pi-subagents 0.89.0 → 0.89.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 (45) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-WW6GQBBS.js → chunk-4FFKVLBG.js} +4 -4
  5. package/bundle/{chunk-JRO2CU4D.js → chunk-5TXWZB73.js} +1 -1
  6. package/bundle/{chunk-CHEABMO2.js → chunk-6D54VW3E.js} +19 -19
  7. package/bundle/{chunk-S77ZKDLS.js → chunk-77VQEATI.js} +1 -1
  8. package/bundle/{chunk-443LPCRI.js → chunk-BERAWSQQ.js} +5 -5
  9. package/bundle/{chunk-7W2IQFP4.js → chunk-C22YEYFZ.js} +4 -4
  10. package/bundle/{chunk-2I6YN6ET.js → chunk-CASL47ST.js} +8 -8
  11. package/bundle/{chunk-YX7R55CR.js → chunk-F6PTAPQ3.js} +12 -12
  12. package/bundle/{chunk-AZW4HXNU.js → chunk-IGZTXGPG.js} +98 -29
  13. package/bundle/{chunk-SLLZJ5EC.js → chunk-KCDPTXHT.js} +2 -2
  14. package/bundle/{chunk-X5ZOTDHO.js → chunk-LUNVS6KP.js} +11 -11
  15. package/bundle/{chunk-GHJ6BH5U.js → chunk-LWH7IGI3.js} +8 -0
  16. package/bundle/{chunk-NQ26PJSQ.js → chunk-MIX3MCIF.js} +4 -4
  17. package/bundle/{chunk-JFACGAJT.js → chunk-OUM6SEVD.js} +2 -2
  18. package/bundle/{chunk-UQT2EQ4U.js → chunk-Q4VH72JI.js} +2 -2
  19. package/bundle/{chunk-HZDLR73C.js → chunk-R3NH5XAL.js} +1 -1
  20. package/bundle/{chunk-PPPAEFRA.js → chunk-ROJH7KPK.js} +2 -2
  21. package/bundle/{chunk-6JD4XCA4.js → chunk-SG3NCWZW.js} +14 -6
  22. package/bundle/{chunk-KOLLMZ2X.js → chunk-SWGB2P5J.js} +1 -1
  23. package/bundle/{chunk-TGABNSG5.js → chunk-TDXVQPZW.js} +4 -4
  24. package/bundle/{chunk-4ALRHKGE.js → chunk-TRN65L4F.js} +1 -1
  25. package/bundle/{chunk-ZSCIHMUI.js → chunk-TXC7WIPL.js} +3 -2
  26. package/bundle/{chunk-HSHLPYCQ.js → chunk-URKQZHVH.js} +9 -9
  27. package/bundle/{chunk-A3INCQ6Z.js → chunk-UUW7P6KJ.js} +1 -1
  28. package/bundle/{chunk-EPMRDKQT.js → chunk-VEEUXJDO.js} +1 -1
  29. package/bundle/{chunk-NONHDYXE.js → chunk-YJIU5WF4.js} +1 -1
  30. package/bundle/{chunk-ETDE2VYK.js → chunk-YLU5JFW2.js} +2 -2
  31. package/bundle/control-channel.js +2 -2
  32. package/bundle/index.js +1 -1
  33. package/bundle/intercom-bridge.js +2 -2
  34. package/bundle/preflight.js +8 -8
  35. package/bundle/project-panes.js +3 -3
  36. package/docs/agents.md +2 -2
  37. package/package.json +1 -1
  38. package/src/extension/herdr-pi-bridge.js +1 -1
  39. package/src/runs/background/async-job-tracker.js +85 -9
  40. package/src/runs/background/async-status.d.ts +2 -0
  41. package/src/runs/background/async-status.js +8 -3
  42. package/src/runs/shared/herdr-machine.js +3 -1
  43. package/src/runs/shared/subagent-prompt-runtime.js +6 -5
  44. package/src/shared/utils.d.ts +2 -0
  45. package/src/shared/utils.js +9 -0
