kibi-cli 2.31.0 → 2.32.0

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 (226) 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/commands/check.d.ts +1 -0
  6. package/dist/commands/check.d.ts.map +1 -1
  7. package/dist/commands/check.js +14 -5
  8. package/dist/commands/discovery-table.d.ts.map +1 -1
  9. package/dist/commands/discovery-table.js +51 -4
  10. package/dist/commands/doctor.js +19 -4
  11. package/dist/commands/migrate.d.ts.map +1 -1
  12. package/dist/commands/migrate.js +89 -3
  13. package/dist/commands/prove.d.ts +48 -1
  14. package/dist/commands/prove.d.ts.map +1 -1
  15. package/dist/commands/prove.js +293 -8
  16. package/dist/commands/report.d.ts +1 -0
  17. package/dist/commands/report.d.ts.map +1 -1
  18. package/dist/commands/report.js +70 -5
  19. package/dist/commands/signoff.d.ts.map +1 -1
  20. package/dist/commands/signoff.js +21 -2
  21. package/dist/commands/sync/manifest.d.ts.map +1 -1
  22. package/dist/commands/sync/manifest.js +20 -4
  23. package/dist/commands/sync/persistence.d.ts.map +1 -1
  24. package/dist/commands/sync/persistence.js +16 -5
  25. package/dist/diagnostics.js +1 -1
  26. package/dist/engine.js +1 -1
  27. package/dist/extractors/markdown.d.ts +3 -1
  28. package/dist/extractors/markdown.d.ts.map +1 -1
  29. package/dist/extractors/markdown.js +17 -0
  30. package/dist/operations/bootstrap/candidate-helpers.d.ts +3 -0
  31. package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
  32. package/dist/operations/bootstrap/candidate-helpers.js +4 -0
  33. package/dist/operations/migration/evidence-floor.d.ts +41 -0
  34. package/dist/operations/migration/evidence-floor.d.ts.map +1 -0
  35. package/dist/operations/migration/evidence-floor.js +230 -0
  36. package/dist/operations/migration/proof-contract-claims.d.ts +59 -0
  37. package/dist/operations/migration/proof-contract-claims.d.ts.map +1 -0
  38. package/dist/operations/migration/proof-contract-claims.js +182 -0
  39. package/dist/operations/migration/schema6.d.ts +6 -0
  40. package/dist/operations/migration/schema6.d.ts.map +1 -1
  41. package/dist/operations/migration/schema6.js +94 -0
  42. package/dist/operations/mutation/omitted-properties.d.ts +11 -0
  43. package/dist/operations/mutation/omitted-properties.d.ts.map +1 -0
  44. package/dist/operations/mutation/omitted-properties.js +76 -0
  45. package/dist/operations/mutation/serialization.d.ts.map +1 -1
  46. package/dist/operations/mutation/serialization.js +1 -0
  47. package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
  48. package/dist/operations/mutation/strict-fact.js +6 -2
  49. package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
  50. package/dist/operations/mutation/symbol-granularity.js +5 -3
  51. package/dist/operations/mutation/upsert.d.ts.map +1 -1
  52. package/dist/operations/mutation/upsert.js +7 -1
  53. package/dist/operations/mutation/validation.d.ts +2 -0
  54. package/dist/operations/mutation/validation.d.ts.map +1 -1
  55. package/dist/operations/mutation/validation.js +4 -0
  56. package/dist/operations/proof/claim-bindings.d.ts +23 -0
  57. package/dist/operations/proof/claim-bindings.d.ts.map +1 -0
  58. package/dist/operations/proof/claim-bindings.js +211 -0
  59. package/dist/operations/proof/code-certificates.d.ts +135 -0
  60. package/dist/operations/proof/code-certificates.d.ts.map +1 -0
  61. package/dist/operations/proof/code-certificates.js +785 -0
  62. package/dist/operations/proof/code-scope.d.ts +11 -1
  63. package/dist/operations/proof/code-scope.d.ts.map +1 -1
  64. package/dist/operations/proof/code-scope.js +20 -2
  65. package/dist/operations/proof/compact-receipts.d.ts.map +1 -1
  66. package/dist/operations/proof/compact-receipts.js +4 -3
  67. package/dist/operations/proof/explain.d.ts +32 -0
  68. package/dist/operations/proof/explain.d.ts.map +1 -1
  69. package/dist/operations/proof/explain.js +91 -0
  70. package/dist/operations/proof/ingest-proof.d.ts +9 -1
  71. package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
  72. package/dist/operations/proof/ingest-proof.js +41 -2
  73. package/dist/operations/proof/receipt-compaction.d.ts +2 -0
  74. package/dist/operations/proof/receipt-compaction.d.ts.map +1 -1
  75. package/dist/operations/proof/receipt-compaction.js +6 -2
  76. package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
  77. package/dist/operations/semantic-advisor/shared.js +4 -0
  78. package/dist/operations/semantic-advisor/strict-rules.js +3 -3
  79. package/dist/operations/semantic-advisor/types.d.ts +2 -1
  80. package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
  81. package/dist/plugins/approved-source-analyzers.generated.d.ts +6 -6
  82. package/dist/plugins/approved-source-analyzers.generated.js +6 -6
  83. package/dist/proof/command-test-report.d.ts +4 -3
  84. package/dist/proof/command-test-report.d.ts.map +1 -1
  85. package/dist/proof/command-test-report.js +4 -10
  86. package/dist/proof/evaluate.d.ts.map +1 -1
  87. package/dist/proof/evaluate.js +18 -2
  88. package/dist/proof/inspect.d.ts.map +1 -1
  89. package/dist/proof/inspect.js +58 -0
  90. package/dist/proof/producers/playwright-reporter.d.ts +3 -0
  91. package/dist/proof/producers/playwright-reporter.d.ts.map +1 -1
  92. package/dist/proof/producers/playwright-reporter.js +25 -2
  93. package/dist/proof/step-runner.d.ts +36 -0
  94. package/dist/proof/step-runner.d.ts.map +1 -0
  95. package/dist/proof/step-runner.js +234 -0
  96. package/dist/public/evidence-levels.d.ts +12 -0
  97. package/dist/public/evidence-levels.d.ts.map +1 -0
  98. package/dist/public/evidence-levels.js +19 -0
  99. package/dist/public/impact/coverage-depth-quality.d.ts +7 -0
  100. package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
  101. package/dist/public/impact/coverage-depth-quality.js +59 -0
  102. package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
  103. package/dist/public/impact/full-kb-quality.js +3 -1
  104. package/dist/public/operations/catalog.d.ts +167 -6
  105. package/dist/public/operations/catalog.d.ts.map +1 -1
  106. package/dist/public/operations/check-executor.d.ts +2 -0
  107. package/dist/public/operations/check-executor.d.ts.map +1 -1
  108. package/dist/public/operations/check-executor.js +6 -0
  109. package/dist/public/operations/evidence-floor.d.ts +48 -0
  110. package/dist/public/operations/evidence-floor.d.ts.map +1 -0
  111. package/dist/public/operations/evidence-floor.js +143 -0
  112. package/dist/public/operations/migration-plan.d.ts +19 -5
  113. package/dist/public/operations/migration-plan.d.ts.map +1 -1
  114. package/dist/public/operations/migration-plan.js +22 -5
  115. package/dist/public/operations/node-ports.d.ts.map +1 -1
  116. package/dist/public/operations/node-ports.js +4 -1
  117. package/dist/public/operations/proof-contract-claims.d.ts +26 -0
  118. package/dist/public/operations/proof-contract-claims.d.ts.map +1 -0
  119. package/dist/public/operations/proof-contract-claims.js +71 -0
  120. package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
  121. package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
  122. package/dist/public/operations/specs/check-rules.generated.js +3 -1
  123. package/dist/public/operations/specs/check.d.ts +1 -1
  124. package/dist/public/operations/specs/mutation-schemas.d.ts +157 -5
  125. package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
  126. package/dist/public/operations/specs/mutation-schemas.js +15 -2
  127. package/dist/public/operations/specs/proof.d.ts +9 -0
  128. package/dist/public/operations/specs/proof.d.ts.map +1 -1
  129. package/dist/public/operations/specs/reporting.d.ts.map +1 -1
  130. package/dist/public/operations/specs/reporting.js +19 -10
  131. package/dist/public/operations/specs/upsert.d.ts +157 -5
  132. package/dist/public/operations/specs/upsert.d.ts.map +1 -1
  133. package/dist/public/proof-certificates.d.ts +89 -0
  134. package/dist/public/proof-certificates.d.ts.map +1 -0
  135. package/dist/public/proof-certificates.js +207 -0
  136. package/dist/public/proof-protocol.d.ts +126 -3
  137. package/dist/public/proof-protocol.d.ts.map +1 -1
  138. package/dist/public/proof-protocol.js +239 -3
  139. package/dist/public/proof-receipt.d.ts +89 -6
  140. package/dist/public/proof-receipt.d.ts.map +1 -1
  141. package/dist/public/proof-receipt.js +83 -7
  142. package/dist/public/schemas/entity.d.ts.map +1 -1
  143. package/dist/public/schemas/entity.js +18 -1
  144. package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
  145. package/dist/public/skills/kibi-commit-review/SKILL.md +4 -3
  146. package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +6 -1
  147. package/dist/public/skills/kibi-decisions/SKILL.md +10 -2
  148. package/dist/public/skills/kibi-decisions/resources/decision-records.md +6 -1
  149. package/dist/public/skills/kibi-decisions/resources/signoff-views.md +3 -2
  150. package/dist/public/skills/kibi-freshness/SKILL.md +5 -1
  151. package/dist/public/skills/kibi-traceability/SKILL.md +11 -1
  152. package/dist/public/skills/kibi-usage/SKILL.md +6 -4
  153. package/dist/public/skills/kibi-usage/resources/proof.md +124 -19
  154. package/dist/public/skills/kibi-usage/resources/workflows.md +4 -4
  155. package/dist/report/html-report.css +38 -1
  156. package/dist/report/html-report.d.ts +8 -0
  157. package/dist/report/html-report.d.ts.map +1 -1
  158. package/dist/report/html-report.js +141 -6
  159. package/dist/report/report-view.d.ts +1 -1
  160. package/dist/report/report-view.d.ts.map +1 -1
  161. package/dist/report/report-view.js +7 -0
  162. package/dist/schemas/entity.schema.json +212 -4
  163. package/dist/search-answer.d.ts.map +1 -1
  164. package/dist/search-answer.js +1 -0
  165. package/dist/signoff/html.d.ts.map +1 -1
  166. package/dist/signoff/html.js +3 -0
  167. package/dist/signoff/markdown.d.ts.map +1 -1
  168. package/dist/signoff/markdown.js +3 -0
  169. package/dist/signoff/model.d.ts +20 -0
  170. package/dist/signoff/model.d.ts.map +1 -1
  171. package/dist/signoff/model.js +20 -1
  172. package/dist/traceability/impact-knowledge.d.ts.map +1 -1
  173. package/dist/traceability/impact-knowledge.js +1 -0
  174. package/dist/traceability/temp-kb.d.ts.map +1 -1
  175. package/dist/traceability/temp-kb.js +1 -0
  176. package/dist/types/entities.d.ts +4 -1
  177. package/dist/types/entities.d.ts.map +1 -1
  178. package/dist/utils/merge-driver-setup.d.ts +8 -1
  179. package/dist/utils/merge-driver-setup.d.ts.map +1 -1
  180. package/dist/utils/merge-driver-setup.js +23 -2
  181. package/dist/utils/rule-registry.generated.d.ts +10 -0
  182. package/dist/utils/rule-registry.generated.d.ts.map +1 -1
  183. package/dist/utils/rule-registry.generated.js +12 -0
  184. package/dist/utils/schema-version.d.ts +1 -1
  185. package/dist/utils/schema-version.d.ts.map +1 -1
  186. package/dist/utils/schema-version.js +5 -1
  187. package/package.json +6 -2
  188. package/schema/entities.pl +6 -0
  189. package/schema/validation.pl +4 -1
  190. package/src/public/evidence-levels.ts +23 -0
  191. package/src/public/impact/coverage-depth-quality.ts +73 -0
  192. package/src/public/impact/full-kb-quality.ts +6 -1
  193. package/src/public/operations/check-executor.ts +13 -0
  194. package/src/public/operations/evidence-floor.ts +203 -0
  195. package/src/public/operations/migration-plan.ts +39 -6
  196. package/src/public/operations/node-ports.ts +3 -1
  197. package/src/public/operations/proof-contract-claims.ts +103 -0
  198. package/src/public/operations/specs/check-rules.generated.ts +3 -1
  199. package/src/public/operations/specs/mutation-schemas.ts +17 -2
  200. package/src/public/operations/specs/reporting.ts +20 -10
  201. package/src/public/proof-certificates.ts +271 -0
  202. package/src/public/proof-protocol-types.d.ts +17 -1
  203. package/src/public/proof-protocol.ts +318 -3
  204. package/src/public/proof-receipt.ts +127 -7
  205. package/src/public/schemas/entity.ts +19 -1
  206. package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
  207. package/src/public/skills/kibi-commit-review/SKILL.md +4 -3
  208. package/src/public/skills/kibi-commit-review/resources/staged-gate.md +6 -1
  209. package/src/public/skills/kibi-decisions/SKILL.md +10 -2
  210. package/src/public/skills/kibi-decisions/resources/decision-records.md +6 -1
  211. package/src/public/skills/kibi-decisions/resources/signoff-views.md +3 -2
  212. package/src/public/skills/kibi-freshness/SKILL.md +5 -1
  213. package/src/public/skills/kibi-traceability/SKILL.md +11 -1
  214. package/src/public/skills/kibi-usage/SKILL.md +6 -4
  215. package/src/public/skills/kibi-usage/resources/proof.md +124 -19
  216. package/src/public/skills/kibi-usage/resources/workflows.md +4 -4
  217. package/src/schemas/entity.schema.json +212 -4
  218. package/dist/commands/proof-impact.d.ts +0 -7
  219. package/dist/commands/proof-impact.d.ts.map +0 -1
  220. package/dist/commands/proof-impact.js +0 -39
  221. package/dist/operations/proof/baseline-diff.d.ts +0 -41
  222. package/dist/operations/proof/baseline-diff.d.ts.map +0 -1
  223. package/dist/operations/proof/baseline-diff.js +0 -153
  224. package/dist/operations/proof/impact.d.ts +0 -51
  225. package/dist/operations/proof/impact.d.ts.map +0 -1
  226. package/dist/operations/proof/impact.js +0 -138
@@ -1,14 +1,43 @@
1
1
  export declare const PROOF_RUN_VERSION: "kibi.proof-run.v1";
2
2
  export declare const PROOF_CONTRACT_VERSION: "kibi.proof-contract.v1";
3
- export declare const PROOF_RECEIPT_VERSION: "kibi.proof-receipt.v1";
3
+ /**
4
+ * Receipts Kibi writes. v2 adds the contract's kind, the evidence level the
5
+ * receipt supports, and for certificate kinds the re-checked certificate.
6
+ */
7
+ export declare const PROOF_RECEIPT_VERSION: "kibi.proof-receipt.v2";
8
+ /** Receipts written before v2; still read, as e2e evidence at tested. */
9
+ export declare const PROOF_RECEIPT_V1_VERSION: "kibi.proof-receipt.v1";
10
+ export declare const PROOF_RECEIPT_VERSIONS: readonly ["kibi.proof-receipt.v1", "kibi.proof-receipt.v2"];
11
+ /** The certificate a certificate-kind proof leaves for Kibi to re-check. */
12
+ export declare const CODE_CERTIFICATE_VERSION: "kibi.code-certificate.v1";
4
13
  export declare const PROOF_INTEGRATION_VERSION: "kibi.proof-integration.v1";
5
14
  export declare const PROOF_RUN_OUTCOMES: readonly ["passed", "failed", "errored", "cancelled", "timed_out", "interrupted", "no_results"];
