( source: ConfigChangeSource, filePath?: string, timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS, )
| 4307 | * @param timeoutMs Optional timeout in milliseconds for hook execution |
| 4308 | */ |
| 4309 | export async function executeConfigChangeHooks( |
| 4310 | source: ConfigChangeSource, |
| 4311 | filePath?: string, |
| 4312 | timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS, |
| 4313 | ): Promise<HookOutsideReplResult[]> { |
| 4314 | const hookInput: ConfigChangeHookInput = { |
| 4315 | ...createBaseHookInput(undefined), |
| 4316 | hook_event_name: 'ConfigChange', |
| 4317 | source, |
| 4318 | file_path: filePath, |
| 4319 | } |
| 4320 | |
| 4321 | const results = await executeHooksOutsideREPL({ |
| 4322 | hookInput, |
| 4323 | timeoutMs, |
| 4324 | matchQuery: source, |
| 4325 | }) |
| 4326 | |
| 4327 | // Policy settings are enterprise-managed — hooks fire for audit logging |
| 4328 | // but must never block policy changes from being applied |
| 4329 | if (source === 'policy_settings') { |
| 4330 | return results.map(r => ({ ...r, blocked: false })) |
| 4331 | } |
| 4332 | |
| 4333 | return results |
| 4334 | } |
| 4335 | |
| 4336 | async function executeEnvHooks( |
| 4337 | hookInput: HookInput, |
no test coverage detected