@@ -10,10 +10,10 @@ import {
10
10
  setInlineWorkflowCoverage,
11
11
  setMainThinkingLevelSource,
12
12
  widgetRenderKey
13
- } from "./chunk-WW6GQBBS.js";
13
+ } from "./chunk-4FFKVLBG.js";
14
14
  import {
15
15
  package_default
16
- } from "./chunk-4ALRHKGE.js";
16
+ } from "./chunk-TRN65L4F.js";
17
17
  import {
18
18
  EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
19
19
  REVIVAL_ORIGIN_FILE,
@@ -66,7 +66,7 @@ import {
66
66
  takeCompactionAbort,
67
67
  workflowResumeClaimState,
68
68
  workflowResumeRefusal
69
- } from "./chunk-X5ZOTDHO.js";
69
+ } from "./chunk-LUNVS6KP.js";
70
70
  import {
71
71
  SUBAGENT_CHILD_ENV,
72
72
  SUBAGENT_PARENT_SESSION_ENV,
@@ -86,14 +86,14 @@ import {
86
86
  resolvePiSessionId,
87
87
  resolveWaitToolConfig,
88
88
  setDeclarationPinning
89
- } from "./chunk-TGABNSG5.js";
89
+ } from "./chunk-TDXVQPZW.js";
90
90
  import {
91
91
  deliverAsyncRunStop,
92
92
  ownerConfirmedDead,
93
93
  readSessionMessagesTail,
94
94
  resolveSubagentRunId,
95
95
  restoreForegroundRunHistory
96
- } from "./chunk-7W2IQFP4.js";
96
+ } from "./chunk-C22YEYFZ.js";
97
97
  import {
98
98
  ASYNC_STATUS_SNAPSHOT_KIND,
99
99
  ASYNC_STATUS_SNAPSHOT_VERSION,
@@ -108,8 +108,9 @@ import {
108
108
  resolveAsyncRunLocation,
109
109
  resolveAsyncStatusChild,
110
110
  runLaunchDir,
111
- stopStoppableAsyncStatusChildren
112
- } from "./chunk-6JD4XCA4.js";
111
+ stopStoppableAsyncStatusChildren,
112
+ summarizeAsyncStatus
113
+ } from "./chunk-SG3NCWZW.js";
113
114
  import {
114
115
  CONTACT_SUPERVISOR_TOOL_NAME,
115
116
  NATIVE_SUPERVISOR_TOOL_NAME,
@@ -119,7 +120,7 @@ import {
119
120
  parseSupervisorReplyData,
120
121
  parseSupervisorRequestDetails,
121
122
  topLevelSupervisorTool
122
- } from "./chunk-EPMRDKQT.js";
123
+ } from "./chunk-VEEUXJDO.js";
123
124
  import {
124
125
  MODEL_ONLY_TOOL,
125
126
  canRenderComponents,
@@ -145,7 +146,7 @@ import {
145
146
  resolveDisabledFeatureSurface,
146
147
  resolveMaxActiveAsyncRunsPerSession,
147
148
  resolveScheduledStoreRoot
148
- } from "./chunk-ETDE2VYK.js";
149
+ } from "./chunk-YLU5JFW2.js";
149
150
  import {
150
151
  ACTIVE_RUN_INDEX_DIR,
151
152
  MissionNotFoundError,
@@ -196,28 +197,28 @@ import {
196
197
  withWorkflowChildRunModel,
197
198
  writeAsyncResultFile,
198
199
  writeResultIndexForData
199
- } from "./chunk-SLLZJ5EC.js";
200
- import "./chunk-A3INCQ6Z.js";
200
+ } from "./chunk-KCDPTXHT.js";
201
+ import "./chunk-UUW7P6KJ.js";
201
202
  import {
202
203
  shouldUseNativeFsWatch
203
204
  } from "./chunk-NIXWDZZV.js";
204
205
  import {
205
206
  validateIntercomBridgeConfig
206
- } from "./chunk-NONHDYXE.js";
207
+ } from "./chunk-YJIU5WF4.js";
207
208
  import "./chunk-7F6RKT6W.js";
208
- import "./chunk-HZDLR73C.js";
209
+ import "./chunk-R3NH5XAL.js";
209
210
  import "./chunk-YARY7JWU.js";
210
211
  import {
211
212
  listHerdrProjectPaneRoots,
212
213
  restoreHerdrProjectPaneSnapshots
213
- } from "./chunk-JFACGAJT.js";
214
+ } from "./chunk-OUM6SEVD.js";
214
215
  import "./chunk-7J4ZXMY7.js";
215
216
  import {
216
217
  cleanupAllArtifactDirs,
217
218
  cleanupOldArtifacts,
218
219
  getArtifactPaths,
219
220
  getArtifactsDir
220
- } from "./chunk-S77ZKDLS.js";
221
+ } from "./chunk-77VQEATI.js";
221
222
  import {
222
223
  listBackgroundWorkProviders
223
224
  } from "./chunk-XA3DY6UG.js";
@@ -225,12 +226,12 @@ import "./chunk-YYREO77V.js";
225
226
  import "./chunk-UKG4V45O.js";
