@gtrabanco/agentic-workflow-schema 4.8.0 → 4.10.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.
@@ -17,6 +17,68 @@
17
17
  * @type {readonly ["AC", "What was run", "Exit / digest", "Output (≤2 lines)", "Verified-by"]}
18
18
  */
19
19
  export declare const EVIDENCE_COLUMNS: readonly ["AC", "What was run", "Exit / digest", "Output (≤2 lines)", "Verified-by"];
20
+ /**
21
+ * The `claim | command | output | status` row a repair introduces for every
22
+ * claim it makes. `fold-findings` and `execute-phase` mandate it in prose; this
23
+ * is the versioned shape a driver can check, so "paste the command, never type
24
+ * the result" stops being a request a model may skip.
25
+ *
26
+ * @type {readonly ["claim", "command", "output", "status"]}
27
+ */
28
+ export declare const EVIDENCE_ROW_COLUMNS: readonly ["claim", "command", "output", "status"];
29
+ /**
30
+ * The closed verdict set: a row either verifies or it does not. A `✗` row means
31
+ * the turn is not done, which is why the vocabulary is closed rather than free
32
+ * text (`yes`/`PASS`/`ok` are refused, never coerced).
33
+ *
34
+ * @type {readonly ["✓", "✗"]}
35
+ */
36
+ export declare const EVIDENCE_ROW_VERDICTS: readonly ["✓", "✗"];
37
+ /**
38
+ * Classify a markdown line against `evidence-row@1`: a header, a separator, a
39
+ * claim row (with its parsed cells and refuse-nothing shape), or something else.
40
+ *
41
+ * @param {string} line
42
+ */
43
+ export declare function parseEvidenceRow(line: string): {
44
+ kind: string;
45
+ ok: boolean;
46
+ cells: null;
47
+ violations: never[];
48
+ } | {
49
+ kind: string;
50
+ ok: boolean;
51
+ cells: {
52
+ claim: string;
53
+ command: string;
54
+ output: string;
55
+ status: string;
56
+ };
57
+ violations: string[];
58
+ };
59
+ /**
60
+ * Validate one line against `evidence-row@1`. A header or separator is not a
61
+ * claim and passes; a non-table line is not a row of this grammar either.
62
+ *
63
+ * @param {string} line
64
+ * @returns {{ ok: boolean, kind: string, cells: object|null, violations: string[] }}
65
+ */
66
+ export declare function validateEvidenceRow(line: string): {
67
+ kind: string;
68
+ ok: boolean;
69
+ cells: {
70
+ claim: string;
71
+ command: string;
72
+ output: string;
73
+ status: string;
74
+ };
75
+ violations: string[];
76
+ } | {
77
+ kind: string;
78
+ cells: null;
79
+ ok: boolean;
80
+ violations: string[];
81
+ };
20
82
  export declare const PROGRESS_ENTRY_PATTERN: RegExp;
