pi-subagents 0.83.0 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +39 -2
  2. package/bundle/agents.js +4 -4
  3. package/bundle/capability-ceiling.js +1 -1
  4. package/bundle/child-tool-plan.js +3 -3
  5. package/bundle/{chunk-HJJAVHFB.js → chunk-235AWJUQ.js} +35 -32
  6. package/bundle/{chunk-P2NCCTZP.js → chunk-2D52JFLF.js} +1 -1
  7. package/bundle/{chunk-WG2OTTAK.js → chunk-2DHZTCOL.js} +2 -2
  8. package/bundle/{chunk-MBDOYZ2V.js → chunk-2S4K53MV.js} +1 -1
  9. package/bundle/{chunk-527E3D2J.js → chunk-4E7BKDTX.js} +5 -5
  10. package/bundle/{chunk-CZTMUBUI.js → chunk-7BWGNDNK.js} +4 -4
  11. package/bundle/{chunk-HXVKGS33.js → chunk-AKOIVLA5.js} +4 -4
  12. package/bundle/{chunk-MHX22USZ.js → chunk-C5P5CHYK.js} +1 -1
  13. package/bundle/{chunk-5ESXK62X.js → chunk-CGN2TVE7.js} +417 -389
  14. package/bundle/{chunk-VTMNBPCQ.js → chunk-D3JAFGMO.js} +1 -1
  15. package/bundle/{chunk-CDI3GMNV.js → chunk-DZDETGRJ.js} +18 -15
  16. package/bundle/{chunk-BKFWQ642.js → chunk-F4ASL6OV.js} +1 -1
  17. package/bundle/{chunk-JHZ6DZ5M.js → chunk-G2Z6ZH26.js} +1 -1
  18. package/bundle/{chunk-XXKG3P2W.js → chunk-J5YL7LYR.js} +4 -4
  19. package/bundle/{chunk-LDMXJIA6.js → chunk-JG4QKI5M.js} +58 -67
  20. package/bundle/{chunk-OOFW75PV.js → chunk-L3WFKBEI.js} +15 -11
  21. package/bundle/{chunk-Y3I6H6DV.js → chunk-LFDBD4PW.js} +2 -2
  22. package/bundle/{chunk-7F5SK2U3.js → chunk-LNRJCP2Y.js} +17 -14
  23. package/bundle/{chunk-4BW55BTL.js → chunk-NENDSQUY.js} +4 -4
  24. package/bundle/{chunk-6B4ITO2W.js → chunk-NKQ6JNAS.js} +1 -1
  25. package/bundle/{chunk-RZJN63GU.js → chunk-PALJGGYC.js} +2 -2
  26. package/bundle/{chunk-TJQJ3MEA.js → chunk-PV63UFUR.js} +10 -10
  27. package/bundle/{chunk-Z7KVHQHL.js → chunk-QXASAHIA.js} +2 -2
  28. package/bundle/{chunk-HLE22FSH.js → chunk-SSG7IEP5.js} +2 -2
  29. package/bundle/{chunk-CSSZRTKY.js → chunk-V2BZYLEP.js} +2 -2
  30. package/bundle/{chunk-CNLDYEH4.js → chunk-VQVVHSY6.js} +11 -11
  31. package/bundle/{chunk-CGXWSNPA.js → chunk-XDQORLZ5.js} +4 -4
  32. package/bundle/control-channel.js +3 -3
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +3 -3
  35. package/bundle/preflight.js +9 -9
  36. package/bundle/project-panes.js +4 -4
  37. package/docs/configuration.md +12 -1
  38. package/docs/extension-api.md +2 -0
  39. package/docs/missions.md +2 -0
  40. package/docs/tool-reference.md +1 -1
  41. package/package.json +1 -1
  42. package/src/agents/agent-management.d.ts +1 -1
  43. package/src/agents/agent-management.js +2 -2
  44. package/src/agents/agents.js +1 -2
  45. package/src/agents/frontmatter.js +22 -18
  46. package/src/extension/index.js +2 -2
  47. package/src/missions/actions.js +7 -2
  48. package/src/missions/lifecycle.d.ts +11 -0
  49. package/src/missions/lifecycle.js +37 -6
  50. package/src/missions/store.js +1 -0
  51. package/src/missions/types.d.ts +2 -0
  52. package/src/runs/background/async-execution.d.ts +4 -1
  53. package/src/runs/background/async-execution.js +18 -3
  54. package/src/runs/background/async-resume.js +3 -2
  55. package/src/runs/background/async-retention.d.ts +1 -0
  56. package/src/runs/background/async-retention.js +16 -10
  57. package/src/runs/background/retained-children.js +1 -1
  58. package/src/runs/background/run-child-session.d.ts +2 -0
  59. package/src/runs/background/run-child-session.js +9 -1
  60. package/src/runs/background/subagent-runner.js +1 -0
  61. package/src/runs/foreground/subagent-executor.js +29 -51
  62. package/src/runs/shared/capability-ceiling.d.ts +2 -1
  63. package/src/runs/shared/capability-ceiling.js +3 -2
  64. package/src/runs/shared/child-session.d.ts +2 -0
  65. package/src/runs/shared/child-session.js +1 -0
  66. package/src/runs/shared/model-resolution-diagnostic.d.ts +11 -0
  67. package/src/runs/shared/model-resolution-diagnostic.js +25 -0
  68. package/src/runs/shared/parallel-handoff.d.ts +1 -1
  69. package/src/runs/shared/parallel-handoff.js +10 -6
  70. package/src/runs/shared/parallel-utils.d.ts +2 -0
  71. package/src/shared/types.d.ts +1 -1
  72. package/src/workflows/scripted-workflow.js +6 -1
  73. package/workflow-script-worker.cjs +450 -175
