@gtrabanco/agentic-workflow-schema 3.2.0 → 3.4.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.
@@ -0,0 +1,129 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/gtrabanco/agentic-workflow/packages/agentic-workflow-schema/candidate-snapshot.schema.json",
4
+ "title": "agentic-workflow candidate snapshot v1",
5
+ "description": "A content-bound candidate snapshot proving exactly which diff a review evaluated. Source of truth: @gtrabanco/agentic-workflow-schema.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "contract",
10
+ "objectFormat",
11
+ "baseCommit",
12
+ "candidateCommit",
13
+ "baseTree",
14
+ "candidateTree",
15
+ "acceptanceFingerprint",
16
+ "changedPaths"
17
+ ],
18
+ "properties": {
19
+ "contract": {
20
+ "type": "string",
21
+ "const": "agentic-workflow/candidate-snapshot@1"
22
+ },
23
+ "objectFormat": {
24
+ "enum": ["sha1", "sha256"]
25
+ },
26
+ "baseCommit": {
27
+ "$ref": "#/$defs/gitObjectId"
28
+ },
29
+ "candidateCommit": {
30
+ "$ref": "#/$defs/gitObjectId"
31
+ },
32
+ "baseTree": {
33
+ "$ref": "#/$defs/gitObjectId"
34
+ },
35
+ "candidateTree": {
36
+ "$ref": "#/$defs/gitObjectId"
37
+ },
38
+ "acceptanceFingerprint": {
39
+ "type": "string",
40
+ "pattern": "^[a-f0-9]{64}$"
41
+ },
42
+ "changedPaths": {
43
+ "type": "array",
44
+ "items": {
45
+ "$ref": "#/$defs/manifestEntryV1"
46
+ }
47
+ }
48
+ },
49
+ "$defs": {
50
+ "gitObjectId": {
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "required": ["algorithm", "hex"],
54
+ "properties": {
55
+ "algorithm": {
56
+ "enum": ["sha1", "sha256"]
57
+ },
58
+ "hex": {
59
+ "type": "string"
60
+ }
61
+ },
62
+ "anyOf": [
63
+ {
64
+ "if": { "properties": { "algorithm": { "const": "sha1" } }, "required": ["algorithm"] },
65
+ "then": { "properties": { "hex": { "type": "string", "pattern": "^[a-f0-9]{40}$" } } }
66
+ },
67
+ {
68
+ "if": { "properties": { "algorithm": { "const": "sha256" } }, "required": ["algorithm"] },
69
+ "then": { "properties": { "hex": { "type": "string", "pattern": "^[a-f0-9]{64}$" } } }
70
+ }
71
+ ]
72
+ },
73
+ "manifestEntryV1": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": ["path", "status", "oldPath", "mode", "objectSha", "sizeBytes", "binary"],
77
+ "properties": {
78
+ "path": {
79
+ "type": "string",
80
+ "pattern": "^(?!\\0)(?!\\/)(?!.*(?:^|\\/)(?:\\.\\.|\\./))[^\\0]*$"
81
+ },
82
+ "status": {
83
+ "enum": ["added", "modified", "deleted", "renamed", "copied", "type-changed"]
84
+ },
85
+ "oldPath": {
86
+ "type": ["string", "null"]
87
+ },
88
+ "mode": {
89
+ "oneOf": [
90
+ { "enum": ["100644", "100755", "120000", "160000"] },
91
+ { "type": "null" }
92
+ ]
93
+ },
94
+ "objectSha": {
95
+ "oneOf": [
96
+ { "$ref": "#/$defs/gitObjectId" },
97
+ { "type": "null" }
98
+ ]
99
+ },
100
+ "sizeBytes": {
101
+ "oneOf": [
102
+ { "type": "integer", "minimum": 0 },
103
+ { "type": "null" }
104
+ ]
105
+ },
106
+ "binary": {
107
+ "oneOf": [
108
+ { "type": "boolean" },
109
+ { "type": "null" }
110
+ ]
111
+ }
112
+ },
113
+ "anyOf": [
114
+ {
115
+ "if": { "properties": { "status": { "const": "deleted" } }, "required": ["status"] },
116
+ "then": { "properties": { "oldPath": { "const": null } } }
117
+ },
118
+ {
119
+ "if": { "properties": { "status": { "enum": ["renamed", "copied"] } }, "required": ["status"] },
120
+ "then": { "properties": { "oldPath": { "not": { "const": null } } } }
121
+ },
122
+ {
123
+ "if": { "properties": { "status": { "enum": ["added", "modified", "type-changed"] } }, "required": ["status"] },
124
+ "then": { "properties": { "oldPath": { "const": null } } }
125
+ }
126
+ ]
127
+ }
128
+ }
129
+ }
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  * take the LAST fenced ```json block of the assistant's final message;
9
9
  * exactly one envelope per turn; all top-level keys always present.
10
10
  */
11
+ import { VERIFICATION_COMMAND_STATUSES, VERIFICATION_COST_CLASSES, VERIFICATION_DIAGNOSTIC_CODES, VERIFICATION_LIMITS, VERIFICATION_PLAN_CONTRACT_ID, VERIFICATION_RECEIPT_CONTRACT_ID, VERIFICATION_STAGES, VERIFICATION_VERDICTS, WORKING_DIRECTORY_POLICIES, type VerificationDiagnosticCodeV1, type VerificationDiagnosticV1 } from "./verification-contract.js";
11
12
  export declare const ENVELOPE_STATES: readonly ["OK", "CONTINUE", "READY_FOR_REVIEW", "READY_FOR_AUDIT", "MERGE_READY", "MERGED", "NEEDS_FIXES", "BLOCKED", "NEEDS_INPUT", "FAILED", "HALT"];
12
13
  export type EnvelopeState = (typeof ENVELOPE_STATES)[number];
13
14
  /** States after which an orchestrator must stop and involve a human. */
@@ -471,3 +472,412 @@ export declare function validateWorkflowSnapshotV1(value: unknown): WorkflowSnap
471
472
  * locations for every value it derives.
472
473
  */
473
474
  export declare function compileWorkflowSnapshot(input: WorkflowSnapshotInput): WorkflowSnapshotResult;
475
+ /** Contract identifier for CandidateSnapshot v1. */
476
+ export declare const CANDIDATE_SNAPSHOT_CONTRACT_ID = "agentic-workflow/candidate-snapshot@1";
477
+ /** Git object hash algorithm. */
478
+ export type GitObjectFormat = "sha1" | "sha256";
479
+ /** A fully-qualified Git object identifier — algorithm + hex digest. */
480
+ export interface GitObjectId {
481
+ readonly algorithm: GitObjectFormat;
482
+ readonly hex: string;
483
+ }
484
+ /** Allowed change statuses in a manifest entry. */
485
+ export type ChangeStatus = "added" | "modified" | "deleted" | "renamed" | "copied" | "type-changed";
486
+ /** Git file mode — serialized as string; null when not applicable. */
487
+ export type GitMode = "100644" | "100755" | "120000" | "160000";
488
+ /** A single entry in the changed-paths manifest. */
489
+ export interface ManifestEntryV1 {
490
+ readonly path: string;
491
+ readonly status: ChangeStatus;
492
+ readonly oldPath: string | null;
493
+ readonly mode: GitMode | null;
494
+ readonly objectSha: GitObjectId | null;
495
+ readonly sizeBytes: number | null;
496
+ readonly binary: boolean | null;
497
+ }
498
+ /** A content-bound candidate snapshot — proves exactly what a review evaluated. */
499
+ export interface CandidateSnapshotV1 {
500
+ readonly contract: typeof CANDIDATE_SNAPSHOT_CONTRACT_ID;
501
+ readonly objectFormat: GitObjectFormat;
502
+ readonly baseCommit: GitObjectId;
503
+ readonly candidateCommit: GitObjectId;
504
+ readonly baseTree: GitObjectId;
505
+ readonly candidateTree: GitObjectId;
506
+ readonly acceptanceFingerprint: string;
507
+ readonly changedPaths: readonly ManifestEntryV1[];
508
+ }
509
+ export type CandidateSnapshotValidationResult = {
510
+ ok: true;
511
+ snapshot: CandidateSnapshotV1;
512
+ } | {
513
+ ok: false;
514
+ errors: string[];
515
+ };
516
+ /**
517
+ * Structural validation of a CandidateSnapshot v1.
518
+ * Rejects undeclared fields, enforces GitObjectId format, path-byte ordering,
519
+ * null-applicability matrix, and the empty-diff rule.
520
+ */
521
+ export declare function validateCandidateSnapshotV1(value: unknown): CandidateSnapshotValidationResult;
522
+ /** Contract identifier for ReviewReceipt v1. */
523
+ export declare const REVIEW_RECEIPT_CONTRACT_ID = "agentic-workflow/review-receipt@1";
524
+ /** All review kinds supported by the workflow. */
525
+ export declare const REVIEW_KINDS: readonly ["implementation", "security", "verification", "debt", "design", "accessibility", "brand", "performance", "seo", "audit"];
526
+ /** Finding severity levels. */
527
+ export declare const FINDING_SEVERITIES: readonly ["info", "low", "medium", "high", "critical"];
528
+ /** A line-level piece of evidence attached to a finding. */
529
+ export interface FindingEvidenceV1 {
530
+ readonly path: string;
531
+ readonly line?: number;
532
+ }
533
+ /** A single finding within a review receipt. */
534
+ export interface FindingV1 {
535
+ readonly id: string;
536
+ readonly severity: (typeof FINDING_SEVERITIES)[number];
537
+ readonly summary: string;
538
+ readonly evidence?: FindingEvidenceV1;
539
+ readonly refs: readonly string[];
540
+ }
541
+ /** A content-bound review receipt — proves exactly what was reviewed. */
542
+ export interface ReviewReceiptV1 {
543
+ readonly contract: typeof REVIEW_RECEIPT_CONTRACT_ID;
544
+ readonly id: string;
545
+ readonly candidateSnapshotDigest: string;
546
+ readonly kind: (typeof REVIEW_KINDS)[number];
547
+ readonly verdict: "pass" | "fail";
548
+ readonly findings: readonly FindingV1[];
549
+ readonly reviewer: string;
550
+ readonly sessionId: string;
551
+ readonly startedAt: string;
552
+ readonly finishedAt: string;
553
+ readonly diagnostics: readonly string[];
554
+ readonly policyVersion: string;
555
+ }
556
+ export type ReviewReceiptValidationResult = {
557
+ ok: true;
558
+ receipt: ReviewReceiptV1;
559
+ } | {
560
+ ok: false;
561
+ errors: string[];
562
+ };
563
+ /**
564
+ * Structural validation of a ReviewReceipt v1.
565
+ * Rejects undeclared fields, enforces closed vocabularies, format rules,
566
+ * and constraints on timestamps and finding structure.
567
+ */
568
+ export declare function validateReviewReceiptV1(value: unknown): ReviewReceiptValidationResult;
569
+ /** Staleness reason codes — one per detectable dimension. */
570
+ export declare const STALE_REASON_CODES: readonly ["stale-base-tree", "stale-candidate-tree", "stale-manifest", "stale-acceptance-fingerprint", "stale-review-policy"];
571
+ export type StaleReasonCode = (typeof STALE_REASON_CODES)[number];
572
+ export type FreshResult = {
573
+ fresh: true;
574
+ };
575
+ export type StaleResult = {
576
+ fresh: false;
577
+ reasonCode: StaleReasonCode;
578
+ };
579
+ export type FreshnessResult = FreshResult | StaleResult;
580
+ /**
581
+ * D4 — Canonicalize a CandidateSnapshotV1.
582
+ * Produces deterministic JSON with declaration-order keys and sorted changedPaths.
583
+ */
584
+ export declare function canonicalizeCandidateSnapshot(snapshot: CandidateSnapshotV1): string;
585
+ /**
586
+ * D4 — Canonicalize a ReviewReceiptV1.
587
+ * Findings are sorted by ascending byte order of their stable ids.
588
+ */
589
+ export declare function canonicalizeReviewReceipt(receipt: ReviewReceiptV1): string;
590
+ /** D4 — Digest a CandidateSnapshotV1 via canonical serialization. */
591
+ export declare function digestCandidateSnapshot(snapshot: CandidateSnapshotV1): Promise<string>;
592
+ /** D4 — Digest a ReviewReceiptV1 via canonical serialization. */
593
+ export declare function digestReviewReceipt(receipt: ReviewReceiptV1): Promise<string>;
594
+ /**
595
+ * D2 — Compute the acceptance fingerprint from an ordered array of
596
+ * {id, blobSha256} entries. Returns lowercase hex SHA-256 over their
597
+ * canonical serialization (sorted by byte-order of id).
598
+ */
599
+ export declare function computeAcceptanceFingerprint(inputs: ReadonlyArray<{
600
+ id: string;
601
+ blobSha256: string;
602
+ }>): Promise<string>;
603
+ /**
604
+ * D1 — Compare a receipt against the current candidate snapshot and
605
+ * acceptance fingerprint. Returns exactly one stable reason code per stale
606
+ * dimension, or `{fresh: true}` when everything matches.
607
+ *
608
+ * Comparison order (per spec): baseCommit → candidateCommit → changedPaths
609
+ * (canonical equality) → acceptanceFingerprint → policyVersion.
610
+ * Everything equal AND snapshot digest === receipt.candidateSnapshotDigest → fresh.
611
+ */
612
+ export declare function compareReceiptToCurrentSnapshot(receipt: ReviewReceiptV1, snapshot: CandidateSnapshotV1, acceptanceInputs: ReadonlyArray<{
613
+ id: string;
614
+ blobSha256: string;
615
+ }>, policyVersion: string): Promise<FreshnessResult>;
616
+ export interface CanonicalVectorV1 {
617
+ /** Contract name. */
618
+ contract: string;
619
+ /** Expected SHA-256 hex digest. */
620
+ digest: string;
621
+ /** Description of what this vector tests. */
622
+ description: string;
623
+ }
624
+ /**
625
+ * Published frozen canonical vectors. Each vector is a minimal valid value
626
+ * whose canonical digest is deterministic and reproducible.
627
+ *
628
+ * These vectors lock the canonicalization rules (D4) in place.
629
+ * Changing any vector's expected digest would be a reviewed contract change.
630
+ */
631
+ export declare const CANONICAL_VECTORS: ReadonlyArray<CanonicalVectorV1>;
632
+ /** Contract identifier for VerificationPlan v1 (re-exported from the canonical definition). */
633
+ export { VERIFICATION_PLAN_CONTRACT_ID };
634
+ /** Verification stages: fast and full (re-exported from the canonical definition). */
635
+ export { VERIFICATION_STAGES };
636
+ export type VerificationStage = (typeof VERIFICATION_STAGES)[number];
637
+ /** Cost classes declared by the project, not measured by the package. */
638
+ export { VERIFICATION_COST_CLASSES };
639
+ export type VerificationCostClass = (typeof VERIFICATION_COST_CLASSES)[number];
640
+ /**
641
+ * D14 bounded usability — the published ceilings of the v1 contracts
642
+ * (re-exported from the canonical definition, which is where they are enforced).
643
+ */
644
+ export { VERIFICATION_LIMITS };
645
+ /** Working directory policy derived from the canonical runtime vocabulary. */
646
+ export type WorkingDirectoryPolicy = (typeof WORKING_DIRECTORY_POLICIES)[number];
647
+ /**
648
+ * A single verification command within a plan.
649
+ *
650
+ * `executable` + `args` are represented separately (never a shell string);
651
+ * shell composition is reserved for a future versioned contract.
652
+ */
653
+ export interface VerificationCommandV1 {
654
+ /** Stable, non-empty, unique within the plan. */
655
+ readonly id: string;
656
+ /** `fast` or `full` — which stage this command belongs to. */
657
+ readonly stage: VerificationStage;
658
+ /** Non-empty executable path; no NUL characters. Never a shell string. */
659
+ readonly executable: string;
660
+ /** Ordered arguments; each without NUL; may be empty. */
661
+ readonly args: readonly string[];
662
+ /** Whether the command runs at the candidate root or a relative subdirectory. */
663
+ readonly workingDirectoryPolicy: WorkingDirectoryPolicy;
664
+ /** `null` iff `candidate-root`; a validated relative path iff `relative-path`. */
665
+ readonly workingDirectory: string | null;
666
+ /** Positive integer timeout in milliseconds. */
667
+ readonly timeoutMs: number;
668
+ /** Whether to stop executing subsequent commands on failure. */
669
+ readonly stopOnFailure: boolean;
670
+ /** Project-declared cost class (not measured billing truth). */
671
+ readonly costClass: VerificationCostClass;
672
+ }
673
+ /**
674
+ * An ordered, non-empty command list for staged verification.
675
+ *
676
+ * The package validates, canonicalizes, and digests the plan; it does NOT
677
+ * execute commands. The caller owns execution.
678
+ */
679
+ export interface VerificationPlanV1 {
680
+ /** Must equal `VERIFICATION_PLAN_CONTRACT_ID`. */
681
+ readonly contract: typeof VERIFICATION_PLAN_CONTRACT_ID;
682
+ /** Non-empty command list in declared order. */
683
+ readonly commands: readonly VerificationCommandV1[];
684
+ }
685
+ export type VerificationPlanValidationResult = {
686
+ ok: true;
687
+ plan: VerificationPlanV1;
688
+ } | {
689
+ ok: false;
690
+ diagnostics: readonly VerificationDiagnosticV1[];
691
+ truncated: boolean;
692
+ };
693
+ /**
694
+ * D16 closed diagnostic result (re-exported from the canonical definition).
695
+ *
696
+ * A failure never carries a message or a submitted value — only the frozen code
697
+ * and the RFC 6901 pointer to the offending location, capped at
698
+ * `VERIFICATION_LIMITS.diagnostics` rows with `truncated` telling the consumer
699
+ * the list is not the whole story.
700
+ */
701
+ export { VERIFICATION_DIAGNOSTIC_CODES };
702
+ export type VerificationDiagnosticCode = VerificationDiagnosticCodeV1;
703
+ export type { VerificationDiagnosticV1 };
704
+ /**
705
+ * The sole plan-validation authority (D12).
706
+ *
707
+ * Every structural rule comes from the canonical verification-contract
708
+ * definition: contract id, non-empty command list, unique non-empty ids,
709
+ * closed vocabularies, executable/args shapes, working-directory policy
710
+ * nullness and relative-path validation, positive-integer timeouts, and
711
+ * undeclared or inherited fields at every level.
712
+ *
713
+ * The input domain is JSON documents — values `JSON.parse` produces or
714
+ * equivalent literals. An input outside that domain (e.g. an object with a
715
+ * throwing live getter) cannot smuggle its exception past this entry: the
716
+ * walk failure is refused as a redacted `invalid-type` row, so callers
717
+ * always observe the D16 diagnostic contract (F92).
718
+ *
719
+ * On success it returns a normalized own-property DTO — never the submitted
720
+ * reference — so digests and downstream semantics see exactly the declared
721
+ * contract fields. On failure it returns at most
722
+ * `VERIFICATION_LIMITS.diagnostics` redacted code+path rows (D16).
723
+ */
724
+ export declare function validateVerificationPlanV1(value: unknown): VerificationPlanValidationResult;
725
+ /** Contract identifier for VerificationReceipt v1 (re-exported from the canonical definition). */
726
+ export { VERIFICATION_RECEIPT_CONTRACT_ID };
727
+ /** Possible per-command result statuses (re-exported from the canonical definition). */
728
+ export { VERIFICATION_COMMAND_STATUSES };
729
+ export type VerificationCommandStatus = (typeof VERIFICATION_COMMAND_STATUSES)[number];
730
+ /** Verdict values derived from receipt content. */
731
+ export { VERIFICATION_VERDICTS };
732
+ export type VerificationVerdict = (typeof VERIFICATION_VERDICTS)[number];
733
+ /** Stage requested: fast or full — the same closed vocabulary as `stage`. */
734
+ export type VerificationStageRequest = VerificationStage;
735
+ /**
736
+ * Bounded reference to captured evidence (stdout/stderr output).
737
+ *
738
+ * Output contents stay outside the portable receipt; only the reference,
739
+ * size, and digest are carried.
740
+ */
741
+ export interface EvidenceReferenceV1 {
742
+ /** Non-empty opaque pointer to stored evidence, ≤ 1024 chars, no NUL. */
743
+ readonly ref: string;
744
+ /** Size of the captured evidence in bytes (≥ 0). */
745
+ readonly bytes: number;
746
+ /** Lowercase 64-hex SHA-256 digest of the captured evidence. */
747
+ readonly sha256: string;
748
+ }
749
+ /**
750
+ * Per-command verification result.
751
+ *
752
+ * The D4 exit-code/signal matrix:
753
+ * - passed/failed: exactly one of exitCode (integer) / signal (non-empty string)
754
+ * - timed-out: exitCode null, signal nullable
755
+ * - infrastructure-error: both null
756
+ * - skipped: both null
757
+ */
758
+ export interface VerificationResultV1 {
759
+ /** Must exist in the bound plan's commands. */
760
+ readonly commandId: string;
761
+ /** The terminal status of this command execution. */
762
+ readonly status: VerificationCommandStatus;
763
+ /** Integer exit code; per the D4 matrix (null for timed-out/infrastructure-error/skipped). */
764
+ readonly exitCode: number | null;
765
+ /** Kill signal; per the D4 matrix (nullable for timed-out, null otherwise). */
766
+ readonly signal: string | null;
767
+ /** ISO-8601 UTC start timestamp. */
768
+ readonly startedAt: string;
769
+ /** ISO-8601 UTC end timestamp, ≥ startedAt. */
770
+ readonly endedAt: string;
771
+ /** Bounded stdout evidence reference or null. */
772
+ readonly stdout: EvidenceReferenceV1 | null;
773
+ /** Bounded stderr evidence reference or null. */
774
+ readonly stderr: EvidenceReferenceV1 | null;
775
+ /** Skip reason: null on non-skipped rows; when skipped, a stable id ≤ 1024 chars.
776
+ * For fail-fast: MUST equal the stable id of an earlier-declared command
777
+ * whose result is non-passed and whose plan entry declares stopOnFailure: true.
778
+ * Any other non-null value makes the receipt invalid.
779
+ */
780
+ readonly skipReason: string | null;
781
+ }
782
+ /**
783
+ * A verification receipt bound to a plan, candidate snapshot, and acceptance
784
+ * fingerprint.
785
+ *
786
+ * The verdict field must equal deriveVerificationVerdict(receipt, plan)
787
+ * — a stored verdict that disagrees with the derived verdict makes the
788
+ * receipt invalid.
789
+ */
790
+ export interface VerificationReceiptV1 {
791
+ /** Must equal `VERIFICATION_RECEIPT_CONTRACT_ID`. */
792
+ readonly contract: typeof VERIFICATION_RECEIPT_CONTRACT_ID;
793
+ /** Lowercase 64-hex SHA-256 of `digestVerificationPlan(plan)`. */
794
+ readonly planDigest: string;
795
+ /** Lowercase 64-hex SHA-256 from #138's candidate-snapshot digest. */
796
+ readonly candidateSnapshotDigest: string;
797
+ /** Lowercase 64-hex acceptance fingerprint from #138. */
798
+ readonly acceptanceFingerprint: string;
799
+ /** Which stage was requested: fast or full. */
800
+ readonly stageRequested: VerificationStageRequest;
801
+ /** Ordered per-command results. */
802
+ readonly results: readonly VerificationResultV1[];
803
+ /** Must equal `deriveVerificationVerdict(receipt, plan)`. */
804
+ readonly verdict: VerificationVerdict;
805
+ }
806
+ /** Result of the sole public receipt entry point (D12/D16). */
807
+ export type VerificationReceiptValidationResult = {
808
+ ok: true;
809
+ receipt: VerificationReceiptV1;
810
+ } | {
811
+ ok: false;
812
+ diagnostics: readonly VerificationDiagnosticV1[];
813
+ truncated: boolean;
814
+ };
815
+ /**
816
+ * The sole receipt-validation authority (D12): one call performs the
817
+ * VerificationReceipt v1 structural shape check, the VerificationPlan v1
818
+ * structural check, and every plan-bound rule — commandId existence, declared
819
+ * order, fast-stage subset, complete `stopOnFailure` sequencing and attribution
820
+ * (D3/S4), planDigest match and verdict consistency (D2).
821
+ *
822
+ * It accepts unknown input and returns a normalized own-property receipt DTO;
823
+ * no standalone structural receipt validator is exported, so a structural
824
+ * match alone can never claim runtime validity (D13). Async because the
825
+ * planDigest check composes the async digest. The input domain is JSON
826
+ * documents — like the plan entry, an out-of-domain object (a throwing live
827
+ * getter) is refused as a redacted `invalid-type` row rather than escaping an
828
+ * attacker-chosen exception (F92).
829
+ */
830
+ export declare function validateVerificationReceiptAgainstPlan(receipt: unknown, plan: unknown): Promise<VerificationReceiptValidationResult>;
831
+ /**
832
+ * D2 — Verdict derivation: incomplete > fail > pass. Validating wrapper around
833
+ * {@link deriveVerdictUnchecked} — safe to call standalone on unvalidated inputs.
834
+ */
835
+ export declare function deriveVerificationVerdict(receipt: VerificationReceiptV1, plan: VerificationPlanV1): VerificationVerdict;
836
+ /**
837
+ * D6 — Canonical serialization of a validated `VerificationPlan v1`. The
838
+ * input must first pass `validateVerificationPlanV1`; out-of-contract
839
+ * cardinality or byte budgets throw a named TypeError (F91).
840
+ */
841
+ export declare function canonicalizeVerificationPlan(plan: VerificationPlanV1): string;
842
+ /**
843
+ * D6 — Canonical serialization of a validated `VerificationReceipt v1`. The
844
+ * input must first pass `validateVerificationReceiptAgainstPlan`;
845
+ * out-of-contract cardinality or byte budgets throw a named TypeError (F91).
846
+ */
847
+ export declare function canonicalizeVerificationReceipt(receipt: VerificationReceiptV1): string;
848
+ /** D6 — Digest of a validated plan (inherits the F91 canonical-input guards). */
849
+ export declare function digestVerificationPlan(plan: VerificationPlanV1): Promise<string>;
850
+ /** D6 — Digest of a validated receipt (inherits the F91 canonical-input guards). */
851
+ export declare function digestVerificationReceipt(receipt: VerificationReceiptV1): Promise<string>;
852
+ /**
853
+ * D1 — Freshness predicate.
854
+ *
855
+ * Pure, async, deterministic and it throws nothing. Fixed check order (SPEC §
856
+ * Stage, verdict, and freshness semantics): plan digest → candidate-snapshot
857
+ * digest → acceptance fingerprint → a missing fast-stage result → an
858
+ * unjustified skip → a missing full-stage result → `{ fresh: true }`.
859
+ *
860
+ * The two coverage codes are partitioned by the STAGE OF THE MISSING COMMAND,
861
+ * which is what keeps them disjoint while `incomplete-missing-results` still
862
+ * answers a full receipt that skipped a fast command:
863
+ * `incomplete-stage-coverage` only fires on a `full` receipt whose declared
864
+ * full-stage commands are not covered.
865
+ */
866
+ /** Verification-specific freshness reason codes (D1). */
867
+ export declare const VERIFICATION_FRESHNESS_CODES: readonly ["stale-plan", "stale-candidate-snapshot", "stale-acceptance-fingerprint", "incomplete-missing-results", "incomplete-unjustified-skip", "incomplete-stage-coverage"];
868
+ export type VerificationFreshnessReasonCode = (typeof VERIFICATION_FRESHNESS_CODES)[number];
869
+ export type VerificationFreshnessResult = {
870
+ fresh: true;
871
+ } | {
872
+ fresh: false;
873
+ reasonCode: VerificationFreshnessReasonCode;
874
+ };
875
+ export declare function compareVerificationReceiptToCurrent(receipt: VerificationReceiptV1, plan: VerificationPlanV1, candidateSnapshotDigest: string, acceptanceFingerprint: string): Promise<VerificationFreshnessResult>;
876
+ /**
877
+ * Published frozen canonical vectors for the verification contracts.
878
+ *
879
+ * Each vector is a minimal valid value whose canonical digest is deterministic
880
+ * and reproducible. These vectors lock the canonicalization rules (D6) in place.
881
+ * Changing any vector's expected digest would be a reviewed contract change.
882
+ */
883
+ export declare const VERIFICATION_CANONICAL_VECTORS: ReadonlyArray<Readonly<CanonicalVectorV1>>;