@agentfield/sdk 0.1.136 → 0.1.137-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/index.d.ts +227 -193
- package/dist/index.js +1289 -884
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# AgentField TypeScript SDK
|
|
2
2
|
|
|
3
|
+
## Graceful shutdown
|
|
4
|
+
|
|
5
|
+
`serve()` installs SIGTERM and SIGINT handlers that notify the control plane and drain detached executions. Host processes that own signal handling can use `serve({ handleSignals: false })` and call the idempotent `shutdown()` method themselves. `AGENTFIELD_SHUTDOWN_TIMEOUT` accepts bare seconds (`30`) or durations (`30s`, `5m`) and defaults to 30 seconds. In Kubernetes, set `terminationGracePeriodSeconds` higher than this timeout.
|
|
6
|
+
|
|
3
7
|
The TypeScript SDK provides an idiomatic Node.js interface for building and running AgentField agents. It mirrors the Python SDK APIs, including AI, memory, discovery, and MCP tooling.
|
|
4
8
|
|
|
5
9
|
## Installing
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,200 @@ declare class PauseManager {
|
|
|
113
113
|
*/
|
|
114
114
|
declare function installApprovalWebhookRoute(app: express.Express, manager: PauseManager, logger?: PauseLogger): void;
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Multimodal content helpers for AI prompts.
|
|
118
|
+
* Provides Image, Audio, and File classes with factory methods for creating
|
|
119
|
+
* multimodal content from various sources (files, URLs, buffers, base64).
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Represents text content in a multimodal prompt.
|
|
123
|
+
*/
|
|
124
|
+
declare class Text {
|
|
125
|
+
readonly type: 'text';
|
|
126
|
+
readonly text: string;
|
|
127
|
+
constructor(text: string);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Represents image content in a multimodal prompt.
|
|
131
|
+
*/
|
|
132
|
+
declare class Image {
|
|
133
|
+
readonly type: 'image_url';
|
|
134
|
+
readonly imageUrl: {
|
|
135
|
+
url: string;
|
|
136
|
+
detail?: 'low' | 'high' | 'auto';
|
|
137
|
+
};
|
|
138
|
+
private constructor();
|
|
139
|
+
/**
|
|
140
|
+
* Create Image from a local file by converting to base64 data URL.
|
|
141
|
+
*/
|
|
142
|
+
static fromFile(filePath: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
143
|
+
/**
|
|
144
|
+
* Create Image from a URL.
|
|
145
|
+
*/
|
|
146
|
+
static fromUrl(url: string, detail?: 'low' | 'high' | 'auto'): Image;
|
|
147
|
+
/**
|
|
148
|
+
* Create Image from a buffer.
|
|
149
|
+
*/
|
|
150
|
+
static fromBuffer(buffer: Buffer | Uint8Array, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
151
|
+
/**
|
|
152
|
+
* Create Image from a base64 string.
|
|
153
|
+
*/
|
|
154
|
+
static fromBase64(base64Data: string, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Represents audio content in a multimodal prompt.
|
|
158
|
+
*/
|
|
159
|
+
declare class Audio {
|
|
160
|
+
readonly type: 'input_audio';
|
|
161
|
+
readonly audio: {
|
|
162
|
+
data: string;
|
|
163
|
+
format: string;
|
|
164
|
+
};
|
|
165
|
+
private constructor();
|
|
166
|
+
/**
|
|
167
|
+
* Create Audio from a local file by converting to base64.
|
|
168
|
+
*/
|
|
169
|
+
static fromFile(filePath: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
170
|
+
/**
|
|
171
|
+
* Create Audio from a URL (downloads and converts to base64).
|
|
172
|
+
*/
|
|
173
|
+
static fromUrl(url: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
174
|
+
/**
|
|
175
|
+
* Create Audio from a buffer.
|
|
176
|
+
*/
|
|
177
|
+
static fromBuffer(buffer: Buffer | Uint8Array, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
178
|
+
/**
|
|
179
|
+
* Create Audio from a base64 string.
|
|
180
|
+
*/
|
|
181
|
+
static fromBase64(base64Data: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Represents video content in a multimodal prompt.
|
|
185
|
+
*/
|
|
186
|
+
declare class Video {
|
|
187
|
+
readonly type: 'video_url';
|
|
188
|
+
readonly videoUrl: {
|
|
189
|
+
url: string;
|
|
190
|
+
};
|
|
191
|
+
private constructor();
|
|
192
|
+
/**
|
|
193
|
+
* Create Video from a local file by converting to a base64 data URL.
|
|
194
|
+
*/
|
|
195
|
+
static fromFile(filePath: string): Promise<Video>;
|
|
196
|
+
/**
|
|
197
|
+
* Create Video from a URL.
|
|
198
|
+
*/
|
|
199
|
+
static fromUrl(url: string): Video;
|
|
200
|
+
/**
|
|
201
|
+
* Create Video from a buffer.
|
|
202
|
+
*/
|
|
203
|
+
static fromBuffer(buffer: Buffer | Uint8Array, mimeType?: string): Promise<Video>;
|
|
204
|
+
/**
|
|
205
|
+
* Create Video from a base64 string.
|
|
206
|
+
*/
|
|
207
|
+
static fromBase64(base64Data: string, mimeType?: string): Promise<Video>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Represents a generic file content in a multimodal prompt.
|
|
211
|
+
*/
|
|
212
|
+
declare class File {
|
|
213
|
+
readonly type: 'file';
|
|
214
|
+
readonly file: {
|
|
215
|
+
url: string;
|
|
216
|
+
mimeType?: string;
|
|
217
|
+
};
|
|
218
|
+
private constructor();
|
|
219
|
+
/**
|
|
220
|
+
* Create File from a local file path.
|
|
221
|
+
*/
|
|
222
|
+
static fromFile(filePath: string, mimeType?: string): Promise<File>;
|
|
223
|
+
/**
|
|
224
|
+
* Create File from a URL.
|
|
225
|
+
*/
|
|
226
|
+
static fromUrl(url: string, mimeType?: string): File;
|
|
227
|
+
/**
|
|
228
|
+
* Create File from a buffer.
|
|
229
|
+
*/
|
|
230
|
+
static fromBuffer(buffer: Buffer | Uint8Array, mimeType: string): Promise<File>;
|
|
231
|
+
/**
|
|
232
|
+
* Create File from a base64 string.
|
|
233
|
+
*/
|
|
234
|
+
static fromBase64(base64Data: string, mimeType: string): Promise<File>;
|
|
235
|
+
}
|
|
236
|
+
/** Infer a MIME type from a URL's data prefix or pathname extension. */
|
|
237
|
+
declare function guessUrlMimeType(url: string): string | null;
|
|
238
|
+
/** Canonical IANA media type for an audio format (e.g. 'mp3' -> 'audio/mpeg'). */
|
|
239
|
+
declare function audioMediaType(format: string): string;
|
|
240
|
+
/**
|
|
241
|
+
* Create text content.
|
|
242
|
+
*/
|
|
243
|
+
declare function text(content: string): Text;
|
|
244
|
+
/**
|
|
245
|
+
* Create image content from a local file.
|
|
246
|
+
*/
|
|
247
|
+
declare function imageFromFile(filePath: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
248
|
+
/**
|
|
249
|
+
* Create image content from a URL.
|
|
250
|
+
*/
|
|
251
|
+
declare function imageFromUrl(url: string, detail?: 'low' | 'high' | 'auto'): Image;
|
|
252
|
+
/**
|
|
253
|
+
* Create image content from a buffer.
|
|
254
|
+
*/
|
|
255
|
+
declare function imageFromBuffer(buffer: Buffer | Uint8Array, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
256
|
+
/**
|
|
257
|
+
* Create image content from a base64 string.
|
|
258
|
+
*/
|
|
259
|
+
declare function imageFromBase64(base64Data: string, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
260
|
+
/**
|
|
261
|
+
* Create audio content from a local file.
|
|
262
|
+
*/
|
|
263
|
+
declare function audioFromFile(filePath: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
264
|
+
/**
|
|
265
|
+
* Create audio content from a URL.
|
|
266
|
+
*/
|
|
267
|
+
declare function audioFromUrl(url: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
268
|
+
/**
|
|
269
|
+
* Create audio content from a buffer.
|
|
270
|
+
*/
|
|
271
|
+
declare function audioFromBuffer(buffer: Buffer | Uint8Array, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
272
|
+
/**
|
|
273
|
+
* Create audio content from a base64 string.
|
|
274
|
+
*/
|
|
275
|
+
declare function audioFromBase64(base64Data: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
276
|
+
/**
|
|
277
|
+
* Create video content from a local file.
|
|
278
|
+
*/
|
|
279
|
+
declare function videoFromFile(filePath: string): Promise<Video>;
|
|
280
|
+
/**
|
|
281
|
+
* Create video content from a URL.
|
|
282
|
+
*/
|
|
283
|
+
declare function videoFromUrl(url: string): Video;
|
|
284
|
+
/**
|
|
285
|
+
* Create video content from a buffer.
|
|
286
|
+
*/
|
|
287
|
+
declare function videoFromBuffer(buffer: Buffer | Uint8Array, mimeType?: string): Promise<Video>;
|
|
288
|
+
/**
|
|
289
|
+
* Create video content from a base64 string.
|
|
290
|
+
*/
|
|
291
|
+
declare function videoFromBase64(base64Data: string, mimeType?: string): Promise<Video>;
|
|
292
|
+
/**
|
|
293
|
+
* Create file content from a local file.
|
|
294
|
+
*/
|
|
295
|
+
declare function fileFromPath(filePath: string, mimeType?: string): Promise<File>;
|
|
296
|
+
/**
|
|
297
|
+
* Create file content from a URL.
|
|
298
|
+
*/
|
|
299
|
+
declare function fileFromUrl(url: string, mimeType?: string): File;
|
|
300
|
+
/**
|
|
301
|
+
* Create file content from a buffer.
|
|
302
|
+
*/
|
|
303
|
+
declare function fileFromBuffer(buffer: Buffer | Uint8Array, mimeType: string): Promise<File>;
|
|
304
|
+
/**
|
|
305
|
+
* Create file content from a base64 string.
|
|
306
|
+
*/
|
|
307
|
+
declare function fileFromBase64(base64Data: string, mimeType: string): Promise<File>;
|
|
308
|
+
type MultimodalContent = Text | Image | Audio | Video | File;
|
|
309
|
+
|
|
116
310
|
type ZodSchema<T> = z.Schema<T, z.ZodTypeDef, any>;
|
|
117
311
|
interface AIRequestOptions {
|
|
118
312
|
system?: string;
|
|
@@ -128,6 +322,8 @@ interface AIRequestOptions {
|
|
|
128
322
|
* - 'tool': Force tool calling mode
|
|
129
323
|
*/
|
|
130
324
|
mode?: 'auto' | 'json' | 'tool';
|
|
325
|
+
/** Additional image, audio, video, or file parts for the user message. */
|
|
326
|
+
content?: MultimodalContent[];
|
|
131
327
|
}
|
|
132
328
|
type AIStream = AsyncIterable<string>;
|
|
133
329
|
interface AIEmbeddingOptions {
|
|
@@ -160,6 +356,7 @@ declare class AIClient {
|
|
|
160
356
|
modelName: string;
|
|
161
357
|
};
|
|
162
358
|
private buildModel;
|
|
359
|
+
private buildPrompt;
|
|
163
360
|
private buildEmbeddingModel;
|
|
164
361
|
private openRouterHeaders;
|
|
165
362
|
private getRateLimiter;
|
|
@@ -595,6 +792,7 @@ declare class AgentFieldClient {
|
|
|
595
792
|
constructor(config: AgentConfig);
|
|
596
793
|
register(payload: any): Promise<any>;
|
|
597
794
|
getNode(nodeId: string): Promise<any>;
|
|
795
|
+
shutdown(nodeId: string): Promise<any>;
|
|
598
796
|
heartbeat(status?: 'starting' | 'ready' | 'degraded' | 'offline'): Promise<HealthStatus>;
|
|
599
797
|
execute<T = any>(target: string, input: any, metadata?: {
|
|
600
798
|
runId?: string;
|
|
@@ -1327,7 +1525,7 @@ interface HarnessConfig {
|
|
|
1327
1525
|
* When unset, `AGENTFIELD_HARNESS_PROVIDER` is consulted before the default.
|
|
1328
1526
|
* An explicit value always wins.
|
|
1329
1527
|
*/
|
|
1330
|
-
provider?: 'aforge' | 'claude-code' | 'codex' | 'gemini' | 'opencode';
|
|
1528
|
+
provider?: 'aforge' | 'claude-code' | 'codex' | 'gemini' | 'opencode' | 'pi' | 'omp';
|
|
1331
1529
|
/** Model identifier. Empty means the provider's own default. */
|
|
1332
1530
|
model?: string;
|
|
1333
1531
|
/**
|
|
@@ -1351,6 +1549,8 @@ interface HarnessConfig {
|
|
|
1351
1549
|
codexBin?: string;
|
|
1352
1550
|
geminiBin?: string;
|
|
1353
1551
|
opencodeBin?: string;
|
|
1552
|
+
piBin?: string;
|
|
1553
|
+
ompBin?: string;
|
|
1354
1554
|
}
|
|
1355
1555
|
interface HarnessOptions {
|
|
1356
1556
|
/**
|
|
@@ -1382,6 +1582,10 @@ interface HarnessOptions {
|
|
|
1382
1582
|
codexBin?: string;
|
|
1383
1583
|
geminiBin?: string;
|
|
1384
1584
|
opencodeBin?: string;
|
|
1585
|
+
piBin?: string;
|
|
1586
|
+
ompBin?: string;
|
|
1587
|
+
resumeSessionId?: string;
|
|
1588
|
+
timeout?: number;
|
|
1385
1589
|
schema?: unknown;
|
|
1386
1590
|
}
|
|
1387
1591
|
interface Metrics {
|
|
@@ -1691,6 +1895,8 @@ type RunnerOptions = Omit<HarnessOptions, 'schema'> & {
|
|
|
1691
1895
|
codexBin?: string;
|
|
1692
1896
|
geminiBin?: string;
|
|
1693
1897
|
opencodeBin?: string;
|
|
1898
|
+
piBin?: string;
|
|
1899
|
+
ompBin?: string;
|
|
1694
1900
|
};
|
|
1695
1901
|
declare class HarnessRunner {
|
|
1696
1902
|
private readonly config?;
|
|
@@ -1744,6 +1950,10 @@ declare class RealtimeSession {
|
|
|
1744
1950
|
}
|
|
1745
1951
|
declare function buildSessionDefinition(name: string, options: SessionOptions): SessionDefinition;
|
|
1746
1952
|
|
|
1953
|
+
interface ServeOptions {
|
|
1954
|
+
handleSignals?: boolean;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1747
1957
|
declare class Agent {
|
|
1748
1958
|
readonly config: AgentConfig;
|
|
1749
1959
|
readonly app: express.Express;
|
|
@@ -1751,6 +1961,10 @@ declare class Agent {
|
|
|
1751
1961
|
readonly skills: SkillRegistry;
|
|
1752
1962
|
private server?;
|
|
1753
1963
|
private heartbeatTimer?;
|
|
1964
|
+
private shutdownPromise?;
|
|
1965
|
+
private readonly inFlightExecutions;
|
|
1966
|
+
private shuttingDown;
|
|
1967
|
+
private signalHandlers?;
|
|
1754
1968
|
private readonly aiClient;
|
|
1755
1969
|
private readonly agentFieldClient;
|
|
1756
1970
|
private readonly memoryClient;
|
|
@@ -1869,8 +2083,10 @@ declare class Agent {
|
|
|
1869
2083
|
executionId?: string;
|
|
1870
2084
|
}): Promise<ApprovalResult>;
|
|
1871
2085
|
private buildExecutionLogContext;
|
|
1872
|
-
serve(): Promise<void>;
|
|
2086
|
+
serve(options?: ServeOptions): Promise<void>;
|
|
1873
2087
|
shutdown(): Promise<void>;
|
|
2088
|
+
private performShutdown;
|
|
2089
|
+
private installSignalHandlers;
|
|
1874
2090
|
call(target: string, input: any): Promise<any>;
|
|
1875
2091
|
/**
|
|
1876
2092
|
* Remote call variant that submits the execution asynchronously and polls for
|
|
@@ -2126,196 +2342,6 @@ declare class StatelessRateLimiter {
|
|
|
2126
2342
|
executeWithRetry<T>(fn: () => Promise<T>): Promise<T>;
|
|
2127
2343
|
}
|
|
2128
2344
|
|
|
2129
|
-
/**
|
|
2130
|
-
* Multimodal content helpers for AI prompts.
|
|
2131
|
-
* Provides Image, Audio, and File classes with factory methods for creating
|
|
2132
|
-
* multimodal content from various sources (files, URLs, buffers, base64).
|
|
2133
|
-
*/
|
|
2134
|
-
/**
|
|
2135
|
-
* Represents text content in a multimodal prompt.
|
|
2136
|
-
*/
|
|
2137
|
-
declare class Text {
|
|
2138
|
-
readonly type: 'text';
|
|
2139
|
-
readonly text: string;
|
|
2140
|
-
constructor(text: string);
|
|
2141
|
-
}
|
|
2142
|
-
/**
|
|
2143
|
-
* Represents image content in a multimodal prompt.
|
|
2144
|
-
*/
|
|
2145
|
-
declare class Image {
|
|
2146
|
-
readonly type: 'image_url';
|
|
2147
|
-
readonly imageUrl: {
|
|
2148
|
-
url: string;
|
|
2149
|
-
detail?: 'low' | 'high' | 'auto';
|
|
2150
|
-
};
|
|
2151
|
-
private constructor();
|
|
2152
|
-
/**
|
|
2153
|
-
* Create Image from a local file by converting to base64 data URL.
|
|
2154
|
-
*/
|
|
2155
|
-
static fromFile(filePath: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
2156
|
-
/**
|
|
2157
|
-
* Create Image from a URL.
|
|
2158
|
-
*/
|
|
2159
|
-
static fromUrl(url: string, detail?: 'low' | 'high' | 'auto'): Image;
|
|
2160
|
-
/**
|
|
2161
|
-
* Create Image from a buffer.
|
|
2162
|
-
*/
|
|
2163
|
-
static fromBuffer(buffer: Buffer | Uint8Array, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
2164
|
-
/**
|
|
2165
|
-
* Create Image from a base64 string.
|
|
2166
|
-
*/
|
|
2167
|
-
static fromBase64(base64Data: string, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
2168
|
-
}
|
|
2169
|
-
/**
|
|
2170
|
-
* Represents audio content in a multimodal prompt.
|
|
2171
|
-
*/
|
|
2172
|
-
declare class Audio {
|
|
2173
|
-
readonly type: 'input_audio';
|
|
2174
|
-
readonly audio: {
|
|
2175
|
-
data: string;
|
|
2176
|
-
format: string;
|
|
2177
|
-
};
|
|
2178
|
-
private constructor();
|
|
2179
|
-
/**
|
|
2180
|
-
* Create Audio from a local file by converting to base64.
|
|
2181
|
-
*/
|
|
2182
|
-
static fromFile(filePath: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2183
|
-
/**
|
|
2184
|
-
* Create Audio from a URL (downloads and converts to base64).
|
|
2185
|
-
*/
|
|
2186
|
-
static fromUrl(url: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2187
|
-
/**
|
|
2188
|
-
* Create Audio from a buffer.
|
|
2189
|
-
*/
|
|
2190
|
-
static fromBuffer(buffer: Buffer | Uint8Array, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2191
|
-
/**
|
|
2192
|
-
* Create Audio from a base64 string.
|
|
2193
|
-
*/
|
|
2194
|
-
static fromBase64(base64Data: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2195
|
-
}
|
|
2196
|
-
/**
|
|
2197
|
-
* Represents video content in a multimodal prompt.
|
|
2198
|
-
*/
|
|
2199
|
-
declare class Video {
|
|
2200
|
-
readonly type: 'video_url';
|
|
2201
|
-
readonly videoUrl: {
|
|
2202
|
-
url: string;
|
|
2203
|
-
};
|
|
2204
|
-
private constructor();
|
|
2205
|
-
/**
|
|
2206
|
-
* Create Video from a local file by converting to a base64 data URL.
|
|
2207
|
-
*/
|
|
2208
|
-
static fromFile(filePath: string): Promise<Video>;
|
|
2209
|
-
/**
|
|
2210
|
-
* Create Video from a URL.
|
|
2211
|
-
*/
|
|
2212
|
-
static fromUrl(url: string): Video;
|
|
2213
|
-
/**
|
|
2214
|
-
* Create Video from a buffer.
|
|
2215
|
-
*/
|
|
2216
|
-
static fromBuffer(buffer: Buffer | Uint8Array, mimeType?: string): Promise<Video>;
|
|
2217
|
-
/**
|
|
2218
|
-
* Create Video from a base64 string.
|
|
2219
|
-
*/
|
|
2220
|
-
static fromBase64(base64Data: string, mimeType?: string): Promise<Video>;
|
|
2221
|
-
}
|
|
2222
|
-
/**
|
|
2223
|
-
* Represents a generic file content in a multimodal prompt.
|
|
2224
|
-
*/
|
|
2225
|
-
declare class File {
|
|
2226
|
-
readonly type: 'file';
|
|
2227
|
-
readonly file: {
|
|
2228
|
-
url: string;
|
|
2229
|
-
mimeType?: string;
|
|
2230
|
-
};
|
|
2231
|
-
private constructor();
|
|
2232
|
-
/**
|
|
2233
|
-
* Create File from a local file path.
|
|
2234
|
-
*/
|
|
2235
|
-
static fromFile(filePath: string, mimeType?: string): Promise<File>;
|
|
2236
|
-
/**
|
|
2237
|
-
* Create File from a URL.
|
|
2238
|
-
*/
|
|
2239
|
-
static fromUrl(url: string, mimeType?: string): File;
|
|
2240
|
-
/**
|
|
2241
|
-
* Create File from a buffer.
|
|
2242
|
-
*/
|
|
2243
|
-
static fromBuffer(buffer: Buffer | Uint8Array, mimeType: string): Promise<File>;
|
|
2244
|
-
/**
|
|
2245
|
-
* Create File from a base64 string.
|
|
2246
|
-
*/
|
|
2247
|
-
static fromBase64(base64Data: string, mimeType: string): Promise<File>;
|
|
2248
|
-
}
|
|
2249
|
-
/**
|
|
2250
|
-
* Create text content.
|
|
2251
|
-
*/
|
|
2252
|
-
declare function text(content: string): Text;
|
|
2253
|
-
/**
|
|
2254
|
-
* Create image content from a local file.
|
|
2255
|
-
*/
|
|
2256
|
-
declare function imageFromFile(filePath: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
2257
|
-
/**
|
|
2258
|
-
* Create image content from a URL.
|
|
2259
|
-
*/
|
|
2260
|
-
declare function imageFromUrl(url: string, detail?: 'low' | 'high' | 'auto'): Image;
|
|
2261
|
-
/**
|
|
2262
|
-
* Create image content from a buffer.
|
|
2263
|
-
*/
|
|
2264
|
-
declare function imageFromBuffer(buffer: Buffer | Uint8Array, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
2265
|
-
/**
|
|
2266
|
-
* Create image content from a base64 string.
|
|
2267
|
-
*/
|
|
2268
|
-
declare function imageFromBase64(base64Data: string, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
2269
|
-
/**
|
|
2270
|
-
* Create audio content from a local file.
|
|
2271
|
-
*/
|
|
2272
|
-
declare function audioFromFile(filePath: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2273
|
-
/**
|
|
2274
|
-
* Create audio content from a URL.
|
|
2275
|
-
*/
|
|
2276
|
-
declare function audioFromUrl(url: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2277
|
-
/**
|
|
2278
|
-
* Create audio content from a buffer.
|
|
2279
|
-
*/
|
|
2280
|
-
declare function audioFromBuffer(buffer: Buffer | Uint8Array, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2281
|
-
/**
|
|
2282
|
-
* Create audio content from a base64 string.
|
|
2283
|
-
*/
|
|
2284
|
-
declare function audioFromBase64(base64Data: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
2285
|
-
/**
|
|
2286
|
-
* Create video content from a local file.
|
|
2287
|
-
*/
|
|
2288
|
-
declare function videoFromFile(filePath: string): Promise<Video>;
|
|
2289
|
-
/**
|
|
2290
|
-
* Create video content from a URL.
|
|
2291
|
-
*/
|
|
2292
|
-
declare function videoFromUrl(url: string): Video;
|
|
2293
|
-
/**
|
|
2294
|
-
* Create video content from a buffer.
|
|
2295
|
-
*/
|
|
2296
|
-
declare function videoFromBuffer(buffer: Buffer | Uint8Array, mimeType?: string): Promise<Video>;
|
|
2297
|
-
/**
|
|
2298
|
-
* Create video content from a base64 string.
|
|
2299
|
-
*/
|
|
2300
|
-
declare function videoFromBase64(base64Data: string, mimeType?: string): Promise<Video>;
|
|
2301
|
-
/**
|
|
2302
|
-
* Create file content from a local file.
|
|
2303
|
-
*/
|
|
2304
|
-
declare function fileFromPath(filePath: string, mimeType?: string): Promise<File>;
|
|
2305
|
-
/**
|
|
2306
|
-
* Create file content from a URL.
|
|
2307
|
-
*/
|
|
2308
|
-
declare function fileFromUrl(url: string, mimeType?: string): File;
|
|
2309
|
-
/**
|
|
2310
|
-
* Create file content from a buffer.
|
|
2311
|
-
*/
|
|
2312
|
-
declare function fileFromBuffer(buffer: Buffer | Uint8Array, mimeType: string): Promise<File>;
|
|
2313
|
-
/**
|
|
2314
|
-
* Create file content from a base64 string.
|
|
2315
|
-
*/
|
|
2316
|
-
declare function fileFromBase64(base64Data: string, mimeType: string): Promise<File>;
|
|
2317
|
-
type MultimodalContent = Text | Image | Audio | Video | File;
|
|
2318
|
-
|
|
2319
2345
|
/**
|
|
2320
2346
|
* Multimodal response classes for handling LLM multimodal outputs.
|
|
2321
2347
|
* Provides seamless integration with audio, image, and file outputs while maintaining backward compatibility.
|
|
@@ -2698,6 +2724,14 @@ declare function splitModelVariant(model: unknown): ModelVariant;
|
|
|
2698
2724
|
declare function resolveModelAndVariant(options: Record<string, unknown>): ModelVariant;
|
|
2699
2725
|
|
|
2700
2726
|
declare const SUPPORTED_PROVIDERS: Set<string>;
|
|
2727
|
+
declare const DEFAULT_HARNESS_PROVIDER = "aforge";
|
|
2728
|
+
declare const HARNESS_PROVIDER_ENV_VAR = "AGENTFIELD_HARNESS_PROVIDER";
|
|
2729
|
+
/**
|
|
2730
|
+
* Applies harness provider precedence: an explicit name wins, then
|
|
2731
|
+
* AGENTFIELD_HARNESS_PROVIDER, then DEFAULT_HARNESS_PROVIDER ("aforge").
|
|
2732
|
+
* Blank / whitespace-only values are treated as unset.
|
|
2733
|
+
*/
|
|
2734
|
+
declare function resolveProviderName(explicit?: string): string;
|
|
2701
2735
|
declare function buildProvider(config: HarnessConfig): Promise<HarnessProvider>;
|
|
2702
2736
|
|
|
2703
2737
|
/**
|
|
@@ -3036,4 +3070,4 @@ declare function simulateSchedule<R>(handler: (ctx: SimulatedContext) => R | Pro
|
|
|
3036
3070
|
*/
|
|
3037
3071
|
declare function loadFixture(source: string): Record<string, unknown>;
|
|
3038
3072
|
|
|
3039
|
-
export { ACTIVE_STATUSES, AIClient, type AIConfig, type AIEmbeddingOptions, type AIRequestOptions, type AIStream, type AIToolRequestOptions, Agent, type AgentCapability, type AgentConfig, type AgentHandler, AgentRouter, type AgentRouterOptions, type AgentState, ApprovalClient, type ApprovalDecision, type ApprovalRequestResponse, ApprovalResult, type ApprovalStatusResponse, Audio, type AudioOutput, type AudioRequest, type AuditTrailExport, type AuditTrailFilters, type Awaitable, CANONICAL_STATUSES, type CompactCapability, type CompactDiscoveryResponse, type CostEntry, type CostEntryInit, CostTracker, DIDAuthenticator, type DIDIdentity, type DIDIdentityPackage, type DIDRegistrationRequest, type DIDRegistrationResponse, type DeploymentType, DidClient, DidInterface, DidManager, type DidResolver, type DiscoveryFormat, type DiscoveryOptions, type DiscoveryPagination, type DiscoveryResponse, type DiscoveryResult, type EventTriggerBinding, type EventTriggerSpec, ExecutionContext, type ExecutionCredential, type ExecutionLogAttributes, type ExecutionLogBatchPayload, type ExecutionLogContext, type ExecutionLogEmitOptions, type ExecutionLogEntry, type ExecutionLogLevel, type ExecutionLogTransport, type ExecutionLogTransportPayload, type ExecutionLogWireEntry, ExecutionLogger, type ExecutionLoggerOptions, type ExecutionMetadata, ExecutionStatus, type ExecutionStatusValue, File, type FileOutput, type GenerateCredentialOptions, type GenerateCredentialParams, HEADER_CALLER_DID, HEADER_DID_NONCE, HEADER_DID_SIGNATURE, HEADER_DID_TIMESTAMP, type HarnessConfig, type HarnessOptions, type HarnessProvider, type HarnessResult, HarnessRunner, type HealthStatus, Image, type ImageOutput, type ImageRequest, JWE_ALG, JWE_ENC, KEY_AGREEMENT_TYPE, MODEL_VARIANT_SEP, type MediaProvider, MediaProviderError, type MediaResponse, MediaRouter, type MemoryChangeEvent, MemoryClient, MemoryClientBase, type MemoryConfig, MemoryEventClient, type MemoryEventHandler, type MemoryEventHistoryOptions, type MemoryEventSubscriptionOptions, MemoryInterface, type MemoryRequestMetadata, type MemoryRequestOptions, type MemoryScope, type MemoryWatchHandler, type Metrics, type ModelVariant, type MultimodalContent, MultimodalResponse, OpenRouterMediaProvider, type OpenRouterMediaProviderOptions, PauseClock, PauseManager, type Payload, PayloadEncryptionError, RateLimitError, type RateLimiterOptions, type RawExecutionContext, type RawResult, RealtimeSession, type ReasonerCapability, ReasonerContext, type ReasonerDefinition, type ReasonerHandler, type ReasonerOptions, type RequestApprovalPayload, SUPPORTED_PROVIDERS, SUPPORTED_SESSION_TRANSPORTS, type ScheduleTriggerBinding, type ScheduleTriggerSpec, type ServerlessAdapter, type ServerlessEvent, type ServerlessResponse, type SessionDefinition, type SessionOptions, type SessionProvider, type SessionTransport, type SessionTransportCapability, SessionTransportError, type SessionTurn, type SimulateScheduleOptions, type SimulateTriggerOptions, type SimulatedContext, type SkillCapability, SkillContext, type SkillDefinition, type SkillHandler, type SkillOptions, StatelessRateLimiter, TERMINAL_STATUSES, Text, type ToolCallConfig, type ToolCallRecord, type ToolCallTrace, type ToolsOption, type TriggerBinding, type TriggerContext, type TriggerEnvelope, USAGE_ENVELOPE_KEY, type UnwrapResult, type UsageEntryWire, type UsageSummaryWire, type VectorSearchOptions, type VectorSearchResult, Video, type VideoFrameImage, type VideoInputReference, type VideoRequest, type WaitForApprovalOptions, type WorkflowCredential, type WorkflowMetadata, type WorkflowProgressOptions, WorkflowReporter, type ZodSchema, applyTriggerTransform, attachUsageToSyncResult, audioFromBase64, audioFromBuffer, audioFromFile, audioFromUrl, buildProvider, buildSessionDefinition, buildToolConfig, capabilitiesToTools, capabilityToMetadataTool, capabilityToTool, createExecutionLogger, createHarnessResult, createMetrics, createMultimodalResponse, createRawResult, decrypt, decryptToString, deriveProvider, encryptForDid, encryptToJwk, eventTrigger, executeToolCallLoop, extractKeyAgreementJwk, fileFromBase64, fileFromBuffer, fileFromPath, fileFromUrl, generateX25519KeyPair, getCurrentContext, getCurrentSkillContext, imageFromBase64, imageFromBuffer, imageFromFile, imageFromUrl, installApprovalWebhookRoute, isActive, isExecutionLogBatchPayload, isTerminal, isTriggerEnvelope, loadFixture, normalizeExecutionLogEntry, normalizeSessionTransportValue, normalizeStatus, resolveModelAndVariant, scheduleTrigger, serializeExecutionLogEntry, simulateSchedule, simulateTrigger, splitModelVariant, text, triggerToPayload, unwrapEnvelope, usageSummaryOrNull, validateSessionTransport, videoFromBase64, videoFromBuffer, videoFromFile, videoFromUrl };
|
|
3073
|
+
export { ACTIVE_STATUSES, AIClient, type AIConfig, type AIEmbeddingOptions, type AIRequestOptions, type AIStream, type AIToolRequestOptions, Agent, type AgentCapability, type AgentConfig, type AgentHandler, AgentRouter, type AgentRouterOptions, type AgentState, ApprovalClient, type ApprovalDecision, type ApprovalRequestResponse, ApprovalResult, type ApprovalStatusResponse, Audio, type AudioOutput, type AudioRequest, type AuditTrailExport, type AuditTrailFilters, type Awaitable, CANONICAL_STATUSES, type CompactCapability, type CompactDiscoveryResponse, type CostEntry, type CostEntryInit, CostTracker, DEFAULT_HARNESS_PROVIDER, DIDAuthenticator, type DIDIdentity, type DIDIdentityPackage, type DIDRegistrationRequest, type DIDRegistrationResponse, type DeploymentType, DidClient, DidInterface, DidManager, type DidResolver, type DiscoveryFormat, type DiscoveryOptions, type DiscoveryPagination, type DiscoveryResponse, type DiscoveryResult, type EventTriggerBinding, type EventTriggerSpec, ExecutionContext, type ExecutionCredential, type ExecutionLogAttributes, type ExecutionLogBatchPayload, type ExecutionLogContext, type ExecutionLogEmitOptions, type ExecutionLogEntry, type ExecutionLogLevel, type ExecutionLogTransport, type ExecutionLogTransportPayload, type ExecutionLogWireEntry, ExecutionLogger, type ExecutionLoggerOptions, type ExecutionMetadata, ExecutionStatus, type ExecutionStatusValue, File, type FileOutput, type GenerateCredentialOptions, type GenerateCredentialParams, HARNESS_PROVIDER_ENV_VAR, HEADER_CALLER_DID, HEADER_DID_NONCE, HEADER_DID_SIGNATURE, HEADER_DID_TIMESTAMP, type HarnessConfig, type HarnessOptions, type HarnessProvider, type HarnessResult, HarnessRunner, type HealthStatus, Image, type ImageOutput, type ImageRequest, JWE_ALG, JWE_ENC, KEY_AGREEMENT_TYPE, MODEL_VARIANT_SEP, type MediaProvider, MediaProviderError, type MediaResponse, MediaRouter, type MemoryChangeEvent, MemoryClient, MemoryClientBase, type MemoryConfig, MemoryEventClient, type MemoryEventHandler, type MemoryEventHistoryOptions, type MemoryEventSubscriptionOptions, MemoryInterface, type MemoryRequestMetadata, type MemoryRequestOptions, type MemoryScope, type MemoryWatchHandler, type Metrics, type ModelVariant, type MultimodalContent, MultimodalResponse, OpenRouterMediaProvider, type OpenRouterMediaProviderOptions, PauseClock, PauseManager, type Payload, PayloadEncryptionError, RateLimitError, type RateLimiterOptions, type RawExecutionContext, type RawResult, RealtimeSession, type ReasonerCapability, ReasonerContext, type ReasonerDefinition, type ReasonerHandler, type ReasonerOptions, type RequestApprovalPayload, SUPPORTED_PROVIDERS, SUPPORTED_SESSION_TRANSPORTS, type ScheduleTriggerBinding, type ScheduleTriggerSpec, type ServerlessAdapter, type ServerlessEvent, type ServerlessResponse, type SessionDefinition, type SessionOptions, type SessionProvider, type SessionTransport, type SessionTransportCapability, SessionTransportError, type SessionTurn, type SimulateScheduleOptions, type SimulateTriggerOptions, type SimulatedContext, type SkillCapability, SkillContext, type SkillDefinition, type SkillHandler, type SkillOptions, StatelessRateLimiter, TERMINAL_STATUSES, Text, type ToolCallConfig, type ToolCallRecord, type ToolCallTrace, type ToolsOption, type TriggerBinding, type TriggerContext, type TriggerEnvelope, USAGE_ENVELOPE_KEY, type UnwrapResult, type UsageEntryWire, type UsageSummaryWire, type VectorSearchOptions, type VectorSearchResult, Video, type VideoFrameImage, type VideoInputReference, type VideoRequest, type WaitForApprovalOptions, type WorkflowCredential, type WorkflowMetadata, type WorkflowProgressOptions, WorkflowReporter, type ZodSchema, applyTriggerTransform, attachUsageToSyncResult, audioFromBase64, audioFromBuffer, audioFromFile, audioFromUrl, audioMediaType, buildProvider, buildSessionDefinition, buildToolConfig, capabilitiesToTools, capabilityToMetadataTool, capabilityToTool, createExecutionLogger, createHarnessResult, createMetrics, createMultimodalResponse, createRawResult, decrypt, decryptToString, deriveProvider, encryptForDid, encryptToJwk, eventTrigger, executeToolCallLoop, extractKeyAgreementJwk, fileFromBase64, fileFromBuffer, fileFromPath, fileFromUrl, generateX25519KeyPair, getCurrentContext, getCurrentSkillContext, guessUrlMimeType, imageFromBase64, imageFromBuffer, imageFromFile, imageFromUrl, installApprovalWebhookRoute, isActive, isExecutionLogBatchPayload, isTerminal, isTriggerEnvelope, loadFixture, normalizeExecutionLogEntry, normalizeSessionTransportValue, normalizeStatus, resolveModelAndVariant, resolveProviderName, scheduleTrigger, serializeExecutionLogEntry, simulateSchedule, simulateTrigger, splitModelVariant, text, triggerToPayload, unwrapEnvelope, usageSummaryOrNull, validateSessionTransport, videoFromBase64, videoFromBuffer, videoFromFile, videoFromUrl };
|