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