fascicle 0.1.13
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 +12 -0
- package/LICENSE +201 -0
- package/README.md +224 -0
- package/dist/index.d.ts +1036 -0
- package/dist/index.js +5532 -0
- package/dist/index.js.map +1 -0
- package/package.json +114 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1036 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
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 Step<i, o> = {
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly kind: string;
|
|
48
|
+
run(input: i, ctx: RunContext): Promise<o> | o;
|
|
49
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
50
|
+
readonly children?: ReadonlyArray<Step<unknown, unknown>>;
|
|
51
|
+
readonly anonymous?: boolean;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region packages/core/src/runner.d.ts
|
|
55
|
+
type RunOptions = {
|
|
56
|
+
readonly install_signal_handlers?: boolean;
|
|
57
|
+
readonly trajectory?: TrajectoryLogger;
|
|
58
|
+
readonly checkpoint_store?: CheckpointStore;
|
|
59
|
+
readonly resume_data?: Readonly<Record<string, unknown>>;
|
|
60
|
+
};
|
|
61
|
+
type StreamingRunHandle<o> = {
|
|
62
|
+
readonly events: AsyncIterable<TrajectoryEvent>;
|
|
63
|
+
readonly result: Promise<o>;
|
|
64
|
+
};
|
|
65
|
+
declare function run_impl<i, o>(flow: Step<i, o>, input: i, options?: RunOptions): Promise<o>;
|
|
66
|
+
declare function run_stream<i, o>(flow: Step<i, o>, input: i, options?: RunOptions): StreamingRunHandle<o>;
|
|
67
|
+
declare const run: typeof run_impl & {
|
|
68
|
+
stream: typeof run_stream;
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region packages/core/src/step.d.ts
|
|
72
|
+
declare function step<i, o>(id: string, fn: StepFn<i, o>): Step<i, o>;
|
|
73
|
+
declare function step<i, o>(fn: StepFn<i, o>): Step<i, o>;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region packages/core/src/describe.d.ts
|
|
76
|
+
type FlowValue = string | number | boolean | null | ReadonlyArray<FlowValue> | Readonly<{
|
|
77
|
+
[key: string]: FlowValue;
|
|
78
|
+
}> | {
|
|
79
|
+
readonly kind: '<fn>';
|
|
80
|
+
readonly name?: string;
|
|
81
|
+
} | {
|
|
82
|
+
readonly kind: '<schema>';
|
|
83
|
+
} | {
|
|
84
|
+
readonly kind: string;
|
|
85
|
+
readonly id: string;
|
|
86
|
+
};
|
|
87
|
+
type FlowNode = {
|
|
88
|
+
readonly kind: string;
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly config?: Readonly<{
|
|
91
|
+
[key: string]: FlowValue;
|
|
92
|
+
}>;
|
|
93
|
+
readonly children?: ReadonlyArray<FlowNode>;
|
|
94
|
+
};
|
|
95
|
+
type DescribeOptions = {
|
|
96
|
+
readonly strict?: boolean;
|
|
97
|
+
};
|
|
98
|
+
declare const describe: {
|
|
99
|
+
<i, o>(root: Step<i, o>, options?: DescribeOptions): string;
|
|
100
|
+
json: <i, o>(root: Step<i, o>, options?: DescribeOptions) => FlowNode;
|
|
101
|
+
};
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region packages/core/src/sequence.d.ts
|
|
104
|
+
type AnyStep$2 = Step<unknown, unknown>;
|
|
105
|
+
type FirstInput<children> = children extends readonly [Step<infer i, unknown>, ...unknown[]] ? i : unknown;
|
|
106
|
+
type LastOutput$1<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
|
|
107
|
+
declare function sequence<const children extends readonly AnyStep$2[]>(children: children): Step<FirstInput<children>, LastOutput$1<children>>;
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region packages/core/src/parallel.d.ts
|
|
110
|
+
type AnyStep$1 = Step<unknown, unknown>;
|
|
111
|
+
type OutputOf<s> = s extends Step<unknown, infer o> ? o : unknown;
|
|
112
|
+
type ParallelOutputs<children extends Record<string, AnyStep$1>> = { [k in keyof children]: OutputOf<children[k]> };
|
|
113
|
+
declare function parallel<i, children extends Record<string, Step<i, unknown>>>(members: children): Step<i, ParallelOutputs<children>>;
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region packages/core/src/branch.d.ts
|
|
116
|
+
type BranchConfig<i, o> = {
|
|
117
|
+
readonly when: (input: i) => boolean | Promise<boolean>;
|
|
118
|
+
readonly then: Step<i, o>;
|
|
119
|
+
readonly otherwise: Step<i, o>;
|
|
120
|
+
};
|
|
121
|
+
declare function branch<i, o>(config: BranchConfig<i, o>): Step<i, o>;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region packages/core/src/map.d.ts
|
|
124
|
+
type MapConfig<input, item, result> = {
|
|
125
|
+
readonly items: (input: input) => ReadonlyArray<item> | Promise<ReadonlyArray<item>>;
|
|
126
|
+
readonly do: Step<item, result>;
|
|
127
|
+
readonly concurrency?: number;
|
|
128
|
+
};
|
|
129
|
+
declare function map<input, item, result>(config: MapConfig<input, item, result>): Step<input, result[]>;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region packages/core/src/pipe.d.ts
|
|
132
|
+
declare function pipe<i, a, b>(inner: Step<i, a>, fn: (value: a) => b | Promise<b>): Step<i, b>;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region packages/core/src/retry.d.ts
|
|
135
|
+
type RetryConfig = {
|
|
136
|
+
readonly max_attempts: number;
|
|
137
|
+
readonly backoff_ms?: number;
|
|
138
|
+
readonly on_error?: (err: unknown, attempt: number) => void;
|
|
139
|
+
};
|
|
140
|
+
declare function retry<i, o>(inner: Step<i, o>, config: RetryConfig): Step<i, o>;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region packages/core/src/fallback.d.ts
|
|
143
|
+
declare function fallback<i, o>(primary: Step<i, o>, backup: Step<i, o>): Step<i, o>;
|
|
144
|
+
//#endregion
|
|
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;
|
|
167
|
+
};
|
|
168
|
+
declare function adversarial<input, candidate>(config: AdversarialConfig<input, candidate>): Step<input, AdversarialResult<candidate>>;
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region packages/core/src/ensemble.d.ts
|
|
171
|
+
type EnsembleConfig<i, o> = {
|
|
172
|
+
readonly members: Record<string, Step<i, o>>;
|
|
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>;
|
|
179
|
+
};
|
|
180
|
+
declare function ensemble<i, o>(config: EnsembleConfig<i, o>): Step<i, EnsembleResult<o>>;
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region packages/core/src/tournament.d.ts
|
|
183
|
+
type BracketRecord = {
|
|
184
|
+
readonly round: number;
|
|
185
|
+
readonly a_id: string;
|
|
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';
|
|
192
|
+
};
|
|
193
|
+
type TournamentResult<o> = {
|
|
194
|
+
readonly winner: o;
|
|
195
|
+
readonly bracket: ReadonlyArray<BracketRecord>;
|
|
196
|
+
};
|
|
197
|
+
declare function tournament<i, o>(config: TournamentConfig<i, o>): Step<i, TournamentResult<o>>;
|
|
198
|
+
//#endregion
|
|
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;
|
|
203
|
+
readonly max_rounds: number;
|
|
204
|
+
};
|
|
205
|
+
type ConsensusResult<o> = {
|
|
206
|
+
readonly result: Record<string, o>;
|
|
207
|
+
readonly converged: boolean;
|
|
208
|
+
};
|
|
209
|
+
declare function consensus<i, o>(config: ConsensusConfig<i, o>): Step<i, ConsensusResult<o>>;
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region packages/core/src/checkpoint.d.ts
|
|
212
|
+
type CheckpointConfig<i> = {
|
|
213
|
+
readonly key: string | ((input: i) => string);
|
|
214
|
+
};
|
|
215
|
+
declare function checkpoint<i, o>(inner: Step<i, o>, config: CheckpointConfig<i>): Step<i, o>;
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region packages/core/src/suspend.d.ts
|
|
218
|
+
type SuspendConfig<i, o, resume> = {
|
|
219
|
+
readonly id: string;
|
|
220
|
+
readonly on: (input: i, ctx: RunContext) => Promise<void> | void;
|
|
221
|
+
readonly resume_schema: z.ZodType<resume>;
|
|
222
|
+
readonly combine: (input: i, resume: resume, ctx: RunContext) => Promise<o> | o | Step<unknown, o>;
|
|
223
|
+
};
|
|
224
|
+
declare function suspend<i, o, resume>(config: SuspendConfig<i, o, resume>): Step<i, o>;
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region packages/core/src/scope.d.ts
|
|
227
|
+
type AnyStep = Step<unknown, unknown>;
|
|
228
|
+
type LastOutput<children> = children extends readonly [...unknown[], Step<unknown, infer o>] ? o : children extends readonly [Step<unknown, infer o>] ? o : unknown;
|
|
229
|
+
declare function scope<const children extends readonly AnyStep[]>(children: children): Step<unknown, LastOutput<children>>;
|
|
230
|
+
declare function stash<i, v>(key: string, source: Step<i, v>): Step<i, v>;
|
|
231
|
+
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): Step<i, o>;
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region packages/core/src/errors.d.ts
|
|
234
|
+
/**
|
|
235
|
+
* Typed errors for the composition layer.
|
|
236
|
+
*
|
|
237
|
+
* This is the only source file in packages/core/src/ that uses the `class`
|
|
238
|
+
* keyword. `Error` is a built-in and `instanceof` branching is how composers
|
|
239
|
+
* like `retry` and `fallback` distinguish failure modes. See constraints.md §2.
|
|
240
|
+
*/
|
|
241
|
+
declare class timeout_error extends Error {
|
|
242
|
+
readonly kind: "timeout_error";
|
|
243
|
+
readonly timeout_ms: number;
|
|
244
|
+
constructor(message: string, timeout_ms: number);
|
|
245
|
+
}
|
|
246
|
+
declare class suspended_error extends Error {
|
|
247
|
+
readonly kind: "suspended_error";
|
|
248
|
+
readonly suspend_id: string;
|
|
249
|
+
readonly payload: unknown;
|
|
250
|
+
constructor(suspend_id: string, payload: unknown, message?: string);
|
|
251
|
+
}
|
|
252
|
+
declare class resume_validation_error extends Error {
|
|
253
|
+
readonly kind: "resume_validation_error";
|
|
254
|
+
readonly issues: unknown;
|
|
255
|
+
constructor(message: string, issues: unknown);
|
|
256
|
+
}
|
|
257
|
+
declare class describe_cycle_error extends Error {
|
|
258
|
+
readonly kind: "describe_cycle_error";
|
|
259
|
+
readonly step_id: string;
|
|
260
|
+
constructor(step_id: string, message?: string);
|
|
261
|
+
}
|
|
262
|
+
declare class aborted_error extends Error {
|
|
263
|
+
readonly kind: "aborted_error";
|
|
264
|
+
readonly reason?: unknown;
|
|
265
|
+
readonly step_index: number;
|
|
266
|
+
readonly tool_call_in_flight?: {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
};
|
|
270
|
+
constructor(message?: string, metadata?: {
|
|
271
|
+
reason?: unknown;
|
|
272
|
+
step_index?: number;
|
|
273
|
+
tool_call_in_flight?: {
|
|
274
|
+
id: string;
|
|
275
|
+
name: string;
|
|
276
|
+
};
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region packages/core/src/version.d.ts
|
|
281
|
+
declare const version = "0.1.13";
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region packages/core/src/index.d.ts
|
|
284
|
+
declare const flow_schema: {
|
|
285
|
+
$schema: string;
|
|
286
|
+
$id: string;
|
|
287
|
+
title: string;
|
|
288
|
+
description: string;
|
|
289
|
+
type: string;
|
|
290
|
+
items: {
|
|
291
|
+
$ref: string;
|
|
292
|
+
};
|
|
293
|
+
$defs: {
|
|
294
|
+
compose_entry: {
|
|
295
|
+
type: string;
|
|
296
|
+
required: string[];
|
|
297
|
+
properties: {
|
|
298
|
+
compose: {
|
|
299
|
+
type: string;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
allOf: {
|
|
303
|
+
$ref: string;
|
|
304
|
+
}[];
|
|
305
|
+
};
|
|
306
|
+
node: {
|
|
307
|
+
type: string;
|
|
308
|
+
anyOf: {
|
|
309
|
+
required: string[];
|
|
310
|
+
}[];
|
|
311
|
+
properties: {
|
|
312
|
+
step: {
|
|
313
|
+
$ref: string;
|
|
314
|
+
};
|
|
315
|
+
sequence: {
|
|
316
|
+
$ref: string;
|
|
317
|
+
};
|
|
318
|
+
parallel: {
|
|
319
|
+
$ref: string;
|
|
320
|
+
};
|
|
321
|
+
branch: {
|
|
322
|
+
$ref: string;
|
|
323
|
+
};
|
|
324
|
+
map: {
|
|
325
|
+
$ref: string;
|
|
326
|
+
};
|
|
327
|
+
pipe: {
|
|
328
|
+
$ref: string;
|
|
329
|
+
};
|
|
330
|
+
retry: {
|
|
331
|
+
$ref: string;
|
|
332
|
+
};
|
|
333
|
+
fallback: {
|
|
334
|
+
$ref: string;
|
|
335
|
+
};
|
|
336
|
+
timeout: {
|
|
337
|
+
$ref: string;
|
|
338
|
+
};
|
|
339
|
+
adversarial: {
|
|
340
|
+
$ref: string;
|
|
341
|
+
};
|
|
342
|
+
ensemble: {
|
|
343
|
+
$ref: string;
|
|
344
|
+
};
|
|
345
|
+
tournament: {
|
|
346
|
+
$ref: string;
|
|
347
|
+
};
|
|
348
|
+
consensus: {
|
|
349
|
+
$ref: string;
|
|
350
|
+
};
|
|
351
|
+
checkpoint: {
|
|
352
|
+
$ref: string;
|
|
353
|
+
};
|
|
354
|
+
suspend: {
|
|
355
|
+
$ref: string;
|
|
356
|
+
};
|
|
357
|
+
scope: {
|
|
358
|
+
$ref: string;
|
|
359
|
+
};
|
|
360
|
+
ref: {
|
|
361
|
+
type: string;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
step_config: {
|
|
366
|
+
type: string;
|
|
367
|
+
required: string[];
|
|
368
|
+
properties: {
|
|
369
|
+
id: {
|
|
370
|
+
type: string;
|
|
371
|
+
};
|
|
372
|
+
fn: {
|
|
373
|
+
type: string;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
sequence_config: {
|
|
378
|
+
type: string;
|
|
379
|
+
items: {
|
|
380
|
+
$ref: string;
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
parallel_config: {
|
|
384
|
+
type: string;
|
|
385
|
+
additionalProperties: {
|
|
386
|
+
$ref: string;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
branch_config: {
|
|
390
|
+
type: string;
|
|
391
|
+
required: string[];
|
|
392
|
+
properties: {
|
|
393
|
+
when: {
|
|
394
|
+
type: string;
|
|
395
|
+
};
|
|
396
|
+
then: {
|
|
397
|
+
$ref: string;
|
|
398
|
+
};
|
|
399
|
+
otherwise: {
|
|
400
|
+
$ref: string;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
map_config: {
|
|
405
|
+
type: string;
|
|
406
|
+
required: string[];
|
|
407
|
+
properties: {
|
|
408
|
+
items: {
|
|
409
|
+
type: string;
|
|
410
|
+
};
|
|
411
|
+
do: {
|
|
412
|
+
$ref: string;
|
|
413
|
+
};
|
|
414
|
+
concurrency: {
|
|
415
|
+
type: string;
|
|
416
|
+
minimum: number;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
pipe_config: {
|
|
421
|
+
type: string;
|
|
422
|
+
required: string[];
|
|
423
|
+
properties: {
|
|
424
|
+
of: {
|
|
425
|
+
$ref: string;
|
|
426
|
+
};
|
|
427
|
+
fn: {
|
|
428
|
+
type: string;
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
retry_config: {
|
|
433
|
+
type: string;
|
|
434
|
+
required: string[];
|
|
435
|
+
properties: {
|
|
436
|
+
do: {
|
|
437
|
+
$ref: string;
|
|
438
|
+
};
|
|
439
|
+
max_attempts: {
|
|
440
|
+
type: string;
|
|
441
|
+
minimum: number;
|
|
442
|
+
};
|
|
443
|
+
backoff_ms: {
|
|
444
|
+
type: string;
|
|
445
|
+
minimum: number;
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
fallback_config: {
|
|
450
|
+
type: string;
|
|
451
|
+
required: string[];
|
|
452
|
+
properties: {
|
|
453
|
+
primary: {
|
|
454
|
+
$ref: string;
|
|
455
|
+
};
|
|
456
|
+
backup: {
|
|
457
|
+
$ref: string;
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
timeout_config: {
|
|
462
|
+
type: string;
|
|
463
|
+
required: string[];
|
|
464
|
+
properties: {
|
|
465
|
+
do: {
|
|
466
|
+
$ref: string;
|
|
467
|
+
};
|
|
468
|
+
ms: {
|
|
469
|
+
type: string;
|
|
470
|
+
minimum: number;
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
adversarial_config: {
|
|
475
|
+
type: string;
|
|
476
|
+
required: string[];
|
|
477
|
+
properties: {
|
|
478
|
+
build: {
|
|
479
|
+
$ref: string;
|
|
480
|
+
};
|
|
481
|
+
critique: {
|
|
482
|
+
$ref: string;
|
|
483
|
+
};
|
|
484
|
+
accept: {
|
|
485
|
+
type: string;
|
|
486
|
+
};
|
|
487
|
+
max_rounds: {
|
|
488
|
+
type: string;
|
|
489
|
+
minimum: number;
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
ensemble_config: {
|
|
494
|
+
type: string;
|
|
495
|
+
required: string[];
|
|
496
|
+
properties: {
|
|
497
|
+
members: {
|
|
498
|
+
type: string;
|
|
499
|
+
additionalProperties: {
|
|
500
|
+
$ref: string;
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
score: {
|
|
504
|
+
type: string;
|
|
505
|
+
};
|
|
506
|
+
select: {
|
|
507
|
+
type: string;
|
|
508
|
+
enum: string[];
|
|
509
|
+
};
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
tournament_config: {
|
|
513
|
+
type: string;
|
|
514
|
+
required: string[];
|
|
515
|
+
properties: {
|
|
516
|
+
members: {
|
|
517
|
+
type: string;
|
|
518
|
+
additionalProperties: {
|
|
519
|
+
$ref: string;
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
compare: {
|
|
523
|
+
type: string;
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
consensus_config: {
|
|
528
|
+
type: string;
|
|
529
|
+
required: string[];
|
|
530
|
+
properties: {
|
|
531
|
+
members: {
|
|
532
|
+
type: string;
|
|
533
|
+
additionalProperties: {
|
|
534
|
+
$ref: string;
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
agree: {
|
|
538
|
+
type: string;
|
|
539
|
+
};
|
|
540
|
+
max_rounds: {
|
|
541
|
+
type: string;
|
|
542
|
+
minimum: number;
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
checkpoint_config: {
|
|
547
|
+
type: string;
|
|
548
|
+
required: string[];
|
|
549
|
+
properties: {
|
|
550
|
+
do: {
|
|
551
|
+
$ref: string;
|
|
552
|
+
};
|
|
553
|
+
key: {
|
|
554
|
+
type: string;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
suspend_config: {
|
|
559
|
+
type: string;
|
|
560
|
+
required: string[];
|
|
561
|
+
properties: {
|
|
562
|
+
id: {
|
|
563
|
+
type: string;
|
|
564
|
+
};
|
|
565
|
+
on: {
|
|
566
|
+
type: string;
|
|
567
|
+
};
|
|
568
|
+
resume_schema: {
|
|
569
|
+
type: string;
|
|
570
|
+
};
|
|
571
|
+
combine: {
|
|
572
|
+
type: string;
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
scope_config: {
|
|
577
|
+
type: string;
|
|
578
|
+
items: {
|
|
579
|
+
$ref: string;
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
scope_entry: {
|
|
583
|
+
type: string;
|
|
584
|
+
oneOf: ({
|
|
585
|
+
type: string;
|
|
586
|
+
required: string[];
|
|
587
|
+
properties: {
|
|
588
|
+
stash: {
|
|
589
|
+
type: string;
|
|
590
|
+
};
|
|
591
|
+
do: {
|
|
592
|
+
$ref: string;
|
|
593
|
+
};
|
|
594
|
+
use?: never;
|
|
595
|
+
};
|
|
596
|
+
} | {
|
|
597
|
+
type: string;
|
|
598
|
+
required: string[];
|
|
599
|
+
properties: {
|
|
600
|
+
use: {
|
|
601
|
+
type: string;
|
|
602
|
+
items: {
|
|
603
|
+
type: string;
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
do: {
|
|
607
|
+
$ref: string;
|
|
608
|
+
};
|
|
609
|
+
stash?: never;
|
|
610
|
+
};
|
|
611
|
+
})[];
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region packages/engine/src/version.d.ts
|
|
617
|
+
declare const version$1 = "0.1.13";
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region packages/engine/src/providers/claude_cli/types.d.ts
|
|
620
|
+
/**
|
|
621
|
+
* Public types for the claude_cli subprocess provider (spec §5.1, §5.3, §5.4).
|
|
622
|
+
*
|
|
623
|
+
* Value fields are snake_case; exported type aliases are PascalCase. These
|
|
624
|
+
* types are re-exported from packages/engine/src/index.ts so callers can
|
|
625
|
+
* narrow provider-scoped options and provider_reported values at their use
|
|
626
|
+
* site.
|
|
627
|
+
*/
|
|
628
|
+
type AuthMode = 'auto' | 'oauth' | 'api_key';
|
|
629
|
+
type SandboxProviderConfig = {
|
|
630
|
+
readonly kind: 'bwrap';
|
|
631
|
+
readonly network_allowlist?: ReadonlyArray<string>;
|
|
632
|
+
readonly additional_write_paths?: ReadonlyArray<string>;
|
|
633
|
+
} | {
|
|
634
|
+
readonly kind: 'greywall';
|
|
635
|
+
readonly network_allowlist?: ReadonlyArray<string>;
|
|
636
|
+
readonly additional_write_paths?: ReadonlyArray<string>;
|
|
637
|
+
};
|
|
638
|
+
type ClaudeCliProviderConfig = {
|
|
639
|
+
readonly binary?: string;
|
|
640
|
+
readonly auth_mode?: AuthMode;
|
|
641
|
+
readonly api_key?: string;
|
|
642
|
+
/**
|
|
643
|
+
* Under `auth_mode: 'oauth'` the subprocess env seeds from `process.env`
|
|
644
|
+
* by default so it can reach the logged-in `claude` session. Set to
|
|
645
|
+
* `false` to opt out and start from an empty env (the api_key-mode
|
|
646
|
+
* default). Ignored outside oauth mode.
|
|
647
|
+
*/
|
|
648
|
+
readonly inherit_env?: boolean;
|
|
649
|
+
readonly default_cwd?: string;
|
|
650
|
+
readonly startup_timeout_ms?: number;
|
|
651
|
+
readonly stall_timeout_ms?: number;
|
|
652
|
+
readonly setting_sources?: ReadonlyArray<'user' | 'project' | 'local'>;
|
|
653
|
+
readonly plugin_dirs?: ReadonlyArray<string>;
|
|
654
|
+
readonly sandbox?: SandboxProviderConfig;
|
|
655
|
+
readonly skip_probe?: boolean;
|
|
656
|
+
};
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region packages/engine/src/types.d.ts
|
|
659
|
+
type EffortLevel = 'none' | 'low' | 'medium' | 'high';
|
|
660
|
+
type FinishReason = 'stop' | 'tool_calls' | 'length' | 'content_filter' | 'aborted' | 'max_steps';
|
|
661
|
+
type RetryFailureKind = 'rate_limit' | 'provider_5xx' | 'network' | 'timeout';
|
|
662
|
+
type RetryPolicy = {
|
|
663
|
+
max_attempts: number;
|
|
664
|
+
initial_delay_ms: number;
|
|
665
|
+
max_delay_ms: number;
|
|
666
|
+
retry_on: ReadonlyArray<RetryFailureKind>;
|
|
667
|
+
};
|
|
668
|
+
type AliasTarget = {
|
|
669
|
+
provider: string;
|
|
670
|
+
model_id: string;
|
|
671
|
+
defaults?: {
|
|
672
|
+
temperature?: number;
|
|
673
|
+
max_tokens?: number;
|
|
674
|
+
effort?: EffortLevel;
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
type AliasTable = Readonly<Record<string, AliasTarget>>;
|
|
678
|
+
type Pricing = {
|
|
679
|
+
input_per_million: number;
|
|
680
|
+
output_per_million: number;
|
|
681
|
+
cached_input_per_million?: number;
|
|
682
|
+
cache_write_per_million?: number;
|
|
683
|
+
reasoning_per_million?: number;
|
|
684
|
+
};
|
|
685
|
+
type PricingTable = Readonly<Record<string, Pricing>>;
|
|
686
|
+
type UsageTotals = {
|
|
687
|
+
input_tokens: number;
|
|
688
|
+
output_tokens: number;
|
|
689
|
+
reasoning_tokens?: number;
|
|
690
|
+
cached_input_tokens?: number;
|
|
691
|
+
cache_write_tokens?: number;
|
|
692
|
+
};
|
|
693
|
+
type CostBreakdown = {
|
|
694
|
+
total_usd: number;
|
|
695
|
+
input_usd: number;
|
|
696
|
+
output_usd: number;
|
|
697
|
+
cached_input_usd?: number;
|
|
698
|
+
cache_write_usd?: number;
|
|
699
|
+
reasoning_usd?: number;
|
|
700
|
+
currency: 'USD';
|
|
701
|
+
is_estimate: true;
|
|
702
|
+
};
|
|
703
|
+
type ToolCallRecord = {
|
|
704
|
+
id: string;
|
|
705
|
+
name: string;
|
|
706
|
+
input: unknown;
|
|
707
|
+
output?: unknown;
|
|
708
|
+
error?: {
|
|
709
|
+
message: string;
|
|
710
|
+
stack?: string;
|
|
711
|
+
};
|
|
712
|
+
duration_ms: number;
|
|
713
|
+
started_at: number;
|
|
714
|
+
};
|
|
715
|
+
type StepRecord = {
|
|
716
|
+
index: number;
|
|
717
|
+
text: string;
|
|
718
|
+
tool_calls: ToolCallRecord[];
|
|
719
|
+
usage: UsageTotals;
|
|
720
|
+
cost?: CostBreakdown;
|
|
721
|
+
finish_reason: FinishReason;
|
|
722
|
+
};
|
|
723
|
+
type UserContentPart = {
|
|
724
|
+
type: 'text';
|
|
725
|
+
text: string;
|
|
726
|
+
} | {
|
|
727
|
+
type: 'image';
|
|
728
|
+
image: Uint8Array | string;
|
|
729
|
+
media_type?: string;
|
|
730
|
+
};
|
|
731
|
+
type AssistantContentPart = {
|
|
732
|
+
type: 'text';
|
|
733
|
+
text: string;
|
|
734
|
+
} | {
|
|
735
|
+
type: 'tool_call';
|
|
736
|
+
id: string;
|
|
737
|
+
name: string;
|
|
738
|
+
input: unknown;
|
|
739
|
+
};
|
|
740
|
+
type Message = {
|
|
741
|
+
role: 'system';
|
|
742
|
+
content: string;
|
|
743
|
+
} | {
|
|
744
|
+
role: 'user';
|
|
745
|
+
content: string | UserContentPart[];
|
|
746
|
+
} | {
|
|
747
|
+
role: 'assistant';
|
|
748
|
+
content: string | AssistantContentPart[];
|
|
749
|
+
} | {
|
|
750
|
+
role: 'tool';
|
|
751
|
+
tool_call_id: string;
|
|
752
|
+
name: string;
|
|
753
|
+
content: string;
|
|
754
|
+
};
|
|
755
|
+
type ToolExecContext = {
|
|
756
|
+
abort: AbortSignal;
|
|
757
|
+
trajectory?: TrajectoryLogger;
|
|
758
|
+
tool_call_id: string;
|
|
759
|
+
step_index: number;
|
|
760
|
+
};
|
|
761
|
+
type Tool<i = unknown, o = unknown> = {
|
|
762
|
+
name: string;
|
|
763
|
+
description: string;
|
|
764
|
+
input_schema: z.ZodType<i>;
|
|
765
|
+
execute: (input: i, ctx: ToolExecContext) => Promise<o> | o;
|
|
766
|
+
needs_approval?: boolean | ((input: i) => boolean | Promise<boolean>);
|
|
767
|
+
};
|
|
768
|
+
type ToolApprovalRequest = {
|
|
769
|
+
tool_name: string;
|
|
770
|
+
input: unknown;
|
|
771
|
+
step_index: number;
|
|
772
|
+
abort: AbortSignal;
|
|
773
|
+
};
|
|
774
|
+
type ToolApprovalHandler = (request: ToolApprovalRequest) => boolean | Promise<boolean>;
|
|
775
|
+
type StreamChunk = {
|
|
776
|
+
kind: 'text';
|
|
777
|
+
text: string;
|
|
778
|
+
step_index: number;
|
|
779
|
+
} | {
|
|
780
|
+
kind: 'reasoning';
|
|
781
|
+
text: string;
|
|
782
|
+
step_index: number;
|
|
783
|
+
} | {
|
|
784
|
+
kind: 'tool_call_start';
|
|
785
|
+
id: string;
|
|
786
|
+
name: string;
|
|
787
|
+
step_index: number;
|
|
788
|
+
} | {
|
|
789
|
+
kind: 'tool_call_input_delta';
|
|
790
|
+
id: string;
|
|
791
|
+
delta: string;
|
|
792
|
+
step_index: number;
|
|
793
|
+
} | {
|
|
794
|
+
kind: 'tool_call_end';
|
|
795
|
+
id: string;
|
|
796
|
+
input: unknown;
|
|
797
|
+
step_index: number;
|
|
798
|
+
} | {
|
|
799
|
+
kind: 'tool_result';
|
|
800
|
+
id: string;
|
|
801
|
+
output?: unknown;
|
|
802
|
+
error?: {
|
|
803
|
+
message: string;
|
|
804
|
+
};
|
|
805
|
+
step_index: number;
|
|
806
|
+
} | {
|
|
807
|
+
kind: 'step_finish';
|
|
808
|
+
step_index: number;
|
|
809
|
+
finish_reason: FinishReason;
|
|
810
|
+
usage: UsageTotals;
|
|
811
|
+
} | {
|
|
812
|
+
kind: 'finish';
|
|
813
|
+
finish_reason: FinishReason;
|
|
814
|
+
usage: UsageTotals;
|
|
815
|
+
};
|
|
816
|
+
type GenerateOptions<t = string> = {
|
|
817
|
+
model?: string;
|
|
818
|
+
prompt: string | Message[];
|
|
819
|
+
system?: string;
|
|
820
|
+
schema?: z.ZodType<t>;
|
|
821
|
+
tools?: Tool[];
|
|
822
|
+
effort?: EffortLevel;
|
|
823
|
+
temperature?: number;
|
|
824
|
+
max_tokens?: number;
|
|
825
|
+
top_p?: number;
|
|
826
|
+
max_steps?: number;
|
|
827
|
+
abort?: AbortSignal;
|
|
828
|
+
trajectory?: TrajectoryLogger;
|
|
829
|
+
on_chunk?: (chunk: StreamChunk) => void | Promise<void>;
|
|
830
|
+
retry?: RetryPolicy;
|
|
831
|
+
tool_error_policy?: 'feed_back' | 'throw';
|
|
832
|
+
schema_repair_attempts?: number;
|
|
833
|
+
on_tool_approval?: ToolApprovalHandler;
|
|
834
|
+
provider_options?: Record<string, unknown>;
|
|
835
|
+
};
|
|
836
|
+
type GenerateResult<t = string> = {
|
|
837
|
+
content: t;
|
|
838
|
+
tool_calls: ToolCallRecord[];
|
|
839
|
+
steps: StepRecord[];
|
|
840
|
+
usage: UsageTotals;
|
|
841
|
+
cost?: CostBreakdown;
|
|
842
|
+
finish_reason: FinishReason;
|
|
843
|
+
model_resolved: {
|
|
844
|
+
provider: string;
|
|
845
|
+
model_id: string;
|
|
846
|
+
};
|
|
847
|
+
provider_reported?: Record<string, unknown>;
|
|
848
|
+
};
|
|
849
|
+
type ProviderInit = {
|
|
850
|
+
api_key?: string;
|
|
851
|
+
base_url?: string;
|
|
852
|
+
[k: string]: unknown;
|
|
853
|
+
};
|
|
854
|
+
type ProviderConfigMap = {
|
|
855
|
+
anthropic?: {
|
|
856
|
+
api_key: string;
|
|
857
|
+
base_url?: string;
|
|
858
|
+
};
|
|
859
|
+
openai?: {
|
|
860
|
+
api_key: string;
|
|
861
|
+
base_url?: string;
|
|
862
|
+
organization?: string;
|
|
863
|
+
};
|
|
864
|
+
google?: {
|
|
865
|
+
api_key: string;
|
|
866
|
+
base_url?: string;
|
|
867
|
+
};
|
|
868
|
+
ollama?: {
|
|
869
|
+
base_url: string;
|
|
870
|
+
};
|
|
871
|
+
lmstudio?: {
|
|
872
|
+
base_url: string;
|
|
873
|
+
};
|
|
874
|
+
openrouter?: {
|
|
875
|
+
api_key: string;
|
|
876
|
+
base_url?: string;
|
|
877
|
+
http_referer?: string;
|
|
878
|
+
x_title?: string;
|
|
879
|
+
};
|
|
880
|
+
claude_cli?: ClaudeCliProviderConfig;
|
|
881
|
+
[custom: string]: ProviderInit | undefined;
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* Call-level defaults applied by the engine before dispatching to a provider.
|
|
885
|
+
*
|
|
886
|
+
* Per-call options from `generate(opts)` win over defaults using these rules:
|
|
887
|
+
*
|
|
888
|
+
* | Field | Rule |
|
|
889
|
+
* | --------------------------------------------------------------------- | ----------------------------------------- |
|
|
890
|
+
* | `model` | per-call wins; else default; else throw |
|
|
891
|
+
* | `system`, `effort`, `max_steps`, `tool_error_policy`, `schema_repair_attempts` | per-call wins (nullish coalesce) |
|
|
892
|
+
* | `retry_policy` | per-call replaces wholesale |
|
|
893
|
+
* | `provider_options` | two-level: per-provider-key shallow merge |
|
|
894
|
+
* | `prompt`, `tools`, `schema`, `abort`, `trajectory`, `on_chunk` | not defaultable; always call-supplied |
|
|
895
|
+
*/
|
|
896
|
+
type EngineDefaults = {
|
|
897
|
+
readonly model?: string;
|
|
898
|
+
readonly system?: string;
|
|
899
|
+
readonly effort?: EffortLevel;
|
|
900
|
+
readonly max_steps?: number;
|
|
901
|
+
readonly retry_policy?: RetryPolicy;
|
|
902
|
+
readonly tool_error_policy?: 'feed_back' | 'throw';
|
|
903
|
+
readonly schema_repair_attempts?: number;
|
|
904
|
+
readonly provider_options?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
905
|
+
};
|
|
906
|
+
type EngineConfig = {
|
|
907
|
+
providers: ProviderConfigMap;
|
|
908
|
+
aliases?: AliasTable;
|
|
909
|
+
pricing?: PricingTable;
|
|
910
|
+
default_retry?: RetryPolicy;
|
|
911
|
+
default_effort?: EffortLevel;
|
|
912
|
+
default_max_steps?: number;
|
|
913
|
+
defaults?: EngineDefaults;
|
|
914
|
+
};
|
|
915
|
+
type Engine = {
|
|
916
|
+
generate: <t = string>(opts: GenerateOptions<t>) => Promise<GenerateResult<t>>;
|
|
917
|
+
register_alias: (alias: string, target: AliasTarget) => void;
|
|
918
|
+
unregister_alias: (alias: string) => void;
|
|
919
|
+
resolve_alias: (alias: string) => AliasTarget;
|
|
920
|
+
list_aliases: () => AliasTable;
|
|
921
|
+
register_price: (provider: string, model_id: string, pricing: Pricing) => void;
|
|
922
|
+
resolve_price: (provider: string, model_id: string) => Pricing | undefined;
|
|
923
|
+
list_prices: () => PricingTable;
|
|
924
|
+
dispose: () => Promise<void>;
|
|
925
|
+
};
|
|
926
|
+
//#endregion
|
|
927
|
+
//#region packages/engine/src/create_engine.d.ts
|
|
928
|
+
declare function create_engine(config: EngineConfig): Engine;
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region packages/engine/src/errors.d.ts
|
|
931
|
+
declare class rate_limit_error extends Error {
|
|
932
|
+
readonly kind: "rate_limit_error";
|
|
933
|
+
readonly retry_after_ms?: number;
|
|
934
|
+
readonly attempts: number;
|
|
935
|
+
readonly status?: number;
|
|
936
|
+
constructor(message: string, metadata?: {
|
|
937
|
+
retry_after_ms?: number;
|
|
938
|
+
attempts?: number;
|
|
939
|
+
status?: number;
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
declare class provider_error extends Error {
|
|
943
|
+
readonly kind: "provider_error";
|
|
944
|
+
readonly status?: number;
|
|
945
|
+
readonly body?: string;
|
|
946
|
+
readonly cause_kind?: 'provider_5xx' | 'network' | 'unknown';
|
|
947
|
+
constructor(message: string, metadata?: {
|
|
948
|
+
status?: number;
|
|
949
|
+
body?: string;
|
|
950
|
+
cause_kind?: 'provider_5xx' | 'network' | 'unknown';
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
declare class schema_validation_error extends Error {
|
|
954
|
+
readonly kind: "schema_validation_error";
|
|
955
|
+
readonly zod_error: unknown;
|
|
956
|
+
readonly raw_text: string;
|
|
957
|
+
constructor(message: string, zod_error: unknown, raw_text: string);
|
|
958
|
+
}
|
|
959
|
+
declare class tool_error extends Error {
|
|
960
|
+
readonly kind: "tool_error";
|
|
961
|
+
readonly tool_name: string;
|
|
962
|
+
readonly tool_call_id: string;
|
|
963
|
+
readonly cause: unknown;
|
|
964
|
+
constructor(message: string, metadata: {
|
|
965
|
+
tool_name: string;
|
|
966
|
+
tool_call_id: string;
|
|
967
|
+
cause: unknown;
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
declare class tool_approval_denied_error extends Error {
|
|
971
|
+
readonly kind: "tool_approval_denied_error";
|
|
972
|
+
readonly tool_name: string;
|
|
973
|
+
readonly step_index: number;
|
|
974
|
+
readonly tool_call_id: string;
|
|
975
|
+
constructor(message: string, metadata: {
|
|
976
|
+
tool_name: string;
|
|
977
|
+
step_index: number;
|
|
978
|
+
tool_call_id: string;
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
declare class model_not_found_error extends Error {
|
|
982
|
+
readonly kind: "model_not_found_error";
|
|
983
|
+
readonly model: string;
|
|
984
|
+
readonly registered: ReadonlyArray<string>;
|
|
985
|
+
constructor(model: string, registered: ReadonlyArray<string>);
|
|
986
|
+
}
|
|
987
|
+
declare class provider_not_configured_error extends Error {
|
|
988
|
+
readonly kind: "provider_not_configured_error";
|
|
989
|
+
readonly provider: string;
|
|
990
|
+
constructor(provider: string);
|
|
991
|
+
}
|
|
992
|
+
declare class engine_config_error extends Error {
|
|
993
|
+
readonly kind: "engine_config_error";
|
|
994
|
+
readonly provider?: string;
|
|
995
|
+
constructor(message: string, provider?: string);
|
|
996
|
+
}
|
|
997
|
+
declare class on_chunk_error extends Error {
|
|
998
|
+
readonly kind: "on_chunk_error";
|
|
999
|
+
readonly cause: unknown;
|
|
1000
|
+
constructor(message: string, cause: unknown);
|
|
1001
|
+
}
|
|
1002
|
+
declare class provider_capability_error extends Error {
|
|
1003
|
+
readonly kind: "provider_capability_error";
|
|
1004
|
+
readonly provider: string;
|
|
1005
|
+
readonly capability: string;
|
|
1006
|
+
constructor(provider: string, capability: string, detail?: string);
|
|
1007
|
+
}
|
|
1008
|
+
//#endregion
|
|
1009
|
+
//#region packages/fascicle/src/model_call.d.ts
|
|
1010
|
+
type ModelCallInput = string | ReadonlyArray<Message>;
|
|
1011
|
+
type ModelCallConfig<T = unknown> = {
|
|
1012
|
+
readonly engine: Engine;
|
|
1013
|
+
/**
|
|
1014
|
+
* Model or alias string. Optional: if omitted, the engine's
|
|
1015
|
+
* `defaults.model` is used. Errors at call time if neither is set.
|
|
1016
|
+
*/
|
|
1017
|
+
readonly model?: string;
|
|
1018
|
+
readonly id?: string;
|
|
1019
|
+
readonly system?: string;
|
|
1020
|
+
readonly tools?: ReadonlyArray<Tool>;
|
|
1021
|
+
readonly schema?: z.ZodType<T>;
|
|
1022
|
+
readonly effort?: EffortLevel;
|
|
1023
|
+
readonly max_steps?: number;
|
|
1024
|
+
readonly provider_options?: Record<string, unknown>;
|
|
1025
|
+
readonly retry_policy?: RetryPolicy;
|
|
1026
|
+
readonly tool_error_policy?: 'feed_back' | 'throw';
|
|
1027
|
+
readonly schema_repair_attempts?: number;
|
|
1028
|
+
readonly on_tool_approval?: ToolApprovalHandler;
|
|
1029
|
+
};
|
|
1030
|
+
declare function model_call<T = unknown>(cfg: ModelCallConfig<T>): Step<ModelCallInput, GenerateResult<T>>;
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region packages/fascicle/src/forward_standard_env.d.ts
|
|
1033
|
+
declare function forward_standard_env(): Record<string, string>;
|
|
1034
|
+
//#endregion
|
|
1035
|
+
export { type AliasTable, type AliasTarget, type AssistantContentPart, type CheckpointStore, type CostBreakdown, type DescribeOptions, type EffortLevel, type Engine, type EngineConfig, type EngineDefaults, type FinishReason, type FlowNode, type FlowValue, type GenerateOptions, type GenerateResult, type Message, type ModelCallConfig, type ModelCallInput, type Pricing, type PricingTable, type ProviderConfigMap, type ProviderInit, type RetryFailureKind, type RetryPolicy, type RunContext, type Step, type StepRecord, type StreamChunk, type Tool, type ToolApprovalHandler, type ToolApprovalRequest, type ToolCallRecord, type ToolExecContext, type TrajectoryEvent, type TrajectoryLogger, type UsageTotals, type UserContentPart, aborted_error, adversarial, branch, checkpoint, consensus, version as core_version, create_engine, describe, describe_cycle_error, engine_config_error, version$1 as engine_version, ensemble, fallback, flow_schema, forward_standard_env, map, model_call, model_not_found_error, on_chunk_error, parallel, pipe, provider_capability_error, provider_error, provider_not_configured_error, rate_limit_error, resume_validation_error, retry, run, schema_validation_error, scope, sequence, stash, step, suspend, suspended_error, timeout, timeout_error, tool_approval_denied_error, tool_error, tournament, use };
|
|
1036
|
+
//# sourceMappingURL=index.d.ts.map
|