@opencode/ai 0.0.0-dev-466 → 0.0.0-dev-469

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 (87) hide show
  1. package/README.md +27 -16
  2. package/dist/cache-policy.d.ts +1 -1
  3. package/dist/cache-policy.js +2 -2
  4. package/dist/decision-client.d.ts +3 -3
  5. package/dist/decision.d.ts +13 -120
  6. package/dist/decision.js +17 -13
  7. package/dist/effect.d.ts +8 -6
  8. package/dist/effect.js +4 -3
  9. package/dist/effort-updates.d.ts +1 -1
  10. package/dist/effort-updates.js +2 -2
  11. package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
  12. package/dist/experimental/cloudflare-run-extraction.js +4 -1
  13. package/dist/experimental/extraction.d.ts +12 -38
  14. package/dist/experimental/extraction.js +13 -11
  15. package/dist/experimental.d.ts +8 -8
  16. package/dist/experimental.js +4 -4
  17. package/dist/image-client.d.ts +11 -5
  18. package/dist/image-client.js +1 -1
  19. package/dist/image.d.ts +21 -62
  20. package/dist/image.js +16 -13
  21. package/dist/index.d.ts +20 -14
  22. package/dist/index.js +6 -3
  23. package/dist/llm.d.ts +60 -25
  24. package/dist/llm.js +126 -38
  25. package/dist/protocols/alibaba-images.d.ts +2 -2
  26. package/dist/protocols/alibaba-messages.js +3 -3
  27. package/dist/protocols/anthropic-messages.d.ts +1 -1
  28. package/dist/protocols/anthropic-messages.js +4 -3
  29. package/dist/protocols/assemblyai-transcription.d.ts +2 -2
  30. package/dist/protocols/cartesia-speech.d.ts +2 -2
  31. package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
  32. package/dist/protocols/deepgram-speech.d.ts +2 -2
  33. package/dist/protocols/deepgram-transcription.d.ts +2 -2
  34. package/dist/protocols/elevenlabs-speech.d.ts +2 -2
  35. package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
  36. package/dist/protocols/gemini.js +2 -8
  37. package/dist/protocols/google-images.d.ts +2 -2
  38. package/dist/protocols/google-speech.d.ts +2 -2
  39. package/dist/protocols/google-transcription.d.ts +2 -2
  40. package/dist/protocols/google-video.d.ts +2 -2
  41. package/dist/protocols/meta-images.d.ts +2 -2
  42. package/dist/protocols/meta-responses.js +4 -3
  43. package/dist/protocols/minimax-images.d.ts +2 -2
  44. package/dist/protocols/open-responses.d.ts +1 -21
  45. package/dist/protocols/openai-chat.d.ts +1 -21
  46. package/dist/protocols/openai-chat.js +7 -9
  47. package/dist/protocols/openai-decisions.js +1 -1
  48. package/dist/protocols/openai-images.d.ts +2 -2
  49. package/dist/protocols/openai-responses.js +0 -1
  50. package/dist/protocols/openai-speech.d.ts +2 -2
  51. package/dist/protocols/openai-transcription.d.ts +2 -2
  52. package/dist/protocols/runway-video.d.ts +2 -2
  53. package/dist/protocols/shared.d.ts +1 -1
  54. package/dist/protocols/shared.js +2 -2
  55. package/dist/protocols/system-one.d.ts +4 -4
  56. package/dist/protocols/utils/responses-checkpoint.js +1 -1
  57. package/dist/protocols/utils/responses-compaction.d.ts +1 -1
  58. package/dist/protocols/utils/responses-compaction.js +4 -3
  59. package/dist/protocols/utils/tool-stream.d.ts +3 -63
  60. package/dist/protocols/xai-images.d.ts +2 -2
  61. package/dist/protocols/xai-video.d.ts +2 -2
  62. package/dist/protocols/zai-images.d.ts +2 -2
  63. package/dist/protocols/zai-messages.js +3 -3
  64. package/dist/provider-error.js +4 -4
  65. package/dist/providers/vercel-ai-gateway.js +4 -3
  66. package/dist/route/client.d.ts +43 -19
  67. package/dist/route/client.js +30 -18
  68. package/dist/route/decision.d.ts +6 -6
  69. package/dist/schema/errors.d.ts +1 -2
  70. package/dist/schema/errors.js +1 -2
  71. package/dist/schema/events.d.ts +61 -769
  72. package/dist/schema/events.js +3 -30
  73. package/dist/schema/messages.d.ts +20 -92
  74. package/dist/schema/messages.js +1 -52
  75. package/dist/speech-client.d.ts +5 -5
  76. package/dist/speech.d.ts +17 -19
  77. package/dist/speech.js +16 -12
  78. package/dist/testing.d.ts +8 -168
  79. package/dist/tool-runtime.js +12 -30
  80. package/dist/transcription-client.d.ts +5 -5
  81. package/dist/transcription.d.ts +17 -19
  82. package/dist/transcription.js +16 -12
  83. package/dist/video-client.d.ts +5 -5
  84. package/dist/video-client.js +1 -1
  85. package/dist/video.d.ts +18 -20
  86. package/dist/video.js +16 -12
  87. package/package.json +3 -3
@@ -325,16 +325,6 @@ export declare const ToolResult: Schema.Struct<{
325
325
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
326
326
  }>;
327
327
  export type ToolResult = Schema.Schema.Type<typeof ToolResult>;
328
- export declare const ToolError: Schema.Struct<{
329
- readonly type: Schema.tag<"tool-error">;
330
- readonly id: Schema.String;
331
- readonly name: Schema.String;
332
- readonly namespace: Schema.optional<Schema.String>;
333
- readonly message: Schema.String;
334
- readonly error: Schema.optional<Schema.Defect>;
335
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
336
- }>;
337
- export type ToolError = Schema.Schema.Type<typeof ToolError>;
338
328
  export declare const FinishReasonDetails: Schema.Struct<{
339
329
  readonly normalized: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
340
330
  readonly raw: Schema.optional<Schema.String>;
@@ -370,6 +360,8 @@ export declare const Finish: Schema.Struct<{
370
360
  readonly explanation: Schema.optional<Schema.String>;
371
361
  }>;
372
362
  readonly usage: Schema.optional<typeof Usage>;
363
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
364
+ readonly message: Schema.optional<typeof Message>;
373
365
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
374
366
  }>;
375
367
  export type Finish = Schema.Schema.Type<typeof Finish>;
@@ -410,13 +402,6 @@ export declare const MediaEvent: Schema.Struct<{
410
402
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
411
403
  }>;
412
404
  export type MediaEvent = Schema.Schema.Type<typeof MediaEvent>;
413
- export declare const ProviderErrorEvent: Schema.Struct<{
414
- readonly type: Schema.tag<"provider-error">;
415
- readonly message: Schema.String;
416
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
417
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
418
- }>;
419
- export type ProviderErrorEvent = Schema.Schema.Type<typeof ProviderErrorEvent>;
420
405
  /** One provider frame as received, emitted before the events parsed from it when the request sets `includeRaw`. */
421
406
  export declare const RawEvent: Schema.Struct<{
422
407
  readonly type: Schema.tag<"raw">;
@@ -584,14 +569,6 @@ declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.refi
584
569
  }>;
585
570
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
586
571
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
587
- }>, Schema.Struct<{
588
- readonly type: Schema.tag<"tool-error">;
589
- readonly id: Schema.String;
590
- readonly name: Schema.String;
591
- readonly namespace: Schema.optional<Schema.String>;
592
- readonly message: Schema.String;
593
- readonly error: Schema.optional<Schema.Defect>;
594
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
595
572
  }>, Schema.Struct<{
596
573
  readonly type: Schema.tag<"media">;
597
574
  readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
@@ -650,11 +627,8 @@ declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.refi
650
627
  readonly explanation: Schema.optional<Schema.String>;
651
628
  }>;
652
629
  readonly usage: Schema.optional<typeof Usage>;
653
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
654
- }>, Schema.Struct<{
655
- readonly type: Schema.tag<"provider-error">;
656
- readonly message: Schema.String;
657
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
630
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
631
+ readonly message: Schema.optional<typeof Message>;
658
632
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
659
633
  }>, Schema.Struct<{
660
634
  readonly type: Schema.tag<"raw">;
@@ -836,14 +810,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
836
810
  }>;
837
811
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
838
812
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
839
- }>, Schema.Struct<{
840
- readonly type: Schema.tag<"tool-error">;
841
- readonly id: Schema.String;
842
- readonly name: Schema.String;
843
- readonly namespace: Schema.optional<Schema.String>;
844
- readonly message: Schema.String;
845
- readonly error: Schema.optional<Schema.Defect>;
846
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
847
813
  }>, Schema.Struct<{
848
814
  readonly type: Schema.tag<"media">;
849
815
  readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
@@ -902,18 +868,15 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
902
868
  readonly explanation: Schema.optional<Schema.String>;
903
869
  }>;
904
870
  readonly usage: Schema.optional<typeof Usage>;
905
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
906
- }>, Schema.Struct<{
907
- readonly type: Schema.tag<"provider-error">;
908
- readonly message: Schema.String;
909
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
871
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
872
+ readonly message: Schema.optional<typeof Message>;
910
873
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
911
874
  }>, Schema.Struct<{
912
875
  readonly type: Schema.tag<"raw">;
913
876
  readonly data: Schema.Unknown;
914
877
  }>]> & {
915
878
  readonly tag: "type";
916
- readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "tool-error", "media", "step-finish", "finish", "provider-error", "raw"];
879
+ readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "media", "step-finish", "finish", "raw"];
917
880
  readonly cases: {
918
881
  compaction: Schema.refine<{
919
882
  readonly type: "compaction";
@@ -953,6 +916,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
953
916
  readonly explanation: Schema.optional<Schema.String>;
954
917
  }>;
955
918
  readonly usage: Schema.optional<typeof Usage>;
919
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
920
+ readonly message: Schema.optional<typeof Message>;
956
921
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
957
922
  }>;
958
923
  media: Schema.Struct<{
@@ -990,12 +955,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
990
955
  }>, never, never>;
991
956
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
992
957
  }>;
993
- "provider-error": Schema.Struct<{
994
- readonly type: Schema.tag<"provider-error">;
995
- readonly message: Schema.String;
996
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
997
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
998
- }>;
999
958
  raw: Schema.Struct<{
1000
959
  readonly type: Schema.tag<"raw">;
1001
960
  readonly data: Schema.Unknown;
@@ -1063,15 +1022,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1063
1022
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
1064
1023
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1065
1024
  }>;
1066
- "tool-error": Schema.Struct<{
1067
- readonly type: Schema.tag<"tool-error">;
1068
- readonly id: Schema.String;
1069
- readonly name: Schema.String;
1070
- readonly namespace: Schema.optional<Schema.String>;
1071
- readonly message: Schema.String;
1072
- readonly error: Schema.optional<Schema.Defect>;
1073
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1074
- }>;
1075
1025
  "tool-input-delta": Schema.Struct<{
1076
1026
  readonly type: Schema.tag<"tool-input-delta">;
1077
1027
  readonly id: Schema.String;
@@ -1320,18 +1270,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1320
1270
  readonly [x: string]: unknown;
1321
1271
  };
1322
1272
  } | undefined;
1323
- } | {
1324
- readonly type: "tool-error";
1325
- readonly id: string;
1326
- readonly name: string;
1327
- readonly namespace?: string | undefined;
1328
- readonly message: string;
1329
- readonly error?: unknown;
1330
- readonly providerMetadata?: {
1331
- readonly [x: string]: {
1332
- readonly [x: string]: unknown;
1333
- };
1334
- } | undefined;
1335
1273
  } | {
1336
1274
  readonly type: "step-finish";
1337
1275
  readonly index: number;
@@ -1356,6 +1294,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1356
1294
  readonly explanation?: string | undefined;
1357
1295
  };
1358
1296
  readonly usage?: Usage | undefined;
1297
+ readonly message?: Message | undefined;
1359
1298
  readonly providerMetadata?: {
1360
1299
  readonly [x: string]: {
1361
1300
  readonly [x: string]: unknown;
@@ -1369,15 +1308,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1369
1308
  readonly [x: string]: unknown;
1370
1309
  };
1371
1310
  } | undefined;
1372
- } | {
1373
- readonly type: "provider-error";
1374
- readonly message: string;
1375
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
1376
- readonly providerMetadata?: {
1377
- readonly [x: string]: {
1378
- readonly [x: string]: unknown;
1379
- };
1380
- } | undefined;
1381
1311
  } | ({
1382
1312
  readonly type: "compaction";
1383
1313
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -1566,20 +1496,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1566
1496
  } | undefined;
1567
1497
  }, {
1568
1498
  readonly type: Keys;
1569
- }> | Extract<{
1570
- readonly type: "tool-error";
1571
- readonly id: string;
1572
- readonly name: string;
1573
- readonly namespace?: string | undefined;
1574
- readonly message: string;
1575
- readonly error?: unknown;
1576
- readonly providerMetadata?: {
1577
- readonly [x: string]: {
1578
- readonly [x: string]: unknown;
1579
- };
1580
- } | undefined;
1581
- }, {
1582
- readonly type: Keys;
1583
1499
  }> | Extract<{
1584
1500
  readonly type: "step-finish";
1585
1501
  readonly index: number;
@@ -1606,6 +1522,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1606
1522
  readonly explanation?: string | undefined;
1607
1523
  };
1608
1524
  readonly usage?: Usage | undefined;
1525
+ readonly message?: Message | undefined;
1609
1526
  readonly providerMetadata?: {
1610
1527
  readonly [x: string]: {
1611
1528
  readonly [x: string]: unknown;
@@ -1623,17 +1540,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1623
1540
  } | undefined;
1624
1541
  }, {
1625
1542
  readonly type: Keys;
1626
- }> | Extract<{
1627
- readonly type: "provider-error";
1628
- readonly message: string;
1629
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
1630
- readonly providerMetadata?: {
1631
- readonly [x: string]: {
1632
- readonly [x: string]: unknown;
1633
- };
1634
- } | undefined;
1635
- }, {
1636
- readonly type: Keys;
1637
1543
  }> | Extract<{
1638
1544
  readonly type: "compaction";
1639
1545
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -1680,6 +1586,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1680
1586
  readonly explanation?: string | undefined;
1681
1587
  };
1682
1588
  readonly usage?: Usage | undefined;
1589
+ readonly message?: Message | undefined;
1683
1590
  readonly providerMetadata?: {
1684
1591
  readonly [x: string]: {
1685
1592
  readonly [x: string]: unknown;
@@ -1695,16 +1602,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1695
1602
  };
1696
1603
  } | undefined;
1697
1604
  };
1698
- "provider-error": (u: unknown) => u is {
1699
- readonly type: "provider-error";
1700
- readonly message: string;
1701
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
1702
- readonly providerMetadata?: {
1703
- readonly [x: string]: {
1704
- readonly [x: string]: unknown;
1705
- };
1706
- } | undefined;
1707
- };
1708
1605
  raw: (u: unknown) => u is {
1709
1606
  readonly type: "raw";
1710
1607
  readonly data: unknown;
@@ -1800,19 +1697,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1800
1697
  };
1801
1698
  } | undefined;
1802
1699
  };
1803
- "tool-error": (u: unknown) => u is {
1804
- readonly type: "tool-error";
1805
- readonly id: string;
1806
- readonly name: string;
1807
- readonly namespace?: string | undefined;
1808
- readonly message: string;
1809
- readonly error?: unknown;
1810
- readonly providerMetadata?: {
1811
- readonly [x: string]: {
1812
- readonly [x: string]: unknown;
1813
- };
1814
- } | undefined;
1815
- };
1816
1700
  "tool-input-delta": (u: unknown) => u is {
1817
1701
  readonly type: "tool-input-delta";
1818
1702
  readonly id: string;
@@ -1898,7 +1782,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1898
1782
  };
1899
1783
  };
