pi-subagents 0.87.0 → 0.88.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +3 -3
  4. package/bundle/{chunk-3CVOAS77.js → chunk-2DIEL4WG.js} +2 -2
  5. package/bundle/{chunk-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
  6. package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
  7. package/bundle/{chunk-XV7RTWTS.js → chunk-4ZQBZDF3.js} +21 -6
  8. package/bundle/{chunk-LZKVUWIY.js → chunk-5EMPFFO4.js} +30 -5
  9. package/bundle/{chunk-OOE3R7IQ.js → chunk-6CG2VAG4.js} +2 -2
  10. package/bundle/{chunk-LFKMM3UH.js → chunk-6OWNDN7R.js} +2 -2
  11. package/bundle/{chunk-HDICKROY.js → chunk-7OX6O7DQ.js} +31 -14
  12. package/bundle/{chunk-PGU4TZV3.js → chunk-CPSUJHZE.js} +417 -455
  13. package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
  14. package/bundle/{chunk-SIAQXPJ4.js → chunk-D32H53HM.js} +21 -9
  15. package/bundle/{chunk-YEXKJJVS.js → chunk-DSHQWGHO.js} +4 -4
  16. package/bundle/{chunk-DGTZKYIE.js → chunk-FLNDHNPE.js} +75 -44
  17. package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
  18. package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
  19. package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
  20. package/bundle/{chunk-2NY5PCKQ.js → chunk-LV3CPYXJ.js} +4 -4
  21. package/bundle/{chunk-AIL46SZU.js → chunk-N6TAAIB3.js} +6 -4
  22. package/bundle/{chunk-EYGBK6CE.js → chunk-PCZEQQAQ.js} +114 -49
  23. package/bundle/{chunk-2D2DQGC2.js → chunk-PYKBTBY6.js} +27 -10
  24. package/bundle/{chunk-M2VBGET6.js → chunk-RMZAAXIR.js} +7 -2
  25. package/bundle/{chunk-OTLDAYEQ.js → chunk-VTUUOLM4.js} +14 -5
  26. package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
  27. package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
  28. package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
  29. package/bundle/chunk-YDZ7BZD5.js +523 -0
  30. package/bundle/{chunk-JLDQ6YUR.js → chunk-YQSTGPEU.js} +12 -12
  31. package/bundle/{chunk-OZCPYJEY.js → chunk-ZJ2BT5TI.js} +130 -49
  32. package/bundle/control-channel.js +2 -2
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +2 -2
  35. package/bundle/preflight.js +9 -9
  36. package/bundle/project-panes.js +3 -3
  37. package/bundle/required-child-extensions.js +1 -1
  38. package/docs/agents.md +4 -2
  39. package/docs/configuration.md +7 -3
  40. package/docs/observability.md +2 -0
  41. package/docs/tool-reference.md +4 -1
  42. package/docs/workflows.md +3 -1
  43. package/package.json +2 -2
  44. package/skills/pi-subagents/SKILL.md +8 -2
  45. package/src/agents/agent-management.d.ts +1 -0
  46. package/src/agents/agent-management.js +12 -4
  47. package/src/agents/agents.d.ts +1 -0
  48. package/src/agents/agents.js +2 -2
  49. package/src/extension/config.d.ts +1 -0
  50. package/src/extension/config.js +6 -0
  51. package/src/extension/index.d.ts +1 -1
  52. package/src/extension/index.js +47 -23
  53. package/src/extension/schemas.d.ts +2 -0
  54. package/src/extension/schemas.js +1 -0
  55. package/src/extension/subagent-launch-tool.d.ts +6 -2
  56. package/src/extension/subagent-launch-tool.js +13 -9
  57. package/src/extension/tool-activation.js +20 -3
  58. package/src/runs/background/async-resume.js +2 -1
  59. package/src/runs/background/async-retention.d.ts +0 -2
  60. package/src/runs/background/async-retention.js +11 -5
  61. package/src/runs/background/async-status.d.ts +2 -0
  62. package/src/runs/background/async-status.js +4 -0
  63. package/src/runs/background/run-child-session.d.ts +2 -2
  64. package/src/runs/background/run-child-session.js +4 -7
  65. package/src/runs/background/stale-run-reconciler.js +17 -8
  66. package/src/runs/background/steering.d.ts +2 -11
  67. package/src/runs/background/steering.js +11 -6
  68. package/src/runs/background/subagent-runner.d.ts +0 -2
  69. package/src/runs/background/subagent-runner.js +73 -58
  70. package/src/runs/foreground/async-steering-action.js +24 -9
  71. package/src/runs/foreground/execution.js +32 -15
  72. package/src/runs/foreground/prompt-audit.js +1 -0
  73. package/src/runs/foreground/subagent-executor.d.ts +1 -8
  74. package/src/runs/foreground/subagent-executor.js +17 -21
  75. package/src/runs/shared/async-status-projection.d.ts +2 -0
  76. package/src/runs/shared/async-status-projection.js +10 -0
  77. package/src/runs/shared/child-launch.js +6 -3
  78. package/src/runs/shared/child-session.d.ts +1 -1
  79. package/src/runs/shared/child-session.js +24 -30
  80. package/src/runs/shared/mcp-config-sources.d.ts +2 -0
  81. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +5 -5
  82. package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -15
  83. package/src/runs/shared/subagent-prompt-runtime.js +14 -2
  84. package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
  85. package/src/runs/shared/supervisor-wait-timer.js +61 -0
  86. package/src/shared/artifacts.d.ts +1 -0
  87. package/src/shared/artifacts.js +107 -9
  88. package/src/shared/compaction-interruption.d.ts +9 -0
  89. package/src/shared/compaction-interruption.js +47 -0
  90. package/src/shared/parent-wake.d.ts +3 -2
  91. package/src/shared/parent-wake.js +14 -3
  92. package/src/shared/reported-progress.d.ts +1 -0
  93. package/src/shared/reported-progress.js +12 -0
  94. package/src/shared/required-child-extensions.d.ts +2 -0
  95. package/src/shared/required-child-extensions.js +27 -0
  96. package/src/shared/status-format.d.ts +1 -0
  97. package/src/shared/status-format.js +1 -1
  98. package/src/shared/types.d.ts +9 -0
  99. package/src/shared/utils.d.ts +3 -1
  100. package/src/shared/utils.js +4 -0
  101. package/src/tui/fleet.d.ts +7 -2
  102. package/src/tui/fleet.js +22 -0
  103. package/src/tui/render.js +33 -2
  104. package/src/watchdog/permission-arbiter.js +1 -0
  105. package/src/watchdog/review.d.ts +0 -5
  106. package/src/watchdog/review.js +2 -1
  107. package/src/workflows/workflow-script-worker.js +3 -1
  108. package/bundle/chunk-XSDYTXHF.js +0 -242
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.88.1] - 2026-11-12
6
+
7
+ ### Highlights
8
+
9
+ - A permission prompt or other dialog that opens while the fleet inspector is up is no longer hidden behind it.
10
+ - Background subagents whose agent has no tool list get your configured MCP tools again, and an extension that registers its own MCP server no longer stops subagents from starting.
11
+ - `status` and `stop` no longer report a cleanly finishing background subagent as having ended without proof.
12
+ - A manual `/compact` no longer wakes an idle parent while background subagents are running.
13
+
14
+ ### Fixed
15
+
16
+ - The fleet inspector no longer covers a dialog that opens while it is up, such as a permission prompt from another extension or a `select`/`confirm`. The inspector steps aside while the dialog is open and comes back, with the same child selected, when it closes. Before, the dialog sat hidden behind the inspector, so `q` seemed to do nothing and Esc answered the hidden prompt. Thanks to [@imLWY](https://github.com/imLWY) for #3254.
17
+ - Background subagents whose agent doesn't list `tools` now get the direct MCP tools you configured in pi-mcp-adapter, as long as no capability ceiling applies. Agents that only set `excludeTools` keep every tool they don't exclude. Before, these subagents lost all direct MCP tools. Thanks to [@acolomba](https://github.com/acolomba) for #3259.
18
+ - A subagent no longer fails to start when one of its required child extensions registers an MCP server with `pi.registerMcpServer()` and the agent selects no `mcp:` tools. Before, the launch stopped with "Required child extension failed during startup". The subagent now runs and shows Pi's message as a warning in its output; any other startup failure of a required extension still stops the launch. With Pi's built-in MCP, foreground subagents can also select `mcp:` tools from servers their required child extensions register; before, every server an extension registered was refused in the foreground. Thanks to [@NicholasSend](https://github.com/NicholasSend) for #3256.
19
+ - `status` and `stop` no longer report a background subagent's exit as `unknown` (`observer-unavailable`) when they are called in the moment between the subagent saving its result and saving its final status. The run now keeps showing `running` until it finishes. Before, a caller waiting for proof that the run ended could see an unverifiable end for a run that exited cleanly. Thanks to [@Ancienttwo](https://github.com/Ancienttwo) for #3258.
20
+ - An extension that changes a workflow child's `task` in its `tool_call` handler for `subagent_launch` now changes what that child is told. Before, the change was dropped and the child got the original text, although Pi applies such changes for every other tool. This covers workflow scripts, `parallel`, `tasks` and `chain`, including steps built from `{previous}`. Other fields and a resumed child's message still can't be changed.
21
+ - With background subagents running, a manual compaction (`/compact`, RPC `compact` or an extension's `ctx.compact()`) no longer starts a turn when the parent was idle or stopped with Esc. Before, every manual compaction resumed the parent, so an extension that compacts on `agent_settled` made it answer "still waiting" each time. A compaction that interrupts a working parent still resumes it. A subagent result that arrives during a compaction now wakes the parent once the compaction ends, instead of starting a run mid-compaction. Thanks to [@IdrisGit](https://github.com/IdrisGit) for #3253 and [@jyshowalter](https://github.com/jyshowalter) for the report. (#3252)
22
+
23
+ ## [0.88.0] - 2026-11-10
24
+
25
+ ### Highlights
26
+
27
+ - The widget and `status` now show the latest progress a running child reported, with how long ago it reported.
28
+ - A child waiting for your answer no longer runs out its `timeoutMs` while it waits, and a reply cut off at the model's output limit now fails instead of passing as a success.
29
+ - Forked subagents stop filling the disk: their copies of the parent session are deleted once they go unused for `cleanupDays`.
30
+ - Big agent catalogs stay small in the conversation: `list` shows at most 30 agents and has a `search` filter.
31
+ - Fixes for pi Desktop workflow scripts, Windows machines that block PowerShell, disabled MCP servers, and gateways that require a prompt cache key.
32
+
33
+ ### Added
34
+
35
+ - The subagent widget shows the latest progress a running child reported with `contact_supervisor` (`progress_update`), with how long ago it reported, and `status` lists it on the child's line. Before, the report text was not shown anywhere in the parent. Thanks to [@kodfodrasz](https://github.com/kodfodrasz) for #3230.
36
+ - `{ action: "list" }` takes an `options.search` filter that matches agent names, descriptions and aliases. Thanks to [@peskycipher](https://github.com/peskycipher) for the report. (#3225)
37
+
38
+ ### Fixed
39
+
40
+ - A run's remaining `timeoutMs` budget no longer changes when the system clock is adjusted. Before, setting the clock back or forward during a run could add that much time to the budget or end the run early. Thanks to [@Osraka](https://github.com/Osraka) for #3247.
41
+ - A subagent run's `timeoutMs` no longer counts the time a child spends waiting for its supervisor to answer a `contact_supervisor` decision or interview, or an `intercom` ask. Before, a child that asked late in a run could time out while it waited, and the run was reported as failed even though the child did the right thing. Thanks to [@adrian-ludwig](https://github.com/adrian-ludwig) for #3228.
42
+ - A subagent whose final reply was cut off at the model's maximum output length now fails with "Response was truncated: the model reached its maximum output length." and keeps the partial reply for inspection. Before, the run was reported as a success with the cut-off text as its answer. A run that already returned a valid `structured_output` still succeeds. Thanks to [@adrian-ludwig](https://github.com/adrian-ludwig) for #3226.
43
+ - With `toolActivation: "auto"`, switching models before the first message now picks the subagent tools for the model you switched to. Before, the choice was made for the startup model, so a session that switched to a model that can't add tools mid-conversation kept the loader, and calling it later made the provider miss its prompt cache. Thanks to [@IdrisGit](https://github.com/IdrisGit) for #3241.
44
+ - A subagent's final acceptance report now reaches the parent intact. Before, a steer or follow-up queued while the child was finishing started another turn after the report, and the parent received that turn's text instead of the report. A steer the child rejects now stays rejected until you resume the child, instead of the child being restarted automatically. Thanks to [@adrian-ludwig](https://github.com/adrian-ludwig) for #3227.
45
+ - The bundled `undici` dependency is now 8.12.4, which fixes the security advisories published against 8.12.3 (cache and redirect information disclosure, credential stripping, a skipped integrity check, and an uncaught exception). Thanks to [@dzervas](https://github.com/dzervas) for the report. (#3242)
46
+ - On Windows machines where policy blocks `powershell.exe`, the cleanup of old background subagent state now finishes. Before, it stopped with `spawn UNKNOWN` and printed the error over the footer every session. A cleanup failure now shows as a warning in Pi instead of raw text over the screen. Thanks to [@SuperSalsa20](https://github.com/SuperSalsa20) for the report. (#3240)
47
+ - Subagents now skip `mcp:` selectors for pi-mcp-adapter servers explicitly configured with `disabled: true`. Before, a disabled server could prevent a child from launching. Unknown servers and enabled servers without matching cached tools still fail the launch. Thanks to [@shura-v](https://github.com/shura-v) for #3238.
48
+ - Workflow scripts start on hosts that run Pi on Electron, such as pi Desktop. Before, Electron left the sandbox flags in the script process's arguments and every workflow script failed with `Cannot find module '--allow-worker'`. Thanks to [@hotsnow-sean](https://github.com/hotsnow-sean) for #3222.
49
+ - A forked subagent (`context: "fork"`) launched in another folder than the parent session now gets that folder's `AGENTS.md` / `CLAUDE.md`. Before, it kept only the parent's project instructions, so a fork started in a repository worktree never saw the repository's `AGENTS.md`.
50
+ - The copies of the parent session that forked subagents write under `<parent session>/forks/` are now deleted once nothing has written to them for `artifactConfig.cleanupDays` (default 7) and their run is no longer active. Before, nothing deleted them; one parent session of about 400 MB filled 22 GB in a day with 57 forks. Resuming a child whose copy was deleted now says so. (#3232)
51
+ - `{ action: "list" }` now shows at most 30 agents and points to `options.search` for the rest. Before, it printed every agent with its full description, so a catalog of a few hundred agents put about 160 KB into the conversation in one call.
52
+ - In a non-interactive session (`pi -p`), Pi now waits for background subagent work at the end of a turn for as long as the `timeoutMs` setting allows a run to take. Before, it always gave up after 30 minutes, so a parent that ended its turn to wait for a longer child failed and exited before the child's result arrived. Without `timeoutMs`, the wait is still 30 minutes. Thanks to [@mt-huerta](https://github.com/mt-huerta) for #3229.
53
+ - The Watchdog's own model requests (reviews and permission decisions) and Prompt Audit's task rewrite now carry the parent session id, so providers that key prompt caching on it get a `prompt_cache_key`. Before, a gateway that requires one rejected every Watchdog review with HTTP 400. Thanks to [@hetingyi](https://github.com/hetingyi) for #3223.
54
+
5
55
  ## [0.87.0] - 2026-11-07
6
56
 
7
57
  ### Highlights
package/bundle/agents.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  RUNTIME_AGENT_REGISTER_EVENT,
3
3
  RUNTIME_AGENT_REGISTER_VERSION,
4
4
  registerAgentViaEvents
5
- } from "./chunk-BFF6YDK6.js";
5
+ } from "./chunk-L4YY2TOE.js";
6
6
  import {
7
7
  registerRuntimeAgent
8
- } from "./chunk-C5QWQSSM.js";
9
- import "./chunk-C3KWLXDH.js";
8
+ } from "./chunk-KXW62VBU.js";
9
+ import "./chunk-4MVDMA5C.js";
10
10
  import "./chunk-JEZOSEWG.js";
11
11
  import "./chunk-YFCK7H2S.js";
12
12
  import "./chunk-QXASAHIA.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  resolvePiLaunchToolPlan
3
- } from "./chunk-SIAQXPJ4.js";
4
- import "./chunk-CTPAE36Y.js";
5
- import "./chunk-C3KWLXDH.js";
3
+ } from "./chunk-D32H53HM.js";
4
+ import "./chunk-YARY7JWU.js";
5
+ import "./chunk-4MVDMA5C.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
8
  import "./chunk-QXASAHIA.js";
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-7J4ZXMY7.js";
4
4
  import {
5
5
  getProjectSubagentsDir
6
- } from "./chunk-XSDYTXHF.js";
6
+ } from "./chunk-YDZ7BZD5.js";
7
7
  import {
8
8
  getPiSpawnCommand,
9
9
  writeAtomicJson
10
- } from "./chunk-C3KWLXDH.js";
10
+ } from "./chunk-4MVDMA5C.js";
11
11
 
12
12
  // src/inspectors/herdr/project-panes.ts
13
13
  import * as fs from "node:fs";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7F6RKT6W.js";
4
4
  import {
5
5
  getAgentDir
6
- } from "./chunk-C3KWLXDH.js";
6
+ } from "./chunk-4MVDMA5C.js";
7
7
 
8
8
  // src/intercom/intercom-bridge.ts
9
9
  import * as fs from "node:fs";
@@ -4382,7 +4382,7 @@ function formatAvailableAgentLines(agents) {
4382
4382
  const short = description.length > MAX_LISTED_DESCRIPTION_CHARS ? `${description.slice(0, MAX_LISTED_DESCRIPTION_CHARS - 1).trimEnd()}\u2026` : description;
4383
4383
  return `- ${agent.name} (${agent.source})${short ? ` \u2014 ${short}` : ""}`;
4384
4384
  });
4385
- if (sorted.length > MAX_LISTED_AGENTS) lines.push(`+${sorted.length - MAX_LISTED_AGENTS} more; {action:"list"}`);
4385
+ if (sorted.length > MAX_LISTED_AGENTS) lines.push(`+${sorted.length - MAX_LISTED_AGENTS} more; {action:"list", options:{search:"<term>"}}`);
4386
4386
  return lines.length ? lines : ["- (none)"];
4387
4387
  }
4388
4388
  function suggestAgentName(name, agents) {
@@ -7781,6 +7781,10 @@ function getFinalOutput(messages) {
7781
7781
  function getSingleResultOutput(result) {
7782
7782
  return result.finalOutput ?? getFinalOutput(result.messages ?? []);
7783
7783
  }
7784
+ var TRUNCATED_RESPONSE_ERROR = "Response was truncated: the model reached its maximum output length.";
7785
+ function getTerminalAssistantStopReason(messages) {
7786
+ return messages.findLast((message) => message.role === "assistant")?.stopReason;
7787
+ }
7784
7788
  function getDisplayItems(messages) {
7785
7789
  if (!messages || messages.length === 0) return [];
7786
7790
  const items = [];
@@ -8715,6 +8719,8 @@ export {
8715
8719
  assistantMessageError,
8716
8720
  getFinalOutput,
8717
8721
  getSingleResultOutput,
8722
+ TRUNCATED_RESPONSE_ERROR,
8723
+ getTerminalAssistantStopReason,
8718
8724
  getDisplayItems,
8719
8725
  sumResultsUsage,
8720
8726
  toAgentToolUsage,
@@ -8793,6 +8799,7 @@ export {
8793
8799
  resolveEffectiveAcceptance,
8794
8800
  formatReviewGateLabel,
8795
8801
  formatAcceptancePrompt,
8802
+ parseAcceptanceReport,
8796
8803
  stripAcceptanceReport,
8797
8804
  validateAcceptanceReport,
8798
8805
  captureStagedIndexBaseline,
@@ -8828,6 +8835,7 @@ export {
8828
8835
  defaultInheritSkills,
8829
8836
  findBlockingAgentDiagnostic,
8830
8837
  unknownAgentDiagnosticContext,
8838
+ MAX_LISTED_AGENTS,
8831
8839
  formatAvailableAgentLines,
8832
8840
  suggestAgentName,
8833
8841
  formatUnknownAgentError,
@@ -46,16 +46,19 @@ import {
46
46
  validateModelResponseAliases,
47
47
  withWorkflowChildRunModel,
48
48
  withWorktreeTransaction
49
- } from "./chunk-PGU4TZV3.js";
49
+ } from "./chunk-CPSUJHZE.js";
50
50
  import {
51
51
  validateIntercomBridgeConfig
52
- } from "./chunk-ESWW6XSX.js";
52
+ } from "./chunk-47ZN7NKR.js";
53
53
  import {
54
54
  stableJsonDigest
55
55
  } from "./chunk-7F6RKT6W.js";
56
56
  import {
57
57
  snapshotRequiredChildExtensions
58
- } from "./chunk-CTPAE36Y.js";
58
+ } from "./chunk-YARY7JWU.js";
59
+ import {
60
+ missingForkCopyNote
61
+ } from "./chunk-YDZ7BZD5.js";
59
62
  import {
60
63
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
61
64
  assertWorkflowLaneKey,
@@ -80,7 +83,7 @@ import {
80
83
  validateToolBudgetConfig,
81
84
  waitForFileSystemRetry,
82
85
  writeAtomicJson
83
- } from "./chunk-C3KWLXDH.js";
86
+ } from "./chunk-4MVDMA5C.js";
84
87
  import {
85
88
  DIRS,
86
89
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -1241,6 +1244,8 @@ function projectStep(step, index, depth, ctx) {
1241
1244
  const activity = activityFor(step, ctx);
1242
1245
  const { id, label } = stepIdentity(step, index, ctx);
1243
1246
  const agent = publicOptionalText(step.agent, ctx.caps.maxStringLength);
1247
+ const progressText = publicOptionalText(step.progressText, ctx.caps.maxStringLength);
1248
+ const progressUpdatedAt = publicTime(step.progressUpdatedAt);
1244
1249
  const node = {
1245
1250
  id,
1246
1251
  kind: "step",
@@ -1249,7 +1254,9 @@ function projectStep(step, index, depth, ctx) {
1249
1254
  ...startedAt !== void 0 ? { startedAt } : {},
1250
1255
  ...updatedAt !== void 0 ? { updatedAt } : {},
1251
1256
  ...terminalState(state) && endedAt !== void 0 ? { endedAt } : {},
1252
- ...activity ? { activity } : {}
1257
+ ...activity ? { activity } : {},
1258
+ ...progressText ? { progressText } : {},
1259
+ ...progressUpdatedAt !== void 0 ? { progressUpdatedAt } : {}
1253
1260
  };
1254
1261
  if (agent) node.agent = agent;
1255
1262
  setStepModel(node, ctx, step);
@@ -1392,6 +1399,10 @@ function projectMaterializedStep(step, index, child, depth, ctx, childrenByParen
1392
1399
  const selfActivity = selfStep ? activityFor(selfStep, ctx) : void 0;
1393
1400
  const activity = laneActivity || selfActivity || live.activity ? { ...laneActivity, ...selfActivity, ...live.activity } : void 0;
1394
1401
  const node = { ...live, id, kind: "step", label };
1402
+ const progressText = publicOptionalText(selfStep?.progressText ?? step.progressText, ctx.caps.maxStringLength);
1403
+ const progressUpdatedAt = publicTime(selfStep?.progressUpdatedAt ?? step.progressUpdatedAt);
1404
+ if (progressText) node.progressText = progressText;
1405
+ if (progressUpdatedAt !== void 0) node.progressUpdatedAt = progressUpdatedAt;
1395
1406
  const agent = publicOptionalText(selfStep?.agent || step.agent, ctx.caps.maxStringLength);
1396
1407
  if (agent) node.agent = agent;
1397
1408
  if (activity) node.activity = activity;
@@ -2291,6 +2302,8 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2291
2302
  ...step.currentPath ? { currentPath: step.currentPath } : {},
2292
2303
  ...step.recentTools ? { recentTools: step.recentTools.map((tool) => ({ ...tool })) } : {},
2293
2304
  ...step.recentOutput ? { recentOutput: [...step.recentOutput] } : {},
2305
+ ...step.progressText ? { progressText: step.progressText } : {},
2306
+ ...step.progressUpdatedAt !== void 0 ? { progressUpdatedAt: step.progressUpdatedAt } : {},
2294
2307
  ...step.turnCount !== void 0 ? { turnCount: step.turnCount } : {},
2295
2308
  ...step.toolCount !== void 0 ? { toolCount: step.toolCount } : {},
2296
2309
  ...step.steering ? { steering: step.steering } : {},
@@ -2556,6 +2569,7 @@ function formatStepLine(step) {
2556
2569
  const modelThinking = formatModelThinking(step.model, step.thinking);
2557
2570
  if (modelThinking) parts.push(modelThinking);
2558
2571
  if (step.durationMs !== void 0) parts.push(formatDuration(step.durationMs));
2572
+ if (step.progressText && step.status === "running") parts.push(`progress: ${step.progressText}`);
2559
2573
  if (step.tokens) parts.push(`${formatTokens(step.tokens.total)} tok`);
2560
2574
  if (step.lane) parts.push(`lane ${step.lane.key}`);
2561
2575
  if (step.worktreePath) parts.push(`worktree ${shortenPath(step.worktreePath)} \xB7 branch ${step.branch ?? "unknown"}${step.provider ? ` \xB7 provider ${step.provider}` : ""}`);
@@ -3883,7 +3897,7 @@ function launchedWorktreeCwdWithoutHandoff(runId, launchCwd, launched) {
3883
3897
  function validateResumeSessionFile(runId, sessionFile) {
3884
3898
  if (path8.extname(sessionFile) !== ".jsonl") throw new Error(`Async run '${runId}' session file must be a .jsonl file: ${sessionFile}`);
3885
3899
  const resolved = path8.resolve(sessionFile);
3886
- if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}`);
3900
+ if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
3887
3901
  return resolved;
3888
3902
  }
3889
3903
  function validateResumeCwd(runId, cwd) {
@@ -4109,6 +4123,7 @@ function opencodeSessionHeaders(model, sessionId) {
4109
4123
  export {
4110
4124
  agentStreamOptions,
4111
4125
  opencodeSessionHeaders,
4126
+ formatActivityAge,
4112
4127
  formatActivityLabel,
4113
4128
  aggregateStepStatus,
4114
4129
  formatAgentRunningLabel,
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  buildWorkflowChatProgressRows
3
- } from "./chunk-2NY5PCKQ.js";
3
+ } from "./chunk-LV3CPYXJ.js";
4
4
  import {
5
5
  aggregateStepStatus,
6
6
  contextModeBadge,
7
7
  contextModeLabel,
8
8
  contextModePrefix,
9
+ formatActivityAge,
9
10
  formatActivityLabel,
10
11
  formatAgentRunningLabel,
11
12
  formatNestedAggregate,
@@ -21,7 +22,7 @@ import {
21
22
  projectAsyncWorkflowRows,
22
23
  projectWorkflowChecklist,
23
24
  workflowGraphStageNodes
24
- } from "./chunk-XV7RTWTS.js";
25
+ } from "./chunk-4ZQBZDF3.js";
25
26
  import {
26
27
  isStaleExtensionContextError,
27
28
  isUnboundExtensionRuntimeError,
@@ -33,7 +34,7 @@ import {
33
34
  formatWorkflowJsonPreview,
34
35
  hostStepReportName,
35
36
  hostStepVerdictLabel
36
- } from "./chunk-PGU4TZV3.js";
37
+ } from "./chunk-CPSUJHZE.js";
37
38
  import {
38
39
  snapshotExternalRuns
39
40
  } from "./chunk-UKG4V45O.js";
@@ -51,7 +52,7 @@ import {
51
52
  getSingleResultOutput,
52
53
  shortenPath,
53
54
  unresolvedChildWatchdogBlockers
54
- } from "./chunk-C3KWLXDH.js";
55
+ } from "./chunk-4MVDMA5C.js";
55
56
  import {
56
57
  MAX_WIDGET_JOBS,
57
58
  WIDGET_ANIMATION_INTERVAL_MS,
@@ -636,6 +637,16 @@ function workflowLabelForResult(details, resultIndex) {
636
637
  };
637
638
  return details.workflowGraph ? visit(details.workflowGraph.nodes) : void 0;
638
639
  }
640
+ function reportedProgressRow(progress, theme, indent, width) {
641
+ const text = progress.progressText?.trim();
642
+ if (!text) return void 0;
643
+ let updated = "";
644
+ if (progress.progressUpdatedAt !== void 0) {
645
+ const age = formatActivityAge(Math.max(0, Date.now() - progress.progressUpdatedAt));
646
+ updated = age === "now" ? " \xB7 updated now" : ` \xB7 updated ${age} ago`;
647
+ }
648
+ return truncLine(theme.fg("dim", `${indent}progress: ${sanitizeDisplayText(text)}${updated}`), width);
649
+ }
639
650
  function foregroundProgressForResult(details, resultIndex) {
640
651
  const result = details.results[resultIndex];
641
652
  if (result?.progress) return result.progress;
@@ -907,6 +918,8 @@ function widgetStepRenderKey(step, index, expanded = false) {
907
918
  step.workflowKey,
908
919
  step.phase,
909
920
  step.label,
921
+ step.progressText,
922
+ step.progressUpdatedAt,
910
923
  step.status,
911
924
  step.activityState,
912
925
  step.lastActivityAt,
@@ -2002,6 +2015,8 @@ function foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index, tota
2002
2015
  const task = fullTask ? void 0 : collapseDetails ? stepTaskSummary(step, displayName) : compactTaskText(step.description, step.label);
2003
2016
  for (const line of fullTask ?? []) lines.push(`${detailIndent}${theme.fg("dim", line)}`);
2004
2017
  if (task) lines.push(`${detailIndent}${theme.fg("dim", `task: ${task}`)}`);
2018
+ const progressRow = step.status === "running" ? reportedProgressRow(step, theme, detailIndent, width - 4) : void 0;
2019
+ if (progressRow) lines.push(progressRow);
2005
2020
  const activity = widgetStepActivityLine(step, width, expanded, job.updatedAt);
2006
2021
  const currentPath = options?.includeCurrentPath && step.currentPath ? shortenPath(step.currentPath) : void 0;
2007
2022
  const activityWithPath = currentPath && activity && !activity.includes(currentPath) ? `${activity} \xB7 ${currentPath}` : activity ?? currentPath;
@@ -2126,12 +2141,14 @@ function compactSingleWidgetLines(job, theme, width, frame, projection = buildWo
2126
2141
  const status = widgetStepStatus(step.status, theme, thinking);
2127
2142
  const activity = widgetStepActivityLine(step, width, false, job.updatedAt);
2128
2143
  const stepStats = widgetStepStats(theme, step, job.updatedAt);
2129
- const activitySuffix = activity ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", activity)}` : "";
2130
2144
  const modelDisplay = modelThinkingBadge(theme, step.model, step.thinking);
2131
2145
  const task = compactTaskText(step.description, step.label);
2132
2146
  const taskSuffix = task ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", `task: ${task}`)}` : "";
2147
+ const activitySuffix = activity ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", activity)}` : "";
2133
2148
  const marker = rowIndex === rows.length - 1 && rowIndex >= group.total - 1 ? "\u2514\u2500" : "\u251C\u2500";
2134
2149
  lines.push(` ${marker} ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, row.index), frame, thinking)} ${themeBold(theme, row.rowLabel)}${contextModeBadge(theme, step.context)} ${theme.fg("dim", "\xB7")} ${status}${modelDisplay}${taskSuffix}${activitySuffix}${stepStats ? ` ${theme.fg("dim", "\xB7")} ${stepStats}` : ""}`);
2150
+ const progressRow = step.status === "running" ? reportedProgressRow(step, theme, " ", width) : void 0;
2151
+ if (progressRow) lines.push(progressRow);
2135
2152
  const lane = projectAsyncLane(job, step);
2136
2153
  if (lane) lines.push(...formatLaneProjectionLines(lane, theme, " "));
2137
2154
  for (const nestedLine of formatNestedWidgetLines(step.children, theme, width, false, job.updatedAt, 6)) lines.push(` ${nestedLine}`);
@@ -2699,6 +2716,8 @@ function renderSingleCompact(d, r, theme, layout, frame, foregroundDetachShortcu
2699
2716
  if (isRunning && r.progress) {
2700
2717
  const task = compactTaskText(r.task);
2701
2718
  if (task) c.addChild(new Text(truncLine(theme.fg("dim", `${detailIndent}task: ${task}`), width), 0, 0));
2719
+ const reportedRow = reportedProgressRow(r.progress, theme, detailIndent, width);
2720
+ if (reportedRow) c.addChild(new Text(reportedRow, 0, 0));
2702
2721
  const progressSnapshotNow = snapshotNowForProgress(r.progress);
2703
2722
  const activity = compactCurrentActivity(r.progress);
2704
2723
  c.addChild(new Text(truncLine(theme.fg("dim", `${detailIndent}\u23BF ${activity}`), width), 0, 0));
@@ -2936,6 +2955,8 @@ function renderMultiCompact(d, theme, layout, frame) {
2936
2955
  const task = compactTaskText(r.task, workflowLabelForResult(d, i));
2937
2956
  if (task) c.addChild(new Text(truncLine(theme.fg("dim", `${detailIndent}task: ${task}`), width), 0, 0));
2938
2957
  }
2958
+ const reportedRow = rRunning && progressFromArray ? reportedProgressRow(progressFromArray, theme, detailIndent, width) : void 0;
2959
+ if (reportedRow) c.addChild(new Text(reportedRow, 0, 0));
2939
2960
  if (rRunning && rProg && "status" in rProg) {
2940
2961
  const liveProgress = rProg;
2941
2962
  const activity = compactCurrentActivity(liveProgress);
@@ -3034,6 +3055,8 @@ function renderSubagentResult(result, options, theme, frame, rendererConfig, for
3034
3055
  c2.addChild(new Text(fit2(theme.fg(r.exitCode !== 0 ? "error" : "dim", ` \u23BF ${resultStatusLine(r, output)}`)), 0, 0));
3035
3056
  }
3036
3057
  if (isRunning && r.progress) {
3058
+ const reportedRow = reportedProgressRow(r.progress, theme, " ", w2);
3059
+ if (reportedRow) c2.addChild(new Text(fit2(reportedRow), 0, 0));
3037
3060
  const progressSnapshotNow = snapshotNowForProgress(r.progress);
3038
3061
  for (const nestedLine of formatNestedWidgetLines(r.children, theme, w2, true, progressSnapshotNow, 12)) {
3039
3062
  c2.addChild(new Text(fit2(` ${nestedLine}`), 0, 0));
@@ -3202,6 +3225,8 @@ function renderSubagentResult(result, options, theme, frame, rendererConfig, for
3202
3225
  const taskMaxLen = Math.max(20, w - 12);
3203
3226
  const taskPreview = expanded || r.task.length <= taskMaxLen ? r.task : `${r.task.slice(0, taskMaxLen)}...`;
3204
3227
  c.addChild(new Text(fit(theme.fg("dim", ` task: ${taskPreview}`)), 0, 0));
3228
+ const reportedRow = rRunning && progressFromArray ? reportedProgressRow(progressFromArray, theme, " ", w) : void 0;
3229
+ if (reportedRow) c.addChild(new Text(fit(reportedRow), 0, 0));
3205
3230
  const outputTarget = extractOutputTarget(r.task);
3206
3231
  if (outputTarget) {
3207
3232
  c.addChild(new Text(fit(theme.fg("dim", ` output: ${outputTarget}`)), 0, 0));
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.87.0",
4
+ version: "0.88.1",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",
@@ -108,7 +108,7 @@ var package_default = {
108
108
  "@js-temporal/polyfill": "0.5.1",
109
109
  acorn: "8.18.0",
110
110
  jiti: "2.7.0",
111
- undici: "8.12.3",
111
+ undici: "8.12.4",
112
112
  yaml: "2.8.3"
113
113
  },
114
114
  devDependencies: {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  appendAgentRefinementOverlay
3
- } from "./chunk-USRX7QXD.js";
3
+ } from "./chunk-XIA5GSEU.js";
4
4
  import {
5
5
  buildAgentMemoryInjection,
6
6
  buildSkillInjection
7
- } from "./chunk-C3KWLXDH.js";
7
+ } from "./chunk-4MVDMA5C.js";
8
8
 
9
9
  // src/runs/shared/effective-system-prompt.ts
10
10
  function appendSection(prompt, section) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isTrustedRecordedSessionFile,
3
3
  resolveSubagentRunId
4
- } from "./chunk-2NY5PCKQ.js";
4
+ } from "./chunk-LV3CPYXJ.js";
5
5
  import {
6
6
  agentStreamOptions,
7
7
  opencodeSessionHeaders,
8
8
  resolveAsyncResumeTarget
9
- } from "./chunk-XV7RTWTS.js";
9
+ } from "./chunk-4ZQBZDF3.js";
10
10
  import {
11
11
  ownsRun
12
12
  } from "./chunk-HXRB42AF.js";
@@ -18,12 +18,12 @@ import {
18
18
  reconcileAsyncRun,
19
19
  resolveAuthorityDecision,
20
20
  resolveMissionStoreLocation
21
- } from "./chunk-PGU4TZV3.js";
21
+ } from "./chunk-CPSUJHZE.js";
22
22
  import {
23
23
  deliverInterruptRequest,
24
24
  queueRevivalBrief,
25
25
  requestAsyncSteer
26
- } from "./chunk-VFUFOZBU.js";
26
+ } from "./chunk-W6HIYD2Z.js";
27
27
  import {
28
28
  formatShellCommand
29
29
  } from "./chunk-7J4ZXMY7.js";
@@ -34,7 +34,7 @@ import {
34
34
  tryLease,
35
35
  writeAtomicJson,
36
36
  writePrivateAtomicJson
37
- } from "./chunk-C3KWLXDH.js";
37
+ } from "./chunk-4MVDMA5C.js";
38
38
  import {
39
39
  DIRS
40
40
  } from "./chunk-JEZOSEWG.js";
@@ -76,7 +76,7 @@ function recordSteeringRequest(status, input) {
76
76
  requestedAt: input.requestedAt,
77
77
  ...input.source ? { source: input.source } : {},
78
78
  messagePreview: steeringMessagePreview(input.message),
79
- targets: input.targets.map((target) => ({ index: target.index, state: target.state, ...target.reason ? { reason: target.reason } : {} }))
79
+ targets: input.targets.map((target) => ({ index: target.index, state: target.state, ...target.reason ? { reason: target.reason } : {}, ...target.failureKind ? { failureKind: target.failureKind } : {} }))
80
80
  };
81
81
  status.requested++;
82
82
  status.lastRequestedAt = input.requestedAt;
@@ -95,6 +95,8 @@ function updateSteeringTarget(status, requestId, index, state, now, fields = {})
95
95
  const request = status.recent.find((candidate) => candidate.id === requestId);
96
96
  const target = request?.targets.find((candidate) => candidate.index === index);
97
97
  if (!target) return void 0;
98
+ if (state !== "failed") delete target.failureKind;
99
+ else if (fields.failureKind) target.failureKind = fields.failureKind;
98
100
  if (state === "late" && target.state === "recovered") {
99
101
  if (target.lateDeliveredAt === void 0) {
100
102
  target.lateDeliveredAt = now;
@@ -144,6 +146,7 @@ function actionResultFromSteeringStatus(status, sourceRunId, requestId, replacem
144
146
  ...target.deliveredAt !== void 0 ? { deliveredAt: target.deliveredAt } : {},
145
147
  ...target.lateDeliveredAt !== void 0 ? { lateDeliveredAt: target.lateDeliveredAt } : {},
146
148
  ...target.reason ? { reason: target.reason } : {},
149
+ ...target.failureKind ? { failureKind: target.failureKind } : {},
147
150
  ...target.replacementRunId ? { replacementRunId: target.replacementRunId } : {}
148
151
  }));
149
152
  const states = targets.map((target) => target.state);
@@ -240,6 +243,9 @@ function steerTargetsAccepted(result2) {
240
243
  const targets = result2?.targets ?? [];
241
244
  return targets.length > 0 && targets.every((target) => target.state === "queued" || target.state === "delivered");
242
245
  }
246
+ function steerTargetsRejected(result2) {
247
+ return result2?.targets.some((target) => target.state === "failed" && target.failureKind === "rejected") === true;
248
+ }
243
249
  function canQueueRetainedAsyncFollowUp(status, index) {
244
250
  const steps = status.steps ?? [];
245
251
  return status.state === "complete" && Boolean(status.parentWorkflowRunId) && steps.length === 1 && (steps[0]?.status === "complete" || steps[0]?.status === "completed") && Boolean(steps[0]?.sessionFile ?? status.sessionFile) && (index === void 0 || index === 0);
@@ -377,8 +383,10 @@ ${replies}` }],
377
383
  if (input.signal?.aborted) {
378
384
  return { content: [{ type: "text", text: steeringReceipt(input.message, `Steering pending for async run ${status.runId} (request ${requestId}); caller aborted before recovery.`) }], details: { mode: "management", results: [], steering: result2 } };
379
385
  }
386
+ const projected = (current) => current?.steering ? actionResultFromSteeringStatus(current.steering, status.runId, requestId) : void 0;
387
+ const rejected = () => new Error(`Child rejected the guidance; continue it with action "resume" and id "${status.runId}".`);
380
388
  const finalStatus = readStatus(asyncDir);
381
- const finalResult = finalStatus?.steering ? actionResultFromSteeringStatus(finalStatus.steering, status.runId, requestId) : void 0;
389
+ const finalResult = projected(finalStatus);
382
390
  const acceptedReply = (accepted) => {
383
391
  const acceptedState = accepted.state === "delivered" ? "delivered" : "queued";
384
392
  return { content: [{ type: "text", text: steeringReceipt(input.message, `Steering ${acceptedState} for async run ${status.runId} (request ${requestId}).`) }], details: { mode: "management", results: [], steering: accepted } };
@@ -386,7 +394,7 @@ ${replies}` }],
386
394
  if (finalResult && steerTargetsAccepted(finalResult)) return acceptedReply(finalResult);
387
395
  const running = (finalStatus?.steps ?? status.steps ?? []).filter((step) => step.status === "running");
388
396
  const recoveryAllowed = (input.mode ?? "steer") === "steer" && status.mode === "single" && status.isNested !== true && running.length === 1 && Boolean(finalStatus?.steering) && (input.index === void 0 || input.index === 0);
389
- if (recoveryAllowed && finalResult?.state !== "scheduled" && input.recover) {
397
+ if (recoveryAllowed && finalResult?.state !== "scheduled" && !steerTargetsRejected(finalResult) && input.recover) {
390
398
  const appendSteeringNotice = (state, message) => {
391
399
  try {
392
400
  fs2.appendFileSync(path2.join(asyncDir, "events.jsonl"), `${JSON.stringify({ type: "subagent.steering.notice", ts: Date.now(), runId: status.runId, requestId, state, message, ...status.sessionId ? { currentSessionId: status.sessionId } : {} })}
@@ -395,18 +403,18 @@ ${replies}` }],
395
403
  }
396
404
  };
397
405
  try {
398
- const latest = readStatus(asyncDir);
399
- const latestResult = latest?.steering ? actionResultFromSteeringStatus(latest.steering, status.runId, requestId) : void 0;
406
+ const latestResult = projected(readStatus(asyncDir));
400
407
  if (latestResult && steerTargetsAccepted(latestResult)) return acceptedReply(latestResult);
408
+ if (steerTargetsRejected(latestResult)) throw rejected();
401
409
  const committedAt = Date.now();
402
410
  input.onBeforeRecoveryClaim?.(requestId, committedAt);
403
411
  const { claimPath, markerPath } = claimSteeringRecovery(asyncDir, { requestId, sourceRunId: status.runId, committedAt });
404
412
  input.onRecoveryCommitted?.(requestId, committedAt);
405
- const preCommitStatus = readStatus(asyncDir);
406
- const preCommitResult = preCommitStatus?.steering ? actionResultFromSteeringStatus(preCommitStatus.steering, status.runId, requestId) : void 0;
407
- if (preCommitResult && preCommitResult.targets.length > 0 && preCommitResult.targets.every((target) => target.state === "queued" || target.deliveredAt !== void 0 && target.deliveredAt <= committedAt)) {
413
+ const preCommitResult = projected(readStatus(asyncDir));
414
+ if (preCommitResult && (steerTargetsRejected(preCommitResult) || preCommitResult.targets.length > 0 && preCommitResult.targets.every((target) => target.state === "queued" || target.deliveredAt !== void 0 && target.deliveredAt <= committedAt))) {
408
415
  fs2.rmSync(markerPath, { force: true });
409
416
  fs2.rmSync(claimPath, { force: true });
417
+ if (steerTargetsRejected(preCommitResult)) throw rejected();
410
418
  return acceptedReply(preCommitResult);
411
419
  }
412
420
  try {
@@ -424,6 +432,10 @@ ${replies}` }],
424
432
  if (input.signal?.aborted) break;
425
433
  const candidate = readStatus(asyncDir);
426
434
  lastObservedState = candidate?.state;
435
+ if (steerTargetsRejected(projected(candidate))) {
436
+ fs2.rmSync(claimPath, { force: true });
437
+ throw rejected();
438
+ }
427
439
  if (candidate?.state === "paused" && candidate.endedAt !== void 0) {
428
440
  paused = candidate;
429
441
  break;
@@ -447,6 +459,10 @@ ${replies}` }],
447
459
  if (recoveryTarget.kind !== "revive" || !recoveryTarget.sessionFile) throw new Error("Source run has no valid persisted child session; it remains paused and requires a new run.");
448
460
  if (!recoveryTarget.recoveryDescriptor) throw new Error("Source run has no private recovery descriptor; it remains paused and is not safely resumable.");
449
461
  const limits = remainingSteeringRecoveryLimits(recoveryTarget.recoveryDescriptor, paused);
462
+ if (steerTargetsRejected(projected(readStatus(asyncDir)))) {
463
+ fs2.rmSync(claimPath, { force: true });
464
+ throw rejected();
465
+ }
450
466
  const revived = await input.recover(limits);
451
467
  if (revived.isError || !revived.details.asyncId) throw new Error(revived.content[0]?.type === "text" ? revived.content[0].text : "Replacement launch failed; source run remains paused.");
452
468
  const targetIndex = input.index ?? paused.steering?.recent.find((request) => request.id === requestId)?.targets[0]?.index ?? status.steps?.findIndex((step) => step.status === "running") ?? -1;
@@ -470,7 +486,7 @@ ${replies}` }],
470
486
  failedStatus.activityState = "needs_attention";
471
487
  writeAtomicJson(path2.join(asyncDir, "status.json"), failedStatus);
472
488
  }
473
- const failed = failedStatus?.steering ? actionResultFromSteeringStatus(failedStatus.steering, status.runId, requestId) : void 0;
489
+ const failed = projected(failedStatus);
474
490
  appendSteeringNotice("failed", `Steering failed for run ${status.runId}: ${reason}`);
475
491
  return { content: [{ type: "text", text: steeringReceipt(input.message, `Steering failed for async run ${status.runId} (request ${requestId}): ${reason}`) }], isError: true, details: { mode: "management", results: [], steering: failed ?? { requestId, state: "failed", sourceRunId: status.runId, deliveryStatus: "queued", targets: [{ index: input.index ?? 0, state: "failed", reason }] } } };
476
492
  }
@@ -1085,6 +1101,7 @@ async function rewritePromptWithGuidance(input) {
1085
1101
  });
1086
1102
  const ctxThinking = input.ctx.getThinkingLevel?.();
1087
1103
  const agent = new Agent({
1104
+ sessionId,
1088
1105
  initialState: {
1089
1106
  systemPrompt: [
1090
1107
  "Rewrite one subagent authored task from Prompt Audit context.",