| 231 | } |
| 232 | |
| 233 | function normalizeDecision(response: string | null, approved: boolean): PermissionDecision { |
| 234 | if (response === 'always' || response === 'approved_for_session') { |
| 235 | return 'approved_for_session'; |
| 236 | } |
| 237 | if (response === 'once' || response === 'approved') { |
| 238 | return 'approved'; |
| 239 | } |
| 240 | if (response === 'reject' || response === 'denied') { |
| 241 | return 'denied'; |
| 242 | } |
| 243 | if (response === 'abort' || response === 'cancel' || response === 'canceled') { |
| 244 | return 'abort'; |
| 245 | } |
| 246 | return approved ? 'approved' : 'denied'; |
| 247 | } |
| 248 | |
| 249 | function resolveOpencodeConfigDir(session: OpencodeSession): string { |
| 250 | if (process.env.OPENCODE_CONFIG_DIR) { |