Forked from OpenCode v1.17.4 with multi-agent system: - 5 agents: aircoding, scheduler, worker, architect, reviewer - Deterministic DAG scheduling engine (coordinator_tick) - Tool whitelists as hard enforcement - AirCoding validation plugin - V1 requirements: C4 docs, ADR, AGENTS.md, debug-log.md - Design documents in docs/
23 lines
609 B
TypeScript
23 lines
609 B
TypeScript
import { EventEmitter } from "events"
|
|
import { Identifier } from "@/id/id"
|
|
|
|
export type GlobalEvent = {
|
|
directory?: string
|
|
project?: string
|
|
workspace?: string
|
|
payload: any
|
|
}
|
|
|
|
class GlobalBusEmitter extends EventEmitter<{
|
|
event: [GlobalEvent]
|
|
}> {
|
|
override emit(eventName: "event", event: GlobalEvent): boolean {
|
|
if (event.payload && typeof event.payload === "object" && !("id" in event.payload)) {
|
|
event.payload.id = event.payload.syncEvent?.id ?? Identifier.create("evt", "ascending")
|
|
}
|
|
return super.emit(eventName, event)
|
|
}
|
|
}
|
|
|
|
export const GlobalBus = new GlobalBusEmitter()
|