pi-subagents 0.86.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 (122) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/bundle/agents.js +3 -3
  3. package/bundle/child-tool-plan.js +2 -2
  4. package/bundle/{chunk-PYOAIN3V.js → chunk-2DIEL4WG.js} +2 -2
  5. package/bundle/{chunk-GJGTMLPE.js → chunk-3DT5X2QC.js} +483 -477
  6. package/bundle/{chunk-374MZFF4.js → chunk-3MFYKBKI.js} +23 -13
  7. package/bundle/{chunk-ZJJCPV3L.js → chunk-47GJDBIK.js} +10 -6
  8. package/bundle/{chunk-77ASNIEM.js → chunk-47ZN7NKR.js} +1 -1
  9. package/bundle/{chunk-QGO6HXHG.js → chunk-4MVDMA5C.js} +88 -64
  10. package/bundle/{chunk-O3YH7XIY.js → chunk-4PM6RDE5.js} +46 -32
  11. package/bundle/{chunk-BWC2LVII.js → chunk-4UGWHREQ.js} +200 -64
  12. package/bundle/{chunk-3RKFH2UZ.js → chunk-6EUQPQY7.js} +31 -14
  13. package/bundle/{chunk-A637IMAO.js → chunk-6OWNDN7R.js} +2 -2
  14. package/bundle/{chunk-6VD7BGIC.js → chunk-6PR44R7E.js} +7 -2
  15. package/bundle/{chunk-7ZUFN6ME.js → chunk-CKLZ5FGU.js} +2 -2
  16. package/bundle/{chunk-ZPY5QZCS.js → chunk-CYKNHFXB.js} +1 -1
  17. package/bundle/{chunk-YK3QYNLE.js → chunk-GDR2ILWY.js} +1 -1
  18. package/bundle/{chunk-7QA7ZA46.js → chunk-IZEKQEY4.js} +9 -9
  19. package/bundle/{chunk-NAFLUJ26.js → chunk-KXW62VBU.js} +1 -1
  20. package/bundle/{chunk-S2Q75LP3.js → chunk-L4YY2TOE.js} +1 -1
  21. package/bundle/{chunk-QM3JGE4W.js → chunk-MTPICU4A.js} +12 -12
  22. package/bundle/{chunk-BU6PFPVX.js → chunk-PJSOS2Q4.js} +12 -7
  23. package/bundle/{chunk-UR7OW5S7.js → chunk-RHYVKQQL.js} +11 -5
  24. package/bundle/{chunk-BGXEAYUM.js → chunk-SVIXQDIV.js} +20 -5
  25. package/bundle/{chunk-7ADDXUGF.js → chunk-UVDLJXL6.js} +14 -5
  26. package/bundle/{chunk-NF7IEKBH.js → chunk-W2BZS6UC.js} +27 -13
  27. package/bundle/{chunk-5H4BICQZ.js → chunk-W6HIYD2Z.js} +1 -1
  28. package/bundle/{chunk-2IYBCYFU.js → chunk-XAOHLFJO.js} +174 -56
  29. package/bundle/{chunk-LGINOOY5.js → chunk-XIA5GSEU.js} +2 -2
  30. package/bundle/chunk-YDZ7BZD5.js +523 -0
  31. package/bundle/{chunk-WN2E5XHN.js → chunk-YZPVALSQ.js} +30 -5
  32. package/bundle/control-channel.js +2 -2
  33. package/bundle/index.js +1 -1
  34. package/bundle/intercom-bridge.js +2 -2
  35. package/bundle/preflight.js +12 -10
  36. package/bundle/project-panes.js +3 -3
  37. package/bundle/workflow-resources.js +1 -1
  38. package/docs/agents.md +4 -4
  39. package/docs/configuration.md +17 -5
  40. package/docs/extension-api.md +2 -0
  41. package/docs/models.md +6 -2
  42. package/docs/observability.md +2 -0
  43. package/docs/tool-reference.md +5 -1
  44. package/package.json +2 -2
  45. package/skills/pi-subagents/SKILL.md +15 -6
  46. package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
  47. package/src/agents/agent-management.d.ts +1 -0
  48. package/src/agents/agent-management.js +22 -10
  49. package/src/agents/agent-serializer.d.ts +2 -0
  50. package/src/agents/agent-serializer.js +1 -1
  51. package/src/agents/agents.d.ts +1 -0
  52. package/src/agents/agents.js +39 -14
  53. package/src/api/preflight.d.ts +3 -1
  54. package/src/api/preflight.js +2 -0
  55. package/src/extension/config.d.ts +1 -0
  56. package/src/extension/config.js +6 -0
  57. package/src/extension/index.js +8 -5
  58. package/src/extension/schemas.d.ts +4 -0
  59. package/src/extension/schemas.js +2 -0
  60. package/src/extension/tool-activation.js +20 -3
  61. package/src/runs/background/async-execution.d.ts +2 -1
  62. package/src/runs/background/async-execution.js +4 -2
  63. package/src/runs/background/async-resume.js +2 -1
  64. package/src/runs/background/async-retention.d.ts +0 -2
  65. package/src/runs/background/async-retention.js +11 -5
  66. package/src/runs/background/async-status.d.ts +2 -0
  67. package/src/runs/background/async-status.js +4 -0
  68. package/src/runs/background/run-child-session.d.ts +2 -2
  69. package/src/runs/background/run-child-session.js +4 -7
  70. package/src/runs/background/runner-aliases.js +15 -0
  71. package/src/runs/background/steering.d.ts +2 -11
  72. package/src/runs/background/steering.js +11 -6
  73. package/src/runs/background/subagent-runner.d.ts +0 -2
  74. package/src/runs/background/subagent-runner.js +73 -58
  75. package/src/runs/background/wait-subscriptions.js +124 -12
  76. package/src/runs/foreground/async-steering-action.js +24 -9
  77. package/src/runs/foreground/async-stop-action.d.ts +1 -1
  78. package/src/runs/foreground/async-stop-action.js +9 -1
  79. package/src/runs/foreground/execution.js +33 -15
  80. package/src/runs/foreground/prompt-audit.js +1 -0
  81. package/src/runs/foreground/subagent-executor.d.ts +2 -8
  82. package/src/runs/foreground/subagent-executor.js +57 -23
  83. package/src/runs/shared/async-status-projection.d.ts +2 -0
  84. package/src/runs/shared/async-status-projection.js +10 -0
  85. package/src/runs/shared/child-session.d.ts +5 -4
  86. package/src/runs/shared/child-session.js +64 -36
  87. package/src/runs/shared/herdr-placed-run.js +3 -2
  88. package/src/runs/shared/mcp-config-sources.d.ts +4 -1
  89. package/src/runs/shared/mcp-config-sources.js +1 -1
  90. package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -3
  91. package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -17
  92. package/src/runs/shared/model-resolution.d.ts +19 -4
  93. package/src/runs/shared/model-resolution.js +50 -51
  94. package/src/runs/shared/subagent-prompt-runtime.js +14 -2
  95. package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
  96. package/src/runs/shared/supervisor-wait-timer.js +61 -0
  97. package/src/shared/artifacts.d.ts +1 -0
  98. package/src/shared/artifacts.js +132 -22
  99. package/src/shared/pruned-fork.js +2 -2
  100. package/src/shared/reported-progress.d.ts +1 -0
  101. package/src/shared/reported-progress.js +12 -0
  102. package/src/shared/status-format.d.ts +1 -0
  103. package/src/shared/status-format.js +1 -1
  104. package/src/shared/types.d.ts +23 -0
  105. package/src/shared/utils.d.ts +3 -1
  106. package/src/shared/utils.js +4 -0
  107. package/src/tui/render.js +33 -2
  108. package/src/watchdog/model-selection.js +2 -2
  109. package/src/watchdog/permission-arbiter.js +1 -0
  110. package/src/watchdog/review.d.ts +0 -5
  111. package/src/watchdog/review.js +4 -3
  112. package/src/workflows/scripted-workflow.d.ts +2 -0
  113. package/src/workflows/scripted-workflow.js +103 -39
  114. package/src/workflows/structured-workflow-scripts.d.ts +4 -3
  115. package/src/workflows/structured-workflow-scripts.js +32 -11
  116. package/src/workflows/workflow-resources.js +4 -4
  117. package/src/workflows/workflow-resume-claim.d.ts +2 -0
  118. package/src/workflows/workflow-resume-claim.js +1 -1
  119. package/src/workflows/workflow-resume.d.ts +1 -1
  120. package/src/workflows/workflow-resume.js +3 -1
  121. package/src/workflows/workflow-script-worker.js +3 -1
  122. package/bundle/chunk-GRJHIXYF.js +0 -235
