@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
@@ -4,13 +4,13 @@ import {
4
4
  remoteShellCommand,
5
5
  runBoundedCommand,
6
6
  sshMachineAccess
7
- } from "./chunk-6O7YH2QV.js";
7
+ } from "./chunk-GDR2ILWY.js";
8
8
  import {
9
9
  package_default
10
- } from "./chunk-OOE3R7IQ.js";
10
+ } from "./chunk-CKLZ5FGU.js";
11
11
  import {
12
12
  ensureSupervisorChannelDir
13
- } from "./chunk-W52LJANO.js";
13
+ } from "./chunk-CYKNHFXB.js";
14
14
  import "./chunk-HXRB42AF.js";
15
15
  import "./chunk-NIXWDZZV.js";
16
16
  import {
@@ -34,7 +34,7 @@ import {
34
34
  resolveRexBinary,
35
35
  rexCommandEnv,
36
36
  rexGlobalArgs
37
- } from "./chunk-C3KWLXDH.js";
37
+ } from "./chunk-4MVDMA5C.js";
38
38
  import "./chunk-JEZOSEWG.js";
39
39
  import "./chunk-YFCK7H2S.js";
40
40
  import "./chunk-QXASAHIA.js";
@@ -12,7 +12,7 @@ import {
12
12
  summarizeContextModes,
13
13
  utf8Tail,
14
14
  workflowPreflightLaneForRuntimeKey
15
- } from "./chunk-XV7RTWTS.js";
15
+ } from "./chunk-SVIXQDIV.js";
16
16
  import {
17
17
  ownsRun
18
18
  } from "./chunk-HXRB42AF.js";
@@ -34,11 +34,11 @@ import {
34
34
  updateActiveRunIndex,
35
35
  validateModelResponseAliases,
36
36
  writeAsyncResultFile
37
- } from "./chunk-PGU4TZV3.js";
37
+ } from "./chunk-3DT5X2QC.js";
38
38
  import {
39
39
  deliverStopRequest,
40
40
  stopInboxClosedPath
41
- } from "./chunk-VFUFOZBU.js";
41
+ } from "./chunk-W6HIYD2Z.js";
42
42
  import {
43
43
  SUBAGENT_STOPPED_MESSAGE,
44
44
  formatDuration,
@@ -50,7 +50,7 @@ import {
50
50
  waitToolName,
51
51
  writeAtomicJson,
52
52
  writePrivateAtomicJson
53
- } from "./chunk-C3KWLXDH.js";
53
+ } from "./chunk-4MVDMA5C.js";
54
54
  import {
55
55
  DIRS
56
56
  } from "./chunk-JEZOSEWG.js";
@@ -46,16 +46,19 @@ import {
46
46
  validateModelResponseAliases,
47
47
  withWorkflowChildRunModel,
48
48
  withWorktreeTransaction
49
- } from "./chunk-PGU4TZV3.js";
49
+ } from "./chunk-3DT5X2QC.js";
50
50
  import {
51
51
  validateIntercomBridgeConfig
52
- } from "./chunk-ESWW6XSX.js";
52
+ } from "./chunk-47ZN7NKR.js";
53
53
  import {
54
54
  stableJsonDigest
55
55
  } from "./chunk-7F6RKT6W.js";
56
56
  import {
57
57
  snapshotRequiredChildExtensions
58
58
  } from "./chunk-CTPAE36Y.js";
