(nextMode: ExecutionMode)
| 377 | } |
| 378 | |
| 379 | const switchExecutionMode = async (nextMode: ExecutionMode) => { |
| 380 | const session = sessionRef.current |
| 381 | if (!session || busy) { |
| 382 | return |
| 383 | } |
| 384 | |
| 385 | if (session.executionMode === nextMode) { |
| 386 | addEntry("status", "mode", `Already using ${nextMode} execution.`) |
| 387 | return |
| 388 | } |
| 389 | |
| 390 | setBusy(true) |
| 391 | |
| 392 | try { |
| 393 | await session.setExecutionMode(nextMode) |
| 394 | setExecutionModeState(nextMode) |
| 395 | addEntry( |
| 396 | "status", |
| 397 | "mode", |
| 398 | `Switched to ${nextMode} execution. Target: ${session.executionTarget}.` |
| 399 | ) |
| 400 | } catch (error) { |
| 401 | addEntry("error", "mode", getErrorMessage(error)) |
| 402 | } finally { |
| 403 | setBusy(false) |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | const sendPrompt = async (prompt: string) => { |
| 408 | const session = sessionRef.current |
no test coverage detected