feat(aircoding): AirCoding V2 baseline — deterministic multi-agent architecture
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 - System prompt injection for routing - V1 requirements: C4 docs, ADR, AGENTS.md, debug-log.md - Design documents in docs/
This commit is contained in:
31
packages/opencode/test/server/global-bus.ts
Normal file
31
packages/opencode/test/server/global-bus.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { GlobalBus, type GlobalEvent } from "@/bus/global"
|
||||
import { Cause, Effect } from "effect"
|
||||
|
||||
export function waitGlobalBusEvent(input: {
|
||||
timeout?: number
|
||||
message?: string
|
||||
predicate: (event: GlobalEvent) => boolean
|
||||
}) {
|
||||
return Effect.callback<GlobalEvent, unknown>((resume) => {
|
||||
const cleanup = () => GlobalBus.off("event", handler)
|
||||
|
||||
const handler = (event: GlobalEvent) => {
|
||||
try {
|
||||
if (!input.predicate(event)) return
|
||||
cleanup()
|
||||
resume(Effect.succeed(event))
|
||||
} catch (error) {
|
||||
cleanup()
|
||||
resume(Effect.fail(error))
|
||||
}
|
||||
}
|
||||
|
||||
GlobalBus.on("event", handler)
|
||||
return Effect.sync(cleanup)
|
||||
}).pipe(
|
||||
Effect.timeout(input.timeout ?? 10_000),
|
||||
Effect.mapError((error) =>
|
||||
Cause.isTimeoutError(error) ? new Error(input.message ?? "timed out waiting for global bus event") : error,
|
||||
),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user