2nd dokployH
Find a file
Tianyi Cui 65165b5d54 feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core
The two hook bridges (dsh-hooks-claude, dsh-hooks-codex) would otherwise duplicate
the bulk of the protocol — Codex deliberately reimplements a SUBSET of the Claude
Code protocol (same hooks.json shape, exit-code/stdout contract, command-hook
model). This library holds the genuinely-identical primitives; each bridge owns
only what differs (per-event stdin payload, env/substitution, decision mapping).

New packages/hooks/ group; hook-protocol is a LIBRARY (no plugin, registers/injects
nothing):
- matcher: matchesMatcher(pattern, query, mode) — the one dialect axis collapsed to
  a mode param (claude = literal-or-regex with pipe alternation; codex = always
  unanchored regex). Match-all on absent/''/'*'; invalid regex matches nothing.
- codec: parseHookOutput(exit, stdout, stderr) → dialect-neutral HookOutput. Exit 0
  → lenient JSON; exit 2 → blocking error (stderr = reason, surfaced as
  decision:'block'); other → non-blocking. Parses the CC superset
  (continue/stopReason/decision/hookSpecificOutput.{permissionDecision,
  additionalContext,updatedInput}/systemMessage); permissionDecision overrides the
  legacy top-level decision.
- runner: runHook(bash, hook, opts, now) — runs a command hook via ctx.bash (stdin
  payload + trusted-plugin env), honors timeoutSec, never throws (executor reject →
  non-blocking-error HookOutput). Injected clock for testable durations.
- merge: mergeHookOutputs — most-restrictive fold (deny>ask>allow, sticky stop,
  block reasons joined, context/system-messages accumulated).
- hook/* session events (declaration-merged into SessionEventMap, log-only like
  compact/*) + appendHookInvoked/appendHookResult helpers.

updatedInput is parsed but NOT honored (deferred pre-tool-input-rewrite RFC); a
bridge logs+warns. 47 unit tests at per-file 100% (matcher per-mode, codec per
exit-code/field, runner plumbing w/ stub executor, merge precedence, hook/*
helpers). RFC: implemented/feature/2026-06-30-hook-protocol-lib.md.
2026-07-01 00:41:53 +08:00
.agents/skills docs(rfc): classify RFCs by kind via path-encoded subdirectories 2026-06-20 22:29:45 +08:00
.claude docs: accuracy sweep, architecture restructure, two ADRs, review skill 2026-06-13 22:05:34 +08:00
.github/workflows ci: raise Node heap ceiling for type-aware ESLint lint step 2026-06-26 23:38:53 +08:00
docs feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
examples fix(todo): address todo_write review feedback 2026-06-29 19:44:38 +08:00
packages feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
scripts feat(events): interception seams — the typed-Decision surface for hooks 2026-06-30 17:11:18 +08:00
vendor Use explicit ts specifiers for declarations 2026-06-22 06:11:00 +08:00
.gitignore Merge origin/master into codex/fix-stdio-readline-terminal 2026-06-23 16:27:49 +08:00
AGENTS.md feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
CLAUDE.md Initialize repo with README, AGENTS.md, and CLAUDE.md symlink 2026-06-10 22:58:56 +08:00
eslint.config.mjs fix: make constraints, lint and md-links happy 2026-06-22 01:38:44 +08:00
knip.json Add the ACP subagent backend: out-of-process delegation (PR3) 2026-06-22 10:47:02 +08:00
lefthook.yml feat(acp-example): snapshot harness, normalizers, wiring, and handshake scenario 2026-06-19 03:36:12 +08:00
LICENSE Initialize repo with README, AGENTS.md, and CLAUDE.md symlink 2026-06-10 22:58:56 +08:00
package.json Use explicit ts specifiers for declarations 2026-06-22 06:11:00 +08:00
pnpm-lock.yaml feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
pnpm-workspace.yaml Reorganize packages into a modular hierarchy 2026-06-20 22:55:20 +08:00
README.md feat: migrate to pnpm 2026-06-16 14:55:37 +08:00
tsconfig.base.json feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
tsconfig.build.json feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
tsconfig.json feat(hooks): dsh-hook-protocol — shared Claude Code / Codex hook wire-protocol core 2026-07-01 00:41:53 +08:00
tsdown.config.ts Merge remote-tracking branch 'origin/master' into feat/adr0016-type-build-check 2026-06-22 00:35:51 +08:00
vitest.config.ts Merge remote-tracking branch 'origin/master' into feat/adr0016-type-build-check 2026-06-22 00:35:51 +08:00
vitest.e2e.config.ts Merge remote-tracking branch 'origin/master' into feat/adr0016-type-build-check 2026-06-22 00:35:51 +08:00
vitest.snapshot.config.ts feat: one tsconfig.json and different rules 2026-06-19 23:35:47 +08:00

DeepSeek Harness

Monorepo for the DeepSeek Harness group.

Projects

  • DeepSeek Code — DeepSeek's coding agent product.

Development

This monorepo is built on the Cordis framework (vendored as source under vendor/), microkernel-style: everything is a plugin.

pnpm install
pnpm run test          # vitest
pnpm run demo:echo     # runnable echo-agent example (no API key needed)
pnpm run demo:coding   # the real DeepSeek coding agent (needs DEEPSEEK_API_KEY)

For humans, start with the development guide for local setup, hooks, environment variables, and quality gates, then read the architecture design before package work. Local context lives in packages/ and vendor/.

For agents, follow AGENTS.md.