6
15
  export declare const PROOF_RESULT_OUTCOMES: readonly ["passed", "failed", "timed_out", "skipped", "interrupted", "errored"];
7
16
  export declare const PROOF_BINDING_KINDS: readonly ["native_case", "aggregate_run"];
8
17
  export declare const ATTEMPTS_STATUS: readonly ["complete", "unavailable"];
9
18
  export declare const RUN_FAILURE_PHASES: readonly ["setup", "collection", "execution", "teardown", "infrastructure"];
10
- export declare const SUCCESS_POLICIES: readonly ["all_required_first_attempt"];
19
+ /**
20
+ * `all_required_first_attempt`: the whole run must pass and every obligation's
21
+ * own result must pass on its first attempt.
22
+ * `own_results_first_attempt`: a run whose only failures are other test cases
23
+ * (outcome `failed` in the execution phase) still proves an obligation whose
24
+ * own native-case result passed on its first attempt, so one unrelated
25
+ * failing case does not erase a suite's evidence. Aggregate-run obligations
26
+ * still need the whole run to pass.
27
+ */
28
+ export declare const SUCCESS_POLICIES: readonly ["all_required_first_attempt", "own_results_first_attempt"];
29
+ /**
30
+ * What a proof contract's checker establishes. Runner kinds (e2e, example,
31
+ * property) sample cases and support tested evidence; certificate kinds
32
+ * (exhaustive, typecheck, arithmetic, smt) cover every case and support
33
+ * proved evidence once Kibi re-checks the certificate the run left.
34
+ */
35
+ export declare const PROOF_KINDS: readonly ["e2e", "example", "property", "exhaustive", "typecheck", "arithmetic", "smt"];
36
+ export declare const CERTIFICATE_PROOF_KINDS: readonly ["exhaustive", "typecheck", "arithmetic", "smt"];
37
+ export type ProofKind = (typeof PROOF_KINDS)[number];
38
+ export declare function isCertificateProofKind(kind: unknown): boolean;
11
39
  export type { AttemptsStatus, ProducerProvenance, ProofAttempt, ProofAttempts, ProofBinding, ProofBindingKind, ProofContract, ProofEnvironment, ProofObligation, ProofResult, ProofResultOutcome, ProofRun, ProofRunArtifact, ProofRunOutcome, RunFailurePhase, SuccessPolicy, } from "./proof-protocol-types.js";
40
+ import type { ProofContract } from "./proof-protocol-types.js";
12
41
  export declare const PROOF_RESULT_SCHEMA: {
13
42
  readonly type: "object";
14
43
  readonly description: "One observed proof result. binding distinguishes native-case observations from aggregate-run bindings; attempts must report facts only.";
@@ -266,6 +295,15 @@ export declare const PROOF_RUN_ARTIFACT_SCHEMA: {
266
295
  readonly minLength: 1;
267
296
  };
268
297
  };
298
+ readonly certificates: {
299
+ readonly type: "array";
300
+ readonly description: "kibi.code-certificate.v1 objects the run left for certificate-kind contracts, one per test. Kibi re-checks each before a receipt counts as proved.";
301
+ readonly maxItems: 1000;
302
+ readonly items: {
303
+ readonly type: "object";
304
+ readonly required: readonly ["version", "kind", "test_id"];
305
+ };
306
+ };
269
307
  };
270
308
  readonly additionalProperties: false;
271
309
  };
@@ -304,7 +342,87 @@ export declare const PROOF_CONTRACT_SCHEMA: {
304
342
  };
305
343
  readonly success_policy: {
306
344
  readonly type: "string";
307
- readonly enum: readonly ["all_required_first_attempt"];
345
+ readonly enum: readonly ["all_required_first_attempt", "own_results_first_attempt"];
346
+ };
347
+ readonly kind: {
348
+ readonly type: "string";
349
+ readonly enum: readonly ["e2e", "example", "property", "exhaustive", "typecheck", "arithmetic", "smt"];
350
+ readonly description: "What the checker establishes; absent means e2e. exhaustive, typecheck, arithmetic and smt must leave a kibi.code-certificate.v1 that Kibi re-checks before the receipt counts as proved.";
351
+ };
352
+ readonly domain_source: {
353
+ readonly type: "object";
354
+ readonly description: "exhaustive and typecheck: the symbol that defines the finite domain. The proof must import it from its source file; a hand-listed domain downgrades the receipt to example. Kibi reads the export named `export`, or the symbol's title when `export` is absent.";
355
+ readonly required: readonly ["symbol_id"];
356
+ readonly properties: {
357
+ readonly symbol_id: {
358
+ readonly type: "string";
359
+ readonly minLength: 1;
360
+ };
361
+ readonly export: {
362
+ readonly type: "string";
363
+ readonly minLength: 1;
364
+ readonly description: "The name the domain is exported under in the symbol's source file, when the symbol's title is not that name.";
365
+ };
366
+ };
367
+ readonly additionalProperties: false;
368
+ };
369
+ readonly witness: {
370
+ readonly type: "object";
371
+ readonly description: "typecheck: the repository-relative witness file Kibi compiles (an exhaustive switch ending in never, or a mapped type over the domain).";
372
+ readonly required: readonly ["path"];
373
+ readonly properties: {
374
+ readonly path: {
375
+ readonly type: "string";
376
+ readonly minLength: 1;
377
+ };
378
+ };
379
+ readonly additionalProperties: false;
380
+ };
381
+ readonly proves: {
382
+ readonly type: "array";
383
+ readonly description: "Certificate kinds: the requirement claim keys (CLAIM-...) this certificate proves. Each must be a modeled claim of a current requirement the test reaches through its scenarios. Kibi derives what the certificate must establish from the claim's grounding fact (a set fact for exhaustive or typecheck, a numeric fact for arithmetic or smt); a claim with no such derivation is only attested and never counts as proved.";
384
+ readonly minItems: 1;
385
+ readonly items: {
386
+ readonly type: "string";
387
+ readonly pattern: "^CLAIM-";
388
+ };
389
+ readonly uniqueItems: true;
390
+ };
391
+ readonly value_source: {
392
+ readonly type: "array";
393
+ readonly description: "arithmetic and smt: code constants the assumptions read. Kibi evaluates each export at ingest and requires the certificate to assume the variable equals that value, so the proof is about the code and not only the knowledge base.";
394
+ readonly minItems: 1;
395
+ readonly items: {
396
+ readonly type: "object";
397
+ readonly required: readonly ["symbol_id"];
398
+ readonly properties: {
399
+ readonly symbol_id: {
400
+ readonly type: "string";
401
+ readonly minLength: 1;
402
+ };
403
+ readonly export: {
404
+ readonly type: "string";
405
+ readonly minLength: 1;
406
+ };
407
+ };
408
+ readonly additionalProperties: false;
409
+ };
410
+ };
411
+ readonly constraint_source: {
412
+ readonly type: "object";
413
+ readonly description: "arithmetic and smt: the typed numeric property_value facts the certificate's assumptions come from. Kibi checks the assumptions (or the query's assertions) are exactly these facts' constraints, so the proof is about the knowledge base, not numbers the test chose.";
414
+ readonly required: readonly ["fact_ids"];
415
+ readonly properties: {
416
+ readonly fact_ids: {
417
+ readonly type: "array";
418
+ readonly minItems: 1;
419
+ readonly items: {
420
+ readonly type: "string";
421
+ readonly minLength: 1;
422
+ };
423
+ };
424
+ };
425
+ readonly additionalProperties: false;
308
426
  };
