@agent-ix/quoin 0.21.8 → 0.22.5

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 (116) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/default-modules.yaml +18 -2
  4. package/dist/{advisor-COB2SuIj.js → advisor-BkgwDKvQ.js} +1 -1
  5. package/dist/auditor/audit.d.ts +23 -18
  6. package/dist/auditor/audit.d.ts.map +1 -1
  7. package/dist/auditor/index.d.ts +2 -1
  8. package/dist/auditor/index.d.ts.map +1 -1
  9. package/dist/{auditor-ww0MC62a.js → auditor-C3bSmPD_.js} +82 -65
  10. package/dist/{base-DNieRzIg.js → base-CqKNs2Kd.js} +1 -1
  11. package/dist/cli.js +1 -1
  12. package/dist/commands/advise.js +16 -15
  13. package/dist/commands/assurance.d.ts.map +1 -1
  14. package/dist/commands/assurance.js +84 -61
  15. package/dist/commands/catalog/list.js +2 -2
  16. package/dist/commands/catalog/methods.js +3 -3
  17. package/dist/commands/catalog/show.js +2 -2
  18. package/dist/commands/catalog/validate.js +2 -2
  19. package/dist/commands/completeness.js +2 -2
  20. package/dist/commands/config/doctor.d.ts.map +1 -1
  21. package/dist/commands/config/doctor.js +3 -3
  22. package/dist/commands/config/edit.d.ts.map +1 -1
  23. package/dist/commands/config/edit.js +3 -3
  24. package/dist/commands/config/get.js +1 -1
  25. package/dist/commands/config/set.js +1 -1
  26. package/dist/commands/evidence/affirm.js +6 -5
  27. package/dist/commands/evidence/audit.d.ts.map +1 -1
  28. package/dist/commands/evidence/audit.js +57 -45
  29. package/dist/commands/evidence/baseline.d.ts.map +1 -1
  30. package/dist/commands/evidence/baseline.js +52 -42
  31. package/dist/commands/evidence/gc.js +3 -2
  32. package/dist/commands/evidence/index.js +1 -1
  33. package/dist/commands/evidence/inspect-mocks.d.ts +16 -0
  34. package/dist/commands/evidence/inspect-mocks.d.ts.map +1 -0
  35. package/dist/commands/evidence/inspect-mocks.js +49 -0
  36. package/dist/commands/evidence/record.d.ts +1 -0
  37. package/dist/commands/evidence/record.d.ts.map +1 -1
  38. package/dist/commands/evidence/record.js +42 -31
  39. package/dist/commands/matrix.js +1 -1
  40. package/dist/commands/measurement/index.d.ts +7 -0
  41. package/dist/commands/measurement/index.d.ts.map +1 -0
  42. package/dist/commands/measurement/index.js +11 -0
  43. package/dist/commands/measurement/record.d.ts +10 -0
  44. package/dist/commands/measurement/record.d.ts.map +1 -0
  45. package/dist/commands/measurement/record.js +35 -0
  46. package/dist/commands/module/ensure-defaults.js +3 -3
  47. package/dist/commands/module/install.js +2 -2
  48. package/dist/commands/module/list.js +2 -2
  49. package/dist/commands/module/remove.js +2 -2
  50. package/dist/commands/report.d.ts +15 -0
  51. package/dist/commands/report.d.ts.map +1 -0
  52. package/dist/commands/report.js +70 -0
  53. package/dist/commands/review.js +1 -1
  54. package/dist/commands/to-plan.js +1 -1
  55. package/dist/commands/update.js +2 -2
  56. package/dist/commands/validate.d.ts +13 -0
  57. package/dist/commands/validate.d.ts.map +1 -0
  58. package/dist/commands/validate.js +123 -0
  59. package/dist/commands/write.js +3 -3
  60. package/dist/{completeness-F657dxMp.js → completeness-DamWradt.js} +1 -1
  61. package/dist/evidence/index.d.ts +3 -2
  62. package/dist/evidence/index.d.ts.map +1 -1
  63. package/dist/evidence/mock-inspection.d.ts +16 -0
  64. package/dist/evidence/mock-inspection.d.ts.map +1 -0
  65. package/dist/evidence/store.d.ts +11 -1
  66. package/dist/evidence/store.d.ts.map +1 -1
  67. package/dist/evidence/types.d.ts +31 -0
  68. package/dist/evidence/types.d.ts.map +1 -1
  69. package/dist/{evidence-BA5vyZJk.js → evidence-DD0CHzJ0.js} +246 -316
  70. package/dist/{flow-command-D1vJU-7a.js → flow-command-BfFNY0Rv.js} +1 -1
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +9 -8
  74. package/dist/measurement/compare.d.ts +4 -0
  75. package/dist/measurement/compare.d.ts.map +1 -0
  76. package/dist/measurement/index.d.ts +9 -0
  77. package/dist/measurement/index.d.ts.map +1 -0
  78. package/dist/measurement/plans.d.ts +4 -0
  79. package/dist/measurement/plans.d.ts.map +1 -0
  80. package/dist/measurement/portfolio.d.ts +48 -0
  81. package/dist/measurement/portfolio.d.ts.map +1 -0
  82. package/dist/measurement/profiles.d.ts +9 -0
  83. package/dist/measurement/profiles.d.ts.map +1 -0
  84. package/dist/measurement/report.d.ts +44 -0
  85. package/dist/measurement/report.d.ts.map +1 -0
  86. package/dist/measurement/store.d.ts +7 -0
  87. package/dist/measurement/store.d.ts.map +1 -0
  88. package/dist/measurement/types.d.ts +83 -0
  89. package/dist/measurement/types.d.ts.map +1 -0
  90. package/dist/measurement/validate.d.ts +9 -0
  91. package/dist/measurement/validate.d.ts.map +1 -0
  92. package/dist/measurement-CzB74Q07.js +595 -0
  93. package/dist/{modules-BWyZ7kVN.js → modules-ez9httBA.js} +2 -2
  94. package/dist/{plugins-Czi2OyDB.js → plugins-C-ta0llj.js} +1 -1
  95. package/dist/quire/contract.d.ts +11 -12
  96. package/dist/quire/contract.d.ts.map +1 -1
  97. package/dist/quire/exec.d.ts +10 -0
  98. package/dist/quire/exec.d.ts.map +1 -1
  99. package/dist/quire/index.d.ts +2 -2
  100. package/dist/quire/index.d.ts.map +1 -1
  101. package/dist/quire/types.d.ts +119 -1
  102. package/dist/quire/types.d.ts.map +1 -1
  103. package/dist/{quire-UzoK3Azf.js → quire-D8tCpgyA.js} +526 -499
  104. package/dist/schemas/coverage-v1.schema.json +919 -105
  105. package/dist/schemas/properties-v1.schema.json +25 -0
  106. package/dist/store--2sAv12X.js +219 -0
  107. package/dist/validators/gates.d.ts +18 -0
  108. package/dist/validators/gates.d.ts.map +1 -0
  109. package/dist/validators/index.d.ts +2 -0
  110. package/dist/validators/index.d.ts.map +1 -0
  111. package/dist/{version-G_RI6TD4.js → version-Dg0e6CZU.js} +1 -1
  112. package/dist/{write-BJ9rTVAS.js → write-DElwS9xc.js} +1 -1
  113. package/package.json +22 -16
  114. package/skills/assurance-status-report/SKILL.md +135 -0
  115. package/skills/assurance-status-report/references/report-contract.md +110 -0
  116. package/skills/spec-architecture-evaluation/SKILL.md +30 -0
