feat: show memory summary in status

This commit is contained in:
Peter Steinberger
2026-01-18 01:57:37 +00:00
parent 14e6b21b50
commit 8013c4717c
5 changed files with 95 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import { probeGateway } from "../gateway/probe.js";
import { collectChannelStatusIssues } from "../infra/channels-status-issues.js";
import { resolveOsSummary } from "../infra/os-summary.js";
import { getTailnetHostname } from "../infra/tailscale.js";
import { MemoryIndexManager } from "../memory/manager.js";
import { runExec } from "../process/exec.js";
import type { RuntimeEnv } from "../runtime.js";
import { getAgentLocalStatuses } from "./status.agent-local.js";
@@ -14,6 +15,10 @@ import { getStatusSummary } from "./status.summary.js";
import { getUpdateCheckResult } from "./status.update.js";
import { buildChannelsTable } from "./status-all/channels.js";
type MemoryStatusSnapshot = ReturnType<(typeof MemoryIndexManager)["prototype"]["status"]> & {
agentId: string;
};
export type StatusScanResult = {
cfg: ReturnType<typeof loadConfig>;
osSummary: ReturnType<typeof resolveOsSummary>;
@@ -31,6 +36,7 @@ export type StatusScanResult = {
agentStatus: Awaited<ReturnType<typeof getAgentLocalStatuses>>;
channels: Awaited<ReturnType<typeof buildChannelsTable>>;
summary: Awaited<ReturnType<typeof getStatusSummary>>;
memory: MemoryStatusSnapshot | null;
};
export async function scanStatus(
@@ -44,7 +50,7 @@ export async function scanStatus(
return await withProgress(
{
label: "Scanning status…",
total: 9,
total: 10,
enabled: opts.json !== true,
},
async (progress) => {
@@ -122,6 +128,20 @@ export async function scanStatus(
});
progress.tick();
progress.setLabel("Checking memory…");
const memory = await (async (): Promise<MemoryStatusSnapshot | null> => {
const agentId = agentStatus.defaultId ?? "main";
const manager = await MemoryIndexManager.get({ cfg, agentId }).catch(() => null);
if (!manager) return null;
try {
await manager.probeVectorAvailability();
} catch {}
const status = manager.status();
await manager.close().catch(() => {});
return { agentId, ...status };
})();
progress.tick();
progress.setLabel("Reading sessions…");
const summary = await getStatusSummary();
progress.tick();
@@ -146,6 +166,7 @@ export async function scanStatus(
agentStatus,
channels,
summary,
memory,
};
},
);