1900
1784
  readonly match: {
1901
- <Handlers extends { [K in "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
1785
+ <Handlers extends { [K in "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
1902
1786
  readonly compaction: Schema.refine<{
1903
1787
  readonly type: "compaction";
1904
1788
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -1937,6 +1821,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1937
1821
  readonly explanation: Schema.optional<Schema.String>;
1938
1822
  }>;
1939
1823
  readonly usage: Schema.optional<typeof Usage>;
1824
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
1825
+ readonly message: Schema.optional<typeof Message>;
1940
1826
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1941
1827
  }>;
1942
1828
  readonly media: Schema.Struct<{
@@ -1974,12 +1860,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
1974
1860
  }>, never, never>;
1975
1861
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1976
1862
  }>;
1977
- readonly "provider-error": Schema.Struct<{
1978
- readonly type: Schema.tag<"provider-error">;
1979
- readonly message: Schema.String;
1980
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
1981
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1982
- }>;
1983
1863
  readonly raw: Schema.Struct<{
1984
1864
  readonly type: Schema.tag<"raw">;
1985
1865
  readonly data: Schema.Unknown;
@@ -2047,15 +1927,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2047
1927
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
2048
1928
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2049
1929
  }>;
2050
- readonly "tool-error": Schema.Struct<{
2051
- readonly type: Schema.tag<"tool-error">;
2052
- readonly id: Schema.String;
2053
- readonly name: Schema.String;
2054
- readonly namespace: Schema.optional<Schema.String>;
2055
- readonly message: Schema.String;
2056
- readonly error: Schema.optional<Schema.Defect>;
2057
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2058
- }>;
2059
1930
  readonly "tool-input-delta": Schema.Struct<{
2060
1931
  readonly type: Schema.tag<"tool-input-delta">;
2061
1932
  readonly id: Schema.String;
@@ -2303,18 +2174,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2303
2174
  readonly [x: string]: unknown;
2304
2175
  };
2305
2176
  } | undefined;
2306
- } | {
2307
- readonly type: "tool-error";
2308
- readonly id: string;
2309
- readonly name: string;
2310
- readonly namespace?: string | undefined;
2311
- readonly message: string;
2312
- readonly error?: unknown;
2313
- readonly providerMetadata?: {
2314
- readonly [x: string]: {
2315
- readonly [x: string]: unknown;
2316
- };
2317
- } | undefined;
2318
2177
  } | {
2319
2178
  readonly type: "step-finish";
2320
2179
  readonly index: number;
@@ -2339,6 +2198,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2339
2198
  readonly explanation?: string | undefined;
2340
2199
  };
2341
2200
  readonly usage?: Usage | undefined;
2201
+ readonly message?: Message | undefined;
2342
2202
  readonly providerMetadata?: {
2343
2203
  readonly [x: string]: {
2344
2204
  readonly [x: string]: unknown;
@@ -2352,15 +2212,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2352
2212
  readonly [x: string]: unknown;
2353
2213
  };
2354
2214
  } | undefined;
2355
- } | {
2356
- readonly type: "provider-error";
2357
- readonly message: string;
2358
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2359
- readonly providerMetadata?: {
2360
- readonly [x: string]: {
2361
- readonly [x: string]: unknown;
2362
- };
2363
- } | undefined;
2364
2215
  } | ({
2365
2216
  readonly type: "compaction";
2366
2217
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -2373,8 +2224,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2373
2224
  } | {
2374
2225
  readonly text: string | null;
2375
2226
  readonly encrypted?: never;
2376
- })), cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
2377
- <Handlers extends { [K in "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
2227
+ })), cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
2228
+ <Handlers extends { [K in "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
2378
2229
  readonly compaction: Schema.refine<{
2379
2230
  readonly type: "compaction";
2380
2231
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -2413,6 +2264,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2413
2264
  readonly explanation: Schema.optional<Schema.String>;
2414
2265
  }>;
2415
2266
  readonly usage: Schema.optional<typeof Usage>;
2267
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
2268
+ readonly message: Schema.optional<typeof Message>;
2416
2269
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2417
2270
  }>;
2418
2271
  readonly media: Schema.Struct<{
@@ -2450,12 +2303,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2450
2303
  }>, never, never>;
2451
2304
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2452
2305
  }>;
2453
- readonly "provider-error": Schema.Struct<{
2454
- readonly type: Schema.tag<"provider-error">;
2455
- readonly message: Schema.String;
2456
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
2457
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2458
- }>;
2459
2306
  readonly raw: Schema.Struct<{
2460
2307
  readonly type: Schema.tag<"raw">;
2461
2308
  readonly data: Schema.Unknown;
@@ -2523,15 +2370,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2523
2370
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
2524
2371
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2525
2372
  }>;
2526
- readonly "tool-error": Schema.Struct<{
2527
- readonly type: Schema.tag<"tool-error">;
2528
- readonly id: Schema.String;
2529
- readonly name: Schema.String;
2530
- readonly namespace: Schema.optional<Schema.String>;
2531
- readonly message: Schema.String;
2532
- readonly error: Schema.optional<Schema.Defect>;
2533
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2534
- }>;
2535
2373
  readonly "tool-input-delta": Schema.Struct<{
2536
2374
  readonly type: Schema.tag<"tool-input-delta">;
2537
2375
  readonly id: Schema.String;
@@ -2779,18 +2617,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2779
2617
  readonly [x: string]: unknown;
2780
2618
  };
2781
2619
  } | undefined;
2782
- } | {
2783
- readonly type: "tool-error";
2784
- readonly id: string;
2785
- readonly name: string;
2786
- readonly namespace?: string | undefined;
2787
- readonly message: string;
2788
- readonly error?: unknown;
2789
- readonly providerMetadata?: {
2790
- readonly [x: string]: {
2791
- readonly [x: string]: unknown;
2792
- };
2793
- } | undefined;
2794
2620
  } | {
2795
2621
  readonly type: "step-finish";
2796
2622
  readonly index: number;
@@ -2815,6 +2641,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2815
2641
  readonly explanation?: string | undefined;
2816
2642
  };
2817
2643
  readonly usage?: Usage | undefined;
2644
+ readonly message?: Message | undefined;
2818
2645
  readonly providerMetadata?: {
2819
2646
  readonly [x: string]: {
2820
2647
  readonly [x: string]: unknown;
@@ -2828,15 +2655,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2828
2655
  readonly [x: string]: unknown;
2829
2656
  };
2830
2657
  } | undefined;
2831
- } | {
2832
- readonly type: "provider-error";
2833
- readonly message: string;
2834
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2835
- readonly providerMetadata?: {
2836
- readonly [x: string]: {
2837
- readonly [x: string]: unknown;
2838
- };
2839
- } | undefined;
2840
2658
  } | ({
2841
2659
  readonly type: "compaction";
2842
2660
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -2849,7 +2667,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
2849
2667
  } | {
2850
2668
  readonly text: string | null;
2851
2669
  readonly encrypted?: never;
2852
- }))) => import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
2670
+ }))) => import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
2853
2671
  };
2854
2672
  readonly matchOrElse: {
2855
2673
  <Handlers, OrElse>(value: {
@@ -3000,18 +2818,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3000
2818
  readonly [x: string]: unknown;
3001
2819
  };
3002
2820
  } | undefined;
3003
- } | {
3004
- readonly type: "tool-error";
3005
- readonly id: string;
3006
- readonly name: string;
3007
- readonly namespace?: string | undefined;
3008
- readonly message: string;
3009
- readonly error?: unknown;
3010
- readonly providerMetadata?: {
3011
- readonly [x: string]: {
3012
- readonly [x: string]: unknown;
3013
- };
3014
- } | undefined;
3015
2821
  } | {
3016
2822
  readonly type: "step-finish";
3017
2823
  readonly index: number;
@@ -3036,6 +2842,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3036
2842
  readonly explanation?: string | undefined;
3037
2843
  };
3038
2844
  readonly usage?: Usage | undefined;
2845
+ readonly message?: Message | undefined;
3039
2846
  readonly providerMetadata?: {
3040
2847
  readonly [x: string]: {
3041
2848
  readonly [x: string]: unknown;
@@ -3049,15 +2856,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3049
2856
  readonly [x: string]: unknown;
3050
2857
  };
3051
2858
  } | undefined;
3052
- } | {
3053
- readonly type: "provider-error";
3054
- readonly message: string;
3055
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3056
- readonly providerMetadata?: {
3057
- readonly [x: string]: {
3058
- readonly [x: string]: unknown;
3059
- };
3060
- } | undefined;
3061
2859
  } | ({
3062
2860
  readonly type: "compaction";
3063
2861
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -3093,6 +2891,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3093
2891
  readonly explanation?: string | undefined;
3094
2892
  };
3095
2893
  readonly usage?: Usage | undefined;
2894
+ readonly message?: Message | undefined;
3096
2895
  readonly providerMetadata?: {
3097
2896
  readonly [x: string]: {
3098
2897
  readonly [x: string]: unknown;
@@ -3108,16 +2907,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3108
2907
  };
3109
2908
  } | undefined;
3110
2909
  }) => any) | undefined;
