@opencode/simulation 2.0.32 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/frontend/actions.d.ts +14 -14
- package/dist/frontend/renderer.d.ts +1 -1
- package/dist/frontend/renderer.js +14 -3
- package/dist/frontend/semantics.d.ts +4 -2
- package/dist/frontend/server.d.ts +2 -2
- package/dist/frontend/simulation.d.ts +1 -1
- package/dist/frontend/simulation.js +2 -1
- package/package.json +9 -9
|
@@ -24,8 +24,8 @@ export declare function createHarness(renderer: CliRenderer): Harness;
|
|
|
24
24
|
export declare function elements(renderer: CliRenderer): Element[];
|
|
25
25
|
export declare function state(harness: Harness): {
|
|
26
26
|
focused: {
|
|
27
|
-
editor: boolean;
|
|
28
27
|
renderable?: number | undefined;
|
|
28
|
+
editor: boolean;
|
|
29
29
|
};
|
|
30
30
|
elements: SimulationProtocol.Frontend.Element[];
|
|
31
31
|
};
|
|
@@ -53,8 +53,8 @@ export declare const execute: (harness: Harness, action: {
|
|
|
53
53
|
readonly type: "ui.press";
|
|
54
54
|
readonly key: string;
|
|
55
55
|
readonly modifiers?: {
|
|
56
|
-
readonly shift?: boolean | undefined;
|
|
57
56
|
readonly ctrl?: boolean | undefined;
|
|
57
|
+
readonly shift?: boolean | undefined;
|
|
58
58
|
readonly meta?: boolean | undefined;
|
|
59
59
|
readonly super?: boolean | undefined;
|
|
60
60
|
readonly hyper?: boolean | undefined;
|
|
@@ -63,51 +63,51 @@ export declare const execute: (harness: Harness, action: {
|
|
|
63
63
|
readonly type: "ui.enter";
|
|
64
64
|
} | {
|
|
65
65
|
readonly type: "ui.arrow";
|
|
66
|
-
readonly direction: "down" | "
|
|
66
|
+
readonly direction: "down" | "left" | "right" | "up";
|
|
67
67
|
} | {
|
|
68
68
|
readonly type: "ui.focus";
|
|
69
69
|
readonly target: number;
|
|
70
70
|
} | {
|
|
71
71
|
readonly type: "ui.mouse";
|
|
72
72
|
readonly params: {
|
|
73
|
-
readonly action: "move";
|
|
74
73
|
readonly x: number;
|
|
75
74
|
readonly y: number;
|
|
76
75
|
readonly modifiers?: {
|
|
77
76
|
readonly shift?: boolean | undefined;
|
|
78
|
-
readonly ctrl?: boolean | undefined;
|
|
79
77
|
readonly alt?: boolean | undefined;
|
|
78
|
+
readonly ctrl?: boolean | undefined;
|
|
80
79
|
} | undefined;
|
|
80
|
+
readonly action: "move";
|
|
81
81
|
} | {
|
|
82
|
-
readonly action: "down" | "up";
|
|
83
82
|
readonly x: number;
|
|
84
83
|
readonly y: number;
|
|
85
84
|
readonly modifiers?: {
|
|
86
85
|
readonly shift?: boolean | undefined;
|
|
87
|
-
readonly ctrl?: boolean | undefined;
|
|
88
86
|
readonly alt?: boolean | undefined;
|
|
87
|
+
readonly ctrl?: boolean | undefined;
|
|
89
88
|
} | undefined;
|
|
89
|
+
readonly action: "down" | "up";
|
|
90
90
|
readonly button?: "left" | "middle" | "right" | undefined;
|
|
91
91
|
} | {
|
|
92
|
-
readonly action: "scroll";
|
|
93
92
|
readonly x: number;
|
|
94
93
|
readonly y: number;
|
|
95
|
-
readonly direction: "down" | "up" | "left" | "right";
|
|
96
94
|
readonly modifiers?: {
|
|
97
95
|
readonly shift?: boolean | undefined;
|
|
98
|
-
readonly ctrl?: boolean | undefined;
|
|
99
96
|
readonly alt?: boolean | undefined;
|
|
97
|
+
readonly ctrl?: boolean | undefined;
|
|
100
98
|
} | undefined;
|
|
99
|
+
readonly action: "scroll";
|
|
100
|
+
readonly direction: "down" | "left" | "right" | "up";
|
|
101
101
|
};
|
|
102
102
|
} | {
|
|
103
|
-
readonly x: number;
|
|
104
|
-
readonly y: number;
|
|
105
103
|
readonly type: "ui.click";
|
|
106
104
|
readonly target: number;
|
|
105
|
+
readonly x: number;
|
|
106
|
+
readonly y: number;
|
|
107
107
|
readonly semantic?: {
|
|
108
108
|
readonly id: string;
|
|
109
|
-
readonly element: number;
|
|
110
109
|
readonly instance?: string | undefined;
|
|
110
|
+
readonly element: number;
|
|
111
111
|
} | undefined;
|
|
112
112
|
} | {
|
|
113
113
|
readonly type: "ui.resize";
|
|
@@ -115,8 +115,8 @@ export declare const execute: (harness: Harness, action: {
|
|
|
115
115
|
readonly rows: number;
|
|
116
116
|
}) => Effect.Effect<{
|
|
117
117
|
focused: {
|
|
118
|
-
editor: boolean;
|
|
119
118
|
renderable?: number | undefined;
|
|
119
|
+
editor: boolean;
|
|
120
120
|
};
|
|
121
121
|
elements: SimulationProtocol.Frontend.Element[];
|
|
122
122
|
}, Error, never>;
|
|
@@ -16,5 +16,5 @@ export declare const create: (options: CliRendererConfig, path?: string | undefi
|
|
|
16
16
|
export declare function recordResize(renderer: CliRenderer, cols: number, rows: number): void;
|
|
17
17
|
export declare function recordPointer(renderer: CliRenderer, action: Pointer["action"], x: number, y: number): void;
|
|
18
18
|
export declare function setupFor(renderer: CliRenderer): TestRendererSetup | undefined;
|
|
19
|
-
export declare function finish(renderer: CliRenderer): Effect.Effect<
|
|
19
|
+
export declare function finish(renderer: CliRenderer): Effect.Effect<string, import("effect/Cause").UnknownError, never> | Effect.Effect<never, Error, never>;
|
|
20
20
|
export * as SimulationRenderer from "./renderer";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createTestRenderer } from "@opentui/core/testing";
|
|
2
|
+
import { Writable } from "node:stream";
|
|
2
3
|
import { Effect } from "effect";
|
|
3
4
|
import { Timeline } from "../recording";
|
|
4
5
|
const setups = new WeakMap, recordings = new WeakMap;
|
|
@@ -10,13 +11,19 @@ export const create = Effect.fn("SimulationRenderer.create")(function* (options,
|
|
|
10
11
|
height: rows,
|
|
11
12
|
kittyKeyboard: Boolean(options.useKittyKeyboard),
|
|
12
13
|
...recording ? {
|
|
13
|
-
stdout:
|
|
14
|
+
stdout: new Writable({
|
|
15
|
+
write(chunk, encoding, callback) {
|
|
16
|
+
recording.write(chunk, encoding, callback);
|
|
17
|
+
}
|
|
18
|
+
}),
|
|
14
19
|
bufferedOutput: "stdout"
|
|
15
20
|
} : {}
|
|
16
|
-
})), (setup) => Effect.
|
|
21
|
+
})), (setup) => Effect.promise(async () => {
|
|
17
22
|
if (!setup.renderer.isDestroyed)
|
|
18
23
|
setup.renderer.destroy();
|
|
24
|
+
await setup.renderer.closed;
|
|
19
25
|
}));
|
|
26
|
+
yield* Effect.tryPromise(() => setup.renderer.setupTerminal());
|
|
20
27
|
setups.set(setup.renderer, setup);
|
|
21
28
|
if (recording)
|
|
22
29
|
recordings.set(setup.renderer, recording);
|
|
@@ -35,7 +42,11 @@ export function finish(renderer) {
|
|
|
35
42
|
const recording = recordings.get(renderer);
|
|
36
43
|
if (!recording)
|
|
37
44
|
return Effect.fail(Error("UI recording is not available"));
|
|
38
|
-
return Effect.tryPromise(() =>
|
|
45
|
+
return Effect.tryPromise(async () => {
|
|
46
|
+
if (renderer.isDestroyed)
|
|
47
|
+
await renderer.closed;
|
|
48
|
+
return recording.finish();
|
|
49
|
+
});
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
export * as SimulationRenderer from "./renderer";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Renderable } from "@opentui/core";
|
|
2
2
|
import type { SimulationProtocol } from "../protocol";
|
|
3
3
|
export type Definition = Omit<SimulationProtocol.Frontend.SemanticNode, "id" | "element" | "parent">;
|
|
4
|
+
declare const bind: (definition: () => Definition) => (renderable: Renderable) => void;
|
|
4
5
|
export declare const read: (renderable: Renderable) => (() => Definition) | undefined;
|
|
5
6
|
export declare const SimulationSemantics: {
|
|
6
|
-
bind:
|
|
7
|
-
read:
|
|
7
|
+
bind: typeof bind;
|
|
8
|
+
read: typeof read;
|
|
8
9
|
};
|
|
10
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
export declare const start: (harness:
|
|
2
|
+
import { type Harness } from "./actions";
|
|
3
|
+
export declare const start: (harness: Harness, endpoint: string, version?: any) => Effect.Effect<{
|
|
4
4
|
url: string;
|
|
5
5
|
}, unknown, import("effect/Scope").Scope>;
|
|
6
6
|
export * as SimulationServer from "./server";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CliRendererConfig } from "@opentui/core";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
/** Drive-mode renderer and control-server acquisition. */
|
|
4
|
-
export declare const create: (options: CliRendererConfig, version: string) => Effect.Effect<import("@opentui/core").CliRenderer, unknown, import("effect/
|
|
4
|
+
export declare const create: (options: CliRendererConfig, version: string) => Effect.Effect<import("@opentui/core").CliRenderer, unknown, import("effect/FileSystem").FileSystem | import("effect/Scope").Scope>;
|
|
5
5
|
export * as Drive from "./simulation";
|
|
@@ -5,9 +5,10 @@ import { SimulationActions } from "./actions";
|
|
|
5
5
|
import { SimulationRenderer } from "./renderer";
|
|
6
6
|
import { SimulationServer } from "./server";
|
|
7
7
|
export const create = Effect.fn("Drive.create")(function* (options, version) {
|
|
8
|
-
const headless = (yield* Config.String("OPENCODE_DRIVE_RENDERER").pipe(Config.withDefault("visible"))) === "headless", manifest = yield* DriveManifest.resolve(), renderer = headless ? yield* SimulationRenderer.create(options, manifest.recording?.timeline, manifest.viewport) : yield* Effect.acquireRelease(Effect.tryPromise(() => createCliRenderer(options)), (renderer) => Effect.
|
|
8
|
+
const headless = (yield* Config.String("OPENCODE_DRIVE_RENDERER").pipe(Config.withDefault("visible"))) === "headless", manifest = yield* DriveManifest.resolve(), renderer = headless ? yield* SimulationRenderer.create(options, manifest.recording?.timeline, manifest.viewport) : yield* Effect.acquireRelease(Effect.tryPromise(() => createCliRenderer(options)), (renderer) => Effect.promise(async () => {
|
|
9
9
|
if (!renderer.isDestroyed)
|
|
10
10
|
renderer.destroy();
|
|
11
|
+
await renderer.closed;
|
|
11
12
|
}));
|
|
12
13
|
if (!headless && manifest.viewport)
|
|
13
14
|
renderer.resize(manifest.viewport.cols, manifest.viewport.rows);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode/simulation",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "bun run script/build.ts",
|
|
46
46
|
"test": "bun test --timeout 30000 --only-failures",
|
|
47
|
-
"typecheck": "
|
|
47
|
+
"typecheck": "tsc -b"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@opencode/core": "2.
|
|
51
|
-
"@opencode/ai": "2.
|
|
52
|
-
"@opencode/plugin": "2.
|
|
53
|
-
"@opencode/protocol": "2.
|
|
54
|
-
"@opencode/util": "2.
|
|
55
|
-
"@opentui/core": "0.
|
|
50
|
+
"@opencode/core": "2.1.1",
|
|
51
|
+
"@opencode/ai": "2.1.1",
|
|
52
|
+
"@opencode/plugin": "2.1.1",
|
|
53
|
+
"@opencode/protocol": "2.1.1",
|
|
54
|
+
"@opencode/util": "2.1.1",
|
|
55
|
+
"@opentui/core": "0.6.6",
|
|
56
56
|
"effect": "4.0.1",
|
|
57
57
|
"ws": "8.21.0"
|
|
58
58
|
},
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"@tsconfig/bun": "1.0.9",
|
|
61
61
|
"@types/bun": "1.4.0",
|
|
62
62
|
"@types/ws": "8.18.1",
|
|
63
|
-
"@typescript/native
|
|
63
|
+
"@typescript/native": "npm:typescript@7.0.2"
|
|
64
64
|
}
|
|
65
65
|
}
|