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

Function readSessionIndex

apps/vis/server/src/lib/session-store.ts:236–255  ·  view source on GitHub ↗
(home: string)

Source from the content-addressed store, hash-verified

234}
235
236async function readSessionIndex(home: string): Promise<Map<string, SessionIndexEntry>> {
237 const out = new Map<string, SessionIndexEntry>();
238 let raw: string;
239 try {
240 raw = await readFile(join(home, 'session_index.jsonl'), 'utf8');
241 } catch { return out; }
242 for (const line of raw.split(/\r?\n/)) {
243 if (!line.trim()) continue;
244 try {
245 const entry = JSON.parse(line) as { sessionId?: string; sessionDir?: string; workDir?: string };
246 if (typeof entry.sessionId === 'string' && typeof entry.sessionDir === 'string') {
247 out.set(entry.sessionId, {
248 sessionDir: entry.sessionDir,
249 workDir: typeof entry.workDir === 'string' ? entry.workDir : '',
250 });
251 }
252 } catch { /* skip malformed */ }
253 }
254 return out;
255}
256
257async function inventoryAgents(sessionDir: string, state: StateJson, deriveHomedir = false): Promise<AgentInfo[]> {
258 const result: AgentInfo[] = [];

Callers 2

listSessionsFunction · 0.70
readSessionDetailFunction · 0.70

Calls 2

setMethod · 0.65
readFileFunction · 0.50

Tested by

no test coverage detected