@@ -0,0 +1,595 @@
1
+ import { h as e, i as t } from "./store--2sAv12X.js";
2
+ import { existsSync as n, mkdirSync as r, readFileSync as i, readdirSync as a, renameSync as o, statSync as s, unlinkSync as c, writeFileSync as l } from "node:fs";
3
+ import { basename as u, dirname as ee, isAbsolute as d, join as f, relative as p, resolve as m } from "node:path";
4
+ import { parse as h } from "yaml";
5
+ import { randomUUID as g } from "node:crypto";
6
+ //#region src/measurement/compare.ts
7
+ function _(e, t) {
8
+ let n = y(e.observations), r = y(t.observations);
9
+ return [.../* @__PURE__ */ new Set([...n.keys(), ...r.keys()])].sort(S).map((i) => {
10
+ let a = n.get(i), o = r.get(i), s = a ?? o;
11
+ if (!a || !o || a.state === "not_computed" || o.state === "not_computed") return {
12
+ metric: s.metric,
13
+ dimensions: s.dimensions ?? {},
14
+ before: a?.value ?? null,
15
+ after: o?.value ?? null,
16
+ delta: null,
17
+ status: "not_computed",
18
+ reasons: []
19
+ };
20
+ let c = [];
21
+ a.definitionVersion !== o.definitionVersion && c.push({
22
+ code: "definition_changed",
23
+ blocking: !0,
24
+ message: `${a.metric}: definition moved ${a.definitionVersion} -> ${o.definitionVersion}`
25
+ }), e.configDigest !== t.configDigest && c.push({
26
+ code: "configuration_changed",
27
+ blocking: !0,
28
+ message: `${a.metric}: producer configuration moved ${e.configDigest} -> ${t.configDigest}`
29
+ }), (v(a) || v(o)) && c.push({
30
+ code: "incomplete_population",
31
+ blocking: !0,
32
+ message: `${a.metric}: ratio matched none of a non-empty examined population, or collection marked it incomplete`
33
+ }), x(a) !== x(o) && c.push({
34
+ code: "population_changed",
35
+ blocking: !1,
36
+ message: `${a.metric}: population changed; delta is shown with this warning`
37
+ }), e.toolVersion !== t.toolVersion && c.push({
38
+ code: "tool_changed",
39
+ blocking: !1,
40
+ message: `${a.metric}: tool moved ${e.toolVersion} -> ${t.toolVersion}`
41
+ });
42
+ let l = c.some((e) => e.blocking);
43
+ return {
44
+ metric: a.metric,
45
+ dimensions: a.dimensions ?? {},
46
+ before: a.value,
47
+ after: o.value,
48
+ delta: l ? null : o.value - a.value,
49
+ status: l ? "incomparable" : "comparable",
50
+ reasons: c
51
+ };
52
+ });
53
+ }
54
+ function v(e) {
55
+ return e.population?.complete === void 0 ? e.shape === "ratio" && (e.population?.examined ?? 0) > 0 && e.population?.matched === 0 : !e.population.complete;
56
+ }
57
+ function y(e) {
58
+ return new Map(e.map((e) => [b(e), e]));
59
+ }
60
+ function b(e) {
61
+ return `${e.metric}\0${JSON.stringify(Object.entries(e.dimensions ?? {}).sort(([e], [t]) => S(e, t)))}`;
62
+ }
63
+ function x(e) {
64
+ return JSON.stringify(e.population ?? null);
65
+ }
66
+ function S(e, t) {
67
+ return e === t ? 0 : e < t ? -1 : 1;
68
+ }
69
+ //#endregion
70
+ //#region src/measurement/plans.ts
71
+ var C = /* @__PURE__ */ new Set([
72
+ "observe",
73
+ "baseline",
74
+ "branch-comparison",
75
+ "trend",
76
+ "ratchet",
77
+ "target",
78
+ "gate"
79
+ ]);
80
+ function w(e) {
81
+ return te(e).map((t) => ne(t, e)).filter((e) => e !== null).sort((e, t) => T(e.metric, t.metric) || T(e.id, t.id));
82
+ }
83
+ function te(e) {
84
+ return [f(e, "spec", "assurance"), f(e, "assurance")].filter(n).flatMap(re).sort(T);
85
+ }
86
+ function ne(e, t) {
87
+ let n = i(e, "utf8"), r = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(n);
88
+ if (!r) return null;
89
+ let a = h(r[1]);
90
+ if (a.type !== "MeasurementPlan") return null;
91
+ for (let t of [
92
+ "id",
93
+ "title",
94
+ "status",
95
+ "stage",
96
+ "metric",
97
+ "definition_version"
98
+ ]) if (typeof a[t] != "string" || a[t].length === 0) throw Error(`${e}: MeasurementPlan requires non-empty \`${t}\``);
99
+ if (!C.has(a.stage)) throw Error(`${e}: unknown measurement stage \`${String(a.stage)}\``);
100
+ let o = a.status;
101
+ if (!(/* @__PURE__ */ new Set([
102
+ "proposed",
103
+ "active",
104
+ "retired"
105
+ ])).has(o)) throw Error(`${e}: unknown MeasurementPlan status \`${String(a.status)}\``);
106
+ return {
107
+ id: a.id,
108
+ title: a.title,
109
+ status: o,
110
+ stage: a.stage,
111
+ metric: a.metric,
112
+ definitionVersion: a.definition_version,
113
+ path: d(e) ? p(t, e) : e
114
+ };
115
+ }
116
+ function re(e) {
117
+ let t = [], n = [e];
118
+ for (; n.length > 0;) {
119
+ let e = n.pop();
120
+ for (let r of a(e, { withFileTypes: !0 })) {
121
+ let i = f(e, r.name);
122
+ r.isDirectory() ? n.push(i) : r.isFile() && r.name.endsWith(".md") && t.push(i);
123
+ }
124
+ }
125
+ return t.sort(T);
126
+ }
127
+ function T(e, t) {
128
+ return e === t ? 0 : e < t ? -1 : 1;
129
+ }
130
+ //#endregion
131
+ //#region src/measurement/profiles.ts
132
+ function E(e) {
133
+ return D(e).map((t) => O(t, e)).filter((e) => e !== null && e.status === "active").sort((e, t) => A(e.id, t.id) || A(e.path, t.path));
134
+ }
135
+ function D(e) {
136
+ return [f(e, "spec", "assurance"), f(e, "assurance")].filter(n).flatMap(k).sort(A);
137
+ }
138
+ function O(e, t) {
139
+ let n = i(e, "utf8"), r = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(n);
140
+ if (!r) return null;
141
+ let a = h(r[1]);
142
+ if (a.type !== "AssuranceProfile") return null;
143
+ for (let t of [
144
+ "id",
145
+ "title",
146
+ "status"
147
+ ]) if (typeof a[t] != "string" || a[t].length === 0) throw Error(`${e}: AssuranceProfile requires non-empty \`${t}\``);
148
+ let o = a.status;
149
+ if (!(/* @__PURE__ */ new Set([
150
+ "proposed",
151
+ "active",
152
+ "retired"
153
+ ])).has(o)) throw Error(`${e}: unknown AssuranceProfile status \`${o}\``);
154
+ return {
155
+ id: a.id,
156
+ title: a.title,
157
+ status: o,
158
+ path: p(t, e)
159
+ };
160
+ }
161
+ function k(e) {
162
+ let t = [], n = [e];
163
+ for (; n.length > 0;) {
164
+ let e = n.pop();
165
+ for (let r of a(e, { withFileTypes: !0 })) {
166
+ let i = f(e, r.name);
167
+ r.isDirectory() ? n.push(i) : r.isFile() && r.name.endsWith(".md") && t.push(i);
168
+ }
169
+ }
170
+ return t.sort(A);
171
+ }
172
+ function A(e, t) {
173
+ return e === t ? 0 : e < t ? -1 : 1;
174
+ }
175
+ //#endregion
176
+ //#region src/measurement/types.ts
177
+ var j = 2, M = class extends Error {
178
+ constructor(e) {
179
+ super(e), this.name = "MeasurementValidationError";
180
+ }
181
+ };
182
+ function N(e, t) {
183
+ P(e), e.schemaVersion !== 2 && R("new collections must use schemaVersion 2; v1 is read-only historical evidence"), e.verificationStack?.buildProfile !== "release" && R("verificationStack.buildProfile must be release for new collections");
184
+ let n = e.verificationStack.toolchains;
185
+ (!L(n) || [
186
+ "node",
187
+ "rust",
188
+ "python"
189
+ ].some((e) => typeof n[e] != "string" || !n[e])) && R("verificationStack.toolchains must pin node, rust, and python");
190
+ let r = new Map(t.map((e) => [e.metric, e]));
191
+ for (let t of e.observations) {
192
+ let e = r.get(t.metric);
193
+ e || R(`metric \`${t.metric}\` has no MeasurementPlan under spec/assurance or assurance; record refused`), e.status !== "active" && R(`metric \`${t.metric}\` plan ${e.id} is ${e.status}, not active`), t.planId !== e.id && R(`metric \`${t.metric}\` names plan ${t.planId}; active plan is ${e.id}`), t.definitionVersion !== e.definitionVersion && R(`metric \`${t.metric}\` definition ${t.definitionVersion} does not match ${e.definitionVersion}`);
194
+ }
195
+ }
196
+ function P(e) {
197
+ L(e) || R("collection must be an object"), e.schemaVersion !== 1 && e.schemaVersion !== 2 && R("schemaVersion must be 1 or 2");
198
+ for (let t of [
199
+ "collectionId",
200
+ "subject",
201
+ "toolIdentity",
202
+ "toolVersion",
203
+ "configDigest",
204
+ "timestamp",
205
+ "sourceRevision"
206
+ ]) (typeof e[t] != "string" || e[t].length === 0) && R(`collection requires non-empty \`${t}\``);
207
+ (!Array.isArray(e.observations) || e.observations.length === 0) && R("collection requires at least one observation"), L(e.environment) || R("environment must be an object"), "scope" in e || R("collection requires `scope`"), "rawEvidence" in e || R("collection requires attached `rawEvidence`"), e.schemaVersion === 2 && ie(e.verificationStack);
208
+ let t = /* @__PURE__ */ new Set();
209
+ for (let n of e.observations) {
210
+ F(n);
211
+ let e = `${n.metric}\0${I(n)}`;
212
+ t.has(e) && R(`duplicate observation for \`${n.metric}\` and its dimensions`), t.add(e);
213
+ }
214
+ }
215
+ function ie(e) {
216
+ L(e) || R("schemaVersion 2 requires `verificationStack`"), e.schemaVersion !== "verification-stack-attestation-v1" && R("verificationStack has unsupported schemaVersion");
217
+ for (let t of ["lockDigest", "executableDigest"]) /^sha256:[0-9a-f]{64}$/.test(String(e[t] ?? "")) || R(`verificationStack.${t} must be a full sha256 digest`);
218
+ if (e.buildProfile !== void 0 && e.buildProfile !== "debug" && e.buildProfile !== "release" && R("verificationStack.buildProfile must be debug, release, or absent"), e.toolchains !== void 0) {
219
+ L(e.toolchains) || R("verificationStack.toolchains must pin node, rust, and python");
220
+ for (let t of [
221
+ "node",
222
+ "rust",
223
+ "python"
224
+ ]) (typeof e.toolchains[t] != "string" || !e.toolchains[t]) && R("verificationStack.toolchains must pin node, rust, and python");
225
+ }
226
+ (!L(e.sources) || Object.keys(e.sources).length === 0) && R("verificationStack.sources must be a non-empty object");
227
+ for (let [t, n] of Object.entries(e.sources)) (!L(n) || !/^[0-9a-f]{40}$/.test(String(n.revision ?? "")) || n.sourceState !== "clean" || typeof n.remote != "string" || n.remote.length === 0) && R(`verificationStack.sources.${t} is not a clean full-SHA source`);
228
+ (!Array.isArray(e.capabilities) || e.capabilities.length === 0 || e.capabilities.some((e) => typeof e != "string" || !e)) && R("verificationStack.capabilities must be a non-empty string array"), (!L(e.artifacts) || Object.keys(e.artifacts).length === 0) && R("verificationStack.artifacts must be a non-empty object");
229
+ for (let [t, n] of Object.entries(e.artifacts)) /^sha256:[0-9a-f]{64}$/.test(String(n)) || R(`verificationStack.artifacts.${t} must be a full sha256 digest`);
230
+ }
231
+ function F(e) {
232
+ L(e) || R("observation must be an object");
233
+ for (let t of [
234
+ "metric",
235
+ "planId",
236
+ "definitionVersion",
237
+ "unit",
238
+ "shape",
239
+ "state"
240
+ ]) (typeof e[t] != "string" || e[t].length === 0) && R(`observation requires non-empty \`${t}\``);
241
+ (/* @__PURE__ */ new Set([
242
+ "scalar",
243
+ "ratio",
244
+ "count"
245
+ ])).has(e.shape) || R(`observation \`${String(e.metric)}\` has invalid shape`), (/* @__PURE__ */ new Set(["measured", "not_computed"])).has(e.state) || R(`observation \`${String(e.metric)}\` has invalid state`), e.state === "measured" && typeof e.value != "number" && R(`measured observation \`${String(e.metric)}\` requires a numeric value`), e.state === "not_computed" && e.value !== null && R(`not_computed observation \`${String(e.metric)}\` requires null value`);
246
+ }
247
+ function I(e) {
248
+ return JSON.stringify(Object.entries(e.dimensions ?? {}).sort(([e], [t]) => e === t ? 0 : e < t ? -1 : 1));
249
+ }
250
+ function L(e) {
251
+ return typeof e == "object" && !!e && !Array.isArray(e);
252
+ }
253
+ function R(e) {
254
+ throw new M(e);
255
+ }
256
+ //#endregion
257
+ //#region src/measurement/store.ts
258
+ function z(t) {
259
+ return f(e(t), "measurements");
260
+ }
261
+ function B(e, t) {
262
+ return f(z(e), `${U(t)}.json`);
263
+ }
264
+ function V(e, a) {
265
+ N(a, w(e));
266
+ let s = B(e, a.collectionId), u = t(a);
267
+ if (n(s)) {
268
+ if (i(s, "utf8") === u) return s;
269
+ throw Error(`${s}: collection id already exists with different content`);
270
+ }
271
+ r(ee(s), { recursive: !0 });
272
+ let d = `${s}.tmp-${process.pid}-${g()}`;
273
+ try {
274
+ l(d, u, {
275
+ encoding: "utf8",
276
+ flag: "wx"
277
+ }), o(d, s);
278
+ } finally {
279
+ n(d) && c(d);
280
+ }
281
+ return s;
282
+ }
283
+ function H(e) {
284
+ let t = z(e);
285
+ return n(t) ? a(t).filter((e) => e.endsWith(".json")).sort(W).map((e) => {
286
+ let n = f(t, e), r;
287
+ try {
288
+ r = JSON.parse(i(n, "utf8")), P(r);
289
+ } catch (e) {
290
+ let t = e instanceof Error ? e.message : String(e);
291
+ throw Error(`${n}: unreadable measurement collection: ${t}`);
292
+ }
293
+ return r;
294
+ }).sort((e, t) => W(e.timestamp, t.timestamp) || W(e.collectionId, t.collectionId)) : [];
295
+ }
296
+ function U(e) {
297
+ if (!/^[A-Za-z0-9._-]+$/.test(e)) throw Error(`unsafe measurement collection id \`${e}\``);
298
+ return e;
299
+ }
300
+ function W(e, t) {
301
+ return e === t ? 0 : e < t ? -1 : 1;
302
+ }
303
+ //#endregion
304
+ //#region src/measurement/report.ts
305
+ function G(e) {
306
+ return K(e, w(e), H(e));
307
+ }
308
+ function K(e, t, n) {
309
+ let r = t.filter((e) => e.status === "active");
310
+ return {
311
+ plans: r,
312
+ current: r.flatMap((t) => {
313
+ let r = [...n].reverse().find((e) => e.observations.some((e) => e.metric === t.metric)), i = r?.observations.filter((e) => e.metric === t.metric) ?? [];
314
+ return (i.length > 0 ? i : [null]).map((n) => ({
315
+ metric: t.metric,
316
+ planId: t.id,
317
+ planPath: t.path,
318
+ planDefinitionVersion: t.definitionVersion,
319
+ stage: t.stage,
320
+ observation: n,
321
+ collection: r ? {
322
+ collectionId: r.collectionId,
323
+ timestamp: r.timestamp,
324
+ toolIdentity: r.toolIdentity,
325
+ toolVersion: r.toolVersion,
326
+ configDigest: r.configDigest,
327
+ sourceRevision: r.sourceRevision,
328
+ corpusRevision: r.corpusRevision,
329
+ path: B(e, r.collectionId)
330
+ } : null
331
+ }));
332
+ }),
333
+ corpusGaps: ce(n)
334
+ };
335
+ }
336
+ function q(e) {
337
+ let t = [
338
+ "# QA measurement report",
339
+ "",
340
+ "## What this repository measures",
341
+ ""
342
+ ];
343
+ if (e.plans.length === 0) t.push("No MeasurementPlan is authored.", "");
344
+ else {
345
+ t.push("| Metric | Plan | Stage | Current |", "| --- | --- | --- | --- |");
346
+ for (let n of e.current) {
347
+ let e = Object.entries(n.observation?.dimensions ?? {}).map(([e, t]) => `${e}=${t}`).join(", "), r = e ? `${n.metric} [${e}]` : n.metric, i = n.observation ? n.observation.definitionVersion === n.planDefinitionVersion ? n.observation.state === "measured" ? `${n.observation.value} ${n.observation.unit}` : `not_computed: ${n.observation.reason ?? "producer did not compute it"}` : `incomparable: definition ${n.observation.definitionVersion}; active plan ${n.planDefinitionVersion}` : "not_computed: no record";
348
+ t.push(`| ${r} | ${n.planId} (${n.planPath}) | ${n.stage} | ${i} |`);
349
+ }
350
+ t.push("");
351
+ }
352
+ t.push("## Current evidence", ""), t.push(e.corpusGaps === null ? "Corpus gaps: not_computed" : `Corpus gaps: ${e.corpusGaps}`, "");
353
+ let n = new Map(e.current.filter((e) => e.collection).map((e) => [e.collection?.collectionId, e.collection]));
354
+ for (let e of n.values()) e && t.push(`- ${e.timestamp} — ${e.toolIdentity} ${e.toolVersion}; source ${e.sourceRevision}; corpus ${e.corpusRevision ?? "n/a"}; config ${e.configDigest}`);
355
+ n.size === 0 && t.push("No measurement collection recorded."), t.push(""), t.push("## Attention", "");
356
+ let r = [];
357
+ (e.corpusGaps ?? 0) > 0 && r.push(`${e.corpusGaps} mode-language cells are GAP; run the corpus bounds view to see each named cell.`);
358
+ for (let t of e.current) {
359
+ let e = t.observation;
360
+ if (!e) {
361
+ r.push(`${t.metric}: no collection has computed this authored plan.`);
362
+ continue;
363
+ }
364
+ let n = Object.entries(e.dimensions ?? {}).map(([e, t]) => `${e}=${t}`).join(", "), i = n ? `${t.metric} [${n}]` : t.metric;
365
+ e.state === "not_computed" ? r.push(`${i}: not computed — ${e.reason ?? "no reason supplied"}.`) : e.definitionVersion === t.planDefinitionVersion ? t.metric === "finding_recall" && e.value === 0 ? r.push(`${i}: zero seeded defects detected; add or connect the detector named by the family.`) : t.metric === "finding_precision.unadjudicated" && (e.value ?? 0) > 0 ? r.push(`${i}: ${e.value} firings have no corpus ruling; adjudicate their cases.`) : t.metric === "actionability_rate" && e.population?.examined !== void 0 && r.push(`${i}: ${e.population.matched ?? 0} of ${e.population.examined} findings name a row or line; inspect emitted findings without a locus.`) : r.push(`${i}: stored definition ${e.definitionVersion} does not match active plan ${t.planDefinitionVersion}; do not compare the value.`);
366
+ }
367
+ return t.push(...r.length > 0 ? r.map((e) => `- ${e}`) : ["No factual attention items."], ""), t.join("\n");
368
+ }
369
+ function J(e) {
370
+ return t(e);
371
+ }
372
+ function ae(e, t) {
373
+ return H(e).flatMap((e) => e.observations.filter((e) => e.metric === t).map((t) => ({
374
+ timestamp: e.timestamp,
375
+ sourceRevision: e.sourceRevision,
376
+ toolVersion: e.toolVersion,
377
+ toolIdentity: e.toolIdentity,
378
+ configDigest: e.configDigest,
379
+ corpusRevision: e.corpusRevision ?? null,
380
+ corpusGaps: Z(e),
381
+ observation: t
382
+ })));
383
+ }
384
+ function oe(e, t) {
385
+ let n = H(e), r = [...n].reverse().find((e) => e.sourceRevision.startsWith(t)), i = n.at(-1);
386
+ return i ? r ? {
387
+ status: "compared",
388
+ reason: null,
389
+ before: Y(e, r),
390
+ after: Y(e, i),
391
+ comparisons: _(r, i)
392
+ } : {
393
+ status: "not_computed",
394
+ reason: `no baseline measurement collection for source revision ${t}`,
395
+ before: null,
396
+ after: Y(e, i),
397
+ comparisons: []
398
+ } : {
399
+ status: "not_computed",
400
+ reason: "no current measurement collection is recorded",
401
+ before: null,
402
+ after: null,
403
+ comparisons: []
404
+ };
405
+ }
406
+ function se(e) {
407
+ let t = [
408
+ "# QA measurement comparison",
409
+ "",
410
+ `Status: ${e.status}`,
411
+ ""
412
+ ];
413
+ if (e.before ? t.push(`Before: ${X(e.before)}`) : t.push("Before: not_computed — no baseline"), e.after ? t.push(`After: ${X(e.after)}`) : t.push("After: not_computed — no current record"), t.push(""), e.reason) return t.push(`not_computed: ${e.reason}`, ""), t.join("\n");
414
+ t.push("| Metric | Status | Before | After | Delta |", "| --- | --- | ---: | ---: | ---: |");
415
+ for (let n of e.comparisons) {
416
+ let e = Object.entries(n.dimensions).map(([e, t]) => `${e}=${t}`).join(", "), r = e ? `${n.metric} [${e}]` : n.metric;
417
+ t.push(`| ${r} | ${n.status} | ${n.before ?? "n/a"} | ${n.after ?? "n/a"} | ${n.delta ?? "n/a"} |`);
418
+ for (let e of n.reasons) t.push(`| ↳ ${e.code} | ${e.blocking ? "blocks delta" : "context"} | | | ${e.message} |`);
419
+ }
420
+ return t.push(""), t.join("\n");
421
+ }
422
+ function Y(e, t) {
423
+ return {
424
+ collectionId: t.collectionId,
425
+ timestamp: t.timestamp,
426
+ toolIdentity: t.toolIdentity,
427
+ toolVersion: t.toolVersion,
428
+ configDigest: t.configDigest,
429
+ sourceRevision: t.sourceRevision,
430
+ corpusRevision: t.corpusRevision ?? null,
431
+ corpusGaps: Z(t),
432
+ path: B(e, t.collectionId)
433
+ };
434
+ }
435
+ function X(e) {
436
+ return `${e.collectionId} — ${e.toolIdentity} ${e.toolVersion}; source ${e.sourceRevision}; corpus ${e.corpusRevision ?? "n/a"}; gaps ${e.corpusGaps ?? "not_computed"}; config ${e.configDigest}; record ${e.path}`;
437
+ }
438
+ function Z(e) {
439
+ let t = e.rawEvidence;
440
+ return typeof t?.bounds?.gap_count == "number" ? t.bounds.gap_count : null;
441
+ }
442
+ function ce(e) {
443
+ for (let t of [...e].reverse()) {
444
+ let e = Z(t);
445
+ if (e !== null) return e;
446
+ }
447
+ return null;
448
+ }
449
+ //#endregion
450
+ //#region src/measurement/portfolio.ts
451
+ var le = 864e5, ue = 30;
452
+ function de(e) {
453
+ let t = [...new Set(e.map((e) => m(e)))].sort($).map(me);
454
+ for (let e of t) {
455
+ let t = e.latestCollection;
456
+ t && !Number.isFinite(Date.parse(t.timestamp)) && he(e, `${t.path}: collection timestamp is not a valid date`);
457
+ }
458
+ let n = t.map((e) => e.latestCollection?.timestamp).filter((e) => e !== void 0).sort($).at(-1) ?? null, r = n ? Date.parse(n) : null;
459
+ for (let e of t) {
460
+ let t = e.latestCollection;
461
+ if (!t || r === null) continue;
462
+ let i = Date.parse(t.timestamp), a = Math.floor(Math.max(0, r - i) / le);
463
+ e.staleness = {
464
+ status: a > 30 ? "stale" : "current",
465
+ ageDays: a,
466
+ relativeTo: n,
467
+ thresholdDays: 30
468
+ };
469
+ }
470
+ return {
471
+ schemaVersion: 1,
472
+ newestCollectionTimestamp: n,
473
+ staleAfterDays: 30,
474
+ repositories: t
475
+ };
476
+ }
477
+ function fe(e) {
478
+ let t = [
479
+ "# QA portfolio report",
480
+ "",
481
+ "No cross-repository metric is summed, averaged, or assigned a quality verdict.",
482
+ ""
483
+ ];
484
+ for (let n of e.repositories) {
485
+ if (t.push(`## ${n.name}`, "", `Root: ${n.root}`), n.status !== "readable") {
486
+ t.push(`Status: ${n.status} — ${n.error ?? "unknown read error"}`, "");
487
+ continue;
488
+ }
489
+ t.push(`Status: readable; measurement store: ${n.store}`), t.push(`Profiles: ${n.profiles.length ? n.profiles.map((e) => `${e.id} (${e.path})`).join(", ") : "none"}`);
490
+ let e = n.latestCollection;
491
+ t.push(e ? `Latest: ${e.timestamp} — ${e.id} (${e.path}); ${n.staleness.status}, ${n.staleness.ageDays} days behind portfolio latest` : "Latest: not_computed — no measurement collection"), e && t.push(`Provenance: source ${e.sourceRevision}; corpus ${e.corpusRevision ?? "n/a"}; tool ${e.toolIdentity} ${e.toolVersion}; config ${e.configDigest}`);
492
+ let r = n.measurements;
493
+ if (t.push(!r || r.corpusGaps === null || !e ? "Corpus gaps: not_computed" : `Corpus gaps: ${r.corpusGaps} (${e.path}; raw evidence, no metric plan)`, "", "| Metric | State/value | Plan | Collection |", "| --- | --- | --- | --- |"), !r || r.current.length === 0) t.push("| not_computed | no active MeasurementPlan | n/a | n/a |");
494
+ else for (let e of r.current) {
495
+ let n = Object.entries(e.observation?.dimensions ?? {}).map(([e, t]) => `${e}=${t}`).join(", "), r = n ? `${e.metric} [${n}]` : e.metric, i = e.observation ? e.observation.definitionVersion === e.planDefinitionVersion ? e.observation.state === "measured" ? `${e.observation.value} ${e.observation.unit}` : `not_computed: ${e.observation.reason ?? "producer supplied no reason"}` : `incomparable: definition ${e.observation.definitionVersion}; active plan ${e.planDefinitionVersion}` : "not_computed: no collection";
496
+ t.push(`| ${r} | ${i} | ${e.planId} (${e.planPath}) | ${e.collection ? `${e.collection.collectionId} (${e.collection.path})` : "n/a"} |`);
497
+ }
498
+ t.push(""), _e(t, n);
499
+ }
500
+ return t.join("\n");
501
+ }
502
+ function pe(e) {
503
+ return t(e);
504
+ }
505
+ function me(e) {
506
+ let t = ge(e);
507
+ if (!n(e)) return {
508
+ ...t,
509
+ status: "missing",
510
+ error: `${e}: repository does not exist`
511
+ };
512
+ try {
513
+ if (!s(e).isDirectory()) return {
514
+ ...t,
515
+ status: "unreadable",
516
+ store: "unreadable",
517
+ error: `${e}: repository location is not a directory`
518
+ };
519
+ let r = E(e), i = w(e).filter((e) => e.status === "active"), a = H(e), o = a.at(-1) ?? null, c = a.at(-2) ?? null;
520
+ return {
521
+ ...t,
522
+ store: n(z(e)) ? a.length === 0 ? "empty" : "present" : "missing",
523
+ profiles: r,
524
+ plans: i,
525
+ measurements: K(e, i, a),
526
+ latestCollection: o ? Q(e, o) : null,
527
+ comparison: c && o ? {
528
+ before: Q(e, c),
529
+ after: Q(e, o),
530
+ observations: _(c, o)
531
+ } : null
532
+ };
533
+ } catch (e) {
534
+ let n = e instanceof Error ? e.message : String(e);
535
+ return {
536
+ ...t,
537
+ status: "unreadable",
538
+ store: "unreadable",
539
+ error: n
540
+ };
541
+ }
542
+ }
543
+ function he(e, t) {
544
+ e.status = "unreadable", e.store = "unreadable", e.error = t, e.measurements = null, e.comparison = null, e.latestCollection = null;
545
+ }
546
+ function ge(e) {
547
+ return {
548
+ name: u(e) || e,
549
+ root: e,
550
+ status: "readable",
551
+ error: null,
552
+ store: "missing",
553
+ profiles: [],
554
+ plans: [],
555
+ measurements: null,
556
+ latestCollection: null,
557
+ comparison: null,
558
+ staleness: {
559
+ status: "not_computed",
560
+ ageDays: null,
561
+ relativeTo: null,
562
+ thresholdDays: 30
563
+ }
564
+ };
565
+ }
566
+ function Q(e, t) {
567
+ return {
568
+ id: t.collectionId,
569
+ path: B(e, t.collectionId),
570
+ timestamp: t.timestamp,
571
+ sourceRevision: t.sourceRevision,
572
+ toolIdentity: t.toolIdentity,
573
+ toolVersion: t.toolVersion,
574
+ configDigest: t.configDigest,
575
+ ...t.corpusRevision ? { corpusRevision: t.corpusRevision } : {}
576
+ };
577
+ }
578
+ function _e(e, t) {
579
+ let n = t.comparison;
580
+ if (!n) {
581
+ e.push("Comparison: not_computed — fewer than two collections", "");
582
+ return;
583
+ }
584
+ e.push(`Comparison: ${n.before.id} (${n.before.path}) → ${n.after.id} (${n.after.path})`, "", "| Metric | Status | Before | After | Reasons | Plan |", "| --- | --- | ---: | ---: | --- | --- |");
585
+ for (let r of n.observations) {
586
+ let n = t.plans.find((e) => e.metric === r.metric), i = Object.entries(r.dimensions).map(([e, t]) => `${e}=${t}`).join(", "), a = i ? `${r.metric} [${i}]` : r.metric;
587
+ e.push(`| ${a} | ${r.status} | ${r.before ?? "n/a"} | ${r.after ?? "n/a"} | ${r.reasons.map((e) => `${e.code}: ${e.message}`).join("; ") || "none"} | ${n ? `${n.id} (${n.path})` : "not_computed: no active plan"} |`);
588
+ }
589
+ e.push("");
590
+ }
591
+ function $(e, t) {
592
+ return e === t ? 0 : e < t ? -1 : 1;
593
+ }
594
+ //#endregion
595
+ export { _ as S, N as _, G as a, E as b, se as c, ae as d, B as f, M as g, V as h, pe as i, q as l, H as m, de as n, K as o, z as p, fe as r, oe as s, ue as t, J as u, P as v, w as x, j as y };
@@ -1,5 +1,5 @@
1
- import { a as e } from "./base-DNieRzIg.js";
2
- import { t } from "./plugins-Czi2OyDB.js";
1
+ import { a as e } from "./base-CqKNs2Kd.js";
2
+ import { t } from "./plugins-C-ta0llj.js";
3
3
  import { fileURLToPath as n } from "node:url";
