@reaatech/media-pipeline-mcp-core 0.3.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,3173 @@
1
+ import * as stream_web from 'stream/web';
2
+ import { z } from 'zod';
3
+
4
+ /** @internal Executor-local store shape. The canonical type lives in @reaatech/media-pipeline-mcp-persistence. */
5
+ interface PipelineStateStore {
6
+ createRun(run: PipelineRunRecord): Promise<string>;
7
+ getRun(runId: string): Promise<PipelineRunRecord | undefined>;
8
+ updateRun(runId: string, patch: Partial<PipelineRunRecord>): Promise<void>;
9
+ acquireLock(runId: string, ttlMs?: number): Promise<boolean>;
10
+ releaseLock(runId: string): Promise<void>;
11
+ listRuns(filter?: {
12
+ pipelineId?: string;
13
+ status?: PipelineStatus;
14
+ }): Promise<PipelineRunRecord[]>;
15
+ }
16
+ /** @internal Executor-local record. The canonical PipelineRun lives in @reaatech/media-pipeline-mcp-persistence. */
17
+ interface PipelineRunRecord {
18
+ runId: string;
19
+ pipelineId: string;
20
+ status: PipelineStatus;
21
+ definition: PipelineDefinition;
22
+ stepStates: StepStateRecord[];
23
+ artifacts: Record<string, string>;
24
+ totalCostUsd: number;
25
+ startedAt: string;
26
+ completedAt?: string;
27
+ error?: string;
28
+ resumable?: boolean;
29
+ }
30
+ /** @internal Executor-local record. The canonical StepState lives in @reaatech/media-pipeline-mcp-persistence. */
31
+ interface StepStateRecord {
32
+ stepId: string;
33
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'gated' | 'skipped' | 'cached';
34
+ artifactId?: string;
35
+ attempts: number;
36
+ startedAt?: string;
37
+ completedAt?: string;
38
+ error?: string;
39
+ }
40
+ /** @internal Executor-local ledger shape. The canonical CostLedger lives in @reaatech/media-pipeline-mcp-cost. */
41
+ interface CostLedger {
42
+ charge(params: {
43
+ runId: string;
44
+ stepId: string;
45
+ operation: string;
46
+ provider: string;
47
+ costUsd: number;
48
+ }): Promise<void>;
49
+ getRunCost(runId: string): Promise<number>;
50
+ getTotalCost(): Promise<number>;
51
+ }
52
+ declare const ArtifactTypeSchema: z.ZodEnum<["image", "video", "audio", "text", "document"]>;
53
+ type ArtifactType = z.infer<typeof ArtifactTypeSchema>;
54
+ declare const ArtifactSchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ type: z.ZodEnum<["image", "video", "audio", "text", "document"]>;
57
+ uri: z.ZodString;
58
+ mimeType: z.ZodString;
59
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
60
+ sourceStep: z.ZodOptional<z.ZodString>;
61
+ createdAt: z.ZodOptional<z.ZodString>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ id: string;
64
+ type: "image" | "video" | "audio" | "text" | "document";
65
+ uri: string;
66
+ mimeType: string;
67
+ metadata: Record<string, unknown>;
68
+ sourceStep?: string | undefined;
69
+ createdAt?: string | undefined;
70
+ }, {
71
+ id: string;
72
+ type: "image" | "video" | "audio" | "text" | "document";
73
+ uri: string;
74
+ mimeType: string;
75
+ metadata?: Record<string, unknown> | undefined;
76
+ sourceStep?: string | undefined;
77
+ createdAt?: string | undefined;
78
+ }>;
79
+ type Artifact = z.infer<typeof ArtifactSchema>;
80
+ declare const QualityGateActionSchema: z.ZodEnum<["fail", "retry", "warn"]>;
81
+ type QualityGateAction = z.infer<typeof QualityGateActionSchema>;
82
+ declare const QualityGateSchema: z.ZodObject<{
83
+ type: z.ZodEnum<["llm-judge", "threshold", "dimension-check", "custom"]>;
84
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
85
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
86
+ maxRetries: z.ZodOptional<z.ZodNumber>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
89
+ config: Record<string, unknown>;
90
+ action: "fail" | "retry" | "warn";
91
+ maxRetries?: number | undefined;
92
+ }, {
93
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
94
+ config: Record<string, unknown>;
95
+ action: "fail" | "retry" | "warn";
96
+ maxRetries?: number | undefined;
97
+ }>;
98
+ type QualityGate = z.infer<typeof QualityGateSchema>;
99
+ declare const BudgetConfigSchema: z.ZodObject<{
100
+ maxUsd: z.ZodNumber;
101
+ onExceed: z.ZodEnum<["abort", "suspend"]>;
102
+ warnAtPct: z.ZodOptional<z.ZodNumber>;
103
+ }, "strip", z.ZodTypeAny, {
104
+ maxUsd: number;
105
+ onExceed: "abort" | "suspend";
106
+ warnAtPct?: number | undefined;
107
+ }, {
108
+ maxUsd: number;
109
+ onExceed: "abort" | "suspend";
110
+ warnAtPct?: number | undefined;
111
+ }>;
112
+ type BudgetConfig = z.infer<typeof BudgetConfigSchema>;
113
+ declare const CacheConfigSchema: z.ZodObject<{
114
+ mode: z.ZodOptional<z.ZodEnum<["use", "refresh", "skip"]>>;
115
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
116
+ scope: z.ZodOptional<z.ZodEnum<["global", "tenant"]>>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ mode?: "use" | "refresh" | "skip" | undefined;
119
+ ttlSeconds?: number | undefined;
120
+ scope?: "global" | "tenant" | undefined;
121
+ }, {
122
+ mode?: "use" | "refresh" | "skip" | undefined;
123
+ ttlSeconds?: number | undefined;
124
+ scope?: "global" | "tenant" | undefined;
125
+ }>;
126
+ type CacheConfig = z.infer<typeof CacheConfigSchema>;
127
+ declare const RouteCandidateSchema: z.ZodObject<{
128
+ provider: z.ZodString;
129
+ model: z.ZodString;
130
+ maxQueueMs: z.ZodOptional<z.ZodNumber>;
131
+ maxUsd: z.ZodOptional<z.ZodNumber>;
132
+ inputOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
133
+ weight: z.ZodOptional<z.ZodNumber>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ model: string;
136
+ provider: string;
137
+ weight?: number | undefined;
138
+ maxQueueMs?: number | undefined;
139
+ maxUsd?: number | undefined;
140
+ inputOverrides?: Record<string, unknown> | undefined;
141
+ }, {
142
+ model: string;
143
+ provider: string;
144
+ weight?: number | undefined;
145
+ maxQueueMs?: number | undefined;
146
+ maxUsd?: number | undefined;
147
+ inputOverrides?: Record<string, unknown> | undefined;
148
+ }>;
149
+ declare const RouteConfigSchema: z.ZodObject<{
150
+ strategy: z.ZodEnum<["first-success", "cheapest-acceptable", "fastest"]>;
151
+ candidates: z.ZodArray<z.ZodObject<{
152
+ provider: z.ZodString;
153
+ model: z.ZodString;
154
+ maxQueueMs: z.ZodOptional<z.ZodNumber>;
155
+ maxUsd: z.ZodOptional<z.ZodNumber>;
156
+ inputOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
157
+ weight: z.ZodOptional<z.ZodNumber>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ model: string;
160
+ provider: string;
161
+ weight?: number | undefined;
162
+ maxQueueMs?: number | undefined;
163
+ maxUsd?: number | undefined;
164
+ inputOverrides?: Record<string, unknown> | undefined;
165
+ }, {
166
+ model: string;
167
+ provider: string;
168
+ weight?: number | undefined;
169
+ maxQueueMs?: number | undefined;
170
+ maxUsd?: number | undefined;
171
+ inputOverrides?: Record<string, unknown> | undefined;
172
+ }>, "many">;
173
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
174
+ healthTtlMs: z.ZodOptional<z.ZodNumber>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
177
+ candidates: {
178
+ model: string;
179
+ provider: string;
180
+ weight?: number | undefined;
181
+ maxQueueMs?: number | undefined;
182
+ maxUsd?: number | undefined;
183
+ inputOverrides?: Record<string, unknown> | undefined;
184
+ }[];
185
+ timeoutMs?: number | undefined;
186
+ healthTtlMs?: number | undefined;
187
+ }, {
188
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
189
+ candidates: {
190
+ model: string;
191
+ provider: string;
192
+ weight?: number | undefined;
193
+ maxQueueMs?: number | undefined;
194
+ maxUsd?: number | undefined;
195
+ inputOverrides?: Record<string, unknown> | undefined;
196
+ }[];
197
+ timeoutMs?: number | undefined;
198
+ healthTtlMs?: number | undefined;
199
+ }>;
200
+ type RouteConfig = z.infer<typeof RouteConfigSchema>;
201
+ declare const JudgeRubricSchema: z.ZodObject<{
202
+ dimensions: z.ZodArray<z.ZodObject<{
203
+ name: z.ZodString;
204
+ weight: z.ZodNumber;
205
+ description: z.ZodString;
206
+ }, "strip", z.ZodTypeAny, {
207
+ name: string;
208
+ weight: number;
209
+ description: string;
210
+ }, {
211
+ name: string;
212
+ weight: number;
213
+ description: string;
214
+ }>, "many">;
215
+ }, "strip", z.ZodTypeAny, {
216
+ dimensions: {
217
+ name: string;
218
+ weight: number;
219
+ description: string;
220
+ }[];
221
+ }, {
222
+ dimensions: {
223
+ name: string;
224
+ weight: number;
225
+ description: string;
226
+ }[];
227
+ }>;
228
+ type JudgeRubric = z.infer<typeof JudgeRubricSchema>;
229
+ declare const JudgeConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
230
+ type: z.ZodLiteral<"llm-judge">;
231
+ criteria: z.ZodString;
232
+ model: z.ZodOptional<z.ZodString>;
233
+ provider: z.ZodOptional<z.ZodString>;
234
+ rubric: z.ZodOptional<z.ZodObject<{
235
+ dimensions: z.ZodArray<z.ZodObject<{
236
+ name: z.ZodString;
237
+ weight: z.ZodNumber;
238
+ description: z.ZodString;
239
+ }, "strip", z.ZodTypeAny, {
240
+ name: string;
241
+ weight: number;
242
+ description: string;
243
+ }, {
244
+ name: string;
245
+ weight: number;
246
+ description: string;
247
+ }>, "many">;
248
+ }, "strip", z.ZodTypeAny, {
249
+ dimensions: {
250
+ name: string;
251
+ weight: number;
252
+ description: string;
253
+ }[];
254
+ }, {
255
+ dimensions: {
256
+ name: string;
257
+ weight: number;
258
+ description: string;
259
+ }[];
260
+ }>>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ type: "llm-judge";
263
+ criteria: string;
264
+ model?: string | undefined;
265
+ provider?: string | undefined;
266
+ rubric?: {
267
+ dimensions: {
268
+ name: string;
269
+ weight: number;
270
+ description: string;
271
+ }[];
272
+ } | undefined;
273
+ }, {
274
+ type: "llm-judge";
275
+ criteria: string;
276
+ model?: string | undefined;
277
+ provider?: string | undefined;
278
+ rubric?: {
279
+ dimensions: {
280
+ name: string;
281
+ weight: number;
282
+ description: string;
283
+ }[];
284
+ } | undefined;
285
+ }>, z.ZodObject<{
286
+ type: z.ZodLiteral<"image-judge">;
287
+ criteria: z.ZodEnum<["clip-score", "aesthetic"]>;
288
+ reference: z.ZodOptional<z.ZodString>;
289
+ }, "strip", z.ZodTypeAny, {
290
+ type: "image-judge";
291
+ criteria: "clip-score" | "aesthetic";
292
+ reference?: string | undefined;
293
+ }, {
294
+ type: "image-judge";
295
+ criteria: "clip-score" | "aesthetic";
296
+ reference?: string | undefined;
297
+ }>, z.ZodObject<{
298
+ type: z.ZodLiteral<"rule">;
299
+ expression: z.ZodString;
300
+ }, "strip", z.ZodTypeAny, {
301
+ type: "rule";
302
+ expression: string;
303
+ }, {
304
+ type: "rule";
305
+ expression: string;
306
+ }>, z.ZodObject<{
307
+ type: z.ZodLiteral<"custom">;
308
+ toolName: z.ZodString;
309
+ }, "strip", z.ZodTypeAny, {
310
+ type: "custom";
311
+ toolName: string;
312
+ }, {
313
+ type: "custom";
314
+ toolName: string;
315
+ }>]>;
316
+ type JudgeConfig = z.infer<typeof JudgeConfigSchema>;
317
+ declare const VariantsConfigSchema: z.ZodObject<{
318
+ n: z.ZodNumber;
319
+ seedStrategy: z.ZodOptional<z.ZodEnum<["random", "sequential", "fixed-list"]>>;
320
+ seeds: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
321
+ judge: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
322
+ type: z.ZodLiteral<"llm-judge">;
323
+ criteria: z.ZodString;
324
+ model: z.ZodOptional<z.ZodString>;
325
+ provider: z.ZodOptional<z.ZodString>;
326
+ rubric: z.ZodOptional<z.ZodObject<{
327
+ dimensions: z.ZodArray<z.ZodObject<{
328
+ name: z.ZodString;
329
+ weight: z.ZodNumber;
330
+ description: z.ZodString;
331
+ }, "strip", z.ZodTypeAny, {
332
+ name: string;
333
+ weight: number;
334
+ description: string;
335
+ }, {
336
+ name: string;
337
+ weight: number;
338
+ description: string;
339
+ }>, "many">;
340
+ }, "strip", z.ZodTypeAny, {
341
+ dimensions: {
342
+ name: string;
343
+ weight: number;
344
+ description: string;
345
+ }[];
346
+ }, {
347
+ dimensions: {
348
+ name: string;
349
+ weight: number;
350
+ description: string;
351
+ }[];
352
+ }>>;
353
+ }, "strip", z.ZodTypeAny, {
354
+ type: "llm-judge";
355
+ criteria: string;
356
+ model?: string | undefined;
357
+ provider?: string | undefined;
358
+ rubric?: {
359
+ dimensions: {
360
+ name: string;
361
+ weight: number;
362
+ description: string;
363
+ }[];
364
+ } | undefined;
365
+ }, {
366
+ type: "llm-judge";
367
+ criteria: string;
368
+ model?: string | undefined;
369
+ provider?: string | undefined;
370
+ rubric?: {
371
+ dimensions: {
372
+ name: string;
373
+ weight: number;
374
+ description: string;
375
+ }[];
376
+ } | undefined;
377
+ }>, z.ZodObject<{
378
+ type: z.ZodLiteral<"image-judge">;
379
+ criteria: z.ZodEnum<["clip-score", "aesthetic"]>;
380
+ reference: z.ZodOptional<z.ZodString>;
381
+ }, "strip", z.ZodTypeAny, {
382
+ type: "image-judge";
383
+ criteria: "clip-score" | "aesthetic";
384
+ reference?: string | undefined;
385
+ }, {
386
+ type: "image-judge";
387
+ criteria: "clip-score" | "aesthetic";
388
+ reference?: string | undefined;
389
+ }>, z.ZodObject<{
390
+ type: z.ZodLiteral<"rule">;
391
+ expression: z.ZodString;
392
+ }, "strip", z.ZodTypeAny, {
393
+ type: "rule";
394
+ expression: string;
395
+ }, {
396
+ type: "rule";
397
+ expression: string;
398
+ }>, z.ZodObject<{
399
+ type: z.ZodLiteral<"custom">;
400
+ toolName: z.ZodString;
401
+ }, "strip", z.ZodTypeAny, {
402
+ type: "custom";
403
+ toolName: string;
404
+ }, {
405
+ type: "custom";
406
+ toolName: string;
407
+ }>]>;
408
+ loserAction: z.ZodOptional<z.ZodEnum<["archive", "discard"]>>;
409
+ perVariantCandidate: z.ZodOptional<z.ZodBoolean>;
410
+ minScore: z.ZodOptional<z.ZodNumber>;
411
+ }, "strip", z.ZodTypeAny, {
412
+ n: number;
413
+ judge: {
414
+ type: "llm-judge";
415
+ criteria: string;
416
+ model?: string | undefined;
417
+ provider?: string | undefined;
418
+ rubric?: {
419
+ dimensions: {
420
+ name: string;
421
+ weight: number;
422
+ description: string;
423
+ }[];
424
+ } | undefined;
425
+ } | {
426
+ type: "image-judge";
427
+ criteria: "clip-score" | "aesthetic";
428
+ reference?: string | undefined;
429
+ } | {
430
+ type: "rule";
431
+ expression: string;
432
+ } | {
433
+ type: "custom";
434
+ toolName: string;
435
+ };
436
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
437
+ seeds?: number[] | undefined;
438
+ loserAction?: "archive" | "discard" | undefined;
439
+ perVariantCandidate?: boolean | undefined;
440
+ minScore?: number | undefined;
441
+ }, {
442
+ n: number;
443
+ judge: {
444
+ type: "llm-judge";
445
+ criteria: string;
446
+ model?: string | undefined;
447
+ provider?: string | undefined;
448
+ rubric?: {
449
+ dimensions: {
450
+ name: string;
451
+ weight: number;
452
+ description: string;
453
+ }[];
454
+ } | undefined;
455
+ } | {
456
+ type: "image-judge";
457
+ criteria: "clip-score" | "aesthetic";
458
+ reference?: string | undefined;
459
+ } | {
460
+ type: "rule";
461
+ expression: string;
462
+ } | {
463
+ type: "custom";
464
+ toolName: string;
465
+ };
466
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
467
+ seeds?: number[] | undefined;
468
+ loserAction?: "archive" | "discard" | undefined;
469
+ perVariantCandidate?: boolean | undefined;
470
+ minScore?: number | undefined;
471
+ }>;
472
+ type VariantsConfig = z.infer<typeof VariantsConfigSchema>;
473
+ declare const VoiceRefSchema: z.ZodObject<{
474
+ provider: z.ZodEnum<["elevenlabs", "openai", "google", "deepgram-tts"]>;
475
+ voiceId: z.ZodString;
476
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
477
+ }, "strip", z.ZodTypeAny, {
478
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
479
+ voiceId: string;
480
+ settings?: Record<string, unknown> | undefined;
481
+ }, {
482
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
483
+ voiceId: string;
484
+ settings?: Record<string, unknown> | undefined;
485
+ }>;
486
+ type VoiceRef = z.infer<typeof VoiceRefSchema>;
487
+ declare const StyleRefSchema: z.ZodObject<{
488
+ description: z.ZodString;
489
+ negative: z.ZodOptional<z.ZodString>;
490
+ perProvider: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
491
+ description: z.ZodOptional<z.ZodString>;
492
+ negative: z.ZodOptional<z.ZodString>;
493
+ }, "strip", z.ZodTypeAny, {
494
+ description?: string | undefined;
495
+ negative?: string | undefined;
496
+ }, {
497
+ description?: string | undefined;
498
+ negative?: string | undefined;
499
+ }>>>;
500
+ }, "strip", z.ZodTypeAny, {
501
+ description: string;
502
+ negative?: string | undefined;
503
+ perProvider?: Record<string, {
504
+ description?: string | undefined;
505
+ negative?: string | undefined;
506
+ }> | undefined;
507
+ }, {
508
+ description: string;
509
+ negative?: string | undefined;
510
+ perProvider?: Record<string, {
511
+ description?: string | undefined;
512
+ negative?: string | undefined;
513
+ }> | undefined;
514
+ }>;
515
+ type StyleRef = z.infer<typeof StyleRefSchema>;
516
+ declare const BrandKitSchema: z.ZodObject<{
517
+ primaryColor: z.ZodOptional<z.ZodString>;
518
+ secondaryColor: z.ZodOptional<z.ZodString>;
519
+ fontFamily: z.ZodOptional<z.ZodString>;
520
+ logoArtifactId: z.ZodOptional<z.ZodString>;
521
+ extras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
522
+ }, "strip", z.ZodTypeAny, {
523
+ primaryColor?: string | undefined;
524
+ secondaryColor?: string | undefined;
525
+ fontFamily?: string | undefined;
526
+ logoArtifactId?: string | undefined;
527
+ extras?: Record<string, unknown> | undefined;
528
+ }, {
529
+ primaryColor?: string | undefined;
530
+ secondaryColor?: string | undefined;
531
+ fontFamily?: string | undefined;
532
+ logoArtifactId?: string | undefined;
533
+ extras?: Record<string, unknown> | undefined;
534
+ }>;
535
+ type BrandKit = z.infer<typeof BrandKitSchema>;
536
+ declare const ContextRefSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
537
+ kind: z.ZodLiteral<"voice">;
538
+ name: z.ZodString;
539
+ }, "strip", z.ZodTypeAny, {
540
+ name: string;
541
+ kind: "voice";
542
+ }, {
543
+ name: string;
544
+ kind: "voice";
545
+ }>, z.ZodObject<{
546
+ kind: z.ZodLiteral<"style">;
547
+ name: z.ZodString;
548
+ }, "strip", z.ZodTypeAny, {
549
+ name: string;
550
+ kind: "style";
551
+ }, {
552
+ name: string;
553
+ kind: "style";
554
+ }>, z.ZodObject<{
555
+ kind: z.ZodLiteral<"brand">;
556
+ key: z.ZodString;
557
+ }, "strip", z.ZodTypeAny, {
558
+ kind: "brand";
559
+ key: string;
560
+ }, {
561
+ kind: "brand";
562
+ key: string;
563
+ }>]>;
564
+ declare const RunContextSchema: z.ZodObject<{
565
+ voices: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
566
+ provider: z.ZodEnum<["elevenlabs", "openai", "google", "deepgram-tts"]>;
567
+ voiceId: z.ZodString;
568
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
569
+ }, "strip", z.ZodTypeAny, {
570
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
571
+ voiceId: string;
572
+ settings?: Record<string, unknown> | undefined;
573
+ }, {
574
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
575
+ voiceId: string;
576
+ settings?: Record<string, unknown> | undefined;
577
+ }>>>;
578
+ styles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
579
+ description: z.ZodString;
580
+ negative: z.ZodOptional<z.ZodString>;
581
+ perProvider: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
582
+ description: z.ZodOptional<z.ZodString>;
583
+ negative: z.ZodOptional<z.ZodString>;
584
+ }, "strip", z.ZodTypeAny, {
585
+ description?: string | undefined;
586
+ negative?: string | undefined;
587
+ }, {
588
+ description?: string | undefined;
589
+ negative?: string | undefined;
590
+ }>>>;
591
+ }, "strip", z.ZodTypeAny, {
592
+ description: string;
593
+ negative?: string | undefined;
594
+ perProvider?: Record<string, {
595
+ description?: string | undefined;
596
+ negative?: string | undefined;
597
+ }> | undefined;
598
+ }, {
599
+ description: string;
600
+ negative?: string | undefined;
601
+ perProvider?: Record<string, {
602
+ description?: string | undefined;
603
+ negative?: string | undefined;
604
+ }> | undefined;
605
+ }>>>;
606
+ brandKit: z.ZodOptional<z.ZodObject<{
607
+ primaryColor: z.ZodOptional<z.ZodString>;
608
+ secondaryColor: z.ZodOptional<z.ZodString>;
609
+ fontFamily: z.ZodOptional<z.ZodString>;
610
+ logoArtifactId: z.ZodOptional<z.ZodString>;
611
+ extras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
612
+ }, "strip", z.ZodTypeAny, {
613
+ primaryColor?: string | undefined;
614
+ secondaryColor?: string | undefined;
615
+ fontFamily?: string | undefined;
616
+ logoArtifactId?: string | undefined;
617
+ extras?: Record<string, unknown> | undefined;
618
+ }, {
619
+ primaryColor?: string | undefined;
620
+ secondaryColor?: string | undefined;
621
+ fontFamily?: string | undefined;
622
+ logoArtifactId?: string | undefined;
623
+ extras?: Record<string, unknown> | undefined;
624
+ }>>;
625
+ vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
626
+ }, "strip", z.ZodTypeAny, {
627
+ voices?: Record<string, {
628
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
629
+ voiceId: string;
630
+ settings?: Record<string, unknown> | undefined;
631
+ }> | undefined;
632
+ styles?: Record<string, {
633
+ description: string;
634
+ negative?: string | undefined;
635
+ perProvider?: Record<string, {
636
+ description?: string | undefined;
637
+ negative?: string | undefined;
638
+ }> | undefined;
639
+ }> | undefined;
640
+ brandKit?: {
641
+ primaryColor?: string | undefined;
642
+ secondaryColor?: string | undefined;
643
+ fontFamily?: string | undefined;
644
+ logoArtifactId?: string | undefined;
645
+ extras?: Record<string, unknown> | undefined;
646
+ } | undefined;
647
+ vars?: Record<string, unknown> | undefined;
648
+ }, {
649
+ voices?: Record<string, {
650
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
651
+ voiceId: string;
652
+ settings?: Record<string, unknown> | undefined;
653
+ }> | undefined;
654
+ styles?: Record<string, {
655
+ description: string;
656
+ negative?: string | undefined;
657
+ perProvider?: Record<string, {
658
+ description?: string | undefined;
659
+ negative?: string | undefined;
660
+ }> | undefined;
661
+ }> | undefined;
662
+ brandKit?: {
663
+ primaryColor?: string | undefined;
664
+ secondaryColor?: string | undefined;
665
+ fontFamily?: string | undefined;
666
+ logoArtifactId?: string | undefined;
667
+ extras?: Record<string, unknown> | undefined;
668
+ } | undefined;
669
+ vars?: Record<string, unknown> | undefined;
670
+ }>;
671
+ type RunContext = z.infer<typeof RunContextSchema>;
672
+ declare const PipelineStepSchema: z.ZodObject<{
673
+ id: z.ZodString;
674
+ operation: z.ZodString;
675
+ inputs: z.ZodRecord<z.ZodString, z.ZodString>;
676
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
677
+ qualityGate: z.ZodOptional<z.ZodObject<{
678
+ type: z.ZodEnum<["llm-judge", "threshold", "dimension-check", "custom"]>;
679
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
680
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
681
+ maxRetries: z.ZodOptional<z.ZodNumber>;
682
+ }, "strip", z.ZodTypeAny, {
683
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
684
+ config: Record<string, unknown>;
685
+ action: "fail" | "retry" | "warn";
686
+ maxRetries?: number | undefined;
687
+ }, {
688
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
689
+ config: Record<string, unknown>;
690
+ action: "fail" | "retry" | "warn";
691
+ maxRetries?: number | undefined;
692
+ }>>;
693
+ variants: z.ZodOptional<z.ZodObject<{
694
+ n: z.ZodNumber;
695
+ seedStrategy: z.ZodOptional<z.ZodEnum<["random", "sequential", "fixed-list"]>>;
696
+ seeds: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
697
+ judge: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
698
+ type: z.ZodLiteral<"llm-judge">;
699
+ criteria: z.ZodString;
700
+ model: z.ZodOptional<z.ZodString>;
701
+ provider: z.ZodOptional<z.ZodString>;
702
+ rubric: z.ZodOptional<z.ZodObject<{
703
+ dimensions: z.ZodArray<z.ZodObject<{
704
+ name: z.ZodString;
705
+ weight: z.ZodNumber;
706
+ description: z.ZodString;
707
+ }, "strip", z.ZodTypeAny, {
708
+ name: string;
709
+ weight: number;
710
+ description: string;
711
+ }, {
712
+ name: string;
713
+ weight: number;
714
+ description: string;
715
+ }>, "many">;
716
+ }, "strip", z.ZodTypeAny, {
717
+ dimensions: {
718
+ name: string;
719
+ weight: number;
720
+ description: string;
721
+ }[];
722
+ }, {
723
+ dimensions: {
724
+ name: string;
725
+ weight: number;
726
+ description: string;
727
+ }[];
728
+ }>>;
729
+ }, "strip", z.ZodTypeAny, {
730
+ type: "llm-judge";
731
+ criteria: string;
732
+ model?: string | undefined;
733
+ provider?: string | undefined;
734
+ rubric?: {
735
+ dimensions: {
736
+ name: string;
737
+ weight: number;
738
+ description: string;
739
+ }[];
740
+ } | undefined;
741
+ }, {
742
+ type: "llm-judge";
743
+ criteria: string;
744
+ model?: string | undefined;
745
+ provider?: string | undefined;
746
+ rubric?: {
747
+ dimensions: {
748
+ name: string;
749
+ weight: number;
750
+ description: string;
751
+ }[];
752
+ } | undefined;
753
+ }>, z.ZodObject<{
754
+ type: z.ZodLiteral<"image-judge">;
755
+ criteria: z.ZodEnum<["clip-score", "aesthetic"]>;
756
+ reference: z.ZodOptional<z.ZodString>;
757
+ }, "strip", z.ZodTypeAny, {
758
+ type: "image-judge";
759
+ criteria: "clip-score" | "aesthetic";
760
+ reference?: string | undefined;
761
+ }, {
762
+ type: "image-judge";
763
+ criteria: "clip-score" | "aesthetic";
764
+ reference?: string | undefined;
765
+ }>, z.ZodObject<{
766
+ type: z.ZodLiteral<"rule">;
767
+ expression: z.ZodString;
768
+ }, "strip", z.ZodTypeAny, {
769
+ type: "rule";
770
+ expression: string;
771
+ }, {
772
+ type: "rule";
773
+ expression: string;
774
+ }>, z.ZodObject<{
775
+ type: z.ZodLiteral<"custom">;
776
+ toolName: z.ZodString;
777
+ }, "strip", z.ZodTypeAny, {
778
+ type: "custom";
779
+ toolName: string;
780
+ }, {
781
+ type: "custom";
782
+ toolName: string;
783
+ }>]>;
784
+ loserAction: z.ZodOptional<z.ZodEnum<["archive", "discard"]>>;
785
+ perVariantCandidate: z.ZodOptional<z.ZodBoolean>;
786
+ minScore: z.ZodOptional<z.ZodNumber>;
787
+ }, "strip", z.ZodTypeAny, {
788
+ n: number;
789
+ judge: {
790
+ type: "llm-judge";
791
+ criteria: string;
792
+ model?: string | undefined;
793
+ provider?: string | undefined;
794
+ rubric?: {
795
+ dimensions: {
796
+ name: string;
797
+ weight: number;
798
+ description: string;
799
+ }[];
800
+ } | undefined;
801
+ } | {
802
+ type: "image-judge";
803
+ criteria: "clip-score" | "aesthetic";
804
+ reference?: string | undefined;
805
+ } | {
806
+ type: "rule";
807
+ expression: string;
808
+ } | {
809
+ type: "custom";
810
+ toolName: string;
811
+ };
812
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
813
+ seeds?: number[] | undefined;
814
+ loserAction?: "archive" | "discard" | undefined;
815
+ perVariantCandidate?: boolean | undefined;
816
+ minScore?: number | undefined;
817
+ }, {
818
+ n: number;
819
+ judge: {
820
+ type: "llm-judge";
821
+ criteria: string;
822
+ model?: string | undefined;
823
+ provider?: string | undefined;
824
+ rubric?: {
825
+ dimensions: {
826
+ name: string;
827
+ weight: number;
828
+ description: string;
829
+ }[];
830
+ } | undefined;
831
+ } | {
832
+ type: "image-judge";
833
+ criteria: "clip-score" | "aesthetic";
834
+ reference?: string | undefined;
835
+ } | {
836
+ type: "rule";
837
+ expression: string;
838
+ } | {
839
+ type: "custom";
840
+ toolName: string;
841
+ };
842
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
843
+ seeds?: number[] | undefined;
844
+ loserAction?: "archive" | "discard" | undefined;
845
+ perVariantCandidate?: boolean | undefined;
846
+ minScore?: number | undefined;
847
+ }>>;
848
+ gates: z.ZodOptional<z.ZodArray<z.ZodObject<{
849
+ type: z.ZodEnum<["llm-judge", "threshold", "dimension-check", "custom"]>;
850
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
851
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
852
+ maxRetries: z.ZodOptional<z.ZodNumber>;
853
+ }, "strip", z.ZodTypeAny, {
854
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
855
+ config: Record<string, unknown>;
856
+ action: "fail" | "retry" | "warn";
857
+ maxRetries?: number | undefined;
858
+ }, {
859
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
860
+ config: Record<string, unknown>;
861
+ action: "fail" | "retry" | "warn";
862
+ maxRetries?: number | undefined;
863
+ }>, "many">>;
864
+ cache: z.ZodOptional<z.ZodObject<{
865
+ mode: z.ZodOptional<z.ZodEnum<["use", "refresh", "skip"]>>;
866
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
867
+ scope: z.ZodOptional<z.ZodEnum<["global", "tenant"]>>;
868
+ }, "strip", z.ZodTypeAny, {
869
+ mode?: "use" | "refresh" | "skip" | undefined;
870
+ ttlSeconds?: number | undefined;
871
+ scope?: "global" | "tenant" | undefined;
872
+ }, {
873
+ mode?: "use" | "refresh" | "skip" | undefined;
874
+ ttlSeconds?: number | undefined;
875
+ scope?: "global" | "tenant" | undefined;
876
+ }>>;
877
+ route: z.ZodOptional<z.ZodObject<{
878
+ strategy: z.ZodEnum<["first-success", "cheapest-acceptable", "fastest"]>;
879
+ candidates: z.ZodArray<z.ZodObject<{
880
+ provider: z.ZodString;
881
+ model: z.ZodString;
882
+ maxQueueMs: z.ZodOptional<z.ZodNumber>;
883
+ maxUsd: z.ZodOptional<z.ZodNumber>;
884
+ inputOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
885
+ weight: z.ZodOptional<z.ZodNumber>;
886
+ }, "strip", z.ZodTypeAny, {
887
+ model: string;
888
+ provider: string;
889
+ weight?: number | undefined;
890
+ maxQueueMs?: number | undefined;
891
+ maxUsd?: number | undefined;
892
+ inputOverrides?: Record<string, unknown> | undefined;
893
+ }, {
894
+ model: string;
895
+ provider: string;
896
+ weight?: number | undefined;
897
+ maxQueueMs?: number | undefined;
898
+ maxUsd?: number | undefined;
899
+ inputOverrides?: Record<string, unknown> | undefined;
900
+ }>, "many">;
901
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
902
+ healthTtlMs: z.ZodOptional<z.ZodNumber>;
903
+ }, "strip", z.ZodTypeAny, {
904
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
905
+ candidates: {
906
+ model: string;
907
+ provider: string;
908
+ weight?: number | undefined;
909
+ maxQueueMs?: number | undefined;
910
+ maxUsd?: number | undefined;
911
+ inputOverrides?: Record<string, unknown> | undefined;
912
+ }[];
913
+ timeoutMs?: number | undefined;
914
+ healthTtlMs?: number | undefined;
915
+ }, {
916
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
917
+ candidates: {
918
+ model: string;
919
+ provider: string;
920
+ weight?: number | undefined;
921
+ maxQueueMs?: number | undefined;
922
+ maxUsd?: number | undefined;
923
+ inputOverrides?: Record<string, unknown> | undefined;
924
+ }[];
925
+ timeoutMs?: number | undefined;
926
+ healthTtlMs?: number | undefined;
927
+ }>>;
928
+ }, "strip", z.ZodTypeAny, {
929
+ id: string;
930
+ operation: string;
931
+ inputs: Record<string, string>;
932
+ config: Record<string, unknown>;
933
+ qualityGate?: {
934
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
935
+ config: Record<string, unknown>;
936
+ action: "fail" | "retry" | "warn";
937
+ maxRetries?: number | undefined;
938
+ } | undefined;
939
+ variants?: {
940
+ n: number;
941
+ judge: {
942
+ type: "llm-judge";
943
+ criteria: string;
944
+ model?: string | undefined;
945
+ provider?: string | undefined;
946
+ rubric?: {
947
+ dimensions: {
948
+ name: string;
949
+ weight: number;
950
+ description: string;
951
+ }[];
952
+ } | undefined;
953
+ } | {
954
+ type: "image-judge";
955
+ criteria: "clip-score" | "aesthetic";
956
+ reference?: string | undefined;
957
+ } | {
958
+ type: "rule";
959
+ expression: string;
960
+ } | {
961
+ type: "custom";
962
+ toolName: string;
963
+ };
964
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
965
+ seeds?: number[] | undefined;
966
+ loserAction?: "archive" | "discard" | undefined;
967
+ perVariantCandidate?: boolean | undefined;
968
+ minScore?: number | undefined;
969
+ } | undefined;
970
+ gates?: {
971
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
972
+ config: Record<string, unknown>;
973
+ action: "fail" | "retry" | "warn";
974
+ maxRetries?: number | undefined;
975
+ }[] | undefined;
976
+ cache?: {
977
+ mode?: "use" | "refresh" | "skip" | undefined;
978
+ ttlSeconds?: number | undefined;
979
+ scope?: "global" | "tenant" | undefined;
980
+ } | undefined;
981
+ route?: {
982
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
983
+ candidates: {
984
+ model: string;
985
+ provider: string;
986
+ weight?: number | undefined;
987
+ maxQueueMs?: number | undefined;
988
+ maxUsd?: number | undefined;
989
+ inputOverrides?: Record<string, unknown> | undefined;
990
+ }[];
991
+ timeoutMs?: number | undefined;
992
+ healthTtlMs?: number | undefined;
993
+ } | undefined;
994
+ }, {
995
+ id: string;
996
+ operation: string;
997
+ inputs: Record<string, string>;
998
+ config?: Record<string, unknown> | undefined;
999
+ qualityGate?: {
1000
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1001
+ config: Record<string, unknown>;
1002
+ action: "fail" | "retry" | "warn";
1003
+ maxRetries?: number | undefined;
1004
+ } | undefined;
1005
+ variants?: {
1006
+ n: number;
1007
+ judge: {
1008
+ type: "llm-judge";
1009
+ criteria: string;
1010
+ model?: string | undefined;
1011
+ provider?: string | undefined;
1012
+ rubric?: {
1013
+ dimensions: {
1014
+ name: string;
1015
+ weight: number;
1016
+ description: string;
1017
+ }[];
1018
+ } | undefined;
1019
+ } | {
1020
+ type: "image-judge";
1021
+ criteria: "clip-score" | "aesthetic";
1022
+ reference?: string | undefined;
1023
+ } | {
1024
+ type: "rule";
1025
+ expression: string;
1026
+ } | {
1027
+ type: "custom";
1028
+ toolName: string;
1029
+ };
1030
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1031
+ seeds?: number[] | undefined;
1032
+ loserAction?: "archive" | "discard" | undefined;
1033
+ perVariantCandidate?: boolean | undefined;
1034
+ minScore?: number | undefined;
1035
+ } | undefined;
1036
+ gates?: {
1037
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1038
+ config: Record<string, unknown>;
1039
+ action: "fail" | "retry" | "warn";
1040
+ maxRetries?: number | undefined;
1041
+ }[] | undefined;
1042
+ cache?: {
1043
+ mode?: "use" | "refresh" | "skip" | undefined;
1044
+ ttlSeconds?: number | undefined;
1045
+ scope?: "global" | "tenant" | undefined;
1046
+ } | undefined;
1047
+ route?: {
1048
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1049
+ candidates: {
1050
+ model: string;
1051
+ provider: string;
1052
+ weight?: number | undefined;
1053
+ maxQueueMs?: number | undefined;
1054
+ maxUsd?: number | undefined;
1055
+ inputOverrides?: Record<string, unknown> | undefined;
1056
+ }[];
1057
+ timeoutMs?: number | undefined;
1058
+ healthTtlMs?: number | undefined;
1059
+ } | undefined;
1060
+ }>;
1061
+ type PipelineStep = z.infer<typeof PipelineStepSchema>;
1062
+ declare const PipelineStatusSchema: z.ZodEnum<["pending", "running", "completed", "failed", "gated", "cancelled"]>;
1063
+ type PipelineStatus = z.infer<typeof PipelineStatusSchema>;
1064
+ declare const PipelineSchema: z.ZodObject<{
1065
+ id: z.ZodString;
1066
+ steps: z.ZodArray<z.ZodObject<{
1067
+ id: z.ZodString;
1068
+ operation: z.ZodString;
1069
+ inputs: z.ZodRecord<z.ZodString, z.ZodString>;
1070
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1071
+ qualityGate: z.ZodOptional<z.ZodObject<{
1072
+ type: z.ZodEnum<["llm-judge", "threshold", "dimension-check", "custom"]>;
1073
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1074
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
1075
+ maxRetries: z.ZodOptional<z.ZodNumber>;
1076
+ }, "strip", z.ZodTypeAny, {
1077
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1078
+ config: Record<string, unknown>;
1079
+ action: "fail" | "retry" | "warn";
1080
+ maxRetries?: number | undefined;
1081
+ }, {
1082
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1083
+ config: Record<string, unknown>;
1084
+ action: "fail" | "retry" | "warn";
1085
+ maxRetries?: number | undefined;
1086
+ }>>;
1087
+ variants: z.ZodOptional<z.ZodObject<{
1088
+ n: z.ZodNumber;
1089
+ seedStrategy: z.ZodOptional<z.ZodEnum<["random", "sequential", "fixed-list"]>>;
1090
+ seeds: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
1091
+ judge: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1092
+ type: z.ZodLiteral<"llm-judge">;
1093
+ criteria: z.ZodString;
1094
+ model: z.ZodOptional<z.ZodString>;
1095
+ provider: z.ZodOptional<z.ZodString>;
1096
+ rubric: z.ZodOptional<z.ZodObject<{
1097
+ dimensions: z.ZodArray<z.ZodObject<{
1098
+ name: z.ZodString;
1099
+ weight: z.ZodNumber;
1100
+ description: z.ZodString;
1101
+ }, "strip", z.ZodTypeAny, {
1102
+ name: string;
1103
+ weight: number;
1104
+ description: string;
1105
+ }, {
1106
+ name: string;
1107
+ weight: number;
1108
+ description: string;
1109
+ }>, "many">;
1110
+ }, "strip", z.ZodTypeAny, {
1111
+ dimensions: {
1112
+ name: string;
1113
+ weight: number;
1114
+ description: string;
1115
+ }[];
1116
+ }, {
1117
+ dimensions: {
1118
+ name: string;
1119
+ weight: number;
1120
+ description: string;
1121
+ }[];
1122
+ }>>;
1123
+ }, "strip", z.ZodTypeAny, {
1124
+ type: "llm-judge";
1125
+ criteria: string;
1126
+ model?: string | undefined;
1127
+ provider?: string | undefined;
1128
+ rubric?: {
1129
+ dimensions: {
1130
+ name: string;
1131
+ weight: number;
1132
+ description: string;
1133
+ }[];
1134
+ } | undefined;
1135
+ }, {
1136
+ type: "llm-judge";
1137
+ criteria: string;
1138
+ model?: string | undefined;
1139
+ provider?: string | undefined;
1140
+ rubric?: {
1141
+ dimensions: {
1142
+ name: string;
1143
+ weight: number;
1144
+ description: string;
1145
+ }[];
1146
+ } | undefined;
1147
+ }>, z.ZodObject<{
1148
+ type: z.ZodLiteral<"image-judge">;
1149
+ criteria: z.ZodEnum<["clip-score", "aesthetic"]>;
1150
+ reference: z.ZodOptional<z.ZodString>;
1151
+ }, "strip", z.ZodTypeAny, {
1152
+ type: "image-judge";
1153
+ criteria: "clip-score" | "aesthetic";
1154
+ reference?: string | undefined;
1155
+ }, {
1156
+ type: "image-judge";
1157
+ criteria: "clip-score" | "aesthetic";
1158
+ reference?: string | undefined;
1159
+ }>, z.ZodObject<{
1160
+ type: z.ZodLiteral<"rule">;
1161
+ expression: z.ZodString;
1162
+ }, "strip", z.ZodTypeAny, {
1163
+ type: "rule";
1164
+ expression: string;
1165
+ }, {
1166
+ type: "rule";
1167
+ expression: string;
1168
+ }>, z.ZodObject<{
1169
+ type: z.ZodLiteral<"custom">;
1170
+ toolName: z.ZodString;
1171
+ }, "strip", z.ZodTypeAny, {
1172
+ type: "custom";
1173
+ toolName: string;
1174
+ }, {
1175
+ type: "custom";
1176
+ toolName: string;
1177
+ }>]>;
1178
+ loserAction: z.ZodOptional<z.ZodEnum<["archive", "discard"]>>;
1179
+ perVariantCandidate: z.ZodOptional<z.ZodBoolean>;
1180
+ minScore: z.ZodOptional<z.ZodNumber>;
1181
+ }, "strip", z.ZodTypeAny, {
1182
+ n: number;
1183
+ judge: {
1184
+ type: "llm-judge";
1185
+ criteria: string;
1186
+ model?: string | undefined;
1187
+ provider?: string | undefined;
1188
+ rubric?: {
1189
+ dimensions: {
1190
+ name: string;
1191
+ weight: number;
1192
+ description: string;
1193
+ }[];
1194
+ } | undefined;
1195
+ } | {
1196
+ type: "image-judge";
1197
+ criteria: "clip-score" | "aesthetic";
1198
+ reference?: string | undefined;
1199
+ } | {
1200
+ type: "rule";
1201
+ expression: string;
1202
+ } | {
1203
+ type: "custom";
1204
+ toolName: string;
1205
+ };
1206
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1207
+ seeds?: number[] | undefined;
1208
+ loserAction?: "archive" | "discard" | undefined;
1209
+ perVariantCandidate?: boolean | undefined;
1210
+ minScore?: number | undefined;
1211
+ }, {
1212
+ n: number;
1213
+ judge: {
1214
+ type: "llm-judge";
1215
+ criteria: string;
1216
+ model?: string | undefined;
1217
+ provider?: string | undefined;
1218
+ rubric?: {
1219
+ dimensions: {
1220
+ name: string;
1221
+ weight: number;
1222
+ description: string;
1223
+ }[];
1224
+ } | undefined;
1225
+ } | {
1226
+ type: "image-judge";
1227
+ criteria: "clip-score" | "aesthetic";
1228
+ reference?: string | undefined;
1229
+ } | {
1230
+ type: "rule";
1231
+ expression: string;
1232
+ } | {
1233
+ type: "custom";
1234
+ toolName: string;
1235
+ };
1236
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1237
+ seeds?: number[] | undefined;
1238
+ loserAction?: "archive" | "discard" | undefined;
1239
+ perVariantCandidate?: boolean | undefined;
1240
+ minScore?: number | undefined;
1241
+ }>>;
1242
+ gates: z.ZodOptional<z.ZodArray<z.ZodObject<{
1243
+ type: z.ZodEnum<["llm-judge", "threshold", "dimension-check", "custom"]>;
1244
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1245
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
1246
+ maxRetries: z.ZodOptional<z.ZodNumber>;
1247
+ }, "strip", z.ZodTypeAny, {
1248
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1249
+ config: Record<string, unknown>;
1250
+ action: "fail" | "retry" | "warn";
1251
+ maxRetries?: number | undefined;
1252
+ }, {
1253
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1254
+ config: Record<string, unknown>;
1255
+ action: "fail" | "retry" | "warn";
1256
+ maxRetries?: number | undefined;
1257
+ }>, "many">>;
1258
+ cache: z.ZodOptional<z.ZodObject<{
1259
+ mode: z.ZodOptional<z.ZodEnum<["use", "refresh", "skip"]>>;
1260
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
1261
+ scope: z.ZodOptional<z.ZodEnum<["global", "tenant"]>>;
1262
+ }, "strip", z.ZodTypeAny, {
1263
+ mode?: "use" | "refresh" | "skip" | undefined;
1264
+ ttlSeconds?: number | undefined;
1265
+ scope?: "global" | "tenant" | undefined;
1266
+ }, {
1267
+ mode?: "use" | "refresh" | "skip" | undefined;
1268
+ ttlSeconds?: number | undefined;
1269
+ scope?: "global" | "tenant" | undefined;
1270
+ }>>;
1271
+ route: z.ZodOptional<z.ZodObject<{
1272
+ strategy: z.ZodEnum<["first-success", "cheapest-acceptable", "fastest"]>;
1273
+ candidates: z.ZodArray<z.ZodObject<{
1274
+ provider: z.ZodString;
1275
+ model: z.ZodString;
1276
+ maxQueueMs: z.ZodOptional<z.ZodNumber>;
1277
+ maxUsd: z.ZodOptional<z.ZodNumber>;
1278
+ inputOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1279
+ weight: z.ZodOptional<z.ZodNumber>;
1280
+ }, "strip", z.ZodTypeAny, {
1281
+ model: string;
1282
+ provider: string;
1283
+ weight?: number | undefined;
1284
+ maxQueueMs?: number | undefined;
1285
+ maxUsd?: number | undefined;
1286
+ inputOverrides?: Record<string, unknown> | undefined;
1287
+ }, {
1288
+ model: string;
1289
+ provider: string;
1290
+ weight?: number | undefined;
1291
+ maxQueueMs?: number | undefined;
1292
+ maxUsd?: number | undefined;
1293
+ inputOverrides?: Record<string, unknown> | undefined;
1294
+ }>, "many">;
1295
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
1296
+ healthTtlMs: z.ZodOptional<z.ZodNumber>;
1297
+ }, "strip", z.ZodTypeAny, {
1298
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1299
+ candidates: {
1300
+ model: string;
1301
+ provider: string;
1302
+ weight?: number | undefined;
1303
+ maxQueueMs?: number | undefined;
1304
+ maxUsd?: number | undefined;
1305
+ inputOverrides?: Record<string, unknown> | undefined;
1306
+ }[];
1307
+ timeoutMs?: number | undefined;
1308
+ healthTtlMs?: number | undefined;
1309
+ }, {
1310
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1311
+ candidates: {
1312
+ model: string;
1313
+ provider: string;
1314
+ weight?: number | undefined;
1315
+ maxQueueMs?: number | undefined;
1316
+ maxUsd?: number | undefined;
1317
+ inputOverrides?: Record<string, unknown> | undefined;
1318
+ }[];
1319
+ timeoutMs?: number | undefined;
1320
+ healthTtlMs?: number | undefined;
1321
+ }>>;
1322
+ }, "strip", z.ZodTypeAny, {
1323
+ id: string;
1324
+ operation: string;
1325
+ inputs: Record<string, string>;
1326
+ config: Record<string, unknown>;
1327
+ qualityGate?: {
1328
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1329
+ config: Record<string, unknown>;
1330
+ action: "fail" | "retry" | "warn";
1331
+ maxRetries?: number | undefined;
1332
+ } | undefined;
1333
+ variants?: {
1334
+ n: number;
1335
+ judge: {
1336
+ type: "llm-judge";
1337
+ criteria: string;
1338
+ model?: string | undefined;
1339
+ provider?: string | undefined;
1340
+ rubric?: {
1341
+ dimensions: {
1342
+ name: string;
1343
+ weight: number;
1344
+ description: string;
1345
+ }[];
1346
+ } | undefined;
1347
+ } | {
1348
+ type: "image-judge";
1349
+ criteria: "clip-score" | "aesthetic";
1350
+ reference?: string | undefined;
1351
+ } | {
1352
+ type: "rule";
1353
+ expression: string;
1354
+ } | {
1355
+ type: "custom";
1356
+ toolName: string;
1357
+ };
1358
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1359
+ seeds?: number[] | undefined;
1360
+ loserAction?: "archive" | "discard" | undefined;
1361
+ perVariantCandidate?: boolean | undefined;
1362
+ minScore?: number | undefined;
1363
+ } | undefined;
1364
+ gates?: {
1365
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1366
+ config: Record<string, unknown>;
1367
+ action: "fail" | "retry" | "warn";
1368
+ maxRetries?: number | undefined;
1369
+ }[] | undefined;
1370
+ cache?: {
1371
+ mode?: "use" | "refresh" | "skip" | undefined;
1372
+ ttlSeconds?: number | undefined;
1373
+ scope?: "global" | "tenant" | undefined;
1374
+ } | undefined;
1375
+ route?: {
1376
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1377
+ candidates: {
1378
+ model: string;
1379
+ provider: string;
1380
+ weight?: number | undefined;
1381
+ maxQueueMs?: number | undefined;
1382
+ maxUsd?: number | undefined;
1383
+ inputOverrides?: Record<string, unknown> | undefined;
1384
+ }[];
1385
+ timeoutMs?: number | undefined;
1386
+ healthTtlMs?: number | undefined;
1387
+ } | undefined;
1388
+ }, {
1389
+ id: string;
1390
+ operation: string;
1391
+ inputs: Record<string, string>;
1392
+ config?: Record<string, unknown> | undefined;
1393
+ qualityGate?: {
1394
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1395
+ config: Record<string, unknown>;
1396
+ action: "fail" | "retry" | "warn";
1397
+ maxRetries?: number | undefined;
1398
+ } | undefined;
1399
+ variants?: {
1400
+ n: number;
1401
+ judge: {
1402
+ type: "llm-judge";
1403
+ criteria: string;
1404
+ model?: string | undefined;
1405
+ provider?: string | undefined;
1406
+ rubric?: {
1407
+ dimensions: {
1408
+ name: string;
1409
+ weight: number;
1410
+ description: string;
1411
+ }[];
1412
+ } | undefined;
1413
+ } | {
1414
+ type: "image-judge";
1415
+ criteria: "clip-score" | "aesthetic";
1416
+ reference?: string | undefined;
1417
+ } | {
1418
+ type: "rule";
1419
+ expression: string;
1420
+ } | {
1421
+ type: "custom";
1422
+ toolName: string;
1423
+ };
1424
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1425
+ seeds?: number[] | undefined;
1426
+ loserAction?: "archive" | "discard" | undefined;
1427
+ perVariantCandidate?: boolean | undefined;
1428
+ minScore?: number | undefined;
1429
+ } | undefined;
1430
+ gates?: {
1431
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1432
+ config: Record<string, unknown>;
1433
+ action: "fail" | "retry" | "warn";
1434
+ maxRetries?: number | undefined;
1435
+ }[] | undefined;
1436
+ cache?: {
1437
+ mode?: "use" | "refresh" | "skip" | undefined;
1438
+ ttlSeconds?: number | undefined;
1439
+ scope?: "global" | "tenant" | undefined;
1440
+ } | undefined;
1441
+ route?: {
1442
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1443
+ candidates: {
1444
+ model: string;
1445
+ provider: string;
1446
+ weight?: number | undefined;
1447
+ maxQueueMs?: number | undefined;
1448
+ maxUsd?: number | undefined;
1449
+ inputOverrides?: Record<string, unknown> | undefined;
1450
+ }[];
1451
+ timeoutMs?: number | undefined;
1452
+ healthTtlMs?: number | undefined;
1453
+ } | undefined;
1454
+ }>, "many">;
1455
+ status: z.ZodDefault<z.ZodEnum<["pending", "running", "completed", "failed", "gated", "cancelled"]>>;
1456
+ artifacts: z.ZodDefault<z.ZodMap<z.ZodString, z.ZodObject<{
1457
+ id: z.ZodString;
1458
+ type: z.ZodEnum<["image", "video", "audio", "text", "document"]>;
1459
+ uri: z.ZodString;
1460
+ mimeType: z.ZodString;
1461
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1462
+ sourceStep: z.ZodOptional<z.ZodString>;
1463
+ createdAt: z.ZodOptional<z.ZodString>;
1464
+ }, "strip", z.ZodTypeAny, {
1465
+ id: string;
1466
+ type: "image" | "video" | "audio" | "text" | "document";
1467
+ uri: string;
1468
+ mimeType: string;
1469
+ metadata: Record<string, unknown>;
1470
+ sourceStep?: string | undefined;
1471
+ createdAt?: string | undefined;
1472
+ }, {
1473
+ id: string;
1474
+ type: "image" | "video" | "audio" | "text" | "document";
1475
+ uri: string;
1476
+ mimeType: string;
1477
+ metadata?: Record<string, unknown> | undefined;
1478
+ sourceStep?: string | undefined;
1479
+ createdAt?: string | undefined;
1480
+ }>>>;
1481
+ failedStep: z.ZodOptional<z.ZodString>;
1482
+ gatedStep: z.ZodOptional<z.ZodString>;
1483
+ currentStep: z.ZodOptional<z.ZodString>;
1484
+ completedSteps: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1485
+ startedAt: z.ZodOptional<z.ZodString>;
1486
+ completedAt: z.ZodOptional<z.ZodString>;
1487
+ }, "strip", z.ZodTypeAny, {
1488
+ id: string;
1489
+ steps: {
1490
+ id: string;
1491
+ operation: string;
1492
+ inputs: Record<string, string>;
1493
+ config: Record<string, unknown>;
1494
+ qualityGate?: {
1495
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1496
+ config: Record<string, unknown>;
1497
+ action: "fail" | "retry" | "warn";
1498
+ maxRetries?: number | undefined;
1499
+ } | undefined;
1500
+ variants?: {
1501
+ n: number;
1502
+ judge: {
1503
+ type: "llm-judge";
1504
+ criteria: string;
1505
+ model?: string | undefined;
1506
+ provider?: string | undefined;
1507
+ rubric?: {
1508
+ dimensions: {
1509
+ name: string;
1510
+ weight: number;
1511
+ description: string;
1512
+ }[];
1513
+ } | undefined;
1514
+ } | {
1515
+ type: "image-judge";
1516
+ criteria: "clip-score" | "aesthetic";
1517
+ reference?: string | undefined;
1518
+ } | {
1519
+ type: "rule";
1520
+ expression: string;
1521
+ } | {
1522
+ type: "custom";
1523
+ toolName: string;
1524
+ };
1525
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1526
+ seeds?: number[] | undefined;
1527
+ loserAction?: "archive" | "discard" | undefined;
1528
+ perVariantCandidate?: boolean | undefined;
1529
+ minScore?: number | undefined;
1530
+ } | undefined;
1531
+ gates?: {
1532
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1533
+ config: Record<string, unknown>;
1534
+ action: "fail" | "retry" | "warn";
1535
+ maxRetries?: number | undefined;
1536
+ }[] | undefined;
1537
+ cache?: {
1538
+ mode?: "use" | "refresh" | "skip" | undefined;
1539
+ ttlSeconds?: number | undefined;
1540
+ scope?: "global" | "tenant" | undefined;
1541
+ } | undefined;
1542
+ route?: {
1543
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1544
+ candidates: {
1545
+ model: string;
1546
+ provider: string;
1547
+ weight?: number | undefined;
1548
+ maxQueueMs?: number | undefined;
1549
+ maxUsd?: number | undefined;
1550
+ inputOverrides?: Record<string, unknown> | undefined;
1551
+ }[];
1552
+ timeoutMs?: number | undefined;
1553
+ healthTtlMs?: number | undefined;
1554
+ } | undefined;
1555
+ }[];
1556
+ status: "pending" | "running" | "completed" | "failed" | "gated" | "cancelled";
1557
+ artifacts: Map<string, {
1558
+ id: string;
1559
+ type: "image" | "video" | "audio" | "text" | "document";
1560
+ uri: string;
1561
+ mimeType: string;
1562
+ metadata: Record<string, unknown>;
1563
+ sourceStep?: string | undefined;
1564
+ createdAt?: string | undefined;
1565
+ }>;
1566
+ completedSteps: string[];
1567
+ failedStep?: string | undefined;
1568
+ gatedStep?: string | undefined;
1569
+ currentStep?: string | undefined;
1570
+ startedAt?: string | undefined;
1571
+ completedAt?: string | undefined;
1572
+ }, {
1573
+ id: string;
1574
+ steps: {
1575
+ id: string;
1576
+ operation: string;
1577
+ inputs: Record<string, string>;
1578
+ config?: Record<string, unknown> | undefined;
1579
+ qualityGate?: {
1580
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1581
+ config: Record<string, unknown>;
1582
+ action: "fail" | "retry" | "warn";
1583
+ maxRetries?: number | undefined;
1584
+ } | undefined;
1585
+ variants?: {
1586
+ n: number;
1587
+ judge: {
1588
+ type: "llm-judge";
1589
+ criteria: string;
1590
+ model?: string | undefined;
1591
+ provider?: string | undefined;
1592
+ rubric?: {
1593
+ dimensions: {
1594
+ name: string;
1595
+ weight: number;
1596
+ description: string;
1597
+ }[];
1598
+ } | undefined;
1599
+ } | {
1600
+ type: "image-judge";
1601
+ criteria: "clip-score" | "aesthetic";
1602
+ reference?: string | undefined;
1603
+ } | {
1604
+ type: "rule";
1605
+ expression: string;
1606
+ } | {
1607
+ type: "custom";
1608
+ toolName: string;
1609
+ };
1610
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1611
+ seeds?: number[] | undefined;
1612
+ loserAction?: "archive" | "discard" | undefined;
1613
+ perVariantCandidate?: boolean | undefined;
1614
+ minScore?: number | undefined;
1615
+ } | undefined;
1616
+ gates?: {
1617
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1618
+ config: Record<string, unknown>;
1619
+ action: "fail" | "retry" | "warn";
1620
+ maxRetries?: number | undefined;
1621
+ }[] | undefined;
1622
+ cache?: {
1623
+ mode?: "use" | "refresh" | "skip" | undefined;
1624
+ ttlSeconds?: number | undefined;
1625
+ scope?: "global" | "tenant" | undefined;
1626
+ } | undefined;
1627
+ route?: {
1628
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1629
+ candidates: {
1630
+ model: string;
1631
+ provider: string;
1632
+ weight?: number | undefined;
1633
+ maxQueueMs?: number | undefined;
1634
+ maxUsd?: number | undefined;
1635
+ inputOverrides?: Record<string, unknown> | undefined;
1636
+ }[];
1637
+ timeoutMs?: number | undefined;
1638
+ healthTtlMs?: number | undefined;
1639
+ } | undefined;
1640
+ }[];
1641
+ status?: "pending" | "running" | "completed" | "failed" | "gated" | "cancelled" | undefined;
1642
+ artifacts?: Map<string, {
1643
+ id: string;
1644
+ type: "image" | "video" | "audio" | "text" | "document";
1645
+ uri: string;
1646
+ mimeType: string;
1647
+ metadata?: Record<string, unknown> | undefined;
1648
+ sourceStep?: string | undefined;
1649
+ createdAt?: string | undefined;
1650
+ }> | undefined;
1651
+ failedStep?: string | undefined;
1652
+ gatedStep?: string | undefined;
1653
+ currentStep?: string | undefined;
1654
+ completedSteps?: string[] | undefined;
1655
+ startedAt?: string | undefined;
1656
+ completedAt?: string | undefined;
1657
+ }>;
1658
+ type Pipeline = z.infer<typeof PipelineSchema>;
1659
+ declare const PipelineDefinitionSchema: z.ZodObject<{
1660
+ id: z.ZodString;
1661
+ steps: z.ZodArray<z.ZodObject<{
1662
+ id: z.ZodString;
1663
+ operation: z.ZodString;
1664
+ inputs: z.ZodRecord<z.ZodString, z.ZodString>;
1665
+ config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1666
+ qualityGate: z.ZodOptional<z.ZodObject<{
1667
+ type: z.ZodEnum<["llm-judge", "threshold", "dimension-check", "custom"]>;
1668
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1669
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
1670
+ maxRetries: z.ZodOptional<z.ZodNumber>;
1671
+ }, "strip", z.ZodTypeAny, {
1672
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1673
+ config: Record<string, unknown>;
1674
+ action: "fail" | "retry" | "warn";
1675
+ maxRetries?: number | undefined;
1676
+ }, {
1677
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1678
+ config: Record<string, unknown>;
1679
+ action: "fail" | "retry" | "warn";
1680
+ maxRetries?: number | undefined;
1681
+ }>>;
1682
+ variants: z.ZodOptional<z.ZodObject<{
1683
+ n: z.ZodNumber;
1684
+ seedStrategy: z.ZodOptional<z.ZodEnum<["random", "sequential", "fixed-list"]>>;
1685
+ seeds: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
1686
+ judge: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1687
+ type: z.ZodLiteral<"llm-judge">;
1688
+ criteria: z.ZodString;
1689
+ model: z.ZodOptional<z.ZodString>;
1690
+ provider: z.ZodOptional<z.ZodString>;
1691
+ rubric: z.ZodOptional<z.ZodObject<{
1692
+ dimensions: z.ZodArray<z.ZodObject<{
1693
+ name: z.ZodString;
1694
+ weight: z.ZodNumber;
1695
+ description: z.ZodString;
1696
+ }, "strip", z.ZodTypeAny, {
1697
+ name: string;
1698
+ weight: number;
1699
+ description: string;
1700
+ }, {
1701
+ name: string;
1702
+ weight: number;
1703
+ description: string;
1704
+ }>, "many">;
1705
+ }, "strip", z.ZodTypeAny, {
1706
+ dimensions: {
1707
+ name: string;
1708
+ weight: number;
1709
+ description: string;
1710
+ }[];
1711
+ }, {
1712
+ dimensions: {
1713
+ name: string;
1714
+ weight: number;
1715
+ description: string;
1716
+ }[];
1717
+ }>>;
1718
+ }, "strip", z.ZodTypeAny, {
1719
+ type: "llm-judge";
1720
+ criteria: string;
1721
+ model?: string | undefined;
1722
+ provider?: string | undefined;
1723
+ rubric?: {
1724
+ dimensions: {
1725
+ name: string;
1726
+ weight: number;
1727
+ description: string;
1728
+ }[];
1729
+ } | undefined;
1730
+ }, {
1731
+ type: "llm-judge";
1732
+ criteria: string;
1733
+ model?: string | undefined;
1734
+ provider?: string | undefined;
1735
+ rubric?: {
1736
+ dimensions: {
1737
+ name: string;
1738
+ weight: number;
1739
+ description: string;
1740
+ }[];
1741
+ } | undefined;
1742
+ }>, z.ZodObject<{
1743
+ type: z.ZodLiteral<"image-judge">;
1744
+ criteria: z.ZodEnum<["clip-score", "aesthetic"]>;
1745
+ reference: z.ZodOptional<z.ZodString>;
1746
+ }, "strip", z.ZodTypeAny, {
1747
+ type: "image-judge";
1748
+ criteria: "clip-score" | "aesthetic";
1749
+ reference?: string | undefined;
1750
+ }, {
1751
+ type: "image-judge";
1752
+ criteria: "clip-score" | "aesthetic";
1753
+ reference?: string | undefined;
1754
+ }>, z.ZodObject<{
1755
+ type: z.ZodLiteral<"rule">;
1756
+ expression: z.ZodString;
1757
+ }, "strip", z.ZodTypeAny, {
1758
+ type: "rule";
1759
+ expression: string;
1760
+ }, {
1761
+ type: "rule";
1762
+ expression: string;
1763
+ }>, z.ZodObject<{
1764
+ type: z.ZodLiteral<"custom">;
1765
+ toolName: z.ZodString;
1766
+ }, "strip", z.ZodTypeAny, {
1767
+ type: "custom";
1768
+ toolName: string;
1769
+ }, {
1770
+ type: "custom";
1771
+ toolName: string;
1772
+ }>]>;
1773
+ loserAction: z.ZodOptional<z.ZodEnum<["archive", "discard"]>>;
1774
+ perVariantCandidate: z.ZodOptional<z.ZodBoolean>;
1775
+ minScore: z.ZodOptional<z.ZodNumber>;
1776
+ }, "strip", z.ZodTypeAny, {
1777
+ n: number;
1778
+ judge: {
1779
+ type: "llm-judge";
1780
+ criteria: string;
1781
+ model?: string | undefined;
1782
+ provider?: string | undefined;
1783
+ rubric?: {
1784
+ dimensions: {
1785
+ name: string;
1786
+ weight: number;
1787
+ description: string;
1788
+ }[];
1789
+ } | undefined;
1790
+ } | {
1791
+ type: "image-judge";
1792
+ criteria: "clip-score" | "aesthetic";
1793
+ reference?: string | undefined;
1794
+ } | {
1795
+ type: "rule";
1796
+ expression: string;
1797
+ } | {
1798
+ type: "custom";
1799
+ toolName: string;
1800
+ };
1801
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1802
+ seeds?: number[] | undefined;
1803
+ loserAction?: "archive" | "discard" | undefined;
1804
+ perVariantCandidate?: boolean | undefined;
1805
+ minScore?: number | undefined;
1806
+ }, {
1807
+ n: number;
1808
+ judge: {
1809
+ type: "llm-judge";
1810
+ criteria: string;
1811
+ model?: string | undefined;
1812
+ provider?: string | undefined;
1813
+ rubric?: {
1814
+ dimensions: {
1815
+ name: string;
1816
+ weight: number;
1817
+ description: string;
1818
+ }[];
1819
+ } | undefined;
1820
+ } | {
1821
+ type: "image-judge";
1822
+ criteria: "clip-score" | "aesthetic";
1823
+ reference?: string | undefined;
1824
+ } | {
1825
+ type: "rule";
1826
+ expression: string;
1827
+ } | {
1828
+ type: "custom";
1829
+ toolName: string;
1830
+ };
1831
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1832
+ seeds?: number[] | undefined;
1833
+ loserAction?: "archive" | "discard" | undefined;
1834
+ perVariantCandidate?: boolean | undefined;
1835
+ minScore?: number | undefined;
1836
+ }>>;
1837
+ gates: z.ZodOptional<z.ZodArray<z.ZodObject<{
1838
+ type: z.ZodEnum<["llm-judge", "threshold", "dimension-check", "custom"]>;
1839
+ config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1840
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
1841
+ maxRetries: z.ZodOptional<z.ZodNumber>;
1842
+ }, "strip", z.ZodTypeAny, {
1843
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1844
+ config: Record<string, unknown>;
1845
+ action: "fail" | "retry" | "warn";
1846
+ maxRetries?: number | undefined;
1847
+ }, {
1848
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1849
+ config: Record<string, unknown>;
1850
+ action: "fail" | "retry" | "warn";
1851
+ maxRetries?: number | undefined;
1852
+ }>, "many">>;
1853
+ cache: z.ZodOptional<z.ZodObject<{
1854
+ mode: z.ZodOptional<z.ZodEnum<["use", "refresh", "skip"]>>;
1855
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
1856
+ scope: z.ZodOptional<z.ZodEnum<["global", "tenant"]>>;
1857
+ }, "strip", z.ZodTypeAny, {
1858
+ mode?: "use" | "refresh" | "skip" | undefined;
1859
+ ttlSeconds?: number | undefined;
1860
+ scope?: "global" | "tenant" | undefined;
1861
+ }, {
1862
+ mode?: "use" | "refresh" | "skip" | undefined;
1863
+ ttlSeconds?: number | undefined;
1864
+ scope?: "global" | "tenant" | undefined;
1865
+ }>>;
1866
+ route: z.ZodOptional<z.ZodObject<{
1867
+ strategy: z.ZodEnum<["first-success", "cheapest-acceptable", "fastest"]>;
1868
+ candidates: z.ZodArray<z.ZodObject<{
1869
+ provider: z.ZodString;
1870
+ model: z.ZodString;
1871
+ maxQueueMs: z.ZodOptional<z.ZodNumber>;
1872
+ maxUsd: z.ZodOptional<z.ZodNumber>;
1873
+ inputOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1874
+ weight: z.ZodOptional<z.ZodNumber>;
1875
+ }, "strip", z.ZodTypeAny, {
1876
+ model: string;
1877
+ provider: string;
1878
+ weight?: number | undefined;
1879
+ maxQueueMs?: number | undefined;
1880
+ maxUsd?: number | undefined;
1881
+ inputOverrides?: Record<string, unknown> | undefined;
1882
+ }, {
1883
+ model: string;
1884
+ provider: string;
1885
+ weight?: number | undefined;
1886
+ maxQueueMs?: number | undefined;
1887
+ maxUsd?: number | undefined;
1888
+ inputOverrides?: Record<string, unknown> | undefined;
1889
+ }>, "many">;
1890
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
1891
+ healthTtlMs: z.ZodOptional<z.ZodNumber>;
1892
+ }, "strip", z.ZodTypeAny, {
1893
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1894
+ candidates: {
1895
+ model: string;
1896
+ provider: string;
1897
+ weight?: number | undefined;
1898
+ maxQueueMs?: number | undefined;
1899
+ maxUsd?: number | undefined;
1900
+ inputOverrides?: Record<string, unknown> | undefined;
1901
+ }[];
1902
+ timeoutMs?: number | undefined;
1903
+ healthTtlMs?: number | undefined;
1904
+ }, {
1905
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1906
+ candidates: {
1907
+ model: string;
1908
+ provider: string;
1909
+ weight?: number | undefined;
1910
+ maxQueueMs?: number | undefined;
1911
+ maxUsd?: number | undefined;
1912
+ inputOverrides?: Record<string, unknown> | undefined;
1913
+ }[];
1914
+ timeoutMs?: number | undefined;
1915
+ healthTtlMs?: number | undefined;
1916
+ }>>;
1917
+ }, "strip", z.ZodTypeAny, {
1918
+ id: string;
1919
+ operation: string;
1920
+ inputs: Record<string, string>;
1921
+ config: Record<string, unknown>;
1922
+ qualityGate?: {
1923
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1924
+ config: Record<string, unknown>;
1925
+ action: "fail" | "retry" | "warn";
1926
+ maxRetries?: number | undefined;
1927
+ } | undefined;
1928
+ variants?: {
1929
+ n: number;
1930
+ judge: {
1931
+ type: "llm-judge";
1932
+ criteria: string;
1933
+ model?: string | undefined;
1934
+ provider?: string | undefined;
1935
+ rubric?: {
1936
+ dimensions: {
1937
+ name: string;
1938
+ weight: number;
1939
+ description: string;
1940
+ }[];
1941
+ } | undefined;
1942
+ } | {
1943
+ type: "image-judge";
1944
+ criteria: "clip-score" | "aesthetic";
1945
+ reference?: string | undefined;
1946
+ } | {
1947
+ type: "rule";
1948
+ expression: string;
1949
+ } | {
1950
+ type: "custom";
1951
+ toolName: string;
1952
+ };
1953
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
1954
+ seeds?: number[] | undefined;
1955
+ loserAction?: "archive" | "discard" | undefined;
1956
+ perVariantCandidate?: boolean | undefined;
1957
+ minScore?: number | undefined;
1958
+ } | undefined;
1959
+ gates?: {
1960
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1961
+ config: Record<string, unknown>;
1962
+ action: "fail" | "retry" | "warn";
1963
+ maxRetries?: number | undefined;
1964
+ }[] | undefined;
1965
+ cache?: {
1966
+ mode?: "use" | "refresh" | "skip" | undefined;
1967
+ ttlSeconds?: number | undefined;
1968
+ scope?: "global" | "tenant" | undefined;
1969
+ } | undefined;
1970
+ route?: {
1971
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
1972
+ candidates: {
1973
+ model: string;
1974
+ provider: string;
1975
+ weight?: number | undefined;
1976
+ maxQueueMs?: number | undefined;
1977
+ maxUsd?: number | undefined;
1978
+ inputOverrides?: Record<string, unknown> | undefined;
1979
+ }[];
1980
+ timeoutMs?: number | undefined;
1981
+ healthTtlMs?: number | undefined;
1982
+ } | undefined;
1983
+ }, {
1984
+ id: string;
1985
+ operation: string;
1986
+ inputs: Record<string, string>;
1987
+ config?: Record<string, unknown> | undefined;
1988
+ qualityGate?: {
1989
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
1990
+ config: Record<string, unknown>;
1991
+ action: "fail" | "retry" | "warn";
1992
+ maxRetries?: number | undefined;
1993
+ } | undefined;
1994
+ variants?: {
1995
+ n: number;
1996
+ judge: {
1997
+ type: "llm-judge";
1998
+ criteria: string;
1999
+ model?: string | undefined;
2000
+ provider?: string | undefined;
2001
+ rubric?: {
2002
+ dimensions: {
2003
+ name: string;
2004
+ weight: number;
2005
+ description: string;
2006
+ }[];
2007
+ } | undefined;
2008
+ } | {
2009
+ type: "image-judge";
2010
+ criteria: "clip-score" | "aesthetic";
2011
+ reference?: string | undefined;
2012
+ } | {
2013
+ type: "rule";
2014
+ expression: string;
2015
+ } | {
2016
+ type: "custom";
2017
+ toolName: string;
2018
+ };
2019
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
2020
+ seeds?: number[] | undefined;
2021
+ loserAction?: "archive" | "discard" | undefined;
2022
+ perVariantCandidate?: boolean | undefined;
2023
+ minScore?: number | undefined;
2024
+ } | undefined;
2025
+ gates?: {
2026
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
2027
+ config: Record<string, unknown>;
2028
+ action: "fail" | "retry" | "warn";
2029
+ maxRetries?: number | undefined;
2030
+ }[] | undefined;
2031
+ cache?: {
2032
+ mode?: "use" | "refresh" | "skip" | undefined;
2033
+ ttlSeconds?: number | undefined;
2034
+ scope?: "global" | "tenant" | undefined;
2035
+ } | undefined;
2036
+ route?: {
2037
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
2038
+ candidates: {
2039
+ model: string;
2040
+ provider: string;
2041
+ weight?: number | undefined;
2042
+ maxQueueMs?: number | undefined;
2043
+ maxUsd?: number | undefined;
2044
+ inputOverrides?: Record<string, unknown> | undefined;
2045
+ }[];
2046
+ timeoutMs?: number | undefined;
2047
+ healthTtlMs?: number | undefined;
2048
+ } | undefined;
2049
+ }>, "many">;
2050
+ resumable: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2051
+ budget: z.ZodOptional<z.ZodObject<{
2052
+ maxUsd: z.ZodNumber;
2053
+ onExceed: z.ZodEnum<["abort", "suspend"]>;
2054
+ warnAtPct: z.ZodOptional<z.ZodNumber>;
2055
+ }, "strip", z.ZodTypeAny, {
2056
+ maxUsd: number;
2057
+ onExceed: "abort" | "suspend";
2058
+ warnAtPct?: number | undefined;
2059
+ }, {
2060
+ maxUsd: number;
2061
+ onExceed: "abort" | "suspend";
2062
+ warnAtPct?: number | undefined;
2063
+ }>>;
2064
+ context: z.ZodOptional<z.ZodObject<{
2065
+ voices: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2066
+ provider: z.ZodEnum<["elevenlabs", "openai", "google", "deepgram-tts"]>;
2067
+ voiceId: z.ZodString;
2068
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2069
+ }, "strip", z.ZodTypeAny, {
2070
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
2071
+ voiceId: string;
2072
+ settings?: Record<string, unknown> | undefined;
2073
+ }, {
2074
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
2075
+ voiceId: string;
2076
+ settings?: Record<string, unknown> | undefined;
2077
+ }>>>;
2078
+ styles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2079
+ description: z.ZodString;
2080
+ negative: z.ZodOptional<z.ZodString>;
2081
+ perProvider: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2082
+ description: z.ZodOptional<z.ZodString>;
2083
+ negative: z.ZodOptional<z.ZodString>;
2084
+ }, "strip", z.ZodTypeAny, {
2085
+ description?: string | undefined;
2086
+ negative?: string | undefined;
2087
+ }, {
2088
+ description?: string | undefined;
2089
+ negative?: string | undefined;
2090
+ }>>>;
2091
+ }, "strip", z.ZodTypeAny, {
2092
+ description: string;
2093
+ negative?: string | undefined;
2094
+ perProvider?: Record<string, {
2095
+ description?: string | undefined;
2096
+ negative?: string | undefined;
2097
+ }> | undefined;
2098
+ }, {
2099
+ description: string;
2100
+ negative?: string | undefined;
2101
+ perProvider?: Record<string, {
2102
+ description?: string | undefined;
2103
+ negative?: string | undefined;
2104
+ }> | undefined;
2105
+ }>>>;
2106
+ brandKit: z.ZodOptional<z.ZodObject<{
2107
+ primaryColor: z.ZodOptional<z.ZodString>;
2108
+ secondaryColor: z.ZodOptional<z.ZodString>;
2109
+ fontFamily: z.ZodOptional<z.ZodString>;
2110
+ logoArtifactId: z.ZodOptional<z.ZodString>;
2111
+ extras: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2112
+ }, "strip", z.ZodTypeAny, {
2113
+ primaryColor?: string | undefined;
2114
+ secondaryColor?: string | undefined;
2115
+ fontFamily?: string | undefined;
2116
+ logoArtifactId?: string | undefined;
2117
+ extras?: Record<string, unknown> | undefined;
2118
+ }, {
2119
+ primaryColor?: string | undefined;
2120
+ secondaryColor?: string | undefined;
2121
+ fontFamily?: string | undefined;
2122
+ logoArtifactId?: string | undefined;
2123
+ extras?: Record<string, unknown> | undefined;
2124
+ }>>;
2125
+ vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2126
+ }, "strip", z.ZodTypeAny, {
2127
+ voices?: Record<string, {
2128
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
2129
+ voiceId: string;
2130
+ settings?: Record<string, unknown> | undefined;
2131
+ }> | undefined;
2132
+ styles?: Record<string, {
2133
+ description: string;
2134
+ negative?: string | undefined;
2135
+ perProvider?: Record<string, {
2136
+ description?: string | undefined;
2137
+ negative?: string | undefined;
2138
+ }> | undefined;
2139
+ }> | undefined;
2140
+ brandKit?: {
2141
+ primaryColor?: string | undefined;
2142
+ secondaryColor?: string | undefined;
2143
+ fontFamily?: string | undefined;
2144
+ logoArtifactId?: string | undefined;
2145
+ extras?: Record<string, unknown> | undefined;
2146
+ } | undefined;
2147
+ vars?: Record<string, unknown> | undefined;
2148
+ }, {
2149
+ voices?: Record<string, {
2150
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
2151
+ voiceId: string;
2152
+ settings?: Record<string, unknown> | undefined;
2153
+ }> | undefined;
2154
+ styles?: Record<string, {
2155
+ description: string;
2156
+ negative?: string | undefined;
2157
+ perProvider?: Record<string, {
2158
+ description?: string | undefined;
2159
+ negative?: string | undefined;
2160
+ }> | undefined;
2161
+ }> | undefined;
2162
+ brandKit?: {
2163
+ primaryColor?: string | undefined;
2164
+ secondaryColor?: string | undefined;
2165
+ fontFamily?: string | undefined;
2166
+ logoArtifactId?: string | undefined;
2167
+ extras?: Record<string, unknown> | undefined;
2168
+ } | undefined;
2169
+ vars?: Record<string, unknown> | undefined;
2170
+ }>>;
2171
+ }, "strip", z.ZodTypeAny, {
2172
+ id: string;
2173
+ steps: {
2174
+ id: string;
2175
+ operation: string;
2176
+ inputs: Record<string, string>;
2177
+ config: Record<string, unknown>;
2178
+ qualityGate?: {
2179
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
2180
+ config: Record<string, unknown>;
2181
+ action: "fail" | "retry" | "warn";
2182
+ maxRetries?: number | undefined;
2183
+ } | undefined;
2184
+ variants?: {
2185
+ n: number;
2186
+ judge: {
2187
+ type: "llm-judge";
2188
+ criteria: string;
2189
+ model?: string | undefined;
2190
+ provider?: string | undefined;
2191
+ rubric?: {
2192
+ dimensions: {
2193
+ name: string;
2194
+ weight: number;
2195
+ description: string;
2196
+ }[];
2197
+ } | undefined;
2198
+ } | {
2199
+ type: "image-judge";
2200
+ criteria: "clip-score" | "aesthetic";
2201
+ reference?: string | undefined;
2202
+ } | {
2203
+ type: "rule";
2204
+ expression: string;
2205
+ } | {
2206
+ type: "custom";
2207
+ toolName: string;
2208
+ };
2209
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
2210
+ seeds?: number[] | undefined;
2211
+ loserAction?: "archive" | "discard" | undefined;
2212
+ perVariantCandidate?: boolean | undefined;
2213
+ minScore?: number | undefined;
2214
+ } | undefined;
2215
+ gates?: {
2216
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
2217
+ config: Record<string, unknown>;
2218
+ action: "fail" | "retry" | "warn";
2219
+ maxRetries?: number | undefined;
2220
+ }[] | undefined;
2221
+ cache?: {
2222
+ mode?: "use" | "refresh" | "skip" | undefined;
2223
+ ttlSeconds?: number | undefined;
2224
+ scope?: "global" | "tenant" | undefined;
2225
+ } | undefined;
2226
+ route?: {
2227
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
2228
+ candidates: {
2229
+ model: string;
2230
+ provider: string;
2231
+ weight?: number | undefined;
2232
+ maxQueueMs?: number | undefined;
2233
+ maxUsd?: number | undefined;
2234
+ inputOverrides?: Record<string, unknown> | undefined;
2235
+ }[];
2236
+ timeoutMs?: number | undefined;
2237
+ healthTtlMs?: number | undefined;
2238
+ } | undefined;
2239
+ }[];
2240
+ resumable?: boolean | undefined;
2241
+ budget?: {
2242
+ maxUsd: number;
2243
+ onExceed: "abort" | "suspend";
2244
+ warnAtPct?: number | undefined;
2245
+ } | undefined;
2246
+ context?: {
2247
+ voices?: Record<string, {
2248
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
2249
+ voiceId: string;
2250
+ settings?: Record<string, unknown> | undefined;
2251
+ }> | undefined;
2252
+ styles?: Record<string, {
2253
+ description: string;
2254
+ negative?: string | undefined;
2255
+ perProvider?: Record<string, {
2256
+ description?: string | undefined;
2257
+ negative?: string | undefined;
2258
+ }> | undefined;
2259
+ }> | undefined;
2260
+ brandKit?: {
2261
+ primaryColor?: string | undefined;
2262
+ secondaryColor?: string | undefined;
2263
+ fontFamily?: string | undefined;
2264
+ logoArtifactId?: string | undefined;
2265
+ extras?: Record<string, unknown> | undefined;
2266
+ } | undefined;
2267
+ vars?: Record<string, unknown> | undefined;
2268
+ } | undefined;
2269
+ }, {
2270
+ id: string;
2271
+ steps: {
2272
+ id: string;
2273
+ operation: string;
2274
+ inputs: Record<string, string>;
2275
+ config?: Record<string, unknown> | undefined;
2276
+ qualityGate?: {
2277
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
2278
+ config: Record<string, unknown>;
2279
+ action: "fail" | "retry" | "warn";
2280
+ maxRetries?: number | undefined;
2281
+ } | undefined;
2282
+ variants?: {
2283
+ n: number;
2284
+ judge: {
2285
+ type: "llm-judge";
2286
+ criteria: string;
2287
+ model?: string | undefined;
2288
+ provider?: string | undefined;
2289
+ rubric?: {
2290
+ dimensions: {
2291
+ name: string;
2292
+ weight: number;
2293
+ description: string;
2294
+ }[];
2295
+ } | undefined;
2296
+ } | {
2297
+ type: "image-judge";
2298
+ criteria: "clip-score" | "aesthetic";
2299
+ reference?: string | undefined;
2300
+ } | {
2301
+ type: "rule";
2302
+ expression: string;
2303
+ } | {
2304
+ type: "custom";
2305
+ toolName: string;
2306
+ };
2307
+ seedStrategy?: "random" | "sequential" | "fixed-list" | undefined;
2308
+ seeds?: number[] | undefined;
2309
+ loserAction?: "archive" | "discard" | undefined;
2310
+ perVariantCandidate?: boolean | undefined;
2311
+ minScore?: number | undefined;
2312
+ } | undefined;
2313
+ gates?: {
2314
+ type: "custom" | "llm-judge" | "threshold" | "dimension-check";
2315
+ config: Record<string, unknown>;
2316
+ action: "fail" | "retry" | "warn";
2317
+ maxRetries?: number | undefined;
2318
+ }[] | undefined;
2319
+ cache?: {
2320
+ mode?: "use" | "refresh" | "skip" | undefined;
2321
+ ttlSeconds?: number | undefined;
2322
+ scope?: "global" | "tenant" | undefined;
2323
+ } | undefined;
2324
+ route?: {
2325
+ strategy: "first-success" | "cheapest-acceptable" | "fastest";
2326
+ candidates: {
2327
+ model: string;
2328
+ provider: string;
2329
+ weight?: number | undefined;
2330
+ maxQueueMs?: number | undefined;
2331
+ maxUsd?: number | undefined;
2332
+ inputOverrides?: Record<string, unknown> | undefined;
2333
+ }[];
2334
+ timeoutMs?: number | undefined;
2335
+ healthTtlMs?: number | undefined;
2336
+ } | undefined;
2337
+ }[];
2338
+ resumable?: boolean | undefined;
2339
+ budget?: {
2340
+ maxUsd: number;
2341
+ onExceed: "abort" | "suspend";
2342
+ warnAtPct?: number | undefined;
2343
+ } | undefined;
2344
+ context?: {
2345
+ voices?: Record<string, {
2346
+ provider: "elevenlabs" | "openai" | "google" | "deepgram-tts";
2347
+ voiceId: string;
2348
+ settings?: Record<string, unknown> | undefined;
2349
+ }> | undefined;
2350
+ styles?: Record<string, {
2351
+ description: string;
2352
+ negative?: string | undefined;
2353
+ perProvider?: Record<string, {
2354
+ description?: string | undefined;
2355
+ negative?: string | undefined;
2356
+ }> | undefined;
2357
+ }> | undefined;
2358
+ brandKit?: {
2359
+ primaryColor?: string | undefined;
2360
+ secondaryColor?: string | undefined;
2361
+ fontFamily?: string | undefined;
2362
+ logoArtifactId?: string | undefined;
2363
+ extras?: Record<string, unknown> | undefined;
2364
+ } | undefined;
2365
+ vars?: Record<string, unknown> | undefined;
2366
+ } | undefined;
2367
+ }>;
2368
+ type PipelineDefinition = z.infer<typeof PipelineDefinitionSchema>;
2369
+ declare const ProviderInputSchema: z.ZodObject<{
2370
+ operation: z.ZodString;
2371
+ inputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2372
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2373
+ }, "strip", z.ZodTypeAny, {
2374
+ operation: string;
2375
+ inputs: Record<string, unknown>;
2376
+ config?: Record<string, unknown> | undefined;
2377
+ }, {
2378
+ operation: string;
2379
+ inputs: Record<string, unknown>;
2380
+ config?: Record<string, unknown> | undefined;
2381
+ }>;
2382
+ type ProviderInput = z.infer<typeof ProviderInputSchema>;
2383
+ declare const ProviderOutputSchema: z.ZodObject<{
2384
+ artifact: z.ZodObject<{
2385
+ id: z.ZodString;
2386
+ type: z.ZodEnum<["image", "video", "audio", "text", "document"]>;
2387
+ uri: z.ZodString;
2388
+ mimeType: z.ZodString;
2389
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2390
+ sourceStep: z.ZodOptional<z.ZodString>;
2391
+ createdAt: z.ZodOptional<z.ZodString>;
2392
+ }, "strip", z.ZodTypeAny, {
2393
+ id: string;
2394
+ type: "image" | "video" | "audio" | "text" | "document";
2395
+ uri: string;
2396
+ mimeType: string;
2397
+ metadata: Record<string, unknown>;
2398
+ sourceStep?: string | undefined;
2399
+ createdAt?: string | undefined;
2400
+ }, {
2401
+ id: string;
2402
+ type: "image" | "video" | "audio" | "text" | "document";
2403
+ uri: string;
2404
+ mimeType: string;
2405
+ metadata?: Record<string, unknown> | undefined;
2406
+ sourceStep?: string | undefined;
2407
+ createdAt?: string | undefined;
2408
+ }>;
2409
+ cost_usd: z.ZodOptional<z.ZodNumber>;
2410
+ duration_ms: z.ZodOptional<z.ZodNumber>;
2411
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2412
+ }, "strip", z.ZodTypeAny, {
2413
+ artifact: {
2414
+ id: string;
2415
+ type: "image" | "video" | "audio" | "text" | "document";
2416
+ uri: string;
2417
+ mimeType: string;
2418
+ metadata: Record<string, unknown>;
2419
+ sourceStep?: string | undefined;
2420
+ createdAt?: string | undefined;
2421
+ };
2422
+ metadata?: Record<string, unknown> | undefined;
2423
+ cost_usd?: number | undefined;
2424
+ duration_ms?: number | undefined;
2425
+ }, {
2426
+ artifact: {
2427
+ id: string;
2428
+ type: "image" | "video" | "audio" | "text" | "document";
2429
+ uri: string;
2430
+ mimeType: string;
2431
+ metadata?: Record<string, unknown> | undefined;
2432
+ sourceStep?: string | undefined;
2433
+ createdAt?: string | undefined;
2434
+ };
2435
+ metadata?: Record<string, unknown> | undefined;
2436
+ cost_usd?: number | undefined;
2437
+ duration_ms?: number | undefined;
2438
+ }>;
2439
+ type ProviderOutput = z.infer<typeof ProviderOutputSchema>;
2440
+ declare const QualityGateResultSchema: z.ZodObject<{
2441
+ passed: z.ZodBoolean;
2442
+ reasoning: z.ZodOptional<z.ZodString>;
2443
+ score: z.ZodOptional<z.ZodNumber>;
2444
+ action: z.ZodEnum<["fail", "retry", "warn"]>;
2445
+ }, "strip", z.ZodTypeAny, {
2446
+ action: "fail" | "retry" | "warn";
2447
+ passed: boolean;
2448
+ reasoning?: string | undefined;
2449
+ score?: number | undefined;
2450
+ }, {
2451
+ action: "fail" | "retry" | "warn";
2452
+ passed: boolean;
2453
+ reasoning?: string | undefined;
2454
+ score?: number | undefined;
2455
+ }>;
2456
+ type QualityGateResult = z.infer<typeof QualityGateResultSchema>;
2457
+ declare const PipelineEventTypeSchema: z.ZodEnum<["pipeline:start", "pipeline:complete", "pipeline:failed", "pipeline:gated", "step:start", "step:complete", "step:failed", "step:gated", "step:retry", "run-created", "run-started", "run-completed", "run-failed", "run-suspended", "run-resumed", "step-started", "step-progress", "step-completed", "step-failed", "step-cached", "step-gated"]>;
2458
+ type PipelineEventType = z.infer<typeof PipelineEventTypeSchema>;
2459
+ declare const PipelineEventSchema: z.ZodObject<{
2460
+ type: z.ZodEnum<["pipeline:start", "pipeline:complete", "pipeline:failed", "pipeline:gated", "step:start", "step:complete", "step:failed", "step:gated", "step:retry", "run-created", "run-started", "run-completed", "run-failed", "run-suspended", "run-resumed", "step-started", "step-progress", "step-completed", "step-failed", "step-cached", "step-gated"]>;
2461
+ pipelineId: z.ZodString;
2462
+ stepId: z.ZodOptional<z.ZodString>;
2463
+ artifactId: z.ZodOptional<z.ZodString>;
2464
+ timestamp: z.ZodString;
2465
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2466
+ }, "strip", z.ZodTypeAny, {
2467
+ type: "pipeline:start" | "pipeline:complete" | "pipeline:failed" | "pipeline:gated" | "step:start" | "step:complete" | "step:failed" | "step:gated" | "step:retry" | "run-created" | "run-started" | "run-completed" | "run-failed" | "run-suspended" | "run-resumed" | "step-started" | "step-progress" | "step-completed" | "step-failed" | "step-cached" | "step-gated";
2468
+ pipelineId: string;
2469
+ timestamp: string;
2470
+ stepId?: string | undefined;
2471
+ artifactId?: string | undefined;
2472
+ data?: Record<string, unknown> | undefined;
2473
+ }, {
2474
+ type: "pipeline:start" | "pipeline:complete" | "pipeline:failed" | "pipeline:gated" | "step:start" | "step:complete" | "step:failed" | "step:gated" | "step:retry" | "run-created" | "run-started" | "run-completed" | "run-failed" | "run-suspended" | "run-resumed" | "step-started" | "step-progress" | "step-completed" | "step-failed" | "step-cached" | "step-gated";
2475
+ pipelineId: string;
2476
+ timestamp: string;
2477
+ stepId?: string | undefined;
2478
+ artifactId?: string | undefined;
2479
+ data?: Record<string, unknown> | undefined;
2480
+ }>;
2481
+ type PipelineEvent = z.infer<typeof PipelineEventSchema>;
2482
+ declare const CostRecordSchema: z.ZodObject<{
2483
+ operation: z.ZodString;
2484
+ provider: z.ZodString;
2485
+ model: z.ZodOptional<z.ZodString>;
2486
+ cost_usd: z.ZodNumber;
2487
+ artifactId: z.ZodOptional<z.ZodString>;
2488
+ pipelineId: z.ZodOptional<z.ZodString>;
2489
+ timestamp: z.ZodString;
2490
+ }, "strip", z.ZodTypeAny, {
2491
+ operation: string;
2492
+ provider: string;
2493
+ cost_usd: number;
2494
+ timestamp: string;
2495
+ model?: string | undefined;
2496
+ pipelineId?: string | undefined;
2497
+ artifactId?: string | undefined;
2498
+ }, {
2499
+ operation: string;
2500
+ provider: string;
2501
+ cost_usd: number;
2502
+ timestamp: string;
2503
+ model?: string | undefined;
2504
+ pipelineId?: string | undefined;
2505
+ artifactId?: string | undefined;
2506
+ }>;
2507
+ type CostRecord = z.infer<typeof CostRecordSchema>;
2508
+ declare const CostSummarySchema: z.ZodObject<{
2509
+ total_usd: z.ZodNumber;
2510
+ by_operation: z.ZodDefault<z.ZodMap<z.ZodString, z.ZodNumber>>;
2511
+ by_provider: z.ZodDefault<z.ZodMap<z.ZodString, z.ZodNumber>>;
2512
+ by_pipeline: z.ZodDefault<z.ZodMap<z.ZodString, z.ZodNumber>>;
2513
+ }, "strip", z.ZodTypeAny, {
2514
+ total_usd: number;
2515
+ by_operation: Map<string, number>;
2516
+ by_provider: Map<string, number>;
2517
+ by_pipeline: Map<string, number>;
2518
+ }, {
2519
+ total_usd: number;
2520
+ by_operation?: Map<string, number> | undefined;
2521
+ by_provider?: Map<string, number> | undefined;
2522
+ by_pipeline?: Map<string, number> | undefined;
2523
+ }>;
2524
+ type CostSummary = z.infer<typeof CostSummarySchema>;
2525
+ declare const ArtifactMetaSchema: z.ZodObject<{
2526
+ id: z.ZodString;
2527
+ type: z.ZodEnum<["image", "video", "audio", "text", "document"]>;
2528
+ mimeType: z.ZodString;
2529
+ size: z.ZodOptional<z.ZodNumber>;
2530
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2531
+ createdAt: z.ZodOptional<z.ZodString>;
2532
+ sourceStep: z.ZodOptional<z.ZodString>;
2533
+ }, "strip", z.ZodTypeAny, {
2534
+ id: string;
2535
+ type: "image" | "video" | "audio" | "text" | "document";
2536
+ mimeType: string;
2537
+ metadata?: Record<string, unknown> | undefined;
2538
+ sourceStep?: string | undefined;
2539
+ createdAt?: string | undefined;
2540
+ size?: number | undefined;
2541
+ }, {
2542
+ id: string;
2543
+ type: "image" | "video" | "audio" | "text" | "document";
2544
+ mimeType: string;
2545
+ metadata?: Record<string, unknown> | undefined;
2546
+ sourceStep?: string | undefined;
2547
+ createdAt?: string | undefined;
2548
+ size?: number | undefined;
2549
+ }>;
2550
+ type ArtifactMeta = z.infer<typeof ArtifactMetaSchema>;
2551
+ declare const StorageResultSchema: z.ZodObject<{
2552
+ data: z.ZodUnion<[z.ZodType<stream_web.ReadableStream<unknown>, z.ZodTypeDef, stream_web.ReadableStream<unknown>>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>;
2553
+ meta: z.ZodObject<{
2554
+ id: z.ZodString;
2555
+ type: z.ZodEnum<["image", "video", "audio", "text", "document"]>;
2556
+ mimeType: z.ZodString;
2557
+ size: z.ZodOptional<z.ZodNumber>;
2558
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2559
+ createdAt: z.ZodOptional<z.ZodString>;
2560
+ sourceStep: z.ZodOptional<z.ZodString>;
2561
+ }, "strip", z.ZodTypeAny, {
2562
+ id: string;
2563
+ type: "image" | "video" | "audio" | "text" | "document";
2564
+ mimeType: string;
2565
+ metadata?: Record<string, unknown> | undefined;
2566
+ sourceStep?: string | undefined;
2567
+ createdAt?: string | undefined;
2568
+ size?: number | undefined;
2569
+ }, {
2570
+ id: string;
2571
+ type: "image" | "video" | "audio" | "text" | "document";
2572
+ mimeType: string;
2573
+ metadata?: Record<string, unknown> | undefined;
2574
+ sourceStep?: string | undefined;
2575
+ createdAt?: string | undefined;
2576
+ size?: number | undefined;
2577
+ }>;
2578
+ }, "strip", z.ZodTypeAny, {
2579
+ data: stream_web.ReadableStream<unknown> | Buffer<ArrayBufferLike>;
2580
+ meta: {
2581
+ id: string;
2582
+ type: "image" | "video" | "audio" | "text" | "document";
2583
+ mimeType: string;
2584
+ metadata?: Record<string, unknown> | undefined;
2585
+ sourceStep?: string | undefined;
2586
+ createdAt?: string | undefined;
2587
+ size?: number | undefined;
2588
+ };
2589
+ }, {
2590
+ data: stream_web.ReadableStream<unknown> | Buffer<ArrayBufferLike>;
2591
+ meta: {
2592
+ id: string;
2593
+ type: "image" | "video" | "audio" | "text" | "document";
2594
+ mimeType: string;
2595
+ metadata?: Record<string, unknown> | undefined;
2596
+ sourceStep?: string | undefined;
2597
+ createdAt?: string | undefined;
2598
+ size?: number | undefined;
2599
+ };
2600
+ }>;
2601
+ type StorageResult = z.infer<typeof StorageResultSchema>;
2602
+ declare const ValidationResultSchema: z.ZodObject<{
2603
+ valid: z.ZodBoolean;
2604
+ errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2605
+ warnings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2606
+ estimated_cost_usd: z.ZodOptional<z.ZodNumber>;
2607
+ estimated_duration_ms: z.ZodOptional<z.ZodNumber>;
2608
+ }, "strip", z.ZodTypeAny, {
2609
+ valid: boolean;
2610
+ errors: string[];
2611
+ warnings: string[];
2612
+ estimated_cost_usd?: number | undefined;
2613
+ estimated_duration_ms?: number | undefined;
2614
+ }, {
2615
+ valid: boolean;
2616
+ errors?: string[] | undefined;
2617
+ warnings?: string[] | undefined;
2618
+ estimated_cost_usd?: number | undefined;
2619
+ estimated_duration_ms?: number | undefined;
2620
+ }>;
2621
+ type ValidationResult = z.infer<typeof ValidationResultSchema>;
2622
+ interface PipelineResumeRequest {
2623
+ runId: string;
2624
+ fromStepId?: string;
2625
+ }
2626
+ interface PipelineEstimate {
2627
+ totalUsdLow: number;
2628
+ totalUsdHigh: number;
2629
+ perStep: StepEstimate[];
2630
+ warnings: EstimateWarning[];
2631
+ }
2632
+ interface StepEstimate {
2633
+ stepId: string;
2634
+ operation: string;
2635
+ provider: string;
2636
+ modelId: string;
2637
+ usdLow: number;
2638
+ usdHigh: number;
2639
+ estimable: boolean;
2640
+ fallbackUsed?: 'cached-stats' | 'default-bound';
2641
+ }
2642
+ interface EstimateWarning {
2643
+ stepId: string;
2644
+ code: 'no-estimator' | 'variable-output' | 'depends-on-prior-step' | 'router-spread';
2645
+ message: string;
2646
+ }
2647
+ interface VariantResult {
2648
+ variantIndex: number;
2649
+ artifactId?: string;
2650
+ costUsd: number;
2651
+ judgeScore?: number;
2652
+ judgeRationale?: string;
2653
+ winner: boolean;
2654
+ rejected?: 'safety' | 'judge-low' | 'gate-fail' | 'generation-error';
2655
+ generationError?: {
2656
+ code: string;
2657
+ message: string;
2658
+ };
2659
+ }
2660
+ interface VariantsStepOutput {
2661
+ winner?: VariantResult;
2662
+ losers: VariantResult[];
2663
+ totalCostUsd: number;
2664
+ judgeUsdCost: number;
2665
+ }
2666
+ type ContextRef = {
2667
+ kind: 'voice';
2668
+ name: string;
2669
+ } | {
2670
+ kind: 'style';
2671
+ name: string;
2672
+ } | {
2673
+ kind: 'brand';
2674
+ key: string;
2675
+ };
2676
+
2677
+ interface ArtifactRegistryInterface {
2678
+ register(artifact: Omit<Artifact, 'id'>): Artifact;
2679
+ registerWithId(id: string, artifact: Omit<Artifact, 'id'>): Artifact;
2680
+ get(id: string): Artifact | undefined;
2681
+ delete(id: string): boolean;
2682
+ list(): Artifact[];
2683
+ findBySourceStep(stepId: string): Artifact | undefined;
2684
+ clear(): void;
2685
+ }
2686
+ declare class ArtifactRegistry implements ArtifactRegistryInterface {
2687
+ private artifacts;
2688
+ register(artifact: Omit<Artifact, 'id'>): Artifact;
2689
+ registerWithId(id: string, artifact: Omit<Artifact, 'id'>): Artifact;
2690
+ get(id: string): Artifact | undefined;
2691
+ delete(id: string): boolean;
2692
+ list(): Artifact[];
2693
+ findBySourceStep(stepId: string): Artifact | undefined;
2694
+ deleteBySourceStep(stepId: string): number;
2695
+ clear(): void;
2696
+ size(): number;
2697
+ }
2698
+
2699
+ interface QualityGateEvaluator {
2700
+ evaluate(gate: QualityGate, artifact: Artifact): Promise<QualityGateResult>;
2701
+ }
2702
+ declare class ThresholdEvaluator implements QualityGateEvaluator {
2703
+ evaluate(gate: QualityGate, artifact: Artifact): Promise<QualityGateResult>;
2704
+ private getNestedValue;
2705
+ private compare;
2706
+ }
2707
+ declare class DimensionCheckEvaluator implements QualityGateEvaluator {
2708
+ evaluate(gate: QualityGate, artifact: Artifact): Promise<QualityGateResult>;
2709
+ }
2710
+ declare class LLMJudgeEvaluator implements QualityGateEvaluator {
2711
+ private evaluateFn;
2712
+ constructor(evaluateFn: (prompt: string, artifact: Artifact) => Promise<{
2713
+ pass: boolean;
2714
+ reasoning: string;
2715
+ score?: number;
2716
+ }>);
2717
+ evaluate(gate: QualityGate, artifact: Artifact): Promise<QualityGateResult>;
2718
+ }
2719
+ declare class CustomEvaluator implements QualityGateEvaluator {
2720
+ private checkFn;
2721
+ constructor(checkFn: (artifact: Artifact, config: Record<string, unknown>) => boolean | Promise<boolean>);
2722
+ evaluate(gate: QualityGate, artifact: Artifact): Promise<QualityGateResult>;
2723
+ }
2724
+ declare function createQualityGateEvaluator(gate: QualityGate, llmJudgeFn?: (prompt: string, artifact: Artifact) => Promise<{
2725
+ pass: boolean;
2726
+ reasoning: string;
2727
+ score?: number;
2728
+ }>, customCheckFn?: (artifact: Artifact, config: Record<string, unknown>) => boolean | Promise<boolean>): QualityGateEvaluator;
2729
+
2730
+ interface ProviderAvailability {
2731
+ isAvailable(operation: string): boolean;
2732
+ getEstimatedCost(operation: string, config: Record<string, unknown>): number;
2733
+ getEstimatedDuration(operation: string, config: Record<string, unknown>): number;
2734
+ }
2735
+ declare class PipelineValidator {
2736
+ private providerAvailability;
2737
+ constructor(providerAvailability: ProviderAvailability);
2738
+ validate(definition: PipelineDefinition): ValidationResult;
2739
+ private validateReferences;
2740
+ private validateProviders;
2741
+ private validateQualityGates;
2742
+ private validateBudgetConfig;
2743
+ private validateVariantsConfig;
2744
+ private validateRunContext;
2745
+ }
2746
+
2747
+ interface RouteStepParams {
2748
+ route: unknown;
2749
+ operation: string;
2750
+ resolvedInputs: Record<string, unknown>;
2751
+ stepConfig: Record<string, unknown>;
2752
+ pipelineId: string;
2753
+ stepId: string;
2754
+ getProviderByName: (name: string) => Provider | undefined;
2755
+ }
2756
+ type RouteStepFn = (params: RouteStepParams) => Promise<{
2757
+ artifact: Artifact;
2758
+ providerName: string;
2759
+ } | null>;
2760
+ interface VariantsStepParams {
2761
+ variants: unknown;
2762
+ step: PipelineStep;
2763
+ resolvedInputs: Record<string, unknown>;
2764
+ pipelineId: string;
2765
+ stepId: string;
2766
+ }
2767
+ type VariantsStepFn = (params: VariantsStepParams) => Promise<{
2768
+ artifact: Artifact;
2769
+ } | null>;
2770
+ interface RatiosStepParams {
2771
+ ratios: unknown;
2772
+ operation: string;
2773
+ resolvedInputs: Record<string, unknown>;
2774
+ stepConfig: Record<string, unknown>;
2775
+ stepId: string;
2776
+ }
2777
+ type RatiosStepFn = (params: RatiosStepParams) => Promise<{
2778
+ artifact: Artifact;
2779
+ } | null>;
2780
+ interface GateEvalParams {
2781
+ gate: unknown;
2782
+ artifact: Artifact;
2783
+ artifactUri: string;
2784
+ stepId: string;
2785
+ }
2786
+ type GateEvalFn = (params: GateEvalParams) => Promise<{
2787
+ passed: boolean;
2788
+ action: string;
2789
+ resultArtifact?: Artifact;
2790
+ } | null>;
2791
+ interface ContextResolveParams {
2792
+ inputs: Record<string, unknown>;
2793
+ context: RunContext;
2794
+ providerName: string;
2795
+ }
2796
+ type ContextResolveFn = (params: ContextResolveParams) => Record<string, unknown>;
2797
+ interface Provider {
2798
+ readonly name: string;
2799
+ readonly supportedOperations: string[];
2800
+ execute(operation: string, inputs: Record<string, unknown>, config: Record<string, unknown>): Promise<{
2801
+ data?: Buffer | NodeJS.ReadableStream;
2802
+ artifact: Omit<Artifact, 'id' | 'createdAt'>;
2803
+ cost_usd?: number;
2804
+ duration_ms?: number;
2805
+ }>;
2806
+ healthCheck(): Promise<boolean>;
2807
+ /**
2808
+ * F4/F5 estimateCost — optional on the executor's narrow Provider shape because legacy
2809
+ * mock providers may not implement it. Real providers (MediaProvider subclasses) all do.
2810
+ * Returns a CostEstimate-like value the executor uses for budget preflight + dry-run.
2811
+ */
2812
+ estimateCost?(input: {
2813
+ operation: string;
2814
+ params: Record<string, unknown>;
2815
+ config: Record<string, unknown>;
2816
+ }): Promise<{
2817
+ costUsd: number;
2818
+ estimatedDurationMs?: number;
2819
+ }>;
2820
+ }
2821
+ interface PipelineExecutorOptions {
2822
+ providers: Provider[];
2823
+ defaultPipelineTimeoutMs?: number;
2824
+ defaultStepTimeoutMs?: number;
2825
+ llmJudgeFn?: (prompt: string, artifact: Artifact) => Promise<{
2826
+ pass: boolean;
2827
+ reasoning: string;
2828
+ score?: number;
2829
+ }>;
2830
+ customCheckFn?: (artifact: Artifact, config: Record<string, unknown>) => boolean | Promise<boolean>;
2831
+ prepareInputs?: (operation: string, inputs: Record<string, unknown>) => Promise<Record<string, unknown>>;
2832
+ persistArtifact?: (params: {
2833
+ artifactId: string;
2834
+ operation: string;
2835
+ data?: Buffer | NodeJS.ReadableStream;
2836
+ artifact: Omit<Artifact, 'id' | 'createdAt'>;
2837
+ pipelineId: string;
2838
+ stepId: string;
2839
+ }) => Promise<{
2840
+ uri?: string;
2841
+ } | undefined>;
2842
+ onEvent?: (event: PipelineEvent) => void;
2843
+ onCost?: (record: CostRecord) => void;
2844
+ persistence?: PipelineStateStore;
2845
+ ledger?: CostLedger;
2846
+ routeStepFn?: RouteStepFn;
2847
+ variantsStepFn?: VariantsStepFn;
2848
+ ratiosStepFn?: RatiosStepFn;
2849
+ context?: RunContext;
2850
+ contextResolveFn?: ContextResolveFn;
2851
+ gateEvalFn?: GateEvalFn;
2852
+ tenantPolicyEnforceFn?: (provider: string | undefined, model: string | undefined) => void;
2853
+ signProvenance?: (params: {
2854
+ artifactId: string;
2855
+ runId: string;
2856
+ pipelineDefHash: string;
2857
+ stepId: string;
2858
+ operation: string;
2859
+ providerId: string;
2860
+ modelId?: string;
2861
+ /** Upstream artifact ids that fed into this step. Become C2PA ingredients. */
2862
+ ingredientArtifactIds?: string[];
2863
+ }) => Promise<{
2864
+ signedArtifactId: string;
2865
+ manifestUri: string;
2866
+ }>;
2867
+ }
2868
+ declare function createStepStateRecord(stepId: string, status?: StepStateRecord['status']): StepStateRecord;
2869
+ declare class PipelineExecutor {
2870
+ private registry;
2871
+ private providers;
2872
+ private readonly defaultPipelineTimeoutMs;
2873
+ private llmJudgeFn?;
2874
+ private customCheckFn?;
2875
+ private prepareInputs?;
2876
+ private persistArtifact?;
2877
+ private onEvent?;
2878
+ private onCost?;
2879
+ private persistence?;
2880
+ private ledger?;
2881
+ private routeStepFn?;
2882
+ private variantsStepFn?;
2883
+ private ratiosStepFn?;
2884
+ private context?;
2885
+ private contextResolveFn?;
2886
+ private gateEvalFn?;
2887
+ private tenantPolicyEnforceFn?;
2888
+ private signProvenance?;
2889
+ constructor(options: PipelineExecutorOptions);
2890
+ execute(definition: PipelineDefinition, options?: {
2891
+ runId?: string;
2892
+ }): Promise<Pipeline>;
2893
+ resume(runId: string, fromStepId?: string): Promise<Pipeline>;
2894
+ resume(pipeline: Pipeline, action: 'retry' | 'skip' | 'abort'): Promise<Pipeline>;
2895
+ private resumeByRunId;
2896
+ private resumeLegacy;
2897
+ estimate(definition: PipelineDefinition): Promise<PipelineEstimate>;
2898
+ private updateRunState;
2899
+ /**
2900
+ * Estimate the per-step cost band for budget preflight (F4) and dry-run (F5).
2901
+ *
2902
+ * Calls `provider.estimateCost` when available — that's what the spec wants, and
2903
+ * what makes preflight actually enforce caps against real pricing.
2904
+ *
2905
+ * When the provider doesn't implement estimateCost (legacy mocks, certain test fakes),
2906
+ * falls back to a tiny default band so preflight doesn't catastrophically block.
2907
+ * Variable-output ops widen the high band: when max_tokens is present, treat low as
2908
+ * ~30% of max and high as 100% per plan §F5.
2909
+ */
2910
+ private quickEstimateStep;
2911
+ private executeStep;
2912
+ private executeStepOnce;
2913
+ /** Hash the normalized pipeline definition for provenance manifests (F17) and for
2914
+ * PipelineRunRecord auditing. Same canonical-json rule as F2 cache keys. */
2915
+ private hashPipelineDefinition;
2916
+ /** Set inside execute()/resume() before stepping through steps; read by signProvenance. */
2917
+ private currentPipelineDefHash?;
2918
+ private findProviderByName;
2919
+ private resolveInputs;
2920
+ private evaluateQualityGate;
2921
+ private emitEvent;
2922
+ getRegistry(): ArtifactRegistry;
2923
+ }
2924
+
2925
+ interface PipelineEstimatorOptions {
2926
+ ledger?: CostLedger;
2927
+ estimateOperation?: (operation: string, config: Record<string, unknown>) => Promise<{
2928
+ usdLow: number;
2929
+ usdHigh: number;
2930
+ } | null>;
2931
+ }
2932
+ declare class PipelineEstimator {
2933
+ private ledger?;
2934
+ private estimateOperation?;
2935
+ constructor(options?: PipelineEstimatorOptions);
2936
+ estimate(pipeline: PipelineDefinition): Promise<PipelineEstimate>;
2937
+ }
2938
+
2939
+ interface MockProviderConfig {
2940
+ name?: string;
2941
+ operations?: string[];
2942
+ delay?: number;
2943
+ failureRate?: number;
2944
+ baseCost?: number;
2945
+ alwaysPass?: boolean;
2946
+ }
2947
+ declare class MockProvider implements Provider {
2948
+ readonly name: string;
2949
+ readonly supportedOperations: string[];
2950
+ private delay;
2951
+ private failureRate;
2952
+ private baseCost;
2953
+ private alwaysPass;
2954
+ constructor(config?: MockProviderConfig);
2955
+ execute(operation: string, _inputs: Record<string, unknown>, config: Record<string, unknown>): Promise<{
2956
+ data?: Buffer | NodeJS.ReadableStream;
2957
+ artifact: Omit<Artifact, 'id' | 'createdAt'>;
2958
+ cost_usd?: number;
2959
+ duration_ms?: number;
2960
+ }>;
2961
+ healthCheck(): Promise<boolean>;
2962
+ }
2963
+ declare const mockOperations: {
2964
+ readonly generate: "mock.generate";
2965
+ readonly transform: "mock.transform";
2966
+ readonly extract: "mock.extract";
2967
+ readonly imageGenerate: "image.generate";
2968
+ readonly imageUpscale: "image.upscale";
2969
+ readonly imageRemoveBackground: "image.remove_background";
2970
+ readonly audioTts: "audio.tts";
2971
+ readonly audioStt: "audio.stt";
2972
+ };
2973
+
2974
+ type EventHandler<E> = (event: E) => void | Promise<void>;
2975
+ interface EventBus<E extends {
2976
+ kind: string;
2977
+ }> {
2978
+ on<K extends E['kind']>(kind: K, handler: EventHandler<Extract<E, {
2979
+ kind: K;
2980
+ }>>): () => void;
2981
+ emit(event: E): void;
2982
+ await<K extends E['kind']>(kind: K, predicate?: (e: Extract<E, {
2983
+ kind: K;
2984
+ }>) => boolean, timeoutMs?: number): Promise<Extract<E, {
2985
+ kind: K;
2986
+ }>>;
2987
+ }
2988
+ declare function createEventBus<E extends {
2989
+ kind: string;
2990
+ }>(): EventBus<E>;
2991
+
2992
+ declare class A2AError extends Error {
2993
+ code: string;
2994
+ retryable: boolean;
2995
+ constructor(message?: string);
2996
+ }
2997
+ declare class IdempotencyConflictError extends A2AError {
2998
+ reason: 'in-flight' | 'body-mismatch';
2999
+ existingRunId?: string | undefined;
3000
+ code: "IDEMPOTENCY_CONFLICT";
3001
+ retryable: false;
3002
+ constructor(reason: 'in-flight' | 'body-mismatch', existingRunId?: string | undefined);
3003
+ }
3004
+ declare class BudgetExceededError extends A2AError {
3005
+ spentUsd: number;
3006
+ capUsd: number;
3007
+ scope: 'run' | 'tenant-daily' | 'tenant-monthly';
3008
+ code: "BUDGET_EXCEEDED";
3009
+ retryable: false;
3010
+ constructor(spentUsd: number, capUsd: number, scope: 'run' | 'tenant-daily' | 'tenant-monthly');
3011
+ }
3012
+ declare class RunNotFoundError extends A2AError {
3013
+ code: "RUN_NOT_FOUND";
3014
+ retryable: false;
3015
+ constructor();
3016
+ }
3017
+ declare class RunInProgressError extends A2AError {
3018
+ code: "RUN_IN_PROGRESS";
3019
+ retryable: true;
3020
+ constructor();
3021
+ }
3022
+ declare class RunNotResumableError extends A2AError {
3023
+ code: "RUN_NOT_RESUMABLE";
3024
+ retryable: false;
3025
+ constructor();
3026
+ }
3027
+ declare class WebhookSignatureInvalidError extends A2AError {
3028
+ code: "WEBHOOK_SIGNATURE_INVALID";
3029
+ retryable: false;
3030
+ constructor();
3031
+ }
3032
+ declare class WebhookProviderUnknownError extends A2AError {
3033
+ code: "WEBHOOK_PROVIDER_UNKNOWN";
3034
+ retryable: false;
3035
+ constructor();
3036
+ }
3037
+ declare class StateStoreUnavailableError extends A2AError {
3038
+ code: "STATE_STORE_UNAVAILABLE";
3039
+ retryable: true;
3040
+ constructor();
3041
+ }
3042
+ declare class EstimateUnsupportedError extends A2AError {
3043
+ code: "ESTIMATE_UNSUPPORTED";
3044
+ retryable: false;
3045
+ constructor();
3046
+ }
3047
+ declare class ArtifactNotFoundError extends A2AError {
3048
+ code: "ARTIFACT_NOT_FOUND";
3049
+ retryable: false;
3050
+ constructor();
3051
+ }
3052
+ declare class RouterAllCandidatesFailedError extends A2AError {
3053
+ attemptedCandidates: string[];
3054
+ lastError: Error;
3055
+ code: "ROUTER_ALL_CANDIDATES_FAILED";
3056
+ retryable: false;
3057
+ constructor(attemptedCandidates: string[], lastError: Error);
3058
+ }
3059
+ declare class RouterNoCandidatesError extends A2AError {
3060
+ code: "ROUTER_NO_CANDIDATES";
3061
+ retryable: false;
3062
+ constructor();
3063
+ }
3064
+ declare class RouterFastestIneligibleError extends A2AError {
3065
+ code: "ROUTER_FASTEST_INELIGIBLE";
3066
+ retryable: false;
3067
+ constructor();
3068
+ }
3069
+ declare class SafetyGateRejectedError extends A2AError {
3070
+ category: string;
3071
+ score: number;
3072
+ code: "SAFETY_GATE_REJECTED";
3073
+ retryable: false;
3074
+ constructor(category: string, score: number);
3075
+ }
3076
+ declare class TenantNotFoundError extends A2AError {
3077
+ code: "TENANT_NOT_FOUND";
3078
+ retryable: false;
3079
+ constructor();
3080
+ }
3081
+ declare class KeyVaultUnavailableError extends A2AError {
3082
+ code: "KEY_VAULT_UNAVAILABLE";
3083
+ retryable: true;
3084
+ constructor();
3085
+ }
3086
+ declare class FfmpegUnavailableError extends A2AError {
3087
+ code: string;
3088
+ retryable: boolean;
3089
+ }
3090
+ declare class VariantsAllRejectedError extends A2AError {
3091
+ reason: 'safety' | 'judge-low' | 'generation-error' | 'all-failed';
3092
+ code: string;
3093
+ retryable: boolean;
3094
+ constructor(reason: 'safety' | 'judge-low' | 'generation-error' | 'all-failed');
3095
+ }
3096
+ declare class JudgeUnavailableError extends A2AError {
3097
+ code: string;
3098
+ retryable: boolean;
3099
+ }
3100
+ declare class WorkflowNotFoundError extends A2AError {
3101
+ workflowName?: string | undefined;
3102
+ code: string;
3103
+ retryable: boolean;
3104
+ constructor(workflowName?: string | undefined);
3105
+ }
3106
+ declare class WorkflowExpiredError extends A2AError {
3107
+ detail?: string | undefined;
3108
+ code: string;
3109
+ retryable: boolean;
3110
+ constructor(detail?: string | undefined);
3111
+ }
3112
+ declare class ContextRefUnknownError extends A2AError {
3113
+ kind: string;
3114
+ name: string;
3115
+ code: string;
3116
+ retryable: boolean;
3117
+ constructor(kind: string, name: string);
3118
+ }
3119
+ declare class ContextRefTypeError extends A2AError {
3120
+ stepOp: string;
3121
+ refKind: string;
3122
+ code: string;
3123
+ retryable: boolean;
3124
+ constructor(stepOp: string, refKind: string);
3125
+ }
3126
+ declare class LoudnessGateFailedError extends A2AError {
3127
+ code: string;
3128
+ retryable: boolean;
3129
+ }
3130
+ declare class TenantPolicyViolationError extends A2AError {
3131
+ code: string;
3132
+ retryable: boolean;
3133
+ }
3134
+ declare class ProvenanceSigningFailedError extends A2AError {
3135
+ code: string;
3136
+ retryable: boolean;
3137
+ }
3138
+ declare class SafetyProviderUnavailableError extends A2AError {
3139
+ code: string;
3140
+ retryable: boolean;
3141
+ }
3142
+ declare class RatioUnsupportedError extends A2AError {
3143
+ ratio: string;
3144
+ provider: string;
3145
+ code: string;
3146
+ retryable: boolean;
3147
+ constructor(ratio: string, provider: string);
3148
+ }
3149
+ declare class InvalidInputError extends A2AError {
3150
+ reason: string;
3151
+ code: string;
3152
+ retryable: boolean;
3153
+ constructor(reason: string);
3154
+ }
3155
+ declare class FormatUnsupportedError extends A2AError {
3156
+ format: string;
3157
+ operation: string;
3158
+ code: string;
3159
+ retryable: boolean;
3160
+ constructor(format: string, operation: string);
3161
+ }
3162
+ declare class ArtifactAccessDeniedError extends A2AError {
3163
+ code: string;
3164
+ retryable: boolean;
3165
+ }
3166
+ declare class InvalidResourceUriError extends A2AError {
3167
+ uri?: string | undefined;
3168
+ code: string;
3169
+ retryable: boolean;
3170
+ constructor(uri?: string | undefined);
3171
+ }
3172
+
3173
+ export { A2AError, type Artifact, ArtifactAccessDeniedError, type ArtifactMeta, ArtifactMetaSchema, ArtifactNotFoundError, ArtifactRegistry, type ArtifactRegistryInterface, ArtifactSchema, type ArtifactType, ArtifactTypeSchema, type BrandKit, BrandKitSchema, type BudgetConfig, BudgetConfigSchema, BudgetExceededError, type CacheConfig, CacheConfigSchema, type ContextRef, ContextRefSchema, ContextRefTypeError, ContextRefUnknownError, type CostLedger, type CostRecord, CostRecordSchema, type CostSummary, CostSummarySchema, CustomEvaluator, DimensionCheckEvaluator, EstimateUnsupportedError, type EstimateWarning, FfmpegUnavailableError, FormatUnsupportedError, IdempotencyConflictError, InvalidInputError, InvalidResourceUriError, type JudgeConfig, JudgeConfigSchema, type JudgeRubric, JudgeRubricSchema, JudgeUnavailableError, KeyVaultUnavailableError, LLMJudgeEvaluator, LoudnessGateFailedError, MockProvider, type MockProviderConfig, type Pipeline, type PipelineDefinition, PipelineDefinitionSchema, type PipelineEstimate, PipelineEstimator, type PipelineEstimatorOptions, type PipelineEvent, PipelineEventSchema, type PipelineEventType, PipelineEventTypeSchema, PipelineExecutor, type PipelineExecutorOptions, type PipelineResumeRequest, type PipelineRunRecord, PipelineSchema, type PipelineStateStore, type PipelineStatus, PipelineStatusSchema, type PipelineStep, PipelineStepSchema, PipelineValidator, ProvenanceSigningFailedError, type Provider, type ProviderAvailability, type ProviderInput, ProviderInputSchema, type ProviderOutput, ProviderOutputSchema, type QualityGate, type QualityGateAction, QualityGateActionSchema, type QualityGateEvaluator, type QualityGateResult, QualityGateResultSchema, QualityGateSchema, RatioUnsupportedError, RouteCandidateSchema, type RouteConfig, RouteConfigSchema, RouterAllCandidatesFailedError, RouterFastestIneligibleError, RouterNoCandidatesError, type RunContext, RunContextSchema, RunInProgressError, RunNotFoundError, RunNotResumableError, SafetyGateRejectedError, SafetyProviderUnavailableError, StateStoreUnavailableError, type StepEstimate, type StepStateRecord, type StorageResult, StorageResultSchema, type StyleRef, StyleRefSchema, TenantNotFoundError, TenantPolicyViolationError, ThresholdEvaluator, type ValidationResult, ValidationResultSchema, type VariantResult, VariantsAllRejectedError, type VariantsConfig, VariantsConfigSchema, type VariantsStepOutput, type VoiceRef, VoiceRefSchema, WebhookProviderUnknownError, WebhookSignatureInvalidError, WorkflowExpiredError, WorkflowNotFoundError, createEventBus, createQualityGateEvaluator, createStepStateRecord, mockOperations };