bash-tool 1.0.2 → 1.2.0
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 +1 -1
- package/dist/AGENTS.md +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/sandbox/just-bash.d.ts +18 -3
- package/dist/sandbox/just-bash.d.ts.map +1 -1
- package/dist/sandbox/just-bash.js +4 -30
- package/dist/sandbox/just-bash.js.map +1 -1
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +21 -4
- package/dist/tool.js.map +1 -1
- package/dist/tools/bash.d.ts +2 -0
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +10 -3
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/read-file.d.ts +2 -0
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +4 -2
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/write-file.d.ts +3 -1
- package/dist/tools/write-file.d.ts.map +1 -1
- package/dist/tools/write-file.js +4 -2
- package/dist/tools/write-file.js.map +1 -1
- package/dist/tools-prompt.d.ts +59 -0
- package/dist/tools-prompt.d.ts.map +1 -0
- package/dist/tools-prompt.js +333 -0
- package/dist/tools-prompt.js.map +1 -0
- package/dist/types.d.ts +17 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ const { bash } = await createBashTool({
|
|
|
97
97
|
import { Sandbox } from "@vercel/sandbox";
|
|
98
98
|
|
|
99
99
|
const sandbox = await Sandbox.create();
|
|
100
|
-
// Files are written to
|
|
100
|
+
// Files are written to ./workspace by default
|
|
101
101
|
const { tools } = await createBashTool({
|
|
102
102
|
sandbox,
|
|
103
103
|
files: { "index.ts": "console.log('hello');" },
|
package/dist/AGENTS.md
CHANGED
|
@@ -38,7 +38,7 @@ const result = await agent.generate({
|
|
|
38
38
|
## Key Behaviors
|
|
39
39
|
|
|
40
40
|
1. **Default sandbox is just-bash** - Install `just-bash` or provide your own sandbox
|
|
41
|
-
2. **Working directory defaults to
|
|
41
|
+
2. **Working directory defaults to `./workspace`** - All files written relative to `destination`
|
|
42
42
|
3. **Files are written before tools are returned** - Sandbox is pre-populated
|
|
43
43
|
4. **Tool descriptions include file list** - LLM sees available files in bash tool description
|
|
44
44
|
5. **No `stop()` method** - Sandbox lifecycle is managed externally
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export type { JustBashLike } from "./sandbox/just-bash.js";
|
|
1
2
|
export { createBashTool } from "./tool.js";
|
|
2
|
-
export type {
|
|
3
|
+
export type { BashToolCategory, BashToolInfo, FileFormat, ToolPromptOptions, } from "./tools-prompt.js";
|
|
4
|
+
export { bashTools, createToolPrompt, detectFormat, discoverAvailableTools, getToolsByCategory, getToolsForFormat, toolsByFormat, } from "./tools-prompt.js";
|
|
5
|
+
export type { BashToolkit, CommandResult, CreateBashToolOptions, PromptOptions, Sandbox, VercelSandboxInstance, } from "./types.js";
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EACV,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,OAAO,EACP,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAO3C,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GACd,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Sandbox } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal interface for the just-bash methods we actually use.
|
|
4
|
+
* This allows proper typing without requiring the full class.
|
|
5
|
+
*/
|
|
6
|
+
export interface JustBashLike {
|
|
7
|
+
exec: (command: string) => Promise<{
|
|
8
|
+
stdout: string;
|
|
9
|
+
stderr: string;
|
|
10
|
+
exitCode: number;
|
|
11
|
+
}>;
|
|
12
|
+
fs: {
|
|
13
|
+
readFile: (path: string) => Promise<string>;
|
|
14
|
+
writeFile: (path: string, content: string) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
2
17
|
/**
|
|
3
18
|
* Options for creating a just-bash sandbox.
|
|
4
19
|
*/
|
|
@@ -16,9 +31,9 @@ export declare function createJustBashSandbox(options?: JustBashSandboxOptions):
|
|
|
16
31
|
/**
|
|
17
32
|
* Check if an object is a just-bash Bash instance using duck-typing.
|
|
18
33
|
*/
|
|
19
|
-
export declare function isJustBash(obj: unknown): obj is
|
|
34
|
+
export declare function isJustBash(obj: unknown): obj is JustBashLike;
|
|
20
35
|
/**
|
|
21
36
|
* Wraps a just-bash Bash instance to conform to our Sandbox interface.
|
|
22
37
|
*/
|
|
23
|
-
export declare function wrapJustBash(bashInstance:
|
|
38
|
+
export declare function wrapJustBash(bashInstance: JustBashLike): Sandbox;
|
|
24
39
|
//# sourceMappingURL=just-bash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"just-bash.d.ts","sourceRoot":"","sources":["../../src/sandbox/just-bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,
|
|
1
|
+
{"version":3,"file":"just-bash.d.ts","sourceRoot":"","sources":["../../src/sandbox/just-bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,aAAa,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,EAAE,EAAE;QACF,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5C,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAC7D,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,wBAAwB;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,YAAY,CAK5D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAmBhE"}
|
|
@@ -26,23 +26,10 @@ export async function createJustBashSandbox(options = {}) {
|
|
|
26
26
|
};
|
|
27
27
|
},
|
|
28
28
|
async readFile(filePath) {
|
|
29
|
-
|
|
30
|
-
if (result.exitCode !== 0) {
|
|
31
|
-
throw new Error(`Failed to read file: ${filePath}\n${result.stderr}`);
|
|
32
|
-
}
|
|
33
|
-
return result.stdout;
|
|
29
|
+
return bashEnv.fs.readFile(filePath);
|
|
34
30
|
},
|
|
35
31
|
async writeFile(filePath, content) {
|
|
36
|
-
|
|
37
|
-
const dir = filePath.substring(0, filePath.lastIndexOf("/"));
|
|
38
|
-
if (dir) {
|
|
39
|
-
await bashEnv.exec(`mkdir -p "${dir}"`);
|
|
40
|
-
}
|
|
41
|
-
// Write file using heredoc to handle special characters
|
|
42
|
-
const result = await bashEnv.exec(`cat > "${filePath}" << 'BASH_TOOL_EOF'\n${content}\nBASH_TOOL_EOF`);
|
|
43
|
-
if (result.exitCode !== 0) {
|
|
44
|
-
throw new Error(`Failed to write file: ${filePath}\n${result.stderr}`);
|
|
45
|
-
}
|
|
32
|
+
await bashEnv.fs.writeFile(filePath, content);
|
|
46
33
|
},
|
|
47
34
|
};
|
|
48
35
|
}
|
|
@@ -70,23 +57,10 @@ export function wrapJustBash(bashInstance) {
|
|
|
70
57
|
};
|
|
71
58
|
},
|
|
72
59
|
async readFile(filePath) {
|
|
73
|
-
|
|
74
|
-
if (result.exitCode !== 0) {
|
|
75
|
-
throw new Error(`Failed to read file: ${filePath}\n${result.stderr}`);
|
|
76
|
-
}
|
|
77
|
-
return result.stdout;
|
|
60
|
+
return bashInstance.fs.readFile(filePath);
|
|
78
61
|
},
|
|
79
62
|
async writeFile(filePath, content) {
|
|
80
|
-
|
|
81
|
-
const dir = filePath.substring(0, filePath.lastIndexOf("/"));
|
|
82
|
-
if (dir) {
|
|
83
|
-
await bashInstance.exec(`mkdir -p "${dir}"`);
|
|
84
|
-
}
|
|
85
|
-
// Write file using heredoc to handle special characters
|
|
86
|
-
const result = await bashInstance.exec(`cat > "${filePath}" << 'BASH_TOOL_EOF'\n${content}\nBASH_TOOL_EOF`);
|
|
87
|
-
if (result.exitCode !== 0) {
|
|
88
|
-
throw new Error(`Failed to write file: ${filePath}\n${result.stderr}`);
|
|
89
|
-
}
|
|
63
|
+
await bashInstance.fs.writeFile(filePath, content);
|
|
90
64
|
},
|
|
91
65
|
};
|
|
92
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"just-bash.js","sourceRoot":"","sources":["../../src/sandbox/just-bash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"just-bash.js","sourceRoot":"","sources":["../../src/sandbox/just-bash.ts"],"names":[],"mappings":"AA4BA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,UAAkC,EAAE;IAEpC,oDAAoD;IACpD,IAAI,IAAqC,CAAC;IAC1C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;QACzC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,gIAAgI,CACjI,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,CAAC,cAAc,CAAC,OAAe;YAClC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO;gBACL,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D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAW,MAAM,YAAY,CAAC;AAK9E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,cAAc,CAClC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,WAAW,CAAC,CA4EtB"}
|
package/dist/tool.js
CHANGED
|
@@ -5,7 +5,9 @@ import { isVercelSandbox, wrapVercelSandbox } from "./sandbox/vercel.js";
|
|
|
5
5
|
import { createBashExecuteTool } from "./tools/bash.js";
|
|
6
6
|
import { createReadFileTool } from "./tools/read-file.js";
|
|
7
7
|
import { createWriteFileTool } from "./tools/write-file.js";
|
|
8
|
+
import { createToolPrompt } from "./tools-prompt.js";
|
|
8
9
|
const DEFAULT_DESTINATION = "/workspace";
|
|
10
|
+
const VERCEL_SANDBOX_DESTINATION = "/vercel/sandbox/workspace";
|
|
9
11
|
/**
|
|
10
12
|
* Creates a bash tool with tools for AI agents.
|
|
11
13
|
*
|
|
@@ -33,7 +35,11 @@ const DEFAULT_DESTINATION = "/workspace";
|
|
|
33
35
|
* ```
|
|
34
36
|
*/
|
|
35
37
|
export async function createBashTool(options = {}) {
|
|
36
|
-
|
|
38
|
+
// Determine default destination based on sandbox type
|
|
39
|
+
const defaultDestination = options.sandbox && isVercelSandbox(options.sandbox)
|
|
40
|
+
? VERCEL_SANDBOX_DESTINATION
|
|
41
|
+
: DEFAULT_DESTINATION;
|
|
42
|
+
const destination = options.destination ?? defaultDestination;
|
|
37
43
|
// 1. Load files from disk and/or inline
|
|
38
44
|
const loadedFiles = await loadFiles({
|
|
39
45
|
files: options.files,
|
|
@@ -47,6 +53,7 @@ export async function createBashTool(options = {}) {
|
|
|
47
53
|
}
|
|
48
54
|
// 3. Create or wrap sandbox
|
|
49
55
|
let sandbox;
|
|
56
|
+
let usingJustBash = false;
|
|
50
57
|
if (options.sandbox) {
|
|
51
58
|
// Check @vercel/sandbox first (more specific check)
|
|
52
59
|
if (isVercelSandbox(options.sandbox)) {
|
|
@@ -54,6 +61,7 @@ export async function createBashTool(options = {}) {
|
|
|
54
61
|
}
|
|
55
62
|
else if (isJustBash(options.sandbox)) {
|
|
56
63
|
sandbox = wrapJustBash(options.sandbox);
|
|
64
|
+
usingJustBash = true;
|
|
57
65
|
}
|
|
58
66
|
else {
|
|
59
67
|
sandbox = options.sandbox;
|
|
@@ -69,21 +77,30 @@ export async function createBashTool(options = {}) {
|
|
|
69
77
|
files: filesWithDestination,
|
|
70
78
|
cwd: destination,
|
|
71
79
|
});
|
|
80
|
+
usingJustBash = true;
|
|
72
81
|
}
|
|
73
|
-
// 4.
|
|
82
|
+
// 4. Discover available tools and generate prompt
|
|
74
83
|
const fileList = Object.keys(loadedFiles);
|
|
84
|
+
const toolPrompt = await createToolPrompt({
|
|
85
|
+
sandbox,
|
|
86
|
+
filenames: fileList,
|
|
87
|
+
isJustBash: usingJustBash,
|
|
88
|
+
toolPrompt: options.promptOptions?.toolPrompt,
|
|
89
|
+
});
|
|
90
|
+
// 5. Create tools
|
|
75
91
|
const bash = createBashExecuteTool({
|
|
76
92
|
sandbox,
|
|
77
93
|
cwd: destination,
|
|
78
94
|
files: fileList,
|
|
95
|
+
toolPrompt,
|
|
79
96
|
extraInstructions: options.extraInstructions,
|
|
80
97
|
onBeforeBashCall: options.onBeforeBashCall,
|
|
81
98
|
onAfterBashCall: options.onAfterBashCall,
|
|
82
99
|
});
|
|
83
100
|
const tools = {
|
|
84
101
|
bash,
|
|
85
|
-
readFile: createReadFileTool({ sandbox }),
|
|
86
|
-
writeFile: createWriteFileTool({ sandbox }),
|
|
102
|
+
readFile: createReadFileTool({ sandbox, cwd: destination }),
|
|
103
|
+
writeFile: createWriteFileTool({ sandbox, cwd: destination }),
|
|
87
104
|
};
|
|
88
105
|
return { bash, tools, sandbox };
|
|
89
106
|
}
|
package/dist/tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,mBAAmB,GAAG,YAAY,CAAC;AACzC,MAAM,0BAA0B,GAAG,2BAA2B,CAAC;AAE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
|
package/dist/tools/bash.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface CreateBashToolOptions {
|
|
|
6
6
|
/** List of file paths available in the sandbox (relative to cwd) */
|
|
7
7
|
files?: string[];
|
|
8
8
|
extraInstructions?: string;
|
|
9
|
+
/** Auto-generated prompt describing available bash tools */
|
|
10
|
+
toolPrompt?: string;
|
|
9
11
|
/** Callback before command execution, can modify the command */
|
|
10
12
|
onBeforeBashCall?: (input: BeforeBashCallInput) => BeforeBashCallOutput | undefined;
|
|
11
13
|
/** Callback after command execution, can modify the result */
|
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":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,OAAO,EACR,MAAM,aAAa,CAAC;AAMrB,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,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,mBAAmB,KACvB,oBAAoB,GAAG,SAAS,CAAC;IACtC,8DAA8D;IAC9D,eAAe,CAAC,EAAE,CAChB,KAAK,EAAE,kBAAkB,KACtB,mBAAmB,GAAG,SAAS,CAAC;CACtC;
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,OAAO,EACR,MAAM,aAAa,CAAC;AAMrB,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,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,mBAAmB,KACvB,oBAAoB,GAAG,SAAS,CAAC;IACtC,8DAA8D;IAC9D,eAAe,CAAC,EAAE,CAChB,KAAK,EAAE,kBAAkB,KACtB,mBAAmB,GAAG,SAAS,CAAC;CACtC;AAgDD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB;;wCAiCnE"}
|
package/dist/tools/bash.js
CHANGED
|
@@ -4,7 +4,7 @@ const bashSchema = z.object({
|
|
|
4
4
|
command: z.string().describe("The bash command to execute"),
|
|
5
5
|
});
|
|
6
6
|
function generateDescription(options) {
|
|
7
|
-
const { cwd, files, extraInstructions } = options;
|
|
7
|
+
const { cwd, files, extraInstructions, toolPrompt } = options;
|
|
8
8
|
const lines = [
|
|
9
9
|
"Execute bash commands in the sandbox environment.",
|
|
10
10
|
"",
|
|
@@ -24,6 +24,11 @@ function generateDescription(options) {
|
|
|
24
24
|
}
|
|
25
25
|
lines.push("");
|
|
26
26
|
}
|
|
27
|
+
// Add available tools prompt if provided
|
|
28
|
+
if (toolPrompt) {
|
|
29
|
+
lines.push(toolPrompt);
|
|
30
|
+
lines.push("");
|
|
31
|
+
}
|
|
27
32
|
lines.push("Common operations:");
|
|
28
33
|
lines.push(" ls -la # List files with details");
|
|
29
34
|
lines.push(" find . -name '*.ts' # Find files by pattern");
|
|
@@ -37,7 +42,7 @@ function generateDescription(options) {
|
|
|
37
42
|
return lines.join("\n").trim();
|
|
38
43
|
}
|
|
39
44
|
export function createBashExecuteTool(options) {
|
|
40
|
-
const { sandbox, onBeforeBashCall, onAfterBashCall } = options;
|
|
45
|
+
const { sandbox, cwd, onBeforeBashCall, onAfterBashCall } = options;
|
|
41
46
|
return tool({
|
|
42
47
|
description: generateDescription(options),
|
|
43
48
|
inputSchema: bashSchema,
|
|
@@ -50,8 +55,10 @@ export function createBashExecuteTool(options) {
|
|
|
50
55
|
command = beforeResult.command;
|
|
51
56
|
}
|
|
52
57
|
}
|
|
58
|
+
// Prepend cd to ensure commands run in the working directory
|
|
59
|
+
const fullCommand = `cd "${cwd}" && ${command}`;
|
|
53
60
|
// Execute the command
|
|
54
|
-
let result = await sandbox.executeCommand(
|
|
61
|
+
let result = await sandbox.executeCommand(fullCommand);
|
|
55
62
|
// Allow modification of result after execution
|
|
56
63
|
if (onAfterBashCall) {
|
|
57
64
|
const afterResult = onAfterBashCall({ command, result });
|
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;AASxB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC5D,CAAC,CAAC;
|
|
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;AASxB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC5D,CAAC,CAAC;AAqBH,SAAS,mBAAmB,CAAC,OAA8B;IACzD,MAAM,EAAE,GAAG,EAAE,KAAK,E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
|
1
1
|
import type { Sandbox } from "../types.js";
|
|
2
2
|
export interface CreateReadFileToolOptions {
|
|
3
3
|
sandbox: Sandbox;
|
|
4
|
+
/** Working directory for resolving relative paths */
|
|
5
|
+
cwd: string;
|
|
4
6
|
}
|
|
5
7
|
export declare function createReadFileTool(options: CreateReadFileToolOptions): import("ai").Tool<{
|
|
6
8
|
path: string;
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAM3C,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB;;;;GAYpE"}
|
package/dist/tools/read-file.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import nodePath from "node:path";
|
|
1
2
|
import { tool } from "ai";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const readFileSchema = z.object({
|
|
4
5
|
path: z.string().describe("The path to the file to read"),
|
|
5
6
|
});
|
|
6
7
|
export function createReadFileTool(options) {
|
|
7
|
-
const { sandbox } = options;
|
|
8
|
+
const { sandbox, cwd } = options;
|
|
8
9
|
return tool({
|
|
9
10
|
description: "Read the contents of a file from the sandbox.",
|
|
10
11
|
inputSchema: readFileSchema,
|
|
11
12
|
execute: async ({ path }) => {
|
|
12
|
-
const
|
|
13
|
+
const resolvedPath = nodePath.posix.resolve(cwd, path);
|
|
14
|
+
const content = await sandbox.readFile(resolvedPath);
|
|
13
15
|
return { content };
|
|
14
16
|
},
|
|
15
17
|
});
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../src/tools/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,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;AAQH,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEjC,OAAO,IAAI,CAAC;QACV,WAAW,EAAE,+CAA+C;QAC5D,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC1B,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACvD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACrD,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Sandbox } from "../types.js";
|
|
2
2
|
export interface CreateWriteFileToolOptions {
|
|
3
3
|
sandbox: Sandbox;
|
|
4
|
+
/** Working directory for resolving relative paths */
|
|
5
|
+
cwd: string;
|
|
4
6
|
}
|
|
5
7
|
export declare function createWriteFileTool(options: CreateWriteFileToolOptions): import("ai").Tool<{
|
|
6
|
-
content: string;
|
|
7
8
|
path: string;
|
|
9
|
+
content: string;
|
|
8
10
|
}, {
|
|
9
11
|
success: boolean;
|
|
10
12
|
}>;
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAO3C,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;;;;;GAatE"}
|
package/dist/tools/write-file.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import nodePath from "node:path";
|
|
1
2
|
import { tool } from "ai";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
const writeFileSchema = z.object({
|
|
@@ -5,12 +6,13 @@ const writeFileSchema = z.object({
|
|
|
5
6
|
content: z.string().describe("The content to write to the file"),
|
|
6
7
|
});
|
|
7
8
|
export function createWriteFileTool(options) {
|
|
8
|
-
const { sandbox } = options;
|
|
9
|
+
const { sandbox, cwd } = options;
|
|
9
10
|
return tool({
|
|
10
11
|
description: "Write content to a file in the sandbox. Creates parent directories if needed.",
|
|
11
12
|
inputSchema: writeFileSchema,
|
|
12
13
|
execute: async ({ path, content }) => {
|
|
13
|
-
|
|
14
|
+
const resolvedPath = nodePath.posix.resolve(cwd, path);
|
|
15
|
+
await sandbox.writeFile(resolvedPath, content);
|
|
14
16
|
return { success: true };
|
|
15
17
|
},
|
|
16
18
|
});
|
|
@@ -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,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACtE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CACjE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../src/tools/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACtE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CACjE,CAAC,CAAC;AAQH,MAAM,UAAU,mBAAmB,CAAC,OAAmC;IACrE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEjC,OAAO,IAAI,CAAC;QACV,WAAW,EACT,+EAA+E;QACjF,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;YACnC,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACvD,MAAM,OAAO,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Sandbox } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Common bash tools for text processing used by AI agents.
|
|
4
|
+
*/
|
|
5
|
+
export interface BashToolInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
purpose: string;
|
|
8
|
+
category: BashToolCategory;
|
|
9
|
+
}
|
|
10
|
+
export type BashToolCategory = "search" | "transform" | "view" | "organize" | "compare" | "count-format" | "structured-data" | "network" | "utilities";
|
|
11
|
+
export type FileFormat = "json" | "yaml" | "html" | "xml" | "csv" | "toml" | "ini" | "binary" | "text";
|
|
12
|
+
export declare const bashTools: BashToolInfo[];
|
|
13
|
+
/**
|
|
14
|
+
* Maps file formats to the bash tools most useful for processing them.
|
|
15
|
+
*/
|
|
16
|
+
export declare const toolsByFormat: Record<FileFormat, string[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Get tools by category.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getToolsByCategory(category: BashToolCategory): BashToolInfo[];
|
|
21
|
+
/**
|
|
22
|
+
* Get tools suitable for a specific file format.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getToolsForFormat(format: FileFormat): BashToolInfo[];
|
|
25
|
+
/**
|
|
26
|
+
* Detect file format from filename.
|
|
27
|
+
*/
|
|
28
|
+
export declare function detectFormat(filename: string): FileFormat | null;
|
|
29
|
+
/**
|
|
30
|
+
* Discover available bash tools by checking bin directories.
|
|
31
|
+
*/
|
|
32
|
+
export declare function discoverAvailableTools(sandbox: Sandbox): Promise<Set<string>>;
|
|
33
|
+
export interface ToolPromptOptions {
|
|
34
|
+
/** The sandbox to check for available tools */
|
|
35
|
+
sandbox: Sandbox;
|
|
36
|
+
/** List of filenames to detect formats from */
|
|
37
|
+
filenames: string[];
|
|
38
|
+
/** Set to true if using just-bash sandbox (enables yq CSV support) */
|
|
39
|
+
isJustBash?: boolean;
|
|
40
|
+
/** Custom tool prompt. If provided, skips tool discovery and returns this value. */
|
|
41
|
+
toolPrompt?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates a prompt describing available bash tools and format-specific tools.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const prompt = await createToolPrompt({
|
|
49
|
+
* sandbox,
|
|
50
|
+
* filenames: ["data.json", "config.yaml", "readme.md"]
|
|
51
|
+
* });
|
|
52
|
+
* // Returns something like:
|
|
53
|
+
* // "Available tools: cat, grep, sed, awk, head, tail, sort, jq, yq, ...
|
|
54
|
+
* // For JSON files: jq
|
|
55
|
+
* // For YAML files: yq"
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function createToolPrompt(options: ToolPromptOptions): Promise<string>;
|
|
59
|
+
//# sourceMappingURL=tools-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-prompt.d.ts","sourceRoot":"","sources":["../src/tools-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,WAAW,GACX,MAAM,GACN,UAAU,GACV,SAAS,GACT,cAAc,GACd,iBAAiB,GACjB,SAAS,GACT,WAAW,CAAC;AAEhB,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,MAAM,CAAC;AAEX,eAAO,MAAM,SAAS,EAAE,YAAY,EAuJnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,CA4CtD,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAE7E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY,EAAE,CAGpE;AA6BD;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAGhE;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAqBtB;AAED,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sEAAsE;IACtE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,CA4DjB"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
export const bashTools = [
|
|
2
|
+
{
|
|
3
|
+
name: "grep",
|
|
4
|
+
purpose: "Pattern matching and searching (regex support)",
|
|
5
|
+
category: "search",
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
name: "sed",
|
|
9
|
+
purpose: "Stream editor for substitution and transformation",
|
|
10
|
+
category: "transform",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "awk",
|
|
14
|
+
purpose: "Field-based processing and pattern scanning",
|
|
15
|
+
category: "transform",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "cat",
|
|
19
|
+
purpose: "Concatenate and display file contents",
|
|
20
|
+
category: "view",
|
|
21
|
+
},
|
|
22
|
+
{ name: "head", purpose: "View first N lines of a file", category: "view" },
|
|
23
|
+
{
|
|
24
|
+
name: "tail",
|
|
25
|
+
purpose: "View last N lines (also follow logs with -f)",
|
|
26
|
+
category: "view",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "sort",
|
|
30
|
+
purpose: "Sort lines alphabetically/numerically",
|
|
31
|
+
category: "organize",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "uniq",
|
|
35
|
+
purpose: "Remove duplicates or count occurrences",
|
|
36
|
+
category: "organize",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "cut",
|
|
40
|
+
purpose: "Extract columns/fields by delimiter",
|
|
41
|
+
category: "organize",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "tr",
|
|
45
|
+
purpose: "Translate, squeeze, or delete characters",
|
|
46
|
+
category: "transform",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "wc",
|
|
50
|
+
purpose: "Count lines, words, characters",
|
|
51
|
+
category: "count-format",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "find",
|
|
55
|
+
purpose: "Locate files (often piped to text tools)",
|
|
56
|
+
category: "search",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "xargs",
|
|
60
|
+
purpose: "Build commands from stdin",
|
|
61
|
+
category: "utilities",
|
|
62
|
+
},
|
|
63
|
+
{ name: "diff", purpose: "Compare files line by line", category: "compare" },
|
|
64
|
+
{
|
|
65
|
+
name: "jq",
|
|
66
|
+
purpose: "Parse and manipulate JSON",
|
|
67
|
+
category: "structured-data",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "yq",
|
|
71
|
+
purpose: "Parse and manipulate YAML, XML, TOML, INI (mikefarah/yq); CSV in just-bash",
|
|
72
|
+
category: "structured-data",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "tee",
|
|
76
|
+
purpose: "Split output to file and stdout",
|
|
77
|
+
category: "utilities",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "paste",
|
|
81
|
+
purpose: "Merge lines from multiple files",
|
|
82
|
+
category: "organize",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "column",
|
|
86
|
+
purpose: "Format text into aligned columns",
|
|
87
|
+
category: "count-format",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "printf",
|
|
91
|
+
purpose: "Formatted output with precise control",
|
|
92
|
+
category: "count-format",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "comm",
|
|
96
|
+
purpose: "Compare two sorted files (common/unique lines)",
|
|
97
|
+
category: "compare",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "rev",
|
|
101
|
+
purpose: "Reverse characters in each line",
|
|
102
|
+
category: "transform",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "fold",
|
|
106
|
+
purpose: "Wrap lines to specified width",
|
|
107
|
+
category: "count-format",
|
|
108
|
+
},
|
|
109
|
+
{ name: "nl", purpose: "Number lines in output", category: "count-format" },
|
|
110
|
+
{
|
|
111
|
+
name: "split",
|
|
112
|
+
purpose: "Split file into smaller pieces",
|
|
113
|
+
category: "organize",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "join",
|
|
117
|
+
purpose: "SQL-like join on sorted files",
|
|
118
|
+
category: "organize",
|
|
119
|
+
},
|
|
120
|
+
{ name: "expand", purpose: "Convert tabs to spaces", category: "transform" },
|
|
121
|
+
{
|
|
122
|
+
name: "unexpand",
|
|
123
|
+
purpose: "Convert spaces to tabs",
|
|
124
|
+
category: "transform",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "strings",
|
|
128
|
+
purpose: "Extract printable strings from binaries",
|
|
129
|
+
category: "view",
|
|
130
|
+
},
|
|
131
|
+
{ name: "od", purpose: "Octal dump for binary inspection", category: "view" },
|
|
132
|
+
{ name: "xxd", purpose: "Hex dump for binary inspection", category: "view" },
|
|
133
|
+
{
|
|
134
|
+
name: "iconv",
|
|
135
|
+
purpose: "Convert between character encodings",
|
|
136
|
+
category: "transform",
|
|
137
|
+
},
|
|
138
|
+
{ name: "curl", purpose: "Fetch content from URLs", category: "network" },
|
|
139
|
+
{
|
|
140
|
+
name: "html-to-markdown",
|
|
141
|
+
purpose: "Convert HTML to markdown (just-bash)",
|
|
142
|
+
category: "transform",
|
|
143
|
+
},
|
|
144
|
+
{ name: "node", purpose: "JavaScript runtime", category: "utilities" },
|
|
145
|
+
{ name: "python", purpose: "Python interpreter", category: "utilities" },
|
|
146
|
+
{
|
|
147
|
+
name: "xan",
|
|
148
|
+
purpose: "Fast CSV processing, filtering, aggregation, and visualization",
|
|
149
|
+
category: "structured-data",
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
/**
|
|
153
|
+
* Maps file formats to the bash tools most useful for processing them.
|
|
154
|
+
*/
|
|
155
|
+
export const toolsByFormat = {
|
|
156
|
+
json: ["jq", "grep", "sed", "cat", "head", "tail"],
|
|
157
|
+
yaml: ["yq", "grep", "sed", "cat", "head", "tail"],
|
|
158
|
+
html: ["html-to-markdown", "grep", "sed", "curl", "cat"],
|
|
159
|
+
xml: ["yq", "grep", "sed", "awk", "cat", "head", "tail"],
|
|
160
|
+
csv: [
|
|
161
|
+
"xan",
|
|
162
|
+
"awk",
|
|
163
|
+
"cut",
|
|
164
|
+
"sort",
|
|
165
|
+
"uniq",
|
|
166
|
+
"join",
|
|
167
|
+
"paste",
|
|
168
|
+
"column",
|
|
169
|
+
"grep",
|
|
170
|
+
"sed",
|
|
171
|
+
"head",
|
|
172
|
+
"tail",
|
|
173
|
+
],
|
|
174
|
+
toml: ["yq", "grep", "sed", "cat", "head", "tail"],
|
|
175
|
+
ini: ["yq", "grep", "sed", "cat", "head", "tail"],
|
|
176
|
+
binary: ["strings", "od", "xxd", "head", "tail", "split"],
|
|
177
|
+
text: [
|
|
178
|
+
"grep",
|
|
179
|
+
"sed",
|
|
180
|
+
"awk",
|
|
181
|
+
"cat",
|
|
182
|
+
"head",
|
|
183
|
+
"tail",
|
|
184
|
+
"sort",
|
|
185
|
+
"uniq",
|
|
186
|
+
"cut",
|
|
187
|
+
"tr",
|
|
188
|
+
"wc",
|
|
189
|
+
"diff",
|
|
190
|
+
"comm",
|
|
191
|
+
"paste",
|
|
192
|
+
"join",
|
|
193
|
+
"column",
|
|
194
|
+
"fold",
|
|
195
|
+
"nl",
|
|
196
|
+
"rev",
|
|
197
|
+
"iconv",
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Get tools by category.
|
|
202
|
+
*/
|
|
203
|
+
export function getToolsByCategory(category) {
|
|
204
|
+
return bashTools.filter((tool) => tool.category === category);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get tools suitable for a specific file format.
|
|
208
|
+
*/
|
|
209
|
+
export function getToolsForFormat(format) {
|
|
210
|
+
const toolNames = toolsByFormat[format];
|
|
211
|
+
return bashTools.filter((tool) => toolNames.includes(tool.name));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* File extension to format mapping.
|
|
215
|
+
*/
|
|
216
|
+
const extensionToFormat = {
|
|
217
|
+
".json": "json",
|
|
218
|
+
".jsonl": "json",
|
|
219
|
+
".ndjson": "json",
|
|
220
|
+
".yaml": "yaml",
|
|
221
|
+
".yml": "yaml",
|
|
222
|
+
".html": "html",
|
|
223
|
+
".htm": "html",
|
|
224
|
+
".xml": "xml",
|
|
225
|
+
".svg": "xml",
|
|
226
|
+
".csv": "csv",
|
|
227
|
+
".tsv": "csv",
|
|
228
|
+
".toml": "toml",
|
|
229
|
+
".ini": "ini",
|
|
230
|
+
".cfg": "ini",
|
|
231
|
+
".conf": "ini",
|
|
232
|
+
".bin": "binary",
|
|
233
|
+
".exe": "binary",
|
|
234
|
+
".so": "binary",
|
|
235
|
+
".dylib": "binary",
|
|
236
|
+
".a": "binary",
|
|
237
|
+
".o": "binary",
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Detect file format from filename.
|
|
241
|
+
*/
|
|
242
|
+
export function detectFormat(filename) {
|
|
243
|
+
const ext = filename.slice(filename.lastIndexOf(".")).toLowerCase();
|
|
244
|
+
return extensionToFormat[ext] ?? null;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Discover available bash tools by checking bin directories.
|
|
248
|
+
*/
|
|
249
|
+
export async function discoverAvailableTools(sandbox) {
|
|
250
|
+
const availableTools = new Set();
|
|
251
|
+
const knownToolNames = new Set(bashTools.map((t) => t.name));
|
|
252
|
+
// List all bin directories in a single command
|
|
253
|
+
const result = await sandbox.executeCommand("ls /usr/bin /usr/local/bin /bin /sbin /usr/sbin 2>/dev/null");
|
|
254
|
+
if (result.exitCode === 0 || result.stdout) {
|
|
255
|
+
const tools = result.stdout.split("\n").filter(Boolean);
|
|
256
|
+
for (const tool of tools) {
|
|
257
|
+
// Skip directory headers (e.g., "/usr/bin:")
|
|
258
|
+
if (tool.endsWith(":"))
|
|
259
|
+
continue;
|
|
260
|
+
if (knownToolNames.has(tool)) {
|
|
261
|
+
availableTools.add(tool);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return availableTools;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Creates a prompt describing available bash tools and format-specific tools.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* const prompt = await createToolPrompt({
|
|
273
|
+
* sandbox,
|
|
274
|
+
* filenames: ["data.json", "config.yaml", "readme.md"]
|
|
275
|
+
* });
|
|
276
|
+
* // Returns something like:
|
|
277
|
+
* // "Available tools: cat, grep, sed, awk, head, tail, sort, jq, yq, ...
|
|
278
|
+
* // For JSON files: jq
|
|
279
|
+
* // For YAML files: yq"
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
export async function createToolPrompt(options) {
|
|
283
|
+
const { sandbox, filenames, isJustBash = false, toolPrompt } = options;
|
|
284
|
+
// Return custom toolPrompt if provided
|
|
285
|
+
if (toolPrompt !== undefined) {
|
|
286
|
+
return toolPrompt;
|
|
287
|
+
}
|
|
288
|
+
// Discover available tools
|
|
289
|
+
const availableTools = await discoverAvailableTools(sandbox);
|
|
290
|
+
if (availableTools.size === 0) {
|
|
291
|
+
return "";
|
|
292
|
+
}
|
|
293
|
+
// Build the main tools list (sorted alphabetically)
|
|
294
|
+
const sortedTools = [...availableTools].sort();
|
|
295
|
+
const lines = [
|
|
296
|
+
`Available tools: ${sortedTools.join(", ")}, and more`,
|
|
297
|
+
];
|
|
298
|
+
// Detect formats from filenames
|
|
299
|
+
const detectedFormats = new Set();
|
|
300
|
+
for (const filename of filenames) {
|
|
301
|
+
const format = detectFormat(filename);
|
|
302
|
+
if (format && format !== "text" && format !== "binary") {
|
|
303
|
+
detectedFormats.add(format);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// Add format-specific tool hints
|
|
307
|
+
const formatLabels = {
|
|
308
|
+
json: "JSON",
|
|
309
|
+
yaml: "YAML",
|
|
310
|
+
html: "HTML",
|
|
311
|
+
xml: "XML",
|
|
312
|
+
csv: "CSV/TSV",
|
|
313
|
+
toml: "TOML",
|
|
314
|
+
ini: "INI",
|
|
315
|
+
binary: "binary",
|
|
316
|
+
text: "text",
|
|
317
|
+
};
|
|
318
|
+
for (const format of detectedFormats) {
|
|
319
|
+
let formatToolNames = toolsByFormat[format];
|
|
320
|
+
// Add yq for CSV only in just-bash (where it has CSV support)
|
|
321
|
+
if (format === "csv" && isJustBash) {
|
|
322
|
+
formatToolNames = ["yq", ...formatToolNames];
|
|
323
|
+
}
|
|
324
|
+
const formatTools = formatToolNames.filter((t) => availableTools.has(t));
|
|
325
|
+
if (formatTools.length > 0) {
|
|
326
|
+
// Highlight the primary tool for this format
|
|
327
|
+
const primaryTools = formatTools.slice(0, 3).join(", ");
|
|
328
|
+
lines.push(`For ${formatLabels[format]}: ${primaryTools}`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return lines.join("\n");
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=tools-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-prompt.js","sourceRoot":"","sources":["../src/tools-prompt.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC;QACE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,gDAAgD;QACzD,QAAQ,EAAE,QAAQ;KACnB;IACD;QACE,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,mDAAmD;QAC5D,QAAQ,EAAE,WAAW;KACtB;IACD;QACE,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,6CAA6C;QACtD,QAAQ,EAAE,WAAW;KACtB;IACD;QACE,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,uCAAuC;QAChD,QAAQ,EAAE,MAAM;KACjB;IACD,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,8BAA8B,EAAE,QAAQ,EAAE,MAAM,EAAE;IAC3E;QACE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,8CAA8C;QACvD,QAAQ,EAAE,MAAM;KACjB;IACD;QACE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,uCAAuC;QAChD,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,wCAAwC;QACjD,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,qCAAqC;QAC9C,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,0CAA0C;QACnD,QAAQ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C7D,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Sandbox as VercelSandbox } from "@vercel/sandbox";
|
|
2
|
+
import type { JustBashLike } from "./sandbox/just-bash.js";
|
|
2
3
|
export interface CommandResult {
|
|
3
4
|
stdout: string;
|
|
4
5
|
stderr: string;
|
|
@@ -9,18 +10,6 @@ export interface Sandbox {
|
|
|
9
10
|
readFile(path: string): Promise<string>;
|
|
10
11
|
writeFile(path: string, content: string): Promise<void>;
|
|
11
12
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Duck-typed just-bash Bash instance.
|
|
14
|
-
* We detect this by checking for the exec method.
|
|
15
|
-
*/
|
|
16
|
-
export interface JustBashInstance {
|
|
17
|
-
exec: (command: string) => Promise<{
|
|
18
|
-
stdout: string;
|
|
19
|
-
stderr: string;
|
|
20
|
-
exitCode: number;
|
|
21
|
-
}>;
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
}
|
|
24
13
|
/**
|
|
25
14
|
* Input for onBeforeBashCall callback.
|
|
26
15
|
*/
|
|
@@ -53,12 +42,22 @@ export interface AfterBashCallOutput {
|
|
|
53
42
|
/** The (potentially modified) result */
|
|
54
43
|
result: CommandResult;
|
|
55
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for customizing the tool prompt generation.
|
|
47
|
+
*/
|
|
48
|
+
export interface PromptOptions {
|
|
49
|
+
/**
|
|
50
|
+
* Custom tool prompt to use instead of auto-generating one.
|
|
51
|
+
* When provided, skips tool discovery entirely.
|
|
52
|
+
*/
|
|
53
|
+
toolPrompt?: string;
|
|
54
|
+
}
|
|
56
55
|
export interface CreateBashToolOptions {
|
|
57
56
|
/**
|
|
58
57
|
* Destination directory on the sandbox for files.
|
|
59
58
|
* Both `files` and `uploadDirectory` are written relative to this.
|
|
60
59
|
* Also used as the working directory for commands.
|
|
61
|
-
* @default "
|
|
60
|
+
* @default "./workspace"
|
|
62
61
|
*/
|
|
63
62
|
destination?: string;
|
|
64
63
|
/**
|
|
@@ -84,11 +83,15 @@ export interface CreateBashToolOptions {
|
|
|
84
83
|
* Accepts a @vercel/sandbox instance, just-bash Bash instance,
|
|
85
84
|
* or any object implementing Sandbox.
|
|
86
85
|
*/
|
|
87
|
-
sandbox?: Sandbox | VercelSandbox |
|
|
86
|
+
sandbox?: Sandbox | VercelSandbox | JustBashLike;
|
|
88
87
|
/**
|
|
89
88
|
* Additional instructions to append to tool descriptions.
|
|
90
89
|
*/
|
|
91
90
|
extraInstructions?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Options for customizing the tool prompt generation.
|
|
93
|
+
*/
|
|
94
|
+
promptOptions?: PromptOptions;
|
|
92
95
|
/**
|
|
93
96
|
* Callback invoked before bash command execution.
|
|
94
97
|
* Can modify the command before it runs.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC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Ae,CAAC,EAAE,CAChB,KAAK,EAAE,kBAAkB,KACtB,mBAAmB,GAAG,SAAS,CAAC;CACtC;AAGD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,IAAI,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;IAC/C,kEAAkE;IAClE,KAAK,EAAE;QACL,IAAI,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;QAC/C,QAAQ,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;QAChD,SAAS,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;KACnD,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,YAAY,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0
|
|
6
|
+
"version": "1.2.0",
|
|
7
7
|
"description": "Generic bash tool for AI agents, compatible with AI SDK",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "dist/index.js",
|
|
@@ -68,11 +68,13 @@
|
|
|
68
68
|
"optional": true
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
+
"packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81",
|
|
71
72
|
"scripts": {
|
|
72
73
|
"build": "tsc -p tsconfig.build.json && sed '1,/^-->/d' AGENTS.npm.md > dist/AGENTS.md",
|
|
73
74
|
"typecheck": "tsc --noEmit",
|
|
74
|
-
"test": "vitest",
|
|
75
|
-
"test:run": "vitest run",
|
|
75
|
+
"test": "vitest --exclude 'src/tool.vercel.integration.test.ts'",
|
|
76
|
+
"test:run": "vitest run --exclude 'src/tool.vercel.integration.test.ts'",
|
|
77
|
+
"test:vercel": "vitest run src/tool.vercel.integration.test.ts",
|
|
76
78
|
"lint": "biome check .",
|
|
77
79
|
"lint:fix": "biome check --write .",
|
|
78
80
|
"format": "biome format --write .",
|