diff --git a/packages/core/src/core/__snapshots__/prompts.test.ts.snap b/packages/core/src/core/__snapshots__/prompts.test.ts.snap index 0c0b6c6ad..69481949b 100644 --- a/packages/core/src/core/__snapshots__/prompts.test.ts.snap +++ b/packages/core/src/core/__snapshots__/prompts.test.ts.snap @@ -149,7 +149,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -383,7 +383,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -597,7 +597,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -811,7 +811,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -1025,7 +1025,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -1239,7 +1239,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -1453,7 +1453,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -1667,7 +1667,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -1881,7 +1881,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -2097,7 +2097,7 @@ model: true user: start the server implemented in server.js model: -{"name": "run_shell_command", "arguments": {"command": "node server.js &"}} +{"name": "run_shell_command", "arguments": {"command": "node server.js &", "is_background": true}} @@ -2332,12 +2332,15 @@ model: true user: start the server implemented in server.js -model: +model: node server.js & + +true + @@ -2631,7 +2634,7 @@ model: true user: start the server implemented in server.js model: -{"name": "run_shell_command", "arguments": {"command": "node server.js &"}} +{"name": "run_shell_command", "arguments": {"command": "node server.js &", "is_background": true}} @@ -2866,12 +2869,15 @@ model: true user: start the server implemented in server.js -model: +model: node server.js & + +true + @@ -3159,7 +3165,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] @@ -3373,7 +3379,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: run_shell_command for 'node server.js &' because it must run in the background] +model: [tool_call: run_shell_command for 'node server.js &' with is_background: true because it must run in the background] diff --git a/packages/core/src/core/prompts.test.ts b/packages/core/src/core/prompts.test.ts index a232b50f7..7a9799433 100644 --- a/packages/core/src/core/prompts.test.ts +++ b/packages/core/src/core/prompts.test.ts @@ -302,7 +302,9 @@ describe('Model-specific tool call formats', () => { // Should contain JSON-style tool calls expect(prompt).toContain(''); expect(prompt).toContain('{"name": "run_shell_command"'); - expect(prompt).toContain('"arguments": {"command": "node server.js &"}'); + expect(prompt).toContain( + '"arguments": {"command": "node server.js &", "is_background": true}', + ); expect(prompt).toContain(''); // Should NOT contain bracket-style tool calls diff --git a/packages/core/src/core/prompts.ts b/packages/core/src/core/prompts.ts index 8d3ff4683..4ad5e38ea 100644 --- a/packages/core/src/core/prompts.ts +++ b/packages/core/src/core/prompts.ts @@ -447,7 +447,7 @@ model: true user: start the server implemented in server.js -model: [tool_call: ${ToolNames.SHELL} for 'node server.js &' because it must run in the background] +model: [tool_call: ${ToolNames.SHELL} for 'node server.js &' with is_background: true because it must run in the background] @@ -523,12 +523,15 @@ model: true user: start the server implemented in server.js -model: +model: node server.js & + +true + @@ -679,7 +682,7 @@ model: true user: start the server implemented in server.js model: -{"name": "${ToolNames.SHELL}", "arguments": {"command": "node server.js &"}} +{"name": "${ToolNames.SHELL}", "arguments": {"command": "node server.js &", "is_background": true}} diff --git a/packages/core/src/tools/shell.ts b/packages/core/src/tools/shell.ts index a02412626..d48391b90 100644 --- a/packages/core/src/tools/shell.ts +++ b/packages/core/src/tools/shell.ts @@ -543,7 +543,7 @@ export class ShellTool extends BaseDeclarativeTool< is_background: { type: 'boolean', description: - 'Whether to run the command in background. Default is false. Set to true for long-running processes like development servers, watchers, or daemons that should continue running without blocking further commands.', + 'Optional: Whether to run the command in background. If not specified, defaults to false (foreground execution). Explicitly set to true for long-running processes like development servers, watchers, or daemons that should continue running without blocking further commands.', }, timeout: { type: 'number', @@ -560,7 +560,7 @@ export class ShellTool extends BaseDeclarativeTool< '(OPTIONAL) The absolute path of the directory to run the command in. If not provided, the project root directory is used. Must be a directory within the workspace and must already exist.', }, }, - required: ['command', 'is_background'], + required: ['command'], }, false, // output is not markdown true, // output can be updated