pi-subagents 0.78.0 → 0.79.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 +45 -0
- package/docs/agents.md +4 -2
- package/docs/configuration.md +1 -1
- package/docs/extension-api.md +4 -0
- package/docs/observability.md +9 -3
- package/docs/tool-reference.md +12 -1
- package/docs/workflows.md +4 -2
- package/package.json +1 -1
- package/skills/pi-subagents/SKILL.md +1 -0
- package/skills/pi-subagents/references/execution-controls.md +2 -0
- package/src/extension/declaration-pinning.d.ts.map +1 -1
- package/src/extension/declaration-pinning.js +15 -1
- package/src/extension/declaration-pinning.js.map +1 -1
- package/src/extension/index.d.ts.map +1 -1
- package/src/extension/index.js +17 -4
- package/src/extension/index.js.map +1 -1
- package/src/extension/public-execution.d.ts +1 -0
- package/src/extension/public-execution.d.ts.map +1 -1
- package/src/extension/public-execution.js +3 -0
- package/src/extension/public-execution.js.map +1 -1
- package/src/extension/rpc.d.ts.map +1 -1
- package/src/extension/rpc.js +5 -3
- package/src/extension/rpc.js.map +1 -1
- package/src/extension/schemas.d.ts +2 -0
- package/src/extension/schemas.d.ts.map +1 -1
- package/src/extension/schemas.js +1 -0
- package/src/extension/schemas.js.map +1 -1
- package/src/extension/tool-activation.d.ts.map +1 -1
- package/src/extension/tool-activation.js +22 -5
- package/src/extension/tool-activation.js.map +1 -1
- package/src/intercom/native-supervisor-channel.d.ts +2 -1
- package/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/src/intercom/native-supervisor-channel.js +105 -9
- package/src/intercom/native-supervisor-channel.js.map +1 -1
- package/src/runs/background/async-resume.d.ts.map +1 -1
- package/src/runs/background/async-resume.js +2 -1
- package/src/runs/background/async-resume.js.map +1 -1
- package/src/runs/background/async-status-snapshot.d.ts.map +1 -1
- package/src/runs/background/async-status-snapshot.js +4 -2
- package/src/runs/background/async-status-snapshot.js.map +1 -1
- package/src/runs/background/async-status.d.ts.map +1 -1
- package/src/runs/background/async-status.js +10 -6
- package/src/runs/background/async-status.js.map +1 -1
- package/src/runs/background/inspect-rpc.d.ts +5 -0
- package/src/runs/background/inspect-rpc.d.ts.map +1 -1
- package/src/runs/background/inspect-rpc.js +20 -3
- package/src/runs/background/inspect-rpc.js.map +1 -1
- package/src/runs/background/result-delivery-ownership.d.ts +0 -2
- package/src/runs/background/result-delivery-ownership.d.ts.map +1 -1
- package/src/runs/background/result-delivery-ownership.js +5 -21
- package/src/runs/background/result-delivery-ownership.js.map +1 -1
- package/src/runs/background/result-files.d.ts +5 -3
- package/src/runs/background/result-files.d.ts.map +1 -1
- package/src/runs/background/result-files.js +10 -6
- package/src/runs/background/result-files.js.map +1 -1
- package/src/runs/background/result-watcher.d.ts.map +1 -1
- package/src/runs/background/result-watcher.js +15 -8
- package/src/runs/background/result-watcher.js.map +1 -1
- package/src/runs/background/resume-guidance.d.ts.map +1 -1
- package/src/runs/background/resume-guidance.js +3 -2
- package/src/runs/background/resume-guidance.js.map +1 -1
- package/src/runs/background/run-child-session.d.ts.map +1 -1
- package/src/runs/background/run-child-session.js +7 -4
- package/src/runs/background/run-child-session.js.map +1 -1
- package/src/runs/background/run-status.d.ts.map +1 -1
- package/src/runs/background/run-status.js +11 -4
- package/src/runs/background/run-status.js.map +1 -1
- package/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/src/runs/background/subagent-runner.js +15 -5
- package/src/runs/background/subagent-runner.js.map +1 -1
- package/src/runs/foreground/async-dismiss-action.d.ts.map +1 -1
- package/src/runs/foreground/async-dismiss-action.js +2 -1
- package/src/runs/foreground/async-dismiss-action.js.map +1 -1
- package/src/runs/foreground/async-steering-action.d.ts.map +1 -1
- package/src/runs/foreground/async-steering-action.js +3 -2
- package/src/runs/foreground/async-steering-action.js.map +1 -1
- package/src/runs/foreground/async-stop-action.d.ts +1 -0
- package/src/runs/foreground/async-stop-action.d.ts.map +1 -1
- package/src/runs/foreground/async-stop-action.js +3 -1
- package/src/runs/foreground/async-stop-action.js.map +1 -1
- package/src/runs/foreground/command-action.d.ts.map +1 -1
- package/src/runs/foreground/command-action.js +2 -1
- package/src/runs/foreground/command-action.js.map +1 -1
- package/src/runs/foreground/execution.d.ts.map +1 -1
- package/src/runs/foreground/execution.js +18 -7
- package/src/runs/foreground/execution.js.map +1 -1
- package/src/runs/foreground/subagent-executor.d.ts +2 -0
- package/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/src/runs/foreground/subagent-executor.js +98 -32
- package/src/runs/foreground/subagent-executor.js.map +1 -1
- package/src/runs/shared/async-status-projection.d.ts +4 -0
- package/src/runs/shared/async-status-projection.d.ts.map +1 -1
- package/src/runs/shared/async-status-projection.js +23 -1
- package/src/runs/shared/async-status-projection.js.map +1 -1
- package/src/runs/shared/child-commands.d.ts +2 -0
- package/src/runs/shared/child-commands.d.ts.map +1 -1
- package/src/runs/shared/child-commands.js +4 -0
- package/src/runs/shared/child-commands.js.map +1 -1
- package/src/runs/shared/child-runtime-config.d.ts +6 -0
- package/src/runs/shared/child-runtime-config.d.ts.map +1 -1
- package/src/runs/shared/child-runtime-config.js +6 -0
- package/src/runs/shared/child-runtime-config.js.map +1 -1
- package/src/runs/shared/child-session.d.ts +2 -2
- package/src/runs/shared/child-session.d.ts.map +1 -1
- package/src/runs/shared/child-session.js +104 -42
- package/src/runs/shared/child-session.js.map +1 -1
- package/src/runs/shared/long-running-guard.d.ts +3 -1
- package/src/runs/shared/long-running-guard.d.ts.map +1 -1
- package/src/runs/shared/long-running-guard.js +4 -14
- package/src/runs/shared/long-running-guard.js.map +1 -1
- package/src/runs/shared/model-resolution.d.ts +5 -1
- package/src/runs/shared/model-resolution.d.ts.map +1 -1
- package/src/runs/shared/model-resolution.js +8 -1
- package/src/runs/shared/model-resolution.js.map +1 -1
- package/src/runs/shared/nested-events.d.ts.map +1 -1
- package/src/runs/shared/nested-events.js +2 -0
- package/src/runs/shared/nested-events.js.map +1 -1
- package/src/runs/shared/run-ownership.d.ts +4 -0
- package/src/runs/shared/run-ownership.d.ts.map +1 -0
- package/src/runs/shared/run-ownership.js +9 -0
- package/src/runs/shared/run-ownership.js.map +1 -0
- package/src/runs/shared/subagent-control.d.ts +1 -0
- package/src/runs/shared/subagent-control.d.ts.map +1 -1
- package/src/runs/shared/subagent-control.js +2 -1
- package/src/runs/shared/subagent-control.js.map +1 -1
- package/src/runs/shared/subagent-prompt-runtime.d.ts +45 -18
- package/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/src/runs/shared/subagent-prompt-runtime.js +160 -59
- package/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/src/shared/file-lease.d.ts +7 -1
- package/src/shared/file-lease.d.ts.map +1 -1
- package/src/shared/file-lease.js +8 -2
- package/src/shared/file-lease.js.map +1 -1
- package/src/shared/fork-context.d.ts +3 -1
- package/src/shared/fork-context.d.ts.map +1 -1
- package/src/shared/fork-context.js +23 -13
- package/src/shared/fork-context.js.map +1 -1
- package/src/shared/session-succession.d.ts +5 -0
- package/src/shared/session-succession.d.ts.map +1 -0
- package/src/shared/session-succession.js +25 -0
- package/src/shared/session-succession.js.map +1 -0
- package/src/shared/types.d.ts +15 -1
- package/src/shared/types.d.ts.map +1 -1
- package/src/shared/types.js +3 -0
- package/src/shared/types.js.map +1 -1
- package/src/shared/utils.d.ts +11 -0
- package/src/shared/utils.d.ts.map +1 -1
- package/src/shared/utils.js +17 -0
- package/src/shared/utils.js.map +1 -1
- package/src/slash/slash-commands.d.ts.map +1 -1
- package/src/slash/slash-commands.js +2 -2
- package/src/slash/slash-commands.js.map +1 -1
- package/src/watchdog/register-main.js +2 -2
- package/src/watchdog/register-main.js.map +1 -1
- package/src/watchdog/runtime.d.ts.map +1 -1
- package/src/watchdog/runtime.js +3 -5
- package/src/watchdog/runtime.js.map +1 -1
- package/src/workflows/scripted-workflow.d.ts +1 -1
- package/src/workflows/scripted-workflow.d.ts.map +1 -1
- package/src/workflows/workflow-child-summary.d.ts +5 -0
- package/src/workflows/workflow-child-summary.d.ts.map +1 -1
- package/src/workflows/workflow-child-summary.js +10 -0
- package/src/workflows/workflow-child-summary.js.map +1 -1
- package/src/workflows/workflow-reuse.d.ts +6 -1
- package/src/workflows/workflow-reuse.d.ts.map +1 -1
- package/src/workflows/workflow-reuse.js +22 -1
- package/src/workflows/workflow-reuse.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.79.0] - 2026-10-17
|
|
6
|
+
|
|
7
|
+
### Highlights
|
|
8
|
+
|
|
9
|
+
- Handoffs keep your background work. A session that takes over from another one in the same Pi process can see, wait on, steer, stop and resume the old session's background runs, and a stopped workflow can be picked up with `reuseFrom` without running its finished children again.
|
|
10
|
+
- Coordinators can give a finished worker another round. Resuming a finished background child, a forked child, or a child that was already resumed once now works instead of failing with "session file is not under that nested run's session directory".
|
|
11
|
+
- Fewer wasted tokens. Forked subagents reuse the parent's prompt cache, `/subagent-cost` and other view-only reports no longer ride along in every request, and codemode no longer breaks the cache on every resume.
|
|
12
|
+
- `subagent` survives updates. Updating or reloading pi-subagents mid-session no longer leaves `subagent` or `bg_wait` turned off.
|
|
13
|
+
- RPC hosts see more: each background child's agent, run id, requested model, and the model that actually answered.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Inspect replies (`/subagents-inspect-rpc`) now include `resolvedModel: { provider, model }`, the provider and model of the inspected child's latest reply. Before, a host could only see the requested model. The field is missing until the child replies, for a whole workflow or multi-step run, and for runs from before this release. A forked child's inherited history never counts. Thanks to [@koenvg](https://github.com/koenvg) for reporting [#2922](https://github.com/nicobailon/pi-subagents/issues/2922).
|
|
18
|
+
- The RPC `subagent-async` status snapshot now includes each background step's `model`, `thinking` level and `agent`. A workflow lane's label names the lane, not the agent, so hosts could not name a running child until it finished. Thanks to [@agustinsacco](https://github.com/agustinsacco) for [#2893](https://github.com/nicobailon/pi-subagents/pull/2893) ([#2892](https://github.com/nicobailon/pi-subagents/issues/2892)) and [@kevinsleegerslameco](https://github.com/kevinsleegerslameco) for [#2912](https://github.com/nicobailon/pi-subagents/pull/2912) ([#2911](https://github.com/nicobailon/pi-subagents/issues/2911)).
|
|
19
|
+
- In a workflow that waits for its result, a background child's `workflowChildren` row now carries its `agent` and `runId` from launch, and that `runId` matches the child's run in the `subagent-async` snapshot. Before, the row had only `{ childId, state }` until the child finished. Thanks to [@kevinsleegerslameco](https://github.com/kevinsleegerslameco) for reporting [#2911](https://github.com/nicobailon/pi-subagents/issues/2911).
|
|
20
|
+
- After a handoff, a relaunched workflow can reuse the work of a run that was stopped because the old session's runtime was replaced: pass `options: { reuseFrom: "<run id>" }`. Finished children are reused and running ones are awaited, even from another session, as long as the run ran the same script in the same cwd. Before, relaunching ran every child again, so two writers could share one output. The stop notice names the option and the run id. Thanks to [@wireknight](https://github.com/wireknight) for reporting [#2909](https://github.com/nicobailon/pi-subagents/issues/2909).
|
|
21
|
+
- A session that takes over from another one in the same Pi process, for example after a handoff to a new session file, now owns the old session's background runs. They show in its run list, fleet view and RPC snapshot. It can wait on, steer, stop, resume and inspect them, and it gets their notices and answers their supervisor questions. `status` shows `Owner: inherited from session '…' (replaced in this process).` for these runs. A fresh start, `pi --continue`, or another Pi process inherits nothing. Thanks to [@wireknight](https://github.com/wireknight) for reporting [#2909](https://github.com/nicobailon/pi-subagents/issues/2909).
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- The pi-subagents skill now says that `subagent`, `subagents_enable`, `subagent_supervisor`, `contact_supervisor` and `structured_output` can't be called from codemode scripts. With codemode on, models used to try `tools.subagent_supervisor(...)` and get a "does not exist" error. Thanks to [@CovetingEpiphany2152](https://github.com/CovetingEpiphany2152) for the report. ([#2887](https://github.com/nicobailon/pi-subagents/issues/2887))
|
|
26
|
+
- Replying to a supervisor question that was already answered, expired or withdrawn now lists the questions still pending, so the parent can answer a newer one without another `pending` call. Thanks to [@agustinsacco](https://github.com/agustinsacco) for [#2895](https://github.com/nicobailon/pi-subagents/pull/2895). ([#2894](https://github.com/nicobailon/pi-subagents/issues/2894))
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- A coordinator could not resume its own finished background child: `resume` failed with "session file is not under that nested run's session directory", so it had to start a new child and send the brief again. The same happened for forked children (`context: "fork"`) and for a child that had already been resumed once. All three now resume, with the same ownership checks as before. Background and forked children now keep their session in a folder named by their run id. Children launched before this update still can't be resumed. Thanks to [@mannainsect](https://github.com/mannainsect) for reporting [#2924](https://github.com/nicobailon/pi-subagents/issues/2924) and [@GeorgeLautenschlager](https://github.com/GeorgeLautenschlager) for showing it outside workflows. ([#2932](https://github.com/nicobailon/pi-subagents/issues/2932))
|
|
31
|
+
- A coordinator child (one that delegates its own work) stayed stuck in `bg_wait` when one of its children asked it a question with `contact_supervisor`, so the questions expired unanswered. Its `bg_wait` now returns as soon as a question is waiting, as the parent's already does. Thanks to [@mannainsect](https://github.com/mannainsect) for reporting [#2923](https://github.com/nicobailon/pi-subagents/issues/2923).
|
|
32
|
+
- A child's `contact_supervisor` question could expire before the parent saw it when the parent was busy in a long tool call, so the child gave up and asked again and the parent's late reply failed. The question's deadline now moves forward until the parent's model sees it. Thanks to [@agustinsacco](https://github.com/agustinsacco) for the report. ([#2894](https://github.com/nicobailon/pi-subagents/issues/2894))
|
|
33
|
+
- When a handoff or reload stopped an async workflow, its still-running children were listed as `stopped`, its notice didn't say that reusing finished children works only from the same session, and `status` offered a `Revive:` command to sessions that can't use it. The children now show as `running`, the notice explains how the same session and another session can reuse them, and `status` offers resume only to the session that launched the run. Thanks to [@wireknight](https://github.com/wireknight) for reporting [#2909](https://github.com/nicobailon/pi-subagents/issues/2909).
|
|
34
|
+
- After pi-subagents was updated or reloaded mid-session, `subagent` stayed off once the session started again (`/reload` or `pi --continue`), and `subagents_enable` wasn't offered either, so nothing could turn it back on. Pi records the unload as a removal of the extension's tools, and that was replayed as if you had turned `subagent` off. An unload is now recognized and the tools come back as you had them. Thanks to [@bkdinoop](https://github.com/bkdinoop) for reporting [#2910](https://github.com/nicobailon/pi-subagents/issues/2910).
|
|
35
|
+
- After such an update, a session continued in a new process (`pi --continue`) also kept `bg_wait` off, and a second update in that session lost `subagent` again. The tools the update removed now come back when the session starts, unless they are excluded for this process. ([#2916](https://github.com/nicobailon/pi-subagents/issues/2916))
|
|
36
|
+
- Forked subagents now reuse the parent's prompt cache. A fork used to replace the parent's system prompt and tools, so its first request re-read the whole conversation. It now sends the parent's system prompt, tools and messages unchanged, and gets its own instructions in a `<subagent_instructions>` block at the start of its task. A fork also sees the parent's project context and skills even when its agent turns them off. On Claude with a 60k-token parent, a fork's first request went from 9.6k cached and 52k written tokens to 60.8k cached and 1.7k written. See [tool-reference.md](docs/tool-reference.md#fork-context-details) for the forks that still miss the cache. Fresh children are unchanged. Thanks to [@gabsn](https://github.com/gabsn) for [#2879](https://github.com/nicobailon/pi-subagents/pull/2879).
|
|
37
|
+
- `/subagent-cost` and other view-only slash reports no longer go into every later model request. They are still saved, shown in the TUI and sent to RPC callers. `/run` results stay in context because the model needs them. Reports saved before this update stay until compaction, so updating doesn't break a session's prompt cache. Thanks to [@isjiajia01](https://github.com/isjiajia01) for [#2927](https://github.com/nicobailon/pi-subagents/pull/2927) and [@summer-tt](https://github.com/summer-tt) for the report. ([#2925](https://github.com/nicobailon/pi-subagents/issues/2925))
|
|
38
|
+
- With Pi's codemode on, every start or resume of a session added another copy of codemode's note to the `bg_wait` description, so the provider re-read the conversation without its prompt cache. The note now appears once and a resumed session keeps its tool declaration. Thanks to [@SamuelBadr](https://github.com/SamuelBadr) for the report. ([#2889](https://github.com/nicobailon/pi-subagents/issues/2889))
|
|
39
|
+
- When a provider stopped a child with an error, such as a content-filter refusal, the child reported only the stop code. Its error now includes the provider's reply text as `Reply text: …` (up to 500 characters), so a refusal can be told apart from an outage. In a failed workflow, each failed child's line also starts with its own error instead of the `Run fan-out: N/64 used` line. Thanks to [@stanleytelehealth](https://github.com/stanleytelehealth) for [#2913](https://github.com/nicobailon/pi-subagents/pull/2913).
|
|
40
|
+
- A read-only child running `grep … 2>/dev/null` could be flagged `needs_attention`: the redirect counted as a file change, and output containing words like "error" counted as a failure. Redirects to `/dev/null` no longer count as changes, and a tool call counts as failed only when its result says `isError: true`. Calls blocked by a hard `toolBudget` don't count either. Thanks to [@Liaokc](https://github.com/Liaokc) for the fix and [@builtroller](https://github.com/builtroller) for the report. ([#2878](https://github.com/nicobailon/pi-subagents/issues/2878), [#2884](https://github.com/nicobailon/pi-subagents/issues/2884))
|
|
41
|
+
- A notice about a long-running `bash` call in a child suggested `command.status`, `command.yield` and `command.cancel` even when the child had no command controller, so following it failed with "No command controller is available for this child." The notice now suggests them only when they work. Thanks to [@G0-0000](https://github.com/G0-0000) for [#2882](https://github.com/nicobailon/pi-subagents/pull/2882). ([#2880](https://github.com/nicobailon/pi-subagents/issues/2880))
|
|
42
|
+
- On Pi 1.2 and later, the watchdog took the system prompt of a run started by an extension message (for example a wake sent with `triggerTurn: true`) as your prompt and showed it to its reviewer model as a real requirement. These runs no longer add to the watchdog's scope, and their edits are still reviewed against your earlier prompts. Thanks to [@isjiajia01](https://github.com/isjiajia01) for [#2928](https://github.com/nicobailon/pi-subagents/pull/2928) and [@sternnick](https://github.com/sternnick) for reporting [#2926](https://github.com/nicobailon/pi-subagents/issues/2926).
|
|
43
|
+
- A child using built-in MCP tools failed after 10 seconds even when its server was still connecting normally. It now waits for the connection, fails promptly when a connection fails, and stops waiting when the child is stopped or times out. This needs Pi 0.99.2 or later. Thanks to [@qsgy-edge](https://github.com/qsgy-edge) for [#2904](https://github.com/nicobailon/pi-subagents/pull/2904).
|
|
44
|
+
- An extension that force-exits a headless run on quit could kill the background runner when one of its children ended, so the run failed with "Async runner process N exited with code 0 before writing a result". The runner now sets `PI_SUBAGENT_RUNNER_PID` to its own pid, so an extension can compare it with `process.pid` and leave the runner alone. Processes spawned from a child inherit the value but have their own pid. See [extension-api.md](docs/extension-api.md#background-work-provider-api). Thanks to [@hughy](https://github.com/hughy) for [#2885](https://github.com/nicobailon/pi-subagents/pull/2885). ([#2883](https://github.com/nicobailon/pi-subagents/issues/2883))
|
|
45
|
+
- After Pi auto-compacted in the middle of a turn, the async and Fleet status widgets stayed hidden until the whole run ended. They now come back as soon as the compaction finishes. Thanks to [@agustinsacco](https://github.com/agustinsacco) for [#2891](https://github.com/nicobailon/pi-subagents/pull/2891). ([#2890](https://github.com/nicobailon/pi-subagents/issues/2890))
|
|
46
|
+
- When a background subagent finished, the parent often logged `Failed to acknowledge the mission observer ... Timed out waiting for another process to finish updating` with a stack trace and stalled for 200 ms. It now retries quietly a moment later. Thanks to [@RainbowXie](https://github.com/RainbowXie) for the report. ([#2896](https://github.com/nicobailon/pi-subagents/issues/2896))
|
|
47
|
+
- A finished mission run from an earlier Pi process in the same session was synced to its mission again every 60 seconds, rewriting the mission record each time. It is now synced once. Thanks to [@BelovedYaoo](https://github.com/BelovedYaoo) for reporting [#2905](https://github.com/nicobailon/pi-subagents/issues/2905).
|
|
48
|
+
|
|
5
49
|
## [0.78.0] - 2026-10-12
|
|
6
50
|
|
|
7
51
|
### Highlights
|
|
@@ -406,6 +450,7 @@
|
|
|
406
450
|
- Logs from running and failed external CLI agents can be viewed in Fleet, tool status, and the TUI. Thanks to [@Shujakuinkuraudo](https://github.com/Shujakuinkuraudo) for [#2375](https://github.com/nicobailon/pi-subagents/issues/2375).
|
|
407
451
|
- Structured delegation updates report cumulative usage and no longer count missing provider cache numbers as zero. Thanks to [@bioShaun](https://github.com/bioShaun) for [#2374](https://github.com/nicobailon/pi-subagents/pull/2374).
|
|
408
452
|
- Forked sessions keep Pi 0.87 context edits, including replaced content and signed Anthropic thinking blocks.
|
|
453
|
+
|
|
409
454
|
## [0.70.1] - 2026-09-20
|
|
410
455
|
|
|
411
456
|
### Highlights
|
package/docs/agents.md
CHANGED
|
@@ -359,6 +359,8 @@ Use these fields when an agent should see more:
|
|
|
359
359
|
|
|
360
360
|
Builtin agents opt into repository instruction inheritance by default so they follow repo-specific rules out of the box, but global context remains excluded unless `inheritGlobalContext: true` is set. This changes the behavior of existing agents that previously received global context as part of `inheritProjectContext: true`. `delegate` also uses append mode because its job is orchestration inside the parent workflow.
|
|
361
361
|
|
|
362
|
+
These fields and `systemPromptMode` shape a fresh child's system prompt. A forked child (`context: "fork"`) sends its parent's whole system prompt instead, project context, global context, and skills included, and gets its agent prompt in its task message (see [fork context details](tool-reference.md#fork-context-details)).
|
|
363
|
+
|
|
362
364
|
## Frontmatter reference
|
|
363
365
|
|
|
364
366
|
A full example:
|
|
@@ -537,7 +539,7 @@ Examples:
|
|
|
537
539
|
|
|
538
540
|
### MCP tools
|
|
539
541
|
|
|
540
|
-
When [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter) is not installed and Pi has built-in MCP (Pi 0.99 or later), `mcp:server` and `mcp:server/tool` entries resolve against Pi's built-in MCP. Name the server and tool as the server reports them: `mcp:my-docs/get-item` selects the tool Pi registers as `mcp__my_docs__get_item`. The server part may also use the `-`→`_` form of its name that Pi's MCP namespace uses, such as `mcp:my_docs`. The child connects the servers in Pi's `mcp.json` (the project's `.pi/mcp.json` only when the parent trusts the project) and gets only the selected tools, as direct tools, whatever exposure the server is configured with; tools configured as `hidden` cannot be selected. Servers that an extension adds with `pi.registerMcpServer()` work in background children, because the registering extension loads there too. They do not work in foreground children, which load no ambient extensions, so a foreground launch that selects one fails and says to use `async: true`. The launch
|
|
542
|
+
When [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter) is not installed and Pi has built-in MCP (Pi 0.99.2 or later), `mcp:server` and `mcp:server/tool` entries resolve against Pi's built-in MCP. Name the server and tool as the server reports them: `mcp:my-docs/get-item` selects the tool Pi registers as `mcp__my_docs__get_item`. The server part may also use the `-`→`_` form of its name that Pi's MCP namespace uses, such as `mcp:my_docs`. The child connects the servers in Pi's `mcp.json` (the project's `.pi/mcp.json` only when the parent trusts the project) and gets only the selected tools, as direct tools, whatever exposure the server is configured with; tools configured as `hidden` cannot be selected. Servers that an extension adds with `pi.registerMcpServer()` work in background children, because the registering extension loads there too. They do not work in foreground children, which load no ambient extensions, so a foreground launch that selects one fails and says to use `async: true`. The child waits for the selected servers' current MCP connection attempts before its first prompt, then rejects the launch if any selected tool is missing or not available as a direct tool. Pi's MCP request timeout still bounds each connection; stopping, interrupting, timing out, or shutting down the child cancels the startup wait. An unrelated server does not delay this check.
|
|
541
543
|
|
|
542
544
|
When pi-mcp-adapter is installed, it keeps priority and provides the direct MCP tools. Subagents only receive direct MCP tools when `mcp:` entries are listed in their frontmatter; global `directTools: true` in the adapter's MCP config is not enough by itself. The generic `mcp` proxy tool can still be used for discovery when available. The adapter caches tool metadata at startup, so after connecting a new MCP server for the first time, restart Pi before relying on direct tools. Server `includeTools` and `excludeTools` policies are enforced while resolving cached metadata for children: both accept exact names and `*`/`?` glob patterns against raw, generated-resource, and server/short/mcp/none-prefixed names, with `excludeTools` taking precedence. `mcp:` entries must name servers from the adapter's configuration files. A server that exists only in the adapter's runtime snapshot (registered at runtime, not persisted) cannot be provided to a child: children are pi sessions inside the parent or the runner process, not `pi` processes that could receive an MCP config argument, so such a launch fails with an error saying that MCP tools must come from an ambient adapter extension in a background child. An `mcp:` entry named `subagent` does not authorize nested fanout; declare the builtin `subagent` tool or set `allowNestedSubagents: true`. If a resolved direct MCP name is missing from the child registry, pi-subagents keeps the launch failed under the strict allowlist and reports the registration mismatch; check the resolved names against what the host or pi-mcp-adapter actually registers before child startup.
|
|
543
545
|
|
|
@@ -613,7 +615,7 @@ Agent-local `skillPath` candidates never enter Pi's parent/global skills catalog
|
|
|
613
615
|
|
|
614
616
|
## The bundled pi-subagents skill
|
|
615
617
|
|
|
616
|
-
The package bundles a `pi-subagents` skill that is automatically available to the parent agent when the extension is installed. Availability is not automatic routing or permission to delegate: the parent works directly unless the operator requests delegation in the current request or through applicable user/project instructions. Once authorized, use the smallest bounded child or workflow whose evidence, independent review, specialization, parallelism, or isolation benefit earns its overhead. It is for the orchestrating parent only: child subagents never receive it, and a child's own context is filtered to strip parent-only orchestration instructions. A forked child keeps the history it inherited as the parent sent
|
|
618
|
+
The package bundles a `pi-subagents` skill that is automatically available to the parent agent when the extension is installed. Availability is not automatic routing or permission to delegate: the parent works directly unless the operator requests delegation in the current request or through applicable user/project instructions. Once authorized, use the smallest bounded child or workflow whose evidence, independent review, specialization, parallelism, or isolation benefit earns its overhead. It is for the orchestrating parent only: fresh child subagents never receive it, and a child's own context is filtered to strip parent-only orchestration instructions. A forked child is the exception: it keeps the history, system prompt, and tool declarations it inherited as the parent sent them, so it sees this skill in the parent's skills list and the parent's subagent catalog. It receives its own instructions, including its subagent boundary, in its task message, and its first request reuses the parent's prompt cache (see [fork context details](tool-reference.md#fork-context-details)).
|
|
617
619
|
|
|
618
620
|
What it covers:
|
|
619
621
|
|
package/docs/configuration.md
CHANGED
|
@@ -278,7 +278,7 @@ Controls how resolved fork launches prepare the inherited session. The default `
|
|
|
278
278
|
|
|
279
279
|
Child-visible spilled items contain only the model summary and a stable `{ batchId, itemId }` recovery ref. Raw bodies and their digests, source entry ids, labels, sizes, and tool metadata go to a private `0600` sidecar next to the child session. This release does not add a recovery command or expose that payload to the child model.
|
|
280
280
|
|
|
281
|
-
Pruned forks keep the normal `parentSession` link, child cwd alignment, and fork thinking-block sanitization (signed Anthropic thinking blocks are stripped; the child keeps its requested thinking level). Missing model or auth, invalid or incomplete summary JSON, budget overflow, recovery validation failure, and raw overflow leakage all stop the launch before child spawn. The extension never falls back to a full fork or refs-only context after a prune failure.
|
|
281
|
+
Pruned forks keep the normal `parentSession` link, child cwd alignment, and fork thinking-block sanitization (a pruned fork rewrites inherited content, so its signed and redacted Anthropic thinking blocks are stripped; the child keeps its requested thinking level). Missing model or auth, invalid or incomplete summary JSON, budget overflow, recovery validation failure, and raw overflow leakage all stop the launch before child spawn. The extension never falls back to a full fork or refs-only context after a prune failure.
|
|
282
282
|
|
|
283
283
|
## `fleetView`
|
|
284
284
|
|
package/docs/extension-api.md
CHANGED
|
@@ -432,6 +432,10 @@ Children do not gain provider tools or extensions automatically. Add `bg_wait` t
|
|
|
432
432
|
|
|
433
433
|
Local foreground children never load the parent's ambient extensions: they share the parent's process, and loading them would start a second copy of every ambient extension, including this one, inside it. They do inherit the providers the parent's extensions registered, so a provider extension's models resolve in a local foreground child. Pane-native remote foreground children instead use the remote machine's provider discovery and configuration. Agents that need MCP tools (`mcpDirectTools`, or MCP tools from an ambient adapter such as pi-mcp-adapter) must run as background children (`async: true`), which load the ambient extensions inside the detached runner process unless the agent sets `extensions` or the capability ceiling denies extensions.
|
|
434
434
|
|
|
435
|
+
The runner hosts many child sessions in one process and keeps working after each one ends: a background child's extensions see `session_shutdown` with reason `"quit"` in print mode, but the process does not exit with it. An extension that acts on process exit at that point (for example by force-exiting a headless run) should first check `process.env.PI_SUBAGENT_RUNNER_PID === String(process.pid)`, which is true only inside the runner. `PI_SUBAGENT_CHILD=1` cannot make that distinction: processes spawned from a child, such as a headless `pi` started by its bash tool, inherit both variables but have their own pid.
|
|
436
|
+
|
|
437
|
+
A local foreground child ends the same way, but it runs inside the parent Pi process, which is not a runner and sets no marker. An extension configured into a foreground child (through the agent's `extensions` or `subagentOnlyExtensions`) must not act on process exit at `session_shutdown`.
|
|
438
|
+
|
|
435
439
|
## External job provider bridge
|
|
436
440
|
|
|
437
441
|
Extensions that own long-running advisor jobs can register a process-local provider for `runner.type: external-job` agents:
|
package/docs/observability.md
CHANGED
|
@@ -155,9 +155,11 @@ If something feels misconfigured, run `/subagents-doctor` or ask: "Check whether
|
|
|
155
155
|
## Host inspection protocol (RPC)
|
|
156
156
|
|
|
157
157
|
RPC hosts receive live async status through the bounded `subagent-async` widget
|
|
158
|
-
(`PI_SUBAGENT_ASYNC_JSON:` payload).
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
(`PI_SUBAGENT_ASYNC_JSON:` payload). Step nodes report the `agent` the child
|
|
159
|
+
runs as, and the `model` and `thinking` level it runs on once its status reports
|
|
160
|
+
them. For on-demand
|
|
161
|
+
detail — a child's delegated task, transcript window, or final output — hosts
|
|
162
|
+
can invoke the extension command:
|
|
161
163
|
|
|
162
164
|
```text
|
|
163
165
|
/subagents-inspect-rpc <requestId> <asyncId> [childId] [--lines N]
|
|
@@ -183,6 +185,10 @@ Inspection properties:
|
|
|
183
185
|
- `task` is the child session's first user message and is only populated when
|
|
184
186
|
it is genuinely attributable (fresh-context child whose session file fits the
|
|
185
187
|
read window); forked children omit it.
|
|
188
|
+
- `resolvedModel` (`{ provider, model }`) is the pair Pi recorded on the
|
|
189
|
+
inspected child's latest own assistant reply, never the requested model. It is
|
|
190
|
+
absent before the first reply, for run-level inspection of a multi-step or
|
|
191
|
+
workflow run, and for runs recorded before pi-subagents reported it.
|
|
186
192
|
- `childId` is exactly the node id the host received in the status snapshot
|
|
187
193
|
(step `workflowKey`/`runId`/`step:<index>`, or a nested run id).
|
|
188
194
|
|
package/docs/tool-reference.md
CHANGED
|
@@ -82,6 +82,7 @@ The `subagent` tool schema lists `agent`, `task`, `workflow`, `args`, `async`, `
|
|
|
82
82
|
| `options.context` | `fresh \| fork \| profile` | global or per-agent default, else `fresh` | Explicit `fresh` or `fork` overrides every workflow child. `profile` requires the selected agent's declared `defaultContext` and ignores config `defaultSubagentContext`; missing agent defaults fail. When omitted, [`defaultSubagentContext`](configuration.md#defaultsubagentcontext) wins over each agent's `defaultContext`; implicit fork falls back to fresh without a persisted parent session and leaf. Explicit fork is strict. Packaged `worker` defaults to `fresh`; packaged `oracle` and `advisor` default to `fork`. |
|
|
83
83
|
| `model` | string | agent default | An exact `provider/id`; bare ids resolve only if unique, and agent names are not model ids. An unknown or ambiguous model fails with up to 5 closest registry ids to copy; `{action:"models"}` lists them all. A suffix such as `provider/id:high` (`off/minimal/low/medium/high/xhigh/max`) overrides agent thinking. The `thinking` field is only for `watchdog.configure`, ignored on dispatch. On the `claude-code` and `claude-code-writer` adapters the model is Claude Code's own alias or id, and the same suffix becomes its `--effort`, bounded by `subagents.maxThinking` and by an enforced `subagents.modelScope`. |
|
|
84
84
|
| `options.missionId` | string | - | Attach a workflow, including each fire of `schedule.create`, to an existing project mission. Scheduled attachment uses ordinary lifecycle and retention rules. |
|
|
85
|
+
| `options.reuseFrom` | string | - | Exact id of an async workflow run stopped by a runtime replacement (`workflow.stopCause: "runtime-replaced"`). An async relaunch of the same script in the same cwd, from any session, reuses that run's finished children and waits for its running ones; see [Workflows](workflows.md). |
|
|
85
86
|
| `options.mission` | object/false | auto-create | Override the default enclosing mission with `{ title \| summary, objective?, goal?, budget?, labels? }`. Set exactly one non-empty `title` or `summary`; `objective` and `labels` are optional. `goal` may only be `true`, requires `budget.tokens`, and enables continuation notices. Pass `false` for an intentionally ephemeral workflow with no mission for it or its children and no `state` global. Explicit mission persistence failures are strict. |
|
|
86
87
|
| `options.handoffPath` | string | - | Aggregate handoff manifest for `action: "worktree.discard"` or lane evidence actions, or optional explicit metadata for `action: "worktree.cleanup"`. |
|
|
87
88
|
| `options.repo` | string | runtime cwd | Repository path for `action: "worktree.cleanup"`; required explicitly for apply. The configured worktree base filters candidates by their per-project folder under it but never discovers them. |
|
|
@@ -131,7 +132,17 @@ Bound writer work with a narrow task and an outer `timeoutMs` or `maxRuntimeMs`
|
|
|
131
132
|
|
|
132
133
|
Explicit `context: "fork"` fails fast when the parent session is not persisted, the current leaf is missing, or the branched child session cannot be created. By contrast, global `defaultSubagentContext: "fork"` and agent-level `defaultContext: fork` are preferences: when the parent has no persisted session file or current leaf yet, the launch uses `fresh` immediately instead of failing and requiring a retry. Global `defaultSubagentContext: "fresh"` starts fresh. Explicit `context: "fresh"` always wins over both preferences.
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
A forked child keeps the inherited transcript as the parent sent it, signed Anthropic `thinking` blocks included: a signature covers its block's content, so a verbatim copy stays valid, and Pi replays a signed block only to the model that signed it. Raw `redacted_thinking` blocks, signed thinking in a `context_edit` replacement, and every signed or redacted Anthropic thinking block of a [pruned fork](configuration.md#forkcontext) are still removed. The child keeps its requested thinking level either way. Explicit `context: "fork"` never silently downgrades to `fresh`.
|
|
136
|
+
|
|
137
|
+
A forked child's requests start exactly as its parent's last request did, so the provider reads the whole inherited conversation from the parent's prompt cache:
|
|
138
|
+
|
|
139
|
+
- The child sends its parent's system prompt and tool declarations unchanged. Its own instructions (its agent prompt, the subagent boundary, structured-output rules, and the list of tools it can call) go in a `<subagent_instructions>` block at the start of its task message. Sections that describe a loadout (tools, rules, docs, skills, advertised subagents, MCP servers, project context) are not repeated there.
|
|
140
|
+
- A fork's prompt therefore includes the parent's base prompt, project and global context, skills (the bundled `pi-subagents` skill included), the parent's subagent catalog, and its list of running runs when that is shown. This holds even when the fork's agent sets `inheritProjectContext`, `inheritGlobalContext`, or `inheritSkills` to `false`, and `systemPromptMode: replace` does not remove the parent's base prompt: the agent prompt goes in the instructions block in both modes.
|
|
141
|
+
- A parent tool the child does not have stays declared, and calling it returns Pi's "not found" error without running anything. A tool only the child has is declared at the fork point. Models whose Pi `compat` sets `supportsMidConvoSystemMessages` and `supportsMidConvoToolChanges` take it there and keep the cache; others get it appended to the tool list, which changes the very start of the request and loses the cache. Give a fork agent no tool the parent lacks to keep its cache on those models.
|
|
142
|
+
- A tool the child defines differently under a parent tool's name, such as a `structured_output` with its own schema, is declared again at the fork point with the child's definition, so the model sees the schema the child's tool checks. Pi cannot redefine a tool in place, so that request sends the child's tool list and loses the cache.
|
|
143
|
+
- On Anthropic-style endpoints where Pi sends a session-affinity header, a child that runs on the model that wrote its inherited history sends its parent's session id, so a router with several upstreams sends it to the one that holds the parent's cache. A child on another model sends its own session id.
|
|
144
|
+
- A child on a different model than its parent gets each inherited thinking block as plain text, so the parent's reasoning is sent to that model's provider. Pi-shaped redacted thinking (`redacted: true` on a `thinking` block) is kept in a verbatim fork and replayed only to the model that wrote it.
|
|
145
|
+
- Another extension that returns a replacement `systemPrompt` from `before_agent_start` in the child replaces the parent's prompt and loses the cache. After a compaction in the child, no inherited message remains, so the child sends its own prompt with the boundary as a prompt section.
|
|
135
146
|
|
|
136
147
|
In workflow runs that omit `context`, each `runs.run` child follows the global `defaultSubagentContext` when set, then its own `defaultContext`. Without the global setting, a fresh-default worker can run fresh beside a fork-default oracle. If the parent session file or current leaf is not available yet, implicit fork-default children run fresh. Pass explicit `context: "fork"` or `context: "fresh"` when you intentionally want one context for every child.
|
|
137
148
|
|
package/docs/workflows.md
CHANGED
|
@@ -29,7 +29,9 @@ Stop and report the exact failure, run/status, and repository/cwd/worktree/branc
|
|
|
29
29
|
|
|
30
30
|
Failed workflow details and async `status.json` include `workflow.failureKind` as `validation`, `script`, `child`, `return-serialization`, `timeout`, `detached-child`, or `runtime`. `validation` means the host rejected the script before it ran (syntax or portability) or at completion (unawaited calls); errors thrown into a running script, including rejected `runs.run` parameters and runtime `SyntaxError`s, are `script` because the script could catch them, and failed children are `child`. `runtime` covers host setup and infrastructure failures, such as an unavailable cwd or a crashed worker. A workflow that is stopped or reloaded is not a failure and has no `failureKind`.
|
|
31
31
|
|
|
32
|
-
When `/reload`, a session resume, or a pi-web project switch replaces the extension runtime, a running async workflow stops with `workflow.stopCause: "runtime-replaced"` in `status.json`, and its awaited async children keep running. Its in-process foreground children are stopped, including ones that detached to ask their supervisor. When the same workflow script is launched again with the same `args` in that session, a `runs.run` with the same key and params returns a child that already finished successfully without launching it, and waits for a child that is still running instead of starting another. Those results carry `reused: true`, their step and trace entry are marked `reused`, and the new run records `workflow.reusedFrom`. Failed and stopped children, and children that ran in-process, launch again. Reuse applies only when the newest run of that script and args in the session was stopped this way; a user stop or a completed run ends it.
|
|
32
|
+
When `/reload`, a session resume, or a pi-web project switch replaces the extension runtime, a running async workflow stops with `workflow.stopCause: "runtime-replaced"` in `status.json`, and its awaited async children keep running. Its in-process foreground children are stopped, including ones that detached to ask their supervisor. When the same workflow script is launched again with the same `args` in that session, a `runs.run` with the same key and params returns a child that already finished successfully without launching it, and waits for a child that is still running instead of starting another. Those results carry `reused: true`, their step and trace entry are marked `reused`, and the new run records `workflow.reusedFrom`. Failed and stopped children, and children that ran in-process, launch again. Reuse applies only when the newest run of that script and args in the session was stopped this way; a user stop or a completed run ends it. From another session, such as one that took over after a handoff, relaunch the same script as an async workflow with `options: { reuseFrom: "<stopped run id>" }`; the run must have stopped this way in the same cwd, and `args` may differ, because each child is still reused only when its key and params match.
|
|
33
|
+
|
|
34
|
+
After `/new`, `/resume`, or a fork in the same Pi process, the new session owns the async runs of the session it replaced, and of the sessions that one replaced. It can list, `bg_wait` on, steer, stop, and resume them, receives their completion notices, and answers their children's pending supervisor requests. Over RPC, a host can steer, interrupt, stop, resume, and inspect them, and sees them in the fleet and `subagent-async` snapshots. Startup and other Pi processes inherit nothing; `/reload` adds nothing new but keeps what the session already inherited. To relaunch a stopped workflow instead of controlling its children one by one, use `options.reuseFrom`.
|
|
33
35
|
|
|
34
36
|
Pi core may print a generic `pi -ne` extension-load hint; that out-of-repo hint is not protocol-approved fallback. A verified compaction abort may continue the retained child once on its already resolved model; it does not authorize an execution-mode or model switch.
|
|
35
37
|
|
|
@@ -429,7 +431,7 @@ known, or for explicit emergency hotfix lanes.
|
|
|
429
431
|
|
|
430
432
|
For watched same-repo workflows, pass `async:false` only when the parent must block until completion. That blocking mode also shows the live in-chat workflow card. `chatProgress` can force `off` or `live-card` when the automatic policy is not what you want. Blocking workflows default to a 30-minute timeout; async workflows have no default timeout. See the [tool reference](tool-reference.md) for the full parameter list.
|
|
431
433
|
|
|
432
|
-
Synchronous workflows publish trace and `emit(...)` updates through the tool update callback regardless of `chatProgress`, including RPC/headless and cross-repository runs. These updates include `details.workflow` and `details.workflowChildren`; `chatProgress: "off"` disables the live card, not transport progress. Running foreground child rows additionally expose bounded `activity` (current tool, timing, and counters), plus resolved model/thinking when available, keyed by `childId`. Activity-only updates coalesce over 100 ms; lifecycle updates remain immediate. Activity clears when children settle, and is not persisted for async workflows. Tool names are limited to 256 UTF-8 bytes and each activity object is below 2 KiB (including JSON escaping); arguments and transcripts are not forwarded.
|
|
434
|
+
Synchronous workflows publish trace and `emit(...)` updates through the tool update callback regardless of `chatProgress`, including RPC/headless and cross-repository runs. These updates include `details.workflow` and `details.workflowChildren`; `chatProgress: "off"` disables the live card, not transport progress. Once a child launches, its running row carries its `agent` and `runId`; for a child running in the background, that `runId` is the id of its run node in the `subagent-async` snapshot. Running foreground child rows additionally expose bounded `activity` (current tool, timing, and counters), plus resolved model/thinking when available, keyed by `childId`. Activity-only updates coalesce over 100 ms; lifecycle updates remain immediate. Activity clears when children settle, and is not persisted for async workflows. Tool names are limited to 256 UTF-8 bytes and each activity object is below 2 KiB (including JSON escaping); arguments and transcripts are not forwarded.
|
|
433
435
|
|
|
434
436
|
The workflow result text keeps the Return, Emitted, and Console sections, and a failed workflow's error, under 200 KB and 5000 lines, or under `maxOutput` when set. Each call-trace error is cut to 500 characters. A cut adds a `[TRUNCATED: ... - full output at <path>]` line. The full text goes to the workflow `output` file when one is set, otherwise to `<run>_workflow-result.md` in the run's artifacts directory, outside the `outputs/` tree where children save their reports. That file has the same retention as the other run artifacts: age-based cleanup removes it from temp and session artifact directories, and `artifactDir: "project"` files are kept. The status line, the rest of each trace line, warnings, and output-path mappings are never cut. Async completion notices and `action: "status"` show short previews; a cut preview or async error ends in `…` and names the run's `status.json`, which holds the full `workflow.value`, `workflow.emits`, and `error`.
|
|
435
437
|
|
package/package.json
CHANGED
|
@@ -105,6 +105,7 @@ For an authorized complex delegated workflow, read `prompting-and-roles.md` and
|
|
|
105
105
|
## Operating rules
|
|
106
106
|
|
|
107
107
|
- Avoid duplicate scouts, overlapping writers, and vague prompts without a concrete deliverable.
|
|
108
|
+
- Call `subagent`, `subagents_enable`, `subagent_supervisor`, `contact_supervisor`, and `structured_output` as ordinary model tool calls. They are model-only, so codemode scripts cannot reach them through `tools.*`, `ALL_TOOLS`, or `searchTools`.
|
|
108
109
|
- Keep the parent on the ordinary strong default model. Route workers/scouts to a fast capable tier, serious reviews to a strong tier, and top reasoning to bounded read-only critique.
|
|
109
110
|
- Exact model names are deployment policy. Put them in user/project settings or profiles, not package guidance.
|
|
110
111
|
- Give every child a compact meta-prompt checklist: objective; repo/cwd/ref; authority/edit boundary; relevant files/contracts and constraints; success/acceptance criteria; validation; expected output/report; and stop/ask conditions. See `references/prompting-and-roles.md`.
|
|
@@ -558,4 +558,6 @@ subagent_supervisor({ action: "pending" })
|
|
|
558
558
|
|
|
559
559
|
Native supervisor coordination does not expose generic `intercom` as a fallback. Use `subagent_supervisor` for parent replies.
|
|
560
560
|
|
|
561
|
+
`subagent`, `subagents_enable`, `subagent_supervisor`, `contact_supervisor`, and `structured_output` are model-only: call them as ordinary model tool calls. Codemode scripts cannot reach them through `tools.*`, `ALL_TOOLS`, or `searchTools`.
|
|
562
|
+
|
|
561
563
|
If intercom messages do not show up, run `subagent({ action: "doctor" })` or `/subagents-doctor`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-pinning.d.ts","sourceRoot":"","sources":["../../../src/extension/declaration-pinning.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAoB,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"declaration-pinning.d.ts","sourceRoot":"","sources":["../../../src/extension/declaration-pinning.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAoB,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA+JvC;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAExF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,IAAI,CAMrI;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAE7E"}
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { declarationsEqual, getCurrentSystemMessage, toToolDeclaration } from "@earendil-works/pi-ai";
|
|
2
2
|
const pinsByApi = new WeakMap();
|
|
3
3
|
const GUIDELINES_PLACEHOLDER = "\u0000pi-subagents guidelines";
|
|
4
|
+
/**
|
|
5
|
+
* A recorded description without the text a host appends to each declared tool, such as Pi's
|
|
6
|
+
* codemode note on script-callable tools. The host decorates whatever is registered, so reusing a
|
|
7
|
+
* decorated description would add the note again on every session start (#2889). Drops a repeated
|
|
8
|
+
* trailing paragraph, then a trailing paragraph added after the current description.
|
|
9
|
+
*/
|
|
10
|
+
function undecorated(recorded, current) {
|
|
11
|
+
const paragraphs = recorded.split("\n\n");
|
|
12
|
+
while (paragraphs.length > 1 && paragraphs.at(-1) === paragraphs.at(-2))
|
|
13
|
+
paragraphs.pop();
|
|
14
|
+
const stripped = paragraphs.join("\n\n");
|
|
15
|
+
return stripped.startsWith(`${current}\n\n`) ? current : stripped;
|
|
16
|
+
}
|
|
4
17
|
function pinnedDefinition(tool, pin) {
|
|
5
18
|
const { constrainedSampling, promptSnippet, promptGuidelines, ...rest } = tool;
|
|
6
19
|
// An unchanged declaration keeps the registered schema object rather than its JSON copy.
|
|
7
|
-
const
|
|
20
|
+
const recorded = pin ? { ...pin.declaration, description: undecorated(pin.declaration.description, rest.description) } : undefined;
|
|
21
|
+
const declaration = recorded && !declarationsEqual(recorded, tool) ? recorded : undefined;
|
|
8
22
|
const definition = { ...rest, description: declaration?.description ?? rest.description, parameters: declaration?.parameters ?? rest.parameters };
|
|
9
23
|
const sampling = declaration ? declaration.constrainedSampling : constrainedSampling;
|
|
10
24
|
if (sampling !== undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration-pinning.js","sourceRoot":"","sources":["../../../src/extension/declaration-pinning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,iBAAiB,EAA+C,MAAM,uBAAuB,CAAC;AA8BnJ,MAAM,SAAS,GAAG,IAAI,OAAO,EAAsB,CAAC;AACpD,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AAE/D,SAAS,gBAAgB,CAAC,IAAkB,EAAE,GAA4B;IACzE,MAAM,EAAE,mBAAmB,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAC/E,yFAAyF;IACzF,MAAM,
|
|
1
|
+
{"version":3,"file":"declaration-pinning.js","sourceRoot":"","sources":["../../../src/extension/declaration-pinning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,iBAAiB,EAA+C,MAAM,uBAAuB,CAAC;AA8BnJ,MAAM,SAAS,GAAG,IAAI,OAAO,EAAsB,CAAC;AACpD,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AAE/D;;;;;GAKG;AACH,SAAS,WAAW,CAAC,QAAgB,EAAE,OAAe;IACrD,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAAE,UAAU,CAAC,GAAG,EAAE,CAAC;IAC1F,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnE,CAAC;AAED,SAAS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ACH,MAAM,UAAU,qBAAqB,CAAC,EAAgB,EAAE,MAAe;IACtE,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extension/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAoC,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extension/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAoC,MAAM,iCAAiC,CAAC;AAmCtG,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA8BjG,OAAO,EAIN,KAAK,aAAa,EAYlB,MAAM,oBAAoB,CAAC;AAoI5B,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,EAAE,CA6C7E;AAED,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAs4BxE"}
|
package/src/extension/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { registerRuntimeAgentEventListener } from "../agents/runtime-agent-event
|
|
|
24
24
|
import { ensureAccessibleDir } from "../shared/accessible-dir.js";
|
|
25
25
|
import { cleanupAllArtifactDirs, cleanupOldArtifacts, getArtifactsDir } from "../shared/artifacts.js";
|
|
26
26
|
import { resolveCurrentSessionId } from "../shared/session-identity.js";
|
|
27
|
+
import { recordSessionReplacement } from "../shared/session-succession.js";
|
|
27
28
|
import { getAgentDir } from "../shared/utils.js";
|
|
28
29
|
import { isStaleExtensionContextError, MODEL_ONLY_TOOL, withCachedUiContext } from "../shared/extension-context.js";
|
|
29
30
|
import { currentCompletionOwnerId } from "../shared/completion-owner.js";
|
|
@@ -553,6 +554,13 @@ export default function registerSubagentExtension(pi) {
|
|
|
553
554
|
return undefined;
|
|
554
555
|
return createSlashResultComponent(details, options, theme, config.mainWindowRenderer, config.foregroundDetachShortcut, () => state.lastUiContext?.ui.theme ?? theme);
|
|
555
556
|
});
|
|
557
|
+
// Keep view-only reports in the transcript/RPC stream, but out of model context.
|
|
558
|
+
// SLASH_RESULT_TYPE carries delegated work and must remain model-visible.
|
|
559
|
+
pi.on("context", (event) => ({
|
|
560
|
+
messages: event.messages.filter((message) => message.role !== "custom"
|
|
561
|
+
|| message.customType !== SLASH_TEXT_RESULT_TYPE
|
|
562
|
+
|| message.details?.viewOnly !== true),
|
|
563
|
+
}));
|
|
556
564
|
pi.registerMessageRenderer(SLASH_TEXT_RESULT_TYPE, (message, _options, _theme) => {
|
|
557
565
|
const content = typeof message.content === "string"
|
|
558
566
|
? message.content
|
|
@@ -798,9 +806,10 @@ export default function registerSubagentExtension(pi) {
|
|
|
798
806
|
state.widgetsSuspended = false;
|
|
799
807
|
state.baseCwd = ctx.cwd;
|
|
800
808
|
goalTurnId = 0;
|
|
801
|
-
const previousRuntimeSessionId = state.currentSessionId;
|
|
802
|
-
resultDeliveryOwnership.claimPredecessor(previousSessionFile, previousRuntimeSessionId);
|
|
803
809
|
state.currentSessionId = resolveCurrentSessionId(ctx.sessionManager);
|
|
810
|
+
// Pi passes previousSessionFile only for new/resume/fork, after tearing that session down in this process.
|
|
811
|
+
if (previousSessionFile)
|
|
812
|
+
recordSessionReplacement(state.currentSessionId, previousSessionFile);
|
|
804
813
|
state.supervisorOwnerSessionId = ctx.sessionManager.getSessionId() || null;
|
|
805
814
|
transitionResultDelivery();
|
|
806
815
|
owedResultRunIds.clear();
|
|
@@ -904,7 +913,6 @@ export default function registerSubagentExtension(pi) {
|
|
|
904
913
|
modulePreloadTimer = undefined;
|
|
905
914
|
asyncRetentionAbort.abort();
|
|
906
915
|
stopResultWatcher();
|
|
907
|
-
resultDeliveryOwnership.clear();
|
|
908
916
|
completionNotifier.dispose();
|
|
909
917
|
mainWatchdog.dispose();
|
|
910
918
|
scheduledRunManager.stop();
|
|
@@ -993,7 +1001,12 @@ export default function registerSubagentExtension(pi) {
|
|
|
993
1001
|
herdrStatusBridge.agentStarted();
|
|
994
1002
|
programStatus.agentStarted();
|
|
995
1003
|
});
|
|
996
|
-
pi.on("message_start", (event) =>
|
|
1004
|
+
pi.on("message_start", (event) => {
|
|
1005
|
+
// Pi also compacts between turns of a running loop, with no agent_start after it. A message
|
|
1006
|
+
// starts only once that compaction has finished and its status indicator is cleared.
|
|
1007
|
+
resumeWidgetsAfterCompaction();
|
|
1008
|
+
completionNotifier.messageStarted(event.message);
|
|
1009
|
+
});
|
|
997
1010
|
pi.on("agent_settled", () => {
|
|
998
1011
|
resumeWidgetsAfterCompaction();
|
|
999
1012
|
programStatus.agentSettled();
|