diff options
| author | Olcan <[email protected]> | 2025-05-27 15:40:18 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-27 15:40:18 -0700 |
| commit | bfeaac844186153698d3a7079b41214bbf1e4371 (patch) | |
| tree | b7b5208072de7f43eb45d9e7a2fe64b1febee42f /packages/server/src/tools/shell.ts | |
| parent | 0d5f7686d7c4cd355cc2d327a2f04c8d7d31e09e (diff) | |
live output from shell tool (#573)
Diffstat (limited to 'packages/server/src/tools/shell.ts')
| -rw-r--r-- | packages/server/src/tools/shell.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/server/src/tools/shell.ts b/packages/server/src/tools/shell.ts index 9e61717c..6ee36b8d 100644 --- a/packages/server/src/tools/shell.ts +++ b/packages/server/src/tools/shell.ts @@ -123,6 +123,7 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> { async execute( params: ShellToolParams, abortSignal: AbortSignal, + onOutputChunk?: (chunk: string) => void, ): Promise<ToolResult> { const validationError = this.validateToolParams(params); if (validationError) { @@ -157,6 +158,9 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> { const str = data.toString(); stdout += str; output += str; + if (onOutputChunk) { + onOutputChunk(str); + } }); let stderr = ''; @@ -174,6 +178,9 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> { } stderr += str; output += str; + if (onOutputChunk) { + onOutputChunk(str); + } }); let error: Error | null = null; |
