@gtrabanco/agentic-workflow-schema 4.2.0 → 4.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.
package/README.md CHANGED
@@ -312,7 +312,7 @@ display the guarantees the schema cannot state.
312
312
  | `PRE_EXECUTION_CONTEXT_KINDS` | `roadmap-row` · `governing-issue` · `normalized-repository-state` · `architectural-invariants` · `dependency-unit` · `project-guide` — Authorities a reviewer was allowed to rely on. |
313
313
  | `PRE_EXECUTION_CONTEXT_PRESENCE` | `present` · `absent` — `absent` is a recorded fact, never a skipped field. |
314
314
  | `PRE_EXECUTION_VERDICTS` | `spec-review-pass` · `spec-review-fail` · `plan-review-pass` · `plan-review-fail` · `needs-design` — Each verdict names the stage it is legal on. |
315
- | `PRE_EXECUTION_FINDING_SEVERITIES` | `info` · `low` · `medium` · `high` · `critical` — `info` never blocks a PASS on its own merits. |
315
+ | `PRE_EXECUTION_FINDING_SEVERITIES` | `info` · `low` · `medium` · `high` · `critical` — material = `medium` and above; `low` is a persisted report-note and `info` is immaterial, so neither blocks a PASS on its own merits. |
316
316
  | `PRE_EXECUTION_FINDING_CLASSES` | `product` · `plan` · `source` · `environment` · `runtime` — Which contract layer the finding is about. |
317
317
  | `PRE_EXECUTION_FINDING_VERIFICATION` | `verified` · `unverified` — Only `verified` material findings can support a PASS. |
318
318
  | `PRE_EXECUTION_FINDING_RESOLUTIONS` | `open` · `resolved` · `dismissed` — `dismissed` requires recorded counter-evidence. |
@@ -377,7 +377,7 @@ validator to refuse an unordered snapshot.
377
377
  `verdict` ∈ `spec-review-pass | spec-review-fail | plan-review-pass |
378
378
  plan-review-fail | needs-design`, and the verdict must match the snapshot stage.
379
379
  A finding is `{ id, severity, class, claim, evidenceRefs, verification,
380
- resolution, resolutionEvidence }` with `severity` ∈ `info | low | medium | high
380
+ resolution, resolutionEvidence, reproducer? }` with `severity` ∈ `info | low | medium | high
381
381
  | critical`, `class` ∈ `product | plan | source | environment | runtime`,
382
382
  `verification` ∈ `verified | unverified`, and `resolution` ∈ `open | resolved |
383
383
  dismissed`. Every finding carries at least one evidence reference, and a
@@ -385,7 +385,8 @@ dismissal requires recorded counter-evidence.
385
385
 
386
386
  `validatePreExecutionReceiptAgainstSnapshot` is the only entry that can bless a
387
387
  PASS. It refuses a PASS while any material finding is open or unverified
388
- (`info`-severity findings never block on their own merits), while the receipt
388
+ (material = `medium` and above; `low`/`info` report-notes never block on their
389
+ own merits), while the receipt
389
390
  binds a different snapshot, while the policy version differs, when the claimed
390
391
  author exclusion is violated under `enforced`, or when the reviewer's own
391
392
  identity authored the artifact set (`invalid-author`). Parent receipts model a
@@ -417,7 +418,7 @@ other families):
417
418
  artifacts 32 · contexts 16 · findings 64 · evidencePerFinding 8
418
419
  parentReceipts 8 · receiptDiagnostics 8 · diagnostics 50
419
420
  unitIdChars 128 · revisionIdChars 128 · idChars 128 · identifierChars 160
420
- pathChars 1024 · claimChars 2048 · evidenceChars 1024
421
+ pathChars 1024 · claimChars 2048 · reproducerChars 1024 · evidenceChars 1024
421
422
  resolutionEvidenceChars 2048 · policyChars 64 · diagnosticChars 512
422
423
  artifactBytes 4194304 · snapshotBytes 32768 · receiptBytes 65536
