Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

simplify agents view and compact chat headers (#2180)

kt5c1416975973
diff --git a/packages/coding-agent/.changes/ui-agents-view.md b/packages/coding-agent/.changes/ui-agents-view.md
new file mode 100644
index 0000000000..0d2fe0d808
--- /dev/null
+++ b/packages/coding-agent/.changes/ui-agents-view.md
@@ -0,0 +1,7 @@
+- Changed the agents view to hide abandoned empty saved sessions consistently during search, simplify model labels, and keep secondary metadata quiet.
+- Changed the agents list to separate the splash from search, bold the shared column headings, mute populated status groups, and omit the global scope label.
+- Changed idle and inactive rows to share one bold status circle distinguished by color, keeping the animated mark for running rows and sub-agent expansion available through its keybinding.
+- Replaced chat and agents splash logos with a compact solid butterfly beside centered runtime metadata, with a text heading in narrow terminals.
+- Changed the agents header to show three metadata lines: title and version, agent counts, and the working directory globally or numeric depth in nested views; retained the nested back breadcrumb and chat model line.
+- Removed duplicate prompt suggestions from chat and agents headers.
+- Fixed empty-state search feedback while replying to or renaming an agent.
diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts
index 64641cf5b2..f73f51ca36 100644
--- a/packages/coding-agent/src/main.ts
+++ b/packages/coding-agent/src/main.ts
@@ -1478,7 +1478,6 @@ export async function main(args: string[], options?: MainOptions) {
migratedProviders,
modelFallbackMessage: startupModel.modelFallbackMessage,
promptStashStore,
- startupModelId: startupModel.model?.id,
initialSession,
initialScopeKey,
verbose: parsed.verbose,
diff --git a/packages/coding-agent/src/modes/agents-view/agents-view-mode.ts b/packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
index 9fa9e25fb7..973167826a 100644
--- a/packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
+++ b/packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
@@ -76,6 +76,7 @@ import {
buildUnifiedSessionIndex,
computeRecursiveRollups,
createUnattachableChildOpenResult,
+ filterEmptyAgentsViewSessions,
filterUnifiedSessions,
formatHeartbeatBadge,
getAgentsViewSelectionKey,
@@ -109,8 +110,7 @@ const STATUS_MESSAGE_DURATION_MS = 4500;
const SEARCH_PROMPT_PLACEHOLDER = "Search sessions";
const REPLY_PROMPT_FALLBACK_PLACEHOLDER = "Write a reply to this agent";
const RESUME_PROMPT_PLACEHOLDER = "Write a prompt to resume this session";
-const COMPLETED_ROW_ICON = "✓";
-const NEEDS_INPUT_ROW_ICON = "●";
+const STATUS_ROW_ICON = "•";
const SELECTED_ROW_MARKER = "\0agents-view-selected-row\0";
const CODE_ROW_MARKER = "\0agents-view-code-row\0";
@@ -121,7 +121,6 @@ export interface AgentsViewModeOptions {
createUiServicesForSession?: (summary: SessionSummary) => Promise<InteractiveModeUiServices>;
migratedProviders?: string[];
modelFallbackMessage?: string;
- startupModelId?: string;
verbose?: boolean;
recoverDaemon?: () => Promise<void>;
reconnectTimeoutMs?: number;
@@ -666,7 +665,6 @@ export class AgentsViewMode implements Component, Focusable {
private workingIconFrame = 0;
private rows: AgentsViewRow[] = [];
private allRows: AgentsViewRow[] = [];
- private showActions = false;
private lastListedSummaries: SessionSummary[] = [];
private lastVisibleSummaries: SessionSummary[] = [];
private savedSessions: AgentConnectionSavedSessionInfo[] = [];
@@ -841,23 +839,16 @@ export class AgentsViewMode implements Component, Focusable {
this.editor.invalidate();
},
};
- this.splash = new BrandSplashHeader(
- VERSION,
- () => this.getSplashModelId(),
- () => this.getSplashCwd(),
- undefined,
- {
- topPadding: true,
- getExtraMetadata: () => {
- const root = this.scopeRootSummary;
- return [
- { label: "agents", value: this.getAgentCountsText() },
- { label: "scope", value: root ? getAgentsViewSessionTitle(root) : "global" },
- { label: "depth", value: String(getAgentsViewDepth(root)) },
- ];
- },
+ this.splash = new BrandSplashHeader(VERSION, () => this.getSplashCwd(), undefined, {
+ topPadding: true,
+ getExtraMetadata: () => {
+ const root = this.scopeRootSummary;
+ return [
+ { label: "agents", value: this.getAgentCountsText() },
+ ...(root ? [{ label: "depth", value: String(getAgentsViewDepth(root)) }] : []),
+ ];
},
- );
+ });
}
async run(): Promise<AgentsViewRunResult> {
@@ -922,12 +913,6 @@ export class AgentsViewMode implements Component, Focusable {
handleInput(data: string): void {
this.clearStickyStatusMessage();
- if (this.showActions) {
- this.showActions = false;
- this.ui.requestRender();
- if (this.keybindings.matches(data, "app.shortcuts") || this.keybindings.matches(data, "tui.select.cancel"))
- return;
- }
if (this.renameTarget) {
if (this.keybindings.matches(data, "tui.select.cancel")) {
this.exitRenameMode();
@@ -973,11 +958,6 @@ export class AgentsViewMode implements Component, Focusable {
return;
}
if (!this.replyTarget && this.editor.getText().length === 0) {
- if (this.keybindings.matches(data, "app.shortcuts")) {
- this.showActions = !this.showActions;
- this.ui.requestRender();
- return;
- }
if (this.keybindings.matches(data, "app.agents.expand")) {
const row = this.rows[this.selectedIndex];
if (row && row.descendantCount > 0) this.toggleSubagentList(row);
@@ -1030,6 +1010,11 @@ export class AgentsViewMode implements Component, Focusable {
if (noticeLines.length > 0) {
headerLines.push("", ...noticeLines);
}
+ const root = this.scopeRootSummary;
+ if (root) {
+ const scopeLabel = `${keyText("app.agents.back")} back · ${getAgentsViewSessionTitle(root)} › subagents`;
+ headerLines.push("", truncateToWidth(theme.fg("dim", scopeLabel), width));
+ }
headerLines.push("");
// The prompt belongs to the scroll pane rather than the fullscreen dock, but
@@ -1306,7 +1291,13 @@ export class AgentsViewMode implements Component, Focusable {
private getFilteredRecords(): UnifiedSessionRecord[] {
const query = this.replyTarget || this.renameTarget ? (this.actionModeSearchQuery ?? "") : this.editor.getText();
- return filterUnifiedSessions(this.scopedRecords, (text) => matchesSearchText(text, query));
+ const preservedSessionIds = new Set([
+ ...(this.anchorSessionId ? [this.anchorSessionId] : []),
+ ...(this.scopeKey ? [this.scopeKey.sessionId] : []),
+ ...this.heartbeats.map((heartbeat) => heartbeat.job.sessionId),
+ ]);
+ const records = filterEmptyAgentsViewSessions(this.scopedRecords, preservedSessionIds);
+ return query.trim() ? filterUnifiedSessions(records, (text) => matchesSearchText(text, query)) : records;
}
/** Rebuild rows from the last fetched summaries, keeping selection on the same row. */
@@ -2486,7 +2477,6 @@ export class AgentsViewMode implements Component, Focusable {
private renderSessionRows(width: number, maxRows: number): string[] {
if (maxRows <= 0) return [];
- if (this.showActions) return this.renderActions(width).slice(0, maxRows);
const layout = buildCompactAgentsViewLayout(this.rows, width);
const displayItems: DisplayItem[] = [];
const counts = countRowsBySection(this.allRows.length > 0 ? this.allRows : this.rows);
@@ -2506,10 +2496,12 @@ export class AgentsViewMode implements Component, Focusable {
}
}
if (displayItems.length === 0) {
- return [theme.fg("dim", "No sessions match your search.")];
+ const query =
+ this.replyTarget || this.renameTarget ? (this.actionModeSearchQuery ?? "") : this.editor.getText();
+ return [theme.fg("dim", query.trim() ? "No sessions match your search." : "No sessions yet.")];
}
- // Reserve the shared column header before calculating the selection viewport.
- const headerRows = maxRows > 1 ? 1 : 0;
+ // Reserve the column header and its spacer, leaving at least one session row visible.
+ const headerRows = Math.min(2, maxRows - 1);
const visibleRows = maxRows - headerRows;
const selectedIdentity = this.rows[this.selectedIndex]?.identity;
const selectedDisplayIndex = displayItems.findIndex(
@@ -2534,13 +2526,14 @@ export class AgentsViewMode implements Component, Focusable {
);
}
if (item.type === "heading") {
- return theme.bold(truncateToWidth(`${sectionTitle(item.section)} (${counts[item.section]})`, width));
+ return theme.fg("muted", truncateToWidth(`${sectionTitle(item.section)} (${counts[item.section]})`, width));
}
return this.renderRow(item.row, width, layout);
});
if (showLeadingEllipsis) lines.unshift(theme.fg("dim", " ..."));
if (showTrailingEllipsis) lines.push(theme.fg("dim", " ..."));
- if (headerRows > 0) lines.unshift(theme.fg("muted", layout.legend));
+ if (headerRows > 1) lines.unshift("");
+ if (headerRows > 0) lines.unshift(theme.bold(layout.legend));
return lines;
}
@@ -2565,10 +2558,9 @@ export class AgentsViewMode implements Component, Focusable {
return markRow(formatTableCell(theme.fg("error", title), width));
}
const icon = this.formatRowIcon(row.section, this.getRowIcon(row.section));
- const expand = row.descendantCount > 0 ? (this.expandedSubagentParents.has(row.identity) ? "▾" : "▸") : " ";
const badge = formatHeartbeatBadge(row.heartbeat);
const heartbeat = badge ? `${theme.fg((row.heartbeat?.activeCount ?? 0) > 0 ? "error" : "dim", badge)} ` : "";
- const title = `${" ".repeat(row.depth)}${icon}${expand} ${heartbeat}${styleRowTitle(row)}`;
+ const title = `${" ".repeat(row.depth)}${icon} ${heartbeat}${styleRowTitle(row)}`;
const status =
row.summary.statusLabel !== undefined || row.summary.lastHeardFromAt !== undefined
? row.statusLabel
@@ -2579,39 +2571,10 @@ export class AgentsViewMode implements Component, Focusable {
formatTableCell(theme.fg("muted", formatSessionModel(row)), layout.modelWidth),
];
if (layout.activityWidth > 0) cells.push(formatTableCell(theme.fg("dim", activity), layout.activityWidth));
- cells.push(theme.fg("muted", details));
+ cells.push(theme.fg("dim", details));
return markRow(formatTableCell(cells.join(" "), width));
}
- private renderActions(width: number): string[] {
- const row = this.rows[this.selectedIndex];
- const actions = [
- `${keyText("tui.select.confirm")} open ${keyText("app.agents.open")} open ${keyText("app.agents.new")} new`,
- `${keyText("app.agents.expand")} expand/collapse subagents ${keyText("app.agents.program")} program`,
- `${keyText("app.agents.reply")} reply/resume ${keyText("app.agents.rename")} rename ${keyText("app.agents.delete")} stop/delete`,
- `${keyText("app.shortcuts")} close actions`,
- ];
- if (row) {
- const model = row.summary.model;
- const savedModel = row.record?.saved?.model;
- const modelLabel = model
- ? `${model.provider}/${model.id}`
- : savedModel
- ? `${savedModel.provider}/${savedModel.modelId}`
- : "unknown";
- const usage = row.summary.usage;
- actions.push(
- "",
- row.title,
- `Model: ${modelLabel}${row.summary.thinkingLevel ? ` · ${row.summary.thinkingLevel}` : ""}`,
- `Directory: ${row.summary.cwd}`,
- `Tokens: ${usage?.inputTokens ?? 0} in · ${usage?.outputTokens ?? 0} out`,
- `Cost: $${(usage?.cost ?? 0).toFixed(2)} session · $${row.recursiveCost.toFixed(2)} including subagents`,
- );
- }
- return actions.flatMap((line) => wrapTextWithAnsi(theme.fg("muted", line), width));
- }
-
// Spawn-code rows are read-only context. They render deemphasized — muted
// text on a panel background (applied in finalizeRenderedLine) so the program
// reads as one quiet segmented block rather than competing with agent rows.
@@ -2698,7 +2661,7 @@ export class AgentsViewMode implements Component, Focusable {
if (this.replyTarget) {
return truncateToWidth(theme.fg("muted", this.renderReplyComposerHints()), width);
}
- const hints = `${keyText("tui.select.up")}/${keyText("tui.select.down")} navigate ${keyText("tui.select.confirm")} open ${keyText("app.agents.new")} new ${keyText("app.shortcuts")} actions`;
+ const hints = `${keyText("tui.select.up")}/${keyText("tui.select.down")} navigate ${keyText("tui.select.confirm")} open ${keyText("app.agents.new")} new`;
return truncateToWidth(theme.fg("muted", hints), width);
}
@@ -2728,11 +2691,8 @@ export class AgentsViewMode implements Component, Focusable {
return Math.max(0, rows - dockHeight);
}
- private getSplashModelId(): string | undefined {
- return this.rows[this.selectedIndex]?.summary.model?.id ?? this.options.startupModelId;
- }
-
- private getSplashCwd(): string {
+ private getSplashCwd(): string | undefined {
+ if (this.scopeRootSummary) return undefined;
return this.rows[this.selectedIndex]?.summary.cwd ?? this.options.uiServices.getInitialCwd();
}
@@ -2741,9 +2701,8 @@ export class AgentsViewMode implements Component, Focusable {
case "running":
return workingIconFrame(this.workingIconFrame);
case "idle":
- return NEEDS_INPUT_ROW_ICON;
case "inactive":
- return COMPLETED_ROW_ICON;
+ return STATUS_ROW_ICON;
default: {
const _exhaustive: never = section;
return _exhaustive;
@@ -2756,9 +2715,9 @@ export class AgentsViewMode implements Component, Focusable {
case "running":
return theme.bold(icon);
case "idle":
- return theme.fg("warning", icon);
+ return theme.bold(theme.fg("warning", icon));
case "inactive":
- return theme.fg("dim", icon);
+ return theme.bold(theme.fg("dim", icon));
default: {
const _exhaustive: never = section;
return _exhaustive;
@@ -2877,7 +2836,7 @@ function formatTableCell(value: string, width: number): string {
// Model ids can embed a provider path ("moonshotai/kimi-k2"); the column shows
// the bare model name plus the thinking level ("kimi-k2:high") when one is
// active — "off" reads as noise, so it and absent levels render bare (saved
-// rows carry no level). The actions panel keeps the full provider/id · level form.
+// rows carry no level).
function formatSessionModel(row: AgentsViewRow): string {
const id = row.summary.model?.id ?? row.record?.saved?.model?.modelId;
if (!id) return "-";
diff --git a/packages/coding-agent/src/modes/agents-view/agents-view-state.ts b/packages/coding-agent/src/modes/agents-view/agents-view-state.ts
index 6d8dcbbbbd..85d9c93ff6 100644
--- a/packages/coding-agent/src/modes/agents-view/agents-view-state.ts
+++ b/packages/coding-agent/src/modes/agents-view/agents-view-state.ts
@@ -424,6 +424,43 @@ export function filterUnifiedSessions(
return records.filter((record) => retained.has(record));
}
+/** Hide abandoned empty catalog entries without changing saved sessions or their ancestry. */
+export function filterEmptyAgentsViewSessions(
+ records: readonly UnifiedSessionRecord[],
+ preservedSessionIds: ReadonlySet<string> = new Set(),
+): UnifiedSessionRecord[] {
+ const index = buildUnifiedSessionIndex(records);
+ const retained = new Set<UnifiedSessionRecord>();
+ for (const record of records) {
+ const summary = summaryForUnifiedRecord(record);
+ const firstMessage = summary.firstMessage?.trim();
+ const keep =
+ record.section !== "inactive" ||
+ summary.activeSessionId !== undefined ||
+ summary.isSessionActive ||
+ summary.attachedClients > 0 ||
+ summary.hasActiveHeartbeat ||
+ summary.hasRegisteredHeartbeat ||
+ summary.hasRegisteredCronJob ||
+ (record.heartbeat?.activeCount ?? 0) + (record.heartbeat?.pausedCount ?? 0) > 0 ||
+ !isEmptyAgentsViewSession(summary) ||
+ (record.saved?.messageCount ?? 0) > 0 ||
+ Boolean(summary.sessionName?.trim()) ||
+ Boolean(firstMessage && firstMessage !== "(no messages)") ||
+ Boolean(record.saved?.allMessagesText.trim()) ||
+ (summary.usage?.cost ?? 0) > 0 ||
+ isSubagentSummary(summary) ||
+ preservedSessionIds.has(summary.sessionId);
+ if (!keep) continue;
+ let current: UnifiedSessionRecord | undefined = record;
+ while (current && !retained.has(current)) {
+ retained.add(current);
+ current = findParentRecord(current, index.byKey);
+ }
+ }
+ return records.filter((record) => retained.has(record));
+}
+
export interface UnifiedSessionIndex {
byKey: Map<string, UnifiedSessionRecord>;
childrenByParent: Map<UnifiedSessionRecord, UnifiedSessionRecord[]>;
diff --git a/packages/coding-agent/src/modes/daemon/daemon-mode.ts b/packages/coding-agent/src/modes/daemon/daemon-mode.ts
index 7ba94b8366..2f4b15e08b 100644
--- a/packages/coding-agent/src/modes/daemon/daemon-mode.ts
+++ b/packages/coding-agent/src/modes/daemon/daemon-mode.ts
@@ -3404,9 +3404,7 @@ export class AgentDaemon {
...(entry.repliedSinceTask !== undefined ? { repliedSinceTask: entry.repliedSinceTask } : {}),
...(entry.parentSessionId ? { parentSessionId: entry.parentSessionId } : {}),
...(entry.rlmChildId ? { rlmChildId: entry.rlmChildId } : {}),
- ...(entry.firstMessage
- ? { firstMessage: entry.firstMessage.slice(0, AGENT_OBSERVE_PREVIEW_MAX_CHARS) }
- : {}),
+ ...(entry.firstMessage ? { firstMessage: entry.firstMessage.slice(0, AGENT_OBSERVE_PREVIEW_MAX_CHARS) } : {}),
};
}
@@ -3482,7 +3480,11 @@ export class AgentDaemon {
...(summary.firstMessage ? { firstMessage: summary.firstMessage } : {}),
...(latest
? {
- latestMessage: createAgentObserveMessagePreview(latest, messages.length - 1, AGENT_OBSERVE_PREVIEW_MAX_CHARS),
+ latestMessage: createAgentObserveMessagePreview(
+ latest,
+ messages.length - 1,
+ AGENT_OBSERVE_PREVIEW_MAX_CHARS,
+ ),
}
: {}),
};
diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
index 59f648a4a1..4e42449e9a 100644
--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts
+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
@@ -136,7 +136,7 @@ import {
type TelemetryOnboardingOutcome,
} from "../../core/telemetry.js";
import { type TruncationResult, truncateTail } from "../../core/tools/truncate.js";
-import { PRIME_BUTTERFLY_LOGO } from "../../themes/prime-logo.js";
+import { PRIME_COMPACT_BUTTERFLY_LOGO } from "../../themes/prime-logo.js";
import { getChangelogPath, parseChangelog } from "../../utils/changelog.js";
import { spawnHidden, spawnSyncHidden } from "../../utils/child-process.js";
import { copyToClipboard } from "../../utils/clipboard.js";
@@ -438,25 +438,22 @@ export interface BrandSplashMetadataLine {
export interface BrandSplashHeaderOptions {
logo?: string;
topPadding?: boolean;
+ getModelId?: () => string | undefined;
getExtraMetadata?: () => readonly BrandSplashMetadataLine[];
- getHideStartHint?: () => boolean;
- getStartHint?: () => string;
}
export class BrandSplashHeader implements Component {
private readonly logoRaw: string[];
private readonly logoCanvasWidth: number;
- private readonly gutter = 4;
- private readonly labelWidth = 9;
+ private readonly gutter = 3;
constructor(
private readonly version: string,
- private readonly getModelId: () => string | undefined,
- private readonly getCwd: () => string,
+ private readonly getCwd: () => string | undefined,
private readonly verboseInstructions?: string,
private readonly options: BrandSplashHeaderOptions = {},
) {
- this.logoRaw = (options.logo ?? PRIME_BUTTERFLY_LOGO).split("\n");
+ this.logoRaw = (options.logo ?? PRIME_COMPACT_BUTTERFLY_LOGO).split("\n");
this.logoCanvasWidth = this.logoRaw.reduce((max, line) => Math.max(max, visibleWidth(line)), 0);
}
@@ -468,41 +465,50 @@ export class BrandSplashHeader implements Component {
const safeWidth = Math.max(1, width);
const paddingX = safeWidth > 1 ? 1 : 0;
const contentWidth = Math.max(1, safeWidth - paddingX * 2);
- const metaWidth = contentWidth - this.logoCanvasWidth - this.gutter;
- const showMeta = metaWidth >= this.labelWidth + 8;
- const valueWidth = Math.max(1, metaWidth - this.labelWidth);
- const labelled = (label: string, value: string) => {
- const displayValue =
- label === "cwd" ? truncatePathMiddle(value, valueWidth) : truncateToWidth(value, valueWidth);
- return theme.fg("dim", label.padEnd(this.labelWidth)) + theme.fg("muted", displayValue);
- };
+ const showLogo = this.logoCanvasWidth > 0 && contentWidth - this.logoCanvasWidth - this.gutter >= 24;
+ const metaWidth = showLogo ? contentWidth - this.logoCanvasWidth - this.gutter : contentWidth;
const extraMetadata = this.options.getExtraMetadata?.() ?? [];
- const hideStartHint = this.options.getHideStartHint?.() ?? false;
- const startHint = this.options.getStartHint?.() ?? "type to search sessions";
- const metaLines = showMeta
- ? [
- labelled("version", `v${this.version}`),
- labelled("model", this.getModelId() ?? "—"),
- labelled("cwd", formatSplashCwd(this.getCwd())),
- ...extraMetadata.map((line) => labelled(line.label, line.value)),
- ...(hideStartHint ? [] : ["", theme.fg("dim", startHint)]),
- ]
- : [];
- const metaStart = Math.max(0, Math.floor((this.logoRaw.length - metaLines.length) / 2));
+ const version = theme.fg("muted", `v${this.version}`);
+ const titleText = "prime agent";
+ const title = theme.fg("text", titleText);
+ const modelLabel = "model ";
+ const cwdLabel = "cwd ";
+ const cwd = this.getCwd();
+ const metaLines = [
+ ...(visibleWidth(`${titleText} v${this.version}`) <= metaWidth ? [`${title} ${version}`] : [title, version]),
+ ...(this.options.getModelId
+ ? [
+ `${theme.fg("dim", modelLabel)}${theme.fg(
+ "muted",
+ truncateToWidth(
+ this.options.getModelId() ?? "—",
+ Math.max(1, metaWidth - visibleWidth(modelLabel)),
+ ),
+ )}`,
+ ]
+ : []),
+ ...extraMetadata.map(({ label, value }) => `${theme.fg("dim", `${label} `)}${theme.fg("muted", value)}`),
+ ...(cwd === undefined
+ ? []
+ : [
+ `${theme.fg("dim", cwdLabel)}${theme.fg("muted", truncatePathMiddle(formatSplashCwd(cwd), Math.max(1, metaWidth - visibleWidth(cwdLabel))))}`,
+ ]),
+ ];
const lines = this.options.topPadding ? [""] : [];
- lines.push(
- ...this.logoRaw.map((line, index) => {
- const colored = theme.fg("text", line);
- const meta = index >= metaStart && index < metaStart + metaLines.length ? metaLines[index - metaStart] : "";
- const padding = showMeta
- ? " ".repeat(Math.max(0, this.logoCanvasWidth - visibleWidth(line) + this.gutter))
- : "";
- const content = truncateToWidth(colored + padding + meta, contentWidth, "");
- return (
- " ".repeat(paddingX) + content + " ".repeat(Math.max(0, safeWidth - paddingX - visibleWidth(content)))
- );
- }),
- );
+ const rowCount = Math.max(showLogo ? this.logoRaw.length : 0, metaLines.length);
+ const metaStartIndex = showLogo ? Math.floor((rowCount - metaLines.length) / 2) : 0;
+ for (let index = 0; index < rowCount; index++) {
+ const logoLine = showLogo ? (this.logoRaw[index] ?? "") : "";
+ const logo = showLogo
+ ? theme.fg("text", logoLine) + " ".repeat(this.logoCanvasWidth - visibleWidth(logoLine) + this.gutter)
+ : "";
+ const metaIndex = index - metaStartIndex;
+ const metaLine = metaIndex >= 0 && metaIndex < metaLines.length ? metaLines[metaIndex] : "";
+ const content = truncateToWidth(logo + metaLine, contentWidth);
+ lines.push(
+ " ".repeat(paddingX) + content + " ".repeat(Math.max(0, safeWidth - paddingX - visibleWidth(content))),
+ );
+ }
if (this.verboseInstructions) {
lines.push(" ".repeat(safeWidth));
@@ -1431,12 +1437,12 @@ export class InteractiveMode {
this.ui.addChild(this.headerContainer);
- // Brand splash: side-panel layout with structured runtime metadata on the right.
+ // Compact butterfly beside runtime metadata.
// The model/cwd are read through live getters, so they fill in once the
// connection state loads (rebindCurrentSession below). Onboarding, when
// required, renders as a full-screen overlay on top of this header.
if (this.options.verbose || !this.settingsManager.getQuietStartup()) {
- // Verbose: include the full keybinding cheatsheet under the brand mark.
+ // Verbose: include the full keybinding cheatsheet below the header.
const hint = (keybinding: AppKeybinding, description: string) => keyHint(keybinding, description);
const verboseInstructions = this.options.verbose
? [
@@ -1462,16 +1468,10 @@ export class InteractiveMode {
rawKeyHint("drop files", "to attach"),
].join("\n")
: undefined;
- this.builtInHeader = new BrandSplashHeader(
- this.version,
- () => this.getCurrentModelId(),
- () => this.getCurrentCwd(),
- verboseInstructions,
- {
- topPadding: true,
- getHideStartHint: () => true,
- },
- );
+ this.builtInHeader = new BrandSplashHeader(this.version, () => this.getCurrentCwd(), verboseInstructions, {
+ topPadding: true,
+ getModelId: () => this.getCurrentModelId(),
+ });
this.headerContainer.addChild(this.builtInHeader);
this.headerContainer.addChild(new Spacer(1));
} else {
diff --git a/packages/coding-agent/src/themes/prime-logo.ts b/packages/coding-agent/src/themes/prime-logo.ts
index d8e2d7930d..6b3a322b35 100644
--- a/packages/coding-agent/src/themes/prime-logo.ts
+++ b/packages/coding-agent/src/themes/prime-logo.ts
@@ -16,3 +16,12 @@ export const PRIME_BUTTERFLY_LOGO = ` ▄▄███
█████ ▀█▄▄▄█████▀
███████▄ ████████▀
▀███▀▀ █████▀`;
+
+/** Compact 7-row × 22-column butterfly, rendered from the brand SVG with solid quadrant cells. */
+export const PRIME_COMPACT_BUTTERFLY_LOGO = ` ▗▄▄█▀
+ ███▄ ▗▄███▀
+ ▗█▛▐█▙ ▗▄█▀▗█▀
+ ▗█▛ ▟██▙▄██▛ ▟▛
+ ▗▟▌ ▐███▛▘▗▄█▖
+▟███▄ ▄▄▟███▀
+▜█▛▀▘ ▜█▛▀▘`;
diff --git a/packages/coding-agent/test/agents-view-empty-sessions.test.ts b/packages/coding-agent/test/agents-view-empty-sessions.test.ts
new file mode 100644
index 0000000000..b025812f1a
--- /dev/null
+++ b/packages/coding-agent/test/agents-view-empty-sessions.test.ts
@@ -0,0 +1,77 @@
+import { describe, expect, it } from "vitest";
+import type { AgentConnectionSavedSessionInfo } from "../src/modes/agent-connection/types.js";
+import { filterEmptyAgentsViewSessions, reconcileUnifiedSessions } from "../src/modes/agents-view/agents-view-state.js";
+import type { SessionSummary } from "../src/modes/daemon/daemon-session-list.js";
+
+function saved(id: string, overrides: Partial<AgentConnectionSavedSessionInfo> = {}): AgentConnectionSavedSessionInfo {
+ return {
+ id,
+ path: `/tmp/${id}.jsonl`,
+ cwd: "/tmp/project",
+ created: new Date(0),
+ modified: new Date(0),
+ messageCount: 0,
+ firstMessage: "(no messages)",
+ allMessagesText: "",
+ ...overrides,
+ };
+}
+
+function live(id: string, overrides: Partial<SessionSummary> = {}): SessionSummary {
+ return {
+ id,
+ activeSessionId: id,
+ sessionId: id,
+ lifecycle: "live",
+ activity: "idle",
+ isSessionActive: false,
+ cwd: "/tmp/project",
+ isStreaming: false,
+ isCompacting: false,
+ attachedClients: 0,
+ messageCount: 0,
+ sessionActions: { queuedCount: 0, steering: [], followUps: [] },
+ ...overrides,
+ };
+}
+
+describe("agents view empty session filtering", () => {
+ it("hides only abandoned empty saved sessions and leaves the catalog intact", () => {
+ const records = reconcileUnifiedSessions(
+ [],
+ [
+ saved("empty"),
+ saved("conversation", { messageCount: 2, firstMessage: "Fix authentication" }),
+ saved("named", { name: "My next task" }),
+ saved("usage", { usage: { inputTokens: 20, outputTokens: 5, cost: 0.01 } }),
+ ],
+ );
+ expect(filterEmptyAgentsViewSessions(records).map((record) => record.saved?.id)).toEqual([
+ "conversation",
+ "named",
+ "usage",
+ ]);
+ expect(records).toHaveLength(4);
+ expect(records[0]?.saved?.firstMessage).toBe("(no messages)");
+ });
+
+ it("preserves active sessions, the entered-from session, and scheduled sessions", () => {
+ const records = reconcileUnifiedSessions(
+ [live("idle"), live("working", { isSessionActive: true, isStreaming: true, activity: "working" })],
+ [saved("anchor"), saved("scheduled"), saved("empty")],
+ );
+ expect(
+ filterEmptyAgentsViewSessions(records, new Set(["anchor", "scheduled"])).map(
+ (record) => record.daemon?.sessionId ?? record.saved?.id,
+ ),
+ ).toEqual(["idle", "working", "anchor", "scheduled"]);
+ });
+
+ it("retains empty ancestors and subagents so their hierarchy stays navigable", () => {
+ const records = reconcileUnifiedSessions(
+ [],
+ [saved("parent"), saved("child", { parentSessionPath: "/tmp/parent.jsonl", rlmDepth: 1 }), saved("empty")],
+ );
+ expect(filterEmptyAgentsViewSessions(records).map((record) => record.saved?.id)).toEqual(["parent", "child"]);
+ });
+});
diff --git a/packages/coding-agent/test/agents-view-mode.test.ts b/packages/coding-agent/test/agents-view-mode.test.ts
index 410587ca97..fe0c6523bb 100644
--- a/packages/coding-agent/test/agents-view-mode.test.ts
+++ b/packages/coding-agent/test/agents-view-mode.test.ts
@@ -853,14 +853,7 @@ describe("AgentsViewMode", () => {
expect(render("with-model")).toContain("glm-4.7");
expect(render("bare")).toMatch(/\s-\s/);
expect(render("bare")).not.toContain("glm-4.7");
- // The actions panel shows the same recorded model instead of "unknown".
- Reflect.set(
- view,
- "selectedIndex",
- rows.findIndex((row) => row.summary.sessionId === "with-model"),
- );
- const actions = (invoke("renderActions", view, 120) as string[]).map(stripAnsi).join("\n");
- expect(actions).toContain("Model: prime-inference/glm-4.7");
+ expect(Reflect.get(AgentsViewMode.prototype, "renderActions")).toBeUndefined();
} finally {
stopThemeWatcher();
}
@@ -900,8 +893,14 @@ describe("AgentsViewMode", () => {
const rendered = invoke("renderSessionRows", view, 120, 40) as string[];
const lines = rendered.map(stripAnsi);
expect(lines.filter((line) => /Model/.test(line) && /Age/i.test(line))).toHaveLength(1);
- expect(lines.some((line) => line.startsWith("Running"))).toBe(true);
- expect(lines.some((line) => line.startsWith("Idle"))).toBe(true);
+ expect(rendered[0]).toBe(
+ theme.bold(buildCompactAgentsViewLayout(Reflect.get(view, "rows") as AgentsViewRow[], 120).legend),
+ );
+ expect(lines[1]).toBe("");
+ expect(lines[2]).toBe("Running (1)");
+ expect(rendered[2]).toContain(theme.fg("muted", "Running (1)"));
+ expect(lines).toContain("Idle (1)");
+ expect(lines).not.toContain("Inactive (0)");
expect(lines.join("\n")).not.toMatch(/show program|#sub|\$agent|↑in|↓out/);
const rows = Reflect.get(view, "rows") as AgentsViewRow[];
expect(rows.filter((row) => row.kind === "subagent-summary")).toHaveLength(0);
@@ -913,6 +912,113 @@ describe("AgentsViewMode", () => {
}
});
+ it("renders a shared color-coded status circle for idle and inactive rows", () => {
+ const summaries = [
+ summary({
+ id: "busy",
+ activeSessionId: "busy",
+ sessionId: "busy-session",
+ sessionName: "busy",
+ activity: "working",
+ isStreaming: true,
+ }),
+ summary({
+ id: "idle",
+ activeSessionId: "idle",
+ sessionId: "idle-session",
+ sessionName: "idle",
+ sessionFile: "/tmp/idle.jsonl",
+ }),
+ ];
+ const archived: AgentConnectionSavedSessionInfo = {
+ id: "archived",
+ path: "/tmp/archived.jsonl",
+ cwd: "/tmp/project",
+ created: new Date(0),
+ modified: new Date(0),
+ messageCount: 2,
+ firstMessage: "Fix authentication",
+ allMessagesText: "",
+ name: "archived session",
+ };
+ const view = new AgentsViewMode({ config: {}, uiServices: createUiServices() }, {});
+ try {
+ Reflect.set(view, "lastListedSummaries", summaries);
+ Reflect.set(view, "savedSessions", [archived]);
+ invoke("reconcileCatalogs", view);
+ Reflect.set(view, "selectedIndex", -1);
+ Reflect.set(view, "ui", { terminal: { rows: 60 }, requestRender: () => {} });
+ const rendered = invoke("renderSessionRows", view, 120, 40) as string[];
+ const output = rendered.map(stripAnsi).join("\n");
+ expect(output).toContain("Running (1)");
+ expect(output).toContain("Idle (1)");
+ expect(output).toContain("Inactive (1)");
+ const runningRow = rendered.find((line) => stripAnsi(line).includes("busy"))!;
+ const idleRow = rendered.find((line) => stripAnsi(line).includes("idle"))!;
+ const inactiveRow = rendered.find((line) => stripAnsi(line).includes("archived session"))!;
+ expect(runningRow).toContain(theme.bold("◇"));
+ expect(idleRow).toContain(theme.bold(theme.fg("warning", "•")));
+ expect(inactiveRow).toContain(theme.bold(theme.fg("dim", "•")));
+ expect(stripAnsi(runningRow)).toMatch(/◇ busy/u);
+ expect(stripAnsi(idleRow)).toMatch(/• idle/u);
+ expect(stripAnsi(inactiveRow)).toMatch(/• archived session/u);
+ expect(output).not.toContain("●");
+ expect(output).not.toContain("✓");
+ } finally {
+ stopThemeWatcher();
+ }
+ });
+
+ it("omits empty status categories and keeps feedback when no sessions match", () => {
+ const view = new AgentsViewMode({ config: {}, uiServices: createUiServices() }, { savedCatalogLoaded: true });
+ const finish = vi.fn();
+ Reflect.set(view, "finish", finish);
+ const render = () => (invoke("renderSessionRows", view, 120, 20) as string[]).map(stripAnsi);
+ const expectEmptyList = (message: string) => {
+ expect(render()).toEqual([message]);
+ expect(Reflect.get(view, "rows")).toEqual([]);
+ invoke("moveSelection", view, 1);
+ invoke("openSelected", view);
+ expect(finish).not.toHaveBeenCalled();
+ };
+ try {
+ invoke("reconcileCatalogs", view);
+ expectEmptyList("No sessions yet.");
+ Reflect.set(view, "lastListedSummaries", [summary({ sessionName: "Review changes" })]);
+ invoke("reconcileCatalogs", view);
+ expect(render()).not.toContain("Running (0)");
+ expect(render()).toContain("Idle (1)");
+ expect(render()).not.toContain("Inactive (0)");
+ invoke("setSearchQuery", view, "unmatched-session");
+ expectEmptyList("No sessions match your search.");
+ invoke("setSearchQuery", view, "");
+ invoke("moveSelection", view, 1);
+ invoke("openSelected", view);
+ expect(finish).toHaveBeenCalledWith(
+ expect.objectContaining({ summary: expect.objectContaining({ sessionName: "Review changes" }) }),
+ );
+ } finally {
+ stopThemeWatcher();
+ }
+ });
+
+ it.each(["replyTarget", "renameTarget"])("uses the preserved search for empty-state copy during %s", (target) => {
+ const view = new AgentsViewMode({ config: {}, uiServices: createUiServices() }, { savedCatalogLoaded: true });
+ try {
+ Reflect.set(view, target, { summary: summary() });
+ Reflect.set(view, "actionModeSearchQuery", "");
+ Reflect.set(view, "editor", { getText: () => "a reply or new name" });
+ expect((invoke("renderSessionRows", view, 120, 20) as string[]).map(stripAnsi)).toEqual(["No sessions yet."]);
+ Reflect.set(view, "actionModeSearchQuery", "missing session");
+ Reflect.set(view, "editor", { getText: () => "" });
+ expect((invoke("renderSessionRows", view, 120, 20) as string[]).map(stripAnsi)).toEqual([
+ "No sessions match your search.",
+ ]);
+ } finally {
+ stopThemeWatcher();
+ }
+ });
+
it("always renders inactive sessions; search is the only filter", () => {
const live = summary({ sessionName: "live" });
const saved = summary({
@@ -1013,31 +1119,123 @@ describe("AgentsViewMode", () => {
Reflect.set(view, "selectedIndex", rows.length - 1);
Reflect.set(view, "ui", { terminal: { rows: 13 }, requestRender: () => {} });
const lines = (invoke("renderSessionRows", view, 120, 4) as string[]).map(stripAnsi);
- expect(lines[1]).toContain("...");
+ expect(lines[1]).toBe("");
+ expect(lines[2]).toContain("...");
expect(lines).toHaveLength(4);
const lastTitle = rows.at(-1)!.title;
expect(lines.some((line) => line.includes(lastTitle))).toBe(true);
+ for (let maxRows = 1; maxRows <= 10; maxRows += 1) {
+ for (let selectedIndex = 0; selectedIndex < rows.length; selectedIndex += 1) {
+ Reflect.set(view, "selectedIndex", selectedIndex);
+ const viewport = invoke("renderSessionRows", view, 120, maxRows) as string[];
+ const selected = viewport.filter((line) => line.includes("\0agents-view-selected-row\0"));
+ expect(viewport.length).toBeLessThanOrEqual(maxRows);
+ expect(selected).toHaveLength(1);
+ expect(selected[0]).toContain(rows[selectedIndex]!.title);
+ }
+ }
} finally {
stopThemeWatcher();
}
});
- it("reveals usage details through actions and closes them before searching", () => {
+ it("strips provider prefixes from compact row model labels", () => {
const view = new AgentsViewMode({ config: {}, uiServices: createUiServices() }, { savedCatalogLoaded: true });
try {
Reflect.set(view, "lastListedSummaries", [
- summary({ sessionName: "parent", usage: { inputTokens: 1234, outputTokens: 56, cost: 1.23 } }),
+ summary({
+ model: { ...getModel("openai", "gpt-4o"), provider: "prime-inference", id: "internal/glm-5.3-fast" },
+ usage: { inputTokens: 100, outputTokens: 10, cost: 0.12 },
+ }),
]);
invoke("reconcileCatalogs", view);
- view.handleInput("?");
- const actions = (invoke("renderSessionRows", view, 120, 20) as string[]).map(stripAnsi).join("\n");
- expect(actions).toContain("1234 in");
- expect(actions).toContain("$1.23");
- view.handleInput("p");
- expect(Reflect.get(view, "showActions")).toBe(false);
const rows = (invoke("renderSessionRows", view, 120, 20) as string[]).map(stripAnsi).join("\n");
- expect(rows).toContain("parent");
- expect(rows).not.toContain("1234 in");
+ expect(rows).toContain("glm-5.3-fast");
+ expect(rows).not.toContain("internal/");
+ expect(rows).not.toContain("prime-inference");
+ } finally {
+ stopThemeWatcher();
+ }
+ });
+
+ it("keeps search to a quiet single row and reports nested depth in three metadata lines", () => {
+ const view = new AgentsViewMode({ config: {}, uiServices: createUiServices() }, { savedCatalogLoaded: true });
+ try {
+ Reflect.set(view, "lastListedSummaries", [summary({ sessionName: "Review changes" })]);
+ invoke("reconcileCatalogs", view);
+ const prompt = invoke("renderPrompt", view, 80) as string[];
+ expect(prompt).toHaveLength(1);
+ expect(stripAnsi(prompt[0]!)).toContain("Search sessions");
+ expect(prompt[0]).not.toContain("\x1b[48;");
+ const globalLines = (invoke("renderContent", view, 100, 40) as string[]).map(stripAnsi);
+ const searchIndex = globalLines.findIndex((line) => line.includes("Search sessions"));
+ expect(globalLines[searchIndex - 1]).toBe("");
+ expect(globalLines[searchIndex - 2]!.trim()).not.toBe("");
+ expect(globalLines[searchIndex + 1]).toBe("");
+ expect(globalLines[searchIndex + 2]).toMatch(/Session\s+Model/);
+ expect(globalLines.join("\n")).not.toContain("All sessions");
+ expect(globalLines.join("\n")).not.toContain("back ·");
+ expect(globalLines.filter((line) => /prime agent|agents \d|cwd /.test(line))).toHaveLength(3);
+ expect(globalLines.join("\n")).toContain("cwd /tmp");
+ expect(globalLines.join("\n")).not.toMatch(/depth\s+|model\s+/);
+ for (let height = 1; height <= 6; height += 1) {
+ const shortLines = (invoke("renderContent", view, 80, height) as string[]).map(stripAnsi);
+ expect(shortLines.length).toBeLessThanOrEqual(height);
+ expect(shortLines.join("\n")).toContain("Search sessions");
+ if (height > 1) expect(shortLines.join("\n")).toContain("Review changes");
+ }
+ Reflect.set(view, "scopeRootSummary", summary({ sessionName: "Fix authentication", rlmDepth: 3 }));
+ for (const width of [40, 100]) {
+ const lines = (invoke("renderContent", view, width, 40) as string[]).map(stripAnsi);
+ expect(lines.filter((line) => /prime agent|agents \d|depth /.test(line))).toHaveLength(3);
+ expect(lines.join("\n")).toContain("depth 4");
+ expect(lines.join("\n")).not.toMatch(/scope\s+|cwd\s+|model\s+/);
+ if (width === 100) expect(lines.join("\n")).toContain("← back · Fix authentication › subagents");
+ }
+ Reflect.set(view, "scopeRootSummary", undefined);
+ const restored = (invoke("renderContent", view, 100, 40) as string[]).map(stripAnsi).join("\n");
+ expect(restored).toContain("cwd /tmp");
+ expect(restored).not.toContain("depth ");
+ } finally {
+ stopThemeWatcher();
+ }
+ });
+
+ it("keeps abandoned saved entries out of rows and section counts before, during, and after search", () => {
+ const abandoned: AgentConnectionSavedSessionInfo = {
+ path: "/tmp/abandoned.jsonl",
+ id: "abandoned-session",
+ cwd: "/tmp/project",
+ created: new Date(0),
+ modified: new Date(0),
+ messageCount: 0,
+ firstMessage: "(no messages)",
+ allMessagesText: "",
+ };
+ const persistentState: AgentsViewPersistentState = { savedCatalogLoaded: true, savedSessions: [abandoned] };
+ const view = new AgentsViewMode({ config: {}, uiServices: createUiServices() }, persistentState);
+ try {
+ Reflect.set(view, "lastListedSummaries", [summary({ sessionName: "active", messageCount: 0 })]);
+ invoke("reconcileCatalogs", view);
+ const rowIds = () => (Reflect.get(view, "rows") as AgentsViewRow[]).map((row) => row.summary.sessionId);
+ const expectNoAbandonedRows = () => {
+ expect(rowIds()).not.toContain("abandoned-session");
+ const rendered = (invoke("renderSessionRows", view, 120, 20) as string[]).map(stripAnsi).join("\n");
+ expect(rendered).not.toContain("Inactive");
+ expect(rendered).not.toContain("(no messages)");
+ expect(invoke("getAgentCountsText", view)).toBe(`0 running, ${rowIds().length} idle, 0 inactive`);
+ };
+ expect(rowIds()).toEqual(["scope-session"]);
+ expectNoAbandonedRows();
+ for (const query of ["abandoned-session", "(no messages)", "project", "active"]) {
+ invoke("setSearchQuery", view, query);
+ expectNoAbandonedRows();
+ }
+ expect(rowIds()).toEqual(["scope-session"]);
+ invoke("setSearchQuery", view, "");
+ expect(rowIds()).toEqual(["scope-session"]);
+ expectNoAbandonedRows();
+ expect(persistentState.savedSessions).toEqual([abandoned]);
} finally {
stopThemeWatcher();
}
@@ -1069,7 +1267,9 @@ describe("AgentsViewMode", () => {
Reflect.set(view, "lastListedSummaries", [parent, child, secondChild]);
invoke("reconcileCatalogs", view);
expect(rows()).toHaveLength(1);
- expect(invoke("renderRow", view, rows()[0], 120)).toContain("▸");
+ const collapsedRow = invoke("renderRow", view, rows()[0], 120) as string;
+ expect(collapsedRow).not.toContain("▸");
+ expect(collapsedRow).not.toContain("▾");
const collapsed = lines();
const parentIndex = collapsed.findIndex((line) => line.includes("parent"));
expect(collapsed[parentIndex + 1]).toBe(" 2 subagents running");
@@ -1078,7 +1278,9 @@ describe("AgentsViewMode", () => {
view.handleInput("\x1b[1;3C");
expect(rows().map((row) => row.kind)).toEqual(["agent", "subagent", "subagent"]);
expect(lines().join("\n")).not.toContain("subagents running");
- expect(invoke("renderRow", view, rows()[0], 120)).toContain("▾");
+ const expandedRow = invoke("renderRow", view, rows()[0], 120) as string;
+ expect(expandedRow).not.toContain("▸");
+ expect(expandedRow).not.toContain("▾");
view.handleInput("\x1b[1;3C");
expect(rows()).toHaveLength(1);
expect(lines()).toContain(" 2 subagents running");
diff --git a/packages/coding-agent/test/interactive-mode-startup.test.ts b/packages/coding-agent/test/interactive-mode-startup.test.ts
index 6a080c6054..6847e25c76 100644
--- a/packages/coding-agent/test/interactive-mode-startup.test.ts
+++ b/packages/coding-agent/test/interactive-mode-startup.test.ts
@@ -5,6 +5,7 @@ import {
setKeybindings,
Text,
TUI,
+ visibleWidth,
} from "@earendil-works/pi-tui";
import stripAnsi from "strip-ansi";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
@@ -49,39 +50,99 @@ describe("InteractiveMode startup hints", () => {
return mode;
}
- it("keeps a blank row above the shared splash and limits its metadata", () => {
- const header = new BrandSplashHeader(
- "0.0.0",
- () => "test-model",
- () => "/tmp/project",
- undefined,
- {
- topPadding: true,
- getHideStartHint: () => true,
- },
- );
+ it("shows a compact butterfly beside metadata without a repeated input hint", () => {
+ const header = new BrandSplashHeader("0.0.0", () => "/tmp/project", undefined, {
+ topPadding: true,
+ getExtraMetadata: () => [{ label: "agents", value: "2 running" }],
+ });
const lines = header.render(120);
const output = stripAnsi(lines.join("\n"));
expect(lines[0]).toBe("");
- expect(output).toContain("version v0.0.0");
- expect(output).toContain("model test-model");
- expect(output).toContain("cwd /tmp/project");
+ expect(lines.length).toBeLessThanOrEqual(8);
+ expect(output).toContain("prime agent v0.0.0");
+ expect(output).toMatch(/[▗▙▛▜]/u);
+ expect(stripAnsi(lines[4])).toContain("agents 2 running");
+ expect(stripAnsi(lines[5])).toContain("cwd /tmp/project");
+ expect(output).not.toContain("model ");
expect(output).not.toContain("Try ");
expect(output).not.toContain("type to search sessions");
- expect(output).not.toContain("input");
- expect(output).not.toContain("files");
- expect(output).not.toContain("help");
-
- const unpadded = new BrandSplashHeader(
- "0.0.0",
- () => "test-model",
- () => "/tmp/project",
- );
+
+ const unpadded = new BrandSplashHeader("0.0.0", () => "/tmp/project");
expect(unpadded.render(120)[0]).not.toBe("");
});
+ it("renders the model line in the chat splash without effort metadata", () => {
+ let modelId: string | undefined = "first-model";
+ const header = new BrandSplashHeader("0.0.0", () => "/tmp/project", undefined, {
+ topPadding: true,
+ getModelId: () => modelId,
+ });
+
+ const lines = header.render(120);
+ const output = stripAnsi(lines.join("\n"));
+
+ expect(output).toContain("prime agent v0.0.0");
+ expect(stripAnsi(lines[3])).toContain("prime agent v0.0.0");
+ expect(stripAnsi(lines[4])).toContain("model first-model");
+ expect(stripAnsi(lines[5])).toContain("cwd /tmp/project");
+ expect(output).not.toContain("•");
+
+ modelId = "second-model";
+ const updated = stripAnsi(header.render(120).join("\n"));
+ expect(updated).toContain("model second-model");
+ expect(updated).not.toContain("first-model");
+
+ modelId = undefined;
+ expect(stripAnsi(header.render(120).join("\n"))).toContain("model —");
+ });
+
+ it("keeps metadata visible in narrow terminals and bounds every rendered row", () => {
+ const header = new BrandSplashHeader("0.0.0", () => "/tmp/project");
+
+ for (const width of [1, 2, 12, 14, 20, 24, 39, 40, 50, 51, 80]) {
+ const lines = header.render(width);
+ const output = stripAnsi(lines.join("\n"));
+ expect(lines.every((line) => visibleWidth(line) <= width)).toBe(true);
+ if (width < 51) {
+ expect(output).not.toMatch(/[▗▙▛▜]/u);
+ if (width >= 14) expect(output).toContain("prime agent");
+ } else {
+ expect(output).toMatch(/[▗▙▛▜]/u);
+ expect(output).toContain("agent v0.0.0");
+ }
+ if (width >= 14) {
+ expect(output).toContain("v0.0.0");
+ }
+ if (width >= 18) {
+ expect(output).toContain("cwd /tmp/project");
+ }
+ }
+ });
+
+ it("renders live agents metadata, custom marks, and verbose instructions", () => {
+ let cwd = "/tmp/first";
+ const header = new BrandSplashHeader("0.0.0", () => cwd, "custom shortcut instructions", {
+ logo: "<>\n><",
+ getExtraMetadata: () => [
+ { label: "agents", value: "2 running" },
+ { label: "scope", value: "current project" },
+ ],
+ });
+
+ const initial = stripAnsi(header.render(80).join("\n"));
+ expect(initial).toContain("<>");
+ expect(initial).toContain("prime agent v0.0.0");
+ expect(initial).toContain("agents 2 running");
+ expect(initial).toContain("scope current project");
+ expect(initial).toContain("custom shortcut instructions");
+
+ cwd = "/tmp/second";
+ const updated = stripAnsi(header.render(80).join("\n"));
+ expect(updated).toContain("/tmp/second");
+ });
+
it("keeps fresh-chat shortcut instructions out of the lower tray", () => {
const mode = createMode();
const label = Reflect.get(InteractiveMode.prototype, "getTrayLocationLabel").call(mode);
diff --git a/packages/coding-agent/test/suite/regressions/502-unified-session-view.test.ts b/packages/coding-agent/test/suite/regressions/502-unified-session-view.test.ts
index 170d9f4974..3618338db2 100644
--- a/packages/coding-agent/test/suite/regressions/502-unified-session-view.test.ts
+++ b/packages/coding-agent/test/suite/regressions/502-unified-session-view.test.ts
@@ -1,7 +1,10 @@
import stripAnsi from "strip-ansi";
import { describe, expect, test, vi } from "vitest";
import { AgentsViewMode } from "../../../src/modes/agents-view/agents-view-mode.js";
-import { buildUnifiedSessionIndex } from "../../../src/modes/agents-view/agents-view-state.js";
+import {
+ buildUnifiedSessionIndex,
+ reconcileUnifiedSessions,
+} from "../../../src/modes/agents-view/agents-view-state.js";
import type { SessionSummary } from "../../../src/modes/daemon/daemon-session-list.js";
import { initTheme } from "../../../src/modes/interactive/theme/theme.js";
import { createDeferred as deferred } from "../scheduling.js";
@@ -380,6 +383,7 @@ describe("#502 unified session view regressions", () => {
{ mode: "search", prompt: ["prompt top", "prompt input", "prompt bottom"] },
{ mode: "reply", prompt: ["prompt top", "reply header", "reply gap", "prompt input", "prompt bottom"] },
])("short content reserves the $mode editor and a session row ahead of startup chrome", ({ prompt }) => {
+ initTheme("dark");
const renderSessionRows = vi.fn(() => ["session row"]);
const harness = {
splash: { render: () => Array.from({ length: 8 }, () => "splash") },
@@ -404,15 +408,19 @@ describe("#502 unified session view regressions", () => {
renameTarget: mode === "rename" ? { identity: "target" } : undefined,
actionModeSearchQuery: "needle",
editor: { getText: () => "action editor text" },
- scopedRecords: [
- { identity: "match", identityAliases: [], section: "idle", searchableText: "needle session" },
- { identity: "other", identityAliases: [], section: "idle", searchableText: "other session" },
- ],
+ heartbeats: [],
+ scopedRecords: reconcileUnifiedSessions(
+ [
+ { ...summary("match"), sessionName: "needle session" },
+ { ...summary("other"), sessionName: "other session" },
+ ],
+ [],
+ ),
};
const filtered =
privateMethod<(this: typeof harness) => Array<{ identity: string }>>("getFilteredRecords").call(harness);
- expect(filtered.map((record) => record.identity)).toEqual(["match"]);
+ expect(filtered.map((record) => record.identity)).toEqual(["session:session-match"]);
});
test("inactive rows keep total cost and age visible in a narrow row", () => {
diff --git a/scripts/render-logo.py b/scripts/render-logo.py
index c12a9910da..5357be0561 100755
--- a/scripts/render-logo.py
+++ b/scripts/render-logo.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
-"""Render the Prime butterfly SVG to ASCII via half-block encoding.
+"""Render the Prime butterfly SVG as terminal-safe text art.
Usage:
- uv run scripts/render-logo.py [--width 60] [--threshold 96] [--svg path]
+ uv run scripts/render-logo.py [--width 60] [--threshold 96] [--style blocks] [--svg path]
Outputs the rendered art to stdout.
@@ -29,7 +29,75 @@ def render(svg_path: Path, width: int, threshold: int, style: str) -> str:
import cairosvg
from PIL import Image
- if style == "dots":
+ if style == "quadrants":
+ # Quadrant block characters encode a solid 2x2 grid. Halving the SVG's
+ # raster height compensates for terminal cells being roughly twice as tall
+ # as they are wide while retaining twice the horizontal edge resolution.
+ png_bytes = cairosvg.svg2png(url=str(svg_path), output_width=width * 2)
+ img = Image.open(io.BytesIO(png_bytes)).convert("RGBA")
+ bg = Image.new("RGBA", img.size, (0, 0, 0, 255))
+ bg.paste(img, (0, 0), img)
+ img = bg.convert("L").resize((width * 2, max(2, round(img.size[1] / 2))), Image.LANCZOS)
+ w, h = img.size
+ padded_h = h + (-h % 2)
+ if padded_h != h:
+ padded = Image.new("L", (w, padded_h), 0)
+ padded.paste(img, (0, 0))
+ img = padded
+ h = padded_h
+ px = img.load()
+ glyphs = (" ", "▘", "▝", "▀", "▖", "▌", "▞", "▛", "▗", "▚", "▐", "▜", "▄", "▙", "▟", "█")
+ rows = []
+ for y in range(0, h, 2):
+ row = ""
+ for x in range(0, w, 2):
+ mask = (
+ (1 if px[x, y] > threshold else 0)
+ | (2 if px[x + 1, y] > threshold else 0)
+ | (4 if px[x, y + 1] > threshold else 0)
+ | (8 if px[x + 1, y + 1] > threshold else 0)
+ )
+ row += glyphs[mask]
+ rows.append(row.rstrip())
+ elif style == "braille":
+ # A Braille cell is a 2 x 4 pixel grid. Terminal cells are typically twice as
+ # tall as they are wide, so those subpixels are approximately square and the
+ # SVG keeps its intended aspect without further vertical scaling.
+ png_bytes = cairosvg.svg2png(url=str(svg_path), output_width=width * 2)
+ img = Image.open(io.BytesIO(png_bytes)).convert("RGBA")
+ bg = Image.new("RGBA", img.size, (0, 0, 0, 255))
+ bg.paste(img, (0, 0), img)
+ img = bg.convert("L")
+ w, h = img.size
+ padded_w = w + (-w % 2)
+ padded_h = h + (-h % 4)
+ if (padded_w != w) or (padded_h != h):
+ padded = Image.new("L", (padded_w, padded_h), 0)
+ padded.paste(img, (0, 0))
+ img = padded
+ w, h = img.size
+ px = img.load()
+ dot_bits = (
+ (0, 0, 0),
+ (0, 1, 1),
+ (0, 2, 2),
+ (1, 0, 3),
+ (1, 1, 4),
+ (1, 2, 5),
+ (0, 3, 6),
+ (1, 3, 7),
+ )
+ rows = []
+ for y in range(0, h, 4):
+ row: list[str] = []
+ for x in range(0, w, 2):
+ mask = 0
+ for dx, dy, bit in dot_bits:
+ if px[x + dx, y + dy] > threshold:
+ mask |= 1 << bit
+ row.append(chr(0x2800 + mask) if mask else " ")
+ rows.append("".join(row).rstrip())
+ elif style == "dots":
# 1 pixel = 1 character cell. Compensate for terminal cells being ~2x taller than wide
# so the rendered shape keeps the original proportions.
# Use ▪ (BLACK SMALL SQUARE) so adjacent cells read as a tightly packed dot matrix —
@@ -95,9 +163,9 @@ def main() -> int:
)
parser.add_argument(
"--style",
- choices=("blocks", "dots"),
+ choices=("blocks", "braille", "dots", "quadrants"),
default="blocks",
- help="blocks = half-block ▀▄█; dots = mid-dot · matrix (default: blocks)",
+ help="blocks = half-block; braille = 2x4 dots; dots = square matrix; quadrants = solid 2x2 cells",
)
args = parser.parse_args()