@opencode-ai/ai 0.0.0-dev-18534 → 0.0.0-dev-18535

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 (2) hide show
  1. package/dist/schema/events.d.ts +2749 -349
  2. package/package.json +5 -5
@@ -2051,6 +2051,1206 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
2051
2051
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2052
2052
  }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
2053
2053
  };
2054
+ readonly matchOrElse: {
2055
+ <Cases extends {
2056
+ "step-start"?: ((value: {
2057
+ readonly type: "step-start";
2058
+ readonly index: number;
2059
+ }) => any) | undefined;
2060
+ "text-start"?: ((value: {
2061
+ readonly id: string;
2062
+ readonly type: "text-start";
2063
+ readonly providerMetadata?: {
2064
+ readonly [x: string]: {
2065
+ readonly [x: string]: unknown;
2066
+ };
2067
+ } | undefined;
2068
+ }) => any) | undefined;
2069
+ "text-delta"?: ((value: {
2070
+ readonly id: string;
2071
+ readonly type: "text-delta";
2072
+ readonly text: string;
2073
+ readonly providerMetadata?: {
2074
+ readonly [x: string]: {
2075
+ readonly [x: string]: unknown;
2076
+ };
2077
+ } | undefined;
2078
+ }) => any) | undefined;
2079
+ "text-end"?: ((value: {
2080
+ readonly id: string;
2081
+ readonly type: "text-end";
2082
+ readonly providerMetadata?: {
2083
+ readonly [x: string]: {
2084
+ readonly [x: string]: unknown;
2085
+ };
2086
+ } | undefined;
2087
+ }) => any) | undefined;
2088
+ "reasoning-start"?: ((value: {
2089
+ readonly id: string;
2090
+ readonly type: "reasoning-start";
2091
+ readonly providerMetadata?: {
2092
+ readonly [x: string]: {
2093
+ readonly [x: string]: unknown;
2094
+ };
2095
+ } | undefined;
2096
+ }) => any) | undefined;
2097
+ "reasoning-delta"?: ((value: {
2098
+ readonly id: string;
2099
+ readonly type: "reasoning-delta";
2100
+ readonly text: string;
2101
+ readonly providerMetadata?: {
2102
+ readonly [x: string]: {
2103
+ readonly [x: string]: unknown;
2104
+ };
2105
+ } | undefined;
2106
+ }) => any) | undefined;
2107
+ "reasoning-end"?: ((value: {
2108
+ readonly id: string;
2109
+ readonly type: "reasoning-end";
2110
+ readonly providerMetadata?: {
2111
+ readonly [x: string]: {
2112
+ readonly [x: string]: unknown;
2113
+ };
2114
+ } | undefined;
2115
+ }) => any) | undefined;
2116
+ "tool-input-start"?: ((value: {
2117
+ readonly id: string;
2118
+ readonly type: "tool-input-start";
2119
+ readonly name: string;
2120
+ readonly providerMetadata?: {
2121
+ readonly [x: string]: {
2122
+ readonly [x: string]: unknown;
2123
+ };
2124
+ } | undefined;
2125
+ readonly providerExecuted?: boolean | undefined;
2126
+ }) => any) | undefined;
2127
+ "tool-input-delta"?: ((value: {
2128
+ readonly id: string;
2129
+ readonly type: "tool-input-delta";
2130
+ readonly name: string;
2131
+ readonly text: string;
2132
+ readonly input?: unknown;
2133
+ }) => any) | undefined;
2134
+ "tool-input-end"?: ((value: {
2135
+ readonly id: string;
2136
+ readonly type: "tool-input-end";
2137
+ readonly name: string;
2138
+ readonly providerMetadata?: {
2139
+ readonly [x: string]: {
2140
+ readonly [x: string]: unknown;
2141
+ };
2142
+ } | undefined;
2143
+ }) => any) | undefined;
2144
+ "tool-input-error"?: ((value: {
2145
+ readonly type: "tool-input-error";
2146
+ readonly id: string;
2147
+ readonly name: string;
2148
+ readonly raw: string;
2149
+ }) => any) | undefined;
2150
+ "tool-call"?: ((value: {
2151
+ readonly id: string;
2152
+ readonly type: "tool-call";
2153
+ readonly name: string;
2154
+ readonly input: unknown;
2155
+ readonly providerMetadata?: {
2156
+ readonly [x: string]: {
2157
+ readonly [x: string]: unknown;
2158
+ };
2159
+ } | undefined;
2160
+ readonly providerExecuted?: boolean | undefined;
2161
+ }) => any) | undefined;
2162
+ "tool-result"?: ((value: {
2163
+ readonly id: string;
2164
+ readonly type: "tool-result";
2165
+ readonly name: string;
2166
+ readonly result: {
2167
+ readonly type: "json";
2168
+ readonly value: unknown;
2169
+ } | {
2170
+ readonly type: "text";
2171
+ readonly value: unknown;
2172
+ } | {
2173
+ readonly type: "error";
2174
+ readonly value: unknown;
2175
+ } | {
2176
+ readonly type: "content";
2177
+ readonly value: readonly ({
2178
+ readonly type: "text";
2179
+ readonly text: string;
2180
+ } | {
2181
+ readonly type: "file";
2182
+ readonly uri: string;
2183
+ readonly mime: string;
2184
+ readonly name?: string | undefined;
2185
+ })[];
2186
+ };
2187
+ readonly output?: {
2188
+ readonly structured: unknown;
2189
+ readonly content: readonly ({
2190
+ readonly type: "text";
2191
+ readonly text: string;
2192
+ } | {
2193
+ readonly type: "file";
2194
+ readonly uri: string;
2195
+ readonly mime: string;
2196
+ readonly name?: string | undefined;
2197
+ })[];
2198
+ } | undefined;
2199
+ readonly providerMetadata?: {
2200
+ readonly [x: string]: {
2201
+ readonly [x: string]: unknown;
2202
+ };
2203
+ } | undefined;
2204
+ readonly providerExecuted?: boolean | undefined;
2205
+ }) => any) | undefined;
2206
+ "tool-error"?: ((value: {
2207
+ readonly id: string;
2208
+ readonly type: "tool-error";
2209
+ readonly name: string;
2210
+ readonly message: string;
2211
+ readonly error?: unknown;
2212
+ readonly providerMetadata?: {
2213
+ readonly [x: string]: {
2214
+ readonly [x: string]: unknown;
2215
+ };
2216
+ } | undefined;
2217
+ }) => any) | undefined;
2218
+ "step-finish"?: ((value: {
2219
+ readonly type: "step-finish";
2220
+ readonly reason: {
2221
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2222
+ readonly raw?: string | undefined;
2223
+ };
2224
+ readonly index: number;
2225
+ readonly providerMetadata?: {
2226
+ readonly [x: string]: {
2227
+ readonly [x: string]: unknown;
2228
+ };
2229
+ } | undefined;
2230
+ readonly usage?: Usage | undefined;
2231
+ }) => any) | undefined;
2232
+ finish?: ((value: {
2233
+ readonly type: "finish";
2234
+ readonly reason: {
2235
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2236
+ readonly raw?: string | undefined;
2237
+ };
2238
+ readonly providerMetadata?: {
2239
+ readonly [x: string]: {
2240
+ readonly [x: string]: unknown;
2241
+ };
2242
+ } | undefined;
2243
+ readonly usage?: Usage | undefined;
2244
+ }) => any) | undefined;
2245
+ "provider-error"?: ((value: {
2246
+ readonly type: "provider-error";
2247
+ readonly message: string;
2248
+ readonly providerMetadata?: {
2249
+ readonly [x: string]: {
2250
+ readonly [x: string]: unknown;
2251
+ };
2252
+ } | undefined;
2253
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2254
+ }) => any) | undefined;
2255
+ } & { [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<{
2256
+ readonly type: "step-start";
2257
+ readonly index: number;
2258
+ }, {
2259
+ readonly type: keyof Cases;
2260
+ }> | Exclude<{
2261
+ readonly id: string;
2262
+ readonly type: "text-start";
2263
+ readonly providerMetadata?: {
2264
+ readonly [x: string]: {
2265
+ readonly [x: string]: unknown;
2266
+ };
2267
+ } | undefined;
2268
+ }, {
2269
+ readonly type: keyof Cases;
2270
+ }> | Exclude<{
2271
+ readonly id: string;
2272
+ readonly type: "text-delta";
2273
+ readonly text: string;
2274
+ readonly providerMetadata?: {
2275
+ readonly [x: string]: {
2276
+ readonly [x: string]: unknown;
2277
+ };
2278
+ } | undefined;
2279
+ }, {
2280
+ readonly type: keyof Cases;
2281
+ }> | Exclude<{
2282
+ readonly id: string;
2283
+ readonly type: "text-end";
2284
+ readonly providerMetadata?: {
2285
+ readonly [x: string]: {
2286
+ readonly [x: string]: unknown;
2287
+ };
2288
+ } | undefined;
2289
+ }, {
2290
+ readonly type: keyof Cases;
2291
+ }> | Exclude<{
2292
+ readonly id: string;
2293
+ readonly type: "reasoning-start";
2294
+ readonly providerMetadata?: {
2295
+ readonly [x: string]: {
2296
+ readonly [x: string]: unknown;
2297
+ };
2298
+ } | undefined;
2299
+ }, {
2300
+ readonly type: keyof Cases;
2301
+ }> | Exclude<{
2302
+ readonly id: string;
2303
+ readonly type: "reasoning-delta";
2304
+ readonly text: string;
2305
+ readonly providerMetadata?: {
2306
+ readonly [x: string]: {
2307
+ readonly [x: string]: unknown;
2308
+ };
2309
+ } | undefined;
2310
+ }, {
2311
+ readonly type: keyof Cases;
2312
+ }> | Exclude<{
2313
+ readonly id: string;
2314
+ readonly type: "reasoning-end";
2315
+ readonly providerMetadata?: {
2316
+ readonly [x: string]: {
2317
+ readonly [x: string]: unknown;
2318
+ };
2319
+ } | undefined;
2320
+ }, {
2321
+ readonly type: keyof Cases;
2322
+ }> | Exclude<{
2323
+ readonly id: string;
2324
+ readonly type: "tool-input-start";
2325
+ readonly name: string;
2326
+ readonly providerMetadata?: {
2327
+ readonly [x: string]: {
2328
+ readonly [x: string]: unknown;
2329
+ };
2330
+ } | undefined;
2331
+ readonly providerExecuted?: boolean | undefined;
2332
+ }, {
2333
+ readonly type: keyof Cases;
2334
+ }> | Exclude<{
2335
+ readonly id: string;
2336
+ readonly type: "tool-input-delta";
2337
+ readonly name: string;
2338
+ readonly text: string;
2339
+ readonly input?: unknown;
2340
+ }, {
2341
+ readonly type: keyof Cases;
2342
+ }> | Exclude<{
2343
+ readonly id: string;
2344
+ readonly type: "tool-input-end";
2345
+ readonly name: string;
2346
+ readonly providerMetadata?: {
2347
+ readonly [x: string]: {
2348
+ readonly [x: string]: unknown;
2349
+ };
2350
+ } | undefined;
2351
+ }, {
2352
+ readonly type: keyof Cases;
2353
+ }> | Exclude<{
2354
+ readonly type: "tool-input-error";
2355
+ readonly id: string;
2356
+ readonly name: string;
2357
+ readonly raw: string;
2358
+ }, {
2359
+ readonly type: keyof Cases;
2360
+ }> | Exclude<{
2361
+ readonly id: string;
2362
+ readonly type: "tool-call";
2363
+ readonly name: string;
2364
+ readonly input: unknown;
2365
+ readonly providerMetadata?: {
2366
+ readonly [x: string]: {
2367
+ readonly [x: string]: unknown;
2368
+ };
2369
+ } | undefined;
2370
+ readonly providerExecuted?: boolean | undefined;
2371
+ }, {
2372
+ readonly type: keyof Cases;
2373
+ }> | Exclude<{
2374
+ readonly id: string;
2375
+ readonly type: "tool-result";
2376
+ readonly name: string;
2377
+ readonly result: {
2378
+ readonly type: "json";
2379
+ readonly value: unknown;
2380
+ } | {
2381
+ readonly type: "text";
2382
+ readonly value: unknown;
2383
+ } | {
2384
+ readonly type: "error";
2385
+ readonly value: unknown;
2386
+ } | {
2387
+ readonly type: "content";
2388
+ readonly value: readonly ({
2389
+ readonly type: "text";
2390
+ readonly text: string;
2391
+ } | {
2392
+ readonly type: "file";
2393
+ readonly uri: string;
2394
+ readonly mime: string;
2395
+ readonly name?: string | undefined;
2396
+ })[];
2397
+ };
2398
+ readonly output?: {
2399
+ readonly structured: unknown;
2400
+ readonly content: readonly ({
2401
+ readonly type: "text";
2402
+ readonly text: string;
2403
+ } | {
2404
+ readonly type: "file";
2405
+ readonly uri: string;
2406
+ readonly mime: string;
2407
+ readonly name?: string | undefined;
2408
+ })[];
2409
+ } | undefined;
2410
+ readonly providerMetadata?: {
2411
+ readonly [x: string]: {
2412
+ readonly [x: string]: unknown;
2413
+ };
2414
+ } | undefined;
2415
+ readonly providerExecuted?: boolean | undefined;
2416
+ }, {
2417
+ readonly type: keyof Cases;
2418
+ }> | Exclude<{
2419
+ readonly id: string;
2420
+ readonly type: "tool-error";
2421
+ readonly name: string;
2422
+ readonly message: string;
2423
+ readonly error?: unknown;
2424
+ readonly providerMetadata?: {
2425
+ readonly [x: string]: {
2426
+ readonly [x: string]: unknown;
2427
+ };
2428
+ } | undefined;
2429
+ }, {
2430
+ readonly type: keyof Cases;
2431
+ }> | Exclude<{
2432
+ readonly type: "step-finish";
2433
+ readonly reason: {
2434
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2435
+ readonly raw?: string | undefined;
2436
+ };
2437
+ readonly index: number;
2438
+ readonly providerMetadata?: {
2439
+ readonly [x: string]: {
2440
+ readonly [x: string]: unknown;
2441
+ };
2442
+ } | undefined;
2443
+ readonly usage?: Usage | undefined;
2444
+ }, {
2445
+ readonly type: keyof Cases;
2446
+ }> | Exclude<{
2447
+ readonly type: "finish";
2448
+ readonly reason: {
2449
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2450
+ readonly raw?: string | undefined;
2451
+ };
2452
+ readonly providerMetadata?: {
2453
+ readonly [x: string]: {
2454
+ readonly [x: string]: unknown;
2455
+ };
2456
+ } | undefined;
2457
+ readonly usage?: Usage | undefined;
2458
+ }, {
2459
+ readonly type: keyof Cases;
2460
+ }> | Exclude<{
2461
+ readonly type: "provider-error";
2462
+ readonly message: string;
2463
+ readonly providerMetadata?: {
2464
+ readonly [x: string]: {
2465
+ readonly [x: string]: unknown;
2466
+ };
2467
+ } | undefined;
2468
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2469
+ }, {
2470
+ readonly type: keyof Cases;
2471
+ }>) => any>(value: {
2472
+ readonly type: "step-start";
2473
+ readonly index: number;
2474
+ } | {
2475
+ readonly id: string;
2476
+ readonly type: "text-start";
2477
+ readonly providerMetadata?: {
2478
+ readonly [x: string]: {
2479
+ readonly [x: string]: unknown;
2480
+ };
2481
+ } | undefined;
2482
+ } | {
2483
+ readonly id: string;
2484
+ readonly type: "text-delta";
2485
+ readonly text: string;
2486
+ readonly providerMetadata?: {
2487
+ readonly [x: string]: {
2488
+ readonly [x: string]: unknown;
2489
+ };
2490
+ } | undefined;
2491
+ } | {
2492
+ readonly id: string;
2493
+ readonly type: "text-end";
2494
+ readonly providerMetadata?: {
2495
+ readonly [x: string]: {
2496
+ readonly [x: string]: unknown;
2497
+ };
2498
+ } | undefined;
2499
+ } | {
2500
+ readonly id: string;
2501
+ readonly type: "reasoning-start";
2502
+ readonly providerMetadata?: {
2503
+ readonly [x: string]: {
2504
+ readonly [x: string]: unknown;
2505
+ };
2506
+ } | undefined;
2507
+ } | {
2508
+ readonly id: string;
2509
+ readonly type: "reasoning-delta";
2510
+ readonly text: string;
2511
+ readonly providerMetadata?: {
2512
+ readonly [x: string]: {
2513
+ readonly [x: string]: unknown;
2514
+ };
2515
+ } | undefined;
2516
+ } | {
2517
+ readonly id: string;
2518
+ readonly type: "reasoning-end";
2519
+ readonly providerMetadata?: {
2520
+ readonly [x: string]: {
2521
+ readonly [x: string]: unknown;
2522
+ };
2523
+ } | undefined;
2524
+ } | {
2525
+ readonly id: string;
2526
+ readonly type: "tool-input-start";
2527
+ readonly name: string;
2528
+ readonly providerMetadata?: {
2529
+ readonly [x: string]: {
2530
+ readonly [x: string]: unknown;
2531
+ };
2532
+ } | undefined;
2533
+ readonly providerExecuted?: boolean | undefined;
2534
+ } | {
2535
+ readonly id: string;
2536
+ readonly type: "tool-input-delta";
2537
+ readonly name: string;
2538
+ readonly text: string;
2539
+ readonly input?: unknown;
2540
+ } | {
2541
+ readonly id: string;
2542
+ readonly type: "tool-input-end";
2543
+ readonly name: string;
2544
+ readonly providerMetadata?: {
2545
+ readonly [x: string]: {
2546
+ readonly [x: string]: unknown;
2547
+ };
2548
+ } | undefined;
2549
+ } | {
2550
+ readonly type: "tool-input-error";
2551
+ readonly id: string;
2552
+ readonly name: string;
2553
+ readonly raw: string;
2554
+ } | {
2555
+ readonly id: string;
2556
+ readonly type: "tool-call";
2557
+ readonly name: string;
2558
+ readonly input: unknown;
2559
+ readonly providerMetadata?: {
2560
+ readonly [x: string]: {
2561
+ readonly [x: string]: unknown;
2562
+ };
2563
+ } | undefined;
2564
+ readonly providerExecuted?: boolean | undefined;
2565
+ } | {
2566
+ readonly id: string;
2567
+ readonly type: "tool-result";
2568
+ readonly name: string;
2569
+ readonly result: {
2570
+ readonly type: "json";
2571
+ readonly value: unknown;
2572
+ } | {
2573
+ readonly type: "text";
2574
+ readonly value: unknown;
2575
+ } | {
2576
+ readonly type: "error";
2577
+ readonly value: unknown;
2578
+ } | {
2579
+ readonly type: "content";
2580
+ readonly value: readonly ({
2581
+ readonly type: "text";
2582
+ readonly text: string;
2583
+ } | {
2584
+ readonly type: "file";
2585
+ readonly uri: string;
2586
+ readonly mime: string;
2587
+ readonly name?: string | undefined;
2588
+ })[];
2589
+ };
2590
+ readonly output?: {
2591
+ readonly structured: unknown;
2592
+ readonly content: readonly ({
2593
+ readonly type: "text";
2594
+ readonly text: string;
2595
+ } | {
2596
+ readonly type: "file";
2597
+ readonly uri: string;
2598
+ readonly mime: string;
2599
+ readonly name?: string | undefined;
2600
+ })[];
2601
+ } | undefined;
2602
+ readonly providerMetadata?: {
2603
+ readonly [x: string]: {
2604
+ readonly [x: string]: unknown;
2605
+ };
2606
+ } | undefined;
2607
+ readonly providerExecuted?: boolean | undefined;
2608
+ } | {
2609
+ readonly id: string;
2610
+ readonly type: "tool-error";
2611
+ readonly name: string;
2612
+ readonly message: string;
2613
+ readonly error?: unknown;
2614
+ readonly providerMetadata?: {
2615
+ readonly [x: string]: {
2616
+ readonly [x: string]: unknown;
2617
+ };
2618
+ } | undefined;
2619
+ } | {
2620
+ readonly type: "step-finish";
2621
+ readonly reason: {
2622
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2623
+ readonly raw?: string | undefined;
2624
+ };
2625
+ readonly index: number;
2626
+ readonly providerMetadata?: {
2627
+ readonly [x: string]: {
2628
+ readonly [x: string]: unknown;
2629
+ };
2630
+ } | undefined;
2631
+ readonly usage?: Usage | undefined;
2632
+ } | {
2633
+ readonly type: "finish";
2634
+ readonly reason: {
2635
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2636
+ readonly raw?: string | undefined;
2637
+ };
2638
+ readonly providerMetadata?: {
2639
+ readonly [x: string]: {
2640
+ readonly [x: string]: unknown;
2641
+ };
2642
+ } | undefined;
2643
+ readonly usage?: Usage | undefined;
2644
+ } | {
2645
+ readonly type: "provider-error";
2646
+ readonly message: string;
2647
+ readonly providerMetadata?: {
2648
+ readonly [x: string]: {
2649
+ readonly [x: string]: unknown;
2650
+ };
2651
+ } | undefined;
2652
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2653
+ }, 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>>;
2654
+ <Cases extends {
2655
+ "step-start"?: ((value: {
2656
+ readonly type: "step-start";
2657
+ readonly index: number;
2658
+ }) => any) | undefined;
2659
+ "text-start"?: ((value: {
2660
+ readonly id: string;
2661
+ readonly type: "text-start";
2662
+ readonly providerMetadata?: {
2663
+ readonly [x: string]: {
2664
+ readonly [x: string]: unknown;
2665
+ };
2666
+ } | undefined;
2667
+ }) => any) | undefined;
2668
+ "text-delta"?: ((value: {
2669
+ readonly id: string;
2670
+ readonly type: "text-delta";
2671
+ readonly text: string;
2672
+ readonly providerMetadata?: {
2673
+ readonly [x: string]: {
2674
+ readonly [x: string]: unknown;
2675
+ };
2676
+ } | undefined;
2677
+ }) => any) | undefined;
2678
+ "text-end"?: ((value: {
2679
+ readonly id: string;
2680
+ readonly type: "text-end";
2681
+ readonly providerMetadata?: {
2682
+ readonly [x: string]: {
2683
+ readonly [x: string]: unknown;
2684
+ };
2685
+ } | undefined;
2686
+ }) => any) | undefined;
2687
+ "reasoning-start"?: ((value: {
2688
+ readonly id: string;
2689
+ readonly type: "reasoning-start";
2690
+ readonly providerMetadata?: {
2691
+ readonly [x: string]: {
2692
+ readonly [x: string]: unknown;
2693
+ };
2694
+ } | undefined;
2695
+ }) => any) | undefined;
2696
+ "reasoning-delta"?: ((value: {
2697
+ readonly id: string;
2698
+ readonly type: "reasoning-delta";
2699
+ readonly text: string;
2700
+ readonly providerMetadata?: {
2701
+ readonly [x: string]: {
2702
+ readonly [x: string]: unknown;
2703
+ };
2704
+ } | undefined;
2705
+ }) => any) | undefined;
2706
+ "reasoning-end"?: ((value: {
2707
+ readonly id: string;
2708
+ readonly type: "reasoning-end";
2709
+ readonly providerMetadata?: {
2710
+ readonly [x: string]: {
2711
+ readonly [x: string]: unknown;
2712
+ };
2713
+ } | undefined;
2714
+ }) => any) | undefined;
2715
+ "tool-input-start"?: ((value: {
2716
+ readonly id: string;
2717
+ readonly type: "tool-input-start";
2718
+ readonly name: string;
2719
+ readonly providerMetadata?: {
2720
+ readonly [x: string]: {
2721
+ readonly [x: string]: unknown;
2722
+ };
2723
+ } | undefined;
2724
+ readonly providerExecuted?: boolean | undefined;
2725
+ }) => any) | undefined;
2726
+ "tool-input-delta"?: ((value: {
2727
+ readonly id: string;
2728
+ readonly type: "tool-input-delta";
2729
+ readonly name: string;
2730
+ readonly text: string;
2731
+ readonly input?: unknown;
2732
+ }) => any) | undefined;
2733
+ "tool-input-end"?: ((value: {
2734
+ readonly id: string;
2735
+ readonly type: "tool-input-end";
2736
+ readonly name: string;
2737
+ readonly providerMetadata?: {
2738
+ readonly [x: string]: {
2739
+ readonly [x: string]: unknown;
2740
+ };
2741
+ } | undefined;
2742
+ }) => any) | undefined;
2743
+ "tool-input-error"?: ((value: {
2744
+ readonly type: "tool-input-error";
2745
+ readonly id: string;
2746
+ readonly name: string;
2747
+ readonly raw: string;
2748
+ }) => any) | undefined;
2749
+ "tool-call"?: ((value: {
2750
+ readonly id: string;
2751
+ readonly type: "tool-call";
2752
+ readonly name: string;
2753
+ readonly input: unknown;
2754
+ readonly providerMetadata?: {
2755
+ readonly [x: string]: {
2756
+ readonly [x: string]: unknown;
2757
+ };
2758
+ } | undefined;
2759
+ readonly providerExecuted?: boolean | undefined;
2760
+ }) => any) | undefined;
2761
+ "tool-result"?: ((value: {
2762
+ readonly id: string;
2763
+ readonly type: "tool-result";
2764
+ readonly name: string;
2765
+ readonly result: {
2766
+ readonly type: "json";
2767
+ readonly value: unknown;
2768
+ } | {
2769
+ readonly type: "text";
2770
+ readonly value: unknown;
2771
+ } | {
2772
+ readonly type: "error";
2773
+ readonly value: unknown;
2774
+ } | {
2775
+ readonly type: "content";
2776
+ readonly value: readonly ({
2777
+ readonly type: "text";
2778
+ readonly text: string;
2779
+ } | {
2780
+ readonly type: "file";
2781
+ readonly uri: string;
2782
+ readonly mime: string;
2783
+ readonly name?: string | undefined;
2784
+ })[];
2785
+ };
2786
+ readonly output?: {
2787
+ readonly structured: unknown;
2788
+ readonly content: readonly ({
2789
+ readonly type: "text";
2790
+ readonly text: string;
2791
+ } | {
2792
+ readonly type: "file";
2793
+ readonly uri: string;
2794
+ readonly mime: string;
2795
+ readonly name?: string | undefined;
2796
+ })[];
2797
+ } | undefined;
2798
+ readonly providerMetadata?: {
2799
+ readonly [x: string]: {
2800
+ readonly [x: string]: unknown;
2801
+ };
2802
+ } | undefined;
2803
+ readonly providerExecuted?: boolean | undefined;
2804
+ }) => any) | undefined;
2805
+ "tool-error"?: ((value: {
2806
+ readonly id: string;
2807
+ readonly type: "tool-error";
2808
+ readonly name: string;
2809
+ readonly message: string;
2810
+ readonly error?: unknown;
2811
+ readonly providerMetadata?: {
2812
+ readonly [x: string]: {
2813
+ readonly [x: string]: unknown;
2814
+ };
2815
+ } | undefined;
2816
+ }) => any) | undefined;
2817
+ "step-finish"?: ((value: {
2818
+ readonly type: "step-finish";
2819
+ readonly reason: {
2820
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2821
+ readonly raw?: string | undefined;
2822
+ };
2823
+ readonly index: number;
2824
+ readonly providerMetadata?: {
2825
+ readonly [x: string]: {
2826
+ readonly [x: string]: unknown;
2827
+ };
2828
+ } | undefined;
2829
+ readonly usage?: Usage | undefined;
2830
+ }) => any) | undefined;
2831
+ finish?: ((value: {
2832
+ readonly type: "finish";
2833
+ readonly reason: {
2834
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
2835
+ readonly raw?: string | undefined;
2836
+ };
2837
+ readonly providerMetadata?: {
2838
+ readonly [x: string]: {
2839
+ readonly [x: string]: unknown;
2840
+ };
2841
+ } | undefined;
2842
+ readonly usage?: Usage | undefined;
2843
+ }) => any) | undefined;
2844
+ "provider-error"?: ((value: {
2845
+ readonly type: "provider-error";
2846
+ readonly message: string;
2847
+ readonly providerMetadata?: {
2848
+ readonly [x: string]: {
2849
+ readonly [x: string]: unknown;
2850
+ };
2851
+ } | undefined;
2852
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
2853
+ }) => any) | undefined;
2854
+ } & { [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<{
2855
+ readonly type: "step-start";
2856
+ readonly index: number;
2857
+ }, {
2858
+ readonly type: keyof Cases;
2859
+ }> | Exclude<{
2860
+ readonly id: string;
2861
+ readonly type: "text-start";
2862
+ readonly providerMetadata?: {
2863
+ readonly [x: string]: {
2864
+ readonly [x: string]: unknown;
2865
+ };
2866
+ } | undefined;
2867
+ }, {
2868
+ readonly type: keyof Cases;
2869
+ }> | Exclude<{
2870
+ readonly id: string;
2871
+ readonly type: "text-delta";
2872
+ readonly text: string;
2873
+ readonly providerMetadata?: {
2874
+ readonly [x: string]: {
2875
+ readonly [x: string]: unknown;
2876
+ };
2877
+ } | undefined;
2878
+ }, {
2879
+ readonly type: keyof Cases;
2880
+ }> | Exclude<{
2881
+ readonly id: string;
2882
+ readonly type: "text-end";
2883
+ readonly providerMetadata?: {
2884
+ readonly [x: string]: {
2885
+ readonly [x: string]: unknown;
2886
+ };
2887
+ } | undefined;
2888
+ }, {
2889
+ readonly type: keyof Cases;
2890
+ }> | Exclude<{
2891
+ readonly id: string;
2892
+ readonly type: "reasoning-start";
2893
+ readonly providerMetadata?: {
2894
+ readonly [x: string]: {
2895
+ readonly [x: string]: unknown;
2896
+ };
2897
+ } | undefined;
2898
+ }, {
2899
+ readonly type: keyof Cases;
2900
+ }> | Exclude<{
2901
+ readonly id: string;
2902
+ readonly type: "reasoning-delta";
2903
+ readonly text: string;
2904
+ readonly providerMetadata?: {
2905
+ readonly [x: string]: {
2906
+ readonly [x: string]: unknown;
2907
+ };
2908
+ } | undefined;
2909
+ }, {
2910
+ readonly type: keyof Cases;
2911
+ }> | Exclude<{
2912
+ readonly id: string;
2913
+ readonly type: "reasoning-end";
2914
+ readonly providerMetadata?: {
2915
+ readonly [x: string]: {
2916
+ readonly [x: string]: unknown;
2917
+ };
2918
+ } | undefined;
2919
+ }, {
2920
+ readonly type: keyof Cases;
2921
+ }> | Exclude<{
2922
+ readonly id: string;
2923
+ readonly type: "tool-input-start";
2924
+ readonly name: string;
2925
+ readonly providerMetadata?: {
2926
+ readonly [x: string]: {
2927
+ readonly [x: string]: unknown;
2928
+ };
2929
+ } | undefined;
2930
+ readonly providerExecuted?: boolean | undefined;
2931
+ }, {
2932
+ readonly type: keyof Cases;
2933
+ }> | Exclude<{
2934
+ readonly id: string;
2935
+ readonly type: "tool-input-delta";
2936
+ readonly name: string;
2937
+ readonly text: string;
2938
+ readonly input?: unknown;
2939
+ }, {
2940
+ readonly type: keyof Cases;
2941
+ }> | Exclude<{
2942
+ readonly id: string;
2943
+ readonly type: "tool-input-end";
2944
+ readonly name: string;
2945
+ readonly providerMetadata?: {
2946
+ readonly [x: string]: {
2947
+ readonly [x: string]: unknown;
2948
+ };
2949
+ } | undefined;
2950
+ }, {
2951
+ readonly type: keyof Cases;
2952
+ }> | Exclude<{
2953
+ readonly type: "tool-input-error";
2954
+ readonly id: string;
2955
+ readonly name: string;
2956
+ readonly raw: string;
2957
+ }, {
2958
+ readonly type: keyof Cases;
2959
+ }> | Exclude<{
2960
+ readonly id: string;
2961
+ readonly type: "tool-call";
2962
+ readonly name: string;
2963
+ readonly input: unknown;
2964
+ readonly providerMetadata?: {
2965
+ readonly [x: string]: {
2966
+ readonly [x: string]: unknown;
2967
+ };
2968
+ } | undefined;
2969
+ readonly providerExecuted?: boolean | undefined;
2970
+ }, {
2971
+ readonly type: keyof Cases;
2972
+ }> | Exclude<{
2973
+ readonly id: string;
2974
+ readonly type: "tool-result";
2975
+ readonly name: string;
2976
+ readonly result: {
2977
+ readonly type: "json";
2978
+ readonly value: unknown;
2979
+ } | {
2980
+ readonly type: "text";
2981
+ readonly value: unknown;
2982
+ } | {
2983
+ readonly type: "error";
2984
+ readonly value: unknown;
2985
+ } | {
2986
+ readonly type: "content";
2987
+ readonly value: readonly ({
2988
+ readonly type: "text";
2989
+ readonly text: string;
2990
+ } | {
2991
+ readonly type: "file";
2992
+ readonly uri: string;
2993
+ readonly mime: string;
2994
+ readonly name?: string | undefined;
2995
+ })[];
2996
+ };
2997
+ readonly output?: {
2998
+ readonly structured: unknown;
2999
+ readonly content: readonly ({
3000
+ readonly type: "text";
3001
+ readonly text: string;
3002
+ } | {
3003
+ readonly type: "file";
3004
+ readonly uri: string;
3005
+ readonly mime: string;
3006
+ readonly name?: string | undefined;
3007
+ })[];
3008
+ } | undefined;
3009
+ readonly providerMetadata?: {
3010
+ readonly [x: string]: {
3011
+ readonly [x: string]: unknown;
3012
+ };
3013
+ } | undefined;
3014
+ readonly providerExecuted?: boolean | undefined;
3015
+ }, {
3016
+ readonly type: keyof Cases;
3017
+ }> | Exclude<{
3018
+ readonly id: string;
3019
+ readonly type: "tool-error";
3020
+ readonly name: string;
3021
+ readonly message: string;
3022
+ readonly error?: unknown;
3023
+ readonly providerMetadata?: {
3024
+ readonly [x: string]: {
3025
+ readonly [x: string]: unknown;
3026
+ };
3027
+ } | undefined;
3028
+ }, {
3029
+ readonly type: keyof Cases;
3030
+ }> | Exclude<{
3031
+ readonly type: "step-finish";
3032
+ readonly reason: {
3033
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3034
+ readonly raw?: string | undefined;
3035
+ };
3036
+ readonly index: number;
3037
+ readonly providerMetadata?: {
3038
+ readonly [x: string]: {
3039
+ readonly [x: string]: unknown;
3040
+ };
3041
+ } | undefined;
3042
+ readonly usage?: Usage | undefined;
3043
+ }, {
3044
+ readonly type: keyof Cases;
3045
+ }> | Exclude<{
3046
+ readonly type: "finish";
3047
+ readonly reason: {
3048
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3049
+ readonly raw?: string | undefined;
3050
+ };
3051
+ readonly providerMetadata?: {
3052
+ readonly [x: string]: {
3053
+ readonly [x: string]: unknown;
3054
+ };
3055
+ } | undefined;
3056
+ readonly usage?: Usage | undefined;
3057
+ }, {
3058
+ readonly type: keyof Cases;
3059
+ }> | Exclude<{
3060
+ readonly type: "provider-error";
3061
+ readonly message: string;
3062
+ readonly providerMetadata?: {
3063
+ readonly [x: string]: {
3064
+ readonly [x: string]: unknown;
3065
+ };
3066
+ } | undefined;
3067
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3068
+ }, {
3069
+ readonly type: keyof Cases;
3070
+ }>) => any>(cases: Cases, orElse: OrElse): (value: {
3071
+ readonly type: "step-start";
3072
+ readonly index: number;
3073
+ } | {
3074
+ readonly id: string;
3075
+ readonly type: "text-start";
3076
+ readonly providerMetadata?: {
3077
+ readonly [x: string]: {
3078
+ readonly [x: string]: unknown;
3079
+ };
3080
+ } | undefined;
3081
+ } | {
3082
+ readonly id: string;
3083
+ readonly type: "text-delta";
3084
+ readonly text: string;
3085
+ readonly providerMetadata?: {
3086
+ readonly [x: string]: {
3087
+ readonly [x: string]: unknown;
3088
+ };
3089
+ } | undefined;
3090
+ } | {
3091
+ readonly id: string;
3092
+ readonly type: "text-end";
3093
+ readonly providerMetadata?: {
3094
+ readonly [x: string]: {
3095
+ readonly [x: string]: unknown;
3096
+ };
3097
+ } | undefined;
3098
+ } | {
3099
+ readonly id: string;
3100
+ readonly type: "reasoning-start";
3101
+ readonly providerMetadata?: {
3102
+ readonly [x: string]: {
3103
+ readonly [x: string]: unknown;
3104
+ };
3105
+ } | undefined;
3106
+ } | {
3107
+ readonly id: string;
3108
+ readonly type: "reasoning-delta";
3109
+ readonly text: string;
3110
+ readonly providerMetadata?: {
3111
+ readonly [x: string]: {
3112
+ readonly [x: string]: unknown;
3113
+ };
3114
+ } | undefined;
3115
+ } | {
3116
+ readonly id: string;
3117
+ readonly type: "reasoning-end";
3118
+ readonly providerMetadata?: {
3119
+ readonly [x: string]: {
3120
+ readonly [x: string]: unknown;
3121
+ };
3122
+ } | undefined;
3123
+ } | {
3124
+ readonly id: string;
3125
+ readonly type: "tool-input-start";
3126
+ readonly name: string;
3127
+ readonly providerMetadata?: {
3128
+ readonly [x: string]: {
3129
+ readonly [x: string]: unknown;
3130
+ };
3131
+ } | undefined;
3132
+ readonly providerExecuted?: boolean | undefined;
3133
+ } | {
3134
+ readonly id: string;
3135
+ readonly type: "tool-input-delta";
3136
+ readonly name: string;
3137
+ readonly text: string;
3138
+ readonly input?: unknown;
3139
+ } | {
3140
+ readonly id: string;
3141
+ readonly type: "tool-input-end";
3142
+ readonly name: string;
3143
+ readonly providerMetadata?: {
3144
+ readonly [x: string]: {
3145
+ readonly [x: string]: unknown;
3146
+ };
3147
+ } | undefined;
3148
+ } | {
3149
+ readonly type: "tool-input-error";
3150
+ readonly id: string;
3151
+ readonly name: string;
3152
+ readonly raw: string;
3153
+ } | {
3154
+ readonly id: string;
3155
+ readonly type: "tool-call";
3156
+ readonly name: string;
3157
+ readonly input: unknown;
3158
+ readonly providerMetadata?: {
3159
+ readonly [x: string]: {
3160
+ readonly [x: string]: unknown;
3161
+ };
3162
+ } | undefined;
3163
+ readonly providerExecuted?: boolean | undefined;
3164
+ } | {
3165
+ readonly id: string;
3166
+ readonly type: "tool-result";
3167
+ readonly name: string;
3168
+ readonly result: {
3169
+ readonly type: "json";
3170
+ readonly value: unknown;
3171
+ } | {
3172
+ readonly type: "text";
3173
+ readonly value: unknown;
3174
+ } | {
3175
+ readonly type: "error";
3176
+ readonly value: unknown;
3177
+ } | {
3178
+ readonly type: "content";
3179
+ readonly value: readonly ({
3180
+ readonly type: "text";
3181
+ readonly text: string;
3182
+ } | {
3183
+ readonly type: "file";
3184
+ readonly uri: string;
3185
+ readonly mime: string;
3186
+ readonly name?: string | undefined;
3187
+ })[];
3188
+ };
3189
+ readonly output?: {
3190
+ readonly structured: unknown;
3191
+ readonly content: readonly ({
3192
+ readonly type: "text";
3193
+ readonly text: string;
3194
+ } | {
3195
+ readonly type: "file";
3196
+ readonly uri: string;
3197
+ readonly mime: string;
3198
+ readonly name?: string | undefined;
3199
+ })[];
3200
+ } | undefined;
3201
+ readonly providerMetadata?: {
3202
+ readonly [x: string]: {
3203
+ readonly [x: string]: unknown;
3204
+ };
3205
+ } | undefined;
3206
+ readonly providerExecuted?: boolean | undefined;
3207
+ } | {
3208
+ readonly id: string;
3209
+ readonly type: "tool-error";
3210
+ readonly name: string;
3211
+ readonly message: string;
3212
+ readonly error?: unknown;
3213
+ readonly providerMetadata?: {
3214
+ readonly [x: string]: {
3215
+ readonly [x: string]: unknown;
3216
+ };
3217
+ } | undefined;
3218
+ } | {
3219
+ readonly type: "step-finish";
3220
+ readonly reason: {
3221
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3222
+ readonly raw?: string | undefined;
3223
+ };
3224
+ readonly index: number;
3225
+ readonly providerMetadata?: {
3226
+ readonly [x: string]: {
3227
+ readonly [x: string]: unknown;
3228
+ };
3229
+ } | undefined;
3230
+ readonly usage?: Usage | undefined;
3231
+ } | {
3232
+ readonly type: "finish";
3233
+ readonly reason: {
3234
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3235
+ readonly raw?: string | undefined;
3236
+ };
3237
+ readonly providerMetadata?: {
3238
+ readonly [x: string]: {
3239
+ readonly [x: string]: unknown;
3240
+ };
3241
+ } | undefined;
3242
+ readonly usage?: Usage | undefined;
3243
+ } | {
3244
+ readonly type: "provider-error";
3245
+ readonly message: string;
3246
+ readonly providerMetadata?: {
3247
+ readonly [x: string]: {
3248
+ readonly [x: string]: unknown;
3249
+ };
3250
+ } | undefined;
3251
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3252
+ }) => 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>>;
3253
+ };
2054
3254
  } & {
2055
3255
  stepStart: (input: {
2056
3256
  readonly index: number;
@@ -2804,7 +4004,197 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2804
4004
  readonly [x: string]: unknown;
2805
4005
  };
2806
4006
  } | undefined;
2807
- } | {
4007
+ } | {
4008
+ readonly id: string;
4009
+ readonly type: "reasoning-start";
4010
+ readonly providerMetadata?: {
4011
+ readonly [x: string]: {
4012
+ readonly [x: string]: unknown;
4013
+ };
4014
+ } | undefined;
4015
+ } | {
4016
+ readonly id: string;
4017
+ readonly type: "reasoning-delta";
4018
+ readonly text: string;
4019
+ readonly providerMetadata?: {
4020
+ readonly [x: string]: {
4021
+ readonly [x: string]: unknown;
4022
+ };
4023
+ } | undefined;
4024
+ } | {
4025
+ readonly id: string;
4026
+ readonly type: "reasoning-end";
4027
+ readonly providerMetadata?: {
4028
+ readonly [x: string]: {
4029
+ readonly [x: string]: unknown;
4030
+ };
4031
+ } | undefined;
4032
+ } | {
4033
+ readonly id: string;
4034
+ readonly type: "tool-input-start";
4035
+ readonly name: string;
4036
+ readonly providerMetadata?: {
4037
+ readonly [x: string]: {
4038
+ readonly [x: string]: unknown;
4039
+ };
4040
+ } | undefined;
4041
+ readonly providerExecuted?: boolean | undefined;
4042
+ } | {
4043
+ readonly id: string;
4044
+ readonly type: "tool-input-delta";
4045
+ readonly name: string;
4046
+ readonly text: string;
4047
+ readonly input?: unknown;
4048
+ } | {
4049
+ readonly id: string;
4050
+ readonly type: "tool-input-end";
4051
+ readonly name: string;
4052
+ readonly providerMetadata?: {
4053
+ readonly [x: string]: {
4054
+ readonly [x: string]: unknown;
4055
+ };
4056
+ } | undefined;
4057
+ } | {
4058
+ readonly type: "tool-input-error";
4059
+ readonly id: string;
4060
+ readonly name: string;
4061
+ readonly raw: string;
4062
+ } | {
4063
+ readonly id: string;
4064
+ readonly type: "tool-call";
4065
+ readonly name: string;
4066
+ readonly input: unknown;
4067
+ readonly providerMetadata?: {
4068
+ readonly [x: string]: {
4069
+ readonly [x: string]: unknown;
4070
+ };
4071
+ } | undefined;
4072
+ readonly providerExecuted?: boolean | undefined;
4073
+ } | {
4074
+ readonly id: string;
4075
+ readonly type: "tool-result";
4076
+ readonly name: string;
4077
+ readonly result: {
4078
+ readonly type: "json";
4079
+ readonly value: unknown;
4080
+ } | {
4081
+ readonly type: "text";
4082
+ readonly value: unknown;
4083
+ } | {
4084
+ readonly type: "error";
4085
+ readonly value: unknown;
4086
+ } | {
4087
+ readonly type: "content";
4088
+ readonly value: readonly ({
4089
+ readonly type: "text";
4090
+ readonly text: string;
4091
+ } | {
4092
+ readonly type: "file";
4093
+ readonly uri: string;
4094
+ readonly mime: string;
4095
+ readonly name?: string | undefined;
4096
+ })[];
4097
+ };
4098
+ readonly output?: {
4099
+ readonly structured: unknown;
4100
+ readonly content: readonly ({
4101
+ readonly type: "text";
4102
+ readonly text: string;
4103
+ } | {
4104
+ readonly type: "file";
4105
+ readonly uri: string;
4106
+ readonly mime: string;
4107
+ readonly name?: string | undefined;
4108
+ })[];
4109
+ } | undefined;
4110
+ readonly providerMetadata?: {
4111
+ readonly [x: string]: {
4112
+ readonly [x: string]: unknown;
4113
+ };
4114
+ } | undefined;
4115
+ readonly providerExecuted?: boolean | undefined;
4116
+ } | {
4117
+ readonly id: string;
4118
+ readonly type: "tool-error";
4119
+ readonly name: string;
4120
+ readonly message: string;
4121
+ readonly error?: unknown;
4122
+ readonly providerMetadata?: {
4123
+ readonly [x: string]: {
4124
+ readonly [x: string]: unknown;
4125
+ };
4126
+ } | undefined;
4127
+ } | {
4128
+ readonly type: "step-finish";
4129
+ readonly reason: {
4130
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4131
+ readonly raw?: string | undefined;
4132
+ };
4133
+ readonly index: number;
4134
+ readonly providerMetadata?: {
4135
+ readonly [x: string]: {
4136
+ readonly [x: string]: unknown;
4137
+ };
4138
+ } | undefined;
4139
+ readonly usage?: Usage | undefined;
4140
+ } | {
4141
+ readonly type: "finish";
4142
+ readonly reason: {
4143
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4144
+ readonly raw?: string | undefined;
4145
+ };
4146
+ readonly providerMetadata?: {
4147
+ readonly [x: string]: {
4148
+ readonly [x: string]: unknown;
4149
+ };
4150
+ } | undefined;
4151
+ readonly usage?: Usage | undefined;
4152
+ } | {
4153
+ readonly type: "provider-error";
4154
+ readonly message: string;
4155
+ readonly providerMetadata?: {
4156
+ readonly [x: string]: {
4157
+ readonly [x: string]: unknown;
4158
+ };
4159
+ } | undefined;
4160
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4161
+ }) => value is Extract<{
4162
+ readonly type: "step-start";
4163
+ readonly index: number;
4164
+ }, {
4165
+ readonly type: Keys;
4166
+ }> | Extract<{
4167
+ readonly id: string;
4168
+ readonly type: "text-start";
4169
+ readonly providerMetadata?: {
4170
+ readonly [x: string]: {
4171
+ readonly [x: string]: unknown;
4172
+ };
4173
+ } | undefined;
4174
+ }, {
4175
+ readonly type: Keys;
4176
+ }> | Extract<{
4177
+ readonly id: string;
4178
+ readonly type: "text-delta";
4179
+ readonly text: string;
4180
+ readonly providerMetadata?: {
4181
+ readonly [x: string]: {
4182
+ readonly [x: string]: unknown;
4183
+ };
4184
+ } | undefined;
4185
+ }, {
4186
+ readonly type: Keys;
4187
+ }> | Extract<{
4188
+ readonly id: string;
4189
+ readonly type: "text-end";
4190
+ readonly providerMetadata?: {
4191
+ readonly [x: string]: {
4192
+ readonly [x: string]: unknown;
4193
+ };
4194
+ } | undefined;
4195
+ }, {
4196
+ readonly type: Keys;
4197
+ }> | Extract<{
2808
4198
  readonly id: string;
2809
4199
  readonly type: "reasoning-start";
2810
4200
  readonly providerMetadata?: {
@@ -2812,7 +4202,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2812
4202
  readonly [x: string]: unknown;
2813
4203
  };
2814
4204
  } | undefined;
2815
- } | {
4205
+ }, {
4206
+ readonly type: Keys;
4207
+ }> | Extract<{
2816
4208
  readonly id: string;
2817
4209
  readonly type: "reasoning-delta";
2818
4210
  readonly text: string;
@@ -2821,7 +4213,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2821
4213
  readonly [x: string]: unknown;
2822
4214
  };
