@0perator/operator 0.1.360-next.2 → 0.2.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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/autonomy/delegate-mode.js +159 -0
  3. package/dist/autonomy/delegate.js +1 -1
  4. package/dist/autonomy/session-factory.js +2 -0
  5. package/dist/background/index.js +26 -2
  6. package/dist/background/resume.js +125 -0
  7. package/dist/browser/engine.js +163 -0
  8. package/dist/browser/session.js +130 -140
  9. package/dist/cli.js +174 -12
  10. package/dist/config/settings.js +1 -1
  11. package/dist/engine/agent.js +1 -1
  12. package/dist/engine/aurora.js +4 -4
  13. package/dist/engine/compaction.js +1 -1
  14. package/dist/engine/moa.js +2 -1
  15. package/dist/engine/selfheal.js +1 -1
  16. package/dist/engine/toolcalls.js +6 -6
  17. package/dist/index.js +3 -0
  18. package/dist/mcp/phone-server.js +30 -0
  19. package/dist/permissions/index.js +33 -17
  20. package/dist/permissions/signature.js +5 -0
  21. package/dist/phone-cli.js +65 -0
  22. package/dist/remote/host.js +31 -2
  23. package/dist/router/models.js +5 -15
  24. package/dist/selfimprove/index.js +1 -1
  25. package/dist/session.js +48 -7
  26. package/dist/tools/deferred.js +1 -0
  27. package/dist/tools/device/android.js +227 -0
  28. package/dist/tools/device/classify.js +127 -0
  29. package/dist/tools/device/deps.js +69 -0
  30. package/dist/tools/device/desktop.js +82 -0
  31. package/dist/tools/device/harness.js +262 -0
  32. package/dist/tools/device/iphone.js +206 -0
  33. package/dist/tools/device/mirroring-jxa.js +146 -0
  34. package/dist/tools/device/setup.js +90 -0
  35. package/dist/tools/device/tools.js +70 -0
  36. package/dist/tools/device/types.js +19 -0
  37. package/dist/tools/registry.js +12 -3
  38. package/dist/ui/App.js +4 -3
  39. package/dist/ui/ApprovalPrompt.js +10 -4
  40. package/dist/ui/BgPanel.js +2 -2
  41. package/dist/ui/UpdatePrompt.js +40 -0
  42. package/dist/ui/modelPicker.js +1 -1
  43. package/dist/ui/slashCommands.js +1 -0
  44. package/dist/update-check.js +134 -0
  45. package/dist/update.js +59 -15
  46. package/dist/util/slash.js +2 -2
  47. package/package.json +4 -2
  48. package/src/tools/device/NOTICE +37 -0
  49. package/dist/browser/cdp.js +0 -271
