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.
- package/CHANGELOG.md +59 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-PYOAIN3V.js → chunk-2DIEL4WG.js} +2 -2
- package/bundle/{chunk-GJGTMLPE.js → chunk-3DT5X2QC.js} +483 -477
- package/bundle/{chunk-374MZFF4.js → chunk-3MFYKBKI.js} +23 -13
- package/bundle/{chunk-ZJJCPV3L.js → chunk-47GJDBIK.js} +10 -6
- package/bundle/{chunk-77ASNIEM.js → chunk-47ZN7NKR.js} +1 -1
- package/bundle/{chunk-QGO6HXHG.js → chunk-4MVDMA5C.js} +88 -64
- package/bundle/{chunk-O3YH7XIY.js → chunk-4PM6RDE5.js} +46 -32
- package/bundle/{chunk-BWC2LVII.js → chunk-4UGWHREQ.js} +200 -64
- package/bundle/{chunk-3RKFH2UZ.js → chunk-6EUQPQY7.js} +31 -14
- package/bundle/{chunk-A637IMAO.js → chunk-6OWNDN7R.js} +2 -2
- package/bundle/{chunk-6VD7BGIC.js → chunk-6PR44R7E.js} +7 -2
- package/bundle/{chunk-7ZUFN6ME.js → chunk-CKLZ5FGU.js} +2 -2
- package/bundle/{chunk-ZPY5QZCS.js → chunk-CYKNHFXB.js} +1 -1
- package/bundle/{chunk-YK3QYNLE.js → chunk-GDR2ILWY.js} +1 -1
- package/bundle/{chunk-7QA7ZA46.js → chunk-IZEKQEY4.js} +9 -9
- package/bundle/{chunk-NAFLUJ26.js → chunk-KXW62VBU.js} +1 -1
- package/bundle/{chunk-S2Q75LP3.js → chunk-L4YY2TOE.js} +1 -1
- package/bundle/{chunk-QM3JGE4W.js → chunk-MTPICU4A.js} +12 -12
- package/bundle/{chunk-BU6PFPVX.js → chunk-PJSOS2Q4.js} +12 -7
- package/bundle/{chunk-UR7OW5S7.js → chunk-RHYVKQQL.js} +11 -5
- package/bundle/{chunk-BGXEAYUM.js → chunk-SVIXQDIV.js} +20 -5
- package/bundle/{chunk-7ADDXUGF.js → chunk-UVDLJXL6.js} +14 -5
- package/bundle/{chunk-NF7IEKBH.js → chunk-W2BZS6UC.js} +27 -13
- package/bundle/{chunk-5H4BICQZ.js → chunk-W6HIYD2Z.js} +1 -1
- package/bundle/{chunk-2IYBCYFU.js → chunk-XAOHLFJO.js} +174 -56
- package/bundle/{chunk-LGINOOY5.js → chunk-XIA5GSEU.js} +2 -2
- package/bundle/chunk-YDZ7BZD5.js +523 -0
- package/bundle/{chunk-WN2E5XHN.js → chunk-YZPVALSQ.js} +30 -5
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +12 -10
- package/bundle/project-panes.js +3 -3
- package/bundle/workflow-resources.js +1 -1
- package/docs/agents.md +4 -4
- package/docs/configuration.md +17 -5
- package/docs/extension-api.md +2 -0
- package/docs/models.md +6 -2
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +5 -1
- package/package.json +2 -2
- package/skills/pi-subagents/SKILL.md +15 -6
- package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
- package/src/agents/agent-management.d.ts +1 -0
- package/src/agents/agent-management.js +22 -10
- package/src/agents/agent-serializer.d.ts +2 -0
- package/src/agents/agent-serializer.js +1 -1
- package/src/agents/agents.d.ts +1 -0
- package/src/agents/agents.js +39 -14
- package/src/api/preflight.d.ts +3 -1
- package/src/api/preflight.js +2 -0
- package/src/extension/config.d.ts +1 -0
- package/src/extension/config.js +6 -0
- package/src/extension/index.js +8 -5
- package/src/extension/schemas.d.ts +4 -0
- package/src/extension/schemas.js +2 -0
- package/src/extension/tool-activation.js +20 -3
- package/src/runs/background/async-execution.d.ts +2 -1
- package/src/runs/background/async-execution.js +4 -2
- package/src/runs/background/async-resume.js +2 -1
- package/src/runs/background/async-retention.d.ts +0 -2
- package/src/runs/background/async-retention.js +11 -5
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +4 -0
- package/src/runs/background/run-child-session.d.ts +2 -2
- package/src/runs/background/run-child-session.js +4 -7
- package/src/runs/background/runner-aliases.js +15 -0
- package/src/runs/background/steering.d.ts +2 -11
- package/src/runs/background/steering.js +11 -6
- package/src/runs/background/subagent-runner.d.ts +0 -2
- package/src/runs/background/subagent-runner.js +73 -58
- package/src/runs/background/wait-subscriptions.js +124 -12
- package/src/runs/foreground/async-steering-action.js +24 -9
- package/src/runs/foreground/async-stop-action.d.ts +1 -1
- package/src/runs/foreground/async-stop-action.js +9 -1
- package/src/runs/foreground/execution.js +33 -15
- package/src/runs/foreground/prompt-audit.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +2 -8
- package/src/runs/foreground/subagent-executor.js +57 -23
- package/src/runs/shared/async-status-projection.d.ts +2 -0
- package/src/runs/shared/async-status-projection.js +10 -0
- package/src/runs/shared/child-session.d.ts +5 -4
- package/src/runs/shared/child-session.js +64 -36
- package/src/runs/shared/herdr-placed-run.js +3 -2
- package/src/runs/shared/mcp-config-sources.d.ts +4 -1
- package/src/runs/shared/mcp-config-sources.js +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -17
- package/src/runs/shared/model-resolution.d.ts +19 -4
- package/src/runs/shared/model-resolution.js +50 -51
- package/src/runs/shared/subagent-prompt-runtime.js +14 -2
- package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
- package/src/runs/shared/supervisor-wait-timer.js +61 -0
- package/src/shared/artifacts.d.ts +1 -0
- package/src/shared/artifacts.js +132 -22
- package/src/shared/pruned-fork.js +2 -2
- package/src/shared/reported-progress.d.ts +1 -0
- package/src/shared/reported-progress.js +12 -0
- package/src/shared/status-format.d.ts +1 -0
- package/src/shared/status-format.js +1 -1
- package/src/shared/types.d.ts +23 -0
- package/src/shared/utils.d.ts +3 -1
- package/src/shared/utils.js +4 -0
- package/src/tui/render.js +33 -2
- package/src/watchdog/model-selection.js +2 -2
- package/src/watchdog/permission-arbiter.js +1 -0
- package/src/watchdog/review.d.ts +0 -5
- package/src/watchdog/review.js +4 -3
- package/src/workflows/scripted-workflow.d.ts +2 -0
- package/src/workflows/scripted-workflow.js +103 -39
- package/src/workflows/structured-workflow-scripts.d.ts +4 -3
- package/src/workflows/structured-workflow-scripts.js +32 -11
- package/src/workflows/workflow-resources.js +4 -4
- package/src/workflows/workflow-resume-claim.d.ts +2 -0
- package/src/workflows/workflow-resume-claim.js +1 -1
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +3 -1
- package/src/workflows/workflow-script-worker.js +3 -1
- 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
|
|
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],
|
|
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"],
|
|
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],
|
|
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],
|
|
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? }, ...]
|
|
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." };
|