@opencode-ai/ai 0.0.0-beta-18387 → 0.0.0-beta-18593

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 (54) hide show
  1. package/README.md +29 -11
  2. package/dist/image.js +5 -4
  3. package/dist/llm.d.ts +2 -0
  4. package/dist/llm.js +4 -7
  5. package/dist/protocols/anthropic-messages.js +7 -5
  6. package/dist/protocols/bedrock-converse.d.ts +1 -0
  7. package/dist/protocols/bedrock-converse.js +17 -7
  8. package/dist/protocols/bedrock-event-stream.js +16 -6
  9. package/dist/protocols/gemini.d.ts +1 -0
  10. package/dist/protocols/gemini.js +13 -1
  11. package/dist/protocols/google-images.js +8 -18
  12. package/dist/protocols/open-responses-channel.js +20 -9
  13. package/dist/protocols/open-responses-continuation.js +9 -8
  14. package/dist/protocols/open-responses.d.ts +9 -3
  15. package/dist/protocols/open-responses.js +139 -78
  16. package/dist/protocols/openai-chat.d.ts +3 -1
  17. package/dist/protocols/openai-chat.js +39 -28
  18. package/dist/protocols/openai-compatible-chat.js +1 -2
  19. package/dist/protocols/openai-images.js +11 -16
  20. package/dist/protocols/openai-responses.js +1 -1
  21. package/dist/protocols/shared.d.ts +11 -7
  22. package/dist/protocols/shared.js +31 -18
  23. package/dist/protocols/utils/image-input.d.ts +4 -4
  24. package/dist/protocols/utils/image-input.js +6 -8
  25. package/dist/protocols/utils/lifecycle.d.ts +6 -2
  26. package/dist/protocols/utils/lifecycle.js +11 -7
  27. package/dist/protocols/utils/tool-stream.d.ts +6 -0
  28. package/dist/protocols/xai-images.js +7 -12
  29. package/dist/protocols/zai-images.js +5 -10
  30. package/dist/provider-error.d.ts +4 -4
  31. package/dist/provider-error.js +39 -55
  32. package/dist/providers/groq.d.ts +1 -1
  33. package/dist/providers/groq.js +1 -2
  34. package/dist/providers/openrouter.d.ts +1 -1
  35. package/dist/providers/openrouter.js +1 -2
  36. package/dist/route/auth.js +3 -5
  37. package/dist/route/client.d.ts +2 -0
  38. package/dist/route/client.js +29 -11
  39. package/dist/route/executor.d.ts +9 -5
  40. package/dist/route/executor.js +33 -66
  41. package/dist/route/framing.d.ts +6 -2
  42. package/dist/route/framing.js +5 -0
  43. package/dist/route/transport/http.js +7 -2
  44. package/dist/route/transport/index.d.ts +3 -1
  45. package/dist/route/transport/websocket-channel.d.ts +2 -1
  46. package/dist/route/transport/websocket.d.ts +2 -1
  47. package/dist/route/transport/websocket.js +70 -30
  48. package/dist/schema/errors.d.ts +71 -89
  49. package/dist/schema/errors.js +35 -87
  50. package/dist/schema/events.d.ts +2835 -351
  51. package/dist/schema/events.js +32 -14
  52. package/dist/testing.d.ts +41 -2
  53. package/dist/testing.js +39 -18
  54. package/package.json +5 -5
@@ -91,6 +91,8 @@ export type TextDelta = Schema.Schema.Type<typeof TextDelta>;
91
91
  export declare const TextEnd: Schema.Struct<{
92
92
  readonly type: Schema.tag<"text-end">;
93
93
  readonly id: Schema.String;
94
+ /** Authoritative complete value; replaces accumulated deltas when present. */
95
+ readonly text: Schema.optional<Schema.String>;
94
96
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
95
97
  }>;
96
98
  export type TextEnd = Schema.Schema.Type<typeof TextEnd>;
@@ -110,6 +112,8 @@ export type ReasoningDelta = Schema.Schema.Type<typeof ReasoningDelta>;
110
112
  export declare const ReasoningEnd: Schema.Struct<{
111
113
  readonly type: Schema.tag<"reasoning-end">;
112
114
  readonly id: Schema.String;
115
+ /** Authoritative complete value; replaces accumulated deltas when present. */
116
+ readonly text: Schema.optional<Schema.String>;
113
117
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
114
118
  }>;
115
119
  export type ReasoningEnd = Schema.Schema.Type<typeof ReasoningEnd>;
