Commit Graph
2 Commits
Author SHA1 Message Date
Charlie Marsh 96681d86f0 Deduplicate MCP text fallbacks in Code Mode output (#63540)
## Why

MCP tools can return structured data alongside a JSON text fallback for
clients that need it. Printing the whole result in Code Mode can show
the same data twice.

## What changed

Enable `features.code_mode_mcp_result_dedup` to let `text()` omit
`content` when it prints an original, successful MCP result whose only
content block is a plain text fallback that parses to the same JSON as
`structuredContent`. The JavaScript result retains both fields.

Carry the result format through gRPC so the host can distinguish MCP
results from ordinary JSON. The feature is off by default.

## Testing

Add coverage for both feature flag settings, for printing original MCP
results and copies through gRPC, and for comparing equivalent JSON.

GitOrigin-RevId: a8b0b42f5375d9744c235a0e663090dd5982e37e
2026-11-24 04:49:27 +00:00
Henry Levy d64451b049 Support tool-specific JavaScript preloads in Code Mode (#62430)
## What changed

Let in-process sessions and hosts using stdio or gRPC supply trusted
JavaScript helpers. Run each helper before the cell's module in the same V8
context, only when the cell exposes a unique matching binding with the
expected tool name and namespace.

Report ambiguous bindings and preload failures as bounded cell errors.
Suppress V8 diagnostics on stdout so they cannot corrupt stdio protocol frames.

## Testing

Add coverage for per-session helper selection, exact tool matching, ambiguous
bindings, and bounded compile and execution errors. A stdio subprocess test
checks that a failed preload leaves another session on the same connection
usable. Allow more time for existing CLI and MCP integration tests to connect,
start their test server, or shut down.

GitOrigin-RevId: f9f037de7f9d6018ae755b38475c4131ca7ba1f0
2026-11-19 04:48:49 +00:00