@ai-sdk/tool-bash 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @ai-sdk/tool-bash
2
2
 
3
+ ## 1.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [47236dd]
8
+ - Updated dependencies [c8e8866]
9
+ - Updated dependencies [1cf95c6]
10
+ - ai@7.0.154
11
+
12
+ ## 1.0.7
13
+
14
+ ### Patch Changes
15
+
16
+ - e729d58: chore(docs): update `README.md` for consistent format and to avoid duplication
17
+ - Updated dependencies [5475347]
18
+ - ai@7.0.153
19
+
3
20
  ## 1.0.6
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -2,23 +2,12 @@
2
2
 
3
3
  A first-party, provider-independent bash tool for the [AI SDK](https://ai-sdk.dev/docs).
4
4
 
5
- The `@ai-sdk/tool-bash` entry point provides a bash tool for any model supporting
6
- function calling. Supply an `Experimental_SandboxSession` to choose where commands
7
- run. Use `@ai-sdk/sandbox-just-bash` for an in-memory environment,
8
- `@ai-sdk/sandbox-vercel` for Vercel Sandbox, or your own implementation.
5
+ ## Setup
9
6
 
10
- The tool has no direct dependency on either runtime.
11
-
12
- ## Installation
13
-
14
- Install the tool and the sandbox adapter you want to use:
15
-
16
- ```sh
17
- pnpm add ai @ai-sdk/tool-bash @ai-sdk/sandbox-just-bash
7
+ ```bash
8
+ npm i ai @ai-sdk/tool-bash @ai-sdk/sandbox-just-bash
18
9
  ```
19
10
 
20
- Requires Node.js 22.13 or newer.
21
-
22
11
  ## Usage
23
12
 
24
13
  ```ts
@@ -50,66 +39,4 @@ try {
50
39
  }
51
40
  ```
52
41
 
53
- `experimental_createBashTool()` returns the tool directly. Read generated files through the
54
- supplied sandbox using `readTextFile({ path })`, which returns `null` if missing.
55
- The just-bash adapter resolves relative read paths against its default directory.
56
- When overriding `workingDirectory`, use absolute paths to read files there.
57
-
58
- The caller owns the sandbox lifecycle. Tools sharing a session share files.
59
- Seed files through `sandbox.writeTextFile({ path, content })` before running the
60
- tool. Commands use the sandbox's default working directory. Set
61
- `workingDirectory` to an absolute path to override it; explicit directories are
62
- created if needed. Without an override, creating the tool runs no setup commands.
63
- Commands, networking, and persistence depend on the sandbox.
64
-
65
- ## Vercel Sandbox
66
-
67
- Install `@ai-sdk/sandbox-vercel` and `@vercel/sandbox` to use an existing native
68
- Vercel Sandbox. Wrap it with the adapter before passing it to the tool:
69
-
70
- ```ts
71
- import { createVercelSandboxSessionFromNativeSandbox } from '@ai-sdk/sandbox-vercel';
72
- import { experimental_createBashTool as createBashTool } from '@ai-sdk/tool-bash';
73
- import { Sandbox } from '@vercel/sandbox';
74
-
75
- const nativeSandbox = await Sandbox.create();
76
-
77
- try {
78
- const sandbox = createVercelSandboxSessionFromNativeSandbox(nativeSandbox);
79
- await sandbox.writeTextFile({
80
- path: 'notes.txt',
81
- content: 'Hello from Vercel Sandbox',
82
- });
83
- const bash = await createBashTool({ sandbox });
84
-
85
- // Use bash with generateText, streamText, or ToolLoopAgent here.
86
- } finally {
87
- await nativeSandbox.stop();
88
- }
89
- ```
90
-
91
- You can also create a managed session with
92
- `createVercelNetworkSandboxSession()` from `@ai-sdk/sandbox-vercel` and pass
93
- `session.restricted()`. For an existing native just-bash `Sandbox`, use
94
- `createJustBashSandboxSessionFromNativeSandbox()` from `@ai-sdk/sandbox-just-bash`.
95
- Raw runtime instances need their respective adapters; a custom
96
- `Experimental_SandboxSession` can be passed directly.
97
-
98
- Pass `maxOutputLength` to limit characters retained from each output stream
99
- (default: 30,000). Cancellation is forwarded to the supplied session.
100
-
101
- Pass `timeout` to set a timeout in milliseconds for each command execution:
102
-
103
- ```ts
104
- const bash = await createBashTool({ sandbox, timeout: 10_000 });
105
- ```
106
-
107
- The value must be an integer from `1` to `2147483647`. There is no tool-level
108
- timeout by default. Each execution gets a fresh timeout; initialization and
109
- waiting for the model or approval are excluded. The timeout is combined with
110
- the caller's abort signal, and the sandbox must honor cancellation. The
111
- sandbox's result or error is passed through (just-bash returns exit code `124`
112
- when a running command is cancelled).
113
-
114
- See the [Bash Tool documentation](https://ai-sdk.dev/docs/ai-sdk-core/tools#bash-tool)
115
- for options and file handling.
42
+ See the [Bash Tool documentation](https://ai-sdk.dev/docs/ai-sdk-core/tools#bash-tool) for more information.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { Experimental_SandboxSession, Tool, ToolExecuteFunction } from "ai";
2
2
  import { z } from "zod/v4";
3
3
  //#region src/bash-tool.d.ts
4
- type BashInput = z.infer<typeof inputSchema>;
5
- type BashOutput = z.infer<typeof outputSchema>;
6
4
  declare const inputSchema: z.ZodObject<{
7
5
  command: z.ZodString;
8
6
  }, z.core.$strip>;
@@ -11,6 +9,8 @@ declare const outputSchema: z.ZodObject<{
11
9
  stderr: z.ZodString;
12
10
  exitCode: z.ZodNumber;
13
11
  }, z.core.$strip>;
12
+ type BashInput = z.infer<typeof inputSchema>;
13
+ type BashOutput = z.infer<typeof outputSchema>;
14
14
  /**
15
15
  * Create a provider-independent bash tool backed by a supplied sandbox session.
16
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["SandboxSession"],"sources":["../src/bash-tool.ts"],"mappings":";;;KAUK,YAAY,EAAE,aAAa;KAE3B,aAAa,EAAE,aAAa;cAE3B,aAAW,EAAA;;GAEf,EAAA,KAAA;cAEI,cAAY,EAAA;;;;GAIhB,EAAA,KAAA;;;;;;;;;;;;;;;;iBAyBoB,iBACpB,SACA,kBACA,iBACA;EAEA,SAASA;EACT;EACA;EACA;IACE,QACF,KAAK,WAAW;EACd,SAAS,oBAAoB,WAAW"}
1
+ {"version":3,"file":"index.d.ts","names":["SandboxSession"],"sources":["../src/bash-tool.ts"],"mappings":";;;cAUM,aAAW,EAAA;;GAEf,EAAA,KAAA;cAEI,cAAY,EAAA;;;;GAIhB,EAAA,KAAA;KAEG,YAAY,EAAE,aAAa;KAE3B,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;;iBAyBX,iBACpB,SACA,kBACA,iBACA;EAEA,SAASA;EACT;EACA;EACA;IACE,QACF,KAAK,WAAW;EACd,SAAS,oBAAoB,WAAW"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/bash-tool.ts"],"sourcesContent":["import {\n InvalidArgumentError,\n tool,\n type Tool,\n type ToolExecuteFunction,\n type Experimental_SandboxSession as SandboxSession,\n} from 'ai';\nimport { posix } from 'node:path';\nimport { z } from 'zod/v4';\n\ntype BashInput = z.infer<typeof inputSchema>;\n\ntype BashOutput = z.infer<typeof outputSchema>;\n\nconst inputSchema = z.object({\n command: z.string().describe('The Bash command or script to execute.'),\n});\n\nconst outputSchema = z.object({\n stdout: z.string(),\n stderr: z.string(),\n exitCode: z.number(),\n});\n\nfunction limitOutput(output: string, maxLength: number): string {\n if (output.length <= maxLength) {\n return output;\n }\n\n return `${output.slice(0, maxLength)}\\n[Output truncated: ${output.length - maxLength} characters omitted.]`;\n}\n\n/**\n * Create a provider-independent bash tool backed by a supplied sandbox session.\n *\n * The caller owns the sandbox's lifecycle. Tools using the same session share\n * its files. Available commands and persistence depend on the sandbox.\n * Returns the tool; use the supplied sandbox for file access.\n *\n * @param sandbox - Sandbox session used for commands and file operations.\n * @param workingDirectory - Optional absolute starting directory for every\n * command, created if needed. When omitted, uses the sandbox's default directory.\n * @param maxOutputLength - Maximum characters retained from each output stream\n * before appending a truncation notice. Defaults to 30,000.\n * @param timeout - Optional timeout in milliseconds for each command execution.\n * Cancellation is forwarded to the sandbox along with the caller's abort signal.\n */\nexport async function createBashTool({\n sandbox,\n workingDirectory,\n maxOutputLength = 30_000,\n timeout,\n}: {\n sandbox: SandboxSession;\n workingDirectory?: string;\n maxOutputLength?: number;\n timeout?: number;\n}): Promise<\n Tool<BashInput, BashOutput, {}> & {\n execute: ToolExecuteFunction<BashInput, BashOutput, {}>;\n }\n> {\n if (\n timeout !== undefined &&\n (!Number.isInteger(timeout) || timeout < 1 || timeout > 2_147_483_647)\n ) {\n throw new InvalidArgumentError({\n parameter: 'timeout',\n value: timeout,\n message: 'Must be an integer between 1 and 2147483647 milliseconds.',\n });\n }\n\n if (!Number.isSafeInteger(maxOutputLength) || maxOutputLength < 1) {\n throw new InvalidArgumentError({\n parameter: 'maxOutputLength',\n value: maxOutputLength,\n message: 'Must be a positive safe integer.',\n });\n }\n\n if (workingDirectory !== undefined && !posix.isAbsolute(workingDirectory)) {\n throw new InvalidArgumentError({\n parameter: 'workingDirectory',\n value: workingDirectory,\n message: 'Must be an absolute path in the sandbox.',\n });\n }\n\n if (workingDirectory !== undefined) {\n workingDirectory = posix.normalize(workingDirectory);\n }\n\n if (workingDirectory !== undefined) {\n const directoryResult = await sandbox.run({\n command: `mkdir -p -- '${workingDirectory.replace(/'/g, \"'\\\\''\")}'`,\n });\n if (directoryResult.exitCode !== 0) {\n throw new Error(\n `Failed to create working directory: ${directoryResult.stderr}`,\n );\n }\n }\n\n return tool<BashInput, BashOutput, {}>({\n description:\n 'Run Bash commands in the sandbox. ' +\n (workingDirectory !== undefined\n ? `Every command starts in ${workingDirectory}. `\n : \"Commands run in the sandbox's default working directory. \") +\n 'Use ls to discover files and commands such as cat, grep, sort, awk, ' +\n 'and jq to inspect and transform them. Pipes and redirections are supported. ' +\n 'Returns stdout, stderr, and exitCode; long output is truncated.\\n' +\n sandbox.description,\n inputSchema,\n outputSchema,\n execute: async ({ command }, { abortSignal }) => {\n const timeoutSignal =\n timeout === undefined ? undefined : AbortSignal.timeout(timeout);\n const commandSignal =\n timeoutSignal === undefined\n ? abortSignal\n : abortSignal === undefined\n ? timeoutSignal\n : AbortSignal.any([abortSignal, timeoutSignal]);\n\n const { stdout, stderr, exitCode } = await sandbox.run({\n command,\n ...(workingDirectory !== undefined ? { workingDirectory } : {}),\n abortSignal: commandSignal,\n });\n\n return {\n stdout: limitOutput(stdout, maxOutputLength),\n stderr: limitOutput(stderr, maxOutputLength),\n exitCode,\n };\n },\n });\n}\n"],"mappings":";;;;AAcA,MAAM,cAAc,EAAE,OAAO,EAC3B,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,wCAAwC,EACvE,CAAC;AAED,MAAM,eAAe,EAAE,OAAO;CAC5B,QAAQ,EAAE,OAAO;CACjB,QAAQ,EAAE,OAAO;CACjB,UAAU,EAAE,OAAO;AACrB,CAAC;AAED,SAAS,YAAY,QAAgB,WAA2B;CAC9D,IAAI,OAAO,UAAU,WACnB,OAAO;CAGT,OAAO,GAAG,OAAO,MAAM,GAAG,SAAS,EAAE,uBAAuB,OAAO,SAAS,UAAU;AACxF;;;;;;;;;;;;;;;;AAiBA,eAAsB,eAAe,EACnC,SACA,kBACA,kBAAkB,KAClB,WAUA;CACA,IACE,YAAY,KAAA,MACX,CAAC,OAAO,UAAU,OAAO,KAAK,UAAU,KAAK,UAAU,aAExD,MAAM,IAAI,qBAAqB;EAC7B,WAAW;EACX,OAAO;EACP,SAAS;CACX,CAAC;CAGH,IAAI,CAAC,OAAO,cAAc,eAAe,KAAK,kBAAkB,GAC9D,MAAM,IAAI,qBAAqB;EAC7B,WAAW;EACX,OAAO;EACP,SAAS;CACX,CAAC;CAGH,IAAI,qBAAqB,KAAA,KAAa,CAAC,MAAM,WAAW,gBAAgB,GACtE,MAAM,IAAI,qBAAqB;EAC7B,WAAW;EACX,OAAO;EACP,SAAS;CACX,CAAC;CAGH,IAAI,qBAAqB,KAAA,GACvB,mBAAmB,MAAM,UAAU,gBAAgB;CAGrD,IAAI,qBAAqB,KAAA,GAAW;EAClC,MAAM,kBAAkB,MAAM,QAAQ,IAAI,EACxC,SAAS,gBAAgB,iBAAiB,QAAQ,MAAM,OAAO,EAAE,GACnE,CAAC;EACD,IAAI,gBAAgB,aAAa,GAC/B,MAAM,IAAI,MACR,uCAAuC,gBAAgB,QACzD;CAEJ;CAEA,OAAO,KAAgC;EACrC,aACE,wCACC,qBAAqB,KAAA,IAClB,2BAA2B,iBAAiB,MAC5C,+DACJ,sNAGA,QAAQ;EACV;EACA;EACA,SAAS,OAAO,EAAE,WAAW,EAAE,kBAAkB;GAC/C,MAAM,gBACJ,YAAY,KAAA,IAAY,KAAA,IAAY,YAAY,QAAQ,OAAO;GACjE,MAAM,gBACJ,kBAAkB,KAAA,IACd,cACA,gBAAgB,KAAA,IACd,gBACA,YAAY,IAAI,CAAC,aAAa,aAAa,CAAC;GAEpD,MAAM,EAAE,QAAQ,QAAQ,aAAa,MAAM,QAAQ,IAAI;IACrD;IACA,GAAI,qBAAqB,KAAA,IAAY,EAAE,iBAAiB,IAAI,CAAC;IAC7D,aAAa;GACf,CAAC;GAED,OAAO;IACL,QAAQ,YAAY,QAAQ,eAAe;IAC3C,QAAQ,YAAY,QAAQ,eAAe;IAC3C;GACF;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/bash-tool.ts"],"sourcesContent":["import {\n InvalidArgumentError,\n tool,\n type Tool,\n type ToolExecuteFunction,\n type Experimental_SandboxSession as SandboxSession,\n} from 'ai';\nimport { posix } from 'node:path';\nimport { z } from 'zod/v4';\n\nconst inputSchema = z.object({\n command: z.string().describe('The Bash command or script to execute.'),\n});\n\nconst outputSchema = z.object({\n stdout: z.string(),\n stderr: z.string(),\n exitCode: z.number(),\n});\n\ntype BashInput = z.infer<typeof inputSchema>;\n\ntype BashOutput = z.infer<typeof outputSchema>;\n\nfunction limitOutput(output: string, maxLength: number): string {\n if (output.length <= maxLength) {\n return output;\n }\n\n return `${output.slice(0, maxLength)}\\n[Output truncated: ${output.length - maxLength} characters omitted.]`;\n}\n\n/**\n * Create a provider-independent bash tool backed by a supplied sandbox session.\n *\n * The caller owns the sandbox's lifecycle. Tools using the same session share\n * its files. Available commands and persistence depend on the sandbox.\n * Returns the tool; use the supplied sandbox for file access.\n *\n * @param sandbox - Sandbox session used for commands and file operations.\n * @param workingDirectory - Optional absolute starting directory for every\n * command, created if needed. When omitted, uses the sandbox's default directory.\n * @param maxOutputLength - Maximum characters retained from each output stream\n * before appending a truncation notice. Defaults to 30,000.\n * @param timeout - Optional timeout in milliseconds for each command execution.\n * Cancellation is forwarded to the sandbox along with the caller's abort signal.\n */\nexport async function createBashTool({\n sandbox,\n workingDirectory,\n maxOutputLength = 30_000,\n timeout,\n}: {\n sandbox: SandboxSession;\n workingDirectory?: string;\n maxOutputLength?: number;\n timeout?: number;\n}): Promise<\n Tool<BashInput, BashOutput, {}> & {\n execute: ToolExecuteFunction<BashInput, BashOutput, {}>;\n }\n> {\n if (\n timeout !== undefined &&\n (!Number.isInteger(timeout) || timeout < 1 || timeout > 2_147_483_647)\n ) {\n throw new InvalidArgumentError({\n parameter: 'timeout',\n value: timeout,\n message: 'Must be an integer between 1 and 2147483647 milliseconds.',\n });\n }\n\n if (!Number.isSafeInteger(maxOutputLength) || maxOutputLength < 1) {\n throw new InvalidArgumentError({\n parameter: 'maxOutputLength',\n value: maxOutputLength,\n message: 'Must be a positive safe integer.',\n });\n }\n\n if (workingDirectory !== undefined && !posix.isAbsolute(workingDirectory)) {\n throw new InvalidArgumentError({\n parameter: 'workingDirectory',\n value: workingDirectory,\n message: 'Must be an absolute path in the sandbox.',\n });\n }\n\n if (workingDirectory !== undefined) {\n workingDirectory = posix.normalize(workingDirectory);\n }\n\n if (workingDirectory !== undefined) {\n const directoryResult = await sandbox.run({\n command: `mkdir -p -- '${workingDirectory.replace(/'/g, \"'\\\\''\")}'`,\n });\n if (directoryResult.exitCode !== 0) {\n throw new Error(\n `Failed to create working directory: ${directoryResult.stderr}`,\n );\n }\n }\n\n return tool<BashInput, BashOutput, {}>({\n description:\n 'Run Bash commands in the sandbox. ' +\n (workingDirectory !== undefined\n ? `Every command starts in ${workingDirectory}. `\n : \"Commands run in the sandbox's default working directory. \") +\n 'Use ls to discover files and commands such as cat, grep, sort, awk, ' +\n 'and jq to inspect and transform them. Pipes and redirections are supported. ' +\n 'Returns stdout, stderr, and exitCode; long output is truncated.\\n' +\n sandbox.description,\n inputSchema,\n outputSchema,\n execute: async ({ command }, { abortSignal }) => {\n const timeoutSignal =\n timeout === undefined ? undefined : AbortSignal.timeout(timeout);\n const commandSignal =\n timeoutSignal === undefined\n ? abortSignal\n : abortSignal === undefined\n ? timeoutSignal\n : AbortSignal.any([abortSignal, timeoutSignal]);\n\n const { stdout, stderr, exitCode } = await sandbox.run({\n command,\n ...(workingDirectory !== undefined ? { workingDirectory } : {}),\n abortSignal: commandSignal,\n });\n\n return {\n stdout: limitOutput(stdout, maxOutputLength),\n stderr: limitOutput(stderr, maxOutputLength),\n exitCode,\n };\n },\n });\n}\n"],"mappings":";;;;AAUA,MAAM,cAAc,EAAE,OAAO,EAC3B,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,wCAAwC,EACvE,CAAC;AAED,MAAM,eAAe,EAAE,OAAO;CAC5B,QAAQ,EAAE,OAAO;CACjB,QAAQ,EAAE,OAAO;CACjB,UAAU,EAAE,OAAO;AACrB,CAAC;AAMD,SAAS,YAAY,QAAgB,WAA2B;CAC9D,IAAI,OAAO,UAAU,WACnB,OAAO;CAGT,OAAO,GAAG,OAAO,MAAM,GAAG,SAAS,EAAE,uBAAuB,OAAO,SAAS,UAAU;AACxF;;;;;;;;;;;;;;;;AAiBA,eAAsB,eAAe,EACnC,SACA,kBACA,kBAAkB,KAClB,WAUA;CACA,IACE,YAAY,KAAA,MACX,CAAC,OAAO,UAAU,OAAO,KAAK,UAAU,KAAK,UAAU,aAExD,MAAM,IAAI,qBAAqB;EAC7B,WAAW;EACX,OAAO;EACP,SAAS;CACX,CAAC;CAGH,IAAI,CAAC,OAAO,cAAc,eAAe,KAAK,kBAAkB,GAC9D,MAAM,IAAI,qBAAqB;EAC7B,WAAW;EACX,OAAO;EACP,SAAS;CACX,CAAC;CAGH,IAAI,qBAAqB,KAAA,KAAa,CAAC,MAAM,WAAW,gBAAgB,GACtE,MAAM,IAAI,qBAAqB;EAC7B,WAAW;EACX,OAAO;EACP,SAAS;CACX,CAAC;CAGH,IAAI,qBAAqB,KAAA,GACvB,mBAAmB,MAAM,UAAU,gBAAgB;CAGrD,IAAI,qBAAqB,KAAA,GAAW;EAClC,MAAM,kBAAkB,MAAM,QAAQ,IAAI,EACxC,SAAS,gBAAgB,iBAAiB,QAAQ,MAAM,OAAO,EAAE,GACnE,CAAC;EACD,IAAI,gBAAgB,aAAa,GAC/B,MAAM,IAAI,MACR,uCAAuC,gBAAgB,QACzD;CAEJ;CAEA,OAAO,KAAgC;EACrC,aACE,wCACC,qBAAqB,KAAA,IAClB,2BAA2B,iBAAiB,MAC5C,+DACJ,sNAGA,QAAQ;EACV;EACA;EACA,SAAS,OAAO,EAAE,WAAW,EAAE,kBAAkB;GAC/C,MAAM,gBACJ,YAAY,KAAA,IAAY,KAAA,IAAY,YAAY,QAAQ,OAAO;GACjE,MAAM,gBACJ,kBAAkB,KAAA,IACd,cACA,gBAAgB,KAAA,IACd,gBACA,YAAY,IAAI,CAAC,aAAa,aAAa,CAAC;GAEpD,MAAM,EAAE,QAAQ,QAAQ,aAAa,MAAM,QAAQ,IAAI;IACrD;IACA,GAAI,qBAAqB,KAAA,IAAY,EAAE,iBAAiB,IAAI,CAAC;IAC7D,aAAa;GACf,CAAC;GAED,OAAO;IACL,QAAQ,YAAY,QAAQ,eAAe;IAC3C,QAAQ,YAAY,QAAQ,eAAe;IAC3C;GACF;EACF;CACF,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/tool-bash",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Provider-independent bash tool for the AI SDK",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -28,15 +28,15 @@
28
28
  "zod": "3.25.76"
29
29
  },
30
30
  "peerDependencies": {
31
- "ai": "^7.0.152"
31
+ "ai": "^7.0.154"
32
32
  },
33
33
  "devDependencies": {
34
- "@ai-sdk/sandbox-just-bash": "1.0.163",
35
- "@ai-sdk/sandbox-vercel": "1.0.163",
34
+ "@ai-sdk/sandbox-just-bash": "1.0.165",
35
+ "@ai-sdk/sandbox-vercel": "1.0.165",
36
36
  "@types/node": "22.19.19",
37
37
  "@vercel/ai-tsconfig": "0.0.0",
38
38
  "@vercel/ai-tsdown-config": "0.0.0",
39
- "ai": "7.0.152",
39
+ "ai": "7.0.154",
40
40
  "tsdown": "^0.23.0",
41
41
  "typescript": "6.0.3"
42
42
  },
package/src/bash-tool.ts CHANGED
@@ -8,10 +8,6 @@ import {
8
8
  import { posix } from 'node:path';
9
9
  import { z } from 'zod/v4';
10
10
 
11
- type BashInput = z.infer<typeof inputSchema>;
12
-
13
- type BashOutput = z.infer<typeof outputSchema>;
14
-
15
11
  const inputSchema = z.object({
16
12
  command: z.string().describe('The Bash command or script to execute.'),
17
13
  });
@@ -22,6 +18,10 @@ const outputSchema = z.object({
22
18
  exitCode: z.number(),
23
19
  });
24
20
 
21
+ type BashInput = z.infer<typeof inputSchema>;
22
+
23
+ type BashOutput = z.infer<typeof outputSchema>;
24
+
25
25
  function limitOutput(output: string, maxLength: number): string {
26
26
  if (output.length <= maxLength) {
27
27
  return output;