MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / readSessionDetail

Function readSessionDetail

apps/vis/server/src/lib/session-store.ts:65–84  ·  view source on GitHub ↗
(home: string, sessionId: string)

Source from the content-addressed store, hash-verified

63}
64
65export async function readSessionDetail(home: string, sessionId: string): Promise<SessionDetail | null> {
66 if (isImportId(sessionId)) return readImportedDetail(home, sessionId);
67 const sessionDir = await findSessionDir(home, sessionId);
68 if (sessionDir === null) return null;
69 const index = await readSessionIndex(home);
70 const workDir = index.get(sessionId)?.workDir ?? '';
71 const state = await readState(sessionDir);
72 // When state.json is unreadable we still return a SessionDetail so the
73 // UI can render the broken-state diagnostic. Agent inventory cannot be
74 // derived from state, but the on-disk `agents/<id>/wire.jsonl` files
75 // are independent of state — probe for them directly so users can
76 // still inspect the wire/context of a session whose state is corrupt.
77 if (state === null) {
78 const agents = await discoverAgentsFromDisk(sessionDir);
79 return { sessionId, sessionDir, workDir, state: null, agents, imported: false, importMeta: null };
80 }
81 if (state.custom?.['imported_from_kimi_cli'] === true) return null;
82 const agents = await inventoryAgents(sessionDir, state);
83 return { sessionId, sessionDir, workDir, state, agents, imported: false, importMeta: null };
84}
85
86/** Detail for an imported bundle. Same readers as a local session, but the
87 * directory is `imported/<id>/`, the workDir comes from the manifest, and

Callers 10

sessionDetailRouteFunction · 0.90
wireRouteFunction · 0.90
logsRouteFunction · 0.90
blobsRouteFunction · 0.90
tasksRouteFunction · 0.90
contextRouteFunction · 0.90
cronRouteFunction · 0.90
sessionsRouteFunction · 0.90
subagentsRouteFunction · 0.90

Calls 8

isImportIdFunction · 0.90
readImportedDetailFunction · 0.85
findSessionDirFunction · 0.85
readStateFunction · 0.85
discoverAgentsFromDiskFunction · 0.85
inventoryAgentsFunction · 0.85
readSessionIndexFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected