@gtrabanco/agentic-workflow-schema 4.7.0 → 4.8.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/dist/index.d.ts CHANGED
@@ -904,7 +904,8 @@ export declare const VERIFICATION_CANONICAL_VECTORS: ReadonlyArray<Readonly<Cano
904
904
  * package-internal, exactly as the verification family's does, and the generated
905
905
  * Draft-07 files are projections of it, not a second authority.
906
906
  */
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";
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, UNIT_DOC_SECTION_SHAPES, UNIT_DOC_SPEC_REF_SECTIONS, isImpossibleReceiptTimeline, resolveUnitDocShape, unitDocSectionsFor, } from "./pre-execution.js";
908
+ export type { UnitDocShape } from "./pre-execution.js";
908
909
  export { VERDICTS_BY_STAGE } from "./pre-execution-contract.js";
909
910
  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";
910
911
  /**
package/dist/index.js CHANGED
@@ -2900,7 +2900,7 @@ export const VERIFICATION_CANONICAL_VECTORS = Object.freeze([
2900
2900
  * package-internal, exactly as the verification family's does, and the generated
2901
2901
  * Draft-07 files are projections of it, not a second authority.
2902
2902
  */
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";
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, UNIT_DOC_SECTION_SHAPES, UNIT_DOC_SPEC_REF_SECTIONS, isImpossibleReceiptTimeline, resolveUnitDocShape, unitDocSectionsFor, } from "./pre-execution.js";
2904
2904
  export { VERDICTS_BY_STAGE } from "./pre-execution-contract.js";
2905
2905
  // ---------------------------------------------------------------------------
2906
2906
  // next.continuation — the executable hand-off object (feature 59)