2823
4215
  } | undefined;
2824
- } | {
4216
+ }, {
4217
+ readonly type: Keys;
4218
+ }> | Extract<{
2825
4219
  readonly id: string;
2826
4220
  readonly type: "reasoning-end";
2827
4221
  readonly providerMetadata?: {
@@ -2829,7 +4223,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2829
4223
  readonly [x: string]: unknown;
2830
4224
  };
2831
4225
  } | undefined;
2832
- } | {
4226
+ }, {
4227
+ readonly type: Keys;
4228
+ }> | Extract<{
2833
4229
  readonly id: string;
2834
4230
  readonly type: "tool-input-start";
2835
4231
  readonly name: string;
@@ -2839,13 +4235,17 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2839
4235
  };
2840
4236
  } | undefined;
2841
4237
  readonly providerExecuted?: boolean | undefined;
2842
- } | {
4238
+ }, {
4239
+ readonly type: Keys;
4240
+ }> | Extract<{
2843
4241
  readonly id: string;
2844
4242
  readonly type: "tool-input-delta";
2845
4243
  readonly name: string;
2846
4244
  readonly text: string;
2847
4245
  readonly input?: unknown;
2848
- } | {
4246
+ }, {
4247
+ readonly type: Keys;
4248
+ }> | Extract<{
2849
4249
  readonly id: string;
2850
4250
  readonly type: "tool-input-end";
2851
4251
  readonly name: string;
@@ -2854,12 +4254,16 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2854
4254
  readonly [x: string]: unknown;
2855
4255
  };
