diff --git a/src/commands/status-overview-rows.ts b/src/commands/status-overview-rows.ts index fd81a8828bc..0c680826721 100644 --- a/src/commands/status-overview-rows.ts +++ b/src/commands/status-overview-rows.ts @@ -1,6 +1,5 @@ import { formatCliCommand } from "../cli/command-format.js"; import type { HeartbeatEventPayload } from "../infra/heartbeat-events.js"; -import type { Tone } from "../memory-host-sdk/status.js"; import type { PluginCompatibilityNotice } from "../plugins/status.js"; import { VERSION } from "../version.js"; import type { HealthSummary } from "./health.js"; @@ -23,47 +22,38 @@ import { buildStatusLastHeartbeatValue, buildStatusMemoryValue, buildStatusTasksValue, + type StatusMemoryStateResolvers, } from "./status.command-sections.js"; import type { MemoryPluginStatus, MemoryStatusSnapshot } from "./status.scan.shared.js"; import type { StatusSummary } from "./status.types.js"; -export function buildStatusCommandOverviewRows(params: { - opts: { - deep?: boolean; - }; - surface: StatusOverviewSurface; - osLabel: string; - summary: StatusSummary; - health?: HealthSummary; - lastHeartbeat: HeartbeatEventPayload | null; - agentStatus: { - defaultId?: string | null; - bootstrapPendingCount: number; - totalSessions: number; - agents: AgentLocalStatus[]; - }; - memory: MemoryStatusSnapshot | null; - memoryPlugin: MemoryPluginStatus; - pluginCompatibility: PluginCompatibilityNotice[]; - ok: (value: string) => string; - warn: (value: string) => string; - muted: (value: string) => string; - formatTimeAgo: (ageMs: number) => string; - formatKTokens: (value: number) => string; - resolveMemoryVectorState: (value: NonNullable) => { - state: string; - tone: Tone; - }; - resolveMemoryFtsState: (value: NonNullable) => { - state: string; - tone: Tone; - }; - resolveMemoryCacheSummary: (value: NonNullable) => { - text: string; - tone: Tone; - }; - updateValue?: string; -}) { +export function buildStatusCommandOverviewRows( + params: { + opts: { + deep?: boolean; + }; + surface: StatusOverviewSurface; + osLabel: string; + summary: StatusSummary; + health?: HealthSummary; + lastHeartbeat: HeartbeatEventPayload | null; + agentStatus: { + defaultId?: string | null; + bootstrapPendingCount: number; + totalSessions: number; + agents: AgentLocalStatus[]; + }; + memory: MemoryStatusSnapshot | null; + memoryPlugin: MemoryPluginStatus; + pluginCompatibility: PluginCompatibilityNotice[]; + ok: (value: string) => string; + warn: (value: string) => string; + muted: (value: string) => string; + formatTimeAgo: (ageMs: number) => string; + formatKTokens: (value: number) => string; + updateValue?: string; + } & StatusMemoryStateResolvers, +) { const agentsValue = buildStatusAgentsValue({ agentStatus: params.agentStatus, formatTimeAgo: params.formatTimeAgo, diff --git a/src/commands/status.command-report-data.ts b/src/commands/status.command-report-data.ts index 36bc7a916ec..79280d1b860 100644 --- a/src/commands/status.command-report-data.ts +++ b/src/commands/status.command-report-data.ts @@ -1,6 +1,5 @@ import type { HeartbeatEventPayload } from "../infra/heartbeat-events.js"; import type { resolveOsSummary } from "../infra/os-summary.js"; -import type { Tone } from "../memory-host-sdk/status.js"; import type { PluginCompatibilityNotice } from "../plugins/status.js"; import type { SecurityAuditReport } from "../security/audit.js"; import type { RenderTableOptions, TableColumn } from "../terminal/table.js"; @@ -22,80 +21,71 @@ import { buildStatusSystemEventsRows, buildStatusSystemEventsTrailer, statusHealthColumns, + type StatusMemoryStateResolvers, } from "./status.command-sections.js"; import type { MemoryPluginStatus, MemoryStatusSnapshot } from "./status.scan.shared.js"; import type { SessionStatus, StatusSummary } from "./status.types.js"; -export async function buildStatusCommandReportData(params: { - opts: { - deep?: boolean; - verbose?: boolean; - }; - surface: StatusOverviewSurface; - osSummary: ReturnType; - summary: StatusSummary; - securityAudit?: SecurityAuditReport; - health?: HealthSummary; - usageLines?: string[]; - lastHeartbeat: HeartbeatEventPayload | null; - agentStatus: { - defaultId?: string | null; - bootstrapPendingCount: number; - totalSessions: number; - agents: AgentLocalStatus[]; - }; - channels: { - rows: Array<{ - id: string; - label: string; - enabled: boolean; - state: "ok" | "warn" | "off" | "setup"; - detail: string; +export async function buildStatusCommandReportData( + params: { + opts: { + deep?: boolean; + verbose?: boolean; + }; + surface: StatusOverviewSurface; + osSummary: ReturnType; + summary: StatusSummary; + securityAudit?: SecurityAuditReport; + health?: HealthSummary; + usageLines?: string[]; + lastHeartbeat: HeartbeatEventPayload | null; + agentStatus: { + defaultId?: string | null; + bootstrapPendingCount: number; + totalSessions: number; + agents: AgentLocalStatus[]; + }; + channels: { + rows: Array<{ + id: string; + label: string; + enabled: boolean; + state: "ok" | "warn" | "off" | "setup"; + detail: string; + }>; + }; + channelIssues: Array<{ + channel: string; + message: string; }>; - }; - channelIssues: Array<{ - channel: string; - message: string; - }>; - memory: MemoryStatusSnapshot | null; - memoryPlugin: MemoryPluginStatus; - pluginCompatibility: PluginCompatibilityNotice[]; - pairingRecovery: { requestId: string | null } | null; - tableWidth: number; - ok: (value: string) => string; - warn: (value: string) => string; - muted: (value: string) => string; - shortenText: (value: string, maxLen: number) => string; - formatCliCommand: (value: string) => string; - formatTimeAgo: (ageMs: number) => string; - formatKTokens: (value: number) => string; - formatTokensCompact: (value: SessionStatus) => string; - formatPromptCacheCompact: (value: SessionStatus) => string | null; - formatHealthChannelLines: (summary: HealthSummary, opts: { accountMode: "all" }) => string[]; - formatPluginCompatibilityNotice: (notice: PluginCompatibilityNotice) => string; - formatUpdateAvailableHint: (update: StatusOverviewSurface["update"]) => string | null; - resolveMemoryVectorState: (value: NonNullable) => { - state: string; - tone: Tone; - }; - resolveMemoryFtsState: (value: NonNullable) => { - state: string; - tone: Tone; - }; - resolveMemoryCacheSummary: (value: NonNullable) => { - text: string; - tone: Tone; - }; - accentDim: (value: string) => string; - updateValue?: string; - theme: { - heading: (value: string) => string; - muted: (value: string) => string; + memory: MemoryStatusSnapshot | null; + memoryPlugin: MemoryPluginStatus; + pluginCompatibility: PluginCompatibilityNotice[]; + pairingRecovery: { requestId: string | null } | null; + tableWidth: number; + ok: (value: string) => string; warn: (value: string) => string; - error: (value: string) => string; - }; - renderTable: (input: RenderTableOptions) => string; -}) { + muted: (value: string) => string; + shortenText: (value: string, maxLen: number) => string; + formatCliCommand: (value: string) => string; + formatTimeAgo: (ageMs: number) => string; + formatKTokens: (value: number) => string; + formatTokensCompact: (value: SessionStatus) => string; + formatPromptCacheCompact: (value: SessionStatus) => string | null; + formatHealthChannelLines: (summary: HealthSummary, opts: { accountMode: "all" }) => string[]; + formatPluginCompatibilityNotice: (notice: PluginCompatibilityNotice) => string; + formatUpdateAvailableHint: (update: StatusOverviewSurface["update"]) => string | null; + accentDim: (value: string) => string; + updateValue?: string; + theme: { + heading: (value: string) => string; + muted: (value: string) => string; + warn: (value: string) => string; + error: (value: string) => string; + }; + renderTable: (input: RenderTableOptions) => string; + } & StatusMemoryStateResolvers, +) { const overviewRows = buildStatusCommandOverviewRows({ opts: params.opts, surface: params.surface, diff --git a/src/commands/status.command-sections.ts b/src/commands/status.command-sections.ts index 7028e5d3380..a3ceffc9539 100644 --- a/src/commands/status.command-sections.ts +++ b/src/commands/status.command-sections.ts @@ -19,6 +19,21 @@ type MemoryLike = MemoryStatusSnapshot | null; type MemoryPluginLike = MemoryPluginStatus; type SessionsRecentLike = SessionStatus; +export type StatusMemoryStateResolvers = { + resolveMemoryVectorState: (value: NonNullable) => { + state: string; + tone: Tone; + }; + resolveMemoryFtsState: (value: NonNullable) => { + state: string; + tone: Tone; + }; + resolveMemoryCacheSummary: (value: NonNullable) => { + text: string; + tone: Tone; + }; +}; + type PluginCompatibilityNoticeLike = { severity?: "warn" | "info" | null; }; @@ -115,25 +130,15 @@ export function buildStatusLastHeartbeatValue(params: { .join(" ยท "); } -export function buildStatusMemoryValue(params: { - memory: MemoryLike; - memoryPlugin: MemoryPluginLike; - ok: (value: string) => string; - warn: (value: string) => string; - muted: (value: string) => string; - resolveMemoryVectorState: (value: NonNullable) => { - state: string; - tone: Tone; - }; - resolveMemoryFtsState: (value: NonNullable) => { - state: string; - tone: Tone; - }; - resolveMemoryCacheSummary: (value: NonNullable) => { - text: string; - tone: Tone; - }; -}) { +export function buildStatusMemoryValue( + params: { + memory: MemoryLike; + memoryPlugin: MemoryPluginLike; + ok: (value: string) => string; + warn: (value: string) => string; + muted: (value: string) => string; + } & StatusMemoryStateResolvers, +) { if (!params.memoryPlugin.enabled) { const suffix = params.memoryPlugin.reason ? ` (${params.memoryPlugin.reason})` : ""; return params.muted(`disabled${suffix}`);