309
427
  };
310
428
  readonly additionalProperties: false;
@@ -350,5 +468,10 @@ export declare const PROOF_BINDINGS_SCHEMA: {
350
468
  export declare function proofResultErrors(value: unknown, label: string): string[];
351
469
  export declare function proofRunArtifactErrors(value: unknown): string[];
352
470
  export declare function proofContractErrors(value: unknown): string[];
471
+ /**
472
+ * The optional contract fields beyond the v1 core, copied only when present
473
+ * so existing contracts keep their hash.
474
+ */
475
+ export declare function optionalProofContractFields(contract: Record<string, unknown>): Pick<ProofContract, "kind" | "domain_source" | "witness" | "constraint_source" | "value_source" | "proves">;
353
476
  export declare function proofBindingsErrors(value: unknown): string[];
354
477
  //# sourceMappingURL=proof-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proof-protocol.d.ts","sourceRoot":"","sources":["../../src/public/proof-protocol.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,EAAG,mBAA4B,CAAC;AAE9D,eAAO,MAAM,sBAAsB,EAAG,wBAAiC,CAAC;AAExE,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AAEtE,eAAO,MAAM,yBAAyB,EAAG,2BAAoC,CAAC;AAE9E,eAAO,MAAM,kBAAkB,iGAQrB,CAAC;AAEX,eAAO,MAAM,qBAAqB,iFAOxB,CAAC;AAEX,eAAO,MAAM,mBAAmB,2CAA4C,CAAC;AAE7E,eAAO,MAAM,eAAe,sCAAuC,CAAC;AAEpE,eAAO,MAAM,kBAAkB,6EAMrB,CAAC;AAEX,eAAO,MAAM,gBAAgB,yCAA0C,CAAC;AAExE,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,aAAa,GACd,MAAM,2BAA2B,CAAC;AAWnC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DtB,CAAC;AAEX,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;CA4FxB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBxB,CAAC;AA0GX,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAgCzE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAoH/D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAyD5D;AAwGD;;;GAGG;AAEH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CACL,aAAa,EACX,MAAM,GACN,eAAe,GACf,SAAS,GACT,mBAAmB,GACnB,cAAc,GACd,QAAQ,CACX,CA2CA;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CA8C5D"}
@@ -2,8 +2,23 @@
2
2
  export const PROOF_RUN_VERSION = "kibi.proof-run.v1";
3
3
  // implements REQ-kibi-verification-evidence-contract
4
4
  export const PROOF_CONTRACT_VERSION = "kibi.proof-contract.v1";
5
- // implements REQ-kibi-verification-evidence-contract
6
- export const PROOF_RECEIPT_VERSION = "kibi.proof-receipt.v1";
5
+ /**
6
+ * Receipts Kibi writes. v2 adds the contract's kind, the evidence level the
7
+ * receipt supports, and for certificate kinds the re-checked certificate.
8
+ */
9
+ // implements REQ-kibi-verification-evidence-contract, REQ-kibi-code-proof-kinds
10
+ export const PROOF_RECEIPT_VERSION = "kibi.proof-receipt.v2";
11
+ /** Receipts written before v2; still read, as e2e evidence at tested. */
12
+ // implements REQ-kibi-code-proof-kinds
13
+ export const PROOF_RECEIPT_V1_VERSION = "kibi.proof-receipt.v1";
14
+ // implements REQ-kibi-code-proof-kinds
15
+ export const PROOF_RECEIPT_VERSIONS = [
16
+ PROOF_RECEIPT_V1_VERSION,
17
+ PROOF_RECEIPT_VERSION,
18
+ ];
19
+ /** The certificate a certificate-kind proof leaves for Kibi to re-check. */
20
+ // implements REQ-kibi-code-proof-kinds
21
+ export const CODE_CERTIFICATE_VERSION = "kibi.code-certificate.v1";
7
22
  // implements REQ-kibi-verification-evidence-contract
8
23
  export const PROOF_INTEGRATION_VERSION = "kibi.proof-integration.v1";
9
24
  export const PROOF_RUN_OUTCOMES = [
@@ -32,7 +47,46 @@ export const RUN_FAILURE_PHASES = [
32
47
  "teardown",
33
48
  "infrastructure",
34
49
  ];
35
- export const SUCCESS_POLICIES = ["all_required_first_attempt"];
50
+ /**
51
+ * `all_required_first_attempt`: the whole run must pass and every obligation's
52
+ * own result must pass on its first attempt.
53
+ * `own_results_first_attempt`: a run whose only failures are other test cases
54
+ * (outcome `failed` in the execution phase) still proves an obligation whose
55
+ * own native-case result passed on its first attempt, so one unrelated
56
+ * failing case does not erase a suite's evidence. Aggregate-run obligations
57
+ * still need the whole run to pass.
58
+ */
59
+ export const SUCCESS_POLICIES = [
60
+ "all_required_first_attempt",
61
+ "own_results_first_attempt",
62
+ ];
63
+ /**
64
+ * What a proof contract's checker establishes. Runner kinds (e2e, example,
65
+ * property) sample cases and support tested evidence; certificate kinds
66
+ * (exhaustive, typecheck, arithmetic, smt) cover every case and support
67
+ * proved evidence once Kibi re-checks the certificate the run left.
68
+ */
69
+ // implements REQ-kibi-code-proof-kinds
70
+ export const PROOF_KINDS = [
71
+ "e2e",
72
+ "example",
73
+ "property",
74
+ "exhaustive",
75
+ "typecheck",
76
+ "arithmetic",
77
+ "smt",
78
+ ];
79
+ // implements REQ-kibi-code-proof-kinds
80
+ export const CERTIFICATE_PROOF_KINDS = [
81
+ "exhaustive",
82
+ "typecheck",
83
+ "arithmetic",
84
+ "smt",
85
+ ];
86
+ // implements REQ-kibi-code-proof-kinds
87
+ export function isCertificateProofKind(kind) {
88
+ return CERTIFICATE_PROOF_KINDS.includes(kind);
89
+ }
36
90
  export const PROOF_RESULT_SCHEMA = {
37
91
  type: "object",
38
92
  description: "One observed proof result. binding distinguishes native-case observations from aggregate-run bindings; attempts must report facts only.",
@@ -152,6 +206,12 @@ export const PROOF_RUN_ARTIFACT_SCHEMA = {
152
206
  type: "array",
153
207
  items: { type: "string", minLength: 1 },
154
208
  },
209
+ certificates: {
210
+ type: "array",
211
+ description: "kibi.code-certificate.v1 objects the run left for certificate-kind contracts, one per test. Kibi re-checks each before a receipt counts as proved.",
212
+ maxItems: 1000,
213
+ items: { type: "object", required: ["version", "kind", "test_id"] },
214
+ },
155
215
  },
156
216
  additionalProperties: false,
157
217
  };
@@ -177,6 +237,66 @@ export const PROOF_CONTRACT_SCHEMA = {
177
237
  },
178
238
  },
