@gtrabanco/agentic-workflow-schema 4.9.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,6 +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
923
  export { FUTURE_STATUS_KINDS, FINDINGS_TABLE_SEVERITIES, LOG_KIND_TOKENS, SWEEP_CLAIM_KINDS, SWEEP_MISMATCH_REASONS, } from "./vocabularies.js";
924
924
  export type { FutureStatus, FindingsTableSeverity, LogKindToken, SweepClaimKind, SweepMismatchReason, } from "./vocabularies.js";
package/dist/index.js CHANGED
@@ -2916,6 +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
2920
  // ── Published closed vocabularies (unit 84, issue #315) ─────────────
2921
2921
  export { FUTURE_STATUS_KINDS, FINDINGS_TABLE_SEVERITIES, LOG_KIND_TOKENS, SWEEP_CLAIM_KINDS, SWEEP_MISMATCH_REASONS, } from "./vocabularies.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/agentic-workflow-schema",
3
- "version": "4.9.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
  }