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