179
239
  success_policy: { type: "string", enum: [...SUCCESS_POLICIES] },
240
+ kind: {
241
+ type: "string",
242
+ enum: [...PROOF_KINDS],
243
+ description: "What the checker establishes; absent means e2e. exhaustive, typecheck, arithmetic and smt must leave a kibi.code-certificate.v1 that Kibi re-checks before the receipt counts as proved.",
244
+ },
245
+ domain_source: {
246
+ type: "object",
247
+ description: "exhaustive and typecheck: the symbol that defines the finite domain. The proof must import it from its source file; a hand-listed domain downgrades the receipt to example. Kibi reads the export named `export`, or the symbol's title when `export` is absent.",
248
+ required: ["symbol_id"],
249
+ properties: {
250
+ symbol_id: { type: "string", minLength: 1 },
251
+ export: {
252
+ type: "string",
253
+ minLength: 1,
254
+ description: "The name the domain is exported under in the symbol's source file, when the symbol's title is not that name.",
255
+ },
256
+ },
257
+ additionalProperties: false,
258
+ },
259
+ witness: {
260
+ type: "object",
261
+ description: "typecheck: the repository-relative witness file Kibi compiles (an exhaustive switch ending in never, or a mapped type over the domain).",
262
+ required: ["path"],
263
+ properties: { path: { type: "string", minLength: 1 } },
264
+ additionalProperties: false,
265
+ },
266
+ proves: {
267
+ type: "array",
268
+ description: "Certificate kinds: the requirement claim keys (CLAIM-...) this certificate proves. Each must be a modeled claim of a current requirement the test reaches through its scenarios. Kibi derives what the certificate must establish from the claim's grounding fact (a set fact for exhaustive or typecheck, a numeric fact for arithmetic or smt); a claim with no such derivation is only attested and never counts as proved.",
269
+ minItems: 1,
270
+ items: { type: "string", pattern: "^CLAIM-" },
271
+ uniqueItems: true,
272
+ },
273
+ value_source: {
274
+ type: "array",
275
+ description: "arithmetic and smt: code constants the assumptions read. Kibi evaluates each export at ingest and requires the certificate to assume the variable equals that value, so the proof is about the code and not only the knowledge base.",
276
+ minItems: 1,
277
+ items: {
278
+ type: "object",
279
+ required: ["symbol_id"],
280
+ properties: {
281
+ symbol_id: { type: "string", minLength: 1 },
282
+ export: { type: "string", minLength: 1 },
283
+ },
284
+ additionalProperties: false,
285
+ },
286
+ },
287
+ constraint_source: {
288
+ type: "object",
289
+ description: "arithmetic and smt: the typed numeric property_value facts the certificate's assumptions come from. Kibi checks the assumptions (or the query's assertions) are exactly these facts' constraints, so the proof is about the knowledge base, not numbers the test chose.",
290
+ required: ["fact_ids"],
291
+ properties: {
292
+ fact_ids: {
293
+ type: "array",
294
+ minItems: 1,
295
+ items: { type: "string", minLength: 1 },
296
+ },
297
+ },
298
+ additionalProperties: false,
299
+ },
180
300
  },