59
+ import {
60
+ missingForkCopyNote
61
+ } from "./chunk-YDZ7BZD5.js";
59
62
  import {
60
63
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
61
64
  assertWorkflowLaneKey,
@@ -80,7 +83,7 @@ import {
80
83
  validateToolBudgetConfig,
81
84
  waitForFileSystemRetry,
82
85
  writeAtomicJson
83
- } from "./chunk-C3KWLXDH.js";
86
+ } from "./chunk-4MVDMA5C.js";
84
87
  import {
85
88
  DIRS,
86
89
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -1241,6 +1244,8 @@ function projectStep(step, index, depth, ctx) {
1241
1244
  const activity = activityFor(step, ctx);
1242
1245
  const { id, label } = stepIdentity(step, index, ctx);
1243
1246
  const agent = publicOptionalText(step.agent, ctx.caps.maxStringLength);
1247
+ const progressText = publicOptionalText(step.progressText, ctx.caps.maxStringLength);
1248
+ const progressUpdatedAt = publicTime(step.progressUpdatedAt);
1244
1249
  const node = {
1245
1250
  id,
1246
1251
  kind: "step",
@@ -1249,7 +1254,9 @@ function projectStep(step, index, depth, ctx) {
1249
1254
  ...startedAt !== void 0 ? { startedAt } : {},
1250
1255
  ...updatedAt !== void 0 ? { updatedAt } : {},
1251
1256
  ...terminalState(state) && endedAt !== void 0 ? { endedAt } : {},
1252
- ...activity ? { activity } : {}
1257
+ ...activity ? { activity } : {},
1258
+ ...progressText ? { progressText } : {},
1259
+ ...progressUpdatedAt !== void 0 ? { progressUpdatedAt } : {}
1253
1260
  };
1254
1261
  if (agent) node.agent = agent;
1255
1262
  setStepModel(node, ctx, step);
@@ -1392,6 +1399,10 @@ function projectMaterializedStep(step, index, child, depth, ctx, childrenByParen
1392
1399
  const selfActivity = selfStep ? activityFor(selfStep, ctx) : void 0;
1393
1400
  const activity = laneActivity || selfActivity || live.activity ? { ...laneActivity, ...selfActivity, ...live.activity } : void 0;
1394
1401
  const node = { ...live, id, kind: "step", label };
1402
+ const progressText = publicOptionalText(selfStep?.progressText ?? step.progressText, ctx.caps.maxStringLength);
1403
+ const progressUpdatedAt = publicTime(selfStep?.progressUpdatedAt ?? step.progressUpdatedAt);
1404
+ if (progressText) node.progressText = progressText;
1405
+ if (progressUpdatedAt !== void 0) node.progressUpdatedAt = progressUpdatedAt;
1395
1406
  const agent = publicOptionalText(selfStep?.agent || step.agent, ctx.caps.maxStringLength);
1396
1407
  if (agent) node.agent = agent;
1397
1408
  if (activity) node.activity = activity;
@@ -2291,6 +2302,8 @@ function statusToSummary(asyncDir, status, nestedWarnings = [], nestedRoute) {
2291
2302
  ...step.currentPath ? { currentPath: step.currentPath } : {},
2292
2303
  ...step.recentTools ? { recentTools: step.recentTools.map((tool) => ({ ...tool })) } : {},
2293
2304
  ...step.recentOutput ? { recentOutput: [...step.recentOutput] } : {},
2305
+ ...step.progressText ? { progressText: step.progressText } : {},
2306
+ ...step.progressUpdatedAt !== void 0 ? { progressUpdatedAt: step.progressUpdatedAt } : {},
2294
2307
  ...step.turnCount !== void 0 ? { turnCount: step.turnCount } : {},
2295
2308
  ...step.toolCount !== void 0 ? { toolCount: step.toolCount } : {},
2296
2309
  ...step.steering ? { steering: step.steering } : {},
@@ -2556,6 +2569,7 @@ function formatStepLine(step) {
2556
2569
  const modelThinking = formatModelThinking(step.model, step.thinking);
2557
2570
  if (modelThinking) parts.push(modelThinking);
2558
2571
  if (step.durationMs !== void 0) parts.push(formatDuration(step.durationMs));
2572
+ if (step.progressText && step.status === "running") parts.push(`progress: ${step.progressText}`);
2559
2573
  if (step.tokens) parts.push(`${formatTokens(step.tokens.total)} tok`);
2560
2574
  if (step.lane) parts.push(`lane ${step.lane.key}`);
2561
2575
  if (step.worktreePath) parts.push(`worktree ${shortenPath(step.worktreePath)} \xB7 branch ${step.branch ?? "unknown"}${step.provider ? ` \xB7 provider ${step.provider}` : ""}`);
@@ -3883,7 +3897,7 @@ function launchedWorktreeCwdWithoutHandoff(runId, launchCwd, launched) {
3883
3897
  function validateResumeSessionFile(runId, sessionFile) {
3884
3898
  if (path8.extname(sessionFile) !== ".jsonl") throw new Error(`Async run '${runId}' session file must be a .jsonl file: ${sessionFile}`);
3885
3899
  const resolved = path8.resolve(sessionFile);
3886
- if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}`);
3900
+ if (!fs7.existsSync(resolved)) throw new Error(`Async run '${runId}' session file does not exist: ${sessionFile}${missingForkCopyNote(resolved)}`);
3887
3901
  return resolved;
3888
3902
  }
3889
3903
  function validateResumeCwd(runId, cwd) {
@@ -4109,6 +4123,7 @@ function opencodeSessionHeaders(model, sessionId) {
4109
4123
  export {
4110
4124
  agentStreamOptions,
4111
4125
  opencodeSessionHeaders,
4126
+ formatActivityAge,
4112
4127
  formatActivityLabel,
4113
4128
  aggregateStepStatus,
4114
4129
  formatAgentRunningLabel,
@@ -14,20 +14,20 @@ import {
14
14
  resolveCurrentSessionId,
15
15
  resolveWatchdogReviewModel,
16
16
  startWatchdogDiffBaselineCapture
17
- } from "./chunk-O7A26O6B.js";
17
+ } from "./chunk-JYHTDTOZ.js";
18
18
  import {
19
19
  agentStreamOptions,
20
20
  opencodeSessionHeaders
21
- } from "./chunk-XV7RTWTS.js";
21
+ } from "./chunk-SVIXQDIV.js";
22
22
  import {
23
23
  registerNativeSupervisorClient
24
- } from "./chunk-W52LJANO.js";
24
+ } from "./chunk-CYKNHFXB.js";
25
25
  import {
26
26
  MODEL_ONLY_TOOL
27
27
  } from "./chunk-HXRB42AF.js";
28
28
  import {
29
29
  inheritedNestedRouteOf
30
- } from "./chunk-PGU4TZV3.js";
30
+ } from "./chunk-3DT5X2QC.js";
31
31
  import {
32
32
  CHILD_WATCHDOG_STATUS_EVENT,
33
33
  DEFAULT_WAIT_TOOL_NAME,
@@ -46,7 +46,7 @@ import {
46
46
  toolBudgetSoftNudge,
47
47
  validateAcceptanceReport,
48
48
  validateStructuredOutputValue
49
- } from "./chunk-C3KWLXDH.js";
49
+ } from "./chunk-4MVDMA5C.js";
50
50
  import {
51
51
  INTERCOM_SESSION_IDENTITY_EVENT
52
52
  } from "./chunk-JEZOSEWG.js";
@@ -295,6 +295,7 @@ function createWatchdogPermissionArbiter(options = {}) {
295
295
  ].join("\n");
296
296
  const tools = [tool];
297
297
  agent = new Agent({
298
+ sessionId,
298
299
  initialState: {
299
300
  systemPrompt,
300
301
  model: selection.model,
@@ -584,6 +585,11 @@ function modelBefore(messages, forkedAt) {
584
585
  return void 0;
585
586
  }
586
587
  var LOADOUT_SECTIONS = /* @__PURE__ */ new Set(["tools", "rules", "docs", "skills", "advertised_subagents", "mcp_servers", "project_context"]);
588
+ function projectInstructionBlocks(section) {
589
+ const blocks = /* @__PURE__ */ new Map();
590
+ for (const match of (section ?? "").matchAll(/<project_instructions\s+path=(["'])(.*?)\1\s*>[\s\S]*?<\/project_instructions>/gi)) blocks.set(match[2], match[0]);
591
+ return blocks;
592
+ }
587
593
  function forkInstructions(input) {
588
594
  const parent = getCurrentSystemMessage(input.parent);
589
595
  const child = getCurrentSystemMessage(input.child);
@@ -596,6 +602,9 @@ function forkInstructions(input) {
596
602
  for (const [name, value] of Object.entries(child?.sections ?? {})) {
597
603
  if (!LOADOUT_SECTIONS.has(name) && value && parent?.sections?.[name] !== value) parts.push(value);
598
604
  }
605
+ const parentFiles = projectInstructionBlocks(parent?.sections?.project_context);
606
+ const missingFiles = [...projectInstructionBlocks(child?.sections?.project_context)].filter(([filePath]) => !parentFiles.has(filePath)).map(([, block]) => block);
607
+ if (missingFiles.length > 0) parts.push(["Project instructions for your working folder, which the parent's prompt does not include:", ...missingFiles].join("\n\n"));
599
608
  if (input.boundary) parts.push(input.boundary);
600
609
  return `<subagent_instructions>
601
610
  ${parts.join("\n\n")}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  appendAgentRefinementOverlay
3
- } from "./chunk-USRX7QXD.js";
3
+ } from "./chunk-XIA5GSEU.js";
4
4
  import {
5
5
  buildAgentMemoryInjection,
6
6
  buildSkillInjection
7
- } from "./chunk-C3KWLXDH.js";
7
+ } from "./chunk-4MVDMA5C.js";
8
8
 
9
9
  // src/runs/shared/effective-system-prompt.ts
10
10
  function appendSection(prompt, section) {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  resolveWatchPath,
6
6
  writeAtomicJson
7
- } from "./chunk-C3KWLXDH.js";
7
+ } from "./chunk-4MVDMA5C.js";
8
8
  import {
9
9
  POLL_INTERVAL_MS
10
10
  } from "./chunk-JEZOSEWG.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getProjectSubagentsDir
3
- } from "./chunk-XSDYTXHF.js";
3
+ } from "./chunk-YDZ7BZD5.js";
4
4
  import {
5
5
  discoverAgents,
6
6
  formatUnknownAgentError,
7
7
  resolveAgentName,
8
8
  unknownAgentDiagnosticContext
9
- } from "./chunk-C3KWLXDH.js";
9
+ } from "./chunk-4MVDMA5C.js";
10
10
 