@@ -39,10 +39,10 @@ import {
39
39
  validateModelResponseAliases,
40
40
  withWorkflowChildRunModel,
41
41
  withWorktreeTransaction
42
- } from "./chunk-5ESXK62X.js";
42
+ } from "./chunk-CGN2TVE7.js";
43
43
  import {
44
44
  validateIntercomBridgeConfig
45
- } from "./chunk-MHX22USZ.js";
45
+ } from "./chunk-C5P5CHYK.js";
46
46
  import {
47
47
  stableJsonDigest
48
48
  } from "./chunk-7F6RKT6W.js";
@@ -73,7 +73,7 @@ import {
73
73
  validateToolBudgetConfig,
74
74
  waitForFileSystemRetry,
75
75
  writeAtomicJson
76
- } from "./chunk-7F5SK2U3.js";
76
+ } from "./chunk-LNRJCP2Y.js";
77
77
  import {
78
78
  DIRS,
79
79
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -88,7 +88,7 @@ import {
88
88
  intersectSubagentCapabilityCeilings,
89
89
  normalizeCapabilityCeilingAllowedAgents,
90
90
  parseSubagentCapabilityCeiling
91
- } from "./chunk-Z7KVHQHL.js";
91
+ } from "./chunk-QXASAHIA.js";
92
92
 
93
93
  // src/shared/session-succession.ts
94
94
  var SUCCESSION_KEY = /* @__PURE__ */ Symbol.for("pi-subagents.session-succession");
@@ -2850,18 +2850,21 @@ async function protectRetainedWorktreeForResume(manifestPath, runId, childIndex,
2850
2850
  return cwd;
2851
2851
  }), { signal }));
2852
2852
  }