@@ -259,6 +263,8 @@ declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Stru
259
263
  }>, Schema.Struct<{
260
264
  readonly type: Schema.tag<"text-end">;
261
265
  readonly id: Schema.String;
266
+ /** Authoritative complete value; replaces accumulated deltas when present. */
267
+ readonly text: Schema.optional<Schema.String>;
262
268
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
263
269
  }>, Schema.Struct<{
264
270
  readonly type: Schema.tag<"reasoning-start">;
@@ -272,6 +278,8 @@ declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Stru
272
278
  }>, Schema.Struct<{
273
279
  readonly type: Schema.tag<"reasoning-end">;
274
280
  readonly id: Schema.String;
281
+ /** Authoritative complete value; replaces accumulated deltas when present. */
282
+ readonly text: Schema.optional<Schema.String>;
275
283
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
276
284
  }>, Schema.Struct<{
277
285
  readonly type: Schema.tag<"tool-input-start">;
@@ -409,6 +417,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
409
417
  }>, Schema.Struct<{
410
418
  readonly type: Schema.tag<"text-end">;
411
419
  readonly id: Schema.String;
420
+ /** Authoritative complete value; replaces accumulated deltas when present. */
421
+ readonly text: Schema.optional<Schema.String>;
412
422
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
413
423
  }>, Schema.Struct<{
414
424
  readonly type: Schema.tag<"reasoning-start">;
@@ -422,6 +432,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
422
432
  }>, Schema.Struct<{
423
433
  readonly type: Schema.tag<"reasoning-end">;
424
434
  readonly id: Schema.String;
435
+ /** Authoritative complete value; replaces accumulated deltas when present. */
436
+ readonly text: Schema.optional<Schema.String>;
425
437
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
426
438
  }>, Schema.Struct<{
427
439
  readonly type: Schema.tag<"tool-input-start">;
@@ -549,6 +561,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
549
561
  "text-end": Schema.Struct<{
550
562
  readonly type: Schema.tag<"text-end">;
551
563
  readonly id: Schema.String;
564
+ /** Authoritative complete value; replaces accumulated deltas when present. */
565
+ readonly text: Schema.optional<Schema.String>;
552
566
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
553
567
  }>;
554
568
  "reasoning-start": Schema.Struct<{
@@ -565,6 +579,8 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
565
579
  "reasoning-end": Schema.Struct<{
566
580
  readonly type: Schema.tag<"reasoning-end">;
567
581
  readonly id: Schema.String;
582
+ /** Authoritative complete value; replaces accumulated deltas when present. */
583
+ readonly text: Schema.optional<Schema.String>;
568
584
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
569
585
  }>;
570
586
  "tool-input-start": Schema.Struct<{
@@ -706,6 +722,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
706
722
  } | {
707
723
  readonly id: string;
708
724
  readonly type: "text-end";
725
+ readonly text?: string | undefined;
709
726
  readonly providerMetadata?: {
710
727
  readonly [x: string]: {
711
728
  readonly [x: string]: unknown;
@@ -731,6 +748,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
731
748
  } | {
732
749
  readonly id: string;
733
750
  readonly type: "reasoning-end";
751
+ readonly text?: string | undefined;
734
752
  readonly providerMetadata?: {
735
753
  readonly [x: string]: {
736
754
  readonly [x: string]: unknown;
@@ -894,6 +912,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
894
912
  }> | Extract<{
895
913
  readonly id: string;
896
914
  readonly type: "text-end";
915
+ readonly text?: string | undefined;
897
916
  readonly providerMetadata?: {
898
917
  readonly [x: string]: {
899
918
  readonly [x: string]: unknown;
@@ -925,6 +944,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
925
944
  }> | Extract<{
926
945
  readonly id: string;
927
946
  readonly type: "reasoning-end";
947
+ readonly text?: string | undefined;
928
948
  readonly providerMetadata?: {
929
949
  readonly [x: string]: {
930
950
  readonly [x: string]: unknown;
@@ -1109,6 +1129,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1109
1129
  "text-end": (u: unknown) => u is {
1110
1130
  readonly id: string;
1111
1131
  readonly type: "text-end";
1132
+ readonly text?: string | undefined;
1112
1133
  readonly providerMetadata?: {
1113
1134
  readonly [x: string]: {
1114
1135
  readonly [x: string]: unknown;
@@ -1137,6 +1158,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1137
1158
  "reasoning-end": (u: unknown) => u is {
1138
1159
  readonly id: string;
1139
1160
  readonly type: "reasoning-end";
1161
+ readonly text?: string | undefined;
1140
1162
  readonly providerMetadata?: {
1141
1163
  readonly [x: string]: {
1142
1164
  readonly [x: string]: unknown;
@@ -1311,6 +1333,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1311
1333
  "text-end": (value: {
1312
1334
  readonly id: string;
1313
1335
  readonly type: "text-end";
1336
+ readonly text?: string | undefined;
1314
1337
  readonly providerMetadata?: {
1315
1338
  readonly [x: string]: {
1316
1339
  readonly [x: string]: unknown;
@@ -1339,6 +1362,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1339
1362
  "reasoning-end": (value: {
1340
1363
  readonly id: string;
1341
1364
  readonly type: "reasoning-end";
1365
+ readonly text?: string | undefined;
1342
1366
  readonly providerMetadata?: {
1343
1367
  readonly [x: string]: {
1344
1368
  readonly [x: string]: unknown;
@@ -1507,6 +1531,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1507
1531
  } | {
1508
1532
  readonly id: string;
1509
1533
  readonly type: "text-end";
1534
+ readonly text?: string | undefined;
1510
1535
  readonly providerMetadata?: {
1511
1536
  readonly [x: string]: {
1512
1537
  readonly [x: string]: unknown;
@@ -1532,6 +1557,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1532
1557
  } | {
1533
1558
  readonly id: string;
1534
1559
  readonly type: "reasoning-end";
1560
+ readonly text?: string | undefined;
1535
1561
  readonly providerMetadata?: {
1536
1562
  readonly [x: string]: {
1537
1563
  readonly [x: string]: unknown;
@@ -1694,6 +1720,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1694
1720
  "text-end": (value: {
1695
1721
  readonly id: string;
1696
1722
  readonly type: "text-end";
1723
+ readonly text?: string | undefined;
1697
1724
  readonly providerMetadata?: {
1698
1725
  readonly [x: string]: {
1699
1726
  readonly [x: string]: unknown;
@@ -1722,6 +1749,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1722
1749
  "reasoning-end": (value: {
1723
1750
  readonly id: string;
1724
1751
  readonly type: "reasoning-end";
1752
+ readonly text?: string | undefined;
1725
1753
  readonly providerMetadata?: {
1726
1754
  readonly [x: string]: {
1727
1755
  readonly [x: string]: unknown;
@@ -1890,6 +1918,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1890
1918
  } | {
1891
1919
  readonly id: string;
1892
1920
  readonly type: "text-end";
1921
+ readonly text?: string | undefined;
1893
1922
  readonly providerMetadata?: {
1894
1923
  readonly [x: string]: {
1895
1924
  readonly [x: string]: unknown;
@@ -1915,6 +1944,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
1915
1944
  } | {
1916
1945
  readonly id: string;
1917
1946
  readonly type: "reasoning-end";
1947
+ readonly text?: string | undefined;
1918
1948
  readonly providerMetadata?: {
1919
1949
  readonly [x: string]: {
1920
1950
  readonly [x: string]: unknown;
@@ -2051,6 +2081,1218 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
2051
2081
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2052
2082
  }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
2053
2083
  };
2084
+ readonly matchOrElse: {
2085
+ <Cases extends {
2086
+ "step-start"?: ((value: {
2087
+ readonly type: "step-start";
2088
+ readonly index: number;
2089
+ }) => any) | undefined;
2090
+ "text-start"?: ((value: {
2091
+ readonly id: string;
2092
+ readonly type: "text-start";
2093
+ readonly providerMetadata?: {
2094
+ readonly [x: string]: {
2095
+ readonly [x: string]: unknown;
2096
+ };
2097
+ } | undefined;
2098
+ }) => any) | undefined;
2099
+ "text-delta"?: ((value: {
2100
+ readonly id: string;
2101
+ readonly type: "text-delta";
2102
+ readonly text: string;
2103
+ readonly providerMetadata?: {
2104
+ readonly [x: string]: {
2105
+ readonly [x: string]: unknown;
2106
+ };
2107
+ } | undefined;
2108
+ }) => any) | undefined;
2109
+ "text-end"?: ((value: {
2110
+ readonly id: string;
2111
+ readonly type: "text-end";
2112
+ readonly text?: string | undefined;
2113
+ readonly providerMetadata?: {
2114
+ readonly [x: string]: {
2115
+ readonly [x: string]: unknown;
2116
+ };
2117
+ } | undefined;
2118
+ }) => any) | undefined;
2119
+ "reasoning-start"?: ((value: {
2120
+ readonly id: string;
2121
+ readonly type: "reasoning-start";
2122
+ readonly providerMetadata?: {
2123
+ readonly [x: string]: {
2124
+ readonly [x: string]: unknown;
2125
+ };
2126
+ } | undefined;
2127
+ }) => any) | undefined;
2128
+ "reasoning-delta"?: ((value: {
2129
+ readonly id: string;
2130
+ readonly type: "reasoning-delta";
2131
+ readonly text: string;
2132
+ readonly providerMetadata?: {
2133
+ readonly [x: string]: {
2134
+ readonly [x: string]: unknown;
2135
+ };
2136
+ } | undefined;
2137
+ }) => any) | undefined;
2138
+ "reasoning-end"?: ((value: {
2139
+ readonly id: string;
2140
+ readonly type: "reasoning-end";
2141
+ readonly text?: string | undefined;
2142
+ readonly providerMetadata?: {
2143
+ readonly [x: string]: {
2144
+ readonly [x: string]: unknown;
2145
+ };
2146
+ } | undefined;
2147
+ }) => any) | undefined;
2148
+ "tool-input-start"?: ((value: {
2149
+ readonly id: string;
2150
+ readonly type: "tool-input-start";
2151
+ readonly name: string;
2152
+ readonly providerMetadata?: {
2153
+ readonly [x: string]: {
2154
+ readonly [x: string]: unknown;
2155
+ };
2156
+ } | undefined;
2157
+ readonly providerExecuted?: boolean | undefined;
2158
+ }) => any) | undefined;
2159
+ "tool-input-delta"?: ((value: {
2160
+ readonly id: string;
2161
+ readonly type: "tool-input-delta";
2162
+ readonly name: string;
2163
+ readonly text: string;
2164
+ readonly input?: unknown;
2165
+ }) => any) | undefined;
2166
+ "tool-input-end"?: ((value: {
2167
+ readonly id: string;
2168
+ readonly type: "tool-input-end";
2169
+ readonly name: string;
2170
+ readonly providerMetadata?: {
2171
+ readonly [x: string]: {
2172
+ readonly [x: string]: unknown;
2173
+ };
2174
+ } | undefined;
2175
+ }) => any) | undefined;
2176
+ "tool-input-error"?: ((value: {
2177
+ readonly type: "tool-input-error";
2178
+ readonly id: string;
2179
+ readonly name: string;
2180
+ readonly raw: string;
2181
+ }) => any) | undefined;
2182
+ "tool-call"?: ((value: {
2183
+ readonly id: string;
2184
+ readonly type: "tool-call";
2185
+ readonly name: string;
2186
+ readonly input: unknown;
2187
+ readonly providerMetadata?: {
2188
+ readonly [x: string]: {
2189
+ readonly [x: string]: unknown;
2190
+ };
2191
+ } | undefined;
2192
+ readonly providerExecuted?: boolean | undefined;
2193
+ }) => any) | undefined;
2194
+ "tool-result"?: ((value: {
2195
+ readonly id: string;
2196
+ readonly type: "tool-result";
2197
+ readonly name: string;
2198
+ readonly result: {
2199
+ readonly type: "json";
2200
+ readonly value: unknown;
2201
+ } | {
2202
+ readonly type: "text";
2203
+ readonly value: unknown;
2204
+ } | {
2205
+ readonly type: "error";
2206
+ readonly value: unknown;
2207
+ } | {
2208
+ readonly type: "content";
2209
+ readonly value: readonly ({
2210
+ readonly type: "text";
2211
+ readonly text: string;
2212
+ } | {
2213
+ readonly type: "file";
2214
+ readonly uri: string;
2215
+ readonly mime: string;
2216
+ readonly name?: string | undefined;
2217
+ })[];
2218
+ };
2219
+ readonly output?: {
2220
+ readonly structured: unknown;
2221
+ readonly content: readonly ({
2222
+ readonly type: "text";
2223
+ readonly text: string;
2224
+ } | {
2225
+ readonly type: "file";
2226
+ readonly uri: string;
2227
+ readonly mime: string;
2228
+ readonly name?: string | undefined;
2229
+ })[];
2230
+ } | undefined;
2231
+ readonly providerMetadata?: {
2232
+ readonly [x: string]: {
2233
+ readonly [x: string]: unknown;
2234
+ };
2235
+ } | undefined;
2236
+ readonly providerExecuted?: boolean | undefined;
2237
+ }) => any) | undefined;
2238
+ "tool-error"?: ((value: {
2239
+ readonly id: string;
2240
+ readonly type: "tool-error";
2241
+ readonly name: string;
2242
+ readonly message: string;
2243
+ readonly error?: unknown;
2244
+ readonly providerMetadata?: {
2245
+ readonly [x: string]: {
2246
+ readonly [x: string]: unknown;
2247
+ };
2248
+ } | undefined;
2249
+ }) => any) | undefined;
2250
+ "step-finish"?: ((value: {
2251
+ readonly type: "step-finish";
2252
+ readonly reason: {
2253
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2254
+ readonly raw?: string | undefined;
2255
+ };
2256
+ readonly index: number;
2257
+ readonly providerMetadata?: {
2258
+ readonly [x: string]: {
2259
+ readonly [x: string]: unknown;
2260
+ };
2261
+ } | undefined;
2262
+ readonly usage?: Usage | undefined;
2263
+ }) => any) | undefined;
2264
+ finish?: ((value: {
2265
+ readonly type: "finish";
2266
+ readonly reason: {
2267
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2268
+ readonly raw?: string | undefined;
2269
+ };
2270
+ readonly providerMetadata?: {
2271
+ readonly [x: string]: {
2272
+ readonly [x: string]: unknown;
2273
+ };
2274
+ } | undefined;
2275
+ readonly usage?: Usage | undefined;
2276
+ }) => any) | undefined;
2277
+ "provider-error"?: ((value: {
2278
+ readonly type: "provider-error";
2279
+ readonly message: string;
2280
+ readonly providerMetadata?: {
2281
+ readonly [x: string]: {
2282
+ readonly [x: string]: unknown;
2283
+ };
2284
+ } | undefined;
2285
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2286
+ }) => any) | undefined;
2287
+ } & { [K in Exclude<keyof Cases, "finish" | "tool-call" | "tool-result" | "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-error" | "step-finish" | "provider-error">]: never; }, OrElse extends (value: Exclude<{
2288
+ readonly type: "step-start";
2289
+ readonly index: number;
2290
+ }, {
2291
+ readonly type: keyof Cases;
2292
+ }> | Exclude<{
2293
+ readonly id: string;
2294
+ readonly type: "text-start";
2295
+ readonly providerMetadata?: {
2296
+ readonly [x: string]: {
2297
+ readonly [x: string]: unknown;
2298
+ };
2299
+ } | undefined;
2300
+ }, {
2301
+ readonly type: keyof Cases;
2302
+ }> | Exclude<{
2303
+ readonly id: string;
2304
+ readonly type: "text-delta";
2305
+ readonly text: string;
2306
+ readonly providerMetadata?: {
2307
+ readonly [x: string]: {
2308
+ readonly [x: string]: unknown;
2309
+ };
2310
+ } | undefined;
2311
+ }, {
2312
+ readonly type: keyof Cases;
2313
+ }> | Exclude<{
2314
+ readonly id: string;
2315
+ readonly type: "text-end";
2316
+ readonly text?: string | undefined;
2317
+ readonly providerMetadata?: {
2318
+ readonly [x: string]: {
2319
+ readonly [x: string]: unknown;
2320
+ };
2321
+ } | undefined;
2322
+ }, {
2323
+ readonly type: keyof Cases;
2324
+ }> | Exclude<{
2325
+ readonly id: string;
2326
+ readonly type: "reasoning-start";
2327
+ readonly providerMetadata?: {
2328
+ readonly [x: string]: {
2329
+ readonly [x: string]: unknown;
2330
+ };
2331
+ } | undefined;
2332
+ }, {
2333
+ readonly type: keyof Cases;
2334
+ }> | Exclude<{
2335
+ readonly id: string;
2336
+ readonly type: "reasoning-delta";
2337
+ readonly text: string;
2338
+ readonly providerMetadata?: {
2339
+ readonly [x: string]: {
2340
+ readonly [x: string]: unknown;
2341
+ };
2342
+ } | undefined;
2343
+ }, {
2344
+ readonly type: keyof Cases;
2345
+ }> | Exclude<{
2346
+ readonly id: string;
2347
+ readonly type: "reasoning-end";
2348
+ readonly text?: string | undefined;
2349
+ readonly providerMetadata?: {
2350
+ readonly [x: string]: {
2351
+ readonly [x: string]: unknown;
2352
+ };
2353
+ } | undefined;
2354
+ }, {
2355
+ readonly type: keyof Cases;
2356
+ }> | Exclude<{
2357
+ readonly id: string;
2358
+ readonly type: "tool-input-start";
2359
+ readonly name: string;
2360
+ readonly providerMetadata?: {
2361
+ readonly [x: string]: {
2362
+ readonly [x: string]: unknown;
2363
+ };
2364
+ } | undefined;
2365
+ readonly providerExecuted?: boolean | undefined;
2366
+ }, {
2367
+ readonly type: keyof Cases;
2368
+ }> | Exclude<{
2369
+ readonly id: string;
2370
+ readonly type: "tool-input-delta";
2371
+ readonly name: string;
2372
+ readonly text: string;
2373
+ readonly input?: unknown;
2374
+ }, {
2375
+ readonly type: keyof Cases;
2376
+ }> | Exclude<{
2377
+ readonly id: string;
2378
+ readonly type: "tool-input-end";
2379
+ readonly name: string;
2380
+ readonly providerMetadata?: {
2381
+ readonly [x: string]: {
2382
+ readonly [x: string]: unknown;
2383
+ };
2384
+ } | undefined;
2385
+ }, {
2386
+ readonly type: keyof Cases;
2387
+ }> | Exclude<{
2388
+ readonly type: "tool-input-error";
2389
+ readonly id: string;
2390
+ readonly name: string;
2391
+ readonly raw: string;
2392
+ }, {
2393
+ readonly type: keyof Cases;
2394
+ }> | Exclude<{
2395
+ readonly id: string;
2396
+ readonly type: "tool-call";
2397
+ readonly name: string;
2398
+ readonly input: unknown;
2399
+ readonly providerMetadata?: {
2400
+ readonly [x: string]: {
2401
+ readonly [x: string]: unknown;
2402
+ };
2403
+ } | undefined;
2404
+ readonly providerExecuted?: boolean | undefined;
2405
+ }, {
2406
+ readonly type: keyof Cases;
2407
+ }> | Exclude<{
2408
+ readonly id: string;
2409
+ readonly type: "tool-result";
2410
+ readonly name: string;
2411
+ readonly result: {
2412
+ readonly type: "json";
2413
+ readonly value: unknown;
2414
+ } | {
2415
+ readonly type: "text";
2416
+ readonly value: unknown;
2417
+ } | {
2418
+ readonly type: "error";
2419
+ readonly value: unknown;
2420
+ } | {
2421
+ readonly type: "content";
2422
+ readonly value: readonly ({
2423
+ readonly type: "text";
2424
+ readonly text: string;
2425
+ } | {
2426
+ readonly type: "file";
2427
+ readonly uri: string;
2428
+ readonly mime: string;
2429
+ readonly name?: string | undefined;
2430
+ })[];
2431
+ };
2432
+ readonly output?: {
2433
+ readonly structured: unknown;
2434
+ readonly content: readonly ({
2435
+ readonly type: "text";
2436
+ readonly text: string;
2437
+ } | {
2438
+ readonly type: "file";
2439
+ readonly uri: string;
2440
+ readonly mime: string;
2441
+ readonly name?: string | undefined;
2442
+ })[];
2443
+ } | undefined;
2444
+ readonly providerMetadata?: {
2445
+ readonly [x: string]: {
2446
+ readonly [x: string]: unknown;
2447
+ };
2448
+ } | undefined;
2449
+ readonly providerExecuted?: boolean | undefined;
2450
+ }, {
2451
+ readonly type: keyof Cases;
2452
+ }> | Exclude<{
2453
+ readonly id: string;
2454
+ readonly type: "tool-error";
2455
+ readonly name: string;
2456
+ readonly message: string;
2457
+ readonly error?: unknown;
2458
+ readonly providerMetadata?: {
2459
+ readonly [x: string]: {
2460
+ readonly [x: string]: unknown;
2461
+ };
2462
+ } | undefined;
2463
+ }, {
2464
+ readonly type: keyof Cases;
2465
+ }> | Exclude<{
2466
+ readonly type: "step-finish";
2467
+ readonly reason: {
2468
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2469
+ readonly raw?: string | undefined;
2470
+ };
2471
+ readonly index: number;
2472
+ readonly providerMetadata?: {
2473
+ readonly [x: string]: {
2474
+ readonly [x: string]: unknown;
2475
+ };
2476
+ } | undefined;
2477
+ readonly usage?: Usage | undefined;
2478
+ }, {
2479
+ readonly type: keyof Cases;
2480
+ }> | Exclude<{
2481
+ readonly type: "finish";
2482
+ readonly reason: {
2483
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2484
+ readonly raw?: string | undefined;
2485
+ };
2486
+ readonly providerMetadata?: {
2487
+ readonly [x: string]: {
2488
+ readonly [x: string]: unknown;
2489
+ };
2490
+ } | undefined;
2491
+ readonly usage?: Usage | undefined;
2492
+ }, {
2493
+ readonly type: keyof Cases;
2494
+ }> | Exclude<{
2495
+ readonly type: "provider-error";
2496
+ readonly message: string;
2497
+ readonly providerMetadata?: {
2498
+ readonly [x: string]: {
2499
+ readonly [x: string]: unknown;
2500
+ };
2501
+ } | undefined;
2502
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2503
+ }, {
2504
+ readonly type: keyof Cases;
2505
+ }>) => any>(value: {
2506
+ readonly type: "step-start";
2507
+ readonly index: number;
2508
+ } | {
2509
+ readonly id: string;
2510
+ readonly type: "text-start";
2511
+ readonly providerMetadata?: {
2512
+ readonly [x: string]: {
2513
+ readonly [x: string]: unknown;
2514
+ };
2515
+ } | undefined;
2516
+ } | {
2517
+ readonly id: string;
2518
+ readonly type: "text-delta";
2519
+ readonly text: string;
2520
+ readonly providerMetadata?: {
2521
+ readonly [x: string]: {
2522
+ readonly [x: string]: unknown;
2523
+ };
2524
+ } | undefined;
2525
+ } | {
2526
+ readonly id: string;
2527
+ readonly type: "text-end";
2528
+ readonly text?: string | undefined;
2529
+ readonly providerMetadata?: {
2530
+ readonly [x: string]: {
2531
+ readonly [x: string]: unknown;
2532
+ };
2533
+ } | undefined;
2534
+ } | {
2535
+ readonly id: string;
2536
+ readonly type: "reasoning-start";
2537
+ readonly providerMetadata?: {
2538
+ readonly [x: string]: {
2539
+ readonly [x: string]: unknown;
2540
+ };
2541
+ } | undefined;
2542
+ } | {
2543
+ readonly id: string;
2544
+ readonly type: "reasoning-delta";
2545
+ readonly text: string;
2546
+ readonly providerMetadata?: {
2547
+ readonly [x: string]: {
2548
+ readonly [x: string]: unknown;
2549
+ };
2550
+ } | undefined;
2551
+ } | {
2552
+ readonly id: string;
2553
+ readonly type: "reasoning-end";
2554
+ readonly text?: string | undefined;
2555
+ readonly providerMetadata?: {
2556
+ readonly [x: string]: {
2557
+ readonly [x: string]: unknown;
2558
+ };
2559
+ } | undefined;
2560
+ } | {
2561
+ readonly id: string;
2562
+ readonly type: "tool-input-start";
2563
+ readonly name: string;
2564
+ readonly providerMetadata?: {
2565
+ readonly [x: string]: {
2566
+ readonly [x: string]: unknown;
2567
+ };
2568
+ } | undefined;
2569
+ readonly providerExecuted?: boolean | undefined;
2570
+ } | {
2571
+ readonly id: string;
2572
+ readonly type: "tool-input-delta";
2573
+ readonly name: string;
2574
+ readonly text: string;
2575
+ readonly input?: unknown;
2576
+ } | {
2577
+ readonly id: string;
2578
+ readonly type: "tool-input-end";
2579
+ readonly name: string;
2580
+ readonly providerMetadata?: {
2581
+ readonly [x: string]: {
2582
+ readonly [x: string]: unknown;
2583
+ };
2584
+ } | undefined;
2585
+ } | {
2586
+ readonly type: "tool-input-error";
2587
+ readonly id: string;
2588
+ readonly name: string;
2589
+ readonly raw: string;
2590
+ } | {
2591
+ readonly id: string;
2592
+ readonly type: "tool-call";
2593
+ readonly name: string;
2594
+ readonly input: unknown;
2595
+ readonly providerMetadata?: {
2596
+ readonly [x: string]: {
2597
+ readonly [x: string]: unknown;
2598
+ };
2599
+ } | undefined;
2600
+ readonly providerExecuted?: boolean | undefined;
2601
+ } | {
2602
+ readonly id: string;
2603
+ readonly type: "tool-result";
2604
+ readonly name: string;
2605
+ readonly result: {
2606
+ readonly type: "json";
2607
+ readonly value: unknown;
2608
+ } | {
2609
+ readonly type: "text";
2610
+ readonly value: unknown;
2611
+ } | {
2612
+ readonly type: "error";
2613
+ readonly value: unknown;
2614
+ } | {
2615
+ readonly type: "content";
2616
+ readonly value: readonly ({
2617
+ readonly type: "text";
2618
+ readonly text: string;
2619
+ } | {
2620
+ readonly type: "file";
2621
+ readonly uri: string;
2622
+ readonly mime: string;
2623
+ readonly name?: string | undefined;
2624
+ })[];
2625
+ };
2626
+ readonly output?: {
2627
+ readonly structured: unknown;
2628
+ readonly content: readonly ({
2629
+ readonly type: "text";
2630
+ readonly text: string;
2631
+ } | {
2632
+ readonly type: "file";
2633
+ readonly uri: string;
2634
+ readonly mime: string;
2635
+ readonly name?: string | undefined;
2636
+ })[];
2637
+ } | undefined;
2638
+ readonly providerMetadata?: {
2639
+ readonly [x: string]: {
2640
+ readonly [x: string]: unknown;
2641
+ };
2642
+ } | undefined;
2643
+ readonly providerExecuted?: boolean | undefined;
2644
+ } | {
2645
+ readonly id: string;
2646
+ readonly type: "tool-error";
2647
+ readonly name: string;
2648
+ readonly message: string;
2649
+ readonly error?: unknown;
2650
+ readonly providerMetadata?: {
2651
+ readonly [x: string]: {
2652
+ readonly [x: string]: unknown;
2653
+ };
2654
+ } | undefined;
2655
+ } | {
2656
+ readonly type: "step-finish";
2657
+ readonly reason: {
2658
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2659
+ readonly raw?: string | undefined;
2660
+ };
2661
+ readonly index: number;
2662
+ readonly providerMetadata?: {
2663
+ readonly [x: string]: {
2664
+ readonly [x: string]: unknown;
2665
+ };
2666
+ } | undefined;
2667
+ readonly usage?: Usage | undefined;
2668
+ } | {
2669
+ readonly type: "finish";
2670
+ readonly reason: {
2671
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2672
+ readonly raw?: string | undefined;
2673
+ };
2674
+ readonly providerMetadata?: {
2675
+ readonly [x: string]: {
2676
+ readonly [x: string]: unknown;
2677
+ };
2678
+ } | undefined;
2679
+ readonly usage?: Usage | undefined;
2680
+ } | {
2681
+ readonly type: "provider-error";
2682
+ readonly message: string;
2683
+ readonly providerMetadata?: {
2684
+ readonly [x: string]: {
2685
+ readonly [x: string]: unknown;
2686
+ };
2687
+ } | undefined;
2688
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2689
+ }, cases: Cases, orElse: OrElse): import("effect/Unify").Unify<{ [K_1 in keyof Cases]-?: NonNullable<Cases[K_1]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
2690
+ <Cases extends {
2691
+ "step-start"?: ((value: {
2692
+ readonly type: "step-start";
2693
+ readonly index: number;
2694
+ }) => any) | undefined;
2695
+ "text-start"?: ((value: {
2696
+ readonly id: string;
2697
+ readonly type: "text-start";
2698
+ readonly providerMetadata?: {
2699
+ readonly [x: string]: {
2700
+ readonly [x: string]: unknown;
2701
+ };
2702
+ } | undefined;
2703
+ }) => any) | undefined;
2704
+ "text-delta"?: ((value: {
2705
+ readonly id: string;
2706
+ readonly type: "text-delta";
2707
+ readonly text: string;
2708
+ readonly providerMetadata?: {
2709
+ readonly [x: string]: {
2710
+ readonly [x: string]: unknown;
2711
+ };
2712
+ } | undefined;
2713
+ }) => any) | undefined;
2714
+ "text-end"?: ((value: {
2715
+ readonly id: string;
2716
+ readonly type: "text-end";
2717
+ readonly text?: string | undefined;
2718
+ readonly providerMetadata?: {
2719
+ readonly [x: string]: {
2720
+ readonly [x: string]: unknown;
2721
+ };
2722
+ } | undefined;
2723
+ }) => any) | undefined;
2724
+ "reasoning-start"?: ((value: {
2725
+ readonly id: string;
2726
+ readonly type: "reasoning-start";
2727
+ readonly providerMetadata?: {
2728
+ readonly [x: string]: {
2729
+ readonly [x: string]: unknown;
2730
+ };
2731
+ } | undefined;
2732
+ }) => any) | undefined;
2733
+ "reasoning-delta"?: ((value: {
2734
+ readonly id: string;
2735
+ readonly type: "reasoning-delta";
2736
+ readonly text: string;
2737
+ readonly providerMetadata?: {
2738
+ readonly [x: string]: {
2739
+ readonly [x: string]: unknown;
2740
+ };
2741
+ } | undefined;
2742
+ }) => any) | undefined;
2743
+ "reasoning-end"?: ((value: {
2744
+ readonly id: string;
2745
+ readonly type: "reasoning-end";
2746
+ readonly text?: string | undefined;
2747
+ readonly providerMetadata?: {
2748
+ readonly [x: string]: {
2749
+ readonly [x: string]: unknown;
2750
+ };
2751
+ } | undefined;
2752
+ }) => any) | undefined;
2753
+ "tool-input-start"?: ((value: {
2754
+ readonly id: string;
2755
+ readonly type: "tool-input-start";
2756
+ readonly name: string;
2757
+ readonly providerMetadata?: {
2758
+ readonly [x: string]: {
2759
+ readonly [x: string]: unknown;
2760
+ };
2761
+ } | undefined;
2762
+ readonly providerExecuted?: boolean | undefined;
2763
+ }) => any) | undefined;
2764
+ "tool-input-delta"?: ((value: {
2765
+ readonly id: string;
2766
+ readonly type: "tool-input-delta";
2767
+ readonly name: string;
2768
+ readonly text: string;
2769
+ readonly input?: unknown;
2770
+ }) => any) | undefined;
2771
+ "tool-input-end"?: ((value: {
2772
+ readonly id: string;
2773
+ readonly type: "tool-input-end";
2774
+ readonly name: string;
2775
+ readonly providerMetadata?: {
2776
+ readonly [x: string]: {
2777
+ readonly [x: string]: unknown;
2778
+ };
2779
+ } | undefined;
2780
+ }) => any) | undefined;
2781
+ "tool-input-error"?: ((value: {
2782
+ readonly type: "tool-input-error";
2783
+ readonly id: string;
2784
+ readonly name: string;
2785
+ readonly raw: string;
2786
+ }) => any) | undefined;
2787
+ "tool-call"?: ((value: {
2788
+ readonly id: string;
2789
+ readonly type: "tool-call";
2790
+ readonly name: string;
2791
+ readonly input: unknown;
2792
+ readonly providerMetadata?: {
2793
+ readonly [x: string]: {
2794
+ readonly [x: string]: unknown;
2795
+ };
2796
+ } | undefined;
2797
+ readonly providerExecuted?: boolean | undefined;
2798
+ }) => any) | undefined;
2799
+ "tool-result"?: ((value: {
2800
+ readonly id: string;
2801
+ readonly type: "tool-result";
2802
+ readonly name: string;
2803
+ readonly result: {
2804
+ readonly type: "json";
2805
+ readonly value: unknown;
2806
+ } | {
2807
+ readonly type: "text";
2808
+ readonly value: unknown;
2809
+ } | {
2810
+ readonly type: "error";
2811
+ readonly value: unknown;
2812
+ } | {
2813
+ readonly type: "content";
2814
+ readonly value: readonly ({
2815
+ readonly type: "text";
2816
+ readonly text: string;
2817
+ } | {
2818
+ readonly type: "file";
2819
+ readonly uri: string;
2820
+ readonly mime: string;
2821
+ readonly name?: string | undefined;
2822
+ })[];
2823
+ };
2824
+ readonly output?: {
2825
+ readonly structured: unknown;
2826
+ readonly content: readonly ({
2827
+ readonly type: "text";
2828
+ readonly text: string;
2829
+ } | {
2830
+ readonly type: "file";
2831
+ readonly uri: string;
2832
+ readonly mime: string;
2833
+ readonly name?: string | undefined;
2834
+ })[];
2835
+ } | undefined;
2836
+ readonly providerMetadata?: {
2837
+ readonly [x: string]: {
2838
+ readonly [x: string]: unknown;
2839
+ };
2840
+ } | undefined;
2841
+ readonly providerExecuted?: boolean | undefined;
2842
+ }) => any) | undefined;
2843
+ "tool-error"?: ((value: {
2844
+ readonly id: string;
2845
+ readonly type: "tool-error";
2846
+ readonly name: string;
2847
+ readonly message: string;
2848
+ readonly error?: unknown;
2849
+ readonly providerMetadata?: {
2850
+ readonly [x: string]: {
2851
+ readonly [x: string]: unknown;
2852
+ };
2853
+ } | undefined;
2854
+ }) => any) | undefined;
2855
+ "step-finish"?: ((value: {
2856
+ readonly type: "step-finish";
2857
+ readonly reason: {
2858
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2859
+ readonly raw?: string | undefined;
2860
+ };
2861
+ readonly index: number;
2862
+ readonly providerMetadata?: {
2863
+ readonly [x: string]: {
2864
+ readonly [x: string]: unknown;
2865
+ };
2866
+ } | undefined;
2867
+ readonly usage?: Usage | undefined;
2868
+ }) => any) | undefined;
2869
+ finish?: ((value: {
2870
+ readonly type: "finish";
2871
+ readonly reason: {
2872
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2873
+ readonly raw?: string | undefined;
2874
+ };
2875
+ readonly providerMetadata?: {
2876
+ readonly [x: string]: {
2877
+ readonly [x: string]: unknown;
2878
+ };
2879
+ } | undefined;
2880
+ readonly usage?: Usage | undefined;
2881
+ }) => any) | undefined;
2882
+ "provider-error"?: ((value: {
2883
+ readonly type: "provider-error";
2884
+ readonly message: string;
2885
+ readonly providerMetadata?: {
2886
+ readonly [x: string]: {
2887
+ readonly [x: string]: unknown;
2888
+ };
2889
+ } | undefined;
2890
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2891
+ }) => any) | undefined;
2892
+ } & { [K in Exclude<keyof Cases, "finish" | "tool-call" | "tool-result" | "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-error" | "step-finish" | "provider-error">]: never; }, OrElse extends (value: Exclude<{
2893
+ readonly type: "step-start";
2894
+ readonly index: number;
2895
+ }, {
2896
+ readonly type: keyof Cases;
2897
+ }> | Exclude<{
2898
+ readonly id: string;
2899
+ readonly type: "text-start";
2900
+ readonly providerMetadata?: {
2901
+ readonly [x: string]: {
2902
+ readonly [x: string]: unknown;
2903
+ };
2904
+ } | undefined;
2905
+ }, {
2906
+ readonly type: keyof Cases;
2907
+ }> | Exclude<{
2908
+ readonly id: string;
2909
+ readonly type: "text-delta";
2910
+ readonly text: string;
2911
+ readonly providerMetadata?: {
2912
+ readonly [x: string]: {
2913
+ readonly [x: string]: unknown;
2914
+ };
2915
+ } | undefined;
2916
+ }, {
2917
+ readonly type: keyof Cases;
2918
+ }> | Exclude<{
2919
+ readonly id: string;
2920
+ readonly type: "text-end";
2921
+ readonly text?: string | undefined;
2922
+ readonly providerMetadata?: {
2923
+ readonly [x: string]: {
2924
+ readonly [x: string]: unknown;
2925
+ };
2926
+ } | undefined;
2927
+ }, {
2928
+ readonly type: keyof Cases;
2929
+ }> | Exclude<{
2930
+ readonly id: string;
2931
+ readonly type: "reasoning-start";
2932
+ readonly providerMetadata?: {
2933
+ readonly [x: string]: {
2934
+ readonly [x: string]: unknown;
2935
+ };
2936
+ } | undefined;
2937
+ }, {
2938
+ readonly type: keyof Cases;
2939
+ }> | Exclude<{
2940
+ readonly id: string;
2941
+ readonly type: "reasoning-delta";
2942
+ readonly text: string;
2943
+ readonly providerMetadata?: {
2944
+ readonly [x: string]: {
2945
+ readonly [x: string]: unknown;
2946
+ };
2947
+ } | undefined;
2948
+ }, {
2949
+ readonly type: keyof Cases;
2950
+ }> | Exclude<{
2951
+ readonly id: string;
2952
+ readonly type: "reasoning-end";
2953
+ readonly text?: string | undefined;
2954
+ readonly providerMetadata?: {
2955
+ readonly [x: string]: {
2956
+ readonly [x: string]: unknown;
2957
+ };
2958
+ } | undefined;
2959
+ }, {
2960
+ readonly type: keyof Cases;
2961
+ }> | Exclude<{
2962
+ readonly id: string;
2963
+ readonly type: "tool-input-start";
2964
+ readonly name: string;
2965
+ readonly providerMetadata?: {
2966
+ readonly [x: string]: {
2967
+ readonly [x: string]: unknown;
2968
+ };
2969
+ } | undefined;
2970
+ readonly providerExecuted?: boolean | undefined;
2971
+ }, {
2972
+ readonly type: keyof Cases;
2973
+ }> | Exclude<{
2974
+ readonly id: string;
2975
+ readonly type: "tool-input-delta";
2976
+ readonly name: string;
2977
+ readonly text: string;
2978
+ readonly input?: unknown;
2979
+ }, {
2980
+ readonly type: keyof Cases;
2981
+ }> | Exclude<{
2982
+ readonly id: string;
2983
+ readonly type: "tool-input-end";
2984
+ readonly name: string;
2985
+ readonly providerMetadata?: {
2986
+ readonly [x: string]: {
2987
+ readonly [x: string]: unknown;
2988
+ };
2989
+ } | undefined;
2990
+ }, {
2991
+ readonly type: keyof Cases;
2992
+ }> | Exclude<{
2993
+ readonly type: "tool-input-error";
2994
+ readonly id: string;
2995
+ readonly name: string;
2996
+ readonly raw: string;
2997
+ }, {
2998
+ readonly type: keyof Cases;
2999
+ }> | Exclude<{
3000
+ readonly id: string;
3001
+ readonly type: "tool-call";
3002
+ readonly name: string;
3003
+ readonly input: unknown;
3004
+ readonly providerMetadata?: {
3005
+ readonly [x: string]: {
3006
+ readonly [x: string]: unknown;
3007
+ };
3008
+ } | undefined;
3009
+ readonly providerExecuted?: boolean | undefined;
3010
+ }, {
3011
+ readonly type: keyof Cases;
3012
+ }> | Exclude<{
3013
+ readonly id: string;
3014
+ readonly type: "tool-result";
3015
+ readonly name: string;
3016
+ readonly result: {
3017
+ readonly type: "json";
3018
+ readonly value: unknown;
3019
+ } | {
3020
+ readonly type: "text";
3021
+ readonly value: unknown;
3022
+ } | {
3023
+ readonly type: "error";
3024
+ readonly value: unknown;
3025
+ } | {
3026
+ readonly type: "content";
3027
+ readonly value: readonly ({
3028
+ readonly type: "text";
3029
+ readonly text: string;
3030
+ } | {
3031
+ readonly type: "file";
3032
+ readonly uri: string;
3033
+ readonly mime: string;
3034
+ readonly name?: string | undefined;
3035
+ })[];
3036
+ };
3037
+ readonly output?: {
3038
+ readonly structured: unknown;
3039
+ readonly content: readonly ({
3040
+ readonly type: "text";
3041
+ readonly text: string;
3042
+ } | {
3043
+ readonly type: "file";
3044
+ readonly uri: string;
3045
+ readonly mime: string;
3046
+ readonly name?: string | undefined;
3047
+ })[];
3048
+ } | undefined;
3049
+ readonly providerMetadata?: {
3050
+ readonly [x: string]: {
3051
+ readonly [x: string]: unknown;
3052
+ };
3053
+ } | undefined;
3054
+ readonly providerExecuted?: boolean | undefined;
3055
+ }, {
3056
+ readonly type: keyof Cases;
3057
+ }> | Exclude<{
3058
+ readonly id: string;
3059
+ readonly type: "tool-error";
3060
+ readonly name: string;
3061
+ readonly message: string;
3062
+ readonly error?: unknown;
3063
+ readonly providerMetadata?: {
3064
+ readonly [x: string]: {
3065
+ readonly [x: string]: unknown;
3066
+ };
3067
+ } | undefined;
3068
+ }, {
3069
+ readonly type: keyof Cases;
3070
+ }> | Exclude<{
3071
+ readonly type: "step-finish";
3072
+ readonly reason: {
3073
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3074
+ readonly raw?: string | undefined;
3075
+ };
3076
+ readonly index: number;
3077
+ readonly providerMetadata?: {
3078
+ readonly [x: string]: {
3079
+ readonly [x: string]: unknown;
3080
+ };
3081
+ } | undefined;
3082
+ readonly usage?: Usage | undefined;
3083
+ }, {
3084
+ readonly type: keyof Cases;
3085
+ }> | Exclude<{
3086
+ readonly type: "finish";
3087
+ readonly reason: {
3088
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3089
+ readonly raw?: string | undefined;
3090
+ };
3091
+ readonly providerMetadata?: {
3092
+ readonly [x: string]: {
3093
+ readonly [x: string]: unknown;
3094
+ };
3095
+ } | undefined;
3096
+ readonly usage?: Usage | undefined;
3097
+ }, {
3098
+ readonly type: keyof Cases;
3099
+ }> | Exclude<{
3100
+ readonly type: "provider-error";
3101
+ readonly message: string;
3102
+ readonly providerMetadata?: {
3103
+ readonly [x: string]: {
3104
+ readonly [x: string]: unknown;
3105
+ };
3106
+ } | undefined;
3107
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3108
+ }, {
3109
+ readonly type: keyof Cases;
3110
+ }>) => any>(cases: Cases, orElse: OrElse): (value: {
3111
+ readonly type: "step-start";
3112
+ readonly index: number;
3113
+ } | {
3114
+ readonly id: string;
3115
+ readonly type: "text-start";
3116
+ readonly providerMetadata?: {
3117
+ readonly [x: string]: {
3118
+ readonly [x: string]: unknown;
3119
+ };
3120
+ } | undefined;
3121
+ } | {
3122
+ readonly id: string;
3123
+ readonly type: "text-delta";
3124
+ readonly text: string;
3125
+ readonly providerMetadata?: {
3126
+ readonly [x: string]: {
3127
+ readonly [x: string]: unknown;
3128
+ };
3129
+ } | undefined;
3130
+ } | {
3131
+ readonly id: string;
3132
+ readonly type: "text-end";
3133
+ readonly text?: string | undefined;
3134
+ readonly providerMetadata?: {
3135
+ readonly [x: string]: {
3136
+ readonly [x: string]: unknown;
3137
+ };
3138
+ } | undefined;
3139
+ } | {
3140
+ readonly id: string;
3141
+ readonly type: "reasoning-start";
3142
+ readonly providerMetadata?: {
3143
+ readonly [x: string]: {
3144
+ readonly [x: string]: unknown;
3145
+ };
3146
+ } | undefined;
3147
+ } | {
3148
+ readonly id: string;
3149
+ readonly type: "reasoning-delta";
3150
+ readonly text: string;
3151
+ readonly providerMetadata?: {
3152
+ readonly [x: string]: {
3153
+ readonly [x: string]: unknown;
3154
+ };
3155
+ } | undefined;
3156
+ } | {
3157
+ readonly id: string;
3158
+ readonly type: "reasoning-end";
3159
+ readonly text?: string | undefined;
3160
+ readonly providerMetadata?: {
3161
+ readonly [x: string]: {
3162
+ readonly [x: string]: unknown;
3163
+ };
3164
+ } | undefined;
3165
+ } | {
3166
+ readonly id: string;
3167
+ readonly type: "tool-input-start";
3168
+ readonly name: string;
3169
+ readonly providerMetadata?: {
3170
+ readonly [x: string]: {
3171
+ readonly [x: string]: unknown;
3172
+ };
3173
+ } | undefined;
3174
+ readonly providerExecuted?: boolean | undefined;
3175
+ } | {
3176
+ readonly id: string;
3177
+ readonly type: "tool-input-delta";
3178
+ readonly name: string;
3179
+ readonly text: string;
3180
+ readonly input?: unknown;
3181
+ } | {
3182
+ readonly id: string;
3183
+ readonly type: "tool-input-end";
3184
+ readonly name: string;
3185
+ readonly providerMetadata?: {
3186
+ readonly [x: string]: {
3187
+ readonly [x: string]: unknown;
3188
+ };
3189
+ } | undefined;
3190
+ } | {
3191
+ readonly type: "tool-input-error";
3192
+ readonly id: string;
3193
+ readonly name: string;
3194
+ readonly raw: string;
3195
+ } | {
3196
+ readonly id: string;
3197
+ readonly type: "tool-call";
3198
+ readonly name: string;
3199
+ readonly input: unknown;
3200
+ readonly providerMetadata?: {
3201
+ readonly [x: string]: {
3202
+ readonly [x: string]: unknown;
3203
+ };
3204
+ } | undefined;
3205
+ readonly providerExecuted?: boolean | undefined;
3206
+ } | {
3207
+ readonly id: string;
3208
+ readonly type: "tool-result";
3209
+ readonly name: string;
3210
+ readonly result: {
3211
+ readonly type: "json";
3212
+ readonly value: unknown;
3213
+ } | {
3214
+ readonly type: "text";
3215
+ readonly value: unknown;
3216
+ } | {
3217
+ readonly type: "error";
3218
+ readonly value: unknown;
3219
+ } | {
3220
+ readonly type: "content";
3221
+ readonly value: readonly ({
3222
+ readonly type: "text";
3223
+ readonly text: string;
3224
+ } | {
3225
+ readonly type: "file";
3226
+ readonly uri: string;
3227
+ readonly mime: string;
3228
+ readonly name?: string | undefined;
3229
+ })[];
3230
+ };
3231
+ readonly output?: {
3232
+ readonly structured: unknown;
3233
+ readonly content: readonly ({
3234
+ readonly type: "text";
3235
+ readonly text: string;
3236
+ } | {
3237
+ readonly type: "file";
3238
+ readonly uri: string;
3239
+ readonly mime: string;
3240
+ readonly name?: string | undefined;
3241
+ })[];
3242
+ } | undefined;
3243
+ readonly providerMetadata?: {
3244
+ readonly [x: string]: {
3245
+ readonly [x: string]: unknown;
3246
+ };
3247
+ } | undefined;
3248
+ readonly providerExecuted?: boolean | undefined;
3249
+ } | {
3250
+ readonly id: string;
3251
+ readonly type: "tool-error";
3252
+ readonly name: string;
3253
+ readonly message: string;
3254
+ readonly error?: unknown;
3255
+ readonly providerMetadata?: {
3256
+ readonly [x: string]: {
3257
+ readonly [x: string]: unknown;
3258
+ };
3259
+ } | undefined;
3260
+ } | {
3261
+ readonly type: "step-finish";
3262
+ readonly reason: {
3263
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3264
+ readonly raw?: string | undefined;
3265
+ };
3266
+ readonly index: number;
3267
+ readonly providerMetadata?: {
3268
+ readonly [x: string]: {
3269
+ readonly [x: string]: unknown;
3270
+ };
3271
+ } | undefined;
3272
+ readonly usage?: Usage | undefined;
3273
+ } | {
3274
+ readonly type: "finish";
3275
+ readonly reason: {
3276
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3277
+ readonly raw?: string | undefined;
3278
+ };
3279
+ readonly providerMetadata?: {
3280
+ readonly [x: string]: {
3281
+ readonly [x: string]: unknown;
3282
+ };
3283
+ } | undefined;
3284
+ readonly usage?: Usage | undefined;
3285
+ } | {
3286
+ readonly type: "provider-error";
3287
+ readonly message: string;
3288
+ readonly providerMetadata?: {
3289
+ readonly [x: string]: {
3290
+ readonly [x: string]: unknown;
3291
+ };
3292
+ } | undefined;
3293
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3294
+ }) => import("effect/Unify").Unify<{ [K_1 in keyof Cases]-?: NonNullable<Cases[K_1]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
3295
+ };
2054
3296
  } & {
2055
3297
  stepStart: (input: {
2056
3298
  readonly index: number;
@@ -2081,6 +3323,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
2081
3323
  textEnd: (input: WithID<TextEnd, ContentBlockID>) => {
2082
3324
  readonly id: string;
2083
3325
  readonly type: "text-end";
3326
+ readonly text?: string | undefined;
2084
3327
  readonly providerMetadata?: {
2085
3328
  readonly [x: string]: {
2086
3329
  readonly [x: string]: unknown;
@@ -2109,6 +3352,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
2109
3352
  reasoningEnd: (input: WithID<ReasoningEnd, ContentBlockID>) => {
2110
3353
  readonly id: string;
2111
3354
  readonly type: "reasoning-end";
3355
+ readonly text?: string | undefined;
2112
3356
  readonly providerMetadata?: {
2113
3357
  readonly [x: string]: {
2114
3358
  readonly [x: string]: unknown;
@@ -2290,6 +3534,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
2290
3534
  textEnd: (u: unknown) => u is {
2291
3535
  readonly id: string;
2292
3536
  readonly type: "text-end";
3537
+ readonly text?: string | undefined;
2293
3538
  readonly providerMetadata?: {
2294
3539
  readonly [x: string]: {
2295
3540
  readonly [x: string]: unknown;
@@ -2318,6 +3563,7 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
2318
3563
  reasoningEnd: (u: unknown) => u is {
2319
3564
  readonly id: string;
2320
3565
  readonly type: "reasoning-end";
3566
+ readonly text?: string | undefined;
2321
3567
  readonly providerMetadata?: {
2322
3568
  readonly [x: string]: {
2323
3569
  readonly [x: string]: unknown;
@@ -2502,6 +3748,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2502
3748
  }>, Schema.Struct<{
2503
3749
  readonly type: Schema.tag<"text-end">;
2504
3750
  readonly id: Schema.String;
3751
+ /** Authoritative complete value; replaces accumulated deltas when present. */
3752
+ readonly text: Schema.optional<Schema.String>;
2505
3753
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2506
3754
  }>, Schema.Struct<{
2507
3755
  readonly type: Schema.tag<"reasoning-start">;
@@ -2515,6 +3763,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2515
3763
  }>, Schema.Struct<{
2516
3764
  readonly type: Schema.tag<"reasoning-end">;
2517
3765
  readonly id: Schema.String;
3766
+ /** Authoritative complete value; replaces accumulated deltas when present. */
3767
+ readonly text: Schema.optional<Schema.String>;
2518
3768
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2519
3769
  }>, Schema.Struct<{
2520
3770
  readonly type: Schema.tag<"tool-input-start">;
@@ -2642,6 +3892,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2642
3892
  "text-end": Schema.Struct<{
2643
3893
  readonly type: Schema.tag<"text-end">;
2644
3894
  readonly id: Schema.String;
3895
+ /** Authoritative complete value; replaces accumulated deltas when present. */
3896
+ readonly text: Schema.optional<Schema.String>;
2645
3897
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2646
3898
  }>;
2647
3899
  "reasoning-start": Schema.Struct<{
@@ -2658,6 +3910,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2658
3910
  "reasoning-end": Schema.Struct<{
2659
3911
  readonly type: Schema.tag<"reasoning-end">;
2660
3912
  readonly id: Schema.String;
3913
+ /** Authoritative complete value; replaces accumulated deltas when present. */
3914
+ readonly text: Schema.optional<Schema.String>;
2661
3915
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
2662
3916
  }>;
2663
3917
  "tool-input-start": Schema.Struct<{
@@ -2799,12 +4053,205 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2799
4053
  } | {
2800
4054
  readonly id: string;
2801
4055
  readonly type: "text-end";
4056
+ readonly text?: string | undefined;
4057
+ readonly providerMetadata?: {
4058
+ readonly [x: string]: {
4059
+ readonly [x: string]: unknown;
4060
+ };
4061
+ } | undefined;
4062
+ } | {
4063
+ readonly id: string;
4064
+ readonly type: "reasoning-start";
4065
+ readonly providerMetadata?: {
4066
+ readonly [x: string]: {
4067
+ readonly [x: string]: unknown;
4068
+ };
4069
+ } | undefined;
4070
+ } | {
4071
+ readonly id: string;
4072
+ readonly type: "reasoning-delta";
4073
+ readonly text: string;
4074
+ readonly providerMetadata?: {
4075
+ readonly [x: string]: {
4076
+ readonly [x: string]: unknown;
4077
+ };
4078
+ } | undefined;
4079
+ } | {
4080
+ readonly id: string;
4081
+ readonly type: "reasoning-end";
4082
+ readonly text?: string | undefined;
4083
+ readonly providerMetadata?: {
4084
+ readonly [x: string]: {
4085
+ readonly [x: string]: unknown;
4086
+ };
4087
+ } | undefined;
4088
+ } | {
4089
+ readonly id: string;
4090
+ readonly type: "tool-input-start";
4091
+ readonly name: string;
4092
+ readonly providerMetadata?: {
4093
+ readonly [x: string]: {
4094
+ readonly [x: string]: unknown;
4095
+ };
4096
+ } | undefined;
4097
+ readonly providerExecuted?: boolean | undefined;
4098
+ } | {
4099
+ readonly id: string;
4100
+ readonly type: "tool-input-delta";
4101
+ readonly name: string;
4102
+ readonly text: string;
4103
+ readonly input?: unknown;
4104
+ } | {
4105
+ readonly id: string;
4106
+ readonly type: "tool-input-end";
4107
+ readonly name: string;
4108
+ readonly providerMetadata?: {
4109
+ readonly [x: string]: {
4110
+ readonly [x: string]: unknown;
4111
+ };
4112
+ } | undefined;
4113
+ } | {
4114
+ readonly type: "tool-input-error";
4115
+ readonly id: string;
4116
+ readonly name: string;
4117
+ readonly raw: string;
4118
+ } | {
4119
+ readonly id: string;
4120
+ readonly type: "tool-call";
4121
+ readonly name: string;
4122
+ readonly input: unknown;
4123
+ readonly providerMetadata?: {
4124
+ readonly [x: string]: {
4125
+ readonly [x: string]: unknown;
4126
+ };
4127
+ } | undefined;
4128
+ readonly providerExecuted?: boolean | undefined;
4129
+ } | {
4130
+ readonly id: string;
4131
+ readonly type: "tool-result";
4132
+ readonly name: string;
4133
+ readonly result: {
4134
+ readonly type: "json";
4135
+ readonly value: unknown;
4136
+ } | {
4137
+ readonly type: "text";
4138
+ readonly value: unknown;
4139
+ } | {
4140
+ readonly type: "error";
4141
+ readonly value: unknown;
4142
+ } | {
4143
+ readonly type: "content";
4144
+ readonly value: readonly ({
4145
+ readonly type: "text";
4146
+ readonly text: string;
4147
+ } | {
4148
+ readonly type: "file";
4149
+ readonly uri: string;
4150
+ readonly mime: string;
4151
+ readonly name?: string | undefined;
4152
+ })[];
4153
+ };
4154
+ readonly output?: {
4155
+ readonly structured: unknown;
4156
+ readonly content: readonly ({
4157
+ readonly type: "text";
4158
+ readonly text: string;
4159
+ } | {
4160
+ readonly type: "file";
4161
+ readonly uri: string;
4162
+ readonly mime: string;
4163
+ readonly name?: string | undefined;
4164
+ })[];
4165
+ } | undefined;
4166
+ readonly providerMetadata?: {
4167
+ readonly [x: string]: {
4168
+ readonly [x: string]: unknown;
4169
+ };
4170
+ } | undefined;
4171
+ readonly providerExecuted?: boolean | undefined;
4172
+ } | {
4173
+ readonly id: string;
4174
+ readonly type: "tool-error";
4175
+ readonly name: string;
4176
+ readonly message: string;
4177
+ readonly error?: unknown;
4178
+ readonly providerMetadata?: {
4179
+ readonly [x: string]: {
4180
+ readonly [x: string]: unknown;
4181
+ };
4182
+ } | undefined;
4183
+ } | {
4184
+ readonly type: "step-finish";
4185
+ readonly reason: {
4186
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4187
+ readonly raw?: string | undefined;
4188
+ };
4189
+ readonly index: number;
4190
+ readonly providerMetadata?: {
4191
+ readonly [x: string]: {
4192
+ readonly [x: string]: unknown;
4193
+ };
4194
+ } | undefined;
4195
+ readonly usage?: Usage | undefined;
4196
+ } | {
4197
+ readonly type: "finish";
4198
+ readonly reason: {
4199
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4200
+ readonly raw?: string | undefined;
4201
+ };
4202
+ readonly providerMetadata?: {
4203
+ readonly [x: string]: {
4204
+ readonly [x: string]: unknown;
4205
+ };
4206
+ } | undefined;
4207
+ readonly usage?: Usage | undefined;
4208
+ } | {
4209
+ readonly type: "provider-error";
4210
+ readonly message: string;
4211
+ readonly providerMetadata?: {
4212
+ readonly [x: string]: {
4213
+ readonly [x: string]: unknown;
4214
+ };
4215
+ } | undefined;
4216
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4217
+ }) => value is Extract<{
4218
+ readonly type: "step-start";
4219
+ readonly index: number;
4220
+ }, {
4221
+ readonly type: Keys;
4222
+ }> | Extract<{
4223
+ readonly id: string;
4224
+ readonly type: "text-start";
4225
+ readonly providerMetadata?: {
4226
+ readonly [x: string]: {
4227
+ readonly [x: string]: unknown;
4228
+ };
4229
+ } | undefined;
4230
+ }, {
4231
+ readonly type: Keys;
4232
+ }> | Extract<{
4233
+ readonly id: string;
4234
+ readonly type: "text-delta";
4235
+ readonly text: string;
4236
+ readonly providerMetadata?: {
4237
+ readonly [x: string]: {
4238
+ readonly [x: string]: unknown;
4239
+ };
4240
+ } | undefined;
4241
+ }, {
4242
+ readonly type: Keys;
4243
+ }> | Extract<{
4244
+ readonly id: string;
4245
+ readonly type: "text-end";
4246
+ readonly text?: string | undefined;
2802
4247
  readonly providerMetadata?: {
2803
4248
  readonly [x: string]: {
2804
4249
  readonly [x: string]: unknown;
2805
4250
  };
2806
4251
  } | undefined;
2807
- } | {
4252
+ }, {
4253
+ readonly type: Keys;
4254
+ }> | Extract<{
2808
4255
  readonly id: string;
2809
4256
  readonly type: "reasoning-start";
2810
4257
  readonly providerMetadata?: {
@@ -2812,7 +4259,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2812
4259
  readonly [x: string]: unknown;
2813
4260
  };
2814
4261
  } | undefined;
2815
- } | {
4262
+ }, {
4263
+ readonly type: Keys;
4264
+ }> | Extract<{
2816
4265
  readonly id: string;
2817
4266
  readonly type: "reasoning-delta";
2818
4267
  readonly text: string;
@@ -2821,15 +4270,20 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2821
4270
  readonly [x: string]: unknown;
2822
4271
  };
2823
4272
  } | undefined;
2824
- } | {
4273
+ }, {
4274
+ readonly type: Keys;
4275
+ }> | Extract<{
2825
4276
  readonly id: string;
2826
4277
  readonly type: "reasoning-end";
4278
+ readonly text?: string | undefined;
2827
4279
  readonly providerMetadata?: {
2828
4280
  readonly [x: string]: {
2829
4281
  readonly [x: string]: unknown;
2830
4282
  };
2831
4283
  } | undefined;
2832
- } | {
4284
+ }, {
4285
+ readonly type: Keys;
4286
+ }> | Extract<{
2833
4287
  readonly id: string;
2834
4288
  readonly type: "tool-input-start";
2835
4289
  readonly name: string;
@@ -2839,13 +4293,17 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2839
4293
  };
2840
4294
  } | undefined;
2841
4295
  readonly providerExecuted?: boolean | undefined;
2842
- } | {
4296
+ }, {
4297
+ readonly type: Keys;
4298
+ }> | Extract<{
2843
4299
  readonly id: string;
2844
4300
  readonly type: "tool-input-delta";
2845
4301
  readonly name: string;
2846
4302
  readonly text: string;
2847
4303
  readonly input?: unknown;
2848
- } | {
4304
+ }, {
4305
+ readonly type: Keys;
4306
+ }> | Extract<{
2849
4307
  readonly id: string;
2850
4308
  readonly type: "tool-input-end";
2851
4309
  readonly name: string;
@@ -2854,12 +4312,16 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2854
4312
  readonly [x: string]: unknown;
2855
4313
  };
2856
4314
  } | undefined;
2857
- } | {
4315
+ }, {
4316
+ readonly type: Keys;
4317
+ }> | Extract<{
2858
4318
  readonly type: "tool-input-error";
2859
4319
  readonly id: string;
2860
4320
  readonly name: string;
2861
4321
  readonly raw: string;
2862
- } | {
4322
+ }, {
4323
+ readonly type: Keys;
4324
+ }> | Extract<{
2863
4325
  readonly id: string;
2864
4326
  readonly type: "tool-call";
2865
4327
  readonly name: string;
@@ -2870,7 +4332,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2870
4332
  };
2871
4333
  } | undefined;
2872
4334
  readonly providerExecuted?: boolean | undefined;
2873
- } | {
4335
+ }, {
4336
+ readonly type: Keys;
4337
+ }> | Extract<{
2874
4338
  readonly id: string;
2875
4339
  readonly type: "tool-result";
2876
4340
  readonly name: string;
@@ -2913,7 +4377,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2913
4377
  };
2914
4378
  } | undefined;
2915
4379
  readonly providerExecuted?: boolean | undefined;
2916
- } | {
4380
+ }, {
4381
+ readonly type: Keys;
4382
+ }> | Extract<{
2917
4383
  readonly id: string;
2918
4384
  readonly type: "tool-error";
2919
4385
  readonly name: string;
@@ -2924,7 +4390,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2924
4390
  readonly [x: string]: unknown;
2925
4391
  };
2926
4392
  } | undefined;
2927
- } | {
4393
+ }, {
4394
+ readonly type: Keys;
4395
+ }> | Extract<{
2928
4396
  readonly type: "step-finish";
2929
4397
  readonly reason: {
2930
4398
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -2937,7 +4405,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2937
4405
  };
2938
4406
  } | undefined;
2939
4407
  readonly usage?: Usage | undefined;
2940
- } | {
4408
+ }, {
4409
+ readonly type: Keys;
4410
+ }> | Extract<{
2941
4411
  readonly type: "finish";
2942
4412
  readonly reason: {
2943
4413
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -2949,238 +4419,817 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2949
4419
  };
2950
4420
  } | undefined;
2951
4421
  readonly usage?: Usage | undefined;
2952
- } | {
2953
- readonly type: "provider-error";
2954
- readonly message: string;
2955
- readonly providerMetadata?: {
2956
- readonly [x: string]: {
2957
- readonly [x: string]: unknown;
2958
- };
2959
- } | undefined;
2960
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2961
- }) => value is Extract<{
2962
- readonly type: "step-start";
2963
- readonly index: number;
2964
- }, {
2965
- readonly type: Keys;
2966
- }> | Extract<{
2967
- readonly id: string;
2968
- readonly type: "text-start";
2969
- readonly providerMetadata?: {
2970
- readonly [x: string]: {
2971
- readonly [x: string]: unknown;
2972
- };
2973
- } | undefined;
2974
- }, {
2975
- readonly type: Keys;
2976
- }> | Extract<{
2977
- readonly id: string;
2978
- readonly type: "text-delta";
2979
- readonly text: string;
2980
- readonly providerMetadata?: {
2981
- readonly [x: string]: {
2982
- readonly [x: string]: unknown;
2983
- };
2984
- } | undefined;
2985
- }, {
2986
- readonly type: Keys;
2987
- }> | Extract<{
2988
- readonly id: string;
2989
- readonly type: "text-end";
2990
- readonly providerMetadata?: {
2991
- readonly [x: string]: {
2992
- readonly [x: string]: unknown;
2993
- };
2994
- } | undefined;
2995
- }, {
2996
- readonly type: Keys;
2997
- }> | Extract<{
2998
- readonly id: string;
2999
- readonly type: "reasoning-start";
3000
- readonly providerMetadata?: {
3001
- readonly [x: string]: {
3002
- readonly [x: string]: unknown;
3003
- };
3004
- } | undefined;
3005
- }, {
3006
- readonly type: Keys;
3007
- }> | Extract<{
3008
- readonly id: string;
3009
- readonly type: "reasoning-delta";
3010
- readonly text: string;
3011
- readonly providerMetadata?: {
3012
- readonly [x: string]: {
3013
- readonly [x: string]: unknown;
3014
- };
3015
- } | undefined;
3016
4422
  }, {
3017
4423
  readonly type: Keys;
3018
4424
  }> | Extract<{
3019
- readonly id: string;
3020
- readonly type: "reasoning-end";
4425
+ readonly type: "provider-error";
4426
+ readonly message: string;
3021
4427
  readonly providerMetadata?: {
3022
4428
  readonly [x: string]: {
3023
4429
  readonly [x: string]: unknown;
3024
4430
  };
3025
4431
  } | undefined;
4432
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3026
4433
  }, {
3027
4434
  readonly type: Keys;
3028
- }> | Extract<{
3029
- readonly id: string;
3030
- readonly type: "tool-input-start";
3031
- readonly name: string;
3032
- readonly providerMetadata?: {
3033
- readonly [x: string]: {
3034
- readonly [x: string]: unknown;
4435
+ }>;
4436
+ readonly guards: {
4437
+ "step-start": (u: unknown) => u is {
4438
+ readonly type: "step-start";
4439
+ readonly index: number;
4440
+ };
4441
+ "text-start": (u: unknown) => u is {
4442
+ readonly id: string;
4443
+ readonly type: "text-start";
4444
+ readonly providerMetadata?: {
4445
+ readonly [x: string]: {
4446
+ readonly [x: string]: unknown;
4447
+ };
4448
+ } | undefined;
4449
+ };
4450
+ "text-delta": (u: unknown) => u is {
4451
+ readonly id: string;
4452
+ readonly type: "text-delta";
4453
+ readonly text: string;
4454
+ readonly providerMetadata?: {
4455
+ readonly [x: string]: {
4456
+ readonly [x: string]: unknown;
4457
+ };
4458
+ } | undefined;
4459
+ };
4460
+ "text-end": (u: unknown) => u is {
4461
+ readonly id: string;
4462
+ readonly type: "text-end";
4463
+ readonly text?: string | undefined;
4464
+ readonly providerMetadata?: {
4465
+ readonly [x: string]: {
4466
+ readonly [x: string]: unknown;
4467
+ };
4468
+ } | undefined;
4469
+ };
4470
+ "reasoning-start": (u: unknown) => u is {
4471
+ readonly id: string;
4472
+ readonly type: "reasoning-start";
4473
+ readonly providerMetadata?: {
4474
+ readonly [x: string]: {
4475
+ readonly [x: string]: unknown;
4476
+ };
4477
+ } | undefined;
4478
+ };
4479
+ "reasoning-delta": (u: unknown) => u is {
4480
+ readonly id: string;
4481
+ readonly type: "reasoning-delta";
4482
+ readonly text: string;
4483
+ readonly providerMetadata?: {
4484
+ readonly [x: string]: {
4485
+ readonly [x: string]: unknown;
4486
+ };
4487
+ } | undefined;
4488
+ };
4489
+ "reasoning-end": (u: unknown) => u is {
4490
+ readonly id: string;
4491
+ readonly type: "reasoning-end";
4492
+ readonly text?: string | undefined;
4493
+ readonly providerMetadata?: {
4494
+ readonly [x: string]: {
4495
+ readonly [x: string]: unknown;
4496
+ };
4497
+ } | undefined;
4498
+ };
4499
+ "tool-input-start": (u: unknown) => u is {
4500
+ readonly id: string;
4501
+ readonly type: "tool-input-start";
4502
+ readonly name: string;
4503
+ readonly providerMetadata?: {
4504
+ readonly [x: string]: {
4505
+ readonly [x: string]: unknown;
4506
+ };
4507
+ } | undefined;
4508
+ readonly providerExecuted?: boolean | undefined;
4509
+ };
4510
+ "tool-input-delta": (u: unknown) => u is {
4511
+ readonly id: string;
4512
+ readonly type: "tool-input-delta";
4513
+ readonly name: string;
4514
+ readonly text: string;
4515
+ readonly input?: unknown;
4516
+ };
4517
+ "tool-input-end": (u: unknown) => u is {
4518
+ readonly id: string;
4519
+ readonly type: "tool-input-end";
4520
+ readonly name: string;
4521
+ readonly providerMetadata?: {
4522
+ readonly [x: string]: {
4523
+ readonly [x: string]: unknown;
4524
+ };
4525
+ } | undefined;
4526
+ };
4527
+ "tool-input-error": (u: unknown) => u is {
4528
+ readonly type: "tool-input-error";
4529
+ readonly id: string;
4530
+ readonly name: string;
4531
+ readonly raw: string;
4532
+ };
4533
+ "tool-call": (u: unknown) => u is {
4534
+ readonly id: string;
4535
+ readonly type: "tool-call";
4536
+ readonly name: string;
4537
+ readonly input: unknown;
4538
+ readonly providerMetadata?: {
4539
+ readonly [x: string]: {
4540
+ readonly [x: string]: unknown;
4541
+ };
4542
+ } | undefined;
4543
+ readonly providerExecuted?: boolean | undefined;
4544
+ };
4545
+ "tool-result": (u: unknown) => u is {
4546
+ readonly id: string;
4547
+ readonly type: "tool-result";
4548
+ readonly name: string;
4549
+ readonly result: {
4550
+ readonly type: "json";
4551
+ readonly value: unknown;
4552
+ } | {
4553
+ readonly type: "text";
4554
+ readonly value: unknown;
4555
+ } | {
4556
+ readonly type: "error";
4557
+ readonly value: unknown;
4558
+ } | {
4559
+ readonly type: "content";
4560
+ readonly value: readonly ({
4561
+ readonly type: "text";
4562
+ readonly text: string;
4563
+ } | {
4564
+ readonly type: "file";
4565
+ readonly uri: string;
4566
+ readonly mime: string;
4567
+ readonly name?: string | undefined;
4568
+ })[];
3035
4569
  };
3036
- } | undefined;
3037
- readonly providerExecuted?: boolean | undefined;
3038
- }, {
3039
- readonly type: Keys;
3040
- }> | Extract<{
3041
- readonly id: string;
3042
- readonly type: "tool-input-delta";
3043
- readonly name: string;
3044
- readonly text: string;
3045
- readonly input?: unknown;
3046
- }, {
3047
- readonly type: Keys;
3048
- }> | Extract<{
3049
- readonly id: string;
3050
- readonly type: "tool-input-end";
3051
- readonly name: string;
3052
- readonly providerMetadata?: {
3053
- readonly [x: string]: {
3054
- readonly [x: string]: unknown;
4570
+ readonly output?: {
4571
+ readonly structured: unknown;
4572
+ readonly content: readonly ({
4573
+ readonly type: "text";
4574
+ readonly text: string;
4575
+ } | {
4576
+ readonly type: "file";
4577
+ readonly uri: string;
4578
+ readonly mime: string;
4579
+ readonly name?: string | undefined;
4580
+ })[];
4581
+ } | undefined;
4582
+ readonly providerMetadata?: {
4583
+ readonly [x: string]: {
4584
+ readonly [x: string]: unknown;
4585
+ };
4586
+ } | undefined;
4587
+ readonly providerExecuted?: boolean | undefined;
4588
+ };
4589
+ "tool-error": (u: unknown) => u is {
4590
+ readonly id: string;
4591
+ readonly type: "tool-error";
4592
+ readonly name: string;
4593
+ readonly message: string;
4594
+ readonly error?: unknown;
4595
+ readonly providerMetadata?: {
4596
+ readonly [x: string]: {
4597
+ readonly [x: string]: unknown;
4598
+ };
4599
+ } | undefined;
4600
+ };
4601
+ "step-finish": (u: unknown) => u is {
4602
+ readonly type: "step-finish";
4603
+ readonly reason: {
4604
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4605
+ readonly raw?: string | undefined;
3055
4606
  };
3056
- } | undefined;
3057
- }, {
3058
- readonly type: Keys;
3059
- }> | Extract<{
3060
- readonly type: "tool-input-error";
3061
- readonly id: string;
3062
- readonly name: string;
3063
- readonly raw: string;
3064
- }, {
3065
- readonly type: Keys;
3066
- }> | Extract<{
3067
- readonly id: string;
3068
- readonly type: "tool-call";
3069
- readonly name: string;
3070
- readonly input: unknown;
3071
- readonly providerMetadata?: {
3072
- readonly [x: string]: {
3073
- readonly [x: string]: unknown;
4607
+ readonly index: number;
4608
+ readonly providerMetadata?: {
4609
+ readonly [x: string]: {
4610
+ readonly [x: string]: unknown;
4611
+ };
4612
+ } | undefined;
4613
+ readonly usage?: Usage | undefined;
4614
+ };
4615
+ finish: (u: unknown) => u is {
4616
+ readonly type: "finish";
4617
+ readonly reason: {
4618
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4619
+ readonly raw?: string | undefined;
3074
4620
  };
3075
- } | undefined;
3076
- readonly providerExecuted?: boolean | undefined;
3077
- }, {
3078
- readonly type: Keys;
3079
- }> | Extract<{
3080
- readonly id: string;
3081
- readonly type: "tool-result";
3082
- readonly name: string;
3083
- readonly result: {
3084
- readonly type: "json";
3085
- readonly value: unknown;
4621
+ readonly providerMetadata?: {
4622
+ readonly [x: string]: {
4623
+ readonly [x: string]: unknown;
4624
+ };
4625
+ } | undefined;
4626
+ readonly usage?: Usage | undefined;
4627
+ };
4628
+ "provider-error": (u: unknown) => u is {
4629
+ readonly type: "provider-error";
4630
+ readonly message: string;
4631
+ readonly providerMetadata?: {
4632
+ readonly [x: string]: {
4633
+ readonly [x: string]: unknown;
4634
+ };
4635
+ } | undefined;
4636
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4637
+ };
4638
+ };
4639
+ readonly match: {
4640
+ <Cases extends {
4641
+ "step-start": (value: {
4642
+ readonly type: "step-start";
4643
+ readonly index: number;
4644
+ }) => any;
4645
+ "text-start": (value: {
4646
+ readonly id: string;
4647
+ readonly type: "text-start";
4648
+ readonly providerMetadata?: {
4649
+ readonly [x: string]: {
4650
+ readonly [x: string]: unknown;
4651
+ };
4652
+ } | undefined;
4653
+ }) => any;
4654
+ "text-delta": (value: {
4655
+ readonly id: string;
4656
+ readonly type: "text-delta";
4657
+ readonly text: string;
4658
+ readonly providerMetadata?: {
4659
+ readonly [x: string]: {
4660
+ readonly [x: string]: unknown;
4661
+ };
4662
+ } | undefined;
4663
+ }) => any;
4664
+ "text-end": (value: {
4665
+ readonly id: string;
4666
+ readonly type: "text-end";
4667
+ readonly text?: string | undefined;
4668
+ readonly providerMetadata?: {
4669
+ readonly [x: string]: {
4670
+ readonly [x: string]: unknown;
4671
+ };
4672
+ } | undefined;
4673
+ }) => any;
4674
+ "reasoning-start": (value: {
4675
+ readonly id: string;
4676
+ readonly type: "reasoning-start";
4677
+ readonly providerMetadata?: {
4678
+ readonly [x: string]: {
4679
+ readonly [x: string]: unknown;
4680
+ };
4681
+ } | undefined;
4682
+ }) => any;
4683
+ "reasoning-delta": (value: {
4684
+ readonly id: string;
4685
+ readonly type: "reasoning-delta";
4686
+ readonly text: string;
4687
+ readonly providerMetadata?: {
4688
+ readonly [x: string]: {
4689
+ readonly [x: string]: unknown;
4690
+ };
4691
+ } | undefined;
4692
+ }) => any;
4693
+ "reasoning-end": (value: {
4694
+ readonly id: string;
4695
+ readonly type: "reasoning-end";
4696
+ readonly text?: string | undefined;
4697
+ readonly providerMetadata?: {
4698
+ readonly [x: string]: {
4699
+ readonly [x: string]: unknown;
4700
+ };
4701
+ } | undefined;
4702
+ }) => any;
4703
+ "tool-input-start": (value: {
4704
+ readonly id: string;
4705
+ readonly type: "tool-input-start";
4706
+ readonly name: string;
4707
+ readonly providerMetadata?: {
4708
+ readonly [x: string]: {
4709
+ readonly [x: string]: unknown;
4710
+ };
4711
+ } | undefined;
4712
+ readonly providerExecuted?: boolean | undefined;
4713
+ }) => any;
4714
+ "tool-input-delta": (value: {
4715
+ readonly id: string;
4716
+ readonly type: "tool-input-delta";
4717
+ readonly name: string;
4718
+ readonly text: string;
4719
+ readonly input?: unknown;
4720
+ }) => any;
4721
+ "tool-input-end": (value: {
4722
+ readonly id: string;
4723
+ readonly type: "tool-input-end";
4724
+ readonly name: string;
4725
+ readonly providerMetadata?: {
4726
+ readonly [x: string]: {
4727
+ readonly [x: string]: unknown;
4728
+ };
4729
+ } | undefined;
4730
+ }) => any;
4731
+ "tool-input-error": (value: {
4732
+ readonly type: "tool-input-error";
4733
+ readonly id: string;
4734
+ readonly name: string;
4735
+ readonly raw: string;
4736
+ }) => any;
4737
+ "tool-call": (value: {
4738
+ readonly id: string;
4739
+ readonly type: "tool-call";
4740
+ readonly name: string;
4741
+ readonly input: unknown;
4742
+ readonly providerMetadata?: {
4743
+ readonly [x: string]: {
4744
+ readonly [x: string]: unknown;
4745
+ };
4746
+ } | undefined;
4747
+ readonly providerExecuted?: boolean | undefined;
4748
+ }) => any;
4749
+ "tool-result": (value: {
4750
+ readonly id: string;
4751
+ readonly type: "tool-result";
4752
+ readonly name: string;
4753
+ readonly result: {
4754
+ readonly type: "json";
4755
+ readonly value: unknown;
4756
+ } | {
4757
+ readonly type: "text";
4758
+ readonly value: unknown;
4759
+ } | {
4760
+ readonly type: "error";
4761
+ readonly value: unknown;
4762
+ } | {
4763
+ readonly type: "content";
4764
+ readonly value: readonly ({
4765
+ readonly type: "text";
4766
+ readonly text: string;
4767
+ } | {
4768
+ readonly type: "file";
4769
+ readonly uri: string;
4770
+ readonly mime: string;
4771
+ readonly name?: string | undefined;
4772
+ })[];
4773
+ };
4774
+ readonly output?: {
4775
+ readonly structured: unknown;
4776
+ readonly content: readonly ({
4777
+ readonly type: "text";
4778
+ readonly text: string;
4779
+ } | {
4780
+ readonly type: "file";
4781
+ readonly uri: string;
4782
+ readonly mime: string;
4783
+ readonly name?: string | undefined;
4784
+ })[];
4785
+ } | undefined;
4786
+ readonly providerMetadata?: {
4787
+ readonly [x: string]: {
4788
+ readonly [x: string]: unknown;
4789
+ };
4790
+ } | undefined;
4791
+ readonly providerExecuted?: boolean | undefined;
4792
+ }) => any;
4793
+ "tool-error": (value: {
4794
+ readonly id: string;
4795
+ readonly type: "tool-error";
4796
+ readonly name: string;
4797
+ readonly message: string;
4798
+ readonly error?: unknown;
4799
+ readonly providerMetadata?: {
4800
+ readonly [x: string]: {
4801
+ readonly [x: string]: unknown;
4802
+ };
4803
+ } | undefined;
4804
+ }) => any;
4805
+ "step-finish": (value: {
4806
+ readonly type: "step-finish";
4807
+ readonly reason: {
4808
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4809
+ readonly raw?: string | undefined;
4810
+ };
4811
+ readonly index: number;
4812
+ readonly providerMetadata?: {
4813
+ readonly [x: string]: {
4814
+ readonly [x: string]: unknown;
4815
+ };
4816
+ } | undefined;
4817
+ readonly usage?: Usage | undefined;
4818
+ }) => any;
4819
+ finish: (value: {
4820
+ readonly type: "finish";
4821
+ readonly reason: {
4822
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4823
+ readonly raw?: string | undefined;
4824
+ };
4825
+ readonly providerMetadata?: {
4826
+ readonly [x: string]: {
4827
+ readonly [x: string]: unknown;
4828
+ };
4829
+ } | undefined;
4830
+ readonly usage?: Usage | undefined;
4831
+ }) => any;
4832
+ "provider-error": (value: {
4833
+ readonly type: "provider-error";
4834
+ readonly message: string;
4835
+ readonly providerMetadata?: {
4836
+ readonly [x: string]: {
4837
+ readonly [x: string]: unknown;
4838
+ };
4839
+ } | undefined;
4840
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4841
+ }) => any;
4842
+ }>(value: {
4843
+ readonly type: "step-start";
4844
+ readonly index: number;
3086
4845
  } | {
3087
- readonly type: "text";
3088
- readonly value: unknown;
4846
+ readonly id: string;
4847
+ readonly type: "text-start";
4848
+ readonly providerMetadata?: {
4849
+ readonly [x: string]: {
4850
+ readonly [x: string]: unknown;
4851
+ };
4852
+ } | undefined;
3089
4853
  } | {
3090
- readonly type: "error";
3091
- readonly value: unknown;
4854
+ readonly id: string;
4855
+ readonly type: "text-delta";
4856
+ readonly text: string;
4857
+ readonly providerMetadata?: {
4858
+ readonly [x: string]: {
4859
+ readonly [x: string]: unknown;
4860
+ };
4861
+ } | undefined;
3092
4862
  } | {
3093
- readonly type: "content";
3094
- readonly value: readonly ({
3095
- readonly type: "text";
3096
- readonly text: string;
4863
+ readonly id: string;
4864
+ readonly type: "text-end";
4865
+ readonly text?: string | undefined;
4866
+ readonly providerMetadata?: {
4867
+ readonly [x: string]: {
4868
+ readonly [x: string]: unknown;
4869
+ };
4870
+ } | undefined;
4871
+ } | {
4872
+ readonly id: string;
4873
+ readonly type: "reasoning-start";
4874
+ readonly providerMetadata?: {
4875
+ readonly [x: string]: {
4876
+ readonly [x: string]: unknown;
4877
+ };
4878
+ } | undefined;
4879
+ } | {
4880
+ readonly id: string;
4881
+ readonly type: "reasoning-delta";
4882
+ readonly text: string;
4883
+ readonly providerMetadata?: {
4884
+ readonly [x: string]: {
4885
+ readonly [x: string]: unknown;
4886
+ };
4887
+ } | undefined;
4888
+ } | {
4889
+ readonly id: string;
4890
+ readonly type: "reasoning-end";
4891
+ readonly text?: string | undefined;
4892
+ readonly providerMetadata?: {
4893
+ readonly [x: string]: {
4894
+ readonly [x: string]: unknown;
4895
+ };
4896
+ } | undefined;
4897
+ } | {
4898
+ readonly id: string;
4899
+ readonly type: "tool-input-start";
4900
+ readonly name: string;
4901
+ readonly providerMetadata?: {
4902
+ readonly [x: string]: {
4903
+ readonly [x: string]: unknown;
4904
+ };
4905
+ } | undefined;
4906
+ readonly providerExecuted?: boolean | undefined;
4907
+ } | {
4908
+ readonly id: string;
4909
+ readonly type: "tool-input-delta";
4910
+ readonly name: string;
4911
+ readonly text: string;
4912
+ readonly input?: unknown;
4913
+ } | {
4914
+ readonly id: string;
4915
+ readonly type: "tool-input-end";
4916
+ readonly name: string;
4917
+ readonly providerMetadata?: {
4918
+ readonly [x: string]: {
4919
+ readonly [x: string]: unknown;
4920
+ };
4921
+ } | undefined;
4922
+ } | {
4923
+ readonly type: "tool-input-error";
4924
+ readonly id: string;
4925
+ readonly name: string;
4926
+ readonly raw: string;
4927
+ } | {
4928
+ readonly id: string;
4929
+ readonly type: "tool-call";
4930
+ readonly name: string;
4931
+ readonly input: unknown;
4932
+ readonly providerMetadata?: {
4933
+ readonly [x: string]: {
4934
+ readonly [x: string]: unknown;
4935
+ };
4936
+ } | undefined;
4937
+ readonly providerExecuted?: boolean | undefined;
4938
+ } | {
4939
+ readonly id: string;
4940
+ readonly type: "tool-result";
4941
+ readonly name: string;
4942
+ readonly result: {
4943
+ readonly type: "json";
4944
+ readonly value: unknown;
3097
4945
  } | {
3098
- readonly type: "file";
3099
- readonly uri: string;
3100
- readonly mime: string;
3101
- readonly name?: string | undefined;
3102
- })[];
3103
- };
3104
- readonly output?: {
3105
- readonly structured: unknown;
3106
- readonly content: readonly ({
3107
4946
  readonly type: "text";
3108
- readonly text: string;
4947
+ readonly value: unknown;
3109
4948
  } | {
3110
- readonly type: "file";
3111
- readonly uri: string;
3112
- readonly mime: string;
3113
- readonly name?: string | undefined;
3114
- })[];
3115
- } | undefined;
3116
- readonly providerMetadata?: {
3117
- readonly [x: string]: {
3118
- readonly [x: string]: unknown;
3119
- };
3120
- } | undefined;
3121
- readonly providerExecuted?: boolean | undefined;
3122
- }, {
3123
- readonly type: Keys;
3124
- }> | Extract<{
3125
- readonly id: string;
3126
- readonly type: "tool-error";
3127
- readonly name: string;
3128
- readonly message: string;
3129
- readonly error?: unknown;
3130
- readonly providerMetadata?: {
3131
- readonly [x: string]: {
3132
- readonly [x: string]: unknown;
3133
- };
3134
- } | undefined;
3135
- }, {
3136
- readonly type: Keys;
3137
- }> | Extract<{
3138
- readonly type: "step-finish";
3139
- readonly reason: {
3140
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3141
- readonly raw?: string | undefined;
3142
- };
3143
- readonly index: number;
3144
- readonly providerMetadata?: {
3145
- readonly [x: string]: {
3146
- readonly [x: string]: unknown;
4949
+ readonly type: "error";
4950
+ readonly value: unknown;
4951
+ } | {
4952
+ readonly type: "content";
4953
+ readonly value: readonly ({
4954
+ readonly type: "text";
4955
+ readonly text: string;
4956
+ } | {
4957
+ readonly type: "file";
4958
+ readonly uri: string;
4959
+ readonly mime: string;
4960
+ readonly name?: string | undefined;
4961
+ })[];
3147
4962
  };
3148
- } | undefined;
3149
- readonly usage?: Usage | undefined;
3150
- }, {
3151
- readonly type: Keys;
3152
- }> | Extract<{
3153
- readonly type: "finish";
3154
- readonly reason: {
3155
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3156
- readonly raw?: string | undefined;
3157
- };
3158
- readonly providerMetadata?: {
3159
- readonly [x: string]: {
3160
- readonly [x: string]: unknown;
4963
+ readonly output?: {
4964
+ readonly structured: unknown;
4965
+ readonly content: readonly ({
4966
+ readonly type: "text";
4967
+ readonly text: string;
4968
+ } | {
4969
+ readonly type: "file";
4970
+ readonly uri: string;
4971
+ readonly mime: string;
4972
+ readonly name?: string | undefined;
4973
+ })[];
4974
+ } | undefined;
4975
+ readonly providerMetadata?: {
4976
+ readonly [x: string]: {
4977
+ readonly [x: string]: unknown;
4978
+ };
4979
+ } | undefined;
4980
+ readonly providerExecuted?: boolean | undefined;
4981
+ } | {
4982
+ readonly id: string;
4983
+ readonly type: "tool-error";
4984
+ readonly name: string;
4985
+ readonly message: string;
4986
+ readonly error?: unknown;
4987
+ readonly providerMetadata?: {
4988
+ readonly [x: string]: {
4989
+ readonly [x: string]: unknown;
4990
+ };
4991
+ } | undefined;
4992
+ } | {
4993
+ readonly type: "step-finish";
4994
+ readonly reason: {
4995
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4996
+ readonly raw?: string | undefined;
3161
4997
  };
3162
- } | undefined;
3163
- readonly usage?: Usage | undefined;
3164
- }, {
3165
- readonly type: Keys;
3166
- }> | Extract<{
3167
- readonly type: "provider-error";
3168
- readonly message: string;
3169
- readonly providerMetadata?: {
3170
- readonly [x: string]: {
3171
- readonly [x: string]: unknown;
4998
+ readonly index: number;
4999
+ readonly providerMetadata?: {
5000
+ readonly [x: string]: {
5001
+ readonly [x: string]: unknown;
5002
+ };
5003
+ } | undefined;
5004
+ readonly usage?: Usage | undefined;
5005
+ } | {
5006
+ readonly type: "finish";
5007
+ readonly reason: {
5008
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5009
+ readonly raw?: string | undefined;
3172
5010
  };
3173
- } | undefined;
3174
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3175
- }, {
3176
- readonly type: Keys;
3177
- }>;
3178
- readonly guards: {
3179
- "step-start": (u: unknown) => u is {
5011
+ readonly providerMetadata?: {
5012
+ readonly [x: string]: {
5013
+ readonly [x: string]: unknown;
5014
+ };
5015
+ } | undefined;
5016
+ readonly usage?: Usage | undefined;
5017
+ } | {
5018
+ readonly type: "provider-error";
5019
+ readonly message: string;
5020
+ readonly providerMetadata?: {
5021
+ readonly [x: string]: {
5022
+ readonly [x: string]: unknown;
5023
+ };
5024
+ } | undefined;
5025
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5026
+ }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
5027
+ <Cases extends {
5028
+ "step-start": (value: {
5029
+ readonly type: "step-start";
5030
+ readonly index: number;
5031
+ }) => any;
5032
+ "text-start": (value: {
5033
+ readonly id: string;
5034
+ readonly type: "text-start";
5035
+ readonly providerMetadata?: {
5036
+ readonly [x: string]: {
5037
+ readonly [x: string]: unknown;
5038
+ };
5039
+ } | undefined;
5040
+ }) => any;
5041
+ "text-delta": (value: {
5042
+ readonly id: string;
5043
+ readonly type: "text-delta";
5044
+ readonly text: string;
5045
+ readonly providerMetadata?: {
5046
+ readonly [x: string]: {
5047
+ readonly [x: string]: unknown;
5048
+ };
5049
+ } | undefined;
5050
+ }) => any;
5051
+ "text-end": (value: {
5052
+ readonly id: string;
5053
+ readonly type: "text-end";
5054
+ readonly text?: string | undefined;
5055
+ readonly providerMetadata?: {
5056
+ readonly [x: string]: {
5057
+ readonly [x: string]: unknown;
5058
+ };
5059
+ } | undefined;
5060
+ }) => any;
5061
+ "reasoning-start": (value: {
5062
+ readonly id: string;
5063
+ readonly type: "reasoning-start";
5064
+ readonly providerMetadata?: {
5065
+ readonly [x: string]: {
5066
+ readonly [x: string]: unknown;
5067
+ };
5068
+ } | undefined;
5069
+ }) => any;
5070
+ "reasoning-delta": (value: {
5071
+ readonly id: string;
5072
+ readonly type: "reasoning-delta";
5073
+ readonly text: string;
5074
+ readonly providerMetadata?: {
5075
+ readonly [x: string]: {
5076
+ readonly [x: string]: unknown;
5077
+ };
5078
+ } | undefined;
5079
+ }) => any;
5080
+ "reasoning-end": (value: {
5081
+ readonly id: string;
5082
+ readonly type: "reasoning-end";
5083
+ readonly text?: string | undefined;
5084
+ readonly providerMetadata?: {
5085
+ readonly [x: string]: {
5086
+ readonly [x: string]: unknown;
5087
+ };
5088
+ } | undefined;
5089
+ }) => any;
5090
+ "tool-input-start": (value: {
5091
+ readonly id: string;
5092
+ readonly type: "tool-input-start";
5093
+ readonly name: string;
5094
+ readonly providerMetadata?: {
5095
+ readonly [x: string]: {
5096
+ readonly [x: string]: unknown;
5097
+ };
5098
+ } | undefined;
5099
+ readonly providerExecuted?: boolean | undefined;
5100
+ }) => any;
5101
+ "tool-input-delta": (value: {
5102
+ readonly id: string;
5103
+ readonly type: "tool-input-delta";
5104
+ readonly name: string;
5105
+ readonly text: string;
5106
+ readonly input?: unknown;
5107
+ }) => any;
5108
+ "tool-input-end": (value: {
5109
+ readonly id: string;
5110
+ readonly type: "tool-input-end";
5111
+ readonly name: string;
5112
+ readonly providerMetadata?: {
5113
+ readonly [x: string]: {
5114
+ readonly [x: string]: unknown;
5115
+ };
5116
+ } | undefined;
5117
+ }) => any;
5118
+ "tool-input-error": (value: {
5119
+ readonly type: "tool-input-error";
5120
+ readonly id: string;
5121
+ readonly name: string;
5122
+ readonly raw: string;
5123
+ }) => any;
5124
+ "tool-call": (value: {
5125
+ readonly id: string;
5126
+ readonly type: "tool-call";
5127
+ readonly name: string;
5128
+ readonly input: unknown;
5129
+ readonly providerMetadata?: {
5130
+ readonly [x: string]: {
5131
+ readonly [x: string]: unknown;
5132
+ };
5133
+ } | undefined;
5134
+ readonly providerExecuted?: boolean | undefined;
5135
+ }) => any;
5136
+ "tool-result": (value: {
5137
+ readonly id: string;
5138
+ readonly type: "tool-result";
5139
+ readonly name: string;
5140
+ readonly result: {
5141
+ readonly type: "json";
5142
+ readonly value: unknown;
5143
+ } | {
5144
+ readonly type: "text";
5145
+ readonly value: unknown;
5146
+ } | {
5147
+ readonly type: "error";
5148
+ readonly value: unknown;
5149
+ } | {
5150
+ readonly type: "content";
5151
+ readonly value: readonly ({
5152
+ readonly type: "text";
5153
+ readonly text: string;
5154
+ } | {
5155
+ readonly type: "file";
5156
+ readonly uri: string;
5157
+ readonly mime: string;
5158
+ readonly name?: string | undefined;
5159
+ })[];
5160
+ };
5161
+ readonly output?: {
5162
+ readonly structured: unknown;
5163
+ readonly content: readonly ({
5164
+ readonly type: "text";
5165
+ readonly text: string;
5166
+ } | {
5167
+ readonly type: "file";
5168
+ readonly uri: string;
5169
+ readonly mime: string;
5170
+ readonly name?: string | undefined;
5171
+ })[];
5172
+ } | undefined;
5173
+ readonly providerMetadata?: {
5174
+ readonly [x: string]: {
5175
+ readonly [x: string]: unknown;
5176
+ };
5177
+ } | undefined;
5178
+ readonly providerExecuted?: boolean | undefined;
5179
+ }) => any;
5180
+ "tool-error": (value: {
5181
+ readonly id: string;
5182
+ readonly type: "tool-error";
5183
+ readonly name: string;
5184
+ readonly message: string;
5185
+ readonly error?: unknown;
5186
+ readonly providerMetadata?: {
5187
+ readonly [x: string]: {
5188
+ readonly [x: string]: unknown;
5189
+ };
5190
+ } | undefined;
5191
+ }) => any;
5192
+ "step-finish": (value: {
5193
+ readonly type: "step-finish";
5194
+ readonly reason: {
5195
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5196
+ readonly raw?: string | undefined;
5197
+ };
5198
+ readonly index: number;
5199
+ readonly providerMetadata?: {
5200
+ readonly [x: string]: {
5201
+ readonly [x: string]: unknown;
5202
+ };
5203
+ } | undefined;
5204
+ readonly usage?: Usage | undefined;
5205
+ }) => any;
5206
+ finish: (value: {
5207
+ readonly type: "finish";
5208
+ readonly reason: {
5209
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5210
+ readonly raw?: string | undefined;
5211
+ };
5212
+ readonly providerMetadata?: {
5213
+ readonly [x: string]: {
5214
+ readonly [x: string]: unknown;
5215
+ };
5216
+ } | undefined;
5217
+ readonly usage?: Usage | undefined;
5218
+ }) => any;
5219
+ "provider-error": (value: {
5220
+ readonly type: "provider-error";
5221
+ readonly message: string;
5222
+ readonly providerMetadata?: {
5223
+ readonly [x: string]: {
5224
+ readonly [x: string]: unknown;
5225
+ };
5226
+ } | undefined;
5227
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5228
+ }) => any;
5229
+ }>(cases: Cases): (value: {
3180
5230
  readonly type: "step-start";
3181
5231
  readonly index: number;
3182
- };
3183
- "text-start": (u: unknown) => u is {
5232
+ } | {
3184
5233
  readonly id: string;
3185
5234
  readonly type: "text-start";
3186
5235
  readonly providerMetadata?: {
@@ -3188,8 +5237,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3188
5237
  readonly [x: string]: unknown;
3189
5238
  };
3190
5239
  } | undefined;
3191
- };
3192
- "text-delta": (u: unknown) => u is {
5240
+ } | {
3193
5241
  readonly id: string;
3194
5242
  readonly type: "text-delta";
3195
5243
  readonly text: string;
@@ -3198,17 +5246,16 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3198
5246
  readonly [x: string]: unknown;
3199
5247
  };
3200
5248
  } | undefined;
3201
- };
3202
- "text-end": (u: unknown) => u is {
5249
+ } | {
3203
5250
  readonly id: string;
3204
5251
  readonly type: "text-end";
5252
+ readonly text?: string | undefined;
3205
5253
  readonly providerMetadata?: {
3206
5254
  readonly [x: string]: {
3207
5255
  readonly [x: string]: unknown;
3208
5256
  };
3209
5257
  } | undefined;
3210
- };
3211
- "reasoning-start": (u: unknown) => u is {
5258
+ } | {
3212
5259
  readonly id: string;
3213
5260
  readonly type: "reasoning-start";
3214
5261
  readonly providerMetadata?: {
@@ -3216,8 +5263,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3216
5263
  readonly [x: string]: unknown;
3217
5264
  };
3218
5265
  } | undefined;
3219
- };
3220
- "reasoning-delta": (u: unknown) => u is {
5266
+ } | {
3221
5267
  readonly id: string;
3222
5268
  readonly type: "reasoning-delta";
3223
5269
  readonly text: string;
@@ -3226,17 +5272,16 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3226
5272
  readonly [x: string]: unknown;
3227
5273
  };
3228
5274
  } | undefined;
3229
- };
3230
- "reasoning-end": (u: unknown) => u is {
5275
+ } | {
3231
5276
  readonly id: string;
3232
5277
  readonly type: "reasoning-end";
5278
+ readonly text?: string | undefined;
3233
5279
  readonly providerMetadata?: {
3234
5280
  readonly [x: string]: {
3235
5281
  readonly [x: string]: unknown;
3236
5282
  };
3237
5283
  } | undefined;
3238
- };
3239
- "tool-input-start": (u: unknown) => u is {
5284
+ } | {
3240
5285
  readonly id: string;
3241
5286
  readonly type: "tool-input-start";
3242
5287
  readonly name: string;
@@ -3246,15 +5291,13 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3246
5291
  };
3247
5292
  } | undefined;
3248
5293
  readonly providerExecuted?: boolean | undefined;
3249
- };
3250
- "tool-input-delta": (u: unknown) => u is {
5294
+ } | {
3251
5295
  readonly id: string;
3252
5296
  readonly type: "tool-input-delta";
3253
5297
  readonly name: string;
3254
5298
  readonly text: string;
3255
5299
  readonly input?: unknown;
3256
- };
3257
- "tool-input-end": (u: unknown) => u is {
5300
+ } | {
3258
5301
  readonly id: string;
3259
5302
  readonly type: "tool-input-end";
3260
5303
  readonly name: string;
@@ -3263,14 +5306,12 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3263
5306
  readonly [x: string]: unknown;
3264
5307
  };
3265
5308
  } | undefined;
3266
- };
3267
- "tool-input-error": (u: unknown) => u is {
5309
+ } | {
3268
5310
  readonly type: "tool-input-error";
3269
5311
  readonly id: string;
3270
5312
  readonly name: string;
3271
5313
  readonly raw: string;
3272
- };
3273
- "tool-call": (u: unknown) => u is {
5314
+ } | {
3274
5315
  readonly id: string;
3275
5316
  readonly type: "tool-call";
3276
5317
  readonly name: string;
@@ -3281,8 +5322,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3281
5322
  };
3282
5323
  } | undefined;
3283
5324
  readonly providerExecuted?: boolean | undefined;
3284
- };
3285
- "tool-result": (u: unknown) => u is {
5325
+ } | {
3286
5326
  readonly id: string;
3287
5327
  readonly type: "tool-result";
3288
5328
  readonly name: string;
@@ -3325,8 +5365,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3325
5365
  };
3326
5366
  } | undefined;
3327
5367
  readonly providerExecuted?: boolean | undefined;
3328
- };
3329
- "tool-error": (u: unknown) => u is {
5368
+ } | {
3330
5369
  readonly id: string;
3331
5370
  readonly type: "tool-error";
3332
5371
  readonly name: string;
@@ -3337,8 +5376,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3337
5376
  readonly [x: string]: unknown;
3338
5377
  };
3339
5378
  } | undefined;
3340
- };
3341
- "step-finish": (u: unknown) => u is {
5379
+ } | {
3342
5380
  readonly type: "step-finish";
3343
5381
  readonly reason: {
3344
5382
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3351,8 +5389,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3351
5389
  };
3352
5390
  } | undefined;
3353
5391
  readonly usage?: Usage | undefined;
3354
- };
3355
- finish: (u: unknown) => u is {
5392
+ } | {
3356
5393
  readonly type: "finish";
3357
5394
  readonly reason: {
3358
5395
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3364,8 +5401,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3364
5401
  };
3365
5402
  } | undefined;
3366
5403
  readonly usage?: Usage | undefined;
3367
- };
3368
- "provider-error": (u: unknown) => u is {
5404
+ } | {
3369
5405
  readonly type: "provider-error";
3370
5406
  readonly message: string;
3371
5407
  readonly providerMetadata?: {
@@ -3374,15 +5410,15 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3374
5410
  };
3375
5411
  } | undefined;
3376
5412
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3377
- };
5413
+ }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
3378
5414
  };
3379
- readonly match: {
5415
+ readonly matchOrElse: {
3380
5416
  <Cases extends {
3381
- "step-start": (value: {
5417
+ "step-start"?: ((value: {
3382
5418
  readonly type: "step-start";
3383
5419
  readonly index: number;
3384
- }) => any;
3385
- "text-start": (value: {
5420
+ }) => any) | undefined;
5421
+ "text-start"?: ((value: {
3386
5422
  readonly id: string;
3387
5423
  readonly type: "text-start";
3388
5424
  readonly providerMetadata?: {
@@ -3390,8 +5426,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3390
5426
  readonly [x: string]: unknown;
3391
5427
  };
3392
5428
  } | undefined;
3393
- }) => any;
3394
- "text-delta": (value: {
5429
+ }) => any) | undefined;
5430
+ "text-delta"?: ((value: {
3395
5431
  readonly id: string;
3396
5432
  readonly type: "text-delta";
3397
5433
  readonly text: string;
@@ -3400,17 +5436,18 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3400
5436
  readonly [x: string]: unknown;
3401
5437
  };
3402
5438
  } | undefined;
3403
- }) => any;
3404
- "text-end": (value: {
5439
+ }) => any) | undefined;
5440
+ "text-end"?: ((value: {
3405
5441
  readonly id: string;
3406
5442
  readonly type: "text-end";
5443
+ readonly text?: string | undefined;
3407
5444
  readonly providerMetadata?: {
3408
5445
  readonly [x: string]: {
3409
5446
  readonly [x: string]: unknown;
3410
5447
  };
3411
5448
  } | undefined;
3412
- }) => any;
3413
- "reasoning-start": (value: {
5449
+ }) => any) | undefined;
5450
+ "reasoning-start"?: ((value: {
3414
5451
  readonly id: string;
3415
5452
  readonly type: "reasoning-start";
3416
5453
  readonly providerMetadata?: {
@@ -3418,8 +5455,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3418
5455
  readonly [x: string]: unknown;
3419
5456
  };
3420
5457
  } | undefined;
3421
- }) => any;
3422
- "reasoning-delta": (value: {
5458
+ }) => any) | undefined;
5459
+ "reasoning-delta"?: ((value: {
3423
5460
  readonly id: string;
3424
5461
  readonly type: "reasoning-delta";
3425
5462
  readonly text: string;
@@ -3428,17 +5465,18 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3428
5465
  readonly [x: string]: unknown;
3429
5466
  };
3430
5467
  } | undefined;
3431
- }) => any;
3432
- "reasoning-end": (value: {
5468
+ }) => any) | undefined;
5469
+ "reasoning-end"?: ((value: {
3433
5470
  readonly id: string;
3434
5471
  readonly type: "reasoning-end";
5472
+ readonly text?: string | undefined;
3435
5473
  readonly providerMetadata?: {
3436
5474
  readonly [x: string]: {
3437
5475
  readonly [x: string]: unknown;
3438
5476
  };
3439
5477
  } | undefined;
3440
- }) => any;
3441
- "tool-input-start": (value: {
5478
+ }) => any) | undefined;
5479
+ "tool-input-start"?: ((value: {
3442
5480
  readonly id: string;
3443
5481
  readonly type: "tool-input-start";
3444
5482
  readonly name: string;
@@ -3448,15 +5486,15 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3448
5486
  };
3449
5487
  } | undefined;
3450
5488
  readonly providerExecuted?: boolean | undefined;
3451
- }) => any;
3452
- "tool-input-delta": (value: {
5489
+ }) => any) | undefined;
5490
+ "tool-input-delta"?: ((value: {
3453
5491
  readonly id: string;
3454
5492
  readonly type: "tool-input-delta";
3455
5493
  readonly name: string;
3456
5494
  readonly text: string;
3457
5495
  readonly input?: unknown;
3458
- }) => any;
3459
- "tool-input-end": (value: {
5496
+ }) => any) | undefined;
5497
+ "tool-input-end"?: ((value: {
3460
5498
  readonly id: string;
3461
5499
  readonly type: "tool-input-end";
3462
5500
  readonly name: string;
@@ -3465,14 +5503,14 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3465
5503
  readonly [x: string]: unknown;
3466
5504
  };
3467
5505
  } | undefined;
3468
- }) => any;
3469
- "tool-input-error": (value: {
5506
+ }) => any) | undefined;
5507
+ "tool-input-error"?: ((value: {
3470
5508
  readonly type: "tool-input-error";
3471
5509
  readonly id: string;
3472
5510
  readonly name: string;
3473
5511
  readonly raw: string;
3474
- }) => any;
3475
- "tool-call": (value: {
5512
+ }) => any) | undefined;
5513
+ "tool-call"?: ((value: {
3476
5514
  readonly id: string;
3477
5515
  readonly type: "tool-call";
3478
5516
  readonly name: string;
@@ -3483,8 +5521,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3483
5521
  };
3484
5522
  } | undefined;
3485
5523
  readonly providerExecuted?: boolean | undefined;
3486
- }) => any;
3487
- "tool-result": (value: {
5524
+ }) => any) | undefined;
5525
+ "tool-result"?: ((value: {
3488
5526
  readonly id: string;
3489
5527
  readonly type: "tool-result";
3490
5528
  readonly name: string;
@@ -3527,8 +5565,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3527
5565
  };
3528
5566
  } | undefined;
3529
5567
  readonly providerExecuted?: boolean | undefined;
3530
- }) => any;
3531
- "tool-error": (value: {
5568
+ }) => any) | undefined;
5569
+ "tool-error"?: ((value: {
3532
5570
  readonly id: string;
3533
5571
  readonly type: "tool-error";
3534
5572
  readonly name: string;
@@ -3539,45 +5577,263 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3539
5577
  readonly [x: string]: unknown;
3540
5578
  };
3541
5579
  } | undefined;
3542
- }) => any;
3543
- "step-finish": (value: {
5580
+ }) => any) | undefined;
5581
+ "step-finish"?: ((value: {
3544
5582
  readonly type: "step-finish";
3545
5583
  readonly reason: {
3546
5584
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3547
5585
  readonly raw?: string | undefined;
3548
5586
  };
3549
- readonly index: number;
3550
- readonly providerMetadata?: {
3551
- readonly [x: string]: {
3552
- readonly [x: string]: unknown;
3553
- };
3554
- } | undefined;
3555
- readonly usage?: Usage | undefined;
3556
- }) => any;
3557
- finish: (value: {
3558
- readonly type: "finish";
3559
- readonly reason: {
3560
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3561
- readonly raw?: string | undefined;
5587
+ readonly index: number;
5588
+ readonly providerMetadata?: {
5589
+ readonly [x: string]: {
5590
+ readonly [x: string]: unknown;
5591
+ };
5592
+ } | undefined;
5593
+ readonly usage?: Usage | undefined;
5594
+ }) => any) | undefined;
5595
+ finish?: ((value: {
5596
+ readonly type: "finish";
5597
+ readonly reason: {
5598
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5599
+ readonly raw?: string | undefined;
5600
+ };
5601
+ readonly providerMetadata?: {
5602
+ readonly [x: string]: {
5603
+ readonly [x: string]: unknown;
5604
+ };
5605
+ } | undefined;
5606
+ readonly usage?: Usage | undefined;
5607
+ }) => any) | undefined;
5608
+ "provider-error"?: ((value: {
5609
+ readonly type: "provider-error";
5610
+ readonly message: string;
5611
+ readonly providerMetadata?: {
5612
+ readonly [x: string]: {
5613
+ readonly [x: string]: unknown;
5614
+ };
5615
+ } | undefined;
5616
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5617
+ }) => any) | undefined;
5618
+ } & { [K in Exclude<keyof Cases, "finish" | "tool-call" | "tool-result" | "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-error" | "step-finish" | "provider-error">]: never; }, OrElse extends (value: Exclude<{
5619
+ readonly type: "step-start";
5620
+ readonly index: number;
5621
+ }, {
5622
+ readonly type: keyof Cases;
5623
+ }> | Exclude<{
5624
+ readonly id: string;
5625
+ readonly type: "text-start";
5626
+ readonly providerMetadata?: {
5627
+ readonly [x: string]: {
5628
+ readonly [x: string]: unknown;
5629
+ };
5630
+ } | undefined;
5631
+ }, {
5632
+ readonly type: keyof Cases;
5633
+ }> | Exclude<{
5634
+ readonly id: string;
5635
+ readonly type: "text-delta";
5636
+ readonly text: string;
5637
+ readonly providerMetadata?: {
5638
+ readonly [x: string]: {
5639
+ readonly [x: string]: unknown;
5640
+ };
5641
+ } | undefined;
5642
+ }, {
5643
+ readonly type: keyof Cases;
5644
+ }> | Exclude<{
5645
+ readonly id: string;
5646
+ readonly type: "text-end";
5647
+ readonly text?: string | undefined;
5648
+ readonly providerMetadata?: {
5649
+ readonly [x: string]: {
5650
+ readonly [x: string]: unknown;
5651
+ };
5652
+ } | undefined;
5653
+ }, {
5654
+ readonly type: keyof Cases;
5655
+ }> | Exclude<{
5656
+ readonly id: string;
5657
+ readonly type: "reasoning-start";
5658
+ readonly providerMetadata?: {
5659
+ readonly [x: string]: {
5660
+ readonly [x: string]: unknown;
5661
+ };
5662
+ } | undefined;
5663
+ }, {
5664
+ readonly type: keyof Cases;
5665
+ }> | Exclude<{
5666
+ readonly id: string;
5667
+ readonly type: "reasoning-delta";
5668
+ readonly text: string;
5669
+ readonly providerMetadata?: {
5670
+ readonly [x: string]: {
5671
+ readonly [x: string]: unknown;
5672
+ };
5673
+ } | undefined;
5674
+ }, {
5675
+ readonly type: keyof Cases;
5676
+ }> | Exclude<{
5677
+ readonly id: string;
5678
+ readonly type: "reasoning-end";
5679
+ readonly text?: string | undefined;
5680
+ readonly providerMetadata?: {
5681
+ readonly [x: string]: {
5682
+ readonly [x: string]: unknown;
5683
+ };
5684
+ } | undefined;
5685
+ }, {
5686
+ readonly type: keyof Cases;
5687
+ }> | Exclude<{
5688
+ readonly id: string;
5689
+ readonly type: "tool-input-start";
5690
+ readonly name: string;
5691
+ readonly providerMetadata?: {
5692
+ readonly [x: string]: {
5693
+ readonly [x: string]: unknown;
5694
+ };
5695
+ } | undefined;
5696
+ readonly providerExecuted?: boolean | undefined;
5697
+ }, {
5698
+ readonly type: keyof Cases;
5699
+ }> | Exclude<{
5700
+ readonly id: string;
5701
+ readonly type: "tool-input-delta";
5702
+ readonly name: string;
5703
+ readonly text: string;
5704
+ readonly input?: unknown;
5705
+ }, {
5706
+ readonly type: keyof Cases;
5707
+ }> | Exclude<{
5708
+ readonly id: string;
5709
+ readonly type: "tool-input-end";
5710
+ readonly name: string;
5711
+ readonly providerMetadata?: {
5712
+ readonly [x: string]: {
5713
+ readonly [x: string]: unknown;
5714
+ };
5715
+ } | undefined;
5716
+ }, {
5717
+ readonly type: keyof Cases;
5718
+ }> | Exclude<{
5719
+ readonly type: "tool-input-error";
5720
+ readonly id: string;
5721
+ readonly name: string;
5722
+ readonly raw: string;
5723
+ }, {
5724
+ readonly type: keyof Cases;
5725
+ }> | Exclude<{
5726
+ readonly id: string;
5727
+ readonly type: "tool-call";
5728
+ readonly name: string;
5729
+ readonly input: unknown;
5730
+ readonly providerMetadata?: {
5731
+ readonly [x: string]: {
5732
+ readonly [x: string]: unknown;
5733
+ };
5734
+ } | undefined;
5735
+ readonly providerExecuted?: boolean | undefined;
5736
+ }, {
5737
+ readonly type: keyof Cases;
5738
+ }> | Exclude<{
5739
+ readonly id: string;
5740
+ readonly type: "tool-result";
5741
+ readonly name: string;
5742
+ readonly result: {
5743
+ readonly type: "json";
5744
+ readonly value: unknown;
5745
+ } | {
5746
+ readonly type: "text";
5747
+ readonly value: unknown;
5748
+ } | {
5749
+ readonly type: "error";
5750
+ readonly value: unknown;
5751
+ } | {
5752
+ readonly type: "content";
5753
+ readonly value: readonly ({
5754
+ readonly type: "text";
5755
+ readonly text: string;
5756
+ } | {
5757
+ readonly type: "file";
5758
+ readonly uri: string;
5759
+ readonly mime: string;
5760
+ readonly name?: string | undefined;
5761
+ })[];
5762
+ };
5763
+ readonly output?: {
5764
+ readonly structured: unknown;
5765
+ readonly content: readonly ({
5766
+ readonly type: "text";
5767
+ readonly text: string;
5768
+ } | {
5769
+ readonly type: "file";
5770
+ readonly uri: string;
5771
+ readonly mime: string;
5772
+ readonly name?: string | undefined;
5773
+ })[];
5774
+ } | undefined;
5775
+ readonly providerMetadata?: {
5776
+ readonly [x: string]: {
5777
+ readonly [x: string]: unknown;
5778
+ };
5779
+ } | undefined;
5780
+ readonly providerExecuted?: boolean | undefined;
5781
+ }, {
5782
+ readonly type: keyof Cases;
5783
+ }> | Exclude<{
5784
+ readonly id: string;
5785
+ readonly type: "tool-error";
5786
+ readonly name: string;
5787
+ readonly message: string;
5788
+ readonly error?: unknown;
5789
+ readonly providerMetadata?: {
5790
+ readonly [x: string]: {
5791
+ readonly [x: string]: unknown;
5792
+ };
5793
+ } | undefined;
5794
+ }, {
5795
+ readonly type: keyof Cases;
5796
+ }> | Exclude<{
5797
+ readonly type: "step-finish";
5798
+ readonly reason: {
5799
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5800
+ readonly raw?: string | undefined;
5801
+ };
5802
+ readonly index: number;
5803
+ readonly providerMetadata?: {
5804
+ readonly [x: string]: {
5805
+ readonly [x: string]: unknown;
5806
+ };
5807
+ } | undefined;
5808
+ readonly usage?: Usage | undefined;
5809
+ }, {
5810
+ readonly type: keyof Cases;
5811
+ }> | Exclude<{
5812
+ readonly type: "finish";
5813
+ readonly reason: {
5814
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5815
+ readonly raw?: string | undefined;
5816
+ };
5817
+ readonly providerMetadata?: {
5818
+ readonly [x: string]: {
5819
+ readonly [x: string]: unknown;
3562
5820
  };
3563
- readonly providerMetadata?: {
3564
- readonly [x: string]: {
3565
- readonly [x: string]: unknown;
3566
- };
3567
- } | undefined;
3568
- readonly usage?: Usage | undefined;
3569
- }) => any;
3570
- "provider-error": (value: {
3571
- readonly type: "provider-error";
3572
- readonly message: string;
3573
- readonly providerMetadata?: {
3574
- readonly [x: string]: {
3575
- readonly [x: string]: unknown;
3576
- };
3577
- } | undefined;
3578
- readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3579
- }) => any;
3580
- }>(value: {
5821
+ } | undefined;
5822
+ readonly usage?: Usage | undefined;
5823
+ }, {
5824
+ readonly type: keyof Cases;
5825
+ }> | Exclude<{
5826
+ readonly type: "provider-error";
5827
+ readonly message: string;
5828
+ readonly providerMetadata?: {
5829
+ readonly [x: string]: {
5830
+ readonly [x: string]: unknown;
5831
+ };
5832
+ } | undefined;
5833
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5834
+ }, {
5835
+ readonly type: keyof Cases;
5836
+ }>) => any>(value: {
3581
5837
  readonly type: "step-start";
3582
5838
  readonly index: number;
3583
5839
  } | {
@@ -3600,6 +5856,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3600
5856
  } | {
3601
5857
  readonly id: string;
3602
5858
  readonly type: "text-end";
5859
+ readonly text?: string | undefined;
3603
5860
  readonly providerMetadata?: {
3604
5861
  readonly [x: string]: {
3605
5862
  readonly [x: string]: unknown;
@@ -3625,6 +5882,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3625
5882
  } | {
3626
5883
  readonly id: string;
3627
5884
  readonly type: "reasoning-end";
5885
+ readonly text?: string | undefined;
3628
5886
  readonly providerMetadata?: {
3629
5887
  readonly [x: string]: {
3630
5888
  readonly [x: string]: unknown;
@@ -3759,13 +6017,13 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3759
6017
  };
3760
6018
  } | undefined;
3761
6019
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3762
- }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
6020
+ }, cases: Cases, orElse: OrElse): import("effect/Unify").Unify<{ [K_1 in keyof Cases]-?: NonNullable<Cases[K_1]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
3763
6021
  <Cases extends {
3764
- "step-start": (value: {
6022
+ "step-start"?: ((value: {
3765
6023
  readonly type: "step-start";
3766
6024
  readonly index: number;
3767
- }) => any;
3768
- "text-start": (value: {
6025
+ }) => any) | undefined;
6026
+ "text-start"?: ((value: {
3769
6027
  readonly id: string;
3770
6028
  readonly type: "text-start";
3771
6029
  readonly providerMetadata?: {
@@ -3773,8 +6031,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3773
6031
  readonly [x: string]: unknown;
3774
6032
  };
3775
6033
  } | undefined;
3776
- }) => any;
3777
- "text-delta": (value: {
6034
+ }) => any) | undefined;
6035
+ "text-delta"?: ((value: {
3778
6036
  readonly id: string;
3779
6037
  readonly type: "text-delta";
3780
6038
  readonly text: string;
@@ -3783,17 +6041,18 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3783
6041
  readonly [x: string]: unknown;
3784
6042
  };
3785
6043
  } | undefined;
3786
- }) => any;
3787
- "text-end": (value: {
6044
+ }) => any) | undefined;
6045
+ "text-end"?: ((value: {
3788
6046
  readonly id: string;
3789
6047
  readonly type: "text-end";
6048
+ readonly text?: string | undefined;
3790
6049
  readonly providerMetadata?: {
3791
6050
  readonly [x: string]: {
3792
6051
  readonly [x: string]: unknown;
3793
6052
  };
3794
6053
  } | undefined;
3795
- }) => any;
3796
- "reasoning-start": (value: {
6054
+ }) => any) | undefined;
6055
+ "reasoning-start"?: ((value: {
3797
6056
  readonly id: string;
3798
6057
  readonly type: "reasoning-start";
3799
6058
  readonly providerMetadata?: {
@@ -3801,8 +6060,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3801
6060
  readonly [x: string]: unknown;
3802
6061
  };
3803
6062
  } | undefined;
3804
- }) => any;
3805
- "reasoning-delta": (value: {
6063
+ }) => any) | undefined;
6064
+ "reasoning-delta"?: ((value: {
3806
6065
  readonly id: string;
3807
6066
  readonly type: "reasoning-delta";
3808
6067
  readonly text: string;
@@ -3811,17 +6070,18 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3811
6070
  readonly [x: string]: unknown;
3812
6071
  };
3813
6072
  } | undefined;
3814
- }) => any;
3815
- "reasoning-end": (value: {
6073
+ }) => any) | undefined;
6074
+ "reasoning-end"?: ((value: {
3816
6075
  readonly id: string;
3817
6076
  readonly type: "reasoning-end";
6077
+ readonly text?: string | undefined;
3818
6078
  readonly providerMetadata?: {
3819
6079
  readonly [x: string]: {
3820
6080
  readonly [x: string]: unknown;
3821
6081
  };
3822
6082
  } | undefined;
3823
- }) => any;
3824
- "tool-input-start": (value: {
6083
+ }) => any) | undefined;
6084
+ "tool-input-start"?: ((value: {
3825
6085
  readonly id: string;
3826
6086
  readonly type: "tool-input-start";
3827
6087
  readonly name: string;
@@ -3831,15 +6091,15 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3831
6091
  };
3832
6092
  } | undefined;
3833
6093
  readonly providerExecuted?: boolean | undefined;
3834
- }) => any;
3835
- "tool-input-delta": (value: {
6094
+ }) => any) | undefined;
6095
+ "tool-input-delta"?: ((value: {
3836
6096
  readonly id: string;
3837
6097
  readonly type: "tool-input-delta";
3838
6098
  readonly name: string;
3839
6099
  readonly text: string;
3840
6100
  readonly input?: unknown;
3841
- }) => any;
3842
- "tool-input-end": (value: {
6101
+ }) => any) | undefined;
6102
+ "tool-input-end"?: ((value: {
3843
6103
  readonly id: string;
3844
6104
  readonly type: "tool-input-end";
3845
6105
  readonly name: string;
@@ -3848,14 +6108,14 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3848
6108
  readonly [x: string]: unknown;
3849
6109
  };
3850
6110
  } | undefined;
3851
- }) => any;
3852
- "tool-input-error": (value: {
6111
+ }) => any) | undefined;
6112
+ "tool-input-error"?: ((value: {
3853
6113
  readonly type: "tool-input-error";
3854
6114
  readonly id: string;
3855
6115
  readonly name: string;
3856
6116
  readonly raw: string;
3857
- }) => any;
3858
- "tool-call": (value: {
6117
+ }) => any) | undefined;
6118
+ "tool-call"?: ((value: {
3859
6119
  readonly id: string;
3860
6120
  readonly type: "tool-call";
3861
6121
  readonly name: string;
@@ -3866,8 +6126,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3866
6126
  };
3867
6127
  } | undefined;
3868
6128
  readonly providerExecuted?: boolean | undefined;
3869
- }) => any;
3870
- "tool-result": (value: {
6129
+ }) => any) | undefined;
6130
+ "tool-result"?: ((value: {
3871
6131
  readonly id: string;
3872
6132
  readonly type: "tool-result";
3873
6133
  readonly name: string;
@@ -3910,8 +6170,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3910
6170
  };
3911
6171
  } | undefined;
3912
6172
  readonly providerExecuted?: boolean | undefined;
3913
- }) => any;
3914
- "tool-error": (value: {
6173
+ }) => any) | undefined;
6174
+ "tool-error"?: ((value: {
3915
6175
  readonly id: string;
3916
6176
  readonly type: "tool-error";
3917
6177
  readonly name: string;
@@ -3922,8 +6182,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3922
6182
  readonly [x: string]: unknown;
3923
6183
  };
3924
6184
  } | undefined;
3925
- }) => any;
3926
- "step-finish": (value: {
6185
+ }) => any) | undefined;
6186
+ "step-finish"?: ((value: {
3927
6187
  readonly type: "step-finish";
3928
6188
  readonly reason: {
3929
6189
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3936,8 +6196,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3936
6196
  };
3937
6197
  } | undefined;
3938
6198
  readonly usage?: Usage | undefined;
3939
- }) => any;
3940
- finish: (value: {
6199
+ }) => any) | undefined;
6200
+ finish?: ((value: {
3941
6201
  readonly type: "finish";
3942
6202
  readonly reason: {
3943
6203
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3949,8 +6209,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3949
6209
  };
3950
6210
  } | undefined;
3951
6211
  readonly usage?: Usage | undefined;
3952
- }) => any;
3953
- "provider-error": (value: {
6212
+ }) => any) | undefined;
6213
+ "provider-error"?: ((value: {
3954
6214
  readonly type: "provider-error";
3955
6215
  readonly message: string;
3956
6216
  readonly providerMetadata?: {
@@ -3959,8 +6219,226 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3959
6219
  };
3960
6220
  } | undefined;
3961
6221
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3962
- }) => any;
3963
- }>(cases: Cases): (value: {
6222
+ }) => any) | undefined;
6223
+ } & { [K in Exclude<keyof Cases, "finish" | "tool-call" | "tool-result" | "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-error" | "step-finish" | "provider-error">]: never; }, OrElse extends (value: Exclude<{
6224
+ readonly type: "step-start";
6225
+ readonly index: number;
6226
+ }, {
6227
+ readonly type: keyof Cases;
6228
+ }> | Exclude<{
6229
+ readonly id: string;
6230
+ readonly type: "text-start";
6231
+ readonly providerMetadata?: {
6232
+ readonly [x: string]: {
6233
+ readonly [x: string]: unknown;
6234
+ };
6235
+ } | undefined;
6236
+ }, {
6237
+ readonly type: keyof Cases;
6238
+ }> | Exclude<{
6239
+ readonly id: string;
6240
+ readonly type: "text-delta";
6241
+ readonly text: string;
6242
+ readonly providerMetadata?: {
6243
+ readonly [x: string]: {
6244
+ readonly [x: string]: unknown;
6245
+ };
6246
+ } | undefined;
6247
+ }, {
6248
+ readonly type: keyof Cases;
6249
+ }> | Exclude<{
6250
+ readonly id: string;
6251
+ readonly type: "text-end";
6252
+ readonly text?: string | undefined;
6253
+ readonly providerMetadata?: {
6254
+ readonly [x: string]: {
6255
+ readonly [x: string]: unknown;
6256
+ };
6257
+ } | undefined;
6258
+ }, {
6259
+ readonly type: keyof Cases;
6260
+ }> | Exclude<{
6261
+ readonly id: string;
6262
+ readonly type: "reasoning-start";
6263
+ readonly providerMetadata?: {
6264
+ readonly [x: string]: {
6265
+ readonly [x: string]: unknown;
6266
+ };
6267
+ } | undefined;
6268
+ }, {
6269
+ readonly type: keyof Cases;
6270
+ }> | Exclude<{
6271
+ readonly id: string;
6272
+ readonly type: "reasoning-delta";
6273
+ readonly text: string;
6274
+ readonly providerMetadata?: {
6275
+ readonly [x: string]: {
6276
+ readonly [x: string]: unknown;
6277
+ };
6278
+ } | undefined;
6279
+ }, {
6280
+ readonly type: keyof Cases;
6281
+ }> | Exclude<{
6282
+ readonly id: string;
6283
+ readonly type: "reasoning-end";
6284
+ readonly text?: string | undefined;
6285
+ readonly providerMetadata?: {
6286
+ readonly [x: string]: {
6287
+ readonly [x: string]: unknown;
6288
+ };
6289
+ } | undefined;
6290
+ }, {
6291
+ readonly type: keyof Cases;
6292
+ }> | Exclude<{
6293
+ readonly id: string;
6294
+ readonly type: "tool-input-start";
6295
+ readonly name: string;
6296
+ readonly providerMetadata?: {
6297
+ readonly [x: string]: {
6298
+ readonly [x: string]: unknown;
6299
+ };
6300
+ } | undefined;
6301
+ readonly providerExecuted?: boolean | undefined;
6302
+ }, {
6303
+ readonly type: keyof Cases;
6304
+ }> | Exclude<{
6305
+ readonly id: string;
6306
+ readonly type: "tool-input-delta";
6307
+ readonly name: string;
6308
+ readonly text: string;
6309
+ readonly input?: unknown;
6310
+ }, {
6311
+ readonly type: keyof Cases;
6312
+ }> | Exclude<{
6313
+ readonly id: string;
6314
+ readonly type: "tool-input-end";
6315
+ readonly name: string;
6316
+ readonly providerMetadata?: {
6317
+ readonly [x: string]: {
6318
+ readonly [x: string]: unknown;
6319
+ };
6320
+ } | undefined;
6321
+ }, {
6322
+ readonly type: keyof Cases;
6323
+ }> | Exclude<{
6324
+ readonly type: "tool-input-error";
6325
+ readonly id: string;
6326
+ readonly name: string;
6327
+ readonly raw: string;
6328
+ }, {
6329
+ readonly type: keyof Cases;
6330
+ }> | Exclude<{
6331
+ readonly id: string;
6332
+ readonly type: "tool-call";
6333
+ readonly name: string;
6334
+ readonly input: unknown;
6335
+ readonly providerMetadata?: {
6336
+ readonly [x: string]: {
6337
+ readonly [x: string]: unknown;
6338
+ };
6339
+ } | undefined;
6340
+ readonly providerExecuted?: boolean | undefined;
6341
+ }, {
6342
+ readonly type: keyof Cases;
6343
+ }> | Exclude<{
6344
+ readonly id: string;
6345
+ readonly type: "tool-result";
6346
+ readonly name: string;
6347
+ readonly result: {
6348
+ readonly type: "json";
6349
+ readonly value: unknown;
6350
+ } | {
6351
+ readonly type: "text";
6352
+ readonly value: unknown;
6353
+ } | {
6354
+ readonly type: "error";
6355
+ readonly value: unknown;
6356
+ } | {
6357
+ readonly type: "content";
6358
+ readonly value: readonly ({
6359
+ readonly type: "text";
6360
+ readonly text: string;
6361
+ } | {
6362
+ readonly type: "file";
6363
+ readonly uri: string;
6364
+ readonly mime: string;
6365
+ readonly name?: string | undefined;
6366
+ })[];
6367
+ };
6368
+ readonly output?: {
6369
+ readonly structured: unknown;
6370
+ readonly content: readonly ({
6371
+ readonly type: "text";
6372
+ readonly text: string;
6373
+ } | {
6374
+ readonly type: "file";
6375
+ readonly uri: string;
6376
+ readonly mime: string;
6377
+ readonly name?: string | undefined;
6378
+ })[];
6379
+ } | undefined;
6380
+ readonly providerMetadata?: {
6381
+ readonly [x: string]: {
6382
+ readonly [x: string]: unknown;
6383
+ };
6384
+ } | undefined;
6385
+ readonly providerExecuted?: boolean | undefined;
6386
+ }, {
6387
+ readonly type: keyof Cases;
6388
+ }> | Exclude<{
6389
+ readonly id: string;
6390
+ readonly type: "tool-error";
6391
+ readonly name: string;
6392
+ readonly message: string;
6393
+ readonly error?: unknown;
6394
+ readonly providerMetadata?: {
6395
+ readonly [x: string]: {
6396
+ readonly [x: string]: unknown;
6397
+ };
6398
+ } | undefined;
6399
+ }, {
6400
+ readonly type: keyof Cases;
6401
+ }> | Exclude<{
6402
+ readonly type: "step-finish";
6403
+ readonly reason: {
6404
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
6405
+ readonly raw?: string | undefined;
6406
+ };
6407
+ readonly index: number;
6408
+ readonly providerMetadata?: {
6409
+ readonly [x: string]: {
6410
+ readonly [x: string]: unknown;
6411
+ };
6412
+ } | undefined;
6413
+ readonly usage?: Usage | undefined;
6414
+ }, {
6415
+ readonly type: keyof Cases;
6416
+ }> | Exclude<{
6417
+ readonly type: "finish";
6418
+ readonly reason: {
6419
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
6420
+ readonly raw?: string | undefined;
6421
+ };
6422
+ readonly providerMetadata?: {
6423
+ readonly [x: string]: {
6424
+ readonly [x: string]: unknown;
6425
+ };
6426
+ } | undefined;
6427
+ readonly usage?: Usage | undefined;
6428
+ }, {
6429
+ readonly type: keyof Cases;
6430
+ }> | Exclude<{
6431
+ readonly type: "provider-error";
6432
+ readonly message: string;
6433
+ readonly providerMetadata?: {
6434
+ readonly [x: string]: {
6435
+ readonly [x: string]: unknown;
6436
+ };
6437
+ } | undefined;
6438
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
6439
+ }, {
6440
+ readonly type: keyof Cases;
6441
+ }>) => any>(cases: Cases, orElse: OrElse): (value: {
3964
6442
  readonly type: "step-start";
3965
6443
  readonly index: number;
3966
6444
  } | {
@@ -3983,6 +6461,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3983
6461
  } | {
3984
6462
  readonly id: string;
3985
6463
  readonly type: "text-end";
6464
+ readonly text?: string | undefined;
3986
6465
  readonly providerMetadata?: {
3987
6466
  readonly [x: string]: {
3988
6467
  readonly [x: string]: unknown;
@@ -4008,6 +6487,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4008
6487
  } | {
4009
6488
  readonly id: string;
4010
6489
  readonly type: "reasoning-end";
6490
+ readonly text?: string | undefined;
4011
6491
  readonly providerMetadata?: {
4012
6492
  readonly [x: string]: {
4013
6493
  readonly [x: string]: unknown;
@@ -4142,7 +6622,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4142
6622
  };
4143
6623
  } | undefined;
4144
6624
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4145
- }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
6625
+ }) => import("effect/Unify").Unify<{ [K_1 in keyof Cases]-?: NonNullable<Cases[K_1]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
4146
6626
  };
4147
6627
  } & {
4148
6628
  stepStart: (input: {
@@ -4174,6 +6654,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4174
6654
  textEnd: (input: WithID<TextEnd, ContentBlockID>) => {
4175
6655
  readonly id: string;
4176
6656
  readonly type: "text-end";
6657
+ readonly text?: string | undefined;
4177
6658
  readonly providerMetadata?: {
4178
6659
  readonly [x: string]: {
4179
6660
  readonly [x: string]: unknown;
@@ -4202,6 +6683,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4202
6683
  reasoningEnd: (input: WithID<ReasoningEnd, ContentBlockID>) => {
4203
6684
  readonly id: string;
4204
6685
  readonly type: "reasoning-end";
6686
+ readonly text?: string | undefined;
4205
6687
  readonly providerMetadata?: {
4206
6688
  readonly [x: string]: {
4207
6689
  readonly [x: string]: unknown;
@@ -4383,6 +6865,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4383
6865
  textEnd: (u: unknown) => u is {
4384
6866
  readonly id: string;
4385
6867
  readonly type: "text-end";
6868
+ readonly text?: string | undefined;
4386
6869
  readonly providerMetadata?: {
4387
6870
  readonly [x: string]: {
4388
6871
  readonly [x: string]: unknown;
@@ -4411,6 +6894,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4411
6894
  reasoningEnd: (u: unknown) => u is {
4412
6895
  readonly id: string;
4413
6896
  readonly type: "reasoning-end";
6897
+ readonly text?: string | undefined;
4414
6898
  readonly providerMetadata?: {
4415
6899
  readonly [x: string]: {
4416
6900
  readonly [x: string]: unknown;
@@ -4565,9 +7049,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4565
7049
  }>;
4566
7050
  }>, {}>;
4567
7051
  export declare class LLMResponse extends LLMResponse_base {
4568
- /** Concatenated assistant text assembled from streamed `text-delta` events. */
7052
+ /** Concatenated assistant text; each fragment's `text-end` value replaces its accumulated deltas when present. */
4569
7053
  get text(): string;
4570
- /** Concatenated reasoning text assembled from streamed `reasoning-delta` events. */
7054
+ /** Concatenated reasoning text; each fragment's `reasoning-end` value replaces its accumulated deltas when present. */
4571
7055
  get reasoning(): string;
4572
7056
  /** Completed tool calls emitted by the provider. */
4573
7057
  get toolCalls(): {