| 63 | export const SANDBOX_NETWORK_ACCESS_TOOL_NAME = 'SandboxNetworkAccess' |
| 64 | |
| 65 | function 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 | |
| 94 | function buildRequiresActionDetails( |
| 95 | tool: Tool, |