Files
stack/packages/macp/src/event-emitter.ts
Mos (Agent) 10689a30d2
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed
feat: monorepo consolidation — forge pipeline, MACP protocol, framework plugin, profiles/guides/skills
Work packages completed:
- WP1: packages/forge — pipeline runner, stage adapter, board tasks, brief classifier,
  persona loader with project-level overrides. 89 tests, 95.62% coverage.
- WP2: packages/macp — credential resolver, gate runner, event emitter, protocol types.
  65 tests, 96.24% coverage. Full Python-to-TS port preserving all behavior.
- WP3: plugins/mosaic-framework — OC rails injection plugin (before_agent_start +
  subagent_spawning hooks for Mosaic contract enforcement).
- WP4: profiles/ (domains, tech-stacks, workflows), guides/ (17 docs),
  skills/ (5 universal skills), forge pipeline assets (48 markdown files).

Board deliberation: docs/reviews/consolidation-board-memo.md
Brief: briefs/monorepo-consolidation.md

Consolidates mosaic/stack (forge, MACP, bootstrap framework) into mosaic/mosaic-stack.
154 new tests total. Zero Python — all TypeScript/ESM.
2026-03-30 19:43:24 +00:00

36 lines
848 B
TypeScript

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 ?? {},
});
}