chore: consolidate new foundation and archive v1 (#1495)

This commit is contained in:
2026-09-07 12:32:57 -05:00
3511 changed files with 727899 additions and 10 deletions
+35
View File
@@ -0,0 +1,35 @@
import { randomUUID } from 'node:crypto';
import { appendFileSync, mkdirSync } from 'node:fs';
import { dirname } from 'node:path';
import type { MACPEvent } from './types.js';
export function nowISO(): string {
return new Date().toISOString();
}
export function appendEvent(eventsPath: string, event: MACPEvent): void {
mkdirSync(dirname(eventsPath), { recursive: true });
appendFileSync(eventsPath, JSON.stringify(event) + '\n', 'utf-8');
}
export function emitEvent(
eventsPath: string,
eventType: string,
taskId: string,
status: string,
source: string,
message: string,
metadata?: Record<string, unknown>,
): void {
appendEvent(eventsPath, {
event_id: randomUUID(),
event_type: eventType,
task_id: taskId,
status,
timestamp: nowISO(),
source,
message,
metadata: metadata ?? {},
});
}