3111
- readonly "provider-error"?: ((value: {
3112
- readonly type: "provider-error";
3113
- readonly message: string;
3114
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3115
- readonly providerMetadata?: {
3116
- readonly [x: string]: {
3117
- readonly [x: string]: unknown;
3118
- };
3119
- } | undefined;
3120
- }) => any) | undefined;
3121
2910
  readonly raw?: ((value: {
3122
2911
  readonly type: "raw";
3123
2912
  readonly data: unknown;
@@ -3213,19 +3002,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3213
3002
  };
3214
3003
  } | undefined;
3215
3004
  }) => any) | undefined;
3216
- readonly "tool-error"?: ((value: {
3217
- readonly type: "tool-error";
3218
- readonly id: string;
3219
- readonly name: string;
3220
- readonly namespace?: string | undefined;
3221
- readonly message: string;
3222
- readonly error?: unknown;
3223
- readonly providerMetadata?: {
3224
- readonly [x: string]: {
3225
- readonly [x: string]: unknown;
3226
- };
3227
- } | undefined;
3228
- }) => any) | undefined;
3229
3005
  readonly "tool-input-delta"?: ((value: {
3230
3006
  readonly type: "tool-input-delta";
3231
3007
  readonly id: string;
@@ -3309,7 +3085,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3309
3085
  };
3310
3086
  } | undefined;
3311
3087
  }) => any) | undefined;
3312
- } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
3088
+ } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
3313
3089
  readonly type: "step-start";
3314
3090
  readonly index: number;
3315
3091
  }, {
@@ -3485,20 +3261,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3485
3261
  } | undefined;
3486
3262
  }, {
3487
3263
  readonly type: keyof Handlers;
3488
- }> | Exclude<{
3489
- readonly type: "tool-error";
3490
- readonly id: string;
3491
- readonly name: string;
3492
- readonly namespace?: string | undefined;
3493
- readonly message: string;
3494
- readonly error?: unknown;
3495
- readonly providerMetadata?: {
3496
- readonly [x: string]: {
3497
- readonly [x: string]: unknown;
3498
- };
3499
- } | undefined;
3500
- }, {
3501
- readonly type: keyof Handlers;
3502
3264
  }> | Exclude<{
3503
3265
  readonly type: "step-finish";
3504
3266
  readonly index: number;
@@ -3525,6 +3287,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3525
3287
  readonly explanation?: string | undefined;
3526
3288
  };
3527
3289
  readonly usage?: Usage | undefined;
3290
+ readonly message?: Message | undefined;
3528
3291
  readonly providerMetadata?: {
3529
3292
  readonly [x: string]: {
3530
3293
  readonly [x: string]: unknown;
@@ -3542,17 +3305,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3542
3305
  } | undefined;
3543
3306
  }, {
3544
3307
  readonly type: keyof Handlers;
3545
- }> | Exclude<{
3546
- readonly type: "provider-error";
3547
- readonly message: string;
3548
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3549
- readonly providerMetadata?: {
3550
- readonly [x: string]: {
3551
- readonly [x: string]: unknown;
3552
- };
3553
- } | undefined;
3554
- }, {
3555
- readonly type: keyof Handlers;
3556
3308
  }> | Exclude<{
3557
3309
  readonly type: "compaction";
3558
3310
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -3599,6 +3351,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3599
3351
  readonly explanation?: string | undefined;
3600
3352
  };
3601
3353
  readonly usage?: Usage | undefined;
3354
+ readonly message?: Message | undefined;
3602
3355
  readonly providerMetadata?: {
3603
3356
  readonly [x: string]: {
3604
3357
  readonly [x: string]: unknown;
@@ -3614,16 +3367,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3614
3367
  };
3615
3368
  } | undefined;
3616
3369
  }) => any) | undefined;
3617
- readonly "provider-error"?: ((value: {
3618
- readonly type: "provider-error";
3619
- readonly message: string;
3620
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3621
- readonly providerMetadata?: {
3622
- readonly [x: string]: {
3623
- readonly [x: string]: unknown;
3624
- };
3625
- } | undefined;
3626
- }) => any) | undefined;
3627
3370
  readonly raw?: ((value: {
3628
3371
  readonly type: "raw";
3629
3372
  readonly data: unknown;
@@ -3719,19 +3462,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3719
3462
  };
3720
3463
  } | undefined;
3721
3464
  }) => any) | undefined;
3722
- readonly "tool-error"?: ((value: {
3723
- readonly type: "tool-error";
3724
- readonly id: string;
3725
- readonly name: string;
3726
- readonly namespace?: string | undefined;
3727
- readonly message: string;
3728
- readonly error?: unknown;
3729
- readonly providerMetadata?: {
3730
- readonly [x: string]: {
3731
- readonly [x: string]: unknown;
3732
- };
3733
- } | undefined;
3734
- }) => any) | undefined;
3735
3465
  readonly "tool-input-delta"?: ((value: {
3736
3466
  readonly type: "tool-input-delta";
3737
3467
  readonly id: string;
@@ -3815,7 +3545,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3815
3545
  };
3816
3546
  } | undefined;
3817
3547
  }) => any) | undefined;
3818
- } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
3548
+ } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
3819
3549
  readonly type: "step-start";
3820
3550
  readonly index: number;
3821
3551
  }, {
@@ -3991,20 +3721,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
3991
3721
  } | undefined;
3992
3722
  }, {
3993
3723
  readonly type: keyof Handlers;
3994
- }> | Exclude<{
3995
- readonly type: "tool-error";
3996
- readonly id: string;
3997
- readonly name: string;
3998
- readonly namespace?: string | undefined;
3999
- readonly message: string;
4000
- readonly error?: unknown;
4001
- readonly providerMetadata?: {
4002
- readonly [x: string]: {
4003
- readonly [x: string]: unknown;
4004
- };
4005
- } | undefined;
4006
- }, {
4007
- readonly type: keyof Handlers;
4008
3724
  }> | Exclude<{
4009
3725
  readonly type: "step-finish";
4010
3726
  readonly index: number;
@@ -4031,6 +3747,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4031
3747
  readonly explanation?: string | undefined;
4032
3748
  };
4033
3749
  readonly usage?: Usage | undefined;
3750
+ readonly message?: Message | undefined;
4034
3751
  readonly providerMetadata?: {
4035
3752
  readonly [x: string]: {
4036
3753
  readonly [x: string]: unknown;
@@ -4048,17 +3765,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4048
3765
  } | undefined;
4049
3766
  }, {
4050
3767
  readonly type: keyof Handlers;
4051
- }> | Exclude<{
4052
- readonly type: "provider-error";
4053
- readonly message: string;
4054
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4055
- readonly providerMetadata?: {
4056
- readonly [x: string]: {
4057
- readonly [x: string]: unknown;
4058
- };
4059
- } | undefined;
4060
- }, {
4061
- readonly type: keyof Handlers;
4062
3768
  }> | Exclude<{
4063
3769
  readonly type: "compaction";
4064
3770
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -4229,18 +3935,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4229
3935
  readonly [x: string]: unknown;
4230
3936
  };
4231
3937
  } | undefined;
4232
- } | {
4233
- readonly type: "tool-error";
4234
- readonly id: string;
4235
- readonly name: string;
4236
- readonly namespace?: string | undefined;
4237
- readonly message: string;
4238
- readonly error?: unknown;
4239
- readonly providerMetadata?: {
4240
- readonly [x: string]: {
4241
- readonly [x: string]: unknown;
4242
- };
4243
- } | undefined;
4244
3938
  } | {
4245
3939
  readonly type: "step-finish";
4246
3940
  readonly index: number;
@@ -4265,6 +3959,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4265
3959
  readonly explanation?: string | undefined;
4266
3960
  };
4267
3961
  readonly usage?: Usage | undefined;
3962
+ readonly message?: Message | undefined;
4268
3963
  readonly providerMetadata?: {
4269
3964
  readonly [x: string]: {
4270
3965
  readonly [x: string]: unknown;
@@ -4278,15 +3973,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4278
3973
  readonly [x: string]: unknown;
4279
3974
  };
4280
3975
  } | undefined;
