Skip to content

AI Protocol Parser: add ParserConfig for the wuffs JSON parser#46300

Draft
tyxia wants to merge 15 commits into
envoyproxy:mainfrom
tyxia:wuff-config
Draft

AI Protocol Parser: add ParserConfig for the wuffs JSON parser#46300
tyxia wants to merge 15 commits into
envoyproxy:mainfrom
tyxia:wuff-config

Conversation

@tyxia

@tyxia tyxia commented Jul 22, 2026

Copy link
Copy Markdown
Member

Introduces ParserConfig to bound the parsing and capture and control streaming JSON field
extraction on top of WuffsJsonCursor.
The use of ParserConfig are shown in the test handler, agentic(MCP/A2A) and LLM(openAI/Gemini) handler will be implemented in the next PRs.

Capture limitation, (TODO define good defaults)

  • max_body_bytes: pre-feed cap on raw bytes entering the cursor.
  • max_per_scalar_bytes: per-string-value cap. Over-budget values are
    rejected — dropped entirely
  • max_total_scalar_capture_bytes: body-wide retention budget across all captured
    values. A value that would overflow the total is dropped without consuming
    budget, so later smaller values still fit.
  • max_element_capture_bytes: per container byte-range capture.

Two capture modes

  1. Spec-based extraction (extract_fields) — the operator declares exactly
    which fields to extract as pattern paths ("model", "params._meta.traceparent",
    "messages[].role", "tools[].function.name").

  2. Capture-all mode (capture_all_scalars) — captures every scalar value
    (strings, numbers, booleans, nulls) at every depth to maxDepth

Clean-up and Clarification

  • clean up and polish the code comment
  • buildIndex/PatternPath and path tracking are not needed anymore, replaced by matchesPatternPath
  • number token is also bounded by max_body_bytes introduced in this PR.

@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #46300 was opened by tyxia.

see: more, trace.

@tyxia tyxia changed the title config AI protocol parsing: add ParserConfig for the wuffs JSON parser Jul 23, 2026
@tyxia tyxia changed the title AI protocol parsing: add ParserConfig for the wuffs JSON parser AI Protocol Parser: add ParserConfig for the wuffs JSON parser Jul 23, 2026
@tyxia

tyxia commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

/retest

tyxia added 10 commits July 23, 2026 18:25
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
tyxia added 2 commits July 23, 2026 21:48
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
@tyxia

tyxia commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

/retest

tyxia added 3 commits July 24, 2026 11:17
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants