MCPcopy Index your code
hub / github.com/anomalyco/opencode / permissionRun

Function permissionRun

packages/opencode/src/cli/cmd/run/permission.shared.ts:174–224  ·  view source on GitHub ↗
(state: PermissionBodyState, requestID: string, option: PermissionOption)

Source from the content-addressed store, hash-verified

172}
173
174export function permissionRun(state: PermissionBodyState, requestID: string, option: PermissionOption): PermissionStep {
175 if (state.submitting) {
176 return { state }
177 }
178
179 if (state.stage === "permission") {
180 if (option === "always") {
181 return {
182 state: {
183 ...state,
184 stage: "always",
185 selected: "confirm",
186 },
187 }
188 }
189
190 if (option === "reject") {
191 return {
192 state: {
193 ...state,
194 stage: "reject",
195 selected: "reject",
196 },
197 }
198 }
199
200 return {
201 state,
202 reply: permissionReply(requestID, "once"),
203 }
204 }
205
206 if (state.stage !== "always") {
207 return { state }
208 }
209
210 if (option === "cancel") {
211 return {
212 state: {
213 ...state,
214 stage: "permission",
215 selected: "always",
216 },
217 }
218 }
219
220 return {
221 state,
222 reply: permissionReply(requestID, "always"),
223 }
224}
225
226export function permissionReject(state: PermissionBodyState, requestID: string): PermissionReply | undefined {
227 if (state.submitting) {

Callers 2

runFunction · 0.90

Calls 1

permissionReplyFunction · 0.85

Tested by

no test coverage detected