import type { AgentConfig } from '../types/agentConfig.js'; import type { Flow } from '../types/flow.js'; import type { RunState } from '../runtime/durable/types.js'; export declare const FLOW_CATALOG_NOTE_TAG = "flow-catalog"; export interface FlowCatalogEntry { name: string; description: string; } export interface FlowCatalogDelta { added: FlowCatalogEntry[]; removed: string[]; } export interface PersistedLiveFlowCatalog { agentId: string; announced: FlowCatalogEntry[]; } export declare class FlowNameConflictError extends Error { readonly name = "FlowNameConflictError"; readonly flowName: string; readonly reason: 'code' | 'bundle' | 'dynamic'; constructor(flowName: string, reason: 'code' | 'bundle' | 'dynamic'); } export declare class FlowCycleError extends Error { readonly name = "FlowCycleError"; constructor(); } /** * Per-agent live roster: code-configured flows are the baseline; dynamic flows * layer on top and must not reuse a baseline name. Shared across sessions of * the same runtime — announcement snapshots live on run state, not here. */ export declare class LiveFlowCatalog { private readonly baseline; private readonly dynamic; constructor(baseline: readonly Flow[]); list(): Flow[]; get(name: string): Flow | undefined; hasCodeFlow(name: string): boolean; register(flow: Flow): void; remove(name: string): boolean; getDynamic(name: string): Flow | undefined; /** * Undo one bundle's live mutations. Deletes names this bundle added; * restores the prior Flow object for names this bundle replaced. * Concurrent registrations for other names are left untouched. */ rollbackDynamic(added: readonly string[], replaced: ReadonlyMap): void; overlay(agent: AgentConfig): AgentConfig; entries(): FlowCatalogEntry[]; } export declare function findFlowByName(agent: AgentConfig, flowName: string): Flow | undefined; export declare function diffFlowCatalog(previous: readonly FlowCatalogEntry[], next: readonly FlowCatalogEntry[]): FlowCatalogDelta; export declare function renderFlowCatalogDelta(delta: FlowCatalogDelta, roster: readonly string[]): string; /** * Diff the live roster against the snapshot stored on this run. Writes the new * snapshot onto run state. Returns true when run state changed (snapshot and/or * note) so the caller can persist. A crash before that write re-diffs next turn. */ export declare function applyFlowCatalogAnnouncement(catalog: LiveFlowCatalog, agentId: string, runState: RunState): boolean; export declare function rebaselineFlowCatalogAnnouncement(catalog: LiveFlowCatalog, agentId: string, runState: RunState): void;