@comput/pi-intercom 0.5.1 → 0.6.1
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 +51 -10
- package/dist/config.d.ts +13 -1
- package/dist/config.js +57 -5
- package/dist/config.js.map +1 -1
- package/dist/handoff.d.ts +87 -0
- package/dist/handoff.js +327 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.js +76 -15
- package/dist/index.js.map +1 -1
- package/dist/monitor-view.d.ts +1 -1
- package/dist/monitor-view.js +49 -3
- package/dist/monitor-view.js.map +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/observability.js +1 -1
- package/dist/observability.js.map +1 -1
- package/dist/pane-close.d.ts +22 -0
- package/dist/pane-close.js +166 -0
- package/dist/pane-close.js.map +1 -0
- package/dist/runtime.d.ts +9 -2
- package/dist/runtime.js +75 -6
- package/dist/runtime.js.map +1 -1
- package/dist/snapshot.d.ts +9 -0
- package/dist/snapshot.js +23 -1
- package/dist/snapshot.js.map +1 -1
- package/dist/transport.d.ts +2 -1
- package/dist/transport.js +4 -1
- package/dist/transport.js.map +1 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/dist/worker-status.d.ts +1 -1
- package/dist/worker-status.js +9 -1
- package/dist/worker-status.js.map +1 -1
- package/package.json +2 -2
- package/references/implementation-blocker.md +1 -1
- package/references/observability.md +13 -3
- package/src/config.ts +49 -4
- package/src/handoff.ts +280 -0
- package/src/index.ts +60 -13
- package/src/monitor-view.ts +48 -4
- package/src/observability.ts +1 -1
- package/src/pane-close.ts +138 -0
- package/src/runtime.ts +63 -7
- package/src/snapshot.ts +22 -1
- package/src/transport.ts +4 -2
- package/src/version.ts +13 -0
- package/src/worker-status.ts +9 -2
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ The value is the loop: **delegate → report back → evaluate → decide the ne
|
|
|
25
25
|
> **0.4.1:** The terminal monitor replaces the browser dashboard. Public worker reports and the read-only JSON worker-status tool keep coordinator decisions separate from observed activity.
|
|
26
26
|
>
|
|
27
27
|
> **0.5.1:** manually closed workers remain registered and sort last as disconnected in the monitor. Optional JSON health checks and guarded resume preserve the distinction between connectivity and saved session identity.
|
|
28
|
+
>
|
|
29
|
+
> **0.6.1:** Linux Herdr background save-handoff-and-close workflow, with saved public summaries in config and monitor/JSON details. Empty rosters no longer open a monitor; coordinator session/tab names are preserved.
|
|
28
30
|
|
|
29
31
|
For potential next steps, see [Improvement topics](references/roadmap.md). These are proposals for discussion, not implemented features or release commitments.
|
|
30
32
|
|
|
@@ -64,7 +66,7 @@ Open Pi inside a Herdr workspace at the project root you want to coordinate, or
|
|
|
64
66
|
|
|
65
67
|
### Know the boundaries
|
|
66
68
|
|
|
67
|
-
- **
|
|
69
|
+
- **Graceful stop remains disabled.** Pi 0.84.4's cancellation behavior leaves retry continuations alive; newer versions are not assumed safe without verification. The Linux Herdr `close_worker` in 0.6.1 has a different contract: request/save a handoff, await final settlement, then attempt an identity-checked external pane close. It does not use Pi abort/shutdown or promise all descendants terminate. Manual closure remains available. See the [cancellation blocker](references/implementation-blocker.md).
|
|
68
70
|
- **No silent recovery.** Intercom does not automatically retry messages, replace workers, switch launchers, commit changes, or roll them back.
|
|
69
71
|
- **Local, not remote.** Messaging binds to loopback. Local processes are trusted; this is not an authenticated service for untrusted clients.
|
|
70
72
|
|
|
@@ -94,7 +96,7 @@ Replace the final path with your checkout's absolute path (use a Windows path on
|
|
|
94
96
|
|
|
95
97
|
Run Pi `/reload` (or start a new interactive session) after installing or changing source; reload workers too when changing their extension code. A standalone monitor already running in its pane needs an explicit restart to load rebuilt display code. Linux supports messaging, configuration, the terminal monitor, and Herdr worker launch/resume. Launch the coordinator inside a Herdr workspace; `herdr`, `sh`, and `pi` must be on PATH in worker panes. Workers run a quoted POSIX shell command in the returned pane, with the coordinator's actual extension path. Project trust remains required.
|
|
96
98
|
|
|
97
|
-
Linux `multiplexer: none` is explicitly unsupported: no terminal guessing, headless fallback, or automatic cleanup.
|
|
99
|
+
Linux `multiplexer: none` is explicitly unsupported: no terminal guessing, headless fallback, or automatic cleanup. Graceful stop remains disabled on both platforms; external pane closure is Linux Herdr only. Automated Linux tests cover shell argument preservation and adapter/HTTP behavior. A live source-loaded Linux Herdr smoke test launched two workers: both registered, loaded their configured names/responsibilities, and acknowledged coordinator messages through Intercom. This verifies launch and round-trip messaging, not resume or cancellation.
|
|
98
100
|
|
|
99
101
|
### Startup and launchers
|
|
100
102
|
|
|
@@ -115,7 +117,7 @@ Existing workers restore responsibility by session ID, bind their saved port or,
|
|
|
115
117
|
|
|
116
118
|
## Tools and permissions
|
|
117
119
|
|
|
118
|
-
Every tool rereads current config and checks the live Pi session ID. Names are case-insensitive for lookup/uniqueness; display capitalization is preserved. `Coordinator` is reserved.
|
|
120
|
+
Every tool rereads current config and checks the live Pi session ID. Names are case-insensitive for lookup/uniqueness; display capitalization is preserved. `Coordinator` is reserved for internal configuration/routing. The coordinator's existing Pi session name and Herdr tab title are preserved; only worker sessions are synchronized to their configured names.
|
|
119
121
|
|
|
120
122
|
| Tool | Arguments | Permission / effect |
|
|
121
123
|
|---|---|---|
|
|
@@ -128,12 +130,14 @@ Every tool rereads current config and checks the live Pi session ID. Names are c
|
|
|
128
130
|
| `intercom_request_status` | `to` (worker name) | Coordinator; independent extension report |
|
|
129
131
|
| `intercom_report_status` | None | Workers including anonymous; shared report function, never registration |
|
|
130
132
|
| `intercom_report_work` | `status`, `summary?` | Configured, responsibility-loaded workers; save a public report and notify coordinator, never approve/complete work |
|
|
131
|
-
| `intercom_stop_worker
|
|
133
|
+
| `intercom_stop_worker` | `to` | Unsupported graceful cancellation; no side effects |
|
|
134
|
+
| `intercom_close_worker` | `to` | Linux Herdr coordinator; request background handoff/save/settle/pane-close job, retain registration |
|
|
135
|
+
| `intercom_report_handoff` | `jobId`, `summary` | Requested worker only; save concise public handoff, then finish the turn and wait |
|
|
132
136
|
| `intercom_resume_worker` | `to`, `confirmClosed` | Coordinator; user-confirmed old-session closure, saved session/launcher/directory, guarded launch |
|
|
133
137
|
| `intercom_remove_worker` | `to` (worker name) | Coordinator; config entry only, no shutdown/session deletion |
|
|
134
138
|
| `intercom_set_multiplexer` | `multiplexer`: `herdr` or `none` | Coordinator; future launches only |
|
|
135
139
|
|
|
136
|
-
**Removal precondition:**
|
|
140
|
+
**Removal precondition:** close a running worker before removing its entry. Removal forgets the registration; it is not how to park a worker for later resume. Active/uncertain close jobs fence removal and other lifecycle/work operations. Saved IDs/ports alone do not prove closure; no force-kill fallback occurs.
|
|
137
141
|
|
|
138
142
|
Anonymous `send`/`list` and all coordinator operations fail explicitly. Anonymous registration and status remain available. A dedicated repeat-registration operation and broader anonymous permissions remain **unresolved contract TODOs**, not silently added tools. If initial registration fails, the worker remains reachable and reports the error locally. Explicit user Pi `/reload` restarts this extension and repeats startup registration; status is not a substitute and there is no automatic retry.
|
|
139
143
|
|
|
@@ -168,7 +172,9 @@ HTTP binds **127.0.0.1 only**. `POST /intercom` accepts UTF-8 JSON, at most 64 K
|
|
|
168
172
|
{"version":1,"kind":"message","from":"sender-session-id","to":"expected-recipient-session-id","payload":{"message":"explicit message"}}
|
|
169
173
|
```
|
|
170
174
|
|
|
171
|
-
|
|
175
|
+
Handoff wire kinds (0.6.1): `close_prepare`, `close_identity`, `close_request`, `handoff_report`, `close_ready`, `close_commit`. These require configured roles, matching job/runtime identity and bounded validated payloads. Pane/process identity is ephemeral protocol data, never stored in public config or summaries.
|
|
176
|
+
|
|
177
|
+
Other kinds: `message`, `report` (`status`, `summary`; configured worker → coordinator only), `registration` (`port`, `projectDirectory`), `status` (`port`, `busy`), `request_status`, `reload`, `stop`, `close` (empty control payload). Sender session identity is the envelope `from`; registration/status agent notifications include an explicit `sessionId` field. Agent messages require configured sender and recipient; controls require the current coordinator's sender ID and a worker recipient. Registration/unknown status are intentional exceptions to configured-sender checks, accepted only by coordinator. All receivers verify expected recipient ID, protecting against stale ports reaching another session. Local processes are trusted: this is role validation, **not authentication**. No remote networking/proxies/redirects or credentials.
|
|
172
178
|
|
|
173
179
|
`202 {"accepted":true}` means Intercom extension receipt/dispatch, **not guaranteed Pi input acceptance, queueing, or model completion**. In Pi 0.84.4, `sendUserMessage` can reject during manual compaction after Intercom has acknowledged receipt: its void extension API reports the asynchronous rejection only as a local host error. Intercom has no delivery queue or retry to repair this gap; inspect the recipient's local error and arrange an explicit resend after compaction if needed. Replacing it with `sendMessage` is not a safe workaround because that path can start a concurrent run. Invalid/unsupported requests return an error; excessive bodies return 413. Request-status sends its report separately after accepting control. Starting in 0.2.1, Intercom always supplies `deliverAs: 'steer'`: Pi starts normally when idle and steers when busy. This avoids the idle-snapshot-to-busy race that caused “Agent is already processing” errors; it does not fix manual-compaction rejection. It does not hard-interrupt an executing tool. Each send resolves the recipient again from config; 5-second receipt deadline, **no retries**. Timeout means unknown outcome, not proof of nondelivery. No durable inbox, deduplication or replay log in V1.
|
|
174
180
|
|
|
@@ -178,9 +184,9 @@ Tool text output is bounded to 50 KiB/2000 lines. The full saved roster remains
|
|
|
178
184
|
|
|
179
185
|
## Standalone terminal status monitor
|
|
180
186
|
|
|
181
|
-
|
|
187
|
+
When at least one worker is registered, the coordinator automatically checks for its monitor pane on startup inside Herdr. If missing, it creates a small pane **above the coordinator**, preserving coordinator focus. With no workers, it does not create/check the monitor. Configuring the first worker triggers the check; disconnected saved workers still count. This does not automatically close an already-existing monitor when the final worker is removed. This is a standalone Node/pi-tui program, **not another Pi instance**. The old inline widget implementation has been removed. Source installations must run `npm run build` before reloading Pi; published packages include the compiled `dist/monitor.js` entry.
|
|
182
188
|
|
|
183
|
-
The table uses aligned **Worker | Connection | Report | Activity | Seen | Last activity** columns (activity age/detail give way first on narrow panes). Report is explicitly worker-authored and separate from host activity. Activity is the last reported `working`, `thinking`, `idle`, `closed`, or `unknown` state. Seen marks evidence older than 60 seconds with `(old)`; this is not a live connection indicator. Last activity uses fixed public labels such as Reading files, Running command or Writing response and can persist after the worker settles. Recent working/thinking/idle observations use restrained colors; old evidence remains neutral and explicitly marked. `NO_COLOR` disables styling. No read-only banner or busy/idle count summary is shown. It reads the bounded config/log snapshot and performs read-only loopback health checks, then refreshes roughly three seconds after completion, without worker prompts or model calls. Checks are bounded by 750 ms per endpoint, a four-second batch budget, 16 concurrent requests and 256 workers; no overlapping batches or retries. Closing the monitor aborts checks. Only observed activity is shown, not inferred assignments/completion. Evidence over 60 seconds old is stale; missing evidence is unknown. The number of worker rows adapts to the pane height, with an omitted count when needed. The display is clipped to pane dimensions. In the monitor pane, use **↑/↓** to select a worker and **Enter** to toggle its details (configured responsibility and observed status). Selection follows the worker across roster reorder and scrolls the visible window. **Escape** closes details first, then quits; **q** or **Ctrl+C** always quits only the display process, never agents or their panes.
|
|
189
|
+
The table uses aligned **Worker | Connection | Report | Activity | Seen | Last activity** columns (activity age/detail give way first on narrow panes). Report is explicitly worker-authored and separate from host activity. Activity is the last reported `working`, `thinking`, `idle`, `closed`, or `unknown` state. Seen marks evidence older than 60 seconds with `(old)`; this is not a live connection indicator. Last activity uses fixed public labels such as Reading files, Running command or Writing response and can persist after the worker settles. Recent working/thinking/idle observations use restrained colors; old evidence remains neutral and explicitly marked. `NO_COLOR` disables styling. Version 0.5.2 adds a small footer label for the Intercom package version loaded by the monitor at startup; restart the monitor after updating to load the new version. Narrow panes use a compact version label and preserve the quit hint. No read-only banner or busy/idle count summary is shown. It reads the bounded config/log snapshot and performs read-only loopback health checks, then refreshes roughly three seconds after completion, without worker prompts or model calls. Checks are bounded by 750 ms per endpoint, a four-second batch budget, 16 concurrent requests and 256 workers; no overlapping batches or retries. Closing the monitor aborts checks. Only observed activity is shown, not inferred assignments/completion. Evidence over 60 seconds old is stale; missing evidence is unknown. The number of worker rows adapts to the pane height, with an omitted count when needed. The display is clipped to pane dimensions. In the monitor pane, use **↑/↓** to select a worker and **Enter** to toggle its details (configured responsibility and observed status). Selection follows the worker across roster reorder and scrolls the visible window. **Escape** closes details first, then quits; **q** or **Ctrl+C** always quits only the display process, never agents or their panes.
|
|
184
190
|
|
|
185
191
|
Detailed phase reports require reloading participating Pi sessions. `thinking` is emitted only when the provider supplies thinking events; missing thinking events do not imply that no reasoning occurred. Streaming content, reasoning text, command arguments and tool outputs are never read or logged for status. Repeated streaming events are deduplicated; concurrent tools are tracked without recording their arguments. Legacy busy observations display as working without invented detail. No task completion is inferred from settlement.
|
|
186
192
|
|
|
@@ -196,7 +202,24 @@ Connection is separate from historical activity and public reports. A recent mat
|
|
|
196
202
|
|
|
197
203
|
After the user confirms the previous session is closed, call `intercom_resume_worker({ to: "Builder", confirmClosed: true })`. It launches the **same saved Pi session**, restores configured identity/responsibility, and does not automatically start an old assignment. A matching connected endpoint blocks resume. Concurrent/submitted/uncertain attempts are fenced locally until a subsequent configured worker status arrives. On uncertain launch with no status, inspect the actual worker process; only after verifying closure should you reload the coordinator and consider an explicit retry. The fence is not persistent or a cross-process uniqueness guarantee. Resume failures do not remove/replace saved identity.
|
|
198
204
|
|
|
199
|
-
`intercom_remove_worker` is only for forgetting the saved registration, not parking a worker.
|
|
205
|
+
`intercom_remove_worker` is only for forgetting the saved registration, not parking a worker. Graceful stop remains disabled; see the background close workflow below. Reload coordinator/workers and restart the standalone monitor to use the new health protocol/UI; these additions require 0.5.1.
|
|
206
|
+
|
|
207
|
+
### Background save-and-close (0.6.1)
|
|
208
|
+
|
|
209
|
+
On supported **Linux + Herdr**, `intercom_close_worker({to:"Builder"})` returns a persisted job ID/state promptly. It does not hold the coordinator model turn open waiting for the worker. The extension performs these steps in the background:
|
|
210
|
+
|
|
211
|
+
1. Obtain and independently verify the worker's current pane, session header, terminal identity and Linux PID/start identity. Never infer ownership from a title/name alone.
|
|
212
|
+
2. Ask that worker to call `intercom_report_handoff({jobId,summary})` with a concise public summary (up to 4000 characters): completed work, unfinished items, blockers, validation and relevant project files. No credentials, private reasoning, raw tool output or private session paths.
|
|
213
|
+
3. Save `Agent.handoff` and `Agent.closeJob` atomically in config; only then acknowledge the worker's report tool. No pane closes at this step.
|
|
214
|
+
4. Wait for a successful matching tool result in the current branch and the worker's final `agent_settled` notification. New input/activity invalidates readiness.
|
|
215
|
+
5. Persist closing intent, recheck pane identity, and make a final nonce-bound worker settlement challenge immediately before issuing one exact `herdr pane close` command.
|
|
216
|
+
6. Observe pane absence and the original worker process's exit. Record `closed` only when both are verified; otherwise retain an explicit failure/uncertainty state. Name, responsibility, session ID and saved handoff remain registered.
|
|
217
|
+
|
|
218
|
+
The latest handoff/job are visible in `intercom_list`, bounded `intercom_worker_status` JSON and monitor details—even while the worker is disconnected. A handoff is worker-authored context, not acceptance of its findings. Config may be source-controlled: keep these summaries non-secret.
|
|
219
|
+
|
|
220
|
+
Jobs have a 120-second deadline and at most 16 simultaneous coordinator jobs. Unsupported hosts, missing identity, missing summary, save failure or absent final settlement never authorize a pane close. Old workers must reload the updated extension first. Active/uncertain jobs fence new Intercom work and conflicting lifecycle/config changes. On coordinator reload, pending jobs become interrupted and closing intent becomes uncertain; no job is automatically replayed. An uncertain persisted job requires explicit operator inspection/recovery of config before a new close/resume/removal—do not erase its fence or retry blindly.
|
|
221
|
+
|
|
222
|
+
**Scope of guarantees:** this is external pane closure, not graceful Pi cancellation. Herdr's pane-ID-only API has no atomic compare-and-close operation; independent local/Telegram input or pane replacement can still race the final check. No guarantee covers escaped child processes or transcript fsync/power-loss durability. Windows/non-Herdr close is unsupported. A disposable ordinary Node process was verified to exit on pane closure in local Linux Herdr 0.9.1; that is not a full live Pi handoff/history test. No existing project worker was closed during validation.
|
|
200
223
|
|
|
201
224
|
### JSON worker status for agents and chat integrations
|
|
202
225
|
|
|
@@ -256,6 +279,24 @@ The workflow validates on Windows and Linux, then publishes with provenance from
|
|
|
256
279
|
|
|
257
280
|
Published versions are immutable. For a new release, bump package and lockfile versions, commit/push, then publish a matching GitHub release. Manual dispatch publishes the selected ref and is **not a dry run**; the release-tag check only applies when a release tag is present. Do not dispatch publishing for an already published version. CI validates pushes to `main` and pull requests separately without publishing.
|
|
258
281
|
|
|
282
|
+
### 0.6.1 Background handoff-and-close and quiet startup
|
|
283
|
+
|
|
284
|
+
- First npm release of these features: the preserved 0.6.0 GitHub tag failed Windows validation and was not published to npm.
|
|
285
|
+
- Windows config publication handles transient `EPERM` replacement failures with bounded filesystem-only attempts and lifecycle/deadline checks before each attempt. Worker close commands, messages and jobs are never retried by this safeguard. Persistent contention can still prevent publication; an unpersisted terminal close outcome retains the existing intent/fence for operator inspection and reload recovery.
|
|
286
|
+
|
|
287
|
+
- Explicit Linux Herdr close jobs request and save a public worker handoff, await final settlement, then attempt one identity-checked pane close in the background. Worker registration, responsibility and session ID remain saved.
|
|
288
|
+
- Persist latest handoff and close-job status in config; show them in monitor details and JSON worker status. Correlation, deadlines, lifecycle guards and uncertainty fences prevent automatic replay.
|
|
289
|
+
- Empty rosters do not open/check the monitor; configuring the first worker triggers setup. Disconnected saved workers still count.
|
|
290
|
+
- Preserve the coordinator's existing Pi session name and Herdr tab title; worker naming remains synchronized.
|
|
291
|
+
- Validation includes typecheck, workflow/platform regression tests and isolated package installation. An isolated ordinary-process pane-close check passed on Linux Herdr 0.9.1; full live Pi handoff/history and Windows pane termination are not claimed.
|
|
292
|
+
- Upgrade coordinator/workers and restart the monitor. Close is Linux Herdr only, not graceful Pi abort or an all-descendants termination guarantee. Config-root discovery and connectivity polling architecture are unchanged.
|
|
293
|
+
|
|
294
|
+
### 0.5.2 Monitor version footer
|
|
295
|
+
|
|
296
|
+
- Display the monitor's loaded Intercom package version at the bottom-right, with a compact label on narrow panes and preserved quit hints.
|
|
297
|
+
- Read validated version metadata from the monitor's own package once at startup, not from the working directory. Restart the monitor after updating to load the new version.
|
|
298
|
+
- Add footer geometry, metadata validation and installed-package version checks. Local typecheck, 135 tests and isolated package-install validation passed.
|
|
299
|
+
|
|
259
300
|
### 0.5.1 Retained disconnected workers
|
|
260
301
|
|
|
261
302
|
The 0.5.0 release did not publish to npm because an occupied-port fallback exposed duplicate listener counting in test instrumentation. 0.5.1 fixes the test hook and forces that fallback deterministically, without changing production listener behavior. The 0.5.0 tag is unchanged.
|
|
@@ -338,5 +379,5 @@ The release/session evidence reported during the 0.1.2 validation establishes th
|
|
|
338
379
|
- Windows visible terminal/Pi process startup. Success only proves terminal creation, **not Pi readiness**; startup failures remain visible in that terminal. No live readiness handshake was added.
|
|
339
380
|
- Actual persisted-session lookup and resumed worker startup; never-used session failure.
|
|
340
381
|
- Cross-process/network-drive atomicity and Windows ACL/sharing failures (same-process temp-filesystem races are tested).
|
|
341
|
-
-
|
|
382
|
+
- Graceful stop remains disabled until a verified cancellation API covers retries, compaction continuations and queues. The Linux Herdr pane-close workflow is a separately authorized best-effort contract, not a claim that graceful cancellation was fixed.
|
|
342
383
|
- Explicit repeat-registration tool and broad anonymous permissions require a contract decision. Duplicate-session locks, takeover, durable logging, non-Herdr Linux launchers and macOS support are deferred.
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Handoff, type CloseJob } from './handoff.js';
|
|
1
2
|
export interface Agent {
|
|
2
3
|
sessionId: string;
|
|
3
4
|
name: string;
|
|
@@ -7,6 +8,8 @@ export interface Agent {
|
|
|
7
8
|
/** Legacy browser dashboard field, accepted for migration only; removed at coordinator startup. */
|
|
8
9
|
dashboardPort?: number;
|
|
9
10
|
projectDirectory: string;
|
|
11
|
+
handoff?: Handoff;
|
|
12
|
+
closeJob?: CloseJob;
|
|
10
13
|
}
|
|
11
14
|
export interface Config {
|
|
12
15
|
version: 1;
|
|
@@ -24,16 +27,25 @@ export declare const coordinator: (c: Config) => Agent;
|
|
|
24
27
|
export declare function named(c: Config, name: string): Agent;
|
|
25
28
|
export declare function requireCoordinator(c: Config, id: string): Agent;
|
|
26
29
|
export declare function directory(root: string, requested: string): Promise<string>;
|
|
30
|
+
export interface ConfigStoreOptions {
|
|
31
|
+
/** Publication seams for deterministic platform/race tests. */
|
|
32
|
+
platform?: NodeJS.Platform;
|
|
33
|
+
rename?: (from: string, to: string) => Promise<void>;
|
|
34
|
+
delay?: (milliseconds: number) => Promise<void>;
|
|
35
|
+
now?: () => number;
|
|
36
|
+
}
|
|
27
37
|
export declare class ConfigStore {
|
|
28
38
|
readonly root: string;
|
|
39
|
+
private readonly options;
|
|
29
40
|
readonly file: string;
|
|
30
41
|
private tail;
|
|
31
|
-
constructor(root: string);
|
|
42
|
+
constructor(root: string, options?: ConfigStoreOptions);
|
|
32
43
|
read(): Promise<Config>;
|
|
33
44
|
static discover(cwd: string): Promise<ConfigStore | undefined>;
|
|
34
45
|
protected openTemporary(file: string): Promise<import("fs/promises").FileHandle>;
|
|
35
46
|
private temporary;
|
|
36
47
|
initialize(id: string, boundPort: number, assertValid?: () => void): Promise<boolean>;
|
|
48
|
+
private publish;
|
|
37
49
|
update(id: string, mutate: (config: Config) => void | Promise<void>, assertValid?: () => void): Promise<Config>;
|
|
38
50
|
configure(id: string, values: Omit<Agent, 'coordinator'>, assertValid?: () => void): Promise<Config>;
|
|
39
51
|
}
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdir, readFile, realpath, rename, unlink, open, link, stat } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import { fencedClose, validateHandoff, validateCloseJob } from './handoff.js';
|
|
4
5
|
export const DEFAULT_DESCRIPTION = 'Coordinate workers, delegate work, and manage shared configuration.';
|
|
5
6
|
export const key = (name) => name.toLowerCase();
|
|
6
7
|
export function fail(message) { throw new Error(`PiIntercom: ${message}`); }
|
|
@@ -32,6 +33,16 @@ export function validateConfig(value) {
|
|
|
32
33
|
fail('invalid name');
|
|
33
34
|
port(a.port);
|
|
34
35
|
relativeDirectory(a.projectDirectory);
|
|
36
|
+
if (a.handoff !== undefined) {
|
|
37
|
+
if (a.coordinator)
|
|
38
|
+
fail('handoff is worker-only');
|
|
39
|
+
validateHandoff(a.handoff);
|
|
40
|
+
}
|
|
41
|
+
if (a.closeJob !== undefined) {
|
|
42
|
+
if (a.coordinator)
|
|
43
|
+
fail('closeJob is worker-only');
|
|
44
|
+
validateCloseJob(a.closeJob);
|
|
45
|
+
}
|
|
35
46
|
if (a.dashboardPort !== undefined) {
|
|
36
47
|
if (!a.coordinator)
|
|
37
48
|
fail('dashboardPort is coordinator-only');
|
|
@@ -67,12 +78,16 @@ export async function directory(root, requested) {
|
|
|
67
78
|
fail('projectDirectory is not a directory');
|
|
68
79
|
return rel.split(path.sep).join('/') || '.';
|
|
69
80
|
}
|
|
81
|
+
const RENAME_DELAYS = [10, 20, 40, 80];
|
|
82
|
+
const RENAME_BUDGET_MS = 250;
|
|
70
83
|
export class ConfigStore {
|
|
71
84
|
root;
|
|
85
|
+
options;
|
|
72
86
|
file;
|
|
73
87
|
tail = Promise.resolve();
|
|
74
|
-
constructor(root) {
|
|
88
|
+
constructor(root, options = {}) {
|
|
75
89
|
this.root = root;
|
|
90
|
+
this.options = options;
|
|
76
91
|
this.file = path.join(root, '.pi-intercom', 'config.json');
|
|
77
92
|
}
|
|
78
93
|
async read() {
|
|
@@ -141,6 +156,35 @@ export class ConfigStore {
|
|
|
141
156
|
throw error;
|
|
142
157
|
}
|
|
143
158
|
}
|
|
159
|
+
async publish(temp, assertValid) {
|
|
160
|
+
const replace = this.options.rename ?? rename;
|
|
161
|
+
const now = this.options.now ?? (() => performance.now());
|
|
162
|
+
const delay = this.options.delay ?? (milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds)));
|
|
163
|
+
const started = now();
|
|
164
|
+
let originalError;
|
|
165
|
+
for (let attempt = 0;; attempt++) {
|
|
166
|
+
// Windows readers can briefly deny replace-rename. Retry only publication
|
|
167
|
+
// of this already synced/closed temp, never the mutation or any OS action
|
|
168
|
+
// outside config persistence. The elapsed budget bounds retry initiation,
|
|
169
|
+
// not the duration of an already-submitted OS rename.
|
|
170
|
+
assertValid();
|
|
171
|
+
if (attempt > 0 && now() - started >= RENAME_BUDGET_MS)
|
|
172
|
+
throw originalError;
|
|
173
|
+
try {
|
|
174
|
+
await replace(temp, this.file);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
if ((this.options.platform ?? process.platform) !== 'win32' || error.code !== 'EPERM')
|
|
179
|
+
throw error;
|
|
180
|
+
originalError ??= error;
|
|
181
|
+
const backoff = RENAME_DELAYS[attempt];
|
|
182
|
+
if (backoff === undefined || now() - started + backoff >= RENAME_BUDGET_MS)
|
|
183
|
+
throw originalError;
|
|
184
|
+
await delay(backoff);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
144
188
|
async update(id, mutate, assertValid = () => { }) {
|
|
145
189
|
const operation = this.tail.then(async () => {
|
|
146
190
|
assertValid();
|
|
@@ -152,9 +196,9 @@ export class ConfigStore {
|
|
|
152
196
|
validateConfig(c);
|
|
153
197
|
const temp = await this.temporary(c);
|
|
154
198
|
try {
|
|
155
|
-
//
|
|
156
|
-
|
|
157
|
-
await
|
|
199
|
+
// Every publication attempt checks the lifecycle/deadline guard; an
|
|
200
|
+
// already submitted OS rename still cannot be undone.
|
|
201
|
+
await this.publish(temp, assertValid);
|
|
158
202
|
}
|
|
159
203
|
catch (error) {
|
|
160
204
|
await unlink(temp).catch(() => { });
|
|
@@ -174,8 +218,16 @@ export class ConfigStore {
|
|
|
174
218
|
const index = c.agents.findIndex(old => old.sessionId === a.sessionId);
|
|
175
219
|
if (index < 0)
|
|
176
220
|
c.agents.push(a);
|
|
177
|
-
else
|
|
221
|
+
else {
|
|
222
|
+
const old = c.agents[index];
|
|
223
|
+
if (fencedClose(old.closeJob))
|
|
224
|
+
fail('worker close is active or uncertain; configuration is fenced');
|
|
225
|
+
if (old.handoff)
|
|
226
|
+
a.handoff = old.handoff;
|
|
227
|
+
if (old.closeJob)
|
|
228
|
+
a.closeJob = old.closeJob;
|
|
178
229
|
c.agents[index] = a;
|
|
230
|
+
}
|
|
179
231
|
}, assertValid);
|
|
180
232
|
}
|
|
181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,wCAAwC,CAAC,CAAC;YAClG,MAAM,gBAAgB,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC7E,MAAM,CAAC,GAAU,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;YAC9J,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC;YACvE,IAAI,KAAK,GAAG,CAAC;gBAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBAC3B,CAAC;gBACJ,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC5B,IAAI,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;oBAAE,IAAI,CAAC,8DAA8D,CAAC,CAAC;gBACpG,IAAI,GAAG,CAAC,OAAO;oBAAE,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;gBACzC,IAAI,GAAG,CAAC,QAAQ;oBAAE,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;gBAC5C,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC;QACH,CAAC,EAAE,WAAW,CAAC,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Agent, Config } from './config.js';
|
|
2
|
+
export interface WorkerPaneIdentity {
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
paneId: string;
|
|
5
|
+
terminalId: string;
|
|
6
|
+
sessionId: string;
|
|
7
|
+
sessionFile: string;
|
|
8
|
+
pid: number;
|
|
9
|
+
processStart: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CloseProvider {
|
|
12
|
+
getIdentity(): Promise<WorkerPaneIdentity>;
|
|
13
|
+
inspect(identity: WorkerPaneIdentity, expectedSessionId: string, assertCurrent: () => void): Promise<void>;
|
|
14
|
+
close(identity: WorkerPaneIdentity, expectedSessionId: string, assertCurrent: () => void, beforeSubmit: () => Promise<void>): Promise<{
|
|
15
|
+
paneClosed: boolean;
|
|
16
|
+
workerExited: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export type CloseReason = 'timeout' | 'interrupted' | 'delivery_failed' | 'identity_failed' | 'save_failed' | 'worker_changed' | 'worker_busy' | 'commit_rejected' | 'close_unverified' | 'close_failed';
|
|
20
|
+
export type CloseState = 'requested' | 'awaiting_handoff' | 'awaiting_settlement' | 'ready' | 'closing' | 'closed' | 'failed' | 'timed_out' | 'interrupted' | 'uncertain';
|
|
21
|
+
export interface Handoff {
|
|
22
|
+
version: 1;
|
|
23
|
+
summary: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
jobId: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CloseJob {
|
|
28
|
+
jobId: string;
|
|
29
|
+
state: CloseState;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
deadlineAt: string;
|
|
33
|
+
reason?: CloseReason;
|
|
34
|
+
}
|
|
35
|
+
export type HandoffKind = 'close_prepare' | 'close_identity' | 'close_request' | 'handoff_report' | 'close_ready' | 'close_commit';
|
|
36
|
+
export declare const HANDOFF_KINDS: readonly string[];
|
|
37
|
+
export declare const pendingClose: (job?: CloseJob) => boolean;
|
|
38
|
+
export declare const fencedClose: (job?: CloseJob) => boolean;
|
|
39
|
+
export declare function validateIdentity(value: unknown): asserts value is WorkerPaneIdentity;
|
|
40
|
+
export declare function validateHandoff(value: unknown): asserts value is Handoff;
|
|
41
|
+
export declare function validateCloseJob(value: unknown): asserts value is CloseJob;
|
|
42
|
+
export declare function validateHandoffPayload(kind: string, p: Record<string, unknown>): void;
|
|
43
|
+
interface Context {
|
|
44
|
+
state(): Promise<{
|
|
45
|
+
id: string;
|
|
46
|
+
config: Config;
|
|
47
|
+
me?: Agent;
|
|
48
|
+
}>;
|
|
49
|
+
assertCurrent(): void;
|
|
50
|
+
update(mutate: (config: Config) => void, guard?: () => void): Promise<void>;
|
|
51
|
+
send(sessionId: string, kind: HandoffKind, payload: Record<string, unknown>): Promise<void>;
|
|
52
|
+
deliver(message: string): void;
|
|
53
|
+
busy(): boolean;
|
|
54
|
+
provider?: CloseProvider;
|
|
55
|
+
timeoutMs?: number;
|
|
56
|
+
}
|
|
57
|
+
/** Extension-owned asynchronous protocol. No host abort, shutdown, automatic retries or guessed pane targets. */
|
|
58
|
+
export declare class HandoffWorkflow {
|
|
59
|
+
private readonly ctx;
|
|
60
|
+
private readonly instanceId;
|
|
61
|
+
private jobs;
|
|
62
|
+
private worker?;
|
|
63
|
+
private epoch;
|
|
64
|
+
private disposed;
|
|
65
|
+
private readonly timeout;
|
|
66
|
+
constructor(ctx: Context);
|
|
67
|
+
private valid;
|
|
68
|
+
private background;
|
|
69
|
+
dispose(): void;
|
|
70
|
+
recover(): Promise<void>;
|
|
71
|
+
private assertJob;
|
|
72
|
+
private target;
|
|
73
|
+
private transition;
|
|
74
|
+
private finish;
|
|
75
|
+
request(target: Agent): Promise<CloseJob>;
|
|
76
|
+
workerStarted(): void;
|
|
77
|
+
workerSettled(successfulToolCallIds: ReadonlySet<string>): void;
|
|
78
|
+
private assertWorker;
|
|
79
|
+
get workerClosing(): boolean;
|
|
80
|
+
isClosing(sessionId: string): boolean;
|
|
81
|
+
report(jobId: unknown, summary: unknown, toolCallId?: string): Promise<{
|
|
82
|
+
saved: true;
|
|
83
|
+
closure: 'awaiting_turn_settlement';
|
|
84
|
+
}>;
|
|
85
|
+
receive(kind: HandoffKind, from: string, payload: Record<string, unknown>): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
export {};
|