4281
- } | {
4282
- readonly type: "provider-error";
4283
- readonly message: string;
4284
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4285
- readonly providerMetadata?: {
4286
- readonly [x: string]: {
4287
- readonly [x: string]: unknown;
4288
- };
4289
- } | undefined;
4290
3976
  } | ({
4291
3977
  readonly type: "compaction";
4292
3978
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -4488,19 +4174,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4488
4174
  };
4489
4175
  } | undefined;
4490
4176
  };
4491
- toolError: (input: WithID<ToolError, ToolCallID>) => {
4492
- readonly type: "tool-error";
4493
- readonly id: string;
4494
- readonly name: string;
4495
- readonly namespace?: string | undefined;
4496
- readonly message: string;
4497
- readonly error?: unknown;
4498
- readonly providerMetadata?: {
4499
- readonly [x: string]: {
4500
- readonly [x: string]: unknown;
4501
- };
4502
- } | undefined;
4503
- };
4504
4177
  media: (input: {
4505
4178
  readonly type?: "media" | undefined;
4506
4179
  readonly media: Media.Asset;
@@ -4543,25 +4216,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4543
4216
  readonly explanation?: string | undefined;
4544
4217
  };
4545
4218
  readonly usage?: Usage | undefined;
4546
- readonly providerMetadata?: {
4547
- readonly [x: string]: {
4548
- readonly [x: string]: unknown;
4549
- };
4550
- } | undefined;
4551
- };
4552
- providerError: (input: {
4553
- readonly type?: "provider-error" | undefined;
4554
- readonly message: string;
4555
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4556
- readonly providerMetadata?: {
4557
- readonly [x: string]: {
4558
- readonly [x: string]: unknown;
4559
- };
4560
- } | undefined;
4561
- }, options?: Schema.MakeOptions) => {
4562
- readonly type: "provider-error";
4563
- readonly message: string;
4564
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4219
+ readonly message?: Message | undefined;
4565
4220
  readonly providerMetadata?: {
4566
4221
  readonly [x: string]: {
4567
4222
  readonly [x: string]: unknown;
@@ -4747,19 +4402,6 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4747
4402
  };
4748
4403
  } | undefined;
4749
4404
  };
4750
- toolError: (u: unknown) => u is {
4751
- readonly type: "tool-error";
4752
- readonly id: string;
4753
- readonly name: string;
4754
- readonly namespace?: string | undefined;
4755
- readonly message: string;
4756
- readonly error?: unknown;
4757
- readonly providerMetadata?: {
4758
- readonly [x: string]: {
4759
- readonly [x: string]: unknown;
4760
- };
4761
- } | undefined;
4762
- };
4763
4405
  media: (u: unknown) => u is {
4764
4406
  readonly type: "media";
4765
4407
  readonly media: Media.Asset;
@@ -4794,16 +4436,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
4794
4436
  readonly explanation?: string | undefined;
4795
4437
  };
4796
4438
  readonly usage?: Usage | undefined;
4797
- readonly providerMetadata?: {
4798
- readonly [x: string]: {
4799
- readonly [x: string]: unknown;
4800
- };
4801
- } | undefined;
4802
- };
4803
- providerError: (u: unknown) => u is {
4804
- readonly type: "provider-error";
4805
- readonly message: string;
4806
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4439
+ readonly message?: Message | undefined;
4807
4440
  readonly providerMetadata?: {
4808
4441
  readonly [x: string]: {
4809
4442
  readonly [x: string]: unknown;
@@ -5002,14 +4635,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5002
4635
  }>;
5003
4636
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
5004
4637
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5005
- }>, Schema.Struct<{
5006
- readonly type: Schema.tag<"tool-error">;
5007
- readonly id: Schema.String;
5008
- readonly name: Schema.String;
5009
- readonly namespace: Schema.optional<Schema.String>;
5010
- readonly message: Schema.String;
5011
- readonly error: Schema.optional<Schema.Defect>;
5012
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5013
4638
  }>, Schema.Struct<{
5014
4639
  readonly type: Schema.tag<"media">;
5015
4640
  readonly media: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
@@ -5068,18 +4693,15 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5068
4693
  readonly explanation: Schema.optional<Schema.String>;
5069
4694
  }>;
5070
4695
  readonly usage: Schema.optional<typeof Usage>;
5071
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5072
- }>, Schema.Struct<{
5073
- readonly type: Schema.tag<"provider-error">;
5074
- readonly message: Schema.String;
5075
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
4696
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
4697
+ readonly message: Schema.optional<typeof Message>;
5076
4698
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5077
4699
  }>, Schema.Struct<{
5078
4700
  readonly type: Schema.tag<"raw">;
5079
4701
  readonly data: Schema.Unknown;
5080
4702
  }>]> & {
5081
4703
  readonly tag: "type";
5082
- readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "tool-error", "media", "step-finish", "finish", "provider-error", "raw"];
4704
+ readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "media", "step-finish", "finish", "raw"];
5083
4705
  readonly cases: {
5084
4706
  compaction: Schema.refine<{
5085
4707
  readonly type: "compaction";
@@ -5119,6 +4741,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5119
4741
  readonly explanation: Schema.optional<Schema.String>;
5120
4742
  }>;
5121
4743
  readonly usage: Schema.optional<typeof Usage>;
4744
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
4745
+ readonly message: Schema.optional<typeof Message>;
5122
4746
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5123
4747
  }>;
5124
4748
  media: Schema.Struct<{
@@ -5156,12 +4780,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5156
4780
  }>, never, never>;
5157
4781
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5158
4782
  }>;
5159
- "provider-error": Schema.Struct<{
5160
- readonly type: Schema.tag<"provider-error">;
5161
- readonly message: Schema.String;
5162
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
5163
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5164
- }>;
5165
4783
  raw: Schema.Struct<{
5166
4784
  readonly type: Schema.tag<"raw">;
5167
4785
  readonly data: Schema.Unknown;
@@ -5229,15 +4847,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5229
4847
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
5230
4848
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5231
4849
  }>;
5232
- "tool-error": Schema.Struct<{
5233
- readonly type: Schema.tag<"tool-error">;
5234
- readonly id: Schema.String;
5235
- readonly name: Schema.String;
5236
- readonly namespace: Schema.optional<Schema.String>;
5237
- readonly message: Schema.String;
5238
- readonly error: Schema.optional<Schema.Defect>;
5239
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
5240
- }>;
5241
4850
  "tool-input-delta": Schema.Struct<{
5242
4851
  readonly type: Schema.tag<"tool-input-delta">;
5243
4852
  readonly id: Schema.String;
@@ -5486,18 +5095,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5486
5095
  readonly [x: string]: unknown;
5487
5096
  };
5488
5097
  } | undefined;
5489
- } | {
5490
- readonly type: "tool-error";
5491
- readonly id: string;
5492
- readonly name: string;
5493
- readonly namespace?: string | undefined;
5494
- readonly message: string;
5495
- readonly error?: unknown;
5496
- readonly providerMetadata?: {
5497
- readonly [x: string]: {
5498
- readonly [x: string]: unknown;
5499
- };
5500
- } | undefined;
5501
5098
  } | {
5502
5099
  readonly type: "step-finish";
5503
5100
  readonly index: number;
@@ -5522,6 +5119,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5522
5119
  readonly explanation?: string | undefined;
5523
5120
  };
5524
5121
  readonly usage?: Usage | undefined;
5122
+ readonly message?: Message | undefined;
5525
5123
  readonly providerMetadata?: {
5526
5124
  readonly [x: string]: {
5527
5125
  readonly [x: string]: unknown;
@@ -5535,15 +5133,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5535
5133
  readonly [x: string]: unknown;
5536
5134
  };
5537
5135
  } | undefined;
