@isaacriehm/cairn-state 0.22.5

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 (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/alignment-pending.d.ts +28 -0
  5. package/dist/alignment-pending.js +83 -0
  6. package/dist/alignment-pending.js.map +1 -0
  7. package/dist/anchor-map.d.ts +14 -0
  8. package/dist/anchor-map.js +56 -0
  9. package/dist/anchor-map.js.map +1 -0
  10. package/dist/archive.d.ts +48 -0
  11. package/dist/archive.js +96 -0
  12. package/dist/archive.js.map +1 -0
  13. package/dist/cache.d.ts +48 -0
  14. package/dist/cache.js +241 -0
  15. package/dist/cache.js.map +1 -0
  16. package/dist/component-registry.d.ts +93 -0
  17. package/dist/component-registry.js +0 -0
  18. package/dist/component-registry.js.map +1 -0
  19. package/dist/components.d.ts +192 -0
  20. package/dist/components.js +603 -0
  21. package/dist/components.js.map +1 -0
  22. package/dist/config.d.ts +9 -0
  23. package/dist/config.js +26 -0
  24. package/dist/config.js.map +1 -0
  25. package/dist/drift.d.ts +8 -0
  26. package/dist/drift.js +23 -0
  27. package/dist/drift.js.map +1 -0
  28. package/dist/file-candidates-map.d.ts +23 -0
  29. package/dist/file-candidates-map.js +76 -0
  30. package/dist/file-candidates-map.js.map +1 -0
  31. package/dist/frontmatter.d.ts +32 -0
  32. package/dist/frontmatter.js +77 -0
  33. package/dist/frontmatter.js.map +1 -0
  34. package/dist/fs.d.ts +36 -0
  35. package/dist/fs.js +47 -0
  36. package/dist/fs.js.map +1 -0
  37. package/dist/glob.d.ts +10 -0
  38. package/dist/glob.js +46 -0
  39. package/dist/glob.js.map +1 -0
  40. package/dist/home.d.ts +69 -0
  41. package/dist/home.js +168 -0
  42. package/dist/home.js.map +1 -0
  43. package/dist/index.d.ts +29 -0
  44. package/dist/index.js +30 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/languages.d.ts +113 -0
  47. package/dist/languages.js +512 -0
  48. package/dist/languages.js.map +1 -0
  49. package/dist/ledgers.d.ts +14 -0
  50. package/dist/ledgers.js +105 -0
  51. package/dist/ledgers.js.map +1 -0
  52. package/dist/logger.d.ts +13 -0
  53. package/dist/logger.js +17 -0
  54. package/dist/logger.js.map +1 -0
  55. package/dist/manifest.d.ts +10 -0
  56. package/dist/manifest.js +84 -0
  57. package/dist/manifest.js.map +1 -0
  58. package/dist/missions.d.ts +119 -0
  59. package/dist/missions.js +414 -0
  60. package/dist/missions.js.map +1 -0
  61. package/dist/paths.d.ts +117 -0
  62. package/dist/paths.js +241 -0
  63. package/dist/paths.js.map +1 -0
  64. package/dist/quality-grades.d.ts +11 -0
  65. package/dist/quality-grades.js +100 -0
  66. package/dist/quality-grades.js.map +1 -0
  67. package/dist/rejected.d.ts +42 -0
  68. package/dist/rejected.js +100 -0
  69. package/dist/rejected.js.map +1 -0
  70. package/dist/schemas.d.ts +789 -0
  71. package/dist/schemas.js +506 -0
  72. package/dist/schemas.js.map +1 -0
  73. package/dist/scope-index.d.ts +96 -0
  74. package/dist/scope-index.js +299 -0
  75. package/dist/scope-index.js.map +1 -0
  76. package/dist/slug.d.ts +81 -0
  77. package/dist/slug.js +138 -0
  78. package/dist/slug.js.map +1 -0
  79. package/dist/sot-bindings.d.ts +14 -0
  80. package/dist/sot-bindings.js +79 -0
  81. package/dist/sot-bindings.js.map +1 -0
  82. package/dist/sot-cache.d.ts +18 -0
  83. package/dist/sot-cache.js +62 -0
  84. package/dist/sot-cache.js.map +1 -0
  85. package/dist/text.d.ts +27 -0
  86. package/dist/text.js +63 -0
  87. package/dist/text.js.map +1 -0
  88. package/dist/topic-index.d.ts +27 -0
  89. package/dist/topic-index.js +82 -0
  90. package/dist/topic-index.js.map +1 -0
  91. package/dist/walk.d.ts +7 -0
  92. package/dist/walk.js +34 -0
  93. package/dist/walk.js.map +1 -0
  94. package/package.json +35 -0
@@ -0,0 +1,789 @@
1
+ import { z } from "zod";
2
+ export declare const Audience: z.ZodEnum<{
3
+ "ai-only": "ai-only";
4
+ dual: "dual";
5
+ "human-only": "human-only";
6
+ }>;
7
+ export type Audience = z.infer<typeof Audience>;
8
+ export declare const ProvenanceFrontmatter: z.ZodObject<{
9
+ type: z.ZodOptional<z.ZodString>;
10
+ status: z.ZodOptional<z.ZodString>;
11
+ audience: z.ZodOptional<z.ZodEnum<{
12
+ "ai-only": "ai-only";
13
+ dual: "dual";
14
+ "human-only": "human-only";
15
+ }>>;
16
+ generated: z.ZodOptional<z.ZodString>;
17
+ "verified-at": z.ZodOptional<z.ZodString>;
18
+ "source-commits": z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ supersedes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ }, z.core.$loose>;
21
+ export type ProvenanceFrontmatter = z.infer<typeof ProvenanceFrontmatter>;
22
+ export declare const ManifestEntry: z.ZodObject<{
23
+ path: z.ZodString;
24
+ sha256: z.ZodString;
25
+ classification: z.ZodString;
26
+ audience: z.ZodOptional<z.ZodString>;
27
+ verified_at: z.ZodOptional<z.ZodString>;
28
+ generator: z.ZodOptional<z.ZodString>;
29
+ source: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>;
31
+ export type ManifestEntry = z.infer<typeof ManifestEntry>;
32
+ export declare const Manifest: z.ZodObject<{
33
+ version: z.ZodLiteral<1>;
34
+ generated: z.ZodString;
35
+ generator: z.ZodOptional<z.ZodString>;
36
+ files: z.ZodArray<z.ZodObject<{
37
+ path: z.ZodString;
38
+ sha256: z.ZodString;
39
+ classification: z.ZodString;
40
+ audience: z.ZodOptional<z.ZodString>;
41
+ verified_at: z.ZodOptional<z.ZodString>;
42
+ generator: z.ZodOptional<z.ZodString>;
43
+ source: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>>;
45
+ }, z.core.$strip>;
46
+ export type Manifest = z.infer<typeof Manifest>;
47
+ export declare const DecisionAssertion: z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ id: z.ZodString;
49
+ kind: z.ZodLiteral<"schema_must_contain">;
50
+ table: z.ZodString;
51
+ column: z.ZodString;
52
+ column_type: z.ZodOptional<z.ZodString>;
53
+ nullable: z.ZodOptional<z.ZodBoolean>;
54
+ }, z.core.$strip>, z.ZodObject<{
55
+ id: z.ZodString;
56
+ kind: z.ZodLiteral<"text_must_match">;
57
+ pattern: z.ZodString;
58
+ in_globs: z.ZodArray<z.ZodString>;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ id: z.ZodString;
61
+ kind: z.ZodLiteral<"text_must_not_match">;
62
+ pattern: z.ZodString;
63
+ in_globs: z.ZodArray<z.ZodString>;
64
+ }, z.core.$strip>, z.ZodObject<{
65
+ id: z.ZodString;
66
+ kind: z.ZodLiteral<"index_must_exist">;
67
+ table: z.ZodString;
68
+ columns: z.ZodArray<z.ZodString>;
69
+ where: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ id: z.ZodString;
72
+ kind: z.ZodLiteral<"ast_pattern">;
73
+ language: z.ZodString;
74
+ pattern: z.ZodString;
75
+ in_globs: z.ZodArray<z.ZodString>;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ id: z.ZodString;
78
+ kind: z.ZodLiteral<"file_must_not_be_modified">;
79
+ path: z.ZodString;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ id: z.ZodString;
82
+ kind: z.ZodLiteral<"query_must_filter_by">;
83
+ orm: z.ZodString;
84
+ in_globs: z.ZodArray<z.ZodString>;
85
+ table: z.ZodString;
86
+ columns: z.ZodArray<z.ZodString>;
87
+ operator: z.ZodEnum<{
88
+ in: "in";
89
+ eq: "eq";
90
+ between: "between";
91
+ is_not_null: "is_not_null";
92
+ }>;
93
+ require_combination: z.ZodEnum<{
94
+ and: "and";
95
+ or: "or";
96
+ }>;
97
+ }, z.core.$strip>, z.ZodObject<{
98
+ id: z.ZodString;
99
+ kind: z.ZodLiteral<"route_must_have_guard">;
100
+ in_globs: z.ZodArray<z.ZodString>;
101
+ guard: z.ZodString;
102
+ require_on: z.ZodArray<z.ZodString>;
103
+ }, z.core.$strip>, z.ZodObject<{
104
+ id: z.ZodString;
105
+ kind: z.ZodLiteral<"event_must_emit">;
106
+ in_globs: z.ZodArray<z.ZodString>;
107
+ after_method: z.ZodString;
108
+ event_key: z.ZodString;
109
+ payload_must_include: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ }, z.core.$strip>, z.ZodObject<{
111
+ id: z.ZodString;
112
+ kind: z.ZodLiteral<"service_method_must_call">;
113
+ in_globs: z.ZodArray<z.ZodString>;
114
+ in_method: z.ZodString;
115
+ must_call: z.ZodString;
116
+ before_returning: z.ZodOptional<z.ZodBoolean>;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ id: z.ZodString;
119
+ kind: z.ZodLiteral<"human_review_hint">;
120
+ description: z.ZodString;
121
+ }, z.core.$strip>], "kind">;
122
+ export type DecisionAssertion = z.infer<typeof DecisionAssertion>;
123
+ /**
124
+ * sot_kind = where the canonical prose lives for this DEC.
125
+ * "ledger" — body in this DEC file is canonical (source-comment essay,
126
+ * operator-recorded). Lens renders body verbatim.
127
+ * "path" — sot_path points at the canonical location (doc paragraph,
128
+ * CLAUDE.md section). Lens renders live content from there.
129
+ */
130
+ export declare const SotKind: z.ZodEnum<{
131
+ path: "path";
132
+ ledger: "ledger";
133
+ }>;
134
+ export type SotKind = z.infer<typeof SotKind>;
135
+ export declare const DecisionFrontmatter: z.ZodObject<{
136
+ id: z.ZodString;
137
+ title: z.ZodString;
138
+ type: z.ZodOptional<z.ZodLiteral<"adr">>;
139
+ status: z.ZodString;
140
+ audience: z.ZodOptional<z.ZodEnum<{
141
+ "ai-only": "ai-only";
142
+ dual: "dual";
143
+ "human-only": "human-only";
144
+ }>>;
145
+ generated: z.ZodOptional<z.ZodString>;
146
+ "verified-at": z.ZodOptional<z.ZodString>;
147
+ "source-commits": z.ZodOptional<z.ZodArray<z.ZodString>>;
148
+ decided_at: z.ZodOptional<z.ZodString>;
149
+ decided_by: z.ZodOptional<z.ZodString>;
150
+ scope_globs: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
+ supersedes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
+ superseded_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
153
+ assertions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
154
+ id: z.ZodString;
155
+ kind: z.ZodLiteral<"schema_must_contain">;
156
+ table: z.ZodString;
157
+ column: z.ZodString;
158
+ column_type: z.ZodOptional<z.ZodString>;
159
+ nullable: z.ZodOptional<z.ZodBoolean>;
160
+ }, z.core.$strip>, z.ZodObject<{
161
+ id: z.ZodString;
162
+ kind: z.ZodLiteral<"text_must_match">;
163
+ pattern: z.ZodString;
164
+ in_globs: z.ZodArray<z.ZodString>;
165
+ }, z.core.$strip>, z.ZodObject<{
166
+ id: z.ZodString;
167
+ kind: z.ZodLiteral<"text_must_not_match">;
168
+ pattern: z.ZodString;
169
+ in_globs: z.ZodArray<z.ZodString>;
170
+ }, z.core.$strip>, z.ZodObject<{
171
+ id: z.ZodString;
172
+ kind: z.ZodLiteral<"index_must_exist">;
173
+ table: z.ZodString;
174
+ columns: z.ZodArray<z.ZodString>;
175
+ where: z.ZodOptional<z.ZodString>;
176
+ }, z.core.$strip>, z.ZodObject<{
177
+ id: z.ZodString;
178
+ kind: z.ZodLiteral<"ast_pattern">;
179
+ language: z.ZodString;
180
+ pattern: z.ZodString;
181
+ in_globs: z.ZodArray<z.ZodString>;
182
+ }, z.core.$strip>, z.ZodObject<{
183
+ id: z.ZodString;
184
+ kind: z.ZodLiteral<"file_must_not_be_modified">;
185
+ path: z.ZodString;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ id: z.ZodString;
188
+ kind: z.ZodLiteral<"query_must_filter_by">;
189
+ orm: z.ZodString;
190
+ in_globs: z.ZodArray<z.ZodString>;
191
+ table: z.ZodString;
192
+ columns: z.ZodArray<z.ZodString>;
193
+ operator: z.ZodEnum<{
194
+ in: "in";
195
+ eq: "eq";
196
+ between: "between";
197
+ is_not_null: "is_not_null";
198
+ }>;
199
+ require_combination: z.ZodEnum<{
200
+ and: "and";
201
+ or: "or";
202
+ }>;
203
+ }, z.core.$strip>, z.ZodObject<{
204
+ id: z.ZodString;
205
+ kind: z.ZodLiteral<"route_must_have_guard">;
206
+ in_globs: z.ZodArray<z.ZodString>;
207
+ guard: z.ZodString;
208
+ require_on: z.ZodArray<z.ZodString>;
209
+ }, z.core.$strip>, z.ZodObject<{
210
+ id: z.ZodString;
211
+ kind: z.ZodLiteral<"event_must_emit">;
212
+ in_globs: z.ZodArray<z.ZodString>;
213
+ after_method: z.ZodString;
214
+ event_key: z.ZodString;
215
+ payload_must_include: z.ZodOptional<z.ZodArray<z.ZodString>>;
216
+ }, z.core.$strip>, z.ZodObject<{
217
+ id: z.ZodString;
218
+ kind: z.ZodLiteral<"service_method_must_call">;
219
+ in_globs: z.ZodArray<z.ZodString>;
220
+ in_method: z.ZodString;
221
+ must_call: z.ZodString;
222
+ before_returning: z.ZodOptional<z.ZodBoolean>;
223
+ }, z.core.$strip>, z.ZodObject<{
224
+ id: z.ZodString;
225
+ kind: z.ZodLiteral<"human_review_hint">;
226
+ description: z.ZodString;
227
+ }, z.core.$strip>], "kind">>>;
228
+ human_review_hint: z.ZodOptional<z.ZodString>;
229
+ related_invariants: z.ZodOptional<z.ZodArray<z.ZodString>>;
230
+ sot_kind: z.ZodEnum<{
231
+ path: "path";
232
+ ledger: "ledger";
233
+ }>;
234
+ sot_path: z.ZodString;
235
+ sot_content_hash: z.ZodString;
236
+ related: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
+ derived_from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
238
+ }, z.core.$loose>;
239
+ export type DecisionFrontmatter = z.infer<typeof DecisionFrontmatter>;
240
+ export declare const InvariantFrontmatter: z.ZodObject<{
241
+ id: z.ZodString;
242
+ title: z.ZodString;
243
+ type: z.ZodOptional<z.ZodLiteral<"invariant">>;
244
+ status: z.ZodOptional<z.ZodEnum<{
245
+ superseded: "superseded";
246
+ archived: "archived";
247
+ active: "active";
248
+ }>>;
249
+ audience: z.ZodOptional<z.ZodEnum<{
250
+ "ai-only": "ai-only";
251
+ dual: "dual";
252
+ "human-only": "human-only";
253
+ }>>;
254
+ generated: z.ZodOptional<z.ZodString>;
255
+ "verified-at": z.ZodOptional<z.ZodString>;
256
+ source_run: z.ZodOptional<z.ZodString>;
257
+ source_decision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
258
+ introduced_for_bug: z.ZodOptional<z.ZodString>;
259
+ sensor: z.ZodOptional<z.ZodString>;
260
+ e2e: z.ZodOptional<z.ZodString>;
261
+ naming_convention: z.ZodOptional<z.ZodString>;
262
+ superseded_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
263
+ sot_kind: z.ZodEnum<{
264
+ path: "path";
265
+ ledger: "ledger";
266
+ }>;
267
+ sot_path: z.ZodString;
268
+ sot_content_hash: z.ZodString;
269
+ related: z.ZodOptional<z.ZodNullable<z.ZodString>>;
270
+ derived_from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
271
+ }, z.core.$loose>;
272
+ export type InvariantFrontmatter = z.infer<typeof InvariantFrontmatter>;
273
+ export declare const DecisionLedgerEntry: z.ZodObject<{
274
+ id: z.ZodString;
275
+ title: z.ZodString;
276
+ status: z.ZodString;
277
+ scope_globs: z.ZodOptional<z.ZodArray<z.ZodString>>;
278
+ supersedes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
279
+ superseded_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
280
+ }, z.core.$strip>;
281
+ export type DecisionLedgerEntry = z.infer<typeof DecisionLedgerEntry>;
282
+ export declare const InvariantLedgerEntry: z.ZodObject<{
283
+ id: z.ZodString;
284
+ title: z.ZodString;
285
+ status: z.ZodString;
286
+ source_decision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
287
+ superseded_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
+ }, z.core.$strip>;
289
+ export type InvariantLedgerEntry = z.infer<typeof InvariantLedgerEntry>;
290
+ export declare const QualityGrade: z.ZodObject<{
291
+ module: z.ZodString;
292
+ score: z.ZodNumber;
293
+ pass_rate: z.ZodNumber;
294
+ drift_count: z.ZodNumber;
295
+ last_updated: z.ZodString;
296
+ recent_run_count: z.ZodNumber;
297
+ }, z.core.$strip>;
298
+ export type QualityGrade = z.infer<typeof QualityGrade>;
299
+ export declare const QualityGrades: z.ZodObject<{
300
+ version: z.ZodLiteral<1>;
301
+ generated: z.ZodString;
302
+ modules: z.ZodArray<z.ZodObject<{
303
+ module: z.ZodString;
304
+ score: z.ZodNumber;
305
+ pass_rate: z.ZodNumber;
306
+ drift_count: z.ZodNumber;
307
+ last_updated: z.ZodString;
308
+ recent_run_count: z.ZodNumber;
309
+ }, z.core.$strip>>;
310
+ }, z.core.$strip>;
311
+ export type QualityGrades = z.infer<typeof QualityGrades>;
312
+ /**
313
+ * Topic-index entry — one row per content-fingerprint slug across all
314
+ * scanned sources. `sot_source` is the canonical source path picked by
315
+ * priority order (docs/* > CLAUDE.md > AGENTS.md > source comments).
316
+ * `candidates` lists every place the same prose appears (one becomes the
317
+ * SoT, the rest become §DEC-<id> cites).
318
+ *
319
+ * `marker_kind` is stamped at walk-time when the SoT block sits under a
320
+ * `cairn:` frontmatter key (file-level) or has a `<!-- cairn:decision -->`
321
+ * / `<!-- cairn:rule -->` HTML comment within 3 lines of its heading
322
+ * (block-level). Phase 6 Stage 3 reads this field directly off the
323
+ * topic-index and bypasses Stages 1+2 (file-purpose + section batch
324
+ * classifiers) for marked entries — the operator has already declared
325
+ * the block authoritative, so Haiku adds no signal.
326
+ *
327
+ * `content_hash` mirrors the SoT block's body hash at walk-time. Used by
328
+ * `cairn_propose_decision` (PR 2) and the alignment hooks to detect
329
+ * source drift before promoting a candidate to a draft.
330
+ */
331
+ export declare const TopicIndexEntry: z.ZodObject<{
332
+ slug: z.ZodString;
333
+ dec_id: z.ZodOptional<z.ZodString>;
334
+ sot_source: z.ZodString;
335
+ candidates: z.ZodArray<z.ZodObject<{
336
+ file: z.ZodString;
337
+ kind: z.ZodEnum<{
338
+ doc: "doc";
339
+ claudemd: "claudemd";
340
+ agentsmd: "agentsmd";
341
+ rule: "rule";
342
+ "source-comment": "source-comment";
343
+ }>;
344
+ anchor: z.ZodOptional<z.ZodString>;
345
+ line_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
346
+ }, z.core.$strip>>;
347
+ created_at: z.ZodString;
348
+ marker_kind: z.ZodOptional<z.ZodEnum<{
349
+ rule: "rule";
350
+ decision: "decision";
351
+ }>>;
352
+ content_hash: z.ZodOptional<z.ZodString>;
353
+ }, z.core.$strip>;
354
+ export type TopicIndexEntry = z.infer<typeof TopicIndexEntry>;
355
+ export declare const TopicIndex: z.ZodObject<{
356
+ version: z.ZodLiteral<1>;
357
+ generated: z.ZodString;
358
+ topics: z.ZodRecord<z.ZodString, z.ZodObject<{
359
+ slug: z.ZodString;
360
+ dec_id: z.ZodOptional<z.ZodString>;
361
+ sot_source: z.ZodString;
362
+ candidates: z.ZodArray<z.ZodObject<{
363
+ file: z.ZodString;
364
+ kind: z.ZodEnum<{
365
+ doc: "doc";
366
+ claudemd: "claudemd";
367
+ agentsmd: "agentsmd";
368
+ rule: "rule";
369
+ "source-comment": "source-comment";
370
+ }>;
371
+ anchor: z.ZodOptional<z.ZodString>;
372
+ line_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
373
+ }, z.core.$strip>>;
374
+ created_at: z.ZodString;
375
+ marker_kind: z.ZodOptional<z.ZodEnum<{
376
+ rule: "rule";
377
+ decision: "decision";
378
+ }>>;
379
+ content_hash: z.ZodOptional<z.ZodString>;
380
+ }, z.core.$strip>>;
381
+ }, z.core.$strip>;
382
+ export type TopicIndex = z.infer<typeof TopicIndex>;
383
+ /**
384
+ * SoT bindings — bidirectional map between DEC ids and their canonical
385
+ * source paths. Forward index is one-to-one. Reverse index is one-to-many
386
+ * because supersedes chains keep the same sot_path across multiple DEC
387
+ * ids.
388
+ */
389
+ export declare const SotBindings: z.ZodObject<{
390
+ version: z.ZodLiteral<1>;
391
+ generated: z.ZodString;
392
+ forward: z.ZodRecord<z.ZodString, z.ZodString>;
393
+ reverse: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
394
+ }, z.core.$strip>;
395
+ export type SotBindings = z.infer<typeof SotBindings>;
396
+ /**
397
+ * Sot-cache — tokenized DEC body shingles for Jaccard pre-filter in the
398
+ * Layer A alignment hook. Mtime-keyed so the cache rebuilds incrementally
399
+ * on PostToolUse Write events.
400
+ */
401
+ export declare const SotCacheEntry: z.ZodObject<{
402
+ dec_id: z.ZodString;
403
+ sot_path: z.ZodString;
404
+ body_hash: z.ZodString;
405
+ tokens: z.ZodArray<z.ZodString>;
406
+ shingles: z.ZodArray<z.ZodString>;
407
+ mtime_ms: z.ZodNumber;
408
+ }, z.core.$strip>;
409
+ export type SotCacheEntry = z.infer<typeof SotCacheEntry>;
410
+ export declare const SotCache: z.ZodObject<{
411
+ version: z.ZodLiteral<1>;
412
+ generated: z.ZodString;
413
+ entries: z.ZodRecord<z.ZodString, z.ZodObject<{
414
+ dec_id: z.ZodString;
415
+ sot_path: z.ZodString;
416
+ body_hash: z.ZodString;
417
+ tokens: z.ZodArray<z.ZodString>;
418
+ shingles: z.ZodArray<z.ZodString>;
419
+ mtime_ms: z.ZodNumber;
420
+ }, z.core.$strip>>;
421
+ }, z.core.$strip>;
422
+ export type SotCache = z.infer<typeof SotCache>;
423
+ /**
424
+ * Anchor-map — external map from topic slug to its current location in
425
+ * source. Allows operator's docs to stay pristine (no `<!-- cairn-anchor -->`
426
+ * injected) while drift detection reconciles via content_hash.
427
+ */
428
+ export declare const AnchorMapEntry: z.ZodObject<{
429
+ file: z.ZodString;
430
+ current_anchor: z.ZodOptional<z.ZodString>;
431
+ content_hash: z.ZodString;
432
+ line_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
433
+ kind: z.ZodEnum<{
434
+ doc: "doc";
435
+ claudemd: "claudemd";
436
+ agentsmd: "agentsmd";
437
+ rule: "rule";
438
+ "source-comment": "source-comment";
439
+ }>;
440
+ }, z.core.$strip>;
441
+ export type AnchorMapEntry = z.infer<typeof AnchorMapEntry>;
442
+ export declare const AnchorMap: z.ZodObject<{
443
+ version: z.ZodLiteral<1>;
444
+ generated: z.ZodString;
445
+ anchors: z.ZodRecord<z.ZodString, z.ZodObject<{
446
+ file: z.ZodString;
447
+ current_anchor: z.ZodOptional<z.ZodString>;
448
+ content_hash: z.ZodString;
449
+ line_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
450
+ kind: z.ZodEnum<{
451
+ doc: "doc";
452
+ claudemd: "claudemd";
453
+ agentsmd: "agentsmd";
454
+ rule: "rule";
455
+ "source-comment": "source-comment";
456
+ }>;
457
+ }, z.core.$strip>>;
458
+ }, z.core.$strip>;
459
+ export type AnchorMap = z.infer<typeof AnchorMap>;
460
+ export declare const DriftEvent: z.ZodObject<{
461
+ ts: z.ZodString;
462
+ kind: z.ZodEnum<{
463
+ frontmatter_stale: "frontmatter_stale";
464
+ generator_drift: "generator_drift";
465
+ broken_link: "broken_link";
466
+ orphan_path: "orphan_path";
467
+ orphan_entity: "orphan_entity";
468
+ manifest_hash_changed: "manifest_hash_changed";
469
+ "doc-drift": "doc-drift";
470
+ "paragraph-deleted": "paragraph-deleted";
471
+ "pre-commit-drift": "pre-commit-drift";
472
+ }>;
473
+ path: z.ZodString;
474
+ detail: z.ZodOptional<z.ZodString>;
475
+ severity: z.ZodDefault<z.ZodEnum<{
476
+ soft: "soft";
477
+ hard: "hard";
478
+ }>>;
479
+ dec_id: z.ZodOptional<z.ZodString>;
480
+ }, z.core.$strip>;
481
+ export type DriftEvent = z.infer<typeof DriftEvent>;
482
+ /**
483
+ * Layer B pre-commit-drift log entry written by the git pre-commit
484
+ * hook (`cairn hook pre-commit-align`). SessionStart Drain SessionStart drain
485
+ * consumes this file, re-checks each entry against the (possibly
486
+ * changed) source location, and runs the Haiku judge for ambiguous
487
+ * candidates.
488
+ *
489
+ * Path: `.cairn/staleness/pre-commit-deferred.jsonl`.
490
+ *
491
+ * `tier: tier1` — deterministic match passed (Jaccard ≥ 0.85, shingle
492
+ * ≥ 0.6, length ratio 0.5–2.0). SessionStart Drain can auto-cite without Haiku
493
+ * if the block survives.
494
+ *
495
+ * `tier: tier2-3` — Jaccard pre-filter survivors only; Tier 1 didn't
496
+ * fire. SessionStart Drain invokes Haiku dedup judge.
497
+ */
498
+ export declare const PreCommitDriftCandidate: z.ZodObject<{
499
+ id: z.ZodString;
500
+ similarity: z.ZodNumber;
501
+ body_hash: z.ZodString;
502
+ sot_path: z.ZodString;
503
+ }, z.core.$strip>;
504
+ export type PreCommitDriftCandidate = z.infer<typeof PreCommitDriftCandidate>;
505
+ export declare const PreCommitDriftLogEntry: z.ZodObject<{
506
+ ts: z.ZodString;
507
+ file: z.ZodString;
508
+ block_start_line: z.ZodNumber;
509
+ block_end_line: z.ZodNumber;
510
+ block_content_hash: z.ZodString;
511
+ block_prose: z.ZodString;
512
+ tier: z.ZodEnum<{
513
+ tier1: "tier1";
514
+ "tier2-3": "tier2-3";
515
+ }>;
516
+ candidates: z.ZodArray<z.ZodObject<{
517
+ id: z.ZodString;
518
+ similarity: z.ZodNumber;
519
+ body_hash: z.ZodString;
520
+ sot_path: z.ZodString;
521
+ }, z.core.$strip>>;
522
+ }, z.core.$strip>;
523
+ export type PreCommitDriftLogEntry = z.infer<typeof PreCommitDriftLogEntry>;
524
+ /**
525
+ * Rejected-candidate ledger entry (`.cairn/ground/_rejected.yaml`).
526
+ *
527
+ * Records topic-index slugs the operator (or `ai-curator`) decided are
528
+ * *not* canonical — false positives, research notes, planning prose,
529
+ * etc. The drift sensor reads this file and suppresses any candidate
530
+ * whose slug appears here; phase 6 / `cairn ingest` skip rejected slugs
531
+ * on the next pass instead of re-proposing them.
532
+ *
533
+ * Dedup is by slug. First writer wins the `reason` string; subsequent
534
+ * writes only refresh `rejected_at`. Phase 5b GC drops entries whose
535
+ * slug is no longer present in the freshly-built topic-index.
536
+ */
537
+ export declare const RejectedEntry: z.ZodObject<{
538
+ slug: z.ZodString;
539
+ rejected_at: z.ZodString;
540
+ rejected_by: z.ZodEnum<{
541
+ operator: "operator";
542
+ "ai-curator": "ai-curator";
543
+ "cairn-init": "cairn-init";
544
+ }>;
545
+ reason: z.ZodString;
546
+ sot_source: z.ZodString;
547
+ line_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
548
+ }, z.core.$strip>;
549
+ export type RejectedEntry = z.infer<typeof RejectedEntry>;
550
+ export declare const RejectedYaml: z.ZodObject<{
551
+ version: z.ZodLiteral<1>;
552
+ generated: z.ZodString;
553
+ rejected: z.ZodArray<z.ZodObject<{
554
+ slug: z.ZodString;
555
+ rejected_at: z.ZodString;
556
+ rejected_by: z.ZodEnum<{
557
+ operator: "operator";
558
+ "ai-curator": "ai-curator";
559
+ "cairn-init": "cairn-init";
560
+ }>;
561
+ reason: z.ZodString;
562
+ sot_source: z.ZodString;
563
+ line_range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
564
+ }, z.core.$strip>>;
565
+ }, z.core.$strip>;
566
+ export type RejectedYaml = z.infer<typeof RejectedYaml>;
567
+ /**
568
+ * `.cairn/ground/file-candidates-map.yaml` — per-file count of
569
+ * topic-index entries with `dec_id IS NULL`. Built at the end of phase
570
+ * 5b (and refreshed whenever `dec_id` is stamped — phase 6, the PR 2
571
+ * `cairn_propose_decision` tool, etc.). The read-enrich hook consults
572
+ * this map to inject a candidate-count warning when an AI agent reads a
573
+ * file with unpromoted candidates, without scanning the whole topic
574
+ * index per Read.
575
+ */
576
+ export declare const FileCandidatesMap: z.ZodObject<{
577
+ version: z.ZodLiteral<1>;
578
+ generated: z.ZodString;
579
+ file_candidates: z.ZodRecord<z.ZodString, z.ZodNumber>;
580
+ }, z.core.$strip>;
581
+ export type FileCandidatesMap = z.infer<typeof FileCandidatesMap>;
582
+ export type CommentLang = "js" | "py" | "rs" | "go" | "java" | "c" | "cs" | "rb" | "sh" | "php" | "lua" | "dart" | "kt" | "swift" | "scala" | "unknown";
583
+ export type CommentKind = "block" | "jsdoc" | "line-cluster" | "license";
584
+ export interface CommentBlock {
585
+ /** Stable per-walk id: `<rel-path>:<startLine>-<endLine>` */
586
+ id: string;
587
+ /** Repo-relative POSIX path. */
588
+ file: string;
589
+ lang: CommentLang;
590
+ kind: CommentKind;
591
+ /** 1-based, inclusive. */
592
+ startLine: number;
593
+ /** 1-based, inclusive. */
594
+ endLine: number;
595
+ /** Raw text including comment markers. */
596
+ raw: string;
597
+ /** Stripped prose — markers + leading `*` removed, used for word count. */
598
+ prose: string;
599
+ lineCount: number;
600
+ charCount: number;
601
+ wordCount: number;
602
+ /** Index where `raw` starts in the file (UTF-8 bytes ≈ chars for source). */
603
+ startOffset: number;
604
+ /** Index immediately after `raw`. */
605
+ endOffset: number;
606
+ }
607
+ /**
608
+ * Per-mission default exit gate, with optional per-phase override in
609
+ * roadmap.md frontmatter.
610
+ * - `prompt` — Stop hook surfaces inline AskUserQuestion on phase complete.
611
+ * - `auto` — cursor advances silently when last phase task graduates.
612
+ * - `manual` — operator advances explicitly via cairn_mission_advance.
613
+ */
614
+ export declare const MissionExitGate: z.ZodEnum<{
615
+ prompt: "prompt";
616
+ auto: "auto";
617
+ manual: "manual";
618
+ }>;
619
+ export type MissionExitGate = z.infer<typeof MissionExitGate>;
620
+ export declare const MissionPhase: z.ZodObject<{
621
+ id: z.ZodString;
622
+ title: z.ZodString;
623
+ depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
624
+ exit_criteria: z.ZodString;
625
+ exit_gate: z.ZodOptional<z.ZodEnum<{
626
+ prompt: "prompt";
627
+ auto: "auto";
628
+ manual: "manual";
629
+ }>>;
630
+ }, z.core.$strip>;
631
+ export type MissionPhase = z.infer<typeof MissionPhase>;
632
+ /**
633
+ * Roadmap frontmatter — `.cairn/ground/missions/<id>/roadmap.md`. Lives
634
+ * in committed ground state; multi-dev visible. Phase YAML is canonical;
635
+ * any prose body is operator notes ignored by Cairn parsing.
636
+ */
637
+ export declare const MissionRoadmapFrontmatter: z.ZodObject<{
638
+ mission_id: z.ZodString;
639
+ title: z.ZodString;
640
+ spec_path: z.ZodString;
641
+ created_at: z.ZodString;
642
+ exit_gate: z.ZodEnum<{
643
+ prompt: "prompt";
644
+ auto: "auto";
645
+ manual: "manual";
646
+ }>;
647
+ phases: z.ZodArray<z.ZodObject<{
648
+ id: z.ZodString;
649
+ title: z.ZodString;
650
+ depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
651
+ exit_criteria: z.ZodString;
652
+ exit_gate: z.ZodOptional<z.ZodEnum<{
653
+ prompt: "prompt";
654
+ auto: "auto";
655
+ manual: "manual";
656
+ }>>;
657
+ }, z.core.$strip>>;
658
+ }, z.core.$loose>;
659
+ export type MissionRoadmapFrontmatter = z.infer<typeof MissionRoadmapFrontmatter>;
660
+ export declare const MissionPhaseState: z.ZodEnum<{
661
+ pending: "pending";
662
+ in_progress: "in_progress";
663
+ done: "done";
664
+ }>;
665
+ export type MissionPhaseState = z.infer<typeof MissionPhaseState>;
666
+ export declare const MissionPhaseProgressEntry: z.ZodObject<{
667
+ state: z.ZodEnum<{
668
+ pending: "pending";
669
+ in_progress: "in_progress";
670
+ done: "done";
671
+ }>;
672
+ task_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
673
+ graduated_at: z.ZodOptional<z.ZodString>;
674
+ ready_emitted: z.ZodOptional<z.ZodBoolean>;
675
+ brief_status: z.ZodOptional<z.ZodEnum<{
676
+ accepted: "accepted";
677
+ drafted: "drafted";
678
+ }>>;
679
+ }, z.core.$strip>;
680
+ export type MissionPhaseProgressEntry = z.infer<typeof MissionPhaseProgressEntry>;
681
+ /**
682
+ * One resolved fork captured during per-phase tightening — the question
683
+ * the brief closed plus the operator's (or, in autonomous mode, the
684
+ * model's) choice. Mirrors a lightweight DEC without graduating to the
685
+ * decision graph; phase-scoped and archived with the mission.
686
+ */
687
+ export declare const MissionPhaseBriefDecision: z.ZodObject<{
688
+ question: z.ZodString;
689
+ choice: z.ZodString;
690
+ rationale: z.ZodOptional<z.ZodString>;
691
+ }, z.core.$strip>;
692
+ export type MissionPhaseBriefDecision = z.infer<typeof MissionPhaseBriefDecision>;
693
+ /**
694
+ * Per-phase brief — `.cairn/ground/missions/<id>/briefs/<phase-id>.md`.
695
+ * The just-in-time tightening artifact for a single phase: the forks the
696
+ * operator resolved, the constraints tasks in this phase must honour,
697
+ * the phase acceptance bar, and the in-scope ground-state cites that
698
+ * pre-answered the rest. Committed alongside the roadmap (multi-dev
699
+ * visible). Frontmatter is canonical; prose body is operator notes.
700
+ */
701
+ export declare const MissionPhaseBrief: z.ZodObject<{
702
+ phase_id: z.ZodString;
703
+ drafted_at: z.ZodString;
704
+ status: z.ZodDefault<z.ZodEnum<{
705
+ accepted: "accepted";
706
+ drafted: "drafted";
707
+ }>>;
708
+ autonomous: z.ZodOptional<z.ZodBoolean>;
709
+ decisions: z.ZodDefault<z.ZodArray<z.ZodObject<{
710
+ question: z.ZodString;
711
+ choice: z.ZodString;
712
+ rationale: z.ZodOptional<z.ZodString>;
713
+ }, z.core.$strip>>>;
714
+ constraints: z.ZodDefault<z.ZodArray<z.ZodString>>;
715
+ acceptance: z.ZodDefault<z.ZodArray<z.ZodString>>;
716
+ cite_decisions: z.ZodDefault<z.ZodArray<z.ZodString>>;
717
+ cite_invariants: z.ZodDefault<z.ZodArray<z.ZodString>>;
718
+ }, z.core.$loose>;
719
+ export type MissionPhaseBrief = z.infer<typeof MissionPhaseBrief>;
720
+ export declare const MissionCursor: z.ZodObject<{
721
+ active_phase: z.ZodNullable<z.ZodString>;
722
+ active_phase_started_at: z.ZodNullable<z.ZodString>;
723
+ }, z.core.$strip>;
724
+ export type MissionCursor = z.infer<typeof MissionCursor>;
725
+ export declare const MissionOutcome: z.ZodEnum<{
726
+ active: "active";
727
+ done: "done";
728
+ aborted: "aborted";
729
+ }>;
730
+ export type MissionOutcome = z.infer<typeof MissionOutcome>;
731
+ /**
732
+ * Per-clone mission state — `.cairn/missions/<id>/state.json`.
733
+ * Tracks the cursor + phase progress. Never committed (gitignored under
734
+ * `.cairn/missions/`).
735
+ */
736
+ export declare const MissionState: z.ZodObject<{
737
+ mission_id: z.ZodString;
738
+ started_at: z.ZodString;
739
+ cursor: z.ZodObject<{
740
+ active_phase: z.ZodNullable<z.ZodString>;
741
+ active_phase_started_at: z.ZodNullable<z.ZodString>;
742
+ }, z.core.$strip>;
743
+ phase_progress: z.ZodRecord<z.ZodString, z.ZodObject<{
744
+ state: z.ZodEnum<{
745
+ pending: "pending";
746
+ in_progress: "in_progress";
747
+ done: "done";
748
+ }>;
749
+ task_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
750
+ graduated_at: z.ZodOptional<z.ZodString>;
751
+ ready_emitted: z.ZodOptional<z.ZodBoolean>;
752
+ brief_status: z.ZodOptional<z.ZodEnum<{
753
+ accepted: "accepted";
754
+ drafted: "drafted";
755
+ }>>;
756
+ }, z.core.$strip>>;
757
+ outcome: z.ZodDefault<z.ZodEnum<{
758
+ active: "active";
759
+ done: "done";
760
+ aborted: "aborted";
761
+ }>>;
762
+ closed_at: z.ZodOptional<z.ZodString>;
763
+ abort_reason: z.ZodOptional<z.ZodString>;
764
+ }, z.core.$strip>;
765
+ export type MissionState = z.infer<typeof MissionState>;
766
+ /**
767
+ * Mission journal entry — `.cairn/missions/<id>/journal.jsonl`. One
768
+ * record per mission-level event (start, advance, resync, close).
769
+ */
770
+ export declare const MissionJournalEntry: z.ZodObject<{
771
+ ts: z.ZodString;
772
+ kind: z.ZodEnum<{
773
+ started: "started";
774
+ "phase-advanced": "phase-advanced";
775
+ "phase-deferred": "phase-deferred";
776
+ "phase-brief-set": "phase-brief-set";
777
+ "task-attached": "task-attached";
778
+ "resync-pending": "resync-pending";
779
+ "resync-applied": "resync-applied";
780
+ "drift-detected": "drift-detected";
781
+ closed: "closed";
782
+ reopened: "reopened";
783
+ "exit-gate-changed": "exit-gate-changed";
784
+ }>;
785
+ phase_id: z.ZodOptional<z.ZodString>;
786
+ task_id: z.ZodOptional<z.ZodString>;
787
+ detail: z.ZodOptional<z.ZodString>;
788
+ }, z.core.$strip>;
789
+ export type MissionJournalEntry = z.infer<typeof MissionJournalEntry>;