Skip to content

Commit 69a465d

Browse files
authored
feat: adopt drive and TUI catalog (#42133)
1 parent 66c2967 commit 69a465d

438 files changed

Lines changed: 41869 additions & 1110 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: deploy-lab-catalog
2+
3+
on:
4+
push:
5+
branches: [v2]
6+
paths:
7+
- ".github/workflows/deploy-lab-catalog.yml"
8+
- "bun.lock"
9+
- "package.json"
10+
- "packages/drive/**"
11+
- "packages/protocol/src/simulation.ts"
12+
- "packages/simulation/**"
13+
- "packages/lab/catalog/**"
14+
workflow_dispatch:
15+
16+
concurrency:
17+
group: deploy-lab-catalog-${{ github.ref_name }}
18+
cancel-in-progress: false
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
deploy:
25+
if: github.repository == 'anomalyco/opencode' && github.ref_name == 'v2'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
29+
30+
- uses: ./.github/actions/setup-bun
31+
32+
- name: Install ffmpeg
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install --yes ffmpeg
36+
37+
- name: Validate
38+
run: |
39+
bun --cwd packages/protocol typecheck
40+
bun --cwd packages/simulation typecheck
41+
bun --cwd packages/drive run check
42+
bun --cwd packages/drive run test
43+
bun --cwd packages/lab/catalog run check
44+
45+
- name: Deploy
46+
working-directory: packages/lab/catalog
47+
run: bun run deploy
48+
env:
49+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

‎.github/workflows/test.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ jobs:
5555
git config --global user.email "bot@opencode.ai"
5656
git config --global user.name "opencode"
5757
58+
- name: Install ffmpeg
59+
if: runner.os == 'Linux'
60+
run: |
61+
sudo apt-get update
62+
sudo apt-get install --yes ffmpeg
63+
5864
- name: Cache Turbo
5965
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
6066
with:
@@ -66,7 +72,7 @@ jobs:
6672
6773
- name: Run unit tests
6874
timeout-minutes: 20
69-
run: GITHUB_ACTIONS=false bun turbo test
75+
run: GITHUB_ACTIONS=false bun turbo test ${{ runner.os == 'Windows' && '--filter=!opencode-drive' || '' }}
7076
env:
7177
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
7278

‎.opencode/skills/opencode-drive/SKILL.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ files. If the script is unsuccessful, automatically fix the script and run it ag
5151
Scripts use one typed definition object. `setup` runs before OpenCode starts,
5252
and `fs.writeFile` always writes inside the simulated project.
5353

54-
You can read the full typed API here: https://raw.githubusercontent.com/jlongster/opencode-drive/refs/heads/main/src/script/types.ts
54+
You can read the full typed API here: https://raw.githubusercontent.com/anomalyco/opencode/v2/packages/drive/src/script/types.ts
5555

5656
```ts
5757
import { defineScript } from "opencode-drive"
@@ -83,7 +83,7 @@ itself (this is extremely rare, do not use this unless explicitly asked). In thi
8383
mode `ui` is typed as `null`; call `server.launch()` exactly
8484
once before launching clients. Each `clients.launch(name)` result provides the
8585
same UI methods as the automatic client. You can see an example of this API
86-
here: https://raw.githubusercontent.com/jlongster/opencode-drive/refs/heads/main/examples/multiple-clients.ts
86+
here: https://raw.githubusercontent.com/anomalyco/opencode/v2/packages/drive/examples/multiple-clients.ts
8787

8888
Use the exported `wait(milliseconds)` utility for an unconditional delay.
8989

@@ -114,8 +114,8 @@ completion are automatic.
114114

115115
You can see some example scripts here:
116116

117-
- https://raw.githubusercontent.com/jlongster/opencode-drive/refs/heads/main/examples/simple.ts
118-
- https://raw.githubusercontent.com/jlongster/opencode-drive/refs/heads/main/examples/serve.ts
117+
- https://raw.githubusercontent.com/anomalyco/opencode/v2/packages/drive/examples/simple.ts
118+
- https://raw.githubusercontent.com/anomalyco/opencode/v2/packages/drive/examples/serve.ts
119119

120120
## Prune
121121

‎bun.lock‎

Lines changed: 855 additions & 544 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"packages": [
3434
"packages/*",
3535
"packages/console/*",
36+
"packages/lab/*",
3637
"packages/stats/*",
3738
"packages/slack"
3839
],
@@ -120,7 +121,8 @@
120121
"prettier": "3.6.2",
121122
"semver": "^7.6.0",
122123
"sst": "catalog:",
123-
"turbo": "2.10.2"
124+
"turbo": "2.10.2",
125+
"vitest": "4.1.10"
124126
},
125127
"dependencies": {
126128
"@aws-sdk/client-s3": "3.933.0",

‎packages/drive/CHANGELOG.md‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# opencode-drive
2+
3+
## 1.4.3
4+
5+
### Patch Changes
6+
7+
- 99561ad: Restore controlled tools against the current V2 plugin API and add typed runtime control for write calls.
8+
9+
## 1.4.2
10+
11+
### Patch Changes
12+
13+
- b524213: Render light box-drawing borders as continuous geometric primitives.
14+
- a24a09d: Defer recording font initialization so source-checkout scripts can start without loading a duplicate renderer.
15+
16+
## 1.4.1
17+
18+
### Patch Changes
19+
20+
- 6a8d52b: Prevent concurrent detached launchers from stealing prepared instance ownership and spawning competing daemon processes.
21+
- d71356f: Restore compatibility with current OpenCode V2 checkouts and packed Drive installations. Drive now uses V2's built-in simulation transport and provider shape, isolates scripted service ports and command forms, and compiles standalone scripts against the launching Drive toolchain without package installation or source-directory links.
22+
23+
## 1.4.0
24+
25+
### Minor Changes
26+
27+
- c20d147: Control arbitrary provider-backed tool lifecycles with dynamic registration, structured progress, success, failure, cancellation, and reconnect-safe replay.
28+
29+
## 1.3.0
30+
31+
### Minor Changes
32+
33+
- 7caebeb: Expose semantic UI snapshots, exact semantic node polling, and safe semantic-node clicks for compatible OpenCode endpoints.
34+
35+
## 1.2.0
36+
37+
### Minor Changes
38+
39+
- 4e0c002: Write screenshots and recordings beneath run- and restart-scoped media directories so named outputs cannot overwrite earlier runs.
40+
41+
## 1.1.0
42+
43+
### Minor Changes
44+
45+
- fad9f96: Allow scripts and library drivers to intercept declared tools and control concurrent invocations by call ID at runtime.
46+
47+
### Patch Changes
48+
49+
- 63d3464: Keep service and progress output out of visible TUI sessions and avoid reinstalling the OpenTUI preload package for development checkouts.
50+
- fd45cfe: Allow Drive runs to select a durable OpenCode database with the Effect-configured `OPENCODE_DRIVE_DB` setting while retaining `:memory:` as the default.
51+
- e66adc1: Preserve recorded frame timing during MP4 encoding and reduce work for dense or unchanged terminal output.
52+
- e7dff5f: Render diagonal quadrant block glyphs as exact terminal cell geometry in screenshots, recordings, and catalog frames.
53+
- 63d3464: Export recordings at 60 FPS by default and preserve the requested frame rate in generated MP4 files.
54+
55+
## 1.0.0
56+
57+
### Major Changes
58+
59+
- 1009394: Remove the Promise-based simulation clients. `SimulationClient`, `BackendSimulationClient`, `connectSimulation`, and `connectBackendSimulation` are gone, along with the `opencode-drive/experimental` entry point. The `opencode-drive/client` entry now exports only the canonical protocol schemas and default ports; the public API is Effect-only, as documented. The CLI drives instances through the Effect `SimulationConnector` directly.
60+
61+
### Minor Changes
62+
63+
- 9deab8d: Add the browser-safe `opencode-drive/frame` entry point: canonical cell geometry, OpenTUI text-attribute bits, the geometric block/bar glyph table, and baseline placement shared by the Drive PNG renderer and downstream canvas renderers. The PNG renderer now also draws the `┃` and `╹` structural bars geometrically instead of with fonts.
64+
65+
### Patch Changes
66+
67+
- 8481090: Settle simulated LLM responses cleanly when OpenCode terminates an invocation during interruption. Drive now uses the negotiated `llm.pending` capability to distinguish external termination from genuine response write failures.
68+
69+
## 0.6.0
70+
71+
### Minor Changes
72+
73+
- 58c4801: Return simulated background shells immediately, continue their handlers asynchronously, notify the session when they finish, and cancel them when Drive shuts down.
74+
- b5e8dfe: Make the script API Effect-only. Script setup and run callbacks, UI, LLM, filesystem, server, and TUI operations now return Effects; LLM serve handlers return Streams; and script cancellation uses Effect interruption without a Promise compatibility shim.
75+
- 775f799: Remove the tool handler `AbortSignal`. Foreground session interruption, transport disconnects, and Drive shutdown now surface uniformly as Effect interruption, and controller shutdown awaits handler finalizers. Detached background shell handlers remain active after launch and are interrupted during Drive shutdown.
76+
- 8e51796: Add deterministic shell, web fetch, and web search handlers with progress, success, failure, and interruption simulation.
77+
- 905f846: Add `opencode-drive script init` for generating an Effect-native starter script and show focused migration guidance when `check` finds Promise-style script callbacks.
78+
- d1bba54: Add first-class tool call input streaming through `Llm.toolCall` stream options.
79+
- 72f7aff: Expose the authenticated generated OpenCode SDK as `opencode` to drivers and scripts.
80+
- 37b4cd1: Give capabilities precise typed errors, validate UI predicates in canonical `ui.waitFor`, expose concrete failures through `Errors`, and keep pure response constructors exclusively under `Llm`.
81+
- 13ec474: Unify the Effect driver and `defineScript` around one canonical programmatic model. Both expose the generated SDK as `opencode`, the primary frontend as `tui`, additional frontends through `tuis`, and the primary UI as `ui`. Every `Tui` has the same `{ ui, close, recording }` shape and `{ recording, viewport }` options. Project setup now uses the shared `Project`, `Setup`, `SetupContext`, and `ProjectFileSystem` types. Remove duplicate script UI types, flattened frontend handles, partial settlement controls, root-level raw simulation exports, convenience CLI aliases, and the `wait` helper.
82+
83+
### Patch Changes
84+
85+
- c8f5b51: Attach one best-effort normalized terminal frame to UI polling timeout errors without retaining screenshot artifacts.
86+
- c8f5b51: Render OpenCode's full UI symbol set with deterministic bundled fallback fonts instead of platform fonts or hand-drawn symbol exceptions.
87+
- c8f5b51: Preserve the managed driver's `Scope.Scope` requirement when consumed from TypeScript workspace applications.
88+
- 40d2241: Render the background completion arrow correctly in exported recordings.
89+
- 11cbbfd: Preserve the canonical OpenCode UI command shapes for optional named screenshots and key presses.

‎packages/drive/LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 opencode-drive
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)