2856
4256
  } | undefined;
2857
- } | {
4257
+ }, {
4258
+ readonly type: Keys;
4259
+ }> | Extract<{
2858
4260
  readonly type: "tool-input-error";
2859
4261
  readonly id: string;
2860
4262
  readonly name: string;
2861
4263
  readonly raw: string;
2862
- } | {
4264
+ }, {
4265
+ readonly type: Keys;
4266
+ }> | Extract<{
2863
4267
  readonly id: string;
2864
4268
  readonly type: "tool-call";
2865
4269
  readonly name: string;
@@ -2870,7 +4274,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2870
4274
  };
2871
4275
  } | undefined;
2872
4276
  readonly providerExecuted?: boolean | undefined;
2873
- } | {
4277
+ }, {
4278
+ readonly type: Keys;
4279
+ }> | Extract<{
2874
4280
  readonly id: string;
2875
4281
  readonly type: "tool-result";
2876
4282
  readonly name: string;
@@ -2913,7 +4319,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2913
4319
  };
2914
4320
  } | undefined;
2915
4321
  readonly providerExecuted?: boolean | undefined;
2916
- } | {
4322
+ }, {
4323
+ readonly type: Keys;
4324
+ }> | Extract<{
2917
4325
  readonly id: string;
2918
4326
  readonly type: "tool-error";
2919
4327
  readonly name: string;
@@ -2924,7 +4332,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2924
4332
  readonly [x: string]: unknown;
2925
4333
  };
