import { et as FileSystem } from "../disk-DEqV3mtA.cjs"; import { ZodType, z } from "zod"; //#region src/internal/tools.d.ts /** What the bound tools operate on: a {@link FileSystem} plus the presentation * bits the agent layer adds on top — a layout hint appended to each tool's * description, and the container path the disks mount at (so `run_bash`'s working * directory lines up with the paths the file tools use). */ interface ToolContext { fs: FileSystem; layoutHint: string; execRoot: string; } /** Build a {@link ToolContext} from any filesystem. A workspace is detected by * its `diskNames()` method (duck-typed so this layer needn't import the class); * its disks are top-level directories, whereas a single disk is rooted at `/`. */ declare function buildContext(fs: FileSystem): ToolContext; interface ToolErrorResult { error: { message: string; status?: number; path?: string; }; } interface Spec { name: N; description: string; schema: T; handler: (ctx: ToolContext, args: z.infer) => Promise; } type AnySpec = Spec; declare const SPECS: readonly [Spec<"read_file", z.ZodObject<{ path: z.ZodString; }, z.core.$strip>, { content: string; bytes: number; binary?: undefined; } | { binary: true; bytes: number; content?: undefined; }>, Spec<"write_file", z.ZodObject<{ path: z.ZodString; content: z.ZodString; }, z.core.$strip>, { bytes: number; }>, Spec<"delete_file", z.ZodObject<{ path: z.ZodString; }, z.core.$strip>, {}>, Spec<"list_files", z.ZodObject<{ path: z.ZodOptional; recursive: z.ZodOptional; }, z.core.$strip>, { entries: ({ type: "dir"; path: string; } | { type: "file"; path: string; bytes: number; })[]; isTruncated: true; } | { entries: ({ type: "dir"; path: string; } | { type: "file"; path: string; bytes: number; })[]; isTruncated?: undefined; }>, Spec<"glob", z.ZodObject<{ pattern: z.ZodString; path: z.ZodOptional; limit: z.ZodOptional; }, z.core.$strip>, { content: string; count: number; path: string; truncated: boolean; }>, Spec<"grep", z.ZodObject<{ pattern: z.ZodString; path: z.ZodOptional; recursive: z.ZodOptional; maxResults: z.ZodOptional; }, z.core.$strip>, { matches: { path: string; line: number; text: string; }[]; status: string; filesScanned: number; }>, Spec<"run_bash", z.ZodObject<{ command: z.ZodString; }, z.core.$strip>, { exitCode: number; stdout: string; stderr: string; timing: { totalMs: number; queueMs: number; executeMs: number; }; }>]; type ToolSpecs = typeof SPECS; interface BoundSpec { name: N; description: string; schema: T; invoke: (args: z.infer) => Promise; } type AnyBoundSpec = BoundSpec; type BindSpec = T extends Spec ? BoundSpec : never; type BindSpecs[]> = Specs extends readonly [infer Head extends AnySpec, ...infer Tail extends AnySpec[]] ? BindSpecs, ...Accumulator]> : Accumulator; type BoundSpecs = BindSpecs; type inferSpecInput = T extends BoundSpec ? z.infer : never; type inferSpecResult = T extends BoundSpec ? V | ToolErrorResult : never; /** * Bind the specs to a filesystem. The layout hint is appended to each * description so the model knows where files live, and `invoke` returns * expected failures as structured error objects rather than throwing. */ declare function bindSpecs(fs: FileSystem): BoundSpecs; //#endregion export { AnyBoundSpec, BoundSpec, BoundSpecs, ToolContext, ToolErrorResult, ToolSpecs, bindSpecs, buildContext, inferSpecInput, inferSpecResult };