@xzzpig/pi-subagents 0.20.0 → 0.21.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 +154 -0
- package/README.md +1 -1
- package/agents/oracle.md +8 -19
- package/agents/researcher.md +0 -3
- package/agents/reviewer.md +17 -61
- package/agents/scout.md +1 -4
- package/agents/worker.md +8 -25
- package/docs/agents.md +72 -7
- package/docs/configuration.md +58 -7
- package/docs/extension-api.md +36 -11
- package/docs/fork-extensions.md +1 -0
- package/docs/missions.md +34 -17
- package/docs/models.md +1 -1
- package/docs/observability.md +10 -5
- package/docs/tool-reference.md +117 -84
- package/docs/watchdog.md +8 -6
- package/docs/workflows.md +16 -7
- package/index.ts +5 -0
- package/package.json +5 -3
- package/prompts/council.md +1 -1
- package/skills/pi-subagents/SKILL.md +1 -1
- package/skills/pi-subagents/references/constraints-and-recipes.md +1 -1
- package/skills/pi-subagents/references/execution-controls.md +16 -16
- package/skills/pi-subagents/references/management-authoring-rpc.md +16 -12
- package/skills/pi-subagents/references/prompting-and-roles.md +3 -3
- package/src/agents/advertised-agent-prompt.ts +9 -1
- package/src/agents/agent-management.ts +4 -0
- package/src/agents/agent-memory.ts +3 -3
- package/src/agents/agent-scope.ts +4 -0
- package/src/agents/agent-serializer.ts +8 -1
- package/src/agents/agents.ts +191 -145
- package/src/api/preflight.ts +8 -4
- package/src/extension/config.ts +21 -2
- package/src/extension/context-injection.ts +6 -1
- package/src/extension/control-notices.ts +1 -9
- package/src/extension/declaration-pinning.ts +164 -0
- package/src/extension/doctor.ts +7 -10
- package/src/extension/fanout-child.ts +7 -8
- package/src/extension/index.ts +114 -132
- package/src/extension/reply-workflow-script.ts +20 -11
- package/src/extension/rpc.ts +11 -6
- package/src/extension/schemas.ts +34 -30
- package/src/extension/subagent-guide.ts +86 -6
- package/src/extension/subagent-options.ts +47 -0
- package/src/extension/tool-activation.ts +3 -2
- package/src/extension/tool-description.ts +51 -68
- package/src/inspectors/actions.ts +37 -11
- package/src/inspectors/plugins.ts +3 -2
- package/src/inspectors/tmux/actions.ts +204 -0
- package/src/inspectors/tmux/client.ts +85 -0
- package/src/inspectors/tmux/plugin.ts +21 -0
- package/src/integrations/herdr-status.ts +18 -49
- package/src/integrations/program-status.ts +215 -0
- package/src/intercom/native-supervisor-channel.ts +77 -4
- package/src/intercom/result-intercom.ts +3 -2
- package/src/intercom/supervisor-ui.ts +2 -174
- package/src/missions/store.ts +25 -5
- package/src/profiles/profiles.ts +24 -21
- package/src/runs/background/active-async-capacity.ts +58 -8
- package/src/runs/background/async-execution.ts +143 -38
- package/src/runs/background/async-job-tracker.ts +11 -4
- package/src/runs/background/async-resume.ts +5 -2
- package/src/runs/background/await-async-run.ts +14 -9
- package/src/runs/background/binary-bootstrap.ts +2 -1
- package/src/runs/background/calendar-schedule.ts +90 -0
- package/src/runs/background/chain-root-attachment.ts +9 -5
- package/src/runs/background/fleet-view.ts +5 -5
- package/src/runs/background/notify.ts +185 -12
- package/src/runs/background/result-files.ts +116 -5
- package/src/runs/background/result-watcher.ts +99 -66
- package/src/runs/background/resume-guidance.ts +2 -2
- package/src/runs/background/run-child-session.ts +16 -2
- package/src/runs/background/run-id-resolver.ts +8 -5
- package/src/runs/background/run-status.ts +21 -16
- package/src/runs/background/runner-child-launch.ts +1 -0
- package/src/runs/background/runner-http-dispatcher.ts +3 -0
- package/src/runs/background/scheduled-runs.ts +256 -61
- package/src/runs/background/subagent-runner-bootstrap.ts +4 -1
- package/src/runs/background/subagent-runner.ts +32 -12
- package/src/runs/background/subagent-wait.ts +38 -19
- package/src/runs/background/terminal-run-index.ts +46 -1
- package/src/runs/background/wait-completions.ts +1 -0
- package/src/runs/background/wait-tool.ts +33 -23
- package/src/runs/background/workflow-terminal-proof.ts +39 -22
- package/src/runs/foreground/async-stop-action.ts +48 -22
- package/src/runs/foreground/execution.ts +94 -52
- package/src/runs/foreground/foreground-history.ts +1 -0
- package/src/runs/foreground/subagent-executor.ts +207 -77
- package/src/runs/shared/child-commands.ts +2 -1
- package/src/runs/shared/child-hooks.ts +4 -3
- package/src/runs/shared/child-launch.ts +3 -0
- package/src/runs/shared/child-session.ts +41 -24
- package/src/runs/shared/child-tool-plan.ts +13 -26
- package/src/runs/shared/dynamic-fanout.ts +1 -1
- package/src/runs/shared/fork-command-result.ts +10 -0
- package/src/runs/shared/herdr-placed-run.ts +5 -4
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +5 -3
- package/src/runs/shared/model-resolution-diagnostic.ts +25 -0
- package/src/runs/shared/model-resolution.ts +30 -1
- package/src/runs/shared/nested-events.ts +5 -0
- package/src/runs/shared/parallel-handoff.ts +56 -8
- package/src/runs/shared/parallel-utils.ts +2 -0
- package/src/runs/shared/partial-output.ts +48 -0
- package/src/runs/shared/runner-launcher.ts +25 -0
- package/src/runs/shared/single-output.ts +53 -0
- package/src/runs/shared/structured-output.ts +14 -7
- package/src/runs/shared/subagent-control.ts +3 -3
- package/src/runs/shared/subagent-prompt-runtime.ts +47 -24
- package/src/runs/shared/workflow-async-child-guidance.ts +1 -1
- package/src/runs/shared/worktree-cleanup-apply.ts +160 -0
- package/src/runs/shared/worktree-cleanup-plan.ts +41 -19
- package/src/runs/shared/worktree-lock.ts +29 -0
- package/src/runs/shared/worktree.ts +12 -1
- package/src/shared/atomic-json.ts +4 -2
- package/src/shared/edit-distance.ts +33 -0
- package/src/shared/file-lease.ts +74 -0
- package/src/shared/formatters.ts +1 -5
- package/src/shared/model-info.ts +22 -0
- package/src/shared/package-version.ts +17 -0
- package/src/shared/parent-wake.ts +79 -0
- package/src/shared/pruned-fork.ts +7 -1
- package/src/shared/runtime-module-path.ts +19 -0
- package/src/shared/settings-file-lease.ts +36 -0
- package/src/shared/types.ts +36 -2
- package/src/shared/utils.ts +8 -6
- package/src/slash/slash-commands.ts +3 -3
- package/src/slash/subagents-admin.ts +2 -1
- package/src/tui/fleet-native-transcript.ts +2 -0
- package/src/tui/fleet-transcript.ts +12 -3
- package/src/tui/fleet.ts +11 -8
- package/src/tui/render.ts +27 -19
- package/src/tui/subagent-messages.ts +305 -0
- package/src/watchdog/diff-tool.ts +2 -2
- package/src/watchdog/register-main.ts +2 -22
- package/src/watchdog/render.ts +2 -24
- package/src/watchdog/runtime.ts +6 -4
- package/src/watchdog/settings.ts +18 -13
- package/src/watchdog/tool-actions.ts +2 -2
- package/src/workflows/scripted-workflow.ts +20 -6
- package/src/workflows/workflow-resources.ts +11 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
|
|
4
|
+
/** Every extension a sibling runtime module may be published with: compiled `.js` first, source `.ts`. */
|
|
5
|
+
export const RUNTIME_MODULE_EXTENSIONS = [".js", ".ts"] as const;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Which extension a sibling runtime module has on disk now. An in-place package
|
|
9
|
+
* update can swap the `.ts` source layout for the compiled `.js` layout under a
|
|
10
|
+
* running process, so the running module's own extension is not reliable.
|
|
11
|
+
*/
|
|
12
|
+
export function resolveRuntimeModuleExtension(dir: string, basename: string): string {
|
|
13
|
+
return RUNTIME_MODULE_EXTENSIONS.find((extension) => fs.existsSync(path.join(dir, `${basename}${extension}`))) ?? ".js";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Absolute, normalized path to a sibling runtime module that exists on disk. */
|
|
17
|
+
export function resolveRuntimeModulePath(dir: string, basename: string): string {
|
|
18
|
+
return path.normalize(path.join(dir, `${basename}${resolveRuntimeModuleExtension(dir, basename)}`));
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { withFileLease } from "./file-lease.ts";
|
|
4
|
+
|
|
5
|
+
/** Physical file a settings path writes to, following file and directory links (including a dangling file link). */
|
|
6
|
+
export function resolveSettingsWriteTarget(filePath: string): string {
|
|
7
|
+
let targetPath = filePath;
|
|
8
|
+
for (;;) {
|
|
9
|
+
try {
|
|
10
|
+
return fs.realpathSync.native(targetPath);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
|
|
13
|
+
// A trailing separator requires a directory; it cannot name a new settings file.
|
|
14
|
+
if (targetPath.endsWith("/") || targetPath.endsWith(path.sep)) throw error;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// A missing target is allowed only when its physical parent already exists.
|
|
18
|
+
const parentPath = fs.realpathSync.native(path.dirname(targetPath));
|
|
19
|
+
const unresolvedPath = path.join(parentPath, path.basename(targetPath));
|
|
20
|
+
let linkText: string;
|
|
21
|
+
try {
|
|
22
|
+
linkText = fs.readlinkSync(unresolvedPath);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
|
|
25
|
+
return unresolvedPath;
|
|
26
|
+
}
|
|
27
|
+
// Keep link text intact so the filesystem follows directory links before "..".
|
|
28
|
+
targetPath = path.isAbsolute(linkText) ? linkText : `${parentPath}${path.sep}${linkText}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Hold the physical settings file's lease for a whole read-modify-write. */
|
|
33
|
+
export function withSettingsFileLease<T>(filePath: string, action: () => T): T {
|
|
34
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
35
|
+
return withFileLease(resolveSettingsWriteTarget(filePath), action);
|
|
36
|
+
}
|
package/src/shared/types.ts
CHANGED
|
@@ -455,6 +455,8 @@ export interface ParallelHandoffLaneBinding {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
export interface ParallelHandoffCleanupTask {
|
|
458
|
+
/** Canonical parent recorded when the worktree was created; missing proof keeps old trees. */
|
|
459
|
+
recordedBaseDir?: string;
|
|
458
460
|
index: number;
|
|
459
461
|
path: string;
|
|
460
462
|
branch: string;
|
|
@@ -838,6 +840,8 @@ export interface SteeringRecoveryDescriptor {
|
|
|
838
840
|
sessionFile?: string;
|
|
839
841
|
/** Git ref used to allocate managed worktrees for this run. */
|
|
840
842
|
baseRef?: string;
|
|
843
|
+
/** Launcher name the run was wrapped with; resume re-reads its argv from current user config. Absence means unwrapped. */
|
|
844
|
+
launcher?: string;
|
|
841
845
|
cwd: string;
|
|
842
846
|
model?: string;
|
|
843
847
|
modelProvider?: string;
|
|
@@ -914,6 +918,8 @@ export interface SubagentResultIntercomChild {
|
|
|
914
918
|
status: SubagentResultStatus;
|
|
915
919
|
/** Whether the child produced substantive output before its process ended. */
|
|
916
920
|
outputState?: SubagentOutputState;
|
|
921
|
+
/** True when the output is unfinished streamed text recovered after a timeout or child error. */
|
|
922
|
+
outputPartial?: boolean;
|
|
917
923
|
summary: string;
|
|
918
924
|
index?: number;
|
|
919
925
|
artifactPath?: string;
|
|
@@ -1335,6 +1341,8 @@ export interface SingleResult {
|
|
|
1335
1341
|
finalOutput?: string;
|
|
1336
1342
|
/** Provenance-aware state for substantive child output, excluding synthetic lifecycle messages. */
|
|
1337
1343
|
outputState?: SubagentOutputState;
|
|
1344
|
+
/** True when the output is unfinished streamed text recovered after a timeout or child error. */
|
|
1345
|
+
outputPartial?: boolean;
|
|
1338
1346
|
outputMode?: OutputMode;
|
|
1339
1347
|
savedOutputPath?: string;
|
|
1340
1348
|
outputReference?: SavedOutputReference;
|
|
@@ -1392,6 +1400,8 @@ export interface WaitCompletionChild {
|
|
|
1392
1400
|
sessionFile?: string;
|
|
1393
1401
|
success?: boolean;
|
|
1394
1402
|
outputState?: SubagentOutputState;
|
|
1403
|
+
/** True when the output is unfinished streamed text recovered after a timeout or child error. */
|
|
1404
|
+
outputPartial?: boolean;
|
|
1395
1405
|
structuredOutput?: unknown;
|
|
1396
1406
|
structuredOutputPath?: string;
|
|
1397
1407
|
error?: string;
|
|
@@ -1465,8 +1475,8 @@ export interface Details {
|
|
|
1465
1475
|
activeRunIds: string[];
|
|
1466
1476
|
activeProviderItems: Array<{ provider: string; id: string }>;
|
|
1467
1477
|
} | {
|
|
1468
|
-
/** Non-terminal
|
|
1469
|
-
reason: "supervisor_request";
|
|
1478
|
+
/** Non-terminal yield for a supervisor request or a user message; tracked work remains active. */
|
|
1479
|
+
reason: "supervisor_request" | "user_input";
|
|
1470
1480
|
timedOut: false;
|
|
1471
1481
|
activeRunIds: string[];
|
|
1472
1482
|
activeProviderItems: Array<{ provider: string; id: string }>;
|
|
@@ -1939,6 +1949,8 @@ export interface AsyncStatus {
|
|
|
1939
1949
|
/** Linux PID namespace identity used to scope liveness probes. */
|
|
1940
1950
|
pidNamespaceScope?: string;
|
|
1941
1951
|
cwd?: string;
|
|
1952
|
+
/** User-configured launcher that wrapped the background runner (argv only, never environment). */
|
|
1953
|
+
launcher?: RunnerLauncher;
|
|
1942
1954
|
/** Parent-resolved child session root retained for trusted restored transcript lookup. */
|
|
1943
1955
|
sessionRoot?: string;
|
|
1944
1956
|
currentStep?: number;
|
|
@@ -2166,6 +2178,8 @@ export interface ForegroundResumeChild {
|
|
|
2166
2178
|
error?: string;
|
|
2167
2179
|
finalOutput?: string;
|
|
2168
2180
|
outputState?: SubagentOutputState;
|
|
2181
|
+
/** True when the output is unfinished streamed text recovered after a timeout or child error. */
|
|
2182
|
+
outputPartial?: boolean;
|
|
2169
2183
|
outputMode?: OutputMode;
|
|
2170
2184
|
savedOutputPath?: string;
|
|
2171
2185
|
outputSaveError?: string;
|
|
@@ -2296,6 +2310,8 @@ export interface ForegroundRunControl {
|
|
|
2296
2310
|
interrupt?: () => boolean;
|
|
2297
2311
|
detach?: () => boolean;
|
|
2298
2312
|
steer?: ForegroundChildControl["steer"];
|
|
2313
|
+
/** Set while a detached child runs: records it as stopped, then aborts it, when this runtime is replaced. */
|
|
2314
|
+
stopForRuntimeReplacement?: () => void;
|
|
2299
2315
|
}
|
|
2300
2316
|
|
|
2301
2317
|
export interface WaitSubscriptionRecord {
|
|
@@ -2436,6 +2452,13 @@ export const INTERCOM_DETACH_RESPONSE_EVENT = "pi-intercom:detach-response";
|
|
|
2436
2452
|
/** pi-intercom asks each session for a fixed intercom ID at session start; `claim(id)` answers synchronously. */
|
|
2437
2453
|
export const INTERCOM_SESSION_IDENTITY_EVENT = "intercom:session-identity";
|
|
2438
2454
|
export const SUBAGENT_ASYNC_STARTED_EVENT = "subagent:async-started";
|
|
2455
|
+
/** Launcher names are plain identifiers so they survive frontmatter rewrites without quoting. */
|
|
2456
|
+
export const RUNNER_LAUNCHER_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u;
|
|
2457
|
+
export const RUNNER_LAUNCHER_NAME_RULE = "must start with a letter or digit and use only letters, digits, '.', '_' or '-' (at most 128 characters)";
|
|
2458
|
+
export interface RunnerLauncher {
|
|
2459
|
+
name: string;
|
|
2460
|
+
argv: string[];
|
|
2461
|
+
}
|
|
2439
2462
|
export const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
|
|
2440
2463
|
export const SUBAGENT_PROCESS_TERMINAL_EVENT = "subagent:process-terminal";
|
|
2441
2464
|
export const SUBAGENT_FOREGROUND_COMPLETE_EVENT = "subagent:foreground-complete";
|
|
@@ -2472,6 +2495,8 @@ export interface SubagentChildStatusEvent {
|
|
|
2472
2495
|
export interface ForegroundChildSessionControls {
|
|
2473
2496
|
steer: (text: string) => Promise<void>;
|
|
2474
2497
|
followUp: (text: string) => Promise<void>;
|
|
2498
|
+
/** Abort the live child and report the run as stopped with `reason`. */
|
|
2499
|
+
stop: (reason: string) => void;
|
|
2475
2500
|
}
|
|
2476
2501
|
|
|
2477
2502
|
export interface RunSyncOptions {
|
|
@@ -2489,6 +2514,8 @@ export interface RunSyncOptions {
|
|
|
2489
2514
|
permissions?: import("../runs/shared/permissions.ts").PermissionConfig;
|
|
2490
2515
|
/** Session id of the direct parent session for permission-system ask forwarding. */
|
|
2491
2516
|
parentSessionId?: string;
|
|
2517
|
+
/** The parent session's file, recorded as a new child session's `parentSession` header. */
|
|
2518
|
+
parentSessionFile?: string;
|
|
2492
2519
|
/** Resolved launch context for this child. */
|
|
2493
2520
|
context?: "fresh" | "fork";
|
|
2494
2521
|
cwd?: string;
|
|
@@ -2639,6 +2666,7 @@ export interface ScheduledRunsConfig {
|
|
|
2639
2666
|
}
|
|
2640
2667
|
|
|
2641
2668
|
export type FleetViewPlacement = "aboveEditor" | "belowEditor";
|
|
2669
|
+
export type AsyncWidgetLayout = "adaptive" | "rows";
|
|
2642
2670
|
|
|
2643
2671
|
export const FLEET_KEYBINDING_ACTIONS = [
|
|
2644
2672
|
"close",
|
|
@@ -2704,8 +2732,14 @@ export interface ExtensionConfig {
|
|
|
2704
2732
|
asyncWidget?: boolean;
|
|
2705
2733
|
/** Start the under-editor async runs widget folded. Defaults to false. */
|
|
2706
2734
|
asyncWidgetCollapsed?: boolean;
|
|
2735
|
+
/** Unfolded async runs widget layout: "adaptive" fits run details to the terminal height, "rows" shows one line per run. Defaults to "adaptive". */
|
|
2736
|
+
asyncWidgetLayout?: AsyncWidgetLayout;
|
|
2737
|
+
/** Report subagent run state to the terminal with OSC 7501. Defaults to true. */
|
|
2738
|
+
programStatus?: boolean;
|
|
2707
2739
|
/** Exact provider/model candidates mapped to operator-declared equivalent response IDs. Empty arrays add no accepted IDs. */
|
|
2708
2740
|
modelResponseAliases?: Record<string, string[]>;
|
|
2741
|
+
/** Named argv prefixes for background runners; agents select one with `launcher: <name>`. User config only. */
|
|
2742
|
+
runnerLaunchers?: Record<string, string[]>;
|
|
2709
2743
|
/** Tool description variant registered for the parent-facing subagent tool. Defaults to split metadata. */
|
|
2710
2744
|
toolDescriptionMode?: ToolDescriptionMode;
|
|
2711
2745
|
/** How a new parent session offers the subagent tool. Defaults to auto. */
|
package/src/shared/utils.ts
CHANGED
|
@@ -321,12 +321,14 @@ function compactCompletedProgress(progress: AgentProgress): AgentProgress {
|
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
/** Summaries of the latest `limit` tool calls, in chronological order; older calls are never read. */
|
|
325
|
+
function extractToolCallSummaries(messages: Message[] | undefined, limit = Infinity): ToolCallSummary[] {
|
|
326
326
|
const summaries: ToolCallSummary[] = [];
|
|
327
|
-
for (
|
|
327
|
+
for (let i = (messages?.length ?? 0) - 1; i >= 0 && summaries.length < limit; i--) {
|
|
328
|
+
const msg = messages![i]!;
|
|
328
329
|
if (msg.role !== "assistant") continue;
|
|
329
|
-
for (
|
|
330
|
+
for (let j = msg.content.length - 1; j >= 0 && summaries.length < limit; j--) {
|
|
331
|
+
const part = msg.content[j]!;
|
|
330
332
|
if (part.type !== "toolCall") continue;
|
|
331
333
|
const args = typeof part.arguments === "object" && part.arguments !== null && !Array.isArray(part.arguments)
|
|
332
334
|
? part.arguments
|
|
@@ -337,7 +339,7 @@ function extractToolCallSummaries(messages: Message[] | undefined): ToolCallSumm
|
|
|
337
339
|
});
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
|
-
return summaries;
|
|
342
|
+
return summaries.reverse();
|
|
341
343
|
}
|
|
342
344
|
|
|
343
345
|
export function sumResultsUsage(results: SingleResult[]): Usage {
|
|
@@ -448,7 +450,7 @@ export function boundStreamedRecentOutput(recentOutput: string[]): string[] {
|
|
|
448
450
|
* derives one from `messages`; bounded to the most recent calls.
|
|
449
451
|
*/
|
|
450
452
|
export function boundStreamedToolCalls(result: Pick<SingleResult, "toolCalls" | "messages">): ToolCallSummary[] | undefined {
|
|
451
|
-
const summaries = result.toolCalls?.length ? result.toolCalls : extractToolCallSummaries(result.messages);
|
|
453
|
+
const summaries = result.toolCalls?.length ? result.toolCalls : extractToolCallSummaries(result.messages, MAX_STREAMED_TOOL_CALLS);
|
|
452
454
|
if (!summaries.length) return undefined;
|
|
453
455
|
return summaries.slice(-MAX_STREAMED_TOOL_CALLS).map((summary) => ({ ...summary }));
|
|
454
456
|
}
|
|
@@ -620,7 +620,7 @@ export function registerSlashCommands(
|
|
|
620
620
|
};
|
|
621
621
|
const showFleet = async (ctx: ExtensionContext) => {
|
|
622
622
|
state.lastUiContext = ctx;
|
|
623
|
-
if (
|
|
623
|
+
if (ctx.mode !== "tui") {
|
|
624
624
|
await runCommand(ctx, { action: "status", view: "fleet" });
|
|
625
625
|
return;
|
|
626
626
|
}
|
|
@@ -700,7 +700,7 @@ export function registerSlashCommands(
|
|
|
700
700
|
description: "Host integration bridge: answer an async child inspection request with a correlated widget payload (no model turn)",
|
|
701
701
|
handler: async (args, ctx) => {
|
|
702
702
|
if (ctx.mode === "tui") {
|
|
703
|
-
ctx.ui.notify("Inspection replies are emitted only on RPC surfaces. Use /subagents or subagent({ action: \"status\", view: \"transcript\" }) interactively.", "info");
|
|
703
|
+
ctx.ui.notify("Inspection replies are emitted only on RPC surfaces. Use /subagents or subagent({ action: \"status\", options: { view: \"transcript\" } }) interactively.", "info");
|
|
704
704
|
return;
|
|
705
705
|
}
|
|
706
706
|
if (!ctx.hasUI) return;
|
|
@@ -803,7 +803,7 @@ export function registerSlashCommands(
|
|
|
803
803
|
ctx.ui.notify(message, "error");
|
|
804
804
|
return;
|
|
805
805
|
}
|
|
806
|
-
if (
|
|
806
|
+
if (ctx.mode !== "tui") {
|
|
807
807
|
sendSlashText(pi, stopFallbackText(targets));
|
|
808
808
|
return;
|
|
809
809
|
}
|
|
@@ -230,7 +230,8 @@ function metadataFor(agent: AgentConfig): string {
|
|
|
230
230
|
|
|
231
231
|
async function selectFromList(ctx: ExtensionContext, title: string, subtitle: string | undefined, items: SelectorItem[]): Promise<string | undefined> {
|
|
232
232
|
markAdminDialogSilent();
|
|
233
|
-
|
|
233
|
+
// RPC mode defines ui.custom as a no-op that resolves undefined, so only TUI can show the component.
|
|
234
|
+
if (ctx.mode === "tui" && typeof ctx.ui.custom === "function") {
|
|
234
235
|
const result = await ctx.ui.custom<SelectorResult>(
|
|
235
236
|
(tui, theme, kb, done) => new SelectorComponent(tui, theme, kb, { title, subtitle, items, done }),
|
|
236
237
|
{ overlay: false },
|
|
@@ -84,6 +84,7 @@ export interface NativeFleetBuildInput {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export interface NativeFleetBuildResult {
|
|
87
|
+
readFailed?: true;
|
|
87
88
|
lines: string[];
|
|
88
89
|
conversationState: string;
|
|
89
90
|
truncated: boolean;
|
|
@@ -370,6 +371,7 @@ export function buildNativeFleetTranscript(
|
|
|
370
371
|
truncated: read.truncated,
|
|
371
372
|
...(read.warning ? { warning: read.warning } : {}),
|
|
372
373
|
entryCount: 0,
|
|
374
|
+
...(read.readFailed ? { readFailed: true } : {}),
|
|
373
375
|
};
|
|
374
376
|
}
|
|
375
377
|
|
|
@@ -58,6 +58,8 @@ export interface FleetTranscript {
|
|
|
58
58
|
events: FleetTranscriptEvent[];
|
|
59
59
|
truncated: boolean;
|
|
60
60
|
warning?: string;
|
|
61
|
+
/** The path was refused or the file could not be read, as opposed to a read that only skipped records. */
|
|
62
|
+
readFailed?: true;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export interface FleetTranscriptReadOptions {
|
|
@@ -323,8 +325,12 @@ function parseTranscriptLines(lines: string[], conversationStarted = false): { e
|
|
|
323
325
|
}
|
|
324
326
|
if (role === "assistant") {
|
|
325
327
|
assistantSeen = true;
|
|
328
|
+
// The transcript writer records the assistant message's provider-local id, which can itself contain a slash.
|
|
329
|
+
const rawModel = stringValue(record.model) ?? stringValue(message?.model);
|
|
330
|
+
const provider = stringValue(message?.provider);
|
|
331
|
+
const model = rawModel && provider ? `${provider}/${rawModel}` : rawModel;
|
|
326
332
|
if (text) appendTextEvent(events, "assistant", text, {
|
|
327
|
-
...(
|
|
333
|
+
...(model ? { model } : {}),
|
|
328
334
|
...(timestamp !== undefined ? { timestamp } : {}),
|
|
329
335
|
});
|
|
330
336
|
continue;
|
|
@@ -343,7 +349,7 @@ function parseTranscriptLines(lines: string[], conversationStarted = false): { e
|
|
|
343
349
|
export function readFleetTranscript(filePath: string, options: FleetTranscriptReadOptions): FleetTranscript {
|
|
344
350
|
const validated = validateTranscriptPath(filePath, options.trustedRoots, options.trustedFiles, options.trustedFileRoot);
|
|
345
351
|
if (!validated.resolvedPath) {
|
|
346
|
-
return { path: filePath, events: [], truncated: false, ...(validated.warning ? { warning: safeDisplayText(validated.warning) } : {}) };
|
|
352
|
+
return { path: filePath, events: [], truncated: false, readFailed: true, ...(validated.warning ? { warning: safeDisplayText(validated.warning) } : {}) };
|
|
347
353
|
}
|
|
348
354
|
const maxRecords = Math.max(1, options.maxRecords ?? DEFAULT_MAX_RECORDS);
|
|
349
355
|
const tail = readTailLines(validated.resolvedPath, Math.max(1024, options.maxBytes ?? DEFAULT_MAX_BYTES));
|
|
@@ -358,11 +364,13 @@ export function readFleetTranscript(filePath: string, options: FleetTranscriptRe
|
|
|
358
364
|
path: filePath,
|
|
359
365
|
events: parsed.events,
|
|
360
366
|
truncated: tail.truncated || tail.lines.length > maxRecords || parsed.explicitTruncation,
|
|
367
|
+
...(tail.warning ? { readFailed: true as const } : {}),
|
|
361
368
|
...(warnings.length ? { warning: safeDisplayText(warnings.join(" ")) } : {}),
|
|
362
369
|
};
|
|
363
370
|
}
|
|
364
371
|
|
|
365
372
|
export interface TranscriptRecordRead {
|
|
373
|
+
readFailed?: true;
|
|
366
374
|
records: Array<Record<string, unknown>>;
|
|
367
375
|
truncated: boolean;
|
|
368
376
|
warning?: string;
|
|
@@ -377,7 +385,7 @@ export interface TranscriptRecordRead {
|
|
|
377
385
|
export function readTranscriptRecords(filePath: string, options: FleetTranscriptReadOptions): TranscriptRecordRead {
|
|
378
386
|
const validated = validateTranscriptPath(filePath, options.trustedRoots);
|
|
379
387
|
if (!validated.resolvedPath) {
|
|
380
|
-
return { records: [], truncated: false, ...(validated.warning ? { warning: safeDisplayText(validated.warning) } : {}) };
|
|
388
|
+
return { records: [], truncated: false, readFailed: true, ...(validated.warning ? { warning: safeDisplayText(validated.warning) } : {}) };
|
|
381
389
|
}
|
|
382
390
|
const maxRecords = Math.max(1, options.maxRecords ?? DEFAULT_MAX_RECORDS);
|
|
383
391
|
const tail = readTailLines(validated.resolvedPath, Math.max(1024, options.maxBytes ?? DEFAULT_MAX_BYTES));
|
|
@@ -403,6 +411,7 @@ export function readTranscriptRecords(filePath: string, options: FleetTranscript
|
|
|
403
411
|
].filter((value): value is string => Boolean(value));
|
|
404
412
|
return {
|
|
405
413
|
records,
|
|
414
|
+
...(tail.warning ? { readFailed: true as const } : {}),
|
|
406
415
|
truncated: tail.truncated || tail.lines.length > maxRecords,
|
|
407
416
|
...(warnings.length ? { warning: safeDisplayText(warnings.join(" ")) } : {}),
|
|
408
417
|
};
|
package/src/tui/fleet.ts
CHANGED
|
@@ -812,8 +812,10 @@ interface FleetTranscriptCache {
|
|
|
812
812
|
|
|
813
813
|
function transcriptFingerprint(filePath: string): string {
|
|
814
814
|
try {
|
|
815
|
-
|
|
816
|
-
|
|
815
|
+
// ino and ctime catch a same-size, same-mtime replacement. Bigint keeps
|
|
816
|
+
// Windows file ids, which exceed 2^53, exact.
|
|
817
|
+
const stat = fs.statSync(filePath, { bigint: true });
|
|
818
|
+
return `${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
|
|
817
819
|
} catch {
|
|
818
820
|
return "missing";
|
|
819
821
|
}
|
|
@@ -882,7 +884,7 @@ export class SubagentFleetComponent implements Component {
|
|
|
882
884
|
});
|
|
883
885
|
}
|
|
884
886
|
|
|
885
|
-
private nativeRenderedOutcome(mod: NativeTranscriptModule, target: { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string }, width: number): { body: string[]; conversationState: string; hasContent: boolean; warning?: string } {
|
|
887
|
+
private nativeRenderedOutcome(mod: NativeTranscriptModule, target: { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string }, width: number): { body: string[]; conversationState: string; hasContent: boolean; warning?: string; readFailed?: boolean } {
|
|
886
888
|
try {
|
|
887
889
|
const built = buildNativeFleetTranscript(mod, {
|
|
888
890
|
filePath: target.path,
|
|
@@ -896,7 +898,7 @@ export class SubagentFleetComponent implements Component {
|
|
|
896
898
|
cwd: this.state.baseCwd,
|
|
897
899
|
theme: this.theme,
|
|
898
900
|
});
|
|
899
|
-
return { body: built.lines, conversationState: built.conversationState, hasContent: built.entryCount > 0, ...(built.warning ? { warning: built.warning } : {}) };
|
|
901
|
+
return { readFailed: built.readFailed, body: built.lines, conversationState: built.conversationState, hasContent: built.entryCount > 0, ...(built.warning ? { warning: built.warning } : {}) };
|
|
900
902
|
} catch {
|
|
901
903
|
// A native-render failure must never blank the inspector: degrade to
|
|
902
904
|
// the legacy renderer for the rest of this inspector session.
|
|
@@ -905,7 +907,7 @@ export class SubagentFleetComponent implements Component {
|
|
|
905
907
|
}
|
|
906
908
|
}
|
|
907
909
|
|
|
908
|
-
private legacyRenderedOutcome(target: { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string }, width: number): { body: string[]; conversationState: string; hasContent: boolean; warning?: string } {
|
|
910
|
+
private legacyRenderedOutcome(target: { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string }, width: number): { body: string[]; conversationState: string; hasContent: boolean; warning?: string; readFailed?: boolean } {
|
|
909
911
|
const transcript = readFleetTranscript(target.path, {
|
|
910
912
|
trustedRoots: target.trustedRoots,
|
|
911
913
|
...(target.trustedFiles ? { trustedFiles: target.trustedFiles } : {}),
|
|
@@ -926,6 +928,7 @@ export class SubagentFleetComponent implements Component {
|
|
|
926
928
|
body,
|
|
927
929
|
conversationState,
|
|
928
930
|
hasContent: transcript.events.length > 0,
|
|
931
|
+
readFailed: transcript.readFailed,
|
|
929
932
|
...(transcript.warning ? { warning: transcript.warning } : {}),
|
|
930
933
|
};
|
|
931
934
|
}
|
|
@@ -936,7 +939,7 @@ export class SubagentFleetComponent implements Component {
|
|
|
936
939
|
this.refreshTimer = undefined;
|
|
937
940
|
if (this.disposed) return;
|
|
938
941
|
try {
|
|
939
|
-
this.
|
|
942
|
+
this.refresh();
|
|
940
943
|
this.tui.requestRender();
|
|
941
944
|
} finally {
|
|
942
945
|
this.scheduleRefresh();
|
|
@@ -1359,7 +1362,7 @@ export class SubagentFleetComponent implements Component {
|
|
|
1359
1362
|
});
|
|
1360
1363
|
}
|
|
1361
1364
|
|
|
1362
|
-
private renderedTranscript(target: { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string }, width: number): { body: string[]; conversationState: string; hasContent: boolean; warning?: string } {
|
|
1365
|
+
private renderedTranscript(target: { path: string; trustedRoots: string[]; trustedFiles?: string[]; trustedFileRoot?: string }, width: number): { body: string[]; conversationState: string; hasContent: boolean; warning?: string; readFailed?: boolean } {
|
|
1363
1366
|
const fingerprint = `${this.rendererMode}|${target.trustedRoots.join("\0")}|${target.trustedFiles?.join("\0") ?? ""}|${target.trustedFileRoot ?? ""}|${transcriptFingerprint(target.path)}`;
|
|
1364
1367
|
if (this.transcriptCache
|
|
1365
1368
|
&& this.transcriptCache.mode === this.rendererMode
|
|
@@ -1381,7 +1384,7 @@ export class SubagentFleetComponent implements Component {
|
|
|
1381
1384
|
const outcome = this.rendererMode === "native" && this.nativeModule
|
|
1382
1385
|
? this.nativeRenderedOutcome(this.nativeModule, target, width)
|
|
1383
1386
|
: this.legacyRenderedOutcome(target, width);
|
|
1384
|
-
this.transcriptCache = { mode: this.rendererMode, path: target.path, fingerprint, width, expandedTools: this.expandedTools, expandedThinking: this.expandedThinking, ...outcome, body: [...outcome.body] };
|
|
1387
|
+
this.transcriptCache = outcome.readFailed ? undefined : { mode: this.rendererMode, path: target.path, fingerprint, width, expandedTools: this.expandedTools, expandedThinking: this.expandedThinking, ...outcome, body: [...outcome.body] };
|
|
1385
1388
|
return outcome;
|
|
1386
1389
|
}
|
|
1387
1390
|
|
package/src/tui/render.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type AsyncJobState,
|
|
14
14
|
type AsyncJobStep,
|
|
15
15
|
type AsyncParallelGroupStatus,
|
|
16
|
+
type AsyncWidgetLayout,
|
|
16
17
|
type Details,
|
|
17
18
|
type HostStepState,
|
|
18
19
|
type HostStepVerdict,
|
|
@@ -2520,6 +2521,7 @@ interface WidgetLayoutSession {
|
|
|
2520
2521
|
columns: number;
|
|
2521
2522
|
tier: WidgetRenderTier;
|
|
2522
2523
|
lockedRows?: number;
|
|
2524
|
+
rootJobCount?: number;
|
|
2523
2525
|
visibleJobKeys: string[];
|
|
2524
2526
|
}
|
|
2525
2527
|
|
|
@@ -2760,7 +2762,7 @@ function fitWidgetLineBudget(lines: string[], theme: Theme, width: number, expan
|
|
|
2760
2762
|
return [...lines.slice(0, visibleLines), truncLine(theme.fg("dim", hint), width)];
|
|
2761
2763
|
}
|
|
2762
2764
|
|
|
2763
|
-
function fitAdaptiveWidgetLines(jobs: AsyncJobState[], buildLines: () => string[], theme: Theme, width: number, expanded: boolean, frame?: number, projectionFor?: WorkflowWidgetProjectionLookup): string[] {
|
|
2765
|
+
function fitAdaptiveWidgetLines(jobs: AsyncJobState[], buildLines: () => string[], theme: Theme, width: number, expanded: boolean, frame?: number, projectionFor?: WorkflowWidgetProjectionLookup, layout: AsyncWidgetLayout = "adaptive"): string[] {
|
|
2764
2766
|
if (expanded) {
|
|
2765
2767
|
resetWidgetLayoutSession();
|
|
2766
2768
|
return fitWidgetLineBudget(buildLines(), theme, width, true);
|
|
@@ -2779,24 +2781,30 @@ function fitAdaptiveWidgetLines(jobs: AsyncJobState[], buildLines: () => string[
|
|
|
2779
2781
|
const session = widgetLayoutSession;
|
|
2780
2782
|
const lockedRows = widgetLayoutSession.lockedRows;
|
|
2781
2783
|
let rendered = buildProgressiveWidgetLines(jobs, theme, width, lockedRows, session.visibleJobKeys, frame, projectionFor);
|
|
2782
|
-
//
|
|
2784
|
+
// The height stays fixed across content-only updates (#186). It grows when a new job would be hidden while the cap
|
|
2785
|
+
// has room, and shrinks to content only when root jobs leave, so finished jobs leave no blank rows.
|
|
2783
2786
|
const capRows = Math.min(availableRows, collapsedWidgetLineBudget(rows));
|
|
2784
2787
|
if (rendered.visibleJobKeys.length < jobs.length && lockedRows < capRows) {
|
|
2785
2788
|
rendered = buildProgressiveWidgetLines(jobs, theme, width, capRows, session.visibleJobKeys, frame, projectionFor);
|
|
2786
2789
|
session.lockedRows = Math.max(lockedRows, rendered.contentRows);
|
|
2790
|
+
} else if (jobs.length < (session.rootJobCount ?? 0)) {
|
|
2791
|
+
session.lockedRows = rendered.contentRows;
|
|
2787
2792
|
}
|
|
2793
|
+
session.rootJobCount = jobs.length;
|
|
2788
2794
|
session.visibleJobKeys = rendered.visibleJobKeys;
|
|
2789
2795
|
return rendered.lines.slice(0, session.lockedRows);
|
|
2790
2796
|
}
|
|
2791
2797
|
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2798
|
+
if (layout === "adaptive") {
|
|
2799
|
+
const lines = buildLines();
|
|
2800
|
+
if (lines.length <= availableRows) {
|
|
2801
|
+
widgetLayoutSession = { expanded, rows, columns, tier: "full", visibleJobKeys: [] };
|
|
2802
|
+
return fitWidgetLineBudget(lines, theme, width, false);
|
|
2803
|
+
}
|
|
2804
|
+
if (availableRows > 2 && jobs.length === 1 && projectionFor?.(jobs[0]!).stageProgress) {
|
|
2805
|
+
widgetLayoutSession = { expanded, rows, columns, tier: "full", visibleJobKeys: [] };
|
|
2806
|
+
return fitWidgetLineBudget(lines, theme, width, false);
|
|
2807
|
+
}
|
|
2800
2808
|
}
|
|
2801
2809
|
|
|
2802
2810
|
if (availableRows <= 2) {
|
|
@@ -2807,7 +2815,7 @@ function fitAdaptiveWidgetLines(jobs: AsyncJobState[], buildLines: () => string[
|
|
|
2807
2815
|
// Lock to the rows the content fills so the fixed-height card has no blank padding.
|
|
2808
2816
|
const rendered = buildProgressiveWidgetLines(jobs, theme, width, Math.min(availableRows, collapsedWidgetLineBudget(rows)), [], frame, projectionFor);
|
|
2809
2817
|
const lockedRows = rendered.contentRows;
|
|
2810
|
-
widgetLayoutSession = { expanded, rows, columns, tier: "progressive", lockedRows, visibleJobKeys: rendered.visibleJobKeys };
|
|
2818
|
+
widgetLayoutSession = { expanded, rows, columns, tier: "progressive", lockedRows, rootJobCount: jobs.length, visibleJobKeys: rendered.visibleJobKeys };
|
|
2811
2819
|
return rendered.lines.slice(0, lockedRows);
|
|
2812
2820
|
}
|
|
2813
2821
|
|
|
@@ -2900,7 +2908,7 @@ function materializedWidgetChildLines(job: AsyncJobState, theme: Theme, width: n
|
|
|
2900
2908
|
return lines;
|
|
2901
2909
|
}
|
|
2902
2910
|
|
|
2903
|
-
function buildWidgetComponent(jobs: AsyncJobState[], ui: ExtensionContext["ui"], initiallyCollapsed = false): (tui: { requestRender(): void }, theme: Theme) => Component {
|
|
2911
|
+
function buildWidgetComponent(jobs: AsyncJobState[], ui: ExtensionContext["ui"], initiallyCollapsed = false, layout: AsyncWidgetLayout): (tui: { requestRender(): void }, theme: Theme) => Component {
|
|
2904
2912
|
return (tui, theme) => {
|
|
2905
2913
|
const container = new Container();
|
|
2906
2914
|
let cachedRenderWidth: number | undefined;
|
|
@@ -2978,7 +2986,7 @@ function buildWidgetComponent(jobs: AsyncJobState[], ui: ExtensionContext["ui"],
|
|
|
2978
2986
|
cachedExpanded = expanded;
|
|
2979
2987
|
cachedLines = (collapsed
|
|
2980
2988
|
? buildSingleLineWidgetLines(jobs, theme, width, frame)
|
|
2981
|
-
: fitAdaptiveWidgetLines(roots, buildLines, theme, width, expanded, frame, projectionFor)
|
|
2989
|
+
: fitAdaptiveWidgetLines(roots, buildLines, theme, width, expanded, frame, projectionFor, layout)
|
|
2982
2990
|
).map((line) => paddedWidgetLine(line, renderWidth));
|
|
2983
2991
|
return cachedLines;
|
|
2984
2992
|
};
|
|
@@ -3080,7 +3088,7 @@ export function buildWidgetLines(jobs: AsyncJobState[], theme: Theme, width = ge
|
|
|
3080
3088
|
/**
|
|
3081
3089
|
* Render the async jobs widget
|
|
3082
3090
|
*/
|
|
3083
|
-
export function renderWidget(ctx: ExtensionContext, jobs: AsyncJobState[], initiallyCollapsed = false): void {
|
|
3091
|
+
export function renderWidget(ctx: ExtensionContext, jobs: AsyncJobState[], initiallyCollapsed = false, layout: AsyncWidgetLayout = "adaptive"): void {
|
|
3084
3092
|
if (jobs.length === 0) {
|
|
3085
3093
|
resetWidgetLayoutSession();
|
|
3086
3094
|
asyncWidgetUpdates.delete(ctx.ui);
|
|
@@ -3096,7 +3104,7 @@ export function renderWidget(ctx: ExtensionContext, jobs: AsyncJobState[], initi
|
|
|
3096
3104
|
// component instead so progress cannot move it past other extensions' widgets.
|
|
3097
3105
|
const update = asyncWidgetUpdates.get(ctx.ui);
|
|
3098
3106
|
if (update) update(jobs);
|
|
3099
|
-
else ctx.ui.setWidget(WIDGET_KEY, buildWidgetComponent(jobs, ctx.ui, initiallyCollapsed));
|
|
3107
|
+
else ctx.ui.setWidget(WIDGET_KEY, buildWidgetComponent(jobs, ctx.ui, initiallyCollapsed, layout));
|
|
3100
3108
|
}
|
|
3101
3109
|
|
|
3102
3110
|
function renderSingleCompact(
|
|
@@ -3119,7 +3127,7 @@ function renderSingleCompact(
|
|
|
3119
3127
|
const width = getTermWidth() - 4;
|
|
3120
3128
|
const detailIndent = mainWindowIndent(layout, 1);
|
|
3121
3129
|
const continuationIndent = mainWindowIndent(layout, 2) + (layout.horizontalSpacing > 0 ? " " : "");
|
|
3122
|
-
const modelDisplay = modelThinkingBadge(theme, r.model ?? r.
|
|
3130
|
+
const modelDisplay = modelThinkingBadge(theme, r.progress?.model ?? r.model, r.thinking ?? r.progress?.thinking);
|
|
3123
3131
|
c.addChild(new Text(truncLine(`${resultGlyph(r, output, theme, isRunning, undefined, frame)} ${theme.fg("toolTitle", theme.bold(foregroundSingleDisplayName(r)))}${modelDisplay}${contextBadge}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`, width), 0, 0));
|
|
3124
3132
|
|
|
3125
3133
|
if (isRunning && r.progress) {
|
|
@@ -3378,7 +3386,7 @@ function renderMultiCompact(d: Details, theme: Theme, layout: MainWindowRenderLa
|
|
|
3378
3386
|
const pendingLabel = rPending ? ` ${theme.fg("dim", "· pending")}` : "";
|
|
3379
3387
|
const stepLabel = entry.rowLabel;
|
|
3380
3388
|
const rowProgressModel = rProg && "status" in rProg ? rProg : undefined;
|
|
3381
|
-
const rowModelDisplay = modelThinkingBadge(theme,
|
|
3389
|
+
const rowModelDisplay = modelThinkingBadge(theme, rowProgressModel?.model ?? r.model, r.thinking ?? rowProgressModel?.thinking);
|
|
3382
3390
|
const labelPrefix = stepLabel ? `${stepLabel}: ` : "";
|
|
3383
3391
|
const line = `${glyph} ${labelPrefix}${themeBold(theme, agentName)}${contextModeBadge(theme, r.context)}${rowModelDisplay}${stepStats ? ` ${theme.fg("dim", "·")} ${stepStats}` : ""}${pendingLabel}`;
|
|
3384
3392
|
c.addChild(new Text(truncLine(`${rowIndent}${line}`, width), 0, 0));
|
|
@@ -3579,7 +3587,7 @@ export function renderSubagentResult(
|
|
|
3579
3587
|
if (r.skillsWarning) {
|
|
3580
3588
|
c.addChild(new Text(fit(theme.fg("warning", `Warning: ${r.skillsWarning}`)), 0, 0));
|
|
3581
3589
|
}
|
|
3582
|
-
c.addChild(new Text(fit(theme.fg("dim", formatUsage(r.usage, r.model))), 0, 0));
|
|
3590
|
+
c.addChild(new Text(fit(theme.fg("dim", formatUsage(r.usage, r.progress?.model ?? r.model))), 0, 0));
|
|
3583
3591
|
if (r.sessionFile) {
|
|
3584
3592
|
c.addChild(new Text(fit(theme.fg("dim", `Session: ${shortenPath(r.sessionFile)}`)), 0, 0));
|
|
3585
3593
|
}
|
|
@@ -3725,7 +3733,7 @@ export function renderSubagentResult(
|
|
|
3725
3733
|
const resultOutput = getSingleResultOutput(r);
|
|
3726
3734
|
const rowPresentation = styledResultPresentation(resultPresentation(r, resultOutput, rRunning, progressRunningSeed(rProg), frame), theme);
|
|
3727
3735
|
const stats = rProg ? ` | ${rProg.toolCount} tools, ${formatDuration(rProg.durationMs)}` : "";
|
|
3728
|
-
const modelDisplay = modelThinkingBadge(theme,
|
|
3736
|
+
const modelDisplay = modelThinkingBadge(theme, rProg?.model ?? r.model, r.thinking ?? rProg?.thinking);
|
|
3729
3737
|
const stepLabel = entry.rowLabel;
|
|
3730
3738
|
const contextBadge = contextModeBadge(theme, r.context);
|
|
3731
3739
|
const labelPrefix = stepLabel ? `${stepLabel}: ` : "";
|