/** * Autonomous agent work loop — business logic extracted from `cleo agent work`. * * The CLI handler delegates here after resolving credentials and starting the * runtime. This module owns the poll-and-dispatch loop, LAFS envelope parsing, * and clean shutdown coordination. * * @module agents/work-loop * @epic T9833 * @task T10062 */ /** Configuration for the autonomous work loop. */ export interface WorkLoopConfig { /** The agent ID running the loop. */ agentId: string; /** Poll interval in milliseconds (default: 30 000). */ pollIntervalMs: number; /** When true, tasks are executed via `orchestrate.spawn.execute`. */ executeMode: boolean; /** Restrict autonomous execution to this epic ID (optional). */ epicRestrict?: string; /** Route spawns through this adapter ID (optional). */ adapterRestrict?: string; } /** Callbacks the CLI layer provides for output and shutdown wiring. */ export interface WorkLoopCallbacks { /** Emit a human-readable info line. */ onInfo: (message: string) => void; /** Emit a human-readable warning line. */ onWarn: (message: string) => void; /** Called when shutdown is requested. */ onShutdown?: () => void; } /** Summary emitted after the loop terminates. */ export interface WorkLoopSummary { agentId: string; mode: 'conductor-loop' | 'watch-only'; iterations: number; } /** * Start the autonomous work loop and return a handle to stop it. * * The loop polls for the next ready task on every `pollIntervalMs` tick. In * watch-only mode it announces available tasks. In conductor-loop mode it * actually spawns them via `cleo orchestrate spawn`. * * @param config - Loop parameters * @param callbacks - Output / lifecycle callbacks * @returns A function that stops the loop and resolves to a summary. */ export declare function startWorkLoop(config: WorkLoopConfig, callbacks: WorkLoopCallbacks): { stop: () => WorkLoopSummary; }; //# sourceMappingURL=work-loop.d.ts.map