Implement background command support for bash tool
- Added `background` option to `bash` tool to allow long-lived commands to run without blocking the turn. - Introduced `bash_status` tool to check the status and output of background commands. - Added `bash_stop` tool to explicitly stop running background commands. - Updated command parsing to handle `/bash` commands for listing, stopping individual, and stopping all background commands. - Enhanced session management to reap stale background commands on agent shutdown. - Updated UI to reflect background command status and allow user interruption via ctrl-c. - Added tests for background command functionality and command parsing. - Documented new features and usage in background-bash.md.
This commit is contained in:
+5
-1
@@ -1004,7 +1004,11 @@ export class Session {
|
||||
// Files written this turn are now on disk; re-walk so the next prompt's
|
||||
// workspace list shows them without a restart.
|
||||
try { await this.refreshWorkspaceFiles(); } catch {}
|
||||
onBashOutput(undefined);
|
||||
// Keep the listener alive while a background process is running so the UI
|
||||
// panel shows its output between turns. statusBackground always has the
|
||||
// data either way (bg.tail); this just keeps the live panel up.
|
||||
const { backgroundHandles } = await import('./tools');
|
||||
if (backgroundHandles().length === 0) onBashOutput(undefined);
|
||||
await (this.pluginHost ?? this.opts.plugins)?.afterTurn();
|
||||
if (!this.opts.disableAutoLearn && this.messages.length >= 6) {
|
||||
this.learnTurns += 1;
|
||||
|
||||
Reference in New Issue
Block a user