@@ -32,9 +32,7 @@ export in an isolated Bun process:
3232// drive.ts
3333import { OpenCodeDriver } from " opencode-drive"
3434
35- export default OpenCodeDriver .use (({ ui }) =>
36- ui .screenshot (" home" ),
37- )
35+ export default OpenCodeDriver .use (({ ui }) => ui .screenshot (" home" ))
3836```
3937
4038``` sh
@@ -75,17 +73,20 @@ artifact and recording paths, retention, and the negotiated or legacy
7573compatibility of every simulation endpoint:
7674
7775``` ts
78- const result = yield * OpenCodeDriver .useReport (options , program )
79- yield * Effect .log (result .report )
76+ const result = yield * OpenCodeDriver .useReport (options , program )
77+ yield * Effect .log (result .report )
8078```
8179
8280Drive prefers ` simulation.handshake ` and explicitly records legacy fallback.
8381Require negotiation when protocol skew must fail before the program runs:
8482
8583``` ts
86- OpenCodeDriver .use ({
87- opencode: { compatibility: " required" },
88- }, program )
84+ OpenCodeDriver .use (
85+ {
86+ opencode: { compatibility: " required" },
87+ },
88+ program ,
89+ )
8990```
9091
9192Additional TUIs share the same server and LLM controller:
@@ -110,8 +111,8 @@ processes are `tui` and `tuis`. This keeps SDK calls distinct from terminal UI
110111control:
111112
112113``` ts
113- const health = yield * opencode .health .get ()
114- const frame = yield * tui .ui .capture ()
114+ const health = yield * opencode .health .get ()
115+ const frame = yield * tui .ui .capture ()
115116```
116117
117118Enable recording per TUI. Settlement finishes each timeline and exports its
@@ -121,15 +122,11 @@ video automatically:
121122import { Effect } from " effect"
122123import { OpenCodeDriver } from " opencode-drive"
123124
124- export default OpenCodeDriver .use (
125- { tui: { recording: true } },
126- (oc ) =>
127- Effect .gen (function * () {
128- yield * oc .ui .screenshot (" recorded-home" )
129- yield * Effect .log (
130- ` recording will be exported to ${oc .tui .recording ?.path } ` ,
131- )
132- }),
125+ export default OpenCodeDriver .use ({ tui: { recording: true } }, (oc ) =>
126+ Effect .gen (function * () {
127+ yield * oc .ui .screenshot (" recorded-home" )
128+ yield * Effect .log (` recording will be exported to ${oc .tui .recording ?.path } ` )
129+ }),
133130)
134131```
135132
@@ -446,9 +443,9 @@ processes and compiled script artifacts are cleaned up when the script ends.
446443Pass ` { recording: true } ` to record an individual TUI:
447444
448445``` ts
449- const alice = yield * tuis .launch (" alice" , { recording: true })
450- yield * alice .ui .submit (" Hello" )
451- yield * alice .close ()
446+ const alice = yield * tuis .launch (" alice" , { recording: true })
447+ yield * alice .ui .submit (" Hello" )
448+ yield * alice .close ()
452449```
453450
454451Recordings are exported when the script settles. Call
@@ -459,8 +456,8 @@ consume `llm.queue`, `llm.send`, or `llm.serve` responses. Manual-launch
459456scripts can customize them before starting the server:
460457
461458``` ts
462- yield * llm .title (() => Effect .succeed (" Custom title" ))
463- yield * server .launch ()
459+ yield * llm .title (() => Effect .succeed (" Custom title" ))
460+ yield * server .launch ()
464461```
465462
466463Use ` yield* llm.send(...) ` to wait for and complete the next request or `yield*
@@ -471,9 +468,7 @@ the handler passed to `llm.serve` returns an Effect `Stream`:
471468import { Stream } from " effect"
472469import { Llm } from " opencode-drive"
473470
474- yield * llm .serve ((_request , index ) =>
475- Stream .make (Llm .text (` Response ${index + 1 } ` )),
476- )
471+ yield * llm .serve ((_request , index ) => Stream .make (Llm .text (` Response ${index + 1 } ` )))
477472```
478473
479474The backend connection, default ` finish("stop") ` , and cleanup are automatic.
@@ -521,14 +516,16 @@ component-owned state, and a transient element handle that `ui.click()` can
521516resolve safely:
522517
523518``` ts
524- const allow = yield * ui .getNode ({
525- role: " option" ,
526- label: " Allow once" ,
527- selected: true ,
528- disabled: false ,
529- })
519+ const allow =
520+ yield *
521+ ui .getNode ({
522+ role: " option" ,
523+ label: " Allow once" ,
524+ selected: true ,
525+ disabled: false ,
526+ })
530527
531- yield * ui .click (allow )
528+ yield * ui .click (allow )
532529```
533530
534531` ui.snapshot ` and atomic semantic clicks are negotiated as optional
@@ -550,14 +547,12 @@ leave `error.frame` undefined.
550547import { Effect } from " effect"
551548import { Errors } from " opencode-drive"
552549
553- yield * ui .getElement ({ editor: true }).pipe (
554- Effect .catchTag (" UiElementAmbiguousError" , (error ) =>
555- Effect .logWarning (` Matched ${error .count } editors ` ),
556- ),
557- )
550+ yield *
551+ ui
552+ .getElement ({ editor: true })
553+ .pipe (Effect .catchTag (" UiElementAmbiguousError" , (error ) => Effect .logWarning (` Matched ${error .count } editors ` )))
558554
559- const isFileSystemError = (error : unknown ) =>
560- error instanceof Errors .FileSystemError
555+ const isFileSystemError = (error : unknown ) => error instanceof Errors .FileSystemError
561556```
562557
563558## Release validation
0 commit comments