@gtrabanco/agentic-workflow-schema 3.4.0 → 4.0.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,19 @@
1
+ /**
2
+ * Published canonical vectors for the pre-execution contracts.
3
+ *
4
+ * Each entry pins the EXACT lowercase SHA-256 digest of one fixture document
5
+ * (`test/fixtures/pre-execution-vectors.mjs`, kept in sync by name). The payloads
6
+ * are written as literal JSON documents — not produced by the builder — so a change
7
+ * to the canonical serializer, the field projection, or the byte ordering shifts a
8
+ * digest here and the suite fails instead of silently re-blessing new bytes.
9
+ *
10
+ * A digest change is a contract change: it is reviewed, versioned, and recorded in
11
+ * `CHANGELOG.md`, never regenerated to make a test pass.
12
+ */
13
+ export interface PreExecutionCanonicalVector {
14
+ readonly contract: string;
15
+ readonly description: string;
16
+ readonly digest: string;
17
+ }
18
+ /** The four shipped vectors: both contracts, both stages. */
19
+ export declare const PRE_EXECUTION_CANONICAL_VECTORS: readonly PreExecutionCanonicalVector[];
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Published canonical vectors for the pre-execution contracts.
3
+ *
4
+ * Each entry pins the EXACT lowercase SHA-256 digest of one fixture document
5
+ * (`test/fixtures/pre-execution-vectors.mjs`, kept in sync by name). The payloads
6
+ * are written as literal JSON documents — not produced by the builder — so a change
7
+ * to the canonical serializer, the field projection, or the byte ordering shifts a
8
+ * digest here and the suite fails instead of silently re-blessing new bytes.
9
+ *
10
+ * A digest change is a contract change: it is reviewed, versioned, and recorded in
11
+ * `CHANGELOG.md`, never regenerated to make a test pass.
12
+ */
13
+ /** The four shipped vectors: both contracts, both stages. */
14
+ export const PRE_EXECUTION_CANONICAL_VECTORS = Object.freeze([
15
+ Object.freeze({
16
+ contract: "agentic-workflow/pre-execution-artifact-snapshot@1",
17
+ description: "SPEC-stage snapshot binding one Product projection and one governing issue",
18
+ digest: "a7c7237c6b6105e80a6fb26b3c0a7fd946505df8eed0c952a29cbc3ad7770658",
19
+ }),
20
+ Object.freeze({
21
+ contract: "agentic-workflow/pre-execution-artifact-snapshot@1",
22
+ description: "Plan-stage snapshot bound to a Product parent with SPEC, ACCEPTANCE, and TASKS rows",
23
+ digest: "6348fc1818fc57ca78939a09d09d38600c3624e8ba3e09866cea2378161045c5",
24
+ }),
25
+ Object.freeze({
26
+ contract: "agentic-workflow/pre-execution-review-receipt@1",
27
+ description: "SPEC-stage review receipt with a clean PASS and no findings",
28
+ digest: "7003133ab8f00ae7a9edb052e435e1bb07168d17f19c29f1d1ad0708e795b566",
29
+ }),
30
+ Object.freeze({
31
+ contract: "agentic-workflow/pre-execution-review-receipt@1",
32
+ description: "Plan-stage arbiter receipt carrying two findings and one critic parent digest",
33
+ digest: "27d7d2b949b2776dc386ba217d93926f02580d54b7c194a99710f6f3696ee97e",
34
+ }),
35
+ ]);
@@ -0,0 +1,363 @@
1
+ /**
2
+ * Pre-execution evidence contracts — the feature 28 runtime surface.
3
+ *
4
+ * `PreExecutionArtifactSnapshot v1` records the EXACT artifact set, authoritative
5
+ * contexts, source revision and authoring revision an independent reviewer read;
6
+ * `PreExecutionReviewReceipt v1` records that reviewer's content-bound verdict on
7
+ * one snapshot. Together they make "the Product was reviewed before the Plan was
8
+ * written" a checkable claim instead of a hopeful sentence in a progress log.
9
+ *
10
+ * What lives here, and what deliberately does not:
11
+ * - Every structural rule is declared once in `pre-execution-contract.ts` and
12
+ * enforced by the ONE package-wide structural engine (`validateStructure`),
13
+ * so this module adds semantics, not a second walker.
14
+ * - The package never reads the filesystem or Git. The selector and the builder
15
+ * consume caller-supplied text and caller-supplied revisions, so a reviewer can
16
+ * bind a document from any source (forge API, shallow clone, editor buffer) and
17
+ * a digest can never describe bytes other than the ones it was handed.
18
+ * - These contracts are not the candidate review receipt (feature 25) and not the
19
+ * staged verification receipt (feature 26): a pre-execution PASS authorizes
20
+ * WRITING code, never merging it. A substitute from either family is refused by
21
+ * contract-id mismatch before any content is compared.
22
+ *
23
+ * Feature 28, phase P1. Diagnostics follow the package's D16 rule: a frozen code
24
+ * plus an RFC 6901 pointer, never the submitted value.
25
+ */
26
+ import { PRE_EXECUTION_ARTIFACT_KINDS, PRE_EXECUTION_AUTHOR_EXCLUSIONS, PRE_EXECUTION_CONTEXT_KINDS, PRE_EXECUTION_CONTEXT_PRESENCE, PRE_EXECUTION_FINDING_CLASSES, PRE_EXECUTION_FINDING_RESOLUTIONS, PRE_EXECUTION_FINDING_SEVERITIES, PRE_EXECUTION_FINDING_VERIFICATION, PRE_EXECUTION_LIMITS, PRE_EXECUTION_MODEL_DIVERSITY, PRE_EXECUTION_PARENT_ROLES, PRE_EXECUTION_RECEIPT_CONTRACT_ID, PRE_EXECUTION_REVIEW_ROLES, PRE_EXECUTION_SELECTORS, PRE_EXECUTION_STAGES, PRE_EXECUTION_SNAPSHOT_CONTRACT_ID, PRE_EXECUTION_UNIT_KINDS, PRE_EXECUTION_VERDICTS } from "./pre-execution-contract.js";
27
+ import { PRE_EXECUTION_CANONICAL_VECTORS, type PreExecutionCanonicalVector } from "./pre-execution-vectors.js";
28
+ export { PRE_EXECUTION_SNAPSHOT_CONTRACT_ID, PRE_EXECUTION_RECEIPT_CONTRACT_ID, PRE_EXECUTION_STAGES, PRE_EXECUTION_UNIT_KINDS, PRE_EXECUTION_SELECTORS, PRE_EXECUTION_ARTIFACT_KINDS, PRE_EXECUTION_CONTEXT_KINDS, PRE_EXECUTION_CONTEXT_PRESENCE, PRE_EXECUTION_VERDICTS, PRE_EXECUTION_FINDING_SEVERITIES, PRE_EXECUTION_FINDING_CLASSES, PRE_EXECUTION_FINDING_VERIFICATION, PRE_EXECUTION_FINDING_RESOLUTIONS, PRE_EXECUTION_REVIEW_ROLES, PRE_EXECUTION_PARENT_ROLES, PRE_EXECUTION_AUTHOR_EXCLUSIONS, PRE_EXECUTION_MODEL_DIVERSITY, PRE_EXECUTION_LIMITS, PRE_EXECUTION_CANONICAL_VECTORS, };
29
+ export type { PreExecutionCanonicalVector };
30
+ export { PRE_EXECUTION_RUNTIME_RULES } from "./pre-execution-contract.js";
31
+ /** The one selector a SPEC-stage snapshot may bind: the Product projection (D2). */
32
+ export declare const PRE_EXECUTION_SNAPSHOT_SELECTOR: "spec-product-v1";
33
+ export type PreExecutionStage = (typeof PRE_EXECUTION_STAGES)[number];
34
+ export type PreExecutionUnitKind = (typeof PRE_EXECUTION_UNIT_KINDS)[number];
35
+ export type PreExecutionSelector = (typeof PRE_EXECUTION_SELECTORS)[number];
36
+ export type PreExecutionArtifactKind = (typeof PRE_EXECUTION_ARTIFACT_KINDS)[number];
37
+ export type PreExecutionContextKind = (typeof PRE_EXECUTION_CONTEXT_KINDS)[number];
38
+ export type PreExecutionContextPresence = (typeof PRE_EXECUTION_CONTEXT_PRESENCE)[number];
39
+ export type PreExecutionVerdict = (typeof PRE_EXECUTION_VERDICTS)[number];
40
+ export type PreExecutionFindingSeverity = (typeof PRE_EXECUTION_FINDING_SEVERITIES)[number];
41
+ export type PreExecutionFindingClass = (typeof PRE_EXECUTION_FINDING_CLASSES)[number];
42
+ export type PreExecutionFindingVerification = (typeof PRE_EXECUTION_FINDING_VERIFICATION)[number];
43
+ export type PreExecutionFindingResolution = (typeof PRE_EXECUTION_FINDING_RESOLUTIONS)[number];
44
+ export type PreExecutionReviewerRole = (typeof PRE_EXECUTION_REVIEW_ROLES)[number];
45
+ export type PreExecutionParentRole = (typeof PRE_EXECUTION_PARENT_ROLES)[number];
46
+ export type PreExecutionAuthorExclusion = (typeof PRE_EXECUTION_AUTHOR_EXCLUSIONS)[number];
47
+ export type PreExecutionModelDiversity = (typeof PRE_EXECUTION_MODEL_DIVERSITY)[number];
48
+ /**
49
+ * The closed diagnostic vocabulary of this contract family: the package-wide D16
50
+ * codes (so a driver that already routes on them keeps working unchanged) plus the
51
+ * pre-execution refusals no existing code describes. Adding a member is a reviewed,
52
+ * versioned change, and no code ever names a submitted value.
53
+ */
54
+ export declare const PRE_EXECUTION_DIAGNOSTIC_CODES: readonly ["invalid-type", "missing-field", "unknown-field", "invalid-value", "limit-exceeded", "duplicate-id", "unknown-command", "invalid-order", "invalid-stage", "invalid-exit-state", "invalid-evidence", "invalid-skip", "invalid-fail-fast", "digest-mismatch", "verdict-mismatch", "budget-exceeded", "missing-artifact-kind", "invalid-artifact-set", "invalid-selector", "invalid-author", "invalid-context", "invalid-topology", "stale-snapshot", "stale-policy"];
55
+ export type PreExecutionDiagnosticCode = (typeof PRE_EXECUTION_DIAGNOSTIC_CODES)[number];
56
+ /** One refusal row: a frozen code and the pointer to the offending location. */
57
+ export interface PreExecutionDiagnostic {
58
+ readonly code: PreExecutionDiagnosticCode;
59
+ /** RFC 6901 pointer over declared property names and decimal indices; `""` is the root. */
60
+ readonly path: string;
61
+ }
62
+ /**
63
+ * The freshness/authority answers of `comparePreExecutionReceiptToSnapshot`.
64
+ * Exactly one fires per call, in the documented precedence, and the comparison
65
+ * never throws: an input it cannot read is answered with a code.
66
+ */
67
+ export declare const PRE_EXECUTION_FRESHNESS_CODES: readonly ["invalid-stage", "invalid-unit", "stale-policy", "stale-context", "stale-source-revision", "stale-parent", "stale-artifact-revision", "stale-artifact-content", "missing-receipt-snapshot"];
68
+ export type PreExecutionFreshnessCode = (typeof PRE_EXECUTION_FRESHNESS_CODES)[number];
69
+ /** The Product-half headings the selector binds, in required order. */
70
+ export declare const SPEC_PRODUCT_REQUIRED_HEADINGS: readonly ["Goal", "Branch", "Size", "Dependencies", "Product half", "Design status"];
71
+ /** One artifact bound into a snapshot, by the exact bytes the reviewer read. */
72
+ export interface PreExecutionArtifactRow {
73
+ readonly kind: PreExecutionArtifactKind;
74
+ readonly path: string;
75
+ readonly selector: PreExecutionSelector;
76
+ readonly byteLength: number;
77
+ readonly digest: string;
78
+ }
79
+ /** One authoritative context: present and bound by digest, or explicitly absent. */
80
+ export interface PreExecutionContextBinding {
81
+ readonly kind: PreExecutionContextKind;
82
+ readonly identifier: string;
83
+ readonly presence: PreExecutionContextPresence;
84
+ readonly digest: string | null;
85
+ }
86
+ /** The exact artifact set one independent reviewer read. */
87
+ export interface PreExecutionArtifactSnapshotV1 {
88
+ readonly contract: typeof PRE_EXECUTION_SNAPSHOT_CONTRACT_ID;
89
+ readonly stage: PreExecutionStage;
90
+ readonly unitKind: PreExecutionUnitKind;
91
+ readonly unitId: string;
92
+ readonly sourceRevision: string;
93
+ readonly artifactRevisionId: string;
94
+ readonly artifacts: readonly PreExecutionArtifactRow[];
95
+ readonly contexts: readonly PreExecutionContextBinding[];
96
+ readonly parentSpecSnapshotDigest: string | null;
97
+ }
98
+ /** One structured review finding. */
99
+ export interface PreExecutionFinding {
100
+ readonly id: string;
101
+ readonly severity: PreExecutionFindingSeverity;
102
+ readonly class: PreExecutionFindingClass;
103
+ readonly claim: string;
104
+ readonly evidenceRefs: readonly string[];
105
+ readonly verification: PreExecutionFindingVerification;
106
+ readonly resolution: PreExecutionFindingResolution;
107
+ readonly resolutionEvidence: string | null;
108
+ }
109
+ /** One optional parent receipt: topology, never a vote. */
110
+ export interface PreExecutionParentReceipt {
111
+ readonly role: PreExecutionParentRole;
112
+ readonly receiptDigest: string;
113
+ }
114
+ /** An independent, content-bound verdict on one pre-execution snapshot. */
115
+ export interface PreExecutionReviewReceiptV1 {
116
+ readonly contract: typeof PRE_EXECUTION_RECEIPT_CONTRACT_ID;
117
+ readonly id: string;
118
+ readonly stage: PreExecutionStage;
119
+ readonly snapshotDigest: string;
120
+ readonly verdict: PreExecutionVerdict;
121
+ readonly findings: readonly PreExecutionFinding[];
122
+ readonly reviewer: string;
123
+ readonly sessionId: string;
124
+ readonly reviewerRole: PreExecutionReviewerRole;
125
+ readonly authorId: string;
126
+ readonly authorExclusion: PreExecutionAuthorExclusion;
127
+ readonly contextClean: boolean;
128
+ readonly modelDiversity: PreExecutionModelDiversity;
129
+ readonly policyVersion: string;
130
+ readonly startedAt: string;
131
+ readonly finishedAt: string;
132
+ readonly parentReceipts: readonly PreExecutionParentReceipt[];
133
+ readonly diagnostics: readonly string[];
134
+ }
135
+ /** Result of a snapshot validation; `snapshot` is present only when `ok`. */
136
+ export interface PreExecutionSnapshotValidationResult {
137
+ readonly ok: boolean;
138
+ readonly snapshot?: PreExecutionArtifactSnapshotV1;
139
+ readonly diagnostics: readonly PreExecutionDiagnostic[];
140
+ readonly truncated: boolean;
141
+ }
142
+ /** Result of a receipt validation; `receipt` is present only when `ok`. */
143
+ export interface PreExecutionReceiptValidationResult {
144
+ readonly ok: boolean;
145
+ readonly receipt?: PreExecutionReviewReceiptV1;
146
+ readonly diagnostics: readonly PreExecutionDiagnostic[];
147
+ readonly truncated: boolean;
148
+ }
149
+ /** Verdict of the freshness comparison. */
150
+ export type PreExecutionFreshnessResult = {
151
+ readonly fresh: true;
152
+ } | {
153
+ readonly fresh: false;
154
+ readonly reasonCode: PreExecutionFreshnessCode;
155
+ };
156
+ /** Why a Product projection could not be cut. Names a heading, never a document. */
157
+ export interface SpecProductSelectorError {
158
+ readonly code: "selector-title-missing" | "selector-heading-missing" | "selector-heading-duplicate" | "selector-heading-order";
159
+ readonly heading: string;
160
+ }
161
+ /** The bytes a SPEC-stage snapshot binds, or the one defect that stopped the cut. */
162
+ export type SpecProductSelection = {
163
+ readonly ok: true;
164
+ readonly content: string;
165
+ readonly byteLength: number;
166
+ readonly digest: string;
167
+ } | {
168
+ readonly ok: false;
169
+ readonly errors: readonly SpecProductSelectorError[];
170
+ };
171
+ /**
172
+ * Cut the Product projection out of a SPEC document.
173
+ *
174
+ * The selection is byte-exact and total: the level-1 title and the required
175
+ * level-2 sections (Goal, Branch, Size, Dependencies, Product half, Design
176
+ * status), ending at the first boundary heading after Design status, with trailing
177
+ * blank lines removed and exactly one final newline. Everything the selector does
178
+ * NOT take — Amendments, the Engineering half, later appendices — stays outside
179
+ * Product authority, so a Plan-phase write can never rotate a Product digest and
180
+ * silently erase a recorded review (the property AC2 and S6 test).
181
+ *
182
+ * Determinism rules that make the digest trustworthy:
183
+ * - line endings normalize to LF first, so a CRLF checkout and an LF editor
184
+ * select identical bytes;
185
+ * - fenced blocks are inert: a `## Goal` inside a template is neither a duplicate
186
+ * heading nor a section boundary, and fenced content still belongs to the
187
+ * section containing it (under-binding would leave edits unchecked); a block ends
188
+ * only on a run of its own fence character, at least as long and with no info
189
+ * string, so a mixed-character fence cannot end it early;
190
+ * - heading text is compared EXACTLY — no trimming, no case folding, no
191
+ * substring — so `## Goals`, `### Goal` and `## Goal ` all fail closed;
192
+ * - the FIRST defect in the fixed order title → missing → duplicate → order is
193
+ * reported alone, because every later position is already suspect.
194
+ *
195
+ * No I/O: the caller supplies the text it read.
196
+ */
197
+ export declare function selectSpecProduct(text: unknown): SpecProductSelection;
198
+ /**
199
+ * The authoritative snapshot validator (feature 28 AC1).
200
+ *
201
+ * Enforces, in one pass and from the canonical definition: the contract id, the
202
+ * closed stage/unit/artifact/selector/context vocabularies, the exact 40- or
203
+ * 64-hex source revision and 64-hex digest shapes, normalized repository-relative
204
+ * paths, the declared-field-only DTO at every level (prototype and undeclared keys
205
+ * are never contract data), the published cardinality and length ceilings, the
206
+ * payload budget, and the stage matrix Draft-07 cannot express: `spec` binds one
207
+ * Product-projection row and no parent, `plan` binds at least the whole SPEC and
208
+ * ACCEPTANCE and its parent snapshot digest, a fix unit has no `spec` stage, rows
209
+ * are unique per kind and byte-ordered by path, and context identities are unique
210
+ * and byte-ordered.
211
+ *
212
+ * The input domain is JSON documents. A value outside it (a throwing getter, say)
213
+ * is refused as one redacted `invalid-type` row rather than escaping as an
214
+ * exception, and no diagnostic ever carries a submitted value.
215
+ */
216
+ export declare function validatePreExecutionArtifactSnapshotV1(value: unknown): PreExecutionSnapshotValidationResult;
217
+ /** One document the reviewer read, as text plus where it came from. */
218
+ export interface PreExecutionArtifactInput {
219
+ readonly kind: PreExecutionArtifactKind;
220
+ readonly path: string;
221
+ readonly content: string;
222
+ /**
223
+ * How to select the bound bytes. Defaults to the Product projection for a
224
+ * `spec` row of a SPEC-stage snapshot and to `whole-file` everywhere else.
225
+ */
226
+ readonly selector?: PreExecutionSelector;
227
+ }
228
+ /**
229
+ * One authoritative context, supplied as the bytes the reviewer read (`content`)
230
+ * or as an explicit absence. Both branches are rows: "there is no governing
231
+ * issue" is a recorded fact, not a skipped field.
232
+ */
233
+ export interface PreExecutionContextInput {
234
+ readonly kind: PreExecutionContextKind;
235
+ readonly identifier: string;
236
+ readonly content?: string;
237
+ readonly presence?: PreExecutionContextPresence;
238
+ }
239
+ /** Input to the artifact-set builder. Every field is caller-owned; nothing is read. */
240
+ export interface PreExecutionSnapshotBuildInput {
241
+ readonly stage: PreExecutionStage;
242
+ readonly unitKind: PreExecutionUnitKind;
243
+ readonly unitId: string;
244
+ readonly sourceRevision: string;
245
+ readonly artifactRevisionId: string;
246
+ readonly files: readonly PreExecutionArtifactInput[];
247
+ readonly contexts?: readonly PreExecutionContextInput[];
248
+ readonly parentSpecSnapshotDigest?: string | null;
249
+ }
250
+ /**
251
+ * Build the canonical artifact set for a stage from bytes the caller supplied.
252
+ *
253
+ * This is the only sanctioned way to produce a snapshot: it derives every digest
254
+ * and `byteLength` from the text it is handed, orders artifact rows by UTF-8 path
255
+ * bytes and context rows by (kind, identifier), defaults the parent binding to
256
+ * `null` at the SPEC stage, and then feeds the result through
257
+ * `validatePreExecutionArtifactSnapshotV1`. That last step is the guarantee: a
258
+ * builder can never return a snapshot its own validator would refuse, and a
259
+ * hand-assembled object is not how a reviewer gets one.
260
+ *
261
+ * A `spec-product-v1` row binds the PROJECTION, so Engineering-half and Amendments
262
+ * writes do not move its digest; a `whole-file` row binds the exact bytes. A
263
+ * rejected selection fails the build under `invalid-selector` at the row's content
264
+ * pointer rather than producing a partial binding. Diagnostics in this family are
265
+ * bounded (code, path) pairs, so WHICH heading failed and how is not carried here —
266
+ * `selectSpecProduct` is the only entry that reports the selector's own reason.
267
+ */
268
+ export declare function buildPreExecutionArtifactSnapshot(input: PreExecutionSnapshotBuildInput): PreExecutionSnapshotValidationResult;
269
+ /**
270
+ * D6 — canonical serialization of a validated `PreExecutionArtifactSnapshot v1`.
271
+ *
272
+ * Sorted keys, compact separators, declared own-properties only, and the input
273
+ * domain is the JSON data model: an undeclared field, a prototype value, or a leaf
274
+ * no validator would accept (a function, a BigInt, `NaN`) is a named refusal, so a
275
+ * digest can never describe bytes the contract would reject. Artifact and context
276
+ * order is PRESERVED, never re-sorted here: the canonical order is a contract rule
277
+ * the validator enforces, so the serializer stays a pure projection.
278
+ */
279
+ export declare function canonicalizePreExecutionArtifactSnapshot(snapshot: PreExecutionArtifactSnapshotV1): string;
280
+ /**
281
+ * D6 — canonical serialization of a validated `PreExecutionReviewReceipt v1`.
282
+ *
283
+ * Findings are re-emitted in UTF-8 byte order of their stable ids and parent
284
+ * receipts in byte order of their digests: the ORDER two independent reviewers
285
+ * happened to append them in carries no meaning, so it must not change a digest
286
+ * either. (Artifact and context rows are the opposite case — their order IS a
287
+ * contract rule the validator enforces — so the snapshot serializer preserves it.)
288
+ */
289
+ export declare function canonicalizePreExecutionReviewReceipt(receipt: PreExecutionReviewReceiptV1): string;
290
+ /** D6 — digest of a validated snapshot (inherits the canonical-input guards). Sync, like the family that produces it (F67). */
291
+ export declare function digestPreExecutionArtifactSnapshot(snapshot: PreExecutionArtifactSnapshotV1): string;
292
+ /** D6 — digest of a validated receipt (inherits the canonical-input guards). Sync, like the family that produces it (F67). */
293
+ export declare function digestPreExecutionReviewReceipt(receipt: PreExecutionReviewReceiptV1): string;
294
+ /**
295
+ * The authoritative receipt validator that does NOT bind a snapshot (feature 28
296
+ * AC1): the contract id, the closed verdict/severity/class/verification/resolution/
297
+ * role vocabularies, the stage/verdict matrix, opaque bounded identities, UTC
298
+ * calendar-valid ordered timestamps, the bounded finding and parent-receipt sets
299
+ * with unique ids, digests, and rows, and the payload budget.
300
+ *
301
+ * It proves a receipt is WELL-FORMED. The parent topology is deliberately not
302
+ * part of that answer — a plain reviewer may record a critique lineage — and
303
+ * cannot prove the claim a PASS makes — that the bound snapshot is the current
304
+ * one and nothing material is still open — so it is never the gate;
305
+ * `validatePreExecutionReceiptAgainstSnapshot` is.
306
+ */
307
+ export declare function validatePreExecutionReviewReceiptV1(value: unknown): PreExecutionReceiptValidationResult;
308
+ /**
309
+ * The ONLY authority that blesses a pre-execution verdict (feature 28 AC1/AC2).
310
+ *
311
+ * On top of the structural pass it binds the receipt to a snapshot and to the
312
+ * policy it was reviewed under, then enforces what a PASS actually claims:
313
+ *
314
+ * 1. the receipt must bind THIS snapshot — same stage, current `policyVersion`,
315
+ * and a `snapshotDigest` equal to the digest of the snapshot (`stale-snapshot`
316
+ * otherwise, so a rotated document cannot be blessed by an older reading);
317
+ * 2. when the runtime can observe authorship, a reviewer cannot be its own author
318
+ * (`invalid-author`); where it cannot, the receipt says so in
319
+ * `authorExclusion: "not-enforceable"` and the limit stays visible instead of
320
+ * being laundered into a PASS;
321
+ * 3. `contextClean` is mandatory for a PASS and never for a FAIL: a contaminated
322
+ * reviewer may still report what it found;
323
+ * 4. a PASS may not carry a material finding that is still open or unverified
324
+ * (`verdict-mismatch`) — `info` severity is the only immaterial row.
325
+ *
326
+ * The parent-topology rule (parents require a critic/synthesizer/arbiter role,
327
+ * `invalid-topology`) is part of the canonical definition itself — the shared
328
+ * structural walk enforces it for the standalone validator too, so there is no
329
+ * second, binding-only copy. `modelDiversity` is deliberately absent from this
330
+ * list: it is reported truthfully and never converted into a threshold, because
331
+ * plurality of identical models is not independence. There is no quorum to
332
+ * satisfy, and no numeric approval model to reverse-engineer from a parent list.
333
+ */
334
+ export declare function validatePreExecutionReceiptAgainstSnapshot(receipt: unknown, snapshot: unknown, policyVersion: string): PreExecutionReceiptValidationResult;
335
+ /**
336
+ * Is the approval recorded in `receipt` still the approval of the CURRENT document?
337
+ *
338
+ * Pure, deterministic, and total: it throws nothing and returns exactly one verdict
339
+ * in this fixed precedence —
340
+ *
341
+ * 1. `missing-receipt-snapshot` — the receipt does not bind the reviewed snapshot
342
+ * (including a receipt or snapshot it cannot read at all);
343
+ * 2. `invalid-stage` / `invalid-unit` — the two snapshots are not the same review
344
+ * target, which no content comparison can repair;
345
+ * 3. `stale-policy` — the review policy moved under the approval;
346
+ * 4. `stale-context` — an authority the reviewer relied on changed;
347
+ * 5. `stale-source-revision` — the repository revision the artifacts were read at
348
+ * changed;
349
+ * 6. `stale-parent` — the Product snapshot a Plan approval descends from changed
350
+ * (lineage, so a Product rewrite erases the descendant approval);
351
+ * 7. `stale-artifact-content` — a bound artifact's bytes changed;
352
+ * 8. `stale-artifact-revision` — the authoring revision rotated with identical
353
+ * bytes, which is why content is checked first: a mutate-then-revert with a
354
+ * rotated `artifactRevisionId` still lands here and an older PASS never
355
+ * resurrects (S6);
356
+ * 9. otherwise `{ fresh: true }`.
357
+ *
358
+ * Every dimension is reported alone because a caller routes on it: a stale context
359
+ * asks a sensor to re-read, a stale artifact asks the reviewer to re-read, and a
360
+ * rotated revision asks the author for a new review. Collapsing them into "stale"
361
+ * would leave a driver guessing which is why the codes are named per dimension.
362
+ */
363
+ export declare function comparePreExecutionReceiptToSnapshot(receipt: unknown, reviewedSnapshot: unknown, currentSnapshot: unknown, policyVersion: string): PreExecutionFreshnessResult;