@deepseek-ai/dsh-hook-protocol 0.0.1-rc.1 → 0.0.1-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +1 -1
- package/README.md +1 -1
- package/lib/index.js +1 -1
- package/lib/types/runner.d.ts +1 -1
- package/package.json +7 -7
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/hooks/hook-protocol/README.md
|
|
5
|
-
README.md:
|
|
5
|
+
README.md: cf5d6d4c106a8fbd569f3c64b80dc8c787aadb3e
|
|
6
6
|
README.zh.md: 3bd229a5d469db4a6f1e18b09df62fb8e1204747
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Codex deliberately reimplements a *subset* of the Claude Code hook protocol —
|
|
|
20
20
|
## Primitives
|
|
21
21
|
|
|
22
22
|
- **`matcherDiagnostic(matcher, mode)` / `matchesMatcher(matcher, query, mode)`** — match-all on absent/`''`/`'*'`; `claude` mode treats a pure `[A-Za-z0-9_|]+` pattern as a literal (pipe = exact-match alternation) and anything else as a regex; `codex` mode is always an unanchored regex. Bridge parsers discard matcher fields for events without matcher subjects, then use `matcherDiagnostic` to reject an invalid consumed regex with a stable diagnostic before registering any hooks. The runtime predicate still contains an invalid pattern as a non-match, so a direct library caller cannot throw into the agent loop.
|
|
23
|
-
- **`runHook(bash, hook, options, now)`** — require and forward the caller-owned `options.signal`, serialize `options.payload` to the hook's stdin (with a trailing newline iff `options.trailingNewline`), merge `options.env` after the executor's credential scrub (the `dsh-bash` trusted-plugin
|
|
23
|
+
- **`runHook(bash, hook, options, now)`** — require and forward the caller-owned `options.signal`, serialize `options.payload` to the hook's stdin (with a trailing newline iff `options.trailingNewline`), merge `options.env` after the executor's credential scrub (the `dsh-bash` trusted-plugin API), honor the hook's `timeoutSec` (else `options.defaultTimeoutMs` — the bridge owns the default, its config defaulting to the lib's `DEFAULT_HOOK_TIMEOUT_MS` 10-minute reference), and decode the result (threading `options.expectedEventName` to the codec). Cancellation therefore reaches the executor's process-group kill and join boundary. Never throws: an executor rejection (infra fault) becomes a `HookOutput` with `exitCode: undefined` (a non-blocking error). `now` is injected for testable durations.
|
|
24
24
|
- **`parseHookOutput(exitCode, stdout, stderr, expectedEventName?)`** decodes exit status and structured stdout. Exit 2 blocks with stderr; other failures are non-blocking. A matching hook-specific permission decision overrides the legacy top-level decision; mismatched or missing event discriminators suppress only event-specific fields. Top-level fields remain event-agnostic, and successful non-JSON output is left to the bridge.
|
|
25
25
|
- **`mergeHookOutputs(outputs)`** — fold the results of every hook that matched one point: permission precedence **deny > ask > allow**, halt sticky on the first `continue:false`, block reasons joined with `\n\n`, `additionalContext`/`systemMessages` accumulated in order.
|
|
26
26
|
- **`createDetachedRuns()`** — quiescence tracking for the emit-shaped points, which run detached (no extension point awaits them). The bridge tracks each run chain — the hook run PLUS its continuation — and registers `drain()` as its effect disposer: drain fires the tracker's abort `signal` (so a still-running hook process is killed via `runHook`, not awaited out to its timeout), then resolves once every tracked chain has settled. `fiber.dispose()` resolving therefore means no detached hook work is left to fire into a disposed context ([defensive patterns](../../../docs/defensive-patterns.md): dispose must reach quiescence).
|
package/lib/index.js
CHANGED
|
@@ -170,7 +170,7 @@ function applyStructured(output, parsed, expectedEventName) {
|
|
|
170
170
|
* Claude Code and Codex apply to a hook whose config sets no `timeout`. It
|
|
171
171
|
* lives here, once, as the protocol's default; the bridges' `defaultTimeoutMs`
|
|
172
172
|
* config defaults to it, and a per-hook {@link CommandHook.timeoutSec} is the
|
|
173
|
-
* override
|
|
173
|
+
* override API.
|
|
174
174
|
*/
|
|
175
175
|
const DEFAULT_HOOK_TIMEOUT_MS = 6e5;
|
|
176
176
|
/**
|
package/lib/types/runner.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { CommandHook, HookOutput } from './types.ts';
|
|
|
12
12
|
* Claude Code and Codex apply to a hook whose config sets no `timeout`. It
|
|
13
13
|
* lives here, once, as the protocol's default; the bridges' `defaultTimeoutMs`
|
|
14
14
|
* config defaults to it, and a per-hook {@link CommandHook.timeoutSec} is the
|
|
15
|
-
* override
|
|
15
|
+
* override API.
|
|
16
16
|
*/
|
|
17
17
|
export declare const DEFAULT_HOOK_TIMEOUT_MS = 600000;
|
|
18
18
|
/** Everything a single hook invocation needs beyond its command line. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-hook-protocol",
|
|
3
3
|
"description": "Shared Claude Code / Codex hook wire protocol: matcher engine, stdin/exit-code/stdout codec, multi-hook merge, and hook/* session events",
|
|
4
|
-
"version": "0.0.1-rc.
|
|
4
|
+
"version": "0.0.1-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "BSD-3-Clause",
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/dsh-session": "^0.0.1-rc.
|
|
35
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.2",
|
|
36
|
+
"@deepseek-ai/dsh-bash": "^0.0.1-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-session": "^0.0.1-rc.2",
|
|
38
38
|
"@deepseek-ai/cordis": "^4.0.1-rc.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@deepseek-ai/dsh-bash": "^0.0.1-rc.
|
|
42
|
-
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.
|
|
43
|
-
"@deepseek-ai/dsh-session": "^0.0.1-rc.
|
|
41
|
+
"@deepseek-ai/dsh-bash": "^0.0.1-rc.2",
|
|
42
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.2",
|
|
43
|
+
"@deepseek-ai/dsh-session": "^0.0.1-rc.2",
|
|
44
44
|
"@deepseek-ai/cordis": "^4.0.1-rc.1"
|
|
45
45
|
}
|
|
46
46
|
}
|