Skip to main content

Module hook_handlers

Module hook_handlers 

Source

Functions§

arm_watchdog
Arms a watchdog that force-exits the process after the given duration. Prevents hook processes from becoming zombies when stdin pipes break or the IDE cancels the call. Since hooks MUST NOT spawn child processes (to avoid orphan zombies), a simple exit(1) suffices.
handle_codex_pretooluse
handle_codex_session_start
handle_copilot
Copilot-specific PreToolUse handler. VS Code Copilot Chat uses the same hook format as Claude Code. Tool names differ: “runInTerminal” / “editFile” instead of “Bash” / “Read”.
handle_redirect
handle_rewrite
handle_rewrite_inline
Inline rewrite: takes a command as CLI args, prints the rewritten command to stdout. Used by the OpenCode TS plugin where the command is passed as an argument, not via stdin JSON. Uses native OS paths (not MSYS) because the calling shell may be PowerShell or cmd on Windows.
mark_hook_environment
Mark this process as a hook child so the daemon-client never auto-starts the daemon from inside a hook (which would create zombie processes).