@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,493 @@
1
+ import { ComputerArbiter } from "./arbiter.js";
2
+ import { tierAllows, tierFor, tierRefusal } from "./policy.js";
3
+ import { ComputerError } from "./target.js";
4
+ import { isComputerEnableMode } from "./mode.js";
5
+ /**
6
+ * What every conversation shares: one helper process, one arbiter.
7
+ *
8
+ * The helper starts on the first call that needs it — registered eagerly,
9
+ * launched lazily, the same rule as the browser — and is restarted on the next
10
+ * call if it dies.
11
+ */
12
+ export class ComputerRuntime {
13
+ arbiter;
14
+ opts;
15
+ starting;
16
+ helperInfo;
17
+ observers = new Set();
18
+ snapshotObservers = new Set();
19
+ enableObservers = new Set();
20
+ constructor(opts) {
21
+ this.opts = opts;
22
+ this.arbiter = opts.arbiter ?? new ComputerArbiter();
23
+ }
24
+ async target() {
25
+ if (!this.starting) {
26
+ this.starting = this.opts.target().catch((err) => {
27
+ this.starting = undefined;
28
+ throw err;
29
+ });
30
+ }
31
+ return this.starting;
32
+ }
33
+ /** Forget a dead helper so the next call starts a fresh one. */
34
+ reset() {
35
+ const old = this.starting;
36
+ this.starting = undefined;
37
+ this.helperInfo = undefined;
38
+ void old?.then((target) => target.close()).catch(() => { });
39
+ }
40
+ async info() {
41
+ if (!this.helperInfo)
42
+ this.helperInfo = await (await this.target()).info();
43
+ return this.helperInfo;
44
+ }
45
+ granted;
46
+ async permissions() {
47
+ const now = this.opts.permissions ? await this.opts.permissions() : await (await this.target()).permissions();
48
+ // A grant that just arrived is invisible to a helper started before it:
49
+ // start a fresh one, which asks the OS again.
50
+ const before = this.granted;
51
+ if (before && ((now.accessibility && !before.accessibility) || (now.screen && !before.screen))) {
52
+ this.reset();
53
+ }
54
+ this.granted = now;
55
+ return now;
56
+ }
57
+ async requestPermissions(grant) {
58
+ await (await this.target()).requestPermissions(grant);
59
+ }
60
+ selfPids() {
61
+ return new Set(this.opts.selfPids?.() ?? [process.pid]);
62
+ }
63
+ policy() {
64
+ return this.opts.policy?.() ?? {};
65
+ }
66
+ takeover() {
67
+ return this.opts.takeover?.() ?? "ask";
68
+ }
69
+ enableMode() {
70
+ const mode = this.opts.enable?.();
71
+ return isComputerEnableMode(mode) ? mode : "ask";
72
+ }
73
+ /**
74
+ * A conversation's agent switched Computer use on. The + menu tells the
75
+ * server itself; this is how the server hears of the other way, to save the
76
+ * conversation and show the chip and the permission card.
77
+ */
78
+ onEnabled(listener) {
79
+ this.enableObservers.add(listener);
80
+ return () => this.enableObservers.delete(listener);
81
+ }
82
+ emitEnabled(sessionId) {
83
+ for (const listener of this.enableObservers) {
84
+ try {
85
+ listener(sessionId);
86
+ }
87
+ catch {
88
+ // Whoever was told cannot undo the switch by failing.
89
+ }
90
+ }
91
+ }
92
+ onAction(listener) {
93
+ this.observers.add(listener);
94
+ return () => this.observers.delete(listener);
95
+ }
96
+ emit(event) {
97
+ for (const listener of this.observers) {
98
+ try {
99
+ listener(event);
100
+ }
101
+ catch {
102
+ // An overlay that throws must not fail the action it was drawing.
103
+ }
104
+ }
105
+ }
106
+ canSnapshot() {
107
+ return Boolean(this.opts.snapshot);
108
+ }
109
+ async snapshot(window) {
110
+ return this.opts.snapshot?.(window).catch(() => undefined);
111
+ }
112
+ onSnapshot(listener) {
113
+ this.snapshotObservers.add(listener);
114
+ return () => this.snapshotObservers.delete(listener);
115
+ }
116
+ emitSnapshot(event) {
117
+ for (const listener of this.snapshotObservers) {
118
+ try {
119
+ listener(event);
120
+ }
121
+ catch {
122
+ // A transcript that cannot take the picture must not fail the turn.
123
+ }
124
+ }
125
+ }
126
+ async close() {
127
+ const target = this.starting;
128
+ this.starting = undefined;
129
+ await target?.then((t) => t.close()).catch(() => { });
130
+ }
131
+ }
132
+ /**
133
+ * One conversation's view of the computer.
134
+ *
135
+ * Holds what only makes sense per conversation: the apps and windows it has
136
+ * seen (so a permission prompt can name an app synchronously), the geometry of
137
+ * the screenshots it was shown (so its coordinates can be mapped back), and
138
+ * the window it last worked in.
139
+ */
140
+ export class ComputerUseSession {
141
+ runtime;
142
+ sessionId = "";
143
+ label = () => undefined;
144
+ apps = new Map();
145
+ windowsById = new Map();
146
+ shots = new Map();
147
+ secureRefs = new Set();
148
+ /**
149
+ * The windows this turn worked in, in the order last used, each with the
150
+ * agent's own screenshot of it while that is still how it looks. Each gets
151
+ * one picture under the reply when the turn ends: that screenshot when there
152
+ * is one, else a capture. The screenshot sits folded inside its tool card,
153
+ * where nobody reading the reply sees it, and reusing it costs no capture —
154
+ * so a host without Screen Recording still shows what the agent saw.
155
+ */
156
+ unseen = new Map();
157
+ refFrames = new Map();
158
+ currentWindow;
159
+ constructor(runtime, sessionId) {
160
+ this.runtime = runtime;
161
+ if (sessionId)
162
+ this.sessionId = sessionId;
163
+ }
164
+ bind(sessionId) {
165
+ if (!this.sessionId)
166
+ this.sessionId = sessionId;
167
+ }
168
+ setLabel(label) {
169
+ this.label = label;
170
+ }
171
+ holder() {
172
+ return { sessionId: this.sessionId, label: this.label() ?? "another conversation" };
173
+ }
174
+ get id() {
175
+ return this.sessionId;
176
+ }
177
+ // ---- lookups -----------------------------------------------------------
178
+ async listApps() {
179
+ const target = await this.runtime.target();
180
+ const self = this.runtime.selfPids();
181
+ const apps = (await target.apps()).filter((app) => !self.has(app.pid));
182
+ for (const app of apps)
183
+ this.rememberApp(app);
184
+ return apps;
185
+ }
186
+ async listWindows(pid) {
187
+ const target = await this.runtime.target();
188
+ const self = this.runtime.selfPids();
189
+ const windows = (await target.windows(pid === undefined ? {} : { pid })).filter((w) => !self.has(w.pid));
190
+ for (const window of windows)
191
+ this.windowsById.set(window.id, window);
192
+ return windows;
193
+ }
194
+ rememberApp(app) {
195
+ this.apps.set(app.id.toLowerCase(), app);
196
+ this.apps.set(app.name.toLowerCase(), app);
197
+ }
198
+ /**
199
+ * The app a call names, synchronously, for the permission prompt.
200
+ *
201
+ * From what this conversation has already seen; an app it has not listed
202
+ * yet is named as the model wrote it, which still scopes the approval to
203
+ * one app.
204
+ */
205
+ appIdFor(input) {
206
+ const window = input.ref ? windowOfRef(input.ref) : input.window;
207
+ if (window) {
208
+ const known = this.windowsById.get(window);
209
+ if (known)
210
+ return known.appId;
211
+ }
212
+ if (input.app)
213
+ return this.apps.get(input.app.toLowerCase())?.id ?? input.app.toLowerCase();
214
+ if (!window && this.currentWindow)
215
+ return this.windowsById.get(this.currentWindow)?.appId;
216
+ return undefined;
217
+ }
218
+ /** Find the window a call means: by ref, by id, by app, or the last one used. */
219
+ async resolveWindow(input) {
220
+ const wanted = input.ref ? windowOfRef(input.ref) : input.window;
221
+ if (wanted) {
222
+ let window = this.windowsById.get(wanted);
223
+ if (!window)
224
+ window = (await this.listWindows()).find((w) => w.id === wanted);
225
+ if (!window)
226
+ throw new ComputerError("not_found", `No window ${wanted}. Call computer_list_apps to see what is open.`);
227
+ return window;
228
+ }
229
+ if (input.app) {
230
+ const key = input.app.toLowerCase();
231
+ let app = this.apps.get(key);
232
+ if (!app) {
233
+ await this.listApps();
234
+ app = this.apps.get(key) ?? [...new Set(this.apps.values())].find((a) => a.name.toLowerCase().includes(key));
235
+ }
236
+ if (!app)
237
+ throw new ComputerError("not_found", `${input.app} is not running. Use computer_open_app to start it.`);
238
+ let windows = (await this.listWindows(app.pid)).filter((w) => !w.minimized);
239
+ if (!windows.length) {
240
+ // Remembered from an earlier look, it may have been quit and opened
241
+ // again since, under a new pid: read the apps again before saying no.
242
+ const running = await this.listApps();
243
+ const fresh = this.apps.get(app.id.toLowerCase());
244
+ if (!running.some((a) => a.id === app.id)) {
245
+ throw new ComputerError("not_found", `${app.name} is not running. Use computer_open_app to start it.`);
246
+ }
247
+ if (fresh && fresh.pid !== app.pid) {
248
+ app = fresh;
249
+ windows = (await this.listWindows(app.pid)).filter((w) => !w.minimized);
250
+ }
251
+ }
252
+ const window = windows.find((w) => w.focused) ?? windows[0];
253
+ if (!window)
254
+ throw new ComputerError("not_found", `${app.name} has no open window.`);
255
+ return window;
256
+ }
257
+ if (this.currentWindow) {
258
+ const window = this.windowsById.get(this.currentWindow);
259
+ if (window)
260
+ return window;
261
+ }
262
+ throw new ComputerError("not_found", "Name an app or a window. Call computer_list_apps to see what is open.");
263
+ }
264
+ // ---- guards ------------------------------------------------------------
265
+ tierOf(window) {
266
+ return tierFor(window.appId, window.app, this.runtime.policy());
267
+ }
268
+ /**
269
+ * Everything that has to hold before touching a window: it is not ours,
270
+ * its tier allows this kind of action, and no other conversation has it.
271
+ */
272
+ guard(window, kind) {
273
+ if (this.runtime.selfPids().has(window.pid)) {
274
+ throw new ComputerError("refused", "That window belongs to OHarness itself, which cannot be controlled by the agent.");
275
+ }
276
+ const tier = this.tierOf(window);
277
+ if (!tierAllows(tier, kind))
278
+ throw new ComputerError("refused", tierRefusal(tier, window.app, kind));
279
+ if (kind !== "look") {
280
+ this.runtime.arbiter.claimWindow(this.holder(), window.id);
281
+ if (kind === "type")
282
+ this.runtime.arbiter.claimApp(this.holder(), window.pid);
283
+ }
284
+ this.currentWindow = window.id;
285
+ }
286
+ /**
287
+ * Stay off a window the person is using right now.
288
+ *
289
+ * Their front window with input in the last few seconds is theirs: the
290
+ * lease on it lapses and the call is refused. Pointer-free actions on other
291
+ * windows go ahead regardless.
292
+ */
293
+ async respectUser(window, target) {
294
+ if (this.runtime.arbiter.holdsControl(this.sessionId))
295
+ return;
296
+ const [front, idle] = await Promise.all([target.frontmost().catch(() => undefined), target.idle().catch(() => Infinity)]);
297
+ if (front && idle < 3_000 && (front.window === window.id || (!front.window && front.pid === window.pid))) {
298
+ this.runtime.arbiter.yieldWindow(window.id);
299
+ throw new ComputerError("busy", `The user is working in ${window.app} right now. Wait, or work on something else.`);
300
+ }
301
+ }
302
+ /** Keys wait until the person has stopped typing, up to a limit. */
303
+ async waitForQuiet(target, signal, quietMs = 1_500, maxMs = 10_000) {
304
+ if (this.runtime.arbiter.holdsControl(this.sessionId))
305
+ return;
306
+ const started = Date.now();
307
+ for (;;) {
308
+ const idle = await target.idle().catch(() => Infinity);
309
+ if (idle >= quietMs)
310
+ return;
311
+ if (Date.now() - started > maxMs) {
312
+ throw new ComputerError("busy", "The user has been typing continuously; try again when they pause.");
313
+ }
314
+ if (signal?.aborted)
315
+ throw new ComputerError("refused", "stopped");
316
+ await new Promise((resolve) => setTimeout(resolve, Math.min(500, quietMs - idle + 50)));
317
+ }
318
+ }
319
+ // ---- screenshots and coordinates ---------------------------------------
320
+ rememberShot(key, shot) {
321
+ this.shots.set(key, { width: shot.width, height: shot.height, frame: shot.frame });
322
+ }
323
+ /**
324
+ * A rectangle `[x0, y0, x1, y1]` in the last screenshot under `key` (a
325
+ * window id, or `display:<id>`), on screen. Clipped to the screenshot, so a
326
+ * region drawn a little past its edge still means its edge.
327
+ */
328
+ regionToScreen(key, what, region) {
329
+ const shot = this.shots.get(key);
330
+ if (!shot) {
331
+ throw new ComputerError("refused", `Take a computer_screenshot of ${what} first; the region is pixels in that screenshot. Or zoom on a ref from computer_read_app.`);
332
+ }
333
+ const [x0, y0, x1, y1] = region.map(Number);
334
+ const left = Math.max(0, Math.min(x0, x1));
335
+ const top = Math.max(0, Math.min(y0, y1));
336
+ const right = Math.min(shot.width, Math.max(x0, x1));
337
+ const bottom = Math.min(shot.height, Math.max(y0, y1));
338
+ if (right - left < 1 || bottom - top < 1) {
339
+ throw new ComputerError("refused", `[${region.join(", ")}] is not inside the ${shot.width}x${shot.height} screenshot.`);
340
+ }
341
+ const sx = shot.frame.w / shot.width;
342
+ const sy = shot.frame.h / shot.height;
343
+ return { x: shot.frame.x + left * sx, y: shot.frame.y + top * sy, w: (right - left) * sx, h: (bottom - top) * sy };
344
+ }
345
+ /** Screen rect → `[x0, y0, x1, y1]` in the last screenshot under `key`, rounded. */
346
+ screenToRegion(key, rect) {
347
+ const shot = this.shots.get(key);
348
+ if (!shot)
349
+ return undefined;
350
+ const px = (x) => Math.round(((x - shot.frame.x) * shot.width) / shot.frame.w);
351
+ const py = (y) => Math.round(((y - shot.frame.y) * shot.height) / shot.frame.h);
352
+ return [px(rect.x), py(rect.y), px(rect.x + rect.w), py(rect.y + rect.h)];
353
+ }
354
+ // ---- displays ----------------------------------------------------------
355
+ /** The monitors, primary first; empty when the layer cannot say. */
356
+ async listDisplays() {
357
+ const target = await this.runtime.target();
358
+ const displays = (await target.displays?.().catch(() => undefined)) ?? [];
359
+ return [...displays].sort((a, b) => Number(b.primary) - Number(a.primary));
360
+ }
361
+ /** A display by id or by name, as the model wrote it. */
362
+ async resolveDisplay(wanted) {
363
+ const displays = await this.listDisplays();
364
+ if (!displays.length)
365
+ return undefined;
366
+ const lower = wanted.trim().toLowerCase();
367
+ const found = displays.find((d) => d.id === wanted.trim()) ??
368
+ displays.find((d) => d.name.toLowerCase() === lower) ??
369
+ (lower === "primary" || lower === "main" ? displays.find((d) => d.primary) : undefined) ??
370
+ displays.find((d) => d.name.toLowerCase().includes(lower));
371
+ if (!found) {
372
+ throw new ComputerError("not_found", `No display "${wanted}". Displays: ${displays.map((d) => `${d.id} "${d.name}"`).join(", ")}.`);
373
+ }
374
+ return found;
375
+ }
376
+ /**
377
+ * Map a point in the last screenshot of `window` back to the screen.
378
+ *
379
+ * The model only ever sees image pixels. Retina, per-monitor DPI and the
380
+ * downscale to fit the image budget are all folded into the screenshot's own
381
+ * frame, so none of them reach the model.
382
+ */
383
+ toScreen(window, x, y) {
384
+ const shot = this.shots.get(window.id);
385
+ if (!shot) {
386
+ throw new ComputerError("refused", `Take a computer_screenshot of ${window.app} first; x/y are pixels in that screenshot. Or act on a ref from computer_read_app.`);
387
+ }
388
+ if (x < 0 || y < 0 || x > shot.width || y > shot.height) {
389
+ throw new ComputerError("refused", `(${x}, ${y}) is outside the ${shot.width}x${shot.height} screenshot.`);
390
+ }
391
+ return {
392
+ x: shot.frame.x + (x * shot.frame.w) / shot.width,
393
+ y: shot.frame.y + (y * shot.frame.h) / shot.height,
394
+ };
395
+ }
396
+ // ---- accessibility refs ------------------------------------------------
397
+ rememberTree(nodes) {
398
+ for (const node of nodes) {
399
+ if (node.secure)
400
+ this.secureRefs.add(node.ref);
401
+ if (node.frame)
402
+ this.refFrames.set(node.ref, node.frame);
403
+ }
404
+ }
405
+ isSecure(ref) {
406
+ return this.secureRefs.has(ref);
407
+ }
408
+ frameOf(ref) {
409
+ return this.refFrames.get(ref);
410
+ }
411
+ // ---- presentation ------------------------------------------------------
412
+ async announce(event, target) {
413
+ const known = event.window ? this.windowsById.get(event.window) : undefined;
414
+ // Opening or reading a window has no point of its own, and without one the
415
+ // cursor stayed wherever the last click was — or nowhere — while the agent
416
+ // had moved on to another app. The window's middle says where it is now.
417
+ if (event.kind === "look" && !event.point && known?.frame) {
418
+ event = { ...event, point: { x: known.frame.x + known.frame.w / 2, y: known.frame.y + known.frame.h / 2 } };
419
+ }
420
+ let visible = event.visible;
421
+ if (visible === undefined && event.point && event.window && target) {
422
+ visible = await target.pointVisible(event.window, event.point.x, event.point.y).catch(() => false);
423
+ }
424
+ if (event.window && event.kind !== "control" && event.kind !== "release") {
425
+ const seen = this.unseen.get(event.window);
426
+ // Looking — a tree read, a zoom — changes nothing: a screenshot taken
427
+ // before it is still the window's state. Anything else makes it stale.
428
+ // Re-inserted, so the order is the order the windows were last used in.
429
+ if (!(event.kind === "look" && seen?.shot)) {
430
+ this.unseen.delete(event.window);
431
+ this.unseen.set(event.window, { app: event.app ?? known?.app ?? "" });
432
+ }
433
+ }
434
+ this.runtime.emit({
435
+ ...event,
436
+ ...(visible === undefined ? {} : { visible }),
437
+ ...(known ? { windowFrame: known.frame, ...(known.title ? { title: known.title } : {}) } : {}),
438
+ sessionId: this.sessionId,
439
+ label: this.holder().label,
440
+ });
441
+ }
442
+ /** The agent's own screenshot of this window: its state, until the next action on it. */
443
+ sawWindow(window, shot) {
444
+ const app = this.unseen.get(window)?.app ?? this.windowsById.get(window)?.app ?? "";
445
+ this.unseen.delete(window);
446
+ this.unseen.set(window, { app, ...(shot ? { shot } : {}) });
447
+ }
448
+ /** The turn ended: let go of windows and control, so others need not wait out the lease. */
449
+ endTurn() {
450
+ this.runtime.arbiter.releaseAll(this.sessionId);
451
+ // The idle event first, synchronously: the host marks where in the
452
+ // conversation this turn ended on it, before a queued message can start
453
+ // the next one. The pictures follow when they are taken.
454
+ this.runtime.emit({ sessionId: this.sessionId, label: this.holder().label, kind: "idle" });
455
+ const windows = [...this.unseen].slice(-SNAPSHOT_MAX_WINDOWS);
456
+ this.unseen.clear();
457
+ const capture = this.runtime.canSnapshot();
458
+ if (windows.some(([, seen]) => seen.shot || capture))
459
+ void this.snapshotTurn(windows, capture);
460
+ }
461
+ async snapshotTurn(windows, capture) {
462
+ const shots = [];
463
+ for (const [window, { app, shot }] of windows) {
464
+ const image = shot ?? (capture ? await this.runtime.snapshot(window) : undefined);
465
+ if (!image)
466
+ continue;
467
+ const title = this.windowsById.get(window)?.title;
468
+ shots.push({ window, app, ...(title ? { title } : {}), ...image });
469
+ }
470
+ if (shots.length)
471
+ this.runtime.emitSnapshot({ sessionId: this.sessionId, shots });
472
+ }
473
+ async close() {
474
+ // Closing is not the end of a turn anyone will read back.
475
+ this.unseen.clear();
476
+ this.endTurn();
477
+ this.shots.clear();
478
+ this.windowsById.clear();
479
+ this.apps.clear();
480
+ }
481
+ }
482
+ /**
483
+ * At most this many windows get a picture per turn: a turn that went through
484
+ * ten apps is read back by its last few, and each picture is a capture and a
485
+ * file. The page shows one row of them and opens the rest from it.
486
+ */
487
+ const SNAPSHOT_MAX_WINDOWS = 6;
488
+ /** Refs look like `w<window>.<n>`; the window id is everything between. */
489
+ export function windowOfRef(ref) {
490
+ const match = /^w(.+)\.\d+$/.exec(ref);
491
+ return match?.[1];
492
+ }
493
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/computer/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,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