11
11
  // src/agents/agent-refinements.ts
12
12
  import { createHash, randomUUID } from "node:crypto";
@@ -10,10 +10,10 @@ import {
10
10
  setInlineWorkflowCoverage,
11
11
  setMainThinkingLevelSource,
12
12
  widgetRenderKey
13
- } from "./chunk-LZKVUWIY.js";
13
+ } from "./chunk-YZPVALSQ.js";
14
14
  import {
15
15
  package_default
16
- } from "./chunk-OOE3R7IQ.js";
16
+ } from "./chunk-CKLZ5FGU.js";
17
17
  import {
18
18
  EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
19
19
  REVIVAL_ORIGIN_FILE,
@@ -62,7 +62,7 @@ import {
62
62
  snapshotProviderDiagnostics,
63
63
  workflowResumeClaimState,
64
64
  workflowResumeRefusal
65
- } from "./chunk-75LVXBSA.js";
65
+ } from "./chunk-AOSILI5R.js";
66
66
  import {
67
67
  SUBAGENT_CHILD_ENV,
68
68
  SUBAGENT_PARENT_SESSION_ENV,
@@ -82,14 +82,14 @@ import {
82
82
  resolvePiSessionId,
83
83
  resolveWaitToolConfig,
84
84
  setDeclarationPinning
85
- } from "./chunk-O7A26O6B.js";
85
+ } from "./chunk-JYHTDTOZ.js";
86
86
  import {
87
87
  deliverAsyncRunStop,
88
88
  ownerConfirmedDead,
89
89
  readSessionMessagesTail,
90
90
  resolveSubagentRunId,
91
91
  restoreForegroundRunHistory
92
- } from "./chunk-2NY5PCKQ.js";
92
+ } from "./chunk-RHYVKQQL.js";
93
93
  import {
94
94
  ASYNC_STATUS_SNAPSHOT_KIND,
95
95
  ASYNC_STATUS_SNAPSHOT_VERSION,
@@ -105,7 +105,7 @@ import {
105
105
  resolveAsyncStatusChild,
106
106
  runLaunchDir,
107
107
  stopStoppableAsyncStatusChildren
108
- } from "./chunk-XV7RTWTS.js";
108
+ } from "./chunk-SVIXQDIV.js";
109
109
  import {
110
110
  CONTACT_SUPERVISOR_TOOL_NAME,
111
111
  NATIVE_SUPERVISOR_TOOL_NAME,
@@ -115,7 +115,7 @@ import {
115
115
  parseSupervisorReplyData,
116
116
  parseSupervisorRequestDetails,
117
117
  topLevelSupervisorTool
118
- } from "./chunk-W52LJANO.js";
118
+ } from "./chunk-CYKNHFXB.js";
119
119
  import {
120
120
  MODEL_ONLY_TOOL,
121
121
  canRenderComponents,
@@ -137,10 +137,11 @@ import {
137
137
  loadConfig,
138
138
  resolveAbandonedSlotReleaseAfterMs,
139
139
  resolveAsyncByDefault,
140
+ resolveConfigDefaultTimeoutMs,
140
141
  resolveDisabledFeatureSurface,
141
142
  resolveMaxActiveAsyncRunsPerSession,
142
143
  resolveScheduledStoreRoot
143
- } from "./chunk-M2VBGET6.js";
144
+ } from "./chunk-6PR44R7E.js";
144
145
  import {
145
146
  ACTIVE_RUN_INDEX_DIR,
146
147
  MissionNotFoundError,
@@ -191,28 +192,28 @@ import {
191
192
  withWorkflowChildRunModel,
192
193
  writeAsyncResultFile,
193
194
  writeResultIndexForData
194
- } from "./chunk-PGU4TZV3.js";
195
- import "./chunk-VFUFOZBU.js";
195
+ } from "./chunk-3DT5X2QC.js";
196
+ import "./chunk-W6HIYD2Z.js";
196
197
  import {
197
198
  shouldUseNativeFsWatch
198
199
  } from "./chunk-NIXWDZZV.js";
