@cleocode/contracts 2026.4.70 → 2026.4.72

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.
Files changed (46) hide show
  1. package/dist/__tests__/evidence-record.test.d.ts +14 -0
  2. package/dist/__tests__/evidence-record.test.d.ts.map +1 -0
  3. package/dist/__tests__/evidence-record.test.js +362 -0
  4. package/dist/__tests__/evidence-record.test.js.map +1 -0
  5. package/dist/__tests__/invariants.test.d.ts +19 -0
  6. package/dist/__tests__/invariants.test.d.ts.map +1 -0
  7. package/dist/__tests__/invariants.test.js +351 -0
  8. package/dist/__tests__/invariants.test.js.map +1 -0
  9. package/dist/acceptance-gate-schema.d.ts +81 -4
  10. package/dist/acceptance-gate-schema.d.ts.map +1 -1
  11. package/dist/acceptance-gate-schema.js +60 -1
  12. package/dist/acceptance-gate-schema.js.map +1 -1
  13. package/dist/acceptance-gate.d.ts +99 -2
  14. package/dist/acceptance-gate.d.ts.map +1 -1
  15. package/dist/evidence-record-schema.d.ts +202 -0
  16. package/dist/evidence-record-schema.d.ts.map +1 -0
  17. package/dist/evidence-record-schema.js +130 -0
  18. package/dist/evidence-record-schema.js.map +1 -0
  19. package/dist/evidence-record.d.ts +167 -0
  20. package/dist/evidence-record.d.ts.map +1 -0
  21. package/dist/evidence-record.js +21 -0
  22. package/dist/evidence-record.js.map +1 -0
  23. package/dist/index.d.ts +10 -3
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +5 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/task-evidence.d.ts +251 -0
  28. package/dist/task-evidence.d.ts.map +1 -0
  29. package/dist/task-evidence.js +89 -0
  30. package/dist/task-evidence.js.map +1 -0
  31. package/package.json +8 -2
  32. package/schemas/acceptance-gate.schema.json +9 -0
  33. package/schemas/attachment.schema.json +9 -0
  34. package/schemas/gate-result-details.schema.json +9 -0
  35. package/schemas/gate-result.schema.json +9 -0
  36. package/schemas/manifest-v1.json +176 -0
  37. package/schemas/task-evidence.schema.json +9 -0
  38. package/schemas/task.schema.json +9 -0
  39. package/src/__tests__/evidence-record.test.ts +412 -0
  40. package/src/__tests__/invariants.test.ts +445 -0
  41. package/src/acceptance-gate-schema.ts +65 -1
  42. package/src/acceptance-gate.ts +108 -2
  43. package/src/evidence-record-schema.ts +158 -0
  44. package/src/evidence-record.ts +182 -0
  45. package/src/index.ts +65 -1
  46. package/src/task-evidence.ts +239 -0
