pi-subagents 0.83.0 → 0.84.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +39 -2
  2. package/bundle/agents.js +4 -4
  3. package/bundle/capability-ceiling.js +1 -1
  4. package/bundle/child-tool-plan.js +3 -3
  5. package/bundle/{chunk-HJJAVHFB.js → chunk-235AWJUQ.js} +35 -32
  6. package/bundle/{chunk-P2NCCTZP.js → chunk-2D52JFLF.js} +1 -1
  7. package/bundle/{chunk-WG2OTTAK.js → chunk-2DHZTCOL.js} +2 -2
  8. package/bundle/{chunk-MBDOYZ2V.js → chunk-2S4K53MV.js} +1 -1
  9. package/bundle/{chunk-527E3D2J.js → chunk-4E7BKDTX.js} +5 -5
  10. package/bundle/{chunk-CZTMUBUI.js → chunk-7BWGNDNK.js} +4 -4
  11. package/bundle/{chunk-HXVKGS33.js → chunk-AKOIVLA5.js} +4 -4
  12. package/bundle/{chunk-MHX22USZ.js → chunk-C5P5CHYK.js} +1 -1
  13. package/bundle/{chunk-5ESXK62X.js → chunk-CGN2TVE7.js} +417 -389
  14. package/bundle/{chunk-VTMNBPCQ.js → chunk-D3JAFGMO.js} +1 -1
  15. package/bundle/{chunk-CDI3GMNV.js → chunk-DZDETGRJ.js} +18 -15
  16. package/bundle/{chunk-BKFWQ642.js → chunk-F4ASL6OV.js} +1 -1
  17. package/bundle/{chunk-JHZ6DZ5M.js → chunk-G2Z6ZH26.js} +1 -1
  18. package/bundle/{chunk-XXKG3P2W.js → chunk-J5YL7LYR.js} +4 -4
  19. package/bundle/{chunk-LDMXJIA6.js → chunk-JG4QKI5M.js} +58 -67
  20. package/bundle/{chunk-OOFW75PV.js → chunk-L3WFKBEI.js} +15 -11
  21. package/bundle/{chunk-Y3I6H6DV.js → chunk-LFDBD4PW.js} +2 -2
  22. package/bundle/{chunk-7F5SK2U3.js → chunk-LNRJCP2Y.js} +17 -14
  23. package/bundle/{chunk-4BW55BTL.js → chunk-NENDSQUY.js} +4 -4
  24. package/bundle/{chunk-6B4ITO2W.js → chunk-NKQ6JNAS.js} +1 -1
  25. package/bundle/{chunk-RZJN63GU.js → chunk-PALJGGYC.js} +2 -2
  26. package/bundle/{chunk-TJQJ3MEA.js → chunk-PV63UFUR.js} +10 -10
  27. package/bundle/{chunk-Z7KVHQHL.js → chunk-QXASAHIA.js} +2 -2
  28. package/bundle/{chunk-HLE22FSH.js → chunk-SSG7IEP5.js} +2 -2
  29. package/bundle/{chunk-CSSZRTKY.js → chunk-V2BZYLEP.js} +2 -2
  30. package/bundle/{chunk-CNLDYEH4.js → chunk-VQVVHSY6.js} +11 -11
  31. package/bundle/{chunk-CGXWSNPA.js → chunk-XDQORLZ5.js} +4 -4
  32. package/bundle/control-channel.js +3 -3
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +3 -3
  35. package/bundle/preflight.js +9 -9
  36. package/bundle/project-panes.js +4 -4
  37. package/docs/configuration.md +12 -1
  38. package/docs/extension-api.md +2 -0
  39. package/docs/missions.md +2 -0
  40. package/docs/tool-reference.md +1 -1
  41. package/package.json +1 -1
  42. package/src/agents/agent-management.d.ts +1 -1
  43. package/src/agents/agent-management.js +2 -2
  44. package/src/agents/agents.js +1 -2
  45. package/src/agents/frontmatter.js +22 -18
  46. package/src/extension/index.js +2 -2
  47. package/src/missions/actions.js +7 -2
  48. package/src/missions/lifecycle.d.ts +11 -0
  49. package/src/missions/lifecycle.js +37 -6
  50. package/src/missions/store.js +1 -0
  51. package/src/missions/types.d.ts +2 -0
  52. package/src/runs/background/async-execution.d.ts +4 -1
  53. package/src/runs/background/async-execution.js +18 -3
  54. package/src/runs/background/async-resume.js +3 -2
  55. package/src/runs/background/async-retention.d.ts +1 -0
  56. package/src/runs/background/async-retention.js +16 -10
  57. package/src/runs/background/retained-children.js +1 -1
  58. package/src/runs/background/run-child-session.d.ts +2 -0
  59. package/src/runs/background/run-child-session.js +9 -1
  60. package/src/runs/background/subagent-runner.js +1 -0
  61. package/src/runs/foreground/subagent-executor.js +29 -51
  62. package/src/runs/shared/capability-ceiling.d.ts +2 -1
  63. package/src/runs/shared/capability-ceiling.js +3 -2
  64. package/src/runs/shared/child-session.d.ts +2 -0
  65. package/src/runs/shared/child-session.js +1 -0
  66. package/src/runs/shared/model-resolution-diagnostic.d.ts +11 -0
  67. package/src/runs/shared/model-resolution-diagnostic.js +25 -0
  68. package/src/runs/shared/parallel-handoff.d.ts +1 -1
  69. package/src/runs/shared/parallel-handoff.js +10 -6
  70. package/src/runs/shared/parallel-utils.d.ts +2 -0
  71. package/src/shared/types.d.ts +1 -1
  72. package/src/workflows/scripted-workflow.js +6 -1
  73. package/workflow-script-worker.cjs +450 -175
