@vicary/pi-subagents 0.87.0 → 0.88.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 (91) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-3CVOAS77.js → chunk-2DIEL4WG.js} +2 -2
  5. package/bundle/{chunk-PGU4TZV3.js → chunk-3DT5X2QC.js} +406 -447
  6. package/bundle/{chunk-SIAQXPJ4.js → chunk-3MFYKBKI.js} +18 -6
  7. package/bundle/{chunk-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
  8. package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
  9. package/bundle/{chunk-HDICKROY.js → chunk-6EUQPQY7.js} +31 -14
  10. package/bundle/{chunk-M2VBGET6.js → chunk-6PR44R7E.js} +7 -2
  11. package/bundle/{chunk-75LVXBSA.js → chunk-AOSILI5R.js} +45 -15
  12. package/bundle/{chunk-PUSTU4Q7.js → chunk-BW5JLKIU.js} +118 -42
  13. package/bundle/{chunk-OOE3R7IQ.js → chunk-CKLZ5FGU.js} +2 -2
  14. package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
  15. package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
  16. package/bundle/{chunk-2D2DQGC2.js → chunk-IZEKQEY4.js} +9 -9
  17. package/bundle/{chunk-O7A26O6B.js → chunk-JYHTDTOZ.js} +6 -4
  18. package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
  19. package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
  20. package/bundle/{chunk-NJTSXIMG.js → chunk-NVGQE2H2.js} +11 -11
  21. package/bundle/{chunk-YEXKJJVS.js → chunk-PJSOS2Q4.js} +4 -4
  22. package/bundle/{chunk-2NY5PCKQ.js → chunk-RHYVKQQL.js} +4 -4
  23. package/bundle/{chunk-XV7RTWTS.js → chunk-SVIXQDIV.js} +20 -5
  24. package/bundle/{chunk-Z4TR7MK6.js → chunk-TDJKY2NE.js} +14 -5
  25. package/bundle/{chunk-HTI7DD5D.js → chunk-V7SZMS6W.js} +2 -2
  26. package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
  27. package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
  28. package/bundle/{chunk-NMYBVCGP.js → chunk-XZXYPZUT.js} +42 -29
  29. package/bundle/chunk-YDZ7BZD5.js +523 -0
  30. package/bundle/{chunk-LZKVUWIY.js → chunk-YZPVALSQ.js} +30 -5
  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 +1 -1
  37. package/docs/configuration.md +4 -2
  38. package/docs/observability.md +2 -0
  39. package/docs/tool-reference.md +4 -1
  40. package/package.json +3 -3
  41. package/skills/pi-subagents/SKILL.md +8 -2
  42. package/src/agents/agent-management.d.ts +1 -0
  43. package/src/agents/agent-management.js +12 -4
  44. package/src/agents/agents.d.ts +1 -0
  45. package/src/agents/agents.js +2 -2
  46. package/src/extension/config.d.ts +9 -0
  47. package/src/extension/config.js +13 -0
  48. package/src/extension/index.js +4 -3
  49. package/src/extension/schemas.d.ts +2 -0
  50. package/src/extension/schemas.js +1 -0
  51. package/src/extension/tool-activation.js +20 -3
  52. package/src/runs/background/async-resume.js +2 -1
  53. package/src/runs/background/async-retention.d.ts +0 -2
  54. package/src/runs/background/async-retention.js +11 -5
  55. package/src/runs/background/async-status.d.ts +2 -0
  56. package/src/runs/background/async-status.js +4 -0
  57. package/src/runs/background/run-child-session.d.ts +2 -2
  58. package/src/runs/background/run-child-session.js +4 -7
  59. package/src/runs/background/steering.d.ts +2 -11
  60. package/src/runs/background/steering.js +11 -6
  61. package/src/runs/background/subagent-runner.d.ts +0 -2
  62. package/src/runs/background/subagent-runner.js +73 -58
  63. package/src/runs/foreground/async-steering-action.js +24 -9
  64. package/src/runs/foreground/execution.js +32 -15
  65. package/src/runs/foreground/prompt-audit.js +1 -0
  66. package/src/runs/foreground/subagent-executor.d.ts +1 -8
  67. package/src/runs/foreground/subagent-executor.js +6 -15
  68. package/src/runs/shared/async-status-projection.d.ts +2 -0
  69. package/src/runs/shared/async-status-projection.js +10 -0
  70. package/src/runs/shared/child-session.js +21 -3
  71. package/src/runs/shared/mcp-config-sources.d.ts +2 -0
  72. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -2
  73. package/src/runs/shared/mcp-direct-tool-allowlist.js +21 -11
  74. package/src/runs/shared/subagent-prompt-runtime.js +14 -2
  75. package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
  76. package/src/runs/shared/supervisor-wait-timer.js +61 -0
  77. package/src/shared/artifacts.d.ts +1 -0
  78. package/src/shared/artifacts.js +107 -9
  79. package/src/shared/reported-progress.d.ts +1 -0
  80. package/src/shared/reported-progress.js +12 -0
  81. package/src/shared/status-format.d.ts +1 -0
  82. package/src/shared/status-format.js +1 -1
  83. package/src/shared/types.d.ts +9 -0
  84. package/src/shared/utils.d.ts +3 -1
  85. package/src/shared/utils.js +4 -0
  86. package/src/tui/render.js +33 -2
  87. package/src/watchdog/permission-arbiter.js +1 -0
  88. package/src/watchdog/review.d.ts +0 -5
  89. package/src/watchdog/review.js +2 -1
  90. package/src/workflows/workflow-script-worker.js +3 -1
  91. package/bundle/chunk-XSDYTXHF.js +0 -242
@@ -3,7 +3,7 @@ import {
3
3
  projectRuntimeAcknowledgedExtensions,
4
4
  registerSubagentPromptBoundary,
5
5
  registerSubagentPromptRuntime
6
- } from "./chunk-Z4TR7MK6.js";
6
+ } from "./chunk-TDJKY2NE.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-HDICKROY.js";
28
+ } from "./chunk-6EUQPQY7.js";
29
29
  import {
30
30
  PLACED_RESTORE_UNSUPPORTED,
31
31
  formatHerdrMachineRunnerUnsupported,
32
32
  resolveMachinePlacement
33
- } from "./chunk-6O7YH2QV.js";
33
+ } from "./chunk-GDR2ILWY.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-75LVXBSA.js";
122
+ } from "./chunk-AOSILI5R.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-O7A26O6B.js";
135
+ } from "./chunk-JYHTDTOZ.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-2NY5PCKQ.js";
148
+ } from "./chunk-RHYVKQQL.js";
149
149
  import {
150
150
  RunFanoutLimitError,
151
151
  annotateWorkflowPreflightTrace,
@@ -206,12 +206,12 @@ import {
206
206
  writeRunFanoutBudgetDescriptor,
207
207
  writeWorkflowLaunchRecord,
208
208
  writeWorktreeSetupHandoff
209
- } from "./chunk-XV7RTWTS.js";
209
+ } from "./chunk-SVIXQDIV.js";
210
210
  import {
211
211
  NATIVE_SUPERVISOR_TOOL_NAME,
212
212
  createNativeSupervisorChannel,
213
213
  resolveSupervisorChannelDir
214
- } from "./chunk-W52LJANO.js";
214
+ } from "./chunk-CYKNHFXB.js";
215
215
  import {
216
216
  MODEL_ONLY_TOOL,
217
217
  inheritedSessionIds,
@@ -234,10 +234,10 @@ import {
234
234
  canPreferFork,
235
235
  createForkContextResolver,
236
236
  resolveSubagentLaunchContext
237
- } from "./chunk-HTI7DD5D.js";
237
+ } from "./chunk-V7SZMS6W.js";
238
238
  import {
239
239
  handleRefinementAction
240
- } from "./chunk-USRX7QXD.js";
240
+ } from "./chunk-XIA5GSEU.js";
241
241
  import {
242
242
  ActiveAsyncCapacityError,
243
243
  acquireActiveAsyncCapacity,
@@ -249,10 +249,11 @@ import {
249
249
  loadConfig,
250
250
  resolveAbandonedSlotReleaseAfterMs,
251
251
  resolveAsyncByDefault,
252
+ resolveConfigDefaultTimeoutMs,
252
253
  resolveDisabledFeatureSurface,
253
254
  resolveMaxActiveAsyncRunsPerSession,
254
255
  transferActiveAsyncCapacity
255
- } from "./chunk-M2VBGET6.js";
256
+ } from "./chunk-6PR44R7E.js";
256
257
  import {
257
258
  DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS,
258
259
  MACHINE_DIFF_OPTIONS,
@@ -338,7 +339,7 @@ import {
338
339
  writeNestedControlRequest,
339
340
  writeNestedControlResult,
340
341
  writeNestedEvent
341
- } from "./chunk-PGU4TZV3.js";
342
+ } from "./chunk-3DT5X2QC.js";
342
343
  import {
343
344
  closeSteerInbox,
344
345
  consumeSteerRequests,
@@ -346,7 +347,7 @@ import {
346
347
  readRevivalBriefs,
347
348
  requestAsyncSteer,
348
349
  watchAsyncControlInbox
349
- } from "./chunk-VFUFOZBU.js";
350
+ } from "./chunk-W6HIYD2Z.js";
350
351
  import "./chunk-NIXWDZZV.js";
