@gtrabanco/agentic-workflow-schema 4.6.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/README.md +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/pre-execution.d.ts +50 -11
- package/dist/pre-execution.js +79 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -467,6 +467,7 @@ const spec = [
|
|
|
467
467
|
"## Why", "", "The customer needs it.", "",
|
|
468
468
|
"## User outcome", "", "Users can do X.", "",
|
|
469
469
|
"## Acceptance criteria", "", "- [x] S1 done.", "",
|
|
470
|
+
"## Impact", "", "`selectSpecProduct` and the snapshot builder read it.", "",
|
|
470
471
|
"## Non-goals", "", "- Not S2.", "",
|
|
471
472
|
"## Future cost", "", "None known.", "",
|
|
472
473
|
"## Applicable tests", "", "- Unit tests.", "",
|
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)
|
package/dist/pre-execution.d.ts
CHANGED
|
@@ -89,11 +89,39 @@ export declare function isImpossibleReceiptTimeline({ finishedAt, sourceCommitDa
|
|
|
89
89
|
sourceCommitDate: unknown;
|
|
90
90
|
skewMs?: unknown;
|
|
91
91
|
}): boolean | null;
|
|
92
|
-
/** The unit document's closed
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
/** The unit document's closed required-section list (#305: 14 sections). The
|
|
93
|
+
two-half SPEC was retired by feature 61: plan-feature, plan-fix, review-spec,
|
|
94
|
+
review-plan, and design-feature are absorbed into the lane, which uses a single
|
|
95
|
+
unit document with these sections; the selector reads them in order. `Impact`
|
|
96
|
+
is required since #305 — it shipped as a tolerated extra while every published
|
|
97
|
+
surface (both templates, `template/AGENTS.md`, `MIGRATION.md`, `LANE_FLOW.md`,
|
|
98
|
+
`init-workspace`) already promised 14 sections including it, so the machine was
|
|
99
|
+
looser than the product. Its *content* is checked by
|
|
100
|
+
`scripts/promise-coherence.mjs`, not here: this list enforces shape only. */
|
|
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;
|
|
97
125
|
/** One artifact bound into a snapshot, by the exact bytes the reviewer read. */
|
|
98
126
|
export interface PreExecutionArtifactRow {
|
|
99
127
|
readonly kind: PreExecutionArtifactKind;
|
|
@@ -196,16 +224,27 @@ export type SpecProductSelection = {
|
|
|
196
224
|
readonly ok: false;
|
|
197
225
|
readonly errors: readonly SpecProductSelectorError[];
|
|
198
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[];
|
|
199
237
|
/**
|
|
200
238
|
* Cut the Product projection out of a SPEC document.
|
|
201
239
|
*
|
|
202
240
|
* The selection is byte-exact and total: the level-1 title and the required
|
|
203
|
-
* level-2 sections (
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* Product authority, so a Plan-phase write can
|
|
208
|
-
* silently erase a recorded review (the
|
|
241
|
+
* level-2 sections (`UNIT_DOC_REQUIRED_SECTIONS`, in that order), ending at the
|
|
242
|
+
* first boundary heading after `References`, with trailing blank lines removed
|
|
243
|
+
* and exactly one final newline. Everything the selector does NOT take — the
|
|
244
|
+
* tolerated extras (`## Future`, `## Issue`, `## Branch`, `## Regression scope`),
|
|
245
|
+
* later appendices — stays outside Product authority, so a Plan-phase write can
|
|
246
|
+
* never rotate a Product digest and silently erase a recorded review (the
|
|
247
|
+
* property AC2 and S6 test).
|
|
209
248
|
*
|
|
210
249
|
* Determinism rules that make the digest trustworthy:
|
|
211
250
|
* - line endings normalize to LF first, so a CRLF checkout and an LF editor
|
package/dist/pre-execution.js
CHANGED
|
@@ -109,15 +109,21 @@ function parseStamp(value) {
|
|
|
109
109
|
const ms = Date.parse(value.trim());
|
|
110
110
|
return Number.isNaN(ms) ? null : ms;
|
|
111
111
|
}
|
|
112
|
-
/** The unit document's closed
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
/** The unit document's closed required-section list (#305: 14 sections). The
|
|
113
|
+
two-half SPEC was retired by feature 61: plan-feature, plan-fix, review-spec,
|
|
114
|
+
review-plan, and design-feature are absorbed into the lane, which uses a single
|
|
115
|
+
unit document with these sections; the selector reads them in order. `Impact`
|
|
116
|
+
is required since #305 — it shipped as a tolerated extra while every published
|
|
117
|
+
surface (both templates, `template/AGENTS.md`, `MIGRATION.md`, `LANE_FLOW.md`,
|
|
118
|
+
`init-workspace`) already promised 14 sections including it, so the machine was
|
|
119
|
+
looser than the product. Its *content* is checked by
|
|
120
|
+
`scripts/promise-coherence.mjs`, not here: this list enforces shape only. */
|
|
116
121
|
export const UNIT_DOC_REQUIRED_SECTIONS = Object.freeze([
|
|
117
122
|
"Objective",
|
|
118
123
|
"Why",
|
|
119
124
|
"User outcome",
|
|
120
125
|
"Acceptance criteria",
|
|
126
|
+
"Impact",
|
|
121
127
|
"Non-goals",
|
|
122
128
|
"Future cost",
|
|
123
129
|
"Applicable tests",
|
|
@@ -128,6 +134,40 @@ export const UNIT_DOC_REQUIRED_SECTIONS = Object.freeze([
|
|
|
128
134
|
"Next",
|
|
129
135
|
"References",
|
|
130
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
|
+
});
|
|
131
171
|
// ---------------------------------------------------------------------------
|
|
132
172
|
// Shared plumbing: one sink, one capture, one structural engine
|
|
133
173
|
// ---------------------------------------------------------------------------
|
|
@@ -235,16 +275,35 @@ function advanceFence(run, open) {
|
|
|
235
275
|
function selectionError(code, heading) {
|
|
236
276
|
return { ok: false, errors: Object.freeze([Object.freeze({ code, heading })]) };
|
|
237
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
|
+
}
|
|
238
296
|
/**
|
|
239
297
|
* Cut the Product projection out of a SPEC document.
|
|
240
298
|
*
|
|
241
299
|
* The selection is byte-exact and total: the level-1 title and the required
|
|
242
|
-
* level-2 sections (
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* Product authority, so a Plan-phase write can
|
|
247
|
-
* silently erase a recorded review (the
|
|
300
|
+
* level-2 sections (`UNIT_DOC_REQUIRED_SECTIONS`, in that order), ending at the
|
|
301
|
+
* first boundary heading after `References`, with trailing blank lines removed
|
|
302
|
+
* and exactly one final newline. Everything the selector does NOT take — the
|
|
303
|
+
* tolerated extras (`## Future`, `## Issue`, `## Branch`, `## Regression scope`),
|
|
304
|
+
* later appendices — stays outside Product authority, so a Plan-phase write can
|
|
305
|
+
* never rotate a Product digest and silently erase a recorded review (the
|
|
306
|
+
* property AC2 and S6 test).
|
|
248
307
|
*
|
|
249
308
|
* Determinism rules that make the digest trustworthy:
|
|
250
309
|
* - line endings normalize to LF first, so a CRLF checkout and an LF editor
|
|
@@ -290,14 +349,21 @@ export function selectSpecProduct(text) {
|
|
|
290
349
|
}
|
|
291
350
|
if (titleLine === -1)
|
|
292
351
|
return selectionError("selector-title-missing", "<title>");
|
|
293
|
-
|
|
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) {
|
|
294
360
|
if (!headings.some((heading) => heading.name === required)) {
|
|
295
361
|
return selectionError("selector-heading-missing", required);
|
|
296
362
|
}
|
|
297
363
|
}
|
|
298
364
|
const seen = new Set();
|
|
299
365
|
for (const heading of headings) {
|
|
300
|
-
if (!
|
|
366
|
+
if (!requiredSections.includes(heading.name))
|
|
301
367
|
continue;
|
|
302
368
|
if (seen.has(heading.name))
|
|
303
369
|
return selectionError("selector-heading-duplicate", heading.name);
|
|
@@ -305,7 +371,7 @@ export function selectSpecProduct(text) {
|
|
|
305
371
|
}
|
|
306
372
|
let highest = -1;
|
|
307
373
|
for (const heading of headings) {
|
|
308
|
-
const index =
|
|
374
|
+
const index = requiredSections.indexOf(heading.name);
|
|
309
375
|
if (index === -1)
|
|
310
376
|
continue;
|
|
311
377
|
if (index < highest)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtrabanco/agentic-workflow-schema",
|
|
3
|
-
"version": "4.
|
|
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",
|