5538
- } | {
5539
- readonly type: "provider-error";
5540
- readonly message: string;
5541
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5542
- readonly providerMetadata?: {
5543
- readonly [x: string]: {
5544
- readonly [x: string]: unknown;
5545
- };
5546
- } | undefined;
5547
5136
  } | ({
5548
5137
  readonly type: "compaction";
5549
5138
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -5732,20 +5321,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5732
5321
  } | undefined;
5733
5322
  }, {
5734
5323
  readonly type: Keys;
5735
- }> | Extract<{
5736
- readonly type: "tool-error";
5737
- readonly id: string;
5738
- readonly name: string;
5739
- readonly namespace?: string | undefined;
5740
- readonly message: string;
5741
- readonly error?: unknown;
5742
- readonly providerMetadata?: {
5743
- readonly [x: string]: {
5744
- readonly [x: string]: unknown;
5745
- };
5746
- } | undefined;
5747
- }, {
5748
- readonly type: Keys;
5749
5324
  }> | Extract<{
5750
5325
  readonly type: "step-finish";
5751
5326
  readonly index: number;
@@ -5772,6 +5347,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5772
5347
  readonly explanation?: string | undefined;
5773
5348
  };
5774
5349
  readonly usage?: Usage | undefined;
5350
+ readonly message?: Message | undefined;
5775
5351
  readonly providerMetadata?: {
5776
5352
  readonly [x: string]: {
5777
5353
  readonly [x: string]: unknown;
@@ -5789,17 +5365,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5789
5365
  } | undefined;
5790
5366
  }, {
5791
5367
  readonly type: Keys;
5792
- }> | Extract<{
5793
- readonly type: "provider-error";
5794
- readonly message: string;
5795
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5796
- readonly providerMetadata?: {
5797
- readonly [x: string]: {
5798
- readonly [x: string]: unknown;
5799
- };
5800
- } | undefined;
5801
- }, {
5802
- readonly type: Keys;
5803
5368
  }> | Extract<{
5804
5369
  readonly type: "compaction";
5805
5370
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -5846,6 +5411,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5846
5411
  readonly explanation?: string | undefined;
5847
5412
  };
5848
5413
  readonly usage?: Usage | undefined;
5414
+ readonly message?: Message | undefined;
5849
5415
  readonly providerMetadata?: {
5850
5416
  readonly [x: string]: {
5851
5417
  readonly [x: string]: unknown;
@@ -5861,16 +5427,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5861
5427
  };
5862
5428
  } | undefined;
5863
5429
  };
5864
- "provider-error": (u: unknown) => u is {
5865
- readonly type: "provider-error";
5866
- readonly message: string;
5867
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5868
- readonly providerMetadata?: {
5869
- readonly [x: string]: {
5870
- readonly [x: string]: unknown;
5871
- };
5872
- } | undefined;
5873
- };
5874
5430
  raw: (u: unknown) => u is {
5875
5431
  readonly type: "raw";
5876
5432
  readonly data: unknown;
@@ -5966,19 +5522,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
5966
5522
  };
5967
5523
  } | undefined;
5968
5524
  };
5969
- "tool-error": (u: unknown) => u is {
5970
- readonly type: "tool-error";
5971
- readonly id: string;
5972
- readonly name: string;
5973
- readonly namespace?: string | undefined;
5974
- readonly message: string;
5975
- readonly error?: unknown;
5976
- readonly providerMetadata?: {
5977
- readonly [x: string]: {
5978
- readonly [x: string]: unknown;
5979
- };
5980
- } | undefined;
5981
- };
5982
5525
  "tool-input-delta": (u: unknown) => u is {
5983
5526
  readonly type: "tool-input-delta";
5984
5527
  readonly id: string;
@@ -6064,7 +5607,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6064
5607
  };
6065
5608
  };
6066
5609
  readonly match: {
6067
- <Handlers extends { [K in "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
5610
+ <Handlers extends { [K in "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
6068
5611
  readonly compaction: Schema.refine<{
6069
5612
  readonly type: "compaction";
6070
5613
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -6103,6 +5646,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6103
5646
  readonly explanation: Schema.optional<Schema.String>;
6104
5647
  }>;
6105
5648
  readonly usage: Schema.optional<typeof Usage>;
5649
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
5650
+ readonly message: Schema.optional<typeof Message>;
6106
5651
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6107
5652
  }>;
6108
5653
  readonly media: Schema.Struct<{
@@ -6140,12 +5685,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6140
5685
  }>, never, never>;
6141
5686
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6142
5687
  }>;
6143
- readonly "provider-error": Schema.Struct<{
6144
- readonly type: Schema.tag<"provider-error">;
6145
- readonly message: Schema.String;
6146
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
6147
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6148
- }>;
6149
5688
  readonly raw: Schema.Struct<{
6150
5689
  readonly type: Schema.tag<"raw">;
6151
5690
  readonly data: Schema.Unknown;
@@ -6213,15 +5752,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6213
5752
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
6214
5753
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6215
5754
  }>;
6216
- readonly "tool-error": Schema.Struct<{
6217
- readonly type: Schema.tag<"tool-error">;
6218
- readonly id: Schema.String;
6219
- readonly name: Schema.String;
6220
- readonly namespace: Schema.optional<Schema.String>;
6221
- readonly message: Schema.String;
6222
- readonly error: Schema.optional<Schema.Defect>;
6223
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6224
- }>;
6225
5755
  readonly "tool-input-delta": Schema.Struct<{
6226
5756
  readonly type: Schema.tag<"tool-input-delta">;
6227
5757
  readonly id: Schema.String;
@@ -6469,18 +5999,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6469
5999
  readonly [x: string]: unknown;
6470
6000
  };
6471
6001
  } | undefined;
6472
- } | {
6473
- readonly type: "tool-error";
6474
- readonly id: string;
6475
- readonly name: string;
6476
- readonly namespace?: string | undefined;
6477
- readonly message: string;
6478
- readonly error?: unknown;
6479
- readonly providerMetadata?: {
6480
- readonly [x: string]: {
6481
- readonly [x: string]: unknown;
6482
- };
6483
- } | undefined;
6484
6002
  } | {
6485
6003
  readonly type: "step-finish";
6486
6004
  readonly index: number;
@@ -6505,6 +6023,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6505
6023
  readonly explanation?: string | undefined;
6506
6024
  };
6507
6025
  readonly usage?: Usage | undefined;
6026
+ readonly message?: Message | undefined;
6508
6027
  readonly providerMetadata?: {
6509
6028
  readonly [x: string]: {
6510
6029
  readonly [x: string]: unknown;
@@ -6518,15 +6037,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6518
6037
  readonly [x: string]: unknown;
6519
6038
  };
6520
6039
  } | undefined;
6521
- } | {
6522
- readonly type: "provider-error";
6523
- readonly message: string;
6524
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
6525
- readonly providerMetadata?: {
6526
- readonly [x: string]: {
6527
- readonly [x: string]: unknown;
6528
- };
6529
- } | undefined;
6530
6040
  } | ({
6531
6041
  readonly type: "compaction";
6532
6042
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -6539,8 +6049,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6539
6049
  } | {
6540
6050
  readonly text: string | null;
6541
6051
  readonly encrypted?: never;
6542
- })), cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
6543
- <Handlers extends { [K in "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
6052
+ })), cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
6053
+ <Handlers extends { [K in "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]: (value: {
6544
6054
  readonly compaction: Schema.refine<{
6545
6055
  readonly type: "compaction";
6546
6056
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -6579,6 +6089,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6579
6089
  readonly explanation: Schema.optional<Schema.String>;
6580
6090
  }>;
6581
6091
  readonly usage: Schema.optional<typeof Usage>;
6092
+ /** The final assistant message, set by `ai.stream` and `ai.loop`. */
6093
+ readonly message: Schema.optional<typeof Message>;
6582
6094
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6583
6095
  }>;
6584
6096
  readonly media: Schema.Struct<{
@@ -6616,12 +6128,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6616
6128
  }>, never, never>;
6617
6129
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6618
6130
  }>;
6619
- readonly "provider-error": Schema.Struct<{
6620
- readonly type: Schema.tag<"provider-error">;
6621
- readonly message: Schema.String;
6622
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
6623
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6624
- }>;
6625
6131
  readonly raw: Schema.Struct<{
6626
6132
  readonly type: Schema.tag<"raw">;
6627
6133
  readonly data: Schema.Unknown;
@@ -6689,15 +6195,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6689
6195
  readonly providerExecuted: Schema.optional<Schema.Boolean>;
6690
6196
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6691
6197
  }>;