4
4
  import { readFileSync as r } from "node:fs";
5
5
  import { dirname as i, join as a } from "node:path";
@@ -1,4 +1,4 @@
1
- import { a as e, r as t } from "./base-DNieRzIg.js";
1
+ import { a as e, r as t } from "./base-CqKNs2Kd.js";
2
2
  import { existsSync as n, readFileSync as r, rmSync as i } from "node:fs";
3
3
  import { basename as a, join as o } from "node:path";
4
4
  import { parse as s } from "yaml";
@@ -12,19 +12,19 @@
12
12
  * is no dependency edge along which a schema file could travel, and fetching
13
13
  * one at runtime is out of the question (quoin performs no network reads on a
14
14
  * command path). So the artifacts are **copied in with their provenance
15
- * recorded** — source tag, path and content hash — and refreshed deliberately
15
+ * recorded** — source revision, path and content hash — and refreshed deliberately
16
16
  * by `scripts/refresh-quire-schemas.mjs`, whose diff is reviewed.
17
17
  *
18
18
  * That is a copy, and a copy can drift. What keeps it honest is that the hash
19
- * is asserted on every test run and the refresh script re-derives it from a
20
- * checked-out quire-rs at the pinned tag: an edit to the vendored file without
19
+ * is asserted on every test run and the refresh script re-derives it from the
20
+ * exact pinned quire-rs git object: an edit to the vendored file without
21
21
  * a matching refresh fails immediately, rather than silently teaching quoin a