2853
- function resolveRetainedWorktreeCwd(manifestPath, runId, childIndex) {
2853
+ function resolveRetainedWorktreeCwd(manifestPath, runId, childIndex, recordedWorktreePath) {
2854
2854
  const manifest = readParallelHandoffManifest(manifestPath);
2855
- if (!manifest) return void 0;
2856
- if (manifest.runId !== runId) throw new Error(`Managed worktree handoff belongs to run '${manifest.runId}', not '${runId}'.`);
2857
- const match = manifest.groups.flatMap((group) => group.children.map((child) => ({ group, child }))).find(({ child }) => child.index === childIndex);
2858
- if (!match) return void 0;
2855
+ if (manifest && manifest.runId !== runId) throw new Error(`Managed worktree handoff belongs to run '${manifest.runId}', not '${runId}'.`);
2856
+ const match = manifest?.groups.flatMap((group) => group.children.map((child) => ({ group, child }))).find(({ child }) => child.index === childIndex);
2857
+ if (!manifest || !match) {
2858
+ if (recordedWorktreePath) throw new Error(`Async run '${runId}' child ${childIndex} ran in managed worktree ${recordedWorktreePath}, but its handoff has no resumable record yet. Retry after the run settles; if it already ended, inspect ${manifestPath}.`);
2859
+ return void 0;
2860
+ }
2859
2861
  const cleanup = match.group.cleanup.tasks.find((task) => task.index === match.child.taskIndex);
2860
2862
  if (!cleanup) throw new Error(`Async run '${runId}' child ${childIndex} has no managed worktree cleanup record.`);
2861
2863
  const relativeCwd = path5.relative(resolveExistingPath(match.group.repoRoot), resolveExistingPath(manifest.cwd));
2862
2864
  if (path5.isAbsolute(relativeCwd) || relativeCwd === ".." || relativeCwd.startsWith(`..${path5.sep}`)) throw new Error(`Async run '${runId}' has an invalid managed worktree cwd.`);
2863
2865
  const requiredCwd = path5.join(cleanup.path, relativeCwd);
2864
2866
  if (cleanup.worktreeRemoved || cleanup.branchRemoved) throw new Error(`Async run '${runId}' required managed worktree was removed: ${requiredCwd}`);
2867
+ if (cleanup.reason?.includes("pending durable handoff capture")) throw new Error(`Async run '${runId}' child ${childIndex} is still finalizing its managed worktree: ${requiredCwd}. Retry after the run settles; if it already ended, inspect ${manifestPath}.`);
2865
2868
  let worktreeRoot = "";
2866
2869
  let resolvedRequiredCwd = "";
2867
2870
  try {
@@ -3813,7 +3816,8 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
3813
3816
  const requireSessionFile = options.requireSessionFile ?? true;
3814
3817
  const location = resolveAsyncRunLocation(params, asyncDirRoot, resultsDir);
3815
3818
  if (!location.asyncDir && !location.resultPath) {
3816
- throw new Error("Async run not found. Provide id or dir.");
3819
+ const requested = params.id ?? params.runId;
3820
+ throw new Error(requested ? `Async run not found for '${requested}'.` : "Async run not found. Provide id or dir.");
3817
3821
  }
3818
3822
  const reconciliation = location.asyncDir ? reconcileAsyncRun(location.asyncDir, { resultsDir, kill: deps.kill, now: deps.now }) : void 0;
3819
3823
  const status = reconciliation?.status ?? null;
@@ -3913,7 +3917,7 @@ function resolveAsyncResumeTarget(params, deps = {}, options = {}) {
3913
3917
  const stepThinking = statusSteps[index]?.thinking ?? resultSteps[index]?.thinking ?? (stepCount === 1 ? result?.thinking : void 0);
3914
3918
  const thinkingCeiling = statusSteps[index]?.thinkingCeiling ?? (stepCount === 1 ? recoveryDescriptor?.thinkingCeiling : void 0);
3915
3919
  const capabilityCeiling = mode === "workflow" ? intersectSubagentCapabilityCeilings(status?.admissionCapabilityCeiling, result?.admissionCapabilityCeiling) : intersectSubagentCapabilityCeilings(status?.capabilityCeiling, statusSteps[index]?.capabilityCeiling, result?.capabilityCeiling, resultSteps[index]?.capabilityCeiling);
3916
- const managedWorktreeCwd = location.asyncDir ? resolveRetainedWorktreeCwd(parallelHandoffPath(location.asyncDir), runId, index) : void 0;
3920
+ const managedWorktreeCwd = location.asyncDir ? resolveRetainedWorktreeCwd(parallelHandoffPath(location.asyncDir), runId, index, statusSteps[index]?.worktreePath) : void 0;
3917
3921
  const resumeCwd = validateResumeCwd(runId, managedWorktreeCwd ?? status?.cwd ?? result?.cwd ?? recoveryDescriptor?.cwd);
3918
3922
  return {
3919
3923
  kind: "revive",
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getProjectSubagentsDir
3
- } from "./chunk-VTMNBPCQ.js";
3
+ } from "./chunk-D3JAFGMO.js";
4
4
  import {
5
5
  discoverAgents,
6
6
  formatUnknownAgentError,
7
7
  resolveAgentName,
8
8
  unknownAgentDiagnosticContext
9
- } from "./chunk-7F5SK2U3.js";
9
+ } from "./chunk-LNRJCP2Y.js";
10
10
 
11
11
  // src/agents/agent-refinements.ts
12
12
  import { createHash, randomUUID } from "node:crypto";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-YFCK7H2S.js";
11
11
  import {
12
12
  normalizeCapabilityCeilingAllowedAgents
13
- } from "./chunk-Z7KVHQHL.js";
13
+ } from "./chunk-QXASAHIA.js";
14
14
 
15
15
  // src/shared/file-system-retry.ts
16
16
  var WAIT_BUFFER = typeof SharedArrayBuffer !== "undefined" ? new SharedArrayBuffer(4) : void 0;
@@ -338,16 +338,12 @@ function parseFrontmatter(content) {
338
338
  const indent = line.search(/\S|$/);
339
339
  const trimmed = line.trim();
340
340
  if (trimmed.startsWith("#") && !currentFolded && !currentLiteral) continue;
341
- if (currentKey !== null && currentBlockLines !== null && (indent > (currentIndent ?? 0) || (currentFolded || currentLiteral) && trimmed === "")) {
341
+ if (currentKey !== null && currentBlockLines !== null && (indent > (currentIndent ?? 0) || trimmed === "")) {
342
342
  currentBlockLines.push(line);
343
343
  continue;
344
344
  }
345
345
  if (currentKey !== null && currentBlockLines !== null) {
346
- const rawBlock = currentBlockLines.join("\n");
347
- const leadingSpaces = rawBlock.match(/^[ \t]+(?=\S)/m);
348
- const prefix = leadingSpaces?.[0] ?? "";
349
- const stripped = prefix ? rawBlock.replace(new RegExp(`^${escapeRegex(prefix)}`, "gm"), "").replace(/^\n/, "") : rawBlock;
350
- frontmatter[currentKey] = currentFolded ? foldBlock(stripped) : stripped;
346
+ frontmatter[currentKey] = flushBlockLines(currentBlockLines, currentFolded, currentLiteral);
351
347
  currentKey = null;
352
348
  currentBlockLines = null;
353
349
  currentIndent = null;
@@ -378,14 +374,22 @@ function parseFrontmatter(content) {
378
374
  }
379
375
  }
380
376
  if (currentKey !== null && currentBlockLines !== null) {
381
- const rawBlock = currentBlockLines.join("\n");
382
- const leadingSpaces = rawBlock.match(/^[ \t]+(?=\S)/m);
383
- const prefix = leadingSpaces?.[0] ?? "";
384
- const stripped = prefix ? rawBlock.replace(new RegExp(`^${escapeRegex(prefix)}`, "gm"), "").replace(/^\n/, "") : rawBlock;
385
- frontmatter[currentKey] = currentFolded ? foldBlock(stripped) : stripped;
377
+ frontmatter[currentKey] = flushBlockLines(currentBlockLines, currentFolded, currentLiteral);
386
378
  }
387
379
  return { frontmatter, body };
388
380
  }
381
+ function flushBlockLines(blockLines, folded, literal) {
382
+ let lines = blockLines;
383
+ if (!folded && !literal) {
384
+ const end = lines.indexOf("", lines.findLastIndex((line) => line.trim() !== "") + 1);
385
+ lines = lines.slice(lines.findIndex((line) => line !== ""), end < 0 ? lines.length : end);
386
+ }
387
+ const rawBlock = lines.join("\n");
388
+ const leadingSpaces = rawBlock.match(/^[ \t]+(?=\S)/m);
389
+ const prefix = leadingSpaces?.[0] ?? "";
390
+ const stripped = prefix ? rawBlock.replace(new RegExp(`^${escapeRegex(prefix)}`, "gm"), "").replace(/^\n/, "") : rawBlock;
391
+ return folded ? foldBlock(stripped) : stripped;
392
+ }
389
393
 
390
394
  // src/shared/utils.ts
391
395
  import * as fs14 from "node:fs";
@@ -6143,8 +6147,7 @@ function buildAgentDiscoverySources(cwd, preferredModelProvider, globalNpmRoot,
6143
6147
  const watchPaths = /* @__PURE__ */ new Set([
6144
6148
  userSettingsPath,
6145
6149
  ...projectSettingsPath ? [projectSettingsPath] : [],
6146
- ...projectDiscoveryWatchPaths(effectiveCwd),
6147
- ...findProjectRootCandidates(effectiveCwd).map((root) => path11.join(getProjectConfigDir(root), "settings.json")),
6150
+ ...projectTrusted ? [...projectDiscoveryWatchPaths(effectiveCwd), ...findProjectRootCandidates(effectiveCwd).map((root) => path11.join(getProjectConfigDir(root), "settings.json"))] : [],
6148
6151
  ...userScanDirs.watchPaths,
6149
6152
  ...projectScanDirs.watchPaths,
6150
6153
  ...packageSubagentPaths.watchPaths
@@ -13,7 +13,7 @@ import {
13
13
  summarizeContextModes,
14
14
  utf8Tail,
15
15
  workflowPreflightLaneForRuntimeKey
16
- } from "./chunk-OOFW75PV.js";
16
+ } from "./chunk-L3WFKBEI.js";
17
17
  import {
18
18
  assertSafeNestedId,
19
19
  checkRecordedPidLiveness,
@@ -32,11 +32,11 @@ import {
32
32
  updateActiveRunIndex,
33
33
  validateModelResponseAliases,
34
34
  writeAsyncResultFile
35
- } from "./chunk-5ESXK62X.js";
35
+ } from "./chunk-CGN2TVE7.js";
36
36
  import {
37
37
  deliverStopRequest,
38
38
  stopInboxClosedPath
39
- } from "./chunk-BKFWQ642.js";
39
+ } from "./chunk-F4ASL6OV.js";
40
40
  import {
41
41
  SUBAGENT_STOPPED_MESSAGE,
42
42
  formatDuration,
@@ -47,7 +47,7 @@ import {
47
47
  validateAcceptanceInput,
48
48
  writeAtomicJson,
49
49
  writePrivateAtomicJson
50
- } from "./chunk-7F5SK2U3.js";
50
+ } from "./chunk-LNRJCP2Y.js";
51
51
  import {
52
52
  DIRS
53
53
  } from "./chunk-JEZOSEWG.js";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "pi-subagents",
4
- version: "0.83.0",
4
+ version: "0.84.0",
5
5
  private: true,
6
6
  description: "Pi extension for single-agent delegation and scripted multi-agent workflows",
7
7
  author: "Nico Bailon",
@@ -11,13 +11,13 @@ import {
11
11
  validateAuthorityPolicy,
12
12
  validateMissionStoreConfig,
13
13
  validateModelResponseAliases
14
- } from "./chunk-5ESXK62X.js";
14
+ } from "./chunk-CGN2TVE7.js";
15
15
  import {
16
16
  getAgentDir,
17
17
  readStatus,
18
18
  validatePermissionConfig,
19
19
  writePrivateAtomicJson
20
- } from "./chunk-7F5SK2U3.js";
20
+ } from "./chunk-LNRJCP2Y.js";
21
21
  import {
22
22
  FLEET_KEYBINDING_ACTIONS,
23
23
  RUNNER_LAUNCHER_NAME_PATTERN,
@@ -6,35 +6,35 @@ import {
6
6
  resolveWorkflowForegroundSteeringTarget,
7
7
  steerAsyncRun,
8
8
  steerWorkflowForegroundTarget
9
- } from "./chunk-527E3D2J.js";
9
+ } from "./chunk-4E7BKDTX.js";
10
10
  import {
11
11
  FLEET_STATUS_WIDGET_KEY,
12
12
  reportFleetWarning,
13
13
  runningTone,
14
14
  stepTaskSummary
15
- } from "./chunk-HXVKGS33.js";
15
+ } from "./chunk-AKOIVLA5.js";
16
16
  import {
17
17
  foregroundChildStateLabel,
18
18
  formatAsyncRunTranscript,
19
19
  stopAsyncRun
20
- } from "./chunk-4BW55BTL.js";
20
+ } from "./chunk-NENDSQUY.js";
21
21
  import {
22
22
  contextModeBadge,
23
23
  contextModeLabel,
24
24
  decodeUtf8Tail,
25
25
  listAsyncRuns
26
- } from "./chunk-OOFW75PV.js";
27
- import "./chunk-5ESXK62X.js";
28
- import "./chunk-BKFWQ642.js";
26
+ } from "./chunk-L3WFKBEI.js";
27
+ import "./chunk-CGN2TVE7.js";
28
+ import "./chunk-F4ASL6OV.js";
29
29
  import "./chunk-NIXWDZZV.js";
