@convex-dev/agent 0.1.14 → 0.1.15-alpha.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.
Files changed (62) hide show
  1. package/dist/client/index.d.ts +496 -174
  2. package/dist/client/index.d.ts.map +1 -1
  3. package/dist/client/index.js +120 -165
  4. package/dist/client/index.js.map +1 -1
  5. package/dist/client/listMessages.d.ts +22 -0
  6. package/dist/client/listMessages.d.ts.map +1 -0
  7. package/dist/client/listMessages.js +25 -0
  8. package/dist/client/listMessages.js.map +1 -0
  9. package/dist/client/search.d.ts +162 -0
  10. package/dist/client/search.d.ts.map +1 -0
  11. package/dist/client/search.js +113 -0
  12. package/dist/client/search.js.map +1 -0
  13. package/dist/client/streaming.d.ts +17 -3
  14. package/dist/client/streaming.d.ts.map +1 -1
  15. package/dist/client/streaming.js +39 -1
  16. package/dist/client/streaming.js.map +1 -1
  17. package/dist/client/types.d.ts +5 -1
  18. package/dist/client/types.d.ts.map +1 -1
  19. package/dist/component/_generated/api.d.ts +14 -3
  20. package/dist/component/messages.d.ts +4 -4
  21. package/dist/component/messages.d.ts.map +1 -1
  22. package/dist/component/messages.js +12 -7
  23. package/dist/component/messages.js.map +1 -1
  24. package/dist/component/schema.d.ts +38 -28
  25. package/dist/component/schema.d.ts.map +1 -1
  26. package/dist/component/schema.js +3 -2
  27. package/dist/component/schema.js.map +1 -1
  28. package/dist/component/streams.d.ts +7 -0
  29. package/dist/component/streams.d.ts.map +1 -1
  30. package/dist/component/streams.js +49 -22
  31. package/dist/component/streams.js.map +1 -1
  32. package/dist/component/vector/index.js +3 -3
  33. package/dist/component/vector/index.js.map +1 -1
  34. package/dist/react/deltas.d.ts.map +1 -1
  35. package/dist/react/deltas.js +2 -2
  36. package/dist/react/deltas.js.map +1 -1
  37. package/dist/react/index.d.ts +4 -2
  38. package/dist/react/index.d.ts.map +1 -1
  39. package/dist/react/index.js +22 -9
  40. package/dist/react/index.js.map +1 -1
  41. package/dist/react/optimisticallySendMessage.js +1 -1
  42. package/dist/react/optimisticallySendMessage.js.map +1 -1
  43. package/dist/validators.d.ts +49 -55
  44. package/dist/validators.d.ts.map +1 -1
  45. package/dist/validators.js +3 -8
  46. package/dist/validators.js.map +1 -1
  47. package/package.json +4 -3
  48. package/src/client/index.ts +249 -268
  49. package/src/client/listMessages.ts +38 -0
  50. package/src/client/search.ts +172 -0
  51. package/src/client/streaming.ts +56 -3
  52. package/src/client/types.ts +5 -1
  53. package/src/component/_generated/api.d.ts +14 -3
  54. package/src/component/messages.ts +13 -7
  55. package/src/component/schema.ts +3 -2
  56. package/src/component/streams.ts +85 -39
  57. package/src/component/vector/index.ts +4 -4
  58. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  59. package/src/react/deltas.ts +4 -2
  60. package/src/react/index.ts +23 -11
  61. package/src/react/optimisticallySendMessage.ts +1 -1
  62. package/src/validators.ts +8 -10
@@ -5,19 +5,23 @@ import type { MessageDoc, ThreadDoc } from "../component/schema.js";
5
5
  import { type VectorDimension } from "../component/vector/tables.js";
6
6
  import { type AIMessageWithoutId } from "../mapping.js";
7
7
  import { extractText, isTool } from "../shared.js";
8
- import { type MessageWithMetadata, type MessageStatus, type ProviderMetadata, type SearchOptions, type StreamArgs, type Usage } from "../validators.js";
8
+ import { type MessageWithMetadata, type MessageStatus, type ProviderMetadata, type StreamArgs, type Usage, type MessageEmbeddings } from "../validators.js";
9
9
  import { createTool } from "./createTool.js";
