@vicary/pi-subagents 0.85.0 → 0.87.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 +48 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-O7CPL6H4.js → chunk-2D2DQGC2.js} +9 -9
- package/bundle/{chunk-KZ34KQQH.js → chunk-2NY5PCKQ.js} +11 -5
- package/bundle/{chunk-PVIVCDG2.js → chunk-3CVOAS77.js} +2 -2
- package/bundle/{chunk-N7B2KD74.js → chunk-6O7YH2QV.js} +1 -1
- package/bundle/{chunk-B3OOJJA6.js → chunk-75LVXBSA.js} +194 -94
- package/bundle/{chunk-H2NLFTC5.js → chunk-BFF6YDK6.js} +1 -1
- package/bundle/{chunk-UX4SCV5N.js → chunk-C3KWLXDH.js} +159 -98
- package/bundle/{chunk-GCSLVFCX.js → chunk-C5QWQSSM.js} +1 -1
- package/bundle/{chunk-KDMFBYFM.js → chunk-ESWW6XSX.js} +1 -1
- package/bundle/{chunk-CS4O36CZ.js → chunk-HDICKROY.js} +5 -5
- package/bundle/{chunk-JHBQ7N2L.js → chunk-HTI7DD5D.js} +2 -2
- package/bundle/{chunk-L2ENOFVZ.js → chunk-LZKVUWIY.js} +66 -26
- package/bundle/{chunk-RV5OGHLO.js → chunk-M2VBGET6.js} +2 -2
- package/bundle/{chunk-QZL2ZZPM.js → chunk-NJTSXIMG.js} +12 -12
- package/bundle/{chunk-YZBCREP5.js → chunk-NMYBVCGP.js} +39 -34
- package/bundle/{chunk-A7VJ5XXE.js → chunk-O7A26O6B.js} +8 -6
- package/bundle/{chunk-HFTBF7SG.js → chunk-OOE3R7IQ.js} +1 -1
- package/bundle/{chunk-LGMILZNE.js → chunk-PGU4TZV3.js} +79 -32
- package/bundle/{chunk-VEZMZDTW.js → chunk-PUSTU4Q7.js} +80 -37
- package/bundle/{chunk-KEY3UQMQ.js → chunk-SIAQXPJ4.js} +6 -8
- package/bundle/{chunk-QO75KJBT.js → chunk-USRX7QXD.js} +2 -2
- package/bundle/{chunk-7MAE3DJV.js → chunk-VFUFOZBU.js} +1 -1
- package/bundle/{chunk-NF7IEKBH.js → chunk-W2BZS6UC.js} +27 -13
- package/bundle/{chunk-T5V5BRCL.js → chunk-W52LJANO.js} +1 -1
- package/bundle/{chunk-PHZP3KHB.js → chunk-XSDYTXHF.js} +18 -11
- package/bundle/{chunk-LTPH2DXH.js → chunk-XV7RTWTS.js} +3 -3
- package/bundle/{chunk-JO67XSKD.js → chunk-YEXKJJVS.js} +12 -7
- package/bundle/{chunk-HS4WPO6B.js → chunk-Z4TR7MK6.js} +5 -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 +9 -3
- package/docs/configuration.md +14 -6
- package/docs/extension-api.md +2 -0
- package/docs/models.md +6 -2
- package/docs/tool-reference.md +3 -0
- package/package.json +2 -2
- package/skills/pi-subagents/SKILL.md +7 -4
- package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
- package/src/agents/agent-management.js +10 -6
- package/src/agents/agent-serializer.d.ts +2 -0
- package/src/agents/agent-serializer.js +1 -1
- package/src/agents/agents.js +37 -12
- package/src/api/preflight.d.ts +3 -1
- package/src/api/preflight.js +2 -0
- package/src/extension/index.js +4 -2
- package/src/extension/schemas.d.ts +2 -0
- package/src/extension/schemas.js +1 -0
- package/src/extension/tool-activation.js +10 -1
- package/src/extension/tool-description.d.ts +1 -1
- package/src/extension/tool-description.js +8 -8
- package/src/runs/background/async-execution.d.ts +2 -1
- package/src/runs/background/async-execution.js +4 -2
- package/src/runs/background/run-status.js +5 -4
- package/src/runs/background/runner-aliases.js +15 -0
- package/src/runs/background/subagent-runner.js +6 -6
- package/src/runs/background/wait-subscriptions.js +124 -12
- 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 +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +1 -0
- package/src/runs/foreground/subagent-executor.js +51 -8
- package/src/runs/shared/acceptance.js +69 -26
- package/src/runs/shared/child-session.d.ts +5 -4
- package/src/runs/shared/child-session.js +43 -33
- package/src/runs/shared/external-cli-contract.d.ts +49 -0
- package/src/runs/shared/external-cli-contract.js +18 -13
- package/src/runs/shared/herdr-placed-run.js +3 -2
- package/src/runs/shared/mcp-config-sources.d.ts +2 -1
- package/src/runs/shared/mcp-config-sources.js +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.js +5 -6
- package/src/runs/shared/model-resolution.d.ts +19 -4
- package/src/runs/shared/model-resolution.js +50 -51
- package/src/runs/shared/structured-output.js +10 -3
- package/src/shared/artifacts.js +25 -13
- package/src/shared/pruned-fork.js +2 -2
- package/src/shared/types.d.ts +71 -48
- package/src/tui/render.js +83 -22
- package/src/watchdog/model-selection.js +2 -2
- package/src/watchdog/review.js +2 -2
- 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-receipt.js +36 -53
- 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/shared/types.d.ts
CHANGED
|
@@ -1457,6 +1457,8 @@ export interface Details {
|
|
|
1457
1457
|
sourceRunId: string;
|
|
1458
1458
|
attempt: number;
|
|
1459
1459
|
};
|
|
1460
|
+
/** When `stop` with `drain` was requested (epoch ms). A drained run is never resumed. */
|
|
1461
|
+
drainRequestedAt?: number;
|
|
1460
1462
|
resource?: WorkflowResourceProvenance;
|
|
1461
1463
|
preflightWarnings?: string[];
|
|
1462
1464
|
trace: Array<{
|
|
@@ -1734,54 +1736,9 @@ export interface ExternalCliReceiptMetadata {
|
|
|
1734
1736
|
};
|
|
1735
1737
|
capabilities: ExternalCliCapabilities;
|
|
1736
1738
|
machine?: ExternalCliMachineStatus;
|
|
1737
|
-
safety?:
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
ephemeral: true;
|
|
1741
|
-
} | {
|
|
1742
|
-
access: "workspace-write";
|
|
1743
|
-
sandbox: "workspace-write";
|
|
1744
|
-
approvalPolicy: "never";
|
|
1745
|
-
ephemeral: true;
|
|
1746
|
-
} | {
|
|
1747
|
-
permissionMode: "plan";
|
|
1748
|
-
tools: "none";
|
|
1749
|
-
mcp: "empty-strict";
|
|
1750
|
-
settingSources: "none";
|
|
1751
|
-
sessionPersistence: false;
|
|
1752
|
-
} | {
|
|
1753
|
-
access: "read-only";
|
|
1754
|
-
authentication: "existing-cli-required";
|
|
1755
|
-
permissionMode: "plan";
|
|
1756
|
-
tools: "none";
|
|
1757
|
-
mcp: "empty-strict";
|
|
1758
|
-
settingSources: "user";
|
|
1759
|
-
userSettingsTrust: "required";
|
|
1760
|
-
sessionPersistence: false;
|
|
1761
|
-
} | {
|
|
1762
|
-
access: "workspace-write";
|
|
1763
|
-
authentication: "existing-cli-required";
|
|
1764
|
-
permissionMode: "acceptEdits";
|
|
1765
|
-
tools: "Read,Write,Edit,Glob,Grep";
|
|
1766
|
-
mcp: "empty-strict";
|
|
1767
|
-
settingSources: "user";
|
|
1768
|
-
userSettingsTrust: "required";
|
|
1769
|
-
sessionPersistence: false;
|
|
1770
|
-
} | {
|
|
1771
|
-
access: "read-only";
|
|
1772
|
-
authentication: "cursor-api-key-or-existing-login";
|
|
1773
|
-
mode: "ask";
|
|
1774
|
-
sandbox: "enabled";
|
|
1775
|
-
workspaceTrust: "existing-required";
|
|
1776
|
-
sessionReuse: false;
|
|
1777
|
-
} | {
|
|
1778
|
-
access: "workspace-write";
|
|
1779
|
-
authentication: "cursor-api-key-or-existing-login";
|
|
1780
|
-
mode: "print";
|
|
1781
|
-
sandbox: "enabled";
|
|
1782
|
-
workspaceTrust: "existing-required";
|
|
1783
|
-
sessionReuse: false;
|
|
1784
|
-
};
|
|
1739
|
+
safety?: ExternalCliProfileSafety;
|
|
1740
|
+
/** Where `safety` came from. Nothing in it is measured from the launched process. */
|
|
1741
|
+
safetySource?: ExternalCliSafetySource;
|
|
1785
1742
|
outputArtifacts?: {
|
|
1786
1743
|
stdoutPath?: string;
|
|
1787
1744
|
stderrPath?: string;
|
|
@@ -1796,6 +1753,59 @@ export interface ExternalCliReceiptMetadata {
|
|
|
1796
1753
|
};
|
|
1797
1754
|
nonResumableReason: string;
|
|
1798
1755
|
}
|
|
1756
|
+
export type ExternalCliProfileSafety = {
|
|
1757
|
+
sandbox: "read-only";
|
|
1758
|
+
approvalPolicy: "never";
|
|
1759
|
+
ephemeral: true;
|
|
1760
|
+
} | {
|
|
1761
|
+
access: "workspace-write";
|
|
1762
|
+
sandbox: "workspace-write";
|
|
1763
|
+
approvalPolicy: "never";
|
|
1764
|
+
ephemeral: true;
|
|
1765
|
+
} | {
|
|
1766
|
+
permissionMode: "plan";
|
|
1767
|
+
tools: "none";
|
|
1768
|
+
mcp: "empty-strict";
|
|
1769
|
+
settingSources: "none";
|
|
1770
|
+
sessionPersistence: false;
|
|
1771
|
+
} | {
|
|
1772
|
+
access: "read-only";
|
|
1773
|
+
authentication: "existing-cli-required";
|
|
1774
|
+
permissionMode: "plan";
|
|
1775
|
+
tools: "none";
|
|
1776
|
+
mcp: "empty-strict";
|
|
1777
|
+
settingSources: "user";
|
|
1778
|
+
userSettingsTrust: "required";
|
|
1779
|
+
sessionPersistence: false;
|
|
1780
|
+
} | {
|
|
1781
|
+
access: "workspace-write";
|
|
1782
|
+
authentication: "existing-cli-required";
|
|
1783
|
+
permissionMode: "acceptEdits";
|
|
1784
|
+
tools: "Read,Write,Edit,Glob,Grep";
|
|
1785
|
+
mcp: "empty-strict";
|
|
1786
|
+
settingSources: "user";
|
|
1787
|
+
userSettingsTrust: "required";
|
|
1788
|
+
sessionPersistence: false;
|
|
1789
|
+
} | {
|
|
1790
|
+
access: "read-only";
|
|
1791
|
+
authentication: "cursor-api-key-or-existing-login";
|
|
1792
|
+
mode: "ask";
|
|
1793
|
+
sandbox: "enabled";
|
|
1794
|
+
workspaceTrust: "existing-required";
|
|
1795
|
+
sessionReuse: false;
|
|
1796
|
+
} | {
|
|
1797
|
+
access: "workspace-write";
|
|
1798
|
+
authentication: "cursor-api-key-or-existing-login";
|
|
1799
|
+
mode: "print";
|
|
1800
|
+
sandbox: "enabled";
|
|
1801
|
+
workspaceTrust: "existing-required";
|
|
1802
|
+
sessionReuse: false;
|
|
1803
|
+
};
|
|
1804
|
+
export interface ExternalCliSafetySource {
|
|
1805
|
+
measured: false;
|
|
1806
|
+
/** The launch command, absent on a Herdr saved machine. A wrapper script here can grant more or less than the adapter profile. */
|
|
1807
|
+
command?: string;
|
|
1808
|
+
}
|
|
1799
1809
|
export interface ExternalCliRunnerStatus {
|
|
1800
1810
|
type: "external-cli";
|
|
1801
1811
|
command: string;
|
|
@@ -1803,6 +1813,7 @@ export interface ExternalCliRunnerStatus {
|
|
|
1803
1813
|
promptDelivery: "stdin" | "prompt-file";
|
|
1804
1814
|
adapter: ExternalCliReceiptMetadata["adapter"];
|
|
1805
1815
|
safety?: ExternalCliReceiptMetadata["safety"];
|
|
1816
|
+
safetySource?: ExternalCliSafetySource;
|
|
1806
1817
|
capabilities: ExternalCliCapabilities;
|
|
1807
1818
|
unsupportedReasons: Record<Exclude<keyof ExternalCliCapabilities, "stop">, string>;
|
|
1808
1819
|
nonResumableReason: string;
|
|
@@ -2276,6 +2287,10 @@ export interface WaitSubscriptionRecord {
|
|
|
2276
2287
|
version: 1;
|
|
2277
2288
|
token: string;
|
|
2278
2289
|
sessionId: string;
|
|
2290
|
+
/** Completion owner of the process that armed the record. A record without it stays scoped to the session. */
|
|
2291
|
+
completionOwnerId?: string;
|
|
2292
|
+
/** The Pi process behind `completionOwnerId`. Once it is dead, the next process on the session takes the wake. */
|
|
2293
|
+
completionOwnerProcess?: RecordedPid;
|
|
2279
2294
|
targetKind: "async" | "foreground";
|
|
2280
2295
|
runId: string;
|
|
2281
2296
|
requestedId: string;
|
|
@@ -2365,6 +2380,13 @@ export interface SubagentState {
|
|
|
2365
2380
|
workflowControllers?: Map<string, AbortController>;
|
|
2366
2381
|
/** Live in-process workflow child stoppers keyed by parent workflow run id. */
|
|
2367
2382
|
workflowChildStops?: Map<string, (childId: string, message?: string) => boolean>;
|
|
2383
|
+
/** Live in-process workflow drains keyed by workflow run id; `ok: false` means the drain request could not be saved and nothing was stopped. */
|
|
2384
|
+
workflowDrains?: Map<string, () => {
|
|
2385
|
+
ok: true;
|
|
2386
|
+
started: number;
|
|
2387
|
+
} | {
|
|
2388
|
+
ok: false;
|
|
2389
|
+
}>;
|
|
2368
2390
|
/** Background children awaited by a blocking workflow call: their parent cannot answer supervisor asks. */
|
|
2369
2391
|
blockingWorkflowChildren?: Set<string>;
|
|
2370
2392
|
}
|
|
@@ -2553,6 +2575,7 @@ export interface RunSyncOptions {
|
|
|
2553
2575
|
fullId: string;
|
|
2554
2576
|
contextWindow?: number;
|
|
2555
2577
|
}>;
|
|
2578
|
+
knownProviders?: import("../runs/shared/model-resolution.ts").KnownProviders;
|
|
2556
2579
|
modelResponseAliases?: Record<string, string[]>;
|
|
2557
2580
|
/** Current parent-session provider to prefer for ambiguous bare model ids */
|
|
2558
2581
|
preferredModelProvider?: string;
|
package/src/tui/render.js
CHANGED
|
@@ -245,6 +245,33 @@ export function compactTaskText(task, label) {
|
|
|
245
245
|
return undefined;
|
|
246
246
|
return previewDisplayText(normalized, COMPACT_TASK_MAX_CHARS);
|
|
247
247
|
}
|
|
248
|
+
const EXPANDED_TASK_MAX_LINES = 8;
|
|
249
|
+
/** Runs on every spinner frame, so the task is cut to what the line cap can show before any sanitizing or wrapping. */
|
|
250
|
+
function expandedTaskLines(task, label, width) {
|
|
251
|
+
const taskText = task?.trim();
|
|
252
|
+
if (!taskText || taskText === PROMPT_REDACTED || width <= 0)
|
|
253
|
+
return undefined;
|
|
254
|
+
const shown = truncateDisplayText(taskText, EXPANDED_TASK_MAX_LINES * width);
|
|
255
|
+
const labelText = label?.trim() && label.trim() !== PROMPT_REDACTED ? sanitizeDisplayText(label) : "";
|
|
256
|
+
const head = labelText && labelText !== sanitizeDisplayText(shown) ? `${labelText} — ` : "";
|
|
257
|
+
const lines = [];
|
|
258
|
+
for (const rawLine of `task: ${head}${shown}`.split("\n")) {
|
|
259
|
+
const content = sanitizeDisplayText(rawLine);
|
|
260
|
+
if (!content) {
|
|
261
|
+
if (lines.length > 0 && lines[lines.length - 1] !== "")
|
|
262
|
+
lines.push("");
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const indent = rawLine.match(/^[ \t]*/)[0].replace(/\t/g, " ").slice(0, Math.floor(width / 2));
|
|
266
|
+
for (const part of wrapPlainText(content, width - indent.length))
|
|
267
|
+
lines.push(`${indent}${part}`);
|
|
268
|
+
if (lines.length > EXPANDED_TASK_MAX_LINES)
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
if (lines.length <= EXPANDED_TASK_MAX_LINES && shown.length === taskText.length)
|
|
272
|
+
return lines;
|
|
273
|
+
return [...lines.slice(0, EXPANDED_TASK_MAX_LINES), "…"];
|
|
274
|
+
}
|
|
248
275
|
const LANE_VALUE_MAX_CHARS = 48;
|
|
249
276
|
function boundedLaneValue(value, maxChars = LANE_VALUE_MAX_CHARS) {
|
|
250
277
|
if (!value?.trim() || value.trim() === PROMPT_REDACTED)
|
|
@@ -1543,7 +1570,7 @@ function widgetStepActivity(step, snapshotNow) {
|
|
|
1543
1570
|
return activity;
|
|
1544
1571
|
return facts.join(" · ");
|
|
1545
1572
|
}
|
|
1546
|
-
function widgetChainDetails(job, theme, expanded = false, width = getTermWidth(), frame) {
|
|
1573
|
+
function widgetChainDetails(job, theme, expanded = false, width = getTermWidth(), frame, fullTask = false) {
|
|
1547
1574
|
if (!job.steps?.length)
|
|
1548
1575
|
return [];
|
|
1549
1576
|
const total = job.chainStepCount ?? job.steps.length;
|
|
@@ -1551,7 +1578,7 @@ function widgetChainDetails(job, theme, expanded = false, width = getTermWidth()
|
|
|
1551
1578
|
for (const span of buildAsyncChainStepSpans(total, job.steps.length, job.parallelGroups)) {
|
|
1552
1579
|
const steps = job.steps.slice(span.start, span.start + span.count);
|
|
1553
1580
|
if (span.isParallel) {
|
|
1554
|
-
lines.push(...parallelWidgetGroupDetails(job, theme, { steps, total: span.count, stepIndex: span.stepIndex, chainTotal: total }, expanded, width, frame, false));
|
|
1581
|
+
lines.push(...parallelWidgetGroupDetails(job, theme, { steps, total: span.count, stepIndex: span.stepIndex, chainTotal: total }, expanded, width, frame, false, fullTask));
|
|
1555
1582
|
continue;
|
|
1556
1583
|
}
|
|
1557
1584
|
const step = steps[0];
|
|
@@ -1559,20 +1586,26 @@ function widgetChainDetails(job, theme, expanded = false, width = getTermWidth()
|
|
|
1559
1586
|
lines.push(` ${theme.fg("dim", `◦ Step ${span.stepIndex + 1}/${total}: pending`)}`);
|
|
1560
1587
|
continue;
|
|
1561
1588
|
}
|
|
1562
|
-
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, "Step", span.stepIndex + 1, total, expanded, width, frame));
|
|
1589
|
+
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, "Step", span.stepIndex + 1, total, expanded, width, frame, { fullTask }));
|
|
1563
1590
|
}
|
|
1564
1591
|
return lines;
|
|
1565
1592
|
}
|
|
1566
|
-
function widgetParallelAgentDetails(job, theme, expanded = false, width = getTermWidth(), frame) {
|
|
1593
|
+
function widgetParallelAgentDetails(job, theme, expanded = false, width = getTermWidth(), frame, fullTask = false) {
|
|
1567
1594
|
if (!job.steps?.length)
|
|
1568
1595
|
return [];
|
|
1596
|
+
// Multi-job cards prefix every line with a 4-column tree continuation after this returns.
|
|
1597
|
+
const taskLines = (step, indent) => expanded && fullTask && step.status === "running"
|
|
1598
|
+
? (expandedTaskLines(step.description, step.label, width - indent.length - 4) ?? []).map((line) => `${indent}${theme.fg("dim", line)}`)
|
|
1599
|
+
: [];
|
|
1600
|
+
if (job.mode === "single")
|
|
1601
|
+
return job.steps.flatMap((step) => taskLines(step, " "));
|
|
1569
1602
|
if (job.mode !== "parallel" && job.mode !== "chain")
|
|
1570
1603
|
return [];
|
|
1571
1604
|
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length)
|
|
1572
|
-
return widgetChainDetails(job, theme, expanded, width, frame);
|
|
1605
|
+
return widgetChainDetails(job, theme, expanded, width, frame, fullTask);
|
|
1573
1606
|
const group = activeParallelWidgetGroup(job);
|
|
1574
1607
|
if (group)
|
|
1575
|
-
return parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup));
|
|
1608
|
+
return parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup), fullTask);
|
|
1576
1609
|
const total = job.stepsTotal ?? job.steps.length;
|
|
1577
1610
|
const lines = [];
|
|
1578
1611
|
for (const [index, step] of job.steps.entries()) {
|
|
@@ -1584,6 +1617,7 @@ function widgetParallelAgentDetails(job, theme, expanded = false, width = getTer
|
|
|
1584
1617
|
const display = step.sessionName?.trim() || (label ? `${label} (${step.agent})` : step.agent);
|
|
1585
1618
|
const thinking = childThinkingLevel(step);
|
|
1586
1619
|
lines.push(` ${theme.fg("dim", `${marker} ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, index), frame, thinking)} ${itemTitle} ${index + 1}/${total}: ${display} · ${widgetStepStatus(step.status, theme, thinking)}${modelDisplay}${activity ? ` · ${activity}` : ""}`)}`);
|
|
1620
|
+
lines.push(...taskLines(step, " "));
|
|
1587
1621
|
const lane = projectAsyncLane(job, step);
|
|
1588
1622
|
if (lane)
|
|
1589
1623
|
lines.push(...formatLaneProjectionLines(lane, theme, " "));
|
|
@@ -1731,7 +1765,7 @@ function parallelWidgetGroupHeader(group, theme, frame) {
|
|
|
1731
1765
|
: "parallel group";
|
|
1732
1766
|
return ` ${widgetStepGlyph(status, theme, widgetStepsRunningSeed(group.steps), frame)} ${themeBold(theme, label)} ${theme.fg("dim", "·")} ${theme.fg("dim", formatParallelOutcome(group.steps, group.total))}`;
|
|
1733
1767
|
}
|
|
1734
|
-
function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, prioritizeActive) {
|
|
1768
|
+
function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, prioritizeActive, fullTask = false) {
|
|
1735
1769
|
const lines = [parallelWidgetGroupHeader(group, theme, frame)];
|
|
1736
1770
|
const rows = parallelWidgetStepRows(group.steps, group.total, prioritizeActive);
|
|
1737
1771
|
for (const [rowIndex, row] of rows.entries()) {
|
|
@@ -1742,6 +1776,7 @@ function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, p
|
|
|
1742
1776
|
detailIndent: " ",
|
|
1743
1777
|
rowMarker: marker,
|
|
1744
1778
|
includeCurrentPath: true,
|
|
1779
|
+
fullTask,
|
|
1745
1780
|
}));
|
|
1746
1781
|
}
|
|
1747
1782
|
for (let index = rows.length; index < group.total; index++) {
|
|
@@ -2232,7 +2267,9 @@ function formatNestedWidgetLines(children, theme, width, expanded, snapshotNow,
|
|
|
2232
2267
|
append(children, 0, "");
|
|
2233
2268
|
return lines.map((line) => truncLine(line, width));
|
|
2234
2269
|
}
|
|
2235
|
-
function foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index, total, expanded, width, frame,
|
|
2270
|
+
function foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index, total, expanded, width, frame,
|
|
2271
|
+
/** `fullTask`: the widget has exactly one running child, so an expanded row may spend lines on its whole task. */
|
|
2272
|
+
options) {
|
|
2236
2273
|
const rowIndent = options?.rowIndent ?? " ";
|
|
2237
2274
|
const detailIndent = options?.detailIndent ?? " ";
|
|
2238
2275
|
const thinking = childThinkingLevel(step);
|
|
@@ -2251,7 +2288,11 @@ function foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index, tota
|
|
|
2251
2288
|
const lane = projectAsyncLane(job, step);
|
|
2252
2289
|
if (lane)
|
|
2253
2290
|
lines.push(...formatLaneProjectionLines(lane, theme, detailIndent));
|
|
2254
|
-
|
|
2291
|
+
// Multi-job cards prefix every line with a 4-column tree continuation after this returns.
|
|
2292
|
+
const fullTask = expanded && options?.fullTask && step.status === "running" ? expandedTaskLines(step.description, step.label, width - detailIndent.length - 4) : undefined;
|
|
2293
|
+
const task = fullTask ? undefined : collapseDetails ? stepTaskSummary(step, displayName) : compactTaskText(step.description, step.label);
|
|
2294
|
+
for (const line of fullTask ?? [])
|
|
2295
|
+
lines.push(`${detailIndent}${theme.fg("dim", line)}`);
|
|
2255
2296
|
if (task)
|
|
2256
2297
|
lines.push(`${detailIndent}${theme.fg("dim", `task: ${task}`)}`);
|
|
2257
2298
|
const activity = widgetStepActivityLine(step, width, expanded, job.updatedAt);
|
|
@@ -2314,7 +2355,7 @@ function hostStepWidgetLines(job, theme, indent) {
|
|
|
2314
2355
|
lines.push(`${indent}${theme.fg("dim", `… +${rows.length - visible.length} host steps hidden`)}`);
|
|
2315
2356
|
return lines;
|
|
2316
2357
|
}
|
|
2317
|
-
function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection = buildWorkflowWidgetProjection(job)) {
|
|
2358
|
+
function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection = buildWorkflowWidgetProjection(job), fullTask = false) {
|
|
2318
2359
|
const steps = projection.steps.filter((step) => !projection.materializedKeys?.has(step.workflowKey ?? "") && !projection.materializedKeys?.has(step.runId ?? ""));
|
|
2319
2360
|
const checklist = widgetChecklistWithoutMaterializedChildren(projection);
|
|
2320
2361
|
if (!expanded && job.mode === "workflow") {
|
|
@@ -2332,14 +2373,14 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2332
2373
|
];
|
|
2333
2374
|
}
|
|
2334
2375
|
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length)
|
|
2335
|
-
return widgetChainDetails(job, theme, expanded, width, frame);
|
|
2376
|
+
return widgetChainDetails(job, theme, expanded, width, frame, fullTask);
|
|
2336
2377
|
const lines = [
|
|
2337
2378
|
...(expanded ? workflowPreflightLines(job) : []),
|
|
2338
2379
|
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { includeItemErrors: !expanded, liveWidget: true }),
|
|
2339
2380
|
];
|
|
2340
2381
|
const group = activeParallelWidgetGroup(job);
|
|
2341
2382
|
if (group) {
|
|
2342
|
-
lines.push(...parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup)));
|
|
2383
|
+
lines.push(...parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup), fullTask));
|
|
2343
2384
|
}
|
|
2344
2385
|
else {
|
|
2345
2386
|
const { stageProgress, plannedKeys } = projection;
|
|
@@ -2356,7 +2397,7 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2356
2397
|
const itemTitle = isPlannedStage ? "Stage" : "Step";
|
|
2357
2398
|
const displayIndex = isPlannedStage ? (step.index ?? index) + 1 : plannedKeys ? ++extraStepIndex : index + 1;
|
|
2358
2399
|
const displayTotal = isPlannedStage ? stageTotal : extraStepCount;
|
|
2359
|
-
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, itemTitle, displayIndex, displayTotal, expanded, width, frame));
|
|
2400
|
+
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, itemTitle, displayIndex, displayTotal, expanded, width, frame, { fullTask }));
|
|
2360
2401
|
}
|
|
2361
2402
|
}
|
|
2362
2403
|
lines.push(...hostStepWidgetLines(job, theme, " "));
|
|
@@ -2368,7 +2409,7 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2368
2409
|
return lines;
|
|
2369
2410
|
}
|
|
2370
2411
|
/** `reservedLines` are lines the caller renders after these, such as materialized workflow children. */
|
|
2371
|
-
function buildSingleWidgetLines(job, theme, width, expanded, frame, projection = buildWorkflowWidgetProjection(job), reservedLines = 0) {
|
|
2412
|
+
function buildSingleWidgetLines(job, theme, width, expanded, frame, projection = buildWorkflowWidgetProjection(job), reservedLines = 0, fullTask = false) {
|
|
2372
2413
|
if ((!expanded || projection.inlineFleetCovered) && job.mode === "workflow")
|
|
2373
2414
|
return [compactWorkflowHeaderLine(job, theme, width), ...compactWorkflowWidgetBodyLines(job, theme, frame, projection, widgetLineBudget(expanded) - 1 - reservedLines)].map((line) => truncLine(line, width));
|
|
2374
2415
|
const stats = widgetStats(job, theme, projection, !expanded);
|
|
@@ -2385,7 +2426,7 @@ function buildSingleWidgetLines(job, theme, width, expanded, frame, projection =
|
|
|
2385
2426
|
return [
|
|
2386
2427
|
`${theme.fg("toolTitle", themeBold(theme, title))} ${theme.fg("dim", "· background")}`,
|
|
2387
2428
|
...(collapseDetails ? [] : [summary]),
|
|
2388
|
-
...foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection),
|
|
2429
|
+
...foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection, fullTask),
|
|
2389
2430
|
].map((line) => truncLine(line, width));
|
|
2390
2431
|
}
|
|
2391
2432
|
function compactSingleWidgetLines(job, theme, width, frame, projection = buildWorkflowWidgetProjection(job)) {
|
|
@@ -2817,7 +2858,7 @@ function widgetChecklistWithoutMaterializedChildren(projection) {
|
|
|
2817
2858
|
return checklist;
|
|
2818
2859
|
return { ...checklist, phases: checklist.phases.map((phase) => ({ ...phase, items: phase.items.filter((item) => !materializedKeys.has(item.key)) })) };
|
|
2819
2860
|
}
|
|
2820
|
-
function materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor) {
|
|
2861
|
+
function materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor, fullTask = false) {
|
|
2821
2862
|
const { children, inlineFleetCovered } = projectionFor(job);
|
|
2822
2863
|
if (inlineFleetCovered || !children?.length)
|
|
2823
2864
|
return [];
|
|
@@ -2829,9 +2870,9 @@ function materializedWidgetChildLines(job, theme, width, expanded, frame, projec
|
|
|
2829
2870
|
const identity = child.workflowKey ?? child.asyncId;
|
|
2830
2871
|
const stats = widgetStats(child, theme, projection, !expanded);
|
|
2831
2872
|
lines.push(` ${last ? "└─" : "├─"} ${theme.bold(identity)} ${widgetStatusGlyph(child, theme, frame)} ${themeBold(theme, widgetJobName(child))}${contextModeBadge(theme, child.context)}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`);
|
|
2832
|
-
for (const detail of foregroundStyleWidgetDetails(child, theme, expanded, Math.max(0, width - 6), frame, projection))
|
|
2873
|
+
for (const detail of foregroundStyleWidgetDetails(child, theme, expanded, Math.max(0, width - 6), frame, projection, fullTask))
|
|
2833
2874
|
lines.push(` ${last ? " " : "│ "}${detail}`);
|
|
2834
|
-
for (const detail of materializedWidgetChildLines(child, theme, Math.max(0, width - 4), expanded, frame, projectionFor))
|
|
2875
|
+
for (const detail of materializedWidgetChildLines(child, theme, Math.max(0, width - 4), expanded, frame, projectionFor, fullTask))
|
|
2835
2876
|
lines.push(` ${detail}`);
|
|
2836
2877
|
}
|
|
2837
2878
|
if (shown.length < children.length)
|
|
@@ -2934,12 +2975,32 @@ function buildWidgetComponent(jobs, ui, initiallyCollapsed = false, layout) {
|
|
|
2934
2975
|
return component;
|
|
2935
2976
|
};
|
|
2936
2977
|
}
|
|
2978
|
+
/** Running children the widget shows, counted the way it renders them: a workflow step that has
|
|
2979
|
+
* its own child job is that job's row, so it counts once. */
|
|
2980
|
+
function runningWidgetChildCount(jobs, projectionFor) {
|
|
2981
|
+
let running = 0;
|
|
2982
|
+
for (const job of jobs) {
|
|
2983
|
+
const { steps, materializedKeys, children } = projectionFor(job);
|
|
2984
|
+
if (!steps.length && job.status === "running")
|
|
2985
|
+
running++;
|
|
2986
|
+
for (const step of steps) {
|
|
2987
|
+
if (step.status === "running" && !materializedKeys?.has(step.workflowKey ?? "") && !materializedKeys?.has(step.runId ?? ""))
|
|
2988
|
+
running++;
|
|
2989
|
+
}
|
|
2990
|
+
if (children?.length)
|
|
2991
|
+
running += runningWidgetChildCount(children, projectionFor);
|
|
2992
|
+
}
|
|
2993
|
+
return running;
|
|
2994
|
+
}
|
|
2937
2995
|
function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), expanded = false, frame, projectionFor = workflowWidgetProjectionLookup()) {
|
|
2938
2996
|
if (jobs.length === 0)
|
|
2939
2997
|
return [];
|
|
2998
|
+
// Expanded rows show a whole task only while exactly one child runs in the whole widget; with
|
|
2999
|
+
// more, the extra lines would push other running children past the widget's line budget.
|
|
3000
|
+
const fullTask = expanded && runningWidgetChildCount(jobs, projectionFor) === 1;
|
|
2940
3001
|
if (jobs.length === 1) {
|
|
2941
|
-
const childLines = materializedWidgetChildLines(jobs[0], theme, width, expanded, frame, projectionFor).map((line) => truncLine(line, width));
|
|
2942
|
-
return [...buildSingleWidgetLines(jobs[0], theme, width, expanded, frame, projectionFor(jobs[0]), childLines.length), ...childLines];
|
|
3002
|
+
const childLines = materializedWidgetChildLines(jobs[0], theme, width, expanded, frame, projectionFor, fullTask).map((line) => truncLine(line, width));
|
|
3003
|
+
return [...buildSingleWidgetLines(jobs[0], theme, width, expanded, frame, projectionFor(jobs[0]), childLines.length, fullTask), ...childLines];
|
|
2943
3004
|
}
|
|
2944
3005
|
const running = jobs.filter((job) => job.status === "running");
|
|
2945
3006
|
const queued = jobs.filter((job) => job.status === "queued");
|
|
@@ -2965,14 +3026,14 @@ function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), exp
|
|
|
2965
3026
|
` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
|
|
2966
3027
|
...widgetLaneDetailLines(job, theme, projection),
|
|
2967
3028
|
...workflowChecklistWidgetLines(widgetChecklistWithoutMaterializedChildren(projection), theme, " ", expanded, frame, { includeItemErrors: !expanded || !job.steps?.length, liveWidget: true }),
|
|
2968
|
-
...widgetParallelAgentDetails(job, theme, expanded, width, frame),
|
|
3029
|
+
...widgetParallelAgentDetails(job, theme, expanded, width, frame, fullTask),
|
|
2969
3030
|
];
|
|
2970
3031
|
const item = [
|
|
2971
3032
|
compactWorkflow
|
|
2972
3033
|
? compactWorkflowHeaderLine(job, theme, width)
|
|
2973
3034
|
: `${widgetStatusGlyph(job, theme, frame)} ${themeBold(theme, widgetJobName(job))}${contextModeBadge(theme, job.context)}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`,
|
|
2974
3035
|
...details,
|
|
2975
|
-
...materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor),
|
|
3036
|
+
...materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor, fullTask),
|
|
2976
3037
|
];
|
|
2977
3038
|
items.push(item);
|
|
2978
3039
|
if (compactWorkflow)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeModelSegment, resolveModelCandidate } from "../runs/shared/model-resolution.js";
|
|
1
|
+
import { knownModelProviders, normalizeModelSegment, resolveModelCandidate } from "../runs/shared/model-resolution.js";
|
|
2
2
|
import { getSupportedThinkingLevels, splitKnownThinkingSuffix, THINKING_LEVELS, toModelInfo, } from "../shared/model-info.js";
|
|
3
3
|
export const STRONG_WATCHDOG_THINKING = "high";
|
|
4
4
|
const STRONG_WATCHDOG_MODELS = {
|
|
@@ -53,7 +53,7 @@ export function resolveWatchdogModelInput(ctx, rawModel) {
|
|
|
53
53
|
throw new Error("Watchdog model must be a non-empty provider/model value.");
|
|
54
54
|
const availableModels = modelRegistryEntries(ctx);
|
|
55
55
|
const preferredProvider = typeof ctx.model?.provider === "string" ? ctx.model.provider : undefined;
|
|
56
|
-
const resolved = resolveModelCandidate(trimmed, availableModels, preferredProvider) ?? trimmed;
|
|
56
|
+
const resolved = resolveModelCandidate(trimmed, availableModels, preferredProvider, knownModelProviders(ctx.modelRegistry)) ?? trimmed;
|
|
57
57
|
const { baseModel, thinkingSuffix } = splitKnownThinkingSuffix(resolved);
|
|
58
58
|
const named = splitProviderModel(baseModel);
|
|
59
59
|
if (!named)
|
package/src/watchdog/review.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Agent } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import { createReadOnlyTools, convertToLlm } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
|
-
import { resolveModelCandidate } from "../runs/shared/model-resolution.js";
|
|
4
|
+
import { knownModelProviders, resolveModelCandidate } from "../runs/shared/model-resolution.js";
|
|
5
5
|
import { agentStreamOptions } from "../shared/agent-stream-options.js";
|
|
6
6
|
import { opencodeSessionHeaders } from "../shared/opencode-session-headers.js";
|
|
7
7
|
import { resolveEffectiveThinking, splitKnownThinkingSuffix, THINKING_LEVELS, toModelInfo } from "../shared/model-info.js";
|
|
@@ -54,7 +54,7 @@ function resolveReviewThinking(input) {
|
|
|
54
54
|
function resolveConfiguredModel(ctx, rawModel) {
|
|
55
55
|
const availableModels = ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
56
56
|
const preferredProvider = typeof ctx.model?.provider === "string" ? ctx.model.provider : undefined;
|
|
57
|
-
const resolved = resolveModelCandidate(rawModel, availableModels, preferredProvider);
|
|
57
|
+
const resolved = resolveModelCandidate(rawModel, availableModels, preferredProvider, knownModelProviders(ctx.modelRegistry));
|
|
58
58
|
if (!resolved) {
|
|
59
59
|
throw new Error(`Configured watchdog model '${rawModel}' did not match exactly one authenticated available model. Use provider/model or configure credentials for the intended provider.`);
|
|
60
60
|
}
|
|
@@ -184,6 +184,8 @@ export interface RunWorkflowScriptOptions {
|
|
|
184
184
|
set: (key: string, value: unknown) => void | Promise<void>;
|
|
185
185
|
};
|
|
186
186
|
registerStopChild?: (stop: ((key: string, message?: string) => boolean) | undefined) => void;
|
|
187
|
+
/** Drain: stop children that have not started, refuse new launches, and call `onDrained` once every started child has a result. Returns the started-child count. */
|
|
188
|
+
registerDrain?: (drain: ((onDrained: () => void) => number) | undefined) => void;
|
|
187
189
|
onTrace?: (trace: WorkflowScriptTraceEntry[]) => void;
|
|
188
190
|
onLanePlan?: (lanes: WorkflowLanePlan[]) => void;
|
|
189
191
|
onEmit?: (emits: unknown[]) => void;
|