pi-subagents 0.84.0 → 0.86.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 +83 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-JG4QKI5M.js → chunk-2IYBCYFU.js} +214 -97
- package/bundle/{chunk-V2BZYLEP.js → chunk-374MZFF4.js} +7 -2
- package/bundle/{chunk-4E7BKDTX.js → chunk-3RKFH2UZ.js} +11 -156
- package/bundle/{chunk-F4ASL6OV.js → chunk-5H4BICQZ.js} +1 -1
- package/bundle/{chunk-PALJGGYC.js → chunk-6VD7BGIC.js} +6 -3
- package/bundle/{chunk-C5P5CHYK.js → chunk-77ASNIEM.js} +1 -1
- package/bundle/{chunk-XDQORLZ5.js → chunk-7ADDXUGF.js} +15 -6
- package/bundle/{chunk-PV63UFUR.js → chunk-7QA7ZA46.js} +183 -28
- package/bundle/{chunk-NKQ6JNAS.js → chunk-7ZUFN6ME.js} +2 -1
- package/bundle/{chunk-SSG7IEP5.js → chunk-A637IMAO.js} +2 -2
- package/bundle/{chunk-L3WFKBEI.js → chunk-BGXEAYUM.js} +247 -153
- package/bundle/{chunk-J5YL7LYR.js → chunk-BU6PFPVX.js} +59 -27
- package/bundle/{chunk-DZDETGRJ.js → chunk-BWC2LVII.js} +259 -216
- package/bundle/{chunk-CGN2TVE7.js → chunk-GJGTMLPE.js} +322 -18
- package/bundle/{chunk-D3JAFGMO.js → chunk-GRJHIXYF.js} +1 -1
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-LFDBD4PW.js → chunk-LGINOOY5.js} +2 -2
- package/bundle/{chunk-G2Z6ZH26.js → chunk-NAFLUJ26.js} +1 -1
- package/bundle/{chunk-235AWJUQ.js → chunk-O3YH7XIY.js} +324 -111
- package/bundle/{chunk-2DHZTCOL.js → chunk-PYOAIN3V.js} +2 -2
- package/bundle/{chunk-LNRJCP2Y.js → chunk-QGO6HXHG.js} +417 -242
- package/bundle/{chunk-VQVVHSY6.js → chunk-QM3JGE4W.js} +22 -11
- package/bundle/{chunk-2S4K53MV.js → chunk-S2Q75LP3.js} +1 -1
- package/bundle/{chunk-NENDSQUY.js → chunk-UR7OW5S7.js} +9 -6
- package/bundle/{chunk-AKOIVLA5.js → chunk-WN2E5XHN.js} +135 -77
- package/bundle/{chunk-2D52JFLF.js → chunk-YK3QYNLE.js} +41 -117
- package/bundle/{chunk-7BWGNDNK.js → chunk-ZJJCPV3L.js} +190 -1177
- package/bundle/chunk-ZPY5QZCS.js +1067 -0
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +8 -8
- package/bundle/project-panes.js +3 -3
- package/docs/agents.md +23 -2
- package/docs/configuration.md +4 -4
- package/docs/extension-api.md +16 -1
- package/docs/tool-reference.md +2 -0
- package/docs/workflows.md +30 -2
- package/package.json +1 -1
- package/src/agents/agent-management.js +27 -11
- package/src/agents/agent-memory.d.ts +1 -4
- package/src/agents/agent-memory.js +1 -4
- package/src/agents/agents.d.ts +1 -3
- package/src/agents/agents.js +7 -6
- package/src/agents/frontmatter.js +1 -8
- package/src/agents/global-npm-root.d.ts +1 -0
- package/src/agents/global-npm-root.js +11 -3
- package/src/agents/skills.d.ts +0 -3
- package/src/agents/skills.js +0 -3
- package/src/extension/config.js +7 -1
- package/src/extension/herdr-pi-bridge.js +10 -2
- package/src/extension/index.d.ts +0 -13
- package/src/extension/index.js +43 -32
- package/src/extension/public-execution.d.ts +1 -0
- package/src/extension/public-execution.js +4 -0
- package/src/extension/reply-workflow-script.js +24 -4
- package/src/extension/schemas.d.ts +8 -3
- package/src/extension/schemas.js +5 -3
- package/src/extension/session-switch.d.ts +25 -0
- package/src/extension/session-switch.js +138 -0
- package/src/extension/subagent-guide.d.ts +1 -1
- package/src/extension/subagent-guide.js +1 -1
- package/src/extension/subagent-launch-tool.d.ts +25 -0
- package/src/extension/subagent-launch-tool.js +48 -0
- package/src/extension/tool-activation.js +35 -12
- package/src/extension/tool-description.d.ts +1 -1
- package/src/extension/tool-description.js +14 -8
- package/src/inspectors/herdr/actions.d.ts +0 -1
- package/src/inspectors/herdr/actions.js +0 -1
- package/src/inspectors/session-roots-codec.d.ts +0 -1
- package/src/inspectors/session-roots-codec.js +0 -1
- package/src/inspectors/tmux/actions.d.ts +0 -1
- package/src/inspectors/tmux/actions.js +0 -1
- package/src/integrations/herdr-status.js +3 -8
- package/src/intercom/native-supervisor-channel.js +65 -9
- package/src/runs/background/async-execution.d.ts +5 -9
- package/src/runs/background/async-execution.js +62 -27
- package/src/runs/background/async-job-tracker.js +12 -0
- package/src/runs/background/async-resume.d.ts +2 -1
- package/src/runs/background/async-resume.js +112 -39
- package/src/runs/background/async-retention.js +6 -1
- package/src/runs/background/auto-drain.js +2 -1
- package/src/runs/background/boot-id.d.ts +1 -3
- package/src/runs/background/boot-id.js +1 -3
- package/src/runs/background/completion-batcher.d.ts +3 -4
- package/src/runs/background/completion-batcher.js +2 -3
- package/src/runs/background/control-channel.d.ts +0 -6
- package/src/runs/background/control-channel.js +0 -6
- package/src/runs/background/fleet-view.js +2 -3
- package/src/runs/background/notify.d.ts +0 -2
- package/src/runs/background/notify.js +0 -2
- package/src/runs/background/result-watcher.d.ts +1 -0
- package/src/runs/background/result-watcher.js +59 -29
- package/src/runs/background/resume-guidance.js +4 -2
- package/src/runs/background/retained-children.js +2 -1
- package/src/runs/background/run-child-session.d.ts +0 -1
- package/src/runs/background/run-child-session.js +1 -1
- package/src/runs/background/run-status.js +9 -7
- package/src/runs/background/scheduled-runs.d.ts +3 -1
- package/src/runs/background/scheduled-runs.js +13 -16
- package/src/runs/background/subagent-runner.d.ts +2 -4
- package/src/runs/background/subagent-runner.js +15 -12
- package/src/runs/background/subagent-wait.js +12 -15
- package/src/runs/background/wait-config.d.ts +2 -0
- package/src/runs/background/wait-config.js +17 -3
- package/src/runs/background/wait-tool.js +4 -2
- package/src/runs/background/workflow-terminal-proof.d.ts +0 -1
- package/src/runs/background/workflow-terminal-proof.js +0 -1
- package/src/runs/foreground/execution.d.ts +0 -3
- package/src/runs/foreground/execution.js +17 -9
- package/src/runs/foreground/subagent-executor.d.ts +3 -2
- package/src/runs/foreground/subagent-executor.js +107 -26
- package/src/runs/shared/acceptance.js +69 -26
- package/src/runs/shared/child-commands.js +15 -2
- package/src/runs/shared/child-hooks.d.ts +1 -7
- package/src/runs/shared/child-hooks.js +13 -5
- package/src/runs/shared/child-launch.js +6 -2
- package/src/runs/shared/child-runtime-config.d.ts +0 -1
- package/src/runs/shared/child-session.d.ts +1 -1
- package/src/runs/shared/child-session.js +21 -2
- package/src/runs/shared/child-tool-plan.d.ts +0 -1
- package/src/runs/shared/child-tool-plan.js +0 -1
- package/src/runs/shared/claude-code-adapter.js +11 -0
- 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/external-cli-runner.js +26 -6
- package/src/runs/shared/herdr-connection.js +2 -1
- package/src/runs/shared/herdr-pane-host.d.ts +2 -2
- package/src/runs/shared/herdr-pane-host.js +17 -1
- package/src/runs/shared/herdr-placed-run.js +48 -22
- package/src/runs/shared/lane-metadata.d.ts +0 -1
- package/src/runs/shared/lane-metadata.js +0 -1
- package/src/runs/shared/mcp-direct-tool-grant.js +8 -1
- package/src/runs/shared/model-resolution-diagnostic.d.ts +0 -1
- package/src/runs/shared/model-resolution.d.ts +2 -2
- package/src/runs/shared/model-resolution.js +7 -1
- package/src/runs/shared/model-scope.d.ts +1 -5
- package/src/runs/shared/model-scope.js +1 -5
- package/src/runs/shared/mutation-evidence.d.ts +1 -1
- package/src/runs/shared/mutation-evidence.js +52 -7
- package/src/runs/shared/nested-events.d.ts +1 -0
- package/src/runs/shared/nested-events.js +1 -1
- package/src/runs/shared/parallel-utils.d.ts +0 -1
- package/src/runs/shared/permissions.js +5 -3
- package/src/runs/shared/placement-host.d.ts +5 -1
- package/src/runs/shared/rex-pane-host.d.ts +0 -1
- package/src/runs/shared/rex-pane-host.js +0 -2
- package/src/runs/shared/run-launch-folder.d.ts +12 -0
- package/src/runs/shared/run-launch-folder.js +21 -0
- package/src/runs/shared/runner-launcher.d.ts +12 -1
- package/src/runs/shared/runner-launcher.js +16 -0
- package/src/runs/shared/single-output.d.ts +3 -3
- package/src/runs/shared/single-output.js +5 -3
- package/src/runs/shared/structured-output.d.ts +8 -0
- package/src/runs/shared/structured-output.js +40 -5
- package/src/runs/shared/subagent-prompt-runtime.d.ts +0 -1
- package/src/runs/shared/subagent-prompt-runtime.js +4 -2
- package/src/runs/shared/tool-timeout.js +2 -1
- package/src/runs/shared/worktree-cleanup-plan.d.ts +0 -1
- package/src/runs/shared/worktree-cleanup-plan.js +0 -1
- package/src/runs/shared/worktree.d.ts +3 -0
- package/src/runs/shared/worktree.js +20 -0
- package/src/shared/capacity-resilient-json.d.ts +1 -1
- package/src/shared/child-cache-retention.d.ts +1 -2
- package/src/shared/child-cache-retention.js +1 -2
- package/src/shared/fleet-transcript-reader.d.ts +51 -0
- package/src/shared/fleet-transcript-reader.js +333 -0
- package/src/shared/formatters.d.ts +0 -18
- package/src/shared/formatters.js +0 -18
- package/src/shared/session-succession.d.ts +16 -1
- package/src/shared/session-succession.js +41 -2
- package/src/shared/session-warnings.d.ts +7 -0
- package/src/shared/session-warnings.js +26 -0
- package/src/shared/settings.d.ts +0 -23
- package/src/shared/settings.js +3 -35
- package/src/shared/types.d.ts +85 -59
- package/src/shared/types.js +0 -12
- package/src/shared/utils.d.ts +0 -14
- package/src/shared/utils.js +0 -22
- package/src/shared/wait-tool-name.d.ts +8 -0
- package/src/shared/wait-tool-name.js +13 -0
- package/src/slash/slash-commands.js +2 -1
- package/src/slash/subagent-cost.d.ts +3 -2
- package/src/slash/subagent-cost.js +22 -3
- package/src/slash/subagents-admin.js +0 -1
- package/src/tui/fleet-status.d.ts +0 -5
- package/src/tui/fleet-status.js +4 -24
- package/src/tui/fleet-transcript.d.ts +1 -44
- package/src/tui/fleet-transcript.js +1 -327
- package/src/tui/fleet.js +6 -4
- package/src/tui/render.d.ts +0 -9
- package/src/tui/render.js +161 -66
- package/src/tui/subagent-messages.js +3 -2
- package/src/watchdog/register-child.d.ts +2 -3
- package/src/watchdog/register-child.js +2 -3
- package/src/watchdog/turn-delta.js +2 -1
- package/src/workflows/scripted-workflow.js +241 -20
- package/src/workflows/workflow-launch-record.d.ts +15 -6
- package/src/workflows/workflow-launch-record.js +30 -12
- package/src/workflows/workflow-receipt.js +36 -53
- package/src/workflows/workflow-resume-claim.js +2 -2
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +11 -8
- package/src/workflows/workflow-script-worker.d.ts +13 -0
- package/src/workflows/workflow-script-worker.js +79 -0
- package/workflow-script-process.cjs +36 -0
- package/workflow-script-worker.cjs +4 -1
package/src/tui/render.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rendering functions for subagent results
|
|
3
|
-
*/
|
|
4
1
|
import * as path from "node:path";
|
|
5
2
|
import { createHash } from "node:crypto";
|
|
6
3
|
import { getMarkdownTheme, keyText } from "@earendil-works/pi-coding-agent";
|
|
@@ -248,6 +245,33 @@ export function compactTaskText(task, label) {
|
|
|
248
245
|
return undefined;
|
|
249
246
|
return previewDisplayText(normalized, COMPACT_TASK_MAX_CHARS);
|
|
250
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
|
+
}
|
|
251
275
|
const LANE_VALUE_MAX_CHARS = 48;
|
|
252
276
|
function boundedLaneValue(value, maxChars = LANE_VALUE_MAX_CHARS) {
|
|
253
277
|
if (!value?.trim() || value.trim() === PROMPT_REDACTED)
|
|
@@ -729,6 +753,31 @@ function visibleWorkflowRows(rows) {
|
|
|
729
753
|
hiddenRows: rows.length - selected.size,
|
|
730
754
|
};
|
|
731
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Lines for at most `cap` rows: every unfinished row plus the newest finished ones, in order, with the
|
|
758
|
+
* older finished rows folded into one line, because live widgets list rows oldest first. When unfinished
|
|
759
|
+
* rows alone fill `cap`, only they are returned, possibly more than `cap`.
|
|
760
|
+
*/
|
|
761
|
+
function foldEarlierDoneLines(rows, cap, line, foldLine) {
|
|
762
|
+
if (rows.length <= cap)
|
|
763
|
+
return rows.map(line);
|
|
764
|
+
const unfinished = rows.filter((row) => row.state !== "complete");
|
|
765
|
+
if (unfinished.length >= cap)
|
|
766
|
+
return unfinished.map(line);
|
|
767
|
+
// rows.length > cap, so at least two rows fold into the one line.
|
|
768
|
+
const hidden = rows.length - cap + 1;
|
|
769
|
+
const lines = [];
|
|
770
|
+
let skipped = 0;
|
|
771
|
+
for (const row of rows) {
|
|
772
|
+
if (skipped < hidden && row.state === "complete") {
|
|
773
|
+
if (++skipped === hidden)
|
|
774
|
+
lines.push(foldLine(hidden));
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
lines.push(line(row));
|
|
778
|
+
}
|
|
779
|
+
return lines;
|
|
780
|
+
}
|
|
732
781
|
function snapshotNowForProgress(progress) {
|
|
733
782
|
if (progress.currentToolStartedAt !== undefined && progress.durationMs !== undefined)
|
|
734
783
|
return progress.currentToolStartedAt + progress.durationMs;
|
|
@@ -1258,6 +1307,7 @@ function workflowChecklistItemLine(item, theme, indent, frame, includeError) {
|
|
|
1258
1307
|
return `${indent}${workflowChecklistGlyph(item, theme, frame)} ${theme.bold(identity || item.key)}${context}${state}${details ? ` ${theme.fg("dim", `· ${details}`)}` : ""}`;
|
|
1259
1308
|
}
|
|
1260
1309
|
const COLLAPSED_WORKFLOW_PHASE_LIMIT = 4;
|
|
1310
|
+
const EXPANDED_WIDGET_DONE_ITEMS = 4;
|
|
1261
1311
|
function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame, options = {}) {
|
|
1262
1312
|
if (!checklist?.total)
|
|
1263
1313
|
return [];
|
|
@@ -1266,6 +1316,12 @@ function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame,
|
|
|
1266
1316
|
const includeBottleneckOutput = options.includeBottleneckOutput ?? expanded;
|
|
1267
1317
|
const includeItemErrors = options.includeItemErrors ?? true;
|
|
1268
1318
|
const lines = includeSummary ? [`${indent}${theme.fg("dim", `Checklist ${formatWorkflowChecklistSummary(checklist)}`)}`] : [];
|
|
1319
|
+
const bottleneck = formatWorkflowChecklistBottleneck(checklist.bottleneck, { includeOutput: includeBottleneckOutput, includeError: !expanded });
|
|
1320
|
+
const tone = checklist.bottleneck?.state === "blocked" || checklist.bottleneck?.state === "failed" ? "error" : checklist.bottleneck?.state === "running" ? "accent" : "warning";
|
|
1321
|
+
const bottleneckLine = bottleneck ? `${indent}${theme.fg(tone, `bottleneck · ${bottleneck}`)}` : undefined;
|
|
1322
|
+
const liveExpanded = expanded && options.liveWidget === true;
|
|
1323
|
+
if (liveExpanded && bottleneckLine)
|
|
1324
|
+
lines.push(bottleneckLine);
|
|
1269
1325
|
const phases = !limitPhases || checklist.phases.length <= COLLAPSED_WORKFLOW_PHASE_LIMIT
|
|
1270
1326
|
? checklist.phases
|
|
1271
1327
|
: checklist.phases
|
|
@@ -1287,16 +1343,14 @@ function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame,
|
|
|
1287
1343
|
}, theme, frame);
|
|
1288
1344
|
lines.push(`${indent}${glyph} ${theme.bold(formatWorkflowChecklistPhase(phase))}`);
|
|
1289
1345
|
if (expanded) {
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1346
|
+
const items = [...phase.items].sort((left, right) => workflowChecklistItemPriority(left.state) - workflowChecklistItemPriority(right.state));
|
|
1347
|
+
const line = (item) => workflowChecklistItemLine(item, theme, `${indent} `, frame, includeItemErrors || item.kind === "host");
|
|
1348
|
+
const cap = liveExpanded ? items.filter((item) => item.state !== "complete").length + EXPANDED_WIDGET_DONE_ITEMS + 1 : items.length;
|
|
1349
|
+
lines.push(...foldEarlierDoneLines(items, cap, line, (hidden) => `${indent} ${theme.fg("dim", `… ${hidden} earlier done`)}`));
|
|
1293
1350
|
}
|
|
1294
1351
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
const tone = checklist.bottleneck?.state === "blocked" || checklist.bottleneck?.state === "failed" ? "error" : checklist.bottleneck?.state === "running" ? "accent" : "warning";
|
|
1298
|
-
lines.push(`${indent}${theme.fg(tone, `bottleneck · ${bottleneck}`)}`);
|
|
1299
|
-
}
|
|
1352
|
+
if (!liveExpanded && bottleneckLine)
|
|
1353
|
+
lines.push(bottleneckLine);
|
|
1300
1354
|
return lines;
|
|
1301
1355
|
}
|
|
1302
1356
|
function compactWorkflowLaneState(items) {
|
|
@@ -1473,24 +1527,25 @@ function compactWorkflowHeaderLine(job, theme, width) {
|
|
|
1473
1527
|
return full;
|
|
1474
1528
|
return `${theme.fg("toolTitle", themeBold(theme, `async workflow ${label}`))} ${theme.fg("dim", "· background")}`;
|
|
1475
1529
|
}
|
|
1476
|
-
|
|
1530
|
+
/** `lineBudget` is the room left for these lines; older done lanes fold so the newest and active ones fit. */
|
|
1531
|
+
function compactWorkflowWidgetBodyLines(job, theme, frame, projection, lineBudget) {
|
|
1477
1532
|
const rows = compactWorkflowLaneRows(job, projection.checklist);
|
|
1478
1533
|
const lines = [` ${compactWorkflowStats(job, rows, theme, projection)}`];
|
|
1479
1534
|
if (projection.inlineFleetCovered)
|
|
1480
1535
|
return [...lines, ` ${theme.fg("dim", "Workflow children shown in Fleet roster")}`];
|
|
1536
|
+
const bottleneck = compactWorkflowBottleneck(rows, job);
|
|
1537
|
+
const hint = job.status === "running" || rows.some((row) => row.state === "running");
|
|
1481
1538
|
if (rows.length) {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
}
|
|
1539
|
+
const shown = rows.filter((row) => !projection.materializedKeys?.has(row.key));
|
|
1540
|
+
const cap = lineBudget === undefined ? shown.length : Math.max(1, lineBudget - lines.length - Number(Boolean(bottleneck)) - Number(hint));
|
|
1541
|
+
lines.push(...foldEarlierDoneLines(shown, cap, (row) => compactWorkflowLaneLine(row, theme, " ", frame), (hidden) => ` ${theme.fg("dim", `… ${hidden} earlier done`)}`));
|
|
1486
1542
|
}
|
|
1487
1543
|
else {
|
|
1488
1544
|
lines.push(` ${theme.fg("dim", "◦ waiting for workflow lanes")}`);
|
|
1489
1545
|
}
|
|
1490
|
-
const bottleneck = compactWorkflowBottleneck(rows, job);
|
|
1491
1546
|
if (bottleneck)
|
|
1492
1547
|
lines.push(` ${theme.fg(bottleneck.tone, `bottleneck · ${bottleneck.text}`)}`);
|
|
1493
|
-
if (
|
|
1548
|
+
if (hint)
|
|
1494
1549
|
lines.push(` ${theme.fg("accent", workflowDetailHintText())}`);
|
|
1495
1550
|
return lines;
|
|
1496
1551
|
}
|
|
@@ -1515,7 +1570,7 @@ function widgetStepActivity(step, snapshotNow) {
|
|
|
1515
1570
|
return activity;
|
|
1516
1571
|
return facts.join(" · ");
|
|
1517
1572
|
}
|
|
1518
|
-
function widgetChainDetails(job, theme, expanded = false, width = getTermWidth(), frame) {
|
|
1573
|
+
function widgetChainDetails(job, theme, expanded = false, width = getTermWidth(), frame, fullTask = false) {
|
|
1519
1574
|
if (!job.steps?.length)
|
|
1520
1575
|
return [];
|
|
1521
1576
|
const total = job.chainStepCount ?? job.steps.length;
|
|
@@ -1523,7 +1578,7 @@ function widgetChainDetails(job, theme, expanded = false, width = getTermWidth()
|
|
|
1523
1578
|
for (const span of buildAsyncChainStepSpans(total, job.steps.length, job.parallelGroups)) {
|
|
1524
1579
|
const steps = job.steps.slice(span.start, span.start + span.count);
|
|
1525
1580
|
if (span.isParallel) {
|
|
1526
|
-
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));
|
|
1527
1582
|
continue;
|
|
1528
1583
|
}
|
|
1529
1584
|
const step = steps[0];
|
|
@@ -1531,20 +1586,26 @@ function widgetChainDetails(job, theme, expanded = false, width = getTermWidth()
|
|
|
1531
1586
|
lines.push(` ${theme.fg("dim", `◦ Step ${span.stepIndex + 1}/${total}: pending`)}`);
|
|
1532
1587
|
continue;
|
|
1533
1588
|
}
|
|
1534
|
-
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 }));
|
|
1535
1590
|
}
|
|
1536
1591
|
return lines;
|
|
1537
1592
|
}
|
|
1538
|
-
function widgetParallelAgentDetails(job, theme, expanded = false, width = getTermWidth(), frame) {
|
|
1593
|
+
function widgetParallelAgentDetails(job, theme, expanded = false, width = getTermWidth(), frame, fullTask = false) {
|
|
1539
1594
|
if (!job.steps?.length)
|
|
1540
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, " "));
|
|
1541
1602
|
if (job.mode !== "parallel" && job.mode !== "chain")
|
|
1542
1603
|
return [];
|
|
1543
1604
|
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length)
|
|
1544
|
-
return widgetChainDetails(job, theme, expanded, width, frame);
|
|
1605
|
+
return widgetChainDetails(job, theme, expanded, width, frame, fullTask);
|
|
1545
1606
|
const group = activeParallelWidgetGroup(job);
|
|
1546
1607
|
if (group)
|
|
1547
|
-
return parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup));
|
|
1608
|
+
return parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup), fullTask);
|
|
1548
1609
|
const total = job.stepsTotal ?? job.steps.length;
|
|
1549
1610
|
const lines = [];
|
|
1550
1611
|
for (const [index, step] of job.steps.entries()) {
|
|
@@ -1556,6 +1617,7 @@ function widgetParallelAgentDetails(job, theme, expanded = false, width = getTer
|
|
|
1556
1617
|
const display = step.sessionName?.trim() || (label ? `${label} (${step.agent})` : step.agent);
|
|
1557
1618
|
const thinking = childThinkingLevel(step);
|
|
1558
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, " "));
|
|
1559
1621
|
const lane = projectAsyncLane(job, step);
|
|
1560
1622
|
if (lane)
|
|
1561
1623
|
lines.push(...formatLaneProjectionLines(lane, theme, " "));
|
|
@@ -1703,7 +1765,7 @@ function parallelWidgetGroupHeader(group, theme, frame) {
|
|
|
1703
1765
|
: "parallel group";
|
|
1704
1766
|
return ` ${widgetStepGlyph(status, theme, widgetStepsRunningSeed(group.steps), frame)} ${themeBold(theme, label)} ${theme.fg("dim", "·")} ${theme.fg("dim", formatParallelOutcome(group.steps, group.total))}`;
|
|
1705
1767
|
}
|
|
1706
|
-
function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, prioritizeActive) {
|
|
1768
|
+
function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, prioritizeActive, fullTask = false) {
|
|
1707
1769
|
const lines = [parallelWidgetGroupHeader(group, theme, frame)];
|
|
1708
1770
|
const rows = parallelWidgetStepRows(group.steps, group.total, prioritizeActive);
|
|
1709
1771
|
for (const [rowIndex, row] of rows.entries()) {
|
|
@@ -1714,6 +1776,7 @@ function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, p
|
|
|
1714
1776
|
detailIndent: " ",
|
|
1715
1777
|
rowMarker: marker,
|
|
1716
1778
|
includeCurrentPath: true,
|
|
1779
|
+
fullTask,
|
|
1717
1780
|
}));
|
|
1718
1781
|
}
|
|
1719
1782
|
for (let index = rows.length; index < group.total; index++) {
|
|
@@ -2204,7 +2267,9 @@ function formatNestedWidgetLines(children, theme, width, expanded, snapshotNow,
|
|
|
2204
2267
|
append(children, 0, "");
|
|
2205
2268
|
return lines.map((line) => truncLine(line, width));
|
|
2206
2269
|
}
|
|
2207
|
-
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) {
|
|
2208
2273
|
const rowIndent = options?.rowIndent ?? " ";
|
|
2209
2274
|
const detailIndent = options?.detailIndent ?? " ";
|
|
2210
2275
|
const thinking = childThinkingLevel(step);
|
|
@@ -2223,7 +2288,11 @@ function foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index, tota
|
|
|
2223
2288
|
const lane = projectAsyncLane(job, step);
|
|
2224
2289
|
if (lane)
|
|
2225
2290
|
lines.push(...formatLaneProjectionLines(lane, theme, detailIndent));
|
|
2226
|
-
|
|
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)}`);
|
|
2227
2296
|
if (task)
|
|
2228
2297
|
lines.push(`${detailIndent}${theme.fg("dim", `task: ${task}`)}`);
|
|
2229
2298
|
const activity = widgetStepActivityLine(step, width, expanded, job.updatedAt);
|
|
@@ -2286,7 +2355,7 @@ function hostStepWidgetLines(job, theme, indent) {
|
|
|
2286
2355
|
lines.push(`${indent}${theme.fg("dim", `… +${rows.length - visible.length} host steps hidden`)}`);
|
|
2287
2356
|
return lines;
|
|
2288
2357
|
}
|
|
2289
|
-
function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection = buildWorkflowWidgetProjection(job)) {
|
|
2358
|
+
function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection = buildWorkflowWidgetProjection(job), fullTask = false) {
|
|
2290
2359
|
const steps = projection.steps.filter((step) => !projection.materializedKeys?.has(step.workflowKey ?? "") && !projection.materializedKeys?.has(step.runId ?? ""));
|
|
2291
2360
|
const checklist = widgetChecklistWithoutMaterializedChildren(projection);
|
|
2292
2361
|
if (!expanded && job.mode === "workflow") {
|
|
@@ -2296,7 +2365,7 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2296
2365
|
const lane = projectAsyncLane(job, laneStepForJob(job, steps));
|
|
2297
2366
|
return [
|
|
2298
2367
|
...(expanded ? workflowPreflightLines(job) : []),
|
|
2299
|
-
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame),
|
|
2368
|
+
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { liveWidget: true }),
|
|
2300
2369
|
...(lane ? formatLaneProjectionLines(lane, theme, " ") : []),
|
|
2301
2370
|
...hostStepWidgetLines(job, theme, " "),
|
|
2302
2371
|
` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
|
|
@@ -2304,14 +2373,14 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2304
2373
|
];
|
|
2305
2374
|
}
|
|
2306
2375
|
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length)
|
|
2307
|
-
return widgetChainDetails(job, theme, expanded, width, frame);
|
|
2376
|
+
return widgetChainDetails(job, theme, expanded, width, frame, fullTask);
|
|
2308
2377
|
const lines = [
|
|
2309
2378
|
...(expanded ? workflowPreflightLines(job) : []),
|
|
2310
|
-
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { includeItemErrors: !expanded }),
|
|
2379
|
+
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { includeItemErrors: !expanded, liveWidget: true }),
|
|
2311
2380
|
];
|
|
2312
2381
|
const group = activeParallelWidgetGroup(job);
|
|
2313
2382
|
if (group) {
|
|
2314
|
-
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));
|
|
2315
2384
|
}
|
|
2316
2385
|
else {
|
|
2317
2386
|
const { stageProgress, plannedKeys } = projection;
|
|
@@ -2328,7 +2397,7 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2328
2397
|
const itemTitle = isPlannedStage ? "Stage" : "Step";
|
|
2329
2398
|
const displayIndex = isPlannedStage ? (step.index ?? index) + 1 : plannedKeys ? ++extraStepIndex : index + 1;
|
|
2330
2399
|
const displayTotal = isPlannedStage ? stageTotal : extraStepCount;
|
|
2331
|
-
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 }));
|
|
2332
2401
|
}
|
|
2333
2402
|
}
|
|
2334
2403
|
lines.push(...hostStepWidgetLines(job, theme, " "));
|
|
@@ -2339,9 +2408,10 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2339
2408
|
}
|
|
2340
2409
|
return lines;
|
|
2341
2410
|
}
|
|
2342
|
-
|
|
2411
|
+
/** `reservedLines` are lines the caller renders after these, such as materialized workflow children. */
|
|
2412
|
+
function buildSingleWidgetLines(job, theme, width, expanded, frame, projection = buildWorkflowWidgetProjection(job), reservedLines = 0, fullTask = false) {
|
|
2343
2413
|
if ((!expanded || projection.inlineFleetCovered) && job.mode === "workflow")
|
|
2344
|
-
return [compactWorkflowHeaderLine(job, theme, width), ...compactWorkflowWidgetBodyLines(job, theme, frame, projection)].map((line) => truncLine(line, width));
|
|
2414
|
+
return [compactWorkflowHeaderLine(job, theme, width), ...compactWorkflowWidgetBodyLines(job, theme, frame, projection, widgetLineBudget(expanded) - 1 - reservedLines)].map((line) => truncLine(line, width));
|
|
2345
2415
|
const stats = widgetStats(job, theme, projection, !expanded);
|
|
2346
2416
|
const count = job.mode === "workflow"
|
|
2347
2417
|
? projection.checklist?.total ?? projection.stageProgress?.total ?? job.stepsTotal ?? job.agents?.length ?? job.steps?.length
|
|
@@ -2356,7 +2426,7 @@ function buildSingleWidgetLines(job, theme, width, expanded, frame, projection =
|
|
|
2356
2426
|
return [
|
|
2357
2427
|
`${theme.fg("toolTitle", themeBold(theme, title))} ${theme.fg("dim", "· background")}`,
|
|
2358
2428
|
...(collapseDetails ? [] : [summary]),
|
|
2359
|
-
...foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection),
|
|
2429
|
+
...foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection, fullTask),
|
|
2360
2430
|
].map((line) => truncLine(line, width));
|
|
2361
2431
|
}
|
|
2362
2432
|
function compactSingleWidgetLines(job, theme, width, frame, projection = buildWorkflowWidgetProjection(job)) {
|
|
@@ -2632,10 +2702,9 @@ function buildProgressiveWidgetLines(jobs, theme, width, lockedRows, previousKey
|
|
|
2632
2702
|
lines.push(progressiveJobLine(job, theme, width, frame, projection, laneRows));
|
|
2633
2703
|
if (!laneRows || projection.inlineFleetCovered)
|
|
2634
2704
|
continue;
|
|
2635
|
-
const
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
spareRows -= shownLanes.length;
|
|
2705
|
+
const laneLines = foldEarlierDoneLines(laneRows, spareRows, (row) => truncLine(compactWorkflowLaneLine(row, theme, " ", frame), width), (hidden) => truncLine(` ${theme.fg("dim", `… ${hidden} earlier done`)}`, width)).slice(0, spareRows);
|
|
2706
|
+
lines.push(...laneLines);
|
|
2707
|
+
spareRows -= laneLines.length;
|
|
2639
2708
|
}
|
|
2640
2709
|
if (hiddenJobs.length > 0 && lines.length < rowCount)
|
|
2641
2710
|
lines.push(progressiveHiddenLine(hiddenJobs, theme, width));
|
|
@@ -2653,11 +2722,12 @@ function paddedWidgetLine(line, width) {
|
|
|
2653
2722
|
const text = ` ${truncLine(line, width - 2)} `;
|
|
2654
2723
|
return `${text}${" ".repeat(Math.max(0, width - visibleWidth(text)))}`;
|
|
2655
2724
|
}
|
|
2725
|
+
function widgetLineBudget(expanded) {
|
|
2726
|
+
const rows = currentTerminalRows();
|
|
2727
|
+
return expanded ? Math.max(12, Math.min(24, Math.floor(rows * 0.55))) : collapsedWidgetLineBudget(rows);
|
|
2728
|
+
}
|
|
2656
2729
|
function fitWidgetLineBudget(lines, theme, width, expanded) {
|
|
2657
|
-
const
|
|
2658
|
-
const budget = expanded
|
|
2659
|
-
? Math.max(12, Math.min(24, Math.floor(rows * 0.55)))
|
|
2660
|
-
: collapsedWidgetLineBudget(rows);
|
|
2730
|
+
const budget = widgetLineBudget(expanded);
|
|
2661
2731
|
if (lines.length <= budget)
|
|
2662
2732
|
return lines;
|
|
2663
2733
|
const visibleLines = Math.max(1, budget - 1);
|
|
@@ -2788,7 +2858,7 @@ function widgetChecklistWithoutMaterializedChildren(projection) {
|
|
|
2788
2858
|
return checklist;
|
|
2789
2859
|
return { ...checklist, phases: checklist.phases.map((phase) => ({ ...phase, items: phase.items.filter((item) => !materializedKeys.has(item.key)) })) };
|
|
2790
2860
|
}
|
|
2791
|
-
function materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor) {
|
|
2861
|
+
function materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor, fullTask = false) {
|
|
2792
2862
|
const { children, inlineFleetCovered } = projectionFor(job);
|
|
2793
2863
|
if (inlineFleetCovered || !children?.length)
|
|
2794
2864
|
return [];
|
|
@@ -2800,9 +2870,9 @@ function materializedWidgetChildLines(job, theme, width, expanded, frame, projec
|
|
|
2800
2870
|
const identity = child.workflowKey ?? child.asyncId;
|
|
2801
2871
|
const stats = widgetStats(child, theme, projection, !expanded);
|
|
2802
2872
|
lines.push(` ${last ? "└─" : "├─"} ${theme.bold(identity)} ${widgetStatusGlyph(child, theme, frame)} ${themeBold(theme, widgetJobName(child))}${contextModeBadge(theme, child.context)}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`);
|
|
2803
|
-
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))
|
|
2804
2874
|
lines.push(` ${last ? " " : "│ "}${detail}`);
|
|
2805
|
-
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))
|
|
2806
2876
|
lines.push(` ${detail}`);
|
|
2807
2877
|
}
|
|
2808
2878
|
if (shown.length < children.length)
|
|
@@ -2905,14 +2975,33 @@ function buildWidgetComponent(jobs, ui, initiallyCollapsed = false, layout) {
|
|
|
2905
2975
|
return component;
|
|
2906
2976
|
};
|
|
2907
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
|
+
}
|
|
2908
2995
|
function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), expanded = false, frame, projectionFor = workflowWidgetProjectionLookup()) {
|
|
2909
2996
|
if (jobs.length === 0)
|
|
2910
2997
|
return [];
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
];
|
|
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;
|
|
3001
|
+
if (jobs.length === 1) {
|
|
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];
|
|
3004
|
+
}
|
|
2916
3005
|
const running = jobs.filter((job) => job.status === "running");
|
|
2917
3006
|
const queued = jobs.filter((job) => job.status === "queued");
|
|
2918
3007
|
const finished = jobs.filter((job) => job.status !== "running" && job.status !== "queued");
|
|
@@ -2926,27 +3015,29 @@ function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), exp
|
|
|
2926
3015
|
let hiddenFinished = 0;
|
|
2927
3016
|
let queuedSummaryShown = false;
|
|
2928
3017
|
let slots = MAX_WIDGET_JOBS;
|
|
3018
|
+
const compactCards = [];
|
|
2929
3019
|
const appendJob = (job) => {
|
|
2930
3020
|
const projection = projectionFor(job);
|
|
2931
3021
|
const compactWorkflow = (!expanded || projection.inlineFleetCovered) && job.mode === "workflow";
|
|
2932
3022
|
const stats = compactWorkflow ? "" : widgetStats(job, theme, projection, !expanded);
|
|
2933
3023
|
const details = compactWorkflow
|
|
2934
|
-
?
|
|
2935
|
-
...compactWorkflowWidgetBodyLines(job, theme, frame, projection),
|
|
2936
|
-
]
|
|
3024
|
+
? compactWorkflowWidgetBodyLines(job, theme, frame, projection)
|
|
2937
3025
|
: [
|
|
2938
3026
|
` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
|
|
2939
3027
|
...widgetLaneDetailLines(job, theme, projection),
|
|
2940
|
-
...workflowChecklistWidgetLines(widgetChecklistWithoutMaterializedChildren(projection), theme, " ", expanded, frame, { includeItemErrors: !expanded || !job.steps?.length }),
|
|
2941
|
-
...widgetParallelAgentDetails(job, theme, expanded, width, frame),
|
|
3028
|
+
...workflowChecklistWidgetLines(widgetChecklistWithoutMaterializedChildren(projection), theme, " ", expanded, frame, { includeItemErrors: !expanded || !job.steps?.length, liveWidget: true }),
|
|
3029
|
+
...widgetParallelAgentDetails(job, theme, expanded, width, frame, fullTask),
|
|
2942
3030
|
];
|
|
2943
|
-
|
|
3031
|
+
const item = [
|
|
2944
3032
|
compactWorkflow
|
|
2945
3033
|
? compactWorkflowHeaderLine(job, theme, width)
|
|
2946
3034
|
: `${widgetStatusGlyph(job, theme, frame)} ${themeBold(theme, widgetJobName(job))}${contextModeBadge(theme, job.context)}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`,
|
|
2947
3035
|
...details,
|
|
2948
|
-
...materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor),
|
|
2949
|
-
]
|
|
3036
|
+
...materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor, fullTask),
|
|
3037
|
+
];
|
|
3038
|
+
items.push(item);
|
|
3039
|
+
if (compactWorkflow)
|
|
3040
|
+
compactCards.push({ item, job, projection, bodyLength: details.length });
|
|
2950
3041
|
};
|
|
2951
3042
|
for (const job of running) {
|
|
2952
3043
|
if (slots <= 0) {
|
|
@@ -2981,6 +3072,16 @@ function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), exp
|
|
|
2981
3072
|
parts.push(`${hiddenFinished} finished`);
|
|
2982
3073
|
items.push([theme.fg("dim", `+${hiddenTotal} more (${parts.join(", ")})`)]);
|
|
2983
3074
|
}
|
|
3075
|
+
// Fold the oldest done lanes of compact workflow cards by the overflow, so later cards and
|
|
3076
|
+
// materialized children stay inside the line budget.
|
|
3077
|
+
let overflow = 1 + items.reduce((sum, item) => sum + item.length, 0) - widgetLineBudget(expanded);
|
|
3078
|
+
for (const card of compactCards) {
|
|
3079
|
+
if (overflow <= 0)
|
|
3080
|
+
break;
|
|
3081
|
+
const body = compactWorkflowWidgetBodyLines(card.job, theme, frame, card.projection, card.bodyLength - overflow);
|
|
3082
|
+
card.item.splice(1, card.bodyLength, ...body);
|
|
3083
|
+
overflow -= card.bodyLength - body.length;
|
|
3084
|
+
}
|
|
2984
3085
|
for (let i = 0; i < items.length; i++) {
|
|
2985
3086
|
const item = items[i];
|
|
2986
3087
|
const last = i === items.length - 1;
|
|
@@ -2997,9 +3098,6 @@ export function buildWidgetLines(jobs, theme, width = getTermWidth(), expanded =
|
|
|
2997
3098
|
const { roots, projectionFor } = widgetJobTree(jobs, Date.now());
|
|
2998
3099
|
return buildWidgetLinesWithProjection(roots, theme, width, expanded, frame, projectionFor);
|
|
2999
3100
|
}
|
|
3000
|
-
/**
|
|
3001
|
-
* Render the async jobs widget
|
|
3002
|
-
*/
|
|
3003
3101
|
export function renderWidget(ctx, jobs, initiallyCollapsed = false, layout = "adaptive") {
|
|
3004
3102
|
// Advance round tracking on every widget update, including the empty-jobs
|
|
3005
3103
|
// cleanup path below, which never reaches container.render.
|
|
@@ -3382,9 +3480,6 @@ export function renderSubagentSummary(result, options, theme) {
|
|
|
3382
3480
|
: details?.mode || "subagent";
|
|
3383
3481
|
return new Text(truncLine(`${glyph} ${theme.fg("toolTitle", theme.bold(label))} ${theme.fg("dim", "·")} ${theme.fg(state === "failed" ? "error" : state === "completed" ? "success" : state === "running" ? "accent" : "warning", state)}`, getTermWidth() - 4), 0, 0);
|
|
3384
3482
|
}
|
|
3385
|
-
/**
|
|
3386
|
-
* Render a subagent result
|
|
3387
|
-
*/
|
|
3388
3483
|
export function renderSubagentResult(result, options, theme, frame, rendererConfig, foregroundDetachShortcut) {
|
|
3389
3484
|
const layout = resolveMainWindowRenderLayout(rendererConfig);
|
|
3390
3485
|
const compact = (component) => capCompactMainWindowResult(component, layout, theme, !options.expanded);
|
|
@@ -8,6 +8,7 @@ import { safeTerminalText } from "../shared/display-text.js";
|
|
|
8
8
|
import { formatWatchdogWarningRenderText, stateLabels } from "../watchdog/render.js";
|
|
9
9
|
import { SUBAGENT_WATCHDOG_WARNING_TYPE, WATCHDOG_WARNING_IMPORTANCES, WATCHDOG_WARNING_SEVERITIES } from "../watchdog/types.js";
|
|
10
10
|
import { normalizeWatchdogWarningDetails } from "../watchdog/warning-format.js";
|
|
11
|
+
import { waitToolName } from "../shared/wait-tool-name.js";
|
|
11
12
|
/**
|
|
12
13
|
* Theme colors for the label. Pi's themes offer few non-status colors that read
|
|
13
14
|
* apart, so asks and attention notices, both a child needing the parent, share one,
|
|
@@ -122,8 +123,8 @@ function supervisorReminderHeadline(details, status) {
|
|
|
122
123
|
}
|
|
123
124
|
function waitSubscriptionHeadline(details) {
|
|
124
125
|
if (!isRecord(details) || typeof details.runId !== "string" || typeof details.outcome !== "string")
|
|
125
|
-
return [
|
|
126
|
-
return [
|
|
126
|
+
return [`${waitToolName()} fired`];
|
|
127
|
+
return [`${waitToolName()}: run ${details.runId} `, { status: details.outcome }];
|
|
127
128
|
}
|
|
128
129
|
/** Workflow child notices saved before render details existed are read from their first line. */
|
|
129
130
|
function workflowChildHeadline(message) {
|
|
@@ -4,9 +4,8 @@ import { type ChildWatchdogConfig, type ChildWatchdogStatusEvent } from "./child
|
|
|
4
4
|
import { type ResolvedWatchdogConfig } from "./types.ts";
|
|
5
5
|
export declare function childResolvedConfig(config: ChildWatchdogConfig): ResolvedWatchdogConfig;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* child's event stream.
|
|
7
|
+
* Status events go to the sink the hosting process passed in the child runtime
|
|
8
|
+
* config; the host folds them into the child's event stream.
|
|
10
9
|
*/
|
|
11
10
|
export declare function registerChildWatchdog(pi: ExtensionAPI, childConfig: ChildWatchdogConfig | undefined, writeStatus: ((event: ChildWatchdogStatusEvent) => void) | undefined, structuredTerminal?: {
|
|
12
11
|
captured: boolean;
|
|
@@ -34,9 +34,8 @@ function childWarningDetails(details, config) {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* child's event stream.
|
|
37
|
+
* Status events go to the sink the hosting process passed in the child runtime
|
|
38
|
+
* config; the host folds them into the child's event stream.
|
|
40
39
|
*/
|
|
41
40
|
export function registerChildWatchdog(pi, childConfig, writeStatus, structuredTerminal) {
|
|
42
41
|
if (!childConfig)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SUBAGENT_WATCHDOG_WARNING_TYPE } from "./types.js";
|
|
2
|
+
import { waitToolName } from "../shared/wait-tool-name.js";
|
|
2
3
|
function textFromContent(content) {
|
|
3
4
|
if (typeof content === "string")
|
|
4
5
|
return content;
|
|
@@ -171,7 +172,7 @@ export function formatWatchdogOrchestrationActivity(event) {
|
|
|
171
172
|
const args = call.arguments;
|
|
172
173
|
if (!args || typeof args !== "object")
|
|
173
174
|
continue;
|
|
174
|
-
const eligible = call.name ===
|
|
175
|
+
const eligible = call.name === waitToolName()
|
|
175
176
|
|| (call.name === "subagent_supervisor" && ["pending", "list", "reply"].includes(args.action))
|
|
176
177
|
|| (call.name === "subagent" && (["status", "resume", "interrupt", "steer", "stop"].includes(args.action)
|
|
177
178
|
|| (args.action === undefined && (typeof args.agent === "string" || args.workflow !== undefined))));
|