2926
4334
  } | undefined;
2927
- } | {
4335
+ }, {
4336
+ readonly type: Keys;
4337
+ }> | Extract<{
2928
4338
  readonly type: "step-finish";
2929
4339
  readonly reason: {
2930
4340
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -2937,7 +4347,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2937
4347
  };
2938
4348
  } | undefined;
2939
4349
  readonly usage?: Usage | undefined;
2940
- } | {
4350
+ }, {
4351
+ readonly type: Keys;
4352
+ }> | Extract<{
2941
4353
  readonly type: "finish";
2942
4354
  readonly reason: {
2943
4355
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -2949,238 +4361,809 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
2949
4361
  };
2950
4362
  } | undefined;
2951
4363
  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
4364
  }, {
3017
4365
  readonly type: Keys;
3018
4366
  }> | Extract<{
3019
- readonly id: string;
3020
- readonly type: "reasoning-end";
4367
+ readonly type: "provider-error";
4368
+ readonly message: string;
3021
4369
  readonly providerMetadata?: {
3022
4370
  readonly [x: string]: {
3023
4371
  readonly [x: string]: unknown;
3024
4372
  };
3025
4373
  } | undefined;
4374
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3026
4375
  }, {
3027
4376
  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;
4377
+ }>;
4378
+ readonly guards: {
4379
+ "step-start": (u: unknown) => u is {
4380
+ readonly type: "step-start";
4381
+ readonly index: number;
4382
+ };
4383
+ "text-start": (u: unknown) => u is {
4384
+ readonly id: string;
4385
+ readonly type: "text-start";
4386
+ readonly providerMetadata?: {
4387
+ readonly [x: string]: {
4388
+ readonly [x: string]: unknown;
4389
+ };
4390
+ } | undefined;
4391
+ };
4392
+ "text-delta": (u: unknown) => u is {
4393
+ readonly id: string;
4394
+ readonly type: "text-delta";
4395
+ readonly text: string;
4396
+ readonly providerMetadata?: {
4397
+ readonly [x: string]: {
4398
+ readonly [x: string]: unknown;
4399
+ };
4400
+ } | undefined;
4401
+ };
4402
+ "text-end": (u: unknown) => u is {
4403
+ readonly id: string;
4404
+ readonly type: "text-end";
4405
+ readonly providerMetadata?: {
4406
+ readonly [x: string]: {
4407
+ readonly [x: string]: unknown;
4408
+ };
4409
+ } | undefined;
4410
+ };
4411
+ "reasoning-start": (u: unknown) => u is {
4412
+ readonly id: string;
4413
+ readonly type: "reasoning-start";
4414
+ readonly providerMetadata?: {
4415
+ readonly [x: string]: {
4416
+ readonly [x: string]: unknown;
4417
+ };
4418
+ } | undefined;
4419
+ };
4420
+ "reasoning-delta": (u: unknown) => u is {
4421
+ readonly id: string;
4422
+ readonly type: "reasoning-delta";
4423
+ readonly text: string;
4424
+ readonly providerMetadata?: {
4425
+ readonly [x: string]: {
4426
+ readonly [x: string]: unknown;
4427
+ };
4428
+ } | undefined;
4429
+ };
4430
+ "reasoning-end": (u: unknown) => u is {
4431
+ readonly id: string;
4432
+ readonly type: "reasoning-end";
4433
+ readonly providerMetadata?: {
4434
+ readonly [x: string]: {
4435
+ readonly [x: string]: unknown;
4436
+ };
4437
+ } | undefined;
4438
+ };
4439
+ "tool-input-start": (u: unknown) => u is {
4440
+ readonly id: string;
4441
+ readonly type: "tool-input-start";
4442
+ readonly name: string;
4443
+ readonly providerMetadata?: {
4444
+ readonly [x: string]: {
4445
+ readonly [x: string]: unknown;
4446
+ };
4447
+ } | undefined;
4448
+ readonly providerExecuted?: boolean | undefined;
4449
+ };
4450
+ "tool-input-delta": (u: unknown) => u is {
4451
+ readonly id: string;
4452
+ readonly type: "tool-input-delta";
4453
+ readonly name: string;
4454
+ readonly text: string;
4455
+ readonly input?: unknown;
4456
+ };
4457
+ "tool-input-end": (u: unknown) => u is {
4458
+ readonly id: string;
4459
+ readonly type: "tool-input-end";
4460
+ readonly name: string;
4461
+ readonly providerMetadata?: {
4462
+ readonly [x: string]: {
4463
+ readonly [x: string]: unknown;
4464
+ };
4465
+ } | undefined;
4466
+ };
4467
+ "tool-input-error": (u: unknown) => u is {
4468
+ readonly type: "tool-input-error";
4469
+ readonly id: string;
4470
+ readonly name: string;
4471
+ readonly raw: string;
4472
+ };
4473
+ "tool-call": (u: unknown) => u is {
4474
+ readonly id: string;
4475
+ readonly type: "tool-call";
4476
+ readonly name: string;
4477
+ readonly input: unknown;
4478
+ readonly providerMetadata?: {
4479
+ readonly [x: string]: {
4480
+ readonly [x: string]: unknown;
4481
+ };
4482
+ } | undefined;
4483
+ readonly providerExecuted?: boolean | undefined;
4484
+ };
4485
+ "tool-result": (u: unknown) => u is {
4486
+ readonly id: string;
4487
+ readonly type: "tool-result";
4488
+ readonly name: string;
4489
+ readonly result: {
4490
+ readonly type: "json";
4491
+ readonly value: unknown;
4492
+ } | {
4493
+ readonly type: "text";
4494
+ readonly value: unknown;
4495
+ } | {
4496
+ readonly type: "error";
4497
+ readonly value: unknown;
4498
+ } | {
4499
+ readonly type: "content";
4500
+ readonly value: readonly ({
4501
+ readonly type: "text";
4502
+ readonly text: string;
4503
+ } | {
4504
+ readonly type: "file";
4505
+ readonly uri: string;
4506
+ readonly mime: string;
4507
+ readonly name?: string | undefined;
4508
+ })[];
3035
4509
  };
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;
4510
+ readonly output?: {
4511
+ readonly structured: unknown;
4512
+ readonly content: readonly ({
4513
+ readonly type: "text";
4514
+ readonly text: string;
4515
+ } | {
4516
+ readonly type: "file";
4517
+ readonly uri: string;
4518
+ readonly mime: string;
4519
+ readonly name?: string | undefined;
4520
+ })[];
4521
+ } | undefined;
4522
+ readonly providerMetadata?: {
4523
+ readonly [x: string]: {
4524
+ readonly [x: string]: unknown;
4525
+ };
4526
+ } | undefined;
4527
+ readonly providerExecuted?: boolean | undefined;
4528
+ };
4529
+ "tool-error": (u: unknown) => u is {
4530
+ readonly id: string;
4531
+ readonly type: "tool-error";
4532
+ readonly name: string;
4533
+ readonly message: string;
4534
+ readonly error?: unknown;
4535
+ readonly providerMetadata?: {
4536
+ readonly [x: string]: {
4537
+ readonly [x: string]: unknown;
4538
+ };
4539
+ } | undefined;
4540
+ };
4541
+ "step-finish": (u: unknown) => u is {
4542
+ readonly type: "step-finish";
4543
+ readonly reason: {
4544
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4545
+ readonly raw?: string | undefined;
3055
4546
  };
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;
4547
+ readonly index: number;
4548
+ readonly providerMetadata?: {
4549
+ readonly [x: string]: {
4550
+ readonly [x: string]: unknown;
4551
+ };
4552
+ } | undefined;
4553
+ readonly usage?: Usage | undefined;
4554
+ };
4555
+ finish: (u: unknown) => u is {
4556
+ readonly type: "finish";
4557
+ readonly reason: {
4558
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4559
+ readonly raw?: string | undefined;
3074
4560
  };
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;
4561
+ readonly providerMetadata?: {
4562
+ readonly [x: string]: {
4563
+ readonly [x: string]: unknown;
4564
+ };
4565
+ } | undefined;
4566
+ readonly usage?: Usage | undefined;
4567
+ };
4568
+ "provider-error": (u: unknown) => u is {
4569
+ readonly type: "provider-error";
4570
+ readonly message: string;
4571
+ readonly providerMetadata?: {
4572
+ readonly [x: string]: {
4573
+ readonly [x: string]: unknown;
4574
+ };
4575
+ } | undefined;
4576
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4577
+ };
4578
+ };
4579
+ readonly match: {
4580
+ <Cases extends {
4581
+ "step-start": (value: {
4582
+ readonly type: "step-start";
4583
+ readonly index: number;
4584
+ }) => any;
4585
+ "text-start": (value: {
4586
+ readonly id: string;
4587
+ readonly type: "text-start";
4588
+ readonly providerMetadata?: {
4589
+ readonly [x: string]: {
4590
+ readonly [x: string]: unknown;
4591
+ };
4592
+ } | undefined;
4593
+ }) => any;
4594
+ "text-delta": (value: {
4595
+ readonly id: string;
4596
+ readonly type: "text-delta";
4597
+ readonly text: string;
4598
+ readonly providerMetadata?: {
4599
+ readonly [x: string]: {
4600
+ readonly [x: string]: unknown;
4601
+ };
4602
+ } | undefined;
4603
+ }) => any;
4604
+ "text-end": (value: {
4605
+ readonly id: string;
4606
+ readonly type: "text-end";
4607
+ readonly providerMetadata?: {
4608
+ readonly [x: string]: {
4609
+ readonly [x: string]: unknown;
4610
+ };
4611
+ } | undefined;
4612
+ }) => any;
4613
+ "reasoning-start": (value: {
4614
+ readonly id: string;
4615
+ readonly type: "reasoning-start";
4616
+ readonly providerMetadata?: {
4617
+ readonly [x: string]: {
4618
+ readonly [x: string]: unknown;
4619
+ };
4620
+ } | undefined;
4621
+ }) => any;
4622
+ "reasoning-delta": (value: {
4623
+ readonly id: string;
4624
+ readonly type: "reasoning-delta";
4625
+ readonly text: string;
4626
+ readonly providerMetadata?: {
4627
+ readonly [x: string]: {
4628
+ readonly [x: string]: unknown;
4629
+ };
4630
+ } | undefined;
4631
+ }) => any;
4632
+ "reasoning-end": (value: {
4633
+ readonly id: string;
4634
+ readonly type: "reasoning-end";
4635
+ readonly providerMetadata?: {
4636
+ readonly [x: string]: {
4637
+ readonly [x: string]: unknown;
4638
+ };
4639
+ } | undefined;
4640
+ }) => any;
4641
+ "tool-input-start": (value: {
4642
+ readonly id: string;
4643
+ readonly type: "tool-input-start";
4644
+ readonly name: string;
4645
+ readonly providerMetadata?: {
4646
+ readonly [x: string]: {
4647
+ readonly [x: string]: unknown;
4648
+ };
4649
+ } | undefined;
4650
+ readonly providerExecuted?: boolean | undefined;
4651
+ }) => any;
4652
+ "tool-input-delta": (value: {
4653
+ readonly id: string;
4654
+ readonly type: "tool-input-delta";
4655
+ readonly name: string;
4656
+ readonly text: string;
4657
+ readonly input?: unknown;
4658
+ }) => any;
4659
+ "tool-input-end": (value: {
4660
+ readonly id: string;
4661
+ readonly type: "tool-input-end";
4662
+ readonly name: string;
4663
+ readonly providerMetadata?: {
4664
+ readonly [x: string]: {
4665
+ readonly [x: string]: unknown;
4666
+ };
4667
+ } | undefined;
4668
+ }) => any;
4669
+ "tool-input-error": (value: {
4670
+ readonly type: "tool-input-error";
4671
+ readonly id: string;
4672
+ readonly name: string;
4673
+ readonly raw: string;
4674
+ }) => any;
4675
+ "tool-call": (value: {
4676
+ readonly id: string;
4677
+ readonly type: "tool-call";
4678
+ readonly name: string;
4679
+ readonly input: unknown;
4680
+ readonly providerMetadata?: {
4681
+ readonly [x: string]: {
4682
+ readonly [x: string]: unknown;
4683
+ };
4684
+ } | undefined;
4685
+ readonly providerExecuted?: boolean | undefined;
4686
+ }) => any;
4687
+ "tool-result": (value: {
4688
+ readonly id: string;
4689
+ readonly type: "tool-result";
4690
+ readonly name: string;
4691
+ readonly result: {
4692
+ readonly type: "json";
4693
+ readonly value: unknown;
4694
+ } | {
4695
+ readonly type: "text";
4696
+ readonly value: unknown;
4697
+ } | {
4698
+ readonly type: "error";
4699
+ readonly value: unknown;
4700
+ } | {
4701
+ readonly type: "content";
4702
+ readonly value: readonly ({
4703
+ readonly type: "text";
4704
+ readonly text: string;
4705
+ } | {
4706
+ readonly type: "file";
4707
+ readonly uri: string;
4708
+ readonly mime: string;
4709
+ readonly name?: string | undefined;
4710
+ })[];
4711
+ };
4712
+ readonly output?: {
4713
+ readonly structured: unknown;
4714
+ readonly content: readonly ({
4715
+ readonly type: "text";
4716
+ readonly text: string;
4717
+ } | {
4718
+ readonly type: "file";
4719
+ readonly uri: string;
4720
+ readonly mime: string;
4721
+ readonly name?: string | undefined;
4722
+ })[];
4723
+ } | undefined;
4724
+ readonly providerMetadata?: {
4725
+ readonly [x: string]: {
4726
+ readonly [x: string]: unknown;
4727
+ };
4728
+ } | undefined;
4729
+ readonly providerExecuted?: boolean | undefined;
4730
+ }) => any;
4731
+ "tool-error": (value: {
4732
+ readonly id: string;
4733
+ readonly type: "tool-error";
4734
+ readonly name: string;
4735
+ readonly message: string;
4736
+ readonly error?: unknown;
4737
+ readonly providerMetadata?: {
4738
+ readonly [x: string]: {
4739
+ readonly [x: string]: unknown;
4740
+ };
4741
+ } | undefined;
4742
+ }) => any;
4743
+ "step-finish": (value: {
4744
+ readonly type: "step-finish";
4745
+ readonly reason: {
4746
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4747
+ readonly raw?: string | undefined;
4748
+ };
4749
+ readonly index: number;
4750
+ readonly providerMetadata?: {
4751
+ readonly [x: string]: {
4752
+ readonly [x: string]: unknown;
4753
+ };
4754
+ } | undefined;
4755
+ readonly usage?: Usage | undefined;
4756
+ }) => any;
4757
+ finish: (value: {
4758
+ readonly type: "finish";
4759
+ readonly reason: {
4760
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4761
+ readonly raw?: string | undefined;
4762
+ };
4763
+ readonly providerMetadata?: {
4764
+ readonly [x: string]: {
4765
+ readonly [x: string]: unknown;
4766
+ };
4767
+ } | undefined;
4768
+ readonly usage?: Usage | undefined;
4769
+ }) => any;
4770
+ "provider-error": (value: {
4771
+ readonly type: "provider-error";
4772
+ readonly message: string;
4773
+ readonly providerMetadata?: {
4774
+ readonly [x: string]: {
4775
+ readonly [x: string]: unknown;
4776
+ };
4777
+ } | undefined;
4778
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4779
+ }) => any;
4780
+ }>(value: {
4781
+ readonly type: "step-start";
4782
+ readonly index: number;
3086
4783
  } | {
3087
- readonly type: "text";
3088
- readonly value: unknown;
4784
+ readonly id: string;
4785
+ readonly type: "text-start";
4786
+ readonly providerMetadata?: {
4787
+ readonly [x: string]: {
4788
+ readonly [x: string]: unknown;
4789
+ };
4790
+ } | undefined;
3089
4791
  } | {
3090
- readonly type: "error";
3091
- readonly value: unknown;
4792
+ readonly id: string;
4793
+ readonly type: "text-delta";
4794
+ readonly text: string;
4795
+ readonly providerMetadata?: {
4796
+ readonly [x: string]: {
4797
+ readonly [x: string]: unknown;
4798
+ };
4799
+ } | undefined;
3092
4800
  } | {
3093
- readonly type: "content";
3094
- readonly value: readonly ({
3095
- readonly type: "text";
3096
- readonly text: string;
4801
+ readonly id: string;
4802
+ readonly type: "text-end";
4803
+ readonly providerMetadata?: {
4804
+ readonly [x: string]: {
4805
+ readonly [x: string]: unknown;
4806
+ };
4807
+ } | undefined;
4808
+ } | {
4809
+ readonly id: string;
4810
+ readonly type: "reasoning-start";
4811
+ readonly providerMetadata?: {
4812
+ readonly [x: string]: {
4813
+ readonly [x: string]: unknown;
4814
+ };
4815
+ } | undefined;
4816
+ } | {
4817
+ readonly id: string;
4818
+ readonly type: "reasoning-delta";
4819
+ readonly text: string;
4820
+ readonly providerMetadata?: {
4821
+ readonly [x: string]: {
4822
+ readonly [x: string]: unknown;
4823
+ };
4824
+ } | undefined;
4825
+ } | {
4826
+ readonly id: string;
4827
+ readonly type: "reasoning-end";
4828
+ readonly providerMetadata?: {
4829
+ readonly [x: string]: {
4830
+ readonly [x: string]: unknown;
4831
+ };
4832
+ } | undefined;
4833
+ } | {
4834
+ readonly id: string;
4835
+ readonly type: "tool-input-start";
4836
+ readonly name: string;
4837
+ readonly providerMetadata?: {
4838
+ readonly [x: string]: {
4839
+ readonly [x: string]: unknown;
4840
+ };
4841
+ } | undefined;
4842
+ readonly providerExecuted?: boolean | undefined;
4843
+ } | {
4844
+ readonly id: string;
4845
+ readonly type: "tool-input-delta";
4846
+ readonly name: string;
4847
+ readonly text: string;
4848
+ readonly input?: unknown;
4849
+ } | {
4850
+ readonly id: string;
4851
+ readonly type: "tool-input-end";
4852
+ readonly name: string;
4853
+ readonly providerMetadata?: {
4854
+ readonly [x: string]: {
4855
+ readonly [x: string]: unknown;
4856
+ };
4857
+ } | undefined;
4858
+ } | {
4859
+ readonly type: "tool-input-error";
4860
+ readonly id: string;
4861
+ readonly name: string;
4862
+ readonly raw: string;
4863
+ } | {
4864
+ readonly id: string;
4865
+ readonly type: "tool-call";
4866
+ readonly name: string;
4867
+ readonly input: unknown;
4868
+ readonly providerMetadata?: {
4869
+ readonly [x: string]: {
4870
+ readonly [x: string]: unknown;
4871
+ };
4872
+ } | undefined;
4873
+ readonly providerExecuted?: boolean | undefined;
4874
+ } | {
4875
+ readonly id: string;
4876
+ readonly type: "tool-result";
4877
+ readonly name: string;
4878
+ readonly result: {
4879
+ readonly type: "json";
4880
+ readonly value: unknown;
3097
4881
  } | {
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
4882
  readonly type: "text";
3108
- readonly text: string;
4883
+ readonly value: unknown;
3109
4884
  } | {
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;
4885
+ readonly type: "error";
4886
+ readonly value: unknown;
4887
+ } | {
4888
+ readonly type: "content";
4889
+ readonly value: readonly ({
4890
+ readonly type: "text";
4891
+ readonly text: string;
4892
+ } | {
4893
+ readonly type: "file";
4894
+ readonly uri: string;
4895
+ readonly mime: string;
4896
+ readonly name?: string | undefined;
4897
+ })[];
3147
4898
  };
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;
4899
+ readonly output?: {
4900
+ readonly structured: unknown;
4901
+ readonly content: readonly ({
4902
+ readonly type: "text";
4903
+ readonly text: string;
4904
+ } | {
4905
+ readonly type: "file";
4906
+ readonly uri: string;
4907
+ readonly mime: string;
4908
+ readonly name?: string | undefined;
4909
+ })[];
4910
+ } | undefined;
4911
+ readonly providerMetadata?: {
4912
+ readonly [x: string]: {
4913
+ readonly [x: string]: unknown;
4914
+ };
4915
+ } | undefined;
4916
+ readonly providerExecuted?: boolean | undefined;
4917
+ } | {
4918
+ readonly id: string;
4919
+ readonly type: "tool-error";
4920
+ readonly name: string;
4921
+ readonly message: string;
4922
+ readonly error?: unknown;
4923
+ readonly providerMetadata?: {
4924
+ readonly [x: string]: {
4925
+ readonly [x: string]: unknown;
4926
+ };
4927
+ } | undefined;
4928
+ } | {
4929
+ readonly type: "step-finish";
4930
+ readonly reason: {
4931
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4932
+ readonly raw?: string | undefined;
3161
4933
  };
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;
4934
+ readonly index: number;
4935
+ readonly providerMetadata?: {
4936
+ readonly [x: string]: {
4937
+ readonly [x: string]: unknown;
4938
+ };
4939
+ } | undefined;
4940
+ readonly usage?: Usage | undefined;
4941
+ } | {
4942
+ readonly type: "finish";
4943
+ readonly reason: {
4944
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
4945
+ readonly raw?: string | undefined;
3172
4946
  };
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 {
4947
+ readonly providerMetadata?: {
4948
+ readonly [x: string]: {
4949
+ readonly [x: string]: unknown;
4950
+ };
4951
+ } | undefined;
4952
+ readonly usage?: Usage | undefined;
4953
+ } | {
4954
+ readonly type: "provider-error";
4955
+ readonly message: string;
4956
+ readonly providerMetadata?: {
4957
+ readonly [x: string]: {
4958
+ readonly [x: string]: unknown;
4959
+ };
4960
+ } | undefined;
4961
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4962
+ }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
4963
+ <Cases extends {
4964
+ "step-start": (value: {
4965
+ readonly type: "step-start";
4966
+ readonly index: number;
4967
+ }) => any;
4968
+ "text-start": (value: {
4969
+ readonly id: string;
4970
+ readonly type: "text-start";
4971
+ readonly providerMetadata?: {
4972
+ readonly [x: string]: {
4973
+ readonly [x: string]: unknown;
4974
+ };
4975
+ } | undefined;
4976
+ }) => any;
4977
+ "text-delta": (value: {
4978
+ readonly id: string;
4979
+ readonly type: "text-delta";
4980
+ readonly text: string;
4981
+ readonly providerMetadata?: {
4982
+ readonly [x: string]: {
4983
+ readonly [x: string]: unknown;
4984
+ };
4985
+ } | undefined;
4986
+ }) => any;
4987
+ "text-end": (value: {
4988
+ readonly id: string;
4989
+ readonly type: "text-end";
4990
+ readonly providerMetadata?: {
4991
+ readonly [x: string]: {
4992
+ readonly [x: string]: unknown;
4993
+ };
4994
+ } | undefined;
4995
+ }) => any;
4996
+ "reasoning-start": (value: {
4997
+ readonly id: string;
4998
+ readonly type: "reasoning-start";
4999
+ readonly providerMetadata?: {
5000
+ readonly [x: string]: {
5001
+ readonly [x: string]: unknown;
5002
+ };
5003
+ } | undefined;
5004
+ }) => any;
5005
+ "reasoning-delta": (value: {
5006
+ readonly id: string;
5007
+ readonly type: "reasoning-delta";
5008
+ readonly text: string;
5009
+ readonly providerMetadata?: {
5010
+ readonly [x: string]: {
5011
+ readonly [x: string]: unknown;
5012
+ };
5013
+ } | undefined;
5014
+ }) => any;
5015
+ "reasoning-end": (value: {
5016
+ readonly id: string;
5017
+ readonly type: "reasoning-end";
5018
+ readonly providerMetadata?: {
5019
+ readonly [x: string]: {
5020
+ readonly [x: string]: unknown;
5021
+ };
5022
+ } | undefined;
5023
+ }) => any;
5024
+ "tool-input-start": (value: {
5025
+ readonly id: string;
5026
+ readonly type: "tool-input-start";
5027
+ readonly name: string;
5028
+ readonly providerMetadata?: {
5029
+ readonly [x: string]: {
5030
+ readonly [x: string]: unknown;
5031
+ };
5032
+ } | undefined;
5033
+ readonly providerExecuted?: boolean | undefined;
5034
+ }) => any;
5035
+ "tool-input-delta": (value: {
5036
+ readonly id: string;
5037
+ readonly type: "tool-input-delta";
5038
+ readonly name: string;
5039
+ readonly text: string;
5040
+ readonly input?: unknown;
5041
+ }) => any;
5042
+ "tool-input-end": (value: {
5043
+ readonly id: string;
5044
+ readonly type: "tool-input-end";
5045
+ readonly name: string;
5046
+ readonly providerMetadata?: {
5047
+ readonly [x: string]: {
5048
+ readonly [x: string]: unknown;
5049
+ };
5050
+ } | undefined;
5051
+ }) => any;
5052
+ "tool-input-error": (value: {
5053
+ readonly type: "tool-input-error";
5054
+ readonly id: string;
5055
+ readonly name: string;
5056
+ readonly raw: string;
5057
+ }) => any;
5058
+ "tool-call": (value: {
5059
+ readonly id: string;
5060
+ readonly type: "tool-call";
5061
+ readonly name: string;
5062
+ readonly input: unknown;
5063
+ readonly providerMetadata?: {
5064
+ readonly [x: string]: {
5065
+ readonly [x: string]: unknown;
5066
+ };
5067
+ } | undefined;
5068
+ readonly providerExecuted?: boolean | undefined;
5069
+ }) => any;
5070
+ "tool-result": (value: {
5071
+ readonly id: string;
5072
+ readonly type: "tool-result";
5073
+ readonly name: string;
5074
+ readonly result: {
5075
+ readonly type: "json";
5076
+ readonly value: unknown;
5077
+ } | {
5078
+ readonly type: "text";
5079
+ readonly value: unknown;
5080
+ } | {
5081
+ readonly type: "error";
5082
+ readonly value: unknown;
5083
+ } | {
5084
+ readonly type: "content";
5085
+ readonly value: readonly ({
5086
+ readonly type: "text";
5087
+ readonly text: string;
5088
+ } | {
5089
+ readonly type: "file";
5090
+ readonly uri: string;
5091
+ readonly mime: string;
5092
+ readonly name?: string | undefined;
5093
+ })[];
5094
+ };
5095
+ readonly output?: {
5096
+ readonly structured: unknown;
5097
+ readonly content: readonly ({
5098
+ readonly type: "text";
5099
+ readonly text: string;
5100
+ } | {
5101
+ readonly type: "file";
5102
+ readonly uri: string;
5103
+ readonly mime: string;
5104
+ readonly name?: string | undefined;
5105
+ })[];
5106
+ } | undefined;
5107
+ readonly providerMetadata?: {
5108
+ readonly [x: string]: {
5109
+ readonly [x: string]: unknown;
5110
+ };
5111
+ } | undefined;
5112
+ readonly providerExecuted?: boolean | undefined;
5113
+ }) => any;
5114
+ "tool-error": (value: {
5115
+ readonly id: string;
5116
+ readonly type: "tool-error";
5117
+ readonly name: string;
5118
+ readonly message: string;
5119
+ readonly error?: unknown;
5120
+ readonly providerMetadata?: {
5121
+ readonly [x: string]: {
5122
+ readonly [x: string]: unknown;
5123
+ };
5124
+ } | undefined;
5125
+ }) => any;
5126
+ "step-finish": (value: {
5127
+ readonly type: "step-finish";
5128
+ readonly reason: {
5129
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5130
+ readonly raw?: string | undefined;
5131
+ };
5132
+ readonly index: number;
5133
+ readonly providerMetadata?: {
5134
+ readonly [x: string]: {
5135
+ readonly [x: string]: unknown;
5136
+ };
5137
+ } | undefined;
5138
+ readonly usage?: Usage | undefined;
5139
+ }) => any;
5140
+ finish: (value: {
5141
+ readonly type: "finish";
5142
+ readonly reason: {
5143
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5144
+ readonly raw?: string | undefined;
5145
+ };
5146
+ readonly providerMetadata?: {
5147
+ readonly [x: string]: {
5148
+ readonly [x: string]: unknown;
5149
+ };
5150
+ } | undefined;
5151
+ readonly usage?: Usage | undefined;
5152
+ }) => any;
5153
+ "provider-error": (value: {
5154
+ readonly type: "provider-error";
5155
+ readonly message: string;
5156
+ readonly providerMetadata?: {
5157
+ readonly [x: string]: {
5158
+ readonly [x: string]: unknown;
5159
+ };
5160
+ } | undefined;
5161
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5162
+ }) => any;
5163
+ }>(cases: Cases): (value: {
3180
5164
  readonly type: "step-start";
3181
5165
  readonly index: number;
3182
- };
3183
- "text-start": (u: unknown) => u is {
5166
+ } | {
3184
5167
  readonly id: string;
3185
5168
  readonly type: "text-start";
3186
5169
  readonly providerMetadata?: {
@@ -3188,8 +5171,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3188
5171
  readonly [x: string]: unknown;
3189
5172
  };
3190
5173
  } | undefined;
3191
- };
3192
- "text-delta": (u: unknown) => u is {
5174
+ } | {
3193
5175
  readonly id: string;
3194
5176
  readonly type: "text-delta";
3195
5177
  readonly text: string;
@@ -3198,8 +5180,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3198
5180
  readonly [x: string]: unknown;
3199
5181
  };
3200
5182
  } | undefined;
3201
- };
3202
- "text-end": (u: unknown) => u is {
5183
+ } | {
3203
5184
  readonly id: string;
3204
5185
  readonly type: "text-end";
3205
5186
  readonly providerMetadata?: {
@@ -3207,8 +5188,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3207
5188
  readonly [x: string]: unknown;
3208
5189
  };
3209
5190
  } | undefined;
3210
- };
3211
- "reasoning-start": (u: unknown) => u is {
5191
+ } | {
3212
5192
  readonly id: string;
3213
5193
  readonly type: "reasoning-start";
3214
5194
  readonly providerMetadata?: {
@@ -3216,8 +5196,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3216
5196
  readonly [x: string]: unknown;
3217
5197
  };
3218
5198
  } | undefined;
3219
- };
3220
- "reasoning-delta": (u: unknown) => u is {
5199
+ } | {
3221
5200
  readonly id: string;
3222
5201
  readonly type: "reasoning-delta";
3223
5202
  readonly text: string;
@@ -3226,8 +5205,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3226
5205
  readonly [x: string]: unknown;
3227
5206
  };
3228
5207
  } | undefined;
