Compare commits

..

1003 commits

Author SHA1 Message Date
Aiden Cline
f3a34aab9f
fix(core): say when a long grep line has more matches than its preview shows (#67042)
Some checks are pending
check-cli-rs / check (push) Waiting to run
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-28 21:06:33 -06:00
Aiden Cline
b62bea7d0d
fix(sdk): skip strings line by line in the packed workerd check (#67056) 2026-11-28 20:54:13 -06:00
opencode-agent[bot]
c1d2d2eb62
feat(core): support name frontmatter in markdown agent files (#67051)
Co-authored-by: Tarquinen <78942835+Tarquinen@users.noreply.github.com>
Co-authored-by: Dan Smolsky <dannysmo@gmail.com>
2026-11-29 02:39:46 +00:00
Aiden Cline
107fa22ac6
fix(core): say why a refused machine is offline (#66867) 2026-11-28 20:33:08 -06:00
Aiden Cline
816d777495
fix(core): return whole lines from read (#66927) 2026-11-28 20:16:16 -06:00
Aiden Cline
d1d46b9068
test(core): rebuild the MCP test suite around real servers, a capability contract and a lifecycle model (#67018) 2026-11-28 17:10:39 -06:00
Kit Langton
6f46fd53cf
feat(server): support hibernatable Durable Object WebSockets for machine links (#67026) 2026-11-28 14:23:50 -08:00
Kit Langton
7f608c965e
feat(sdk): expose fetch, password, cors, workspace, and machine links on OpenCodeWorkerd (#67023) 2026-11-28 13:49:02 -08:00
Kit Langton
44026ef1b4
fix(core): return typed 503 for filesystem and pty on bare workerd locations (#67020) 2026-11-28 13:25:28 -08:00
Kit Langton
cedabc4eda
feat(workerd): add host image resizer hook (#67022) 2026-11-28 13:13:12 -08:00
Kit Langton
cabe2aeb7a
fix(core): persist pending machine join invitations in KV (#67019) 2026-11-28 12:51:49 -08:00
Kit Langton
2c365062f5
feat(site): list Anomaly's companion tools in llms.txt (#66929) 2026-11-28 12:35:01 -08:00
Aiden Cline
a386d7f6a5
fix(core): show the part of a long line around a grep match (#67017) 2026-11-28 14:26:12 -06:00
Aiden Cline
2474329a3f
refactor(core): parse MCP event notifications into messages at the SDK edge (#67013)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-28 13:26:46 -06:00
Aiden Cline
2d938ac178
fix(core): decode stored MCP OAuth metadata once and keep sign-in on the effect clock (#66932) 2026-11-28 13:15:31 -06:00
Kit Langton
44d32f6ce0
feat(server): support WebSocketPair upgrade for /api/experimental/machine/link on ServerWorkerd (#66954)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-cli-rs / check (push) Waiting to run
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-28 10:58:56 -08:00
Kit Langton
ff756e0316
fix(core): make Noise XX work in workerd, log Link defects, and map shell start failure to 503 (#66950) 2026-11-28 10:54:17 -08:00
Kit Langton
b14fd5221f
fix(core): report Iroh path when a worker reconnects over a new connection (#66948) 2026-11-28 10:54:11 -08:00
opencode-agent[bot]
22ab061312
fix(session-ui): fix current-timeline error card trigger height and tighten subagent tests (#67006)
Co-authored-by: James Long <james@anoma.ly>
2026-11-28 13:22:18 -05:00
opencode-agent[bot]
cc0677159e
fix(session-ui): keep subagent cards apart in the current timeline (#66918)
Co-authored-by: James Long <james@anoma.ly>
2026-11-28 11:28:22 -05:00
opencodejr[bot]
c7c2881c66
test(app): expect the Automations entry in Home and vertical tabs e2e tests (#67000) 2026-11-28 10:58:38 -05:00
opencode-agent[bot]
3456865d16
fix(app): keep the inbox from opening tabs or taking tab shortcuts (#66496)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-28 23:41:39 +08:00
opencode-agent[bot]
fdacacb2c5
fix(session-ui): truncate tool group labels that name many tools (#66821)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-28 15:39:28 +00:00
Ryan Vogel
c3fa442b45
feat(site): link the iPhone app to the App Store (#66989) 2026-11-28 09:05:15 -06:00
Jack
2204311ec6
fix(site): finish the docs UI labels and stamp intentional English (#66964)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-cli-rs / check (push) Waiting to run
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-28 18:31:57 +08:00
Simon Klee
8870cabc06
fix(cli-rs): treat an empty XDG_STATE_HOME as unset, and pin the P-TUI clock (#66959) 2026-11-28 10:48:07 +01:00
Frank
e1b5c45b96
fix(release): accept localized docs routes in site targets (#66957)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-28 04:06:15 -05:00
Frank
6d1d82e8f0
fix(data): localize remaining zh data page copy (#66937) 2026-11-28 03:53:52 -05:00
Aiden Cline
eeeeaa0db3
fix(core): parse MCP server configs once before connecting or signing in (#66931) 2026-11-27 22:44:37 -06:00
Simon Klee
c3eea9045e
feat(cli-rs): find in session, and the TUI fixes since #66776 (#66875) 2026-11-28 05:44:20 +01:00
Jack
3436a8e928
fix(site): tidy the docs Console nav key in the dictionaries (#66930) 2026-11-28 12:29:55 +08:00
Jack
67cef7e6af
docs(site): translate V2 docs to 16 more languages (#66838) 2026-11-28 12:21:49 +08:00
Jack
1a7af0f7ab
docs(site): translate V2 docs to Simplified Chinese (#66786) 2026-11-28 12:18:36 +08:00
Jack
b07e33bff4
feat(site): multi-language V2 docs (#66778) 2026-11-28 12:16:20 +08:00
Jack
970213080c
refactor(site): share locale helpers between site and data (#66772) 2026-11-28 12:14:01 +08:00
Aiden Cline
136583cb11
fix(core): keep MCP needs_auth and event follows through connection teardown (#66923) 2026-11-27 22:12:59 -06:00
Dan Smolsky
c5cc9369c8
feat(core): stop a subagent's Claude process once it goes idle (#66229) 2026-11-27 22:34:37 -05:00
David Hill
2a2d46f772
chore(data): update OpenMono to 1.001 (#66909) 2026-11-27 21:29:19 -06:00
David Hill
f863c00b91
chore(site): update OpenMono to 1.001 (#66908) 2026-11-27 21:29:14 -06:00
Aiden Cline
f7ac3ac447
fix(app): guard channel lookup in settings catalog (#66926) 2026-11-28 03:28:33 +00:00
Kit Langton
c4d994d74d
feat(core): support native Windows machine workers on the home (#66912) 2026-11-27 19:28:30 -08:00
Aiden Cline
af9dfecabf
fix(core): share pooled MCP connections across equivalent configs (#66914) 2026-11-27 21:24:20 -06:00
Aiden Cline
4eba154a56
feat(core): let tools call other tools through context.tool.call (#66919) 2026-11-27 21:16:31 -06:00
Aiden Cline
a2c07baca4
feat(core): enable opencode api in dev by default (#66924) 2026-11-28 03:10:45 +00:00
Aiden Cline
86de9febb9
fix(core): keep the MCP SDK out of startup and type MCP errors (#66915) 2026-11-27 20:47:15 -06:00
Kit Langton
59af60fbf4
refactor(sdk,server): split ServerOptions, unify ServerFetch, and clean SDK seams (#66880) 2026-11-27 16:51:43 -08:00
Kit Langton
a1e942988d
refactor(core): plan inbox boundaries purely and carry drain position (#66879) 2026-11-27 16:49:33 -08:00
Dax
5410c21e3e
fix(app): only call a cron every N hours when it covers the whole day (#66900) 2026-11-27 18:35:50 -05:00
Dax
f5683d1e69
feat(app): ship automations and clean up the list (#66899) 2026-11-27 18:33:53 -05:00
Aiden Cline
6f1e4d1fc7
fix(cli-rs): mark /find as not ported in the slash parity test (#66895) 2026-11-27 17:31:16 -06:00
Aiden Cline
36bfb85cd1
fix(app): keep tab widths while closing tabs with the mouse (#66887) 2026-11-27 22:01:41 +00:00
Jack
68ea328db1
feat(site): link to the Console pages in the page's language (#66852) 2026-11-28 04:24:45 +08:00
Jack
497569c6f2
fix(site): review site copy in 16 more languages (#66844) 2026-11-28 04:15:47 +08:00
Jack
8ff8defb39
fix(site): use 你 and keep agent in English in zh copy (#66787) 2026-11-28 04:08:25 +08:00
Kit Langton
a152d11d07
fix(core): return typed Config.integration result and centralize Flag reactivity (#66873) 2026-11-27 11:38:43 -08:00
Kit Langton
a766ad0db9
fix(core): forward workspace options without waking and resolve Environment.path once (#66872) 2026-11-27 11:38:24 -08:00
Kit Langton
a82fac193d
refactor(core): split WebSocketConstructor by runtime and export Pty.unsupportedLayer (#66869) 2026-11-27 11:38:07 -08:00
Kit Langton
e445d5238f
fix(core): forward MCP skills spec in pool and simplify pool state (#66870) 2026-11-27 11:34:45 -08:00
Dan Smolsky
5d1f788444
fix(core): skip files Claude Code cannot read (#66757) 2026-11-27 13:44:02 -05:00
usrnk1
ca43c2f68d
feat(app): rename Component Lab to Lab, with pages and states (#66618) 2026-11-27 19:26:48 +01:00
usrnk1
eb010a1a68
feat(app): answer questions from the composer in the New question UI experiment (#66825) 2026-11-27 18:09:07 +00:00
Simon Klee
d70760947e
chore(ci): build the Rust client for every target (#66152) 2026-11-27 13:04:16 -05:00
Simon Klee
93e3b623db
fix(tui): don't hang on a slot path with an empty segment (#66863) 2026-11-27 17:50:23 +00:00
Jorge Eduardo Rojas
999950b2fc
fix(client): treat an empty XDG_STATE_HOME as unset (#61288)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
2026-11-27 17:48:32 +00:00
Filip Hejmowski
568ce4871c
test(tui): fix Home worktree test on Windows (#66864) 2026-11-27 17:43:48 +00:00
Simon Klee
707abbf190
fix(cli-rs): port provider order and the service.json refusal, and fix CI-only test races (#66776) 2026-11-27 18:38:56 +01:00
James Long
b40acc9eb0
fix(session-ui): group unknown tools as "Tool" in step-counted headers (#66853) 2026-11-27 12:34:39 -05:00
opencodejr[bot]
773f5ea574
test(tui): wait for server replies before Home worktree frame checks (#66858)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-27 18:16:14 +01:00
Dan Smolsky
020d2307d9
fix(core): pass attachment file names to Claude Code (#66756) 2026-11-27 16:59:59 +00:00
Dan Smolsky
e29159eed8
fix(core): stop Claude Code treating an image from earlier turns as newly attached (#66755) 2026-11-27 11:52:59 -05:00
Aiden Cline
2be552c4e5
fix(core): append Meta's guidance to the default prompt for Muse (#66711) 2026-11-27 10:27:38 -06:00
Filip Hejmowski
df6ccc7202
fix(tui): third batch of small TUI bug fixes (#66841) 2026-11-27 16:48:30 +01:00
David Hill
35a7b08cd1
feat(site): add Anomaly avatar downloads to the press page (#66843) 2026-11-27 09:44:40 -06:00
Filip Hejmowski
c02e6ecc1a
fix: fix a batch of Windows tooling and test harness issues (#66806)
Co-authored-by: Viraj Choudhary <70713801+virajchoudhary@users.noreply.github.com>
Co-authored-by: Nie Yinan <noah17@yeah.net>
Co-authored-by: Matthew Em. Spotnitz <mespotnitz@gmail.com>
Co-authored-by: stussysenik <35629779+stussysenik@users.noreply.github.com>
2026-11-27 16:37:22 +01:00
opencodejr[bot]
f2a9ebb462
test(app): wait for the composer hand-off before keyboard navigation in the inbox shelf test (#66807)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-27 10:12:28 -05:00
Filip Hejmowski
9dff0b8255
fix(i18n): fix a batch of mistranslations and misplaced labels (#66805)
Co-authored-by: Olcan Askar <aabdullaholcan@gmail.com>
Co-authored-by: OrlovKS <kys.tok@ya.ru>
Co-authored-by: Hossein Mirhadi <ho3in.mirhadi@gmail.com>
Co-authored-by: dat-rd <thanhdat.rd.70369@gmail.com>
Co-authored-by: чеснок <68599854+KPGVM@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: anastasio <Zxl2024903531@outlook.com>
Co-authored-by: 王梓峰 <1805827169@qq.com>
2026-11-27 15:58:47 +01:00
usrnk1
8815bc9d47
feat(session-ui): show quotes inline in user messages in every build (#66823) 2026-11-27 14:38:03 +00:00
Filip Hejmowski
138cc9aedb
fix(tui): second batch of small TUI bug fixes (#66813) 2026-11-27 15:36:25 +01:00
Aarav Sareen
98bc686252
feat(app): browser address bar and recent pages in the side panel New tab (#66818)
Co-authored-by: Aarav Sareen <arvsrn@Aaravs-MacBook-Pro.local>
2026-11-27 20:01:01 +05:30
Aiden Cline
31a291bd03
fix(core): report MCP web search tool errors instead of empty results (#66819)
Co-authored-by: fihade <millerliang97@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:08:48 -06:00
Aiden Cline
32e5583491
feat(core): ask before loading an MCP skill, once per version (#66731) 2026-11-27 08:07:18 -06:00
Aiden Cline
ef0431d44c
fix(core): cap long strings in Code Mode call rows (#66816) 2026-11-27 08:01:50 -06:00
Filip Hejmowski
a4f1040b48
docs: fix a batch of outdated and missing docs (#66803)
Co-authored-by: TuanNancy <vuanhtuan18092004@gmail.com>
Co-authored-by: yash-alla <112993411+yash-alla@users.noreply.github.com>
Co-authored-by: Johannes Starke <johannesstarke@gmail.com>
Co-authored-by: M. Pranay <mudadlapranay@gmail.com>
Co-authored-by: andreivince <andreivince21@gmail.com>
2026-11-27 14:57:15 +01:00
usrnk1
740bd1d732
feat(ui): add icon audits to Components Lab (#66768) 2026-11-27 13:21:41 +00:00
opencode-agent[bot]
b7a7135bb9
feat(app): choose a model from a searchable list after connecting a provider (#66608)
Co-authored-by: arvsrn <96787824+arvsrn@users.noreply.github.com>
Co-authored-by: Aarav Sareen <arvsrn@Aaravs-MacBook-Pro.local>
2026-11-27 18:33:59 +05:30
Filip Hejmowski
8db8c7f366
fix(ai): ignore x-should-retry on successful responses when the stream drops (#66798) 2026-11-27 12:50:39 +00:00
Filip Hejmowski
32f694892e
fix(tui): batch of small TUI bug fixes (#66795) 2026-11-27 13:18:05 +01:00
Filip Hejmowski
0b22cf9195
fix(ai): treat Tencent's 400003 input limit error as context overflow (#66796) 2026-11-27 12:16:38 +00:00
Filip Hejmowski
0081ffabb4
fix(mcp): fix a batch of MCP OAuth, connection and prompt issues (#66636) 2026-11-27 13:03:04 +01:00
Ludvig Rask
0a4e0109b5
feat(ui): taller tooltip lines and colored tooltip text (#66789) 2026-11-27 12:45:29 +01:00
Filip Hejmowski
9d4c5a57a8
feat(tui): find in session (#64870) 2026-11-27 12:30:45 +01:00
victor
2b8f912c86
fix(core): let a CI failure wake a full window when it settles with other updates (#66763) 2026-11-27 08:54:49 +00:00
opencode-agent[bot]
9b1992045a
fix(session-ui): group a script's file changes into one patch group (#66751)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-27 16:09:03 +08:00
opencode-agent[bot]
80bd09332b
fix(app): show the Recent header in the inbox sidebar again (#66494)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-27 15:59:35 +08:00
opencode-agent[bot]
5ca42a3e0c
feat(desktop): first-quit notice that OpenCode keeps running, and a setting to stop it on quit (#66499)
Some checks failed
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Has been cancelled
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Has been cancelled
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Has been cancelled
check / typecheck (push) Has been cancelled
check-nix / nix-eval (push) Has been cancelled
deploy-files / files-build (push) Has been cancelled
deploy-site / site-build (push) Has been cancelled
deploy / legacy-build (push) Has been cancelled
deploy / data-build (push) Has been cancelled
bot-nix-hashes / compute (push) Has been cancelled
bot-nix-hashes / publish (push) Has been cancelled
deploy-files / files-deploy (push) Has been cancelled
deploy-site / site-deploy (push) Has been cancelled
deploy / legacy-deploy (push) Has been cancelled
deploy / data-deploy (push) Has been cancelled
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-27 15:08:36 +08:00
opencode-agent[bot]
b64f928fd0
fix(app): keep the inbox list in place when a focused session changes section (#66547)
Co-authored-by: Brendonovich <14191578+Brendonovich@users.noreply.github.com>
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-27 15:00:03 +08:00
opencode-agent[bot]
30db303dc5
fix(app): keep the selected session in the collapsed Working section (#66500)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-27 14:59:23 +08:00
opencode-agent[bot]
2535f4a2b0
fix(app): open the row below after archiving the open inbox session (#66558)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-27 14:51:16 +08:00
Dan Smolsky
93e15e2557
fix: use the same provider order in desktop, the TUI and auth login (#66736) 2026-11-27 01:50:57 -05:00
Kit Langton
e702df9e74
fix(cli): refuse to overwrite an invalid service.json (#66687) 2026-11-27 00:26:36 -06:00
Kit Langton
dd1418bd8d
fix(core): forward local MCP server stderr to debug logs (#66685) 2026-11-27 00:26:17 -06:00
Aiden Cline
08cc1967e2
fix(ai): pass effort and tool update support through routes built on shared protocols (#66721) 2026-11-27 05:02:17 +00:00
Aiden Cline
ca9ba8ad9f
fix(ai): fold tool changes alongside context_management compaction on Responses (#65028) 2026-11-26 22:59:07 -06:00
Aiden Cline
b5bb6baeda
fix(ai): keep the prompt cache when switching effort on Copilot GPT (#66648) 2026-11-26 22:52:53 -06:00
Aiden Cline
0b6663a8ea
fix(core): release the native PTY when a terminal's shell exits on its own (#66720) 2026-11-26 22:49:16 -06:00
Aiden Cline
23d6540586
fix(core): register a new ChatGPT client when adding an account (#64945) 2026-11-27 04:37:08 +00:00
Aiden Cline
804b0f2306
fix(core): convert each tool schema to JSON Schema once (#66656) 2026-11-26 22:36:44 -06:00
Aiden Cline
ace8a5302e
fix(core): read effort and system update flags from models.dev (#66717) 2026-11-27 04:35:07 +00:00
Aiden Cline
7bfda96047
refactor(core): parse MCP skill entries once and type skill load failures (#66649) 2026-11-26 21:57:05 -06:00
Kit Langton
1e83f843c1
refactor(core): unify location and private SDK instances in one map (#66690) 2026-11-26 19:43:36 -08:00
Aiden Cline
3161ddcbfb
fix(ai): replay Muse commentary after a tool call without its phase (#65774) 2026-11-26 21:23:24 -06:00
Aiden Cline
2c97d2de9b
fix(core): show the keys a model sent when a tool call misses a required key (#66504) 2026-11-26 21:15:20 -06:00
Aiden Cline
6d1bcacf9b
fix(core): replace all edit matches in one pass (#66665) 2026-11-26 21:13:15 -06:00
Adam Hearn
449c128a5b
fix(data): guard alias and catalog lookups against Object.prototype keys (#66670) 2026-11-26 23:46:04 +00:00
Sebastian
9c3f8311a6
feat(server): sync and write several experimental spaces in one request (#66694)
Some checks are pending
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: kommander <335157+kommander@users.noreply.github.com>
2026-11-27 00:26:13 +01:00
Kit Langton
42542eab45
fix(core): re-provision workspace when destroy and recreate race connect (#66684) 2026-11-26 15:20:51 -08:00
Simon Klee
7290a572cc
fix(cli-rs): port selection colours and ACP fixes, and regenerate bindings (#66652) 2026-11-26 23:40:11 +01:00
Adam Hearn
18c4f55118
fix(core): poll Console config every 5 minutes with jitter (#66673) 2026-11-26 14:32:55 -08:00
opencodejr[bot]
1b7cc2e5a7
test(app): expect Modus as Midnight's neighbor in the plugin theme picker test (#66599)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-26 15:58:42 -06:00
Luke Parker
d382c66c6d
feat(ui): add Sakura, Espresso, Witch Hazel, E-Ink, and Dune themes (#66531) 2026-11-26 15:46:59 -06:00
David Hill
d0ccd5a00a
feat(data): even corners and descriptions under titles in phone section headings (#66679) 2026-11-26 15:39:15 -06:00
David Hill
3fa1bbac8a
feat(data): section controls above the title on phones (#66675) 2026-11-26 15:26:11 -06:00
Kit Langton
4ce2ecd5a2
refactor(core): build shared location globals once on the host (#66663) 2026-11-26 13:24:26 -08:00
Kit Langton
bd87e00380
refactor(core): scope background fibers and derive InternalPlugin services (#66502) 2026-11-26 13:23:23 -08:00
David Hill
355d1e79d9
fix(data): 44px share tap targets on touch; period toggle hugs its buttons (#66669) 2026-11-26 15:05:55 -06:00
Sebastian
63b7f04555
feat(server): batch writes for experimental spaces (#66668)
Co-authored-by: kommander <335157+kommander@users.noreply.github.com>
2026-11-26 21:52:33 +01:00
David Hill
5dfb6dfccd
fix(data): draw link-card characters from OpenMono's rest file (#64798) 2026-11-26 14:50:36 -06:00
David Hill
377026dd03
feat(site): use OpenMono as the mono typeface (#64796) 2026-11-26 14:45:30 -06:00
David Hill
b15f4e9301
feat(app): bundle OpenMono as the default mono font (#64797) 2026-11-27 06:36:51 +10:00
James Long
82d8fc5bec
feat(session-ui): count a script's steps instead of the script with full_codemode (#66650) 2026-11-26 14:22:00 -05:00
David Hill
8876471936
fix(data): redraw the share video icon on whole pixels (#66658) 2026-11-26 13:19:38 -06:00
Aiden Cline
8ec08f4913
refactor(core): keep one entry per skill and parse skill paths at the edge (#66285) 2026-11-26 12:01:20 -06:00
Aiden Cline
fcc2732693
fix(core): show Code Mode file calls as reads and writes (#66647) 2026-11-26 17:57:56 +00:00
Aiden Cline
3a2e427d0d
fix(ai): map Z.AI's model_context_window_exceeded finish to length (#66646) 2026-11-26 17:47:32 +00:00
Aiden Cline
ac2263f34c
fix(ai): map Z.AI's sensitive finish reason to content-filter (#66643) 2026-11-26 17:42:13 +00:00
James Long
a956150945
fix(session-ui): keep a script's Output when its changes are grouped (#66638) 2026-11-26 12:34:47 -05:00
Aiden Cline
2ae0ff0008
refactor(core): split session API skill reference into a folder (#66434) 2026-11-26 11:24:07 -06:00
David Hill
26748986e3
fix(data): phone share editor matches desktop (#66639) 2026-11-26 11:21:09 -06:00
Filip Hejmowski
9f49f9e37a
fix(session-ui): keep sticky file headers under the taller group header (#66637) 2026-11-26 17:05:37 +00:00
Aiden Cline
6c26549955
refactor(core): drop the Kimi system prompt override (#66538) 2026-11-26 10:38:51 -06:00
opencodejr[bot]
93e053ff89
fix(app): pass the Home automations entry into the projects view instead of reading contexts there (#66635)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
Co-authored-by: Filip <filip@anoma.ly>
2026-11-26 17:37:11 +01:00
James Long
104bda5ba3
feat(session-ui): flat execute layout and script diffs behind full_codemode (#66509) 2026-11-26 11:26:06 -05:00
victor
4769a48e5d
fix(core): settle bursts of watched status changes into one wake (#66332) 2026-11-26 17:13:06 +01:00
victor
d97b2265ee
feat(core): read voice, embedding and transcription models from config (#66627) 2026-11-26 17:09:09 +01:00
Filip Hejmowski
1917f0eb4a
fix(acp): fix a batch of ACP issues (#66631) 2026-11-26 17:05:20 +01:00
Sebastian
d580636cd4
feat(server): experimental spaces (#63998)
Co-authored-by: kommander <335157+kommander@users.noreply.github.com>
2026-11-26 16:45:28 +01:00
Filip Hejmowski
782125f72a
feat(app): show where automations run and which session they wake (#66393)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-26 16:14:19 +01:00
Filip Hejmowski
c39ad3b75c
feat(desktop): add smooth scrolling setting on linux (#66622) 2026-11-26 16:09:14 +01:00
Filip Hejmowski
44159132a5
fix(core): pass a plugin id in the session.update test (#66620) 2026-11-26 15:06:47 +00:00
Ryan Yip
3c019e9199
fix(plugin): session.update silently ignores archived (#61036) 2026-11-26 15:50:49 +01:00
Filip Hejmowski
586fa9038a
fix(tui): draw text selections in theme colours (#65776) 2026-11-26 15:19:37 +01:00
Filip Hejmowski
924b560240
fix(app): ask before opening a folder from an opencode:// link (#65803) 2026-11-26 15:12:00 +01:00
Filip Hejmowski
b5ae67aecb
fix(core): keep nested permission metadata JSON-encodable (#66391) 2026-11-26 15:02:12 +01:00
Filip Hejmowski
f91949daee
fix(session-ui): show images tool calls return in the timeline (#66430) 2026-11-26 15:00:26 +01:00
opencode-agent[bot]
6e0eda6317
feat(app): add Copy submenu to session menus (#66576)
Co-authored-by: victor <victor@anoma.ly>
Co-authored-by: kamil <kamil@anoma.ly>
Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com>
2026-11-26 13:57:28 +00:00
Filip Hejmowski
70e8a0f6f3
fix(core): fall back to legacy when the MCP probe gets an HTTP 5xx (#66588) 2026-11-26 14:48:04 +01:00
usrnk1
dc390b6a04
fix(app): use sessions-stack icon for Home by default (#66594) 2026-11-26 14:31:41 +01:00
victor
697db19210
feat: ship model speeds by removing the model_speeds flag (#65877) 2026-11-26 13:33:38 +01:00
Frank
314842df11
fix(data): keep sparse early days from breaking the new model user estimate (#66561)
Some checks failed
deploy-files / files-build (push) Has been cancelled
deploy-site / site-build (push) Has been cancelled
deploy-update / update-build (push) Has been cancelled
deploy / legacy-build (push) Has been cancelled
deploy / data-build (push) Has been cancelled
deploy-files / files-deploy (push) Has been cancelled
deploy-site / site-deploy (push) Has been cancelled
deploy-update / update-deploy (push) Has been cancelled
deploy / legacy-deploy (push) Has been cancelled
deploy / data-deploy (push) Has been cancelled
2026-11-26 03:59:33 -05:00
Frank
6f707fe45f
feat(data): estimate new model users since launch from daily and weekly counts (#66553) 2026-11-26 03:49:16 -05:00
opencode-agent[bot]
bcd1457002
docs(console): add OpenClaw harness guide (#66548)
Co-authored-by: aj <aj@anoma.ly>
2026-11-26 02:25:20 -05:00
Frank
44344bd22d
feat(data): show launch totals and switchable new models (#66529)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-files / files-build (push) Waiting to run
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
2026-11-25 23:51:39 -05:00
Luke Parker
04eccc3012
feat(ui): add Modus, Alabaster, VS Code, Cyberdream, Poimandres, and Oxocarbon themes (#66528) 2026-11-25 22:44:40 -06:00
Luke Parker
5e000543a6
feat(ui): calibrate non-default GUI themes for WCAG 2.2 contrast and elevation (#66521) 2026-11-25 22:27:53 -06:00
Dan Smolsky
fb4da63818
feat(core): send question, answer, error and permission details in push data (#66451) 2026-11-26 04:12:15 +00:00
Dan Smolsky
e927e98f06
fix(session-ui): keep the View code button on an open execute call's title line (#66519) 2026-11-25 23:07:59 -05:00
Kit Langton
3331136a63
refactor(core): gate VCS, Snapshot, Worktree, and Project on Environment (#66498) 2026-11-25 20:00:14 -08:00
Kit Langton
563f732360
refactor(core): type Bus commit errors and settle OAuth Deferreds synchronously (#66495) 2026-11-25 19:59:19 -08:00
opencode-agent[bot]
2820f6a9a5
test(app): mock /api/experimental/flag in e2e mock server (#66513)
Co-authored-by: Hona <luke@anoma.ly>
2026-11-26 03:44:54 +00:00
Luke Parker
662002c557
fix(desktop): smooth Windows installer progress bar with live status and throughput (#66506) 2026-11-25 21:16:46 -06:00
Luke Parker
63261c1c5d
feat(desktop): add opt-in install updates on quit setting (#66501) 2026-11-25 20:29:41 -06:00
James Long
1f66f5f4ad
feat(server): expose resolved feature flags at /api/experimental/flag (#66469) 2026-11-25 20:42:34 -05:00
Luke Parker
badd3ea1cd
feat(browser): stream remote browser traffic over multiplexed binary WebSocket (#66217) 2026-11-26 01:41:08 +00:00
opencode-agent[bot]
90dc1b5f94
docs: add Seaglass Alpha Free (#66490)
Co-authored-by: Daniel <daniel@anoma.ly>
Co-authored-by: Daniel Chen <daniel85.chen@gmail.com>
2026-11-25 17:23:50 -08:00
opencode-agent[bot]
4d9ce85135
data: treat seaglass-alpha as a stealth model (#66489)
Co-authored-by: Daniel <daniel@anoma.ly>
2026-11-25 17:19:07 -08:00
Adam Hearn
d09b189ba1
feat(core): agent(), llm() and structured JSON Schema output in Code Mode (#66278) 2026-11-26 00:41:30 +00:00
Kit Langton
2b88b48c3b
refactor(core): decouple Environment from Workspace via WorkspaceConnector (#66485) 2026-11-25 16:31:39 -08:00
Aiden Cline
1e16a3177b
fix(core): ignore node_modules and .git in configured plugin directory watches (#66471) 2026-11-25 18:30:22 -06:00
Kit Langton
fe187c63e4
test(core): add snapshot-deserialized TestDatabase fixture helper (#66482) 2026-11-25 16:20:47 -08:00
Aiden Cline
f3b5e9fa0a
fix(ai): name the request URL in bare provider HTTP errors (#66477) 2026-11-25 18:11:03 -06:00
Aiden Cline
55b3550c77
test(app): update question dock tests for Enter submitting answers (#66480) 2026-11-25 23:52:04 +00:00
Aiden Cline
08918300c2
refactor(core): make generate_image and generate_video Code Mode tools (#66465) 2026-11-25 17:45:00 -06:00
Kit Langton
2709f3a554
fix(core): delegate Drizzle SQLite transactions to Effect SqlClient (#66473) 2026-11-25 15:37:49 -08:00
Aiden Cline
304a0c8064
test(app): expect /rename in the slash command list (#66474) 2026-11-25 23:36:13 +00:00
Adam
8a05e78d8e
fix(core): watch a Console artifact share's comments from the root session (#66460) 2026-11-25 17:33:55 -06:00
Simon Klee
c914188339
fix(cli-rs): bring the Rust client level with the TUI (#66470) 2026-11-26 00:15:52 +01:00
Kit Langton
458371c5cc
refactor(util): simplify LayerNode and add typed node.mock (#66467) 2026-11-25 15:13:38 -08:00
Sebastian
3b38a77c09
feat(core): copy files and forward ports directly between machines (#66457)
Co-authored-by: kommander <335157+kommander@users.noreply.github.com>
2026-11-26 00:09:40 +01:00
Kit Langton
c85b83eb08
refactor: fix live lint:effect-patterns violations across util, core, and cli (#66418)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-25 14:03:44 -08:00
Kit Langton
ac1bab2ffc
test: isolate home and XDG directories across core preload, server, and sdk (#66417) 2026-11-25 13:55:04 -08:00
Kit Langton
73c3b1da2f
fix(core): scope remaining module-level keyed mutexes to host services (#66416) 2026-11-25 13:53:46 -08:00
opencode-agent[bot]
028cd6ce91
feat(app): submit question answers with Enter, with a setting for Cmd/Ctrl+Enter (#66169) 2026-11-25 22:22:35 +01:00
Dan Smolsky
dfce18305d
fix(app): keep a running script's shells out of the background pill (#66402) 2026-11-25 15:59:14 -05:00
Dan Smolsky
29c4e472d4
fix(core): include a permission's resources in its push notification (#66445) 2026-11-25 15:56:50 -05:00
Aiden Cline
6e01a86973
fix(core): don't pause automations on failed runs or missing tools (#66422) 2026-11-25 14:30:16 -06:00
Aiden Cline
57551d990d
fix(ai): send freeform tools as JSON when the model doesn't list its formats (#66436) 2026-11-25 20:27:51 +00:00
Aiden Cline
35c35d3d80
test(data): run data app tests with the solid condition instead of mocking the router (#66447) 2026-11-25 14:22:20 -06:00
Dax
2b296cabc8
feat(site): replace header product dropdown with flat docs sub-links (#66439)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-25 14:25:18 -05:00
Aiden Cline
a021b09474
docs(core): prefer all built-in tools before OpenCode HTTP API (#66431) 2026-11-25 18:57:28 +00:00
opencode-agent[bot]
01328b65e9
docs: extend DeepSeek ZDR date to December 31, 2026 (#66429)
Co-authored-by: Jack <jack@anoma.ly>
2026-11-26 02:31:01 +08:00
Filip Hejmowski
1765c26657
fix(tui): check connected providers in the session location (#66424) 2026-11-25 19:21:09 +01:00
Adam
b6973f1b7b
docs(console): document the usage export API (#66420) 2026-11-25 17:52:01 +00:00
opencode-agent[bot]
3ac14c053c
feat(app): regenerate session title with bare /rename (#66396) 2026-11-25 18:10:07 +01:00
Aiden Cline
0caad64533
refactor(core): trim redundant boilerplate in the opencode skill (#66305) 2026-11-25 10:44:02 -06:00
Dan Smolsky
45b5bd4694
feat: undo when interrupting before the model answers (#65505) 2026-11-25 11:33:45 -05:00
Dax
e0bf30832b
chore(release): add backfill-blockmaps workflow (#66403) 2026-11-25 11:20:25 -05:00
Adam Hearn
a75fcac14c
fix(site): stop sharing in-flight edge cache reads across requests (#66226) 2026-11-25 07:59:38 -08:00
Filip Hejmowski
1b297d1a49
test(core): drop redundant core tests (#66387) 2026-11-25 16:17:56 +01:00
Adam
ad4ed1d41d
fix(site): point the legal history's Nov 25 entries at dev's commit (#66388) 2026-11-25 09:09:35 -06:00
Adam
2cd57b2f8b
docs(site): publish the updated Terms of Use and the Refund Policy (#66126) 2026-11-25 09:03:23 -06:00
Junying Shao
7b8a065e29
fix(core): expand ~\ in session move destinations on Windows (#66269)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-25 15:43:55 +01:00
Filip Hejmowski
6d2cb07f17
fix(core): keep published MCP OAuth resource over configured query (#66036) 2026-11-25 15:19:46 +01:00
Filip Hejmowski
68c244f40b
fix(util): keep a final empty + line in an added file (#66378) 2026-11-25 15:12:31 +01:00
opencode-agent[bot]
45277af6cf
feat(app): show archived sessions dimmed in Search sessions (#66356)
Co-authored-by: victor <victor@anoma.ly>
2026-11-25 15:00:24 +01:00
usrnk1
fd3c9c454f
fix(session-ui): open file tree position menu with Shift+F10 (#66372) 2026-11-25 14:46:40 +01:00
Filip Hejmowski
ea8aa5b05e
fix(tui): keep the model picker responsive with large catalogs (#66370) 2026-11-25 14:18:09 +01:00
victor
d06f869560
fix(tui): list every provider of a just-connected integration (#66363) 2026-11-25 13:48:14 +01:00
Filip Hejmowski
c9afad6206
feat(core): preserve subagent session IDs across compaction (#65136) 2026-11-25 13:45:10 +01:00
Adam
e8224c82b9
feat(data): feature breakout launches in new models (#65884) 2026-11-25 12:36:46 +00:00
Aarav Sareen
5050225a09
fix(app): redesign the add extension dialog (#66355) 2026-11-25 11:48:08 +00:00
opencode-agent[bot]
f8fc24ea5c
fix(server): unarchive a session when a person sends it input (#66348)
Co-authored-by: victor <victor@anoma.ly>
2026-11-25 11:16:07 +00:00
Aarav Sareen
204d38da8d
feat(app): group tabs by project or server in Consolidated (#66350) 2026-11-25 16:46:04 +05:30
Aarav Sareen
59a7e1cccc
feat(app): join consecutive thoughts in the new timeline (#66349) 2026-11-25 11:12:39 +00:00
usrnk1
64324cf3e4
fix(app): show keyboard focus in the worktree picker and What's New (#66340) 2026-11-25 10:44:19 +00:00
opencode-agent[bot]
fe4535adce
fix(release): publish blockmaps for signed desktop installers (#66042)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-25 05:28:58 -05:00
Aarav Sareen
eec153e79a
fix(app): split the browser import dialog into what to import and which sites (#66339) 2026-11-25 10:22:45 +00:00
Aarav Sareen
31459a2c9e
fix(app): remove the gap inside top tab groups (#66343) 2026-11-25 10:22:07 +00:00
usrnk1
879d7dc893
docs: check Tab and Shift+Tab when focus behaviour changes (#66338) 2026-11-25 11:18:04 +01:00
opencode-agent[bot]
acce96c36e
fix(app): inbox sidebar — archived sessions needing attention, archive toggle, session shortcuts (#66327)
Co-authored-by: Brendan <brendan@anoma.ly>
Co-authored-by: victor <victor@anoma.ly>
2026-11-25 09:37:20 +00:00
Aiden Cline
b5dba31bf2
feat(core): add gpt-6.2 system prompt and routing (#66297) 2026-11-25 01:47:57 -06:00
Aiden Cline
a73e0db2f3
docs(protocol): name HTTP routes in session prompt description (#66306) 2026-11-25 01:45:30 -06:00
Aarav Sareen
e54fbacb3d
fix(ui): update settings icon hexagon (#66308) 2026-11-25 07:33:35 +00:00
Kit Langton
af4c115588
fix(core): normalize Link welcome label for Workspace.IDs and validate in Link.dial (#66298) 2026-11-24 23:16:52 -08:00
Aiden Cline
1aee987a60
fix(core): fix errors in the opencode skill and API reference (#66300) 2026-11-25 01:13:15 -06:00
Aiden Cline
df2f7837e1
perf(core): cut repeated work in Code Mode runs (#66250) 2026-11-25 01:02:26 -06:00
Aiden Cline
fb5ba10f4f
feat(core): make the report skill gather what maintainers need (#66290) 2026-11-25 06:55:33 +00:00
Aarav Sareen
546a44d8fa
fix(session-ui): simplify execute details dialog (#66295) 2026-11-25 06:53:41 +00:00
Dan Smolsky
8d7477816f
fix(core): store push notifications (#66273)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-25 06:22:51 +00:00
Aiden Cline
1f5856d7a5
fix(core): load an MCP skill given only its URI (#66220) 2026-11-25 06:14:48 +00:00
Dax
b19812f0f5
fix(desktop): use VITE_OPENCODE_CHANNEL in renderer (#66279) 2026-11-25 01:08:12 -05:00
Dan Smolsky
ee9f4fd845
fix(core): clear a session's push notifications when it is archived (#66275) 2026-11-25 05:59:16 +00:00
Aiden Cline
20e7f000b3
perf(core): skip the extra copy of file bytes for Code Mode fetch Blob bodies (#66271) 2026-11-24 23:37:17 -06:00
Kit Langton
6f6c193006
feat(sdk,core,server): wire OpenCodeWorkerd alarm(), WorkspaceDriver Identity, and WorkerClient.fromWebSocket (#66240) 2026-11-24 21:32:40 -08:00
opencodejr[bot]
e1578f67af
fix(core): copy file bytes into an ArrayBuffer-backed Uint8Array for fetch Blob bodies (#66264)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-24 23:24:34 -06:00
Aarav Sareen
13d601e31f
feat(app): fill Consolidated gaps in pins, sidebar and Home picker (#66265) 2026-11-25 05:19:08 +00:00
Aiden Cline
05a8196c1e
fix(core): move subagents with their parent session (#66215) 2026-11-24 23:11:05 -06:00
Aiden Cline
0c30d6578c
feat(core): trace background compaction and the wait for it (#66254) 2026-11-24 23:09:53 -06:00
Dan Smolsky
4c2977b82e
feat(core): add push notifications for the mobile apps (#66130) 2026-11-24 23:52:07 -05:00
Aiden Cline
dc3b58beb3
perf(codemode): skip redundant schema work in Code Mode catalogs (#66251) 2026-11-24 22:46:13 -06:00
Aiden Cline
ba105b8423
perf(core): diff file changes once and skip diffing empty sides (#66246) 2026-11-24 22:45:05 -06:00
opencodejr[bot]
aa3b856a80
fix(release): pin the data OG Worker's renamed OpenMono font modules (#66253)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-24 23:42:21 -05:00
opencode-agent[bot]
58621ad6cc
fix(app): send prod crashes to Sentry only when Report is clicked (#66257)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-25 04:09:21 +00:00
Aiden Cline
a4bea47aa5
docs(plugin): describe the new quote text in ComposerQuote (#66248) 2026-11-25 03:42:52 +00:00
Aiden Cline
f90047ff14
fix(app): send quotes as plain reply-style blockquotes (#66247) 2026-11-24 21:34:17 -06:00
Aiden Cline
02ae2d377e
fix(core): say which MCP server a skill comes from (#66244) 2026-11-24 21:34:13 -06:00
David Hill
7f7fc38aed
feat(data): share and embed cards for every section, behind the share flag (#65994) 2026-11-24 21:27:11 -06:00
Aiden Cline
1a6aea85ee
fix(core): stop Code Mode Bun.write from walking every byte of a Uint8Array (#66242) 2026-11-25 03:10:24 +00:00
Aiden Cline
4aa115738a
fix(core): tell same-named MCP skills apart instead of dropping one (#66210) 2026-11-24 20:31:03 -06:00
Adam Hearn
3e858dfc11
fix(legacy): return 404 when the GitHub App is not installed (#66224) 2026-11-24 17:41:48 -08:00
Luke Parker
ede9da4204
fix(app): keep the New timeline's rows still when older history loads (#66014) 2026-11-24 19:39:48 -06:00
Adam Hearn
d12947ec18
fix(data): stop sharing in-flight catalog and stats reads across requests (#66225) 2026-11-25 01:38:20 +00:00
Adam Hearn
ba122767ce
fix(update): answer HEAD lookups and log data lake send errors (#66223) 2026-11-25 01:19:17 +00:00
Kit Langton
6e852faa94
fix(core): skip the skill rescan when a config update leaves sources unchanged (#66194) 2026-11-24 19:18:34 -06:00
Kit Langton
4188b32758
refactor(core,server): route FileSystem through Environment.files and drop workerd stubs (#66202) 2026-11-24 17:12:33 -08:00
Luke Parker
92e3e654f2
perf(app): remove forced layout from timeline scroll frames (#65631) 2026-11-24 18:57:35 -06:00
Luke Parker
092c1161b7
fix(app): read only a history page's own messages in four transcript passes (#66066) 2026-11-24 18:27:56 -06:00
Luke Parker
d62d2db9bc
fix(app): keep the command list and session header steady while the transcript changes (#66026) 2026-11-24 18:21:10 -06:00
Aiden Cline
2545a8720f
fix(core): report skills that fail to load instead of crashing (#66207) 2026-11-25 00:18:27 +00:00
Adam Hearn
c73a4d4c4d
fix(update): stop sharing in-flight D1 reads across requests (#66205) 2026-11-24 16:09:47 -08:00
Luke Parker
4e703db7a1
fix(app): keep loaded history when the transcript is read again (#66035) 2026-11-24 18:08:38 -06:00
Aiden Cline
df79010bc6
feat(core): load skills from MCP servers (#66201) 2026-11-24 18:06:08 -06:00
Luke Parker
58473c4511
fix(session-ui): stop hiding a working turn from screen readers (#66120)
Fixes #54652

Both timelines marked every reply and tool row of a working turn aria-hidden, although those rows hold controls that take focus (a tool header, a link in a reply). Remove the attribute in both row renderers. Nothing replaces it: no live region wraps the rows, so nothing is read again while a reply streams.

#51084 by @aimansour made the same change for the current timeline's renderer.

Co-authored-by: Abdullah Mansour <abdullahmansour.marketing@gmail.com>
2026-11-24 17:28:51 -06:00
Aiden Cline
244491841d
refactor(core): let skills load content on demand (#66197) 2026-11-24 16:39:07 -06:00
Luke Parker
f555dfefad
fix(desktop): reattach the browser to sessions in open tabs (#65969)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-24 16:07:58 -06:00
Kit Langton
fb56d1cd91
feat(core,server): add Workspace keepWarm/attach/alarm lifecycle for workerd (#66183) 2026-11-24 13:59:11 -08:00
github-actions[bot]
b0cda2010b
chore: update nix node_modules hashes (#65922)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-24 20:36:46 +00:00
Aiden Cline
d65b5d24c7
fix(core): make partial read results explicit in Code Mode (#65732) 2026-11-24 14:24:37 -06:00
Kit Langton
63f2ac5309
feat(core): add Driver.lazy combinator and pull-mode Worker client (#66030) 2026-11-24 11:58:35 -08:00
Kit Langton
2255b89322
refactor(core): replace Environment.Facts with Options, home, and rg; remove MachinePath (#66024) 2026-11-24 10:41:38 -08:00
usrnk1
22d022cb13
fix(session-ui): lift one-line inline quotes so lowercase sits centered on the bar (#66149) 2026-11-24 18:42:12 +01:00
Adam
3281a5db1b
fix(data): color past leaders in the weekly top models chart (#66118) 2026-11-24 11:00:54 -06:00
victor
9964772701
chore(core): revert niche fixes from the daily review job (#66140) 2026-11-24 17:35:15 +01:00
opencodejr[bot]
66d53a82d0
fix(core): make the API skill and cd worktree tests pass on Windows (#66115)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-24 10:19:10 -05:00
victor
af54caef70
fix(core): refuse plugin automation creates before configured permissions load (#66109) 2026-11-24 14:34:36 +00:00
Ludvig Rask
a44675ecee
feat(ui): radio surfaces and flat unselected controls, as in Figma (#66108) 2026-11-24 15:32:03 +01:00
victor
4bb997ea44
fix(models): honor legacy variants at the selected speed (#66107)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-24 14:15:36 +00:00
victor
f84258d3b6
fix(core): wait for the automation target's plugin registry (#66104) 2026-11-24 14:13:13 +00:00
victor
caacb32ff9
fix(core): register worktrees before honoring cancellation (#66105) 2026-11-24 14:11:38 +00:00
victor
71324e2063
fix(plugin): preserve completed errors on late abort (#66102) 2026-11-24 14:04:40 +00:00
victor
8d915d49de
fix(core): keep saved Superbot Fast Priority sessions working (#66106) 2026-11-24 14:03:09 +00:00
victor
baa7e92876
fix(core): accept undefined fields in Effect plugin automations (#66103) 2026-11-24 14:01:24 +00:00
Ludvig Rask
0c2e204eaa
fix(ui): stack elevation shadows in Figma's order (#66071) 2026-11-24 14:37:08 +01:00
usrnk1
87dd60cbea
refactor(app): choose a missing session worktree from the shared worktree dialog (#66096) 2026-11-24 13:27:59 +00:00
usrnk1
b47eb4ed2d
feat(app): show the worktree shortcut in the base branch tooltip (#66097) 2026-11-24 14:21:39 +01:00
usrnk1
24cf6eb258
fix(app): keep focus in the worktree search while hovering rows (#66092) 2026-11-24 14:01:55 +01:00
usrnk1
678621a5df
fix(app): make the worktree step's back control the search-field arrow (#66090) 2026-11-24 13:33:00 +01:00
victor
adc958a7d7
docs(console): list decision and embedding endpoints in the Inference API (#66064) 2026-11-24 11:11:22 +01:00
Luke Parker
40b6e9cdf8
fix(app): write the scroll position once for each batch of measured rows (#66034) 2026-11-24 03:25:32 -06:00
victor
01bf9f0d65
fix(core): let plugins create automations during setup (#65987) 2026-11-24 09:24:38 +00:00
victor
883c871683
fix(plugin): reject aborted Promise plugin calls with the signal's reason (#66041) 2026-11-24 09:22:12 +00:00
victor
41b6f7dee6
test(core): don't depend on the bundled snapshot's prices for day re-pricing (#66044) 2026-11-24 09:20:39 +00:00
victor
e4cd9c2bc5
fix(core): keep a mode's ID on the service tier it asks for (#65989) 2026-11-24 09:20:02 +00:00
victor
7dd39a70b6
fix(core): keep service tier prices free when text prices aren't per token (#65983) 2026-11-24 09:08:55 +00:00
victor
57f83d690d
fix(plugin): honor abort signals in Promise plugin API calls (#65980) 2026-11-24 09:04:32 +00:00
victor
fe6a9c9013
fix(core): re-price introductory model prices when the day changes (#65985) 2026-11-24 09:03:27 +00:00
victor
f176d3b0c6
fix(tui,app): keep variants saved for a model speed (#65982) 2026-11-24 09:03:18 +00:00
victor
6c7e0455ad
fix(core): price service tier speeds at the tier's long-context rates (#65984) 2026-11-24 09:02:47 +00:00
victor
4149d9e5ea
fix(core): treat another project's automation as missing in automation tools (#65986) 2026-11-24 09:02:36 +00:00
victor
6eccfc8d45
fix(core): validate automations created by Effect plugins (#65981) 2026-11-24 09:02:25 +00:00
opencode-agent[bot]
c94ff33f56
docs: add Kimi K3.1 Pro to Zen models (#66031)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Daniel <daniel@anoma.ly>
2026-11-24 00:28:54 -08:00
victor
81045bf4f8
docs(console): document Go decision and embedding models (#65875) 2026-11-24 09:02:09 +01:00
opencode-agent[bot]
f25b09005e
feat(app): move the file tree to the right from its context menu (#66012)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-24 07:13:36 +00:00
opencode-agent[bot]
18c9719c3c
fix(app): keep text and code files off the artifact background (#65976)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-24 14:50:57 +08:00
Aiden Cline
10b9adbac5
feat(core): generate the opencode skill's API reference from openapi.json (#65836) 2026-11-24 06:49:21 +00:00
Aiden Cline
1d9a0a0000
feat(codemode): say each execute call is a fresh program (#66007) 2026-11-24 06:48:11 +00:00
opencode-agent[bot]
b5948e5229
feat(app): pin inbox sessions and list archived ones in the sidebar (#65961)
Co-authored-by: Brendonovich <14191578+Brendonovich@users.noreply.github.com>
Co-authored-by: aj <aj@anoma.ly>
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-24 14:41:37 +08:00
Aiden Cline
e85a7bc513
feat(codemode): say full Code Mode works with files and data (#65670) 2026-11-24 00:38:09 -06:00
Aiden Cline
c6df401531
fix(core): save the site, not every URL, when always allowing a web fetch (#66000) 2026-11-24 06:35:50 +00:00
Aarav Sareen
f824eb3589
fix(app): line up settings with home and keep home steady at medium widths (#65998) 2026-11-24 11:59:19 +05:30
Aiden Cline
70ba59b511
feat(core): check opencode:// fetch as the opencode api command (#65931)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-24 00:05:13 -06:00
Aiden Cline
5b66287cad
chore(codemode): bump psychoscript to 0.3.0 (#65990) 2026-11-23 23:37:47 -06:00
Aiden Cline
30ef864fe7
feat(core): add agent instructions and use them for Plan mode (#63669) 2026-11-23 23:18:25 -06:00
Aiden Cline
a5232b2057
fix(core): send Bun.file bodies from Code Mode fetch (#65917) 2026-11-23 23:10:14 -06:00
Adam Hearn
8c80aff92b
chore(ci): tighten stale issue closing and add linked-ref/slop workflows (#65954) 2026-11-23 23:37:32 -05:00
Aiden Cline
ee3326b5d1
fix(core): detect PDFs whose header is not at byte 0 (#65967) 2026-11-23 21:14:04 -06:00
opencode-agent[bot]
6e2289bc94
fix(app): show the parent session's side panel tabs in subagents (#65957)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-24 11:09:59 +08:00
opencode-agent[bot]
a9156f58ea
docs: add HungerG Free to Go (#65960)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Jack <jack@anoma.ly>
2026-11-24 02:36:44 +00:00
Adam Hearn
84e357e025
fix(core): harden PermissionPolicy algebra and unattended hook checks (#65945) 2026-11-23 18:08:26 -08:00
Kit Langton
6d04312b71
feat(core): add experimental cd tool behind machines flag (#65938) 2026-11-23 17:00:33 -08:00
Aiden Cline
696db0aa81
fix(core): accept Windows drive paths after local: (#65936) 2026-11-24 00:42:46 +00:00
Adam Hearn
ca9e8f2ce9
refactor(core): introduce Permission.Policy algebra for rule composition (#65907) 2026-11-24 00:37:35 +00:00
Aiden Cline
553c14178e
refactor(ai): decide freeform formats in the AI package from the model's capabilities (#65898) 2026-11-24 00:19:14 +00:00
Aiden Cline
e33e872628
feat(ai): let freeform tools set other parameters on an order-free first line (#65849) 2026-11-23 18:11:00 -06:00
Kit Langton
01daacc688
feat(core): add unified Environments entry point (#65926) 2026-11-23 16:05:49 -08:00
Adam Hearn
3a6c925bae
fix(tui): make goal dialog content scrollable (#65906) 2026-11-23 15:49:52 -08:00
Luke Parker
8d9e096e8c
fix(app): keep the timeline still when a focused row scrolls out of range (#65921) 2026-11-23 17:48:02 -06:00
Adam Hearn
7599851add
fix(app): show app menu in side tabs header on Linux (#65912) 2026-11-23 15:46:39 -08:00
Adam Hearn
4d7951bcc9
fix(tui): revert to default theme when theme is removed from config (#65925) 2026-11-23 15:45:21 -08:00
Simon Klee
4ef8064939
chore: upgrade opentui v0.9.9 (#65919) 2026-11-23 23:08:52 +00:00
Adam Hearn
c7d0d38027
fix(core): hide tools when narrow denies trail a blanket deny (#65899) 2026-11-23 14:57:28 -08:00
Kit Langton
7d2acece1d
fix(core): read host capability from environment facts (#65911) 2026-11-23 14:47:54 -08:00
Adam Hearn
6230d3bc35
fix(core): keep branches whose names end in /HEAD (#65904) 2026-11-23 22:43:35 +00:00
James Long
18ff0717b3
fix(tui): re-enable type-to-filter in message actions (#65903) 2026-11-23 22:17:55 +00:00
Simon Klee
340b42223d
chore(cli-rs): pin OpenTUI 0.9.8 and share one syntax theme across views (#65901) 2026-11-23 23:07:14 +01:00
usrnk1
9a8a656e96
feat(session-ui): show quotes inline in user messages (#65897)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-deploy (push) Blocked by required conditions
2026-11-23 22:21:25 +01:00
Kit Langton
2002026a12
feat(core): report session cwd and load cwd AGENTS.md in instructions (#65889) 2026-11-23 12:09:25 -08:00
Kit Langton
477919960d
fix(server): prefer Iroh ahead of URLs in machine join reach (#65890) 2026-11-23 11:57:26 -08:00
Kit Langton
92e28580f1
test(core): add Bus.node dep to session-cwd test (#65886) 2026-11-23 11:49:11 -08:00
Kit Langton
21d5ab15d7
feat(core): add internal experimental session cwd (#65633) 2026-11-23 11:08:10 -08:00
victor
4b0e34747b
fix(core): price a speed from its tier's own prices when it has no multiplier (#65861) 2026-11-23 19:41:05 +01:00
OpeOginni
914d5e2b1b
fix(tui): keep session selection visible after deletion (#65855) 2026-11-23 13:10:02 -05:00
Aiden Cline
292cb5a164
test(core): make MCP event tests deterministic (#65868) 2026-11-23 11:49:51 -06:00
github-actions[bot]
472d9f8e2e
release: v2.4.1 (#65848)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
2026-11-23 11:33:25 -06:00
Kit Langton
e1fb08afc5
fix(core): stop an automation's timed-out shell command instead of backgrounding it (#65626) 2026-11-23 08:56:43 -08:00
opencode-agent[bot]
adce0e6bfd
Revert "docs: add HungerG Free to Go (#65851)" (#65854)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Jack <jack@anoma.ly>
2026-11-23 16:39:42 +00:00
OpeOginni
c2a6ce7c17
fix(tui): save config updates in order (#65761) 2026-11-23 11:31:56 -05:00
opencode-agent[bot]
a3bf375810
docs: add HungerG Free to Go (#65851)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
2026-11-23 16:09:00 +00:00
Aiden Cline
91365c8caa
docs(protocol): describe API request parameters (#65841) 2026-11-23 10:01:19 -06:00
Aiden Cline
02ccc5c7cc
docs(protocol): clarify session API descriptions (#65837) 2026-11-23 15:45:41 +00:00
OpeOginni
72fbe17715
fix(release): format Discord announcement subheadings (#63495) 2026-11-23 09:34:26 -06:00
Aiden Cline
71020126b0
chore: update team members (#65702) 2026-11-23 10:34:03 -05:00
Jensen
4cf9db9574
fix(latex): support the LaTeX control space in math (#64156)
Co-authored-by: Shreyansh Jain <shreyanshjain646@gmail.com>
2026-11-23 09:03:17 -06:00
Aiden Cline
3bae667b6f
fix(app): keep the model list in place when unfavoriting with the mouse (#65649) 2026-11-23 09:01:59 -06:00
opencode-agent[bot]
698800f59c
fix(plugin): lower the @opentui peer floor to 0.8.0 and stop raising it on upgrades (#65819)
Co-authored-by: Sebastian <sebastian@anoma.ly>
2026-11-23 08:44:53 -06:00
Simon Klee
0089ba9e39
fix(cli-rs): bound the transcript window so scrolling stops growing memory (#65826) 2026-11-23 14:33:47 +00:00
Simon Klee
b51482f907
feat(cli-rs): bring the Rust client up to v2.4.0, and fix finished subagents (#65825) 2026-11-23 15:25:14 +01:00
Aiden Cline
7268011db4
fix(nix): update node_modules hashes (#65824) 2026-11-23 08:22:17 -06:00
usrnk1
9b03fe1f65
fix(app): mark /btw tabs answered in the background as unread (#65821) 2026-11-23 15:14:29 +01:00
usrnk1
d1f98703ab
fix(app): match the layout cards to the navigation cards' style (#65800)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-files / files-build (push) Waiting to run
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-23 12:39:37 +00:00
usrnk1
16ba706544
fix(app): drop the ring around focused file viewers, tool output, error details, What's New and the terminal (#65785) 2026-11-23 12:24:16 +00:00
Filip Hejmowski
8f8a9ae88d
fix(tui): count config-only providers as connected (#65793) 2026-11-23 13:08:11 +01:00
Filip Hejmowski
9ae270fe29
fix(core): keep the goal reminder out of the cache tail (#65788) 2026-11-23 12:56:44 +01:00
usrnk1
2bf2468018
fix(app): drop the ring around a clicked Settings page and round the split button's ring (#65783) 2026-11-23 11:19:02 +00:00
Filip Hejmowski
4551672c80
fix(app): tolerate subpixel rounding in folder picker middle truncation (#65225) 2026-11-23 12:08:25 +01:00
Luke Parker
811cdb8c27
fix(core): save assistant messages on the SQLite that macOS 12 ships (#65771) 2026-11-23 11:05:19 +00:00
Filip Hejmowski
ad8858de43
fix(core): keep compaction's retained tail within keep.tokens (#65768) 2026-11-23 11:55:50 +01:00
Chirag Singhal
b8cbd0e43c
fix(client): honor event cancellation after source completion (#65441) 2026-11-23 11:54:44 +01:00
usrnk1
7cfd868443
fix(app): keep the timeline and Home list out of the Tab order (#65758) 2026-11-23 11:14:27 +01:00
usrnk1
d284e7ce17
fix(app): show the selected layout card's check in the accent blue (#65757) 2026-11-23 10:53:10 +01:00
github-actions[bot]
d6379ff0e1
release: v2.4.0 (#65753)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-23 09:36:16 +00:00
victor
26f4041911
feat(plugin): let plugins create, list and delete automations (#65747) 2026-11-23 10:24:49 +01:00
victor
7edab789f7
feat: offer a model's service tiers as a speed in the TUI and desktop (#65749) 2026-11-23 10:13:08 +01:00
opencode-agent[bot]
1906056539
data: treat hungerg as a stealth model (#65750)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Jack <jack@anoma.ly>
2026-11-23 16:41:42 +08:00
Luke Parker
609e4bb6ae
test(app): save a Go key before connecting OpenCode Go from Settings (#65743) 2026-11-23 08:14:11 +00:00
opencode-agent[bot]
331010a1ef
fix(app): hide OpenCode Go from Settings popular providers (#65740)
Co-authored-by: Hona <luke@anoma.ly>
2026-11-23 17:52:16 +10:00
Aiden Cline
571619bc15
feat(core): call the OpenCode API from Code Mode with opencode:// fetch in local builds (#65725) 2026-11-23 01:33:09 -06:00
Aiden Cline
d3abc6706c
fix(ai): flatten xAI compaction requests like every step (#65726) 2026-11-23 00:44:47 -06:00
Luke Parker
45aca07b15
fix(browser): open the browser in a project its server has only just started (#65720) 2026-11-22 23:54:01 -06:00
Aiden Cline
b575c1f30f
feat(core): add a Code Mode tool that interrupts a session and everything under it (#65718) 2026-11-23 05:52:01 +00:00
Aiden Cline
3b38f3aadd
fix(ai): flatten tool namespaces once, before provider adapters (#65621)
Co-authored-by: Miroshnikov Vladislav <55508043+vladislav-miroshnikov@users.noreply.github.com>
2026-11-23 05:49:37 +00:00
Aiden Cline
825986a31a
fix(core): name the shell in the shell tool's Code Mode description (#65712) 2026-11-22 23:42:28 -06:00
Aiden Cline
8c0be712aa
fix(core): delete blobs a week after they were written (#65671)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-22 23:25:56 -06:00
Brendan Allan
2720b4b20c
feat(app): support key chords in shortcuts (#64395) 2026-11-23 13:22:56 +08:00
Walter
70c7f452a5
fix: update Feishu community link (#65711) 2026-11-23 13:05:28 +08:00
Lev Smolsky
8bae58e7b9
feat(core): add Claude Agent as a web search provider (#65704)
Co-authored-by: Dan Smolsky <dannysmo@gmail.com>
2026-11-22 23:58:24 -05:00
Luke Parker
9b1cdf0167
fix(desktop): put the comment button back in the browser bar (#65707) 2026-11-22 22:48:34 -06:00
Luke Parker
b705c446f0
fix(app): show a file's whole diff when its accordion opens (#65703) 2026-11-22 22:19:20 -06:00
Aiden Cline
735f272bc6
fix(core): hold event watches like timers while automations are off (#65699) 2026-11-22 22:11:20 -06:00
Aiden Cline
406fd32698
docs: add the v2.3.1 and v2.3.2 changelog entries to dev (#65701) 2026-11-23 04:08:28 +00:00
Luke Parker
18be128acc
fix(app): remove the focus rings around the timeline and composer (#65690) 2026-11-22 21:46:36 -06:00
Luke Parker
d84e1d7bb3
fix(session-ui): open a group of long Code Mode scripts without freezing the timeline (#65696) 2026-11-22 21:44:34 -06:00
Luke Parker
6622d61309
fix(app): eliminate model picker layout thrash on open, scroll, and select (#65635) 2026-11-22 21:44:27 -06:00
Aiden Cline
f113ec3279
refactor(core): rename mcp/event-errors.ts to event-stream.ts (#65695) 2026-11-22 21:43:22 -06:00
Luke Parker
512d2f33a8
perf(ui): bake the activity spinner into a 90 fps APNG (#65693) 2026-11-23 03:39:19 +00:00
Aiden Cline
b3f233c64c
fix(app): open ~ file links in the server's home folder (#65689) 2026-11-22 21:25:32 -06:00
Luke Parker
c6df1612c3
chore(perf): bench with strobe 0.44.1 (#65691) 2026-11-22 21:24:54 -06:00
Aiden Cline
7b70422787
refactor(core): rename the media tools to generate_image and generate_video (#65682) 2026-11-22 21:14:23 -06:00
opencode-agent[bot]
13671da355
fix(core): pin websearch in the Code Mode catalog (#65687)
Co-authored-by: Aiden Cline <aiden@anoma.ly>
2026-11-23 03:08:47 +00:00
Aiden Cline
562e55a048
fix(core): skip an oversized MCP event instead of pausing its watch (#65673) 2026-11-22 20:36:24 -06:00
Aiden Cline
04a10583c8
feat(core): turn on video generation by default (#65664) 2026-11-23 02:20:51 +00:00
Luke Parker
bab0d0413f
fix(desktop): keep sites in the browser off the taskbar badge (#65646) 2026-11-22 18:57:21 -06:00
Luke Parker
361bed51ef
fix(session-ui): light the whole Compacted label on hover (#65644) 2026-11-22 18:45:56 -06:00
Luke Parker
f55e2575b1
perf(app): keep the background activity menu smooth with many subagents (#65634) 2026-11-22 18:24:00 -06:00
Luke Parker
23fd3da786
fix(session-ui): show Windows tool paths relative to the project (#65639) 2026-11-22 18:03:44 -06:00
Adam Hearn
030e8d75d3
fix(app): list drafts in the inbox sidebar (#65525)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-22 14:44:27 -08:00
Luke Parker
a946e848e6
fix(desktop): isolate local Windows AppUserModelID from installed channels (#65624) 2026-11-22 16:08:54 -06:00
Kit Langton
4332e24fad
perf(core): ramp chunk size when seeking large files in read (#65611)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-deploy (push) Blocked by required conditions
2026-11-22 12:54:37 -08:00
Kit Langton
cf2d028d82
refactor(core): read environment facts in file access, shell and search (#65613) 2026-11-22 12:42:51 -08:00
opencode-agent[bot]
95d52c4cf1
docs(console): drop free models from the deprecated models table (#65617) 2026-11-22 12:38:20 -08:00
Simon Klee
8ba44455a3
refactor(cli-rs): apply streamed deltas borrowed from their JSON (#65609) 2026-11-22 19:17:44 +00:00
Simon Klee
2ae15f2e36
refactor(cli-rs): own the store on the UI thread (#65608) 2026-11-22 19:16:54 +00:00
Simon Klee
44ef8cec2f
refactor(cli-rs): begin and complete store requests over plain data (#65607) 2026-11-22 20:15:59 +01:00
Aiden Cline
9aaa33013b
refactor(core): handle misplaced tool calls in one place, with notes first (#65494) 2026-11-22 12:42:30 -06:00
github-actions[bot]
d9dacaf525
chore: update nix node_modules hashes (#60957)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-22 18:03:08 +00:00
Aiden Cline
13b86ac4a6
fix(nix): update node_modules hashes (#65598) 2026-11-22 12:03:04 -06:00
Simon Klee
62d07aa01d
refactor(cli-rs): match tools and events by type, not by string (#65595) 2026-11-22 19:00:50 +01:00
opencode-agent[bot]
33d22fe235
docs(console): add Jev 1.14 to Zen models (#65597)
Co-authored-by: Daniel <daniel@anoma.ly>
2026-11-22 09:59:17 -08:00
Simon Klee
43d60f42b3
refactor(cli-rs): stop per-frame and per-keystroke rebuilds in the TUI (#65594) 2026-11-22 18:58:35 +01:00
Simon Klee
d5452df1f9
refactor(cli-rs): keep store state in typed per-session records (#65593) 2026-11-22 18:56:50 +01:00
Simon Klee
6d978e2ee5
test(cli-rs): add hot-path perf baselines and fix flaky tests (#65592) 2026-11-22 18:53:36 +01:00
Aiden Cline
43b1015f57
feat(core): read the ChatGPT plan model lists from models.dev (#65579) 2026-11-22 11:46:41 -06:00
Dax
f3aef0ba25
fix(data): open bar charts on the daily view (#65581)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-22 12:20:44 -05:00
Adam
8a836dd924
fix(core): tell the agent when watch updates stop waking it (#65562) 2026-11-22 11:03:22 -06:00
Adam
e1cffae53b
feat(data): open bar charts on daily (#65577) 2026-11-22 10:52:54 -06:00
Jack
10144b53c3
docs: end GLM 5.3 Go promo note (#65570) 2026-11-23 00:00:18 +08:00
opencode-agent[bot]
71cd8c064c
docs(go): add LongCat 2.5, deprecate LongCat 2.0 and LongCat 2.5 Free (#65196)
Co-authored-by: Jack <jack@anoma.ly>
2026-11-22 15:32:46 +00:00
Adam
1a215a4b20
feat(data): weekly view for bar charts (#65307) 2026-11-22 14:52:15 +00:00
Frank
ee5fe34e13
feat(data): add new models section and yesterday leaderboard (#65541)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
Co-authored-by: Frank Wang <frank@Franks-MacBook-Air.local>
2026-11-22 04:29:17 -05:00
Adam Hearn
5310e42203
fix(core): ask to reconnect ChatGPT when its refresh token is rejected (#65289)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-21 20:18:55 -08:00
Aiden Cline
1645a8aa5a
feat(mcp): follow the MCP Events beta for push delivery (#65271) 2026-11-21 21:48:02 -06:00
Aiden Cline
5756d59a68
fix(core): put small fields before large output in tool results (#65513) 2026-11-21 21:13:22 -06:00
Kit Langton
73a0eae88d
refactor(core): the command seam names its own types (#65508) 2026-11-21 17:45:04 -08:00
opencodejr[bot]
d02b62de5d
test(app): follow the OpenCode rename and Go-through-OpenCode connect flow in e2e (#65509)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-21 20:43:11 -05:00
Kit Langton
942af1fb8b
refactor(core): a seam for commands that outlive the server (#65449) 2026-11-21 17:31:53 -08:00
Dan Smolsky
342839461a
feat(app): start voice with the newest GPT-Live model the server lists (#65506) 2026-11-21 20:20:51 -05:00
Dan Smolsky
387140811c
feat(core): list voice models from models.dev (#65491) 2026-11-21 20:01:22 -05:00
Kit Langton
d03cb4a024
refactor(core): ask an environment what it can do (#65452) 2026-11-21 16:57:11 -08:00
Aiden Cline
4c7ef3e128
fix(codemode): show pinned tools' full descriptions in the catalog (#65493) 2026-11-21 17:58:23 -06:00
Luke Parker
066336864f
fix(session-ui): show the folder a search or listing ran in, not its parent (#65460) 2026-11-21 17:24:51 -06:00
Simon Klee
6b1df0cceb
feat(cli-rs): add the native CLI and TUI (#63477)
Add packages/cli-rs, an OpenCode client written in Rust on OpenTUI's Rust crates. It is a client only.
2026-11-22 00:07:01 +01:00
Aiden Cline
9a2f16d165
test(core): remove a duplicate Agent import (#65487) 2026-11-21 22:46:07 +00:00
Aiden Cline
291c51b704
fix(core): ask permission for shell commands the scanner can't analyze (#65269) 2026-11-21 16:32:05 -06:00
Dax Raad
6531f17b44 docs: add enterprise page with policy examples
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-21 16:56:39 -05:00
Frank
cd5752f7fa
docs(console): show 60% discount for GLM 5.3 and DeepSeek V4.1 Flash (#65470)
Co-authored-by: Frank Wang <frank@Franks-MacBook-Air.local>
2026-11-21 16:52:03 -05:00
Dax
8bf0903016
feat: connect OpenCode Go through the OpenCode connection (#65466) 2026-11-21 21:20:07 +00:00
Luke Parker
55b127bff4
fix(desktop): remember the first window as focused when it opens focused (#65458)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-21 14:25:18 -06:00
Kit Langton
4d4a95a323
refactor(core): machine path syntax lives in one module (#65446) 2026-11-21 11:25:46 -08:00
victor
93a1ed0d1c
docs(site): document the Go usage endpoint (#65455) 2026-11-21 19:25:06 +00:00
Kit Langton
e8b8ebda2c
refactor(core): one function for the working directory (#65445) 2026-11-21 11:20:24 -08:00
Luke Parker
375f654e6d
fix(desktop): close the oldest Windows toast when the cap evicts it (#65421) 2026-11-21 12:35:23 -06:00
Kit Langton
e31eb1ebc1
perf(core): faster byte conversion when sending to a machine over Iroh (#65432) 2026-11-21 09:54:17 -08:00
Kit Langton
5a4f3bc5ad
feat(core): processes on a machine take input and keep errors separate (#65427) 2026-11-21 09:52:51 -08:00
opencode-agent[bot]
889ab114b6
feat(app): archive the open session with ⌘⇧S (#65428)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Brendonovich <14191578+Brendonovich@users.noreply.github.com>
2026-11-22 01:03:08 +08:00
Aiden Cline
2ae1910140
fix(core): record top-level Code Mode tool calls as execute programs (#65193) 2026-11-21 10:23:36 -06:00
Luke Parker
0bc9ccf55d
feat(desktop): say what Windows toasts ask and take them back once handled (#65325) 2026-11-21 09:49:06 -06:00
Luke Parker
176db8d456
feat(desktop): drag files from the file tree into other Windows apps (#65330) 2026-11-21 09:48:55 -06:00
Luke Parker
b00b733f07
feat(desktop): add New Session and New Window to the Windows jump list (#65327) 2026-11-21 09:48:44 -06:00
Dan Smolsky
204af946ba
feat(app): fold tall file diffs in the timeline (#65329) 2026-11-21 10:44:20 -05:00
victor
a61f267044
docs(console): document embedding models (#65402) 2026-11-21 15:10:25 +01:00
Luke Parker
ba5bbef82c
fix(desktop): draw the Windows caption buttons in the contrast theme's text colour (#65324)
Some checks are pending
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-21 04:53:47 -06:00
Luke Parker
32ae019771
fix(desktop): resync server event streams after Windows resumes from sleep (#65321) 2026-11-21 04:40:29 -06:00
Luke Parker
3aff591323
fix(desktop): reopen snapped, moved and minimized windows where they were on Windows (#65323) 2026-11-21 04:28:43 -06:00
Luke Parker
b310a05b54
fix(desktop): open projects and new sessions from opencode:// links again (#65332) 2026-11-21 04:28:35 -06:00
Kit Langton
dcb24c74dc
fix(core): shell tool's structured result says why a command has no exit code (#65365) 2026-11-21 01:42:19 -08:00
Luke Parker
edacc8686a
feat(desktop): show a count badge for sessions that need you on the Windows taskbar (#65318) 2026-11-21 02:57:30 -06:00
Luke Parker
844a6aa6fe
feat(desktop): flash the Windows taskbar button for requests that wait on you (#65319) 2026-11-21 02:28:41 -06:00
Luke Parker
f05c0fdc06
feat(desktop): open in Windows Terminal and list only installed apps on Windows (#65320) 2026-11-21 02:27:14 -06:00
Kit Langton
44593c514e
feat(core): a paired machine needs no approval (#65356) 2026-11-21 00:17:23 -08:00
Kit Langton
5ca87b9dda
feat(core): machine.list tool in Code Mode (#65349) 2026-11-20 23:16:16 -08:00
Kit Langton
cfb1b4afbc
feat(cli): show how machines connect (#65347) 2026-11-20 22:55:46 -08:00
Kit Langton
f8d34e1116
fix(core): clearer errors for machine paths (#65346) 2026-11-20 22:50:15 -08:00
Kit Langton
cfbf3f7171
feat(core): accept machine links over iroh (#65341) 2026-11-20 22:01:25 -08:00
Kit Langton
b3b30005e4
fix(cli): machine commands accept --server (#65340) 2026-11-20 21:29:54 -08:00
Luke Parker
46f56ea2d0
fix(browser): copy sign-ins to a remote server's pages without stalling the app (#65339) 2026-11-20 23:25:38 -06:00
Luke Parker
7f513b15b7
feat(desktop): show session status on Windows taskbar progress bar (#65317) 2026-11-20 23:02:18 -06:00
Luke Parker
a4b7cc9a25
test(browser): wait for the menu's first row before End (#65336) 2026-11-20 22:44:21 -06:00
Luke Parker
68c0215b74
test(browser): wait for the menu to return focus before submitting the page note (#65333)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-20 22:13:51 -06:00
Luke Parker
0811b42484
fix(app): keep an open session's side tabs when old sessions are forgotten (#65328) 2026-11-20 21:52:12 -06:00
Luke Parker
1bd37e7903
fix(browser): keep every open tab in the strip (#65322) 2026-11-20 21:30:13 -06:00
Luke Parker
34411562e4
fix(browser): keep the pane's tabs unless the person or the agent closes them (#65313) 2026-11-20 21:12:25 -06:00
Aiden Cline
656c273638
fix: fix Windows MCP pool and review toggle CI failures (#65308) 2026-11-21 02:21:58 +00:00
Luke Parker
b83ea51365
fix(app): keep the background pill's rows in place (#65312) 2026-11-20 19:51:45 -06:00
Aiden Cline
09bfa6041d
feat(core): enable session full-text search in dev builds (#65300) 2026-11-21 01:28:27 +00:00
Aiden Cline
cb82da7cde
feat(core): replace the automations flag with an automations config key (#65296) 2026-11-21 01:19:36 +00:00
Kit Langton
b5424afe62
fix(core): machine review fixes (#65295) 2026-11-20 17:18:16 -08:00
opencode-agent[bot]
80f41d7852
fix(app): keep foreground Code Mode scripts out of the background pill (#65303)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Dan Smolsky <78942835+Tarquinen@users.noreply.github.com>
2026-11-21 01:17:55 +00:00
Aiden Cline
6ab27d6e4b
fix: restore dev CI (#65302) 2026-11-21 01:13:21 +00:00
Aiden Cline
db2d889c0e
feat(core): auto-update @latest, range and Git branch plugins (#65052) 2026-11-20 19:03:56 -06:00
Aiden Cline
58f0af713d
fix(ai): replay undeclared tool call names in provider-safe form (#65292) 2026-11-21 00:25:39 +00:00
Aiden Cline
613ee72fa2
test: fix Windows automation and Electron unit failures (#65286) 2026-11-20 18:18:28 -06:00
Aiden Cline
bda12b51d7
feat(mcp): negotiate the newest protocol by default (#65282) 2026-11-20 18:03:13 -06:00
Aiden Cline
ab0e644838
fix(core): watch PRs and pushes again after the shell exitCode rename (#65283) 2026-11-20 17:59:12 -06:00
Aiden Cline
ddb3817e3c
fix(core): prefer standard model offerings by default (#65280) 2026-11-20 23:39:58 +00:00
opencode-agent[bot]
f670a075f1
feat(cli): add hidden login shortcut for auth login (#65263)
Co-authored-by: Aiden Cline <aiden@anoma.ly>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
2026-11-20 17:33:30 -06:00
Kit Langton
32330f55b5
feat(cli): add, list and remove machines (#65268) 2026-11-20 15:13:28 -08:00
Luke Parker
b9a60d9d07
fix(app): keep tab groups stable when closing a tab (#65165) 2026-11-20 16:22:54 -06:00
opencodejr[bot]
494e8b6154
fix(ui): keep focus on a focused tabindex=-1 panel when the page changes around it (#65274)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-20 22:07:18 +00:00
James Long
a5fc5fd93d
feat(codemode): add timeout and background to execute behind full_codemode (#65266) 2026-11-20 16:26:11 -05:00
James Long
f691e443db
fix(session-ui): space a script's diff cards in the old timeline (#65270) 2026-11-20 16:25:55 -05:00
Aiden Cline
1f926188ac
feat(automation): give scheduled code the session's Code Mode tools (#65236) 2026-11-20 21:01:09 +00:00
James Long
e86058a790
feat(codemode): show a script's diffs while it runs (#65247) 2026-11-20 15:59:27 -05:00
Kit Langton
6f9d6cf575
feat(server): endpoint for a machine's link (#65259) 2026-11-20 12:55:45 -08:00
opencode-agent[bot]
ac548ed8b4
feat(tui): add /login and /auth as aliases for /connect (#65265)
Co-authored-by: Aiden Cline <aiden@anoma.ly>
2026-11-20 14:48:32 -06:00
usrnk1
3bc82a19b3
feat(app): send browser, file and review comments to the session with Mod+Enter (#65264) 2026-11-20 20:42:43 +00:00
James Long
8a1501ca5e
feat(codemode): show file diffs from a script below the execute block (#65002) 2026-11-20 15:32:56 -05:00
opencode-agent[bot]
504a7b3054
fix(cli): show help when the directory argument doesn't exist (#65262)
Some checks failed
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Process daemon / Miri (callback ownership) (push) Has been cancelled
Process daemon / Core (blacksmith-6vcpu-macos-15) (push) Has been cancelled
Process daemon / Core (ubuntu-22.04) (push) Has been cancelled
Process daemon / Windows (arm64) (push) Has been cancelled
Process daemon / Windows (x64) (push) Has been cancelled
Co-authored-by: Aiden Cline <aiden@anoma.ly>
2026-11-20 20:14:52 +00:00
Aiden Cline
4122af0206
fix(core): authorize Bun Glob scans as reads (#65255) 2026-11-20 19:11:30 +00:00
usrnk1
f502a6e6cc
fix(app): fix clipped and misleading focus rings in the timeline and settings (#65215) 2026-11-20 18:54:52 +00:00
James Long
fe8def6854
refactor(session-ui): place timeline entries from facts (#65025) 2026-11-20 12:52:39 -05:00
Aiden Cline
0f0d168877
refactor(automation): trim shell action checks and the unattended denylist (#65217) 2026-11-20 11:46:06 -06:00
James Long
07c2502525
refactor(session-ui): derive timeline summaries from facts (#65012) 2026-11-20 12:42:50 -05:00
Dax
4cca18d804
feat(core): load a per-project overlay config directory behind project_overlay (#65204) 2026-11-20 12:03:06 -05:00
Kit Langton
d9eb208a22
feat(core): messages over the machine link (#65099) 2026-11-20 08:48:28 -08:00
Aiden Cline
4390284d4d
fix(core): put built-ins in Code Mode for every model under full_codemode (#65208) 2026-11-20 16:36:31 +00:00
Guy Hartstein
810afd296f
docs(ecosystem): point Tavily plugin entry at @tavily/opencode-plugin (#62960) 2026-11-20 10:30:20 -06:00
usrnk1
7f90d8d201
fix(app): keep the side panel's add button and review toggle in tab order (#65213) 2026-11-20 16:15:42 +00:00
usrnk1
c1a6e6f0ea
fix(ui): keep the composer ring hidden when a click on Steer or Remove moves focus to it (#65211) 2026-11-20 16:09:12 +00:00
Filip Hejmowski
1607d4e624
feat(app): split Open and Open in background in the Home session menu (#65212) 2026-11-20 17:03:24 +01:00
James Long
cc74b9ab03
chore(codemode): use psychoscript 0.2.1 through psychoscript/effect (#65207) 2026-11-20 11:02:27 -05:00
Filip Hejmowski
ef68b7ef67
feat(app): open a Home session in the background from its menu (#65209) 2026-11-20 16:53:20 +01:00
Dax
55c6827566
fix(core): skip home memory maintenance on first run and archive its session (#65199) 2026-11-20 15:16:46 +00:00
usrnk1
7afef17923
fix(app): draw the whole timeline focus ring with rounded corners (#65192) 2026-11-20 15:11:00 +00:00
usrnk1
6b661050cb
fix(app): show the new session's target worktree in the header while it starts (#65190) 2026-11-20 16:08:08 +01:00
Aiden Cline
e47d8feb50
test(gui-plugins): wait for Electron extension readiness (#65191) 2026-11-20 08:50:32 -06:00
Filip Hejmowski
bf006b5e4f
fix(app): keep the model picker responsive with large catalogs (#65189) 2026-11-20 15:46:12 +01:00
Aiden Cline
b7f0b90dc0
feat(automation): run a fixed shell command as an automation action (#65186) 2026-11-20 08:44:40 -06:00
Aiden Cline
8e1c6a43a2
feat(core): session_search and session_read tools behind sqlite_fts (#65076) 2026-11-20 14:28:21 +00:00
Aiden Cline
2002222d13
feat(automation): give automation tools their own namespace (#65001) 2026-11-20 08:05:33 -06:00
usrnk1
b958fc84d7
fix(app): keep the pinned group name field inside its menu without a focus ring (#65176) 2026-11-20 13:46:58 +00:00
usrnk1
e440d29274
fix(app): stop buttons from flashing dark on keyboard focus (#65177) 2026-11-20 13:46:38 +00:00
usrnk1
22ecda23a9
fix(browser): show browser profiles inline and tidy settings copy (#65174) 2026-11-20 14:44:55 +01:00
Aarav Sareen
85951cb086
fix(session-ui): show subagent status as a colored bar and word in the New timeline (#65164) 2026-11-20 18:07:55 +05:30
Luke Parker
80d7c17d8e
feat(browser): open a link's new tab beside the tab it came from (#65126) 2026-11-20 06:33:59 -06:00
Luke Parker
bfee96a859
fix(browser): confirm before clearing browsing data (#65124) 2026-11-20 06:03:42 -06:00
Filip Hejmowski
8b36735d51
fix(install): stream curl download via stdout for confined curl (#65132) 2026-11-20 11:36:34 +01:00
Filip Hejmowski
13efefcfd3
fix(app): go back and forward with the mouse buttons on desktop (#65129) 2026-11-20 11:01:56 +01:00
Filip Hejmowski
f0df6070f9
fix(app): recover child session permissions after reconnect (#65120) 2026-11-20 10:55:47 +01:00
usrnk1
10e26d9d6c
fix(ui): show text field and line comment focus in high contrast mode (#65100) 2026-11-20 09:48:19 +00:00
Filip Hejmowski
f00f28ded2
fix(core): preserve legacy variant in markdown commands (#65118) 2026-11-20 10:48:03 +01:00
Filip Hejmowski
7aed488e41
fix(core): preserve yaml flow collections during frontmatter repair (#65119) 2026-11-20 10:38:50 +01:00
Filip Hejmowski
f8738a13bb
fix(process-daemon): keep listing terminals while one is terminated (#65123) 2026-11-20 10:37:32 +01:00
Filip Hejmowski
c18c9236f7
fix(core): skip selecting the agent a session already runs as (#65122) 2026-11-20 09:31:29 +00:00
Luke Parker
c5ba0ee03a
test(app): wait for focus rescue before selecting text in the quote action test (#65121) 2026-11-20 03:26:41 -06:00
Filip Hejmowski
20f6dda107
fix(util): include file tail in sampledChecksum (#65114) 2026-11-20 10:20:23 +01:00
opencode-agent[bot]
92d35f8e18
fix(session-ui): keep execute details padding visible when code and output are long (#65115)
Some checks are pending
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Filip <filip@anoma.ly>
2026-11-20 09:11:08 +00:00
Luke Parker
5fe4c38b96
fix(browser): open a middle-clicked link in a new tab (#65091) 2026-11-20 03:04:00 -06:00
Luke Parker
12c4cfa3e1
fix(browser): shorten the browser settings texts (#65101) 2026-11-20 02:24:01 -06:00
Luke Parker
2c4352b415
fix(browser): log why a page's process ended (#65096) 2026-11-20 02:17:01 -06:00
Luke Parker
701eff9e26
test(browser): measure verifier handle growth after the process settles (#65098) 2026-11-20 02:09:03 -06:00
Luke Parker
98b11bc92d
fix(browser): show each site's icon in its tab (#65094) 2026-11-20 02:08:01 -06:00
Luke Parker
d6b7756d17
fix(browser): say sign-ins, not cookies, in the import and data texts (#65095) 2026-11-20 01:51:28 -06:00
opencode-agent[bot]
a96327d3e8
feat(app): support building the web app under a base path (#64597)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-20 15:36:16 +08:00
Kit Langton
352c3df480
feat(core): machine link handshake (#65087) 2026-11-19 23:35:52 -08:00
Luke Parker
bf683129fa
feat(browser): import browsing history and complete the address bar from it (#65073) 2026-11-20 01:24:18 -06:00
Luke Parker
92aa3b32e6
fix(app): keep the browser page shown while a panel is resized on Windows (#65083) 2026-11-20 01:21:58 -06:00
usrnk1
57f5670971
fix(ui): don't show the composer focus ring when returning to the window (#65082) 2026-11-20 07:18:44 +00:00
usrnk1
8b30f8c7b6
fix(app): show a focus ring on the titlebar Update button (#65084) 2026-11-20 08:17:15 +01:00
usrnk1
906e370146
fix(session-ui): show the current day in the message menu timestamp (#65081) 2026-11-20 07:09:03 +00:00
Aiden Cline
8c08e834c8
fix(core): keep same-day siblings and every search match in the models tool (#65071) 2026-11-20 01:03:45 -06:00
Aiden Cline
8e50929d0d
refactor(core)!: call the session tools opencode.session.rename and .move in Code Mode (#65080) 2026-11-20 07:01:46 +00:00
Luke Parker
bf93d0e752
fix(session-ui): open Code Mode rows while a browser tab's address keeps its selection (#65078) 2026-11-20 00:55:49 -06:00
Luke Parker
2701a89260
fix(browser): show saved tabs at once when the app reopens, and hold them while they load (#65067) 2026-11-20 00:54:08 -06:00
Kit Langton
08c4798423
feat(core): Noise handshake for the machine link (#65074) 2026-11-19 22:41:19 -08:00
Aiden Cline
b5e0abd730
fix(app): stop showing instruction updates as the system prompt in the Context tab (#64991) 2026-11-20 00:21:14 -06:00
Aiden Cline
b8fe9ac67f
feat(core): opt-in sqlite full-text index of session history (#62769) 2026-11-20 00:13:37 -06:00
Kit Langton
6e924965c6
feat(core): machine keys and one-use join strings (#65031) 2026-11-19 21:41:12 -08:00
Aiden Cline
e51247f626
fix(core): send background results in one <background-result> block (#64971) 2026-11-20 05:18:15 +00:00
Dan Smolsky
6baeebfec0
fix(core): raise the Claude Agent startup wait to 60 seconds (#65064) 2026-11-20 05:05:30 +00:00
James Long
eb2dfb2638
refactor(codemode): use the psychoscript package for the language (#65011) 2026-11-19 23:10:54 -05:00
WTLAIB
aaa9bff2a3
fix(core): stop Claude Agent processes when their session is deleted (#62649)
Co-authored-by: WTLAIB <205451322+WTLAIB@users.noreply.github.com>
Co-authored-by: Dan Smolsky <dannysmo@gmail.com>
Co-authored-by: Dan Smolsky <78942835+Tarquinen@users.noreply.github.com>
2026-11-20 04:04:03 +00:00
Aiden Cline
2c9060237f
fix(core): check plugins for updates every 24 hours, not every 48 (#65056) 2026-11-19 22:02:44 -06:00
opencode-agent[bot]
d643c87587
refactor(app): upload attachments through the generated client (#64779)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-20 11:51:28 +08:00
Dan Smolsky
7566048d83
chore(protocol): regenerate the OpenAPI document (#65055) 2026-11-19 22:43:43 -05:00
Aiden Cline
c98608c513
fix(core): use <system-update> for instruction updates in every prompt (#65034) 2026-11-20 02:57:26 +00:00
Dax Raad
16bbbe635c feat(core): add flagged home folder memory workspace 2026-11-19 21:56:29 -05:00
Dan Smolsky
3f51686f20
feat(core): add Claude Agent usage control (#65035) 2026-11-20 02:49:02 +00:00
Dan Smolsky
789f310a4a
feat(core): add a configDir setting to the Claude Agent provider (#62514) 2026-11-19 21:35:06 -05:00
Luke Parker
cd0d037d68
feat(desktop): signed-in browser pane with extensions, previews, prompts and agent safeguards (#63002) 2026-11-19 20:18:12 -06:00
Dan Smolsky
4288e1dd69
refactor(core): drop the extra-usage hint from Claude Agent billing errors (#65033) 2026-11-19 21:06:42 -05:00
Dan Smolsky
908ea3f0e0
fix(core): keep every listed Claude model ID working when Claude Code renames a model (#65032) 2026-11-19 21:06:11 -05:00
Aiden Cline
ec5461ed17
feat(core): use models.dev's recommended API behind a flag (#65003) 2026-11-19 19:55:32 -06:00
opencode-agent[bot]
c0aeddbef0
feat(core): write assistant parts as session_part rows by default (#65039)
Co-authored-by: rekram1-node <63023139+rekram1-node@users.noreply.github.com>
2026-11-20 01:54:06 +00:00
Aiden Cline
5db6221502
fix(ai): accept Office documents on Google Interactions (#65037) 2026-11-20 01:48:52 +00:00
Aiden Cline
9d754e3e13
fix(core): build Gemma 4 thinking variants on Interactions (#65038) 2026-11-20 01:46:51 +00:00
Aiden Cline
7b6b2858d9
fix(ai): pass safety settings on Google Interactions (#65036) 2026-11-19 19:38:44 -06:00
Kit Langton
5d429b952d
feat(core): a machine path can start at the machine's home (#65026)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-19 16:32:48 -08:00
Kit Langton
88ebea163a
fix(core): recover a machine filename with POSIX rules on a Windows server (#65022) 2026-11-19 16:15:02 -08:00
Kit Langton
f898eaeaa1
feat(core): tell the model which machines it can reach (#65019) 2026-11-19 15:57:58 -08:00
Kit Langton
0071deec8c
feat(core): machine names in paths (#65013) 2026-11-19 15:46:37 -08:00
Dan Smolsky
b0159407f0
fix(core): label Claude Agent entry point (#65016)
Co-authored-by: Salloxy <197323176+Salloxy@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:45:23 +00:00
Aiden Cline
d20509de54
fix(ai): continue Google Interactions responses split across requests (#65006) 2026-11-19 23:26:19 +00:00
Aiden Cline
11883188a6
fix: address dev browser, unit and docs CI failures (#65000) 2026-11-19 17:11:14 -06:00
Aiden Cline
1626bbc54e
fix(codemode): give errors a stack (#64939) 2026-11-19 17:07:12 -06:00
Kit Langton
bf00f52937
feat(core): machine list (#64997) 2026-11-19 15:05:23 -08:00
Kit Langton
6e6cd0cf5f
feat(core): machine driver (#64943) 2026-11-19 14:33:50 -08:00
James Long
4f98dcbcbf
feat(tui): turn new designs on by default and make the new theme opencode (#64988) 2026-11-19 22:03:28 +00:00
Aiden Cline
a21895aee6
fix(codemode): honor locale and options in Date toLocale methods (#64938) 2026-11-19 15:27:12 -06:00
Aiden Cline
277c9a4439
fix(codemode): honor localeCompare locales and collator options (#64935) 2026-11-19 15:26:58 -06:00
Aiden Cline
7c2fd929fa
fix(codemode): honor base64 alphabet, omitPadding, and lastChunkHandling options (#64931) 2026-11-19 15:26:45 -06:00
Aiden Cline
6fbc0af624
fix(codemode): make Buffer map, filter, slice and subarray return a Buffer (#64933) 2026-11-19 15:26:31 -06:00
Aiden Cline
53212a6125
feat(core): revoke ChatGPT sign-in on logout (#64947) 2026-11-19 21:19:50 +00:00
James Long
199722963c
fix(tui): keep list dialog footers at the bottom and drop the empty footer gap (#64983) 2026-11-19 21:09:26 +00:00
usrnk1
19ee066471
fix(app): show the composer focus ring only when focus arrives by keyboard (#64976) 2026-11-19 21:00:29 +00:00
Kit Langton
36bd410cad
test(core): advance the clock until the video wait finishes (#64980) 2026-11-19 12:49:48 -08:00
James Long
5051718713
feat(tui): open the first busy tab when the picker opens with down (#64972) 2026-11-19 15:43:44 -05:00
Kit Langton
1c90a3ea9e
refactor(core): identify a file by its environment and path (#64928) 2026-11-19 12:43:40 -08:00
usrnk1
1e731f7b19
fix(app): keep the status line clear of the activity pill (#64973) 2026-11-19 20:36:02 +00:00
Kit Langton
2e7eabc592
fix(core): format only files on the server's own machine (#64925) 2026-11-19 12:33:48 -08:00
James Long
b9a2dc32cb
feat(tui): add a Scripts tab to the composer picker (#64956) 2026-11-19 15:24:43 -05:00
Kit Langton
a48ff45c50
refactor(core): environments have an id (#64923) 2026-11-19 12:19:53 -08:00
Filip Hejmowski
b4d81f04ad
fix(core): refuse to rewrite files that are not valid UTF-8 (#64868) 2026-11-19 20:51:28 +01:00
James Long
dfc06f7764
fix(app): keep job events that arrive while the job list loads (#64966) 2026-11-19 14:46:23 -05:00
Sebastian
9fd74ebdb7
fix(cli): keep service password out of the CLI log (#64911) 2026-11-19 20:31:56 +01:00
usrnk1
b9d82b7eb1
docs: add focus-states skill for keyboard focus rings and focus movement (#64963) 2026-11-19 19:31:05 +00:00
James Long
ca729da9a5
fix(codemode): pass the in-scope test262 class tests (#64965) 2026-11-19 19:21:12 +00:00
James Long
668a4f4487
fix(tui): use buttons and single-row gaps in prompt and export dialogs (#64944) 2026-11-19 14:14:24 -05:00
James Long
5d4f55d298
fix(tui): lighten opencode2's light-mode grays (#64962) 2026-11-19 19:13:46 +00:00
opencodejr[bot]
312d119469
fix(app): mock the background job list in the e2e mock server (#64959)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-19 20:06:32 +01:00
Filip Hejmowski
83f90214f2
feat(app): add setting to keep the side panel across sessions (#64950) 2026-11-19 20:05:50 +01:00
James Long
a41a53505b
feat(core): let Code Mode scripts block for 2 minutes before moving to the background (#64957) 2026-11-19 14:05:04 -05:00
usrnk1
d99e203f97
fix(ui): unify focus ring and add missing focus states (#64909) 2026-11-19 18:57:37 +00:00
Aiden Cline
10e5856f05
fix(codemode): define Uint8Array BYTES_PER_ELEMENT (#64930) 2026-11-19 12:45:52 -06:00
James Long
847de275f8
fix(app): drop the background work subtitle from subagent rows (#64951) 2026-11-19 18:38:00 +00:00
Aiden Cline
a0ef1e99b9
feat(app): ask the workspace admin when the ChatGPT Business limit is reached (#64926) 2026-11-19 12:25:17 -06:00
opencode-agent[bot]
b104f97744
docs: deprecate Inkling 2 Small Free (#64940) 2026-11-19 10:21:48 -08:00
James Long
da3689ee40
fix(tui): draw the delete-confirm row's selection bar in red (#64936) 2026-11-19 18:14:20 +00:00
James Long
edf960b4a6
fix(tui): let overflowing dialog lists cut off instead of showing an ellipsis row (#64934) 2026-11-19 18:13:38 +00:00
James Long
99952796f1
fix(core): include a running tool's progress metadata when reading messages (#64929) 2026-11-19 18:13:29 +00:00
Aarav Sareen
de81b817b1
fix(app): polish free model picker and connect dialog (#64927) 2026-11-19 23:37:22 +05:30
James Long
1a01c3bbe0
test(codemode): deterministic suspend points in the accessor tests (#64919) 2026-11-19 18:06:26 +00:00
Kit Langton
011f9043e8
refactor(core): shell commands run in the environment of their working directory (#64815) 2026-11-19 09:28:22 -08:00
James Long
bf06224462
fix(session-ui): keep each run's reply out of the activity group (#64917) 2026-11-19 12:23:12 -05:00
Kit Langton
eb452cd278
refactor(core): search runs in the environment of the path it resolved (#64814) 2026-11-19 09:19:15 -08:00
James Long
d3f6559d93
feat(codemode): getters and setters (#64908) 2026-11-19 17:12:53 +00:00
Caleb Norton
5ef7657335
chore: update nixpkgs (#64700) 2026-11-19 11:09:29 -06:00
James Long
f15ed39165
feat(app): show Code Mode scripts and subagents' background work as running work (#64790) 2026-11-19 12:07:01 -05:00
Luca Barbato
bca1def93b
fix(ai): classify OpenAI cyber_policy refusals as content policy (#64844) 2026-11-19 17:06:21 +00:00
Kit Langton
df313c5209
refactor(core): image and video tools use the environment of the path they resolved (#64813) 2026-11-19 08:58:37 -08:00
Filip Hejmowski
773b9d0ec2
fix(process-daemon): spawn Windows pipe processes suspended before joining their job (#64901)
Some checks failed
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Process daemon / Miri (callback ownership) (push) Has been cancelled
Process daemon / Core (blacksmith-6vcpu-macos-15) (push) Has been cancelled
Process daemon / Core (ubuntu-22.04) (push) Has been cancelled
Process daemon / Windows (arm64) (push) Has been cancelled
Process daemon / Windows (x64) (push) Has been cancelled
2026-11-19 17:53:54 +01:00
opencodejr[bot]
40a01f1f63
test(app): expect the large connect dialog size in the providers e2e (#64912)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-19 11:50:48 -05:00
Aarav Sareen
193ced8f5c
feat(app): show the provider connect hint on Home (#64885) 2026-11-19 21:59:58 +05:30
Filip Hejmowski
a8dbca1065
fix(ai): classify Gemini terms-of-use refusals as content policy (#64910) 2026-11-19 16:24:13 +00:00
James Long
fb40f64d0c
fix(core): hide glob, grep, and webfetch for every model under full_codemode (#64906) 2026-11-19 11:20:07 -05:00
Adam
e090ace288
feat(core): let a console watch keep waking an unattended session (#64895) 2026-11-19 10:19:50 -06:00
Adam
d9463aaa14
fix(data): keep custom models out of free-tier stats (#64894) 2026-11-19 10:19:45 -06:00
Filip Hejmowski
c740f6dcb2
fix(core): keep shell commands working after their output directory is removed (#64889) 2026-11-19 15:40:06 +01:00
Filip Hejmowski
0a297bf15d
fix(core): respect repository line endings and symlinks in git diffs (#64884) 2026-11-19 15:08:21 +01:00
Filip Hejmowski
b8928b9360
test: fix Windows timeouts in server and sdk contract tests (#64879) 2026-11-19 15:07:16 +01:00
Aarav Sareen
40f7e4da2b
fix(app): match integrations dialog to palette width (#64882) 2026-11-19 13:49:32 +00:00
Filip Hejmowski
354afc493e
test(core): fix Windows unit flakes in video, shell, and session-tabs tests (#64875) 2026-11-19 14:47:27 +01:00
Filip Hejmowski
e3ee082167
test(tui): fix shell output, session link and terminal pane flakes (#64876) 2026-11-19 14:47:14 +01:00
Filip Hejmowski
299193f88d
test(app): measure the subagent indicator's exit in the task that starts it (#64874) 2026-11-19 14:46:26 +01:00
Filip Hejmowski
09cc0c7a59
fix(desktop): open PowerShell 7 from Open in PowerShell on Windows (#64873) 2026-11-19 14:43:51 +01:00
Simon Klee
4c5298bce4
Opentui 0.9.0 (#63989) 2026-11-19 14:41:06 +01:00
Filip Hejmowski
88c90d08ad
feat(app): add previous and next match buttons to conversation search (#64865) 2026-11-19 13:38:35 +01:00
Walter
d33b578333
fix(ai): default MiniMax text video ratio (#64822)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-19 16:11:39 +08:00
opencode-agent[bot]
a86ac3f1b9
docs: deprecate GLM 5, GLM 5.1 and GLM 5.2 (#64818)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
2026-11-18 23:43:13 -08:00
Kit Langton
3508a0e31a
refactor(core): Code Mode files use the environment of the path they resolved (#64807) 2026-11-18 22:24:48 -08:00
Kit Langton
a105f58280
refactor(core): read tool calls its filesystem functions directly (#64795) 2026-11-18 22:03:43 -08:00
Aiden Cline
c4df872944
feat(core): auto-update plugins written as name@latest (#64764) 2026-11-18 23:14:12 -06:00
Kit Langton
47fcf735fa
refactor(core): file tools use the environment of the path they resolved (#64774) 2026-11-18 20:27:13 -08:00
James Long
56dc95bff5
fix(core): keep todo opt-in only (#64775) 2026-11-19 02:52:39 +00:00
Adam
88ca792e02
fix(core): wake a held watching session again after 30 quiet minutes (#64760)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-18 18:31:08 -06:00
opencode-agent[bot]
9bf497d3e8
docs(console): add Tidepool Alpha Free (#64767)
Co-authored-by: Daniel <daniel@anoma.ly>
2026-11-18 23:06:29 +00:00
Aiden Cline
49cbcd8c0c
feat(core): add an experimental video generation tool (#63666) 2026-11-18 22:23:47 +00:00
opencode-agent[bot]
643856d865
docs(console): add Gemini 4 Neon to Zen models (#64763)
Co-authored-by: Daniel <daniel@anoma.ly>
2026-11-18 14:22:58 -08:00
Adam
70fe3b6d0d
feat(core): read a member's own MCP server events as theirs (#63563) 2026-11-18 16:20:11 -06:00
James Long
77b322ceae
feat(core): enable full_codemode by default in dev builds (#64761) 2026-11-18 22:00:51 +00:00
James Long
007afb1b0c
feat(core): choose tools and Code Mode placement from the session's model (#64515) 2026-11-18 19:57:39 +00:00
James Long
6fcf38838b
fix(ui): show finished background Code Mode scripts like background shells (#64741) 2026-11-18 19:49:23 +00:00
Kit Langton
3aaac77313
fix(core): reload config only when a config input changes (#62158) 2026-11-18 18:56:14 +00:00
usrnk1
3dc66ab6e5
chore(app): drop translations left unused by the removed Projects sidebar (#64728) 2026-11-18 18:20:32 +00:00
usrnk1
789f80b45d
feat(app): retire the Projects sidebar mode in favor of Consolidated or Customize (#64727) 2026-11-18 18:17:55 +00:00
Aiden Cline
ef9aab240d
fix(core): keep Astra models at 272k context with ChatGPT sign-in (#64725) 2026-11-18 18:16:21 +00:00
Aiden Cline
73215c55eb
fix(ai): apply HTTP timeouts to all requests (#64692) 2026-11-18 11:55:56 -06:00
Aiden Cline
102efff30e
chore(core): update the bundled models.dev catalog (#64707) 2026-11-18 11:51:03 -06:00
JasonH
ae88eb6a7a
fix(cli): reject FIFO attachments without blocking (#64696) 2026-11-18 18:33:35 +01:00
Aiden Cline
a40c6d7f68
fix(ai): keep WebSocket continuation after a custom tool call (#64706)
Some checks failed
deploy-files / files-build (push) Has been cancelled
deploy-site / site-build (push) Has been cancelled
deploy-update / update-build (push) Has been cancelled
deploy / legacy-build (push) Has been cancelled
deploy / data-build (push) Has been cancelled
deploy-files / files-deploy (push) Has been cancelled
deploy-site / site-deploy (push) Has been cancelled
deploy-update / update-deploy (push) Has been cancelled
deploy / legacy-deploy (push) Has been cancelled
deploy / data-deploy (push) Has been cancelled
2026-11-18 11:22:55 -06:00
David Hill
9f65852eb3
fix(data): keep og card stats clear of X title overlay (#64711) 2026-11-18 11:22:10 -06:00
Filip Hejmowski
0b87612685
fix(desktop): disable the updater when app-update.yml is missing (#64681) 2026-11-18 17:48:29 +01:00
Aiden Cline
910c423e48
fix(core): read COPILOT_GITHUB_TOKEN for GitHub Copilot instead of GITHUB_TOKEN (#64697) 2026-11-18 10:36:57 -06:00
Filip Hejmowski
fc30827099
fix(core): skip the WAL checkpoint on database open (#64532) 2026-11-18 17:32:05 +01:00
Aiden Cline
af64830a47
fix(core): make the todo flag opt-in only (#64691) 2026-11-18 16:27:51 +00:00
Aiden Cline
ce7b4252d8
fix(server): stop waiting for plugins in the model, provider, generate, voice and websearch handlers (#63814)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-18 10:24:40 -06:00
victor
a61f5ea834
docs(console): document the model list endpoints (#64654) 2026-11-18 15:35:29 +01:00
Aarav Sareen
723e0a9105
feat(app): consolidated navigation experiment (#64668) 2026-11-18 19:42:30 +05:30
Aarav Sareen
bb01d3eecc
fix(app): keep Home's date headers visible while scrolling (#64665) 2026-11-18 19:26:22 +05:30
usrnk1
0220248dc1
fix(session-ui): keep the latest response copy visible at rest (#64640) 2026-11-18 14:07:47 +01:00
knp-sap
79bd2c6f11
fix(core): match file permission rules without case on macOS (#64626)
Co-authored-by: neriousy <hejmowskifilip@gmail.com>
2026-11-18 12:05:36 +01:00
Aarav Sareen
d412042beb
feat(app): redesign the goal pill (#60001)
The goal plugin's pill gets its own glyphs: a ripple for an active goal, a faded dot when paused and a check once reached. They are three SVG files the plugin declares and names through ctx.icons, so the host colors them by tone, keeps the ripple running while the pill renders again and holds it under reduced motion. The labels now read Following goal, Goal paused and Goal reached.

The popover leads with the objective. Once the goal has a reason, a divider and the colored status follow with the reason under it. Pause or Resume sit beside a red Clear, and a reached goal offers only Dismiss.

A pill's own popover (menu) no longer gets a host heading. The host keeps the popover's frame, and everything inside belongs to the plugin; the view's title names the popover for assistive technology.

A pill that starts with an icon now sits it 8px from the edge with a 6px gap to its label, through one rule on the shared pill. The activity menu's rows follow the capsule's new inset and gap.

Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com>
2026-11-18 04:11:22 -06:00
Luke Parker
22377659a8
feat(plugin): let GUI plugins declare their own icons (#64577)
A plugin declares SVG artwork in Plugin.define({ icons }) and names it with ctx.icons.<name> in every SDK icon field and ctx.ui.Icon. The host registers the artwork in the app's icon component before setup, so any part of the app draws it by name, in the size and color of its place, and withdraws it with the plugin.

Artwork may move with SVG animation elements. It stays in place while its host renders again, and the host holds it on its first frame under reduced motion.

Pairing and goal now ship the artwork only they show, which leaves the app's icon catalog.
2026-11-18 03:27:56 -06:00
opencode-agent[bot]
521ceac004
docs(go): note GLM-5.3 limited-time limits (#64611)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-files / files-build (push) Waiting to run
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
Co-authored-by: Jack <jack@anoma.ly>
Co-authored-by: Jack <jiangyoubob@gmail.com>
2026-11-18 15:57:51 +08:00
opencode-agent[bot]
1862f2ce5c
docs: deprecate GLM-5.3-Flash Free (#64600)
Co-authored-by: Jack <jack@anoma.ly>
2026-11-18 07:08:45 +00:00
Aiden Cline
a0fdbf9b91
refactor(core): replace watch_mcp_event with list_mcp_events (#64586) 2026-11-17 23:24:50 -06:00
Aiden Cline
7667ec4020
feat(core): tell models about Bun's file APIs in Code Mode with full_codemode (#64589) 2026-11-18 04:48:33 +00:00
Aiden Cline
db8730ebcd
fix(codemode): say why an import can't be resolved (#64587) 2026-11-17 22:45:39 -06:00
Luke Parker
a5533f7bdf
fix(ui): remove the fringe on project icon corners (#64582) 2026-11-17 22:22:12 -06:00
opencode-agent[bot]
aab2f85c86
fix(app): don't show the Hex tip on touch devices (#64583)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-18 12:18:35 +08:00
Adam
54b4698a72
feat(core): read Console artifacts (#64555) 2026-11-17 21:38:36 -06:00
Luke Parker
852d5ed0b3
fix(app): keep code block borders under the action fill (#64576) 2026-11-18 03:28:37 +00:00
Brendan Allan
cf9d13072c
feat(app): dispatch command shortcuts through @opentui/keymap (#64394) 2026-11-18 11:12:50 +08:00
Aiden Cline
1950fb8fe4
feat(core): durable video jobs (#64546) 2026-11-17 21:07:18 -06:00
Luke Parker
63bfe62c91
feat(app): add experimental tab groups to side tabs (#64407) 2026-11-17 20:07:32 -06:00
Luke Parker
792cf31f7f
fix(app): stop the timeline crashing when a row leaves mid-update (#64565) 2026-11-17 20:04:42 -06:00
Luke Parker
363217b2c4
feat(app): wrap long lines in timeline code blocks (#64545) 2026-11-17 19:56:02 -06:00
Aiden Cline
2f20ba65b7
feat(core): add Bun.file, Bun.write and Bun.Glob to Code Mode behind full_codemode (#64518) 2026-11-17 19:40:16 -06:00
Aiden Cline
de291ab7b1
fix(ai): send the system prompt as a developer message on every Responses route (#64544) 2026-11-18 00:22:15 +00:00
Aiden Cline
7ca7b3feba
fix(ai): send the OpenAI system prompt as a developer message (#64542)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-17 23:58:26 +00:00
Aiden Cline
9cfff5f24d
feat(codemode): let an extension name the modules that load its globals (#64516) 2026-11-17 16:59:36 -06:00
Aiden Cline
d9d0a46d46
refactor(core): drop url and format from webfetch output (#64534) 2026-11-17 16:56:02 -06:00
Filip Hejmowski
bd115fdac8
fix(core): let either Claude Code flag disable every CLAUDE.md (#64533) 2026-11-17 16:44:46 -06:00
opencode-agent[bot]
b0cecfa496
test(core): expect CLAUDE.md fallbacks in the Windows drive-letter test (#64530)
Co-authored-by: James Long <james@anoma.ly>
2026-11-17 17:31:33 -05:00
Aiden Cline
ea79f69bcf
fix(app): stop reading plugin readiness from plugin.list (#64527) 2026-11-17 15:55:10 -06:00
Aiden Cline
64630cfd65
feat(core): add append to Environment.Files (#64517) 2026-11-17 15:45:04 -06:00
opencode-agent[bot]
cb41d3da12
fix(app): keep plugin update findings until the settled list agrees (#64525)
Co-authored-by: James Long <james@anoma.ly>
2026-11-17 16:32:59 -05:00
Filip Hejmowski
7988f65ab8
refactor(app): pass composer focus on from the shortcut's control (#64504) 2026-11-17 21:32:48 +00:00
Aiden Cline
7bec1e6b35
refactor(server): remove plugin readiness from plugin.list (#64524) 2026-11-17 21:31:07 +00:00
Adam
abad4fc5bf
fix(data): stop redirecting /data by language and give the sitemap real dates (#64523) 2026-11-17 21:23:05 +00:00
Adam
6b18e3c9f2
docs: real descriptions and distinct titles for docs pages (#64521) 2026-11-17 21:21:11 +00:00
Adam
20d049ba33
fix(site): list Console pages in llms.txt; describe llms-full.txt accurately (#64520) 2026-11-17 21:20:44 +00:00
Yhibo
b7340e6415
feat(core): add GPT 6.2 Sol and Astra to the ChatGPT model list (#64508) 2026-11-17 21:14:36 +00:00
Aiden Cline
e92fbcfba1
feat(codemode): let host functions cross back to the host and let globals be constructible (#64472) 2026-11-17 15:11:40 -06:00
Adam
3811714fab
fix(site): permanent redirects for moved docs and marketing pages (#64305) 2026-11-17 15:08:52 -06:00
opencode-agent[bot]
b03809b2d7
feat(app): check for and install plugin updates in Settings › Extensions (#64511)
Co-authored-by: James Long <james@anoma.ly>
2026-11-17 15:58:09 -05:00
James Long
b24d599d33
fix(codemode): let the runtime drop functions and await promises in host-call arguments (#64513) 2026-11-17 20:55:40 +00:00
James Long
2b5ea4977f
fix(codemode): reject an unknown tool's promise instead of throwing (#64510) 2026-11-17 20:42:14 +00:00
Aiden Cline
e40057ab84
feat(core): pin read, edit, write, and patch in full Code Mode (#64497) 2026-11-17 20:39:55 +00:00
James Long
1addb95724
fix(app): reload Recent only when a root session is created (#64503) 2026-11-17 20:36:55 +00:00
James Long
b9029e64a0
refactor(codemode): split the language layer from Code Mode (#64487) 2026-11-17 15:21:51 -05:00
Filip Hejmowski
9c6b33783c
fix(app): focus the composer after switching session tabs by shortcut (#64418) 2026-11-17 21:18:08 +01:00
Aiden Cline
133f24a4d3
feat(server): report plugin readiness on plugin.list (#64029) 2026-11-17 14:12:51 -06:00
Jack
53fb250975
docs: add GPT 6.2 Sol and Astra to Zen (#64491)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-18 02:56:14 +08:00
usrnk1
0e447fce16
feat(stories): cover device pairing flows in the Components Lab (#64490) 2026-11-17 19:14:12 +01:00
Aiden Cline
18503ee942
feat(core): add Node's path to Code Mode behind full_codemode (#64476) 2026-11-17 18:00:45 +00:00
Aiden Cline
f0def1f86f
feat(codemode): let each run pick which of the runtime's extensions it gets (#64482) 2026-11-17 11:53:55 -06:00
Jack
2aed8226ee
docs(console): hold the voice model out of the docs for now (#64477) 2026-11-18 01:37:54 +08:00
James Long
5db3553efa
feat(app): always show the assistant copy button (#64478) 2026-11-17 17:37:35 +00:00
opencode-agent[bot]
7828491cc9
fix(core): fall back to CLAUDE.md where no AGENTS.md exists (#64474)
Co-authored-by: Aiden Cline <aiden@anoma.ly>
Co-authored-by: neriousy <filip@anoma.ly>
2026-11-17 18:05:02 +01:00
Aiden Cline
cbfd30e520
feat(core): enable websearch in full Code Mode (#64475) 2026-11-17 16:54:53 +00:00
Filip Hejmowski
3f19c92afd
fix(core): keep ChatGPT sharing safeguards when a token refresh fails (#64470) 2026-11-17 17:41:10 +01:00
Jack
0e0bc56d2d
docs(console): document image and voice models (#64473) 2026-11-18 00:33:51 +08:00
Aiden Cline
8a30e585a6
refactor(core): simplify websearch tool results (#64471) 2026-11-17 16:23:20 +00:00
James Long
30654dae6c
feat(core): background slow Code Mode scripts behind full_codemode (#64343) 2026-11-17 11:12:13 -05:00
Aarav Sareen
9bc417603d
feat(ui): ship the new icons and drop the experiment (#64466) 2026-11-17 21:40:51 +05:30
Jack
db9e9d69ac
docs(console): drop retired models and list xAI as a ZDR exception (#64465)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-17 23:44:23 +08:00
usrnk1
00016308be
feat(app): add focus rings and focus visibility review stories to components lab (#64460) 2026-11-17 15:30:18 +00:00
James Long
301ab45538
feat(core): make shell the only Code Mode shell tool, pinned and annotated (#64335) 2026-11-17 10:28:59 -05:00
usrnk1
9ca3daec38
feat(app): show copy and download actions in text file tabs (#64463) 2026-11-17 15:27:45 +00:00
usrnk1
a1fbf98b4e
feat(app): pin and mute sessions in the Projects sidebar (#64456) 2026-11-17 15:23:04 +00:00
usrnk1
b181df309d
fix(session-ui): use flat muted dividers for timeline notices (#64462) 2026-11-17 15:21:21 +00:00
Adam
c323ffb786
docs(console): set up harnesses with the Console CLI (#64459) 2026-11-17 09:14:30 -06:00
Aarav Sareen
12d299720d
feat(ui): add new artwork for 25 more icons (#64451) 2026-11-17 20:19:16 +05:30
usrnk1
a60a9d0154
fix(session-ui): restore fading notice dividers in the new timeline (#64453) 2026-11-17 14:48:19 +00:00
usrnk1
b2fda77a4f
fix(app): keep long prompts folded during session creation (#64452) 2026-11-17 15:46:41 +01:00
usrnk1
34d93d4cd5
fix(app): keep Use main checkout on one line in the branch picker (#64450) 2026-11-17 14:30:47 +00:00
usrnk1
09b7b1e726
fix(app): keep the browser pane live while resizing panels on macOS (#64443) 2026-11-17 15:27:25 +01:00
usrnk1
ee5dfa9d41
fix(session-ui): improve spacing for wrapped question descriptions (#64446) 2026-11-17 15:25:05 +01:00
usrnk1
1cb0633c8b
feat(desktop): browser toolbar with mobile and custom viewport sizes (#63819) 2026-11-17 13:54:12 +00:00
usrnk1
0d901e2105
fix(app): open settings on the first sidebar item by listing preferences first (#64440) 2026-11-17 13:41:36 +00:00
usrnk1
4048ff9fee
feat(app): move long message folding to Timeline preferences (#64441) 2026-11-17 14:36:46 +01:00
Jack
95b0de8aa3
docs(console): list Google as a ZDR exception (#64435) 2026-11-17 21:13:47 +08:00
Adam
1f01f83797
feat(opencode): publish artifacts to OpenCode Console through a console artifact provider (#63929) 2026-11-17 07:04:08 -06:00
Aarav Sareen
887f6cd44b
fix(app): show either the variant or the budget on a model row, never both (#64423) 2026-11-17 17:56:09 +05:30
Aarav Sareen
a9a35b4b4c
fix(session-ui): select diff text and comment on it from a toolbar (#64410) 2026-11-17 16:32:12 +05:30
Aarav Sareen
1e6bf4c34a
feat(app): open the model picker flyout from the keyboard and show budgets in it (#64409) 2026-11-17 16:19:05 +05:30
Jack
db1d7b9120
fix(site): feature the most-used Go models in the Go chart (#64391)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-17 16:20:33 +08:00
Aiden Cline
7633c30396
test(core): remove Code Mode flag coverage (#64387)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-17 07:31:45 +00:00
Aiden Cline
edd81e580a
feat(core): enable editing tools in full Code Mode (#64386) 2026-11-17 01:28:15 -06:00
opencode-agent[bot]
fb67e33a13
docs(go): raise GLM-5.3 limits to $100 / $200 / $105 (#64382)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Walter <walter@anoma.ly>
2026-11-17 15:06:34 +08:00
opencode-agent[bot]
e78605ac39
feat(app): render latex and math code fences as display math (#64380)
Co-authored-by: Brendan <brendan@anoma.ly>
2026-11-17 15:04:13 +08:00
Aiden Cline
c658753fdb
feat(core): enable read in full Code Mode (#64368) 2026-11-17 06:48:30 +00:00
Jack
84dcb2fb00
docs: MiMo-V2.6-Flash Free is no longer a privacy exception (#64377) 2026-11-17 14:41:47 +08:00
Jack
f5086ef8a2
fix(site): use the gateway id for DeepSeek V4.1 Flash in the Go chart (#64373) 2026-11-17 14:18:59 +08:00
Aiden Cline
6c5ad7d907
feat(core): hide webfetch when full_codemode is on (#64372) 2026-11-17 06:16:19 +00:00
Jack
f9da9fcd85
fix(site): drop deprecated MiMo V2.5 models from the Go chart (#64371) 2026-11-17 14:07:10 +08:00
Jack
bc2591d501
docs: drop deprecated MiMo V2.5 rows from Go retention table (#64370) 2026-11-17 14:01:16 +08:00
Aiden Cline
bb9d4e3562
feat(core): hide grep and glob when full_codemode is on (#64364) 2026-11-16 23:58:35 -06:00
Aiden Cline
eaa6075572
feat(codemode): add Node's Buffer (#64365) 2026-11-16 23:55:30 -06:00
Aiden Cline
042badd23f
feat(codemode): let a synchronous global block on an Effect (#64363) 2026-11-16 23:54:45 -06:00
Aiden Cline
2cb1818d01
refactor(core): simplify read tool structured output (#64361) 2026-11-17 05:17:40 +00:00
Aiden Cline
df46f6931d
fix(codemode): accept a plain string query in search (#64347) 2026-11-16 21:57:07 -06:00
Luke Parker
32974e0c57
chore: upgrade oxlint to 1.93.0 (#64351) 2026-11-16 21:33:02 -06:00
Dan Smolsky
5cdf288a8c
fix(core): skip unreachable wellknown sources instead of dropping all (#62578) 2026-11-17 03:01:46 +00:00
Dan Smolsky
ecd2cf2f6f
fix(core): include hidden files in ripgrep file search (#62577) 2026-11-16 21:55:01 -05:00
opencode-agent[bot]
d327a9662b
test(cli): wait out Windows EBUSY when removing the ACP fixture root (#64346)
Co-authored-by: James Long <james@anoma.ly>
2026-11-16 21:42:06 -05:00
Aiden Cline
d54fe2628d
fix(codemode): drop the null result line before logs (#64344) 2026-11-16 20:41:54 -06:00
James Long
a0777f3182
fix(core): raise the Code Mode tool summary limit to 500 characters (#64341) 2026-11-17 02:27:56 +00:00
James Long
a9e910d2d4
fix(core): pin @opencode/pty 0.6.0 and use protocol 9 (#64251) 2026-11-16 21:20:00 -05:00
opencode-agent[bot]
c6882a15db
docs(console): move MiniMax M3.1 Flash Free to deprecated models (#64342)
Co-authored-by: Jack <jack@anoma.ly>
2026-11-17 10:11:06 +08:00
Aiden Cline
49b94635ff
feat(ai): add mid-conversation tool changes (#64166) 2026-11-16 19:20:04 -06:00
Aiden Cline
18c9da079e
fix(core): return a renamed tool's structured output in Code Mode (#64333) 2026-11-16 19:18:22 -06:00
Kit Langton
62d06fab22
feat(core): turn experimental schedules into automations (#64160) 2026-11-16 17:14:59 -08:00
Dan Smolsky
3d321762ac
fix(core): ignore a corrupt cached project id (#62576) 2026-11-17 01:01:23 +00:00
Dan Smolsky
0a72d0dc15
feat(tui): choose where to save exports in the new export dialog (#62490) 2026-11-17 00:59:42 +00:00
Dan Smolsky
ca8a517814
fix(core): keep grep results when a match is not valid UTF-8 (#62249) 2026-11-17 00:44:28 +00:00
Adam
3a7aca777c
docs(go): keep data retention terms until Console shows them (#64332) 2026-11-17 00:34:53 +00:00
Adam
222a5abef3
docs(go): link Go's per-model lists and tables to Console's Go page (#64271) 2026-11-17 00:30:18 +00:00
Aiden Cline
e0ab9b0ebc
fix(core): honor plugin tool renames in Code Mode (#63633) 2026-11-16 18:27:08 -06:00
Adam
86755334b4
docs(console): Go Teams 2-member minimum, and Go workspaces can invite teammates (#63627) 2026-11-16 18:24:30 -06:00
Aiden Cline
43406d468d
fix(core): give each Code Mode call its own ID (#64324) 2026-11-16 18:07:25 -06:00
Aiden Cline
9f807c7777
feat(server): async video generation API with disk-backed media (#64140)
Some checks failed
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Process daemon / Miri (callback ownership) (push) Has been cancelled
Process daemon / Core (blacksmith-6vcpu-macos-15) (push) Has been cancelled
Process daemon / Core (ubuntu-22.04) (push) Has been cancelled
Process daemon / Windows (arm64) (push) Has been cancelled
Process daemon / Windows (x64) (push) Has been cancelled
2026-11-16 17:14:18 -06:00
James Long
fd9137efec
fix(process-daemon): synchronize the controller-switch test with PTY input (#64310) 2026-11-16 17:53:29 -05:00
James Long
03d848f7b8
fix(process-daemon): reap shell commands at exit (protocol 9, release 0.6.0) (#64266) 2026-11-16 21:39:24 +00:00
James Long
c0a7beb6d9
ci(process-daemon): pin MSVC 14.51 and cache/prefetch Ghostty dependencies (#64285) 2026-11-16 16:37:32 -05:00
James Long
73de67fcd2
feat(core): move shell into Code Mode behind full_codemode (#64284) 2026-11-16 15:42:54 -05:00
Filip Hejmowski
edd88bd3fe
feat(core): run background compaction by default (#64290) 2026-11-16 21:33:04 +01:00
James Long
7745079647
feat(core): add the full_codemode feature flag, off unless opted in (#64281) 2026-11-16 19:29:13 +00:00
vprdev
d481307bb4
docs(go): explain how models share the usage allowance (#64288) 2026-11-16 11:23:43 -08:00
Dax
0ac0d7ee72
docs(site): update the browse page for 0.1.0 (#64278)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-16 13:04:02 -05:00
Filip Hejmowski
6a2300da32
fix(core): keep unknown ANSI-C escapes the way each shell does (#64263) 2026-11-16 18:15:20 +01:00
Aarav Sareen
96a6c43b34
feat(app): redesign the open project folder picker (#64241) 2026-11-16 22:28:00 +05:30
Filip Hejmowski
93abead744
fix(core): match session titles case-insensitively beyond ASCII (#64259) 2026-11-16 17:56:46 +01:00
Filip Hejmowski
9e48e80fa5
fix(cli): stream ACP turns woken by background shells (#64262) 2026-11-16 17:55:39 +01:00
Filip Hejmowski
887a78e280
fix(tui): close a tab removed by another TUI to its neighbour (#64261) 2026-11-16 17:44:02 +01:00
opencode-agent[bot]
07965844a5
fix(ai): drop reasoning details when the model declares another field (#64243)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: MrMushrooooom <19261047+MrMushrooooom@users.noreply.github.com>
2026-11-16 23:17:50 +08:00
Aarav Sareen
e4606463e7
fix(app): show every provider as a card in Manage models (#64235) 2026-11-16 20:01:05 +05:30
opencodejr[bot]
cdd0585e04
test(app): use the locale's labels in the background activity alignment e2e (#64221)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-16 09:21:33 -05:00
usrnk1
8bd9bdf95d
fix(app): show the base branch for new worktrees and apply branch picks immediately (#64228) 2026-11-16 15:04:30 +01:00
usrnk1
d8da34d23f
fix(stories): let Components Lab load stories that import Navigate (#64229) 2026-11-16 13:55:30 +00:00
usrnk1
139e5c2a14
feat(app): replace Home with Settings in the Customize sidebar (#64227) 2026-11-16 14:49:21 +01:00
opencodejr[bot]
56b5947eaa
test(app): check the eye hover overlay on background-image after the neutral restyle (#64209)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-16 19:10:31 +05:30
usrnk1
e85035a36c
feat(app): replace Home in the desktop Projects sidebar (#64220) 2026-11-16 14:39:37 +01:00
Aarav Sareen
56625a3e1f
fix(app): unify dialog styles (#64216) 2026-11-16 18:42:40 +05:30
Aarav Sareen
a4c9642cf9
fix(app): hide the sidebar resize pill (#64219) 2026-11-16 18:39:28 +05:30
usrnk1
26f2522e60
fix(app): enlarge image attachment thumbnails to 3:2 (#64215) 2026-11-16 13:36:32 +01:00
usrnk1
fd95bf0d21
fix(browser): space URL bar action buttons 6px apart (#64214) 2026-11-16 13:19:55 +01:00
Aarav Sareen
c5f18d1616
fix(app): confirm before disconnecting providers or removing accounts in settings (#64212) 2026-11-16 17:37:20 +05:30
Filip Hejmowski
b083c4d510
fix(app): add missing translations (#64205) 2026-11-16 12:35:19 +01:00
usrnk1
8bb7fab26e
fix(ui): cap large dialogs at 720px and extra-large dialogs at 880px (#64206) 2026-11-16 12:20:44 +01:00
Filip Hejmowski
4c3e17b9d8
fix(desktop): keep drafts storage out of the CLI database (#64203) 2026-11-16 12:20:10 +01:00
Aarav Sareen
9b57cc05cb
fix(app): match the sidebar peek's end inset to its start inset (#64192) 2026-11-16 09:27:09 +00:00
Aarav Sareen
f4107529f6
fix(app): restyle the timeline detail slider and visibility buttons (#64186) 2026-11-16 14:20:57 +05:30
Jack
0354362b85
chore(site): show New on Hy4 flash Free instead of Hy4 in the Go chart (#64178)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
2026-11-16 07:15:25 +00:00
opencode-agent[bot]
cf112e73c1
docs(go): add Hy4 flash Free to Free and Go (#64172)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-16 06:58:28 +00:00
opencode-agent[bot]
b75b158396
fix(ui): don't fade animated-number digits at rest (#64155)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-15 23:06:31 -05:00
Aiden Cline
367d24b70a
feat(ai): scope HTTP middleware to any call, for every modality (#64152) 2026-11-15 21:16:23 -06:00
Aiden Cline
0fad04b3d5
fix(server): answer handler defects with a readable 500 instead of an empty one (#64022) 2026-11-15 20:58:06 -06:00
opencode-agent[bot]
d5ea1ee676
docs(go): add Qwen4 Max (#64144)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-16 02:25:13 +00:00
Adam
c5e741e787
feat(app): name a paired server from its QR code (#64139) 2026-11-15 17:50:57 -06:00
Dax
5d55571d8d
fix(app): no spinner on subagent rows in the new timeline (#64132)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-15 18:00:39 -05:00
Dax
b1acf7ed5c
fix(desktop): match rune hex installation checks (#64131) 2026-11-15 17:58:27 -05:00
Dax
141be750b2
feat(app): hide the hex tip when hex is installed (#64130) 2026-11-15 17:53:11 -05:00
Aiden Cline
aa2960fa26
refactor(ai): unify generation status to running, completed and error (#64109) 2026-11-15 14:37:47 -06:00
Aiden Cline
46b7916ab7
fix(core): report subagent state from outstanding work (#64026) 2026-11-15 14:15:43 -06:00
Dan Smolsky
6c5ef96af4
fix(core): keep Claude Agent models from falling back to 200k context (#64107) 2026-11-15 18:01:08 +00:00
Dax
e3ed63c7de
feat(app): status chips for subagent rows in the new timeline (#64102) 2026-11-15 11:45:36 -05:00
Aiden Cline
d432a06b9c
fix(core): preserve UTF-8 across shell output pages (#63984)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-14 21:49:50 -06:00
Dax
0cfe2c2610
fix(app): never count subagents in the new timeline (#64017) 2026-11-14 22:49:38 -05:00
Aiden Cline
38bd73789a
fix: keep text cuts from splitting characters (#63967)
Some checks failed
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Has been cancelled
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Has been cancelled
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Has been cancelled
bot-nix-hashes / compute (push) Has been cancelled
bot-nix-hashes / publish (push) Has been cancelled
2026-11-14 16:00:40 -06:00
Dax
46744b6469
fix(app): use consistent dialog sizes (#63432) 2026-11-14 16:44:58 -05:00
Dax
9f1639c732
fix(app): clarify hex tip copy (#63974) 2026-11-14 15:42:43 -05:00
opencode-agent[bot]
1fa50dd28c
Revert "docs(go): remove Gemini 4 Argon from Go" (#63969) 2026-11-14 10:51:33 -08:00
opencode-agent[bot]
b4136f3902
docs(go): remove Gemini 4 Argon from Go (#63963)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-14 10:10:35 -08:00
Aiden Cline
b659188ac8
fix(core): identify invalid filename globs in search tools (#63960) 2026-11-14 11:33:20 -06:00
Luke Parker
f61411af46
chore(perf): bench with strobe 0.42.0 (#63957) 2026-11-14 16:40:56 +00:00
Luke Parker
d759c548aa
perf(app): measure main-thread work to scroll history (#63923)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-14 05:53:15 -06:00
Luke Parker
c9957fd508
chore(perf): bench with strobe 0.41.0 (#63918) 2026-11-14 11:04:44 +00:00
Luke Parker
024a1462f5
chore(perf): bench with strobe 0.40.0 (#63914) 2026-11-14 09:23:29 +00:00
Luke Parker
cbe71595e1
chore(perf): bench with strobe 0.39.0 (#63893)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-14 04:12:32 +00:00
opencodejr[bot]
6205e99cb3
fix(ui): keep the redirect paste field named after its label only (#63885)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
2026-11-13 21:16:24 -06:00
Luke Parker
f0089856c0
chore(perf): bench with strobe 0.38.0 (#63883) 2026-11-14 02:21:51 +00:00
usrnk1
83960f8a56
fix(ui): dismiss tooltips when their trigger is pressed (#63834)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-13 21:04:31 +01:00
Aarav Sareen
f91b88efac
fix(app): polish the connect dialog sign-in steps (#63829) 2026-11-14 00:55:24 +05:30
Aiden Cline
e6fc58886a
fix(core): keep text starting with BM readable (#63822) 2026-11-13 12:36:13 -06:00
Aiden Cline
083e3114a5
feat(app): find in side panel previews (#63663) 2026-11-13 12:23:47 -06:00
Aiden Cline
0b7a1a04e6
refactor(core): skip the text MIME scan when checking for media (#63823) 2026-11-13 12:22:53 -06:00
Aiden Cline
48de2e315c
fix(core): match both six-byte GIF signatures (#63811) 2026-11-13 12:10:25 -06:00
Aiden Cline
68fd7dd6b3
fix(core): reject a zero limit on read calls (#63808) 2026-11-13 17:50:08 +00:00
Luke Parker
f0f41c0164
chore(perf): bench with strobe 0.37.0 (#63812) 2026-11-13 17:41:46 +00:00
Dax
c523434e36
test: isolate submenu timing, server config and terminal colors (#63803) 2026-11-13 12:40:07 -05:00
Aiden Cline
2396f7b972
fix(core): preserve a single blank line in paged reads (#63809) 2026-11-13 11:33:53 -06:00
Aiden Cline
b3c1936a97
fix(core): enforce default read limits for small text files (#63810) 2026-11-13 11:30:12 -06:00
Aiden Cline
f6e0c2d083
refactor(ai): ignore video sound on models that can't switch it (#63726) 2026-11-13 09:21:28 -06:00
Luke Parker
ba77ff90d3
chore(perf): bench with strobe 0.36.0 (#63765)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-13 13:29:03 +00:00
Dax
152115dea5
feat(app): wait an hour after first launch before the first tip (#63760) 2026-11-13 08:03:27 -05:00
Dax
507c939f41
fix(tui): drop ttft from the assistant footer (#63759) 2026-11-13 07:58:21 -05:00
Aarav Sareen
191a69ad45
fix(app): tidy New timeline questions, moves, compaction and shells (#63751) 2026-11-13 18:18:43 +05:30
Filip Hejmowski
f352f5e875
fix(ui): switch submenus without blinking and keep them open on the way in (#63739)
Co-authored-by: Filip Hejmowski <fhejmowski@simplito.com>
2026-11-13 12:29:19 +00:00
Aarav Sareen
5b131f5995
fix(session-ui): keep message meta lines visible in the New timeline (#63749) 2026-11-13 17:25:12 +05:30
usrnk1
46aefe3da3
fix(app): hide zero session cost for OpenCode Go (#63744)
Some checks failed
deploy / data-deploy (push) Has been cancelled
deploy-site / site-build (push) Has been cancelled
deploy-files / files-build (push) Has been cancelled
deploy-update / update-build (push) Has been cancelled
deploy / legacy-build (push) Has been cancelled
deploy / data-build (push) Has been cancelled
deploy-site / site-deploy (push) Has been cancelled
deploy-files / files-deploy (push) Has been cancelled
deploy-update / update-deploy (push) Has been cancelled
deploy / legacy-deploy (push) Has been cancelled
2026-11-13 12:23:16 +01:00
usrnk1
a660c18c08
feat(session-ui): make session stories configurable and preview file media (#63738) 2026-11-13 12:10:52 +01:00
usrnk1
71d63d4617
feat(ui): expand interactive stories and compare icon artwork (#63735) 2026-11-13 10:58:45 +00:00
usrnk1
b3f806c2f6
test(gui-plugins): add interactive workspace, browser, and pairing stories (#63734) 2026-11-13 11:58:40 +01:00
usrnk1
a5170d6e01
feat(stories): browse app states in the standalone components lab (#63737) 2026-11-13 11:53:39 +01:00
usrnk1
377b528b05
fix(app): show hover background on subagent breadcrumbs (#63742) 2026-11-13 11:52:16 +01:00
Luke Parker
77b26fdebd
chore(perf): bench with strobe 0.35.0 (#63731) 2026-11-13 10:18:41 +00:00
Aarav Sareen
f413b302fb
fix(app): keep subagent rows in order inside grouped activity in the New timeline (#63725) 2026-11-13 15:27:52 +05:30
Aiden Cline
5bf661138b
feat(core): tell the model its session ID is in OPENCODE_SESSION_ID (#63718) 2026-11-13 03:34:24 -06:00
Aiden Cline
928bb44255
feat(ai): accept only images as video start and end frames (#63721) 2026-11-13 03:26:56 -06:00
Aiden Cline
9dab916b16
refactor(ai): address async image jobs by ID like video (#63720) 2026-11-13 03:23:14 -06:00
Aarav Sareen
f2156d79c9
fix(app): show subagents in grouped activity as events in the New timeline (#63685) 2026-11-13 09:12:03 +00:00
Aarav Sareen
688b60c078
fix(app): keep new timeline status below reports and shorten file lists (#63686) 2026-11-13 14:34:10 +05:30
github-actions[bot]
a554d70499
release: v2.3.0 (#63719)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-13 09:04:03 +00:00
Aiden Cline
f2687cc30a
fix(core): import legacy auth.json only into the user's database file (#63716) 2026-11-13 02:56:05 -06:00
Adam
de63679df0
docs(core): Console watch tool says CI wakes on a failure and once when all checks finish (#63656) 2026-11-13 02:38:21 -06:00
Aiden Cline
0a90308df4
refactor(ai): address video jobs by the provider's job ID (#63714) 2026-11-13 02:37:12 -06:00
Aiden Cline
b80a3891a4
feat(core): move timed-out shell commands to the background by default (#63699) 2026-11-13 02:21:33 -06:00
Aiden Cline
3518013b18
feat(ai): add the xAI video entrypoint and keep video provider options (#63707) 2026-11-13 02:12:09 -06:00
Aiden Cline
73abe63ac2
fix(core): default a zero shell timeout and stop timed-out background commands (#63703) 2026-11-13 01:28:22 -06:00
Aiden Cline
fbdb81d726
fix(core): give local model discovery 15 seconds instead of 1 (#63700) 2026-11-13 01:02:23 -06:00
Aiden Cline
908d140231
feat(core): present a provider's client certificate on model requests (#61832) 2026-11-13 00:56:44 -06:00
Aiden Cline
63a74e7e42
feat(ai): add Google Gemini Omni video generation (#63683) 2026-11-13 06:52:24 +00:00
Aiden Cline
91dccad1eb
fix(core): tag subagent reports with pending background work as running (#63675) 2026-11-13 00:51:04 -06:00
Aiden Cline
b81c5f3465
feat(plugin): export Tool from the effect entrypoint (#63698) 2026-11-13 00:48:01 -06:00
Aiden Cline
27930d26c8
fix(codemode): suggest tools when a namespace is called (#63697) 2026-11-13 00:46:05 -06:00
Aiden Cline
d0cf80c764
feat(ai): add MiniMax video generation (#63682) 2026-11-13 06:42:33 +00:00
Aiden Cline
989565390f
feat(ai): add Seedance video generation for Volcengine and BytePlus (#63680) 2026-11-13 06:20:46 +00:00
Aiden Cline
b645291e9c
fix(core): hide instruction updates a revert left behind (#63667)
Some checks are pending
check-nix / nix-eval (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / publish (push) Blocked by required conditions
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-13 00:07:59 -06:00
Aiden Cline
e36f0c8fda
feat(ai): add OpenRouter video generation (#63681) 2026-11-13 06:05:40 +00:00
Dax
fb11429446
fix(app): remove session search tip and tighten tip copy (#63677) 2026-11-13 00:02:06 -05:00
Dax
81e3c8e378
chore(ci): publish dev builds every 6 hours instead of on every push (#63674) 2026-11-12 23:55:32 -05:00
Dax
6aa3521eba
feat(app): add hex tip (#63668) 2026-11-12 23:55:28 -05:00
Dax
2b2c6054f5
feat(app): show paced one-time tip toasts (#63664) 2026-11-12 23:29:29 -05:00
Aiden Cline
c4601e3d14
fix(core): only discourage unprompted subagent status checks (#63662) 2026-11-12 22:02:20 -06:00
Aiden Cline
5eac2802b7
feat(ai): graduate video generation with start, status, result and cancel (#63657) 2026-11-12 21:56:34 -06:00
Luke Parker
265be7a96d
chore(perf): bench with strobe 0.34.0 (#63661) 2026-11-13 03:53:14 +00:00
Aiden Cline
fe35524411
refactor(core): return the edit summary as a string (#63635) 2026-11-12 21:18:18 -06:00
Aiden Cline
2f8a867eae
fix(core): rename instead of deleting when a patch only changes a file's case (#63655) 2026-11-13 03:07:23 +00:00
Aiden Cline
3f073962bd
refactor(core): expose shell exit code, elapsed time, and log path (#63647) 2026-11-12 21:05:35 -06:00
Dax
7e441d348e
docs(protocol): describe parentID on session create (#63653) 2026-11-12 21:30:14 -05:00
Dax
94e070db97
fix(site): update press email (#63649)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-12 20:49:13 -05:00
Aiden Cline
2f886a2a5e
fix(core): pass stored message metadata to session request hooks (#63590) 2026-11-12 19:00:57 -06:00
Aiden Cline
85a043926a
refactor(ai): remove Gemini Veo and Runway video protocols (#63634) 2026-11-12 18:20:50 -06:00
Aiden Cline
e6f21f95cd
revert(core): restore tool dispatch before nested repair (#63630) 2026-11-13 00:06:23 +00:00
Aiden Cline
a8dde001d3
feat(codemode): stream fetch response bodies (#63436) 2026-11-12 17:50:06 -06:00
Aiden Cline
b6ed77e474
fix(core): return write confirmations as strings (#63616) 2026-11-12 23:47:37 +00:00
Luke Parker
e82687adf4
chore(perf): bench with strobe 0.33.0 (#63628) 2026-11-12 23:44:54 +00:00
Aiden Cline
c80548e800
fix(core): honor plugin tool repairs in Code Mode (#63444) 2026-11-12 17:44:07 -06:00
Aiden Cline
9070bff302
refactor(core): return directory and content from the skill tool (#63623) 2026-11-12 17:43:44 -06:00
Aiden Cline
f1bbaea632
fix(core): return empty structured output from patch (#63618) 2026-11-12 17:43:40 -06:00
David Hill
6dd40633a1
docs(site): brand colors copy and agent style rules (#63621) 2026-11-12 17:03:17 -06:00
opencode-agent[bot]
737e133b95
feat(site): link the Android app on Google Play (#62874)
Co-authored-by: R44VC0RP <89211796+R44VC0RP@users.noreply.github.com>
2026-11-12 22:59:00 +00:00
Sara Kay
aed4cbc024
fix(gui-plugins): keep the pairing QR code dark on light in every theme (#63220)
Co-authored-by: ssskay <ssskay@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:24:52 -05:00
Adam
f179e6e5f0
fix(tui): drop tool-result image bytes from the transcript store unless image previews are on (#63577)
Some checks are pending
deploy / data-build (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-deploy (push) Blocked by required conditions
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
2026-11-12 15:17:44 -06:00
James Long
fd6a1167b4
fix(tui): give shell mode its own prompt color under new designs (#63605) 2026-11-12 16:09:20 -05:00
David Hill
9bc30594ab
refactor(site): put every neutral grey on one shared scale (#63604)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-12 20:57:16 +00:00
Aiden Cline
a3d6e54b3d
fix(codemode): decode UTF-8 across chunk boundaries (#63600) 2026-11-12 20:30:06 +00:00
Aiden Cline
8921769577
fix(core): drop stale thinking when Claude Agent prompts or tools change (#63592) 2026-11-12 13:56:50 -06:00
Adam
ebf6e00ad3
docs(console): document Send identity on custom providers (#63596) 2026-11-12 13:49:08 -06:00
James Long
a1aa513f78
fix(core): resume directly driven child sessions after restart (#63415) 2026-11-12 14:23:00 -05:00
opencode-agent[bot]
8c809fb1f8
docs(console): add Gemini 4 Hydrogen to Zen (#63589)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-12 11:10:55 -08:00
James Long
6cca598863
fix(session-ui): keep links whose label contains inline code (#63587) 2026-11-12 13:51:17 -05:00
James Long
becb9c7c9f
fix(app): order Recent sessions by the last list reload and drop the rename guard (#63370) 2026-11-12 13:45:04 -05:00
usrnk1
f738b32d23
feat(app): jump to an earlier prompt by searching session messages (#63585) 2026-11-12 19:41:08 +01:00
James Long
a73657f3f9
refactor(codemode): flatten the VM into src and remove two-engine leftovers (#63377) 2026-11-12 13:39:15 -05:00
James Long
3cfe63a182
fix(tui): restore pasted text when undo brings back its placeholder (#63265) 2026-11-12 13:34:17 -05:00
James Long
89e66ae70e
fix(tui): restore the live draft after browsing prompt history (#63262) 2026-11-12 13:33:17 -05:00
Aarav Sareen
0996030161
feat(app): show a free limit panel in place of the composer (#63531) 2026-11-13 00:01:25 +05:30
Luke Parker
5418e010d7
chore(perf): bench with strobe 0.32.0 (#63575) 2026-11-12 16:58:55 +00:00
James Long
28f74f8591
fix(tui): copy the paste inside the prompt selection (#63275) 2026-11-12 16:50:11 +00:00
James Long
32a00c976d
fix(tui): keep the Mini draft caret when closing the command palette (#63260) 2026-11-12 16:49:22 +00:00
Dax
71b27c4cd8
fix(app): reuse mention suggestions while typing (#63572) 2026-11-12 11:46:46 -05:00
Aiden Cline
f96b54590d
docs: describe tools exposed directly when execute is denied (#63566) 2026-11-12 10:28:25 -06:00
David Hill
33aefad13c
chore(site): serve OG Studio link cards from the files bucket, add docs previews (#63560)
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
2026-11-12 10:00:20 -06:00
David Hill
1a85993784
chore(site): render Ukrainian and Russian link cards in OpenTUI Mono's Cyrillic (#63556) 2026-11-12 09:30:37 -06:00
Filip
ec263d62b6
fix(core): keep plugin swaps going when a cleanup fails (#63548)
Co-authored-by: Filip Hejmowski <fhejmowski@simplito.com>
2026-11-12 16:15:41 +01:00
usrnk1
96d950178c
fix(app): advance SSH prompts and close the dialog on connection (#63544) 2026-11-12 15:14:43 +00:00
opencode-agent[bot]
b268a4e8b0
feat(session-ui): maximize Mermaid diagrams to zoom and pan them (#59250) 2026-11-12 15:02:33 +00:00
usrnk1
1c53e40a7f
feat(app): choose each server's terminal shell from its menu (#63539) 2026-11-12 15:37:30 +01:00
James Long
98def2f90e
test(app): update e2e specs for always-background subagents (#63538) 2026-11-12 09:08:25 -05:00
Dax
196a5ee922
chore: only require code owner review for .github (#63543) 2026-11-12 08:54:05 -05:00
Luke Parker
3d308eae2e
chore(perf): bench with strobe 0.31.0 (#63515)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-12 11:03:03 +00:00
Adam
9d236eb0c8
fix(site): ship the link-card videos with the site's static assets (#63459)
Some checks are pending
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy-update / update-build (push) Waiting to run
deploy-update / update-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-12 04:56:04 -06:00
Aarav Sareen
82e39cce28
fix(app): restore message footers in the New timeline (#63513) 2026-11-12 16:08:23 +05:30
opencode-agent[bot]
d7ae4f2e3c
fix(site): keep the page when leaving the Markdown view on static pages (#63503)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-12 10:56:00 +01:00
Filip
cbcd846a57
fix(app): retry browser pane when server plugins finish loading (#63500) 2026-11-12 10:45:34 +01:00
Luke Parker
df7911ab8b
chore(perf): bench with strobe 0.30.0 (#63497) 2026-11-12 09:17:00 +00:00
Dax Raad
101776024c fix(release): limit stable releases to named actors
Some checks failed
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-6vcpu-macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
Process daemon / Miri (callback ownership) (push) Has been cancelled
Process daemon / Core (blacksmith-6vcpu-macos-15) (push) Has been cancelled
Process daemon / Core (ubuntu-22.04) (push) Has been cancelled
Process daemon / Windows (arm64) (push) Has been cancelled
Process daemon / Windows (x64) (push) Has been cancelled
2026-11-11 23:08:45 -05:00
Aiden Cline
2c1e17b581
feat(core): publish MCP events on the bus (#63261) 2026-11-11 21:41:31 -06:00
Luke Parker
4f51455a5d
chore(perf): bench with strobe 0.29.0 (#63441) 2026-11-12 03:01:34 +00:00
Aiden Cline
647e5a7b18
fix(ai): accept System One refusals and send PDFs in the OpenRouter state (#63443) 2026-11-12 03:00:45 +00:00
opencode-agent[bot]
5c965609cf
docs(console): add GPT 6 Luna Decision and Gemini Decision 1 (#63440)
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
2026-11-11 18:54:37 -08:00
Dax Raad
f5ca39a97d fix(tui): open session list at the top instead of the current session 2026-11-11 20:56:14 -05:00
Dax
6c34e24488
feat(app): hide and mute sessions in Recent sidebar (#63427) 2026-11-11 20:27:07 -05:00
Dax Raad
a7041d45d6 isolate release credentials and process daemon publishing 2026-11-11 20:21:45 -05:00
Dax
b451fe3952
fix(legacy): keep github app secrets in production (#63423) 2026-11-11 19:49:20 -05:00
James Long
6d023043ca
refactor(core): remove the subagent notify option (#63413) 2026-11-11 18:44:14 -05:00
James Long
63dd3f1c6c
feat(core): run local Windows shell commands in the process daemon (#63409) 2026-11-11 18:32:15 -05:00
Aiden Cline
464688ba68
fix(core): stop keeping the whole file in memory for tail reads (#63030) 2026-11-11 17:30:09 -06:00
Dan Smolsky
6b8c796eeb
fix(core): use the localhost redirect when an MCP OAuth server rewrites 127.0.0.1 (#63403) 2026-11-11 18:04:54 -05:00
Dax
17b5826a5e
ci: run macos build jobs on blacksmith (#63397) 2026-11-11 17:29:09 -05:00
David Hill
135d46cea7
chore(site): remove the /ide page (#63386)
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
2026-11-11 21:56:25 +00:00
James Long
b5fb1df299
fix(tui): show the subagent card instead of launch instructions in mini scrollback (#63389) 2026-11-11 15:53:40 -06:00
James Long
ffcaeec36c
refactor(app): remove leftover foreground subagent UI (#63391) 2026-11-11 15:53:31 -06:00
James Long
23dd370ab5
refactor(core): remove leftover foreground subagent and reattach code (#63392) 2026-11-11 15:52:50 -06:00
David Hill
41cc8d6b9d
chore(site): update OpenCode link cards (#63401) 2026-11-11 15:51:06 -06:00
David Hill
1df721deeb
feat(site): simplify the docs header menu and move the V1 notice into the header (#63399) 2026-11-11 15:51:02 -06:00
Aiden Cline
7392bd4567
fix(core): show the start of tool output that exceeds the limit (#63272) 2026-11-11 15:38:06 -06:00
Dax Raad
afbd99f93f read dev data sync from the dev lake 2026-11-11 16:32:54 -05:00
Dax
33123b1c42
ci: deploy dev workers in anomaly-dev (#63379)
Some checks are pending
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
bot-nix-hashes / hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
bot-nix-hashes / hash (macos-latest, aarch64-darwin) (push) Waiting to run
bot-nix-hashes / compute (push) Blocked by required conditions
bot-nix-hashes / publish (push) Blocked by required conditions
check-nix / nix-eval (push) Waiting to run
Process daemon / Miri (callback ownership) (push) Waiting to run
Process daemon / Core (macos-15) (push) Waiting to run
Process daemon / Core (ubuntu-22.04) (push) Waiting to run
Process daemon / Windows (arm64) (push) Waiting to run
Process daemon / Windows (x64) (push) Waiting to run
check / typecheck (push) Waiting to run
deploy-files / files-build (push) Waiting to run
deploy-files / files-deploy (push) Blocked by required conditions
deploy-site / site-build (push) Waiting to run
deploy-site / site-deploy (push) Blocked by required conditions
deploy / legacy-build (push) Waiting to run
deploy / legacy-deploy (push) Blocked by required conditions
deploy / data-build (push) Waiting to run
deploy / data-deploy (push) Blocked by required conditions
2026-11-11 16:17:46 -05:00
Vladimir Glafirov
745636aee3
chore(core): bump gitlab-ai-provider to 6.24.0 (#63342) 2026-11-11 21:08:57 +00:00
James Long
3039a8b5e9
fix(acp): stream the parent's reaction to background subagent reports (#63395) 2026-11-11 21:04:39 +00:00
Aiden Cline
0bd8cee7c2
feat(ai): add Google Decisions (#63369) 2026-11-11 14:40:35 -06:00
7848 changed files with 1138373 additions and 124239 deletions

17
.gitattributes vendored
View file

@ -7,7 +7,24 @@ packages/protocol/openapi.json linguist-generated
packages/client/src/promise/generated/** linguist-generated packages/client/src/promise/generated/** linguist-generated
packages/client/src/effect/generated/** linguist-generated packages/client/src/effect/generated/** linguist-generated
packages/client/src/effect/api/** linguist-generated packages/client/src/effect/api/** linguist-generated
# cli-rs: parity recordings and the files `script/gen` writes.
packages/cli-rs/parity/fixtures/** linguist-generated
packages/cli-rs/assets/queries/** linguist-generated
packages/cli-rs/crates/acp/src/permission/structured_patch.json linguist-generated
packages/cli-rs/crates/api-types/src/types.rs linguist-generated
packages/cli-rs/crates/api/src/generated/** linguist-generated
packages/cli-rs/crates/cli/src/run/mime.rs linguist-generated
packages/cli-rs/crates/cli/tests/fixtures/** linguist-generated
packages/cli-rs/crates/local/src/generated/** linguist-generated
packages/cli-rs/crates/mermaid/src/core/entities.rs linguist-generated
packages/cli-rs/crates/mermaid/src/core/wide.rs linguist-generated
packages/cli-rs/crates/ui/src/fuzzy/accents.rs linguist-generated
packages/cli-rs/crates/ui/src/keymap/generated.rs linguist-generated
packages/cli-rs/crates/ui/src/theme/generated/** linguist-generated
packages/cli-rs/crates/util/fixtures/time.tsv linguist-generated
packages/core/src/**/*.txt text eol=lf packages/core/src/**/*.txt text eol=lf
# test/opencode-api-skill.test.ts compares the generated API reference byte for byte, so Windows checkouts keep LF.
packages/core/src/plugin/skill/opencode/** text eol=lf
packages/httpapi-codegen/test/generated/*.ts text eol=lf packages/httpapi-codegen/test/generated/*.ts text eol=lf
# The site tests compare source text and humans.txt byte for byte, so Windows checkouts keep LF. # The site tests compare source text and humans.txt byte for byte, so Windows checkouts keep LF.
services/site/** text=auto eol=lf services/site/** text=auto eol=lf

12
.github/CODEOWNERS vendored
View file

@ -1,11 +1,3 @@
# web + desktop packages
packages/app/ @Hona @Brendonovich
packages/desktop/ @Hona @Brendonovich
# GUI plugin SDK
# changes here must be meticulous - pls chat first :)
packages/plugin/src/gui/ @Hona
# CI and releases. Release jobs that hold secrets run only .github/workflows/release.yml and .github/release/, # CI and releases. Release jobs that hold secrets run only .github/workflows/release.yml and .github/release/,
# which makes this path the release security boundary. # which makes this path the release security boundary. It is the only path that needs a code owner review.
/.github/ @anomalyco/releasers /.github/ @thdxr

View file

@ -11,7 +11,6 @@ kommander
ludvigrask ludvigrask
MrMushrooooom MrMushrooooom
neriousy neriousy
nexxeln
R44VC0RP R44VC0RP
rekram1-node rekram1-node
thdxr thdxr
@ -19,4 +18,8 @@ simonklee
Slickstef11 Slickstef11
usrnk1 usrnk1
vimtor vimtor
StarpTech Tarquinen
dc85
vaprdev
hearnadam
heimoshuiyu

View file

@ -0,0 +1,40 @@
name: Prefetch Ghostty dependencies
description: Prepare the pinned source and Zig packages for process-daemon's native build
runs:
using: composite
steps:
- name: Check out pinned Ghostty source
id: pins
shell: bash
env:
GHOSTTY_SOURCE_DIR: ${{ runner.temp }}/ghostty
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/.zig-cache
run: |
revision=$(git show HEAD:packages/process-daemon/ghostty-revision)
git init --quiet "$GHOSTTY_SOURCE_DIR"
git -C "$GHOSTTY_SOURCE_DIR" fetch --depth=1 https://github.com/ghostty-org/ghostty.git "$revision"
git -C "$GHOSTTY_SOURCE_DIR" -c core.longpaths=true checkout --detach "$revision"
echo "revision=$revision" >> "$GITHUB_OUTPUT"
echo "zig=$(zig version)" >> "$GITHUB_OUTPUT"
echo "GHOSTTY_SOURCE_DIR=$GHOSTTY_SOURCE_DIR" >> "$GITHUB_ENV"
echo "ZIG_GLOBAL_CACHE_DIR=$ZIG_GLOBAL_CACHE_DIR" >> "$GITHUB_ENV"
# Zig 0.16 stores portable, content-addressed source tarballs in p/.
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .zig-cache/p
key: ghostty-packages-${{ steps.pins.outputs.zig }}-${{ steps.pins.outputs.revision }}
enableCrossOsArchive: true
- name: Fetch Zig packages
shell: bash
working-directory: ${{ env.GHOSTTY_SOURCE_DIR }}
run: |
for attempt in 1 2 3 4; do
echo "zig build --fetch=all (attempt $attempt/4)"
if zig build --fetch=all; then exit 0; fi
if [[ $attempt == 4 ]]; then exit 1; fi
delay=$((5 * 2 ** (attempt - 1)))
echo "Retrying in ${delay}s"
sleep "$delay"
done

53
.github/release/backfill-blockmaps.sh vendored Normal file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
# backfill-blockmaps.sh <version>...: builds the .blockmap for each published Windows installer and macOS zip of
# the given stable versions from the signed files on opencode.ai/files and uploads it next to them. Releases before
# publish-desktop.sh built blockmaps shipped without them, so electron-updater could not update differentially
# from them. A blockmap that already exists is left alone; a file the version never shipped is skipped.
. "$(dirname "$0")/lib.sh"
actor=${GITHUB_TRIGGERING_ACTOR:-${GITHUB_ACTOR:-}}
if ! (shopt -s nocasematch; [[ "$actor" = thdxr || "$actor" = Hona || "$actor" = rekram1-node ]]); then
die "${actor:-An unknown actor} is not allowed to backfill release files"
fi
[ $# -gt 0 ] || die "No versions given"
for version in "$@"; do
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] && [[ "$version" != 0.0.0-* ]] ||
die "Invalid release version: $version"
done
names=(opencode-desktop-win-arm64.exe opencode-desktop-win-x64.exe opencode-desktop-mac-arm64.zip opencode-desktop-mac-x64.zip)
status() {
curl -sS -o /dev/null -w '%{http_code}' --head "$1"
}
credentials=false
for version in "$@"; do
dir=$(mktemp -d)
for name in "${names[@]}"; do
url="https://opencode.ai/files/bin/$version/$name"
case "$(status "$url.blockmap")" in
200) echo "$version/$name.blockmap exists" && continue ;;
404) ;;
*) die "Could not check $url.blockmap" ;;
esac
case "$(status "$url")" in
200) ;;
404) echo "$version/$name was not published" && continue ;;
*) die "Could not check $url" ;;
esac
curl -fsSL --retry 3 -o "$dir/$name" "$url"
node "$release_dir/blockmap.mjs" "$dir/$name"
if dry_run; then
echo "dry-run upload: bin/$version/$name.blockmap ($(size "$dir/$name.blockmap") bytes)"
continue
fi
if [ "$credentials" = false ]; then
r2_credentials
credentials=true
fi
OPENCODE_VERSION=$version upload_file "$dir/$name.blockmap" "$name.blockmap" application/octet-stream ||
die "Upload failed: $version/$name.blockmap"
echo "uploaded bin/$version/$name.blockmap"
done
rm -rf "$dir"
done

179
.github/release/blockmap.mjs vendored Normal file
View file

@ -0,0 +1,179 @@
// blockmap.mjs <file>...: writes <file>.blockmap next to each file, the gzipped block map electron-updater fetches
// for a differential download. It matches electron-builder's buildBlockMap (app-builder-lib 26): Rabin
// content-defined chunks of 8-32 KB and a 18-byte BLAKE2b checksum per chunk. electron-builder builds it at pack
// time, but signing changes the installer, so the release builds it here from the final signed files.
//
// It runs in publish jobs that hold secrets, so it uses Node's standard library only.
import { createReadStream, writeFileSync } from "node:fs"
import { gzipSync } from "node:zlib"
const MIN = 8192
const MAX = 32768
const MASK = 16384 - 1
const WINDOW = 64
// Rabin fingerprint tables for the degree-63 polynomial 0xbfe6b8a5bf378d83 (github.com/aclements/go-rabin), each
// 64-bit entry split into signed 32-bit hi and lo words.
const POLY = 0xbfe6b8a5bf378d83n
const PUSH_HI = new Int32Array(256)
const PUSH_LO = new Int32Array(256)
const POP_HI = new Int32Array(256)
const POP_LO = new Int32Array(256)
{
const mod = (a) => {
for (let d = a.toString(2).length - 1; a !== 0n && d >= 63; d = a.toString(2).length - 1)
a ^= POLY << BigInt(d - 63)
return a
}
const set = (hi, lo, i, x) => {
hi[i] = Number(BigInt.asIntN(32, x >> 32n))
lo[i] = Number(BigInt.asIntN(32, x))
}
for (let i = 0; i < 256; i++) {
const b = BigInt(i)
set(PUSH_HI, PUSH_LO, i, BigInt.asUintN(64, (b << 63n) ^ mod(b << 63n)))
set(POP_HI, POP_LO, i, mod(b << BigInt((WINDOW - 1) * 8)))
}
}
// BLAKE2b (RFC 7693) with an 18-byte digest and no key, on 32-bit word pairs. Node's crypto offers only BLAKE2b-512,
// whose digest length is part of the parameter block, so truncating it gives a different hash.
const IV = new Uint32Array([
0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, 0xade682d1,
0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19,
])
const SIGMA = [
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
[14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3],
[11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4],
[7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8],
[9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13],
[2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9],
[12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11],
[13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10],
[6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5],
[10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0],
].map((row) => row.map((i) => i * 2))
const ROUNDS = [...SIGMA, SIGMA[0], SIGMA[1]]
const DIGEST = 18
const v = new Uint32Array(32)
const m = new Uint32Array(32)
const h = new Uint32Array(16)
const block = new Uint8Array(128)
const view = new DataView(block.buffer)
function add(a, b0, b1) {
const lo = v[a] + b0
v[a + 1] = v[a + 1] + b1 + (lo >= 0x100000000 ? 1 : 0)
v[a] = lo
}
function mix(a, b, c, d, x, y) {
add(a, v[b], v[b + 1])
add(a, m[x], m[x + 1])
let lo = v[d] ^ v[a]
let hi = v[d + 1] ^ v[a + 1]
v[d] = hi
v[d + 1] = lo
add(c, v[d], v[d + 1])
lo = v[b] ^ v[c]
hi = v[b + 1] ^ v[c + 1]
v[b] = (lo >>> 24) ^ (hi << 8)
v[b + 1] = (hi >>> 24) ^ (lo << 8)
add(a, v[b], v[b + 1])
add(a, m[y], m[y + 1])
lo = v[d] ^ v[a]
hi = v[d + 1] ^ v[a + 1]
v[d] = (lo >>> 16) ^ (hi << 16)
v[d + 1] = (hi >>> 16) ^ (lo << 16)
add(c, v[d], v[d + 1])
lo = v[b] ^ v[c]
hi = v[b + 1] ^ v[c + 1]
v[b] = (hi >>> 31) ^ (lo << 1)
v[b + 1] = (lo >>> 31) ^ (hi << 1)
}
function compress(count, last) {
for (let i = 0; i < 16; i++) {
v[i] = h[i]
v[i + 16] = IV[i]
}
v[24] ^= count
v[25] ^= Math.floor(count / 0x100000000)
if (last) {
v[28] = ~v[28]
v[29] = ~v[29]
}
for (let i = 0; i < 32; i++) m[i] = view.getUint32(i * 4, true)
for (const s of ROUNDS) {
mix(0, 8, 16, 24, s[0], s[1])
mix(2, 10, 18, 26, s[2], s[3])
mix(4, 12, 20, 28, s[4], s[5])
mix(6, 14, 22, 30, s[6], s[7])
mix(0, 10, 20, 30, s[8], s[9])
mix(2, 12, 22, 24, s[10], s[11])
mix(4, 14, 16, 26, s[12], s[13])
mix(6, 8, 18, 28, s[14], s[15])
}
for (let i = 0; i < 16; i++) h[i] ^= v[i] ^ v[i + 16]
}
function blake2b(data) {
h.set(IV)
h[0] ^= 0x01010000 ^ DIGEST
let offset = 0
while (data.length - offset > 128) {
block.set(data.subarray(offset, offset + 128))
offset += 128
compress(offset, false)
}
block.fill(0)
block.set(data.subarray(offset))
compress(data.length, true)
return Buffer.from(h.buffer, h.byteOffset, DIGEST).toString("base64")
}
async function blockmap(file) {
const checksums = []
const sizes = []
const chunk = Buffer.allocUnsafe(MAX)
const win = new Uint8Array(WINDOW)
let n = 0
let hi = 0
let lo = 0
let pos = 0
const emit = () => {
checksums.push(blake2b(chunk.subarray(0, n)))
sizes.push(n)
n = hi = lo = pos = 0
win.fill(0)
}
for await (const data of createReadStream(file, { highWaterMark: 256 * 1024 })) {
for (let i = 0; i < data.length; i++) {
const b = data[i]
chunk[n++] = b
if (n <= MIN - WINDOW) continue
if (n > MIN) {
const old = win[pos]
hi ^= POP_HI[old]
lo ^= POP_LO[old]
}
win[pos] = b
pos = (pos + 1) % WINDOW
const top = (hi >>> 23) & 0xff
const nhi = ((hi << 8) | (lo >>> 24)) & 0x7fffffff
const nlo = (lo << 8) | b
hi = nhi ^ PUSH_HI[top]
lo = nlo ^ PUSH_LO[top]
if (n >= MIN && ((lo & MASK) === MASK || n >= MAX)) emit()
}
}
if (n > 0) emit()
const map = { version: "2", files: [{ name: "file", offset: 0, checksums, sizes }] }
writeFileSync(`${file}.blockmap`, gzipSync(Buffer.from(JSON.stringify(map)), { level: 9 }))
}
for (const file of process.argv.slice(2)) await blockmap(file)

View file

@ -12,6 +12,10 @@ set +x
url=${CLOUDFLARE_TOKEN_URL:-https://kjivkui2evldapbok5fhrrl6oy0fctkp.lambda-url.us-east-1.on.aws/} url=${CLOUDFLARE_TOKEN_URL:-https://kjivkui2evldapbok5fhrrl6oy0fctkp.lambda-url.us-east-1.on.aws/}
account=${CLOUDFLARE_ACCOUNT_ID:-15d29c8639fd3733b1b5486a2acfd968} account=${CLOUDFLARE_ACCOUNT_ID:-15d29c8639fd3733b1b5486a2acfd968}
if [[ $# == 1 ]]; then
. "$(dirname "$0")/lib.sh"
account=$(stage_account "$1")
fi
# One argv value, never a line in curl's config: a newline in an override must not be able to # One argv value, never a line in curl's config: a newline in an override must not be able to
# inject curl options or move the AWS credentials into Basic auth. # inject curl options or move the AWS credentials into Basic auth.

View file

@ -32,7 +32,8 @@ done
: "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}"
# Pinned in targets/ and in the token issuer's config (anomalyco/secrets). # Pinned in targets/ and in the token issuer's config (anomalyco/secrets).
export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode")
export CLOUDFLARE_ACCOUNT_ID
unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \ unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \
! -path ./v0/config.json \ ! -path ./v0/config.json \

View file

@ -24,7 +24,8 @@ target="$release/targets/files/$mode/wrangler.json"
: "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}"
# Pinned in targets/ and in the token issuer's config (anomalyco/secrets). # Pinned in targets/ and in the token issuer's config (anomalyco/secrets).
export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode")
export CLOUDFLARE_ACCOUNT_ID
unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS ! -path ./index.js) unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS ! -path ./index.js)
[ -z "$unexpected" ] || die "Unexpected files in the files artifact: $unexpected" [ -z "$unexpected" ] || die "Unexpected files in the files artifact: $unexpected"

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# deploy-legacy.sh <dev|production> <dir> <secrets.json>: deploys the legacy # deploy-legacy.sh <dev|production> <dir> [production-secrets.json]: deploys the legacy
# Worker from a verified Build Output artifact (services/legacy/.cloudflare/output) # Worker from a verified Build Output artifact (services/legacy/.cloudflare/output)
# with the cf CLI pinned in cf/package-lock.json. # with the cf CLI pinned in cf/package-lock.json.
# #
@ -12,7 +12,6 @@
mode=$1 mode=$1
src=$(cd "$2" && pwd) src=$(cd "$2" && pwd)
secrets=$(posix "$3")
release=$(cd "$(dirname "$0")" && pwd) release=$(cd "$(dirname "$0")" && pwd)
case "$mode" in case "$mode" in
@ -24,7 +23,8 @@ target="$release/targets/legacy/$mode"
: "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}"
# Pinned in targets/ and in the token issuer's config (anomalyco/secrets). # Pinned in targets/ and in the token issuer's config (anomalyco/secrets).
export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode")
export CLOUDFLARE_ACCOUNT_ID
unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \ unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \
! -path ./v0/config.json \ ! -path ./v0/config.json \
@ -36,8 +36,13 @@ unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256
expect_json "$src/v0/config.json" "$target/root.json" "The legacy Worker's root config" expect_json "$src/v0/config.json" "$target/root.json" "The legacy Worker's root config"
expect_json "$src/v0/workers/default/worker.config.json" "$target/worker.json" "The legacy Worker's config" expect_json "$src/v0/workers/default/worker.config.json" "$target/worker.json" "The legacy Worker's config"
jq -e 'keys == ["GITHUB_APP_ID", "GITHUB_APP_PRIVATE_KEY"] and all(.[]; type == "string" and length > 0)' \ args=()
"$secrets" > /dev/null || die "The secrets file does not hold exactly GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY" if [[ "$mode" == production ]]; then
secrets=$(posix "$3")
jq -e 'keys == ["GITHUB_APP_ID", "GITHUB_APP_PRIVATE_KEY"] and all(.[]; type == "string" and length > 0)' \
"$secrets" > /dev/null || die "The secrets file does not hold exactly GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY"
args=(--secrets-file "$secrets")
fi
work=$(mktemp -d) work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT trap 'rm -rf "$work"' EXIT
@ -51,4 +56,4 @@ cf="$release/cf/node_modules/.bin/cf"
[ -x "$cf" ] || die "Install the pinned cf CLI first: npm ci --ignore-scripts in .github/release/cf" [ -x "$cf" ] || die "Install the pinned cf CLI first: npm ci --ignore-scripts in .github/release/cf"
cd "$work" cd "$work"
"$cf" deploy --prebuilt --mode "$mode" --secrets-file "$secrets" "$cf" deploy --prebuilt --mode "$mode" "${args[@]}"

View file

@ -24,7 +24,8 @@ target="$release/targets/site/$mode"
: "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}"
# Pinned in targets/ and in the token issuer's config (anomalyco/secrets). # Pinned in targets/ and in the token issuer's config (anomalyco/secrets).
export CLOUDFLARE_ACCOUNT_ID=15d29c8639fd3733b1b5486a2acfd968 CLOUDFLARE_ACCOUNT_ID=$(stage_account "$mode")
export CLOUDFLARE_ACCOUNT_ID
unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \ unexpected=$(cd "$src" && find . ! -type d ! -type f -o -type f ! -path ./SHA256SUMS \
! -path ./v0/config.json \ ! -path ./v0/config.json \

View file

@ -6,5 +6,7 @@
<true/> <true/>
<key>com.apple.security.device.audio-input</key> <key>com.apple.security.device.audio-input</key>
<true/> <true/>
<key>com.apple.security.device.camera</key>
<true/>
</dict> </dict>
</plist> </plist>

14
.github/release/import-certificate.sh vendored Normal file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
umask 077
cert="$RUNNER_TEMP/cert.p12"
trap 'rm -f "$cert"' EXIT
keychain_password=$(openssl rand -base64 32)
printf '%s' "$APPLE_SIGNING_CERTIFICATE" | base64 --decode > "$cert"
unset APPLE_SIGNING_CERTIFICATE
security create-keychain -p "$keychain_password" build.keychain
security set-keychain-settings -lut 21600 build.keychain
security unlock-keychain -p "$keychain_password" build.keychain
security import "$cert" -k build.keychain -P "" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productsign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null
security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')

View file

@ -23,6 +23,14 @@ dry_run() {
[ "${OPENCODE_DRY_RUN:-false}" = true ] [ "${OPENCODE_DRY_RUN:-false}" = true ]
} }
stage_account() {
case "$1" in
dev) echo d8e944f537ceef3f06a5bd3aec1d7a53 ;;
production) echo 15d29c8639fd3733b1b5486a2acfd968 ;;
*) die "Unknown Cloudflare stage: $1" ;;
esac
}
sha256() { sha256() {
if command -v sha256sum > /dev/null; then sha256sum "$@"; else shasum -a 256 "$@"; fi if command -v sha256sum > /dev/null; then sha256sum "$@"; else shasum -a 256 "$@"; fi
} }

View file

@ -2,18 +2,18 @@
# plan-release.sh: decides version, channel and npm dist-tag from the event, ref and dispatch inputs # plan-release.sh: decides version, channel and npm dist-tag from the event, ref and dispatch inputs
# (INPUT_BUMP, INPUT_VERSION) only, and writes them to $GITHUB_OUTPUT. Nothing here reads repository files. # (INPUT_BUMP, INPUT_VERSION) only, and writes them to $GITHUB_OUTPUT. Nothing here reads repository files.
# #
# push or dispatch on dev -> dev 0.0.0-dev-<run> npm tag dev, desktop # schedule or dispatch on dev -> dev 0.0.0-dev-<run> npm tag dev, desktop
# dispatch on dev with bump/version -> latest x.y.z npm tag latest, releasers only, notes required # dispatch on dev with bump/version -> latest x.y.z npm tag latest, releasers only, notes required
# push or dispatch on beta -> beta 0.0.0-beta-<run> desktop only # push or dispatch on beta -> beta 0.0.0-beta-<run> desktop only
# pull_request -> pr 0.0.0-pr-<run> everything, dry run # pull_request -> pr 0.0.0-pr-<run> everything, dry run
# #
# Releasers are actors with the admin or maintain role on the repository (the releasers team has maintain). # Stable releases are limited to the GitHub logins listed below (case-insensitive).
. "$(dirname "$0")/lib.sh" . "$(dirname "$0")/lib.sh"
versioned=false versioned=false
if [ -n "${INPUT_BUMP:-}" ] || [ -n "${INPUT_VERSION:-}" ]; then versioned=true; fi if [ -n "${INPUT_BUMP:-}" ] || [ -n "${INPUT_VERSION:-}" ]; then versioned=true; fi
case "$GITHUB_EVENT_NAME:$GITHUB_REF:$versioned" in case "$GITHUB_EVENT_NAME:$GITHUB_REF:$versioned" in
push:refs/heads/dev:false | workflow_dispatch:refs/heads/dev:false) channel="dev" ;; schedule:refs/heads/dev:false | workflow_dispatch:refs/heads/dev:false) channel="dev" ;;
workflow_dispatch:refs/heads/dev:true) channel="latest" ;; workflow_dispatch:refs/heads/dev:true) channel="latest" ;;
push:refs/heads/beta:false | workflow_dispatch:refs/heads/beta:false) channel="beta" ;; push:refs/heads/beta:false | workflow_dispatch:refs/heads/beta:false) channel="beta" ;;
pull_request:*:false) channel="pr" ;; pull_request:*:false) channel="pr" ;;
@ -27,11 +27,9 @@ fi
if [ "$channel" = latest ]; then if [ "$channel" = latest ]; then
actor=${GITHUB_TRIGGERING_ACTOR:-${GITHUB_ACTOR:-}} actor=${GITHUB_TRIGGERING_ACTOR:-${GITHUB_ACTOR:-}}
[ -n "$actor" ] || die "Stable releases can only be started by releasers; the triggering actor is unknown" [ -n "$actor" ] || die "Stable releases can only be started by releasers; the triggering actor is unknown"
role=$(gh api "repos/$GITHUB_REPOSITORY/collaborators/$actor/permission" --jq .role_name) || role="" if ! (shopt -s nocasematch; [[ "$actor" = thdxr || "$actor" = Hona || "$actor" = rekram1-node ]]); then
case "$role" in die "$actor is not allowed to start stable releases"
admin | maintain) ;; fi
*) die "Stable releases can only be started by releasers (admin or maintain on the repo); $actor has ${role:-no readable role}" ;;
esac
fi fi
if [ "$channel" = latest ] && [ -n "${INPUT_VERSION:-}" ]; then if [ "$channel" = latest ] && [ -n "${INPUT_VERSION:-}" ]; then

View file

@ -24,7 +24,13 @@ feed() {
done | jq -s --arg date "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" '{files: ., releaseDate: $date}' done | jq -s --arg date "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" '{files: ., releaseDate: $date}'
} }
files=$(upload_files "${win[@]}" "${mac[@]}" "${linux[@]}" "${linux_arm[@]}" "${bundles[@]}") # electron-updater fetches <file>.blockmap next to the Windows installer and the macOS zip for a differential
# download. Signing changes these files, so the blockmaps electron-builder made at pack time no longer match.
differential=("${win[@]}" "$macos/opencode-desktop-mac-arm64.zip" "$macos/opencode-desktop-mac-x64.zip")
node "$release_dir/blockmap.mjs" "${differential[@]}"
blockmaps=("${differential[@]/%/.blockmap}")
files=$(upload_files "${win[@]}" "${mac[@]}" "${linux[@]}" "${linux_arm[@]}" "${bundles[@]}" "${blockmaps[@]}")
manifests=$(jq -n --argjson win "$(feed "${win[@]}")" --argjson mac "$(feed "${mac[@]}")" \ manifests=$(jq -n --argjson win "$(feed "${win[@]}")" --argjson mac "$(feed "${mac[@]}")" \
--argjson linux "$(feed "${linux[@]}")" --argjson linux_arm64 "$(feed "${linux_arm[@]}")" \ --argjson linux "$(feed "${linux[@]}")" --argjson linux_arm64 "$(feed "${linux_arm[@]}")" \
'{"desktop.yml": $win, "desktop-mac.yml": $mac, "desktop-linux.yml": $linux, "desktop-linux-arm64.yml": $linux_arm64}') '{"desktop.yml": $win, "desktop-mac.yml": $mac, "desktop-linux.yml": $linux, "desktop-linux-arm64.yml": $linux_arm64}')

View file

@ -6,7 +6,8 @@
tag="v$OPENCODE_VERSION" tag="v$OPENCODE_VERSION"
payload=$(jq -n --arg tag "$tag" --arg notes "${OPENCODE_RELEASE_NOTES:-}" \ payload=$(jq -n --arg tag "$tag" --arg notes "${OPENCODE_RELEASE_NOTES:-}" \
--arg url "https://github.com/$GITHUB_REPOSITORY/releases/tag/$tag" ' --arg url "https://github.com/$GITHUB_REPOSITORY/releases/tag/$tag" '
($notes | if length > 4000 then .[:4000] + "\n\n[Full release notes](\($url))" else . end) as $description | ($notes | gsub("(?m)^#{4,6}[ \\t]+(?<heading>[^\\r\\n]+)"; "**\(.heading)**") |
if length > 4000 then .[:4000] + "\n\n[Full release notes](\($url))" else . end) as $description |
{ {
allowed_mentions: {parse: []}, allowed_mentions: {parse: []},
embeds: [{title: "OpenCode V2 \($tag)", url: $url, description: $description, color: 2829099}] embeds: [{title: "OpenCode V2 \($tag)", url: $url, description: $description, color: 2829099}]

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
. "$(dirname "$0")/lib.sh"
version=${GITHUB_REF_NAME#process-daemon-v}
[[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?$ ]] || die 'Invalid daemon version'
registry=https://registry.npmjs.org
# Validate every package before the first write. Publish the dispatcher last.
packages=(pty-darwin-{arm64,x64} pty-linux-{arm64,x64}-{gnu,musl} pty-win32-{arm64,x64} pty)
for package in "${packages[@]}"; do
file="$1/opencode-$package-$version.tgz"
tar -xOzf "$file" package/package.json | jq -es --arg name "@opencode/$package" --arg version "$version" '
length == 1 and (.[0] | .name == $name and .version == $version and
((.publishConfig // {}) | del(.access) == {}))' >/dev/null || die "Unexpected manifest for $package"
done
for package in "${packages[@]}"; do
if ! npm view --registry="$registry" "@opencode/$package@$version" version >/dev/null 2>&1; then
npm publish --registry="$registry" --ignore-scripts --access public --provenance "$1/opencode-$package-$version.tgz"
fi
done

View file

@ -5,6 +5,16 @@
. "$(dirname "$0")/lib.sh" . "$(dirname "$0")/lib.sh"
tag="v$OPENCODE_VERSION" tag="v$OPENCODE_VERSION"
if ! dry_run; then
umask 077
ssh_dir=$(mktemp -d)
trap 'rm -rf "$ssh_dir"' EXIT
printf '%s\n' "$RELEASE_TAG_KEY" > "$ssh_dir/key"
unset RELEASE_TAG_KEY
echo 'github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl' > "$ssh_dir/known_hosts"
export GIT_SSH_COMMAND="ssh -i $ssh_dir/key -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$ssh_dir/known_hosts"
git remote set-url origin git@github.com:anomalyco/opencode.git
fi
# @opencode/pty is versioned separately, by process-daemon-v<version> tags. # @opencode/pty is versioned separately, by process-daemon-v<version> tags.
git ls-files -z -- '*package.json' bun.lock ':!packages/process-daemon/**' | xargs -0 sed -i -E "s/\"version\": \"[^\"]+\"/\"version\": \"$OPENCODE_VERSION\"/g" git ls-files -z -- '*package.json' bun.lock ':!packages/process-daemon/**' | xargs -0 sed -i -E "s/\"version\": \"[^\"]+\"/\"version\": \"$OPENCODE_VERSION\"/g"
@ -37,5 +47,5 @@ if [ -n "$existing" ]; then
echo "sha=$existing" >> "$GITHUB_OUTPUT" echo "sha=$existing" >> "$GITHUB_OUTPUT"
exit 0 exit 0
fi fi
git push -q origin "HEAD:refs/tags/$tag" if ! dry_run; then git push -q origin "HEAD:refs/tags/$tag"; fi
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

View file

@ -3,25 +3,25 @@
"compatibilityDate": "2026-07-25", "compatibilityDate": "2026-07-25",
"compatibilityFlags": ["nodejs_compat"], "compatibilityFlags": ["nodejs_compat"],
"triggers": [ "triggers": [
{ "type": "fetch", "pattern": "dev.opencode.ai/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/en/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/en/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/zh/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/zh/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/zht/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/zht/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/ko/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/ko/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/de/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/de/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/es/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/es/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/fr/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/fr/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/it/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/it/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/da/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/da/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/ja/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/ja/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/pl/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/pl/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/ru/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/ru/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/uk/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/uk/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/ar/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/ar/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/no/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/no/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/br/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/br/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/th/data*", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai/th/data*", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/tr/data*", "zone": "opencode.ai" } { "type": "fetch", "pattern": "dev.opencode.ai/tr/data*", "zone": "dev.opencode.ai" }
], ],
"observability": { "enabled": true }, "observability": { "enabled": true },
"workersDev": false, "workersDev": false,

View file

@ -11,10 +11,10 @@
"harfbuzz.wasm": { "type": "wasm" }, "harfbuzz.wasm": { "type": "wasm" },
"satori-layout.wasm": { "type": "wasm" }, "satori-layout.wasm": { "type": "wasm" },
"resvg.wasm": { "type": "wasm" }, "resvg.wasm": { "type": "wasm" },
"opentui-mono-regular-rest.bin": { "type": "data" }, "openmono-regular-rest.bin": { "type": "data" },
"opentui-mono-regular-latin.bin": { "type": "data" }, "openmono-regular-latin.bin": { "type": "data" },
"opentui-mono-bold-rest.bin": { "type": "data" }, "openmono-bold-rest.bin": { "type": "data" },
"opentui-mono-bold-latin.bin": { "type": "data" } "openmono-bold-latin.bin": { "type": "data" }
} }
} }
} }

View file

@ -1,4 +1,4 @@
{ {
"accountId": "15d29c8639fd3733b1b5486a2acfd968", "accountId": "d8e944f537ceef3f06a5bd3aec1d7a53",
"buildContext": { "isPreview": false, "mode": "dev" } "buildContext": { "isPreview": false, "mode": "dev" }
} }

View file

@ -18,6 +18,7 @@
"exportName": "DataSyncWorkflow" "exportName": "DataSyncWorkflow"
}, },
"STAGE": { "type": "text", "value": "dev" }, "STAGE": { "type": "text", "value": "dev" },
"R2_SQL_ACCOUNT_ID": { "type": "text", "value": "d8e944f537ceef3f06a5bd3aec1d7a53" },
"DATA_DATABASE_HOST": { "type": "secret" }, "DATA_DATABASE_HOST": { "type": "secret" },
"DATA_DATABASE_USERNAME": { "type": "secret" }, "DATA_DATABASE_USERNAME": { "type": "secret" },
"DATA_DATABASE_PASSWORD": { "type": "secret" }, "DATA_DATABASE_PASSWORD": { "type": "secret" },

View file

@ -11,10 +11,10 @@
"harfbuzz.wasm": { "type": "wasm" }, "harfbuzz.wasm": { "type": "wasm" },
"satori-layout.wasm": { "type": "wasm" }, "satori-layout.wasm": { "type": "wasm" },
"resvg.wasm": { "type": "wasm" }, "resvg.wasm": { "type": "wasm" },
"opentui-mono-regular-rest.bin": { "type": "data" }, "openmono-regular-rest.bin": { "type": "data" },
"opentui-mono-regular-latin.bin": { "type": "data" }, "openmono-regular-latin.bin": { "type": "data" },
"opentui-mono-bold-rest.bin": { "type": "data" }, "openmono-bold-rest.bin": { "type": "data" },
"opentui-mono-bold-latin.bin": { "type": "data" } "openmono-bold-latin.bin": { "type": "data" }
} }
} }
} }

View file

@ -1,11 +1,12 @@
{ {
"name": "opencode-dev-files", "name": "opencode-dev-files",
"account_id": "d8e944f537ceef3f06a5bd3aec1d7a53",
"main": "index.js", "main": "index.js",
"no_bundle": true, "no_bundle": true,
"compatibility_date": "2026-08-01", "compatibility_date": "2026-08-01",
"workers_dev": false, "workers_dev": false,
"preview_urls": false, "preview_urls": false,
"vars": { "STAGE": "dev" }, "vars": { "STAGE": "dev" },
"routes": [{ "pattern": "dev.opencode.ai/files/*", "zone_name": "opencode.ai" }], "routes": [{ "pattern": "dev.opencode.ai/files/*", "zone_name": "dev.opencode.ai" }],
"r2_buckets": [{ "binding": "FILES", "bucket_name": "opencode-dev-files" }] "r2_buckets": [{ "binding": "FILES", "bucket_name": "opencode-dev-files" }]
} }

View file

@ -1,4 +1,4 @@
{ {
"accountId": "15d29c8639fd3733b1b5486a2acfd968", "accountId": "d8e944f537ceef3f06a5bd3aec1d7a53",
"buildContext": { "isPreview": false, "mode": "dev" } "buildContext": { "isPreview": false, "mode": "dev" }
} }

View file

@ -3,14 +3,10 @@
"compatibilityDate": "2026-07-25", "compatibilityDate": "2026-07-25",
"compatibilityFlags": ["nodejs_compat"], "compatibilityFlags": ["nodejs_compat"],
"domains": ["dev.opncd.ai", "api.dev.opencode.ai"], "domains": ["dev.opncd.ai", "api.dev.opencode.ai"],
"logpush": true, "logpush": false,
"observability": { "enabled": true }, "observability": { "enabled": true },
"workersDev": false, "workersDev": false,
"previewUrls": false, "previewUrls": false,
"env": {
"GITHUB_APP_ID": { "type": "secret" },
"GITHUB_APP_PRIVATE_KEY": { "type": "secret" }
},
"manifest": { "manifest": {
"type": "complete", "type": "complete",
"mainModule": "index.js", "mainModule": "index.js",

View file

@ -1,4 +1,4 @@
{ {
"accountId": "15d29c8639fd3733b1b5486a2acfd968", "accountId": "d8e944f537ceef3f06a5bd3aec1d7a53",
"buildContext": { "isPreview": false, "mode": "dev" } "buildContext": { "isPreview": false, "mode": "dev" }
} }

View file

@ -19,13 +19,64 @@
"!/v1/docs/assets/*", "!/v1/docs/assets/*",
"!/v1/docs/pagefind/*", "!/v1/docs/pagefind/*",
"!/v1/docs/llms.txt", "!/v1/docs/llms.txt",
"!/v1/docs/theme.json" "!/v1/docs/theme.json",
"/zh/docs",
"/zh/docs/*",
"!/zh/docs/pagefind/*",
"/zht/docs",
"/zht/docs/*",
"!/zht/docs/pagefind/*",
"/ko/docs",
"/ko/docs/*",
"!/ko/docs/pagefind/*",
"/de/docs",
"/de/docs/*",
"!/de/docs/pagefind/*",
"/es/docs",
"/es/docs/*",
"!/es/docs/pagefind/*",
"/fr/docs",
"/fr/docs/*",
"!/fr/docs/pagefind/*",
"/it/docs",
"/it/docs/*",
"!/it/docs/pagefind/*",
"/da/docs",
"/da/docs/*",
"!/da/docs/pagefind/*",
"/ja/docs",
"/ja/docs/*",
"!/ja/docs/pagefind/*",
"/pl/docs",
"/pl/docs/*",
"!/pl/docs/pagefind/*",
"/ru/docs",
"/ru/docs/*",
"!/ru/docs/pagefind/*",
"/uk/docs",
"/uk/docs/*",
"!/uk/docs/pagefind/*",
"/ar/docs",
"/ar/docs/*",
"!/ar/docs/pagefind/*",
"/no/docs",
"/no/docs/*",
"!/no/docs/pagefind/*",
"/br/docs",
"/br/docs/*",
"!/br/docs/pagefind/*",
"/th/docs",
"/th/docs/*",
"!/th/docs/pagefind/*",
"/tr/docs",
"/tr/docs/*",
"!/tr/docs/pagefind/*"
] ]
}, },
"domains": ["dev.opencode.ai", "docs.dev.opencode.ai"], "domains": ["dev.opencode.ai", "docs.dev.opencode.ai"],
"triggers": [ "triggers": [
{ "type": "fetch", "pattern": "dev.opencode.ai", "zone": "opencode.ai" }, { "type": "fetch", "pattern": "dev.opencode.ai", "zone": "dev.opencode.ai" },
{ "type": "fetch", "pattern": "dev.opencode.ai/*", "zone": "opencode.ai" } { "type": "fetch", "pattern": "dev.opencode.ai/*", "zone": "dev.opencode.ai" }
], ],
"observability": { "enabled": true }, "observability": { "enabled": true },
"workersDev": false, "workersDev": false,

View file

@ -19,7 +19,58 @@
"!/v1/docs/assets/*", "!/v1/docs/assets/*",
"!/v1/docs/pagefind/*", "!/v1/docs/pagefind/*",
"!/v1/docs/llms.txt", "!/v1/docs/llms.txt",
"!/v1/docs/theme.json" "!/v1/docs/theme.json",
"/zh/docs",
"/zh/docs/*",
"!/zh/docs/pagefind/*",
"/zht/docs",
"/zht/docs/*",
"!/zht/docs/pagefind/*",
"/ko/docs",
"/ko/docs/*",
"!/ko/docs/pagefind/*",
"/de/docs",
"/de/docs/*",
"!/de/docs/pagefind/*",
"/es/docs",
"/es/docs/*",
"!/es/docs/pagefind/*",
"/fr/docs",
"/fr/docs/*",
"!/fr/docs/pagefind/*",
"/it/docs",
"/it/docs/*",
"!/it/docs/pagefind/*",
"/da/docs",
"/da/docs/*",
"!/da/docs/pagefind/*",
"/ja/docs",
"/ja/docs/*",
"!/ja/docs/pagefind/*",
"/pl/docs",
"/pl/docs/*",
"!/pl/docs/pagefind/*",
"/ru/docs",
"/ru/docs/*",
"!/ru/docs/pagefind/*",
"/uk/docs",
"/uk/docs/*",
"!/uk/docs/pagefind/*",
"/ar/docs",
"/ar/docs/*",
"!/ar/docs/pagefind/*",
"/no/docs",
"/no/docs/*",
"!/no/docs/pagefind/*",
"/br/docs",
"/br/docs/*",
"!/br/docs/pagefind/*",
"/th/docs",
"/th/docs/*",
"!/th/docs/pagefind/*",
"/tr/docs",
"/tr/docs/*",
"!/tr/docs/pagefind/*"
] ]
}, },
"domains": ["opencode.ai", "docs.opencode.ai"], "domains": ["opencode.ai", "docs.opencode.ai"],

21
.github/release/with-secrets.sh vendored Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Fetch only this command's named secrets; keep credentials out of its environment.
. "$(dirname "$0")/lib.sh"
set +x
while [[ $# -gt 0 && $1 != -- ]]; do
name=${1%%=*} id=${1#*=}
[[ $name =~ ^[A-Z][A-Z0-9_]*$ && $id != "$1" && -n $id ]] || die 'Expected NAME=secret-id'
if ! dry_run; then
value=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "$id" --query SecretString --output text)
[[ -n $value && $value != None ]] || die "Empty secret: $id"
while IFS= read -r line; do
[[ -z $line ]] || printf '::add-mask::%s\n' "${line//%/%25}"
done <<< "$value"
export "$name=$value"
fi
shift
done
[[ ${1:-} == -- && $# -gt 1 ]] || die 'Expected -- command'
shift
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN value
exec "$@"

View file

@ -0,0 +1,70 @@
name: backfill-blockmaps
# Uploads the .blockmap files electron-updater needs for a differential update next to desktop releases that
# shipped without them (2.2.0 through 2.4.1). Like release.yml's publish jobs, it runs in the release environment,
# checks out only .github/release/ and treats the published files as data; releasers only.
on:
workflow_dispatch:
inputs:
versions:
description: "Space-separated stable versions, such as 2.4.0 2.4.1"
required: true
type: string
dry_run:
description: "Build the blockmaps without uploading them"
required: false
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: read
jobs:
backfill:
if: github.repository == 'anomalyco/opencode' && github.ref == 'refs/heads/dev'
runs-on: ubuntu-24.04
environment: release
permissions:
contents: read
id-token: write
env:
OPENCODE_DRY_RUN: ${{ inputs.dry_run }}
steps:
- name: Check out release scripts
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.sha }}
sparse-checkout: /.github/release/
sparse-checkout-cone-mode: false
persist-credentials: false
- id: aws
name: Configure AWS credentials
if: inputs.dry_run != true
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
output-env-credentials: false
output-credentials: true
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Cloudflare token
id: cloudflare-token
if: inputs.dry_run != true
run: bash .github/release/cloudflare-token.sh
env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
- name: Backfill
run: |
read -ra versions <<< "$VERSIONS"
bash .github/release/backfill-blockmaps.sh "${versions[@]}"
env:
VERSIONS: ${{ inputs.versions }}
CLOUDFLARE_ACCOUNT_ID: 15d29c8639fd3733b1b5486a2acfd968
CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }}

View file

@ -45,7 +45,7 @@ jobs:
- system: aarch64-linux - system: aarch64-linux
runner: blacksmith-4vcpu-ubuntu-2404-arm runner: blacksmith-4vcpu-ubuntu-2404-arm
- system: aarch64-darwin - system: aarch64-darwin
runner: macos-latest runner: blacksmith-6vcpu-macos-latest
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
steps: steps:

51
.github/workflows/check-cli-rs.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: check-cli-rs
# Checks packages/cli-rs, the Rust client, which check-test.yml leaves out. Pull requests run it only when they change
# the client. Its tests and check:drift also compare it with the TypeScript packages below, so a dev push that changes
# one runs it too: a TypeScript change that breaks the client shows on dev, not on other teams' pull requests.
on:
pull_request:
paths:
- packages/cli-rs/**
- .github/workflows/check-cli-rs.yml
push:
branches: [dev]
paths:
- packages/cli-rs/**
- packages/cli/src/**
- packages/client/**
- packages/plugin/**
- packages/protocol/**
- packages/schema/**
- packages/theme/**
- packages/tui/**
- packages/util/**
- bun.lock
- .github/workflows/check-cli-rs.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 45
defaults:
run:
working-directory: packages/cli-rs
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
# Bun and node_modules: the tests and check:drift run the TypeScript side they compare against.
- uses: ./.github/actions/setup-bun
# rustup reads rust-toolchain.toml; `bun run cargo` first fetches OpenTUI's native library from its release.
- run: rustup toolchain install
- run: bun run cargo fmt --check
- run: bun run cargo clippy --locked --workspace --all-targets -- -D warnings
# Every crate's tests, even after one fails, so one run shows every failure.
- run: bun run cargo test --locked --workspace --no-fail-fast
- run: bun run check:drift

View file

@ -4,11 +4,13 @@ on:
pull_request: pull_request:
paths: paths:
- packages/process-daemon/** - packages/process-daemon/**
- .github/actions/prefetch-ghostty/**
- .github/workflows/check-process-daemon.yml - .github/workflows/check-process-daemon.yml
push: push:
branches: [dev] branches: [dev]
paths: paths:
- packages/process-daemon/** - packages/process-daemon/**
- .github/actions/prefetch-ghostty/**
- .github/workflows/check-process-daemon.yml - .github/workflows/check-process-daemon.yml
workflow_dispatch: workflow_dispatch:
@ -53,12 +55,14 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-22.04, macos-15] os: [ubuntu-22.04, blacksmith-6vcpu-macos-15]
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
with: with:
version: 0.16.0 version: 0.16.0
use-cache: false
- uses: ./.github/actions/prefetch-ghostty
- name: Install Rust - name: Install Rust
run: rustup toolchain install 1.90.0 --profile minimal --component rustfmt --component clippy run: rustup toolchain install 1.90.0 --profile minimal --component rustfmt --component clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
@ -79,7 +83,7 @@ jobs:
windows: windows:
name: Windows (${{ matrix.arch }}) name: Windows (${{ matrix.arch }})
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
timeout-minutes: 30 timeout-minutes: 45
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -109,7 +113,7 @@ jobs:
if: matrix.arch == 'x64' if: matrix.arch == 'x64'
with: with:
version: 0.16.0 version: 0.16.0
cache-key: ${{ matrix.target }} use-cache: false
# Zig 0.16 crashes when building Ghostty on the native ARM64 host. # Zig 0.16 crashes when building Ghostty on the native ARM64 host.
# Use x64-hosted compilers on this ARM64 runner, but execute ARM64 tests natively. # Use x64-hosted compilers on this ARM64 runner, but execute ARM64 tests natively.
- name: Install x64 Zig for ARM64 cross-compilation - name: Install x64 Zig for ARM64 cross-compilation
@ -130,6 +134,33 @@ jobs:
$old = '@ptrCast(try si.loadNtdllProc(@tagName(proc)))' $old = '@ptrCast(try si.loadNtdllProc(@tagName(proc)))'
if (!$source.Contains($old)) { throw 'Zig alignment workaround no longer matches; re-evaluate it' } if (!$source.Contains($old)) { throw 'Zig alignment workaround no longer matches; re-evaluate it' }
[System.IO.File]::WriteAllText($file, $source.Replace($old, '@ptrCast(@alignCast(try si.loadNtdllProc(@tagName(proc))))')) [System.IO.File]::WriteAllText($file, $source.Replace($old, '@ptrCast(@alignCast(try si.loadNtdllProc(@tagName(proc))))'))
- name: Pin MSVC 14.51 for Zig's Clang 21
timeout-minutes: 20
run: |
$installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer"
$vs = & "$installer\vswhere.exe" -latest -products * -property installationPath
$tools = "$vs\VC\Tools\MSVC"
$arch = '${{ matrix.arch }}'
$hasRuntimes = {
(Test-Path "$($_.FullName)\lib\x64\vcruntime.lib") -and
(Test-Path "$($_.FullName)\lib\$arch\vcruntime.lib")
}
if (!(Get-ChildItem $tools -Directory -Filter '14.51.*' | Where-Object $hasRuntimes)) {
$components = '--add Microsoft.VisualStudio.Component.VC.14.51.x86.x64'
if ($arch -eq 'arm64') { $components += ' --add Microsoft.VisualStudio.Component.VC.14.51.ARM64' }
$setup = Start-Process "$installer\setup.exe" -ArgumentList "modify --installPath `"$vs`" $components --quiet --norestart" -Wait -PassThru
if ($setup.ExitCode -notin 0, 3010) { throw "VS installer exited with $($setup.ExitCode)" }
Write-Output "MSVC 14.51 installer exited with $($setup.ExitCode) for $arch"
}
$toolset = Get-ChildItem $tools -Directory -Filter '14.51.*' |
Where-Object $hasRuntimes |
Sort-Object { [version]$_.Name } -Descending | Select-Object -First 1
if (!$toolset) { throw "Missing MSVC 14.51 for $arch" }
# Zig reads this file for both host and target tools on the disposable runner.
Set-Content "$vs\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" $toolset.Name -Encoding ascii
$libc = zig libc
$libc
if ($LASTEXITCODE -ne 0 -or $libc -inotcontains "sys_include_dir=$($toolset.FullName)\include") { throw 'Zig selected unexpected MSVC headers' }
- name: Install Rust toolchain and target - name: Install Rust toolchain and target
run: rustup toolchain install $env:RUSTUP_TOOLCHAIN --force-non-host --profile minimal --component rustfmt --component clippy --target $env:CARGO_BUILD_TARGET run: rustup toolchain install $env:RUSTUP_TOOLCHAIN --force-non-host --profile minimal --component rustfmt --component clippy --target $env:CARGO_BUILD_TARGET
- name: Verify runner and compiler architecture - name: Verify runner and compiler architecture
@ -145,6 +176,7 @@ jobs:
if ($compiler -notcontains 'host: x86_64-pc-windows-msvc') { throw 'Unexpected Rust compiler host' } if ($compiler -notcontains 'host: x86_64-pc-windows-msvc') { throw 'Unexpected Rust compiler host' }
Write-Output "Executable target: $env:CARGO_BUILD_TARGET" Write-Output "Executable target: $env:CARGO_BUILD_TARGET"
zig version zig version
- uses: ./.github/actions/prefetch-ghostty
# No cache-on-failure: a timed-out run once saved a partial cache that broke re-runs. # No cache-on-failure: a timed-out run once saved a partial cache that broke re-runs.
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
with: with:

View file

@ -106,7 +106,7 @@ jobs:
# It is a step output, so only the Deploy step gets it. # It is a step output, so only the Deploy step gets it.
- name: Cloudflare token - name: Cloudflare token
id: cloudflare-token id: cloudflare-token
run: bash .github/release/cloudflare-token.sh run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME"
env: env:
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}

View file

@ -99,7 +99,7 @@ jobs:
# It is a step output, so only the Deploy step gets it. # It is a step output, so only the Deploy step gets it.
- name: Cloudflare token - name: Cloudflare token
id: cloudflare-token id: cloudflare-token
run: bash .github/release/cloudflare-token.sh run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME"
env: env:
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}

View file

@ -96,7 +96,7 @@ jobs:
# It is a step output, so only the Deploy step gets it. # It is a step output, so only the Deploy step gets it.
- name: Cloudflare token - name: Cloudflare token
id: cloudflare-token id: cloudflare-token
run: bash .github/release/cloudflare-token.sh run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME"
env: env:
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
@ -109,11 +109,14 @@ jobs:
# An explicit bash runs with pipefail, so a failed secret read fails the step. # An explicit bash runs with pipefail, so a failed secret read fails the step.
shell: bash shell: bash
run: | run: |
if [[ "$STAGE" == dev ]]; then
exec bash .github/release/deploy-legacy.sh dev "$RUNNER_TEMP/in/legacy-dev"
fi
umask 077 umask 077
secrets="$RUNNER_TEMP/legacy-secrets.json" secrets="$RUNNER_TEMP/legacy-secrets.json"
trap 'rm -f "$secrets"' EXIT trap 'rm -f "$secrets"' EXIT
for name in GITHUB_APP_ID GITHUB_APP_PRIVATE_KEY; do for name in GITHUB_APP_ID GITHUB_APP_PRIVATE_KEY; do
aws secretsmanager get-secret-value --secret-id "opencode/$STAGE/$name" --output json | aws secretsmanager get-secret-value --secret-id "opencode/production/$name" --output json |
jq --arg name "$name" '{($name): .SecretString}' jq --arg name "$name" '{($name): .SecretString}'
done | jq -s add > "$secrets" done | jq -s add > "$secrets"
bash .github/release/deploy-legacy.sh "$STAGE" "$RUNNER_TEMP/in/legacy-$STAGE" "$secrets" bash .github/release/deploy-legacy.sh "$STAGE" "$RUNNER_TEMP/in/legacy-$STAGE" "$secrets"
@ -185,7 +188,7 @@ jobs:
- name: Cloudflare token - name: Cloudflare token
id: cloudflare-token id: cloudflare-token
run: bash .github/release/cloudflare-token.sh run: bash .github/release/cloudflare-token.sh "$GITHUB_REF_NAME"
env: env:
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}

126
.github/workflows/release-cli-rs.yml vendored Normal file
View file

@ -0,0 +1,126 @@
name: cli-rs release
# Builds opencode-native, the Rust client in packages/cli-rs, natively on each runner below and keeps each archive as an
# artifact. A cli-rs-v<version> tag also publishes them as a GitHub release. It never becomes Latest: the monorepo's
# Latest release drives OpenCode's own update paths.
on:
push:
tags:
- "cli-rs-v*"
pull_request:
paths:
- .github/workflows/release-cli-rs.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# Zig links Linux against glibc 2.17, OpenTUI's floor. zig_sha is the archive's, from ziglang.org.
- runner: ubuntu-24.04
target: x86_64-unknown-linux-gnu
zig: x86_64-linux-gnu.2.17
zig_sha: 3581863e3cbcfd0fce0efc682ce7e9e93da96668a977791d356a26d2a7e9b17a
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
zig: aarch64-linux-gnu.2.17
zig_sha: a1546d5646eb184437918d6635ca6b762a0e889eac09cef720ee7a1ed3fe7795
- { runner: macos-15-intel, target: x86_64-apple-darwin }
- { runner: macos-15, target: aarch64-apple-darwin }
- { runner: windows-2025, target: x86_64-pc-windows-msvc, exe: .exe }
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
defaults:
run:
shell: bash
working-directory: packages/cli-rs
env:
OPENCODE_NATIVE_COMMIT: ${{ github.sha }}
CARGO_PROFILE_DIST_STRIP: symbols
MACOSX_DEPLOYMENT_TARGET: "13.0"
# No Visual C++ runtime to install beside the .exe.
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS: -C target-feature=+crt-static
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version-file: package.json
# The version opencode-native --version prints: the tag's, or 0.0.0-<commit> for any other run.
- name: Version
run: |
version=0.0.0-$GITHUB_SHA
if [[ $GITHUB_REF == refs/tags/cli-rs-v* ]]; then version=${GITHUB_REF_NAME#cli-rs-v}; fi
echo "OPENCODE_VERSION=$version" >> "$GITHUB_ENV"
# Zig 0.17.1 as the C and C++ compiler and the linker. The wrapper drops flags zig rejects: cc's --target, and
# rustc's Cortex-A53 erratum fix on aarch64.
- if: matrix.zig
working-directory: ${{ runner.temp }}
run: |
file=zig-$(uname -m)-linux-0.17.1
curl -fsSL --retry 3 -o zig.tar.xz "https://ziglang.org/download/0.17.1/$file.tar.xz"
echo "${{ matrix.zig_sha }} zig.tar.xz" | sha256sum -c
tar -xJf zig.tar.xz
for tool in cc c++; do
cat > "zig-$tool" <<EOF
#!/bin/sh
for a; do shift; case \$a in --target=*|-Wl,--fix-cortex-a53-843419) ;; *) set -- "\$@" "\$a" ;; esac; done
exec "$PWD/$file/zig" $tool -target ${{ matrix.zig }} "\$@"
EOF
chmod +x "zig-$tool"
done
triple=$(tr a-z- A-Z_ <<< "${{ matrix.target }}")
{ echo "CARGO_TARGET_${triple}_LINKER=$PWD/zig-cc"; echo "CC_${triple,,}=$PWD/zig-cc"
echo "CXX_${triple,,}=$PWD/zig-c++"; echo "CXXSTDLIB_${triple,,}=c++"; } >> "$GITHUB_ENV"
# rustup reads rust-toolchain.toml; `bun run cargo` first fetches OpenTUI's native library from its release.
- run: rustup toolchain install
- run: bun run cargo build --locked --profile dist --bin opencode-native
- name: Check glibc 2.17 and no libstdc++
if: matrix.zig
run: "! readelf -dV target/dist/opencode-native | grep -E 'GLIBC_2\\.(1[89]|[2-9][0-9])|libstdc\\+\\+'"
- name: Package
run: |
name=opencode-native-$OPENCODE_VERSION-${{ matrix.target }}
mkdir -p "dist/$name"
cp "target/dist/opencode-native${{ matrix.exe }}" "dist/$name/"
# Our licence, and OpenTUI's licences (FFmpeg's among them) from its native release zip.
cp ../../LICENSE "dist/$name/"
cp -r .opentui/*/host/licenses "dist/$name/"
tar -C dist -czf "dist/$name.tar.gz" "$name"
ls -l "dist/$name" "dist/$name.tar.gz"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: opencode-native-${{ matrix.target }}
path: packages/cli-rs/dist/*.tar.gz
if-no-files-found: error
compression-level: 0
release:
needs: build
if: startsWith(github.ref, 'refs/tags/cli-rs-v')
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: opencode-native-*
merge-multiple: true
- name: Publish
env:
GH_TOKEN: ${{ github.token }}
run: |
sha256sum ./*.tar.gz > SHA256SUMS
gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag --latest=false \
--title "opencode-native ${GITHUB_REF_NAME#cli-rs-v}" --notes "The Rust client (packages/cli-rs) at $GITHUB_SHA." \
./*.tar.gz SHA256SUMS

View file

@ -10,8 +10,10 @@ on:
- "process-daemon-v*" - "process-daemon-v*"
pull_request: pull_request:
paths: paths:
- .github/actions/prefetch-ghostty/**
- .github/workflows/release-process-daemon.yml - .github/workflows/release-process-daemon.yml
- packages/process-daemon/build.rs - packages/process-daemon/build.rs
- packages/process-daemon/ghostty-revision
- packages/process-daemon/npm/** - packages/process-daemon/npm/**
- packages/process-daemon/script/npm-packages.mjs - packages/process-daemon/script/npm-packages.mjs
workflow_dispatch: workflow_dispatch:
@ -39,6 +41,8 @@ jobs:
- uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
with: with:
version: ${{ env.ZIG_VERSION }} version: ${{ env.ZIG_VERSION }}
use-cache: false
- uses: ./.github/actions/prefetch-ghostty
- name: Configure baseline Zig builds - name: Configure baseline Zig builds
run: | run: |
chmod +x "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin/zig" chmod +x "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin/zig"
@ -83,7 +87,7 @@ jobs:
musl: true musl: true
- runner: macos-15-intel - runner: macos-15-intel
target: x86_64-apple-darwin target: x86_64-apple-darwin
- runner: macos-15 - runner: blacksmith-6vcpu-macos-15
target: aarch64-apple-darwin target: aarch64-apple-darwin
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
env: env:
@ -94,7 +98,8 @@ jobs:
- uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5 - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
with: with:
version: ${{ env.ZIG_VERSION }} version: ${{ env.ZIG_VERSION }}
cache-key: ${{ matrix.target }} use-cache: false
- uses: ./.github/actions/prefetch-ghostty
- name: Configure baseline Zig builds - name: Configure baseline Zig builds
run: | run: |
chmod +x "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin/zig" chmod +x "$GITHUB_WORKSPACE/packages/process-daemon/script/release-bin/zig"
@ -187,7 +192,7 @@ jobs:
if: matrix.arch == 'x64' if: matrix.arch == 'x64'
with: with:
version: ${{ env.ZIG_VERSION }} version: ${{ env.ZIG_VERSION }}
cache-key: release-${{ matrix.target }} use-cache: false
# Zig 0.16 crashes when building Ghostty on the native ARM64 host, so use # Zig 0.16 crashes when building Ghostty on the native ARM64 host, so use
# the x64-hosted compiler there (matching check-process-daemon.yml). # the x64-hosted compiler there (matching check-process-daemon.yml).
- name: Install x64 Zig for ARM64 cross-compilation - name: Install x64 Zig for ARM64 cross-compilation
@ -206,8 +211,36 @@ jobs:
$old = '@ptrCast(try si.loadNtdllProc(@tagName(proc)))' $old = '@ptrCast(try si.loadNtdllProc(@tagName(proc)))'
if (!$source.Contains($old)) { throw 'Zig alignment workaround no longer matches; re-evaluate it' } if (!$source.Contains($old)) { throw 'Zig alignment workaround no longer matches; re-evaluate it' }
[System.IO.File]::WriteAllText($file, $source.Replace($old, '@ptrCast(@alignCast(try si.loadNtdllProc(@tagName(proc))))')) [System.IO.File]::WriteAllText($file, $source.Replace($old, '@ptrCast(@alignCast(try si.loadNtdllProc(@tagName(proc))))'))
- name: Pin MSVC 14.51 for Zig's Clang 21
timeout-minutes: 20
run: |
$installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer"
$vs = & "$installer\vswhere.exe" -latest -products * -property installationPath
$tools = "$vs\VC\Tools\MSVC"
$arch = '${{ matrix.arch }}'
$hasRuntimes = {
(Test-Path "$($_.FullName)\lib\x64\vcruntime.lib") -and
(Test-Path "$($_.FullName)\lib\$arch\vcruntime.lib")
}
if (!(Get-ChildItem $tools -Directory -Filter '14.51.*' | Where-Object $hasRuntimes)) {
$components = '--add Microsoft.VisualStudio.Component.VC.14.51.x86.x64'
if ($arch -eq 'arm64') { $components += ' --add Microsoft.VisualStudio.Component.VC.14.51.ARM64' }
$setup = Start-Process "$installer\setup.exe" -ArgumentList "modify --installPath `"$vs`" $components --quiet --norestart" -Wait -PassThru
if ($setup.ExitCode -notin 0, 3010) { throw "VS installer exited with $($setup.ExitCode)" }
Write-Output "MSVC 14.51 installer exited with $($setup.ExitCode) for $arch"
}
$toolset = Get-ChildItem $tools -Directory -Filter '14.51.*' |
Where-Object $hasRuntimes |
Sort-Object { [version]$_.Name } -Descending | Select-Object -First 1
if (!$toolset) { throw "Missing MSVC 14.51 for $arch" }
# Zig reads this file for both host and target tools on the disposable runner.
Set-Content "$vs\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" $toolset.Name -Encoding ascii
$libc = zig libc
$libc
if ($LASTEXITCODE -ne 0 -or $libc -inotcontains "sys_include_dir=$($toolset.FullName)\include") { throw 'Zig selected unexpected MSVC headers' }
- name: Install Rust toolchain and target - name: Install Rust toolchain and target
run: rustup toolchain install $env:RUSTUP_TOOLCHAIN --force-non-host --profile minimal --target $env:CARGO_BUILD_TARGET run: rustup toolchain install $env:RUSTUP_TOOLCHAIN --force-non-host --profile minimal --target $env:CARGO_BUILD_TARGET
- uses: ./.github/actions/prefetch-ghostty
- name: Build - name: Build
run: cargo build --locked --release run: cargo build --locked --release
- name: Smoke test - name: Smoke test
@ -246,13 +279,11 @@ jobs:
path: packages/process-daemon/dist/*.tar.gz path: packages/process-daemon/dist/*.tar.gz
if-no-files-found: error if-no-files-found: error
release: package:
needs: [checks, build, build-windows] needs: [checks, build, build-windows]
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
permissions: outputs:
contents: write digest: ${{ steps.upload.outputs.digest }}
id-token: write
attestations: write
env: env:
PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }} PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }}
steps: steps:
@ -261,8 +292,6 @@ jobs:
with: with:
node-version: "24" node-version: "24"
registry-url: https://registry.npmjs.org registry-url: https://registry.npmjs.org
- name: Install npm with trusted publishing support
run: npm install --global npm@^11.5.1
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with: with:
path: packages/process-daemon/dist path: packages/process-daemon/dist
@ -297,35 +326,68 @@ jobs:
npm pack --pack-destination "$temporary" dist/npm/opencode-pty-linux-x64-gnu dist/npm/opencode-pty >/dev/null npm pack --pack-destination "$temporary" dist/npm/opencode-pty-linux-x64-gnu dist/npm/opencode-pty >/dev/null
npm install --prefix "$temporary" --ignore-scripts --no-package-lock --no-audit --no-fund "$temporary"/*.tgz npm install --prefix "$temporary" --ignore-scripts --no-package-lock --no-audit --no-fund "$temporary"/*.tgz
test "$("$temporary/node_modules/.bin/opencode-pty" --version)" = "opencode-pty $(node -p 'require("./npm/package.json").version') (protocol $PROTOCOL_VERSION)" test "$("$temporary/node_modules/.bin/opencode-pty" --version)" = "opencode-pty $(node -p 'require("./npm/package.json").version') (protocol $PROTOCOL_VERSION)"
- uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 - name: Stage release files
if: startsWith(github.ref, 'refs/tags/process-daemon-v') run: |
mkdir -p "$RUNNER_TEMP/bundle/github" "$RUNNER_TEMP/bundle/npm"
cp dist/*.tar.gz dist/release-manifest.json dist/SHA256SUMS "$RUNNER_TEMP/bundle/github/"
for package in dist/npm/*; do
npm pack --ignore-scripts --pack-destination "$RUNNER_TEMP/bundle/npm" "$(realpath "$package")"
done
# The upload action owns the outer SHA256SUMS; include the release checksums in it.
mv "$RUNNER_TEMP/bundle/github/SHA256SUMS" "$RUNNER_TEMP/bundle/github/checksums.txt"
- id: upload
uses: ./.github/release/upload
with: with:
subject-checksums: packages/process-daemon/dist/SHA256SUMS name: process-daemon-bundle
path: ${{ runner.temp }}/bundle
release:
needs: [checks, package]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/process-daemon-v')
runs-on: ubuntu-24.04
environment: process-daemon-release
permissions:
contents: write
id-token: write
attestations: write
defaults:
run:
working-directory: .
env:
PROTOCOL_VERSION: ${{ needs.checks.outputs.protocol }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
sparse-checkout: /.github/release/
sparse-checkout-cone-mode: false
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0; caching opt-in
with:
node-version: '24.11.0'
- uses: ./.github/release/download
with:
pattern: process-daemon-bundle
digests: process-daemon-bundle=${{ needs.package.outputs.digest }}
require-digests: 'true'
- uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-path: |
${{ runner.temp }}/in/process-daemon-bundle/github/*.tar.gz
${{ runner.temp }}/in/process-daemon-bundle/github/release-manifest.json
# The monorepo's Latest release drives OpenCode's own update paths, so this release must never become # The monorepo's Latest release drives OpenCode's own update paths, so this release must never become
# Latest. It is drafted first because immutable releases lock assets once published. # Latest. It is drafted first because immutable releases lock assets once published.
- name: Publish release - name: Publish release
if: startsWith(github.ref, 'refs/tags/process-daemon-v')
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
run: | run: |
cd "$RUNNER_TEMP/in/process-daemon-bundle/github"
mv checksums.txt SHA256SUMS
version="${GITHUB_REF_NAME#process-daemon-v}" version="${GITHUB_REF_NAME#process-daemon-v}"
gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1 || gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1 ||
gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft --verify-tag --latest=false \ gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft --verify-tag --latest=false \
--title "process-daemon v$version" \ --title "process-daemon v$version" \
--notes "opencode-pty $version (protocol $PROTOCOL_VERSION) from packages/process-daemon, published to npm as @opencode/pty@$version." --notes "opencode-pty $version (protocol $PROTOCOL_VERSION) from packages/process-daemon, published to npm as @opencode/pty@$version."
gh release upload "$GITHUB_REF_NAME" dist/*.tar.gz dist/SHA256SUMS dist/release-manifest.json --clobber --repo "$GITHUB_REPOSITORY" gh release upload "$GITHUB_REF_NAME" ./*.tar.gz SHA256SUMS release-manifest.json --clobber --repo "$GITHUB_REPOSITORY"
gh release edit "$GITHUB_REF_NAME" --draft=false --latest=false --repo "$GITHUB_REPOSITORY" gh release edit "$GITHUB_REF_NAME" --draft=false --latest=false --repo "$GITHUB_REPOSITORY"
- name: Publish npm packages - name: Publish npm packages
if: startsWith(github.ref, 'refs/tags/process-daemon-v') run: bash .github/release/publish-process-daemon.sh "$RUNNER_TEMP/in/process-daemon-bundle/npm"
run: |
version="${GITHUB_REF_NAME#process-daemon-v}"
for package in dist/npm/opencode-pty-*; do
name="$(node -p 'require(process.argv[1]).name' "$(realpath "$package/package.json")")"
if ! npm view "$name@$version" version >/dev/null 2>&1; then
npm publish "$package" --access public --provenance
fi
done
name="@opencode/pty"
if ! npm view "$name@$version" version >/dev/null 2>&1; then
npm publish dist/npm/opencode-pty --access public --provenance
fi

View file

@ -16,7 +16,9 @@ run-name: "${{ format('release {0}{1}', inputs.bump, inputs.version) }}"
on: on:
push: push:
branches: [dev, beta] branches: [beta]
schedule:
- cron: "17 */6 * * *"
workflow_dispatch: workflow_dispatch:
inputs: inputs:
bump: bump:
@ -83,8 +85,8 @@ jobs:
# release.yml does not wait for the check-test push run on the same commit, so a stable release would publish # release.yml does not wait for the check-test push run on the same commit, so a stable release would publish
# whatever that run later says. This gate runs the whole suite — unit tests on both OSes, the compiled builds and # whatever that run later says. This gate runs the whole suite — unit tests on both OSes, the compiled builds and
# the Linux browser suites — before any publish job below. Continuous dev and beta builds skip it: they publish # the Linux browser suites — before any publish job below. Dev and beta builds skip it: check-test already
# their own channel from a dev push, whose check-test run covers the same commit. # runs on pushes to those branches.
verify: verify:
needs: plan needs: plan
if: needs.plan.outputs.channel == 'latest' if: needs.plan.outputs.channel == 'latest'
@ -113,33 +115,31 @@ jobs:
outputs: outputs:
sha: ${{ steps.tag.outputs.sha || github.sha }} sha: ${{ steps.tag.outputs.sha || github.sha }}
steps: steps:
# The tag is pushable only with the release deploy key, so without the release environment there is nothing # Fetch the deploy key only for the tag command; checkout uses its read-only token.
# to fetch and the checkout below falls back to the workflow token. - id: aws
- name: Configure AWS credentials name: Configure AWS credentials
if: needs.plan.outputs.channel == 'latest' && needs.plan.outputs.dry_run != 'true' if: needs.plan.outputs.channel == 'latest' && needs.plan.outputs.dry_run != 'true'
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with: with: &release-role
output-env-credentials: false
output-credentials: true
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }} role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1 aws-region: us-east-1
- name: Read release tag key
if: needs.plan.outputs.channel == 'latest' && needs.plan.outputs.dry_run != 'true'
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
with:
secret-ids: RELEASE_TAG_KEY,opencode/release/RELEASE_TAG_KEY
parse-json-secrets: false
- name: Check out - name: Check out
if: needs.plan.outputs.channel == 'latest' if: needs.plan.outputs.channel == 'latest'
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with: with:
ssh-key: ${{ env.RELEASE_TAG_KEY }} persist-credentials: false
- id: tag - id: tag
name: Tag name: Tag
if: needs.plan.outputs.channel == 'latest' if: needs.plan.outputs.channel == 'latest'
run: bash .github/release/tag-release.sh run: bash .github/release/with-secrets.sh RELEASE_TAG_KEY=opencode/release/RELEASE_TAG_KEY -- bash .github/release/tag-release.sh
env: env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }} OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }}
# ---- Build: repository code; no environment, secrets or id-token -------------------------------------------- # ---- Build: repository code; no environment, secrets or id-token --------------------------------------------
@ -212,7 +212,7 @@ jobs:
include: include:
- { target: linux-arm64, host: blacksmith-4vcpu-ubuntu-2404-arm } - { target: linux-arm64, host: blacksmith-4vcpu-ubuntu-2404-arm }
- { target: linux-x64, host: blacksmith-4vcpu-ubuntu-2404 } - { target: linux-x64, host: blacksmith-4vcpu-ubuntu-2404 }
- { target: darwin-arm64, host: macos-26 } - { target: darwin-arm64, host: blacksmith-6vcpu-macos-26 }
- { target: windows-arm64, host: blacksmith-4vcpu-windows-2025 } - { target: windows-arm64, host: blacksmith-4vcpu-windows-2025 }
- { target: windows-x64, host: blacksmith-4vcpu-windows-2025 } - { target: windows-x64, host: blacksmith-4vcpu-windows-2025 }
runs-on: ${{ matrix.host }} runs-on: ${{ matrix.host }}
@ -323,9 +323,9 @@ jobs:
matrix: matrix:
include: include:
- target: darwin-x64 - target: darwin-x64
host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'macos-26' || 'macos-26-intel' }} host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'blacksmith-6vcpu-macos-26' || 'macos-26-intel' }}
install: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && '--os=darwin --cpu=*' || '--os=darwin --cpu=x64' }} install: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && '--os=darwin --cpu=*' || '--os=darwin --cpu=x64' }}
- { target: darwin-arm64, host: macos-26, install: --os=darwin --cpu=arm64 } - { target: darwin-arm64, host: blacksmith-6vcpu-macos-26, install: --os=darwin --cpu=arm64 }
# github-hosted: blacksmith lacks the ARM64 MSVC cross-compilation toolchain # github-hosted: blacksmith lacks the ARM64 MSVC cross-compilation toolchain
- target: windows-arm64 - target: windows-arm64
host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'blacksmith-4vcpu-windows-2025' || 'windows-2025' }} host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'blacksmith-4vcpu-windows-2025' || 'windows-2025' }}
@ -433,45 +433,33 @@ jobs:
uses: ./.github/release/download uses: ./.github/release/download
with: with:
pattern: "{build-npm,build-desktop-darwin-*}" pattern: "{build-npm,build-desktop-darwin-*}"
- name: Configure AWS credentials - &configure-release-role
id: aws
name: Configure AWS credentials
if: needs.plan.outputs.dry_run != 'true' if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with: with: *release-role
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Read signing secrets
if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
with:
secret-ids: |
APPLE_SIGNING_CERTIFICATE,shared/APPLE_SIGNING_CERTIFICATE
APPLE_NOTARY_KEY,shared/APPLE_NOTARY_KEY
parse-json-secrets: false
# The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up # The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up
# the identity in build.keychain, and codesign finds the key through the user search list. # the identity in build.keychain, and codesign finds the key through the user search list.
- name: Import certificate - name: Import certificate
if: needs.plan.outputs.dry_run != 'true' if: needs.plan.outputs.dry_run != 'true'
run: | env: &aws-step
cert="$RUNNER_TEMP/cert.p12" AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
keychain_password=$(openssl rand -base64 32) AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
printf '%s' "$APPLE_SIGNING_CERTIFICATE" | base64 --decode > "$cert" AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
security create-keychain -p "$keychain_password" build.keychain run: bash .github/release/with-secrets.sh APPLE_SIGNING_CERTIFICATE=shared/APPLE_SIGNING_CERTIFICATE -- bash .github/release/import-certificate.sh
security set-keychain-settings -lut 21600 build.keychain
security unlock-keychain -p "$keychain_password" build.keychain
security import "$cert" -k build.keychain -P "" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productsign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null
security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')
rm -f "$cert"
- name: Sign CLI - name: Sign CLI
if: needs.plan.outputs.cli == 'true' if: needs.plan.outputs.cli == 'true'
run: bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out" run: bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out"
- name: Sign desktop - name: Sign desktop
if: needs.plan.outputs.desktop == 'true' if: needs.plan.outputs.desktop == 'true'
run: | run: |
bash .github/release/sign-desktop-macos.sh "$RUNNER_TEMP/out" \ bash .github/release/with-secrets.sh APPLE_NOTARY_KEY=shared/APPLE_NOTARY_KEY -- bash .github/release/sign-desktop-macos.sh "$RUNNER_TEMP/out" \
"$RUNNER_TEMP"/in/build-desktop-darwin-*/opencode-desktop-mac-*.app.tar "$RUNNER_TEMP"/in/build-desktop-darwin-*/opencode-desktop-mac-*.app.tar
env: env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
APPLE_NOTARY_KEY_ID: ${{ vars.APPLE_NOTARY_KEY_ID }} APPLE_NOTARY_KEY_ID: ${{ vars.APPLE_NOTARY_KEY_ID }}
APPLE_NOTARY_ISSUER_ID: ${{ vars.APPLE_NOTARY_ISSUER_ID }} APPLE_NOTARY_ISSUER_ID: ${{ vars.APPLE_NOTARY_ISSUER_ID }}
- id: upload - id: upload
@ -519,6 +507,7 @@ jobs:
if: needs.plan.outputs.dry_run != 'true' if: needs.plan.outputs.dry_run != 'true'
uses: azure/artifact-signing-action@b443cf8ea4124818d2ea9f043cba29fc3ec47b16 # v1.2.0 uses: azure/artifact-signing-action@b443cf8ea4124818d2ea9f043cba29fc3ec47b16 # v1.2.0
with: with:
cache-dependencies: false
endpoint: ${{ vars.AZURE_TRUSTED_SIGNING_ENDPOINT }} endpoint: ${{ vars.AZURE_TRUSTED_SIGNING_ENDPOINT }}
signing-account-name: ${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }} signing-account-name: ${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
certificate-profile-name: ${{ vars.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }} certificate-profile-name: ${{ vars.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
@ -651,18 +640,16 @@ jobs:
steps: steps:
- *checkout-release - *checkout-release
- *download-signed-cli - *download-signed-cli
- name: Configure AWS credentials - *configure-release-role
if: needs.plan.outputs.dry_run != 'true' - &cloudflare-token
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 name: Cloudflare token
with:
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Cloudflare token
id: cloudflare-token id: cloudflare-token
if: needs.plan.outputs.dry_run != 'true' if: needs.plan.outputs.dry_run != 'true'
run: bash .github/release/cloudflare-token.sh run: bash .github/release/cloudflare-token.sh
env: env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }} CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
- name: Publish - name: Publish
run: bash .github/release/publish-cli.sh "$RUNNER_TEMP/in/build-archives" "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-windows" run: bash .github/release/publish-cli.sh "$RUNNER_TEMP/in/build-archives" "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-windows"
@ -686,19 +673,8 @@ jobs:
with: with:
pattern: "{sign-macos,sign-desktop-windows-installer,build-desktop-linux-*}" pattern: "{sign-macos,sign-desktop-windows-installer,build-desktop-linux-*}"
digests: sign-macos=${{ needs.sign-macos.outputs.digest }} sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }} digests: sign-macos=${{ needs.sign-macos.outputs.digest }} sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }}
- name: Configure AWS credentials - *configure-release-role
if: needs.plan.outputs.dry_run != 'true' - *cloudflare-token
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Cloudflare token
id: cloudflare-token
if: needs.plan.outputs.dry_run != 'true'
run: bash .github/release/cloudflare-token.sh
env:
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
- name: Publish - name: Publish
run: | run: |
bash .github/release/publish-desktop.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-desktop-windows-installer" \ bash .github/release/publish-desktop.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-desktop-windows-installer" \
@ -737,21 +713,10 @@ jobs:
steps: steps:
- *checkout-release - *checkout-release
- *download-signed-cli - *download-signed-cli
- name: Configure AWS credentials - *configure-release-role
if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Read publish secrets
if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
with:
secret-ids: HOMEBREW_TAP_DEPLOY_KEY,shared/HOMEBREW_TAP_DEPLOY_KEY
parse-json-secrets: false
- name: Publish - name: Publish
run: bash .github/release/publish-homebrew.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/build-archives" env: *aws-step
run: bash .github/release/with-secrets.sh HOMEBREW_TAP_DEPLOY_KEY=shared/HOMEBREW_TAP_DEPLOY_KEY -- bash .github/release/publish-homebrew.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/build-archives"
# The AUR package installs the published npm tarballs, so it follows the npm publish. # The AUR package installs the published npm tarballs, so it follows the npm publish.
publish-aur: publish-aur:
@ -766,21 +731,10 @@ jobs:
steps: steps:
- *checkout-release - *checkout-release
- *download-signed-cli - *download-signed-cli
- name: Configure AWS credentials - *configure-release-role
if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Read publish secrets
if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
with:
secret-ids: AUR_KEY,shared/AUR_SSH_KEY
parse-json-secrets: false
- name: Publish - name: Publish
run: bash .github/release/publish-aur.sh "$RUNNER_TEMP/in/build-npm" env: *aws-step
run: bash .github/release/with-secrets.sh AUR_KEY=shared/AUR_SSH_KEY -- bash .github/release/publish-aur.sh "$RUNNER_TEMP/in/build-npm"
# WinGet manifests as data. Submission to microsoft/winget-pkgs stays paused until the packages are accepted. # WinGet manifests as data. Submission to microsoft/winget-pkgs stays paused until the packages are accepted.
publish-winget: publish-winget:
@ -838,22 +792,13 @@ jobs:
env: *env env: *env
steps: steps:
- *checkout-release - *checkout-release
- name: Configure AWS credentials - *configure-release-role
if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
role-session-name: opencode-${{ github.run_id }}
aws-region: us-east-1
- name: Read publish secrets
if: needs.plan.outputs.dry_run != 'true'
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
with:
secret-ids: DISCORD_WEBHOOK,opencode/release/DISCORD_WEBHOOK
parse-json-secrets: false
- name: Publish - name: Publish
run: bash .github/release/publish-discord.sh run: bash .github/release/with-secrets.sh DISCORD_WEBHOOK=opencode/release/DISCORD_WEBHOOK -- bash .github/release/publish-discord.sh
env: env:
AWS_ACCESS_KEY_ID: ${{ steps.aws.outputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ steps.aws.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.aws.outputs.aws-session-token }}
OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }} OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }}
# Brings the release commit back to dev. Pushing to dev is blocked by rulesets, so it opens a PR. # Brings the release commit back to dev. Pushing to dev is blocked by rulesets, so it opens a PR.

View file

@ -2,8 +2,17 @@ name: triage-close-issues
on: on:
schedule: schedule:
- cron: "0 2 * * *" # Daily at 2:00 AM - cron: "0 2 * * *" # Daily at 2:00 AM UTC
workflow_dispatch: workflow_dispatch:
inputs:
dry-run:
description: "Log matching issues without closing them"
type: boolean
default: true
concurrency:
group: triage-close-issues
cancel-in-progress: false
jobs: jobs:
close: close:
@ -18,7 +27,12 @@ jobs:
with: with:
bun-version: latest bun-version: latest
- name: Close stale issues - name: Close stale waiting-for-info issues
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
run: bun script/github/close-issues.ts run: |
args=()
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs['dry-run'] }}" != "false" ]; then
args+=("--dry-run")
fi
bun script/github/close-issues.ts "${args[@]}"

View file

@ -0,0 +1,397 @@
name: triage-close-linked
# Closes what GitHub native auto-close misses on merge into the default branch:
# - additional issues in lists ("Fixes #1, #2 and #3" -> closes #2 and #3; GitHub closes #1)
# - superseded pull requests ("Supersedes #4", "Replaces #5")
#
# Runs entirely against the GitHub API with no checkout, so pull_request_target is safe.
permissions:
contents: read
on:
pull_request_target:
types: [closed]
workflow_dispatch:
inputs:
pr_number:
description: "Merged PR whose description to read"
required: true
type: string
dry_run:
description: "Log targets without closing them"
required: false
type: boolean
default: true
jobs:
close-linked:
if: >
github.repository == 'anomalyco/opencode' &&
(github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true)
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
issues: write
pull-requests: write
steps:
- name: Close linked issues and superseded PRs
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const ISSUE_KEYWORDS = new Set([
"close", "closes", "closed",
"fix", "fixes", "fixed",
"resolve", "resolves", "resolved",
]);
const PR_KEYWORDS = new Set([
"supersede", "supersedes", "superseded",
"replace", "replaces", "replaced",
]);
const KEYWORDS = new Set([...ISSUE_KEYWORDS, ...PR_KEYWORDS]);
const HEDGES = new Set([
"may", "might", "could", "would", "possibly", "probably", "potentially",
"maybe", "perhaps", "hopefully", "likely", "unlikely", "partially", "partly", "partial",
]);
const SUBORDINATORS = new Set(["if", "whether", "when", "whenever", "once", "until", "unless", "before", "after"]);
const DISQUALIFIERS = new Set([
"not", "never", "neither", "nor", "without", "cannot", "can't", "doesn't", "don't",
"won't", "didn't", "isn't", "wasn't", "hasn't", "haven't", "hadn't", "wouldn't",
"couldn't", "shouldn't", "mightn't", "mustn't",
...HEDGES,
...SUBORDINATORS,
"the", "a", "an", "of", "on", "in", "by", "from", "with", "for", "than",
]);
const BASE_FORMS = new Set(["close", "fix", "resolve", "supersede", "replace"]);
const VERB_MARKERS = new Set(["does", "do", "did", "and"]);
const DETERMINERS = new Set(["this", "that", "the", "a", "an"]);
const INTERVENING = new Set([
"also", "fully", "completely", "entirely", "actually", "really", "yet", "directly", "properly",
"have", "has", "had",
]);
const MAX_TARGETS = 10;
function stripNonProse(body) {
const lines = body.replaceAll("\r\n", "\n").split("\n");
const kept = [];
let fence = null;
let inComment = false;
let paragraph = false;
for (const line of lines) {
if (inComment) {
const end = line.indexOf("-->");
if (end === -1) { kept.push(""); continue; }
inComment = false;
kept.push(line.slice(end + 3));
continue;
}
const trimmed = line.trim();
if (fence !== null) {
if (trimmed.startsWith(fence) && [...trimmed].every(c => c === fence[0])) fence = null;
paragraph = false;
kept.push("");
continue;
}
if (trimmed === "") { paragraph = false; kept.push(""); continue; }
// Skip 4-space or tab indented code blocks outside a paragraph.
if (!paragraph && (/^ {4}/.test(line) || line.startsWith("\t"))) {
kept.push("");
continue;
}
const fenceMatch = /^(`{3,}|~{3,})/.exec(trimmed);
if (fenceMatch && (fenceMatch[1][0] === "~" || !trimmed.slice(fenceMatch[1].length).includes("`"))) {
fence = fenceMatch[1];
paragraph = false;
kept.push("");
continue;
}
if (trimmed.startsWith(">")) { paragraph = false; kept.push(""); continue; }
// Skip markdown task list items like "- [ ] Fix #99".
if (/^[-*+]\s+\[[ xX]\]/.test(trimmed)) { paragraph = false; kept.push(""); continue; }
// Strip inline code spans BEFORE HTML comments so `<!--` in backticks is not a comment.
let cleaned = line.replace(/`[^`\n]+`/g, " code ");
while (cleaned.includes("<!--")) {
const start = cleaned.indexOf("<!--");
const end = cleaned.indexOf("-->", start + 4);
if (end === -1) {
cleaned = cleaned.slice(0, start);
inComment = true;
break;
}
cleaned = cleaned.slice(0, start) + " " + cleaned.slice(end + 3);
}
paragraph = !/^#{1,6}\s/.test(trimmed);
kept.push(cleaned);
}
let text = kept.join("\n");
text = text.replace(/~~[^~\n]+~~/g, " ");
text = text.replace(/<(?:s|del|strike)\b[^>]*>[\s\S]*?<\/(?:s|del|strike)>/gi, " ");
return text;
}
function tokenize(text) {
const tokens = [];
let i = 0;
while (i < text.length) {
const c = text[i];
if (c === "\n") {
if (tokens.at(-1)?.kind === "newline") tokens[tokens.length - 1] = { kind: "break" };
else if (tokens.at(-1)?.kind !== "break") tokens.push({ kind: "newline" });
i++;
continue;
}
if (c.trim() === "") { i++; continue; }
const urlMatch = /^https?:\/\/github\.com\/([\w.-]+\/[\w.-]+)\/(?:issues|pull)\/(\d+)(?![\w])/i.exec(text.slice(i));
if (urlMatch) {
tokens.push({ kind: "ref", repository: urlMatch[1].toLowerCase(), number: Number(urlMatch[2]) });
i += urlMatch[0].length;
continue;
}
const repoRefMatch = /^([\w.-]+\/[\w.-]+)#(\d+)(?![\w'\u2019])/.exec(text.slice(i));
if (repoRefMatch) {
tokens.push({ kind: "ref", repository: repoRefMatch[1].toLowerCase(), number: Number(repoRefMatch[2]) });
i += repoRefMatch[0].length;
continue;
}
const bareRefMatch = /^#(\d+)(?![\w'\u2019])/.exec(text.slice(i));
if (bareRefMatch) {
tokens.push({ kind: "ref", repository: null, number: Number(bareRefMatch[1]) });
i += bareRefMatch[0].length;
continue;
}
const wordMatch = /^[A-Za-z][A-Za-z0-9'\u2019-]*/.exec(text.slice(i));
if (wordMatch) {
tokens.push({ kind: "word", text: wordMatch[0].toLowerCase().replaceAll("\u2019", "'") });
i += wordMatch[0].length;
continue;
}
tokens.push({ kind: "punct", text: c });
i++;
}
return tokens;
}
const isPunct = (t, s) => t?.kind === "punct" && t.text === s;
const isWord = (t, s) => t?.kind === "word" && t.text === s;
const skipEmph = (tokens, i) => { while (isPunct(tokens[i], "*") || isPunct(tokens[i], "_")) i++; return i; };
const skipEmphBack = (tokens, i) => { while (i >= 0 && (isPunct(tokens[i], "*") || isPunct(tokens[i], "_"))) i--; return i; };
const skipInterveningBack = (tokens, i) => {
for (;;) {
i = skipEmphBack(tokens, i);
if (i < 0 || tokens[i].kind !== "word" || !INTERVENING.has(tokens[i].text)) return i;
i--;
}
};
const endsWithRef = (tokens, k) => {
const p = skipEmphBack(tokens, k);
const t = tokens[p];
if (!t) return false;
if (t.kind === "ref") return true;
if (isPunct(t, ">")) return tokens[p - 1]?.kind === "ref" && isPunct(tokens[p - 2], "<");
if (isPunct(t, ")")) {
if (tokens[p - 1]?.kind === "ref" && isPunct(tokens[p - 2], "(")) return true;
if (isPunct(tokens[p - 2], "(") && isPunct(tokens[p - 3], "]")) return tokens[p - 4]?.kind === "ref" && isPunct(tokens[p - 5], "[");
}
return false;
};
// A continuation reference must terminate cleanly (end of text/line/clause or list separator),
// so "Fixes #12, #13 is tracked separately" does NOT close #13.
const endsCleanly = (tokens, j) => {
const next = tokens[skipEmph(tokens, j)];
if (!next || next.kind === "newline" || next.kind === "break") return true;
if (next.kind === "punct" && ".,;:)&".includes(next.text)) return true;
if (isWord(next, "and")) return true;
return false;
};
function isClosingStatement(tokens, index, keyword) {
let k = skipInterveningBack(tokens, index - 1);
// Skip parenthetical / dash / colon lead-ins from a reference ("Reverts #100 (fixes #99)", "TODO: fix #99").
if (isPunct(tokens[k], ":") && tokens[k - 1]?.kind === "word" && ["todo", "note", "fyi"].includes(tokens[k - 1].text)) return false;
if (tokens[k]?.kind === "punct" && "(—–-".includes(tokens[k].text)) {
let q = skipInterveningBack(tokens, k - 1);
while (tokens[q]?.kind === "punct" && "-—–".includes(tokens[q].text)) q = skipInterveningBack(tokens, q - 1);
if (endsWithRef(tokens, q)) return false;
}
if (endsWithRef(tokens, k)) return false;
const lineStart = tokens[k]?.kind === "newline" || tokens[k]?.kind === "break" || k < 0;
if (tokens[k]?.kind === "newline") {
const e = skipEmphBack(tokens, k - 1);
const w = skipInterveningBack(tokens, e);
if (w < e && endsWithRef(tokens, w)) return false;
k = w;
}
const before = tokens[k];
if (!before || before.kind !== "word") return true;
if (before.text === "which" || before.text === "that") {
let p = skipInterveningBack(tokens, k - 1);
while (tokens[p]?.kind === "newline" || (tokens[p]?.kind === "punct" && ",(;:-\u2013\u2014".includes(tokens[p].text))) {
p = skipInterveningBack(tokens, p - 1);
}
if (endsWithRef(tokens, p)) return false;
}
if (DISQUALIFIERS.has(before.text)) return false;
let p = skipInterveningBack(tokens, k - 1);
if (tokens[p]?.kind === "newline") p = skipInterveningBack(tokens, p - 1);
if (tokens[p]?.kind === "word" && DETERMINERS.has(tokens[p].text)) {
p = skipInterveningBack(tokens, p - 1);
if (tokens[p]?.kind === "newline") p = skipInterveningBack(tokens, p - 1);
}
if (isPunct(tokens[p], ",")) p = skipInterveningBack(tokens, p - 1);
if (tokens[p]?.kind === "word" && (SUBORDINATORS.has(tokens[p].text) || HEDGES.has(tokens[p].text))) return false;
if (!BASE_FORMS.has(keyword)) return true;
return lineStart ? before.text !== "to" : VERB_MARKERS.has(before.text);
}
function readRef(tokens, index) {
index = skipEmph(tokens, index);
const t = tokens[index];
if (!t) return null;
if (t.kind === "ref") return { token: t, end: index + 1 };
if (isPunct(t, "<") && tokens[index + 1]?.kind === "ref" && isPunct(tokens[index + 2], ">")) {
return { token: tokens[index + 1], end: index + 3 };
}
if (isPunct(t, "[")) {
let close = index + 1;
while (close < tokens.length && close < index + 10 && !isPunct(tokens[close], "]")) {
if (tokens[close].kind === "newline" || tokens[close].kind === "break") return null;
close++;
}
if (isPunct(tokens[close], "]") && isPunct(tokens[close + 1], "(") && isPunct(tokens[close + 3], ")")) {
if (tokens[close + 2]?.kind === "ref") return { token: tokens[close + 2], end: close + 4 };
if (close === index + 2 && tokens[index + 1]?.kind === "ref") return { token: tokens[index + 1], end: close + 4 };
}
}
return null;
}
function findLinkedReferences(body, repository) {
const self = repository.toLowerCase();
const tokens = tokenize(stripNonProse(body));
const found = [];
let i = 0;
while (i < tokens.length) {
const token = tokens[i];
if (token.kind !== "word" || !KEYWORDS.has(token.text) || !isClosingStatement(tokens, i, token.text)) {
i++;
continue;
}
const targetKind = PR_KEYWORDS.has(token.text) ? "pull" : "issue";
let j = i + 1;
if (isPunct(tokens[j], ":")) j++;
let ref = readRef(tokens, j);
if (!ref) { i++; continue; }
let pos = 0;
for (;;) {
// For issue keywords, GitHub natively closes pos === 0 when bare #N/URL/owner/repo#N.
// Still emit pos === 0 only for markdown-link/PR keywords, or list continuations (pos > 0),
// avoiding racing GitHub native auto-close.
const nativeClose = targetKind === "issue" && pos === 0 && tokens[skipEmph(tokens, j)]?.kind === "ref";
if (!nativeClose && (pos === 0 || endsCleanly(tokens, ref.end))) {
found.push({ repository: ref.token.repository ?? self, number: ref.token.number, keyword: token.text, targetKind });
}
j = ref.end;
pos++;
let k = skipEmph(tokens, j);
let sep = false;
if (isPunct(tokens[k], ",")) { k++; sep = true; }
if (isWord(tokens[k], "and") || isPunct(tokens[k], "&")) { k++; sep = true; }
if (!sep) break;
ref = readRef(tokens, k);
if (!ref) break;
if (!endsCleanly(tokens, ref.end)) break;
}
i = j;
}
return found;
}
const { owner, repo } = context.repo;
const repository = `${owner}/${repo}`;
const expectedRepoUrl = `https://api.github.com/repos/${repository.toLowerCase()}`;
const inputs = context.payload.inputs ?? {};
const event = context.payload.pull_request;
const prNumber = event?.number ?? Number(inputs.pr_number);
const dryRun = String(inputs.dry_run ?? "false") === "true";
if (!Number.isInteger(prNumber) || prNumber <= 0) {
core.setFailed(`Invalid pull request number: ${inputs.pr_number}`);
return;
}
const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: prNumber });
if (!pr.merged) {
core.info(`#${prNumber}: not merged, skipping`);
return;
}
const defaultBranch = pr.base.repo.default_branch;
if (pr.base.ref !== defaultBranch) {
core.info(`#${prNumber}: merged into ${pr.base.ref}, not ${defaultBranch}, skipping`);
return;
}
const prAuthor = pr.user?.login?.toLowerCase();
const trustedAuthor = ["OWNER", "MEMBER"].includes(pr.author_association);
const body = (event ? event.body : pr.body) ?? "";
const seen = new Set();
const targets = [];
for (const ref of findLinkedReferences(body, repository)) {
if (ref.repository !== repository.toLowerCase()) continue;
if (ref.number === prNumber || seen.has(ref.number)) continue;
seen.add(ref.number);
targets.push(ref);
}
if (targets.length === 0) {
core.info(`#${prNumber}: no additional linked references to close`);
return;
}
if (targets.length > MAX_TARGETS) {
core.warning(`#${prNumber}: found ${targets.length} references (cap ${MAX_TARGETS}); refusing bulk close`);
return;
}
let failed = 0;
for (const ref of targets) {
let item;
try {
({ data: item } = await github.rest.issues.get({ owner, repo, issue_number: ref.number }));
} catch (error) {
if (error.status === 404 || error.status === 410) continue;
failed++;
core.error(`#${ref.number}: ${error.message}`);
continue;
}
if (item.repository_url && item.repository_url.toLowerCase() !== expectedRepoUrl) continue;
if (item.state !== "open") continue;
const isPull = item.pull_request !== undefined;
// Only close issues for close/fix/resolve, and only close PRs for supersede/replace.
if (ref.targetKind === "issue" && isPull) continue;
if (ref.targetKind === "pull" && !isPull) continue;
// Only allow an outside contributor PR to supersede their own PR.
if (isPull && !trustedAuthor && item.user?.login?.toLowerCase() !== prAuthor) {
core.info(`#${ref.number}: skipping supersede of another contributor PR by non-member`);
continue;
}
if (dryRun) {
core.info(`[dry-run] Would close ${isPull ? "PR" : "issue"} #${ref.number} (${ref.keyword} in #${prNumber})`);
continue;
}
try {
if (isPull) {
await github.rest.pulls.update({ owner, repo, pull_number: ref.number, state: "closed" });
} else {
await github.rest.issues.update({ owner, repo, issue_number: ref.number, state: "closed", state_reason: "completed" });
}
await github.rest.issues.createComment({
owner,
repo,
issue_number: ref.number,
body: isPull ? `Superseded by #${prNumber}.` : `Closed as completed by #${prNumber}.`,
});
} catch (error) {
failed++;
core.error(`#${ref.number}: ${error.message}`);
}
}
if (failed > 0) core.setFailed(`${failed} of ${targets.length} references could not be closed`);

90
.github/workflows/triage-slop.yml vendored Normal file
View file

@ -0,0 +1,90 @@
name: triage-slop
permissions:
contents: read
on:
pull_request_target:
types: [labeled]
jobs:
close-slop:
runs-on: ubuntu-latest
if: >
github.event.label.name == 'slop' &&
github.repository == 'anomalyco/opencode' &&
github.event.pull_request.state == 'open'
timeout-minutes: 5
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Close, scrub, and comment on AI slop PR
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const pr = context.payload.pull_request;
const pullNumber = pr.number;
const login = pr.user?.login?.toLowerCase();
// Never touch merged/closed PRs, bots, or team members.
if (pr.state !== "open" || pr.merged) return;
if (pr.user?.type === "Bot" || ["OWNER", "MEMBER"].includes(pr.author_association)) {
core.info(`Skipping #${pullNumber}: author ${pr.user?.login} is exempt`);
return;
}
try {
const { data: file } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: ".github/TEAM_MEMBERS",
ref: "dev",
});
const members = new Set(
Buffer.from(file.content, "base64").toString("utf8").split("\n").map((l) => l.trim().toLowerCase()).filter(Boolean),
);
if (login && members.has(login)) {
core.info(`Skipping #${pullNumber}: author ${pr.user?.login} is in TEAM_MEMBERS`);
return;
}
} catch (error) {
core.warning(`Could not read TEAM_MEMBERS: ${error.message}`);
return;
}
// Close and scrub first so a failed update never leaves a misleading closed comment.
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pullNumber,
title: 'ai slop',
body: 'This pull request was closed as AI slop and its title/description were cleared to avoid misleading reviewers. If you believe this was closed in error, leave a comment explaining why.',
state: 'closed',
});
const marker = "<!-- triage-slop -->";
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullNumber,
per_page: 100,
});
if (comments.some((c) => (c.body || "").includes(marker))) return;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullNumber,
body: [
marker,
'This pull request has been closed because it was flagged as low-quality AI slop.',
'',
'Common reasons include:',
'- Failing to verify the underlying problem exists',
'- Failing to test that the change actually fixes it',
'- Making unverified assumptions about the codebase or adding speculative/misleading changes',
'',
'If you believe this was closed in error, leave a comment explaining how you reproduced and verified the change.',
].join('\n'),
});

View file

@ -13,12 +13,12 @@ Requirements:
- Preserve meaning, intent, tone, and formatting (including Markdown/MDX structure). - Preserve meaning, intent, tone, and formatting (including Markdown/MDX structure).
- Preserve all technical terms and artifacts exactly: product/company names, API names, identifiers, code, commands/flags, file paths, URLs, versions, error messages, config keys/values, and anything inside inline code or code blocks. - Preserve all technical terms and artifacts exactly: product/company names, API names, identifiers, code, commands/flags, file paths, URLs, versions, error messages, config keys/values, and anything inside inline code or code blocks.
- Also preserve every term listed in the Do-Not-Translate glossary below. - Also preserve every term listed in the Do-Not-Translate glossary below.
- Also apply locale-specific guidance from `.opencode/glossary/<locale>.md` when available (for example, `zh-cn.md`). - Also apply the matching locale file when available: `.opencode/glossary/<locale>.md` for the marketing site, `services/site/src/docs/i18n/glossary/<locale>.md` for the docs (for example, `zh-cn.md` and `zh.md`).
- Do not modify fenced code blocks. - Do not modify fenced code blocks.
- Output ONLY the translation (no commentary). - Output ONLY the translation (no commentary).
If the target locale is missing, ask the user to provide it. If the target locale is missing, ask the user to provide it.
If no locale-specific glossary exists, use the global glossary only. If no locale-specific glossary exists, use the shared glossary only.
--- ---
@ -35,6 +35,31 @@ When translating the marketing site (`services/site/src/i18n/<locale>.ts` and `s
--- ---
# V2 Docs Pages (opencode.ai/docs)
When translating a page of the latest docs (`services/site/src/docs/content`):
- Translate the English page at `src/docs/content/<same path>.mdx` into `src/docs/content/<locale>/<same path>.mdx`, using the site's language folder (`zh`, `zht`, `ko`, `de`, `es`, `fr`, `it`, `da`, `ja`, `pl`, `ru`, `uk`, `ar`, `no`, `br`, `th`, `tr`). English stays at the root.
- Translate the frontmatter's `title` and `description`; keep every other key and value as written.
- Keep the English heading structure: the same headings, in the same order and depth. Translated pages reuse the English heading ids, so `#anchors` keep working in every language. A translation whose heading depths differ is treated as stale: the build warns, the page shows the English fallback, and `check-translations.ts` lists it. If the English page gains a heading, update the translation's headings in the same place.
- Never call OpenCode an "AI coding agent": it is an "open source coding agent" in every language. Do not add "AI" to that phrase; "AI models" and "AI providers" are fine.
- Keep every MDX component, prop, code block, inline code span, path, URL, command, flag, config key and product name exactly as written. Translate only prose, table headers and code-block captions.
- Keep internal links docs-root-relative (`/config`): the site adds the page's language prefix. Do not write `/docs/...`, `/<locale>/docs/...` or `https://opencode.ai/docs/...`.
- A page you do not translate is served in English under that language's chrome, with a notice, so partial translations are safe.
- From `services/site`, run `bun src/docs/script/check-translations.ts <locale>` to list missing pages and pages whose English changed since their stamp, then run it with `--stamp` once the language is up to date. Stamps live in `src/docs/i18n/stamps/<locale>.json`.
## Review before shipping a language
- Compare every page paragraph by paragraph, list item, table row and code block against the CURRENT English page, not an older translation, and re-read pages whose English changed since their stamp.
- Read the result as native prose: remove translationese and literal calques, and keep the tone of the English page.
- Check numbers, prices, model IDs and version numbers against the English.
- Keep proper nouns, identifiers and code exactly as written, per the shared rules in `src/docs/i18n/glossary.md`.
- Keep the English heading order, depth and count; anchors depend on it.
- Apply the shared rules in `src/docs/i18n/glossary.md` and the language's terms in `src/docs/i18n/glossary/<locale>.md`.
- Spot-check two or three rendered pages in the built site: title, sidebar and code blocks.
---
# Locale-Specific Glossaries # Locale-Specific Glossaries
When a locale glossary exists, use it to: When a locale glossary exists, use it to:

43
.opencode/glossary/uk.md Normal file
View file

@ -0,0 +1,43 @@
# uk Glossary
## Sources
- Review of the desktop app's Ukrainian UI copy
## Do Not Translate (Locale Additions)
- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
- `OpenCode CLI`
- `CLI`, `TUI`, `MCP`, `LSP`, `OAuth` (never transliterate them as `МКП` or `ЛСП`)
- Commands, flags, file paths, and code literals (keep exactly as written)
## Preferred Terms
| English | Preferred | Notes |
| ------------------------------------------------ | ------------------------------ | --------------------------------------------------------------------------- |
| session | сесія | Not `сеанс` |
| project | проєкт | 2019 orthography, not `проект` |
| worktree | робоче дерево | Not `робоча область` or `робоче місце` |
| Experimental (settings tab) | Експериментальні функції | Not the bare adjective `Експериментальний` |
| shell (tool, activity category, mode) | Термінал | `Використано: Читання, Запис, Термінал`; `режим термінала` |
| shell (a running command or process) | команда | `3 команди`, `запущено 2 команди`, `Очікування команди`, `Зупинити команду` |
| shell command | команда термінала | `Введіть команду термінала…` |
| shell (bash, zsh, PowerShell chosen in settings) | оболонка | Only where the user picks the shell program itself |
| terminal (genitive) | термінала | Not `терміналу` |
| About (settings tab) | Про OpenCode | Not a bare `Про` |
| third-party notices | ліцензії сторонніх компонентів | Not `повідомлення третіх сторін` |
| Released under the MIT License | Поширюється за ліцензією MIT | |
## Guidance
- Prefer natural Ukrainian phrasing over literal translation
- Keep tone clear and direct in UI labels and docs prose
- Fill every plural form the locale uses: `.one`, `.few`, `.many`, `.other`
- Keep the English punctuation of short taglines when it reads naturally (for example `OpenCode, агент кодування з відкритим кодом`)
- Preserve technical artifacts exactly: commands, flags, code, URLs, model IDs, and file paths
## Avoid
- Avoid `оболонка` for shell activity, counts, and tool labels; it reads as jargon next to `Читання` and `Запис`
- Avoid translating product and protocol names that are fixed identifiers
- Avoid mixing multiple Ukrainian terms for the same recurring UI action once a preferred term is established

69
.opencode/glossary/vi.md Normal file
View file

@ -0,0 +1,69 @@
# vi Glossary
## Sources
- PR #55925: https://github.com/anomalyco/opencode/pull/55925 (terminology fixes in this file)
- PR #55922: https://github.com/anomalyco/opencode/pull/55922 (Vietnamese Console locale)
- Existing Vietnamese copy on dev: `packages/app/src/runtime/i18n/vi.ts`, `packages/ui/src/i18n/vi.ts`, `README.vi.md`
## Do Not Translate (Locale Additions)
- `OpenCode` (preserve casing in prose; keep `opencode` only in commands, package names, paths, or code)
- `Zen`, `Go`, `Go Plus`, `Black`, `Enterprise`, `Models.dev`
- `TUI`, `LSP`, `LLM`, `API`, `CLI`, `MCP`, `SSO`, `SDK`, `IDE`, `SSE`, `ZDR`, `MIT License`
- `terminal`, `desktop`, `web`, `shell`
- Plan names such as `Black 20`, `Black 100`, `Black 200`
- Commands, flags, file paths, and code literals (keep exactly as written)
## Preferred Terms
| English | Preferred | Notes |
| -------------------------- | --------------------- | -------------------------------------------------------- |
| coding agent (the product) | `trợ lý lập trình AI` | Matches the tagline already used in `README.vi.md` |
| agent (an instance) | `tác nhân` | Used in app UI copy; keep consistent with `packages/app` |
| session | `phiên` | Matches `packages/app/src/runtime/i18n/vi.ts` |
| file | `tệp` | `tệp đính kèm` for attachment |
| provider | `nhà cung cấp` | |
| model | `mô hình` | |
| docs | `tài liệu` | |
| download | `tải về` | |
| sign in / log in | `đăng nhập` | |
| sign up | `đăng ký` | |
| subscribe | `đăng ký` | Prefer `đăng ký gói ...` for plans |
| cancel | `hủy` | |
| privacy | `quyền riêng tư` | |
| settings | `cài đặt` | |
| usage limits | `hạn mức sử dụng` | |
| top up (balance/credit) | `nạp thêm` | `nạp thêm số dư` / `nạp thêm tín dụng` |
| refund | `hoàn tiền` | |
| waitlist | `danh sách chờ` | |
| server | `máy chủ` | |
| workspace | `không gian làm việc` | |
| brand | `thương hiệu` | |
| changelog | `nhật ký thay đổi` | |
| local models | `mô hình chạy cục bộ` | |
| prompt | `lời nhắc` | |
| token | `token` | Keep in English; do not use `mã thông báo` |
| skill | `kỹ năng` | Matches the app UI label for the skills tab |
| plugin | `tiện ích mở rộng` | Matches the app UI label for extensions |
| command | `lệnh` | |
| theme | `giao diện` | |
| formatter | `trình định dạng` | |
| compaction | `nén` | |
| attachment | `tệp đính kèm` | |
| data | `dữ liệu` | |
## Guidance
- Prefer natural Vietnamese phrasing over literal translation; short labels stay short
- Keep language names static/native in language pickers: always `Tiếng Việt`, never a translated form
- Keep `$` amounts in the original currency notation and numbers, e.g. `$10/month`
- Vietnamese has no grammatical plural, so `*_one` and `*_other` strings may be identical
- Write dates and numbers with the Latin digits used elsewhere in the UI
## Avoid
- Avoid translating language names differently per current locale in language lists
- Avoid `mã nguồn` for `token` and `token` for `source code`
- Avoid Sino-Vietnamese calques such as `chủ đề` for `topic` when `chủ đề` already means theme
- Avoid translating `Zen`, `Go`, and `Black` as generic words like `đỉnh cao` or `đi`

View file

@ -16,7 +16,4 @@
"tools": { "tools": {
"github-pr-search": false, "github-pr-search": false,
}, },
"experimental": {
"part_rows": true,
},
} }

View file

@ -15,14 +15,14 @@ Read these first rather than repeating them:
## Stories and `mount` ## Stories and `mount`
- **Location.** Put the story next to the production component under `src/` of `ui`, `session-ui`, `app` or `gui-plugins`. The story server indexes `*.stories.tsx` files in those four trees (`packages/stories/vite.config.ts`, `src/index-plugin.ts`), reading each file's `export default { title, id }` and its `export const` stories from source. - **Location.** Put the Lab page next to the production component under `src/` of `ui`, `session-ui`, `app` or `gui-plugins`. The story server indexes `*.lab.tsx` files in those four trees (`packages/stories/vite.config.ts`, `src/index-plugin.ts`), reading each page's `export default { title, id }` and its `export const` states (the stories a test mounts) from source. Name a page that needs the story server's fixture runtime `*.standalone.lab.tsx`: the in-app Lab skips those.
- **Story ID.** It is the meta `id` if one is set (`packages/session-ui/src/components/session-review.stories.tsx:25`). Otherwise it is the kebab-cased `title`, then `--`, then the kebab-cased export. Check it at `http://127.0.0.1:6006/?id=<id>` on a running story server (`bun --cwd packages/stories dev`). A wrong ID renders nothing (the page throws `No story has the id …`), so `mount` waits out its full 30 s root wait (`story.ts:39`) and then fails. - **Story ID.** It is the meta `id` if one is set (`packages/session-ui/src/components/session-review.lab.tsx:25`). Otherwise it is the kebab-cased `title`, then `--`, then the kebab-cased export. Check it at `http://127.0.0.1:6006/?id=<id>` on a running story server (`bun --cwd packages/stories dev`). A wrong ID renders nothing (the page throws `No story has the id …`), so `mount` waits out its full 30 s root wait (`story.ts:39`) and then fails.
- **URL args.** `mount(id, { args, globals })` writes them into the URL as `key:value` pairs (`story.ts:20-36`). The frame reads every one: a value becomes a boolean or number when the story's own default for that key is one, `!true`/`!false`/`!null`/`!undefined` keep Storybook's meaning, and anything else stays text. - **URL args.** `mount(id, { args, globals })` writes them into the URL as `key:value` pairs (`story.ts:20-36`). The frame reads every one: a value becomes a boolean or number when the story's own default for that key is one, `!true`/`!false`/`!null`/`!undefined` keep Storybook's meaning, and anything else stays text.
- Give every arg a typed default. With `args: { split: false }` (`session-review.stories.tsx:129`), `split:false` arrives as a boolean. - Give every arg a typed default. With `args: { split: false }` (`session-review.lab.tsx:129`), `split:false` arrives as a boolean.
- A value containing `;` would split the pair list, so pick such values inside the story, from a `scenario`-style arg. - A value containing `;` would split the pair list, so pick such values inside the story, from a `scenario`-style arg.
- **Globals** are `theme` (default `light`), `direction` and `locale` (`packages/stories/src/frame.tsx`). - **Globals** are `theme` (default `light`), `direction` and `locale` (`packages/stories/src/frame.tsx`).
- **Portaled UI.** `mount` returns `#story-root`. Dialogs, menus and drawers render outside it, so locate them from `page` (`packages/app/component-tests/composer.spec.ts:101-107`). - **Portaled UI.** `mount` returns `#story-root`. Dialogs, menus and drawers render outside it, so locate them from `page` (`packages/app/component-tests/composer.spec.ts:101-107`).
- **Server state** comes from the `resolve.alias` list in `packages/stories/vite.config.ts`, which points app server, SDK and sync modules at `packages/stories/mocks/app/**`. Extend a mock rather than adding a server. The app's components lab renders the same stories inside the real app instead, so a story must not depend on a mock-only export. Tests reset mock state on every mount. - **Server state** comes from the `resolve.alias` list in `packages/stories/vite.config.ts`, which points app server, SDK and sync modules at `packages/stories/mocks/app/**`. Extend a mock rather than adding a server. The app's Lab (`/components`) renders the same pages inside the real app instead, so a story must not depend on a mock-only export. Tests reset mock state on every mount.
- **Requests the mocks do not answer.** Route them with `page.route`. That includes server endpoints such as `/api/fs/read` (`packages/session-ui/component-tests/read-image.spec.ts:20`) and external URLs such as favicons (`packages/session-ui/component-tests/markdown.spec.ts:217`). - **Requests the mocks do not answer.** Route them with `page.route`. That includes server endpoints such as `/api/fs/read` (`packages/session-ui/component-tests/read-image.spec.ts:20`) and external URLs such as favicons (`packages/session-ui/component-tests/markdown.spec.ts:217`).
## Fixtures imported by URL ## Fixtures imported by URL
@ -44,10 +44,10 @@ Use these when the contract is not visible in a story, such as construction coun
## Vite pre-bundling and reloads ## Vite pre-bundling and reloads
`packages/stories/vite.config.ts` sets `optimizeDeps.entries`: every `*.stories.tsx` and `*.worker.ts` under the four `src/` trees, every module a component spec names by a `./` or `../` string literal ending in `.ts`/`.tsx` (collected at the top of the file), and the frame's `index.html`. Vite pre-bundles their bare imports before the first page loads. A dependency the scan misses is found on first import instead. If that changes chunks already served, Vite logs `✨ optimized dependencies changed. reloading` and sends `full-reload` with path `*` to every page in every worker, and requests with a stale `?v=` hash get a 504 "Outdated Optimize Dep". `packages/stories/vite.config.ts` sets `optimizeDeps.entries`: every `*.lab.tsx` and `*.worker.ts` under the four `src/` trees, every module a component spec names by a `./` or `../` string literal ending in `.ts`/`.tsx` (collected at the top of the file), and the frame's `index.html`. Vite pre-bundles their bare imports before the first page loads. A dependency the scan misses is found on first import instead. If that changes chunks already served, Vite logs `✨ optimized dependencies changed. reloading` and sends `full-reload` with path `*` to every page in every worker, and requests with a stale `?v=` hash get a 504 "Outdated Optimize Dep".
- **The bar is zero reloads.** A cold run of either suite should print neither `new dependencies optimized` nor `optimized dependencies changed`, so these lines are the signal to watch. - **The bar is zero reloads.** A cold run of either suite should print neither `new dependencies optimized` nor `optimized dependencies changed`, so these lines are the signal to watch.
- **Keep new code reachable by the scan.** A module path built at runtime, in a template literal, or without its extension is not collected, and neither is a spec named other than `*.spec.ts`. Name stories `*.stories.tsx`: the story index and the scan read only that extension. Name workers `*.worker.ts`, since the scan does not follow `new Worker(new URL(…))`. Add an `optimizeDeps.include` entry only for a dependency the scan cannot reach. Vite names it in `✨ new dependencies optimized: …`, and `DEBUG=vite:deps` replaces that line with scan and discovery detail. - **Keep new code reachable by the scan.** A module path built at runtime, in a template literal, or without its extension is not collected, and neither is a spec named other than `*.spec.ts`. Name Lab pages `*.lab.tsx`: the story index and the scan read only that extension. Name workers `*.worker.ts`, since the scan does not follow `new Worker(new URL(…))`. Add an `optimizeDeps.include` entry only for a dependency the scan cannot reach. Vite names it in `✨ new dependencies optimized: …`, and `DEBUG=vite:deps` replaces that line with scan and discovery detail.
- **Symptoms.** "page.evaluate: Execution context was destroyed", "Failed to fetch dynamically imported module …/@fs/…", or fixture state that is gone right after `mount` ("Registrations: 1" not found, an empty tab strip). - **Symptoms.** "page.evaluate: Execution context was destroyed", "Failed to fetch dynamically imported module …/@fs/…", or fixture state that is gone right after `mount` ("Registrations: 1" not found, an empty tab strip).
- **Only `mount()` survives a reload,** because it navigates back to the same URL. A reload loses everything set up after it: `page.evaluate` imports, mounted fixtures, state from earlier clicks, and the elements your locators pointed at. Another worker's discovery can trigger it at any moment. - **Only `mount()` survives a reload,** because it navigates back to the same URL. A reload loses everything set up after it: `page.evaluate` imports, mounted fixtures, state from earlier clicks, and the elements your locators pointed at. Another worker's discovery can trigger it at any moment.
- **Fix reloads in the scan, never with retries, timeouts or import order.** The import-everything-before-mount `Promise.all` in `browser-pane-restore.spec.ts:43-58` (comment at `:56`) only narrowed the window. Before the entries existed, that file's `:123` and `:150` were retried in 31 CI jobs each, and failed attempts cost about 39-47 s (Linux) and 34 s (Windows) of worker time per run. - **Fix reloads in the scan, never with retries, timeouts or import order.** The import-everything-before-mount `Promise.all` in `browser-pane-restore.spec.ts:43-58` (comment at `:56`) only narrowed the window. Before the entries existed, that file's `:123` and `:150` were retried in 31 CI jobs each, and failed attempts cost about 39-47 s (Linux) and 34 s (Windows) of worker time per run.

View file

@ -0,0 +1,73 @@
---
name: focus-states
description: Focus indicators and focus movement in OpenCode Desktop and the web app. Use when adding or reviewing an interactive component, a :focus/:focus-visible/:focus-within rule, an outline on focus, a list/menu/palette row, a text field, a dialog, menu or popover, a selected state, removing or closing a focused item, or anything that moves focus programmatically.
---
# Focus States
Use one default ring when someone navigates focus to a control, not when they click or tap it. The exceptions are below. Desktop uses Chromium; on the web, test the browser you’re changing or targeting rather than assuming identical focus behaviour.
## The ring
- Use `:focus-visible` for the ring. Don’t use `:focus` to decide whether to show it. `base.css` supplies `outline: 2px solid var(--v2-border-border-focus); outline-offset: 2px` and a 4px radius for links.
- Offset: `2px` outward by default. `-2px` inset for full-width rows and for controls flush against an edge that clips or scrolls (segmented items, split buttons, titlebar buttons, clear buttons). No other offsets.
- Follow the control’s radius; give a square text action or link 4px where appropriate. Use a wrapper with `:has(> trigger:focus-visible)` when the wrapper owns the visible shape or the trigger’s ring would clip, as with tabs and Settings project cards. End the selector at the wrapper or its pseudo-element (`wrapper:has(…)::after`). A selector that continues after `:has()` (`wrapper:has(…) ~ other`) restyles everything inside the wrapper on each focus change; around the timeline that made scrolling hitch (`packages/app/AGENTS.md`, Timeline stability).
- Outline only. Don't draw focus with `box-shadow`: Windows High Contrast removes shadows, so the ring disappears, and shadow rings looked different from every other ring.
- Rings appear and disappear instantly. Draw no outline at rest and leave `outline-color` out of `transition`; animating it from the default colour flashes black. Don't use `outline: 2px solid transparent` at rest: High Contrast turns it into a visible outline on every control.
- Keep a border that identifies an unfocused control. Where Chromium's forced colours remove the shadow that draws a control's edge, give it a system-colour border in `@media (forced-colors: active)`, separate from the ring, as switches and radios do.
- Inline rename inputs rely on the caret and editing state. The timeline's Jump to latest stays in the Tab order with the shared ring, since it's the only quick way back down from the keyboard; its container is `inert` while it's hidden. Loading alone doesn’t add a ring. If a busy button keeps keyboard focus, keep the ring and show the busy state separately with `aria-busy`, a disabled state, or loading text; the ring alone doesn’t say whether the button can be activated.
- These ring rules do not replace normal field borders or validation feedback. Those can respond to click focus and have their own inset treatment.
## Text fields and scroll areas
Chromium matches `:focus-visible` on every focused text field, and on anything that has focus once a key is pressed. A ring on a large surface then shows after a click, when the app moves focus there, and on returning to the window.
- A text field never draws the ring, the composer and Home search included. Focus shows as the caret and the field's focused border or background. Don't add ring state or pointer tracking to a field.
- A scroll area (the timeline, Home's list) takes focus from a click so the keyboard can scroll it, and draws no ring. It is not a Tab stop: Tab moves between the items inside it, and they show the ring. In a session, PageUp and PageDown in the composer page the timeline.
- Moving a screen reader’s reading cursor alone does not move DOM focus.
## Rows
- Choose by how focus moves.
- Focus stays in a search input while arrow keys move a highlight (`aria-activedescendant`: palettes, search lists): the active option is background-only and should not also be a Tab stop. Independent actions can still be Tab stops.
- A full-width row that is its own Tab stop (Home sessions and projects, settings rows) gets a 2px inset ring. Standalone disclosure and tool triggers can use an outset ring if it fits. Hover stays background-only.
- With roving focus (tabs and file trees), Tab enters the widget and arrow keys move focus within it. Show a ring on the keyboard-focused item, even though the other items are not separate Tab stops.
- The active option’s background highlight can disappear or become too faint in forced colours. Use `Highlight` and `HighlightText` in `@media (forced-colors: active)`. Check that nested labels and icons remain readable.
- Selection is not focus. Keep it neutral and distinct from the blue ring. The Settings › General layout cards (`settings/general/interface-mode.css`) are the reference for picker cards: a 2px `--v2-border-border-strong` border, a check badge outside the corner (`--v2-icon-icon-muted` fill, cut out in the surface colour, with a system-colour border in forced colours), and the other options' content faded. Don't use the inverse (black) border.
## Overlays and menus
- When an overlay closes and returns focus to its opener:
- Pointer dismissals (backdrop click, a close button clicked with the pointer) restore the opener’s ring state from when the overlay opened.
- Escape or another keyboard close after a keyboard open shows the ring on the restored control.
- Escape after a pointer open restores the no-ring state. Changing that is a deliberate product decision and needs its own test.
- Dialogs get this from the dialog context and dropdown menus from the `Menu` wrapper. Select, `Menu.Context`, and raw `@kobalte/core/popover` uses get it from `createOverlayFocus` in `packages/ui/src/context/overlay-focus.tsx`: call `openChanged` from `onOpenChange` and `restore(event, trigger)` from `onCloseAutoFocus`. Without a trigger, `restore(event)` returns to whatever had focus when it opened, such as a context menu's row. Never call a bare `trigger.focus()` on close.
- Choose the widget by what's inside, not by how it looks. A menu (`Menu`, `role="menu"`) holds only commands: arrow keys, Home/End and typeahead move, Enter chooses, Esc closes, and Tab does nothing, as in native menus. A popover that holds controls (switches, links, buttons in flyouts, like the Extensions panel) must let Tab move through them; arrow keys may be added on top.
## Clipping and covering
- Use `overflow: clip; overflow-clip-margin: 5px` only if the container does not need to scroll, including programmatic scrolling. For scrollers, use an inset ring, padding, or scroll margins as appropriate.
- Rows that overlap by a pixel to merge borders (accordions) let the next row paint over the bottom of an inset ring. Raise the header holding focus (`z-index`), as `accordion.css` and `sticky-accordion-header.css` do; with sticky headers, raise the header, not the item, or the item lands under its neighbours' sticky headers.
- Keep the whole ring clear of sticky content. Try an inset ring or a targeted `scroll-margin` on the affected items first. Use `scroll-padding` on the scroller only when sticky chrome covers focus across the whole area, since it changes every scroll, not just focus. Account for the header, any fade, and the ring’s reach (4px for the default outset ring). Check Tab and Shift+Tab.
## Colour and contrast
- Use `--v2-border-border-focus`, never a raw colour or a per-component override. It is Blue 500 in light and Blue 400 in dark; custom themes can override it.
- Light mode has a known contrast gap: Blue 500 is about 2.7:1 on white, below the 3:1 target. It was kept as a documented decision because Blue 600 read too heavy. It is not a pass, and 2.7:1 is not a new threshold.
- Measure against the actual adjacent colours in both schemes: the surrounding surface for an outset ring and the control’s fill for an inset ring. If contrast is low, first try a placement that improves it without clipping. If placement can’t fix it, flag the shortfall and revisit the token. Never change the colour per component.
## Order and movement
- Follow logical reading and interaction order, including in RTL. Fix DOM order rather than using positive `tabindex`. Use native buttons for actions and links for navigation; use established widget primitives or keyboard patterns for tabs, trees, sliders, and resize handles.
- Move focus in response to a user action or to recover focus when its target disappears. Background updates, streamed output, toasts, and incoming prompts must not steal focus.
- If a focused item is closed or deleted, move focus to the next place the user can continue the same task: the next or previous item in the same list, or a stable fallback such as the list heading or the control that opened it. Use the visually nearest control only when it serves that task. Don’t leave focus on `<body>`.
- Chromium drops focus to `<body>` without an event when the focused element is removed, disabled, or stops being editable. `packages/ui/src/context/focus-rescue.tsx` (installed in `AppBaseProviders`) recovers it inside a `data-focus-scope`: the next item, or the previous after the last, widening to the enclosing scope when the inner one is empty, and back to what had focus before when nothing is left. The control it moves focus to shows its ring only when Tab or an arrow key last moved focus; typing, shortcuts and a key pressed on a clicked control don't count. Mark a new list, strip, chip row or panel with `data-focus-scope` rather than adding per-feature focus code. Rescue never moves focus into a `role="tablist"`, because Kobalte tabs select themselves on focus, so don't mark a tab list as a scope. Items in an overlay leave the return to the overlay; rescue steps in only when the overlay's opener is gone too. Move focus explicitly when the task has a better target than the neighbour, such as the composer after the last chip.
- A row that scrolls out of a virtualized list is not a removed item. The list unmounts it with its focused control, and the rescue would then focus a control in another row, which scrolls the list to that row. The list gives focus to its own viewport first, with `preventScroll: true`, as `VirtualRow` does in `packages/app/src/session/timeline/virtualizer.tsx`. Do the same in a new virtualized list.
- `focus()` scrolls its target into view. Inside a scroll container, pass `{ preventScroll: true }` unless the reader must see that control next: keyboard navigation to it, or the item that takes the place of a removed one (`packages/app/AGENTS.md`, Timeline stability).
## Verify
- A story is optional, for visual checks such as clipping, colour, and forced colours. Use one if the repo has a suitable focus story, or a local one you don't commit; don't add a case for every fix. Test focus order, removal and restoration in the app with real input, not in a story.
- Use real keyboard and pointer input for the behaviour you changed. Check Tab and Shift+Tab for order and clipping, and when you replace a control, remove a ring or reuse a picker, run them through the whole changed flow and check both where focus lands and whether you can see it. Check arrow keys for composites, and shortcuts for programmatic focus. For overlay return, check keyboard open with Escape, keyboard open with a pointer dismissal, pointer open with a backdrop click, and pointer open with Escape. Forced focus shows appearance, not whether navigation or restoration works.
- After a change to focus in or near the timeline, click a tool header in it, then scroll up and down with the wheel. The timeline must follow the wheel.
- Check light, dark, and forced colours when the indicator or its background changes. Report Chromium forced-colours emulation (DevTools → Rendering → `forced-colors: active`) separately from native Windows High Contrast or assistive-technology testing.

View file

@ -23,6 +23,40 @@
] ]
}, },
"overrides": [ "overrides": [
{
"files": ["packages/ai/src/**"],
"rules": {
"no-restricted-globals": [
"error",
{
"name": "Reflect",
"message": "Use typed property access or direct invocation. Suppress this rule only for genuine reflection."
},
{
"name": "fetch",
"message": "Send HTTP through RequestExecutor, which applies executor-wide and scoped middleware (HTTP hooks). A request sent any other way skips them."
}
],
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "effect/http",
"importNames": ["HttpClient", "FetchHttpClient"],
"message": "Send HTTP through RequestExecutor, which applies executor-wide and scoped middleware (HTTP hooks). Only route/executor.ts holds the HTTP client."
}
]
}
]
}
},
{
"files": ["packages/ai/src/route/executor.ts"],
"rules": {
"no-restricted-imports": "off"
}
},
{ {
"files": [ "files": [
"packages/app/**", "packages/app/**",
@ -145,33 +179,6 @@
} }
] ]
} }
},
{
"files": ["packages/codemode/src/interpreter/**", "packages/codemode/src/stdlib/**"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "effect",
"allowTypeImports": true,
"message": "The evaluator and built-ins are plain generators driven by the job queue in runner.ts. Start host work with runner.host or block on it with runner.blocking; only runner.ts, execute.ts, and extensions.ts run Effects."
}
]
}
]
}
},
{
"files": [
"packages/codemode/src/interpreter/runner.ts",
"packages/codemode/src/interpreter/execute.ts",
"packages/codemode/src/interpreter/extensions.ts"
],
"rules": {
"no-restricted-imports": "off"
}
} }
], ],
"ignorePatterns": [ "ignorePatterns": [
@ -181,6 +188,7 @@
"**/.sst", "**/.sst",
"**/*.d.ts", "**/*.d.ts",
"**/sdk.gen.ts", "**/sdk.gen.ts",
"packages/cli-rs/**",
"packages/plugins/figma/skills/**", "packages/plugins/figma/skills/**",
".agent/**", ".agent/**",
".agents/**", ".agents/**",

View file

@ -2,4 +2,5 @@ sst-env.d.ts
packages/desktop/src/bindings.ts packages/desktop/src/bindings.ts
packages/client/src/generated/ packages/client/src/generated/
packages/client/src/generated-effect/ packages/client/src/generated-effect/
packages/core/src/plugin/skill/opencode/
packages/plugins/figma/skills/ packages/plugins/figma/skills/

View file

@ -182,8 +182,8 @@ const table = sqliteTable("session", {
- When you open a PR, decide whether the change needs a flag: new user-visible behavior, risky core changes, and anything not ready to release get one; fixes, refactors, docs and tests do not. - When you open a PR, decide whether the change needs a flag: new user-visible behavior, risky core changes, and anything not ready to release get one; fixes, refactors, docs and tests do not.
- Gate risky behavior, or behavior that lands over several PRs, with a key and a description in `packages/schema/src/config/flag.ts`, and read it with `Flag.enabled("<key>")` from `@opencode/core/flag`. - Gate risky behavior, or behavior that lands over several PRs, with a key and a description in `packages/schema/src/config/flag.ts`, and read it with `Flag.enabled("<key>")` from `@opencode/core/flag`.
- Flags are on in local and dev builds and off in releases; `experimental.<key>` in config and `OPENCODE_FLAGS="key,-other"` override that. - Flags default to on in local and dev builds and off in releases, except `optInOnly` flags (such as `todo`), which require an explicit `OPENCODE_FLAGS=<key>` or `experimental.<key>: true` in every build.
- Say in the PR body which flag guards the change. To try every flag at once, use `OPENCODE_FLAGS=all` or `experimental.all_flags: true`; a `-<key>` opt-out or `experimental.<key>: false` still wins, and neither `all` nor `all_flags` is a flag key. - Say in the PR body which flag guards the change. The reserved switches `OPENCODE_FLAGS=all` and `experimental.all_flags: true` skip opt-in-only flags; use `all,-<key>` or `experimental.<key>: false` to opt out within the respective source.
- Ship a feature by deleting its flag and the checks that read it. - Ship a feature by deleting its flag and the checks that read it.
## Testing ## Testing
@ -202,8 +202,7 @@ const table = sqliteTable("session", {
## Plugin Loading ## Plugin Loading
- Plugins load asynchronously. Server handlers never wait for them (`Plugin.awaitActivation`), never retry until something appears, and never turn slow plugins into a timeout or 503. This applies to reads and to actions such as `rpc.call` and `vcs.init`. - Plugins load asynchronously. Server handlers never wait for them (`Plugin.awaitActivation`), never retry until something appears, and never turn slow plugins into a timeout or 503. This applies to reads and to actions such as `generate.*`, `rpc.call`, `vcs.init` and `websearch.query`.
- Temporary exception: endpoints that list or use providers managed policy can deny (`model.list`, `model.default`, `provider.list`, `generate.*`, `voice.*` and `websearch.query`) wait through `awaitPlugins` in `packages/server/src/location.ts`, because policy is applied by the last plugin to activate and is missing until then. Don't add new waits; this goes away once a plugin batch becomes visible only when it ends.
- The server answers with what is loaded now: lists may be empty or partial on a cold Location, and an action whose model, provider or RPC hasn't loaded yet fails with not-found. That is expected, not a bug to fix on the server. - The server answers with what is loaded now: lists may be empty or partial on a cold Location, and an action whose model, provider or RPC hasn't loaded yet fails with not-found. That is expected, not a bug to fix on the server.
- Clients are responsible for making sure what they need is loaded before they call. Long-lived clients refresh on the matching `*.updated` event (`model.updated`, `agent.updated`, `skill.updated`, `integration.updated`, `plugin.updated`, ...). One-shot clients (CLI commands, ACP, SDK callers) wait on their side, for example by polling `plugin.list` or the entry they need. See `packages/cli/src/services/plugin-startup.ts`. - Clients are responsible for making sure what they need is loaded before they call. Long-lived clients refresh on the matching `*.updated` event (`model.updated`, `agent.updated`, `skill.updated`, `integration.updated`, `plugin.updated`, ...). One-shot clients (CLI commands, ACP, SDK callers) wait on their side, for example by polling `plugin.list` or the entry they need. See `packages/cli/src/services/plugin-startup.ts`.
- Running the hooks that are registered and waiting for their result is fine (for example `hooks.trigger("session", "http.request", ...)`). What is not allowed is waiting for plugins to load first: if the plugin that adds a hook hasn't loaded yet, the call runs without that hook. - Running the hooks that are registered and waiting for their result is fine (for example `hooks.trigger("session", "http.request", ...)`). What is not allowed is waiting for plugins to load first: if the plugin that adds a hook hasn't loaded yet, the call runs without that hook.
@ -216,7 +215,7 @@ const table = sqliteTable("session", {
- Keep `SessionExecution` process-global and Session-ID based. Its local implementation owns the process-local Session coordinator and discovers placement through `SessionStore` plus `LocationServiceMap.get(session.location)` only when a drain starts; no layer should take a Session ID. Interruption targets the active process-local ownership chain for that Session; interruption of a known but idle or locally unowned Session is a no-op, while the public API rejects an unknown Session. - Keep `SessionExecution` process-global and Session-ID based. Its local implementation owns the process-local Session coordinator and discovers placement through `SessionStore` plus `LocationServiceMap.get(session.location)` only when a drain starts; no layer should take a Session ID. Interruption targets the active process-local ownership chain for that Session; interruption of a known but idle or locally unowned Session is a no-op, while the public API rejects an unknown Session.
- Keep `SessionRunner`, model resolution, tool registry, permissions, and filesystem Location-scoped. Omitted `Location.workspaceID` means implicit-local placement; explicit workspace identity remains reserved for future placement semantics. - Keep `SessionRunner`, model resolution, tool registry, permissions, and filesystem Location-scoped. Omitted `Location.workspaceID` means implicit-local placement; explicit workspace identity remains reserved for future placement semantics.
- Each step is one explicit `llm.stream` call that continues from reloaded history. Do not add an in-memory tool loop. - Each step is one explicit `llm.stream` call that continues from reloaded history. Do not add an in-memory tool loop.
- Keep local Session drains process-local until clustering is implemented. `SessionRunCoordinator` joins explicit same-Session resumes, coalesces prompt wakeups, and allows different Sessions to run concurrently. A write-ahead execution claim marks a process-local busy period for restart recovery: terminal completion, failure, or user interruption releases it, while shutdown interruption and process death preserve it. Startup recovery resumes claimed top-level Sessions with durable per-execution attempt accounting. The claim is a recovery marker, not clustered ownership, fencing, or an exactly-once guarantee. - Keep local Session drains process-local until clustering is implemented. `SessionRunCoordinator` joins explicit same-Session resumes, coalesces prompt wakeups, and allows different Sessions to run concurrently. A write-ahead execution claim marks a process-local busy period for restart recovery: terminal completion, failure, or user interruption releases it, while shutdown interruption and process death preserve it. Startup recovery resumes claimed Sessions with durable per-execution attempt accounting. Running subagent Jobs own recovery of the children they represent. The claim is a recovery marker, not clustered ownership, fencing, or an exactly-once guarantee.
- Keep delivery vocabulary explicit. Prompts steer by default. At safe step boundaries, steered compaction takes priority up to the first steered move control; other steers retain enqueue order. At an idle boundary, steers take priority; otherwise exactly one queued item delivers before the runner reevaluates continuation. Inbox items may be cancelled or changed between queue and steer before delivery. Promoting new user input resets the selected agent's step allowance; a batch of steers resets it once. - Keep delivery vocabulary explicit. Prompts steer by default. At safe step boundaries, steered compaction takes priority up to the first steered move control; other steers retain enqueue order. At an idle boundary, steers take priority; otherwise exactly one queued item delivers before the runner reevaluates continuation. Inbox items may be cancelled or changed between queue and steer before delivery. Promoting new user input resets the selected agent's step allowance; a batch of steers resets it once.
- One step is one logical LLM call; its durable record covers only the model-visible span. Do not write "provider turn", and do not use bare "turn" for a single call: "turn" is reserved for the future assistant-turn unit containing all steps from prompt promotion until the session would go idle. - One step is one logical LLM call; its durable record covers only the model-visible span. Do not write "provider turn", and do not use bare "turn" for a single call: "turn" is reserved for the future assistant-turn unit containing all steps from prompt promotion until the session would go idle.
- Keep event replay ownership separate from clustered Session execution ownership. - Keep event replay ownership separate from clustered Session execution ownership.

View file

@ -2,6 +2,489 @@
Release notes for OpenCode V2, newest first. Release notes for OpenCode V2, newest first.
## v2.4.1 — 2026-11-23
### Highlights
- **macOS 12 Session Fix**: OpenCode can save assistant messages again on the older SQLite version included with macOS 12. ([#65771](https://github.com/anomalyco/opencode/pull/65771))
- **Config-Only Providers Show Their Models**: Providers you set up only in your config, such as Ollama, now show their models in `/models` without a `/connect` login. ([#65793](https://github.com/anomalyco/opencode/pull/65793))
- **Unread `/btw` Answers**: When a side question finishes behind another side-panel tab, its tab shows an unread dot until you open it. ([#65821](https://github.com/anomalyco/opencode/pull/65821))
### Core
#### Improvements
- With `experimental.model_speeds` enabled, model service tiers are exposed as remembered speeds instead of separate model-picker entries. ([#65749](https://github.com/anomalyco/opencode/pull/65749))
#### Bug fixes
- Fixed assistant messages failing to save on macOS 12 because its system SQLite does not support the JSON operator used in v2.4.0. ([#65771](https://github.com/anomalyco/opencode/pull/65771))
- Fixed compaction retaining more recent history than `keep.tokens`, including when a single newest message already exceeds the allowance. ([#65768](https://github.com/anomalyco/opencode/pull/65768))
- Fixed occasional extra cache cost in long goal sessions after a compaction. ([#65788](https://github.com/anomalyco/opencode/pull/65788))
### TUI
#### Improvements
- With `experimental.model_speeds` enabled, `/speed` and `/fast` list the current model’s service tiers and relative prices. The `speed.list` and `speed.cycle` keybinds are available without default bindings. ([#65749](https://github.com/anomalyco/opencode/pull/65749))
#### Bug fixes
- Fixed `/models` hiding models from config-only providers such as Ollama when no `/connect` login exists. ([#65793](https://github.com/anomalyco/opencode/pull/65793))
### Desktop
#### Improvements
- With `experimental.model_speeds` enabled, models with service tiers have a speed dropdown beside the variant selector; `/speed` cycles through the available speeds. ([#65749](https://github.com/anomalyco/opencode/pull/65749))
- Layout choices in Settings now use consistent navigation-card previews and accent styling. ([#65757](https://github.com/anomalyco/opencode/pull/65757), [#65800](https://github.com/anomalyco/opencode/pull/65800))
#### Bug fixes
- Fixed `/btw` answers completed behind another side-panel tab providing no unread indication. The tab now shows a dot until viewed. ([#65821](https://github.com/anomalyco/opencode/pull/65821))
- Fixed the timeline, Home list, file viewers and tool output adding invisible or oversized stops to keyboard Tab navigation. They remain focusable by clicking for keyboard scrolling. ([#65758](https://github.com/anomalyco/opencode/pull/65758), [#65785](https://github.com/anomalyco/opencode/pull/65785))
- Fixed unwanted focus rings around clicked Settings pages, error details, What’s New and the terminal, and corrected the split button’s focus-ring corners. ([#65783](https://github.com/anomalyco/opencode/pull/65783), [#65785](https://github.com/anomalyco/opencode/pull/65785))
- Fixed folder paths showing middle-truncation markers unnecessarily at fractional UI zoom levels. ([#65225](https://github.com/anomalyco/opencode/pull/65225))
### SDK
#### Bug fixes
- An aborted shared event subscription now stops immediately even when the source has already completed or failed with buffered events remaining. Thanks @chirag127. ([#65441](https://github.com/anomalyco/opencode/pull/65441))
### Extensions
#### Improvements
- Effect and Promise plugins can create, list and delete automations through `ctx.experimental.automation.{create,list,delete}`. ([#65747](https://github.com/anomalyco/opencode/pull/65747))
- `@opencode/plugin` now supports `@opentui/core` and `@opentui/solid` from version 0.8.0, allowing plugins capped below OpenTUI 0.9 to install again. ([#65819](https://github.com/anomalyco/opencode/pull/65819))
## v2.4.0 — 2026-11-23
### Highlights
- **Built-In Desktop Browser**: Import your sign-ins and browsing history from Chrome, Edge, Firefox or Safari, and add extensions from Chromium browsers or the Chrome and Edge stores. Everything stays in one persistent desktop profile: chat links open signed in, your tabs survive restarts and the agent can read and drive the same pages without you switching apps. ([#63002](https://github.com/anomalyco/opencode/pull/63002), [#65073](https://github.com/anomalyco/opencode/pull/65073))
- **Automations**: Ask the agent to run a prompt, a script or a shell command on a timer, on a cron schedule or when an MCP server sends an event, and manage them with `/automation`. Set `"automations": false` in your config if you don't want them. ([#65296](https://github.com/anomalyco/opencode/pull/65296), [#65186](https://github.com/anomalyco/opencode/pull/65186))
- **Generate Videos**: When a connected provider has a video model, the agent can make videos with `generate_video`. It keeps working while the video renders and saves the files into your workspace when they're ready. ([#63666](https://github.com/anomalyco/opencode/pull/63666), [#65664](https://github.com/anomalyco/opencode/pull/65664))
- **New TUI Look**: The TUI's new designs are on by default, and the `opencode` theme is the new one. Pick `opencode-classic` in **Theme** to keep the previous colors. ([#64988](https://github.com/anomalyco/opencode/pull/64988))
- **Windows Taskbar Status**: On Windows, the taskbar button shows session progress, counts sessions that need you and flashes when a permission or question is waiting. ([#65317](https://github.com/anomalyco/opencode/pull/65317), [#65318](https://github.com/anomalyco/opencode/pull/65318), [#65319](https://github.com/anomalyco/opencode/pull/65319))
### Upgrade notes
- **Image tool renamed.** `experimental_image_generate` is now `generate_image`. Permission rules with the old name are mapped automatically, but saved "always allow" approvals are not, so it asks again once. ([#65682](https://github.com/anomalyco/opencode/pull/65682))
- **Plugins that follow a version now update on their own.** A plugin written as `name@latest`, a version range (such as `name@^1.2.0`), a Git branch or a Git `semver:` range is checked on startup and every 24 hours, and a newer match is installed and reloaded. Ranges never leave their range, and if a new version fails to load the previous one keeps running. A bare `name`, an exact version, another tag such as `@next`, a Git tag or a commit hash doesn't update itself; `opencode plugin update` still updates those by hand. ([#64764](https://github.com/anomalyco/opencode/pull/64764), [#65052](https://github.com/anomalyco/opencode/pull/65052), [#65056](https://github.com/anomalyco/opencode/pull/65056))
- **GitHub Copilot no longer reads `GITHUB_TOKEN`.** Set `COPILOT_GITHUB_TOKEN` or sign in with OAuth. ([#64697](https://github.com/anomalyco/opencode/pull/64697))
- **MCP servers are tried on the newest protocol first.** A server without a `protocol` setting is probed before falling back to the legacy handshake. Set `protocol: "legacy"` on a server that misbehaves. ([#65282](https://github.com/anomalyco/opencode/pull/65282))
- **The TUI `opencode` theme changed.** It now means the new theme; set `opencode-classic` for the previous look, and `experimental["new-designs"]: false` in your TUI config for the previous designs. ([#64988](https://github.com/anomalyco/opencode/pull/64988))
- **Chat links open in the browser pane.** In the desktop app, web links from the chat open beside the conversation. Modifier-click a link to open it in your system browser. A `browser` deny in your permission rules refuses every agent browser call. ([#63002](https://github.com/anomalyco/opencode/pull/63002))
- **OpenCode Go connects through OpenCode.** The connect dialogs and `opencode auth login` list one **OpenCode** option that includes Go models. **OpenCode Go** is only listed when a Go key is already saved, and saved keys keep working. ([#65466](https://github.com/anomalyco/opencode/pull/65466))
- **New desktop shortcut.** `Cmd+Shift+S` (`Ctrl+Shift+S` on Windows and Linux) now archives the open session. The composer's `Cmd+U` and `Escape`/`Ctrl+G` now follow the **Attach file** and **Stop session** shortcuts. ([#65428](https://github.com/anomalyco/opencode/pull/65428), [#64394](https://github.com/anomalyco/opencode/pull/64394))
- **Code Mode session tool paths moved.** `tools.opencode.session_rename` and `session_move` are now `tools.opencode.session.rename` and `.move`. Direct tool names and permission actions are unchanged. ([#65080](https://github.com/anomalyco/opencode/pull/65080))
- **TUI plugins need OpenTUI 0.9.4.** `@opencode/plugin` requires `@opentui/core` and `@opentui/solid` 0.9.4 or later. Renderers passed to `registerCodeBlockRenderer` now receive an OpenTUI block (`block.text`) instead of a Markdown token; `codeBlockStyle` and `escaped` are gone. ([#63989](https://github.com/anomalyco/opencode/pull/63989))
- **SDK: plugins load in the background again.** Plugins are meant to load asynchronously, and the server never waits for them. In v2.2.7 the model, provider, `generate.*`, `voice.*` and `websearch.query` endpoints started waiting up to 5 seconds for plugins and returning 503 after that ([#63040](https://github.com/anomalyco/opencode/pull/63040)); this release removes that wait. Right after startup these endpoints answer with whatever has loaded, so a list can be empty or partial. Long-lived clients should refresh on the matching `*.updated` event, such as `model.updated`. One-shot scripts should wait on their side, for example by polling `plugin.list` until it returns plugins, or the endpoint until the entry they need appears. ([#63814](https://github.com/anomalyco/opencode/pull/63814))
- **Desktop voice needs a matching server.** The app reads each voice model's engine, which older servers don't report, so voice shows as unavailable against a server from before this release. ([#65506](https://github.com/anomalyco/opencode/pull/65506))
- **Storage write path.** Assistant parts are now saved as their own rows. `experimental.part_rows: false` restores the old path for this release. ([#65039](https://github.com/anomalyco/opencode/pull/65039))
### Core
#### Improvements
- Added automations. Agents can schedule prompts, Code Mode scripts or fixed shell commands to run once, on an interval, on a cron schedule or when a connected MCP server pushes an event. Use the `/automation` command or the `automation` tools. A shell action asks for approval once, when it's created, and records each run's exit code and output. Set `"automations": false` to turn them off. ([#65296](https://github.com/anomalyco/opencode/pull/65296), [#65186](https://github.com/anomalyco/opencode/pull/65186), [#65217](https://github.com/anomalyco/opencode/pull/65217), [#65236](https://github.com/anomalyco/opencode/pull/65236), [#65001](https://github.com/anomalyco/opencode/pull/65001), [#65699](https://github.com/anomalyco/opencode/pull/65699))
- MCP Events shipped: OpenCode follows the MCP Events beta for push delivery, with argument checks, heartbeats and automatic reconnects. An event too large for its prompt is skipped and its automation keeps running. ([#65271](https://github.com/anomalyco/opencode/pull/65271), [#65673](https://github.com/anomalyco/opencode/pull/65673))
- MCP servers without a `protocol` setting now negotiate the newest MCP protocol and fall back to the legacy handshake. ([#65282](https://github.com/anomalyco/opencode/pull/65282))
- Agents can generate videos with `generate_video` whenever a connected provider has a video model. The job runs in the background, survives a server restart, saves the finished videos into the workspace and wakes the agent with their paths. Set a default model with `experimental.video_generate.model`. The image tool is now called `generate_image`. ([#63666](https://github.com/anomalyco/opencode/pull/63666), [#64546](https://github.com/anomalyco/opencode/pull/64546), [#65664](https://github.com/anomalyco/opencode/pull/65664), [#65682](https://github.com/anomalyco/opencode/pull/65682))
- Plugins that follow a version (`name@latest`, a version range, a Git branch or a Git `semver:` range) are checked on startup and every 24 hours, and a newer match is installed and reloaded without a restart. A range stays within its range, and if a new version fails to load, the previous one keeps running. Other plugins still only report updates. ([#64764](https://github.com/anomalyco/opencode/pull/64764), [#65052](https://github.com/anomalyco/opencode/pull/65052), [#65056](https://github.com/anomalyco/opencode/pull/65056))
- The Claude Agent provider has a `configDir` setting for a Claude config folder other than the default. Given a list of folders, a chat moves to the next account when one hits its usage limit. Claude Agent sessions also show up in Claude Code as coming from `opencode`. ([#62514](https://github.com/anomalyco/opencode/pull/62514), [#65035](https://github.com/anomalyco/opencode/pull/65035), [#65016](https://github.com/anomalyco/opencode/pull/65016))
- Removing a Sign in with ChatGPT account, with `opencode auth logout` or the remove button in the app, now also revokes it with OpenAI. ([#64947](https://github.com/anomalyco/opencode/pull/64947))
- The ChatGPT plan model lists now come from models.dev, so new models show up without an OpenCode update. ([#65579](https://github.com/anomalyco/opencode/pull/65579))
- Voice models are now listed from models.dev, adding newer OpenAI models such as `gpt-live-1.1`. ([#65491](https://github.com/anomalyco/opencode/pull/65491))
- Reading far into a large file with `read`, or reading its tail, takes far fewer reads, which is much faster on remote workspaces. ([#65611](https://github.com/anomalyco/opencode/pull/65611))
- The shell tool's result says why a command ended without an exit code, and lists its output after the smaller fields so they survive truncation. ([#65365](https://github.com/anomalyco/opencode/pull/65365), [#65513](https://github.com/anomalyco/opencode/pull/65513))
- Code Mode scripts can define getters and setters, errors have a `stack` showing where they were thrown, and a failed import says why. ([#64908](https://github.com/anomalyco/opencode/pull/64908), [#64939](https://github.com/anomalyco/opencode/pull/64939), [#64587](https://github.com/anomalyco/opencode/pull/64587))
- A `timeout` set on a provider now applies to every request, including image, video, speech, transcription, embedding and compaction requests, which previously could hang forever on a stalled provider. ([#64692](https://github.com/anomalyco/opencode/pull/64692))
- Gemma 4 models on Google's Interactions API offer the `none` and `thinking` variants, and the provider's `safetySettings` are sent to Interactions. ([#65038](https://github.com/anomalyco/opencode/pull/65038), [#65036](https://github.com/anomalyco/opencode/pull/65036))
- Added `claude-agent` as a web search provider. With Claude Agent connected, set `"websearch": { "provider": "claude-agent" }` to run `websearch` through Claude Code's WebSearch, which Claude plans include, so any model can search without a search API key. ([#65704](https://github.com/anomalyco/opencode/pull/65704))
- With `full_codemode` on, agents can call `tools.opencode.session.interrupt` to stop another session, its background jobs and its subagents. ([#65718](https://github.com/anomalyco/opencode/pull/65718))
- Stored blobs, such as generated videos, are deleted a week after they were written, so the data folder no longer grows without limit. Copies saved into your project are untouched; `GET /api/experimental/blob/:id` returns 404 for a deleted blob. ([#65671](https://github.com/anomalyco/opencode/pull/65671))
- Config now reloads only when a file that feeds it changes, not on every write under `.opencode` such as editing a skill. ([#62158](https://github.com/anomalyco/opencode/pull/62158))
- Each streamed assistant part is saved as its own row instead of rewriting the whole message on every update, so long steps with many tool calls save reliably. ([#65039](https://github.com/anomalyco/opencode/pull/65039))
#### Bug fixes
- Fixed GitHub Copilot picking up `GITHUB_TOKEN`, which git tooling and GitHub Actions often set without Copilot access. It now reads `COPILOT_GITHUB_TOKEN`. ([#64697](https://github.com/anomalyco/opencode/pull/64697))
- Fixed shell commands the scanner can't analyze, such as dynamic execution, failing outright. They now ask for permission, and a matching `shell` deny rule still blocks them. ([#65269](https://github.com/anomalyco/opencode/pull/65269))
- Fixed sessions getting stuck on provider 400 errors after a model called a tool by a dotted name such as a Code Mode path. A Code Mode tool called at the top level now runs as that tool, with a note telling the model to use `execute`. ([#65292](https://github.com/anomalyco/opencode/pull/65292), [#65193](https://github.com/anomalyco/opencode/pull/65193), [#65494](https://github.com/anomalyco/opencode/pull/65494))
- Fixed a forced tool choice for a namespaced tool naming a tool the request never declared on every provider except native OpenAI Responses. ([#65621](https://github.com/anomalyco/opencode/pull/65621), [#65726](https://github.com/anomalyco/opencode/pull/65726))
- Fixed the shell tool's description not saying which OS and shell commands run in when `full_codemode` is on. ([#65712](https://github.com/anomalyco/opencode/pull/65712))
- Fixed a revoked or expired ChatGPT sign-in failing every prompt with "Request failed: 400". It now asks you to connect again. ([#65289](https://github.com/anomalyco/opencode/pull/65289))
- Fixed `edit` and `patch` replacing every non-UTF-8 character (Latin-1, cp1252, GBK…) with `<60>` across the whole file. They now refuse to rewrite such files. ([#64868](https://github.com/anomalyco/opencode/pull/64868))
- Fixed the review pane showing every line as changed in repositories with `core.autocrlf=true`, and symlinks as modified with `core.symlinks=false`. ([#64884](https://github.com/anomalyco/opencode/pull/64884))
- Fixed file permission rules not matching other capitalizations of the same path on macOS. Thanks @knp-sap. ([#64626](https://github.com/anomalyco/opencode/pull/64626))
- Fixed the model picker staying empty while a slow project was still loading. ([#63814](https://github.com/anomalyco/opencode/pull/63814))
- Fixed Claude Agent processes staying alive after their session was deleted. Thanks @WTLAIB. ([#62649](https://github.com/anomalyco/opencode/pull/62649))
- Fixed Claude Agent models becoming unavailable after Claude Code renamed them, and Claude Agent now waits up to 60 seconds for its process to start. ([#65032](https://github.com/anomalyco/opencode/pull/65032), [#65064](https://github.com/anomalyco/opencode/pull/65064))
- Fixed shell commands failing with "failed to open output file" after OpenCode's shell output directory was removed. ([#64889](https://github.com/anomalyco/opencode/pull/64889))
- Fixed concurrent shell commands failing on Windows with PowerShell 7 from the Microsoft Store, and stopping one such command killing the others. ([#64901](https://github.com/anomalyco/opencode/pull/64901))
- Fixed `opencode service set password` writing the password to the CLI log. ([#64911](https://github.com/anomalyco/opencode/pull/64911))
- Fixed `opencode run` hanging when a FIFO is passed as an attachment; it's now rejected right away. Thanks @yang0228. ([#64696](https://github.com/anomalyco/opencode/pull/64696))
- Fixed `opencode <name>` crashing with a stack trace when `<name>` is neither a command nor a directory. It now prints help and the error. ([#65262](https://github.com/anomalyco/opencode/pull/65262))
- Fixed the background service becoming unresponsive at startup with a large database write-ahead log on a slow disk. ([#64532](https://github.com/anomalyco/opencode/pull/64532))
- Fixed a client that opens a session during a running tool call not seeing that tool's progress, such as a running subagent's session. ([#64929](https://github.com/anomalyco/opencode/pull/64929))
- Fixed Markdown commands dropping a separate `variant` next to `model`, and agents being skipped when frontmatter repair turned inline lists or objects into strings. ([#65118](https://github.com/anomalyco/opencode/pull/65118), [#65119](https://github.com/anomalyco/opencode/pull/65119))
- Fixed Google Interactions responses stopping early when Google splits a response across requests. ([#65006](https://github.com/anomalyco/opencode/pull/65006))
- Fixed GPT models over OpenAI's WebSocket transport resending the whole conversation after a freeform tool call such as `execute` or `patch`. ([#64706](https://github.com/anomalyco/opencode/pull/64706))
- Fixed `gpt-6.2-astra` and later Astra models getting a 500k context window with ChatGPT sign-in; they stay at 272k. ([#64725](https://github.com/anomalyco/opencode/pull/64725))
- OpenAI `cyber_policy` and Gemini "terms of use" refusals are now reported as content policy errors. Thanks @lu-zero. ([#64844](https://github.com/anomalyco/opencode/pull/64844), [#64910](https://github.com/anomalyco/opencode/pull/64910))
- Fixed MiniMax text-to-video requests without an aspect ratio being rejected; they now default to `16:9`. ([#64822](https://github.com/anomalyco/opencode/pull/64822))
- Fixed several Code Mode built-ins to match Bun: `localeCompare` and `Date` `toLocale*` honor their locale and options, `toBase64`/`fromBase64` honor their options, `Buffer` `map`, `filter`, `slice` and `subarray` return a Buffer, and `Uint8Array.BYTES_PER_ELEMENT` is defined. ([#64935](https://github.com/anomalyco/opencode/pull/64935), [#64938](https://github.com/anomalyco/opencode/pull/64938), [#64931](https://github.com/anomalyco/opencode/pull/64931), [#64933](https://github.com/anomalyco/opencode/pull/64933), [#64930](https://github.com/anomalyco/opencode/pull/64930), [#64965](https://github.com/anomalyco/opencode/pull/64965))
- Fixed large file views not refreshing when only the end of the file changed. ([#65114](https://github.com/anomalyco/opencode/pull/65114))
- Fixed the install script failing with a disk-space error when `curl` is installed through Snap. ([#65132](https://github.com/anomalyco/opencode/pull/65132))
### TUI
#### Improvements
- The new TUI designs are on by default, and the theme named `opencode` is the new theme. The previous default is available as `opencode-classic`, and `opencode2` keeps working as an alias of `opencode`. To go back to the previous designs, turn off **New designs** in the Experiments dialog. ([#64988](https://github.com/anomalyco/opencode/pull/64988))
- `/login` and `/auth` open the same dialog as `/connect`, which now lists a single **OpenCode** entry that includes OpenCode Go models. ([#65265](https://github.com/anomalyco/opencode/pull/65265), [#65466](https://github.com/anomalyco/opencode/pull/65466))
- Pressing `↓` opens the picker on the first tab with something running, the same tab that clicking the footer opens. ([#64972](https://github.com/anomalyco/opencode/pull/64972))
- Text prompt dialogs such as rename session, `/btw`, worktree names and connect forms end with a **Submit** button, and prompt and export dialogs have tighter spacing. ([#64944](https://github.com/anomalyco/opencode/pull/64944))
- The `opencode` theme's light mode uses lighter grays for the prompt box, selected tabs and hovered rows. ([#64962](https://github.com/anomalyco/opencode/pull/64962))
#### Bug fixes
- Fixed connect forms built from integration fields, such as the Azure resource name, showing an empty row between the title and the input. ([#64944](https://github.com/anomalyco/opencode/pull/64944))
- Fixed list dialogs ending with two blank rows, and the **Manage workspaces** footer not staying at the bottom. ([#64983](https://github.com/anomalyco/opencode/pull/64983))
- Fixed long dialog lists replacing their last visible row with a stray `…`. ([#64934](https://github.com/anomalyco/opencode/pull/64934))
- Fixed the selection bar of a delete-confirmation row staying blue instead of red. ([#64936](https://github.com/anomalyco/opencode/pull/64936))
- Fixed file, agent and skill mentions landing on the wrong text when you restore a prompt sent from the desktop or web app that contains tabs or wide characters. ([#63989](https://github.com/anomalyco/opencode/pull/63989))
### Desktop
#### Improvements
- The browser pane keeps you signed in. Links from the chat open beside the conversation in one saved profile, you can import sign-ins and browsing history from Chrome, Edge, Firefox, Safari and other browsers, and you can install store extensions after reviewing what they can access. The pane gains a right-click menu, find in page, page dialogs, permission prompts, pop-up blocking and readable error pages, and the address bar completes from your history. The agent can read and drive the same signed-in tabs. ([#63002](https://github.com/anomalyco/opencode/pull/63002), [#65073](https://github.com/anomalyco/opencode/pull/65073))
- New tabs that a page opens in the browser pane appear beside the tab they came from, and middle-clicking a link opens it in a new tab. ([#65126](https://github.com/anomalyco/opencode/pull/65126), [#65091](https://github.com/anomalyco/opencode/pull/65091))
- Comments in the browser pane, file viewer and review diff can be sent to the session right away with `Mod+Enter`. Depending on your follow-up setting, they send, steer or queue. ([#65264](https://github.com/anomalyco/opencode/pull/65264))
- Added **Wrap code blocks** under Settings › General › Timeline, plus a **Wrap lines** button on timeline code blocks with lines too long to fit. ([#64545](https://github.com/anomalyco/opencode/pull/64545), [#64576](https://github.com/anomalyco/opencode/pull/64576))
- Added **Keep side panel open across sessions** in Settings › General. ([#64950](https://github.com/anomalyco/opencode/pull/64950))
- Added an **Archive session** command, bound to `Cmd+Shift+S` (`Ctrl+Shift+S` on Windows and Linux). ([#65428](https://github.com/anomalyco/opencode/pull/65428))
- The Home session menu has **Open** and **Open in background**, and Home shows the provider connect hint when nothing is connected. ([#65209](https://github.com/anomalyco/opencode/pull/65209), [#65212](https://github.com/anomalyco/opencode/pull/65212), [#64885](https://github.com/anomalyco/opencode/pull/64885))
- The Inbox layout's sidebar has a **Drafts** group for unsent new-session drafts. ([#65525](https://github.com/anomalyco/opencode/pull/65525))
- Conversation search (`Cmd+F` / `Ctrl+F`) has previous and next match buttons. ([#64865](https://github.com/anomalyco/opencode/pull/64865))
- The connect dialog lists one **OpenCode** option that includes OpenCode Go models, Settings › Providers follows the same rule, and the free model picker has a tighter layout. ([#65466](https://github.com/anomalyco/opencode/pull/65466), [#65740](https://github.com/anomalyco/opencode/pull/65740), [#64927](https://github.com/anomalyco/opencode/pull/64927))
- When you reach your ChatGPT Business workspace's usage limit, a dialog explains it and offers **Copy request for admin**. ([#64926](https://github.com/anomalyco/opencode/pull/64926))
- Voice uses the newest GPT-Live model the server lists. ([#65506](https://github.com/anomalyco/opencode/pull/65506))
- Shortcuts go through the same keymap engine as the TUI, and the new **Stop session** command can be changed in Settings › Shortcuts. ([#64394](https://github.com/anomalyco/opencode/pull/64394))
- Shortcuts can be key chords, such as `Mod+K Mod+C` or `G I`. In Settings › Shortcuts, click **+** on a shortcut you just recorded to add another key, up to 4. While a chord is pending, a panel lists the keys that continue it. ([#64395](https://github.com/anomalyco/opencode/pull/64395))
- The activity pill keeps a subagent listed while work it started is still running. ([#64790](https://github.com/anomalyco/opencode/pull/64790))
- The goal pill has a new design with the labels Following goal, Goal paused and Goal reached. ([#60001](https://github.com/anomalyco/opencode/pull/60001))
- Keyboard focus shows as one consistent ring across the app, no longer appears after a mouse click, and moves to the next item when the focused one is removed. The timeline and the composer no longer draw a ring around their whole frame. ([#64909](https://github.com/anomalyco/opencode/pull/64909), [#64976](https://github.com/anomalyco/opencode/pull/64976), [#65082](https://github.com/anomalyco/opencode/pull/65082), [#65084](https://github.com/anomalyco/opencode/pull/65084), [#65100](https://github.com/anomalyco/opencode/pull/65100), [#65690](https://github.com/anomalyco/opencode/pull/65690))
- Only the latest response shows its Copy button all the time; older ones show it on hover or focus. ([#64640](https://github.com/anomalyco/opencode/pull/64640))
- Added experimental tab groups for side tabs under Settings › Experimental. ([#64407](https://github.com/anomalyco/opencode/pull/64407))
- On Windows, the taskbar button shows session status as a progress bar, a count badge for sessions that need you, and flashes when a permission or question is waiting. Notifications say what is being asked and disappear once you answer. ([#65317](https://github.com/anomalyco/opencode/pull/65317), [#65318](https://github.com/anomalyco/opencode/pull/65318), [#65319](https://github.com/anomalyco/opencode/pull/65319), [#65325](https://github.com/anomalyco/opencode/pull/65325), [#65421](https://github.com/anomalyco/opencode/pull/65421))
- On Windows, the jump list has **New Session** and **New Window**, you can drag files from the file tree into other apps, and **Open in** includes Windows Terminal and lists only installed apps. ([#65327](https://github.com/anomalyco/opencode/pull/65327), [#65330](https://github.com/anomalyco/opencode/pull/65330), [#65320](https://github.com/anomalyco/opencode/pull/65320))
- The web app can be built to run under a path prefix, for example behind a reverse proxy, with `bun --cwd packages/app build --base=/opencode/`. ([#64597](https://github.com/anomalyco/opencode/pull/64597))
- The background activity menu stays smooth with many subagents, and the model picker stays responsive with catalogs of thousands of models. ([#65634](https://github.com/anomalyco/opencode/pull/65634), [#65189](https://github.com/anomalyco/opencode/pull/65189), [#65635](https://github.com/anomalyco/opencode/pull/65635))
#### Bug fixes
- Fixed `opencode://open-project` and `opencode://new-session` links doing nothing. ([#65332](https://github.com/anomalyco/opencode/pull/65332))
- Fixed file links like `~/Downloads/clip.mp4` showing "File not found". `~` now opens in the server's home folder. ([#65689](https://github.com/anomalyco/opencode/pull/65689))
- Fixed an open session's side panel tabs disappearing after you had used many other sessions. ([#65328](https://github.com/anomalyco/opencode/pull/65328), [#65322](https://github.com/anomalyco/opencode/pull/65322))
- Fixed the app freezing when opening a session on a remote server with **Share sign-ins with remote servers** on. ([#65339](https://github.com/anomalyco/opencode/pull/65339))
- Fixed the app freezing for several seconds when you open a group of long Code Mode scripts. An Execute row now lists its latest 10 calls, with **+N more** for the earlier ones. ([#65696](https://github.com/anomalyco/opencode/pull/65696))
- Fixed the browser pane showing "The browser couldn't open" in a project whose server had only just started. ([#65720](https://github.com/anomalyco/opencode/pull/65720))
- Fixed **Clear browsing data** clearing everything on the first click; it now asks first. ([#65124](https://github.com/anomalyco/opencode/pull/65124))
- Fixed browser tabs showing a generic globe instead of the site's icon, saved tabs appearing late after the app reopens, and the page going blank while a panel is resized on Windows. ([#65094](https://github.com/anomalyco/opencode/pull/65094), [#65067](https://github.com/anomalyco/opencode/pull/65067), [#65083](https://github.com/anomalyco/opencode/pull/65083))
- Fixed sites in the browser pane replacing the app's badge on the taskbar or Dock. ([#65646](https://github.com/anomalyco/opencode/pull/65646))
- Fixed the mouse Back and Forward buttons doing nothing. ([#65129](https://github.com/anomalyco/opencode/pull/65129))
- Fixed a subagent's pending permission request not reappearing after a reload or reconnect. ([#65120](https://github.com/anomalyco/opencode/pull/65120))
- Fixed background jobs that changed while the job list was loading showing the wrong state, and rows in the activity menu jumping around. ([#64966](https://github.com/anomalyco/opencode/pull/64966), [#65312](https://github.com/anomalyco/opencode/pull/65312))
- Fixed the session view crashing when a timeline row disappeared mid-update. ([#64565](https://github.com/anomalyco/opencode/pull/64565))
- Fixed earlier replies being folded into the "Used N tools" group when a session was woken without a new message. ([#64917](https://github.com/anomalyco/opencode/pull/64917))
- Fixed the Context tab showing the latest instruction update as the "System Prompt". ([#64991](https://github.com/anomalyco/opencode/pull/64991))
- Fixed the session header briefly showing the wrong worktree while a new session starts. ([#65190](https://github.com/anomalyco/opencode/pull/65190))
- Fixed Grep, Glob and List rows showing the parent of the folder they searched, and Windows paths not showing relative to the project. ([#65460](https://github.com/anomalyco/opencode/pull/65460), [#65639](https://github.com/anomalyco/opencode/pull/65639))
- Fixed server event streams going stale after Windows wakes from sleep, and windows reopening in the wrong place after being snapped or minimized. ([#65321](https://github.com/anomalyco/opencode/pull/65321), [#65323](https://github.com/anomalyco/opencode/pull/65323))
- Fixed the Windows caption buttons being hard to see with a contrast theme. ([#65324](https://github.com/anomalyco/opencode/pull/65324))
- Fixed **Open in PowerShell** on Windows opening Windows PowerShell instead of PowerShell 7 when it's installed. ([#64873](https://github.com/anomalyco/opencode/pull/64873))
- Fixed builds packaged without `app-update.yml`, such as AUR packages, showing update-check errors. Settings now shows **Updates unavailable**. ([#64681](https://github.com/anomalyco/opencode/pull/64681))
- Fixed the message menu's "Today" and "Yesterday" labels, and Home's date headers staying invisible while scrolling. ([#65081](https://github.com/anomalyco/opencode/pull/65081), [#64665](https://github.com/anomalyco/opencode/pull/64665))
- Fixed clipped or misleading focus rings, the side panel's add button being skipped by `Tab`, and the **Compacted** label only partly highlighting on hover. ([#65215](https://github.com/anomalyco/opencode/pull/65215), [#65192](https://github.com/anomalyco/opencode/pull/65192), [#65176](https://github.com/anomalyco/opencode/pull/65176), [#65177](https://github.com/anomalyco/opencode/pull/65177), [#65211](https://github.com/anomalyco/opencode/pull/65211), [#65213](https://github.com/anomalyco/opencode/pull/65213), [#65644](https://github.com/anomalyco/opencode/pull/65644))
- Fixed the Hex voice tip showing on phones and tablets, and a fringe on project icon corners. ([#64583](https://github.com/anomalyco/opencode/pull/64583), [#64582](https://github.com/anomalyco/opencode/pull/64582))
### SDK
#### Improvements
- Added `experimental.job.cancel` to cancel a running background job, and an `experimental.job.updated` event when a job starts, moves to the background or ends. `@opencode/client/solid`'s `createData` has a `job` slice. ([#64790](https://github.com/anomalyco/opencode/pull/64790), [#65266](https://github.com/anomalyco/opencode/pull/65266), [#64956](https://github.com/anomalyco/opencode/pull/64956))
- The video endpoints (`experimental.generate.video.create` and `.get`) no longer need a flag. Video jobs survive a server restart, can return more than one video, and stay readable for 24 hours after they finish. ([#65664](https://github.com/anomalyco/opencode/pull/65664), [#64546](https://github.com/anomalyco/opencode/pull/64546))
- The automation endpoints work without a flag, and an automation can run a shell command as its action. ([#65296](https://github.com/anomalyco/opencode/pull/65296), [#65186](https://github.com/anomalyco/opencode/pull/65186))
### Extensions
#### Improvements
- A plugin tool can set `options.codemode` to an object (`{ pinned?, description?, input?, output? }`) to give its Code Mode form its own description and schemas. Top-level `options.pinned` still works but is deprecated. ([#64515](https://github.com/anomalyco/opencode/pull/64515))
- The `execute.before` and `execute.after` tool hooks receive `info`, the tool's definition, and `codemode`, which is true when a Code Mode script made the call. ([#64515](https://github.com/anomalyco/opencode/pull/64515))
- An integration's OAuth method can define `revoke` to sign a credential out remotely before it's removed. ([#64947](https://github.com/anomalyco/opencode/pull/64947))
- TUI plugins can read a session's running background jobs with `api.data.job.list(sessionID)` (experimental). ([#64956](https://github.com/anomalyco/opencode/pull/64956))
- `experimental.idle` background entries can have the kind `video`. ([#63666](https://github.com/anomalyco/opencode/pull/63666))
- GUI plugins can declare their own SVG icons with `Plugin.define({ icons })` and use them through `ctx.icons`. The built-in `outline-pair` and `outline-steer` icons were removed. ([#64577](https://github.com/anomalyco/opencode/pull/64577))
- The GUI composer API adds `composer.send(commentID)` and `composer.delivery()`, and the `Browser` contract adds `experimental.open` and `experimental.close`. ([#65264](https://github.com/anomalyco/opencode/pull/65264), [#63002](https://github.com/anomalyco/opencode/pull/63002))
- GUI `System.open` only launches HTTP, HTTPS and mail URLs, and `Browser.open` refuses `file://` URLs outside the built-in preview. ([#63002](https://github.com/anomalyco/opencode/pull/63002))
## v2.3.2 — 2026-11-18
### Highlights
- **GPT-6.2 Prompt Caching**: GPT-6.2 models don't cache a system prompt sent in the Responses `instructions` field, so every step re-billed it as uncached input. OpenCode now sends it as a leading developer message on every Responses route, including OpenAI (API key and ChatGPT sign-in), GitHub Copilot, Zen, Azure and OpenRouter, so it is cached from the second step on. ([#64542](https://github.com/anomalyco/opencode/pull/64542), [#64544](https://github.com/anomalyco/opencode/pull/64544))
### Core
#### Bug fixes
- Fixed GPT-6.2 models re-billing the system prompt as uncached input on every step. On GitHub Copilot `gpt-6.2-sol`, uncached input per step dropped from about 14,000 tokens to 3. Compaction through `/responses/compact` now reads the same cached prefix. ([#64542](https://github.com/anomalyco/opencode/pull/64542), [#64544](https://github.com/anomalyco/opencode/pull/64544))
- `webfetch` structured output no longer repeats the `url` and `format` it was called with. ([#64534](https://github.com/anomalyco/opencode/pull/64534))
## v2.3.1 — 2026-11-17
### Highlights
- **Timed-Out Shell Commands Keep Running**: A shell command still running when its timeout expires now moves to the background instead of being killed, so long builds and test runs finish and report back. A foreground `timeout: 0` now means the default 120 seconds. ([#63699](https://github.com/anomalyco/opencode/pull/63699))
- **Compaction Without the Wait**: As a session nears automatic compaction, the summary is now written in the background, so your next prompt doesn't pause for it. Set `compaction.background: false` to turn it off; a background summary that ends up unused still costs tokens. ([#64290](https://github.com/anomalyco/opencode/pull/64290))
- **GPT 6.2 with ChatGPT Sign-In**: GPT 6.2 Sol and GPT 6.2 Astra, plus their fast variants, now show up in the model picker when you sign in with ChatGPT. ([#64508](https://github.com/anomalyco/opencode/pull/64508))
- **Update Plugins from Settings**: Open **Settings › Extensions**, click **Check for updates**, then **Update** on any plugin with a new version. ([#64511](https://github.com/anomalyco/opencode/pull/64511))
- **Comment on Selected Code**: Selecting code in diff and file viewers now just selects it, so you can copy it, and an **Add comment** toolbar appears beside the selection. ([#64410](https://github.com/anomalyco/opencode/pull/64410))
### Core
#### Improvements
- Shell commands still running when their timeout expires now move to the background instead of being killed, in every build. The `shell_timeout_background` flag is gone; configs that still set it keep loading. A foreground `timeout: 0` now uses the default 120 second timeout instead of waiting until the command exits. ([#63699](https://github.com/anomalyco/opencode/pull/63699))
- Background compaction is now on by default: as a session nears automatic compaction, the summary is written in the background so the next prompt doesn't wait for it. Turn it off with `compaction.background: false`; a background summary that is never used still costs tokens. The `experimental.background_compaction` setting is removed. ([#64290](https://github.com/anomalyco/opencode/pull/64290))
- OpenCode again reads `CLAUDE.md` in any directory that has no `AGENTS.md`, and falls back to `~/.claude/CLAUDE.md` when the global `AGENTS.md` is missing. This also applies to instructions found when the agent reads nested files. Set `OPENCODE_DISABLE_CLAUDE_CODE` or `OPENCODE_DISABLE_CLAUDE_CODE_PROMPT` to skip every `CLAUDE.md`. ([#64474](https://github.com/anomalyco/opencode/pull/64474), [#64533](https://github.com/anomalyco/opencode/pull/64533))
- Added GPT 6.2 Sol and GPT 6.2 Astra, plus their fast variants, to the ChatGPT model list. ([#64508](https://github.com/anomalyco/opencode/pull/64508))
- `websearch` now returns a flat list of results, each with its `url`, `title`, `content` and `published` date. ([#64471](https://github.com/anomalyco/opencode/pull/64471))
- Code Mode and plugins get a simpler structured result from `read`: `text` (with `offset`, `lineCount` and `next`), `directory` (entry names) or `media` (a URI instead of base64). What the model sees is unchanged. ([#64361](https://github.com/anomalyco/opencode/pull/64361))
- Code Mode programs can use Node's `Buffer` for encoding and decoding bytes. ([#64365](https://github.com/anomalyco/opencode/pull/64365))
- In Code Mode, `search("issues")` now works as shorthand for `search({ query: "issues" })`. ([#64347](https://github.com/anomalyco/opencode/pull/64347))
- Code Mode tool summaries in the catalog can now be up to 500 characters instead of 120, so the model sees more of each tool's description. ([#64341](https://github.com/anomalyco/opencode/pull/64341))
- The `glob` and `grep` tools now report a malformed filename glob (for example `[`) as an error that names the parameter to fix, instead of returning no results. ([#63960](https://github.com/anomalyco/opencode/pull/63960))
- Server requests that crash now return a 500 with a readable JSON `UnknownError` body instead of an empty one. Storage problems name the cause (for example "Storage is full" or "Storage is read-only"); other crashes include a `ref` you can find in the server log. ([#64022](https://github.com/anomalyco/opencode/pull/64022))
- The shell tool description now tells the model that its session ID is in the `OPENCODE_SESSION_ID` environment variable. ([#63718](https://github.com/anomalyco/opencode/pull/63718))
- Experimental schedules are now automations, behind the `automations` flag (the old `schedules` flag still works). An automation runs on a time, an interval, a cron or a pushed MCP event, and either sends a prompt (to the creating session, another session or a new subagent) or runs a Code Mode program that decides whether to send one. Use `/automation` or the `automation_*` tools. Active or paused plain prompt schedules carry over; schedules with a condition or run limit, and finished ones, are dropped. ([#64160](https://github.com/anomalyco/opencode/pull/64160))
#### Bug fixes
- Fixed finished shell commands leaving zombie processes under `opencode-pty`. The process daemon now cleans each command up when it exits. Background processes started by a successful command (`cmd &`) keep running, and a failed command's leftovers are stopped. ([#64266](https://github.com/anomalyco/opencode/pull/64266), [#64251](https://github.com/anomalyco/opencode/pull/64251))
- Fixed ChatGPT and OpenAI subscription logins losing their sharing-limit safeguards and context caps when a token refresh failed. ([#64470](https://github.com/anomalyco/opencode/pull/64470))
- Fixed Claude Agent models falling back to a 200K context window when Claude Code adds or renames a model. Thanks @Tarquinen. ([#64107](https://github.com/anomalyco/opencode/pull/64107))
- Fixed requests being rejected after switching models mid-session on OpenAI-compatible providers. Models that declare a different reasoning field (such as `reasoning_content`) no longer receive `reasoning_details` from earlier turns. ([#64243](https://github.com/anomalyco/opencode/pull/64243))
- Rejecting a permission request now rejects only the other pending requests from the same step, not every pending request in the session. ([#64343](https://github.com/anomalyco/opencode/pull/64343))
- Fixed a finished subagent being reported to its parent as still running when its answer quoted the "Background work still running" heading. ([#64026](https://github.com/anomalyco/opencode/pull/64026))
- Fixed ACP clients missing turns that a background shell woke after the original turn ended. ([#64262](https://github.com/anomalyco/opencode/pull/64262))
- Reading a small text file now applies the default line and byte limits, so a short file with very many lines is paged instead of returned whole. ([#63810](https://github.com/anomalyco/opencode/pull/63810))
- Paged reads that select a single blank line now return that line instead of an empty result. ([#63809](https://github.com/anomalyco/opencode/pull/63809))
- `read` now rejects `limit: 0` with "Limit must be a positive integer". ([#63808](https://github.com/anomalyco/opencode/pull/63808))
- Text files that start with `BM` are no longer mistaken for BMP images, and only real `GIF87a`/`GIF89a` headers count as GIFs, so these files read as text again. ([#63822](https://github.com/anomalyco/opencode/pull/63822), [#63811](https://github.com/anomalyco/opencode/pull/63811))
- Fixed shell output pages, grep previews, generated titles, read lines and shell output tails splitting emoji and other multi-byte characters, which showed up as `<60>`. ([#63984](https://github.com/anomalyco/opencode/pull/63984), [#63967](https://github.com/anomalyco/opencode/pull/63967))
- Shell commands using unknown ANSI-C escapes such as `$'\q'` are now read the same way Bash and Zsh read them, so permission rules can match them. ([#64263](https://github.com/anomalyco/opencode/pull/64263))
- Session title search is now case-insensitive for non-ASCII letters, such as Cyrillic and accented text. ([#64259](https://github.com/anomalyco/opencode/pull/64259))
- Fixed `grep` results being dropped when a matching line or path is not valid UTF-8. Thanks @Tarquinen. ([#62249](https://github.com/anomalyco/opencode/pull/62249))
- The `@` file picker now finds files in hidden folders such as `.github/` and dotfiles such as `.env.example` when file search uses ripgrep (the default on Windows and outside git repos). `.git` and gitignored files stay excluded. Thanks @Tarquinen. ([#62577](https://github.com/anomalyco/opencode/pull/62577))
- An unreachable well-known integration source is now skipped instead of dropping every well-known source. Thanks @Tarquinen. ([#62578](https://github.com/anomalyco/opencode/pull/62578))
- A corrupt cached project ID is now ignored instead of being used. Thanks @Tarquinen. ([#62576](https://github.com/anomalyco/opencode/pull/62576))
- Plugin tool renames from `tool.execute.before` now apply to calls inside Code Mode programs, and a renamed call returns the new tool's structured result. ([#63633](https://github.com/anomalyco/opencode/pull/63633), [#64333](https://github.com/anomalyco/opencode/pull/64333))
- In Code Mode, calling a tool that doesn't exist now returns a rejected promise, so `.catch` and `Promise.allSettled` can handle it instead of the whole script failing. ([#64510](https://github.com/anomalyco/opencode/pull/64510))
- A Code Mode program that only logs no longer shows a stray `null` line before its logs. ([#64344](https://github.com/anomalyco/opencode/pull/64344))
### TUI
#### Improvements
- Permission prompts from a subagent, and from that subagent's own subagents, now appear while you view the subagent's session. Prompts also show in front of an open composer. ([#64343](https://github.com/anomalyco/opencode/pull/64343))
- The export dialog under the new designs can save to the system temp directory as well as the project folder. Thanks @Tarquinen. ([#62490](https://github.com/anomalyco/opencode/pull/62490))
- Removed time to first token (ttft) from the assistant message footer. Tokens per second still shows when `session.tps` is on. ([#63759](https://github.com/anomalyco/opencode/pull/63759))
#### Bug fixes
- When another TUI sharing your tabs closes the session you're viewing, closing it here now moves to the neighbouring tab. ([#64261](https://github.com/anomalyco/opencode/pull/64261))
- Fixed broken characters at the edges of the shell output viewer and the inline shell display when output is long. ([#63967](https://github.com/anomalyco/opencode/pull/63967), [#63984](https://github.com/anomalyco/opencode/pull/63984))
### Desktop
#### Improvements
- You can check for and install plugin package updates from **Settings › Extensions**. Use **Check for updates** to look for new versions, then click **Update** on any plugin that has one. ([#64511](https://github.com/anomalyco/opencode/pull/64511), [#64525](https://github.com/anomalyco/opencode/pull/64525))
- Selecting code in diff and file viewers now just selects text, so you can copy it. An **Add comment** toolbar appears next to the selection to comment on those lines; line numbers and the gutter `+` still start a comment directly. ([#64410](https://github.com/anomalyco/opencode/pull/64410))
- Cmd+F (Ctrl+F) now finds text in Markdown, Mermaid, CSV and HTML previews in the side panel, using the same find bar as the code view. ([#63663](https://github.com/anomalyco/opencode/pull/63663))
- Disconnecting a provider or removing an account in **Settings → Providers** now asks for confirmation first. Disconnecting OpenCode Console says how many providers will stop working. ([#64212](https://github.com/anomalyco/opencode/pull/64212))
- The model picker's variant flyout now follows the keyboard: it opens beside the highlighted row, `→` enters it to pick a variant or toggle Favorite, and `←` or `Escape` goes back. A model's Console budget and reset time now show in the flyout. ([#64409](https://github.com/anomalyco/opencode/pull/64409), [#64423](https://github.com/anomalyco/opencode/pull/64423))
- When **New worktree** is selected for a new session, the composer shows the base branch (`from dev ▾`). Click it to pick another base; the choice applies immediately, and **Use main checkout** switches back. ([#64228](https://github.com/anomalyco/opencode/pull/64228))
- Redesigned the folder picker for remote servers, with a path bar, up to three recent-project pills plus a **More projects** menu, and a search box that shows the selected folder. ([#64241](https://github.com/anomalyco/opencode/pull/64241))
- ` ```latex ` and ` ```math ` code fences now render as display math once complete. ([#64380](https://github.com/anomalyco/opencode/pull/64380))
- The new icon set is now the default, and the **New icons** experiment has been removed. ([#64466](https://github.com/anomalyco/opencode/pull/64466), [#64451](https://github.com/anomalyco/opencode/pull/64451))
- The copy button under assistant messages is now always visible. Message metadata still appears on hover. ([#64478](https://github.com/anomalyco/opencode/pull/64478))
- Text files opened in side-panel tabs now have the same copy and download actions as other files. ([#64463](https://github.com/anomalyco/opencode/pull/64463))
- **Manage models** now shows every provider as a card with a `⋯` menu, whether or not you're signed in to OpenCode Console. ([#64235](https://github.com/anomalyco/opencode/pull/64235))
- The connect provider dialog has a cleaner layout for every sign-in step: breadcrumbs, method icons, full-width device codes, and a "Signing in from another device?" row for pasting a redirect URL. ([#63829](https://github.com/anomalyco/opencode/pull/63829))
- **Collapse long messages** is no longer experimental. It is now a setting under **Timeline** preferences. ([#64441](https://github.com/anomalyco/opencode/pull/64441))
- Settings now opens on your client preferences, which are listed first, pairing is grouped with Servers, and there's a **Help & feedback** link. ([#64440](https://github.com/anomalyco/opencode/pull/64440), [#64220](https://github.com/anomalyco/opencode/pull/64220))
- Automatic compactions now always show as a single quiet divider; manual and failed compactions still show the full record. ([#64290](https://github.com/anomalyco/opencode/pull/64290))
- Pairing QR codes can carry a server name, which becomes the paired server's default name. ([#64139](https://github.com/anomalyco/opencode/pull/64139))
- Image attachment thumbnails are larger, with a 3:2 crop, and a failed image no longer moves the message below it when retried. ([#64215](https://github.com/anomalyco/opencode/pull/64215))
- The Hex voice tip no longer appears when Hex is already installed, its copy now says what Hex is, and tips wait an hour after first launch before the first one shows. ([#64130](https://github.com/anomalyco/opencode/pull/64130), [#64131](https://github.com/anomalyco/opencode/pull/64131), [#63974](https://github.com/anomalyco/opencode/pull/63974), [#63760](https://github.com/anomalyco/opencode/pull/63760))
- Added missing translations for every non-English language, about 920 strings each. ([#64205](https://github.com/anomalyco/opencode/pull/64205))
#### Bug fixes
- Fixed the desktop app failing to start when `drafts.sqlite` was a symlink to or copy of the CLI's `opencode.db`. The desktop now moves that file aside and creates its own, leaving the CLI database untouched. ([#64203](https://github.com/anomalyco/opencode/pull/64203))
- Switching session tabs with a keyboard shortcut now focuses the composer. ([#64418](https://github.com/anomalyco/opencode/pull/64418))
- Long prompts now stay folded while a new session is being created. ([#64452](https://github.com/anomalyco/opencode/pull/64452))
- On macOS, the browser pane stays live while you resize panels instead of showing a still image. ([#64443](https://github.com/anomalyco/opencode/pull/64443))
- Submenus now open one at a time and swap without blinking, and stay open while you move the pointer across other items to reach them. ([#63739](https://github.com/anomalyco/opencode/pull/63739))
- Pressing a button now dismisses its tooltip until you hover it again, and copy buttons show "Copied" for two seconds, including in the `/btw` panel. ([#63834](https://github.com/anomalyco/opencode/pull/63834))
- Dialogs now use consistent sizes, corner radius and row styles across the command palette, session search, model picker, location picker and other lists. ([#63432](https://github.com/anomalyco/opencode/pull/63432), [#64216](https://github.com/anomalyco/opencode/pull/64216), [#64206](https://github.com/anomalyco/opencode/pull/64206))
- Sessions on OpenCode Go no longer show a $0.00 cost. ([#63744](https://github.com/anomalyco/opencode/pull/63744))
- **Use main checkout** now stays on one line in the branch picker, and wrapped question descriptions have better spacing. ([#64450](https://github.com/anomalyco/opencode/pull/64450), [#64446](https://github.com/anomalyco/opencode/pull/64446))
- Restyled the **Timeline detail** slider and visibility buttons in settings so they read as clickable. ([#64186](https://github.com/anomalyco/opencode/pull/64186))
- Polished small details: animated counts no longer look faded at rest, the sidebar resize pill is hidden, the sidebar peek insets match, subagent breadcrumbs show a hover background, and screen readers name the redirect URL field after its label only. ([#64155](https://github.com/anomalyco/opencode/pull/64155), [#64219](https://github.com/anomalyco/opencode/pull/64219), [#64192](https://github.com/anomalyco/opencode/pull/64192), [#63742](https://github.com/anomalyco/opencode/pull/63742), [#63885](https://github.com/anomalyco/opencode/pull/63885))
### SDK
#### Improvements
- Unhandled server errors now return a JSON `UnknownError` body (`message` and `ref`) with status 500 instead of an empty body. ([#64022](https://github.com/anomalyco/opencode/pull/64022))
- Experimental automation endpoints replace the schedule endpoints: `/api/experimental/automation` and `client.experimental.automation.*` (`create`, `list`, `get`, `pause`, `resume`, `delete`). `/api/experimental/schedule` and `client.experimental.schedule.*` are removed. ([#64160](https://github.com/anomalyco/opencode/pull/64160))
- Config adds `compaction.background`; `experimental.background_compaction` and the `shell_timeout_background` flag are removed. ([#64290](https://github.com/anomalyco/opencode/pull/64290), [#63699](https://github.com/anomalyco/opencode/pull/63699))
#### Bug fixes
- Apps embedding the SDK with an in-memory database no longer import the user's legacy `auth.json` credentials. Only a database file opened by path imports them. ([#63716](https://github.com/anomalyco/opencode/pull/63716))
### Extensions
#### Improvements
- Each tool call inside a Code Mode program now has its own call ID in plugin hooks and traces. Its permission requests still show on the `execute` call's row. ([#64324](https://github.com/anomalyco/opencode/pull/64324))
- Plugin `SessionIdleBackground` items can now be `{ kind: "codemode", sessionID, jobID }`, and GUI plugin `BridgeLayout` accepts an optional `clip` rectangle. ([#64343](https://github.com/anomalyco/opencode/pull/64343), [#63819](https://github.com/anomalyco/opencode/pull/63819))
#### Bug fixes
- The browser extension's URL bar action buttons are now spaced 6px apart. ([#64214](https://github.com/anomalyco/opencode/pull/64214))
## v2.3.0 — 2026-11-13
### Highlights
- **Background Subagents by Default**: Subagents now return immediately, continue in the background, and report back whenever they become idle. You can keep working in the parent session while multiple subagents run concurrently. ([#63382](https://github.com/anomalyco/opencode/pull/63382))
- **Quieter Transcripts by Default**: The TUI now summarizes each run of tool calls and thoughts into one collapsible activity row, so the answer is easier to follow. To see every step again, set **Verbosity** to `medium` or `high` in settings, or set `session.verbosity` in your TUI config; an existing setting is kept. ([#63207](https://github.com/anomalyco/opencode/pull/63207))
- **Jump to an Earlier Prompt**: In the desktop app, open **Jump to message** from the command palette or press `Cmd+Alt+G` (`Ctrl+Alt+G` on Windows and Linux) to search prompts across the current session and jump directly to one. ([#63585](https://github.com/anomalyco/opencode/pull/63585))
### Core
#### Improvements
- Subagents now always run in the background, return their session ID immediately, and report results to their parent whenever they become idle. ([#63382](https://github.com/anomalyco/opencode/pull/63382))
- Added experimental support for MCP events, behind the `mcp_events` flag. ([#63254](https://github.com/anomalyco/opencode/pull/63254), [#63261](https://github.com/anomalyco/opencode/pull/63261), [#63269](https://github.com/anomalyco/opencode/pull/63269))
- Shell commands now survive server handoffs and keep their output when interrupted.
- Added experimental support for moving a shell command to the background when its timeout expires, behind the `shell_timeout_background` flag. With the flag on, an explicit timeout on a background command stops it. ([#63024](https://github.com/anomalyco/opencode/pull/63024), [#63703](https://github.com/anomalyco/opencode/pull/63703))
- Local Windows shell commands now run through the process daemon.
- Added support for freeform tool input on compatible models.
- Added LM Studio decision-model support.
- Agents are now told when their session is a fork. Thanks @hasta84. ([#63235](https://github.com/anomalyco/opencode/pull/63235))
- Tool output truncation now keeps the beginning of the output and preserves a usable preview if the full output cannot be saved.
- Tail reads no longer load the entire file into memory.
- Providers can present a client certificate for gateways that require mutual TLS. Set `settings.tls` with `cert`, `key` and an optional `passphrase` on the provider; values accept `{file:}` and `{env:}` like `apiKey`. ([#61832](https://github.com/anomalyco/opencode/pull/61832))
- When a subagent goes idle while its own background work is still running, its report to the parent now says it is still running, so the parent waits for the final report instead of treating the partial answer as done. ([#63675](https://github.com/anomalyco/opencode/pull/63675))
- Code Mode gets simpler structured results from file and skill tools: `write` and `edit` return their confirmation as a string, `patch` returns an empty result, and `skill` returns the skill's directory and content. ([#63616](https://github.com/anomalyco/opencode/pull/63616), [#63635](https://github.com/anomalyco/opencode/pull/63635), [#63618](https://github.com/anomalyco/opencode/pull/63618), [#63623](https://github.com/anomalyco/opencode/pull/63623))
#### Bug fixes
- Fixed case-only file renames in patches on case-insensitive filesystems.
- Fixed stale thinking being retained after Claude Agent prompts or tools change.
- Fixed directly driven child sessions not resuming after a restart.
- Fixed plugin replacement stopping when cleanup of an earlier plugin fails.
- Fixed MCP OAuth refreshes and localhost redirects when a server rewrites `127.0.0.1`.
- Fixed saved API keys being omitted from local-model discovery.
- Local model discovery (Ollama, LM Studio, vLLM) waits up to 15 seconds per request instead of 1, so remote or tunnelled endpoints list their models, and a slow endpoint no longer delays other endpoints or config reloads. ([#63700](https://github.com/anomalyco/opencode/pull/63700))
- In Code Mode, calling a namespace as if it were a tool now suggests up to three real tools under it. ([#63697](https://github.com/anomalyco/opencode/pull/63697))
- Fixed retryable provider streams losing completed work when interrupted.
- Fixed GitHub Copilot requests using the wrong endpoint before models finish loading.
- Fixed exhausted request rate limits being treated as terminal. Thanks @Kyle-j-bush. ([#59816](https://github.com/anomalyco/opencode/pull/59816))
- Fixed LM Studio models with a null context length and accepted decision-type models. Thanks @tomzhu1024. ([#56214](https://github.com/anomalyco/opencode/pull/56214))
### TUI
#### Improvements
- Transcript verbosity now defaults to `low`, which summarizes each run of tools and thoughts into one activity row. A `session.verbosity` you already set is kept. ([#63207](https://github.com/anomalyco/opencode/pull/63207))
- Session IDs found in messages can now be opened directly.
- Activity tabs are clickable and open the correct view.
- Shell mode has its own prompt color under the new designs.
#### Bug fixes
- Restored pasted text when undo brings back its placeholder.
- Restored the live draft after browsing prompt history.
- Fixed copying a paste from within the prompt selection.
- Preserved the Mini composer caret when closing the command palette.
- Prevented image bytes from being retained in transcript storage when image previews are disabled.
- Fixed paste-chip contrast across light and dark themes.
- Fixed plugin-provided themes updating live.
- Session lists now open at the top rather than at the current session.
- Mini scrollback now shows the subagent card instead of obsolete launch instructions.
### Desktop
#### Improvements
- Added **Jump to message** to the command palette with `Cmd+Alt+G` / `Ctrl+Alt+G`, including prompts not yet loaded in the timeline. Thanks @usrnk1. ([#63585](https://github.com/anomalyco/opencode/pull/63585))
- Added the experimental **Recent** sessions sidebar, with cross-server recency, local pins, reordering, and standard session-row actions.
- Recent sessions are limited to the last seven days and 30 rows, and can be hidden or muted.
- Added an experimental customizable sessions sidebar.
- Mermaid diagrams can now be maximized for zooming and panning. ([#59250](https://github.com/anomalyco/opencode/pull/59250))
- Added `Alt+Enter` to place a follow-up first in the queue and `Mod+Enter` to steer the next queued prompt.
- Holding the modifier key now shows tab shortcut numbers.
- Each server’s terminal shell can be selected from its menu.
- Added a free-limit panel in place of the composer when applicable.
- Session IDs are easier to find and copy.
#### Bug fixes
- Recent sessions now keep stable recency ordering through list reloads, renames, and completed runs.
- Fixed browser panes not retrying after server plugins finish loading.
- Fixed mention suggestions being recreated while typing.
- Fixed SSH prompts failing to advance or close after connection.
- Fixed pasted provider-auth redirect URLs being rejected.
- Restored message footers in the New timeline.
- Fixed links whose labels contain inline code.
- Fixed the desktop main process freezing while probing the login-shell environment.
- Fixed the drag region after changing layout direction.
- Fixed vertical-tab previews snapping to the wrong tab.
- Fixed the file-tree sidebar opening animation.
- Fixed pairing QR-code contrast in light themes. Thanks @ssskay. ([#63220](https://github.com/anomalyco/opencode/pull/63220))
- Fixed activity-tab navigation and click handling. Thanks @OpeOginni. ([#60168](https://github.com/anomalyco/opencode/pull/60168))
### SDK
#### Improvements
- Event subscriptions can now receive `experimental.mcp.event` events from MCP event subscriptions.
- Model capability schemas now advertise supported freeform tool-input formats.
- Session throughput is now measured from the first streamed token.
- Session creation documentation now clarifies the `parentID` field.
### Extensions
#### Improvements
- Promise-based tools can cooperatively stop through `ToolContext.signal`.
- Added the experimental `session.fork` hook.
- Promise plugin cleanup failures no longer prevent subsequent plugin replacements.
- `@opencode/plugin/effect` now exports `Tool`, so an `execute.before` hook can reject a call with `Tool.Error` without importing `@opencode/schema/tool`. ([#63698](https://github.com/anomalyco/opencode/pull/63698))
## v2.2.7 — 2026-11-10 ## v2.2.7 — 2026-11-10
### Highlights ### Highlights

View file

@ -110,4 +110,4 @@ OpenCode 内置两种 Agent,可用 `Tab` 键快速切换:
--- ---
**加入我们的社区** [飞书](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=52ao9352-5623-4fa0-b7dd-3407c392c1af&qr_code=true) | [X.com](https://x.com/opencode) **加入我们的社区** [飞书](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=a53kb082-3aff-41fb-b412-b3e669334f16&qr_code=true) | [X.com](https://x.com/opencode)

View file

@ -110,4 +110,4 @@ OpenCode 內建了兩種 Agent,您可以使用 `Tab` 鍵快速切換。
--- ---
**加入我們的社群** [飞书](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=52ao9352-5623-4fa0-b7dd-3407c392c1af&qr_code=true) | [X.com](https://x.com/opencode) **加入我們的社群** [飞书](https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=a53kb082-3aff-41fb-b412-b3e669334f16&qr_code=true) | [X.com](https://x.com/opencode)

496
bun.lock

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
exact = true exact = true
# Only install newly resolved package versions published at least 3 days ago. # Only install newly resolved package versions published at least 3 days ago.
minimumReleaseAge = 259200 minimumReleaseAge = 259200
minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@brendonovich/vite-plugin-opencode", "@hona/strobe", "@hona/strobe-darwin-arm64", "@hona/strobe-darwin-x64", "@hona/strobe-linux-arm64", "@hona/strobe-linux-x64", "@hona/strobe-win32-arm64", "@hona/strobe-win32-x64", "@kitlangton/knobs", "@kitlangton/solid-motion", "@opencode/sdk", "@opencode/pty", "@opencode/pty-darwin-arm64", "@opencode/pty-darwin-x64", "@opencode/pty-linux-arm64-gnu", "@opencode/pty-linux-arm64-musl", "@opencode/pty-linux-x64-gnu", "@opencode/pty-linux-x64-musl", "@opencode/pty-win32-arm64", "@opencode/pty-win32-x64", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "@opentunnel/client", "@opentunnel/protocol", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/highlights", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron", "electron-builder", "electron-publish", "blume", "pele", "bun-types", "typescript@7.1.0-beta", "@textjs/app", "@textjs/core", "@textjs/opencode", "@textjs/react"] minimumReleaseAgeExcludes = ["@ai-sdk/amazon-bedrock", "@ai-sdk/anthropic", "@brendonovich/vite-plugin-opencode", "@hona/strobe", "@hona/strobe-darwin-arm64", "@hona/strobe-darwin-x64", "@hona/strobe-linux-arm64", "@hona/strobe-linux-x64", "@hona/strobe-win32-arm64", "@hona/strobe-win32-x64", "@kitlangton/knobs", "@kitlangton/solid-motion", "@opencode/sdk", "@opencode/pty", "@opencode/pty-darwin-arm64", "@opencode/pty-darwin-x64", "@opencode/pty-linux-arm64-gnu", "@opencode/pty-linux-arm64-musl", "@opencode/pty-linux-x64-gnu", "@opencode/pty-linux-x64-musl", "@opencode/pty-win32-arm64", "@opencode/pty-win32-x64", "@opentui/core", "@opentui/core-darwin-arm64", "@opentui/core-darwin-x64", "@opentui/core-linux-arm64", "@opentui/core-linux-arm64-musl", "@opentui/core-linux-x64", "@opentui/core-linux-x64-musl", "@opentui/core-win32-arm64", "@opentui/core-win32-x64", "@opentui/keymap", "@opentui/solid", "@opentunnel/client", "@opentunnel/protocol", "gitlab-ai-provider", "opencode-gitlab-auth", "@ff-labs/fff-node", "@ff-labs/fff-bun", "@ff-labs/fff-bin-darwin-arm64", "@ff-labs/fff-bin-darwin-x64", "@ff-labs/fff-bin-linux-arm64-gnu", "@ff-labs/fff-bin-linux-arm64-musl", "@ff-labs/fff-bin-linux-x64-gnu", "@ff-labs/fff-bin-linux-x64-musl", "@ff-labs/fff-bin-win32-arm64", "@ff-labs/fff-bin-win32-x64", "@pierre/diffs", "@pierre/highlights", "@pierre/theming", "app-builder-lib", "dmg-builder", "electron", "electron-builder", "electron-publish", "blume", "pele", "bun-types", "typescript@7.1.0-beta", "@textjs/app", "@textjs/core", "@textjs/opencode", "@textjs/react", "psychoscript"]
[test] [test]
root = "./do-not-run-tests-from-root" root = "./do-not-run-tests-from-root"

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1790510107, "lastModified": 1794840529,
"narHash": "sha256-EVMNYv7hYDDD9TGVT/hIyTYgpiXA8y3m5xIEIxuGNU0=", "narHash": "sha256-ySrWnmZB5UsZTYGHHnBjllT05O5iFjElCRS+mabtfP0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3181085bfd08663b6b9e60bc7a8395c2aaa741bd", "rev": "e21fec321d73511849707a7585e4ea155ee4bf40",
"type": "github" "type": "github"
}, },
"original": { "original": {

47
install
View file

@ -262,6 +262,26 @@ print_progress() {
printf "\r${ORANGE}%s%s %3d%%${NC}" "$filled" "$empty" "$percent" >&4 printf "\r${ORANGE}%s%s %3d%%${NC}" "$filled" "$empty" "$percent" >&4
} }
install_tmp_dir=""
download_curl_pid=""
cursor_hidden=false
cleanup_download() {
if [ -n "${download_curl_pid:-}" ]; then
kill "$download_curl_pid" 2>/dev/null || true
wait "$download_curl_pid" 2>/dev/null || true
download_curl_pid=""
fi
if [ "$cursor_hidden" = "true" ]; then
{ printf '\033[?25h' >&4; exec 4>&-; } 2>/dev/null || true
cursor_hidden=false
fi
if [ -n "${install_tmp_dir:-}" ]; then
rm -rf "$install_tmp_dir"
install_tmp_dir=""
fi
}
download_with_progress() { download_with_progress() {
local url="$1" local url="$1"
local output="$2" local output="$2"
@ -272,20 +292,23 @@ download_with_progress() {
exec 4>/dev/null exec 4>/dev/null
fi fi
local headers="${output}.headers"
# Hide cursor # Hide cursor
printf "\033[?25l" >&4 printf "\033[?25l" >&4
cursor_hidden=true
trap "trap - RETURN; rm -f \"$headers\"; printf '\033[?25h' >&4; exec 4>&-" RETURN trap 'trap - RETURN; if [ "$cursor_hidden" = "true" ]; then printf "\033[?25h" >&4; exec 4>&-; cursor_hidden=false; fi' RETURN
local headers="${output}.headers"
# Poll the file size on a timer so rendering cost stays fixed no matter how many bytes arrive. # Poll the file size on a timer so rendering cost stays fixed no matter how many bytes arrive.
# Read the size with ls because busybox wc -c reads the whole file. # Read the size with ls because busybox wc -c reads the whole file.
curl -fsL -D "$headers" -o "$output" "$url" & # Bash opens both files so a confined curl (e.g. snap) with a private /tmp can still write them.
local curl_pid=$! # npm's CDN omits content-length on HEAD, so read it from this request's headers.
curl -fsL -D /dev/stderr "$url" > "$output" 2> "$headers" &
download_curl_pid=$!
local length bytes local length bytes
while kill -0 "$curl_pid" 2>/dev/null; do while kill -0 "$download_curl_pid" 2>/dev/null; do
if [ -f "$output" ]; then if [ -f "$output" ]; then
length=$(grep -i '^content-length:' "$headers" 2>/dev/null | tail -n 1 | tr -dc '0-9' || true) length=$(grep -i '^content-length:' "$headers" 2>/dev/null | tail -n 1 | tr -dc '0-9' || true)
bytes=$(ls -ln "$output" | awk '{print $5}') bytes=$(ls -ln "$output" | awk '{print $5}')
@ -295,7 +318,8 @@ download_with_progress() {
done done
local ret=0 local ret=0
wait "$curl_pid" || ret=$? wait "$download_curl_pid" || ret=$?
download_curl_pid=""
if [ "$ret" -eq 0 ]; then if [ "$ret" -eq 0 ]; then
bytes=$(ls -ln "$output" | awk '{print $5}') bytes=$(ls -ln "$output" | awk '{print $5}')
print_progress "$bytes" "$bytes" print_progress "$bytes" "$bytes"
@ -308,11 +332,16 @@ download_and_install() {
print_message info "\n${MUTED}Installing ${NC}$APP ${MUTED}version: ${NC}$specific_version" print_message info "\n${MUTED}Installing ${NC}$APP ${MUTED}version: ${NC}$specific_version"
local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$" local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
mkdir -p "$tmp_dir" mkdir -p "$tmp_dir"
install_tmp_dir="$tmp_dir"
trap cleanup_download EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
# Fallback to standard curl on Windows, non-TTY environments, or if custom progress fails # Fallback to standard curl on Windows, non-TTY environments, or if custom progress fails
local ret=0 local ret=0
curl -f -# -L -o "$tmp_dir/$filename" "$url" || ret=$? # Redirect in bash instead of passing -o to curl so confined builds (e.g. snap) don't need host /tmp access.
curl -f -# -L "$url" > "$tmp_dir/$filename" || ret=$?
# curl exits 23 when it cannot write the file, usually because the temporary directory is full. # curl exits 23 when it cannot write the file, usually because the temporary directory is full.
if [ "$ret" -eq 23 ]; then if [ "$ret" -eq 23 ]; then
print_message error "Could not write the download to $tmp_dir. Make sure it has enough free space, or set TMPDIR to another directory, then try again." >&2 print_message error "Could not write the download to $tmp_dir. Make sure it has enough free space, or set TMPDIR to another directory, then try again." >&2
@ -329,7 +358,7 @@ download_and_install() {
fi fi
mv "$tmp_dir/package/bin/$binary_name" "$INSTALL_DIR/$installed_binary" mv "$tmp_dir/package/bin/$binary_name" "$INSTALL_DIR/$installed_binary"
chmod 755 "$INSTALL_DIR/$installed_binary" chmod 755 "$INSTALL_DIR/$installed_binary"
rm -rf "$tmp_dir" cleanup_download
} }
install_from_binary() { install_from_binary() {

View file

@ -1,7 +1,7 @@
{ {
"nodeModules": { "nodeModules": {
"x86_64-linux": "sha256-UOVs48Z4yO4TJv859cg89lsul54KB9StTSl/VSQJXmc=", "x86_64-linux": "sha256-LhAICCt8oDBwcwwxDf11PBxJPgKx9gz0TcLcWEoSxp4=",
"aarch64-linux": "sha256-INQvojH68t0J1Hc61N1dJvTJzl89afkQNrUcahxOs9g=", "aarch64-linux": "sha256-lDEEZsLHGVvMgI7dsQqURo+Fo/dUyMisoOy2bb9qUGA=",
"aarch64-darwin": "sha256-AU2AUkdlL1g+hBkMZX93gQeQy6u8F0Gyzuk48yoN8as=" "aarch64-darwin": "sha256-ktDDSk98gLUiafmmuWhsIO/1zqi06QeMzp1QvPoaWFE="
} }
} }

View file

@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/package.json", "$schema": "https://json.schemastore.org/package.json",
"name": "opencode", "name": "opencode",
"description": "AI-powered development tool", "description": "AI-powered development tool",
"version": "2.2.7", "version": "2.4.1",
"private": true, "private": true,
"type": "module", "type": "module",
"packageManager": "bun@1.4.4", "packageManager": "bun@1.4.4",
@ -14,7 +14,7 @@
"dev:desktop": "bun --cwd packages/desktop dev", "dev:desktop": "bun --cwd packages/desktop dev",
"dev:web": "bun --cwd packages/app dev", "dev:web": "bun --cwd packages/app dev",
"dev:site": "bun run --cwd services/site dev", "dev:site": "bun run --cwd services/site dev",
"lint": "oxlint && ast-grep scan -c script/ast-grep/gui-plugins/sgconfig.yml && bun script/sdk-docs.ts", "lint": "oxlint && ast-grep scan -c script/ast-grep/gui-plugins/sgconfig.yml && ast-grep scan --rule script/ast-grep/dialog-size.yml packages && bun script/sdk-docs.ts && bun script/check-greys.ts",
"lint:changed": "bun script/lint-changed.ts", "lint:changed": "bun script/lint-changed.ts",
"lint:effect-patterns": "ast-grep scan -c script/ast-grep/sgconfig.yml packages/util/src packages/core/src packages/server/src packages/protocol/src packages/cli/src", "lint:effect-patterns": "ast-grep scan -c script/ast-grep/sgconfig.yml packages/util/src packages/core/src packages/server/src packages/protocol/src packages/cli/src",
"lint:effect-simplifications": "ast-grep scan -c script/ast-grep/effect-simplifications/sgconfig.yml --off=unused-suppression packages", "lint:effect-simplifications": "ast-grep scan -c script/ast-grep/effect-simplifications/sgconfig.yml --off=unused-suppression packages",
@ -48,12 +48,12 @@
"@effect/sql-sqlite-node": "4.1.0", "@effect/sql-sqlite-node": "4.1.0",
"@npmcli/arborist": "9.4.0", "@npmcli/arborist": "9.4.0",
"@types/bun": "1.4.3", "@types/bun": "1.4.3",
"@hona/strobe": "0.28.0", "@hona/strobe": "0.44.1",
"@types/cross-spawn": "6.0.6", "@types/cross-spawn": "6.0.6",
"@octokit/rest": "22.0.0", "@octokit/rest": "22.0.0",
"@opentui/core": "0.8.4", "@opentui/core": "0.9.9",
"@opentui/keymap": "0.8.4", "@opentui/keymap": "0.9.9",
"@opentui/solid": "0.8.4", "@opentui/solid": "0.9.9",
"@tanstack/solid-virtual": "3.13.37", "@tanstack/solid-virtual": "3.13.37",
"@standard-schema/spec": "1.1.0", "@standard-schema/spec": "1.1.0",
"@kobalte/core": "0.13.13", "@kobalte/core": "0.13.13",
@ -110,7 +110,7 @@
"@ast-grep/cli": "0.44.0", "@ast-grep/cli": "0.44.0",
"@hona/strobe": "catalog:", "@hona/strobe": "catalog:",
"@opencode/client": "workspace:*", "@opencode/client": "workspace:*",
"@oxlint/plugins": "1.60.0", "@oxlint/plugins": "1.93.0",
"@tsconfig/bun": "catalog:", "@tsconfig/bun": "catalog:",
"@types/bun": "catalog:", "@types/bun": "catalog:",
"@types/mime-types": "3.0.1", "@types/mime-types": "3.0.1",
@ -118,7 +118,7 @@
"@typescript/native": "catalog:", "@typescript/native": "catalog:",
"glob": "13.0.5", "glob": "13.0.5",
"husky": "9.1.7", "husky": "9.1.7",
"oxlint": "1.60.0", "oxlint": "1.93.0",
"prettier": "3.6.2", "prettier": "3.6.2",
"semver": "^7.6.0", "semver": "^7.6.0",
"turbo": "2.10.2" "turbo": "2.10.2"
@ -174,6 +174,8 @@
"electron-updater@6.8.9": "patches/electron-updater@6.8.9.patch", "electron-updater@6.8.9": "patches/electron-updater@6.8.9.patch",
"@pierre/trees@1.0.0-beta.6": "patches/@pierre%2Ftrees@1.0.0-beta.6.patch", "@pierre/trees@1.0.0-beta.6": "patches/@pierre%2Ftrees@1.0.0-beta.6.patch",
"@brendonovich/vite-plugin-opencode@0.1.3": "patches/@brendonovich%2Fvite-plugin-opencode@0.1.3.patch", "@brendonovich/vite-plugin-opencode@0.1.3": "patches/@brendonovich%2Fvite-plugin-opencode@0.1.3.patch",
"@modelcontextprotocol/client@2.4.0": "patches/@modelcontextprotocol%2Fclient@2.4.0.patch" "@modelcontextprotocol/client@2.4.0": "patches/@modelcontextprotocol%2Fclient@2.4.0.patch",
"@kobalte/core@0.13.13": "patches/@kobalte%2Fcore@0.13.13.patch",
"bun-pty@0.4.11": "patches/bun-pty@0.4.11.patch"
} }
} }

View file

@ -7,7 +7,8 @@
- **One canonical model.** The Schema classes in `src/schema/` are the data model. Do not add a parallel shape or a second construction path. - **One canonical model.** The Schema classes in `src/schema/` are the data model. Do not add a parallel shape or a second construction path.
- **Independent of Session.** Auth, permissions, plugins, and orchestration belong in Core. `ai.stream`/`ai.generate` run exactly one model call. - **Independent of Session.** Auth, permissions, plugins, and orchestration belong in Core. `ai.stream`/`ai.generate` run exactly one model call.
- **Reuse protocols.** Providers compose existing protocols with `Route.make(...)` instead of cloning them. - **Reuse protocols.** Providers compose existing protocols with `Route.make(...)` instead of cloning them.
- **One API, two runtimes.** `ai` from `@opencode/ai` and `ai` from `@opencode/ai/effect` have the same namespaces and operations, with the same names, overloads, input and options (plus `signal` on the Promise side); keep `test/promise-parity.types.ts` passing. - **One API, two runtimes.** `ai` from `@opencode/ai` and `ai` from `@opencode/ai/effect` have the same namespaces and operations, with the same names, overloads, input and options (plus `RunOptions`, `signal` and `http`, on the Promise side); keep `test/promise-parity.types.ts` passing.
- **One way to hook HTTP.** Every request goes through `RequestExecutor`, which applies executor-wide middleware (`RequestExecutor.middleware`) and the caller's scoped middleware (`RequestExecutor.withMiddleware`, Promise `{ http }`). Don't add a per-method hook option or send HTTP any other way. A `url` asset downloads with its own `middleware`, which a route sets only for URLs on the provider's origin. Types already require every route to send through the executor it is given, and lint rejects `fetch` and the `HttpClient` import outside `route/executor.ts`. Keep `test/http-hooks.test.ts` passing; it lists every Promise method.
## Code style ## Code style

View file

@ -1,7 +1,7 @@
# @opencode/ai # @opencode/ai
Schema-first APIs for text, images, decisions, and embeddings, built with Effect. Video, speech, transcription, extraction, and Schema-first APIs for text, images, video, decisions, and embeddings, built with Effect. Speech, transcription,
realtime voice are [experimental](#experimental). extraction, and realtime voice are [experimental](#experimental).
`@opencode/ai` is the Promise API: one managed runtime behind the LLM and media methods, plus asset helpers. `ai.file` `@opencode/ai` is the Promise API: one managed runtime behind the LLM and media methods, plus asset helpers. `ai.file`
and `ai.write` load `node:fs/promises` on first use, so no Effect `FileSystem` is needed: and `ai.write` load `node:fs/promises` on first use, so no Effect `FileSystem` is needed:
@ -211,7 +211,7 @@ Raw usage is preserved in `usage.providerMetadata.google`. `inputTokens` follows
`contextTokens` uses its full `raw_prompt_token` count when supplied. These can differ substantially with server-side `contextTokens` uses its full `raw_prompt_token` count when supplied. These can differ substantially with server-side
continuation. Explicit caches, hosted tools, and generated media are not supported by this initial protocol. continuation. Explicit caches, hosted tools, and generated media are not supported by this initial protocol.
The same configured facade names image models (and the experimental video, speech, and transcription models). The same configured facade names image and video models (and the experimental speech and transcription models).
`ai.image.generate` resolves the provider's image route from the model and returns `Media.Asset`s with lazily decoded bytes: `ai.image.generate` resolves the provider's image route from the model and returns `Media.Asset`s with lazily decoded bytes:
```ts ```ts
@ -249,6 +249,29 @@ const logged = RequestExecutor.middleware((request, next) =>
const everything = AIClient.layerWith(logged) // or AI.make({ layer: logged }) const everything = AIClient.layerWith(logged) // or AI.make({ layer: logged })
``` ```
To hook only some calls, such as adding a per-user header, scope middleware to them. It runs on every provider request
they make, whatever the modality: submits, polls, results and cancels. Executor-wide middleware wraps it.
```ts
const signed: HttpMiddleware = (request, next) => next(HttpClientRequest.setHeader(request, "x-user", "user-1"))
// Effect: an Effect or a Stream
const video =
yield *
Effect.gen(function* () {
const job = yield* ai.video.start({ model, prompt: "A red balloon floats up" })
return yield* ai.video.result(model, job.id)
}).pipe(RequestExecutor.withMiddleware(signed))
// Promise: `http` on any call's options; a handle it returns keeps it
await AI.ai.video.start({ model, prompt: "A red balloon floats up" }, { http: signed })
```
Downloading a `url` asset never uses the caller's scoped middleware, so hooks that add credentials can't reach another
host such as a CDN or a presigned storage URL. A result URL on the provider's own origin carries the middleware of the
call that returned it (`asset.middleware`), so it downloads the same way later. Set `middleware` yourself with
`Media.url(url, { middleware })`.
## Venice AI ## Venice AI
`Venice` provides native Chat Completions with streaming tools and reasoning. `model` and `chat` `Venice` provides native Chat Completions with streaming tools and reasoning. `model` and `chat`
@ -1031,6 +1054,135 @@ const program = Effect.gen(function* () {
The hosted result is represented as a provider-executed tool call and a tool result whose content carries the generated image as a file. Gemini image-capable models instead emit a first-class `media` `LLMEvent` for inline image output (`response.message` then carries a `media` part). Retaining `response.message` preserves the generated image for continuation on both routes. The hosted result is represented as a provider-executed tool call and a tool result whose content carries the generated image as a file. Gemini image-capable models instead emit a first-class `media` `LLMEvent` for inline image output (`response.message` then carries a `media` part). Retaining `response.message` preserves the generated image for continuation on both routes.
### Image jobs
`ai.image.generate` and `ai.image.stream` poll a queued image route for you. To manage the job yourself, use the same
calls as video: `start` submits it and returns `{ id }` at once, the provider's job ID as a string you can store and
read back from another process, and `status`, `result` and `cancel` take the model and that `id`. `status` is one read;
`result` fails with an `InvalidRequest` reason while the job is still running; `cancel` fails with an
`UnsupportedOperation` reason when the provider has no cancel endpoint. No shipped image route is queued yet, so on
every image model today all four fail with an `UnsupportedOperation` reason before sending anything.
```ts
const program = Effect.gen(function* () {
const job = yield* ai.image.start({ model, prompt: "A lighthouse" })
const status = yield* ai.image.status(model, job.id) // { status, progress? }
if (status.status === "completed") return yield* ai.image.result(model, job.id)
})
```
## Video generation
Video generation is a job: `start` submits it and returns at once, and the caller decides when to read its `status`,
fetch its `result`, or `cancel` it. Nothing polls for you. Every call after `start` takes the model and the job's
`id`, the provider's job ID as a string you can store and read back from another process, so recovering after a restart
is the same call as a normal status read. Models come from `.video(...)` selectors on the `XAI`, `OpenRouter`, `Volcengine`,
`BytePlus`, `MiniMax` and `Google` facades.
```ts
import { Effect } from "effect"
import { ai, Media } from "@opencode/ai/effect"
import { XAI } from "@opencode/ai/providers"
const model = XAI.configure({ apiKey: process.env.XAI_API_KEY }).video("grok-imagine-video-1.5")
const program = Effect.gen(function* () {
const job = yield* ai.video.start({
model,
prompt: "Panning wide shot of a calico kitten sleeping in the sunshine",
start: "https://example.com/first-frame.png", // exact first frame; `end` pins the last one
references: [], // images, videos or audio that guide subject or style
duration: "8 seconds",
aspect: "16:9", // or "auto" to follow the start image
resolution: "720p", // 480p | 720p | 1080p | 4k, or any provider value
sound: false,
})
job.id // the provider's job ID: store it with the provider and model ID
const status = yield* ai.video.status(model, job.id)
status.status // "running" | "completed" | "error"
status.reason // "failed" | "cancelled" | "expired", only when status is "error"
status.progress // 0..1, only when the provider reports it
const response = yield* ai.video.result(model, job.id)
yield* Media.write(response.video, "./kitten.mp4") // streams the download to disk
})
```
The shared fields are `prompt`, `start`, `end`, `references`, `duration`, `aspect`, `resolution` and `sound`;
everything else is provider-specific and goes under `providerOptions`, typed from the selected model. A request only
fails before sending when its protocol has no way to express it, such as a reference video on xAI. `sound` is the
exception: on models whose sound can't be switched (MiniMax H3 and Gemini Omni always have it, Hailuo never does) it
isn't sent, and the model's own behavior applies. Values the provider
may reject, like an unsupported duration or too many references, go to the provider, and its error comes back typed.
`start` and `end` are images. They take a URL, data URL, base64 string or bytes, or an asset built with
`Media.image(...)`, which rejects assets known to be video, audio or documents; URLs and provider file references
whose type isn't stated are sent and checked by the provider. `references` take any kind.
`status` is one read; `result` fails with an `InvalidRequest` reason when the job hasn't finished, and with the
provider's reason (and terminal document on `reason.body`) when it failed, was cancelled or expired. Moderation
outcomes (xAI `respect_moderation`) fail with a `ContentPolicy` reason when no video comes back. Status and result reads
retry transient failures (rate limits, provider 5xx, network errors) with backoff that honors `retry-after`; `start`
and `cancel` never retry. `cancel` fails with an `UnsupportedOperation` reason on providers without a cancel endpoint,
such as xAI, where the job keeps running and billing. Finished videos are usually URLs that expire (`expiresAt` when the
provider documents it): download them with `Media.write`, `asset.stream()` or `materialize()` before then.
Provider notes:
- **xAI** maps `start` to `image`, `end` to `last_frame`, image references to `reference_images`, audio references to
`reference_audios`, and `sound` to `generate_audio`, and leaves `aspect: "auto"` out when a start frame sets the
shape. It has no reference video input. `providerOptions.mode: "edit" | "extend"` sends a native `video: { url }`
source to `/videos/edits` or `/videos/extensions`.
- **OpenRouter** (`OpenRouter.configure(...).video("google/veo-3.1")`) maps `start` and `end` to `frame_images`,
references to `input_references` by kind (`image_url`, `video_url`, `audio_url`), `sound` to `generate_audio`, and
`resolution` to its spelling (`4k` → `4K`), and leaves `aspect: "auto"` out so models that can follow the input image do.
Frames and references are both sent; when both are present OpenRouter keeps the frames and drops the references. It
rejects reference videos or audio that aren't http(s) URLs (inline images work). Routing and upstream parameters go under `providerOptions.provider` (`only`, `order`,
`options: { <slug>: {...} }`), and `providerOptions.previous_job_id` edits or extends a finished job. Results are
OpenRouter content URLs that download with the API key, which the asset carries; there is no cancel endpoint.
- **Seedance** (`Volcengine.configure(...).video(...)` with `ARK_API_KEY`, `BytePlus.configure(...).video(...)` with
`BYTEPLUS_API_KEY`) builds Ark's `content[]`: the prompt as a `text` item, `start` and `end` as `image_url` items
with roles `first_frame` and `last_frame`, and references as `reference_image`, `reference_video` or
`reference_audio` by kind. Your own `Media.ref(...)` assets go as `asset://<id>`. `duration` goes to `duration`,
`aspect` to `ratio` (`auto` becomes `adaptive`), `resolution` to `resolution` and `sound` to `generate_audio`. Ark
doesn't allow frames and references in one task; that combination is sent and the provider's error comes back.
`providerOptions.draft_task: { id }` adds a `draft_task` item; `frames`, `seed`, `watermark`, `output_format`,
`omni_reference_task_type`, `return_last_frame` and the rest go into the body as-is. `cancel` sends `DELETE`, which
only cancels a queued task: Ark refuses it for a running one and deletes the record of a finished one. Video URLs
expire 24 hours after the task finished.
- **MiniMax** (`MiniMax.configure(...).video(id)`, or `@opencode/ai/providers/minimax/videos`) serves two APIs and picks
one by model family: Hailuo and `*-01` models use v1, everything else (H3) uses v2. Video builds its `/v1` and `/v2`
paths on the API host, so a `baseURL` shared with images or chat (`https://api.minimax.cn/v1`) loses its trailing
`/v1`, and a bare host (`https://api.minimax.io`) works as is. On H3, `start`, `end` and `references` become `content[]` items with `first_frame`, `last_frame` and `reference_image` /
`reference_video` / `reference_audio` roles, MiniMax file refs become `mm_file://` URLs, `aspect: "auto"` becomes
`ratio: "adaptive"`, and `resolution` is uppercased (`480P`, `2K`). H3 requires `resolution` and `duration`, plus a
`ratio` for text-only prompts; nothing is filled in, so MiniMax rejects a request without them. H3 always has sound
and has no field for it, so `sound` isn't sent. On Hailuo, `start` and `end` map to `first_frame_image` and
`last_frame_image`, image references to `subject_reference`, and the result looks up the file's download URL, which
expires after one hour. Hailuo is always silent, so `sound` isn't sent; it has no aspect field, so an explicit
`aspect` and video or audio references fail before sending. Cancel works on H3 (only while queued); Hailuo has no cancel. Native fields
such as `extra.prompt_expansion_mode` (H3), `prompt_optimizer` (Hailuo) and `callback_url` go under `providerOptions`.
- **Google** (`Google.video("gemini-omni-1.2-flash")`) starts a background Gemini Omni interaction. Omni has no
role field for media, so `start`, `end` and `references` go into `input` in that order (images, plus video
references), and `generation_config.video_config.task` is set to `image_to_video` for frames only or
`reference_to_video` for references only; with both, the prompt decides. `duration` becomes
`response_format.duration` (`"3s"`), and `aspect` and `resolution` go to `response_format` as is (resolution
lowercased); `aspect: "auto"` leaves the ratio out. It rejects `end` without `start` (a lone image reads as the
first frame). Omni always generates audio and has no field for it, so `sound` isn't sent. Videos come back as inline bytes. `cancel` posts to
`/interactions/{id}/cancel`. `providerOptions` takes native Interactions fields, such as `previous_interaction_id`
to edit or extend a generated video, `generation_config.video_config.task`, `service_tier` and `webhook_config`.
The promise client has the same calls, each accepting `{ signal }`:
```ts
import { ai } from "@opencode/ai"
const job = await ai.video.start({ model, prompt })
const status = await ai.video.status(model, job.id)
if (status.status === "completed") await ai.write((await ai.video.result(model, job.id)).video, "./kite.mp4")
```
## Public API ## Public API
Everything below is exported from `@opencode/ai/effect` unless noted. Everything below is exported from `@opencode/ai/effect` unless noted.
@ -1042,119 +1194,32 @@ Everything below is exported from `@opencode/ai/effect` unless noted.
- **`Message.user(...)` / `Message.assistant(...)` / `Message.tool(...)`** — message constructors from the canonical schema model. - **`Message.user(...)` / `Message.assistant(...)` / `Message.tool(...)`** — message constructors from the canonical schema model.
- **`LanguageModel.make(...)` / `ToolCallPart.make(...)` / `ToolResultPart.make(...)` / `ToolDefinition.make(...)`** — model and tool-related constructors from the canonical schema model. - **`LanguageModel.make(...)` / `ToolCallPart.make(...)` / `ToolResultPart.make(...)` / `ToolDefinition.make(...)`** — model and tool-related constructors from the canonical schema model.
- **`LLMEvent.is.*`** — typed guards (`is.textDelta`, `is.toolCall`, `is.finish`, …) for filtering streams. - **`LLMEvent.is.*`** — typed guards (`is.textDelta`, `is.toolCall`, `is.finish`, …) for filtering streams.
- **`ai.image.request` / `generate` / `stream` / `start` / `resume`** — images over inline, streaming (partial previews), and queued routes through a provider-neutral request and response model. - **`ai.image.request` / `generate` / `stream` / `start` / `status` / `result` / `cancel`** — images over inline, streaming (partial previews), and queued routes through a provider-neutral request and response model. `start`, `status`, `result` and `cancel` address a queued job by the provider's job ID, like video; see [Image jobs](#image-jobs).
- **`ImageClient`** — Effect service and layer for image execution, parallel to `LLMClient`. - **`ImageClient`** — Effect service and layer for image execution, parallel to `LLMClient`.
- **`ai.video.request` / `start` / `status` / `result` / `cancel`** — video generation as a job addressed by the provider's job ID; see [Video generation](#video-generation). `VideoClient` is its Effect service and layer.
- **`Media`** — the shared asset type (`Media.Asset`, `Media.Source`) and constructors used by messages, tool results, and media requests. - **`Media`** — the shared asset type (`Media.Asset`, `Media.Source`) and constructors used by messages, tool results, and media requests.
- **`Generation`** — provider-neutral handle for an in-flight media generation (`await`, `refresh`, `cancel`, `events`) used by queued media routes. - **`Generation`** — provider-neutral handle for an in-flight media generation (`await`, `refresh`, `cancel`, `events`) used by queued media routes.
- **`ai.decision.request` / `ai.decision.generate`** — typed predicate, choice, and score questions over text, JSON, and media input; `DecisionClient` is its Effect service and layer. - **`ai.decision.request` / `ai.decision.generate`** — typed predicate, choice, and score questions over text, JSON, and media input; `DecisionClient` is its Effect service and layer.
- **`ai.embedding.request` / `ai.embedding.generate`** — one vector per text or media value, with optional `dimensions` and `inputType`; `EmbeddingClient` is its Effect service and layer. - **`ai.embedding.request` / `ai.embedding.generate`** — one vector per text or media value, with optional `dimensions` and `inputType`; `EmbeddingClient` is its Effect service and layer.
- **`AIClient.layer` / `AIClient.layerWith(executor)`** — every modality client plus the request executor in one layer. - **`AIClient.layer` / `AIClient.layerWith(executor)`** — every modality client plus the request executor in one layer.
- **`@opencode/ai`** (Promise root) — a default `ai` with the text calls (`request`, `generate`, `stream`, `loop`, `compact`, `canCompact`) at the top level plus `image`, `decision` and `embedding` (plus `experimental.video`, `experimental.speech`, and `experimental.transcription`) as Promise / `AsyncIterable` APIs, `run(effect)` for any package Effect, plus `file`, `write`, `bytes`, `base64`, and `materialize` for assets. `AI.make({ layer? })` builds a client over a custom executor. The same `ai` from `@opencode/ai/effect` returns `Effect` and `Stream`. - **`@opencode/ai`** (Promise root) — a default `ai` with the text calls (`request`, `generate`, `stream`, `loop`, `compact`, `canCompact`) at the top level plus `image`, `decision`, `embedding` and `video` (plus `experimental.speech` and `experimental.transcription`) as Promise / `AsyncIterable` APIs, `run(effect)` for any package Effect, plus `file`, `write`, `bytes`, `base64`, and `materialize` for assets. `AI.make({ layer? })` builds a client over a custom executor. The same `ai` from `@opencode/ai/effect` returns `Effect` and `Stream`.
- **`@opencode/ai/experimental`** — APIs that may change without compatibility guarantees: `Video`, `Speech`, `Transcription`, `Extraction`, and `Realtime`. See [Experimental](#experimental). - **`@opencode/ai/experimental`** — APIs that may change without compatibility guarantees: `Speech`, `Transcription`, `Extraction`, and `Realtime`. See [Experimental](#experimental).
## Experimental ## Experimental
These APIs may change without compatibility guarantees. The Effect API is exported from `@opencode/ai/experimental`, These APIs may change without compatibility guarantees. The Effect API is exported from `@opencode/ai/experimental`,
and the Promise client exposes it under `ai.experimental`. and the Promise client exposes it under `ai.experimental`.
- **`Video`**, **`Speech`**, and **`Transcription`** — media generation and speech-to-text, with `VideoClient`, - **`Speech`** and **`Transcription`** — speech generation and speech-to-text, with `SpeechClient` and
`SpeechClient`, and `TranscriptionClient` as their Effect services. Promise: `ai.experimental.video`, `.speech`, and `TranscriptionClient` as their Effect services. Promise: `ai.experimental.speech` and `.transcription`.
`.transcription`.
- **`Extraction`** — typed values read out of text. - **`Extraction`** — typed values read out of text.
- **`Realtime`** — `Realtime.connect` starts an OpenAI, xAI, or Gemini voice session and returns a WebRTC answer SDP or - **`Realtime`** — `Realtime.connect` starts an OpenAI, xAI, or Gemini voice session and returns a WebRTC answer SDP or
a short-lived WebSocket URL and token. a short-lived WebSocket URL and token.
The provider selectors for these modalities (`.video(...)`, `.speech(...)`, `.transcription(...)`, The provider selectors for these modalities (`.speech(...)`, `.transcription(...)`,
`.experimental.extraction(...)`) and their protocol entrypoints (such as `@opencode/ai/protocols/openai-speech`) are `.experimental.extraction(...)`) and their protocol entrypoints (such as `@opencode/ai/protocols/openai-speech`) are
part of the same experimental surface. part of the same experimental surface.
### Video generation
Video mirrors `Image` with one difference: every provider is asynchronous, so the route is a submit-then-poll
`Generation`. Models come from `.video(...)` selectors on the `Google` (Veo), `XAI`, and `Runway` facades.
Common fields (`frames`, `references`, `video`, `durationSeconds`, `aspect`, `resolution`, `audio`, `n`, `seed`,
`negativePrompt`) lower natively or fail with a typed `AIError` before any network call; provider-native controls live
under `providerOptions`, inferred from the selected model.
```ts
import { Video } from "@opencode/ai/experimental"
import { Google, Runway } from "@opencode/ai/providers"
const google = Google.configure({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY })
// Simple: submit and wait.
const program = Effect.gen(function* () {
const response = yield* Video.generate(
{
model: google.video("veo-3.1-generate-preview"),
prompt: "Panning wide shot of a calico kitten sleeping in the sunshine",
aspect: "16:9",
resolution: "1080p",
durationSeconds: 8,
providerOptions: { personGeneration: "allow_adult" },
},
{ poll: { interval: "10 seconds", timeout: "10 minutes" } },
)
// Veo serves files for two days behind the API key. The asset knows the deadline (`expiresAt`) and carries the
// download credentials only on the live instance (`asset.headers`), never in `source` or JSON: materialize
// before persisting, or the persisted URL cannot be fetched again.
return yield* response.video.materialize()
})
// Explicit control: keep the handle, persist the token, resume elsewhere.
const controlled = Effect.gen(function* () {
const generation = yield* Video.start({ model: google.video("veo-3.1-generate-preview"), prompt })
generation.id // provider operation / task / request id
generation.status // "queued" | "running" | "completed" | "failed" | "cancelled" | "expired"
generation.token // route-owned JSON: `{ operation }`, `{ requestID }`, or `{ taskID }`
// The token carries no route identity: persist the provider and model ID alongside it, since `resume` needs the model.
const saved = JSON.stringify(generation.token)
const resumed = yield* Video.resume(google.video("veo-3.1-generate-preview"), JSON.parse(saved))
return yield* resumed.await({ poll: { interval: "10 seconds" } })
})
// Progress as a stream: generation-queued | generation-progress | video | finish.
const events = Video.stream({ model: Runway.configure({ apiKey }).video("gen4.5"), prompt }, { poll })
```
Status polls, result fetches, cancels, and asset downloads all run through the same request executor with the route's
auth. `Generation.await` and `Generation.events` fail with a
`Timeout` reason when `poll.timeout` (default 10 minutes) elapses. Status polls and result fetches retry transient
failures (rate limits, provider 5xx, network errors) with backoff that honors `retry-after`, always within
`poll.timeout`; submits and cancels never retry. Interrupting a wait (or aborting its `signal`) does not cancel the
provider job, which keeps running and billing: call `cancel()` to stop it. Failed,
cancelled, and expired generations fail typed with the provider's terminal document on `reason.body`; moderation
outcomes (Veo `raiMediaFilteredReasons`, xAI `respect_moderation`, Runway `SAFETY.*` codes) fail with a
`ContentPolicy` reason when no video comes back; when one still does, Veo and xAI keep the raw outcome in
`providerMetadata`.
Provider notes:
- **Google Veo** takes inline bytes only (materialize `url` assets first); `frames.last` requires `frames.first`;
audio is always on, so `audio: false` fails typed; one video per request. Output URLs need the API key to
download, which the returned asset holds transiently (see above).
- **xAI** sends a `video` input to `/videos/edits`, or `/videos/extensions` with `providerOptions.mode: "extend"`.
`seed` and `negativePrompt` are not supported.
- **Runway** expects pixel ratios in `aspect` for most models (`"1280:720"`), pins `X-Runway-Version`, reports
`usage: { type: "credits" }`, and its output URLs expire after 24–48 hours.
The promise client exposes the same surface: `ai.experimental.video.start(...)` resolves to a handle with `await`, `events`,
`result`, `refresh`, `cancel`, and `token`; `ai.experimental.video.generate`, `ai.experimental.video.resume(model, token)`, and
`ai.experimental.video.stream` mirror the Effect API. The handle's `status` and `progress` are a snapshot from when it was
created; `refresh()` resolves to a new handle. Every promise method and stream accepts `{ signal }`: like `fetch`,
aborting rejects the Promise or throws from the `for await` loop with `signal.reason` (an `AbortError` `DOMException`
unless `abort(reason)` passed one), while `break` stops a stream without throwing.
```ts
import { ai } from "@opencode/ai"
const generation = await ai.experimental.video.start({ model, prompt })
for await (const event of generation.events({ poll: { interval: 10_000 } })) console.log(event.type)
const video = await generation.result({ signal })
await ai.write(video.video, "./kite.mp4")
```
### Speech generation ### Speech generation
Speech (text-to-speech) is one request whose response is parsed incrementally, so every route supports both Speech (text-to-speech) is one request whose response is parsed incrementally, so every route supports both
@ -1287,8 +1352,8 @@ const program = Effect.gen(function* () {
}) })
``` ```
Inline routes emit only `finish` from `stream` (no faked deltas); queued routes emit `generation-queued` / Inline routes emit only `finish` from `stream` (no faked deltas); queued routes emit `generation-progress`
`generation-progress` before it. before it.
Provider notes: Provider notes:

View file

@ -1,6 +1,6 @@
{ {
"$schema": "https://json.schemastore.org/package.json", "$schema": "https://json.schemastore.org/package.json",
"version": "2.2.7", "version": "2.4.1",
"name": "@opencode/ai", "name": "@opencode/ai",
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",
@ -44,6 +44,8 @@
"./providers/azure/responses": "./src/providers/azure/responses.ts", "./providers/azure/responses": "./src/providers/azure/responses.ts",
"./providers/baseten": "./src/providers/baseten.ts", "./providers/baseten": "./src/providers/baseten.ts",
"./providers/baseten/decisions": "./src/providers/baseten/decisions.ts", "./providers/baseten/decisions": "./src/providers/baseten/decisions.ts",
"./providers/byteplus": "./src/providers/byteplus.ts",
"./providers/byteplus/videos": "./src/providers/byteplus/videos.ts",
"./providers/cartesia": "./src/providers/cartesia.ts", "./providers/cartesia": "./src/providers/cartesia.ts",
"./providers/cerebras": "./src/providers/cerebras.ts", "./providers/cerebras": "./src/providers/cerebras.ts",
"./providers/cloudflare-ai-gateway": "./src/providers/cloudflare-ai-gateway.ts", "./providers/cloudflare-ai-gateway": "./src/providers/cloudflare-ai-gateway.ts",
@ -77,9 +79,11 @@
"./providers/google-vertex/messages": "./src/providers/google-vertex/messages.ts", "./providers/google-vertex/messages": "./src/providers/google-vertex/messages.ts",
"./providers/google-vertex/mistral": "./src/providers/google-vertex/mistral.ts", "./providers/google-vertex/mistral": "./src/providers/google-vertex/mistral.ts",
"./providers/google-vertex/responses": "./src/providers/google-vertex/responses.ts", "./providers/google-vertex/responses": "./src/providers/google-vertex/responses.ts",
"./providers/google/decisions": "./src/providers/google/decisions.ts",
"./providers/google/embeddings": "./src/providers/google/embeddings.ts", "./providers/google/embeddings": "./src/providers/google/embeddings.ts",
"./providers/google/images": "./src/providers/google/images.ts", "./providers/google/images": "./src/providers/google/images.ts",
"./providers/google/interactions": "./src/providers/google/interactions.ts", "./providers/google/interactions": "./src/providers/google/interactions.ts",
"./providers/google/videos": "./src/providers/google/videos.ts",
"./providers/groq": "./src/providers/groq.ts", "./providers/groq": "./src/providers/groq.ts",
"./providers/meta": "./src/providers/meta.ts", "./providers/meta": "./src/providers/meta.ts",
"./providers/meta/chat": "./src/providers/meta/chat.ts", "./providers/meta/chat": "./src/providers/meta/chat.ts",
@ -91,6 +95,7 @@
"./providers/minimax/images": "./src/providers/minimax/images.ts", "./providers/minimax/images": "./src/providers/minimax/images.ts",
"./providers/minimax/messages": "./src/providers/minimax/messages.ts", "./providers/minimax/messages": "./src/providers/minimax/messages.ts",
"./providers/minimax/responses": "./src/providers/minimax/responses.ts", "./providers/minimax/responses": "./src/providers/minimax/responses.ts",
"./providers/minimax/videos": "./src/providers/minimax/videos.ts",
"./providers/mistral": "./src/providers/mistral.ts", "./providers/mistral": "./src/providers/mistral.ts",
"./providers/moonshot": "./src/providers/moonshot.ts", "./providers/moonshot": "./src/providers/moonshot.ts",
"./providers/moonshot/chat": "./src/providers/moonshot/chat.ts", "./providers/moonshot/chat": "./src/providers/moonshot/chat.ts",
@ -113,13 +118,15 @@
"./providers/openrouter/decisions": "./src/providers/openrouter/decisions.ts", "./providers/openrouter/decisions": "./src/providers/openrouter/decisions.ts",
"./providers/openrouter/embeddings": "./src/providers/openrouter/embeddings.ts", "./providers/openrouter/embeddings": "./src/providers/openrouter/embeddings.ts",
"./providers/openrouter/images": "./src/providers/openrouter/images.ts", "./providers/openrouter/images": "./src/providers/openrouter/images.ts",
"./providers/openrouter/videos": "./src/providers/openrouter/videos.ts",
"./providers/openrouter/responses": "./src/providers/openrouter/responses.ts", "./providers/openrouter/responses": "./src/providers/openrouter/responses.ts",
"./providers/runway": "./src/providers/runway.ts",
"./providers/togetherai": "./src/providers/togetherai.ts", "./providers/togetherai": "./src/providers/togetherai.ts",
"./providers/typesafe-ai": "./src/providers/typesafe-ai.ts", "./providers/typesafe-ai": "./src/providers/typesafe-ai.ts",
"./providers/typesafe-ai/decisions": "./src/providers/typesafe-ai/decisions.ts", "./providers/typesafe-ai/decisions": "./src/providers/typesafe-ai/decisions.ts",
"./providers/venice": "./src/providers/venice.ts", "./providers/venice": "./src/providers/venice.ts",
"./providers/venice/responses": "./src/providers/venice/responses.ts", "./providers/venice/responses": "./src/providers/venice/responses.ts",
"./providers/volcengine": "./src/providers/volcengine.ts",
"./providers/volcengine/videos": "./src/providers/volcengine/videos.ts",
"./providers/vercel-ai-gateway": "./src/providers/vercel-ai-gateway.ts", "./providers/vercel-ai-gateway": "./src/providers/vercel-ai-gateway.ts",
"./providers/vercel-ai-gateway/chat": "./src/providers/vercel-ai-gateway/chat.ts", "./providers/vercel-ai-gateway/chat": "./src/providers/vercel-ai-gateway/chat.ts",
"./providers/vercel-ai-gateway/decisions": "./src/providers/vercel-ai-gateway/decisions.ts", "./providers/vercel-ai-gateway/decisions": "./src/providers/vercel-ai-gateway/decisions.ts",
@ -129,6 +136,7 @@
"./providers/vercel-ai-gateway/responses": "./src/providers/vercel-ai-gateway/responses.ts", "./providers/vercel-ai-gateway/responses": "./src/providers/vercel-ai-gateway/responses.ts",
"./providers/xai": "./src/providers/xai.ts", "./providers/xai": "./src/providers/xai.ts",
"./providers/xai/images": "./src/providers/xai/images.ts", "./providers/xai/images": "./src/providers/xai/images.ts",
"./providers/xai/videos": "./src/providers/xai/videos.ts",
"./providers/zai": "./src/providers/zai.ts", "./providers/zai": "./src/providers/zai.ts",
"./providers/zai-coding-plan": "./src/providers/zai-coding-plan.ts", "./providers/zai-coding-plan": "./src/providers/zai-coding-plan.ts",
"./providers/zai-coding-plan/chat": "./src/providers/zai-coding-plan/chat.ts", "./providers/zai-coding-plan/chat": "./src/providers/zai-coding-plan/chat.ts",
@ -141,16 +149,20 @@
"./protocols/cloudflare-run-decisions": "./src/protocols/cloudflare-run-decisions.ts", "./protocols/cloudflare-run-decisions": "./src/protocols/cloudflare-run-decisions.ts",
"./protocols/cloudflare-workers-ai-images": "./src/protocols/cloudflare-workers-ai-images.ts", "./protocols/cloudflare-workers-ai-images": "./src/protocols/cloudflare-workers-ai-images.ts",
"./protocols/deepgram-transcription": "./src/protocols/deepgram-transcription.ts", "./protocols/deepgram-transcription": "./src/protocols/deepgram-transcription.ts",
"./protocols/google-decisions": "./src/protocols/google-decisions.ts",
"./protocols/google-images": "./src/protocols/google-images.ts", "./protocols/google-images": "./src/protocols/google-images.ts",
"./protocols/google-interactions-video": "./src/protocols/google-interactions-video.ts",
"./protocols/google-speech": "./src/protocols/google-speech.ts", "./protocols/google-speech": "./src/protocols/google-speech.ts",
"./protocols/google-transcription": "./src/protocols/google-transcription.ts", "./protocols/google-transcription": "./src/protocols/google-transcription.ts",
"./protocols/openai-chat": "./src/protocols/openai-chat.ts", "./protocols/openai-chat": "./src/protocols/openai-chat.ts",
"./protocols/openai-decisions": "./src/protocols/openai-decisions.ts", "./protocols/openai-decisions": "./src/protocols/openai-decisions.ts",
"./protocols/openai-embeddings": "./src/protocols/openai-embeddings.ts", "./protocols/openai-embeddings": "./src/protocols/openai-embeddings.ts",
"./protocols/openai-images": "./src/protocols/openai-images.ts", "./protocols/openai-images": "./src/protocols/openai-images.ts",
"./protocols/openrouter-video": "./src/protocols/openrouter-video.ts",
"./protocols/openai-responses": "./src/protocols/openai-responses.ts", "./protocols/openai-responses": "./src/protocols/openai-responses.ts",
"./protocols/openai-speech": "./src/protocols/openai-speech.ts", "./protocols/openai-speech": "./src/protocols/openai-speech.ts",
"./protocols/openai-transcription": "./src/protocols/openai-transcription.ts", "./protocols/openai-transcription": "./src/protocols/openai-transcription.ts",
"./protocols/seedance-video": "./src/protocols/seedance-video.ts",
"./protocols/system-one": "./src/protocols/system-one.ts", "./protocols/system-one": "./src/protocols/system-one.ts",
"./protocols/xai-images": "./src/protocols/xai-images.ts", "./protocols/xai-images": "./src/protocols/xai-images.ts",
"./protocols/xai-video": "./src/protocols/xai-video.ts", "./protocols/xai-video": "./src/protocols/xai-video.ts",

View file

@ -104,17 +104,6 @@ const PROVIDERS: ReadonlyArray<Provider> = [
vars: [{ name: "XAI_API_KEY" }], vars: [{ name: "XAI_API_KEY" }],
validate: (env) => validateBearer("https://api.x.ai/v1/models", Redacted.make(env.XAI_API_KEY)), validate: (env) => validateBearer("https://api.x.ai/v1/models", Redacted.make(env.XAI_API_KEY)),
}, },
{
id: "runway",
label: "Runway",
tier: "canary",
note: "Runway task video recorded tests",
vars: [{ name: "RUNWAYML_API_SECRET" }],
validate: (env) =>
validateBearer("https://api.dev.runwayml.com/v1/organization", Redacted.make(env.RUNWAYML_API_SECRET), {
"X-Runway-Version": "2024-11-06",
}),
},
{ {
id: "elevenlabs", id: "elevenlabs",
label: "ElevenLabs", label: "ElevenLabs",

View file

@ -23,6 +23,7 @@ import {
type ToolEntry, type ToolEntry,
} from "./schema/messages.js" } from "./schema/messages.js"
import { effortUpdate } from "./effort-updates.js" import { effortUpdate } from "./effort-updates.js"
import { toolsUpdate } from "./tool-updates.js"
const AUTO: CachePolicyObject = { const AUTO: CachePolicyObject = {
tools: true, tools: true,
@ -191,14 +192,15 @@ const markMessages = (
let remaining = strategy.tail let remaining = strategy.tail
while (remaining > 0 && start > 0) { while (remaining > 0 && start > 0) {
start -= 1 start -= 1
if (effortUpdate(messages[start]!) === undefined) remaining -= 1 if (!isMarker(messages[start]!)) remaining -= 1
} }
let next = messages let next = messages
for (let i = start; i < messages.length; i++) for (let i = start; i < messages.length; i++) if (!isMarker(messages[i]!)) next = markMessageAt(next, i, hint, budget)
if (effortUpdate(messages[i]!) === undefined) next = markMessageAt(next, i, hint, budget)
return next return next
} }
const isMarker = (message: Message) => effortUpdate(message) !== undefined || toolsUpdate(message) !== undefined
const countHints = (request: LLMRequest) => const countHints = (request: LLMRequest) =>
countToolHints(request.tools) + countToolHints(request.tools) +
request.system.reduce((count, part) => count + (part.cache === undefined ? 0 : 1), 0) + request.system.reduce((count, part) => count + (part.cache === undefined ? 0 : 1), 0) +

View file

@ -5,7 +5,7 @@ import { tryRequest } from "./media-model.js"
import { import {
AIError, AIError,
type BaseRequest, type BaseRequest,
type HttpOptions, type TransportOptions,
ModelID, ModelID,
ProviderID, ProviderID,
ProviderMetadata, ProviderMetadata,
@ -200,7 +200,8 @@ export class DecisionModel<Options extends DecisionOptions = DecisionOptions> {
readonly id: ModelID readonly id: ModelID
readonly provider: ProviderID readonly provider: ProviderID
readonly route: DecisionModelRoute<Options> readonly route: DecisionModelRoute<Options>
readonly http?: HttpOptions /** Deployment headers, timeouts and `http` overlays, below each request's own. */
readonly transport?: TransportOptions
readonly compatibility?: DecisionModelCompatibility readonly compatibility?: DecisionModelCompatibility
/** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */ /** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */
readonly providerOptions?: ProviderOptions readonly providerOptions?: ProviderOptions
@ -209,7 +210,7 @@ export class DecisionModel<Options extends DecisionOptions = DecisionOptions> {
this.id = input.id this.id = input.id
this.provider = input.provider this.provider = input.provider
this.route = input.route this.route = input.route
this.http = input.http this.transport = input.transport
this.compatibility = input.compatibility this.compatibility = input.compatibility
this.providerOptions = input.providerOptions this.providerOptions = input.providerOptions
} }
@ -228,7 +229,7 @@ export namespace DecisionModel {
readonly id: ModelID readonly id: ModelID
readonly provider: ProviderID readonly provider: ProviderID
readonly route: DecisionModelRoute<Options> readonly route: DecisionModelRoute<Options>
readonly http?: HttpOptions readonly transport?: TransportOptions
readonly compatibility?: DecisionModelCompatibility readonly compatibility?: DecisionModelCompatibility
readonly providerOptions?: ProviderOptions readonly providerOptions?: ProviderOptions
} }

View file

@ -18,17 +18,18 @@ export const ai = {
image: Image, image: Image,
decision: Decision, decision: Decision,
embedding: Embedding, embedding: Embedding,
video: Video,
/** Experimental: may change without compatibility guarantees. */ /** Experimental: may change without compatibility guarantees. */
experimental: { experimental: {
speech: Speech, speech: Speech,
transcription: Transcription, transcription: Transcription,
video: Video,
}, },
} as const } as const
export { AIClient } from "./ai-client.js" export { AIClient } from "./ai-client.js"
export { LLMClient } from "./route/client.js" export { LLMClient } from "./route/client.js"
export { ImageClient } from "./image-client.js" export { ImageClient } from "./image-client.js"
export { VideoClient } from "./video-client.js"
export { Auth } from "./route/auth.js" export { Auth } from "./route/auth.js"
export { ProviderPackage } from "./provider-package.js" export { ProviderPackage } from "./provider-package.js"
export type { LLMClientService } from "./route/client.js" export type { LLMClientService } from "./route/client.js"

View file

@ -5,7 +5,7 @@ import { tryRequest } from "./media-model.js"
import { import {
type AIError, type AIError,
type BaseRequest, type BaseRequest,
type HttpOptions, type TransportOptions,
ModelID, ModelID,
ProviderID, ProviderID,
ProviderMetadata, ProviderMetadata,
@ -38,7 +38,10 @@ export type EmbeddingOptions = Record<string, unknown>
/** What an embedding model's route does; `EmbeddingRoute.make(...).model(...)` builds one from a protocol. */ /** What an embedding model's route does; `EmbeddingRoute.make(...).model(...)` builds one from a protocol. */
export interface EmbeddingModelRoute<Options extends EmbeddingOptions = EmbeddingOptions> { export interface EmbeddingModelRoute<Options extends EmbeddingOptions = EmbeddingOptions> {
readonly id: string readonly id: string
generate(request: EmbeddingRequest<EmbeddingModel<Options>>, execute: Execute): Effect.Effect<EmbeddingResponse, AIError> generate(
request: EmbeddingRequest<EmbeddingModel<Options>>,
execute: Execute,
): Effect.Effect<EmbeddingResponse, AIError>
} }
export class EmbeddingModel<Options extends EmbeddingOptions = EmbeddingOptions> { export class EmbeddingModel<Options extends EmbeddingOptions = EmbeddingOptions> {
@ -46,7 +49,8 @@ export class EmbeddingModel<Options extends EmbeddingOptions = EmbeddingOptions>
readonly id: ModelID readonly id: ModelID
readonly provider: ProviderID readonly provider: ProviderID
readonly route: EmbeddingModelRoute<Options> readonly route: EmbeddingModelRoute<Options>
readonly http?: HttpOptions /** Deployment headers, timeouts and `http` overlays, below each request's own. */
readonly transport?: TransportOptions
/** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */ /** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */
readonly providerOptions?: ProviderOptions readonly providerOptions?: ProviderOptions
@ -54,7 +58,7 @@ export class EmbeddingModel<Options extends EmbeddingOptions = EmbeddingOptions>
this.id = input.id this.id = input.id
this.provider = input.provider this.provider = input.provider
this.route = input.route this.route = input.route
this.http = input.http this.transport = input.transport
this.providerOptions = input.providerOptions this.providerOptions = input.providerOptions
} }
@ -72,7 +76,7 @@ export namespace EmbeddingModel {
readonly id: ModelID readonly id: ModelID
readonly provider: ProviderID readonly provider: ProviderID
readonly route: EmbeddingModelRoute<Options> readonly route: EmbeddingModelRoute<Options>
readonly http?: HttpOptions readonly transport?: TransportOptions
readonly providerOptions?: ProviderOptions readonly providerOptions?: ProviderOptions
} }

View file

@ -1,14 +1,3 @@
export { VideoClient } from "./video-client.js"
export { VideoAspectRatio, VideoEvent, VideoFrames, VideoModel, VideoModelSchema, VideoResponse } from "./video.js"
export type {
VideoModelOptions,
VideoOptions,
VideoRequest,
VideoRequestInput,
VideoResolution,
VideoRoute,
} from "./video.js"
export { Video } from "./video.js"
export { SpeechClient } from "./speech-client.js" export { SpeechClient } from "./speech-client.js"
export { SpeechEvent, SpeechModel, SpeechModelSchema, SpeechResponse, SpeechTimestamp, SpeechVoice } from "./speech.js" export { SpeechEvent, SpeechModel, SpeechModelSchema, SpeechResponse, SpeechTimestamp, SpeechVoice } from "./speech.js"
export type { export type {
@ -54,6 +43,7 @@ export type {
export { Realtime } from "./experimental/realtime.js" export { Realtime } from "./experimental/realtime.js"
export type { export type {
RealtimeConnectInput, RealtimeConnectInput,
RealtimeEngine,
RealtimeSession, RealtimeSession,
RealtimeTransport, RealtimeTransport,
RealtimeTransportInput, RealtimeTransportInput,

View file

@ -99,14 +99,13 @@ export const model = (input: MediaRoute.ModelInput) =>
new ExtractionModel({ new ExtractionModel({
id: input.id, id: input.id,
provider: route.provider, provider: route.provider,
http: input.http, transport: input.transport,
route: MediaRoute.inline({ route: MediaRoute.inline({
protocol, protocol,
endpoint: Endpoint.path<MediaProtocol.Body, ExtractionRequest>(({ request }) => `/${request.model.id}`, { endpoint: Endpoint.path<MediaProtocol.Body, ExtractionRequest>(({ request }) => `/${request.model.id}`, {
baseURL: input.baseURL, baseURL: input.baseURL,
}), }),
auth: input.auth, auth: input.auth,
headers: input.headers,
}), }),
}) })

View file

@ -1,7 +1,7 @@
import { Clock, Effect, Redacted, Schema } from "effect" import { Clock, Effect, Redacted, Schema } from "effect"
import { HttpClientRequest } from "effect/http" import { HttpClientRequest } from "effect/http"
import { RequestExecutor } from "../route/executor.js" import { RequestExecutor } from "../route/executor.js"
import { AIError, InvalidProviderOutputError, InvalidRequestError } from "../schema/index.js" import { AIError, InvalidProviderOutputError, InvalidRequestError, type RequestTimeout } from "../schema/index.js"
import { encodeJson } from "../utils/json.js" import { encodeJson } from "../utils/json.js"
const OPENAI_BASE_URL = "https://api.openai.com/v1" const OPENAI_BASE_URL = "https://api.openai.com/v1"
@ -21,42 +21,30 @@ export type RealtimeTransport =
export type RealtimeSession = Readonly<Record<string, unknown>> export type RealtimeSession = Readonly<Record<string, unknown>>
export interface RealtimeConnectInput { export interface RealtimeConnectInput {
readonly engine: RealtimeEngine
readonly model: string readonly model: string
readonly apiKey: Redacted.Redacted readonly apiKey: Redacted.Redacted
/** Where a GPT-Live session starts, OpenAI by default: another host of its API, such as OpenCode's. */ /** Where a GPT-Live session starts, OpenAI by default: another host of its API, such as OpenCode's. */
readonly baseURL?: string readonly baseURL?: string
/** Headers that host needs besides the API key, such as OpenCode's workspace. */ /** Headers that host needs besides the API key, such as OpenCode's workspace. */
readonly headers?: Readonly<Record<string, string>> readonly headers?: Readonly<Record<string, string>>
readonly timeout?: RequestTimeout
readonly session?: RealtimeSession readonly session?: RealtimeSession
readonly transport: RealtimeTransportInput readonly transport: RealtimeTransportInput
} }
// The voice APIs this package speaks, by provider and models.dev API. Which models they start comes from models.dev.
export const engines = [ export const engines = [
{ family: "gpt-live", model: "gpt-live-1", id: "openai-live", provider: "openai", transports: ["webrtc"] }, { id: "openai-live", provider: "openai", api: "live", transports: ["webrtc"] },
{ { id: "openai-realtime", provider: "openai", api: "realtime", transports: ["webrtc", "websocket"] },
family: "gpt-realtime", { id: "xai-realtime", provider: "xai", api: "realtime", transports: ["websocket"] },
model: "gpt-realtime-2.1", { id: "gemini-live", provider: "google", api: "bidi-generate-content", transports: ["websocket"] },
id: "openai-realtime",
provider: "openai",
transports: ["webrtc", "websocket"],
},
{ family: "grok-voice", model: "grok-voice-3.0", id: "xai-realtime", provider: "xai", transports: ["websocket"] },
{
family: "gemini-3.8-live",
model: "gemini-3.8-live",
id: "gemini-live",
provider: "google",
transports: ["websocket"],
},
] as const ] as const
// Matches the bare family name (`gpt-realtime`) and its versions (`gpt-realtime-2.1`, `gpt-realtime-mini`). export type RealtimeEngine = (typeof engines)[number]
export const engine = (model: string) =>
engines.find((item) => model === item.family || model.startsWith(`${item.family}-`))
export const connect = Effect.fn("Realtime.connect")(function* (input: RealtimeConnectInput) { export const connect = Effect.fn("Realtime.connect")(function* (input: RealtimeConnectInput) {
const resolved = engine(input.model) const resolved = input.engine
if (!resolved) return yield* invalidRequest(`Unsupported voice model: ${input.model}`)
if (!resolved.transports.some((type) => type === input.transport.type)) if (!resolved.transports.some((type) => type === input.transport.type))
return yield* invalidRequest(`${input.model} only supports ${resolved.transports.join(", ")} transport`) return yield* invalidRequest(`${input.model} only supports ${resolved.transports.join(", ")} transport`)
const session = { ...input.session, model: input.model } const session = { ...input.session, model: input.model }
@ -69,16 +57,23 @@ export const connect = Effect.fn("Realtime.connect")(function* (input: RealtimeC
input.apiKey, input.apiKey,
{ session, transport: input.transport }, { session, transport: input.transport },
LiveSessionResponse, LiveSessionResponse,
{ headers: input.headers }, { headers: input.headers, timeout: input.timeout },
) )
return { type: "webrtc" as const, sdp: data.transport.sdp } return { type: "webrtc" as const, sdp: data.transport.sdp }
} }
case "openai-realtime": { case "openai-realtime": {
if (input.transport.type === "websocket") if (input.transport.type === "websocket")
return yield* clientSecret(resolved.id, OPENAI_BASE_URL, input.model, input.apiKey, { return yield* clientSecret(
expires_after: { anchor: "created_at", seconds: 60 }, resolved.id,
session, OPENAI_BASE_URL,
}) input.model,
input.apiKey,
{
expires_after: { anchor: "created_at", seconds: 60 },
session,
},
input.timeout,
)
const form = new FormData() const form = new FormData()
form.append("sdp", input.transport.sdp) form.append("sdp", input.transport.sdp)
form.append("session", encodeJson(session)) form.append("session", encodeJson(session))
@ -89,13 +84,21 @@ export const connect = Effect.fn("Realtime.connect")(function* (input: RealtimeC
input.apiKey, input.apiKey,
form, form,
Schema.String, Schema.String,
{ timeout: input.timeout },
) )
return { type: "webrtc" as const, sdp } return { type: "webrtc" as const, sdp }
} }
case "xai-realtime": case "xai-realtime":
return yield* clientSecret(resolved.id, XAI_BASE_URL, input.model, input.apiKey, { return yield* clientSecret(
expires_after: { seconds: 60 }, resolved.id,
}) XAI_BASE_URL,
input.model,
input.apiKey,
{
expires_after: { seconds: 60 },
},
input.timeout,
)
case "gemini-live": { case "gemini-live": {
const now = yield* Clock.currentTimeMillis const now = yield* Clock.currentTimeMillis
const expiresAt = now + 60_000 const expiresAt = now + 60_000
@ -110,7 +113,7 @@ export const connect = Effect.fn("Realtime.connect")(function* (input: RealtimeC
bidiGenerateContentSetup: { ...input.session, model: `models/${input.model}` }, bidiGenerateContentSetup: { ...input.session, model: `models/${input.model}` },
}, },
AuthTokenResponse, AuthTokenResponse,
{ authHeader: "x-goog-api-key" }, { authHeader: "x-goog-api-key", timeout: input.timeout },
) )
return { return {
type: "websocket" as const, type: "websocket" as const,
@ -124,7 +127,6 @@ export const connect = Effect.fn("Realtime.connect")(function* (input: RealtimeC
export const Realtime = { export const Realtime = {
engines, engines,
engine,
connect, connect,
} as const } as const
@ -158,11 +160,18 @@ const post = <A>(
apiKey: Redacted.Redacted, apiKey: Redacted.Redacted,
body: Record<string, unknown> | FormData, body: Record<string, unknown> | FormData,
response: Schema.Codec<A, string>, response: Schema.Codec<A, string>,
options: { readonly authHeader?: string; readonly headers?: Readonly<Record<string, string>> } = {}, options: {
readonly authHeader?: string
readonly headers?: Readonly<Record<string, string>>
readonly timeout?: RequestTimeout
} = {},
) => ) =>
Effect.gen(function* () { Effect.gen(function* () {
const executor = yield* RequestExecutor.Service const executor = yield* RequestExecutor.Service
const res = yield* executor.execute( const res = yield* RequestExecutor.withTimeout(
executor.execute,
options.timeout,
)(
HttpClientRequest.post(url).pipe( HttpClientRequest.post(url).pipe(
HttpClientRequest.setHeaders(options.headers ?? {}), HttpClientRequest.setHeaders(options.headers ?? {}),
options.authHeader options.authHeader
@ -176,7 +185,7 @@ const post = <A>(
const http = RequestExecutor.responseHttp(res) const http = RequestExecutor.responseHttp(res)
const fail = (message: string, cause?: unknown, raw?: string) => const fail = (message: string, cause?: unknown, raw?: string) =>
new AIError({ reason: new InvalidProviderOutputError({ route, message, body: raw, http, cause }) }) new AIError({ reason: new InvalidProviderOutputError({ route, message, body: raw, http, cause }) })
const text = yield* res.text.pipe(Effect.mapError((cause) => fail(`Failed to read ${route} response`, cause))) const text = yield* RequestExecutor.responseText(res)
return yield* Schema.decodeEffect(response)(text).pipe( return yield* Schema.decodeEffect(response)(text).pipe(
Effect.mapError((cause) => fail(`${route} returned an invalid response`, cause, text)), Effect.mapError((cause) => fail(`${route} returned an invalid response`, cause, text)),
) )
@ -188,8 +197,9 @@ const clientSecret = (
model: string, model: string,
apiKey: Redacted.Redacted, apiKey: Redacted.Redacted,
body: Record<string, unknown>, body: Record<string, unknown>,
timeout?: RequestTimeout,
) => ) =>
post(route, `${baseURL}/realtime/client_secrets`, apiKey, body, ClientSecretResponse).pipe( post(route, `${baseURL}/realtime/client_secrets`, apiKey, body, ClientSecretResponse, { timeout }).pipe(
Effect.map( Effect.map(
(data): RealtimeTransport => ({ (data): RealtimeTransport => ({
type: "websocket", type: "websocket",

View file

@ -1,16 +1,21 @@
import { Clock, Duration, Effect, Schedule, Schema, Stream } from "effect" import { Clock, Duration, Effect, Schedule, Schema, Stream } from "effect"
import { AIError, TimeoutError } from "./schema/errors.js" import { AIError, TimeoutError } from "./schema/errors.js"
export const Status = Schema.Literals(["queued", "running", "completed", "failed", "cancelled", "expired"]) export const Status = Schema.Literals(["running", "completed", "error"])
export type Status = Schema.Schema.Type<typeof Status> export type Status = Schema.Schema.Type<typeof Status>
/** Why a generation ended in `error`. */
export const Reason = Schema.Literals(["failed", "cancelled", "expired"])
export type Reason = Schema.Schema.Type<typeof Reason>
/** Provider-neutral view of one generation observation. */ /** Provider-neutral view of one generation observation. */
export interface Snapshot { export interface Snapshot {
readonly id: string readonly id: string
readonly status: Status readonly status: Status
/** Set when `status` is `error`. */
readonly reason?: Reason
/** Normalized 0..1 when the provider reports progress. */ /** Normalized 0..1 when the provider reports progress. */
readonly progress?: number readonly progress?: number
readonly position?: number
} }
/** /**
@ -35,31 +40,30 @@ export interface AwaitOptions {
const DEFAULT_POLL_INTERVAL = Duration.seconds(5) const DEFAULT_POLL_INTERVAL = Duration.seconds(5)
const DEFAULT_POLL_TIMEOUT = Duration.minutes(10) const DEFAULT_POLL_TIMEOUT = Duration.minutes(10)
export const QueuedEvent = Schema.Struct({
type: Schema.tag("generation-queued"),
id: Schema.String,
position: Schema.optional(Schema.Number),
}).annotate({ identifier: "Generation.Event.Queued" })
export const ProgressEvent = Schema.Struct({ export const ProgressEvent = Schema.Struct({
type: Schema.tag("generation-progress"), type: Schema.tag("generation-progress"),
id: Schema.String, id: Schema.String,
progress: Schema.optional(Schema.Number), progress: Schema.optional(Schema.Number),
}).annotate({ identifier: "Generation.Event.Progress" }) }).annotate({ identifier: "Generation.Event.Progress" })
export type Observation = Schema.Schema.Type<typeof QueuedEvent> | Schema.Schema.Type<typeof ProgressEvent> export type Observation = Schema.Schema.Type<typeof ProgressEvent>
export type Event = Observation | { readonly type: "generation-finished"; readonly id: string; readonly status: Status } export type Event =
| Observation
| {
readonly type: "generation-finished"
readonly id: string
readonly status: Status
readonly reason?: Reason
}
const TERMINAL: ReadonlySet<Status> = new Set(["completed", "failed", "cancelled", "expired"]) export const isTerminal = (status: Status) => status !== "running"
export const isTerminal = (status: Status) => TERMINAL.has(status)
export class Generation<Response> { export class Generation<Response> {
readonly id: string readonly id: string
readonly status: Status readonly status: Status
readonly reason?: Reason
readonly progress?: number readonly progress?: number
readonly position?: number
constructor( constructor(
readonly route: Route<Response>, readonly route: Route<Response>,
@ -69,16 +73,16 @@ export class Generation<Response> {
) { ) {
this.id = snapshot.id this.id = snapshot.id
this.status = snapshot.status this.status = snapshot.status
this.reason = snapshot.reason
this.progress = snapshot.progress this.progress = snapshot.progress
this.position = snapshot.position
} }
get snapshot(): Snapshot { get snapshot(): Snapshot {
return { return {
id: this.id, id: this.id,
status: this.status, status: this.status,
reason: this.reason,
progress: this.progress, progress: this.progress,
position: this.position,
} }
} }
@ -139,8 +143,7 @@ export class Generation<Response> {
} }
private event(): Event { private event(): Event {
if (this.terminal) return { type: "generation-finished", id: this.id, status: this.status } if (this.terminal) return { type: "generation-finished", id: this.id, status: this.status, reason: this.reason }
if (this.status === "queued") return { type: "generation-queued", id: this.id, position: this.position }
return { type: "generation-progress", id: this.id, progress: this.progress } return { type: "generation-progress", id: this.id, progress: this.progress }
} }

View file

@ -1,20 +1,89 @@
import { Context } from "effect" import { Context, Effect, Layer, Schema, Stream } from "effect"
import type { AwaitOptions } from "./generation.js"
import { MediaClient } from "./media-client.js" import { MediaClient } from "./media-client.js"
import type { ImageEvent, ImageRequest, ImageResponse } from "./image.js" import { RequestExecutor } from "./route/executor.js"
import { AIError, UnsupportedOperationError } from "./schema/index.js"
import type { ImageEvent, ImageJob, ImageModel, ImageRequest, ImageResponse, ImageStatus } from "./image.js"
export type Interface = MediaClient.Interface<ImageRequest, ImageEvent, ImageResponse> /** `start`, `status`, `result` and `cancel` fail with `UnsupportedOperation` on inline and stream routes. */
export interface Interface
extends Pick<MediaClient.Interface<ImageRequest, ImageEvent, ImageResponse>, "generate" | "stream"> {
readonly start: (request: ImageRequest) => Effect.Effect<ImageJob, AIError>
readonly status: (model: ImageModel, id: string) => Effect.Effect<ImageStatus, AIError>
readonly result: (model: ImageModel, id: string) => Effect.Effect<ImageResponse, AIError>
readonly cancel: (model: ImageModel, id: string) => Effect.Effect<void, AIError>
}
export class ImageClientService extends Context.Service<ImageClientService, Interface>()("@opencode/ImageClient") {} export class ImageClientService extends Context.Service<ImageClientService, Interface>()("@opencode/ImageClient") {}
export const Service = ImageClientService export const Service = ImageClientService
export type Service = ImageClientService export type Service = ImageClientService
const responseEvents = (response: ImageResponse) => [
...response.images.map((image, index) => ({ type: "image" as const, index, image })),
{ type: "finish" as const, usage: response.usage, providerMetadata: response.providerMetadata },
]
// A queued image route whose token isn't a string is a programmer defect, not a provider error.
const decodeID = (token: unknown) => Schema.decodeUnknownEffect(Schema.String)(token).pipe(Effect.orDie)
export const layer = Layer.effect(
Service,
Effect.gen(function* () {
const executor = yield* RequestExecutor.Service
const media = MediaClient.operations<ImageRequest, ImageEvent, ImageResponse>(executor.execute, {
modality: "image",
responseEvents,
})
const attach = (model: ImageModel, id: string, operation: string) => {
if (model.route.kind !== "queued") return Effect.fail(MediaClient.notQueued("image", model.route, operation))
return model.route.attach(model, id, executor.execute)
}
return Service.of({
generate: media.generate,
stream: media.stream,
start: (request) =>
media.start(request).pipe(
// The token, not the snapshot id, is what `status` and `result` decode; `ImageModel.fromRoute` makes it a string.
Effect.flatMap((generation) => decodeID(generation.token)),
Effect.map((id) => ({ id })),
),
status: (model, id) =>
attach(model, id, "status").pipe(
Effect.flatMap((route) => route.status),
Effect.map((snapshot) => ({ status: snapshot.status, reason: snapshot.reason, progress: snapshot.progress })),
),
result: (model, id) => attach(model, id, "result").pipe(Effect.flatMap((route) => route.result)),
cancel: (model, id) =>
attach(model, id, "cancel").pipe(
Effect.flatMap(
(route) =>
route.cancel ??
Effect.fail(
new AIError({
reason: new UnsupportedOperationError({
operation: "image.cancel",
provider: model.provider,
route: model.route.id,
message: `${model.provider}/${model.route.id} has no way to cancel an image generation`,
}),
}),
),
),
),
})
}),
)
export const ImageClient = { export const ImageClient = {
Service, Service,
...MediaClient.make(Service, { layer,
modality: "image", responseEvents,
responseEvents: (response: ImageResponse) => [ generate: (request: ImageRequest, options?: AwaitOptions) =>
...response.images.map((image, index) => ({ type: "image" as const, index, image })), Service.use((client) => client.generate(request, options)),
{ type: "finish" as const, usage: response.usage, providerMetadata: response.providerMetadata }, stream: (request: ImageRequest, options?: AwaitOptions) =>
], Stream.unwrap(Service.useSync((client) => client.stream(request, options))),
}), start: (request: ImageRequest) => Service.use((client) => client.start(request)),
status: (model: ImageModel, id: string) => Service.use((client) => client.status(model, id)),
result: (model: ImageModel, id: string) => Service.use((client) => client.result(model, id)),
cancel: (model: ImageModel, id: string) => Service.use((client) => client.cancel(model, id)),
} as const } as const

View file

@ -1,5 +1,5 @@
import { Effect, Schema, Stream } from "effect" import { Effect, Schema, Stream } from "effect"
import { Generation, ProgressEvent, QueuedEvent, type AwaitOptions } from "./generation.js" import { ProgressEvent, type AwaitOptions, type Reason, type Status } from "./generation.js"
import { Media } from "./media.js" import { Media } from "./media.js"
import { MediaModel, composeRoute, tryRequest } from "./media-model.js" import { MediaModel, composeRoute, tryRequest } from "./media-model.js"
import { MediaRoute } from "./route/media.js" import { MediaRoute } from "./route/media.js"
@ -24,7 +24,10 @@ export type ImageRoute = MediaRoute.AnyRoute<ImageRequest, ImageEvent, ImageResp
export class ImageModel<Options extends ImageOptions = ImageOptions> extends MediaModel<ImageRoute, Options> { export class ImageModel<Options extends ImageOptions = ImageOptions> extends MediaModel<ImageRoute, Options> {
declare protected readonly _ImageModel: void declare protected readonly _ImageModel: void
/** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */ /**
* The number of type arguments selects the kind: `<Options>` for inline or queued, `<Options, Frame, State>` for
* stream. A queued route's token is the provider's job ID, so `ImageJob.id` is exactly what `status` and `result` take.
*/
static fromRoute<Options extends ImageOptions>( static fromRoute<Options extends ImageOptions>(
route: MediaModel.InlineRouteInput<ImageRequest<ImageModel<Options>>, ImageResponse>, route: MediaModel.InlineRouteInput<ImageRequest<ImageModel<Options>>, ImageResponse>,
input: MediaRoute.ModelInput, input: MediaRoute.ModelInput,
@ -33,18 +36,18 @@ export class ImageModel<Options extends ImageOptions = ImageOptions> extends Med
route: MediaModel.StreamRouteInput<ImageRequest<ImageModel<Options>>, ImageEvent, Frame, State>, route: MediaModel.StreamRouteInput<ImageRequest<ImageModel<Options>>, ImageEvent, Frame, State>,
input: MediaRoute.ModelInput, input: MediaRoute.ModelInput,
): ImageModel<Options> ): ImageModel<Options>
static fromRoute<Options extends ImageOptions, Token>( static fromRoute<Options extends ImageOptions>(
route: MediaModel.QueuedRouteInput<ImageRequest<ImageModel<Options>>, ImageResponse, Token>, route: MediaModel.QueuedRouteInput<ImageRequest<ImageModel<Options>>, ImageResponse, string>,
input: MediaRoute.ModelInput, input: MediaRoute.ModelInput,
): ImageModel<Options> ): ImageModel<Options>
static fromRoute<Options extends ImageOptions, Frame, State, Token>( static fromRoute<Options extends ImageOptions, Frame, State>(
route: MediaModel.AnyRouteInput<ImageRequest<ImageModel<Options>>, ImageEvent, ImageResponse, Frame, State, Token>, route: MediaModel.AnyRouteInput<ImageRequest<ImageModel<Options>>, ImageEvent, ImageResponse, Frame, State, string>,
input: MediaRoute.ModelInput, input: MediaRoute.ModelInput,
) { ) {
return new ImageModel<Options>({ return new ImageModel<Options>({
id: input.id, id: input.id,
provider: route.protocol.provider, provider: route.protocol.provider,
http: input.http, transport: input.transport,
providerOptions: input.providerOptions, providerOptions: input.providerOptions,
route: composeRoute(route, input, collectResponse) as ImageRoute, route: composeRoute(route, input, collectResponse) as ImageRoute,
}) })
@ -99,9 +102,23 @@ export type ImageRequestInput<Model extends ImageModel = ImageModel> = Omit<
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Response and events // Job, status, response and events
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** A submitted generation on a queued route. Store `id` with the model to read the job later, from any process. */
export interface ImageJob {
/** The provider's job ID. */
readonly id: string
}
export interface ImageStatus {
readonly status: Status
/** Set when `status` is `error`. */
readonly reason?: Reason
/** 0..1, only when the provider reports progress. */
readonly progress?: number
}
export class ImageResponse extends Schema.Class<ImageResponse>("Image.Response")({ export class ImageResponse extends Schema.Class<ImageResponse>("Image.Response")({
images: Schema.Array(Media.AssetSchema), images: Schema.Array(Media.AssetSchema),
usage: Schema.optional(MediaUsage), usage: Schema.optional(MediaUsage),
@ -127,16 +144,11 @@ export const ImageFinishEvent = Schema.Struct({
providerMetadata: Schema.optional(ProviderMetadata), providerMetadata: Schema.optional(ProviderMetadata),
}).annotate({ identifier: "Image.Event.Finish" }) }).annotate({ identifier: "Image.Event.Finish" })
const imageEventTagged = Schema.Union([ const imageEventTagged = Schema.Union([ProgressEvent, ImagePartialEvent, ImageOutputEvent, ImageFinishEvent]).pipe(
QueuedEvent, Schema.toTaggedUnion("type"),
ProgressEvent, )
ImagePartialEvent,
ImageOutputEvent,
ImageFinishEvent,
]).pipe(Schema.toTaggedUnion("type"))
export const ImageEvent = Object.assign(imageEventTagged, { export const ImageEvent = Object.assign(imageEventTagged, {
is: { is: {
generationQueued: imageEventTagged.guards["generation-queued"],
generationProgress: imageEventTagged.guards["generation-progress"], generationProgress: imageEventTagged.guards["generation-progress"],
imagePartial: imageEventTagged.guards["image-partial"], imagePartial: imageEventTagged.guards["image-partial"],
image: imageEventTagged.guards.image, image: imageEventTagged.guards.image,
@ -193,21 +205,32 @@ export function stream(input: ImageRequestInput, options?: AwaitOptions) {
return Stream.unwrap(requestEffect(input).pipe(Effect.map((request) => ImageClient.stream(request, options)))) return Stream.unwrap(requestEffect(input).pipe(Effect.map((request) => ImageClient.stream(request, options))))
} }
/** Inline and streaming routes fail with `UnsupportedOperation`. */ /** Submit a generation and return at once; nothing polls. Inline and stream routes fail with `UnsupportedOperation`. */
export function start<const Model extends ImageModel>( export function start<const Model extends ImageModel>(
input: ImageRequestInput<Model>, input: ImageRequestInput<Model>,
): Effect.Effect<Generation<ImageResponse>, AIError, Service> ): Effect.Effect<ImageJob, AIError, Service>
export function start(input: ImageRequestInput) { export function start(input: ImageRequestInput) {
return requestEffect(input).pipe(Effect.flatMap((request) => ImageClient.start(request))) return requestEffect(input).pipe(Effect.flatMap((request) => ImageClient.start(request)))
} }
export const resume = (model: ImageModel, token: unknown): Effect.Effect<Generation<ImageResponse>, AIError, Service> => /** One status read for a job ID. */
ImageClient.resume(model, token) export const status = (model: ImageModel, id: string): Effect.Effect<ImageStatus, AIError, Service> =>
ImageClient.status(model, id)
/** The finished images; fails while the job is still running, or with the provider's reason when it failed. */
export const result = (model: ImageModel, id: string): Effect.Effect<ImageResponse, AIError, Service> =>
ImageClient.result(model, id)
/** Ask the provider to stop the job; fails with `UnsupportedOperation` when the provider has no cancel call. */
export const cancel = (model: ImageModel, id: string): Effect.Effect<void, AIError, Service> =>
ImageClient.cancel(model, id)
export const Image = { export const Image = {
request, request,
generate, generate,
stream, stream,
start, start,
resume, status,
result,
cancel,
} as const } as const

View file

@ -13,7 +13,7 @@ import {
type StreamOptions, type StreamOptions,
type TriggerCompactOptions, type TriggerCompactOptions,
} from "./route/client.js" } from "./route/client.js"
import { RequestExecutor } from "./route/executor.js" import { RequestExecutor, type HttpMiddleware } from "./route/executor.js"
import { import {
AIError, AIError,
InvalidRequestError, InvalidRequestError,
@ -56,8 +56,16 @@ export interface Options {
export interface RunOptions { export interface RunOptions {
readonly signal?: AbortSignal readonly signal?: AbortSignal
/**
* Runs on every provider request the call makes, like `RequestExecutor.withMiddleware`: submits, polls, results and
* cancels included. A handle the call returns keeps it for its own calls.
*/
readonly http?: HttpMiddleware
} }
/** Options for reading or writing an asset. Downloads use the asset's own `middleware`, never a caller's `http`. */
export type AssetRunOptions = Omit<RunOptions, "http">
export type Services = AIClient.Services export type Services = AIClient.Services
/** /**
@ -97,7 +105,7 @@ export const make = (options: Options = {}) => {
/** Run any package Effect (for example `ai.compact(...)` from `@opencode/ai/effect`) inside this runtime. */ /** Run any package Effect (for example `ai.compact(...)` from `@opencode/ai/effect`) inside this runtime. */
const run = <A, E>(effect: Effect.Effect<A, E, Services>, options?: RunOptions) => const run = <A, E>(effect: Effect.Effect<A, E, Services>, options?: RunOptions) =>
runtime.runPromise(Effect.raceFirst(effect, abortEffect(options?.signal))) runtime.runPromise(Effect.raceFirst(scoped(effect, options?.http), abortEffect(options?.signal)))
const iterate = <A, E>(stream: Stream.Stream<A, E, Services>, options?: RunOptions): AsyncIterable<A> => const iterate = <A, E>(stream: Stream.Stream<A, E, Services>, options?: RunOptions): AsyncIterable<A> =>
Stream.toAsyncIterable( Stream.toAsyncIterable(
@ -105,7 +113,10 @@ export const make = (options: Options = {}) => {
runtime.contextEffect.pipe( runtime.contextEffect.pipe(
Effect.map( Effect.map(
(context): Stream.Stream<A, unknown> => (context): Stream.Stream<A, unknown> =>
stream.pipe(Stream.interruptWhen(abortEffect(options?.signal)), Stream.provideContext(context)), scoped(stream, options?.http).pipe(
Stream.interruptWhen(abortEffect(options?.signal)),
Stream.provideContext(context),
),
), ),
), ),
), ),
@ -119,8 +130,9 @@ export const make = (options: Options = {}) => {
input: LLMRequestInput<Model>, input: LLMRequestInput<Model>,
options?: StreamOptions & RunOptions, options?: StreamOptions & RunOptions,
): Promise<LLMResponse> ): Promise<LLMResponse>
// `run` and `iterate` apply `http` around the whole call, so the LLM call gets none of its own.
function generate(input: LLMRequestInput & { readonly schema?: OutputSchema }, options?: StreamOptions & RunOptions) { function generate(input: LLMRequestInput & { readonly schema?: OutputSchema }, options?: StreamOptions & RunOptions) {
return run(LLM.generate(input, options), options) return run(LLM.generate(input, { ...options, http: undefined }), options)
} }
function stream<const Model extends LanguageModel, S extends OutputSchema>( function stream<const Model extends LanguageModel, S extends OutputSchema>(
@ -132,7 +144,7 @@ export const make = (options: Options = {}) => {
options?: StreamOptions & RunOptions, options?: StreamOptions & RunOptions,
): AsyncIterable<LLMEvent> ): AsyncIterable<LLMEvent>
function stream(input: LLMRequestInput & { readonly schema?: OutputSchema }, options?: StreamOptions & RunOptions) { function stream(input: LLMRequestInput & { readonly schema?: OutputSchema }, options?: StreamOptions & RunOptions) {
return iterate(LLM.stream(input, options), options) return iterate(LLM.stream(input, { ...options, http: undefined }), options)
} }
function loop<const Model extends LanguageModel, S extends OutputSchema>( function loop<const Model extends LanguageModel, S extends OutputSchema>(
@ -144,7 +156,7 @@ export const make = (options: Options = {}) => {
options?: StreamOptions & RunOptions, options?: StreamOptions & RunOptions,
): AsyncIterable<LLMEvent> ): AsyncIterable<LLMEvent>
function loop(input: LLMLoopInput & { readonly schema?: OutputSchema }, options?: StreamOptions & RunOptions) { function loop(input: LLMLoopInput & { readonly schema?: OutputSchema }, options?: StreamOptions & RunOptions) {
return iterate(LLM.loop(input, options), options) return iterate(LLM.loop(input, { ...options, http: undefined }), options)
} }
/** Read `events` from `stream` or `loop` to the end and fold them into the final result. */ /** Read `events` from `stream` or `loop` to the end and fold them into the final result. */
@ -165,31 +177,33 @@ export const make = (options: Options = {}) => {
options?: (TriggerCompactOptions | EndpointCompactOptions) & RunOptions, options?: (TriggerCompactOptions | EndpointCompactOptions) & RunOptions,
) { ) {
return options?.mechanism === "trigger" return options?.mechanism === "trigger"
? run(LLM.compact(request as CheckpointRequest, options), options) ? run(LLM.compact(request as CheckpointRequest, { ...options, http: undefined }), options)
: run(LLM.compact(request as CompactionRequest, options), options) : run(LLM.compact(request as CompactionRequest, { ...options, http: undefined }), options)
} }
const handle = <Response>(generation: Generation<Response>): GenerationHandle<Response> => ({ const handle =
...generation.snapshot, (http: HttpMiddleware | undefined) =>
snapshot: generation.snapshot, <Response>(generation: Generation<Response>): GenerationHandle<Response> => ({
terminal: generation.terminal, ...generation.snapshot,
token: generation.token, snapshot: generation.snapshot,
await: (options) => run(generation.await(options), options), terminal: generation.terminal,
events: (options) => iterate(generation.events(options), options), token: generation.token,
result: (options) => run(generation.result(), options), await: (options) => run(generation.await(options), { http, ...options }),
refresh: (options) => run(generation.refresh(), options).then(handle), events: (options) => iterate(generation.events(options), { http, ...options }),
cancel: (options) => run(generation.cancel(), options), result: (options) => run(generation.result(), { http, ...options }),
}) refresh: (options) => run(generation.refresh(), { http, ...options }).then(handle(options?.http ?? http)),
cancel: (options) => run(generation.cancel(), { http, ...options }),
})
return { return {
run, run,
/** Decoded asset bytes, downloading `url` sources through the executor. */ /** Decoded asset bytes, downloading `url` sources through the executor. */
bytes: (asset: Media.Asset, options?: RunOptions) => run(asset.bytes(), options), bytes: (asset: Media.Asset, options?: AssetRunOptions) => run(asset.bytes(), options),
base64: (asset: Media.Asset, options?: RunOptions) => run(asset.base64(), options), base64: (asset: Media.Asset, options?: AssetRunOptions) => run(asset.base64(), options),
/** Pull a `url` asset into owned bytes before the provider URL expires. */ /** Pull a `url` asset into owned bytes before the provider URL expires. */
materialize: (asset: Media.Asset, options?: RunOptions) => run(asset.materialize(), options), materialize: (asset: Media.Asset, options?: AssetRunOptions) => run(asset.materialize(), options),
/** Read a file into an asset like `Media.file`: sniffed media type, then the extension's. */ /** Read a file into an asset like `Media.file`: sniffed media type, then the extension's. */
file: async (path: string, options?: Media.AssetOptions & RunOptions) => { file: async (path: string, options?: Media.AssetOptions & AssetRunOptions) => {
const { readFile } = await import("node:fs/promises") const { readFile } = await import("node:fs/promises")
return run( return run(
Effect.tryPromise({ Effect.tryPromise({
@ -204,20 +218,23 @@ export const make = (options: Options = {}) => {
options, options,
) )
}, },
/** Write an asset's bytes like `Media.write`, downloading `url` sources through the executor. */ /** Write an asset's bytes like `Media.write`: streamed through a temporary file that replaces `path` on success. */
write: async (asset: Media.Asset, path: string, options?: RunOptions) => { write: async (asset: Media.Asset, path: string, options?: AssetRunOptions) => {
const { writeFile } = await import("node:fs/promises") const { open, rename, rm } = await import("node:fs/promises")
return run( const temporary = `${path}.${crypto.randomUUID()}.tmp`
asset.bytes().pipe( try {
Effect.flatMap((data) => const file = await open(temporary, "w")
Effect.tryPromise({ try {
try: (signal) => writeFile(path, data, { signal }), for await (const chunk of iterate(asset.stream(), options)) await file.write(chunk)
catch: (cause) => fileError(`Failed to write media file ${path}`, cause), } finally {
}), await file.close()
), }
), await rename(temporary, path)
options, } catch (cause) {
) await rm(temporary, { force: true })
if (cause instanceof AIError || cause === options?.signal?.reason) throw cause
throw fileError(`Failed to write media file ${path}`, cause)
}
}, },
request: LLM.request, request: LLM.request,
generate, generate,
@ -238,10 +255,14 @@ export const make = (options: Options = {}) => {
input: ImageRequestInput<Model> | ImageRequest, input: ImageRequestInput<Model> | ImageRequest,
options?: AwaitOptions & RunOptions, options?: AwaitOptions & RunOptions,
) => iterate(Image.stream(input, options), options), ) => iterate(Image.stream(input, options), options),
/** Submit a generation on a queued route and return its `{ id }` at once; nothing polls. */
start: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: RunOptions) => start: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: RunOptions) =>
run(Image.start(input), options).then(handle), run(Image.start(input), options),
resume: (model: ImageModel, token: unknown, options?: RunOptions) => /** One status read for a job ID. */
run(Image.resume(model, token), options).then(handle), status: (model: ImageModel, id: string, options?: RunOptions) => run(Image.status(model, id), options),
/** The finished images; fails while the job is still running. */
result: (model: ImageModel, id: string, options?: RunOptions) => run(Image.result(model, id), options),
cancel: (model: ImageModel, id: string, options?: RunOptions) => run(Image.cancel(model, id), options),
}, },
decision: { decision: {
request: Decision.request, request: Decision.request,
@ -255,6 +276,17 @@ export const make = (options: Options = {}) => {
generate: <const Model extends EmbeddingModel>(input: EmbeddingRequestInput<Model>, options?: RunOptions) => generate: <const Model extends EmbeddingModel>(input: EmbeddingRequestInput<Model>, options?: RunOptions) =>
run(Embedding.generate(input), options), run(Embedding.generate(input), options),
}, },
video: {
request: Video.request,
/** Submit a generation and return its `{ id }` at once; nothing polls. */
start: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: RunOptions) =>
run(Video.start(input), options),
/** One status read for a job ID. */
status: (model: VideoModel, id: string, options?: RunOptions) => run(Video.status(model, id), options),
/** The finished videos; fails while the job is still running. */
result: (model: VideoModel, id: string, options?: RunOptions) => run(Video.result(model, id), options),
cancel: (model: VideoModel, id: string, options?: RunOptions) => run(Video.cancel(model, id), options),
},
/** Experimental: may change without compatibility guarantees. */ /** Experimental: may change without compatibility guarantees. */
experimental: { experimental: {
speech: { speech: {
@ -281,24 +313,9 @@ export const make = (options: Options = {}) => {
start: <const Model extends TranscriptionModel>( start: <const Model extends TranscriptionModel>(
input: TranscriptionRequestInput<Model> | TranscriptionRequest, input: TranscriptionRequestInput<Model> | TranscriptionRequest,
options?: RunOptions, options?: RunOptions,
) => run(Transcription.start(input), options).then(handle), ) => run(Transcription.start(input), options).then(handle(options?.http)),
resume: (model: TranscriptionModel, token: unknown, options?: RunOptions) => resume: (model: TranscriptionModel, token: unknown, options?: RunOptions) =>
run(Transcription.resume(model, token), options).then(handle), run(Transcription.resume(model, token), options).then(handle(options?.http)),
},
video: {
request: Video.request,
start: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: RunOptions) =>
run(Video.start(input), options).then(handle),
generate: <const Model extends VideoModel>(
input: VideoRequestInput<Model> | VideoRequest,
options?: AwaitOptions & RunOptions,
) => run(Video.generate(input, { poll: options?.poll }), options),
resume: (model: VideoModel, token: unknown, options?: RunOptions) =>
run(Video.resume(model, token), options).then(handle),
stream: <const Model extends VideoModel>(
input: VideoRequestInput<Model> | VideoRequest,
options?: AwaitOptions & RunOptions,
) => iterate(Video.stream(input, { poll: options?.poll }), options),
}, },
}, },
dispose: () => runtime.dispose(), dispose: () => runtime.dispose(),
@ -307,6 +324,11 @@ export const make = (options: Options = {}) => {
export type Client = ReturnType<typeof make> export type Client = ReturnType<typeof make>
const scoped = <Self extends Effect.Effect<unknown, unknown, unknown> | Stream.Stream<unknown, unknown, unknown>>(
self: Self,
http: HttpMiddleware | undefined,
) => (http === undefined ? self : RequestExecutor.withMiddleware(http)(self))
const fileError = (message: string, cause: unknown) => const fileError = (message: string, cause: unknown) =>
new AIError({ reason: new InvalidRequestError({ message, cause }) }) new AIError({ reason: new InvalidRequestError({ message, cause }) })

View file

@ -39,6 +39,7 @@ import {
import { tool, type ExecutableTool, type Tool, type ToolSchema } from "./tool.js" import { tool, type ExecutableTool, type Tool, type ToolSchema } from "./tool.js"
import { runTools } from "./tool-runtime.js" import { runTools } from "./tool-runtime.js"
import { addUsage, nextRequest, pendingCalls } from "./loop.js" import { addUsage, nextRequest, pendingCalls } from "./loop.js"
import { foldTools } from "./tool-updates.js"
/** Input accepted by `ai.request`, `ai.generate`, `ai.stream` and `ai.compact`. An `LLMRequest` is also a valid input. */ /** Input accepted by `ai.request`, `ai.generate`, `ai.stream` and `ai.compact`. An `LLMRequest` is also a valid input. */
export type LLMRequestInput<Model extends LanguageModel = LanguageModel> = TextRequestFields<Model> & PromptOrMessages export type LLMRequestInput<Model extends LanguageModel = LanguageModel> = TextRequestFields<Model> & PromptOrMessages
@ -53,7 +54,10 @@ interface TextRequestFields<Model extends LanguageModel>
GenerationOptionsFields { GenerationOptionsFields {
readonly id?: string readonly id?: string
readonly system?: string | SystemPart | ReadonlyArray<SystemPart> readonly system?: string | SystemPart | ReadonlyArray<SystemPart>
/** Sent in array order. Pass `tool(...)` values or wire entries such as hosted provider tools. */ /**
* Sent in array order. Pass `tool(...)` values or wire entries such as hosted provider tools. The same as a
* `Message.tools({ add: tools })` leading the history.
*/
readonly tools?: ReadonlyArray<Tool | ToolEntryInput> readonly tools?: ReadonlyArray<Tool | ToolEntryInput>
readonly toolChoice?: ToolChoice.Input readonly toolChoice?: ToolChoice.Input
readonly cache?: CachePolicy readonly cache?: CachePolicy
@ -149,11 +153,35 @@ export function loop(input: LLMLoopInput & { readonly schema?: OutputSchema }, o
const { tools, until, ...rest } = input const { tools, until, ...rest } = input
return Stream.unwrap( return Stream.unwrap(
prepare({ ...rest, tools }).pipe( prepare({ ...rest, tools }).pipe(
Effect.map(({ request, output }) => driveLoop({ tools, until, output, options }, request, [], undefined)), // Untyped callers may omit `tools`.
Effect.map(({ request, output }) =>
driveLoop(
{ tools: runnableTools(tools ?? [], input.messages ?? []), until, output, options },
request,
[],
undefined,
),
),
), ),
) )
} }
// Tools that `Message.tools(...)` adds run like top-level ones; a later change with the same name replaces or removes them.
const runnableTools = (tools: ReadonlyArray<Tool>, messages: ReadonlyArray<Message | Message.Input>) =>
messages
.reduce<ReadonlyArray<Tool | ToolEntryInput>>(
(current, message) =>
message.role === "system" && message.tools !== undefined
? foldTools(
current,
message.tools.add ?? [],
(message.tools.remove ?? []).map((item) => (typeof item === "string" ? item : item.name)),
)
: current,
tools,
)
.filter((item): item is Tool => "_definition" in item)
export { collect, type Collected, type CollectResult } from "./loop.js" export { collect, type Collected, type CollectResult } from "./loop.js"
interface Step { interface Step {
@ -209,7 +237,7 @@ const finishStep = (
} }
interface LoopContext { interface LoopContext {
readonly tools: ReadonlyArray<ExecutableTool> readonly tools: ReadonlyArray<Tool>
readonly until: LLMLoopInput["until"] readonly until: LLMLoopInput["until"]
readonly output: Tool | undefined readonly output: Tool | undefined
readonly options: StreamOptions | undefined readonly options: StreamOptions | undefined

View file

@ -2,7 +2,7 @@ import { type Context, Effect, Layer, Stream } from "effect"
import { resultEvents, type AwaitOptions, type Generation, type Observation } from "./generation.js" import { resultEvents, type AwaitOptions, type Generation, type Observation } from "./generation.js"
import { RequestExecutor } from "./route/executor.js" import { RequestExecutor } from "./route/executor.js"
import type { MediaRoute } from "./route/media.js" import type { MediaRoute } from "./route/media.js"
import { AIError, UnsupportedOperationError } from "./schema/index.js" import { AIError, UnsupportedOperationError, type ProviderID } from "./schema/index.js"
/** A media request whose model carries the route that executes it. */ /** A media request whose model carries the route that executes it. */
export interface RoutedRequest<Self extends MediaRoute.MediaRequest, Event, Response> extends MediaRoute.MediaRequest { export interface RoutedRequest<Self extends MediaRoute.MediaRequest, Event, Response> extends MediaRoute.MediaRequest {
@ -17,55 +17,71 @@ export interface Interface<Req extends RoutedRequest<Req, Event, Response>, Even
readonly resume: (model: Req["model"], token: unknown) => Effect.Effect<Generation<Response>, AIError> readonly resume: (model: Req["model"], token: unknown) => Effect.Effect<Generation<Response>, AIError>
} }
/** One modality's layer and service accessors, dispatching each request on its route's `kind`. */ export interface Input<Event, Response> {
readonly modality: string
/** A completed response expanded into the streaming event shape. */
readonly responseEvents: (response: Response) => ReadonlyArray<Event>
}
/** `${modality}.${operation}` on a route that is not queued. */
export const notQueued = (
modality: string,
route: { readonly provider: ProviderID; readonly id: string },
operation: string,
) =>
new AIError({
reason: new UnsupportedOperationError({
operation: `${modality}.${operation}`,
provider: route.provider,
route: route.id,
message: `${route.provider}/${route.id} is not a queued route; use generate or stream`,
}),
})
/** One modality's operations over an executor, dispatching each request on its route's `kind`. */
export const operations = <Req extends RoutedRequest<Req, Event, Response>, Event, Response>(
execute: MediaRoute.Execute,
input: Input<Event, Response>,
): Interface<Req, Event, Response> => {
const start = (request: Req) => {
const route = request.model.route
if (route.kind !== "queued") return Effect.fail(notQueued(input.modality, route, "start"))
return route.start(request, execute)
}
return {
start,
resume: (model, token) => {
if (model.route.kind !== "queued") return Effect.fail(notQueued(input.modality, model.route, "resume"))
return model.route.resume(model, token, execute)
},
generate: (request, options) => {
const route = request.model.route
if (route.kind !== "queued") return route.generate(request, execute)
return start(request).pipe(Effect.flatMap((generation) => generation.await(options)))
},
stream: (request, options) => {
const route = request.model.route
if (route.kind === "stream") return route.stream(request, execute)
if (route.kind === "queued")
return Stream.unwrap(
start(request).pipe(Effect.map((generation) => resultEvents(generation, input.responseEvents, options))),
)
return Stream.fromIterableEffect(Effect.map(route.generate(request, execute), input.responseEvents))
},
}
}
/** One modality's layer and service accessors over `operations`. */
export const make = <Self, Req extends RoutedRequest<Req, Event, Response>, Event, Response>( export const make = <Self, Req extends RoutedRequest<Req, Event, Response>, Event, Response>(
service: Context.Service<Self, Interface<Req, Event, Response>>, service: Context.Service<Self, Interface<Req, Event, Response>>,
input: { input: Input<Event, Response>,
readonly modality: string
/** A completed response expanded into the streaming event shape. */
readonly responseEvents: (response: Response) => ReadonlyArray<Event>
},
) => ({ ) => ({
responseEvents: input.responseEvents, responseEvents: input.responseEvents,
layer: Layer.effect( layer: Layer.effect(
service, service,
Effect.gen(function* () { Effect.gen(function* () {
const executor = yield* RequestExecutor.Service const executor = yield* RequestExecutor.Service
const notQueued = (route: MediaRoute.AnyRoute<Req, Event, Response>, operation: string) => return service.of(operations<Req, Event, Response>(executor.execute, input))
new AIError({
reason: new UnsupportedOperationError({
operation: `${input.modality}.${operation}`,
provider: route.provider,
route: route.id,
message: `${route.provider}/${route.id} is not a queued route; use generate or stream`,
}),
})
const start = (request: Req) => {
const route = request.model.route
if (route.kind !== "queued") return Effect.fail(notQueued(route, "start"))
return route.start(request, executor.execute)
}
return service.of({
start,
resume: (model, token) => {
if (model.route.kind !== "queued") return Effect.fail(notQueued(model.route, "resume"))
return model.route.resume(model, token, executor.execute)
},
generate: (request, options) => {
const route = request.model.route
if (route.kind !== "queued") return route.generate(request, executor.execute)
return start(request).pipe(Effect.flatMap((generation) => generation.await(options)))
},
stream: (request, options) => {
const route = request.model.route
if (route.kind === "stream") return route.stream(request, executor.execute)
if (route.kind === "queued")
return Stream.unwrap(
start(request).pipe(Effect.map((generation) => resultEvents(generation, input.responseEvents, options))),
)
return Stream.fromIterableEffect(Effect.map(route.generate(request, executor.execute), input.responseEvents))
},
})
}), }),
), ),
generate: (request: Req, options?: AwaitOptions) => service.use((client) => client.generate(request, options)), generate: (request: Req, options?: AwaitOptions) => service.use((client) => client.generate(request, options)),

View file

@ -7,12 +7,12 @@ import {
InvalidRequestError, InvalidRequestError,
ModelID, ModelID,
ProviderID, ProviderID,
type HttpOptions,
type ProviderOptions, type ProviderOptions,
type TransportOptions,
} from "./schema/index.js" } from "./schema/index.js"
/** /**
* What every media model carries: ids, the configured route, and deployment `http` overlays. Modality classes * What every media model carries: ids, the configured route, and deployment transport overlays. Modality classes
* (`ImageModel`, `VideoModel`, `SpeechModel`, `TranscriptionModel`) extend it with their route type and a nominal * (`ImageModel`, `VideoModel`, `SpeechModel`, `TranscriptionModel`) extend it with their route type and a nominal
* marker so one cannot stand in for the other in requests. * marker so one cannot stand in for the other in requests.
*/ */
@ -23,7 +23,8 @@ export class MediaModel<Route, Options> {
readonly id: ModelID readonly id: ModelID
readonly provider: ProviderID readonly provider: ProviderID
readonly route: Route readonly route: Route
readonly http?: HttpOptions /** Deployment headers, timeouts and `http` overlays, below each request's own. */
readonly transport?: TransportOptions
/** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */ /** Defaults under each request's `providerOptions`, such as options a provider package reads from its settings. */
readonly providerOptions?: ProviderOptions readonly providerOptions?: ProviderOptions
@ -31,7 +32,7 @@ export class MediaModel<Route, Options> {
this.id = ModelID.make(input.id) this.id = ModelID.make(input.id)
this.provider = ProviderID.make(input.provider) this.provider = ProviderID.make(input.provider)
this.route = input.route this.route = input.route
this.http = input.http this.transport = input.transport
this.providerOptions = input.providerOptions this.providerOptions = input.providerOptions
} }
} }
@ -43,7 +44,7 @@ export namespace MediaModel {
readonly id: string | ModelID readonly id: string | ModelID
readonly provider: string | ProviderID readonly provider: string | ProviderID
readonly route: Route readonly route: Route
readonly http?: HttpOptions readonly transport?: TransportOptions
readonly providerOptions?: ProviderOptions readonly providerOptions?: ProviderOptions
} }
@ -84,10 +85,16 @@ export const composeRoute = <Request extends MediaRoute.MediaRequest, Event, Res
collect: (events: ReadonlyArray<Event>) => Effect.Effect<Response, AIError>, collect: (events: ReadonlyArray<Event>) => Effect.Effect<Response, AIError>,
): MediaRoute.AnyRoute<Request, Event, Response> => { ): MediaRoute.AnyRoute<Request, Event, Response> => {
if (isStreamInput(route)) return MediaRoute.stream({ ...composition(route, input), collect }) if (isStreamInput(route)) return MediaRoute.stream({ ...composition(route, input), collect })
if (isQueuedInput(route)) return MediaRoute.queued(composition(route, input)) if (isQueuedInput(route)) return composeQueuedRoute(route, input)
return MediaRoute.inline(composition(route, input)) return MediaRoute.inline(composition(route, input))
} }
/** Compose a queued protocol route input with one deployment through `MediaRoute.queued`. */
export const composeQueuedRoute = <Request extends MediaRoute.MediaRequest, Response, Token>(
route: MediaModel.QueuedRouteInput<Request, Response, Token>,
input: MediaRoute.ModelInput,
) => MediaRoute.queued(composition(route, input))
const composition = <Request extends MediaRoute.MediaRequest, Protocol>( const composition = <Request extends MediaRoute.MediaRequest, Protocol>(
route: MediaModel.RouteInput<Request, Protocol>, route: MediaModel.RouteInput<Request, Protocol>,
input: MediaRoute.ModelInput, input: MediaRoute.ModelInput,
@ -95,8 +102,7 @@ const composition = <Request extends MediaRoute.MediaRequest, Protocol>(
protocol: route.protocol, protocol: route.protocol,
endpoint: Endpoint.path(route.path, { baseURL: input.baseURL ?? route.baseURL }), endpoint: Endpoint.path(route.path, { baseURL: input.baseURL ?? route.baseURL }),
auth: input.auth, auth: input.auth,
headers: headers: route.headers,
route.headers === undefined && input.headers === undefined ? undefined : { ...route.headers, ...input.headers },
}) })
const isStreamInput = <Request extends MediaRoute.MediaRequest, Event, Response, Frame, State, Token>( const isStreamInput = <Request extends MediaRoute.MediaRequest, Event, Response, Frame, State, Token>(

View file

@ -1,12 +1,18 @@
export * as Media from "./media.js" export * as Media from "./media.js"
import { Effect, FileSystem, Result, Schema, SchemaGetter } from "effect" import { Effect, FileSystem, Result, Schema, SchemaGetter, Stream } from "effect"
import { Base64 } from "effect/encoding" import { Base64 } from "effect/encoding"
import { HttpClientRequest } from "effect/http" import { HttpClientRequest } from "effect/http"
import { ProviderID } from "./schema/ids.js" import { ProviderID } from "./schema/ids.js"
import { AIError, InvalidProviderOutputError, InvalidRequestError } from "./schema/errors.js" import { AIError, InvalidRequestError } from "./schema/errors.js"
import { ProviderMetadata } from "./schema/options.js" import { ProviderMetadata } from "./schema/options.js"
import { responseHttp, Service } from "./route/executor-service.js" import {
CurrentMiddleware,
type HttpMiddleware,
responseBytes,
responseStream,
Service,
} from "./route/executor-service.js"
import { detectMediaType, fileMediaType } from "./utils/media-type.js" import { detectMediaType, fileMediaType } from "./utils/media-type.js"
export { detectMediaType } from "./utils/media-type.js" export { detectMediaType } from "./utils/media-type.js"
@ -37,7 +43,7 @@ const UrlSource = Schema.Struct({
expiresAt: Schema.optional(Schema.Number), expiresAt: Schema.optional(Schema.Number),
}) })
/** A provider-side handle: OpenAI `file_id`, Gemini file URI, `gs://`, `runway://`, or a prior generation id. */ /** A provider-side handle: OpenAI `file_id`, Gemini file URI, `gs://`, or a prior generation id. */
const RefSource = Schema.Struct({ const RefSource = Schema.Struct({
type: Schema.Literal("ref"), type: Schema.Literal("ref"),
provider: ProviderID, provider: ProviderID,
@ -109,6 +115,8 @@ export class Asset {
readonly providerMetadata?: ProviderMetadata readonly providerMetadata?: ProviderMetadata
/** Transient download credentials for `url` sources; see `Asset.Input.headers`. */ /** Transient download credentials for `url` sources; see `Asset.Input.headers`. */
readonly headers?: Record<string, string> readonly headers?: Record<string, string>
/** Middleware for downloading a `url` source; see `Asset.Input.middleware`. */
readonly middleware?: HttpMiddleware
// Derived payload forms are cached on the instance because every protocol lowering re-reads the same payload. The // Derived payload forms are cached on the instance because every protocol lowering re-reads the same payload. The
// cache is check-then-set (concurrent first reads of a `url` source may both download) and is never observable // cache is check-then-set (concurrent first reads of a `url` source may both download) and is never observable
@ -127,6 +135,7 @@ export class Asset {
this.expiresAt = input.source.type === "url" ? input.source.expiresAt : undefined this.expiresAt = input.source.type === "url" ? input.source.expiresAt : undefined
this.providerMetadata = input.providerMetadata this.providerMetadata = input.providerMetadata
this.headers = input.source.type === "url" ? input.headers : undefined this.headers = input.source.type === "url" ? input.headers : undefined
this.middleware = input.source.type === "url" ? input.middleware : undefined
} }
/** Inline payload without effects, for protocols that embed base64 or data URLs directly. */ /** Inline payload without effects, for protocols that embed base64 or data URLs directly. */
@ -151,11 +160,18 @@ export class Asset {
? Effect.fromResult(Base64.decode(source.data)).pipe( ? Effect.fromResult(Base64.decode(source.data)).pipe(
Effect.mapError((cause) => invalid(`Media asset contains invalid base64 data`, cause)), Effect.mapError((cause) => invalid(`Media asset contains invalid base64 data`, cause)),
) )
: download(source, this.headers) : download(source, this.headers, this.middleware)
return decoded.pipe(Effect.tap((data) => Effect.sync(() => (this.#bytes = data)))) return decoded.pipe(Effect.tap((data) => Effect.sync(() => (this.#bytes = data))))
}) })
} }
/** The payload as a byte stream; `url` sources stream from the network without being buffered or cached. */
stream(): Stream.Stream<Uint8Array, AIError, Service> {
const source = this.source
if (source.type !== "url" || this.#bytes !== undefined) return Stream.fromEffect(this.bytes())
return Stream.unwrap(downloadStream(source, this.headers, this.middleware))
}
base64(): Effect.Effect<string, AIError, Service> { base64(): Effect.Effect<string, AIError, Service> {
return Effect.suspend(() => { return Effect.suspend(() => {
const source = this.source const source = this.source
@ -199,11 +215,17 @@ export namespace Asset {
readonly info?: Info readonly info?: Info
readonly providerMetadata?: ProviderMetadata readonly providerMetadata?: ProviderMetadata
/** /**
* Headers required to download a `url` source, such as the provider API key Veo demands for its file URIs. * Headers required to download a `url` source, such as a provider API key.
* They are runtime-only: never part of `source`, `toJSON()`, or `AssetSchema`, so a persisted asset cannot leak * They are runtime-only: never part of `source`, `toJSON()`, or `AssetSchema`, so a persisted asset cannot leak
* credentials and cannot be downloaded again after a round-trip. Call `materialize()` before persisting. * credentials and cannot be downloaded again after a round-trip. Call `materialize()` before persisting.
*/ */
readonly headers?: Record<string, string> readonly headers?: Record<string, string>
/**
* Middleware for downloading a `url` source, runtime-only like `headers`. A download never uses the caller's
* scoped middleware (`RequestExecutor.withMiddleware`), so hooks that add provider credentials can't reach another
* host. Routes set this to that middleware only for result URLs on the provider's origin.
*/
readonly middleware?: HttpMiddleware
} }
} }
@ -232,27 +254,42 @@ export const AssetSchema = AssetEncoded.pipe(
}), }),
) )
/**
* An image, or a URL or provider file reference whose type it doesn't state, which the provider checks itself. Build one with
* `Media.image`; an asset known to be a video, audio or document is rejected.
*/
export const ImageAssetSchema = AssetInstance.check(
Schema.makeFilter(
(asset) =>
asset.kind === "image" ||
((asset.source.type === "url" || asset.source.type === "ref") && asset.source.mediaType === undefined) ||
`expected an image, got ${asset.mediaType}`,
),
).pipe(Schema.brand("Media.ImageAsset"))
export type ImageAsset = typeof ImageAssetSchema.Type
const download = Effect.fn("Media.download")(function* ( const download = Effect.fn("Media.download")(function* (
source: Extract<Source, { readonly type: "url" }>, source: Extract<Source, { readonly type: "url" }>,
headers: Record<string, string> | undefined, headers: Record<string, string> | undefined,
middleware: HttpMiddleware | undefined,
) { ) {
const executor = yield* Service const executor = yield* Service
const response = yield* executor.execute( const response = yield* executor
HttpClientRequest.get(source.url).pipe(HttpClientRequest.setHeaders(headers ?? {})), .execute(HttpClientRequest.get(source.url).pipe(HttpClientRequest.setHeaders(headers ?? {})))
) .pipe(Effect.provideService(CurrentMiddleware, middleware))
const buffer = yield* response.arrayBuffer.pipe( return yield* responseBytes(response)
Effect.mapError( })
(cause) =>
new AIError({ const downloadStream = Effect.fn("Media.downloadStream")(function* (
reason: new InvalidProviderOutputError({ source: Extract<Source, { readonly type: "url" }>,
message: `Failed to read media from ${source.url}`, headers: Record<string, string> | undefined,
http: responseHttp(response), middleware: HttpMiddleware | undefined,
cause, ) {
}), const executor = yield* Service
}), const response = yield* executor
), .execute(HttpClientRequest.get(source.url).pipe(HttpClientRequest.setHeaders(headers ?? {})))
) .pipe(Effect.provideService(CurrentMiddleware, middleware))
return new Uint8Array(buffer) return responseStream(response)
}) })
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -301,6 +338,13 @@ export type Data = Uint8Array | ArrayBuffer | URL | string
/** What file inputs accept: an `Asset` or plain `Data`. */ /** What file inputs accept: an `Asset` or plain `Data`. */
export type Input = Asset | Data export type Input = Asset | Data
/** Normalize input into an `ImageAsset`; throws when it's known not to be an image. */
export const image = (input: Input, mediaType?: string): ImageAsset => {
const asset = make(input, mediaType)
if (!Schema.is(ImageAssetSchema)(asset)) throw invalid(`expected an image, got ${asset.mediaType}`)
return asset
}
/** /**
* Normalize file input into an `Asset`. Data URLs carry their media type and bytes or base64 are sniffed from magic * Normalize file input into an `Asset`. Data URLs carry their media type and bytes or base64 are sniffed from magic
* bytes; `mediaType` is required when sniffing fails. Assets pass through unchanged. * bytes; `mediaType` is required when sniffing fails. Assets pass through unchanged.
@ -344,12 +388,21 @@ export const file = (path: string, options?: AssetOptions): Effect.Effect<Asset,
return bytes(data, fileMediaType(data, path), options) return bytes(data, fileMediaType(data, path), options)
}) })
/** Materialize an asset and write its bytes through `FileSystem`. */ /**
* Stream an asset's bytes into a file through `FileSystem` without buffering `url` downloads. The bytes go to a temporary
* file next to `path` that replaces it only once the download finished, so a failed download leaves an existing file as
* it was.
*/
export const write = (asset: Asset, path: string): Effect.Effect<void, AIError, FileSystem.FileSystem | Service> => export const write = (asset: Asset, path: string): Effect.Effect<void, AIError, FileSystem.FileSystem | Service> =>
Effect.gen(function* () { Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem const fs = yield* FileSystem.FileSystem
const data = yield* asset.bytes() const temporary = `${path}.${crypto.randomUUID()}.tmp`
yield* fs yield* asset.stream().pipe(
.writeFile(path, data) Stream.run(fs.sink(temporary)),
.pipe(Effect.mapError((cause) => invalid(`Failed to write media file ${path}`, cause))) Effect.andThen(fs.rename(temporary, path)),
Effect.onError(() => fs.remove(temporary).pipe(Effect.ignore)),
Effect.mapError((cause) =>
cause instanceof AIError ? cause : invalid(`Failed to write media file ${path}`, cause),
),
)
}) })

View file

@ -44,6 +44,8 @@ export const protocol = Protocol.make({
}), }),
}, },
stream: AnthropicMessages.protocol.stream, stream: AnthropicMessages.protocol.stream,
supportsEffortUpdates: AnthropicMessages.protocol.supportsEffortUpdates,
toolUpdates: AnthropicMessages.protocol.toolUpdates,
}) })
export * as AlibabaMessages from "./alibaba-messages.js" export * as AlibabaMessages from "./alibaba-messages.js"

View file

@ -81,6 +81,7 @@ export const protocol = Protocol.make({
), ),
) )
}), }),
supportsEffortUpdates: OpenResponses.protocol.supportsEffortUpdates,
}) })
export * as AlibabaResponses from "./alibaba-responses.js" export * as AlibabaResponses from "./alibaba-responses.js"

View file

@ -23,11 +23,13 @@ import {
type ProviderOptions, type ProviderOptions,
type ToolCallPart, type ToolCallPart,
type ToolDefinition, type ToolDefinition,
type ToolChanges,
type ToolResultPart, type ToolResultPart,
} from "../schema/index.js" } from "../schema/index.js"
import { JsonObject, knownString, optionalArray, optionalNull, ProviderShared, withUntypedFrames } from "./shared.js" import { JsonObject, knownString, optionalArray, optionalNull, ProviderShared, withUntypedFrames } from "./shared.js"
import { classifyProviderFailure } from "../provider-error.js" import { classifyProviderFailure } from "../provider-error.js"
import { effortUpdate, resolveEffortUpdates } from "../effort-updates.js" import { effortUpdate, resolveEffortUpdates } from "../effort-updates.js"
import { addsTools, toolsUpdate, type ToolUpdateEncoding } from "../tool-updates.js"
import * as Cache from "./utils/cache.js" import * as Cache from "./utils/cache.js"
import { claudeVersion, supportsThinkingBlockBinding, THINKING_BINDING_BETA } from "./utils/claude-model.js" import { claudeVersion, supportsThinkingBlockBinding, THINKING_BINDING_BETA } from "./utils/claude-model.js"
import { Lifecycle } from "./utils/lifecycle.js" import { Lifecycle } from "./utils/lifecycle.js"
@ -253,17 +255,6 @@ const AnthropicAssistantBlock = Schema.Union([
type AnthropicAssistantBlock = Schema.Schema.Type<typeof AnthropicAssistantBlock> type AnthropicAssistantBlock = Schema.Schema.Type<typeof AnthropicAssistantBlock>
type AnthropicToolResultBlock = Schema.Schema.Type<typeof AnthropicToolResultBlock> type AnthropicToolResultBlock = Schema.Schema.Type<typeof AnthropicToolResultBlock>
const AnthropicMessage = Schema.Union([
Schema.Struct({ role: Schema.Literal("user"), content: Schema.Array(AnthropicUserBlock) }),
Schema.Struct({ role: Schema.Literal("assistant"), content: Schema.Array(AnthropicAssistantBlock) }),
Schema.Struct({
role: Schema.Literal("system"),
content: Schema.Array(AnthropicTextBlock),
output_config: Schema.optional(Schema.Struct({ effort: Schema.String })),
}),
]).pipe(Schema.toTaggedUnion("role"))
type AnthropicMessage = Schema.Schema.Type<typeof AnthropicMessage>
const AnthropicTool = Schema.Struct({ const AnthropicTool = Schema.Struct({
name: Schema.String, name: Schema.String,
description: Schema.String, description: Schema.String,
@ -272,6 +263,26 @@ const AnthropicTool = Schema.Struct({
}) })
type AnthropicTool = Schema.Schema.Type<typeof AnthropicTool> type AnthropicTool = Schema.Schema.Type<typeof AnthropicTool>
const AnthropicToolAdditionBlock = Schema.Struct({
type: Schema.tag("tool_addition"),
tool: Schema.Struct({ type: Schema.tag("tool_definition"), definition: AnthropicTool }),
})
const AnthropicToolRemovalBlock = Schema.Struct({
type: Schema.tag("tool_removal"),
tool: Schema.Struct({ type: Schema.tag("tool_reference"), name: Schema.String }),
})
const AnthropicMessage = Schema.Union([
Schema.Struct({ role: Schema.Literal("user"), content: Schema.Array(AnthropicUserBlock) }),
Schema.Struct({ role: Schema.Literal("assistant"), content: Schema.Array(AnthropicAssistantBlock) }),
Schema.Struct({
role: Schema.Literal("system"),
content: Schema.Array(Schema.Union([AnthropicTextBlock, AnthropicToolAdditionBlock, AnthropicToolRemovalBlock])),
output_config: Schema.optional(Schema.Struct({ effort: Schema.String })),
}),
]).pipe(Schema.toTaggedUnion("role"))
type AnthropicMessage = Schema.Schema.Type<typeof AnthropicMessage>
const AnthropicToolChoice = Schema.Union([ const AnthropicToolChoice = Schema.Union([
Schema.Struct({ Schema.Struct({
type: Schema.Literals(["auto", "any", "none"]), type: Schema.Literals(["auto", "any", "none"]),
@ -792,6 +803,28 @@ const lowerWrappedSystemUpdate = Effect.fnUntraced(function* (
return { type: "text" as const, text: part.text, cache_control: cacheControl(breakpoints, part.cache) } return { type: "text" as const, text: part.text, cache_control: cacheControl(breakpoints, part.cache) }
}) })
const lowerToolsUpdate = Effect.fnUntraced(function* (
message: LLMRequest["messages"][number],
update: ToolChanges,
breakpoints: Cache.Breakpoints,
) {
const text = message.content.length === 0 ? [] : (yield* lowerNativeSystemUpdate(message, breakpoints)).content
return {
role: "system" as const,
content: [
...ProviderShared.flattenTools(update.add).map((tool) => ({
type: "tool_addition" as const,
tool: { type: "tool_definition" as const, definition: lowerTool(breakpoints, tool) },
})),
...update.remove.map((name) => ({
type: "tool_removal" as const,
tool: { type: "tool_reference" as const, name },
})),
...text,
],
}
})
const appendToUserTurn = (messages: AnthropicMessage[], block: AnthropicUserBlock) => { const appendToUserTurn = (messages: AnthropicMessage[], block: AnthropicUserBlock) => {
const last = messages.at(-1) const last = messages.at(-1)
if (last?.role === "user") messages[messages.length - 1] = { role: "user", content: [...last.content, block] } if (last?.role === "user") messages[messages.length - 1] = { role: "user", content: [...last.content, block] }
@ -808,6 +841,13 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, breakpoi
const releaseHeld = Effect.fnUntraced(function* () { const releaseHeld = Effect.fnUntraced(function* () {
const native = acceptsNativeSystemAfter(messages.findLast((message) => message.role !== "system")) const native = acceptsNativeSystemAfter(messages.findLast((message) => message.role !== "system"))
for (const update of held.splice(0)) { for (const update of held.splice(0)) {
const tools = toolsUpdate(update)
if (tools !== undefined) {
if (!native) return yield* invalid("Anthropic Messages tool updates must follow a user message or tool result")
const lowered = yield* lowerToolsUpdate(update, tools, breakpoints)
if (lowered.content.length > 0) messages.push(lowered)
continue
}
if (native) messages.push(yield* lowerNativeSystemUpdate(update, breakpoints)) if (native) messages.push(yield* lowerNativeSystemUpdate(update, breakpoints))
else appendToUserTurn(messages, yield* lowerWrappedSystemUpdate(update, breakpoints)) else appendToUserTurn(messages, yield* lowerWrappedSystemUpdate(update, breakpoints))
} }
@ -821,6 +861,12 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, breakpoi
messages.push({ role: "system", content: [], output_config: { effort: update.effort ?? DEFAULT_EFFORT } }) messages.push({ role: "system", content: [], output_config: { effort: update.effort ?? DEFAULT_EFFORT } })
continue continue
} }
// Held like text updates, so one between a tool call and its result lands after the result. Planning keeps a
// marker in place only on models that take native system messages.
if (toolsUpdate(message) !== undefined) {
held.push(message)
continue
}
if (splitsLocalToolResults(request.messages, index)) if (splitsLocalToolResults(request.messages, index))
return yield* invalid("Anthropic Messages system updates cannot split a local tool call from its tool result") return yield* invalid("Anthropic Messages system updates cannot split a local tool call from its tool result")
if (holdUpdates) held.push(message) if (holdUpdates) held.push(message)
@ -930,6 +976,21 @@ const supportsEffortUpdates = (request: LLMRequest) => {
return version.major > 5 || (version.major === 5 && version.minor >= 1) return version.major > 5 || (version.major === 5 && version.minor >= 1)
} }
// `tool_addition` adds a tool, or redefines one with the same name; `tool_removal` removes one. A held marker is
// released just before the next assistant message, where Anthropic only accepts a native system message after a
// user message or tool result; a marker that would land elsewhere folds.
const toolUpdates = {
kinds: ["add", "remove", "replace"],
placeable: (request, index) => {
if (!supportsNativeSystemUpdates(request)) return false
const end = request.messages.findIndex((next, at) => at > index && next.role === "assistant")
const role = request.messages
.slice(0, end === -1 ? undefined : end)
.findLast((next) => next.role !== "system")?.role
return role === "user" || role === "tool"
},
} satisfies ToolUpdateEncoding
const applyThinkingBindingDefault = (model: LLMRequest["model"], thinking: AnthropicThinking | undefined) => { const applyThinkingBindingDefault = (model: LLMRequest["model"], thinking: AnthropicThinking | undefined) => {
if (isThinkingOff(thinking)) return thinking if (isThinkingOff(thinking)) return thinking
if (!supportsThinkingBlockBinding(model)) return thinking if (!supportsThinkingBlockBinding(model)) return thinking
@ -961,10 +1022,11 @@ const fromRequest = Effect.fn("AnthropicMessages.fromRequest")(function* (reques
// messages. Tools live highest in the cache hierarchy, so when callers // messages. Tools live highest in the cache hierarchy, so when callers
// over-mark we keep their tool hints and shed the message-tail ones first. // over-mark we keep their tool hints and shed the message-tail ones first.
const breakpoints = Cache.newBreakpoints(ANTHROPIC_BREAKPOINT_CAP) const breakpoints = Cache.newBreakpoints(ANTHROPIC_BREAKPOINT_CAP)
const flattened = ProviderShared.flattenToolRequest(updates.request) const definitions = ProviderShared.flattenTools(updates.request.tools)
const tools = flattened.tools.length === 0 ? undefined : flattened.tools.map((tool) => lowerTool(breakpoints, tool)) const tools = definitions.length === 0 ? undefined : definitions.map((tool) => lowerTool(breakpoints, tool))
// Anthropic rejects tool_choice when tools are absent; "none" is only meaningful with tools present. // Anthropic rejects tool_choice when no tool is declared; "none" is only meaningful with tools present.
const toolChoice = tools === undefined || !request.toolChoice ? undefined : yield* lowerToolChoice(request.toolChoice) const declared = tools !== undefined || addsTools(request)
const toolChoice = !declared || !request.toolChoice ? undefined : yield* lowerToolChoice(request.toolChoice)
const systemParts = request.system.filter((part) => part.text.length > 0) const systemParts = request.system.filter((part) => part.text.length > 0)
const system = const system =
systemParts.length === 0 systemParts.length === 0
@ -974,7 +1036,7 @@ const fromRequest = Effect.fn("AnthropicMessages.fromRequest")(function* (reques
text: part.text, text: part.text,
cache_control: cacheControl(breakpoints, part.cache), cache_control: cacheControl(breakpoints, part.cache),
})) }))
const messages = yield* lowerMessages(flattened.request, breakpoints) const messages = yield* lowerMessages(updates.request, breakpoints)
yield* Cache.warnDropped(breakpoints, "Anthropic Messages", ANTHROPIC_BREAKPOINT_CAP) yield* Cache.warnDropped(breakpoints, "Anthropic Messages", ANTHROPIC_BREAKPOINT_CAP)
const output_config = const output_config =
updates.effort === undefined && format === undefined ? undefined : { effort: updates.effort, format } updates.effort === undefined && format === undefined ? undefined : { effort: updates.effort, format }
@ -1528,6 +1590,7 @@ export const protocol = Protocol.make({
step, step,
}, },
supportsEffortUpdates, supportsEffortUpdates,
toolUpdates,
}) })
export const transport = < export const transport = <
@ -1568,6 +1631,14 @@ function requiredBetaHeaders(
if (body.messages.some((message) => message.role === "system" && message.output_config !== undefined)) if (body.messages.some((message) => message.role === "system" && message.output_config !== undefined))
betas.push("mid-conversation-output-config-2026-07-01") betas.push("mid-conversation-output-config-2026-07-01")
if (
body.messages.some(
(message) =>
message.role === "system" &&
message.content.some((block) => block.type === "tool_addition" || block.type === "tool_removal"),
)
)
betas.push("inline-tools-2026-09-15")
// Opus 5.5 accepts `speed` without this header; earlier fast-mode models reject `speed` without it. // Opus 5.5 accepts `speed` without this header; earlier fast-mode models reject `speed` without it.
if (body.speed !== undefined) betas.push("fast-mode-2026-02-01") if (body.speed !== undefined) betas.push("fast-mode-2026-02-01")

View file

@ -1,6 +1,5 @@
import { Effect, Schema } from "effect" import { Effect, Schema } from "effect"
import type { HttpClientResponse } from "effect/http" import type { HttpClientResponse } from "effect/http"
import type { Status } from "../generation.js"
import { Media } from "../media.js" import { Media } from "../media.js"
import { MediaProtocol } from "../route/media-protocol.js" import { MediaProtocol } from "../route/media-protocol.js"
import { MediaRoute } from "../route/media.js" import { MediaRoute } from "../route/media.js"
@ -78,11 +77,11 @@ const Transcript = Schema.Struct({
}) })
const STATUS = { const STATUS = {
queued: "queued", queued: "running",
processing: "running", processing: "running",
completed: "completed", completed: "completed",
error: "failed", error: "failed",
} as const satisfies Record<string, Status> } as const satisfies Record<string, MediaProtocol.State>
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// 5. Request body construction // 5. Request body construction
@ -133,8 +132,10 @@ const decodeStart = Effect.fn("AssemblyAITranscription.decodeStart")(function* (
response: HttpClientResponse.HttpClientResponse, response: HttpClientResponse.HttpClientResponse,
) { ) {
const output = yield* decodeTranscript(response) const output = yield* decodeTranscript(response)
const status = MediaProtocol.status(STATUS, output.value.status) return {
return { token: { transcriptID: output.value.id }, snapshot: { id: output.value.id, status } } token: { transcriptID: output.value.id },
snapshot: { id: output.value.id, ...MediaProtocol.status(STATUS, output.value.status) },
}
}) })
const decodeStatus = Effect.fn("AssemblyAITranscription.decodeStatus")(function* ( const decodeStatus = Effect.fn("AssemblyAITranscription.decodeStatus")(function* (
@ -142,8 +143,7 @@ const decodeStatus = Effect.fn("AssemblyAITranscription.decodeStatus")(function*
context: MediaProtocol.PollContext<Token>, context: MediaProtocol.PollContext<Token>,
) { ) {
const output = yield* decodeTranscript(response) const output = yield* decodeTranscript(response)
const status = MediaProtocol.status(STATUS, output.value.status) return { id: context.token.transcriptID, ...MediaProtocol.status(STATUS, output.value.status) }
return { id: context.token.transcriptID, status }
}) })
const seconds = (milliseconds: number) => milliseconds / 1000 const seconds = (milliseconds: number) => milliseconds / 1000
@ -154,7 +154,7 @@ const decodeResult = Effect.fn("AssemblyAITranscription.decodeResult")(function*
) { ) {
const output = yield* decodeTranscript(response) const output = yield* decodeTranscript(response)
const transcript = output.value const transcript = output.value
const status = MediaProtocol.status(STATUS, transcript.status) const status = MediaProtocol.state(STATUS, transcript.status)
const error = transcript.error ?? undefined const error = transcript.error ?? undefined
if (status === "failed") if (status === "failed")
return yield* output.ended("failed", `${route.name} transcription failed${error === undefined ? "" : `: ${error}`}`) return yield* output.ended("failed", `${route.name} transcription failed${error === undefined ? "" : `: ${error}`}`)

View file

@ -312,8 +312,8 @@ const removeEmptyToolInputKeys = (input: unknown): unknown => {
const lowerToolCall = (part: ToolCallPart, normalizeID: (id: string) => string): BedrockToolUseBlock => ({ const lowerToolCall = (part: ToolCallPart, normalizeID: (id: string) => string): BedrockToolUseBlock => ({
toolUse: { toolUse: {
toolUseId: normalizeID(part.id), toolUseId: normalizeID(part.id),
// Models can emit names that Converse rejects when replayed in history. // Converse rejects replayed names over 64 characters; flattenRequest already fixed invalid characters.
name: part.name.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 64) || "_", name: part.name.slice(0, 64),
input: removeEmptyToolInputKeys(part.input), input: removeEmptyToolInputKeys(part.input),
}, },
}) })
@ -560,7 +560,7 @@ const applyThinkingBindingDefault = (request: LLMRequest, thinking: Readonly<Rec
const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request: LLMRequest) { const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request: LLMRequest) {
const toolChoice = request.toolChoice ? yield* lowerToolChoice(request.toolChoice) : undefined const toolChoice = request.toolChoice ? yield* lowerToolChoice(request.toolChoice) : undefined
const flattened = ProviderShared.flattenToolRequest(request) const definitions = ProviderShared.flattenTools(request.tools)
const options = yield* decodeOptions(request.providerOptions ?? {}) const options = yield* decodeOptions(request.providerOptions ?? {})
const maxTokens = const maxTokens =
isNova2(request.model) && (options.effort === "high" || isHighReasoningEffort(request.http?.body)) isNova2(request.model) && (options.effort === "high" || isHighReasoningEffort(request.http?.body))
@ -593,16 +593,16 @@ const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request:
// tools → system → messages order to favour the highest-impact prefixes. // tools → system → messages order to favour the highest-impact prefixes.
const breakpoints = BedrockCache.breakpoints(request.model) const breakpoints = BedrockCache.breakpoints(request.model)
const toolConfig = (() => { const toolConfig = (() => {
if (flattened.tools.length === 0) return undefined if (definitions.length === 0) return undefined
return { return {
tools: lowerTools(breakpoints, flattened.tools), tools: lowerTools(breakpoints, definitions),
// Converse has no native "none". Keep definitions stable for prompt // Converse has no native "none". Keep definitions stable for prompt
// caching and omit only the unsupported choice. // caching and omit only the unsupported choice.
toolChoice, toolChoice,
} }
})() })()
const system = lowerSystem(breakpoints, request.system) const system = lowerSystem(breakpoints, request.system)
const messages = yield* lowerMessages(flattened.request, breakpoints) const messages = yield* lowerMessages(request, breakpoints)
yield* warnDropped(breakpoints, "Bedrock Converse", BedrockCache.BEDROCK_BREAKPOINT_CAP) yield* warnDropped(breakpoints, "Bedrock Converse", BedrockCache.BEDROCK_BREAKPOINT_CAP)
const inferenceConfig = (() => { const inferenceConfig = (() => {
if ( if (

View file

@ -145,7 +145,7 @@ const TOOL_CHOICE = { auto: undefined, none: "NONE", required: "REQUIRED", tool:
const fromRequest = Effect.fn("CohereChat.fromRequest")(function* (request: LLMRequest) { const fromRequest = Effect.fn("CohereChat.fromRequest")(function* (request: LLMRequest) {
const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(request.providerOptions ?? {}) const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(request.providerOptions ?? {})
const flattened = ProviderShared.flattenToolRequest(request) const definitions = ProviderShared.flattenTools(request.tools)
const messages: (typeof Message.Type)[] = request.system.length const messages: (typeof Message.Type)[] = request.system.length
? [ ? [
{ {
@ -157,7 +157,7 @@ const fromRequest = Effect.fn("CohereChat.fromRequest")(function* (request: LLMR
}, },
] ]
: [] : []
for (const message of flattened.request.messages) { for (const message of request.messages) {
if (message.role === "system") { if (message.role === "system") {
messages.push({ role: "user", content: (yield* ProviderShared.wrappedSystemUpdate("Cohere Chat", message)).text }) messages.push({ role: "user", content: (yield* ProviderShared.wrappedSystemUpdate("Cohere Chat", message)).text })
continue continue
@ -211,7 +211,7 @@ const fromRequest = Effect.fn("CohereChat.fromRequest")(function* (request: LLMR
}) })
} }
const selected = request.toolChoice?.type === "tool" ? request.toolChoice.name : undefined const selected = request.toolChoice?.type === "tool" ? request.toolChoice.name : undefined
const tools = selected === undefined ? flattened.tools : flattened.tools.filter((tool) => tool.name === selected) const tools = selected === undefined ? definitions : definitions.filter((tool) => tool.name === selected)
if (selected !== undefined && tools.length === 0) if (selected !== undefined && tools.length === 0)
return yield* ProviderShared.invalidRequest("Cohere Chat tool choice must name an available tool") return yield* ProviderShared.invalidRequest("Cohere Chat tool choice must name an available tool")
if (tools.some((tool) => tool.native !== undefined)) if (tools.some((tool) => tool.native !== undefined))

View file

@ -149,25 +149,6 @@ const GeminiThinkingConfig = Schema.Struct({
thinkingLevel: Schema.optional(GeminiThinkingLevel), thinkingLevel: Schema.optional(GeminiThinkingLevel),
}) })
const GeminiSafetySetting = Schema.Struct({
category: knownString<
| "HARM_CATEGORY_UNSPECIFIED"
| "HARM_CATEGORY_HATE_SPEECH"
| "HARM_CATEGORY_DANGEROUS_CONTENT"
| "HARM_CATEGORY_HARASSMENT"
| "HARM_CATEGORY_SEXUALLY_EXPLICIT"
| "HARM_CATEGORY_CIVIC_INTEGRITY"
>(),
threshold: knownString<
| "HARM_BLOCK_THRESHOLD_UNSPECIFIED"
| "BLOCK_LOW_AND_ABOVE"
| "BLOCK_MEDIUM_AND_ABOVE"
| "BLOCK_ONLY_HIGH"
| "BLOCK_NONE"
| "OFF"
>(),
})
// ============================================================================= // =============================================================================
// Provider Options // Provider Options
// ============================================================================= // =============================================================================
@ -180,7 +161,7 @@ const GeminiThinkingConfigInput = Schema.Struct({
}) })
const Options = Schema.Struct({ const Options = Schema.Struct({
cachedContent: lenient(Schema.String), cachedContent: lenient(Schema.String),
safetySettings: lenient(Schema.Array(GeminiSafetySetting)), safetySettings: lenient(Schema.Array(GeminiGenerateContent.SafetySetting)),
serviceTier: lenient(knownString<"standard" | "flex" | "priority">()), serviceTier: lenient(knownString<"standard" | "flex" | "priority">()),
thinkingConfig: lenient(GeminiThinkingConfigInput), thinkingConfig: lenient(GeminiThinkingConfigInput),
}) })
@ -202,7 +183,7 @@ const GeminiBodyFields = {
cachedContent: Schema.optional(Schema.String), cachedContent: Schema.optional(Schema.String),
contents: Schema.Array(GeminiContent), contents: Schema.Array(GeminiContent),
labels: Schema.optional(Schema.Record(Schema.String, Schema.String)), labels: Schema.optional(Schema.Record(Schema.String, Schema.String)),
safetySettings: optionalArray(GeminiSafetySetting), safetySettings: optionalArray(GeminiGenerateContent.SafetySetting),
serviceTier: Schema.optional(Schema.String), serviceTier: Schema.optional(Schema.String),
systemInstruction: Schema.optional(GeminiSystemInstruction), systemInstruction: Schema.optional(GeminiSystemInstruction),
tools: optionalArray(GeminiTool), tools: optionalArray(GeminiTool),
@ -442,8 +423,8 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest) {
}) })
const fromRequest = Effect.fn("Gemini.fromRequest")(function* (request: LLMRequest) { const fromRequest = Effect.fn("Gemini.fromRequest")(function* (request: LLMRequest) {
const flattened = ProviderShared.flattenToolRequest(request) const definitions = ProviderShared.flattenTools(request.tools)
const hasTools = flattened.tools.length > 0 const hasTools = definitions.length > 0
const options = yield* decodeOptions(request.providerOptions ?? {}) const options = yield* decodeOptions(request.providerOptions ?? {})
const generationConfig = { const generationConfig = {
maxOutputTokens: request.maxTokens, maxOutputTokens: request.maxTokens,
@ -474,7 +455,7 @@ const fromRequest = Effect.fn("Gemini.fromRequest")(function* (request: LLMReque
return { return {
cachedContent: options.cachedContent, cachedContent: options.cachedContent,
contents: yield* lowerMessages(flattened.request), contents: yield* lowerMessages(request),
safetySettings: options.safetySettings, safetySettings: options.safetySettings,
serviceTier: options.serviceTier, serviceTier: options.serviceTier,
systemInstruction: systemInstruction:
@ -482,7 +463,7 @@ const fromRequest = Effect.fn("Gemini.fromRequest")(function* (request: LLMReque
tools: hasTools tools: hasTools
? [ ? [
{ {
functionDeclarations: flattened.tools.map(lowerTool), functionDeclarations: definitions.map(lowerTool),
}, },
] ]
: undefined, : undefined,

View file

@ -0,0 +1,179 @@
import { Effect, Schema } from "effect"
import { DecisionResponse, DecisionUsage, type DecisionPart, type DecisionRequest } from "../decision.js"
import type { Media } from "../media.js"
import { DecisionRoute } from "../route/decision.js"
import { Endpoint } from "../route/endpoint.js"
import { MediaProtocol } from "../route/media-protocol.js"
import {
AIError,
ProviderID,
UnsupportedOperationError,
mergeJsonRecords,
type ProviderOptions,
} from "../schema/index.js"
import { encodeJson } from "../utils/json.js"
import { JsonObject, knownString, ProviderShared } from "./shared.js"
import { SystemOne } from "./system-one.js"
import { MediaInput } from "./utils/media-input.js"
const ID = "google-decisions"
const NAME = "Google Decisions"
export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta"
const Options = Schema.Struct({
/** Token budget for every image and video input; `ultra_high` applies to images only. */
mediaResolution: Schema.optional(knownString<"low" | "medium" | "high" | "ultra_high">()),
})
/** Known fields map to their wire names; anything else is sent as given. */
export type OptionsInput = ProviderOptions & typeof Options.Encoded
const Usage = Schema.StructWithRest(
Schema.Struct({
total_input_tokens: Schema.optional(Schema.Number),
total_output_tokens: Schema.optional(Schema.Number),
total_tokens: Schema.optional(Schema.Number),
}),
[JsonObject],
)
const Response = Schema.Struct({
answers: Schema.Record(Schema.String, SystemOne.Answer),
usage: Schema.optional(Usage),
})
const decodeOptions = ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))
const fromRequest = Effect.fn("GoogleDecisions.fromRequest")(function* (request: DecisionRequest) {
const options = yield* decodeOptions(request.providerOptions ?? {})
const { mediaResolution: _, ...native } = request.providerOptions ?? {}
return {
...mergeJsonRecords(native, request.http?.body),
model: request.model.id,
input: separateText(
yield* Effect.forEach(request.input, (part) => inputPart(request, part, options.mediaResolution)),
),
questions: {
...(yield* SystemOne.encodeQuestions(request.questions)),
// Google names System One's predicate criteria `true_description` and `false_description`.
...Object.fromEntries(
request.questions.flatMap((question) =>
question.type === "predicate" && question.criteria !== undefined
? [
[
question.name,
{
type: "noul",
instructions: question.instructions,
criteria: {
...(question.criteria.true === undefined ? {} : { true_description: question.criteria.true }),
...(question.criteria.false === undefined ? {} : { false_description: question.criteria.false }),
},
},
],
]
: [],
),
),
},
}
})
const inputPart = (
request: DecisionRequest,
part: DecisionPart,
resolution: string | undefined,
): Effect.Effect<Record<string, unknown>, AIError> => {
if (part.type === "text") return Effect.succeed({ type: "text", text: part.text })
// Google reads every text block as text; JSON is serialized so its keys are never parsed as content blocks.
if (part.type === "json") return Effect.succeed({ type: "text", text: encodeJson(part.value) })
return mediaPart(request, part.media, resolution)
}
// Google joins adjacent text blocks with no separator, so each one after another starts on a new line.
const separateText = (blocks: ReadonlyArray<Record<string, unknown>>) =>
blocks.map((block, index) =>
block.type === "text" && blocks[index - 1]?.type === "text" ? { ...block, text: `\n${block.text}` } : block,
)
const mediaPart = (request: DecisionRequest, asset: Media.Asset, resolution: string | undefined) => {
const type =
asset.kind === "image" || asset.kind === "audio" || asset.kind === "video"
? asset.kind
: asset.mediaType.toLowerCase() === "application/pdf"
? "document"
: undefined
if (type === undefined)
return Effect.fail(
new AIError({
reason: new UnsupportedOperationError({
operation: "decision.media",
provider: request.model.provider,
route: request.model.route.id,
message: `${NAME} takes images, audio, video and PDFs; got ${asset.mediaType}`,
}),
}),
)
const block = {
type,
mime_type: asset.mediaType.toLowerCase(),
// `ultra_high` is image-only, so video keeps Google's default for it.
...(resolution !== undefined && (type === "image" || (type === "video" && resolution !== "ultra_high"))
? { resolution }
: {}),
}
const inline = asset.inline()
if (inline) return Effect.succeed({ ...block, data: inline.base64 })
// Google fetches URLs itself, so one that needs our download credentials can't be forwarded.
if (asset.source.type === "url" && /^https:\/\//i.test(asset.source.url) && asset.headers === undefined)
return Effect.succeed({ ...block, uri: asset.source.url })
const file = MediaInput.refID(asset, ProviderID.make("google"))
if (file !== undefined) return Effect.succeed({ ...block, uri: file })
return Effect.fail(
ProviderShared.invalidRequest(
`${NAME} accepts inline media, public HTTPS URLs and Google Files API URIs; materialize ${asset.source.type} media first`,
),
)
}
const decodeDocument = MediaProtocol.identity({ id: ID, name: NAME, provider: "google" }).decodeJson(Response)
export const protocol = DecisionRoute.protocol({
id: ID,
name: NAME,
body: { from: fromRequest },
response: {
decode: Effect.fn("GoogleDecisions.decodeResponse")(function* (response, context) {
const output = yield* decodeDocument(response)
const data = output.value
const answers = data.answers
const names = context.request.questions.map((question) => question.name)
if (Object.keys(answers).length !== names.length || !names.every((name) => Object.hasOwn(answers, name)))
return yield* output.invalid(`${NAME} answers do not match the requested questions`)
return new DecisionResponse({
answers: context.request.questions.map((question) => SystemOne.toAnswer(question, answers[question.name])),
usage:
data.usage === undefined
? undefined
: new DecisionUsage({
inputTokens: data.usage.total_input_tokens,
outputTokens: data.usage.total_output_tokens,
totalTokens: ProviderShared.totalTokens(
data.usage.total_input_tokens,
data.usage.total_output_tokens,
data.usage.total_tokens,
),
}),
providerMetadata:
data.usage === undefined ? undefined : { [context.providerMetadataKey]: { usage: data.usage } },
})
}),
},
})
export const route = DecisionRoute.make({
id: ID,
provider: "google",
protocol,
endpoint: Endpoint.path("/decisions", { baseURL: DEFAULT_BASE_URL }),
})
export * as GoogleDecisions from "./google-decisions.js"

View file

@ -0,0 +1,264 @@
import { Effect, Schema } from "effect"
import type { HttpClientResponse } from "effect/http"
import { Media } from "../media.js"
import { MediaProtocol } from "../route/media-protocol.js"
import { MediaRoute } from "../route/media.js"
import { mergeJsonRecords, tokenUsage, type OpenString } from "../schema/index.js"
import { VideoModel, VideoResponse, seconds, type VideoRequest } from "../video.js"
import { GoogleInteractions } from "./google-interactions.js"
import { optionalNull } from "./shared.js"
import { GeminiGenerateContent } from "./utils/gemini-generate-content.js"
import { MediaInput } from "./utils/media-input.js"
const route = MediaProtocol.identity({
id: "google-interactions-video",
name: "Google Interactions Video",
provider: "google",
})
export const DEFAULT_BASE_URL = GoogleInteractions.DEFAULT_BASE_URL
export const PATH = "/interactions"
// ---------------------------------------------------------------------------
// 1. Public model input
// ---------------------------------------------------------------------------
/**
* Provider-native Interactions fields, merged into the body. Common fields (`start`, `end`, `references`,
* `duration`, `aspect`, `resolution`) live on the request. Edit or extend a video by passing it as a reference with
* `generation_config.video_config.task`, or continue a generated one with `previous_interaction_id`.
*/
export type GoogleVideoOptions = {
readonly previous_interaction_id?: string
readonly generation_config?: {
readonly video_config?: {
readonly task?: OpenString<"text_to_video" | "image_to_video" | "reference_to_video" | "edit" | "extend">
} & Record<string, unknown>
} & Record<string, unknown>
readonly response_format?: { readonly delivery?: OpenString<"inline" | "uri"> } & Record<string, unknown>
readonly service_tier?: OpenString<"flex" | "standard" | "priority">
readonly webhook_config?: {
readonly uris?: ReadonlyArray<string>
readonly user_metadata?: Record<string, unknown>
}
} & Record<string, unknown>
export type Request = VideoRequest<VideoModel<GoogleVideoOptions>>
// ---------------------------------------------------------------------------
// 2. Token and response schemas
// ---------------------------------------------------------------------------
/** The provider's job ID; it is all a later status, result or cancel call needs. */
export const Token = Schema.String
export type Token = Schema.Schema.Type<typeof Token>
const Content = Schema.Struct({
type: Schema.String,
data: optionalNull(Schema.String),
uri: optionalNull(Schema.String),
mime_type: optionalNull(Schema.String),
text: optionalNull(Schema.String),
})
const Usage = Schema.StructWithRest(
Schema.Struct({
total_input_tokens: optionalNull(Schema.Number),
total_output_tokens: optionalNull(Schema.Number),
total_thought_tokens: optionalNull(Schema.Number),
total_tokens: optionalNull(Schema.Number),
}),
[Schema.Record(Schema.String, Schema.Unknown)],
)
const Interaction = Schema.Struct({
id: Schema.String,
status: Schema.String,
model: optionalNull(Schema.String),
steps: optionalNull(
Schema.Array(Schema.Struct({ type: Schema.String, content: optionalNull(Schema.Array(Content)) })),
),
usage: optionalNull(Usage),
errors: optionalNull(
Schema.Array(Schema.Struct({ code: optionalNull(Schema.String), message: optionalNull(Schema.String) })),
),
})
// `incomplete` is terminal ("completed, but contains incomplete results"); the result read decides whether a video
// came back. `requires_action` and `requires_continuation` are not documented for video and stay running.
const STATUS = {
in_progress: "running",
completed: "completed",
incomplete: "completed",
failed: "failed",
cancelled: "cancelled",
} as const satisfies Record<string, MediaProtocol.State>
// ---------------------------------------------------------------------------
// 3. Failures
// ---------------------------------------------------------------------------
// Interaction error codes are documented only as "a URI that identifies the error type"; the last segment carries the
// canonical Google status name.
const FAILURE = {
INVALID_ARGUMENT: "InvalidRequest",
FAILED_PRECONDITION: "InvalidRequest",
OUT_OF_RANGE: "InvalidRequest",
PERMISSION_DENIED: "Authentication",
UNAUTHENTICATED: "Authentication",
RESOURCE_EXHAUSTED: "RateLimit",
} as const satisfies Record<string, MediaProtocol.Failure>
const errorCode = (code: string | null | undefined) =>
code?.split("/").at(-1)?.trim().toUpperCase().replaceAll("-", "_") || undefined
// ---------------------------------------------------------------------------
// 5. Request body construction
// ---------------------------------------------------------------------------
// Omni has no role field for media: it reads one image as the start frame and two as start and end. The task hint
// pins that reading when only frames, or only references, are sent; with both, the prompt decides.
const task = (request: Request) => {
const frames = request.start !== undefined || request.end !== undefined
const references = (request.references ?? []).length > 0
if (frames && !references) return "image_to_video"
if (references && !frames) return "reference_to_video"
return undefined
}
const fromRequest = Effect.fn("GoogleInteractionsVideo.fromRequest")(function* (request: Request) {
if (request.end !== undefined && request.start === undefined)
return yield* route.unsupported("video.end", `${route.name} reads a lone image as the start frame; send start too`)
const media = yield* Effect.forEach(
[request.start, request.end, ...(request.references ?? [])].filter(
(asset): asset is Media.Asset => asset !== undefined,
),
GoogleInteractions.mediaContent,
)
const responseFormat = {
// `auto` follows the input image, which Omni expresses by leaving the ratio out.
aspect_ratio: request.aspect === "auto" ? undefined : request.aspect,
resolution: request.resolution?.toLowerCase(),
duration: request.duration === undefined ? undefined : `${seconds(request.duration)}s`,
}
const videoTask = task(request)
return MediaProtocol.json(
mergeJsonRecords(
{
model: request.model.id,
input: [...media, { type: "text", text: request.prompt }],
background: true,
response_format: Object.values(responseFormat).some((value) => value !== undefined)
? { type: "video", ...responseFormat }
: undefined,
generation_config: videoTask === undefined ? undefined : { video_config: { task: videoTask } },
},
request.providerOptions,
request.http?.body,
) ?? {},
)
})
// ---------------------------------------------------------------------------
// 6. Response decoding
// ---------------------------------------------------------------------------
const decodeStart = route.decodeStarted(Interaction, (value) => ({
token: value.id,
snapshot: { id: value.id, ...MediaProtocol.status(STATUS, value.status) },
}))
const decodeInteraction = route.decodeJson(Interaction)
const decodeStatus = Effect.fn("GoogleInteractionsVideo.decodeStatus")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeInteraction(response)
return { id: context.token, ...MediaProtocol.status(STATUS, output.value.status) }
})
const decodeResult = Effect.fn("GoogleInteractionsVideo.decodeResult")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeInteraction(response)
const decoded = output.value
const status = MediaProtocol.state(STATUS, decoded.status)
if (status === "running") return yield* output.pending(context.token)
const errors = decoded.errors ?? []
const codes = errors.flatMap((error) => {
const code = errorCode(error.code)
return code === undefined ? [] : [code]
})
const messages = errors.flatMap((error) => (error.message?.trim() ? [error.message.trim()] : []))
if (status === "cancelled")
return yield* output.ended("cancelled", `${route.name} interaction ${context.token} was cancelled`)
if (status === "failed") {
const message = `${route.name} generation failed${codes.length === 0 ? "" : ` (${codes.join(", ")})`}${messages.length === 0 ? "" : `: ${messages.join("\n")}`}`
if (codes.some((code) => code === "CONTENT_BLOCKED" || GeminiGenerateContent.contentFiltered(code)))
return yield* output.contentPolicy(message)
return yield* output.ended("failed", message, MediaProtocol.failure(FAILURE, codes[0]))
}
const contents = (decoded.steps ?? []).flatMap((step) => (step.type === "model_output" ? (step.content ?? []) : []))
const videos = yield* Effect.forEach(
contents.filter((content) => content.type === "video"),
(content, index) => {
const mediaType = content.mime_type ?? undefined
if (content.data)
return MediaInput.decodedAsset(output.invalid, `${route.name} video ${index}`, content.data, mediaType)
// `GET /interactions/{id}` documents inline data even for `delivery: "uri"`; a Files API URI needs the API key
// to download, so it stays a Google reference that can be passed back as input.
if (content.uri) return Effect.succeed(Media.ref(route.provider, content.uri, mediaType))
return Effect.fail(output.invalid(`${route.name} returned a video without data or a URI`))
},
)
if (videos.length === 0) {
if (codes.some((code) => code === "CONTENT_BLOCKED" || GeminiGenerateContent.contentFiltered(code)))
return yield* output.contentPolicy(
`${route.name} withheld the video${messages.length === 0 ? "" : `: ${messages.join("\n")}`}`,
)
return yield* output.invalid(`${route.name} ${decoded.status} without a video`)
}
const usage = decoded.usage ?? undefined
return new VideoResponse({
videos,
usage:
usage === undefined
? undefined
: tokenUsage({
input: usage.total_input_tokens ?? undefined,
output: usage.total_output_tokens ?? undefined,
total: usage.total_tokens ?? undefined,
details: { reasoningTokens: usage.total_thought_tokens ?? undefined, google: usage },
}),
providerMetadata: {
google: {
interactionId: decoded.id,
model: decoded.model ?? undefined,
status: decoded.status,
},
},
})
})
// ---------------------------------------------------------------------------
// 7. Protocol and route
// ---------------------------------------------------------------------------
const interactionPath = (token: Token) => `${PATH}/${encodeURIComponent(token)}`
export const protocol = MediaProtocol.queued<Request, VideoResponse, Token>(route, {
token: Token,
start: { body: { from: fromRequest }, decode: decodeStart },
status: { path: interactionPath, decode: decodeStatus },
result: { path: interactionPath, decode: decodeResult },
cancel: { method: "POST", path: (token) => `${interactionPath(token)}/cancel` },
})
export const model = (input: MediaRoute.ModelInput) =>
VideoModel.fromRoute<GoogleVideoOptions>({ protocol, baseURL: DEFAULT_BASE_URL, path: PATH }, input)
export const GoogleInteractionsVideo = {
protocol,
model,
} as const

View file

@ -1,9 +1,14 @@
import { Effect, Option, Schema, SchemaGetter } from "effect" import { Effect, Option, Schema, SchemaGetter, Stream } from "effect"
import { Route } from "../route/client.js" import { Route } from "../route/client.js"
import { Auth } from "../route/auth.js" import { Auth } from "../route/auth.js"
import { Endpoint } from "../route/endpoint.js" import { Endpoint } from "../route/endpoint.js"
import { Framing } from "../route/framing.js"
import { Protocol } from "../route/protocol.js" import { Protocol } from "../route/protocol.js"
import {
HttpTransport,
type Transport,
type TransportExecution,
type TransportPrepareInput,
} from "../route/transport/index.js"
import { import {
AIError, AIError,
ContentPolicyError, ContentPolicyError,
@ -25,6 +30,9 @@ import { GeminiGenerateContent } from "./utils/gemini-generate-content.js"
import { ToolStream } from "./utils/tool-stream.js" import { ToolStream } from "./utils/tool-stream.js"
const ADAPTER = "google-interactions" const ADAPTER = "google-interactions"
const CONTINUATION = "requires_continuation"
// Matches Google's GenAI SDKs (Python, JS, and Go).
const MAX_STREAM_RECONNECTS_WITHOUT_PROGRESS = 3
const SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator" const SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator"
export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta" export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta"
@ -38,6 +46,7 @@ const Options = Schema.Struct({
thinkingLevel: lenient(ThinkingLevel), thinkingLevel: lenient(ThinkingLevel),
thinkingSummaries: lenient(knownString<"auto" | "none">()), thinkingSummaries: lenient(knownString<"auto" | "none">()),
serviceTier: lenient(knownString<"standard" | "flex" | "priority" | "deferred">()), serviceTier: lenient(knownString<"standard" | "flex" | "priority" | "deferred">()),
safetySettings: lenient(Schema.Array(GeminiGenerateContent.SafetySetting)),
}) })
export type OptionsInput = typeof Options.Encoded export type OptionsInput = typeof Options.Encoded
export type ProviderOptionsInput = OptionsInput export type ProviderOptionsInput = OptionsInput
@ -83,12 +92,14 @@ const ToolChoice = Schema.Union([
]) ])
const Body = Schema.Struct({ const Body = Schema.Struct({
model: Schema.String, model: Schema.String,
input: Schema.Array(InputStep), input: Schema.optional(Schema.Array(InputStep)),
stream: Schema.Literal(true), stream: Schema.Literal(true),
store: Schema.Boolean, store: Schema.Boolean,
previous_interaction_id: Schema.optional(Schema.String), previous_interaction_id: Schema.optional(Schema.String),
continuation_token: Schema.optional(Schema.String),
system_instruction: Schema.optional(Schema.String), system_instruction: Schema.optional(Schema.String),
service_tier: Schema.optional(Schema.String), service_tier: Schema.optional(Schema.String),
safety_settings: Schema.optional(Schema.Array(Schema.Struct({ type: Schema.String, threshold: Schema.String }))),
tools: Schema.optional( tools: Schema.optional(
Schema.Array( Schema.Array(
Schema.Struct({ Schema.Struct({
@ -157,6 +168,7 @@ const Interaction = Schema.StructWithRest(
Schema.Struct({ Schema.Struct({
id: Schema.optional(Schema.String), id: Schema.optional(Schema.String),
status: Schema.String, status: Schema.String,
continuation_token: optionalNull(Schema.String),
usage: Schema.optional(RawUsage), usage: Schema.optional(RawUsage),
errors: Schema.optional( errors: Schema.optional(
Schema.Array(Schema.Struct({ code: Schema.optional(Schema.String), message: Schema.optional(Schema.String) })), Schema.Array(Schema.Struct({ code: Schema.optional(Schema.String), message: Schema.optional(Schema.String) })),
@ -202,6 +214,8 @@ const Event = Schema.Union([
event_type: Schema.Literal("interaction.status_update"), event_type: Schema.Literal("interaction.status_update"),
interaction_id: Schema.optional(Schema.String), interaction_id: Schema.optional(Schema.String),
status: Schema.String, status: Schema.String,
continuation_token: optionalNull(Schema.String),
usage: Schema.optional(RawUsage),
}), }),
Schema.Struct({ event_type: Schema.Literal("interaction.completed"), interaction: Interaction }), Schema.Struct({ event_type: Schema.Literal("interaction.completed"), interaction: Interaction }),
Schema.Struct({ event_type: Schema.Literal("error"), error: Schema.optionalKey(Schema.Unknown) }), Schema.Struct({ event_type: Schema.Literal("error"), error: Schema.optionalKey(Schema.Unknown) }),
@ -216,6 +230,10 @@ interface ParserState {
readonly route: string readonly route: string
readonly metadataKey: string readonly metadataKey: string
readonly lifecycle: Lifecycle.State readonly lifecycle: Lifecycle.State
readonly hop: number
readonly hasToolCalls: boolean
readonly usage?: RawUsage
readonly continuedUsage: ReadonlyArray<RawUsage | undefined>
readonly steps: Partial<Record<number, OutputStep>> readonly steps: Partial<Record<number, OutputStep>>
readonly tools: ToolStream.State<number> readonly tools: ToolStream.State<number>
} }
@ -224,13 +242,28 @@ type StepResult = readonly [ParserState, ReadonlyArray<LLMEvent>]
// ============================================================================= // =============================================================================
// Request Body Construction // Request Body Construction
// ============================================================================= // =============================================================================
const mediaContent = Effect.fnUntraced(function* (asset: Media.Asset) { // https://aistudio.google.com/docs/document-processing#office-documents
const OFFICE_DOCUMENT_MIME_TYPES = new Set([
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
"application/vnd.oasis.opendocument.text",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"application/vnd.oasis.opendocument.presentation",
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.oasis.opendocument.spreadsheet",
])
export const mediaContent = Effect.fnUntraced(function* (asset: Media.Asset) {
if ( if (
asset.kind !== "image" && asset.kind !== "image" &&
asset.kind !== "audio" && asset.kind !== "audio" &&
asset.kind !== "video" && asset.kind !== "video" &&
asset.mediaType !== "application/pdf" && asset.mediaType !== "application/pdf" &&
asset.mediaType !== "text/csv" asset.mediaType !== "text/csv" &&
!OFFICE_DOCUMENT_MIME_TYPES.has(asset.mediaType)
) )
return yield* ProviderShared.invalidRequest( return yield* ProviderShared.invalidRequest(
`Google Interactions does not support ${asset.mediaType} document input`, `Google Interactions does not support ${asset.mediaType} document input`,
@ -335,8 +368,8 @@ const lowerToolResult = Effect.fnUntraced(function* (part: ToolResultPart) {
const fromRequest = Effect.fn("GoogleInteractions.fromRequest")(function* (request: LLMRequest) { const fromRequest = Effect.fn("GoogleInteractions.fromRequest")(function* (request: LLMRequest) {
const options = yield* decodeOptions(request.providerOptions ?? {}) const options = yield* decodeOptions(request.providerOptions ?? {})
const flattened = ProviderShared.flattenToolRequest(request) const definitions = ProviderShared.flattenTools(request.tools)
if (flattened.tools.some((tool) => tool.native !== undefined)) if (definitions.some((tool) => tool.native !== undefined))
return yield* ProviderShared.invalidRequest("Google Interactions hosted tools are not supported") return yield* ProviderShared.invalidRequest("Google Interactions hosted tools are not supported")
if (request.topK !== undefined || request.frequencyPenalty !== undefined || request.presencePenalty !== undefined) if (request.topK !== undefined || request.frequencyPenalty !== undefined || request.presencePenalty !== undefined)
return yield* ProviderShared.invalidRequest( return yield* ProviderShared.invalidRequest(
@ -353,15 +386,19 @@ const fromRequest = Effect.fn("GoogleInteractions.fromRequest")(function* (reque
}) })
return { return {
model: request.model.id, model: request.model.id,
input: yield* lowerMessages(flattened.request), input: yield* lowerMessages(request),
stream: true as const, stream: true as const,
// Full-history replay need not create retained provider resources. Continuation callers opt in to storage. // Full-history replay need not create retained provider resources. Continuation callers opt in to storage.
store: options.store ?? false, store: options.store ?? false,
previous_interaction_id: options.previousInteractionId, previous_interaction_id: options.previousInteractionId,
system_instruction: request.system.length ? ProviderShared.joinText(request.system) : undefined, system_instruction: request.system.length ? ProviderShared.joinText(request.system) : undefined,
service_tier: options.serviceTier, service_tier: options.serviceTier,
tools: flattened.tools.length safety_settings: options.safetySettings?.map((setting) => ({
? flattened.tools.map((tool) => ({ type: setting.category.replace(/^HARM_CATEGORY_/, "").toLowerCase(),
threshold: setting.threshold.toLowerCase(),
})),
tools: definitions.length
? definitions.map((tool) => ({
type: "function" as const, type: "function" as const,
name: tool.name, name: tool.name,
description: tool.description, description: tool.description,
@ -387,32 +424,54 @@ const fromRequest = Effect.fn("GoogleInteractions.fromRequest")(function* (reque
const metadata = (state: ParserState, step: OutputStep): ProviderMetadata => ({ const metadata = (state: ParserState, step: OutputStep): ProviderMetadata => ({
[state.metadataKey]: { interactionSignature: step.signature }, [state.metadataKey]: { interactionSignature: step.signature },
}) })
const mapUsage = (usage: RawUsage | undefined, key: string) => { const mapUsage = (usage: RawUsage | undefined, key: string, continued: ParserState["continuedUsage"]) => {
if (!usage) return undefined if (!usage && continued.every((hop) => !hop)) return undefined
const input = usage.total_input_tokens ?? undefined const first = continued.length ? continued[0] : usage
const cached = usage.total_cached_tokens ?? undefined const hops = [...continued, usage]
const reasoning = usage.total_thought_tokens ?? undefined const sum = (field: (hop: RawUsage) => number | null | undefined) =>
const output = ProviderShared.sumTokens(...hops.map((hop) => (hop ? (field(hop) ?? undefined) : undefined)))
usage.total_output_tokens === undefined || usage.total_output_tokens === null const input = first?.total_input_tokens ?? undefined
const cached = first?.total_cached_tokens ?? undefined
const reasoning = sum((hop) => hop.total_thought_tokens)
const text = sum((hop) => hop.total_output_tokens)
const output = continued.length
? ProviderShared.sumTokens(text, reasoning)
: text === undefined
? undefined ? undefined
: usage.total_output_tokens + (reasoning ?? 0) : text + (reasoning ?? 0)
return new Usage({ return new Usage({
contextTokens: usage.raw_prompt_token ?? input, contextTokens: first?.raw_prompt_token ?? input,
inputTokens: input, inputTokens: input,
outputTokens: output, outputTokens: output,
nonCachedInputTokens: ProviderShared.subtractTokens(input, cached), nonCachedInputTokens: ProviderShared.subtractTokens(input, cached),
cacheReadInputTokens: cached, cacheReadInputTokens: cached,
reasoningTokens: reasoning, reasoningTokens: reasoning,
totalTokens: usage.total_tokens ?? undefined, totalTokens: continued.length
providerMetadata: { [key]: usage }, ? ProviderShared.totalTokens(input, output, undefined)
: (usage?.total_tokens ?? undefined),
// Keep re-billed input in provider metadata, separate from the logical call's input.
providerMetadata: {
[key]: continued.length
? {
total_input_tokens: sum((hop) => hop.total_input_tokens),
total_cached_tokens: sum((hop) => hop.total_cached_tokens),
total_output_tokens: text,
total_thought_tokens: reasoning,
total_tokens: sum((hop) => hop.total_tokens),
requests: hops.length,
}
: (usage ?? {}),
},
}) })
} }
const blockID = (state: ParserState, index: number) => (state.hop === 0 ? String(index) : `${state.hop}:${index}`)
const onStart = Effect.fnUntraced(function* (state: ParserState, index: number, step: OutputStep) { const onStart = Effect.fnUntraced(function* (state: ParserState, index: number, step: OutputStep) {
const events: LLMEvent[] = [] const events: LLMEvent[] = []
let lifecycle = Lifecycle.stepStart(state.lifecycle, events) let lifecycle = Lifecycle.stepStart(state.lifecycle, events)
let tools = state.tools let tools = state.tools
const id = String(index) const id = blockID(state, index)
if (step.type === "thought") { if (step.type === "thought") {
lifecycle = Lifecycle.reasoningStart(lifecycle, events, id, metadata(state, step)) lifecycle = Lifecycle.reasoningStart(lifecycle, events, id, metadata(state, step))
for (const part of step.summary ?? []) lifecycle = Lifecycle.reasoningDelta(lifecycle, events, id, part.text) for (const part of step.summary ?? []) lifecycle = Lifecycle.reasoningDelta(lifecycle, events, id, part.text)
@ -439,7 +498,16 @@ const onStart = Effect.fnUntraced(function* (state: ParserState, index: number,
events.push(LLMEvent.toolInputStart({ id: step.id, name: step.name, providerMetadata: metadata(state, step) })) events.push(LLMEvent.toolInputStart({ id: step.id, name: step.name, providerMetadata: metadata(state, step) }))
} else } else
return yield* ProviderShared.eventError(ADAPTER, `Unsupported Interactions step: ${step.type}`, encodeJson(step)) return yield* ProviderShared.eventError(ADAPTER, `Unsupported Interactions step: ${step.type}`, encodeJson(step))
return [{ ...state, lifecycle, tools, steps: { ...state.steps, [index]: step } }, events] satisfies StepResult return [
{
...state,
lifecycle,
tools,
hasToolCalls: state.hasToolCalls || step.type === "function_call",
steps: { ...state.steps, [index]: step },
},
events,
] satisfies StepResult
}) })
const onDelta = Effect.fnUntraced(function* (state: ParserState, index: number, delta: typeof Delta.Type) { const onDelta = Effect.fnUntraced(function* (state: ParserState, index: number, delta: typeof Delta.Type) {
@ -449,12 +517,15 @@ const onDelta = Effect.fnUntraced(function* (state: ParserState, index: number,
const events: LLMEvent[] = [] const events: LLMEvent[] = []
if (delta.type === "text" && step.type === "model_output") if (delta.type === "text" && step.type === "model_output")
return [ return [
{ ...state, lifecycle: Lifecycle.textDelta(state.lifecycle, events, String(index), delta.text) }, { ...state, lifecycle: Lifecycle.textDelta(state.lifecycle, events, blockID(state, index), delta.text) },
events, events,
] satisfies StepResult ] satisfies StepResult
if (delta.type === "thought_summary" && step.type === "thought") if (delta.type === "thought_summary" && step.type === "thought")
return [ return [
{ ...state, lifecycle: Lifecycle.reasoningDelta(state.lifecycle, events, String(index), delta.content.text) }, {
...state,
lifecycle: Lifecycle.reasoningDelta(state.lifecycle, events, blockID(state, index), delta.content.text),
},
events, events,
] satisfies StepResult ] satisfies StepResult
if (delta.type === "thought_signature") { if (delta.type === "thought_signature") {
@ -493,12 +564,15 @@ const onStop = Effect.fnUntraced(function* (state: ParserState, index: number) {
const events: LLMEvent[] = [] const events: LLMEvent[] = []
if (step.type === "thought") if (step.type === "thought")
return [ return [
{ ...state, lifecycle: Lifecycle.reasoningEnd(state.lifecycle, events, String(index), metadata(state, step)) }, {
...state,
lifecycle: Lifecycle.reasoningEnd(state.lifecycle, events, blockID(state, index), metadata(state, step)),
},
events, events,
] satisfies StepResult ] satisfies StepResult
if (step.type === "model_output") if (step.type === "model_output")
return [ return [
{ ...state, lifecycle: Lifecycle.textEnd(state.lifecycle, events, String(index)) }, { ...state, lifecycle: Lifecycle.textEnd(state.lifecycle, events, blockID(state, index)) },
events, events,
] satisfies StepResult ] satisfies StepResult
const result = yield* ToolStream.finish(ADAPTER, state.tools, index) const result = yield* ToolStream.finish(ADAPTER, state.tools, index)
@ -524,7 +598,32 @@ const failureReason = (route: string, code: string | undefined, message: string,
return classifyProviderFailure({ message, data, rawBody }) return classifyProviderFailure({ message, data, rawBody })
} }
const step = Effect.fnUntraced(function* (state: ParserState, event: Event) { // Marks a request boundary without adding another logical LLM step or finish.
class NextRequest {}
const step = Effect.fnUntraced(function* (state: ParserState, event: Event | NextRequest) {
if (event instanceof NextRequest) {
const pending = yield* ToolStream.finishAll(ADAPTER, state.tools)
const events = [...pending.events]
let lifecycle = state.lifecycle
for (const [index, step] of Object.entries(state.steps)) {
const id = blockID(state, Number(index))
if (step?.type === "thought") lifecycle = Lifecycle.reasoningEnd(lifecycle, events, id, metadata(state, step))
if (step?.type === "model_output") lifecycle = Lifecycle.textEnd(lifecycle, events, id)
}
return [
{
...state,
hop: state.hop + 1,
lifecycle,
steps: {},
tools: ToolStream.empty<number>(),
usage: undefined,
continuedUsage: [...state.continuedUsage, state.usage],
},
events,
] satisfies StepResult
}
switch (event.event_type) { switch (event.event_type) {
case "step.start": case "step.start":
return yield* onStart(state, event.index, event.step) return yield* onStart(state, event.index, event.step)
@ -532,8 +631,9 @@ const step = Effect.fnUntraced(function* (state: ParserState, event: Event) {
return yield* onDelta(state, event.index, event.delta) return yield* onDelta(state, event.index, event.delta)
case "step.stop": case "step.stop":
return yield* onStop(state, event.index) return yield* onStop(state, event.index)
case "interaction.created":
case "interaction.status_update": case "interaction.status_update":
return [{ ...state, usage: event.usage ?? state.usage }, []] satisfies StepResult
case "interaction.created":
case "unknown": case "unknown":
return [state, []] satisfies StepResult return [state, []] satisfies StepResult
case "error": { case "error": {
@ -551,6 +651,8 @@ const step = Effect.fnUntraced(function* (state: ParserState, event: Event) {
} }
case "interaction.completed": { case "interaction.completed": {
const interaction = event.interaction const interaction = event.interaction
if (interaction.status === CONTINUATION)
return [{ ...state, usage: interaction.usage ?? state.usage }, []] satisfies StepResult
if (interaction.status === "failed" || interaction.status === "cancelled") { if (interaction.status === "failed" || interaction.status === "cancelled") {
const messages = (interaction.errors ?? []).flatMap((error) => (error.message?.trim() ? [error.message] : [])) const messages = (interaction.errors ?? []).flatMap((error) => (error.message?.trim() ? [error.message] : []))
const coded = interaction.errors?.find((error) => error.code) const coded = interaction.errors?.find((error) => error.code)
@ -573,18 +675,17 @@ const step = Effect.fnUntraced(function* (state: ParserState, event: Event) {
) )
const pending = yield* ToolStream.finishAll(ADAPTER, state.tools) const pending = yield* ToolStream.finishAll(ADAPTER, state.tools)
const events = [...pending.events] const events = [...pending.events]
const hasToolCalls = Object.values(state.steps).some((item) => item?.type === "function_call")
const lifecycle = Lifecycle.finish(state.lifecycle, events, { const lifecycle = Lifecycle.finish(state.lifecycle, events, {
reason: { reason: {
normalized: normalized:
interaction.status === "requires_action" || (interaction.status === "completed" && hasToolCalls) interaction.status === "requires_action" || (interaction.status === "completed" && state.hasToolCalls)
? "tool-calls" ? "tool-calls"
: interaction.status === "incomplete" : interaction.status === "incomplete"
? "length" ? "length"
: "stop", : "stop",
raw: interaction.status, raw: interaction.status,
}, },
usage: mapUsage(interaction.usage, state.metadataKey), usage: mapUsage(interaction.usage ?? state.usage, state.metadataKey, state.continuedUsage),
providerMetadata: { [state.metadataKey]: { interactionId: interaction.id } }, providerMetadata: { [state.metadataKey]: { interactionId: interaction.id } },
}) })
return [{ ...state, lifecycle, tools: pending.tools }, events] satisfies StepResult return [{ ...state, lifecycle, tools: pending.tools }, events] satisfies StepResult
@ -592,6 +693,177 @@ const step = Effect.fnUntraced(function* (state: ParserState, event: Event) {
} }
}) })
// =============================================================================
// Transport
// =============================================================================
type Body = typeof Body.Type
export interface Prepared {
readonly http: HttpTransport.HttpPrepared<string>
readonly input: TransportPrepareInput<Body>
}
interface Resume {
readonly token: string
readonly owner?: string
readonly reconnectsWithoutProgress: number
readonly lastError?: AIError
}
const sse = HttpTransport.sseJson.with<Body>()
const WireEvent = Protocol.jsonEvent(Event)
const decodeEvent = Schema.decodeUnknownEffect(WireEvent)
export const transport: Transport<Body, Prepared, Event | NextRequest> = {
id: sse.id,
prepare: (input) => sse.prepare(input).pipe(Effect.map((http) => ({ http, input }))),
execute: (prepared, request, runtime) =>
Effect.gen(function* () {
const label = `${request.model.provider}/${request.model.route.id}`
const raw = new WeakMap<object, string>()
const respond = (
execution: TransportExecution<string>,
resume?: Resume,
): Stream.Stream<Event | NextRequest, AIError> =>
Stream.suspend(() => {
let token = resume?.token
let owner: string | undefined
let status: string | undefined
let contentSinceToken = false
let terminal = false
let dropped: AIError | undefined
const pendingTools = new Set<number>()
return execution.frames.pipe(
Stream.mapEffect((frame) =>
decodeEvent(frame).pipe(
Effect.mapError((cause) =>
ProviderShared.eventError(ADAPTER, `Invalid ${label} stream event`, frame, cause),
),
Effect.map((event) => {
raw.set(event, frame)
switch (event.event_type) {
case "interaction.created":
owner = event.interaction.id
break
case "interaction.status_update":
status = event.status
owner = event.interaction_id ?? owner
if (event.continuation_token && event.continuation_token !== token) {
token = event.continuation_token
contentSinceToken = false
}
break
case "interaction.completed":
terminal = true
status = event.interaction.status
owner = event.interaction.id ?? owner
if (event.interaction.continuation_token) {
token = event.interaction.continuation_token
contentSinceToken = false
}
break
case "step.start":
if (event.step.type === "function_call") pendingTools.add(event.index)
if (
pendingTools.has(event.index) ||
event.step.content?.length ||
event.step.summary?.length ||
event.step.signature
)
contentSinceToken = true
break
case "step.delta":
contentSinceToken = true
break
case "step.stop":
if (pendingTools.delete(event.index)) contentSinceToken = true
break
}
return event
}),
),
),
Stream.takeUntil((event) => event.event_type === "interaction.completed"),
Stream.catchIf(
(error) => error.reason._tag === "Transport" && error.reason.code !== "Timeout",
(error) => {
dropped = error
return Stream.empty
},
),
Stream.concat(
Stream.suspend(() => {
const needsContinuation = status === CONTINUATION
const resumable = needsContinuation || (!terminal && (status === undefined || status === "in_progress"))
const newToken = token !== resume?.token
// An interrupted tool call may carry arguments across the checkpoint. Don't finalize it on EOF.
if (
token &&
resumable &&
!contentSinceToken &&
(terminal || pendingTools.size === 0) &&
(!needsContinuation || newToken)
) {
const reconnectsWithoutProgress = newToken ? 0 : (resume?.reconnectsWithoutProgress ?? 0) + 1
const lastError = dropped ?? (newToken ? undefined : resume?.lastError)
if (reconnectsWithoutProgress > MAX_STREAM_RECONNECTS_WITHOUT_PROGRESS) {
if (!lastError) return Stream.empty
return Stream.fail(
new AIError({
reason: new InvalidProviderOutputError({
route: label,
message: lastError.reason.message,
classification: "incomplete-stream",
cause: lastError,
http: lastError.reason.http,
}),
}),
)
}
return Stream.concat(
Stream.succeed(new NextRequest()),
next({ token, owner: newToken ? owner : resume?.owner, reconnectsWithoutProgress, lastError }),
)
}
if (dropped) return Stream.fail(dropped)
if (terminal && needsContinuation && !token)
return Stream.fail(ProviderShared.eventError(label, "Google Interactions continued without a token"))
// No safe checkpoint. Leave EOF for the route's incomplete-stream check.
return Stream.empty
}),
),
)
})
const next = (resume: Resume) => {
const body = prepared.input.body
return Stream.unwrap(
sse
.prepare({
...prepared.input,
body: {
...body,
continuation_token: resume.token,
...(body.store && resume.owner ? { input: undefined, previous_interaction_id: resume.owner } : {}),
},
})
.pipe(
Effect.flatMap((continued) => sse.execute(continued, request, runtime)),
Effect.map((execution) => respond(execution, resume)),
),
)
}
const first = yield* sse.execute(prepared.http, request, runtime)
return {
frames: respond(first),
http: first.http,
body: (frame) => raw.get(frame),
raw: (frame) => {
const body = raw.get(frame)
return body === undefined ? undefined : ProviderShared.decodeJson(body)
},
}
}),
}
// ============================================================================= // =============================================================================
// Protocol And Route // Protocol And Route
// ============================================================================= // =============================================================================
@ -600,16 +872,22 @@ export const protocol = Protocol.make({
sanitizer: "gemini", sanitizer: "gemini",
body: { schema: Body, from: fromRequest }, body: { schema: Body, from: fromRequest },
stream: { stream: {
event: Protocol.jsonEvent(Event), event: Schema.Union([Schema.instanceOf(NextRequest), Schema.toType(Event), WireEvent]),
initial: (request): ParserState => ({ initial: (request): ParserState => ({
route: `${request.model.provider}/${request.model.route.id}`, route: `${request.model.provider}/${request.model.route.id}`,
metadataKey: request.model.route.providerMetadataKey ?? request.model.provider, metadataKey: request.model.route.providerMetadataKey ?? request.model.provider,
lifecycle: Lifecycle.initial(), lifecycle: Lifecycle.initial(),
hop: 0,
hasToolCalls: false,
continuedUsage: [],
steps: {}, steps: {},
tools: ToolStream.empty<number>(), tools: ToolStream.empty<number>(),
}), }),
step, step,
terminal: (event) => event.event_type === "interaction.completed", terminal: (event) =>
!(event instanceof NextRequest) &&
event.event_type === "interaction.completed" &&
event.interaction.status !== CONTINUATION,
}, },
}) })
@ -620,7 +898,7 @@ export const route = Route.make({
protocol, protocol,
endpoint: Endpoint.path("/interactions", { baseURL: DEFAULT_BASE_URL }), endpoint: Endpoint.path("/interactions", { baseURL: DEFAULT_BASE_URL }),
auth: Auth.none, auth: Auth.none,
framing: Framing.sse, transport,
}) })
export * as GoogleInteractions from "./google-interactions.js" export * as GoogleInteractions from "./google-interactions.js"

View file

@ -1,228 +0,0 @@
import { Duration, Effect, Schema } from "effect"
import type { HttpClientResponse } from "effect/http"
import type { Status } from "../generation.js"
import { Media } from "../media.js"
import { MediaProtocol } from "../route/media-protocol.js"
import { MediaRoute } from "../route/media.js"
import { mergeJsonRecords, type OpenString } from "../schema/index.js"
import { VideoModel, VideoResponse, type VideoRequest } from "../video.js"
import { ProviderShared, optionalArray } from "./shared.js"
const route = MediaProtocol.identity({ id: "google-video", name: "Google Veo", provider: "google" })
export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta"
/** Veo keeps generated files for two days; the asset carries that deadline so callers materialize in time. */
const FILE_RETENTION = Duration.days(2)
// ---------------------------------------------------------------------------
// 1. Public model input
// ---------------------------------------------------------------------------
/** Provider-native `parameters`. Common fields (`aspect`, `resolution`, `durationSeconds`, `seed`) live on the request. */
export type GoogleVideoOptions = {
readonly personGeneration?: OpenString<"allow_all" | "allow_adult" | "dont_allow">
} & Record<string, unknown>
export type Request = VideoRequest<VideoModel<GoogleVideoOptions>>
// ---------------------------------------------------------------------------
// 2. Token and response schemas
// ---------------------------------------------------------------------------
/** The long-running operation name, e.g. `models/veo-3.1-generate-preview/operations/abc123`. */
export const Token = Schema.Struct({ operation: Schema.String })
export type Token = Schema.Schema.Type<typeof Token>
const StartResponse = Schema.Struct({ name: Schema.String })
const Operation = Schema.Struct({
done: Schema.optional(Schema.Boolean),
error: Schema.optional(
Schema.Struct({ code: Schema.optional(Schema.Number), message: Schema.optional(Schema.String) }),
),
response: Schema.optional(
Schema.Struct({
generateVideoResponse: Schema.optional(
Schema.Struct({
generatedSamples: optionalArray(
Schema.Struct({
video: Schema.optional(
Schema.Struct({
uri: Schema.optional(Schema.String),
mimeType: Schema.optional(Schema.String),
}),
),
}),
),
raiMediaFilteredCount: Schema.optional(Schema.Number),
raiMediaFilteredReasons: optionalArray(Schema.String),
}),
),
}),
),
metadata: Schema.optional(Schema.Unknown),
})
// Operation errors are `google.rpc.Status`; unlisted codes (INTERNAL, UNAVAILABLE, ...) are provider-side.
const FAILURE = {
3: "InvalidRequest", // INVALID_ARGUMENT
7: "Authentication", // PERMISSION_DENIED
8: "RateLimit", // RESOURCE_EXHAUSTED
9: "InvalidRequest", // FAILED_PRECONDITION
11: "InvalidRequest", // OUT_OF_RANGE
16: "Authentication", // UNAUTHENTICATED
} as const satisfies Record<number, MediaProtocol.Failure>
// ---------------------------------------------------------------------------
// 5. Request body construction
// ---------------------------------------------------------------------------
// Veo takes inline media only; a prior Veo output is `Media.url` with transient auth, so materialize it first.
const inlineMedia = (asset: Media.Asset) =>
ProviderShared.requireInlineMedia(route.name, asset).pipe(
Effect.map((inline) => ({ inlineData: { mimeType: inline.mime, data: inline.base64 } })),
)
const fromRequest = Effect.fn("GoogleVideo.fromRequest")(function* (request: Request) {
if (request.n !== undefined && request.n > 1)
return yield* route.unsupported(
"video.n",
`${route.name} generates one video per request; call it once per video instead of n=${request.n}`,
)
if (request.audio === false)
return yield* route.unsupported(
"video.audio",
`${route.name} always generates audio; audio: false cannot be honored`,
)
if (request.frames?.last !== undefined && request.frames.first === undefined)
return yield* ProviderShared.invalidRequest(`${route.name} requires frames.first when frames.last is set`)
const image = request.frames?.first === undefined ? undefined : yield* inlineMedia(request.frames.first)
const lastFrame = request.frames?.last === undefined ? undefined : yield* inlineMedia(request.frames.last)
const video = request.video === undefined ? undefined : yield* inlineMedia(request.video)
const referenceImages = yield* Effect.forEach(request.references ?? [], (asset) =>
inlineMedia(asset).pipe(Effect.map((image) => ({ image, referenceType: "asset" }))),
)
return MediaProtocol.json(
mergeJsonRecords(
{
instances: [
{
prompt: request.prompt,
image,
lastFrame,
referenceImages: referenceImages.length === 0 ? undefined : referenceImages,
video,
},
],
parameters: mergeJsonRecords(
{
aspectRatio: request.aspect,
resolution: request.resolution,
durationSeconds: request.durationSeconds,
negativePrompt: request.negativePrompt,
seed: request.seed,
},
request.providerOptions,
),
},
request.http?.body,
) ?? {},
)
})
// ---------------------------------------------------------------------------
// 6. Response decoding
// ---------------------------------------------------------------------------
const decodeStart = route.decodeStarted(StartResponse, (value) => ({
token: { operation: value.name },
snapshot: { id: value.name, status: "running" },
}))
// Operations carry no status string: not done is running, done with `error` failed, otherwise completed.
const statusOf = (operation: typeof Operation.Type): Status => {
if (operation.done !== true) return "running"
return operation.error === undefined ? "completed" : "failed"
}
const decodeOperation = route.decodeJson(Operation)
const decodeStatus = Effect.fn("GoogleVideo.decodeStatus")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeOperation(response)
return { id: context.token.operation, status: statusOf(output.value) }
})
const decodeResult = Effect.fn("GoogleVideo.decodeResult")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeOperation(response)
const operation = output.value
const status = statusOf(operation)
if (status === "running") return yield* output.pending(context.token.operation)
if (status === "failed")
return yield* output.ended(
"failed",
`${route.name} operation failed${operation.error?.message === undefined ? "" : `: ${operation.error.message}`}`,
MediaProtocol.failure(FAILURE, operation.error?.code),
)
const generated = operation.response?.generateVideoResponse
// Downloads require the same API key as the poll; the asset carries it transiently and follows the redirect.
const videos = yield* Effect.forEach(
(generated?.generatedSamples ?? []).flatMap((sample) =>
sample.video?.uri === undefined ? [] : [{ uri: sample.video.uri, mimeType: sample.video.mimeType }],
),
(video) =>
MediaProtocol.expiringUrl(video.uri, FILE_RETENTION, {
mediaType: video.mimeType ?? "video/mp4",
headers: context.auth,
}),
)
const reasons = generated?.raiMediaFilteredReasons ?? []
if (videos.length === 0 && (reasons.length > 0 || (generated?.raiMediaFilteredCount ?? 0) > 0))
return yield* output.contentPolicy(
`${route.name} filtered every video${reasons.length === 0 ? "" : `: ${reasons.join("; ")}`}`,
)
if (videos.length === 0) return yield* output.invalid(`${route.name} operation completed without any video`)
return new VideoResponse({
videos,
providerMetadata: {
google: {
operation: context.token.operation,
raiMediaFilteredCount: generated?.raiMediaFilteredCount,
raiMediaFilteredReasons: generated?.raiMediaFilteredReasons,
metadata: operation.metadata,
},
},
})
})
// ---------------------------------------------------------------------------
// 7. Protocol and route
// ---------------------------------------------------------------------------
const operationPath = (token: Token) => `/${token.operation}`
export const protocol = MediaProtocol.queued<Request, VideoResponse, Token>(route, {
token: Token,
start: { body: { from: fromRequest }, decode: decodeStart },
status: { path: operationPath, decode: decodeStatus },
result: { path: operationPath, decode: decodeResult },
})
export const model = (input: MediaRoute.ModelInput) =>
VideoModel.fromRoute<GoogleVideoOptions, Token>(
{
protocol,
baseURL: DEFAULT_BASE_URL,
path: ({ request }) => `/models/${request.model.id}:predictLongRunning`,
},
input,
)
export const GoogleVideo = {
protocol,
model,
} as const

View file

@ -3,6 +3,7 @@ export * as BedrockConverse from "./bedrock-converse.js"
export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js" export * as CloudflareRunDecisions from "./cloudflare-run-decisions.js"
export * as CohereChat from "./cohere-chat.js" export * as CohereChat from "./cohere-chat.js"
export * as Gemini from "./gemini.js" export * as Gemini from "./gemini.js"
export * as GoogleDecisions from "./google-decisions.js"
export * as GoogleEmbedContent from "./google-embed-content.js" export * as GoogleEmbedContent from "./google-embed-content.js"
export * as GoogleInteractions from "./google-interactions.js" export * as GoogleInteractions from "./google-interactions.js"
export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js" export * as GoogleVertexPredictEmbeddings from "./google-vertex-predict-embeddings.js"

View file

@ -26,8 +26,8 @@ const Body = Schema.Struct({
}) })
const fromRequest = Effect.fn("MetaMessages.fromRequest")(function* (request: LLMRequest) { const fromRequest = Effect.fn("MetaMessages.fromRequest")(function* (request: LLMRequest) {
const projected = ProviderShared.flattenToolRequest(request) const body = yield* AnthropicMessages.protocol.body.from(request)
const body = yield* AnthropicMessages.protocol.body.from(projected.request) const definitions = ProviderShared.flattenTools(request.tools)
return { return {
...body, ...body,
messages: body.messages.map((message) => { messages: body.messages.map((message) => {
@ -45,7 +45,7 @@ const fromRequest = Effect.fn("MetaMessages.fromRequest")(function* (request: LL
? undefined ? undefined
: yield* Effect.forEach(body.tools, (tool, index) => : yield* Effect.forEach(body.tools, (tool, index) =>
Effect.gen(function* () { Effect.gen(function* () {
const native = projected.tools[index]?.native const native = definitions[index]?.native
if (native === undefined) return tool if (native === undefined) return tool
const search = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(MetaResponses.WebSearch))( const search = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(MetaResponses.WebSearch))(
native.meta, native.meta,
@ -62,6 +62,8 @@ export const protocol = Protocol.make({
id: "meta-messages", id: "meta-messages",
body: { schema: Body, from: fromRequest }, body: { schema: Body, from: fromRequest },
stream: AnthropicMessages.protocol.stream, stream: AnthropicMessages.protocol.stream,
supportsEffortUpdates: AnthropicMessages.protocol.supportsEffortUpdates,
toolUpdates: AnthropicMessages.protocol.toolUpdates,
}) })
export * as MetaMessages from "./meta-messages.js" export * as MetaMessages from "./meta-messages.js"

View file

@ -242,6 +242,7 @@ export const protocol = Protocol.make({
step, step,
terminal: OpenResponses.terminal, terminal: OpenResponses.terminal,
}, },
supportsEffortUpdates: OpenResponses.protocol.supportsEffortUpdates,
}) })
export const httpTransport = OpenResponses.httpTransport export const httpTransport = OpenResponses.httpTransport

View file

@ -0,0 +1,406 @@
import { Duration, Effect, Schema } from "effect"
import type { HttpClientResponse } from "effect/http"
import { Media } from "../media.js"
import { MediaProtocol } from "../route/media-protocol.js"
import { MediaRoute } from "../route/media.js"
import { AIError, QuotaExceededError, mergeJsonRecords, type OpenString } from "../schema/index.js"
import { VideoModel, VideoResponse, seconds, type VideoRequest } from "../video.js"
import { ProviderShared, optionalNull } from "./shared.js"
// MiniMax runs two video APIs with different bodies, statuses and results: H3 on v2 and Hailuo on v1.
const route = MediaProtocol.identity({ id: "minimax-video", name: "MiniMax Video", provider: "minimax" })
const hailuoRoute = MediaProtocol.identity({
id: "minimax-hailuo-video",
name: "MiniMax Hailuo Video",
provider: "minimax",
})
/** The API host without a version: H3 is served under `/v2` and Hailuo under `/v1`. */
export const DEFAULT_BASE_URL = "https://api.minimax.io"
export const PATH = "/v2/video_generation"
export const STATUS_PATH = "/v2/query/video_generation"
export const HAILUO_PATH = "/v1/video_generation"
export const HAILUO_STATUS_PATH = "/v1/query/video_generation"
export const FILE_PATH = "/v1/files/retrieve"
const DOWNLOAD_RETENTION = Duration.hours(1)
// ---------------------------------------------------------------------------
// 1. Public model input
// ---------------------------------------------------------------------------
/**
* Provider-native options, merged into the body. Common fields (`start`, `end`, `references`, `duration`, `aspect`,
* `resolution`, `sound`) live on the request. `extra` and `response_format` are H3 (v2) fields; `prompt_optimizer`
* and `fast_pretreatment` are Hailuo (v1) fields; both APIs take `callback_url`.
*/
export type MiniMaxVideoOptions = {
readonly extra?: { readonly prompt_expansion_mode?: OpenString<"disabled" | "balanced" | "quality"> }
readonly response_format?: OpenString<"task" | "flat">
readonly prompt_optimizer?: boolean
readonly fast_pretreatment?: boolean
readonly callback_url?: string
} & Record<string, unknown>
export type Request = VideoRequest<VideoModel<MiniMaxVideoOptions>>
// ---------------------------------------------------------------------------
// 2. Token and response schemas
// ---------------------------------------------------------------------------
/** The provider's job ID; it is all a later status, result or cancel call needs. */
export const Token = Schema.String
export type Token = Schema.Schema.Type<typeof Token>
const BaseResp = optionalNull(
Schema.Struct({
status_code: Schema.Number,
status_msg: optionalNull(Schema.String),
}),
)
const StartResponse = Schema.Struct({ task_id: Schema.String })
const Task = Schema.Struct({
id: optionalNull(Schema.String),
model: optionalNull(Schema.String),
status: optionalNull(Schema.String),
error: optionalNull(
Schema.Struct({
code: optionalNull(Schema.Union([Schema.String, Schema.Number])),
message: optionalNull(Schema.String),
}),
),
content: optionalNull(Schema.Struct({ url: optionalNull(Schema.String) })),
resolution: optionalNull(Schema.String),
duration: optionalNull(Schema.Number),
ratio: optionalNull(Schema.String),
usage: optionalNull(Schema.Record(Schema.String, Schema.Unknown)),
})
// `response_format: "flat"` moves the task fields from `task` to the top level.
const TaskResponse = Schema.Struct({ ...Task.fields, task: optionalNull(Task) })
const HailuoStartResponse = Schema.Struct({ task_id: optionalNull(Schema.String), base_resp: BaseResp })
const HailuoTask = Schema.Struct({
status: optionalNull(Schema.String),
file_id: optionalNull(Schema.String),
video_width: optionalNull(Schema.Number),
video_height: optionalNull(Schema.Number),
base_resp: BaseResp,
})
const HailuoFile = Schema.Struct({
file: optionalNull(
Schema.Struct({
download_url: optionalNull(Schema.String),
}),
),
base_resp: BaseResp,
})
const STATUS = {
queued: "running",
running: "running",
succeeded: "completed",
failed: "failed",
cancelled: "cancelled",
} as const satisfies Record<string, MediaProtocol.State>
const HAILUO_STATUS = {
Preparing: "running",
Queueing: "running",
Processing: "running",
Success: "completed",
Fail: "failed",
} as const satisfies Record<string, MediaProtocol.State>
// ---------------------------------------------------------------------------
// 3. Failures
// ---------------------------------------------------------------------------
// Error codes from https://platform.minimax.io/docs/api-reference/errorcode; unknown codes are provider-side.
const FAILURE: Readonly<Record<string, MediaProtocol.Failure>> = {
1002: "RateLimit",
1004: "Authentication",
1039: "RateLimit",
2013: "InvalidRequest",
2049: "Authentication",
}
const INSUFFICIENT_BALANCE = 1008
// 1026 flags the input and 1027 the generated video.
const CONTENT_POLICY = new Set(["1026", "1027"])
type Output = Effect.Success<ReturnType<typeof route.text>>
const failed = (output: Output, name: string, code: string | number | undefined, detail: string | undefined) => {
const message = `${name} generation failed${code === undefined ? "" : ` (${code})`}${detail === undefined ? "" : `: ${detail}`}`
if (code !== undefined && CONTENT_POLICY.has(String(code))) return output.contentPolicy(message)
if (code !== undefined && Number(code) === INSUFFICIENT_BALANCE)
return new AIError({ reason: new QuotaExceededError({ message, body: output.body, http: output.http }) })
return output.ended("failed", message, MediaProtocol.failure(FAILURE, code))
}
// v1 answers errors with HTTP 200 and a non-zero `base_resp.status_code`.
const baseError = (
output: Output,
base: { readonly status_code: number; readonly status_msg?: string | null } | null | undefined,
) =>
base === undefined || base === null || base.status_code === 0
? undefined
: failed(output, hailuoRoute.name, base.status_code, base.status_msg ?? undefined)
// ---------------------------------------------------------------------------
// 5. Request body construction
// ---------------------------------------------------------------------------
/** H3 takes URLs, data URIs and `mm_file://{file_id}` references to MiniMax files. */
const mediaUrl = (asset: Media.Asset) =>
ProviderShared.mediaReference(asset, route.provider, route.name).pipe(
Effect.map((reference) => (reference.type === "ref" ? `mm_file://${reference.value}` : reference.value)),
)
const ROLES = { image: "reference_image", video: "reference_video", audio: "reference_audio" } as const
const item = (asset: Media.Asset, role: string) =>
mediaUrl(asset).pipe(
Effect.map((url) => {
const type = asset.kind === "video" ? "video_url" : asset.kind === "audio" ? "audio_url" : "image_url"
return { type, [type]: { url }, role }
}),
)
const reference = (asset: Media.Asset) =>
item(asset, asset.kind === "video" || asset.kind === "audio" ? ROLES[asset.kind] : ROLES.image)
/** MiniMax spells resolutions in uppercase (`480P`, `768P`, `2K`). */
const resolution = (request: Request) => request.resolution?.toUpperCase()
const fromRequest = Effect.fn("MiniMaxVideo.fromRequest")(function* (request: Request) {
// H3 always generates a soundtrack and has no field for `sound`, so it isn't sent.
const content = [
{ type: "text", text: request.prompt },
...(request.start === undefined ? [] : [yield* item(request.start, "first_frame")]),
...(request.end === undefined ? [] : [yield* item(request.end, "last_frame")]),
...(yield* Effect.forEach(request.references ?? [], reference)),
]
// H3 rejects a t2va (text-only) request without a concrete `ratio`, so `auto` and unset default to `16:9`.
const ratio =
content.length === 1 && (request.aspect === undefined || request.aspect === "auto")
? "16:9"
: request.aspect === "auto"
? "adaptive"
: request.aspect
return MediaProtocol.json(
mergeJsonRecords(
{
model: request.model.id,
content,
resolution: resolution(request),
duration: request.duration === undefined ? undefined : seconds(request.duration),
ratio,
},
request.providerOptions,
request.http?.body,
) ?? {},
)
})
/** v1 documents URLs and data URLs only, so MiniMax file references aren't sent. */
const hailuoUrl = (asset: Media.Asset) =>
ProviderShared.mediaReference(asset, undefined, hailuoRoute.name).pipe(Effect.map((reference) => reference.value))
const hailuoFromRequest = Effect.fn("MiniMaxHailuoVideo.fromRequest")(function* (request: Request) {
const references = request.references ?? []
if (references.some((asset) => asset.kind === "video" || asset.kind === "audio"))
return yield* hailuoRoute.unsupported(
"video.references",
`${hailuoRoute.name} takes only image (subject) references`,
)
// Hailuo output is always silent and its shape follows the model or the first frame, with no field for either.
// `sound` has nothing to send, so it isn't; an aspect ratio would change the shape the caller asked for.
if (request.aspect !== undefined && request.aspect !== "auto")
return yield* hailuoRoute.unsupported("video.aspect", `${hailuoRoute.name} has no aspect ratio input`)
const subjects = yield* Effect.forEach(references, (asset) =>
hailuoUrl(asset).pipe(Effect.map((url) => ({ type: "character", image: [url] }))),
)
return MediaProtocol.json(
mergeJsonRecords(
{
model: request.model.id,
prompt: request.prompt,
first_frame_image: request.start === undefined ? undefined : yield* hailuoUrl(request.start),
last_frame_image: request.end === undefined ? undefined : yield* hailuoUrl(request.end),
subject_reference: subjects.length === 0 ? undefined : subjects,
duration: request.duration === undefined ? undefined : seconds(request.duration),
resolution: resolution(request),
},
request.providerOptions,
request.http?.body,
) ?? {},
)
})
// ---------------------------------------------------------------------------
// 6. Response decoding
// ---------------------------------------------------------------------------
const decodeStart = route.decodeStarted(StartResponse, (value) => ({
token: value.task_id,
snapshot: { id: value.task_id, status: "running" },
}))
const decodeTask = route.decodeJson(TaskResponse)
const decodeStatus = Effect.fn("MiniMaxVideo.decodeStatus")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeTask(response)
const task = output.value.task ?? output.value
return { id: context.token, ...MediaProtocol.status(STATUS, task.status ?? "") }
})
const decodeResult = Effect.fn("MiniMaxVideo.decodeResult")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeTask(response)
const task = output.value.task ?? output.value
const status = MediaProtocol.state(STATUS, task.status ?? "")
if (status === "running") return yield* output.pending(context.token)
if (status === "failed")
return yield* failed(output, route.name, task.error?.code ?? undefined, task.error?.message ?? undefined)
if (status !== "completed")
return yield* output.ended("cancelled", `${route.name} task ${context.token} was cancelled`)
const url = task.content?.url ?? undefined
if (url === undefined) return yield* output.invalid(`${route.name} completed without a video URL`)
const duration = task.duration ?? undefined
const total = task.usage?.total_seconds
return new VideoResponse({
// The URL is time-limited without a documented window; reading the result again returns a fresh one.
videos: [
Media.url(url, {
mediaType: "video/mp4",
info: duration === undefined ? undefined : { durationSeconds: duration },
}),
],
usage: typeof total === "number" ? { type: "seconds", seconds: total } : undefined,
providerMetadata: {
minimax: {
taskId: context.token,
model: task.model ?? undefined,
resolution: task.resolution ?? undefined,
ratio: task.ratio ?? undefined,
usage: task.usage ?? undefined,
},
},
})
})
const decodeHailuoStart = Effect.fn("MiniMaxHailuoVideo.decodeStart")(function* (
response: HttpClientResponse.HttpClientResponse,
) {
const output = yield* hailuoRoute.decodeJson(HailuoStartResponse)(response)
const error = baseError(output, output.value.base_resp)
if (error) return yield* error
const taskID = output.value.task_id ?? ""
if (taskID === "") return yield* output.invalid(`${hailuoRoute.name} returned no task_id`)
return { token: taskID, snapshot: { id: taskID, status: "running" as const } }
})
const decodeHailuoTask = hailuoRoute.decodeJson(HailuoTask)
const decodeHailuoStatus = Effect.fn("MiniMaxHailuoVideo.decodeStatus")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeHailuoTask(response)
const status = MediaProtocol.status(HAILUO_STATUS, output.value.status ?? "")
// A failed task also carries its reason in `base_resp`; any other non-zero code is a failed read.
const error = status.reason === "failed" ? undefined : baseError(output, output.value.base_resp)
if (error) return yield* error
return { id: context.token, ...status }
})
const decodeHailuoFile = hailuoRoute.decodeJson(HailuoFile)
const decodeHailuoResult = Effect.fn("MiniMaxHailuoVideo.decodeResult")(function* (
response: HttpClientResponse.HttpClientResponse,
context: MediaProtocol.PollContext<Token>,
) {
const output = yield* decodeHailuoTask(response)
const task = output.value
const status = MediaProtocol.state(HAILUO_STATUS, task.status ?? "")
const error = baseError(output, task.base_resp)
if (status === "failed") return yield* error ?? failed(output, hailuoRoute.name, undefined, undefined)
if (error) return yield* error
if (status !== "completed") return yield* output.pending(context.token)
const fileID = task.file_id ?? ""
if (fileID === "") return yield* output.invalid(`${hailuoRoute.name} completed without a file_id`)
// The task names a file; its download URL takes a second lookup and is valid for one hour.
const file = yield* decodeHailuoFile(yield* context.get(`${FILE_PATH}?file_id=${encodeURIComponent(fileID)}`))
const fileError = baseError(file, file.value.base_resp)
if (fileError) return yield* fileError
const url = file.value.file?.download_url ?? undefined
if (url === undefined) return yield* file.invalid(`${hailuoRoute.name} returned no download_url for ${fileID}`)
const width = task.video_width ?? undefined
const height = task.video_height ?? undefined
return new VideoResponse({
videos: [
yield* MediaProtocol.expiringUrl(url, DOWNLOAD_RETENTION, {
mediaType: "video/mp4",
info: width === undefined && height === undefined ? undefined : { width, height },
}),
],
providerMetadata: {
minimax: { taskId: context.token, fileId: fileID },
},
})
})
// ---------------------------------------------------------------------------
// 7. Protocol and route
// ---------------------------------------------------------------------------
export const protocol = MediaProtocol.queued<Request, VideoResponse, Token>(route, {
token: Token,
start: { body: { from: fromRequest }, decode: decodeStart },
status: { path: (token) => `${STATUS_PATH}/${encodeURIComponent(token)}`, decode: decodeStatus },
result: { path: (token) => `${STATUS_PATH}/${encodeURIComponent(token)}`, decode: decodeResult },
// Cancels a queued task; MiniMax rejects it once the task is running.
cancel: { method: "DELETE", path: (token) => `${PATH}/${encodeURIComponent(token)}` },
})
const hailuoStatusPath = (token: Token) => `${HAILUO_STATUS_PATH}?task_id=${encodeURIComponent(token)}`
export const hailuoProtocol = MediaProtocol.queued<Request, VideoResponse, Token>(hailuoRoute, {
token: Token,
start: { body: { from: hailuoFromRequest }, decode: decodeHailuoStart },
status: { path: hailuoStatusPath, decode: decodeHailuoStatus },
result: { path: hailuoStatusPath, decode: decodeHailuoResult },
})
/** H3 and later models on the v2 API. */
export const h3Model = (input: MediaRoute.ModelInput) =>
VideoModel.fromRoute<MiniMaxVideoOptions>({ protocol, baseURL: DEFAULT_BASE_URL, path: PATH }, input)
/** Hailuo and the `*-01` models on the v1 API. */
export const hailuoModel = (input: MediaRoute.ModelInput) =>
VideoModel.fromRoute<MiniMaxVideoOptions>(
{ protocol: hailuoProtocol, baseURL: DEFAULT_BASE_URL, path: HAILUO_PATH },
input,
)
// v1 is MiniMax's legacy API with a fixed model list; every newer model ships on v2.
const isHailuo = (modelID: string) => /^(minimax-hailuo-|[tis]2v-01|video-01)/i.test(modelID)
/** Picks the API by model family: Hailuo and `*-01` models use v1, everything else v2. */
export const model = (input: MediaRoute.ModelInput) => (isHailuo(input.id) ? hailuoModel(input) : h3Model(input))
export const MiniMaxVideo = {
protocol,
hailuoProtocol,
model,
h3Model,
hailuoModel,
} as const

View file

@ -369,6 +369,7 @@ const lowerTool = (tool: ToolDefinition): MistralTool => ({
function: { name: tool.name, description: tool.description, parameters: tool.inputSchema, strict: false }, function: { name: tool.name, description: tool.description, parameters: tool.inputSchema, strict: false },
}) })
/** Expects tool namespaces already flattened, as `protocol.body.from` passes it; otherwise run `ProviderShared.flattenRequest` first. */
export const fromRequest = Effect.fn("MistralChat.fromRequest")(function* (request: LLMRequest) { export const fromRequest = Effect.fn("MistralChat.fromRequest")(function* (request: LLMRequest) {
const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(MistralOptions))( const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(MistralOptions))(
request.providerOptions ?? {}, request.providerOptions ?? {},
@ -385,11 +386,10 @@ export const fromRequest = Effect.fn("MistralChat.fromRequest")(function* (reque
tool: (name) => ({ type: "function" as const, function: { name } }), tool: (name) => ({ type: "function" as const, function: { name } }),
}) })
: undefined : undefined
const flattened = ProviderShared.flattenToolRequest(request)
return { return {
model: request.model.id, model: request.model.id,
messages: yield* lowerMessages(flattened.request), messages: yield* lowerMessages(request),
tools: flattened.tools.length > 0 ? flattened.tools.map(lowerTool) : undefined, tools: request.tools.length > 0 ? ProviderShared.flattenTools(request.tools).map(lowerTool) : undefined,
tool_choice: toolChoice, tool_choice: toolChoice,
stream: true as const, stream: true as const,
max_tokens: request.maxTokens, max_tokens: request.maxTokens,

View file

@ -87,6 +87,8 @@ const comparable = (value: unknown) => {
name: value.name, name: value.name,
arguments: json(value.arguments), arguments: json(value.arguments),
} }
if (value.type === "custom_tool_call")
return { type: value.type, call_id: value.call_id, name: value.name, input: value.input }
if (value.type === "reasoning") if (value.type === "reasoning")
return { return {
type: value.type, type: value.type,

View file

@ -14,6 +14,7 @@ import {
type ReasoningPart, type ReasoningPart,
type TextPart, type TextPart,
type ToolCallPart, type ToolCallPart,
type ToolChanges,
type ToolDefinition, type ToolDefinition,
type ToolResultPart, type ToolResultPart,
type UserMessage, type UserMessage,
@ -29,7 +30,8 @@ import {
withUntypedFrames, withUntypedFrames,
} from "./shared.js" } from "./shared.js"
import { classifyProviderFailure } from "../provider-error.js" import { classifyProviderFailure } from "../provider-error.js"
import { effortUpdate } from "../effort-updates.js" import { effortUpdate, resolveEffortUpdates } from "../effort-updates.js"
import { toolsUpdate } from "../tool-updates.js"
import { OpenResponsesOptions } from "./utils/open-responses-options.js" import { OpenResponsesOptions } from "./utils/open-responses-options.js"
import { Lifecycle } from "./utils/lifecycle.js" import { Lifecycle } from "./utils/lifecycle.js"
import { ToolStream } from "./utils/tool-stream.js" import { ToolStream } from "./utils/tool-stream.js"
@ -189,9 +191,49 @@ export const HostedToolReplay = Schema.StructWithRest(
) )
export type HostedToolReplayItem = Schema.Schema.Type<typeof HostedToolReplay> export type HostedToolReplayItem = Schema.Schema.Type<typeof HostedToolReplay>
export const Tool = Schema.Struct({
type: Schema.tag("function"),
name: Schema.String,
description: Schema.String,
parameters: JsonObject,
strict: Schema.optional(Schema.Boolean),
})
export const CustomTool = Schema.Struct({
type: Schema.tag("custom"),
name: Schema.String,
description: Schema.String,
format: Schema.Union([
Schema.Struct({ type: Schema.tag("text") }),
Schema.Struct({
type: Schema.tag("grammar"),
syntax: Schema.Literals(["lark", "regex"]),
definition: Schema.String,
}),
]),
})
export const HostedTool = Schema.StructWithRest(
Schema.Struct({
type: Schema.String,
}),
[JsonObject],
)
export type HostedTool = Schema.Schema.Type<typeof HostedTool>
const NamedTool = Schema.Struct({ type: Schema.Literals(["function", "custom"]), name: Schema.String })
// Tools added mid-conversation. Only the OpenAI extension lowers it; other hosts fold tool updates.
export const AdditionalTools = Schema.Struct({
type: Schema.Literal("additional_tools"),
role: Schema.Literal("developer"),
tools: Schema.Array(Schema.Union([Tool, CustomTool, HostedTool])),
})
export const InputItem = Schema.Union([ export const InputItem = Schema.Union([
CompactionItem, CompactionItem,
ConfigurationUpdate, ConfigurationUpdate,
AdditionalTools,
Schema.Struct({ type: Schema.tag("message"), role: Schema.tag("system"), content: Schema.String }), Schema.Struct({ type: Schema.tag("message"), role: Schema.tag("system"), content: Schema.String }),
Schema.Struct({ type: Schema.tag("message"), role: Schema.tag("developer"), content: Schema.String }), Schema.Struct({ type: Schema.tag("message"), role: Schema.tag("developer"), content: Schema.String }),
Schema.Struct({ Schema.Struct({
@ -243,38 +285,6 @@ type OpenResponsesReasoningInput = {
summary: Array<{ type: "summary_text"; text: string }> summary: Array<{ type: "summary_text"; text: string }>
encrypted_content?: string | null encrypted_content?: string | null
} }
export const Tool = Schema.Struct({
type: Schema.tag("function"),
name: Schema.String,
description: Schema.String,
parameters: JsonObject,
strict: Schema.optional(Schema.Boolean),
})
export const CustomTool = Schema.Struct({
type: Schema.tag("custom"),
name: Schema.String,
description: Schema.String,
format: Schema.Union([
Schema.Struct({ type: Schema.tag("text") }),
Schema.Struct({
type: Schema.tag("grammar"),
syntax: Schema.Literals(["lark", "regex"]),
definition: Schema.String,
}),
]),
})
export const HostedTool = Schema.StructWithRest(
Schema.Struct({
type: Schema.String,
}),
[JsonObject],
)
export type HostedTool = Schema.Schema.Type<typeof HostedTool>
const NamedTool = Schema.Struct({ type: Schema.Literals(["function", "custom"]), name: Schema.String })
export const ToolChoice = Schema.Union([ export const ToolChoice = Schema.Union([
Schema.Literals(["auto", "none", "required"]), Schema.Literals(["auto", "none", "required"]),
NamedTool, NamedTool,
@ -434,6 +444,8 @@ export interface ProviderAdapter {
readonly request: LLMRequest readonly request: LLMRequest
}) => MediaInput | undefined }) => MediaInput | undefined
readonly restoreHostedToolItem?: (item: unknown) => HostedToolReplayItem | undefined readonly restoreHostedToolItem?: (item: unknown) => HostedToolReplayItem | undefined
/** Lowers a `Message.tools(...)` marker sent in place; routes without it must fold tool updates. */
readonly lowerToolChanges?: (changes: ToolChanges) => Effect.Effect<ReadonlyArray<OpenResponsesInputItem>, AIError>
} }
const BASE_ADAPTER: ProviderAdapter = { id: ADAPTER, name: NAME } const BASE_ADAPTER: ProviderAdapter = { id: ADAPTER, name: NAME }
@ -484,11 +496,11 @@ export const lowerTool = Effect.fnUntraced(function* (protocolName: string, tool
}) })
export const lowerCustomTool = (tool: ToolDefinition, custom: OpenAIFreeform.Custom) => { export const lowerCustomTool = (tool: ToolDefinition, custom: OpenAIFreeform.Custom) => {
const grammar = OpenAIFreeform.grammar(custom.format) const grammar = OpenAIFreeform.grammar(custom)
return { return {
type: "custom" as const, type: "custom" as const,
name: tool.name, name: tool.name,
description: tool.description, description: OpenAIFreeform.description(tool, custom),
format: grammar ? { type: "grammar" as const, ...grammar } : { type: "text" as const }, format: grammar ? { type: "grammar" as const, ...grammar } : { type: "text" as const },
} }
} }
@ -548,7 +560,7 @@ const lowerToolCall = (
...(id === undefined ? {} : { id }), ...(id === undefined ? {} : { id }),
call_id: part.id, call_id: part.id,
name: part.name, name: part.name,
input: OpenAIFreeform.toRaw(custom, part.input), input: OpenAIFreeform.toRaw(custom, part.input, part.providerMetadata?.[providerMetadataKey]?.header),
} }
return { return {
type: "function_call", type: "function_call",
@ -641,10 +653,17 @@ const lowerToolResultOutput = Effect.fnUntraced(function* (
const DEFAULT_EFFORT = "medium" const DEFAULT_EFFORT = "medium"
const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter: ProviderAdapter) { // A call's output only follows the whole assistant turn, and Meta's Muse models, directly or through a gateway,
// reject a commentary message replayed while a call is waiting for it. Text after a call keeps its place without
// the phase there; other providers accept it and keep the phase.
const rejectsPendingCommentary = (request: LLMRequest) =>
request.model.provider === "meta" || /(?:^|\/)muse-/i.test(request.model.id)
export const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter: ProviderAdapter) {
const input: OpenResponsesInputItem[] = [] const input: OpenResponsesInputItem[] = []
const providerMetadataKey = metadataKey(request.model) const providerMetadataKey = metadataKey(request.model)
const custom = OpenAIFreeform.tools(request) const custom = OpenAIFreeform.tools(request)
const pendingCommentaryRejected = rejectsPendingCommentary(request)
const customTool = (part: ToolCallPart | ToolResultPart) => const customTool = (part: ToolCallPart | ToolResultPart) =>
part.namespace === undefined ? custom.get(part.name) : undefined part.namespace === undefined ? custom.get(part.name) : undefined
@ -663,6 +682,13 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter:
input.push({ type: "configuration_update", reasoning: { effort: update.effort ?? DEFAULT_EFFORT } }) input.push({ type: "configuration_update", reasoning: { effort: update.effort ?? DEFAULT_EFFORT } })
continue continue
} }
// Planning folds every marker on routes whose protocol has no `toolUpdates`, so only adapters with
// `lowerToolChanges` see one.
const tools = toolsUpdate(message)
if (tools && adapter.lowerToolChanges) {
input.push(...(yield* adapter.lowerToolChanges(tools)))
if (message.content.length === 0) continue
}
input.push({ input.push({
type: "message", type: "message",
role: "developer", role: "developer",
@ -682,6 +708,7 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter:
const content: TextPart[] = [] const content: TextPart[] = []
const reasoningItems: Record<string, OpenResponsesReasoningInput> = {} const reasoningItems: Record<string, OpenResponsesReasoningInput> = {}
const hostedToolItems = new Set<string>() const hostedToolItems = new Set<string>()
let calledTool = false
const flushText = () => { const flushText = () => {
if (content.length === 0) return if (content.length === 0) return
const groups = content.reduce< const groups = content.reduce<
@ -690,7 +717,8 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter:
const partMetadata = part.providerMetadata?.[providerMetadataKey] const partMetadata = part.providerMetadata?.[providerMetadataKey]
const id = itemID(part.providerMetadata, providerMetadataKey) ?? metadata?.itemId const id = itemID(part.providerMetadata, providerMetadataKey) ?? metadata?.itemId
const partPhase = messagePhase(partMetadata?.phase) const partPhase = messagePhase(partMetadata?.phase)
const phase = partPhase === undefined ? metadata?.phase : partPhase const declared = partPhase === undefined ? metadata?.phase : partPhase
const phase = calledTool && declared === "commentary" && pendingCommentaryRejected ? undefined : declared
const group = groups.at(-1) const group = groups.at(-1)
if (group && group.id === id && group.phase === phase) group.parts.push(part) if (group && group.id === id && group.phase === phase) group.parts.push(part)
else groups.push({ id, phase, parts: [part] }) else groups.push({ id, phase, parts: [part] })
@ -742,6 +770,7 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter:
flushText() flushText()
if (part.providerExecuted === true) continue if (part.providerExecuted === true) continue
input.push(lowerToolCall(part, providerMetadataKey, customTool(part))) input.push(lowerToolCall(part, providerMetadataKey, customTool(part)))
calledTool = true
continue continue
} }
if (part.type === "tool-result" && part.providerExecuted === true) { if (part.type === "tool-result" && part.providerExecuted === true) {
@ -805,12 +834,15 @@ const lowerMessages = Effect.fnUntraced(function* (request: LLMRequest, adapter:
return input return input
}) })
// The system prompt leads `input` as a developer message: GPT-6.2 models never cache top-level `instructions`.
export const lowerConversation = Effect.fnUntraced(function* (request: LLMRequest, adapter: ProviderAdapter) { export const lowerConversation = Effect.fnUntraced(function* (request: LLMRequest, adapter: ProviderAdapter) {
const instructions = ProviderShared.joinText(request.system) const system = ProviderShared.joinText(request.system)
return { return {
model: request.model.id, model: request.model.id,
input: yield* lowerMessages(request, adapter), input: [
...(instructions ? { instructions } : {}), ...(system ? [{ type: "message" as const, role: "developer" as const, content: system }] : []),
...(yield* lowerMessages(request, adapter)),
],
} }
}) })
@ -864,23 +896,26 @@ export const allowedToolChoice = (
} }
} }
/** Expects tool namespaces already flattened, as `protocol.body.from` passes it; otherwise run `ProviderShared.flattenRequest` first. */
export const fromRequestWithAdapter = Effect.fn("OpenResponses.fromRequestWithAdapter")(function* ( export const fromRequestWithAdapter = Effect.fn("OpenResponses.fromRequestWithAdapter")(function* (
request: LLMRequest, request: LLMRequest,
adapter: ProviderAdapter, adapter: ProviderAdapter,
) { ) {
const projected = ProviderShared.flattenToolRequest(request) const definitions = ProviderShared.flattenTools(request.tools)
const options = OpenResponsesOptions.resolve(request) const options = OpenResponsesOptions.resolve(request)
const custom = OpenAIFreeform.tools(request) const custom = OpenAIFreeform.tools(request)
const updates = resolveEffortUpdates(request, options.reasoningEffort)
return { return {
...(yield* lowerConversation(projected.request, adapter)), ...(yield* lowerConversation(updates.request, adapter)),
...lowerGeneration(request, options), ...lowerGeneration(request, { ...options, reasoningEffort: updates.effort }),
tools: projected.tools.length === 0 ? undefined : yield* lowerTools(projected.tools, adapter, custom), tools: definitions.length === 0 ? undefined : yield* lowerTools(definitions, adapter, custom),
tool_choice: tool_choice:
allowedToolChoice(options, custom) ?? allowedToolChoice(options, custom) ??
(request.toolChoice ? yield* lowerToolChoice(adapter.name, request.toolChoice, custom) : undefined), (request.toolChoice ? yield* lowerToolChoice(adapter.name, request.toolChoice, custom) : undefined),
} }
}) })
/** Expects tool namespaces already flattened, as `protocol.body.from` passes it; otherwise run `ProviderShared.flattenRequest` first. */
export const fromRequest = (request: LLMRequest) => fromRequestWithAdapter(request, BASE_ADAPTER) export const fromRequest = (request: LLMRequest) => fromRequestWithAdapter(request, BASE_ADAPTER)
// ============================================================================= // =============================================================================
@ -1313,19 +1348,25 @@ const onOutputItemDone = Effect.fnUntraced(function* (state: ParserState, item:
if (!item.call_id || !item.name) return [state, NO_EVENTS] satisfies StepResult if (!item.call_id || !item.name) return [state, NO_EVENTS] satisfies StepResult
const custom = item.type === "custom_tool_call" const custom = item.type === "custom_tool_call"
const metadata = providerMetadata(state, OpenAIFreeform.metadata(item.id, custom)) const metadata = providerMetadata(state, OpenAIFreeform.metadata(item.id, custom))
const final = { custom: state.custom.get(item.name), raw: rawInput(item) }
const input = custom ? OpenAIFreeform.fromRaw(final.custom, final.raw) : item.arguments
const registered = state.tools[item.id] !== undefined const registered = state.tools[item.id] !== undefined
const closed = custom ? OpenAIFreeform.close(state.tools, [item.id], final) : undefined const started = registered
const tools = registered ? state.tools
? (closed?.tools ?? state.tools)
: ToolStream.start(state.tools, item.id, { : ToolStream.start(state.tools, item.id, {
id: item.call_id, id: item.call_id,
name: item.name, name: item.name,
namespace: item.namespace, namespace: item.namespace,
providerMetadata: metadata, providerMetadata: metadata,
}) })
const result = yield* ToolStream.finish(state.id, tools, item.id, input) // A custom call's final raw text sets its input, so it finishes without an override.
const closed = custom
? OpenAIFreeform.close(started, [item.id], state.custom, state.providerMetadataKey, rawInput(item))
: undefined
const result = yield* ToolStream.finish(
state.id,
closed?.tools ?? started,
item.id,
custom ? undefined : item.arguments,
)
const events: LLMEvent[] = [] const events: LLMEvent[] = []
const finished = [...(closed?.events ?? []), ...(result.events ?? [])] const finished = [...(closed?.events ?? []), ...(result.events ?? [])]
// A done-only call never streamed a start event, so open its lifecycle here. // A done-only call never streamed a start event, so open its lifecycle here.
@ -1417,7 +1458,16 @@ const onResponseFinish = Effect.fnUntraced(function* (state: ParserState, event:
events.push(...emitted) events.push(...emitted)
} }
// Some compatible providers omit output_item.done even after completing the response. // Some compatible providers omit output_item.done even after completing the response.
const pending = yield* ToolStream.finishAll(current.id, current.tools) const open = OpenAIFreeform.close(
current.tools,
Object.keys(current.tools).filter(
(key) => current.tools[key]?.providerMetadata?.[current.providerMetadataKey]?.custom === true,
),
current.custom,
current.providerMetadataKey,
)
events.push(...open.events)
const pending = yield* ToolStream.finishAll(current.id, open.tools)
current = { current = {
...current, ...current,
tools: pending.tools, tools: pending.tools,
@ -1590,6 +1640,8 @@ export const protocol = Protocol.make({
step: (state: ParserState, event: Event) => step(state, normalize(state, event)), step: (state: ParserState, event: Event) => step(state, normalize(state, event)),
terminal, terminal,
}, },
// Not every Open Responses server accepts `configuration_update`, so only models that opt in get it.
supportsEffortUpdates: (request) => request.model.capabilities?.reasoning?.updates === true,
}) })
export const httpTransport = HttpTransport.sseJson.with<OpenResponsesBody>() export const httpTransport = HttpTransport.sseJson.with<OpenResponsesBody>()

View file

@ -406,12 +406,12 @@ const lowerTool = (
custom: OpenAIFreeform.Custom | undefined, custom: OpenAIFreeform.Custom | undefined,
): OpenAIChatTool => { ): OpenAIChatTool => {
if (custom) { if (custom) {
const grammar = OpenAIFreeform.grammar(custom.format) const grammar = OpenAIFreeform.grammar(custom)
return { return {
type: "custom", type: "custom",
custom: { custom: {
name: tool.name, name: tool.name,
description: tool.description, description: OpenAIFreeform.description(tool, custom),
format: grammar ? { type: "grammar", grammar } : { type: "text" }, format: grammar ? { type: "grammar", grammar } : { type: "text" },
}, },
cache_control: options.cacheControl?.(tool.cache), cache_control: options.cacheControl?.(tool.cache),
@ -450,7 +450,10 @@ const lowerToolCall = (part: ToolCallPart, options: MessageLoweringOptions): Ope
return { return {
id: options.toolCallID?.(part.id) ?? part.id, id: options.toolCallID?.(part.id) ?? part.id,
type: "custom", type: "custom",
custom: { name: part.name, input: OpenAIFreeform.toRaw(custom, part.input) }, custom: {
name: part.name,
input: OpenAIFreeform.toRaw(custom, part.input, part.providerMetadata?.[options.providerMetadataKey]?.header),
},
} }
return { return {
id: options.toolCallID?.(part.id) ?? part.id, id: options.toolCallID?.(part.id) ?? part.id,
@ -577,6 +580,9 @@ const lowerAssistantMessage = Effect.fnUntraced(function* (
const opaque = reasoningOpaque(reasoning, options.providerMetadataKey) const opaque = reasoningOpaque(reasoning, options.providerMetadataKey)
const reasoningText = const reasoningText =
reasoning.length === 0 || (opaque !== undefined && text === "") ? (requireReasoning ? "" : undefined) : text reasoning.length === 0 || (opaque !== undefined && text === "") ? (requireReasoning ? "" : undefined) : text
// A model that declares a different reasoning field reads reasoning there, so structured details and opaque values
// from earlier turns (including another model served under the same provider metadata key) must not be replayed.
const replaysStructured = configuredField === undefined || configuredField === "reasoning_details"
const result = { const result = {
role: "assistant" as const, role: "assistant" as const,
content: (() => { content: (() => {
@ -585,10 +591,11 @@ const lowerAssistantMessage = Effect.fnUntraced(function* (
return content.map((part) => part.text).join("") return content.map((part) => part.text).join("")
})(), })(),
...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}), ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}),
...(details !== undefined ? { reasoning_details: details } : {}), ...(details !== undefined && replaysStructured ? { reasoning_details: details } : {}),
...(opaque !== undefined ? { reasoning_opaque: opaque } : {}), ...(opaque !== undefined && replaysStructured ? { reasoning_opaque: opaque } : {}),
} }
if (field === undefined || reasoningText === undefined) return result // `reasoning_details` is the structured list itself, so scalar text must not be written over it.
if (field === undefined || reasoningText === undefined || field === "reasoning_details") return result
return { ...result, [field]: reasoningText } return { ...result, [field]: reasoningText }
}) })
@ -862,6 +869,7 @@ const lowerOptions = (request: LLMRequest, supportsStore: boolean, hasActiveTool
} }
} }
/** Expects tool namespaces already flattened, as `protocol.body.from` passes it; otherwise run `ProviderShared.flattenRequest` first. */
export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* ( export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (
request: LLMRequest, request: LLMRequest,
options: LoweringOptions = {}, options: LoweringOptions = {},
@ -873,7 +881,7 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (
return yield* ProviderShared.invalidRequest( return yield* ProviderShared.invalidRequest(
`OpenAI Chat reasoning field conflicts with reserved field ${reasoningField}`, `OpenAI Chat reasoning field conflicts with reserved field ${reasoningField}`,
) )
const flattened = ProviderShared.flattenToolRequest(request) const definitions = ProviderShared.flattenTools(request.tools)
const provider = request.model.provider const provider = request.model.provider
const baseURL = request.model.route.endpoint.baseURL const baseURL = request.model.route.endpoint.baseURL
const detectedMaxTokensField = detectMaxTokensField(provider, baseURL) const detectedMaxTokensField = detectMaxTokensField(provider, baseURL)
@ -883,18 +891,18 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (
const zaiToolStream = const zaiToolStream =
request.model.compatibility?.zaiToolStream ?? detectZaiToolStream(provider, baseURL, request.model.id) request.model.compatibility?.zaiToolStream ?? detectZaiToolStream(provider, baseURL, request.model.id)
const hasHistory = hasToolHistory(request.messages) const hasHistory = hasToolHistory(request.messages)
const hasActiveTools = flattened.tools.length > 0 const hasActiveTools = definitions.length > 0
const custom = OpenAIFreeform.tools(request) const custom = OpenAIFreeform.tools(request)
const lowering = { ...options, cacheControl: options.cacheControl ?? declaredCacheControl(request), custom } const lowering = { ...options, cacheControl: options.cacheControl ?? declaredCacheControl(request), custom }
return { return {
model: request.model.id, model: request.model.id,
messages: yield* lowerMessages(flattened.request, lowering), messages: yield* lowerMessages(request, lowering),
tools: tools:
flattened.tools.length === 0 definitions.length === 0
? hasHistory ? hasHistory
? [] ? []
: undefined : undefined
: flattened.tools.map((tool) => lowerTool(tool, lowering, supportsStrictMode, custom.get(tool.name))), : definitions.map((tool) => lowerTool(tool, lowering, supportsStrictMode, custom.get(tool.name))),
tool_choice: hasActiveTools && request.toolChoice ? yield* lowerToolChoice(request.toolChoice, custom) : undefined, tool_choice: hasActiveTools && request.toolChoice ? yield* lowerToolChoice(request.toolChoice, custom) : undefined,
stream: true as const, stream: true as const,
...((request.model.capabilities?.streamUsage ?? true) ? { stream_options: { include_usage: true } } : {}), ...((request.model.capabilities?.streamUsage ?? true) ? { stream_options: { include_usage: true } } : {}),
@ -942,8 +950,12 @@ const mapFinishReason = Effect.fnUntraced(function* (event: OpenAIChatEvent, rea
case "end": case "end":
return "stop" as const return "stop" as const
case "length": case "length":
// Z.AI stops with this when the prompt plus the generated output fill the context window.
case "model_context_window_exceeded":
return "length" as const return "length" as const
case "content_filter": case "content_filter":
// Z.AI ends a response its safety review blocked with "sensitive".
case "sensitive":
return "content-filter" as const return "content-filter" as const
case "function_call": case "function_call":
case "tool_calls": case "tool_calls":
@ -1283,7 +1295,7 @@ const step = (state: ParserState, event: OpenAIChatEvent) =>
!incompleteTools && !incompleteTools &&
state.finishReason === undefined && state.finishReason === undefined &&
Object.keys(tools).length > 0 Object.keys(tools).length > 0
? yield* finishTools(tools, customCalls) ? yield* finishTools(state, tools, customCalls)
: undefined : undefined
return [ return [
@ -1312,8 +1324,12 @@ const step = (state: ParserState, event: OpenAIChatEvent) =>
}) })
// Custom calls close their JSON fragment before every pending call finishes. // Custom calls close their JSON fragment before every pending call finishes.
const finishTools = Effect.fnUntraced(function* (tools: ParserState["tools"], customCalls: ReadonlySet<number>) { const finishTools = Effect.fnUntraced(function* (
const closed = OpenAIFreeform.close(tools, customCalls) state: ParserState,
tools: ParserState["tools"],
customCalls: ReadonlySet<number>,
) {
const closed = OpenAIFreeform.close(tools, customCalls, state.custom, state.providerMetadataKey)
const finished = yield* ToolStream.finishAll(ADAPTER, closed.tools) const finished = yield* ToolStream.finishAll(ADAPTER, closed.tools)
return { tools: finished.tools, events: [...closed.events, ...finished.events] } return { tools: finished.tools, events: [...closed.events, ...finished.events] }
}) })
@ -1330,7 +1346,7 @@ export const finishEvents = Effect.fnUntraced(function* (state: ParserState) {
const events: LLMEvent[] = [] const events: LLMEvent[] = []
const toolCallEvents = const toolCallEvents =
state.finishReason === undefined && Object.keys(state.tools).length > 0 state.finishReason === undefined && Object.keys(state.tools).length > 0
? (yield* finishTools(state.tools, state.customCalls)).events ? (yield* finishTools(state, state.tools, state.customCalls)).events
: state.toolCallEvents : state.toolCallEvents
const hasToolCalls = toolCallEvents.length > 0 const hasToolCalls = toolCallEvents.length > 0
const reason = state.finishReason const reason = state.finishReason

Some files were not shown because too many files have changed in this diff Show more