MCPcopy Create free account
hub / github.com/aetherstate/GODMOD3.AI / recordEvent

Function recordEvent

api/lib/metadata.ts:114–133  ·  view source on GitHub ↗
(event: Omit<MetadataEvent, 'id' | 'timestamp'>)

Source from the content-addressed store, hash-verified

112// ── Recording ────────────────────────────────────────────────────────
113
114export function recordEvent(event: Omit<MetadataEvent, 'id' | 'timestamp'>): string {
115 const id = randomUUID()
116 const record: MetadataEvent = {
117 ...event,
118 id,
119 timestamp: Date.now(),
120 }
121
122 events.push(record)
123
124 // Auto-flush to HF when approaching capacity (async, non-blocking)
125 checkMetadataThreshold(events.length, MAX_EVENTS)
126
127 // Evict oldest if over cap (fallback if HF publish is not configured or failed)
128 if (events.length > MAX_EVENTS) {
129 events = events.slice(events.length - MAX_EVENTS)
130 }
131
132 return id
133}
134
135// ── Error Categorization ─────────────────────────────────────────────
136

Callers 2

consortium.tsFile · 0.90
chat.tsFile · 0.90

Calls 1

checkMetadataThresholdFunction · 0.90

Tested by

no test coverage detected