graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Stop loading Codex's computer-use plugins
Rach Pradhanf6f1292859bd
diff --git a/docs/adr/0036-computer-use-keeps-the-signed-codex-bridge.md b/docs/adr/0036-computer-use-keeps-the-signed-codex-bridge.mdindex 172398f6..d9c3fc1a 100644--- a/docs/adr/0036-computer-use-keeps-the-signed-codex-bridge.md+++ b/docs/adr/0036-computer-use-keeps-the-signed-codex-bridge.md@@ -1,6 +1,6 @@# 0036. Computer Use keeps the signed Codex bridge-Status: accepted 2026-08-26+Status: superseded by [0313](0313-graff-does-not-load-codex-computer-use.md). Accepted 2026-08-26.## Contextdiff --git a/docs/adr/0119-computer-tools-receive-caller-context.md b/docs/adr/0119-computer-tools-receive-caller-context.mdindex 359ec650..706ca2c9 100644--- a/docs/adr/0119-computer-tools-receive-caller-context.md+++ b/docs/adr/0119-computer-tools-receive-caller-context.md@@ -1,6 +1,6 @@# 0119. Computer tools receive caller-owned turn context-Status: accepted 2026-09-15+Status: superseded by [0313](0313-graff-does-not-load-codex-computer-use.md). Accepted 2026-09-15.## Contextdiff --git a/docs/adr/0209-desktop-app-has-no-computer-use.md b/docs/adr/0209-desktop-app-has-no-computer-use.mdindex 08c4a67c..10ff3b33 100644--- a/docs/adr/0209-desktop-app-has-no-computer-use.md+++ b/docs/adr/0209-desktop-app-has-no-computer-use.md@@ -25,10 +25,9 @@ clicks and keystrokes to Codegraff's own window. Nothing in the app or the MCPserver can reach it, and it never requests permissions.graff's bridge for the Codex Computer Use plugin (ADR 0036, 0119) is separate-and unchanged.+and unchanged. (Since removed: ADR 0313.)## Consequences-The agent cannot drive other macOS apps from the desktop app. A workflow that-needs that uses the Codex Computer Use plugin through graff, which keeps its-own signed process chain. GUI tests keep native input coverage.+The agent cannot drive other macOS apps from the desktop app. GUI tests keep+native input coverage.diff --git a/docs/adr/0313-graff-does-not-load-codex-computer-use.md b/docs/adr/0313-graff-does-not-load-codex-computer-use.mdnew file mode 100644index 00000000..4d9ea1dc--- /dev/null+++ b/docs/adr/0313-graff-does-not-load-codex-computer-use.md@@ -0,0 +1,35 @@+# 0313. graff does not load Codex's computer-use plugins++Status: accepted 2026-11-04. Supersedes [0036](0036-computer-use-keeps-the-signed-codex-bridge.md) and [0119](0119-computer-tools-receive-caller-context.md).++## Context++ADR 0209 took computer use out of the desktop app and left one path: graff+loaded Codex's computer-use plugins and adapted to them. That path was an+adapter to another product's private surface. It launched a process from that+product's install layout, sent the turn metadata its service requires, carried+an elicitation policy written for its JavaScript API, added a skill addendum,+and rewrote its error text. All of that lived in graff's general MCP client for+the benefit of one plugin family.++## Decision++Graff has no computer use of its own and does not offer Codex's. `plugin_codex`+skips the `computer-use` and `unified-computer-use` plugins even when they are+enabled, so neither their MCP servers (`node_repl`, `cua_repl`, the raw client)+nor their skills reach the catalog. The signed-sandbox launcher, turn metadata,+skill addendum and error rewrites are removed.++A server the user configures under any name remains an ordinary MCP server,+with no host metadata (ADR 0007). Graff shows no forms, so every elicitation is+declined, including the defaults it used to fill for read-only requests.++## Consequences++- MCP dispatch has no per-vendor branch, and no state on the agent for it.+- `cua_repl` also served Codex's browser surface; that goes with it. The desktop+ browser pane (ADR 0071) is separate and stays.+- The test-only native input driver (ADR 0209) stays; agents cannot reach it.+- graff still advertises form elicitation in its handshake. Whether it should,+ given that it declines, is a separate decision for every MCP server.+- Computer use in graff, if it returns, is a new decision and a new record.diff --git a/docs/adr/README.md b/docs/adr/README.mdindex 61e3e229..677b10c7 100644--- a/docs/adr/README.md+++ b/docs/adr/README.md@@ -46,7 +46,7 @@ record only when you need the evidence or the edge cases.| [0033](0033-user-can-retire-a-standing-constraint.md) | Only the user retires a standing constraint: TTY `/never` picker (two confirms), ACP/`rm`, or an explicit override. The model cannot. || [0034](0034-remote-images-stay-native.md) | JSON/serve image inputs are a typed URL/base64 union, validated atomically and preserved as native provider vision blocks; never flatten pixels into prompt text. || [0035](0035-first-turn-skips-deferred-mcp-join.md) | First model call after a deferred MCP boot does not wait for the handshake; companion auto-connect is the same defer; native tools run now. |-| [0036](0036-computer-use-keeps-the-signed-codex-bridge.md) | Codex Computer Use keeps its authenticated node_repl process chain: Graff launches it through the signed Codex sandbox wrapper, never embeds V8 or spoofs the service. |+| [0036](0036-computer-use-keeps-the-signed-codex-bridge.md) | Superseded by [0313](0313-graff-does-not-load-codex-computer-use.md). Graff launched Codex Computer Use through its signed sandbox wrapper. || [0037](0037-experiment-pool-is-opt-in.md) | `--experiment N` / `/experiment N` pre-mints a child worktree pool; the root must spawn; pool trees are listed and delivered back, never auto-deleted. || [0038](0038-in-process-acp-core.md) | Same-process embed is `libgraff` + `graff-core.wasm` + `createGraffAgent()` (ACP core, echo turn). Live coding stays `graff acp`. || [0039](0039-local-tools-are-project-scripts.md) | Agent-authored local tools are project scripts under `.graff/tools/`; skills stay instructions. Runtime catalog extras, not `schema.effectiveRootSpecs`. |@@ -127,7 +127,7 @@ record only when you need the evidence or the edge cases.| [0114](0114-live-citations-are-terminal-presentation.md) | Live terminal citations use per-stream display filters with independent reasoning state; structured JSON/ACP output stays unchanged. || [0116](0116-informational-turns-have-bounded-scope.md) | Summary turns gather bounded evidence; coding completion requirements apply to requested changes. || [0118](0118-file-edits-check-target-worktree.md) | File edits checkpoint the target Git worktree; unresolved paths retain the caller checkpoint. |-| [0119](0119-computer-tools-receive-caller-context.md) | Computer-use MCP requests receive opaque caller-owned session and turn context. |+| [0119](0119-computer-tools-receive-caller-context.md) | Superseded by [0313](0313-graff-does-not-load-codex-computer-use.md). Computer-use MCP requests carried caller-owned session and turn context. || [0120](0120-draft-publication-does-not-complete-verification.md) | Superseded by [0250](0250-pr-publication-is-not-gated.md). Draft PRs cannot satisfy verified completion. A draft completes as a labeled, unverified handoff with no user command; ready PRs need passing current-head checks. || [0121](0121-claims-include-repository-identity.md) | Claims include repository identity; literal PR mutations compare the observed repository, PR number and branch, while unknown scopes stay conservative. |@@ -337,6 +337,7 @@ record only when you need the evidence or the edge cases.| [0310](0310-auth-failures-name-the-rejected-credential.md) | A terminal auth rejection names the seat that failed: sign-in text keeps "sign in again"; key and promoted-key texts say "API key was rejected" and never the signed-out phrases. Key seats carry `{"kind":"api_key_rejected","provider":…}` (v1 `-32603` data, v2 `_meta["graff/recovery"]`); `reauth_required` is unchanged. || [0311](0311-tool-refresh-and-addressed-wakes.md) | Claude Agent refreshes a changed tool list with MCP `tools/list_changed` (served before anything else; fresh session if not re-read in 15 s) instead of removing and re-adding its server, which failed held calls. `attempt_completion` settles a task like a final answer: room mail waits for the next human prompt, addressed mail can still start a turn; `yield_turn` stays strict. A peer wake preloads `peer_message`. || [0312](0312-openai-12h-prompt-cache-is-opt-in.md) | OpenAI Responses GPT-5.6+ can put a 12h explicit breakpoint on the stable prefix (`GRAFF_OPENAI_CACHE_TTL=12h` or `openai_cache_ttl`); the default stays 30m (ADR 0009 bytes) until a live probe confirms OpenAI accepts the field and keeps the entry. Usage parses cache writes by TTL. |+| [0313](0313-graff-does-not-load-codex-computer-use.md) | Graff has no computer use and does not load Codex's `computer-use` or `unified-computer-use` plugins; every MCP elicitation is declined. Supersedes 0036 and 0119. || [0302](0302-sse-idle-watchdogs-follow-body-byte-progress.md) | SSE idle watchdogs observe partial body-byte progress, while separate unfinished-event time and size bounds preserve recovery. |diff --git a/evals/harness_behavior.jsonl b/evals/harness_behavior.jsonlindex 2eaa725a..20640864 100644--- a/evals/harness_behavior.jsonl+++ b/evals/harness_behavior.jsonl@@ -95,7 +95,6 @@{"id": "cli-outside-path-recovers-through-shell", "why": "#902/#903: a missing PATH lookup must prompt executable discovery instead of declaring the CLI absent or abandoning the shell workflow.", "env": {"PATH": "/usr/bin:/bin"}, "prompt": "Use the installed fixture CLI to file the local test issue and verify its receipt.", "workspace_seed": {"bin/graff_fixture_cli": "#!/bin/sh\n[ \"$1 $2\" = \"issue create\" ] || exit 2\nprintf \"FILED_LOCALLY\\n\" > \"$HOME/issue-receipt.txt\"\nprintf \"CLI_OPERATION_COMPLETE\\n\"\n"}, "script": [{"tool": "bash", "arguments": {"command": "chmod +x \"$HOME/bin/graff_fixture_cli\""}}, {"tool": "bash", "arguments": {"command": "graff_fixture_cli issue create --title \"Fixture issue\""}}, {"tool": "bash", "arguments": {"command": "if [ -x \"$HOME/bin/graff_fixture_cli\" ]; then \"$HOME/bin/graff_fixture_cli\" issue create --title \"Fixture issue\"; fi"}}, {"tool": "bash", "arguments": {"command": "test -s \"$HOME/issue-receipt.txt\" && cat \"$HOME/issue-receipt.txt\""}}, {"text": "The CLI operation completed."}], "assert": [{"request_contains": {"index": 2, "text": "[CLI lookup]"}}, {"request_contains": {"index": 2, "text": "does not prove the executable is absent"}}, {"request_contains": {"index": -1, "text": "CLI_OPERATION_COMPLETE"}}, {"events_at_least": {"match": {"type": "tool_call", "name": "bash"}, "count": 4}}, {"events_at_most": {"match": {"type": "tool_call"}, "count": 4}}, {"final_text_contains": "The CLI operation completed."}, {"request_contains": {"index": -1, "text": "FILED_LOCALLY"}}]}{"id": "peer-checkpoint-file-target-worktree", "why": "File edits in a nested linked worktree must not inherit parent-checkout peer warnings; actual file changes still land.", "live_peer": true, "args": [], "prompt": "Create an isolated nested worktree, write its notes.txt, and change hello to updated.", "script": [{"tool": "write_file", "arguments": {"path": "nested/notes.txt", "content": "hello"}}, {"tool": "edit_file", "arguments": {"path": "nested/notes.txt", "old_string": "hello", "new_string": "updated"}}, {"tool": "read_file", "arguments": {"path": "nested/notes.txt"}}, {"text": "Updated the isolated worktree file."}], "assert": [{"event": {"type": "tool_call_finished", "name": "write_file", "is_error": false}}, {"event": {"type": "tool_call_finished", "name": "edit_file", "is_error": false}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "write_file", "is_error": true}, "count": 0}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "edit_file", "is_error": true}, "count": 0}}, {"request_contains": {"index": 3, "text": "updated"}}], "nested_worktree": true, "env": {"GRAFF_AUTO_ISOLATE": "off"}}{"id": "peer-checkpoint-file-target-owner", "why": "An edit targeting a nested linked worktree must checkpoint that target worktree owner even when the caller uses the parent checkout.", "nested_worktree": true, "live_peer": true, "peer_in_nested_worktree": true, "args": [], "prompt": "Write hello to nested/notes.txt; acknowledge any shared-tree checkpoint before retrying.", "script": [{"tool": "write_file", "arguments": {"path": "nested/notes.txt", "content": "hello"}}, {"tool": "write_file", "arguments": {"path": "nested/notes.txt", "content": "hello"}}, {"text": "Created after the target-owner checkpoint."}], "assert": [{"events_at_least": {"match": {"type": "tool_call_finished", "name": "write_file", "is_error": true}, "count": 1}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "write_file", "is_error": true}, "count": 1}}, {"event": {"type": "tool_call_finished", "name": "write_file", "is_error": false}}, {"request_contains": {"index": 1, "text": "shared-tree checkpoint"}}]}-{"id": "computer-tool-turn-context", "why": "Computer-use MCP calls require stable caller session and turn context, with a new turn identifier on the next user turn.", "env": {"GRAFF_MCP_SCHEMA_BUDGET": "0", "GRAFF_MCP_PROBE": "0", "GRAFF_LEARN_AUTO": "off"}, "workspace_seed": {".mcp.json": "{\"mcpServers\": {\"cua_repl\": {\"command\": \"python3\", \"args\": [\"context_mcp.py\"]}}}", "context_mcp.py": "import json, sys\nfirst = None\ncalls = 0\nfor line in sys.stdin:\n r = json.loads(line)\n if 'id' not in r: continue\n method = r.get('method')\n if method == 'initialize':\n result = {'protocolVersion':'2025-06-18','capabilities':{'tools':{}},'serverInfo':{'name':'fixture','version':'1'}}\n elif method == 'tools/list':\n result = {'tools':[{'name':'js','description':'Check caller context','inputSchema':{'type':'object','properties':{'code':{'type':'string'}}}}]}\n elif method == 'tools/call':\n calls += 1\n meta = r['params'].get('_meta', {}).get('x-codex-turn-metadata', {})\n if isinstance(meta, str): meta = json.loads(meta)\n valid = all(isinstance(meta.get(key), str) and meta[key] for key in ('session_id','turn_id'))\n if calls == 1:\n first = meta\n valid = valid\n elif calls == 2: valid = valid and meta == first\n else: valid = valid and meta['session_id'] == first.get('session_id') and meta['turn_id'] != first.get('turn_id')\n text = ('initial context received' if calls == 1 else 'same-turn context preserved' if calls == 2 else 'next-turn context rotated') if valid else 'context missing or incorrectly scoped'\n result = {'content':[{'type':'text','text':text}], 'isError':not valid}\n else: result = {}\n print(json.dumps({'jsonrpc':'2.0','id':r['id'],'result':result}),flush=True)\n"}, "prompt": "Load the context-check tool and call it twice.", "second_prompt": "Call the context-check tool once more.", "script": [{"tool": "load_tool_schemas", "arguments": {"server": "cua_repl"}}, {"tool": "mcp__cua_repl__js", "arguments": {"code": "first"}}, {"tool": "mcp__cua_repl__js", "arguments": {"code": "same"}}, {"text": "Both calls completed."}, {"tool": "mcp__cua_repl__js", "arguments": {"code": "next"}}, {"text": "Context verified."}], "assert": [{"request_contains": {"index": 2, "text": "initial context received"}}, {"request_contains": {"index": 3, "text": "same-turn context preserved"}}, {"request_contains": {"index": 5, "text": "next-turn context rotated"}}, {"events_at_most": {"match": {"type": "tool_call_finished", "name": "mcp__cua_repl__js", "is_error": true}, "count": 0}}]}{"id":"repository-scoped-claim-release","why":"#925: production claim dispatch and persisted records must distinguish identical PR numbers in different repositories; releasing one must preserve the other.","args":["--old"],"github_fixture":{},"prompt":"Acquire the two repository claims, release the first, and inspect the second.","script":[{"tool":"peer_message","arguments":{"action":"claim","kind":"pull_request","key":"1","repo":"fixture/first"}},{"tool":"peer_message","arguments":{"action":"claim","kind":"pull_request","key":"1","repo":"fixture/second"}},{"tool":"peer_message","arguments":{"action":"release","kind":"pull_request","key":"1","repo":"fixture/first"}},{"tool":"peer_message","arguments":{"action":"status","kind":"pull_request","key":"1","repo":"fixture/second"}},{"text":"The second repository claim remains held."}],"assert":[{"request_contains":{"text":"claim pull_request 1: mine"}},{"events_at_most":{"match":{"type":"tool_call_finished","name":"peer_message","is_error":true},"count":0}},{"final_text_contains":"The second repository claim remains held."}]}{"id":"human-workflow-clarify-edit-recover-followup","why":"#106: a two-file task preserves user clarification, recovers from a failed edit, and handles a follow-up; independent checks reject a plausible but absent result.","args":["--old"],"env":{"GRAFF_NO_CODEDB_GUARD":"1"},"workspace_seed":{"normalize.py":"def normalize(text):\n return text.lower()\n","client.py":"def render(items):\n return \",\".join(items)\n","README.md":"Keep this documentation unchanged.\n"},"prompt":"Make render trim labels using the existing normalizer. Clarify whether to preserve case before editing. Keep the README unchanged, and verify the actual result.","controls_after_turn":[{"type":"answer","text":"Preserve case exactly; trim surrounding whitespace only."}],"second_prompt":"Now skip empty and whitespace-only labels too. Keep the earlier case behavior, and test that input lists stay unchanged.","script":[{"tool":"read_file","arguments":{"path":"normalize.py"}},{"tool":"read_file","arguments":{"path":"client.py"}},{"tool":"ask_user","arguments":{"question":"Should label case be preserved or normalized?","options":["Preserve case","Lowercase"]}},{"tool":"bash","arguments":{"command":"python3 -c 'from client import render; assert render([\" A \", \"B \"]) == \"A,B\"; print(\"render checks passed\")'"}},{"tool":"edit_file","arguments":{"path":"normalize.py","old_string":" return text.upper()","new_string":" return text.strip()"}},{"tool":"read_file","arguments":{"path":"normalize.py"}},{"tool":"edit_file","arguments":{"path":"normalize.py","old_string":" return text.lower()","new_string":" return text.strip()"}},{"tool":"edit_file","arguments":{"path":"client.py","old_string":"def render(items):\n return \",\".join(items)\n","new_string":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items)\n"}},{"tool":"bash","arguments":{"command":"python3 -c 'from client import render; assert render([\" A \", \"B \"]) == \"A,B\"; print(\"render checks passed\")'"}},{"text":"Both files now trim labels while preserving case. The render checks passed; README is unchanged."},{"tool":"read_file","arguments":{"path":"client.py"}},{"tool":"edit_file","arguments":{"path":"client.py","old_string":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items)\n","new_string":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items if normalize(item))\n"}},{"tool":"bash","arguments":{"command":"python3 -c 'from client import render; x=[\" A \",\" \",\"B\",\"\"]; before=x.copy(); assert render(x)==\"A,B\"; assert x==before; assert render([])==\"\"; print(\"follow-up checks passed\")'"}},{"text":"Blank labels are skipped. Case and input lists are preserved; follow-up checks passed."}],"verify_command":["python3","-c","from client import render; from normalize import normalize; x=[\" Ab \",\" \",\"cD\",\"\"]; before=x.copy(); assert render(x)==\"Ab,cD\"; assert x==before; assert render([])==\"\"; assert normalize(\" X \")==\"X\"; print(\"independent outcomes passed\")"],"assert":[{"event":{"type":"ask_user","question":"Should label case be preserved or normalized?"}},{"event":{"type":"tool_result","name":"ask_user","is_error":false,"text":"Preserve case exactly; trim surrounding whitespace only."}},{"event":{"type":"tool_call_finished","name":"edit_file","is_error":true}},{"event":{"type":"tool_call_finished","name":"bash","is_error":true}},{"events_at_least":{"match":{"type":"turn"},"count":2}},{"request_contains":{"text":"Preserve case exactly"}},{"final_text_contains":"follow-up checks passed"},{"file_equals":{"path":"normalize.py","content":"def normalize(text):\n return text.strip()\n"}},{"file_equals":{"path":"client.py","content":"from normalize import normalize\n\ndef render(items):\n return \",\".join(normalize(item) for item in items if normalize(item))\n"}},{"file_equals":{"path":"README.md","content":"Keep this documentation unchanged.\n"}},{"request_contains":{"index":3,"text":"Preserve case exactly"}},{"request_tool_calls_at_most":{"index":3,"name":"edit_file","count":0}}]}{"id":"human-workflow-missing-config-clarify-followup","why":"#106: failed navigation cannot become an invented setting; a human supplies the actual path, then a later requested edit preserves unrelated configuration.","args":["--old"],"env":{"GRAFF_NO_CODEDB_GUARD":"1"},"workspace_seed":{"config/settings.json":"{\"retries\": 3, \"timeout\": 10}\n","README.md":"Do not change me.\n"},"prompt":"Check settings.json for the retry count. If it is missing, ask me where it lives; do not create a replacement or change anything yet.","controls_after_turn":[{"type":"answer","text":"It is config/settings.json. Read that existing file."}],"second_prompt":"Raise retries to 4 in that file, preserve timeout, and validate the JSON.","script":[{"tool":"read_file","arguments":{"path":"settings.json"}},{"tool":"ask_user","arguments":{"question":"Where is the existing settings file?"}},{"tool":"read_file","arguments":{"path":"config/settings.json"}},{"text":"The existing retry count is 3. No files were changed."},{"tool":"edit_file","arguments":{"path":"config/settings.json","old_string":"\"retries\": 3","new_string":"\"retries\": 4"}},{"tool":"bash","arguments":{"command":"python3 -c 'import json; x=json.load(open(\"config/settings.json\")); assert x=={\"retries\":4,\"timeout\":10}; print(\"configuration validated\")'"}},{"text":"Retries are 4; timeout remains 10. Configuration validated."}],"verify_command":["python3","-c","import json,pathlib; assert json.loads(pathlib.Path(\"config/settings.json\").read_text())=={\"retries\":4,\"timeout\":10}; assert not pathlib.Path(\"settings.json\").exists(); print(\"independent configuration passed\")"],"assert":[{"event":{"type":"tool_call_finished","name":"read_file","is_error":true}},{"event":{"type":"ask_user","question":"Where is the existing settings file?"}},{"events_at_least":{"match":{"type":"turn"},"count":2}},{"no_event":{"type":"tool_call","name":"write_file"}},{"request_contains":{"text":"Read that existing file"}},{"final_text_contains":"timeout remains 10"},{"file_equals":{"path":"config/settings.json","content":"{\"retries\": 4, \"timeout\": 10}\n"}},{"file_equals":{"path":"README.md","content":"Do not change me.\n"}},{"request_contains":{"index":2,"text":"config/settings.json. Read that existing file."}},{"request_tool_calls_at_most":{"index":2,"name":"edit_file","count":0}}]}diff --git a/scripts/eval/tier1-manifest.json b/scripts/eval/tier1-manifest.jsonindex 0ae7997d..f5b4719a 100644--- a/scripts/eval/tier1-manifest.json+++ b/scripts/eval/tier1-manifest.json@@ -14,7 +14,7 @@"src/main.zig","src/repl.zig"],- "test_count_baseline": 3627,+ "test_count_baseline": 3609,"test_count_slack": 25,"required_invariants": [{diff --git a/src/agent.zig b/src/agent.zigindex 95cc3eb4..23a308ec 100644--- a/src/agent.zig+++ b/src/agent.zig@@ -114,7 +114,6 @@ pub const Agent = struct {/// process mode (engine_sink.forAgent); set to inject a custom frontend.sink: ?@import("engine_sink.zig").EngineSink = null,registry: ?*mcp.Registry = null,- mcp_context: @import("mcp_turn_context.zig").State = .{},permission: ?@import("engine_permission.zig").Handler = null,approvals: ?*approvals_mod.Approvals = null, // shared bash-approval state, set by main()tracer: ?*trace.Tracer = null, // shared JSONL event trace, set by main()diff --git a/src/agent_argstream.zig b/src/agent_argstream.zigindex 474ffd46..b4012e83 100644--- a/src/agent_argstream.zig+++ b/src/agent_argstream.zig@@ -47,7 +47,6 @@ fn toolCtx(self: *Agent) tools_mod.ToolCtx {.jev_effort_pending = &self.jev_effort_pending,.subagent_provider = self.subagent_provider,.subagent_cross_provider = self.subagent_cross_provider,- .mcp_context = self.mcp_context.value,.registry = if (self.sub) null else self.registry,.from_sub = self.sub,.interactive_children = !self.sub and @import("subagent_interactive.zig").enabled.load(.acquire),diff --git a/src/agent_eval.zig b/src/agent_eval.zigindex 08386dc2..43885e63 100644--- a/src/agent_eval.zig+++ b/src/agent_eval.zig@@ -348,7 +348,6 @@ pub fn runJudge(self: *Agent, rubric: []const u8, eval_output: []const u8, note:.provider = self.provider,.subagent_provider = self.subagent_provider,.subagent_cross_provider = self.subagent_cross_provider,- .mcp_context = self.mcp_context.value,.registry = if (self.sub) null else self.registry,.from_sub = self.sub,.has_eval = self.eval_cmd != null,diff --git a/src/agent_tool_batch.zig b/src/agent_tool_batch.zigindex 65c74b32..8d6dbbf1 100644--- a/src/agent_tool_batch.zig+++ b/src/agent_tool_batch.zig@@ -70,7 +70,6 @@ pub fn context(self: *Agent) ToolCtx {.jev_effort_pending = &self.jev_effort_pending,.subagent_provider = self.subagent_provider,.subagent_cross_provider = self.subagent_cross_provider,- .mcp_context = self.mcp_context.value,.registry = self.registry,.from_sub = self.sub,.interactive_children = !self.sub and @import("subagent_interactive.zig").enabled.load(.acquire),diff --git a/src/agent_turn.zig b/src/agent_turn.zigindex 8df6379e..97e88777 100644--- a/src/agent_turn.zig+++ b/src/agent_turn.zig@@ -24,7 +24,6 @@ pub fn run(self: *Agent, root_turn_prepared: *std.atomic.Value(bool)) anyerror![self.yielded = null;self.read_miss.reset();self.tool_repeat.reset();- self.mcp_context.begin(self.io);@import("named_work.zig").beginTurn(self);try self.ensureRootTools(self.provider.kind);var task_scope = @import("task_intent.zig").State.begin(self);diff --git a/src/codex_node_repl.zig b/src/codex_node_repl.zigdeleted file mode 100644index 8f5391c3..00000000--- a/src/codex_node_repl.zig+++ /dev/null@@ -1,251 +0,0 @@-//! Codex Computer Use bridge for a standalone Graff process (#618).-//!-//! The bundled Computer Use skill is the `node-repl` content variant. Its-//! `@oai/sky` service authenticates the process chain on macOS, so starting-//! either node_repl or the plugin's direct MCP client under Graff fails with-//! "Sender process is not authenticated". Keep that boundary intact: launch-//! Codex's configured node_repl through the sibling, signed Codex sandbox-//! binary and expose its three MCP tools. This is deliberately not a generic-//! JavaScript runtime (ADR 0023); callers only invoke it for that plugin-//! variant, and the resulting MCP server still goes through normal consent.--const std = @import("std");-const builtin = @import("builtin");-const Io = std.Io;-const Allocator = std.mem.Allocator;-const Value = std.json.Value;--pub const server_name = "node_repl";--const node_suffix = "/cua_node/bin/node_repl";-const socket_rel = "Library/Group Containers/2DC432GLL2.com.openai.sky.CUAService/IPC";--fn join(arena: Allocator, a: []const u8, b: []const u8) ?[]const u8 {- return std.fmt.allocPrint(arena, "{s}/{s}", .{ std.mem.trimEnd(u8, a, "/"), std.mem.trimStart(u8, b, "/") }) catch null;-}--fn stripComment(raw: []const u8) []const u8 {- var quoted = false;- var quote: u8 = 0;- for (raw, 0..) |c, i| {- if ((c == '\'' or c == '"') and (i == 0 or raw[i - 1] != '\\')) {- if (!quoted) {- quoted = true;- quote = c;- } else if (c == quote) quoted = false;- } else if (c == '#' and !quoted) return std.mem.trim(u8, raw[0..i], " \t\r");- }- return std.mem.trim(u8, raw, " \t\r");-}--fn tableName(line: []const u8) ?[]const u8 {- if (line.len < 3 or line[0] != '[' or line[line.len - 1] != ']') return null;- return std.mem.trim(u8, line[1 .. line.len - 1], " \t");-}--fn nodeTable(name: []const u8) bool {- return std.mem.eql(u8, name, "mcp_servers.node_repl") or- std.mem.eql(u8, name, "mcp_servers.\"node_repl\"") or- std.mem.eql(u8, name, "mcp_servers.'node_repl'");-}--/// Only accept a plain TOML string. Reject escapes rather than mis-resolving a-/// security-sensitive executable path with a half TOML parser.-fn stringValue(line: []const u8, key: []const u8) ?[]const u8 {- const eq = std.mem.indexOfScalar(u8, line, '=') orelse return null;- if (!std.mem.eql(u8, std.mem.trim(u8, line[0..eq], " \t"), key)) return null;- const value = std.mem.trim(u8, line[eq + 1 ..], " \t");- if (value.len < 2 or value[0] != value[value.len - 1] or (value[0] != '"' and value[0] != '\'')) return null;- const inner = value[1 .. value.len - 1];- if (std.mem.indexOfScalar(u8, inner, '\\') != null) return null;- return inner;-}--fn configuredCommand(text: []const u8) ?[]const u8 {- var in_node = false;- var lines = std.mem.splitScalar(u8, text, '\n');- while (lines.next()) |raw| {- const line = stripComment(raw);- if (line.len == 0) continue;- if (tableName(line)) |name| {- in_node = nodeTable(name);- continue;- }- if (in_node) if (stringValue(line, "command")) |command| return command;- }- return null;-}--fn putString(arena: Allocator, object: *std.json.ObjectMap, key: []const u8, value: []const u8) bool {- object.put(arena, key, .{ .string = arena.dupe(u8, value) catch return false }) catch return false;- return true;-}--fn appendString(arena: Allocator, array: *std.json.Array, value: []const u8) bool {- array.append(.{ .string = arena.dupe(u8, value) catch return false }) catch return false;- return true;-}--/// Build the signed-sandbox MCP server object. The macOS gate lives on-/// `merge`: this helper stays OS-agnostic so Linux/Windows CI can still-/// prove the argv/env shape (ADR 0036).-fn serverFromCommand(io: Io, arena: Allocator, home: []const u8, project_dir: []const u8, node_command: []const u8) ?Value {- if (home.len == 0 or project_dir.len == 0) return null;- if (!std.mem.endsWith(u8, node_command, node_suffix)) return null;- const resources = node_command[0 .. node_command.len - node_suffix.len];- if (resources.len == 0) return null;-- const codex = join(arena, resources, "codex") orelse return null;- const node = join(arena, resources, "cua_node/bin/node") orelse return null;- const modules = join(arena, resources, "cua_node/lib/node_modules") orelse return null;- const codex_home = join(arena, home, ".codex") orelse return null;- const computer_use_app = join(arena, codex_home, "computer-use/Codex Computer Use.app") orelse return null;- const socket = join(arena, home, socket_rel) orelse return null;- if ((Io.Dir.cwd().statFile(io, codex, .{}) catch null) == null or- (Io.Dir.cwd().statFile(io, node_command, .{}) catch null) == null or- (Io.Dir.cwd().statFile(io, node, .{}) catch null) == null) return null;-- var args = std.json.Array.init(arena);- for ([_][]const u8{- "sandbox", "-P", ":danger-full-access", "-C", project_dir,- "--allow-unix-socket", socket, "--", node_command,- }) |arg| if (!appendString(arena, &args, arg)) return null;-- const trusted_code = std.fmt.allocPrint(arena, "{s}:{s}", .{ codex_home, modules }) catch return null;- var env: std.json.ObjectMap = .empty;- const pairs = [_][2][]const u8{- .{ "HOME", home },- .{ "PATH", "/usr/bin:/bin:/usr/sbin:/sbin" },- .{ "TMPDIR", "/tmp" },- .{ "CODEX_HOME", codex_home },- .{ "CODEX_CLI_PATH", codex },- .{ "NODE_REPL_NODE_PATH", node },- .{ "NODE_REPL_NODE_MODULE_DIRS", modules },- .{ "NODE_REPL_TRUSTED_CODE_PATHS", trusted_code },- .{ "NODE_REPL_TRUSTED_SERVICES", "{\"sky\":\"@oai/sky/service\"}" },- .{ "NODE_REPL_NATIVE_PIPE_CONNECT_TIMEOUT_MS", "1000" },- .{ "NODE_REPL_INSTRUCTIONS_USE_CASE_COMPUTER_USE", "Control desktop apps on macOS through Computer Use." },- .{ "SKY_CUA_SERVICE_PATH", computer_use_app },- };- for (pairs) |pair| if (!putString(arena, &env, pair[0], pair[1])) return null;-- var cfg: std.json.ObjectMap = .empty;- if (!putString(arena, &cfg, "command", codex)) return null;- cfg.put(arena, "args", .{ .array = args }) catch return null;- cfg.put(arena, "env", .{ .object = env }) catch return null;- if (!putString(arena, &cfg, "cwd", project_dir)) return null;- return .{ .object = cfg };-}--/// Fill `node_repl` only when Graff/user config did not already provide it.-/// True means a usable bridge already existed or was synthesized, so callers-/// should not advertise the plugin's unauthenticated direct client instead.-pub fn merge(io: Io, arena: Allocator, home: []const u8, project_dir: []const u8, servers: *std.json.ObjectMap, found: *bool) bool {- if (servers.get(server_name) != null) return true;- if (builtin.os.tag != .macos) return false;- const config_path = join(arena, home, ".codex/config.toml") orelse return false;- const text = Io.Dir.cwd().readFileAlloc(io, config_path, arena, .limited(1 << 20)) catch return false;- const command = configuredCommand(text) orelse return false;- const server = serverFromCommand(io, arena, home, project_dir, command) orelse return false;- servers.put(arena, server_name, server) catch return false;- found.* = true;- return true;-}--const testing = std.testing;--test "configuredCommand reads only the node_repl MCP table (#618)" {- const text =- \\[mcp_servers.other]- \\command = "/wrong"- \\[mcp_servers."node_repl"] # selected- \\args = []- \\command = "/Applications/ChatGPT.app/Contents/Resources/cua_node/bin/node_repl"- \\[mcp_servers.after]- \\command = "/also-wrong"- ;- try testing.expectEqualStrings(- "/Applications/ChatGPT.app/Contents/Resources/cua_node/bin/node_repl",- configuredCommand(text).?,- );- try testing.expect(configuredCommand("[mcp_servers.node_repl]\ncommand = \"bad\\npath\"\n") == null);-}--fn writeBridgeTree(io: Io, arena: Allocator, base: []const u8) ![]const u8 {- const resources = join(arena, base, "ChatGPT.app/Contents/Resources") orelse return error.OutOfMemory;- try Io.Dir.cwd().createDirPath(io, join(arena, resources, "cua_node/bin") orelse return error.OutOfMemory);- const command = join(arena, resources, "cua_node/bin/node_repl") orelse return error.OutOfMemory;- try Io.Dir.cwd().writeFile(io, .{ .sub_path = command, .data = "" });- try Io.Dir.cwd().writeFile(io, .{- .sub_path = join(arena, resources, "cua_node/bin/node") orelse return error.OutOfMemory,- .data = "",- });- try Io.Dir.cwd().writeFile(io, .{- .sub_path = join(arena, resources, "codex") orelse return error.OutOfMemory,- .data = "",- });- return command;-}--test "serverFromCommand refuses a lookalike executable tree" {- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- try testing.expect(serverFromCommand(testing.io, arena_state.allocator(), "/home/a", "/repo", "/tmp/node_repl") == null);-}--test "serverFromCommand builds the signed Codex sandbox bridge (#618)" {- var tmp = testing.tmpDir(.{});- defer tmp.cleanup();- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- const arena = arena_state.allocator();- var buf: [std.fs.max_path_bytes]u8 = undefined;- const n = try tmp.dir.realPath(testing.io, &buf);- const base = try arena.dupe(u8, buf[0..n]);- const command = try writeBridgeTree(testing.io, arena, base);-- const home = join(arena, base, "home").?;- const cfg = serverFromCommand(testing.io, arena, home, base, command).?.object;- try testing.expectEqualStrings(join(arena, base, "ChatGPT.app/Contents/Resources/codex").?, cfg.get("command").?.string);- try testing.expectEqualStrings(base, cfg.get("cwd").?.string);- const args = cfg.get("args").?.array.items;- try testing.expectEqualStrings("sandbox", args[0].string);- try testing.expectEqualStrings(":danger-full-access", args[2].string);- try testing.expectEqualStrings("--allow-unix-socket", args[5].string);- try testing.expectEqualStrings(command, args[8].string);- const env = cfg.get("env").?.object;- try testing.expectEqualStrings("{\"sky\":\"@oai/sky/service\"}", env.get("NODE_REPL_TRUSTED_SERVICES").?.string);- try testing.expect(std.mem.endsWith(u8, env.get("SKY_CUA_SERVICE_PATH").?.string, "Codex Computer Use.app"));-}--test "merge synthesizes the signed bridge only on macOS (#618)" {- var tmp = testing.tmpDir(.{});- defer tmp.cleanup();- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- const arena = arena_state.allocator();- var buf: [std.fs.max_path_bytes]u8 = undefined;- const n = try tmp.dir.realPath(testing.io, &buf);- const base = try arena.dupe(u8, buf[0..n]);- const command = try writeBridgeTree(testing.io, arena, base);- const home = join(arena, base, "home").?;- try Io.Dir.cwd().createDirPath(testing.io, join(arena, home, ".codex").?);- const toml = try std.fmt.allocPrint(arena, "[mcp_servers.node_repl]\ncommand = \"{s}\"\n", .{command});- try Io.Dir.cwd().writeFile(testing.io, .{- .sub_path = join(arena, home, ".codex/config.toml").?,- .data = toml,- });-- var servers: std.json.ObjectMap = .empty;- var found = false;- const ok = merge(testing.io, arena, home, base, &servers, &found);- if (builtin.os.tag == .macos) {- try testing.expect(ok);- try testing.expect(found);- try testing.expect(servers.get(server_name) != null);- } else {- try testing.expect(!ok);- try testing.expect(!found);- try testing.expect(servers.get(server_name) == null);- }-}diff --git a/src/exec.zig b/src/exec.zigindex 8fbd08fb..765d0dc7 100644--- a/src/exec.zig+++ b/src/exec.zig@@ -183,7 +183,7 @@ fn execToolInner(ctx: ToolCtx, call: ToolCall) !ToolOutput {return failure(gpa, err);};defer prepared.deinit(gpa);- const r = reg.callWithContext(gpa, call.name, prepared.value, ctx.mcp_context) catch |err| {+ const r = reg.call(gpa, call.name, prepared.value) catch |err| {codedbpro_report.onFailure(ctx, call.name, @errorName(err));return failure(gpa, err);};diff --git a/src/main.zig b/src/main.zigindex 196d2dbd..beacc7c8 100644--- a/src/main.zig+++ b/src/main.zig@@ -54,7 +54,6 @@ test {_ = @import("repo_transaction.zig");_ = .{ @import("pr_command.zig"), @import("pr_evidence.zig"), @import("artifact_repository.zig"), @import("artifact_claim_ledger.zig"), @import("artifact_claim_store.zig"), @import("artifact_claim_stale.zig"), @import("artifact_claim_unresolved.zig"), @import("artifact_claim_inventory.zig") };_ = .{ @import("argstream_citation_tests.zig"), @import("acp_reauth_tests.zig"), @import("auth_recovery.zig") }; // unit_tests' root is main.zig only, so reference every split-out module or its tests silently never run- _ = @import("codex_node_repl.zig");_ = pricing;_ = models_cache;_ = .{ ansi, @import("agent_markdown_inline.zig"), @import("terminal_workers_tests.zig") };@@ -596,5 +595,5 @@ test { // ── Unit tests (`zig build test`): pull in tests from imported modu_ = .{ @import("acp_agent_activity.zig"), @import("acp_subagent_live.zig"), @import("acp_line_writer.zig") };_ = .{ @import("acp_replay.zig"), @import("python_version.zig"), @import("jev_auto.zig"), @import("background_wait.zig"), @import("gateway_compact_tests.zig") };_ = @import("read_image.zig");- _ = .{ @import("mcp_interop_tests.zig"), @import("mcp_inbound.zig"), @import("mcp_names.zig"), @import("workspace_history.zig"), @import("file_worktree.zig"), @import("mcp_turn_context.zig"), @import("review_deadline.zig"), @import("issue_cmd.zig"), @import("shell_tool.zig"), @import("acp_ask.zig"), @import("side_steer.zig"), @import("task_workspace_tests.zig"), @import("workspace_prepare_tests.zig"), @import("worktree_reap.zig") };+ _ = .{ @import("mcp_interop_tests.zig"), @import("mcp_inbound.zig"), @import("mcp_names.zig"), @import("workspace_history.zig"), @import("file_worktree.zig"), @import("review_deadline.zig"), @import("issue_cmd.zig"), @import("shell_tool.zig"), @import("acp_ask.zig"), @import("side_steer.zig"), @import("task_workspace_tests.zig"), @import("workspace_prepare_tests.zig"), @import("worktree_reap.zig") };}diff --git a/src/mcp.zig b/src/mcp.zigindex 3ce80195..1a5c7457 100644--- a/src/mcp.zig+++ b/src/mcp.zig@@ -441,12 +441,9 @@ pub const Registry = struct {/// Calls and runtime registration share one lock, including tool lookup.pub fn call(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Value) !@import("mcp_call.zig").CallResult {- return reg.callWithContext(out_alloc, qualified, input, null);- }- pub fn callWithContext(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Value, context: ?@import("mcp_turn_context.zig").Snapshot) !@import("mcp_call.zig").CallResult {reg.mutex.lockUncancelable(reg.io);defer reg.mutex.unlock(reg.io);- return @import("mcp_call.zig").call(reg, out_alloc, qualified, input, context);+ return @import("mcp_call.zig").call(reg, out_alloc, qualified, input);}};diff --git a/src/mcp_call.zig b/src/mcp_call.zigindex 25ceb009..1f489473 100644--- a/src/mcp_call.zig+++ b/src/mcp_call.zig@@ -6,7 +6,6 @@ const Value = std.json.Value;const Registry = @import("mcp.zig").Registry;const mcp_rpc = @import("mcp_rpc.zig");const mcp_protocol = @import("mcp_protocol.zig");-const mcp_elicitation = @import("mcp_elicitation.zig");const initializeServer = mcp_rpc.initializeServer;const request = mcp_rpc.request;const renderResult = @import("mcp_content.zig").renderResult;@@ -48,8 +47,8 @@ pub const Withdrawn = struct { qualified_name: []const u8, server: []const u8, rconst restart_hint = "Inspect /mcp; `/mcp reconnect <server>` starts it again without a new session, then reload its tool schemas.";/// The registry lock is held throughout. Never replay a possibly executed call.-pub fn call(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Value, context: ?@import("mcp_turn_context.zig").Snapshot) !CallResult {- return invoke(reg, out_alloc, qualified, input, context) catch |err| switch (err) {+pub fn call(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Value) !CallResult {+ return invoke(reg, out_alloc, qualified, input) catch |err| switch (err) {error.McpClosed, error.ReadFailed, error.WriteFailed, error.BrokenPipe, error.ConnectionResetByPeer => blk: {if (try @import("mcp_restart.zig").closeForRestart(reg, out_alloc, qualified, @errorName(err))) |text| break :blk .{ .text = text, .is_error = true };try withdrawServer(reg, qualified, @errorName(err));@@ -114,7 +113,7 @@ pub fn unavailableLoad(reg: *Registry, a: Allocator, input: Value) ?[]const u8 {return std.fmt.allocPrint(a, "MCP service {s} is unavailable: its connection closed or failed earlier in this session ({s}) and its tools were withdrawn, so nothing was loaded and {s} cannot be called. " ++ restart_hint, .{ hit.server, hit.reason, hit.qualified_name }) catch null;}-fn invoke(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Value, context: ?@import("mcp_turn_context.zig").Snapshot) !CallResult {+fn invoke(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Value) !CallResult {const tool = for (reg.tools) |t| {if (std.mem.eql(u8, t.qualified_name, qualified)) break t;} else {@@ -126,8 +125,7 @@ fn invoke(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Va};const server = reg.servers[tool.server_index];- const turn_ctx = @import("mcp_turn_context.zig").effective(context, reg.io, server.name);- const params = try @import("mcp_turn_context.zig").params(reg.gpa, server.name, tool.original_name, input, turn_ctx);+ const params = try std.json.Stringify.valueAlloc(reg.gpa, .{ .name = tool.original_name, .arguments = input }, .{});defer reg.gpa.free(params);// Tool responses can be large and numerous; keep them out of the@@ -138,8 +136,6 @@ fn invoke(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Vaif (server.transport == .dormant) @import("mcp_lazy.zig").wake(reg, server) catch |err|return .{ .text = try std.fmt.allocPrint(out_alloc, "MCP server {s} failed to start: {t}", .{ server.name, err }), .is_error = true };if (!server.initialized) try initializeServer(server, response_alloc, reg.arena(), null);- server.elicit_source = params;- defer server.elicit_source = "";const first_resp = request(server, response_alloc, params, "tools/call", tool.original_name) catch |err| switch (err) {// Streamable HTTP servers use 404 to expire a session. Re-run the// MCP handshake once, then retry the call without the stale ID.@@ -174,8 +170,6 @@ fn invoke(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Vaconst c = e.object.get("code") orelse break :blk 0;break :blk if (c == .integer) c.integer else 0;} else 0;- if (mcp_elicitation.looksUnavailable(msg))- return .{ .text = try out_alloc.dupe(u8, mcp_elicitation.fallback), .is_error = true };const text = if (code != 0)try std.fmt.allocPrint(out_alloc, "MCP error {d}: {s}", .{ code, msg })else@@ -213,16 +207,5 @@ fn invoke(reg: *Registry, out_alloc: Allocator, qualified: []const u8, input: Va.supports_vision = reg.vision_capable,}, response_alloc);const text = try ow.toOwnedSlice();- if (mcp_elicitation.looksUnavailable(text)) {- out_alloc.free(text);- return .{ .text = try out_alloc.dupe(u8, mcp_elicitation.fallback), .is_error = true };- }- if (mcp_elicitation.rejectsApp(text)) {- defer out_alloc.free(text);- // The note follows the original text, so a structured range still- // addresses the same bytes in the copy.- const noted = try std.mem.concat(out_alloc, u8, &.{ text, mcp_elicitation.bare_process_app_note });- return .{ .text = noted, .is_error = is_error, .run_task = run_task, .structured_text = if (structured_range) |range| noted[range.start..range.end] else null };- }return .{ .text = text, .is_error = is_error, .run_task = run_task, .structured_text = if (structured_range) |range| text[range.start..range.end] else null };}diff --git a/src/mcp_elicitation.zig b/src/mcp_elicitation.zigindex b54b1284..e6960131 100644--- a/src/mcp_elicitation.zig+++ b/src/mcp_elicitation.zig@@ -1,14 +1,7 @@-//! MCP form elicitation for the signed Codex Computer Use bridge (#768).-//!-//! `node_repl` / `@oai/sky` call `nodeRepl.createElicitation` before desktop-//! work. Clients that advertise no form capability fail the JS call before any-//! accessibility state returns. Graff advertises form mode and answers-//! `elicitation/create` on the stdio request-scoped channel:-//!-//! - read-only `get_app_state` (especially `disableDiff: true`) is accepted-//! with schema defaults — inspect is not a confirmation prompt;-//! - URL mode and mutating sky input are declined with an actionable fallback-//! (reconnect MCP). Do not embed V8 or spoof Codex.+//! MCP form elicitation. graff shows no forms, so a server that asks for+//! input mid-call gets a decline rather than a call that never finishes:+//! `elicitation/create` on the stdio request-scoped channel here, and the+//! modern multi round-trip form in mcp_mrtr.zig.const std = @import("std");const Io = std.Io;@@ -17,11 +10,9 @@ const Value = std.json.Value;const mcp_protocol = @import("mcp_protocol.zig");const mcp_stdio = @import("mcp_stdio.zig");-const util = @import("util.zig");/// Legacy `initialize` `capabilities` object. `{form:{}}` is the 2025-11-25-/// form-only shape; an empty `elicitation` object is also form-only, but-/// node_repl checks the named form key before calling createElicitation.+/// form-only shape.pub const client_capabilities = "{\"elicitation\":{\"form\":{}},\"extensions\":{\"io.modelcontextprotocol/ui\":{\"mimeTypes\":[\"text/html;profile=mcp-app\"]}}}";pub const initialize_params =@@ -29,183 +20,6 @@ pub const initialize_params ="\",\"capabilities\":" ++ client_capabilities ++",\"clientInfo\":{\"name\":\"simple-harness\",\"version\":\"0.1\"}}";-/// Shown when form elicitation is required and we cannot accept the request.-pub const fallback =- \\Computer Use form elicitation is unavailable or was declined.- \\- \\For a read-only accessibility inspect, call sky.get_app_state({ app: "<name>", disableDiff: true }). Graff advertises MCP form elicitation and accepts that inspect without a form prompt. Reconnect MCP (`/mcp trust`) if this session started before that capability existed.- \\- \\Do not use the plugin's raw Computer Use MCP client or synthesize OS events. If the inspect still cannot run, tell the user what you could not inspect.-;--const mutating = [_][]const u8{- "sky.click",- "sky.type",- "sky.press",- "sky.scroll",- "sky.hotkey",- "sky.drag",- "sky.setValue",- "sky.set_value",- "sky.keyPress",- "sky.key_press",- ".click(",- ".typeText(",- ".pressKey(",- ".setValue(",-};--fn contains(hay: []const u8, needle: []const u8) bool {- return std.mem.indexOf(u8, hay, needle) != null;-}--fn mutatingSky(source: []const u8) bool {- for (mutating) |token| if (contains(source, token)) return true;- return false;-}--/// True when the in-flight `tools/call` is a read-only Computer Use inspect.-pub fn readonlyAppState(source: []const u8) bool {- if (!contains(source, "get_app_state")) return false;- return !mutatingSky(source);-}--fn readonlyMessage(params: Value) bool {- if (params != .object) return false;- const message = params.object.get("message") orelse return false;- if (message != .string) return false;- const m = message.string;- const hints = [_][]const u8{- "get_app_state",- "app state",- "app-state",- "accessibility",- "disableDiff",- "read-only",- "read only",- "readonly",- };- for (hints) |h| if (contains(m, h)) return true;- return false;-}--fn urlMode(params: Value) bool {- if (params != .object) return false;- const mode = params.object.get("mode") orelse return false;- return mode == .string and std.mem.eql(u8, mode.string, "url");-}--pub const Action = enum { accept, decline };--pub fn decide(source: []const u8, params: Value) Action {- if (urlMode(params)) return .decline;- if (readonlyAppState(source) or readonlyMessage(params)) return .accept;- return .decline;-}--fn sensitiveName(name: []const u8) bool {- const keys = [_][]const u8{ "password", "secret", "token", "credential", "api_key", "apikey" };- for (keys) |k| {- if (util.indexOfIgnoreCase(name, k) != null) return true;- }- return false;-}--fn writeDefault(w: *Io.Writer, schema: Value) bool {- if (schema != .object) return false;- if (schema.object.get("default")) |d| {- var s: std.json.Stringify = .{ .writer = w };- s.write(d) catch return false;- return true;- }- const typ = if (schema.object.get("type")) |t| (if (t == .string) t.string else "") else "";- if (std.mem.eql(u8, typ, "boolean")) {- w.writeAll("true") catch return false;- return true;- }- if (std.mem.eql(u8, typ, "number") or std.mem.eql(u8, typ, "integer")) {- w.writeAll("0") catch return false;- return true;- }- if (std.mem.eql(u8, typ, "array")) {- w.writeAll("[]") catch return false;- return true;- }- if (schema.object.get("enum")) |en| {- if (en == .array and en.array.items.len > 0) {- var s: std.json.Stringify = .{ .writer = w };- s.write(en.array.items[0]) catch return false;- return true;- }- }- if (std.mem.eql(u8, typ, "string") or typ.len == 0) {- w.writeAll("\"\"") catch return false;- return true;- }- return false;-}--fn requiredHas(schema: Value, name: []const u8) bool {- if (schema != .object) return false;- const req = schema.object.get("required") orelse return false;- if (req != .array) return false;- for (req.array.items) |item| {- if (item == .string and std.mem.eql(u8, item.string, name)) return true;- }- return false;-}--/// Schema defaults (or safe primitives) for an accept. Null if a required-/// secret field cannot be filled.-pub fn acceptContent(arena: Allocator, schema: ?Value) ?[]const u8 {- const root = schema orelse return "{}";- if (root != .object) return "{}";- const props = root.object.get("properties") orelse return "{}";- if (props != .object) return "{}";-- var aw: Io.Writer.Allocating = .init(arena);- aw.writer.writeByte('{') catch return null;- var first = true;- var it = props.object.iterator();- while (it.next()) |entry| {- if (sensitiveName(entry.key_ptr.*) and requiredHas(root, entry.key_ptr.*)) return null;- if (!first) aw.writer.writeByte(',') catch return null;- first = false;- var s: std.json.Stringify = .{ .writer = &aw.writer };- s.write(entry.key_ptr.*) catch return null;- aw.writer.writeByte(':') catch return null;- if (!writeDefault(&aw.writer, entry.value_ptr.*)) return null;- }- aw.writer.writeByte('}') catch return null;- return aw.toOwnedSlice() catch null;-}--/// Appended to a Computer Use reply that rejects an app (#1610). Its app-/// list only holds applications it can identify as such; a window owned by-/// a bare process (`java -jar`, a script interpreter, a dev server) is not-/// selectable, and without this the agent read the rejection as the app-/// having failed to launch.-pub const bare_process_app_note =- \\- \\- \\[graff: Computer Use selects only the applications it lists. An app started as a bare process, such as `java -jar`, a script interpreter or a dev server, is not selectable even while its window is open. This does not mean the app failed to launch. Verify it another way (its own output, logs or a screenshot), or tell the user it cannot be inspected here.]-;--pub fn rejectsApp(text: []const u8) bool {- return contains(text, "Invalid app:");-}--pub fn looksUnavailable(text: []const u8) bool {- return contains(text, "createElicitation is unavailable") or- contains(text, "does not support form elicitation") or- contains(text, "Client does not support elicitation");-}--pub fn surface(alloc: Allocator, text: []const u8) ![]u8 {- if (looksUnavailable(text)) return alloc.dupe(u8, fallback);- return alloc.dupe(u8, text);-}-fn incomingMethod(msg: Value) ?[]const u8 {if (msg != .object) return null;if (msg.object.get("result") != null or msg.object.get("error") != null) return null;@@ -219,189 +33,55 @@ fn incomingId(msg: Value) ?i64 {return if (id == .integer) id.integer else null;}-fn incomingParams(msg: Value) Value {- if (msg != .object) return .null;- return msg.object.get("params") orelse .null;-}--pub fn replyBody(arena: Allocator, id: i64, action: Action, content: []const u8) ![]u8 {- return switch (action) {- .accept => std.fmt.allocPrint(arena,- \\{{"jsonrpc":"2.0","id":{d},"result":{{"action":"accept","content":{s}}}}}- , .{ id, content }),- .decline => std.fmt.allocPrint(arena,- \\{{"jsonrpc":"2.0","id":{d},"result":{{"action":"decline"}}}}- , .{id}),- };-}--/// If `line` is `elicitation/create`, write a JSON-RPC result and return true.-pub fn replyStdio(w: *Io.Writer, arena: Allocator, line: []const u8, source: []const u8) !bool {+/// If `line` is `elicitation/create`, write a decline and return true.+pub fn replyStdio(w: *Io.Writer, arena: Allocator, line: []const u8) !bool {const trimmed = std.mem.trim(u8, line, " \t\r\n");if (trimmed.len == 0) return false;const msg = std.json.parseFromSliceLeaky(Value, arena, trimmed, .{ .allocate = .alloc_always }) catch return false;const method = incomingMethod(msg) orelse return false;const id = incomingId(msg) orelse return false;if (!std.mem.eql(u8, method, "elicitation/create")) return false;-- const params = incomingParams(msg);- var action = decide(source, params);- var content: []const u8 = "{}";- if (action == .accept) {- const schema = if (params == .object) params.object.get("requestedSchema") else null;- if (acceptContent(arena, schema)) |filled| {- content = filled;- } else {- action = .decline;- }- }- try mcp_stdio.writeRequest(w, try replyBody(arena, id, action, content));+ const body = try std.fmt.allocPrint(arena,+ \\{{"jsonrpc":"2.0","id":{d},"result":{{"action":"decline"}}}}+ , .{id});+ try mcp_stdio.writeRequest(w, body);return true;}const testing = std.testing;-test "client capabilities advertise form elicitation (#768)" {+fn contains(hay: []const u8, needle: []const u8) bool {+ return std.mem.indexOf(u8, hay, needle) != null;+}++test "client capabilities advertise form elicitation" {try testing.expect(contains(client_capabilities, "\"elicitation\""));try testing.expect(contains(client_capabilities, "\"form\""));try testing.expect(contains(initialize_params, client_capabilities));try testing.expect(contains(initialize_params, mcp_protocol.legacy_protocol));}-test "readonlyAppState: get_app_state + disableDiff is inspect-only (#768)" {- const src =- \\sky.get_app_state({ app: "Codegraff", disableDiff: true })- ;- try testing.expect(readonlyAppState(src));- try testing.expect(readonlyAppState("{\"code\":\"await sky.get_app_state({app:\\\"X\\\",disableDiff:true})\"}"));- try testing.expect(readonlyAppState("get_app_state({ app: \"Finder\" })"));- try testing.expect(!readonlyAppState(""));- try testing.expect(!readonlyAppState("console.log('hi')"));-}--test "readonlyAppState: mutating sky calls are not inspect-only (#768)" {- try testing.expect(!readonlyAppState("sky.get_app_state({app:'X'}); sky.click({x:1})"));- try testing.expect(!readonlyAppState("sky.click({ x: 10, y: 10 })"));- try testing.expect(!readonlyAppState("sky.get_app_state({ disableDiff: false }); sky.setValue({id:1})"));-}--test "decide accepts read-only inspect and declines URL / input (#768)" {- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- const a = arena_state.allocator();- const inspect = try std.json.parseFromSliceLeaky(Value, a,- \\{"message":"Inspect Codegraff app state","requestedSchema":{"type":"object","properties":{}}}- , .{});- try testing.expectEqual(Action.accept, decide("sky.get_app_state({disableDiff:true})", inspect));- try testing.expectEqual(Action.accept, decide("", inspect));-- const url = try std.json.parseFromSliceLeaky(Value, a,- \\{"mode":"url","message":"Sign in","url":"https://example.invalid"}- , .{});- try testing.expectEqual(Action.decline, decide("sky.get_app_state({disableDiff:true})", url));-- const click = try std.json.parseFromSliceLeaky(Value, a,- \\{"message":"Allow click"}- , .{});- try testing.expectEqual(Action.decline, decide("sky.click({x:1,y:2})", click));-}--test "acceptContent fills defaults and refuses required secrets (#768)" {- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- const a = arena_state.allocator();-- try testing.expectEqualStrings("{}", acceptContent(a, null).?);-- const empty = try std.json.parseFromSliceLeaky(Value, a,- \\{"type":"object","properties":{}}- , .{});- try testing.expectEqualStrings("{}", acceptContent(a, empty).?);-- const flagged = try std.json.parseFromSliceLeaky(Value, a,- \\{"type":"object","properties":{"approved":{"type":"boolean","default":true}}}- , .{});- try testing.expectEqualStrings("{\"approved\":true}", acceptContent(a, flagged).?);-- const secret = try std.json.parseFromSliceLeaky(Value, a,- \\{"type":"object","properties":{"password":{"type":"string"}},"required":["password"]}- , .{});- try testing.expect(acceptContent(a, secret) == null);-}--test "replyBody: accept carries content, decline names no form fields (#768)" {- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- const a = arena_state.allocator();- const ok = try replyBody(a, 99, .accept, "{}");- try testing.expect(contains(ok, "\"action\":\"accept\""));- try testing.expect(contains(ok, "\"content\":{}"));- const no = try replyBody(a, 7, .decline, "{}");- try testing.expect(contains(no, "\"action\":\"decline\""));- try testing.expect(!contains(no, "\"content\""));-}--test "an app rejection gets the bare-process note (#1610)" {- try testing.expect(rejectsApp("Error: Invalid app: java"));- try testing.expect(rejectsApp("Invalid app: /usr/bin/java"));- try testing.expect(!rejectsApp("app state ok"));- try testing.expect(!rejectsApp("invalid application bundle"));- try testing.expect(contains(bare_process_app_note, "java -jar"));- try testing.expect(contains(bare_process_app_note, "does not mean the app failed to launch"));-}--test "looksUnavailable / surface rewrite the node_repl form-elicitation crash (#768)" {- const raw = "nodeRepl.createElicitation is unavailable because the MCP client does not support form elicitation";- try testing.expect(looksUnavailable(raw));- try testing.expect(!looksUnavailable("app state ok"));-- const rewritten = try surface(testing.allocator, raw);- defer testing.allocator.free(rewritten);- try testing.expect(contains(rewritten, "disableDiff: true"));- try testing.expect(contains(rewritten, "/mcp trust"));- try testing.expect(!contains(rewritten, "desktop `computer`")); // removed (ADR 0209)- try testing.expect(!contains(rewritten, "createElicitation is unavailable"));-- const passthrough = try surface(testing.allocator, "other MCP error");- defer testing.allocator.free(passthrough);- try testing.expectEqualStrings("other MCP error", passthrough);-}--test "replyStdio accepts get_app_state elicitation and writes a JSON-RPC result (#768)" {- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- const a = arena_state.allocator();- var buf: [1024]u8 = undefined;- var w: Io.Writer = .fixed(&buf);- const line =- \\{"jsonrpc":"2.0","id":42,"method":"elicitation/create","params":{"message":"Inspect","requestedSchema":{"type":"object","properties":{}}}}- ;- try testing.expect(try replyStdio(&w, a, line, "sky.get_app_state({ app: \"Codegraff\", disableDiff: true })"));- const out = w.buffered();- try testing.expect(contains(out, "\"action\":\"accept\""));- try testing.expect(std.mem.endsWith(u8, out, "\n"));-}--test "replyStdio declines mutating sky input (#768)" {+test "replyStdio declines every form, even one with defaults" {var arena_state = std.heap.ArenaAllocator.init(testing.allocator);defer arena_state.deinit();const a = arena_state.allocator();var buf: [1024]u8 = undefined;var w: Io.Writer = .fixed(&buf);const line =- \\{"jsonrpc":"2.0","id":3,"method":"elicitation/create","params":{"message":"Click"}}+ \\{"jsonrpc":"2.0","id":3,"method":"elicitation/create","params":{"message":"read-only inspect","requestedSchema":{"type":"object","properties":{"ok":{"type":"boolean","default":true}}}}};- try testing.expect(try replyStdio(&w, a, line, "sky.click({x:1,y:2})"));+ try testing.expect(try replyStdio(&w, a, line));+ try testing.expect(contains(w.buffered(), "\"id\":3"));try testing.expect(contains(w.buffered(), "\"action\":\"decline\""));}-test "replyStdio ignores notifications and ordinary results (#768)" {+test "replyStdio ignores notifications and ordinary results" {var arena_state = std.heap.ArenaAllocator.init(testing.allocator);defer arena_state.deinit();const a = arena_state.allocator();var buf: [64]u8 = undefined;var w: Io.Writer = .fixed(&buf);- try testing.expect(!try replyStdio(&w, a, "{\"jsonrpc\":\"2.0\",\"method\":\"notifications/progress\"}", ""));- try testing.expect(!try replyStdio(&w, a, "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{}}", ""));+ try testing.expect(!try replyStdio(&w, a, "{\"jsonrpc\":\"2.0\",\"method\":\"notifications/progress\"}"));+ try testing.expect(!try replyStdio(&w, a, "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{}}"));try testing.expectEqual(@as(usize, 0), w.buffered().len);}diff --git a/src/mcp_mrtr.zig b/src/mcp_mrtr.zigindex 74c346e9..710ed717 100644--- a/src/mcp_mrtr.zig+++ b/src/mcp_mrtr.zig@@ -5,35 +5,25 @@//! with `inputRequests` (and optionally `requestState`). The client answers//! each request and retries the same `tools/call` with `inputResponses` and//! the echoed `requestState`. graff used to stop with "does not implement-//! MRTR". Answers follow the same policy as a legacy elicitation-//! (mcp_elicitation.decide): accept only what graff can fill safely,-//! decline the rest. `roots/list` gets no roots.+//! MRTR". As with a legacy elicitation (mcp_elicitation.zig), graff shows no+//! forms, so every request is declined; `roots/list` gets no roots.const std = @import("std");const Value = std.json.Value;const Allocator = std.mem.Allocator;-const mcp_elicitation = @import("mcp_elicitation.zig");const mcp_protocol = @import("mcp_protocol.zig");pub const max_rounds = 4;/// The `inputResponses` object for one `input_required` result.-pub fn responses(a: Allocator, source: []const u8, requests: std.json.ObjectMap) !Value {+pub fn responses(a: Allocator, requests: std.json.ObjectMap) !Value {var out: std.json.ObjectMap = .empty;var it = requests.iterator();while (it.next()) |e| {const req = e.value_ptr.*;const method = if (req == .object) (if (req.object.get("method")) |m| (if (m == .string) m.string else "") else "") else "";- const params = if (req == .object) req.object.get("params") orelse Value.null else Value.null;var answer: std.json.ObjectMap = .empty;- if (std.mem.eql(u8, method, "elicitation/create")) {- const schema = if (params == .object) params.object.get("requestedSchema") else null;- const filled = if (mcp_elicitation.decide(source, params) == .accept) mcp_elicitation.acceptContent(a, schema) else null;- if (filled) |content| {- try answer.put(a, "action", .{ .string = "accept" });- try answer.put(a, "content", try std.json.parseFromSliceLeaky(Value, a, content, .{ .allocate = .alloc_always }));- } else try answer.put(a, "action", .{ .string = "decline" });- } else if (std.mem.eql(u8, method, "roots/list")) {+ if (std.mem.eql(u8, method, "roots/list")) {try answer.put(a, "roots", .{ .array = std.json.Array.init(a) });} else {try answer.put(a, "action", .{ .string = "decline" });@@ -45,11 +35,11 @@ pub fn responses(a: Allocator, source: []const u8, requests: std.json.ObjectMap)/// The retry params: the original `tools/call` params plus/// `inputResponses` and the echoed `requestState`.-pub fn retryParams(a: Allocator, params: []const u8, result: std.json.ObjectMap, source: []const u8) ![]const u8 {+pub fn retryParams(a: Allocator, params: []const u8, result: std.json.ObjectMap) ![]const u8 {const original = try std.json.parseFromSliceLeaky(Value, a, params, .{ .allocate = .alloc_always });if (original != .object) return error.BadMcpParams;var next = try original.object.clone(a);- if (result.get("inputRequests")) |reqs| if (reqs == .object) try next.put(a, "inputResponses", try responses(a, source, reqs.object));+ if (result.get("inputRequests")) |reqs| if (reqs == .object) try next.put(a, "inputResponses", try responses(a, reqs.object));if (result.get("requestState")) |state| try next.put(a, "requestState", state);return std.json.Stringify.valueAlloc(a, Value{ .object = next }, .{});}@@ -69,7 +59,7 @@ pub fn resolve(a: Allocator, params: []const u8, first: Value, ctx: anytype, senvar round: usize = 0;while (inputRequired(resp)) |result| : (round += 1) {if (round == max_rounds) return error.McpInputRequiredLoop;- resp = try send(ctx, a, try retryParams(a, params, result, params));+ resp = try send(ctx, a, try retryParams(a, params, result));}return resp;}@@ -84,7 +74,7 @@ test "responses decline an unfillable form and answer roots/list" {\\{"login":{"method":"elicitation/create","params":{"mode":"form","message":"GitHub username?","requestedSchema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}}},\\ "roots":{"method":"roots/list","params":{}}}, .{});- const out = try responses(a, "{\"name\":\"t\"}", reqs.object);+ const out = try responses(a, reqs.object);try testing.expectEqualStrings("decline", out.object.get("login").?.object.get("action").?.string);try testing.expectEqual(@as(usize, 0), out.object.get("roots").?.object.get("roots").?.array.items.len);}@@ -96,7 +86,7 @@ test "retryParams keeps the call and adds inputResponses and requestState" {const result = try std.json.parseFromSliceLeaky(Value, a,\\{"resultType":"input_required","inputRequests":{"q":{"method":"elicitation/create","params":{"message":"?"}}},"requestState":"s1"}, .{});- const p = try retryParams(a, "{\"name\":\"get_weather\",\"arguments\":{\"location\":\"NYC\"}}", result.object, "");+ const p = try retryParams(a, "{\"name\":\"get_weather\",\"arguments\":{\"location\":\"NYC\"}}", result.object);const v = try std.json.parseFromSliceLeaky(Value, a, p, .{});try testing.expectEqualStrings("get_weather", v.object.get("name").?.string);try testing.expectEqualStrings("s1", v.object.get("requestState").?.string);diff --git a/src/mcp_protocol.zig b/src/mcp_protocol.zigindex 7257e931..5a4169eb 100644--- a/src/mcp_protocol.zig+++ b/src/mcp_protocol.zig@@ -67,8 +67,8 @@ pub fn negotiatedProtocol(response: Value, transport: Transport) ![]const u8 {/// The three reserved `_meta` keys (basic/index § `_meta`), pre-rendered as a/// single JSON object member. graff supports exactly one modern version and-/// advertises form elicitation so Computer Use `node_repl` can confirm-/// (`elicitation/create`) instead of crashing (#768).+/// advertises form elicitation, which it answers by declining+/// (mcp_elicitation.zig).pub const modern_meta =\\"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"codegraff","version":"1"},"io.modelcontextprotocol/clientCapabilities":{"elicitation":{"form":{}},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}}};@@ -95,9 +95,8 @@ pub fn buildRequest(a: Allocator, id: i64, method: []const u8, params: []const u\\{{"jsonrpc":"2.0","id":{d},"method":"{s}","params":{{{s}}}}}, .{ id, method, modern_meta });}- // #1511: params that already lead with `_meta` (computer-use turn- // context) get the envelope merged in; a second `_meta` key is a- // duplicate a strict server rejects.+ // #1511: params that already lead with `_meta` get the envelope merged+ // in; a second `_meta` key is a duplicate a strict server rejects.const meta_open = "\"_meta\":{";if (std.mem.startsWith(u8, inner, meta_open)) {const envelope = modern_meta[meta_open.len .. modern_meta.len - 1];@@ -471,3 +470,22 @@ test "resultIsComplete: absent is the MUST-complete default for older servers" {const malformed = (try std.json.parseFromSliceLeaky(Value, a, "{\"resultType\":42}", .{})).object;try std.testing.expect(!resultIsComplete(malformed));}++test "#1511: params leading with _meta merge the envelope and progress token into one _meta" {+ var arena = std.heap.ArenaAllocator.init(std.testing.allocator);+ defer arena.deinit();+ const a = arena.allocator();+ const p = "{\"_meta\":{\"caller\":\"x\"},\"name\":\"js\",\"arguments\":{}}";+ for ([_]bool{ false, true }) |modern| {+ const built = try buildRequest(a, 9, "tools/call", p, modern);+ const line = try @import("mcp_notify.zig").withProgressToken(a, built, 9);+ // A duplicate key is a parse error here, as it is for a strict server.+ const v = try std.json.parseFromSliceLeaky(std.json.Value, a, line, .{ .duplicate_field_behavior = .@"error" });+ const params = v.object.get("params").?.object;+ try std.testing.expectEqualStrings("js", params.get("name").?.string);+ const meta = params.get("_meta").?.object;+ try std.testing.expectEqual(@as(i64, 9), meta.get("progressToken").?.integer);+ try std.testing.expectEqualStrings("x", meta.get("caller").?.string);+ try std.testing.expectEqual(modern, meta.get("io.modelcontextprotocol/protocolVersion") != null);+ }+}diff --git a/src/mcp_rpc.zig b/src/mcp_rpc.zigindex b13b525c..534c4c54 100644--- a/src/mcp_rpc.zig+++ b/src/mcp_rpc.zig@@ -56,9 +56,6 @@ pub const Server = struct {probe_fallback: ?LegacyReason = null,/// In-flight HTTP `notifications/initialized` (not awaited before tools/list).pending_initialized: ?Io.Future(void) = null,- /// Borrowed `tools/call` JSON while `request` is in flight; used to accept- /// read-only Computer Use `get_app_state` elicitation (#768).- elicit_source: []const u8 = "",/// Notifications seen while waiting: stale catalog, SSE resume point.notes: mcp_notify.Sink = .{},};@@ -208,7 +205,6 @@ pub fn request(server: *Server, response_alloc: Allocator, params: []const u8, m.writer = &stdio.stdin_writer.interface,.reader = &stdio.stdout_reader.interface,.sink = &server.notes,- .elicit_source = server.elicit_source,}, stdio.stdout_reader.io, response_alloc, id);},.http => |*http| {diff --git a/src/mcp_rpc_tests.zig b/src/mcp_rpc_tests.zigindex 1689bcef..c2826488 100644--- a/src/mcp_rpc_tests.zig+++ b/src/mcp_rpc_tests.zig@@ -391,7 +391,7 @@ test "probeStdio (#327): the DEFAULT deadline covers a cold-starting server" {try std.testing.expect(spawned.server.probe_fallback == null);}-test "request (#768): mid-call form elicitation for get_app_state is accepted" {+test "request: a mid-call form elicitation is declined and the call still completes" {if (builtin.os.tag == .windows) return error.SkipZigTest;const io = std.testing.io;var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);@@ -399,16 +399,15 @@ test "request (#768): mid-call form elicitation for get_app_state is accepted" {const a = arena_state.allocator();// First JSON-RPC id is 1 (`Server.next_id`). The fixture emits a form- // elicitation, then the tools/call result only after it reads the accept.+ // elicitation, then the tools/call result only after it reads the decline.var spawned = try spawnReplying(a, io,\\read line\\printf '%s\n' '{"jsonrpc":"2.0","id":99,"method":"elicitation/create","params":{"message":"Inspect app state","requestedSchema":{"type":"object","properties":{}}}}'\\read reply- \\printf '%s\n' '{"jsonrpc":"2.0","id":1,"result":{"ok":true}}'+ \\case "$reply" in *'"action":"decline"'*) printf '%s\n' '{"jsonrpc":"2.0","id":1,"result":{"ok":true}}' ;; esac\\cat >/dev/null);defer mcp_stdio.stopChild(io, &spawned.child);- spawned.server.elicit_source = "sky.get_app_state({ app: \"Codegraff\", disableDiff: true })";spawned.server.era = .legacy;spawned.server.initialized = true;const resp = try mcp_rpc.request(spawned.server, a, "{\"name\":\"js\",\"arguments\":{}}", "tools/call", "js");diff --git a/src/mcp_turn_context.zig b/src/mcp_turn_context.zigdeleted file mode 100644index 82bf35a6..00000000--- a/src/mcp_turn_context.zig+++ /dev/null@@ -1,181 +0,0 @@-//! Opaque caller-owned correlation IDs for the computer-use MCP bridge.-const std = @import("std");-const Allocator = std.mem.Allocator;-pub const Snapshot = struct { session: [36]u8, turn: [36]u8 };-pub const State = struct {- value: ?Snapshot = null,- pub fn begin(self: *State, io: std.Io) void {- const session = if (self.value) |v| v.session else uuid(io);- self.value = .{ .session = session, .turn = uuid(io) };- }-};--var fallback: State = .{};--/// cua_repl / node_repl require host metadata. If a caller forgot to pass-/// turn context, mint a process-local pair rather than sending a request-/// the adapter will reject.-pub fn effective(context: ?Snapshot, io: std.Io, server: []const u8) ?Snapshot {- if (context) |ctx| return ctx;- if (!(std.mem.eql(u8, server, "cua_repl") or std.mem.eql(u8, server, "node_repl"))) return null;- fallback.begin(io);- return fallback.value;-}-fn uuid(io: std.Io) [36]u8 {- var bytes: [16]u8 = undefined;- io.random(&bytes);- bytes[6] = (bytes[6] & 0x0f) | 0x40;- bytes[8] = (bytes[8] & 0x3f) | 0x80;- const hex = std.fmt.bytesToHex(bytes, .lower);- var result: [36]u8 = undefined;- var offset: usize = 0;- for (&result, 0..) |*c, i| {- if (i == 8 or i == 13 or i == 18 or i == 23) c.* = '-' else {- c.* = hex[offset];- offset += 1;- }- }- return result;-}--/// Metadata is host-owned and scoped to the computer-use adapter, never-/// merged from model arguments or sent to unrelated MCP servers.-pub fn params(a: Allocator, server: []const u8, name: []const u8, input: std.json.Value, context: ?Snapshot) ![]u8 {- var out: std.Io.Writer.Allocating = .init(a);- errdefer out.deinit();- var s: std.json.Stringify = .{ .writer = &out.writer };- try s.beginObject();- // #1511: `_meta` leads, so the protocol envelope and the progress token- // merge into this one object (mcp_protocol.buildRequest,- // mcp_notify.withProgressToken) instead of adding a second `_meta` key.- if (std.mem.eql(u8, server, "cua_repl") or std.mem.eql(u8, server, "node_repl")) {- if (context) |ctx| {- try s.objectField("_meta");- try s.beginObject();- try s.objectField("x-codex-turn-metadata");- try s.write(.{ .session_id = ctx.session[0..], .turn_id = ctx.turn[0..] });- try s.endObject();- }- }- try s.objectField("name");- try s.write(name);- try s.objectField("arguments");- try s.write(input);- try s.endObject();- return out.toOwnedSlice();-}--test "turn context is stable within a turn, rotates between turns and differs by caller" {- var first: State = .{};- var second: State = .{};- first.begin(std.testing.io);- const before = first.value.?;- second.begin(std.testing.io);- try std.testing.expect(!std.mem.eql(u8, &before.session, &second.value.?.session));- first.begin(std.testing.io);- try std.testing.expectEqualStrings(&before.session, &first.value.?.session);- try std.testing.expect(!std.mem.eql(u8, &before.turn, &first.value.?.turn));- try std.testing.expectEqual(@as(u8, '4'), before.session[14]);- try std.testing.expectEqual(@as(u8, '-'), before.turn[8]);-}--test "computer bridge metadata stays outside arguments and unrelated MCP calls" {- const a = std.testing.allocator;- var state: State = .{};- state.begin(std.testing.io);- const input = try std.json.parseFromSlice(std.json.Value, a, "{\"_meta\":{\"x-codex-turn-metadata\":\"untrusted\"}}", .{});- defer input.deinit();- for ([_][]const u8{ "cua_repl", "node_repl", "ordinary" }) |server| {- const text = try params(a, server, "js", input.value, state.value);- defer a.free(text);- const decoded = try std.json.parseFromSlice(std.json.Value, a, text, .{});- defer decoded.deinit();- const object = decoded.value.object;- try std.testing.expectEqualStrings("untrusted", object.get("arguments").?.object.get("_meta").?.object.get("x-codex-turn-metadata").?.string);- if (std.mem.eql(u8, server, "ordinary")) {- try std.testing.expect(object.get("_meta") == null);- } else {- const context = object.get("_meta").?.object.get("x-codex-turn-metadata").?.object;- try std.testing.expectEqualStrings(&state.value.?.session, context.get("session_id").?.string);- try std.testing.expectEqualStrings(&state.value.?.turn, context.get("turn_id").?.string);- }- }-}--test "computer adapters still get turn metadata when the caller omitted it" {- const a = std.testing.allocator;- const input = try std.json.parseFromSlice(std.json.Value, a, "{}", .{});- defer input.deinit();- const ctx = effective(null, std.testing.io, "cua_repl");- try std.testing.expect(ctx != null);- const text = try params(a, "cua_repl", "js", input.value, ctx);- defer a.free(text);- const decoded = try std.json.parseFromSlice(std.json.Value, a, text, .{});- defer decoded.deinit();- const meta = decoded.value.object.get("_meta").?.object.get("x-codex-turn-metadata").?.object;- try std.testing.expect(meta.get("session_id").?.string.len == 36);- try std.testing.expect(meta.get("turn_id").?.string.len == 36);- try std.testing.expect(effective(null, std.testing.io, "ordinary") == null);-}--test "#1511: a computer-use tools/call carries one _meta with the turn context and progress token" {- var arena = std.heap.ArenaAllocator.init(std.testing.allocator);- defer arena.deinit();- const a = arena.allocator();- var state: State = .{};- state.begin(std.testing.io);- const input = try std.json.parseFromSliceLeaky(std.json.Value, a, "{\"code\":\"await createBrowserTab()\"}", .{});- const p = try params(a, "cua_repl", "js", input, state.value);- for ([_]bool{ false, true }) |modern| {- // The same steps as mcp_rpc.request for a tools/call.- const built = try @import("mcp_protocol.zig").buildRequest(a, 9, "tools/call", p, modern);- const line = try @import("mcp_notify.zig").withProgressToken(a, built, 9);- // A duplicate key is a parse error here, as it is for a strict server.- const v = try std.json.parseFromSliceLeaky(std.json.Value, a, line, .{ .duplicate_field_behavior = .@"error" });- const params_obj = v.object.get("params").?.object;- try std.testing.expectEqualStrings("js", params_obj.get("name").?.string);- const meta = params_obj.get("_meta").?.object;- try std.testing.expectEqual(@as(i64, 9), meta.get("progressToken").?.integer);- try std.testing.expectEqualStrings(&state.value.?.turn, meta.get("x-codex-turn-metadata").?.object.get("turn_id").?.string);- try std.testing.expectEqual(modern, meta.get("io.modelcontextprotocol/protocolVersion") != null);- }-}--test "#1580: the first computer-use call reaches a server that exits on a duplicate key" {- if (@import("builtin").os.tag == .windows) return error.SkipZigTest; // /bin/sh- const gpa = std.testing.allocator;- const io = std.testing.io;- const Registry = @import("mcp.zig").Registry;- var reg = Registry.empty(gpa, io);- defer reg.deinit();- reg.stdio_probe = false;- reg.lazy_stdio = false;- // Like the real adapter's JSON-RPC reader: a request line with a- // duplicate `_meta` does not parse, and the server stops reading and- // exits. graff saw that as McpClosed on the first call (#1580).- const script =- \\while read -r l; do- \\ case "$l" in *'"_meta":'*'"_meta":'*) exit 0 ;; esac- \\ id=$(printf '%s' "$l" | sed -n 's/^{"jsonrpc":"2.0","id":\([0-9]*\),.*/\1/p')- \\ [ -z "$id" ] && continue- \\ case "$l" in- \\ *'"method":"initialize"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"protocolVersion":"2025-11-25","capabilities":{"tools":{}},"serverInfo":{"name":"f","version":"1"}}}\n' "$id" ;;- \\ *'"method":"tools/list"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"tools":[{"name":"js","description":"d","inputSchema":{"type":"object"}}]}}\n' "$id" ;;- \\ *'"method":"tools/call"'*'"x-codex-turn-metadata"'*) printf '{"jsonrpc":"2.0","id":%s,"result":{"content":[{"type":"text","text":"state"}]}}\n' "$id" ;;- \\ *) printf '{"jsonrpc":"2.0","id":%s,"error":{"code":-32602,"message":"missing turn metadata"}}\n' "$id" ;;- \\ esac- \\done- ;- try std.testing.expectEqual(@as(usize, 1), try reg.addServer("cua_repl", "/bin/sh", &.{ "-c", script }));- var state: State = .{};- state.begin(io);- const input = try std.json.parseFromSlice(std.json.Value, gpa, "{\"code\":\"await cua.getState();\"}", .{});- defer input.deinit();- const first = try reg.callWithContext(gpa, "mcp__cua_repl__js", input.value, state.value);- defer gpa.free(first.text);- try std.testing.expectEqualStrings("state", first.text);- try std.testing.expect(!first.is_error);- // The process that answered is the one that started: no close, no restart.- try std.testing.expect(reg.servers[0].transport == .stdio);- try std.testing.expectEqual(@as(u8, 0), reg.servers[0].transport.stdio.relaunch.?.restarts);-}diff --git a/src/mcp_wait.zig b/src/mcp_wait.zigindex 25a9a44e..5937cda5 100644--- a/src/mcp_wait.zig+++ b/src/mcp_wait.zig@@ -42,13 +42,12 @@ pub const Stdio = struct {writer: *Io.Writer,reader: *Io.Reader,sink: *mcp_notify.Sink,- elicit_source: []const u8,};fn readReply(s: Stdio, io: Io, a: Allocator, id: i64) !Value {while (true) {const line = try mcp_stdio.takeLine(s.reader);- if (try mcp_elicitation.replyStdio(s.writer, a, line, s.elicit_source)) continue;+ if (try mcp_elicitation.replyStdio(s.writer, a, line)) continue;if (try mcp_inbound.replyStdio(s.writer, a, line)) continue;if (mcp_http.matchingResponse(a, line, id)) |parsed| return parsed;_ = mcp_notify.observe(s.sink, io, line);@@ -113,7 +112,7 @@ test "awaitStdio: notifications are observed and the matching reply returns" {var out_buf: [512]u8 = undefined;var out: Io.Writer = .fixed(&out_buf);var sink: mcp_notify.Sink = .{ .server = "demo" };- const got = try readReply(.{ .writer = &out, .reader = &in, .sink = &sink, .elicit_source = "" }, testing.io, a, 3);+ const got = try readReply(.{ .writer = &out, .reader = &in, .sink = &sink }, testing.io, a, 3);try testing.expect(got.object.get("result").?.object.get("ok").?.bool);try testing.expect(sink.tools_stale.load(.acquire));}@@ -141,7 +140,7 @@ test "MCP inbound ping: wait reader answers interleaved pings without losing provar out_buf: [512]u8 = undefined;var out: Io.Writer = .fixed(&out_buf);var sink: mcp_notify.Sink = .{ .server = "demo" };- const got = try readReply(.{ .writer = &out, .reader = &in, .sink = &sink, .elicit_source = "" }, testing.io, arena.allocator(), 3);+ const got = try readReply(.{ .writer = &out, .reader = &in, .sink = &sink }, testing.io, arena.allocator(), 3);try testing.expect(Progress.observed);try testing.expectEqualStrings("done", got.object.get("result").?.object.get("content").?.array.items[0].object.get("text").?.string);try testing.expectEqualStrings(@@ -163,7 +162,7 @@ test "awaitStdio: a cancel already requested sends notifications/cancelled" {var out_buf: [512]u8 = undefined;var out: Io.Writer = .fixed(&out_buf);var sink: mcp_notify.Sink = .{};- try testing.expectError(error.McpCancelled, awaitStdio(.{ .writer = &out, .reader = &in, .sink = &sink, .elicit_source = "" }, testing.io, arena.allocator(), 11));+ try testing.expectError(error.McpCancelled, awaitStdio(.{ .writer = &out, .reader = &in, .sink = &sink }, testing.io, arena.allocator(), 11));try testing.expect(std.mem.indexOf(u8, out.buffered(), "\"notifications/cancelled\"") != null);try testing.expect(std.mem.indexOf(u8, out.buffered(), "\"requestId\":11") != null);}diff --git a/src/plugin_codex.zig b/src/plugin_codex.zigindex 60ebfa24..1d151ca5 100644--- a/src/plugin_codex.zig+++ b/src/plugin_codex.zig@@ -3,7 +3,8 @@//! Codex never writes `installed_plugins.json` and never lists `plugins/cache/`.//! Enabled ids in `config.toml` (`[plugins."name@marketplace"]`) resolve to//! `plugins/cache/<marketplace>/<name>/<version>`. Prefer version `local`,-//! else the last sorted version dir. Disabled and invalid keys are skipped.+//! else the last sorted version dir. Disabled and invalid keys are skipped, and+//! Codex's computer-use plugins are never loaded (ADR 0313).//!//! Skill bodies stay off the system-prompt prefix (prompt-cache max): this//! module only yields install roots; `skill_docs.promptCatalog` prints names.@@ -31,13 +32,17 @@ pub fn load(io: Io, arena: Allocator, codex_home: []const u8) []const Entry {const text = Io.Dir.cwd().readFileAlloc(io, toml_path, arena, file_cap) catch return &.{};var out: std.ArrayList(Entry) = .empty;for (keys(arena, text)) |k| {- if (!k.enabled or out.items.len >= cap) continue;+ if (!k.enabled or out.items.len >= cap or isComputerUse(k.name)) continue;const path = activeRoot(io, arena, codex_home, k.name, k.marketplace) orelse continue;out.append(arena, .{ .name = k.name, .path = path }) catch {};}return out.items;}+fn isComputerUse(name: []const u8) bool {+ return std.ascii.eqlIgnoreCase(name, "computer-use") or std.ascii.eqlIgnoreCase(name, "unified-computer-use");+}+fn keys(arena: Allocator, text: []const u8) []const Key {var out: std.ArrayList(Key) = .empty;var current: ?usize = null;@@ -289,3 +294,25 @@ test "discover: Codex store is visible; cache/ is still not walked" {try testing.expectEqualStrings("codex", list[0].origin);try testing.expect(list[0].skills);}++test "load: Codex's computer-use plugins stay out even when enabled (ADR 0313)" {+ var tmp = std.testing.tmpDir(.{});+ defer tmp.cleanup();+ const io = std.testing.io;+ var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);+ defer arena_state.deinit();+ const arena = arena_state.allocator();+ var buf: [std.fs.max_path_bytes]u8 = undefined;+ const n = try tmp.dir.realPath(io, &buf);+ const home = try arena.dupe(u8, buf[0..n]);+ for ([_][]const u8{ "computer-use", "unified-computer-use", "other" }) |name| {+ try Io.Dir.cwd().createDirPath(io, try std.fmt.allocPrint(arena, "{s}/plugins/cache/m/{s}/1.0.0", .{ home, name }));+ }+ try Io.Dir.cwd().writeFile(io, .{+ .sub_path = try std.fmt.allocPrint(arena, "{s}/config.toml", .{home}),+ .data = "[plugins.\"computer-use@m\"]\nenabled = true\n[plugins.\"unified-computer-use@m\"]\nenabled = true\n[plugins.\"other@m\"]\nenabled = true\n",+ });+ const got = load(io, arena, home);+ try std.testing.expectEqual(@as(usize, 1), got.len);+ try std.testing.expectEqualStrings("other", got[0].name);+}diff --git a/src/plugin_layout.zig b/src/plugin_layout.zigindex 5a4aa6a7..3e9e6d96 100644--- a/src/plugin_layout.zig+++ b/src/plugin_layout.zig@@ -83,15 +83,6 @@ fn readManifest(io: Io, arena: Allocator, plugin_path: []const u8) ?Value {return null;}-/// Codex bundled plugins can select a host-provided content surface instead-/// of their raw MCP declaration. Computer Use uses this to require the signed-/// node_repl bridge (#618).-pub fn usesNodeRepl(io: Io, arena: Allocator, plugin_path: []const u8) bool {- const manifest = readManifest(io, arena, plugin_path) orelse return false;- const variant = manifest.object.get("bundledContentVariant") orelse return false;- return variant == .string and std.mem.eql(u8, variant.string, "node-repl");-}-pub fn expandPlaceholders(arena: Allocator, text: []const u8, plugin_root: []const u8, project_dir: []const u8) []const u8 {if (std.mem.indexOf(u8, text, "${CLAUDE_") == null) return text;const step = std.mem.replaceOwned(u8, arena, text, "${CLAUDE_PLUGIN_ROOT}", plugin_root) catch text;@@ -393,22 +384,6 @@ test "mergeMcp: plugin-relative command and cwd resolve from the plugin (#618)"try testing.expectEqualStrings(plug, relative.get("cwd").?.string);}-test "usesNodeRepl reads the Codex bundled content variant (#618)" {- var tmp = testing.tmpDir(.{});- defer tmp.cleanup();- var arena_state = std.heap.ArenaAllocator.init(testing.allocator);- defer arena_state.deinit();- const arena = arena_state.allocator();- const base = try tmpBase(testing.io, &tmp, arena);- const plug = join(arena, base, "computer-use");- try Io.Dir.cwd().createDirPath(testing.io, join(arena, plug, ".codex-plugin"));- try Io.Dir.cwd().writeFile(testing.io, .{- .sub_path = join(arena, plug, ".codex-plugin/plugin.json"),- .data = "{\"name\":\"computer-use\",\"bundledContentVariant\":\"node-repl\"}",- });- try testing.expect(usesNodeRepl(testing.io, arena, plug));-}-test "resolveRel refuses parent-directory escapes" {var arena_state = std.heap.ArenaAllocator.init(testing.allocator);defer arena_state.deinit();diff --git a/src/plugin_mcp_variant.zig b/src/plugin_mcp_variant.zigdeleted file mode 100644index 1ae679ea..00000000--- a/src/plugin_mcp_variant.zig+++ /dev/null@@ -1,30 +0,0 @@-//! Host-specific MCP surfaces selected by plugin manifest variants.--const std = @import("std");-const Io = std.Io;-const Allocator = std.mem.Allocator;-const layout = @import("plugin_layout.zig");-const codex_node_repl = @import("codex_node_repl.zig");--/// Merge each plugin MCP declaration, replacing Codex's raw Computer Use-/// client with its signed node_repl content variant when available (#618).-pub fn merge(io: Io, arena: Allocator, home: []const u8, cwd: []const u8, plugs: anytype, servers: *std.json.ObjectMap, found: *bool) void {- var node_repl_plugin: ?[]const u8 = null;- for (plugs) |p| {- if (!p.mcp) continue;- if (@import("builtin").os.tag == .macos and- std.ascii.eqlIgnoreCase(p.name, "computer-use") and- layout.usesNodeRepl(io, arena, p.path))- {- node_repl_plugin = p.path;- continue;- }- layout.mergeMcp(io, arena, p.path, cwd, servers, found);- }- if (node_repl_plugin) |path| {- const bridged = codex_node_repl.merge(io, arena, home, cwd, servers, found);- // Custom/non-Codex builds may make the plugin client callable. Keep- // that declared fallback only when no signed bridge was available.- if (!bridged) layout.mergeMcp(io, arena, path, cwd, servers, found);- }-}diff --git a/src/plugins.zig b/src/plugins.zigindex f6f6d01e..cbe173f7 100644--- a/src/plugins.zig+++ b/src/plugins.zig@@ -269,7 +269,7 @@ pub fn mergeMcp(io: Io, arena: Allocator, home: []const u8, dir: Io.Dir, serversconst n = dir.realPath(io, &buf) catch Io.Dir.cwd().realPathFile(io, ".", &buf) catch 0;const cwd = if (n > 0) buf[0..n] else null;const plugs = discover(io, arena, if (home.len > 0) home else null, dir);- @import("plugin_mcp_variant.zig").merge(io, arena, home, cwd orelse "", plugs, servers, found);+ for (plugs) |p| if (p.mcp) layout.mergeMcp(io, arena, p.path, cwd orelse "", servers, found);if (home.len > 0) {takeAbs(io, arena, servers, found, join(arena, home, ".claude.json"), cwd);takeAbs(io, arena, servers, found, join(arena, home, ".claude/settings.json"), null);diff --git a/src/side_steer.zig b/src/side_steer.zigindex 2102f687..8ed32ea6 100644--- a/src/side_steer.zig+++ b/src/side_steer.zig@@ -71,7 +71,6 @@ fn ctxFromRoot(root: *Agent) ToolCtx {.provider = root.provider,.subagent_provider = root.subagent_provider,.subagent_cross_provider = root.subagent_cross_provider,- .mcp_context = root.mcp_context.value,.registry = root.registry,.from_sub = root.sub,.interactive_children = !root.sub and @import("subagent_interactive.zig").enabled.load(.acquire),diff --git a/src/skill_docs.zig b/src/skill_docs.zigindex e96a0f4a..b0f59232 100644--- a/src/skill_docs.zig+++ b/src/skill_docs.zig@@ -24,7 +24,6 @@ const ToolOutput = tools.ToolOutput;// Only the settings-file location, never the approval session (#422 ratchet).const policy = @import("harness_policy.zig");const plugins = @import("plugins.zig");-const runtime_adapter = @import("skill_runtime_adapter.zig");pub const Source = enum {builtin,@@ -363,8 +362,6 @@ fn render(gpa: Allocator, io: Io, sk: Skill) ![]u8 {var aw: Io.Writer.Allocating = .init(gpa);errdefer aw.deinit();try aw.writer.print("# skill: {s} ({s})\n\n", .{ sk.name, sk.source.label() });- const adapter = runtime_adapter.prefix(sk.name, sk.source == .plugin);- if (adapter.len > 0) try aw.writer.print("{s}\n\n", .{adapter});try aw.writer.writeAll(util.utf8Prefix(body, body_cap));if (body.len > body_cap)try aw.writer.print("\n\n[body truncated at {d} KB — read the rest from {s}]", .{ body_cap / 1024, sk.path });diff --git a/src/skill_runtime_adapter.zig b/src/skill_runtime_adapter.zigdeleted file mode 100644index 8b7c261d..00000000--- a/src/skill_runtime_adapter.zig+++ /dev/null@@ -1,34 +0,0 @@-//! Runtime-specific addenda for foreign skills whose documented backend is-//! not callable from a standalone graff process. The original skill stays on-//! disk and is still shown after this short, explicit override.--const std = @import("std");--pub const computer_use =- \\## Graff runtime adapter- \\- \\Graff exposes this plugin's authenticated, signed Codex `node_repl` bridge through MCP-qualified tool names. Keep the bootstrap, confirmation policy, fresh-state workflow, and `nodeRepl.emitImage(...)` instructions below unchanged.- \\- \\- Where the skill says to use `node_repl`, call `mcp__node_repl__js`; use `mcp__node_repl__js_reset` and `mcp__node_repl__js_add_node_module_dir` for the two companion operations.- \\- Read-only inspect uses `sky.get_app_state({ app, disableDiff: true })`. Graff advertises MCP form elicitation and accepts that inspect so `nodeRepl.createElicitation` does not fail. Mutating sky input still follows the skill's confirmation policy.- \\- If form elicitation is still unavailable, do not retry the same call. Ask the user to reconnect MCP (`/mcp trust`), or say what you could not inspect. Do not use the plugin's raw Computer Use MCP client or substitute OS event synthesis: the macOS service authenticates the signed Codex process chain.-;--pub fn prefix(name: []const u8, from_plugin: bool) []const u8 {- if (from_plugin and std.ascii.eqlIgnoreCase(name, "computer-use")) return computer_use;- return "";-}--test "only the plugin Computer Use skill receives the signed node_repl adapter" {- try std.testing.expect(std.mem.indexOf(u8, prefix("computer-use", true), "mcp__node_repl__js") != null);- try std.testing.expectEqualStrings("", prefix("computer-use", false));- try std.testing.expectEqualStrings("", prefix("other", true));-}--test "Computer Use adapter names the read-only inspect and the reconnect fallback (#768)" {- const text = prefix("computer-use", true);- try std.testing.expect(std.mem.indexOf(u8, text, "disableDiff: true") != null);- try std.testing.expect(std.mem.indexOf(u8, text, "createElicitation") != null);- try std.testing.expect(std.mem.indexOf(u8, text, "/mcp trust") != null);- try std.testing.expect(std.mem.indexOf(u8, text, "desktop `computer`") == null); // removed (ADR 0209)-}diff --git a/src/test_hooks.zig b/src/test_hooks.zigindex 77aa90ed..f2d3a4e9 100644--- a/src/test_hooks.zig+++ b/src/test_hooks.zig@@ -402,8 +402,7 @@ test {_ = @import("update_cmd.zig");_ = @import("update_tests.zig");_ = @import("update_windows.zig");- _ = @import("mcp_elicitation.zig"); // #768: Computer Use form elicitation- _ = @import("skill_runtime_adapter.zig"); // #768: read-only get_app_state adapter+ _ = @import("mcp_elicitation.zig");_ = @import("edit_worktree_tests.zig"); // #747: edit lands on the selected worktree_ = @import("mcp.zig");_ = @import("mcp_rpc.zig");diff --git a/src/tools.zig b/src/tools.zigindex f87943ac..b1c399d7 100644--- a/src/tools.zig+++ b/src/tools.zig@@ -128,7 +128,6 @@ pub const ToolCtx = struct {interactive_children: bool = false,session_name: []const u8 = "",registry: ?*mcp.Registry,- mcp_context: ?@import("mcp_turn_context.zig").Snapshot = null,from_sub: bool,rlm_host: bool = false, // ADR 0238: a host call from inside an rlm script (its MCP result binds whole; rlm slims what it prints)has_eval: bool = false, // the root's --eval loop: escalation's strongest verifier