22
22
  * contract quire does not emit.
23
23
  */
24
24
  /** Where the vendored schemas came from, and exactly which bytes. */
25
25
  export declare const QUIRE_CONTRACT: {
26
- /** The quire-rs release the vendored schemas were copied from. */
27
- readonly sourceTag: "v0.42.0";
26
+ /** Exact quire-rs commit whose schemas were copied. */
27
+ readonly sourceRevision: "ca7362d4dacecb96f01d74d1d971327118c25917";
28
28
  /** The contract version, as carried in each schema's `$id` and filename. */
29
29
  readonly contractVersion: "v1";
30
30
  /**
@@ -40,15 +40,14 @@ export declare const QUIRE_CONTRACT: {
40
40
  * SHA-256 of each vendored file. Asserted on every test run, so an edit
41
41
  * without a matching refresh fails loudly.
42
42
  *
43
- * v0.42.0 supersedes the CR-041 carry-ahead (the two CR-091 shapes taken
44
- * ahead of the tag) with the released files wholesale, as that note said the
45
- * next refresh would. Beyond CR-091 the tag adds only additive shapes under
46
- * quire-rs FR-055-CON-3: `line` on the matrix-row/symbol records (#210),
47
- * `shared_trace_ids` (CR-087) and `excluded_source_files` (#215).
43
+ * The revision is pinned rather than described as a release because the QA
44
+ * program intentionally runs both projects from their tracking branches.
45
+ * The refresh helper reads the files from that git object, so unrelated
46
+ * working-tree changes cannot alter the recorded contract.
48
47
  */
49
48
  readonly hashes: {
50
- readonly "coverage-v1.schema.json": "2b7a8f6d786cadf637df6461c89c92c350096cf263c1f3c5d6b3b24a490bc590";
51
- readonly "properties-v1.schema.json": "d81f1ec85abdecd1f1664ded15e081f9aecb6c0f054d6b332b71e904cf826292";
49
+ readonly "coverage-v1.schema.json": "f0cdbb9457ca7ca76b642c11fd5b6f41273909c894458c31f58c9c50fdbcdb38";
50
+ readonly "properties-v1.schema.json": "cc687773c35b3e71e82fc336e887ecc688a28b03e970e349b2921b8624e4d11c";
52
51
  };
53
52
  };
