fascicle 0.1.13 → 0.3.8
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.
- package/CHANGELOG.md +119 -1
- package/README.md +107 -167
- package/dist/bin/fascicle-viewer.js +9 -0
- package/dist/index.d.ts +474 -69
- package/dist/index.js +2263 -548
- package/dist/index.js.map +1 -1
- package/dist/static/viewer.html +374 -0
- package/package.json +9 -3
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,14 @@ type RunContext = {
|
|
|
42
42
|
readonly streaming: boolean;
|
|
43
43
|
};
|
|
44
44
|
type StepFn<i, o> = (input: i, ctx: RunContext) => Promise<o> | o;
|
|
45
|
+
type StepMetadata = {
|
|
46
|
+
readonly display_name?: string;
|
|
47
|
+
readonly description?: string;
|
|
48
|
+
readonly port_labels?: Readonly<{
|
|
49
|
+
readonly in?: string;
|
|
50
|
+
readonly out?: string;
|
|
51
|
+
}>;
|
|
52
|
+
};
|
|
45
53
|
type Step<i, o> = {
|
|
46
54
|
readonly id: string;
|
|
47
55
|
readonly kind: string;
|
|
@@ -49,6 +57,7 @@ type Step<i, o> = {
|
|
|
49
57
|
readonly config?: Readonly<Record<string, unknown>>;
|
|
50
58
|
readonly children?: ReadonlyArray<Step<unknown, unknown>>;
|
|
51
59
|
readonly anonymous?: boolean;
|
|
60
|
+
readonly meta?: StepMetadata;
|
|
52
61
|
};
|
|
53
62
|
//#endregion
|
|
54
63
|
//#region packages/core/src/runner.d.ts
|
|
@@ -69,7 +78,7 @@ declare const run: typeof run_impl & {
|
|
|
69
78
|
};
|
|
70
79
|
//#endregion
|
|
71
80
|
//#region packages/core/src/step.d.ts
|
|
72
|
-
declare function step<i, o>(id: string, fn: StepFn<i, o
|
|
81
|
+
declare function step<i, o>(id: string, fn: StepFn<i, o>, meta?: StepMetadata): Step<i, o>;
|
|
73
82
|
declare function step<i, o>(fn: StepFn<i, o>): Step<i, o>;
|
|
74
83
|
//#endregion
|
|
75
84
|
//#region packages/core/src/describe.d.ts
|
|
@@ -91,6 +100,7 @@ type FlowNode = {
|
|
|
91
100
|
[key: string]: FlowValue;
|
|
92
101
|
}>;
|
|
93
102
|
readonly children?: ReadonlyArray<FlowNode>;
|
|
103
|
+
readonly meta?: StepMetadata;
|
|
94
104
|
};
|
|
95
105
|
type DescribeOptions = {
|
|
96
106
|
readonly strict?: boolean;
|
|
@@ -104,16 +114,23 @@ declare const describe: {
|
|
|
104
114
|
type AnyStep$2 = Step<unknown, unknown>;
|
|
105
115
|
type FirstInput<children> = children extends readonly [Step<infer i, unknown>, ...unknown[]] ? i : unknown;
|
|
106
116
|
type LastOutput$1<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
|
|
107
|
-
|
|
117
|
+
type SequenceOptions = {
|
|
118
|
+
readonly name?: string;
|
|
119
|
+
};
|
|
120
|
+
declare function sequence<const children extends readonly AnyStep$2[]>(children: children, options?: SequenceOptions): Step<FirstInput<children>, LastOutput$1<children>>;
|
|
108
121
|
//#endregion
|
|
109
122
|
//#region packages/core/src/parallel.d.ts
|
|
110
123
|
type AnyStep$1 = Step<unknown, unknown>;
|
|
111
124
|
type OutputOf<s> = s extends Step<unknown, infer o> ? o : unknown;
|
|
112
125
|
type ParallelOutputs<children extends Record<string, AnyStep$1>> = { [k in keyof children]: OutputOf<children[k]> };
|
|
113
|
-
|
|
126
|
+
type ParallelOptions = {
|
|
127
|
+
readonly name?: string;
|
|
128
|
+
};
|
|
129
|
+
declare function parallel<i, children extends Record<string, Step<i, unknown>>>(members: children, options?: ParallelOptions): Step<i, ParallelOutputs<children>>;
|
|
114
130
|
//#endregion
|
|
115
131
|
//#region packages/core/src/branch.d.ts
|
|
116
132
|
type BranchConfig<i, o> = {
|
|
133
|
+
readonly name?: string;
|
|
117
134
|
readonly when: (input: i) => boolean | Promise<boolean>;
|
|
118
135
|
readonly then: Step<i, o>;
|
|
119
136
|
readonly otherwise: Step<i, o>;
|
|
@@ -122,6 +139,7 @@ declare function branch<i, o>(config: BranchConfig<i, o>): Step<i, o>;
|
|
|
122
139
|
//#endregion
|
|
123
140
|
//#region packages/core/src/map.d.ts
|
|
124
141
|
type MapConfig<input, item, result> = {
|
|
142
|
+
readonly name?: string;
|
|
125
143
|
readonly items: (input: input) => ReadonlyArray<item> | Promise<ReadonlyArray<item>>;
|
|
126
144
|
readonly do: Step<item, result>;
|
|
127
145
|
readonly concurrency?: number;
|
|
@@ -129,10 +147,14 @@ type MapConfig<input, item, result> = {
|
|
|
129
147
|
declare function map<input, item, result>(config: MapConfig<input, item, result>): Step<input, result[]>;
|
|
130
148
|
//#endregion
|
|
131
149
|
//#region packages/core/src/pipe.d.ts
|
|
132
|
-
|
|
150
|
+
type PipeOptions = {
|
|
151
|
+
readonly name?: string;
|
|
152
|
+
};
|
|
153
|
+
declare function pipe<i, a, b>(inner: Step<i, a>, fn: (value: a) => b | Promise<b>, options?: PipeOptions): Step<i, b>;
|
|
133
154
|
//#endregion
|
|
134
155
|
//#region packages/core/src/retry.d.ts
|
|
135
156
|
type RetryConfig = {
|
|
157
|
+
readonly name?: string;
|
|
136
158
|
readonly max_attempts: number;
|
|
137
159
|
readonly backoff_ms?: number;
|
|
138
160
|
readonly on_error?: (err: unknown, attempt: number) => void;
|
|
@@ -140,76 +162,43 @@ type RetryConfig = {
|
|
|
140
162
|
declare function retry<i, o>(inner: Step<i, o>, config: RetryConfig): Step<i, o>;
|
|
141
163
|
//#endregion
|
|
142
164
|
//#region packages/core/src/fallback.d.ts
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
//#region packages/core/src/timeout.d.ts
|
|
146
|
-
declare function timeout<i, o>(inner: Step<i, o>, ms: number): Step<i, o>;
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region packages/core/src/adversarial.d.ts
|
|
149
|
-
type AdversarialBuildInput<input, candidate> = {
|
|
150
|
-
readonly input: input;
|
|
151
|
-
readonly prior?: candidate;
|
|
152
|
-
readonly critique?: string;
|
|
153
|
-
};
|
|
154
|
-
type AdversarialCritiqueResult = {
|
|
155
|
-
readonly notes: string;
|
|
156
|
-
} & Record<string, unknown>;
|
|
157
|
-
type AdversarialResult<candidate> = {
|
|
158
|
-
readonly candidate: candidate;
|
|
159
|
-
readonly converged: boolean;
|
|
160
|
-
readonly rounds: number;
|
|
161
|
-
};
|
|
162
|
-
type AdversarialConfig<input, candidate> = {
|
|
163
|
-
readonly build: Step<AdversarialBuildInput<input, candidate>, candidate>;
|
|
164
|
-
readonly critique: Step<candidate, AdversarialCritiqueResult>;
|
|
165
|
-
readonly accept: (critique_result: AdversarialCritiqueResult) => boolean;
|
|
166
|
-
readonly max_rounds: number;
|
|
165
|
+
type FallbackOptions = {
|
|
166
|
+
readonly name?: string;
|
|
167
167
|
};
|
|
168
|
-
declare function
|
|
168
|
+
declare function fallback<i, o>(primary: Step<i, o>, backup: Step<i, o>, options?: FallbackOptions): Step<i, o>;
|
|
169
169
|
//#endregion
|
|
170
|
-
//#region packages/core/src/
|
|
171
|
-
type
|
|
172
|
-
readonly
|
|
173
|
-
readonly score: (result: o, member_id: string) => number | Promise<number>;
|
|
174
|
-
readonly select?: 'max' | 'min';
|
|
175
|
-
};
|
|
176
|
-
type EnsembleResult<o> = {
|
|
177
|
-
readonly winner: o;
|
|
178
|
-
readonly scores: Record<string, number>;
|
|
170
|
+
//#region packages/core/src/timeout.d.ts
|
|
171
|
+
type TimeoutOptions = {
|
|
172
|
+
readonly name?: string;
|
|
179
173
|
};
|
|
180
|
-
declare function
|
|
174
|
+
declare function timeout<i, o>(inner: Step<i, o>, ms: number, options?: TimeoutOptions): Step<i, o>;
|
|
181
175
|
//#endregion
|
|
182
|
-
//#region packages/core/src/
|
|
183
|
-
type
|
|
184
|
-
readonly
|
|
185
|
-
readonly
|
|
186
|
-
readonly b_id: string;
|
|
187
|
-
readonly winner_id: string;
|
|
188
|
-
};
|
|
189
|
-
type TournamentConfig<i, o> = {
|
|
190
|
-
readonly members: Record<string, Step<i, o>>;
|
|
191
|
-
readonly compare: (a: o, b: o) => Promise<'a' | 'b'> | 'a' | 'b';
|
|
176
|
+
//#region packages/core/src/loop.d.ts
|
|
177
|
+
type LoopGuardResult<state> = {
|
|
178
|
+
readonly stop: boolean;
|
|
179
|
+
readonly state: state;
|
|
192
180
|
};
|
|
193
|
-
type
|
|
194
|
-
readonly
|
|
195
|
-
readonly
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
//#region packages/core/src/consensus.d.ts
|
|
200
|
-
type ConsensusConfig<i, o> = {
|
|
201
|
-
readonly members: Record<string, Step<i, o>>;
|
|
202
|
-
readonly agree: (results: Record<string, o>) => boolean;
|
|
181
|
+
type LoopConfig<i, state, o> = {
|
|
182
|
+
readonly name?: string;
|
|
183
|
+
readonly init: (input: i) => state;
|
|
184
|
+
readonly body: Step<state, state>;
|
|
185
|
+
readonly guard?: Step<state, LoopGuardResult<state>>;
|
|
186
|
+
readonly finish: (state: state, round: number) => o;
|
|
203
187
|
readonly max_rounds: number;
|
|
204
188
|
};
|
|
205
|
-
type
|
|
206
|
-
readonly
|
|
189
|
+
type LoopResult<o> = {
|
|
190
|
+
readonly value: o;
|
|
207
191
|
readonly converged: boolean;
|
|
192
|
+
readonly rounds: number;
|
|
208
193
|
};
|
|
209
|
-
declare function
|
|
194
|
+
declare function loop<i, state, o>(config: LoopConfig<i, state, o>): Step<i, LoopResult<o>>;
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region packages/core/src/compose.d.ts
|
|
197
|
+
declare function compose<i, o>(name: string, inner: Step<i, o>): Step<i, o>;
|
|
210
198
|
//#endregion
|
|
211
199
|
//#region packages/core/src/checkpoint.d.ts
|
|
212
200
|
type CheckpointConfig<i> = {
|
|
201
|
+
readonly name?: string;
|
|
213
202
|
readonly key: string | ((input: i) => string);
|
|
214
203
|
};
|
|
215
204
|
declare function checkpoint<i, o>(inner: Step<i, o>, config: CheckpointConfig<i>): Step<i, o>;
|
|
@@ -217,6 +206,7 @@ declare function checkpoint<i, o>(inner: Step<i, o>, config: CheckpointConfig<i>
|
|
|
217
206
|
//#region packages/core/src/suspend.d.ts
|
|
218
207
|
type SuspendConfig<i, o, resume> = {
|
|
219
208
|
readonly id: string;
|
|
209
|
+
readonly name?: string;
|
|
220
210
|
readonly on: (input: i, ctx: RunContext) => Promise<void> | void;
|
|
221
211
|
readonly resume_schema: z.ZodType<resume>;
|
|
222
212
|
readonly combine: (input: i, resume: resume, ctx: RunContext) => Promise<o> | o | Step<unknown, o>;
|
|
@@ -226,9 +216,18 @@ declare function suspend<i, o, resume>(config: SuspendConfig<i, o, resume>): Ste
|
|
|
226
216
|
//#region packages/core/src/scope.d.ts
|
|
227
217
|
type AnyStep = Step<unknown, unknown>;
|
|
228
218
|
type LastOutput<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
219
|
+
type ScopeOptions = {
|
|
220
|
+
readonly name?: string;
|
|
221
|
+
};
|
|
222
|
+
type StashOptions = {
|
|
223
|
+
readonly name?: string;
|
|
224
|
+
};
|
|
225
|
+
type UseOptions = {
|
|
226
|
+
readonly name?: string;
|
|
227
|
+
};
|
|
228
|
+
declare function scope<const children extends readonly AnyStep[]>(children: children, options?: ScopeOptions): Step<unknown, LastOutput<children>>;
|
|
229
|
+
declare function stash<i, v>(key: string, source: Step<i, v>, options?: StashOptions): Step<i, v>;
|
|
230
|
+
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>;
|
|
232
231
|
//#endregion
|
|
233
232
|
//#region packages/core/src/errors.d.ts
|
|
234
233
|
/**
|
|
@@ -277,8 +276,56 @@ declare class aborted_error extends Error {
|
|
|
277
276
|
});
|
|
278
277
|
}
|
|
279
278
|
//#endregion
|
|
279
|
+
//#region packages/core/src/step_kinds.d.ts
|
|
280
|
+
/**
|
|
281
|
+
* Closed registry of every `Step.kind` produced by the composition layer.
|
|
282
|
+
*
|
|
283
|
+
* Studio (and any other consumer that needs to enumerate primitives — palette,
|
|
284
|
+
* docs, code generation) can rely on this being the exhaustive set. New
|
|
285
|
+
* primitives must add their kind here. The `step_kinds_cover_runner` contract
|
|
286
|
+
* test in `step_kinds.test.ts` asserts every dispatch handler corresponds to a
|
|
287
|
+
* kind listed here.
|
|
288
|
+
*/
|
|
289
|
+
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"];
|
|
290
|
+
type StepKind = (typeof STEP_KINDS)[number];
|
|
291
|
+
declare function is_step_kind(value: unknown): value is StepKind;
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region packages/core/src/trajectory.d.ts
|
|
294
|
+
declare const span_start_event_schema: z.ZodObject<{
|
|
295
|
+
kind: z.ZodLiteral<"span_start">;
|
|
296
|
+
span_id: z.ZodString;
|
|
297
|
+
name: z.ZodString;
|
|
298
|
+
}, z.core.$loose>;
|
|
299
|
+
declare const span_end_event_schema: z.ZodObject<{
|
|
300
|
+
kind: z.ZodLiteral<"span_end">;
|
|
301
|
+
span_id: z.ZodString;
|
|
302
|
+
}, z.core.$loose>;
|
|
303
|
+
declare const emit_event_schema: z.ZodObject<{
|
|
304
|
+
kind: z.ZodLiteral<"emit">;
|
|
305
|
+
}, z.core.$loose>;
|
|
306
|
+
declare const custom_event_schema: z.ZodObject<{
|
|
307
|
+
kind: z.ZodString;
|
|
308
|
+
}, z.core.$loose>;
|
|
309
|
+
declare const trajectory_event_schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
310
|
+
kind: z.ZodLiteral<"span_start">;
|
|
311
|
+
span_id: z.ZodString;
|
|
312
|
+
name: z.ZodString;
|
|
313
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
314
|
+
kind: z.ZodLiteral<"span_end">;
|
|
315
|
+
span_id: z.ZodString;
|
|
316
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
317
|
+
kind: z.ZodLiteral<"emit">;
|
|
318
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
319
|
+
kind: z.ZodString;
|
|
320
|
+
}, z.core.$loose>]>;
|
|
321
|
+
type SpanStartEvent = z.infer<typeof span_start_event_schema>;
|
|
322
|
+
type SpanEndEvent = z.infer<typeof span_end_event_schema>;
|
|
323
|
+
type EmitEvent = z.infer<typeof emit_event_schema>;
|
|
324
|
+
type CustomTrajectoryEvent = z.infer<typeof custom_event_schema>;
|
|
325
|
+
type ParsedTrajectoryEvent = z.infer<typeof trajectory_event_schema>;
|
|
326
|
+
//#endregion
|
|
280
327
|
//#region packages/core/src/version.d.ts
|
|
281
|
-
declare const version = "0.
|
|
328
|
+
declare const version = "0.3.8";
|
|
282
329
|
//#endregion
|
|
283
330
|
//#region packages/core/src/index.d.ts
|
|
284
331
|
declare const flow_schema: {
|
|
@@ -336,6 +383,12 @@ declare const flow_schema: {
|
|
|
336
383
|
timeout: {
|
|
337
384
|
$ref: string;
|
|
338
385
|
};
|
|
386
|
+
loop: {
|
|
387
|
+
$ref: string;
|
|
388
|
+
};
|
|
389
|
+
compose_node: {
|
|
390
|
+
$ref: string;
|
|
391
|
+
};
|
|
339
392
|
adversarial: {
|
|
340
393
|
$ref: string;
|
|
341
394
|
};
|
|
@@ -471,6 +524,45 @@ declare const flow_schema: {
|
|
|
471
524
|
};
|
|
472
525
|
};
|
|
473
526
|
};
|
|
527
|
+
compose_node_config: {
|
|
528
|
+
type: string;
|
|
529
|
+
required: string[];
|
|
530
|
+
properties: {
|
|
531
|
+
name: {
|
|
532
|
+
type: string;
|
|
533
|
+
minLength: number;
|
|
534
|
+
};
|
|
535
|
+
do: {
|
|
536
|
+
$ref: string;
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
loop_config: {
|
|
541
|
+
type: string;
|
|
542
|
+
required: string[];
|
|
543
|
+
properties: {
|
|
544
|
+
name: {
|
|
545
|
+
type: string;
|
|
546
|
+
minLength: number;
|
|
547
|
+
};
|
|
548
|
+
init: {
|
|
549
|
+
type: string;
|
|
550
|
+
};
|
|
551
|
+
body: {
|
|
552
|
+
$ref: string;
|
|
553
|
+
};
|
|
554
|
+
guard: {
|
|
555
|
+
$ref: string;
|
|
556
|
+
};
|
|
557
|
+
finish: {
|
|
558
|
+
type: string;
|
|
559
|
+
};
|
|
560
|
+
max_rounds: {
|
|
561
|
+
type: string;
|
|
562
|
+
minimum: number;
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
};
|
|
474
566
|
adversarial_config: {
|
|
475
567
|
type: string;
|
|
476
568
|
required: string[];
|
|
@@ -613,8 +705,279 @@ declare const flow_schema: {
|
|
|
613
705
|
};
|
|
614
706
|
};
|
|
615
707
|
//#endregion
|
|
708
|
+
//#region packages/composites/src/adversarial.d.ts
|
|
709
|
+
type AdversarialBuildInput<input, candidate> = {
|
|
710
|
+
readonly input: input;
|
|
711
|
+
readonly prior?: candidate;
|
|
712
|
+
readonly critique?: string;
|
|
713
|
+
};
|
|
714
|
+
type AdversarialCritiqueResult = {
|
|
715
|
+
readonly notes: string;
|
|
716
|
+
} & Record<string, unknown>;
|
|
717
|
+
type AdversarialResult<candidate> = {
|
|
718
|
+
readonly candidate: candidate;
|
|
719
|
+
readonly converged: boolean;
|
|
720
|
+
readonly rounds: number;
|
|
721
|
+
};
|
|
722
|
+
type AdversarialConfig<input, candidate> = {
|
|
723
|
+
readonly name?: string;
|
|
724
|
+
readonly build: Step<AdversarialBuildInput<input, candidate>, candidate>;
|
|
725
|
+
readonly critique: Step<candidate, AdversarialCritiqueResult>;
|
|
726
|
+
readonly accept: (critique_result: AdversarialCritiqueResult) => boolean;
|
|
727
|
+
readonly max_rounds: number;
|
|
728
|
+
};
|
|
729
|
+
declare function adversarial<input, candidate>(config: AdversarialConfig<input, candidate>): Step<input, AdversarialResult<candidate>>;
|
|
730
|
+
//#endregion
|
|
731
|
+
//#region packages/composites/src/consensus.d.ts
|
|
732
|
+
type ConsensusConfig<i, o> = {
|
|
733
|
+
readonly name?: string;
|
|
734
|
+
readonly members: Record<string, Step<i, o>>;
|
|
735
|
+
readonly agree: (results: Record<string, o>) => boolean;
|
|
736
|
+
readonly max_rounds: number;
|
|
737
|
+
};
|
|
738
|
+
type ConsensusResult<o> = {
|
|
739
|
+
readonly result: Record<string, o>;
|
|
740
|
+
readonly converged: boolean;
|
|
741
|
+
};
|
|
742
|
+
declare function consensus<i, o>(config: ConsensusConfig<i, o>): Step<i, ConsensusResult<o>>;
|
|
743
|
+
//#endregion
|
|
744
|
+
//#region packages/composites/src/ensemble.d.ts
|
|
745
|
+
type EnsembleConfig<i, o> = {
|
|
746
|
+
readonly name?: string;
|
|
747
|
+
readonly members: Record<string, Step<i, o>>;
|
|
748
|
+
readonly score: (result: o, member_id: string) => number | Promise<number>;
|
|
749
|
+
readonly select?: 'max' | 'min';
|
|
750
|
+
};
|
|
751
|
+
type EnsembleResult<o> = {
|
|
752
|
+
readonly winner: o;
|
|
753
|
+
readonly scores: Record<string, number>;
|
|
754
|
+
};
|
|
755
|
+
declare function ensemble<i, o>(config: EnsembleConfig<i, o>): Step<i, EnsembleResult<o>>;
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region packages/composites/src/ensemble_step.d.ts
|
|
758
|
+
type EnsembleStepConfig<i, o, ranked> = {
|
|
759
|
+
readonly name?: string;
|
|
760
|
+
readonly members: Record<string, Step<i, o>>;
|
|
761
|
+
readonly score: Step<o, ranked>;
|
|
762
|
+
readonly rank_by: (r: ranked) => number;
|
|
763
|
+
readonly select?: 'max' | 'min';
|
|
764
|
+
};
|
|
765
|
+
type EnsembleStepResult<o, ranked> = {
|
|
766
|
+
readonly winner_id: string;
|
|
767
|
+
readonly winner: o;
|
|
768
|
+
readonly winner_scored: ranked;
|
|
769
|
+
readonly scored: Record<string, ranked>;
|
|
770
|
+
};
|
|
771
|
+
declare function ensemble_step<i, o, ranked>(config: EnsembleStepConfig<i, o, ranked>): Step<i, EnsembleStepResult<o, ranked>>;
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region packages/composites/src/improve.d.ts
|
|
774
|
+
type Candidate<c> = {
|
|
775
|
+
readonly content: c;
|
|
776
|
+
readonly proposer_id: string;
|
|
777
|
+
readonly rationale?: string;
|
|
778
|
+
};
|
|
779
|
+
type ScoredCandidate<c> = {
|
|
780
|
+
readonly candidate: Candidate<c>;
|
|
781
|
+
readonly score: number;
|
|
782
|
+
readonly accepted: boolean;
|
|
783
|
+
readonly reason?: string;
|
|
784
|
+
};
|
|
785
|
+
type Lesson = {
|
|
786
|
+
readonly round: number;
|
|
787
|
+
readonly proposer_id: string;
|
|
788
|
+
readonly reason: string;
|
|
789
|
+
};
|
|
790
|
+
type ImproveRoundInput<c> = {
|
|
791
|
+
readonly parent: c;
|
|
792
|
+
readonly parent_score: number;
|
|
793
|
+
readonly round: number;
|
|
794
|
+
readonly lessons: ReadonlyArray<Lesson>;
|
|
795
|
+
};
|
|
796
|
+
type ImproveBudget = {
|
|
797
|
+
readonly max_rounds: number;
|
|
798
|
+
readonly max_wallclock_ms?: number;
|
|
799
|
+
readonly patience: number;
|
|
800
|
+
};
|
|
801
|
+
type ImproveConfig<i, c> = {
|
|
802
|
+
readonly name?: string;
|
|
803
|
+
readonly seed: Step<i, {
|
|
804
|
+
readonly content: c;
|
|
805
|
+
readonly score: number;
|
|
806
|
+
}>;
|
|
807
|
+
readonly propose: Step<ImproveRoundInput<c>, Candidate<c>>;
|
|
808
|
+
readonly score: Step<Candidate<c>, ScoredCandidate<c>>;
|
|
809
|
+
readonly budget: ImproveBudget;
|
|
810
|
+
readonly epsilon?: number;
|
|
811
|
+
readonly proposers_per_round?: number;
|
|
812
|
+
readonly lessons_capacity?: number;
|
|
813
|
+
};
|
|
814
|
+
type HistoryEntry<c> = {
|
|
815
|
+
readonly round: number;
|
|
816
|
+
readonly winner: ScoredCandidate<c>;
|
|
817
|
+
readonly accepted: boolean;
|
|
818
|
+
};
|
|
819
|
+
type ImproveResult<c> = {
|
|
820
|
+
readonly best: {
|
|
821
|
+
readonly content: c;
|
|
822
|
+
readonly score: number;
|
|
823
|
+
};
|
|
824
|
+
readonly rounds_used: number;
|
|
825
|
+
readonly stopped_by: 'budget' | 'plateau';
|
|
826
|
+
readonly history: ReadonlyArray<HistoryEntry<c>>;
|
|
827
|
+
};
|
|
828
|
+
declare function improve<i, c>(config: ImproveConfig<i, c>): Step<i, ImproveResult<c>>;
|
|
829
|
+
//#endregion
|
|
830
|
+
//#region packages/composites/src/learn.d.ts
|
|
831
|
+
type TrajectorySource = {
|
|
832
|
+
readonly kind: 'events';
|
|
833
|
+
readonly events: ReadonlyArray<TrajectoryEvent>;
|
|
834
|
+
} | {
|
|
835
|
+
readonly kind: 'paths';
|
|
836
|
+
readonly paths: ReadonlyArray<string>;
|
|
837
|
+
} | {
|
|
838
|
+
readonly kind: 'dir';
|
|
839
|
+
readonly dir: string;
|
|
840
|
+
};
|
|
841
|
+
type LearnInput = {
|
|
842
|
+
readonly flow_description: string;
|
|
843
|
+
readonly events: ReadonlyArray<TrajectoryEvent>;
|
|
844
|
+
readonly prior?: unknown;
|
|
845
|
+
};
|
|
846
|
+
type Improvement = {
|
|
847
|
+
readonly target: string;
|
|
848
|
+
readonly kind: 'prompt' | 'config' | 'structure' | 'note';
|
|
849
|
+
readonly rationale: string;
|
|
850
|
+
readonly suggestion: string;
|
|
851
|
+
};
|
|
852
|
+
type LearnConfig<i extends LearnInput, o> = {
|
|
853
|
+
readonly name?: string;
|
|
854
|
+
readonly flow: Step<unknown, unknown>;
|
|
855
|
+
readonly source: TrajectorySource;
|
|
856
|
+
readonly analyzer: Step<i, o>;
|
|
857
|
+
readonly filter?: (event: TrajectoryEvent) => boolean;
|
|
858
|
+
readonly max_events?: number;
|
|
859
|
+
};
|
|
860
|
+
type LearnResult<o> = {
|
|
861
|
+
readonly proposals: o;
|
|
862
|
+
readonly events_considered: number;
|
|
863
|
+
readonly run_ids: ReadonlyArray<string>;
|
|
864
|
+
};
|
|
865
|
+
declare function learn<i extends LearnInput, o>(config: LearnConfig<i, o>): Step<unknown, LearnResult<o>>;
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region packages/composites/src/tournament.d.ts
|
|
868
|
+
type BracketRecord = {
|
|
869
|
+
readonly round: number;
|
|
870
|
+
readonly a_id: string;
|
|
871
|
+
readonly b_id: string;
|
|
872
|
+
readonly winner_id: string;
|
|
873
|
+
};
|
|
874
|
+
type TournamentConfig<i, o> = {
|
|
875
|
+
readonly name?: string;
|
|
876
|
+
readonly members: Record<string, Step<i, o>>;
|
|
877
|
+
readonly compare: (a: o, b: o) => Promise<'a' | 'b'> | 'a' | 'b';
|
|
878
|
+
};
|
|
879
|
+
type TournamentResult<o> = {
|
|
880
|
+
readonly winner: o;
|
|
881
|
+
readonly bracket: ReadonlyArray<BracketRecord>;
|
|
882
|
+
};
|
|
883
|
+
declare function tournament<i, o>(config: TournamentConfig<i, o>): Step<i, TournamentResult<o>>;
|
|
884
|
+
//#endregion
|
|
885
|
+
//#region packages/composites/src/bench.d.ts
|
|
886
|
+
type Score = {
|
|
887
|
+
readonly score: number;
|
|
888
|
+
readonly reason?: string;
|
|
889
|
+
};
|
|
890
|
+
type BenchCase<I> = {
|
|
891
|
+
readonly id: string;
|
|
892
|
+
readonly input: I;
|
|
893
|
+
readonly meta?: Readonly<Record<string, unknown>>;
|
|
894
|
+
};
|
|
895
|
+
type JudgeArgs<I, O> = {
|
|
896
|
+
readonly input: I;
|
|
897
|
+
readonly output: O;
|
|
898
|
+
readonly meta?: Readonly<Record<string, unknown>>;
|
|
899
|
+
};
|
|
900
|
+
type Judge<I, O, S = Score> = Step<JudgeArgs<I, O>, S | undefined>;
|
|
901
|
+
type CaseResult<I = unknown, O = unknown, S = Score> = {
|
|
902
|
+
readonly case_id: string;
|
|
903
|
+
readonly ok: boolean;
|
|
904
|
+
readonly output?: O;
|
|
905
|
+
readonly error?: string;
|
|
906
|
+
readonly scores: Record<string, S>;
|
|
907
|
+
readonly duration_ms: number;
|
|
908
|
+
readonly cost_usd: number;
|
|
909
|
+
readonly trajectory_path?: string;
|
|
910
|
+
readonly _input?: I;
|
|
911
|
+
};
|
|
912
|
+
type BenchSummary = {
|
|
913
|
+
readonly pass_rate: number;
|
|
914
|
+
readonly mean_scores: Record<string, number>;
|
|
915
|
+
readonly total_duration_ms: number;
|
|
916
|
+
readonly total_cost_usd: number;
|
|
917
|
+
readonly mean_cost_usd: number;
|
|
918
|
+
};
|
|
919
|
+
type BenchReport<I = unknown, O = unknown, S = Score> = {
|
|
920
|
+
readonly flow_name: string;
|
|
921
|
+
readonly run_id: string;
|
|
922
|
+
readonly cases: ReadonlyArray<CaseResult<I, O, S>>;
|
|
923
|
+
readonly summary: BenchSummary;
|
|
924
|
+
};
|
|
925
|
+
type BenchOptions = {
|
|
926
|
+
readonly concurrency?: number;
|
|
927
|
+
readonly on_case?: (result: CaseResult) => void;
|
|
928
|
+
readonly trajectory_dir?: string;
|
|
929
|
+
readonly live_url?: string;
|
|
930
|
+
readonly run_id?: string;
|
|
931
|
+
readonly install_signal_handlers?: boolean;
|
|
932
|
+
};
|
|
933
|
+
declare function bench<I, O, S = Score>(flow: Step<I, O>, cases: ReadonlyArray<BenchCase<I>>, judges: Record<string, Judge<I, O, S>>, options?: BenchOptions): Promise<BenchReport<I, O, S>>;
|
|
934
|
+
declare function normalize_score(raw: unknown): Score | undefined;
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region packages/composites/src/judges.d.ts
|
|
937
|
+
declare function judge_equals<O>(): Judge<unknown, O>;
|
|
938
|
+
type JudgeWithFn<I, O> = (args: JudgeArgs<I, O>) => number | Score | undefined | Promise<number | Score | undefined>;
|
|
939
|
+
declare function judge_with<I, O>(fn: JudgeWithFn<I, O>): Judge<I, O>;
|
|
940
|
+
type JudgeLlmConfig = {
|
|
941
|
+
readonly model: Step<string, string>;
|
|
942
|
+
readonly rubric: string;
|
|
943
|
+
readonly scale?: {
|
|
944
|
+
readonly min: number;
|
|
945
|
+
readonly max: number;
|
|
946
|
+
};
|
|
947
|
+
};
|
|
948
|
+
declare function judge_llm<I, O>(config: JudgeLlmConfig): Judge<I, O>;
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region packages/composites/src/regression.d.ts
|
|
951
|
+
type RegressionDelta = {
|
|
952
|
+
readonly metric: string;
|
|
953
|
+
readonly baseline: number;
|
|
954
|
+
readonly current: number;
|
|
955
|
+
readonly delta: number;
|
|
956
|
+
readonly is_regression: boolean;
|
|
957
|
+
};
|
|
958
|
+
type PerCaseDelta = {
|
|
959
|
+
readonly case_id: string;
|
|
960
|
+
readonly baseline?: CaseResult;
|
|
961
|
+
readonly current?: CaseResult;
|
|
962
|
+
readonly score_deltas: Record<string, number>;
|
|
963
|
+
readonly cost_delta: number;
|
|
964
|
+
readonly is_regression: boolean;
|
|
965
|
+
};
|
|
966
|
+
type RegressionReport = {
|
|
967
|
+
readonly ok: boolean;
|
|
968
|
+
readonly deltas: ReadonlyArray<RegressionDelta>;
|
|
969
|
+
readonly per_case: ReadonlyArray<PerCaseDelta>;
|
|
970
|
+
};
|
|
971
|
+
type RegressionCompareOptions = {
|
|
972
|
+
readonly score_threshold?: number;
|
|
973
|
+
readonly cost_threshold?: number;
|
|
974
|
+
};
|
|
975
|
+
declare function regression_compare(current: BenchReport, baseline: BenchReport, options?: RegressionCompareOptions): RegressionReport;
|
|
976
|
+
declare function read_baseline(path: string): Promise<BenchReport>;
|
|
977
|
+
declare function write_baseline(path: string, report: BenchReport): Promise<void>;
|
|
978
|
+
//#endregion
|
|
616
979
|
//#region packages/engine/src/version.d.ts
|
|
617
|
-
declare const version$1 = "0.
|
|
980
|
+
declare const version$1 = "0.3.8";
|
|
618
981
|
//#endregion
|
|
619
982
|
//#region packages/engine/src/providers/claude_cli/types.d.ts
|
|
620
983
|
/**
|
|
@@ -656,7 +1019,7 @@ type ClaudeCliProviderConfig = {
|
|
|
656
1019
|
};
|
|
657
1020
|
//#endregion
|
|
658
1021
|
//#region packages/engine/src/types.d.ts
|
|
659
|
-
type EffortLevel = 'none' | 'low' | 'medium' | 'high';
|
|
1022
|
+
type EffortLevel = 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
660
1023
|
type FinishReason = 'stop' | 'tool_calls' | 'length' | 'content_filter' | 'aborted' | 'max_steps';
|
|
661
1024
|
type RetryFailureKind = 'rate_limit' | 'provider_5xx' | 'network' | 'timeout';
|
|
662
1025
|
type RetryPolicy = {
|
|
@@ -1032,5 +1395,47 @@ declare function model_call<T = unknown>(cfg: ModelCallConfig<T>): Step<ModelCal
|
|
|
1032
1395
|
//#region packages/fascicle/src/forward_standard_env.d.ts
|
|
1033
1396
|
declare function forward_standard_env(): Record<string, string>;
|
|
1034
1397
|
//#endregion
|
|
1035
|
-
|
|
1398
|
+
//#region packages/viewer/src/cli.d.ts
|
|
1399
|
+
/**
|
|
1400
|
+
* fascicle-viewer CLI.
|
|
1401
|
+
*
|
|
1402
|
+
* fascicle-viewer <path> # tail a JSONL file (primary)
|
|
1403
|
+
* fascicle-viewer --listen # accept HTTP push only
|
|
1404
|
+
* fascicle-viewer <path> --listen # both producers feed the same broadcaster
|
|
1405
|
+
*
|
|
1406
|
+
* Flags: --port <n> --host <h> --buffer <n> --no-open --help
|
|
1407
|
+
*
|
|
1408
|
+
* Defaults bind 127.0.0.1:4242 and open the user's default browser. SIGINT
|
|
1409
|
+
* shuts everything down cleanly. The CLI body is exposed as `run_viewer_cli`
|
|
1410
|
+
* so the umbrella's bin shim can drive it from a bundled `dist/index.js`.
|
|
1411
|
+
*/
|
|
1412
|
+
declare function run_viewer_cli(argv: readonly string[]): Promise<void>;
|
|
1413
|
+
//#endregion
|
|
1414
|
+
//#region packages/viewer/src/index.d.ts
|
|
1415
|
+
/**
|
|
1416
|
+
* Public surface for @repo/viewer.
|
|
1417
|
+
*
|
|
1418
|
+
* `start_viewer({ ... })` is the programmatic embed: spin up the server,
|
|
1419
|
+
* optionally start tailing a JSONL file, and return a handle that can stop
|
|
1420
|
+
* both. `start_viewer` only depends on @repo/core's wire-format schema; it
|
|
1421
|
+
* never reaches into the engine, composites, or any provider.
|
|
1422
|
+
*/
|
|
1423
|
+
type StartViewerOptions = {
|
|
1424
|
+
readonly path?: string;
|
|
1425
|
+
readonly host?: string;
|
|
1426
|
+
readonly port?: number;
|
|
1427
|
+
readonly buffer?: number;
|
|
1428
|
+
readonly on_parse_error?: (err: unknown, line: string) => void;
|
|
1429
|
+
readonly on_io_error?: (err: unknown) => void;
|
|
1430
|
+
readonly on_subscriber_error?: (err: unknown) => void;
|
|
1431
|
+
};
|
|
1432
|
+
type ViewerHandle = {
|
|
1433
|
+
readonly url: string;
|
|
1434
|
+
readonly host: string;
|
|
1435
|
+
readonly port: number;
|
|
1436
|
+
readonly close: () => Promise<void>;
|
|
1437
|
+
};
|
|
1438
|
+
declare function start_viewer(options?: StartViewerOptions): Promise<ViewerHandle>;
|
|
1439
|
+
//#endregion
|
|
1440
|
+
export { type AdversarialBuildInput, type AdversarialConfig, type AdversarialCritiqueResult, type AdversarialResult, type AliasTable, type AliasTarget, type AssistantContentPart, type BenchCase, type BenchOptions, type BenchReport, type BenchSummary, type BracketRecord, type Candidate, type CaseResult, type CheckpointStore, type ConsensusConfig, type ConsensusResult, type CostBreakdown, type CustomTrajectoryEvent, type DescribeOptions, type EffortLevel, type EmitEvent, type Engine, type EngineConfig, type EngineDefaults, type EnsembleConfig, type EnsembleResult, type EnsembleStepConfig, type EnsembleStepResult, type FinishReason, type FlowNode, type FlowValue, type GenerateOptions, type GenerateResult, type HistoryEntry, type ImproveBudget, type ImproveConfig, type ImproveResult, type ImproveRoundInput, type Improvement, type Judge, type JudgeArgs, type JudgeLlmConfig, type JudgeWithFn, type LearnConfig, type LearnInput, type LearnResult, type Lesson, type LoopConfig, type LoopGuardResult, type LoopResult, type Message, type ModelCallConfig, type ModelCallInput, type ParsedTrajectoryEvent, type PerCaseDelta, type Pricing, type PricingTable, type ProviderConfigMap, type ProviderInit, type RegressionCompareOptions, type RegressionDelta, type RegressionReport, type RetryFailureKind, type RetryPolicy, type RunContext, STEP_KINDS, type Score, type ScoredCandidate, type SpanEndEvent, type SpanStartEvent, type StartViewerOptions, type Step, type StepKind, type StepMetadata, type StepRecord, type StreamChunk, type Tool, type ToolApprovalHandler, type ToolApprovalRequest, type ToolCallRecord, type ToolExecContext, type TournamentConfig, type TournamentResult, type TrajectoryEvent, type TrajectoryLogger, type TrajectorySource, type UsageTotals, type UserContentPart, type ViewerHandle, aborted_error, adversarial, bench, branch, checkpoint, compose, consensus, version as core_version, create_engine, custom_event_schema, describe, describe_cycle_error, emit_event_schema, engine_config_error, version$1 as engine_version, ensemble, ensemble_step, fallback, flow_schema, forward_standard_env, improve, is_step_kind, judge_equals, judge_llm, judge_with, learn, loop, map, model_call, model_not_found_error, normalize_score, on_chunk_error, parallel, pipe, provider_capability_error, provider_error, provider_not_configured_error, rate_limit_error, read_baseline, regression_compare, resume_validation_error, retry, run, run_viewer_cli, schema_validation_error, scope, sequence, span_end_event_schema, span_start_event_schema, start_viewer, stash, step, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, trajectory_event_schema, use, write_baseline };
|
|
1036
1441
|
//# sourceMappingURL=index.d.ts.map
|