351
352
  import {
352
353
  INTERCOM_BRIDGE_MARKER,
@@ -355,7 +356,7 @@ import {
355
356
  resolveIntercomBridge,
356
357
  resolveIntercomSessionTarget,
357
358
  resolveSubagentIntercomTarget
358
- } from "./chunk-ESWW6XSX.js";
359
+ } from "./chunk-47ZN7NKR.js";
359
360
  import {
360
361
  agentDefinitionDigest,
361
362
  resolveLaunchBinding,
@@ -370,7 +371,7 @@ import {
370
371
  resolvePiLaunchToolPlan,
371
372
  resolveRuntimeModulePath,
372
373
  supervisorChannelDir
373
- } from "./chunk-SIAQXPJ4.js";
374
+ } from "./chunk-3MFYKBKI.js";
374
375
  import {
375
376
  assertRequiredChildExtensionsAdmitted,
376
377
  hasMandatoryRequiredChildExtensions,
@@ -381,7 +382,7 @@ import {
381
382
  import {
382
383
  HERDR_PROJECT_PANE_ACTIONS,
383
384
  handleHerdrProjectPaneAction
384
- } from "./chunk-3CVOAS77.js";
385
+ } from "./chunk-2DIEL4WG.js";
385
386
  import "./chunk-7J4ZXMY7.js";
386
387
  import {
387
388
  PROJECT_SUBAGENTS_RELATIVE_DIR,
@@ -392,14 +393,15 @@ import {
392
393
  getArtifactsDir,
393
394
  getProjectArtifactPackagingWarning,
394
395
  getProjectSubagentsDir,
396
+ missingForkCopyNote,
395
397
  writeArtifact,
396
398
  writeMetadata
397
- } from "./chunk-XSDYTXHF.js";
399
+ } from "./chunk-YDZ7BZD5.js";
398
400
  import "./chunk-XA3DY6UG.js";
399
401
  import {
400
402
  getExternalJobProvider
401
403
  } from "./chunk-YYREO77V.js";
402
- import "./chunk-C5QWQSSM.js";
404
+ import "./chunk-KXW62VBU.js";
403
405
  import {
404
406
  ChainOutputValidationError,
405
407
  DEFAULT_WAIT_TOOL_NAME,
@@ -414,6 +416,7 @@ import {
414
416
  SUBAGENT_STOPPED_MESSAGE,
415
417
  SUBAGENT_TIMED_OUT_MESSAGE,
416
418
  THINKING_LEVELS,
419
+ TRUNCATED_RESPONSE_ERROR,
417
420
  TYPED_VERIFY_OUTPUT_SCHEMA_CONFLICT,
418
421
  acceptChildWatchdogEvent,
419
422
  acceptanceFailureMessage,
@@ -467,6 +470,7 @@ import {
467
470
  getFinalOutput,
468
471
  getSingleResultOutput,
469
472
  getStepAgents,
473
+ getTerminalAssistantStopReason,
470
474
  hasEmptyTerminalAssistantResponse,
471
475
  hasSingleAdjacentTransposition,
472
476
  hasSingleOutputChangedSinceSnapshot,
@@ -551,7 +555,7 @@ import {
551
555
  writeAtomicJson,
552
556
  writeInitialProgressFile,
553
557
  writePrivateAtomicJson
554
- } from "./chunk-C3KWLXDH.js";
558
+ } from "./chunk-4MVDMA5C.js";
555
559
  import {
556
560
  CHAIN_RUNS_DIR,
557
561
  DEFAULT_ARTIFACT_CONFIG,
@@ -582,7 +586,8 @@ import {
582
586
  wrapForkTask
583
587
  } from "./chunk-JEZOSEWG.js";
584
588
  import {
585
- safeTerminalText
589
+ safeTerminalText,
590
+ sanitizeDisplayText
586
591
  } from "./chunk-YFCK7H2S.js";
587
592
  import "./chunk-62OCY2S4.js";
588
593
  import {
@@ -4128,6 +4133,17 @@ function createChildTranscriptWriter(input) {
4128
4133
  };
4129
4134
  }
4130
4135
 
4136
+ // src/shared/reported-progress.ts
4137
+ var MAX_REPORTED_PROGRESS_LENGTH = 512;
4138
+ function extractReportedProgress(toolName, args) {
4139
+ if (toolName !== "contact_supervisor" || typeof args !== "object" || args === null) return void 0;
4140
+ const call = args;
4141
+ if (call.reason !== "progress_update" || typeof call.message !== "string") return void 0;
4142
+ const firstLine = call.message.split(/\r?\n/, 1)[0] ?? "";
4143
+ const sanitized = sanitizeDisplayText(firstLine).replace(/^(?:progress|update):\s*/i, "");
4144
+ return sanitized ? sanitized.slice(0, MAX_REPORTED_PROGRESS_LENGTH) : void 0;
4145
+ }
4146
+
4131
4147
  // src/runs/shared/partial-output.ts
4132
4148
  function isAssistant(message) {
4133
4149
  return !!message && typeof message === "object" && message.role === "assistant";
@@ -5123,6 +5139,59 @@ function reconcileAttemptUsage(live, messages, baseline) {
5123
5139
  return reconciled;
5124
5140
  }
5125
5141
 
5142
+ // src/runs/shared/supervisor-wait-timer.ts
5143
+ function isBlockingSupervisorTool(toolName, args) {
5144
+ if (!args || typeof args !== "object") return false;
5145
+ const call = args;
5146
+ if (toolName === "contact_supervisor") return call.reason === "need_decision" || call.reason === "interview_request";
5147
+ return toolName === "intercom" && call.action === "ask";
5148
+ }
5149
+ function startPausableTimer(delayMs, onFire) {
5150
+ let remaining = Math.max(0, delayMs);
5151
+ let runningSince;
5152
+ let timer;
5153
+ let done = false;
5154
+ const pausedBy = /* @__PURE__ */ new Set();
5155
+ const remainingMs = () => runningSince === void 0 ? remaining : Math.max(0, remaining - (performance.now() - runningSince));
5156
+ const run = () => {
5157
+ runningSince = performance.now();
5158
+ timer = setTimeout(() => {
5159
+ done = true;
5160
+ runningSince = void 0;
5161
+ remaining = 0;
5162
+ onFire();
5163
+ }, remaining);
5164
+ timer.unref?.();
5165
+ };
5166
+ const stop = () => {
5167
+ clearTimeout(timer);
5168
+ remaining = remainingMs();
5169
+ runningSince = void 0;
5170
+ };
5171
+ run();
5172
+ return {
5173
+ pause(key) {
5174
+ if (done) return;
5175
+ if (pausedBy.size === 0) stop();
5176
+ pausedBy.add(key);
5177
+ },
5178
+ resume(key) {
5179
+ if (done || !pausedBy.delete(key) || pausedBy.size > 0) return;
5180
+ run();
5181
+ },
5182
+ remainingMs,
5183
+ clear() {
5184
+ done = true;
5185
+ stop();
5186
+ }
5187
+ };
5188
+ }
5189
+ function pauseForSupervisorWait(timer, event) {
5190
+ if (!timer || typeof event.toolCallId !== "string") return;
5191
+ if (event.type === "tool_execution_start" && isBlockingSupervisorTool(event.toolName, event.args)) timer.pause(event.toolCallId);
5192
+ else if (event.type === "tool_execution_end") timer.resume(event.toolCallId);
5193
+ }
5194
+
5126
5195
  // src/runs/foreground/execution.ts
5127
5196
  var artifactOutputByResult = /* @__PURE__ */ new WeakMap();
5128
5197
  var acceptanceOutputByResult = /* @__PURE__ */ new WeakMap();
@@ -5271,6 +5340,8 @@ function captureStructuredDelegationProgressState(progress, result2) {
5271
5340
  recentOutput: [...progress.recentOutput],
5272
5341
  recentTools: progress.recentTools.slice(-MAX_STREAMED_RECENT_TOOLS).map(({ tool, args }) => ({ tool, args })),
5273
5342
  activityState: progress.activityState,
5343
+ progressText: progress.progressText,
5344
+ progressUpdatedAt: progress.progressUpdatedAt,
5274
5345
  model: progress.model ?? result2.model,
5275
5346
  toolCount: progress.toolCount,
5276
5347
  tokens: progress.tokens,
@@ -5278,7 +5349,7 @@ function captureStructuredDelegationProgressState(progress, result2) {
5278
5349
  };
5279
5350
  }
5280
5351
  function structuredDelegationProgressChanged(previous, progress, result2) {
5281
- if (previous.providerDiagnostics !== progress.providerDiagnostics || previous.currentTool !== progress.currentTool || previous.currentToolArgs !== progress.currentToolArgs || previous.activityState !== progress.activityState || previous.model !== (progress.model ?? result2.model) || previous.toolCount !== progress.toolCount || previous.tokens !== progress.tokens || previous.turnCount !== progress.turnCount || previous.recentOutput.length !== progress.recentOutput.length) return true;
5352
+ if (previous.providerDiagnostics !== progress.providerDiagnostics || previous.currentTool !== progress.currentTool || previous.currentToolArgs !== progress.currentToolArgs || previous.activityState !== progress.activityState || previous.progressText !== progress.progressText || previous.progressUpdatedAt !== progress.progressUpdatedAt || previous.model !== (progress.model ?? result2.model) || previous.toolCount !== progress.toolCount || previous.tokens !== progress.tokens || previous.turnCount !== progress.turnCount || previous.recentOutput.length !== progress.recentOutput.length) return true;
5282
5353
  for (let index = 0; index < progress.recentOutput.length; index++) {
5283
5354
  if (previous.recentOutput[index] !== progress.recentOutput[index]) return true;
5284
5355
  }
@@ -5296,6 +5367,7 @@ function isCompleteUsageCounter(value) {
5296
5367
  }
5297
5368
  var STOPPED_BEFORE_COMPLETION_ERROR = "Subagent stopped before completion.";
5298
5369
  var AFTER_COMPACTION_SETTLEMENT = /* @__PURE__ */ Symbol("afterCompactionSettlement");
5370
+ var REMAINING_TIMEOUT_MS = /* @__PURE__ */ Symbol("remainingTimeoutMs");
5299
5371
  async function runSingleAttempt(runtimeCwd, agent, task, model, options, shared) {
5300
5372
  const effectiveThinking = options.thinkingOverride ?? agent.thinking;
5301
5373
  const modelArg = applyThinkingSuffix(model, effectiveThinking, options.thinkingOverride !== void 0);
@@ -5481,6 +5553,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5481
5553
  let toolAvailabilityError;
5482
5554
  let abortedBySignal = options.signal?.aborted === true;
5483
5555
  let afterCompactionSettlement = false;
5556
+ let remainingTimeoutMs;
5484
5557
  if (options.workflowChildPermitLaunch) {
5485
5558
  const permitError = consumeWorkflowChildPermit(options.workflowChildPermitLaunch.permit, {
5486
5559
  workflowRunId: options.workflowChildPermitLaunch.workflowRunId,
@@ -5522,7 +5595,8 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5522
5595
  let timeoutHardFinishTimer;
5523
5596
  const clearTimeoutTimers = () => {
5524
5597
  if (timeoutTimer) {
5525
- clearTimeout(timeoutTimer);
5598
+ remainingTimeoutMs = timeoutTimer.remainingMs();
5599
+ timeoutTimer.clear();
5526
5600
  timeoutTimer = void 0;
5527
5601
  }
5528
5602
  if (timeoutHardFinishTimer) {
@@ -5980,6 +6054,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5980
6054
  progress.durationMs = now - startTime;
5981
6055
  progress.lastActivityAt = now;
5982
6056
  updateActivityState(now);
6057
+ pauseForSupervisorWait(timeoutTimer, evt);
5983
6058
  if (evt.type === "tool_execution_start") {
5984
6059
  const toolArgs = evt.args && typeof evt.args === "object" && !Array.isArray(evt.args) ? evt.args : {};
5985
6060
  const activeTool = evt.toolName !== void 0 ? recordActiveToolCall(evt, toolArgs, now) : void 0;
@@ -5996,7 +6071,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
5996
6071
  result2.toolBudget = toolBudgetState(options.toolBudget, progress.toolCount, result2.toolBudget?.blockedTool);
5997
6072
  }
5998
6073
  const mutates = isMutatingTool(evt.toolName, toolArgs, agent.mutationTools);
5999
- pendingToolResult = { tool: evt.toolName ?? "tool", path: activeTool?.path, mutates, startedAt: now };
6074
+ pendingToolResult = { tool: evt.toolName ?? "tool", path: activeTool?.path, mutates, startedAt: now, progressText: extractReportedProgress(evt.toolName ?? "", evt.args) };
6000
6075
  if (typeof evt.toolCallId === "string" && evt.toolCallId) pendingToolResultsByCallId.set(evt.toolCallId, pendingToolResult);
6001
6076
  fireUpdate();
6002
6077
  }
@@ -6086,6 +6161,10 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6086
6161
  );
6087
6162
  }
6088
6163
  appendRecentOutput(progress, resultText.split("\n").slice(-10));
6164
+ if (evt.message.isError !== true && resultToolName === toolSnapshot?.tool && toolSnapshot?.progressText) {
6165
+ progress.progressText = toolSnapshot.progressText;
6166
+ progress.progressUpdatedAt = now;
6167
+ }
6089
6168
  if (toolSnapshot?.mutates && !budgetBlocked && didMutatingToolFail(evt.message)) {
6090
6169
  recordMutatingFailure(mutatingFailures, {
6091
6170
  tool: toolSnapshot.tool,
@@ -6124,7 +6203,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6124
6203
  activityTimer.unref?.();
6125
6204
  }
6126
6205
  if (attemptTimeout) {
6127
- timeoutTimer = setTimeout(() => {
6206
+ timeoutTimer = startPausableTimer(attemptTimeout.remainingMs, () => {
6128
6207
  if (sessionSettled || lifecycleFinished || interruptedByControl || result2.timedOut) return;
6129
6208
  result2.timedOut = true;
6130
6209
  timeoutCause = attemptTimeout.message;
@@ -6141,8 +6220,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6141
6220
  settle(void 0, true);
6142
6221
  }, 4e3);
6143
6222
  timeoutHardFinishTimer.unref?.();
6144
- }, attemptTimeout.remainingMs);
6145
- timeoutTimer.unref?.();
6223
+ });
6146
6224
  }
6147
6225
  let toolTimeoutSequence = 0;
6148
6226
  const activeToolTimeouts = /* @__PURE__ */ new Map();
@@ -6170,7 +6248,7 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6170
6248
  };
6171
6249
  const terminateForToolTimeout = (message) => {
6172
6250
  if (sessionSettled || lifecycleFinished || interruptedByControl || result2.timedOut) return;
6173
- clearTimeout(timeoutTimer);
6251
+ timeoutTimer?.clear();
6174
6252
  result2.timedOut = true;
6175
6253
  timeoutCause = message;
6176
6254
  result2.error = message;
@@ -6189,9 +6267,6 @@ ${shared.acceptancePrompt}` : shared.systemPrompt,
6189
6267
  const armToolTimeout = (event) => {
6190
6268
  const timeoutForTool = effectiveToolTimeoutMs(event.toolName, options.toolTimeoutMs);
6191
6269
  if (timeoutForTool === void 0) return;
6192
- const elapsed = Date.now() - startTime;
6193
- const runRemaining = attemptTimeout ? Math.max(0, attemptTimeout.remainingMs - elapsed) : void 0;
6194
- if (runRemaining !== void 0 && timeoutForTool >= runRemaining) return;
6195
6270
  const key = toolTimeoutCallKey(event, ++toolTimeoutSequence);
6196
6271
  const toolName = event.toolName;
6197
6272
  const timer = setTimeout(() => {
@@ -6309,12 +6384,12 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
6309
6384
  const steer = created.steer.bind(created);
6310
6385
  const followUp = created.followUp.bind(created);
6311
6386
  created.steer = async (text) => {
6387
+ await steer(text);
6312
6388
  if (cleanTerminalAssistantStopReceived || agentSettledReceived) queuedDrainHold = true;
6313
- return steer(text);
6314
6389
  };
6315
6390
  created.followUp = async (text) => {
6391
+ await followUp(text);
6316
6392
  if (cleanTerminalAssistantStopReceived || agentSettledReceived) queuedDrainHold = true;
6317
- return followUp(text);
6318
6393
  };
6319
6394
  created.detached = detached;
6320
6395
  unsubscribe = created.subscribe((event) => processEvent(event));
@@ -6345,9 +6420,8 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
6345
6420
  result2.exitCode = exitCode;
6346
6421
  result2.providerDiagnostics = clearProviderRetry(result2.providerDiagnostics);
6347
6422
  progress.providerDiagnostics = result2.providerDiagnostics;
6348
- if (afterCompactionSettlement) {
6349
- result2[AFTER_COMPACTION_SETTLEMENT] = true;
6350
- }
6423
+ if (afterCompactionSettlement) result2[AFTER_COMPACTION_SETTLEMENT] = true;
6424
+ result2[REMAINING_TIMEOUT_MS] = remainingTimeoutMs;
6351
6425
  if (interruptedByControl) {
6352
6426
  result2.exitCode = 0;
6353
6427
  result2.interrupted = true;
@@ -6402,6 +6476,9 @@ ${formatInheritedProviderDiagnostic({ agent: agent.name, model: launch.session.m
6402
6476
  } else if (errInfo.hasError) {
6403
6477
  result2.exitCode = errInfo.exitCode ?? 1;
6404
6478
  result2.error = errInfo.details ? `${errInfo.errorType} failed (exit ${errInfo.exitCode}): ${errInfo.details}` : `${errInfo.errorType} failed with exit code ${errInfo.exitCode}`;
6479
+ } else if (!validatedStructuredOutput && getTerminalAssistantStopReason(messages) === "length") {
6480
+ result2.exitCode = 1;
6481
+ result2.error = TRUNCATED_RESPONSE_ERROR;
6405
6482
  }
6406
6483
  }
6407
6484
  progress.status = result2.exitCode === 0 ? "completed" : "failed";
@@ -6803,6 +6880,8 @@ ${PROMPT_REDACTED}; live Prompt Audit only.
6803
6880
  });
6804
6881
  if (recovery.action === "resume") {
6805
6882
  recoveryPrompt = recovery.prompt;
6883
+ const remainingMs = attemptResult[REMAINING_TIMEOUT_MS];
6884
+ if (remainingMs !== void 0) attemptOptions.deadlineAt = Date.now() + remainingMs;
6806
6885
  attemptNotes.push("[abort-recovery] compaction abort after useful progress; resuming the retained child session once on the same model.");
6807
6886
  continue;
6808
6887
  }
@@ -10339,7 +10418,7 @@ function resolveForegroundResumeTarget(params, state, options = {}) {
10339
10418
  if (!child.sessionFile) throw new Error(`Foreground run '${run.runId}' child ${index} does not have a persisted session file to resume from.`);
10340
10419
  if (path18.extname(child.sessionFile) !== ".jsonl") throw new Error(`Foreground run '${run.runId}' child ${index} session file must be a .jsonl file: ${child.sessionFile}`);
10341
10420
  const sessionFile = path18.resolve(child.sessionFile);
10342
- if (!fs20.existsSync(sessionFile)) throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}`);
10421
+ if (!fs20.existsSync(sessionFile)) throw new Error(`Foreground run '${run.runId}' child ${index} session file does not exist: ${child.sessionFile}${missingForkCopyNote(sessionFile)}`);
10343
10422
  return {
10344
10423
  runId: run.runId,
10345
10424
  mode: run.mode,
@@ -10781,7 +10860,7 @@ function validateNestedSessionFile(run, trustedSessionRoots2, resolveSource, vis
10781
10860
  if (path18.extname(sessionFile) !== ".jsonl") throw new Error(`Nested run '${run.id}' session file must be a .jsonl file: ${sessionFile}`);
10782
10861
  const resolved = path18.resolve(sessionFile);
10783
10862
  if (!path18.isAbsolute(sessionFile)) throw new Error(`Nested run '${run.id}' session file must be absolute: ${sessionFile}`);
10784
- if (!fs20.existsSync(resolved)) throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}`);
10863
+ if (!fs20.existsSync(resolved)) throw new Error(`Nested run '${run.id}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
10785
10864
  const stat = fs20.lstatSync(resolved);
10786
10865
  if (!stat.isFile() || stat.isSymbolicLink()) throw new Error(`Nested run '${run.id}' session file is not a regular file: ${sessionFile}`);
10787
10866
  const realSessionFile = fs20.realpathSync(resolved);
@@ -12099,10 +12178,6 @@ var MAX_TIMER_DELAY_MS = 2147483647;
12099
12178
  function timerDelayOverflowError(name, value) {
12100
12179
  return typeof value === "number" && value > MAX_TIMER_DELAY_MS ? `${name} must be a positive integer no larger than ${MAX_TIMER_DELAY_MS}.` : void 0;
12101
12180
  }
12102
- function resolveConfigDefaultTimeoutMs(raw) {
12103
- if (typeof raw !== "number" || !Number.isInteger(raw) || raw <= 0 || raw > MAX_TIMER_DELAY_MS) return void 0;
12104
- return raw;
12105
- }
12106
12181
  function resolveForegroundTimeout(params, defaultTimeoutMs) {
12107
12182
  const rawTimeout = params.timeoutMs;
12108
12183
  const rawMaxRuntime = params.maxRuntimeMs;
@@ -15016,6 +15091,8 @@ Parent action: ${COMPLETION_ACTION}` : content,
15016
15091
  step2.currentToolArgs = progress.currentToolArgs;
15017
15092
  step2.currentToolStartedAt = progress.currentToolStartedAt;
15018
15093
  step2.currentPath = progress.currentPath;
15094
+ step2.progressText = progress.progressText;
15095
+ step2.progressUpdatedAt = progress.progressUpdatedAt;
15019
15096
  step2.recentTools = progress.recentTools.map((tool) => ({ ...tool }));
15020
15097
  step2.recentOutput = [...progress.recentOutput];
15021
15098
  step2.turnCount = progress.turnCount;
@@ -16804,7 +16881,6 @@ export {
16804
16881
  promptAuditRedoParams,
16805
16882
  readNestedRecoveryDescriptor,
16806
16883
  removeForegroundControlIfIdle,
16807
- resolveConfigDefaultTimeoutMs,
16808
16884
  resolveForegroundTimeout,
16809
16885
  resolveRevivalControlConfig,
16810
16886
  resolveSingleAgentLaunchTimeout,
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.87.0",
4
+ version: "0.88.0",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",
@@ -108,7 +108,7 @@ var package_default = {
108
108
  "@js-temporal/polyfill": "0.5.1",
109
109
  acorn: "8.18.0",
110
110
  jiti: "2.7.0",
111
- undici: "8.12.3",
111
+ undici: "8.12.4",
112
112
  yaml: "2.8.3"
113
113
  },
114
114
  devDependencies: {
@@ -11,7 +11,7 @@ import {
11
11
  readStatus,
12
12
  writeAtomicJson,
13
13
  writePrivateAtomicJson
14
- } from "./chunk-C3KWLXDH.js";
14
+ } from "./chunk-4MVDMA5C.js";
15
15
  import {
16
16
  ASYNC_DIR,
17
17
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -4,7 +4,7 @@ import {
4
4
  getAgentDir,
5
5
  getProjectConfigDir,
6
6
  resolveRexLocalPlacement
7
- } from "./chunk-C3KWLXDH.js";
7
+ } from "./chunk-4MVDMA5C.js";
8
8
 
9
9
  // src/runs/shared/herdr-machine.ts
10
10
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -7,37 +7,37 @@ import {
7
7
  safeTranscriptEvent,
8
8
  steerAsyncRun,
9
9
  steerWorkflowForegroundTarget
10
- } from "./chunk-HDICKROY.js";
10
+ } from "./chunk-6EUQPQY7.js";
11
11
  import {
12
12
  FLEET_STATUS_WIDGET_KEY,
13
13
  runningTone,
14
14
  stepTaskSummary
15
- } from "./chunk-LZKVUWIY.js";
15
+ } from "./chunk-YZPVALSQ.js";
16
16
  import {
17
17
  foregroundChildStateLabel,
18
18
  formatAsyncRunTranscript,
19
19
  stopAsyncRun
20
- } from "./chunk-2NY5PCKQ.js";
20
+ } from "./chunk-RHYVKQQL.js";
21
21
  import {
22
22
  contextModeBadge,
23
23
  contextModeLabel,
24
24
  decodeUtf8Tail,
25
25
  listAsyncRuns
26
- } from "./chunk-XV7RTWTS.js";
26
+ } from "./chunk-SVIXQDIV.js";
27
27
  import {
28
28
  reportSessionWarning
29
29
  } from "./chunk-HXRB42AF.js";
30
- import "./chunk-PGU4TZV3.js";
31
- import "./chunk-VFUFOZBU.js";
30
+ import "./chunk-3DT5X2QC.js";
31
+ import "./chunk-W6HIYD2Z.js";
32
32
  import "./chunk-NIXWDZZV.js";
33
- import "./chunk-ESWW6XSX.js";
33
+ import "./chunk-47ZN7NKR.js";
34
34
  import "./chunk-7F6RKT6W.js";
35
35
  import "./chunk-CTPAE36Y.js";
36
36
  import "./chunk-7J4ZXMY7.js";
37
37
  import {
38
38
  getArtifactPaths,
39
39
  getArtifactsDir
40
- } from "./chunk-XSDYTXHF.js";
40
+ } from "./chunk-YDZ7BZD5.js";
41
41
  import {
42
42
  snapshotExternalRuns
43
43
  } from "./chunk-UKG4V45O.js";
@@ -49,7 +49,7 @@ import {
49
49
  formatTokens,
50
50
  readStatus,
51
51
  shortenPath
52
- } from "./chunk-C3KWLXDH.js";
52
+ } from "./chunk-4MVDMA5C.js";
53
53
  import {
54
54
  DIRS
55
55
  } from "./chunk-JEZOSEWG.js";
@@ -8,7 +8,7 @@ import {
8
8
  projectTimeoutRecovery,
9
9
  readAsyncRecoveryDescriptor,
10
10
  utf8Tail
11
- } from "./chunk-XV7RTWTS.js";
11
+ } from "./chunk-SVIXQDIV.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-PGU4TZV3.js";
24
+ } from "./chunk-3DT5X2QC.js";
25
25
  import {
26
26
  PROJECT_SUBAGENTS_RELATIVE_DIR
27
- } from "./chunk-XSDYTXHF.js";
27
+ } from "./chunk-YDZ7BZD5.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-C3KWLXDH.js";
53
+ } from "./chunk-4MVDMA5C.js";
54
54
  import {
55
55
  DIRS,
56
56
  INTERCOM_DETACH_REQUEST_EVENT,
@@ -820,6 +820,7 @@ var SubagentParamProperties = {
820
820
  description: 'Management/control only; omit for execution. validate accepts workflow: true or a script path. Discover actions with {action:"guide",options:{topic:"tool-reference"}}.'
821
821
  })),
822
822
  capabilities: Type2.Optional(Type2.Boolean({ description: "list: compact capability rows/details without system prompts." })),
823
+ search: Type2.Optional(Type2.String({ minLength: 1, description: "list: case-insensitive match on agent name, alias, or description." })),
823
824
  name: Type2.Optional(Type2.String({ description: "schedule.create name." })),
824
825
  id: Type2.Optional(Type2.String({
825
826
  description: "Run id/prefix for status/control."
@@ -4401,6 +4402,7 @@ async function runWatchdogAttempt(ctx, request, options) {
4401
4402
  hasDiff: diffBaseline !== void 0
4402
4403
  });
4403
4404
  const agent2 = new Agent({
4405
+ sessionId,
4404
4406
  initialState: {
4405
4407
  systemPrompt,
4406
4408
  model: selection.model,
@@ -8,7 +8,7 @@ import {
8
8
  validateCodeOwnedProfileRunner,
9
9
  validatePermissionRules,
10
10
  validateToolBudgetConfig
11
- } from "./chunk-C3KWLXDH.js";
11
+ } from "./chunk-4MVDMA5C.js";
12
12
 
13
13
  // src/agents/runtime-agent-registry.ts
14
14
  var RUNTIME_AGENT_REGISTRY_KEY = "pi-subagents.runtime-agents.v1";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  registerRuntimeAgent
3
- } from "./chunk-C5QWQSSM.js";
3
+ } from "./chunk-KXW62VBU.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,32 +1,32 @@
1
1
  import {
2
2
  rewriteSubagentPrompt
3
- } from "./chunk-Z4TR7MK6.js";
3
+ } from "./chunk-TDJKY2NE.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-OOE3R7IQ.js";
6
+ } from "./chunk-CKLZ5FGU.js";
7
7
  import {
8
8
  WATCHDOG_DIFF_TOOL_NAME,
9
9
  captureWatchdogDiffBaseline,
10
10
  createWatchdogDiffTool
11
- } from "./chunk-O7A26O6B.js";
12
- import "./chunk-XV7RTWTS.js";
13
- import "./chunk-W52LJANO.js";
11
+ } from "./chunk-JYHTDTOZ.js";
12
+ import "./chunk-SVIXQDIV.js";
13
+ import "./chunk-CYKNHFXB.js";
14
14
  import {
15
15
  MODEL_ONLY_TOOL
16
16
  } from "./chunk-HXRB42AF.js";
17
17
  import "./chunk-W2BZS6UC.js";
18
18
  import {
19
19
  appendAgentRefinementOverlay
20
- } from "./chunk-USRX7QXD.js";
21
- import "./chunk-PGU4TZV3.js";
20
+ } from "./chunk-XIA5GSEU.js";
21
+ import "./chunk-3DT5X2QC.js";
22
22
  import "./chunk-NIXWDZZV.js";
23
- import "./chunk-ESWW6XSX.js";
23
+ import "./chunk-47ZN7NKR.js";
24
24
  import "./chunk-7F6RKT6W.js";
25
25
  import {
26
26
  assertNoToolModifierEntries
27
- } from "./chunk-SIAQXPJ4.js";
27
+ } from "./chunk-3MFYKBKI.js";
28
28
  import "./chunk-CTPAE36Y.js";
29
- import "./chunk-XSDYTXHF.js";
29
+ import "./chunk-YDZ7BZD5.js";
30
30
  import {
31
31
  HERDR_PI_MAX_FRAME_BYTES,
32
32
  HERDR_PI_PROTOCOL,
@@ -43,7 +43,7 @@ import {
43
43
  discoverAgents,
44
44
  resolveExistingReadPaths,
45
45
  resolveSkills
46
- } from "./chunk-C3KWLXDH.js";
46
+ } from "./chunk-4MVDMA5C.js";
47
47
  import "./chunk-JEZOSEWG.js";
48
48
  import "./chunk-YFCK7H2S.js";
49
49
  import "./chunk-QXASAHIA.js";