@oharness/engine 0.9.3 → 0.11.0
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/acp/claude.d.ts +34 -0
- package/dist/acp/claude.js +122 -0
- package/dist/acp/claude.js.map +1 -0
- package/dist/acp/client.d.ts +193 -0
- package/dist/acp/client.js +279 -0
- package/dist/acp/client.js.map +1 -0
- package/dist/acp/runner.d.ts +80 -0
- package/dist/acp/runner.js +159 -0
- package/dist/acp/runner.js.map +1 -0
- package/dist/agent/agent.d.ts +258 -2
- package/dist/agent/agent.js +1010 -53
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/background.d.ts +135 -0
- package/dist/agent/background.js +307 -0
- package/dist/agent/background.js.map +1 -0
- package/dist/agent/compaction.d.ts +7 -0
- package/dist/agent/compaction.js +11 -3
- package/dist/agent/compaction.js.map +1 -1
- package/dist/agent/goal.d.ts +36 -0
- package/dist/agent/goal.js +71 -0
- package/dist/agent/goal.js.map +1 -0
- package/dist/agent/hooks.js +6 -6
- package/dist/agent/hooks.js.map +1 -1
- package/dist/agent/permissions.d.ts +6 -0
- package/dist/agent/permissions.js +2 -1
- package/dist/agent/permissions.js.map +1 -1
- package/dist/agent/session.d.ts +38 -0
- package/dist/agent/session.js +91 -2
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/store.d.ts +25 -0
- package/dist/agent/store.js +21 -0
- package/dist/agent/store.js.map +1 -1
- package/dist/agent/subagent.d.ts +21 -0
- package/dist/agent/subagent.js +17 -1
- package/dist/agent/subagent.js.map +1 -1
- package/dist/agent/workspace.d.ts +9 -0
- package/dist/agent/workspace.js +59 -5
- package/dist/agent/workspace.js.map +1 -1
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/manager.d.ts +9 -0
- package/dist/auth/manager.js +71 -6
- package/dist/auth/manager.js.map +1 -1
- package/dist/auth/oauth.d.ts +33 -0
- package/dist/auth/oauth.js +59 -8
- package/dist/auth/oauth.js.map +1 -1
- package/dist/auth/providers/account.js +5 -4
- package/dist/auth/providers/account.js.map +1 -1
- package/dist/auth/providers/anthropic.d.ts +25 -5
- package/dist/auth/providers/anthropic.js +47 -6
- package/dist/auth/providers/anthropic.js.map +1 -1
- package/dist/auth/providers/chatgpt.d.ts +8 -0
- package/dist/auth/providers/chatgpt.js +180 -0
- package/dist/auth/providers/chatgpt.js.map +1 -0
- package/dist/auth/providers/openrouter.d.ts +2 -0
- package/dist/auth/providers/openrouter.js +101 -0
- package/dist/auth/providers/openrouter.js.map +1 -0
- package/dist/auth/types.d.ts +15 -0
- package/dist/auth/types.js.map +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/plugin.d.ts +6 -1
- package/dist/browser/plugin.js.map +1 -1
- package/dist/browser/session.d.ts +47 -0
- package/dist/browser/session.js +177 -2
- package/dist/browser/session.js.map +1 -1
- package/dist/browser/tools.js +142 -18
- package/dist/browser/tools.js.map +1 -1
- package/dist/computer/arbiter.d.ts +69 -0
- package/dist/computer/arbiter.js +128 -0
- package/dist/computer/arbiter.js.map +1 -0
- package/dist/computer/cua-driver.d.ts +174 -0
- package/dist/computer/cua-driver.js +597 -0
- package/dist/computer/cua-driver.js.map +1 -0
- package/dist/computer/helper-client.d.ts +80 -0
- package/dist/computer/helper-client.js +166 -0
- package/dist/computer/helper-client.js.map +1 -0
- package/dist/computer/index.d.ts +16 -0
- package/dist/computer/index.js +9 -0
- package/dist/computer/index.js.map +1 -0
- package/dist/computer/mode.d.ts +34 -0
- package/dist/computer/mode.js +52 -0
- package/dist/computer/mode.js.map +1 -0
- package/dist/computer/plugin.d.ts +24 -0
- package/dist/computer/plugin.js +17 -0
- package/dist/computer/plugin.js.map +1 -0
- package/dist/computer/policy.d.ts +29 -0
- package/dist/computer/policy.js +127 -0
- package/dist/computer/policy.js.map +1 -0
- package/dist/computer/session.d.ts +228 -0
- package/dist/computer/session.js +493 -0
- package/dist/computer/session.js.map +1 -0
- package/dist/computer/target.d.ts +206 -0
- package/dist/computer/target.js +31 -0
- package/dist/computer/target.js.map +1 -0
- package/dist/computer/tools.d.ts +8 -0
- package/dist/computer/tools.js +664 -0
- package/dist/computer/tools.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js.map +1 -1
- package/dist/core/tokens.js +4 -0
- package/dist/core/tokens.js.map +1 -1
- package/dist/core/types.d.ts +16 -1
- package/dist/core/types.js.map +1 -1
- package/dist/harness.d.ts +128 -1
- package/dist/harness.js +287 -30
- package/dist/harness.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/manager.d.ts +15 -0
- package/dist/mcp/manager.js +28 -1
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/transport.js +3 -0
- package/dist/mcp/transport.js.map +1 -1
- package/dist/providers/catalog.js +6 -0
- package/dist/providers/catalog.js.map +1 -1
- package/dist/providers/catalog.json +14 -3
- package/dist/providers/discovery.js +10 -2
- package/dist/providers/discovery.js.map +1 -1
- package/dist/providers/models-dev.d.ts +15 -0
- package/dist/providers/models-dev.js +15 -0
- package/dist/providers/models-dev.js.map +1 -1
- package/dist/providers/models-dev.json +114 -102
- package/dist/providers/piai.d.ts +54 -2
- package/dist/providers/piai.js +154 -9
- package/dist/providers/piai.js.map +1 -1
- package/dist/providers/registry.d.ts +16 -1
- package/dist/providers/registry.js +42 -11
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/types.d.ts +6 -0
- package/dist/providers/types.js.map +1 -1
- package/dist/runtime-plugins/builtin/studio.d.ts +7 -0
- package/dist/runtime-plugins/builtin/studio.js +69 -4
- package/dist/runtime-plugins/builtin/studio.js.map +1 -1
- package/dist/runtime-plugins/cloud-connector.js +5 -0
- package/dist/runtime-plugins/cloud-connector.js.map +1 -1
- package/dist/schedule/scheduler.d.ts +38 -0
- package/dist/schedule/scheduler.js +101 -1
- package/dist/schedule/scheduler.js.map +1 -1
- package/dist/tools/builtin/bash.d.ts +6 -0
- package/dist/tools/builtin/bash.js +8 -11
- package/dist/tools/builtin/bash.js.map +1 -1
- package/dist/tools/builtin/recall.js +4 -0
- package/dist/tools/builtin/recall.js.map +1 -1
- package/dist/tools/builtin/routine.d.ts +9 -0
- package/dist/tools/builtin/routine.js +23 -2
- package/dist/tools/builtin/routine.js.map +1 -1
- package/dist/tools/builtin/task-control.d.ts +21 -0
- package/dist/tools/builtin/task-control.js +120 -0
- package/dist/tools/builtin/task-control.js.map +1 -0
- package/dist/tools/builtin/task.js +50 -9
- package/dist/tools/builtin/task.js.map +1 -1
- package/dist/tools/builtin/todo.d.ts +1 -1
- package/dist/tools/builtin/worktree.d.ts +10 -0
- package/dist/tools/builtin/worktree.js +52 -0
- package/dist/tools/builtin/worktree.js.map +1 -0
- package/dist/tools/define.d.ts +4 -1
- package/dist/tools/define.js +2 -0
- package/dist/tools/define.js.map +1 -1
- package/dist/tools/types.d.ts +112 -0
- package/dist/tools/types.js.map +1 -1
- package/dist/util/shell.d.ts +30 -0
- package/dist/util/shell.js +70 -0
- package/dist/util/shell.js.map +1 -1
- package/dist/worktree/index.d.ts +109 -0
- package/dist/worktree/index.js +463 -0
- package/dist/worktree/index.js.map +1 -0
- package/package.json +3 -3
- package/skills/media-generation/SKILL.md +22 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { Logger } from "../util/logger.ts";
|
|
2
|
+
import { ComputerArbiter } from "./arbiter.ts";
|
|
3
|
+
import type { LeaseHolder } from "./arbiter.ts";
|
|
4
|
+
import type { ActionKind, ComputerTier, PolicyOptions } from "./policy.ts";
|
|
5
|
+
import type { ComputerEnableMode } from "./mode.ts";
|
|
6
|
+
import type { AppInfo, AxNode, ComputerPermissions, ComputerTarget, ComputerTargetFactory, DisplayInfo, HelperInfo, Rect, Shot, WindowInfo } from "./target.ts";
|
|
7
|
+
/**
|
|
8
|
+
* What the page and the overlay are told about each action, so the person can
|
|
9
|
+
* see where the agent is working without reading the transcript. Presentation
|
|
10
|
+
* only: nothing here goes to the model.
|
|
11
|
+
*/
|
|
12
|
+
export interface ComputerActionEvent {
|
|
13
|
+
sessionId: string;
|
|
14
|
+
label: string;
|
|
15
|
+
kind: "look" | "click" | "type" | "scroll" | "drag" | "key" | "control" | "release" | "idle";
|
|
16
|
+
window?: string;
|
|
17
|
+
app?: string;
|
|
18
|
+
/** Screen point the action lands on, when it has one. */
|
|
19
|
+
point?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
/** Whether that point is on screen and uncovered: the overlay draws the cursor only then. */
|
|
24
|
+
visible?: boolean;
|
|
25
|
+
/** Frame of the element acted on, for a ref action. */
|
|
26
|
+
frame?: Rect;
|
|
27
|
+
/** Where the window is on screen, so a live view can place the point inside it. */
|
|
28
|
+
windowFrame?: Rect;
|
|
29
|
+
/** The window's title, for the live view's heading. */
|
|
30
|
+
title?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* What the windows a turn worked in looked like when it ended, for the person
|
|
34
|
+
* reading the conversation back. Never model input: the agent works from the
|
|
35
|
+
* accessibility tree and takes its own screenshots when it needs one.
|
|
36
|
+
*/
|
|
37
|
+
export interface ComputerSnapshotEvent {
|
|
38
|
+
sessionId: string;
|
|
39
|
+
shots: {
|
|
40
|
+
window: string;
|
|
41
|
+
app: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
mimeType: string;
|
|
44
|
+
data: string;
|
|
45
|
+
}[];
|
|
46
|
+
}
|
|
47
|
+
export interface ComputerRuntimeOptions {
|
|
48
|
+
target: ComputerTargetFactory;
|
|
49
|
+
/**
|
|
50
|
+
* Capture one window for the person, outside the platform layer. The host
|
|
51
|
+
* does this, not the target: a target screenshot replaces the snapshot the
|
|
52
|
+
* agent's element refs belong to, and a picture for the transcript must not
|
|
53
|
+
* cost the agent its refs. Without it, turns end with no snapshot.
|
|
54
|
+
*/
|
|
55
|
+
snapshot?: (window: string) => Promise<{
|
|
56
|
+
mimeType: string;
|
|
57
|
+
data: string;
|
|
58
|
+
} | undefined>;
|
|
59
|
+
/** Pids of the host app itself; its windows are never listed or driven. */
|
|
60
|
+
selfPids?: () => number[];
|
|
61
|
+
policy?: () => PolicyOptions;
|
|
62
|
+
/** `never` keeps the agent in the background: take_control is refused. */
|
|
63
|
+
takeover?: () => "ask" | "never";
|
|
64
|
+
/** Whether `computer_enable` asks first, goes straight through, or is gone. Absent is `ask`. */
|
|
65
|
+
enable?: () => ComputerEnableMode;
|
|
66
|
+
arbiter?: ComputerArbiter;
|
|
67
|
+
logger?: Logger;
|
|
68
|
+
/**
|
|
69
|
+
* Read the OS grants from the host app itself, live. Preferred over asking
|
|
70
|
+
* the helper: macOS caches a process's Accessibility answer, so a helper
|
|
71
|
+
* started before the grant keeps saying no after the person said yes.
|
|
72
|
+
*/
|
|
73
|
+
permissions?: () => Promise<ComputerPermissions>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* What every conversation shares: one helper process, one arbiter.
|
|
77
|
+
*
|
|
78
|
+
* The helper starts on the first call that needs it — registered eagerly,
|
|
79
|
+
* launched lazily, the same rule as the browser — and is restarted on the next
|
|
80
|
+
* call if it dies.
|
|
81
|
+
*/
|
|
82
|
+
export declare class ComputerRuntime {
|
|
83
|
+
readonly arbiter: ComputerArbiter;
|
|
84
|
+
private readonly opts;
|
|
85
|
+
private starting?;
|
|
86
|
+
private helperInfo?;
|
|
87
|
+
private readonly observers;
|
|
88
|
+
private readonly snapshotObservers;
|
|
89
|
+
private readonly enableObservers;
|
|
90
|
+
constructor(opts: ComputerRuntimeOptions);
|
|
91
|
+
target(): Promise<ComputerTarget>;
|
|
92
|
+
/** Forget a dead helper so the next call starts a fresh one. */
|
|
93
|
+
reset(): void;
|
|
94
|
+
info(): Promise<HelperInfo>;
|
|
95
|
+
private granted?;
|
|
96
|
+
permissions(): Promise<ComputerPermissions>;
|
|
97
|
+
requestPermissions(grant?: keyof ComputerPermissions): Promise<void>;
|
|
98
|
+
selfPids(): Set<number>;
|
|
99
|
+
policy(): PolicyOptions;
|
|
100
|
+
takeover(): "ask" | "never";
|
|
101
|
+
enableMode(): ComputerEnableMode;
|
|
102
|
+
/**
|
|
103
|
+
* A conversation's agent switched Computer use on. The + menu tells the
|
|
104
|
+
* server itself; this is how the server hears of the other way, to save the
|
|
105
|
+
* conversation and show the chip and the permission card.
|
|
106
|
+
*/
|
|
107
|
+
onEnabled(listener: (sessionId: string) => void): () => void;
|
|
108
|
+
emitEnabled(sessionId: string): void;
|
|
109
|
+
onAction(listener: (event: ComputerActionEvent) => void): () => void;
|
|
110
|
+
emit(event: ComputerActionEvent): void;
|
|
111
|
+
canSnapshot(): boolean;
|
|
112
|
+
snapshot(window: string): Promise<{
|
|
113
|
+
mimeType: string;
|
|
114
|
+
data: string;
|
|
115
|
+
} | undefined>;
|
|
116
|
+
onSnapshot(listener: (event: ComputerSnapshotEvent) => void): () => void;
|
|
117
|
+
emitSnapshot(event: ComputerSnapshotEvent): void;
|
|
118
|
+
close(): Promise<void>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* One conversation's view of the computer.
|
|
122
|
+
*
|
|
123
|
+
* Holds what only makes sense per conversation: the apps and windows it has
|
|
124
|
+
* seen (so a permission prompt can name an app synchronously), the geometry of
|
|
125
|
+
* the screenshots it was shown (so its coordinates can be mapped back), and
|
|
126
|
+
* the window it last worked in.
|
|
127
|
+
*/
|
|
128
|
+
export declare class ComputerUseSession {
|
|
129
|
+
readonly runtime: ComputerRuntime;
|
|
130
|
+
private sessionId;
|
|
131
|
+
private label;
|
|
132
|
+
private readonly apps;
|
|
133
|
+
private readonly windowsById;
|
|
134
|
+
private readonly shots;
|
|
135
|
+
private readonly secureRefs;
|
|
136
|
+
/**
|
|
137
|
+
* The windows this turn worked in, in the order last used, each with the
|
|
138
|
+
* agent's own screenshot of it while that is still how it looks. Each gets
|
|
139
|
+
* one picture under the reply when the turn ends: that screenshot when there
|
|
140
|
+
* is one, else a capture. The screenshot sits folded inside its tool card,
|
|
141
|
+
* where nobody reading the reply sees it, and reusing it costs no capture —
|
|
142
|
+
* so a host without Screen Recording still shows what the agent saw.
|
|
143
|
+
*/
|
|
144
|
+
private readonly unseen;
|
|
145
|
+
private readonly refFrames;
|
|
146
|
+
private currentWindow?;
|
|
147
|
+
constructor(runtime: ComputerRuntime, sessionId?: string);
|
|
148
|
+
bind(sessionId: string): void;
|
|
149
|
+
setLabel(label: () => string | undefined): void;
|
|
150
|
+
holder(): LeaseHolder;
|
|
151
|
+
get id(): string;
|
|
152
|
+
listApps(): Promise<AppInfo[]>;
|
|
153
|
+
listWindows(pid?: number): Promise<WindowInfo[]>;
|
|
154
|
+
private rememberApp;
|
|
155
|
+
/**
|
|
156
|
+
* The app a call names, synchronously, for the permission prompt.
|
|
157
|
+
*
|
|
158
|
+
* From what this conversation has already seen; an app it has not listed
|
|
159
|
+
* yet is named as the model wrote it, which still scopes the approval to
|
|
160
|
+
* one app.
|
|
161
|
+
*/
|
|
162
|
+
appIdFor(input: {
|
|
163
|
+
app?: string;
|
|
164
|
+
window?: string;
|
|
165
|
+
ref?: string;
|
|
166
|
+
}): string | undefined;
|
|
167
|
+
/** Find the window a call means: by ref, by id, by app, or the last one used. */
|
|
168
|
+
resolveWindow(input: {
|
|
169
|
+
app?: string;
|
|
170
|
+
window?: string;
|
|
171
|
+
ref?: string;
|
|
172
|
+
}): Promise<WindowInfo>;
|
|
173
|
+
tierOf(window: WindowInfo): ComputerTier;
|
|
174
|
+
/**
|
|
175
|
+
* Everything that has to hold before touching a window: it is not ours,
|
|
176
|
+
* its tier allows this kind of action, and no other conversation has it.
|
|
177
|
+
*/
|
|
178
|
+
guard(window: WindowInfo, kind: ActionKind): void;
|
|
179
|
+
/**
|
|
180
|
+
* Stay off a window the person is using right now.
|
|
181
|
+
*
|
|
182
|
+
* Their front window with input in the last few seconds is theirs: the
|
|
183
|
+
* lease on it lapses and the call is refused. Pointer-free actions on other
|
|
184
|
+
* windows go ahead regardless.
|
|
185
|
+
*/
|
|
186
|
+
respectUser(window: WindowInfo, target: ComputerTarget): Promise<void>;
|
|
187
|
+
/** Keys wait until the person has stopped typing, up to a limit. */
|
|
188
|
+
waitForQuiet(target: ComputerTarget, signal?: AbortSignal, quietMs?: number, maxMs?: number): Promise<void>;
|
|
189
|
+
rememberShot(key: string, shot: Shot): void;
|
|
190
|
+
/**
|
|
191
|
+
* A rectangle `[x0, y0, x1, y1]` in the last screenshot under `key` (a
|
|
192
|
+
* window id, or `display:<id>`), on screen. Clipped to the screenshot, so a
|
|
193
|
+
* region drawn a little past its edge still means its edge.
|
|
194
|
+
*/
|
|
195
|
+
regionToScreen(key: string, what: string, region: readonly number[]): Rect;
|
|
196
|
+
/** Screen rect → `[x0, y0, x1, y1]` in the last screenshot under `key`, rounded. */
|
|
197
|
+
screenToRegion(key: string, rect: Rect): number[] | undefined;
|
|
198
|
+
/** The monitors, primary first; empty when the layer cannot say. */
|
|
199
|
+
listDisplays(): Promise<DisplayInfo[]>;
|
|
200
|
+
/** A display by id or by name, as the model wrote it. */
|
|
201
|
+
resolveDisplay(wanted: string): Promise<DisplayInfo | undefined>;
|
|
202
|
+
/**
|
|
203
|
+
* Map a point in the last screenshot of `window` back to the screen.
|
|
204
|
+
*
|
|
205
|
+
* The model only ever sees image pixels. Retina, per-monitor DPI and the
|
|
206
|
+
* downscale to fit the image budget are all folded into the screenshot's own
|
|
207
|
+
* frame, so none of them reach the model.
|
|
208
|
+
*/
|
|
209
|
+
toScreen(window: WindowInfo, x: number, y: number): {
|
|
210
|
+
x: number;
|
|
211
|
+
y: number;
|
|
212
|
+
};
|
|
213
|
+
rememberTree(nodes: AxNode[]): void;
|
|
214
|
+
isSecure(ref: string): boolean;
|
|
215
|
+
frameOf(ref: string): Rect | undefined;
|
|
216
|
+
announce(event: Omit<ComputerActionEvent, "sessionId" | "label">, target?: ComputerTarget): Promise<void>;
|
|
217
|
+
/** The agent's own screenshot of this window: its state, until the next action on it. */
|
|
218
|
+
sawWindow(window: string, shot?: {
|
|
219
|
+
mimeType: string;
|
|
220
|
+
data: string;
|
|
221
|
+
}): void;
|
|
222
|
+
/** The turn ended: let go of windows and control, so others need not wait out the lease. */
|
|
223
|
+
endTurn(): void;
|
|
224
|
+
private snapshotTurn;
|
|
225
|
+
close(): Promise<void>;
|
|
226
|
+
}
|
|
227
|
+
/** Refs look like `w<window>.<n>`; the window id is everything between. */
|
|
228
|
+
export declare function windowOfRef(ref: string): string | undefined;
|