MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / serializeDecisionReason

Function serializeDecisionReason

src/cli/structuredIO.ts:65–92  ·  view source on GitHub ↗
(
  reason: PermissionDecisionReason | undefined,
)

Source from the content-addressed store, hash-verified

63export const SANDBOX_NETWORK_ACCESS_TOOL_NAME = 'SandboxNetworkAccess'
64
65function serializeDecisionReason(
66 reason: PermissionDecisionReason | undefined,
67): string | undefined {
68 if (!reason) {
69 return undefined
70 }
71
72 if (
73 (feature('BASH_CLASSIFIER') || feature('TRANSCRIPT_CLASSIFIER')) &&
74 reason.type === 'classifier'
75 ) {
76 return reason.reason
77 }
78 switch (reason.type) {
79 case 'rule':
80 case 'mode':
81 case 'subcommandResults':
82 case 'permissionPromptTool':
83 return undefined
84 case 'hook':
85 case 'asyncAgent':
86 case 'sandboxOverride':
87 case 'workingDir':
88 case 'safetyCheck':
89 case 'other':
90 return reason.reason
91 }
92}
93
94function buildRequiresActionDetails(
95 tool: Tool,

Callers 1

createCanUseToolMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected