bash-tool 0.1.1 → 0.1.4
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/README.md +17 -18
- package/dist/AGENTS.md +16 -9
- package/dist/tools/bash.d.ts +3 -12
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +1 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/read-file.d.ts +2 -13
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +1 -1
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/write-file.d.ts +2 -16
- package/dist/tools/write-file.d.ts.map +1 -1
- package/dist/tools/write-file.js +1 -1
- package/dist/tools/write-file.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,27 +14,24 @@ For full VM support, install `@vercel/sandbox` or another sandbox product instea
|
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
import { createBashTool } from "bash-tool";
|
|
17
|
-
import {
|
|
17
|
+
import { ToolLoopAgent, stepCountIs } from "ai";
|
|
18
18
|
|
|
19
|
-
const {
|
|
19
|
+
const { tools } = await createBashTool({
|
|
20
20
|
files: {
|
|
21
21
|
"src/index.ts": "export const hello = 'world';",
|
|
22
22
|
"package.json": '{"name": "my-project"}',
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
const result = await generateText({
|
|
26
|
+
const agent = new ToolLoopAgent({
|
|
28
27
|
model: yourModel,
|
|
29
|
-
tools
|
|
30
|
-
|
|
28
|
+
tools,
|
|
29
|
+
// Or use just the bash tool as tools: {bash: tools.bash}
|
|
30
|
+
stopWhen: stepCountIs(20),
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
model: yourModel,
|
|
36
|
-
tools,
|
|
37
|
-
prompt: "Generate a markdown table of shirt colors",
|
|
33
|
+
const result = await agent.generate({
|
|
34
|
+
prompt: "Analyze the project and create a summary report",
|
|
38
35
|
});
|
|
39
36
|
```
|
|
40
37
|
|
|
@@ -72,13 +69,13 @@ Use `Sandbox.get` to reconnect to an existing sandbox by ID:
|
|
|
72
69
|
import { Sandbox } from "@vercel/sandbox";
|
|
73
70
|
|
|
74
71
|
// First invocation: create sandbox and store the ID
|
|
75
|
-
const
|
|
76
|
-
const sandboxId =
|
|
72
|
+
const newSandbox = await Sandbox.create();
|
|
73
|
+
const sandboxId = newSandbox.sandboxId;
|
|
77
74
|
// Store sandboxId in database, session, or return to client
|
|
78
75
|
|
|
79
76
|
// Subsequent invocations: reconnect to existing sandbox
|
|
80
|
-
const
|
|
81
|
-
const { tools } = await createBashTool({ sandbox });
|
|
77
|
+
const existingSandbox = await Sandbox.get({ sandboxId });
|
|
78
|
+
const { tools } = await createBashTool({ sandbox: existingSandbox });
|
|
82
79
|
// All previous files and state are preserved
|
|
83
80
|
```
|
|
84
81
|
|
|
@@ -112,13 +109,15 @@ import { createBashTool, Sandbox } from "bash-tool";
|
|
|
112
109
|
|
|
113
110
|
const customSandbox: Sandbox = {
|
|
114
111
|
async executeCommand(command) {
|
|
115
|
-
//
|
|
112
|
+
// Your implementation here
|
|
113
|
+
return { stdout: "", stderr: "", exitCode: 0 };
|
|
116
114
|
},
|
|
117
115
|
async readFile(path) {
|
|
118
|
-
//
|
|
116
|
+
// Your implementation here
|
|
117
|
+
return "";
|
|
119
118
|
},
|
|
120
119
|
async writeFile(path, content) {
|
|
121
|
-
//
|
|
120
|
+
// Your implementation here
|
|
122
121
|
},
|
|
123
122
|
};
|
|
124
123
|
|
package/dist/AGENTS.md
CHANGED
|
@@ -14,18 +14,23 @@ Instructions for AI agents using bash-tool in projects.
|
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
import { createBashTool } from "bash-tool";
|
|
17
|
-
import {
|
|
17
|
+
import { ToolLoopAgent, stepCountIs } from "ai";
|
|
18
18
|
|
|
19
|
-
const {
|
|
19
|
+
const { tools } = await createBashTool({
|
|
20
20
|
files: {
|
|
21
21
|
"src/index.ts": "export const x = 1;",
|
|
22
22
|
"package.json": '{"name": "test"}',
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const agent = new ToolLoopAgent({
|
|
27
27
|
model,
|
|
28
|
-
tools
|
|
28
|
+
tools,
|
|
29
|
+
// Or use just the bash tool as tools: {bash: tools.bash}
|
|
30
|
+
stopWhen: stepCountIs(20),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const result = await agent.generate({
|
|
29
34
|
prompt: "List files in src/",
|
|
30
35
|
});
|
|
31
36
|
```
|
|
@@ -63,12 +68,12 @@ const { tools } = await createBashTool({ sandbox: vm });
|
|
|
63
68
|
import { Sandbox } from "@vercel/sandbox";
|
|
64
69
|
|
|
65
70
|
// First invocation: create and store sandboxId
|
|
66
|
-
const
|
|
67
|
-
const sandboxId =
|
|
71
|
+
const newSandbox = await Sandbox.create();
|
|
72
|
+
const sandboxId = newSandbox.sandboxId; // store this
|
|
68
73
|
|
|
69
74
|
// Later invocations: reconnect by ID
|
|
70
|
-
const
|
|
71
|
-
const { tools } = await createBashTool({ sandbox });
|
|
75
|
+
const existingSandbox = await Sandbox.get({ sandboxId });
|
|
76
|
+
const { tools } = await createBashTool({ sandbox: existingSandbox });
|
|
72
77
|
// Previous files and state preserved
|
|
73
78
|
```
|
|
74
79
|
|
|
@@ -100,7 +105,9 @@ const { bash } = await createBashTool({
|
|
|
100
105
|
## Error Handling
|
|
101
106
|
|
|
102
107
|
```typescript
|
|
103
|
-
const
|
|
108
|
+
const { tools, sandbox } = await createBashTool();
|
|
109
|
+
|
|
110
|
+
const result = await tools.bash.execute({ command: "ls /nonexistent" });
|
|
104
111
|
if (result.exitCode !== 0) {
|
|
105
112
|
console.error("Command failed:", result.stderr);
|
|
106
113
|
}
|
package/dist/tools/bash.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { CommandResult, Sandbox } from "../types.js";
|
|
1
|
+
import type { Sandbox } from "../types.js";
|
|
3
2
|
export interface CreateBashToolOptions {
|
|
4
3
|
sandbox: Sandbox;
|
|
5
4
|
/** Working directory for command execution */
|
|
@@ -9,15 +8,7 @@ export interface CreateBashToolOptions {
|
|
|
9
8
|
extraInstructions?: string;
|
|
10
9
|
onCall?: (toolName: string, args: unknown) => void;
|
|
11
10
|
}
|
|
12
|
-
export declare function createBashExecuteTool(options: CreateBashToolOptions): import("ai").Tool<
|
|
13
|
-
command: z.ZodString;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
export declare function createBashExecuteTool(options: CreateBashToolOptions): import("ai").Tool<{
|
|
15
12
|
command: string;
|
|
16
|
-
},
|
|
17
|
-
command: string;
|
|
18
|
-
}>, CommandResult> & {
|
|
19
|
-
execute: (args: {
|
|
20
|
-
command: string;
|
|
21
|
-
}, options: import("ai").ToolExecutionOptions) => PromiseLike<CommandResult>;
|
|
22
|
-
};
|
|
13
|
+
}, import("../types.js").CommandResult>;
|
|
23
14
|
//# sourceMappingURL=bash.d.ts.map
|
package/dist/tools/bash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAM3C,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AA0CD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB;;wCAWnE"}
|
package/dist/tools/bash.js
CHANGED
|
@@ -40,7 +40,7 @@ export function createBashExecuteTool(options) {
|
|
|
40
40
|
const { sandbox, onCall } = options;
|
|
41
41
|
return tool({
|
|
42
42
|
description: generateDescription(options),
|
|
43
|
-
|
|
43
|
+
inputSchema: bashSchema,
|
|
44
44
|
execute: async ({ command }) => {
|
|
45
45
|
onCall?.("bash", { command });
|
|
46
46
|
return sandbox.executeCommand(command);
|
package/dist/tools/bash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC5D,CAAC,CAAC;AAYH,SAAS,mBAAmB,CAAC,OAA8B;IACzD,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAElD,MAAM,KAAK,GAAa;QACtB,mDAAmD;QACnD,EAAE;QACF,sBAAsB,GAAG,EAAE;QAC3B,yEAAyE;QACzE,EAAE;KACH,CAAC;IAEF,iDAAiD;IACjD,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEtC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CA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AAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAA8B;IAClE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,OAAO,IAAI,CAAC;QACV,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC;QACzC,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9B,OAAO,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import type { Sandbox } from "../types.js";
|
|
3
2
|
export interface CreateReadFileToolOptions {
|
|
4
3
|
sandbox: Sandbox;
|
|
5
4
|
onCall?: (toolName: string, args: unknown) => void;
|
|
6
5
|
}
|
|
7
|
-
export declare function createReadFileTool(options: CreateReadFileToolOptions): import("ai").Tool<
|
|
8
|
-
path: z.ZodString;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
export declare function createReadFileTool(options: CreateReadFileToolOptions): import("ai").Tool<{
|
|
10
7
|
path: string;
|
|
11
8
|
}, {
|
|
12
|
-
path: string;
|
|
13
|
-
}>, {
|
|
14
9
|
content: string;
|
|
15
|
-
}
|
|
16
|
-
execute: (args: {
|
|
17
|
-
path: string;
|
|
18
|
-
}, options: import("ai").ToolExecutionOptions) => PromiseLike<{
|
|
19
|
-
content: string;
|
|
20
|
-
}>;
|
|
21
|
-
};
|
|
10
|
+
}>;
|
|
22
11
|
//# sourceMappingURL=read-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../src/tools/read-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../src/tools/read-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAM3C,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB;;;;GAYpE"}
|
package/dist/tools/read-file.js
CHANGED
|
@@ -7,7 +7,7 @@ export function createReadFileTool(options) {
|
|
|
7
7
|
const { sandbox, onCall } = options;
|
|
8
8
|
return tool({
|
|
9
9
|
description: "Read the contents of a file from the sandbox.",
|
|
10
|
-
|
|
10
|
+
inputSchema: readFileSchema,
|
|
11
11
|
execute: async ({ path }) => {
|
|
12
12
|
onCall?.("readFile", { path });
|
|
13
13
|
const content = await sandbox.readFile(path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../src/tools/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;CAC1D,CAAC,CAAC;AAOH,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,OAAO,IAAI,CAAC;QACV,WAAW,EAAE,+CAA+C;QAC5D,
|
|
1
|
+
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../src/tools/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;CAC1D,CAAC,CAAC;AAOH,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEpC,OAAO,IAAI,CAAC;QACV,WAAW,EAAE,+CAA+C;QAC5D,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC1B,MAAM,EAAE,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC7C,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import type { Sandbox } from "../types.js";
|
|
3
2
|
export interface CreateWriteFileToolOptions {
|
|
4
3
|
sandbox: Sandbox;
|
|
5
4
|
onCall?: (toolName: string, args: unknown) => void;
|
|
6
5
|
}
|
|
7
|
-
export declare function createWriteFileTool(options: CreateWriteFileToolOptions): import("ai").Tool<
|
|
8
|
-
path: z.ZodString;
|
|
9
|
-
content: z.ZodString;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
export declare function createWriteFileTool(options: CreateWriteFileToolOptions): import("ai").Tool<{
|
|
11
7
|
content: string;
|
|
12
8
|
path: string;
|
|
13
9
|
}, {
|
|
14
|
-
content: string;
|
|
15
|
-
path: string;
|
|
16
|
-
}>, {
|
|
17
10
|
success: boolean;
|
|
18
|
-
}
|
|
19
|
-
execute: (args: {
|
|
20
|
-
content: string;
|
|
21
|
-
path: string;
|
|
22
|
-
}, options: import("ai").ToolExecutionOptions) => PromiseLike<{
|
|
23
|
-
success: boolean;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
11
|
+
}>;
|
|
26
12
|
//# sourceMappingURL=write-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../src/tools/write-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../src/tools/write-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;;;;;GAatE"}
|
package/dist/tools/write-file.js
CHANGED
|
@@ -8,7 +8,7 @@ export function createWriteFileTool(options) {
|
|
|
8
8
|
const { sandbox, onCall } = options;
|
|
9
9
|
return tool({
|
|
10
10
|
description: "Write content to a file in the sandbox. Creates parent directories if needed.",
|
|
11
|
-
|
|
11
|
+
inputSchema: writeFileSchema,
|
|
12
12
|
execute: async ({ path, content }) => {
|
|
13
13
|
onCall?.("writeFile", { path, content });
|
|
14
14
|
await sandbox.writeFile(path, content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../src/tools/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MA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AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.4",
|
|
7
7
|
"description": "Generic bash tool for AI agents, compatible with AI SDK",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "dist/index.js",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"@biomejs/biome": "^2.3.11",
|
|
51
51
|
"@types/node": "^22.10.0",
|
|
52
52
|
"@vercel/sandbox": "^1.1.2",
|
|
53
|
-
"ai": "^
|
|
53
|
+
"ai": "^6.0.13",
|
|
54
54
|
"knip": "^5.80.0",
|
|
55
55
|
"typescript": "^5.7.0",
|
|
56
56
|
"vitest": "^2.1.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@vercel/sandbox": "*",
|
|
60
|
-
"ai": "^
|
|
60
|
+
"ai": "^6.0.0",
|
|
61
61
|
"just-bash": "*"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|