30
- import "./chunk-MHX22USZ.js";
30
+ import "./chunk-C5P5CHYK.js";
31
31
  import "./chunk-7F6RKT6W.js";
32
32
  import "./chunk-CTPAE36Y.js";
33
33
  import "./chunk-7J4ZXMY7.js";
34
34
  import {
35
35
  getArtifactPaths,
36
36
  getArtifactsDir
37
- } from "./chunk-VTMNBPCQ.js";
37
+ } from "./chunk-D3JAFGMO.js";
38
38
  import {
39
39
  snapshotExternalRuns
40
40
  } from "./chunk-UKG4V45O.js";
@@ -46,12 +46,12 @@ import {
46
46
  formatTokens,
47
47
  readStatus,
48
48
  shortenPath
49
- } from "./chunk-7F5SK2U3.js";
49
+ } from "./chunk-LNRJCP2Y.js";
50
50
  import {
51
51
  DIRS
52
52
  } from "./chunk-JEZOSEWG.js";
53
53
  import "./chunk-YFCK7H2S.js";
54
- import "./chunk-Z7KVHQHL.js";
54
+ import "./chunk-QXASAHIA.js";
55
55
 
56
56
  // src/tui/fleet.ts
57
57
  import * as fs from "node:fs";
@@ -118,8 +118,8 @@ function resolveSubagentCapabilityCeiling(sessionId, inherited) {
118
118
  }