@@ -72,14 +72,33 @@ export interface TestGate extends GateBase {
72
72
  /**
73
73
  * Assert properties of a file on disk. Multiple assertions are AND-ed:
74
74
  * all must hold for the gate to pass.
75
+ *
76
+ * Either `path` or `attachmentSha256` must be provided (not both).
77
+ * When `attachmentSha256` is set, the gate runner resolves the on-disk path
78
+ * via `AttachmentStore.get(sha256)` before running assertions.
75
79
  */
76
80
  export interface FileGate extends GateBase {
77
81
  kind: 'file';
78
82
  /**
79
83
  * Absolute or project-root-relative path. Globs are not supported here
80
84
  * — use one gate per path.
85
+ *
86
+ * Exactly one of `path` or `attachmentSha256` must be set.
81
87
  */
82
- path: string;
88
+ path?: string;
89
+ /**
90
+ * SHA-256 hex digest of an attachment stored in the CLEO attachment store.
91
+ *
92
+ * When set, the gate runner resolves the attachment's on-disk blob path
93
+ * via `AttachmentStore.get(sha256)` and uses that path for all assertions.
94
+ * Mutually exclusive with `path`.
95
+ *
96
+ * @example
97
+ * ```json
98
+ * { "kind": "file", "attachmentSha256": "a1b2c3...", "assertions": [{ "type": "nonEmpty" }] }
99
+ * ```
100
+ */
101
+ attachmentSha256?: string;
83
102
  assertions: FileAssertion[];
84
103
  }
85
104
  /**
@@ -220,6 +239,65 @@ export interface ManualGate extends GateBase {
220
239
  export type AcceptanceGate = TestGate | FileGate | CommandGate | LintGate | HttpGate | ManualGate;
221
240
  /** All valid `kind` discriminants for `AcceptanceGate`. */
222
241
  export type AcceptanceGateKind = AcceptanceGate['kind'];
242
+ /**
243
+ * Kind-specific detail payload for {@link AcceptanceGateResult}.
244
+ *
245
+ * Each variant is keyed by `kind` — the same discriminant used on
246
+ * {@link AcceptanceGate} — so callers can narrow `details` with a simple
247
+ * `if (result.details?.kind === 'test') { ... }` guard.
248
+ *
249
+ * @epic T760
250
+ * @task T802
251
+ */
252
+ export type GateResultDetails = {
253
+ kind: 'test';
254
+ /** Exit code of the test process. */
255
+ exitCode: number;
256
+ /** Captured standard output (may be truncated). */
257
+ stdout: string;
258
+ /** Captured standard error (may be truncated). */
259
+ stderr: string;
260
+ /** Wall-clock duration in milliseconds. */
261
+ duration: number;
262
+ } | {
263
+ kind: 'file';
264
+ /** The file path that was evaluated. */
265
+ path: string;
266
+ /** Assertions that passed. */
267
+ passedAssertions: string[];
268
+ /** Assertions that failed (empty on pass). */
269
+ failedAssertions: string[];
270
+ } | {
271
+ kind: 'command';
272
+ /** The command that was run. */
273
+ cmd: string;
274
+ /** Exit code of the command process. */
275
+ exitCode: number;
276
+ /** Captured standard output (may be truncated). */
277
+ stdout: string;
278
+ } | {
279
+ kind: 'lint';
280
+ /** Linting tool name (e.g. `"biome"`, `"tsc"`). */
281
+ tool: string;
282
+ /** Number of diagnostic warnings emitted. */
283
+ warnings: number;
284
+ /** Number of diagnostic errors emitted. */
285
+ errors: number;
286
+ } | {
287
+ kind: 'http';
288
+ /** The URL that was probed. */
289
+ url: string;
290
+ /** HTTP status code returned by the server. */
291
+ status: number;
292
+ /** Response body (may be truncated). */
293
+ body: string;
294
+ } | {
295
+ kind: 'manual';
296
+ /** The prompt shown to the reviewer. */
297
+ prompt: string;
298
+ /** Whether the reviewer accepted (`true`) or rejected (`false`) the gate. */
299
+ accepted: boolean;
300
+ };
223
301
  /**
224
302
  * Result of running one acceptance gate.
225
303
  *
@@ -241,7 +319,26 @@ export interface AcceptanceGateResult {
241
319
  result: 'pass' | 'fail' | 'warn' | 'skipped' | 'error';
242
320
  /** Wall-clock duration of the gate execution in milliseconds. */
243
321
  durationMs: number;
244
- /** Truncated stdout/stderr or file snippet shown in failure messages. */
322
+ /**
323
+ * Typed kind-specific detail payload.
324
+ *
325
+ * Replaces the untyped `evidence?: string` pattern. The `kind` discriminant
326
+ * matches the gate's `kind` so callers can narrow safely:
327
+ *
328
+ * ```ts
329
+ * if (r.details?.kind === 'test') {
330
+ * console.log(r.details.exitCode, r.details.stdout);
331
+ * }
332
+ * ```
333
+ */
334
+ details?: GateResultDetails;
335
+ /**
336
+ * Short plain-text evidence snippet shown in failure messages.
337
+ *
338
+ * Kept for backward compatibility with existing persisted records and
339
+ * display code that reads this field as a truncated summary.
340
+ * New code should prefer {@link details}.
341
+ */
245
342
  evidence?: string;
246
343
  /** Error message when `result` is `"error"` (the gate runner itself crashed). */
247
344
  errorMessage?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"acceptance-gate.d.ts","sourceRoot":"","sources":["../src/acceptance-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,yCAAyC;AACzC,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;;GAIG;AACH,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9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AI,EAAE,QAAQ,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAIN;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,IAAI,EAAE,kBAAkB,CAAC;IACzB,qCAAqC;IACrC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvD,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Zod validation schemas for {@link EvidenceRecord} and its variants.
3
+ *
4
+ * Kept in a separate file from the plain TypeScript types so that consumers
5
+ * that do not need runtime validation (e.g. type-only imports) pay zero cost.
6
+ *
7
+ * All schemas are named `*RecordSchema` and derive their inferred types from
8
+ * the canonical TypeScript interfaces in `./evidence-record.ts`.
9
+ *
10
+ * The top-level {@link evidenceRecordSchema} is a `z.discriminatedUnion` on
11
+ * `"kind"` so Zod can route to the correct variant in O(1).
12
+ *
13
+ * @epic T810
14
+ * @task T816
15
+ */
16
+ import { z } from 'zod';
17
+ /**
18
+ * Zod schema for {@link ImplDiffRecord}.
19
+ *
20
+ * Validates that `filesChanged` is a non-empty array and that `linesAdded` /
21
+ * `linesRemoved` are non-negative integers.
22
+ */
23
+ export declare const implDiffRecordSchema: z.ZodObject<{
24
+ agentIdentity: z.ZodString;
25
+ attachmentSha256: z.ZodString;
26
+ ranAt: z.ZodString;
27
+ durationMs: z.ZodNumber;
28
+ kind: z.ZodLiteral<"impl-diff">;
29
+ phase: z.ZodLiteral<"implement">;
30
+ filesChanged: z.ZodArray<z.ZodString>;
31
+ linesAdded: z.ZodNumber;
32
+ linesRemoved: z.ZodNumber;
33
+ }, z.core.$strip>;
34
+ /** Inferred TypeScript type from {@link implDiffRecordSchema}. */
35
+ export type ImplDiffRecordInput = z.input<typeof implDiffRecordSchema>;
36
+ /**
37
+ * Zod schema for {@link ValidateSpecCheckRecord}.
38
+ *
39
+ * Validates that `reqIdsChecked` is non-empty and `details` is non-blank.
40
+ */
41
+ export declare const validateSpecCheckRecordSchema: z.ZodObject<{
42
+ agentIdentity: z.ZodString;
43
+ attachmentSha256: z.ZodString;
44
+ ranAt: z.ZodString;
45
+ durationMs: z.ZodNumber;
46
+ kind: z.ZodLiteral<"validate-spec-check">;
47
+ phase: z.ZodLiteral<"validate">;
48
+ reqIdsChecked: z.ZodArray<z.ZodString>;
49
+ passed: z.ZodBoolean;
50
+ details: z.ZodString;
51
+ }, z.core.$strip>;
52
+ /** Inferred TypeScript type from {@link validateSpecCheckRecordSchema}. */
53
+ export type ValidateSpecCheckRecordInput = z.input<typeof validateSpecCheckRecordSchema>;
54
+ /**
55
+ * Zod schema for {@link TestOutputRecord}.
56
+ *
57
+ * Validates that `command` is non-blank and test counts are non-negative.
58
+ */
59
+ export declare const testOutputRecordSchema: z.ZodObject<{
60
+ agentIdentity: z.ZodString;
61
+ attachmentSha256: z.ZodString;
62
+ ranAt: z.ZodString;
63
+ durationMs: z.ZodNumber;
64
+ kind: z.ZodLiteral<"test-output">;
65
+ phase: z.ZodLiteral<"test">;
66
+ command: z.ZodString;
67
+ exitCode: z.ZodNumber;
68
+ testsPassed: z.ZodNumber;
69
+ testsFailed: z.ZodNumber;
70
+ }, z.core.$strip>;
71
+ /** Inferred TypeScript type from {@link testOutputRecordSchema}. */
72
+ export type TestOutputRecordInput = z.input<typeof testOutputRecordSchema>;
73
+ /**
74
+ * Zod schema for {@link LintReportRecord}.
75
+ *
76
+ * `phase` is restricted to `'implement' | 'test'`.
77
+ * `warnings` and `errors` are non-negative integers.
78
+ */
79
+ export declare const lintReportRecordSchema: z.ZodObject<{
80
+ agentIdentity: z.ZodString;
81
+ attachmentSha256: z.ZodString;
82
+ ranAt: z.ZodString;
83
+ durationMs: z.ZodNumber;
84
+ kind: z.ZodLiteral<"lint-report">;
85
+ phase: z.ZodEnum<{
86
+ test: "test";
87
+ implement: "implement";
88
+ }>;
89
+ tool: z.ZodString;
90
+ passed: z.ZodBoolean;
91
+ warnings: z.ZodNumber;
92
+ errors: z.ZodNumber;
93
+ }, z.core.$strip>;
94
+ /** Inferred TypeScript type from {@link lintReportRecordSchema}. */
95
+ export type LintReportRecordInput = z.input<typeof lintReportRecordSchema>;
96
+ /**
97
+ * Zod schema for {@link CommandOutputRecord}.
98
+ *
99
+ * `phase` can be `'implement'`, `'validate'`, or `'test'`.
100
+ * `cmd` must be non-blank.
101
+ */
102
+ export declare const commandOutputRecordSchema: z.ZodObject<{
103
+ agentIdentity: z.ZodString;
104
+ attachmentSha256: z.ZodString;
105
+ ranAt: z.ZodString;
106
+ durationMs: z.ZodNumber;
107
+ kind: z.ZodLiteral<"command-output">;
108
+ phase: z.ZodEnum<{
109
+ test: "test";
110
+ implement: "implement";
111
+ validate: "validate";
112
+ }>;
113
+ cmd: z.ZodString;
114
+ exitCode: z.ZodNumber;
115
+ }, z.core.$strip>;
116
+ /** Inferred TypeScript type from {@link commandOutputRecordSchema}. */
117
+ export type CommandOutputRecordInput = z.input<typeof commandOutputRecordSchema>;
118
+ /**
119
+ * Zod discriminated-union schema for {@link EvidenceRecord}.
120
+ *
121
+ * Uses `z.discriminatedUnion('kind', [...])` for O(1) variant lookup.
122
+ * Parse with `evidenceRecordSchema.parse(input)` or
123
+ * `evidenceRecordSchema.safeParse(input)`.
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * const rec = evidenceRecordSchema.parse({
128
+ * kind: 'test-output',
129
+ * phase: 'test',
130
+ * agentIdentity: 'T816-worker',
131
+ * attachmentSha256: 'a'.repeat(64),
132
+ * command: 'pnpm test',
133
+ * exitCode: 0,
134
+ * testsPassed: 10,
135
+ * testsFailed: 0,
136
+ * ranAt: '2026-04-16T00:00:00.000Z',
137
+ * durationMs: 1234,
138
+ * });
139
+ * ```
140
+ */
141
+ export declare const evidenceRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
142
+ agentIdentity: z.ZodString;
143
+ attachmentSha256: z.ZodString;
144
+ ranAt: z.ZodString;
145
+ durationMs: z.ZodNumber;
146
+ kind: z.ZodLiteral<"impl-diff">;
147
+ phase: z.ZodLiteral<"implement">;
148
+ filesChanged: z.ZodArray<z.ZodString>;
149
+ linesAdded: z.ZodNumber;
150
+ linesRemoved: z.ZodNumber;
151
+ }, z.core.$strip>, z.ZodObject<{
152
+ agentIdentity: z.ZodString;
153
+ attachmentSha256: z.ZodString;
154
+ ranAt: z.ZodString;
155
+ durationMs: z.ZodNumber;
156
+ kind: z.ZodLiteral<"validate-spec-check">;
157
+ phase: z.ZodLiteral<"validate">;
158
+ reqIdsChecked: z.ZodArray<z.ZodString>;
159
+ passed: z.ZodBoolean;
160
+ details: z.ZodString;
161
+ }, z.core.$strip>, z.ZodObject<{
162
+ agentIdentity: z.ZodString;
163
+ attachmentSha256: z.ZodString;
164
+ ranAt: z.ZodString;
165
+ durationMs: z.ZodNumber;
166
+ kind: z.ZodLiteral<"test-output">;
167
+ phase: z.ZodLiteral<"test">;
168
+ command: z.ZodString;
169
+ exitCode: z.ZodNumber;
170
+ testsPassed: z.ZodNumber;
171
+ testsFailed: z.ZodNumber;
172
+ }, z.core.$strip>, z.ZodObject<{
173
+ agentIdentity: z.ZodString;
174
+ attachmentSha256: z.ZodString;
175
+ ranAt: z.ZodString;
176
+ durationMs: z.ZodNumber;
177
+ kind: z.ZodLiteral<"lint-report">;
178
+ phase: z.ZodEnum<{
179
+ test: "test";
180
+ implement: "implement";
181
+ }>;
182
+ tool: z.ZodString;
183
+ passed: z.ZodBoolean;
184
+ warnings: z.ZodNumber;
185
+ errors: z.ZodNumber;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ agentIdentity: z.ZodString;
188
+ attachmentSha256: z.ZodString;
189
+ ranAt: z.ZodString;
190
+ durationMs: z.ZodNumber;
191
+ kind: z.ZodLiteral<"command-output">;
192
+ phase: z.ZodEnum<{
193
+ test: "test";
194
+ implement: "implement";
195
+ validate: "validate";
196
+ }>;
197
+ cmd: z.ZodString;
198
+ exitCode: z.ZodNumber;
199
+ }, z.core.$strip>], "kind">;
200
+ /** Inferred TypeScript type from {@link evidenceRecordSchema}. */
201
+ export type EvidenceRecordInput = z.input<typeof evidenceRecordSchema>;
202
+ //# sourceMappingURL=evidence-record-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-record-schema.d.ts","sourceRoot":"","sources":["../src/evidence-record-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAM/B,CAAC;AAEH,kEAAkE;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;iBAMxC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAOjC,CAAC;AAEH,oEAAoE;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;iBAOjC,CAAC;AAEH,oEAAoE;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;iBAKpC,CAAC;AAEH,uEAAuE;AACvE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAIjF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAM/B,CAAC;AAEH,kEAAkE;AAClE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Zod validation schemas for {@link EvidenceRecord} and its variants.
3
+ *
4
+ * Kept in a separate file from the plain TypeScript types so that consumers
5
+ * that do not need runtime validation (e.g. type-only imports) pay zero cost.
6
+ *
7
+ * All schemas are named `*RecordSchema` and derive their inferred types from
8
+ * the canonical TypeScript interfaces in `./evidence-record.ts`.
9
+ *
10
+ * The top-level {@link evidenceRecordSchema} is a `z.discriminatedUnion` on
11
+ * `"kind"` so Zod can route to the correct variant in O(1).
12
+ *
13
+ * @epic T810
14
+ * @task T816
15
+ */
16
+ import { z } from 'zod';
17
+ // ─── Shared base fields ───────────────────────────────────────────────────────
18
+ /**
19
+ * Zod schema for the provenance fields shared by every EvidenceRecord variant.
20
+ *
21
+ * Not exported as a standalone validator; always composed into a full record
22
+ * schema via `.extend()`.
23
+ */
24
+ const evidenceBaseSchema = z.object({
25
+ /** Identity string of the agent that produced this record. */
26
+ agentIdentity: z.string().min(1),
27
+ /** SHA-256 hex digest (64 chars) of the attached artifact. */
28
+ attachmentSha256: z.string().length(64),
29
+ /** ISO 8601 timestamp at which the action ran. */
30
+ ranAt: z.string().datetime(),
31
+ /** Wall-clock duration of the action in milliseconds. */
32
+ durationMs: z.number().nonnegative(),
33
+ });
34
+ // ─── Individual variant schemas ───────────────────────────────────────────────
35
+ /**
36
+ * Zod schema for {@link ImplDiffRecord}.
37
+ *
38
+ * Validates that `filesChanged` is a non-empty array and that `linesAdded` /
39
+ * `linesRemoved` are non-negative integers.
40
+ */
41
+ export const implDiffRecordSchema = evidenceBaseSchema.extend({
42
+ kind: z.literal('impl-diff'),
43
+ phase: z.literal('implement'),
44
+ filesChanged: z.array(z.string().min(1)).min(1),
45
+ linesAdded: z.number().int().nonnegative(),
46
+ linesRemoved: z.number().int().nonnegative(),
47
+ });
48
+ /**
49
+ * Zod schema for {@link ValidateSpecCheckRecord}.
50
+ *
51
+ * Validates that `reqIdsChecked` is non-empty and `details` is non-blank.
52
+ */
53
+ export const validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
54
+ kind: z.literal('validate-spec-check'),
55
+ phase: z.literal('validate'),
56
+ reqIdsChecked: z.array(z.string().min(1)).min(1),
57
+ passed: z.boolean(),
58
+ details: z.string().min(1),
59
+ });
60
+ /**
61
+ * Zod schema for {@link TestOutputRecord}.
62
+ *
63
+ * Validates that `command` is non-blank and test counts are non-negative.
64
+ */
65
+ export const testOutputRecordSchema = evidenceBaseSchema.extend({
66
+ kind: z.literal('test-output'),
67
+ phase: z.literal('test'),
68
+ command: z.string().min(1),
69
+ exitCode: z.number().int(),
70
+ testsPassed: z.number().int().nonnegative(),
71
+ testsFailed: z.number().int().nonnegative(),
72
+ });
73
+ /**
74
+ * Zod schema for {@link LintReportRecord}.
75
+ *
76
+ * `phase` is restricted to `'implement' | 'test'`.
77
+ * `warnings` and `errors` are non-negative integers.
78
+ */
79
+ export const lintReportRecordSchema = evidenceBaseSchema.extend({
80
+ kind: z.literal('lint-report'),
81
+ phase: z.enum(['implement', 'test']),
82
+ tool: z.string().min(1),
83
+ passed: z.boolean(),
84
+ warnings: z.number().int().nonnegative(),
85
+ errors: z.number().int().nonnegative(),
86
+ });
87
+ /**
88
+ * Zod schema for {@link CommandOutputRecord}.
89
+ *
90
+ * `phase` can be `'implement'`, `'validate'`, or `'test'`.
91
+ * `cmd` must be non-blank.
92
+ */
93
+ export const commandOutputRecordSchema = evidenceBaseSchema.extend({
94
+ kind: z.literal('command-output'),
95
+ phase: z.enum(['implement', 'validate', 'test']),
96
+ cmd: z.string().min(1),
97
+ exitCode: z.number().int(),
98
+ });
99
+ // ─── Discriminated union ──────────────────────────────────────────────────────
100
+ /**
101
+ * Zod discriminated-union schema for {@link EvidenceRecord}.
102
+ *
103
+ * Uses `z.discriminatedUnion('kind', [...])` for O(1) variant lookup.
104
+ * Parse with `evidenceRecordSchema.parse(input)` or
105
+ * `evidenceRecordSchema.safeParse(input)`.
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const rec = evidenceRecordSchema.parse({
110
+ * kind: 'test-output',
111
+ * phase: 'test',
112
+ * agentIdentity: 'T816-worker',
113
+ * attachmentSha256: 'a'.repeat(64),
114
+ * command: 'pnpm test',
115
+ * exitCode: 0,
116
+ * testsPassed: 10,
117
+ * testsFailed: 0,
118
+ * ranAt: '2026-04-16T00:00:00.000Z',
119
+ * durationMs: 1234,
120
+ * });
121
+ * ```
122
+ */
123
+ export const evidenceRecordSchema = z.discriminatedUnion('kind', [
124
+ implDiffRecordSchema,
125
+ validateSpecCheckRecordSchema,
126
+ testOutputRecordSchema,
127
+ lintReportRecordSchema,
128
+ commandOutputRecordSchema,
129
+ ]);
130
+ //# sourceMappingURL=evidence-record-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-record-schema.js","sourceRoot":"","sources":["../src/evidence-record-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;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AC,MAAM,CAAC;IACjE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;CAC3B,CAAC,CAAC;AAKH,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,oBAAoB;IACpB,6BAA6B;IAC7B,sBAAsB;IACtB,sBAAsB;IACtB,yBAAyB;CAC1B,CAAC,CAAC"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * EvidenceRecord discriminated union — typed proof artifacts produced by IVTR agents.
3
+ *
4
+ * Each variant represents a specific kind of evidence that an IVTR-phase agent
5
+ * (implement, validate, test) can emit. All variants share a common set of
6
+ * provenance fields (`agentIdentity`, `attachmentSha256`, `ranAt`, `durationMs`)
7
+ * so that evidence rows can be queried, correlated, and archived uniformly.
8
+ *
9
+ * Five kinds are defined:
10
+ * - `impl-diff` — a code change produced by an implement-phase agent
11
+ * - `validate-spec-check` — a spec-requirements check by a validate-phase agent
12
+ * - `test-output` — the output of a test command run by a test-phase agent
13
+ * - `lint-report` — a static-analysis run (biome, tsc, etc.)
14
+ * - `command-output` — a generic CLI command invocation with exit code
15
+ *
16
+ * @epic T810
17
+ * @task T816
18
+ * @see {@link EvidenceRecordKind} for all discriminant values
19
+ */
20
+ /**
21
+ * Evidence that an implement-phase agent produced a code diff.
22
+ *
23
+ * `filesChanged` lists the relative paths of every modified file.
24
+ * `attachmentSha256` is the SHA-256 hex digest of the serialised diff attachment.
25
+ */
26
+ export interface ImplDiffRecord {
27
+ kind: 'impl-diff';
28
+ /** RCASD lifecycle phase that produced this record. */
29
+ phase: 'implement';
30
+ /** Identity string of the agent that ran this action (e.g. `"T816-worker"`). */
31
+ agentIdentity: string;
32
+ /** SHA-256 hex digest (64 chars) of the attached diff blob. */
33
+ attachmentSha256: string;
34
+ /** Relative paths of every file the diff touches. */
35
+ filesChanged: string[];
36
+ /** Net lines added across all changed files. */
37
+ linesAdded: number;
38
+ /** Net lines removed across all changed files. */
39
+ linesRemoved: number;
40
+ /** ISO 8601 timestamp at which the diff was captured. */
41
+ ranAt: string;
42
+ /** Wall-clock duration of the implement action in milliseconds. */
43
+ durationMs: number;
44
+ }
45
+ /**
46
+ * Evidence that a validate-phase agent checked one or more REQ-IDs against
47
+ * the implementation and recorded a pass/fail verdict.
48
+ */
49
+ export interface ValidateSpecCheckRecord {
50
+ kind: 'validate-spec-check';
51
+ /** RCASD lifecycle phase that produced this record. */
52
+ phase: 'validate';
53
+ /** Identity string of the agent that ran this action. */
54
+ agentIdentity: string;
55
+ /** SHA-256 hex digest (64 chars) of the spec-check report attachment. */
56
+ attachmentSha256: string;
57
+ /** REQ-IDs checked in this run (e.g. `["IVTR-01", "IVTR-02"]`). */
58
+ reqIdsChecked: string[];
59
+ /** `true` when all checked REQ-IDs passed; `false` if any failed. */
60
+ passed: boolean;
61
+ /** Human-readable summary of results per REQ-ID. */
62
+ details: string;
63
+ /** ISO 8601 timestamp at which the check ran. */
64
+ ranAt: string;
65
+ /** Wall-clock duration of the validation check in milliseconds. */
66
+ durationMs: number;
67
+ }
68
+ /**
69
+ * Evidence that a test-phase agent ran a test command and recorded counts.
70
+ */
71
+ export interface TestOutputRecord {
72
+ kind: 'test-output';
73
+ /** RCASD lifecycle phase that produced this record. */
74
+ phase: 'test';
75
+ /** Identity string of the agent that ran this action. */
76
+ agentIdentity: string;
77
+ /** SHA-256 hex digest (64 chars) of the test-output attachment. */
78
+ attachmentSha256: string;
79
+ /** The full test command that was executed (e.g. `"pnpm --filter @cleocode/contracts run test"`). */
80
+ command: string;
81
+ /** Exit code returned by the test command. */
82
+ exitCode: number;
83
+ /** Number of individual test cases that passed. */
84
+ testsPassed: number;
85
+ /** Number of individual test cases that failed. */
86
+ testsFailed: number;
87
+ /** ISO 8601 timestamp at which the test command started. */
88
+ ranAt: string;
89
+ /** Wall-clock duration of the full test run in milliseconds. */
90
+ durationMs: number;
91
+ }
92
+ /**
93
+ * Evidence that a lint / static-analysis tool was run.
94
+ *
95
+ * The `phase` field is `'implement' | 'test'` because lint is commonly run
96
+ * after a code change (implement) or as part of a test suite (test).
97
+ */
98
+ export interface LintReportRecord {
99
+ kind: 'lint-report';
100
+ /** RCASD lifecycle phase that produced this record. */
101
+ phase: 'implement' | 'test';
102
+ /** Identity string of the agent that ran this action. */
103
+ agentIdentity: string;
104
+ /** SHA-256 hex digest (64 chars) of the lint-output attachment. */
105
+ attachmentSha256: string;
106
+ /** Name of the lint tool that was invoked (e.g. `"biome"`, `"tsc"`). */
107
+ tool: string;
108
+ /** `true` when the lint run produced zero errors. */
109
+ passed: boolean;
110
+ /** Number of warnings emitted (may be > 0 even when `passed` is `true`). */
111
+ warnings: number;
112
+ /** Number of errors emitted. Non-zero means `passed` is `false`. */
113
+ errors: number;
114
+ /** ISO 8601 timestamp at which the lint tool was invoked. */
115
+ ranAt: string;
116
+ /** Wall-clock duration of the lint run in milliseconds. */
117
+ durationMs: number;
118
+ }
119
+ /**
120
+ * Evidence that an agent ran an arbitrary CLI command and recorded its exit code.
121
+ *
122
+ * Use this as the catch-all when none of the other variants fit.
123
+ */
124
+ export interface CommandOutputRecord {
125
+ kind: 'command-output';
126
+ /** RCASD lifecycle phase that produced this record. */
127
+ phase: 'implement' | 'validate' | 'test';
128
+ /** Identity string of the agent that ran this action. */
129
+ agentIdentity: string;
130
+ /** SHA-256 hex digest (64 chars) of the command-output attachment. */
131
+ attachmentSha256: string;
132
+ /** The CLI command that was executed. */
133
+ cmd: string;
134
+ /** Exit code returned by the command. */
135
+ exitCode: number;
136
+ /** ISO 8601 timestamp at which the command was invoked. */
137
+ ranAt: string;
138
+ /** Wall-clock duration of the command in milliseconds. */
139
+ durationMs: number;
140
+ }
141
+ /**
142
+ * A typed evidence record produced by an IVTR-phase agent.
143
+ *
144
+ * The `kind` discriminant selects the variant. All variants carry
145
+ * `agentIdentity`, `attachmentSha256`, `ranAt`, and `durationMs` for
146
+ * uniform provenance tracking.
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * const rec: EvidenceRecord = {
151
+ * kind: 'test-output',
152
+ * phase: 'test',
153
+ * agentIdentity: 'T816-worker',
154
+ * attachmentSha256: 'a'.repeat(64),
155
+ * command: 'pnpm --filter @cleocode/contracts run test',
156
+ * exitCode: 0,
157
+ * testsPassed: 10,
158
+ * testsFailed: 0,
159
+ * ranAt: '2026-04-16T00:00:00.000Z',
160
+ * durationMs: 1234,
161
+ * };
162
+ * ```
163
+ */
164
+ export type EvidenceRecord = ImplDiffRecord | ValidateSpecCheckRecord | TestOutputRecord | LintReportRecord | CommandOutputRecord;
165
+ /** All valid `kind` discriminants for {@link EvidenceRecord}. */
166
+ export type EvidenceRecordKind = EvidenceRecord['kind'];
167
+ //# sourceMappingURL=evidence-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence-record.d.ts","sourceRoot":"","sources":["../src/evidence-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,uDAAuD;IACvD,KAAK,EAAE,WAAW,CAAC;IACnB,gFAAgF;IAChF,aAAa,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,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