veto-sdk 2.5.1 → 2.6.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.
@@ -0,0 +1,802 @@
1
+ /**
2
+ * Pipeline DSL — declarative, content-addressable spec for dynamic
3
+ * policy feeds.
4
+ *
5
+ * A pipeline composes a small set of validated resolver operations into
6
+ * a list-producing DAG. The LLM compiler emits pipelines by selecting
7
+ * from a fixed catalog; it never writes executable code. Identity is
8
+ * the sha256 of the canonicalized spec (minus `id`), so two callers
9
+ * requesting "block gambling sites" share one pipeline.
10
+ *
11
+ * This module is pure OSS: runtime, scheduler, and resolver
12
+ * implementations live in the platform. The SDK only exposes the
13
+ * schema and validator so consumers can author, verify, and diff
14
+ * pipeline specs without the platform.
15
+ *
16
+ * @module rules/pipeline-dsl
17
+ */
18
+ import { z } from 'zod';
19
+ export declare const PipelineStepSchema: z.ZodUnion<[z.ZodObject<{
20
+ kind: z.ZodLiteral<"search">;
21
+ resolver: z.ZodString;
22
+ query: z.ZodString;
23
+ limit: z.ZodOptional<z.ZodNumber>;
24
+ as: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ kind: "search";
27
+ query: string;
28
+ resolver: string;
29
+ limit?: number | undefined;
30
+ as?: string | undefined;
31
+ }, {
32
+ kind: "search";
33
+ query: string;
34
+ resolver: string;
35
+ limit?: number | undefined;
36
+ as?: string | undefined;
37
+ }>, z.ZodObject<{
38
+ kind: z.ZodLiteral<"fetch">;
39
+ resolver: z.ZodString;
40
+ id_from: z.ZodString;
41
+ fields: z.ZodArray<z.ZodString, "many">;
42
+ as: z.ZodOptional<z.ZodString>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ fields: string[];
45
+ kind: "fetch";
46
+ resolver: string;
47
+ id_from: string;
48
+ as?: string | undefined;
49
+ }, {
50
+ fields: string[];
51
+ kind: "fetch";
52
+ resolver: string;
53
+ id_from: string;
54
+ as?: string | undefined;
55
+ }>, z.ZodObject<{
56
+ kind: z.ZodLiteral<"extract">;
57
+ from: z.ZodString;
58
+ selector: z.ZodString;
59
+ as: z.ZodString;
60
+ }, "strip", z.ZodTypeAny, {
61
+ kind: "extract";
62
+ from: string;
63
+ as: string;
64
+ selector: string;
65
+ }, {
66
+ kind: "extract";
67
+ from: string;
68
+ as: string;
69
+ selector: string;
70
+ }>, z.ZodObject<{
71
+ kind: z.ZodLiteral<"aggregate">;
72
+ source: z.ZodString;
73
+ op: z.ZodEnum<["unique", "count", "union", "intersect"]>;
74
+ as: z.ZodOptional<z.ZodString>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ source: string;
77
+ op: "count" | "unique" | "union" | "intersect";
78
+ kind: "aggregate";
79
+ as?: string | undefined;
80
+ }, {
81
+ source: string;
82
+ op: "count" | "unique" | "union" | "intersect";
83
+ kind: "aggregate";
84
+ as?: string | undefined;
85
+ }>, z.ZodObject<{
86
+ kind: z.ZodLiteral<"diff">;
87
+ current: z.ZodString;
88
+ previous: z.ZodString;
89
+ emit: z.ZodEnum<["added", "removed", "changed"]>;
90
+ as: z.ZodOptional<z.ZodString>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ current: string;
93
+ kind: "diff";
94
+ previous: string;
95
+ emit: "added" | "removed" | "changed";
96
+ as?: string | undefined;
97
+ }, {
98
+ current: string;
99
+ kind: "diff";
100
+ previous: string;
101
+ emit: "added" | "removed" | "changed";
102
+ as?: string | undefined;
103
+ }>, z.ZodObject<{
104
+ kind: z.ZodLiteral<"foreach">;
105
+ source: z.ZodString;
106
+ do: z.ZodArray<z.ZodUnion<[z.ZodObject<{
107
+ kind: z.ZodLiteral<"search">;
108
+ resolver: z.ZodString;
109
+ query: z.ZodString;
110
+ limit: z.ZodOptional<z.ZodNumber>;
111
+ as: z.ZodOptional<z.ZodString>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ kind: "search";
114
+ query: string;
115
+ resolver: string;
116
+ limit?: number | undefined;
117
+ as?: string | undefined;
118
+ }, {
119
+ kind: "search";
120
+ query: string;
121
+ resolver: string;
122
+ limit?: number | undefined;
123
+ as?: string | undefined;
124
+ }>, z.ZodObject<{
125
+ kind: z.ZodLiteral<"fetch">;
126
+ resolver: z.ZodString;
127
+ id_from: z.ZodString;
128
+ fields: z.ZodArray<z.ZodString, "many">;
129
+ as: z.ZodOptional<z.ZodString>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ fields: string[];
132
+ kind: "fetch";
133
+ resolver: string;
134
+ id_from: string;
135
+ as?: string | undefined;
136
+ }, {
137
+ fields: string[];
138
+ kind: "fetch";
139
+ resolver: string;
140
+ id_from: string;
141
+ as?: string | undefined;
142
+ }>, z.ZodObject<{
143
+ kind: z.ZodLiteral<"extract">;
144
+ from: z.ZodString;
145
+ selector: z.ZodString;
146
+ as: z.ZodString;
147
+ }, "strip", z.ZodTypeAny, {
148
+ kind: "extract";
149
+ from: string;
150
+ as: string;
151
+ selector: string;
152
+ }, {
153
+ kind: "extract";
154
+ from: string;
155
+ as: string;
156
+ selector: string;
157
+ }>, z.ZodObject<{
158
+ kind: z.ZodLiteral<"aggregate">;
159
+ source: z.ZodString;
160
+ op: z.ZodEnum<["unique", "count", "union", "intersect"]>;
161
+ as: z.ZodOptional<z.ZodString>;
162
+ }, "strip", z.ZodTypeAny, {
163
+ source: string;
164
+ op: "count" | "unique" | "union" | "intersect";
165
+ kind: "aggregate";
166
+ as?: string | undefined;
167
+ }, {
168
+ source: string;
169
+ op: "count" | "unique" | "union" | "intersect";
170
+ kind: "aggregate";
171
+ as?: string | undefined;
172
+ }>, z.ZodObject<{
173
+ kind: z.ZodLiteral<"diff">;
174
+ current: z.ZodString;
175
+ previous: z.ZodString;
176
+ emit: z.ZodEnum<["added", "removed", "changed"]>;
177
+ as: z.ZodOptional<z.ZodString>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ current: string;
180
+ kind: "diff";
181
+ previous: string;
182
+ emit: "added" | "removed" | "changed";
183
+ as?: string | undefined;
184
+ }, {
185
+ current: string;
186
+ kind: "diff";
187
+ previous: string;
188
+ emit: "added" | "removed" | "changed";
189
+ as?: string | undefined;
190
+ }>]>, "many">;
191
+ as: z.ZodOptional<z.ZodString>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ source: string;
194
+ kind: "foreach";
195
+ do: ({
196
+ kind: "search";
197
+ query: string;
198
+ resolver: string;
199
+ limit?: number | undefined;
200
+ as?: string | undefined;
201
+ } | {
202
+ fields: string[];
203
+ kind: "fetch";
204
+ resolver: string;
205
+ id_from: string;
206
+ as?: string | undefined;
207
+ } | {
208
+ kind: "extract";
209
+ from: string;
210
+ as: string;
211
+ selector: string;
212
+ } | {
213
+ source: string;
214
+ op: "count" | "unique" | "union" | "intersect";
215
+ kind: "aggregate";
216
+ as?: string | undefined;
217
+ } | {
218
+ current: string;
219
+ kind: "diff";
220
+ previous: string;
221
+ emit: "added" | "removed" | "changed";
222
+ as?: string | undefined;
223
+ })[];
224
+ as?: string | undefined;
225
+ }, {
226
+ source: string;
227
+ kind: "foreach";
228
+ do: ({
229
+ kind: "search";
230
+ query: string;
231
+ resolver: string;
232
+ limit?: number | undefined;
233
+ as?: string | undefined;
234
+ } | {
235
+ fields: string[];
236
+ kind: "fetch";
237
+ resolver: string;
238
+ id_from: string;
239
+ as?: string | undefined;
240
+ } | {
241
+ kind: "extract";
242
+ from: string;
243
+ as: string;
244
+ selector: string;
245
+ } | {
246
+ source: string;
247
+ op: "count" | "unique" | "union" | "intersect";
248
+ kind: "aggregate";
249
+ as?: string | undefined;
250
+ } | {
251
+ current: string;
252
+ kind: "diff";
253
+ previous: string;
254
+ emit: "added" | "removed" | "changed";
255
+ as?: string | undefined;
256
+ })[];
257
+ as?: string | undefined;
258
+ }>]>;
259
+ export type PipelineStep = z.infer<typeof PipelineStepSchema>;
260
+ export declare const PipelineScheduleSchema: z.ZodUnion<[z.ZodObject<{
261
+ kind: z.ZodLiteral<"interval">;
262
+ every_sec: z.ZodNumber;
263
+ }, "strip", z.ZodTypeAny, {
264
+ kind: "interval";
265
+ every_sec: number;
266
+ }, {
267
+ kind: "interval";
268
+ every_sec: number;
269
+ }>, z.ZodObject<{
270
+ kind: z.ZodLiteral<"cron">;
271
+ expr: z.ZodString;
272
+ }, "strip", z.ZodTypeAny, {
273
+ kind: "cron";
274
+ expr: string;
275
+ }, {
276
+ kind: "cron";
277
+ expr: string;
278
+ }>]>;
279
+ export type PipelineSchedule = z.infer<typeof PipelineScheduleSchema>;
280
+ export declare const PipelineOutputSchema: z.ZodObject<{
281
+ shape: z.ZodEnum<["list_of_strings", "list_of_objects"]>;
282
+ schema: z.ZodOptional<z.ZodUnknown>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ shape: "list_of_strings" | "list_of_objects";
285
+ schema?: unknown;
286
+ }, {
287
+ shape: "list_of_strings" | "list_of_objects";
288
+ schema?: unknown;
289
+ }>;
290
+ export type PipelineOutput = z.infer<typeof PipelineOutputSchema>;
291
+ export declare const PipelineBudgetSchema: z.ZodObject<{
292
+ max_resolver_calls_per_run: z.ZodNumber;
293
+ max_tokens_per_run: z.ZodNumber;
294
+ }, "strip", z.ZodTypeAny, {
295
+ max_resolver_calls_per_run: number;
296
+ max_tokens_per_run: number;
297
+ }, {
298
+ max_resolver_calls_per_run: number;
299
+ max_tokens_per_run: number;
300
+ }>;
301
+ export type PipelineBudget = z.infer<typeof PipelineBudgetSchema>;
302
+ export declare const PipelineSpecSchema: z.ZodObject<{
303
+ dsl_version: z.ZodLiteral<1>;
304
+ id: z.ZodString;
305
+ description: z.ZodOptional<z.ZodString>;
306
+ schedule: z.ZodUnion<[z.ZodObject<{
307
+ kind: z.ZodLiteral<"interval">;
308
+ every_sec: z.ZodNumber;
309
+ }, "strip", z.ZodTypeAny, {
310
+ kind: "interval";
311
+ every_sec: number;
312
+ }, {
313
+ kind: "interval";
314
+ every_sec: number;
315
+ }>, z.ZodObject<{
316
+ kind: z.ZodLiteral<"cron">;
317
+ expr: z.ZodString;
318
+ }, "strip", z.ZodTypeAny, {
319
+ kind: "cron";
320
+ expr: string;
321
+ }, {
322
+ kind: "cron";
323
+ expr: string;
324
+ }>]>;
325
+ steps: z.ZodArray<z.ZodUnion<[z.ZodObject<{
326
+ kind: z.ZodLiteral<"search">;
327
+ resolver: z.ZodString;
328
+ query: z.ZodString;
329
+ limit: z.ZodOptional<z.ZodNumber>;
330
+ as: z.ZodOptional<z.ZodString>;
331
+ }, "strip", z.ZodTypeAny, {
332
+ kind: "search";
333
+ query: string;
334
+ resolver: string;
335
+ limit?: number | undefined;
336
+ as?: string | undefined;
337
+ }, {
338
+ kind: "search";
339
+ query: string;
340
+ resolver: string;
341
+ limit?: number | undefined;
342
+ as?: string | undefined;
343
+ }>, z.ZodObject<{
344
+ kind: z.ZodLiteral<"fetch">;
345
+ resolver: z.ZodString;
346
+ id_from: z.ZodString;
347
+ fields: z.ZodArray<z.ZodString, "many">;
348
+ as: z.ZodOptional<z.ZodString>;
349
+ }, "strip", z.ZodTypeAny, {
350
+ fields: string[];
351
+ kind: "fetch";
352
+ resolver: string;
353
+ id_from: string;
354
+ as?: string | undefined;
355
+ }, {
356
+ fields: string[];
357
+ kind: "fetch";
358
+ resolver: string;
359
+ id_from: string;
360
+ as?: string | undefined;
361
+ }>, z.ZodObject<{
362
+ kind: z.ZodLiteral<"extract">;
363
+ from: z.ZodString;
364
+ selector: z.ZodString;
365
+ as: z.ZodString;
366
+ }, "strip", z.ZodTypeAny, {
367
+ kind: "extract";
368
+ from: string;
369
+ as: string;
370
+ selector: string;
371
+ }, {
372
+ kind: "extract";
373
+ from: string;
374
+ as: string;
375
+ selector: string;
376
+ }>, z.ZodObject<{
377
+ kind: z.ZodLiteral<"aggregate">;
378
+ source: z.ZodString;
379
+ op: z.ZodEnum<["unique", "count", "union", "intersect"]>;
380
+ as: z.ZodOptional<z.ZodString>;
381
+ }, "strip", z.ZodTypeAny, {
382
+ source: string;
383
+ op: "count" | "unique" | "union" | "intersect";
384
+ kind: "aggregate";
385
+ as?: string | undefined;
386
+ }, {
387
+ source: string;
388
+ op: "count" | "unique" | "union" | "intersect";
389
+ kind: "aggregate";
390
+ as?: string | undefined;
391
+ }>, z.ZodObject<{
392
+ kind: z.ZodLiteral<"diff">;
393
+ current: z.ZodString;
394
+ previous: z.ZodString;
395
+ emit: z.ZodEnum<["added", "removed", "changed"]>;
396
+ as: z.ZodOptional<z.ZodString>;
397
+ }, "strip", z.ZodTypeAny, {
398
+ current: string;
399
+ kind: "diff";
400
+ previous: string;
401
+ emit: "added" | "removed" | "changed";
402
+ as?: string | undefined;
403
+ }, {
404
+ current: string;
405
+ kind: "diff";
406
+ previous: string;
407
+ emit: "added" | "removed" | "changed";
408
+ as?: string | undefined;
409
+ }>, z.ZodObject<{
410
+ kind: z.ZodLiteral<"foreach">;
411
+ source: z.ZodString;
412
+ do: z.ZodArray<z.ZodUnion<[z.ZodObject<{
413
+ kind: z.ZodLiteral<"search">;
414
+ resolver: z.ZodString;
415
+ query: z.ZodString;
416
+ limit: z.ZodOptional<z.ZodNumber>;
417
+ as: z.ZodOptional<z.ZodString>;
418
+ }, "strip", z.ZodTypeAny, {
419
+ kind: "search";
420
+ query: string;
421
+ resolver: string;
422
+ limit?: number | undefined;
423
+ as?: string | undefined;
424
+ }, {
425
+ kind: "search";
426
+ query: string;
427
+ resolver: string;
428
+ limit?: number | undefined;
429
+ as?: string | undefined;
430
+ }>, z.ZodObject<{
431
+ kind: z.ZodLiteral<"fetch">;
432
+ resolver: z.ZodString;
433
+ id_from: z.ZodString;
434
+ fields: z.ZodArray<z.ZodString, "many">;
435
+ as: z.ZodOptional<z.ZodString>;
436
+ }, "strip", z.ZodTypeAny, {
437
+ fields: string[];
438
+ kind: "fetch";
439
+ resolver: string;
440
+ id_from: string;
441
+ as?: string | undefined;
442
+ }, {
443
+ fields: string[];
444
+ kind: "fetch";
445
+ resolver: string;
446
+ id_from: string;
447
+ as?: string | undefined;
448
+ }>, z.ZodObject<{
449
+ kind: z.ZodLiteral<"extract">;
450
+ from: z.ZodString;
451
+ selector: z.ZodString;
452
+ as: z.ZodString;
453
+ }, "strip", z.ZodTypeAny, {
454
+ kind: "extract";
455
+ from: string;
456
+ as: string;
457
+ selector: string;
458
+ }, {
459
+ kind: "extract";
460
+ from: string;
461
+ as: string;
462
+ selector: string;
463
+ }>, z.ZodObject<{
464
+ kind: z.ZodLiteral<"aggregate">;
465
+ source: z.ZodString;
466
+ op: z.ZodEnum<["unique", "count", "union", "intersect"]>;
467
+ as: z.ZodOptional<z.ZodString>;
468
+ }, "strip", z.ZodTypeAny, {
469
+ source: string;
470
+ op: "count" | "unique" | "union" | "intersect";
471
+ kind: "aggregate";
472
+ as?: string | undefined;
473
+ }, {
474
+ source: string;
475
+ op: "count" | "unique" | "union" | "intersect";
476
+ kind: "aggregate";
477
+ as?: string | undefined;
478
+ }>, z.ZodObject<{
479
+ kind: z.ZodLiteral<"diff">;
480
+ current: z.ZodString;
481
+ previous: z.ZodString;
482
+ emit: z.ZodEnum<["added", "removed", "changed"]>;
483
+ as: z.ZodOptional<z.ZodString>;
484
+ }, "strip", z.ZodTypeAny, {
485
+ current: string;
486
+ kind: "diff";
487
+ previous: string;
488
+ emit: "added" | "removed" | "changed";
489
+ as?: string | undefined;
490
+ }, {
491
+ current: string;
492
+ kind: "diff";
493
+ previous: string;
494
+ emit: "added" | "removed" | "changed";
495
+ as?: string | undefined;
496
+ }>]>, "many">;
497
+ as: z.ZodOptional<z.ZodString>;
498
+ }, "strip", z.ZodTypeAny, {
499
+ source: string;
500
+ kind: "foreach";
501
+ do: ({
502
+ kind: "search";
503
+ query: string;
504
+ resolver: string;
505
+ limit?: number | undefined;
506
+ as?: string | undefined;
507
+ } | {
508
+ fields: string[];
509
+ kind: "fetch";
510
+ resolver: string;
511
+ id_from: string;
512
+ as?: string | undefined;
513
+ } | {
514
+ kind: "extract";
515
+ from: string;
516
+ as: string;
517
+ selector: string;
518
+ } | {
519
+ source: string;
520
+ op: "count" | "unique" | "union" | "intersect";
521
+ kind: "aggregate";
522
+ as?: string | undefined;
523
+ } | {
524
+ current: string;
525
+ kind: "diff";
526
+ previous: string;
527
+ emit: "added" | "removed" | "changed";
528
+ as?: string | undefined;
529
+ })[];
530
+ as?: string | undefined;
531
+ }, {
532
+ source: string;
533
+ kind: "foreach";
534
+ do: ({
535
+ kind: "search";
536
+ query: string;
537
+ resolver: string;
538
+ limit?: number | undefined;
539
+ as?: string | undefined;
540
+ } | {
541
+ fields: string[];
542
+ kind: "fetch";
543
+ resolver: string;
544
+ id_from: string;
545
+ as?: string | undefined;
546
+ } | {
547
+ kind: "extract";
548
+ from: string;
549
+ as: string;
550
+ selector: string;
551
+ } | {
552
+ source: string;
553
+ op: "count" | "unique" | "union" | "intersect";
554
+ kind: "aggregate";
555
+ as?: string | undefined;
556
+ } | {
557
+ current: string;
558
+ kind: "diff";
559
+ previous: string;
560
+ emit: "added" | "removed" | "changed";
561
+ as?: string | undefined;
562
+ })[];
563
+ as?: string | undefined;
564
+ }>]>, "many">;
565
+ output: z.ZodObject<{
566
+ shape: z.ZodEnum<["list_of_strings", "list_of_objects"]>;
567
+ schema: z.ZodOptional<z.ZodUnknown>;
568
+ }, "strip", z.ZodTypeAny, {
569
+ shape: "list_of_strings" | "list_of_objects";
570
+ schema?: unknown;
571
+ }, {
572
+ shape: "list_of_strings" | "list_of_objects";
573
+ schema?: unknown;
574
+ }>;
575
+ budget: z.ZodObject<{
576
+ max_resolver_calls_per_run: z.ZodNumber;
577
+ max_tokens_per_run: z.ZodNumber;
578
+ }, "strip", z.ZodTypeAny, {
579
+ max_resolver_calls_per_run: number;
580
+ max_tokens_per_run: number;
581
+ }, {
582
+ max_resolver_calls_per_run: number;
583
+ max_tokens_per_run: number;
584
+ }>;
585
+ on_failure: z.ZodEnum<["skip", "fail_open", "fail_closed", "last_known_good"]>;
586
+ }, "strip", z.ZodTypeAny, {
587
+ output: {
588
+ shape: "list_of_strings" | "list_of_objects";
589
+ schema?: unknown;
590
+ };
591
+ id: string;
592
+ budget: {
593
+ max_resolver_calls_per_run: number;
594
+ max_tokens_per_run: number;
595
+ };
596
+ dsl_version: 1;
597
+ schedule: {
598
+ kind: "interval";
599
+ every_sec: number;
600
+ } | {
601
+ kind: "cron";
602
+ expr: string;
603
+ };
604
+ steps: ({
605
+ kind: "search";
606
+ query: string;
607
+ resolver: string;
608
+ limit?: number | undefined;
609
+ as?: string | undefined;
610
+ } | {
611
+ fields: string[];
612
+ kind: "fetch";
613
+ resolver: string;
614
+ id_from: string;
615
+ as?: string | undefined;
616
+ } | {
617
+ kind: "extract";
618
+ from: string;
619
+ as: string;
620
+ selector: string;
621
+ } | {
622
+ source: string;
623
+ op: "count" | "unique" | "union" | "intersect";
624
+ kind: "aggregate";
625
+ as?: string | undefined;
626
+ } | {
627
+ current: string;
628
+ kind: "diff";
629
+ previous: string;
630
+ emit: "added" | "removed" | "changed";
631
+ as?: string | undefined;
632
+ } | {
633
+ source: string;
634
+ kind: "foreach";
635
+ do: ({
636
+ kind: "search";
637
+ query: string;
638
+ resolver: string;
639
+ limit?: number | undefined;
640
+ as?: string | undefined;
641
+ } | {
642
+ fields: string[];
643
+ kind: "fetch";
644
+ resolver: string;
645
+ id_from: string;
646
+ as?: string | undefined;
647
+ } | {
648
+ kind: "extract";
649
+ from: string;
650
+ as: string;
651
+ selector: string;
652
+ } | {
653
+ source: string;
654
+ op: "count" | "unique" | "union" | "intersect";
655
+ kind: "aggregate";
656
+ as?: string | undefined;
657
+ } | {
658
+ current: string;
659
+ kind: "diff";
660
+ previous: string;
661
+ emit: "added" | "removed" | "changed";
662
+ as?: string | undefined;
663
+ })[];
664
+ as?: string | undefined;
665
+ })[];
666
+ on_failure: "fail_open" | "fail_closed" | "last_known_good" | "skip";
667
+ description?: string | undefined;
668
+ }, {
669
+ output: {
670
+ shape: "list_of_strings" | "list_of_objects";
671
+ schema?: unknown;
672
+ };
673
+ id: string;
674
+ budget: {
675
+ max_resolver_calls_per_run: number;
676
+ max_tokens_per_run: number;
677
+ };
678
+ dsl_version: 1;
679
+ schedule: {
680
+ kind: "interval";
681
+ every_sec: number;
682
+ } | {
683
+ kind: "cron";
684
+ expr: string;
685
+ };
686
+ steps: ({
687
+ kind: "search";
688
+ query: string;
689
+ resolver: string;
690
+ limit?: number | undefined;
691
+ as?: string | undefined;
692
+ } | {
693
+ fields: string[];
694
+ kind: "fetch";
695
+ resolver: string;
696
+ id_from: string;
697
+ as?: string | undefined;
698
+ } | {
699
+ kind: "extract";
700
+ from: string;
701
+ as: string;
702
+ selector: string;
703
+ } | {
704
+ source: string;
705
+ op: "count" | "unique" | "union" | "intersect";
706
+ kind: "aggregate";
707
+ as?: string | undefined;
708
+ } | {
709
+ current: string;
710
+ kind: "diff";
711
+ previous: string;
712
+ emit: "added" | "removed" | "changed";
713
+ as?: string | undefined;
714
+ } | {
715
+ source: string;
716
+ kind: "foreach";
717
+ do: ({
718
+ kind: "search";
719
+ query: string;
720
+ resolver: string;
721
+ limit?: number | undefined;
722
+ as?: string | undefined;
723
+ } | {
724
+ fields: string[];
725
+ kind: "fetch";
726
+ resolver: string;
727
+ id_from: string;
728
+ as?: string | undefined;
729
+ } | {
730
+ kind: "extract";
731
+ from: string;
732
+ as: string;
733
+ selector: string;
734
+ } | {
735
+ source: string;
736
+ op: "count" | "unique" | "union" | "intersect";
737
+ kind: "aggregate";
738
+ as?: string | undefined;
739
+ } | {
740
+ current: string;
741
+ kind: "diff";
742
+ previous: string;
743
+ emit: "added" | "removed" | "changed";
744
+ as?: string | undefined;
745
+ })[];
746
+ as?: string | undefined;
747
+ })[];
748
+ on_failure: "fail_open" | "fail_closed" | "last_known_good" | "skip";
749
+ description?: string | undefined;
750
+ }>;
751
+ export type PipelineSpec = z.infer<typeof PipelineSpecSchema>;
752
+ /**
753
+ * Canonicalize an arbitrary JSON value to a deterministic string.
754
+ *
755
+ * Rules:
756
+ * - Object keys sorted lexicographically.
757
+ * - Arrays preserved in order (order is semantically meaningful in DSL).
758
+ * - Numbers formatted with JSON.stringify default (no special handling).
759
+ * - `undefined` removed (matches JSON.stringify behavior).
760
+ *
761
+ * Throws on non-plain-object container types (Date, Map, Set, RegExp,
762
+ * class instances), BigInt, Symbol, and functions. These would either
763
+ * hash-collide silently (Date → `{}`) or crash JSON.stringify (BigInt).
764
+ * Pipeline specs validated by PipelineSpecSchema never contain such
765
+ * values; the guard exists for callers who bypass Zod.
766
+ *
767
+ * Used only for content-hash identity; not a general-purpose serializer.
768
+ */
769
+ export declare function canonicalizeJson(value: unknown): string;
770
+ /**
771
+ * Compute the content-addressable pipeline id.
772
+ *
773
+ * The id is the hex sha256 of the canonicalized spec with the `id`
774
+ * field stripped (the id cannot refer to itself). Two specs that
775
+ * differ only in description still hash the same because the
776
+ * description is intentionally included — a new description means
777
+ * new monitoring semantics. Callers that want to reuse an existing
778
+ * pipeline should pass the same description.
779
+ */
780
+ export declare function computePipelineId(spec: Omit<PipelineSpec, 'id'> | PipelineSpec): string;
781
+ /**
782
+ * Parse and validate an untrusted pipeline spec.
783
+ *
784
+ * Throws on any schema violation. Does NOT verify the `id` matches
785
+ * the content hash — call `verifyPipelineId(spec)` for that.
786
+ */
787
+ export declare function parsePipelineSpec(input: unknown): PipelineSpec;
788
+ /**
789
+ * Verify the `id` field equals the computed content hash.
790
+ *
791
+ * Use on load from any untrusted source (network, disk) to detect
792
+ * tampering or stale ids after edits.
793
+ */
794
+ export declare function verifyPipelineId(spec: PipelineSpec): boolean;
795
+ /**
796
+ * Stamp the correct content-hash id onto a draft spec.
797
+ *
798
+ * Convenience for authors and compilers who produce specs without
799
+ * pre-computing the id.
800
+ */
801
+ export declare function stampPipelineId(draft: Omit<PipelineSpec, 'id'>): PipelineSpec;
802
+ //# sourceMappingURL=pipeline-dsl.d.ts.map