Skip to content

Commit 9dd0e39

Browse files
chore: generate
1 parent 69a465d commit 9dd0e39

357 files changed

Lines changed: 113259 additions & 7411 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.

‎packages/drive/README.md‎

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ export in an isolated Bun process:
3232
// drive.ts
3333
import { 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
7573
compatibility 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

8280
Drive prefers `simulation.handshake` and explicitly records legacy fallback.
8381
Require 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

9192
Additional 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
110111
control:
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

117118
Enable recording per TUI. Settlement finishes each timeline and exports its
@@ -121,15 +122,11 @@ video automatically:
121122
import { Effect } from "effect"
122123
import { 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.
446443
Pass `{ 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

454451
Recordings are exported when the script settles. Call
@@ -459,8 +456,8 @@ consume `llm.queue`, `llm.send`, or `llm.serve` responses. Manual-launch
459456
scripts 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

466463
Use `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`:
471468
import { Stream } from "effect"
472469
import { 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

479474
The 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
521516
resolve 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.
550547
import { Effect } from "effect"
551548
import { 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
Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,19 @@
11
import * as Effect from "effect/Effect"
22
import { OpenCodeDriver, Tool } from "../src/index.js"
3-
import type {
4-
Frontend,
5-
Project,
6-
Tui,
7-
Tuis,
8-
Ui,
9-
} from "../src/index.js"
3+
import type { Frontend, Project, Tui, Tuis, Ui } from "../src/index.js"
104
import type { ScriptContext } from "../src/script/types.js"
115

126
type Equal<Left, Right> =
13-
(<Value>() => Value extends Left ? 1 : 2) extends
14-
(<Value>() => Value extends Right ? 1 : 2)
15-
? true
16-
: false
7+
(<Value>() => Value extends Left ? 1 : 2) extends <Value>() => Value extends Right ? 1 : 2 ? true : false
178

189
type Assert<Value extends true> = Value
1910

2011
export type ScriptUiIsCanonical = Assert<Equal<ScriptContext["ui"], Ui>>
21-
export type ScriptTuiIsCanonical = Assert<
22-
Equal<ScriptContext["tui"], Tui>
23-
>
24-
export type ScriptTuisAreCanonical = Assert<
25-
Equal<ScriptContext["tuis"], Tuis>
26-
>
27-
export type ScriptToolsAreCanonical = Assert<
28-
Equal<ScriptContext["tools"], Tool.Controls>
29-
>
30-
export type DriverToolsAreCanonical = Assert<
31-
Equal<OpenCodeDriver.Driver["tools"], Tool.Controls>
32-
>
33-
export type LaunchedTuiIsCanonical = Assert<
34-
Equal<Effect.Success<ReturnType<Tuis["launch"]>>, Tui>
35-
>
12+
export type ScriptTuiIsCanonical = Assert<Equal<ScriptContext["tui"], Tui>>
13+
export type ScriptTuisAreCanonical = Assert<Equal<ScriptContext["tuis"], Tuis>>
14+
export type ScriptToolsAreCanonical = Assert<Equal<ScriptContext["tools"], Tool.Controls>>
15+
export type DriverToolsAreCanonical = Assert<Equal<OpenCodeDriver.Driver["tools"], Tool.Controls>>
16+
export type LaunchedTuiIsCanonical = Assert<Equal<Effect.Success<ReturnType<Tuis["launch"]>>, Tui>>
3617
export type ResizeIsCanonicalAction = Assert<
3718
Equal<
3819
Extract<Frontend.Action, { readonly type: "ui.resize" }>,
@@ -43,14 +24,10 @@ export type ResizeIsCanonicalAction = Assert<
4324
}
4425
>
4526
>
46-
export type DriverProjectIsCanonical = Assert<
47-
Equal<NonNullable<OpenCodeDriver.Options["project"]>, Project>
48-
>
27+
export type DriverProjectIsCanonical = Assert<Equal<NonNullable<OpenCodeDriver.Options["project"]>, Project>>
4928

5029
const zeroConfig = OpenCodeDriver.use(() => Effect.void)
51-
export type ZeroConfigUseIsRunnable = Assert<
52-
Equal<Effect.Services<typeof zeroConfig>, never>
53-
>
30+
export type ZeroConfigUseIsRunnable = Assert<Equal<Effect.Services<typeof zeroConfig>, never>>
5431

5532
const controlledOptions: OpenCodeDriver.Options = { tools: ["shell"] }
5633
declare const controls: Tool.Controls
@@ -61,20 +38,9 @@ const dynamicCall = controls.take("call_lookup")
6138
declare const toolName: Tool.Name
6239
controls.control(toolName)
6340
export type ShellControlIsTyped = Assert<
64-
Equal<
65-
Effect.Success<typeof shellCalls>,
66-
Tool.ControlledCalls<Tool.ShellInput, Tool.ShellResult>
67-
>
68-
>
69-
export type DynamicAttachIsTyped = Assert<
70-
Equal<Effect.Success<typeof attached>, void>
71-
>
72-
export type DynamicCallIsTyped = Assert<
73-
Equal<Effect.Success<typeof dynamicCall>, Tool.Invocation>
74-
>
75-
const controlled = OpenCodeDriver.use(controlledOptions, ({ tools }) =>
76-
tools.control("shell").pipe(Effect.asVoid),
77-
)
78-
export type ControlledUseIsRunnable = Assert<
79-
Equal<Effect.Services<typeof controlled>, never>
41+
Equal<Effect.Success<typeof shellCalls>, Tool.ControlledCalls<Tool.ShellInput, Tool.ShellResult>>
8042
>
43+
export type DynamicAttachIsTyped = Assert<Equal<Effect.Success<typeof attached>, void>>
44+
export type DynamicCallIsTyped = Assert<Equal<Effect.Success<typeof dynamicCall>, Tool.Invocation>>
45+
const controlled = OpenCodeDriver.use(controlledOptions, ({ tools }) => tools.control("shell").pipe(Effect.asVoid))
46+
export type ControlledUseIsRunnable = Assert<Equal<Effect.Services<typeof controlled>, never>>

0 commit comments

Comments
 (0)