@dzhechkov/harness-core 0.8.35 → 0.8.37

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 (135) hide show
  1. package/.dz-manifest.json +224 -104
  2. package/README.md +335 -10
  3. package/dist/agentdb-index.d.ts +87 -7
  4. package/dist/agentdb-index.d.ts.map +1 -1
  5. package/dist/agentdb-index.js +416 -57
  6. package/dist/agentdb-index.js.map +1 -1
  7. package/dist/apply-leg.d.ts +57 -1
  8. package/dist/apply-leg.d.ts.map +1 -1
  9. package/dist/apply-leg.js +450 -52
  10. package/dist/apply-leg.js.map +1 -1
  11. package/dist/codex-hooks-assets.d.ts.map +1 -1
  12. package/dist/codex-hooks-assets.js +67 -5
  13. package/dist/codex-hooks-assets.js.map +1 -1
  14. package/dist/codex-hooks.d.ts +13 -1
  15. package/dist/codex-hooks.d.ts.map +1 -1
  16. package/dist/codex-hooks.js +13 -1
  17. package/dist/codex-hooks.js.map +1 -1
  18. package/dist/codex-rollouts.d.ts +118 -0
  19. package/dist/codex-rollouts.d.ts.map +1 -0
  20. package/dist/codex-rollouts.js +297 -0
  21. package/dist/codex-rollouts.js.map +1 -0
  22. package/dist/cost-ledger.d.ts +56 -4
  23. package/dist/cost-ledger.d.ts.map +1 -1
  24. package/dist/cost-ledger.js +176 -20
  25. package/dist/cost-ledger.js.map +1 -1
  26. package/dist/cross-family-control.d.ts +345 -0
  27. package/dist/cross-family-control.d.ts.map +1 -0
  28. package/dist/cross-family-control.js +802 -0
  29. package/dist/cross-family-control.js.map +1 -0
  30. package/dist/debt-ratchet.d.ts +53 -0
  31. package/dist/debt-ratchet.d.ts.map +1 -0
  32. package/dist/debt-ratchet.js +107 -0
  33. package/dist/debt-ratchet.js.map +1 -0
  34. package/dist/embedding-config.d.ts +42 -0
  35. package/dist/embedding-config.d.ts.map +1 -1
  36. package/dist/embedding-config.js +106 -10
  37. package/dist/embedding-config.js.map +1 -1
  38. package/dist/feature-adr-checkpoints.d.ts +6 -0
  39. package/dist/feature-adr-checkpoints.d.ts.map +1 -1
  40. package/dist/feature-adr-checkpoints.js +29 -0
  41. package/dist/feature-adr-checkpoints.js.map +1 -1
  42. package/dist/feature-adr-decision-recall.d.ts +2 -2
  43. package/dist/feature-adr-decision-recall.d.ts.map +1 -1
  44. package/dist/feature-adr-decision-recall.js +5 -3
  45. package/dist/feature-adr-decision-recall.js.map +1 -1
  46. package/dist/feature-adr-envelope.d.ts +96 -0
  47. package/dist/feature-adr-envelope.d.ts.map +1 -0
  48. package/dist/feature-adr-envelope.js +183 -0
  49. package/dist/feature-adr-envelope.js.map +1 -0
  50. package/dist/feature-adr-routing.d.ts +64 -0
  51. package/dist/feature-adr-routing.d.ts.map +1 -1
  52. package/dist/feature-adr-routing.js +122 -2
  53. package/dist/feature-adr-routing.js.map +1 -1
  54. package/dist/feature-adr-stage-canon.d.ts +79 -0
  55. package/dist/feature-adr-stage-canon.d.ts.map +1 -0
  56. package/dist/feature-adr-stage-canon.js +117 -0
  57. package/dist/feature-adr-stage-canon.js.map +1 -0
  58. package/dist/index.d.ts +23 -12
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +15 -7
  61. package/dist/index.js.map +1 -1
  62. package/dist/loop-blobs.generated.js +4 -4
  63. package/dist/loop-blobs.generated.js.map +1 -1
  64. package/dist/mutation-gate.d.ts +51 -0
  65. package/dist/mutation-gate.d.ts.map +1 -1
  66. package/dist/mutation-gate.js +295 -0
  67. package/dist/mutation-gate.js.map +1 -1
  68. package/dist/operations.d.ts +1 -0
  69. package/dist/operations.d.ts.map +1 -1
  70. package/dist/operations.js +18 -2
  71. package/dist/operations.js.map +1 -1
  72. package/dist/publish.d.ts +59 -7
  73. package/dist/publish.d.ts.map +1 -1
  74. package/dist/publish.js +205 -32
  75. package/dist/publish.js.map +1 -1
  76. package/dist/qe-bridge.d.ts.map +1 -1
  77. package/dist/qe-bridge.js +4 -2
  78. package/dist/qe-bridge.js.map +1 -1
  79. package/dist/qe-findings.d.ts +107 -0
  80. package/dist/qe-findings.d.ts.map +1 -0
  81. package/dist/qe-findings.js +417 -0
  82. package/dist/qe-findings.js.map +1 -0
  83. package/dist/recap.d.ts +1 -1
  84. package/dist/recap.d.ts.map +1 -1
  85. package/dist/recap.js +4 -2
  86. package/dist/recap.js.map +1 -1
  87. package/dist/release-line.d.ts +16 -0
  88. package/dist/release-line.d.ts.map +1 -1
  89. package/dist/release-line.js +31 -0
  90. package/dist/release-line.js.map +1 -1
  91. package/dist/round.d.ts +74 -1
  92. package/dist/round.d.ts.map +1 -1
  93. package/dist/round.js +112 -4
  94. package/dist/round.js.map +1 -1
  95. package/dist/run-records.d.ts +60 -0
  96. package/dist/run-records.d.ts.map +1 -1
  97. package/dist/run-records.js +244 -2
  98. package/dist/run-records.js.map +1 -1
  99. package/dist/score.d.ts +44 -1
  100. package/dist/score.d.ts.map +1 -1
  101. package/dist/score.js +78 -5
  102. package/dist/score.js.map +1 -1
  103. package/dist/vector-tier.d.ts +34 -3
  104. package/dist/vector-tier.d.ts.map +1 -1
  105. package/dist/vector-tier.js +105 -14
  106. package/dist/vector-tier.js.map +1 -1
  107. package/package.json +2 -2
  108. package/sbom.json +403 -103
  109. package/src/agentdb-index.ts +423 -60
  110. package/src/apply-leg.ts +469 -50
  111. package/src/codex-hooks-assets.ts +67 -5
  112. package/src/codex-hooks.ts +13 -1
  113. package/src/codex-rollouts.ts +374 -0
  114. package/src/cost-ledger.ts +232 -24
  115. package/src/cross-family-control.ts +960 -0
  116. package/src/debt-ratchet.ts +143 -0
  117. package/src/embedding-config.ts +131 -10
  118. package/src/feature-adr-checkpoints.ts +29 -0
  119. package/src/feature-adr-decision-recall.ts +6 -4
  120. package/src/feature-adr-envelope.ts +242 -0
  121. package/src/feature-adr-routing.ts +139 -2
  122. package/src/feature-adr-stage-canon.ts +141 -0
  123. package/src/index.ts +66 -7
  124. package/src/loop-blobs.generated.ts +4 -4
  125. package/src/mutation-gate.ts +316 -0
  126. package/src/operations.ts +18 -3
  127. package/src/publish.ts +247 -30
  128. package/src/qe-bridge.ts +4 -2
  129. package/src/qe-findings.ts +463 -0
  130. package/src/recap.ts +10 -3
  131. package/src/release-line.ts +32 -0
  132. package/src/round.ts +165 -6
  133. package/src/run-records.ts +282 -2
  134. package/src/score.ts +115 -6
  135. package/src/vector-tier.ts +127 -14
