import { Effect } from "effect"; import type { Tools } from "./tools.js"; export type Services = ServicesOf; type ServicesOf> = Depth["length"] extends 8 ? never : T extends { readonly _tag: "CodeModeTool"; readonly execute: (input: unknown) => Effect.Effect; } ? R : T extends object ? string extends keyof T ? ServicesOf : ServicesOf : never; export type ToolCall = { readonly name: string; }; export type ToolCallStarted = { readonly index: number; readonly name: string; readonly input: unknown; }; export type ToolCallEnded = { readonly index: number; readonly name: string; readonly input: unknown; readonly durationMs: number; readonly outcome: "success" | "failure" | "interrupted"; readonly message?: string; }; export type ToolCallHooks = { readonly onToolCallStart?: ((call: ToolCallStarted) => Effect.Effect) | undefined; readonly onToolCallEnd?: ((call: ToolCallEnded) => Effect.Effect) | undefined; }; export type ToolDescription = { readonly path: string; readonly description: string; readonly signature: string; }; export type SafeObject = Record; export declare const toolExpression: (path: string) => string; export declare class ToolReference { readonly path: ReadonlyArray; constructor(path: ReadonlyArray); } export declare class ToolRuntimeError extends Error { readonly kind: "UnknownTool" | "InvalidToolInput" | "InvalidToolOutput" | "InvalidDataValue" | "ToolCallLimitExceeded"; readonly suggestions: ReadonlyArray; constructor(kind: "UnknownTool" | "InvalidToolInput" | "InvalidToolOutput" | "InvalidDataValue" | "ToolCallLimitExceeded", message: string, suggestions?: ReadonlyArray); } export declare const isBlockedMember: (name: string) => boolean; export declare const copyIn: (value: unknown, label: string, preserveCodeModeValues?: boolean) => unknown; export type CopyOutMode = "json" | "nullify"; export declare const copyOut: (value: unknown, mode: CopyOutMode) => unknown; export type DiscoveryPlan = { readonly catalog: ReadonlyArray; readonly searchIndex: ReadonlyArray; }; export type SearchEntry = { readonly description: ToolDescription; readonly searchText: string; }; /** Exact callable signature of the built-in `search` function, for host-owned instructions. */ export declare const searchSignature: string; export declare const searchIndex: (tools: Tools) => ReadonlyArray; export declare const prepare: (tools: Tools) => DiscoveryPlan; export type ToolRuntime = { readonly root: ToolReference; readonly calls: Array; readonly execute: (path: ReadonlyArray, args: Array) => Effect.Effect; readonly search: (args: Array) => Effect.Effect; readonly keys: (path: ReadonlyArray) => ReadonlyArray; }; export declare const make: (tools: Tools, maxToolCalls: number | undefined, searchIndex: ReadonlyArray, hooks?: ToolCallHooks) => ToolRuntime; export * as ToolRuntime from "./tool-runtime.js";