@vicary/pi-subagents 0.88.1 → 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 (93) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-4QFZZV3O.js → chunk-4AL6LDBY.js} +3 -1
  5. package/bundle/{chunk-5EMPFFO4.js → chunk-4FFKVLBG.js} +4 -4
  6. package/bundle/{chunk-L4YY2TOE.js → chunk-5TXWZB73.js} +1 -1
  7. package/bundle/{chunk-YDZ7BZD5.js → chunk-77VQEATI.js} +1 -1
  8. package/bundle/{chunk-7OX6O7DQ.js → chunk-BERAWSQQ.js} +5 -5
  9. package/bundle/{chunk-LV3CPYXJ.js → chunk-C22YEYFZ.js} +4 -4
  10. package/bundle/{chunk-AZPP3G4N.js → chunk-DVOXHOTY.js} +34 -5
  11. package/bundle/{chunk-2HKPEANZ.js → chunk-JLZFSOEL.js} +26 -15
  12. package/bundle/{chunk-CPSUJHZE.js → chunk-KCDPTXHT.js} +39 -10
  13. package/bundle/{chunk-4MVDMA5C.js → chunk-LWH7IGI3.js} +21 -7
  14. package/bundle/{chunk-DSHQWGHO.js → chunk-MIX3MCIF.js} +96 -96
  15. package/bundle/{chunk-BKISQ5CJ.js → chunk-NLDROUCR.js} +56 -34
  16. package/bundle/{chunk-2DIEL4WG.js → chunk-OUM6SEVD.js} +2 -2
  17. package/bundle/{chunk-XIA5GSEU.js → chunk-Q4VH72JI.js} +2 -2
  18. package/bundle/{chunk-D32H53HM.js → chunk-R3NH5XAL.js} +1 -1
  19. package/bundle/{chunk-CGWNA6EJ.js → chunk-R5XS4CVE.js} +98 -29
  20. package/bundle/{chunk-V7SZMS6W.js → chunk-RHMU7SXN.js} +2 -2
  21. package/bundle/{chunk-4ZQBZDF3.js → chunk-SG3NCWZW.js} +86 -20
  22. package/bundle/{chunk-KXW62VBU.js → chunk-SWGB2P5J.js} +1 -1
  23. package/bundle/{chunk-6CG2VAG4.js → chunk-TRN65L4F.js} +1 -1
  24. package/bundle/{chunk-GDR2ILWY.js → chunk-TXC7WIPL.js} +51 -22
  25. package/bundle/{chunk-IYT7X46U.js → chunk-UNLGCAC4.js} +5 -5
  26. package/bundle/{chunk-PYKBTBY6.js → chunk-URKQZHVH.js} +9 -9
  27. package/bundle/{chunk-W6HIYD2Z.js → chunk-UUW7P6KJ.js} +1 -1
  28. package/bundle/{chunk-CYKNHFXB.js → chunk-VEEUXJDO.js} +1 -1
  29. package/bundle/{chunk-JQTHG2ID.js → chunk-WMGQNIP7.js} +75 -32
  30. package/bundle/{chunk-47ZN7NKR.js → chunk-YJIU5WF4.js} +1 -1
  31. package/bundle/{chunk-RMZAAXIR.js → chunk-YLU5JFW2.js} +2 -2
  32. package/bundle/control-channel.js +2 -2
  33. package/bundle/index.js +2 -2
  34. package/bundle/intercom-bridge.js +2 -2
  35. package/bundle/preflight.js +8 -8
  36. package/bundle/project-panes.js +3 -3
  37. package/docs/agents.md +10 -4
  38. package/docs/configuration.md +2 -0
  39. package/docs/extension-api.md +1 -1
  40. package/docs/tool-reference.md +1 -1
  41. package/docs/workflows.md +5 -3
  42. package/package.json +2 -2
  43. package/src/extension/herdr-pi-bridge.js +79 -23
  44. package/src/extension/schemas.js +1 -1
  45. package/src/extension/subagent-options.js +5 -0
  46. package/src/intercom/result-intercom.js +3 -2
  47. package/src/runs/background/async-job-tracker.js +85 -9
  48. package/src/runs/background/async-status.d.ts +2 -0
  49. package/src/runs/background/async-status.js +8 -3
  50. package/src/runs/background/notify.d.ts +3 -0
  51. package/src/runs/background/notify.js +7 -2
  52. package/src/runs/background/run-status.js +3 -2
  53. package/src/runs/background/runner-child-launch.js +1 -0
  54. package/src/runs/background/subagent-runner.js +11 -8
  55. package/src/runs/foreground/execution.js +8 -7
  56. package/src/runs/foreground/subagent-executor.js +31 -5
  57. package/src/runs/shared/child-launch.d.ts +2 -0
  58. package/src/runs/shared/child-launch.js +1 -1
  59. package/src/runs/shared/child-session.d.ts +2 -1
  60. package/src/runs/shared/herdr-connection.d.ts +6 -0
  61. package/src/runs/shared/herdr-connection.js +11 -1
  62. package/src/runs/shared/herdr-machine.d.ts +2 -2
  63. package/src/runs/shared/herdr-machine.js +49 -22
  64. package/src/runs/shared/herdr-pane-host.d.ts +7 -19
  65. package/src/runs/shared/herdr-pane-host.js +48 -33
  66. package/src/runs/shared/herdr-pi-protocol.d.ts +1 -0
  67. package/src/runs/shared/herdr-pi-protocol.js +3 -2
  68. package/src/runs/shared/herdr-placed-run.d.ts +2 -12
  69. package/src/runs/shared/herdr-placed-run.js +10 -8
  70. package/src/runs/shared/kept-branch-text.d.ts +8 -0
  71. package/src/runs/shared/kept-branch-text.js +24 -0
  72. package/src/runs/shared/local-machine-access.d.ts +4 -1
  73. package/src/runs/shared/local-machine-access.js +6 -3
  74. package/src/runs/shared/mutation-evidence.d.ts +7 -1
  75. package/src/runs/shared/mutation-evidence.js +18 -2
  76. package/src/runs/shared/parallel-handoff.js +19 -7
  77. package/src/runs/shared/placed-run-owner.d.ts +4 -2
  78. package/src/runs/shared/placed-run-owner.js +15 -7
  79. package/src/runs/shared/rex-machine.d.ts +7 -3
  80. package/src/runs/shared/rex-machine.js +12 -9
  81. package/src/runs/shared/rex-pane-host.js +7 -27
  82. package/src/runs/shared/single-output.js +2 -2
  83. package/src/runs/shared/subagent-prompt-runtime.js +34 -0
  84. package/src/runs/shared/tool-availability.d.ts +4 -0
  85. package/src/runs/shared/tool-availability.js +7 -0
  86. package/src/runs/shared/worktree-cleanup-plan.js +2 -2
  87. package/src/runs/shared/worktree.d.ts +4 -14
  88. package/src/runs/shared/worktree.js +38 -8
  89. package/src/shared/types.d.ts +26 -2
  90. package/src/shared/utils.d.ts +2 -0
  91. package/src/shared/utils.js +9 -0
  92. package/src/workflows/workflow-child-summary.d.ts +2 -1
  93. package/src/workflows/workflow-child-summary.js +14 -6