226
227
  import {
227
228
  registerRuntimeAgentEventListener
228
- } from "./chunk-JRO2CU4D.js";
229
+ } from "./chunk-5TXWZB73.js";
229
230
  import {
230
231
  clearRuntimeAgentsForPi,
231
232
  listRuntimeAgentConfigs,
232
233
  mergeRuntimeAgents
233
- } from "./chunk-KOLLMZ2X.js";
234
+ } from "./chunk-SWGB2P5J.js";
234
235
  import {
235
236
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
236
237
  DEFAULT_WAIT_TOOL_NAME,
@@ -253,6 +254,7 @@ import {
253
254
  getPiSpawnCommand,
254
255
  getProjectConfigDir,
255
256
  getSupportedThinkingLevels,
257
+ isStatusAccessError,
256
258
  mergeBuiltinAgentOverride,
257
259
  parseFrontmatter,
258
260
  readStatus,
@@ -273,7 +275,7 @@ import {
273
275
  waitToolName,
274
276
  withSettingsFileLease,
275
277
  writeAtomicJson
276
- } from "./chunk-GHJ6BH5U.js";
278
+ } from "./chunk-LWH7IGI3.js";
277
279
  import {
278
280
  DEFAULT_ARTIFACT_CONFIG,
279
281
  DIRS,
@@ -597,6 +599,8 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
597
599
  const runningJobIds = /* @__PURE__ */ new Set();
598
600
  const externalJobBridgeRuns = /* @__PURE__ */ new Set();
599
601
  const terminalPublications = /* @__PURE__ */ new Map();
602
+ const unreadableStatusRuns = /* @__PURE__ */ new Set();
603
+ const unverifiedRuns = /* @__PURE__ */ new Set();
600
604
  const supervisorNoticeTimers = /* @__PURE__ */ new Map();
601
605
  let rootWatcher;
602
606
  let nextLivenessAt = Date.now() + livenessIntervalMs;
@@ -919,9 +923,47 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
919
923
  runningJobIds.delete(asyncId);
920
924
  externalJobBridgeRuns.delete(asyncId);
921
925
  terminalPublications.delete(asyncId);
926
+ unreadableStatusRuns.delete(asyncId);
927
+ unverifiedRuns.delete(asyncId);
922
928
  clearSupervisorNotices(asyncId);
923
929
  };
930
+ const forgetJob = (asyncId) => {
931
+ cancelCleanup(asyncId);
932
+ closeJobWatcher(asyncId);
933
+ state.asyncJobs.delete(asyncId);
934
+ state.fleetJobs?.delete(asyncId);
935
+ options.onJobCleanup?.(asyncId);
936
+ };
924
937
  const refreshJob = (job) => {
938
+ if (unverifiedRuns.has(job.asyncId)) {
939
+ let stored = null;
940
+ let summary;
941
+ try {
942
+ stored = readStatus(job.asyncDir);
943
+ if (stored) summary = summarizeAsyncStatus(job.asyncDir, stored);
944
+ } catch (error) {
945
+ if (isStatusAccessError(error, job.asyncDir)) return false;
946
+ console.error(`[pi-subagents] Dropping restored async run '${job.asyncId}' at '${path2.join(job.asyncDir, "status.json")}': ${error instanceof Error ? error.message : String(error)}.`);
947
+ }
948
+ const owners = state.currentSessionId ? ownerSessionIds(state.currentSessionId) : void 0;
949
+ if (!stored || !summary || owners && !owners.has(stored.sessionId)) {
950
+ forgetJob(job.asyncId);
951
+ return true;
952
+ }
953
+ let restored;
954
+ try {
955
+ restored = summaryToJob(summary);
956
+ } catch (error) {
957
+ if (!unreadableStatusRuns.has(job.asyncId)) {
958
+ unreadableStatusRuns.add(job.asyncId);
959
+ console.error(`Cannot read async control events for '${job.asyncDir}'; keeping it as running until they are readable:`, error);
960
+ }
961
+ return false;
962
+ }
963
+ Object.assign(job, restored, { status: job.status, controlEventCursor: job.controlEventCursor ?? restored.controlEventCursor });
964
+ rememberFleetJob(state, job);
965
+ unverifiedRuns.delete(job.asyncId);
966
+ }
925
967
  const widgetExpanded = withLastUiContext((ctx) => ctx.ui.getToolsExpanded?.() ?? false) ?? false;
926
968
  const widgetStateBefore = widgetRenderKey(job, widgetExpanded);
927
969
  let nestedRefreshFailed = false;
@@ -967,6 +1009,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
967
1009
  }
968
1010
  });
969
1011
  const status = reconciliation.status ?? readStatus(job.asyncDir);
1012
+ unreadableStatusRuns.delete(job.asyncId);
970
1013
  if (!bridgeAlreadyRequired) {
971
1014
  const bridgeEligibility = externalJobBridgeEligibility(status?.steps);
972
1015
  if (bridgeEligibility === "required") externalJobBridgeRuns.add(job.asyncId);
@@ -1075,6 +1118,13 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1075
1118
  console.error(`Failed to service external job bridge for '${job.asyncDir}':`, bridgeError);
1076
1119
  }
1077
1120
  }
