@agentfield/sdk 0.1.64-rc.6 → 0.1.64-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +429 -1
- package/dist/index.js +1311 -91
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import http from 'node:http';
|
|
|
3
3
|
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { AxiosInstance } from 'axios';
|
|
6
|
+
import { WriteStream } from 'node:tty';
|
|
6
7
|
import { ToolSet } from 'ai';
|
|
7
8
|
|
|
8
9
|
type ZodSchema<T> = z.Schema<T, z.ZodTypeDef, any>;
|
|
@@ -174,6 +175,95 @@ declare class MemoryInterface {
|
|
|
174
175
|
private resolveScopeId;
|
|
175
176
|
}
|
|
176
177
|
|
|
178
|
+
type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
179
|
+
interface ExecutionLogContext {
|
|
180
|
+
executionId?: string;
|
|
181
|
+
runId?: string;
|
|
182
|
+
workflowId?: string;
|
|
183
|
+
rootWorkflowId?: string;
|
|
184
|
+
parentExecutionId?: string;
|
|
185
|
+
sessionId?: string;
|
|
186
|
+
actorId?: string;
|
|
187
|
+
agentNodeId?: string;
|
|
188
|
+
reasonerId?: string;
|
|
189
|
+
callerDid?: string;
|
|
190
|
+
targetDid?: string;
|
|
191
|
+
agentNodeDid?: string;
|
|
192
|
+
}
|
|
193
|
+
interface ExecutionLogAttributes {
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
196
|
+
interface ExecutionLogEntry extends ExecutionLogContext {
|
|
197
|
+
v: 1;
|
|
198
|
+
ts: string;
|
|
199
|
+
level: ExecutionLogLevel;
|
|
200
|
+
source: string;
|
|
201
|
+
message: string;
|
|
202
|
+
eventType?: string;
|
|
203
|
+
systemGenerated?: boolean;
|
|
204
|
+
attributes?: ExecutionLogAttributes;
|
|
205
|
+
}
|
|
206
|
+
interface ExecutionLogWireEntry {
|
|
207
|
+
v: 1;
|
|
208
|
+
ts: string;
|
|
209
|
+
execution_id?: string;
|
|
210
|
+
run_id?: string;
|
|
211
|
+
workflow_id?: string;
|
|
212
|
+
root_workflow_id?: string;
|
|
213
|
+
parent_execution_id?: string;
|
|
214
|
+
session_id?: string;
|
|
215
|
+
actor_id?: string;
|
|
216
|
+
agent_node_id?: string;
|
|
217
|
+
reasoner_id?: string;
|
|
218
|
+
caller_did?: string;
|
|
219
|
+
target_did?: string;
|
|
220
|
+
agent_node_did?: string;
|
|
221
|
+
level: ExecutionLogLevel;
|
|
222
|
+
source: string;
|
|
223
|
+
event_type?: string;
|
|
224
|
+
message: string;
|
|
225
|
+
attributes?: ExecutionLogAttributes;
|
|
226
|
+
system_generated?: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface ExecutionLogBatchPayload {
|
|
229
|
+
entries: ExecutionLogWireEntry[];
|
|
230
|
+
}
|
|
231
|
+
type ExecutionLogTransportPayload = ExecutionLogWireEntry | ExecutionLogBatchPayload;
|
|
232
|
+
declare function isExecutionLogBatchPayload(payload: ExecutionLogTransportPayload): payload is ExecutionLogBatchPayload;
|
|
233
|
+
interface ExecutionLogEmitOptions {
|
|
234
|
+
eventType?: string;
|
|
235
|
+
source?: string;
|
|
236
|
+
systemGenerated?: boolean;
|
|
237
|
+
}
|
|
238
|
+
interface ExecutionLogTransport {
|
|
239
|
+
emit(payload: ExecutionLogTransportPayload): void | Promise<void>;
|
|
240
|
+
}
|
|
241
|
+
interface ExecutionLoggerOptions {
|
|
242
|
+
contextProvider?: () => ExecutionLogContext | undefined;
|
|
243
|
+
transport?: ExecutionLogTransport;
|
|
244
|
+
mirrorToStdout?: boolean;
|
|
245
|
+
stdout?: Pick<WriteStream, 'write'>;
|
|
246
|
+
source?: string;
|
|
247
|
+
}
|
|
248
|
+
declare function normalizeExecutionLogEntry(entry: ExecutionLogEntry): ExecutionLogWireEntry;
|
|
249
|
+
declare function serializeExecutionLogEntry(entry: ExecutionLogEntry): string;
|
|
250
|
+
declare class ExecutionLogger {
|
|
251
|
+
private readonly contextProvider?;
|
|
252
|
+
private readonly transport?;
|
|
253
|
+
private readonly mirrorToStdout;
|
|
254
|
+
private readonly stdout?;
|
|
255
|
+
private readonly defaultSource;
|
|
256
|
+
constructor(options?: ExecutionLoggerOptions);
|
|
257
|
+
log(level: ExecutionLogLevel, message: string, attributes?: ExecutionLogAttributes, options?: ExecutionLogEmitOptions): ExecutionLogEntry;
|
|
258
|
+
debug(message: string, attributes?: ExecutionLogAttributes, options?: ExecutionLogEmitOptions): ExecutionLogEntry;
|
|
259
|
+
info(message: string, attributes?: ExecutionLogAttributes, options?: ExecutionLogEmitOptions): ExecutionLogEntry;
|
|
260
|
+
warn(message: string, attributes?: ExecutionLogAttributes, options?: ExecutionLogEmitOptions): ExecutionLogEntry;
|
|
261
|
+
error(message: string, attributes?: ExecutionLogAttributes, options?: ExecutionLogEmitOptions): ExecutionLogEntry;
|
|
262
|
+
system(eventType: string, message: string, attributes?: ExecutionLogAttributes): ExecutionLogEntry;
|
|
263
|
+
private emit;
|
|
264
|
+
}
|
|
265
|
+
declare function createExecutionLogger(options?: ExecutionLoggerOptions): ExecutionLogger;
|
|
266
|
+
|
|
177
267
|
interface ExecutionStatusUpdate {
|
|
178
268
|
status?: string;
|
|
179
269
|
result?: Record<string, any>;
|
|
@@ -194,7 +284,9 @@ declare class AgentFieldClient {
|
|
|
194
284
|
execute<T = any>(target: string, input: any, metadata?: {
|
|
195
285
|
runId?: string;
|
|
196
286
|
workflowId?: string;
|
|
287
|
+
rootWorkflowId?: string;
|
|
197
288
|
parentExecutionId?: string;
|
|
289
|
+
reasonerId?: string;
|
|
198
290
|
sessionId?: string;
|
|
199
291
|
actorId?: string;
|
|
200
292
|
callerDid?: string;
|
|
@@ -206,6 +298,7 @@ declare class AgentFieldClient {
|
|
|
206
298
|
executionId: string;
|
|
207
299
|
runId: string;
|
|
208
300
|
workflowId?: string;
|
|
301
|
+
rootWorkflowId?: string;
|
|
209
302
|
reasonerId: string;
|
|
210
303
|
agentNodeId: string;
|
|
211
304
|
status: 'waiting' | 'running' | 'succeeded' | 'failed';
|
|
@@ -217,6 +310,7 @@ declare class AgentFieldClient {
|
|
|
217
310
|
error?: string;
|
|
218
311
|
durationMs?: number;
|
|
219
312
|
}): Promise<void>;
|
|
313
|
+
publishExecutionLogs(payload: ExecutionLogTransportPayload): void;
|
|
220
314
|
updateExecutionStatus(executionId: string, update: ExecutionStatusUpdate): Promise<void>;
|
|
221
315
|
discoverCapabilities(options?: DiscoveryOptions): Promise<DiscoveryResult>;
|
|
222
316
|
private mapDiscoveryResponse;
|
|
@@ -233,7 +327,9 @@ declare class AgentFieldClient {
|
|
|
233
327
|
sessionId?: string;
|
|
234
328
|
actorId?: string;
|
|
235
329
|
workflowId?: string;
|
|
330
|
+
rootWorkflowId?: string;
|
|
236
331
|
parentExecutionId?: string;
|
|
332
|
+
reasonerId?: string;
|
|
237
333
|
callerDid?: string;
|
|
238
334
|
targetDid?: string;
|
|
239
335
|
agentNodeDid?: string;
|
|
@@ -266,7 +362,9 @@ interface ExecutionMetadata {
|
|
|
266
362
|
sessionId?: string;
|
|
267
363
|
actorId?: string;
|
|
268
364
|
workflowId?: string;
|
|
365
|
+
rootWorkflowId?: string;
|
|
269
366
|
parentExecutionId?: string;
|
|
367
|
+
reasonerId?: string;
|
|
270
368
|
callerDid?: string;
|
|
271
369
|
targetDid?: string;
|
|
272
370
|
agentNodeDid?: string;
|
|
@@ -284,6 +382,7 @@ declare class ExecutionContext {
|
|
|
284
382
|
res: express.Response;
|
|
285
383
|
agent: Agent;
|
|
286
384
|
});
|
|
385
|
+
get logger(): ExecutionLogger;
|
|
287
386
|
static run<T>(ctx: ExecutionContext, fn: () => T): T;
|
|
288
387
|
static getCurrent(): ExecutionContext | undefined;
|
|
289
388
|
}
|
|
@@ -525,13 +624,16 @@ declare class ReasonerContext<TInput = any> {
|
|
|
525
624
|
readonly sessionId?: string;
|
|
526
625
|
readonly actorId?: string;
|
|
527
626
|
readonly workflowId?: string;
|
|
627
|
+
readonly rootWorkflowId?: string;
|
|
528
628
|
readonly parentExecutionId?: string;
|
|
629
|
+
readonly reasonerId?: string;
|
|
529
630
|
readonly callerDid?: string;
|
|
530
631
|
readonly targetDid?: string;
|
|
531
632
|
readonly agentNodeDid?: string;
|
|
532
633
|
readonly req: express.Request;
|
|
533
634
|
readonly res: express.Response;
|
|
534
635
|
readonly agent: Agent;
|
|
636
|
+
readonly logger: ExecutionLogger;
|
|
535
637
|
readonly aiClient: AIClient;
|
|
536
638
|
readonly memory: MemoryInterface;
|
|
537
639
|
readonly workflow: WorkflowReporter;
|
|
@@ -543,13 +645,16 @@ declare class ReasonerContext<TInput = any> {
|
|
|
543
645
|
sessionId?: string;
|
|
544
646
|
actorId?: string;
|
|
545
647
|
workflowId?: string;
|
|
648
|
+
rootWorkflowId?: string;
|
|
546
649
|
parentExecutionId?: string;
|
|
650
|
+
reasonerId?: string;
|
|
547
651
|
callerDid?: string;
|
|
548
652
|
targetDid?: string;
|
|
549
653
|
agentNodeDid?: string;
|
|
550
654
|
req: express.Request;
|
|
551
655
|
res: express.Response;
|
|
552
656
|
agent: Agent;
|
|
657
|
+
logger: ExecutionLogger;
|
|
553
658
|
aiClient: AIClient;
|
|
554
659
|
memory: MemoryInterface;
|
|
555
660
|
workflow: WorkflowReporter;
|
|
@@ -600,11 +705,14 @@ declare class SkillContext<TInput = any> {
|
|
|
600
705
|
readonly executionId: string;
|
|
601
706
|
readonly sessionId?: string;
|
|
602
707
|
readonly workflowId?: string;
|
|
708
|
+
readonly rootWorkflowId?: string;
|
|
709
|
+
readonly reasonerId?: string;
|
|
603
710
|
readonly callerDid?: string;
|
|
604
711
|
readonly agentNodeDid?: string;
|
|
605
712
|
readonly req: express.Request;
|
|
606
713
|
readonly res: express.Response;
|
|
607
714
|
readonly agent: Agent;
|
|
715
|
+
readonly logger: ExecutionLogger;
|
|
608
716
|
readonly memory: MemoryInterface;
|
|
609
717
|
readonly workflow: WorkflowReporter;
|
|
610
718
|
readonly did: DidInterface;
|
|
@@ -613,11 +721,14 @@ declare class SkillContext<TInput = any> {
|
|
|
613
721
|
executionId: string;
|
|
614
722
|
sessionId?: string;
|
|
615
723
|
workflowId?: string;
|
|
724
|
+
rootWorkflowId?: string;
|
|
725
|
+
reasonerId?: string;
|
|
616
726
|
callerDid?: string;
|
|
617
727
|
agentNodeDid?: string;
|
|
618
728
|
req: express.Request;
|
|
619
729
|
res: express.Response;
|
|
620
730
|
agent: Agent;
|
|
731
|
+
logger: ExecutionLogger;
|
|
621
732
|
memory: MemoryInterface;
|
|
622
733
|
workflow: WorkflowReporter;
|
|
623
734
|
did: DidInterface;
|
|
@@ -985,6 +1096,8 @@ declare class Agent {
|
|
|
985
1096
|
private readonly mcpToolRegistrar?;
|
|
986
1097
|
private readonly localVerifier?;
|
|
987
1098
|
private readonly realtimeValidationFunctions;
|
|
1099
|
+
private readonly processLogRing;
|
|
1100
|
+
private readonly executionLogger;
|
|
988
1101
|
constructor(config: AgentConfig);
|
|
989
1102
|
reasoner<TInput = any, TOutput = any>(name: string, handler: ReasonerHandler<TInput, TOutput>, options?: ReasonerOptions): this;
|
|
990
1103
|
skill<TInput = any, TOutput = any>(name: string, handler: SkillHandler<TInput, TOutput>, options?: SkillOptions): this;
|
|
@@ -999,12 +1112,14 @@ declare class Agent {
|
|
|
999
1112
|
registered: MCPToolRegistration[];
|
|
1000
1113
|
}>;
|
|
1001
1114
|
getAIClient(): AIClient;
|
|
1115
|
+
getExecutionLogger(): ExecutionLogger;
|
|
1002
1116
|
getHarnessRunner(): Promise<HarnessRunner>;
|
|
1003
1117
|
harness(prompt: string, options?: HarnessOptions): Promise<HarnessResult>;
|
|
1004
1118
|
getMemoryInterface(metadata?: ExecutionMetadata): MemoryInterface;
|
|
1005
1119
|
getWorkflowReporter(metadata: ExecutionMetadata): WorkflowReporter;
|
|
1006
1120
|
getDidInterface(metadata: ExecutionMetadata, defaultInput?: any, targetName?: string): DidInterface;
|
|
1007
1121
|
note(message: string, tags?: string[], metadata?: ExecutionMetadata): void;
|
|
1122
|
+
private buildExecutionLogContext;
|
|
1008
1123
|
serve(): Promise<void>;
|
|
1009
1124
|
shutdown(): Promise<void>;
|
|
1010
1125
|
call(target: string, input: any): Promise<any>;
|
|
@@ -1194,6 +1309,319 @@ declare class StatelessRateLimiter {
|
|
|
1194
1309
|
executeWithRetry<T>(fn: () => Promise<T>): Promise<T>;
|
|
1195
1310
|
}
|
|
1196
1311
|
|
|
1312
|
+
/**
|
|
1313
|
+
* Multimodal content helpers for AI prompts.
|
|
1314
|
+
* Provides Image, Audio, and File classes with factory methods for creating
|
|
1315
|
+
* multimodal content from various sources (files, URLs, buffers, base64).
|
|
1316
|
+
*/
|
|
1317
|
+
/**
|
|
1318
|
+
* Represents text content in a multimodal prompt.
|
|
1319
|
+
*/
|
|
1320
|
+
declare class Text {
|
|
1321
|
+
readonly type: 'text';
|
|
1322
|
+
readonly text: string;
|
|
1323
|
+
constructor(text: string);
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Represents image content in a multimodal prompt.
|
|
1327
|
+
*/
|
|
1328
|
+
declare class Image {
|
|
1329
|
+
readonly type: 'image_url';
|
|
1330
|
+
readonly imageUrl: {
|
|
1331
|
+
url: string;
|
|
1332
|
+
detail?: 'low' | 'high' | 'auto';
|
|
1333
|
+
};
|
|
1334
|
+
private constructor();
|
|
1335
|
+
/**
|
|
1336
|
+
* Create Image from a local file by converting to base64 data URL.
|
|
1337
|
+
*/
|
|
1338
|
+
static fromFile(filePath: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
1339
|
+
/**
|
|
1340
|
+
* Create Image from a URL.
|
|
1341
|
+
*/
|
|
1342
|
+
static fromUrl(url: string, detail?: 'low' | 'high' | 'auto'): Image;
|
|
1343
|
+
/**
|
|
1344
|
+
* Create Image from a buffer.
|
|
1345
|
+
*/
|
|
1346
|
+
static fromBuffer(buffer: Buffer | Uint8Array, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
1347
|
+
/**
|
|
1348
|
+
* Create Image from a base64 string.
|
|
1349
|
+
*/
|
|
1350
|
+
static fromBase64(base64Data: string, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Represents audio content in a multimodal prompt.
|
|
1354
|
+
*/
|
|
1355
|
+
declare class Audio {
|
|
1356
|
+
readonly type: 'input_audio';
|
|
1357
|
+
readonly audio: {
|
|
1358
|
+
data: string;
|
|
1359
|
+
format: string;
|
|
1360
|
+
};
|
|
1361
|
+
private constructor();
|
|
1362
|
+
/**
|
|
1363
|
+
* Create Audio from a local file by converting to base64.
|
|
1364
|
+
*/
|
|
1365
|
+
static fromFile(filePath: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Create Audio from a URL (downloads and converts to base64).
|
|
1368
|
+
*/
|
|
1369
|
+
static fromUrl(url: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Create Audio from a buffer.
|
|
1372
|
+
*/
|
|
1373
|
+
static fromBuffer(buffer: Buffer | Uint8Array, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Create Audio from a base64 string.
|
|
1376
|
+
*/
|
|
1377
|
+
static fromBase64(base64Data: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Represents a generic file content in a multimodal prompt.
|
|
1381
|
+
*/
|
|
1382
|
+
declare class File {
|
|
1383
|
+
readonly type: 'file';
|
|
1384
|
+
readonly file: {
|
|
1385
|
+
url: string;
|
|
1386
|
+
mimeType?: string;
|
|
1387
|
+
};
|
|
1388
|
+
private constructor();
|
|
1389
|
+
/**
|
|
1390
|
+
* Create File from a local file path.
|
|
1391
|
+
*/
|
|
1392
|
+
static fromFile(filePath: string, mimeType?: string): Promise<File>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Create File from a URL.
|
|
1395
|
+
*/
|
|
1396
|
+
static fromUrl(url: string, mimeType?: string): File;
|
|
1397
|
+
/**
|
|
1398
|
+
* Create File from a buffer.
|
|
1399
|
+
*/
|
|
1400
|
+
static fromBuffer(buffer: Buffer | Uint8Array, mimeType: string): Promise<File>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Create File from a base64 string.
|
|
1403
|
+
*/
|
|
1404
|
+
static fromBase64(base64Data: string, mimeType: string): Promise<File>;
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Create text content.
|
|
1408
|
+
*/
|
|
1409
|
+
declare function text(content: string): Text;
|
|
1410
|
+
/**
|
|
1411
|
+
* Create image content from a local file.
|
|
1412
|
+
*/
|
|
1413
|
+
declare function imageFromFile(filePath: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
1414
|
+
/**
|
|
1415
|
+
* Create image content from a URL.
|
|
1416
|
+
*/
|
|
1417
|
+
declare function imageFromUrl(url: string, detail?: 'low' | 'high' | 'auto'): Image;
|
|
1418
|
+
/**
|
|
1419
|
+
* Create image content from a buffer.
|
|
1420
|
+
*/
|
|
1421
|
+
declare function imageFromBuffer(buffer: Buffer | Uint8Array, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Create image content from a base64 string.
|
|
1424
|
+
*/
|
|
1425
|
+
declare function imageFromBase64(base64Data: string, mimeType?: string, detail?: 'low' | 'high' | 'auto'): Promise<Image>;
|
|
1426
|
+
/**
|
|
1427
|
+
* Create audio content from a local file.
|
|
1428
|
+
*/
|
|
1429
|
+
declare function audioFromFile(filePath: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Create audio content from a URL.
|
|
1432
|
+
*/
|
|
1433
|
+
declare function audioFromUrl(url: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Create audio content from a buffer.
|
|
1436
|
+
*/
|
|
1437
|
+
declare function audioFromBuffer(buffer: Buffer | Uint8Array, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1438
|
+
/**
|
|
1439
|
+
* Create audio content from a base64 string.
|
|
1440
|
+
*/
|
|
1441
|
+
declare function audioFromBase64(base64Data: string, format?: 'wav' | 'mp3' | 'flac' | 'ogg'): Promise<Audio>;
|
|
1442
|
+
/**
|
|
1443
|
+
* Create file content from a local file.
|
|
1444
|
+
*/
|
|
1445
|
+
declare function fileFromPath(filePath: string, mimeType?: string): Promise<File>;
|
|
1446
|
+
/**
|
|
1447
|
+
* Create file content from a URL.
|
|
1448
|
+
*/
|
|
1449
|
+
declare function fileFromUrl(url: string, mimeType?: string): File;
|
|
1450
|
+
/**
|
|
1451
|
+
* Create file content from a buffer.
|
|
1452
|
+
*/
|
|
1453
|
+
declare function fileFromBuffer(buffer: Buffer | Uint8Array, mimeType: string): Promise<File>;
|
|
1454
|
+
/**
|
|
1455
|
+
* Create file content from a base64 string.
|
|
1456
|
+
*/
|
|
1457
|
+
declare function fileFromBase64(base64Data: string, mimeType: string): Promise<File>;
|
|
1458
|
+
type MultimodalContent = Text | Image | Audio | File;
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Multimodal response classes for handling LLM multimodal outputs.
|
|
1462
|
+
* Provides seamless integration with audio, image, and file outputs while maintaining backward compatibility.
|
|
1463
|
+
*/
|
|
1464
|
+
/**
|
|
1465
|
+
* Represents image output from LLM with convenient access methods.
|
|
1466
|
+
*/
|
|
1467
|
+
interface ImageOutput {
|
|
1468
|
+
/** URL to image */
|
|
1469
|
+
url?: string;
|
|
1470
|
+
/** Base64-encoded image data */
|
|
1471
|
+
b64Json?: string;
|
|
1472
|
+
/** Revised prompt used for generation */
|
|
1473
|
+
revisedPrompt?: string;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Represents audio output from LLM with convenient access methods.
|
|
1477
|
+
*/
|
|
1478
|
+
interface AudioOutput {
|
|
1479
|
+
/** Base64-encoded audio data */
|
|
1480
|
+
data?: string;
|
|
1481
|
+
/** Audio format (wav, mp3, etc.) */
|
|
1482
|
+
format: string;
|
|
1483
|
+
/** URL to audio file if available */
|
|
1484
|
+
url?: string;
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Represents generic file output from LLM.
|
|
1488
|
+
*/
|
|
1489
|
+
interface FileOutput {
|
|
1490
|
+
/** URL to file */
|
|
1491
|
+
url?: string;
|
|
1492
|
+
/** Base64-encoded file data */
|
|
1493
|
+
data?: string;
|
|
1494
|
+
/** MIME type of file */
|
|
1495
|
+
mimeType?: string;
|
|
1496
|
+
/** Suggested filename */
|
|
1497
|
+
filename?: string;
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Enhanced response object that provides seamless access to multimodal content
|
|
1501
|
+
* while maintaining backward compatibility with string responses.
|
|
1502
|
+
*/
|
|
1503
|
+
declare class MultimodalResponse {
|
|
1504
|
+
private _text;
|
|
1505
|
+
private _audio;
|
|
1506
|
+
private _images;
|
|
1507
|
+
private _files;
|
|
1508
|
+
private _rawResponse;
|
|
1509
|
+
private _costUsd;
|
|
1510
|
+
private _usage;
|
|
1511
|
+
constructor(text?: string, audio?: AudioOutput | null, images?: ImageOutput[], files?: FileOutput[], rawResponse?: unknown, costUsd?: number | null, usage?: {
|
|
1512
|
+
promptTokens?: number;
|
|
1513
|
+
completionTokens?: number;
|
|
1514
|
+
totalTokens?: number;
|
|
1515
|
+
});
|
|
1516
|
+
/**
|
|
1517
|
+
* Get text content.
|
|
1518
|
+
*/
|
|
1519
|
+
get text(): string;
|
|
1520
|
+
/**
|
|
1521
|
+
* Get audio output if available.
|
|
1522
|
+
*/
|
|
1523
|
+
get audio(): AudioOutput | null;
|
|
1524
|
+
/**
|
|
1525
|
+
* Get list of image outputs.
|
|
1526
|
+
*/
|
|
1527
|
+
get images(): ImageOutput[];
|
|
1528
|
+
/**
|
|
1529
|
+
* Get list of file outputs.
|
|
1530
|
+
*/
|
|
1531
|
+
get files(): FileOutput[];
|
|
1532
|
+
/**
|
|
1533
|
+
* Check if response contains audio.
|
|
1534
|
+
*/
|
|
1535
|
+
hasAudio(): boolean;
|
|
1536
|
+
/**
|
|
1537
|
+
* Check if response contains images.
|
|
1538
|
+
*/
|
|
1539
|
+
hasImage(): boolean;
|
|
1540
|
+
/**
|
|
1541
|
+
* Check if response contains files.
|
|
1542
|
+
*/
|
|
1543
|
+
hasFile(): boolean;
|
|
1544
|
+
/**
|
|
1545
|
+
* Check if response contains any multimodal content.
|
|
1546
|
+
*/
|
|
1547
|
+
isMultimodal(): boolean;
|
|
1548
|
+
/**
|
|
1549
|
+
* Get the raw LLM response object.
|
|
1550
|
+
*/
|
|
1551
|
+
get rawResponse(): unknown;
|
|
1552
|
+
/**
|
|
1553
|
+
* Estimated cost of this LLM call in USD, if available.
|
|
1554
|
+
*/
|
|
1555
|
+
get costUsd(): number | null;
|
|
1556
|
+
/**
|
|
1557
|
+
* Token usage breakdown.
|
|
1558
|
+
*/
|
|
1559
|
+
get usage(): {
|
|
1560
|
+
promptTokens?: number;
|
|
1561
|
+
completionTokens?: number;
|
|
1562
|
+
totalTokens?: number;
|
|
1563
|
+
};
|
|
1564
|
+
/**
|
|
1565
|
+
* Get all images.
|
|
1566
|
+
* Alias for images property for API consistency.
|
|
1567
|
+
*/
|
|
1568
|
+
getImages(): ImageOutput[];
|
|
1569
|
+
/**
|
|
1570
|
+
* Get audio.
|
|
1571
|
+
* Alias for audio property for API consistency.
|
|
1572
|
+
*/
|
|
1573
|
+
getAudio(): AudioOutput | null;
|
|
1574
|
+
/**
|
|
1575
|
+
* Get all files.
|
|
1576
|
+
* Alias for files property for API consistency.
|
|
1577
|
+
*/
|
|
1578
|
+
getFiles(): FileOutput[];
|
|
1579
|
+
/**
|
|
1580
|
+
* Get raw image bytes from an ImageOutput.
|
|
1581
|
+
*/
|
|
1582
|
+
private decodeBase64;
|
|
1583
|
+
private getUrlBytes;
|
|
1584
|
+
private getImageBytes;
|
|
1585
|
+
/**
|
|
1586
|
+
* Get raw audio bytes from an AudioOutput.
|
|
1587
|
+
*/
|
|
1588
|
+
private getAudioBytes;
|
|
1589
|
+
/**
|
|
1590
|
+
* Get raw file bytes from a FileOutput.
|
|
1591
|
+
*/
|
|
1592
|
+
private getFileBytes;
|
|
1593
|
+
/**
|
|
1594
|
+
* Save a single image to file.
|
|
1595
|
+
*/
|
|
1596
|
+
saveImage(image: ImageOutput, imagePath: string): Promise<void>;
|
|
1597
|
+
/**
|
|
1598
|
+
* Save a single audio to file.
|
|
1599
|
+
*/
|
|
1600
|
+
saveAudio(audio: AudioOutput, audioPath: string): Promise<void>;
|
|
1601
|
+
/**
|
|
1602
|
+
* Save a single file to disk.
|
|
1603
|
+
*/
|
|
1604
|
+
saveFile(file: FileOutput, filePath: string): Promise<void>;
|
|
1605
|
+
/**
|
|
1606
|
+
* Save all multimodal content to a directory.
|
|
1607
|
+
* Returns a dict mapping content type to saved file paths.
|
|
1608
|
+
*/
|
|
1609
|
+
save(outputDir: string, prefix?: string): Promise<Record<string, string>>;
|
|
1610
|
+
/**
|
|
1611
|
+
* String representation for backward compatibility.
|
|
1612
|
+
*/
|
|
1613
|
+
toString(): string;
|
|
1614
|
+
/**
|
|
1615
|
+
* Developer-friendly representation.
|
|
1616
|
+
*/
|
|
1617
|
+
toJSON(): object;
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Create a MultimodalResponse from raw LLM response data.
|
|
1621
|
+
* Handles multiple formats: OpenRouter, OpenAI, and generic patterns.
|
|
1622
|
+
*/
|
|
1623
|
+
declare function createMultimodalResponse(rawResponse: unknown, text?: string): MultimodalResponse;
|
|
1624
|
+
|
|
1197
1625
|
declare const SUPPORTED_PROVIDERS: Set<string>;
|
|
1198
1626
|
declare function buildProvider(config: HarnessConfig): Promise<HarnessProvider>;
|
|
1199
1627
|
|
|
@@ -1301,4 +1729,4 @@ declare class ApprovalClient {
|
|
|
1301
1729
|
waitForApproval(executionId: string, opts?: WaitForApprovalOptions): Promise<ApprovalStatusResponse>;
|
|
1302
1730
|
}
|
|
1303
1731
|
|
|
1304
|
-
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 ApprovalRequestResponse, type ApprovalStatusResponse, type AuditTrailExport, type AuditTrailFilters, type Awaitable, CANONICAL_STATUSES, type CompactCapability, type CompactDiscoveryResponse, DIDAuthenticator, type DIDIdentity, type DIDIdentityPackage, type DIDRegistrationRequest, type DIDRegistrationResponse, type DeploymentType, DidClient, DidInterface, DidManager, type DiscoveryFormat, type DiscoveryOptions, type DiscoveryPagination, type DiscoveryResponse, type DiscoveryResult, ExecutionContext, type ExecutionCredential, type ExecutionMetadata, ExecutionStatus, type ExecutionStatusValue, 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, MCPClient, MCPClientRegistry, type MCPConfig, type MCPHealthSummary, type MCPServerConfig, type MCPTool, MCPToolRegistrar, type MCPToolRegistrarOptions, type MCPToolRegistration, type MemoryChangeEvent, MemoryClient, MemoryClientBase, type MemoryConfig, MemoryEventClient, type MemoryEventHandler, type MemoryEventHistoryOptions, MemoryInterface, type MemoryRequestMetadata, type MemoryRequestOptions, type MemoryScope, type MemoryWatchHandler, type Metrics, RateLimitError, type RateLimiterOptions, type RawResult, type ReasonerCapability, ReasonerContext, type ReasonerDefinition, type ReasonerHandler, type ReasonerOptions, type RequestApprovalPayload, SUPPORTED_PROVIDERS, type ServerlessAdapter, type ServerlessEvent, type ServerlessResponse, type SkillCapability, SkillContext, type SkillDefinition, type SkillHandler, type SkillOptions, StatelessRateLimiter, TERMINAL_STATUSES, type ToolCallConfig, type ToolCallRecord, type ToolCallTrace, type ToolsOption, type VectorSearchOptions, type VectorSearchResult, type WaitForApprovalOptions, type WorkflowCredential, type WorkflowMetadata, type WorkflowProgressOptions, WorkflowReporter, type ZodSchema, buildProvider, buildToolConfig, capabilitiesToTools, capabilityToMetadataTool, capabilityToTool, createHarnessResult, createMetrics, createRawResult, executeToolCallLoop, getCurrentContext, getCurrentSkillContext, isActive, isTerminal, normalizeStatus };
|
|
1732
|
+
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 ApprovalRequestResponse, type ApprovalStatusResponse, Audio, type AudioOutput, type AuditTrailExport, type AuditTrailFilters, type Awaitable, CANONICAL_STATUSES, type CompactCapability, type CompactDiscoveryResponse, DIDAuthenticator, type DIDIdentity, type DIDIdentityPackage, type DIDRegistrationRequest, type DIDRegistrationResponse, type DeploymentType, DidClient, DidInterface, DidManager, type DiscoveryFormat, type DiscoveryOptions, type DiscoveryPagination, type DiscoveryResponse, type DiscoveryResult, 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, MCPClient, MCPClientRegistry, type MCPConfig, type MCPHealthSummary, type MCPServerConfig, type MCPTool, MCPToolRegistrar, type MCPToolRegistrarOptions, type MCPToolRegistration, type MemoryChangeEvent, MemoryClient, MemoryClientBase, type MemoryConfig, MemoryEventClient, type MemoryEventHandler, type MemoryEventHistoryOptions, MemoryInterface, type MemoryRequestMetadata, type MemoryRequestOptions, type MemoryScope, type MemoryWatchHandler, type Metrics, type MultimodalContent, MultimodalResponse, RateLimitError, type RateLimiterOptions, type RawResult, type ReasonerCapability, ReasonerContext, type ReasonerDefinition, type ReasonerHandler, type ReasonerOptions, type RequestApprovalPayload, SUPPORTED_PROVIDERS, type ServerlessAdapter, type ServerlessEvent, type ServerlessResponse, type SkillCapability, SkillContext, type SkillDefinition, type SkillHandler, type SkillOptions, StatelessRateLimiter, TERMINAL_STATUSES, Text, type ToolCallConfig, type ToolCallRecord, type ToolCallTrace, type ToolsOption, type VectorSearchOptions, type VectorSearchResult, type WaitForApprovalOptions, type WorkflowCredential, type WorkflowMetadata, type WorkflowProgressOptions, WorkflowReporter, type ZodSchema, audioFromBase64, audioFromBuffer, audioFromFile, audioFromUrl, buildProvider, buildToolConfig, capabilitiesToTools, capabilityToMetadataTool, capabilityToTool, createExecutionLogger, createHarnessResult, createMetrics, createMultimodalResponse, createRawResult, executeToolCallLoop, fileFromBase64, fileFromBuffer, fileFromPath, fileFromUrl, getCurrentContext, getCurrentSkillContext, imageFromBase64, imageFromBuffer, imageFromFile, imageFromUrl, isActive, isExecutionLogBatchPayload, isTerminal, normalizeExecutionLogEntry, normalizeStatus, serializeExecutionLogEntry, text };
|