@dzhechkov/harness-core 0.5.0 → 0.5.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.
Files changed (96) hide show
  1. package/.dz-manifest.json +339 -75
  2. package/README.md +47 -4
  3. package/dist/codex-hooks-assets.d.ts.map +1 -1
  4. package/dist/codex-hooks-assets.js +39 -2
  5. package/dist/codex-hooks-assets.js.map +1 -1
  6. package/dist/codex-hooks-verify.d.ts +23 -2
  7. package/dist/codex-hooks-verify.d.ts.map +1 -1
  8. package/dist/codex-hooks-verify.js +29 -0
  9. package/dist/codex-hooks-verify.js.map +1 -1
  10. package/dist/codex-hooks.d.ts +90 -7
  11. package/dist/codex-hooks.d.ts.map +1 -1
  12. package/dist/codex-hooks.js +171 -21
  13. package/dist/codex-hooks.js.map +1 -1
  14. package/dist/feature-adr-routing.d.ts +22 -0
  15. package/dist/feature-adr-routing.d.ts.map +1 -1
  16. package/dist/feature-adr-routing.js +45 -0
  17. package/dist/feature-adr-routing.js.map +1 -1
  18. package/dist/index.d.ts +11 -4
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +17 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/loop-blobs.generated.d.ts +1 -1
  23. package/dist/loop-blobs.generated.d.ts.map +1 -1
  24. package/dist/loop-blobs.generated.js +12 -3
  25. package/dist/loop-blobs.generated.js.map +1 -1
  26. package/dist/loop-plan.d.ts +70 -0
  27. package/dist/loop-plan.d.ts.map +1 -1
  28. package/dist/loop-plan.js +103 -0
  29. package/dist/loop-plan.js.map +1 -1
  30. package/dist/loop-render.d.ts.map +1 -1
  31. package/dist/loop-render.js +38 -130
  32. package/dist/loop-render.js.map +1 -1
  33. package/dist/loop-run-semantics.d.ts +130 -0
  34. package/dist/loop-run-semantics.d.ts.map +1 -0
  35. package/dist/loop-run-semantics.js +257 -0
  36. package/dist/loop-run-semantics.js.map +1 -0
  37. package/dist/loop-trace.d.ts +106 -5
  38. package/dist/loop-trace.d.ts.map +1 -1
  39. package/dist/loop-trace.js +151 -18
  40. package/dist/loop-trace.js.map +1 -1
  41. package/dist/managed-hooks.d.ts +10 -0
  42. package/dist/managed-hooks.d.ts.map +1 -1
  43. package/dist/managed-hooks.js +17 -5
  44. package/dist/managed-hooks.js.map +1 -1
  45. package/dist/named-lock.d.ts +57 -0
  46. package/dist/named-lock.d.ts.map +1 -0
  47. package/dist/named-lock.js +247 -0
  48. package/dist/named-lock.js.map +1 -0
  49. package/dist/operations.d.ts +81 -5
  50. package/dist/operations.d.ts.map +1 -1
  51. package/dist/operations.js +356 -38
  52. package/dist/operations.js.map +1 -1
  53. package/dist/parity.d.ts +70 -2
  54. package/dist/parity.d.ts.map +1 -1
  55. package/dist/parity.js +133 -2
  56. package/dist/parity.js.map +1 -1
  57. package/dist/qe-bridge.d.ts +291 -0
  58. package/dist/qe-bridge.d.ts.map +1 -0
  59. package/dist/qe-bridge.js +538 -0
  60. package/dist/qe-bridge.js.map +1 -0
  61. package/dist/score.d.ts.map +1 -1
  62. package/dist/score.js +43 -9
  63. package/dist/score.js.map +1 -1
  64. package/dist/trace-corroborate.d.ts +48 -0
  65. package/dist/trace-corroborate.d.ts.map +1 -0
  66. package/dist/trace-corroborate.js +172 -0
  67. package/dist/trace-corroborate.js.map +1 -0
  68. package/dist/workflow-run-dispatch.d.ts +230 -0
  69. package/dist/workflow-run-dispatch.d.ts.map +1 -0
  70. package/dist/workflow-run-dispatch.js +363 -0
  71. package/dist/workflow-run-dispatch.js.map +1 -0
  72. package/dist/workflow-run.d.ts +513 -0
  73. package/dist/workflow-run.d.ts.map +1 -0
  74. package/dist/workflow-run.js +1377 -0
  75. package/dist/workflow-run.js.map +1 -0
  76. package/package.json +2 -2
  77. package/sbom.json +740 -80
  78. package/src/codex-hooks-assets.ts +39 -2
  79. package/src/codex-hooks-verify.ts +55 -2
  80. package/src/codex-hooks.ts +172 -20
  81. package/src/feature-adr-routing.ts +55 -0
  82. package/src/index.ts +46 -1
  83. package/src/loop-blobs.generated.ts +12 -3
  84. package/src/loop-plan.ts +185 -0
  85. package/src/loop-render.ts +38 -128
  86. package/src/loop-run-semantics.ts +278 -0
  87. package/src/loop-trace.ts +207 -16
  88. package/src/managed-hooks.ts +26 -5
  89. package/src/named-lock.ts +277 -0
  90. package/src/operations.ts +441 -40
  91. package/src/parity.ts +177 -2
  92. package/src/qe-bridge.ts +737 -0
  93. package/src/score.ts +50 -9
  94. package/src/trace-corroborate.ts +205 -0
  95. package/src/workflow-run-dispatch.ts +459 -0
  96. package/src/workflow-run.ts +1773 -0
