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

Method setExecutionMode

sdk/coding-agent-cli/src/agent.ts:123–141  ·  view source on GitHub ↗
(mode: ExecutionMode)

Source from the content-addressed store, hash-verified

121 }
122
123 async setExecutionMode(mode: ExecutionMode) {
124 if (this.currentRun) {
125 throw new Error("Wait for the current run to finish before switching execution mode.")
126 }
127
128 if (this.mode === mode) {
129 return
130 }
131
132 const previousMode = this.mode
133 this.mode = mode
134
135 try {
136 await this.replaceAgent()
137 } catch (error) {
138 this.mode = previousMode
139 throw error
140 }
141 }
142
143 async dispose() {
144 await this.agent[Symbol.asyncDispose]()

Callers 1

switchExecutionModeFunction · 0.80

Calls 1

replaceAgentMethod · 0.95

Tested by

no test coverage detected