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.
- package/dist/cli-register-proof.d.ts.map +1 -1
- package/dist/cli-register-proof.js +19 -7
- package/dist/cli-register-reporting.d.ts.map +1 -1
- package/dist/cli-register-reporting.js +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/commands/check-generated.d.ts +5 -1
- package/dist/commands/check-generated.d.ts.map +1 -1
- package/dist/commands/check-generated.js +24 -35
- package/dist/commands/check.d.ts +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +14 -5
- package/dist/commands/discovery-table.d.ts.map +1 -1
- package/dist/commands/discovery-table.js +51 -4
- package/dist/commands/doctor.js +19 -4
- package/dist/commands/init-helpers.d.ts.map +1 -1
- package/dist/commands/init-helpers.js +8 -5
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +109 -5
- package/dist/commands/prove.d.ts +48 -1
- package/dist/commands/prove.d.ts.map +1 -1
- package/dist/commands/prove.js +293 -8
- package/dist/commands/report.d.ts +1 -0
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +70 -5
- package/dist/commands/signoff.d.ts.map +1 -1
- package/dist/commands/signoff.js +20 -1
- package/dist/commands/sync/manifest.d.ts +10 -1
- package/dist/commands/sync/manifest.d.ts.map +1 -1
- package/dist/commands/sync/manifest.js +106 -17
- package/dist/commands/sync/persistence.d.ts.map +1 -1
- package/dist/commands/sync/persistence.js +16 -5
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +19 -0
- package/dist/diagnostics.js +1 -1
- package/dist/engine.js +1 -1
- package/dist/extractors/markdown.d.ts +4 -2
- package/dist/extractors/markdown.d.ts.map +1 -1
- package/dist/extractors/markdown.js +17 -0
- package/dist/extractors/symbol-coordinates.js +2 -2
- package/dist/extractors/symbols-coordinator.d.ts +2 -4
- package/dist/extractors/symbols-coordinator.d.ts.map +1 -1
- package/dist/extractors/symbols-coordinator.js +1 -2
- package/dist/operations/bootstrap/candidate-helpers.d.ts +3 -0
- package/dist/operations/bootstrap/candidate-helpers.d.ts.map +1 -1
- package/dist/operations/bootstrap/candidate-helpers.js +4 -0
- package/dist/operations/migration/evidence-floor.d.ts +41 -0
- package/dist/operations/migration/evidence-floor.d.ts.map +1 -0
- package/dist/operations/migration/evidence-floor.js +230 -0
- package/dist/operations/migration/proof-contract-claims.d.ts +72 -0
- package/dist/operations/migration/proof-contract-claims.d.ts.map +1 -0
- package/dist/operations/migration/proof-contract-claims.js +215 -0
- package/dist/operations/migration/schema6.d.ts +6 -0
- package/dist/operations/migration/schema6.d.ts.map +1 -1
- package/dist/operations/migration/schema6.js +92 -0
- package/dist/operations/migration/symbol-coordinates-refresh.d.ts +3 -2
- package/dist/operations/migration/symbol-coordinates-refresh.d.ts.map +1 -1
- package/dist/operations/migration/symbol-coordinates-refresh.js +4 -3
- package/dist/operations/migration/untrack-symbol-coordinates.d.ts +23 -0
- package/dist/operations/migration/untrack-symbol-coordinates.d.ts.map +1 -0
- package/dist/operations/migration/untrack-symbol-coordinates.js +67 -0
- package/dist/operations/modeling/requirement-modeler.d.ts.map +1 -1
- package/dist/operations/modeling/requirement-modeler.js +48 -1
- package/dist/operations/modeling/requirement-types.d.ts +2 -1
- package/dist/operations/modeling/requirement-types.d.ts.map +1 -1
- package/dist/operations/modeling/requirement-utils.d.ts +1 -1
- package/dist/operations/modeling/requirement-utils.d.ts.map +1 -1
- package/dist/operations/modeling/requirement-utils.js +8 -1
- package/dist/operations/mutation/omitted-properties.d.ts +11 -0
- package/dist/operations/mutation/omitted-properties.d.ts.map +1 -0
- package/dist/operations/mutation/omitted-properties.js +76 -0
- package/dist/operations/mutation/serialization.d.ts.map +1 -1
- package/dist/operations/mutation/serialization.js +1 -0
- package/dist/operations/mutation/source-authoring.d.ts.map +1 -1
- package/dist/operations/mutation/source-authoring.js +39 -20
- package/dist/operations/mutation/strict-fact.d.ts.map +1 -1
- package/dist/operations/mutation/strict-fact.js +6 -2
- package/dist/operations/mutation/symbol-granularity.d.ts.map +1 -1
- package/dist/operations/mutation/symbol-granularity.js +5 -3
- package/dist/operations/mutation/upsert.d.ts.map +1 -1
- package/dist/operations/mutation/upsert.js +7 -1
- package/dist/operations/mutation/validation.d.ts +2 -0
- package/dist/operations/mutation/validation.d.ts.map +1 -1
- package/dist/operations/mutation/validation.js +4 -0
- package/dist/operations/proof/claim-bindings.d.ts +41 -0
- package/dist/operations/proof/claim-bindings.d.ts.map +1 -0
- package/dist/operations/proof/claim-bindings.js +364 -0
- package/dist/operations/proof/code-certificates.d.ts +155 -0
- package/dist/operations/proof/code-certificates.d.ts.map +1 -0
- package/dist/operations/proof/code-certificates.js +894 -0
- package/dist/operations/proof/code-models.d.ts +96 -0
- package/dist/operations/proof/code-models.d.ts.map +1 -0
- package/dist/operations/proof/code-models.js +601 -0
- package/dist/operations/proof/code-runner.d.ts +40 -0
- package/dist/operations/proof/code-runner.d.ts.map +1 -0
- package/dist/operations/proof/code-runner.js +164 -0
- package/dist/operations/proof/code-scope.d.ts +14 -1
- package/dist/operations/proof/code-scope.d.ts.map +1 -1
- package/dist/operations/proof/code-scope.js +44 -2
- package/dist/operations/proof/compact-receipts.d.ts.map +1 -1
- package/dist/operations/proof/compact-receipts.js +4 -3
- package/dist/operations/proof/explain.d.ts +32 -0
- package/dist/operations/proof/explain.d.ts.map +1 -1
- package/dist/operations/proof/explain.js +91 -0
- package/dist/operations/proof/ingest-proof.d.ts +9 -1
- package/dist/operations/proof/ingest-proof.d.ts.map +1 -1
- package/dist/operations/proof/ingest-proof.js +42 -2
- package/dist/operations/proof/receipt-compaction.d.ts +2 -0
- package/dist/operations/proof/receipt-compaction.d.ts.map +1 -1
- package/dist/operations/proof/receipt-compaction.js +6 -2
- package/dist/operations/proof/regular-language.d.ts +89 -0
- package/dist/operations/proof/regular-language.d.ts.map +1 -0
- package/dist/operations/proof/regular-language.js +943 -0
- package/dist/operations/proof/source-code-readers.d.ts +12 -0
- package/dist/operations/proof/source-code-readers.d.ts.map +1 -0
- package/dist/operations/proof/source-code-readers.js +699 -0
- package/dist/operations/semantic-advisor/analyze-prose.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/analyze-prose.js +2 -1
- package/dist/operations/semantic-advisor/shared.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/shared.js +4 -0
- package/dist/operations/semantic-advisor/strict-count-rules.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/strict-count-rules.js +8 -2
- package/dist/operations/semantic-advisor/strict-rules.d.ts +8 -0
- package/dist/operations/semantic-advisor/strict-rules.d.ts.map +1 -1
- package/dist/operations/semantic-advisor/strict-rules.js +234 -4
- package/dist/operations/semantic-advisor/types.d.ts +3 -2
- package/dist/operations/semantic-advisor/types.d.ts.map +1 -1
- package/dist/plugins/approved-source-analyzers.generated.d.ts +6 -6
- package/dist/plugins/approved-source-analyzers.generated.js +6 -6
- package/dist/prolog.d.ts.map +1 -1
- package/dist/prolog.js +13 -3
- package/dist/proof/command-test-report.d.ts +4 -3
- package/dist/proof/command-test-report.d.ts.map +1 -1
- package/dist/proof/command-test-report.js +4 -10
- package/dist/proof/evaluate.d.ts.map +1 -1
- package/dist/proof/evaluate.js +18 -2
- package/dist/proof/inspect.d.ts.map +1 -1
- package/dist/proof/inspect.js +58 -0
- package/dist/proof/producers/playwright-reporter.d.ts +3 -0
- package/dist/proof/producers/playwright-reporter.d.ts.map +1 -1
- package/dist/proof/producers/playwright-reporter.js +25 -2
- package/dist/proof/step-runner.d.ts +36 -0
- package/dist/proof/step-runner.d.ts.map +1 -0
- package/dist/proof/step-runner.js +234 -0
- package/dist/public/evidence-levels.d.ts +12 -0
- package/dist/public/evidence-levels.d.ts.map +1 -0
- package/dist/public/evidence-levels.js +19 -0
- package/dist/public/impact/coverage-depth-quality.d.ts +7 -0
- package/dist/public/impact/coverage-depth-quality.d.ts.map +1 -1
- package/dist/public/impact/coverage-depth-quality.js +59 -0
- package/dist/public/impact/full-kb-quality.d.ts.map +1 -1
- package/dist/public/impact/full-kb-quality.js +3 -1
- package/dist/public/operations/catalog.d.ts +315 -11
- package/dist/public/operations/catalog.d.ts.map +1 -1
- package/dist/public/operations/check-executor.d.ts +2 -0
- package/dist/public/operations/check-executor.d.ts.map +1 -1
- package/dist/public/operations/check-executor.js +6 -0
- package/dist/public/operations/evidence-floor.d.ts +48 -0
- package/dist/public/operations/evidence-floor.d.ts.map +1 -0
- package/dist/public/operations/evidence-floor.js +143 -0
- package/dist/public/operations/migration-plan.d.ts +19 -5
- package/dist/public/operations/migration-plan.d.ts.map +1 -1
- package/dist/public/operations/migration-plan.js +22 -5
- package/dist/public/operations/node-ports.d.ts.map +1 -1
- package/dist/public/operations/node-ports.js +4 -1
- package/dist/public/operations/proof-contract-claims.d.ts +26 -0
- package/dist/public/operations/proof-contract-claims.d.ts.map +1 -0
- package/dist/public/operations/proof-contract-claims.js +71 -0
- package/dist/public/operations/specs/check-rules.generated.d.ts +1 -1
- package/dist/public/operations/specs/check-rules.generated.d.ts.map +1 -1
- package/dist/public/operations/specs/check-rules.generated.js +3 -1
- package/dist/public/operations/specs/check.d.ts +1 -1
- package/dist/public/operations/specs/composite.d.ts +16 -3
- package/dist/public/operations/specs/composite.d.ts.map +1 -1
- package/dist/public/operations/specs/modeling.d.ts +16 -3
- package/dist/public/operations/specs/modeling.d.ts.map +1 -1
- package/dist/public/operations/specs/modeling.js +22 -3
- package/dist/public/operations/specs/mutation-schemas.d.ts +289 -7
- package/dist/public/operations/specs/mutation-schemas.d.ts.map +1 -1
- package/dist/public/operations/specs/mutation-schemas.js +28 -4
- package/dist/public/operations/specs/proof.d.ts +9 -0
- package/dist/public/operations/specs/proof.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.d.ts.map +1 -1
- package/dist/public/operations/specs/reporting.js +19 -10
- package/dist/public/operations/specs/upsert.d.ts +289 -7
- package/dist/public/operations/specs/upsert.d.ts.map +1 -1
- package/dist/public/proof-certificates.d.ts +163 -0
- package/dist/public/proof-certificates.d.ts.map +1 -0
- package/dist/public/proof-certificates.js +419 -0
- package/dist/public/proof-protocol.d.ts +259 -3
- package/dist/public/proof-protocol.d.ts.map +1 -1
- package/dist/public/proof-protocol.js +524 -3
- package/dist/public/proof-receipt.d.ts +90 -6
- package/dist/public/proof-receipt.d.ts.map +1 -1
- package/dist/public/proof-receipt.js +88 -7
- package/dist/public/proof-sources.d.ts +102 -0
- package/dist/public/proof-sources.d.ts.map +1 -0
- package/dist/public/proof-sources.js +1292 -0
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +39 -2
- package/dist/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/dist/public/skills/kibi-commit-review/SKILL.md +8 -8
- package/dist/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
- package/dist/public/skills/kibi-decisions/SKILL.md +13 -2
- package/dist/public/skills/kibi-decisions/resources/decision-records.md +9 -1
- package/dist/public/skills/kibi-freshness/SKILL.md +5 -1
- package/dist/public/skills/kibi-traceability/SKILL.md +12 -1
- package/dist/public/skills/kibi-usage/SKILL.md +8 -4
- package/dist/public/skills/kibi-usage/resources/proof.md +221 -20
- package/dist/public/skills/kibi-usage/resources/workflows.md +4 -4
- package/dist/report/html-report.css +83 -11
- package/dist/report/html-report.d.ts +8 -0
- package/dist/report/html-report.d.ts.map +1 -1
- package/dist/report/html-report.js +214 -22
- package/dist/report/report-view.d.ts +2 -2
- package/dist/report/report-view.d.ts.map +1 -1
- package/dist/report/report-view.js +8 -0
- package/dist/schemas/entity.schema.json +404 -5
- package/dist/search-answer.d.ts.map +1 -1
- package/dist/search-answer.js +1 -0
- package/dist/signoff/html.d.ts.map +1 -1
- package/dist/signoff/html.js +3 -0
- package/dist/signoff/markdown.d.ts.map +1 -1
- package/dist/signoff/markdown.js +3 -0
- package/dist/signoff/model.d.ts +20 -0
- package/dist/signoff/model.d.ts.map +1 -1
- package/dist/signoff/model.js +20 -1
- package/dist/traceability/evidence-model.d.ts +13 -12
- package/dist/traceability/evidence-model.d.ts.map +1 -1
- package/dist/traceability/evidence-model.js +1 -1
- package/dist/traceability/impact-knowledge.d.ts.map +1 -1
- package/dist/traceability/impact-knowledge.js +1 -0
- package/dist/traceability/staged-diagnostics.d.ts.map +1 -1
- package/dist/traceability/staged-diagnostics.js +24 -20
- package/dist/traceability/staged-impact-contract.d.ts +4 -4
- package/dist/traceability/staged-impact-contract.js +9 -9
- package/dist/traceability/staged-symbols-manifest.d.ts +11 -3
- package/dist/traceability/staged-symbols-manifest.d.ts.map +1 -1
- package/dist/traceability/staged-symbols-manifest.js +47 -140
- package/dist/traceability/temp-kb.d.ts.map +1 -1
- package/dist/traceability/temp-kb.js +1 -0
- package/dist/types/entities.d.ts +5 -2
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/utils/merge-driver-setup.d.ts +8 -1
- package/dist/utils/merge-driver-setup.d.ts.map +1 -1
- package/dist/utils/merge-driver-setup.js +23 -2
- package/dist/utils/rule-registry.generated.d.ts +10 -0
- package/dist/utils/rule-registry.generated.d.ts.map +1 -1
- package/dist/utils/rule-registry.generated.js +12 -0
- package/dist/utils/schema-version.d.ts +1 -1
- package/dist/utils/schema-version.d.ts.map +1 -1
- package/dist/utils/schema-version.js +7 -1
- package/dist/utils/strict-modeling.d.ts +3 -2
- package/dist/utils/strict-modeling.d.ts.map +1 -1
- package/dist/utils/strict-modeling.js +37 -4
- package/dist/workspace-cwd.d.ts +15 -0
- package/dist/workspace-cwd.d.ts.map +1 -0
- package/dist/workspace-cwd.js +86 -0
- package/package.json +6 -2
- package/schema/entities.pl +6 -0
- package/schema/validation.pl +7 -2
- package/src/public/evidence-levels.ts +23 -0
- package/src/public/impact/coverage-depth-quality.ts +73 -0
- package/src/public/impact/full-kb-quality.ts +6 -1
- package/src/public/operations/check-executor.ts +13 -0
- package/src/public/operations/evidence-floor.ts +203 -0
- package/src/public/operations/migration-plan.ts +39 -6
- package/src/public/operations/node-ports.ts +3 -1
- package/src/public/operations/proof-contract-claims.ts +103 -0
- package/src/public/operations/specs/check-rules.generated.ts +3 -1
- package/src/public/operations/specs/modeling.ts +24 -5
- package/src/public/operations/specs/mutation-schemas.ts +30 -4
- package/src/public/operations/specs/reporting.ts +20 -10
- package/src/public/proof-certificates.ts +566 -0
- package/src/public/proof-protocol-types.d.ts +69 -1
- package/src/public/proof-protocol.ts +694 -3
- package/src/public/proof-receipt.ts +133 -7
- package/src/public/proof-sources.ts +1656 -0
- package/src/public/schemas/entity.ts +51 -3
- package/src/public/skills/kibi-bootstrap/SKILL.md +2 -2
- package/src/public/skills/kibi-commit-review/SKILL.md +8 -8
- package/src/public/skills/kibi-commit-review/resources/staged-gate.md +12 -7
- package/src/public/skills/kibi-decisions/SKILL.md +13 -2
- package/src/public/skills/kibi-decisions/resources/decision-records.md +9 -1
- package/src/public/skills/kibi-freshness/SKILL.md +5 -1
- package/src/public/skills/kibi-traceability/SKILL.md +12 -1
- package/src/public/skills/kibi-usage/SKILL.md +8 -4
- package/src/public/skills/kibi-usage/resources/proof.md +221 -20
- package/src/public/skills/kibi-usage/resources/workflows.md +4 -4
- package/src/schemas/entity.schema.json +404 -5
- package/dist/commands/proof-impact.d.ts +0 -7
- package/dist/commands/proof-impact.d.ts.map +0 -1
- package/dist/commands/proof-impact.js +0 -39
- package/dist/operations/proof/baseline-diff.d.ts +0 -41
- package/dist/operations/proof/baseline-diff.d.ts.map +0 -1
- package/dist/operations/proof/baseline-diff.js +0 -153
- package/dist/operations/proof/impact.d.ts +0 -51
- package/dist/operations/proof/impact.d.ts.map +0 -1
- package/dist/operations/proof/impact.js +0 -138
- package/dist/traceability/reviewed-coordinate-refresh.d.ts +0 -10
- package/dist/traceability/reviewed-coordinate-refresh.d.ts.map +0 -1
- package/dist/traceability/reviewed-coordinate-refresh.js +0 -49
|
@@ -4,14 +4,33 @@ import {
|
|
|
4
4
|
proofContractHash,
|
|
5
5
|
} from "./proof-fingerprint.js";
|
|
6
6
|
import {
|
|
7
|
+
PROOF_KINDS,
|
|
7
8
|
PROOF_RECEIPT_VERSION,
|
|
9
|
+
PROOF_RECEIPT_VERSIONS,
|
|
8
10
|
PROOF_RESULT_OUTCOMES,
|
|
9
11
|
PROOF_RUN_OUTCOMES,
|
|
10
12
|
type ProofContract,
|
|
13
|
+
type ProofKind,
|
|
14
|
+
isCertificateProofKind,
|
|
11
15
|
} from "./proof-protocol.js";
|
|
12
16
|
|
|
13
17
|
export const PROOF_RECEIPT_MAX_AGE_SECONDS = 7 * 24 * 60 * 60;
|
|
14
18
|
|
|
19
|
+
/**
|
|
20
|
+
* How a certificate binds to a claim its contract names in proves: derived
|
|
21
|
+
* (Kibi checked it against the claim's fact; the only verdict that proves),
|
|
22
|
+
* attested (the fact has no derivation; the author vouches) or rejected.
|
|
23
|
+
*/
|
|
24
|
+
// implements REQ-kibi-claim-bound-proofs
|
|
25
|
+
export const CLAIM_BINDING_VERDICTS = [
|
|
26
|
+
"derived",
|
|
27
|
+
"attested",
|
|
28
|
+
"rejected",
|
|
29
|
+
] as const;
|
|
30
|
+
|
|
31
|
+
// implements REQ-kibi-claim-bound-proofs
|
|
32
|
+
export type ClaimBindingVerdict = (typeof CLAIM_BINDING_VERDICTS)[number];
|
|
33
|
+
|
|
15
34
|
export const PROOF_RECEIPT_OUTCOMES = [
|
|
16
35
|
"passed",
|
|
17
36
|
"failed",
|
|
@@ -25,7 +44,7 @@ export const PROOF_RECEIPT_OUTCOMES = [
|
|
|
25
44
|
export const PROOF_RECEIPT_SCHEMA = {
|
|
26
45
|
type: "object",
|
|
27
46
|
description:
|
|
28
|
-
"Kibi-derived kibi.proof-receipt.v1. Receipts are never caller-authored; kb_ingest_proof derives them from kibi.proof-run.v1 artifacts.",
|
|
47
|
+
"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.",
|
|
29
48
|
required: [
|
|
30
49
|
"version",
|
|
31
50
|
"receipt_id",
|
|
@@ -47,7 +66,7 @@ export const PROOF_RECEIPT_SCHEMA = {
|
|
|
47
66
|
"proof_results",
|
|
48
67
|
],
|
|
49
68
|
properties: {
|
|
50
|
-
version: { type: "string",
|
|
69
|
+
version: { type: "string", enum: [...PROOF_RECEIPT_VERSIONS] },
|
|
51
70
|
receipt_id: {
|
|
52
71
|
type: "string",
|
|
53
72
|
pattern: "^PR-[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$",
|
|
@@ -144,6 +163,36 @@ export const PROOF_RECEIPT_SCHEMA = {
|
|
|
144
163
|
additionalProperties: false,
|
|
145
164
|
},
|
|
146
165
|
},
|
|
166
|
+
kind: { type: "string", enum: [...PROOF_KINDS] },
|
|
167
|
+
evidence_level: { type: "string", enum: ["proved", "tested"] },
|
|
168
|
+
certificate: { type: "object" },
|
|
169
|
+
certificate_digest: { type: "string", pattern: "^[a-f0-9]{64}$" },
|
|
170
|
+
certificate_rejection: { type: "string", minLength: 1 },
|
|
171
|
+
claim_bindings: {
|
|
172
|
+
type: "array",
|
|
173
|
+
description:
|
|
174
|
+
"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.",
|
|
175
|
+
items: {
|
|
176
|
+
type: "object",
|
|
177
|
+
required: ["claim_key", "binding"],
|
|
178
|
+
properties: {
|
|
179
|
+
claim_key: { type: "string", minLength: 1 },
|
|
180
|
+
requirement_id: { type: "string", minLength: 1 },
|
|
181
|
+
fact_id: { type: "string", minLength: 1 },
|
|
182
|
+
binding: {
|
|
183
|
+
type: "string",
|
|
184
|
+
enum: [...CLAIM_BINDING_VERDICTS],
|
|
185
|
+
},
|
|
186
|
+
scope: {
|
|
187
|
+
type: "string",
|
|
188
|
+
enum: ["code", "source", "harness", "intent"],
|
|
189
|
+
},
|
|
190
|
+
obligation: { type: "object" },
|
|
191
|
+
reason: { type: "string", minLength: 1 },
|
|
192
|
+
},
|
|
193
|
+
additionalProperties: false,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
147
196
|
gaps: {
|
|
148
197
|
type: "array",
|
|
149
198
|
items: {
|
|
@@ -162,7 +211,7 @@ export const PROOF_RECEIPT_SCHEMA = {
|
|
|
162
211
|
} as const;
|
|
163
212
|
|
|
164
213
|
export type ProofReceipt = Readonly<{
|
|
165
|
-
version: typeof
|
|
214
|
+
version: (typeof PROOF_RECEIPT_VERSIONS)[number];
|
|
166
215
|
receipt_id: string;
|
|
167
216
|
test_id: string;
|
|
168
217
|
scope: "unit" | "integration" | "end_to_end";
|
|
@@ -201,6 +250,28 @@ export type ProofReceipt = Readonly<{
|
|
|
201
250
|
readonly target: string;
|
|
202
251
|
readonly reason: string;
|
|
203
252
|
}[];
|
|
253
|
+
/** v2: what the contract's checker establishes. */
|
|
254
|
+
kind?: ProofKind;
|
|
255
|
+
/** v2: proved only for a passed certificate kind whose certificate re-checked. */
|
|
256
|
+
evidence_level?: "proved" | "tested";
|
|
257
|
+
certificate?: Readonly<Record<string, unknown>>;
|
|
258
|
+
certificate_digest?: string;
|
|
259
|
+
certificate_rejection?: string;
|
|
260
|
+
/** Certificate kinds: the binding to each claim the contract names in proves. */
|
|
261
|
+
claim_bindings?: readonly ClaimBinding[];
|
|
262
|
+
}>;
|
|
263
|
+
|
|
264
|
+
/** How one certificate binds to one requirement claim, judged at ingest. */
|
|
265
|
+
// implements REQ-kibi-claim-bound-proofs
|
|
266
|
+
export type ClaimBinding = Readonly<{
|
|
267
|
+
claim_key: string;
|
|
268
|
+
requirement_id?: string;
|
|
269
|
+
fact_id?: string;
|
|
270
|
+
binding: ClaimBindingVerdict;
|
|
271
|
+
/** What the proof rests on: evaluated code, project files Kibi read (source), a test harness, or the knowledge base alone (intent). */
|
|
272
|
+
scope?: "code" | "source" | "harness" | "intent";
|
|
273
|
+
obligation?: Readonly<Record<string, unknown>>;
|
|
274
|
+
reason?: string;
|
|
204
275
|
}>;
|
|
205
276
|
|
|
206
277
|
export function finishedAtPrecedesStartedAt(
|
|
@@ -285,14 +356,17 @@ function validFingerprintComponents(value: unknown): boolean {
|
|
|
285
356
|
);
|
|
286
357
|
}
|
|
287
358
|
|
|
288
|
-
/** Structural validation of one kibi.proof-receipt.v1 entry. */
|
|
359
|
+
/** Structural validation of one kibi.proof-receipt.v1 or v2 entry. */
|
|
289
360
|
export function validProofReceiptShape(
|
|
290
361
|
testId: string,
|
|
291
362
|
receipt: unknown,
|
|
292
363
|
): boolean {
|
|
293
364
|
const row = isRecord(receipt) ? receipt : null;
|
|
294
365
|
if (!row) return false;
|
|
295
|
-
if (row.version
|
|
366
|
+
if (!(PROOF_RECEIPT_VERSIONS as readonly unknown[]).includes(row.version))
|
|
367
|
+
return false;
|
|
368
|
+
if (row.version === PROOF_RECEIPT_VERSION && !validV2Fields(row))
|
|
369
|
+
return false;
|
|
296
370
|
if (
|
|
297
371
|
typeof row.receipt_id !== "string" ||
|
|
298
372
|
!/^PR-[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$/.test(row.receipt_id)
|
|
@@ -358,9 +432,61 @@ export function validProofReceiptShape(
|
|
|
358
432
|
return !finishedAtPrecedesStartedAt(startedAt, finishedAt);
|
|
359
433
|
}
|
|
360
434
|
|
|
435
|
+
// implements REQ-kibi-code-proof-kinds
|
|
436
|
+
function validV2Fields(row: Record<string, unknown>): boolean {
|
|
437
|
+
if (!(PROOF_KINDS as readonly unknown[]).includes(row.kind)) return false;
|
|
438
|
+
if (row.evidence_level !== "proved" && row.evidence_level !== "tested")
|
|
439
|
+
return false;
|
|
440
|
+
if (
|
|
441
|
+
row.evidence_level === "proved" &&
|
|
442
|
+
(row.outcome !== "passed" ||
|
|
443
|
+
!isCertificateProofKind(row.kind) ||
|
|
444
|
+
!isRecord(row.certificate) ||
|
|
445
|
+
!hex64(row.certificate_digest) ||
|
|
446
|
+
row.certificate_rejection !== undefined)
|
|
447
|
+
)
|
|
448
|
+
return false;
|
|
449
|
+
if (row.certificate !== undefined && !isRecord(row.certificate)) return false;
|
|
450
|
+
if (row.certificate_digest !== undefined && !hex64(row.certificate_digest))
|
|
451
|
+
return false;
|
|
452
|
+
if (
|
|
453
|
+
row.certificate_rejection !== undefined &&
|
|
454
|
+
!nonEmptyString(row.certificate_rejection)
|
|
455
|
+
)
|
|
456
|
+
return false;
|
|
457
|
+
if (
|
|
458
|
+
row.claim_bindings !== undefined &&
|
|
459
|
+
!validClaimBindings(row.claim_bindings)
|
|
460
|
+
)
|
|
461
|
+
return false;
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// implements REQ-kibi-claim-bound-proofs
|
|
466
|
+
function validClaimBindings(value: unknown): boolean {
|
|
467
|
+
return (
|
|
468
|
+
Array.isArray(value) &&
|
|
469
|
+
value.every(
|
|
470
|
+
(entry) =>
|
|
471
|
+
isRecord(entry) &&
|
|
472
|
+
nonEmptyString(entry.claim_key) &&
|
|
473
|
+
(CLAIM_BINDING_VERDICTS as readonly unknown[]).includes(
|
|
474
|
+
entry.binding,
|
|
475
|
+
) &&
|
|
476
|
+
(entry.scope === undefined ||
|
|
477
|
+
entry.scope === "code" ||
|
|
478
|
+
entry.scope === "source" ||
|
|
479
|
+
entry.scope === "harness" ||
|
|
480
|
+
entry.scope === "intent") &&
|
|
481
|
+
(entry.obligation === undefined || isRecord(entry.obligation)) &&
|
|
482
|
+
(entry.reason === undefined || nonEmptyString(entry.reason)),
|
|
483
|
+
)
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
|
|
361
487
|
/**
|
|
362
488
|
* Full-history validation for proof_receipts: unique ids, per-test binding,
|
|
363
|
-
* supported scope, ordered timestamps, and structurally valid v1 entries.
|
|
489
|
+
* supported scope, ordered timestamps, and structurally valid v1 or v2 entries.
|
|
364
490
|
*/
|
|
365
491
|
export function proofReceiptHistoryErrors(
|
|
366
492
|
testId: string,
|
|
@@ -388,7 +514,7 @@ export function proofReceiptHistoryErrors(
|
|
|
388
514
|
}
|
|
389
515
|
if (!validProofReceiptShape(testId, receipt)) {
|
|
390
516
|
errors.push(
|
|
391
|
-
`${prefix} must be a structurally valid kibi.proof-receipt.v1 bound to '${testId}'`,
|
|
517
|
+
`${prefix} must be a structurally valid kibi.proof-receipt.v2 (or v1) bound to '${testId}'`,
|
|
392
518
|
);
|
|
393
519
|
continue;
|
|
394
520
|
}
|