6692
- readonly "tool-error": Schema.Struct<{
6693
- readonly type: Schema.tag<"tool-error">;
6694
- readonly id: Schema.String;
6695
- readonly name: Schema.String;
6696
- readonly namespace: Schema.optional<Schema.String>;
6697
- readonly message: Schema.String;
6698
- readonly error: Schema.optional<Schema.Defect>;
6699
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
6700
- }>;
6701
6198
  readonly "tool-input-delta": Schema.Struct<{
6702
6199
  readonly type: Schema.tag<"tool-input-delta">;
6703
6200
  readonly id: Schema.String;
@@ -6945,18 +6442,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6945
6442
  readonly [x: string]: unknown;
6946
6443
  };
6947
6444
  } | undefined;
6948
- } | {
6949
- readonly type: "tool-error";
6950
- readonly id: string;
6951
- readonly name: string;
6952
- readonly namespace?: string | undefined;
6953
- readonly message: string;
6954
- readonly error?: unknown;
6955
- readonly providerMetadata?: {
6956
- readonly [x: string]: {
6957
- readonly [x: string]: unknown;
6958
- };
6959
- } | undefined;
6960
6445
  } | {
6961
6446
  readonly type: "step-finish";
6962
6447
  readonly index: number;
@@ -6981,6 +6466,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6981
6466
  readonly explanation?: string | undefined;
6982
6467
  };
6983
6468
  readonly usage?: Usage | undefined;
6469
+ readonly message?: Message | undefined;
6984
6470
  readonly providerMetadata?: {
6985
6471
  readonly [x: string]: {
6986
6472
  readonly [x: string]: unknown;
@@ -6994,15 +6480,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
6994
6480
  readonly [x: string]: unknown;
6995
6481
  };
6996
6482
  } | undefined;
6997
- } | {
6998
- readonly type: "provider-error";
6999
- readonly message: string;
7000
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
7001
- readonly providerMetadata?: {
7002
- readonly [x: string]: {
7003
- readonly [x: string]: unknown;
7004
- };
7005
- } | undefined;
7006
6483
  } | ({
7007
6484
  readonly type: "compaction";
7008
6485
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -7015,7 +6492,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7015
6492
  } | {
7016
6493
  readonly text: string | null;
7017
6494
  readonly encrypted?: never;
7018
- }))) => import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
6495
+ }))) => import("effect/Unify").Unify<ReturnType<Handlers["compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"]>>;
7019
6496
  };
7020
6497
  readonly matchOrElse: {
7021
6498
  <Handlers, OrElse>(value: {
@@ -7166,18 +6643,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7166
6643
  readonly [x: string]: unknown;
7167
6644
  };
7168
6645
  } | undefined;
7169
- } | {
7170
- readonly type: "tool-error";
7171
- readonly id: string;
7172
- readonly name: string;
7173
- readonly namespace?: string | undefined;
7174
- readonly message: string;
7175
- readonly error?: unknown;
7176
- readonly providerMetadata?: {
7177
- readonly [x: string]: {
7178
- readonly [x: string]: unknown;
7179
- };
7180
- } | undefined;
7181
6646
  } | {
7182
6647
  readonly type: "step-finish";
7183
6648
  readonly index: number;
@@ -7202,6 +6667,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7202
6667
  readonly explanation?: string | undefined;
7203
6668
  };
7204
6669
  readonly usage?: Usage | undefined;
6670
+ readonly message?: Message | undefined;
7205
6671
  readonly providerMetadata?: {
7206
6672
  readonly [x: string]: {
7207
6673
  readonly [x: string]: unknown;
@@ -7215,15 +6681,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7215
6681
  readonly [x: string]: unknown;
7216
6682
  };
7217
6683
  } | undefined;
7218
- } | {
7219
- readonly type: "provider-error";
7220
- readonly message: string;
7221
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
7222
- readonly providerMetadata?: {
7223
- readonly [x: string]: {
7224
- readonly [x: string]: unknown;
7225
- };
7226
- } | undefined;
7227
6684
  } | ({
7228
6685
  readonly type: "compaction";
7229
6686
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -7259,6 +6716,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7259
6716
  readonly explanation?: string | undefined;
7260
6717
  };
7261
6718
  readonly usage?: Usage | undefined;
6719
+ readonly message?: Message | undefined;
7262
6720
  readonly providerMetadata?: {
7263
6721
  readonly [x: string]: {
7264
6722
  readonly [x: string]: unknown;
@@ -7274,16 +6732,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7274
6732
  };
7275
6733
  } | undefined;
7276
6734
  }) => any) | undefined;
7277
- readonly "provider-error"?: ((value: {
7278
- readonly type: "provider-error";
7279
- readonly message: string;
7280
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
7281
- readonly providerMetadata?: {
7282
- readonly [x: string]: {
7283
- readonly [x: string]: unknown;
7284
- };
7285
- } | undefined;
7286
- }) => any) | undefined;
7287
6735
  readonly raw?: ((value: {
7288
6736
  readonly type: "raw";
7289
6737
  readonly data: unknown;
@@ -7379,19 +6827,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7379
6827
  };
7380
6828
  } | undefined;
7381
6829
  }) => any) | undefined;
7382
- readonly "tool-error"?: ((value: {
7383
- readonly type: "tool-error";
7384
- readonly id: string;
7385
- readonly name: string;
7386
- readonly namespace?: string | undefined;
7387
- readonly message: string;
7388
- readonly error?: unknown;
7389
- readonly providerMetadata?: {
7390
- readonly [x: string]: {
7391
- readonly [x: string]: unknown;
7392
- };
7393
- } | undefined;
7394
- }) => any) | undefined;
7395
6830
  readonly "tool-input-delta"?: ((value: {
7396
6831
  readonly type: "tool-input-delta";
7397
6832
  readonly id: string;
@@ -7475,7 +6910,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7475
6910
  };
7476
6911
  } | undefined;
7477
6912
  }) => any) | undefined;
7478
- } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
6913
+ } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
7479
6914
  readonly type: "step-start";
7480
6915
  readonly index: number;
7481
6916
  }, {
@@ -7651,20 +7086,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7651
7086
  } | undefined;
7652
7087
  }, {
7653
7088
  readonly type: keyof Handlers;
7654
- }> | Exclude<{
7655
- readonly type: "tool-error";
7656
- readonly id: string;
7657
- readonly name: string;
7658
- readonly namespace?: string | undefined;
7659
- readonly message: string;
7660
- readonly error?: unknown;
7661
- readonly providerMetadata?: {
7662
- readonly [x: string]: {
7663
- readonly [x: string]: unknown;
7664
- };
7665
- } | undefined;
7666
- }, {
7667
- readonly type: keyof Handlers;
7668
7089
  }> | Exclude<{
7669
7090
  readonly type: "step-finish";
7670
7091
  readonly index: number;
@@ -7691,6 +7112,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7691
7112
  readonly explanation?: string | undefined;
7692
7113
  };
7693
7114
  readonly usage?: Usage | undefined;
7115
+ readonly message?: Message | undefined;
7694
7116
  readonly providerMetadata?: {
7695
7117
  readonly [x: string]: {
7696
7118
  readonly [x: string]: unknown;
@@ -7708,17 +7130,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7708
7130
  } | undefined;
7709
7131
  }, {
7710
7132
  readonly type: keyof Handlers;
7711
- }> | Exclude<{
7712
- readonly type: "provider-error";
7713
- readonly message: string;
7714
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
7715
- readonly providerMetadata?: {
7716
- readonly [x: string]: {
7717
- readonly [x: string]: unknown;
7718
- };
7719
- } | undefined;
7720
- }, {
7721
- readonly type: keyof Handlers;
7722
7133
  }> | Exclude<{
7723
7134
  readonly type: "compaction";
7724
7135
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -7765,6 +7176,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7765
7176
  readonly explanation?: string | undefined;
7766
7177
  };
7767
7178
  readonly usage?: Usage | undefined;
7179
+ readonly message?: Message | undefined;
7768
7180
  readonly providerMetadata?: {
7769
7181
  readonly [x: string]: {
7770
7182
  readonly [x: string]: unknown;
@@ -7780,16 +7192,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7780
7192
  };
7781
7193
  } | undefined;
7782
7194
  }) => any) | undefined;
