Package Exports
- @everruns/bashkit
- @everruns/bashkit/langchain
Readme
@everruns/bashkit
Sandboxed bash interpreter for JavaScript/TypeScript. Native NAPI-RS bindings to the bashkit Rust core.
Install
npm install @everruns/bashkitUsage
import { Bash, BashTool, getVersion } from '@everruns/bashkit';
// Basic usage
const bash = new Bash();
const result = bash.executeSync('echo "Hello, World!"');
console.log(result.stdout); // Hello, World!\n
// State persists between calls
bash.executeSync('X=42');
bash.executeSync('echo $X'); // stdout: 42\n
// With tool-contract metadata
const tool = new BashTool();
console.log(tool.name); // "bashkit"
console.log(tool.inputSchema()); // JSON schema for LLM tool-use
console.log(tool.description()); // Token-efficient tool description
console.log(tool.help()); // Markdown help document
console.log(tool.systemPrompt()); // Compact system prompt
const r = tool.executeSync('echo hello');
console.log(r.stdout); // hello\nAPI
Bash
Core interpreter with virtual filesystem.
new Bash(options?)— create instanceexecuteSync(commands)— run bash commands, returnsExecResultexecuteSyncOrThrow(commands)— run bash commands, throwsBashErroron non-zero exitreset()— clear state, preserve config
BashTool
Interpreter + tool-contract metadata.
- All
Bashmethods, plus: name— tool name ("bashkit")version— version stringshortDescription— one-linerdescription()— token-efficient tool descriptionhelp()— Markdown help documentsystemPrompt()— compact system prompt for LLM orchestrationinputSchema()— JSON input schemaoutputSchema()— JSON output schema
BashOptions
interface BashOptions {
username?: string;
hostname?: string;
maxCommands?: number;
maxLoopIterations?: number;
}ExecResult
interface ExecResult {
stdout: string;
stderr: string;
exit_code: number;
error?: string;
}Platform Support
| OS | Architecture |
|---|---|
| macOS | x86_64, aarch64 (Apple Silicon) |
| Linux | x86_64, aarch64 |
| Windows | x86_64 |
| WASM | wasm32-wasip1-threads |
License
MIT