@mmnto/totem 1.79.0 → 1.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/compiler-schema.d.ts +1635 -256
  2. package/dist/compiler-schema.d.ts.map +1 -1
  3. package/dist/compiler-schema.js +110 -10
  4. package/dist/compiler-schema.js.map +1 -1
  5. package/dist/compiler-schema.test.js +164 -7
  6. package/dist/compiler-schema.test.js.map +1 -1
  7. package/dist/compiler.d.ts +1 -1
  8. package/dist/compiler.d.ts.map +1 -1
  9. package/dist/compiler.js +1 -1
  10. package/dist/compiler.js.map +1 -1
  11. package/dist/config-schema.d.ts +6 -6
  12. package/dist/index.d.ts +7 -3
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +4 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/spine/authored-rule.d.ts +1030 -32
  17. package/dist/spine/authored-rule.d.ts.map +1 -1
  18. package/dist/spine/authored-rule.js +115 -1
  19. package/dist/spine/authored-rule.js.map +1 -1
  20. package/dist/spine/authored-rule.test.js +10 -4
  21. package/dist/spine/authored-rule.test.js.map +1 -1
  22. package/dist/spine/authoring-ledger.d.ts +204 -0
  23. package/dist/spine/authoring-ledger.d.ts.map +1 -0
  24. package/dist/spine/authoring-ledger.js +220 -0
  25. package/dist/spine/authoring-ledger.js.map +1 -0
  26. package/dist/spine/authoring-ledger.test.d.ts +2 -0
  27. package/dist/spine/authoring-ledger.test.d.ts.map +1 -0
  28. package/dist/spine/authoring-ledger.test.js +144 -0
  29. package/dist/spine/authoring-ledger.test.js.map +1 -0
  30. package/dist/spine/compile.test.js +5 -2
  31. package/dist/spine/compile.test.js.map +1 -1
  32. package/dist/spine/corpus-dispositions.d.ts +4 -4
  33. package/dist/spine/preimage-differential.d.ts +112 -0
  34. package/dist/spine/preimage-differential.d.ts.map +1 -0
  35. package/dist/spine/preimage-differential.js +122 -0
  36. package/dist/spine/preimage-differential.js.map +1 -0
  37. package/dist/spine/preimage-differential.test.d.ts +2 -0
  38. package/dist/spine/preimage-differential.test.d.ts.map +1 -0
  39. package/dist/spine/preimage-differential.test.js +223 -0
  40. package/dist/spine/preimage-differential.test.js.map +1 -0
  41. package/dist/spine/windtunnel-lock.d.ts +6 -6
  42. package/dist/store/lance-schema.d.ts +2 -2
  43. package/package.json +1 -1
@@ -81,46 +81,190 @@ export declare const AuthoredRuleRecordSchema: z.ZodObject<{
81
81
  author: z.ZodEffects<z.ZodString, string, string>;
82
82
  authoredAt: z.ZodEffects<z.ZodString, string, string>;
83
83
  targetDefect: z.ZodEffects<z.ZodString, string, string>;
84
- positiveFixtures: z.ZodArray<z.ZodObject<{
84
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
85
85
  pr: z.ZodNumber;
86
- mergeCommitSha: z.ZodString;
87
- preimageCommitSha: z.ZodString;
86
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
87
+ kind: z.ZodLiteral<"lesson">;
88
+ lessonRef: z.ZodString;
89
+ badExample: z.ZodEffects<z.ZodString, string, string>;
90
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
91
+ }, "strict", z.ZodTypeAny, {
92
+ kind: "lesson";
93
+ lessonRef: string;
94
+ badExample: string;
95
+ goodExample: string;
96
+ }, {
97
+ kind: "lesson";
98
+ lessonRef: string;
99
+ badExample: string;
100
+ goodExample: string;
101
+ }>, z.ZodObject<{
102
+ kind: z.ZodLiteral<"commit">;
103
+ preimageCommitSha: z.ZodString;
104
+ mergeCommitSha: z.ZodString;
105
+ }, "strict", z.ZodTypeAny, {
106
+ kind: "commit";
107
+ preimageCommitSha: string;
108
+ mergeCommitSha: string;
109
+ }, {
110
+ kind: "commit";
111
+ preimageCommitSha: string;
112
+ mergeCommitSha: string;
113
+ }>]>;
88
114
  filePath: z.ZodEffects<z.ZodString, string, string>;
89
115
  matchedSpan: z.ZodEffects<z.ZodString, string, string>;
90
116
  contentHash: z.ZodEffects<z.ZodString, string, string>;
91
- }, "strip", z.ZodTypeAny, {
117
+ }, "strict", z.ZodTypeAny, {
92
118
  pr: number;
93
- mergeCommitSha: string;
94
- preimageCommitSha: string;
119
+ preimageSource: {
120
+ kind: "lesson";
121
+ lessonRef: string;
122
+ badExample: string;
123
+ goodExample: string;
124
+ } | {
125
+ kind: "commit";
126
+ preimageCommitSha: string;
127
+ mergeCommitSha: string;
128
+ };
95
129
  filePath: string;
96
130
  matchedSpan: string;
97
131
  contentHash: string;
98
132
  }, {
99
133
  pr: number;
100
- mergeCommitSha: string;
101
- preimageCommitSha: string;
134
+ preimageSource: {
135
+ kind: "lesson";
136
+ lessonRef: string;
137
+ badExample: string;
138
+ goodExample: string;
139
+ } | {
140
+ kind: "commit";
141
+ preimageCommitSha: string;
142
+ mergeCommitSha: string;
143
+ };
144
+ filePath: string;
145
+ matchedSpan: string;
146
+ contentHash: string;
147
+ }>, {
148
+ pr: number;
149
+ preimageSource: {
150
+ kind: "lesson";
151
+ lessonRef: string;
152
+ badExample: string;
153
+ goodExample: string;
154
+ } | {
155
+ kind: "commit";
156
+ preimageCommitSha: string;
157
+ mergeCommitSha: string;
158
+ };
159
+ filePath: string;
160
+ matchedSpan: string;
161
+ contentHash: string;
162
+ }, {
163
+ pr: number;
164
+ preimageSource: {
165
+ kind: "lesson";
166
+ lessonRef: string;
167
+ badExample: string;
168
+ goodExample: string;
169
+ } | {
170
+ kind: "commit";
171
+ preimageCommitSha: string;
172
+ mergeCommitSha: string;
173
+ };
102
174
  filePath: string;
103
175
  matchedSpan: string;
104
176
  contentHash: string;
105
177
  }>, "many">;
