/** * manager-streams.ts, the stream watcher kind's lifecycle. * * Split out of manager.ts so the supervisor file stays inside the 800-line * hand-authored cap. The logic is unchanged: spawn the long-lived command * through the injected stream host, feed every chunk to a StreamLineProcessor, * emit a batch when one is ready, and put a stream command that exits through * the same backoff ladder and breaker every other kind uses. * * These are free functions over a narrow `StreamOwner` view of the manager * rather than methods, so the coupling back to the supervisor is written down * explicitly instead of being "whatever `this` happens to have". */ import { StreamLineProcessor } from './stream-watchers.js'; import { type SupervisionPolicy } from './supervision.js'; import type { TriggerManagerConfig, TriggerStreamHost } from './manager-types.js'; import type { StreamTriggerSpec, TriggerRecord } from './types.js'; /** Per-trigger stream state: the line processor plus its supervision handles. */ export interface StreamRuntime { readonly processor: StreamLineProcessor; streamId: string | null; timer: ReturnType | null; } /** Exactly what the stream lifecycle needs from the supervisor. */ export interface StreamOwner { readonly streams: Map; readonly records: Map; readonly streamHost: TriggerStreamHost | undefined; readonly policy: SupervisionPolicy; config(): TriggerManagerConfig; now(): number; persist(): void; fireAction(id: string, reason: string, fingerprint: string, kind: 'condition' | 'stream', promptOverride?: string): Promise; } export declare function startStreamTrigger(owner: StreamOwner, record: TriggerRecord, spec: StreamTriggerSpec, now: number): Promise; /** Emits whatever batches are ready. An agent runs only when one is. */ export declare function drainStreamTrigger(owner: StreamOwner, id: string, force?: boolean): void; /** A supervised stream command that exits walks the same ladder and breaker. */ export declare function handleStreamExit(owner: StreamOwner, id: string, exitCode: number | null): void; //# sourceMappingURL=manager-streams.d.ts.map