(input: LocalShellSpawnInput & {
shellCommand: ShellCommand;
}, setAppState: SetAppState, toolUseId?: string)
| 257 | * @returns taskId for the registered task |
| 258 | */ |
| 259 | export function registerForeground(input: LocalShellSpawnInput & { |
| 260 | shellCommand: ShellCommand; |
| 261 | }, setAppState: SetAppState, toolUseId?: string): string { |
| 262 | const { |
| 263 | command, |
| 264 | description, |
| 265 | shellCommand, |
| 266 | agentId |
| 267 | } = input; |
| 268 | const taskId = shellCommand.taskOutput.taskId; |
| 269 | const unregisterCleanup = registerCleanup(async () => { |
| 270 | killTask(taskId, setAppState); |
| 271 | }); |
| 272 | const taskState: LocalShellTaskState = { |
| 273 | ...createTaskStateBase(taskId, 'local_bash', description, toolUseId), |
| 274 | type: 'local_bash', |
| 275 | status: 'running', |
| 276 | command, |
| 277 | completionStatusSentInAttachment: false, |
| 278 | shellCommand, |
| 279 | unregisterCleanup, |
| 280 | lastReportedTotalLines: 0, |
| 281 | isBackgrounded: false, |
| 282 | // Not yet backgrounded - running in foreground |
| 283 | agentId |
| 284 | }; |
| 285 | registerTask(taskState, setAppState); |
| 286 | return taskId; |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Background a specific foreground task. |
no test coverage detected