fix(sdk): auto-heal and normalize protocol version in DirectJsonParser
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design
Research direction
The issue is in the DirectJsonParser's compile and parse_and_fix methods. Look for the DirectJsonParser class in the codebase, likely in a file like src/sdk/parser/direct_json_parser.ts. Examine how it processes A2UI message dictionaries. The fix involves checking the 'version' property, adding a leading 'v' if missing, or injecting the catalog version. Run existing tests for the parser to ensure the normalization works.
Written by the indexing model from the issue text.
Description
Description
In the Direct JSON inference format (DirectJsonFormat), the LLM directly emits raw A2UI JSON message streams. The A2UI protocol schemas strictly require a top-level "version" property with a leading 'v' (e.g., "v0.9", "v0.9.1", "v1.0").
Because standard software version conventions use numeric strings (e.g. "0.9", "1.0"), and system prompt workflow rules do not heavily emphasize envelope version string trivia, LLMs frequently omit the leading 'v' (emitting "version": "0.9") or omit the "version" property altogether. This causes non-deterministic schema validation failures (e.g., recent CI evals failure in #2594 where 5 samples failed solely due to '0.9' is not one of ['v0.9', 'v0.9.1']).
In contrast, other inference format compilers (ExpressCompiler, ElementalCompiler, AtomCompiler) deterministically inject the canonical target protocol version into compiled message payloads rather than burdening the LLM with envelope version formatting.
Proposed Solution
- Auto-heal / Normalize Version in
DirectJsonParser:- In
DirectJsonParser.compile()(andparse_and_fix), check each compiled A2UI message dictionary. - If
"version"is missing the leading'v'(e.g."0.9","0.9.1","1.0"), normalize it to"v0.9","v0.9.1", or"v1.0". - If
"version"is omitted entirely, deterministically inject the target protocol version associated with the catalog/format (e.g.f"v{catalog.version}").
- In
- Harmonize Evaluation & Specialist Parsing:
- Ensure
subagent_tooland evaluation scorers rely onDirectJsonParser.compile()so that syntax healing (smart quotes, trailing commas, and version normalization) is consistently applied.
- Ensure
Related
- Relates to #2594
- Dominant language
- TypeScript
- Stars
- 16.4k
- Forks
- 1.3k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 117
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from a2ui-project/a2ui
-
P2 status: first-line-handled type: feature/enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
a2ui-project/a2ui#2643 · 2 comments · 1 assignee ·
-
P2 status: first-line-handled status: needs review type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
a2ui-project/a2ui#2581 · 1 comment · 1 assignee ·
-
P2 status: first-line-handled status: waiting-for-author-response type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
a2ui-project/a2ui#2580 · 1 comment · 1 assignee ·
-
P2 status: first-line-handled type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
a2ui-project/a2ui#2579 · 2 comments · 1 assignee ·
-
P2 status: first-line-handled status: needs review type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
a2ui-project/a2ui#2577 · 1 comment · 1 assignee ·
All issues in a2ui-project/a2ui
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100