106
- negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodObject<{
178
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
107
179
  pr: z.ZodNumber;
108
- mergeCommitSha: z.ZodString;
109
- preimageCommitSha: z.ZodString;
180
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
181
+ kind: z.ZodLiteral<"lesson">;
182
+ lessonRef: z.ZodString;
183
+ badExample: z.ZodEffects<z.ZodString, string, string>;
184
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
185
+ }, "strict", z.ZodTypeAny, {
186
+ kind: "lesson";
187
+ lessonRef: string;
188
+ badExample: string;
189
+ goodExample: string;
190
+ }, {
191
+ kind: "lesson";
192
+ lessonRef: string;
193
+ badExample: string;
194
+ goodExample: string;
195
+ }>, z.ZodObject<{
196
+ kind: z.ZodLiteral<"commit">;
197
+ preimageCommitSha: z.ZodString;
198
+ mergeCommitSha: z.ZodString;
199
+ }, "strict", z.ZodTypeAny, {
200
+ kind: "commit";
201
+ preimageCommitSha: string;
202
+ mergeCommitSha: string;
203
+ }, {
204
+ kind: "commit";
205
+ preimageCommitSha: string;
206
+ mergeCommitSha: string;
207
+ }>]>;
110
208
  filePath: z.ZodEffects<z.ZodString, string, string>;
111
209
  matchedSpan: z.ZodEffects<z.ZodString, string, string>;
112
210
  contentHash: z.ZodEffects<z.ZodString, string, string>;
