import { IEventService, IFunctionTool, IParameterValidationResult, ITool, IToolExecutionContext, IToolRegistry, IToolResult, IToolSchema, TToolExecutor, TToolParameters, TUniversalValue } from "@robota-sdk/agent-core"; import { TypeOf, ZodType } from "zod"; //#region src/types/tool-result.d.ts /** * Result returned by a CLI tool invocation */ interface IToolInvocationResult { success: boolean; output: string; error?: string; exitCode?: number; /** Start line number of the edit in the original file (Edit tool only) */ startLine?: number; } //#endregion //#region src/sandbox/types.d.ts interface ISandboxRunOptions { timeoutMs?: number; workingDirectory?: string; } interface ISandboxRunResult { stdout: string; stderr?: string; exitCode: number; } interface IWorkspaceManifestFileEntry { type: 'file'; content: string; encoding?: 'utf8'; } interface IWorkspaceManifestDirectoryEntry { type: 'dir'; } interface IWorkspaceManifestLocalFileEntry { type: 'localFile'; src: string; } interface IWorkspaceManifestLocalDirectoryEntry { type: 'localDir'; src: string; } interface IWorkspaceManifestGitRepositoryEntry { type: 'gitRepo'; url: string; ref?: string; shallow?: boolean; } interface IWorkspaceManifestS3MountEntry { type: 's3Mount'; bucket: string; prefix?: string; region: string; } interface IWorkspaceManifestGcsMountEntry { type: 'gcsMount'; bucket: string; prefix?: string; } interface IWorkspaceManifestR2MountEntry { type: 'r2Mount'; bucket: string; accountId: string; prefix?: string; } interface IWorkspaceManifestAzureBlobMountEntry { type: 'azureBlobMount'; container: string; account: string; prefix?: string; } type TWorkspaceManifestEntry = IWorkspaceManifestFileEntry | IWorkspaceManifestDirectoryEntry | IWorkspaceManifestLocalFileEntry | IWorkspaceManifestLocalDirectoryEntry | IWorkspaceManifestGitRepositoryEntry | IWorkspaceManifestS3MountEntry | IWorkspaceManifestGcsMountEntry | IWorkspaceManifestR2MountEntry | IWorkspaceManifestAzureBlobMountEntry; interface IWorkspaceManifestPermissions { read?: string[]; write?: string[]; } interface IWorkspaceManifest { entries: Record; environment?: Record; permissions?: IWorkspaceManifestPermissions; } interface IWorkspaceManifestApplyOptions { targetRoot?: string; hostRoot?: string; } type TWorkspaceManifestApplyStatus = 'applied' | 'unsupported'; interface IWorkspaceManifestAppliedEntry { path: string; type: TWorkspaceManifestEntry['type']; status: TWorkspaceManifestApplyStatus; message?: string; } interface IWorkspaceManifestApplyResult { entries: IWorkspaceManifestAppliedEntry[]; } interface ISandboxClient { run(command: string, options?: ISandboxRunOptions): Promise; readFile(path: string): Promise; writeFile(path: string, content: string): Promise; applyManifest?(manifest: IWorkspaceManifest, options?: IWorkspaceManifestApplyOptions): Promise; /** Return a provider-owned resumable workspace reference. */ snapshot?(): Promise; /** Hydrate this client from a provider-owned workspace reference. */ restore?(snapshotId: string): Promise; } interface ISandboxToolOptions { sandboxClient?: ISandboxClient; /** When set, Read/Write/Edit operations on the host (non-sandbox) are restricted to this directory. */ cwd?: string; } //#endregion //#region src/sandbox/e2b-sandbox-client.d.ts interface IE2BCommandStartOptions { timeoutMs?: number; cwd?: string; background?: false; } interface IE2BCommandResult { stdout?: string; stderr?: string; exitCode?: number; exit_code?: number; } interface IE2BCommands { run(command: string, options?: IE2BCommandStartOptions): Promise; } interface IE2BFiles { read(path: string): Promise; write(path: string, content: string): Promise; } interface IE2BSnapshot { snapshotId?: string; id?: string; } interface IE2BSandboxAdapter { sandboxId?: string; commands: IE2BCommands; files: IE2BFiles; pause?(): Promise; connect?(): Promise; createSnapshot?(): Promise; } interface IE2BSandboxClientOptions { sandbox: IE2BSandboxAdapter; connectSandbox?: (sandboxId: string) => Promise; createSandboxFromSnapshot?: (snapshotId: string) => Promise; } declare class E2BSandboxClient implements ISandboxClient { private sandbox; private readonly connectSandbox?; private readonly createSandboxFromSnapshot?; constructor(options: IE2BSandboxClientOptions); run(command: string, options?: ISandboxRunOptions): Promise; readFile(path: string): Promise; writeFile(path: string, content: string): Promise; snapshot(): Promise; restore(snapshotId: string): Promise; } //#endregion //#region src/sandbox/in-memory-sandbox-client.d.ts type TInMemorySandboxRunHandler = (command: string, options: ISandboxRunOptions | undefined, files: ReadonlyMap) => Promise | ISandboxRunResult; interface IInMemorySandboxClientOptions { files?: Record; runHandler?: TInMemorySandboxRunHandler; } declare class InMemorySandboxClient implements ISandboxClient { private readonly files; private readonly snapshots; private readonly runHandler?; private snapshotSequence; constructor(options?: IInMemorySandboxClientOptions); run(command: string, options?: ISandboxRunOptions): Promise; readFile(path: string): Promise; writeFile(path: string, content: string): Promise; snapshot(): Promise; restore(snapshotId: string): Promise; getFile(path: string): string | undefined; } //#endregion //#region src/sandbox/workspace-manifest.d.ts declare function applyWorkspaceManifest(sandboxClient: ISandboxClient, manifest: IWorkspaceManifest, options?: IWorkspaceManifestApplyOptions): Promise; declare function validateWorkspaceManifestPath(path: string): string; //#endregion //#region src/registry/tool-registry.d.ts /** * Tool registry implementation * Manages tool registration, validation, and retrieval */ declare class ToolRegistry implements IToolRegistry { private tools; /** * Register a tool */ register(tool: ITool): void; /** * Unregister a tool */ unregister(name: string): void; /** * Get tool by name */ get(name: string): ITool | undefined; /** * Get all registered tools */ getAll(): ITool[]; /** * Get tool schemas */ getSchemas(): IToolSchema[]; /** * Check if tool exists */ has(name: string): boolean; /** * Clear all tools */ clear(): void; /** * Get tool names */ getToolNames(): string[]; /** * Get tools by pattern */ getToolsByPattern(pattern: string | RegExp): ITool[]; /** * Get tool count */ size(): number; /** * Validate tool schema */ private validateToolSchema; } //#endregion //#region src/implementations/function-tool.d.ts /** * Function tool implementation * Wraps a JavaScript function as a tool with schema validation * * Implements IFunctionTool without extending AbstractTool to avoid * circular runtime dependency (tools → agents → tools). */ declare class FunctionTool implements IFunctionTool { readonly schema: IToolSchema; readonly fn: TToolExecutor; private eventService; constructor(schema: IToolSchema, fn: TToolExecutor); /** * Get tool name */ getName(): string; /** * Set EventService for post-construction injection. * Accepts EventService as-is without transformation. * Caller is responsible for providing properly configured EventService. */ setEventService(eventService: IEventService | undefined): void; /** * Execute the function tool */ execute(parameters: TToolParameters, context?: IToolExecutionContext): Promise; /** * Validate parameters (simple boolean result) */ validate(parameters: TToolParameters): boolean; /** * Validate tool parameters with detailed result */ validateParameters(parameters: TToolParameters): IParameterValidationResult; /** * Get tool description */ getDescription(): string; /** * Validate constructor inputs */ private validateConstructorInputs; } /** * Helper function to create a function tool from a simple function */ declare function createFunctionTool(name: string, description: string, parameters: IToolSchema['parameters'], fn: TToolExecutor): FunctionTool; /** * Helper function to create a function tool from Zod schema */ declare function createZodFunctionTool(name: string, description: string, zodSchema: S, fn: TToolExecutor>): FunctionTool; //#endregion //#region src/implementations/function-tool/types.d.ts /** * Parameter type validation options */ interface IFunctionToolValidationOptions { strict?: boolean; allowUnknown?: boolean; validateTypes?: boolean; } /** * Tool execution metadata */ interface IFunctionToolExecutionMetadata { executionTime: number; toolName: string; parameters: TToolParameters; } /** * Tool result with metadata */ interface IFunctionToolResult { success: boolean; data: TUniversalValue; metadata?: IFunctionToolExecutionMetadata; } //#endregion //#region src/builtins/shell-tool.d.ts /** * Create a `Shell` tool instance — register with the Robota agent tools registry. * The description is resolved at creation time for the host's active shell. */ declare function createShellTool(options?: ISandboxToolOptions): FunctionTool; /** * Create a `Bash` tool instance — the model-familiar alias of the same OS-aware shell tool. */ declare function createBashTool(options?: ISandboxToolOptions): FunctionTool; /** `Shell` tool instance — register with the Robota agent tools registry. */ declare const shellTool: FunctionTool; /** `Bash` tool instance — model-familiar alias of {@link shellTool}. */ declare const bashTool: FunctionTool; //#endregion //#region src/builtins/read-tool.d.ts /** * Create a ReadTool instance — register with Robota agent tools registry. */ declare function createReadTool(options?: ISandboxToolOptions): FunctionTool; /** * ReadTool instance — register with Robota agent tools registry. */ declare const readTool: FunctionTool; //#endregion //#region src/builtins/write-tool.d.ts /** * Create a WriteTool instance — register with Robota agent tools registry. */ declare function createWriteTool(options?: ISandboxToolOptions): FunctionTool; /** * WriteTool instance — register with Robota agent tools registry. */ declare const writeTool: FunctionTool; //#endregion //#region src/builtins/edit-tool.d.ts /** * Create an EditTool instance — register with Robota agent tools registry. */ declare function createEditTool(options?: ISandboxToolOptions): FunctionTool; /** * EditTool instance — register with Robota agent tools registry. */ declare const editTool: FunctionTool; //#endregion //#region src/builtins/glob-tool.d.ts /** * GlobTool — fast file pattern search using fast-glob. * * Excludes node_modules and .git by default. * Results are sorted by modification time (most recently modified first). */ /** * GlobTool instance — register with Robota agent tools registry. */ declare const globTool: FunctionTool; //#endregion //#region src/builtins/grep-tool.d.ts /** * GrepTool — recursive regex content search. * * Supports three output modes: * - files_with_matches (default): return only file paths that contain a match * - content: return matching lines with optional context lines * - count: return per-file match counts as "path:count" rows * * headLimit caps the number of result lines; excess is truncated with a marker. */ /** * GrepTool instance — register with Robota agent tools registry. */ declare const grepTool: FunctionTool; //#endregion //#region src/builtins/web-fetch-tool.d.ts declare const webFetchTool: FunctionTool; //#endregion //#region src/builtins/web-search-tool.d.ts /** * WebSearchTool — search the web and return results. * * Uses Brave Search API when BRAVE_API_KEY is set. * Returns an error with setup instructions otherwise. */ declare const webSearchTool: FunctionTool; //#endregion //#region src/builtins/ask-user-question-tool.d.ts /** * Create an `AskUserQuestion` tool instance — register with the Robota agent tools registry. */ declare function createAskUserQuestionTool(): FunctionTool; /** `AskUserQuestion` tool instance — register with the Robota agent tools registry. */ declare const askUserQuestionTool: FunctionTool; //#endregion export { E2BSandboxClient, FunctionTool, type IE2BSandboxAdapter, type IE2BSandboxClientOptions, type IFunctionToolExecutionMetadata, type IFunctionToolResult, type IFunctionToolValidationOptions, type IInMemorySandboxClientOptions, type ISandboxClient, type ISandboxRunOptions, type ISandboxRunResult, type ISandboxToolOptions, type IToolInvocationResult, type IWorkspaceManifest, type IWorkspaceManifestAppliedEntry, type IWorkspaceManifestApplyOptions, type IWorkspaceManifestApplyResult, type IWorkspaceManifestAzureBlobMountEntry, type IWorkspaceManifestDirectoryEntry, type IWorkspaceManifestFileEntry, type IWorkspaceManifestGcsMountEntry, type IWorkspaceManifestGitRepositoryEntry, type IWorkspaceManifestLocalDirectoryEntry, type IWorkspaceManifestLocalFileEntry, type IWorkspaceManifestPermissions, type IWorkspaceManifestR2MountEntry, type IWorkspaceManifestS3MountEntry, InMemorySandboxClient, type TInMemorySandboxRunHandler, type TWorkspaceManifestApplyStatus, type TWorkspaceManifestEntry, ToolRegistry, applyWorkspaceManifest, askUserQuestionTool, bashTool, createAskUserQuestionTool, createBashTool, createEditTool, createFunctionTool, createReadTool, createShellTool, createWriteTool, createZodFunctionTool, editTool, globTool, grepTool, readTool, shellTool, validateWorkspaceManifestPath, webFetchTool, webSearchTool, writeTool }; //# sourceMappingURL=index.d.ts.map