import { Effect, Ref, Schema } from "effect"; import { Prompt } from "effect/unstable/ai"; import type { RunOptions } from "./agent.js"; import type { Any as AnyAgent } from "./agent-closure.js"; import type { TurnOverrides } from "../turn/turn-policy.js"; import type { HandoffTarget } from "../policy/handoff-target.js"; import { AgentPin } from "../durable/pin.js"; export declare const HandoffFrame: Schema.Struct<{ readonly handoffId: Schema.String; readonly source: Schema.String; readonly target: Schema.String; readonly turn: Schema.Finite; readonly reason: Schema.optionalKey; }>; export type HandoffFrame = typeof HandoffFrame.Type; export declare const HandoffEdgeCount: Schema.Struct<{ readonly source: Schema.String; readonly target: Schema.String; readonly count: Schema.Finite; }>; export declare const HandoffControlState: Schema.Struct<{ readonly root: Schema.String; readonly active: Schema.String; readonly path: Schema.$Array; }>>; readonly edgeCounts: Schema.$Array>; readonly handoffCount: Schema.Finite; readonly pendingContinuation: Schema.optionalKey; readonly instructions: Schema.optionalKey; }>>; }>; export type HandoffControlState = typeof HandoffControlState.Type; export declare const HandoffCommit: Schema.TaggedStruct<"HandoffCommit", { readonly state: Schema.Struct<{ readonly root: Schema.String; readonly active: Schema.String; readonly path: Schema.$Array; }>>; readonly edgeCounts: Schema.$Array>; readonly handoffCount: Schema.Finite; readonly pendingContinuation: Schema.optionalKey; readonly instructions: Schema.optionalKey; }>>; }>; readonly sessionEntryId: Schema.String; readonly sessionParentId: Schema.NullOr; readonly projectedHistory: Schema.Codec; readonly targetAgentPin: Schema.optionalKey>; }>; export type HandoffCommit = typeof HandoffCommit.Type; export interface HandoffRunState { readonly root: string; readonly active: HandoffTarget; readonly path: ReadonlyArray; readonly edgeCounts: ReadonlyMap>; readonly handoffCount: number; readonly pendingContinuation: { readonly prompt: Prompt.RawInput; readonly overrides?: TurnOverrides; } | undefined; } export declare const toHandoffControlState: (state: HandoffRunState) => HandoffControlState; export declare const takePendingContinuation: { (persist: (state: HandoffControlState) => Effect.Effect): (stateRef: Ref.Ref) => Effect.Effect; (stateRef: Ref.Ref, persist: (state: HandoffControlState) => Effect.Effect): Effect.Effect; }; export declare const fromHandoffControlState: { (active: HandoffTarget): (state: HandoffControlState) => HandoffRunState; (state: HandoffControlState, active: HandoffTarget): HandoffRunState; }; export declare const makeHandoffRunState: { (activePin?: AgentPin): (agent: AnyAgent) => HandoffRunState; (agent: AnyAgent, activePin?: AgentPin): HandoffRunState; }; export declare const edgeLabel: { (target: string): (source: string) => string; (source: string, target: string): string; }; export declare const edgeCount: { (source: string, target: string): (counts: HandoffRunState["edgeCounts"]) => number; (counts: HandoffRunState["edgeCounts"], source: string, target: string): number; }; export declare const incrementEdge: { (source: string, target: string): (counts: HandoffRunState["edgeCounts"]) => HandoffRunState["edgeCounts"]; (counts: HandoffRunState["edgeCounts"], source: string, target: string): HandoffRunState["edgeCounts"]; }; declare const HandoffTargetMissing_base: Schema.Class, import("effect/Cause").YieldableError>; export declare class HandoffTargetMissing extends HandoffTargetMissing_base { } declare const HandoffLimitExceeded_base: Schema.Class; readonly turn: Schema.Finite; readonly limit: Schema.Finite; readonly edge: Schema.optionalKey; }>, import("effect/Cause").YieldableError>; export declare class HandoffLimitExceeded extends HandoffLimitExceeded_base { } declare const HandoffRequirementsMissing_base: Schema.Class, import("effect/Cause").YieldableError>; export declare class HandoffRequirementsMissing extends HandoffRequirementsMissing_base { } export declare const HandoffAccepted: Schema.TaggedStruct<"HandoffAccepted", { readonly handoffId: Schema.String; readonly source: Schema.String; readonly target: Schema.String; }>; export type HandoffAccepted = typeof HandoffAccepted.Type; export declare const isHandoffAccepted: (input: I) => input is I & Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<"HandoffAccepted">; readonly handoffId: Schema.String; readonly source: Schema.String; readonly target: Schema.String; }, "Type">; export declare const maxHandoffs: { (agent: AnyAgent): (options: RunOptions) => number | undefined; (options: RunOptions, agent: AnyAgent): number | undefined; }; export declare const makeHandoffStateRef: { (activePin?: AgentPin, restored?: HandoffControlState): (agent: AnyAgent) => Effect.Effect>; (agent: AnyAgent, activePin?: AgentPin, restored?: HandoffControlState): Effect.Effect>; }; export {};