()
| 902 | |
| 903 | // Helper to spawn a background task and return its ID |
| 904 | async function spawnBackgroundTask(): Promise<string> { |
| 905 | const handle = await spawnShellTask({ |
| 906 | command, |
| 907 | description: description || command, |
| 908 | shellCommand, |
| 909 | toolUseId, |
| 910 | agentId |
| 911 | }, { |
| 912 | abortController, |
| 913 | getAppState: () => { |
| 914 | // We don't have direct access to getAppState here, but spawn doesn't |
| 915 | // actually use it during the spawn process |
| 916 | throw new Error('getAppState not available in runShellCommand context'); |
| 917 | }, |
| 918 | setAppState |
| 919 | }); |
| 920 | return handle.taskId; |
| 921 | } |
| 922 | |
| 923 | // Helper to start backgrounding with optional logging |
| 924 | function startBackgrounding(eventName: string, backgroundFn?: (shellId: string) => void): void { |
no test coverage detected