import type { RunStatus } from "./types.js"; export const AgentEvents = { RUN_CREATED: "run:created", RUN_COMPLETED: "run:completed", RUN_STOPPED: "run:stopped", RUN_ITERATION: "run:iteration", RUN_COUNTS_CHANGED: "run:counts_changed", AGENTS_SPAWNED: "agents:spawned", AGENTS_COMPLETED: "agents:completed", AGENTS_STOPPED: "agents:stopped", AGENTS_JOINED: "agents:joined", } as const; export type AgentEventChannel = (typeof AgentEvents)[keyof typeof AgentEvents]; export interface RunCreatedPayload { runId: string; } export interface RunStatusPayload { runId: string; status: Exclude; } export interface RunIterationPayload { runId: string; nodeId: string; iteration: number; } export interface AgentsSpawnedPayload { runId: string; nodeId: string; } export interface AgentsCompletedPayload { runId: string; nodeId: string; } export interface AgentsStoppedPayload { runId: string; nodeId: string; error?: string; } export interface AgentsJoinedPayload { runId: string; nodeId: string; from: string; } export interface RunCountsPayload { runs: number; running: number; waiting: number; } export interface AgentEventPayloads { [AgentEvents.RUN_CREATED]: RunCreatedPayload; [AgentEvents.RUN_COMPLETED]: RunStatusPayload; [AgentEvents.RUN_STOPPED]: RunStatusPayload; [AgentEvents.RUN_ITERATION]: RunIterationPayload; [AgentEvents.RUN_COUNTS_CHANGED]: RunCountsPayload; [AgentEvents.AGENTS_SPAWNED]: AgentsSpawnedPayload; [AgentEvents.AGENTS_COMPLETED]: AgentsCompletedPayload; [AgentEvents.AGENTS_STOPPED]: AgentsStoppedPayload; [AgentEvents.AGENTS_JOINED]: AgentsJoinedPayload; }