423
424
  ```
@@ -462,10 +463,19 @@ const POLICY_VERSION = "2026-08-30";
462
463
 
463
464
  // The caller reads the documents: this package never touches Git or the filesystem.
464
465
  const spec = [
465
- "# Toy feature", "", "## Goal", "", "Ship one usable slice.", "",
466
- "## Branch", "", "`feat/toy`", "", "## Size", "", "`S`", "",
467
- "## Dependencies", "", "- none", "", "## Product half", "", "### Scope", "",
468
- "- **S1:** the slice.", "", "## Design status", "", "`designed`", "",
466
+ "# Toy feature", "", "## Objective", "", "Ship one usable slice.", "",
467
+ "## Why", "", "The customer needs it.", "",
468
+ "## User outcome", "", "Users can do X.", "",
469
+ "## Acceptance criteria", "", "- [x] S1 done.", "",
470
+ "## Non-goals", "", "- Not S2.", "",
471
+ "## Future cost", "", "None known.", "",
472
+ "## Applicable tests", "", "- Unit tests.", "",
473
+ "## Known pre-existing issues", "", "None.", "",
474
+ "## Tasks", "", "- [x] Implement S1.", "",
475
+ "## Evidence", "", "No external evidence.", "",
476
+ "## Progress log", "", "- P1 done.", "",
477
+ "## Next", "", "Ship it.", "",
478
+ "## References", "", "[Link](https://example.com)", "",
469
479
  ].join("\n");
470
480
 
471
481
  /** 1. Freeze the exact bytes a reviewer may rely on, at one causal revision. */
@@ -0,0 +1,30 @@
1
+ /**
2
+ * File-schema vocabularies for agwo edit typed file services.
3
+ *
4
+ * This is the canonical source for: evidence-table columns, roadmap table
5
+ * columns, changelog section header pattern, and operation name constants.
6
+ *
7
+ * The unit-doc section list (UNIT_DOC_REQUIRED_SECTIONS) is already owned
8
+ * by src/pre-execution.ts (feature 61 P8); this file re-exports it for
9
+ * agwo edit consumers via the index. The SDK module at
10
+ * `packages/agentic-workflow/src/edit/schema.mjs` duplicates with a
11
+ * pointing comment when the crate does not depend on the schema package.
12
+ *
13
+ * Consumers in `packages/agentic-workflow/src/edit/` import from here
14
+ * (or from the SDK's schema.mjs which mirrors these values).
15
+ */
16
+ /**
17
+ * @type {readonly ["AC", "What was run", "Exit / digest", "Output (≤2 lines)", "Verified-by"]}
18
+ */
19
+ export declare const EVIDENCE_COLUMNS: readonly ["AC", "What was run", "Exit / digest", "Output (≤2 lines)", "Verified-by"];
20
+ export declare const PROGRESS_ENTRY_PATTERN: RegExp;
21
+ /**
22
+ * @type {readonly ["NN", "slug", "status", "depends-on", "description"]}
23
+ */
24
+ export declare const ROADMAP_COLUMNS: readonly ["NN", "slug", "status", "depends-on", "description"];
25
+ export declare const CHANGELOG_SECTION_PATTERN: RegExp;
26
+ export declare const BUDGETS_OPERATIONS: readonly ["ceilingRebase"];
27
+ export declare const MANIFEST_OPERATIONS: readonly ["skillAdd", "skillRemove"];
28
+ export declare const UNIT_DOC_OPERATIONS: readonly ["create", "setSection", "evidence_addRow", "progress_logEntry", "validate"];
29
+ export declare const ROADMAP_OPERATIONS: readonly ["rowUpsert", "annotate"];
30
+ export declare const CHANGELOG_OPERATIONS: readonly ["rowAdd"];
@@ -0,0 +1,60 @@
1
+ /**
2
+ * File-schema vocabularies for agwo edit typed file services.
3
+ *
4
+ * This is the canonical source for: evidence-table columns, roadmap table
5
+ * columns, changelog section header pattern, and operation name constants.
6
+ *
7
+ * The unit-doc section list (UNIT_DOC_REQUIRED_SECTIONS) is already owned
8
+ * by src/pre-execution.ts (feature 61 P8); this file re-exports it for
9
+ * agwo edit consumers via the index. The SDK module at
10
+ * `packages/agentic-workflow/src/edit/schema.mjs` duplicates with a
11
+ * pointing comment when the crate does not depend on the schema package.
12
+ *
13
+ * Consumers in `packages/agentic-workflow/src/edit/` import from here
14
+ * (or from the SDK's schema.mjs which mirrors these values).
15
+ */
16
+ // NOTE: UNIT_DOC_REQUIRED_SECTIONS is owned by pre-execution.ts —
17
+ // re-exported here via index.ts for agwo edit consumers (feature 61 P8).
18
+ // This file does NOT redeclare it to avoid duplicate identifiers.
19
+ // ── Unit doc: evidence-table@1 columns ───────────────────────────────────
20
+ /**
21
+ * @type {readonly ["AC", "What was run", "Exit / digest", "Output (≤2 lines)", "Verified-by"]}
22
+ */
23
+ export const EVIDENCE_COLUMNS = [
24
+ "AC",
25
+ "What was run",
26
+ "Exit / digest",
27
+ "Output (≤2 lines)",
28
+ "Verified-by",
29
+ ];
30
+ // ── Unit doc: progress-log@1 entry regex ─────────────────────────────────
31
+ export const PROGRESS_ENTRY_PATTERN = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2} — .+ → .+ — next: .+$/;
32
+ // ── Roadmap table columns ────────────────────────────────────────────────
33
+ /**
34
+ * @type {readonly ["NN", "slug", "status", "depends-on", "description"]}
35
+ */
36
+ export const ROADMAP_COLUMNS = [
37
+ "NN",
38
+ "slug",
39
+ "status",
40
+ "depends-on",
41
+ "description",
42
+ ];
43
+ // ── Changelog section header pattern ─────────────────────────────────────
44
+ export const CHANGELOG_SECTION_PATTERN = /^#### `(.+)`$/;
45
+ // ── Budgets ceiling rebase operations ────────────────────────────────────
46
+ export const BUDGETS_OPERATIONS = ["ceilingRebase"];
47
+ // ── Manifest operations ──────────────────────────────────────────────────
48
+ export const MANIFEST_OPERATIONS = ["skillAdd", "skillRemove"];
49
+ // ── Unit doc operations ──────────────────────────────────────────────────
50
+ export const UNIT_DOC_OPERATIONS = [
51
+ "create",
52
+ "setSection",
53
+ "evidence_addRow",
54
+ "progress_logEntry",
55
+ "validate",
56
+ ];
57
+ // ── Roadmap operations ───────────────────────────────────────────────────
58
+ export const ROADMAP_OPERATIONS = ["rowUpsert", "annotate"];
59
+ // ── Changelog operations ─────────────────────────────────────────────────
60
+ export const CHANGELOG_OPERATIONS = ["rowAdd"];
package/dist/index.d.ts CHANGED
@@ -185,7 +185,7 @@ export declare const WORKFLOW_INTENTS: readonly WorkflowIntent[];
185
185
  export declare const WORKFLOW_DECISION_SENSE_CODES: readonly ["sense-initial", "sense-stale-revision", "sense-missing-evidence", "sense-unknown-state", "sense-unlisted-transition"];
186
186
  export type WorkflowDecisionSenseReason = (typeof WORKFLOW_DECISION_SENSE_CODES)[number];
187
187
  /** Stop reason codes: the transition is explicitly blocked or must terminate. */
188
- export declare const WORKFLOW_DECISION_STOP_CODES: readonly ["stop-blocked", "stop-needs-input", "stop-failed", "stop-contradiction", "stop-policy-denied", "stop-forbidden-transition"];
188
+ export declare const WORKFLOW_DECISION_STOP_CODES: readonly ["stop-blocked", "stop-needs-input", "stop-failed", "stop-contradiction", "stop-policy-denied", "stop-forbidden-transition", "stop-review-loop-cap"];
189
189
  export type WorkflowDecisionStopReason = (typeof WORKFLOW_DECISION_STOP_CODES)[number];
190
190
  /** Invoke reason codes: transition is proven and allowed. */
191
191
  export declare const WORKFLOW_DECISION_INVOKE_CODES: readonly ["invoke-proven-transition"];
@@ -208,6 +208,16 @@ export interface WorkflowDecisionInput {
208
208
  readonly lastOutcomeSourceRevision: string | null;
209
209
  /** Closed caller policy governing what transitions are permitted. */
210
210
  readonly policy: WorkflowDecisionPolicy;
211
+ /**
212
+ * Consecutive unconverged review→repair→re-review cycles per pre-execution
213
+ * stage, derived by the consumer from the unit's persisted stage receipts (the
214
+ * count of consecutive FAIL-verdict receipts since that stage's last PASS
215
+ * receipt; a stage with no receipt reads 0). Absent reads as zero.
216
+ */
217
+ readonly reviewLoopCycles?: {
218
+ readonly spec?: number;
219
+ readonly plan?: number;
220
+ };
211
221
  }
212
222
  /** Intent values that may be directly invoked (excludes non-invocation intents). */
213
223
  export type WorkflowInvocableIntent = Exclude<WorkflowIntent, "status" | "ask-human" | "stop" | "none">;
@@ -894,7 +904,7 @@ export declare const VERIFICATION_CANONICAL_VECTORS: ReadonlyArray<Readonly<Cano
894
904
  * package-internal, exactly as the verification family's does, and the generated
895
905
  * Draft-07 files are projections of it, not a second authority.
896
906
  */
897
- export { buildPreExecutionArtifactSnapshot, canonicalizePreExecutionArtifactSnapshot, canonicalizePreExecutionReviewReceipt, comparePreExecutionReceiptToSnapshot, digestPreExecutionArtifactSnapshot, digestPreExecutionReviewReceipt, selectSpecProduct, validatePreExecutionArtifactSnapshotV1, validatePreExecutionReceiptAgainstSnapshot, validatePreExecutionReviewReceiptV1, PRE_EXECUTION_ARTIFACT_KINDS, PRE_EXECUTION_AUTHOR_EXCLUSIONS, PRE_EXECUTION_CANONICAL_VECTORS, PRE_EXECUTION_CONTEXT_KINDS, PRE_EXECUTION_CONTEXT_PRESENCE, PRE_EXECUTION_DIAGNOSTIC_CODES, PRE_EXECUTION_FINDING_CLASSES, PRE_EXECUTION_FINDING_RESOLUTIONS, PRE_EXECUTION_FINDING_SEVERITIES, PRE_EXECUTION_FINDING_VERIFICATION, PRE_EXECUTION_FRESHNESS_CODES, PRE_EXECUTION_LIMITS, PRE_EXECUTION_MODEL_DIVERSITY, PRE_EXECUTION_PARENT_ROLES, PRE_EXECUTION_POLICY_VERSION, PRE_EXECUTION_RECEIPT_CONTRACT_ID, PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS, PRE_EXECUTION_REVIEW_ROLES, PRE_EXECUTION_RUNTIME_RULES, PRE_EXECUTION_SELECTORS, PRE_EXECUTION_SNAPSHOT_CONTRACT_ID, PRE_EXECUTION_SNAPSHOT_SELECTOR, PRE_EXECUTION_STAGES, PRE_EXECUTION_UNIT_KINDS, PRE_EXECUTION_VERDICTS, SPEC_PRODUCT_REQUIRED_HEADINGS, isImpossibleReceiptTimeline, } from "./pre-execution.js";
907
+ export { buildPreExecutionArtifactSnapshot, canonicalizePreExecutionArtifactSnapshot, canonicalizePreExecutionReviewReceipt, comparePreExecutionReceiptToSnapshot, digestPreExecutionArtifactSnapshot, digestPreExecutionReviewReceipt, selectSpecProduct, validatePreExecutionArtifactSnapshotV1, validatePreExecutionReceiptAgainstSnapshot, validatePreExecutionReviewReceiptV1, PRE_EXECUTION_ARTIFACT_KINDS, PRE_EXECUTION_AUTHOR_EXCLUSIONS, PRE_EXECUTION_CANONICAL_VECTORS, PRE_EXECUTION_CONTEXT_KINDS, PRE_EXECUTION_CONTEXT_PRESENCE, PRE_EXECUTION_DIAGNOSTIC_CODES, PRE_EXECUTION_FINDING_CLASSES, PRE_EXECUTION_FINDING_RESOLUTIONS, PRE_EXECUTION_FINDING_SEVERITIES, PRE_EXECUTION_FINDING_VERIFICATION, PRE_EXECUTION_FRESHNESS_CODES, PRE_EXECUTION_LIMITS, PRE_EXECUTION_MODEL_DIVERSITY, PRE_EXECUTION_PARENT_ROLES, PRE_EXECUTION_POLICY_VERSION, PRE_EXECUTION_RECEIPT_CONTRACT_ID, PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS, PRE_EXECUTION_REVIEW_ROLES, PRE_EXECUTION_RUNTIME_RULES, PRE_EXECUTION_SELECTORS, PRE_EXECUTION_SNAPSHOT_CONTRACT_ID, PRE_EXECUTION_SNAPSHOT_SELECTOR, PRE_EXECUTION_STAGES, PRE_EXECUTION_UNIT_KINDS, PRE_EXECUTION_VERDICTS, UNIT_DOC_REQUIRED_SECTIONS, isImpossibleReceiptTimeline, } from "./pre-execution.js";
898
908
  export { VERDICTS_BY_STAGE } from "./pre-execution-contract.js";
899
909
  export type { PreExecutionArtifactInput, PreExecutionArtifactKind, PreExecutionArtifactRow, PreExecutionArtifactSnapshotV1, PreExecutionAuthorExclusion, PreExecutionCanonicalVector, PreExecutionContextBinding, PreExecutionContextInput, PreExecutionContextKind, PreExecutionContextPresence, PreExecutionDiagnostic, PreExecutionDiagnosticCode, PreExecutionFinding, PreExecutionFindingClass, PreExecutionFindingResolution, PreExecutionFindingSeverity, PreExecutionFindingVerification, PreExecutionFreshnessCode, PreExecutionFreshnessResult, PreExecutionModelDiversity, PreExecutionParentReceipt, PreExecutionParentRole, PreExecutionReceiptValidationResult, PreExecutionReviewReceiptV1, PreExecutionReviewerRole, PreExecutionSelector, PreExecutionSnapshotBuildInput, PreExecutionSnapshotValidationResult, PreExecutionStage, PreExecutionUnitKind, PreExecutionVerdict, SpecProductSelection, SpecProductSelectorError, } from "./pre-execution.js";
900
910
  /**
@@ -908,3 +918,4 @@ export { CONTINUATION_CANONICAL_VECTORS, CONTINUATION_VECTOR_CONTRACT } from "./
908
918
  export { sha256Hex, sha256HexSync } from "./sha256.js";
909
919
  export type { ContinuationEvidence, ContinuationPlatformFamily, ContinuationPrecondition, ContinuationRefusalCode, EmitContinuationInput, EmitContinuationResult, EnvelopeContinuation, } from "./continuation.js";
910
920
  export type { ContinuationCanonicalVector } from "./continuation-vectors.js";
921
+ export { EVIDENCE_COLUMNS, PROGRESS_ENTRY_PATTERN, ROADMAP_COLUMNS, CHANGELOG_SECTION_PATTERN, BUDGETS_OPERATIONS, MANIFEST_OPERATIONS, UNIT_DOC_OPERATIONS, ROADMAP_OPERATIONS, CHANGELOG_OPERATIONS, } from "./file-schemas.js";
package/dist/index.js CHANGED
@@ -499,6 +499,7 @@ export const WORKFLOW_DECISION_STOP_CODES = Object.freeze([
499
499
  "stop-contradiction",
500
500
  "stop-policy-denied",
501
501
  "stop-forbidden-transition",
502
+ "stop-review-loop-cap",
502
503
  ]);
503
504
  /** Invoke reason codes: transition is proven and allowed. */
504
505
  export const WORKFLOW_DECISION_INVOKE_CODES = Object.freeze([
@@ -849,6 +850,22 @@ export function decideWorkflowAction(input) {
849
850
  const proposal = input.lastOutcome.next.intent;
850
851
  const targets = input.lastOutcome.next.targets || [];
851
852
  const lastSkill = input.lastOutcome.skill;
853
+ // Derived review-loop cap (feature 31): a third consecutive unconverged review
854
+ // invocation stops and asks the human. The count is consumer-derived from the
855
+ // persisted receipts (never written here); a PASS reset leaves it below 2, so
856
+ // the next cycle is allowed. Checked before the transition-table match.
857
+ if ((proposal === "review-spec" || proposal === "review-plan") && input.reviewLoopCycles) {
858
+ const stage = proposal === "review-spec" ? "spec" : "plan";
859
+ const cycles = input.reviewLoopCycles[stage];
860
+ if (typeof cycles === "number" && cycles >= 2) {
861
+ return {
862
+ kind: "stop", intent: "ask-human", targets,
863
+ reasonCode: "stop-review-loop-cap",
864
+ evidenceRefs: [],
865
+ detail: `${proposal} refused: ${cycles} consecutive unconverged ${stage} cycle(s) (cap 2) · route to design-feature`,
866
+ };
867
+ }
868
+ }
852
869
  const entry = WORKFLOW_TRANSITION_TABLE.find((r) => r.key === lastSkill);
853
870
  if (entry === undefined) {
854
871
  return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-unlisted-transition", evidenceRefs: [], detail: `unlisted transition: ${lastSkill}` };
@@ -2883,7 +2900,7 @@ export const VERIFICATION_CANONICAL_VECTORS = Object.freeze([
2883
2900
  * package-internal, exactly as the verification family's does, and the generated
2884
2901
  * Draft-07 files are projections of it, not a second authority.
2885
2902
  */
2886
- export { buildPreExecutionArtifactSnapshot, canonicalizePreExecutionArtifactSnapshot, canonicalizePreExecutionReviewReceipt, comparePreExecutionReceiptToSnapshot, digestPreExecutionArtifactSnapshot, digestPreExecutionReviewReceipt, selectSpecProduct, validatePreExecutionArtifactSnapshotV1, validatePreExecutionReceiptAgainstSnapshot, validatePreExecutionReviewReceiptV1, PRE_EXECUTION_ARTIFACT_KINDS, PRE_EXECUTION_AUTHOR_EXCLUSIONS, PRE_EXECUTION_CANONICAL_VECTORS, PRE_EXECUTION_CONTEXT_KINDS, PRE_EXECUTION_CONTEXT_PRESENCE, PRE_EXECUTION_DIAGNOSTIC_CODES, PRE_EXECUTION_FINDING_CLASSES, PRE_EXECUTION_FINDING_RESOLUTIONS, PRE_EXECUTION_FINDING_SEVERITIES, PRE_EXECUTION_FINDING_VERIFICATION, PRE_EXECUTION_FRESHNESS_CODES, PRE_EXECUTION_LIMITS, PRE_EXECUTION_MODEL_DIVERSITY, PRE_EXECUTION_PARENT_ROLES, PRE_EXECUTION_POLICY_VERSION, PRE_EXECUTION_RECEIPT_CONTRACT_ID, PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS, PRE_EXECUTION_REVIEW_ROLES, PRE_EXECUTION_RUNTIME_RULES, PRE_EXECUTION_SELECTORS, PRE_EXECUTION_SNAPSHOT_CONTRACT_ID, PRE_EXECUTION_SNAPSHOT_SELECTOR, PRE_EXECUTION_STAGES, PRE_EXECUTION_UNIT_KINDS, PRE_EXECUTION_VERDICTS, SPEC_PRODUCT_REQUIRED_HEADINGS, isImpossibleReceiptTimeline, } from "./pre-execution.js";
2903
+ export { buildPreExecutionArtifactSnapshot, canonicalizePreExecutionArtifactSnapshot, canonicalizePreExecutionReviewReceipt, comparePreExecutionReceiptToSnapshot, digestPreExecutionArtifactSnapshot, digestPreExecutionReviewReceipt, selectSpecProduct, validatePreExecutionArtifactSnapshotV1, validatePreExecutionReceiptAgainstSnapshot, validatePreExecutionReviewReceiptV1, PRE_EXECUTION_ARTIFACT_KINDS, PRE_EXECUTION_AUTHOR_EXCLUSIONS, PRE_EXECUTION_CANONICAL_VECTORS, PRE_EXECUTION_CONTEXT_KINDS, PRE_EXECUTION_CONTEXT_PRESENCE, PRE_EXECUTION_DIAGNOSTIC_CODES, PRE_EXECUTION_FINDING_CLASSES, PRE_EXECUTION_FINDING_RESOLUTIONS, PRE_EXECUTION_FINDING_SEVERITIES, PRE_EXECUTION_FINDING_VERIFICATION, PRE_EXECUTION_FRESHNESS_CODES, PRE_EXECUTION_LIMITS, PRE_EXECUTION_MODEL_DIVERSITY, PRE_EXECUTION_PARENT_ROLES, PRE_EXECUTION_POLICY_VERSION, PRE_EXECUTION_RECEIPT_CONTRACT_ID, PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS, PRE_EXECUTION_REVIEW_ROLES, PRE_EXECUTION_RUNTIME_RULES, PRE_EXECUTION_SELECTORS, PRE_EXECUTION_SNAPSHOT_CONTRACT_ID, PRE_EXECUTION_SNAPSHOT_SELECTOR, PRE_EXECUTION_STAGES, PRE_EXECUTION_UNIT_KINDS, PRE_EXECUTION_VERDICTS, UNIT_DOC_REQUIRED_SECTIONS, isImpossibleReceiptTimeline, } from "./pre-execution.js";
2887
2904
  export { VERDICTS_BY_STAGE } from "./pre-execution-contract.js";
2888
2905
  // ---------------------------------------------------------------------------
2889
2906
  // next.continuation — the executable hand-off object (feature 59)
@@ -2897,3 +2914,6 @@ export { CONTINUATION_CONTRACT_ID, CONTINUATION_PLATFORM_FAMILIES, CONTINUATION_
2897
2914
  export { CONTINUATION_CANONICAL_VECTORS, CONTINUATION_VECTOR_CONTRACT } from "./continuation-vectors.js";
2898
2915
  /** The digest surface the evidence token is bound through (feature 59, D-59-9). */
2899
2916
  export { sha256Hex, sha256HexSync } from "./sha256.js";
2917
+ // ── File-schema vocabularies (agwo edit) ──────────────────────────────────
2918
+ // UNIT_DOC_REQUIRED_SECTIONS is already exported from pre-execution.ts (P8).
2919
+ export { EVIDENCE_COLUMNS, PROGRESS_ENTRY_PATTERN, ROADMAP_COLUMNS, CHANGELOG_SECTION_PATTERN, BUDGETS_OPERATIONS, MANIFEST_OPERATIONS, UNIT_DOC_OPERATIONS, ROADMAP_OPERATIONS, CHANGELOG_OPERATIONS, } from "./file-schemas.js";
@@ -53,7 +53,13 @@ export declare const PRE_EXECUTION_CONTEXT_KINDS: readonly ["roadmap-row", "gove
53
53
  export declare const PRE_EXECUTION_CONTEXT_PRESENCE: readonly ["present", "absent"];
54
54
  /** The five public review verdicts. There is no generic "approve" verb. */
55
55
  export declare const PRE_EXECUTION_VERDICTS: readonly ["spec-review-pass", "spec-review-fail", "plan-review-pass", "plan-review-fail", "needs-design"];
56
- /** Severities mirror the candidate-review ladder; `info` is the only immaterial one. */
56
+ /**
57
+ * Severities mirror the candidate-review ladder on the planning materiality
58
+ * line: material = `medium` and above, so a PASS may coexist with an
59
+ * open/unverified `low` row and is refused while any open/unverified `medium`+
60
+ * row exists. `low` is a persisted report-note the stage author resolves
61
+ * without a re-review; `info` is immaterial.
62
+ */
57
63
  export declare const PRE_EXECUTION_FINDING_SEVERITIES: readonly ["info", "low", "medium", "high", "critical"];
58
64
  /** The five root-cause owners a finding can be routed to (SPEC Design §4). */
59
65
  export declare const PRE_EXECUTION_FINDING_CLASSES: readonly ["product", "plan", "source", "environment", "runtime"];
@@ -92,6 +98,7 @@ export declare const PRE_EXECUTION_LIMITS: Readonly<{
92
98
  readonly pathChars: 1024;
93
99
  readonly identifierChars: 160;
94
100
  readonly claimChars: 2048;
101
+ readonly reproducerChars: 1024;
95
102
  readonly evidenceChars: 1024;
96
103
  readonly resolutionEvidenceChars: 2048;
97
104
  readonly policyChars: 64;
@@ -78,7 +78,13 @@ export const PRE_EXECUTION_VERDICTS = Object.freeze([
78
78
  "plan-review-fail",
79
79
  "needs-design",
80
80
  ]);
81
- /** Severities mirror the candidate-review ladder; `info` is the only immaterial one. */
81
+ /**
82
+ * Severities mirror the candidate-review ladder on the planning materiality
83
+ * line: material = `medium` and above, so a PASS may coexist with an
84
+ * open/unverified `low` row and is refused while any open/unverified `medium`+
85
+ * row exists. `low` is a persisted report-note the stage author resolves
86
+ * without a re-review; `info` is immaterial.
87
+ */
82
88
  export const PRE_EXECUTION_FINDING_SEVERITIES = Object.freeze([
83
89
  "info", "low", "medium", "high", "critical",
84
90
  ]);
@@ -131,6 +137,7 @@ export const PRE_EXECUTION_LIMITS = Object.freeze({
131
137
  pathChars: 1024,
132
138
  identifierChars: 160,
133
139
  claimChars: 2048,
140
+ reproducerChars: 1024,
134
141
  evidenceChars: 1024,
135
142
  resolutionEvidenceChars: 2048,
136
143
  policyChars: 64,
@@ -417,7 +424,7 @@ const FINDING_SPEC = {
417
424
  description: "One structured review finding.",
418
425
  fields: [
419
426
  opaqueId("id", "Stable finding identity, unique inside the receipt."),
420
- { key: "severity", type: "enum", enum: PRE_EXECUTION_FINDING_SEVERITIES, description: "Severity ladder shared with candidate review; `info` is the only immaterial row." },
427
+ { key: "severity", type: "enum", enum: PRE_EXECUTION_FINDING_SEVERITIES, description: "Severity ladder shared with candidate review on the planning materiality line: material = `medium` and above, `low` is a persisted report-note, `info` immaterial." },
421
428
  { key: "class", type: "enum", enum: PRE_EXECUTION_FINDING_CLASSES, description: "Root-cause owner the finding routes to." },
422
429
  {
423
430
  key: "claim",
@@ -447,6 +454,15 @@ const FINDING_SPEC = {
447
454
  nulFree: true,
448
455
  description: "Counter-evidence or repair pointer. Required to dismiss or resolve a finding.",
449
456
  },
457
+ {
458
+ key: "reproducer",
459
+ type: "string",
460
+ minLength: 1,
461
+ maxLength: PRE_EXECUTION_LIMITS.reproducerChars,
462
+ nulFree: true,
463
+ optional: true,
464
+ description: `Concrete reproduction for the finding; at most ${PRE_EXECUTION_LIMITS.reproducerChars} characters. Optional, so a receipt whose findings carry none stays valid.`,
465
+ },
450
466
  ],
451
467
  rules: [
452
468
  {
@@ -89,8 +89,11 @@ export declare function isImpossibleReceiptTimeline({ finishedAt, sourceCommitDa
89
89
  sourceCommitDate: unknown;
90
90
  skewMs?: unknown;
91
91
  }): boolean | null;
92
- /** The Product-half headings the selector binds, in required order. */
93
- export declare const SPEC_PRODUCT_REQUIRED_HEADINGS: readonly ["Goal", "Branch", "Size", "Dependencies", "Product half", "Design status"];
92
+ /** The unit document's closed 13-section list (feature 61 P8). The two-half
93
+ * SPEC was retired: plan-feature, plan-fix, review-spec, review-plan, and
94
+ * design-feature are absorbed into the lane. The lane uses a single unit
95
+ * document with these sections; the selector reads them in order. */
96
+ export declare const UNIT_DOC_REQUIRED_SECTIONS: readonly ["Objective", "Why", "User outcome", "Acceptance criteria", "Non-goals", "Future cost", "Applicable tests", "Known pre-existing issues", "Tasks", "Evidence", "Progress log", "Next", "References"];
94
97
  /** One artifact bound into a snapshot, by the exact bytes the reviewer read. */
95
98
  export interface PreExecutionArtifactRow {
96
99
  readonly kind: PreExecutionArtifactKind;
@@ -128,6 +131,8 @@ export interface PreExecutionFinding {
128
131
  readonly verification: PreExecutionFindingVerification;
129
132
  readonly resolution: PreExecutionFindingResolution;
130
133
  readonly resolutionEvidence: string | null;
134
+ /** Optional concrete reproduction; absent means the producer recorded none. */
135
+ readonly reproducer?: string;
131
136
  }
132
137
  /** One optional parent receipt: topology, never a vote. */
133
138
  export interface PreExecutionParentReceipt {
@@ -196,7 +201,7 @@ export type SpecProductSelection = {
196
201
  *
197
202
  * The selection is byte-exact and total: the level-1 title and the required
198
203
  * level-2 sections (Goal, Branch, Size, Dependencies, Product half, Design
199
- * status), ending at the first boundary heading after Design status, with trailing
204
+ * status), ending at the first boundary heading after References, with trailing
200
205
  * blank lines removed and exactly one final newline. Everything the selector does
201
206
  * NOT take — Amendments, the Engineering half, later appendices — stays outside
202
207
  * Product authority, so a Plan-phase write can never rotate a Product digest and
@@ -344,7 +349,8 @@ export declare function validatePreExecutionReviewReceiptV1(value: unknown): Pre
344
349
  * 3. `contextClean` is mandatory for a PASS and never for a FAIL: a contaminated
345
350
  * reviewer may still report what it found;
346
351
  * 4. a PASS may not carry a material finding that is still open or unverified
347
- * (`verdict-mismatch`) — `info` severity is the only immaterial row.
352
+ * (`verdict-mismatch`) — material is `medium` and above, so a PASS may
353
+ * coexist with an open/unverified `low` or `info` report-note.
348
354
  *
349
355
  * The parent-topology rule (parents require a critic/synthesizer/arbiter role,
350
356
  * `invalid-topology`) is part of the canonical definition itself — the shared
@@ -109,14 +109,24 @@ function parseStamp(value) {
109
109
  const ms = Date.parse(value.trim());
110
110
  return Number.isNaN(ms) ? null : ms;
111
111
  }
112
- /** The Product-half headings the selector binds, in required order. */
113
- export const SPEC_PRODUCT_REQUIRED_HEADINGS = Object.freeze([
114
- "Goal",
115
- "Branch",
116
- "Size",
117
- "Dependencies",
118
- "Product half",
119
- "Design status",
112
+ /** The unit document's closed 13-section list (feature 61 P8). The two-half
113
+ * SPEC was retired: plan-feature, plan-fix, review-spec, review-plan, and
114
+ * design-feature are absorbed into the lane. The lane uses a single unit
115
+ * document with these sections; the selector reads them in order. */
116
+ export const UNIT_DOC_REQUIRED_SECTIONS = Object.freeze([
117
+ "Objective",
118
+ "Why",
119
+ "User outcome",
120
+ "Acceptance criteria",
121
+ "Non-goals",
122
+ "Future cost",
123
+ "Applicable tests",
124
+ "Known pre-existing issues",
125
+ "Tasks",
126
+ "Evidence",
127
+ "Progress log",
128
+ "Next",
129
+ "References",
120
130
  ]);
121
131
  // ---------------------------------------------------------------------------
122
132
  // Shared plumbing: one sink, one capture, one structural engine
@@ -230,7 +240,7 @@ function selectionError(code, heading) {
230
240
  *
231
241
  * The selection is byte-exact and total: the level-1 title and the required
232
242
  * level-2 sections (Goal, Branch, Size, Dependencies, Product half, Design
233
- * status), ending at the first boundary heading after Design status, with trailing
243
+ * status), ending at the first boundary heading after References, with trailing
234
244
  * blank lines removed and exactly one final newline. Everything the selector does
235
245
  * NOT take — Amendments, the Engineering half, later appendices — stays outside
236
246
  * Product authority, so a Plan-phase write can never rotate a Product digest and
@@ -280,14 +290,14 @@ export function selectSpecProduct(text) {
280
290
  }
281
291
  if (titleLine === -1)
282
292
  return selectionError("selector-title-missing", "<title>");
283
- for (const required of SPEC_PRODUCT_REQUIRED_HEADINGS) {
293
+ for (const required of UNIT_DOC_REQUIRED_SECTIONS) {
284
294
  if (!headings.some((heading) => heading.name === required)) {
285
295
  return selectionError("selector-heading-missing", required);
286
296
  }
287
297
  }
288
298
  const seen = new Set();
289
299
  for (const heading of headings) {
290
- if (!SPEC_PRODUCT_REQUIRED_HEADINGS.includes(heading.name))
300
+ if (!UNIT_DOC_REQUIRED_SECTIONS.includes(heading.name))
291
301
  continue;
292
302
  if (seen.has(heading.name))
293
303
  return selectionError("selector-heading-duplicate", heading.name);
@@ -295,7 +305,7 @@ export function selectSpecProduct(text) {
295
305
  }
296
306
  let highest = -1;
297
307
  for (const heading of headings) {
298
- const index = SPEC_PRODUCT_REQUIRED_HEADINGS.indexOf(heading.name);
308
+ const index = UNIT_DOC_REQUIRED_SECTIONS.indexOf(heading.name);
299
309
  if (index === -1)
300
310
  continue;
301
311
  if (index < highest)
@@ -306,7 +316,7 @@ export function selectSpecProduct(text) {
306
316
  // Design-status section opens — never inside a fence.
307
317
  let designLine = -1;
308
318
  for (const heading of headings)
309
- if (heading.name === "Design status")
319
+ if (heading.name === "References")
310
320
  designLine = heading.line;
311
321
  let end = lines.length;
312
322
  openFence = null;
@@ -667,6 +677,12 @@ export function validatePreExecutionReviewReceiptV1(value) {
667
677
  return refused(collector);
668
678
  return accepted("receipt", document);
669
679
  }
680
+ /**
681
+ * The material line (E-D31-8): `medium` and above block a PASS; `low` and
682
+ * `info` are report-notes. One closed set, so a future severity cannot become
683
+ * material through a negated comparison.
684
+ */
685
+ const MATERIAL_FINDING_SEVERITIES = new Set(["medium", "high", "critical"]);
670
686
  /**
671
687
  * The ONLY authority that blesses a pre-execution verdict (feature 28 AC1/AC2).
672
688
  *
@@ -683,7 +699,8 @@ export function validatePreExecutionReviewReceiptV1(value) {
683
699
  * 3. `contextClean` is mandatory for a PASS and never for a FAIL: a contaminated
684
700
  * reviewer may still report what it found;
685
701
  * 4. a PASS may not carry a material finding that is still open or unverified
686
- * (`verdict-mismatch`) — `info` severity is the only immaterial row.
702
+ * (`verdict-mismatch`) — material is `medium` and above, so a PASS may
703
+ * coexist with an open/unverified `low` or `info` report-note.
687
704
  *
688
705
  * The parent-topology rule (parents require a critic/synthesizer/arbiter role,
689
706
  * `invalid-topology`) is part of the canonical definition itself — the shared
@@ -736,7 +753,7 @@ export function validatePreExecutionReceiptAgainstSnapshot(receipt, snapshot, po
736
753
  if (isPassVerdict(bound.verdict)) {
737
754
  for (let i = 0; i < bound.findings.length; i++) {
738
755
  const finding = bound.findings[i];
739
- const material = finding.severity !== "info";
756
+ const material = MATERIAL_FINDING_SEVERITIES.has(finding.severity);
740
757
  if (material && (finding.resolution === "open" || finding.verification === "unverified")) {
741
758
  collector.add("verdict-mismatch", `/findings/${i}`);
742
759
  }
@@ -35,6 +35,12 @@ export interface VerificationFieldSpec {
35
35
  readonly maxLength?: number;
36
36
  /** Reject values containing NUL. */
37
37
  readonly nulFree?: boolean;
38
+ /**
39
+ * The key is declared but not required: an object omitting it stays valid.
40
+ * Default `false` — every field is required unless it opts out. Projected as
41
+ * "present in `properties`, absent from `required`".
42
+ */
43
+ readonly optional?: boolean;
38
44
  /** Single pattern a valid string must match (digest/timestamp shapes). */
39
45
  readonly pattern?: string;
40
46
  readonly minimum?: number;
@@ -872,7 +872,8 @@ function validateStructureFields(contract, spec, value, path, sink) {
872
872
  for (const field of spec.fields) {
873
873
  const fieldPath = at(field.key);
874
874
  if (!Object.prototype.hasOwnProperty.call(value, field.key)) {
875
- sink.push("missing-field", fieldPath);
875
+ if (field.optional !== true)
876
+ sink.push("missing-field", fieldPath);
876
877
  continue;
877
878
  }
878
879
  const raw = value[field.key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/agentic-workflow-schema",
3
- "version": "4.2.0",
3
+ "version": "4.5.0",
4
4
  "description": "Versioned machine contracts, JSON Schemas, parsers, and deterministic document snapshots for agentic-workflow orchestration.",
5
5
  "keywords": [
6
6
  "agentic-workflow",
@@ -11,7 +11,7 @@
11
11
  "envelope"
12
12
  ],
13
13
  "license": "MIT",
14
- "author": "Gabriel Trabanco <gtrabanco@users.noreply.github.com>",
14
+ "author": "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/gtrabanco/agentic-workflow.git",
@@ -333,7 +333,7 @@
333
333
  "high",
334
334
  "critical"
335
335
  ],
336
- "description": "Severity ladder shared with candidate review; `info` is the only immaterial row."
336
+ "description": "Severity ladder shared with candidate review on the planning materiality line: material = `medium` and above, `low` is a persisted report-note, `info` immaterial."
337
337
  },
338
338
  "class": {
339
339
  "type": "string",
@@ -393,6 +393,13 @@
393
393
  }
394
394
  ],
395
395
  "description": "Counter-evidence or repair pointer. Required to dismiss or resolve a finding."
396
+ },
397
+ "reproducer": {
398
+ "type": "string",
399
+ "minLength": 1,
400
+ "maxLength": 1024,
401
+ "pattern": "^[^\\0]*$",
402
+ "description": "Concrete reproduction for the finding; at most 1024 characters. Optional, so a receipt whose findings carry none stays valid."
396
403
  }
397
404
  },
398
405
  "allOf": [