54
53
  export type SchemaName = keyof typeof QUIRE_CONTRACT.hashes;
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/quire/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,qEAAqE;AACrE,eAAO,MAAM,cAAc;IACzB,kEAAkE;;IAElE,4EAA4E;;IAE5E;;;;;;;OAOG;;IAkBH;;;;;;;;;OASG;;;;;CAOK,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC,MAAM,CAAC;AAI5D,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnD;AAED,6CAA6C;AAC7C,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEpD;AAED,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAInD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG7D;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,qBAAqB,GAAG,IAAI,CA2B9B"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/quire/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,qEAAqE;AACrE,eAAO,MAAM,cAAc;IACzB,uDAAuD;;IAEvD,4EAA4E;;IAE5E;;;;;;;OAOG;;IAkBH;;;;;;;;OAQG;;;;;CAOK,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC,MAAM,CAAC;AAI5D,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnD;AAED,6CAA6C;AAC7C,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEpD;AAED,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAInD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG7D;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,qBAAqB,GAAG,IAAI,CA2B9B"}
@@ -16,6 +16,16 @@
16
16
  * command outright.
17
17
  */
18
18
  export declare const QUIRE_MAX_BUFFER: number;
19
+ /**
20
+ * Resolve the producer once per invocation, never once per installation.
21
+ *
22
+ * `QUOIN_QUIRE` is the governed surface used by the verification-stack runner.
23
+ * Ordinary interactive use may still resolve `quire` from PATH, but the result
24
+ * is converted to an absolute real path before execution. When
25
+ * `QUOIN_EXPECTED_QUIRE_SHA256` is present the exact bytes are checked on every
26
+ * call, so replacing a file at the same path cannot move a canonical run.
27
+ */
28
+ export declare function quireExecutable(): string;
19
29
  /**
20
30
  * Run `quire` and return stdout, surfacing **stderr** when it fails.
21
31
  *