@@ -3,7 +3,7 @@ import {
3
3
  projectRuntimeAcknowledgedExtensions,
4
4
  registerSubagentPromptBoundary,
5
5
  registerSubagentPromptRuntime
6
- } from "./chunk-AZPP3G4N.js";
6
+ } from "./chunk-DVOXHOTY.js";
7
7
  import {
8
8
  INSPECTOR_ACTIONS,
9
9
  canQueueRetainedAsyncFollowUp,
@@ -25,12 +25,12 @@ import {
25
25
  updateSteeringTarget,
26
26
  waitForSteeringAction,
27
27
  workflowAsyncChildSteeringGuidance
28
- } from "./chunk-7OX6O7DQ.js";
28
+ } from "./chunk-BERAWSQQ.js";
29
29
  import {
30
30
  PLACED_RESTORE_UNSUPPORTED,
31
31
  formatHerdrMachineRunnerUnsupported,
32
32
  resolveMachinePlacement
33
- } from "./chunk-GDR2ILWY.js";
33
+ } from "./chunk-TXC7WIPL.js";
34
34
  import {
35
35
  COMPLETION_ACTION,
36
36
  DEFAULT_CONTROL_CONFIG,
@@ -119,7 +119,7 @@ import {
119
119
  workflowScriptDigest,
120
120
  workflowStopCause,
121
121
  writeWorkflowReceipt
122
- } from "./chunk-2HKPEANZ.js";
122
+ } from "./chunk-JLZFSOEL.js";
123
123
  import {
124
124
  SUBAGENT_PARENT_SESSION_ENV,
125
125
  applyWatchdogLaunchRules,
@@ -132,7 +132,7 @@ import {
132
132
  resolveWatchdogConfig,
133
133
  sendRuleViolationWarning,
134
134
  writeWatchdogModelSettings
135
- } from "./chunk-IYT7X46U.js";
135
+ } from "./chunk-UNLGCAC4.js";
136
136
  import {
137
137
  MAX_REMEMBERED_FOREGROUND_RUNS,
138
138
  discardRunningForegroundRun,
@@ -145,7 +145,7 @@ import {
145
145
  resolveSubagentRunId,
146
146
  resolveWorkflowChatProgress,
147
147
  stopAsyncRun
148
- } from "./chunk-LV3CPYXJ.js";
148
+ } from "./chunk-C22YEYFZ.js";
149
149
  import {
150
150
  RunFanoutLimitError,
151
151
  annotateWorkflowPreflightTrace,
@@ -165,6 +165,7 @@ import {
165
165
  formatAsyncRunProgressLabel,
166
166
  formatNestedRunStatusLines,
167
167
  formatParallelHandoffError,
168
+ formatParallelHandoffLines,
168
169
  formatParallelHandoffReference,
169
170
  formatRunFanoutBudget,
170
171
  formatStoredParallelHandoffCleanup,
@@ -191,6 +192,8 @@ import {
191
192
  recordParallelHandoffMerge,
192
193
  recordParallelHandoffSupersession,
193
194
  recoveryDescriptorPath,
195
+ remoteMutationEvidence,
196
+ remoteMutationSnapshot,
194
197
  resolveAsyncResumeTarget,
195
198
  resolveAsyncRunLocation,
196
199
  resolveAsyncStatusChild,
@@ -206,12 +209,12 @@ import {
206
209
  writeRunFanoutBudgetDescriptor,
207
210
  writeWorkflowLaunchRecord,
208
211
  writeWorktreeSetupHandoff
209
- } from "./chunk-4ZQBZDF3.js";
212
+ } from "./chunk-SG3NCWZW.js";
210
213
  import {
211
214
  NATIVE_SUPERVISOR_TOOL_NAME,
212
215
  createNativeSupervisorChannel,
213
216
  resolveSupervisorChannelDir
214
- } from "./chunk-CYKNHFXB.js";
217
+ } from "./chunk-VEEUXJDO.js";
215
218
  import {
216
219
  MODEL_ONLY_TOOL,
217
220
  inheritedSessionIds,
@@ -234,10 +237,10 @@ import {
234
237
  canPreferFork,
235
238
  createForkContextResolver,
236
239
  resolveSubagentLaunchContext
237
- } from "./chunk-V7SZMS6W.js";
240
+ } from "./chunk-RHMU7SXN.js";
238
241
  import {
239
242
  handleRefinementAction
240
- } from "./chunk-XIA5GSEU.js";
243
+ } from "./chunk-Q4VH72JI.js";
241
244
  import {
242
245
  ActiveAsyncCapacityError,
243
246
  acquireActiveAsyncCapacity,
@@ -253,7 +256,7 @@ import {
253
256
  resolveDisabledFeatureSurface,
254
257
  resolveMaxActiveAsyncRunsPerSession,
255
258
  transferActiveAsyncCapacity
256
- } from "./chunk-RMZAAXIR.js";
259
+ } from "./chunk-YLU5JFW2.js";
257
260
  import {
258
261
  DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS,
259
262
  MACHINE_DIFF_OPTIONS,
@@ -290,6 +293,7 @@ import {
290
293
  inheritedNestedParentAddressOf,
291
294
  inheritedNestedRouteOf,
292
295
  initializeProcessTerminal,
296
+ isWorktreeCleanupTaskDone,
293
297
  lookupRunnerLauncher,
294
298
  missionAcceptanceStatus,
295
299
  nestedResultsPath,
@@ -339,7 +343,7 @@ import {
339
343
  writeNestedControlRequest,
340
344
  writeNestedControlResult,
341
345
  writeNestedEvent
342
- } from "./chunk-CPSUJHZE.js";
346
+ } from "./chunk-KCDPTXHT.js";
343
347
  import {
344
348
  closeSteerInbox,
345
349
  consumeSteerRequests,
@@ -347,7 +351,7 @@ import {
347
351
  readRevivalBriefs,
348
352
  requestAsyncSteer,
349
353
  watchAsyncControlInbox
350
- } from "./chunk-W6HIYD2Z.js";
354
+ } from "./chunk-UUW7P6KJ.js";
351
355
  import "./chunk-NIXWDZZV.js";
352
356
  import {
353
357
  INTERCOM_BRIDGE_MARKER,
@@ -356,7 +360,7 @@ import {
356
360
  resolveIntercomBridge,
357
361
  resolveIntercomSessionTarget,
358
362
  resolveSubagentIntercomTarget
359
- } from "./chunk-47ZN7NKR.js";
363
+ } from "./chunk-YJIU5WF4.js";
360
364
  import {
361
365
  agentDefinitionDigest,
362
366
  resolveLaunchBinding,
@@ -371,7 +375,7 @@ import {
371
375
  resolvePiLaunchToolPlan,
372
376
  resolveRuntimeModulePath,
373
377
  supervisorChannelDir
374
- } from "./chunk-D32H53HM.js";
378
+ } from "./chunk-R3NH5XAL.js";
375
379
  import {
376
380
  assertRequiredChildExtensionsAdmitted,
377
381
  createRequiredChildExtensionIdentity,
@@ -383,7 +387,7 @@ import {
383
387
  import {
384
388
  HERDR_PROJECT_PANE_ACTIONS,
385
389
  handleHerdrProjectPaneAction
386
- } from "./chunk-2DIEL4WG.js";
390
+ } from "./chunk-OUM6SEVD.js";
387
391
  import "./chunk-7J4ZXMY7.js";
388
392
  import {
389
393
  PROJECT_SUBAGENTS_RELATIVE_DIR,
@@ -397,12 +401,12 @@ import {
397
401
  missingForkCopyNote,
398
402
  writeArtifact,
399
403
  writeMetadata
400
- } from "./chunk-YDZ7BZD5.js";
404
+ } from "./chunk-77VQEATI.js";
401
405
  import "./chunk-XA3DY6UG.js";
402
406
  import {
403
407
  getExternalJobProvider
404
408
  } from "./chunk-YYREO77V.js";
405
- import "./chunk-KXW62VBU.js";
409
+ import "./chunk-SWGB2P5J.js";
406
410
  import {
407
411
  ChainOutputValidationError,
408
412
  DEFAULT_WAIT_TOOL_NAME,
@@ -449,6 +453,7 @@ import {
449
453
  discoverAgentsAll,
450
454
  discoverAvailableSkills,
451
455
  editDistance,
456
+ editsLocalDisk,
452
457
  encodeExtensionBindings,
453
458
  evaluateAcceptance,
454
459
  externalCliReceiptMetadata,
@@ -486,7 +491,6 @@ import {
486
491
  isDynamicRunnerGroup,
487
492
  isParallelGroup,
488
493
  isParallelStep,
489
- isRexLocalMachine,
490
494
  isSettlementFatalOutputError,
491
495
  isStorageCapacityError,
492
496
  isToolBudgetBlockedMessage,
@@ -556,7 +560,7 @@ import {
556
560
  writeAtomicJson,
557
561
  writeInitialProgressFile,
558
562
  writePrivateAtomicJson
559
- } from "./chunk-4MVDMA5C.js";
563
+ } from "./chunk-LWH7IGI3.js";
560
564
  import {
561
565
  CHAIN_RUNS_DIR,
562
566
  DEFAULT_ARTIFACT_CONFIG,
@@ -1370,7 +1374,7 @@ ${input.systemPrompt}` : void 0;
1370
1374
  cwd: input.cwd,
1371
1375
  ...input.machine ? { machine: input.machine } : {},
1372
1376
  ...input.projectTrusted !== void 0 ? { projectTrusted: input.projectTrusted } : {},
1373
- ...input.machine ? { remoteResources: { agent: input.childAgentName, ...input.remoteSkillNames ? { skills: input.remoteSkillNames } : {}, ...input.remoteReads !== void 0 ? { reads: input.remoteReads } : {}, ...toolPlan.explicitToolAllowlist ? { toolCeiling: [...toolPlan.effectiveToolAllowlist] } : toolPlan.capabilityCeiling?.allowedTools ? { toolCeiling: [...toolPlan.capabilityCeiling.allowedTools] } : {} } } : {},
1377
+ ...input.machine ? { remoteResources: { agent: input.childAgentName, ...input.remoteSkillNames ? { skills: input.remoteSkillNames } : {}, ...input.remoteReads !== void 0 ? { reads: input.remoteReads } : {}, ...toolPlan.explicitToolAllowlist ? { toolCeiling: [...toolPlan.effectiveToolAllowlist] } : toolPlan.capabilityCeiling?.allowedTools ? { toolCeiling: [...toolPlan.capabilityCeiling.allowedTools] } : {}, ...input.acceptancePrompt ? { acceptancePrompt: input.acceptancePrompt } : {} } } : {},
1374
1378
  storage: childStorage(input),
1375
1379
  ...input.parentSessionFile ? { parentSessionFile: input.parentSessionFile } : {},
1376
1380
  ...input.model ? { model: input.model } : {},
@@ -5392,6 +5396,7 @@ async function runSingleAttempt(runtimeCwd, agent, task, model, options, shared)
5392
5396
  machine: options.machine,
5393
5397
  remoteSkillNames: options.skills ?? agent.skills,
5394
5398
  remoteReads: options.remoteReads,
5399
+ acceptancePrompt: shared.acceptancePrompt,
5395
5400
  extensionBindings: options.extensionBindings,
5396
5401
  requiredExtensions: options.requiredExtensions,
5397
5402
  sessionEnabled: shared.sessionEnabled,
@@ -5510,6 +5515,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5510
5515
  index: options.index ?? 0,
5511
5516
  agent: agent.name,
5512
5517
  ...childSessionName ? { sessionName: childSessionName } : {},
5518
+ ...options.sessionFile ? { sessionFile: options.sessionFile } : {},
5513
5519
  status: "running",
5514
5520
  task,
5515
5521
  skills: shared.resolvedSkillNames,
@@ -5549,8 +5555,8 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5549
5555
  };
5550
5556
  return result2;
5551
5557
  }
5552
- const mutationCwd = isRexLocalMachine(options.machine) ? options.machine.cwd : options.cwd ?? runtimeCwd;
5553
- const mutationSnapshot = options.machine && !isRexLocalMachine(options.machine) ? { source: "tracked-files", trackedOnly: true, cwd: mutationCwd, dirtyFiles: [], fingerprints: {}, unavailable: "Local Git evidence is not authoritative for a pane-native remote run." } : snapshotTrackedMutations(mutationCwd);
5558
+ const mutationCwd = editsLocalDisk(options.machine) ? options.machine.cwd : options.cwd ?? runtimeCwd;
5559
+ const mutationSnapshot = options.machine && !editsLocalDisk(options.machine) ? remoteMutationSnapshot(mutationCwd) : snapshotTrackedMutations(mutationCwd);
5554
5560
  let structuredOutputToolInvoked = false;
5555
5561
  let structuredOutputMessageStartIndex;
5556
5562
  let toolAvailabilityError;
@@ -6498,8 +6504,7 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
6498
6504
  tokens: progress.tokens,
6499
6505
  durationMs: progress.durationMs
6500
6506
  };
6501
- const remoteGitChanged = result2.nativeMachine?.initialGit && result2.nativeMachine.finalGit ? result2.nativeMachine.initialGit.head !== result2.nativeMachine.finalGit.head || result2.nativeMachine.initialGit.dirty !== result2.nativeMachine.finalGit.dirty : void 0;
6502
- const mutationEvidence = result2.nativeMachine && !isRexLocalMachine(options.machine) ? { source: "tracked-files", trackedOnly: true, changedFiles: [], attemptedMutation: remoteGitChanged === true, ...remoteGitChanged === void 0 ? { unavailable: "Remote Git before/after evidence was incomplete." } : {} } : await collectTrackedMutationEvidence(mutationSnapshot, mutationCwd);
6507
+ const mutationEvidence = result2.nativeMachine && !editsLocalDisk(options.machine) ? remoteMutationEvidence(result2.nativeMachine) : await collectTrackedMutationEvidence(mutationSnapshot, mutationCwd);
6503
6508
  const acceptanceOutput = getFinalOutput(result2.messages ?? []);
6504
6509
  const structuredText = result2.structuredOutput === void 0 ? void 0 : JSON.stringify(result2.structuredOutput, null, 2);
6505
6510
  let fullOutput = stripAcceptanceReport(acceptanceOutput);
@@ -6591,7 +6596,7 @@ function writeStructuredOutputArtifacts(runtime, value, acceptanceReport) {
6591
6596
  }
6592
6597
  async function runSyncCompletionInner(runtimeCwd, agents, agentName, task, options) {
6593
6598
  const effectiveCwd = options.cwd ?? runtimeCwd;
6594
- const cwdError = options.machine && !isRexLocalMachine(options.machine) ? void 0 : preflightLaunchCwd(options.requestedCwd ?? effectiveCwd, effectiveCwd);
6599
+ const cwdError = options.machine && !editsLocalDisk(options.machine) ? void 0 : preflightLaunchCwd(options.requestedCwd ?? effectiveCwd, effectiveCwd);
6595
6600
  if (cwdError) {
6596
6601
  return redactResultPrompt(withRunContext({
6597
6602
  index: options.index ?? 0,
@@ -8925,7 +8930,7 @@ Extensions denied: ${status.capabilityCeiling.denyExtensions ? "yes" : "no"} (so
8925
8930
  status.turnBudget ? `Turn budget: ${status.turnBudget.turnCount}/${status.turnBudget.maxTurns}+${status.turnBudget.graceTurns} (${status.turnBudget.outcome})` : void 0,
8926
8931
  `Dir: ${asyncDir}`,
8927
8932
  outputPath ? `Output: ${outputPath}` : void 0,
8928
- status.parallelHandoff ? `Parallel handoff: ${status.parallelHandoff.path}` : void 0,
8933
+ ...status.parallelHandoff ? formatParallelHandoffLines(status.parallelHandoff.path, status.parallelHandoff.keptBranches) : [],
8929
8934
  reconciliation.message ? `Diagnosis: ${reconciliation.message}` : void 0,
8930
8935
  reconciliation.resultPath && fs17.existsSync(reconciliation.resultPath) ? `Result: ${reconciliation.resultPath}` : void 0
8931
8936
  ].filter((line) => Boolean(line));
@@ -9061,7 +9066,7 @@ Extensions denied: ${status.capabilityCeiling.denyExtensions ? "yes" : "no"} (so
9061
9066
  const status = data.state === "stopped" || data.stopped === true || childStatuses.includes("stopped") ? "stopped" : data.success ? "complete" : data.state === "paused" || data.exitCode === 0 ? "paused" : "failed";
9062
9067
  const runId = data.runId ?? data.id ?? resolvedId;
9063
9068
  const lines = [`Run: ${runId}`, data.toolCallId ? `Tool call: ${data.toolCallId}` : void 0, `State: ${status}`, `Result: ${resultPath}`].filter((line) => Boolean(line));
9064
- if (data.parallelHandoff?.path) lines.push(`Parallel handoff: ${data.parallelHandoff.path}`);
9069
+ if (data.parallelHandoff?.path) lines.push(...formatParallelHandoffLines(data.parallelHandoff.path, data.parallelHandoff.keptBranches));
9065
9070
  const receipt = data.workflowReceipt;
9066
9071
  const receiptPath = receipt && typeof receipt === "object" && !Array.isArray(receipt) ? receipt.path : void 0;
9067
9072
  const workflowReceiptPath2 = typeof receiptPath === "string" && receiptPath ? receiptPath : void 0;
@@ -9649,7 +9654,7 @@ function buildUnknownGitEntry(input) {
9649
9654
  return blockedEntry(entry, "unknown", "unknown", "no matching extension-owned handoff metadata was found");
9650
9655
  }
9651
9656
  function buildMissingMetadataEntry(input) {
9652
- if (input.record.task.worktreeRemoved && input.record.task.branchRemoved) return void 0;
9657
+ if (isWorktreeCleanupTaskDone(input.record.task)) return void 0;
9653
9658
  const pathValue = metadataRecordPath(input.record);
9654
9659
  const entry = buildEntryBase({ path: pathValue, branch: input.record.task.branch, source: "metadata", metadata: input.record, targetHead: input.targetHead });
9655
9660
  return blockedEntry(entry, "stale", "unknown", "handoff metadata records a worktree that is not present in Git worktree state");
@@ -12803,6 +12808,16 @@ function writeWorkflowAggregateOutput(outputPath, text, producedChildOutputPaths
12803
12808
  ${error instanceof Error ? error.message : String(error)}`;
12804
12809
  }
12805
12810
  }
12811
+ function removeEarlierWorkflowOutput(outputPath) {
12812
+ if (!outputPath) return void 0;
12813
+ try {
12814
+ fs20.rmSync(outputPath, { force: true });
12815
+ return void 0;
12816
+ } catch (error) {
12817
+ return `Output file error: ${outputPath}
12818
+ ${error instanceof Error ? error.message : String(error)}`;
12819
+ }
12820
+ }
12806
12821
  function appendWorkflowOutputWarning(text, warning) {
12807
12822
  return warning ? `${text}
12808
12823
 
@@ -14904,6 +14919,7 @@ Parent action: ${STATUS_ACTION}`,
14904
14919
  step.async = runId2 !== void 0 && path18.basename(runId2) === runId2 && fs20.existsSync(path18.join(path18.dirname(asyncDir), runId2));
14905
14920
  persist({ tolerateStatusWriteFailure: true });
14906
14921
  };
14922
+ const earlierOutputWarning2 = workflowReuseSource ? void 0 : removeEarlierWorkflowOutput(workflowAggregateOutputPath2);
14907
14923
  try {
14908
14924
  const workflow = await runWorkflowScript({
14909
14925
  script: workflowScript,
@@ -15212,7 +15228,7 @@ Parent action: ${COMPLETION_ACTION}` : content,
15212
15228
  }
15213
15229
  const errorPreview = status.error && status.error.length > 1e3 ? `${status.error.slice(0, 1e3)}\u2026 (truncated; full error: ${statusPath} (error))` : status.error;
15214
15230
  const terminalSummary = `${status.state === "complete" ? "Workflow completed after detached child finished." : errorPreview ?? (pauseForDetached ? "Workflow paused." : "Workflow failed.")}${stopCause ? ` ${WORKFLOW_RUNTIME_REPLACED_STOP_NOTICE}` : ""}${workflowOutputPathMappingSummary2(partial.children)}${finalPreflightWarnings.length ? ` ${finalPreflightWarnings.join(" ")}` : ""}`;
15215
- const outputWarning = writeWorkflowAggregateOutput(workflowAggregateOutputPath2, terminalSummary, producedChildOutputPaths2);
15231
+ const outputWarning = status.state === "complete" ? writeWorkflowAggregateOutput(workflowAggregateOutputPath2, terminalSummary, producedChildOutputPaths2) : earlierOutputWarning2;
15216
15232
  const resultSummary = appendWorkflowOutputWarning(terminalSummary, outputWarning);
15217
15233
  const receiptState = status.state === "complete" ? "complete" : status.state === "paused" ? "paused" : status.state === "stopped" ? "stopped" : "failed";
15218
15234
  const terminalOutcome = workflowFailureTerminalOutcome(error, partial.children, usageBudgetState(workflowUsageBudget.budget, sumResultsCost(workflowResults2)));
@@ -15288,6 +15304,7 @@ Parent action: ${COMPLETION_ACTION}` : content,
15288
15304
  const liveWorkflowChildren = workflowChildSummary({ parentToolCallId: _id, workflowRunId: foregroundWorkflowRunId, workflowState: "running", inventoryComplete: false, trace: liveWorkflow.trace, progress: childProgress, launches: childLaunches });
15289
15305
  onUpdate?.(workflowProgressUpdate(foregroundWorkflowRunId, chatProgress, liveWorkflow, liveWorkflowChildren, workflowPreflight));
15290
15306
  };
15307
+ const earlierOutputWarning = removeEarlierWorkflowOutput(workflowAggregateOutputPath);
15291
15308
  try {
15292
15309
  const workflow = await runWorkflowScript({
15293
15310
  script: requestParams.workflowScript,
@@ -15369,7 +15386,11 @@ Parent action: ${COMPLETION_ACTION}` : content,
15369
15386
  (deps2.state.blockingWorkflowChildren ??= /* @__PURE__ */ new Set()).add(launch.runId);
15370
15387
  blockingWorkflowChildren.add(launch.runId);
15371
15388
  }
15372
- childLaunches.set(key, { agent: launch.agent, ...launch.runId ? { runId: launch.runId } : {} });
15389
+ childLaunches.set(key, {
15390
+ agent: launch.agent,
15391
+ ...launch.runId ? { runId: launch.runId } : {},
15392
+ ...launch.sessionFile ? { sessionFile: launch.sessionFile } : {}
15393
+ });
15373
15394
  try {
15374
15395
  sendWorkflowProgress();
15375
15396
  } catch (error) {
@@ -15462,7 +15483,7 @@ ${workflow.console.map((entry) => `[${entry.level}] ${entry.text}`).join("\n")}`
15462
15483
  const finalPreflightTrace = annotateWorkflowPreflightTrace(partial.trace, workflowPreflight);
15463
15484
  const trace = finalPreflightTrace.map((entry) => ({ line: `- ${entry.operation} ${entry.key}: ${entry.state}${entry.runId ? ` (${entry.runId})` : ""}${entry.warning ? ` \u2014 ${entry.warning}` : ""}`, error: entry.error }));
15464
15485
  const outputMappings = workflowOutputPathMappingSummary2(partial.children).trim();
15465
- const displayText = formatWorkflowResultText({
15486
+ const displayText = appendWorkflowOutputWarning(formatWorkflowResultText({
15466
15487
  head: workflowPreflight ? [formatWorkflowPreflight(workflowPreflight)] : [],
15467
15488
  script: [
15468
15489
  `Workflow failed: ${text}`,
@@ -15477,10 +15498,11 @@ ${partial.console.map((entry) => `[${entry.level}] ${entry.text}`).join("\n")}`]
15477
15498
  ...outputMappings ? [outputMappings] : []
15478
15499
  ],
15479
15500
  maxOutput: requestParams.maxOutput,
15480
- aggregateOutputPath: workflowAggregateOutputPath,
15501
+ // A failed workflow's text never goes to the declared output file; truncated text goes to the full-result file.
15502
+ aggregateOutputPath: void 0,
15481
15503
  fullResultPath: workflowFullResultPath,
15482
15504
  producedChildOutputPaths
15483
- });
15505
+ }), earlierOutputWarning);
15484
15506
  const workflowChildren = workflowChildSummary({ parentToolCallId: _id, workflowRunId: foregroundWorkflowRunId, workflowState: "failed", inventoryComplete: true, trace: partial.trace, children: partial.children });
15485
15507
  const terminalOutcome = workflowFailureTerminalOutcome(error, partial.children, usageBudgetState(workflowUsageBudget.budget, sumResultsCost(workflowResults)));
15486
15508
  const receipt = terminalWorkflowReceipt(foregroundWorkflowRunId, "failed", partial.children, workflowChildren, terminalOutcome, [...workflowHostSteps.values()], workflowResource?.provenance, workflowArgsDigest);
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-7J4ZXMY7.js";
4
4
  import {
5
5
  getProjectSubagentsDir
6
- } from "./chunk-YDZ7BZD5.js";
6
+ } from "./chunk-77VQEATI.js";
7
7
  import {
8
8
  getPiSpawnCommand,
9
9
  writeAtomicJson
10
- } from "./chunk-4MVDMA5C.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-YDZ7BZD5.js";
3
+ } from "./chunk-77VQEATI.js";
4
4
  import {
5
5
  discoverAgents,
6
6
  formatUnknownAgentError,
7
7
  resolveAgentName,
8
8
  unknownAgentDiagnosticContext
9
- } from "./chunk-4MVDMA5C.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-4MVDMA5C.js";
10
+ } from "./chunk-LWH7IGI3.js";
11
11
  import {
12
12
  TEMP_ROOT_DIR
13
13
  } from "./chunk-JEZOSEWG.js";