3229
- };
3230
- "reasoning-end": (u: unknown) => u is {
5208
+ } | {
3231
5209
  readonly id: string;
3232
5210
  readonly type: "reasoning-end";
3233
5211
  readonly providerMetadata?: {
@@ -3235,8 +5213,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3235
5213
  readonly [x: string]: unknown;
3236
5214
  };
3237
5215
  } | undefined;
3238
- };
3239
- "tool-input-start": (u: unknown) => u is {
5216
+ } | {
3240
5217
  readonly id: string;
3241
5218
  readonly type: "tool-input-start";
3242
5219
  readonly name: string;
@@ -3246,15 +5223,13 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3246
5223
  };
3247
5224
  } | undefined;
3248
5225
  readonly providerExecuted?: boolean | undefined;
3249
- };
3250
- "tool-input-delta": (u: unknown) => u is {
5226
+ } | {
3251
5227
  readonly id: string;
3252
5228
  readonly type: "tool-input-delta";
3253
5229
  readonly name: string;
3254
5230
  readonly text: string;
3255
5231
  readonly input?: unknown;
3256
- };
3257
- "tool-input-end": (u: unknown) => u is {
5232
+ } | {
3258
5233
  readonly id: string;
3259
5234
  readonly type: "tool-input-end";
3260
5235
  readonly name: string;
@@ -3263,14 +5238,12 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3263
5238
  readonly [x: string]: unknown;
3264
5239
  };