21
83
  /**
22
84
  * @type {readonly ["NN", "slug", "status", "depends-on", "description"]}
@@ -27,6 +27,95 @@ export const EVIDENCE_COLUMNS = [
27
27
  "Output (≤2 lines)",
28
28
  "Verified-by",
29
29
  ];
30
+ // ── Unit doc: claim-evidence row grammar (evidence-row@1, #318 S5/S12) ───
31
+ /**
32
+ * The `claim | command | output | status` row a repair introduces for every
33
+ * claim it makes. `fold-findings` and `execute-phase` mandate it in prose; this
34
+ * is the versioned shape a driver can check, so "paste the command, never type
35
+ * the result" stops being a request a model may skip.
36
+ *
37
+ * @type {readonly ["claim", "command", "output", "status"]}
38
+ */
39
+ export const EVIDENCE_ROW_COLUMNS = ["claim", "command", "output", "status"];
40
+ /**
41
+ * The closed verdict set: a row either verifies or it does not. A `✗` row means
42
+ * the turn is not done, which is why the vocabulary is closed rather than free
43
+ * text (`yes`/`PASS`/`ok` are refused, never coerced).
44
+ *
45
+ * @type {readonly ["✓", "✗"]}
46
+ */
47
+ export const EVIDENCE_ROW_VERDICTS = ["✓", "✗"];
48
+ const EVIDENCE_ROW_BACKTICK = /`[^`]+`/;
49
+ const EVIDENCE_ROW_SEPARATOR = /^\|(?:\s*:?-{3,}:?\s*\|)+$/;
50
+ /** Split a markdown table line into its cells, dropping the outer pipes. */
51
+ function evidenceRowCells(line) {
52
+ const text = line.trim();
53
+ if (!text.startsWith("|"))
54
+ return null;
55
+ const cells = text.split("|").slice(1);
56
+ if (cells.length && cells[cells.length - 1].trim() === "")
57
+ cells.pop();
58
+ return cells.map((cell) => cell.trim());
59
+ }
60
+ /** The cell with its wrapping backticks removed, or null when it carries none. */
61
+ function backticked(cell) {
62
+ if (!EVIDENCE_ROW_BACKTICK.test(cell))
63
+ return null;
64
+ return cell.replace(/^`(.*)`$/s, "$1");
65
+ }
66
+ /**
67
+ * Classify a markdown line against `evidence-row@1`: a header, a separator, a
68
+ * claim row (with its parsed cells and refuse-nothing shape), or something else.
69
+ *
70
+ * @param {string} line
71
+ */
72
+ export function parseEvidenceRow(line) {
73
+ const cells = evidenceRowCells(line);
74
+ if (cells === null)
75
+ return { kind: "other", ok: false, cells: null, violations: [] };
76
+ const lower = cells.map((cell) => cell.toLowerCase());
77
+ if (lower.length === EVIDENCE_ROW_COLUMNS.length
78
+ && EVIDENCE_ROW_COLUMNS.every((column, index) => lower[index] === column)) {
79
+ return { kind: "header", ok: true, cells: null, violations: [] };
80
+ }
81
+ if (EVIDENCE_ROW_SEPARATOR.test(line.trim())) {
82
+ return { kind: "separator", ok: true, cells: null, violations: [] };
83
+ }
84
+ const violations = [];
85
+ const [claim = "", commandCell = "", outputCell = "", status = ""] = cells;
86
+ if (claim === "" || claim === "—")
87
+ violations.push("invalid-evidence-row-claim");
88
+ // The command must BE a command: prose in that cell is the same defect as an
89
+ // empty one, because a typed expectation is what the shape exists to stop.
90
+ const command = backticked(commandCell);
91
+ if (command === null || command.trim() === "")
92
+ violations.push("invalid-evidence-row-command");
93
+ const output = backticked(outputCell);
94
+ if (output === null || output.trim() === "")
95
+ violations.push("invalid-evidence-row-output");
96
+ if (!EVIDENCE_ROW_VERDICTS.includes(status))
97
+ violations.push("invalid-evidence-row-status");
98
+ return {
99
+ kind: "row",
100
+ ok: violations.length === 0,
101
+ cells: { claim, command: command ?? commandCell, output: output ?? outputCell, status },
102
+ violations,
103
+ };
104
+ }
105
+ /**
106
+ * Validate one line against `evidence-row@1`. A header or separator is not a
107
+ * claim and passes; a non-table line is not a row of this grammar either.
108
+ *
109
+ * @param {string} line
110
+ * @returns {{ ok: boolean, kind: string, cells: object|null, violations: string[] }}
111
+ */
112
+ export function validateEvidenceRow(line) {
113
+ const parsed = parseEvidenceRow(line);
114
+ if (parsed.kind === "other") {
115
+ return { ...parsed, ok: false, violations: ["invalid-evidence-row-shape"] };
116
+ }
117
+ return parsed;
118
+ }
30
119
  // ── Unit doc: progress-log@1 entry regex ─────────────────────────────────
31
120
  export const PROGRESS_ENTRY_PATTERN = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2} — .+ → .+ — next: .+$/;
32
121
  // ── Roadmap table columns ────────────────────────────────────────────────
package/dist/index.d.ts CHANGED
@@ -919,4 +919,6 @@ export { CONTINUATION_CANONICAL_VECTORS, CONTINUATION_VECTOR_CONTRACT } from "./
919
919
  export { sha256Hex, sha256HexSync } from "./sha256.js";
920
920
  export type { ContinuationEvidence, ContinuationPlatformFamily, ContinuationPrecondition, ContinuationRefusalCode, EmitContinuationInput, EmitContinuationResult, EnvelopeContinuation, } from "./continuation.js";
921
921
  export type { ContinuationCanonicalVector } from "./continuation-vectors.js";
922
- 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";
922
+ export { EVIDENCE_COLUMNS, EVIDENCE_ROW_COLUMNS, EVIDENCE_ROW_VERDICTS, parseEvidenceRow, validateEvidenceRow, PROGRESS_ENTRY_PATTERN, ROADMAP_COLUMNS, CHANGELOG_SECTION_PATTERN, BUDGETS_OPERATIONS, MANIFEST_OPERATIONS, UNIT_DOC_OPERATIONS, ROADMAP_OPERATIONS, CHANGELOG_OPERATIONS, } from "./file-schemas.js";
923
+ export { FUTURE_STATUS_KINDS, FINDINGS_TABLE_SEVERITIES, LOG_KIND_TOKENS, SWEEP_CLAIM_KINDS, SWEEP_MISMATCH_REASONS, } from "./vocabularies.js";
924
+ export type { FutureStatus, FindingsTableSeverity, LogKindToken, SweepClaimKind, SweepMismatchReason, } from "./vocabularies.js";
package/dist/index.js CHANGED
@@ -2916,4 +2916,6 @@ export { CONTINUATION_CANONICAL_VECTORS, CONTINUATION_VECTOR_CONTRACT } from "./
2916
2916
  export { sha256Hex, sha256HexSync } from "./sha256.js";
2917
2917
  // ── File-schema vocabularies (agwo edit) ──────────────────────────────────
2918
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";
2919
+ export { EVIDENCE_COLUMNS, EVIDENCE_ROW_COLUMNS, EVIDENCE_ROW_VERDICTS, parseEvidenceRow, validateEvidenceRow, PROGRESS_ENTRY_PATTERN, ROADMAP_COLUMNS, CHANGELOG_SECTION_PATTERN, BUDGETS_OPERATIONS, MANIFEST_OPERATIONS, UNIT_DOC_OPERATIONS, ROADMAP_OPERATIONS, CHANGELOG_OPERATIONS, } from "./file-schemas.js";
2920
+ // ── Published closed vocabularies (unit 84, issue #315) ─────────────
2921
+ export { FUTURE_STATUS_KINDS, FINDINGS_TABLE_SEVERITIES, LOG_KIND_TOKENS, SWEEP_CLAIM_KINDS, SWEEP_MISMATCH_REASONS, } from "./vocabularies.js";
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Published closed vocabularies — the canonical machine-readable declarations
3
+ * (unit 84, issue #315 S1, decision D2).
4
+ *
5
+ * The repo publishes these sets in prose (the unit-doc templates, the ledger
6
+ * references, the sensor); the prose is a citation, never a second definition.
7
+ * A parity suite (`scripts/vocabulary-parity.test.mjs`) pins every second copy
8
+ * to the consts below — the F22/`LOG_KINDS` pattern, moved to the canonical
9
+ * home. Adding or removing a token is a schema-const + grammar-block +
10
+ * parity-pin change in one PR, never a prose-only edit.
11
+ */
12
+ /** The `## Future` row status vocabulary (`future-status`), published by both
13
+ * unit-doc templates and the `UnitDoc` skeleton: `open`, `planned`, or
14
+ * `discarded <YYYY-MM-DD>` (the date is grammar, not vocabulary). */
15
+ export declare const FUTURE_STATUS_KINDS: readonly string[];
16
+ export type FutureStatus = (typeof FUTURE_STATUS_KINDS)[number];
17
+ /** The findings-table severity vocabulary (`finding-severity`), published by
18
+ * the `findings-table@1` block: `high | med | low`. Distinct from the review
19
+ * payload's five-level `FINDING_SEVERITIES` scale (index.ts) — the table is
20
+ * the ledger scale; the sensor's `SEVERITY_VOCABULARY` may accept legacy
21
+ * aliases on read, but the canonical table scale is this set. */
22
+ export declare const FINDINGS_TABLE_SEVERITIES: readonly string[];
23
+ export type FindingsTableSeverity = (typeof FINDINGS_TABLE_SEVERITIES)[number];
24
+ /** The `## Log` line-kind vocabulary (`log-kind`), published by the
25
+ * `log-kind@1` block. The reader const is `scripts/unit-doc-phases.mjs`
26
+ * `LOG_KINDS`; the parity suite pins the two together. */
27
+ export declare const LOG_KIND_TOKENS: readonly string[];
28
+ export type LogKindToken = (typeof LOG_KIND_TOKENS)[number];
29
+ /** The sweep claim kind the promise-coherence gate publishes (unit 84 S2): the
30
+ * `swept: /<pattern>/<flags> → expected <n> in <glob>` declaration a fold
31
+ * appends to its `## Log` entry (grammar owner: `sweep-declaration@1` in
32
+ * `skills/execute-phase/references/FOLDING.md`). */
33
+ export declare const SWEEP_CLAIM_KINDS: readonly string[];
34
+ export type SweepClaimKind = (typeof SWEEP_CLAIM_KINDS)[number];
35
+ /** The sweep claim's fail-closed reason code. */
36
+ export declare const SWEEP_MISMATCH_REASONS: readonly string[];
37
+ export type SweepMismatchReason = (typeof SWEEP_MISMATCH_REASONS)[number];
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Published closed vocabularies — the canonical machine-readable declarations
3
+ * (unit 84, issue #315 S1, decision D2).
4
+ *
5
+ * The repo publishes these sets in prose (the unit-doc templates, the ledger
6
+ * references, the sensor); the prose is a citation, never a second definition.
7
+ * A parity suite (`scripts/vocabulary-parity.test.mjs`) pins every second copy
8
+ * to the consts below — the F22/`LOG_KINDS` pattern, moved to the canonical
9
+ * home. Adding or removing a token is a schema-const + grammar-block +
10
+ * parity-pin change in one PR, never a prose-only edit.
11
+ */
12
+ /** The `## Future` row status vocabulary (`future-status`), published by both
13
+ * unit-doc templates and the `UnitDoc` skeleton: `open`, `planned`, or
14
+ * `discarded <YYYY-MM-DD>` (the date is grammar, not vocabulary). */
15
+ export const FUTURE_STATUS_KINDS = Object.freeze(["open", "planned", "discarded"]);
16
+ /** The findings-table severity vocabulary (`finding-severity`), published by
17
+ * the `findings-table@1` block: `high | med | low`. Distinct from the review
18
+ * payload's five-level `FINDING_SEVERITIES` scale (index.ts) — the table is
19
+ * the ledger scale; the sensor's `SEVERITY_VOCABULARY` may accept legacy
20
+ * aliases on read, but the canonical table scale is this set. */
21
+ export const FINDINGS_TABLE_SEVERITIES = Object.freeze(["high", "med", "low"]);
22
+ // The findings-table class vocabulary (`finding-class`) is already published
23
+ // canonically: `PRE_EXECUTION_FINDING_CLASSES` in `pre-execution.ts` is exactly
24
+ // the `product | plan | source | environment | runtime` set the
25
+ // `findings-table@1` block cites — no second const is created here.
26
+ /** The `## Log` line-kind vocabulary (`log-kind`), published by the
27
+ * `log-kind@1` block. The reader const is `scripts/unit-doc-phases.mjs`
28
+ * `LOG_KINDS`; the parity suite pins the two together. */
29
+ export const LOG_KIND_TOKENS = Object.freeze(["L", "E", "G", "F", "D", "P", "R", "V"]);
30
+ /** The sweep claim kind the promise-coherence gate publishes (unit 84 S2): the
31
+ * `swept: /<pattern>/<flags> → expected <n> in <glob>` declaration a fold
32
+ * appends to its `## Log` entry (grammar owner: `sweep-declaration@1` in
33
+ * `skills/execute-phase/references/FOLDING.md`). */
34
+ export const SWEEP_CLAIM_KINDS = Object.freeze(["sweep"]);
35
+ /** The sweep claim's fail-closed reason code. */
36
+ export const SWEEP_MISMATCH_REASONS = Object.freeze(["sweep-mismatch"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/agentic-workflow-schema",
3
- "version": "4.8.0",
3
+ "version": "4.10.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",
@@ -75,6 +75,6 @@
75
75
  },
76
76
  "devDependencies": {
77
77
  "ajv": "8.20.0",
78
- "typescript": "6"
78
+ "typescript": "7"
79
79
  }
80
80
  }