@@ -0,0 +1,297 @@
1
+ /**
2
+ * A pure reader for Codex CLI rollout logs (feature `measurement-integrity`, ADR-001 D3).
3
+ *
4
+ * A `dz feature-adr-record --kind ledger` row for a Codex coder/reviewer stage carries
5
+ * `tokens: null` in 130 of 156 recorded rows (Step 0, 2026-09-16) even though the spend is sitting
6
+ * right there on disk: Codex writes one JSONL file per session at
7
+ * `~/.codex/sessions/YYYY/MM/DD/rollout-<ts>-<uuid>.jsonl`, and nothing in the pipeline reads it. The
8
+ * pipeline dispatches Codex without an explicit session id (`codex exec -C <repo> -m <id> …`), so the
9
+ * only way to join a ledger row to the rollout that produced it is a WINDOW match: the stage's own
10
+ * start/end time, its `cwd`, and its model.
11
+ *
12
+ * PURE — this module never opens `~/.codex/sessions` itself; the CLI reads the files and hands their
13
+ * TEXT to {@link parseCodexRollout}. It must never gain a `node:fs` import (the `core-boundary`
14
+ * ratchet, `test/core-boundary.test.ts`, pins the current file/import count).
15
+ *
16
+ * ## A measured schema correction (read before touching the parser)
17
+ *
18
+ * Step 0's assessment described the usage record as `type: "token_count"`, keyed
19
+ * `payload.info.total_token_usage`. A live probe of this machine's `~/.codex/sessions` (2026-09-16,
20
+ * `cli_version: "0.154.0"`, every rollout from the last two days) found NO such record — the CURRENT
21
+ * shape is `type: "token_usage_record"`, keyed `payload.usage`, with the same five sub-fields
22
+ * (`input_tokens`, `cached_input_tokens`, `output_tokens`, `reasoning_output_tokens`,
23
+ * `total_tokens`). The model id lives on `type: "turn_context"`'s `payload.model` (not on
24
+ * `session_meta`, as Step 0 assumed), and `cwd` is carried by BOTH `session_meta.payload.cwd` and
25
+ * `turn_context.payload.cwd`. Rather than build against a shape that no longer exists on this
26
+ * machine, {@link parseCodexRollout} accepts BOTH the documented legacy shape and the measured
27
+ * current one — Codex CLI versions drift the schema (C-2: this module depends on no version beyond
28
+ * the fields it reads), and a reader that understands only a shape nothing on disk still emits would
29
+ * fail FR-5 at the exact thing it exists to fix.
30
+ *
31
+ * @packageDocumentation
32
+ */
33
+ function isRecord(v) {
34
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
35
+ }
36
+ function nonEmptyString(v) {
37
+ return typeof v === 'string' && v.length > 0 ? v : null;
38
+ }
39
+ function finiteNonNegative(v) {
40
+ return typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : 0;
41
+ }
42
+ /** Epoch ms from a record's own `timestamp` (current schema) or `ts` (legacy/defensive), or `null`. */
43
+ function recordTimeMs(rec) {
44
+ const raw = rec['timestamp'] ?? rec['ts'];
45
+ if (typeof raw === 'number' && Number.isFinite(raw))
46
+ return raw;
47
+ if (typeof raw === 'string') {
48
+ const ms = Date.parse(raw);
49
+ return Number.isFinite(ms) ? ms : null;
50
+ }
51
+ return null;
52
+ }
53
+ function isoOrNull(ms) {
54
+ if (ms === null || !Number.isFinite(ms) || Math.abs(ms) > 8.64e15)
55
+ return null;
56
+ try {
57
+ return new Date(ms).toISOString();
58
+ }
59
+ catch {
60
+ return null;
61
+ }
62
+ }
63
+ /** Pull `{input_tokens, cached_input_tokens, output_tokens, reasoning_output_tokens, total_tokens}`
64
+ * (both schemas use these five field names) out of a usage-bearing sub-object. */
65
+ function totalsFrom(usage) {
66
+ return {
67
+ input: finiteNonNegative(usage['input_tokens']),
68
+ cachedInput: finiteNonNegative(usage['cached_input_tokens']),
69
+ output: finiteNonNegative(usage['output_tokens']),
70
+ reasoning: finiteNonNegative(usage['reasoning_output_tokens']),
71
+ total: finiteNonNegative(usage['total_tokens']),
72
+ };
73
+ }
74
+ /**
75
+ * Parse ONE rollout file's full text into a {@link CodexRollout}. Pure, never-throws; a corrupt line
76
+ * is skipped exactly the way `extractCostSamples` (`cost-ledger.ts`) skips one.
77
+ *
78
+ * `fileName`, when given, is used ONLY as a last-resort `id` source (the `rollout-<ts>-<uuid>.jsonl`
79
+ * name's own uuid) when no `session_meta` record carried one — never trusted over the file's own
80
+ * content.
81
+ */
82
+ export function parseCodexRollout(text, fileName) {
83
+ if (typeof text !== 'string' || text.trim().length === 0) {
84
+ return { error: 'empty rollout text' };
85
+ }
86
+ let id = null;
87
+ let cwd = null;
88
+ let sessionMetaModel = null;
89
+ let turnContextModel = null;
90
+ let firstMs = null;
91
+ let lastMs = null;
92
+ let lastTotals = null;
93
+ let sawAnyRecord = false;
94
+ const closedTurns = [];
95
+ let open = null;
96
+ let unmatchableTurns = 0;
97
+ const closeOpenTurn = (endMs) => {
98
+ if (open === null)
99
+ return;
100
+ if (open.startedMs === null || endMs === null)
101
+ unmatchableTurns += 1;
102
+ closedTurns.push({
103
+ model: open.model,
104
+ cwd: open.cwd,
105
+ startedAt: open.startedMs === null ? null : isoOrNull(open.startedMs),
106
+ endedAt: endMs === null ? null : isoOrNull(endMs),
107
+ totals: open.totals,
108
+ });
109
+ };
110
+ const deltaTotals = (now, base) => {
111
+ if (base === null)
112
+ return now;
113
+ const d = (a, b) => (a - b >= 0 ? a - b : a); // a counter that went DOWN is per-record, not cumulative
114
+ return { input: d(now.input, base.input), cachedInput: d(now.cachedInput, base.cachedInput), output: d(now.output, base.output), reasoning: d(now.reasoning, base.reasoning), total: d(now.total, base.total) };
115
+ };
116
+ for (const line of text.split('\n')) {
117
+ if (line.length === 0)
118
+ continue;
119
+ let rec;
120
+ try {
121
+ rec = JSON.parse(line);
122
+ }
123
+ catch {
124
+ continue; // corrupt line — skip, never throw
125
+ }
126
+ if (!isRecord(rec))
127
+ continue;
128
+ sawAnyRecord = true;
129
+ const ms = recordTimeMs(rec);
130
+ if (ms !== null) {
131
+ firstMs = firstMs === null ? ms : Math.min(firstMs, ms);
132
+ lastMs = lastMs === null ? ms : Math.max(lastMs, ms);
133
+ }
134
+ const type = rec['type'];
135
+ const payload = isRecord(rec['payload']) ? rec['payload'] : null;
136
+ if (payload === null)
137
+ continue;
138
+ if (type === 'session_meta') {
139
+ if (id === null)
140
+ id = nonEmptyString(payload['session_id']) ?? nonEmptyString(payload['id']);
141
+ if (cwd === null)
142
+ cwd = nonEmptyString(payload['cwd']);
143
+ // Step 0's documented (legacy, not observed live on this machine) shape put `model` directly on
144
+ // `session_meta` — accepted here too, but `turnContextModel` always wins at the end (below)
145
+ // since that is what the measured current schema actually carries.
146
+ if (sessionMetaModel === null)
147
+ sessionMetaModel = nonEmptyString(payload['model']);
148
+ }
149
+ else if (type === 'turn_context') {
150
+ if (turnContextModel === null)
151
+ turnContextModel = nonEmptyString(payload['model']);
152
+ if (cwd === null)
153
+ cwd = nonEmptyString(payload['cwd']);
154
+ // Close the previous open turn AT this boundary (even when the boundary has no timestamp —
155
+ // the previous turn must stop absorbing usage), then open the new one.
156
+ closeOpenTurn(ms);
157
+ open = { model: nonEmptyString(payload['model']), cwd: nonEmptyString(payload['cwd']) ?? cwd, startedMs: ms, baseline: lastTotals, totals: null };
158
+ }
159
+ // Legacy shape (Step 0's documented one, not observed live on this machine 2026-09-16):
160
+ // `type: "token_count"`, `payload.info.total_token_usage`.
161
+ if (type === 'token_count') {
162
+ const info = isRecord(payload['info']) ? payload['info'] : null;
163
+ const usage = info !== null && isRecord(info['total_token_usage']) ? info['total_token_usage'] : null;
164
+ if (usage !== null) {
165
+ const t = totalsFrom(usage);
166
+ if (open !== null)
167
+ open.totals = deltaTotals(t, open.baseline);
168
+ lastTotals = t;
169
+ }
170
+ }
171
+ // Current shape (measured live, cli_version 0.154.0): `type: "token_usage_record"`,
172
+ // `payload.usage`.
173
+ if (type === 'token_usage_record') {
174
+ const usage = isRecord(payload['usage']) ? payload['usage'] : null;
175
+ if (usage !== null) {
176
+ const t = totalsFrom(usage);
177
+ if (open !== null)
178
+ open.totals = deltaTotals(t, open.baseline);
179
+ lastTotals = t;
180
+ }
181
+ }
182
+ }
183
+ if (open !== null && lastMs !== null)
184
+ closeOpenTurn(lastMs);
185
+ if (!sawAnyRecord)
186
+ return { error: 'no parseable JSON lines in rollout text' };
187
+ if (id === null) {
188
+ // Last resort: the uuid embedded in `rollout-<ts>-<uuid>.jsonl` — never invented, only read back.
189
+ // A plain "greedy dash" regex would stop at the uuid's OWN internal dashes (its 8-4-4-4-12 hex
190
+ // groups), so this matches the canonical uuid shape explicitly rather than "everything after the
191
+ // last dash".
192
+ const m = typeof fileName === 'string'
193
+ ? /([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\.jsonl$/.exec(fileName)
194
+ : null;
195
+ id = m !== null ? (m[1] ?? null) : null;
196
+ }
197
+ if (id === null)
198
+ return { error: 'no session_meta record and no id in fileName — cannot identify this rollout' };
199
+ if (lastTotals === null) {
200
+ return { error: 'no token_count or token_usage_record entry — nothing to attribute' };
201
+ }
202
+ return {
203
+ id,
204
+ cwd,
205
+ model: turnContextModel ?? sessionMetaModel,
206
+ startedAt: isoOrNull(firstMs),
207
+ endedAt: isoOrNull(lastMs),
208
+ totals: lastTotals,
209
+ granularity: closedTurns.length > 0 ? 'turn' : 'session',
210
+ unmatchableTurns,
211
+ turns: closedTurns,
212
+ };
213
+ }
214
+ /**
215
+ * measurement-integrity fix-round-1/F5 (Codex r1 HIGH #5): every candidate window `matchCodexRollouts`
216
+ * may attribute spend to, at the SHARPEST granularity `parseCodexRollout` could recover from the
217
+ * file. For a `granularity: 'turn'` rollout this is one candidate PER TURN THAT ACTUALLY CARRIES
218
+ * USAGE (a turn nothing was ever attributed to yields no candidate — there is nothing honest to
219
+ * report for it); for `granularity: 'session'` it is exactly one candidate, the whole file, exactly
220
+ * as this reader behaved before this fix.
221
+ *
222
+ * This is the fix for the CRITICAL scenario the Codex review named: the OLD matcher tested the
223
+ * whole session's `[startedAt, endedAt]` against the query window, so ANY brief overlap with that wide
224
+ * interval could attribute an entire multi-turn session's cumulative spend (and, potentially, another
225
+ * turn's DIFFERENT model) to one stage. Scoping candidates to turns means two turns of the SAME
226
+ * session that only one of them overlaps the window can no longer collide — and two turns that BOTH
227
+ * overlap it correctly produce two candidates, which the caller below turns into `ambiguous` rather
228
+ * than an arbitrary pick (this is also where "the model of every usage-bearing turn matching a window
229
+ * must agree" ends up enforced: two turns with different models can only both match by being two
230
+ * SEPARATE candidates, which is ambiguous by construction — there is no path where a mismatch is
231
+ * silently resolved to one of them).
232
+ */
233
+ function candidateViewsOf(r) {
234
+ if (r.granularity === 'session')
235
+ return [r];
236
+ const out = [];
237
+ for (const turn of r.turns) {
238
+ if (turn.totals === null)
239
+ continue; // nothing was ever attributed to this turn — not a candidate
240
+ out.push({
241
+ id: r.id,
242
+ unmatchableTurns: r.unmatchableTurns,
243
+ cwd: turn.cwd,
244
+ model: turn.model,
245
+ startedAt: turn.startedAt,
246
+ endedAt: turn.endedAt,
247
+ totals: turn.totals,
248
+ granularity: 'turn',
249
+ turns: [turn],
250
+ });
251
+ }
252
+ return out;
253
+ }
254
+ /**
255
+ * Which candidate VIEWS (session-level, or — per {@link candidateViewsOf} — turn-level whenever the
256
+ * schema recovered turn boundaries) have an interval that OVERLAPS the given `[from, to]` window
257
+ * (never nearest-in-time — ADR-001 D3 rejects "closest by clock" because two reviews back to back
258
+ * would attribute one's spend to the other). A candidate with no parseable timestamps never matches —
259
+ * an unattributable interval is not a wildcard.
260
+ *
261
+ * `0` matches → `{status:'none'}`. `1` → `{status:'one', rollout}`. `>1` → `{status:'ambiguous',
262
+ * candidates}` — NEVER an arbitrary pick of "the first" (NFR-3). `>1` also covers the case where two
263
+ * DIFFERENT turns (of the same or different rollouts) overlap the window with different models — that
264
+ * disagreement can never resolve to a lone `'one'`, it always surfaces as `'ambiguous'`.
265
+ */
266
+ export function matchCodexRollouts(rollouts, window) {
267
+ const fromMs = Date.parse(window.from);
268
+ const toMs = Date.parse(window.to);
269
+ if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || fromMs > toMs)
270
+ return { status: 'none' };
271
+ const candidates = [];
272
+ for (const r of rollouts) {
273
+ for (const view of candidateViewsOf(r)) {
274
+ if (view.startedAt === null || view.endedAt === null)
275
+ continue;
276
+ const startMs = Date.parse(view.startedAt);
277
+ const endMs = Date.parse(view.endedAt);
278
+ if (!Number.isFinite(startMs) || !Number.isFinite(endMs))
279
+ continue;
280
+ // Lead delta after Codex r2 (#5): the turn must START inside the window — a turn that merely
281
+ // brushes the window's edge (any-overlap) is exactly how a neighbouring dispatch's turn leaks in.
282
+ if (startMs < fromMs || startMs > toMs)
283
+ continue;
284
+ if (window.cwd !== undefined && view.cwd !== window.cwd)
285
+ continue;
286
+ if (window.model !== undefined && view.model !== window.model)
287
+ continue;
288
+ candidates.push(view);
289
+ }
290
+ }
291
+ if (candidates.length === 0)
292
+ return { status: 'none' };
293
+ if (candidates.length === 1)
294
+ return { status: 'one', rollout: candidates[0] };
295
+ return { status: 'ambiguous', candidates };
296
+ }
297
+ //# sourceMappingURL=codex-rollouts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-rollouts.js","sourceRoot":"","sources":["../src/codex-rollouts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AASH,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,cAAc,CAAC,CAAU;IAChC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,C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E,UAAU,EAAE,CAAC;AAC7C,CAAC"}
@@ -47,6 +47,7 @@
47
47
  *
48
48
  * @packageDocumentation
49
49
  */
50
+ import type { CanonicalStage } from './feature-adr-stage-canon.js';
50
51
  /** The one sentence that states what the ledger is and is not. Printed by EVERY surface (ADR-003). */
51
52
  export declare const COST_LEDGER_SCOPE: string;
52
53
  export type CostLedgerDefectKind =
@@ -70,10 +71,16 @@ export type CostLedgerDefectKind =
70
71
  */
71
72
  export declare const COST_LEDGER_DEFECT_KINDS: readonly CostLedgerDefectKind[];
72
73
  /**
73
- * Three values, not two. `INSUFFICIENT_DATA` is NOT success: a caller must not read
74
- * `verdict !== 'DEFECT'` as "reconciled" (ADR-003).
74
+ * Four values, not two (measurement-integrity ADR-001 D2 grew this from three). `INSUFFICIENT_DATA`
75
+ * is NOT success: a caller must not read `verdict !== 'DEFECT'` as "reconciled" (ADR-003).
76
+ * `INCOMPLETE_INVENTORY` is likewise not success — it names the SPECIFIC case where every unaccounted
77
+ * token traces to a named orphan transcript (a directory listing the record's own inventory does not
78
+ * know about), with no OTHER attribution defect present. It outranks `BALANCED` (an orphan transcript
79
+ * can never read as balanced) and is outranked by `DEFECT` (a genuine attribution defect — double
80
+ * counting, a foreign sample, spend unaccounted for reasons OTHER than a named orphan — is a worse
81
+ * finding than "the inventory is incomplete but everything it does have reconciles").
75
82
  */
76
- export type CostLedgerVerdict = 'BALANCED' | 'DEFECT' | 'INSUFFICIENT_DATA';
83
+ export type CostLedgerVerdict = 'BALANCED' | 'DEFECT' | 'INCOMPLETE_INVENTORY' | 'INSUFFICIENT_DATA';
77
84
  export declare const COST_LEDGER_VERDICTS: readonly CostLedgerVerdict[];
78
85
  /**
79
86
  * Default reconciliation tolerance, as a FRACTION of the run total. Zero, because the arithmetic is
@@ -128,6 +135,17 @@ export interface CostLedgerRow {
128
135
  readonly slug: string | null;
129
136
  /** `stageLabel()` output, verbatim. */
130
137
  readonly stage: string;
138
+ /** measurement-integrity FR-2/ADR-001 D1: the canonical bucket `stage` classifies into, NEXT TO
139
+ * the untouched verbatim `stage` — never a replacement for it. `'unknown'` when no rule matches. */
140
+ readonly stageCanonical: CanonicalStage | 'unknown';
141
+ /** measurement-integrity FR-4: 1-based position of THIS occurrence among stage entries that share
142
+ * `stage`'s exact label, in record order — `attempt: 1, attempts: 1` when the label occurs once. */
143
+ readonly attempt: number;
144
+ /** Total number of stage entries in this run that share `stage`'s exact label. A repeated label no
145
+ * longer merges silently into one row (ADR-001 D... measurement-integrity FR-4): each occurrence
146
+ * is its OWN row, and every one of them carries the same `attempts` count so a reader grouping by
147
+ * `stage` can tell there were several without re-deriving it. */
148
+ readonly attempts: number;
131
149
  readonly phase: string | null;
132
150
  /** The stage's model id, or `'mixed'` when several agents share a label with different models. */
133
151
  readonly model: string;
@@ -172,6 +190,18 @@ export interface CostLedgerReconciliation {
172
190
  readonly identityHolds: boolean;
173
191
  readonly verdict: CostLedgerVerdict;
174
192
  readonly defects: readonly CostLedgerDefect[];
193
+ /** measurement-integrity FR-3/ADR-001 D2: transcripts present in the run's directory that have NO
194
+ * `workflowProgress[]` entry in the record — named explicitly rather than dissolved into a generic
195
+ * `unaccountedTokens` remainder. `method: 'per-transcript'` means `tokens` is an exact sum over
196
+ * each orphan's own extracted samples; `'count-fallback'` means only the COUNT (and, where
197
+ * available, the ids) is known and `tokens` falls back to the reconciliation's own
198
+ * `unaccountedTokens` as the best available estimate — always present, always additive. */
199
+ readonly orphanTranscripts: {
200
+ readonly count: number;
201
+ readonly tokens: number;
202
+ readonly ids: readonly string[];
203
+ readonly method: 'per-transcript' | 'count-fallback';
204
+ };
175
205
  }
176
206
  export interface CostLedgerReport {
177
207
  readonly runId: string;
@@ -180,6 +210,16 @@ export interface CostLedgerReport {
180
210
  readonly status: string | null;
181
211
  readonly startedTs: string | null;
182
212
  readonly rows: readonly CostLedgerRow[];
213
+ /** measurement-integrity FR-2/T1: rows re-aggregated by `stageCanonical`, plus two synthetic
214
+ * buckets — `unknown` (rows whose verbatim label matched no canon rule) and `unattributed` (the
215
+ * orphan-transcript tokens from `reconciliation.orphanTranscripts`, which belong to no stage row
216
+ * at all). Every one of the 12 {@link CanonicalStage} values is always present, even at zero, so a
217
+ * reader can iterate a stable key set. */
218
+ readonly byCanonicalStage: Record<CanonicalStage | 'unknown' | 'unattributed', {
219
+ readonly tokens: number;
220
+ readonly agents: number;
221
+ readonly attempts: number;
222
+ }>;
183
223
  readonly reconciliation: CostLedgerReconciliation;
184
224
  /** The record's cached raw sum — reported, never the invariant's right-hand side (ADR-002). */
185
225
  readonly recordTotalTokens: number | null;
@@ -232,8 +272,20 @@ export interface BuildCostLedgerInput {
232
272
  }[];
233
273
  /** RIGHT side — the dedup-union over the run's transcript DIRECTORY (ADR-002). */
234
274
  readonly runSamples: readonly CostLedgerSample[];
235
- /** Agent transcripts present in the run directory with no `workflowProgress[]` entry. */
275
+ /** Agent transcripts present in the run directory with no `workflowProgress[]` entry — ids only.
276
+ * Kept for the `Unaccounted` defect's `subjects` listing; superseded by `orphanTranscripts` below
277
+ * for the FR-3 `orphanTranscripts.tokens` figure whenever the caller can supply per-orphan samples. */
236
278
  readonly orphanAgentIds?: readonly string[];
279
+ /** measurement-integrity FR-3: the SAME orphan transcripts as `orphanAgentIds`, but carrying each
280
+ * one's own extracted samples so `reconciliation.orphanTranscripts.tokens` is an EXACT sum rather
281
+ * than a derived remainder. When omitted, `orphanAgentIds` alone still produces a named
282
+ * `orphanTranscripts` entry (`method: 'count-fallback'`, `tokens` = the reconciliation's own
283
+ * `unaccountedTokens` as the best available estimate) — the count/ids are never lost even without
284
+ * the precise per-transcript figure. */
285
+ readonly orphanTranscripts?: readonly {
286
+ readonly agentId: string;
287
+ readonly samples: readonly CostLedgerSample[];
288
+ }[];
237
289
  /** Fraction of the run total tolerated as unaccounted. Default {@link DEFAULT_COST_LEDGER_EPSILON}. */
238
290
  readonly epsilon?: number;
239
291
  /** True when the transcript listing hit the file cap — the run total is incomplete (Codex QE HIGH). */
@@ -1 +1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