Skip to content

refactor(agent): extract text tool-call parser#514

Open
alectimison-maker wants to merge 1 commit into
webbrain-one:mainfrom
alectimison-maker:refactor/extract-tool-call-parser
Open

refactor(agent): extract text tool-call parser#514
alectimison-maker wants to merge 1 commit into
webbrain-one:mainfrom
alectimison-maker:refactor/extract-tool-call-parser

Conversation

@alectimison-maker

Copy link
Copy Markdown
Contributor

Summary

  • extract the raw-text tool-call parser from both browser Agent classes into byte-identical, browser-free modules
  • keep the existing Agent method as a compatibility wrapper with the current default and mode-specific allowlists
  • exercise every currently supported text format directly against production parser code in both builds

Motivation

Local/chat-template models can return tool calls as raw text rather than through a provider's structured tool_calls field. That fallback parser had grown inside both large Agent classes, while most formats were not directly regression-tested. Isolating it makes the security boundary and future parser changes easier to review without changing current behavior.

Design

  • preserve the existing 10,000-character cap, allowlist checks, parsing order, output shape, and fallback IDs
  • keep browser-specific tool-name sets at the Agent call sites
  • mirror the small module in each independently packaged extension tree and enforce byte parity in tests
  • leave parser behavior improvements and broader context-trimming work for separate changes

Testing

  • node test/run.js: 1329 passed, 1 inherited failure (package.json is 25.9.7 while the newest CHANGELOG.md entry is 25.9.0)
  • npm run test:security: 60/60
  • npm run test:fixtures: 125/125
  • npm run test:webmcp: passed with Chrome 150
  • npm run test:ci: passed
  • node --check on both parser modules and both Agent modules
  • git diff --check

Compatibility

No public API, tool schema, accepted format, or browser packaging behavior changes.

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant