@vicary/pi-subagents 0.84.0 → 0.85.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 +62 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/{chunk-F4ASL6OV.js → chunk-7MAE3DJV.js} +1 -1
- package/bundle/{chunk-7BWGNDNK.js → chunk-A7VJ5XXE.js} +196 -1183
- package/bundle/{chunk-DZDETGRJ.js → chunk-B3OOJJA6.js} +231 -182
- package/bundle/{chunk-4E7BKDTX.js → chunk-CS4O36CZ.js} +11 -156
- package/bundle/{chunk-G2Z6ZH26.js → chunk-GCSLVFCX.js} +1 -1
- package/bundle/{chunk-2S4K53MV.js → chunk-H2NLFTC5.js} +1 -1
- package/bundle/{chunk-NKQ6JNAS.js → chunk-HFTBF7SG.js} +2 -1
- package/bundle/{chunk-XDQORLZ5.js → chunk-HS4WPO6B.js} +15 -6
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-4NIY3BE6.js → chunk-JHBQ7N2L.js} +2 -2
- package/bundle/{chunk-J5YL7LYR.js → chunk-JO67XSKD.js} +59 -27
- package/bundle/{chunk-C5P5CHYK.js → chunk-KDMFBYFM.js} +1 -1
- package/bundle/{chunk-V2BZYLEP.js → chunk-KEY3UQMQ.js} +7 -2
- package/bundle/{chunk-NENDSQUY.js → chunk-KZ34KQQH.js} +9 -6
- package/bundle/{chunk-AKOIVLA5.js → chunk-L2ENOFVZ.js} +76 -58
- package/bundle/{chunk-CGN2TVE7.js → chunk-LGMILZNE.js} +322 -18
- package/bundle/{chunk-L3WFKBEI.js → chunk-LTPH2DXH.js} +247 -153
- package/bundle/{chunk-2D52JFLF.js → chunk-N7B2KD74.js} +41 -117
- package/bundle/{chunk-PV63UFUR.js → chunk-O7CPL6H4.js} +183 -28
- package/bundle/{chunk-D3JAFGMO.js → chunk-PHZP3KHB.js} +1 -1
- package/bundle/{chunk-2DHZTCOL.js → chunk-PVIVCDG2.js} +2 -2
- package/bundle/{chunk-LFDBD4PW.js → chunk-QO75KJBT.js} +2 -2
- package/bundle/{chunk-VQVVHSY6.js → chunk-QZL2ZZPM.js} +22 -11
- package/bundle/{chunk-PALJGGYC.js → chunk-RV5OGHLO.js} +6 -3
- package/bundle/chunk-T5V5BRCL.js +1067 -0
- package/bundle/{chunk-LNRJCP2Y.js → chunk-UX4SCV5N.js} +337 -207
- package/bundle/{chunk-RWPNQZHS.js → chunk-VEZMZDTW.js} +212 -102
- package/bundle/{chunk-RSLHTEQV.js → chunk-YZBCREP5.js} +310 -101
- 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 +18 -3
- package/docs/configuration.md +7 -7
- package/docs/extension-api.md +16 -1
- package/docs/observability.md +1 -1
- package/docs/tool-reference.md +1 -1
- package/docs/workflows.md +31 -3
- package/package.json +2 -2
- 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 +6 -4
- 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 +25 -11
- package/src/extension/tool-description.js +6 -0
- 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 -10
- package/src/runs/background/async-execution.js +63 -29
- 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.d.ts +0 -1
- package/src/runs/background/auto-drain.js +7 -6
- 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 +4 -3
- 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 +9 -6
- 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 +7 -8
- package/src/runs/foreground/subagent-executor.js +113 -44
- 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-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 +30 -2
- 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 +33 -17
- 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 +81 -47
- 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-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";
|
|
@@ -729,6 +726,31 @@ function visibleWorkflowRows(rows) {
|
|
|
729
726
|
hiddenRows: rows.length - selected.size,
|
|
730
727
|
};
|
|
731
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* Lines for at most `cap` rows: every unfinished row plus the newest finished ones, in order, with the
|
|
731
|
+
* older finished rows folded into one line, because live widgets list rows oldest first. When unfinished
|
|
732
|
+
* rows alone fill `cap`, only they are returned, possibly more than `cap`.
|
|
733
|
+
*/
|
|
734
|
+
function foldEarlierDoneLines(rows, cap, line, foldLine) {
|
|
735
|
+
if (rows.length <= cap)
|
|
736
|
+
return rows.map(line);
|
|
737
|
+
const unfinished = rows.filter((row) => row.state !== "complete");
|
|
738
|
+
if (unfinished.length >= cap)
|
|
739
|
+
return unfinished.map(line);
|
|
740
|
+
// rows.length > cap, so at least two rows fold into the one line.
|
|
741
|
+
const hidden = rows.length - cap + 1;
|
|
742
|
+
const lines = [];
|
|
743
|
+
let skipped = 0;
|
|
744
|
+
for (const row of rows) {
|
|
745
|
+
if (skipped < hidden && row.state === "complete") {
|
|
746
|
+
if (++skipped === hidden)
|
|
747
|
+
lines.push(foldLine(hidden));
|
|
748
|
+
continue;
|
|
749
|
+
}
|
|
750
|
+
lines.push(line(row));
|
|
751
|
+
}
|
|
752
|
+
return lines;
|
|
753
|
+
}
|
|
732
754
|
function snapshotNowForProgress(progress) {
|
|
733
755
|
if (progress.currentToolStartedAt !== undefined && progress.durationMs !== undefined)
|
|
734
756
|
return progress.currentToolStartedAt + progress.durationMs;
|
|
@@ -1258,6 +1280,7 @@ function workflowChecklistItemLine(item, theme, indent, frame, includeError) {
|
|
|
1258
1280
|
return `${indent}${workflowChecklistGlyph(item, theme, frame)} ${theme.bold(identity || item.key)}${context}${state}${details ? ` ${theme.fg("dim", `· ${details}`)}` : ""}`;
|
|
1259
1281
|
}
|
|
1260
1282
|
const COLLAPSED_WORKFLOW_PHASE_LIMIT = 4;
|
|
1283
|
+
const EXPANDED_WIDGET_DONE_ITEMS = 4;
|
|
1261
1284
|
function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame, options = {}) {
|
|
1262
1285
|
if (!checklist?.total)
|
|
1263
1286
|
return [];
|
|
@@ -1266,6 +1289,12 @@ function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame,
|
|
|
1266
1289
|
const includeBottleneckOutput = options.includeBottleneckOutput ?? expanded;
|
|
1267
1290
|
const includeItemErrors = options.includeItemErrors ?? true;
|
|
1268
1291
|
const lines = includeSummary ? [`${indent}${theme.fg("dim", `Checklist ${formatWorkflowChecklistSummary(checklist)}`)}`] : [];
|
|
1292
|
+
const bottleneck = formatWorkflowChecklistBottleneck(checklist.bottleneck, { includeOutput: includeBottleneckOutput, includeError: !expanded });
|
|
1293
|
+
const tone = checklist.bottleneck?.state === "blocked" || checklist.bottleneck?.state === "failed" ? "error" : checklist.bottleneck?.state === "running" ? "accent" : "warning";
|
|
1294
|
+
const bottleneckLine = bottleneck ? `${indent}${theme.fg(tone, `bottleneck · ${bottleneck}`)}` : undefined;
|
|
1295
|
+
const liveExpanded = expanded && options.liveWidget === true;
|
|
1296
|
+
if (liveExpanded && bottleneckLine)
|
|
1297
|
+
lines.push(bottleneckLine);
|
|
1269
1298
|
const phases = !limitPhases || checklist.phases.length <= COLLAPSED_WORKFLOW_PHASE_LIMIT
|
|
1270
1299
|
? checklist.phases
|
|
1271
1300
|
: checklist.phases
|
|
@@ -1287,16 +1316,14 @@ function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame,
|
|
|
1287
1316
|
}, theme, frame);
|
|
1288
1317
|
lines.push(`${indent}${glyph} ${theme.bold(formatWorkflowChecklistPhase(phase))}`);
|
|
1289
1318
|
if (expanded) {
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1319
|
+
const items = [...phase.items].sort((left, right) => workflowChecklistItemPriority(left.state) - workflowChecklistItemPriority(right.state));
|
|
1320
|
+
const line = (item) => workflowChecklistItemLine(item, theme, `${indent} `, frame, includeItemErrors || item.kind === "host");
|
|
1321
|
+
const cap = liveExpanded ? items.filter((item) => item.state !== "complete").length + EXPANDED_WIDGET_DONE_ITEMS + 1 : items.length;
|
|
1322
|
+
lines.push(...foldEarlierDoneLines(items, cap, line, (hidden) => `${indent} ${theme.fg("dim", `… ${hidden} earlier done`)}`));
|
|
1293
1323
|
}
|
|
1294
1324
|
}
|
|
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
|
-
}
|
|
1325
|
+
if (!liveExpanded && bottleneckLine)
|
|
1326
|
+
lines.push(bottleneckLine);
|
|
1300
1327
|
return lines;
|
|
1301
1328
|
}
|
|
1302
1329
|
function compactWorkflowLaneState(items) {
|
|
@@ -1473,24 +1500,25 @@ function compactWorkflowHeaderLine(job, theme, width) {
|
|
|
1473
1500
|
return full;
|
|
1474
1501
|
return `${theme.fg("toolTitle", themeBold(theme, `async workflow ${label}`))} ${theme.fg("dim", "· background")}`;
|
|
1475
1502
|
}
|
|
1476
|
-
|
|
1503
|
+
/** `lineBudget` is the room left for these lines; older done lanes fold so the newest and active ones fit. */
|
|
1504
|
+
function compactWorkflowWidgetBodyLines(job, theme, frame, projection, lineBudget) {
|
|
1477
1505
|
const rows = compactWorkflowLaneRows(job, projection.checklist);
|
|
1478
1506
|
const lines = [` ${compactWorkflowStats(job, rows, theme, projection)}`];
|
|
1479
1507
|
if (projection.inlineFleetCovered)
|
|
1480
1508
|
return [...lines, ` ${theme.fg("dim", "Workflow children shown in Fleet roster")}`];
|
|
1509
|
+
const bottleneck = compactWorkflowBottleneck(rows, job);
|
|
1510
|
+
const hint = job.status === "running" || rows.some((row) => row.state === "running");
|
|
1481
1511
|
if (rows.length) {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
}
|
|
1512
|
+
const shown = rows.filter((row) => !projection.materializedKeys?.has(row.key));
|
|
1513
|
+
const cap = lineBudget === undefined ? shown.length : Math.max(1, lineBudget - lines.length - Number(Boolean(bottleneck)) - Number(hint));
|
|
1514
|
+
lines.push(...foldEarlierDoneLines(shown, cap, (row) => compactWorkflowLaneLine(row, theme, " ", frame), (hidden) => ` ${theme.fg("dim", `… ${hidden} earlier done`)}`));
|
|
1486
1515
|
}
|
|
1487
1516
|
else {
|
|
1488
1517
|
lines.push(` ${theme.fg("dim", "◦ waiting for workflow lanes")}`);
|
|
1489
1518
|
}
|
|
1490
|
-
const bottleneck = compactWorkflowBottleneck(rows, job);
|
|
1491
1519
|
if (bottleneck)
|
|
1492
1520
|
lines.push(` ${theme.fg(bottleneck.tone, `bottleneck · ${bottleneck.text}`)}`);
|
|
1493
|
-
if (
|
|
1521
|
+
if (hint)
|
|
1494
1522
|
lines.push(` ${theme.fg("accent", workflowDetailHintText())}`);
|
|
1495
1523
|
return lines;
|
|
1496
1524
|
}
|
|
@@ -2296,7 +2324,7 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2296
2324
|
const lane = projectAsyncLane(job, laneStepForJob(job, steps));
|
|
2297
2325
|
return [
|
|
2298
2326
|
...(expanded ? workflowPreflightLines(job) : []),
|
|
2299
|
-
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame),
|
|
2327
|
+
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { liveWidget: true }),
|
|
2300
2328
|
...(lane ? formatLaneProjectionLines(lane, theme, " ") : []),
|
|
2301
2329
|
...hostStepWidgetLines(job, theme, " "),
|
|
2302
2330
|
` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
|
|
@@ -2307,7 +2335,7 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2307
2335
|
return widgetChainDetails(job, theme, expanded, width, frame);
|
|
2308
2336
|
const lines = [
|
|
2309
2337
|
...(expanded ? workflowPreflightLines(job) : []),
|
|
2310
|
-
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { includeItemErrors: !expanded }),
|
|
2338
|
+
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { includeItemErrors: !expanded, liveWidget: true }),
|
|
2311
2339
|
];
|
|
2312
2340
|
const group = activeParallelWidgetGroup(job);
|
|
2313
2341
|
if (group) {
|
|
@@ -2339,9 +2367,10 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2339
2367
|
}
|
|
2340
2368
|
return lines;
|
|
2341
2369
|
}
|
|
2342
|
-
|
|
2370
|
+
/** `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) {
|
|
2343
2372
|
if ((!expanded || projection.inlineFleetCovered) && job.mode === "workflow")
|
|
2344
|
-
return [compactWorkflowHeaderLine(job, theme, width), ...compactWorkflowWidgetBodyLines(job, theme, frame, projection)].map((line) => truncLine(line, width));
|
|
2373
|
+
return [compactWorkflowHeaderLine(job, theme, width), ...compactWorkflowWidgetBodyLines(job, theme, frame, projection, widgetLineBudget(expanded) - 1 - reservedLines)].map((line) => truncLine(line, width));
|
|
2345
2374
|
const stats = widgetStats(job, theme, projection, !expanded);
|
|
2346
2375
|
const count = job.mode === "workflow"
|
|
2347
2376
|
? projection.checklist?.total ?? projection.stageProgress?.total ?? job.stepsTotal ?? job.agents?.length ?? job.steps?.length
|
|
@@ -2632,10 +2661,9 @@ function buildProgressiveWidgetLines(jobs, theme, width, lockedRows, previousKey
|
|
|
2632
2661
|
lines.push(progressiveJobLine(job, theme, width, frame, projection, laneRows));
|
|
2633
2662
|
if (!laneRows || projection.inlineFleetCovered)
|
|
2634
2663
|
continue;
|
|
2635
|
-
const
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
spareRows -= shownLanes.length;
|
|
2664
|
+
const laneLines = foldEarlierDoneLines(laneRows, spareRows, (row) => truncLine(compactWorkflowLaneLine(row, theme, " ", frame), width), (hidden) => truncLine(` ${theme.fg("dim", `… ${hidden} earlier done`)}`, width)).slice(0, spareRows);
|
|
2665
|
+
lines.push(...laneLines);
|
|
2666
|
+
spareRows -= laneLines.length;
|
|
2639
2667
|
}
|
|
2640
2668
|
if (hiddenJobs.length > 0 && lines.length < rowCount)
|
|
2641
2669
|
lines.push(progressiveHiddenLine(hiddenJobs, theme, width));
|
|
@@ -2653,11 +2681,12 @@ function paddedWidgetLine(line, width) {
|
|
|
2653
2681
|
const text = ` ${truncLine(line, width - 2)} `;
|
|
2654
2682
|
return `${text}${" ".repeat(Math.max(0, width - visibleWidth(text)))}`;
|
|
2655
2683
|
}
|
|
2684
|
+
function widgetLineBudget(expanded) {
|
|
2685
|
+
const rows = currentTerminalRows();
|
|
2686
|
+
return expanded ? Math.max(12, Math.min(24, Math.floor(rows * 0.55))) : collapsedWidgetLineBudget(rows);
|
|
2687
|
+
}
|
|
2656
2688
|
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);
|
|
2689
|
+
const budget = widgetLineBudget(expanded);
|
|
2661
2690
|
if (lines.length <= budget)
|
|
2662
2691
|
return lines;
|
|
2663
2692
|
const visibleLines = Math.max(1, budget - 1);
|
|
@@ -2908,11 +2937,10 @@ function buildWidgetComponent(jobs, ui, initiallyCollapsed = false, layout) {
|
|
|
2908
2937
|
function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), expanded = false, frame, projectionFor = workflowWidgetProjectionLookup()) {
|
|
2909
2938
|
if (jobs.length === 0)
|
|
2910
2939
|
return [];
|
|
2911
|
-
if (jobs.length === 1)
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
];
|
|
2940
|
+
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];
|
|
2943
|
+
}
|
|
2916
2944
|
const running = jobs.filter((job) => job.status === "running");
|
|
2917
2945
|
const queued = jobs.filter((job) => job.status === "queued");
|
|
2918
2946
|
const finished = jobs.filter((job) => job.status !== "running" && job.status !== "queued");
|
|
@@ -2926,27 +2954,29 @@ function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), exp
|
|
|
2926
2954
|
let hiddenFinished = 0;
|
|
2927
2955
|
let queuedSummaryShown = false;
|
|
2928
2956
|
let slots = MAX_WIDGET_JOBS;
|
|
2957
|
+
const compactCards = [];
|
|
2929
2958
|
const appendJob = (job) => {
|
|
2930
2959
|
const projection = projectionFor(job);
|
|
2931
2960
|
const compactWorkflow = (!expanded || projection.inlineFleetCovered) && job.mode === "workflow";
|
|
2932
2961
|
const stats = compactWorkflow ? "" : widgetStats(job, theme, projection, !expanded);
|
|
2933
2962
|
const details = compactWorkflow
|
|
2934
|
-
?
|
|
2935
|
-
...compactWorkflowWidgetBodyLines(job, theme, frame, projection),
|
|
2936
|
-
]
|
|
2963
|
+
? compactWorkflowWidgetBodyLines(job, theme, frame, projection)
|
|
2937
2964
|
: [
|
|
2938
2965
|
` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
|
|
2939
2966
|
...widgetLaneDetailLines(job, theme, projection),
|
|
2940
|
-
...workflowChecklistWidgetLines(widgetChecklistWithoutMaterializedChildren(projection), theme, " ", expanded, frame, { includeItemErrors: !expanded || !job.steps?.length }),
|
|
2967
|
+
...workflowChecklistWidgetLines(widgetChecklistWithoutMaterializedChildren(projection), theme, " ", expanded, frame, { includeItemErrors: !expanded || !job.steps?.length, liveWidget: true }),
|
|
2941
2968
|
...widgetParallelAgentDetails(job, theme, expanded, width, frame),
|
|
2942
2969
|
];
|
|
2943
|
-
|
|
2970
|
+
const item = [
|
|
2944
2971
|
compactWorkflow
|
|
2945
2972
|
? compactWorkflowHeaderLine(job, theme, width)
|
|
2946
2973
|
: `${widgetStatusGlyph(job, theme, frame)} ${themeBold(theme, widgetJobName(job))}${contextModeBadge(theme, job.context)}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`,
|
|
2947
2974
|
...details,
|
|
2948
2975
|
...materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor),
|
|
2949
|
-
]
|
|
2976
|
+
];
|
|
2977
|
+
items.push(item);
|
|
2978
|
+
if (compactWorkflow)
|
|
2979
|
+
compactCards.push({ item, job, projection, bodyLength: details.length });
|
|
2950
2980
|
};
|
|
2951
2981
|
for (const job of running) {
|
|
2952
2982
|
if (slots <= 0) {
|
|
@@ -2981,6 +3011,16 @@ function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), exp
|
|
|
2981
3011
|
parts.push(`${hiddenFinished} finished`);
|
|
2982
3012
|
items.push([theme.fg("dim", `+${hiddenTotal} more (${parts.join(", ")})`)]);
|
|
2983
3013
|
}
|
|
3014
|
+
// Fold the oldest done lanes of compact workflow cards by the overflow, so later cards and
|
|
3015
|
+
// materialized children stay inside the line budget.
|
|
3016
|
+
let overflow = 1 + items.reduce((sum, item) => sum + item.length, 0) - widgetLineBudget(expanded);
|
|
3017
|
+
for (const card of compactCards) {
|
|
3018
|
+
if (overflow <= 0)
|
|
3019
|
+
break;
|
|
3020
|
+
const body = compactWorkflowWidgetBodyLines(card.job, theme, frame, card.projection, card.bodyLength - overflow);
|
|
3021
|
+
card.item.splice(1, card.bodyLength, ...body);
|
|
3022
|
+
overflow -= card.bodyLength - body.length;
|
|
3023
|
+
}
|
|
2984
3024
|
for (let i = 0; i < items.length; i++) {
|
|
2985
3025
|
const item = items[i];
|
|
2986
3026
|
const last = i === items.length - 1;
|
|
@@ -2997,9 +3037,6 @@ export function buildWidgetLines(jobs, theme, width = getTermWidth(), expanded =
|
|
|
2997
3037
|
const { roots, projectionFor } = widgetJobTree(jobs, Date.now());
|
|
2998
3038
|
return buildWidgetLinesWithProjection(roots, theme, width, expanded, frame, projectionFor);
|
|
2999
3039
|
}
|
|
3000
|
-
/**
|
|
3001
|
-
* Render the async jobs widget
|
|
3002
|
-
*/
|
|
3003
3040
|
export function renderWidget(ctx, jobs, initiallyCollapsed = false, layout = "adaptive") {
|
|
3004
3041
|
// Advance round tracking on every widget update, including the empty-jobs
|
|
3005
3042
|
// cleanup path below, which never reaches container.render.
|
|
@@ -3382,9 +3419,6 @@ export function renderSubagentSummary(result, options, theme) {
|
|
|
3382
3419
|
: details?.mode || "subagent";
|
|
3383
3420
|
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
3421
|
}
|
|
3385
|
-
/**
|
|
3386
|
-
* Render a subagent result
|
|
3387
|
-
*/
|
|
3388
3422
|
export function renderSubagentResult(result, options, theme, frame, rendererConfig, foregroundDetachShortcut) {
|
|
3389
3423
|
const layout = resolveMainWindowRenderLayout(rendererConfig);
|
|
3390
3424
|
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))));
|