fix(hooks): match Codex Rust regex syntax

This commit is contained in:
ZiyaZhang
2026-07-28 10:37:53 -07:00
parent 140a1eaccc
commit 0ef2327e34
21 files changed
+115 -62

No files matched your search

+6 -5
View File
@@ -1,9 +1,10 @@
/**
* Bridge for unmodified Codex command hooks on harness interception seams. It
* supports five points (SessionStart, prompt/tool pre/post, Stop), regex-only
* matchers, snake_case payloads without a trailing newline, no hook environment
* or command substitution, and no pre-tool approval or rewrite path; only
* blocking decisions are honored. Shared execution and parsing live in
* supports five points (SessionStart, prompt/tool pre/post, Stop), native
* literal-or-Rust-regex matchers, snake_case payloads without a trailing
* newline, no hook environment or command substitution, and no pre-tool
* approval or rewrite path; only blocking decisions are honored. Shared
* execution and parsing live in
* `dsh-hook-protocol`; see the
* [hook-bridges Agent Note](../../../../.agents/notes/implemented/feature/2026-06-30-hook-bridges.md).
* @module @deepseek-ai/dsh-hooks-codex
@@ -127,7 +128,7 @@ export function apply(ctx: Context, config: Config): void {
// user's project rather than the server launch directory.
const workdir = opts.agent?.session.header.cwd
for (const group of groups) {
// Codex always interprets matchers as regexes; it has no literal fast path.
// The protocol library owns Codex's exact-literal/Rust-regex split.
if (!matchesMatcher(group.matcher, matchQuery, 'codex')) continue
for (const hook of group.hooks) {
const handlerId = nextHandlerId(point)