119
119
  return intersectSubagentCapabilityCeilings(inherited, ...active);
120
120
  }
121
- function resolveCurrentSubagentCapabilityCeiling(sessionId) {
122
- return resolveSubagentCapabilityCeiling(sessionId, void 0);
121
+ function resolveCurrentSubagentCapabilityCeiling(piSessionId) {
122
+ return resolveSubagentCapabilityCeiling(piSessionId, void 0);
123
123
  }
124
124
  function isAgentAllowedByCapabilityCeiling(agentName, ceiling) {
125
125
  return ceiling?.allowedAgents === void 0 || ceiling.allowedAgents.includes(agentName);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  appendAgentRefinementOverlay
3
- } from "./chunk-Y3I6H6DV.js";
3
+ } from "./chunk-LFDBD4PW.js";
4
4
  import {
5
5
  buildAgentMemoryInjection,
6
6
  buildSkillInjection
7
- } from "./chunk-7F5SK2U3.js";
7
+ } from "./chunk-LNRJCP2Y.js";
8
8
 
9
9
  // src/runs/shared/effective-system-prompt.ts
10
10
  function appendSection(prompt, section) {
@@ -7,7 +7,7 @@ import {
7
7
  getAgentDir,
8
8
  getConfigDirName,
9
9
  getProjectConfigDir
10
- } from "./chunk-7F5SK2U3.js";
10
+ } from "./chunk-LNRJCP2Y.js";
11
11
  import {
12
12
  TEMP_ROOT_DIR
13
13
  } from "./chunk-JEZOSEWG.js";
@@ -15,7 +15,7 @@ import {
15
15
  capabilityCeilingAgentRestrictionSources,
16
16
  intersectSubagentCapabilityCeilings,
17
17
  isAgentAllowedByCapabilityCeiling
18
- } from "./chunk-Z7KVHQHL.js";
18
+ } from "./chunk-QXASAHIA.js";
19
19
 
20
20
  // src/runs/shared/child-tool-plan.ts
21
21
  import { createHash as createHash2 } from "node:crypto";
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  rewriteSubagentPrompt
3
- } from "./chunk-CGXWSNPA.js";
3
+ } from "./chunk-XDQORLZ5.js";
4
4
  import {
5
5
  package_default
6
- } from "./chunk-6B4ITO2W.js";
7
- import "./chunk-CZTMUBUI.js";
6
+ } from "./chunk-NKQ6JNAS.js";
7
+ import "./chunk-7BWGNDNK.js";
8
8
  import {
9
9
  MODEL_ONLY_TOOL
10
- } from "./chunk-OOFW75PV.js";
10
+ } from "./chunk-L3WFKBEI.js";
11
11
  import "./chunk-NF7IEKBH.js";
12
12
  import {
13
13
  appendAgentRefinementOverlay
14
- } from "./chunk-Y3I6H6DV.js";
15
- import "./chunk-5ESXK62X.js";
14
+ } from "./chunk-LFDBD4PW.js";
15
+ import "./chunk-CGN2TVE7.js";
16
16
  import "./chunk-NIXWDZZV.js";
17
- import "./chunk-MHX22USZ.js";
17
+ import "./chunk-C5P5CHYK.js";
18
18
  import "./chunk-7F6RKT6W.js";
19
19
  import {
20
20
  assertNoToolModifierEntries
21
- } from "./chunk-CSSZRTKY.js";
21
+ } from "./chunk-V2BZYLEP.js";
22
22
  import "./chunk-CTPAE36Y.js";
