kibi-cli 2.31.1 → 2.35.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 (302) hide show
  1. package/dist/cli-register-proof.d.ts.map +1 -1
  2. package/dist/cli-register-proof.js +19 -7
  3. package/dist/cli-register-reporting.d.ts.map +1 -1
  4. package/dist/cli-register-reporting.js +2 -0
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +5 -1
  7. package/dist/commands/check-generated.d.ts +5 -1
  8. package/dist/commands/check-generated.d.ts.map +1 -1
  9. package/dist/commands/check-generated.js +24 -35
  10. package/dist/commands/check.d.ts +1 -0
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +14 -5
  13. package/dist/commands/discovery-table.d.ts.map +1 -1
  14. package/dist/commands/discovery-table.js +51 -4
  15. package/dist/commands/doctor.js +19 -4
  16. package/dist/commands/init-helpers.d.ts.map +1 -1
  17. package/dist/commands/init-helpers.js +8 -5
  18. package/dist/commands/migrate.d.ts.map +1 -1
  19. package/dist/commands/migrate.js +109 -5
  20. package/dist/commands/prove.d.ts +48 -1
  21. package/dist/commands/prove.d.ts.map +1 -1
  22. package/dist/commands/prove.js +293 -8
  23. package/dist/commands/report.d.ts +1 -0
  24. package/dist/commands/report.d.ts.map +1 -1
  25. package/dist/commands/report.js +70 -5
  26. package/dist/commands/signoff.d.ts.map +1 -1
  27. package/dist/commands/signoff.js +20 -1
  28. package/dist/commands/sync/manifest.d.ts +10 -1
  29. package/dist/commands/sync/manifest.d.ts.map +1 -1
  30. package/dist/commands/sync/manifest.js +106 -17
  31. package/dist/commands/sync/persistence.d.ts.map +1 -1
  32. package/dist/commands/sync/persistence.js +16 -5
  33. package/dist/commands/sync.d.ts.map +1 -1
  34. package/dist/commands/sync.js +19 -0
  35. package/dist/diagnostics.js +1 -1
  36. package/dist/engine.js +1 -1
  37. package/dist/extractors/markdown.d.ts +4 -2
  38. package/dist/extractors/markdown.d.ts.map +1 -1
  39. package/dist/extractors/markdown.js +17 -0
  40. package/dist/extractors/symbol-coordinates.js +2 -2
  41. package/dist/extractors/symbols-coordinator.d.ts +2 -4
  42. package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
  43. package/dist/extractors/symbols-coordinator.js +1 -2
  44. package/dist/operations/bootstrap/candidate-helpers.d.ts +3 -0
  45. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  46. package/dist/operations/bootstrap/candidate-helpers.js +4 -0
  47. package/dist/operations/migration/evidence-floor.d.ts +41 -0
  48. package/dist/operations/migration/evidence-floor.d.ts.map +1 -0
  49. package/dist/operations/migration/evidence-floor.js +230 -0
  50. package/dist/operations/migration/proof-contract-claims.d.ts +72 -0
  51. package/dist/operations/migration/proof-contract-claims.d.ts.map +1 -0
  52. package/dist/operations/migration/proof-contract-claims.js +215 -0
  53. package/dist/operations/migration/schema6.d.ts +6 -0
  54. package/dist/operations/migration/schema6.d.ts.map +1 -1
  55. package/dist/operations/migration/schema6.js +92 -0
  56. package/dist/operations/migration/symbol-coordinates-refresh.d.ts +3 -2
  57. package/dist/operations/migration/symbol-coordinates-refresh.d.ts.map +1 -1
  58. package/dist/operations/migration/symbol-coordinates-refresh.js +4 -3
  59. package/dist/operations/migration/untrack-symbol-coordinates.d.ts +23 -0
  60. package/dist/operations/migration/untrack-symbol-coordinates.d.ts.map +1 -0
  61. package/dist/operations/migration/untrack-symbol-coordinates.js +67 -0
  62. package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -1
  63. package/dist/operations/modeling/requirement-modeler.js +48 -1
  64. package/dist/operations/modeling/requirement-types.d.ts +2 -1
  65. package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
  66. package/dist/operations/modeling/requirement-utils.d.ts +1 -1
  67. package/dist/operations/modeling/requirement-utils.d.ts.map +1 -1
  68. package/dist/operations/modeling/requirement-utils.js +8 -1
  69. package/dist/operations/mutation/omitted-properties.d.ts +11 -0
  70. package/dist/operations/mutation/omitted-properties.d.ts.map +1 -0
  71. package/dist/operations/mutation/omitted-properties.js +76 -0
  72. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  73. package/dist/operations/mutation/serialization.js +1 -0
  74. package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
  75. package/dist/operations/mutation/source-authoring.js +39 -20
  76. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  77. package/dist/operations/mutation/strict-fact.js +6 -2
  78. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  79. package/dist/operations/mutation/symbol-granularity.js +5 -3
  80. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  81. package/dist/operations/mutation/upsert.js +7 -1
  82. package/dist/operations/mutation/validation.d.ts +2 -0
  83. package/dist/operations/mutation/validation.d.ts.map +1 -1
  84. package/dist/operations/mutation/validation.js +4 -0
  85. package/dist/operations/proof/claim-bindings.d.ts +41 -0
  86. package/dist/operations/proof/claim-bindings.d.ts.map +1 -0
  87. package/dist/operations/proof/claim-bindings.js +364 -0
  88. package/dist/operations/proof/code-certificates.d.ts +155 -0
  89. package/dist/operations/proof/code-certificates.d.ts.map +1 -0
  90. package/dist/operations/proof/code-certificates.js +894 -0
  91. package/dist/operations/proof/code-models.d.ts +96 -0
  92. package/dist/operations/proof/code-models.d.ts.map +1 -0
  93. package/dist/operations/proof/code-models.js +601 -0
  94. package/dist/operations/proof/code-runner.d.ts +40 -0
  95. package/dist/operations/proof/code-runner.d.ts.map +1 -0
  96. package/dist/operations/proof/code-runner.js +164 -0
  97. package/dist/operations/proof/code-scope.d.ts +14 -1
  98. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  99. package/dist/operations/proof/code-scope.js +44 -2
  100. package/dist/operations/proof/compact-receipts.d.ts.map +1 -1
  101. package/dist/operations/proof/compact-receipts.js +4 -3
  102. package/dist/operations/proof/explain.d.ts +32 -0
  103. package/dist/operations/proof/explain.d.ts.map +1 -1
  104. package/dist/operations/proof/explain.js +91 -0
  105. package/dist/operations/proof/ingest-proof.d.ts +9 -1
  106. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  107. package/dist/operations/proof/ingest-proof.js +42 -2
  108. package/dist/operations/proof/receipt-compaction.d.ts +2 -0
  109. package/dist/operations/proof/receipt-compaction.d.ts.map +1 -1
  110. package/dist/operations/proof/receipt-compaction.js +6 -2
  111. package/dist/operations/proof/regular-language.d.ts +89 -0
  112. package/dist/operations/proof/regular-language.d.ts.map +1 -0
  113. package/dist/operations/proof/regular-language.js +943 -0
  114. package/dist/operations/proof/source-code-readers.d.ts +12 -0
  115. package/dist/operations/proof/source-code-readers.d.ts.map +1 -0
  116. package/dist/operations/proof/source-code-readers.js +699 -0
  117. package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
  118. package/dist/operations/semantic-advisor/analyze-prose.js +2 -1
  119. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
  120. package/dist/operations/semantic-advisor/shared.js +4 -0
  121. package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -1
  122. package/dist/operations/semantic-advisor/strict-count-rules.js +8 -2
  123. package/dist/operations/semantic-advisor/strict-rules.d.ts +8 -0
  124. package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -1
  125. package/dist/operations/semantic-advisor/strict-rules.js +234 -4
  126. package/dist/operations/semantic-advisor/types.d.ts +3 -2
  127. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  128. package/dist/plugins/approved-source-analyzers.generated.d.ts +6 -6
  129. package/dist/plugins/approved-source-analyzers.generated.js +6 -6
  130. package/dist/prolog.d.ts.map +1 -1
  131. package/dist/prolog.js +13 -3
  132. package/dist/proof/command-test-report.d.ts +4 -3
  133. package/dist/proof/command-test-report.d.ts.map +1 -1
  134. package/dist/proof/command-test-report.js +4 -10
  135. package/dist/proof/evaluate.d.ts.map +1 -1
  136. package/dist/proof/evaluate.js +18 -2
  137. package/dist/proof/inspect.d.ts.map +1 -1
  138. package/dist/proof/inspect.js +58 -0
  139. package/dist/proof/producers/playwright-reporter.d.ts +3 -0
  140. package/dist/proof/producers/playwright-reporter.d.ts.map +1 -1
  141. package/dist/proof/producers/playwright-reporter.js +25 -2
  142. package/dist/proof/step-runner.d.ts +36 -0
  143. package/dist/proof/step-runner.d.ts.map +1 -0
  144. package/dist/proof/step-runner.js +234 -0
  145. package/dist/public/evidence-levels.d.ts +12 -0
  146. package/dist/public/evidence-levels.d.ts.map +1 -0
  147. package/dist/public/evidence-levels.js +19 -0
  148. package/dist/public/impact/coverage-depth-quality.d.ts +7 -0
  149. package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
  150. package/dist/public/impact/coverage-depth-quality.js +59 -0
  151. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  152. package/dist/public/impact/full-kb-quality.js +3 -1
  153. package/dist/public/operations/catalog.d.ts +315 -11
  154. package/dist/public/operations/catalog.d.ts.map +1 -1
  155. package/dist/public/operations/check-executor.d.ts +2 -0
  156. package/dist/public/operations/check-executor.d.ts.map +1 -1
  157. package/dist/public/operations/check-executor.js +6 -0
  158. package/dist/public/operations/evidence-floor.d.ts +48 -0
  159. package/dist/public/operations/evidence-floor.d.ts.map +1 -0
  160. package/dist/public/operations/evidence-floor.js +143 -0
  161. package/dist/public/operations/migration-plan.d.ts +19 -5
  162. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  163. package/dist/public/operations/migration-plan.js +22 -5
  164. package/dist/public/operations/node-ports.d.ts.map +1 -1
  165. package/dist/public/operations/node-ports.js +4 -1
  166. package/dist/public/operations/proof-contract-claims.d.ts +26 -0
  167. package/dist/public/operations/proof-contract-claims.d.ts.map +1 -0
  168. package/dist/public/operations/proof-contract-claims.js +71 -0
  169. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  170. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  171. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  172. package/dist/public/operations/specs/check.d.ts +1 -1
  173. package/dist/public/operations/specs/composite.d.ts +16 -3
  174. package/dist/public/operations/specs/composite.d.ts.map +1 -1
  175. package/dist/public/operations/specs/modeling.d.ts +16 -3
  176. package/dist/public/operations/specs/modeling.d.ts.map +1 -1
  177. package/dist/public/operations/specs/modeling.js +22 -3
  178. package/dist/public/operations/specs/mutation-schemas.d.ts +289 -7
  179. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  180. package/dist/public/operations/specs/mutation-schemas.js +28 -4
  181. package/dist/public/operations/specs/proof.d.ts +9 -0
  182. package/dist/public/operations/specs/proof.d.ts.map +1 -1
  183. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  184. package/dist/public/operations/specs/reporting.js +19 -10
  185. package/dist/public/operations/specs/upsert.d.ts +289 -7
  186. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  187. package/dist/public/proof-certificates.d.ts +163 -0
  188. package/dist/public/proof-certificates.d.ts.map +1 -0
  189. package/dist/public/proof-certificates.js +419 -0
  190. package/dist/public/proof-protocol.d.ts +259 -3
  191. package/dist/public/proof-protocol.d.ts.map +1 -1
  192. package/dist/public/proof-protocol.js +524 -3
  193. package/dist/public/proof-receipt.d.ts +90 -6
  194. package/dist/public/proof-receipt.d.ts.map +1 -1
  195. package/dist/public/proof-receipt.js +88 -7
  196. package/dist/public/proof-sources.d.ts +102 -0
  197. package/dist/public/proof-sources.d.ts.map +1 -0
  198. package/dist/public/proof-sources.js +1292 -0
  199. package/dist/public/schemas/entity.d.ts.map +1 -1
  200. package/dist/public/schemas/entity.js +39 -2
  201. package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
  202. package/dist/public/skills/kibi-commit-review/SKILL.md +8 -8
  203. package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
  204. package/dist/public/skills/kibi-decisions/SKILL.md +13 -2
  205. package/dist/public/skills/kibi-decisions/resources/decision-records.md +9 -1
  206. package/dist/public/skills/kibi-freshness/SKILL.md +5 -1
  207. package/dist/public/skills/kibi-traceability/SKILL.md +12 -1
  208. package/dist/public/skills/kibi-usage/SKILL.md +8 -4
  209. package/dist/public/skills/kibi-usage/resources/proof.md +221 -20
  210. package/dist/public/skills/kibi-usage/resources/workflows.md +4 -4
  211. package/dist/report/html-report.css +83 -11
  212. package/dist/report/html-report.d.ts +8 -0
  213. package/dist/report/html-report.d.ts.map +1 -1
  214. package/dist/report/html-report.js +214 -22
  215. package/dist/report/report-view.d.ts +2 -2
  216. package/dist/report/report-view.d.ts.map +1 -1
  217. package/dist/report/report-view.js +8 -0
  218. package/dist/schemas/entity.schema.json +404 -5
  219. package/dist/search-answer.d.ts.map +1 -1
  220. package/dist/search-answer.js +1 -0
  221. package/dist/signoff/html.d.ts.map +1 -1
  222. package/dist/signoff/html.js +3 -0
  223. package/dist/signoff/markdown.d.ts.map +1 -1
  224. package/dist/signoff/markdown.js +3 -0
  225. package/dist/signoff/model.d.ts +20 -0
  226. package/dist/signoff/model.d.ts.map +1 -1
  227. package/dist/signoff/model.js +20 -1
  228. package/dist/traceability/evidence-model.d.ts +13 -12
  229. package/dist/traceability/evidence-model.d.ts.map +1 -1
  230. package/dist/traceability/evidence-model.js +1 -1
  231. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  232. package/dist/traceability/impact-knowledge.js +1 -0
  233. package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
  234. package/dist/traceability/staged-diagnostics.js +24 -20
  235. package/dist/traceability/staged-impact-contract.d.ts +4 -4
  236. package/dist/traceability/staged-impact-contract.js +9 -9
  237. package/dist/traceability/staged-symbols-manifest.d.ts +11 -3
  238. package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
  239. package/dist/traceability/staged-symbols-manifest.js +47 -140
  240. package/dist/traceability/temp-kb.d.ts.map +1 -1
  241. package/dist/traceability/temp-kb.js +1 -0
  242. package/dist/types/entities.d.ts +5 -2
  243. package/dist/types/entities.d.ts.map +1 -1
  244. package/dist/utils/merge-driver-setup.d.ts +8 -1
  245. package/dist/utils/merge-driver-setup.d.ts.map +1 -1
  246. package/dist/utils/merge-driver-setup.js +23 -2
  247. package/dist/utils/rule-registry.generated.d.ts +10 -0
  248. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  249. package/dist/utils/rule-registry.generated.js +12 -0
  250. package/dist/utils/schema-version.d.ts +1 -1
  251. package/dist/utils/schema-version.d.ts.map +1 -1
  252. package/dist/utils/schema-version.js +7 -1
  253. package/dist/utils/strict-modeling.d.ts +3 -2
  254. package/dist/utils/strict-modeling.d.ts.map +1 -1
  255. package/dist/utils/strict-modeling.js +37 -4
  256. package/dist/workspace-cwd.d.ts +15 -0
  257. package/dist/workspace-cwd.d.ts.map +1 -0
  258. package/dist/workspace-cwd.js +86 -0
  259. package/package.json +6 -2
  260. package/schema/entities.pl +6 -0
  261. package/schema/validation.pl +7 -2
  262. package/src/public/evidence-levels.ts +23 -0
  263. package/src/public/impact/coverage-depth-quality.ts +73 -0
  264. package/src/public/impact/full-kb-quality.ts +6 -1
  265. package/src/public/operations/check-executor.ts +13 -0
  266. package/src/public/operations/evidence-floor.ts +203 -0
  267. package/src/public/operations/migration-plan.ts +39 -6
  268. package/src/public/operations/node-ports.ts +3 -1
  269. package/src/public/operations/proof-contract-claims.ts +103 -0
  270. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  271. package/src/public/operations/specs/modeling.ts +24 -5
  272. package/src/public/operations/specs/mutation-schemas.ts +30 -4
  273. package/src/public/operations/specs/reporting.ts +20 -10
  274. package/src/public/proof-certificates.ts +566 -0
  275. package/src/public/proof-protocol-types.d.ts +69 -1
  276. package/src/public/proof-protocol.ts +694 -3
  277. package/src/public/proof-receipt.ts +133 -7
  278. package/src/public/proof-sources.ts +1656 -0
  279. package/src/public/schemas/entity.ts +51 -3
  280. package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
  281. package/src/public/skills/kibi-commit-review/SKILL.md +8 -8
  282. package/src/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
  283. package/src/public/skills/kibi-decisions/SKILL.md +13 -2
  284. package/src/public/skills/kibi-decisions/resources/decision-records.md +9 -1
  285. package/src/public/skills/kibi-freshness/SKILL.md +5 -1
  286. package/src/public/skills/kibi-traceability/SKILL.md +12 -1
  287. package/src/public/skills/kibi-usage/SKILL.md +8 -4
  288. package/src/public/skills/kibi-usage/resources/proof.md +221 -20
  289. package/src/public/skills/kibi-usage/resources/workflows.md +4 -4
  290. package/src/schemas/entity.schema.json +404 -5
  291. package/dist/commands/proof-impact.d.ts +0 -7
  292. package/dist/commands/proof-impact.d.ts.map +0 -1
  293. package/dist/commands/proof-impact.js +0 -39
  294. package/dist/operations/proof/baseline-diff.d.ts +0 -41
  295. package/dist/operations/proof/baseline-diff.d.ts.map +0 -1
  296. package/dist/operations/proof/baseline-diff.js +0 -153
  297. package/dist/operations/proof/impact.d.ts +0 -51
  298. package/dist/operations/proof/impact.d.ts.map +0 -1
  299. package/dist/operations/proof/impact.js +0 -138
  300. package/dist/traceability/reviewed-coordinate-refresh.d.ts +0 -10
  301. package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +0 -1
  302. package/dist/traceability/reviewed-coordinate-refresh.js +0 -49