199
200
  import {
200
201
  validateIntercomBridgeConfig
201
- } from "./chunk-ESWW6XSX.js";
202
+ } from "./chunk-47ZN7NKR.js";
202
203
  import "./chunk-7F6RKT6W.js";
203
- import "./chunk-SIAQXPJ4.js";
204
+ import "./chunk-3MFYKBKI.js";
204
205
  import "./chunk-CTPAE36Y.js";
205
206
  import {
206
207
  listHerdrProjectPaneRoots,
207
208
  restoreHerdrProjectPaneSnapshots
208
- } from "./chunk-3CVOAS77.js";
209
+ } from "./chunk-2DIEL4WG.js";
209
210
  import "./chunk-7J4ZXMY7.js";
210
211
  import {
211
212
  cleanupAllArtifactDirs,
212
213
  cleanupOldArtifacts,
213
214
  getArtifactPaths,
214
215
  getArtifactsDir
215
- } from "./chunk-XSDYTXHF.js";
216
+ } from "./chunk-YDZ7BZD5.js";
216
217
  import {
217
218
  listBackgroundWorkProviders
218
219
  } from "./chunk-XA3DY6UG.js";
@@ -220,12 +221,12 @@ import "./chunk-YYREO77V.js";
220
221
  import "./chunk-UKG4V45O.js";