1121
+ if (isStatusAccessError(error, job.asyncDir)) {
1122
+ if (!unreadableStatusRuns.has(job.asyncId)) {
1123
+ unreadableStatusRuns.add(job.asyncId);
1124
+ console.error(`Cannot read async status for '${job.asyncDir}'; keeping its last known state until it is readable:`, error);
1125
+ }
1126
+ return widgetRenderKey(job, widgetExpanded) !== widgetStateBefore;
1127
+ }
1078
1128
  if (job.status !== "failed") {
1079
1129
  console.error(`Failed to read async status for '${job.asyncDir}':`, error);
1080
1130
  job.status = "failed";
@@ -1192,11 +1242,7 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1192
1242
  const owners = state.currentSessionId ? ownerSessionIds(state.currentSessionId) : void 0;
1193
1243
  for (const job of state.asyncJobs.values()) {
1194
1244
  if (owners && job.sessionId !== void 0 && !owners.has(job.sessionId)) {
1195
- cancelCleanup(job.asyncId);
1196
- closeJobWatcher(job.asyncId);
1197
- state.asyncJobs.delete(job.asyncId);
1198
- state.fleetJobs?.delete(job.asyncId);
1199
- options.onJobCleanup?.(job.asyncId);
1245
+ forgetJob(job.asyncId);
1200
1246
  widgetChanged = true;
1201
1247
  continue;
1202
1248
  }
@@ -1305,6 +1351,8 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1305
1351
  runningJobIds.clear();
1306
1352
  externalJobBridgeRuns.clear();
1307
1353
  terminalPublications.clear();
1354
+ unreadableStatusRuns.clear();
1355
+ unverifiedRuns.clear();
1308
1356
  clearSupervisorNotices();
1309
1357
  };
1310
1358
  const resetJobs = (ctx) => {
@@ -1328,8 +1376,17 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1328
1376
  state.statusProjectionSessionId = null;
1329
1377
  if (!state.currentSessionId) return;
1330
1378
  let runs;
1379
+ const unreadable = [];
1331
1380
  try {
1332
- runs = listAsyncRuns(asyncDirRoot, { states: ["queued", "running"], sessionId: state.currentSessionId, resultsDir, kill: options.kill, now: options.now, adoptCompletionOwnerId: state.completionOwnerId }, observeStatus);
1381
+ runs = listAsyncRuns(asyncDirRoot, {
1382
+ states: ["queued", "running"],
1383
+ sessionId: state.currentSessionId,
1384
+ resultsDir,
1385
+ kill: options.kill,
1386
+ now: options.now,
1387
+ adoptCompletionOwnerId: state.completionOwnerId,
1388
+ onUnreadableActiveRun: (runId, asyncDir) => unreadable.push({ runId, asyncDir })
1389
+ }, observeStatus);
1333
1390
  } catch (error) {
1334
1391
  console.error(`Failed to restore active async jobs from '${asyncDirRoot}':`, error);
1335
1392
  return;
@@ -1341,8 +1398,20 @@ function createAsyncJobTracker(pi, state, asyncDirRoot, options = {}) {
1341
1398
  rememberFleetJob(state, job);
1342
1399
  watchJob(job);
1343
1400
  }
1401
+ for (const { runId, asyncDir } of unreadable) {
1402
+ if (state.asyncJobs.has(runId)) continue;
1403
+ const job = { asyncId: runId, asyncDir, status: "running", sessionId: state.currentSessionId, updatedAt: Date.now() };
1404
+ try {
1405
+ job.controlEventCursor = restoredControlEventCursor(asyncDir);
1406
+ } catch {
1407
+ }
1408
+ state.asyncJobs.set(runId, job);
1409
+ runningJobIds.add(runId);
1410
+ unverifiedRuns.add(runId);
1411
+ watchJob(job);
1412
+ }
1344
1413
  state.statusProjectionSessionId = state.currentSessionId;
1345
- if (runs.length === 0) return;
1414
+ if (runs.length === 0 && unreadable.length === 0) return;
1346
1415
  ensurePoller();
1347
1416
  rerenderLastWidget();
1348
1417
  };
@@ -5370,7 +5439,7 @@ function registerSlashCommands(pi, state, options = {}) {
5370
5439
  }
5371
5440
  fleetOpen = true;
5372
5441
  try {
5373
- const { openSubagentFleet } = await import("./chunk-HSHLPYCQ.js");
5442
+ const { openSubagentFleet } = await import("./chunk-URKQZHVH.js");
5374
5443
  await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
5375
5444
  } finally {
5376
5445
  fleetOpen = false;
@@ -8784,7 +8853,7 @@ function registerSubagentExtension(pi) {
8784
8853
  const ctx = withLastUiContext((current) => current);
8785
8854
  if (!ctx) return;
8786
8855
  try {
8787
- const { openSubagentFleet } = await import("./chunk-HSHLPYCQ.js");
8856
+ const { openSubagentFleet } = await import("./chunk-URKQZHVH.js");
8788
8857
  await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi) });
8789
8858
  } catch (error) {
8790
8859
  if (isStaleExtensionContextError(error)) {
@@ -8993,7 +9062,7 @@ function registerSubagentExtension(pi) {
8993
9062
  let executor;
8994
9063
  let executorPromise;
8995
9064
  let executorModulePromise;
8996
- const loadExecutorModule = () => executorModulePromise ??= import("./chunk-CHEABMO2.js");
9065
+ const loadExecutorModule = () => executorModulePromise ??= import("./chunk-6D54VW3E.js");
8997
9066
  const getExecutor = () => {
8998
9067
  executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
8999
9068
  executor = createSubagentExecutor(executorDeps);
@@ -9007,7 +9076,7 @@ function registerSubagentExtension(pi) {
9007
9076
  modulePreloadTimer = setTimeout(() => {
9008
9077
  loadExecutorModule().catch(() => {
9009
9078
  });
9010
- if (fleetViewEnabled) import("./chunk-HSHLPYCQ.js").catch(() => {
9079
+ if (fleetViewEnabled) import("./chunk-URKQZHVH.js").catch(() => {
9011
9080
  });
9012
9081
  }, MODULE_PRELOAD_DELAY_MS);
9013
9082
  modulePreloadTimer.unref?.();
@@ -5,7 +5,7 @@ import {
5
5
  PROJECT_SUBAGENTS_RELATIVE_DIR,
6
6
  canonicalSessionId,
7
7
  inspectSessionLease
8
- } from "./chunk-S77ZKDLS.js";
8
+ } from "./chunk-77VQEATI.js";
9
9
  import {
10
10
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
11
11
  DEFAULT_GLOBAL_CONCURRENCY_LIMIT,
@@ -27,7 +27,7 @@ import {
27
27
  withFileLease,
28
28
  writeAtomicJson,
29
29
  writePrivateAtomicJson
30
- } from "./chunk-GHJ6BH5U.js";
30
+ } from "./chunk-LWH7IGI3.js";
31
31
  import {
32
32
  DIRS,
33
33
  SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
@@ -11,10 +11,10 @@ import {
11
11
  startWatchdogDiffBaselineCapture,
12
12
  writeUserWatchdogEnabled,
13
13
  writeWatchdogModelSettings
14
- } from "./chunk-TGABNSG5.js";
14
+ } from "./chunk-TDXVQPZW.js";
15
15
  import {
16
16
  resolveGitRepositoryIdentity
17
- } from "./chunk-7W2IQFP4.js";
17
+ } from "./chunk-C22YEYFZ.js";
18
18
  import {
19
19
  formatParallelHandoffLines,
20
20
  listAsyncRuns,
@@ -25,7 +25,7 @@ import {
25
25
  readKeptBranches,
26
26
  readWorkflowLaunchRecord,
27
27
  resolveRetainedWorktreeCwd
28
- } from "./chunk-6JD4XCA4.js";
28
+ } from "./chunk-SG3NCWZW.js";
29
29
  import {
30
30
  ownsRun
31
31
  } from "./chunk-HXRB42AF.js";
@@ -57,24 +57,24 @@ import {
57
57
  resolveMissionStoreLocation,
58
58
  validateMissionId,
59
59
  workflowRunParamsFingerprint
60
- } from "./chunk-SLLZJ5EC.js";
60
+ } from "./chunk-KCDPTXHT.js";
61
61
  import {
62
62
  requestAsyncCommand,
63
63
  watchAsyncControlInbox
64
- } from "./chunk-A3INCQ6Z.js";
64
+ } from "./chunk-UUW7P6KJ.js";
65
65
  import {
66
66
  supervisorChannelDir
67
- } from "./chunk-HZDLR73C.js";
67
+ } from "./chunk-R3NH5XAL.js";
68
68
  import {
69
69
  createRequiredChildExtensionIdentity
70
70
  } from "./chunk-YARY7JWU.js";
71
71
  import {
72
72
  createHerdrClient,
73
73
  detectHerdr
74
- } from "./chunk-JFACGAJT.js";
74
+ } from "./chunk-OUM6SEVD.js";
75
75
  import {
76
76
  getProjectSubagentsDir
77
- } from "./chunk-S77ZKDLS.js";
77
+ } from "./chunk-77VQEATI.js";
78
78
  import {
79
79
  ExternalJobProviderError,
80
80
  getExternalJobProvider,
@@ -84,7 +84,7 @@ import {
84
84
  } from "./chunk-YYREO77V.js";
85
85
  import {
86
86
  mergeRuntimeAgents
87
- } from "./chunk-KOLLMZ2X.js";
87
+ } from "./chunk-SWGB2P5J.js";
88
88
  import {
89
89
  CODE_OWNED_EXTERNAL_CLI_ADAPTER_LABEL,
90
90
  EXTERNAL_CLI_ADAPTER_SAFETY,
@@ -145,7 +145,7 @@ import {
145
145
  withFileLease,
146
146
  writeAtomicJson,
147
147
  writePrivateAtomicJson
148
- } from "./chunk-GHJ6BH5U.js";
148
+ } from "./chunk-LWH7IGI3.js";
149
149
  import {
150
150
  DIRS,
151
151
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -7888,7 +7888,7 @@ function childSessionFactory() {
7888
7888
  }
7889
7889
  function createLazyPlacementFactory(local) {
7890
7890
  let placed;
7891
- const factory = async () => placed ??= (await import("./chunk-NQ26PJSQ.js")).createPlacementAwareChildSessionFactory(local);
7891
+ const factory = async () => placed ??= (await import("./chunk-MIX3MCIF.js")).createPlacementAwareChildSessionFactory(local);
7892
7892
  return {
7893
7893
  async create(launch) {
7894
7894
  return launch.machine ? (await factory()).create(launch) : local.create(launch);
@@ -7664,6 +7664,13 @@ function resolveChildCwd(baseCwd, childCwd) {
7664
7664
  function isNotFoundError(error) {
7665
7665
  return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
7666
7666
  }
7667
+ function isStatusAccessError(error, asyncDir) {
7668
+ const code = error?.cause?.code;
7669
+ if (code !== "EACCES" && code !== "EPERM") return false;
7670
+ const message = error instanceof Error ? error.message : "";
7671
+ const quotedPath = `'${path16.join(asyncDir, "status.json")}':`;
7672
+ return message.startsWith(`Failed to inspect async status file ${quotedPath}`) || message.startsWith(`Failed to read async status file ${quotedPath}`);
7673
+ }
7667
7674
  function readStatus(asyncDir) {
7668
7675
  if (Buffer.byteLength(path16.basename(asyncDir), "utf-8") > 255) {
7669
7676
  return null;
@@ -8720,6 +8727,7 @@ export {
8720
8727
  getProjectConfigDir,
8721
8728
  getAgentDir,
8722
8729
  resolveChildCwd,
8730
+ isStatusAccessError,
8723
8731
  readStatus,
8724
8732
  findLatestSessionFile,
8725
8733
  assistantMessageError,
@@ -7,13 +7,13 @@ import {
7
7
  runBoundedCommand,
8
8
  shellScriptCommand,
9
9
  sshMachineAccess
10
- } from "./chunk-ZSCIHMUI.js";
10
+ } from "./chunk-TXC7WIPL.js";
11
11
  import {
12
12
  package_default
13
- } from "./chunk-4ALRHKGE.js";
13
+ } from "./chunk-TRN65L4F.js";
14
14
  import {
15
15
  ensureSupervisorChannelDir
16
- } from "./chunk-EPMRDKQT.js";
16
+ } from "./chunk-VEEUXJDO.js";
17
17
  import "./chunk-HXRB42AF.js";
18
18
  import "./chunk-NIXWDZZV.js";
19
19
  import {
@@ -39,7 +39,7 @@ import {
39
39
  resolveRexBinary,
40
40
  rexCommandEnv,
41
41
  rexGlobalArgs
42
- } from "./chunk-GHJ6BH5U.js";
42
+ } from "./chunk-LWH7IGI3.js";
43
43
  import "./chunk-JEZOSEWG.js";
44
44
  import "./chunk-YFCK7H2S.js";
45
45
  import "./chunk-QXASAHIA.js";
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-7J4ZXMY7.js";
4
4
  import {
5
5
  getProjectSubagentsDir
6
- } from "./chunk-S77ZKDLS.js";
6
+ } from "./chunk-77VQEATI.js";
7
7
  import {
8
8
  getPiSpawnCommand,
9
9
  writeAtomicJson
10
- } from "./chunk-GHJ6BH5U.js";
10
+ } from "./chunk-LWH7IGI3.js";
11
11
 
12
12
  // src/inspectors/herdr/project-panes.ts
13
13
  import * as fs from "node:fs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getProjectSubagentsDir
3
- } from "./chunk-S77ZKDLS.js";
3
+ } from "./chunk-77VQEATI.js";
4
4
  import {
5
5
  discoverAgents,
6
6
  formatUnknownAgentError,
7
7
  resolveAgentName,
8
8
  unknownAgentDiagnosticContext
9
- } from "./chunk-GHJ6BH5U.js";
9
+ } from "./chunk-LWH7IGI3.js";
10
10
 
11
11
  // src/agents/agent-refinements.ts
12
12
  import { createHash, randomUUID } from "node:crypto";
@@ -7,7 +7,7 @@ import {
7
7
  getAgentDir,
8
8
  getConfigDirName,
9
9
  getProjectConfigDir
10
- } from "./chunk-GHJ6BH5U.js";
10
+ } from "./chunk-LWH7IGI3.js";
11
11
  import {
12
12
  TEMP_ROOT_DIR
13
13
  } from "./chunk-JEZOSEWG.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  appendAgentRefinementOverlay
