import type { PlanStep, FlowStepResult } from "@db-lyon/flowkit"; /** * Per-flow-run lifecycle events emitted by the flow tool while a flow * executes. The HTTP server pipes these into an SSE stream so external * clients (editor plugins, dashboards, `curl --no-buffer`) can observe * live progress. * * One module-level bus serves every concurrent run; the `runId` field * lets subscribers filter to a specific run. The flow.run response * includes the same runId so callers can correlate. */ export type FlowEvent = { type: "run_started"; runId: string; flowName: string; plan: PlanStep[]; timestamp: number; } | { type: "step_started"; runId: string; flowName: string; step: PlanStep; timestamp: number; } | { type: "step_completed"; runId: string; flowName: string; step: PlanStep; result: { success: boolean; skipped: boolean; duration: number; attempts?: number; error?: { message: string; name: string; }; }; timestamp: number; } | { type: "step_failed"; runId: string; flowName: string; step: PlanStep; error: { message: string; name: string; }; timestamp: number; } | { type: "run_completed"; runId: string; flowName: string; success: boolean; duration: number; stepCount: number; failedStep?: string; timestamp: number; }; type Listener = (event: FlowEvent) => void; export declare function nextRunId(): string; export declare function emitFlowEvent(event: FlowEvent): void; export declare function subscribeFlowEvents(listener: Listener): () => void; export declare function trimStepResult(r: FlowStepResult): { success: boolean; skipped: boolean; duration: number; attempts?: number; error?: { message: string; name: string; }; }; export declare function trimError(e: Error): { message: string; name: string; }; export type { FlowRunResult } from "@db-lyon/flowkit";