import { Cause, Effect, Option, Queue, Ref, Stream } from "effect"; import { Chat, Prompt, Tool } from "effect/unstable/ai"; import { AgentError, type Event, type ToolProgress, ProgressOverflow, type ToolNameCollision } from "./agent-event.js"; import { type AnyToolCall, type PendingToolResult } from "./agent-tool-result.js"; import type { Agent, ProgressOverflowPolicy, RunError, RunOptions } from "./agent.js"; import type { AgentRunState } from "./agent-run-state.js"; import type { HandoffRunState } from "./handoff-state.js"; import { type AuthorizationError, type ToolAuthorizer } from "../tools/tool-authorization.js"; import { FrameworkFailure, type Outcome, type Request, type Success, ToolExecutor } from "../tools/tool-executor.js"; import { type Registry } from "../tools/tool-registry.js"; import { ToolContext } from "../tools/tool-context.js"; import { type ToolState } from "./tool-skill-activation.js"; import type { Skill, SkillSourceError } from "../context/skill-source.js"; type StaticToolServices> = Tool.HandlersFor | Exclude, ToolContext>; interface ToolExecutionContext, R> { readonly options: RunOptions; readonly state: AgentRunState; readonly isSkillActivationCall: (call: AnyToolCall, registry: Registry) => boolean; readonly agent: Agent; readonly chat: Chat.Service; readonly sessionId: string; readonly executor: Option.Option; readonly authorizer: ToolAuthorizer; readonly skillRuntime: { readonly source: { readonly get: (name: string) => Effect.Effect; }; } | undefined; readonly toolState: Ref.Ref; readonly handoffState?: Ref.Ref; readonly progressPolicy: ProgressOverflowPolicy; readonly activeSession: Option.Option; readonly memoryRuntime: unknown | undefined; readonly errorMessage: (error: unknown) => string; readonly skillError: (turn: number, error: SkillSourceError) => AgentError; } export declare const makeToolExecution: , R = never>(inputContext: ToolExecutionContext) => { boundedSuccessResult: (call: AnyToolCall, outcome: Success) => Effect.Effect; outcomeEvent: (turn: number, toolCallBatch: Request["toolCallBatch"], toolCallIndex: number, call: AnyToolCall, outcome: Outcome, droppedProgress: number, registry: Registry) => Effect.Effect; defaultExecute: (request: Request, registry: Registry) => Effect.Effect | Tool.HandlerServices>; makeProgressQueue: () => Effect.Effect>; executeApproved: (turn: number, call: AnyToolCall, request: Request, registry: Registry) => Stream.Stream | import("../durable/driver-interpreter.js").DriverInterpreter>; activateSkillOutcome: (turn: number, call: AnyToolCall) => Effect.Effect; authorizationError: (turn: number, error: AuthorizationError) => AgentError; resumeApproved: (turn: number, toolCallBatch: Request["toolCallBatch"], toolCallIndex: number, call: AnyToolCall, registry: Registry) => Stream.Stream | R | import("../durable/driver-interpreter.js").DriverInterpreter>; toolCallEvents: (turn: number, toolCallBatch: Request["toolCallBatch"], toolCallIndex: number, call: AnyToolCall, messages: ReadonlyArray, registry: Registry) => Stream.Stream | R | import("../durable/driver-interpreter.js").DriverInterpreter>; }; export {};