10
10
  import { type StreamingOptions } from "./streaming.js";
11
11
  import type { AgentComponent, ContextOptions, GenerationOutputMetadata, Options, OurObjectArgs, OurStreamObjectArgs, RawRequestResponseHandler, RunActionCtx, RunMutationCtx, RunQueryCtx, ActionCtx, StorageOptions, StreamingTextArgs, SyncStreamsReturnValue, TextArgs, Thread, UsageHandler } from "./types.js";
12
12
  import type { threadFieldsSupportingPatch } from "../component/threads.js";
13
+ import { listMessages } from "./listMessages.js";
14
+ import { syncStreams } from "./streaming.js";
15
+ import { fetchContextMessages } from "./search.js";
13
16
  export { storeFile, getFile } from "./files.js";
14
17
  export { serializeDataOrUrl } from "../mapping.js";
15
18
  export { vMessageDoc, vThreadDoc } from "../component/schema.js";
16
19
  export { vAssistantMessage, vContextOptions, vMessage, vPaginationResult, vProviderMetadata, vStorageOptions, vStreamArgs, vSystemMessage, vToolMessage, vUsage, vUserMessage, } from "../validators.js";
17
20
  export type { ToolCtx } from "./createTool.js";
18
- export { createTool, extractText, isTool };
19
- export type { AgentComponent, ContextOptions, MessageDoc, ProviderMetadata, StorageOptions, StreamArgs, SyncStreamsReturnValue, Thread, ThreadDoc, Usage, UsageHandler, };
20
- export declare class Agent<AgentTools extends ToolSet> {
21
+ export { filterOutOrphanedToolMessages } from "./search.js";
22
+ export { createTool, extractText, fetchContextMessages, isTool, listMessages, syncStreams, };
23
+ export type { AgentComponent, ContextOptions, MessageDoc, ProviderMetadata, RawRequestResponseHandler, StorageOptions, StreamArgs, SyncStreamsReturnValue, Thread, ThreadDoc, Usage, UsageHandler, };
24
+ export declare class Agent<AgentTools extends ToolSet = ToolSet> {
21
25
  component: AgentComponent;
22
26
  options: {
23
27
  /**
@@ -381,14 +385,7 @@ export declare class Agent<AgentTools extends ToolSet> {
381
385
  * You can pass extra metadata alongside the message, e.g. associated fileIds.
382
386
  * @returns The messageId of the saved message.
383
387
  */
384
- saveMessage(ctx: RunMutationCtx, args: {
385
- threadId: string;
386
- userId?: string;
387
- /**
388
- * Metadata to save with the messages. Each element corresponds to the
389
- * message at the same index.
390
- */
391
- metadata?: Omit<MessageWithMetadata, "message">;
388
+ saveMessage(ctx: RunMutationCtx, args: SaveMessageArgs & {
392
389
  /**
393
390
  * If true, it will not generate embeddings for the message.
394
391
  * Useful if you're saving messages in a mutation where you can't run `fetch`.
@@ -396,16 +393,7 @@ export declare class Agent<AgentTools extends ToolSet> {
396
393
  * action later that calls `agent.generateAndSaveEmbeddings`.
397
394
  */
398
395
  skipEmbeddings?: boolean;
399
- } & ({
400
- prompt?: undefined;
401
- /**
402
- * The message to save.
403
- */
404
- message: CoreMessage;
405
- } | {
406
- prompt: string;
407
- message?: undefined;
408
- })): Promise<{
396
+ }): Promise<{
409
397
  messageId: string;
410
398
  message: {
411
399
  id?: string | undefined;
@@ -537,38 +525,13 @@ export declare class Agent<AgentTools extends ToolSet> {
537
525
  }>;
538
526
  /**
539
527
  * Explicitly save messages associated with the thread (& user if provided)
528
+ * If you have an embedding model set, it will also generate embeddings for
529
+ * the messages.
540
530
  * @param ctx The ctx parameter to a mutation or action.
541
531
  * @param args The messages and context to save
542
532
  * @returns
543
533
  */
544
- saveMessages(ctx: RunMutationCtx | RunActionCtx, args: {
545
- threadId: string;
546
- userId?: string;
547
- /**
548
- * The message that these messages are in response to. They will be
549
- * the same "order" as this message, at increasing stepOrder(s).
550
- */
551
- promptMessageId?: string;
552
- /**
553
- * The messages to save.
554
- */
555
- messages: CoreMessageMaybeWithId[];
556
- /**
557
- * Metadata to save with the messages. Each element corresponds to the
558
- * message at the same index.
559
- */
560
- metadata?: Omit<MessageWithMetadata, "message">[];
561
- /**
562
- * If false, it will "commit" the messages immediately.
563
- * If true, it will mark them as pending until the final step has finished.
564
- * Defaults to false.
565
- */
566
- pending?: boolean;
567
- /**
568
- * If true, it will fail any pending steps.
569
- * Defaults to false.
570
- */
571
- failPendingSteps?: boolean;
534
+ saveMessages(ctx: RunMutationCtx | RunActionCtx, args: SaveMessagesArgs & {
572
535
  /**
573
536
  * Skip generating embeddings for the messages. Useful if you're
574
537
  * saving messages in a mutation where you can't run `fetch`.
@@ -607,6 +570,7 @@ export declare class Agent<AgentTools extends ToolSet> {
607
570
  syncStreams(ctx: RunQueryCtx, args: {
608
571
  threadId: string;
609
572
  streamArgs: StreamArgs | undefined;
573
+ includeStatuses?: ("streaming" | "finished" | "aborted")[];
610
574
  }): Promise<SyncStreamsReturnValue | undefined>;
611
575
  /**
612
576
  * Fetch the context messages for a thread.
@@ -871,10 +835,6 @@ export declare class Agent<AgentTools extends ToolSet> {
871
835
  }>;
872
836
  _shouldSaveOutputMessages(storageOpts?: StorageOptions): boolean;
873
837
  _mergedContextOptions(opts: ContextOptions | undefined): ContextOptions;
874
- _searchOptionsWithEmbeddingAndDefaults(ctx: RunActionCtx, { userId, threadId }: {
875
- userId?: string;
876
- threadId?: string;
877
- }, contextOptions: ContextOptions, messages: CoreMessage[]): Promise<SearchOptions>;
878
838
  doEmbed(ctx: RunActionCtx, options: {
879
839
  userId: string | undefined;
880
840
  threadId: string | undefined;
@@ -1057,12 +1017,13 @@ export declare class Agent<AgentTools extends ToolSet> {
1057
1017
  excludeToolMessages?: boolean | undefined;
1058
1018
  recentMessages?: number | undefined;
1059
1019
  searchOptions?: {
1020
+ textSearch?: boolean | undefined;
1021
+ vectorSearch?: boolean | undefined;
1022
+ vectorScoreThreshold?: number | undefined;
1060
1023
  messageRange?: {
1061
1024
  before: number;
1062
1025
  after: number;
1063
1026
  } | undefined;
1064
- textSearch?: boolean | undefined;
1065
- vectorSearch?: boolean | undefined;
1066
1027
  limit: number;
1067
1028
  } | undefined;
1068
1029
  searchOtherThreads?: boolean | undefined;
@@ -1183,12 +1144,13 @@ export declare class Agent<AgentTools extends ToolSet> {
1183
1144
  excludeToolMessages?: boolean | undefined;
1184
1145
  recentMessages?: number | undefined;
1185
1146
  searchOptions?: {
1147
+ textSearch?: boolean | undefined;
1148
+ vectorSearch?: boolean | undefined;
1149
+ vectorScoreThreshold?: number | undefined;
1186
1150
  messageRange?: {
1187
1151
  before: number;
1188
1152
  after: number;
1189
1153
  } | undefined;
1190
- textSearch?: boolean | undefined;
1191
- vectorSearch?: boolean | undefined;
1192
1154
  limit: number;
1193
1155
  } | undefined;
1194
1156
  searchOtherThreads?: boolean | undefined;
@@ -1349,134 +1311,494 @@ export declare class Agent<AgentTools extends ToolSet> {
1349
1311
  messageIds: string[];
1350
1312
  }>>;
1351
1313
  }
1352
- export declare function filterOutOrphanedToolMessages(docs: MessageDoc[]): {
1314
+ type CoreMessageMaybeWithId = CoreMessage & {
1353
1315
  id?: string | undefined;
1354
- userId?: string | undefined;
1355
- embeddingId?: string | undefined;
1356
- fileIds?: string[] | undefined;
1357
- error?: string | undefined;
1358
- agentName?: string | undefined;
1359
- model?: string | undefined;
1360
- provider?: string | undefined;
1361
- providerOptions?: Record<string, Record<string, any>> | undefined;
1362
- message?: {
1363
- providerOptions?: Record<string, Record<string, any>> | undefined;
1364
- role: "user";
1365
- content: string | ({
1366
- providerOptions?: Record<string, Record<string, any>> | undefined;
1367
- type: "text";
1368
- text: string;
1369
- } | {
1370
- providerOptions?: Record<string, Record<string, any>> | undefined;
1371
- mimeType?: string | undefined;
1372
- type: "image";
1373
- image: string | ArrayBuffer;
1316
+ };
1317
+ /**
1318
+ * Create a thread to store messages with an Agent.
1319
+ * @param ctx The context from a mutation or action.
1320
+ * @param component The Agent component, usually `components.agent`.
1321
+ * @param args The associated thread metadata.
1322
+ * @returns The id of the created thread.
1323
+ */
1324
+ export declare function createThread(ctx: RunMutationCtx, component: AgentComponent, args?: {
1325
+ userId?: string;
1326
+ title?: string;
1327
+ summary?: string;
1328
+ }): Promise<string>;
1329
+ /**
1330
+ * Get the metadata for a thread.
1331
+ * @param ctx A ctx object from a query, mutation, or action.
1332
+ * @param args.threadId The thread to get the metadata for.
1333
+ * @returns The metadata for the thread.
1334
+ */
1335
+ export declare function getThreadMetadata(ctx: RunQueryCtx, component: AgentComponent, args: {
1336
+ threadId: string;
1337
+ }): Promise<ThreadDoc>;
1338
+ type SaveMessagesArgs = {
1339
+ threadId: string;
1340
+ userId?: string;
1341
+ /**
1342
+ * The message that these messages are in response to. They will be
1343
+ * the same "order" as this message, at increasing stepOrder(s).
1344
+ */
1345
+ promptMessageId?: string;
1346
+ /**
1347
+ * The messages to save.
1348
+ */
1349
+ messages: CoreMessageMaybeWithId[];
1350
+ /**
1351
+ * Metadata to save with the messages. Each element corresponds to the
1352
+ * message at the same index.
1353
+ */
1354
+ metadata?: Omit<MessageWithMetadata, "message">[];
1355
+ /**
1356
+ * If false, it will "commit" the messages immediately.
1357
+ * If true, it will mark them as pending until the final step has finished.
1358
+ * Defaults to false.
1359
+ */
1360
+ pending?: boolean;
1361
+ /**
1362
+ * If true, it will fail any pending steps.
1363
+ * Defaults to false.
1364
+ */
1365
+ failPendingSteps?: boolean;
1366
+ /**
1367
+ * The embeddings to save with the messages.
1368
+ */
1369
+ embeddings?: MessageEmbeddings;
1370
+ };
1371
+ /**
1372
+ * Explicitly save messages associated with the thread (& user if provided)
1373
+ */
1374
+ export declare function saveMessages(ctx: RunMutationCtx, component: AgentComponent, args: SaveMessagesArgs & {
1375
+ /**
1376
+ * The agent name to associate with the messages.
1377
+ */
1378
+ agentName?: string;
1379
+ }): Promise<{
1380
+ lastMessageId: string;
1381
+ messages: {
1382
+ _creationTime: number;
1383
+ _id: string;
1384
+ agentName?: string | undefined;
1385
+ embeddingId?: string | undefined;
1386
+ error?: string | undefined;
1387
+ fileIds?: string[] | undefined;
1388
+ finishReason?: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other" | "unknown" | undefined;
1389
+ id?: string | undefined;
1390
+ message?: {
1391
+ content: string | ({
1392
+ providerOptions?: {
1393
+ [x: string]: {
1394
+ [x: string]: any;
1395
+ };
1396
+ } | undefined;
1397
+ text: string;
1398
+ type: "text";
1399
+ } | {
1400
+ image: string | ArrayBuffer;
1401
+ mimeType?: string | undefined;
1402
+ providerOptions?: {
1403
+ [x: string]: {
1404
+ [x: string]: any;
1405
+ };
1406
+ } | undefined;
1407
+ type: "image";
1408
+ } | {
1409
+ data: string | ArrayBuffer;
1410
+ filename?: string | undefined;
1411
+ mimeType: string;
1412
+ providerOptions?: {
1413
+ [x: string]: {
1414
+ [x: string]: any;
1415
+ };
1416
+ } | undefined;
1417
+ type: "file";
1418
+ })[];
1419
+ providerOptions?: {
1420
+ [x: string]: {
1421
+ [x: string]: any;
1422
+ };
1423
+ } | undefined;
1424
+ role: "user";
1374
1425
  } | {
1375
- providerOptions?: Record<string, Record<string, any>> | undefined;
1376
- filename?: string | undefined;
1377
- type: "file";
1378
- mimeType: string;
1379
- data: string | ArrayBuffer;
1380
- })[];
1381
- } | {
1382
- providerOptions?: Record<string, Record<string, any>> | undefined;
1383
- role: "assistant";
1384
- content: string | ({
1385
- providerOptions?: Record<string, Record<string, any>> | undefined;
1386
- type: "text";
1387
- text: string;
1426
+ content: string | ({
1427
+ providerOptions?: {
1428
+ [x: string]: {
1429
+ [x: string]: any;
1430
+ };
1431
+ } | undefined;
1432
+ text: string;
1433
+ type: "text";
1434
+ } | {
1435
+ data: string | ArrayBuffer;
1436
+ filename?: string | undefined;
1437
+ mimeType: string;
1438
+ providerOptions?: {
1439
+ [x: string]: {
1440
+ [x: string]: any;
1441
+ };
1442
+ } | undefined;
1443
+ type: "file";
1444
+ } | {
1445
+ providerOptions?: {
1446
+ [x: string]: {
1447
+ [x: string]: any;
1448
+ };
1449
+ } | undefined;
1450
+ signature?: string | undefined;
1451
+ text: string;
1452
+ type: "reasoning";
1453
+ } | {
1454
+ data: string;
1455
+ providerOptions?: {
1456
+ [x: string]: {
1457
+ [x: string]: any;
1458
+ };
1459
+ } | undefined;
1460
+ type: "redacted-reasoning";
1461
+ } | {
1462
+ args: any;
1463
+ providerOptions?: {
1464
+ [x: string]: {
1465
+ [x: string]: any;
1466
+ };
1467
+ } | undefined;
1468
+ toolCallId: string;
1469
+ toolName: string;
1470
+ type: "tool-call";
1471
+ })[];
1472
+ providerOptions?: {
1473
+ [x: string]: {
1474
+ [x: string]: any;
1475
+ };
1476
+ } | undefined;
1477
+ role: "assistant";
1388
1478
  } | {
1389
- providerOptions?: Record<string, Record<string, any>> | undefined;
1390
- filename?: string | undefined;
1391
- type: "file";
1392
- mimeType: string;
1393
- data: string | ArrayBuffer;
1479
+ content: {
1480
+ args?: any;
1481
+ experimental_content?: ({
1482
+ text: string;
1483
+ type: "text";
1484
+ } | {
1485
+ data: string;
1486
+ mimeType?: string | undefined;
1487
+ type: "image";
1488
+ })[] | undefined;
1489
+ isError?: boolean | undefined;
1490
+ providerOptions?: {
1491
+ [x: string]: {
1492
+ [x: string]: any;
1493
+ };
1494
+ } | undefined;
1495
+ result: any;
1496
+ toolCallId: string;
1497
+ toolName: string;
1498
+ type: "tool-result";
1499
+ }[];
1500
+ providerOptions?: {
1501
+ [x: string]: {
1502
+ [x: string]: any;
1503
+ };
1504
+ } | undefined;
1505
+ role: "tool";
1394
1506
  } | {
1395
- providerOptions?: Record<string, Record<string, any>> | undefined;
1507
+ content: string;
1508
+ providerOptions?: {
1509
+ [x: string]: {
1510
+ [x: string]: any;
1511
+ };
1512
+ } | undefined;
1513
+ role: "system";
1514
+ } | undefined;
1515
+ model?: string | undefined;
1516
+ order: number;
1517
+ provider?: string | undefined;
1518
+ providerMetadata?: {
1519
+ [x: string]: {
1520
+ [x: string]: any;
1521
+ };
1522
+ } | undefined;
1523
+ providerOptions?: {
1524
+ [x: string]: {
1525
+ [x: string]: any;
1526
+ };
1527
+ } | undefined;
1528
+ reasoning?: string | undefined;
1529
+ reasoningDetails?: ({
1396
1530
  signature?: string | undefined;
1397
- type: "reasoning";
1398
1531
  text: string;
1532
+ type: "text";
1399
1533
  } | {
1400
- providerOptions?: Record<string, Record<string, any>> | undefined;
1401
- type: "redacted-reasoning";
1402
1534
  data: string;
1535
+ type: "redacted";
1536
+ })[] | undefined;
1537
+ sources?: {
1538
+ id: string;
1539
+ providerOptions?: {
1540
+ [x: string]: {
1541
+ [x: string]: any;
1542
+ };
1543
+ } | undefined;
1544
+ sourceType: "url";
1545
+ title?: string | undefined;
1546
+ url: string;
1547
+ }[] | undefined;
1548
+ status: "pending" | "success" | "failed";
1549
+ stepOrder: number;
1550
+ text?: string | undefined;
1551
+ threadId: string;
1552
+ tool: boolean;
1553
+ usage?: {
1554
+ completionTokens: number;
1555
+ promptTokens: number;
1556
+ totalTokens: number;
1557
+ } | undefined;
1558
+ userId?: string | undefined;
1559
+ warnings?: ({
1560
+ details?: string | undefined;
1561
+ setting: string;
1562
+ type: "unsupported-setting";
1403
1563
  } | {
1404
- providerOptions?: Record<string, Record<string, any>> | undefined;
1405
- type: "tool-call";
1406
- toolCallId: string;
1407
- toolName: string;
1408
- args: any;
1409
- })[];
1410
- } | {
1411
- providerOptions?: Record<string, Record<string, any>> | undefined;
1412
- role: "tool";
1413
- content: {
1414
- providerOptions?: Record<string, Record<string, any>> | undefined;
1415
- args?: any;
1416
- experimental_content?: ({
1417
- type: "text";
1564
+ details?: string | undefined;
1565
+ tool: any;
1566
+ type: "unsupported-tool";
1567
+ } | {
1568
+ message: string;
1569
+ type: "other";
1570
+ })[] | undefined;
1571
+ }[];
1572
+ }>;
1573
+ type SaveMessageArgs = {
1574
+ threadId: string;
1575
+ userId?: string;
1576
+ /**
1577
+ * Metadata to save with the messages. Each element corresponds to the
1578
+ * message at the same index.
1579
+ */
1580
+ metadata?: Omit<MessageWithMetadata, "message">;
1581
+ /**
1582
+ * The embedding to save with the message.
1583
+ */
1584
+ embedding?: {
1585
+ vector: number[];
1586
+ model: string;
1587
+ };
1588
+ } & ({
1589
+ prompt?: undefined;
1590
+ /**
1591
+ * The message to save.
1592
+ */
1593
+ message: CoreMessage;
1594
+ } | {
1595
+ prompt: string;
1596
+ message?: undefined;
1597
+ });
1598
+ /**
1599
+ * Save a message to the thread.
1600
+ * @param ctx A ctx object from a mutation or action.
1601
+ * @param args The message and what to associate it with (user / thread)
1602
+ * You can pass extra metadata alongside the message, e.g. associated fileIds.
1603
+ * @returns The messageId of the saved message.
1604
+ */
1605
+ export declare function saveMessage(ctx: RunMutationCtx, component: AgentComponent, args: SaveMessageArgs & {
1606
+ /**
1607
+ * The agent name to associate with the message.
1608
+ */
1609
+ agentName?: string;
1610
+ }): Promise<{
1611
+ messageId: string;
1612
+ message: {
1613
+ _creationTime: number;
1614
+ _id: string;
1615
+ agentName?: string | undefined;
1616
+ embeddingId?: string | undefined;
1617
+ error?: string | undefined;
1618
+ fileIds?: string[] | undefined;
1619
+ finishReason?: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other" | "unknown" | undefined;
1620
+ id?: string | undefined;
1621
+ message?: {
1622
+ content: string | ({
1623
+ providerOptions?: {
1624
+ [x: string]: {
1625
+ [x: string]: any;
1626
+ };
1627
+ } | undefined;
1418
1628
  text: string;
1629
+ type: "text";
1419
1630
  } | {
1631
+ image: string | ArrayBuffer;
1420
1632
  mimeType?: string | undefined;
1633
+ providerOptions?: {
1634
+ [x: string]: {
1635
+ [x: string]: any;
1636
+ };
1637
+ } | undefined;
1421
1638
  type: "image";
1639
+ } | {
1640
+ data: string | ArrayBuffer;
1641
+ filename?: string | undefined;
1642
+ mimeType: string;
1643
+ providerOptions?: {
1644
+ [x: string]: {
1645
+ [x: string]: any;
1646
+ };
1647
+ } | undefined;
1648
+ type: "file";
1649
+ })[];
1650
+ providerOptions?: {
1651
+ [x: string]: {
1652
+ [x: string]: any;
1653
+ };
1654
+ } | undefined;
1655
+ role: "user";
1656
+ } | {
1657
+ content: string | ({
1658
+ providerOptions?: {
1659
+ [x: string]: {
1660
+ [x: string]: any;
1661
+ };
1662
+ } | undefined;
1663
+ text: string;
1664
+ type: "text";
1665
+ } | {
1666
+ data: string | ArrayBuffer;
1667
+ filename?: string | undefined;
1668
+ mimeType: string;
1669
+ providerOptions?: {
1670
+ [x: string]: {
1671
+ [x: string]: any;
1672
+ };
1673
+ } | undefined;
1674
+ type: "file";
1675
+ } | {
1676
+ providerOptions?: {
1677
+ [x: string]: {
1678
+ [x: string]: any;
1679
+ };
1680
+ } | undefined;
1681
+ signature?: string | undefined;
1682
+ text: string;
1683
+ type: "reasoning";
1684
+ } | {
1422
1685
  data: string;
1423
- })[] | undefined;
1424
- isError?: boolean | undefined;
1425
- type: "tool-result";
1426
- toolCallId: string;
1427
- toolName: string;
1428
- result: any;
1429
- }[];
1430
- } | {
1431
- providerOptions?: Record<string, Record<string, any>> | undefined;
1432
- role: "system";
1433
- content: string;
1434
- } | undefined;
1435
- text?: string | undefined;
1436
- reasoning?: string | undefined;
1437
- usage?: {
1438
- promptTokens: number;
1439
- completionTokens: number;
1440
- totalTokens: number;
1441
- } | undefined;
1442
- providerMetadata?: Record<string, Record<string, any>> | undefined;
1443
- sources?: {
1444
- title?: string | undefined;
1445
- providerOptions?: Record<string, Record<string, any>> | undefined;
1446
- id: string;
1447
- sourceType: "url";
1448
- url: string;
1449
- }[] | undefined;
1450
- reasoningDetails?: ({
1451
- signature?: string | undefined;
1452
- type: "text";
1453
- text: string;
1454
- } | {
1455
- type: "redacted";
1456
- data: string;
1457
- })[] | undefined;
1458
- warnings?: ({
1459
- details?: string | undefined;
1460
- type: "unsupported-setting";
1461
- setting: string;
1462
- } | {
1463
- details?: string | undefined;
1464
- type: "unsupported-tool";
1465
- tool: any;
1466
- } | {
1467
- type: "other";
1468
- message: string;
1469
- })[] | undefined;
1470
- finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
1471
- _id: string;
1472
- _creationTime: number;
1473
- status: "pending" | "success" | "failed";
1474
- order: number;
1475
- threadId: string;
1476
- stepOrder: number;
1477
- tool: boolean;
1478
- }[];
1479
- type CoreMessageMaybeWithId = CoreMessage & {
1480
- id?: string | undefined;
1481
- };
1686
+ providerOptions?: {
1687
+ [x: string]: {
1688
+ [x: string]: any;
1689
+ };
1690
+ } | undefined;
1691
+ type: "redacted-reasoning";
1692
+ } | {
1693
+ args: any;
1694
+ providerOptions?: {
1695
+ [x: string]: {
1696
+ [x: string]: any;
1697
+ };
1698
+ } | undefined;
1699
+ toolCallId: string;
1700
+ toolName: string;
1701
+ type: "tool-call";
1702
+ })[];
1703
+ providerOptions?: {
1704
+ [x: string]: {
1705
+ [x: string]: any;
1706
+ };
1707
+ } | undefined;
1708
+ role: "assistant";
1709
+ } | {
1710
+ content: {
1711
+ args?: any;
1712
+ experimental_content?: ({
1713
+ text: string;
1714
+ type: "text";
1715
+ } | {
1716
+ data: string;
1717
+ mimeType?: string | undefined;
1718
+ type: "image";
1719
+ })[] | undefined;
1720
+ isError?: boolean | undefined;
1721
+ providerOptions?: {
1722
+ [x: string]: {
1723
+ [x: string]: any;
1724
+ };
1725
+ } | undefined;
1726
+ result: any;
1727
+ toolCallId: string;
1728
+ toolName: string;
1729
+ type: "tool-result";
1730
+ }[];
1731
+ providerOptions?: {
1732
+ [x: string]: {
1733
+ [x: string]: any;
1734
+ };
1735
+ } | undefined;
1736
+ role: "tool";
1737
+ } | {
1738
+ content: string;
1739
+ providerOptions?: {
1740
+ [x: string]: {
1741
+ [x: string]: any;
1742
+ };
1743
+ } | undefined;
1744
+ role: "system";
1745
+ } | undefined;
1746
+ model?: string | undefined;
1747
+ order: number;
1748
+ provider?: string | undefined;
1749
+ providerMetadata?: {
1750
+ [x: string]: {
1751
+ [x: string]: any;
1752
+ };
1753
+ } | undefined;
1754
+ providerOptions?: {
1755
+ [x: string]: {
1756
+ [x: string]: any;
1757
+ };
1758
+ } | undefined;
1759
+ reasoning?: string | undefined;
1760
+ reasoningDetails?: ({
1761
+ signature?: string | undefined;
1762
+ text: string;
1763
+ type: "text";
1764
+ } | {
1765
+ data: string;
1766
+ type: "redacted";
1767
+ })[] | undefined;
1768
+ sources?: {
1769
+ id: string;
1770
+ providerOptions?: {
1771
+ [x: string]: {
1772
+ [x: string]: any;
1773
+ };
1774
+ } | undefined;
1775
+ sourceType: "url";
1776
+ title?: string | undefined;
1777
+ url: string;
1778
+ }[] | undefined;
1779
+ status: "pending" | "success" | "failed";
1780
+ stepOrder: number;
1781
+ text?: string | undefined;
1782
+ threadId: string;
1783
+ tool: boolean;
1784
+ usage?: {
1785
+ completionTokens: number;
1786
+ promptTokens: number;
1787
+ totalTokens: number;
1788
+ } | undefined;
1789
+ userId?: string | undefined;
1790
+ warnings?: ({
1791
+ details?: string | undefined;
1792
+ setting: string;
1793
+ type: "unsupported-setting";
1794
+ } | {
1795
+ details?: string | undefined;
1796
+ tool: any;
1797
+ type: "unsupported-tool";
1798
+ } | {
1799
+ message: string;
1800
+ type: "other";
1801
+ })[] | undefined;
1802
+ };
1803
+ }>;
1482
1804
  //# sourceMappingURL=index.d.ts.map