@cleocode/contracts 2026.5.111 → 2026.5.113

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 (118) hide show
  1. package/dist/__tests__/cli-meta-suggested-next.test.d.ts +21 -0
  2. package/dist/__tests__/cli-meta-suggested-next.test.d.ts.map +1 -0
  3. package/dist/__tests__/cli-meta-suggested-next.test.js +70 -0
  4. package/dist/__tests__/cli-meta-suggested-next.test.js.map +1 -0
  5. package/dist/__tests__/evidence-atom-schema.test.d.ts +16 -0
  6. package/dist/__tests__/evidence-atom-schema.test.d.ts.map +1 -0
  7. package/dist/__tests__/evidence-atom-schema.test.js +394 -0
  8. package/dist/__tests__/evidence-atom-schema.test.js.map +1 -0
  9. package/dist/config/__tests__/manifest.test.d.ts +13 -0
  10. package/dist/config/__tests__/manifest.test.d.ts.map +1 -0
  11. package/dist/config/__tests__/manifest.test.js +143 -0
  12. package/dist/config/__tests__/manifest.test.js.map +1 -0
  13. package/dist/config/manifest.d.ts +158 -0
  14. package/dist/config/manifest.d.ts.map +1 -0
  15. package/dist/config/manifest.js +123 -0
  16. package/dist/config/manifest.js.map +1 -0
  17. package/dist/docs/__tests__/provenance.test.d.ts +14 -0
  18. package/dist/docs/__tests__/provenance.test.d.ts.map +1 -0
  19. package/dist/docs/__tests__/provenance.test.js +579 -0
  20. package/dist/docs/__tests__/provenance.test.js.map +1 -0
  21. package/dist/docs/provenance.d.ts +731 -0
  22. package/dist/docs/provenance.d.ts.map +1 -0
  23. package/dist/docs/provenance.js +258 -0
  24. package/dist/docs/provenance.js.map +1 -0
  25. package/dist/docs-taxonomy.d.ts +24 -0
  26. package/dist/docs-taxonomy.d.ts.map +1 -1
  27. package/dist/docs-taxonomy.js +27 -0
  28. package/dist/docs-taxonomy.js.map +1 -1
  29. package/dist/doctor.d.ts +101 -0
  30. package/dist/doctor.d.ts.map +1 -1
  31. package/dist/errors.d.ts +4 -0
  32. package/dist/errors.d.ts.map +1 -1
  33. package/dist/errors.js +4 -0
  34. package/dist/errors.js.map +1 -1
  35. package/dist/evidence-atom-schema.d.ts +407 -0
  36. package/dist/evidence-atom-schema.d.ts.map +1 -0
  37. package/dist/evidence-atom-schema.js +505 -0
  38. package/dist/evidence-atom-schema.js.map +1 -0
  39. package/dist/exit-codes.d.ts +37 -0
  40. package/dist/exit-codes.d.ts.map +1 -1
  41. package/dist/exit-codes.js +37 -0
  42. package/dist/exit-codes.js.map +1 -1
  43. package/dist/index.d.ts +13 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +8 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/invariants/__tests__/adr-056-release.test.d.ts +16 -0
  48. package/dist/invariants/__tests__/adr-056-release.test.d.ts.map +1 -0
  49. package/dist/invariants/__tests__/adr-056-release.test.js +88 -0
  50. package/dist/invariants/__tests__/adr-056-release.test.js.map +1 -0
  51. package/dist/invariants/__tests__/adr-070-orchestration.test.d.ts +22 -0
  52. package/dist/invariants/__tests__/adr-070-orchestration.test.d.ts.map +1 -0
  53. package/dist/invariants/__tests__/adr-070-orchestration.test.js +151 -0
  54. package/dist/invariants/__tests__/adr-070-orchestration.test.js.map +1 -0
  55. package/dist/invariants/__tests__/registry.test.d.ts +14 -0
  56. package/dist/invariants/__tests__/registry.test.d.ts.map +1 -0
  57. package/dist/invariants/__tests__/registry.test.js +113 -0
  58. package/dist/invariants/__tests__/registry.test.js.map +1 -0
  59. package/dist/invariants/adr-056-release.d.ts +42 -0
  60. package/dist/invariants/adr-056-release.d.ts.map +1 -0
  61. package/dist/invariants/adr-056-release.js +143 -0
  62. package/dist/invariants/adr-056-release.js.map +1 -0
  63. package/dist/invariants/adr-070-orchestration.d.ts +73 -0
  64. package/dist/invariants/adr-070-orchestration.d.ts.map +1 -0
  65. package/dist/invariants/adr-070-orchestration.js +290 -0
  66. package/dist/invariants/adr-070-orchestration.js.map +1 -0
  67. package/dist/invariants/adr-073-saga.d.ts +32 -0
  68. package/dist/invariants/adr-073-saga.d.ts.map +1 -0
  69. package/dist/invariants/adr-073-saga.js +155 -0
  70. package/dist/invariants/adr-073-saga.js.map +1 -0
  71. package/dist/invariants/index.d.ts +162 -0
  72. package/dist/invariants/index.d.ts.map +1 -0
  73. package/dist/invariants/index.js +118 -0
  74. package/dist/invariants/index.js.map +1 -0
  75. package/dist/operations/__tests__/input-contract.test.d.ts +20 -0
  76. package/dist/operations/__tests__/input-contract.test.d.ts.map +1 -0
  77. package/dist/operations/__tests__/input-contract.test.js +158 -0
  78. package/dist/operations/__tests__/input-contract.test.js.map +1 -0
  79. package/dist/operations/docs.d.ts +16 -0
  80. package/dist/operations/docs.d.ts.map +1 -1
  81. package/dist/operations/input-contract.d.ts +267 -0
  82. package/dist/operations/input-contract.d.ts.map +1 -0
  83. package/dist/operations/input-contract.js +29 -0
  84. package/dist/operations/input-contract.js.map +1 -0
  85. package/dist/templates/__tests__/manifest.test.d.ts +18 -0
  86. package/dist/templates/__tests__/manifest.test.d.ts.map +1 -0
  87. package/dist/templates/__tests__/manifest.test.js +123 -0
  88. package/dist/templates/__tests__/manifest.test.js.map +1 -0
  89. package/dist/templates/manifest.d.ts +186 -0
  90. package/dist/templates/manifest.d.ts.map +1 -0
  91. package/dist/templates/manifest.js +165 -0
  92. package/dist/templates/manifest.js.map +1 -0
  93. package/package.json +2 -2
  94. package/src/__tests__/cli-meta-suggested-next.test.ts +76 -0
  95. package/src/__tests__/evidence-atom-schema.test.ts +499 -0
  96. package/src/config/__tests__/manifest.test.ts +176 -0
  97. package/src/config/manifest.ts +218 -0
  98. package/src/docs/__tests__/__snapshots__/provenance.test.ts.snap +252 -0
  99. package/src/docs/__tests__/provenance.test.ts +648 -0
  100. package/src/docs/provenance.ts +601 -0
  101. package/src/docs-taxonomy.ts +55 -0
  102. package/src/doctor.ts +111 -0
  103. package/src/errors.ts +4 -0
  104. package/src/evidence-atom-schema.ts +628 -0
  105. package/src/exit-codes.ts +39 -0
  106. package/src/index.ts +129 -0
  107. package/src/invariants/__tests__/adr-056-release.test.ts +102 -0
  108. package/src/invariants/__tests__/adr-070-orchestration.test.ts +186 -0
  109. package/src/invariants/__tests__/registry.test.ts +136 -0
  110. package/src/invariants/adr-056-release.ts +154 -0
  111. package/src/invariants/adr-070-orchestration.ts +317 -0
  112. package/src/invariants/adr-073-saga.ts +167 -0
  113. package/src/invariants/index.ts +222 -0
  114. package/src/operations/__tests__/input-contract.test.ts +188 -0
  115. package/src/operations/docs.ts +16 -0
  116. package/src/operations/input-contract.ts +301 -0
  117. package/src/templates/__tests__/manifest.test.ts +140 -0
  118. package/src/templates/manifest.ts +208 -0