3265
5240
  } | undefined;
3266
- };
3267
- "tool-input-error": (u: unknown) => u is {
5241
+ } | {
3268
5242
  readonly type: "tool-input-error";
3269
5243
  readonly id: string;
3270
5244
  readonly name: string;
3271
5245
  readonly raw: string;
3272
- };
3273
- "tool-call": (u: unknown) => u is {
5246
+ } | {
3274
5247
  readonly id: string;
3275
5248
  readonly type: "tool-call";
3276
5249
  readonly name: string;
@@ -3281,8 +5254,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3281
5254
  };
3282
5255
  } | undefined;
3283
5256
  readonly providerExecuted?: boolean | undefined;
3284
- };
3285
- "tool-result": (u: unknown) => u is {
5257
+ } | {
3286
5258
  readonly id: string;
3287
5259
  readonly type: "tool-result";
3288
5260
  readonly name: string;
@@ -3325,8 +5297,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3325
5297
  };
3326
5298
  } | undefined;
3327
5299
  readonly providerExecuted?: boolean | undefined;
3328
- };
3329
- "tool-error": (u: unknown) => u is {
5300
+ } | {
3330
5301
  readonly id: string;
3331
5302
  readonly type: "tool-error";
3332
5303
  readonly name: string;
@@ -3337,8 +5308,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3337
5308
  readonly [x: string]: unknown;
3338
5309
  };
3339
5310
  } | undefined;
3340
- };
3341
- "step-finish": (u: unknown) => u is {
5311
+ } | {
3342
5312
  readonly type: "step-finish";
3343
5313
  readonly reason: {
3344
5314
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3351,8 +5321,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3351
5321
  };
3352
5322
  } | undefined;
3353
5323
  readonly usage?: Usage | undefined;
3354
- };
3355
- finish: (u: unknown) => u is {
5324
+ } | {
3356
5325
  readonly type: "finish";
3357
5326
  readonly reason: {
3358
5327
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3364,8 +5333,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3364
5333
  };
3365
5334
  } | undefined;
3366
5335
  readonly usage?: Usage | undefined;
3367
- };
3368
- "provider-error": (u: unknown) => u is {
5336
+ } | {
3369
5337
  readonly type: "provider-error";
3370
5338
  readonly message: string;
3371
5339
  readonly providerMetadata?: {
@@ -3374,15 +5342,15 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3374
5342
  };
3375
5343
  } | undefined;
3376
5344
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3377
- };
5345
+ }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
3378
5346
  };
