@fitchmultz/pi-subagents 0.50.0 → 0.51.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.
- package/CHANGELOG.md +51 -2
- package/README.md +36 -5
- package/dist/agent/contracts.js +6 -24
- package/dist/agent/host.js +3 -16
- package/dist/agent/index.js +207 -173
- package/dist/agent/journal-tail.js +115 -156
- package/dist/agent/launch.js +20 -8
- package/dist/agent/legacy.js +65 -23
- package/dist/agent/notifications.js +138 -47
- package/dist/agent/observation-state.js +246 -0
- package/dist/agent/observation-view.js +258 -0
- package/dist/agent/observation.js +346 -0
- package/dist/agent/observe-card.js +243 -0
- package/dist/agent/observe-chrome.js +85 -0
- package/dist/agent/observe-client.js +285 -0
- package/dist/agent/observe-layout.js +65 -0
- package/dist/agent/observe-reading.js +84 -0
- package/dist/agent/observe-screen.js +400 -96
- package/dist/agent/observe-transcript.js +382 -0
- package/dist/agent/observe.js +250 -43
- package/dist/agent/process.js +198 -25
- package/dist/agent/receipts.js +92 -20
- package/dist/agent/runner.js +125 -20
- package/dist/agent/shell.js +2 -1
- package/dist/agent/storage.js +29 -12
- package/dist/agent/tool-schemas.js +20 -0
- package/dist/agent/typebox.js +10 -5
- package/dist/agent/usage.js +0 -115
- package/dist/agent/view.js +46 -16
- package/dist/agent/wake.js +99 -0
- package/dist/build-info.js +1 -1
- package/dist/intercom-client.d.ts +26 -0
- package/dist/intercom-client.js +45 -0
- package/dist/pi-intercom/agent-dir.d.ts +1 -0
- package/dist/pi-intercom/bridge-session.js +2 -1
- package/dist/pi-intercom/broker/broker.js +27 -21
- package/dist/pi-intercom/broker/client-last.d.ts +13 -0
- package/dist/pi-intercom/broker/client-last.js +17 -5
- package/dist/pi-intercom/broker/client.d.ts +60 -0
- package/dist/pi-intercom/broker/client.js +47 -16
- package/dist/pi-intercom/broker/connection.d.ts +29 -0
- package/dist/pi-intercom/broker/framing.d.ts +17 -0
- package/dist/pi-intercom/broker/framing.js +10 -7
- package/dist/pi-intercom/broker/guard.js +23 -0
- package/dist/pi-intercom/broker/last.d.ts +26 -0
- package/dist/pi-intercom/broker/last.js +57 -32
- package/dist/pi-intercom/broker/paths.d.ts +13 -0
- package/dist/pi-intercom/broker/paths.js +35 -12
- package/dist/pi-intercom/broker/pid.js +5 -1
- package/dist/pi-intercom/broker/server-connection.js +19 -0
- package/dist/pi-intercom/broker/snapshot-reader.d.ts +9 -0
- package/dist/pi-intercom/broker/snapshots.d.ts +29 -0
- package/dist/pi-intercom/broker/targets.d.ts +9 -0
- package/dist/pi-intercom/connection.js +10 -2
- package/dist/pi-intercom/identity.js +6 -5
- package/dist/pi-intercom/inbound-delivery.js +16 -60
- package/dist/pi-intercom/inbound-journal.js +83 -6
- package/dist/pi-intercom/inbound-record.js +18 -1
- package/dist/pi-intercom/inbound.js +12 -38
- package/dist/pi-intercom/index.js +3 -0
- package/dist/pi-intercom/last-message.js +4 -16
- package/dist/pi-intercom/lifecycle.js +88 -3
- package/dist/pi-intercom/outbound.js +5 -15
- package/dist/pi-intercom/reply-tracker.js +7 -6
- package/dist/pi-intercom/reply-wait.js +2 -2
- package/dist/pi-intercom/session-targets.d.ts +24 -0
- package/dist/pi-intercom/tool-registration.js +4 -1
- package/dist/pi-intercom/tool-results.js +5 -7
- package/dist/pi-intercom/tool-schemas.js +12 -26
- package/dist/pi-intercom/types.d.ts +212 -0
- package/dist/pi-intercom/types.js +54 -3
- package/dist/pi-intercom/validation.d.ts +12 -0
- package/dist/pi-intercom/validation.js +3 -0
- package/dist/shared/bounded-json.js +151 -0
- package/dist/shared/compact-cards.js +66 -0
- package/dist/shared/journal-frames.js +3 -6
- package/dist/shared/json-projection.js +267 -129
- package/dist/shared/native-journal.js +123 -56
- package/dist/shared/post-exit-stdio-guard.js +120 -7
- package/dist/shared/tui-action.js +29 -0
- package/dist/shared/unknown.d.ts +9 -0
- package/docs/code-quality.md +2 -0
- package/docs/development.md +40 -1
- package/docs/intercom-bridge.md +9 -4
- package/docs/intercom.md +226 -6
- package/docs/performance.md +87 -11
- package/docs/reference.md +157 -20
- package/docs/retired-history-maintenance.md +252 -0
- package/package.json +28 -15
- package/scripts/archive-retired-history.mjs +464 -0
- package/scripts/build.mjs +48 -28
- package/scripts/measure-size.mjs +1 -1
- package/scripts/native-package-smoke.mjs +153 -12
- package/scripts/package-smoke.mjs +80 -11
- package/scripts/prepare.mjs +2 -2
- package/scripts/real-pi-live.mjs +377 -0
- package/scripts/real-pi-processes.mjs +6 -1
- package/scripts/real-pi-smoke.mjs +6 -282
- package/scripts/run-tests.mjs +4 -2
- package/scripts/typescript.mjs +35 -0
- package/skills/pi-intercom/SKILL.md +2 -1
- package/skills/pi-subagents/SKILL.md +23 -5
- package/src/agent/contracts.ts +8 -34
- package/src/agent/host.ts +19 -20
- package/src/agent/index.ts +224 -190
- package/src/agent/journal-tail.ts +141 -153
- package/src/agent/launch.ts +33 -9
- package/src/agent/legacy.ts +85 -31
- package/src/agent/notifications.ts +192 -67
- package/src/agent/observation-state.ts +277 -0
- package/src/agent/observation-view.ts +267 -0
- package/src/agent/observation.ts +405 -0
- package/src/agent/observe-card.ts +304 -0
- package/src/agent/observe-chrome.ts +170 -0
- package/src/agent/observe-client.ts +318 -0
- package/src/agent/observe-layout.ts +79 -0
- package/src/agent/observe-reading.ts +97 -0
- package/src/agent/observe-screen.ts +443 -129
- package/src/agent/observe-transcript.ts +434 -0
- package/src/agent/observe.ts +304 -71
- package/src/agent/process.ts +240 -34
- package/src/agent/receipts.ts +114 -24
- package/src/agent/runner.ts +125 -27
- package/src/agent/shell.ts +2 -1
- package/src/agent/storage.ts +27 -11
- package/src/agent/tool-schemas.ts +33 -0
- package/src/agent/typebox.ts +12 -7
- package/src/agent/usage.ts +0 -130
- package/src/agent/view.ts +70 -20
- package/src/agent/wake.ts +107 -0
- package/src/intercom-client.ts +108 -0
- package/src/pi-intercom/bridge-session.ts +2 -2
- package/src/pi-intercom/broker/broker.ts +27 -23
- package/src/pi-intercom/broker/client-last.ts +25 -12
- package/src/pi-intercom/broker/client.ts +55 -33
- package/src/pi-intercom/broker/framing.ts +11 -8
- package/src/pi-intercom/broker/guard.ts +33 -0
- package/src/pi-intercom/broker/last.ts +86 -33
- package/src/pi-intercom/broker/paths.ts +39 -12
- package/src/pi-intercom/broker/pid.ts +6 -1
- package/src/pi-intercom/broker/server-connection.ts +25 -0
- package/src/pi-intercom/connection.ts +21 -10
- package/src/pi-intercom/identity.ts +8 -5
- package/src/pi-intercom/inbound-delivery.ts +20 -66
- package/src/pi-intercom/inbound-journal.ts +103 -7
- package/src/pi-intercom/inbound-record.ts +21 -4
- package/src/pi-intercom/inbound.ts +18 -49
- package/src/pi-intercom/index.ts +3 -0
- package/src/pi-intercom/last-message.ts +10 -19
- package/src/pi-intercom/lifecycle.ts +117 -14
- package/src/pi-intercom/outbound.ts +7 -16
- package/src/pi-intercom/reply-tracker.ts +8 -6
- package/src/pi-intercom/reply-wait.ts +3 -2
- package/src/pi-intercom/runtime-types.ts +0 -1
- package/src/pi-intercom/tool-registration.ts +4 -1
- package/src/pi-intercom/tool-results.ts +10 -9
- package/src/pi-intercom/tool-schemas.ts +12 -44
- package/src/pi-intercom/types.ts +115 -4
- package/src/pi-intercom/validation.ts +4 -0
- package/src/shared/bounded-json.ts +162 -0
- package/src/shared/compact-cards.ts +118 -0
- package/src/shared/journal-frames.ts +3 -19
- package/src/shared/json-projection.ts +267 -147
- package/src/shared/native-journal.ts +157 -75
- package/src/shared/post-exit-stdio-guard.ts +165 -7
- package/src/shared/tui-action.ts +39 -0
- package/tsconfig.client.json +8 -0
- package/tsconfig.json +1 -0
- package/src/shared/stream-json.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.
|
|
3
|
+
## [0.51.0] - 2026-10-26
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Publish `@fitchmultz/pi-subagents/intercom-client`, a typed non-model client for the existing native broker. Require `spawn:false`, preserve caller-recorded guarded message IDs, and expose discovery, non-waking pinned last pages, original-ID receipts and explicit socket cleanup without loading Pi, a model or another journal. Reject overlapping sends with one pending ID instead of replacing its acknowledgement waiter.
|
|
8
|
+
|
|
9
|
+
- Read non-waking native receipts by original message ID and expose version-1 process-local provenance from the loaded journal owner. Preserve exact root and departed-sender binding, independently hash the raw sender text, and return selected publication metadata without input text or a public parser. Keep append, staging, handoff and actual placement observations separate from fsync and provider/model consumption. Ordinary active-branch `last` paging is unchanged.
|
|
10
|
+
- Negotiate conditional Intercom commands bound to one exact native main, peer, context incarnation and companion-owned application revision. Check the binding at broker routing and native admission, expose the original lifecycle snapshot through a versioned process-local event handshake, and render generic correlated-publication hints without creating ordinary asks. Startup, reload and session replacement invalidate old handles; transport reconnect preserves the context. Ordinary local names, asks and main/child topology are unchanged. This does not install an external client, export native work or strengthen broker acceptance into a recipient receipt.
|
|
11
|
+
|
|
12
|
+
### Breaking
|
|
13
|
+
|
|
14
|
+
- Make child execution asynchronous-only. `delegate` and `agent_runs` no longer accept `async`, and `agent_runs` no longer has `wait`; launches, continuations and guidance return honest receipts, and existing completion notifications resume the parent. A blocking wait held the parent's tool batch open, so admitted Intercom steering could not reach it until the child finished. Aborting a parent turn no longer stops children; use `stop`. New calls no longer attribute child usage to the parent; child results keep exactly-once native contributions, and historical parent charges remain unchanged. The opt-in `smoke:real-pi -- --llm`/`--llm-full` prompts now keep a persistent RPC main open until each launch or continuation receipt's completion notification resumes it, then close it and confirm the delegated actor exits.
|
|
15
|
+
- Remove the Intercom busy-recipient detach probe and its timer. Steers go straight to Pi's native queue for the next tool boundary.
|
|
16
|
+
- Stop child actors and verified owned native shells when their parent exits, including active work and asynchronous delegation from one-shot callers. Keep saved conversations for explicit continuation after parent resume; do not replay interrupted tools. Ordinary extension reload keeps children alive.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Keep the parent and child event loops responsive while they check whether children and parents are still alive. On macOS each check waited on a `ps` run; `/agents`, `agent_runs` lists and each child's parent check now wait on it in the background, and a list checks each saved conversation once instead of once per run. Stop and continuation still prove the process birth synchronously right before signaling.
|
|
21
|
+
- Validate large child journals with an incremental scanner that decodes selected or observed string chunks, replacing stream-json's tokenizer. The package no longer depends on stream-json or stream-chain.
|
|
22
|
+
- Let Stop and continuation release a saved actor or native-shell PID that another user's process now holds, when its native birth proves replacement. Permission-denied probes previously blocked that existing proof, stranding children after a reboot. Unverified identities, unreadable births and claims written after the current process still refuse without signaling.
|
|
23
|
+
- Keep `/agents` working after a live install refresh removes package-local development copies of Pi. Lazy-only viewer modules now resolve UI and SDK values through the selected host. Sessions already using the current viewer API recover on their next `/agents` after installing the fix. Sessions started from the published v0.50.0 package need to restart Pi.
|
|
24
|
+
- Report `reply_failed` with pending/list recovery when an Intercom reply's `to` names a different sender than its `replyTo` ask. A `to` containing "too short" was previously misreported as an ambiguous reply target; recovery codes now come from the failing owner, not message wording.
|
|
25
|
+
- Add an opt-in offline archive command for the retired SQLite history index, with private inventory, whole-set identity checks and prepared/completed retry reconciliation. Refuse unsafe entries, links, foreign ownership, active handles and cross-filesystem moves. Upgrades leave the directory untouched; archiving never deletes or reclaims file allocations. Releases v0.44.0–v0.49.1 can still reopen the data, so owner-enforced quiescence remains required. See the [maintenance guide](docs/retired-history-maintenance.md).
|
|
26
|
+
- Keep the last-good `dist/` when the build fails after compiling. The build now moves the previous tree aside and renames it back if publication fails, instead of deleting it first. Replacement is two renames, not an atomic exchange: a concurrent reader can briefly find no `dist/`, but never a partial tree. A build killed between the two renames can still leave `dist/` absent until the next successful build.
|
|
27
|
+
- Parse child launch lineage once, exactly. Absent root and parent IDs mean a main; otherwise both must be identical, nonempty and unpadded, or the package refuses to load. Padded IDs are no longer trimmed into a different Intercom identity.
|
|
28
|
+
- Keep children running across a managed fork `pi restart` or `/restart` and publish their completions once from the ready replacement. With the fork's `ctx.managedHost`, the launcher owns child liveness; an unready replacement neither adopts children nor publishes, a committed restart or startup rollback keeps them, and parent exit (including quitting an unready replacement) still stops them. Official Pi and older fork launchers keep process-lifetime ownership.
|
|
29
|
+
- Restore native Android/Termux source builds and typechecking with installed Android `tsgo`, place shared sockets under the writable Termux prefix, publish exclusive records atomically without denied hard links, and verify reused PIDs with a boot-qualified monotonic elapsed-age bound that survives controller clock changes. Preserve no-clobber claims, private complete records, existing macOS/Linux namespaces, and native continuation/stop/recovery contracts.
|
|
30
|
+
- Stop idle mains and child actors from rescanning saved runs and commands several times a second. Mains reconcile when a run, child journal or legacy result changes, and after settlement or controls; actors scan commands on change, stop or a deferred run. A one-second stat check of the same inputs recovers change notifications the OS drops. Canonical results, admissions and journal receipts still decide delivery; unwatchable directories keep the previous polling.
|
|
31
|
+
- Stop reparsing unchanged completed child results and searching historical receipts on every completion poll. Keep physical journal validation, chronological delivery and pending-accounting repair.
|
|
32
|
+
- Preserve native Markdown formatting in collapsed message cards, including legacy human relays, and show clickable expansion hints only when content is hidden.
|
|
33
|
+
- Skip provably reused child and native-shell PIDs during Stop, continuation and parent shutdown, including unrelated non-group-leaders. Keep genuine identity uncertainty visible and verified orphan cleanup intact; timezone differences alone never prove replacement.
|
|
34
|
+
- List only active (and unreadable) child runs in the above-editor widget and remove it once a complete scan finds no active work. Stopped, failed and interrupted history stays in `/agents`, direct watch and saved run records.
|
|
35
|
+
- Resolve explicit child `provider/model:thinking` overrides with Pi's native model-reference API when available. Preserve literal colon IDs and inherited thinking, reject fuzzy/fallback selection, and explain the host API requirement on older runtimes.
|
|
36
|
+
- Restore fullscreen click-to-watch on named child rows and clickable `/agents` navigation. Keep regular-mode keyboard controls and read-only observation.
|
|
37
|
+
- Collapse lengthy agent/Intercom result and notification cards by visual lines, reusing Pi's native expansion state and keybindings without truncating saved or model-visible content.
|
|
38
|
+
- Restore default steering for incoming Intercom asks in interactive and print modes; keep explicit queue/passive behavior and sender-side busy capability reporting.
|
|
39
|
+
- Preserve non-passive recovery order and suppress repeated message/reply IDs without reviving answered or superseded work.
|
|
40
|
+
- Restore circle indicators and hide completed runs from the above-editor widget and `/agents` picker. Saved run IDs and already-open read-only watches remain available; failed, stopped, interrupted, and unavailable runs stay visible.
|
|
41
|
+
- Restore steering delivery for new and legacy child completions. Publish an idle backlog before a single native wakeup, preventing separately deferred settlement turns from requeueing the same results.
|
|
42
|
+
- Log and skip a malformed legacy result file instead of dropping every other legacy completion on each scan.
|
|
43
|
+
- Reconcile new-runtime completion backlogs in completion/launch order instead of UUID directory order; preserve published receipts and recovery of genuinely dropped queues.
|
|
44
|
+
- Reuse a bounded physical-receipt index instead of repeatedly parsing unchanged parent journals. Validate changed prefixes and retain newline, replacement, truncation, corruption and owner checks.
|
|
45
|
+
- Restore the above-editor named running-agent widget, active-first status rows and expansion, while retaining read-only `/agents` watching. No live runtime, broker, bridge, model or auth changes.
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- Shorten the `delegate`, `agent_runs` and `intercom` tool descriptions and use Pi's `StringEnum` for `delegate.context` and `agent_runs.action`. Their added active-declaration JSON drops from 4,363 to 2,984 bytes on official Pi 1.4.0 and the fork. Accepted and rejected arguments, actions and results are unchanged; an invalid `context` or `action` now gets Pi's single "allowed values" error instead of one line per union member.
|
|
50
|
+
- Update development tooling to oxlint 1.89.0 with tsgolint 7.0.2005, oxfmt 0.74.0, TypeBox 1.4.3, and Node 24.19.2 and Sinon 22.0.2 typings, with a regenerated lockfile. Runtime dependencies, optional host-provided Pi and TypeBox peers, and the Node 24.21 floor are unchanged.
|
|
51
|
+
|
|
52
|
+
## [0.50.0] - 2026-10-21
|
|
4
53
|
|
|
5
54
|
### Breaking
|
|
6
55
|
|
|
@@ -22,7 +71,7 @@
|
|
|
22
71
|
- Require a concrete resolved recipient for asks before sending; retain exact reply-sender identity checks across peer registration races.
|
|
23
72
|
- Include length-ended completed responses in `last`; ignore unpublished launch directories during listing/reconciliation while retaining their native session evidence. Preserve published uncertain launch claims, visible corruption errors and conservative cold-Stop process identity checks.
|
|
24
73
|
|
|
25
|
-
|
|
74
|
+
Package publication, local installation and paired bridge cutover are separate operations.
|
|
26
75
|
|
|
27
76
|
## [0.49.1] - 2026-10-15
|
|
28
77
|
|
package/README.md
CHANGED
|
@@ -17,7 +17,8 @@ delegate({
|
|
|
17
17
|
});
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Delegation is asynchronous
|
|
20
|
+
Delegation is always asynchronous: tools return a receipt and the completion
|
|
21
|
+
arrives later as a notification. Do other work or end the turn; do not poll.
|
|
21
22
|
`context: "fresh"` is the default; `context: "fork"` preserves the native
|
|
22
23
|
conversation, including prior tool results. There is no hidden role prompt,
|
|
23
24
|
report-writing suffix, profile selection, or model fallback catalog.
|
|
@@ -30,7 +31,6 @@ agent_runs({
|
|
|
30
31
|
id: "<run-id>",
|
|
31
32
|
prompt: "Now inspect the refresh-token path. Do not edit.",
|
|
32
33
|
});
|
|
33
|
-
agent_runs({ action: "wait", id: "<run-id>" });
|
|
34
34
|
agent_runs({ action: "stop", id: "<run-id>" });
|
|
35
35
|
```
|
|
36
36
|
|
|
@@ -56,16 +56,39 @@ A main and its children form one group:
|
|
|
56
56
|
These are coordination rules, not an OS sandbox against same-user code. A peer
|
|
57
57
|
list contains connected, eligible sessions, not every Pi process on the machine.
|
|
58
58
|
|
|
59
|
+
Non-model Node.js companions can import
|
|
60
|
+
`@fitchmultz/pi-subagents/intercom-client` for discovery, exact guarded sends,
|
|
61
|
+
pinned last-response pages and original-message receipts. The
|
|
62
|
+
[supported client API](docs/intercom.md#supported-non-model-client) connects only
|
|
63
|
+
to an existing broker; it loads no Pi SDK, model, TUI or conversation journal.
|
|
64
|
+
|
|
65
|
+
## Bundled skills
|
|
66
|
+
|
|
67
|
+
The package ships two skills that match tool availability.
|
|
68
|
+
[`pi-subagents`](skills/pi-subagents/SKILL.md) covers `delegate` and `agent_runs`,
|
|
69
|
+
which only main sessions receive. [`pi-intercom`](skills/pi-intercom/SKILL.md)
|
|
70
|
+
covers `intercom`, which every session has, including children and mains that
|
|
71
|
+
never delegate. Load either with `/skill:pi-subagents` or `/skill:pi-intercom`.
|
|
72
|
+
|
|
59
73
|
## Watch agents without prompting them
|
|
60
74
|
|
|
61
|
-
In interactive Pi,
|
|
62
|
-
|
|
75
|
+
In interactive Pi, an above-editor widget names individual children with circle
|
|
76
|
+
indicators. The widget lists active work (and unreadable runs) only and disappears
|
|
77
|
+
once a full scan finds none. The `/agents` picker hides completed runs; failed,
|
|
78
|
+
stopped, interrupted, and unavailable runs remain visible there.
|
|
79
|
+
Click a named row in fullscreen mode to watch it; `/agents` remains the keyboard
|
|
80
|
+
path. Long result/message cards are collapsed and use Pi's native expansion
|
|
81
|
+
(Ctrl+O by default). Ctrl+O also expands model/cwd details. Use `/agents <run-id>` to watch
|
|
82
|
+
any saved run, including a completed child's native published text, tool calls and results.
|
|
63
83
|
This is read-only: it neither spends a model turn nor dispatches, steers or stops
|
|
64
84
|
work. Unpublished provider token deltas are not a journal stream. Agents still
|
|
65
85
|
own delegation and communication; human observation is not a second workflow UI.
|
|
66
86
|
|
|
67
87
|
## What stays explicit
|
|
68
88
|
|
|
89
|
+
Completions steer an active parent at the next tool boundary. An idle completion
|
|
90
|
+
backlog is published in order and starts one parent turn, not one turn per result.
|
|
91
|
+
|
|
69
92
|
Launch acceptance is not completion. Broker acceptance is not recipient journal
|
|
70
93
|
persistence or a reply. A stop request is not proof of process exit. Saved run
|
|
71
94
|
inspection reports these states separately, and does not invent a successful
|
|
@@ -93,6 +116,11 @@ state for rollback; qualify the helper and Box client/worker as an immutable pai
|
|
|
93
116
|
with the companion's offline receipt-reconciliation gate. This repository change
|
|
94
117
|
does not deploy or restart anything.
|
|
95
118
|
|
|
119
|
+
Upgrades leave the retired SQLite history index in place. The packaged opt-in
|
|
120
|
+
[offline archive command](docs/retired-history-maintenance.md) preserves its complete
|
|
121
|
+
recovery set after owner-enforced quiescence and observable safety checks.
|
|
122
|
+
It never runs during startup/install, deletes data, or reclaims disk space.
|
|
123
|
+
|
|
96
124
|
- [Tools and lifecycle](docs/reference.md)
|
|
97
125
|
- [Local messaging and broker migration](docs/intercom.md)
|
|
98
126
|
- [Authenticated remote messaging / Grok companion](docs/intercom-bridge.md)
|
|
@@ -100,4 +128,7 @@ does not deploy or restart anything.
|
|
|
100
128
|
- [Diagnosis, baseline, and measurable rebuild gates](docs/single-agent-rebuild.md)
|
|
101
129
|
|
|
102
130
|
Supports official Pi and the maintained `fitchmultz/pi` fork; the two hosts are
|
|
103
|
-
qualified separately. Node.js 24.21 or newer is
|
|
131
|
+
qualified separately, including native Android/Termux. Node.js 24.21 or newer is
|
|
132
|
+
required. Source installs on Android also need an Android-native `tsgo` on PATH;
|
|
133
|
+
the prebuilt npm package does not need a compiler. See
|
|
134
|
+
[development prerequisites](docs/development.md#native-androidtermux). MIT licensed.
|
package/dist/agent/contracts.js
CHANGED
|
@@ -33,10 +33,14 @@ export const processSchema = Type.Object({
|
|
|
33
33
|
pid: Type.Integer({ minimum: 1 }),
|
|
34
34
|
identity: Type.String(),
|
|
35
35
|
token: Type.String(),
|
|
36
|
+
clock: Type.Optional(Type.Object({
|
|
37
|
+
boot: Type.String(),
|
|
38
|
+
namespace: Type.String(),
|
|
39
|
+
at: Type.String({ pattern: "^[1-9][0-9]*$", maxLength: 20 }),
|
|
40
|
+
})),
|
|
36
41
|
});
|
|
37
42
|
export const attachmentSchema = Type.Object({
|
|
38
|
-
|
|
39
|
-
identity: Type.String(),
|
|
43
|
+
...Type.Pick(processSchema, ["pid", "identity", "clock"]).properties,
|
|
40
44
|
generation: Type.String(),
|
|
41
45
|
attached: Type.Boolean(),
|
|
42
46
|
});
|
|
@@ -98,25 +102,3 @@ export const admissionSchema = Type.Object({
|
|
|
98
102
|
state: Type.Optional(Type.Union([Type.Literal("accepted"), Type.Literal("stale")])),
|
|
99
103
|
at: Type.Number(),
|
|
100
104
|
});
|
|
101
|
-
export const delegateSchema = Type.Object({
|
|
102
|
-
prompt: Type.String({ minLength: 1 }),
|
|
103
|
-
name: Type.Optional(Type.String({ minLength: 1 })),
|
|
104
|
-
cwd: Type.Optional(Type.String({ minLength: 1 })),
|
|
105
|
-
model: Type.Optional(Type.String({ minLength: 1, description: "Exact provider/model ID; no fallback." })),
|
|
106
|
-
context: Type.Optional(Type.Union([Type.Literal("fresh"), Type.Literal("fork")])),
|
|
107
|
-
async: Type.Optional(Type.Boolean({ default: true })),
|
|
108
|
-
}, { additionalProperties: false });
|
|
109
|
-
export const runsSchema = Type.Object({
|
|
110
|
-
action: Type.Union([
|
|
111
|
-
Type.Literal("list"),
|
|
112
|
-
Type.Literal("inspect"),
|
|
113
|
-
Type.Literal("continue"),
|
|
114
|
-
Type.Literal("stop"),
|
|
115
|
-
Type.Literal("wait"),
|
|
116
|
-
]),
|
|
117
|
-
id: Type.Optional(Type.String()),
|
|
118
|
-
prompt: Type.Optional(Type.String({ minLength: 1 })),
|
|
119
|
-
async: Type.Optional(Type.Boolean({ default: true })),
|
|
120
|
-
offset: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
121
|
-
length: Type.Optional(Type.Integer({ minimum: 4, maximum: 262144 })),
|
|
122
|
-
}, { additionalProperties: false });
|
package/dist/agent/host.js
CHANGED
|
@@ -10,6 +10,8 @@ import * as fs from "node:fs";
|
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import { findPackageJSON } from "node:module";
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
13
|
+
import { readIntercomLineage } from "../pi-intercom/identity.js";
|
|
14
|
+
export { errorMessage as errorText } from "../shared/unknown.js";
|
|
13
15
|
function isPackage(root) {
|
|
14
16
|
const file = path.join(root, "package.json");
|
|
15
17
|
if (!fs.existsSync(file)) {
|
|
@@ -63,20 +65,5 @@ export function runtimeEntry() {
|
|
|
63
65
|
return fileURLToPath(new URL(import.meta.url.endsWith(".ts") ? "../index.ts" : "../index.js", import.meta.url));
|
|
64
66
|
}
|
|
65
67
|
export function isChild() {
|
|
66
|
-
|
|
67
|
-
const parent = process.env.PI_INTERCOM_PARENT_SESSION_ID;
|
|
68
|
-
if (root === undefined && parent === undefined) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
if (root === undefined ||
|
|
72
|
-
parent === undefined ||
|
|
73
|
-
root.length === 0 ||
|
|
74
|
-
parent.length === 0 ||
|
|
75
|
-
root !== parent) {
|
|
76
|
-
throw new Error("Malformed child identity; delegation is disabled.");
|
|
77
|
-
}
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
export function errorText(error) {
|
|
81
|
-
return error instanceof Error ? error.message : JSON.stringify(error);
|
|
68
|
+
return readIntercomLineage() !== undefined;
|
|
82
69
|
}
|