import type { AgentTool } from "@earendil-works/pi-agent-core"; import type { ImageContent, ModelImageResizeOptions } from "@earendil-works/pi-ai"; import { type Static, Type } from "typebox"; import type { ExtensionContext, ToolDefinition } from "../extensions/types.ts"; import { type TruncationResult } from "./truncate.ts"; declare const readSchema: Type.TObject<{ path: Type.TString; offset: Type.TOptional; limit: Type.TOptional; }>; export declare const readToolSystemPromptContribution: { readonly snippet: "Read file contents"; readonly guidelines: readonly ["Use read to examine files instead of cat or sed."]; }; export type ReadToolInput = Static; /** * Result for programmatic callers such as codemode scripts: the text for text files, and an image * block for images that codemode's `image()` accepts. `note` is the text that goes with the image, * such as resize hints. Property descriptions are left out so the type stays on one line in tool * descriptions. */ declare const readOutputSchema: Type.TUnion<[Type.TString, Type.TObject<{ type: Type.TLiteral<"image">; data: Type.TString; mimeType: Type.TString; note: Type.TString; }>]>; export type ReadToolOutput = Static; export interface ReadToolDetails { truncation?: TruncationResult; } /** * Pluggable operations for the read tool. * Override these to delegate file reading to remote systems (for example SSH). */ export interface ReadOperations { /** Read file contents as a Buffer */ readFile: (absolutePath: string) => Promise; /** Check if file is readable (throw if not) */ access: (absolutePath: string) => Promise; /** Detect image MIME type, return null or undefined for non-images */ detectImageMimeType?: (absolutePath: string) => Promise; } export interface ReadToolOptions { /** Whether to auto-resize images. Default: true */ autoResizeImages?: boolean; /** * Vision model ("provider/modelId") used to describe images when the active * model cannot accept image input. The caption text is returned in place of * the image block. Default: unset (images are omitted as before). */ imageCaptionModel?: string; /** Fallback resize profile when the execution context has no model metadata. */ resizeOptions?: ModelImageResizeOptions; /** Custom operations for file reading. Default: local filesystem */ operations?: ReadOperations; } /** * Ask a vision model to describe an image. Returns the caption text, or null if * the caption model/credentials are unavailable or the request fails. */ export declare function captionImage(image: ImageContent, captionModelId: string | undefined, ctx: ExtensionContext | undefined, signal: AbortSignal | undefined): Promise; export declare function createReadToolDefinition(cwd: string, options?: ReadToolOptions): ToolDefinition; export declare function createReadTool(cwd: string, options?: ReadToolOptions): AgentTool; export {};