221
222
  import {
222
223
  registerRuntimeAgentEventListener
223
- } from "./chunk-BFF6YDK6.js";
224
+ } from "./chunk-L4YY2TOE.js";
224
225
  import {
225
226
  clearRuntimeAgentsForPi,
226
227
  listRuntimeAgentConfigs,
227
228
  mergeRuntimeAgents
228
- } from "./chunk-C5QWQSSM.js";
229
+ } from "./chunk-KXW62VBU.js";
229
230
  import {
230
231
  DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
231
232
  DEFAULT_WAIT_TOOL_NAME,
@@ -268,7 +269,7 @@ import {
268
269
  waitToolName,
269
270
  withSettingsFileLease,
270
271
  writeAtomicJson
271
- } from "./chunk-C3KWLXDH.js";
272
+ } from "./chunk-4MVDMA5C.js";
272
273
  import {
273
274
  DEFAULT_ARTIFACT_CONFIG,
274
275
  DIRS,
@@ -1570,9 +1571,13 @@ async function computeProcessStartIdentity(pid) {
1570
1571
  }
1571
1572
  if (process.platform === "win32") {
1572
1573
  const started = await new Promise((resolve6) => {
1573
- execFile2("powershell.exe", ["-NoProfile", "-Command", `(Get-CimInstance Win32_Process -Filter "ProcessId=${pid}").CreationDate`], { encoding: "utf-8", windowsHide: true, timeout: 5e3 }, (error, stdout) => {
1574
- resolve6(error ? "" : stdout.trim());
1575
- });
1574
+ try {
1575
+ execFile2("powershell.exe", ["-NoProfile", "-Command", `(Get-CimInstance Win32_Process -Filter "ProcessId=${pid}").CreationDate`], { encoding: "utf-8", windowsHide: true, timeout: 5e3 }, (error, stdout) => {
1576
+ resolve6(error ? "" : stdout.trim());
1577
+ });
1578
+ } catch {
1579
+ resolve6("");
1580
+ }
1576
1581
  });
1577
1582
  return started ? `win:${started}` : void 0;
1578
1583
  }
@@ -5360,7 +5365,7 @@ function registerSlashCommands(pi, state, options = {}) {
5360
5365
  }
5361
5366
  fleetOpen = true;
5362
5367
  try {
5363
- const { openSubagentFleet } = await import("./chunk-2D2DQGC2.js");
5368
+ const { openSubagentFleet } = await import("./chunk-IZEKQEY4.js");
5364
5369
  await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
5365
5370
  } finally {
5366
5371
  fleetOpen = false;
@@ -8079,12 +8084,20 @@ ${advertised}` : ""}` }],
8079
8084
  };