@@ -112,7 +112,21 @@ import { randomUUID } from "node:crypto";
112
112
  var OUTPUT_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
113
113
  var PLACEHOLDER_PATTERN = /\{(?:task|previous|outputs\.([A-Za-z_][A-Za-z0-9_]*))\}/g;
114
114
  var CHILD_FIELDS = ["cwd", "model"];
115
- var TOP_LEVEL_CONTROLS_HINT = " Put worktree and other child controls on the subagent call itself; they apply to every child.";
115
+ var SHARED_CHILD_CONTROLS = /* @__PURE__ */ new Set(["worktree", "baseRef", "context", "skill", "fast", "agentScope", "outputMode", "outputSchema", "agentContract", "acceptance", "gate", "toolBudget", "toolTimeoutMs", "control"]);
116
+ var SCRIPT_CHILD_FIELDS = /* @__PURE__ */ new Set(["key", "label", "phase", "resume", "async", "timeoutMs"]);
117
+ function unsupportedChildFieldAdvice(fields, scripts) {
118
+ const perChild = scripts ? "use workflow: true with runs.all items" : "you need workflow scripts, which disabledFeatures has turned off";
119
+ const advice = [];
120
+ const itemFields = fields.filter((field) => CHILD_FIELDS.includes(field));
121
+ if (itemFields.length > 0) advice.push(`Set ${itemFields.join(", ")} on each item, or on the subagent call itself to give every child the same value.`);
122
+ if (fields.includes("output")) advice.push(`For one shared output, set output on the subagent call itself: the workflow result is written there and each child gets its own file beside it. For exact or different per-child paths, ${perChild}. Do not drop output if you need durable child files.`);
123
+ const shared = fields.filter((field) => SHARED_CHILD_CONTROLS.has(field));
124
+ if (shared.length > 0) advice.push(`Set ${shared.join(", ")} on the subagent call itself to give every child the same value; for different values per child, ${perChild}.`);
125
+ const scriptOnly = fields.filter((field) => SCRIPT_CHILD_FIELDS.has(field));
126
+ if (scriptOnly.length > 0) advice.push(`For per-child ${scriptOnly.join(", ")}, ${perChild}.`);
127
+ advice.push("No child was launched.");
128
+ return advice.join(" ");
129
+ }
116
130
  function isPlainRecord(value) {
117
131
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
118
132
  const prototype = Object.getPrototypeOf(value);
@@ -122,10 +136,10 @@ function nonEmptyString(value, path) {
122
136
  if (typeof value !== "string" || !value.trim()) throw new Error(`${path} must be a non-empty string.`);
123
137
  return value;
124
138
  }
125
- function exactFields(value, path, allowed, hint) {
139
+ function exactFields(value, path, allowed, hint, scripts) {
126
140
  if (!isPlainRecord(value)) throw new Error(`${path} must be an object.`);
127
141
  const unsupported = Object.keys(value).filter((key) => !allowed.includes(key));
128
- if (unsupported.length > 0) throw new Error(`${path} contains unsupported fields: ${unsupported.join(", ")}. ${hint}`);
142
+ if (unsupported.length > 0) throw new Error(`${path} contains unsupported fields: ${unsupported.join(", ")}. ${hint} ${unsupportedChildFieldAdvice(unsupported, scripts)}`);
129
143
  return value;
130
144
  }
131
145
  function compileTemplate(template, scope) {
@@ -184,11 +198,11 @@ var SETTLE_HELPER = [
184
198
  ' return new Error(label + ": " + children.filter(function (child) { return !child.ok; }).map(function (child) { return child.key + " (" + child.agent + ") failed" + (child.error ? ": " + child.error : ""); }).join("; "));',
185
199
  "}"
186
200
  ].join("\n");
187
- function buildTasksScript(steps, originalTask) {
201
+ function buildTasksScript(steps, originalTask, scripts) {
188
202
  if (!Array.isArray(steps) || steps.length === 0) throw new Error("tasks must be a non-empty array of { agent, task } items.");
189
203
  const children = steps.map((item, index) => {
190
204
  const path = `tasks[${index}]`;
191
- const record = exactFields(item, path, ["agent", "task", ...CHILD_FIELDS], `Each tasks item accepts agent and task, plus optional cwd and model.${TOP_LEVEL_CONTROLS_HINT}`);
205
+ const record = exactFields(item, path, ["agent", "task", ...CHILD_FIELDS], "Each tasks item accepts agent and task, plus optional cwd and model.", scripts);
192
206
  const agent = nonEmptyString(record.agent, `${path}.agent`);
193
207
  const task = nonEmptyString(record.task, `${path}.task`);
194
208
  const taskExpression = compileTemplate(task, {
@@ -219,18 +233,18 @@ function buildChainScript(steps, originalTask) {
219
233
  let stepChildren;
220
234
  let outputName;
221
235
  if (isPlainRecord(step) && Object.hasOwn(step, "parallel")) {
222
- const record = exactFields(step, path, ["parallel"], `A parallel step accepts only parallel; as is supported on sequential steps only.${TOP_LEVEL_CONTROLS_HINT}`);
236
+ const record = exactFields(step, path, ["parallel"], "A parallel step accepts only parallel; as is supported on sequential steps only.", false);
223
237
  const items = record.parallel;
224
238
  if (!Array.isArray(items) || items.length === 0) throw new Error(`${path}.parallel must be a non-empty array of { agent, task } items.`);
225
239
  stepChildren = items.map((item, itemIndex) => {
226
240
  const itemPath = `${path}.parallel[${itemIndex}]`;
227
- const itemRecord = exactFields(item, itemPath, ["agent", "task", ...CHILD_FIELDS], `Each parallel item accepts agent and task, plus optional cwd and model.${TOP_LEVEL_CONTROLS_HINT}`);
241
+ const itemRecord = exactFields(item, itemPath, ["agent", "task", ...CHILD_FIELDS], "Each parallel item accepts agent and task, plus optional cwd and model.", false);
228
242
  const agent = nonEmptyString(itemRecord.agent, `${itemPath}.agent`);
229
243
  const task = nonEmptyString(itemRecord.task, `${itemPath}.task`);
230
244
  return { key: `step-${number}-${itemIndex + 1}`, agent, fields: childFields(itemRecord, itemPath), taskExpression: compileTemplate(task, { path: `${itemPath}.task`, hasOriginalTask, previous, outputs }) };
231
245
  });
232
246
  } else {
233
- const record = exactFields(step, path, ["agent", "task", "as", ...CHILD_FIELDS], `A sequential step accepts agent, task, as, cwd and model; a parallel step accepts only parallel.${TOP_LEVEL_CONTROLS_HINT}`);
247
+ const record = exactFields(step, path, ["agent", "task", "as", ...CHILD_FIELDS], "A sequential step accepts agent, task, as, cwd and model; a parallel step accepts only parallel.", false);
234
248
  const agent = nonEmptyString(record.agent, `${path}.agent`);
235
249
  let task;
236
250
  if (record.task === void 0) {
@@ -256,8 +270,8 @@ function buildChainScript(steps, originalTask) {
256
270
  lines.push("return { ok: true, children };");
257
271
  return lines.join("\n");
258
272
  }
259
- function buildStructuredWorkflowScript(kind, steps, originalTask) {
260
- return kind === "tasks" ? buildTasksScript(steps, originalTask) : buildChainScript(steps, originalTask);
273
+ function buildStructuredWorkflowScript(kind, steps, originalTask, scripts) {
274
+ return kind === "tasks" ? buildTasksScript(steps, originalTask, scripts) : buildChainScript(steps, originalTask);
261
275
  }
262
276
 
263
277
  // src/workflows/workflow-resources.ts
@@ -375,9 +389,9 @@ function resolveRunCi(args) {
375
389
  }
376
390
  function resolveParallel(args) {
377
391
  const unsupported = Object.keys(args).filter((key) => key !== "tasks");
378
- if (unsupported.length > 0) return { error: `workflow 'parallel' args contain unsupported fields: ${unsupported.join(", ")}. Pass args.tasks: [{ agent, task, cwd?, model? }, ...].${TOP_LEVEL_CONTROLS_HINT}` };
392
+ if (unsupported.length > 0) return { error: `workflow 'parallel' args contain unsupported fields: ${unsupported.join(", ")}. Pass args.tasks: [{ agent, task, cwd?, model? }, ...]. ${unsupportedChildFieldAdvice(unsupported, true)}` };
379
393
  try {
380
- return { script: buildStructuredWorkflowScript("tasks", args.tasks, void 0) };
394
+ return { script: buildStructuredWorkflowScript("tasks", args.tasks, void 0, true) };
381
395
  } catch (error) {
382
396
  return { error: `workflow 'parallel' args.${error instanceof Error ? error.message : String(error)}` };
383
397
  }
@@ -415,7 +429,7 @@ function resolveStructuredWorkflowResource(input) {
415
429
  validatePlainJson(task, "task");
416
430
  }
417
431
  if (jsonByteLength({ [kind]: steps, task }) > MAX_ARGS_BYTES) return { ok: false, error: `${kind} input exceeds ${MAX_ARGS_BYTES} bytes.` };
418
- const script = buildStructuredWorkflowScript(kind, JSON.parse(JSON.stringify(steps)), task);
432
+ const script = buildStructuredWorkflowScript(kind, JSON.parse(JSON.stringify(steps)), task, false);
419
433
  return { ok: true, resource: issueWorkflowResource(kind, STRUCTURED_WORKFLOW_RESOURCE_VERSION, script) };
420
434
  } catch (error) {
421
435
  return { ok: false, error: error instanceof Error ? error.message.slice(0, 4096) : "Structured workflow resolution failed." };
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  resolveWatchPath,
6
6
  writeAtomicJson
7
- } from "./chunk-QGO6HXHG.js";
7
+ } from "./chunk-4MVDMA5C.js";
8
8
  import {
9
9
  POLL_INTERVAL_MS
10
10
  } from "./chunk-JEZOSEWG.js";