@@ -1,15 +1,22 @@
1
1
  import { type ProofFingerprintComponents } from "./proof-fingerprint.js";
2
- import { PROOF_RECEIPT_VERSION, PROOF_RESULT_OUTCOMES, PROOF_RUN_OUTCOMES, type ProofContract } from "./proof-protocol.js";
2
+ import { PROOF_RECEIPT_VERSIONS, PROOF_RESULT_OUTCOMES, PROOF_RUN_OUTCOMES, type ProofContract, type ProofKind } from "./proof-protocol.js";
3
3
  export declare const PROOF_RECEIPT_MAX_AGE_SECONDS: number;
4
+ /**
5
+ * How a certificate binds to a claim its contract names in proves: derived
6
+ * (Kibi checked it against the claim's fact; the only verdict that proves),
7
+ * attested (the fact has no derivation; the author vouches) or rejected.
8
+ */
9
+ export declare const CLAIM_BINDING_VERDICTS: readonly ["derived", "attested", "rejected"];
10
+ export type ClaimBindingVerdict = (typeof CLAIM_BINDING_VERDICTS)[number];
4
11
  export declare const PROOF_RECEIPT_OUTCOMES: readonly ["passed", "failed", "errored", "cancelled", "skipped", "timed_out", "interrupted"];