package/CHANGELOG.md CHANGED
@@ -2,11 +2,48 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.84.0] - 2026-10-28
6
+
7
+ ### Highlights
8
+
9
+ - Security fix: workflow scripts can no longer reach the Pi process outside their sandbox. Upgrade if you use workflow scripts.
10
+ - A locked-down background agent that fails because one of your extensions' providers did not load in it now says which provider and how to load it.
11
+ - Old background runs are now actually deleted from disk.
12
+
13
+ ### Security
14
+
15
+ - Workflow scripts could reach the Pi process outside their sandbox. Upgrade to this version; see [GHSA-6v8j-6w28-2w8r](https://github.com/nicobailon/pi-subagents/security/advisories/GHSA-6v8j-6w28-2w8r) for affected versions and a workaround. Workflow scripts can no longer set `Error.prepareStackTrace`, and a script that calls `import()`, which always failed inside a workflow, is now rejected before it runs.
16
+
17
+ ### Fixed
18
+
19
+ - Old background runs are now deleted from disk. Background runs are meant to be removed 30 days after they finish, but a run was kept forever while its Pi session file still existed, and session files are never deleted, so almost no run was ever removed. A run whose session still exists is now kept for 90 days, so you can still resume it for that long, and is then removed like any other finished run. Thanks to [@LCorleone](https://github.com/LCorleone) for the report and fix, and [@isjiajia01](https://github.com/isjiajia01) for reproducing it. (#3098)
20
+ - A background agent that loads no ambient extensions (for example one with `extensions: []`) now says so when it fails on a model whose provider one of your extensions registers or overrides. That extension never loaded in the child, so the child sent its requests through the built-in provider of the same name and failed with an unrelated provider error. The failure now names the provider and how to load its extension for that agent. Thanks to [@Yivas](https://github.com/Yivas) for the report. (#3100)
21
+
22
+ ## [0.83.1] - 2026-10-27
23
+
24
+ ### Highlights
25
+
26
+ - Stopping, interrupting, or resuming a subagent can no longer act on the wrong run: an interrupt with no id is refused, and resuming a worktree child while it is still cleaning up no longer runs it in your main checkout.
27
+ - A mission you start on purpose stays open until its result is checked, instead of showing `completed` on the writer's own report.
28
+ - Capability limits registered by session id, as the docs show, now cover background runs and workflow children, not only foreground launches.
29
+ - Agent files with a blank line inside an indented block are read in full, so settings below that line are no longer dropped.
30
+
31
+ ### Fixed
32
+
33
+ - `subagent({ action: "interrupt" })` without an id is now refused with "action='interrupt' requires id.", the same as `stop`, `steer`, and `resume`. Before, it interrupted the last foreground run or the newest background run, so a call that lost its id could interrupt the wrong child. When an id matches no run, `stop`, `interrupt`, and `resume` now name that id in the error. Thanks to [@mannainsect](https://github.com/mannainsect) for the report. (#3081)
34
+ - Resuming a background child that ran in its own worktree (`worktree: true`) no longer continues it in your main checkout. If you resumed it in the few seconds while it was saving its changes and removing its worktree, the child could start in your main checkout and commit or switch branches there, or start in a deleted worktree. That resume is now refused with a message to retry once the run finishes cleaning up. Thanks to [@peskycipher](https://github.com/peskycipher) for the report and [@isjiajia01](https://github.com/isjiajia01) for narrowing it down. (#3083)
35
+ - A mission you start with `mission` or `missionId` no longer becomes `completed` when nothing confirmed its result. Before, a background writer run with only its own report marked its mission `completed`, so a claimed result looked like a proven one. When the run, or any workflow child in the mission, ends with acceptance `review-required`, `rejected`, `claimed`, or `pending`, the mission now stays `waiting`, and `mission.show` lists each child's acceptance status. Close it with `mission.close` after you check the result. A `gate` or `acceptance.verify` command alone does not complete a writer run's mission, because writer runs also need a review; add `review: { required: false }` to the `acceptance` policy when the command is enough ([missions.md](docs/missions.md)). Missions created automatically for ordinary launches still complete as before. Thanks to [@kiote](https://github.com/kiote). (#3078)
36
+ - A capability ceiling registered the way the docs show, with `ctx.sessionManager.getSessionId()`, now applies in saved sessions. Before, most checks looked it up by session file path, so background launches, workflow children, and `{ action: "list" }` ignored it and only foreground launches were blocked. Every check now uses the session id, so a ceiling registered by session file path no longer applies. Thanks to [@corobis](https://github.com/corobis) for the report. (#3087)
37
+ - A blank line inside an indented block in an agent file's frontmatter, such as an `external-cli` script argument with an empty line, cut the value off there and dropped every setting below it. The whole block is now read. Lists that used to stop at a blank line, such as `tools:`, now include their later entries, so an agent can get tools it did not get before. `|` and `>` blocks are unchanged. Thanks to [@jbachorik](https://github.com/jbachorik). (#3089)
38
+ - A workflow script that called `runs.run({ key, agent, task })` with a single object passed validation and then failed with "runs.run has an invalid key.". Validation now rejects that call, and both the validation error and the running script show the right forms: `runs.run("plan", { agent, task })` or `runs.all([{ key, agent, task }])`. Thanks to [@brunovcosta](https://github.com/brunovcosta) for the report. (#3088)
39
+ - In a project you have not trusted, agent lookup no longer scans the project's `.git`, `.pi`, and `.agents` folders on every call. It already ignored what was in them, but it still listed them to decide when to refresh, so ordinary git activity made it rebuild its agent list. Thanks to [@ArietidsZ](https://github.com/ArietidsZ). (#3080)
40
+ - Long errors and verdicts in the `runs.lanes` result are now cut at a whole character, so they no longer end in a broken character or go over the 256-byte limit. Thanks to [@XLi-hub](https://github.com/XLi-hub). (#3097)
41
+
5
42
  ## [0.83.0] - 2026-10-25
6
43
 
7
44
  ### Highlights
8
45
 
9
- - Subagents no longer break your session's prompt cache on models that take system messages mid-conversation, so each turn after a subagent returns is cheaper and faster. A child that runs its own subagents keeps its cache too.
46
+ - When an extension or tool search changes the system prompt or tools during a session, subagent results no longer make every later turn miss the prompt cache, so those turns are cheaper and faster again. A child that runs its own subagents keeps its cache too.
10
47
  - Subagents that finished their work always report it: background runs no longer end as "exited with code 0 before writing a result", and foreground calls no longer hang when the child stops after its final reply.
11
48
  - Children placed on another machine (a Rex tab, Rex over SSH, or a Herdr pane) launch instead of being refused, and workflows no longer crash on Windows standalone Pi builds.
12
49
  - Extensions and editors that show subagent activity can refresh on a new event instead of polling, and `bg_wait` now waits for background jobs that other extensions report, such as surf-cli's.
@@ -18,7 +55,7 @@
18
55
 
19
56
  ### Fixed
20
57
 
21
- - On models that take system messages mid-conversation, the first request of every new turn after the first subagent notice missed the prompt cache, so most of the context was sent uncached again each turn. A child that had called `subagent` missed it on every later request. The way pi-subagents marked its notices and removed parent-only subagent history made Pi move every mid-conversation system message to the start of the prompt; both now leave those messages where they are. Thanks to [@adameq](https://github.com/adameq) for the report. (#3058, #3063)
58
+ - When an extension or tool search changed the system prompt or tools during a session, the first request of every new turn after the first subagent notice missed the prompt cache, so most of the context was sent uncached again each turn. A child that had called `subagent` missed it on every later request. On models where Pi adds those changes further down the conversation instead of rewriting the start of the prompt (Anthropic and OpenAI models, among others), the way pi-subagents marked its notices and removed parent-only subagent history made Pi move them all back into the start of the prompt, which then changed every turn. Both now leave those changes where they are. Thanks to [@adameq](https://github.com/adameq) for the report. (#3058, #3063)
22
59
  - Background subagents that finished their work no longer end as "exited with code 0 before writing a result". When a child stopped after its final reply without reporting that it had settled, or when one of its extensions hung on shutdown, the background runner process exited with the result still unwritten. It now ends the child after its final reply, waits for any compaction that runs after that reply, and waits at most 5 seconds for shutdown handlers. A foreground subagent whose child stops the same way now returns its reply too, instead of the call never returning. Thanks to [@perriea](https://github.com/perriea). (#3051)
23
60
  - Background jobs that other extensions report to `bg_wait`, such as surf-cli's or pi-agent-wait's, are now waited for in saved sessions. Before, `bg_wait` and the wait at the end of a `pi -p` run matched a job only when the extension named the session by its file path, so a job named by the session id was ignored and they returned while it was still running. Both forms are now accepted. Thanks to [@cad0p](https://github.com/cad0p) for the report. (#3071)
24
61
  - With features turned off in `disabledFeatures`, every `guide` topic now starts with a notice listing what is disabled, and every section with a one-line pointer to that list, not only the `tool-reference` topic. Before, an agent reading the workflow guide with `workflow-scripts` disabled was taught `workflow: true` and `args`, and its call was rejected. With workflow scripts disabled, the notice also says to use the top-level `tasks` or `chain` fields instead. Thanks to [@jefftheai](https://github.com/jefftheai) for the report. (#3057)
package/bundle/agents.js CHANGED
@@ -2,14 +2,14 @@ import {
2
2
  RUNTIME_AGENT_REGISTER_EVENT,
3
3
  RUNTIME_AGENT_REGISTER_VERSION,
4
4
  registerAgentViaEvents
5
- } from "./chunk-MBDOYZ2V.js";
5
+ } from "./chunk-2S4K53MV.js";
6
6
  import {
7
7
  registerRuntimeAgent
8
- } from "./chunk-JHZ6DZ5M.js";
9
- import "./chunk-7F5SK2U3.js";
8
+ } from "./chunk-G2Z6ZH26.js";
9
+ import "./chunk-LNRJCP2Y.js";
10
10
  import "./chunk-JEZOSEWG.js";
11
11
  import "./chunk-YFCK7H2S.js";
12
- import "./chunk-Z7KVHQHL.js";
12
+ import "./chunk-QXASAHIA.js";
13
13
  export {
14
14
  RUNTIME_AGENT_REGISTER_EVENT,
15
15
  RUNTIME_AGENT_REGISTER_VERSION,
@@ -8,7 +8,7 @@ import {
8
8
  registerSubagentCapabilityCeiling,
9
9
  resolveCurrentSubagentCapabilityCeiling,
10
10
  resolveSubagentCapabilityCeiling
11
- } from "./chunk-Z7KVHQHL.js";
11
+ } from "./chunk-QXASAHIA.js";
12
12
  export {
13
13
  SUBAGENT_CAPABILITY_CEILING_REGISTRY_KEY,
14
14
  SUBAGENT_CAPABILITY_CEILING_VERSION,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  resolvePiLaunchToolPlan
3
- } from "./chunk-CSSZRTKY.js";
3
+ } from "./chunk-V2BZYLEP.js";
4
4
  import "./chunk-CTPAE36Y.js";
5
- import "./chunk-7F5SK2U3.js";
5
+ import "./chunk-LNRJCP2Y.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
- import "./chunk-Z7KVHQHL.js";
8
+ import "./chunk-QXASAHIA.js";
9
9
  export {
10
10
  resolvePiLaunchToolPlan
11
11
  };
@@ -10,10 +10,10 @@ import {
10
10
  setInlineWorkflowCoverage,
11
11
  setMainThinkingLevelSource,
12
12
  widgetRenderKey
13
- } from "./chunk-HXVKGS33.js";
13
+ } from "./chunk-AKOIVLA5.js";
14
14
  import {
15
15
  package_default
16
- } from "./chunk-6B4ITO2W.js";
16
+ } from "./chunk-NKQ6JNAS.js";
17
17
  import {
18
18
  EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
19
19
  REVIVAL_ORIGIN_FILE,
@@ -61,7 +61,7 @@ import {
61
61
  snapshotProviderDiagnostics,
62
62
  workflowResumeClaimState,
63
63
  workflowResumeRefusal
64
- } from "./chunk-CDI3GMNV.js";
64
+ } from "./chunk-DZDETGRJ.js";
65
65
  import {
66
66
  CONTACT_SUPERVISOR_TOOL_NAME,
67
67
  NATIVE_SUPERVISOR_TOOL_NAME,
@@ -89,14 +89,14 @@ import {
89
89
  resolveWaitToolConfig,
90
90
  setDeclarationPinning,
91
91
  topLevelSupervisorTool
92
- } from "./chunk-CZTMUBUI.js";
92
+ } from "./chunk-7BWGNDNK.js";
93
93
  import {
94
94
  deliverAsyncRunStop,
95
95
  ownerConfirmedDead,
96
96
  readSessionMessagesTail,
97
97
  resolveSubagentRunId,
98
98
  restoreForegroundRunHistory
99
- } from "./chunk-4BW55BTL.js";
99
+ } from "./chunk-NENDSQUY.js";
100
100
  import {
101
101
  ASYNC_STATUS_SNAPSHOT_KIND,
102
102
  ASYNC_STATUS_SNAPSHOT_VERSION,
@@ -118,7 +118,7 @@ import {
118
118
  resolveAsyncStatusChild,
119
119
  stopStoppableAsyncStatusChildren,
120
120
  withCachedUiContext
121
- } from "./chunk-OOFW75PV.js";
121
+ } from "./chunk-L3WFKBEI.js";
122
122
  import "./chunk-NF7IEKBH.js";
123
123
  import {
124
124
  disabledFeatureUseError,
@@ -129,7 +129,7 @@ import {
129
129
  resolveDisabledFeatureSurface,
130
130
  resolveMaxActiveAsyncRunsPerSession,
131
131
  resolveScheduledStoreRoot
132
- } from "./chunk-RZJN63GU.js";
132
+ } from "./chunk-PALJGGYC.js";
133
133
  import {
134
134
  ACTIVE_RUN_INDEX_DIR,
135
135
  MissionNotFoundError,
@@ -178,28 +178,28 @@ import {
178
178
  withWorkflowChildRunModel,
179
179
  writeAsyncResultFile,
180
180
  writeResultIndexForData
181
- } from "./chunk-5ESXK62X.js";
182
- import "./chunk-BKFWQ642.js";
181
+ } from "./chunk-CGN2TVE7.js";
182
+ import "./chunk-F4ASL6OV.js";
183
183
  import {
184
184
  shouldUseNativeFsWatch
185
185
  } from "./chunk-NIXWDZZV.js";
186
186
  import {
187
187
  validateIntercomBridgeConfig
188
- } from "./chunk-MHX22USZ.js";
188
+ } from "./chunk-C5P5CHYK.js";
189
189
  import "./chunk-7F6RKT6W.js";
190
- import "./chunk-CSSZRTKY.js";
190
+ import "./chunk-V2BZYLEP.js";
191
191
  import "./chunk-CTPAE36Y.js";
192
192
  import {
193
193
  listHerdrProjectPaneRoots,
194
194
  restoreHerdrProjectPaneSnapshots
195
- } from "./chunk-WG2OTTAK.js";
195
+ } from "./chunk-2DHZTCOL.js";
196
196
  import "./chunk-7J4ZXMY7.js";
197
197
  import {
198
198
  cleanupAllArtifactDirs,
199
199
  cleanupOldArtifacts,
200
200
  getArtifactPaths,
201
201
  getArtifactsDir
202
- } from "./chunk-VTMNBPCQ.js";
202
+ } from "./chunk-D3JAFGMO.js";
203
203
  import {
204
204
  listBackgroundWorkProviders
205
205
  } from "./chunk-XA3DY6UG.js";
@@ -207,12 +207,12 @@ import "./chunk-YYREO77V.js";
207
207
  import "./chunk-UKG4V45O.js";
208
208
  import {
209
209
  registerRuntimeAgentEventListener
210
- } from "./chunk-MBDOYZ2V.js";
210
+ } from "./chunk-2S4K53MV.js";
211
211
  import {
212
212
  clearRuntimeAgentsForPi,
213
213
  listRuntimeAgentConfigs,
214
214
  mergeRuntimeAgents
215
- } from "./chunk-JHZ6DZ5M.js";
215
+ } from "./chunk-G2Z6ZH26.js";
216
216
  import {
217
217
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
218
218
  EXTRA_AGENT_DIRS_ENV,
@@ -252,7 +252,7 @@ import {
252
252
  waitForFileSystemRetry,
253
253
  withSettingsFileLease,
254
254
  writeAtomicJson
255
- } from "./chunk-7F5SK2U3.js";
255
+ } from "./chunk-LNRJCP2Y.js";
256
256
  import {
257
257
  DEFAULT_ARTIFACT_CONFIG,
258
258
  DIRS,
@@ -293,7 +293,7 @@ import {
293
293
  import {
294
294
  isAgentAllowedByCapabilityCeiling,
295
295
  resolveCurrentSubagentCapabilityCeiling
296
- } from "./chunk-Z7KVHQHL.js";
296
+ } from "./chunk-QXASAHIA.js";
297
297
 
298
298
  // src/extension/index.ts
299
299
  import { randomUUID as randomUUID3 } from "node:crypto";
@@ -1215,7 +1215,9 @@ var ASYNC_RETENTION_DAYS = 30;
1215
1215
  var ASYNC_RETENTION_BATCH_SIZE = 100;
1216
1216
  var ASYNC_RETENTION_DELAY_MS = 6e4;
1217
1217
  var ASYNC_RETENTION_TOMBSTONE_GRACE_MS = 24 * 60 * 60 * 1e3;
1218
+ var RESUMABLE_RETENTION_DAYS = 90;
1218
1219
  var RETENTION_MS = ASYNC_RETENTION_DAYS * 24 * 60 * 60 * 1e3;
1220
+ var RESUMABLE_RETENTION_MS = RESUMABLE_RETENTION_DAYS * 24 * 60 * 60 * 1e3;
1219
1221
  var LOCK_NAME = ".async-retention.lock";
1220
1222
  var CURSOR_NAME = ".async-retention-cursor.json";
1221
1223
  var LOG_NAME = "async-retention-maintenance.jsonl";
@@ -1389,8 +1391,8 @@ function runSkipReason(input) {
1389
1391
  if (hasNestedReferences(status)) return "nested-reference";
1390
1392
  if (missionReferenceBlocksReclaim(runDir, input.resultsDir, status.runId)) return "mission-reference";
1391
1393
  if (hasUnresolvedRunHandoff(runDir, status)) return "handoff-reference";
1392
- if (hasResumableContract(runDir, status)) return "resumable";
1393
1394
  const timestamp = statusTimestamp(status, runDir);
1395
+ if (hasResumableContract(runDir, status) && (timestamp === void 0 || timestamp > input.resumableCutoff)) return "resumable";
1394
1396
  if (timestamp === void 0) return "unknown-age";
1395
1397
  if (timestamp > input.cutoff) return "recent";
1396
1398
  return void 0;
@@ -1558,10 +1560,10 @@ function resultSkipReason(input) {
1558
1560
  if (missionObserverIndexExists(input.resultsDir, runId)) return "mission-reference";
1559
1561
  if (input.data.mode === "workflow" || completionMode(input.data) === "workflow" || typeof input.data.parentWorkflowRunId === "string" || typeof input.data.workflowKey === "string") return "workflow-reference";
1560
1562
  if (hasUnresolvedResultHandoff(input.data)) return "handoff-reference";
1561
- if (resultHasResumableSession(input.data)) return "resumable";
1563
+ const timestamp = resultTimestamp(input.data, input.candidate.path);
1564
+ if (resultHasResumableSession(input.data) && (timestamp === void 0 || timestamp > input.resumableCutoff)) return "resumable";
1562
1565
  if (input.candidate.kind === "archive" && fs4.existsSync(path3.join(input.resultsDir, "completion-replay", `${encodeURIComponent(runId)}.json`))) return "replay-reference";
1563
1566
  if (!terminalResult(input.data) && input.candidate.kind !== "replay" && input.candidate.kind !== "archive" && input.candidate.kind !== "tombstone") return "non-terminal-result";
1564
- const timestamp = resultTimestamp(input.data, input.candidate.path);
1565
1567
  if (timestamp === void 0) return "unknown-age";
1566
1568
  if (timestamp > input.cutoff) return "recent";
1567
1569
  return void 0;
@@ -1747,6 +1749,7 @@ async function cleanupAsyncRetention(options) {
1747
1749
  if (markCancelled()) return finish();
1748
1750
  const protectedRunIds = new Set(options.protectedRunIds ?? []);
1749
1751
  const cutoff = currentTime - retentionMs;
1752
+ const resumableCutoff = currentTime - RESUMABLE_RETENTION_MS;
1750
1753
  const cursor = readCursor(maintenanceRoot);
1751
1754
  const runBudget = Math.ceil(batchSize / 2);
1752
1755
  const resultBudget = batchSize - runBudget;
@@ -1811,7 +1814,7 @@ async function cleanupAsyncRetention(options) {
1811
1814
  status = reconciliation.status ?? void 0;
1812
1815
  if (reconciliation.repaired) result.repairedRuns += 1;
1813
1816
  }
1814
- const initialReason = runSkipReason({ runDir, status, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, cutoff, protectedRunIds, waitRunIds: waitReferences.runIds });
1817
+ const initialReason = runSkipReason({ runDir, status, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, cutoff, resumableCutoff, protectedRunIds, waitRunIds: waitReferences.runIds });
1815
1818
  if (initialReason) {
1816
1819
  increment(result.skipped, initialReason);
1817
1820
  continue;
@@ -1826,7 +1829,7 @@ async function cleanupAsyncRetention(options) {
1826
1829
  continue;
1827
1830
  }
1828
1831
  const freshWaitReferences2 = parseWaitRunIds(waitSubscriptionsDir);
1829
- const finalReason = freshWaitReferences2.safe ? runSkipReason({ runDir, status, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, cutoff, protectedRunIds, waitRunIds: freshWaitReferences2.runIds }) : "wait-references-unknown";
1832
+ const finalReason = freshWaitReferences2.safe ? runSkipReason({ runDir, status, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, cutoff, resumableCutoff, protectedRunIds, waitRunIds: freshWaitReferences2.runIds }) : "wait-references-unknown";
1830
1833
  if (finalReason) {
1831
1834
  increment(result.skipped, `recheck-${finalReason}`);
1832
1835
  continue;
@@ -1850,7 +1853,7 @@ async function cleanupAsyncRetention(options) {
1850
1853
  }
1851
1854
  const recheckStatus = readStatus2(tombstone);
1852
1855
  const freshWaitReferences = parseWaitRunIds(waitSubscriptionsDir);
1853
- const recheckReason = freshWaitReferences.safe ? runSkipReason({ runDir: tombstone, status: recheckStatus, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, cutoff, protectedRunIds, waitRunIds: freshWaitReferences.runIds }) : "wait-references-unknown";
1856
+ const recheckReason = freshWaitReferences.safe ? runSkipReason({ runDir: tombstone, status: recheckStatus, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, cutoff, resumableCutoff, protectedRunIds, waitRunIds: freshWaitReferences.runIds }) : "wait-references-unknown";
1854
1857
  if (recheckReason) {
1855
1858
  if (!fs4.existsSync(runDir)) {
1856
1859
  fs4.renameSync(tombstone, runDir);
@@ -1882,7 +1885,7 @@ async function cleanupAsyncRetention(options) {
1882
1885
  continue;
1883
1886
  }
1884
1887
  const data = readJson(candidate.path);
1885
- const reason = resultSkipReason({ candidate, data, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, maintenanceRoot, cutoff, protectedRunIds, waitRunIds: waitReferences.runIds });
1888
+ const reason = resultSkipReason({ candidate, data, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, maintenanceRoot, cutoff, resumableCutoff, protectedRunIds, waitRunIds: waitReferences.runIds });
1886
1889
  if (reason) {
1887
1890
  increment(result.skipped, reason);
1888
1891
  continue;
@@ -1893,7 +1896,7 @@ async function cleanupAsyncRetention(options) {
1893
1896
  continue;
1894
1897
  }
1895
1898
  const freshWaitReferences2 = parseWaitRunIds(waitSubscriptionsDir);
1896
- const finalReason = freshWaitReferences2.safe ? resultSkipReason({ candidate, data, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, maintenanceRoot, cutoff, protectedRunIds, waitRunIds: freshWaitReferences2.runIds }) : "wait-references-unknown";
1899
+ const finalReason = freshWaitReferences2.safe ? resultSkipReason({ candidate, data, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, maintenanceRoot, cutoff, resumableCutoff, protectedRunIds, waitRunIds: freshWaitReferences2.runIds }) : "wait-references-unknown";
1897
1900
  if (finalReason) {
1898
1901
  increment(result.skipped, `recheck-${finalReason}`);
1899
1902
  continue;
@@ -1910,7 +1913,7 @@ async function cleanupAsyncRetention(options) {
1910
1913
  const tombstoneCandidate = { ...candidate, path: tombstone, kind: "tombstone" };
1911
1914
  const recheckData = readJson(tombstone);
1912
1915
  const freshWaitReferences = parseWaitRunIds(waitSubscriptionsDir);
1913
- const recheckReason = freshWaitReferences.safe ? resultSkipReason({ candidate: tombstoneCandidate, data: recheckData, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, maintenanceRoot, cutoff, protectedRunIds, waitRunIds: freshWaitReferences.runIds }) : "wait-references-unknown";
1916
+ const recheckReason = freshWaitReferences.safe ? resultSkipReason({ candidate: tombstoneCandidate, data: recheckData, asyncDirRoot: options.asyncDirRoot, resultsDir: options.resultsDir, maintenanceRoot, cutoff, resumableCutoff, protectedRunIds, waitRunIds: freshWaitReferences.runIds }) : "wait-references-unknown";
1914
1917
  if (recheckReason) {
1915
1918
  if (!fs4.existsSync(candidate.path)) {
1916
1919
  fs4.renameSync(tombstone, candidate.path);
@@ -5182,7 +5185,7 @@ function registerSlashCommands(pi, state, options = {}) {
5182
5185
  }
5183
5186
  fleetOpen = true;
5184
5187
  try {
5185
- const { openSubagentFleet } = await import("./chunk-TJQJ3MEA.js");
5188
+ const { openSubagentFleet } = await import("./chunk-PV63UFUR.js");
5186
5189
  await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
5187
5190
  } finally {
5188
5191
  fleetOpen = false;
@@ -8571,7 +8574,7 @@ function registerSubagentExtension(pi) {
8571
8574
  const ctx = withLastUiContext((current) => current);
8572
8575
  if (!ctx) return;
8573
8576
  try {
8574
- const { openSubagentFleet } = await import("./chunk-TJQJ3MEA.js");
8577
+ const { openSubagentFleet } = await import("./chunk-PV63UFUR.js");
8575
8578
  await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi) });
8576
8579
  } catch (error) {
8577
8580
  if (isStaleExtensionContextError(error)) {
@@ -8767,7 +8770,7 @@ function registerSubagentExtension(pi) {
8767
8770
  let executor;
8768
8771
  let executorPromise;
8769
8772
  let executorModulePromise;
8770
- const loadExecutorModule = () => executorModulePromise ??= import("./chunk-LDMXJIA6.js");
8773
+ const loadExecutorModule = () => executorModulePromise ??= import("./chunk-JG4QKI5M.js");
8771
8774
  const getExecutor = () => {
8772
8775
  executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
8773
8776
  executor = createSubagentExecutor(executorDeps);
@@ -8781,7 +8784,7 @@ function registerSubagentExtension(pi) {
8781
8784
  modulePreloadTimer = setTimeout(() => {
8782
8785
  loadExecutorModule().catch(() => {
8783
8786
  });
8784
- if (fleetViewEnabled) import("./chunk-TJQJ3MEA.js").catch(() => {
8787
+ if (fleetViewEnabled) import("./chunk-PV63UFUR.js").catch(() => {
8785
8788
  });
8786
8789
  }, MODULE_PRELOAD_DELAY_MS);
8787
8790
  modulePreloadTimer.unref?.();
@@ -8947,7 +8950,7 @@ ${close}` }]
8947
8950
  const activeRuns = config.activeRunsPrompt === true ? buildActiveRunsSection(state.asyncJobs.values(), sessionId) : void 0;
8948
8951
  if (activeRuns) event.systemPromptOptions.sections.active_subagents = activeRuns;
8949
8952
  if (!event.systemPromptOptions.selectedTools.includes("subagent")) return;
8950
- const catalog = buildAdvertisedAgentCatalog(advertisedAgents, resolveCurrentSubagentCapabilityCeiling(sessionId), recordedPromptSection(pi, "advertised_subagents"));
8953
+ const catalog = buildAdvertisedAgentCatalog(advertisedAgents, resolveCurrentSubagentCapabilityCeiling(ctx.sessionManager.getSessionId() ?? void 0), recordedPromptSection(pi, "advertised_subagents"));
8951
8954
  if (catalog) event.systemPromptOptions.sections.advertised_subagents = catalog;
8952
8955
  });
8953
8956
  registerWaitTool(pi, state, waitToolConfig.enabled, waitSubscriptionManager, waitToolConfig.defaultTimeoutMs, void 0, supervisorChannel.hasPendingRequests);
@@ -9361,7 +9364,7 @@ ${close}` }]
9361
9364
  hasPendingSupervisorRequest: () => [...supervisorChannel.pending.values()].some((request) => request.expectsReply),
9362
9365
  advertisedPrompt: async () => {
9363
9366
  await waitForAdvertisement();
9364
- return buildAdvertisedAgentPrompt(advertisedAgents, resolveCurrentSubagentCapabilityCeiling(state.currentSessionId ?? void 0));
9367
+ return buildAdvertisedAgentPrompt(advertisedAgents, resolveCurrentSubagentCapabilityCeiling(state.supervisorOwnerSessionId ?? void 0));
9365
9368
  }
9366
9369
  });
9367
9370
  }
@@ -2,7 +2,7 @@ import {
2
2
  CODE_OWNED_EXTERNAL_CLI_ADAPTER_IDS,
3
3
  getAgentDir,
4
4
  getProjectConfigDir
5
- } from "./chunk-7F5SK2U3.js";
5
+ } from "./chunk-LNRJCP2Y.js";
6
6
 
7
7
  // src/runs/shared/rex-machine.ts
8
8
  import { spawnSync } from "node:child_process";
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-7J4ZXMY7.js";
4
4
  import {
5
5
  getProjectSubagentsDir
6
- } from "./chunk-VTMNBPCQ.js";
6
+ } from "./chunk-D3JAFGMO.js";
7
7
  import {
8
8
  getPiSpawnCommand,
9
9
  writeAtomicJson
10
- } from "./chunk-7F5SK2U3.js";
10
+ } from "./chunk-LNRJCP2Y.js";
11
11
 
12
12
  // src/inspectors/herdr/project-panes.ts
13
13
  import * as fs from "node:fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerRuntimeAgent
3
- } from "./chunk-JHZ6DZ5M.js";
3
+ } from "./chunk-G2Z6ZH26.js";
4
4
 
5
5
  // src/agents/runtime-agent-events.ts
6
6
  var RUNTIME_AGENT_REGISTER_EVENT = "pi-subagents:runtime-agent-register:v1";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  isTrustedRecordedSessionFile,
3
3
  resolveSubagentRunId
4
- } from "./chunk-4BW55BTL.js";
4
+ } from "./chunk-NENDSQUY.js";
5
5
  import {
6
6
  agentStreamOptions,
7
7
  opencodeSessionHeaders,
8
8
  ownsRun,
9
9
  resolveAsyncResumeTarget
10
- } from "./chunk-OOFW75PV.js";
10
+ } from "./chunk-L3WFKBEI.js";
11
11
  import {
12
12
  currentCompletionOwnerId,
13
13
  listMissions,
@@ -16,12 +16,12 @@ import {
16
16
  reconcileAsyncRun,
17
17
  resolveAuthorityDecision,
18
18
  resolveMissionStoreLocation
19
- } from "./chunk-5ESXK62X.js";
19
+ } from "./chunk-CGN2TVE7.js";
20
20
  import {
21
21
  deliverInterruptRequest,
22
22
  queueRevivalBrief,
23
23
  requestAsyncSteer
24
- } from "./chunk-BKFWQ642.js";
24
+ } from "./chunk-F4ASL6OV.js";
25
25
  import {
26
26
  formatShellCommand
27
27
  } from "./chunk-7J4ZXMY7.js";
@@ -32,7 +32,7 @@ import {
32
32
  tryLease,
33
33
  writeAtomicJson,
34
34
  writePrivateAtomicJson
35
- } from "./chunk-7F5SK2U3.js";
35
+ } from "./chunk-LNRJCP2Y.js";
36
36
  import {
37
37
  DIRS
38
38
  } from "./chunk-JEZOSEWG.js";
@@ -11,7 +11,7 @@ import {
11
11
  projectTimeoutRecovery,
12
12
  readAsyncRecoveryDescriptor,
13
13
  utf8Tail
14
- } from "./chunk-OOFW75PV.js";
14
+ } from "./chunk-L3WFKBEI.js";
15
15
  import {
16
16
  MAX_ARGS_BYTES,
17
17
  MAX_ARGS_DEPTH,
@@ -24,13 +24,13 @@ import {
24
24
  resultFilePath,
25
25
  resultPayloadMatchesSessionRun,
26
26
  resultPayloadPathForSessionRun
27
- } from "./chunk-5ESXK62X.js";
27
+ } from "./chunk-CGN2TVE7.js";
28
28
  import {
29
29
  shouldUseNativeFsWatch
30
30
  } from "./chunk-NIXWDZZV.js";
31
31
  import {
32
32
  PROJECT_SUBAGENTS_RELATIVE_DIR
33
- } from "./chunk-VTMNBPCQ.js";
33
+ } from "./chunk-D3JAFGMO.js";
34
34
  import {
35
35
  listBackgroundWorkWakeChannels,
36
36
  snapshotBackgroundWork
@@ -55,7 +55,7 @@ import {
55
55
  withSettingsFileLease,
56
56
  writeAtomicJson,
57
57
  writePrivateAtomicJson
58
- } from "./chunk-7F5SK2U3.js";
58
+ } from "./chunk-LNRJCP2Y.js";
59
59
  import {
60
60
  ASYNC_DIR,
61
61
  DIRS,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildWorkflowChatProgressRows
3
- } from "./chunk-4BW55BTL.js";
3
+ } from "./chunk-NENDSQUY.js";
4
4
  import {
5
5
  aggregateStepStatus,
6
6
  contextModeBadge,
@@ -25,13 +25,13 @@ import {
25
25
  projectWorkflowChecklist,
26
26
  withCachedUiContext,
27
27
  workflowGraphStageNodes
28
- } from "./chunk-OOFW75PV.js";
28
+ } from "./chunk-L3WFKBEI.js";
29
29
  import {
30
30
  flatToLogicalStepIndex,
31
31
  formatWorkflowJsonPreview,
32
32
  hostStepReportName,
33
33
  hostStepVerdictLabel
34
- } from "./chunk-5ESXK62X.js";
34
+ } from "./chunk-CGN2TVE7.js";
35
35
  import {
36
36
  snapshotExternalRuns
37
37
  } from "./chunk-UKG4V45O.js";
@@ -49,7 +49,7 @@ import {
49
49
  getSingleResultOutput,
50
50
  shortenPath,
51
51
  unresolvedChildWatchdogBlockers
52
- } from "./chunk-7F5SK2U3.js";
52
+ } from "./chunk-LNRJCP2Y.js";
53
53
  import {
54
54
  MAX_WIDGET_JOBS,
55
55
  WIDGET_ANIMATION_INTERVAL_MS,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-7F6RKT6W.js";
4
4
  import {
5
5
  getAgentDir
6
- } from "./chunk-7F5SK2U3.js";
6
+ } from "./chunk-LNRJCP2Y.js";
7
7
 
8
8
  // src/intercom/intercom-bridge.ts
9
9
  import * as fs from "node:fs";