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