5
12
  export declare const PROOF_RECEIPT_SCHEMA: {
6
13
  readonly type: "object";
7
- readonly description: "Kibi-derived kibi.proof-receipt.v1. Receipts are never caller-authored; kb_ingest_proof derives them from kibi.proof-run.v1 artifacts.";
14
+ readonly description: "Kibi-derived kibi.proof-receipt.v2 (kibi.proof-receipt.v1 entries are still read). Receipts are never caller-authored; kb_ingest_proof derives them from kibi.proof-run.v1 artifacts.";
8
15
  readonly required: readonly ["version", "receipt_id", "test_id", "scope", "outcome", "code_snapshot", "environment_hash", "started_at", "finished_at", "artifact_digest", "contract_hash", "fingerprint", "fingerprint_components", "integration_id", "producer", "command_argv", "run_outcome", "proof_results"];
9
16
  readonly properties: {
10
17
  readonly version: {
11
18
  readonly type: "string";
12
- readonly const: "kibi.proof-receipt.v1";
19
+ readonly enum: readonly ["kibi.proof-receipt.v1", "kibi.proof-receipt.v2"];
13
20
  };
14
21
  readonly receipt_id: {
15
22
  readonly type: "string";
@@ -191,6 +198,63 @@ export declare const PROOF_RECEIPT_SCHEMA: {
191
198
  readonly additionalProperties: false;
192
199
  };
193
200
  };
201
+ readonly kind: {
202
+ readonly type: "string";
203
+ readonly enum: readonly ["e2e", "example", "property", "exhaustive", "typecheck", "arithmetic", "smt", "rule", "state_machine", "regex", "source"];
204
+ };
205
+ readonly evidence_level: {
206
+ readonly type: "string";
207
+ readonly enum: readonly ["proved", "tested"];
208
+ };
209
+ readonly certificate: {
210
+ readonly type: "object";
211
+ };
212
+ readonly certificate_digest: {
213
+ readonly type: "string";
214
+ readonly pattern: "^[a-f0-9]{64}$";
215
+ };
216
+ readonly certificate_rejection: {
217
+ readonly type: "string";
218
+ readonly minLength: 1;
219
+ };
220
+ readonly claim_bindings: {
221
+ readonly type: "array";
222
+ readonly description: "Certificate kinds: how the certificate binds to each claim its contract names in proves, judged at ingest. derived means Kibi derived the certificate's obligation from the claim's grounding fact and the certificate satisfies it; attested means no derivation exists and the author vouches for it (never proved); rejected names why.";
223
+ readonly items: {
224
+ readonly type: "object";
225
+ readonly required: readonly ["claim_key", "binding"];
226
+ readonly properties: {
227
+ readonly claim_key: {
228
+ readonly type: "string";
229
+ readonly minLength: 1;
230
+ };
231
+ readonly requirement_id: {
232
+ readonly type: "string";
233
+ readonly minLength: 1;
234
+ };
235
+ readonly fact_id: {
236
+ readonly type: "string";
237
+ readonly minLength: 1;
238
+ };
239
+ readonly binding: {
240
+ readonly type: "string";
241
+ readonly enum: readonly ["derived", "attested", "rejected"];
242
+ };
243
+ readonly scope: {
244
+ readonly type: "string";
245
+ readonly enum: readonly ["code", "source", "harness", "intent"];
246
+ };
247
+ readonly obligation: {
248
+ readonly type: "object";
249
+ };
250
+ readonly reason: {
251
+ readonly type: "string";
252
+ readonly minLength: 1;
253
+ };
254
+ };
255
+ readonly additionalProperties: false;
256
+ };
257
+ };
194
258
  readonly gaps: {
195
259
  readonly type: "array";
196
260
  readonly items: {
@@ -217,7 +281,7 @@ export declare const PROOF_RECEIPT_SCHEMA: {
217
281
  readonly additionalProperties: false;
218
282
  };
219
283
  export type ProofReceipt = Readonly<{
220
- version: typeof PROOF_RECEIPT_VERSION;
284
+ version: (typeof PROOF_RECEIPT_VERSIONS)[number];
221
285
  receipt_id: string;
222
286
  test_id: string;
223
287
  scope: "unit" | "integration" | "end_to_end";
@@ -259,13 +323,33 @@ export type ProofReceipt = Readonly<{
259
323
  readonly target: string;
260
324
  readonly reason: string;
261
325
  }[];
326
+ /** v2: what the contract's checker establishes. */
327
+ kind?: ProofKind;
328
+ /** v2: proved only for a passed certificate kind whose certificate re-checked. */
329
+ evidence_level?: "proved" | "tested";
330
+ certificate?: Readonly<Record<string, unknown>>;
331
+ certificate_digest?: string;
332
+ certificate_rejection?: string;
333
+ /** Certificate kinds: the binding to each claim the contract names in proves. */
334
+ claim_bindings?: readonly ClaimBinding[];
335
+ }>;
336
+ /** How one certificate binds to one requirement claim, judged at ingest. */
337
+ export type ClaimBinding = Readonly<{
338
+ claim_key: string;
339
+ requirement_id?: string;
340
+ fact_id?: string;
341
+ binding: ClaimBindingVerdict;
342
+ /** What the proof rests on: evaluated code, project files Kibi read (source), a test harness, or the knowledge base alone (intent). */
343
+ scope?: "code" | "source" | "harness" | "intent";
344
+ obligation?: Readonly<Record<string, unknown>>;
345
+ reason?: string;
262
346
  }>;
263
347
  export declare function finishedAtPrecedesStartedAt(startedAt: number | null, finishedAt: number | null): boolean;
264
- /** Structural validation of one kibi.proof-receipt.v1 entry. */
348
+ /** Structural validation of one kibi.proof-receipt.v1 or v2 entry. */
265
349
  export declare function validProofReceiptShape(testId: string, receipt: unknown): boolean;
266
350
  /**
267
351
  * Full-history validation for proof_receipts: unique ids, per-test binding,
268
- * supported scope, ordered timestamps, and structurally valid v1 entries.
352
+ * supported scope, ordered timestamps, and structurally valid v1 or v2 entries.
269
353
  */
270
354
  export declare function proofReceiptHistoryErrors(testId: string, verificationScope: unknown, receipts: readonly Readonly<Record<string, unknown>>[]): readonly string[];
271
355
  /** The current receipt must match the live scope, contract hash, and fingerprint. */
@@ -1 +1 @@
1
- {"version":3,"file":"proof-receipt.d.ts","sourceRoot":"","sources":["../../src/public/proof-receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAGhC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAE9D,eAAO,MAAM,sBAAsB,8FAQzB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,OAAO,EAC1B,QAAQ,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,GACrD,SAAS,MAAM,EAAE,CAuCnB;AAED,qFAAqF;AACrF,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,OAAO,EAC1B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,QAAQ,CAAC,EAAE,aAAa,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,SAAS,MAAM,EAAE,CAgCnB;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAoBrC,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,EACtD,IAAI,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,GAAG,SAAS,GAC7D,SAAS,MAAM,EAAE,CAqBnB"}
@@ -1,6 +1,17 @@
1
1
  import { canonicalJson, proofContractHash, } from "./proof-fingerprint.js";
2
- import { PROOF_RECEIPT_VERSION, PROOF_RESULT_OUTCOMES, PROOF_RUN_OUTCOMES, } from "./proof-protocol.js";
2
+ import { PROOF_KINDS, PROOF_RECEIPT_VERSION, PROOF_RECEIPT_VERSIONS, PROOF_RESULT_OUTCOMES, PROOF_RUN_OUTCOMES, isCertificateProofKind, } from "./proof-protocol.js";
3
3
  export const PROOF_RECEIPT_MAX_AGE_SECONDS = 7 * 24 * 60 * 60;
4
+ /**
5
+ * How a certificate binds to a claim its contract names in proves: derived
6
+ * (Kibi checked it against the claim's fact; the only verdict that proves),
7
+ * attested (the fact has no derivation; the author vouches) or rejected.
8
+ */
9
+ // implements REQ-kibi-claim-bound-proofs
10
+ export const CLAIM_BINDING_VERDICTS = [
11
+ "derived",
12
+ "attested",
13
+ "rejected",
14
+ ];
4
15
  export const PROOF_RECEIPT_OUTCOMES = [
5
16
  "passed",
6
17
  "failed",
@@ -12,7 +23,7 @@ export const PROOF_RECEIPT_OUTCOMES = [
12
23
  ];
13
24
  export const PROOF_RECEIPT_SCHEMA = {
14
25
  type: "object",
15
- description: "Kibi-derived kibi.proof-receipt.v1. Receipts are never caller-authored; kb_ingest_proof derives them from kibi.proof-run.v1 artifacts.",
26
+ description: "Kibi-derived kibi.proof-receipt.v2 (kibi.proof-receipt.v1 entries are still read). Receipts are never caller-authored; kb_ingest_proof derives them from kibi.proof-run.v1 artifacts.",
16
27
  required: [
17
28
  "version",
18
29
  "receipt_id",
@@ -34,7 +45,7 @@ export const PROOF_RECEIPT_SCHEMA = {
34
45
  "proof_results",
35
46
  ],
36
47
  properties: {
37
- version: { type: "string", const: PROOF_RECEIPT_VERSION },
48
+ version: { type: "string", enum: [...PROOF_RECEIPT_VERSIONS] },
38
49
  receipt_id: {
39
50
  type: "string",
40
51
  pattern: "^PR-[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$",
@@ -131,6 +142,35 @@ export const PROOF_RECEIPT_SCHEMA = {
131
142
  additionalProperties: false,
132
143
  },
133
144
  },
145
+ kind: { type: "string", enum: [...PROOF_KINDS] },
146
+ evidence_level: { type: "string", enum: ["proved", "tested"] },
147
+ certificate: { type: "object" },
148
+ certificate_digest: { type: "string", pattern: "^[a-f0-9]{64}$" },
149
+ certificate_rejection: { type: "string", minLength: 1 },
150
+ claim_bindings: {
151
+ type: "array",
152
+ description: "Certificate kinds: how the certificate binds to each claim its contract names in proves, judged at ingest. derived means Kibi derived the certificate's obligation from the claim's grounding fact and the certificate satisfies it; attested means no derivation exists and the author vouches for it (never proved); rejected names why.",
153
+ items: {
154
+ type: "object",
155
+ required: ["claim_key", "binding"],
156
+ properties: {
157
+ claim_key: { type: "string", minLength: 1 },
158
+ requirement_id: { type: "string", minLength: 1 },
159
+ fact_id: { type: "string", minLength: 1 },
160
+ binding: {
161
+ type: "string",
162
+ enum: [...CLAIM_BINDING_VERDICTS],
163
+ },
164
+ scope: {
165
+ type: "string",
166
+ enum: ["code", "source", "harness", "intent"],
167
+ },
168
+ obligation: { type: "object" },
169
+ reason: { type: "string", minLength: 1 },
170
+ },
171
+ additionalProperties: false,
172
+ },
173
+ },
134
174
  gaps: {
135
175
  type: "array",
136
176
  items: {
@@ -209,12 +249,14 @@ function validFingerprintComponents(value) {
209
249
  hex64(row.bindings) &&
210
250
  hex64(row.producer));
211
251
  }
212
- /** Structural validation of one kibi.proof-receipt.v1 entry. */
252
+ /** Structural validation of one kibi.proof-receipt.v1 or v2 entry. */
213
253
  export function validProofReceiptShape(testId, receipt) {
214
254
  const row = isRecord(receipt) ? receipt : null;
215
255
  if (!row)
216
256
  return false;
217
- if (row.version !== PROOF_RECEIPT_VERSION)
257
+ if (!PROOF_RECEIPT_VERSIONS.includes(row.version))
258
+ return false;
259
+ if (row.version === PROOF_RECEIPT_VERSION && !validV2Fields(row))
218
260
  return false;
219
261
  if (typeof row.receipt_id !== "string" ||
220
262
  !/^PR-[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$/.test(row.receipt_id))
@@ -268,9 +310,48 @@ export function validProofReceiptShape(testId, receipt) {
268
310
  return false;
269
311
  return !finishedAtPrecedesStartedAt(startedAt, finishedAt);
270
312
  }
313
+ // implements REQ-kibi-code-proof-kinds
314
+ function validV2Fields(row) {
315
+ if (!PROOF_KINDS.includes(row.kind))
316
+ return false;
317
+ if (row.evidence_level !== "proved" && row.evidence_level !== "tested")
318
+ return false;
319
+ if (row.evidence_level === "proved" &&
320
+ (row.outcome !== "passed" ||
321
+ !isCertificateProofKind(row.kind) ||
322
+ !isRecord(row.certificate) ||
323
+ !hex64(row.certificate_digest) ||
324
+ row.certificate_rejection !== undefined))
325
+ return false;
326
+ if (row.certificate !== undefined && !isRecord(row.certificate))
327
+ return false;
328
+ if (row.certificate_digest !== undefined && !hex64(row.certificate_digest))
329
+ return false;
330
+ if (row.certificate_rejection !== undefined &&
331
+ !nonEmptyString(row.certificate_rejection))
332
+ return false;
333
+ if (row.claim_bindings !== undefined &&
334
+ !validClaimBindings(row.claim_bindings))
335
+ return false;
336
+ return true;
337
+ }
338
+ // implements REQ-kibi-claim-bound-proofs
339
+ function validClaimBindings(value) {
340
+ return (Array.isArray(value) &&
341
+ value.every((entry) => isRecord(entry) &&
342
+ nonEmptyString(entry.claim_key) &&
343
+ CLAIM_BINDING_VERDICTS.includes(entry.binding) &&
344
+ (entry.scope === undefined ||
345
+ entry.scope === "code" ||
346
+ entry.scope === "source" ||
347
+ entry.scope === "harness" ||
348
+ entry.scope === "intent") &&
349
+ (entry.obligation === undefined || isRecord(entry.obligation)) &&
350
+ (entry.reason === undefined || nonEmptyString(entry.reason))));
351
+ }
271
352
  /**
272
353
  * Full-history validation for proof_receipts: unique ids, per-test binding,
273
- * supported scope, ordered timestamps, and structurally valid v1 entries.
354
+ * supported scope, ordered timestamps, and structurally valid v1 or v2 entries.
274
355
  */
275
356
  export function proofReceiptHistoryErrors(testId, verificationScope, receipts) {
276
357
  const errors = [];
@@ -291,7 +372,7 @@ export function proofReceiptHistoryErrors(testId, verificationScope, receipts) {
291
372
  errors.push(`${prefix}.test_id must equal '${testId}'`);
292
373
  }
293
374
  if (!validProofReceiptShape(testId, receipt)) {
294
- errors.push(`${prefix} must be a structurally valid kibi.proof-receipt.v1 bound to '${testId}'`);
375
+ errors.push(`${prefix} must be a structurally valid kibi.proof-receipt.v2 (or v1) bound to '${testId}'`);
295
376
  continue;
296
377
  }
297
378
  const finishedAt = timestamp(receipt.finished_at);
@@ -0,0 +1,102 @@
1
+ export declare const SOURCE_READERS: readonly ["json", "yaml", "glob", "openapi", "references", "schema", "routes", "validator"];
2
+ export type SourceReader = (typeof SOURCE_READERS)[number];
3
+ /** A source spec as a proof contract states it; see sourceSpecErrors. */
4
+ export type SourceSpec = Readonly<Record<string, unknown>> & Readonly<{
5
+ reader: SourceReader;
6
+ }>;
7
+ /** A column of a table, or a field of a validator object. */
8
+ export type SourceColumn = {
9
+ name: string;
10
+ nullable: boolean;
11
+ optional: boolean;
12
+ };
13
+ /** A table (schema reader) or object (validator reader). */
14
+ export type SourceEntity = {
15
+ name: string;
16
+ columns: SourceColumn[];
17
+ foreign_keys: string[];
18
+ };
19
+ /** One endpoint of a route table and the middleware that runs before it. */
20
+ export type SourceRoute = {
21
+ method: string;
22
+ path: string;
23
+ middleware: string[];
24
+ };
25
+ /**
26
+ * What Kibi read: the selected members (sorted, unique), and for schema,
27
+ * validator and routes readers the structure the field and middleware
28
+ * obligations are decided on.
29
+ */
30
+ export type SourceModel = {
31
+ members: string[];
32
+ entities?: SourceEntity[];
33
+ routes?: SourceRoute[];
34
+ };
35
+ export type SourceRead = {
36
+ ok: true;
37
+ model: SourceModel;
38
+ } | {
39
+ ok: false;
40
+ reason: string;
41
+ };
42
+ /** A place in a file Kibi could not read statically. */
43
+ export type UnresolvedReference = Readonly<{
44
+ file: string;
45
+ line: number;
46
+ text: string;
47
+ }>;
48
+ export declare const REFERENCE_EXTRACTS: readonly ["env", "imports", "calls", "string_args", "thrown", "property"];
49
+ /**
50
+ * Why a source spec is not one Kibi can read, or [] when it is. `label`
51
+ * names the field in the messages (proof_contract.source, ...).
52
+ */
53
+ export declare function sourceSpecErrors(value: unknown, label: string): string[];
54
+ /** The spec with only the keys its reader takes, for contract hashing. */
55
+ export declare function normalizeSourceSpec(value: unknown): SourceSpec | undefined;
56
+ /** Workspace-relative files a glob list matches, sorted. */
57
+ export declare function matchWorkspaceFiles(workspaceRoot: string, patterns: readonly string[], ignore?: readonly string[]): string[];
58
+ export type SourceDependency = Readonly<{
59
+ id: string;
60
+ hash: string;
61
+ }>;
62
+ /**
63
+ * What a read of `spec` depends on, so a receipt goes stale when any of it
64
+ * changes: each file the reader parses (its contents), the set of files a
65
+ * glob matches (their paths), and for the readers that evaluate a module
66
+ * (drizzle schemas, route tables, validators) every workspace module that
67
+ * module imports through relative or tsconfig path imports.
68
+ */
69
+ export declare function sourceDependencies(workspaceRoot: string, spec: SourceSpec): SourceDependency[];
70
+ /**
71
+ * The workspace modules `file` imports, directly or not, through relative
72
+ * imports, the nearest tsconfig's `paths` aliases (following `extends`) and
73
+ * workspace packages linked into node_modules (packages installed from a
74
+ * registry are left out: a lockfile change stales nothing here).
75
+ */
76
+ export declare function importClosure(workspaceRoot: string, file: string): string[];
77
+ /** The entities (tables or validator objects) a spec's table filter selects. */
78
+ export declare function selectedEntities(spec: SourceSpec, model: SourceModel): SourceEntity[];
79
+ /** The routes a spec's path_prefix selects. */
80
+ export declare function selectedRoutes(spec: SourceSpec, routes: SourceRoute[]): SourceRoute[];
81
+ /**
82
+ * Read `spec` from the workspace. Readers that evaluate code (drizzle
83
+ * schemas, route tables, validators) and the references reader go through
84
+ * `evaluate`, which the CLI supplies; a read without it refuses those.
85
+ */
86
+ export declare function readSource(workspaceRoot: string, spec: SourceSpec, evaluate?: SourceCodeEvaluator): Promise<SourceRead>;
87
+ /** What the CLI's code evaluator returns for a reader that runs code. */
88
+ export type SourceCodeEvaluation = {
89
+ ok: true;
90
+ members?: string[];
91
+ entities?: SourceEntity[];
92
+ routes?: SourceRoute[];
93
+ } | {
94
+ ok: false;
95
+ reason: string;
96
+ };
97
+ export type SourceCodeEvaluator = (workspaceRoot: string, spec: SourceSpec) => Promise<SourceCodeEvaluation>;
98
+ /** A short description of a spec, for messages. */
99
+ export declare function describeSource(spec: SourceSpec): string;
100
+ /** Unresolved references, as one rejection reason naming the first few. */
101
+ export declare function unresolvedReason(what: string, unresolved: readonly UnresolvedReference[]): string;
102
+ //# sourceMappingURL=proof-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-sources.d.ts","sourceRoot":"","sources":["../../src/public/proof-sources.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,cAAc,6FASjB,CAAC;AAEX,MAAM,MA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