(getAppState: () => AppState, setAppState: SetAppState)
| 428 | } |
| 429 | |
| 430 | export function backgroundAll(getAppState: () => AppState, setAppState: SetAppState): void { |
| 431 | const state = getAppState(); |
| 432 | |
| 433 | // Background all foreground bash tasks |
| 434 | const foregroundBashTaskIds = Object.keys(state.tasks).filter(id => { |
| 435 | const task = state.tasks[id]; |
| 436 | return isLocalShellTask(task) && !task.isBackgrounded && task.shellCommand; |
| 437 | }); |
| 438 | for (const taskId of foregroundBashTaskIds) { |
| 439 | backgroundTask(taskId, getAppState, setAppState); |
| 440 | } |
| 441 | |
| 442 | // Background all foreground agent tasks |
| 443 | const foregroundAgentTaskIds = Object.keys(state.tasks).filter(id => { |
| 444 | const task = state.tasks[id]; |
| 445 | return isLocalAgentTask(task) && !task.isBackgrounded; |
| 446 | }); |
| 447 | for (const taskId of foregroundAgentTaskIds) { |
| 448 | backgroundAgentTask(taskId, getAppState, setAppState); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * Background an already-registered foreground task in-place. |
no test coverage detected