181
301
  additionalProperties: false,
182
302
  };
@@ -371,6 +491,20 @@ export function proofRunArtifactErrors(value) {
371
491
  !artifact.diagnostics.every((entry) => nonEmptyString(entry)))
372
492
  errors.push("artifact.diagnostics must be an array of non-empty strings");
373
493
  }
494
+ if (artifact.certificates !== undefined) {
495
+ if (!Array.isArray(artifact.certificates))
496
+ errors.push("artifact.certificates must be an array when present");
497
+ else
498
+ artifact.certificates.forEach((entry, index) => {
499
+ const row = record(entry);
500
+ if (!row ||
501
+ !nonEmptyString(row.version) ||
502
+ !includes(CERTIFICATE_PROOF_KINDS, row.kind) ||
503
+ !nonEmptyString(row.test_id) ||
504
+ !isPlainJson(row))
505
+ errors.push(`artifact.certificates[${index}] must be a JSON object with version, a certificate kind (${CERTIFICATE_PROOF_KINDS.join(", ")}) and test_id`);
506
+ });
507
+ }
374
508
  return errors;
375
509
  }
376
510
  export function proofContractErrors(value) {
@@ -413,8 +547,110 @@ export function proofContractErrors(value) {
413
547
  }
414
548
  if (!includes(SUCCESS_POLICIES, contract.success_policy))
415
549
  errors.push(`proof_contract.success_policy must be one of: ${SUCCESS_POLICIES.join(", ")}; received ${JSON.stringify(contract.success_policy ?? null)}`);
550
+ errors.push(...proofContractKindErrors(contract));
551
+ return errors;
552
+ }
553
+ // implements REQ-kibi-code-proof-kinds
554
+ function proofContractKindErrors(contract) {
555
+ const errors = [];
556
+ const kind = contract.kind;
557
+ if (kind !== undefined && !includes(PROOF_KINDS, kind))
558
+ errors.push(`proof_contract.kind must be one of: ${PROOF_KINDS.join(", ")}; received ${JSON.stringify(kind)}`);
559
+ const domain = contract.domain_source;
560
+ if (domain !== undefined) {
561
+ const row = record(domain);
562
+ if (!row ||
563
+ !nonEmptyString(row.symbol_id) ||
564
+ (row.export !== undefined && !nonEmptyString(row.export)) ||
565
+ Object.keys(row).some((key) => key !== "symbol_id" && key !== "export"))
566
+ errors.push("proof_contract.domain_source must be {symbol_id, export?} naming the symbol that defines the domain and, when its title is not the export name, the export to read");
567
+ }
568
+ else if (kind === "exhaustive" || kind === "typecheck")
569
+ errors.push(`proof_contract.domain_source is required for kind ${String(kind)}: name the symbol the proof reads its domain from`);
570
+ const witness = contract.witness;
571
+ if (witness !== undefined) {
572
+ const row = record(witness);
573
+ if (!row || !nonEmptyString(row.path) || Object.keys(row).length !== 1)
574
+ errors.push("proof_contract.witness must be {path} naming the repository-relative witness file");
575
+ }
576
+ else if (kind === "typecheck")
577
+ errors.push("proof_contract.witness is required for kind typecheck: name the file the type checker compiles");
578
+ const source = contract.constraint_source;
579
+ if (source !== undefined) {
580
+ const row = record(source);
581
+ const ids = row?.fact_ids;
582
+ if (!row ||
583
+ Object.keys(row).length !== 1 ||
584
+ !Array.isArray(ids) ||
585
+ ids.length === 0 ||
586
+ !ids.every(nonEmptyString))
587
+ errors.push("proof_contract.constraint_source must be {fact_ids: [FACT-...]} naming the facts the assumptions come from");
588
+ }
589
+ else if ((kind === "arithmetic" || kind === "smt") &&
590
+ contract.value_source === undefined)
591
+ errors.push(`proof_contract.constraint_source or value_source is required for kind ${String(kind)}: name the typed facts or code constants its assumptions come from`);
592
+ const valueSource = contract.value_source;
593
+ if (valueSource !== undefined) {
594
+ if (!Array.isArray(valueSource) ||
595
+ valueSource.length === 0 ||
596
+ !valueSource.every((entry) => {
597
+ const row = record(entry);
598
+ return (row !== null &&
599
+ nonEmptyString(row.symbol_id) &&
600
+ (row.export === undefined || nonEmptyString(row.export)) &&
601
+ Object.keys(row).every((key) => key === "symbol_id" || key === "export"));
602
+ }))
603
+ errors.push("proof_contract.value_source must be [{symbol_id, export?}] naming the code constants the assumptions read");
604
+ else if (kind !== "arithmetic" && kind !== "smt")
605
+ errors.push(`proof_contract.value_source applies only to kind arithmetic or smt, not ${String(kind ?? "e2e")}`);
606
+ }
607
+ const proves = contract.proves;
608
+ if (proves !== undefined) {
609
+ if (!Array.isArray(proves) ||
610
+ proves.length === 0 ||
611
+ !proves.every((key) => typeof key === "string" && /^CLAIM-[A-Za-z0-9]+$/.test(key)) ||
612
+ new Set(proves).size !== proves.length)
613
+ errors.push("proof_contract.proves must be a non-empty list of distinct claim keys (CLAIM-...) the certificate proves");
614
+ else if (!isCertificateProofKind(kind))
615
+ errors.push(`proof_contract.proves applies only to certificate kinds (exhaustive, typecheck, arithmetic, smt), not ${String(kind ?? "e2e")}`);
616
+ }
416
617
  return errors;
417
618
  }