3
- } from "./chunk-UQT2EQ4U.js";
3
+ } from "./chunk-Q4VH72JI.js";
4
4
  import {
5
5
  buildAgentMemoryInjection,
6
6
  buildSkillInjection
7
- } from "./chunk-GHJ6BH5U.js";
7
+ } from "./chunk-LWH7IGI3.js";
8
8
 
9
9
  // src/runs/shared/effective-system-prompt.ts
10
10
  function appendSection(prompt, section) {
@@ -47,10 +47,10 @@ import {
47
47
  validateModelResponseAliases,
48
48
  withWorkflowChildRunModel,
49
49
  withWorktreeTransaction
50
- } from "./chunk-SLLZJ5EC.js";
50
+ } from "./chunk-KCDPTXHT.js";
51
51
  import {
52
52
  validateIntercomBridgeConfig
53
- } from "./chunk-NONHDYXE.js";
53
+ } from "./chunk-YJIU5WF4.js";
54
54
  import {
55
55
  stableJsonDigest
56
56
  } from "./chunk-7F6RKT6W.js";
@@ -59,7 +59,7 @@ import {
59
59
  } from "./chunk-YARY7JWU.js";
60
60
  import {
61
61
  missingForkCopyNote
62
- } from "./chunk-S77ZKDLS.js";
62
+ } from "./chunk-77VQEATI.js";
63
63
  import {
64
64
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
65
65
  assertWorkflowLaneKey,
@@ -72,6 +72,7 @@ import {
72
72
  intersectThinkingCeilings,
73
73
  isDynamicParallelStep,
74
74
  isParallelStep,
75
+ isStatusAccessError,
75
76
  normalizeExtensionBindings,
76
77
  normalizeWorkflowLaneMetadata,
77
78
  parseThinkingLevel,
@@ -84,7 +85,7 @@ import {
84
85
  validateToolBudgetConfig,
85
86
  waitForFileSystemRetry,
86
87
  writeAtomicJson
87
- } from "./chunk-GHJ6BH5U.js";
88
+ } from "./chunk-LWH7IGI3.js";
88
89
  import {
89
90
  DIRS,
90
91
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -2172,9 +2173,11 @@ function isolateCorruptActiveRun(asyncDir, runId, error, now) {
2172
2173
  }
2173
2174
  const markerCanBeReleased = processTerminal?.state === "observed" || markerAge !== void 0 && markerAge > DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS;
2174
2175
  let markerAction = "active marker retained because runner liveness is unknown";
2176
+ let retained = true;
2175
2177
  if (markerCanBeReleased) {
2176
2178
  try {
2177
2179
  releaseActiveRunIndex(asyncDir);
2180
+ retained = false;
2178
2181
  markerAction = processTerminal?.state === "observed" ? "active marker released after observed process-terminal proof" : "stale active marker released";
2179
2182
  } catch (releaseError) {
2180
2183
  markerAction = `failed to release active marker: ${getErrorMessage(releaseError)}`;
@@ -2189,9 +2192,10 @@ function isolateCorruptActiveRun(asyncDir, runId, error, now) {
2189
2192
  }
2190
2193
  const signature = `${fileSignature}
2191
2194
  ${line}`;
2192
- if (reportedCorruptStatus.get(statusPath) === signature) return;
2195
+ if (reportedCorruptStatus.get(statusPath) === signature) return retained;
2193
2196
  reportedCorruptStatus.set(statusPath, signature);
2194
2197
  console.error(line);
2198
+ return retained;
2195
2199
  }
2196
2200
  function isNotFoundError(error) {
2197
2201
  return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
@@ -2424,6 +2428,9 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2424
2428
  ...status.sessionFile ? { sessionFile: status.sessionFile } : {}
2425
2429
  };
2426
2430
  }
2431
+ function summarizeAsyncStatus(asyncDir, status) {
2432
+ return statusToSummary(asyncDir, status);
2433
+ }
2427
2434
  function sortRuns(runs) {
2428
2435
  const rank = (state) => {
2429
2436
  switch (state) {
@@ -2523,7 +2530,7 @@ function listAsyncRuns(asyncDirRoot, options = {}, observeStatus) {
2523
2530
  } catch (error) {
2524
2531
  observeStatus?.(null);
2525
2532
  if (!activeEntries.has(entry) || !isAsyncStatusIsolationError(asyncDir, error)) throw error;
2526
- isolateCorruptActiveRun(asyncDir, entry, error, options.now);
2533
+ if (isolateCorruptActiveRun(asyncDir, entry, error, options.now) && isStatusAccessError(error, asyncDir)) options.onUnreadableActiveRun?.(entry, asyncDir);
2527
2534
  continue;
2528
2535
  }
2529
2536
  if (!status) {
@@ -4228,6 +4235,7 @@ export {
4228
4235
  formatWorkflowChecklistPhase,
4229
4236
  formatWorkflowChecklistBottleneck,
4230
4237
  formatWorkflowChecklistText,
4238
+ summarizeAsyncStatus,
4231
4239
  listAsyncRuns,
4232
4240
  formatWorkflowStageLine,
4233
4241
  formatAsyncRunOutputPath,
@@ -8,7 +8,7 @@ import {
8
8
  validateCodeOwnedProfileRunner,
9
9
  validatePermissionRules,
10
10
  validateToolBudgetConfig
11
- } from "./chunk-GHJ6BH5U.js";
11
+ } from "./chunk-LWH7IGI3.js";
12
12
 
13
13
  // src/agents/runtime-agent-registry.ts
14
14
  var RUNTIME_AGENT_REGISTRY_KEY = "pi-subagents.runtime-agents.v1";
@@ -8,7 +8,7 @@ import {
8
8
  projectTimeoutRecovery,
9
9
  readAsyncRecoveryDescriptor,
10
10
  utf8Tail
11
- } from "./chunk-6JD4XCA4.js";
11
+ } from "./chunk-SG3NCWZW.js";
12
12
  import {
13
13
  MAX_ARGS_BYTES,
14
14
  MAX_ARGS_DEPTH,
@@ -21,10 +21,10 @@ import {
21
21
  resultFilePath,
22
22
  resultPayloadMatchesSessionRun,
23
23
  resultPayloadPathForSessionRun
24
- } from "./chunk-SLLZJ5EC.js";
24
+ } from "./chunk-KCDPTXHT.js";
25
25
  import {
26
26
  PROJECT_SUBAGENTS_RELATIVE_DIR
27
- } from "./chunk-S77ZKDLS.js";
27
+ } from "./chunk-77VQEATI.js";
28
28
  import {
29
29
  listBackgroundWorkWakeChannels,
30
30
  snapshotBackgroundWork
@@ -50,7 +50,7 @@ import {
50
50
  waitToolName,
51
51
  withSettingsFileLease,
52
52
  writePrivateAtomicJson
53
- } from "./chunk-GHJ6BH5U.js";
53
+ } from "./chunk-LWH7IGI3.js";
54
54
  import {
55
55
  DIRS,
56
56
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.89.0",
4
+ version: "0.89.1",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",
@@ -5,7 +5,7 @@ import {
5
5
  getProjectConfigDir,
6
6
  resolveLocalLaunchCwd,
7
7
  resolveRexLocalPlacement
8
- } from "./chunk-GHJ6BH5U.js";
8
+ } from "./chunk-LWH7IGI3.js";
9
9
 
10
10
  // src/runs/shared/herdr-machine.ts
11
11
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -542,7 +542,8 @@ function resolveMachinePlacement(input) {
542
542
  const env = input.env ?? process.env;
543
543
  if (env.HERDR_ENV === "1" && env.HERDR_PANE_ID?.trim()) return { machine: resolveHerdrLocalPlacement({ cwd: input.cwd, stepCwd: input.stepCwd, env, herdrBin: input.herdrBin }) };
544
544
  if (env.REX_SESSION?.trim()) return { machine: resolveRexLocalPlacement({ cwd: input.cwd, stepCwd: input.stepCwd, env }) };
545
- throw new Error("Machine 'local' opens the child in a new tab of the terminal this Pi runs in, but this Pi is running in neither Herdr (HERDR_ENV=1 with HERDR_PANE_ID) nor Rex (REX_SESSION).");
545
+ const core = env.HC_TERMINAL_ID?.trim() ? " It runs in a Herdr Core terminal (HC_TERMINAL_ID), which machine 'local' does not support." : "";
546
+ throw new Error(`Machine 'local' opens the child in a new tab of the terminal this Pi runs in, but this Pi is running in neither Herdr (HERDR_ENV=1 with HERDR_PANE_ID) nor Rex (REX_SESSION).${core}`);
546
547
  }
547
548
  if (settings?.rex) return { machine: { provider: "rex", id: requested, target: settings.rex.ssh, cwd: validateRemoteCwd(remoteMachineCwd(input.stepCwd, settings.cwd, requested), requested) } };
548
549
  return resolveHerdrMachinePlacement(input);