@gtrabanco/agentic-workflow-schema 3.3.0 → 3.5.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,175 @@
1
+ /**
2
+ * Canonical internal definition of the two pre-execution evidence contracts.
3
+ *
4
+ * This module is the SINGLE source of the `PreExecutionArtifactSnapshot v1` and
5
+ * `PreExecutionReviewReceipt v1` structural contract: the closed field lists,
6
+ * vocabularies, bounds, patterns, cross-field rules and named runtime-only
7
+ * semantics declared here are consumed by
8
+ * - the two authoritative runtime entries in `index.ts` (which reuse
9
+ * `validateStructure`/`projectStructure` from `verification-contract.ts`, so
10
+ * the package keeps ONE structural engine), and
11
+ * - the deterministic Draft-07 structural projection generator
12
+ * (`scripts/generate-pre-execution-schemas.mjs`).
13
+ *
14
+ * It is package-internal: it is not re-exported from the package root and the
15
+ * published `exports` map does not expose it. The generated JSON Schemas are
16
+ * structural projections of this definition, never a second semantic authority
17
+ * (AD-007). The rules listed in `RUNTIME_RULES` are deliberately not expressible
18
+ * in Draft-07; the projections disclose them instead of implying they are checked.
19
+ *
20
+ * Feature 28, phase P1. The contracts prove what an independent reviewer read
21
+ * BEFORE implementation; they never replace the candidate `ReviewReceipt v1`
22
+ * (feature 25) or the staged `VerificationReceipt v1` (feature 26).
23
+ */
24
+ import type { VerificationContractSpec } from "./verification-contract.js";
25
+ export declare const PRE_EXECUTION_SNAPSHOT_CONTRACT_ID: "agentic-workflow/pre-execution-artifact-snapshot@1";
26
+ export declare const PRE_EXECUTION_RECEIPT_CONTRACT_ID: "agentic-workflow/pre-execution-review-receipt@1";
27
+ /** The two artifact-selection modes. `spec-product-v1` is the Product projection. */
28
+ export declare const PRE_EXECUTION_SELECTORS: readonly ["whole-file", "spec-product-v1"];
29
+ /** The reviewed stage. A fix unit has no SPEC stage (D6). */
30
+ export declare const PRE_EXECUTION_STAGES: readonly ["spec", "plan"];
31
+ /** The unit family the snapshot belongs to. */
32
+ export declare const PRE_EXECUTION_UNIT_KINDS: readonly ["feature", "fix"];
33
+ /**
34
+ * The artifact roles a pre-execution snapshot may bind. Deliberately excludes
35
+ * execution progress (`progress.md`), raw exploration history, and findings
36
+ * resolution: none of them are Plan authority (SPEC Design §2).
37
+ */
38
+ export declare const PRE_EXECUTION_ARTIFACT_KINDS: readonly ["spec", "acceptance", "plan", "tasks", "testing", "decisions", "architecture-notes", "planning-evidence", "obligations"];
39
+ /** Authoritative sources a reviewer was allowed to read besides the artifacts. */
40
+ export declare const PRE_EXECUTION_CONTEXT_KINDS: readonly ["roadmap-row", "governing-issue", "normalized-repository-state", "architectural-invariants", "dependency-unit", "project-guide"];
41
+ /**
42
+ * A context is either present (and bound by digest) or explicitly absent (and
43
+ * bound by `null`). "I did not look" is not representable, which is the point:
44
+ * an unknown stays owned by a named row instead of becoming a silent assumption.
45
+ */
46
+ export declare const PRE_EXECUTION_CONTEXT_PRESENCE: readonly ["present", "absent"];
47
+ /** The five public review verdicts. There is no generic "approve" verb. */
48
+ export declare const PRE_EXECUTION_VERDICTS: readonly ["spec-review-pass", "spec-review-fail", "plan-review-pass", "plan-review-fail", "needs-design"];
49
+ /** Severities mirror the candidate-review ladder; `info` is the only immaterial one. */
50
+ export declare const PRE_EXECUTION_FINDING_SEVERITIES: readonly ["info", "low", "medium", "high", "critical"];
51
+ /** The five root-cause owners a finding can be routed to (SPEC Design §4). */
52
+ export declare const PRE_EXECUTION_FINDING_CLASSES: readonly ["product", "plan", "source", "environment", "runtime"];
53
+ export declare const PRE_EXECUTION_FINDING_VERIFICATION: readonly ["verified", "unverified"];
54
+ export declare const PRE_EXECUTION_FINDING_RESOLUTIONS: readonly ["open", "resolved", "dismissed"];
55
+ export declare const PRE_EXECUTION_REVIEW_ROLES: readonly ["reviewer", "critic", "synthesizer", "arbiter"];
56
+ /** The reviewer roles allowed to carry parent receipts (topology, not rank). */
57
+ export declare const PARENT_CAPABLE_REVIEWER_ROLES: readonly ["critic", "synthesizer", "arbiter"];
58
+ export declare const PRE_EXECUTION_PARENT_ROLES: readonly ["critic", "synthesis", "arbitration"];
59
+ export declare const PRE_EXECUTION_AUTHOR_EXCLUSIONS: readonly ["enforced", "not-enforceable"];
60
+ /** Truthful diversity reporting: a same-model review is never labelled diverse. */
61
+ type Stage = (typeof PRE_EXECUTION_STAGES)[number];
62
+ type Verdict = (typeof PRE_EXECUTION_VERDICTS)[number];
63
+ /** Which verdicts belong to which stage. There is no generic "approve". */
64
+ export declare const VERDICTS_BY_STAGE: Readonly<Record<Stage, readonly Verdict[]>>;
65
+ export declare const PRE_EXECUTION_MODEL_DIVERSITY: readonly ["same-model", "cross-model", "not-applicable"];
66
+ /**
67
+ * Bounded usability. Every number the validator enforces lives here and is
68
+ * published, so a consumer sizes fixtures without restating a literal.
69
+ *
70
+ * The byte budgets are reachable *below* the shape ceilings on purpose: a
71
+ * snapshot of `artifacts` rows whose paths each sit at `pathChars` is already
72
+ * larger than `snapshotBytes`, so the payload budget is the first refusal a wide
73
+ * document earns and the diagnostic ceiling is never spent on it.
74
+ */
75
+ export declare const PRE_EXECUTION_LIMITS: Readonly<{
76
+ readonly artifacts: 32;
77
+ readonly contexts: 16;
78
+ readonly findings: 64;
79
+ readonly evidencePerFinding: 8;
80
+ readonly parentReceipts: 8;
81
+ readonly receiptDiagnostics: 8;
82
+ readonly unitIdChars: 128;
83
+ readonly revisionIdChars: 128;
84
+ readonly idChars: 128;
85
+ readonly pathChars: 1024;
86
+ readonly identifierChars: 160;
87
+ readonly claimChars: 2048;
88
+ readonly evidenceChars: 1024;
89
+ readonly resolutionEvidenceChars: 2048;
90
+ readonly policyChars: 64;
91
+ readonly diagnosticChars: 512;
92
+ readonly artifactBytes: number;
93
+ readonly snapshotBytes: number;
94
+ readonly receiptBytes: number;
95
+ /** Shared ceiling of the one package-wide diagnostic sink. */
96
+ readonly diagnostics: 50;
97
+ }>;
98
+ /**
99
+ * The rules a Draft-07 projection cannot express. The generator lists these ids,
100
+ * with their human-readable claim, in the projection `$comment`, so an editor
101
+ * that validates against the projection knows exactly what it did NOT check.
102
+ */
103
+ /**
104
+ * The rules the runtime enforces that Draft-07 cannot express, named and claimed.
105
+ * The generator appends the ids of every non-projectable cross-field rule it
106
+ * finds in the definition, so this list and the rule tables must agree — the
107
+ * projection test fails if a rule is enforced but undisclosed.
108
+ */
109
+ export declare const PRE_EXECUTION_RUNTIME_RULES: Readonly<{
110
+ readonly snapshot: readonly [{
111
+ readonly id: "stage-required-artifacts";
112
+ readonly claim: "stage drives the required artifact set";
113
+ }, {
114
+ readonly id: "selector-requires-product-stage";
115
+ readonly claim: "spec-product-v1 requires stage spec on the spec row";
116
+ }, {
117
+ readonly id: "artifact-order-is-canonical";
118
+ readonly claim: "artifact rows are ordered by UTF-8 path bytes";
119
+ }, {
120
+ readonly id: "one-row-per-kind";
121
+ readonly claim: "each artifact kind appears at most once";
122
+ }, {
123
+ readonly id: "context-order-is-canonical";
124
+ readonly claim: "context rows are ordered by kind then identifier";
125
+ }, {
126
+ readonly id: "one-context-per-identity";
127
+ readonly claim: "each (kind, identifier) context appears once";
128
+ }, {
129
+ readonly id: "fix-has-no-product-stage";
130
+ readonly claim: "unitKind fix cannot carry a SPEC-stage snapshot";
131
+ }];
132
+ readonly receipt: readonly [{
133
+ readonly id: "finding-requires-evidence";
134
+ readonly claim: "every finding carries at least one evidence reference";
135
+ }, {
136
+ readonly id: "pass-requires-resolved-material-findings";
137
+ readonly claim: "PASS cannot coexist with an open or unverified material finding";
138
+ }, {
139
+ readonly id: "dismissal-requires-counter-evidence";
140
+ readonly claim: "only recorded counter-evidence dismisses a finding";
141
+ }, {
142
+ readonly id: "author-exclusion-where-enforced";
143
+ readonly claim: "an enforcing runtime rejects a reused author identity";
144
+ }, {
145
+ readonly id: "pass-requires-clean-context";
146
+ readonly claim: "PASS requires context-clean evidence";
147
+ }, {
148
+ readonly id: "unique-parent-digests";
149
+ readonly claim: "parent receipt digests are unique";
150
+ }, {
151
+ readonly id: "receipt-bound-to-snapshot";
152
+ readonly claim: "the verdict must bind the exact snapshot digest";
153
+ }];
154
+ }>;
155
+ /**
156
+ * One contract definition: the shared structural shape plus the runtime-only rules
157
+ * the generator must disclose (Draft-07 cannot express them, so a projection that
158
+ * stayed silent would imply a check it never performs).
159
+ */
160
+ export interface PreExecutionContractSpec extends VerificationContractSpec {
161
+ readonly runtimeRules: readonly {
162
+ readonly id: string;
163
+ readonly claim: string;
164
+ }[];
165
+ }
166
+ /**
167
+ * The two pre-execution contracts in the shape the shared structural engine and
168
+ * the projection generator consume. `authority` names the runtime entry that owns
169
+ * validity — and for the receipt, PASS — which the projections repeat in `$comment`.
170
+ */
171
+ export declare const PRE_EXECUTION_CONTRACT: Readonly<{
172
+ snapshot: PreExecutionContractSpec;
173
+ receipt: PreExecutionContractSpec;
174
+ }>;
175
+ export {};