import { createProviderDefinedToolFactory, lazySchema, type Experimental_SandboxSession as SandboxSession, type ProviderDefinedTool, type Tool, type ToolExecuteFunction, zodSchema, } from '@ai-sdk/provider-utils'; import { z } from 'zod/v4'; type Bash20241022Input = { /** * The bash command to run. Required unless the tool is being restarted. */ command: string; /** * Specifying true will restart this tool. Otherwise, leave this unspecified. */ restart?: boolean; }; const bash_20241022InputSchema = lazySchema(() => zodSchema( z.object({ command: z.string(), restart: z.boolean().optional(), }), ), ); export const bash_20241022_internal = createProviderDefinedToolFactory< Bash20241022Input, {} >({ id: 'anthropic.bash_20241022', inputSchema: bash_20241022InputSchema, }); type Bash20241022Options = { execute?: ToolExecuteFunction; needsApproval?: Tool['needsApproval']; toModelOutput?: Tool['toModelOutput']; onInputStart?: Tool['onInputStart']; onInputDelta?: Tool['onInputDelta']; onInputAvailable?: Tool['onInputAvailable']; }; type Bash20241022OptionsWithNullableExecute = Omit< Bash20241022Options, 'execute' > & { execute?: Bash20241022Options['execute'] | null; }; type Bash20241022DefaultOutput = Awaited>; export function bash_20241022( options?: Omit, 'execute'> & { execute?: undefined; }, ): ProviderDefinedTool; export function bash_20241022( options: Omit, 'execute'> & { execute: null; }, ): ProviderDefinedTool; export function bash_20241022( options: Omit, 'execute'> & { execute: Bash20241022Options['execute']; }, ): ProviderDefinedTool; export function bash_20241022( options: Bash20241022OptionsWithNullableExecute = {}, ): ProviderDefinedTool { const { execute, ...rest } = options; if (execute === undefined) { return bash_20241022_internal({ ...rest, execute: async ( { command }, { abortSignal, experimental_sandbox: sandbox }, ) => { if (!sandbox) { throw new Error('Sandbox session is not available'); } return await sandbox.run({ command, abortSignal, }); }, } as Bash20241022Options) as ReturnType< typeof bash_20241022_internal >; } return bash_20241022_internal({ ...rest, ...(execute === null ? {} : { execute }), } as Bash20241022Options); }