remote-pi-app 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -80,7 +80,7 @@ both:
80
80
 
81
81
  Several Pi instances running side-by-side in different terminals can discover
82
82
  each other and exchange messages. Each instance is a peer in a named
83
- *session*. The LLM uses:
83
+ _session_. The LLM uses:
84
84
 
85
85
  - `list_peers` — discover current peer routing addresses
86
86
  - `agent_send` — unicast waits for the broker delivery ACK; broadcast is
@@ -98,8 +98,8 @@ addresses over the relay; local-only use stays on UDS when relay access is off.
98
98
  Useful for splitting work across roles (`backend`, `frontend`, `tests`,
99
99
  `orchestrator`, …) and letting them coordinate.
100
100
 
101
- The first agent to enter a session becomes the *leader* (hosts the broker);
102
- the rest are *followers*. If the leader exits, a follower automatically takes
101
+ The first agent to enter a session becomes the _leader_ (hosts the broker);
102
+ the rest are _followers_. If the leader exits, a follower automatically takes
103
103
  over — the failover is invisible to the LLMs.
104
104
 
105
105
  ### 2) Mobile app (over the relay)
@@ -129,12 +129,12 @@ Beyond the chat, the app surfaces a small set of typed actions you can run
129
129
  on the paired Pi session. Tap the ⚙ button next to the message input (visible
130
130
  when the input is empty) to open the Quick Actions sheet:
131
131
 
132
- | Action | What it does |
133
- |---|---|
134
- | **Compact context** | Runs `ctx.compact()` — same as `/compact` in the TUI. |
135
- | **New session** | Runs `ctx.newSession()` — equivalent to `/new`, asks for confirmation first. |
136
- | **Model** | Opens a model picker fed by your authenticated providers (same source the TUI uses) and switches via `pi.setModel(model)`. |
137
- | **Thinking** | Segmented control with the 6 SDK levels (`off` · `minimal` · `low` · `medium` · `high` · `xhigh`). Changes via `pi.setThinkingLevel(level)`. |
132
+ | Action | What it does |
133
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
134
+ | **Compact context** | Runs `ctx.compact()` — same as `/compact` in the TUI. |
135
+ | **New session** | Runs `ctx.newSession()` — equivalent to `/new`, asks for confirmation first. |
136
+ | **Model** | Opens a model picker fed by your authenticated providers (same source the TUI uses) and switches via `pi.setModel(model)`. |
137
+ | **Thinking** | Segmented control with the 6 SDK levels (`off` · `minimal` · `low` · `medium` · `high` · `xhigh`). Changes via `pi.setThinkingLevel(level)`. |
138
138
 
139
139
  Each action gets a structured `action_ok` / `action_error` reply so the app
