@fifthrevision/axle 0.6.6 → 0.7.1
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/README.md +285 -11
- package/dist/cli.js +6 -6
- package/dist/index.d.ts +584 -1025
- package/dist/index.js +1 -3
- package/dist/simple-DFkTLK9N.js +28 -0
- package/package.json +13 -12
- package/dist/consoleWriter-C6SvRPzi.js +0 -31
package/dist/index.d.ts
CHANGED
|
@@ -1,208 +1,13 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
import
|
|
3
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
4
|
-
import { GoogleGenAI } from '@google/genai';
|
|
5
|
-
import OpenAI from 'openai';
|
|
2
|
+
import { ZodObject, z as z$1 } from 'zod';
|
|
6
3
|
|
|
7
|
-
type PlainObject = Record<string, unknown>;
|
|
8
|
-
type ProgramOptions = {
|
|
9
|
-
dryRun?: boolean;
|
|
10
|
-
config?: string;
|
|
11
|
-
warnUnused?: boolean;
|
|
12
|
-
job?: string;
|
|
13
|
-
log?: boolean;
|
|
14
|
-
debug?: boolean;
|
|
15
|
-
args?: string[];
|
|
16
|
-
};
|
|
17
4
|
interface Stats {
|
|
18
5
|
in: number;
|
|
19
6
|
out: number;
|
|
20
7
|
}
|
|
21
8
|
|
|
22
|
-
interface RecorderLevelFunctions {
|
|
23
|
-
log: (...message: (string | unknown | Error)[]) => void;
|
|
24
|
-
heading: {
|
|
25
|
-
log: (...message: (string | unknown | Error)[]) => void;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
type RecorderEntry = {
|
|
29
|
-
level: LogLevel;
|
|
30
|
-
time: number;
|
|
31
|
-
kind: VisualLevel;
|
|
32
|
-
payload: PlainObject[];
|
|
33
|
-
};
|
|
34
|
-
type VisualLevel = "heading" | "body";
|
|
35
|
-
declare enum LogLevel {
|
|
36
|
-
Trace = 10,
|
|
37
|
-
Debug = 20,
|
|
38
|
-
Info = 30,
|
|
39
|
-
Warn = 40,
|
|
40
|
-
Error = 50,
|
|
41
|
-
Fatal = 60
|
|
42
|
-
}
|
|
43
|
-
interface RecorderWriter {
|
|
44
|
-
handleEvent(event: RecorderEntry): void | Promise<void>;
|
|
45
|
-
flush?(): Promise<void>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
declare class Recorder {
|
|
49
|
-
instanceId: `${string}-${string}-${string}-${string}-${string}`;
|
|
50
|
-
private currentLevel;
|
|
51
|
-
private logs;
|
|
52
|
-
private writers;
|
|
53
|
-
private _debug;
|
|
54
|
-
private _info;
|
|
55
|
-
private _warn;
|
|
56
|
-
private _error;
|
|
57
|
-
constructor();
|
|
58
|
-
buildMethods(): void;
|
|
59
|
-
set level(level: LogLevel);
|
|
60
|
-
get level(): LogLevel;
|
|
61
|
-
get info(): RecorderLevelFunctions;
|
|
62
|
-
get warn(): RecorderLevelFunctions;
|
|
63
|
-
get error(): RecorderLevelFunctions;
|
|
64
|
-
get debug(): RecorderLevelFunctions;
|
|
65
|
-
subscribe(writer: RecorderWriter): void;
|
|
66
|
-
unsubscribe(writer: RecorderWriter): void;
|
|
67
|
-
private publish;
|
|
68
|
-
private logFunction;
|
|
69
|
-
private createLoggingFunction;
|
|
70
|
-
getLogs(level?: LogLevel): RecorderEntry[];
|
|
71
|
-
/**
|
|
72
|
-
* Ensures all writers have completed their pending operations
|
|
73
|
-
* Call this before exiting the process to ensure logs are written
|
|
74
|
-
*/
|
|
75
|
-
shutdown(): Promise<void>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
interface Tool<TSchema extends ZodObject<any> = ZodObject<any>> {
|
|
79
|
-
name: string;
|
|
80
|
-
description: string;
|
|
81
|
-
schema: TSchema;
|
|
82
|
-
execute(input: z$1.infer<TSchema>): Promise<string>;
|
|
83
|
-
configure?(config: Record<string, any>): void;
|
|
84
|
-
}
|
|
85
|
-
type ToolDefinition = Pick<Tool, "name" | "description" | "schema">;
|
|
86
|
-
|
|
87
|
-
interface FileInfo {
|
|
88
|
-
path: string;
|
|
89
|
-
base64?: string;
|
|
90
|
-
content?: string;
|
|
91
|
-
mimeType: string;
|
|
92
|
-
size: number;
|
|
93
|
-
name: string;
|
|
94
|
-
type: "image" | "document" | "text";
|
|
95
|
-
}
|
|
96
|
-
type TextFileInfo = FileInfo & {
|
|
97
|
-
content: string;
|
|
98
|
-
base64?: never;
|
|
99
|
-
type: "text";
|
|
100
|
-
};
|
|
101
|
-
type Base64FileInfo = FileInfo & {
|
|
102
|
-
base64: string;
|
|
103
|
-
content?: never;
|
|
104
|
-
type: "image" | "document";
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
declare enum ResultType {
|
|
108
|
-
String = "string",
|
|
109
|
-
List = "string[]",
|
|
110
|
-
Number = "number",
|
|
111
|
-
Boolean = "boolean"
|
|
112
|
-
}
|
|
113
|
-
type ResultTypeUnion = `${ResultType}`;
|
|
114
|
-
type DeclarativeSchema = {
|
|
115
|
-
[key: string]: ResultTypeUnion | DeclarativeSchema | DeclarativeSchema[];
|
|
116
|
-
};
|
|
117
|
-
type OutputSchema = Record<string, z__default.ZodTypeAny>;
|
|
118
|
-
type InferedOutputSchema<T extends OutputSchema> = {
|
|
119
|
-
[K in keyof T]: z__default.output<T[K]>;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
declare abstract class AbstractInstruct<T extends OutputSchema> {
|
|
123
|
-
readonly name = "instruct";
|
|
124
|
-
prompt: string;
|
|
125
|
-
system: string | null;
|
|
126
|
-
inputs: Record<string, string>;
|
|
127
|
-
tools: Record<string, Tool>;
|
|
128
|
-
files: Base64FileInfo[];
|
|
129
|
-
textReferences: Array<{
|
|
130
|
-
content: string;
|
|
131
|
-
name?: string;
|
|
132
|
-
}>;
|
|
133
|
-
instructions: string[];
|
|
134
|
-
schema: T;
|
|
135
|
-
rawResponse: string;
|
|
136
|
-
protected _taggedSections: {
|
|
137
|
-
tags: Record<string, string>;
|
|
138
|
-
remaining: string;
|
|
139
|
-
} | undefined;
|
|
140
|
-
protected _result: InferedOutputSchema<T> | undefined;
|
|
141
|
-
protected constructor(prompt: string, schema: T);
|
|
142
|
-
setInputs(inputs: Record<string, string>): void;
|
|
143
|
-
addInput(name: string, value: string): void;
|
|
144
|
-
addTools(tools: Tool[]): void;
|
|
145
|
-
addTool(tool: Tool): void;
|
|
146
|
-
addImage(file: FileInfo): void;
|
|
147
|
-
addDocument(file: FileInfo): void;
|
|
148
|
-
addFile(file: FileInfo): void;
|
|
149
|
-
addReference(textFile: FileInfo | TextFileInfo | string, options?: {
|
|
150
|
-
name?: string;
|
|
151
|
-
}): void;
|
|
152
|
-
addInstructions(instruction: string): void;
|
|
153
|
-
hasTools(): boolean;
|
|
154
|
-
hasFiles(): boolean;
|
|
155
|
-
get result(): InferedOutputSchema<T> | undefined;
|
|
156
|
-
compile(variables: Record<string, string>, runtime?: {
|
|
157
|
-
recorder?: Recorder;
|
|
158
|
-
options?: {
|
|
159
|
-
warnUnused?: boolean;
|
|
160
|
-
};
|
|
161
|
-
}): {
|
|
162
|
-
message: string;
|
|
163
|
-
instructions: string;
|
|
164
|
-
};
|
|
165
|
-
protected createUserMessage(variables: Record<string, string>, runtime?: {
|
|
166
|
-
recorder?: Recorder;
|
|
167
|
-
options?: {
|
|
168
|
-
warnUnused?: boolean;
|
|
169
|
-
};
|
|
170
|
-
}): string;
|
|
171
|
-
protected createInstructions(instructions?: string): string;
|
|
172
|
-
protected generateFieldInstructions(key: string, schema: z.ZodTypeAny): string;
|
|
173
|
-
finalize(rawValue: string, runtime?: {
|
|
174
|
-
recorder?: Recorder;
|
|
175
|
-
}): InferedOutputSchema<T>;
|
|
176
|
-
private preprocessValue;
|
|
177
|
-
protected parseTaggedSections(input: string): {
|
|
178
|
-
tags: Record<string, string>;
|
|
179
|
-
remaining: string;
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
declare class Instruct<T extends OutputSchema> extends AbstractInstruct<T> {
|
|
184
|
-
constructor(prompt: string, schema: T);
|
|
185
|
-
static with<T extends OutputSchema>(prompt: string, schema: T): Instruct<T>;
|
|
186
|
-
static with<T extends DeclarativeSchema>(prompt: string, schema: T): Instruct<OutputSchema>;
|
|
187
|
-
static with(prompt: string): Instruct<{
|
|
188
|
-
response: z.ZodString;
|
|
189
|
-
}>;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
interface ActionContext {
|
|
193
|
-
input: string;
|
|
194
|
-
variables: Record<string, any>;
|
|
195
|
-
options?: ProgramOptions;
|
|
196
|
-
recorder?: Recorder;
|
|
197
|
-
}
|
|
198
|
-
interface Action {
|
|
199
|
-
name: string;
|
|
200
|
-
execute(context: ActionContext): Promise<string | void>;
|
|
201
|
-
}
|
|
202
|
-
type WorkflowStep = Instruct<any> | Action;
|
|
203
|
-
|
|
204
9
|
interface StreamChunk {
|
|
205
|
-
type: "start" | "text" | "
|
|
10
|
+
type: "start" | "text-start" | "text-delta" | "text-complete" | "tool-call-start" | "tool-call-complete" | "thinking-start" | "thinking-delta" | "thinking-summary-delta" | "thinking-complete" | "internal-tool-start" | "internal-tool-complete" | "complete" | "error";
|
|
206
11
|
id?: string;
|
|
207
12
|
data?: any;
|
|
208
13
|
}
|
|
@@ -221,10 +26,31 @@ interface StreamCompleteChunk extends StreamChunk {
|
|
|
221
26
|
usage: Stats;
|
|
222
27
|
};
|
|
223
28
|
}
|
|
224
|
-
interface
|
|
225
|
-
type: "
|
|
29
|
+
interface StreamErrorChunk extends StreamChunk {
|
|
30
|
+
type: "error";
|
|
226
31
|
data: {
|
|
32
|
+
type: string;
|
|
33
|
+
message: string;
|
|
34
|
+
usage?: Stats;
|
|
35
|
+
raw?: any;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface StreamTextStartChunk extends StreamChunk {
|
|
39
|
+
type: "text-start";
|
|
40
|
+
data: {
|
|
41
|
+
index: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
interface StreamTextDeltaChunk extends StreamChunk {
|
|
45
|
+
type: "text-delta";
|
|
46
|
+
data: {
|
|
47
|
+
index: number;
|
|
227
48
|
text: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface StreamTextCompleteChunk extends StreamChunk {
|
|
52
|
+
type: "text-complete";
|
|
53
|
+
data: {
|
|
228
54
|
index: number;
|
|
229
55
|
};
|
|
230
56
|
}
|
|
@@ -232,7 +58,9 @@ interface StreamThinkingStartChunk extends StreamChunk {
|
|
|
232
58
|
type: "thinking-start";
|
|
233
59
|
data: {
|
|
234
60
|
index: number;
|
|
61
|
+
id?: string;
|
|
235
62
|
redacted?: boolean;
|
|
63
|
+
signature?: string;
|
|
236
64
|
};
|
|
237
65
|
}
|
|
238
66
|
interface StreamThinkingDeltaChunk extends StreamChunk {
|
|
@@ -242,6 +70,19 @@ interface StreamThinkingDeltaChunk extends StreamChunk {
|
|
|
242
70
|
text: string;
|
|
243
71
|
};
|
|
244
72
|
}
|
|
73
|
+
interface StreamThinkingSummaryDeltaChunk extends StreamChunk {
|
|
74
|
+
type: "thinking-summary-delta";
|
|
75
|
+
data: {
|
|
76
|
+
index: number;
|
|
77
|
+
text: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
interface StreamThinkingCompleteChunk extends StreamChunk {
|
|
81
|
+
type: "thinking-complete";
|
|
82
|
+
data: {
|
|
83
|
+
index: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
245
86
|
interface StreamToolCallStartChunk extends StreamChunk {
|
|
246
87
|
type: "tool-call-start";
|
|
247
88
|
data: {
|
|
@@ -259,93 +100,126 @@ interface StreamToolCallCompleteChunk extends StreamChunk {
|
|
|
259
100
|
arguments: any;
|
|
260
101
|
};
|
|
261
102
|
}
|
|
262
|
-
interface
|
|
263
|
-
type: "
|
|
103
|
+
interface StreamInternalToolStartChunk extends StreamChunk {
|
|
104
|
+
type: "internal-tool-start";
|
|
264
105
|
data: {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
raw?: any;
|
|
106
|
+
index: number;
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
269
109
|
};
|
|
270
110
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
interface AxleAssistantMessage {
|
|
280
|
-
role: "assistant";
|
|
281
|
-
id: string;
|
|
282
|
-
model?: string;
|
|
283
|
-
content: Array<ContentPartText | ContentPartThinking | ContentPartToolCall>;
|
|
284
|
-
finishReason?: AxleStopReason;
|
|
111
|
+
interface StreamInternalToolCompleteChunk extends StreamChunk {
|
|
112
|
+
type: "internal-tool-complete";
|
|
113
|
+
data: {
|
|
114
|
+
index: number;
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
output?: unknown;
|
|
118
|
+
};
|
|
285
119
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
120
|
+
type AnyStreamChunk = StreamStartChunk | StreamCompleteChunk | StreamErrorChunk | StreamTextStartChunk | StreamTextDeltaChunk | StreamTextCompleteChunk | StreamThinkingStartChunk | StreamThinkingDeltaChunk | StreamThinkingSummaryDeltaChunk | StreamThinkingCompleteChunk | StreamToolCallStartChunk | StreamToolCallCompleteChunk | StreamInternalToolStartChunk | StreamInternalToolCompleteChunk;
|
|
121
|
+
|
|
122
|
+
interface Tool<TSchema extends ZodObject<any> = ZodObject<any>> {
|
|
123
|
+
name: string;
|
|
124
|
+
description: string;
|
|
125
|
+
schema: TSchema;
|
|
126
|
+
execute(input: z$1.infer<TSchema>): Promise<string>;
|
|
127
|
+
configure?(config: Record<string, any>): void;
|
|
128
|
+
summarize?(input: z$1.infer<TSchema>): string;
|
|
289
129
|
}
|
|
290
|
-
|
|
291
|
-
|
|
130
|
+
type ToolDefinition = Pick<Tool, "name" | "description" | "schema">;
|
|
131
|
+
|
|
132
|
+
type SpanStatus = "ok" | "error";
|
|
133
|
+
type EventLevel = "debug" | "info" | "warn" | "error";
|
|
134
|
+
type SpanType = string;
|
|
135
|
+
interface SpanEvent {
|
|
292
136
|
name: string;
|
|
293
|
-
|
|
137
|
+
timestamp: number;
|
|
138
|
+
level: EventLevel;
|
|
139
|
+
attributes?: Record<string, unknown>;
|
|
140
|
+
}
|
|
141
|
+
interface SpanData {
|
|
142
|
+
traceId: string;
|
|
143
|
+
spanId: string;
|
|
144
|
+
parentSpanId?: string;
|
|
145
|
+
name: string;
|
|
146
|
+
type?: SpanType;
|
|
147
|
+
startTime: number;
|
|
148
|
+
endTime?: number;
|
|
149
|
+
status: SpanStatus;
|
|
150
|
+
attributes: Record<string, unknown>;
|
|
151
|
+
events: SpanEvent[];
|
|
152
|
+
result?: SpanResult;
|
|
153
|
+
}
|
|
154
|
+
interface SpanOptions {
|
|
155
|
+
type?: SpanType;
|
|
156
|
+
}
|
|
157
|
+
type SpanResult = LLMResult | ToolResult;
|
|
158
|
+
interface LLMResult {
|
|
159
|
+
kind: "llm";
|
|
160
|
+
model: string;
|
|
161
|
+
request: LLMRequest;
|
|
162
|
+
response: LLMResponse;
|
|
163
|
+
usage?: TokenUsage;
|
|
164
|
+
finishReason?: string;
|
|
294
165
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
166
|
+
interface LLMRequest {
|
|
167
|
+
messages: unknown[];
|
|
168
|
+
system?: string;
|
|
169
|
+
tools?: unknown[];
|
|
299
170
|
}
|
|
300
|
-
interface
|
|
301
|
-
|
|
302
|
-
file: FileInfo;
|
|
171
|
+
interface LLMResponse {
|
|
172
|
+
content: unknown;
|
|
303
173
|
}
|
|
304
|
-
interface
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
encrypted?: string;
|
|
309
|
-
signature?: string;
|
|
174
|
+
interface TokenUsage {
|
|
175
|
+
inputTokens?: number;
|
|
176
|
+
outputTokens?: number;
|
|
177
|
+
totalTokens?: number;
|
|
310
178
|
}
|
|
311
|
-
interface
|
|
312
|
-
|
|
313
|
-
id: string;
|
|
179
|
+
interface ToolResult {
|
|
180
|
+
kind: "tool";
|
|
314
181
|
name: string;
|
|
315
|
-
|
|
182
|
+
input: unknown;
|
|
183
|
+
output: unknown;
|
|
184
|
+
}
|
|
185
|
+
interface TraceWriter {
|
|
186
|
+
onSpanStart(span: SpanData): void;
|
|
187
|
+
onSpanUpdate?(span: SpanData): void;
|
|
188
|
+
onSpanEnd(span: SpanData): void;
|
|
189
|
+
onEvent?(span: SpanData, event: SpanEvent): void;
|
|
190
|
+
onLLMStreamStart?(span: SpanData): void;
|
|
191
|
+
onLLMStreamChunk?(span: SpanData, chunk: string): void;
|
|
192
|
+
onLLMStreamEnd?(span: SpanData, result: LLMResult): void;
|
|
193
|
+
flush?(): Promise<void>;
|
|
316
194
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
interface AIProviderConfig {
|
|
335
|
-
ollama: OllamaProviderConfig;
|
|
336
|
-
anthropic: AnthropicProviderConfig;
|
|
337
|
-
openai: OpenAIProviderConfig;
|
|
338
|
-
gemini: GeminiProviderConfig;
|
|
195
|
+
/**
|
|
196
|
+
* Tracing context for a span. Created by Tracer.startSpan().
|
|
197
|
+
* Can create child spans and log events within the span's scope.
|
|
198
|
+
*/
|
|
199
|
+
interface TracingContext {
|
|
200
|
+
startSpan(name: string, options?: SpanOptions): TracingContext;
|
|
201
|
+
end(status?: SpanStatus): void;
|
|
202
|
+
debug(message: string, attributes?: Record<string, unknown>): void;
|
|
203
|
+
info(message: string, attributes?: Record<string, unknown>): void;
|
|
204
|
+
warn(message: string, attributes?: Record<string, unknown>): void;
|
|
205
|
+
error(message: string, attributes?: Record<string, unknown>): void;
|
|
206
|
+
setAttribute(key: string, value: unknown): void;
|
|
207
|
+
setAttributes(attributes: Record<string, unknown>): void;
|
|
208
|
+
setResult(result: SpanResult): void;
|
|
209
|
+
startLLMStream(): void;
|
|
210
|
+
appendLLMStream(chunk: string): void;
|
|
211
|
+
endLLMStream(result: LLMResult): void;
|
|
339
212
|
}
|
|
213
|
+
|
|
340
214
|
interface AIProvider {
|
|
341
215
|
get name(): string;
|
|
342
|
-
|
|
343
|
-
createGenerationRequest(params: {
|
|
216
|
+
/** @internal */
|
|
217
|
+
createGenerationRequest(model: string, params: {
|
|
344
218
|
messages: Array<AxleMessage>;
|
|
345
219
|
system?: string;
|
|
346
220
|
tools?: Array<ToolDefinition>;
|
|
347
221
|
context: {
|
|
348
|
-
|
|
222
|
+
tracer?: TracingContext;
|
|
349
223
|
};
|
|
350
224
|
options?: {
|
|
351
225
|
temperature?: number;
|
|
@@ -357,13 +231,15 @@ interface AIProvider {
|
|
|
357
231
|
[key: string]: any;
|
|
358
232
|
};
|
|
359
233
|
}): Promise<ModelResult>;
|
|
360
|
-
|
|
234
|
+
/** @internal */
|
|
235
|
+
createStreamingRequest?(model: string, params: {
|
|
361
236
|
messages: Array<AxleMessage>;
|
|
362
237
|
system?: string;
|
|
363
238
|
tools?: Array<ToolDefinition>;
|
|
364
239
|
context: {
|
|
365
|
-
|
|
240
|
+
tracer?: TracingContext;
|
|
366
241
|
};
|
|
242
|
+
signal?: AbortSignal;
|
|
367
243
|
options?: {
|
|
368
244
|
temperature?: number;
|
|
369
245
|
top_p?: number;
|
|
@@ -397,367 +273,114 @@ interface ModelError {
|
|
|
397
273
|
}
|
|
398
274
|
type ModelResult = ModelResponse | ModelError;
|
|
399
275
|
declare enum AxleStopReason {
|
|
400
|
-
Stop =
|
|
401
|
-
Length =
|
|
402
|
-
FunctionCall =
|
|
403
|
-
Error =
|
|
404
|
-
Custom =
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
declare class AxleError extends Error {
|
|
408
|
-
readonly code: string;
|
|
409
|
-
readonly id?: string;
|
|
410
|
-
readonly details?: Record<string, any>;
|
|
411
|
-
constructor(message: string, options?: {
|
|
412
|
-
code?: string;
|
|
413
|
-
id?: string;
|
|
414
|
-
details?: Record<string, any>;
|
|
415
|
-
cause?: Error;
|
|
416
|
-
});
|
|
276
|
+
Stop = "stop",
|
|
277
|
+
Length = "length",
|
|
278
|
+
FunctionCall = "function_call",
|
|
279
|
+
Error = "error",
|
|
280
|
+
Custom = "custom",
|
|
281
|
+
Cancelled = "cancelled"
|
|
417
282
|
}
|
|
418
283
|
|
|
419
|
-
interface
|
|
420
|
-
|
|
284
|
+
interface FileInfo {
|
|
285
|
+
path: string;
|
|
286
|
+
base64?: string;
|
|
287
|
+
content?: string;
|
|
288
|
+
mimeType: string;
|
|
289
|
+
size: number;
|
|
290
|
+
name: string;
|
|
291
|
+
type: "image" | "document" | "text";
|
|
421
292
|
}
|
|
293
|
+
type TextFileInfo = FileInfo & {
|
|
294
|
+
content: string;
|
|
295
|
+
base64?: never;
|
|
296
|
+
type: "text";
|
|
297
|
+
};
|
|
298
|
+
type Base64FileInfo = FileInfo & {
|
|
299
|
+
base64: string;
|
|
300
|
+
content?: never;
|
|
301
|
+
type: "image" | "document";
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Load a file with the specified encoding or auto-detect based on file extension
|
|
305
|
+
* @param filePath - Path to the file
|
|
306
|
+
* @param encoding - How to load the file: "utf-8" for text, "base64" for binary, or omit for auto-detection
|
|
307
|
+
* @returns FileInfo object with appropriate content based on encoding
|
|
308
|
+
*/
|
|
309
|
+
declare function loadFileContent(filePath: string): Promise<FileInfo>;
|
|
310
|
+
declare function loadFileContent(filePath: string, encoding: "utf-8"): Promise<TextFileInfo>;
|
|
311
|
+
declare function loadFileContent(filePath: string, encoding: "base64"): Promise<Base64FileInfo>;
|
|
422
312
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
response: string;
|
|
429
|
-
stats: Stats;
|
|
430
|
-
}
|
|
431
|
-
interface WorkflowResult<T = any> {
|
|
432
|
-
response: T;
|
|
433
|
-
stats?: Stats;
|
|
434
|
-
error?: AxleError;
|
|
435
|
-
success: boolean;
|
|
436
|
-
}
|
|
437
|
-
interface WorkflowExecutable {
|
|
438
|
-
execute: (context: {
|
|
439
|
-
provider: AIProvider;
|
|
440
|
-
variables: Record<string, any>;
|
|
441
|
-
options?: ProgramOptions;
|
|
442
|
-
stats?: Stats;
|
|
443
|
-
recorder?: Recorder;
|
|
444
|
-
name?: string;
|
|
445
|
-
}) => Promise<WorkflowResult>;
|
|
446
|
-
}
|
|
447
|
-
interface DAGNodeDefinition {
|
|
448
|
-
step: WorkflowStep | WorkflowStep[];
|
|
449
|
-
dependsOn?: string | string[];
|
|
450
|
-
}
|
|
451
|
-
interface DAGConcurrentNodeDefinition {
|
|
452
|
-
planner: Planner;
|
|
453
|
-
steps: WorkflowStep[];
|
|
454
|
-
dependsOn?: string | string[];
|
|
455
|
-
}
|
|
456
|
-
interface DAGDefinition {
|
|
457
|
-
[nodeName: string]: WorkflowStep | WorkflowStep[] | DAGNodeDefinition | DAGConcurrentNodeDefinition;
|
|
313
|
+
type AxleMessage = AxleUserMessage | AxleAssistantMessage | AxleToolCallMessage;
|
|
314
|
+
interface AxleUserMessage {
|
|
315
|
+
role: "user";
|
|
316
|
+
name?: string;
|
|
317
|
+
content: string | Array<ContentPart>;
|
|
458
318
|
}
|
|
459
|
-
interface
|
|
460
|
-
|
|
461
|
-
|
|
319
|
+
interface AxleAssistantMessage {
|
|
320
|
+
role: "assistant";
|
|
321
|
+
id: string;
|
|
322
|
+
model?: string;
|
|
323
|
+
content: Array<ContentPartText | ContentPartThinking | ContentPartToolCall | ContentPartInternalTool>;
|
|
324
|
+
finishReason?: AxleStopReason;
|
|
462
325
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
private stats;
|
|
467
|
-
private variables;
|
|
468
|
-
recorder: Recorder;
|
|
469
|
-
constructor(config: Partial<AIProviderConfig>);
|
|
470
|
-
addWriter(writer: RecorderWriter): void;
|
|
471
|
-
/**
|
|
472
|
-
* The execute function takes in a list of Tasks
|
|
473
|
-
* @param steps
|
|
474
|
-
* @returns
|
|
475
|
-
*/
|
|
476
|
-
execute(...steps: WorkflowStep[]): Promise<WorkflowResult>;
|
|
477
|
-
/**
|
|
478
|
-
* Execute a DAG workflow
|
|
479
|
-
* @param dagDefinition - The DAG definition object
|
|
480
|
-
* @param variables - Additional variables to pass to the workflow
|
|
481
|
-
* @param options - DAG execution options
|
|
482
|
-
* @returns Promise<WorkflowResult>
|
|
483
|
-
*/
|
|
484
|
-
executeDAG(dagDefinition: DAGDefinition, variables?: Record<string, any>, options?: DAGWorkflowOptions): Promise<WorkflowResult>;
|
|
485
|
-
get logs(): RecorderEntry[];
|
|
486
|
-
/**
|
|
487
|
-
* Load a file with the specified encoding or auto-detect based on file extension
|
|
488
|
-
* @param filePath - Path to the file
|
|
489
|
-
* @param encoding - How to load the file: "utf-8" for text, "base64" for binary, or omit for auto-detection
|
|
490
|
-
* @returns FileInfo object with appropriate content based on encoding
|
|
491
|
-
*/
|
|
492
|
-
static loadFileContent(filePath: string): Promise<FileInfo>;
|
|
493
|
-
static loadFileContent(filePath: string, encoding: "utf-8"): Promise<TextFileInfo>;
|
|
494
|
-
static loadFileContent(filePath: string, encoding: "base64"): Promise<Base64FileInfo>;
|
|
326
|
+
interface AxleToolCallMessage {
|
|
327
|
+
role: "tool";
|
|
328
|
+
content: Array<AxleToolCallResult>;
|
|
495
329
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
static with<T extends DeclarativeSchema>(prompt: string, schema: T): ChainOfThought<OutputSchema>;
|
|
501
|
-
static with(prompt: string): ChainOfThought<{
|
|
502
|
-
response: z.ZodString;
|
|
503
|
-
}>;
|
|
504
|
-
createInstructions(instructions?: string): string;
|
|
505
|
-
finalize(rawValue: string, runtime?: {
|
|
506
|
-
recorder?: Recorder;
|
|
507
|
-
}): InferedOutputSchema<T> & {
|
|
508
|
-
thinking: string;
|
|
509
|
-
};
|
|
330
|
+
interface AxleToolCallResult {
|
|
331
|
+
id: string;
|
|
332
|
+
name: string;
|
|
333
|
+
content: string;
|
|
510
334
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
readonly CLAUDE_HAIKU_4_5: "claude-haiku-4-5";
|
|
516
|
-
readonly CLAUDE_OPUS_4_1_20250805: "claude-opus-4-1-20250805";
|
|
517
|
-
readonly CLAUDE_OPUS_4_1_LATEST: "claude-opus-4-1";
|
|
518
|
-
readonly CLAUDE_OPUS_4_20250514: "claude-opus-4-20250514";
|
|
519
|
-
readonly CLAUDE_OPUS_4_LATEST: "claude-opus-4-0";
|
|
520
|
-
readonly CLAUDE_SONNET_4_20250514: "claude-sonnet-4-20250514";
|
|
521
|
-
readonly CLAUDE_SONNET_4_LATEST: "claude-sonnet-4-0";
|
|
522
|
-
readonly CLAUDE_3_7_SONNET_20250219: "claude-3-7-sonnet-20250219";
|
|
523
|
-
readonly CLAUDE_3_7_SONNET_LATEST: "claude-3-7-sonnet-latest";
|
|
524
|
-
readonly CLAUDE_3_5_SONNET_20241022: "claude-3-5-sonnet-20241022";
|
|
525
|
-
readonly CLAUDE_3_5_HAIKU_20241022: "claude-3-5-haiku-20241022";
|
|
526
|
-
readonly CLAUDE_3_5_HAIKU_LATEST: "claude-3-5-haiku-latest";
|
|
527
|
-
readonly CLAUDE_3_5_SONNET_20240620: "claude-3-5-sonnet-20240620";
|
|
528
|
-
};
|
|
529
|
-
declare const DEFAULT_MODEL$2: "claude-haiku-4-5";
|
|
530
|
-
|
|
531
|
-
declare const NAME$3: "anthropic";
|
|
532
|
-
declare class AnthropicProvider implements AIProvider {
|
|
533
|
-
name: "anthropic";
|
|
534
|
-
client: Anthropic;
|
|
535
|
-
model: string;
|
|
536
|
-
constructor(apiKey: string, model?: string);
|
|
537
|
-
createGenerationRequest(params: {
|
|
538
|
-
messages: Array<AxleMessage>;
|
|
539
|
-
system?: string;
|
|
540
|
-
tools?: Array<ToolDefinition>;
|
|
541
|
-
context: {
|
|
542
|
-
recorder?: Recorder;
|
|
543
|
-
};
|
|
544
|
-
options?: {
|
|
545
|
-
temperature?: number;
|
|
546
|
-
top_p?: number;
|
|
547
|
-
max_tokens?: number;
|
|
548
|
-
frequency_penalty?: number;
|
|
549
|
-
presence_penalty?: number;
|
|
550
|
-
stop?: string | string[];
|
|
551
|
-
[key: string]: any;
|
|
552
|
-
};
|
|
553
|
-
}): Promise<ModelResult>;
|
|
554
|
-
createStreamingRequest(params: {
|
|
555
|
-
messages: Array<AxleMessage>;
|
|
556
|
-
system?: string;
|
|
557
|
-
tools?: Array<ToolDefinition>;
|
|
558
|
-
context: {
|
|
559
|
-
recorder?: Recorder;
|
|
560
|
-
};
|
|
561
|
-
options?: {
|
|
562
|
-
temperature?: number;
|
|
563
|
-
top_p?: number;
|
|
564
|
-
max_tokens?: number;
|
|
565
|
-
frequency_penalty?: number;
|
|
566
|
-
presence_penalty?: number;
|
|
567
|
-
stop?: string | string[];
|
|
568
|
-
[key: string]: any;
|
|
569
|
-
};
|
|
570
|
-
}): AsyncGenerator<AnyStreamChunk, void, unknown>;
|
|
335
|
+
type ContentPart = ContentPartText | ContentPartFile | ContentPartToolCall | ContentPartThinking | ContentPartInternalTool;
|
|
336
|
+
interface ContentPartText {
|
|
337
|
+
type: "text";
|
|
338
|
+
text: string;
|
|
571
339
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
DEFAULT_MODEL$2 as DEFAULT_MODEL,
|
|
576
|
-
Models$2 as Models,
|
|
577
|
-
NAME$3 as NAME,
|
|
578
|
-
AnthropicProvider as Provider,
|
|
579
|
-
};
|
|
340
|
+
interface ContentPartFile {
|
|
341
|
+
type: "file";
|
|
342
|
+
file: FileInfo;
|
|
580
343
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
readonly GEMINI_2_5_FLASH_PREVIEW_NATIVE_AUDIO_DIALOG: "gemini-2.5-flash-preview-native-audio-dialog";
|
|
590
|
-
readonly GEMINI_2_5_FLASH_EXP_NATIVE_AUDIO_THINKING_DIALOG: "gemini-2.5-flash-exp-native-audio-thinking-dialog";
|
|
591
|
-
readonly GEMINI_2_5_FLASH_IMAGE_PREVIEW: "gemini-2.5-flash-image-preview";
|
|
592
|
-
readonly GEMINI_2_5_FLASH_PREVIEW_TTS: "gemini-2.5-flash-preview-tts";
|
|
593
|
-
readonly GEMINI_2_5_PRO_PREVIEW_TTS: "gemini-2.5-pro-preview-tts";
|
|
594
|
-
readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
|
|
595
|
-
readonly GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001";
|
|
596
|
-
readonly GEMINI_2_0_FLASH_EXP: "gemini-2.0-flash-exp";
|
|
597
|
-
readonly GEMINI_2_0_FLASH_PREVIEW_IMAGE_GENERATION: "gemini-2.0-flash-preview-image-generation";
|
|
598
|
-
readonly GEMINI_2_0_FLASH_LITE: "gemini-2.0-flash-lite";
|
|
599
|
-
readonly GEMINI_2_0_FLASH_LITE_001: "gemini-2.0-flash-lite-001";
|
|
600
|
-
readonly GEMINI_2_0_FLASH_LIVE_001: "gemini-2.0-flash-live-001";
|
|
601
|
-
readonly GEMINI_1_5_PRO: "gemini-1.5-pro";
|
|
602
|
-
readonly GEMINI_1_5_PRO_LATEST: "gemini-1.5-pro-latest";
|
|
603
|
-
readonly GEMINI_1_5_PRO_001: "gemini-1.5-pro-001";
|
|
604
|
-
readonly GEMINI_1_5_PRO_002: "gemini-1.5-pro-002";
|
|
605
|
-
readonly GEMINI_1_5_FLASH: "gemini-1.5-flash";
|
|
606
|
-
readonly GEMINI_1_5_FLASH_LATEST: "gemini-1.5-flash-latest";
|
|
607
|
-
readonly GEMINI_1_5_FLASH_001: "gemini-1.5-flash-001";
|
|
608
|
-
readonly GEMINI_1_5_FLASH_002: "gemini-1.5-flash-002";
|
|
609
|
-
readonly GEMINI_1_5_FLASH_8B: "gemini-1.5-flash-8b";
|
|
610
|
-
readonly GEMINI_1_5_FLASH_8B_LATEST: "gemini-1.5-flash-8b-latest";
|
|
611
|
-
readonly GEMINI_1_5_FLASH_8B_001: "gemini-1.5-flash-8b-001";
|
|
612
|
-
readonly GEMMA_3N_E4B_IT: "gemma-3n-e4b-it";
|
|
613
|
-
readonly GEMMA_3_1B_IT: "gemma-3-1b-it";
|
|
614
|
-
readonly GEMMA_3_4B_IT: "gemma-3-4b-it";
|
|
615
|
-
readonly GEMMA_3_12B_IT: "gemma-3-12b-it";
|
|
616
|
-
readonly GEMMA_3_27B_IT: "gemma-3-27b-it";
|
|
617
|
-
readonly LEARNLM_2_0_FLASH_EXPERIMENTAL: "learnlm-2.0-flash-experimental";
|
|
618
|
-
readonly EMBEDDING_001: "embedding-001";
|
|
619
|
-
readonly TEXT_EMBEDDING_004: "text-embedding-004";
|
|
620
|
-
};
|
|
621
|
-
declare const DEFAULT_MODEL$1: "gemini-2.5-flash";
|
|
622
|
-
|
|
623
|
-
declare const NAME$2: "Gemini";
|
|
624
|
-
declare class GeminiProvider implements AIProvider {
|
|
625
|
-
name: "Gemini";
|
|
626
|
-
client: GoogleGenAI;
|
|
627
|
-
model: string;
|
|
628
|
-
constructor(apiKey: string, model?: string);
|
|
629
|
-
createGenerationRequest(params: {
|
|
630
|
-
messages: Array<AxleMessage>;
|
|
631
|
-
system?: string;
|
|
632
|
-
tools?: Array<ToolDefinition>;
|
|
633
|
-
context: {
|
|
634
|
-
recorder?: Recorder;
|
|
635
|
-
};
|
|
636
|
-
options?: {
|
|
637
|
-
temperature?: number;
|
|
638
|
-
top_p?: number;
|
|
639
|
-
max_tokens?: number;
|
|
640
|
-
frequency_penalty?: number;
|
|
641
|
-
presence_penalty?: number;
|
|
642
|
-
stop?: string | string[];
|
|
643
|
-
[key: string]: any;
|
|
644
|
-
};
|
|
645
|
-
}): Promise<ModelResult>;
|
|
646
|
-
createStreamingRequest(params: {
|
|
647
|
-
messages: Array<AxleMessage>;
|
|
648
|
-
system?: string;
|
|
649
|
-
tools?: Array<ToolDefinition>;
|
|
650
|
-
context: {
|
|
651
|
-
recorder?: Recorder;
|
|
652
|
-
};
|
|
653
|
-
options?: {
|
|
654
|
-
temperature?: number;
|
|
655
|
-
top_p?: number;
|
|
656
|
-
max_tokens?: number;
|
|
657
|
-
frequency_penalty?: number;
|
|
658
|
-
presence_penalty?: number;
|
|
659
|
-
stop?: string | string[];
|
|
660
|
-
[key: string]: any;
|
|
661
|
-
};
|
|
662
|
-
}): AsyncGenerator<AnyStreamChunk, void, unknown>;
|
|
344
|
+
interface ContentPartThinking {
|
|
345
|
+
type: "thinking";
|
|
346
|
+
id?: string;
|
|
347
|
+
text: string;
|
|
348
|
+
summary?: string;
|
|
349
|
+
redacted?: boolean;
|
|
350
|
+
encrypted?: string;
|
|
351
|
+
signature?: string;
|
|
663
352
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
NAME$2 as NAME,
|
|
670
|
-
GeminiProvider as Provider,
|
|
671
|
-
};
|
|
353
|
+
interface ContentPartToolCall {
|
|
354
|
+
type: "tool-call";
|
|
355
|
+
id: string;
|
|
356
|
+
name: string;
|
|
357
|
+
parameters: Record<string, unknown>;
|
|
672
358
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
declare class OllamaProvider implements AIProvider {
|
|
359
|
+
interface ContentPartInternalTool {
|
|
360
|
+
type: "internal-tool";
|
|
361
|
+
id: string;
|
|
677
362
|
name: string;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
recorder?: Recorder;
|
|
681
|
-
constructor(model: string, url?: string);
|
|
682
|
-
createGenerationRequest(params: {
|
|
683
|
-
messages: Array<AxleMessage>;
|
|
684
|
-
system?: string;
|
|
685
|
-
tools?: Array<ToolDefinition>;
|
|
686
|
-
context: {
|
|
687
|
-
recorder?: Recorder;
|
|
688
|
-
};
|
|
689
|
-
options?: {
|
|
690
|
-
temperature?: number;
|
|
691
|
-
top_p?: number;
|
|
692
|
-
max_tokens?: number;
|
|
693
|
-
frequency_penalty?: number;
|
|
694
|
-
presence_penalty?: number;
|
|
695
|
-
stop?: string | string[];
|
|
696
|
-
[key: string]: any;
|
|
697
|
-
};
|
|
698
|
-
}): Promise<ModelResult>;
|
|
699
|
-
createStreamingRequest(params: {
|
|
700
|
-
messages: Array<AxleMessage>;
|
|
701
|
-
system?: string;
|
|
702
|
-
tools?: Array<ToolDefinition>;
|
|
703
|
-
context: {
|
|
704
|
-
recorder?: Recorder;
|
|
705
|
-
};
|
|
706
|
-
options?: {
|
|
707
|
-
temperature?: number;
|
|
708
|
-
top_p?: number;
|
|
709
|
-
max_tokens?: number;
|
|
710
|
-
frequency_penalty?: number;
|
|
711
|
-
presence_penalty?: number;
|
|
712
|
-
stop?: string | string[];
|
|
713
|
-
[key: string]: any;
|
|
714
|
-
};
|
|
715
|
-
}): AsyncGenerator<AnyStreamChunk, void, unknown>;
|
|
363
|
+
input?: unknown;
|
|
364
|
+
output?: unknown;
|
|
716
365
|
}
|
|
717
366
|
|
|
718
|
-
declare
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
temperature?: number;
|
|
733
|
-
top_p?: number;
|
|
734
|
-
max_tokens?: number;
|
|
735
|
-
frequency_penalty?: number;
|
|
736
|
-
presence_penalty?: number;
|
|
737
|
-
stop?: string | string[];
|
|
738
|
-
[key: string]: any;
|
|
739
|
-
};
|
|
740
|
-
}): Promise<ModelResult>;
|
|
741
|
-
createStreamingRequest(params: {
|
|
742
|
-
messages: Array<AxleMessage>;
|
|
743
|
-
system?: string;
|
|
744
|
-
tools?: Array<ToolDefinition>;
|
|
745
|
-
context: {
|
|
746
|
-
recorder?: Recorder;
|
|
747
|
-
};
|
|
748
|
-
options?: {
|
|
749
|
-
temperature?: number;
|
|
750
|
-
top_p?: number;
|
|
751
|
-
max_tokens?: number;
|
|
752
|
-
frequency_penalty?: number;
|
|
753
|
-
presence_penalty?: number;
|
|
754
|
-
stop?: string | string[];
|
|
755
|
-
[key: string]: any;
|
|
756
|
-
};
|
|
757
|
-
}): AsyncGenerator<AnyStreamChunk, void, unknown>;
|
|
367
|
+
declare class History {
|
|
368
|
+
system: string;
|
|
369
|
+
private _messages;
|
|
370
|
+
constructor(messages?: AxleMessage[]);
|
|
371
|
+
get messages(): AxleMessage[];
|
|
372
|
+
addSystem(message: string): void;
|
|
373
|
+
addUser(message: string): void;
|
|
374
|
+
addUser(parts: AxleUserMessage["content"]): void;
|
|
375
|
+
addAssistant(message: string): void;
|
|
376
|
+
addAssistant(params: Omit<AxleAssistantMessage, "role">): void;
|
|
377
|
+
addToolResults(input: Array<AxleToolCallResult>): void;
|
|
378
|
+
add(messages: AxleMessage | AxleMessage[]): void;
|
|
379
|
+
latest(): AxleMessage | undefined;
|
|
380
|
+
toString(): string;
|
|
758
381
|
}
|
|
759
382
|
|
|
760
|
-
interface
|
|
383
|
+
interface GenerateTurnOptions {
|
|
761
384
|
temperature?: number;
|
|
762
385
|
top_p?: number;
|
|
763
386
|
max_tokens?: number;
|
|
@@ -766,15 +389,16 @@ interface GenerateOptions {
|
|
|
766
389
|
stop?: string | string[];
|
|
767
390
|
[key: string]: any;
|
|
768
391
|
}
|
|
769
|
-
interface
|
|
392
|
+
interface GenerateTurnProps {
|
|
770
393
|
provider: AIProvider;
|
|
394
|
+
model: string;
|
|
771
395
|
messages: Array<AxleMessage>;
|
|
772
396
|
system?: string;
|
|
773
397
|
tools?: Array<ToolDefinition>;
|
|
774
|
-
|
|
775
|
-
options?:
|
|
398
|
+
tracer?: TracingContext;
|
|
399
|
+
options?: GenerateTurnOptions;
|
|
776
400
|
}
|
|
777
|
-
declare function
|
|
401
|
+
declare function generateTurn(props: GenerateTurnProps): Promise<ModelResult>;
|
|
778
402
|
|
|
779
403
|
type ToolCallResult = {
|
|
780
404
|
type: "success";
|
|
@@ -788,7 +412,8 @@ type ToolCallResult = {
|
|
|
788
412
|
retryable?: boolean;
|
|
789
413
|
};
|
|
790
414
|
};
|
|
791
|
-
type
|
|
415
|
+
type ToolCallCallback = (name: string, parameters: Record<string, unknown>) => Promise<ToolCallResult | null | undefined>;
|
|
416
|
+
type GenerateError = {
|
|
792
417
|
type: "model";
|
|
793
418
|
error: ModelError;
|
|
794
419
|
} | {
|
|
@@ -798,7 +423,7 @@ type GenerateWithToolsError = {
|
|
|
798
423
|
message: string;
|
|
799
424
|
};
|
|
800
425
|
};
|
|
801
|
-
type
|
|
426
|
+
type GenerateResult = {
|
|
802
427
|
result: "success";
|
|
803
428
|
messages: AxleMessage[];
|
|
804
429
|
final?: AxleAssistantMessage;
|
|
@@ -806,271 +431,295 @@ type GenerateWithToolsResult = {
|
|
|
806
431
|
} | {
|
|
807
432
|
result: "error";
|
|
808
433
|
messages: AxleMessage[];
|
|
809
|
-
error:
|
|
434
|
+
error: GenerateError;
|
|
810
435
|
usage?: Stats;
|
|
811
436
|
};
|
|
812
|
-
|
|
437
|
+
type StreamResult = GenerateResult | {
|
|
438
|
+
result: "cancelled";
|
|
439
|
+
messages: AxleMessage[];
|
|
440
|
+
partial?: AxleAssistantMessage;
|
|
441
|
+
usage: Stats;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
type StreamPartType = "text" | "thinking";
|
|
445
|
+
type PartStartCallback = (index: number, type: StreamPartType) => void;
|
|
446
|
+
type PartUpdateCallback = (index: number, type: StreamPartType, delta: string, accumulated: string) => void;
|
|
447
|
+
type PartEndCallback = (index: number, type: StreamPartType, final: string) => void;
|
|
448
|
+
type InternalToolEvent = {
|
|
449
|
+
type: "start";
|
|
450
|
+
index: number;
|
|
451
|
+
id: string;
|
|
452
|
+
name: string;
|
|
453
|
+
} | {
|
|
454
|
+
type: "complete";
|
|
455
|
+
index: number;
|
|
456
|
+
id: string;
|
|
457
|
+
name: string;
|
|
458
|
+
output?: unknown;
|
|
459
|
+
};
|
|
460
|
+
type InternalToolCallback = (event: InternalToolEvent) => void;
|
|
461
|
+
type ErrorCallback = (error: GenerateError) => void;
|
|
462
|
+
interface StreamOptions {
|
|
813
463
|
provider: AIProvider;
|
|
464
|
+
model: string;
|
|
814
465
|
messages: Array<AxleMessage>;
|
|
815
466
|
system?: string;
|
|
816
467
|
tools?: Array<ToolDefinition>;
|
|
817
|
-
onToolCall
|
|
468
|
+
onToolCall?: ToolCallCallback;
|
|
818
469
|
maxIterations?: number;
|
|
819
|
-
|
|
820
|
-
options?:
|
|
470
|
+
tracer?: TracingContext;
|
|
471
|
+
options?: GenerateTurnOptions;
|
|
472
|
+
}
|
|
473
|
+
interface StreamHandle {
|
|
474
|
+
onPartStart(callback: PartStartCallback): void;
|
|
475
|
+
onPartUpdate(callback: PartUpdateCallback): void;
|
|
476
|
+
onPartEnd(callback: PartEndCallback): void;
|
|
477
|
+
onInternalTool(callback: InternalToolCallback): void;
|
|
478
|
+
onError(callback: ErrorCallback): void;
|
|
479
|
+
cancel(): void;
|
|
480
|
+
readonly final: Promise<StreamResult>;
|
|
481
|
+
}
|
|
482
|
+
declare function stream(options: StreamOptions): StreamHandle;
|
|
483
|
+
|
|
484
|
+
type OutputSchema = Record<string, z.ZodTypeAny>;
|
|
485
|
+
type ParsedSchema<T extends OutputSchema> = {
|
|
486
|
+
[K in keyof T]: z.output<T[K]>;
|
|
487
|
+
};
|
|
488
|
+
declare function parseResponse<T extends OutputSchema>(rawValue: string, schema?: T): ParsedSchema<T> | string;
|
|
489
|
+
|
|
490
|
+
declare class Instruct<TSchema extends OutputSchema | undefined = undefined> {
|
|
491
|
+
prompt: string;
|
|
492
|
+
inputs: Record<string, string>;
|
|
493
|
+
files: Base64FileInfo[];
|
|
494
|
+
textReferences: Array<{
|
|
495
|
+
content: string;
|
|
496
|
+
name?: string;
|
|
497
|
+
}>;
|
|
498
|
+
instructions: string[];
|
|
499
|
+
schema: TSchema;
|
|
500
|
+
constructor(prompt: string, schema?: TSchema);
|
|
501
|
+
setInputs(inputs: Record<string, string>): void;
|
|
502
|
+
addInput(name: string, value: string): void;
|
|
503
|
+
addFile(file: FileInfo | string, options?: {
|
|
504
|
+
name?: string;
|
|
505
|
+
}): void;
|
|
506
|
+
addInstructions(instruction: string): void;
|
|
507
|
+
hasFiles(): boolean;
|
|
821
508
|
}
|
|
822
|
-
declare function generateWithTools(options: GenerateWithToolsOptions): Promise<GenerateWithToolsResult>;
|
|
823
509
|
|
|
824
|
-
interface
|
|
510
|
+
interface AgentConfig {
|
|
825
511
|
provider: AIProvider;
|
|
826
|
-
|
|
512
|
+
model: string;
|
|
827
513
|
system?: string;
|
|
828
|
-
tools?:
|
|
829
|
-
|
|
830
|
-
options?: GenerateOptions;
|
|
514
|
+
tools?: Tool[];
|
|
515
|
+
tracer?: TracingContext;
|
|
831
516
|
}
|
|
832
|
-
interface
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
517
|
+
interface AgentResult<T = string> {
|
|
518
|
+
response: T | null;
|
|
519
|
+
messages: AxleMessage[];
|
|
520
|
+
final: AxleAssistantMessage | undefined;
|
|
521
|
+
usage: Stats;
|
|
836
522
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
declare namespace index$1 {
|
|
841
|
-
export {
|
|
842
|
-
index$1_DEFAULT_OLLAMA_URL as DEFAULT_OLLAMA_URL,
|
|
843
|
-
NAME$1 as NAME,
|
|
844
|
-
OllamaProvider as Provider,
|
|
845
|
-
};
|
|
523
|
+
interface AgentHandle<T = string> {
|
|
524
|
+
cancel(): void;
|
|
525
|
+
readonly final: Promise<AgentResult<T>>;
|
|
846
526
|
}
|
|
527
|
+
declare class Agent {
|
|
528
|
+
readonly provider: AIProvider;
|
|
529
|
+
readonly model: string;
|
|
530
|
+
readonly history: History;
|
|
531
|
+
readonly tracer?: TracingContext;
|
|
532
|
+
system: string | undefined;
|
|
533
|
+
tools: Record<string, Tool>;
|
|
534
|
+
private partStartCallback?;
|
|
535
|
+
private partUpdateCallback?;
|
|
536
|
+
private partEndCallback?;
|
|
537
|
+
private internalToolCallback?;
|
|
538
|
+
private errorCallback?;
|
|
539
|
+
constructor(config: AgentConfig);
|
|
540
|
+
addTool(tool: Tool): void;
|
|
541
|
+
addTools(tools: Tool[]): void;
|
|
542
|
+
hasTools(): boolean;
|
|
543
|
+
onPartStart(callback: PartStartCallback): void;
|
|
544
|
+
onPartUpdate(callback: PartUpdateCallback): void;
|
|
545
|
+
onPartEnd(callback: PartEndCallback): void;
|
|
546
|
+
onInternalTool(callback: InternalToolCallback): void;
|
|
547
|
+
onError(callback: ErrorCallback): void;
|
|
548
|
+
send(message: string): AgentHandle<string>;
|
|
549
|
+
send(instruct: Instruct<undefined>, variables?: Record<string, string>): AgentHandle<string>;
|
|
550
|
+
send<TSchema extends OutputSchema>(instruct: Instruct<TSchema>, variables?: Record<string, string>): AgentHandle<ParsedSchema<TSchema>>;
|
|
551
|
+
private execute;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare function compileInstruct(instruct: Instruct<any>, variables?: Record<string, string>): string;
|
|
555
|
+
|
|
556
|
+
declare function anthropic(apiKey: string): AIProvider;
|
|
557
|
+
|
|
558
|
+
declare const Anthropic: {
|
|
559
|
+
readonly Models: {
|
|
560
|
+
readonly CLAUDE_SONNET_4_6: "claude-sonnet-4-6";
|
|
561
|
+
readonly CLAUDE_OPUS_4_6: "claude-opus-4-6";
|
|
562
|
+
readonly CLAUDE_OPUS_4_5_20251101: "claude-opus-4-5-20251101";
|
|
563
|
+
readonly CLAUDE_OPUS_4_5: "claude-opus-4-5-20251101";
|
|
564
|
+
readonly CLAUDE_HAIKU_4_5_20251001: "claude-haiku-4-5-20251001";
|
|
565
|
+
readonly CLAUDE_HAIKU_4_5: "claude-haiku-4-5-20251001";
|
|
566
|
+
readonly CLAUDE_SONNET_4_5_20250929: "claude-sonnet-4-5-20250929";
|
|
567
|
+
readonly CLAUDE_SONNET_4_5: "claude-sonnet-4-5-20250929";
|
|
568
|
+
readonly CLAUDE_OPUS_4_1_20250805: "claude-opus-4-1-20250805";
|
|
569
|
+
readonly CLAUDE_OPUS_4_1: "claude-opus-4-1-20250805";
|
|
570
|
+
readonly CLAUDE_OPUS_4_20250514: "claude-opus-4-20250514";
|
|
571
|
+
readonly CLAUDE_OPUS_4: "claude-opus-4-20250514";
|
|
572
|
+
readonly CLAUDE_SONNET_4_20250514: "claude-sonnet-4-20250514";
|
|
573
|
+
readonly CLAUDE_SONNET_4: "claude-sonnet-4-20250514";
|
|
574
|
+
readonly CLAUDE_3_7_SONNET_20250219: "claude-3-7-sonnet-20250219";
|
|
575
|
+
readonly CLAUDE_3_7_SONNET: "claude-3-7-sonnet-20250219";
|
|
576
|
+
readonly CLAUDE_3_5_HAIKU_20241022: "claude-3-5-haiku-20241022";
|
|
577
|
+
readonly CLAUDE_3_5_HAIKU: "claude-3-5-haiku-20241022";
|
|
578
|
+
readonly CLAUDE_3_HAIKU_20240307: "claude-3-haiku-20240307";
|
|
579
|
+
readonly CLAUDE_3_HAIKU: "claude-3-haiku-20240307";
|
|
580
|
+
};
|
|
581
|
+
readonly DefaultModel: "claude-haiku-4-5-20251001";
|
|
582
|
+
};
|
|
847
583
|
|
|
848
|
-
declare
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
readonly
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
readonly
|
|
887
|
-
readonly GPT_4O_TRANSCRIBE: "gpt-4o-transcribe";
|
|
888
|
-
readonly GPT_4O_MINI_TRANSCRIBE: "gpt-4o-mini-transcribe";
|
|
889
|
-
readonly GPT_4O_MINI_TTS: "gpt-4o-mini-tts";
|
|
890
|
-
readonly GPT_IMAGE_1: "gpt-image-1";
|
|
891
|
-
readonly GPT_IMAGE_1_MINI: "gpt-image-1-mini";
|
|
892
|
-
readonly O4_MINI: "o4-mini";
|
|
893
|
-
readonly O4_MINI_2025_04_16: "o4-mini-2025-04-16";
|
|
894
|
-
readonly O3: "o3";
|
|
895
|
-
readonly O3_PRO: "o3-pro";
|
|
896
|
-
readonly O3_MINI: "o3-mini";
|
|
897
|
-
readonly O3_MINI_2025_01_31: "o3-mini-2025-01-31";
|
|
898
|
-
readonly O1_PRO: "o1-pro";
|
|
899
|
-
readonly O1_PRO_2025_03_19: "o1-pro-2025-03-19";
|
|
900
|
-
readonly O1: "o1";
|
|
901
|
-
readonly O1_2024_12_17: "o1-2024-12-17";
|
|
902
|
-
readonly O1_MINI: "o1-mini";
|
|
903
|
-
readonly O1_MINI_2024_09_12: "o1-mini-2024-09-12";
|
|
904
|
-
readonly O1_PREVIEW: "o1-preview";
|
|
905
|
-
readonly O1_PREVIEW_2024_09_12: "o1-preview-2024-09-12";
|
|
906
|
-
readonly GPT_OSS_120B: "gpt-oss-120b";
|
|
907
|
-
readonly GPT_OSS_7B: "gpt-oss-7b";
|
|
908
|
-
readonly SORA_2: "sora-2";
|
|
909
|
-
readonly SORA_2025_05_02: "sora-2025-05-02";
|
|
910
|
-
readonly CODEX_MINI: "codex-mini";
|
|
911
|
-
readonly COMPUTER_USE_PREVIEW: "computer-use-preview";
|
|
584
|
+
declare function chatCompletions(baseUrl: string, apiKey?: string): AIProvider;
|
|
585
|
+
|
|
586
|
+
declare function gemini(apiKey: string): AIProvider;
|
|
587
|
+
|
|
588
|
+
declare const Gemini: {
|
|
589
|
+
readonly Models: {
|
|
590
|
+
readonly GEMINI_3_PRO_PREVIEW: "gemini-3-pro-preview";
|
|
591
|
+
readonly GEMINI_3_FLASH_PREVIEW: "gemini-3-flash-preview";
|
|
592
|
+
readonly GEMINI_3_PRO_IMAGE_PREVIEW: "gemini-3-pro-image-preview";
|
|
593
|
+
readonly GEMINI_2_5_PRO: "gemini-2.5-pro";
|
|
594
|
+
readonly GEMINI_2_5_FLASH: "gemini-2.5-flash";
|
|
595
|
+
readonly GEMINI_2_5_FLASH_PREVIEW_09_2025: "gemini-2.5-flash-preview-09-2025";
|
|
596
|
+
readonly GEMINI_2_5_FLASH_IMAGE: "gemini-2.5-flash-image";
|
|
597
|
+
readonly GEMINI_2_5_FLASH_LITE: "gemini-2.5-flash-lite";
|
|
598
|
+
readonly GEMINI_2_5_FLASH_LITE_PREVIEW_09_2025: "gemini-2.5-flash-lite-preview-09-2025";
|
|
599
|
+
readonly GEMINI_2_5_FLASH_NATIVE_AUDIO_PREVIEW_09_2025: "gemini-2.5-flash-native-audio-preview-09-2025";
|
|
600
|
+
readonly GEMINI_2_5_FLASH_NATIVE_AUDIO_PREVIEW_12_2025: "gemini-2.5-flash-native-audio-preview-12-2025";
|
|
601
|
+
readonly GEMINI_2_5_COMPUTER_USE_PREVIEW_10_2025: "gemini-2.5-computer-use-preview-10-2025";
|
|
602
|
+
readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
|
|
603
|
+
readonly GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001";
|
|
604
|
+
readonly GEMINI_2_0_FLASH_EXP_IMAGE_GENERATION: "gemini-2.0-flash-exp-image-generation";
|
|
605
|
+
readonly GEMINI_2_0_FLASH_LITE: "gemini-2.0-flash-lite";
|
|
606
|
+
readonly GEMINI_2_0_FLASH_LITE_001: "gemini-2.0-flash-lite-001";
|
|
607
|
+
readonly GEMINI_EXP_1206: "gemini-exp-1206";
|
|
608
|
+
readonly GEMINI_FLASH_LATEST: "gemini-flash-latest";
|
|
609
|
+
readonly GEMINI_FLASH_LITE_LATEST: "gemini-flash-lite-latest";
|
|
610
|
+
readonly GEMINI_PRO_LATEST: "gemini-pro-latest";
|
|
611
|
+
readonly GEMMA_3_27B_IT: "gemma-3-27b-it";
|
|
612
|
+
readonly GEMMA_3_12B_IT: "gemma-3-12b-it";
|
|
613
|
+
readonly GEMMA_3_4B_IT: "gemma-3-4b-it";
|
|
614
|
+
readonly GEMMA_3_1B_IT: "gemma-3-1b-it";
|
|
615
|
+
readonly GEMMA_3N_E4B_IT: "gemma-3n-e4b-it";
|
|
616
|
+
readonly GEMMA_3N_E2B_IT: "gemma-3n-e2b-it";
|
|
617
|
+
readonly DEEP_RESEARCH_PRO_PREVIEW_12_2025: "deep-research-pro-preview-12-2025";
|
|
618
|
+
readonly GEMINI_ROBOTICS_ER_1_5_PREVIEW: "gemini-robotics-er-1.5-preview";
|
|
619
|
+
readonly NANO_BANANA_PRO_PREVIEW: "nano-banana-pro-preview";
|
|
620
|
+
readonly AQA: "aqa";
|
|
621
|
+
};
|
|
622
|
+
readonly DefaultModel: "gemini-3-flash-preview";
|
|
912
623
|
};
|
|
913
|
-
declare const DEFAULT_MODEL: "gpt-5";
|
|
914
624
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
}
|
|
625
|
+
interface GenerateOptions {
|
|
626
|
+
provider: AIProvider;
|
|
627
|
+
model: string;
|
|
628
|
+
messages: Array<AxleMessage>;
|
|
629
|
+
system?: string;
|
|
630
|
+
tools?: Array<ToolDefinition>;
|
|
631
|
+
onToolCall: ToolCallCallback;
|
|
632
|
+
maxIterations?: number;
|
|
633
|
+
tracer?: TracingContext;
|
|
634
|
+
options?: GenerateTurnOptions;
|
|
635
|
+
}
|
|
636
|
+
declare function generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
637
|
+
|
|
638
|
+
declare function openai(apiKey: string): AIProvider;
|
|
639
|
+
|
|
640
|
+
declare const OpenAI: {
|
|
641
|
+
readonly Models: {
|
|
642
|
+
readonly GPT_5_2: "gpt-5.2";
|
|
643
|
+
readonly GPT_5_2_2025_12_11: "gpt-5.2-2025-12-11";
|
|
644
|
+
readonly GPT_5_2_CHAT_LATEST: "gpt-5.2-chat-latest";
|
|
645
|
+
readonly GPT_5_2_PRO: "gpt-5.2-pro";
|
|
646
|
+
readonly GPT_5_2_PRO_2025_12_11: "gpt-5.2-pro-2025-12-11";
|
|
647
|
+
readonly GPT_5_2_CODEX: "gpt-5.2-codex";
|
|
648
|
+
readonly GPT_5_1: "gpt-5.1";
|
|
649
|
+
readonly GPT_5_1_2025_11_13: "gpt-5.1-2025-11-13";
|
|
650
|
+
readonly GPT_5_1_CHAT_LATEST: "gpt-5.1-chat-latest";
|
|
651
|
+
readonly GPT_5_1_CODEX: "gpt-5.1-codex";
|
|
652
|
+
readonly GPT_5_1_CODEX_MAX: "gpt-5.1-codex-max";
|
|
653
|
+
readonly GPT_5_1_CODEX_MINI: "gpt-5.1-codex-mini";
|
|
654
|
+
readonly GPT_5: "gpt-5";
|
|
655
|
+
readonly GPT_5_2025_08_07: "gpt-5-2025-08-07";
|
|
656
|
+
readonly GPT_5_CHAT_LATEST: "gpt-5-chat-latest";
|
|
657
|
+
readonly GPT_5_CODEX: "gpt-5-codex";
|
|
658
|
+
readonly GPT_5_MINI: "gpt-5-mini";
|
|
659
|
+
readonly GPT_5_MINI_2025_08_07: "gpt-5-mini-2025-08-07";
|
|
660
|
+
readonly GPT_5_NANO: "gpt-5-nano";
|
|
661
|
+
readonly GPT_5_NANO_2025_08_07: "gpt-5-nano-2025-08-07";
|
|
662
|
+
readonly GPT_5_PRO: "gpt-5-pro";
|
|
663
|
+
readonly GPT_5_PRO_2025_10_06: "gpt-5-pro-2025-10-06";
|
|
664
|
+
readonly GPT_5_SEARCH_API: "gpt-5-search-api";
|
|
665
|
+
readonly GPT_5_SEARCH_API_2025_10_14: "gpt-5-search-api-2025-10-14";
|
|
666
|
+
readonly GPT_4_1: "gpt-4.1";
|
|
667
|
+
readonly GPT_4_1_2025_04_14: "gpt-4.1-2025-04-14";
|
|
668
|
+
readonly GPT_4_1_MINI: "gpt-4.1-mini";
|
|
669
|
+
readonly GPT_4_1_MINI_2025_04_14: "gpt-4.1-mini-2025-04-14";
|
|
670
|
+
readonly GPT_4_1_NANO: "gpt-4.1-nano";
|
|
671
|
+
readonly GPT_4_1_NANO_2025_04_14: "gpt-4.1-nano-2025-04-14";
|
|
672
|
+
readonly GPT_4O: "gpt-4o";
|
|
673
|
+
readonly GPT_4O_2024_11_20: "gpt-4o-2024-11-20";
|
|
674
|
+
readonly GPT_4O_2024_08_06: "gpt-4o-2024-08-06";
|
|
675
|
+
readonly GPT_4O_2024_05_13: "gpt-4o-2024-05-13";
|
|
676
|
+
readonly GPT_4O_MINI: "gpt-4o-mini";
|
|
677
|
+
readonly GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18";
|
|
678
|
+
readonly GPT_4O_SEARCH_PREVIEW: "gpt-4o-search-preview";
|
|
679
|
+
readonly GPT_4O_SEARCH_PREVIEW_2025_03_11: "gpt-4o-search-preview-2025-03-11";
|
|
680
|
+
readonly GPT_4O_MINI_SEARCH_PREVIEW: "gpt-4o-mini-search-preview";
|
|
681
|
+
readonly GPT_4O_MINI_SEARCH_PREVIEW_2025_03_11: "gpt-4o-mini-search-preview-2025-03-11";
|
|
682
|
+
readonly GPT_4_TURBO: "gpt-4-turbo";
|
|
683
|
+
readonly GPT_4_TURBO_2024_04_09: "gpt-4-turbo-2024-04-09";
|
|
684
|
+
readonly GPT_4_TURBO_PREVIEW: "gpt-4-turbo-preview";
|
|
685
|
+
readonly GPT_4_0125_PREVIEW: "gpt-4-0125-preview";
|
|
686
|
+
readonly GPT_4_1106_PREVIEW: "gpt-4-1106-preview";
|
|
687
|
+
readonly GPT_4: "gpt-4";
|
|
688
|
+
readonly GPT_4_0613: "gpt-4-0613";
|
|
689
|
+
readonly GPT_3_5_TURBO: "gpt-3.5-turbo";
|
|
690
|
+
readonly GPT_3_5_TURBO_0125: "gpt-3.5-turbo-0125";
|
|
691
|
+
readonly GPT_3_5_TURBO_1106: "gpt-3.5-turbo-1106";
|
|
692
|
+
readonly GPT_3_5_TURBO_16K: "gpt-3.5-turbo-16k";
|
|
693
|
+
readonly GPT_3_5_TURBO_INSTRUCT: "gpt-3.5-turbo-instruct";
|
|
694
|
+
readonly GPT_3_5_TURBO_INSTRUCT_0914: "gpt-3.5-turbo-instruct-0914";
|
|
695
|
+
readonly O4_MINI: "o4-mini";
|
|
696
|
+
readonly O4_MINI_2025_04_16: "o4-mini-2025-04-16";
|
|
697
|
+
readonly O4_MINI_DEEP_RESEARCH: "o4-mini-deep-research";
|
|
698
|
+
readonly O4_MINI_DEEP_RESEARCH_2025_06_26: "o4-mini-deep-research-2025-06-26";
|
|
699
|
+
readonly O3: "o3";
|
|
700
|
+
readonly O3_2025_04_16: "o3-2025-04-16";
|
|
701
|
+
readonly O3_PRO: "o3-pro";
|
|
702
|
+
readonly O3_PRO_2025_06_10: "o3-pro-2025-06-10";
|
|
703
|
+
readonly O3_MINI: "o3-mini";
|
|
704
|
+
readonly O3_MINI_2025_01_31: "o3-mini-2025-01-31";
|
|
705
|
+
readonly O3_DEEP_RESEARCH: "o3-deep-research";
|
|
706
|
+
readonly O3_DEEP_RESEARCH_2025_06_26: "o3-deep-research-2025-06-26";
|
|
707
|
+
readonly O1: "o1";
|
|
708
|
+
readonly O1_2024_12_17: "o1-2024-12-17";
|
|
709
|
+
readonly O1_PRO: "o1-pro";
|
|
710
|
+
readonly O1_PRO_2025_03_19: "o1-pro-2025-03-19";
|
|
711
|
+
readonly COMPUTER_USE_PREVIEW: "computer-use-preview";
|
|
712
|
+
readonly COMPUTER_USE_PREVIEW_2025_03_11: "computer-use-preview-2025-03-11";
|
|
713
|
+
readonly CHATGPT_IMAGE_LATEST: "chatgpt-image-latest";
|
|
714
|
+
};
|
|
715
|
+
readonly DefaultModel: "gpt-5-mini";
|
|
716
|
+
};
|
|
926
717
|
|
|
927
718
|
declare const BraveProviderConfigSchema: z$1.ZodObject<{
|
|
928
719
|
"api-key": z$1.ZodString;
|
|
929
720
|
rateLimit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
930
721
|
}, z$1.core.$strip>;
|
|
931
722
|
type BraveProviderConfig = z$1.infer<typeof BraveProviderConfigSchema>;
|
|
932
|
-
declare const JobSchema: z$1.ZodPipe<z$1.ZodTransform<any, any>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
933
|
-
type: z$1.ZodLiteral<"serial">;
|
|
934
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
935
|
-
steps: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
936
|
-
uses: z$1.ZodLiteral<"chat">;
|
|
937
|
-
system: z$1.ZodOptional<z$1.ZodString>;
|
|
938
|
-
message: z$1.ZodString;
|
|
939
|
-
output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
|
|
940
|
-
replace: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
941
|
-
source: z$1.ZodLiteral<"file">;
|
|
942
|
-
pattern: z$1.ZodString;
|
|
943
|
-
files: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>;
|
|
944
|
-
}, z$1.core.$strip>>>;
|
|
945
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
946
|
-
images: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
947
|
-
file: z$1.ZodString;
|
|
948
|
-
}, z$1.core.$strip>>>;
|
|
949
|
-
documents: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
950
|
-
file: z$1.ZodString;
|
|
951
|
-
}, z$1.core.$strip>>>;
|
|
952
|
-
references: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
953
|
-
file: z$1.ZodString;
|
|
954
|
-
}, z$1.core.$strip>>>;
|
|
955
|
-
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
956
|
-
uses: z$1.ZodLiteral<"write-to-disk">;
|
|
957
|
-
output: z$1.ZodString;
|
|
958
|
-
keys: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
|
|
959
|
-
}, z$1.core.$strip>], "uses">>;
|
|
960
|
-
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
961
|
-
type: z$1.ZodLiteral<"batch">;
|
|
962
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
963
|
-
batch: z$1.ZodArray<z$1.ZodObject<{
|
|
964
|
-
type: z$1.ZodLiteral<"files">;
|
|
965
|
-
source: z$1.ZodString;
|
|
966
|
-
bind: z$1.ZodString;
|
|
967
|
-
"skip-if": z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
968
|
-
type: z$1.ZodLiteral<"file-exist">;
|
|
969
|
-
pattern: z$1.ZodString;
|
|
970
|
-
}, z$1.core.$strip>>>;
|
|
971
|
-
}, z$1.core.$strip>>;
|
|
972
|
-
steps: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
973
|
-
uses: z$1.ZodLiteral<"chat">;
|
|
974
|
-
system: z$1.ZodOptional<z$1.ZodString>;
|
|
975
|
-
message: z$1.ZodString;
|
|
976
|
-
output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
|
|
977
|
-
replace: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
978
|
-
source: z$1.ZodLiteral<"file">;
|
|
979
|
-
pattern: z$1.ZodString;
|
|
980
|
-
files: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>;
|
|
981
|
-
}, z$1.core.$strip>>>;
|
|
982
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
983
|
-
images: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
984
|
-
file: z$1.ZodString;
|
|
985
|
-
}, z$1.core.$strip>>>;
|
|
986
|
-
documents: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
987
|
-
file: z$1.ZodString;
|
|
988
|
-
}, z$1.core.$strip>>>;
|
|
989
|
-
references: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
990
|
-
file: z$1.ZodString;
|
|
991
|
-
}, z$1.core.$strip>>>;
|
|
992
|
-
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
993
|
-
uses: z$1.ZodLiteral<"write-to-disk">;
|
|
994
|
-
output: z$1.ZodString;
|
|
995
|
-
keys: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
|
|
996
|
-
}, z$1.core.$strip>], "uses">>;
|
|
997
|
-
}, z$1.core.$strip>], "type">>;
|
|
998
|
-
type Job = z$1.infer<typeof JobSchema>;
|
|
999
|
-
type SerialJob = Extract<Job, {
|
|
1000
|
-
type: "serial";
|
|
1001
|
-
}>;
|
|
1002
|
-
type BatchJob = Extract<Job, {
|
|
1003
|
-
type: "batch";
|
|
1004
|
-
}>;
|
|
1005
|
-
declare const DAGJobSchema: z$1.ZodRecord<z$1.ZodString, z$1.ZodPipe<z$1.ZodTransform<any, any>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
1006
|
-
type: z$1.ZodLiteral<"serial">;
|
|
1007
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
1008
|
-
steps: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
1009
|
-
uses: z$1.ZodLiteral<"chat">;
|
|
1010
|
-
system: z$1.ZodOptional<z$1.ZodString>;
|
|
1011
|
-
message: z$1.ZodString;
|
|
1012
|
-
output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
|
|
1013
|
-
replace: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1014
|
-
source: z$1.ZodLiteral<"file">;
|
|
1015
|
-
pattern: z$1.ZodString;
|
|
1016
|
-
files: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>;
|
|
1017
|
-
}, z$1.core.$strip>>>;
|
|
1018
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
1019
|
-
images: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1020
|
-
file: z$1.ZodString;
|
|
1021
|
-
}, z$1.core.$strip>>>;
|
|
1022
|
-
documents: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1023
|
-
file: z$1.ZodString;
|
|
1024
|
-
}, z$1.core.$strip>>>;
|
|
1025
|
-
references: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1026
|
-
file: z$1.ZodString;
|
|
1027
|
-
}, z$1.core.$strip>>>;
|
|
1028
|
-
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
1029
|
-
uses: z$1.ZodLiteral<"write-to-disk">;
|
|
1030
|
-
output: z$1.ZodString;
|
|
1031
|
-
keys: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
|
|
1032
|
-
}, z$1.core.$strip>], "uses">>;
|
|
1033
|
-
dependsOn: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
|
|
1034
|
-
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
1035
|
-
type: z$1.ZodLiteral<"batch">;
|
|
1036
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
1037
|
-
batch: z$1.ZodArray<z$1.ZodObject<{
|
|
1038
|
-
type: z$1.ZodLiteral<"files">;
|
|
1039
|
-
source: z$1.ZodString;
|
|
1040
|
-
bind: z$1.ZodString;
|
|
1041
|
-
"skip-if": z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1042
|
-
type: z$1.ZodLiteral<"file-exist">;
|
|
1043
|
-
pattern: z$1.ZodString;
|
|
1044
|
-
}, z$1.core.$strip>>>;
|
|
1045
|
-
}, z$1.core.$strip>>;
|
|
1046
|
-
steps: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
1047
|
-
uses: z$1.ZodLiteral<"chat">;
|
|
1048
|
-
system: z$1.ZodOptional<z$1.ZodString>;
|
|
1049
|
-
message: z$1.ZodString;
|
|
1050
|
-
output: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
|
|
1051
|
-
replace: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1052
|
-
source: z$1.ZodLiteral<"file">;
|
|
1053
|
-
pattern: z$1.ZodString;
|
|
1054
|
-
files: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>;
|
|
1055
|
-
}, z$1.core.$strip>>>;
|
|
1056
|
-
tools: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
1057
|
-
images: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1058
|
-
file: z$1.ZodString;
|
|
1059
|
-
}, z$1.core.$strip>>>;
|
|
1060
|
-
documents: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1061
|
-
file: z$1.ZodString;
|
|
1062
|
-
}, z$1.core.$strip>>>;
|
|
1063
|
-
references: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
1064
|
-
file: z$1.ZodString;
|
|
1065
|
-
}, z$1.core.$strip>>>;
|
|
1066
|
-
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
1067
|
-
uses: z$1.ZodLiteral<"write-to-disk">;
|
|
1068
|
-
output: z$1.ZodString;
|
|
1069
|
-
keys: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
|
|
1070
|
-
}, z$1.core.$strip>], "uses">>;
|
|
1071
|
-
dependsOn: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
|
|
1072
|
-
}, z$1.core.$strip>], "type">>>;
|
|
1073
|
-
type DAGJob = z$1.infer<typeof DAGJobSchema>;
|
|
1074
723
|
|
|
1075
724
|
declare const braveSearchSchema: z.ZodObject<{
|
|
1076
725
|
searchTerm: z.ZodString;
|
|
@@ -1103,172 +752,82 @@ declare const calculatorSchema: z$1.ZodObject<{
|
|
|
1103
752
|
declare const calculatorTool: Tool<typeof calculatorSchema>;
|
|
1104
753
|
|
|
1105
754
|
/**
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
*
|
|
1109
|
-
* step following an LLM call to persist the generated output.
|
|
1110
|
-
*
|
|
1111
|
-
* ## CLI Job Definition (YAML)
|
|
1112
|
-
*
|
|
1113
|
-
* In job YAML files, use the `write-to-disk` step type:
|
|
1114
|
-
*
|
|
1115
|
-
* ```yaml
|
|
1116
|
-
* steps:
|
|
1117
|
-
* - uses: chat
|
|
1118
|
-
* message: Generate a greeting for {{name}}
|
|
1119
|
-
* - uses: write-to-disk
|
|
1120
|
-
* output: ./output/greeting-{{name}}.txt
|
|
1121
|
-
* ```
|
|
1122
|
-
*
|
|
1123
|
-
* ### Properties
|
|
1124
|
-
*
|
|
1125
|
-
* | Property | Type | Required | Description |
|
|
1126
|
-
* |----------|----------------------|----------|--------------------------------------------------|
|
|
1127
|
-
* | `uses` | `"write-to-disk"` | Yes | Identifies this as a WriteToDisk step |
|
|
1128
|
-
* | `output` | `string` | Yes | File path template (supports `{{}}` placeholders)|
|
|
1129
|
-
* | `keys` | `string \| string[]` | No | Variable keys to include in output content |
|
|
1130
|
-
*
|
|
1131
|
-
* ### Examples
|
|
1132
|
-
*
|
|
1133
|
-
* **Basic usage** - writes the LLM response to a file:
|
|
1134
|
-
* ```yaml
|
|
1135
|
-
* - uses: write-to-disk
|
|
1136
|
-
* output: ./output/result.txt
|
|
1137
|
-
* ```
|
|
1138
|
-
*
|
|
1139
|
-
* **With path variables** - uses `{{}}` placeholders in path:
|
|
1140
|
-
* ```yaml
|
|
1141
|
-
* - uses: write-to-disk
|
|
1142
|
-
* output: ./output/greeting-{{name}}.txt
|
|
1143
|
-
* ```
|
|
1144
|
-
*
|
|
1145
|
-
* **With file pattern** (batch processing) - uses `*` to substitute file stem:
|
|
1146
|
-
* ```yaml
|
|
1147
|
-
* - uses: write-to-disk
|
|
1148
|
-
* output: ./output/results-*.txt
|
|
1149
|
-
* ```
|
|
1150
|
-
*
|
|
1151
|
-
* **With specific keys** - outputs only specified variables:
|
|
1152
|
-
* ```yaml
|
|
1153
|
-
* - uses: write-to-disk
|
|
1154
|
-
* output: ./output/summary.txt
|
|
1155
|
-
* keys: summary
|
|
1156
|
-
* ```
|
|
1157
|
-
*
|
|
1158
|
-
* **With multiple keys** - outputs multiple variables, each on a new line:
|
|
1159
|
-
* ```yaml
|
|
1160
|
-
* - uses: write-to-disk
|
|
1161
|
-
* output: ./output/report.txt
|
|
1162
|
-
* keys:
|
|
1163
|
-
* - title
|
|
1164
|
-
* - summary
|
|
1165
|
-
* - conclusion
|
|
1166
|
-
* ```
|
|
1167
|
-
*
|
|
1168
|
-
* ## Placeholder Styles
|
|
1169
|
-
*
|
|
1170
|
-
* This action uses `{{variable}}` placeholder style for all variable substitution:
|
|
1171
|
-
*
|
|
1172
|
-
* - **Path template** (`output`): Uses `{{variable}}` placeholders
|
|
1173
|
-
* - Example: `./output/greeting-{{name}}.txt`
|
|
1174
|
-
* - Also supports `*` for file stem substitution in batch processing
|
|
1175
|
-
*
|
|
1176
|
-
* - **Content template** (`keys`): Uses `{{variable}}` placeholders
|
|
1177
|
-
* - Default template: `{{response}}`
|
|
1178
|
-
* - When `keys` is specified, generates: `{{key1}}\n{{key2}}\n...`
|
|
1179
|
-
*
|
|
1180
|
-
* ## Variables Available
|
|
1181
|
-
*
|
|
1182
|
-
* All variables from the workflow context are available for substitution:
|
|
1183
|
-
* - `response` - The text response from the previous LLM step
|
|
1184
|
-
* - `$previous` - The full output object from the previous step
|
|
1185
|
-
* - `file` - File info object when processing batches (contains `stem`, `name`, `ext`, etc.)
|
|
1186
|
-
* - Any custom variables defined in the workflow or extracted by previous steps
|
|
1187
|
-
*
|
|
1188
|
-
* @see WriteToDiskStep in `src/cli/configs/types.ts` for the TypeScript interface
|
|
1189
|
-
* @see writeToDiskConverter in `src/cli/converters/writeToDisk.ts` for CLI conversion logic
|
|
755
|
+
* Root tracer that manages writers and creates spans.
|
|
756
|
+
* Use startSpan() to create TracingContext instances for hierarchical tracing.
|
|
757
|
+
* All logging happens within spans - the Tracer itself is just configuration and factory.
|
|
1190
758
|
*/
|
|
1191
|
-
declare class
|
|
1192
|
-
private
|
|
1193
|
-
private
|
|
1194
|
-
|
|
759
|
+
declare class Tracer {
|
|
760
|
+
private writers;
|
|
761
|
+
private _minLevel;
|
|
762
|
+
get minLevel(): EventLevel;
|
|
763
|
+
set minLevel(level: EventLevel);
|
|
764
|
+
addWriter(writer: TraceWriter): void;
|
|
765
|
+
removeWriter(writer: TraceWriter): void;
|
|
766
|
+
startSpan(name: string, options?: SpanOptions): TracingContext;
|
|
767
|
+
flush(): Promise<void>;
|
|
768
|
+
/** @internal */
|
|
769
|
+
_notifySpanEnd(spanData: SpanData): void;
|
|
770
|
+
/** @internal */
|
|
771
|
+
_notifySpanUpdate(spanData: SpanData): void;
|
|
772
|
+
/** @internal */
|
|
773
|
+
_notifyEvent(spanData: SpanData, event: SpanEvent): void;
|
|
774
|
+
/** @internal */
|
|
775
|
+
_notifySpanStart(spanData: SpanData): void;
|
|
776
|
+
/** @internal */
|
|
777
|
+
_notifyLLMStreamStart(spanData: SpanData): void;
|
|
778
|
+
/** @internal */
|
|
779
|
+
_notifyLLMStreamChunk(spanData: SpanData, chunk: string): void;
|
|
780
|
+
/** @internal */
|
|
781
|
+
_notifyLLMStreamEnd(spanData: SpanData, result: LLMResult): void;
|
|
782
|
+
/** @internal */
|
|
783
|
+
_shouldLog(level: EventLevel): boolean;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
interface SimpleWriterOptions {
|
|
787
|
+
/** Minimum event level to display (default: "info") */
|
|
788
|
+
minLevel?: EventLevel;
|
|
789
|
+
/** Show internal spans - typically enabled via --debug flag (default: false) */
|
|
790
|
+
showInternal?: boolean;
|
|
791
|
+
/** Show timestamps (default: true) */
|
|
792
|
+
showTimestamp?: boolean;
|
|
793
|
+
/** Show duration on span end (default: true) */
|
|
794
|
+
showDuration?: boolean;
|
|
795
|
+
/** Custom output function (default: console.log) */
|
|
796
|
+
output?: (line: string) => void;
|
|
797
|
+
}
|
|
798
|
+
declare class SimpleWriter implements TraceWriter {
|
|
799
|
+
private minLevel;
|
|
800
|
+
private showInternal;
|
|
801
|
+
private showTimestamp;
|
|
802
|
+
private showDuration;
|
|
803
|
+
private output;
|
|
804
|
+
private spans;
|
|
805
|
+
private visibleDepths;
|
|
806
|
+
constructor(options?: SimpleWriterOptions);
|
|
807
|
+
private shouldShowEvent;
|
|
808
|
+
private isSpanVisible;
|
|
1195
809
|
/**
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
* @param pathTemplate - The file path template. Supports:
|
|
1199
|
-
* - `{{variable}}` placeholders for variable substitution
|
|
1200
|
-
* - `*` for file stem substitution (batch processing)
|
|
1201
|
-
* @param contentTemplate - The content template using `{{variable}}` placeholders.
|
|
1202
|
-
* Defaults to `{{response}}` to output the LLM response.
|
|
810
|
+
* Find the nearest visible ancestor span for a given span.
|
|
811
|
+
* Returns null if no visible ancestor exists (root level).
|
|
1203
812
|
*/
|
|
1204
|
-
|
|
813
|
+
private findVisibleAncestor;
|
|
1205
814
|
/**
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
* Resolves the path and content templates using workflow variables,
|
|
1209
|
-
* then writes the content to the resolved file path.
|
|
1210
|
-
*
|
|
1211
|
-
* @param context - The action execution context containing:
|
|
1212
|
-
* - `variables`: All workflow variables available for substitution
|
|
1213
|
-
* - `options`: Execution options (e.g., `dryRun`)
|
|
1214
|
-
* - `recorder`: Optional recorder for logging
|
|
1215
|
-
* @returns A promise that resolves when the file has been written
|
|
815
|
+
* Calculate the visible depth for a span.
|
|
816
|
+
* Only counts visible ancestors in the depth.
|
|
1216
817
|
*/
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
(
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
(
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
(...steps: WorkflowStep[]): WorkflowExecutable;
|
|
1234
|
-
}
|
|
1235
|
-
declare const serialWorkflow: SerialWorkflow;
|
|
1236
|
-
|
|
1237
|
-
declare class Conversation {
|
|
1238
|
-
system: string;
|
|
1239
|
-
private _messages;
|
|
1240
|
-
constructor(messages?: AxleMessage[]);
|
|
1241
|
-
get messages(): AxleMessage[];
|
|
1242
|
-
addSystem(message: string): void;
|
|
1243
|
-
addUser(message: string): void;
|
|
1244
|
-
addUser(parts: AxleUserMessage["content"]): void;
|
|
1245
|
-
addAssistant(message: string): void;
|
|
1246
|
-
addAssistant(params: Omit<AxleAssistantMessage, "role">): void;
|
|
1247
|
-
addToolResults(input: Array<AxleToolCallResult>): void;
|
|
1248
|
-
add(messages: AxleMessage | AxleMessage[]): void;
|
|
1249
|
-
latest(): AxleMessage | undefined;
|
|
1250
|
-
toString(): string;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
declare class ConsoleWriter implements RecorderWriter {
|
|
1254
|
-
private tasks;
|
|
1255
|
-
private entries;
|
|
1256
|
-
private truncate;
|
|
1257
|
-
private intervalId;
|
|
1258
|
-
private spinnerInterval;
|
|
1259
|
-
private lastRender;
|
|
1260
|
-
private isRendering;
|
|
1261
|
-
private inline;
|
|
1262
|
-
constructor(options?: {
|
|
1263
|
-
truncate?: number;
|
|
1264
|
-
inline?: boolean;
|
|
1265
|
-
});
|
|
1266
|
-
private startSpinner;
|
|
1267
|
-
private stopSpinner;
|
|
1268
|
-
private renderTasks;
|
|
1269
|
-
handleEvent(event: RecorderEntry): void;
|
|
1270
|
-
destroy(): void;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
export { index$3 as Anthropic, Axle, AxleStopReason, ChainOfThought, ConsoleWriter, Conversation, index$2 as Gemini, Instruct, LogLevel, index$1 as Ollama, index as OpenAI, WriteToDisk, braveSearchTool, calculatorTool, concurrentWorkflow, dagWorkflow, generate, generateWithTools, serialWorkflow, stream };
|
|
1274
|
-
export type { AIProvider, Action, ActionContext, AxleAssistantMessage, AxleMessage, AxleToolCallMessage, AxleToolCallResult, AxleUserMessage, ContentPart, ContentPartFile, ContentPartText, ContentPartThinking, ContentPartToolCall, DAGDefinition, DAGWorkflowOptions, FileInfo, SerializedExecutionResponse, Tool, ToolDefinition, WorkflowStep };
|
|
818
|
+
private calculateVisibleDepth;
|
|
819
|
+
private formatTimestamp;
|
|
820
|
+
private formatDuration;
|
|
821
|
+
private formatIndent;
|
|
822
|
+
private formatSpanName;
|
|
823
|
+
onSpanStart(span: SpanData): void;
|
|
824
|
+
onSpanEnd(span: SpanData): void;
|
|
825
|
+
onSpanUpdate(span: SpanData): void;
|
|
826
|
+
onEvent(span: SpanData, event: SpanEvent): void;
|
|
827
|
+
onLLMStreamStart(span: SpanData): void;
|
|
828
|
+
onLLMStreamChunk(_span: SpanData, _chunk: string): void;
|
|
829
|
+
onLLMStreamEnd(span: SpanData, result: LLMResult): void;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
export { Agent, Anthropic, AxleStopReason, Gemini, History, Instruct, OpenAI, SimpleWriter, Tracer, anthropic, braveSearchTool, calculatorTool, chatCompletions, compileInstruct, gemini, generate, generateTurn, loadFileContent, openai, parseResponse, stream };
|
|
833
|
+
export type { AIProvider, AgentConfig, AgentHandle, AgentResult, AxleAssistantMessage, AxleMessage, AxleToolCallMessage, AxleToolCallResult, AxleUserMessage, ContentPart, ContentPartFile, ContentPartText, ContentPartThinking, ContentPartToolCall, EventLevel, FileInfo, SimpleWriterOptions, SpanData, SpanOptions, SpanType, Tool, ToolDefinition, TraceWriter, TracingContext };
|