MCPcopy Create free account
hub / github.com/microsoft/AI-Engineering-Coach / parseCodexLine

Function parseCodexLine

src/core/parser-codex.ts:87–105  ·  view source on GitHub ↗
(rawLine: string)

Source from the content-addressed store, hash-verified

85}
86
87function parseCodexLine(rawLine: string): CodexLine | null {
88 try {
89 const parsed: unknown = JSON.parse(rawLine);
90 if (!isRecord(parsed) || typeof parsed.type !== 'string') return null;
91 let timestamp: string | undefined;
92 if (typeof parsed.timestamp === 'string') {
93 timestamp = parsed.timestamp;
94 } else if (typeof parsed.timestamp === 'number') {
95 timestamp = new Date(parsed.timestamp).toISOString();
96 }
97 return {
98 type: parsed.type,
99 timestamp,
100 payload: recordValue(parsed.payload),
101 };
102 } catch {
103 return null;
104 }
105}
106
107function parseJsonRecord(raw: string): Record<string, unknown> | null {
108 try {

Callers 1

readCodexJsonlStreamingFunction · 0.85

Calls 2

isRecordFunction · 0.70
recordValueFunction · 0.70

Tested by

no test coverage detected