@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.
Files changed (170) hide show
  1. package/dist/acp/claude.d.ts +34 -0
  2. package/dist/acp/claude.js +122 -0
  3. package/dist/acp/claude.js.map +1 -0
  4. package/dist/acp/client.d.ts +193 -0
  5. package/dist/acp/client.js +279 -0
  6. package/dist/acp/client.js.map +1 -0
  7. package/dist/acp/runner.d.ts +80 -0
  8. package/dist/acp/runner.js +159 -0
  9. package/dist/acp/runner.js.map +1 -0
  10. package/dist/agent/agent.d.ts +258 -2
  11. package/dist/agent/agent.js +1010 -53
  12. package/dist/agent/agent.js.map +1 -1
  13. package/dist/agent/background.d.ts +135 -0
  14. package/dist/agent/background.js +307 -0
  15. package/dist/agent/background.js.map +1 -0
  16. package/dist/agent/compaction.d.ts +7 -0
  17. package/dist/agent/compaction.js +11 -3
  18. package/dist/agent/compaction.js.map +1 -1
  19. package/dist/agent/goal.d.ts +36 -0
  20. package/dist/agent/goal.js +71 -0
  21. package/dist/agent/goal.js.map +1 -0
  22. package/dist/agent/hooks.js +6 -6
  23. package/dist/agent/hooks.js.map +1 -1
  24. package/dist/agent/permissions.d.ts +6 -0
  25. package/dist/agent/permissions.js +2 -1
  26. package/dist/agent/permissions.js.map +1 -1
  27. package/dist/agent/session.d.ts +38 -0
  28. package/dist/agent/session.js +91 -2
  29. package/dist/agent/session.js.map +1 -1
  30. package/dist/agent/store.d.ts +25 -0
  31. package/dist/agent/store.js +21 -0
  32. package/dist/agent/store.js.map +1 -1
  33. package/dist/agent/subagent.d.ts +21 -0
  34. package/dist/agent/subagent.js +17 -1
  35. package/dist/agent/subagent.js.map +1 -1
  36. package/dist/agent/workspace.d.ts +9 -0
  37. package/dist/agent/workspace.js +59 -5
  38. package/dist/agent/workspace.js.map +1 -1
  39. package/dist/auth/index.d.ts +3 -1
  40. package/dist/auth/index.js +3 -1
  41. package/dist/auth/index.js.map +1 -1
  42. package/dist/auth/manager.d.ts +9 -0
  43. package/dist/auth/manager.js +71 -6
  44. package/dist/auth/manager.js.map +1 -1
  45. package/dist/auth/oauth.d.ts +33 -0
  46. package/dist/auth/oauth.js +59 -8
  47. package/dist/auth/oauth.js.map +1 -1
  48. package/dist/auth/providers/account.js +5 -4
  49. package/dist/auth/providers/account.js.map +1 -1
  50. package/dist/auth/providers/anthropic.d.ts +25 -5
  51. package/dist/auth/providers/anthropic.js +47 -6
  52. package/dist/auth/providers/anthropic.js.map +1 -1
  53. package/dist/auth/providers/chatgpt.d.ts +8 -0
  54. package/dist/auth/providers/chatgpt.js +180 -0
  55. package/dist/auth/providers/chatgpt.js.map +1 -0
  56. package/dist/auth/providers/openrouter.d.ts +2 -0
  57. package/dist/auth/providers/openrouter.js +101 -0
  58. package/dist/auth/providers/openrouter.js.map +1 -0
  59. package/dist/auth/types.d.ts +15 -0
  60. package/dist/auth/types.js.map +1 -1
  61. package/dist/browser/index.d.ts +1 -1
  62. package/dist/browser/plugin.d.ts +6 -1
  63. package/dist/browser/plugin.js.map +1 -1
  64. package/dist/browser/session.d.ts +47 -0
  65. package/dist/browser/session.js +177 -2
  66. package/dist/browser/session.js.map +1 -1
  67. package/dist/browser/tools.js +142 -18
  68. package/dist/browser/tools.js.map +1 -1
  69. package/dist/computer/arbiter.d.ts +69 -0
  70. package/dist/computer/arbiter.js +128 -0
  71. package/dist/computer/arbiter.js.map +1 -0
  72. package/dist/computer/cua-driver.d.ts +174 -0
  73. package/dist/computer/cua-driver.js +597 -0
  74. package/dist/computer/cua-driver.js.map +1 -0
  75. package/dist/computer/helper-client.d.ts +80 -0
  76. package/dist/computer/helper-client.js +166 -0
  77. package/dist/computer/helper-client.js.map +1 -0
  78. package/dist/computer/index.d.ts +16 -0
  79. package/dist/computer/index.js +9 -0
  80. package/dist/computer/index.js.map +1 -0
  81. package/dist/computer/mode.d.ts +34 -0
  82. package/dist/computer/mode.js +52 -0
  83. package/dist/computer/mode.js.map +1 -0
  84. package/dist/computer/plugin.d.ts +24 -0
  85. package/dist/computer/plugin.js +17 -0
  86. package/dist/computer/plugin.js.map +1 -0
  87. package/dist/computer/policy.d.ts +29 -0
  88. package/dist/computer/policy.js +127 -0
  89. package/dist/computer/policy.js.map +1 -0
  90. package/dist/computer/session.d.ts +228 -0
  91. package/dist/computer/session.js +493 -0
  92. package/dist/computer/session.js.map +1 -0
  93. package/dist/computer/target.d.ts +206 -0
  94. package/dist/computer/target.js +31 -0
  95. package/dist/computer/target.js.map +1 -0
  96. package/dist/computer/tools.d.ts +8 -0
  97. package/dist/computer/tools.js +664 -0
  98. package/dist/computer/tools.js.map +1 -0
  99. package/dist/config.d.ts +7 -0
  100. package/dist/config.js.map +1 -1
  101. package/dist/core/tokens.js +4 -0
  102. package/dist/core/tokens.js.map +1 -1
  103. package/dist/core/types.d.ts +16 -1
  104. package/dist/core/types.js.map +1 -1
  105. package/dist/harness.d.ts +128 -1
  106. package/dist/harness.js +287 -30
  107. package/dist/harness.js.map +1 -1
  108. package/dist/index.d.ts +3 -0
  109. package/dist/index.js +2 -0
  110. package/dist/index.js.map +1 -1
  111. package/dist/mcp/manager.d.ts +15 -0
  112. package/dist/mcp/manager.js +28 -1
  113. package/dist/mcp/manager.js.map +1 -1
  114. package/dist/mcp/transport.js +3 -0
  115. package/dist/mcp/transport.js.map +1 -1
  116. package/dist/providers/catalog.js +6 -0
  117. package/dist/providers/catalog.js.map +1 -1
  118. package/dist/providers/catalog.json +14 -3
  119. package/dist/providers/discovery.js +10 -2
  120. package/dist/providers/discovery.js.map +1 -1
  121. package/dist/providers/models-dev.d.ts +15 -0
  122. package/dist/providers/models-dev.js +15 -0
  123. package/dist/providers/models-dev.js.map +1 -1
  124. package/dist/providers/models-dev.json +114 -102
  125. package/dist/providers/piai.d.ts +54 -2
  126. package/dist/providers/piai.js +154 -9
  127. package/dist/providers/piai.js.map +1 -1
  128. package/dist/providers/registry.d.ts +16 -1
  129. package/dist/providers/registry.js +42 -11
  130. package/dist/providers/registry.js.map +1 -1
  131. package/dist/providers/types.d.ts +6 -0
  132. package/dist/providers/types.js.map +1 -1
  133. package/dist/runtime-plugins/builtin/studio.d.ts +7 -0
  134. package/dist/runtime-plugins/builtin/studio.js +69 -4
  135. package/dist/runtime-plugins/builtin/studio.js.map +1 -1
  136. package/dist/runtime-plugins/cloud-connector.js +5 -0
  137. package/dist/runtime-plugins/cloud-connector.js.map +1 -1
  138. package/dist/schedule/scheduler.d.ts +38 -0
  139. package/dist/schedule/scheduler.js +101 -1
  140. package/dist/schedule/scheduler.js.map +1 -1
  141. package/dist/tools/builtin/bash.d.ts +6 -0
  142. package/dist/tools/builtin/bash.js +8 -11
  143. package/dist/tools/builtin/bash.js.map +1 -1
  144. package/dist/tools/builtin/recall.js +4 -0
  145. package/dist/tools/builtin/recall.js.map +1 -1
  146. package/dist/tools/builtin/routine.d.ts +9 -0
  147. package/dist/tools/builtin/routine.js +23 -2
  148. package/dist/tools/builtin/routine.js.map +1 -1
  149. package/dist/tools/builtin/task-control.d.ts +21 -0
  150. package/dist/tools/builtin/task-control.js +120 -0
  151. package/dist/tools/builtin/task-control.js.map +1 -0
  152. package/dist/tools/builtin/task.js +50 -9
  153. package/dist/tools/builtin/task.js.map +1 -1
  154. package/dist/tools/builtin/todo.d.ts +1 -1
  155. package/dist/tools/builtin/worktree.d.ts +10 -0
  156. package/dist/tools/builtin/worktree.js +52 -0
  157. package/dist/tools/builtin/worktree.js.map +1 -0
  158. package/dist/tools/define.d.ts +4 -1
  159. package/dist/tools/define.js +2 -0
  160. package/dist/tools/define.js.map +1 -1
  161. package/dist/tools/types.d.ts +112 -0
  162. package/dist/tools/types.js.map +1 -1
  163. package/dist/util/shell.d.ts +30 -0
  164. package/dist/util/shell.js +70 -0
  165. package/dist/util/shell.js.map +1 -1
  166. package/dist/worktree/index.d.ts +109 -0
  167. package/dist/worktree/index.js +463 -0
  168. package/dist/worktree/index.js.map +1 -0
  169. package/package.json +3 -3
  170. 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;