MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / repeatIdentity

Function repeatIdentity

graph-ui/src/system/system-model.ts:56–70  ·  view source on GitHub ↗

* The fields that make two records the same message, the ones the frontend * buffer compares (app/ui-log.ts): a repeat count carries them too, so it joins * the row of the entry it counts. The detail is compared by its start, which a * field cut on the longer count line leaves intact.

(record: DaemonLogRecord)

Source from the content-addressed store, hash-verified

54 * field cut on the longer count line leaves intact.
55 */
56function repeatIdentity(record: DaemonLogRecord): { key: string; session: string; repeat?: number } {
57 try {
58 const line: unknown = JSON.parse(record.message);
59 if (typeof line === 'object' && line !== null && typeof (line as Record<string, unknown>)['message'] === 'string') {
60 const entry = line as Record<string, unknown>;
61 const text = (name: string) => typeof entry[name] === 'string' ? entry[name] as string : '';
62 const detail = typeof entry['detail'] === 'string' ? entry['detail'] : undefined;
63 const repeat = repeatCount(detail);
64 return { key: JSON.stringify([record.level, record.source, record.project ?? '', text('message'), (countedDetail(detail) ?? '').slice(0, 2048),
65 text('stack').slice(0, 2048), text('url'), entry['line'] ?? null, entry['col'] ?? null]),
66 session: text('session'), repeat };
67 }
68 } catch { /* A daemon line is plain text. */ }
69 return { key: JSON.stringify([record.level, record.source, record.project ?? '', record.message]), session: '' };
70}
71
72/**
73 * Identical messages become one row at their latest position, with how often

Callers 1

collapseRepeatsFunction · 0.85

Calls 3

repeatCountFunction · 0.90
countedDetailFunction · 0.90
textFunction · 0.70

Tested by

no test coverage detected