fascicle 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/README.md +16 -8
- package/dist/adapters.d.ts +38 -0
- package/dist/adapters.js +78 -0
- package/dist/adapters.js.map +1 -0
- package/dist/index-CCFSc--s.d.ts +710 -0
- package/dist/index.d.ts +51 -710
- package/dist/index.js +350 -556
- package/dist/index.js.map +1 -1
- package/dist/tee-D_Qh_vfY.js +169 -0
- package/dist/tee-D_Qh_vfY.js.map +1 -0
- package/package.json +7 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,710 +1,6 @@
|
|
|
1
|
+
import { A as loop, B as FlowNode, C as use, D as LoopConfig, E as compose, F as map, G as CheckpointStore, H as describe, I as branch, J as StepMetadata, K as RunContext, L as parallel, M as fallback, N as retry, O as LoopGuardResult, P as pipe, R as sequence, S as stash, T as checkpoint, U as step, V as FlowValue, W as run, X as TrajectoryLogger, Y as TrajectoryEvent, _ as describe_cycle_error, a as ParsedTrajectoryEvent, b as timeout_error, c as custom_event_schema, d as span_start_event_schema, f as trajectory_event_schema, g as aborted_error, h as is_step_kind, i as EmitEvent, j as timeout, k as LoopResult, l as emit_event_schema, m as StepKind, n as version, o as SpanEndEvent, p as STEP_KINDS, q as Step, r as CustomTrajectoryEvent, s as SpanStartEvent, t as flow_schema, u as span_end_event_schema, v as resume_validation_error, w as suspend, x as scope, y as suspended_error, z as DescribeOptions } from "./index-CCFSc--s.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
|
-
//#region packages/core/src/types.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Shared type surface for the composition layer.
|
|
6
|
-
*
|
|
7
|
-
* These types are the public value contract between composers, the runner,
|
|
8
|
-
* and adapter packages (@repo/observability, @repo/stores,
|
|
9
|
-
* @repo/engine). Adapter packages import types from here; nothing in
|
|
10
|
-
* this file imports from any adapter.
|
|
11
|
-
*
|
|
12
|
-
* Type aliases and interfaces use PascalCase per constraints.md §2.
|
|
13
|
-
* Value-level identifiers (field names, function parameter names) remain
|
|
14
|
-
* snake_case; those are the value contract, not the type contract.
|
|
15
|
-
*/
|
|
16
|
-
type TrajectoryEvent = {
|
|
17
|
-
readonly kind: string;
|
|
18
|
-
readonly span_id?: string | undefined;
|
|
19
|
-
readonly [key: string]: unknown;
|
|
20
|
-
};
|
|
21
|
-
type TrajectoryLogger = {
|
|
22
|
-
readonly record: (event: TrajectoryEvent) => void;
|
|
23
|
-
readonly start_span: (name: string, meta?: Record<string, unknown>) => string;
|
|
24
|
-
readonly end_span: (id: string, meta?: Record<string, unknown>) => void;
|
|
25
|
-
};
|
|
26
|
-
type CheckpointStore = {
|
|
27
|
-
readonly get: (key: string) => Promise<unknown>;
|
|
28
|
-
readonly set: (key: string, value: unknown) => Promise<void>;
|
|
29
|
-
readonly delete: (key: string) => Promise<void>;
|
|
30
|
-
};
|
|
31
|
-
type CleanupFn = () => Promise<void> | void;
|
|
32
|
-
type RunContext = {
|
|
33
|
-
readonly run_id: string;
|
|
34
|
-
readonly trajectory: TrajectoryLogger;
|
|
35
|
-
readonly state: ReadonlyMap<string, unknown>;
|
|
36
|
-
readonly parent_span_id?: string | undefined;
|
|
37
|
-
readonly abort: AbortSignal;
|
|
38
|
-
readonly emit: (event: Record<string, unknown>) => void;
|
|
39
|
-
readonly on_cleanup: (fn: CleanupFn) => void;
|
|
40
|
-
readonly checkpoint_store?: CheckpointStore | undefined;
|
|
41
|
-
readonly resume_data?: Readonly<Record<string, unknown>> | undefined;
|
|
42
|
-
readonly streaming: boolean;
|
|
43
|
-
};
|
|
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
|
-
};
|
|
53
|
-
type Step<i, o> = {
|
|
54
|
-
readonly id: string;
|
|
55
|
-
readonly kind: string;
|
|
56
|
-
run(input: i, ctx: RunContext): Promise<o> | o;
|
|
57
|
-
readonly config?: Readonly<Record<string, unknown>>;
|
|
58
|
-
readonly children?: ReadonlyArray<Step<unknown, unknown>>;
|
|
59
|
-
readonly anonymous?: boolean;
|
|
60
|
-
readonly meta?: StepMetadata;
|
|
61
|
-
};
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region packages/core/src/runner.d.ts
|
|
64
|
-
type RunOptions = {
|
|
65
|
-
readonly install_signal_handlers?: boolean;
|
|
66
|
-
readonly trajectory?: TrajectoryLogger;
|
|
67
|
-
readonly checkpoint_store?: CheckpointStore;
|
|
68
|
-
readonly resume_data?: Readonly<Record<string, unknown>>;
|
|
69
|
-
};
|
|
70
|
-
type StreamingRunHandle<o> = {
|
|
71
|
-
readonly events: AsyncIterable<TrajectoryEvent>;
|
|
72
|
-
readonly result: Promise<o>;
|
|
73
|
-
};
|
|
74
|
-
declare function run_impl<i, o>(flow: Step<i, o>, input: i, options?: RunOptions): Promise<o>;
|
|
75
|
-
declare function run_stream<i, o>(flow: Step<i, o>, input: i, options?: RunOptions): StreamingRunHandle<o>;
|
|
76
|
-
declare const run: typeof run_impl & {
|
|
77
|
-
stream: typeof run_stream;
|
|
78
|
-
};
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region packages/core/src/step.d.ts
|
|
81
|
-
declare function step<i, o>(id: string, fn: StepFn<i, o>, meta?: StepMetadata): Step<i, o>;
|
|
82
|
-
declare function step<i, o>(fn: StepFn<i, o>): Step<i, o>;
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region packages/core/src/describe.d.ts
|
|
85
|
-
type FlowValue = string | number | boolean | null | ReadonlyArray<FlowValue> | Readonly<{
|
|
86
|
-
[key: string]: FlowValue;
|
|
87
|
-
}> | {
|
|
88
|
-
readonly kind: '<fn>';
|
|
89
|
-
readonly name?: string;
|
|
90
|
-
} | {
|
|
91
|
-
readonly kind: '<schema>';
|
|
92
|
-
} | {
|
|
93
|
-
readonly kind: string;
|
|
94
|
-
readonly id: string;
|
|
95
|
-
};
|
|
96
|
-
type FlowNode = {
|
|
97
|
-
readonly kind: string;
|
|
98
|
-
readonly id: string;
|
|
99
|
-
readonly config?: Readonly<{
|
|
100
|
-
[key: string]: FlowValue;
|
|
101
|
-
}>;
|
|
102
|
-
readonly children?: ReadonlyArray<FlowNode>;
|
|
103
|
-
readonly meta?: StepMetadata;
|
|
104
|
-
};
|
|
105
|
-
type DescribeOptions = {
|
|
106
|
-
readonly strict?: boolean;
|
|
107
|
-
};
|
|
108
|
-
declare const describe: {
|
|
109
|
-
<i, o>(root: Step<i, o>, options?: DescribeOptions): string;
|
|
110
|
-
json: <i, o>(root: Step<i, o>, options?: DescribeOptions) => FlowNode;
|
|
111
|
-
};
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region packages/core/src/sequence.d.ts
|
|
114
|
-
type AnyStep$2 = Step<unknown, unknown>;
|
|
115
|
-
type FirstInput<children> = children extends readonly [Step<infer i, unknown>, ...unknown[]] ? i : unknown;
|
|
116
|
-
type LastOutput$1<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
|
|
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>>;
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region packages/core/src/parallel.d.ts
|
|
123
|
-
type AnyStep$1 = Step<unknown, unknown>;
|
|
124
|
-
type OutputOf<s> = s extends Step<unknown, infer o> ? o : unknown;
|
|
125
|
-
type ParallelOutputs<children extends Record<string, AnyStep$1>> = { [k in keyof children]: OutputOf<children[k]> };
|
|
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>>;
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region packages/core/src/branch.d.ts
|
|
132
|
-
type BranchConfig<i, o> = {
|
|
133
|
-
readonly name?: string;
|
|
134
|
-
readonly when: (input: i) => boolean | Promise<boolean>;
|
|
135
|
-
readonly then: Step<i, o>;
|
|
136
|
-
readonly otherwise: Step<i, o>;
|
|
137
|
-
};
|
|
138
|
-
declare function branch<i, o>(config: BranchConfig<i, o>): Step<i, o>;
|
|
139
|
-
//#endregion
|
|
140
|
-
//#region packages/core/src/map.d.ts
|
|
141
|
-
type MapConfig<input, item, result> = {
|
|
142
|
-
readonly name?: string;
|
|
143
|
-
readonly items: (input: input) => ReadonlyArray<item> | Promise<ReadonlyArray<item>>;
|
|
144
|
-
readonly do: Step<item, result>;
|
|
145
|
-
readonly concurrency?: number;
|
|
146
|
-
};
|
|
147
|
-
declare function map<input, item, result>(config: MapConfig<input, item, result>): Step<input, result[]>;
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region packages/core/src/pipe.d.ts
|
|
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>;
|
|
154
|
-
//#endregion
|
|
155
|
-
//#region packages/core/src/retry.d.ts
|
|
156
|
-
type RetryConfig = {
|
|
157
|
-
readonly name?: string;
|
|
158
|
-
readonly max_attempts: number;
|
|
159
|
-
readonly backoff_ms?: number;
|
|
160
|
-
readonly on_error?: (err: unknown, attempt: number) => void;
|
|
161
|
-
};
|
|
162
|
-
declare function retry<i, o>(inner: Step<i, o>, config: RetryConfig): Step<i, o>;
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region packages/core/src/fallback.d.ts
|
|
165
|
-
type FallbackOptions = {
|
|
166
|
-
readonly name?: string;
|
|
167
|
-
};
|
|
168
|
-
declare function fallback<i, o>(primary: Step<i, o>, backup: Step<i, o>, options?: FallbackOptions): Step<i, o>;
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region packages/core/src/timeout.d.ts
|
|
171
|
-
type TimeoutOptions = {
|
|
172
|
-
readonly name?: string;
|
|
173
|
-
};
|
|
174
|
-
declare function timeout<i, o>(inner: Step<i, o>, ms: number, options?: TimeoutOptions): Step<i, o>;
|
|
175
|
-
//#endregion
|
|
176
|
-
//#region packages/core/src/loop.d.ts
|
|
177
|
-
type LoopGuardResult<state> = {
|
|
178
|
-
readonly stop: boolean;
|
|
179
|
-
readonly state: state;
|
|
180
|
-
};
|
|
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;
|
|
187
|
-
readonly max_rounds: number;
|
|
188
|
-
};
|
|
189
|
-
type LoopResult<o> = {
|
|
190
|
-
readonly value: o;
|
|
191
|
-
readonly converged: boolean;
|
|
192
|
-
readonly rounds: number;
|
|
193
|
-
};
|
|
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>;
|
|
198
|
-
//#endregion
|
|
199
|
-
//#region packages/core/src/checkpoint.d.ts
|
|
200
|
-
type CheckpointConfig<i> = {
|
|
201
|
-
readonly name?: string;
|
|
202
|
-
readonly key: string | ((input: i) => string);
|
|
203
|
-
};
|
|
204
|
-
declare function checkpoint<i, o>(inner: Step<i, o>, config: CheckpointConfig<i>): Step<i, o>;
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region packages/core/src/suspend.d.ts
|
|
207
|
-
type SuspendConfig<i, o, resume> = {
|
|
208
|
-
readonly id: string;
|
|
209
|
-
readonly name?: string;
|
|
210
|
-
readonly on: (input: i, ctx: RunContext) => Promise<void> | void;
|
|
211
|
-
readonly resume_schema: z.ZodType<resume>;
|
|
212
|
-
readonly combine: (input: i, resume: resume, ctx: RunContext) => Promise<o> | o | Step<unknown, o>;
|
|
213
|
-
};
|
|
214
|
-
declare function suspend<i, o, resume>(config: SuspendConfig<i, o, resume>): Step<i, o>;
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region packages/core/src/scope.d.ts
|
|
217
|
-
type AnyStep = Step<unknown, unknown>;
|
|
218
|
-
type LastOutput<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
|
|
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>;
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region packages/core/src/errors.d.ts
|
|
233
|
-
/**
|
|
234
|
-
* Typed errors for the composition layer.
|
|
235
|
-
*
|
|
236
|
-
* This is the only source file in packages/core/src/ that uses the `class`
|
|
237
|
-
* keyword. `Error` is a built-in and `instanceof` branching is how composers
|
|
238
|
-
* like `retry` and `fallback` distinguish failure modes. See constraints.md §2.
|
|
239
|
-
*/
|
|
240
|
-
declare class timeout_error extends Error {
|
|
241
|
-
readonly kind: "timeout_error";
|
|
242
|
-
readonly timeout_ms: number;
|
|
243
|
-
constructor(message: string, timeout_ms: number);
|
|
244
|
-
}
|
|
245
|
-
declare class suspended_error extends Error {
|
|
246
|
-
readonly kind: "suspended_error";
|
|
247
|
-
readonly suspend_id: string;
|
|
248
|
-
readonly payload: unknown;
|
|
249
|
-
constructor(suspend_id: string, payload: unknown, message?: string);
|
|
250
|
-
}
|
|
251
|
-
declare class resume_validation_error extends Error {
|
|
252
|
-
readonly kind: "resume_validation_error";
|
|
253
|
-
readonly issues: unknown;
|
|
254
|
-
constructor(message: string, issues: unknown);
|
|
255
|
-
}
|
|
256
|
-
declare class describe_cycle_error extends Error {
|
|
257
|
-
readonly kind: "describe_cycle_error";
|
|
258
|
-
readonly step_id: string;
|
|
259
|
-
constructor(step_id: string, message?: string);
|
|
260
|
-
}
|
|
261
|
-
declare class aborted_error extends Error {
|
|
262
|
-
readonly kind: "aborted_error";
|
|
263
|
-
readonly reason?: unknown;
|
|
264
|
-
readonly step_index: number;
|
|
265
|
-
readonly tool_call_in_flight?: {
|
|
266
|
-
id: string;
|
|
267
|
-
name: string;
|
|
268
|
-
};
|
|
269
|
-
constructor(message?: string, metadata?: {
|
|
270
|
-
reason?: unknown;
|
|
271
|
-
step_index?: number;
|
|
272
|
-
tool_call_in_flight?: {
|
|
273
|
-
id: string;
|
|
274
|
-
name: string;
|
|
275
|
-
};
|
|
276
|
-
});
|
|
277
|
-
}
|
|
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
|
|
327
|
-
//#region packages/core/src/version.d.ts
|
|
328
|
-
declare const version = "0.4.1";
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region packages/core/src/index.d.ts
|
|
331
|
-
declare const flow_schema: {
|
|
332
|
-
$schema: string;
|
|
333
|
-
$id: string;
|
|
334
|
-
title: string;
|
|
335
|
-
description: string;
|
|
336
|
-
type: string;
|
|
337
|
-
items: {
|
|
338
|
-
$ref: string;
|
|
339
|
-
};
|
|
340
|
-
$defs: {
|
|
341
|
-
compose_entry: {
|
|
342
|
-
type: string;
|
|
343
|
-
required: string[];
|
|
344
|
-
properties: {
|
|
345
|
-
compose: {
|
|
346
|
-
type: string;
|
|
347
|
-
};
|
|
348
|
-
};
|
|
349
|
-
allOf: {
|
|
350
|
-
$ref: string;
|
|
351
|
-
}[];
|
|
352
|
-
};
|
|
353
|
-
node: {
|
|
354
|
-
type: string;
|
|
355
|
-
anyOf: {
|
|
356
|
-
required: string[];
|
|
357
|
-
}[];
|
|
358
|
-
properties: {
|
|
359
|
-
step: {
|
|
360
|
-
$ref: string;
|
|
361
|
-
};
|
|
362
|
-
sequence: {
|
|
363
|
-
$ref: string;
|
|
364
|
-
};
|
|
365
|
-
parallel: {
|
|
366
|
-
$ref: string;
|
|
367
|
-
};
|
|
368
|
-
branch: {
|
|
369
|
-
$ref: string;
|
|
370
|
-
};
|
|
371
|
-
map: {
|
|
372
|
-
$ref: string;
|
|
373
|
-
};
|
|
374
|
-
pipe: {
|
|
375
|
-
$ref: string;
|
|
376
|
-
};
|
|
377
|
-
retry: {
|
|
378
|
-
$ref: string;
|
|
379
|
-
};
|
|
380
|
-
fallback: {
|
|
381
|
-
$ref: string;
|
|
382
|
-
};
|
|
383
|
-
timeout: {
|
|
384
|
-
$ref: string;
|
|
385
|
-
};
|
|
386
|
-
loop: {
|
|
387
|
-
$ref: string;
|
|
388
|
-
};
|
|
389
|
-
compose_node: {
|
|
390
|
-
$ref: string;
|
|
391
|
-
};
|
|
392
|
-
adversarial: {
|
|
393
|
-
$ref: string;
|
|
394
|
-
};
|
|
395
|
-
ensemble: {
|
|
396
|
-
$ref: string;
|
|
397
|
-
};
|
|
398
|
-
tournament: {
|
|
399
|
-
$ref: string;
|
|
400
|
-
};
|
|
401
|
-
consensus: {
|
|
402
|
-
$ref: string;
|
|
403
|
-
};
|
|
404
|
-
checkpoint: {
|
|
405
|
-
$ref: string;
|
|
406
|
-
};
|
|
407
|
-
suspend: {
|
|
408
|
-
$ref: string;
|
|
409
|
-
};
|
|
410
|
-
scope: {
|
|
411
|
-
$ref: string;
|
|
412
|
-
};
|
|
413
|
-
ref: {
|
|
414
|
-
type: string;
|
|
415
|
-
};
|
|
416
|
-
};
|
|
417
|
-
};
|
|
418
|
-
step_config: {
|
|
419
|
-
type: string;
|
|
420
|
-
required: string[];
|
|
421
|
-
properties: {
|
|
422
|
-
id: {
|
|
423
|
-
type: string;
|
|
424
|
-
};
|
|
425
|
-
fn: {
|
|
426
|
-
type: string;
|
|
427
|
-
};
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
|
-
sequence_config: {
|
|
431
|
-
type: string;
|
|
432
|
-
items: {
|
|
433
|
-
$ref: string;
|
|
434
|
-
};
|
|
435
|
-
};
|
|
436
|
-
parallel_config: {
|
|
437
|
-
type: string;
|
|
438
|
-
additionalProperties: {
|
|
439
|
-
$ref: string;
|
|
440
|
-
};
|
|
441
|
-
};
|
|
442
|
-
branch_config: {
|
|
443
|
-
type: string;
|
|
444
|
-
required: string[];
|
|
445
|
-
properties: {
|
|
446
|
-
when: {
|
|
447
|
-
type: string;
|
|
448
|
-
};
|
|
449
|
-
then: {
|
|
450
|
-
$ref: string;
|
|
451
|
-
};
|
|
452
|
-
otherwise: {
|
|
453
|
-
$ref: string;
|
|
454
|
-
};
|
|
455
|
-
};
|
|
456
|
-
};
|
|
457
|
-
map_config: {
|
|
458
|
-
type: string;
|
|
459
|
-
required: string[];
|
|
460
|
-
properties: {
|
|
461
|
-
items: {
|
|
462
|
-
type: string;
|
|
463
|
-
};
|
|
464
|
-
do: {
|
|
465
|
-
$ref: string;
|
|
466
|
-
};
|
|
467
|
-
concurrency: {
|
|
468
|
-
type: string;
|
|
469
|
-
minimum: number;
|
|
470
|
-
};
|
|
471
|
-
};
|
|
472
|
-
};
|
|
473
|
-
pipe_config: {
|
|
474
|
-
type: string;
|
|
475
|
-
required: string[];
|
|
476
|
-
properties: {
|
|
477
|
-
of: {
|
|
478
|
-
$ref: string;
|
|
479
|
-
};
|
|
480
|
-
fn: {
|
|
481
|
-
type: string;
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
|
-
};
|
|
485
|
-
retry_config: {
|
|
486
|
-
type: string;
|
|
487
|
-
required: string[];
|
|
488
|
-
properties: {
|
|
489
|
-
do: {
|
|
490
|
-
$ref: string;
|
|
491
|
-
};
|
|
492
|
-
max_attempts: {
|
|
493
|
-
type: string;
|
|
494
|
-
minimum: number;
|
|
495
|
-
};
|
|
496
|
-
backoff_ms: {
|
|
497
|
-
type: string;
|
|
498
|
-
minimum: number;
|
|
499
|
-
};
|
|
500
|
-
};
|
|
501
|
-
};
|
|
502
|
-
fallback_config: {
|
|
503
|
-
type: string;
|
|
504
|
-
required: string[];
|
|
505
|
-
properties: {
|
|
506
|
-
primary: {
|
|
507
|
-
$ref: string;
|
|
508
|
-
};
|
|
509
|
-
backup: {
|
|
510
|
-
$ref: string;
|
|
511
|
-
};
|
|
512
|
-
};
|
|
513
|
-
};
|
|
514
|
-
timeout_config: {
|
|
515
|
-
type: string;
|
|
516
|
-
required: string[];
|
|
517
|
-
properties: {
|
|
518
|
-
do: {
|
|
519
|
-
$ref: string;
|
|
520
|
-
};
|
|
521
|
-
ms: {
|
|
522
|
-
type: string;
|
|
523
|
-
minimum: number;
|
|
524
|
-
};
|
|
525
|
-
};
|
|
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
|
-
};
|
|
566
|
-
adversarial_config: {
|
|
567
|
-
type: string;
|
|
568
|
-
required: string[];
|
|
569
|
-
properties: {
|
|
570
|
-
build: {
|
|
571
|
-
$ref: string;
|
|
572
|
-
};
|
|
573
|
-
critique: {
|
|
574
|
-
$ref: string;
|
|
575
|
-
};
|
|
576
|
-
accept: {
|
|
577
|
-
type: string;
|
|
578
|
-
};
|
|
579
|
-
max_rounds: {
|
|
580
|
-
type: string;
|
|
581
|
-
minimum: number;
|
|
582
|
-
};
|
|
583
|
-
};
|
|
584
|
-
};
|
|
585
|
-
ensemble_config: {
|
|
586
|
-
type: string;
|
|
587
|
-
required: string[];
|
|
588
|
-
properties: {
|
|
589
|
-
members: {
|
|
590
|
-
type: string;
|
|
591
|
-
additionalProperties: {
|
|
592
|
-
$ref: string;
|
|
593
|
-
};
|
|
594
|
-
};
|
|
595
|
-
score: {
|
|
596
|
-
type: string;
|
|
597
|
-
};
|
|
598
|
-
select: {
|
|
599
|
-
type: string;
|
|
600
|
-
enum: string[];
|
|
601
|
-
};
|
|
602
|
-
};
|
|
603
|
-
};
|
|
604
|
-
tournament_config: {
|
|
605
|
-
type: string;
|
|
606
|
-
required: string[];
|
|
607
|
-
properties: {
|
|
608
|
-
members: {
|
|
609
|
-
type: string;
|
|
610
|
-
additionalProperties: {
|
|
611
|
-
$ref: string;
|
|
612
|
-
};
|
|
613
|
-
};
|
|
614
|
-
compare: {
|
|
615
|
-
type: string;
|
|
616
|
-
};
|
|
617
|
-
};
|
|
618
|
-
};
|
|
619
|
-
consensus_config: {
|
|
620
|
-
type: string;
|
|
621
|
-
required: string[];
|
|
622
|
-
properties: {
|
|
623
|
-
members: {
|
|
624
|
-
type: string;
|
|
625
|
-
additionalProperties: {
|
|
626
|
-
$ref: string;
|
|
627
|
-
};
|
|
628
|
-
};
|
|
629
|
-
agree: {
|
|
630
|
-
type: string;
|
|
631
|
-
};
|
|
632
|
-
max_rounds: {
|
|
633
|
-
type: string;
|
|
634
|
-
minimum: number;
|
|
635
|
-
};
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
checkpoint_config: {
|
|
639
|
-
type: string;
|
|
640
|
-
required: string[];
|
|
641
|
-
properties: {
|
|
642
|
-
do: {
|
|
643
|
-
$ref: string;
|
|
644
|
-
};
|
|
645
|
-
key: {
|
|
646
|
-
type: string;
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
};
|
|
650
|
-
suspend_config: {
|
|
651
|
-
type: string;
|
|
652
|
-
required: string[];
|
|
653
|
-
properties: {
|
|
654
|
-
id: {
|
|
655
|
-
type: string;
|
|
656
|
-
};
|
|
657
|
-
on: {
|
|
658
|
-
type: string;
|
|
659
|
-
};
|
|
660
|
-
resume_schema: {
|
|
661
|
-
type: string;
|
|
662
|
-
};
|
|
663
|
-
combine: {
|
|
664
|
-
type: string;
|
|
665
|
-
};
|
|
666
|
-
};
|
|
667
|
-
};
|
|
668
|
-
scope_config: {
|
|
669
|
-
type: string;
|
|
670
|
-
items: {
|
|
671
|
-
$ref: string;
|
|
672
|
-
};
|
|
673
|
-
};
|
|
674
|
-
scope_entry: {
|
|
675
|
-
type: string;
|
|
676
|
-
oneOf: ({
|
|
677
|
-
type: string;
|
|
678
|
-
required: string[];
|
|
679
|
-
properties: {
|
|
680
|
-
stash: {
|
|
681
|
-
type: string;
|
|
682
|
-
};
|
|
683
|
-
do: {
|
|
684
|
-
$ref: string;
|
|
685
|
-
};
|
|
686
|
-
use?: never;
|
|
687
|
-
};
|
|
688
|
-
} | {
|
|
689
|
-
type: string;
|
|
690
|
-
required: string[];
|
|
691
|
-
properties: {
|
|
692
|
-
use: {
|
|
693
|
-
type: string;
|
|
694
|
-
items: {
|
|
695
|
-
type: string;
|
|
696
|
-
};
|
|
697
|
-
};
|
|
698
|
-
do: {
|
|
699
|
-
$ref: string;
|
|
700
|
-
};
|
|
701
|
-
stash?: never;
|
|
702
|
-
};
|
|
703
|
-
})[];
|
|
704
|
-
};
|
|
705
|
-
};
|
|
706
|
-
};
|
|
707
|
-
//#endregion
|
|
708
4
|
//#region packages/composites/src/adversarial.d.ts
|
|
709
5
|
type AdversarialBuildInput<input, candidate> = {
|
|
710
6
|
readonly input: input;
|
|
@@ -977,7 +273,7 @@ declare function read_baseline(path: string): Promise<BenchReport>;
|
|
|
977
273
|
declare function write_baseline(path: string, report: BenchReport): Promise<void>;
|
|
978
274
|
//#endregion
|
|
979
275
|
//#region packages/engine/src/version.d.ts
|
|
980
|
-
declare const version$1 = "0.
|
|
276
|
+
declare const version$1 = "0.6.0";
|
|
981
277
|
//#endregion
|
|
982
278
|
//#region packages/engine/src/providers/claude_cli/types.d.ts
|
|
983
279
|
/**
|
|
@@ -1048,6 +344,11 @@ type AliasTarget = {
|
|
|
1048
344
|
};
|
|
1049
345
|
};
|
|
1050
346
|
type AliasTable = Readonly<Record<string, AliasTarget>>;
|
|
347
|
+
/**
|
|
348
|
+
* Family catalog: family name -> provider name -> the latest model id to send
|
|
349
|
+
* to that provider for the family. See `MODEL_FAMILIES` in aliases.ts.
|
|
350
|
+
*/
|
|
351
|
+
type FamilyCatalog = Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
1051
352
|
type Pricing = {
|
|
1052
353
|
input_per_million: number;
|
|
1053
354
|
output_per_million: number;
|
|
@@ -1188,6 +489,7 @@ type StreamChunk = {
|
|
|
1188
489
|
};
|
|
1189
490
|
type GenerateOptions<t = string> = {
|
|
1190
491
|
model?: string;
|
|
492
|
+
provider?: string;
|
|
1191
493
|
prompt: string | Message[];
|
|
1192
494
|
system?: string;
|
|
1193
495
|
schema?: z.ZodType<t>;
|
|
@@ -1260,7 +562,8 @@ type ProviderConfigMap = {
|
|
|
1260
562
|
*
|
|
1261
563
|
* | Field | Rule |
|
|
1262
564
|
* | --------------------------------------------------------------------- | ----------------------------------------- |
|
|
1263
|
-
* | `model` | per-call wins; else default; else
|
|
565
|
+
* | `model` | per-call wins; else default; else `sonnet` |
|
|
566
|
+
* | `provider` | per-call wins; else default; else sole configured provider; else `anthropic` |
|
|
1264
567
|
* | `system`, `effort`, `max_steps`, `tool_error_policy`, `schema_repair_attempts` | per-call wins (nullish coalesce) |
|
|
1265
568
|
* | `retry_policy` | per-call replaces wholesale |
|
|
1266
569
|
* | `provider_options` | two-level: per-provider-key shallow merge |
|
|
@@ -1268,6 +571,7 @@ type ProviderConfigMap = {
|
|
|
1268
571
|
*/
|
|
1269
572
|
type EngineDefaults = {
|
|
1270
573
|
readonly model?: string;
|
|
574
|
+
readonly provider?: string;
|
|
1271
575
|
readonly system?: string;
|
|
1272
576
|
readonly effort?: EffortLevel;
|
|
1273
577
|
readonly max_steps?: number;
|
|
@@ -1279,6 +583,7 @@ type EngineDefaults = {
|
|
|
1279
583
|
type EngineConfig = {
|
|
1280
584
|
providers: ProviderConfigMap;
|
|
1281
585
|
aliases?: AliasTable;
|
|
586
|
+
families?: FamilyCatalog;
|
|
1282
587
|
pricing?: PricingTable;
|
|
1283
588
|
default_retry?: RetryPolicy;
|
|
1284
589
|
default_effort?: EffortLevel;
|
|
@@ -1357,6 +662,13 @@ declare class model_not_found_error extends Error {
|
|
|
1357
662
|
readonly registered: ReadonlyArray<string>;
|
|
1358
663
|
constructor(model: string, registered: ReadonlyArray<string>);
|
|
1359
664
|
}
|
|
665
|
+
declare class model_family_unavailable_error extends Error {
|
|
666
|
+
readonly kind: "model_family_unavailable_error";
|
|
667
|
+
readonly family: string;
|
|
668
|
+
readonly provider: string;
|
|
669
|
+
readonly available_providers: ReadonlyArray<string>;
|
|
670
|
+
constructor(family: string, provider: string, available_providers: ReadonlyArray<string>);
|
|
671
|
+
}
|
|
1360
672
|
declare class provider_not_configured_error extends Error {
|
|
1361
673
|
readonly kind: "provider_not_configured_error";
|
|
1362
674
|
readonly provider: string;
|
|
@@ -1378,16 +690,45 @@ declare class provider_capability_error extends Error {
|
|
|
1378
690
|
readonly capability: string;
|
|
1379
691
|
constructor(provider: string, capability: string, detail?: string);
|
|
1380
692
|
}
|
|
693
|
+
declare class engine_disposed_error extends Error {
|
|
694
|
+
readonly kind: "engine_disposed_error";
|
|
695
|
+
constructor(message?: string);
|
|
696
|
+
}
|
|
697
|
+
type ClaudeCliErrorReason = 'binary_not_found' | 'auth_missing' | 'auth_expired' | 'api_key_missing' | 'startup_timeout' | 'stall_timeout' | 'no_result_event' | 'result_error' | 'subprocess_exit' | 'sandbox_unavailable' | 'engine_disposed' | 'parse_error';
|
|
698
|
+
declare class claude_cli_error extends Error {
|
|
699
|
+
readonly kind: "claude_cli_error";
|
|
700
|
+
readonly reason: ClaudeCliErrorReason;
|
|
701
|
+
readonly status?: number;
|
|
702
|
+
readonly stderr_snippet?: string;
|
|
703
|
+
constructor(reason: ClaudeCliErrorReason, message: string, metadata?: {
|
|
704
|
+
status?: number;
|
|
705
|
+
stderr_snippet?: string;
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
declare class provider_auth_error extends Error {
|
|
709
|
+
readonly kind: "provider_auth_error";
|
|
710
|
+
readonly provider: string;
|
|
711
|
+
readonly refresh_command?: string;
|
|
712
|
+
constructor(provider: string, message: string, metadata?: {
|
|
713
|
+
refresh_command?: string;
|
|
714
|
+
});
|
|
715
|
+
}
|
|
1381
716
|
//#endregion
|
|
1382
717
|
//#region packages/fascicle/src/model_call.d.ts
|
|
1383
718
|
type ModelCallInput = string | ReadonlyArray<Message>;
|
|
1384
|
-
type ModelCallConfig<T =
|
|
719
|
+
type ModelCallConfig<T = string> = {
|
|
1385
720
|
readonly engine: Engine;
|
|
1386
721
|
/**
|
|
1387
722
|
* Model or alias string. Optional: if omitted, the engine's
|
|
1388
723
|
* `defaults.model` is used. Errors at call time if neither is set.
|
|
1389
724
|
*/
|
|
1390
725
|
readonly model?: string;
|
|
726
|
+
/**
|
|
727
|
+
* Transport for the model: `anthropic` | `claude_cli` | `openrouter` | ...
|
|
728
|
+
* Optional: if omitted, the engine's `defaults.provider` (or sole configured
|
|
729
|
+
* provider, else `anthropic`) is used.
|
|
730
|
+
*/
|
|
731
|
+
readonly provider?: string;
|
|
1391
732
|
readonly id?: string;
|
|
1392
733
|
readonly system?: string;
|
|
1393
734
|
readonly tools?: ReadonlyArray<Tool>;
|
|
@@ -1400,7 +741,7 @@ type ModelCallConfig<T = unknown> = {
|
|
|
1400
741
|
readonly schema_repair_attempts?: number;
|
|
1401
742
|
readonly on_tool_approval?: ToolApprovalHandler;
|
|
1402
743
|
};
|
|
1403
|
-
declare function model_call<T =
|
|
744
|
+
declare function model_call<T = string>(cfg: ModelCallConfig<T>): Step<ModelCallInput, GenerateResult<T>>;
|
|
1404
745
|
//#endregion
|
|
1405
746
|
//#region packages/fascicle/src/forward_standard_env.d.ts
|
|
1406
747
|
declare function forward_standard_env(): Record<string, string>;
|
|
@@ -1447,5 +788,5 @@ type ViewerHandle = {
|
|
|
1447
788
|
};
|
|
1448
789
|
declare function start_viewer(options?: StartViewerOptions): Promise<ViewerHandle>;
|
|
1449
790
|
//#endregion
|
|
1450
|
-
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,
|
|
791
|
+
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, CheckpointStore, type ConsensusConfig, type ConsensusResult, type CostBreakdown, CustomTrajectoryEvent, DescribeOptions, type EffortLevel, EmitEvent, type Engine, type EngineConfig, type EngineDefaults, type EnsembleConfig, type EnsembleResult, type EnsembleStepConfig, type EnsembleStepResult, type FinishReason, FlowNode, 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, LoopConfig, LoopGuardResult, LoopResult, type Message, type ModelCallConfig, type ModelCallInput, ParsedTrajectoryEvent, type PerCaseDelta, type Pricing, type PricingTable, type ProviderConfigMap, type ProviderInit, type RegressionCompareOptions, type RegressionDelta, type RegressionReport, type RetryFailureKind, type RetryPolicy, RunContext, STEP_KINDS, type Score, type ScoredCandidate, SpanEndEvent, SpanStartEvent, type StartViewerOptions, Step, StepKind, StepMetadata, type StepRecord, type StreamChunk, type Tool, type ToolApprovalHandler, type ToolApprovalRequest, type ToolCallRecord, type ToolExecContext, type TournamentConfig, type TournamentResult, TrajectoryEvent, TrajectoryLogger, type TrajectorySource, type UsageTotals, type UserContentPart, type ViewerHandle, aborted_error, adversarial, bench, branch, checkpoint, claude_cli_error, compose, consensus, version as core_version, create_engine, custom_event_schema, describe, describe_cycle_error, emit_event_schema, engine_config_error, engine_disposed_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_family_unavailable_error, model_not_found_error, normalize_score, on_chunk_error, parallel, pipe, provider_auth_error, 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 };
|
|
1451
792
|
//# sourceMappingURL=index.d.ts.map
|