619
+ /**
620
+ * The optional contract fields beyond the v1 core, copied only when present
621
+ * so existing contracts keep their hash.
622
+ */
623
+ // implements REQ-kibi-code-proof-kinds
624
+ export function optionalProofContractFields(contract) {
625
+ const fields = {};
626
+ if (typeof contract.kind === "string")
627
+ fields.kind = contract.kind;
628
+ const domain = record(contract.domain_source);
629
+ if (domain && typeof domain.symbol_id === "string")
630
+ fields.domain_source = {
631
+ symbol_id: domain.symbol_id,
632
+ ...(typeof domain.export === "string" ? { export: domain.export } : {}),
633
+ };
634
+ const witness = record(contract.witness);
635
+ if (witness && typeof witness.path === "string")
636
+ fields.witness = { path: witness.path };
637
+ const source = record(contract.constraint_source);
638
+ if (source && Array.isArray(source.fact_ids))
639
+ fields.constraint_source = {
640
+ fact_ids: source.fact_ids.filter((id) => typeof id === "string"),
641
+ };
642
+ if (Array.isArray(contract.value_source))
643
+ fields.value_source = contract.value_source
644
+ .map((entry) => record(entry))
645
+ .filter((row) => row !== null && typeof row.symbol_id === "string")
646
+ .map((row) => ({
647
+ symbol_id: String(row.symbol_id),
648
+ ...(typeof row.export === "string" ? { export: row.export } : {}),
649
+ }));
650
+ if (Array.isArray(contract.proves))
651
+ fields.proves = contract.proves.filter((key) => typeof key === "string");
652
+ return fields;
653
+ }
418
654
  export function proofBindingsErrors(value) {
419
655
  if (!Array.isArray(value))
420
656
  return ["proof_bindings must be an array of binding objects"];
@@ -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"];
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", "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,32 @@ 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
+ scope?: "code" | "intent";
343
+ obligation?: Readonly<Record<string, unknown>>;
344
+ reason?: string;
262
345
  }>;
263
346
  export declare function finishedAtPrecedesStartedAt(startedAt: number | null, finishedAt: number | null): boolean;
264
- /** Structural validation of one kibi.proof-receipt.v1 entry. */
347
+ /** Structural validation of one kibi.proof-receipt.v1 or v2 entry. */
265
348
  export declare function validProofReceiptShape(testId: string, receipt: unknown): boolean;
266
349
  /**
267
350
  * Full-history validation for proof_receipts: unique ids, per-test binding,
268
- * supported scope, ordered timestamps, and structurally valid v1 entries.
351
+ * supported scope, ordered timestamps, and structurally valid v1 or v2 entries.
269
352
  */
270
353
  export declare function proofReceiptHistoryErrors(testId: string, verificationScope: unknown, receipts: readonly Readonly<Record<string, unknown>>[]): readonly string[];
271
354
  /** 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIvB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,OAAO,EAAE,OAAO,qBAAqB,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE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