140
140
  can show a SnackBar on failure. Visible side-effects (chat output, model
@@ -202,11 +202,11 @@ The bare command is the everyday entry point:
202
202
 
203
203
  Behavior depends on whether there's a local config for this directory:
204
204
 
205
- | State | What happens |
206
- |---|---|
205
+ | State | What happens |
206
+ | ------------------------------------------ | ---------------------------------------------------------------------------------------- |
207
207
  | First run (no `.pi/remote-pi/config.json`) | Interactive wizard → saves config → joins agent session → starts relay (if you opted in) |
208
- | Returning user, auto-start enabled | Joins agent session + starts relay automatically, then prints status |
209
- | Returning user, auto-start disabled | Prints status only; join/relay must be run manually |
208
+ | Returning user, auto-start enabled | Joins agent session + starts relay automatically, then prints status |
209
+ | Returning user, auto-start disabled | Prints status only; join/relay must be run manually |
210
210
 
211
211
  The wizard asks three questions:
212
212
 
@@ -393,12 +393,12 @@ log at `~/.pi/remote/sessions/<name>/audit.jsonl` for postmortem inspection.
393
393
 
394
394
  Useful commands:
395
395
 
396
- | Command | What it does |
397
- |---|---|
398
- | `/remote-pi` | Join the local mesh (and start the relay, if enabled) |
399
- | `/remote-pi peers` | List local + cross-PC mesh peers, grouped by PC |
400
- | `/remote-pi rename <new>` | Rename this agent in the current session |
401
- | `/remote-pi stop` | Leave the local mesh and disconnect the relay |
396
+ | Command | What it does |
397
+ | ------------------------- | ----------------------------------------------------- |
398
+ | `/remote-pi` | Join the local mesh (and start the relay, if enabled) |
399
+ | `/remote-pi peers` | List local + cross-PC mesh peers, grouped by PC |
400
+ | `/remote-pi rename <new>` | Rename this agent in the current session |
401
+ | `/remote-pi stop` | Leave the local mesh and disconnect the relay |
402
402
 
403
403
  Name collisions inside a session get a numeric suffix automatically
404
404
  (`backend`, `backend#2`, `backend#3`). The broker assigns it and returns the
@@ -410,40 +410,40 @@ real name to the peer.
410
410
 
411
411
  ### Local session (one Pi, one terminal)
412
412
 
413
- | Command | Description |
414
- |---|---|
415
- | `/remote-pi` | Connect (join local mesh + start relay), or run setup on first use |
416
- | `/remote-pi setup` | Run the setup wizard and update local config |
417
- | `/remote-pi status` | Show local mesh + relay status |
418
- | `/remote-pi stop` | Stop everything for **this** terminal (mesh + relay) |
419
- | `/remote-pi pair` | Show QR code + copy-paste pairing URI for a new mobile device |
420
- | `/remote-pi devices` | List paired mobile devices (online/offline per device) |
421
- | `/remote-pi revoke <shortid>` | Revoke a paired device by its shortid |
422
- | `/remote-pi set-relay <url>` | Persist a new relay URL (http:// or https://) |
413
+ | Command | Description |
414
+ | ---------------------------------------- | ------------------------------------------------------------------------------ |
415
+ | `/remote-pi` | Connect (join local mesh + start relay), or run setup on first use |
416
+ | `/remote-pi setup` | Run the setup wizard and update local config |
417
+ | `/remote-pi status` | Show local mesh + relay status |
418
+ | `/remote-pi stop` | Stop everything for **this** terminal (mesh + relay) |
419
+ | `/remote-pi pair` | Show QR code + copy-paste pairing URI for a new mobile device |
420
+ | `/remote-pi devices` | List paired mobile devices (online/offline per device) |
421
+ | `/remote-pi revoke <shortid>` | Revoke a paired device by its shortid |
422
+ | `/remote-pi set-relay <url>` | Persist a new relay URL (http:// or https://) |
423
423
  | `/remote-pi relay [start\|stop\|status]` | Relay-only control — leaves local mesh membership untouched (no verb = toggle) |
424
- | `/remote-pi relay url <url>` | Same as `set-relay` |
425
- | `/remote-pi config` | Show the effective relay URL and its source (env / config / default) |
424
+ | `/remote-pi relay url <url>` | Same as `set-relay` |
425
+ | `/remote-pi config` | Show the effective relay URL and its source (env / config / default) |
426
426
 
427
427
  ### Daemon fleet (one supervisor, N background Pis — see [Daemon mode](#daemon-mode))
428
428
 
429
- | Command | Description |
430
- |---|---|
431
- | `/remote-pi create <cwd> [--name X]` | Register a folder as a daemon |
432
- | `/remote-pi remove <id>` | Unregister a daemon (local config preserved) |
433
- | `/remote-pi daemons` | List registered daemons + state |
434
- | `/remote-pi daemon start` | Start every registered daemon |
435
- | `/remote-pi daemon stop` | Stop every running daemon (`/remote-pi stop` stops only the local terminal) |
436
- | `/remote-pi daemon restart` | Stop + start all daemons |
437
- | `/remote-pi daemon status` | Detailed runtime status (pid, uptime, restart count) |
438
- | `/remote-pi daemon send <id> "<text>"` | Send a prompt to a specific daemon |
429
+ | Command | Description |
430
+ | ---------------------------------------------- | ----------------------------------------------------------------------------- |
431
+ | `/remote-pi create <cwd> [--name X]` | Register a folder as a daemon |
432
+ | `/remote-pi remove <id>` | Unregister a daemon (local config preserved) |
433
+ | `/remote-pi daemons` | List registered daemons + state |
434
+ | `/remote-pi daemon start` | Start every registered daemon |
435
+ | `/remote-pi daemon stop` | Stop every running daemon (`/remote-pi stop` stops only the local terminal) |
436
+ | `/remote-pi daemon restart` | Stop + start all daemons |
437
+ | `/remote-pi daemon status` | Detailed runtime status (pid, uptime, restart count) |
438
+ | `/remote-pi daemon send <id> "<text>"` | Send a prompt to a specific daemon |
439
439
  | `/remote-pi cron add <id> "<expr>" "<prompt>"` | Schedule a recurring prompt (`--tz`, `--wake`, `--no-skip-busy`, `--catchup`) |
440
- | `/remote-pi cron list` | List scheduled jobs (schedule, enabled, next run, last status) |
441
- | `/remote-pi cron run <jobId>` | Fire a job now (ignores its schedule) |
442
- | `/remote-pi cron enable\|disable <jobId>` | Toggle a job on/off |
443
- | `/remote-pi cron remove <jobId>` | Delete a job |
444
- | `/remote-pi cron log [<jobId>] [--tail N]` | Read the fire/skip audit log |
445
- | `/remote-pi install` | Install `pi-supervisord` as a system service |
446
- | `/remote-pi uninstall` | Remove the system service (registry preserved) |
440
+ | `/remote-pi cron list` | List scheduled jobs (schedule, enabled, next run, last status) |
441
+ | `/remote-pi cron run <jobId>` | Fire a job now (ignores its schedule) |
442
+ | `/remote-pi cron enable\|disable <jobId>` | Toggle a job on/off |
443
+ | `/remote-pi cron remove <jobId>` | Delete a job |
444
+ | `/remote-pi cron log [<jobId>] [--tail N]` | Read the fire/skip audit log |
445
+ | `/remote-pi install` | Install `pi-supervisord` as a system service |
446
+ | `/remote-pi uninstall` | Remove the system service (registry preserved) |
447
447
 
448
448
  All commands above work both as Pi slash commands (interactive) and as
449
449
  shell-level `remote-pi <subcommand>` when the package is installed
@@ -455,7 +455,7 @@ globally (`npm install -g remote-pi`).
455
455
  supervisor — e.g. a daily "summarise new PRs". Output flows fire-and-forget to
456
456
  the mesh/app like any prompt; the cron layer only audits the dispatch.
457
457
 
458
- - **Schedule** is a cron expression (croner syntax; an optional 6th *seconds*
458
+ - **Schedule** is a cron expression (croner syntax; an optional 6th _seconds_
459
459
  field is supported), with an optional IANA timezone via `--tz`:
460
460
 
461
461
  ```sh
@@ -514,6 +514,7 @@ remote-pi install
514
514
  ```
515
515
 
516
516
  The `install` command:
517
+
517
518
  - Writes `~/.config/systemd/user/remote-pi-supervisord.service` (Linux)
518
519
  or `~/Library/LaunchAgents/dev.remotepi.supervisord.plist` (macOS)
519
520
  - Activates it via `systemctl --user enable --now` or `launchctl bootstrap`
@@ -565,10 +566,10 @@ registered daemon back. To wipe the registry entirely, `rm
565
566
 
566
567
  ### Where to find logs
567
568
 
568
- | Platform | Command |
569
- |---|---|
570
- | Linux | `journalctl --user -u remote-pi-supervisord -f` |
571
- | macOS | `tail -f ~/.pi/remote/supervisord.log` |
569
+ | Platform | Command |
570
+ | -------- | ----------------------------------------------- |
571
+ | Linux | `journalctl --user -u remote-pi-supervisord -f` |
572
+ | macOS | `tail -f ~/.pi/remote/supervisord.log` |
572
573
 
573
574
  Each spawned daemon's stderr is forwarded into the supervisor's log
574
575
  with a `[<cwd>]` prefix, so a single log stream shows every agent.
@@ -592,13 +593,13 @@ with a `[<cwd>]` prefix, so a single log stream shows every agent.
592
593
 
593
594
  ## Configuration files
594
595
 
595
- | Path | Scope | What's in it |
596
- |---|---|---|
597
- | `<cwd>/.pi/remote-pi/config.json` | Per-directory | `agent_name`, `session_name`, `auto_start_relay` |
598
- | `~/.pi/remote/config.json` | Per-user | `relay` URL |
599
- | `~/.pi/remote/peers.json` | Per-machine | Paired mobile devices |
600
- | `~/.pi/remote/sessions/<name>/` | Per-session | Broker socket + `audit.jsonl` |
601
- | `~/.pi/remote/skills/agent-network/SKILL.md` | Per-user | Agent skill the LLM reads |
596
+ | Path | Scope | What's in it |
597
+ | -------------------------------------------- | ------------- | ------------------------------------------------ |
598
+ | `<cwd>/.pi/remote-pi/config.json` | Per-directory | `agent_name`, `session_name`, `auto_start_relay` |
599
+ | `~/.pi/remote/config.json` | Per-user | `relay` URL |
600
+ | `~/.pi/remote/peers.json` | Per-machine | Paired mobile devices |
601
+ | `~/.pi/remote/sessions/<name>/` | Per-session | Broker socket + `audit.jsonl` |
602
+ | `~/.pi/remote/skills/agent-network/SKILL.md` | Per-user | Agent skill the LLM reads |
602
603
 
603
604
  Override the relay for a single run without persisting:
604
605
 
@@ -611,7 +612,7 @@ REMOTE_PI_RELAY=https://staging.example.tld pi
611
612
  ## Troubleshooting
612
613
 
613
614
  **Footer says `🟡 relay waiting for pairing` even though I paired a device.**
614
- The icon reflects whether *any* device has been paired on this machine, not
615
+ The icon reflects whether _any_ device has been paired on this machine, not
615
616
  whether one is connected right now. If you really have a paired device in
616
617
  `/remote-pi devices`, restart Pi — the cache may be stale (fixed in current
617
618
  release; report a bug if it recurs).
@@ -98,6 +98,18 @@ export declare function _npmShimTarget(cmdPath: string): string | null;
98
98
  * is `get_state.isStreaming` (see `RpcChild.refreshBusy`).
99
99
  */
100
100
  export declare function busyTransition(line: string): boolean | null;
101
+ /**
102
+ * Parses an RPC `extension_ui_request` line emitted by the Pi child.
103
+ *
104
+ * Pi's RPC UI context writes these frames to stdout for every `ctx.ui.*` call
105
+ * (select/confirm/input/editor/notify/setStatus/setWidget/setTitle/
106
+ * set_editor_text). The supervisor forwards them to the paired app over the UI
107
+ * socket; before this they were dropped, so a plugin's UI call hung forever.
108
+ */
109
+ export declare function parseUiRequestLine(line: string): ({
110
+ type: "extension_ui_request";
111
+ id: string;
112
+ } & Record<string, unknown>) | null;
101
113
  /**
102
114
  * CLI args for the daemon's `pi --mode rpc` child.
103
115
  *
@@ -170,6 +182,18 @@ export declare class RpcChild extends EventEmitter {
170
182
  * Returns false if the child isn't running (caller decides how to report).
171
183
  */
172
184
  sendPrompt(text: string, requestId?: string): boolean;
185
+ /**
186
+ * Answers an RPC `extension_ui_request` the child emitted (select / confirm /
187
+ * input / editor / notify). The supervisor forwards these from a paired app
188
+ * over the UI socket; the response must carry the request's `id`. Returns
189
+ * false when the child isn't running.
190
+ */
191
+ sendUiResponse(response: {
192
+ id: string;
193
+ value?: string;
194
+ confirmed?: boolean;
195
+ cancelled?: boolean;
196
+ }): boolean;
173
197
  /**
174
198
  * Asks the child to exit gracefully. Sends SIGTERM; if the child doesn't
175
199
  * exit within `timeoutMs`, escalates to SIGKILL. Resolves when the
@@ -127,6 +127,27 @@ function parseGetStateResponse(line) {
127
127
  isStreaming: typeof data?.isStreaming === "boolean" ? data.isStreaming : undefined,
128
128
  };
129
129
  }
130
+ /**
131
+ * Parses an RPC `extension_ui_request` line emitted by the Pi child.
132
+ *
133
+ * Pi's RPC UI context writes these frames to stdout for every `ctx.ui.*` call
134
+ * (select/confirm/input/editor/notify/setStatus/setWidget/setTitle/
135
+ * set_editor_text). The supervisor forwards them to the paired app over the UI
136
+ * socket; before this they were dropped, so a plugin's UI call hung forever.
137
+ */
138
+ export function parseUiRequestLine(line) {
139
+ let obj;
140
+ try {
141
+ obj = JSON.parse(line);
142
+ }
143
+ catch {
144
+ return null;
145
+ }
146
+ const o = obj;
147
+ if (!o || o.type !== "extension_ui_request" || typeof o.id !== "string")
148
+ return null;
149
+ return o;
150
+ }
130
151
  /**
131
152
  * CLI args for the daemon's `pi --mode rpc` child.
132
153
  *
@@ -276,6 +297,24 @@ export class RpcChild extends EventEmitter {
276
297
  return false;
277
298
  }
278
299
  }
300
+ /**
301
+ * Answers an RPC `extension_ui_request` the child emitted (select / confirm /
302
+ * input / editor / notify). The supervisor forwards these from a paired app
303
+ * over the UI socket; the response must carry the request's `id`. Returns
304
+ * false when the child isn't running.
305
+ */
306
+ sendUiResponse(response) {
307
+ if (!this.child || !this.child.stdin || this._state !== "running")
308
+ return false;
309
+ const cmd = { type: "extension_ui_response", ...response };
310
+ try {
311
+ this.child.stdin.write(JSON.stringify(cmd) + "\n");
312
+ return true;
313
+ }
314
+ catch {
315
+ return false;
316
+ }
317
+ }
279
318
  /**
280
319
  * Asks the child to exit gracefully. Sends SIGTERM; if the child doesn't
281
320
  * exit within `timeoutMs`, escalates to SIGKILL. Resolves when the
@@ -328,6 +367,9 @@ export class RpcChild extends EventEmitter {
328
367
  pending.resolve(this._busy);
329
368
  }
330
369
  }
370
+ const uiRequest = parseUiRequestLine(line);
371
+ if (uiRequest)
372
+ this.emit("ui_request", uiRequest);
331
373
  this.emit("stdout", line);
332
374
  }
333
375
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"rpc_child.js","sourceRoot":"","sources":["../../src/daemon/rpc_child.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAoB,MAAM,4BAA4B,CAAC;AAiDjG,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;mFAGmF;AACnF,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAw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E,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAA8B,CAAC,CAAC;IAC3E,CAAC;IAED;4EACwE;IACxE,WAAW;QACT,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -25,6 +25,10 @@ export declare function decideFireAction(o: {
25
25
  export declare class Supervisor {
26
26
  private readonly opts;
27
27
  private server;
28
+ /** Persistent UI socket: one long-lived connection per running daemon child,
29
+ * keyed by daemon id. See `ui_bridge.ts` for the child side. */
30
+ private uiServer;
31
+ private readonly uiClients;
28
32
  private readonly children;
29
33
  /** Live croner schedules, keyed by cron job id (plan/39). */
30
34
  private readonly cronJobs;
@@ -37,6 +41,17 @@ export declare class Supervisor {
37
41
  private _mkdirParent;
38
42
  private _bindUds;
39
43
  private _onConnection;
44
+ /**
45
+ * Bind the persistent UI socket. Unlike the control socket (one request →
46
+ * one reply → close), each extension child holds its connection open for its
47
+ * whole life so `ctx.ui.*` frames can stream in both directions.
48
+ */
49
+ private _bindUiUds;
50
+ private _onUiConnection;
51
+ /** Forward one `extension_ui_request` frame from a daemon child to its
52
+ * connected app bridge. No-op when no bridge is attached — the RPC call
53
+ * then hits its own timeout, matching pre-primitive-B behavior. */
54
+ private _pushUiFrame;
40
55
  private _handleRequest;
41
56
  private _listInfo;
42
57
  private _opStartAll;
@@ -91,3 +106,5 @@ export declare function _idForCwdForTest(cwd: string): string;
91
106
  /** Exported for the bin/supervisord entry + tests to know where the
92
107
  * supervisor will bind. */
93
108
  export declare function getSupervisorSockPath(): string;
109
+ /** Exported for `daemon/ui_bridge.ts` (the child side) + tests. */
110
+ export declare function getSupervisorUiSockPath(): string;
@@ -31,6 +31,7 @@ import { appendCronLog, readCronLog } from "./cron_log.js";
31
31
  * the registry and re-spawns everything.
32
32
  */
33
33
  const SUPERVISOR_SOCK_NAME = "supervisor.sock";
34
+ const SUPERVISOR_UI_SOCK_NAME = "supervisor-ui.sock";
34
35
  /** Backoff schedule for auto-restart after a crash. After exhausting, the
35
36
  * child stays in `crashed` state until manual `restart_all` or fresh
36
37
  * registry add. Keeps logs sane when the agent dies on every boot. */
@@ -40,6 +41,14 @@ function supervisorSockPath() {
40
41
  // POSIX → ~/.pi/remote/supervisor.sock; Windows → per-user named pipe (plan/40).
41
42
  return ipcAddress("supervisor", join(root, ".pi", "remote", SUPERVISOR_SOCK_NAME));
42
43
  }
44
+ /** Persistent newline-JSON UDS the daemon extension children connect to so the
45
+ * supervisor can forward their `ctx.ui.*` frames to the paired app and route
46
+ * the app's answers back. Separate from the request/reply control socket
47
+ * because these connections stay open for the child's whole life. */
48
+ function uiSockPath() {
49
+ const root = process.env["REMOTE_PI_HOME"] || homedir();
50
+ return ipcAddress("supervisor-ui", join(root, ".pi", "remote", SUPERVISOR_UI_SOCK_NAME));
51
+ }
43
52
  /** Thrown by `start()` when another live supervisor already holds the UDS.
44
53
  * Prevents a second supervisor from orphaning the first's children. */
45
54
  export class SupervisorAlreadyRunningError extends Error {
@@ -78,6 +87,10 @@ export function decideFireAction(o) {
78
87
  export class Supervisor {
79
88
  opts;
80
89
  server = null;
90
+ /** Persistent UI socket: one long-lived connection per running daemon child,
91
+ * keyed by daemon id. See `ui_bridge.ts` for the child side. */
92
+ uiServer = null;
93
+ uiClients = new Map();
81
94
  children = new Map();
82
95
  /** Live croner schedules, keyed by cron job id (plan/39). */
83
96
  cronJobs = new Map();
@@ -92,6 +105,7 @@ export class Supervisor {
92
105
  // field) so every daemon has a stable name to inject via env.
93
106
  migrateRegistryNames();
94
107
  await this._bindUds();
108
+ await this._bindUiUds();
95
109
  this._spawnAllFromRegistry();
96
110
  // Cron (plan/39): schedule all enabled jobs, then run any missed catchup.
97
111
  this._reconcileCron();
@@ -127,6 +141,20 @@ export class Supervisor {
127
141
  }
128
142
  catch { /* ignored */ }
129
143
  }
144
+ // Close the persistent UI socket + drop every attached extension client.
145
+ await new Promise((resolve) => {
146
+ if (!this.uiServer)
147
+ return resolve();
148
+ this.uiServer.close(() => resolve());
149
+ });
150
+ this.uiServer = null;
151
+ this.uiClients.clear();
152
+ if (!usesNamedPipe()) {
153
+ try {
154
+ unlinkSync(uiSockPath());
155
+ }
156
+ catch { /* ignored */ }
157
+ }
130
158
  }
131
159
  // ── UDS binding ──────────────────────────────────────────────────────────
132
160
  _mkdirParent() {
@@ -179,6 +207,100 @@ export class Supervisor {
179
207
  });
180
208
  socket.on("error", () => { });
181
209
  }
210
+ // ── Extension UI socket (plan/58 primitive B) ────────────────────────────
211
+ /**
212
+ * Bind the persistent UI socket. Unlike the control socket (one request →
213
+ * one reply → close), each extension child holds its connection open for its
214
+ * whole life so `ctx.ui.*` frames can stream in both directions.
215
+ */
216
+ async _bindUiUds() {
217
+ const path = uiSockPath();
218
+ const pipe = usesNamedPipe();
219
+ // A stale file from a crashed supervisor would make `listen` fail; the
220
+ // control-socket single-instance guard already ran, so it is safe to clear.
221
+ if (!pipe && existsSync(path)) {
222
+ try {
223
+ unlinkSync(path);
224
+ }
225
+ catch { /* will throw on bind if still held */ }
226
+ }
227
+ const server = createServer((socket) => this._onUiConnection(socket));
228
+ await new Promise((resolve, reject) => {
229
+ server.once("error", reject);
230
+ server.listen(path, () => resolve());
231
+ });
232
+ this.uiServer = server;
233
+ }
234
+ _onUiConnection(socket) {
235
+ let buf = "";
236
+ // The daemon id this socket announced via `ui_hello`; set once, then used
237
+ // to route every `ui_response` line back to the right child.
238
+ let daemonId = null;
239
+ socket.setEncoding("utf8");
240
+ socket.on("data", (chunk) => {
241
+ buf += chunk;
242
+ let nl;
243
+ while ((nl = buf.indexOf("\n")) >= 0) {
244
+ const line = buf.slice(0, nl);
245
+ buf = buf.slice(nl + 1);
246
+ if (!line.trim())
247
+ continue;
248
+ let obj;
249
+ try {
250
+ obj = JSON.parse(line);
251
+ }
252
+ catch {
253
+ continue;
254
+ }
255
+ if (!obj || typeof obj !== "object")
256
+ continue;
257
+ const o = obj;
258
+ if (o["op"] === "ui_hello") {
259
+ const id = o["daemon_id"];
260
+ if (typeof id !== "string")
261
+ continue;
262
+ daemonId = id;
263
+ this.uiClients.set(id, socket);
264
+ }
265
+ else if (o["op"] === "ui_response") {
266
+ if (!daemonId)
267
+ continue;
268
+ const rpcId = o["id"];
269
+ if (typeof rpcId !== "string")
270
+ continue;
271
+ const response = { id: rpcId };
272
+ if (typeof o["value"] === "string")
273
+ response.value = o["value"];
274
+ if (typeof o["confirmed"] === "boolean")
275
+ response.confirmed = o["confirmed"];
276
+ if (o["cancelled"] === true)
277
+ response.cancelled = true;
278
+ this.children.get(daemonId)?.child.sendUiResponse(response);
279
+ }
280
+ // Unknown op → ignore (forward-compat).
281
+ }
282
+ });
283
+ socket.on("close", () => {
284
+ // Only drop the mapping if it still points at THIS socket (a reconnect
285
+ // for the same daemon replaces the map entry before the old close fires).
286
+ if (daemonId && this.uiClients.get(daemonId) === socket) {
287
+ this.uiClients.delete(daemonId);
288
+ }
289
+ });
290
+ socket.on("error", () => { });
291
+ }
292
+ /** Forward one `extension_ui_request` frame from a daemon child to its
293
+ * connected app bridge. No-op when no bridge is attached — the RPC call
294
+ * then hits its own timeout, matching pre-primitive-B behavior. */
295
+ _pushUiFrame(daemonId, frame) {
296
+ const sock = this.uiClients.get(daemonId);
297
+ if (!sock)
298
+ return;
299
+ try {
300
+ sock.write(JSON.stringify({ op: "ui_request", frame }) + "\n");
301
+ }
302
+ catch { /* client gone; drop the frame */ }
303
+ }
182
304
  // ── Request dispatch ─────────────────────────────────────────────────────
183
305
  async _handleRequest(line) {
184
306
  let req;
@@ -552,6 +674,7 @@ export class Supervisor {
552
674
  const slot = { id, cwd, child, restartTimer: null, restartAttempt: 0 };
553
675
  this.children.set(id, slot);
554
676
  child.on("exit", (evt) => this._onChildExit(id, evt));
677
+ child.on("ui_request", (frame) => this._pushUiFrame(id, frame));
555
678
  child.spawn();
556
679
  }
557
680
  _onChildExit(id, evt) {
@@ -593,4 +716,6 @@ export function _idForCwdForTest(cwd) { return daemonIdForCwd(cwd); }
593
716
  /** Exported for the bin/supervisord entry + tests to know where the
594
717
  * supervisor will bind. */
595
718
  export function getSupervisorSockPath() { return supervisorSockPath(); }
719
+ /** Exported for `daemon/ui_bridge.ts` (the child side) + tests. */
720
+ export function getSupervisorUiSockPath() { return uiSockPath(); }
596
721
  //# sourceMappingURL=supervisor.js.map