@agent-ix/quoin 0.22.5 → 0.23.1

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 (200) hide show
  1. package/dist/{advisor-BkgwDKvQ.js → advisor-B0rESCx1.js} +1 -1
  2. package/dist/{auditor-C3bSmPD_.js → auditor-Dd3i9Aqx.js} +2 -2
  3. package/dist/{base-CqKNs2Kd.js → base-gAClyCNd.js} +1 -1
  4. package/dist/change-assurance/attestations.d.ts +7 -0
  5. package/dist/change-assurance/attestations.d.ts.map +1 -0
  6. package/dist/change-assurance/index.d.ts +14 -0
  7. package/dist/change-assurance/index.d.ts.map +1 -0
  8. package/dist/change-assurance/integrity.d.ts +11 -0
  9. package/dist/change-assurance/integrity.d.ts.map +1 -0
  10. package/dist/change-assurance/records.d.ts +22 -0
  11. package/dist/change-assurance/records.d.ts.map +1 -0
  12. package/dist/change-assurance/schema-assets.d.ts +8 -0
  13. package/dist/change-assurance/schema-assets.d.ts.map +1 -0
  14. package/dist/change-assurance/store.d.ts +18 -0
  15. package/dist/change-assurance/store.d.ts.map +1 -0
  16. package/dist/change-assurance/types.d.ts +180 -0
  17. package/dist/change-assurance/types.d.ts.map +1 -0
  18. package/dist/change-assurance/verify.d.ts +4 -0
  19. package/dist/change-assurance/verify.d.ts.map +1 -0
  20. package/dist/change-assurance-CyKLPeKa.js +1236 -0
  21. package/dist/cli.js +1 -1
  22. package/dist/commands/advise.js +19 -19
  23. package/dist/commands/assurance.js +20 -20
  24. package/dist/commands/catalog/list.js +2 -2
  25. package/dist/commands/catalog/methods.js +3 -3
  26. package/dist/commands/catalog/show.js +2 -2
  27. package/dist/commands/catalog/validate.js +2 -2
  28. package/dist/commands/change-assurance/common.d.ts +37 -0
  29. package/dist/commands/change-assurance/common.d.ts.map +1 -0
  30. package/dist/commands/change-assurance/index.d.ts +8 -0
  31. package/dist/commands/change-assurance/index.d.ts.map +1 -0
  32. package/dist/commands/change-assurance/index.js +12 -0
  33. package/dist/commands/change-assurance/intake.d.ts +15 -0
  34. package/dist/commands/change-assurance/intake.d.ts.map +1 -0
  35. package/dist/commands/change-assurance/intake.js +53 -0
  36. package/dist/commands/change-assurance/receipt.d.ts +21 -0
  37. package/dist/commands/change-assurance/receipt.d.ts.map +1 -0
  38. package/dist/commands/change-assurance/receipt.js +99 -0
  39. package/dist/commands/change-assurance/recover.d.ts +13 -0
  40. package/dist/commands/change-assurance/recover.d.ts.map +1 -0
  41. package/dist/commands/change-assurance/recover.js +29 -0
  42. package/dist/commands/change-assurance/schema.d.ts +13 -0
  43. package/dist/commands/change-assurance/schema.d.ts.map +1 -0
  44. package/dist/commands/change-assurance/schema.js +40 -0
  45. package/dist/commands/change-assurance/seal-attestation.d.ts +15 -0
  46. package/dist/commands/change-assurance/seal-attestation.d.ts.map +1 -0
  47. package/dist/commands/change-assurance/seal-attestation.js +58 -0
  48. package/dist/commands/change-assurance/seal-record.d.ts +14 -0
  49. package/dist/commands/change-assurance/seal-record.d.ts.map +1 -0
  50. package/dist/commands/change-assurance/seal-record.js +53 -0
  51. package/dist/commands/change-assurance/verify-receipt.d.ts +13 -0
  52. package/dist/commands/change-assurance/verify-receipt.d.ts.map +1 -0
  53. package/dist/commands/change-assurance/verify-receipt.js +41 -0
  54. package/dist/commands/completeness.js +2 -2
  55. package/dist/commands/config/doctor.js +1 -1
  56. package/dist/commands/config/edit.js +1 -1
  57. package/dist/commands/config/get.js +1 -1
  58. package/dist/commands/config/set.js +1 -1
  59. package/dist/commands/evidence/affirm.js +19 -19
  60. package/dist/commands/evidence/audit.js +26 -26
  61. package/dist/commands/evidence/baseline.js +21 -21
  62. package/dist/commands/evidence/gc.js +3 -3
  63. package/dist/commands/evidence/index.js +1 -1
  64. package/dist/commands/evidence/inspect-mocks.js +4 -4
  65. package/dist/commands/evidence/record.d.ts.map +1 -1
  66. package/dist/commands/evidence/record.js +28 -24
  67. package/dist/commands/graph/change-impact.d.ts +16 -0
  68. package/dist/commands/graph/change-impact.d.ts.map +1 -0
  69. package/dist/commands/graph/change-impact.js +29 -0
  70. package/dist/commands/graph/churn.d.ts +14 -0
  71. package/dist/commands/graph/churn.d.ts.map +1 -0
  72. package/dist/commands/graph/churn.js +15 -0
  73. package/dist/commands/graph/common.d.ts +16 -0
  74. package/dist/commands/graph/common.d.ts.map +1 -0
  75. package/dist/commands/graph/fan-out.d.ts +14 -0
  76. package/dist/commands/graph/fan-out.d.ts.map +1 -0
  77. package/dist/commands/graph/fan-out.js +15 -0
  78. package/dist/commands/graph/index.d.ts +8 -0
  79. package/dist/commands/graph/index.d.ts.map +1 -0
  80. package/dist/commands/graph/index.js +12 -0
  81. package/dist/commands/matrix.js +1 -1
  82. package/dist/commands/measurement/index.js +1 -1
  83. package/dist/commands/measurement/intervention.d.ts +11 -0
  84. package/dist/commands/measurement/intervention.d.ts.map +1 -0
  85. package/dist/commands/measurement/intervention.js +31 -0
  86. package/dist/commands/measurement/operational-release.d.ts +11 -0
  87. package/dist/commands/measurement/operational-release.d.ts.map +1 -0
  88. package/dist/commands/measurement/operational-release.js +31 -0
  89. package/dist/commands/measurement/record.d.ts.map +1 -1
  90. package/dist/commands/measurement/record.js +12 -11
  91. package/dist/commands/module/ensure-defaults.js +3 -3
  92. package/dist/commands/module/install.js +2 -2
  93. package/dist/commands/module/list.js +2 -2
  94. package/dist/commands/module/remove.js +2 -2
  95. package/dist/commands/report.d.ts +4 -0
  96. package/dist/commands/report.d.ts.map +1 -1
  97. package/dist/commands/report.js +49 -23
  98. package/dist/commands/review.js +1 -1
  99. package/dist/commands/to-plan.js +1 -1
  100. package/dist/commands/update.js +2 -2
  101. package/dist/commands/validate.js +1 -1
  102. package/dist/commands/write.js +3 -3
  103. package/dist/common-B1ZJ8CSO.js +36 -0
  104. package/dist/common-DTrmnvL-.js +35 -0
  105. package/dist/{completeness-DamWradt.js → completeness-BzBuNq6w.js} +1 -1
  106. package/dist/evidence/adapters/contract-conformance.d.ts +16 -0
  107. package/dist/evidence/adapters/contract-conformance.d.ts.map +1 -0
  108. package/dist/evidence/adapters/differential-report.d.ts +18 -0
  109. package/dist/evidence/adapters/differential-report.d.ts.map +1 -0
  110. package/dist/evidence/adapters/registry.d.ts.map +1 -1
  111. package/dist/evidence/adapters/types.d.ts +31 -0
  112. package/dist/evidence/adapters/types.d.ts.map +1 -1
  113. package/dist/evidence/index.d.ts +5 -2
  114. package/dist/evidence/index.d.ts.map +1 -1
  115. package/dist/{evidence-DD0CHzJ0.js → evidence-OyqpqHLS.js} +191 -110
  116. package/dist/{flow-command-BfFNY0Rv.js → flow-command-CCRTE5Oe.js} +7 -7
  117. package/dist/graph-analysis/analysis.d.ts +106 -0
  118. package/dist/graph-analysis/analysis.d.ts.map +1 -0
  119. package/dist/graph-analysis/index.d.ts +6 -0
  120. package/dist/graph-analysis/index.d.ts.map +1 -0
  121. package/dist/graph-analysis/input.d.ts +33 -0
  122. package/dist/graph-analysis/input.d.ts.map +1 -0
  123. package/dist/graph-analysis/load.d.ts +21 -0
  124. package/dist/graph-analysis/load.d.ts.map +1 -0
  125. package/dist/graph-analysis/render.d.ts +4 -0
  126. package/dist/graph-analysis/render.d.ts.map +1 -0
  127. package/dist/graph-analysis-IWaoJJSN.js +657 -0
  128. package/dist/index.d.ts +1 -0
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +11 -9
  131. package/dist/measurement/agent-eval-intervention.d.ts +6 -0
  132. package/dist/measurement/agent-eval-intervention.d.ts.map +1 -0
  133. package/dist/measurement/atomic-file.d.ts +5 -0
  134. package/dist/measurement/atomic-file.d.ts.map +1 -0
  135. package/dist/measurement/date-time.d.ts +3 -0
  136. package/dist/measurement/date-time.d.ts.map +1 -0
  137. package/dist/measurement/github-release-operational.d.ts +7 -0
  138. package/dist/measurement/github-release-operational.d.ts.map +1 -0
  139. package/dist/measurement/graph-adapters.d.ts +304 -0
  140. package/dist/measurement/graph-adapters.d.ts.map +1 -0
  141. package/dist/measurement/graph-portfolio-load.d.ts +3 -0
  142. package/dist/measurement/graph-portfolio-load.d.ts.map +1 -0
  143. package/dist/measurement/graph-portfolio.d.ts +158 -0
  144. package/dist/measurement/graph-portfolio.d.ts.map +1 -0
  145. package/dist/measurement/index.d.ts +15 -2
  146. package/dist/measurement/index.d.ts.map +1 -1
  147. package/dist/measurement/intervention-report.d.ts +24 -0
  148. package/dist/measurement/intervention-report.d.ts.map +1 -0
  149. package/dist/measurement/intervention-schema.d.ts +144 -0
  150. package/dist/measurement/intervention-schema.d.ts.map +1 -0
  151. package/dist/measurement/intervention-types.d.ts +105 -0
  152. package/dist/measurement/intervention-types.d.ts.map +1 -0
  153. package/dist/measurement/intervention.d.ts +16 -0
  154. package/dist/measurement/intervention.d.ts.map +1 -0
  155. package/dist/measurement/operational-report.d.ts +17 -0
  156. package/dist/measurement/operational-report.d.ts.map +1 -0
  157. package/dist/measurement/operational-schema.d.ts +461 -0
  158. package/dist/measurement/operational-schema.d.ts.map +1 -0
  159. package/dist/measurement/operational-types.d.ts +121 -0
  160. package/dist/measurement/operational-types.d.ts.map +1 -0
  161. package/dist/measurement/operational.d.ts +13 -0
  162. package/dist/measurement/operational.d.ts.map +1 -0
  163. package/dist/measurement/plans.d.ts +3 -1
  164. package/dist/measurement/plans.d.ts.map +1 -1
  165. package/dist/measurement/portfolio.d.ts +7 -1
  166. package/dist/measurement/portfolio.d.ts.map +1 -1
  167. package/dist/measurement/report.d.ts +4 -0
  168. package/dist/measurement/report.d.ts.map +1 -1
  169. package/dist/measurement/schemas/operational-evidence-v1.schema.json.d.ts +384 -0
  170. package/dist/measurement/store.d.ts +7 -0
  171. package/dist/measurement/store.d.ts.map +1 -1
  172. package/dist/measurement/types.d.ts +2 -0
  173. package/dist/measurement/types.d.ts.map +1 -1
  174. package/dist/measurement-j8sDSqx5.js +2980 -0
  175. package/dist/{modules-ez9httBA.js → modules-DDQkKC4l.js} +2 -2
  176. package/dist/{plugins-C-ta0llj.js → plugins-CHpYhpEI.js} +1 -1
  177. package/dist/quire/assurance.d.ts +109 -0
  178. package/dist/quire/assurance.d.ts.map +1 -0
  179. package/dist/quire/contract.d.ts +2 -1
  180. package/dist/quire/contract.d.ts.map +1 -1
  181. package/dist/quire/index.d.ts +3 -2
  182. package/dist/quire/index.d.ts.map +1 -1
  183. package/dist/quire/validate.d.ts +5 -0
  184. package/dist/quire/validate.d.ts.map +1 -1
  185. package/dist/{quire-D8tCpgyA.js → quire-BsVj1xIR.js} +54 -47
  186. package/dist/schema-assets-HZWo_iFN.js +233 -0
  187. package/dist/schemas/assurance-v1.schema.json +225 -0
  188. package/dist/schemas/change-assurance-record-v1.schema.json +234 -0
  189. package/dist/schemas/operational-evidence-v1.schema.json +381 -0
  190. package/dist/schemas/proof-attestation-v1.schema.json +96 -0
  191. package/dist/schemas/verification-receipt-v1.schema.json +208 -0
  192. package/dist/{version-Dg0e6CZU.js → version-CMxMIh5g.js} +1 -1
  193. package/dist/{write-DElwS9xc.js → write-CGTI0dRO.js} +1 -1
  194. package/package.json +5 -1
  195. package/skills/gap-analysis/references/step-4-underspecified-code.md +36 -7
  196. package/skills/gap-analysis/references/step-5-semantic-review.md +2 -2
  197. package/skills/gap-analysis/references/step-6-specreview-artifact.md +6 -5
  198. package/skills/spec-fuzz/SKILL.md +7 -6
  199. package/dist/measurement-CzB74Q07.js +0 -595
  200. package/dist/store--2sAv12X.js +0 -219
@@ -1,595 +0,0 @@
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 };