@gtrabanco/agentic-workflow-schema 4.0.1 → 4.1.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.es.md +7 -2
- package/README.md +13 -7
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/pre-execution-contract.js +5 -1
- package/dist/pre-execution.d.ts +34 -7
- package/dist/pre-execution.js +46 -6
- package/package.json +1 -1
- package/pre-execution-review-receipt.schema.json +1 -2
package/README.es.md
CHANGED
|
@@ -272,6 +272,8 @@ a un cambio en lo que fue aprobado.
|
|
|
272
272
|
| `digestPreExecutionArtifactSnapshot(snapshot)` | SHA-256 hexadecimal en minúsculas |
|
|
273
273
|
| `canonicalizePreExecutionReviewReceipt(receipt)` / `digestPreExecutionReviewReceipt(receipt)` | el mismo par para recibos |
|
|
274
274
|
| `comparePreExecutionReceiptToSnapshot(receipt, reviewed, current, policyVersion)` | decisión de frescura |
|
|
275
|
+
| `isImpossibleReceiptTimeline({ finishedAt, sourceCommitDate, skewMs })` | predicado puro — devuelve `true` cuando el finish de un recibo predice la fecha de commit de su revisión fuente más allá del skew publicado; `false` cuando honesto; `null` con entrada no parseable (fail-open) |
|
|
276
|
+
| `VERDICTS_BY_STAGE` | mapa de veredictos por etapa: `spec: ["spec-review-pass", "spec-review-fail", "needs-design"]`, `plan: ["plan-review-pass", "plan-review-fail"]` — estrecha qué veredictos puede emitir cada etapa (el `PRE_EXECUTION_VERDICTS` plano mantiene todos los valores) |
|
|
275
277
|
|
|
276
278
|
Toda entrada acepta `unknown`, nunca lanza con entrada hostil y responde con el
|
|
277
279
|
vocabulario cerrado y redactado `PRE_EXECUTION_DIAGNOSTIC_CODES`: solo códigos y
|
|
@@ -312,7 +314,8 @@ conductor pueda mostrar las garantías que el schema no puede expresar.
|
|
|
312
314
|
| `PRE_EXECUTION_PARENT_ROLES` | `critic` · `synthesis` · `arbitration` — Qué fue el recibo padre — no hay quórum sobre ellos. |
|
|
313
315
|
| `PRE_EXECUTION_AUTHOR_EXCLUSIONS` | `enforced` · `not-enforceable` — Si el runtime puede probar que el revisor no creó el conjunto de artefactos. |
|
|
314
316
|
| `PRE_EXECUTION_MODEL_DIVERSITY` | `same-model` · `cross-model` · `not-applicable` — Una etiqueta veraz, nunca un umbral. |
|
|
315
|
-
| `PRE_EXECUTION_FRESHNESS_CODES` | `invalid-stage` · `invalid-unit` · `stale-policy` · `stale-context` · `stale-source-revision` · `stale-parent` · `stale-artifact-revision` · `stale-artifact-content` · `missing-receipt-snapshot` — Precedencia ordenada: ver Frescura. |
|
|
317
|
+
| `PRE_EXECUTION_FRESHNESS_CODES` | `invalid-stage` · `invalid-unit` · `stale-policy` · `impossible-timeline` · `stale-context` · `stale-source-revision` · `stale-parent` · `stale-artifact-revision` · `stale-artifact-content` · `missing-receipt-snapshot` — Precedencia ordenada: ver Frescura. |
|
|
318
|
+
| `PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS` | `300000` — La tolerancia de deriva de reloj publicada (±5 min) para el chequeo `impossible-timeline`, de modo que el sensor respaldado por git no pueda desviarse del contrato. |
|
|
316
319
|
| `PRE_EXECUTION_DIAGNOSTIC_CODES` | `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` — Redactado: solo códigos y punteros, jamás un valor enviado. |
|
|
317
320
|
|
|
318
321
|
### Qué ata el snapshot
|
|
@@ -390,7 +393,9 @@ material sin resolver, y `modelDiversity` es una etiqueta veraz
|
|
|
390
393
|
|
|
391
394
|
`comparePreExecutionReceiptToSnapshot` responde `{ fresh: true }` o
|
|
392
395
|
`{ fresh: false, reasonCode }` desde el vocabulario cerrado
|
|
393
|
-
`PRE_EXECUTION_FRESHNESS_CODES`, con esta precedencia fija: `stale-policy` →
|
|
396
|
+
`PRE_EXECUTION_FRESHNESS_CODES`, con esta precedencia fija: `stale-policy` → [`impossible-timeline` — la línea
|
|
397
|
+
temporal de fin/commit registrada en el propio receipt solo puede juzgarla un
|
|
398
|
+
caller respaldado por git; el comparador puro la deja sin evaluar (fail-open)] →
|
|
394
399
|
`stale-context` → `stale-source-revision` → `stale-parent` →
|
|
395
400
|
`stale-artifact-content` → `stale-artifact-revision` → `missing-receipt-snapshot`,
|
|
396
401
|
y `invalid-stage` / `invalid-unit` se rechazan antes de comparar. Como una reversión
|
package/README.md
CHANGED
|
@@ -261,6 +261,8 @@ change in what was approved.
|
|
|
261
261
|
| `digestPreExecutionArtifactSnapshot(snapshot)` | lowercase SHA-256 hex |
|
|
262
262
|
| `canonicalizePreExecutionReviewReceipt(receipt)` / `digestPreExecutionReviewReceipt(receipt)` | same pair for receipts |
|
|
263
263
|
| `comparePreExecutionReceiptToSnapshot(receipt, reviewed, current, policyVersion)` | freshness decision |
|
|
264
|
+
| `isImpossibleReceiptTimeline({ finishedAt, sourceCommitDate, skewMs })` | pure predicate — returns true when a receipt's finish predates its source revision's commit date beyond the published skew; false when honest; null on unparsable input (fail-open) |
|
|
265
|
+
| `VERDICTS_BY_STAGE` | per-stage verdict map: spec, plan narrowings — the flat PRE_EXECUTION_VERDICTS keeps all values |
|
|
264
266
|
|
|
265
267
|
Every entry accepts `unknown`, never throws on hostile input, and answers the
|
|
266
268
|
closed, redacted diagnostic vocabulary `PRE_EXECUTION_DIAGNOSTIC_CODES` — codes
|
|
@@ -301,7 +303,8 @@ display the guarantees the schema cannot state.
|
|
|
301
303
|
| `PRE_EXECUTION_PARENT_ROLES` | `critic` · `synthesis` · `arbitration` — What a parent receipt was — there is no quorum over them. |
|
|
302
304
|
| `PRE_EXECUTION_AUTHOR_EXCLUSIONS` | `enforced` · `not-enforceable` — Whether the runtime can prove the reviewer did not author the artifact set. |
|
|
303
305
|
| `PRE_EXECUTION_MODEL_DIVERSITY` | `same-model` · `cross-model` · `not-applicable` — A truthful label, never a threshold. |
|
|
304
|
-
| `PRE_EXECUTION_FRESHNESS_CODES` | `invalid-stage` · `invalid-unit` · `stale-policy` · `stale-context` · `stale-source-revision` · `stale-parent` · `stale-artifact-revision` · `stale-artifact-content` · `missing-receipt-snapshot` — Ordered precedence: see Freshness. |
|
|
306
|
+
| `PRE_EXECUTION_FRESHNESS_CODES` | `invalid-stage` · `invalid-unit` · `stale-policy` · `impossible-timeline` · `stale-context` · `stale-source-revision` · `stale-parent` · `stale-artifact-revision` · `stale-artifact-content` · `missing-receipt-snapshot` — Ordered precedence: see Freshness. |
|
|
307
|
+
| `PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS` | `300000` — The published clock-drift tolerance (±5 min) for the `impossible-timeline` check, so the git-backed sensor cannot drift from the contract. |
|
|
305
308
|
| `PRE_EXECUTION_DIAGNOSTIC_CODES` | `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` — Redacted: codes and pointers only, never a submitted value. |
|
|
306
309
|
|
|
307
310
|
### What the snapshot binds
|
|
@@ -378,12 +381,15 @@ an unresolved material finding, and `modelDiversity` is a truthful label
|
|
|
378
381
|
|
|
379
382
|
`comparePreExecutionReceiptToSnapshot` answers `{ fresh: true }` or
|
|
380
383
|
`{ fresh: false, reasonCode }` from the closed `PRE_EXECUTION_FRESHNESS_CODES`,
|
|
381
|
-
in this fixed precedence: `stale-policy` → `
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
`
|
|
385
|
-
`
|
|
386
|
-
|
|
384
|
+
in this fixed precedence: `stale-policy` → [`impossible-timeline` — the
|
|
385
|
+
receipt's own recorded finish/commit timeline is judgeable only by a git-backed
|
|
386
|
+
caller; the pure comparator leaves it un-evaluated (fail-open)] →
|
|
387
|
+
`stale-context` → `stale-source-revision` → `stale-parent` →
|
|
388
|
+
`stale-artifact-content` → `stale-artifact-revision` →
|
|
389
|
+
`missing-receipt-snapshot`, with `invalid-stage` and `invalid-unit` refused
|
|
390
|
+
before any comparison. Because a revert that rotates `artifactRevisionId`
|
|
391
|
+
still changes the snapshot digest, an old PASS cannot be resurrected by editing
|
|
392
|
+
a document back to its previous bytes.
|
|
387
393
|
|
|
388
394
|
### Published limits
|
|
389
395
|
|
package/dist/index.d.ts
CHANGED
|
@@ -887,5 +887,6 @@ export declare const VERIFICATION_CANONICAL_VECTORS: ReadonlyArray<Readonly<Cano
|
|
|
887
887
|
* package-internal, exactly as the verification family's does, and the generated
|
|
888
888
|
* Draft-07 files are projections of it, not a second authority.
|
|
889
889
|
*/
|
|
890
|
-
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_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, } from "./pre-execution.js";
|
|
890
|
+
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";
|
|
891
|
+
export { VERDICTS_BY_STAGE } from "./pre-execution-contract.js";
|
|
891
892
|
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";
|
package/dist/index.js
CHANGED
|
@@ -2867,4 +2867,5 @@ export const VERIFICATION_CANONICAL_VECTORS = Object.freeze([
|
|
|
2867
2867
|
* package-internal, exactly as the verification family's does, and the generated
|
|
2868
2868
|
* Draft-07 files are projections of it, not a second authority.
|
|
2869
2869
|
*/
|
|
2870
|
-
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_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, } from "./pre-execution.js";
|
|
2870
|
+
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";
|
|
2871
|
+
export { VERDICTS_BY_STAGE } from "./pre-execution-contract.js";
|
|
@@ -100,7 +100,11 @@ export const PRE_EXECUTION_AUTHOR_EXCLUSIONS = Object.freeze(["enforced", "not-e
|
|
|
100
100
|
/** Which verdicts belong to which stage. There is no generic "approve". */
|
|
101
101
|
export const VERDICTS_BY_STAGE = Object.freeze({
|
|
102
102
|
spec: ["spec-review-pass", "spec-review-fail", "needs-design"],
|
|
103
|
-
|
|
103
|
+
// fix/162 Decision 11: the machine map no longer sanctions a plan-stage
|
|
104
|
+
// needs-design — ONLY review-spec may emit it. The flat PRE_EXECUTION_VERDICTS
|
|
105
|
+
// keeps the token (review-spec still emits it), and no persisted plan-stage
|
|
106
|
+
// needs-design receipt exists, so the narrowing invalidates nothing historical.
|
|
107
|
+
plan: ["plan-review-pass", "plan-review-fail"],
|
|
104
108
|
});
|
|
105
109
|
export const PRE_EXECUTION_MODEL_DIVERSITY = Object.freeze([
|
|
106
110
|
"same-model", "cross-model", "not-applicable",
|
package/dist/pre-execution.d.ts
CHANGED
|
@@ -64,8 +64,31 @@ export interface PreExecutionDiagnostic {
|
|
|
64
64
|
* Exactly one fires per call, in the documented precedence, and the comparison
|
|
65
65
|
* never throws: an input it cannot read is answered with a code.
|
|
66
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"];
|
|
67
|
+
export declare const PRE_EXECUTION_FRESHNESS_CODES: readonly ["invalid-stage", "invalid-unit", "stale-policy", "impossible-timeline", "stale-context", "stale-source-revision", "stale-parent", "stale-artifact-revision", "stale-artifact-content", "missing-receipt-snapshot"];
|
|
68
68
|
export type PreExecutionFreshnessCode = (typeof PRE_EXECUTION_FRESHNESS_CODES)[number];
|
|
69
|
+
/**
|
|
70
|
+
* The published clock-drift tolerance for the `impossible-timeline` check.
|
|
71
|
+
* 5 minutes absorbs cross-machine clock drift while staying three orders of
|
|
72
|
+
* magnitude below the field case's ~20 h contradiction (fix/162, PE-010).
|
|
73
|
+
* Published from the schema so the git-backed sensor cannot drift from the
|
|
74
|
+
* contract it prints.
|
|
75
|
+
*/
|
|
76
|
+
export declare const PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS = 300000;
|
|
77
|
+
/**
|
|
78
|
+
* The `impossible-timeline` pure predicate: is the receipt's own recorded
|
|
79
|
+
* timeline physically impossible? A finish that predates its recorded source
|
|
80
|
+
* revision's commit date by more than the published skew cannot be honest —
|
|
81
|
+
* the review claiming it would have finished before the bytes it reviewed were
|
|
82
|
+
* committed. Fail-open: an input it cannot read (a missing or unparsable
|
|
83
|
+
* stamp, or an invalid skew) answers `null`, never throws, and never flags a
|
|
84
|
+
* receipt it cannot judge. Git-backed callers evaluate this at the documented
|
|
85
|
+
* comparator slot; the pure comparator (which has no git access) is unchanged.
|
|
86
|
+
*/
|
|
87
|
+
export declare function isImpossibleReceiptTimeline({ finishedAt, sourceCommitDate, skewMs, }: {
|
|
88
|
+
finishedAt: unknown;
|
|
89
|
+
sourceCommitDate: unknown;
|
|
90
|
+
skewMs?: unknown;
|
|
91
|
+
}): boolean | null;
|
|
69
92
|
/** The Product-half headings the selector binds, in required order. */
|
|
70
93
|
export declare const SPEC_PRODUCT_REQUIRED_HEADINGS: readonly ["Goal", "Branch", "Size", "Dependencies", "Product half", "Design status"];
|
|
71
94
|
/** One artifact bound into a snapshot, by the exact bytes the reviewer read. */
|
|
@@ -343,17 +366,21 @@ export declare function validatePreExecutionReceiptAgainstSnapshot(receipt: unkn
|
|
|
343
366
|
* 2. `invalid-stage` / `invalid-unit` — the two snapshots are not the same review
|
|
344
367
|
* target, which no content comparison can repair;
|
|
345
368
|
* 3. `stale-policy` — the review policy moved under the approval;
|
|
346
|
-
* 4. `
|
|
347
|
-
*
|
|
369
|
+
* 4. `impossible-timeline` — evaluated by git-backed callers at this slot; the
|
|
370
|
+
* pure comparator leaves it un-evaluated (fail-open), because it has no git
|
|
371
|
+
* access and the receipt's own recorded finish/commit timeline is only
|
|
372
|
+
* judgeable against the recorded revision's commit date;
|
|
373
|
+
* 5. `stale-context` — an authority the reviewer relied on changed;
|
|
374
|
+
* 6. `stale-source-revision` — the repository revision the artifacts were read at
|
|
348
375
|
* changed;
|
|
349
|
-
*
|
|
376
|
+
* 7. `stale-parent` — the Product snapshot a Plan approval descends from changed
|
|
350
377
|
* (lineage, so a Product rewrite erases the descendant approval);
|
|
351
|
-
*
|
|
352
|
-
*
|
|
378
|
+
* 8. `stale-artifact-content` — a bound artifact's bytes changed;
|
|
379
|
+
* 9. `stale-artifact-revision` — the authoring revision rotated with identical
|
|
353
380
|
* bytes, which is why content is checked first: a mutate-then-revert with a
|
|
354
381
|
* rotated `artifactRevisionId` still lands here and an older PASS never
|
|
355
382
|
* resurrects (S6);
|
|
356
|
-
*
|
|
383
|
+
* 10. otherwise `{ fresh: true }`.
|
|
357
384
|
*
|
|
358
385
|
* Every dimension is reported alone because a caller routes on it: a stale context
|
|
359
386
|
* asks a sensor to re-read, a stale artifact asks the reviewer to re-read, and a
|
package/dist/pre-execution.js
CHANGED
|
@@ -66,6 +66,7 @@ export const PRE_EXECUTION_FRESHNESS_CODES = Object.freeze([
|
|
|
66
66
|
"invalid-stage",
|
|
67
67
|
"invalid-unit",
|
|
68
68
|
"stale-policy",
|
|
69
|
+
"impossible-timeline",
|
|
69
70
|
"stale-context",
|
|
70
71
|
"stale-source-revision",
|
|
71
72
|
"stale-parent",
|
|
@@ -73,6 +74,41 @@ export const PRE_EXECUTION_FRESHNESS_CODES = Object.freeze([
|
|
|
73
74
|
"stale-artifact-content",
|
|
74
75
|
"missing-receipt-snapshot",
|
|
75
76
|
]);
|
|
77
|
+
/**
|
|
78
|
+
* The published clock-drift tolerance for the `impossible-timeline` check.
|
|
79
|
+
* 5 minutes absorbs cross-machine clock drift while staying three orders of
|
|
80
|
+
* magnitude below the field case's ~20 h contradiction (fix/162, PE-010).
|
|
81
|
+
* Published from the schema so the git-backed sensor cannot drift from the
|
|
82
|
+
* contract it prints.
|
|
83
|
+
*/
|
|
84
|
+
export const PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS = 300_000;
|
|
85
|
+
/**
|
|
86
|
+
* The `impossible-timeline` pure predicate: is the receipt's own recorded
|
|
87
|
+
* timeline physically impossible? A finish that predates its recorded source
|
|
88
|
+
* revision's commit date by more than the published skew cannot be honest —
|
|
89
|
+
* the review claiming it would have finished before the bytes it reviewed were
|
|
90
|
+
* committed. Fail-open: an input it cannot read (a missing or unparsable
|
|
91
|
+
* stamp, or an invalid skew) answers `null`, never throws, and never flags a
|
|
92
|
+
* receipt it cannot judge. Git-backed callers evaluate this at the documented
|
|
93
|
+
* comparator slot; the pure comparator (which has no git access) is unchanged.
|
|
94
|
+
*/
|
|
95
|
+
export function isImpossibleReceiptTimeline({ finishedAt, sourceCommitDate, skewMs = PRE_EXECUTION_RECEIPT_TIMELINE_SKEW_MS, }) {
|
|
96
|
+
const finish = parseStamp(finishedAt);
|
|
97
|
+
const commit = parseStamp(sourceCommitDate);
|
|
98
|
+
const skew = typeof skewMs === "number" && Number.isFinite(skewMs) && skewMs >= 0 ? skewMs : null;
|
|
99
|
+
if (finish === null || commit === null || skew === null)
|
|
100
|
+
return null;
|
|
101
|
+
return finish < commit - skew;
|
|
102
|
+
}
|
|
103
|
+
/** Parse a timestamp-like value to epoch ms, or `null` when it cannot be read. */
|
|
104
|
+
function parseStamp(value) {
|
|
105
|
+
if (typeof value === "number")
|
|
106
|
+
return Number.isFinite(value) ? value : null;
|
|
107
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
108
|
+
return null;
|
|
109
|
+
const ms = Date.parse(value.trim());
|
|
110
|
+
return Number.isNaN(ms) ? null : ms;
|
|
111
|
+
}
|
|
76
112
|
/** The Product-half headings the selector binds, in required order. */
|
|
77
113
|
export const SPEC_PRODUCT_REQUIRED_HEADINGS = Object.freeze([
|
|
78
114
|
"Goal",
|
|
@@ -728,17 +764,21 @@ function stale(reasonCode) {
|
|
|
728
764
|
* 2. `invalid-stage` / `invalid-unit` — the two snapshots are not the same review
|
|
729
765
|
* target, which no content comparison can repair;
|
|
730
766
|
* 3. `stale-policy` — the review policy moved under the approval;
|
|
731
|
-
* 4. `
|
|
732
|
-
*
|
|
767
|
+
* 4. `impossible-timeline` — evaluated by git-backed callers at this slot; the
|
|
768
|
+
* pure comparator leaves it un-evaluated (fail-open), because it has no git
|
|
769
|
+
* access and the receipt's own recorded finish/commit timeline is only
|
|
770
|
+
* judgeable against the recorded revision's commit date;
|
|
771
|
+
* 5. `stale-context` — an authority the reviewer relied on changed;
|
|
772
|
+
* 6. `stale-source-revision` — the repository revision the artifacts were read at
|
|
733
773
|
* changed;
|
|
734
|
-
*
|
|
774
|
+
* 7. `stale-parent` — the Product snapshot a Plan approval descends from changed
|
|
735
775
|
* (lineage, so a Product rewrite erases the descendant approval);
|
|
736
|
-
*
|
|
737
|
-
*
|
|
776
|
+
* 8. `stale-artifact-content` — a bound artifact's bytes changed;
|
|
777
|
+
* 9. `stale-artifact-revision` — the authoring revision rotated with identical
|
|
738
778
|
* bytes, which is why content is checked first: a mutate-then-revert with a
|
|
739
779
|
* rotated `artifactRevisionId` still lands here and an older PASS never
|
|
740
780
|
* resurrects (S6);
|
|
741
|
-
*
|
|
781
|
+
* 10. otherwise `{ fresh: true }`.
|
|
742
782
|
*
|
|
743
783
|
* Every dimension is reported alone because a caller routes on it: a stale context
|
|
744
784
|
* asks a sensor to re-read, a stale artifact asks the reviewer to re-read, and a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtrabanco/agentic-workflow-schema",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.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",
|