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

Function rehydrateRecord

apps/vis/server/src/lib/blob-resolver.ts:42–70  ·  view source on GitHub ↗
(
  record: Record<string, unknown>,
  sessionId: string,
  agentId: string,
  baseUrl: string,
)

Source from the content-addressed store, hash-verified

40}
41
42function rehydrateRecord(
43 record: Record<string, unknown>,
44 sessionId: string,
45 agentId: string,
46 baseUrl: string,
47): void {
48 const type = record['type'];
49 if (type === 'turn.prompt' || type === 'turn.steer') {
50 rehydrateParts(record['input'] as unknown as ContentPart[], sessionId, agentId, baseUrl);
51 return;
52 }
53 if (type === 'context.append_message') {
54 const message = record['message'] as { content: ContentPart[] };
55 rehydrateParts(message.content, sessionId, agentId, baseUrl);
56 return;
57 }
58 if (type === 'context.append_loop_event') {
59 const event = record['event'] as Record<string, unknown>;
60 if (event['type'] === 'tool.result') {
61 const result = event['result'] as Record<string, unknown>;
62 if (typeof result['output'] !== 'string') {
63 rehydrateParts(result['output'] as ContentPart[], sessionId, agentId, baseUrl);
64 }
65 } else if (event['type'] === 'content.part') {
66 rehydrateParts([event['part'] as ContentPart], sessionId, agentId, baseUrl);
67 }
68 return;
69 }
70}
71
72function rehydrateParts(
73 parts: ContentPart[],

Callers 1

rehydrateWireEntriesFunction · 0.85

Calls 1

rehydratePartsFunction · 0.85

Tested by

no test coverage detected