@@ -99,6 +99,29 @@ surface (both templates, `template/AGENTS.md`, `MIGRATION.md`, `LANE_FLOW.md`,
99
99
  looser than the product. Its *content* is checked by
100
100
  `scripts/promise-coherence.mjs`, not here: this list enforces shape only. */
101
101
  export declare const UNIT_DOC_REQUIRED_SECTIONS: readonly ["Objective", "Why", "User outcome", "Acceptance criteria", "Impact", "Non-goals", "Future cost", "Applicable tests", "Known pre-existing issues", "Tasks", "Evidence", "Progress log", "Next", "References"];
102
+ /**
103
+ * The re-cut (`spec-by-reference`, issue #308) required-section list: the shape a
104
+ * migrated unit doc carries. `## Specs` numbers the owner's requirements
105
+ * verbatim and `## Log` appends every request, correction, evidence run, gate
106
+ * run and folded finding; `## Findings` carries the OPEN rows that used to live
107
+ * in `review-findings.md`. Everything else is shared with the legacy list: the
108
+ * re-cut adds three headings (`Specs`, `Findings`, `Log`) and drops the six they
109
+ * replace — `Objective`, `Why`, `User outcome` and `Acceptance criteria` into
110
+ * `Specs`, `Evidence` and `Progress log` into `Findings` and `Log`.
111
+ */
112
+ export declare const UNIT_DOC_SPEC_REF_SECTIONS: readonly ["Specs", "Impact", "Non-goals", "Future cost", "Applicable tests", "Known pre-existing issues", "Tasks", "Findings", "Log", "Next", "References"];
113
+ /**
114
+ * The accepted shapes, keyed by the name the readers report. Migration is
115
+ * additive (issue #308 §Scope 4): a closed unit keeps `legacy` and is never
116
+ * rewritten, an open unit picks up `spec-by-reference` at its next touch, and
117
+ * both resolve through the same selector — one shape table, never two lists a
118
+ * reader has to choose between by guesswork.
119
+ */
120
+ export declare const UNIT_DOC_SECTION_SHAPES: Readonly<{
121
+ readonly legacy: readonly ["Objective", "Why", "User outcome", "Acceptance criteria", "Impact", "Non-goals", "Future cost", "Applicable tests", "Known pre-existing issues", "Tasks", "Evidence", "Progress log", "Next", "References"];
122
+ readonly "spec-by-reference": readonly ["Specs", "Impact", "Non-goals", "Future cost", "Applicable tests", "Known pre-existing issues", "Tasks", "Findings", "Log", "Next", "References"];
123
+ }>;
124
+ export type UnitDocShape = keyof typeof UNIT_DOC_SECTION_SHAPES;
102
125
  /** One artifact bound into a snapshot, by the exact bytes the reviewer read. */
103
126
  export interface PreExecutionArtifactRow {
104
127
  readonly kind: PreExecutionArtifactKind;
@@ -201,6 +224,16 @@ export type SpecProductSelection = {
201
224
  readonly ok: false;
202
225
  readonly errors: readonly SpecProductSelectorError[];
203
226
  };
227
+ /**
228
+ * Resolve which accepted shape a set of level-2 headings belongs to: the shape
229
+ * whose required sections are all present, preferring `legacy` when both are (a
230
+ * doc that carries both `Evidence` and `Log` is a half-migrated doc — the caller
231
+ * reports the excess, this function never guesses). Returns `null` when neither
232
+ * shape is satisfied, which is the missing-heading case the selector reports.
233
+ */
234
+ export declare function resolveUnitDocShape(headings: readonly string[]): UnitDocShape | null;
235
+ /** The section list of the shape a document asserts, or the legacy list absent one. */
236
+ export declare function unitDocSectionsFor(shape: UnitDocShape | null): readonly string[];
204
237
  /**
205
238
  * Cut the Product projection out of a SPEC document.
206
239
  *
@@ -134,6 +134,40 @@ export const UNIT_DOC_REQUIRED_SECTIONS = Object.freeze([
134
134
  "Next",
135
135
  "References",
136
136
  ]);
137
+ /**
138
+ * The re-cut (`spec-by-reference`, issue #308) required-section list: the shape a
139
+ * migrated unit doc carries. `## Specs` numbers the owner's requirements
140
+ * verbatim and `## Log` appends every request, correction, evidence run, gate
141
+ * run and folded finding; `## Findings` carries the OPEN rows that used to live
142
+ * in `review-findings.md`. Everything else is shared with the legacy list: the
143
+ * re-cut adds three headings (`Specs`, `Findings`, `Log`) and drops the six they
144
+ * replace — `Objective`, `Why`, `User outcome` and `Acceptance criteria` into
145
+ * `Specs`, `Evidence` and `Progress log` into `Findings` and `Log`.
146
+ */
147
+ export const UNIT_DOC_SPEC_REF_SECTIONS = Object.freeze([
148
+ "Specs",
149
+ "Impact",
150
+ "Non-goals",
151
+ "Future cost",
152
+ "Applicable tests",
153
+ "Known pre-existing issues",
154
+ "Tasks",
155
+ "Findings",
156
+ "Log",
157
+ "Next",
158
+ "References",
159
+ ]);
160
+ /**
161
+ * The accepted shapes, keyed by the name the readers report. Migration is
162
+ * additive (issue #308 §Scope 4): a closed unit keeps `legacy` and is never
163
+ * rewritten, an open unit picks up `spec-by-reference` at its next touch, and
164
+ * both resolve through the same selector — one shape table, never two lists a
165
+ * reader has to choose between by guesswork.
166
+ */
167
+ export const UNIT_DOC_SECTION_SHAPES = Object.freeze({
168
+ legacy: UNIT_DOC_REQUIRED_SECTIONS,
169
+ "spec-by-reference": UNIT_DOC_SPEC_REF_SECTIONS,
170
+ });
137
171
  // ---------------------------------------------------------------------------
138
172
  // Shared plumbing: one sink, one capture, one structural engine
139
173
  // ---------------------------------------------------------------------------
@@ -241,6 +275,24 @@ function advanceFence(run, open) {
241
275
  function selectionError(code, heading) {
242
276
  return { ok: false, errors: Object.freeze([Object.freeze({ code, heading })]) };
243
277
  }
278
+ /**
279
+ * Resolve which accepted shape a set of level-2 headings belongs to: the shape
280
+ * whose required sections are all present, preferring `legacy` when both are (a
281
+ * doc that carries both `Evidence` and `Log` is a half-migrated doc — the caller
282
+ * reports the excess, this function never guesses). Returns `null` when neither
283
+ * shape is satisfied, which is the missing-heading case the selector reports.
284
+ */
285
+ export function resolveUnitDocShape(headings) {
286
+ for (const [name, sections] of Object.entries(UNIT_DOC_SECTION_SHAPES)) {
287
+ if (sections.every((section) => headings.includes(section)))
288
+ return name;
289
+ }
290
+ return null;
291
+ }
292
+ /** The section list of the shape a document asserts, or the legacy list absent one. */
293
+ export function unitDocSectionsFor(shape) {
294
+ return shape === null ? UNIT_DOC_REQUIRED_SECTIONS : UNIT_DOC_SECTION_SHAPES[shape];
295
+ }
244
296
  /**
245
297
  * Cut the Product projection out of a SPEC document.
246
298
  *
@@ -297,14 +349,21 @@ export function selectSpecProduct(text) {
297
349
  }
298
350
  if (titleLine === -1)
299
351
  return selectionError("selector-title-missing", "<title>");
300
- for (const required of UNIT_DOC_REQUIRED_SECTIONS) {
352
+ // One contract, two accepted shapes (#308). The required list is resolved from
353
+ // the headings the document actually carries; a document satisfying neither
354
+ // shape reports the first missing section of the legacy list, which is the
355
+ // shape every unit predating the re-cut carries.
356
+ const names = headings.map((heading) => heading.name);
357
+ const shape = resolveUnitDocShape(names);
358
+ const requiredSections = unitDocSectionsFor(shape);
359
+ for (const required of requiredSections) {
301
360
  if (!headings.some((heading) => heading.name === required)) {
302
361
  return selectionError("selector-heading-missing", required);
303
362
  }
304
363
  }
305
364
  const seen = new Set();
306
365
  for (const heading of headings) {
307
- if (!UNIT_DOC_REQUIRED_SECTIONS.includes(heading.name))
366
+ if (!requiredSections.includes(heading.name))
308
367
  continue;
309
368
  if (seen.has(heading.name))
310
369
  return selectionError("selector-heading-duplicate", heading.name);
@@ -312,7 +371,7 @@ export function selectSpecProduct(text) {
312
371
  }
313
372
  let highest = -1;
314
373
  for (const heading of headings) {
315
- const index = UNIT_DOC_REQUIRED_SECTIONS.indexOf(heading.name);
374
+ const index = requiredSections.indexOf(heading.name);
316
375
  if (index === -1)
317
376
  continue;
318
377
  if (index < highest)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/agentic-workflow-schema",
3
- "version": "4.7.0",
3
+ "version": "4.8.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",