You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: extract shared parser runtime to core-parser.ts
Both parser.ts and beta-parser.ts contained an identical parseOutputFormat
implementation (18 lines each): resolve the format object, check for
json_schema type, call format.parse() or JSON.parse(), throw AnthropicError
on failure.
Extract that shared runtime to src/lib/core-parser.ts as
parseAccumulatedFormat(format, content). Both parsers now import and
delegate to it, removing the AnthropicError import from each.
The type-level logic (conditional types, getOutputFormat, deprecated
output_format shim, .parsed getter) stays file-local — it is intentionally
different between the stable and beta paths and has zero runtime cost.
Behaviour preserved exactly: same error message, same fallback to
JSON.parse, same null return when format is absent or non-json_schema.
0 commit comments