8080
8085
  registerPinnedTool(pi, loader);
8081
8086
  let loaderSelected = true;
8087
+ let undeclared;
8088
+ const activationState = () => [LOADER_NAME, SUBAGENT_NAME].map((name) => pi.getActiveTools().includes(name)).join();
8082
8089
  const replyOwed = () => options.hasPendingSupervisorRequest?.() === true;
8083
- pi.on("session_start", (_event, ctx) => {
8090
+ const decide = (ctx) => {
8084
8091
  loaderSelected = applyRecordedSelection(pi, ctx, mode, replyOwed());
8092
+ undeclared = Array.isArray(pi.getActiveTools()) ? activationState() : void 0;
8093
+ };
8094
+ pi.on("session_start", (_event, ctx) => decide(ctx));
8095
+ pi.on("session_tree", (_event, ctx) => decide(ctx));
8096
+ pi.on("agent_start", () => {
8097
+ undeclared = void 0;
8085
8098
  });
8086
- pi.on("session_tree", (_event, ctx) => {
8087
- loaderSelected = applyRecordedSelection(pi, ctx, mode, replyOwed());
8099
+ pi.on("model_select", (_event, ctx) => {
8100
+ if (mode === "auto" && ctx.isIdle() && undeclared === activationState() && loaderSelected !== addsToolsWithoutCheckpoint(ctx.model) && ctx.sessionManager.buildSessionContext().messages.length === 0) decide(ctx);
8088
8101
  });
8089
8102
  pi.on("before_agent_start", (event) => {
8090
8103
  const available = pi.getAllTools();
@@ -8765,7 +8778,7 @@ function registerSubagentExtension(pi) {
8765
8778
  const ctx = withLastUiContext((current) => current);
8766
8779
  if (!ctx) return;
8767
8780
  try {
8768
- const { openSubagentFleet } = await import("./chunk-2D2DQGC2.js");
8781
+ const { openSubagentFleet } = await import("./chunk-IZEKQEY4.js");
8769
8782
  await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi) });
8770
8783
  } catch (error) {
8771
8784
  if (isStaleExtensionContextError(error)) {
@@ -8938,7 +8951,7 @@ function registerSubagentExtension(pi) {
8938
8951
  ])
8939
8952
  });
8940
8953
  } catch (error) {
8941
- console.error("Failed to clean retained async subagent state:", error);
8954
+ reportSessionWarning(state, `Failed to clean retained async subagent state: ${error instanceof Error ? error.message : String(error)}`, "async-retention-cleanup");
8942
8955
  }
8943
8956
  }, ASYNC_RETENTION_DELAY_MS);
