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 Bash20250124Input = { /** * 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_20250124InputSchema = lazySchema(() => zodSchema( z.object({ command: z.string(), restart: z.boolean().optional(), }), ), ); export const bash_20250124_internal = createProviderDefinedToolFactory< Bash20250124Input, {} >({ id: 'anthropic.bash_20250124', inputSchema: bash_20250124InputSchema, }); type Bash20250124Options = { execute?: ToolExecuteFunction; needsApproval?: Tool['needsApproval']; toModelOutput?: Tool['toModelOutput']; onInputStart?: Tool['onInputStart']; onInputDelta?: Tool['onInputDelta']; onInputAvailable?: Tool['onInputAvailable']; }; type Bash20250124OptionsWithNullableExecute = Omit< Bash20250124Options, 'execute' > & { execute?: Bash20250124Options['execute'] | null; }; type Bash20250124DefaultOutput = Awaited>; export function bash_20250124( options?: Omit, 'execute'> & { execute?: undefined; }, ): ProviderDefinedTool; export function bash_20250124( options: Omit, 'execute'> & { execute: null; }, ): ProviderDefinedTool; export function bash_20250124( options: Omit, 'execute'> & { execute: Bash20250124Options['execute']; }, ): ProviderDefinedTool; export function bash_20250124( options: Bash20250124OptionsWithNullableExecute = {}, ): ProviderDefinedTool { const { execute, ...rest } = options; if (execute === undefined) { return bash_20250124_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 Bash20250124Options) as ReturnType< typeof bash_20250124_internal >; } return bash_20250124_internal({ ...rest, ...(execute === null ? {} : { execute }), } as Bash20250124Options); }