MCPcopy
hub / github.com/superagent-ai/grok-cli / buildEffectiveMessageRecords

Function buildEffectiveMessageRecords

src/storage/transcript.ts:77–89  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

75}
76
77function buildEffectiveMessageRecords(sessionId: string): EffectiveMessageRecord[] {
78 const rows = loadMessageRows(sessionId);
79 const messages = rows.map((row) => JSON.parse(row.message_json) as ModelMessage);
80 const seqs = rows.map((row) => row.seq);
81 const timestamps = rows.map((row) => new Date(row.created_at));
82 const transcript = buildEffectiveTranscript(messages, seqs, timestamps, loadLatestCompaction(sessionId));
83
84 return transcript.messages.map((message, index) => ({
85 message,
86 seq: transcript.seqs[index],
87 timestamp: transcript.timestamps[index],
88 }));
89}
90
91export function loadRawTranscript(sessionId: string): ModelMessage[] {
92 return loadMessageRows(sessionId).map((row) => JSON.parse(row.message_json) as ModelMessage);

Callers 1

buildChatEntriesFunction · 0.85

Calls 3

buildEffectiveTranscriptFunction · 0.90
loadMessageRowsFunction · 0.85
loadLatestCompactionFunction · 0.85

Tested by

no test coverage detected