@@ -0,0 +1,206 @@
1
+ // iPhone through the Mac's iPhone Mirroring window (macOS 15+, iOS 18+): nothing is installed on the phone. Ported
2
+ // from phone-harness's ios.py / mirror.py / ocr.py (MIT, see ./NOTICE). Two drivers behind one backend:
3
+ // - Chauffeur, when it is installed: taps and drags go to the window in the background (the owner keeps the screen).
4
+ // - The built-in driver (mirroring-jxa.ts, the system's own osascript), for every Mac without Chauffeur: CGEvents,
5
+ // after bringing the window to the front.
6
+ // Keys and text always use the built-in driver: Mirroring forwards raw HID keycodes to iOS, so a modifier has to be a
7
+ // key held down, which is what that driver does. What Mirroring cannot do is reported, never emulated: no Back key,
8
+ // no app inventory, no accessibility tree inside the phone image (text comes from Vision OCR of the window).
9
+ import { deviceDeps, pngSize } from "./deps.js";
10
+ import { MIRRORING_APP, MIRRORING_JXA, NAMED_KEYCODES, keycodesFor } from "./mirroring-jxa.js";
11
+ import { NeedsOwner, Unsupported } from "./types.js";
12
+ const T_JXA = 15_000;
13
+ const T_CAPTURE = 15_000;
14
+ /** The app macOS asks about for a permission: the outermost app that runs Operator, not node itself. */
15
+ export function hostAppName(env = process.env) {
16
+ const t = env.TERM_PROGRAM ?? "";
17
+ const known = { Apple_Terminal: "Terminal", "iTerm.app": "iTerm", vscode: "Visual Studio Code", ghostty: "Ghostty", WarpTerminal: "Warp", WezTerm: "WezTerm", tmux: "the terminal app running tmux" };
18
+ return known[t] ?? (t ? t : "the app that runs Operator (your terminal)");
19
+ }
20
+ export const PERMISSION_FIX = {
21
+ accessibility: (app) => `System Settings > Privacy & Security > Accessibility: switch on "${app}" (takes effect at once)`,
22
+ screenRecording: (app) => `System Settings > Privacy & Security > Screen & System Audio Recording: switch on "${app}", then quit and reopen it`,
23
+ };
24
+ export function macMajor(version) { return Number(version.trim().split(".")[0]) || 0; }
25
+ export class IphoneBackend {
26
+ prefer;
27
+ kind = "iphone";
28
+ chauffeurCall;
29
+ constructor(prefer = "auto") {
30
+ this.prefer = prefer;
31
+ }
32
+ async jxa(...args) {
33
+ const r = await deviceDeps().run("osascript", ["-l", "JavaScript", "-e", MIRRORING_JXA, ...args], { timeoutMs: T_JXA });
34
+ if (r.missing)
35
+ throw new Unsupported("osascript is missing — this is not a standard macOS install");
36
+ if (r.timedOut)
37
+ throw new Error(`the iPhone Mirroring driver did not answer in ${T_JXA / 1000} s (${args[0]})`);
38
+ if (r.code !== 0)
39
+ throw new Error(`iPhone Mirroring: ${(r.stderr || r.stdout).replace(/^.*execution error: /s, "").trim().slice(0, 300)}`);
40
+ return JSON.parse(r.stdout.trim() || "{}");
41
+ }
42
+ /** The driver for pointer input: Chauffeur when it answers (and is not switched off), else the built-in one. */
43
+ async driver() {
44
+ if (this.prefer === "builtin")
45
+ return "builtin";
46
+ if (this.chauffeurCall === undefined)
47
+ this.chauffeurCall = await deviceDeps().chauffeur().catch(() => null);
48
+ if (this.chauffeurCall)
49
+ return "chauffeur";
50
+ if (this.prefer === "chauffeur")
51
+ throw new NeedsOwner("Chauffeur was asked for but is not installed", "install Chauffeur, or let Operator pick the iPhone driver itself");
52
+ return "builtin";
53
+ }
54
+ async status() {
55
+ const d = deviceDeps();
56
+ const base = { kind: "iphone", backend: "iphone-mirroring" };
57
+ if (d.platform !== "darwin")
58
+ return { ...base, state: "unsupported", detail: `iPhone Mirroring is a macOS app; this computer runs ${d.platform}`, fix: "drive an iPhone from a Mac (macOS 15+), or use an Android phone over adb here" };
59
+ const ver = await d.run("sw_vers", ["-productVersion"], { timeoutMs: 5000 });
60
+ const major = macMajor(ver.stdout);
61
+ if (major && major < 15)
62
+ return { ...base, state: "unsupported", detail: `macOS ${ver.stdout.trim()} has no iPhone Mirroring`, fix: "update to macOS 15 Sequoia or later (Apple menu > System Settings > General > Software Update)" };
63
+ const present = await d.run("osascript", ["-l", "JavaScript", "-e", `ObjC.import('Foundation'); $.NSFileManager.defaultManager.fileExistsAtPath(${JSON.stringify(MIRRORING_APP)}) ? 'yes' : 'no'`], { timeoutMs: T_JXA });
64
+ if (present.missing)
65
+ return { ...base, state: "unsupported", detail: "osascript is missing" };
66
+ if (present.stdout.trim() === "no")
67
+ return { ...base, state: "missing-tool", detail: "the iPhone Mirroring app is not on this Mac", fix: "iPhone Mirroring ships with macOS 15+; it is unavailable in some regions (EU) and on managed Macs that disable it" };
68
+ const perms = await this.jxa("perms");
69
+ const host = hostAppName();
70
+ if (!perms.accessibility)
71
+ return { ...base, state: "permission", detail: `Accessibility is off for ${host} (needed for taps and typing)`, fix: PERMISSION_FIX.accessibility(host) };
72
+ if (!perms.screenRecording)
73
+ return { ...base, state: "permission", detail: `Screen Recording is off for ${host} (needed to see the phone)`, fix: PERMISSION_FIX.screenRecording(host) };
74
+ const w = await this.jxa("window");
75
+ if (!w.running)
76
+ return { ...base, state: "not-running", detail: "iPhone Mirroring is not open", fix: "open iPhone Mirroring (Applications) with your iPhone nearby and locked" };
77
+ if (!w.window)
78
+ return { ...base, state: "not-paired", detail: "iPhone Mirroring is open but shows no phone", fix: "finish pairing in the iPhone Mirroring window (the phone must be in your hand once, signed in to the same Apple Account)" };
79
+ const said = [...(w.ax?.texts ?? []), ...(w.ax?.buttons ?? []).map((b) => `[${b}]`)].join(" ").slice(0, 200);
80
+ if (w.ax?.ok && said)
81
+ return { ...base, state: "blocked", detail: `the mirroring window shows: ${said}`, fix: /in use/i.test(said) ? "lock the iPhone (mirroring pauses while it is unlocked)" : "clear the message in the iPhone Mirroring window (Connect / Try Again)", name: "iPhone Mirroring" };
82
+ return { ...base, state: "ready", detail: `iPhone Mirroring window ${Math.round(w.window.w)}×${Math.round(w.window.h)}${w.ax?.ok ? "" : " (session state unverified: no accessibility read)"}`, name: "iPhone Mirroring" };
83
+ }
84
+ async window() {
85
+ const w = await this.jxa("window");
86
+ if (!w.running)
87
+ throw new NeedsOwner("iPhone Mirroring is not open", "open iPhone Mirroring with your iPhone nearby and locked");
88
+ if (!w.window)
89
+ throw new NeedsOwner("iPhone Mirroring shows no phone window", "finish pairing in the iPhone Mirroring window");
90
+ const said = [...(w.ax?.texts ?? []), ...(w.ax?.buttons ?? [])].join(" ");
91
+ if (w.ax?.ok && said)
92
+ throw new NeedsOwner(`the mirroring window shows: ${said.slice(0, 200)}`, "lock the iPhone, or press Connect in the window — nothing was sent");
93
+ return w.window;
94
+ }
95
+ async screenshot() {
96
+ const d = deviceDeps();
97
+ const win = await this.window();
98
+ const path = await d.tempFile("iphone", "png");
99
+ let r = await d.run("screencapture", ["-x", "-o", "-l", String(win.id), path], { timeoutMs: T_CAPTURE });
100
+ let bytes = r.code === 0 ? await d.readFile(path).catch(() => new Uint8Array()) : new Uint8Array();
101
+ if (bytes.length < 1000) {
102
+ // Not composited (another Space, covered while backing is purged): bring it up and capture its rect instead.
103
+ await this.jxa("activate");
104
+ const w2 = await this.window();
105
+ r = await d.run("screencapture", ["-x", "-R", `${Math.round(w2.x)},${Math.round(w2.y)},${Math.round(w2.w)},${Math.round(w2.h)}`, path], { timeoutMs: T_CAPTURE });
106
+ bytes = r.code === 0 ? await d.readFile(path).catch(() => new Uint8Array()) : new Uint8Array();
107
+ }
108
+ const size = pngSize(bytes);
109
+ if (!size)
110
+ throw new Error(`capturing the iPhone Mirroring window failed: ${(r.stderr || "empty capture").trim()} (Screen Recording must be on for ${hostAppName()})`);
111
+ return { path, ...size };
112
+ }
113
+ /** Vision OCR of the window (the phone image is opaque to accessibility). Boxes come back normalized with a
114
+ * bottom-left origin; flipped here into top-left screenshot pixels. */
115
+ async read(shot) {
116
+ const r = await this.jxa("ocr", shot.path);
117
+ const items = r.items.filter((o) => o.confidence >= 0.3).map((o) => ({
118
+ text: o.text,
119
+ x: Math.round((o.x + o.w / 2) * shot.width),
120
+ y: Math.round((1 - o.y - o.h / 2) * shot.height),
121
+ w: Math.round(o.w * shot.width),
122
+ h: Math.round(o.h * shot.height),
123
+ }));
124
+ return { source: "ocr", items };
125
+ }
126
+ /** Screenshot pixels → global screen points, against the window as it is now (it may have moved). */
127
+ async toScreen(x, y, shot) {
128
+ const win = await this.window();
129
+ const lx = (x * win.w) / shot.width, ly = (y * win.h) / shot.height;
130
+ return { win, lx, ly, sx: win.x + lx, sy: win.y + ly };
131
+ }
132
+ async tap(x, y, shot) {
133
+ const p = await this.toScreen(x, y, shot);
134
+ if ((await this.driver()) === "chauffeur") {
135
+ const pid = (await this.jxa("window")).pid;
136
+ const r = await this.chauffeurCall("click", { pid, window_id: p.win.id, x: Math.round(p.lx), y: Math.round(p.ly) });
137
+ if (/^error|"error"/i.test(r))
138
+ throw new Error(`Chauffeur click: ${r.slice(0, 200)}`);
139
+ return;
140
+ }
141
+ await this.jxa("tap", String(p.sx), String(p.sy));
142
+ }
143
+ async swipe(from, to, shot, durationMs) {
144
+ const a = await this.toScreen(from.x, from.y, shot);
145
+ const b = await this.toScreen(to.x, to.y, shot);
146
+ if ((await this.driver()) === "chauffeur") {
147
+ const pid = (await this.jxa("window")).pid;
148
+ const r = await this.chauffeurCall("drag", { pid, window_id: a.win.id, from_x: Math.round(a.lx), from_y: Math.round(a.ly), to_x: Math.round(b.lx), to_y: Math.round(b.ly) });
149
+ if (/^error|"error"/i.test(r))
150
+ throw new Error(`Chauffeur drag: ${r.slice(0, 200)}`);
151
+ return;
152
+ }
153
+ await this.jxa("drag", String(a.sx), String(a.sy), String(b.sx), String(b.sy), String(Math.min(Math.max(durationMs, 100), 3000) / 1000));
154
+ }
155
+ /** A content scroll (what most "swipe up" requests mean): scroll-wheel events at the window centre. A slow drag
156
+ * barely registers on iOS, the wheel always does (phone-harness, measured). */
157
+ async scroll(dir, shot) {
158
+ const c = await this.toScreen(shot.width / 2, shot.height / 2, shot);
159
+ const amount = Math.round(c.win.h * 0.6);
160
+ const dy = dir === "up" ? amount : dir === "down" ? -amount : 0; // swipe up = reveal content further down
161
+ const dx = dir === "left" ? amount : dir === "right" ? -amount : 0;
162
+ await this.jxa("scroll", String(c.sx), String(c.sy), String(dy), String(dx));
163
+ }
164
+ async type(text) {
165
+ await this.window();
166
+ if (!text)
167
+ return;
168
+ await this.jxa("paste", text);
169
+ }
170
+ /** Real keystrokes, for fields that refuse paste. Subject to iOS autocorrect; US layout only. */
171
+ async keystrokes(text) {
172
+ const codes = keycodesFor(text);
173
+ if (!codes)
174
+ throw new Unsupported("this text has characters with no US-layout key (emoji, accents); type it without keystrokes: true to paste it");
175
+ await this.window();
176
+ await this.jxa("keycodes", JSON.stringify(codes));
177
+ }
178
+ async key(key) {
179
+ const combos = {
180
+ home: ["cmd+1", NAMED_KEYCODES["1"]], recents: ["cmd+2", NAMED_KEYCODES["2"]], search: ["cmd+3", NAMED_KEYCODES["3"]],
181
+ enter: ["return", 36], delete: ["delete", 51], tab: ["tab", 48], space: ["space", 49], escape: ["escape", 53],
182
+ up: ["up", 126], down: ["down", 125], left: ["left", 123], right: ["right", 124],
183
+ };
184
+ if (key === "back")
185
+ throw new Unsupported("iOS has no system Back button: tap the app's own back control (top left), or swipe right from the left edge with phone_swipe");
186
+ const c = combos[key];
187
+ if (!c)
188
+ throw new Unsupported(`iPhone Mirroring cannot press ${key} (no hardware buttons are forwarded)`);
189
+ await this.window();
190
+ await this.jxa("key", c[0], String(c[1]));
191
+ }
192
+ /** Spotlight (Cmd+3), type the name, Return — what a person does. */
193
+ async openApp(name) {
194
+ const codes = keycodesFor(name);
195
+ await this.window();
196
+ await this.jxa("key", "cmd+3", String(NAMED_KEYCODES["3"]));
197
+ await deviceDeps().sleep(900);
198
+ if (codes)
199
+ await this.jxa("keycodes", JSON.stringify(codes));
200
+ else
201
+ await this.jxa("paste", name);
202
+ await deviceDeps().sleep(1200);
203
+ await this.jxa("key", "return", "36");
204
+ return name;
205
+ }
206
+ }
@@ -0,0 +1,146 @@
1
+ // The iPhone Mirroring driver for a Mac without Chauffeur: one JavaScript-for-Automation program run by the system's
2
+ // own `osascript -l JavaScript` (on every Mac — nothing to install), reaching CoreGraphics, AppKit, Accessibility and
3
+ // Vision through the ObjC bridge. It is a port of phone-harness's mirror.py and ocr.py (MIT, see ./NOTICE). The
4
+ // program is fixed text; every value (coordinates, the text to paste, the image path) arrives as an argv word and is
5
+ // read as data, so nothing the model sends is ever evaluated. It never asks macOS for a permission: AXIsProcessTrusted
6
+ // and CGPreflightScreenCaptureAccess only read the grant, they raise no dialog.
7
+ //
8
+ // What phone-harness learned the hard way and this keeps: windows are matched by the owner pid of the
9
+ // com.apple.ScreenContinuity process, never the (localized) app name; iPhone Mirroring forwards raw HID keycodes to iOS
10
+ // and drops the CGEvent flag mask, so a modifier is a key held down, not a flag set; text goes in by paste (immune to
11
+ // autocorrect and keyboard layout), keystrokes only on request; the live phone image is a video stream accessibility
12
+ // cannot see into, so a window with accessible labels or buttons is an interstitial (paused, iPhone in Use, Connect).
13
+ export const MIRRORING_BUNDLE = "com.apple.ScreenContinuity";
14
+ export const MIRRORING_APP = "/System/Applications/iPhone Mirroring.app";
15
+ export const MIRRORING_JXA = `
16
+ ObjC.import('AppKit'); ObjC.import('CoreGraphics'); ObjC.import('ApplicationServices');
17
+ var BUNDLE = 'com.apple.ScreenContinuity';
18
+ function out(o) { return JSON.stringify(o); }
19
+ function app() { var a = $.NSRunningApplication.runningApplicationsWithBundleIdentifier(BUNDLE); return a.count > 0 ? a.objectAtIndex(0) : null; }
20
+ function win(pid) {
21
+ var list = ObjC.deepUnwrap(ObjC.castRefToObject($.CGWindowListCopyWindowInfo(1, 0))) || [];
22
+ for (var i = 0; i < list.length; i++) {
23
+ var w = list[i];
24
+ if (w.kCGWindowOwnerPID === pid && (w.kCGWindowLayer || 0) === 0) {
25
+ var b = w.kCGWindowBounds; return { x: b.X, y: b.Y, w: b.Width, h: b.Height, id: w.kCGWindowNumber };
26
+ }
27
+ }
28
+ return null;
29
+ }
30
+ function front(pid) { var f = $.NSWorkspace.sharedWorkspace.frontmostApplication; return !!f && f.processIdentifier === pid; }
31
+ function activate() {
32
+ var a = app(); if (!a) throw new Error('iPhone Mirroring is not running');
33
+ for (var i = 0; i < 25 && !front(a.processIdentifier); i++) { a.activateWithOptions(2); delay(0.08); }
34
+ if (!front(a.processIdentifier)) throw new Error('could not bring iPhone Mirroring to the front, so nothing was sent');
35
+ return a;
36
+ }
37
+ function mouse(type, x, y) { $.CGEventPost(0, $.CGEventCreateMouseEvent($(), type, { x: x, y: y }, 0)); }
38
+ var MODS = { cmd: [55, 0x100000], shift: [56, 0x20000], alt: [58, 0x80000], option: [58, 0x80000], ctrl: [59, 0x40000] };
39
+ function keyEv(code, down, flags) { var e = $.CGEventCreateKeyboardEvent($(), code, down); if (flags) $.CGEventSetFlags(e, flags); $.CGEventPost(0, e); }
40
+ function chord(mods, code) {
41
+ var acc = 0;
42
+ mods.forEach(function (m) { acc |= MODS[m][1]; keyEv(MODS[m][0], true, acc); delay(0.01); });
43
+ try { keyEv(code, true, acc); delay(0.03); keyEv(code, false, acc); delay(0.03); }
44
+ finally { mods.slice().reverse().forEach(function (m) { acc &= ~MODS[m][1]; keyEv(MODS[m][0], false, acc); delay(0.01); }); }
45
+ }
46
+ function axTexts(pid) {
47
+ var texts = [], buttons = [];
48
+ function attr(el, name) { var r = Ref(); return $.AXUIElementCopyAttributeValue(el, $(name), r) === 0 ? ObjC.castRefToObject(r[0]) : null; }
49
+ function str(v) { try { return v ? ObjC.unwrap(v) : ''; } catch (e) { return ''; } }
50
+ function walk(el, depth) {
51
+ if (depth > 8) return;
52
+ var role = str(attr(el, 'AXRole')), label = str(attr(el, 'AXValue')) || str(attr(el, 'AXTitle')) || str(attr(el, 'AXDescription'));
53
+ if (typeof label === 'string' && label.trim()) { if (role === 'AXButton') buttons.push(label.trim()); else if (role === 'AXStaticText') texts.push(label.trim()); }
54
+ var kids = attr(el, 'AXChildren'); if (!kids) return;
55
+ for (var i = 0; i < kids.count; i++) walk(kids.objectAtIndex(i), depth + 1);
56
+ }
57
+ var wins = attr($.AXUIElementCreateApplication(pid), 'AXWindows');
58
+ if (!wins || wins.count === 0) return { ok: false };
59
+ walk(wins.objectAtIndex(0), 0);
60
+ return { ok: true, texts: texts, buttons: buttons };
61
+ }
62
+ function run(argv) {
63
+ var verb = argv[0], n = function (i) { var v = Number(argv[i]); if (!isFinite(v)) throw new Error('bad number: ' + argv[i]); return v; };
64
+ if (verb === 'perms') { ObjC.bindFunction('CGPreflightScreenCaptureAccess', ['bool', []]); return out({ accessibility: !!$.AXIsProcessTrusted(), screenRecording: !!$.CGPreflightScreenCaptureAccess() }); }
65
+ if (verb === 'window') {
66
+ var a = app(); if (!a) return out({ running: false });
67
+ var pid = a.processIdentifier, ax = null;
68
+ if ($.AXIsProcessTrusted()) { try { ax = axTexts(pid); } catch (e) { ax = { ok: false }; } }
69
+ return out({ running: true, pid: pid, window: win(pid), front: front(pid), ax: ax });
70
+ }
71
+ if (verb === 'activate') { activate(); return out({ ok: true }); }
72
+ if (verb === 'tap') {
73
+ activate(); var x = n(1), y = n(2), hold = argv[3] ? n(3) : 0.06;
74
+ mouse(5, x, y); delay(0.1); mouse(1, x, y); delay(hold); mouse(2, x, y); return out({ ok: true });
75
+ }
76
+ if (verb === 'drag') {
77
+ activate(); var x1 = n(1), y1 = n(2), x2 = n(3), y2 = n(4), secs = n(5), steps = 14;
78
+ mouse(5, x1, y1); delay(0.1); mouse(1, x1, y1);
79
+ for (var i = 1; i <= steps; i++) { var t = i / steps; mouse(6, x1 + (x2 - x1) * t, y1 + (y2 - y1) * t); delay(secs / steps); }
80
+ mouse(2, x2, y2); return out({ ok: true });
81
+ }
82
+ if (verb === 'scroll') {
83
+ activate(); var sx = n(1), sy = n(2), dy = n(3), dx = n(4), k = 6;
84
+ mouse(5, sx, sy); delay(0.1);
85
+ for (var j = 0; j < k; j++) { var e = $.CGEventCreateScrollWheelEvent2($(), 0, 2, Math.round(dy / k), Math.round(dx / k), 0); $.CGEventSetLocation(e, { x: sx, y: sy }); $.CGEventPost(0, e); delay(0.03); }
86
+ return out({ ok: true });
87
+ }
88
+ if (verb === 'key') { activate(); var parts = argv[1].split('+'); chord(parts.slice(0, -1), n(2)); return out({ ok: true }); }
89
+ if (verb === 'keycodes') {
90
+ activate(); var codes = JSON.parse(argv[1]);
91
+ codes.forEach(function (c) { chord(c[1] ? ['shift'] : [], c[0]); delay(0.03); });
92
+ return out({ ok: true });
93
+ }
94
+ if (verb === 'paste') {
95
+ var pb = $.NSPasteboard.generalPasteboard; pb.clearContents; pb.setStringForType($(argv[1]), $.NSPasteboardTypeString);
96
+ if (ObjC.unwrap(pb.stringForType($.NSPasteboardTypeString)) !== argv[1]) throw new Error('the clipboard did not take the text, so nothing was pasted');
97
+ activate(); delay(0.15); chord(['cmd'], 9); return out({ ok: true });
98
+ }
99
+ if (verb === 'ocr') {
100
+ ObjC.import('Vision');
101
+ var handler = $.VNImageRequestHandler.alloc.initWithURLOptions($.NSURL.fileURLWithPath(argv[1]), $());
102
+ var req = $.VNRecognizeTextRequest.alloc.init; req.recognitionLevel = 0;
103
+ if (!handler.performRequestsError($.NSArray.arrayWithObject(req), $())) throw new Error('Vision text recognition failed');
104
+ var res = req.results, items = [];
105
+ for (var r = 0; r < res.count; r++) {
106
+ var obs = res.objectAtIndex(r), c = obs.topCandidates(1); if (c.count === 0) continue;
107
+ var bb = obs.boundingBox, best = c.objectAtIndex(0);
108
+ items.push({ text: ObjC.unwrap(best.string), confidence: best.confidence, x: bb.origin.x, y: bb.origin.y, w: bb.size.width, h: bb.size.height });
109
+ }
110
+ return out({ items: items });
111
+ }
112
+ throw new Error('unknown verb ' + verb);
113
+ }
114
+ `;
115
+ // US-layout virtual keycodes (mirror.py _KEYCODES / _PUNCT_KEYCODES / _SHIFTED), for keystroke typing and named keys.
116
+ const BASE = {
117
+ a: 0, s: 1, d: 2, f: 3, h: 4, g: 5, z: 6, x: 7, c: 8, v: 9, b: 11, q: 12, w: 13, e: 14, r: 15, y: 16, t: 17, o: 31, u: 32,
118
+ i: 34, p: 35, l: 37, j: 38, k: 40, n: 45, m: 46, "1": 18, "2": 19, "3": 20, "4": 21, "5": 23, "6": 22, "7": 26, "8": 28,
119
+ "9": 25, "0": 29, ".": 47, ",": 43, "/": 44, ";": 41, "'": 39, "[": 33, "]": 30, "\\": 42, "-": 27, "=": 24, "`": 50, " ": 49,
120
+ };
121
+ const SHIFTED = {
122
+ "!": "1", "@": "2", "#": "3", $: "4", "%": "5", "^": "6", "&": "7", "*": "8", "(": "9", ")": "0", _: "-", "+": "=", ":": ";",
123
+ '"': "'", "<": ",", ">": ".", "?": "/", "~": "`", "{": "[", "}": "]", "|": "\\",
124
+ };
125
+ export const NAMED_KEYCODES = {
126
+ return: 36, enter: 36, tab: 48, space: 49, delete: 51, escape: 53, left: 123, right: 124, down: 125, up: 126,
127
+ ...BASE,
128
+ };
129
+ /** Each character → [keycode, needs shift]; null when a character has no US-layout key (emoji, accents). */
130
+ export function keycodesFor(text) {
131
+ const out = [];
132
+ for (const ch of text) {
133
+ if (ch === "\n") {
134
+ out.push([36, false]);
135
+ continue;
136
+ }
137
+ const lower = ch.toLowerCase();
138
+ const upper = ch !== lower;
139
+ const base = SHIFTED[ch] ?? lower;
140
+ const code = BASE[base];
141
+ if (code === undefined)
142
+ return null;
143
+ out.push([code, upper || ch in SHIFTED]);
144
+ }
145
+ return out;
146
+ }
@@ -0,0 +1,90 @@
1
+ // `operator phone setup` and phone_status: scan every backend this OS has, print a checklist (✓ done, ✗ the step that
2
+ // is missing, · not reached yet, – not available on this OS) and the ONE next action. It only reads: no app is opened,
3
+ // no permission is requested (macOS never shows a dialog for it), nothing is tapped. The optional last step — one
4
+ // screenshot and a vision description — runs only when the owner says yes.
5
+ import { deviceDeps } from "./deps.js";
6
+ import { osName } from "./desktop.js";
7
+ import { scanDevices, phoneScreenshot } from "./harness.js";
8
+ const failure = (s) => (s.fix ? `${s.detail} → ${s.fix}` : s.detail);
9
+ function ladder(steps, failedAt, failText) {
10
+ return steps.map((text, i) => i < failedAt ? { mark: "✓", text } : i === failedAt ? { mark: "✗", text: failText ? `${text} — ${failText}` : text } : { mark: "·", text });
11
+ }
12
+ function androidItems(s) {
13
+ const steps = ["adb installed", "phone plugged in (USB debugging on)", "this computer allowed on the phone", "phone unlocked"];
14
+ const at = { "missing-tool": 0, "no-device": 1, unauthorized: 2, offline: 2, locked: 3, ready: 4, unreachable: 0 };
15
+ const items = ladder(steps, at[s.state] ?? 0, s.state === "ready" ? undefined : failure(s));
16
+ if (s.state === "ready")
17
+ items.push({ mark: "✓", text: s.detail });
18
+ return items;
19
+ }
20
+ function iphoneItems(s) {
21
+ if (s.state === "unsupported" && !/macOS \d/.test(s.detail))
22
+ return [{ mark: "–", text: s.detail }];
23
+ const steps = ["macOS 15 or later", "iPhone Mirroring app present", "Accessibility permission", "Screen Recording permission", "iPhone Mirroring open", "iPhone paired", "mirroring session live"];
24
+ let at = 7;
25
+ if (s.state === "unsupported")
26
+ at = 0;
27
+ else if (s.state === "missing-tool")
28
+ at = 1;
29
+ else if (s.state === "permission")
30
+ at = /Accessibility/.test(s.detail) ? 2 : 3;
31
+ else if (s.state === "not-running")
32
+ at = 4;
33
+ else if (s.state === "not-paired")
34
+ at = 5;
35
+ else if (s.state === "blocked" || s.state === "unreachable")
36
+ at = 6;
37
+ const items = ladder(steps, at, s.state === "ready" ? undefined : failure(s));
38
+ if (s.state === "ready")
39
+ items.push({ mark: "✓", text: s.detail });
40
+ return items;
41
+ }
42
+ function desktopItems(s) {
43
+ if (s.state === "unsupported")
44
+ return [{ mark: "–", text: s.detail }];
45
+ return [{ mark: s.state === "ready" ? "✓" : "✗", text: s.state === "ready" ? "Chauffeur reachable (this Mac)" : `Chauffeur reachable — ${failure(s)}` }];
46
+ }
47
+ // How far along a backend got, to pick the next action from the one closest to working.
48
+ const PROGRESS = { "missing-tool": 1, "no-device": 2, unauthorized: 3, offline: 3, permission: 3, "not-running": 4, "not-paired": 5, locked: 6, blocked: 6 };
49
+ export async function setupReport() {
50
+ const statuses = await scanDevices();
51
+ const by = (k) => statuses.find((s) => s.kind === k);
52
+ const sections = [
53
+ { title: "Android (adb)", items: androidItems(by("android")) },
54
+ { title: "iPhone (iPhone Mirroring)", items: iphoneItems(by("iphone")) },
55
+ { title: `Desktop (${osName(deviceDeps().platform)})`, items: desktopItems(by("desktop")) },
56
+ ];
57
+ const ready = statuses.filter((s) => s.state === "ready" && s.kind !== "desktop").map((s) => s.kind);
58
+ let next;
59
+ if (ready.length)
60
+ next = `ready: ${ready.join(" and ")}. Optional last step: one screenshot + a description to confirm Operator sees the phone.`;
61
+ else {
62
+ const phones = statuses.filter((s) => s.kind !== "desktop" && s.fix && s.state !== "unsupported");
63
+ const best = phones.sort((a, b) => (PROGRESS[b.state] ?? 0) - (PROGRESS[a.state] ?? 0))[0];
64
+ next = best ? `${best.kind}: ${best.fix}` : "plug in an Android phone with USB debugging on, or open iPhone Mirroring on a Mac with macOS 15+";
65
+ }
66
+ return { os: osName(deviceDeps().platform), sections, next, ready, statuses };
67
+ }
68
+ export function renderSetup(r) {
69
+ const lines = [`Phone setup — ${r.os}`, ""];
70
+ for (const s of r.sections) {
71
+ lines.push(s.title);
72
+ for (const i of s.items)
73
+ lines.push(` ${i.mark} ${i.text}`);
74
+ lines.push("");
75
+ }
76
+ lines.push(`Next: ${r.next}`);
77
+ return lines.join("\n");
78
+ }
79
+ /** The harmless read-only check: one screenshot of the ready phone and what vision sees on it. */
80
+ export async function readOnlyCheck(device) {
81
+ return phoneScreenshot({ ...(device ? { device } : {}), describe: true });
82
+ }
83
+ /** phone_status: the same checklist; `check: true` adds the read-only screenshot + description (the caller confirmed). */
84
+ export async function phoneStatus(args) {
85
+ const r = await setupReport();
86
+ const text = renderSetup(r);
87
+ if (args.check !== true || !r.ready.length)
88
+ return text;
89
+ return `${text}\n\n--- read-only check ---\n${await readOnlyCheck(typeof args.device === "string" ? args.device : undefined)}`;
90
+ }
@@ -0,0 +1,70 @@
1
+ import { phoneKey, phoneOpenApp, phoneRead, phoneScreenshot, phoneSwipe, phoneTap, phoneType } from "./harness.js";
2
+ import { phoneStatus } from "./setup.js";
3
+ import { DEVICE_KEYS } from "./types.js";
4
+ const BINS = ["adb", "osascript", "screencapture", "chauffeur-local", "chauffeur", "sh"];
5
+ const device = { type: "string", description: 'iphone | android | desktop | an adb serial; default: the one phone that is ready' };
6
+ const intent = { type: "string", enum: ["spend", "send", "account"], description: "declare it when the step pays, sends or changes an account: the owner is asked with a screenshot" };
7
+ const verify = { type: "boolean", description: "default true: a screenshot after the action (its path is returned)" };
8
+ const describe = { type: "boolean", description: "also describe the after screenshot with vision" };
9
+ const ACTION = { v: 1, effects: ["device"], bins: BINS, audit: ["device", "x", "y", "key", "name", "direction"] };
10
+ export const PHONE_TOOLS = [
11
+ {
12
+ name: "phone_status",
13
+ contract: { v: 1, effects: ["read", "device"], bins: [...BINS, "sw_vers"] },
14
+ description: "Setup checklist: which phones and screens Operator can drive here (iPhone via iPhone Mirroring, Android via adb, this desktop), what is done, what is missing, and the one next action.",
15
+ parameters: { type: "object", properties: { check: { type: "boolean", description: "also take one screenshot and describe it (read-only); only after the owner said yes" }, device } },
16
+ run: phoneStatus,
17
+ },
18
+ {
19
+ name: "phone_screenshot",
20
+ contract: { v: 1, effects: ["device", "write"], bins: BINS },
21
+ description: "Screenshot the phone (or desktop): returns the PNG path and its pixel size. Coordinates for phone_tap and phone_swipe are pixels in this image. describe: true adds a vision description.",
22
+ parameters: { type: "object", properties: { device, describe: { type: "boolean" }, question: { type: "string", description: "what to ask vision about the screen" } } },
23
+ run: phoneScreenshot,
24
+ },
25
+ {
26
+ name: "phone_read",
27
+ contract: { v: 1, effects: ["device", "write"], bins: BINS },
28
+ description: "Read the text on the phone screen with positions: Android's accessibility tree, the iPhone window's OCR, Chauffeur on the desktop; vision when none can read it.",
29
+ parameters: { type: "object", properties: { device, vision: { type: "boolean", description: "default true: fall back to vision when no text is readable" } } },
30
+ run: phoneRead,
31
+ },
32
+ {
33
+ name: "phone_tap",
34
+ contract: ACTION,
35
+ description: "Tap on the phone: by x, y (pixels in the latest phone_screenshot) or by the visible text of a button. Screenshot after by default.",
36
+ parameters: { type: "object", properties: { device, x: { type: "number" }, y: { type: "number" }, text: { type: "string", description: "visible label to tap instead of x, y" }, intent, verify, describe } },
37
+ run: phoneTap,
38
+ },
39
+ {
40
+ name: "phone_type",
41
+ contract: ACTION,
42
+ description: "Type text into the focused field on the phone (iPhone: pasted, exact; Android: ASCII). submit: true presses enter after it. Tap the field first.",
43
+ parameters: { type: "object", properties: { device, text: { type: "string" }, submit: { type: "boolean" }, keystrokes: { type: "boolean", description: "iPhone: real key presses instead of paste (US layout, autocorrect applies)" }, intent, verify, describe }, required: ["text"] },
44
+ run: phoneType,
45
+ },
46
+ {
47
+ name: "phone_swipe",
48
+ contract: ACTION,
49
+ description: "Swipe on the phone: direction up/down/left/right (\"up\" scrolls to content further down), or x1, y1 → x2, y2 in screenshot pixels.",
50
+ parameters: { type: "object", properties: { device, direction: { type: "string", enum: ["up", "down", "left", "right"] }, x1: { type: "number" }, y1: { type: "number" }, x2: { type: "number" }, y2: { type: "number" }, duration_ms: { type: "number" }, text: { type: "string", description: "the control it slides, e.g. \"slide to pay\"" }, intent, verify, describe } },
51
+ run: phoneSwipe,
52
+ },
53
+ {
54
+ name: "phone_key",
55
+ contract: ACTION,
56
+ description: "Press a key on the phone: home, back (Android only), recents, enter, delete, volume, … iPhone home/recents/search are Mirroring's Cmd+1/2/3.",
57
+ parameters: { type: "object", properties: { device, key: { type: "string", enum: [...DEVICE_KEYS] }, intent, verify, describe }, required: ["key"] },
58
+ run: phoneKey,
59
+ },
60
+ {
61
+ name: "phone_open_app",
62
+ contract: ACTION,
63
+ description: "Open an app on the phone by name (\"Settings\", \"Maps\"); on Android a package id works too. iPhone opens it through Spotlight.",
64
+ parameters: { type: "object", properties: { device, name: { type: "string" }, verify, describe }, required: ["name"] },
65
+ run: phoneOpenApp,
66
+ },
67
+ ];
68
+ export const PHONE_TOOL_NAMES = PHONE_TOOLS.map((t) => t.name);
69
+ /** The tools that act (and ask outside Autonomous mode); the reads run unprompted like chauffeur's reads. */
70
+ export const PHONE_ACTION_NAMES = ["phone_tap", "phone_type", "phone_swipe", "phone_key", "phone_open_app"];
@@ -0,0 +1,19 @@
1
+ // One interface for every screen Operator drives: the macOS desktop, an iPhone through iPhone Mirroring, an Android
2
+ // phone over adb, and the Windows / Linux desktops still to come. A backend owns everything platform-specific; the
3
+ // tools, the permission gate, the audit trail and the skill are shared (harness.ts, tools.ts). Coordinates are always
4
+ // in the pixels of the backend's latest screenshot, the image the model looked at.
5
+ /** Keys a phone or desktop understands by name. Not every backend has every key (iOS has no Back). */
6
+ export const DEVICE_KEYS = ["home", "back", "recents", "enter", "delete", "tab", "space", "escape", "up", "down", "left",
7
+ "right", "volume_up", "volume_down", "power", "search", "menu"];
8
+ export class Unsupported extends Error {
9
+ constructor(message) { super(message); this.name = "Unsupported"; }
10
+ }
11
+ /** A device the owner has to act on before Operator can (plug in, unlock, tap Allow, grant a permission). */
12
+ export class NeedsOwner extends Error {
13
+ fix;
14
+ constructor(message, fix) {
15
+ super(message);
16
+ this.fix = fix;
17
+ this.name = "NeedsOwner";
18
+ }
19
+ }
@@ -1941,6 +1941,15 @@ async function visionImageDataUrl(image, lim) {
1941
1941
  shrank = true;
1942
1942
  }
