import { type Layer } from "effect"; import { Tool, Toolkit } from "effect/unstable/ai"; import { AgentTypeId, type Agent, type ToolDeclaration, type ToolSchedulingPolicy } from "./agent.js"; import type { BudgetLimits } from "../durable/run-budget.js"; import type { Key } from "../context/memory.js"; import type { ModelSelection } from "../model/model-registry.js"; import type { ToolContext } from "../tools/tool-context.js"; import type { TurnPolicy } from "../turn/turn-policy.js"; /** @experimental One Agent observed where its tool and requirement types are not available. */ export interface Any { readonly [AgentTypeId]: unknown; readonly name: string; readonly instructions?: string; readonly toolkit: Toolkit.Any; readonly policy: TurnPolicy; readonly model?: ModelSelection; readonly memory?: Key; readonly toolScheduling: ToolSchedulingPolicy; readonly metadata?: Readonly>; readonly budget?: BudgetLimits; readonly toolDeclarations?: ReadonlyArray; } /** * @experimental Every service one Agent needs to run: its declared requirements, its tool handlers, and the handler * services other than the per-call `ToolContext` that tool execution supplies. */ export type ClosedServices, R> = R | Tool.HandlersFor | Exclude, ToolContext>; /** @experimental Consumer of one hidden Agent identity together with the exact environment that satisfies it. */ export interface Opened { , R>(agent: Agent, environment: Layer.Layer>): A; } /** @experimental One Agent closed over the exact environment it requires; both type arguments stay hidden. */ export interface Closed extends Any { readonly open: (f: Opened) => A; } /** @experimental Close one Agent over the exact environment it requires. */ export declare const close: { , R>(environment: Layer.Layer>>): (agent: Agent) => Closed; , R>(agent: Agent, environment: Layer.Layer>>): Closed; }; /** @experimental Declare additional host-owned tools on an Agent without changing the services it requires. */ export declare const withTools: { , R>(declared: ReadonlyArray): (agent: Agent) => Agent; , R>(agent: Agent, declared: ReadonlyArray): Agent; };