7783
- readonly "provider-error"?: ((value: {
7784
- readonly type: "provider-error";
7785
- readonly message: string;
7786
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
7787
- readonly providerMetadata?: {
7788
- readonly [x: string]: {
7789
- readonly [x: string]: unknown;
7790
- };
7791
- } | undefined;
7792
- }) => any) | undefined;
7793
7195
  readonly raw?: ((value: {
7794
7196
  readonly type: "raw";
7795
7197
  readonly data: unknown;
@@ -7885,19 +7287,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7885
7287
  };
7886
7288
  } | undefined;
7887
7289
  }) => any) | undefined;
7888
- readonly "tool-error"?: ((value: {
7889
- readonly type: "tool-error";
7890
- readonly id: string;
7891
- readonly name: string;
7892
- readonly namespace?: string | undefined;
7893
- readonly message: string;
7894
- readonly error?: unknown;
7895
- readonly providerMetadata?: {
7896
- readonly [x: string]: {
7897
- readonly [x: string]: unknown;
7898
- };
7899
- } | undefined;
7900
- }) => any) | undefined;
7901
7290
  readonly "tool-input-delta"?: ((value: {
7902
7291
  readonly type: "tool-input-delta";
7903
7292
  readonly id: string;
@@ -7981,7 +7370,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
7981
7370
  };
7982
7371
  } | undefined;
7983
7372
  }) => any) | undefined;
7984
- } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
7373
+ } & (Exclude<keyof Handlers, "compaction" | "finish" | "media" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
7985
7374
  readonly type: "step-start";
7986
7375
  readonly index: number;
7987
7376
  }, {
@@ -8157,20 +7546,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8157
7546
  } | undefined;
8158
7547
  }, {
8159
7548
  readonly type: keyof Handlers;
8160
- }> | Exclude<{
8161
- readonly type: "tool-error";
8162
- readonly id: string;
8163
- readonly name: string;
8164
- readonly namespace?: string | undefined;
8165
- readonly message: string;
8166
- readonly error?: unknown;
8167
- readonly providerMetadata?: {
8168
- readonly [x: string]: {
8169
- readonly [x: string]: unknown;
8170
- };
8171
- } | undefined;
8172
- }, {
8173
- readonly type: keyof Handlers;
8174
7549
  }> | Exclude<{
8175
7550
  readonly type: "step-finish";
8176
7551
  readonly index: number;
@@ -8197,6 +7572,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8197
7572
  readonly explanation?: string | undefined;
8198
7573
  };
8199
7574
  readonly usage?: Usage | undefined;
7575
+ readonly message?: Message | undefined;
8200
7576
  readonly providerMetadata?: {
8201
7577
  readonly [x: string]: {
8202
7578
  readonly [x: string]: unknown;
@@ -8214,17 +7590,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8214
7590
  } | undefined;
8215
7591
  }, {
8216
7592
  readonly type: keyof Handlers;
8217
- }> | Exclude<{
8218
- readonly type: "provider-error";
8219
- readonly message: string;
8220
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
8221
- readonly providerMetadata?: {
8222
- readonly [x: string]: {
8223
- readonly [x: string]: unknown;
8224
- };
8225
- } | undefined;
8226
- }, {
8227
- readonly type: keyof Handlers;
8228
7593
  }> | Exclude<{
8229
7594
  readonly type: "compaction";
8230
7595
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -8395,18 +7760,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8395
7760
  readonly [x: string]: unknown;
8396
7761
  };
8397
7762
  } | undefined;
8398
- } | {
8399
- readonly type: "tool-error";
8400
- readonly id: string;
8401
- readonly name: string;
8402
- readonly namespace?: string | undefined;
8403
- readonly message: string;
8404
- readonly error?: unknown;
8405
- readonly providerMetadata?: {
8406
- readonly [x: string]: {
8407
- readonly [x: string]: unknown;
8408
- };
8409
- } | undefined;
8410
7763
  } | {
8411
7764
  readonly type: "step-finish";
8412
7765
  readonly index: number;
@@ -8431,6 +7784,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8431
7784
  readonly explanation?: string | undefined;
8432
7785
  };
8433
7786
  readonly usage?: Usage | undefined;
7787
+ readonly message?: Message | undefined;
8434
7788
  readonly providerMetadata?: {
8435
7789
  readonly [x: string]: {
8436
7790
  readonly [x: string]: unknown;
@@ -8444,15 +7798,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8444
7798
  readonly [x: string]: unknown;
8445
7799
  };
8446
7800
  } | undefined;
8447
- } | {
8448
- readonly type: "provider-error";
8449
- readonly message: string;
8450
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
8451
- readonly providerMetadata?: {
8452
- readonly [x: string]: {
8453
- readonly [x: string]: unknown;
8454
- };
8455
- } | undefined;
8456
7801
  } | ({
8457
7802
  readonly type: "compaction";
8458
7803
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
@@ -8654,19 +7999,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8654
7999
  };
8655
8000
  } | undefined;
8656
8001
  };
8657
- toolError: (input: WithID<ToolError, ToolCallID>) => {
8658
- readonly type: "tool-error";
8659
- readonly id: string;
8660
- readonly name: string;
8661
- readonly namespace?: string | undefined;
8662
- readonly message: string;
8663
- readonly error?: unknown;
8664
- readonly providerMetadata?: {
8665
- readonly [x: string]: {
8666
- readonly [x: string]: unknown;
8667
- };
8668
- } | undefined;
8669
- };
8670
8002
  media: (input: {
8671
8003
  readonly type?: "media" | undefined;
8672
8004
  readonly media: Media.Asset;
@@ -8709,25 +8041,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8709
8041
  readonly explanation?: string | undefined;
8710
8042
  };
8711
8043
  readonly usage?: Usage | undefined;
8712
- readonly providerMetadata?: {
8713
- readonly [x: string]: {
8714
- readonly [x: string]: unknown;
8715
- };
8716
- } | undefined;
8717
- };
8718
- providerError: (input: {
8719
- readonly type?: "provider-error" | undefined;
8720
- readonly message: string;
8721
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
8722
- readonly providerMetadata?: {
8723
- readonly [x: string]: {
8724
- readonly [x: string]: unknown;
8725
- };
8726
- } | undefined;
8727
- }, options?: Schema.MakeOptions) => {
8728
- readonly type: "provider-error";
8729
- readonly message: string;
8730
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
8044
+ readonly message?: Message | undefined;
8731
8045
  readonly providerMetadata?: {
8732
8046
  readonly [x: string]: {
8733
8047
  readonly [x: string]: unknown;
@@ -8913,19 +8227,6 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8913
8227
  };
8914
8228
  } | undefined;
8915
8229
  };
8916
- toolError: (u: unknown) => u is {
8917
- readonly type: "tool-error";
8918
- readonly id: string;
8919
- readonly name: string;
8920
- readonly namespace?: string | undefined;
8921
- readonly message: string;
8922
- readonly error?: unknown;
8923
- readonly providerMetadata?: {
8924
- readonly [x: string]: {
8925
- readonly [x: string]: unknown;
8926
- };
8927
- } | undefined;
8928
- };
8929
8230
  media: (u: unknown) => u is {
8930
8231
  readonly type: "media";
8931
8232
  readonly media: Media.Asset;
@@ -8960,16 +8261,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
8960
8261
  readonly explanation?: string | undefined;
8961
8262
  };
8962
8263
  readonly usage?: Usage | undefined;
8963
- readonly providerMetadata?: {
8964
- readonly [x: string]: {
8965
- readonly [x: string]: unknown;
8966
- };
8967
- } | undefined;
8968
- };
8969
- providerError: (u: unknown) => u is {
8970
- readonly type: "provider-error";
8971
- readonly message: string;
8972
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
8264
+ readonly message?: Message | undefined;
8973
8265
  readonly providerMetadata?: {
8974
8266
  readonly [x: string]: {
8975
8267
  readonly [x: string]: unknown;
@@ -9022,7 +8314,7 @@ export declare namespace LLMResponse {
9022
8314
  const empty: typeof emptyResponseState;
9023
8315
  /** Purely fold one provider-neutral event into the attempt assembly state. */
9024
8316
  const reduce: typeof reduceResponseState;
9025
- /** Return a completed response only after a terminal finish or provider error. */
8317
+ /** Return a completed response only after the terminal finish. */
9026
8318
  const complete: (state: State) => LLMResponse | undefined;
9027
8319
  /** Convenience reducer for callers that already have a collected event list. */
9028
8320
  const fromEvents: (events: ReadonlyArray<LLMEvent>) => LLMResponse | undefined;