1943
1943
  catch {
1944
+ try {
1945
+ // Without sips the size comes from ffprobe, so an image already small enough keeps its own bytes and
1946
+ // type on every OS instead of being re-encoded as JPEG.
1947
+ const { stdout } = await pexec("ffprobe", ["-v", "error", "-select_streams", "v:0", "-show_entries", "stream=width,height", "-of", "csv=p=0:s=x", image]);
1948
+ const [w, h] = stdout.trim().split("x").map(Number);
1949
+ if (w && h && Math.max(w, h) <= lim.maxEdge && buf.length <= lim.maxBytes)
1950
+ return { url: `data:${mime};base64,${buf.toString("base64")}` };
1951
+ }
1952
+ catch { /* no ffprobe: fall through to the resize */ }
1944
1953
  try {
1945
1954
  // non-macOS / sips missing → ffmpeg; min() clamps the fit-box to the image so it never upscales.
1946
1955
  await pexec("ffmpeg", ["-nostdin", "-y", "-loglevel", "error", "-i", image, "-vf", `scale='min(iw,${lim.maxEdge})':'min(ih,${lim.maxEdge})':force_original_aspect_ratio=decrease`, out]);
@@ -2160,7 +2169,7 @@ async function analyzePage(args) {
2160
2169
  return `${head}\n\n${formatDesignRead({ source: shot.finalUrl, seen, ...pixels, ...(css ? { css } : {}) })}`;
2161
2170
  }
2162
2171
  // video_analyze — real video understanding: ffmpeg samples frames evenly across the clip, then the VL model
2163
- // (same Qwen2-VL endpoint, multi-image) describes what happens. Needs ffmpeg on PATH; verified the model
2172
+ // (same vision endpoint, multi-image) describes what happens. Needs ffmpeg on PATH; verified the model
2164
2173
  // synthesizes motion from ordered frames ("calm ocean with gentle waves, golden hue").
2165
2174
  // A video PAGE link (YouTube, Vimeo, … or any url that answers HTML) resolves to a file through yt-dlp, inside
2166
2175
  // MEDIA_CAPS; frames are single ffmpeg seeks at `timestamps` or evenly spaced times, so a long video is never decoded
@@ -3032,11 +3041,11 @@ const TOOLS = [
3032
3041
  {
3033
3042
  name: "browser", safe: false,
3034
3043
  contract: { v: 1, effects: ["fetch", "egress", "exec", "write"], bins: ["chrome"] },
3035
- description: "Drive a REAL headless browser (Chrome over CDP); state persists across calls — JS pages, logins, forms, clicks. Prefer browser_read for content. Actions: open/navigate(url) reload back forward click(selector) fill(selector, text) submit(selector) eval(js, awaits promises) screenshot → png path, tab_select/tab_close(index) close. http/https/about/data URLs only. Login wall: NEVER guess credentials — ask the owner.",
3044
+ description: "Drive a REAL headless browser (Playwright); state persists across calls — JS pages, logins, forms, clicks. Prefer browser_read for content. Actions: open/navigate(url) reload back forward click(selector) fill(selector, text) submit(selector) eval(js, awaits promises) screenshot → png path, tab_select/tab_close(index) close. http/https/about/data URLs only. Login wall: NEVER guess credentials — ask the owner.",
3036
3045
  parameters: { type: "object", properties: {
3037
3046
  action: { type: "string", enum: ["open", "navigate", "reload", "back", "forward", "click", "fill", "submit", "eval", "screenshot", "tab_select", "tab_close", "close"], description: "the browser action" },
3038
3047
  url: { type: "string", description: "for open|navigate" },
3039
- selector: { type: "string", description: "CSS selector for click|fill|submit" },
3048
+ selector: { type: "string", description: "CSS/Playwright selector for click|fill|submit" },
3040
3049
  text: { type: "string", description: "value for fill" },
3041
3050
  js: { type: "string", description: "JS expression for eval" },
3042
3051
  index: { type: "number", description: "tab index" },
package/dist/ui/App.js CHANGED
@@ -30,6 +30,7 @@ import { SecretPrompt } from "./SecretPrompt.js";
30
30
  import { ArtifactPicker } from "./ArtifactPicker.js";
31
31
  import { SessionPicker } from "./SessionPicker.js";
32
32
  import { SkillFinder } from "./SkillFinder.js";
33
+ import { UpdatePrompt } from "./UpdatePrompt.js";
33
34
  import { pendingLines, turnKeySegs } from "./pending.js";
34
35
  import { nextStepLine } from "./nextStep.js";
35
36
  import { centreLayout, switcherLine } from "./conversations.js";
@@ -90,7 +91,7 @@ function ExpandKey({ onExpand, active }) {
90
91
  return null;
91
92
  }
92
93
  export function App(props) {
93
- const { messages, live = null, status, thinkingVerb, verbs, stepLabel, phase = null, fold = null, delegate = null, liveTools = [], route, ctxPct, ctxWindow, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, shellJobs = [], mainLane = null, mainServing, maxRunning, onBackground, tasks = [], planNow, onSubmit, onQueue, onSteer, pending = [], onEditQueued, onDropQueued, nextSteps, onPickNext, onDismissNext, agents = [], onAgentMessage, conversations = [], switcher, onSwitcher, onFocusSwitcher, conversationPane = null, onSendTo, actOffer = null, onActNow, finder = null, onOpenFinder, onInterrupt, onExpand, onCycleMode, onCycleContext, opMode, rcConnected = false, rcActive = false, caffeinated = false, approval = null, onApprovalDecide, question = null, modelPicker = null, secretPrompt = null, planExitPicker = null, artifactsPicker = null, sessionsPicker = null } = props;
94
+ const { messages, live = null, status, thinkingVerb, verbs, stepLabel, phase = null, fold = null, delegate = null, liveTools = [], route, ctxPct, ctxWindow, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, shellJobs = [], mainLane = null, mainServing, maxRunning, onBackground, tasks = [], planNow, onSubmit, onQueue, onSteer, pending = [], onEditQueued, onDropQueued, nextSteps, onPickNext, onDismissNext, agents = [], onAgentMessage, conversations = [], switcher, onSwitcher, onFocusSwitcher, conversationPane = null, onSendTo, actOffer = null, onActNow, finder = null, onOpenFinder, onInterrupt, onExpand, onCycleMode, onCycleContext, opMode, rcConnected = false, rcActive = false, caffeinated = false, approval = null, onApprovalDecide, question = null, modelPicker = null, secretPrompt = null, planExitPicker = null, artifactsPicker = null, sessionsPicker = null, update = null } = props;
94
95
  const cols = useTerminalSize().cols; // subscribe so the inline pinned UI (status rule, composer, footer) reflows the instant the terminal resizes
95
96
  const thinking = status === "thinking" || status === "streaming";
96
97
  // Tool rows exist before their calls run (TUI plan #8): from the first streamed argument (drafting) through waiting
@@ -107,12 +108,12 @@ export function App(props) {
107
108
  // arrives under it (an approval, an ask_user, the plan review) is drawn, waiting, and answered only once the overlay
108
109
  // closes, so nothing typed into the overlay can answer it. With no overlay open a pending prompt owns the keyboard and
109
110
  // the composer gives way, its next-step strip with it. Overlays open only from the composer, so never over a prompt.
110
- const promptUp = !!approval || !!question || !!modelPicker || !!secretPrompt || !!planExitPicker || !!artifactsPicker || !!sessionsPicker;
111
+ const promptUp = !!approval || !!question || !!modelPicker || !!secretPrompt || !!planExitPicker || !!artifactsPicker || !!sessionsPicker || !!update;
111
112
  const owner = finder ? "finder" : switcher?.focused ? "switcher" : promptUp ? "prompt" : "composer";
112
113
  const held = owner === "finder" || owner === "switcher";
113
114
  const waiting = owner === "finder" ? "esc closes the finder, then answer here" : "↑ hands the keyboard back, then answer here";
114
115
  // Prompts are kept out of the fullscreen clip region so they can't be scrolled off.
115
- const prompts = (_jsxs(_Fragment, { children: [_jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }), suspended: held, waiting: waiting }), _jsx(QuestionPrompt, { pending: question, suspended: held, waiting: waiting }), _jsx(QuestionPrompt, { pending: modelPicker, suspended: held, waiting: waiting }), _jsx(SecretPrompt, { pending: secretPrompt, suspended: held }), _jsx(QuestionPrompt, { pending: planExitPicker, suspended: held, waiting: waiting }), _jsx(ArtifactPicker, { pending: artifactsPicker, suspended: held }), _jsx(SessionPicker, { pending: sessionsPicker, suspended: held }), _jsx(SkillFinder, { pending: finder })] }));
116
+ const prompts = (_jsxs(_Fragment, { children: [_jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }), suspended: held, waiting: waiting }), _jsx(QuestionPrompt, { pending: question, suspended: held, waiting: waiting }), _jsx(QuestionPrompt, { pending: modelPicker, suspended: held, waiting: waiting }), _jsx(SecretPrompt, { pending: secretPrompt, suspended: held }), _jsx(QuestionPrompt, { pending: planExitPicker, suspended: held, waiting: waiting }), _jsx(ArtifactPicker, { pending: artifactsPicker, suspended: held }), _jsx(SessionPicker, { pending: sessionsPicker, suspended: held }), _jsx(UpdatePrompt, { pending: update, suspended: held }), _jsx(SkillFinder, { pending: finder })] }));
116
117
  // The pinned bottom band: status rule, composer, bottom rule, then the mode/cycle FOOTER below the rule.
117
118
  // The mode line: the mode on the left, the conversation switcher in the centre, remote control on the right. The centre
118
119
  // gets what the two sides leave, so the row stays at cols−1.