MCPcopy
hub / github.com/cursor/cookbook / switchExecutionMode

Function switchExecutionMode

sdk/coding-agent-cli/src/tui/App.tsx:379–405  ·  view source on GitHub ↗
(nextMode: ExecutionMode)

Source from the content-addressed store, hash-verified

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

Callers 1

runCommandFunction · 0.85

Calls 3

addEntryFunction · 0.85
setExecutionModeMethod · 0.80
getErrorMessageFunction · 0.70

Tested by

no test coverage detected