23
- import "./chunk-VTMNBPCQ.js";
23
+ import "./chunk-D3JAFGMO.js";
24
24
  import {
25
25
  HERDR_PI_MAX_FRAME_BYTES,
26
26
  HERDR_PI_PROTOCOL,
@@ -37,10 +37,10 @@ import {
37
37
  discoverAgents,
38
38
  resolveExistingReadPaths,
39
39
  resolveSkills
40
- } from "./chunk-7F5SK2U3.js";
40
+ } from "./chunk-LNRJCP2Y.js";
41
41
  import "./chunk-JEZOSEWG.js";
42
42
  import "./chunk-YFCK7H2S.js";
43
- import "./chunk-Z7KVHQHL.js";
43
+ import "./chunk-QXASAHIA.js";
44
44
 
45
45
  // src/extension/herdr-pi-bridge.ts
46
46
  import { spawnSync } from "node:child_process";
@@ -15,15 +15,15 @@ import {
15
15
  resolveCurrentSessionId,
16
16
  resolveWatchdogReviewModel,
17
17
  startWatchdogDiffBaselineCapture
18
- } from "./chunk-CZTMUBUI.js";
18
+ } from "./chunk-7BWGNDNK.js";
19
19
  import {
20
20
  MODEL_ONLY_TOOL,
21
21
  agentStreamOptions,
22
22
  opencodeSessionHeaders
23
- } from "./chunk-OOFW75PV.js";
23
+ } from "./chunk-L3WFKBEI.js";
24
24
  import {
25
25
  inheritedNestedRouteOf
26
- } from "./chunk-5ESXK62X.js";
26
+ } from "./chunk-CGN2TVE7.js";
27
27
  import {
28
28
  CHILD_WATCHDOG_STATUS_EVENT,
29
29
  MISSING_STRUCTURED_ACCEPTANCE_REPORT_ERROR,
@@ -39,7 +39,7 @@ import {
39
39
  toolBudgetSoftNudge,
40
40
  validateAcceptanceReport,
41
41
  validateStructuredOutputValue
42
- } from "./chunk-7F5SK2U3.js";
42
+ } from "./chunk-LNRJCP2Y.js";
43
43
  import {
44
44
  INTERCOM_SESSION_IDENTITY_EVENT
45
45
  } from "./chunk-JEZOSEWG.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  requestAsyncStop
3
- } from "./chunk-BKFWQ642.js";
3
+ } from "./chunk-F4ASL6OV.js";
4
4
  import "./chunk-NIXWDZZV.js";
5
- import "./chunk-7F5SK2U3.js";
5
+ import "./chunk-LNRJCP2Y.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
- import "./chunk-Z7KVHQHL.js";
8
+ import "./chunk-QXASAHIA.js";
9
9
  export {
10
10
  requestAsyncStop
11
11
  };
package/bundle/index.js CHANGED
@@ -17,7 +17,7 @@ function readInstalledPackageVersion() {
17
17
  var loadedPackageVersion = readInstalledPackageVersion();
18
18
 
19
19
  // index.ts
20
- var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-CNLDYEH4.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-HJJAVHFB.js")).default;
20
+ var registerExtension = process.env[HERDR_PI_MODE_ENV] === "1" ? (await import("./chunk-VQVVHSY6.js")).default : process.env.PI_SUBAGENT_CHILD === "1" ? void 0 : (await import("./chunk-235AWJUQ.js")).default;
21
21
  function registerSubagentExtension(pi) {
22
22
  const installedVersion = readInstalledPackageVersion();
23
23
  if (installedVersion !== loadedPackageVersion) {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  resolveIntercomSessionTarget
3
- } from "./chunk-MHX22USZ.js";
3
+ } from "./chunk-C5P5CHYK.js";
4
4
  import "./chunk-7F6RKT6W.js";
5
- import "./chunk-7F5SK2U3.js";
5
+ import "./chunk-LNRJCP2Y.js";
6
6
  import "./chunk-JEZOSEWG.js";
7
7
  import "./chunk-YFCK7H2S.js";
8
- import "./chunk-Z7KVHQHL.js";
8
+ import "./chunk-QXASAHIA.js";
9
9
  export {
10
10
  resolveIntercomSessionTarget
11
11
  };
@@ -2,22 +2,22 @@ import {
2
2
  buildEffectiveSystemPrompt,
3
3
  canPreferForkFromSnapshot,
4
4
  resolveSubagentLaunchContext
5
- } from "./chunk-HLE22FSH.js";
6
- import "./chunk-Y3I6H6DV.js";
5
+ } from "./chunk-SSG7IEP5.js";
6
+ import "./chunk-LFDBD4PW.js";
7
7
  import {
8
8
  loadConfig
9
- } from "./chunk-RZJN63GU.js";
9
+ } from "./chunk-PALJGGYC.js";
10
10
  import {
11
11
  nestedResultsPath,
12
12
  processTerminalCandidatePath,
13
13
  processTerminalPath,
14
14
  resultFilePath
15
- } from "./chunk-5ESXK62X.js";
15
+ } from "./chunk-CGN2TVE7.js";
16
16
  import {
17
17
  applyIntercomBridgeToAgent,
18
18
  resolveIntercomBridge,
19
19
  validateIntercomBridgeConfig
20
- } from "./chunk-MHX22USZ.js";
20
+ } from "./chunk-C5P5CHYK.js";
21
21
  import {
22
22
  AGENT_DEFINITION_PROJECTION_VERSION,
23
23
  resolveLaunchBinding,
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  applyThinkingSuffix,
28
28
  resolvePiLaunchToolPlan
29
- } from "./chunk-CSSZRTKY.js";
29
+ } from "./chunk-V2BZYLEP.js";
30
30
  import {
31
31
  assertRequiredChildExtensionsAdmitted,
32
32
  resolveRequiredChildExtensions
@@ -34,7 +34,7 @@ import {
34
34
  import {
35
35
  getArtifactPaths,
36
36
  getArtifactsDir
37
- } from "./chunk-VTMNBPCQ.js";
37
+ } from "./chunk-D3JAFGMO.js";
38
38
  import {
39
39
  assertClaudeCodeModelScope,
40
40
  assertThinkingWithinCeiling,
@@ -61,7 +61,7 @@ import {
61
61
  resolveSkillsWithFallback,
62
62
  resolveStepBehavior,
63
63
  unknownAgentDiagnosticContext
64
- } from "./chunk-7F5SK2U3.js";
64
+ } from "./chunk-LNRJCP2Y.js";
65
65
  import {
66
66
  DIRS,
67
67
  SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
@@ -71,7 +71,7 @@ import "./chunk-YFCK7H2S.js";
71
71
  import {
72
72
  capabilityCeilingAgentRestrictionMessage,
73
73
  intersectSubagentCapabilityCeilings
74
- } from "./chunk-Z7KVHQHL.js";
74
+ } from "./chunk-QXASAHIA.js";
75
75
 
76
76
  // src/api/preflight.ts
77
77
  import * as fs from "node:fs";
@@ -8,13 +8,13 @@ import {
8
8
  openProjectPane,
9
9
  projectPaneBindingPath,
10
10
  readProjectPaneBinding
11
- } from "./chunk-WG2OTTAK.js";
11
+ } from "./chunk-2DHZTCOL.js";
12
12
  import "./chunk-7J4ZXMY7.js";