package/README.md CHANGED
@@ -150,9 +150,25 @@ is shared with the Claude Code path rather than duplicated:
150
150
  | `codex-hooks-assets.ts` | the two emitted `.cjs` helper bodies (the `generateAgentdbWriter` pattern). |
151
151
 
152
152
  `runSyncCodexHooks` (in `operations.ts`) is the I/O shell: refuse → read → merge → back up → atomic
153
- write → helpers → **install-time liveness self-probe** → arm trust → manifest.
154
-
155
- Two runtime facts it encodes, both MEASURED on `codex-cli 0.147.0` and both load-bearing:
153
+ write → helpers → **install-time liveness self-probe** → arm trust → manifest → **live veto probe**.
154
+
155
+ The last step is the one that decides what may be printed. `runCodexVetoProbe` drives ONE
156
+ non-bypassed `codex exec` in a hermetic, consenting workspace with a nonce-scoped sentinel, and
157
+ `classifyVetoProbe` grades it; the report's `ready` is `installed ∧ executable ∧ trusted ∧ a
158
+ witnessed block`, and nothing else may reach a success word. `verify: false` (the CLI's
159
+ `--no-verify`) never yields exit 0 — a refusal to measure is inconclusive, not success. This is the
160
+ independent review's CRITICAL finding: the classifier and its exit map existed and were never called
161
+ from any production path.
162
+
163
+ Two spellings that are NOT the same fact, both MEASURED on codex-cli 0.148.0: a trust KEY embeds
164
+ `pre_tool_use`, while `hooks/list`'s `eventName` FIELD says `preToolUse`. `sameHookEvent` normalises
165
+ both — pinning either alone matches zero rows, writes no trust, and the guard stops firing while
166
+ every unit test stays green (it did; the live probe caught it).
167
+
168
+ Two runtime facts it encodes, both MEASURED on `codex-cli 0.147.0` and RE-CONFIRMED on `0.148.0` at
169
+ the independent-QE fix round (a capability grant now records the runtime version it was measured on,
170
+ and a grant whose recorded version is not the installed one is reported `stale-runtime-version` —
171
+ inconclusive until re-probed). Both are load-bearing:
156
172
 
157
173
  - **Hooks are trust-gated.** A written entry is silently never run until trust is recorded per entry
158
174
  in `$CODEX_HOME/config.toml` as `[hooks.state."<key>"] trusted_hash = "<currentHash>"`. Both values
@@ -168,9 +184,36 @@ Two runtime facts it encodes, both MEASURED on `codex-cli 0.147.0` and both load
168
184
  `runtime: 'claude-code' | 'codex'` (absent ⇒ `claude-code`), and the compaction aggregate carries a
169
185
  `runtimes` set union so provenance survives the lossy path.
170
186
 
187
+ ## Run a plan without the Claude host
188
+
189
+ `runWorkflow` (`workflow-run.ts`) is the PURE scheduler behind `dz workflow run`: it INTERPRETS a
190
+ `loop-plan/1` plan instead of executing a rendered script, dispatching each step through
191
+ `workflow-run-dispatch.ts` (`codex exec`, or an isolated `claude -p`) over a single injected child
192
+ seam. Every one of its 24 failure reasons has a named producer, so the taxonomy is reachable in
193
+ tests without a child process. `loop-run-semantics.ts` is the single blob SOURCE for the gate / join
194
+ / failure constants, which is what makes "imported, not copied" true by construction.
195
+
196
+ **How far the cross-host equivalence claim reaches (MEASURED 2026-08-20).** `dz workflow run` writes
197
+ `trace.jsonl` from the `dz` process itself on BOTH families — instrument-written. The rendered
198
+ script under the Claude host cannot (the sandbox has no filesystem), so there the trace is appended
199
+ by an AGENT the script asks to run the flush command — agent-attested. The host's own records cannot
200
+ close the gap: `journal.jsonl` carries `type` / `key` / `agentId` / `result` and neither `seq` nor
201
+ `ts`; the per-agent transcripts carry `timestamp` and `uuid`/`parentUuid` and can order AGENTS, but a
202
+ join, a gate redo and a typed pause are steps of the loop, not agents, and appear nowhere. So the
203
+ equivalence proved by the committed `pkg-audit-1` fixture covers a bounded fanout, an all-activated
204
+ join, a dep chain and a gate — and NOT the gate redo route, the typed terminal route, the typed
205
+ pause or the file deliverable.
206
+
171
207
  ## Status
172
208
 
173
- `0.4.8` — staged, not published. Adds the Codex hook carrier above, the shared
209
+ `0.5.1` — published. **BEHAVIORAL:** `parseTrace` orders events by `seq`, not by file order (§42
210
+ `CANNOT_ISOLATE` semantics unchanged from 0.5.0) — a stored verdict computed over a non-sequential
211
+ trace is not comparable with one computed here. Adds the plan enactor above, `qe-bridge.ts`
212
+ (cross-family QE hand-off with reviewer isolation, 17-reason taxonomy) and `named-lock.ts`
213
+ (`withNamedLockSync` for read-modify-write file stores outside the worktree). Full detail in
214
+ [CHANGELOG.md](CHANGELOG.md).
215
+
216
+ **0.4.8.** Adds the Codex hook carrier above, the shared
174
217
  `mergeManagedHookEntries` extraction, the `runtime`/`runtimes` provenance on recall-usage, and the
175
218
  granular `hooks-write` / `hooks-shell` / `hooks-prompt` parity capabilities with an evidence gate.
176
219
 
@@ -1 +1 @@
1
- {"version":3,"file":"codex-hooks-assets.d.ts","sourceRoot":"","sources":["../src/codex-hooks-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAkGH;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAoDhD;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CA4FlD;AAED,iEAAiE;AACjE,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC,CAElF"}
1
+ {"version":3,"file":"codex-hooks-assets.d.ts","sourceRoot":"","sources":["../src/codex-hooks-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAuIH;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAoDhD;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CA4FlD;AAED,iEAAiE;AACjE,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC,CAElF"}
@@ -48,9 +48,17 @@ const ERROR_LOG = path.join(CODEX_HOME, 'dz-hooks', 'helper-errors.jsonl');
48
48
  * surfaces a hook's stderr in the transcript ONLY when the hook exits 2 — an exit-0 hook's stderr is
49
49
  * swallowed. So a warn that lived only on stderr would be unobservable, and "the guard is live but
50
50
  * not blocking" (G-J) would be unprovable. This file is where it is observable.
51
+ *
52
+ * The log is 0600 inside a 0700 directory, ENFORCED on every write rather than assumed at creation:
53
+ * \`mkdir -p\` never relaxes an existing directory's mode, so a helper dir that predates dz (or a
54
+ * permissive umask) would leave the record world-readable (independent review, finding 8).
51
55
  */
52
56
  function note(stage, err, extra) {
53
57
  try {
58
+ try { fs.mkdirSync(path.dirname(ERROR_LOG), { recursive: true, mode: 0o700 }); } catch (_) { /* exists */ }
59
+ try { fs.chmodSync(path.dirname(ERROR_LOG), 0o700); } catch (_) { /* not ours to tighten */ }
60
+ try { if (!fs.existsSync(ERROR_LOG)) fs.writeFileSync(ERROR_LOG, '', { mode: 0o600 }); } catch (_) { /* raced */ }
61
+ try { fs.chmodSync(ERROR_LOG, 0o600); } catch (_) { /* not ours to tighten */ }
54
62
  fs.appendFileSync(
55
63
  ERROR_LOG,
56
64
  JSON.stringify(Object.assign(
@@ -61,6 +69,35 @@ function note(stage, err, extra) {
61
69
  } catch (_) { /* the note is best-effort; it must never become the failure */ }
62
70
  }
63
71
 
72
+ /**
73
+ * What a note may say about a COMMAND: its hash, its program name, and a probe nonce if one is
74
+ * embedded — never the line itself.
75
+ *
76
+ * A veto fires on exactly the commands most likely to carry a credential (\`ssh\`, \`curl -u\`,
77
+ * \`psql\`), and the note is a durable file in the user's home. It recorded the full line
78
+ * (independent review, finding 8). The hash keeps the record useful — two notes are the same
79
+ * command iff their hashes match — and \`probeNonce\` keeps the live probe gradeable, because the
80
+ * probe's own correlator is a purpose-built token (\`dzprobe-…\` / \`dzverify-…\`) and not a secret.
81
+ */
82
+ function commandFacts(command) {
83
+ var facts = {};
84
+ try {
85
+ facts.commandSha256 = require('node:crypto').createHash('sha256').update(String(command), 'utf8').digest('hex');
86
+ } catch (_) { /* hashing is best-effort too */ }
87
+ try {
88
+ // The first token is a BINARY NAME or nothing. \`SECRET=xyz ssh …\` puts a credential in the
89
+ // first token, and a synopsis is not worth one byte of it (fix round 2, R2-8): anything that is
90
+ // not a plain program name — in particular anything carrying \`=\` — is redacted outright.
91
+ var first = String(command).trim().split(/\\s+/)[0] || '';
92
+ facts.commandSynopsis = /^[A-Za-z0-9._\\/-]+$/.test(first) ? first.slice(0, 40) : '(redacted)';
93
+ } catch (_) { /* ignore */ }
94
+ try {
95
+ var m = String(command).match(/dz(?:probe|verify)-[0-9a-zA-Z-]+/);
96
+ if (m) facts.probeNonce = m[0];
97
+ } catch (_) { /* ignore */ }
98
+ return facts;
99
+ }
100
+
64
101
  function readPayload() {
65
102
  try {
66
103
  const raw = fs.readFileSync(0, 'utf8');
@@ -159,14 +196,14 @@ function main() {
159
196
 
160
197
  if (mode === 'block') {
161
198
  process.stderr.write('DZ-VETO: ' + hit.rule + ' — ' + hit.reason + ' — command: ' + command + '\\n');
162
- note('veto-block', null, { marker: 'DZ-VETO', rule: hit.rule, command: command, mode: mode });
199
+ note('veto-block', null, Object.assign({ marker: 'DZ-VETO', rule: hit.rule, mode: mode }, commandFacts(command)));
163
200
  return 2;
164
201
  }
165
202
  const warnLine = 'DZ-VETO-WARN: ' + hit.rule + ' — ' + hit.reason + ' — command: ' + command;
166
203
  process.stderr.write(warnLine + '\\n');
167
204
  // Codex swallows an exit-0 hook's stderr (MEASURED), so the warn is ALSO recorded where it can be
168
205
  // read back — otherwise the shipped default would be live-but-unobservable.
169
- note('veto-warn', null, { marker: 'DZ-VETO-WARN', rule: hit.rule, command: command, mode: mode });
206
+ note('veto-warn', null, Object.assign({ marker: 'DZ-VETO-WARN', rule: hit.rule, mode: mode }, commandFacts(command)));
170
207
  return 0;
171
208
  }
172
209
 
@@ -1 +1 @@
1
- {"version":3,"file":"codex-hooks-assets.js","sourceRoot":"","sources":["../src/codex-hooks-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,gFAAgF;AAChF,SAAS,QAAQ;IACf,OAAO;oEAC2D,sBAAsB;;;;;;yBAMjE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkF9C,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,GAAG,QAAQ,EAAE,CAAC,OAAO,CAAC,sBAAsB,EAAE,uDAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD9G,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,GAAG,QAAQ,EAAE,CAAC,OAAO,CAAC,sBAAsB,EAAE,yDAAyD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FhH,CAAC;AACF,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,oBAAoB;IAClC,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,yBAAyB,EAAE,EAAE,CAAC;AAClF,CAAC"}
1
+ {"version":3,"file":"codex-hooks-assets.js","sourceRoot":"","sources":["../src/codex-hooks-assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,gFAAgF;AAChF,SAAS,QAAQ;IACf,OAAO;oEAC2D,sBAAsB;;;;;;yBAMjE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuH9C,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,GAAG,QAAQ,EAAE,CAAC,OAAO,CAAC,sBAAsB,EAAE,uDAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD9G,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,GAAG,QAAQ,EAAE,CAAC,OAAO,CAAC,sBAAsB,EAAE,yDAAyD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0FhH,CAAC;AACF,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,oBAAoB;IAClC,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,yBAAyB,EAAE,EAAE,CAAC;AAClF,CAAC"}
@@ -42,8 +42,29 @@ export interface VetoProbeEvidence {
42
42
  readonly transcript: string;
43
43
  /** Per-run nonce embedded in the probe command; guards against grading a stale transcript. */
44
44
  readonly nonce: string;
45
- /** Did the sentinel side effect land? `true` ⇒ the command RAN. */
46
- readonly sentinelPresent: boolean;
45
+ /**
46
+ * Did the sentinel side effect land? `true` ⇒ the command RAN.
47
+ *
48
+ * `null` ⇒ the state could NOT be established (the stat failed, or a transcript carried no
49
+ * sentinel header). ADR-002 §2 row `sentinelExists === null` ⇒ `inconclusive`: the QE fix round
50
+ * found the probe parser DEFAULTING a missing header to `false`, which is the difference between
51
+ * "the command was blocked" and "we did not look" (independent review, finding 4).
52
+ */
53
+ readonly sentinelPresent: boolean | null;
54
+ /**
55
+ * Did the `codex` invocation COMPLETE? `false` ⇒ inconclusive whatever the transcript says
56
+ * (ADR-002 §2). `null` ⇒ the caller LOOKED and could not tell ⇒ also inconclusive. Absent ⇒ the
57
+ * caller did not report completion at all; the other evidence still decides.
58
+ *
59
+ * The three-way split is the fix-round-2 correction (R2-4): a recorder that cannot find its own
60
+ * completion fields must say so EXPLICITLY, and an explicit "unknown" must not be graded like a
61
+ * caller who simply never spoke about completion.
62
+ */
63
+ readonly ran?: boolean | null | undefined;
64
+ /** The invocation's exit status. `null` ⇒ the process died / was killed / unrecorded ⇒ inconclusive. */
65
+ readonly exitCode?: number | null | undefined;
66
+ /** The invocation hit its timeout. `null` ⇒ recorded as unknown ⇒ inconclusive. */
67
+ readonly timedOut?: boolean | null | undefined;
47
68
  /** Did the transcript show the model actually attempting the shell command? */
48
69
  readonly shellAttempted: boolean;
49
70
  /** Was `--dangerously-bypass-hook-trust` in play? `true` can never yield a pass. */
@@ -1 +1 @@
1
- {"version":3,"file":"codex-hooks-verify.d.ts","sourceRoot":"","sources":["../src/codex-hooks-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,cAAc,CAAC;AACjE,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAAC;AAEhE,mGAAmG;AACnG,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAEpF,iFAAiF;AACjF,eAAO,MAAM,cAAc,aAAa,CAAC;AACzC,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,uCAAuC,CAAC;AAEzE,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAA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AQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,CAAC,aAAa,CAAC,GAAG,SAAS,CAWjF;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAqHvE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAI5D;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAE1D"}
@@ -58,6 +58,35 @@ export function classifyVetoProbe(e) {
58
58
  };
59
59
  }
60
60
  const trust = classifyTrust(e.trustStatus);
61
+ // 1b. COMPLETION (ADR-002 §2, row "invocation did not complete"). A transcript from a run that
62
+ // died, timed out, or never finished is a partial reading, and the marker can appear in a
63
+ // partial reading. Decided before any transcript evidence is weighed (fix-round finding 4).
64
+ if (e.timedOut === true) {
65
+ return { verdict: 'inconclusive', trust, reason: 'the probe invocation TIMED OUT: a partial transcript is a failed observation, not a clean run' };
66
+ }
67
+ if (e.timedOut === null) {
68
+ return { verdict: 'inconclusive', trust, reason: 'completion evidence incomplete: the timeout state was recorded as UNKNOWN — a run that may have been cut short cannot witness a block' };
69
+ }
70
+ if (e.ran === null) {
71
+ return { verdict: 'inconclusive', trust, reason: 'completion evidence incomplete: whether the probe invocation completed was recorded as UNKNOWN' };
72
+ }
73
+ if (e.ran === false) {
74
+ return {
75
+ verdict: 'inconclusive',
76
+ trust,
77
+ reason: e.sentinelPresent === true
78
+ ? 'contradictory evidence: the invocation is reported as never completed, yet the sentinel side effect landed'
79
+ : 'the probe invocation did not complete — there is nothing to grade',
80
+ };
81
+ }
82
+ if (e.exitCode === null) {
83
+ return { verdict: 'inconclusive', trust, reason: 'the probe process died without an exit status (signal or kill) — evidence is missing, not clean' };
84
+ }
85
+ // 1c. An UNKNOWN sentinel state cannot be graded: "absent" is half of the two-sided witness, and
86
+ // "we did not look" must never be spelled the same way (finding 4).
87
+ if (e.sentinelPresent !== true && e.sentinelPresent !== false) {
88
+ return { verdict: 'inconclusive', trust, reason: 'the sentinel side-effect state could not be established — evidence is missing, not clean' };
89
+ }
61
90
  // 2. Stale facts are not facts (AM-10).
62
91
  const recorded = e.recordedCodexVersion;
63
92
  const probed = e.probedCodexVersion;
@@ -1 +1 @@
1
- {"version":3,"file":"codex-hooks-verify.js","sourceRoot":"","sources":["../src/codex-hooks-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AACzC,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AACnD,sFAAsF;AACtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,oCAAoC,CAAC;AA2BzE,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,MAAwC;IACpE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,eAAe,CAAC;QACzB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,CAAoB;IACpD,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAExE,gGAAgG;IAChG,IAAI,CAAC,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO;YACL,OAAO,EAAE,cAAc;YACvB,KAAK,EAAE,SAAS;YAChB,MAAM,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,CAAC,CAAkB;IAC/C,OAAO,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC;AACxD,CAAC"}
@@ -22,8 +22,16 @@
22
22
  *
23
23
  * @packageDocumentation
24
24
  */
25
- /** Bump when a helper BODY changes: a changed body changes codex's `currentHash` ⇒ re-trust. */
26
- export declare const DZ_HOOK_HELPER_VERSION = 1;
25
+ /**
26
+ * Bump when a helper BODY changes: a changed body changes codex's `currentHash` ⇒ re-trust.
27
+ *
28
+ * 2 — the independent-QE fix round: the veto note stopped persisting the raw command line and the
29
+ * notes log/dir modes are now enforced on every write (finding 8).
30
+ * 3 — fix round 2: the note's `commandSynopsis` is a binary NAME or `(redacted)` — an
31
+ * env-assignment first token (`SECRET=xyz ssh …`) carried the credential the redaction removed
32
+ * everywhere else (R2-8).
33
+ */
34
+ export declare const DZ_HOOK_HELPER_VERSION = 3;
27
35
  /** Seconds. Probe-proven (spike S2): `timeout` is honored, the unset default is 600 s. */
28
36
  export declare const DZ_HOOK_TIMEOUT_SECONDS = 5;
29
37
  /** The wide matcher (AM-8). Narrowing needs a recorded live probe; the guard keys on the payload. */
@@ -132,6 +140,19 @@ export declare function parseCodexHookManifest(text: string): CodexHookManifest
132
140
  * in `unattributable`, and warned about. A hand-edited managed command therefore survives.
133
141
  */
134
142
  export declare function isDzManagedEntry(entry: unknown, manifest: CodexHookManifest | undefined): boolean;
143
+ /**
144
+ * Rebuild an OWNED entry from only the handlers that are NOT ours — per-HANDLER attribution.
145
+ *
146
+ * ADR-001 §5 promises that dz deletes only what it can prove it wrote. Attribution was applied to a
147
+ * whole MATCHER GROUP: a group holding one dz handler and one of the user's was removed (or
148
+ * replaced) wholesale, so a foreign handler was deleted by a rule written to protect it
149
+ * (independent review, finding 6). One dz handler in the group must cost exactly that handler.
150
+ *
151
+ * Returns `null` when every handler in the entry was ours (the entry itself is then dropped), and
152
+ * a rebuilt entry — same keys, same order, minus our handlers — when something foreign survives.
153
+ * A legacy FLAT entry (`{type, command}`) is one handler and has nothing to salvage.
154
+ */
155
+ export declare function retainForeignHandlers(entry: unknown, manifest: CodexHookManifest | undefined): unknown | null;
135
156
  /** Cheap resemblance test — drives the `unattributable` COUNT only, never a deletion. */
136
157
  export declare function looksLikeDzEntry(entry: unknown): boolean;
137
158
  export interface CodexRegistry {
@@ -211,6 +232,21 @@ export interface DriftReport {
211
232
  export declare function diffCodexHooks(currentText: string | undefined, entries: readonly ManagedEntry[], manifest: CodexHookManifest | undefined): DriftReport;
212
233
  /** codex's snake_case event spelling inside a trust key (MEASURED from `hooks/list`). */
213
234
  export declare function trustEventName(event: CodexHookEvent): string;
235
+ /**
236
+ * Compare two event spellings the way the runtime actually spells them.
237
+ *
238
+ * MEASURED, both on this machine, on the SAME response shape:
239
+ * - the trust KEY embeds `pre_tool_use` / `user_prompt_submit` (snake_case);
240
+ * - `hooks/list`'s `eventName` FIELD is `preToolUse` / `userPromptSubmit` on **codex-cli 0.148.0**
241
+ * (reproducer: `listCodexHooks(<temp home>)` after an install — the rows are printed verbatim in
242
+ * `07_code_changes/probe-results/fixround/trust-diagnosis.txt`).
243
+ *
244
+ * Pinning either spelling alone silently drops every row: the fix round's first cut compared the
245
+ * field against the KEY spelling, `hooks/list` matched 0 of 2 entries, trust was never written, and
246
+ * the live probe's ARMED leg stopped blocking. Case and separators are therefore normalised away —
247
+ * the spelling is the runtime's cosmetic choice, the EVENT is the fact.
248
+ */
249
+ export declare function sameHookEvent(a: string, b: string): boolean;
214
250
  /**
215
251
  * The trust key codex uses: `<sourcePath>:<snake_event>:<groupIndex>:<hookIndex>`.
216
252
  *
@@ -219,6 +255,24 @@ export declare function trustEventName(event: CodexHookEvent): string;
219
255
  * nothing while reading like success.
220
256
  */
221
257
  export declare function expectedTrustKey(registryPath: string, event: CodexHookEvent, groupIndex: number, hookIndex: number): string;
258
+ /**
259
+ * Split a `hooks/list` trust key into its parts, or `null` when it is not one.
260
+ *
261
+ * MEASURED shape: `<sourcePath>:<snake_event>:<groupIndex>:<hookIndex>`. The path may itself carry
262
+ * a colon, so the split is anchored at the END — the last two fields are the indices and the third
263
+ * from the end is the event.
264
+ *
265
+ * The INDICES are deliberately not predicted: they are positions inside the user's registry, and a
266
+ * foreign entry shifts them. What IS ours to require is the rest — this key names OUR registry and
267
+ * OUR event (fix round 2, R2-7: a row carrying an arbitrary key was selected on path+event+command
268
+ * alone, and the key is what dz then writes trust against).
269
+ */
270
+ export declare function parseTrustKey(key: string): {
271
+ readonly sourcePath: string;
272
+ readonly event: string;
273
+ readonly groupIndex: number;
274
+ readonly hookIndex: number;
275
+ } | null;
222
276
  export interface HookTrustRow {
223
277
  readonly key: string;
224
278
  readonly trustedHash: string;
@@ -234,8 +288,24 @@ export declare const DZ_TRUST_END = "# --- end dz codex hooks trust ---";
234
288
  * nothing else.
235
289
  */
236
290
  export declare function renderTrustBlock(rows: readonly HookTrustRow[]): string;
237
- /** Replace (or append) dz's managed trust block, leaving every other byte of config.toml alone. */
238
- export declare function upsertTrustBlock(configToml: string, rows: readonly HookTrustRow[]): string;
291
+ export type TrustBlockResult = {
292
+ readonly ok: true;
293
+ readonly text: string;
294
+ } | {
295
+ readonly ok: false;
296
+ readonly error: string;
297
+ };
298
+ /**
299
+ * Replace (or append) dz's managed trust block, leaving every other byte of config.toml alone.
300
+ *
301
+ * The fence must be **exactly one well-ordered pair**, or dz refuses (independent review, finding
302
+ * 9). The old `indexOf`-pair logic was satisfiable by a damaged file in three ways, and each one
303
+ * eats the user's TOML on the NEXT sync: a lone BEGIN made the rewrite append a second block, so
304
+ * the following run's `begin…end` window spanned everything between the orphan marker and the new
305
+ * block's END; a reversed pair did the same; duplicate pairs left an orphan block behind. Refusing
306
+ * costs one manual edit — the alternative silently deletes `[projects."…"]` trust rows.
307
+ */
308
+ export declare function upsertTrustBlock(configToml: string, rows: readonly HookTrustRow[]): TrustBlockResult;
239
309
  export interface HooksListHookMetadata {
240
310
  readonly key: string;
241
311
  readonly eventName: string;
@@ -247,11 +317,24 @@ export interface HooksListHookMetadata {
247
317
  readonly enabled: boolean;
248
318
  readonly timeoutSec: number;
249
319
  }
320
+ export interface SelectOwnHookOptions {
321
+ /** The registry file dz wrote. A row from any other source path is not dz's row. */
322
+ readonly registryPath: string;
323
+ }
250
324
  /**
251
- * Pick, from a `hooks/list` response, the metadata of the entries WE wrote — matched on the exact
252
- * command string, so a third party's entry can never inherit dz's trust write.
325
+ * Pick, from a `hooks/list` response, the metadata of the entries WE wrote.
326
+ *
327
+ * The match is on THREE facts, not one (independent review, finding 7): the row's `sourcePath` is
328
+ * the registry dz wrote, its `eventName` is the event dz registered the entry under, and the
329
+ * command string is byte-equal. Command alone was not enough — a project-scoped
330
+ * `<repo>/.codex/hooks.json` DOES load on codex 0.148 (MEASURED, see ADR-004's addendum), so a
331
+ * shadow copy of dz's own command line could supply the `trusted` row that armed the user-global
332
+ * entry nobody had approved.
333
+ *
334
+ * AMBIGUITY IS REFUSED, not resolved: two rows claiming the same entry drop BOTH, because the one
335
+ * dz would arm is then a coin flip and the trust write is keyed by the row it picked.
253
336
  */
254
- export declare function selectOwnHookMetadata(hooks: readonly HooksListHookMetadata[], entries: readonly ManagedEntry[]): {
337
+ export declare function selectOwnHookMetadata(hooks: readonly HooksListHookMetadata[], entries: readonly ManagedEntry[], options: SelectOwnHookOptions): {
255
338
  readonly id: CodexHookId;
256
339
  readonly meta: HooksListHookMetadata;
257
340
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"codex-hooks.d.ts","sourceRoot":"","sources":["../src/codex-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,qGAAqG;AACrG,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,E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