@xzzpig/pi-subagents 0.24.2 → 0.25.1
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 +37 -0
- package/bundle/agent-management.js +4 -4
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +2 -2
- package/bundle/chunk-34TUUBRN.js +1107 -0
- package/bundle/{chunk-SW2VMNIU.js → chunk-5OD3OWTE.js} +2 -2
- package/bundle/{chunk-EUPJB4S7.js → chunk-5Z7JAORM.js} +196 -1219
- package/bundle/{chunk-LCDJWBVM.js → chunk-66JNFRFS.js} +1 -1
- package/bundle/{chunk-ED55MIC2.js → chunk-CGFF4WA3.js} +42 -19
- package/bundle/{chunk-TMHVDPYW.js → chunk-DLVPMML3.js} +263 -154
- package/bundle/{chunk-RU522D5W.js → chunk-FQPV4O6C.js} +183 -28
- package/bundle/chunk-HXRB42AF.js +108 -0
- package/bundle/{chunk-355ECEP2.js → chunk-IH7LQVEE.js} +29 -14
- package/bundle/{chunk-Z6TFJ6BR.js → chunk-INWSUNI6.js} +1 -1
- package/bundle/{chunk-CYY5UMJU.js → chunk-IXCEOEJT.js} +411 -249
- package/bundle/{chunk-WW76JRIX.js → chunk-JAXVBXGF.js} +1 -1
- package/bundle/{chunk-ICNYIALB.js → chunk-JH5H4CYJ.js} +784 -474
- package/bundle/{chunk-224WMDIV.js → chunk-JUYNN63E.js} +350 -123
- package/bundle/{chunk-35GII5EF.js → chunk-JWFLPSTP.js} +41 -117
- package/bundle/{chunk-XWWUDWUW.js → chunk-KRNBJPZ2.js} +670 -400
- package/bundle/{chunk-RB4GELQA.js → chunk-LPJEKHOY.js} +1 -1
- package/bundle/chunk-LYKG4FKH.js +523 -0
- package/bundle/{chunk-X6LOM3Z4.js → chunk-LZ3HBDTR.js} +161 -78
- package/bundle/{chunk-JEA2ZKUA.js → chunk-MMJQMPOK.js} +37 -165
- package/bundle/{chunk-FG6SQJAR.js → chunk-OGPOCGWX.js} +24 -6
- package/bundle/{chunk-FJWI64H7.js → chunk-RMSABUN3.js} +27 -13
- package/bundle/{chunk-H36HBZB2.js → chunk-SJPABBZG.js} +2 -2
- package/bundle/{chunk-4UH4WS4G.js → chunk-SNDCIJMK.js} +23 -12
- package/bundle/{chunk-O4D5PBVI.js → chunk-TM2K53NX.js} +3 -2
- package/bundle/{chunk-3U633XDZ.js → chunk-U3ZDUUTM.js} +11 -3
- package/bundle/{chunk-LVWU2HOO.js → chunk-ULGMXABL.js} +16 -7
- package/bundle/{chunk-WPW4V6HM.js → chunk-W7ZA6TYD.js} +2 -2
- package/bundle/{chunk-BQ2OAB4Q.js → chunk-WWDUNXSE.js} +67 -30
- package/bundle/{chunk-V2KFIGFH.js → chunk-XAC2XNAP.js} +503 -304
- 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 +27 -6
- package/docs/configuration.md +20 -8
- package/docs/extension-api.md +18 -1
- package/docs/models.md +6 -2
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +7 -1
- package/docs/workflows.md +30 -2
- package/package.json +2 -2
- package/skills/pi-subagents/SKILL.md +15 -6
- package/skills/pi-subagents/references/prompting-and-roles.md +1 -0
- package/src/agents/agent-management.d.ts +1 -0
- package/src/agents/agent-management.js +46 -18
- package/src/agents/agent-memory.d.ts +1 -4
- package/src/agents/agent-memory.js +1 -4
- package/src/agents/agent-serializer.d.ts +2 -0
- package/src/agents/agent-serializer.js +1 -1
- package/src/agents/agents.d.ts +2 -3
- package/src/agents/agents.js +46 -20
- 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/api/preflight.d.ts +3 -1
- package/src/api/preflight.js +2 -0
- package/src/extension/config.d.ts +1 -0
- package/src/extension/config.js +13 -1
- package/src/extension/herdr-pi-bridge.js +10 -2
- package/src/extension/index.d.ts +0 -13
- package/src/extension/index.js +51 -37
- 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 +12 -3
- package/src/extension/schemas.js +7 -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 +55 -15
- 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 +7 -10
- package/src/runs/background/async-execution.js +66 -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 +114 -40
- package/src/runs/background/async-retention.d.ts +0 -2
- package/src/runs/background/async-retention.js +17 -6
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +4 -0
- 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 +2 -3
- package/src/runs/background/run-child-session.js +5 -8
- package/src/runs/background/run-status.js +9 -7
- package/src/runs/background/runner-aliases.js +15 -0
- package/src/runs/background/scheduled-runs.d.ts +3 -1
- package/src/runs/background/scheduled-runs.js +13 -16
- package/src/runs/background/steering.d.ts +2 -11
- package/src/runs/background/steering.js +11 -6
- package/src/runs/background/subagent-runner.d.ts +2 -6
- package/src/runs/background/subagent-runner.js +88 -70
- 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-subscriptions.js +124 -12
- 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/async-steering-action.js +24 -9
- package/src/runs/foreground/async-stop-action.d.ts +1 -1
- package/src/runs/foreground/async-stop-action.js +9 -1
- package/src/runs/foreground/execution.d.ts +0 -3
- package/src/runs/foreground/execution.js +68 -84
- package/src/runs/foreground/fork-tool-result-handler.d.ts +60 -0
- package/src/runs/foreground/fork-tool-result-handler.js +83 -0
- package/src/runs/foreground/prompt-audit.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +5 -10
- package/src/runs/foreground/subagent-executor.js +164 -49
- package/src/runs/shared/acceptance.js +69 -26
- package/src/runs/shared/async-status-projection.d.ts +2 -0
- package/src/runs/shared/async-status-projection.js +10 -0
- package/src/runs/shared/child-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 +6 -5
- package/src/runs/shared/child-session.js +85 -38
- 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 +51 -24
- package/src/runs/shared/lane-metadata.d.ts +0 -1
- package/src/runs/shared/lane-metadata.js +0 -1
- package/src/runs/shared/mcp-config-sources.d.ts +4 -1
- package/src/runs/shared/mcp-config-sources.js +1 -1
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +0 -3
- package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -17
- package/src/runs/shared/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 +20 -5
- package/src/runs/shared/model-resolution.js +55 -50
- 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 +18 -4
- package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
- package/src/runs/shared/supervisor-wait-timer.js +61 -0
- 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/artifacts.d.ts +1 -0
- package/src/shared/artifacts.js +132 -22
- 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 +64 -0
- package/src/shared/fleet-transcript-reader.js +376 -0
- package/src/shared/formatters.d.ts +0 -18
- package/src/shared/formatters.js +0 -18
- package/src/shared/pruned-fork.js +2 -2
- package/src/shared/reported-progress.d.ts +1 -0
- package/src/shared/reported-progress.js +12 -0
- package/src/shared/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/status-format.d.ts +1 -0
- package/src/shared/status-format.js +1 -1
- package/src/shared/types.d.ts +108 -59
- package/src/shared/types.js +0 -12
- package/src/shared/utils.d.ts +3 -15
- package/src/shared/utils.js +4 -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-native-transcript.js +1 -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 -57
- package/src/tui/fleet-transcript.js +4 -370
- package/src/tui/fleet.js +6 -4
- package/src/tui/render.d.ts +0 -9
- package/src/tui/render.js +194 -68
- package/src/tui/subagent-messages.js +3 -2
- package/src/watchdog/model-selection.js +2 -2
- package/src/watchdog/permission-arbiter.js +1 -0
- package/src/watchdog/register-child.d.ts +2 -3
- package/src/watchdog/register-child.js +2 -3
- package/src/watchdog/review.d.ts +0 -5
- package/src/watchdog/review.js +4 -3
- package/src/watchdog/turn-delta.js +2 -1
- package/src/workflows/scripted-workflow.d.ts +2 -0
- package/src/workflows/scripted-workflow.js +344 -59
- package/src/workflows/structured-workflow-scripts.d.ts +4 -3
- package/src/workflows/structured-workflow-scripts.js +32 -11
- 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-resources.js +4 -4
- package/src/workflows/workflow-resume-claim.d.ts +2 -0
- package/src/workflows/workflow-resume-claim.js +3 -3
- package/src/workflows/workflow-resume.d.ts +1 -1
- package/src/workflows/workflow-resume.js +13 -8
- package/src/workflows/workflow-script-worker.d.ts +13 -0
- package/src/workflows/workflow-script-worker.js +81 -0
- package/workflow-script-process.cjs +36 -0
- package/workflow-script-worker.cjs +4 -1
- package/bundle/chunk-U4ODUYAG.js +0 -235
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildWorkflowChatProgressRows
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ULGMXABL.js";
|
|
4
4
|
import {
|
|
5
5
|
aggregateStepStatus,
|
|
6
6
|
contextModeBadge,
|
|
7
7
|
contextModeLabel,
|
|
8
8
|
contextModePrefix,
|
|
9
|
+
formatActivityAge,
|
|
9
10
|
formatActivityLabel,
|
|
10
11
|
formatAgentRunningLabel,
|
|
11
12
|
formatNestedAggregate,
|
|
@@ -17,21 +18,23 @@ import {
|
|
|
17
18
|
formatWorkflowPreflightPlanSummary,
|
|
18
19
|
formatWorkflowPreflightWarningSummary,
|
|
19
20
|
formatWorkflowPreflightWarnings,
|
|
20
|
-
isStaleExtensionContextError,
|
|
21
|
-
isUnboundExtensionRuntimeError,
|
|
22
|
-
ownerSessionIds,
|
|
23
21
|
projectAsyncStatusSnapshot,
|
|
24
22
|
projectAsyncWorkflowRows,
|
|
25
23
|
projectWorkflowChecklist,
|
|
26
|
-
withCachedUiContext,
|
|
27
24
|
workflowGraphStageNodes
|
|
28
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-DLVPMML3.js";
|
|
26
|
+
import {
|
|
27
|
+
isStaleExtensionContextError,
|
|
28
|
+
isUnboundExtensionRuntimeError,
|
|
29
|
+
ownerSessionIds,
|
|
30
|
+
reportSessionWarning
|
|
31
|
+
} from "./chunk-HXRB42AF.js";
|
|
29
32
|
import {
|
|
30
33
|
flatToLogicalStepIndex,
|
|
31
34
|
formatWorkflowJsonPreview,
|
|
32
35
|
hostStepReportName,
|
|
33
36
|
hostStepVerdictLabel
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-JH5H4CYJ.js";
|
|
35
38
|
import {
|
|
36
39
|
snapshotExternalRuns
|
|
37
40
|
} from "./chunk-UKG4V45O.js";
|
|
@@ -49,7 +52,7 @@ import {
|
|
|
49
52
|
getSingleResultOutput,
|
|
50
53
|
shortenPath,
|
|
51
54
|
unresolvedChildWatchdogBlockers
|
|
52
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-XAC2XNAP.js";
|
|
53
56
|
import {
|
|
54
57
|
MAX_WIDGET_JOBS,
|
|
55
58
|
WIDGET_ANIMATION_INTERVAL_MS,
|
|
@@ -335,6 +338,27 @@ function compactTaskText(task, label) {
|
|
|
335
338
|
if (!normalized) return void 0;
|
|
336
339
|
return previewDisplayText(normalized, COMPACT_TASK_MAX_CHARS);
|
|
337
340
|
}
|
|
341
|
+
var EXPANDED_TASK_MAX_LINES = 8;
|
|
342
|
+
function expandedTaskLines(task, label, width) {
|
|
343
|
+
const taskText = task?.trim();
|
|
344
|
+
if (!taskText || taskText === PROMPT_REDACTED || width <= 0) return void 0;
|
|
345
|
+
const shown = truncateDisplayText(taskText, EXPANDED_TASK_MAX_LINES * width);
|
|
346
|
+
const labelText = label?.trim() && label.trim() !== PROMPT_REDACTED ? sanitizeDisplayText(label) : "";
|
|
347
|
+
const head = labelText && labelText !== sanitizeDisplayText(shown) ? `${labelText} \u2014 ` : "";
|
|
348
|
+
const lines = [];
|
|
349
|
+
for (const rawLine of `task: ${head}${shown}`.split("\n")) {
|
|
350
|
+
const content = sanitizeDisplayText(rawLine);
|
|
351
|
+
if (!content) {
|
|
352
|
+
if (lines.length > 0 && lines[lines.length - 1] !== "") lines.push("");
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
const indent = rawLine.match(/^[ \t]*/)[0].replace(/\t/g, " ").slice(0, Math.floor(width / 2));
|
|
356
|
+
for (const part of wrapPlainText(content, width - indent.length)) lines.push(`${indent}${part}`);
|
|
357
|
+
if (lines.length > EXPANDED_TASK_MAX_LINES) break;
|
|
358
|
+
}
|
|
359
|
+
if (lines.length <= EXPANDED_TASK_MAX_LINES && shown.length === taskText.length) return lines;
|
|
360
|
+
return [...lines.slice(0, EXPANDED_TASK_MAX_LINES), "\u2026"];
|
|
361
|
+
}
|
|
338
362
|
var LANE_VALUE_MAX_CHARS = 48;
|
|
339
363
|
function boundedLaneValue(value, maxChars = LANE_VALUE_MAX_CHARS) {
|
|
340
364
|
if (!value?.trim() || value.trim() === PROMPT_REDACTED) return void 0;
|
|
@@ -613,6 +637,16 @@ function workflowLabelForResult(details, resultIndex) {
|
|
|
613
637
|
};
|
|
614
638
|
return details.workflowGraph ? visit(details.workflowGraph.nodes) : void 0;
|
|
615
639
|
}
|
|
640
|
+
function reportedProgressRow(progress, theme, indent, width) {
|
|
641
|
+
const text = progress.progressText?.trim();
|
|
642
|
+
if (!text) return void 0;
|
|
643
|
+
let updated = "";
|
|
644
|
+
if (progress.progressUpdatedAt !== void 0) {
|
|
645
|
+
const age = formatActivityAge(Math.max(0, Date.now() - progress.progressUpdatedAt));
|
|
646
|
+
updated = age === "now" ? " \xB7 updated now" : ` \xB7 updated ${age} ago`;
|
|
647
|
+
}
|
|
648
|
+
return truncLine(theme.fg("dim", `${indent}progress: ${sanitizeDisplayText(text)}${updated}`), width);
|
|
649
|
+
}
|
|
616
650
|
function foregroundProgressForResult(details, resultIndex) {
|
|
617
651
|
const result = details.results[resultIndex];
|
|
618
652
|
if (result?.progress) return result.progress;
|
|
@@ -722,6 +756,22 @@ function visibleWorkflowRows(rows) {
|
|
|
722
756
|
hiddenRows: rows.length - selected.size
|
|
723
757
|
};
|
|
724
758
|
}
|
|
759
|
+
function foldEarlierDoneLines(rows, cap, line, foldLine) {
|
|
760
|
+
if (rows.length <= cap) return rows.map(line);
|
|
761
|
+
const unfinished = rows.filter((row) => row.state !== "complete");
|
|
762
|
+
if (unfinished.length >= cap) return unfinished.map(line);
|
|
763
|
+
const hidden = rows.length - cap + 1;
|
|
764
|
+
const lines = [];
|
|
765
|
+
let skipped = 0;
|
|
766
|
+
for (const row of rows) {
|
|
767
|
+
if (skipped < hidden && row.state === "complete") {
|
|
768
|
+
if (++skipped === hidden) lines.push(foldLine(hidden));
|
|
769
|
+
continue;
|
|
770
|
+
}
|
|
771
|
+
lines.push(line(row));
|
|
772
|
+
}
|
|
773
|
+
return lines;
|
|
774
|
+
}
|
|
725
775
|
function snapshotNowForProgress(progress) {
|
|
726
776
|
if (progress.currentToolStartedAt !== void 0 && progress.durationMs !== void 0) return progress.currentToolStartedAt + progress.durationMs;
|
|
727
777
|
return progress.lastActivityAt;
|
|
@@ -868,6 +918,8 @@ function widgetStepRenderKey(step, index, expanded = false) {
|
|
|
868
918
|
step.workflowKey,
|
|
869
919
|
step.phase,
|
|
870
920
|
step.label,
|
|
921
|
+
step.progressText,
|
|
922
|
+
step.progressUpdatedAt,
|
|
871
923
|
step.status,
|
|
872
924
|
step.activityState,
|
|
873
925
|
step.lastActivityAt,
|
|
@@ -1155,6 +1207,7 @@ function workflowChecklistItemLine(item, theme, indent, frame, includeError) {
|
|
|
1155
1207
|
return `${indent}${workflowChecklistGlyph(item, theme, frame)} ${theme.bold(identity || item.key)}${context}${state}${details ? ` ${theme.fg("dim", `\xB7 ${details}`)}` : ""}`;
|
|
1156
1208
|
}
|
|
1157
1209
|
var COLLAPSED_WORKFLOW_PHASE_LIMIT = 4;
|
|
1210
|
+
var EXPANDED_WIDGET_DONE_ITEMS = 4;
|
|
1158
1211
|
function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame, options = {}) {
|
|
1159
1212
|
if (!checklist?.total) return [];
|
|
1160
1213
|
const includeSummary = options.includeSummary ?? true;
|
|
@@ -1162,6 +1215,11 @@ function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame,
|
|
|
1162
1215
|
const includeBottleneckOutput = options.includeBottleneckOutput ?? expanded;
|
|
1163
1216
|
const includeItemErrors = options.includeItemErrors ?? true;
|
|
1164
1217
|
const lines = includeSummary ? [`${indent}${theme.fg("dim", `Checklist ${formatWorkflowChecklistSummary(checklist)}`)}`] : [];
|
|
1218
|
+
const bottleneck = formatWorkflowChecklistBottleneck(checklist.bottleneck, { includeOutput: includeBottleneckOutput, includeError: !expanded });
|
|
1219
|
+
const tone = checklist.bottleneck?.state === "blocked" || checklist.bottleneck?.state === "failed" ? "error" : checklist.bottleneck?.state === "running" ? "accent" : "warning";
|
|
1220
|
+
const bottleneckLine = bottleneck ? `${indent}${theme.fg(tone, `bottleneck \xB7 ${bottleneck}`)}` : void 0;
|
|
1221
|
+
const liveExpanded = expanded && options.liveWidget === true;
|
|
1222
|
+
if (liveExpanded && bottleneckLine) lines.push(bottleneckLine);
|
|
1165
1223
|
const phases = !limitPhases || checklist.phases.length <= COLLAPSED_WORKFLOW_PHASE_LIMIT ? checklist.phases : checklist.phases.map((phase, index) => ({ phase, index })).sort((left, right) => Number(left.phase.state !== "running") - Number(right.phase.state !== "running") || Number(left.phase.state === "complete") - Number(right.phase.state === "complete") || left.index - right.index).slice(0, COLLAPSED_WORKFLOW_PHASE_LIMIT).sort((left, right) => left.index - right.index).map(({ phase }) => phase);
|
|
1166
1224
|
for (const phase of phases) {
|
|
1167
1225
|
const phaseItem = phase.items.find((item) => item.state === "running") ?? phase.items[0];
|
|
@@ -1174,16 +1232,13 @@ function workflowChecklistWidgetLines(checklist, theme, indent, expanded, frame,
|
|
|
1174
1232
|
}, theme, frame);
|
|
1175
1233
|
lines.push(`${indent}${glyph} ${theme.bold(formatWorkflowChecklistPhase(phase))}`);
|
|
1176
1234
|
if (expanded) {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1235
|
+
const items = [...phase.items].sort((left, right) => workflowChecklistItemPriority(left.state) - workflowChecklistItemPriority(right.state));
|
|
1236
|
+
const line = (item) => workflowChecklistItemLine(item, theme, `${indent} `, frame, includeItemErrors || item.kind === "host");
|
|
1237
|
+
const cap = liveExpanded ? items.filter((item) => item.state !== "complete").length + EXPANDED_WIDGET_DONE_ITEMS + 1 : items.length;
|
|
1238
|
+
lines.push(...foldEarlierDoneLines(items, cap, line, (hidden) => `${indent} ${theme.fg("dim", `\u2026 ${hidden} earlier done`)}`));
|
|
1180
1239
|
}
|
|
1181
1240
|
}
|
|
1182
|
-
|
|
1183
|
-
if (bottleneck) {
|
|
1184
|
-
const tone = checklist.bottleneck?.state === "blocked" || checklist.bottleneck?.state === "failed" ? "error" : checklist.bottleneck?.state === "running" ? "accent" : "warning";
|
|
1185
|
-
lines.push(`${indent}${theme.fg(tone, `bottleneck \xB7 ${bottleneck}`)}`);
|
|
1186
|
-
}
|
|
1241
|
+
if (!liveExpanded && bottleneckLine) lines.push(bottleneckLine);
|
|
1187
1242
|
return lines;
|
|
1188
1243
|
}
|
|
1189
1244
|
function compactWorkflowLaneState(items) {
|
|
@@ -1349,20 +1404,21 @@ function compactWorkflowHeaderLine(job, theme, width) {
|
|
|
1349
1404
|
if (width === void 0 || visibleWidth2(full) <= width) return full;
|
|
1350
1405
|
return `${theme.fg("toolTitle", themeBold(theme, `async workflow ${label}`))} ${theme.fg("dim", "\xB7 background")}`;
|
|
1351
1406
|
}
|
|
1352
|
-
function compactWorkflowWidgetBodyLines(job, theme, frame, projection) {
|
|
1407
|
+
function compactWorkflowWidgetBodyLines(job, theme, frame, projection, lineBudget) {
|
|
1353
1408
|
const rows = compactWorkflowLaneRows(job, projection.checklist);
|
|
1354
1409
|
const lines = [` ${compactWorkflowStats(job, rows, theme, projection)}`];
|
|
1355
1410
|
if (projection.inlineFleetCovered) return [...lines, ` ${theme.fg("dim", "Workflow children shown in Fleet roster")}`];
|
|
1411
|
+
const bottleneck = compactWorkflowBottleneck(rows, job);
|
|
1412
|
+
const hint = job.status === "running" || rows.some((row) => row.state === "running");
|
|
1356
1413
|
if (rows.length) {
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
}
|
|
1414
|
+
const shown = rows.filter((row) => !projection.materializedKeys?.has(row.key));
|
|
1415
|
+
const cap = lineBudget === void 0 ? shown.length : Math.max(1, lineBudget - lines.length - Number(Boolean(bottleneck)) - Number(hint));
|
|
1416
|
+
lines.push(...foldEarlierDoneLines(shown, cap, (row) => compactWorkflowLaneLine(row, theme, " ", frame), (hidden) => ` ${theme.fg("dim", `\u2026 ${hidden} earlier done`)}`));
|
|
1360
1417
|
} else {
|
|
1361
1418
|
lines.push(` ${theme.fg("dim", "\u25E6 waiting for workflow lanes")}`);
|
|
1362
1419
|
}
|
|
1363
|
-
const bottleneck = compactWorkflowBottleneck(rows, job);
|
|
1364
1420
|
if (bottleneck) lines.push(` ${theme.fg(bottleneck.tone, `bottleneck \xB7 ${bottleneck.text}`)}`);
|
|
1365
|
-
if (
|
|
1421
|
+
if (hint) lines.push(` ${theme.fg("accent", workflowDetailHintText())}`);
|
|
1366
1422
|
return lines;
|
|
1367
1423
|
}
|
|
1368
1424
|
function widgetStepActivity(step, snapshotNow) {
|
|
@@ -1378,14 +1434,14 @@ function widgetStepActivity(step, snapshotNow) {
|
|
|
1378
1434
|
if (activity) return activity;
|
|
1379
1435
|
return facts.join(" \xB7 ");
|
|
1380
1436
|
}
|
|
1381
|
-
function widgetChainDetails(job, theme, expanded = false, width = getTermWidth(), frame) {
|
|
1437
|
+
function widgetChainDetails(job, theme, expanded = false, width = getTermWidth(), frame, fullTask = false) {
|
|
1382
1438
|
if (!job.steps?.length) return [];
|
|
1383
1439
|
const total = job.chainStepCount ?? job.steps.length;
|
|
1384
1440
|
const lines = [];
|
|
1385
1441
|
for (const span of buildAsyncChainStepSpans(total, job.steps.length, job.parallelGroups)) {
|
|
1386
1442
|
const steps = job.steps.slice(span.start, span.start + span.count);
|
|
1387
1443
|
if (span.isParallel) {
|
|
1388
|
-
lines.push(...parallelWidgetGroupDetails(job, theme, { steps, total: span.count, stepIndex: span.stepIndex, chainTotal: total }, expanded, width, frame, false));
|
|
1444
|
+
lines.push(...parallelWidgetGroupDetails(job, theme, { steps, total: span.count, stepIndex: span.stepIndex, chainTotal: total }, expanded, width, frame, false, fullTask));
|
|
1389
1445
|
continue;
|
|
1390
1446
|
}
|
|
1391
1447
|
const step = steps[0];
|
|
@@ -1393,16 +1449,18 @@ function widgetChainDetails(job, theme, expanded = false, width = getTermWidth()
|
|
|
1393
1449
|
lines.push(` ${theme.fg("dim", `\u25E6 Step ${span.stepIndex + 1}/${total}: pending`)}`);
|
|
1394
1450
|
continue;
|
|
1395
1451
|
}
|
|
1396
|
-
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, "Step", span.stepIndex + 1, total, expanded, width, frame));
|
|
1452
|
+
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, "Step", span.stepIndex + 1, total, expanded, width, frame, { fullTask }));
|
|
1397
1453
|
}
|
|
1398
1454
|
return lines;
|
|
1399
1455
|
}
|
|
1400
|
-
function widgetParallelAgentDetails(job, theme, expanded = false, width = getTermWidth(), frame) {
|
|
1456
|
+
function widgetParallelAgentDetails(job, theme, expanded = false, width = getTermWidth(), frame, fullTask = false) {
|
|
1401
1457
|
if (!job.steps?.length) return [];
|
|
1458
|
+
const taskLines = (step, indent) => expanded && fullTask && step.status === "running" ? (expandedTaskLines(step.description, step.label, width - indent.length - 4) ?? []).map((line) => `${indent}${theme.fg("dim", line)}`) : [];
|
|
1459
|
+
if (job.mode === "single") return job.steps.flatMap((step) => taskLines(step, " "));
|
|
1402
1460
|
if (job.mode !== "parallel" && job.mode !== "chain") return [];
|
|
1403
|
-
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length) return widgetChainDetails(job, theme, expanded, width, frame);
|
|
1461
|
+
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length) return widgetChainDetails(job, theme, expanded, width, frame, fullTask);
|
|
1404
1462
|
const group = activeParallelWidgetGroup(job);
|
|
1405
|
-
if (group) return parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup));
|
|
1463
|
+
if (group) return parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup), fullTask);
|
|
1406
1464
|
const total = job.stepsTotal ?? job.steps.length;
|
|
1407
1465
|
const lines = [];
|
|
1408
1466
|
for (const [index, step] of job.steps.entries()) {
|
|
@@ -1414,6 +1472,7 @@ function widgetParallelAgentDetails(job, theme, expanded = false, width = getTer
|
|
|
1414
1472
|
const display = step.sessionName?.trim() || (label ? `${label} (${step.agent})` : step.agent);
|
|
1415
1473
|
const thinking = childThinkingLevel(step);
|
|
1416
1474
|
lines.push(` ${theme.fg("dim", `${marker} ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, index), frame, thinking)} ${itemTitle} ${index + 1}/${total}: ${display} \xB7 ${widgetStepStatus(step.status, theme, thinking)}${modelDisplay}${activity ? ` \xB7 ${activity}` : ""}`)}`);
|
|
1475
|
+
lines.push(...taskLines(step, " "));
|
|
1417
1476
|
const lane = projectAsyncLane(job, step);
|
|
1418
1477
|
if (lane) lines.push(...formatLaneProjectionLines(lane, theme, " "));
|
|
1419
1478
|
for (const nestedLine of formatNestedWidgetLines(step.children, theme, width, expanded, job.updatedAt, expanded ? 8 : 6)) lines.push(` ${nestedLine}`);
|
|
@@ -1538,7 +1597,7 @@ function parallelWidgetGroupHeader(group, theme, frame) {
|
|
|
1538
1597
|
const label = group.stepIndex !== void 0 && group.chainTotal !== void 0 ? `Step ${group.stepIndex + 1}/${group.chainTotal}: parallel group` : "parallel group";
|
|
1539
1598
|
return ` ${widgetStepGlyph(status, theme, widgetStepsRunningSeed(group.steps), frame)} ${themeBold(theme, label)} ${theme.fg("dim", "\xB7")} ${theme.fg("dim", formatParallelOutcome(group.steps, group.total))}`;
|
|
1540
1599
|
}
|
|
1541
|
-
function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, prioritizeActive) {
|
|
1600
|
+
function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, prioritizeActive, fullTask = false) {
|
|
1542
1601
|
const lines = [parallelWidgetGroupHeader(group, theme, frame)];
|
|
1543
1602
|
const rows = parallelWidgetStepRows(group.steps, group.total, prioritizeActive);
|
|
1544
1603
|
for (const [rowIndex, row] of rows.entries()) {
|
|
@@ -1548,7 +1607,8 @@ function parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, p
|
|
|
1548
1607
|
rowIndent: " ",
|
|
1549
1608
|
detailIndent: " ",
|
|
1550
1609
|
rowMarker: marker,
|
|
1551
|
-
includeCurrentPath: true
|
|
1610
|
+
includeCurrentPath: true,
|
|
1611
|
+
fullTask
|
|
1552
1612
|
}));
|
|
1553
1613
|
}
|
|
1554
1614
|
for (let index = rows.length; index < group.total; index++) {
|
|
@@ -1951,8 +2011,12 @@ function foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index, tota
|
|
|
1951
2011
|
const lines = [`${rowIndent}${rowMarker}${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, index - 1), frame, thinking)} ${themeBold(theme, rowLabel)}${contextModeBadge(theme, step.context)} ${theme.fg("dim", "\xB7")} ${status}${modelDisplay}${stats ? ` ${theme.fg("dim", "\xB7")} ${stats}` : ""}`];
|
|
1952
2012
|
const lane = projectAsyncLane(job, step);
|
|
1953
2013
|
if (lane) lines.push(...formatLaneProjectionLines(lane, theme, detailIndent));
|
|
1954
|
-
const
|
|
2014
|
+
const fullTask = expanded && options?.fullTask && step.status === "running" ? expandedTaskLines(step.description, step.label, width - detailIndent.length - 4) : void 0;
|
|
2015
|
+
const task = fullTask ? void 0 : collapseDetails ? stepTaskSummary(step, displayName) : compactTaskText(step.description, step.label);
|
|
2016
|
+
for (const line of fullTask ?? []) lines.push(`${detailIndent}${theme.fg("dim", line)}`);
|
|
1955
2017
|
if (task) lines.push(`${detailIndent}${theme.fg("dim", `task: ${task}`)}`);
|
|
2018
|
+
const progressRow = step.status === "running" ? reportedProgressRow(step, theme, detailIndent, width - 4) : void 0;
|
|
2019
|
+
if (progressRow) lines.push(progressRow);
|
|
1956
2020
|
const activity = widgetStepActivityLine(step, width, expanded, job.updatedAt);
|
|
1957
2021
|
const currentPath = options?.includeCurrentPath && step.currentPath ? shortenPath(step.currentPath) : void 0;
|
|
1958
2022
|
const activityWithPath = currentPath && activity && !activity.includes(currentPath) ? `${activity} \xB7 ${currentPath}` : activity ?? currentPath;
|
|
@@ -2001,7 +2065,7 @@ function hostStepWidgetLines(job, theme, indent) {
|
|
|
2001
2065
|
if (rows.length > visible.length) lines.push(`${indent}${theme.fg("dim", `\u2026 +${rows.length - visible.length} host steps hidden`)}`);
|
|
2002
2066
|
return lines;
|
|
2003
2067
|
}
|
|
2004
|
-
function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection = buildWorkflowWidgetProjection(job)) {
|
|
2068
|
+
function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection = buildWorkflowWidgetProjection(job), fullTask = false) {
|
|
2005
2069
|
const steps = projection.steps.filter((step) => !projection.materializedKeys?.has(step.workflowKey ?? "") && !projection.materializedKeys?.has(step.runId ?? ""));
|
|
2006
2070
|
const checklist = widgetChecklistWithoutMaterializedChildren(projection);
|
|
2007
2071
|
if (!expanded && job.mode === "workflow") {
|
|
@@ -2011,21 +2075,21 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2011
2075
|
const lane = projectAsyncLane(job, laneStepForJob(job, steps));
|
|
2012
2076
|
return [
|
|
2013
2077
|
...expanded ? workflowPreflightLines(job) : [],
|
|
2014
|
-
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame),
|
|
2078
|
+
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { liveWidget: true }),
|
|
2015
2079
|
...lane ? formatLaneProjectionLines(lane, theme, " ") : [],
|
|
2016
2080
|
...hostStepWidgetLines(job, theme, " "),
|
|
2017
2081
|
` ${theme.fg("dim", `\u23BF ${widgetActivity(job)}`)}`,
|
|
2018
2082
|
...formatNestedWidgetLines(job.nestedChildren, theme, width, expanded, job.updatedAt, expanded ? 12 : 6).map((line) => ` ${line}`)
|
|
2019
2083
|
];
|
|
2020
2084
|
}
|
|
2021
|
-
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length) return widgetChainDetails(job, theme, expanded, width, frame);
|
|
2085
|
+
if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length) return widgetChainDetails(job, theme, expanded, width, frame, fullTask);
|
|
2022
2086
|
const lines = [
|
|
2023
2087
|
...expanded ? workflowPreflightLines(job) : [],
|
|
2024
|
-
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { includeItemErrors: !expanded })
|
|
2088
|
+
...workflowChecklistWidgetLines(checklist, theme, " ", expanded, frame, { includeItemErrors: !expanded, liveWidget: true })
|
|
2025
2089
|
];
|
|
2026
2090
|
const group = activeParallelWidgetGroup(job);
|
|
2027
2091
|
if (group) {
|
|
2028
|
-
lines.push(...parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup)));
|
|
2092
|
+
lines.push(...parallelWidgetGroupDetails(job, theme, group, expanded, width, frame, Boolean(job.activeParallelGroup), fullTask));
|
|
2029
2093
|
} else {
|
|
2030
2094
|
const { stageProgress, plannedKeys } = projection;
|
|
2031
2095
|
const total = job.mode === "chain" ? job.chainStepCount ?? job.stepsTotal ?? steps.length : stageProgress?.total ?? job.stepsTotal ?? steps.length;
|
|
@@ -2037,7 +2101,7 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2037
2101
|
const itemTitle = isPlannedStage ? "Stage" : "Step";
|
|
2038
2102
|
const displayIndex = isPlannedStage ? (step.index ?? index) + 1 : plannedKeys ? ++extraStepIndex : index + 1;
|
|
2039
2103
|
const displayTotal = isPlannedStage ? stageTotal : extraStepCount;
|
|
2040
|
-
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, itemTitle, displayIndex, displayTotal, expanded, width, frame));
|
|
2104
|
+
lines.push(...foregroundStyleWidgetStepLines(job, theme, step, itemTitle, displayIndex, displayTotal, expanded, width, frame, { fullTask }));
|
|
2041
2105
|
}
|
|
2042
2106
|
}
|
|
2043
2107
|
lines.push(...hostStepWidgetLines(job, theme, " "));
|
|
@@ -2048,8 +2112,8 @@ function foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projec
|
|
|
2048
2112
|
}
|
|
2049
2113
|
return lines;
|
|
2050
2114
|
}
|
|
2051
|
-
function buildSingleWidgetLines(job, theme, width, expanded, frame, projection = buildWorkflowWidgetProjection(job)) {
|
|
2052
|
-
if ((!expanded || projection.inlineFleetCovered) && job.mode === "workflow") return [compactWorkflowHeaderLine(job, theme, width), ...compactWorkflowWidgetBodyLines(job, theme, frame, projection)].map((line) => truncLine(line, width));
|
|
2115
|
+
function buildSingleWidgetLines(job, theme, width, expanded, frame, projection = buildWorkflowWidgetProjection(job), reservedLines = 0, fullTask = false) {
|
|
2116
|
+
if ((!expanded || projection.inlineFleetCovered) && job.mode === "workflow") return [compactWorkflowHeaderLine(job, theme, width), ...compactWorkflowWidgetBodyLines(job, theme, frame, projection, widgetLineBudget(expanded) - 1 - reservedLines)].map((line) => truncLine(line, width));
|
|
2053
2117
|
const stats = widgetStats(job, theme, projection, !expanded);
|
|
2054
2118
|
const count = job.mode === "workflow" ? projection.checklist?.total ?? projection.stageProgress?.total ?? job.stepsTotal ?? job.agents?.length ?? job.steps?.length : job.mode === "chain" ? job.chainStepCount : projection.stageProgress?.total ?? job.stepsTotal ?? job.agents?.length ?? job.steps?.length;
|
|
2055
2119
|
const mode = widgetJobName(job);
|
|
@@ -2060,7 +2124,7 @@ function buildSingleWidgetLines(job, theme, width, expanded, frame, projection =
|
|
|
2060
2124
|
return [
|
|
2061
2125
|
`${theme.fg("toolTitle", themeBold(theme, title))} ${theme.fg("dim", "\xB7 background")}`,
|
|
2062
2126
|
...collapseDetails ? [] : [summary],
|
|
2063
|
-
...foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection)
|
|
2127
|
+
...foregroundStyleWidgetDetails(job, theme, expanded, width, frame, projection, fullTask)
|
|
2064
2128
|
].map((line) => truncLine(line, width));
|
|
2065
2129
|
}
|
|
2066
2130
|
function compactSingleWidgetLines(job, theme, width, frame, projection = buildWorkflowWidgetProjection(job)) {
|
|
@@ -2077,12 +2141,14 @@ function compactSingleWidgetLines(job, theme, width, frame, projection = buildWo
|
|
|
2077
2141
|
const status = widgetStepStatus(step.status, theme, thinking);
|
|
2078
2142
|
const activity = widgetStepActivityLine(step, width, false, job.updatedAt);
|
|
2079
2143
|
const stepStats = widgetStepStats(theme, step, job.updatedAt);
|
|
2080
|
-
const activitySuffix = activity ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", activity)}` : "";
|
|
2081
2144
|
const modelDisplay = modelThinkingBadge(theme, step.model, step.thinking);
|
|
2082
2145
|
const task = compactTaskText(step.description, step.label);
|
|
2083
2146
|
const taskSuffix = task ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", `task: ${task}`)}` : "";
|
|
2147
|
+
const activitySuffix = activity ? ` ${theme.fg("dim", "\xB7")} ${theme.fg("dim", activity)}` : "";
|
|
2084
2148
|
const marker = rowIndex === rows.length - 1 && rowIndex >= group.total - 1 ? "\u2514\u2500" : "\u251C\u2500";
|
|
2085
2149
|
lines.push(` ${marker} ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, row.index), frame, thinking)} ${themeBold(theme, row.rowLabel)}${contextModeBadge(theme, step.context)} ${theme.fg("dim", "\xB7")} ${status}${modelDisplay}${taskSuffix}${activitySuffix}${stepStats ? ` ${theme.fg("dim", "\xB7")} ${stepStats}` : ""}`);
|
|
2150
|
+
const progressRow = step.status === "running" ? reportedProgressRow(step, theme, " ", width) : void 0;
|
|
2151
|
+
if (progressRow) lines.push(progressRow);
|
|
2086
2152
|
const lane = projectAsyncLane(job, step);
|
|
2087
2153
|
if (lane) lines.push(...formatLaneProjectionLines(lane, theme, " "));
|
|
2088
2154
|
for (const nestedLine of formatNestedWidgetLines(step.children, theme, width, false, job.updatedAt, 6)) lines.push(` ${nestedLine}`);
|
|
@@ -2283,9 +2349,9 @@ function buildProgressiveWidgetLines(jobs, theme, width, lockedRows, previousKey
|
|
|
2283
2349
|
const laneRows = job.mode === "workflow" ? compactWorkflowLaneRows(job, projection.checklist) : void 0;
|
|
2284
2350
|
lines.push(progressiveJobLine(job, theme, width, frame, projection, laneRows));
|
|
2285
2351
|
if (!laneRows || projection.inlineFleetCovered) continue;
|
|
2286
|
-
const
|
|
2287
|
-
|
|
2288
|
-
spareRows -=
|
|
2352
|
+
const laneLines = foldEarlierDoneLines(laneRows, spareRows, (row) => truncLine(compactWorkflowLaneLine(row, theme, " ", frame), width), (hidden) => truncLine(` ${theme.fg("dim", `\u2026 ${hidden} earlier done`)}`, width)).slice(0, spareRows);
|
|
2353
|
+
lines.push(...laneLines);
|
|
2354
|
+
spareRows -= laneLines.length;
|
|
2289
2355
|
}
|
|
2290
2356
|
if (hiddenJobs.length > 0 && lines.length < rowCount) lines.push(progressiveHiddenLine(hiddenJobs, theme, width));
|
|
2291
2357
|
const contentRows = Math.min(lines.length, rowCount);
|
|
@@ -2300,9 +2366,12 @@ function paddedWidgetLine(line, width) {
|
|
|
2300
2366
|
const text = ` ${truncLine(line, width - 2)} `;
|
|
2301
2367
|
return `${text}${" ".repeat(Math.max(0, width - visibleWidth2(text)))}`;
|
|
2302
2368
|
}
|
|
2369
|
+
function widgetLineBudget(expanded) {
|
|
2370
|
+
const rows = currentTerminalRows();
|
|
2371
|
+
return expanded ? Math.max(12, Math.min(24, Math.floor(rows * 0.55))) : collapsedWidgetLineBudget(rows);
|
|
2372
|
+
}
|
|
2303
2373
|
function fitWidgetLineBudget(lines, theme, width, expanded) {
|
|
2304
|
-
const
|
|
2305
|
-
const budget = expanded ? Math.max(12, Math.min(24, Math.floor(rows * 0.55))) : collapsedWidgetLineBudget(rows);
|
|
2374
|
+
const budget = widgetLineBudget(expanded);
|
|
2306
2375
|
if (lines.length <= budget) return lines;
|
|
2307
2376
|
const visibleLines = Math.max(1, budget - 1);
|
|
2308
2377
|
const hiddenCount = lines.length - visibleLines;
|
|
@@ -2416,7 +2485,7 @@ function widgetChecklistWithoutMaterializedChildren(projection) {
|
|
|
2416
2485
|
if (!checklist || !materializedKeys) return checklist;
|
|
2417
2486
|
return { ...checklist, phases: checklist.phases.map((phase) => ({ ...phase, items: phase.items.filter((item) => !materializedKeys.has(item.key)) })) };
|
|
2418
2487
|
}
|
|
2419
|
-
function materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor) {
|
|
2488
|
+
function materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor, fullTask = false) {
|
|
2420
2489
|
const { children, inlineFleetCovered } = projectionFor(job);
|
|
2421
2490
|
if (inlineFleetCovered || !children?.length) return [];
|
|
2422
2491
|
const lines = [];
|
|
@@ -2427,8 +2496,8 @@ function materializedWidgetChildLines(job, theme, width, expanded, frame, projec
|
|
|
2427
2496
|
const identity = child.workflowKey ?? child.asyncId;
|
|
2428
2497
|
const stats = widgetStats(child, theme, projection, !expanded);
|
|
2429
2498
|
lines.push(` ${last ? "\u2514\u2500" : "\u251C\u2500"} ${theme.bold(identity)} ${widgetStatusGlyph(child, theme, frame)} ${themeBold(theme, widgetJobName(child))}${contextModeBadge(theme, child.context)}${stats ? ` ${theme.fg("dim", "\xB7")} ${stats}` : ""}`);
|
|
2430
|
-
for (const detail of foregroundStyleWidgetDetails(child, theme, expanded, Math.max(0, width - 6), frame, projection)) lines.push(` ${last ? " " : "\u2502 "}${detail}`);
|
|
2431
|
-
for (const detail of materializedWidgetChildLines(child, theme, Math.max(0, width - 4), expanded, frame, projectionFor)) lines.push(` ${detail}`);
|
|
2499
|
+
for (const detail of foregroundStyleWidgetDetails(child, theme, expanded, Math.max(0, width - 6), frame, projection, fullTask)) lines.push(` ${last ? " " : "\u2502 "}${detail}`);
|
|
2500
|
+
for (const detail of materializedWidgetChildLines(child, theme, Math.max(0, width - 4), expanded, frame, projectionFor, fullTask)) lines.push(` ${detail}`);
|
|
2432
2501
|
}
|
|
2433
2502
|
if (shown.length < children.length) lines.push(` +${children.length - shown.length} more workflow children`);
|
|
2434
2503
|
return lines;
|
|
@@ -2512,12 +2581,25 @@ function buildWidgetComponent(jobs, ui, initiallyCollapsed = false, layout) {
|
|
|
2512
2581
|
return component;
|
|
2513
2582
|
};
|
|
2514
2583
|
}
|
|
2584
|
+
function runningWidgetChildCount(jobs, projectionFor) {
|
|
2585
|
+
let running = 0;
|
|
2586
|
+
for (const job of jobs) {
|
|
2587
|
+
const { steps, materializedKeys, children } = projectionFor(job);
|
|
2588
|
+
if (!steps.length && job.status === "running") running++;
|
|
2589
|
+
for (const step of steps) {
|
|
2590
|
+
if (step.status === "running" && !materializedKeys?.has(step.workflowKey ?? "") && !materializedKeys?.has(step.runId ?? "")) running++;
|
|
2591
|
+
}
|
|
2592
|
+
if (children?.length) running += runningWidgetChildCount(children, projectionFor);
|
|
2593
|
+
}
|
|
2594
|
+
return running;
|
|
2595
|
+
}
|
|
2515
2596
|
function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), expanded = false, frame, projectionFor = workflowWidgetProjectionLookup()) {
|
|
2516
2597
|
if (jobs.length === 0) return [];
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2598
|
+
const fullTask = expanded && runningWidgetChildCount(jobs, projectionFor) === 1;
|
|
2599
|
+
if (jobs.length === 1) {
|
|
2600
|
+
const childLines = materializedWidgetChildLines(jobs[0], theme, width, expanded, frame, projectionFor, fullTask).map((line) => truncLine(line, width));
|
|
2601
|
+
return [...buildSingleWidgetLines(jobs[0], theme, width, expanded, frame, projectionFor(jobs[0]), childLines.length, fullTask), ...childLines];
|
|
2602
|
+
}
|
|
2521
2603
|
const running = jobs.filter((job) => job.status === "running");
|
|
2522
2604
|
const queued = jobs.filter((job) => job.status === "queued");
|
|
2523
2605
|
const finished = jobs.filter((job) => job.status !== "running" && job.status !== "queued");
|
|
@@ -2531,23 +2613,24 @@ function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), exp
|
|
|
2531
2613
|
let hiddenFinished = 0;
|
|
2532
2614
|
let queuedSummaryShown = false;
|
|
2533
2615
|
let slots = MAX_WIDGET_JOBS;
|
|
2616
|
+
const compactCards = [];
|
|
2534
2617
|
const appendJob = (job) => {
|
|
2535
2618
|
const projection = projectionFor(job);
|
|
2536
2619
|
const compactWorkflow = (!expanded || projection.inlineFleetCovered) && job.mode === "workflow";
|
|
2537
2620
|
const stats = compactWorkflow ? "" : widgetStats(job, theme, projection, !expanded);
|
|
2538
|
-
const details = compactWorkflow ? [
|
|
2539
|
-
...compactWorkflowWidgetBodyLines(job, theme, frame, projection)
|
|
2540
|
-
] : [
|
|
2621
|
+
const details = compactWorkflow ? compactWorkflowWidgetBodyLines(job, theme, frame, projection) : [
|
|
2541
2622
|
` ${theme.fg("dim", `\u23BF ${widgetActivity(job)}`)}`,
|
|
2542
2623
|
...widgetLaneDetailLines(job, theme, projection),
|
|
2543
|
-
...workflowChecklistWidgetLines(widgetChecklistWithoutMaterializedChildren(projection), theme, " ", expanded, frame, { includeItemErrors: !expanded || !job.steps?.length }),
|
|
2544
|
-
...widgetParallelAgentDetails(job, theme, expanded, width, frame)
|
|
2624
|
+
...workflowChecklistWidgetLines(widgetChecklistWithoutMaterializedChildren(projection), theme, " ", expanded, frame, { includeItemErrors: !expanded || !job.steps?.length, liveWidget: true }),
|
|
2625
|
+
...widgetParallelAgentDetails(job, theme, expanded, width, frame, fullTask)
|
|
2545
2626
|
];
|
|
2546
|
-
|
|
2627
|
+
const item = [
|
|
2547
2628
|
compactWorkflow ? compactWorkflowHeaderLine(job, theme, width) : `${widgetStatusGlyph(job, theme, frame)} ${themeBold(theme, widgetJobName(job))}${contextModeBadge(theme, job.context)}${stats ? ` ${theme.fg("dim", "\xB7")} ${stats}` : ""}`,
|
|
2548
2629
|
...details,
|
|
2549
|
-
...materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor)
|
|
2550
|
-
]
|
|
2630
|
+
...materializedWidgetChildLines(job, theme, width, expanded, frame, projectionFor, fullTask)
|
|
2631
|
+
];
|
|
2632
|
+
items.push(item);
|
|
2633
|
+
if (compactWorkflow) compactCards.push({ item, job, projection, bodyLength: details.length });
|
|
2551
2634
|
};
|
|
2552
2635
|
for (const job of running) {
|
|
2553
2636
|
if (slots <= 0) {
|
|
@@ -2579,6 +2662,13 @@ function buildWidgetLinesWithProjection(jobs, theme, width = getTermWidth(), exp
|
|
|
2579
2662
|
if (hiddenFinished > 0) parts.push(`${hiddenFinished} finished`);
|
|
2580
2663
|
items.push([theme.fg("dim", `+${hiddenTotal} more (${parts.join(", ")})`)]);
|
|
2581
2664
|
}
|
|
2665
|
+
let overflow = 1 + items.reduce((sum, item) => sum + item.length, 0) - widgetLineBudget(expanded);
|
|
2666
|
+
for (const card of compactCards) {
|
|
2667
|
+
if (overflow <= 0) break;
|
|
2668
|
+
const body = compactWorkflowWidgetBodyLines(card.job, theme, frame, card.projection, card.bodyLength - overflow);
|
|
2669
|
+
card.item.splice(1, card.bodyLength, ...body);
|
|
2670
|
+
overflow -= card.bodyLength - body.length;
|
|
2671
|
+
}
|
|
2582
2672
|
for (let i = 0; i < items.length; i++) {
|
|
2583
2673
|
const item = items[i];
|
|
2584
2674
|
const last = i === items.length - 1;
|
|
@@ -2626,6 +2716,8 @@ function renderSingleCompact(d, r, theme, layout, frame, foregroundDetachShortcu
|
|
|
2626
2716
|
if (isRunning && r.progress) {
|
|
2627
2717
|
const task = compactTaskText(r.task);
|
|
2628
2718
|
if (task) c.addChild(new Text(truncLine(theme.fg("dim", `${detailIndent}task: ${task}`), width), 0, 0));
|
|
2719
|
+
const reportedRow = reportedProgressRow(r.progress, theme, detailIndent, width);
|
|
2720
|
+
if (reportedRow) c.addChild(new Text(reportedRow, 0, 0));
|
|
2629
2721
|
const progressSnapshotNow = snapshotNowForProgress(r.progress);
|
|
2630
2722
|
const activity = compactCurrentActivity(r.progress);
|
|
2631
2723
|
c.addChild(new Text(truncLine(theme.fg("dim", `${detailIndent}\u23BF ${activity}`), width), 0, 0));
|
|
@@ -2863,6 +2955,8 @@ function renderMultiCompact(d, theme, layout, frame) {
|
|
|
2863
2955
|
const task = compactTaskText(r.task, workflowLabelForResult(d, i));
|
|
2864
2956
|
if (task) c.addChild(new Text(truncLine(theme.fg("dim", `${detailIndent}task: ${task}`), width), 0, 0));
|
|
2865
2957
|
}
|
|
2958
|
+
const reportedRow = rRunning && progressFromArray ? reportedProgressRow(progressFromArray, theme, detailIndent, width) : void 0;
|
|
2959
|
+
if (reportedRow) c.addChild(new Text(reportedRow, 0, 0));
|
|
2866
2960
|
if (rRunning && rProg && "status" in rProg) {
|
|
2867
2961
|
const liveProgress = rProg;
|
|
2868
2962
|
const activity = compactCurrentActivity(liveProgress);
|
|
@@ -2961,6 +3055,8 @@ function renderSubagentResult(result, options, theme, frame, rendererConfig, for
|
|
|
2961
3055
|
c2.addChild(new Text(fit2(theme.fg(r.exitCode !== 0 ? "error" : "dim", ` \u23BF ${resultStatusLine(r, output)}`)), 0, 0));
|
|
2962
3056
|
}
|
|
2963
3057
|
if (isRunning && r.progress) {
|
|
3058
|
+
const reportedRow = reportedProgressRow(r.progress, theme, " ", w2);
|
|
3059
|
+
if (reportedRow) c2.addChild(new Text(fit2(reportedRow), 0, 0));
|
|
2964
3060
|
const progressSnapshotNow = snapshotNowForProgress(r.progress);
|
|
2965
3061
|
for (const nestedLine of formatNestedWidgetLines(r.children, theme, w2, true, progressSnapshotNow, 12)) {
|
|
2966
3062
|
c2.addChild(new Text(fit2(` ${nestedLine}`), 0, 0));
|
|
@@ -3129,6 +3225,8 @@ function renderSubagentResult(result, options, theme, frame, rendererConfig, for
|
|
|
3129
3225
|
const taskMaxLen = Math.max(20, w - 12);
|
|
3130
3226
|
const taskPreview = expanded || r.task.length <= taskMaxLen ? r.task : `${r.task.slice(0, taskMaxLen)}...`;
|
|
3131
3227
|
c.addChild(new Text(fit(theme.fg("dim", ` task: ${taskPreview}`)), 0, 0));
|
|
3228
|
+
const reportedRow = rRunning && progressFromArray ? reportedProgressRow(progressFromArray, theme, " ", w) : void 0;
|
|
3229
|
+
if (reportedRow) c.addChild(new Text(fit(reportedRow), 0, 0));
|
|
3132
3230
|
const outputTarget = extractOutputTarget(r.task);
|
|
3133
3231
|
if (outputTarget) {
|
|
3134
3232
|
c.addChild(new Text(fit(theme.fg("dim", ` output: ${outputTarget}`)), 0, 0));
|
|
@@ -3462,20 +3560,6 @@ function projectPaneEntries(state) {
|
|
|
3462
3560
|
projectPane: pane
|
|
3463
3561
|
}));
|
|
3464
3562
|
}
|
|
3465
|
-
var reportedFleetWarnings = /* @__PURE__ */ new Set();
|
|
3466
|
-
function reportFleetWarning(state, message) {
|
|
3467
|
-
if (reportedFleetWarnings.has(message)) return;
|
|
3468
|
-
reportedFleetWarnings.add(message);
|
|
3469
|
-
const text = `[pi-subagents] ${message}`;
|
|
3470
|
-
const cached = state.lastUiContext;
|
|
3471
|
-
const notified = withCachedUiContext(cached, () => {
|
|
3472
|
-
if (state.lastUiContext === cached) state.lastUiContext = null;
|
|
3473
|
-
}, (ctx) => {
|
|
3474
|
-
ctx.ui.notify(text, "warning");
|
|
3475
|
-
return true;
|
|
3476
|
-
});
|
|
3477
|
-
if (!notified) console.warn(text);
|
|
3478
|
-
}
|
|
3479
3563
|
function collectFleetStatusEntries(state) {
|
|
3480
3564
|
const now = Date.now();
|
|
3481
3565
|
const entries = [];
|
|
@@ -3604,7 +3688,7 @@ function collectFleetStatusEntries(state) {
|
|
|
3604
3688
|
}
|
|
3605
3689
|
if (state.currentSessionId) {
|
|
3606
3690
|
try {
|
|
3607
|
-
for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) =>
|
|
3691
|
+
for (const run of snapshotExternalRuns(state.currentSessionId, { ignoreMalformed: true, onMalformedRecord: (message) => reportSessionWarning(state, `Removed ${message}`) })) {
|
|
3608
3692
|
if (!isActiveState(run.state)) continue;
|
|
3609
3693
|
entries.push({
|
|
3610
3694
|
key: `external:${run.id}`,
|
|
@@ -3617,7 +3701,7 @@ function collectFleetStatusEntries(state) {
|
|
|
3617
3701
|
});
|
|
3618
3702
|
}
|
|
3619
3703
|
} catch (cause) {
|
|
3620
|
-
|
|
3704
|
+
reportSessionWarning(state, `Failed to inspect external jobs: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
3621
3705
|
}
|
|
3622
3706
|
}
|
|
3623
3707
|
entries.push(...projectPaneEntries(state));
|
|
@@ -4169,7 +4253,6 @@ export {
|
|
|
4169
4253
|
renderSubagentResult,
|
|
4170
4254
|
FLEET_STATUS_WIDGET_KEY,
|
|
4171
4255
|
resolveFleetViewPlacement,
|
|
4172
|
-
reportFleetWarning,
|
|
4173
4256
|
SubagentFleetStatus,
|
|
4174
4257
|
emitUiSpanSilent
|
|
4175
4258
|
};
|