/** * Live agent-run status backed by Effect supervision. * * Supervisor callbacks are synchronous, so lifecycle state crosses that * boundary through a private MutableRef and PubSub. The public contract stays * Effect-native: callers read an Effect snapshot and subscribe to a Stream of * lifecycle changes. */ import { Context, Effect, FiberRef, Layer, Option, Stream } from 'effect'; export type AgentRunState = 'starting' | 'calling_model' | 'streaming' | 'running_tool' | 'paused'; export interface AgentRunInfo { readonly fiberId: string; readonly agentId: string; readonly workflowId?: string; readonly sessionId?: string; readonly state: AgentRunState; readonly startedAt: number; } /** * Metadata inherited by the one child fiber that owns an agent run. * `runId` distinguishes a run root from its incidental descendant fibers. */ export interface AgentRunAnnotation { readonly runId: string; readonly agentId: string; readonly workflowId?: string; readonly sessionId?: string; readonly state?: AgentRunState; readonly startedAt?: number; } export type AgentStatusSnapshot = ReadonlyArray; export type AgentStatusListener = (snapshot: AgentStatusSnapshot) => void; export type AgentStatusUnsubscribe = () => Promise; export interface AgentStatusService { readonly snapshot: Effect.Effect; readonly changes: Stream.Stream; readonly transition: (state: AgentRunState) => Effect.Effect; } export declare const AgentStatusService: Context.Tag; export declare const AgentRunAnnotationRef: FiberRef.FiberRef>; /** Execute an effect in one annotated child fiber. */ export declare const trackAgentRun: (annotation: AgentRunAnnotation) => (effect: Effect.Effect) => Effect.Effect; /** Keep one supervised run root alive for the lifetime of a stream scope. */ export declare const trackAgentStream: (annotation: AgentRunAnnotation) => (stream: Stream.Stream) => Stream.Stream; /** Apply a transition from outside the annotated run fiber (for stream taps). */ export declare const transitionAgentRun: (service: AgentStatusService, annotation: AgentRunAnnotation, state: AgentRunState) => Effect.Effect; /** One independent lifecycle tracker per Fred runtime. */ export declare const AgentStatusServiceLive: Layer.Layer; //# sourceMappingURL=status.d.ts.map