8944
8957
  asyncRetentionTimer.unref?.();
@@ -8974,7 +8987,7 @@ function registerSubagentExtension(pi) {
8974
8987
  let executor;
8975
8988
  let executorPromise;
8976
8989
  let executorModulePromise;
8977
- const loadExecutorModule = () => executorModulePromise ??= import("./chunk-PUSTU4Q7.js");
8990
+ const loadExecutorModule = () => executorModulePromise ??= import("./chunk-BW5JLKIU.js");
8978
8991
  const getExecutor = () => {
8979
8992
  executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
8980
8993
  executor = createSubagentExecutor(executorDeps);
@@ -8988,7 +9001,7 @@ function registerSubagentExtension(pi) {
8988
9001
  modulePreloadTimer = setTimeout(() => {
8989
9002
  loadExecutorModule().catch(() => {
8990
9003
  });
8991
- if (fleetViewEnabled) import("./chunk-2D2DQGC2.js").catch(() => {
9004
+ if (fleetViewEnabled) import("./chunk-IZEKQEY4.js").catch(() => {
8992
9005
  });
8993
9006
  }, MODULE_PRELOAD_DELAY_MS);
8994
9007
  modulePreloadTimer.unref?.();
@@ -9166,7 +9179,7 @@ ${close}` }]
9166
9179
  const active = activeAsyncJobCount();
9167
9180
  if (active > 0) ctx.ui.notify(`${active} background subagent run${active === 1 ? " is" : "s are"} still active${slashCommandsEnabled ? " \xB7 /subagents-stop" : ""}`, "info");
9168
9181
  }
9169
- if (!ctx.hasUI) await drainOutstandingWork({ state, events: pi.events, hasPendingSupervisorRequest: supervisorChannel.hasPendingRequests }).then(resultWatcher.deliverPendingResults);
9182
+ if (!ctx.hasUI) await drainOutstandingWork({ state, events: pi.events, hasPendingSupervisorRequest: supervisorChannel.hasPendingRequests, timeoutMs: resolveConfigDefaultTimeoutMs(config.timeoutMs) }).then(resultWatcher.deliverPendingResults);
9170
9183
  } finally {
9171
9184
  const ownerSessionId = state.currentSessionId;
9172
9185
  if (ownerSessionId) {