113
- }, "strip", z.ZodTypeAny, {
211
+ }, "strict", z.ZodTypeAny, {
114
212
  pr: number;
115
- mergeCommitSha: string;
116
- preimageCommitSha: string;
213
+ preimageSource: {
214
+ kind: "lesson";
215
+ lessonRef: string;
216
+ badExample: string;
217
+ goodExample: string;
218
+ } | {
219
+ kind: "commit";
220
+ preimageCommitSha: string;
221
+ mergeCommitSha: string;
222
+ };
117
223
  filePath: string;
118
224
  matchedSpan: string;
119
225
  contentHash: string;
120
226
  }, {
121
227
  pr: number;
122
- mergeCommitSha: string;
123
- preimageCommitSha: string;
228
+ preimageSource: {
229
+ kind: "lesson";
230
+ lessonRef: string;
231
+ badExample: string;
232
+ goodExample: string;
233
+ } | {
234
+ kind: "commit";
235
+ preimageCommitSha: string;
236
+ mergeCommitSha: string;
237
+ };
238
+ filePath: string;
239
+ matchedSpan: string;
240
+ contentHash: string;
241
+ }>, {
242
+ pr: number;
243
+ preimageSource: {
244
+ kind: "lesson";
245
+ lessonRef: string;
246
+ badExample: string;
247
+ goodExample: string;
248
+ } | {
249
+ kind: "commit";
250
+ preimageCommitSha: string;
251
+ mergeCommitSha: string;
252
+ };
253
+ filePath: string;
254
+ matchedSpan: string;
255
+ contentHash: string;
256
+ }, {
257
+ pr: number;
258
+ preimageSource: {
259
+ kind: "lesson";
260
+ lessonRef: string;
261
+ badExample: string;
262
+ goodExample: string;
263
+ } | {
264
+ kind: "commit";
265
+ preimageCommitSha: string;
266
+ mergeCommitSha: string;
267
+ };
124
268
  filePath: string;
125
269
  matchedSpan: string;
126
270
  contentHash: string;
@@ -132,16 +276,32 @@ export declare const AuthoredRuleRecordSchema: z.ZodObject<{
132
276
  targetDefect: string;
133
277
  positiveFixtures: {
134
278
  pr: number;
135
- mergeCommitSha: string;
136
- preimageCommitSha: string;
279
+ preimageSource: {
280
+ kind: "lesson";
281
+ lessonRef: string;
282
+ badExample: string;
283
+ goodExample: string;
284
+ } | {
285
+ kind: "commit";
286
+ preimageCommitSha: string;
287
+ mergeCommitSha: string;
288
+ };
137
289
  filePath: string;
138
290
  matchedSpan: string;
139
291
  contentHash: string;
140
292
  }[];
141
293
  negativeFixtures?: {
142
294
  pr: number;
143
- mergeCommitSha: string;
144
- preimageCommitSha: string;
295
+ preimageSource: {
296
+ kind: "lesson";
297
+ lessonRef: string;
298
+ badExample: string;
299
+ goodExample: string;
300
+ } | {
301
+ kind: "commit";
302
+ preimageCommitSha: string;
303
+ mergeCommitSha: string;
304
+ };
145
305
  filePath: string;
146
306
  matchedSpan: string;
147
307
  contentHash: string;
@@ -153,16 +313,32 @@ export declare const AuthoredRuleRecordSchema: z.ZodObject<{
153
313
  targetDefect: string;
154
314
  positiveFixtures: {
155
315
  pr: number;
156
- mergeCommitSha: string;
157
- preimageCommitSha: string;
316
+ preimageSource: {
317
+ kind: "lesson";
318
+ lessonRef: string;
319
+ badExample: string;
320
+ goodExample: string;
321
+ } | {
322
+ kind: "commit";
323
+ preimageCommitSha: string;
324
+ mergeCommitSha: string;
325
+ };
158
326
  filePath: string;
159
327
  matchedSpan: string;
160
328
  contentHash: string;
161
329
  }[];
162
330
  negativeFixtures?: {
163
331
  pr: number;
164
- mergeCommitSha: string;
165
- preimageCommitSha: string;
332
+ preimageSource: {
333
+ kind: "lesson";
334
+ lessonRef: string;
335
+ badExample: string;
336
+ goodExample: string;
337
+ } | {
338
+ kind: "commit";
339
+ preimageCommitSha: string;
340
+ mergeCommitSha: string;
341
+ };
166
342
  filePath: string;
167
343
  matchedSpan: string;
168
344
  contentHash: string;
@@ -226,16 +402,32 @@ export declare const AuthoredRuleRecordSchema: z.ZodObject<{
226
402
  targetDefect: string;
227
403
  positiveFixtures: {
228
404
  pr: number;
229
- mergeCommitSha: string;
230
- preimageCommitSha: string;
405
+ preimageSource: {
406
+ kind: "lesson";
407
+ lessonRef: string;
408
+ badExample: string;
409
+ goodExample: string;
410
+ } | {
411
+ kind: "commit";
412
+ preimageCommitSha: string;
413
+ mergeCommitSha: string;
414
+ };
231
415
  filePath: string;
232
416
  matchedSpan: string;
233
417
  contentHash: string;
234
418
  }[];
235
419
  negativeFixtures?: {
236
420
  pr: number;
237
- mergeCommitSha: string;
238
- preimageCommitSha: string;
421
+ preimageSource: {
422
+ kind: "lesson";
423
+ lessonRef: string;
424
+ badExample: string;
425
+ goodExample: string;
426
+ } | {
427
+ kind: "commit";
428
+ preimageCommitSha: string;
429
+ mergeCommitSha: string;
430
+ };
239
431
  filePath: string;
240
432
  matchedSpan: string;
241
433
  contentHash: string;
@@ -266,16 +458,32 @@ export declare const AuthoredRuleRecordSchema: z.ZodObject<{
266
458
  targetDefect: string;
267
459
  positiveFixtures: {
268
460
  pr: number;
269
- mergeCommitSha: string;
270
- preimageCommitSha: string;
461
+ preimageSource: {
462
+ kind: "lesson";
463
+ lessonRef: string;
464
+ badExample: string;
465
+ goodExample: string;
466
+ } | {
467
+ kind: "commit";
468
+ preimageCommitSha: string;
469
+ mergeCommitSha: string;
470
+ };
271
471
  filePath: string;
272
472
  matchedSpan: string;
273
473
  contentHash: string;
274
474
  }[];
275
475
  negativeFixtures?: {
276
476
  pr: number;
277
- mergeCommitSha: string;
278
- preimageCommitSha: string;
477
+ preimageSource: {
478
+ kind: "lesson";
479
+ lessonRef: string;
480
+ badExample: string;
481
+ goodExample: string;
482
+ } | {
483
+ kind: "commit";
484
+ preimageCommitSha: string;
485
+ mergeCommitSha: string;
486
+ };
279
487
  filePath: string;
280
488
  matchedSpan: string;
281
489
  contentHash: string;
@@ -300,6 +508,796 @@ export declare const AuthoredRuleRecordSchema: z.ZodObject<{
300
508
  authoringLedgerRef: string;
301
509
  }>;
302
510
  export type AuthoredRuleRecord = z.infer<typeof AuthoredRuleRecordSchema>;
511
+ export declare const AuthoredRuleInputSchema: z.ZodObject<{
512
+ /** Agent-id or operator handle — attributable (mirrors the provenance field). Trimmed. */
513
+ author: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
514
+ /**
515
+ * ISO-8601 authoring date — trimmed + calendar-validated at the INTAKE boundary
516
+ * (CR diff-review): the same `isIso8601CalendarDate` the record provenance uses,
517
+ * so a malformed `not-a-date` fails here with a clean `CONFIG_INVALID` instead of
518
+ * escaping to a raw ZodError at record construction (pass 1).
519
+ */
520
+ authoredAt: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
521
+ /** The declared DEFECT the rule targets — the pre-image, not its fix (ADR-110 §4 TP-def). Trimmed. */
522
+ targetDefect: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
523
+ /** The matcher engine the author declares; the eligibility check confirms it can represent the class. */
524
+ declaredEngine: z.ZodEnum<["regex", "ast", "ast-grep"]>;
525
+ /**
526
+ * The structural rule-CLASS the author CLAIMS. Fed to the INDEPENDENT
527
+ * `evaluateStructuralEligibility` against the DI whitelist; it is NOT stored
528
+ * verbatim on the record — the *verdict* (`structuralEligibility`, basis
529
+ * `whitelist:<class>`) is. Naming a class is a claim the check adjudicates,
530
+ * never a self-certification of `decidable`. Trimmed so a stray space can't
531
+ * cause an exact-match miss against the registry.
532
+ */
533
+ structuralClass: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
534
+ /** The human-written matcher (same DSL the compiler accepts from the miner). */
535
+ dslSource: z.ZodEffects<z.ZodString, string, string>;
536
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
537
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
538
+ pr: z.ZodNumber;
539
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
540
+ kind: z.ZodLiteral<"lesson">;
541
+ lessonRef: z.ZodString;
542
+ badExample: z.ZodEffects<z.ZodString, string, string>;
543
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
544
+ }, "strict", z.ZodTypeAny, {
545
+ kind: "lesson";
546
+ lessonRef: string;
547
+ badExample: string;
548
+ goodExample: string;
549
+ }, {
550
+ kind: "lesson";
551
+ lessonRef: string;
552
+ badExample: string;
553
+ goodExample: string;
554
+ }>, z.ZodObject<{
555
+ kind: z.ZodLiteral<"commit">;
556
+ preimageCommitSha: z.ZodString;
557
+ mergeCommitSha: z.ZodString;
558
+ }, "strict", z.ZodTypeAny, {
559
+ kind: "commit";
560
+ preimageCommitSha: string;
561
+ mergeCommitSha: string;
562
+ }, {
563
+ kind: "commit";
564
+ preimageCommitSha: string;
565
+ mergeCommitSha: string;
566
+ }>]>;
567
+ filePath: z.ZodEffects<z.ZodString, string, string>;
568
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
569
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
570
+ }, "strict", z.ZodTypeAny, {
571
+ pr: number;
572
+ preimageSource: {
573
+ kind: "lesson";
574
+ lessonRef: string;
575
+ badExample: string;
576
+ goodExample: string;
577
+ } | {
578
+ kind: "commit";
579
+ preimageCommitSha: string;
580
+ mergeCommitSha: string;
581
+ };
582
+ filePath: string;
583
+ matchedSpan: string;
584
+ contentHash: string;
585
+ }, {
586
+ pr: number;
587
+ preimageSource: {
588
+ kind: "lesson";
589
+ lessonRef: string;
590
+ badExample: string;
591
+ goodExample: string;
592
+ } | {
593
+ kind: "commit";
594
+ preimageCommitSha: string;
595
+ mergeCommitSha: string;
596
+ };
597
+ filePath: string;
598
+ matchedSpan: string;
599
+ contentHash: string;
600
+ }>, {
601
+ pr: number;
602
+ preimageSource: {
603
+ kind: "lesson";
604
+ lessonRef: string;
605
+ badExample: string;
606
+ goodExample: string;
607
+ } | {
608
+ kind: "commit";
609
+ preimageCommitSha: string;
610
+ mergeCommitSha: string;
611
+ };
612
+ filePath: string;
613
+ matchedSpan: string;
614
+ contentHash: string;
615
+ }, {
616
+ pr: number;
617
+ preimageSource: {
618
+ kind: "lesson";
619
+ lessonRef: string;
620
+ badExample: string;
621
+ goodExample: string;
622
+ } | {
623
+ kind: "commit";
624
+ preimageCommitSha: string;
625
+ mergeCommitSha: string;
626
+ };
627
+ filePath: string;
628
+ matchedSpan: string;
629
+ contentHash: string;
630
+ }>, "many">;
631
+ /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
632
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
633
+ pr: z.ZodNumber;
634
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
635
+ kind: z.ZodLiteral<"lesson">;
636
+ lessonRef: z.ZodString;
637
+ badExample: z.ZodEffects<z.ZodString, string, string>;
638
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
639
+ }, "strict", z.ZodTypeAny, {
640
+ kind: "lesson";
641
+ lessonRef: string;
642
+ badExample: string;
643
+ goodExample: string;
644
+ }, {
645
+ kind: "lesson";
646
+ lessonRef: string;
647
+ badExample: string;
648
+ goodExample: string;
649
+ }>, z.ZodObject<{
650
+ kind: z.ZodLiteral<"commit">;
651
+ preimageCommitSha: z.ZodString;
652
+ mergeCommitSha: z.ZodString;
653
+ }, "strict", z.ZodTypeAny, {
654
+ kind: "commit";
655
+ preimageCommitSha: string;
656
+ mergeCommitSha: string;
657
+ }, {
658
+ kind: "commit";
659
+ preimageCommitSha: string;
660
+ mergeCommitSha: string;
661
+ }>]>;
662
+ filePath: z.ZodEffects<z.ZodString, string, string>;
663
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
664
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
665
+ }, "strict", z.ZodTypeAny, {
666
+ pr: number;
667
+ preimageSource: {
668
+ kind: "lesson";
669
+ lessonRef: string;
670
+ badExample: string;
671
+ goodExample: string;
672
+ } | {
673
+ kind: "commit";
674
+ preimageCommitSha: string;
675
+ mergeCommitSha: string;
676
+ };
677
+ filePath: string;
678
+ matchedSpan: string;
679
+ contentHash: string;
680
+ }, {
681
+ pr: number;
682
+ preimageSource: {
683
+ kind: "lesson";
684
+ lessonRef: string;
685
+ badExample: string;
686
+ goodExample: string;
687
+ } | {
688
+ kind: "commit";
689
+ preimageCommitSha: string;
690
+ mergeCommitSha: string;
691
+ };
692
+ filePath: string;
693
+ matchedSpan: string;
694
+ contentHash: string;
695
+ }>, {
696
+ pr: number;
697
+ preimageSource: {
698
+ kind: "lesson";
699
+ lessonRef: string;
700
+ badExample: string;
701
+ goodExample: string;
702
+ } | {
703
+ kind: "commit";
704
+ preimageCommitSha: string;
705
+ mergeCommitSha: string;
706
+ };
707
+ filePath: string;
708
+ matchedSpan: string;
709
+ contentHash: string;
710
+ }, {
711
+ pr: number;
712
+ preimageSource: {
713
+ kind: "lesson";
714
+ lessonRef: string;
715
+ badExample: string;
716
+ goodExample: string;
717
+ } | {
718
+ kind: "commit";
719
+ preimageCommitSha: string;
720
+ mergeCommitSha: string;
721
+ };
722
+ filePath: string;
723
+ matchedSpan: string;
724
+ contentHash: string;
725
+ }>, "many">>;
726
+ /**
727
+ * Accelerant lineage (§7). Optional in the YAML; the reader defaults an
728
+ * absent value to `{ kind: 'from-scratch' }` when constructing the record, so
729
+ * the persisted `origin` is always explicit (§7 lineage is never erased).
730
+ */
731
+ origin: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
732
+ kind: z.ZodLiteral<"from-scratch">;
733
+ }, "strip", z.ZodTypeAny, {
734
+ kind: "from-scratch";
735
+ }, {
736
+ kind: "from-scratch";
737
+ }>, z.ZodObject<{
738
+ kind: z.ZodLiteral<"mined-accelerant">;
739
+ sourceRunId: z.ZodEffects<z.ZodString, string, string>;
740
+ suggestionHash: z.ZodEffects<z.ZodString, string, string>;
741
+ }, "strip", z.ZodTypeAny, {
742
+ kind: "mined-accelerant";
743
+ sourceRunId: string;
744
+ suggestionHash: string;
745
+ }, {
746
+ kind: "mined-accelerant";
747
+ sourceRunId: string;
748
+ suggestionHash: string;
749
+ }>]>>;
750
+ }, "strict", z.ZodTypeAny, {
751
+ author: string;
752
+ authoredAt: string;
753
+ targetDefect: string;
754
+ positiveFixtures: {
755
+ pr: number;
756
+ preimageSource: {
757
+ kind: "lesson";
758
+ lessonRef: string;
759
+ badExample: string;
760
+ goodExample: string;
761
+ } | {
762
+ kind: "commit";
763
+ preimageCommitSha: string;
764
+ mergeCommitSha: string;
765
+ };
766
+ filePath: string;
767
+ matchedSpan: string;
768
+ contentHash: string;
769
+ }[];
770
+ dslSource: string;
771
+ declaredEngine: "regex" | "ast" | "ast-grep";
772
+ structuralClass: string;
773
+ negativeFixtures?: {
774
+ pr: number;
775
+ preimageSource: {
776
+ kind: "lesson";
777
+ lessonRef: string;
778
+ badExample: string;
779
+ goodExample: string;
780
+ } | {
781
+ kind: "commit";
782
+ preimageCommitSha: string;
783
+ mergeCommitSha: string;
784
+ };
785
+ filePath: string;
786
+ matchedSpan: string;
787
+ contentHash: string;
788
+ }[] | undefined;
789
+ origin?: {
790
+ kind: "from-scratch";
791
+ } | {
792
+ kind: "mined-accelerant";
793
+ sourceRunId: string;
794
+ suggestionHash: string;
795
+ } | undefined;
796
+ }, {
797
+ author: string;
798
+ authoredAt: string;
799
+ targetDefect: string;
800
+ positiveFixtures: {
801
+ pr: number;
802
+ preimageSource: {
803
+ kind: "lesson";
804
+ lessonRef: string;
805
+ badExample: string;
806
+ goodExample: string;
807
+ } | {
808
+ kind: "commit";
809
+ preimageCommitSha: string;
810
+ mergeCommitSha: string;
811
+ };
812
+ filePath: string;
813
+ matchedSpan: string;
814
+ contentHash: string;
815
+ }[];
816
+ dslSource: string;
817
+ declaredEngine: "regex" | "ast" | "ast-grep";
818
+ structuralClass: string;
819
+ negativeFixtures?: {
820
+ pr: number;
821
+ preimageSource: {
822
+ kind: "lesson";
823
+ lessonRef: string;
824
+ badExample: string;
825
+ goodExample: string;
826
+ } | {
827
+ kind: "commit";
828
+ preimageCommitSha: string;
829
+ mergeCommitSha: string;
830
+ };
831
+ filePath: string;
832
+ matchedSpan: string;
833
+ contentHash: string;
834
+ }[] | undefined;
835
+ origin?: {
836
+ kind: "from-scratch";
837
+ } | {
838
+ kind: "mined-accelerant";
839
+ sourceRunId: string;
840
+ suggestionHash: string;
841
+ } | undefined;
842
+ }>;
843
+ export type AuthoredRuleInput = z.infer<typeof AuthoredRuleInputSchema>;
844
+ /**
845
+ * SLICE B — the on-disk shape of `.totem/spine/authored-rules.yaml`. A file-level
846
+ * authoring header carries the §5/§8 leakage-guard ATTESTATIONS once for the
847
+ * session (not per-rule, since all rules in one file are authored under one
848
+ * frozen split), followed by the rules. Slice B RECORDS these faithfully into the
849
+ * authoring-ledger (strategy's boundary confirm: B records `splitRef` /
850
+ * `authoredAfterSplit` / `fixturePrs`); the MECHANICAL verification — the split
851
+ * was frozen BEFORE authoring (§5.1/FM(g)), fixtures resolve train-side (§5.2),
852
+ * the harness is sandboxed (§5.4) — is the cert-run harness in SLICE C. The
853
+ * attestations are `literal(true)`: an author who cannot attest them is not
854
+ * authoring legitimately, so a `false` fails the read rather than recording a
855
+ * self-defeating attestation. `.strict()` rejects unknown header keys.
856
+ */
857
+ export declare const AuthoredRulesFileSchema: z.ZodObject<{
858
+ /** The frozen split (ADR-110 §6) the rules were authored under (recorded; verified in C). Trimmed (GCA) so stray whitespace can't bypass the non-empty check or perturb the revision fingerprint. */
859
+ splitRef: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
860
+ /** §1(g) embargo attestation — authored AFTER the split was frozen. Always `true`; verified in C. */
861
+ authoredAfterSplit: z.ZodLiteral<true>;
862
+ /** §5 attestation — the author did not inspect the held-out slice. Always `true`; sandboxed in C. */
863
+ heldOutNonInspectionAttestation: z.ZodLiteral<true>;
864
+ /** The authored rules (≥1). */
865
+ rules: z.ZodArray<z.ZodObject<{
866
+ /** Agent-id or operator handle — attributable (mirrors the provenance field). Trimmed. */
867
+ author: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
868
+ /**
869
+ * ISO-8601 authoring date — trimmed + calendar-validated at the INTAKE boundary
870
+ * (CR diff-review): the same `isIso8601CalendarDate` the record provenance uses,
871
+ * so a malformed `not-a-date` fails here with a clean `CONFIG_INVALID` instead of
872
+ * escaping to a raw ZodError at record construction (pass 1).
873
+ */
874
+ authoredAt: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
875
+ /** The declared DEFECT the rule targets — the pre-image, not its fix (ADR-110 §4 TP-def). Trimmed. */
876
+ targetDefect: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
877
+ /** The matcher engine the author declares; the eligibility check confirms it can represent the class. */
878
+ declaredEngine: z.ZodEnum<["regex", "ast", "ast-grep"]>;
879
+ /**
880
+ * The structural rule-CLASS the author CLAIMS. Fed to the INDEPENDENT
881
+ * `evaluateStructuralEligibility` against the DI whitelist; it is NOT stored
882
+ * verbatim on the record — the *verdict* (`structuralEligibility`, basis
883
+ * `whitelist:<class>`) is. Naming a class is a claim the check adjudicates,
884
+ * never a self-certification of `decidable`. Trimmed so a stray space can't
885
+ * cause an exact-match miss against the registry.
886
+ */
887
+ structuralClass: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
888
+ /** The human-written matcher (same DSL the compiler accepts from the miner). */
889
+ dslSource: z.ZodEffects<z.ZodString, string, string>;
890
+ /** ≥1 real lc instance the rule claims to catch — ALL train-side (§5). */
891
+ positiveFixtures: z.ZodArray<z.ZodEffects<z.ZodObject<{
892
+ pr: z.ZodNumber;
893
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
894
+ kind: z.ZodLiteral<"lesson">;
895
+ lessonRef: z.ZodString;
896
+ badExample: z.ZodEffects<z.ZodString, string, string>;
897
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
898
+ }, "strict", z.ZodTypeAny, {
899
+ kind: "lesson";
900
+ lessonRef: string;
901
+ badExample: string;
902
+ goodExample: string;
903
+ }, {
904
+ kind: "lesson";
905
+ lessonRef: string;
906
+ badExample: string;
907
+ goodExample: string;
908
+ }>, z.ZodObject<{
909
+ kind: z.ZodLiteral<"commit">;
910
+ preimageCommitSha: z.ZodString;
911
+ mergeCommitSha: z.ZodString;
912
+ }, "strict", z.ZodTypeAny, {
913
+ kind: "commit";
914
+ preimageCommitSha: string;
915
+ mergeCommitSha: string;
916
+ }, {
917
+ kind: "commit";
918
+ preimageCommitSha: string;
919
+ mergeCommitSha: string;
920
+ }>]>;
921
+ filePath: z.ZodEffects<z.ZodString, string, string>;
922
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
923
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
924
+ }, "strict", z.ZodTypeAny, {
925
+ pr: number;
926
+ preimageSource: {
927
+ kind: "lesson";
928
+ lessonRef: string;
929
+ badExample: string;
930
+ goodExample: string;
931
+ } | {
932
+ kind: "commit";
933
+ preimageCommitSha: string;
934
+ mergeCommitSha: string;
935
+ };
936
+ filePath: string;
937
+ matchedSpan: string;
938
+ contentHash: string;
939
+ }, {
940
+ pr: number;
941
+ preimageSource: {
942
+ kind: "lesson";
943
+ lessonRef: string;
944
+ badExample: string;
945
+ goodExample: string;
946
+ } | {
947
+ kind: "commit";
948
+ preimageCommitSha: string;
949
+ mergeCommitSha: string;
950
+ };
951
+ filePath: string;
952
+ matchedSpan: string;
953
+ contentHash: string;
954
+ }>, {
955
+ pr: number;
956
+ preimageSource: {
957
+ kind: "lesson";
958
+ lessonRef: string;
959
+ badExample: string;
960
+ goodExample: string;
961
+ } | {
962
+ kind: "commit";
963
+ preimageCommitSha: string;
964
+ mergeCommitSha: string;
965
+ };
966
+ filePath: string;
967
+ matchedSpan: string;
968
+ contentHash: string;
969
+ }, {
970
+ pr: number;
971
+ preimageSource: {
972
+ kind: "lesson";
973
+ lessonRef: string;
974
+ badExample: string;
975
+ goodExample: string;
976
+ } | {
977
+ kind: "commit";
978
+ preimageCommitSha: string;
979
+ mergeCommitSha: string;
980
+ };
981
+ filePath: string;
982
+ matchedSpan: string;
983
+ contentHash: string;
984
+ }>, "many">;
985
+ /** Declared near-misses the rule must stay silent on (feeds §6 negative controls). */
986
+ negativeFixtures: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
987
+ pr: z.ZodNumber;
988
+ preimageSource: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
989
+ kind: z.ZodLiteral<"lesson">;
990
+ lessonRef: z.ZodString;
991
+ badExample: z.ZodEffects<z.ZodString, string, string>;
992
+ goodExample: z.ZodEffects<z.ZodString, string, string>;
993
+ }, "strict", z.ZodTypeAny, {
994
+ kind: "lesson";
995
+ lessonRef: string;
996
+ badExample: string;
997
+ goodExample: string;
998
+ }, {
999
+ kind: "lesson";
1000
+ lessonRef: string;
1001
+ badExample: string;
1002
+ goodExample: string;
1003
+ }>, z.ZodObject<{
1004
+ kind: z.ZodLiteral<"commit">;
1005
+ preimageCommitSha: z.ZodString;
1006
+ mergeCommitSha: z.ZodString;
1007
+ }, "strict", z.ZodTypeAny, {
1008
+ kind: "commit";
1009
+ preimageCommitSha: string;
1010
+ mergeCommitSha: string;
1011
+ }, {
1012
+ kind: "commit";
1013
+ preimageCommitSha: string;
1014
+ mergeCommitSha: string;
1015
+ }>]>;
1016
+ filePath: z.ZodEffects<z.ZodString, string, string>;
1017
+ matchedSpan: z.ZodEffects<z.ZodString, string, string>;
1018
+ contentHash: z.ZodEffects<z.ZodString, string, string>;
1019
+ }, "strict", z.ZodTypeAny, {
1020
+ pr: number;
1021
+ preimageSource: {
1022
+ kind: "lesson";
1023
+ lessonRef: string;
1024
+ badExample: string;
1025
+ goodExample: string;
1026
+ } | {
1027
+ kind: "commit";
1028
+ preimageCommitSha: string;
1029
+ mergeCommitSha: string;
1030
+ };
1031
+ filePath: string;
1032
+ matchedSpan: string;
1033
+ contentHash: string;
1034
+ }, {
1035
+ pr: number;
1036
+ preimageSource: {
1037
+ kind: "lesson";
1038
+ lessonRef: string;
1039
+ badExample: string;
1040
+ goodExample: string;
1041
+ } | {
1042
+ kind: "commit";
1043
+ preimageCommitSha: string;
1044
+ mergeCommitSha: string;
1045
+ };
1046
+ filePath: string;
1047
+ matchedSpan: string;
1048
+ contentHash: string;
1049
+ }>, {
1050
+ pr: number;
1051
+ preimageSource: {
1052
+ kind: "lesson";
1053
+ lessonRef: string;
1054
+ badExample: string;
1055
+ goodExample: string;
1056
+ } | {
1057
+ kind: "commit";
1058
+ preimageCommitSha: string;
1059
+ mergeCommitSha: string;
1060
+ };
1061
+ filePath: string;
1062
+ matchedSpan: string;
1063
+ contentHash: string;
1064
+ }, {
1065
+ pr: number;
1066
+ preimageSource: {
1067
+ kind: "lesson";
1068
+ lessonRef: string;
1069
+ badExample: string;
1070
+ goodExample: string;
1071
+ } | {
1072
+ kind: "commit";
1073
+ preimageCommitSha: string;
1074
+ mergeCommitSha: string;
1075
+ };
1076
+ filePath: string;
1077
+ matchedSpan: string;
1078
+ contentHash: string;
1079
+ }>, "many">>;
1080
+ /**
1081
+ * Accelerant lineage (§7). Optional in the YAML; the reader defaults an
1082
+ * absent value to `{ kind: 'from-scratch' }` when constructing the record, so
1083
+ * the persisted `origin` is always explicit (§7 lineage is never erased).
1084
+ */
1085
+ origin: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1086
+ kind: z.ZodLiteral<"from-scratch">;
1087
+ }, "strip", z.ZodTypeAny, {
1088
+ kind: "from-scratch";
1089
+ }, {
1090
+ kind: "from-scratch";
1091
+ }>, z.ZodObject<{
1092
+ kind: z.ZodLiteral<"mined-accelerant">;
1093
+ sourceRunId: z.ZodEffects<z.ZodString, string, string>;
1094
+ suggestionHash: z.ZodEffects<z.ZodString, string, string>;
1095
+ }, "strip", z.ZodTypeAny, {
1096
+ kind: "mined-accelerant";
1097
+ sourceRunId: string;
1098
+ suggestionHash: string;
1099
+ }, {
1100
+ kind: "mined-accelerant";
1101
+ sourceRunId: string;
1102
+ suggestionHash: string;
1103
+ }>]>>;
1104
+ }, "strict", z.ZodTypeAny, {
1105
+ author: string;
1106
+ authoredAt: string;
1107
+ targetDefect: string;
1108
+ positiveFixtures: {
1109
+ pr: number;
1110
+ preimageSource: {
1111
+ kind: "lesson";
1112
+ lessonRef: string;
1113
+ badExample: string;
1114
+ goodExample: string;
1115
+ } | {
1116
+ kind: "commit";
1117
+ preimageCommitSha: string;
1118
+ mergeCommitSha: string;
1119
+ };
1120
+ filePath: string;
1121
+ matchedSpan: string;
1122
+ contentHash: string;
1123
+ }[];
1124
+ dslSource: string;
1125
+ declaredEngine: "regex" | "ast" | "ast-grep";
1126
+ structuralClass: string;
1127
+ negativeFixtures?: {
1128
+ pr: number;
1129
+ preimageSource: {
1130
+ kind: "lesson";
1131
+ lessonRef: string;
1132
+ badExample: string;
1133
+ goodExample: string;
1134
+ } | {
1135
+ kind: "commit";
1136
+ preimageCommitSha: string;
1137
+ mergeCommitSha: string;
1138
+ };
1139
+ filePath: string;
1140
+ matchedSpan: string;
1141
+ contentHash: string;
1142
+ }[] | undefined;
1143
+ origin?: {
1144
+ kind: "from-scratch";
1145
+ } | {
1146
+ kind: "mined-accelerant";
1147
+ sourceRunId: string;
1148
+ suggestionHash: string;
1149
+ } | undefined;
1150
+ }, {
1151
+ author: string;
1152
+ authoredAt: string;
1153
+ targetDefect: string;
1154
+ positiveFixtures: {
1155
+ pr: number;
1156
+ preimageSource: {
1157
+ kind: "lesson";
1158
+ lessonRef: string;
1159
+ badExample: string;
1160
+ goodExample: string;
1161
+ } | {
1162
+ kind: "commit";
1163
+ preimageCommitSha: string;
1164
+ mergeCommitSha: string;
1165
+ };
1166
+ filePath: string;
1167
+ matchedSpan: string;
1168
+ contentHash: string;
1169
+ }[];
1170
+ dslSource: string;
1171
+ declaredEngine: "regex" | "ast" | "ast-grep";
1172
+ structuralClass: string;
1173
+ negativeFixtures?: {
1174
+ pr: number;
1175
+ preimageSource: {
1176
+ kind: "lesson";
1177
+ lessonRef: string;
1178
+ badExample: string;
1179
+ goodExample: string;
1180
+ } | {
1181
+ kind: "commit";
1182
+ preimageCommitSha: string;
1183
+ mergeCommitSha: string;
1184
+ };
1185
+ filePath: string;
1186
+ matchedSpan: string;
1187
+ contentHash: string;
1188
+ }[] | undefined;
1189
+ origin?: {
1190
+ kind: "from-scratch";
1191
+ } | {
1192
+ kind: "mined-accelerant";
1193
+ sourceRunId: string;
1194
+ suggestionHash: string;
1195
+ } | undefined;
1196
+ }>, "many">;
1197
+ }, "strict", z.ZodTypeAny, {
1198
+ rules: {
1199
+ author: string;
1200
+ authoredAt: string;
1201
+ targetDefect: string;
1202
+ positiveFixtures: {
1203
+ pr: number;
1204
+ preimageSource: {
1205
+ kind: "lesson";
1206
+ lessonRef: string;
1207
+ badExample: string;
1208
+ goodExample: string;
1209
+ } | {
1210
+ kind: "commit";
1211
+ preimageCommitSha: string;
1212
+ mergeCommitSha: string;
1213
+ };
1214
+ filePath: string;
1215
+ matchedSpan: string;
1216
+ contentHash: string;
1217
+ }[];
1218
+ dslSource: string;
1219
+ declaredEngine: "regex" | "ast" | "ast-grep";
1220
+ structuralClass: string;
1221
+ negativeFixtures?: {
1222
+ pr: number;
1223
+ preimageSource: {
1224
+ kind: "lesson";
1225
+ lessonRef: string;
1226
+ badExample: string;
1227
+ goodExample: string;
1228
+ } | {
1229
+ kind: "commit";
1230
+ preimageCommitSha: string;
1231
+ mergeCommitSha: string;
1232
+ };
1233
+ filePath: string;
1234
+ matchedSpan: string;
1235
+ contentHash: string;
1236
+ }[] | undefined;
1237
+ origin?: {
1238
+ kind: "from-scratch";
1239
+ } | {
1240
+ kind: "mined-accelerant";
1241
+ sourceRunId: string;
1242
+ suggestionHash: string;
1243
+ } | undefined;
1244
+ }[];
1245
+ splitRef: string;
1246
+ authoredAfterSplit: true;
1247
+ heldOutNonInspectionAttestation: true;
1248
+ }, {
1249
+ rules: {
1250
+ author: string;
1251
+ authoredAt: string;
1252
+ targetDefect: string;
1253
+ positiveFixtures: {
1254
+ pr: number;
1255
+ preimageSource: {
1256
+ kind: "lesson";
1257
+ lessonRef: string;
1258
+ badExample: string;
1259
+ goodExample: string;
1260
+ } | {
1261
+ kind: "commit";
1262
+ preimageCommitSha: string;
1263
+ mergeCommitSha: string;
1264
+ };
1265
+ filePath: string;
1266
+ matchedSpan: string;
1267
+ contentHash: string;
1268
+ }[];
1269
+ dslSource: string;
1270
+ declaredEngine: "regex" | "ast" | "ast-grep";
1271
+ structuralClass: string;
1272
+ negativeFixtures?: {
1273
+ pr: number;
1274
+ preimageSource: {
1275
+ kind: "lesson";
1276
+ lessonRef: string;
1277
+ badExample: string;
1278
+ goodExample: string;
1279
+ } | {
1280
+ kind: "commit";
1281
+ preimageCommitSha: string;
1282
+ mergeCommitSha: string;
1283
+ };
1284
+ filePath: string;
1285
+ matchedSpan: string;
1286
+ contentHash: string;
1287
+ }[] | undefined;
1288
+ origin?: {
1289
+ kind: "from-scratch";
1290
+ } | {
1291
+ kind: "mined-accelerant";
1292
+ sourceRunId: string;
1293
+ suggestionHash: string;
1294
+ } | undefined;
1295
+ }[];
1296
+ splitRef: string;
1297
+ authoredAfterSplit: true;
1298
+ heldOutNonInspectionAttestation: true;
1299
+ }>;
1300
+ export type AuthoredRulesFile = z.infer<typeof AuthoredRulesFileSchema>;
303
1301
  /**
304
1302
  * One decidable `(engine, structuralClass)` pair. The whitelist of these lives
305
1303
  * in the CLI registry (slice B); the registry lists ONLY pairs the engine can