@gtrabanco/agentic-workflow-schema 4.2.0 → 4.3.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 +5 -4
- package/dist/index.d.ts +11 -1
- package/dist/index.js +17 -0
- package/dist/pre-execution-contract.d.ts +8 -1
- package/dist/pre-execution-contract.js +18 -2
- package/dist/pre-execution.d.ts +4 -1
- package/dist/pre-execution.js +9 -2
- package/dist/verification-contract.d.ts +6 -0
- package/dist/verification-contract.js +2 -1
- package/package.json +1 -1
- package/pre-execution-review-receipt.schema.json +8 -1
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`
|
|
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
|
|
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
|
```
|
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">;
|
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}` };
|
|
@@ -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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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
|
{
|
package/dist/pre-execution.d.ts
CHANGED
|
@@ -128,6 +128,8 @@ export interface PreExecutionFinding {
|
|
|
128
128
|
readonly verification: PreExecutionFindingVerification;
|
|
129
129
|
readonly resolution: PreExecutionFindingResolution;
|
|
130
130
|
readonly resolutionEvidence: string | null;
|
|
131
|
+
/** Optional concrete reproduction; absent means the producer recorded none. */
|
|
132
|
+
readonly reproducer?: string;
|
|
131
133
|
}
|
|
132
134
|
/** One optional parent receipt: topology, never a vote. */
|
|
133
135
|
export interface PreExecutionParentReceipt {
|
|
@@ -344,7 +346,8 @@ export declare function validatePreExecutionReviewReceiptV1(value: unknown): Pre
|
|
|
344
346
|
* 3. `contextClean` is mandatory for a PASS and never for a FAIL: a contaminated
|
|
345
347
|
* reviewer may still report what it found;
|
|
346
348
|
* 4. a PASS may not carry a material finding that is still open or unverified
|
|
347
|
-
* (`verdict-mismatch`) — `
|
|
349
|
+
* (`verdict-mismatch`) — material is `medium` and above, so a PASS may
|
|
350
|
+
* coexist with an open/unverified `low` or `info` report-note.
|
|
348
351
|
*
|
|
349
352
|
* The parent-topology rule (parents require a critic/synthesizer/arbiter role,
|
|
350
353
|
* `invalid-topology`) is part of the canonical definition itself — the shared
|
package/dist/pre-execution.js
CHANGED
|
@@ -667,6 +667,12 @@ export function validatePreExecutionReviewReceiptV1(value) {
|
|
|
667
667
|
return refused(collector);
|
|
668
668
|
return accepted("receipt", document);
|
|
669
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* The material line (E-D31-8): `medium` and above block a PASS; `low` and
|
|
672
|
+
* `info` are report-notes. One closed set, so a future severity cannot become
|
|
673
|
+
* material through a negated comparison.
|
|
674
|
+
*/
|
|
675
|
+
const MATERIAL_FINDING_SEVERITIES = new Set(["medium", "high", "critical"]);
|
|
670
676
|
/**
|
|
671
677
|
* The ONLY authority that blesses a pre-execution verdict (feature 28 AC1/AC2).
|
|
672
678
|
*
|
|
@@ -683,7 +689,8 @@ export function validatePreExecutionReviewReceiptV1(value) {
|
|
|
683
689
|
* 3. `contextClean` is mandatory for a PASS and never for a FAIL: a contaminated
|
|
684
690
|
* reviewer may still report what it found;
|
|
685
691
|
* 4. a PASS may not carry a material finding that is still open or unverified
|
|
686
|
-
* (`verdict-mismatch`) — `
|
|
692
|
+
* (`verdict-mismatch`) — material is `medium` and above, so a PASS may
|
|
693
|
+
* coexist with an open/unverified `low` or `info` report-note.
|
|
687
694
|
*
|
|
688
695
|
* The parent-topology rule (parents require a critic/synthesizer/arbiter role,
|
|
689
696
|
* `invalid-topology`) is part of the canonical definition itself — the shared
|
|
@@ -736,7 +743,7 @@ export function validatePreExecutionReceiptAgainstSnapshot(receipt, snapshot, po
|
|
|
736
743
|
if (isPassVerdict(bound.verdict)) {
|
|
737
744
|
for (let i = 0; i < bound.findings.length; i++) {
|
|
738
745
|
const finding = bound.findings[i];
|
|
739
|
-
const material = finding.severity
|
|
746
|
+
const material = MATERIAL_FINDING_SEVERITIES.has(finding.severity);
|
|
740
747
|
if (material && (finding.resolution === "open" || finding.verification === "unverified")) {
|
|
741
748
|
collector.add("verdict-mismatch", `/findings/${i}`);
|
|
742
749
|
}
|
|
@@ -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
|
-
|
|
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.
|
|
3
|
+
"version": "4.3.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",
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
"high",
|
|
334
334
|
"critical"
|
|
335
335
|
],
|
|
336
|
-
"description": "Severity ladder shared with candidate review
|
|
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": [
|