fascicle 0.8.1 → 0.8.10

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,856 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/core/flow-schema.json.d.ts
4
+ declare let $schema: string;
5
+ declare let $id: string;
6
+ declare let title: string;
7
+ declare let description: string;
8
+ declare let type: string;
9
+ declare namespace items {
10
+ let $ref: string;
11
+ }
12
+ declare namespace $defs {
13
+ namespace compose_entry {
14
+ let type_1: string;
15
+ export { type_1 as type };
16
+ export let required: string[];
17
+ export namespace properties {
18
+ namespace compose {
19
+ let type_2: string;
20
+ export { type_2 as type };
21
+ }
22
+ }
23
+ export let allOf: {
24
+ $ref: string;
25
+ }[];
26
+ }
27
+ namespace node {
28
+ let type_3: string;
29
+ export { type_3 as type };
30
+ export let anyOf: {
31
+ required: string[];
32
+ }[];
33
+ export namespace properties_1 {
34
+ namespace step {
35
+ let $ref_1: string;
36
+ export { $ref_1 as $ref };
37
+ }
38
+ namespace sequence {
39
+ let $ref_2: string;
40
+ export { $ref_2 as $ref };
41
+ }
42
+ namespace parallel {
43
+ let $ref_3: string;
44
+ export { $ref_3 as $ref };
45
+ }
46
+ namespace branch {
47
+ let $ref_4: string;
48
+ export { $ref_4 as $ref };
49
+ }
50
+ namespace map {
51
+ let $ref_5: string;
52
+ export { $ref_5 as $ref };
53
+ }
54
+ namespace pipe {
55
+ let $ref_6: string;
56
+ export { $ref_6 as $ref };
57
+ }
58
+ namespace retry {
59
+ let $ref_7: string;
60
+ export { $ref_7 as $ref };
61
+ }
62
+ namespace fallback {
63
+ let $ref_8: string;
64
+ export { $ref_8 as $ref };
65
+ }
66
+ namespace timeout {
67
+ let $ref_9: string;
68
+ export { $ref_9 as $ref };
69
+ }
70
+ namespace loop {
71
+ let $ref_10: string;
72
+ export { $ref_10 as $ref };
73
+ }
74
+ namespace compose_node {
75
+ let $ref_11: string;
76
+ export { $ref_11 as $ref };
77
+ }
78
+ namespace adversarial {
79
+ let $ref_12: string;
80
+ export { $ref_12 as $ref };
81
+ }
82
+ namespace ensemble {
83
+ let $ref_13: string;
84
+ export { $ref_13 as $ref };
85
+ }
86
+ namespace tournament {
87
+ let $ref_14: string;
88
+ export { $ref_14 as $ref };
89
+ }
90
+ namespace consensus {
91
+ let $ref_15: string;
92
+ export { $ref_15 as $ref };
93
+ }
94
+ namespace checkpoint {
95
+ let $ref_16: string;
96
+ export { $ref_16 as $ref };
97
+ }
98
+ namespace suspend {
99
+ let $ref_17: string;
100
+ export { $ref_17 as $ref };
101
+ }
102
+ namespace scope {
103
+ let $ref_18: string;
104
+ export { $ref_18 as $ref };
105
+ }
106
+ namespace ref {
107
+ let type_4: string;
108
+ export { type_4 as type };
109
+ }
110
+ }
111
+ export { properties_1 as properties };
112
+ }
113
+ namespace step_config {
114
+ let type_5: string;
115
+ export { type_5 as type };
116
+ let required_1: string[];
117
+ export { required_1 as required };
118
+ export namespace properties_2 {
119
+ namespace id {
120
+ let type_6: string;
121
+ export { type_6 as type };
122
+ }
123
+ namespace fn {
124
+ let type_7: string;
125
+ export { type_7 as type };
126
+ }
127
+ }
128
+ export { properties_2 as properties };
129
+ }
130
+ namespace sequence_config {
131
+ let type_8: string;
132
+ export { type_8 as type };
133
+ export namespace items_1 {
134
+ let $ref_19: string;
135
+ export { $ref_19 as $ref };
136
+ }
137
+ export { items_1 as items };
138
+ }
139
+ namespace parallel_config {
140
+ let type_9: string;
141
+ export { type_9 as type };
142
+ export namespace additionalProperties {
143
+ let $ref_20: string;
144
+ export { $ref_20 as $ref };
145
+ }
146
+ }
147
+ namespace branch_config {
148
+ let type_10: string;
149
+ export { type_10 as type };
150
+ let required_2: string[];
151
+ export { required_2 as required };
152
+ export namespace properties_3 {
153
+ namespace when {
154
+ let type_11: string;
155
+ export { type_11 as type };
156
+ }
157
+ namespace then {
158
+ let $ref_21: string;
159
+ export { $ref_21 as $ref };
160
+ }
161
+ namespace otherwise {
162
+ let $ref_22: string;
163
+ export { $ref_22 as $ref };
164
+ }
165
+ }
166
+ export { properties_3 as properties };
167
+ }
168
+ namespace map_config {
169
+ let type_12: string;
170
+ export { type_12 as type };
171
+ let required_3: string[];
172
+ export { required_3 as required };
173
+ export namespace properties_4 {
174
+ export namespace items_2 {
175
+ let type_13: string;
176
+ export { type_13 as type };
177
+ }
178
+ export { items_2 as items };
179
+ export namespace _do {
180
+ let $ref_23: string;
181
+ export { $ref_23 as $ref };
182
+ }
183
+ export { _do as do };
184
+ export namespace concurrency {
185
+ let type_14: string;
186
+ export { type_14 as type };
187
+ export let minimum: number;
188
+ }
189
+ }
190
+ export { properties_4 as properties };
191
+ }
192
+ namespace pipe_config {
193
+ let type_15: string;
194
+ export { type_15 as type };
195
+ let required_4: string[];
196
+ export { required_4 as required };
197
+ export namespace properties_5 {
198
+ export namespace of {
199
+ let $ref_24: string;
200
+ export { $ref_24 as $ref };
201
+ }
202
+ export namespace fn_1 {
203
+ let type_16: string;
204
+ export { type_16 as type };
205
+ }
206
+ export { fn_1 as fn };
207
+ }
208
+ export { properties_5 as properties };
209
+ }
210
+ namespace retry_config {
211
+ let type_17: string;
212
+ export { type_17 as type };
213
+ let required_5: string[];
214
+ export { required_5 as required };
215
+ export namespace properties_6 {
216
+ export namespace _do_1 {
217
+ let $ref_25: string;
218
+ export { $ref_25 as $ref };
219
+ }
220
+ export { _do_1 as do };
221
+ export namespace max_attempts {
222
+ let type_18: string;
223
+ export { type_18 as type };
224
+ let minimum_1: number;
225
+ export { minimum_1 as minimum };
226
+ }
227
+ export namespace backoff_ms {
228
+ let type_19: string;
229
+ export { type_19 as type };
230
+ let minimum_2: number;
231
+ export { minimum_2 as minimum };
232
+ }
233
+ }
234
+ export { properties_6 as properties };
235
+ }
236
+ namespace fallback_config {
237
+ let type_20: string;
238
+ export { type_20 as type };
239
+ let required_6: string[];
240
+ export { required_6 as required };
241
+ export namespace properties_7 {
242
+ namespace primary {
243
+ let $ref_26: string;
244
+ export { $ref_26 as $ref };
245
+ }
246
+ namespace backup {
247
+ let $ref_27: string;
248
+ export { $ref_27 as $ref };
249
+ }
250
+ }
251
+ export { properties_7 as properties };
252
+ }
253
+ namespace timeout_config {
254
+ let type_21: string;
255
+ export { type_21 as type };
256
+ let required_7: string[];
257
+ export { required_7 as required };
258
+ export namespace properties_8 {
259
+ export namespace _do_2 {
260
+ let $ref_28: string;
261
+ export { $ref_28 as $ref };
262
+ }
263
+ export { _do_2 as do };
264
+ export namespace ms {
265
+ let type_22: string;
266
+ export { type_22 as type };
267
+ let minimum_3: number;
268
+ export { minimum_3 as minimum };
269
+ }
270
+ }
271
+ export { properties_8 as properties };
272
+ }
273
+ namespace compose_node_config {
274
+ let type_23: string;
275
+ export { type_23 as type };
276
+ let required_8: string[];
277
+ export { required_8 as required };
278
+ export namespace properties_9 {
279
+ export namespace name {
280
+ let type_24: string;
281
+ export { type_24 as type };
282
+ export let minLength: number;
283
+ }
284
+ export namespace _do_3 {
285
+ let $ref_29: string;
286
+ export { $ref_29 as $ref };
287
+ }
288
+ export { _do_3 as do };
289
+ }
290
+ export { properties_9 as properties };
291
+ }
292
+ namespace loop_config {
293
+ let type_25: string;
294
+ export { type_25 as type };
295
+ let required_9: string[];
296
+ export { required_9 as required };
297
+ export namespace properties_10 {
298
+ export namespace name_1 {
299
+ let type_26: string;
300
+ export { type_26 as type };
301
+ let minLength_1: number;
302
+ export { minLength_1 as minLength };
303
+ }
304
+ export { name_1 as name };
305
+ export namespace init {
306
+ let type_27: string;
307
+ export { type_27 as type };
308
+ }
309
+ export namespace body {
310
+ let $ref_30: string;
311
+ export { $ref_30 as $ref };
312
+ }
313
+ export namespace guard {
314
+ let $ref_31: string;
315
+ export { $ref_31 as $ref };
316
+ }
317
+ export namespace finish {
318
+ let type_28: string;
319
+ export { type_28 as type };
320
+ }
321
+ export namespace max_rounds {
322
+ let type_29: string;
323
+ export { type_29 as type };
324
+ let minimum_4: number;
325
+ export { minimum_4 as minimum };
326
+ }
327
+ }
328
+ export { properties_10 as properties };
329
+ }
330
+ namespace adversarial_config {
331
+ let type_30: string;
332
+ export { type_30 as type };
333
+ let required_10: string[];
334
+ export { required_10 as required };
335
+ export namespace properties_11 {
336
+ export namespace build {
337
+ let $ref_32: string;
338
+ export { $ref_32 as $ref };
339
+ }
340
+ export namespace critique {
341
+ let $ref_33: string;
342
+ export { $ref_33 as $ref };
343
+ }
344
+ export namespace accept {
345
+ let type_31: string;
346
+ export { type_31 as type };
347
+ }
348
+ export namespace max_rounds_1 {
349
+ let type_32: string;
350
+ export { type_32 as type };
351
+ let minimum_5: number;
352
+ export { minimum_5 as minimum };
353
+ }
354
+ export { max_rounds_1 as max_rounds };
355
+ }
356
+ export { properties_11 as properties };
357
+ }
358
+ namespace ensemble_config {
359
+ let type_33: string;
360
+ export { type_33 as type };
361
+ let required_11: string[];
362
+ export { required_11 as required };
363
+ export namespace properties_12 {
364
+ namespace members {
365
+ let type_34: string;
366
+ export { type_34 as type };
367
+ export namespace additionalProperties_1 {
368
+ let $ref_34: string;
369
+ export { $ref_34 as $ref };
370
+ }
371
+ export { additionalProperties_1 as additionalProperties };
372
+ }
373
+ namespace score {
374
+ let type_35: string;
375
+ export { type_35 as type };
376
+ }
377
+ namespace select {
378
+ let type_36: string;
379
+ export { type_36 as type };
380
+ let _enum: string[];
381
+ export { _enum as enum };
382
+ }
383
+ }
384
+ export { properties_12 as properties };
385
+ }
386
+ namespace tournament_config {
387
+ let type_37: string;
388
+ export { type_37 as type };
389
+ let required_12: string[];
390
+ export { required_12 as required };
391
+ export namespace properties_13 {
392
+ export namespace members_1 {
393
+ let type_38: string;
394
+ export { type_38 as type };
395
+ export namespace additionalProperties_2 {
396
+ let $ref_35: string;
397
+ export { $ref_35 as $ref };
398
+ }
399
+ export { additionalProperties_2 as additionalProperties };
400
+ }
401
+ export { members_1 as members };
402
+ export namespace compare {
403
+ let type_39: string;
404
+ export { type_39 as type };
405
+ }
406
+ }
407
+ export { properties_13 as properties };
408
+ }
409
+ namespace consensus_config {
410
+ let type_40: string;
411
+ export { type_40 as type };
412
+ let required_13: string[];
413
+ export { required_13 as required };
414
+ export namespace properties_14 {
415
+ export namespace members_2 {
416
+ let type_41: string;
417
+ export { type_41 as type };
418
+ export namespace additionalProperties_3 {
419
+ let $ref_36: string;
420
+ export { $ref_36 as $ref };
421
+ }
422
+ export { additionalProperties_3 as additionalProperties };
423
+ }
424
+ export { members_2 as members };
425
+ export namespace agree {
426
+ let type_42: string;
427
+ export { type_42 as type };
428
+ }
429
+ export namespace max_rounds_2 {
430
+ let type_43: string;
431
+ export { type_43 as type };
432
+ let minimum_6: number;
433
+ export { minimum_6 as minimum };
434
+ }
435
+ export { max_rounds_2 as max_rounds };
436
+ }
437
+ export { properties_14 as properties };
438
+ }
439
+ namespace checkpoint_config {
440
+ let type_44: string;
441
+ export { type_44 as type };
442
+ let required_14: string[];
443
+ export { required_14 as required };
444
+ export namespace properties_15 {
445
+ export namespace _do_4 {
446
+ let $ref_37: string;
447
+ export { $ref_37 as $ref };
448
+ }
449
+ export { _do_4 as do };
450
+ export namespace key {
451
+ let type_45: string;
452
+ export { type_45 as type };
453
+ }
454
+ }
455
+ export { properties_15 as properties };
456
+ }
457
+ namespace suspend_config {
458
+ let type_46: string;
459
+ export { type_46 as type };
460
+ let required_15: string[];
461
+ export { required_15 as required };
462
+ export namespace properties_16 {
463
+ export namespace id_1 {
464
+ let type_47: string;
465
+ export { type_47 as type };
466
+ }
467
+ export { id_1 as id };
468
+ export namespace on {
469
+ let type_48: string;
470
+ export { type_48 as type };
471
+ }
472
+ export namespace resume_schema {
473
+ let type_49: string;
474
+ export { type_49 as type };
475
+ }
476
+ export namespace combine {
477
+ let type_50: string;
478
+ export { type_50 as type };
479
+ }
480
+ }
481
+ export { properties_16 as properties };
482
+ }
483
+ namespace scope_config {
484
+ let type_51: string;
485
+ export { type_51 as type };
486
+ export namespace items_3 {
487
+ let $ref_38: string;
488
+ export { $ref_38 as $ref };
489
+ }
490
+ export { items_3 as items };
491
+ }
492
+ namespace scope_entry {
493
+ let type_52: string;
494
+ export { type_52 as type };
495
+ export let oneOf: ({
496
+ type: string;
497
+ required: string[];
498
+ properties: {
499
+ stash: {
500
+ type: string;
501
+ };
502
+ do: {
503
+ $ref: string;
504
+ };
505
+ use?: never;
506
+ };
507
+ } | {
508
+ type: string;
509
+ required: string[];
510
+ properties: {
511
+ use: {
512
+ type: string;
513
+ items: {
514
+ type: string;
515
+ };
516
+ };
517
+ do: {
518
+ $ref: string;
519
+ };
520
+ stash?: never;
521
+ };
522
+ })[];
523
+ }
524
+ }
525
+ declare namespace __json_default_export {
526
+ export { $schema, $id, title, description, type, items, $defs };
527
+ }
528
+ //#endregion
529
+ //#region src/core/types.d.ts
530
+ /**
531
+ * Shared type surface for the composition layer.
532
+ *
533
+ * These types are the public value contract between composers, the runner,
534
+ * and adapter packages (observability, stores,
535
+ * engine). Adapter packages import types from here; nothing in
536
+ * this file imports from any adapter.
537
+ *
538
+ * Type aliases and interfaces use PascalCase per constraints.md §2.
539
+ * Value-level identifiers (field names, function parameter names) remain
540
+ * snake_case; those are the value contract, not the type contract.
541
+ */
542
+ type TrajectoryEvent = {
543
+ readonly kind: string;
544
+ readonly span_id?: string | undefined;
545
+ readonly ts?: number | undefined;
546
+ readonly [key: string]: unknown;
547
+ };
548
+ type TrajectoryLogger = {
549
+ readonly record: (event: TrajectoryEvent) => void;
550
+ readonly start_span: (name: string, meta?: Record<string, unknown>) => string;
551
+ readonly end_span: (id: string, meta?: Record<string, unknown>) => void;
552
+ };
553
+ type CheckpointStore = {
554
+ readonly get: (key: string) => Promise<unknown>;
555
+ readonly set: (key: string, value: unknown) => Promise<void>;
556
+ readonly delete: (key: string) => Promise<void>;
557
+ };
558
+ type CleanupFn = () => Promise<void> | void;
559
+ type RunContext = {
560
+ readonly run_id: string;
561
+ readonly trajectory: TrajectoryLogger;
562
+ readonly state: ReadonlyMap<string, unknown>;
563
+ readonly parent_span_id?: string | undefined;
564
+ readonly abort: AbortSignal;
565
+ readonly emit: (event: Record<string, unknown>) => void;
566
+ readonly on_cleanup: (fn: CleanupFn) => void;
567
+ readonly checkpoint_store?: CheckpointStore | undefined;
568
+ readonly resume_data?: Readonly<Record<string, unknown>> | undefined;
569
+ readonly streaming: boolean;
570
+ };
571
+ type StepFn<i, o> = (input: i, ctx: RunContext) => Promise<o> | o;
572
+ type StepMetadata = {
573
+ readonly display_name?: string;
574
+ readonly description?: string;
575
+ readonly port_labels?: Readonly<{
576
+ readonly in?: string;
577
+ readonly out?: string;
578
+ }>;
579
+ };
580
+ type Step<i, o> = {
581
+ readonly id: string;
582
+ readonly kind: string;
583
+ run(input: i, ctx: RunContext): Promise<o> | o;
584
+ readonly config?: Readonly<Record<string, unknown>>;
585
+ readonly children?: ReadonlyArray<Step<unknown, unknown>>;
586
+ readonly anonymous?: boolean;
587
+ readonly meta?: StepMetadata;
588
+ };
589
+ //#endregion
590
+ //#region src/core/runner.d.ts
591
+ type RunOptions = {
592
+ readonly install_signal_handlers?: boolean;
593
+ readonly trajectory?: TrajectoryLogger;
594
+ readonly checkpoint_store?: CheckpointStore;
595
+ readonly resume_data?: Readonly<Record<string, unknown>>;
596
+ readonly abort?: AbortSignal;
597
+ };
598
+ type StreamingRunHandle<o> = {
599
+ readonly events: AsyncIterable<TrajectoryEvent>;
600
+ readonly result: Promise<o>;
601
+ };
602
+ declare function run_impl<i, o>(flow: Step<i, o>, input: i, options?: RunOptions): Promise<o>;
603
+ declare function run_stream<i, o>(flow: Step<i, o>, input: i, options?: RunOptions): StreamingRunHandle<o>;
604
+ declare const run: typeof run_impl & {
605
+ stream: typeof run_stream;
606
+ };
607
+ //#endregion
608
+ //#region src/core/step.d.ts
609
+ declare function step<i, o>(id: string, fn: StepFn<i, o>, meta?: StepMetadata): Step<i, o>;
610
+ declare function step<i, o>(fn: StepFn<i, o>): Step<i, o>;
611
+ //#endregion
612
+ //#region src/core/describe.d.ts
613
+ type FlowValue = string | number | boolean | null | ReadonlyArray<FlowValue> | Readonly<{
614
+ [key: string]: FlowValue;
615
+ }> | {
616
+ readonly kind: '<fn>';
617
+ readonly name?: string;
618
+ } | {
619
+ readonly kind: '<schema>';
620
+ } | {
621
+ readonly kind: string;
622
+ readonly id: string;
623
+ };
624
+ type FlowNode = {
625
+ readonly kind: string;
626
+ readonly id: string;
627
+ readonly config?: Readonly<{
628
+ [key: string]: FlowValue;
629
+ }>;
630
+ readonly children?: ReadonlyArray<FlowNode>;
631
+ readonly meta?: StepMetadata;
632
+ };
633
+ type DescribeOptions = {
634
+ readonly strict?: boolean;
635
+ };
636
+ declare const describe: {
637
+ <i, o>(root: Step<i, o>, options?: DescribeOptions): string;
638
+ json: <i, o>(root: Step<i, o>, options?: DescribeOptions) => FlowNode;
639
+ };
640
+ //#endregion
641
+ //#region src/core/sequence.d.ts
642
+ type AnyStep$2 = Step<unknown, unknown>;
643
+ type FirstInput<children> = children extends readonly [Step<infer i, unknown>, ...unknown[]] ? i : unknown;
644
+ type LastOutput$1<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
645
+ type SequenceOptions = {
646
+ readonly name?: string;
647
+ };
648
+ declare function sequence<const children extends readonly AnyStep$2[]>(children: children, options?: SequenceOptions): Step<FirstInput<children>, LastOutput$1<children>>;
649
+ //#endregion
650
+ //#region src/core/parallel.d.ts
651
+ type AnyStep$1 = Step<unknown, unknown>;
652
+ type OutputOf<s> = s extends Step<unknown, infer o> ? o : unknown;
653
+ type ParallelOutputs<children extends Record<string, AnyStep$1>> = { [k in keyof children]: OutputOf<children[k]> };
654
+ type ParallelOptions = {
655
+ readonly name?: string;
656
+ };
657
+ declare function parallel<i, children extends Record<string, Step<i, unknown>>>(members: children, options?: ParallelOptions): Step<i, ParallelOutputs<children>>;
658
+ //#endregion
659
+ //#region src/core/branch.d.ts
660
+ type BranchConfig<i, o> = {
661
+ readonly name?: string;
662
+ readonly when: (input: i) => boolean | Promise<boolean>;
663
+ readonly then: Step<i, o>;
664
+ readonly otherwise: Step<i, o>;
665
+ };
666
+ declare function branch<i, o>(config: BranchConfig<i, o>): Step<i, o>;
667
+ //#endregion
668
+ //#region src/core/map.d.ts
669
+ type MapConfig<input, item, result> = {
670
+ readonly name?: string;
671
+ readonly items: (input: input) => ReadonlyArray<item> | Promise<ReadonlyArray<item>>;
672
+ readonly do: Step<item, result>;
673
+ readonly concurrency?: number;
674
+ };
675
+ declare function map<input, item, result>(config: MapConfig<input, item, result>): Step<input, result[]>;
676
+ //#endregion
677
+ //#region src/core/pipe.d.ts
678
+ type PipeOptions = {
679
+ readonly name?: string;
680
+ };
681
+ declare function pipe<i, a, b>(inner: Step<i, a>, fn: (value: a) => b | Promise<b>, options?: PipeOptions): Step<i, b>;
682
+ //#endregion
683
+ //#region src/core/retry.d.ts
684
+ type RetryConfig = {
685
+ readonly name?: string;
686
+ readonly max_attempts: number;
687
+ readonly backoff_ms?: number;
688
+ readonly on_error?: (err: unknown, attempt: number) => void;
689
+ };
690
+ declare function retry<i, o>(inner: Step<i, o>, config: RetryConfig): Step<i, o>;
691
+ //#endregion
692
+ //#region src/core/fallback.d.ts
693
+ type FallbackOptions = {
694
+ readonly name?: string;
695
+ };
696
+ declare function fallback<i, o>(primary: Step<i, o>, backup: Step<i, o>, options?: FallbackOptions): Step<i, o>;
697
+ //#endregion
698
+ //#region src/core/timeout.d.ts
699
+ type TimeoutOptions = {
700
+ readonly name?: string;
701
+ };
702
+ declare function timeout<i, o>(inner: Step<i, o>, ms: number, options?: TimeoutOptions): Step<i, o>;
703
+ //#endregion
704
+ //#region src/core/loop.d.ts
705
+ type LoopGuardResult<state> = {
706
+ readonly stop: boolean;
707
+ readonly state: state;
708
+ };
709
+ type LoopConfig<i, state, o> = {
710
+ readonly name?: string;
711
+ readonly init: (input: i) => state;
712
+ readonly body: Step<state, state>;
713
+ readonly guard?: Step<state, LoopGuardResult<state>>;
714
+ readonly finish: (state: state, round: number) => o;
715
+ readonly max_rounds: number;
716
+ };
717
+ type LoopResult<o> = {
718
+ readonly value: o;
719
+ readonly converged: boolean;
720
+ readonly rounds: number;
721
+ };
722
+ declare function loop<i, state, o>(config: LoopConfig<i, state, o>): Step<i, LoopResult<o>>;
723
+ //#endregion
724
+ //#region src/core/compose.d.ts
725
+ declare function compose<i, o>(name: string, inner: Step<i, o>): Step<i, o>;
726
+ //#endregion
727
+ //#region src/core/checkpoint.d.ts
728
+ type CheckpointConfig<i> = {
729
+ readonly name?: string;
730
+ readonly key: string | ((input: i) => string);
731
+ };
732
+ declare function checkpoint<i, o>(inner: Step<i, o>, config: CheckpointConfig<i>): Step<i, o>;
733
+ //#endregion
734
+ //#region src/core/suspend.d.ts
735
+ type SuspendConfig<i, o, resume> = {
736
+ readonly id: string;
737
+ readonly name?: string;
738
+ readonly on: (input: i, ctx: RunContext) => Promise<void> | void;
739
+ readonly resume_schema: z.ZodType<resume>;
740
+ readonly combine: (input: i, resume: resume, ctx: RunContext) => Promise<o> | o | Step<unknown, o>;
741
+ };
742
+ declare function suspend<i, o, resume>(config: SuspendConfig<i, o, resume>): Step<i, o>;
743
+ //#endregion
744
+ //#region src/core/scope.d.ts
745
+ type AnyStep = Step<unknown, unknown>;
746
+ type LastOutput<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
747
+ type ScopeOptions = {
748
+ readonly name?: string;
749
+ };
750
+ type StashOptions = {
751
+ readonly name?: string;
752
+ };
753
+ type UseOptions = {
754
+ readonly name?: string;
755
+ };
756
+ declare function scope<const children extends readonly AnyStep[]>(children: children, options?: ScopeOptions): Step<unknown, LastOutput<children>>;
757
+ declare function stash<i, v>(key: string, source: Step<i, v>, options?: StashOptions): Step<i, v>;
758
+ declare function use<const keys extends readonly string[], i, o>(keys: keys, fn: (state: { [k in keys[number]]: unknown }, input: i, ctx: RunContext) => Promise<o> | o, options?: UseOptions): Step<i, o>;
759
+ //#endregion
760
+ //#region src/core/errors.d.ts
761
+ /**
762
+ * Typed errors for the composition layer.
763
+ *
764
+ * This is the only source file in packages/core/src/ that uses the `class`
765
+ * keyword. `Error` is a built-in and `instanceof` branching is how composers
766
+ * like `retry` and `fallback` distinguish failure modes. See constraints.md §2.
767
+ */
768
+ declare class timeout_error extends Error {
769
+ readonly kind: "timeout_error";
770
+ readonly timeout_ms: number;
771
+ constructor(message: string, timeout_ms: number);
772
+ }
773
+ declare class suspended_error extends Error {
774
+ readonly kind: "suspended_error";
775
+ readonly suspend_id: string;
776
+ readonly payload: unknown;
777
+ constructor(suspend_id: string, payload: unknown, message?: string);
778
+ }
779
+ declare class resume_validation_error extends Error {
780
+ readonly kind: "resume_validation_error";
781
+ readonly issues: unknown;
782
+ constructor(message: string, issues: unknown);
783
+ }
784
+ declare class describe_cycle_error extends Error {
785
+ readonly kind: "describe_cycle_error";
786
+ readonly step_id: string;
787
+ constructor(step_id: string, message?: string);
788
+ }
789
+ declare class aborted_error extends Error {
790
+ readonly kind: "aborted_error";
791
+ readonly reason?: unknown;
792
+ readonly step_index: number;
793
+ readonly tool_call_in_flight?: {
794
+ id: string;
795
+ name: string;
796
+ };
797
+ constructor(message?: string, metadata?: {
798
+ reason?: unknown;
799
+ step_index?: number;
800
+ tool_call_in_flight?: {
801
+ id: string;
802
+ name: string;
803
+ };
804
+ });
805
+ }
806
+ //#endregion
807
+ //#region src/core/step_kinds.d.ts
808
+ /**
809
+ * Closed registry of every `Step.kind` produced by the composition layer.
810
+ *
811
+ * Studio (and any other consumer that needs to enumerate primitives — palette,
812
+ * docs, code generation) can rely on this being the exhaustive set. New
813
+ * primitives must add their kind here. The `step_kinds_cover_runner` contract
814
+ * test in `step_kinds.test.ts` asserts every dispatch handler corresponds to a
815
+ * kind listed here.
816
+ */
817
+ declare const STEP_KINDS: readonly ["step", "sequence", "parallel", "branch", "map", "pipe", "retry", "fallback", "timeout", "loop", "compose", "adversarial", "ensemble", "tournament", "consensus", "checkpoint", "suspend", "scope", "stash", "use"];
818
+ type StepKind = (typeof STEP_KINDS)[number];
819
+ declare function is_step_kind(value: unknown): value is StepKind;
820
+ //#endregion
821
+ //#region src/core/trajectory.d.ts
822
+ declare const span_start_event_schema: z.ZodObject<{
823
+ kind: z.ZodLiteral<"span_start">;
824
+ span_id: z.ZodString;
825
+ name: z.ZodString;
826
+ }, z.core.$loose>;
827
+ declare const span_end_event_schema: z.ZodObject<{
828
+ kind: z.ZodLiteral<"span_end">;
829
+ span_id: z.ZodString;
830
+ }, z.core.$loose>;
831
+ declare const emit_event_schema: z.ZodObject<{
832
+ kind: z.ZodLiteral<"emit">;
833
+ }, z.core.$loose>;
834
+ declare const custom_event_schema: z.ZodObject<{
835
+ kind: z.ZodString;
836
+ }, z.core.$loose>;
837
+ declare const trajectory_event_schema: z.ZodUnion<readonly [z.ZodObject<{
838
+ kind: z.ZodLiteral<"span_start">;
839
+ span_id: z.ZodString;
840
+ name: z.ZodString;
841
+ }, z.core.$loose>, z.ZodObject<{
842
+ kind: z.ZodLiteral<"span_end">;
843
+ span_id: z.ZodString;
844
+ }, z.core.$loose>, z.ZodObject<{
845
+ kind: z.ZodLiteral<"emit">;
846
+ }, z.core.$loose>, z.ZodObject<{
847
+ kind: z.ZodString;
848
+ }, z.core.$loose>]>;
849
+ type SpanStartEvent = z.infer<typeof span_start_event_schema>;
850
+ type SpanEndEvent = z.infer<typeof span_end_event_schema>;
851
+ type EmitEvent = z.infer<typeof emit_event_schema>;
852
+ type CustomTrajectoryEvent = z.infer<typeof custom_event_schema>;
853
+ type ParsedTrajectoryEvent = z.infer<typeof trajectory_event_schema>;
854
+ //#endregion
855
+ export { fallback as A, describe as B, checkpoint as C, LoopResult as D, LoopGuardResult as E, parallel as F, Step as G, run as H, sequence as I, TrajectoryLogger as J, StepMetadata as K, DescribeOptions as L, pipe as M, map as N, loop as O, branch as P, FlowNode as R, suspend as S, LoopConfig as T, CheckpointStore as U, step as V, RunContext as W, __json_default_export as Y, suspended_error as _, SpanStartEvent as a, stash as b, span_end_event_schema as c, STEP_KINDS as d, StepKind as f, resume_validation_error as g, describe_cycle_error as h, SpanEndEvent as i, retry as j, timeout as k, span_start_event_schema as l, aborted_error as m, EmitEvent as n, custom_event_schema as o, is_step_kind as p, TrajectoryEvent as q, ParsedTrajectoryEvent as r, emit_event_schema as s, CustomTrajectoryEvent as t, trajectory_event_schema as u, timeout_error as v, compose as w, use as x, scope as y, FlowValue as z };
856
+ //# sourceMappingURL=index-CEj6hY9z.d.ts.map