MCPcopy Create free account
hub / github.com/cortexkit/magic-context / readPiSessionMessages

Function readPiSessionMessages

packages/pi-plugin/src/read-session-pi.ts:211–227  ·  view source on GitHub ↗
(ctx: ExtensionContext)

Source from the content-addressed store, hash-verified

209 * branch.
210 */
211export function readPiSessionMessages(ctx: ExtensionContext): RawMessage[] {
212 const sm = ctx.sessionManager;
213 if (sm === undefined) return [];
214 const getBranch = (sm as { getBranch?: (fromId?: string) => unknown[] })
215 .getBranch;
216 if (typeof getBranch !== "function") return [];
217
218 let entries: unknown[];
219 try {
220 entries = getBranch.call(sm);
221 } catch {
222 return [];
223 }
224 if (!Array.isArray(entries)) return [];
225
226 return convertEntriesToRawMessages(entries);
227}
228
229/**
230 * Resolve the LAST model the session was using, from the JSONL branch's

Callers 7

index.tsFile · 0.90
readPiSessionMessageByIdFunction · 0.90
registerPiContextHandlerFunction · 0.90
maybeFireHistorianFunction · 0.90
executeFunction · 0.90
registerCtxRecompCommandFunction · 0.90

Calls 2

callMethod · 0.80

Tested by

no test coverage detected