Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

feat(agents): run the side panel on OpenCode, in beta, as an agent of its own whose rules deny every tool not named for it, with the page-carrying prompt kept out of a config OpenCode expands

Shahriar5c58b52b74ee
diff --git a/src/daemon/agent/config.test.ts b/src/daemon/agent/config.test.ts
index 2ce7fe6..35da77a 100644
--- a/src/daemon/agent/config.test.ts
+++ b/src/daemon/agent/config.test.ts
@@ -34,6 +34,7 @@ const DEFAULTS: AgentConfig = {
grok: { bin: 'grok' },
cursor: { bin: 'cursor-agent' },
qwen: { bin: 'qwen' },
+ opencode: { bin: 'opencode' },
},
requireApproval: ['page.submitForm'],
};
diff --git a/src/daemon/agent/runners/fixtures/README.md b/src/daemon/agent/runners/fixtures/README.md
index b20e171..4172433 100644
--- a/src/daemon/agent/runners/fixtures/README.md
+++ b/src/daemon/agent/runners/fixtures/README.md
@@ -7,7 +7,10 @@ What each agent CLI printed on stdout, one event per line, for the reader tests
recording machine's slash commands, agents, skills, plugins and memory paths were emptied, and to
its `rate_limit_event`, which keeps only its status. Grok Build prints the same `available_commands`
line several times over; its recordings keep one of each, with the recording machine's slash
- commands emptied.
+ commands emptied. OpenCode's were recorded through the runner's own plan with the model provider
+ replaced by a local stand-in, so the model's words are scripted and its URL is 127.0.0.1 — all but
+ `free-tier`, which the real Zen endpoint answered and which lost only its `cf-ray` and
+ `cf-placement` headers; paths became `/Users/you`.
- `<case>.hand-written.jsonl` was written from the reader code, for streams a contained run cannot
produce or a CLI that was not installed. Its first line says so.
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-auth-error.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-auth-error.jsonl
new file mode 100644
index 0000000..329e42a
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-auth-error.jsonl
@@ -0,0 +1,2 @@
+# opencode 1.18.32: the provider answers 401. Model replies scripted by a local stand-in for the provider.
+{"type":"error","timestamp":1790294607355,"sessionID":"ses_f2a203cfbffer702tSIwYO0Hiz","error":{"name":"APIError","data":{"message":"Invalid API key provided","statusCode":401,"isRetryable":false,"responseHeaders":{"connection":"keep-alive","content-type":"application/json","date":"Fri, 25 Sep 2026 00:03:27 GMT","keep-alive":"timeout=5","transfer-encoding":"chunked"},"responseBody":"{\"error\":{\"message\":\"Invalid API key provided\",\"type\":\"invalid_request_error\",\"code\":\"invalid_api_key\"}}","metadata":{"url":"http://127.0.0.1:4599/v1/chat/completions"}}}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-free-tier.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-free-tier.jsonl
new file mode 100644
index 0000000..3a58372
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-free-tier.jsonl
@@ -0,0 +1,2 @@
+# opencode 1.18.32: a contained run against a free OpenCode Zen model, answered by the real Zen endpoint.
+{"type":"error","timestamp":1790345047893,"sessionID":"ses_f271e9704ffecU3nJaiR7uHno3","error":{"name":"APIError","data":{"message":"Error from provider (Console): OpenCode's free tier can only be used from within OpenCode","statusCode":403,"isRetryable":false,"responseHeaders":{"connection":"keep-alive","content-encoding":"br","content-type":"application/json","date":"Fri, 25 Sep 2026 14:04:07 GMT","server":"cloudflare","transfer-encoding":"chunked"},"responseBody":"{\"type\":\"error\",\"error\":{\"type\":\"FreeTierError\",\"message\":\"Error from provider (Console): OpenCode's free tier can only be used from within OpenCode\"}}","metadata":{"url":"https://opencode.ai/zen/v1/chat/completions"}}}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-refused-tool.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-refused-tool.jsonl
new file mode 100644
index 0000000..3a7272e
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-refused-tool.jsonl
@@ -0,0 +1,7 @@
+# opencode 1.18.32: the model asks for bash, which the ruleset never offered it. Model replies scripted by a local stand-in for the provider.
+{"type":"step_start","timestamp":1790294604828,"sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","part":{"id":"prt_0d5dfbc11001OtJXObDEdGUAOF","messageID":"msg_0d5dfba150016yudhS2ZrhMyMk","sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","type":"step-start"}}
+{"type":"tool_use","timestamp":1790294604828,"sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","part":{"type":"tool","tool":"bash","callID":"call_2","state":{"status":"error","input":{"command":"touch pwned-inside","description":"x"},"error":"Model tried to call unavailable tool 'invalid'. Available tools: browsentic_page_getPageInfo, browsentic_page_navigate.","time":{"start":1790294604821,"end":1790294604821}},"id":"prt_0d5dfbc1200111wua2lnv5dW6y","sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","messageID":"msg_0d5dfba150016yudhS2ZrhMyMk"}}
+{"type":"step_finish","timestamp":1790294604828,"sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","part":{"id":"prt_0d5dfbc170010uzpur73XwHK0A","reason":"tool-calls","messageID":"msg_0d5dfba150016yudhS2ZrhMyMk","sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
+{"type":"step_start","timestamp":1790294604850,"sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","part":{"id":"prt_0d5dfbc2a001il8IbDK1cr61kS","messageID":"msg_0d5dfbc1b0015oGonDBlNGVEiE","sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","type":"step-start"}}
+{"type":"text","timestamp":1790294604850,"sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","part":{"id":"prt_0d5dfbc2b001wT2PX13ci00lLl","messageID":"msg_0d5dfbc1b0015oGonDBlNGVEiE","sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","type":"text","text":"The page is Example Domain.","time":{"start":1790294604843,"end":1790294604844}}}
+{"type":"step_finish","timestamp":1790294604850,"sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","part":{"id":"prt_0d5dfbc2e0012m6NrYmJ7iw3XM","reason":"stop","messageID":"msg_0d5dfbc1b0015oGonDBlNGVEiE","sessionID":"ses_f2a2046a5ffePn4atktCCPeyq8","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-resumed.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-resumed.jsonl
new file mode 100644
index 0000000..4f192e6
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-resumed.jsonl
@@ -0,0 +1,8 @@
+# opencode 1.18.32: the same conversation resumed with --session. Model replies scripted by a local stand-in for the provider.
+{"type":"step_start","timestamp":1790294603583,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb738001xHRw6faCbxz14d","messageID":"msg_0d5dfb4f5001NJVt7kt5CljRbs","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-start"}}
+{"type":"text","timestamp":1790294603583,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb73a001k37DTh0lTDUPZZ","messageID":"msg_0d5dfb4f5001NJVt7kt5CljRbs","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"text","text":"Looking. ","time":{"start":1790294603578,"end":1790294603583}}}
+{"type":"tool_use","timestamp":1790294603602,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"type":"tool","tool":"browsentic_page_getPageInfo","callID":"call_1","state":{"status":"completed","input":{},"output":"title: Example Domain (run run-2)","metadata":{"truncated":false},"title":"","time":{"start":1790294603582,"end":1790294603592}},"id":"prt_0d5dfb73b001w2fNuxmLwk20rh","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","messageID":"msg_0d5dfb4f5001NJVt7kt5CljRbs"}}
+{"type":"step_finish","timestamp":1790294603602,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb74c001vHxyV1ZNlN7IWf","reason":"tool-calls","messageID":"msg_0d5dfb4f5001NJVt7kt5CljRbs","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
+{"type":"step_start","timestamp":1790294603618,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb75c001kKhqgLZW49CcYp","messageID":"msg_0d5dfb750001IM7ewGSDJWq0s3","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-start"}}
+{"type":"text","timestamp":1790294603618,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb75d0016pV8QOt8iFBN7r","messageID":"msg_0d5dfb750001IM7ewGSDJWq0s3","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"text","text":"The page is Example Domain.","time":{"start":1790294603613,"end":1790294603614}}}
+{"type":"step_finish","timestamp":1790294603618,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb75f001E7iI5n4m7JRevX","reason":"stop","messageID":"msg_0d5dfb750001IM7ewGSDJWq0s3","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-shell-ran.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-shell-ran.jsonl
new file mode 100644
index 0000000..2869816
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-shell-ran.jsonl
@@ -0,0 +1,4 @@
+# opencode 1.18.32: bash running to completion, recorded while a user agent of the same name could still widen the ruleset. Model replies scripted by a local stand-in for the provider.
+{"type":"step_start","timestamp":1790293527112,"sessionID":"ses_f2a30b883ffeSOiCqGgi65cOEB","part":{"id":"prt_0d5cf4a40001J1u4fHqIHqOs0k","messageID":"msg_0d5cf4838001JgeAT5W9zA8ucH","sessionID":"ses_f2a30b883ffeSOiCqGgi65cOEB","type":"step-start"}}
+{"type":"tool_use","timestamp":1790293527141,"sessionID":"ses_f2a30b883ffeSOiCqGgi65cOEB","part":{"type":"tool","tool":"bash","callID":"call_2","state":{"status":"completed","input":{"command":"touch pwned-inside","description":"x"},"output":"(no output)","metadata":{"output":"(no output)","exit":0,"truncated":false},"title":"touch pwned-inside","time":{"start":1790293527109,"end":1790293527134}},"id":"prt_0d5cf4a420017qH7vni7OQKYfS","sessionID":"ses_f2a30b883ffeSOiCqGgi65cOEB","messageID":"msg_0d5cf4838001JgeAT5W9zA8ucH"}}
+{"type":"step_finish","timestamp":1790293527141,"sessionID":"ses_f2a30b883ffeSOiCqGgi65cOEB","part":{"id":"prt_0d5cf4a60001GvGMIMiZDXBCDW","reason":"tool-calls","messageID":"msg_0d5cf4838001JgeAT5W9zA8ucH","sessionID":"ses_f2a30b883ffeSOiCqGgi65cOEB","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-task-read.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-task-read.jsonl
new file mode 100644
index 0000000..2c03364
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-task-read.jsonl
@@ -0,0 +1,7 @@
+# opencode 1.18.32: a one-shot that reads its scratch file, then answers. Model replies scripted by a local stand-in for the provider.
+{"type":"step_start","timestamp":1790294609382,"sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","part":{"id":"prt_0d5dfcdb2001l3pBs4Aqu961iD","messageID":"msg_0d5dfcb82001AuaWp0gG1lTmCo","sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","type":"step-start"}}
+{"type":"tool_use","timestamp":1790294609399,"sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","part":{"type":"tool","tool":"read","callID":"call_r19","state":{"status":"completed","input":{"filePath":"/Users/you/.browsentic/agents/opencode/task/tmp/report.txt"},"output":"<path>/Users/you/.browsentic/agents/opencode/task/tmp/report.txt</path>\n<type>file</type>\n<content>\n1: Q3 revenue grew 12%.\n\n(End of file - total 1 lines)\n</content>","metadata":{"preview":"Q3 revenue grew 12%.","truncated":false,"loaded":[],"display":{"type":"file","path":"/Users/you/.browsentic/agents/opencode/task/tmp/report.txt","text":"Q3 revenue grew 12%.","lineStart":1,"lineEnd":1,"totalLines":1,"truncated":false}},"title":"Users/you/.browsentic/agents/opencode/task/tmp/report.txt","time":{"start":1790294609335,"end":1790294609392}},"id":"prt_0d5dfcdb4001q5EviCLEJdbbcF","sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","messageID":"msg_0d5dfcb82001AuaWp0gG1lTmCo"}}
+{"type":"step_finish","timestamp":1790294609399,"sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","part":{"id":"prt_0d5dfcdf20011B3VA5Rjb6D1Yk","reason":"tool-calls","messageID":"msg_0d5dfcb82001AuaWp0gG1lTmCo","sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
+{"type":"step_start","timestamp":1790294609414,"sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","part":{"id":"prt_0d5dfce00001SOjgY4VU0DZWtX","messageID":"msg_0d5dfcdf6001A0u02k1dZ0DASt","sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","type":"step-start"}}
+{"type":"text","timestamp":1790294609414,"sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","part":{"id":"prt_0d5dfce01001L63MhxakKCr8Qe","messageID":"msg_0d5dfcdf6001A0u02k1dZ0DASt","sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","type":"text","text":"The page is Example Domain.","time":{"start":1790294609409,"end":1790294609410}}}
+{"type":"step_finish","timestamp":1790294609414,"sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","part":{"id":"prt_0d5dfce03001RtpWCOAyS57iIG","reason":"stop","messageID":"msg_0d5dfcdf6001A0u02k1dZ0DASt","sessionID":"ses_f2a203542ffemYNY1qaYr37AGS","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-turn.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-turn.jsonl
new file mode 100644
index 0000000..a69ada7
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-turn.jsonl
@@ -0,0 +1,8 @@
+# opencode 1.18.32: a fresh run: prose, a browser tool call, prose. Model replies scripted by a local stand-in for the provider.
+{"type":"step_start","timestamp":1790294602175,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb1b80019QUEm3Rvod9hHx","messageID":"msg_0d5dfaf2d001RfZzzK7oybvFdt","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-start"}}
+{"type":"text","timestamp":1790294602175,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb1b9001h6XBx1Rqk1Wq5w","messageID":"msg_0d5dfaf2d001RfZzzK7oybvFdt","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"text","text":"Looking. ","time":{"start":1790294602169,"end":1790294602174}}}
+{"type":"tool_use","timestamp":1790294602251,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"type":"tool","tool":"browsentic_page_getPageInfo","callID":"call_1","state":{"status":"completed","input":{},"output":"title: Example Domain (run run-1)","metadata":{"truncated":false},"title":"","time":{"start":1790294602173,"end":1790294602239}},"id":"prt_0d5dfb1bb001X33p030TqYn2HC","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","messageID":"msg_0d5dfaf2d001RfZzzK7oybvFdt"}}
+{"type":"step_finish","timestamp":1790294602251,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb201001Z4g7AWBro7D6Pw","reason":"tool-calls","messageID":"msg_0d5dfaf2d001RfZzzK7oybvFdt","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
+{"type":"step_start","timestamp":1790294602263,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb211001zOlmG9k1EsWiMX","messageID":"msg_0d5dfb204001Ckk4v03vC5PW1J","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-start"}}
+{"type":"text","timestamp":1790294602263,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb212001ZYMrQV0KSEl5PB","messageID":"msg_0d5dfb204001Ckk4v03vC5PW1J","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"text","text":"The page is Example Domain.","time":{"start":1790294602258,"end":1790294602259}}}
+{"type":"step_finish","timestamp":1790294602263,"sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","part":{"id":"prt_0d5dfb214001og6cN0JLQ6mcXF","reason":"stop","messageID":"msg_0d5dfb204001Ckk4v03vC5PW1J","sessionID":"ses_f2a205199ffeBLqxrKcIpaS7DT","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-unknown-model.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-unknown-model.jsonl
new file mode 100644
index 0000000..996935b
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-unknown-model.jsonl
@@ -0,0 +1,2 @@
+# opencode 1.18.32: a model id OpenCode does not know. Model replies scripted by a local stand-in for the provider.
+{"type":"error","timestamp":1790294608061,"sessionID":"ses_f2a2037fbffeL59ubvcJrlqa2T","error":{"name":"UnknownError","data":{"message":"Unexpected server error. Check server logs for details.","ref":"err_24e7408d"}}}
diff --git a/src/daemon/agent/runners/fixtures/opencode/1.18.32-web.jsonl b/src/daemon/agent/runners/fixtures/opencode/1.18.32-web.jsonl
new file mode 100644
index 0000000..fad8b45
--- /dev/null
+++ b/src/daemon/agent/runners/fixtures/opencode/1.18.32-web.jsonl
@@ -0,0 +1,8 @@
+# opencode 1.18.32: a research run that fetches a page with webfetch. Model replies scripted by a local stand-in for the provider.
+{"type":"step_start","timestamp":1790294606066,"sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","part":{"id":"prt_0d5dfc0df001LeOFBsD9ur7g8l","messageID":"msg_0d5dfbee4001SUovDRnK5N7HPt","sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","type":"step-start"}}
+{"type":"text","timestamp":1790294606066,"sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","part":{"id":"prt_0d5dfc0e0001XMVrCwS5ngOSte","messageID":"msg_0d5dfbee4001SUovDRnK5N7HPt","sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","type":"text","text":"Checking the pricing page. ","time":{"start":1790294606048,"end":1790294606055}}}
+{"type":"tool_use","timestamp":1790294606066,"sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","part":{"type":"tool","tool":"webfetch","callID":"call_w16","state":{"status":"completed","input":{"url":"http://127.0.0.1:4599/pricing","format":"markdown"},"output":"Pricing\n\n# Pricing\n\nPro costs $12 a month.","metadata":{"truncated":false},"title":"http://127.0.0.1:4599/pricing (text/html)","time":{"start":1790294606053,"end":1790294606060}},"id":"prt_0d5dfc0e2001OW21C1h5t974Mh","sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","messageID":"msg_0d5dfbee4001SUovDRnK5N7HPt"}}
+{"type":"step_finish","timestamp":1790294606066,"sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","part":{"id":"prt_0d5dfc0ee001DUe79obIjsca9A","reason":"tool-calls","messageID":"msg_0d5dfbee4001SUovDRnK5N7HPt","sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
+{"type":"step_start","timestamp":1790294606077,"sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","part":{"id":"prt_0d5dfc0f80011MMZn6ExBLm1Dk","messageID":"msg_0d5dfc0f10018fDDe8MVu7YIHZ","sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","type":"step-start"}}
+{"type":"text","timestamp":1790294606077,"sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","part":{"id":"prt_0d5dfc0f9001sHotj6G4XtnF1M","messageID":"msg_0d5dfc0f10018fDDe8MVu7YIHZ","sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","type":"text","text":"The page is Example Domain.","time":{"start":1790294606073,"end":1790294606073}}}
+{"type":"step_finish","timestamp":1790294606077,"sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","part":{"id":"prt_0d5dfc0fa001zK8K2yELaiP88s","reason":"stop","messageID":"msg_0d5dfc0f10018fDDe8MVu7YIHZ","sessionID":"ses_f2a2041ceffeKFjm2vT3SOzt6b","type":"step-finish","tokens":{"total":1230,"input":200,"output":30,"reasoning":0,"cache":{"write":0,"read":1000}},"cost":0}}
diff --git a/src/daemon/agent/runners/index.test.ts b/src/daemon/agent/runners/index.test.ts
index b70de47..0c552c9 100644
--- a/src/daemon/agent/runners/index.test.ts
+++ b/src/daemon/agent/runners/index.test.ts
@@ -43,6 +43,7 @@ const configWith = (agents: Partial<Record<AgentKind, AgentSettings>>, agent: Ag
grok: { bin: join(bin, 'grok') },
cursor: { bin: join(bin, 'cursor-agent') },
qwen: { bin: join(bin, 'qwen') },
+ opencode: { bin: join(bin, 'opencode') },
...agents,
},
requireApproval: [],
@@ -75,7 +76,7 @@ describe('the registry', () => {
describe('readiness probes', () => {
beforeAll(() => {
mkdirSync(bin, { recursive: true });
- for (const name of ['claude', 'claude-next', 'codex', 'agy', 'vibe', 'grok', 'cursor-agent', 'qwen']) stub(name);
+ for (const name of ['claude', 'claude-next', 'codex', 'agy', 'vibe', 'grok', 'cursor-agent', 'qwen', 'opencode']) stub(name);
stub('codex-expired', { prints: 'licence expired', exit: 3 });
});
@@ -141,7 +142,7 @@ describe('readiness probes', () => {
test('probes are reused for half a minute, even when only the active agent changed', async () => {
await agentState(configWith({}), { refresh: true });
const again = await agentState(configWith({}, 'antigravity'));
- expect([rounds(), again.active]).toEqual([[['agy', 'claude', 'codex', 'cursor-agent', 'grok', 'qwen', 'vibe']], 'antigravity']);
+ expect([rounds(), again.active]).toEqual([[['agy', 'claude', 'codex', 'cursor-agent', 'grok', 'opencode', 'qwen', 'vibe']], 'antigravity']);
});
test('asking for a refresh probes again', async () => {
@@ -154,8 +155,8 @@ describe('readiness probes', () => {
await agentState(configWith({}), { refresh: true });
await agentState(configWith({ claude: { bin: join(bin, 'claude-next') } }));
expect(rounds()).toEqual([
- ['agy', 'claude', 'codex', 'cursor-agent', 'grok', 'qwen', 'vibe'],
- ['agy', 'claude-next', 'codex', 'cursor-agent', 'grok', 'qwen', 'vibe'],
+ ['agy', 'claude', 'codex', 'cursor-agent', 'grok', 'opencode', 'qwen', 'vibe'],
+ ['agy', 'claude-next', 'codex', 'cursor-agent', 'grok', 'opencode', 'qwen', 'vibe'],
]);
});
diff --git a/src/daemon/agent/runners/index.ts b/src/daemon/agent/runners/index.ts
index 60feafe..1a52462 100644
--- a/src/daemon/agent/runners/index.ts
+++ b/src/daemon/agent/runners/index.ts
@@ -16,6 +16,7 @@ import { claudeRunner } from './claude';
import { codexRunner } from './codex';
import { cursorRunner } from './cursor';
import { grokRunner } from './grok';
+import { opencodeRunner } from './opencode';
import { qwenRunner } from './qwen';
import type { McpServer, Runner } from './types';
import { vibeRunner } from './vibe';
@@ -28,6 +29,7 @@ export const RUNNERS: Record<AgentKind, Runner> = {
grok: grokRunner,
cursor: cursorRunner,
qwen: qwenRunner,
+ opencode: opencodeRunner,
};
const cliPath = join(dirname(fileURLToPath(import.meta.url)), 'cli.js');
diff --git a/src/daemon/agent/runners/opencode.test.ts b/src/daemon/agent/runners/opencode.test.ts
new file mode 100644
index 0000000..44d3564
--- /dev/null
+++ b/src/daemon/agent/runners/opencode.test.ts
@@ -0,0 +1,320 @@
+import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
+import { stateDir } from '../../lockfile';
+import { opencodeRunner } from './opencode';
+import { jsonContext, readThrough, shown, streamContext, transcript, valueOf } from './fixtures/support';
+import type { Plan } from './types';
+
+const settings = { bin: 'opencode' };
+const stream = (overrides: Parameters<typeof streamContext>[1] = {}) => opencodeRunner.stream(streamContext(settings, overrides));
+const task = (overrides: Parameters<typeof jsonContext>[1] = {}) => opencodeRunner.json(jsonContext(settings, overrides));
+const read = (name: string, only?: Parameters<typeof readThrough>[2]) => readThrough(opencodeRunner, transcript('opencode', name), only);
+const stdoutOf = (name: string) => transcript('opencode', name).join('\n');
+
+interface Config {
+ share: string;
+ tool_output: { max_bytes: number };
+ mcp: Record<string, { type: string; command: string[]; environment: Record<string, string>; timeout: number }>;
+ instructions?: string[];
+ agent: Record<string, { permission: Record<string, unknown> }>;
+}
+const configOf = (plan: Plan) => JSON.parse(plan.env?.OPENCODE_CONFIG_CONTENT ?? 'null') as Config;
+const rulesOf = (plan: Plan) => configOf(plan).agent[valueOf(plan.args, '--agent') ?? ''].permission;
+
+const SESSION = 'ses_f2a205199ffeBLqxrKcIpaS7DT';
+
+// check() reads the environment and the home directory, and the machine running the tests has its own of both.
+const home = join(stateDir, 'opencode-home');
+
+beforeEach(() => {
+ rmSync(home, { recursive: true, force: true });
+ mkdirSync(home, { recursive: true });
+ vi.stubEnv('HOME', home);
+ for (const name of ['XDG_CONFIG_HOME', 'XDG_DATA_HOME', 'OPENCODE_API_KEY', 'OPENCODE_AUTH_CONTENT']) vi.stubEnv(name, '');
+});
+
+afterEach(() => {
+ vi.unstubAllEnvs();
+ rmSync(home, { recursive: true, force: true });
+});
+
+describe('a streamed run', () => {
+ test('a fresh run is one contained agent, a config in the environment, and the prompt in a file', () => {
+ const plan = shown(stream());
+ expect({ ...plan, env: { ...plan.env, OPENCODE_CONFIG_CONTENT: '<config>' } }).toMatchInlineSnapshot(`
+ {
+ "args": [
+ "run",
+ "--format",
+ "json",
+ "--pure",
+ "--agent",
+ "browsentic-contained",
+ "--",
+ "what does this page cost",
+ ],
+ "cwd": "<state>/agents/opencode/run/conversation-1",
+ "env": {
+ "BROWSENTIC_AGENT_RUN": "run-1",
+ "OPENCODE_CONFIG_CONTENT": "<config>",
+ "OPENCODE_DB": "<state>/agents/opencode/sessions.db",
+ "OPENCODE_DISABLE_CLAUDE_CODE": "1",
+ "OPENCODE_DISABLE_PROJECT_CONFIG": "1",
+ "OPENCODE_DISABLE_SHARE": "1",
+ },
+ "files": [
+ {
+ "content": "You are Browsentic.
+
+ A tool result over 100 KB comes back cut, and the saved copy OpenCode points to cannot be opened in this run, so ask for less at a time — \`page_getPageInfo\` with a small \`maxPerKind\`, \`page_extractText\` with the cursor it hands back.
+ ",
+ "path": "instructions.md",
+ },
+ ],
+ }
+ `);
+ });
+
+ test('the config denies everything first, then allows each browser tool by name', () => {
+ expect(rulesOf(stream())).toEqual({
+ '*': 'deny',
+ browsentic_page_getPageInfo: 'allow',
+ browsentic_page_clickElement: 'allow',
+ browsentic_browsentic_status: 'allow',
+ });
+ });
+
+ test('research allows the two web tools as well, and nothing else', () => {
+ const rules = rulesOf(stream({ research: true }));
+ expect(Object.keys(rules).filter((tool) => !tool.startsWith('browsentic_'))).toEqual(['*', 'webfetch', 'websearch']);
+ });
+
+ // OpenCode expands {env:…} and {file:…} anywhere in its config, so page text there would read the disk.
+ test('the system prompt never travels in the config, only in the file the config names', () => {
+ const plan = stream({ systemPrompt: 'The page said {file:~/.ssh/id_rsa} and {env:AWS_SECRET_ACCESS_KEY}.' });
+ expect(plan.env?.OPENCODE_CONFIG_CONTENT).not.toMatch(/\{(file|env):/);
+ expect(configOf(plan).instructions).toEqual([join(plan.cwd, 'instructions.md')]);
+ expect(plan.files?.[0].content).toContain('{file:~/.ssh/id_rsa}');
+ });
+
+ test('the MCP server carries the run id itself, and outlasts an approval card', () => {
+ const server = configOf(stream()).mcp.browsentic;
+ expect([server.type, server.environment, server.timeout]).toEqual(['local', { BROWSENTIC_AGENT_RUN: 'run-1' }, 1_800_000]);
+ expect(server.command).toEqual(['/usr/local/bin/node', '/usr/local/lib/node_modules/browsentic/dist/cli.js', 'mcp']);
+ });
+
+ test('sharing is off and a tool result may run to Claude Code’s ceiling', () => {
+ const config = configOf(stream());
+ expect([config.share, config.tool_output.max_bytes]).toEqual(['disabled', 100_000]);
+ });
+
+ // A user who made an agent called "browsentic" for themselves would have it merged into this one.
+ test('the agent is one no user would have named, and the title agent is off', () => {
+ expect(Object.keys(configOf(stream()).agent)).toEqual(['title', 'browsentic-contained']);
+ });
+
+ test('an instruction that looks like a flag is still the message', () => {
+ const args = stream({ instruction: '--help me find the price' }).args;
+ expect(args.slice(-2)).toEqual(['--', '--help me find the price']);
+ });
+
+ test('a resumed turn names its session, and a fresh one names none', () => {
+ expect([valueOf(stream().args, '--session'), valueOf(stream({ sessionId: SESSION }).args, '--session')]).toEqual([undefined, SESSION]);
+ });
+
+ test('the model and the effort are passed only when set, and an effort no model knows is dropped', () => {
+ const pinned = stream({ settings: { ...settings, model: 'anthropic/claude-sonnet-5', effort: 'high' } }).args;
+ expect([valueOf(pinned, '--model'), valueOf(pinned, '--variant')]).toEqual(['anthropic/claude-sonnet-5', 'high']);
+ expect(valueOf(stream({ settings: { ...settings, effort: 'ludicrous' } }).args, '--variant')).toBeUndefined();
+ });
+
+ test('a conversation keeps its folder across turns, and another conversation gets its own', () => {
+ expect(stream({ runId: 'run-2' }).cwd).toBe(stream().cwd);
+ expect(stream({ conversation: 'conversation-2' }).cwd).not.toBe(stream().cwd);
+ });
+});
+
+describe('a one-shot', () => {
+ test('a task has no MCP server of its own and no tool at all', () => {
+ const plan = task();
+ expect([configOf(plan).mcp, rulesOf(plan), configOf(plan).instructions]).toEqual([{}, { '*': 'deny' }, undefined]);
+ });
+
+ test('a task runs as the same contained agent, in the task workspace, beside the same sessions', () => {
+ const plan = task();
+ expect([valueOf(plan.args, '--agent'), plan.cwd, plan.env?.OPENCODE_DB]).toEqual([
+ 'browsentic-contained',
+ opencodeRunner.workspace('task'),
+ join(stateDir, 'agents', 'opencode', 'sessions.db'),
+ ]);
+ });
+
+ // OpenCode matches a read against its path relative to the project root, which moves with git.
+ test('a task handed a file may read its scratch folder, as seen from every root OpenCode could pick', () => {
+ const read = rulesOf(task({ reads: true })).read as Record<string, string>;
+ const scratch = join(opencodeRunner.workspace('task'), 'tmp');
+ expect(read['*']).toBe('deny');
+ expect(read[`${scratch.slice(1)}/*`]).toBe('allow');
+ expect(read['task/tmp/*']).toBe('allow');
+ });
+
+ test("the scratch rule never reads as the machine's /tmp", () => {
+ expect(rulesOf(task({ reads: true })).read).not.toHaveProperty('tmp/*');
+ });
+
+ test('only a read is opened, never the shell or the browser', () => {
+ expect(Object.keys(rulesOf(task({ reads: true })))).toEqual(['*', 'read']);
+ });
+});
+
+describe('reading the stream', () => {
+ test('a turn says its text a part at a time, reports what it spent, and leaves the browser call to the daemon', () => {
+ expect(read('1.18.32-turn.jsonl').filter(([signal]) => signal !== 'session')).toEqual([
+ ['text', 'Looking. '],
+ ['usage', { contextTokens: 1230, outputTokens: 30 }],
+ ['text', '\n\nThe page is Example Domain.'],
+ ['usage', { contextTokens: 1230, outputTokens: 60 }],
+ ]);
+ });
+
+ test('every line names the session, and a resumed turn names the same one', () => {
+ expect(new Set(read('1.18.32-turn.jsonl', 'session').map(([, id]) => id))).toEqual(new Set([SESSION]));
+ expect(new Set(read('1.18.32-resumed.jsonl', 'session').map(([, id]) => id))).toEqual(new Set([SESSION]));
+ });
+
+ // The stream has no closing event; drive.ts reads a clean exit as the end of the turn.
+ test('the reader never ends a run itself, because the process exiting does', () => {
+ expect([read('1.18.32-turn.jsonl', 'done'), opencodeRunner.endsOnExit]).toEqual([[], true]);
+ });
+
+ test("a research run's web fetch is drawn on the timeline", () => {
+ expect(read('1.18.32-web.jsonl', 'tool')).toEqual([['tool', 'call_w16', 'webfetch']]);
+ });
+
+ test('a tool the model was never offered is its mistake, not a breach', () => {
+ expect(read('1.18.32-refused-tool.jsonl').filter(([signal]) => signal === 'fail' || signal === 'tool')).toEqual([]);
+ });
+
+ test('a local tool that actually ran stops the run', () => {
+ const [[, code, message]] = read('1.18.32-shell-ran.jsonl', 'fail');
+ expect([code, message]).toEqual(['AGENT_UNSAFE', expect.stringContaining('bash')]);
+ });
+
+ test('a refused key says what the provider said, then how to log in and why an environment key is not enough', () => {
+ const [[, code, message]] = read('1.18.32-auth-error.jsonl', 'fail');
+ expect([code, message]).toEqual(['AGENT_FAILED', expect.stringMatching(/^Invalid API key provided/)]);
+ expect(message).toContain('opencode auth login');
+ });
+
+ // Recorded against the real Zen endpoint: it serves its free models only to requests carrying OpenCode's own tools.
+ test("Zen's free tier refusing a contained run says to sign in to a provider instead", () => {
+ const [[, code, message]] = read('1.18.32-free-tier.jsonl', 'fail');
+ expect([code, message]).toEqual(['AGENT_FAILED', expect.stringContaining('narrowed to the browser')]);
+ expect(message).toContain('opencode auth login');
+ });
+
+ test('an unknown model, which OpenCode reports only as an unexpected error, says how to name one', () => {
+ const [[, , message]] = read('1.18.32-unknown-model.jsonl', 'fail');
+ expect(message).toContain('provider/model');
+ });
+
+ test('a line that is not JSON is ignored', () => {
+ expect(readThrough(opencodeRunner, ['not json', '{"type":"reasoning"}'])).toEqual([]);
+ });
+});
+
+describe('a one-shot answer', () => {
+ test('the answer is the last step, not the one that went to read the file', () => {
+ expect(opencodeRunner.answer(stdoutOf('1.18.32-task-read.jsonl'))).toEqual({ text: 'The page is Example Domain.' });
+ });
+
+ test('a failed one-shot reports why', () => {
+ expect(opencodeRunner.answer(stdoutOf('1.18.32-auth-error.jsonl')).error).toContain('opencode auth login');
+ });
+
+ // runJson asks for the answer as stdout arrives, so a half-written line has to be no answer yet.
+ test('output cut mid-line, or before any text, is no answer yet', () => {
+ const stdout = stdoutOf('1.18.32-task-read.jsonl');
+ expect(opencodeRunner.answer(stdout.slice(0, stdout.lastIndexOf('"text":"The page')))).toEqual({ text: undefined });
+ expect(opencodeRunner.answer('')).toEqual({ text: undefined });
+ });
+});
+
+describe('what the CLI says when it cannot start', () => {
+ test('a flag this OpenCode does not know asks for an update', () => {
+ expect(opencodeRunner.hint?.('Unknown argument: pure')).toContain('npm i -g opencode-ai');
+ });
+
+ test('anything else is left alone', () => {
+ expect(opencodeRunner.hint?.('Killed: 9')).toBeNull();
+ });
+});
+
+describe('readiness', () => {
+ const problem = async () => (await opencodeRunner.check?.(settings)) ?? null;
+ const writeHome = (path: string, content: string) => {
+ mkdirSync(join(home, path, '..'), { recursive: true });
+ writeFileSync(join(home, path), content);
+ };
+
+ test('signed in to nothing, it needs a login, because the free models refuse a contained run', async () => {
+ expect(await problem()).toEqual({
+ code: 'AGENT_NEEDS_PERMISSION',
+ message: expect.stringContaining('free OpenCode Zen models'),
+ fix: 'opencode auth login',
+ });
+ });
+
+ test('a saved login is enough', async () => {
+ writeHome('.local/share/opencode/auth.json', JSON.stringify({ anthropic: { type: 'api', key: 'sk-ant' } }));
+ expect(await problem()).toBeNull();
+ });
+
+ test('an emptied login file is no login', async () => {
+ writeHome('.local/share/opencode/auth.json', '{}');
+ expect((await problem())?.code).toBe('AGENT_NEEDS_PERMISSION');
+ });
+
+ test('an XDG_DATA_HOME of the user’s own is where the login is looked for', async () => {
+ vi.stubEnv('XDG_DATA_HOME', join(home, 'data'));
+ writeHome('data/opencode/auth.json', JSON.stringify({ openai: { type: 'oauth' } }));
+ expect(await problem()).toBeNull();
+ });
+
+ test('a Zen key the run is handed counts', async () => {
+ vi.stubEnv('OPENCODE_API_KEY', 'zen-key');
+ expect(await problem()).toBeNull();
+ });
+
+ // A local model through a provider block needs no login at all.
+ test('a provider declared in the global config counts', async () => {
+ writeHome('.config/opencode/opencode.jsonc', '{\n // ollama\n "provider": { "ollama": {} }\n}');
+ expect(await problem()).toBeNull();
+ });
+
+ // A popup that wrongly says "needs setup" blocks a working agent; the run's own error catches the opposite case.
+ test('a login file that cannot be read is assumed to hold one', async () => {
+ mkdirSync(join(home, '.local', 'share', 'opencode', 'auth.json'), { recursive: true });
+ expect(await problem()).toBeNull();
+ });
+
+ test('Browsentic cannot log in for the user, so it does not offer to', () => {
+ expect(opencodeRunner.grant).toBeUndefined();
+ });
+});
+
+test('the skill picker looks where OpenCode keeps the user’s own skills', () => {
+ expect(opencodeRunner.skillDirs?.()).toEqual([
+ join(home, '.config', 'opencode', 'skills'),
+ join(home, '.config', 'opencode', 'skill'),
+ join(home, '.opencode', 'skills'),
+ join(home, '.agents', 'skills'),
+ join(home, '.claude', 'skills'),
+ ]);
+});
+
+test('an XDG_CONFIG_HOME of the user’s own is honoured', () => {
+ vi.stubEnv('XDG_CONFIG_HOME', '/elsewhere');
+ expect(opencodeRunner.skillDirs?.()?.[0]).toBe(join('/elsewhere', 'opencode', 'skills'));
+});
diff --git a/src/daemon/agent/runners/opencode.ts b/src/daemon/agent/runners/opencode.ts
new file mode 100644
index 0000000..180ae2a
--- /dev/null
+++ b/src/daemon/agent/runners/opencode.ts
@@ -0,0 +1,302 @@
+import { randomUUID } from 'node:crypto';
+import { readFileSync } from 'node:fs';
+import { homedir } from 'node:os';
+import { dirname, join, relative } from 'node:path';
+import type { AgentProblem } from '@/lib/agents/catalog';
+import { stateDir } from '../../lockfile';
+import { MCP_SERVER_NAME } from './claude';
+import { conversationDir, effortOf, parseJsonLine, sweepRunDirs } from './util';
+import type { JsonContext, McpServer, Plan, Runner, RunMode, StreamContext, StreamReader, StreamSink } from './types';
+
+/**
+ * The whole config travels in OPENCODE_CONFIG_CONTENT, and its containment is one rule: the agent
+ * it defines opens on `"*": "deny"`. OpenCode applies the last matching rule and puts an agent's
+ * rules after the user's, so every tool not named after it — built-in, custom, another MCP
+ * server's — is denied, and a tool denied outright is never offered to the model.
+ *
+ * OpenCode expands `{env:…}` and `{file:…}` anywhere in that JSON, so page text never goes in it:
+ * the system prompt is a file the config points at, and instruction files are read verbatim.
+ *
+ * `opencode run` waits for stdin to close and appends it to the message; drive.ts spawns it ignored.
+ */
+
+/**
+ * OpenCode deep-merges an agent the user defined under the same name, keeping the user's key
+ * order, so their `{"*": "allow", "bash": "allow"}` would sit after this deny and win. Measured.
+ */
+const AGENT = 'browsentic-contained';
+
+const INSTRUCTIONS = 'instructions.md';
+
+const WEB_TOOLS = ['webfetch', 'websearch'];
+
+/** Claude Code's 25,000-token MCP ceiling. OpenCode's own 50 KB cut points the model at a saved copy it has no tool to open. */
+const RESULT_BYTES = 100_000;
+
+/** OpenCode abandons an MCP call after a minute; an approval card waits on the user, and page_awaitMonitor up to ten. */
+const TOOL_TIMEOUT_MS = 30 * 60_000;
+
+const TRUNCATION = `A tool result over ${RESULT_BYTES / 1000} KB comes back cut, and the saved copy OpenCode points to cannot be opened in this run, so ask for less at a time — \`page_getPageInfo\` with a small \`maxPerKind\`, \`page_extractText\` with the cursor it hands back.`;
+
+/** A user's `share: auto` would publish every browsing session; project config would load from folders above the workspace. */
+const SEALED = { OPENCODE_DISABLE_PROJECT_CONFIG: '1', OPENCODE_DISABLE_CLAUDE_CODE: '1', OPENCODE_DISABLE_SHARE: '1' };
+
+/** Every folder outside git is one project to OpenCode, so runs kept in its own store would fill the user's session list. */
+const sessionsDb = () => join(stateDir, 'agents', 'opencode', 'sessions.db');
+
+const configHome = () => join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'opencode');
+
+const INSTALL = 'npm i -g opencode-ai';
+
+type Permission = Record<string, string | Record<string, string>>;
+
+interface Part {
+ type?: string;
+ text?: string;
+ tool?: string;
+ callID?: string;
+ state?: { status?: string };
+ tokens?: { input?: number; output?: number; reasoning?: number; cache?: { read?: number; write?: number } };
+}
+
+interface Failure {
+ name?: string;
+ data?: { message?: string; statusCode?: number; responseBody?: string };
+}
+
+interface Event {
+ type?: string;
+ sessionID?: string;
+ part?: Part;
+ error?: Failure;
+}
+
+export const opencodeRunner: Runner = {
+ kind: 'opencode',
+ versionArgs: ['--version'],
+ // Passed as --variant, whose names each model defines; a model ignores one it lacks.
+ efforts: ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'],
+ endsOnExit: true,
+
+ workspace: (mode: RunMode) => join(stateDir, 'agents', 'opencode', mode),
+
+ skillDirs: () => [
+ join(configHome(), 'skills'),
+ join(configHome(), 'skill'),
+ join(homedir(), '.opencode', 'skills'),
+ join(homedir(), '.agents', 'skills'),
+ join(homedir(), '.claude', 'skills'),
+ ],
+
+ stream(context: StreamContext): Plan {
+ const { settings, research } = context;
+ const base = this.workspace('run');
+ sweepRunDirs(base);
+ const cwd = conversationDir(base, context.conversation ?? context.runId);
+ const allowed = [...context.mcpTools.map((tool) => `${MCP_SERVER_NAME}_${tool}`), ...(research ? WEB_TOOLS : [])];
+ const effort = effortOf(settings, this.efforts);
+
+ return {
+ cwd,
+ env: {
+ ...SEALED,
+ OPENCODE_DB: sessionsDb(),
+ OPENCODE_CONFIG_CONTENT: config({
+ mcp: { [MCP_SERVER_NAME]: server(context.mcp) },
+ instructions: [join(cwd, INSTRUCTIONS)],
+ permission: { '*': 'deny', ...Object.fromEntries(allowed.map((tool) => [tool, 'allow'])) },
+ }),
+ BROWSENTIC_AGENT_RUN: context.runId,
+ },
+ files: [{ path: INSTRUCTIONS, content: `${context.systemPrompt.trim()}\n\n${TRUNCATION}\n` }],
+ args: [
+ ...invocation(),
+ ...(context.sessionId ? ['--session', context.sessionId] : []),
+ ...(settings.model ? ['--model', settings.model] : []),
+ ...(effort ? ['--variant', effort] : []),
+ '--',
+ context.instruction,
+ ],
+ };
+ },
+
+ reader(): StreamReader {
+ let spoke = false;
+ let generated = 0;
+
+ const report = (tokens: NonNullable<Part['tokens']>, sink: StreamSink) => {
+ const made = (tokens.output ?? 0) + (tokens.reasoning ?? 0);
+ const prompt = (tokens.input ?? 0) + (tokens.cache?.read ?? 0) + (tokens.cache?.write ?? 0);
+ generated += made;
+ sink.usage({ contextTokens: prompt + made, outputTokens: generated });
+ };
+
+ return (line, sink) => {
+ const event = parseJsonLine<Event>(line);
+ if (!event) return;
+ if (event.sessionID) sink.session(event.sessionID);
+ const part = event.part;
+
+ switch (event.type) {
+ case 'text':
+ if (!part?.text) return;
+ sink.text(spoke ? `\n\n${part.text}` : part.text);
+ spoke = true;
+ return;
+
+ case 'tool_use': {
+ const name = part?.tool;
+ if (!name || ownTool(name)) return;
+ if (WEB_TOOLS.includes(name)) return sink.tool(part.callID ?? randomUUID(), name);
+ // A refused call is the model reaching for a tool it was never offered; one that ran means the ruleset did not hold.
+ if (part.state?.status !== 'completed') return;
+ return sink.fail(
+ 'AGENT_UNSAFE',
+ `OpenCode ran its own ${name} tool in this run, which Browsentic denied, so the run was stopped. ` +
+ 'Update OpenCode and Browsentic; if it persists, please report it.',
+ );
+ }
+
+ case 'step_finish':
+ if (part?.tokens) report(part.tokens, sink);
+ return;
+
+ case 'error':
+ return sink.fail('AGENT_FAILED', explain(event.error));
+ }
+ };
+ },
+
+ json(context: JsonContext): Plan {
+ const { settings, reads } = context;
+ const cwd = this.workspace('task');
+ const permission: Permission = { '*': 'deny', ...(reads ? { read: scratchReads(cwd) } : {}) };
+ return {
+ cwd,
+ env: {
+ ...SEALED,
+ OPENCODE_DB: sessionsDb(),
+ // Merged over the user's servers rather than replacing them: it adds none, and the ruleset hides theirs.
+ OPENCODE_CONFIG_CONTENT: config({ mcp: {}, permission }),
+ },
+ args: [...invocation(), ...(settings.model ? ['--model', settings.model] : []), '--', context.prompt],
+ };
+ },
+
+ answer(stdout: string) {
+ let said: string[] = [];
+ for (const line of stdout.split('\n')) {
+ const event = parseJsonLine<Event>(line);
+ if (event?.type === 'error') return { error: explain(event.error) };
+ if (event?.type === 'step_start') said = [];
+ if (event?.type === 'text' && event.part?.text) said.push(event.part.text);
+ }
+ return { text: said.length ? said.join('\n\n') : undefined };
+ },
+
+ hint(stderrTail: string) {
+ if (/Unknown arguments?|Not enough arguments|Invalid values/i.test(stderrTail)) {
+ return `Your OpenCode does not understand the flags Browsentic uses. Update it (${INSTALL}), then try again. (${stderrTail.trim()})`;
+ }
+ return null;
+ },
+
+ async check(): Promise<AgentProblem | null> {
+ if (process.env.OPENCODE_API_KEY || process.env.OPENCODE_AUTH_CONTENT || signedIn() || declaresProvider()) return null;
+ return {
+ code: 'AGENT_NEEDS_PERMISSION',
+ message:
+ 'OpenCode is signed in to no model provider, and its free OpenCode Zen models refuse a run whose tools Browsentic has narrowed to the browser.',
+ fix: 'opencode auth login',
+ };
+ },
+};
+
+const invocation = () => ['run', '--format', 'json', '--pure', '--agent', AGENT];
+
+const ownTool = (name: string) => name.startsWith(`${MCP_SERVER_NAME}_`);
+
+const server = (mcp: McpServer) => ({
+ type: 'local',
+ command: [mcp.command, ...mcp.args],
+ environment: mcp.env,
+ enabled: true,
+ timeout: TOOL_TIMEOUT_MS,
+});
+
+/** Title generation is a model call per new session that the panel already makes for itself. */
+function config({ mcp, instructions, permission }: { mcp: Record<string, unknown>; instructions?: string[]; permission: Permission }): string {
+ return JSON.stringify({
+ share: 'disabled',
+ autoupdate: false,
+ snapshot: false,
+ tool_output: { max_bytes: RESULT_BYTES, max_lines: RESULT_BYTES },
+ mcp,
+ ...(instructions ? { instructions } : {}),
+ agent: { title: { disable: true }, [AGENT]: { mode: 'primary', permission } },
+ });
+}
+
+/**
+ * OpenCode matches a read against its path relative to the project root — `/` outside git, the
+ * repository when the home directory is one — so the scratch folder is allowed as seen from every
+ * ancestor. Never from the workspace itself: `tmp/*` under a root of `/` is the machine's /tmp.
+ */
+function scratchReads(workspace: string): Record<string, string> {
+ const scratch = join(workspace, 'tmp');
+ const rules: Record<string, string> = { '*': 'deny' };
+ for (let root = dirname(workspace); ; root = dirname(root)) {
+ rules[`${relative(root, scratch)}/*`] = 'allow';
+ if (root === dirname(root)) return rules;
+ }
+}
+
+function explain(failure: Failure | undefined): string {
+ const message = oneLine(failure?.data?.message ?? failure?.name ?? 'OpenCode reported an error');
+ const status = failure?.data?.statusCode;
+ // Zen serves its free models only to requests carrying OpenCode's own built-in tools.
+ if (failure?.data?.responseBody?.includes('FreeTierError')) {
+ return (
+ `OpenCode Zen's free models refuse a run whose tools Browsentic has narrowed to the browser. Run "opencode auth login" ` +
+ `to sign in to a provider, then pick one of its models in the Browsentic popup. (${message})`
+ );
+ }
+ if (failure?.name === 'ProviderAuthError' || status === 401 || status === 403) {
+ return (
+ `${message} If that is a login problem, run "opencode auth login" — a key kept only in an environment ` +
+ 'variable is not passed to a Browsentic run.'
+ );
+ }
+ if (status === 429) return `The provider behind OpenCode is rate-limiting this account. Wait and try again. (${message})`;
+ if (failure?.name === 'UnknownError') {
+ return (
+ `OpenCode could not start this turn, most often because it does not know the model. Pick one in the ` +
+ `Browsentic popup as "opencode models" lists it — provider/model — then try again. (${message})`
+ );
+ }
+ return message;
+}
+
+const oneLine = (message: string) => message.replace(/\s+/g, ' ').trim().slice(0, 240);
+
+const dataHome = () => join(process.env.XDG_DATA_HOME || join(homedir(), '.local', 'share'), 'opencode');
+
+/** A login `opencode auth login` saved. Unreadable counts as signed in; the run's own error catches the rest. */
+function signedIn(): boolean {
+ try {
+ return Object.keys(JSON.parse(readFileSync(join(dataHome(), 'auth.json'), 'utf8')) as object).length > 0;
+ } catch (error) {
+ return (error as NodeJS.ErrnoException).code !== 'ENOENT';
+ }
+}
+
+/** A provider the user configured by hand — a local model needs no login. */
+function declaresProvider(): boolean {
+ return ['opencode.json', 'opencode.jsonc', 'config.json'].some((name) => {
+ try {
+ return /"provider"\s*:/.test(readFileSync(join(configHome(), name), 'utf8'));
+ } catch {
+ return false;
+ }
+ });
+}
diff --git a/src/daemon/cli.ts b/src/daemon/cli.ts
index a3fe967..cef1c24 100644
--- a/src/daemon/cli.ts
+++ b/src/daemon/cli.ts
@@ -36,7 +36,7 @@ const USAGE = `browsentic ${pkg.version} — hand your real browser to the agent
browsentic revoke [id] unpair one browser by the id "sessions" prints, or all of them
browsentic agent show which agent runs the side panel, and which are installed
- browsentic agent <name> switch to claude, codex, antigravity, vibe, grok, cursor or qwen
+ browsentic agent <name> switch to claude, codex, antigravity, vibe, grok, cursor, qwen or opencode
browsentic agent fix <name> let Browsentic fix what that agent still needs
browsentic agent model <name> [model] pin that agent's model, or omit it for the CLI's default
diff --git a/src/daemon/guardrails/spawn.test.ts b/src/daemon/guardrails/spawn.test.ts
index 83eec0d..ff85b5e 100644
--- a/src/daemon/guardrails/spawn.test.ts
+++ b/src/daemon/guardrails/spawn.test.ts
@@ -370,6 +370,69 @@ describe('spawn containment', () => {
expect(vetPlan('qwen', 'task', planOf('qwen', 'task', { reads: true }), stateDir)).toEqual([]);
});
+ const opencodeRun = planOf('opencode', 'run');
+ const opencodeTask = planOf('opencode', 'task');
+ const reconfigured = (plan: Plan, edit: (config: Record<string, unknown>) => void): Plan => {
+ const config = JSON.parse(plan.env?.OPENCODE_CONFIG_CONTENT ?? '{}') as Record<string, unknown>;
+ edit(config);
+ return withEnv(plan, 'OPENCODE_CONFIG_CONTENT', JSON.stringify(config));
+ };
+ const rules = (config: Record<string, unknown>) =>
+ (config.agent as Record<string, { permission: Record<string, unknown> }>)['browsentic-contained'].permission;
+
+ test('an opencode run with web tools, or a task that reads a file, is still contained', () => {
+ expect(vetPlan('opencode', 'run', planOf('opencode', 'run', { research: true }), stateDir)).toEqual([]);
+ expect(vetPlan('opencode', 'task', planOf('opencode', 'task', { reads: true }), stateDir)).toEqual([]);
+ });
+
+ // Plugins run inside OpenCode, so one can add a tool or answer a permission prompt itself.
+ test('dropping --pure is caught on both opencode modes', () => {
+ expect(vetPlan('opencode', 'run', without(opencodeRun, '--pure'), stateDir)).toHaveLength(1);
+ expect(vetPlan('opencode', 'task', without(opencodeTask, '--pure'), stateDir)).toHaveLength(1);
+ });
+
+ test('running as another agent, the user’s own build agent among them, is caught', () => {
+ expect(vetPlan('opencode', 'run', plus(opencodeRun, '--agent', 'build'), stateDir)).toHaveLength(1);
+ expect(vetPlan('opencode', 'run', swapped(opencodeRun, 'browsentic-contained', 'browsentic'), stateDir)).toHaveLength(1);
+ });
+
+ test('a ruleset that no longer opens on a deny is caught', () => {
+ const open = reconfigured(opencodeRun, (config) => void (rules(config)['*'] = 'allow'));
+ expect(vetPlan('opencode', 'run', open, stateDir)).toHaveLength(1);
+ });
+
+ test('a config that lost its ruleset altogether is caught', () => {
+ expect(vetPlan('opencode', 'run', withEnv(opencodeRun, 'OPENCODE_CONFIG_CONTENT'), stateDir)).toHaveLength(1);
+ });
+
+ test('sharing turned back on, in the config or the environment, is caught', () => {
+ expect(vetPlan('opencode', 'run', reconfigured(opencodeRun, (config) => void (config.share = 'auto')), stateDir)).toHaveLength(1);
+ expect(vetPlan('opencode', 'run', withEnv(opencodeRun, 'OPENCODE_DISABLE_SHARE'), stateDir)).toHaveLength(1);
+ });
+
+ test('loading project config from above the workspace is caught', () => {
+ expect(vetPlan('opencode', 'run', withEnv(opencodeRun, 'OPENCODE_DISABLE_PROJECT_CONFIG', '0'), stateDir)).toHaveLength(1);
+ });
+
+ test('--auto, which approves whatever was not denied, is caught', () => {
+ expect(vetPlan('opencode', 'run', plus(opencodeRun, '--auto'), stateDir)).toHaveLength(1);
+ });
+
+ test('a turn sent to a running server, another folder, or a public share is caught', () => {
+ expect(vetPlan('opencode', 'run', plus(opencodeRun, '--attach', 'http://localhost:4096'), stateDir)).toHaveLength(1);
+ expect(vetPlan('opencode', 'run', plus(opencodeRun, '--dir=/'), stateDir)).toHaveLength(1);
+ expect(vetPlan('opencode', 'run', plus(opencodeRun, '--share'), stateDir)).toHaveLength(1);
+ });
+
+ test('an opencode task handed an MCP server is caught', () => {
+ const reaching = reconfigured(opencodeTask, (config) => void (config.mcp = { browsentic: { type: 'local' } }));
+ expect(vetPlan('opencode', 'task', reaching, stateDir)).toHaveLength(1);
+ });
+
+ test('losing the opencode instructions file is caught', () => {
+ expect(vetPlan('opencode', 'run', { ...opencodeRun, files: [] }, stateDir)).toHaveLength(1);
+ });
+
test('running outside the state dir is caught', () => {
expect(vetPlan('antigravity', 'run', { ...agyRun, cwd: '/tmp/anywhere' }, stateDir)).toHaveLength(1);
});
@@ -507,6 +570,20 @@ describe('environment sealing', () => {
expect(sealedFor('claude')).not.toHaveProperty('GOOGLE_APPLICATION_CREDENTIALS');
});
+ test('opencode keeps its own zen key', () => {
+ expect(sealEnv('opencode', { ...DIRTY, OPENCODE_API_KEY: 'zen' }).OPENCODE_API_KEY).toBe('zen');
+ });
+
+ // OpenCode reads a dozen providers' keys; it keeps its own logins in a file, so none is handed over.
+ test('opencode loses every provider key in the environment', () => {
+ const sealed = sealedFor('opencode');
+ expect(['ANTHROPIC_API_KEY', 'OPENAI_API_KEY', 'GEMINI_API_KEY', 'XAI_API_KEY'].filter((name) => name in sealed)).toEqual([]);
+ });
+
+ test('claude loses the opencode key', () => {
+ expect(sealEnv('claude', { ...DIRTY, OPENCODE_API_KEY: 'zen' })).not.toHaveProperty('OPENCODE_API_KEY');
+ });
+
test('sealing reports what it dropped', () => {
expect(sealedAway('claude', DIRTY)).toContain('AWS_SECRET_ACCESS_KEY');
});
diff --git a/src/daemon/guardrails/spawn.ts b/src/daemon/guardrails/spawn.ts
index b9b7c74..6aac5a5 100644
--- a/src/daemon/guardrails/spawn.ts
+++ b/src/daemon/guardrails/spawn.ts
@@ -70,6 +70,8 @@ interface Requirements {
readonly allows?: ToolAllowance;
/** Variables the plan must set for a CLI that takes a switch only from its environment. */
readonly env?: Readonly<Record<string, string>>;
+ /** Substrings a variable must contain, for a CLI that takes its whole config as one. */
+ readonly envContains?: Readonly<Record<string, readonly string[]>>;
/** Workspace files the plan must write before the CLI starts. */
readonly files: readonly string[];
/**
@@ -140,6 +142,15 @@ const NEVER_QWEN = ['Bash', 'exec', 'Edit', 'agent', 'skill', 'monitor'];
*/
const GROK_SEALED = { GROK_MEMORY: '0', GROK_CLAUDE_MCPS_ENABLED: 'false', GROK_CURSOR_MCPS_ENABLED: 'false' };
+/**
+ * OpenCode takes these only from its environment. Project config would load agents and tools from
+ * the folders above the workspace, and a user's `share: auto` publishes every session it runs.
+ */
+const OPENCODE_SEALED = { OPENCODE_DISABLE_PROJECT_CONFIG: '1', OPENCODE_DISABLE_CLAUDE_CODE: '1', OPENCODE_DISABLE_SHARE: '1' };
+
+/** The ruleset that denies every tool not named after it, and the switch that keeps a session off opncd.ai. */
+const OPENCODE_CONFIG = ['"*":"deny"', '"share":"disabled"'];
+
export const CONTAINMENT: Record<AgentKind, Containment> = {
claude: {
localTools: 'allowlist',
@@ -321,6 +332,41 @@ export const CONTAINMENT: Record<AgentKind, Containment> = {
files: [],
},
},
+
+ opencode: {
+ localTools: 'allowlist',
+ // A key in ANTHROPIC_* or OPENAI_* would be one of a dozen providers OpenCode reads; `opencode auth login` keeps them in a file.
+ keepsEnv: ['OPENCODE_'],
+ // `--auto` approves whatever is not denied, `--attach` runs the turn in a server started with someone
+ // else's config, `--dir` moves it out of the workspace, and `--share` publishes it.
+ forbidden: [/^--auto$/i, /^--attach/i, /^--dir/i, /^--share$/i],
+ note:
+ 'a per-run permission ruleset opening on "*": "deny", which OpenCode applies after the user’s own rules, ' +
+ 'so the model is offered no tool that was not named — built-in, custom, or another MCP server’s; ' +
+ 'external plugins and project config stay off, but MCP servers the user gave OpenCode itself still start, with their tools hidden',
+ run: {
+ // Plugins run inside OpenCode and can add tools or answer its permission prompts.
+ required: ['--pure'],
+ pairs: [
+ ['--agent', 'browsentic-contained'],
+ ['--format', 'json'],
+ ],
+ env: OPENCODE_SEALED,
+ envContains: { OPENCODE_CONFIG_CONTENT: OPENCODE_CONFIG },
+ files: ['instructions.md'],
+ },
+ task: {
+ required: ['--pure'],
+ pairs: [
+ ['--agent', 'browsentic-contained'],
+ ['--format', 'json'],
+ ],
+ env: OPENCODE_SEALED,
+ // An empty map adds no server of ours, so a one-shot has no way to the browser.
+ envContains: { OPENCODE_CONFIG_CONTENT: [...OPENCODE_CONFIG, '"mcp":{}'] },
+ files: [],
+ },
+ },
};
/**
@@ -361,6 +407,11 @@ export function vetPlan(kind: AgentKind, mode: SpawnMode, plan: SpawnPlan, home:
if (plan.env?.[name] !== value) problems.push(`${label} is spawned without ${name}=${value}.`);
}
+ for (const [name, needles] of Object.entries(rules.envContains ?? {})) {
+ const missing = needles.filter((needle) => !plan.env?.[name]?.includes(needle));
+ if (missing.length) problems.push(`${label} is spawned with a ${name} missing ${missing.join(', ')}.`);
+ }
+
for (const path of rules.files) {
if (!plan.files?.some((file) => file.path === path)) {
problems.push(`${label} is spawned without ${path} in its workspace.`);
@@ -405,7 +456,7 @@ const SECRET_PREFIX: readonly string[] = [
'STRIPE_', 'SLACK_', 'TWILIO_', 'SENDGRID_', 'SENTRY_', 'DATADOG_', 'PAGERDUTY_',
'DATABASE_', 'POSTGRES_', 'PGPASS', 'MYSQL_', 'REDIS_', 'MONGO_', 'SUPABASE_',
'OPENAI_', 'ANTHROPIC_', 'GEMINI_', 'CLAUDE_', 'CODEX_', 'ANTIGRAVITY_', 'MISTRAL_', 'XAI_', 'GROK_', 'CURSOR_', 'HF_', 'HUGGINGFACE_',
- 'QWEN_', 'DASHSCOPE_', 'BAILIAN_',
+ 'QWEN_', 'DASHSCOPE_', 'BAILIAN_', 'OPENCODE_',
'VERCEL_', 'NETLIFY_', 'CLOUDFLARE_', 'FLY_', 'HEROKU_', 'RAILWAY_',
];
diff --git a/src/extension/components/agent-marks.tsx b/src/extension/components/agent-marks.tsx
index de55aa0..392df28 100644
--- a/src/extension/components/agent-marks.tsx
+++ b/src/extension/components/agent-marks.tsx
@@ -32,6 +32,10 @@ const MARKS: Record<AgentKind, { viewBox: string; path: string }> = {
viewBox: '0 0 24 24',
path: 'M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z',
},
+ opencode: {
+ viewBox: '128 96 256 320',
+ path: 'M384 416H128V96H384V416ZM320 160H192V352H320V160Z',
+ },
};
/** The vendor's mark in the current text colour, so it follows the row's state and the theme. */
diff --git a/src/lib/agents/catalog.ts b/src/lib/agents/catalog.ts
index 88ef6cc..d66fb8e 100644
--- a/src/lib/agents/catalog.ts
+++ b/src/lib/agents/catalog.ts
@@ -1,4 +1,4 @@
-export const AGENT_KINDS = ['claude', 'codex', 'antigravity', 'vibe', 'grok', 'cursor', 'qwen'] as const;
+export const AGENT_KINDS = ['claude', 'codex', 'antigravity', 'vibe', 'grok', 'cursor', 'qwen', 'opencode'] as const;
export type AgentKind = (typeof AGENT_KINDS)[number];
@@ -88,6 +88,18 @@ export const AGENTS: Record<AgentKind, AgentDescriptor> = {
models: ['qwen3-coder-plus', 'qwen3.7-plus', 'qwen3.6-plus', 'qwen3-max-2026-01-23'],
beta: true,
},
+ opencode: {
+ kind: 'opencode',
+ label: 'OpenCode',
+ vendor: 'Anomaly',
+ bin: 'opencode',
+ install: 'npm i -g opencode-ai',
+ docs: 'https://opencode.ai/docs/cli/',
+ // Spelled provider/model, and reachable only through a provider OpenCode is signed in to: Zen's
+ // free models refuse a run whose tools are narrowed to the browser.
+ models: ['anthropic/claude-opus-5-5', 'anthropic/claude-sonnet-5', 'openai/gpt-5.6', 'google/gemini-3.1-pro-preview'],
+ beta: true,
+ },
};
export const AGENT_LIST: AgentDescriptor[] = AGENT_KINDS.map((kind) => AGENTS[kind]);