@convex-dev/agent 0.1.15-alpha.0 → 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 (39) hide show
  1. package/dist/client/index.d.ts +494 -173
  2. package/dist/client/index.d.ts.map +1 -1
  3. package/dist/client/index.js +119 -166
  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 +32 -0
  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 +2 -2
  20. package/dist/component/messages.d.ts +3 -3
  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/vector/index.js +3 -3
  25. package/dist/component/vector/index.js.map +1 -1
  26. package/dist/validators.d.ts +41 -52
  27. package/dist/validators.d.ts.map +1 -1
  28. package/dist/validators.js +1 -8
  29. package/dist/validators.js.map +1 -1
  30. package/package.json +4 -3
  31. package/src/client/index.ts +245 -268
  32. package/src/client/listMessages.ts +38 -0
  33. package/src/client/search.ts +172 -0
  34. package/src/client/streaming.ts +49 -2
  35. package/src/client/types.ts +5 -1
  36. package/src/component/_generated/api.d.ts +2 -2
  37. package/src/component/messages.ts +13 -7
  38. package/src/component/vector/index.ts +4 -4
  39. package/src/validators.ts +2 -10
@@ -5,18 +5,22 @@ 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, };
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, };
20
24
  export declare class Agent<AgentTools extends ToolSet = ToolSet> {
21
25
  component: AgentComponent;
22
26
  options: {
@@ -381,14 +385,7 @@ export declare class Agent<AgentTools extends ToolSet = 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 = 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 = 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`.
@@ -872,10 +835,6 @@ export declare class Agent<AgentTools extends ToolSet = ToolSet> {
872
835
  }>;
873
836
  _shouldSaveOutputMessages(storageOpts?: StorageOptions): boolean;
874
837
  _mergedContextOptions(opts: ContextOptions | undefined): ContextOptions;
875
- _searchOptionsWithEmbeddingAndDefaults(ctx: RunActionCtx, { userId, threadId }: {
876
- userId?: string;
877
- threadId?: string;
878
- }, contextOptions: ContextOptions, messages: CoreMessage[]): Promise<SearchOptions>;
879
838
  doEmbed(ctx: RunActionCtx, options: {
880
839
  userId: string | undefined;
881
840
  threadId: string | undefined;
@@ -1058,12 +1017,13 @@ export declare class Agent<AgentTools extends ToolSet = ToolSet> {
1058
1017
  excludeToolMessages?: boolean | undefined;
1059
1018
  recentMessages?: number | undefined;
1060
1019
  searchOptions?: {
1020
+ textSearch?: boolean | undefined;
1021
+ vectorSearch?: boolean | undefined;
1022
+ vectorScoreThreshold?: number | undefined;
1061
1023
  messageRange?: {
1062
1024
  before: number;
1063
1025
  after: number;
1064
1026
  } | undefined;
1065
- textSearch?: boolean | undefined;
1066
- vectorSearch?: boolean | undefined;
1067
1027
  limit: number;
1068
1028
  } | undefined;
1069
1029
  searchOtherThreads?: boolean | undefined;
@@ -1184,12 +1144,13 @@ export declare class Agent<AgentTools extends ToolSet = ToolSet> {
1184
1144
  excludeToolMessages?: boolean | undefined;
1185
1145
  recentMessages?: number | undefined;
1186
1146
  searchOptions?: {
1147
+ textSearch?: boolean | undefined;
1148
+ vectorSearch?: boolean | undefined;
1149
+ vectorScoreThreshold?: number | undefined;
1187
1150
  messageRange?: {
1188
1151
  before: number;
1189
1152
  after: number;
1190
1153
  } | undefined;
1191
- textSearch?: boolean | undefined;
1192
- vectorSearch?: boolean | undefined;
1193
1154
  limit: number;
1194
1155
  } | undefined;
1195
1156
  searchOtherThreads?: boolean | undefined;
@@ -1350,134 +1311,494 @@ export declare class Agent<AgentTools extends ToolSet = ToolSet> {
1350
1311
  messageIds: string[];
1351
1312
  }>>;
1352
1313
  }
1353
- export declare function filterOutOrphanedToolMessages(docs: MessageDoc[]): {
1314
+ type CoreMessageMaybeWithId = CoreMessage & {
1354
1315
  id?: string | undefined;
1355
- userId?: string | undefined;
1356
- embeddingId?: string | undefined;
1357
- fileIds?: string[] | undefined;
1358
- error?: string | undefined;
1359
- agentName?: string | undefined;
1360
- model?: string | undefined;
1361
- provider?: string | undefined;
1362
- providerOptions?: Record<string, Record<string, any>> | undefined;
1363
- message?: {
1364
- providerOptions?: Record<string, Record<string, any>> | undefined;
1365
- role: "user";
1366
- content: string | ({
1367
- providerOptions?: Record<string, Record<string, any>> | undefined;
1368
- type: "text";
1369
- text: string;
1370
- } | {
1371
- providerOptions?: Record<string, Record<string, any>> | undefined;
1372
- mimeType?: string | undefined;
1373
- type: "image";
1374
- 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";
1375
1425
  } | {
1376
- providerOptions?: Record<string, Record<string, any>> | undefined;
1377
- filename?: string | undefined;
1378
- type: "file";
1379
- mimeType: string;
1380
- data: string | ArrayBuffer;
1381
- })[];
1382
- } | {
1383
- providerOptions?: Record<string, Record<string, any>> | undefined;
1384
- role: "assistant";
1385
- content: string | ({
1386
- providerOptions?: Record<string, Record<string, any>> | undefined;
1387
- type: "text";
1388
- 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";
1389
1478
  } | {
1390
- providerOptions?: Record<string, Record<string, any>> | undefined;
1391
- filename?: string | undefined;
1392
- type: "file";
1393
- mimeType: string;
1394
- 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";
1395
1506
  } | {
1396
- 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?: ({
1397
1530
  signature?: string | undefined;
1398
- type: "reasoning";
1399
1531
  text: string;
1532
+ type: "text";
1400
1533
  } | {
1401
- providerOptions?: Record<string, Record<string, any>> | undefined;
1402
- type: "redacted-reasoning";
1403
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";
1404
1563
  } | {
1405
- providerOptions?: Record<string, Record<string, any>> | undefined;
1406
- type: "tool-call";
1407
- toolCallId: string;
1408
- toolName: string;
1409
- args: any;
1410
- })[];
1411
- } | {
1412
- providerOptions?: Record<string, Record<string, any>> | undefined;
1413
- role: "tool";
1414
- content: {
1415
- providerOptions?: Record<string, Record<string, any>> | undefined;
1416
- args?: any;
1417
- experimental_content?: ({
1418
- 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;
1419
1628
  text: string;
1629
+ type: "text";
1420
1630
  } | {
1631
+ image: string | ArrayBuffer;
1421
1632
  mimeType?: string | undefined;
1633
+ providerOptions?: {
1634
+ [x: string]: {
1635
+ [x: string]: any;
1636
+ };
1637
+ } | undefined;
1422
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
+ } | {
1423
1685
  data: string;
1424
- })[] | undefined;
1425
- isError?: boolean | undefined;
1426
- type: "tool-result";
1427
- toolCallId: string;
1428
- toolName: string;
1429
- result: any;
1430
- }[];
1431
- } | {
1432
- providerOptions?: Record<string, Record<string, any>> | undefined;
1433
- role: "system";
1434
- content: string;
1435
- } | undefined;
1436
- text?: string | undefined;
1437
- reasoning?: string | undefined;
1438
- usage?: {
1439
- promptTokens: number;
1440
- completionTokens: number;
1441
- totalTokens: number;
1442
- } | undefined;
1443
- providerMetadata?: Record<string, Record<string, any>> | undefined;
1444
- sources?: {
1445
- title?: string | undefined;
1446
- providerOptions?: Record<string, Record<string, any>> | undefined;
1447
- id: string;
1448
- sourceType: "url";
1449
- url: string;
1450
- }[] | undefined;
1451
- reasoningDetails?: ({
1452
- signature?: string | undefined;
1453
- type: "text";
1454
- text: string;
1455
- } | {
1456
- type: "redacted";
1457
- data: string;
1458
- })[] | undefined;
1459
- warnings?: ({
1460
- details?: string | undefined;
1461
- type: "unsupported-setting";
1462
- setting: string;
1463
- } | {
1464
- details?: string | undefined;
1465
- type: "unsupported-tool";
1466
- tool: any;
1467
- } | {
1468
- type: "other";
1469
- message: string;
1470
- })[] | undefined;
1471
- finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
1472
- _id: string;
1473
- _creationTime: number;
1474
- status: "pending" | "success" | "failed";
1475
- order: number;
1476
- threadId: string;
1477
- stepOrder: number;
1478
- tool: boolean;
1479
- }[];
1480
- type CoreMessageMaybeWithId = CoreMessage & {
1481
- id?: string | undefined;
1482
- };
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
+ }>;
1483
1804
  //# sourceMappingURL=index.d.ts.map