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

Function askPermission

packages/opencode/src/cli/cmd/run/demo.ts:477–501  ·  view source on GitHub ↗
(state: State, item: Permit)

Source from the content-addressed store, hash-verified

475}
476
477function askPermission(state: State, item: Permit): void {
478 startTool(state, item.ref)
479
480 const id = take(state, "perm", "perm")
481 state.perms.set(id, {
482 ref: item.ref,
483 done: item.done,
484 })
485
486 feed(state, {
487 type: "permission.asked",
488 properties: {
489 id,
490 sessionID: state.id,
491 permission: item.permission,
492 patterns: item.patterns,
493 metadata: item.metadata ?? {},
494 always: item.always,
495 tool: {
496 messageID: item.ref.msg,
497 callID: item.ref.call,
498 },
499 },
500 } as Event)
501}
502
503function doneTool(
504 state: State,

Callers 1

emitPermissionFunction · 0.85

Calls 4

startToolFunction · 0.70
takeFunction · 0.70
feedFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected