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

Function makeMessageEntry

packages/cli/src/commands/migrate.ts:316–338  ·  view source on GitHub ↗
(
    role: "user" | "assistant",
    text: string,
    timestamp: string,
    parentId: string | null,
    usage: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

314}
315
316function makeMessageEntry(
317 role: "user" | "assistant",
318 text: string,
319 timestamp: string,
320 parentId: string | null,
321 usage: Record<string, unknown>,
322): PiJson {
323 const message: Record<string, unknown> = {
324 role,
325 content: [{ type: "text", text }],
326 timestamp: Date.parse(timestamp),
327 };
328 if (role === "assistant") {
329 message.usage = usage;
330 }
331 return {
332 type: "message",
333 id: shortId(),
334 parentId,
335 timestamp,
336 message,
337 };
338}
339
340function makeThinkingEntry(
341 text: string,

Callers 2

convertPartToEntriesFunction · 0.85
buildPiEntriesFunction · 0.85

Calls 1

shortIdFunction · 0.85

Tested by

no test coverage detected