indusagi-coding-agent 0.1.25 → 0.1.26
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 +60 -0
- package/dist/cli/file-processor.js +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/types.d.ts +1 -3
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/task-session-manager.d.ts.map +1 -1
- package/dist/core/task-session-manager.js +1 -7
- package/dist/core/task-session-manager.js.map +1 -1
- package/dist/core/tools/bg-process.d.ts +1 -1
- package/dist/core/tools/index.d.ts +57 -50
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +89 -21
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/todo.d.ts +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +2 -2
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/package.json +3 -3
- package/dist/core/tools/bash.d.ts +0 -428
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js +0 -498
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/edit-diff.d.ts +0 -63
- package/dist/core/tools/edit-diff.d.ts.map +0 -1
- package/dist/core/tools/edit-diff.js +0 -243
- package/dist/core/tools/edit-diff.js.map +0 -1
- package/dist/core/tools/edit.d.ts +0 -315
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js +0 -384
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/find.d.ts +0 -201
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js +0 -342
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts +0 -323
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js +0 -486
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/ls.d.ts +0 -44
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/ls.js +0 -124
- package/dist/core/tools/ls.js.map +0 -1
- package/dist/core/tools/path-utils.d.ts +0 -8
- package/dist/core/tools/path-utils.d.ts.map +0 -1
- package/dist/core/tools/path-utils.js +0 -53
- package/dist/core/tools/path-utils.js.map +0 -1
- package/dist/core/tools/read.d.ts +0 -338
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js +0 -397
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/truncate.d.ts +0 -70
- package/dist/core/tools/truncate.d.ts.map +0 -1
- package/dist/core/tools/truncate.js +0 -205
- package/dist/core/tools/truncate.js.map +0 -1
- package/dist/core/tools/webfetch.d.ts +0 -174
- package/dist/core/tools/webfetch.d.ts.map +0 -1
- package/dist/core/tools/webfetch.js +0 -380
- package/dist/core/tools/webfetch.js.map +0 -1
- package/dist/core/tools/websearch.d.ts +0 -190
- package/dist/core/tools/websearch.d.ts.map +0 -1
- package/dist/core/tools/websearch.js +0 -267
- package/dist/core/tools/websearch.js.map +0 -1
- package/dist/core/tools/write.d.ts +0 -273
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js +0 -288
- package/dist/core/tools/write.js.map +0 -1
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bash Tool - Execute shell commands with streaming and timeout support
|
|
3
|
-
*
|
|
4
|
-
* @module core/tools/bash
|
|
5
|
-
* @description
|
|
6
|
-
* Implements the bash tool for the agent. Executes arbitrary bash commands
|
|
7
|
-
* in the specified working directory with support for:
|
|
8
|
-
* - Real-time output streaming via onUpdate callbacks
|
|
9
|
-
* - Timeout enforcement
|
|
10
|
-
* - Custom execution backends (SSH, containers)
|
|
11
|
-
*
|
|
12
|
-
* Based on Anthropic's Claude API tool definitions and bash execution patterns.
|
|
13
|
-
* Refactored for agent streaming and multi-backend execution.
|
|
14
|
-
* - Large output handling with temp files
|
|
15
|
-
* - Error exit code detection
|
|
16
|
-
*
|
|
17
|
-
* ## Tool Interface
|
|
18
|
-
*
|
|
19
|
-
* **Input Parameters:**
|
|
20
|
-
* - `command` (required): Bash command to execute
|
|
21
|
-
* - `timeout` (optional): Timeout in seconds (no default)
|
|
22
|
-
*
|
|
23
|
-
* **Output:**
|
|
24
|
-
* - Text content with command output
|
|
25
|
-
* - Tool details with truncation info and full output path
|
|
26
|
-
*
|
|
27
|
-
* **Error Behavior:**
|
|
28
|
-
* - Exit code !== 0 → Tool error (rejected)
|
|
29
|
-
* - Timeout → Tool error "Command timed out after N seconds"
|
|
30
|
-
* - Aborted → Tool error "Command aborted"
|
|
31
|
-
* - Other errors → Tool error with message
|
|
32
|
-
*
|
|
33
|
-
* ## Usage in Agent Loops
|
|
34
|
-
*
|
|
35
|
-
* The agent can use this tool to:
|
|
36
|
-
* - Run tests, builds, and deployments
|
|
37
|
-
* - Query system state (ls, git status, npm list, etc.)
|
|
38
|
-
* - Execute scripts and utilities
|
|
39
|
-
* - Validate changes
|
|
40
|
-
*
|
|
41
|
-
* Tool results are included in LLM context for further analysis.
|
|
42
|
-
*
|
|
43
|
-
* ## Security & Safety
|
|
44
|
-
*
|
|
45
|
-
* **No input validation:**
|
|
46
|
-
* - Commands are executed as-is (caller/LLM responsible for safety)
|
|
47
|
-
* - No command whitelisting or blocking
|
|
48
|
-
* - Caller can restrict via BashOperations interface
|
|
49
|
-
*
|
|
50
|
-
* **Execution isolation:**
|
|
51
|
-
* - Runs in separate process (shell process)
|
|
52
|
-
* - No access to parent's memory or file descriptors
|
|
53
|
-
* - Process killed on abort/timeout (kills children too)
|
|
54
|
-
*
|
|
55
|
-
* **Output safety:**
|
|
56
|
-
* - Large output written to temp files (not memory)
|
|
57
|
-
* - Output truncated tail (keeps last 100KB)
|
|
58
|
-
* - Temp files cleaned up by filesystem (caller responsibility)
|
|
59
|
-
*
|
|
60
|
-
* **Environment handling:**
|
|
61
|
-
* - Merges provided env vars with shell defaults
|
|
62
|
-
* - Caller responsible for filtering sensitive vars
|
|
63
|
-
* - Shell config resolved from system defaults
|
|
64
|
-
*
|
|
65
|
-
* ## Customization
|
|
66
|
-
*
|
|
67
|
-
* **Custom Execution Backend:**
|
|
68
|
-
* ```typescript
|
|
69
|
-
* const sshTool = createBashTool(cwd, {
|
|
70
|
-
* operations: {
|
|
71
|
-
* exec: async (cmd, cwd, opts) => {
|
|
72
|
-
* // SSH execution: ssh user@host "cd cwd && cmd"
|
|
73
|
-
* const { execSync } = require('child_process');
|
|
74
|
-
* // Stream output via opts.onData(buffer)
|
|
75
|
-
* return { exitCode: 0 };
|
|
76
|
-
* },
|
|
77
|
-
* },
|
|
78
|
-
* });
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* **Command Prefix:**
|
|
82
|
-
* ```typescript
|
|
83
|
-
* const aliasedTool = createBashTool(cwd, {
|
|
84
|
-
* commandPrefix: "shopt -s expand_aliases\n. ~/.bashrc",
|
|
85
|
-
* });
|
|
86
|
-
* // Now bash aliases will work
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* **Hook Integration:**
|
|
90
|
-
* ```typescript
|
|
91
|
-
* const toolWithHooks = createBashTool(cwd, {
|
|
92
|
-
* hookRunner: hooksRunner,
|
|
93
|
-
* });
|
|
94
|
-
* // Hooks can inject environment via shell.env hook
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* ## Output Handling
|
|
98
|
-
*
|
|
99
|
-
* **Small output (<50KB):**
|
|
100
|
-
* - Returned directly in tool response
|
|
101
|
-
* - Sent to LLM context immediately
|
|
102
|
-
*
|
|
103
|
-
* **Large output (>50KB):**
|
|
104
|
-
* - Written to temp file: `/tmp/indusagi-bash-<random>.log`
|
|
105
|
-
* - Tool response shows last 100KB with notice
|
|
106
|
-
* - Truncated: true in details
|
|
107
|
-
* - Agent can read full output from fullOutputPath
|
|
108
|
-
*
|
|
109
|
-
* **Very long lines (single line >30KB):**
|
|
110
|
-
* - Edge case: line longer than entire max output
|
|
111
|
-
* - Tool shows truncation notice
|
|
112
|
-
* - Full output still in temp file
|
|
113
|
-
*
|
|
114
|
-
* ## Performance
|
|
115
|
-
*
|
|
116
|
-
* - Output streamed via onUpdate callbacks (no buffering)
|
|
117
|
-
* - Large output written to disk (not memory)
|
|
118
|
-
* - Process stdout/stderr captured separately
|
|
119
|
-
* - Timeout checked per second (or per data chunk)
|
|
120
|
-
*
|
|
121
|
-
* ## Error Handling
|
|
122
|
-
*
|
|
123
|
-
* **Rejected with error message:**
|
|
124
|
-
* - Non-zero exit codes: "Command exited with code X"
|
|
125
|
-
* - Timeout: "Command timed out after X seconds"
|
|
126
|
-
* - Abort: "Command aborted"
|
|
127
|
-
* - Spawn errors: "ENOENT: command not found" etc.
|
|
128
|
-
*
|
|
129
|
-
* **Error recovery:**
|
|
130
|
-
* - Extensions can handle via tool.error hooks
|
|
131
|
-
* - Agent can suggest alternatives or retry
|
|
132
|
-
* - Partial output included in error message
|
|
133
|
-
*
|
|
134
|
-
* ## Examples
|
|
135
|
-
*
|
|
136
|
-
* ### Simple command
|
|
137
|
-
* ```typescript
|
|
138
|
-
* // Agent calls: bash {command: "echo hello"}
|
|
139
|
-
* // Output: "hello"
|
|
140
|
-
* ```
|
|
141
|
-
*
|
|
142
|
-
* ### With streaming
|
|
143
|
-
* ```typescript
|
|
144
|
-
* // Agent calls: bash {command: "npm test"}
|
|
145
|
-
* // onUpdate called repeatedly with partial output
|
|
146
|
-
* // Final result includes full output or temp file path
|
|
147
|
-
* ```
|
|
148
|
-
*
|
|
149
|
-
* ### With timeout
|
|
150
|
-
* ```typescript
|
|
151
|
-
* // Agent calls: bash {command: "sleep 100", timeout: 5}
|
|
152
|
-
* // After 5 seconds: rejected with "Command timed out after 5 seconds"
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* ## Attribution
|
|
156
|
-
*
|
|
157
|
-
* Based on: indusagi-agent bash tool
|
|
158
|
-
* Modifications:
|
|
159
|
-
* - Added streaming via onUpdate callbacks
|
|
160
|
-
* - Added temporary file handling for large output
|
|
161
|
-
* - Added hook runner integration
|
|
162
|
-
* - Improved error messages with context
|
|
163
|
-
* - Added custom operations interface for pluggability
|
|
164
|
-
*/
|
|
165
|
-
import type { AgentTool } from "indusagi/agent";
|
|
166
|
-
import type { HookRunner } from "../hooks/index.js";
|
|
167
|
-
import { type TruncationResult } from "./truncate.js";
|
|
168
|
-
/**
|
|
169
|
-
* JSON Schema for bash tool parameters
|
|
170
|
-
* @internal
|
|
171
|
-
*/
|
|
172
|
-
declare const bashSchema: import("@sinclair/typebox").TObject<{
|
|
173
|
-
command: import("@sinclair/typebox").TString;
|
|
174
|
-
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
175
|
-
}>;
|
|
176
|
-
/**
|
|
177
|
-
* Tool-specific details returned with bash execution results
|
|
178
|
-
*
|
|
179
|
-
* Used to communicate truncation status and full output location to extensions.
|
|
180
|
-
*/
|
|
181
|
-
export interface BashToolDetails {
|
|
182
|
-
/** Truncation information if output was too large */
|
|
183
|
-
truncation?: TruncationResult;
|
|
184
|
-
/** Path to temp file containing full output (only if truncated) */
|
|
185
|
-
fullOutputPath?: string;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Pluggable interface for bash command execution
|
|
189
|
-
*
|
|
190
|
-
* Allows custom implementations for:
|
|
191
|
-
* - Remote execution (SSH, containers, cloud VMs)
|
|
192
|
-
* - Sandboxing (seccomp, chroot, etc.)
|
|
193
|
-
* - Testing (mocked execution)
|
|
194
|
-
* - Custom runtimes
|
|
195
|
-
*
|
|
196
|
-
* Implementations must:
|
|
197
|
-
* 1. Call onData(buffer) as output becomes available
|
|
198
|
-
* 2. Respect AbortSignal for cancellation
|
|
199
|
-
* 3. Enforce timeout if provided
|
|
200
|
-
* 4. Return exit code (null if killed/timeout)
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* ```typescript
|
|
204
|
-
* const sshOps: BashOperations = {
|
|
205
|
-
* exec: async (cmd, cwd, opts) => {
|
|
206
|
-
* // Stream output via opts.onData()
|
|
207
|
-
* // Return exit code
|
|
208
|
-
* },
|
|
209
|
-
* };
|
|
210
|
-
*
|
|
211
|
-
* const tool = createBashTool(cwd, { operations: sshOps });
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
export interface BashOperations {
|
|
215
|
-
/**
|
|
216
|
-
* Execute a command with output streaming and timeout support
|
|
217
|
-
*
|
|
218
|
-
* **Responsibilities:**
|
|
219
|
-
* 1. Accept command and execution options
|
|
220
|
-
* 2. Stream output via onData callback as it becomes available
|
|
221
|
-
* 3. Respect AbortSignal for cancellation
|
|
222
|
-
* 4. Enforce timeout if provided
|
|
223
|
-
* 5. Kill/cleanup on timeout or abort
|
|
224
|
-
* 6. Return exit code or null if killed
|
|
225
|
-
*
|
|
226
|
-
* **Must NOT:**
|
|
227
|
-
* - Validate or filter commands
|
|
228
|
-
* - Change working directory before executing
|
|
229
|
-
* - Modify command arguments
|
|
230
|
-
* - Capture environment variables
|
|
231
|
-
*
|
|
232
|
-
* @param command - The bash command to execute (not validated)
|
|
233
|
-
* @param cwd - Working directory (must be validated by caller)
|
|
234
|
-
* @param options - Execution options:
|
|
235
|
-
* - onData: Callback called with output buffers as available
|
|
236
|
-
* - signal: AbortSignal for cancellation
|
|
237
|
-
* - timeout: Timeout in seconds (enforce or error)
|
|
238
|
-
* - env: Environment variables to merge
|
|
239
|
-
*
|
|
240
|
-
* @returns Promise<{ exitCode: number | null }>
|
|
241
|
-
* - exitCode: 0-255 on successful completion
|
|
242
|
-
* - null if process was killed (abort or timeout)
|
|
243
|
-
*
|
|
244
|
-
* @throws Error if:
|
|
245
|
-
* - Working directory doesn't exist
|
|
246
|
-
* - Process spawn fails (ENOENT, EPERM, etc.)
|
|
247
|
-
* - Other system errors
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* ```typescript
|
|
251
|
-
* // Local shell implementation
|
|
252
|
-
* exec: (cmd, cwd, opts) => {
|
|
253
|
-
* const child = spawn(shell, ['-c', cmd], { cwd });
|
|
254
|
-
* child.stdout.on('data', opts.onData);
|
|
255
|
-
* return promise that resolves with exit code;
|
|
256
|
-
* }
|
|
257
|
-
* ```
|
|
258
|
-
*/
|
|
259
|
-
exec: (command: string, cwd: string, options: {
|
|
260
|
-
/** Callback for streaming output buffers */
|
|
261
|
-
onData: (data: Buffer) => void;
|
|
262
|
-
/** AbortSignal for cancellation */
|
|
263
|
-
signal?: AbortSignal;
|
|
264
|
-
/** Timeout in seconds */
|
|
265
|
-
timeout?: number;
|
|
266
|
-
/** Environment variables to merge */
|
|
267
|
-
env?: NodeJS.ProcessEnv;
|
|
268
|
-
}) => Promise<{
|
|
269
|
-
exitCode: number | null;
|
|
270
|
-
}>;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Configuration options for the bash tool
|
|
274
|
-
*
|
|
275
|
-
* Allows customization of execution backend, command preprocessing, and hooks.
|
|
276
|
-
*/
|
|
277
|
-
export interface BashToolOptions {
|
|
278
|
-
/**
|
|
279
|
-
* Custom operations for command execution
|
|
280
|
-
*
|
|
281
|
-
* Default: Local system shell via spawn
|
|
282
|
-
* Custom: SSH, Docker, containers, mocked execution
|
|
283
|
-
*
|
|
284
|
-
* @example
|
|
285
|
-
* ```typescript
|
|
286
|
-
* const sshTool = createBashTool(cwd, {
|
|
287
|
-
* operations: {
|
|
288
|
-
* exec: (cmd, cwd, opts) => {
|
|
289
|
-
* // SSH over wire
|
|
290
|
-
* // Stream output via opts.onData
|
|
291
|
-
* // Return { exitCode }
|
|
292
|
-
* },
|
|
293
|
-
* },
|
|
294
|
-
* });
|
|
295
|
-
* ```
|
|
296
|
-
*/
|
|
297
|
-
operations?: BashOperations;
|
|
298
|
-
/**
|
|
299
|
-
* Command prefix prepended to every command
|
|
300
|
-
*
|
|
301
|
-
* Useful for:
|
|
302
|
-
* - Enabling bash options: "shopt -s expand_aliases"
|
|
303
|
-
* - Sourcing shell rc files: ". ~/.bashrc"
|
|
304
|
-
* - Setting default env vars: "export DEBUG=*"
|
|
305
|
-
* - Changing shell behavior
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* ```typescript
|
|
309
|
-
* const tool = createBashTool(cwd, {
|
|
310
|
-
* commandPrefix: "shopt -s expand_aliases\n. ~/.bashrc",
|
|
311
|
-
* });
|
|
312
|
-
* // User command "my-alias arg" becomes:
|
|
313
|
-
* // "shopt -s expand_aliases\n. ~/.bashrc\nmy-alias arg"
|
|
314
|
-
* ```
|
|
315
|
-
*/
|
|
316
|
-
commandPrefix?: string;
|
|
317
|
-
/**
|
|
318
|
-
* Hook runner for advanced customization
|
|
319
|
-
*
|
|
320
|
-
* Allows hooks to inject environment variables via "shell.env" hook.
|
|
321
|
-
* Hooks can modify environment before command execution.
|
|
322
|
-
*
|
|
323
|
-
* @example
|
|
324
|
-
* ```typescript
|
|
325
|
-
* hookRunner.onHook("shell.env", (ctx, { env }) => {
|
|
326
|
-
* env.CUSTOM_VAR = "value";
|
|
327
|
-
* return { env };
|
|
328
|
-
* });
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
hookRunner?: HookRunner;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Create a bash tool with custom configuration
|
|
335
|
-
*
|
|
336
|
-
* Creates an AgentTool that can execute bash commands. Supports:
|
|
337
|
-
* - Custom execution backends (local, SSH, containers)
|
|
338
|
-
* - Command preprocessing (aliases, initialization)
|
|
339
|
-
* - Hook integration (environment variable injection)
|
|
340
|
-
* - Streaming output and timeout enforcement
|
|
341
|
-
* - Large output handling with temp files
|
|
342
|
-
*
|
|
343
|
-
* **Tool Behavior:**
|
|
344
|
-
* - Commands execute in specified working directory
|
|
345
|
-
* - Output streamed via onUpdate callbacks
|
|
346
|
-
* - Large outputs written to temp files
|
|
347
|
-
* - Non-zero exit codes → Tool error
|
|
348
|
-
* - Timeout errors rejected with message
|
|
349
|
-
* - Abort signal triggers clean cancellation
|
|
350
|
-
*
|
|
351
|
-
* **Tool Parameters:**
|
|
352
|
-
* - `command` (required, string): Bash command to execute
|
|
353
|
-
* - `timeout` (optional, number): Timeout in seconds
|
|
354
|
-
*
|
|
355
|
-
* **Tool Output:**
|
|
356
|
-
* - Text: Command output (last 100KB if truncated)
|
|
357
|
-
* - Details: Truncation info and temp file path
|
|
358
|
-
*
|
|
359
|
-
* @param cwd - Working directory for command execution
|
|
360
|
-
* - Must exist and be readable
|
|
361
|
-
* - Commands execute with this as working directory
|
|
362
|
-
* - Can be overridden per execution
|
|
363
|
-
*
|
|
364
|
-
* @param options - Optional configuration
|
|
365
|
-
* - operations: Custom execution backend (default: local shell)
|
|
366
|
-
* - commandPrefix: Prefix injected into every command
|
|
367
|
-
* - hookRunner: Hooks for environment customization
|
|
368
|
-
*
|
|
369
|
-
* @returns AgentTool instance ready to use
|
|
370
|
-
*
|
|
371
|
-
* **Error Handling:**
|
|
372
|
-
* - Non-zero exit codes: `Tool error: "Command exited with code X"`
|
|
373
|
-
* - Timeout: `Tool error: "Command timed out after X seconds"`
|
|
374
|
-
* - Abort: `Tool error: "Command aborted"`
|
|
375
|
-
* - Spawn errors: `Tool error: "ENOENT: command not found"`
|
|
376
|
-
*
|
|
377
|
-
* @example
|
|
378
|
-
* ```typescript
|
|
379
|
-
* // Basic tool
|
|
380
|
-
* const tool = createBashTool(process.cwd());
|
|
381
|
-
*
|
|
382
|
-
* // With custom backend (SSH)
|
|
383
|
-
* const sshTool = createBashTool("/workspace", {
|
|
384
|
-
* operations: sshOperations,
|
|
385
|
-
* });
|
|
386
|
-
*
|
|
387
|
-
* // With alias support
|
|
388
|
-
* const aliasTool = createBashTool(cwd, {
|
|
389
|
-
* commandPrefix: "shopt -s expand_aliases\n. ~/.bashrc",
|
|
390
|
-
* });
|
|
391
|
-
*
|
|
392
|
-
* // With hooks
|
|
393
|
-
* const hookTool = createBashTool(cwd, {
|
|
394
|
-
* hookRunner: hooksRunner,
|
|
395
|
-
* });
|
|
396
|
-
* ```
|
|
397
|
-
*
|
|
398
|
-
* @see BashToolOptions for detailed configuration options
|
|
399
|
-
* @see BashOperations for custom execution backend interface
|
|
400
|
-
*/
|
|
401
|
-
export declare function createBashTool(cwd: string, options?: BashToolOptions): AgentTool<typeof bashSchema>;
|
|
402
|
-
/**
|
|
403
|
-
* Default bash tool instance
|
|
404
|
-
*
|
|
405
|
-
* Pre-created bash tool using current process working directory.
|
|
406
|
-
* Useful for simple cases where customization isn't needed.
|
|
407
|
-
*
|
|
408
|
-
* Equivalent to:
|
|
409
|
-
* ```typescript
|
|
410
|
-
* const bashTool = createBashTool(process.cwd());
|
|
411
|
-
* ```
|
|
412
|
-
*
|
|
413
|
-
* For custom configuration, use createBashTool() directly.
|
|
414
|
-
*
|
|
415
|
-
* @example
|
|
416
|
-
* ```typescript
|
|
417
|
-
* import { bashTool } from "./tools/bash.js";
|
|
418
|
-
* const agent = new Agent({ tools: [bashTool] });
|
|
419
|
-
* ```
|
|
420
|
-
*
|
|
421
|
-
* @see createBashTool for custom configuration
|
|
422
|
-
*/
|
|
423
|
-
export declare const bashTool: AgentTool<import("@sinclair/typebox").TObject<{
|
|
424
|
-
command: import("@sinclair/typebox").TString;
|
|
425
|
-
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
426
|
-
}>, any>;
|
|
427
|
-
export {};
|
|
428
|
-
//# sourceMappingURL=bash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmKG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAoD,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AAmBtH;;;GAGG;AACH,QAAA,MAAM,UAAU;;;EAGd,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,qDAAqD;IACrD,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACH,IAAI,EAAE,CACL,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QACR,4CAA4C;QAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAC/B,mCAAmC;QACnC,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,yBAAyB;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,qCAAqC;QACrC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;KACxB,KACG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CAC1C;AA2FD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B;;;;;;;;;;;;;;;;;OAiBG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,OAAO,UAAU,CAAC,CAqJnG;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ;;;QAAgC,CAAC"}
|