@@ -0,0 +1,731 @@
1
+ /**
2
+ * Docs Provenance Graph contract — cross-entity nodes + edges.
3
+ *
4
+ * Typed shape for the cross-entity provenance graph returned by C7
5
+ * (`cleo docs provenance` / `cleo docs graph`). A {@link DocProvenanceResponse}
6
+ * is the wire format consumed by the human renderer registered for the
7
+ * `(command='docs', kind='provenance')` slot — the same renderer family that
8
+ * consumes {@link TreeResponse} envelopes from E11.
9
+ *
10
+ * Nodes carry a `kind` discriminator (`doc` | `task` | `decision` | `session` |
11
+ * `memory`) so the renderer can pick the correct icon, colour, and detail
12
+ * layout per entity. Edges carry a `relation` discriminator that names the
13
+ * semantic link between two nodes (`attached-to`, `supersedes`,
14
+ * `superseded-by`, `related-task`, `linked-decision`, `derived-from`).
15
+ *
16
+ * This contract is intentionally read-only — every field is `readonly`, every
17
+ * array is `ReadonlyArray<…>` — so consumers cannot mutate the graph after
18
+ * receiving it from `cleo docs provenance`. Mutations flow through writer
19
+ * verbs (`cleo docs add`, `cleo docs supersede`, …) and emit a fresh graph on
20
+ * the next read.
21
+ *
22
+ * @see TreeResponse — E11 T10138 — the sibling envelope shape this contract
23
+ * composes with (a docs provenance UI may render the doc-subset as a tree).
24
+ * @see DocKindRegistry — packages/contracts/src/docs-taxonomy.ts — supplies
25
+ * the `kind` string carried on each {@link ProvenanceDocNode}.
26
+ * @see ADR-077 §3 — Human Render Contract (envelope kind discriminator).
27
+ * @see ADR-078 — Docs Provenance Graph (cross-entity edge taxonomy).
28
+ *
29
+ * @epic T10157 — Docs Provenance Graph (E12)
30
+ * @task T10166
31
+ */
32
+ import { z } from 'zod';
33
+ /**
34
+ * Discriminator for the entity kind a {@link ProvenanceNode} represents.
35
+ *
36
+ * - `doc` — a canonical document (ADR, spec, research note, …)
37
+ * - `task` — a CLEO task / epic / saga / subtask
38
+ * - `decision` — a BRAIN decision record
39
+ * - `session` — an agent session journal
40
+ * - `memory` — a BRAIN memory observation
41
+ *
42
+ * The string set is closed — extending it requires a new ADR and an additive
43
+ * migration so that older consumers fail-closed on unknown variants rather
44
+ * than silently dropping the node.
45
+ *
46
+ * @task T10166
47
+ */
48
+ export type ProvenanceNodeKind = 'doc' | 'task' | 'decision' | 'session' | 'memory';
49
+ /**
50
+ * Frozen const array backing {@link ProvenanceNodeKind} — used by the Zod
51
+ * enum schema and by exhaustiveness checks in switch statements.
52
+ *
53
+ * @task T10166
54
+ */
55
+ export declare const PROVENANCE_NODE_KINDS: readonly ["doc", "task", "decision", "session", "memory"];
56
+ /**
57
+ * Semantic relationship between two provenance nodes.
58
+ *
59
+ * - `attached-to` — child is attached to parent (doc attached to task, …)
60
+ * - `supersedes` — child supersedes parent (newer doc replaces older)
61
+ * - `superseded-by` — child is superseded by parent (reverse of `supersedes`)
62
+ * - `related-task` — child task is related (non-parent) to parent
63
+ * - `linked-decision` — node references a BRAIN decision
64
+ * - `derived-from` — node was derived from a prior artifact
65
+ *
66
+ * @task T10166
67
+ */
68
+ export type ProvenanceEdgeRelation = 'attached-to' | 'supersedes' | 'superseded-by' | 'related-task' | 'linked-decision' | 'derived-from';
69
+ /**
70
+ * Frozen const array backing {@link ProvenanceEdgeRelation} — used by the
71
+ * Zod enum schema and by exhaustiveness checks.
72
+ *
73
+ * @task T10166
74
+ */
75
+ export declare const PROVENANCE_EDGE_RELATIONS: readonly ["attached-to", "supersedes", "superseded-by", "related-task", "linked-decision", "derived-from"];
76
+ /**
77
+ * Lifecycle status of a doc node — mirrors the canonical status union written
78
+ * by `cleo docs publish` / `cleo docs supersede`.
79
+ *
80
+ * - `active` — current canonical version
81
+ * - `superseded` — replaced by a newer doc (still readable for history)
82
+ * - `archived` — moved out of the active corpus (no successor)
83
+ * - `draft` — in-progress, not yet published
84
+ *
85
+ * @task T10166
86
+ */
87
+ export type DocLifecycleStatus = 'active' | 'superseded' | 'archived' | 'draft';
88
+ /**
89
+ * Frozen const array backing {@link DocLifecycleStatus}.
90
+ *
91
+ * @task T10166
92
+ */
93
+ export declare const DOC_LIFECYCLE_STATUSES: readonly ["active", "superseded", "archived", "draft"];
94
+ /**
95
+ * Fields shared by every {@link ProvenanceNode} variant.
96
+ *
97
+ * `id` is the entity-scoped identifier (e.g. doc slug, task ID `T1234`,
98
+ * decision ID, session ID, memory ID). `id` is unique within a single
99
+ * {@link DocProvenanceResponse} but NOT globally across kinds — two nodes
100
+ * with the same `id` but different `kind` are distinct entities.
101
+ *
102
+ * `metadata` is an opaque, caller-defined key/value bag. Renderers MUST
103
+ * NOT assume any specific keys are present.
104
+ */
105
+ interface ProvenanceNodeBase {
106
+ /** Stable, entity-scoped identifier. */
107
+ readonly id: string;
108
+ /** Display title — short enough to render on a single line. */
109
+ readonly title: string;
110
+ /** Opaque key/value bag the renderer may surface verbatim. */
111
+ readonly metadata?: Readonly<Record<string, unknown>>;
112
+ }
113
+ /**
114
+ * Provenance node representing a canonical document (ADR, spec, research, …).
115
+ *
116
+ * `kind` is the user-facing document classification from
117
+ * {@link DocKindMetadata.kind} (e.g. `adr`, `spec`, `research`).
118
+ * `slug` is the canonical slug that addresses the doc through the docs SSoT.
119
+ *
120
+ * @task T10166
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const node: ProvenanceDocNode = {
125
+ * kind: 'doc',
126
+ * id: 'adr-078-docs-provenance-graph',
127
+ * slug: 'adr-078-docs-provenance-graph',
128
+ * docKind: 'adr',
129
+ * title: 'ADR 078 — Docs Provenance Graph',
130
+ * lifecycleStatus: 'active',
131
+ * publishedAt: '2026-05-22T18:00:00.000Z',
132
+ * };
133
+ * ```
134
+ */
135
+ export interface ProvenanceDocNode extends ProvenanceNodeBase {
136
+ readonly kind: 'doc';
137
+ /** Canonical doc slug. */
138
+ readonly slug: string;
139
+ /** User-facing document classification (DocKind from docs-taxonomy). */
140
+ readonly docKind: string;
141
+ /** Lifecycle state of this doc. */
142
+ readonly lifecycleStatus: DocLifecycleStatus;
143
+ /** ISO-8601 timestamp this doc was first published. */
144
+ readonly publishedAt: string;
145
+ /** ISO-8601 timestamp this doc was superseded — set iff `lifecycleStatus === 'superseded'`. */
146
+ readonly supersededAt?: string;
147
+ /** Optional short summary surfaced by the renderer. */
148
+ readonly summary?: string;
149
+ }
150
+ /**
151
+ * Provenance node representing a CLEO task (saga / epic / task / subtask).
152
+ *
153
+ * `taskType` mirrors the canonical 4-tier hierarchy from ADR-073 so the
154
+ * renderer can pick the correct icon (Σ / E / T / □) per tier.
155
+ *
156
+ * @task T10166
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const node: ProvenanceTaskNode = {
161
+ * kind: 'task',
162
+ * id: 'T10166',
163
+ * title: 'C9: Provenance graph contract',
164
+ * taskType: 'task',
165
+ * status: 'in_progress',
166
+ * };
167
+ * ```
168
+ */
169
+ export interface ProvenanceTaskNode extends ProvenanceNodeBase {
170
+ readonly kind: 'task';
171
+ /** CLEO 4-tier task type. */
172
+ readonly taskType: 'saga' | 'epic' | 'task' | 'subtask';
173
+ /** Lifecycle status of the task. */
174
+ readonly status: 'pending' | 'in_progress' | 'done' | 'blocked' | 'cancelled' | 'archived';
175
+ }
176
+ /**
177
+ * Provenance node representing a BRAIN decision record.
178
+ *
179
+ * @task T10166
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * const node: ProvenanceDecisionNode = {
184
+ * kind: 'decision',
185
+ * id: 'D-arch-001',
186
+ * title: 'Adopt evidence-based gate ritual',
187
+ * outcome: 'accepted',
188
+ * decidedAt: '2026-04-12T14:30:00.000Z',
189
+ * };
190
+ * ```
191
+ */
192
+ export interface ProvenanceDecisionNode extends ProvenanceNodeBase {
193
+ readonly kind: 'decision';
194
+ /** Decision lifecycle outcome. */
195
+ readonly outcome: 'proposed' | 'accepted' | 'rejected' | 'superseded';
196
+ /** ISO-8601 timestamp the decision was last transitioned. */
197
+ readonly decidedAt: string;
198
+ }
199
+ /**
200
+ * Provenance node representing an agent session journal.
201
+ *
202
+ * @task T10166
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * const node: ProvenanceSessionNode = {
207
+ * kind: 'session',
208
+ * id: 'ses_2026-05-22_abc123',
209
+ * title: 'Session 2026-05-22 — T10166 implementation',
210
+ * startedAt: '2026-05-22T18:00:00.000Z',
211
+ * };
212
+ * ```
213
+ */
214
+ export interface ProvenanceSessionNode extends ProvenanceNodeBase {
215
+ readonly kind: 'session';
216
+ /** ISO-8601 timestamp the session started. */
217
+ readonly startedAt: string;
218
+ /** ISO-8601 timestamp the session ended — undefined while still active. */
219
+ readonly endedAt?: string;
220
+ }
221
+ /**
222
+ * Provenance node representing a BRAIN memory observation.
223
+ *
224
+ * @task T10166
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * const node: ProvenanceMemoryNode = {
229
+ * kind: 'memory',
230
+ * id: 'O-2026-05-22-001',
231
+ * title: 'Observed: spawn worker contention under parallel sessions',
232
+ * memoryType: 'observation',
233
+ * recordedAt: '2026-05-22T19:15:00.000Z',
234
+ * };
235
+ * ```
236
+ */
237
+ export interface ProvenanceMemoryNode extends ProvenanceNodeBase {
238
+ readonly kind: 'memory';
239
+ /** BRAIN memory classification. */
240
+ readonly memoryType: 'observation' | 'pattern' | 'decision' | 'diary';
241
+ /** ISO-8601 timestamp the memory was recorded. */
242
+ readonly recordedAt: string;
243
+ }
244
+ /**
245
+ * Discriminated union of every provenance node variant.
246
+ *
247
+ * Switch on `node.kind` for exhaustive narrowing — the `default` branch will
248
+ * be statically reachable iff the discriminator set is extended without
249
+ * updating consumers, which is the desired fail-loud behaviour.
250
+ *
251
+ * @task T10166
252
+ */
253
+ export type ProvenanceNode = ProvenanceDocNode | ProvenanceTaskNode | ProvenanceDecisionNode | ProvenanceSessionNode | ProvenanceMemoryNode;
254
+ /**
255
+ * One semantic edge in the provenance graph.
256
+ *
257
+ * `from` and `to` are the `id` fields of two {@link ProvenanceNode} entries.
258
+ * Because `id` is only unique within a `kind`, edges also reference the
259
+ * source and target node kinds so the renderer can resolve them
260
+ * unambiguously.
261
+ *
262
+ * @task T10166
263
+ *
264
+ * @example
265
+ * ```ts
266
+ * const edge: ProvenanceEdge = {
267
+ * relation: 'attached-to',
268
+ * from: 'adr-078-docs-provenance-graph',
269
+ * fromKind: 'doc',
270
+ * to: 'T10157',
271
+ * toKind: 'task',
272
+ * addedAt: '2026-05-22T18:00:00.000Z',
273
+ * };
274
+ * ```
275
+ */
276
+ export interface ProvenanceEdge {
277
+ /** Semantic relation between {@link from} and {@link to}. */
278
+ readonly relation: ProvenanceEdgeRelation;
279
+ /** Source node `id`. */
280
+ readonly from: string;
281
+ /** Source node `kind` — required to disambiguate `id` across kinds. */
282
+ readonly fromKind: ProvenanceNodeKind;
283
+ /** Target node `id`. */
284
+ readonly to: string;
285
+ /** Target node `kind` — required to disambiguate `id` across kinds. */
286
+ readonly toKind: ProvenanceNodeKind;
287
+ /** ISO-8601 timestamp this edge was first recorded. */
288
+ readonly addedAt: string;
289
+ /** Optional one-line caption surfaced by the renderer. */
290
+ readonly summary?: string;
291
+ }
292
+ /**
293
+ * Top-level wire envelope returned by `cleo docs provenance`.
294
+ *
295
+ * Carries a flat list of nodes + edges so the renderer (or a downstream
296
+ * consumer that wants to project the graph as a tree) can materialise the
297
+ * desired layout without an additional round trip.
298
+ *
299
+ * @task T10166
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * const response: DocProvenanceResponse = {
304
+ * nodes: [
305
+ * {
306
+ * kind: 'doc',
307
+ * id: 'adr-078-docs-provenance-graph',
308
+ * slug: 'adr-078-docs-provenance-graph',
309
+ * docKind: 'adr',
310
+ * title: 'ADR 078',
311
+ * lifecycleStatus: 'active',
312
+ * publishedAt: '2026-05-22T18:00:00.000Z',
313
+ * },
314
+ * { kind: 'task', id: 'T10157', title: 'Epic E12', taskType: 'epic', status: 'in_progress' },
315
+ * ],
316
+ * edges: [
317
+ * {
318
+ * relation: 'attached-to',
319
+ * from: 'adr-078-docs-provenance-graph',
320
+ * fromKind: 'doc',
321
+ * to: 'T10157',
322
+ * toKind: 'task',
323
+ * addedAt: '2026-05-22T18:00:00.000Z',
324
+ * },
325
+ * ],
326
+ * totalNodes: 2,
327
+ * totalEdges: 1,
328
+ * };
329
+ * ```
330
+ */
331
+ export interface DocProvenanceResponse {
332
+ /** Flat list of nodes. Order is renderer-defined — typically pre-order traversal of the doc subset. */
333
+ readonly nodes: ReadonlyArray<ProvenanceNode>;
334
+ /** Flat list of edges between the nodes. */
335
+ readonly edges: ReadonlyArray<ProvenanceEdge>;
336
+ /** Total node count — MUST equal `nodes.length`. */
337
+ readonly totalNodes: number;
338
+ /** Total edge count — MUST equal `edges.length`. */
339
+ readonly totalEdges: number;
340
+ }
341
+ /**
342
+ * Type guard — narrows a {@link ProvenanceNode} to {@link ProvenanceDocNode}.
343
+ *
344
+ * @task T10166
345
+ *
346
+ * @example
347
+ * ```ts
348
+ * for (const node of response.nodes) {
349
+ * if (isProvenanceDocNode(node)) {
350
+ * console.log(`doc: ${node.slug} (${node.lifecycleStatus})`);
351
+ * }
352
+ * }
353
+ * ```
354
+ */
355
+ export declare function isProvenanceDocNode(node: ProvenanceNode): node is ProvenanceDocNode;
356
+ /**
357
+ * Type guard — narrows a {@link ProvenanceNode} to {@link ProvenanceTaskNode}.
358
+ *
359
+ * @task T10166
360
+ */
361
+ export declare function isProvenanceTaskNode(node: ProvenanceNode): node is ProvenanceTaskNode;
362
+ /**
363
+ * Type guard — narrows a {@link ProvenanceNode} to {@link ProvenanceDecisionNode}.
364
+ *
365
+ * @task T10166
366
+ */
367
+ export declare function isProvenanceDecisionNode(node: ProvenanceNode): node is ProvenanceDecisionNode;
368
+ /**
369
+ * Type guard — narrows a {@link ProvenanceNode} to {@link ProvenanceSessionNode}.
370
+ *
371
+ * @task T10166
372
+ */
373
+ export declare function isProvenanceSessionNode(node: ProvenanceNode): node is ProvenanceSessionNode;
374
+ /**
375
+ * Type guard — narrows a {@link ProvenanceNode} to {@link ProvenanceMemoryNode}.
376
+ *
377
+ * @task T10166
378
+ */
379
+ export declare function isProvenanceMemoryNode(node: ProvenanceNode): node is ProvenanceMemoryNode;
380
+ /**
381
+ * Runtime envelope guard for {@link DocProvenanceResponse}.
382
+ *
383
+ * Verifies the envelope shape without inspecting individual node payloads —
384
+ * use the Zod schema for deep validation.
385
+ *
386
+ * @task T10166
387
+ */
388
+ export declare function isDocProvenanceResponse(value: unknown): value is DocProvenanceResponse;
389
+ /**
390
+ * Zod enum schema for {@link ProvenanceNodeKind}.
391
+ *
392
+ * @task T10166
393
+ */
394
+ export declare const provenanceNodeKindSchema: z.ZodEnum<{
395
+ task: "task";
396
+ session: "session";
397
+ decision: "decision";
398
+ memory: "memory";
399
+ doc: "doc";
400
+ }>;
401
+ /**
402
+ * Zod enum schema for {@link ProvenanceEdgeRelation}.
403
+ *
404
+ * @task T10166
405
+ */
406
+ export declare const provenanceEdgeRelationSchema: z.ZodEnum<{
407
+ supersedes: "supersedes";
408
+ "attached-to": "attached-to";
409
+ "superseded-by": "superseded-by";
410
+ "related-task": "related-task";
411
+ "linked-decision": "linked-decision";
412
+ "derived-from": "derived-from";
413
+ }>;
414
+ /**
415
+ * Zod enum schema for {@link DocLifecycleStatus}.
416
+ *
417
+ * @task T10166
418
+ */
419
+ export declare const docLifecycleStatusSchema: z.ZodEnum<{
420
+ active: "active";
421
+ archived: "archived";
422
+ superseded: "superseded";
423
+ draft: "draft";
424
+ }>;
425
+ /**
426
+ * Zod schema for {@link ProvenanceDocNode}.
427
+ *
428
+ * @task T10166
429
+ */
430
+ export declare const provenanceDocNodeSchema: z.ZodObject<{
431
+ kind: z.ZodLiteral<"doc">;
432
+ slug: z.ZodString;
433
+ docKind: z.ZodString;
434
+ lifecycleStatus: z.ZodEnum<{
435
+ active: "active";
436
+ archived: "archived";
437
+ superseded: "superseded";
438
+ draft: "draft";
439
+ }>;
440
+ publishedAt: z.ZodString;
441
+ supersededAt: z.ZodOptional<z.ZodString>;
442
+ summary: z.ZodOptional<z.ZodString>;
443
+ id: z.ZodString;
444
+ title: z.ZodString;
445
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
446
+ }, z.core.$strip>;
447
+ /**
448
+ * Zod schema for {@link ProvenanceTaskNode}.
449
+ *
450
+ * @task T10166
451
+ */
452
+ export declare const provenanceTaskNodeSchema: z.ZodObject<{
453
+ kind: z.ZodLiteral<"task">;
454
+ taskType: z.ZodEnum<{
455
+ epic: "epic";
456
+ task: "task";
457
+ subtask: "subtask";
458
+ saga: "saga";
459
+ }>;
460
+ status: z.ZodEnum<{
461
+ pending: "pending";
462
+ cancelled: "cancelled";
463
+ blocked: "blocked";
464
+ done: "done";
465
+ archived: "archived";
466
+ in_progress: "in_progress";
467
+ }>;
468
+ id: z.ZodString;
469
+ title: z.ZodString;
470
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
471
+ }, z.core.$strip>;
472
+ /**
473
+ * Zod schema for {@link ProvenanceDecisionNode}.
474
+ *
475
+ * @task T10166
476
+ */
477
+ export declare const provenanceDecisionNodeSchema: z.ZodObject<{
478
+ kind: z.ZodLiteral<"decision">;
479
+ outcome: z.ZodEnum<{
480
+ accepted: "accepted";
481
+ proposed: "proposed";
482
+ superseded: "superseded";
483
+ rejected: "rejected";
484
+ }>;
485
+ decidedAt: z.ZodString;
486
+ id: z.ZodString;
487
+ title: z.ZodString;
488
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
489
+ }, z.core.$strip>;
490
+ /**
491
+ * Zod schema for {@link ProvenanceSessionNode}.
492
+ *
493
+ * @task T10166
494
+ */
495
+ export declare const provenanceSessionNodeSchema: z.ZodObject<{
496
+ kind: z.ZodLiteral<"session">;
497
+ startedAt: z.ZodString;
498
+ endedAt: z.ZodOptional<z.ZodString>;
499
+ id: z.ZodString;
500
+ title: z.ZodString;
501
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
502
+ }, z.core.$strip>;
503
+ /**
504
+ * Zod schema for {@link ProvenanceMemoryNode}.
505
+ *
506
+ * @task T10166
507
+ */
508
+ export declare const provenanceMemoryNodeSchema: z.ZodObject<{
509
+ kind: z.ZodLiteral<"memory">;
510
+ memoryType: z.ZodEnum<{
511
+ pattern: "pattern";
512
+ decision: "decision";
513
+ observation: "observation";
514
+ diary: "diary";
515
+ }>;
516
+ recordedAt: z.ZodString;
517
+ id: z.ZodString;
518
+ title: z.ZodString;
519
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
520
+ }, z.core.$strip>;
521
+ /**
522
+ * Discriminated-union schema for {@link ProvenanceNode}.
523
+ *
524
+ * @task T10166
525
+ */
526
+ export declare const provenanceNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
527
+ kind: z.ZodLiteral<"doc">;
528
+ slug: z.ZodString;
529
+ docKind: z.ZodString;
530
+ lifecycleStatus: z.ZodEnum<{
531
+ active: "active";
532
+ archived: "archived";
533
+ superseded: "superseded";
534
+ draft: "draft";
535
+ }>;
536
+ publishedAt: z.ZodString;
537
+ supersededAt: z.ZodOptional<z.ZodString>;
538
+ summary: z.ZodOptional<z.ZodString>;
539
+ id: z.ZodString;
540
+ title: z.ZodString;
541
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
542
+ }, z.core.$strip>, z.ZodObject<{
543
+ kind: z.ZodLiteral<"task">;
544
+ taskType: z.ZodEnum<{
545
+ epic: "epic";
546
+ task: "task";
547
+ subtask: "subtask";
548
+ saga: "saga";
549
+ }>;
550
+ status: z.ZodEnum<{
551
+ pending: "pending";
552
+ cancelled: "cancelled";
553
+ blocked: "blocked";
554
+ done: "done";
555
+ archived: "archived";
556
+ in_progress: "in_progress";
557
+ }>;
558
+ id: z.ZodString;
559
+ title: z.ZodString;
560
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
561
+ }, z.core.$strip>, z.ZodObject<{
562
+ kind: z.ZodLiteral<"decision">;
563
+ outcome: z.ZodEnum<{
564
+ accepted: "accepted";
565
+ proposed: "proposed";
566
+ superseded: "superseded";
567
+ rejected: "rejected";
568
+ }>;
569
+ decidedAt: z.ZodString;
570
+ id: z.ZodString;
571
+ title: z.ZodString;
572
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
573
+ }, z.core.$strip>, z.ZodObject<{
574
+ kind: z.ZodLiteral<"session">;
575
+ startedAt: z.ZodString;
576
+ endedAt: z.ZodOptional<z.ZodString>;
577
+ id: z.ZodString;
578
+ title: z.ZodString;
579
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
580
+ }, z.core.$strip>, z.ZodObject<{
581
+ kind: z.ZodLiteral<"memory">;
582
+ memoryType: z.ZodEnum<{
583
+ pattern: "pattern";
584
+ decision: "decision";
585
+ observation: "observation";
586
+ diary: "diary";
587
+ }>;
588
+ recordedAt: z.ZodString;
589
+ id: z.ZodString;
590
+ title: z.ZodString;
591
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
592
+ }, z.core.$strip>], "kind">;
593
+ /**
594
+ * Zod schema for {@link ProvenanceEdge}.
595
+ *
596
+ * @task T10166
597
+ */
598
+ export declare const provenanceEdgeSchema: z.ZodObject<{
599
+ relation: z.ZodEnum<{
600
+ supersedes: "supersedes";
601
+ "attached-to": "attached-to";
602
+ "superseded-by": "superseded-by";
603
+ "related-task": "related-task";
604
+ "linked-decision": "linked-decision";
605
+ "derived-from": "derived-from";
606
+ }>;
607
+ from: z.ZodString;
608
+ fromKind: z.ZodEnum<{
609
+ task: "task";
610
+ session: "session";
611
+ decision: "decision";
612
+ memory: "memory";
613
+ doc: "doc";
614
+ }>;
615
+ to: z.ZodString;
616
+ toKind: z.ZodEnum<{
617
+ task: "task";
618
+ session: "session";
619
+ decision: "decision";
620
+ memory: "memory";
621
+ doc: "doc";
622
+ }>;
623
+ addedAt: z.ZodString;
624
+ summary: z.ZodOptional<z.ZodString>;
625
+ }, z.core.$strip>;
626
+ /**
627
+ * Zod schema for {@link DocProvenanceResponse}.
628
+ *
629
+ * @task T10166
630
+ */
631
+ export declare const docProvenanceResponseSchema: z.ZodObject<{
632
+ nodes: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
633
+ kind: z.ZodLiteral<"doc">;
634
+ slug: z.ZodString;
635
+ docKind: z.ZodString;
636
+ lifecycleStatus: z.ZodEnum<{
637
+ active: "active";
638
+ archived: "archived";
639
+ superseded: "superseded";
640
+ draft: "draft";
641
+ }>;
642
+ publishedAt: z.ZodString;
643
+ supersededAt: z.ZodOptional<z.ZodString>;
644
+ summary: z.ZodOptional<z.ZodString>;
645
+ id: z.ZodString;
646
+ title: z.ZodString;
647
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
648
+ }, z.core.$strip>, z.ZodObject<{
649
+ kind: z.ZodLiteral<"task">;
650
+ taskType: z.ZodEnum<{
651
+ epic: "epic";
652
+ task: "task";
653
+ subtask: "subtask";
654
+ saga: "saga";
655
+ }>;
656
+ status: z.ZodEnum<{
657
+ pending: "pending";
658
+ cancelled: "cancelled";
659
+ blocked: "blocked";
660
+ done: "done";
661
+ archived: "archived";
662
+ in_progress: "in_progress";
663
+ }>;
664
+ id: z.ZodString;
665
+ title: z.ZodString;
666
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
667
+ }, z.core.$strip>, z.ZodObject<{
668
+ kind: z.ZodLiteral<"decision">;
669
+ outcome: z.ZodEnum<{
670
+ accepted: "accepted";
671
+ proposed: "proposed";
672
+ superseded: "superseded";
673
+ rejected: "rejected";
674
+ }>;
675
+ decidedAt: z.ZodString;
676
+ id: z.ZodString;
677
+ title: z.ZodString;
678
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
679
+ }, z.core.$strip>, z.ZodObject<{
680
+ kind: z.ZodLiteral<"session">;
681
+ startedAt: z.ZodString;
682
+ endedAt: z.ZodOptional<z.ZodString>;
683
+ id: z.ZodString;
684
+ title: z.ZodString;
685
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
686
+ }, z.core.$strip>, z.ZodObject<{
687
+ kind: z.ZodLiteral<"memory">;
688
+ memoryType: z.ZodEnum<{
689
+ pattern: "pattern";
690
+ decision: "decision";
691
+ observation: "observation";
692
+ diary: "diary";
693
+ }>;
694
+ recordedAt: z.ZodString;
695
+ id: z.ZodString;
696
+ title: z.ZodString;
697
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
698
+ }, z.core.$strip>], "kind">>>;
699
+ edges: z.ZodReadonly<z.ZodArray<z.ZodObject<{
700
+ relation: z.ZodEnum<{
701
+ supersedes: "supersedes";
702
+ "attached-to": "attached-to";
703
+ "superseded-by": "superseded-by";
704
+ "related-task": "related-task";
705
+ "linked-decision": "linked-decision";
706
+ "derived-from": "derived-from";
707
+ }>;
708
+ from: z.ZodString;
709
+ fromKind: z.ZodEnum<{
710
+ task: "task";
711
+ session: "session";
712
+ decision: "decision";
713
+ memory: "memory";
714
+ doc: "doc";
715
+ }>;
716
+ to: z.ZodString;
717
+ toKind: z.ZodEnum<{
718
+ task: "task";
719
+ session: "session";
720
+ decision: "decision";
721
+ memory: "memory";
722
+ doc: "doc";
723
+ }>;
724
+ addedAt: z.ZodString;
725
+ summary: z.ZodOptional<z.ZodString>;
726
+ }, z.core.$strip>>>;
727
+ totalNodes: z.ZodNumber;
728
+ totalEdges: z.ZodNumber;
729
+ }, z.core.$strip>;
730
+ export {};
731
+ //# sourceMappingURL=provenance.d.ts.map