13
- import "./chunk-VTMNBPCQ.js";
14
- import "./chunk-7F5SK2U3.js";
13
+ import "./chunk-D3JAFGMO.js";
14
+ import "./chunk-LNRJCP2Y.js";
15
15
  import "./chunk-JEZOSEWG.js";
16
16
  import "./chunk-YFCK7H2S.js";
17
- import "./chunk-Z7KVHQHL.js";
17
+ import "./chunk-QXASAHIA.js";
18
18
  export {
19
19
  PROJECT_PANES_API_VERSION,
20
20
  PROJECT_PANE_TRUST_STATUS,
@@ -202,7 +202,18 @@ With `"summary"`, a tool result looks like this:
202
202
 
203
203
  Set to `false` to register none of the pi-subagents slash commands (`/run`, `/subagents`, `/subagents-fleet`, `/subagents-watchdog`, `/prompt-workflow`, and the rest) and no [`foregroundDetachShortcut`](#foregrounddetachshortcut). The `subagent` tool, RPC, the async widget, and the extension's other features are unchanged. Prompt templates whose frontmatter has `chain:` launch through `/prompt-workflow`, so they stop working too. Defaults to `true`. Restart Pi or run `/reload` after changing it.
204
204
 
205
- The package's prompt shortcuts, such as `/parallel-review` and `/review-loop`, are Pi prompt templates, not commands, so this setting leaves them alone. Pi's package filter removes them: `{ "packages": [{ "source": "npm:pi-subagents", "prompts": [] }] }` in Pi's `settings.json`, or `pi config`.
205
+ The package's prompt shortcuts, such as `/parallel-review` and `/review-loop`, are Pi prompt templates, not commands, so this setting leaves them alone. The same goes for its skills (`pi-subagents` and `council-mode`) and built-in agents. To turn them off, use Pi's package filter for prompts and skills and `disableBuiltins` for the agents, in Pi's `settings.json`. This turns off every prompt, the `council-mode` skill and every built-in agent:
206
+
207
+ ```json
208
+ {
209
+ "packages": [
210
+ { "source": "npm:pi-subagents", "prompts": [], "skills": ["!council-mode"] }
211
+ ],
212
+ "subagents": { "disableBuiltins": true }
213
+ }
214
+ ```
215
+
216
+ A `!` entry such as `"!review-loop.md"` drops one file, and `[]` drops all of that type. `subagents.agentOverrides.<name>.disabled: true` turns off one built-in agent instead of all of them ([agents.md](agents.md)). `pi config` toggles the package's prompts and skills interactively.
206
217
 
207
218
  ## `foregroundDetachShortcut`
208
219
 
@@ -430,6 +430,8 @@ const restriction = registerSubagentCapabilityCeiling({
430
430
  // restriction.dispose() removes only this provider's registration.
431
431
  ```
432
432
 
433
+ Register with **`ctx.sessionManager.getSessionId()`**; a ceiling registered by session file path does not apply.
434
+
433
435
  Semantics:
434
436
 
435
437
  - Active registrations intersect their `allowedTools` and `allowedAgents` sets and OR `denyExtensions`.
package/docs/missions.md CHANGED
@@ -13,6 +13,8 @@ Missions are durable wrappers around runs. The noun map:
13
13
 
14
14
  Ordinary workflow launches create one enclosing mission by default, with detailed JSON records under `~/.pi/agent/missions/projects/<project-hash>/` linking objectives, run ids, lifecycle status, decisions, artifact paths, and delivery receipts. Workflow children do not create separate missions. Each workflow child attempt is stored in the enclosing mission with its stable workflow key, run id when known, agent, task metadata, timestamps, session and artifact paths, and latest status heartbeat.
15
15
 
16
+ A finished run completes a mission you asked for with `mission` or `missionId` only when its result was accepted. If the run, or any workflow child in the mission, ends with acceptance `review-required`, `rejected`, `claimed`, or `pending`, the mission stays `waiting` and `mission.show` lists each child's acceptance status. Check the result and close the mission with `mission.close`. A `gate` or `acceptance.verify` command lets the runtime accept the result, except for writer runs: they require a review by default and stay `review-required` without one. When the command is enough proof, use `acceptance: { level: "verified", verify: [{ id: "check", command: "..." }], review: { required: false } }` instead of `gate`. Missions made by default for ordinary launches still complete when their run finishes.
17
+
16
18
  Records created under the old default `<project>/.pi/subagents/missions` stay on disk. Continue them by setting `missions.directory` to that path for the project or by copying the record into the new agent-dir project store. There is no automatic migration.
17
19
 
18
20
  Behavior:
@@ -344,7 +344,7 @@ subagent({ action: "doctor" })
344
344
  - `view: "transcript"` tails the selected run's live `output-<index>.log` or persisted session transcript, with `lines` capped at 500.
345
345
  - Nested status shows the root/parent path, nested children, session/artifact paths when known, and nested control commands.
346
346
  - Inside child-safe fanout mode, bare `status` requires an id when no local foreground run is active, so children cannot enumerate unrelated top-level async runs.
347
- - Bare `interrupt` still targets only the visible top-level run; interrupting a nested run requires its explicit nested id.
347
+ - `interrupt` requires an id, like `stop`, `steer`, and `resume`; for a nested run, pass its nested id.
348
348
 
349
349
  ### Command controls
350
350
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "pi-subagents",
4
- "version": "0.83.0",
4
+ "version": "0.84.0",
5
5
  "description": "Pi extension for single-agent delegation and scripted multi-agent workflows",
6
6
  "author": "Nico Bailon",
7
7
  "license": "MIT",
@@ -6,7 +6,7 @@ import { type RuntimeAgentOwner } from "./runtime-agent-registry.ts";
6
6
  type ManagementContext = Pick<ExtensionContext, "cwd" | "modelRegistry"> & {
7
7
  model?: ExtensionContext["model"];
8
8
  config?: ExtensionConfig;
9
- currentSessionId?: string;
9
+ piSessionId?: string;
10
10
  runtimeAgentOwner?: RuntimeAgentOwner;
11
11
  onAgentsChanged?: () => void;
12
12
  discoverAgentsAll?: typeof discoverAgentsAll;
@@ -1023,7 +1023,7 @@ export function handleList(params, ctx) {
1023
1023
  let scopedAgents = effectiveAgentsForScope(scope, d, ctx.runtimeAgentOwner, ctx.model?.provider);
1024
1024
  scopedAgents = scopedAgents
1025
1025
  .sort((a, b) => a.name.localeCompare(b.name));
1026
- const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.currentSessionId);
1026
+ const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.piSessionId);
1027
1027
  const visibleAgents = scopedAgents.filter((a) => !a.disabled);
1028
1028
  const agents = visibleAgents.filter((a) => isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
1029
1029
  const restrictedAgents = visibleAgents.filter((a) => !isAgentAllowedByCapabilityCeiling(a.name, capabilityCeiling));
@@ -1082,7 +1082,7 @@ function handleModels(params, ctx) {
1082
1082
  const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
1083
1083
  const currentModel = ctx.model ? { provider: ctx.model.provider, id: ctx.model.id } : undefined;
1084
1084
  const preferredProvider = ctx.model?.provider;
1085
- const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.currentSessionId);
1085
+ const capabilityCeiling = resolveCurrentSubagentCapabilityCeiling(ctx.piSessionId);
1086
1086
  let selectedAgents = effectiveAgents;
1087
1087
  if (requestedAgent) {
1088
1088
  const matches = findAgentsInDiscovery(requestedAgent, discovered, scope, ctx.runtimeAgentOwner, ctx.model?.provider);
@@ -2432,8 +2432,7 @@ function buildAgentDiscoverySources(cwd, preferredModelProvider, globalNpmRoot,
2432
2432
  const watchPaths = new Set([
2433
2433
  userSettingsPath,
2434
2434
  ...(projectSettingsPath ? [projectSettingsPath] : []),
2435
- ...projectDiscoveryWatchPaths(effectiveCwd),
2436
- ...findProjectRootCandidates(effectiveCwd).map((root) => path.join(getProjectConfigDir(root), "settings.json")),
2435
+ ...(projectTrusted ? [...projectDiscoveryWatchPaths(effectiveCwd), ...findProjectRootCandidates(effectiveCwd).map((root) => path.join(getProjectConfigDir(root), "settings.json"))] : []),
2437
2436
  ...userScanDirs.watchPaths,
2438
2437
  ...projectScanDirs.watchPaths,
2439
2438
  ...packageSubagentPaths.watchPaths,