( source: ConfigChangeSource, filePath?: string, timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS, )
| 4216 | * @param timeoutMs Optional timeout in milliseconds for hook execution |
| 4217 | */ |
| 4218 | export async function executeConfigChangeHooks( |
| 4219 | source: ConfigChangeSource, |
| 4220 | filePath?: string, |
| 4221 | timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS, |
| 4222 | ): Promise<HookOutsideReplResult[]> { |
| 4223 | const hookInput: ConfigChangeHookInput = { |
| 4224 | ...createBaseHookInput(undefined), |
| 4225 | hook_event_name: 'ConfigChange', |
| 4226 | source, |
| 4227 | file_path: filePath, |
| 4228 | } |
| 4229 | |
| 4230 | const results = await executeHooksOutsideREPL({ |
| 4231 | hookInput, |
| 4232 | timeoutMs, |
| 4233 | matchQuery: source, |
| 4234 | }) |
| 4235 | |
| 4236 | // Policy settings are enterprise-managed — hooks fire for audit logging |
| 4237 | // but must never block policy changes from being applied |
| 4238 | if (source === 'policy_settings') { |
| 4239 | return results.map(r => ({ ...r, blocked: false })) |
| 4240 | } |
| 4241 | |
| 4242 | return results |
| 4243 | } |
| 4244 | |
| 4245 | async function executeEnvHooks( |
| 4246 | hookInput: HookInput, |
no test coverage detected