3379
- readonly match: {
5347
+ readonly matchOrElse: {
3380
5348
  <Cases extends {
3381
- "step-start": (value: {
5349
+ "step-start"?: ((value: {
3382
5350
  readonly type: "step-start";
3383
5351
  readonly index: number;
3384
- }) => any;
3385
- "text-start": (value: {
5352
+ }) => any) | undefined;
5353
+ "text-start"?: ((value: {
3386
5354
  readonly id: string;
3387
5355
  readonly type: "text-start";
3388
5356
  readonly providerMetadata?: {
@@ -3390,8 +5358,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3390
5358
  readonly [x: string]: unknown;
3391
5359
  };
3392
5360
  } | undefined;
3393
- }) => any;
3394
- "text-delta": (value: {
5361
+ }) => any) | undefined;
5362
+ "text-delta"?: ((value: {
3395
5363
  readonly id: string;
3396
5364
  readonly type: "text-delta";
3397
5365
  readonly text: string;
@@ -3400,8 +5368,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3400
5368
  readonly [x: string]: unknown;
3401
5369
  };
3402
5370
  } | undefined;
3403
- }) => any;
3404
- "text-end": (value: {
5371
+ }) => any) | undefined;
5372
+ "text-end"?: ((value: {
3405
5373
  readonly id: string;
3406
5374
  readonly type: "text-end";
3407
5375
  readonly providerMetadata?: {
@@ -3409,8 +5377,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3409
5377
  readonly [x: string]: unknown;
3410
5378
  };
3411
5379
  } | undefined;
3412
- }) => any;
3413
- "reasoning-start": (value: {
5380
+ }) => any) | undefined;
5381
+ "reasoning-start"?: ((value: {
3414
5382
  readonly id: string;
3415
5383
  readonly type: "reasoning-start";
3416
5384
  readonly providerMetadata?: {
@@ -3418,8 +5386,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3418
5386
  readonly [x: string]: unknown;
3419
5387
  };
3420
5388
  } | undefined;
3421
- }) => any;
3422
- "reasoning-delta": (value: {
5389
+ }) => any) | undefined;
5390
+ "reasoning-delta"?: ((value: {
3423
5391
  readonly id: string;
3424
5392
  readonly type: "reasoning-delta";
3425
5393
  readonly text: string;
@@ -3428,8 +5396,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3428
5396
  readonly [x: string]: unknown;
3429
5397
  };
3430
5398
  } | undefined;
3431
- }) => any;
3432
- "reasoning-end": (value: {
5399
+ }) => any) | undefined;
5400
+ "reasoning-end"?: ((value: {
3433
5401
  readonly id: string;
3434
5402
  readonly type: "reasoning-end";
3435
5403
  readonly providerMetadata?: {
@@ -3437,8 +5405,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3437
5405
  readonly [x: string]: unknown;
3438
5406
  };
3439
5407
  } | undefined;
3440
- }) => any;
3441
- "tool-input-start": (value: {
5408
+ }) => any) | undefined;
5409
+ "tool-input-start"?: ((value: {
3442
5410
  readonly id: string;
3443
5411
  readonly type: "tool-input-start";
3444
5412
  readonly name: string;
@@ -3448,15 +5416,15 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3448
5416
  };
3449
5417
  } | undefined;
3450
5418
  readonly providerExecuted?: boolean | undefined;
3451
- }) => any;
3452
- "tool-input-delta": (value: {
5419
+ }) => any) | undefined;
5420
+ "tool-input-delta"?: ((value: {
3453
5421
  readonly id: string;
3454
5422
  readonly type: "tool-input-delta";
3455
5423
  readonly name: string;
3456
5424
  readonly text: string;
3457
5425
  readonly input?: unknown;
3458
- }) => any;
3459
- "tool-input-end": (value: {
5426
+ }) => any) | undefined;
5427
+ "tool-input-end"?: ((value: {
3460
5428
  readonly id: string;
3461
5429
  readonly type: "tool-input-end";
3462
5430
  readonly name: string;
@@ -3465,14 +5433,14 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3465
5433
  readonly [x: string]: unknown;
3466
5434
  };
3467
5435
  } | undefined;
3468
- }) => any;
3469
- "tool-input-error": (value: {
5436
+ }) => any) | undefined;
5437
+ "tool-input-error"?: ((value: {
3470
5438
  readonly type: "tool-input-error";
3471
5439
  readonly id: string;
3472
5440
  readonly name: string;
3473
5441
  readonly raw: string;
3474
- }) => any;
3475
- "tool-call": (value: {
5442
+ }) => any) | undefined;
5443
+ "tool-call"?: ((value: {
3476
5444
  readonly id: string;
3477
5445
  readonly type: "tool-call";
3478
5446
  readonly name: string;
@@ -3483,8 +5451,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3483
5451
  };
3484
5452
  } | undefined;
3485
5453
  readonly providerExecuted?: boolean | undefined;
3486
- }) => any;
3487
- "tool-result": (value: {
5454
+ }) => any) | undefined;
5455
+ "tool-result"?: ((value: {
3488
5456
  readonly id: string;
3489
5457
  readonly type: "tool-result";
3490
5458
  readonly name: string;
@@ -3527,8 +5495,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3527
5495
  };
3528
5496
  } | undefined;
3529
5497
  readonly providerExecuted?: boolean | undefined;
3530
- }) => any;
3531
- "tool-error": (value: {
5498
+ }) => any) | undefined;
5499
+ "tool-error"?: ((value: {
3532
5500
  readonly id: string;
3533
5501
  readonly type: "tool-error";
3534
5502
  readonly name: string;
@@ -3539,45 +5507,261 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3539
5507
  readonly [x: string]: unknown;
3540
5508
  };
3541
5509
  } | undefined;
3542
- }) => any;
3543
- "step-finish": (value: {
5510
+ }) => any) | undefined;
5511
+ "step-finish"?: ((value: {
3544
5512
  readonly type: "step-finish";
3545
5513
  readonly reason: {
3546
5514
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
3547
5515
  readonly raw?: string | undefined;
3548
5516
  };
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;
5517
+ readonly index: number;
5518
+ readonly providerMetadata?: {
5519
+ readonly [x: string]: {
5520
+ readonly [x: string]: unknown;
5521
+ };
5522
+ } | undefined;
5523
+ readonly usage?: Usage | undefined;
5524
+ }) => any) | undefined;
5525
+ finish?: ((value: {
5526
+ readonly type: "finish";
5527
+ readonly reason: {
5528
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5529
+ readonly raw?: string | undefined;
5530
+ };
5531
+ readonly providerMetadata?: {
5532
+ readonly [x: string]: {
5533
+ readonly [x: string]: unknown;
5534
+ };
5535
+ } | undefined;
5536
+ readonly usage?: Usage | undefined;
5537
+ }) => any) | undefined;
5538
+ "provider-error"?: ((value: {
5539
+ readonly type: "provider-error";
5540
+ readonly message: string;
5541
+ readonly providerMetadata?: {
5542
+ readonly [x: string]: {
5543
+ readonly [x: string]: unknown;
5544
+ };
5545
+ } | undefined;
5546
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5547
+ }) => any) | undefined;
5548
+ } & { [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<{
5549
+ readonly type: "step-start";
5550
+ readonly index: number;
5551
+ }, {
5552
+ readonly type: keyof Cases;
5553
+ }> | Exclude<{
5554
+ readonly id: string;
5555
+ readonly type: "text-start";
5556
+ readonly providerMetadata?: {
5557
+ readonly [x: string]: {
5558
+ readonly [x: string]: unknown;
5559
+ };
5560
+ } | undefined;
5561
+ }, {
5562
+ readonly type: keyof Cases;
5563
+ }> | Exclude<{
5564
+ readonly id: string;
5565
+ readonly type: "text-delta";
5566
+ readonly text: string;
5567
+ readonly providerMetadata?: {
5568
+ readonly [x: string]: {
5569
+ readonly [x: string]: unknown;
5570
+ };
5571
+ } | undefined;
5572
+ }, {
5573
+ readonly type: keyof Cases;
5574
+ }> | Exclude<{
5575
+ readonly id: string;
5576
+ readonly type: "text-end";
5577
+ readonly providerMetadata?: {
5578
+ readonly [x: string]: {
5579
+ readonly [x: string]: unknown;
5580
+ };
5581
+ } | undefined;
5582
+ }, {
5583
+ readonly type: keyof Cases;
5584
+ }> | Exclude<{
5585
+ readonly id: string;
5586
+ readonly type: "reasoning-start";
5587
+ readonly providerMetadata?: {
5588
+ readonly [x: string]: {
5589
+ readonly [x: string]: unknown;
5590
+ };
5591
+ } | undefined;
5592
+ }, {
5593
+ readonly type: keyof Cases;
5594
+ }> | Exclude<{
5595
+ readonly id: string;
5596
+ readonly type: "reasoning-delta";
5597
+ readonly text: string;
5598
+ readonly providerMetadata?: {
5599
+ readonly [x: string]: {
5600
+ readonly [x: string]: unknown;
5601
+ };
5602
+ } | undefined;
5603
+ }, {
5604
+ readonly type: keyof Cases;
5605
+ }> | Exclude<{
5606
+ readonly id: string;
5607
+ readonly type: "reasoning-end";
5608
+ readonly providerMetadata?: {
5609
+ readonly [x: string]: {
5610
+ readonly [x: string]: unknown;
5611
+ };
5612
+ } | undefined;
5613
+ }, {
5614
+ readonly type: keyof Cases;
5615
+ }> | Exclude<{
5616
+ readonly id: string;
5617
+ readonly type: "tool-input-start";
5618
+ readonly name: string;
5619
+ readonly providerMetadata?: {
5620
+ readonly [x: string]: {
5621
+ readonly [x: string]: unknown;
5622
+ };
5623
+ } | undefined;
5624
+ readonly providerExecuted?: boolean | undefined;
5625
+ }, {
5626
+ readonly type: keyof Cases;
5627
+ }> | Exclude<{
5628
+ readonly id: string;
5629
+ readonly type: "tool-input-delta";
5630
+ readonly name: string;
5631
+ readonly text: string;
5632
+ readonly input?: unknown;
5633
+ }, {
5634
+ readonly type: keyof Cases;
5635
+ }> | Exclude<{
5636
+ readonly id: string;
5637
+ readonly type: "tool-input-end";
5638
+ readonly name: string;
5639
+ readonly providerMetadata?: {
5640
+ readonly [x: string]: {
5641
+ readonly [x: string]: unknown;
5642
+ };
5643
+ } | undefined;
5644
+ }, {
5645
+ readonly type: keyof Cases;
5646
+ }> | Exclude<{
5647
+ readonly type: "tool-input-error";
5648
+ readonly id: string;
5649
+ readonly name: string;
5650
+ readonly raw: string;
5651
+ }, {
5652
+ readonly type: keyof Cases;
5653
+ }> | Exclude<{
5654
+ readonly id: string;
5655
+ readonly type: "tool-call";
5656
+ readonly name: string;
5657
+ readonly input: unknown;
5658
+ readonly providerMetadata?: {
5659
+ readonly [x: string]: {
5660
+ readonly [x: string]: unknown;
5661
+ };
5662
+ } | undefined;
5663
+ readonly providerExecuted?: boolean | undefined;
5664
+ }, {
5665
+ readonly type: keyof Cases;
5666
+ }> | Exclude<{
5667
+ readonly id: string;
5668
+ readonly type: "tool-result";
5669
+ readonly name: string;
5670
+ readonly result: {
5671
+ readonly type: "json";
5672
+ readonly value: unknown;
5673
+ } | {
5674
+ readonly type: "text";
5675
+ readonly value: unknown;
5676
+ } | {
5677
+ readonly type: "error";
5678
+ readonly value: unknown;
5679
+ } | {
5680
+ readonly type: "content";
5681
+ readonly value: readonly ({
5682
+ readonly type: "text";
5683
+ readonly text: string;
5684
+ } | {
5685
+ readonly type: "file";
5686
+ readonly uri: string;
5687
+ readonly mime: string;
5688
+ readonly name?: string | undefined;
5689
+ })[];
5690
+ };
5691
+ readonly output?: {
5692
+ readonly structured: unknown;
5693
+ readonly content: readonly ({
5694
+ readonly type: "text";
5695
+ readonly text: string;
5696
+ } | {
5697
+ readonly type: "file";
5698
+ readonly uri: string;
5699
+ readonly mime: string;
5700
+ readonly name?: string | undefined;
5701
+ })[];
5702
+ } | undefined;
5703
+ readonly providerMetadata?: {
5704
+ readonly [x: string]: {
5705
+ readonly [x: string]: unknown;
5706
+ };
5707
+ } | undefined;
5708
+ readonly providerExecuted?: boolean | undefined;
5709
+ }, {
5710
+ readonly type: keyof Cases;
5711
+ }> | Exclude<{
5712
+ readonly id: string;
5713
+ readonly type: "tool-error";
5714
+ readonly name: string;
5715
+ readonly message: string;
5716
+ readonly error?: unknown;
5717
+ readonly providerMetadata?: {
5718
+ readonly [x: string]: {
5719
+ readonly [x: string]: unknown;
5720
+ };
5721
+ } | undefined;
5722
+ }, {
5723
+ readonly type: keyof Cases;
5724
+ }> | Exclude<{
5725
+ readonly type: "step-finish";
5726
+ readonly reason: {
5727
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5728
+ readonly raw?: string | undefined;
5729
+ };
5730
+ readonly index: number;
5731
+ readonly providerMetadata?: {
5732
+ readonly [x: string]: {
5733
+ readonly [x: string]: unknown;
5734
+ };
5735
+ } | undefined;
5736
+ readonly usage?: Usage | undefined;
5737
+ }, {
5738
+ readonly type: keyof Cases;
5739
+ }> | Exclude<{
5740
+ readonly type: "finish";
5741
+ readonly reason: {
5742
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
5743
+ readonly raw?: string | undefined;
5744
+ };
5745
+ readonly providerMetadata?: {
5746
+ readonly [x: string]: {
5747
+ readonly [x: string]: unknown;
3562
5748
  };
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: {
5749
+ } | undefined;
5750
+ readonly usage?: Usage | undefined;
5751
+ }, {
5752
+ readonly type: keyof Cases;
5753
+ }> | Exclude<{
5754
+ readonly type: "provider-error";
5755
+ readonly message: string;
5756
+ readonly providerMetadata?: {
5757
+ readonly [x: string]: {
5758
+ readonly [x: string]: unknown;
5759
+ };
5760
+ } | undefined;
5761
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
5762
+ }, {
5763
+ readonly type: keyof Cases;
5764
+ }>) => any>(value: {
3581
5765
  readonly type: "step-start";
3582
5766
  readonly index: number;
3583
5767
  } | {
@@ -3759,13 +5943,13 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3759
5943
  };
3760
5944
  } | undefined;
3761
5945
  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;
5946
+ }, 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
5947
  <Cases extends {
3764
- "step-start": (value: {
5948
+ "step-start"?: ((value: {
3765
5949
  readonly type: "step-start";
3766
5950
  readonly index: number;
3767
- }) => any;
3768
- "text-start": (value: {
5951
+ }) => any) | undefined;
5952
+ "text-start"?: ((value: {
3769
5953
  readonly id: string;
3770
5954
  readonly type: "text-start";
3771
5955
  readonly providerMetadata?: {
@@ -3773,8 +5957,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3773
5957
  readonly [x: string]: unknown;
3774
5958
  };
3775
5959
  } | undefined;
3776
- }) => any;
3777
- "text-delta": (value: {
5960
+ }) => any) | undefined;
5961
+ "text-delta"?: ((value: {
3778
5962
  readonly id: string;
3779
5963
  readonly type: "text-delta";
3780
5964
  readonly text: string;
@@ -3783,8 +5967,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3783
5967
  readonly [x: string]: unknown;
3784
5968
  };
3785
5969
  } | undefined;
3786
- }) => any;
3787
- "text-end": (value: {
5970
+ }) => any) | undefined;
5971
+ "text-end"?: ((value: {
3788
5972
  readonly id: string;
3789
5973
  readonly type: "text-end";
3790
5974
  readonly providerMetadata?: {
@@ -3792,8 +5976,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3792
5976
  readonly [x: string]: unknown;
3793
5977
  };
3794
5978
  } | undefined;
3795
- }) => any;
3796
- "reasoning-start": (value: {
5979
+ }) => any) | undefined;
5980
+ "reasoning-start"?: ((value: {
3797
5981
  readonly id: string;
3798
5982
  readonly type: "reasoning-start";
3799
5983
  readonly providerMetadata?: {
@@ -3801,8 +5985,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3801
5985
  readonly [x: string]: unknown;
3802
5986
  };
3803
5987
  } | undefined;
3804
- }) => any;
3805
- "reasoning-delta": (value: {
5988
+ }) => any) | undefined;
5989
+ "reasoning-delta"?: ((value: {
3806
5990
  readonly id: string;
3807
5991
  readonly type: "reasoning-delta";
3808
5992
  readonly text: string;
@@ -3811,8 +5995,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3811
5995
  readonly [x: string]: unknown;
3812
5996
  };
3813
5997
  } | undefined;
3814
- }) => any;
3815
- "reasoning-end": (value: {
5998
+ }) => any) | undefined;
5999
+ "reasoning-end"?: ((value: {
3816
6000
  readonly id: string;
3817
6001
  readonly type: "reasoning-end";
3818
6002
  readonly providerMetadata?: {
@@ -3820,8 +6004,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3820
6004
  readonly [x: string]: unknown;
3821
6005
  };
3822
6006
  } | undefined;
3823
- }) => any;
3824
- "tool-input-start": (value: {
6007
+ }) => any) | undefined;
6008
+ "tool-input-start"?: ((value: {
3825
6009
  readonly id: string;
3826
6010
  readonly type: "tool-input-start";
3827
6011
  readonly name: string;
@@ -3831,15 +6015,15 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3831
6015
  };
3832
6016
  } | undefined;
3833
6017
  readonly providerExecuted?: boolean | undefined;
3834
- }) => any;
3835
- "tool-input-delta": (value: {
6018
+ }) => any) | undefined;
6019
+ "tool-input-delta"?: ((value: {
3836
6020
  readonly id: string;
3837
6021
  readonly type: "tool-input-delta";
3838
6022
  readonly name: string;
3839
6023
  readonly text: string;
3840
6024
  readonly input?: unknown;
3841
- }) => any;
3842
- "tool-input-end": (value: {
6025
+ }) => any) | undefined;
6026
+ "tool-input-end"?: ((value: {
3843
6027
  readonly id: string;
3844
6028
  readonly type: "tool-input-end";
3845
6029
  readonly name: string;
@@ -3848,14 +6032,14 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3848
6032
  readonly [x: string]: unknown;
3849
6033
  };
3850
6034
  } | undefined;
3851
- }) => any;
3852
- "tool-input-error": (value: {
6035
+ }) => any) | undefined;
6036
+ "tool-input-error"?: ((value: {
3853
6037
  readonly type: "tool-input-error";
3854
6038
  readonly id: string;
3855
6039
  readonly name: string;
3856
6040
  readonly raw: string;
3857
- }) => any;
3858
- "tool-call": (value: {
6041
+ }) => any) | undefined;
6042
+ "tool-call"?: ((value: {
3859
6043
  readonly id: string;
3860
6044
  readonly type: "tool-call";
3861
6045
  readonly name: string;
@@ -3866,8 +6050,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3866
6050
  };
3867
6051
  } | undefined;
3868
6052
  readonly providerExecuted?: boolean | undefined;
3869
- }) => any;
3870
- "tool-result": (value: {
6053
+ }) => any) | undefined;
6054
+ "tool-result"?: ((value: {
3871
6055
  readonly id: string;
3872
6056
  readonly type: "tool-result";
3873
6057
  readonly name: string;
@@ -3910,8 +6094,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3910
6094
  };
3911
6095
  } | undefined;
3912
6096
  readonly providerExecuted?: boolean | undefined;
3913
- }) => any;
3914
- "tool-error": (value: {
6097
+ }) => any) | undefined;
6098
+ "tool-error"?: ((value: {
3915
6099
  readonly id: string;
3916
6100
  readonly type: "tool-error";
3917
6101
  readonly name: string;
@@ -3922,8 +6106,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3922
6106
  readonly [x: string]: unknown;
3923
6107
  };
3924
6108
  } | undefined;
3925
- }) => any;
3926
- "step-finish": (value: {
6109
+ }) => any) | undefined;
6110
+ "step-finish"?: ((value: {
3927
6111
  readonly type: "step-finish";
3928
6112
  readonly reason: {
3929
6113
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3936,8 +6120,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3936
6120
  };
3937
6121
  } | undefined;
3938
6122
  readonly usage?: Usage | undefined;
3939
- }) => any;
3940
- finish: (value: {
6123
+ }) => any) | undefined;
6124
+ finish?: ((value: {
3941
6125
  readonly type: "finish";
3942
6126
  readonly reason: {
3943
6127
  readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
@@ -3949,8 +6133,8 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3949
6133
  };
3950
6134
  } | undefined;
3951
6135
  readonly usage?: Usage | undefined;
3952
- }) => any;
3953
- "provider-error": (value: {
6136
+ }) => any) | undefined;
6137
+ "provider-error"?: ((value: {
3954
6138
  readonly type: "provider-error";
3955
6139
  readonly message: string;
3956
6140
  readonly providerMetadata?: {
@@ -3959,8 +6143,224 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
3959
6143
  };
3960
6144
  } | undefined;
3961
6145
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
3962
- }) => any;
3963
- }>(cases: Cases): (value: {
6146
+ }) => any) | undefined;
6147
+ } & { [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<{
6148
+ readonly type: "step-start";
6149
+ readonly index: number;
6150
+ }, {
6151
+ readonly type: keyof Cases;
6152
+ }> | Exclude<{
6153
+ readonly id: string;
6154
+ readonly type: "text-start";
6155
+ readonly providerMetadata?: {
6156
+ readonly [x: string]: {
6157
+ readonly [x: string]: unknown;
6158
+ };
6159
+ } | undefined;
6160
+ }, {
6161
+ readonly type: keyof Cases;
6162
+ }> | Exclude<{
6163
+ readonly id: string;
6164
+ readonly type: "text-delta";
6165
+ readonly text: string;
6166
+ readonly providerMetadata?: {
6167
+ readonly [x: string]: {
6168
+ readonly [x: string]: unknown;
6169
+ };
6170
+ } | undefined;
6171
+ }, {
6172
+ readonly type: keyof Cases;
6173
+ }> | Exclude<{
6174
+ readonly id: string;
6175
+ readonly type: "text-end";
6176
+ readonly providerMetadata?: {
6177
+ readonly [x: string]: {
6178
+ readonly [x: string]: unknown;
6179
+ };
6180
+ } | undefined;
6181
+ }, {
6182
+ readonly type: keyof Cases;
6183
+ }> | Exclude<{
6184
+ readonly id: string;
6185
+ readonly type: "reasoning-start";
6186
+ readonly providerMetadata?: {
6187
+ readonly [x: string]: {
6188
+ readonly [x: string]: unknown;
6189
+ };
6190
+ } | undefined;
6191
+ }, {
6192
+ readonly type: keyof Cases;
6193
+ }> | Exclude<{
6194
+ readonly id: string;
6195
+ readonly type: "reasoning-delta";
6196
+ readonly text: string;
6197
+ readonly providerMetadata?: {
6198
+ readonly [x: string]: {
6199
+ readonly [x: string]: unknown;
6200
+ };
6201
+ } | undefined;
6202
+ }, {
6203
+ readonly type: keyof Cases;
6204
+ }> | Exclude<{
6205
+ readonly id: string;
6206
+ readonly type: "reasoning-end";
6207
+ readonly providerMetadata?: {
6208
+ readonly [x: string]: {
6209
+ readonly [x: string]: unknown;
6210
+ };
6211
+ } | undefined;
6212
+ }, {
6213
+ readonly type: keyof Cases;
6214
+ }> | Exclude<{
6215
+ readonly id: string;
6216
+ readonly type: "tool-input-start";
6217
+ readonly name: string;
6218
+ readonly providerMetadata?: {
6219
+ readonly [x: string]: {
6220
+ readonly [x: string]: unknown;
6221
+ };
6222
+ } | undefined;
6223
+ readonly providerExecuted?: boolean | undefined;
6224
+ }, {
6225
+ readonly type: keyof Cases;
6226
+ }> | Exclude<{
6227
+ readonly id: string;
6228
+ readonly type: "tool-input-delta";
6229
+ readonly name: string;
6230
+ readonly text: string;
6231
+ readonly input?: unknown;
6232
+ }, {
6233
+ readonly type: keyof Cases;
6234
+ }> | Exclude<{
6235
+ readonly id: string;
6236
+ readonly type: "tool-input-end";
6237
+ readonly name: string;
6238
+ readonly providerMetadata?: {
6239
+ readonly [x: string]: {
6240
+ readonly [x: string]: unknown;
6241
+ };
6242
+ } | undefined;
6243
+ }, {
6244
+ readonly type: keyof Cases;
6245
+ }> | Exclude<{
6246
+ readonly type: "tool-input-error";
6247
+ readonly id: string;
6248
+ readonly name: string;
6249
+ readonly raw: string;
6250
+ }, {
6251
+ readonly type: keyof Cases;
6252
+ }> | Exclude<{
6253
+ readonly id: string;
6254
+ readonly type: "tool-call";
6255
+ readonly name: string;
6256
+ readonly input: unknown;
6257
+ readonly providerMetadata?: {
6258
+ readonly [x: string]: {
6259
+ readonly [x: string]: unknown;
6260
+ };
6261
+ } | undefined;
6262
+ readonly providerExecuted?: boolean | undefined;
6263
+ }, {
6264
+ readonly type: keyof Cases;
6265
+ }> | Exclude<{
6266
+ readonly id: string;
6267
+ readonly type: "tool-result";
6268
+ readonly name: string;
6269
+ readonly result: {
6270
+ readonly type: "json";
6271
+ readonly value: unknown;
6272
+ } | {
6273
+ readonly type: "text";
6274
+ readonly value: unknown;
6275
+ } | {
6276
+ readonly type: "error";
6277
+ readonly value: unknown;
6278
+ } | {
6279
+ readonly type: "content";
6280
+ readonly value: readonly ({
6281
+ readonly type: "text";
6282
+ readonly text: string;
6283
+ } | {
6284
+ readonly type: "file";
6285
+ readonly uri: string;
6286
+ readonly mime: string;
6287
+ readonly name?: string | undefined;
6288
+ })[];
6289
+ };
6290
+ readonly output?: {
6291
+ readonly structured: unknown;
6292
+ readonly content: readonly ({
6293
+ readonly type: "text";
6294
+ readonly text: string;
6295
+ } | {
6296
+ readonly type: "file";
6297
+ readonly uri: string;
6298
+ readonly mime: string;
6299
+ readonly name?: string | undefined;
6300
+ })[];
6301
+ } | undefined;
6302
+ readonly providerMetadata?: {
6303
+ readonly [x: string]: {
6304
+ readonly [x: string]: unknown;
6305
+ };
6306
+ } | undefined;
6307
+ readonly providerExecuted?: boolean | undefined;
6308
+ }, {
6309
+ readonly type: keyof Cases;
6310
+ }> | Exclude<{
6311
+ readonly id: string;
6312
+ readonly type: "tool-error";
6313
+ readonly name: string;
6314
+ readonly message: string;
6315
+ readonly error?: unknown;
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: "step-finish";
6325
+ readonly reason: {
6326
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
6327
+ readonly raw?: string | undefined;
6328
+ };
6329
+ readonly index: number;
6330
+ readonly providerMetadata?: {
6331
+ readonly [x: string]: {
6332
+ readonly [x: string]: unknown;
6333
+ };
6334
+ } | undefined;
6335
+ readonly usage?: Usage | undefined;
6336
+ }, {
6337
+ readonly type: keyof Cases;
6338
+ }> | Exclude<{
6339
+ readonly type: "finish";
6340
+ readonly reason: {
6341
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
6342
+ readonly raw?: string | undefined;
6343
+ };
6344
+ readonly providerMetadata?: {
6345
+ readonly [x: string]: {
6346
+ readonly [x: string]: unknown;
6347
+ };
6348
+ } | undefined;
6349
+ readonly usage?: Usage | undefined;
6350
+ }, {
6351
+ readonly type: keyof Cases;
6352
+ }> | Exclude<{
6353
+ readonly type: "provider-error";
6354
+ readonly message: string;
6355
+ readonly providerMetadata?: {
6356
+ readonly [x: string]: {
6357
+ readonly [x: string]: unknown;
6358
+ };
6359
+ } | undefined;
6360
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
6361
+ }, {
6362
+ readonly type: keyof Cases;
6363
+ }>) => any>(cases: Cases, orElse: OrElse): (value: {
3964
6364
  readonly type: "step-start";
3965
6365
  readonly index: number;
3966
6366
  } | {
@@ -4142,7 +6542,7 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
4142
6542
  };
4143
6543
  } | undefined;
4144
6544
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
4145
- }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
6545
+ }) => 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
6546
  };
4147
6547
  } & {
4148
6548
  stepStart: (input: {