@tinyweb_dev/agent-framework-llm 0.2.0 → 0.4.0
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.
- package/dist/cache-policy.d.ts +3 -0
- package/dist/cache-policy.d.ts.map +1 -0
- package/dist/index.cjs +2968 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2843 -0
- package/dist/index.js.map +1 -0
- package/dist/llm.cjs +1718 -0
- package/dist/llm.cjs.map +1 -0
- package/dist/llm.d.ts +284 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/llm.js +1692 -0
- package/dist/llm.js.map +1 -0
- package/dist/protocols/openai-chat.cjs +2455 -0
- package/dist/protocols/openai-chat.cjs.map +1 -0
- package/dist/protocols/openai-chat.d.ts +359 -0
- package/dist/protocols/openai-chat.d.ts.map +1 -0
- package/dist/protocols/openai-chat.js +2426 -0
- package/dist/protocols/openai-chat.js.map +1 -0
- package/dist/protocols/openai-compatible-chat.cjs +2455 -0
- package/dist/protocols/openai-compatible-chat.cjs.map +1 -0
- package/dist/protocols/openai-compatible-chat.d.ts +77 -0
- package/dist/protocols/openai-compatible-chat.d.ts.map +1 -0
- package/dist/protocols/openai-compatible-chat.js +2431 -0
- package/dist/protocols/openai-compatible-chat.js.map +1 -0
- package/dist/protocols/shared.cjs +904 -0
- package/dist/protocols/shared.cjs.map +1 -0
- package/dist/protocols/shared.d.ts +51 -0
- package/dist/protocols/shared.d.ts.map +1 -0
- package/dist/protocols/shared.js +857 -0
- package/dist/protocols/shared.js.map +1 -0
- package/dist/protocols/utils/openai-options.d.ts +15 -0
- package/dist/protocols/utils/openai-options.d.ts.map +1 -0
- package/dist/protocols/utils/tool-stream.d.ts +78 -0
- package/dist/protocols/utils/tool-stream.d.ts.map +1 -0
- package/dist/provider.cjs +20 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.ts +19 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +17 -0
- package/dist/provider.js.map +1 -0
- package/{src/providers/openai-compatible-profile.ts → dist/providers/openai-compatible-profile.cjs} +12 -12
- package/dist/providers/openai-compatible-profile.cjs.map +1 -0
- package/dist/providers/openai-compatible-profile.d.ts +52 -0
- package/dist/providers/openai-compatible-profile.d.ts.map +1 -0
- package/dist/providers/openai-compatible-profile.js +21 -0
- package/dist/providers/openai-compatible-profile.js.map +1 -0
- package/dist/providers/openai-compatible.cjs +2545 -0
- package/dist/providers/openai-compatible.cjs.map +1 -0
- package/dist/providers/openai-compatible.d.ts +128 -0
- package/dist/providers/openai-compatible.d.ts.map +1 -0
- package/dist/providers/openai-compatible.js +2507 -0
- package/dist/providers/openai-compatible.js.map +1 -0
- package/dist/providers/openai-options.cjs +797 -0
- package/dist/providers/openai-options.cjs.map +1 -0
- package/dist/providers/openai-options.d.ts +29 -0
- package/dist/providers/openai-options.d.ts.map +1 -0
- package/dist/providers/openai-options.js +792 -0
- package/dist/providers/openai-options.js.map +1 -0
- package/dist/providers/openai.cjs +2529 -0
- package/dist/providers/openai.cjs.map +1 -0
- package/dist/providers/openai.d.ts +87 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +2501 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/route/auth-options.cjs +855 -0
- package/dist/route/auth-options.cjs.map +1 -0
- package/dist/route/auth-options.d.ts +25 -0
- package/dist/route/auth-options.d.ts.map +1 -0
- package/dist/route/auth-options.js +852 -0
- package/dist/route/auth-options.js.map +1 -0
- package/dist/route/auth.cjs +855 -0
- package/dist/route/auth.cjs.map +1 -0
- package/dist/route/auth.d.ts +51 -0
- package/dist/route/auth.d.ts.map +1 -0
- package/dist/route/auth.js +836 -0
- package/dist/route/auth.js.map +1 -0
- package/dist/route/client.cjs +1844 -0
- package/dist/route/client.cjs.map +1 -0
- package/dist/route/client.d.ts +268 -0
- package/dist/route/client.d.ts.map +1 -0
- package/dist/route/client.js +1830 -0
- package/dist/route/client.js.map +1 -0
- package/dist/route/endpoint.cjs +756 -0
- package/dist/route/endpoint.cjs.map +1 -0
- package/dist/route/endpoint.d.ts +13 -0
- package/dist/route/endpoint.d.ts.map +1 -0
- package/dist/route/endpoint.js +752 -0
- package/dist/route/endpoint.js.map +1 -0
- package/dist/route/executor.cjs +1077 -0
- package/dist/route/executor.cjs.map +1 -0
- package/dist/route/executor.d.ts +13 -0
- package/dist/route/executor.d.ts.map +1 -0
- package/dist/route/executor.js +1072 -0
- package/dist/route/executor.js.map +1 -0
- package/dist/route/framing.cjs +773 -0
- package/dist/route/framing.cjs.map +1 -0
- package/dist/route/framing.d.ts +9 -0
- package/dist/route/framing.d.ts.map +1 -0
- package/dist/route/framing.js +750 -0
- package/dist/route/framing.js.map +1 -0
- package/dist/route/overflow-detect.d.ts +18 -0
- package/dist/route/overflow-detect.d.ts.map +1 -0
- package/dist/route/protocol.cjs +25 -0
- package/dist/route/protocol.cjs.map +1 -0
- package/dist/route/protocol.d.ts +40 -0
- package/dist/route/protocol.d.ts.map +1 -0
- package/dist/route/protocol.js +21 -0
- package/dist/route/protocol.js.map +1 -0
- package/dist/route/transport/http.d.ts +48 -0
- package/dist/route/transport/http.d.ts.map +1 -0
- package/dist/route/transport/index.cjs +969 -0
- package/dist/route/transport/index.cjs.map +1 -0
- package/dist/route/transport/index.d.ts +13 -0
- package/dist/route/transport/index.d.ts.map +1 -0
- package/dist/route/transport/index.js +967 -0
- package/dist/route/transport/index.js.map +1 -0
- package/dist/schema/errors.d.ts +181 -0
- package/dist/schema/errors.d.ts.map +1 -0
- package/dist/schema/events.d.ts +3224 -0
- package/dist/schema/events.d.ts.map +1 -0
- package/dist/schema/ids.d.ts +31 -0
- package/dist/schema/ids.d.ts.map +1 -0
- package/dist/schema/index.cjs +847 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +777 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/messages.d.ts +292 -0
- package/dist/schema/messages.d.ts.map +1 -0
- package/dist/schema/options.d.ts +123 -0
- package/dist/schema/options.d.ts.map +1 -0
- package/dist/tool-runtime.cjs +907 -0
- package/dist/tool-runtime.cjs.map +1 -0
- package/dist/tool-runtime.d.ts +50 -0
- package/dist/tool-runtime.d.ts.map +1 -0
- package/dist/tool-runtime.js +901 -0
- package/dist/tool-runtime.js.map +1 -0
- package/dist/tool.cjs +802 -0
- package/dist/tool.cjs.map +1 -0
- package/dist/tool.d.ts +111 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +796 -0
- package/dist/tool.js.map +1 -0
- package/package.json +112 -29
- package/src/cache-policy.ts +0 -92
- package/src/index.ts +0 -62
- package/src/llm.ts +0 -210
- package/src/protocols/openai-chat.ts +0 -464
- package/src/protocols/openai-compatible-chat.ts +0 -29
- package/src/protocols/shared.ts +0 -204
- package/src/protocols/utils/openai-options.ts +0 -56
- package/src/protocols/utils/tool-stream.ts +0 -135
- package/src/provider.ts +0 -32
- package/src/providers/openai-compatible.ts +0 -69
- package/src/providers/openai-options.ts +0 -71
- package/src/providers/openai.ts +0 -39
- package/src/route/auth-options.ts +0 -48
- package/src/route/auth.ts +0 -198
- package/src/route/client.ts +0 -459
- package/src/route/endpoint.ts +0 -28
- package/src/route/executor.ts +0 -396
- package/src/route/framing.ts +0 -13
- package/src/route/overflow-detect.ts +0 -74
- package/src/route/protocol.ts +0 -48
- package/src/route/transport/http.ts +0 -123
- package/src/route/transport/index.ts +0 -21
- package/src/schema/errors.ts +0 -225
- package/src/schema/events.ts +0 -335
- package/src/schema/ids.ts +0 -44
- package/src/schema/index.ts +0 -6
- package/src/schema/messages.ts +0 -250
- package/src/schema/options.ts +0 -231
- package/src/tool-runtime.ts +0 -301
- package/src/tool.ts +0 -212
|
@@ -0,0 +1,3224 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { ContentBlockID, ResponseID, ToolCallID } from "./ids";
|
|
3
|
+
import { ModelRef } from "./options";
|
|
4
|
+
import { ToolResultValue } from "./messages";
|
|
5
|
+
declare const Usage_base: Schema.Class<Usage, Schema.Struct<{
|
|
6
|
+
readonly inputTokens: Schema.optional<Schema.Number>;
|
|
7
|
+
readonly outputTokens: Schema.optional<Schema.Number>;
|
|
8
|
+
readonly nonCachedInputTokens: Schema.optional<Schema.Number>;
|
|
9
|
+
readonly cacheReadInputTokens: Schema.optional<Schema.Number>;
|
|
10
|
+
readonly cacheWriteInputTokens: Schema.optional<Schema.Number>;
|
|
11
|
+
readonly reasoningTokens: Schema.optional<Schema.Number>;
|
|
12
|
+
readonly totalTokens: Schema.optional<Schema.Number>;
|
|
13
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
14
|
+
}>, {}>;
|
|
15
|
+
/**
|
|
16
|
+
* Token usage reported by an LLM provider.
|
|
17
|
+
*
|
|
18
|
+
* **Inclusive totals** (match AI SDK / OpenAI / LangChain convention — a
|
|
19
|
+
* reader from any of those ecosystems sees the number they expect):
|
|
20
|
+
*
|
|
21
|
+
* - `inputTokens` — total prompt tokens, *including* cached reads/writes.
|
|
22
|
+
* - `outputTokens` — total output tokens, *including* reasoning.
|
|
23
|
+
* - `totalTokens` — provider-supplied total, or `inputTokens + outputTokens`.
|
|
24
|
+
*
|
|
25
|
+
* **Non-overlapping breakdown** (every field is independently meaningful;
|
|
26
|
+
* consumers never have to subtract):
|
|
27
|
+
*
|
|
28
|
+
* - `nonCachedInputTokens` — the "fresh" portion of the prompt.
|
|
29
|
+
* - `cacheReadInputTokens` — input tokens served from cache.
|
|
30
|
+
* - `cacheWriteInputTokens` — input tokens written to cache.
|
|
31
|
+
* - `reasoningTokens` — subset of `outputTokens` spent on hidden reasoning.
|
|
32
|
+
*
|
|
33
|
+
* **Invariant**: `nonCachedInputTokens + cacheReadInputTokens +
|
|
34
|
+
* cacheWriteInputTokens = inputTokens`, and `reasoningTokens ≤ outputTokens`.
|
|
35
|
+
*/
|
|
36
|
+
export declare class Usage extends Usage_base {
|
|
37
|
+
/**
|
|
38
|
+
* Visible output tokens — `outputTokens` minus `reasoningTokens`, clamped
|
|
39
|
+
* to zero. The one place subtraction happens in this contract; the clamp
|
|
40
|
+
* means a provider reporting `reasoningTokens > outputTokens` produces a
|
|
41
|
+
* harmless zero rather than a negative that crashes downstream schemas.
|
|
42
|
+
*/
|
|
43
|
+
get visibleOutputTokens(): number;
|
|
44
|
+
}
|
|
45
|
+
export declare const RequestStart: Schema.Struct<{
|
|
46
|
+
readonly type: Schema.tag<"request-start">;
|
|
47
|
+
readonly id: Schema.String;
|
|
48
|
+
readonly model: typeof ModelRef;
|
|
49
|
+
}>;
|
|
50
|
+
export type RequestStart = Schema.Schema.Type<typeof RequestStart>;
|
|
51
|
+
export declare const StepStart: Schema.Struct<{
|
|
52
|
+
readonly type: Schema.tag<"step-start">;
|
|
53
|
+
readonly index: Schema.Number;
|
|
54
|
+
}>;
|
|
55
|
+
export type StepStart = Schema.Schema.Type<typeof StepStart>;
|
|
56
|
+
export declare const TextStart: Schema.Struct<{
|
|
57
|
+
readonly type: Schema.tag<"text-start">;
|
|
58
|
+
readonly id: Schema.String;
|
|
59
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
60
|
+
}>;
|
|
61
|
+
export type TextStart = Schema.Schema.Type<typeof TextStart>;
|
|
62
|
+
export declare const TextDelta: Schema.Struct<{
|
|
63
|
+
readonly type: Schema.tag<"text-delta">;
|
|
64
|
+
readonly id: Schema.String;
|
|
65
|
+
readonly text: Schema.String;
|
|
66
|
+
}>;
|
|
67
|
+
export type TextDelta = Schema.Schema.Type<typeof TextDelta>;
|
|
68
|
+
export declare const TextEnd: Schema.Struct<{
|
|
69
|
+
readonly type: Schema.tag<"text-end">;
|
|
70
|
+
readonly id: Schema.String;
|
|
71
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
72
|
+
}>;
|
|
73
|
+
export type TextEnd = Schema.Schema.Type<typeof TextEnd>;
|
|
74
|
+
export declare const ReasoningStart: Schema.Struct<{
|
|
75
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
76
|
+
readonly id: Schema.String;
|
|
77
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
78
|
+
}>;
|
|
79
|
+
export type ReasoningStart = Schema.Schema.Type<typeof ReasoningStart>;
|
|
80
|
+
export declare const ReasoningDelta: Schema.Struct<{
|
|
81
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
82
|
+
readonly id: Schema.String;
|
|
83
|
+
readonly text: Schema.String;
|
|
84
|
+
}>;
|
|
85
|
+
export type ReasoningDelta = Schema.Schema.Type<typeof ReasoningDelta>;
|
|
86
|
+
export declare const ReasoningEnd: Schema.Struct<{
|
|
87
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
88
|
+
readonly id: Schema.String;
|
|
89
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
90
|
+
}>;
|
|
91
|
+
export type ReasoningEnd = Schema.Schema.Type<typeof ReasoningEnd>;
|
|
92
|
+
export declare const ToolInputStart: Schema.Struct<{
|
|
93
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
94
|
+
readonly id: Schema.String;
|
|
95
|
+
readonly name: Schema.String;
|
|
96
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
97
|
+
}>;
|
|
98
|
+
export type ToolInputStart = Schema.Schema.Type<typeof ToolInputStart>;
|
|
99
|
+
export declare const ToolInputDelta: Schema.Struct<{
|
|
100
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
101
|
+
readonly id: Schema.String;
|
|
102
|
+
readonly name: Schema.String;
|
|
103
|
+
readonly text: Schema.String;
|
|
104
|
+
}>;
|
|
105
|
+
export type ToolInputDelta = Schema.Schema.Type<typeof ToolInputDelta>;
|
|
106
|
+
export declare const ToolInputEnd: Schema.Struct<{
|
|
107
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
108
|
+
readonly id: Schema.String;
|
|
109
|
+
readonly name: Schema.String;
|
|
110
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
111
|
+
}>;
|
|
112
|
+
export type ToolInputEnd = Schema.Schema.Type<typeof ToolInputEnd>;
|
|
113
|
+
export declare const ToolCall: Schema.Struct<{
|
|
114
|
+
readonly type: Schema.tag<"tool-call">;
|
|
115
|
+
readonly id: Schema.String;
|
|
116
|
+
readonly name: Schema.String;
|
|
117
|
+
readonly input: Schema.Unknown;
|
|
118
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
119
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
120
|
+
}>;
|
|
121
|
+
export type ToolCall = Schema.Schema.Type<typeof ToolCall>;
|
|
122
|
+
export declare const ToolResult: Schema.Struct<{
|
|
123
|
+
readonly type: Schema.tag<"tool-result">;
|
|
124
|
+
readonly id: Schema.String;
|
|
125
|
+
readonly name: Schema.String;
|
|
126
|
+
readonly result: Schema.Struct<{
|
|
127
|
+
readonly type: Schema.Literals<readonly ["json", "text", "error"]>;
|
|
128
|
+
readonly value: Schema.Unknown;
|
|
129
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
130
|
+
}> & {
|
|
131
|
+
make: (value: unknown, type?: ToolResultValue["type"], metadata?: Record<string, unknown>) => ToolResultValue;
|
|
132
|
+
};
|
|
133
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
134
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
135
|
+
}>;
|
|
136
|
+
export type ToolResult = Schema.Schema.Type<typeof ToolResult>;
|
|
137
|
+
export declare const ToolError: Schema.Struct<{
|
|
138
|
+
readonly type: Schema.tag<"tool-error">;
|
|
139
|
+
readonly id: Schema.String;
|
|
140
|
+
readonly name: Schema.String;
|
|
141
|
+
readonly message: Schema.String;
|
|
142
|
+
/** Optional structured payload (e.g. tool-interrupt metadata for approval). */
|
|
143
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
144
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
145
|
+
}>;
|
|
146
|
+
export type ToolError = Schema.Schema.Type<typeof ToolError>;
|
|
147
|
+
export declare const StepFinish: Schema.Struct<{
|
|
148
|
+
readonly type: Schema.tag<"step-finish">;
|
|
149
|
+
readonly index: Schema.Number;
|
|
150
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
151
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
152
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
153
|
+
}>;
|
|
154
|
+
export type StepFinish = Schema.Schema.Type<typeof StepFinish>;
|
|
155
|
+
export declare const RequestFinish: Schema.Struct<{
|
|
156
|
+
readonly type: Schema.tag<"request-finish">;
|
|
157
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
158
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
159
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
160
|
+
}>;
|
|
161
|
+
export type RequestFinish = Schema.Schema.Type<typeof RequestFinish>;
|
|
162
|
+
export declare const ProviderErrorEvent: Schema.Struct<{
|
|
163
|
+
readonly type: Schema.tag<"provider-error">;
|
|
164
|
+
readonly message: Schema.String;
|
|
165
|
+
readonly retryable: Schema.optional<Schema.Boolean>;
|
|
166
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
167
|
+
}>;
|
|
168
|
+
export type ProviderErrorEvent = Schema.Schema.Type<typeof ProviderErrorEvent>;
|
|
169
|
+
declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
170
|
+
readonly type: Schema.tag<"request-start">;
|
|
171
|
+
readonly id: Schema.String;
|
|
172
|
+
readonly model: typeof ModelRef;
|
|
173
|
+
}>, Schema.Struct<{
|
|
174
|
+
readonly type: Schema.tag<"step-start">;
|
|
175
|
+
readonly index: Schema.Number;
|
|
176
|
+
}>, Schema.Struct<{
|
|
177
|
+
readonly type: Schema.tag<"text-start">;
|
|
178
|
+
readonly id: Schema.String;
|
|
179
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
180
|
+
}>, Schema.Struct<{
|
|
181
|
+
readonly type: Schema.tag<"text-delta">;
|
|
182
|
+
readonly id: Schema.String;
|
|
183
|
+
readonly text: Schema.String;
|
|
184
|
+
}>, Schema.Struct<{
|
|
185
|
+
readonly type: Schema.tag<"text-end">;
|
|
186
|
+
readonly id: Schema.String;
|
|
187
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
188
|
+
}>, Schema.Struct<{
|
|
189
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
190
|
+
readonly id: Schema.String;
|
|
191
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
192
|
+
}>, Schema.Struct<{
|
|
193
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
194
|
+
readonly id: Schema.String;
|
|
195
|
+
readonly text: Schema.String;
|
|
196
|
+
}>, Schema.Struct<{
|
|
197
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
198
|
+
readonly id: Schema.String;
|
|
199
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
200
|
+
}>, Schema.Struct<{
|
|
201
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
202
|
+
readonly id: Schema.String;
|
|
203
|
+
readonly name: Schema.String;
|
|
204
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
205
|
+
}>, Schema.Struct<{
|
|
206
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
207
|
+
readonly id: Schema.String;
|
|
208
|
+
readonly name: Schema.String;
|
|
209
|
+
readonly text: Schema.String;
|
|
210
|
+
}>, Schema.Struct<{
|
|
211
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
212
|
+
readonly id: Schema.String;
|
|
213
|
+
readonly name: Schema.String;
|
|
214
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
215
|
+
}>, Schema.Struct<{
|
|
216
|
+
readonly type: Schema.tag<"tool-call">;
|
|
217
|
+
readonly id: Schema.String;
|
|
218
|
+
readonly name: Schema.String;
|
|
219
|
+
readonly input: Schema.Unknown;
|
|
220
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
221
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
222
|
+
}>, Schema.Struct<{
|
|
223
|
+
readonly type: Schema.tag<"tool-result">;
|
|
224
|
+
readonly id: Schema.String;
|
|
225
|
+
readonly name: Schema.String;
|
|
226
|
+
readonly result: Schema.Struct<{
|
|
227
|
+
readonly type: Schema.Literals<readonly ["json", "text", "error"]>;
|
|
228
|
+
readonly value: Schema.Unknown;
|
|
229
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
230
|
+
}> & {
|
|
231
|
+
make: (value: unknown, type?: ToolResultValue["type"], metadata?: Record<string, unknown>) => ToolResultValue;
|
|
232
|
+
};
|
|
233
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
234
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
235
|
+
}>, Schema.Struct<{
|
|
236
|
+
readonly type: Schema.tag<"tool-error">;
|
|
237
|
+
readonly id: Schema.String;
|
|
238
|
+
readonly name: Schema.String;
|
|
239
|
+
readonly message: Schema.String;
|
|
240
|
+
/** Optional structured payload (e.g. tool-interrupt metadata for approval). */
|
|
241
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
242
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
243
|
+
}>, Schema.Struct<{
|
|
244
|
+
readonly type: Schema.tag<"step-finish">;
|
|
245
|
+
readonly index: Schema.Number;
|
|
246
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
247
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
248
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
249
|
+
}>, Schema.Struct<{
|
|
250
|
+
readonly type: Schema.tag<"request-finish">;
|
|
251
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
252
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
253
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
254
|
+
}>, Schema.Struct<{
|
|
255
|
+
readonly type: Schema.tag<"provider-error">;
|
|
256
|
+
readonly message: Schema.String;
|
|
257
|
+
readonly retryable: Schema.optional<Schema.Boolean>;
|
|
258
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
259
|
+
}>]>;
|
|
260
|
+
type WithID<Event extends {
|
|
261
|
+
readonly id: unknown;
|
|
262
|
+
}, ID> = Omit<Event, "type" | "id"> & {
|
|
263
|
+
readonly id: ID | string;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* camelCase aliases for `LLMEvent.guards` (provided by `Schema.toTaggedUnion`).
|
|
267
|
+
* Lets consumers write `events.filter(LLMEvent.is.toolCall)` instead of
|
|
268
|
+
* `events.filter(LLMEvent.guards["tool-call"])`.
|
|
269
|
+
*/
|
|
270
|
+
export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
|
|
271
|
+
readonly type: Schema.tag<"request-start">;
|
|
272
|
+
readonly id: Schema.String;
|
|
273
|
+
readonly model: typeof ModelRef;
|
|
274
|
+
}>, Schema.Struct<{
|
|
275
|
+
readonly type: Schema.tag<"step-start">;
|
|
276
|
+
readonly index: Schema.Number;
|
|
277
|
+
}>, Schema.Struct<{
|
|
278
|
+
readonly type: Schema.tag<"text-start">;
|
|
279
|
+
readonly id: Schema.String;
|
|
280
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
281
|
+
}>, Schema.Struct<{
|
|
282
|
+
readonly type: Schema.tag<"text-delta">;
|
|
283
|
+
readonly id: Schema.String;
|
|
284
|
+
readonly text: Schema.String;
|
|
285
|
+
}>, Schema.Struct<{
|
|
286
|
+
readonly type: Schema.tag<"text-end">;
|
|
287
|
+
readonly id: Schema.String;
|
|
288
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
289
|
+
}>, Schema.Struct<{
|
|
290
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
291
|
+
readonly id: Schema.String;
|
|
292
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
293
|
+
}>, Schema.Struct<{
|
|
294
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
295
|
+
readonly id: Schema.String;
|
|
296
|
+
readonly text: Schema.String;
|
|
297
|
+
}>, Schema.Struct<{
|
|
298
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
299
|
+
readonly id: Schema.String;
|
|
300
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
301
|
+
}>, Schema.Struct<{
|
|
302
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
303
|
+
readonly id: Schema.String;
|
|
304
|
+
readonly name: Schema.String;
|
|
305
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
306
|
+
}>, Schema.Struct<{
|
|
307
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
308
|
+
readonly id: Schema.String;
|
|
309
|
+
readonly name: Schema.String;
|
|
310
|
+
readonly text: Schema.String;
|
|
311
|
+
}>, Schema.Struct<{
|
|
312
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
313
|
+
readonly id: Schema.String;
|
|
314
|
+
readonly name: Schema.String;
|
|
315
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
316
|
+
}>, Schema.Struct<{
|
|
317
|
+
readonly type: Schema.tag<"tool-call">;
|
|
318
|
+
readonly id: Schema.String;
|
|
319
|
+
readonly name: Schema.String;
|
|
320
|
+
readonly input: Schema.Unknown;
|
|
321
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
322
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
323
|
+
}>, Schema.Struct<{
|
|
324
|
+
readonly type: Schema.tag<"tool-result">;
|
|
325
|
+
readonly id: Schema.String;
|
|
326
|
+
readonly name: Schema.String;
|
|
327
|
+
readonly result: Schema.Struct<{
|
|
328
|
+
readonly type: Schema.Literals<readonly ["json", "text", "error"]>;
|
|
329
|
+
readonly value: Schema.Unknown;
|
|
330
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
331
|
+
}> & {
|
|
332
|
+
make: (value: unknown, type?: ToolResultValue["type"], metadata?: Record<string, unknown>) => ToolResultValue;
|
|
333
|
+
};
|
|
334
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
335
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
336
|
+
}>, Schema.Struct<{
|
|
337
|
+
readonly type: Schema.tag<"tool-error">;
|
|
338
|
+
readonly id: Schema.String;
|
|
339
|
+
readonly name: Schema.String;
|
|
340
|
+
readonly message: Schema.String;
|
|
341
|
+
/** Optional structured payload (e.g. tool-interrupt metadata for approval). */
|
|
342
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
343
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
344
|
+
}>, Schema.Struct<{
|
|
345
|
+
readonly type: Schema.tag<"step-finish">;
|
|
346
|
+
readonly index: Schema.Number;
|
|
347
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
348
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
349
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
350
|
+
}>, Schema.Struct<{
|
|
351
|
+
readonly type: Schema.tag<"request-finish">;
|
|
352
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
353
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
354
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
355
|
+
}>, Schema.Struct<{
|
|
356
|
+
readonly type: Schema.tag<"provider-error">;
|
|
357
|
+
readonly message: Schema.String;
|
|
358
|
+
readonly retryable: Schema.optional<Schema.Boolean>;
|
|
359
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
360
|
+
}>]> & {
|
|
361
|
+
readonly cases: {
|
|
362
|
+
"request-start": Schema.Struct<{
|
|
363
|
+
readonly type: Schema.tag<"request-start">;
|
|
364
|
+
readonly id: Schema.String;
|
|
365
|
+
readonly model: typeof ModelRef;
|
|
366
|
+
}>;
|
|
367
|
+
"step-start": Schema.Struct<{
|
|
368
|
+
readonly type: Schema.tag<"step-start">;
|
|
369
|
+
readonly index: Schema.Number;
|
|
370
|
+
}>;
|
|
371
|
+
"text-start": Schema.Struct<{
|
|
372
|
+
readonly type: Schema.tag<"text-start">;
|
|
373
|
+
readonly id: Schema.String;
|
|
374
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
375
|
+
}>;
|
|
376
|
+
"text-delta": Schema.Struct<{
|
|
377
|
+
readonly type: Schema.tag<"text-delta">;
|
|
378
|
+
readonly id: Schema.String;
|
|
379
|
+
readonly text: Schema.String;
|
|
380
|
+
}>;
|
|
381
|
+
"text-end": Schema.Struct<{
|
|
382
|
+
readonly type: Schema.tag<"text-end">;
|
|
383
|
+
readonly id: Schema.String;
|
|
384
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
385
|
+
}>;
|
|
386
|
+
"reasoning-start": Schema.Struct<{
|
|
387
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
388
|
+
readonly id: Schema.String;
|
|
389
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
390
|
+
}>;
|
|
391
|
+
"reasoning-delta": Schema.Struct<{
|
|
392
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
393
|
+
readonly id: Schema.String;
|
|
394
|
+
readonly text: Schema.String;
|
|
395
|
+
}>;
|
|
396
|
+
"reasoning-end": Schema.Struct<{
|
|
397
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
398
|
+
readonly id: Schema.String;
|
|
399
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
400
|
+
}>;
|
|
401
|
+
"tool-input-start": Schema.Struct<{
|
|
402
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
403
|
+
readonly id: Schema.String;
|
|
404
|
+
readonly name: Schema.String;
|
|
405
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
406
|
+
}>;
|
|
407
|
+
"tool-input-delta": Schema.Struct<{
|
|
408
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
409
|
+
readonly id: Schema.String;
|
|
410
|
+
readonly name: Schema.String;
|
|
411
|
+
readonly text: Schema.String;
|
|
412
|
+
}>;
|
|
413
|
+
"tool-input-end": Schema.Struct<{
|
|
414
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
415
|
+
readonly id: Schema.String;
|
|
416
|
+
readonly name: Schema.String;
|
|
417
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
418
|
+
}>;
|
|
419
|
+
"tool-call": Schema.Struct<{
|
|
420
|
+
readonly type: Schema.tag<"tool-call">;
|
|
421
|
+
readonly id: Schema.String;
|
|
422
|
+
readonly name: Schema.String;
|
|
423
|
+
readonly input: Schema.Unknown;
|
|
424
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
425
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
426
|
+
}>;
|
|
427
|
+
"tool-result": Schema.Struct<{
|
|
428
|
+
readonly type: Schema.tag<"tool-result">;
|
|
429
|
+
readonly id: Schema.String;
|
|
430
|
+
readonly name: Schema.String;
|
|
431
|
+
readonly result: Schema.Struct<{
|
|
432
|
+
readonly type: Schema.Literals<readonly ["json", "text", "error"]>;
|
|
433
|
+
readonly value: Schema.Unknown;
|
|
434
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
435
|
+
}> & {
|
|
436
|
+
make: (value: unknown, type?: ToolResultValue["type"], metadata?: Record<string, unknown>) => ToolResultValue;
|
|
437
|
+
};
|
|
438
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
439
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
440
|
+
}>;
|
|
441
|
+
"tool-error": Schema.Struct<{
|
|
442
|
+
readonly type: Schema.tag<"tool-error">;
|
|
443
|
+
readonly id: Schema.String;
|
|
444
|
+
readonly name: Schema.String;
|
|
445
|
+
readonly message: Schema.String;
|
|
446
|
+
/** Optional structured payload (e.g. tool-interrupt metadata for approval). */
|
|
447
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
448
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
449
|
+
}>;
|
|
450
|
+
"step-finish": Schema.Struct<{
|
|
451
|
+
readonly type: Schema.tag<"step-finish">;
|
|
452
|
+
readonly index: Schema.Number;
|
|
453
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
454
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
455
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
456
|
+
}>;
|
|
457
|
+
"request-finish": Schema.Struct<{
|
|
458
|
+
readonly type: Schema.tag<"request-finish">;
|
|
459
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
460
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
461
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
462
|
+
}>;
|
|
463
|
+
"provider-error": Schema.Struct<{
|
|
464
|
+
readonly type: Schema.tag<"provider-error">;
|
|
465
|
+
readonly message: Schema.String;
|
|
466
|
+
readonly retryable: Schema.optional<Schema.Boolean>;
|
|
467
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
468
|
+
}>;
|
|
469
|
+
};
|
|
470
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
471
|
+
readonly id: string;
|
|
472
|
+
readonly type: "request-start";
|
|
473
|
+
readonly model: ModelRef;
|
|
474
|
+
} | {
|
|
475
|
+
readonly type: "step-start";
|
|
476
|
+
readonly index: number;
|
|
477
|
+
} | {
|
|
478
|
+
readonly id: string;
|
|
479
|
+
readonly type: "text-start";
|
|
480
|
+
readonly providerMetadata?: {
|
|
481
|
+
readonly [x: string]: {
|
|
482
|
+
readonly [x: string]: unknown;
|
|
483
|
+
};
|
|
484
|
+
} | undefined;
|
|
485
|
+
} | {
|
|
486
|
+
readonly id: string;
|
|
487
|
+
readonly type: "text-delta";
|
|
488
|
+
readonly text: string;
|
|
489
|
+
} | {
|
|
490
|
+
readonly id: string;
|
|
491
|
+
readonly type: "text-end";
|
|
492
|
+
readonly providerMetadata?: {
|
|
493
|
+
readonly [x: string]: {
|
|
494
|
+
readonly [x: string]: unknown;
|
|
495
|
+
};
|
|
496
|
+
} | undefined;
|
|
497
|
+
} | {
|
|
498
|
+
readonly id: string;
|
|
499
|
+
readonly type: "reasoning-start";
|
|
500
|
+
readonly providerMetadata?: {
|
|
501
|
+
readonly [x: string]: {
|
|
502
|
+
readonly [x: string]: unknown;
|
|
503
|
+
};
|
|
504
|
+
} | undefined;
|
|
505
|
+
} | {
|
|
506
|
+
readonly id: string;
|
|
507
|
+
readonly type: "reasoning-delta";
|
|
508
|
+
readonly text: string;
|
|
509
|
+
} | {
|
|
510
|
+
readonly id: string;
|
|
511
|
+
readonly type: "reasoning-end";
|
|
512
|
+
readonly providerMetadata?: {
|
|
513
|
+
readonly [x: string]: {
|
|
514
|
+
readonly [x: string]: unknown;
|
|
515
|
+
};
|
|
516
|
+
} | undefined;
|
|
517
|
+
} | {
|
|
518
|
+
readonly id: string;
|
|
519
|
+
readonly type: "tool-input-start";
|
|
520
|
+
readonly name: string;
|
|
521
|
+
readonly providerMetadata?: {
|
|
522
|
+
readonly [x: string]: {
|
|
523
|
+
readonly [x: string]: unknown;
|
|
524
|
+
};
|
|
525
|
+
} | undefined;
|
|
526
|
+
} | {
|
|
527
|
+
readonly id: string;
|
|
528
|
+
readonly type: "tool-input-delta";
|
|
529
|
+
readonly text: string;
|
|
530
|
+
readonly name: string;
|
|
531
|
+
} | {
|
|
532
|
+
readonly id: string;
|
|
533
|
+
readonly type: "tool-input-end";
|
|
534
|
+
readonly name: string;
|
|
535
|
+
readonly providerMetadata?: {
|
|
536
|
+
readonly [x: string]: {
|
|
537
|
+
readonly [x: string]: unknown;
|
|
538
|
+
};
|
|
539
|
+
} | undefined;
|
|
540
|
+
} | {
|
|
541
|
+
readonly id: string;
|
|
542
|
+
readonly type: "tool-call";
|
|
543
|
+
readonly name: string;
|
|
544
|
+
readonly input: unknown;
|
|
545
|
+
readonly providerMetadata?: {
|
|
546
|
+
readonly [x: string]: {
|
|
547
|
+
readonly [x: string]: unknown;
|
|
548
|
+
};
|
|
549
|
+
} | undefined;
|
|
550
|
+
readonly providerExecuted?: boolean | undefined;
|
|
551
|
+
} | {
|
|
552
|
+
readonly id: string;
|
|
553
|
+
readonly type: "tool-result";
|
|
554
|
+
readonly name: string;
|
|
555
|
+
readonly result: {
|
|
556
|
+
readonly type: "error" | "text" | "json";
|
|
557
|
+
readonly value: unknown;
|
|
558
|
+
readonly metadata?: {
|
|
559
|
+
readonly [x: string]: unknown;
|
|
560
|
+
} | undefined;
|
|
561
|
+
};
|
|
562
|
+
readonly providerMetadata?: {
|
|
563
|
+
readonly [x: string]: {
|
|
564
|
+
readonly [x: string]: unknown;
|
|
565
|
+
};
|
|
566
|
+
} | undefined;
|
|
567
|
+
readonly providerExecuted?: boolean | undefined;
|
|
568
|
+
} | {
|
|
569
|
+
readonly id: string;
|
|
570
|
+
readonly type: "tool-error";
|
|
571
|
+
readonly name: string;
|
|
572
|
+
readonly message: string;
|
|
573
|
+
readonly metadata?: {
|
|
574
|
+
readonly [x: string]: unknown;
|
|
575
|
+
} | undefined;
|
|
576
|
+
readonly providerMetadata?: {
|
|
577
|
+
readonly [x: string]: {
|
|
578
|
+
readonly [x: string]: unknown;
|
|
579
|
+
};
|
|
580
|
+
} | undefined;
|
|
581
|
+
} | {
|
|
582
|
+
readonly type: "step-finish";
|
|
583
|
+
readonly index: number;
|
|
584
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
585
|
+
readonly providerMetadata?: {
|
|
586
|
+
readonly [x: string]: {
|
|
587
|
+
readonly [x: string]: unknown;
|
|
588
|
+
};
|
|
589
|
+
} | undefined;
|
|
590
|
+
readonly usage?: Usage | undefined;
|
|
591
|
+
} | {
|
|
592
|
+
readonly type: "request-finish";
|
|
593
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
594
|
+
readonly providerMetadata?: {
|
|
595
|
+
readonly [x: string]: {
|
|
596
|
+
readonly [x: string]: unknown;
|
|
597
|
+
};
|
|
598
|
+
} | undefined;
|
|
599
|
+
readonly usage?: Usage | undefined;
|
|
600
|
+
} | {
|
|
601
|
+
readonly type: "provider-error";
|
|
602
|
+
readonly message: string;
|
|
603
|
+
readonly providerMetadata?: {
|
|
604
|
+
readonly [x: string]: {
|
|
605
|
+
readonly [x: string]: unknown;
|
|
606
|
+
};
|
|
607
|
+
} | undefined;
|
|
608
|
+
readonly retryable?: boolean | undefined;
|
|
609
|
+
}) => value is never;
|
|
610
|
+
readonly guards: {
|
|
611
|
+
"request-start": (u: unknown) => u is {
|
|
612
|
+
readonly id: string;
|
|
613
|
+
readonly type: "request-start";
|
|
614
|
+
readonly model: ModelRef;
|
|
615
|
+
};
|
|
616
|
+
"step-start": (u: unknown) => u is {
|
|
617
|
+
readonly type: "step-start";
|
|
618
|
+
readonly index: number;
|
|
619
|
+
};
|
|
620
|
+
"text-start": (u: unknown) => u is {
|
|
621
|
+
readonly id: string;
|
|
622
|
+
readonly type: "text-start";
|
|
623
|
+
readonly providerMetadata?: {
|
|
624
|
+
readonly [x: string]: {
|
|
625
|
+
readonly [x: string]: unknown;
|
|
626
|
+
};
|
|
627
|
+
} | undefined;
|
|
628
|
+
};
|
|
629
|
+
"text-delta": (u: unknown) => u is {
|
|
630
|
+
readonly id: string;
|
|
631
|
+
readonly type: "text-delta";
|
|
632
|
+
readonly text: string;
|
|
633
|
+
};
|
|
634
|
+
"text-end": (u: unknown) => u is {
|
|
635
|
+
readonly id: string;
|
|
636
|
+
readonly type: "text-end";
|
|
637
|
+
readonly providerMetadata?: {
|
|
638
|
+
readonly [x: string]: {
|
|
639
|
+
readonly [x: string]: unknown;
|
|
640
|
+
};
|
|
641
|
+
} | undefined;
|
|
642
|
+
};
|
|
643
|
+
"reasoning-start": (u: unknown) => u is {
|
|
644
|
+
readonly id: string;
|
|
645
|
+
readonly type: "reasoning-start";
|
|
646
|
+
readonly providerMetadata?: {
|
|
647
|
+
readonly [x: string]: {
|
|
648
|
+
readonly [x: string]: unknown;
|
|
649
|
+
};
|
|
650
|
+
} | undefined;
|
|
651
|
+
};
|
|
652
|
+
"reasoning-delta": (u: unknown) => u is {
|
|
653
|
+
readonly id: string;
|
|
654
|
+
readonly type: "reasoning-delta";
|
|
655
|
+
readonly text: string;
|
|
656
|
+
};
|
|
657
|
+
"reasoning-end": (u: unknown) => u is {
|
|
658
|
+
readonly id: string;
|
|
659
|
+
readonly type: "reasoning-end";
|
|
660
|
+
readonly providerMetadata?: {
|
|
661
|
+
readonly [x: string]: {
|
|
662
|
+
readonly [x: string]: unknown;
|
|
663
|
+
};
|
|
664
|
+
} | undefined;
|
|
665
|
+
};
|
|
666
|
+
"tool-input-start": (u: unknown) => u is {
|
|
667
|
+
readonly id: string;
|
|
668
|
+
readonly type: "tool-input-start";
|
|
669
|
+
readonly name: string;
|
|
670
|
+
readonly providerMetadata?: {
|
|
671
|
+
readonly [x: string]: {
|
|
672
|
+
readonly [x: string]: unknown;
|
|
673
|
+
};
|
|
674
|
+
} | undefined;
|
|
675
|
+
};
|
|
676
|
+
"tool-input-delta": (u: unknown) => u is {
|
|
677
|
+
readonly id: string;
|
|
678
|
+
readonly type: "tool-input-delta";
|
|
679
|
+
readonly text: string;
|
|
680
|
+
readonly name: string;
|
|
681
|
+
};
|
|
682
|
+
"tool-input-end": (u: unknown) => u is {
|
|
683
|
+
readonly id: string;
|
|
684
|
+
readonly type: "tool-input-end";
|
|
685
|
+
readonly name: string;
|
|
686
|
+
readonly providerMetadata?: {
|
|
687
|
+
readonly [x: string]: {
|
|
688
|
+
readonly [x: string]: unknown;
|
|
689
|
+
};
|
|
690
|
+
} | undefined;
|
|
691
|
+
};
|
|
692
|
+
"tool-call": (u: unknown) => u is {
|
|
693
|
+
readonly id: string;
|
|
694
|
+
readonly type: "tool-call";
|
|
695
|
+
readonly name: string;
|
|
696
|
+
readonly input: unknown;
|
|
697
|
+
readonly providerMetadata?: {
|
|
698
|
+
readonly [x: string]: {
|
|
699
|
+
readonly [x: string]: unknown;
|
|
700
|
+
};
|
|
701
|
+
} | undefined;
|
|
702
|
+
readonly providerExecuted?: boolean | undefined;
|
|
703
|
+
};
|
|
704
|
+
"tool-result": (u: unknown) => u is {
|
|
705
|
+
readonly id: string;
|
|
706
|
+
readonly type: "tool-result";
|
|
707
|
+
readonly name: string;
|
|
708
|
+
readonly result: {
|
|
709
|
+
readonly type: "error" | "text" | "json";
|
|
710
|
+
readonly value: unknown;
|
|
711
|
+
readonly metadata?: {
|
|
712
|
+
readonly [x: string]: unknown;
|
|
713
|
+
} | undefined;
|
|
714
|
+
};
|
|
715
|
+
readonly providerMetadata?: {
|
|
716
|
+
readonly [x: string]: {
|
|
717
|
+
readonly [x: string]: unknown;
|
|
718
|
+
};
|
|
719
|
+
} | undefined;
|
|
720
|
+
readonly providerExecuted?: boolean | undefined;
|
|
721
|
+
};
|
|
722
|
+
"tool-error": (u: unknown) => u is {
|
|
723
|
+
readonly id: string;
|
|
724
|
+
readonly type: "tool-error";
|
|
725
|
+
readonly name: string;
|
|
726
|
+
readonly message: string;
|
|
727
|
+
readonly metadata?: {
|
|
728
|
+
readonly [x: string]: unknown;
|
|
729
|
+
} | undefined;
|
|
730
|
+
readonly providerMetadata?: {
|
|
731
|
+
readonly [x: string]: {
|
|
732
|
+
readonly [x: string]: unknown;
|
|
733
|
+
};
|
|
734
|
+
} | undefined;
|
|
735
|
+
};
|
|
736
|
+
"step-finish": (u: unknown) => u is {
|
|
737
|
+
readonly type: "step-finish";
|
|
738
|
+
readonly index: number;
|
|
739
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
740
|
+
readonly providerMetadata?: {
|
|
741
|
+
readonly [x: string]: {
|
|
742
|
+
readonly [x: string]: unknown;
|
|
743
|
+
};
|
|
744
|
+
} | undefined;
|
|
745
|
+
readonly usage?: Usage | undefined;
|
|
746
|
+
};
|
|
747
|
+
"request-finish": (u: unknown) => u is {
|
|
748
|
+
readonly type: "request-finish";
|
|
749
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
750
|
+
readonly providerMetadata?: {
|
|
751
|
+
readonly [x: string]: {
|
|
752
|
+
readonly [x: string]: unknown;
|
|
753
|
+
};
|
|
754
|
+
} | undefined;
|
|
755
|
+
readonly usage?: Usage | undefined;
|
|
756
|
+
};
|
|
757
|
+
"provider-error": (u: unknown) => u is {
|
|
758
|
+
readonly type: "provider-error";
|
|
759
|
+
readonly message: string;
|
|
760
|
+
readonly providerMetadata?: {
|
|
761
|
+
readonly [x: string]: {
|
|
762
|
+
readonly [x: string]: unknown;
|
|
763
|
+
};
|
|
764
|
+
} | undefined;
|
|
765
|
+
readonly retryable?: boolean | undefined;
|
|
766
|
+
};
|
|
767
|
+
};
|
|
768
|
+
readonly match: {
|
|
769
|
+
<Cases extends {
|
|
770
|
+
"request-start": (value: {
|
|
771
|
+
readonly id: string;
|
|
772
|
+
readonly type: "request-start";
|
|
773
|
+
readonly model: ModelRef;
|
|
774
|
+
}) => any;
|
|
775
|
+
"step-start": (value: {
|
|
776
|
+
readonly type: "step-start";
|
|
777
|
+
readonly index: number;
|
|
778
|
+
}) => any;
|
|
779
|
+
"text-start": (value: {
|
|
780
|
+
readonly id: string;
|
|
781
|
+
readonly type: "text-start";
|
|
782
|
+
readonly providerMetadata?: {
|
|
783
|
+
readonly [x: string]: {
|
|
784
|
+
readonly [x: string]: unknown;
|
|
785
|
+
};
|
|
786
|
+
} | undefined;
|
|
787
|
+
}) => any;
|
|
788
|
+
"text-delta": (value: {
|
|
789
|
+
readonly id: string;
|
|
790
|
+
readonly type: "text-delta";
|
|
791
|
+
readonly text: string;
|
|
792
|
+
}) => any;
|
|
793
|
+
"text-end": (value: {
|
|
794
|
+
readonly id: string;
|
|
795
|
+
readonly type: "text-end";
|
|
796
|
+
readonly providerMetadata?: {
|
|
797
|
+
readonly [x: string]: {
|
|
798
|
+
readonly [x: string]: unknown;
|
|
799
|
+
};
|
|
800
|
+
} | undefined;
|
|
801
|
+
}) => any;
|
|
802
|
+
"reasoning-start": (value: {
|
|
803
|
+
readonly id: string;
|
|
804
|
+
readonly type: "reasoning-start";
|
|
805
|
+
readonly providerMetadata?: {
|
|
806
|
+
readonly [x: string]: {
|
|
807
|
+
readonly [x: string]: unknown;
|
|
808
|
+
};
|
|
809
|
+
} | undefined;
|
|
810
|
+
}) => any;
|
|
811
|
+
"reasoning-delta": (value: {
|
|
812
|
+
readonly id: string;
|
|
813
|
+
readonly type: "reasoning-delta";
|
|
814
|
+
readonly text: string;
|
|
815
|
+
}) => any;
|
|
816
|
+
"reasoning-end": (value: {
|
|
817
|
+
readonly id: string;
|
|
818
|
+
readonly type: "reasoning-end";
|
|
819
|
+
readonly providerMetadata?: {
|
|
820
|
+
readonly [x: string]: {
|
|
821
|
+
readonly [x: string]: unknown;
|
|
822
|
+
};
|
|
823
|
+
} | undefined;
|
|
824
|
+
}) => any;
|
|
825
|
+
"tool-input-start": (value: {
|
|
826
|
+
readonly id: string;
|
|
827
|
+
readonly type: "tool-input-start";
|
|
828
|
+
readonly name: string;
|
|
829
|
+
readonly providerMetadata?: {
|
|
830
|
+
readonly [x: string]: {
|
|
831
|
+
readonly [x: string]: unknown;
|
|
832
|
+
};
|
|
833
|
+
} | undefined;
|
|
834
|
+
}) => any;
|
|
835
|
+
"tool-input-delta": (value: {
|
|
836
|
+
readonly id: string;
|
|
837
|
+
readonly type: "tool-input-delta";
|
|
838
|
+
readonly text: string;
|
|
839
|
+
readonly name: string;
|
|
840
|
+
}) => any;
|
|
841
|
+
"tool-input-end": (value: {
|
|
842
|
+
readonly id: string;
|
|
843
|
+
readonly type: "tool-input-end";
|
|
844
|
+
readonly name: string;
|
|
845
|
+
readonly providerMetadata?: {
|
|
846
|
+
readonly [x: string]: {
|
|
847
|
+
readonly [x: string]: unknown;
|
|
848
|
+
};
|
|
849
|
+
} | undefined;
|
|
850
|
+
}) => any;
|
|
851
|
+
"tool-call": (value: {
|
|
852
|
+
readonly id: string;
|
|
853
|
+
readonly type: "tool-call";
|
|
854
|
+
readonly name: string;
|
|
855
|
+
readonly input: unknown;
|
|
856
|
+
readonly providerMetadata?: {
|
|
857
|
+
readonly [x: string]: {
|
|
858
|
+
readonly [x: string]: unknown;
|
|
859
|
+
};
|
|
860
|
+
} | undefined;
|
|
861
|
+
readonly providerExecuted?: boolean | undefined;
|
|
862
|
+
}) => any;
|
|
863
|
+
"tool-result": (value: {
|
|
864
|
+
readonly id: string;
|
|
865
|
+
readonly type: "tool-result";
|
|
866
|
+
readonly name: string;
|
|
867
|
+
readonly result: {
|
|
868
|
+
readonly type: "error" | "text" | "json";
|
|
869
|
+
readonly value: unknown;
|
|
870
|
+
readonly metadata?: {
|
|
871
|
+
readonly [x: string]: unknown;
|
|
872
|
+
} | undefined;
|
|
873
|
+
};
|
|
874
|
+
readonly providerMetadata?: {
|
|
875
|
+
readonly [x: string]: {
|
|
876
|
+
readonly [x: string]: unknown;
|
|
877
|
+
};
|
|
878
|
+
} | undefined;
|
|
879
|
+
readonly providerExecuted?: boolean | undefined;
|
|
880
|
+
}) => any;
|
|
881
|
+
"tool-error": (value: {
|
|
882
|
+
readonly id: string;
|
|
883
|
+
readonly type: "tool-error";
|
|
884
|
+
readonly name: string;
|
|
885
|
+
readonly message: string;
|
|
886
|
+
readonly metadata?: {
|
|
887
|
+
readonly [x: string]: unknown;
|
|
888
|
+
} | undefined;
|
|
889
|
+
readonly providerMetadata?: {
|
|
890
|
+
readonly [x: string]: {
|
|
891
|
+
readonly [x: string]: unknown;
|
|
892
|
+
};
|
|
893
|
+
} | undefined;
|
|
894
|
+
}) => any;
|
|
895
|
+
"step-finish": (value: {
|
|
896
|
+
readonly type: "step-finish";
|
|
897
|
+
readonly index: number;
|
|
898
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
899
|
+
readonly providerMetadata?: {
|
|
900
|
+
readonly [x: string]: {
|
|
901
|
+
readonly [x: string]: unknown;
|
|
902
|
+
};
|
|
903
|
+
} | undefined;
|
|
904
|
+
readonly usage?: Usage | undefined;
|
|
905
|
+
}) => any;
|
|
906
|
+
"request-finish": (value: {
|
|
907
|
+
readonly type: "request-finish";
|
|
908
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
909
|
+
readonly providerMetadata?: {
|
|
910
|
+
readonly [x: string]: {
|
|
911
|
+
readonly [x: string]: unknown;
|
|
912
|
+
};
|
|
913
|
+
} | undefined;
|
|
914
|
+
readonly usage?: Usage | undefined;
|
|
915
|
+
}) => any;
|
|
916
|
+
"provider-error": (value: {
|
|
917
|
+
readonly type: "provider-error";
|
|
918
|
+
readonly message: string;
|
|
919
|
+
readonly providerMetadata?: {
|
|
920
|
+
readonly [x: string]: {
|
|
921
|
+
readonly [x: string]: unknown;
|
|
922
|
+
};
|
|
923
|
+
} | undefined;
|
|
924
|
+
readonly retryable?: boolean | undefined;
|
|
925
|
+
}) => any;
|
|
926
|
+
}>(value: {
|
|
927
|
+
readonly id: string;
|
|
928
|
+
readonly type: "request-start";
|
|
929
|
+
readonly model: ModelRef;
|
|
930
|
+
} | {
|
|
931
|
+
readonly type: "step-start";
|
|
932
|
+
readonly index: number;
|
|
933
|
+
} | {
|
|
934
|
+
readonly id: string;
|
|
935
|
+
readonly type: "text-start";
|
|
936
|
+
readonly providerMetadata?: {
|
|
937
|
+
readonly [x: string]: {
|
|
938
|
+
readonly [x: string]: unknown;
|
|
939
|
+
};
|
|
940
|
+
} | undefined;
|
|
941
|
+
} | {
|
|
942
|
+
readonly id: string;
|
|
943
|
+
readonly type: "text-delta";
|
|
944
|
+
readonly text: string;
|
|
945
|
+
} | {
|
|
946
|
+
readonly id: string;
|
|
947
|
+
readonly type: "text-end";
|
|
948
|
+
readonly providerMetadata?: {
|
|
949
|
+
readonly [x: string]: {
|
|
950
|
+
readonly [x: string]: unknown;
|
|
951
|
+
};
|
|
952
|
+
} | undefined;
|
|
953
|
+
} | {
|
|
954
|
+
readonly id: string;
|
|
955
|
+
readonly type: "reasoning-start";
|
|
956
|
+
readonly providerMetadata?: {
|
|
957
|
+
readonly [x: string]: {
|
|
958
|
+
readonly [x: string]: unknown;
|
|
959
|
+
};
|
|
960
|
+
} | undefined;
|
|
961
|
+
} | {
|
|
962
|
+
readonly id: string;
|
|
963
|
+
readonly type: "reasoning-delta";
|
|
964
|
+
readonly text: string;
|
|
965
|
+
} | {
|
|
966
|
+
readonly id: string;
|
|
967
|
+
readonly type: "reasoning-end";
|
|
968
|
+
readonly providerMetadata?: {
|
|
969
|
+
readonly [x: string]: {
|
|
970
|
+
readonly [x: string]: unknown;
|
|
971
|
+
};
|
|
972
|
+
} | undefined;
|
|
973
|
+
} | {
|
|
974
|
+
readonly id: string;
|
|
975
|
+
readonly type: "tool-input-start";
|
|
976
|
+
readonly name: string;
|
|
977
|
+
readonly providerMetadata?: {
|
|
978
|
+
readonly [x: string]: {
|
|
979
|
+
readonly [x: string]: unknown;
|
|
980
|
+
};
|
|
981
|
+
} | undefined;
|
|
982
|
+
} | {
|
|
983
|
+
readonly id: string;
|
|
984
|
+
readonly type: "tool-input-delta";
|
|
985
|
+
readonly text: string;
|
|
986
|
+
readonly name: string;
|
|
987
|
+
} | {
|
|
988
|
+
readonly id: string;
|
|
989
|
+
readonly type: "tool-input-end";
|
|
990
|
+
readonly name: string;
|
|
991
|
+
readonly providerMetadata?: {
|
|
992
|
+
readonly [x: string]: {
|
|
993
|
+
readonly [x: string]: unknown;
|
|
994
|
+
};
|
|
995
|
+
} | undefined;
|
|
996
|
+
} | {
|
|
997
|
+
readonly id: string;
|
|
998
|
+
readonly type: "tool-call";
|
|
999
|
+
readonly name: string;
|
|
1000
|
+
readonly input: unknown;
|
|
1001
|
+
readonly providerMetadata?: {
|
|
1002
|
+
readonly [x: string]: {
|
|
1003
|
+
readonly [x: string]: unknown;
|
|
1004
|
+
};
|
|
1005
|
+
} | undefined;
|
|
1006
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1007
|
+
} | {
|
|
1008
|
+
readonly id: string;
|
|
1009
|
+
readonly type: "tool-result";
|
|
1010
|
+
readonly name: string;
|
|
1011
|
+
readonly result: {
|
|
1012
|
+
readonly type: "error" | "text" | "json";
|
|
1013
|
+
readonly value: unknown;
|
|
1014
|
+
readonly metadata?: {
|
|
1015
|
+
readonly [x: string]: unknown;
|
|
1016
|
+
} | undefined;
|
|
1017
|
+
};
|
|
1018
|
+
readonly providerMetadata?: {
|
|
1019
|
+
readonly [x: string]: {
|
|
1020
|
+
readonly [x: string]: unknown;
|
|
1021
|
+
};
|
|
1022
|
+
} | undefined;
|
|
1023
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1024
|
+
} | {
|
|
1025
|
+
readonly id: string;
|
|
1026
|
+
readonly type: "tool-error";
|
|
1027
|
+
readonly name: string;
|
|
1028
|
+
readonly message: string;
|
|
1029
|
+
readonly metadata?: {
|
|
1030
|
+
readonly [x: string]: unknown;
|
|
1031
|
+
} | undefined;
|
|
1032
|
+
readonly providerMetadata?: {
|
|
1033
|
+
readonly [x: string]: {
|
|
1034
|
+
readonly [x: string]: unknown;
|
|
1035
|
+
};
|
|
1036
|
+
} | undefined;
|
|
1037
|
+
} | {
|
|
1038
|
+
readonly type: "step-finish";
|
|
1039
|
+
readonly index: number;
|
|
1040
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1041
|
+
readonly providerMetadata?: {
|
|
1042
|
+
readonly [x: string]: {
|
|
1043
|
+
readonly [x: string]: unknown;
|
|
1044
|
+
};
|
|
1045
|
+
} | undefined;
|
|
1046
|
+
readonly usage?: Usage | undefined;
|
|
1047
|
+
} | {
|
|
1048
|
+
readonly type: "request-finish";
|
|
1049
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1050
|
+
readonly providerMetadata?: {
|
|
1051
|
+
readonly [x: string]: {
|
|
1052
|
+
readonly [x: string]: unknown;
|
|
1053
|
+
};
|
|
1054
|
+
} | undefined;
|
|
1055
|
+
readonly usage?: Usage | undefined;
|
|
1056
|
+
} | {
|
|
1057
|
+
readonly type: "provider-error";
|
|
1058
|
+
readonly message: string;
|
|
1059
|
+
readonly providerMetadata?: {
|
|
1060
|
+
readonly [x: string]: {
|
|
1061
|
+
readonly [x: string]: unknown;
|
|
1062
|
+
};
|
|
1063
|
+
} | undefined;
|
|
1064
|
+
readonly retryable?: boolean | undefined;
|
|
1065
|
+
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
1066
|
+
<Cases extends {
|
|
1067
|
+
"request-start": (value: {
|
|
1068
|
+
readonly id: string;
|
|
1069
|
+
readonly type: "request-start";
|
|
1070
|
+
readonly model: ModelRef;
|
|
1071
|
+
}) => any;
|
|
1072
|
+
"step-start": (value: {
|
|
1073
|
+
readonly type: "step-start";
|
|
1074
|
+
readonly index: number;
|
|
1075
|
+
}) => any;
|
|
1076
|
+
"text-start": (value: {
|
|
1077
|
+
readonly id: string;
|
|
1078
|
+
readonly type: "text-start";
|
|
1079
|
+
readonly providerMetadata?: {
|
|
1080
|
+
readonly [x: string]: {
|
|
1081
|
+
readonly [x: string]: unknown;
|
|
1082
|
+
};
|
|
1083
|
+
} | undefined;
|
|
1084
|
+
}) => any;
|
|
1085
|
+
"text-delta": (value: {
|
|
1086
|
+
readonly id: string;
|
|
1087
|
+
readonly type: "text-delta";
|
|
1088
|
+
readonly text: string;
|
|
1089
|
+
}) => any;
|
|
1090
|
+
"text-end": (value: {
|
|
1091
|
+
readonly id: string;
|
|
1092
|
+
readonly type: "text-end";
|
|
1093
|
+
readonly providerMetadata?: {
|
|
1094
|
+
readonly [x: string]: {
|
|
1095
|
+
readonly [x: string]: unknown;
|
|
1096
|
+
};
|
|
1097
|
+
} | undefined;
|
|
1098
|
+
}) => any;
|
|
1099
|
+
"reasoning-start": (value: {
|
|
1100
|
+
readonly id: string;
|
|
1101
|
+
readonly type: "reasoning-start";
|
|
1102
|
+
readonly providerMetadata?: {
|
|
1103
|
+
readonly [x: string]: {
|
|
1104
|
+
readonly [x: string]: unknown;
|
|
1105
|
+
};
|
|
1106
|
+
} | undefined;
|
|
1107
|
+
}) => any;
|
|
1108
|
+
"reasoning-delta": (value: {
|
|
1109
|
+
readonly id: string;
|
|
1110
|
+
readonly type: "reasoning-delta";
|
|
1111
|
+
readonly text: string;
|
|
1112
|
+
}) => any;
|
|
1113
|
+
"reasoning-end": (value: {
|
|
1114
|
+
readonly id: string;
|
|
1115
|
+
readonly type: "reasoning-end";
|
|
1116
|
+
readonly providerMetadata?: {
|
|
1117
|
+
readonly [x: string]: {
|
|
1118
|
+
readonly [x: string]: unknown;
|
|
1119
|
+
};
|
|
1120
|
+
} | undefined;
|
|
1121
|
+
}) => any;
|
|
1122
|
+
"tool-input-start": (value: {
|
|
1123
|
+
readonly id: string;
|
|
1124
|
+
readonly type: "tool-input-start";
|
|
1125
|
+
readonly name: string;
|
|
1126
|
+
readonly providerMetadata?: {
|
|
1127
|
+
readonly [x: string]: {
|
|
1128
|
+
readonly [x: string]: unknown;
|
|
1129
|
+
};
|
|
1130
|
+
} | undefined;
|
|
1131
|
+
}) => any;
|
|
1132
|
+
"tool-input-delta": (value: {
|
|
1133
|
+
readonly id: string;
|
|
1134
|
+
readonly type: "tool-input-delta";
|
|
1135
|
+
readonly text: string;
|
|
1136
|
+
readonly name: string;
|
|
1137
|
+
}) => any;
|
|
1138
|
+
"tool-input-end": (value: {
|
|
1139
|
+
readonly id: string;
|
|
1140
|
+
readonly type: "tool-input-end";
|
|
1141
|
+
readonly name: string;
|
|
1142
|
+
readonly providerMetadata?: {
|
|
1143
|
+
readonly [x: string]: {
|
|
1144
|
+
readonly [x: string]: unknown;
|
|
1145
|
+
};
|
|
1146
|
+
} | undefined;
|
|
1147
|
+
}) => any;
|
|
1148
|
+
"tool-call": (value: {
|
|
1149
|
+
readonly id: string;
|
|
1150
|
+
readonly type: "tool-call";
|
|
1151
|
+
readonly name: string;
|
|
1152
|
+
readonly input: unknown;
|
|
1153
|
+
readonly providerMetadata?: {
|
|
1154
|
+
readonly [x: string]: {
|
|
1155
|
+
readonly [x: string]: unknown;
|
|
1156
|
+
};
|
|
1157
|
+
} | undefined;
|
|
1158
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1159
|
+
}) => any;
|
|
1160
|
+
"tool-result": (value: {
|
|
1161
|
+
readonly id: string;
|
|
1162
|
+
readonly type: "tool-result";
|
|
1163
|
+
readonly name: string;
|
|
1164
|
+
readonly result: {
|
|
1165
|
+
readonly type: "error" | "text" | "json";
|
|
1166
|
+
readonly value: unknown;
|
|
1167
|
+
readonly metadata?: {
|
|
1168
|
+
readonly [x: string]: unknown;
|
|
1169
|
+
} | undefined;
|
|
1170
|
+
};
|
|
1171
|
+
readonly providerMetadata?: {
|
|
1172
|
+
readonly [x: string]: {
|
|
1173
|
+
readonly [x: string]: unknown;
|
|
1174
|
+
};
|
|
1175
|
+
} | undefined;
|
|
1176
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1177
|
+
}) => any;
|
|
1178
|
+
"tool-error": (value: {
|
|
1179
|
+
readonly id: string;
|
|
1180
|
+
readonly type: "tool-error";
|
|
1181
|
+
readonly name: string;
|
|
1182
|
+
readonly message: string;
|
|
1183
|
+
readonly metadata?: {
|
|
1184
|
+
readonly [x: string]: unknown;
|
|
1185
|
+
} | undefined;
|
|
1186
|
+
readonly providerMetadata?: {
|
|
1187
|
+
readonly [x: string]: {
|
|
1188
|
+
readonly [x: string]: unknown;
|
|
1189
|
+
};
|
|
1190
|
+
} | undefined;
|
|
1191
|
+
}) => any;
|
|
1192
|
+
"step-finish": (value: {
|
|
1193
|
+
readonly type: "step-finish";
|
|
1194
|
+
readonly index: number;
|
|
1195
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1196
|
+
readonly providerMetadata?: {
|
|
1197
|
+
readonly [x: string]: {
|
|
1198
|
+
readonly [x: string]: unknown;
|
|
1199
|
+
};
|
|
1200
|
+
} | undefined;
|
|
1201
|
+
readonly usage?: Usage | undefined;
|
|
1202
|
+
}) => any;
|
|
1203
|
+
"request-finish": (value: {
|
|
1204
|
+
readonly type: "request-finish";
|
|
1205
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1206
|
+
readonly providerMetadata?: {
|
|
1207
|
+
readonly [x: string]: {
|
|
1208
|
+
readonly [x: string]: unknown;
|
|
1209
|
+
};
|
|
1210
|
+
} | undefined;
|
|
1211
|
+
readonly usage?: Usage | undefined;
|
|
1212
|
+
}) => any;
|
|
1213
|
+
"provider-error": (value: {
|
|
1214
|
+
readonly type: "provider-error";
|
|
1215
|
+
readonly message: string;
|
|
1216
|
+
readonly providerMetadata?: {
|
|
1217
|
+
readonly [x: string]: {
|
|
1218
|
+
readonly [x: string]: unknown;
|
|
1219
|
+
};
|
|
1220
|
+
} | undefined;
|
|
1221
|
+
readonly retryable?: boolean | undefined;
|
|
1222
|
+
}) => any;
|
|
1223
|
+
}>(cases: Cases): (value: {
|
|
1224
|
+
readonly id: string;
|
|
1225
|
+
readonly type: "request-start";
|
|
1226
|
+
readonly model: ModelRef;
|
|
1227
|
+
} | {
|
|
1228
|
+
readonly type: "step-start";
|
|
1229
|
+
readonly index: number;
|
|
1230
|
+
} | {
|
|
1231
|
+
readonly id: string;
|
|
1232
|
+
readonly type: "text-start";
|
|
1233
|
+
readonly providerMetadata?: {
|
|
1234
|
+
readonly [x: string]: {
|
|
1235
|
+
readonly [x: string]: unknown;
|
|
1236
|
+
};
|
|
1237
|
+
} | undefined;
|
|
1238
|
+
} | {
|
|
1239
|
+
readonly id: string;
|
|
1240
|
+
readonly type: "text-delta";
|
|
1241
|
+
readonly text: string;
|
|
1242
|
+
} | {
|
|
1243
|
+
readonly id: string;
|
|
1244
|
+
readonly type: "text-end";
|
|
1245
|
+
readonly providerMetadata?: {
|
|
1246
|
+
readonly [x: string]: {
|
|
1247
|
+
readonly [x: string]: unknown;
|
|
1248
|
+
};
|
|
1249
|
+
} | undefined;
|
|
1250
|
+
} | {
|
|
1251
|
+
readonly id: string;
|
|
1252
|
+
readonly type: "reasoning-start";
|
|
1253
|
+
readonly providerMetadata?: {
|
|
1254
|
+
readonly [x: string]: {
|
|
1255
|
+
readonly [x: string]: unknown;
|
|
1256
|
+
};
|
|
1257
|
+
} | undefined;
|
|
1258
|
+
} | {
|
|
1259
|
+
readonly id: string;
|
|
1260
|
+
readonly type: "reasoning-delta";
|
|
1261
|
+
readonly text: string;
|
|
1262
|
+
} | {
|
|
1263
|
+
readonly id: string;
|
|
1264
|
+
readonly type: "reasoning-end";
|
|
1265
|
+
readonly providerMetadata?: {
|
|
1266
|
+
readonly [x: string]: {
|
|
1267
|
+
readonly [x: string]: unknown;
|
|
1268
|
+
};
|
|
1269
|
+
} | undefined;
|
|
1270
|
+
} | {
|
|
1271
|
+
readonly id: string;
|
|
1272
|
+
readonly type: "tool-input-start";
|
|
1273
|
+
readonly name: string;
|
|
1274
|
+
readonly providerMetadata?: {
|
|
1275
|
+
readonly [x: string]: {
|
|
1276
|
+
readonly [x: string]: unknown;
|
|
1277
|
+
};
|
|
1278
|
+
} | undefined;
|
|
1279
|
+
} | {
|
|
1280
|
+
readonly id: string;
|
|
1281
|
+
readonly type: "tool-input-delta";
|
|
1282
|
+
readonly text: string;
|
|
1283
|
+
readonly name: string;
|
|
1284
|
+
} | {
|
|
1285
|
+
readonly id: string;
|
|
1286
|
+
readonly type: "tool-input-end";
|
|
1287
|
+
readonly name: string;
|
|
1288
|
+
readonly providerMetadata?: {
|
|
1289
|
+
readonly [x: string]: {
|
|
1290
|
+
readonly [x: string]: unknown;
|
|
1291
|
+
};
|
|
1292
|
+
} | undefined;
|
|
1293
|
+
} | {
|
|
1294
|
+
readonly id: string;
|
|
1295
|
+
readonly type: "tool-call";
|
|
1296
|
+
readonly name: string;
|
|
1297
|
+
readonly input: unknown;
|
|
1298
|
+
readonly providerMetadata?: {
|
|
1299
|
+
readonly [x: string]: {
|
|
1300
|
+
readonly [x: string]: unknown;
|
|
1301
|
+
};
|
|
1302
|
+
} | undefined;
|
|
1303
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1304
|
+
} | {
|
|
1305
|
+
readonly id: string;
|
|
1306
|
+
readonly type: "tool-result";
|
|
1307
|
+
readonly name: string;
|
|
1308
|
+
readonly result: {
|
|
1309
|
+
readonly type: "error" | "text" | "json";
|
|
1310
|
+
readonly value: unknown;
|
|
1311
|
+
readonly metadata?: {
|
|
1312
|
+
readonly [x: string]: unknown;
|
|
1313
|
+
} | undefined;
|
|
1314
|
+
};
|
|
1315
|
+
readonly providerMetadata?: {
|
|
1316
|
+
readonly [x: string]: {
|
|
1317
|
+
readonly [x: string]: unknown;
|
|
1318
|
+
};
|
|
1319
|
+
} | undefined;
|
|
1320
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1321
|
+
} | {
|
|
1322
|
+
readonly id: string;
|
|
1323
|
+
readonly type: "tool-error";
|
|
1324
|
+
readonly name: string;
|
|
1325
|
+
readonly message: string;
|
|
1326
|
+
readonly metadata?: {
|
|
1327
|
+
readonly [x: string]: unknown;
|
|
1328
|
+
} | undefined;
|
|
1329
|
+
readonly providerMetadata?: {
|
|
1330
|
+
readonly [x: string]: {
|
|
1331
|
+
readonly [x: string]: unknown;
|
|
1332
|
+
};
|
|
1333
|
+
} | undefined;
|
|
1334
|
+
} | {
|
|
1335
|
+
readonly type: "step-finish";
|
|
1336
|
+
readonly index: number;
|
|
1337
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1338
|
+
readonly providerMetadata?: {
|
|
1339
|
+
readonly [x: string]: {
|
|
1340
|
+
readonly [x: string]: unknown;
|
|
1341
|
+
};
|
|
1342
|
+
} | undefined;
|
|
1343
|
+
readonly usage?: Usage | undefined;
|
|
1344
|
+
} | {
|
|
1345
|
+
readonly type: "request-finish";
|
|
1346
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1347
|
+
readonly providerMetadata?: {
|
|
1348
|
+
readonly [x: string]: {
|
|
1349
|
+
readonly [x: string]: unknown;
|
|
1350
|
+
};
|
|
1351
|
+
} | undefined;
|
|
1352
|
+
readonly usage?: Usage | undefined;
|
|
1353
|
+
} | {
|
|
1354
|
+
readonly type: "provider-error";
|
|
1355
|
+
readonly message: string;
|
|
1356
|
+
readonly providerMetadata?: {
|
|
1357
|
+
readonly [x: string]: {
|
|
1358
|
+
readonly [x: string]: unknown;
|
|
1359
|
+
};
|
|
1360
|
+
} | undefined;
|
|
1361
|
+
readonly retryable?: boolean | undefined;
|
|
1362
|
+
}) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
1363
|
+
};
|
|
1364
|
+
} & {
|
|
1365
|
+
requestStart: (input: WithID<RequestStart, ResponseID>) => {
|
|
1366
|
+
readonly id: string;
|
|
1367
|
+
readonly type: "request-start";
|
|
1368
|
+
readonly model: ModelRef;
|
|
1369
|
+
};
|
|
1370
|
+
stepStart: (input: {
|
|
1371
|
+
readonly index: number;
|
|
1372
|
+
readonly type?: "step-start" | undefined;
|
|
1373
|
+
}, options?: Schema.MakeOptions) => {
|
|
1374
|
+
readonly type: "step-start";
|
|
1375
|
+
readonly index: number;
|
|
1376
|
+
};
|
|
1377
|
+
textStart: (input: WithID<TextStart, ContentBlockID>) => {
|
|
1378
|
+
readonly id: string;
|
|
1379
|
+
readonly type: "text-start";
|
|
1380
|
+
readonly providerMetadata?: {
|
|
1381
|
+
readonly [x: string]: {
|
|
1382
|
+
readonly [x: string]: unknown;
|
|
1383
|
+
};
|
|
1384
|
+
} | undefined;
|
|
1385
|
+
};
|
|
1386
|
+
textDelta: (input: WithID<TextDelta, ContentBlockID>) => {
|
|
1387
|
+
readonly id: string;
|
|
1388
|
+
readonly type: "text-delta";
|
|
1389
|
+
readonly text: string;
|
|
1390
|
+
};
|
|
1391
|
+
textEnd: (input: WithID<TextEnd, ContentBlockID>) => {
|
|
1392
|
+
readonly id: string;
|
|
1393
|
+
readonly type: "text-end";
|
|
1394
|
+
readonly providerMetadata?: {
|
|
1395
|
+
readonly [x: string]: {
|
|
1396
|
+
readonly [x: string]: unknown;
|
|
1397
|
+
};
|
|
1398
|
+
} | undefined;
|
|
1399
|
+
};
|
|
1400
|
+
reasoningStart: (input: WithID<ReasoningStart, ContentBlockID>) => {
|
|
1401
|
+
readonly id: string;
|
|
1402
|
+
readonly type: "reasoning-start";
|
|
1403
|
+
readonly providerMetadata?: {
|
|
1404
|
+
readonly [x: string]: {
|
|
1405
|
+
readonly [x: string]: unknown;
|
|
1406
|
+
};
|
|
1407
|
+
} | undefined;
|
|
1408
|
+
};
|
|
1409
|
+
reasoningDelta: (input: WithID<ReasoningDelta, ContentBlockID>) => {
|
|
1410
|
+
readonly id: string;
|
|
1411
|
+
readonly type: "reasoning-delta";
|
|
1412
|
+
readonly text: string;
|
|
1413
|
+
};
|
|
1414
|
+
reasoningEnd: (input: WithID<ReasoningEnd, ContentBlockID>) => {
|
|
1415
|
+
readonly id: string;
|
|
1416
|
+
readonly type: "reasoning-end";
|
|
1417
|
+
readonly providerMetadata?: {
|
|
1418
|
+
readonly [x: string]: {
|
|
1419
|
+
readonly [x: string]: unknown;
|
|
1420
|
+
};
|
|
1421
|
+
} | undefined;
|
|
1422
|
+
};
|
|
1423
|
+
toolInputStart: (input: WithID<ToolInputStart, ToolCallID>) => {
|
|
1424
|
+
readonly id: string;
|
|
1425
|
+
readonly type: "tool-input-start";
|
|
1426
|
+
readonly name: string;
|
|
1427
|
+
readonly providerMetadata?: {
|
|
1428
|
+
readonly [x: string]: {
|
|
1429
|
+
readonly [x: string]: unknown;
|
|
1430
|
+
};
|
|
1431
|
+
} | undefined;
|
|
1432
|
+
};
|
|
1433
|
+
toolInputDelta: (input: WithID<ToolInputDelta, ToolCallID>) => {
|
|
1434
|
+
readonly id: string;
|
|
1435
|
+
readonly type: "tool-input-delta";
|
|
1436
|
+
readonly text: string;
|
|
1437
|
+
readonly name: string;
|
|
1438
|
+
};
|
|
1439
|
+
toolInputEnd: (input: WithID<ToolInputEnd, ToolCallID>) => {
|
|
1440
|
+
readonly id: string;
|
|
1441
|
+
readonly type: "tool-input-end";
|
|
1442
|
+
readonly name: string;
|
|
1443
|
+
readonly providerMetadata?: {
|
|
1444
|
+
readonly [x: string]: {
|
|
1445
|
+
readonly [x: string]: unknown;
|
|
1446
|
+
};
|
|
1447
|
+
} | undefined;
|
|
1448
|
+
};
|
|
1449
|
+
toolCall: (input: WithID<ToolCall, ToolCallID>) => {
|
|
1450
|
+
readonly id: string;
|
|
1451
|
+
readonly type: "tool-call";
|
|
1452
|
+
readonly name: string;
|
|
1453
|
+
readonly input: unknown;
|
|
1454
|
+
readonly providerMetadata?: {
|
|
1455
|
+
readonly [x: string]: {
|
|
1456
|
+
readonly [x: string]: unknown;
|
|
1457
|
+
};
|
|
1458
|
+
} | undefined;
|
|
1459
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1460
|
+
};
|
|
1461
|
+
toolResult: (input: WithID<ToolResult, ToolCallID>) => {
|
|
1462
|
+
readonly id: string;
|
|
1463
|
+
readonly type: "tool-result";
|
|
1464
|
+
readonly name: string;
|
|
1465
|
+
readonly result: {
|
|
1466
|
+
readonly type: "error" | "text" | "json";
|
|
1467
|
+
readonly value: unknown;
|
|
1468
|
+
readonly metadata?: {
|
|
1469
|
+
readonly [x: string]: unknown;
|
|
1470
|
+
} | undefined;
|
|
1471
|
+
};
|
|
1472
|
+
readonly providerMetadata?: {
|
|
1473
|
+
readonly [x: string]: {
|
|
1474
|
+
readonly [x: string]: unknown;
|
|
1475
|
+
};
|
|
1476
|
+
} | undefined;
|
|
1477
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1478
|
+
};
|
|
1479
|
+
toolError: (input: WithID<ToolError, ToolCallID>) => {
|
|
1480
|
+
readonly id: string;
|
|
1481
|
+
readonly type: "tool-error";
|
|
1482
|
+
readonly name: string;
|
|
1483
|
+
readonly message: string;
|
|
1484
|
+
readonly metadata?: {
|
|
1485
|
+
readonly [x: string]: unknown;
|
|
1486
|
+
} | undefined;
|
|
1487
|
+
readonly providerMetadata?: {
|
|
1488
|
+
readonly [x: string]: {
|
|
1489
|
+
readonly [x: string]: unknown;
|
|
1490
|
+
};
|
|
1491
|
+
} | undefined;
|
|
1492
|
+
};
|
|
1493
|
+
stepFinish: (input: {
|
|
1494
|
+
readonly index: number;
|
|
1495
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1496
|
+
readonly type?: "step-finish" | undefined;
|
|
1497
|
+
readonly usage?: Usage | undefined;
|
|
1498
|
+
readonly providerMetadata?: {
|
|
1499
|
+
readonly [x: string]: {
|
|
1500
|
+
readonly [x: string]: unknown;
|
|
1501
|
+
};
|
|
1502
|
+
} | undefined;
|
|
1503
|
+
}, options?: Schema.MakeOptions) => {
|
|
1504
|
+
readonly type: "step-finish";
|
|
1505
|
+
readonly index: number;
|
|
1506
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1507
|
+
readonly providerMetadata?: {
|
|
1508
|
+
readonly [x: string]: {
|
|
1509
|
+
readonly [x: string]: unknown;
|
|
1510
|
+
};
|
|
1511
|
+
} | undefined;
|
|
1512
|
+
readonly usage?: Usage | undefined;
|
|
1513
|
+
};
|
|
1514
|
+
requestFinish: (input: {
|
|
1515
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1516
|
+
readonly type?: "request-finish" | undefined;
|
|
1517
|
+
readonly usage?: Usage | undefined;
|
|
1518
|
+
readonly providerMetadata?: {
|
|
1519
|
+
readonly [x: string]: {
|
|
1520
|
+
readonly [x: string]: unknown;
|
|
1521
|
+
};
|
|
1522
|
+
} | undefined;
|
|
1523
|
+
}, options?: Schema.MakeOptions) => {
|
|
1524
|
+
readonly type: "request-finish";
|
|
1525
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1526
|
+
readonly providerMetadata?: {
|
|
1527
|
+
readonly [x: string]: {
|
|
1528
|
+
readonly [x: string]: unknown;
|
|
1529
|
+
};
|
|
1530
|
+
} | undefined;
|
|
1531
|
+
readonly usage?: Usage | undefined;
|
|
1532
|
+
};
|
|
1533
|
+
providerError: (input: {
|
|
1534
|
+
readonly message: string;
|
|
1535
|
+
readonly type?: "provider-error" | undefined;
|
|
1536
|
+
readonly retryable?: boolean | undefined;
|
|
1537
|
+
readonly providerMetadata?: {
|
|
1538
|
+
readonly [x: string]: {
|
|
1539
|
+
readonly [x: string]: unknown;
|
|
1540
|
+
};
|
|
1541
|
+
} | undefined;
|
|
1542
|
+
}, options?: Schema.MakeOptions) => {
|
|
1543
|
+
readonly type: "provider-error";
|
|
1544
|
+
readonly message: string;
|
|
1545
|
+
readonly providerMetadata?: {
|
|
1546
|
+
readonly [x: string]: {
|
|
1547
|
+
readonly [x: string]: unknown;
|
|
1548
|
+
};
|
|
1549
|
+
} | undefined;
|
|
1550
|
+
readonly retryable?: boolean | undefined;
|
|
1551
|
+
};
|
|
1552
|
+
is: {
|
|
1553
|
+
requestStart: (u: unknown) => u is {
|
|
1554
|
+
readonly id: string;
|
|
1555
|
+
readonly type: "request-start";
|
|
1556
|
+
readonly model: ModelRef;
|
|
1557
|
+
};
|
|
1558
|
+
stepStart: (u: unknown) => u is {
|
|
1559
|
+
readonly type: "step-start";
|
|
1560
|
+
readonly index: number;
|
|
1561
|
+
};
|
|
1562
|
+
textStart: (u: unknown) => u is {
|
|
1563
|
+
readonly id: string;
|
|
1564
|
+
readonly type: "text-start";
|
|
1565
|
+
readonly providerMetadata?: {
|
|
1566
|
+
readonly [x: string]: {
|
|
1567
|
+
readonly [x: string]: unknown;
|
|
1568
|
+
};
|
|
1569
|
+
} | undefined;
|
|
1570
|
+
};
|
|
1571
|
+
textDelta: (u: unknown) => u is {
|
|
1572
|
+
readonly id: string;
|
|
1573
|
+
readonly type: "text-delta";
|
|
1574
|
+
readonly text: string;
|
|
1575
|
+
};
|
|
1576
|
+
textEnd: (u: unknown) => u is {
|
|
1577
|
+
readonly id: string;
|
|
1578
|
+
readonly type: "text-end";
|
|
1579
|
+
readonly providerMetadata?: {
|
|
1580
|
+
readonly [x: string]: {
|
|
1581
|
+
readonly [x: string]: unknown;
|
|
1582
|
+
};
|
|
1583
|
+
} | undefined;
|
|
1584
|
+
};
|
|
1585
|
+
reasoningStart: (u: unknown) => u is {
|
|
1586
|
+
readonly id: string;
|
|
1587
|
+
readonly type: "reasoning-start";
|
|
1588
|
+
readonly providerMetadata?: {
|
|
1589
|
+
readonly [x: string]: {
|
|
1590
|
+
readonly [x: string]: unknown;
|
|
1591
|
+
};
|
|
1592
|
+
} | undefined;
|
|
1593
|
+
};
|
|
1594
|
+
reasoningDelta: (u: unknown) => u is {
|
|
1595
|
+
readonly id: string;
|
|
1596
|
+
readonly type: "reasoning-delta";
|
|
1597
|
+
readonly text: string;
|
|
1598
|
+
};
|
|
1599
|
+
reasoningEnd: (u: unknown) => u is {
|
|
1600
|
+
readonly id: string;
|
|
1601
|
+
readonly type: "reasoning-end";
|
|
1602
|
+
readonly providerMetadata?: {
|
|
1603
|
+
readonly [x: string]: {
|
|
1604
|
+
readonly [x: string]: unknown;
|
|
1605
|
+
};
|
|
1606
|
+
} | undefined;
|
|
1607
|
+
};
|
|
1608
|
+
toolInputStart: (u: unknown) => u is {
|
|
1609
|
+
readonly id: string;
|
|
1610
|
+
readonly type: "tool-input-start";
|
|
1611
|
+
readonly name: string;
|
|
1612
|
+
readonly providerMetadata?: {
|
|
1613
|
+
readonly [x: string]: {
|
|
1614
|
+
readonly [x: string]: unknown;
|
|
1615
|
+
};
|
|
1616
|
+
} | undefined;
|
|
1617
|
+
};
|
|
1618
|
+
toolInputDelta: (u: unknown) => u is {
|
|
1619
|
+
readonly id: string;
|
|
1620
|
+
readonly type: "tool-input-delta";
|
|
1621
|
+
readonly text: string;
|
|
1622
|
+
readonly name: string;
|
|
1623
|
+
};
|
|
1624
|
+
toolInputEnd: (u: unknown) => u is {
|
|
1625
|
+
readonly id: string;
|
|
1626
|
+
readonly type: "tool-input-end";
|
|
1627
|
+
readonly name: string;
|
|
1628
|
+
readonly providerMetadata?: {
|
|
1629
|
+
readonly [x: string]: {
|
|
1630
|
+
readonly [x: string]: unknown;
|
|
1631
|
+
};
|
|
1632
|
+
} | undefined;
|
|
1633
|
+
};
|
|
1634
|
+
toolCall: (u: unknown) => u is {
|
|
1635
|
+
readonly id: string;
|
|
1636
|
+
readonly type: "tool-call";
|
|
1637
|
+
readonly name: string;
|
|
1638
|
+
readonly input: unknown;
|
|
1639
|
+
readonly providerMetadata?: {
|
|
1640
|
+
readonly [x: string]: {
|
|
1641
|
+
readonly [x: string]: unknown;
|
|
1642
|
+
};
|
|
1643
|
+
} | undefined;
|
|
1644
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1645
|
+
};
|
|
1646
|
+
toolResult: (u: unknown) => u is {
|
|
1647
|
+
readonly id: string;
|
|
1648
|
+
readonly type: "tool-result";
|
|
1649
|
+
readonly name: string;
|
|
1650
|
+
readonly result: {
|
|
1651
|
+
readonly type: "error" | "text" | "json";
|
|
1652
|
+
readonly value: unknown;
|
|
1653
|
+
readonly metadata?: {
|
|
1654
|
+
readonly [x: string]: unknown;
|
|
1655
|
+
} | undefined;
|
|
1656
|
+
};
|
|
1657
|
+
readonly providerMetadata?: {
|
|
1658
|
+
readonly [x: string]: {
|
|
1659
|
+
readonly [x: string]: unknown;
|
|
1660
|
+
};
|
|
1661
|
+
} | undefined;
|
|
1662
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1663
|
+
};
|
|
1664
|
+
toolError: (u: unknown) => u is {
|
|
1665
|
+
readonly id: string;
|
|
1666
|
+
readonly type: "tool-error";
|
|
1667
|
+
readonly name: string;
|
|
1668
|
+
readonly message: string;
|
|
1669
|
+
readonly metadata?: {
|
|
1670
|
+
readonly [x: string]: unknown;
|
|
1671
|
+
} | undefined;
|
|
1672
|
+
readonly providerMetadata?: {
|
|
1673
|
+
readonly [x: string]: {
|
|
1674
|
+
readonly [x: string]: unknown;
|
|
1675
|
+
};
|
|
1676
|
+
} | undefined;
|
|
1677
|
+
};
|
|
1678
|
+
stepFinish: (u: unknown) => u is {
|
|
1679
|
+
readonly type: "step-finish";
|
|
1680
|
+
readonly index: number;
|
|
1681
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1682
|
+
readonly providerMetadata?: {
|
|
1683
|
+
readonly [x: string]: {
|
|
1684
|
+
readonly [x: string]: unknown;
|
|
1685
|
+
};
|
|
1686
|
+
} | undefined;
|
|
1687
|
+
readonly usage?: Usage | undefined;
|
|
1688
|
+
};
|
|
1689
|
+
requestFinish: (u: unknown) => u is {
|
|
1690
|
+
readonly type: "request-finish";
|
|
1691
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1692
|
+
readonly providerMetadata?: {
|
|
1693
|
+
readonly [x: string]: {
|
|
1694
|
+
readonly [x: string]: unknown;
|
|
1695
|
+
};
|
|
1696
|
+
} | undefined;
|
|
1697
|
+
readonly usage?: Usage | undefined;
|
|
1698
|
+
};
|
|
1699
|
+
providerError: (u: unknown) => u is {
|
|
1700
|
+
readonly type: "provider-error";
|
|
1701
|
+
readonly message: string;
|
|
1702
|
+
readonly providerMetadata?: {
|
|
1703
|
+
readonly [x: string]: {
|
|
1704
|
+
readonly [x: string]: unknown;
|
|
1705
|
+
};
|
|
1706
|
+
} | undefined;
|
|
1707
|
+
readonly retryable?: boolean | undefined;
|
|
1708
|
+
};
|
|
1709
|
+
};
|
|
1710
|
+
};
|
|
1711
|
+
export type LLMEvent = Schema.Schema.Type<typeof llmEventTagged>;
|
|
1712
|
+
declare const PreparedRequest_base: Schema.Class<PreparedRequest, Schema.Struct<{
|
|
1713
|
+
readonly id: Schema.String;
|
|
1714
|
+
readonly route: Schema.String;
|
|
1715
|
+
readonly protocol: Schema.String;
|
|
1716
|
+
readonly model: typeof ModelRef;
|
|
1717
|
+
readonly body: Schema.Unknown;
|
|
1718
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
1719
|
+
}>, {}>;
|
|
1720
|
+
export declare class PreparedRequest extends PreparedRequest_base {
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* A `PreparedRequest` whose `body` is typed as `Body`. Use with the generic
|
|
1724
|
+
* on `LLMClient.prepare<Body>(...)` when the caller knows which route their
|
|
1725
|
+
* request will resolve to and wants its native shape statically exposed
|
|
1726
|
+
* (debug UIs, request previews, plan rendering).
|
|
1727
|
+
*
|
|
1728
|
+
* The runtime body is identical — the route still emits `body: unknown` — so
|
|
1729
|
+
* this is a type-level assertion the caller makes about what they expect to
|
|
1730
|
+
* find. The prepare runtime does not validate the assertion.
|
|
1731
|
+
*/
|
|
1732
|
+
export type PreparedRequestOf<Body> = Omit<PreparedRequest, "body"> & {
|
|
1733
|
+
readonly body: Body;
|
|
1734
|
+
};
|
|
1735
|
+
declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
1736
|
+
readonly events: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
1737
|
+
readonly type: Schema.tag<"request-start">;
|
|
1738
|
+
readonly id: Schema.String;
|
|
1739
|
+
readonly model: typeof ModelRef;
|
|
1740
|
+
}>, Schema.Struct<{
|
|
1741
|
+
readonly type: Schema.tag<"step-start">;
|
|
1742
|
+
readonly index: Schema.Number;
|
|
1743
|
+
}>, Schema.Struct<{
|
|
1744
|
+
readonly type: Schema.tag<"text-start">;
|
|
1745
|
+
readonly id: Schema.String;
|
|
1746
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1747
|
+
}>, Schema.Struct<{
|
|
1748
|
+
readonly type: Schema.tag<"text-delta">;
|
|
1749
|
+
readonly id: Schema.String;
|
|
1750
|
+
readonly text: Schema.String;
|
|
1751
|
+
}>, Schema.Struct<{
|
|
1752
|
+
readonly type: Schema.tag<"text-end">;
|
|
1753
|
+
readonly id: Schema.String;
|
|
1754
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1755
|
+
}>, Schema.Struct<{
|
|
1756
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
1757
|
+
readonly id: Schema.String;
|
|
1758
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1759
|
+
}>, Schema.Struct<{
|
|
1760
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
1761
|
+
readonly id: Schema.String;
|
|
1762
|
+
readonly text: Schema.String;
|
|
1763
|
+
}>, Schema.Struct<{
|
|
1764
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
1765
|
+
readonly id: Schema.String;
|
|
1766
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1767
|
+
}>, Schema.Struct<{
|
|
1768
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
1769
|
+
readonly id: Schema.String;
|
|
1770
|
+
readonly name: Schema.String;
|
|
1771
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1772
|
+
}>, Schema.Struct<{
|
|
1773
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
1774
|
+
readonly id: Schema.String;
|
|
1775
|
+
readonly name: Schema.String;
|
|
1776
|
+
readonly text: Schema.String;
|
|
1777
|
+
}>, Schema.Struct<{
|
|
1778
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
1779
|
+
readonly id: Schema.String;
|
|
1780
|
+
readonly name: Schema.String;
|
|
1781
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1782
|
+
}>, Schema.Struct<{
|
|
1783
|
+
readonly type: Schema.tag<"tool-call">;
|
|
1784
|
+
readonly id: Schema.String;
|
|
1785
|
+
readonly name: Schema.String;
|
|
1786
|
+
readonly input: Schema.Unknown;
|
|
1787
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
1788
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1789
|
+
}>, Schema.Struct<{
|
|
1790
|
+
readonly type: Schema.tag<"tool-result">;
|
|
1791
|
+
readonly id: Schema.String;
|
|
1792
|
+
readonly name: Schema.String;
|
|
1793
|
+
readonly result: Schema.Struct<{
|
|
1794
|
+
readonly type: Schema.Literals<readonly ["json", "text", "error"]>;
|
|
1795
|
+
readonly value: Schema.Unknown;
|
|
1796
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
1797
|
+
}> & {
|
|
1798
|
+
make: (value: unknown, type?: ToolResultValue["type"], metadata?: Record<string, unknown>) => ToolResultValue;
|
|
1799
|
+
};
|
|
1800
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
1801
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1802
|
+
}>, Schema.Struct<{
|
|
1803
|
+
readonly type: Schema.tag<"tool-error">;
|
|
1804
|
+
readonly id: Schema.String;
|
|
1805
|
+
readonly name: Schema.String;
|
|
1806
|
+
readonly message: Schema.String;
|
|
1807
|
+
/** Optional structured payload (e.g. tool-interrupt metadata for approval). */
|
|
1808
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
1809
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1810
|
+
}>, Schema.Struct<{
|
|
1811
|
+
readonly type: Schema.tag<"step-finish">;
|
|
1812
|
+
readonly index: Schema.Number;
|
|
1813
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
1814
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
1815
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1816
|
+
}>, Schema.Struct<{
|
|
1817
|
+
readonly type: Schema.tag<"request-finish">;
|
|
1818
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
1819
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
1820
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1821
|
+
}>, Schema.Struct<{
|
|
1822
|
+
readonly type: Schema.tag<"provider-error">;
|
|
1823
|
+
readonly message: Schema.String;
|
|
1824
|
+
readonly retryable: Schema.optional<Schema.Boolean>;
|
|
1825
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1826
|
+
}>]> & {
|
|
1827
|
+
readonly cases: {
|
|
1828
|
+
"request-start": Schema.Struct<{
|
|
1829
|
+
readonly type: Schema.tag<"request-start">;
|
|
1830
|
+
readonly id: Schema.String;
|
|
1831
|
+
readonly model: typeof ModelRef;
|
|
1832
|
+
}>;
|
|
1833
|
+
"step-start": Schema.Struct<{
|
|
1834
|
+
readonly type: Schema.tag<"step-start">;
|
|
1835
|
+
readonly index: Schema.Number;
|
|
1836
|
+
}>;
|
|
1837
|
+
"text-start": Schema.Struct<{
|
|
1838
|
+
readonly type: Schema.tag<"text-start">;
|
|
1839
|
+
readonly id: Schema.String;
|
|
1840
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1841
|
+
}>;
|
|
1842
|
+
"text-delta": Schema.Struct<{
|
|
1843
|
+
readonly type: Schema.tag<"text-delta">;
|
|
1844
|
+
readonly id: Schema.String;
|
|
1845
|
+
readonly text: Schema.String;
|
|
1846
|
+
}>;
|
|
1847
|
+
"text-end": Schema.Struct<{
|
|
1848
|
+
readonly type: Schema.tag<"text-end">;
|
|
1849
|
+
readonly id: Schema.String;
|
|
1850
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1851
|
+
}>;
|
|
1852
|
+
"reasoning-start": Schema.Struct<{
|
|
1853
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
1854
|
+
readonly id: Schema.String;
|
|
1855
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1856
|
+
}>;
|
|
1857
|
+
"reasoning-delta": Schema.Struct<{
|
|
1858
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
1859
|
+
readonly id: Schema.String;
|
|
1860
|
+
readonly text: Schema.String;
|
|
1861
|
+
}>;
|
|
1862
|
+
"reasoning-end": Schema.Struct<{
|
|
1863
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
1864
|
+
readonly id: Schema.String;
|
|
1865
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1866
|
+
}>;
|
|
1867
|
+
"tool-input-start": Schema.Struct<{
|
|
1868
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
1869
|
+
readonly id: Schema.String;
|
|
1870
|
+
readonly name: Schema.String;
|
|
1871
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1872
|
+
}>;
|
|
1873
|
+
"tool-input-delta": Schema.Struct<{
|
|
1874
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
1875
|
+
readonly id: Schema.String;
|
|
1876
|
+
readonly name: Schema.String;
|
|
1877
|
+
readonly text: Schema.String;
|
|
1878
|
+
}>;
|
|
1879
|
+
"tool-input-end": Schema.Struct<{
|
|
1880
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
1881
|
+
readonly id: Schema.String;
|
|
1882
|
+
readonly name: Schema.String;
|
|
1883
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1884
|
+
}>;
|
|
1885
|
+
"tool-call": Schema.Struct<{
|
|
1886
|
+
readonly type: Schema.tag<"tool-call">;
|
|
1887
|
+
readonly id: Schema.String;
|
|
1888
|
+
readonly name: Schema.String;
|
|
1889
|
+
readonly input: Schema.Unknown;
|
|
1890
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
1891
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1892
|
+
}>;
|
|
1893
|
+
"tool-result": Schema.Struct<{
|
|
1894
|
+
readonly type: Schema.tag<"tool-result">;
|
|
1895
|
+
readonly id: Schema.String;
|
|
1896
|
+
readonly name: Schema.String;
|
|
1897
|
+
readonly result: Schema.Struct<{
|
|
1898
|
+
readonly type: Schema.Literals<readonly ["json", "text", "error"]>;
|
|
1899
|
+
readonly value: Schema.Unknown;
|
|
1900
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
1901
|
+
}> & {
|
|
1902
|
+
make: (value: unknown, type?: ToolResultValue["type"], metadata?: Record<string, unknown>) => ToolResultValue;
|
|
1903
|
+
};
|
|
1904
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
1905
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1906
|
+
}>;
|
|
1907
|
+
"tool-error": Schema.Struct<{
|
|
1908
|
+
readonly type: Schema.tag<"tool-error">;
|
|
1909
|
+
readonly id: Schema.String;
|
|
1910
|
+
readonly name: Schema.String;
|
|
1911
|
+
readonly message: Schema.String;
|
|
1912
|
+
/** Optional structured payload (e.g. tool-interrupt metadata for approval). */
|
|
1913
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
1914
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1915
|
+
}>;
|
|
1916
|
+
"step-finish": Schema.Struct<{
|
|
1917
|
+
readonly type: Schema.tag<"step-finish">;
|
|
1918
|
+
readonly index: Schema.Number;
|
|
1919
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
1920
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
1921
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1922
|
+
}>;
|
|
1923
|
+
"request-finish": Schema.Struct<{
|
|
1924
|
+
readonly type: Schema.tag<"request-finish">;
|
|
1925
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
1926
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
1927
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1928
|
+
}>;
|
|
1929
|
+
"provider-error": Schema.Struct<{
|
|
1930
|
+
readonly type: Schema.tag<"provider-error">;
|
|
1931
|
+
readonly message: Schema.String;
|
|
1932
|
+
readonly retryable: Schema.optional<Schema.Boolean>;
|
|
1933
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1934
|
+
}>;
|
|
1935
|
+
};
|
|
1936
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
1937
|
+
readonly id: string;
|
|
1938
|
+
readonly type: "request-start";
|
|
1939
|
+
readonly model: ModelRef;
|
|
1940
|
+
} | {
|
|
1941
|
+
readonly type: "step-start";
|
|
1942
|
+
readonly index: number;
|
|
1943
|
+
} | {
|
|
1944
|
+
readonly id: string;
|
|
1945
|
+
readonly type: "text-start";
|
|
1946
|
+
readonly providerMetadata?: {
|
|
1947
|
+
readonly [x: string]: {
|
|
1948
|
+
readonly [x: string]: unknown;
|
|
1949
|
+
};
|
|
1950
|
+
} | undefined;
|
|
1951
|
+
} | {
|
|
1952
|
+
readonly id: string;
|
|
1953
|
+
readonly type: "text-delta";
|
|
1954
|
+
readonly text: string;
|
|
1955
|
+
} | {
|
|
1956
|
+
readonly id: string;
|
|
1957
|
+
readonly type: "text-end";
|
|
1958
|
+
readonly providerMetadata?: {
|
|
1959
|
+
readonly [x: string]: {
|
|
1960
|
+
readonly [x: string]: unknown;
|
|
1961
|
+
};
|
|
1962
|
+
} | undefined;
|
|
1963
|
+
} | {
|
|
1964
|
+
readonly id: string;
|
|
1965
|
+
readonly type: "reasoning-start";
|
|
1966
|
+
readonly providerMetadata?: {
|
|
1967
|
+
readonly [x: string]: {
|
|
1968
|
+
readonly [x: string]: unknown;
|
|
1969
|
+
};
|
|
1970
|
+
} | undefined;
|
|
1971
|
+
} | {
|
|
1972
|
+
readonly id: string;
|
|
1973
|
+
readonly type: "reasoning-delta";
|
|
1974
|
+
readonly text: string;
|
|
1975
|
+
} | {
|
|
1976
|
+
readonly id: string;
|
|
1977
|
+
readonly type: "reasoning-end";
|
|
1978
|
+
readonly providerMetadata?: {
|
|
1979
|
+
readonly [x: string]: {
|
|
1980
|
+
readonly [x: string]: unknown;
|
|
1981
|
+
};
|
|
1982
|
+
} | undefined;
|
|
1983
|
+
} | {
|
|
1984
|
+
readonly id: string;
|
|
1985
|
+
readonly type: "tool-input-start";
|
|
1986
|
+
readonly name: string;
|
|
1987
|
+
readonly providerMetadata?: {
|
|
1988
|
+
readonly [x: string]: {
|
|
1989
|
+
readonly [x: string]: unknown;
|
|
1990
|
+
};
|
|
1991
|
+
} | undefined;
|
|
1992
|
+
} | {
|
|
1993
|
+
readonly id: string;
|
|
1994
|
+
readonly type: "tool-input-delta";
|
|
1995
|
+
readonly text: string;
|
|
1996
|
+
readonly name: string;
|
|
1997
|
+
} | {
|
|
1998
|
+
readonly id: string;
|
|
1999
|
+
readonly type: "tool-input-end";
|
|
2000
|
+
readonly name: string;
|
|
2001
|
+
readonly providerMetadata?: {
|
|
2002
|
+
readonly [x: string]: {
|
|
2003
|
+
readonly [x: string]: unknown;
|
|
2004
|
+
};
|
|
2005
|
+
} | undefined;
|
|
2006
|
+
} | {
|
|
2007
|
+
readonly id: string;
|
|
2008
|
+
readonly type: "tool-call";
|
|
2009
|
+
readonly name: string;
|
|
2010
|
+
readonly input: unknown;
|
|
2011
|
+
readonly providerMetadata?: {
|
|
2012
|
+
readonly [x: string]: {
|
|
2013
|
+
readonly [x: string]: unknown;
|
|
2014
|
+
};
|
|
2015
|
+
} | undefined;
|
|
2016
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2017
|
+
} | {
|
|
2018
|
+
readonly id: string;
|
|
2019
|
+
readonly type: "tool-result";
|
|
2020
|
+
readonly name: string;
|
|
2021
|
+
readonly result: {
|
|
2022
|
+
readonly type: "error" | "text" | "json";
|
|
2023
|
+
readonly value: unknown;
|
|
2024
|
+
readonly metadata?: {
|
|
2025
|
+
readonly [x: string]: unknown;
|
|
2026
|
+
} | undefined;
|
|
2027
|
+
};
|
|
2028
|
+
readonly providerMetadata?: {
|
|
2029
|
+
readonly [x: string]: {
|
|
2030
|
+
readonly [x: string]: unknown;
|
|
2031
|
+
};
|
|
2032
|
+
} | undefined;
|
|
2033
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2034
|
+
} | {
|
|
2035
|
+
readonly id: string;
|
|
2036
|
+
readonly type: "tool-error";
|
|
2037
|
+
readonly name: string;
|
|
2038
|
+
readonly message: string;
|
|
2039
|
+
readonly metadata?: {
|
|
2040
|
+
readonly [x: string]: unknown;
|
|
2041
|
+
} | undefined;
|
|
2042
|
+
readonly providerMetadata?: {
|
|
2043
|
+
readonly [x: string]: {
|
|
2044
|
+
readonly [x: string]: unknown;
|
|
2045
|
+
};
|
|
2046
|
+
} | undefined;
|
|
2047
|
+
} | {
|
|
2048
|
+
readonly type: "step-finish";
|
|
2049
|
+
readonly index: number;
|
|
2050
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2051
|
+
readonly providerMetadata?: {
|
|
2052
|
+
readonly [x: string]: {
|
|
2053
|
+
readonly [x: string]: unknown;
|
|
2054
|
+
};
|
|
2055
|
+
} | undefined;
|
|
2056
|
+
readonly usage?: Usage | undefined;
|
|
2057
|
+
} | {
|
|
2058
|
+
readonly type: "request-finish";
|
|
2059
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2060
|
+
readonly providerMetadata?: {
|
|
2061
|
+
readonly [x: string]: {
|
|
2062
|
+
readonly [x: string]: unknown;
|
|
2063
|
+
};
|
|
2064
|
+
} | undefined;
|
|
2065
|
+
readonly usage?: Usage | undefined;
|
|
2066
|
+
} | {
|
|
2067
|
+
readonly type: "provider-error";
|
|
2068
|
+
readonly message: string;
|
|
2069
|
+
readonly providerMetadata?: {
|
|
2070
|
+
readonly [x: string]: {
|
|
2071
|
+
readonly [x: string]: unknown;
|
|
2072
|
+
};
|
|
2073
|
+
} | undefined;
|
|
2074
|
+
readonly retryable?: boolean | undefined;
|
|
2075
|
+
}) => value is never;
|
|
2076
|
+
readonly guards: {
|
|
2077
|
+
"request-start": (u: unknown) => u is {
|
|
2078
|
+
readonly id: string;
|
|
2079
|
+
readonly type: "request-start";
|
|
2080
|
+
readonly model: ModelRef;
|
|
2081
|
+
};
|
|
2082
|
+
"step-start": (u: unknown) => u is {
|
|
2083
|
+
readonly type: "step-start";
|
|
2084
|
+
readonly index: number;
|
|
2085
|
+
};
|
|
2086
|
+
"text-start": (u: unknown) => u is {
|
|
2087
|
+
readonly id: string;
|
|
2088
|
+
readonly type: "text-start";
|
|
2089
|
+
readonly providerMetadata?: {
|
|
2090
|
+
readonly [x: string]: {
|
|
2091
|
+
readonly [x: string]: unknown;
|
|
2092
|
+
};
|
|
2093
|
+
} | undefined;
|
|
2094
|
+
};
|
|
2095
|
+
"text-delta": (u: unknown) => u is {
|
|
2096
|
+
readonly id: string;
|
|
2097
|
+
readonly type: "text-delta";
|
|
2098
|
+
readonly text: string;
|
|
2099
|
+
};
|
|
2100
|
+
"text-end": (u: unknown) => u is {
|
|
2101
|
+
readonly id: string;
|
|
2102
|
+
readonly type: "text-end";
|
|
2103
|
+
readonly providerMetadata?: {
|
|
2104
|
+
readonly [x: string]: {
|
|
2105
|
+
readonly [x: string]: unknown;
|
|
2106
|
+
};
|
|
2107
|
+
} | undefined;
|
|
2108
|
+
};
|
|
2109
|
+
"reasoning-start": (u: unknown) => u is {
|
|
2110
|
+
readonly id: string;
|
|
2111
|
+
readonly type: "reasoning-start";
|
|
2112
|
+
readonly providerMetadata?: {
|
|
2113
|
+
readonly [x: string]: {
|
|
2114
|
+
readonly [x: string]: unknown;
|
|
2115
|
+
};
|
|
2116
|
+
} | undefined;
|
|
2117
|
+
};
|
|
2118
|
+
"reasoning-delta": (u: unknown) => u is {
|
|
2119
|
+
readonly id: string;
|
|
2120
|
+
readonly type: "reasoning-delta";
|
|
2121
|
+
readonly text: string;
|
|
2122
|
+
};
|
|
2123
|
+
"reasoning-end": (u: unknown) => u is {
|
|
2124
|
+
readonly id: string;
|
|
2125
|
+
readonly type: "reasoning-end";
|
|
2126
|
+
readonly providerMetadata?: {
|
|
2127
|
+
readonly [x: string]: {
|
|
2128
|
+
readonly [x: string]: unknown;
|
|
2129
|
+
};
|
|
2130
|
+
} | undefined;
|
|
2131
|
+
};
|
|
2132
|
+
"tool-input-start": (u: unknown) => u is {
|
|
2133
|
+
readonly id: string;
|
|
2134
|
+
readonly type: "tool-input-start";
|
|
2135
|
+
readonly name: string;
|
|
2136
|
+
readonly providerMetadata?: {
|
|
2137
|
+
readonly [x: string]: {
|
|
2138
|
+
readonly [x: string]: unknown;
|
|
2139
|
+
};
|
|
2140
|
+
} | undefined;
|
|
2141
|
+
};
|
|
2142
|
+
"tool-input-delta": (u: unknown) => u is {
|
|
2143
|
+
readonly id: string;
|
|
2144
|
+
readonly type: "tool-input-delta";
|
|
2145
|
+
readonly text: string;
|
|
2146
|
+
readonly name: string;
|
|
2147
|
+
};
|
|
2148
|
+
"tool-input-end": (u: unknown) => u is {
|
|
2149
|
+
readonly id: string;
|
|
2150
|
+
readonly type: "tool-input-end";
|
|
2151
|
+
readonly name: string;
|
|
2152
|
+
readonly providerMetadata?: {
|
|
2153
|
+
readonly [x: string]: {
|
|
2154
|
+
readonly [x: string]: unknown;
|
|
2155
|
+
};
|
|
2156
|
+
} | undefined;
|
|
2157
|
+
};
|
|
2158
|
+
"tool-call": (u: unknown) => u is {
|
|
2159
|
+
readonly id: string;
|
|
2160
|
+
readonly type: "tool-call";
|
|
2161
|
+
readonly name: string;
|
|
2162
|
+
readonly input: unknown;
|
|
2163
|
+
readonly providerMetadata?: {
|
|
2164
|
+
readonly [x: string]: {
|
|
2165
|
+
readonly [x: string]: unknown;
|
|
2166
|
+
};
|
|
2167
|
+
} | undefined;
|
|
2168
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2169
|
+
};
|
|
2170
|
+
"tool-result": (u: unknown) => u is {
|
|
2171
|
+
readonly id: string;
|
|
2172
|
+
readonly type: "tool-result";
|
|
2173
|
+
readonly name: string;
|
|
2174
|
+
readonly result: {
|
|
2175
|
+
readonly type: "error" | "text" | "json";
|
|
2176
|
+
readonly value: unknown;
|
|
2177
|
+
readonly metadata?: {
|
|
2178
|
+
readonly [x: string]: unknown;
|
|
2179
|
+
} | undefined;
|
|
2180
|
+
};
|
|
2181
|
+
readonly providerMetadata?: {
|
|
2182
|
+
readonly [x: string]: {
|
|
2183
|
+
readonly [x: string]: unknown;
|
|
2184
|
+
};
|
|
2185
|
+
} | undefined;
|
|
2186
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2187
|
+
};
|
|
2188
|
+
"tool-error": (u: unknown) => u is {
|
|
2189
|
+
readonly id: string;
|
|
2190
|
+
readonly type: "tool-error";
|
|
2191
|
+
readonly name: string;
|
|
2192
|
+
readonly message: string;
|
|
2193
|
+
readonly metadata?: {
|
|
2194
|
+
readonly [x: string]: unknown;
|
|
2195
|
+
} | undefined;
|
|
2196
|
+
readonly providerMetadata?: {
|
|
2197
|
+
readonly [x: string]: {
|
|
2198
|
+
readonly [x: string]: unknown;
|
|
2199
|
+
};
|
|
2200
|
+
} | undefined;
|
|
2201
|
+
};
|
|
2202
|
+
"step-finish": (u: unknown) => u is {
|
|
2203
|
+
readonly type: "step-finish";
|
|
2204
|
+
readonly index: number;
|
|
2205
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2206
|
+
readonly providerMetadata?: {
|
|
2207
|
+
readonly [x: string]: {
|
|
2208
|
+
readonly [x: string]: unknown;
|
|
2209
|
+
};
|
|
2210
|
+
} | undefined;
|
|
2211
|
+
readonly usage?: Usage | undefined;
|
|
2212
|
+
};
|
|
2213
|
+
"request-finish": (u: unknown) => u is {
|
|
2214
|
+
readonly type: "request-finish";
|
|
2215
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2216
|
+
readonly providerMetadata?: {
|
|
2217
|
+
readonly [x: string]: {
|
|
2218
|
+
readonly [x: string]: unknown;
|
|
2219
|
+
};
|
|
2220
|
+
} | undefined;
|
|
2221
|
+
readonly usage?: Usage | undefined;
|
|
2222
|
+
};
|
|
2223
|
+
"provider-error": (u: unknown) => u is {
|
|
2224
|
+
readonly type: "provider-error";
|
|
2225
|
+
readonly message: string;
|
|
2226
|
+
readonly providerMetadata?: {
|
|
2227
|
+
readonly [x: string]: {
|
|
2228
|
+
readonly [x: string]: unknown;
|
|
2229
|
+
};
|
|
2230
|
+
} | undefined;
|
|
2231
|
+
readonly retryable?: boolean | undefined;
|
|
2232
|
+
};
|
|
2233
|
+
};
|
|
2234
|
+
readonly match: {
|
|
2235
|
+
<Cases extends {
|
|
2236
|
+
"request-start": (value: {
|
|
2237
|
+
readonly id: string;
|
|
2238
|
+
readonly type: "request-start";
|
|
2239
|
+
readonly model: ModelRef;
|
|
2240
|
+
}) => any;
|
|
2241
|
+
"step-start": (value: {
|
|
2242
|
+
readonly type: "step-start";
|
|
2243
|
+
readonly index: number;
|
|
2244
|
+
}) => any;
|
|
2245
|
+
"text-start": (value: {
|
|
2246
|
+
readonly id: string;
|
|
2247
|
+
readonly type: "text-start";
|
|
2248
|
+
readonly providerMetadata?: {
|
|
2249
|
+
readonly [x: string]: {
|
|
2250
|
+
readonly [x: string]: unknown;
|
|
2251
|
+
};
|
|
2252
|
+
} | undefined;
|
|
2253
|
+
}) => any;
|
|
2254
|
+
"text-delta": (value: {
|
|
2255
|
+
readonly id: string;
|
|
2256
|
+
readonly type: "text-delta";
|
|
2257
|
+
readonly text: string;
|
|
2258
|
+
}) => any;
|
|
2259
|
+
"text-end": (value: {
|
|
2260
|
+
readonly id: string;
|
|
2261
|
+
readonly type: "text-end";
|
|
2262
|
+
readonly providerMetadata?: {
|
|
2263
|
+
readonly [x: string]: {
|
|
2264
|
+
readonly [x: string]: unknown;
|
|
2265
|
+
};
|
|
2266
|
+
} | undefined;
|
|
2267
|
+
}) => any;
|
|
2268
|
+
"reasoning-start": (value: {
|
|
2269
|
+
readonly id: string;
|
|
2270
|
+
readonly type: "reasoning-start";
|
|
2271
|
+
readonly providerMetadata?: {
|
|
2272
|
+
readonly [x: string]: {
|
|
2273
|
+
readonly [x: string]: unknown;
|
|
2274
|
+
};
|
|
2275
|
+
} | undefined;
|
|
2276
|
+
}) => any;
|
|
2277
|
+
"reasoning-delta": (value: {
|
|
2278
|
+
readonly id: string;
|
|
2279
|
+
readonly type: "reasoning-delta";
|
|
2280
|
+
readonly text: string;
|
|
2281
|
+
}) => any;
|
|
2282
|
+
"reasoning-end": (value: {
|
|
2283
|
+
readonly id: string;
|
|
2284
|
+
readonly type: "reasoning-end";
|
|
2285
|
+
readonly providerMetadata?: {
|
|
2286
|
+
readonly [x: string]: {
|
|
2287
|
+
readonly [x: string]: unknown;
|
|
2288
|
+
};
|
|
2289
|
+
} | undefined;
|
|
2290
|
+
}) => any;
|
|
2291
|
+
"tool-input-start": (value: {
|
|
2292
|
+
readonly id: string;
|
|
2293
|
+
readonly type: "tool-input-start";
|
|
2294
|
+
readonly name: string;
|
|
2295
|
+
readonly providerMetadata?: {
|
|
2296
|
+
readonly [x: string]: {
|
|
2297
|
+
readonly [x: string]: unknown;
|
|
2298
|
+
};
|
|
2299
|
+
} | undefined;
|
|
2300
|
+
}) => any;
|
|
2301
|
+
"tool-input-delta": (value: {
|
|
2302
|
+
readonly id: string;
|
|
2303
|
+
readonly type: "tool-input-delta";
|
|
2304
|
+
readonly text: string;
|
|
2305
|
+
readonly name: string;
|
|
2306
|
+
}) => any;
|
|
2307
|
+
"tool-input-end": (value: {
|
|
2308
|
+
readonly id: string;
|
|
2309
|
+
readonly type: "tool-input-end";
|
|
2310
|
+
readonly name: string;
|
|
2311
|
+
readonly providerMetadata?: {
|
|
2312
|
+
readonly [x: string]: {
|
|
2313
|
+
readonly [x: string]: unknown;
|
|
2314
|
+
};
|
|
2315
|
+
} | undefined;
|
|
2316
|
+
}) => any;
|
|
2317
|
+
"tool-call": (value: {
|
|
2318
|
+
readonly id: string;
|
|
2319
|
+
readonly type: "tool-call";
|
|
2320
|
+
readonly name: string;
|
|
2321
|
+
readonly input: unknown;
|
|
2322
|
+
readonly providerMetadata?: {
|
|
2323
|
+
readonly [x: string]: {
|
|
2324
|
+
readonly [x: string]: unknown;
|
|
2325
|
+
};
|
|
2326
|
+
} | undefined;
|
|
2327
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2328
|
+
}) => any;
|
|
2329
|
+
"tool-result": (value: {
|
|
2330
|
+
readonly id: string;
|
|
2331
|
+
readonly type: "tool-result";
|
|
2332
|
+
readonly name: string;
|
|
2333
|
+
readonly result: {
|
|
2334
|
+
readonly type: "error" | "text" | "json";
|
|
2335
|
+
readonly value: unknown;
|
|
2336
|
+
readonly metadata?: {
|
|
2337
|
+
readonly [x: string]: unknown;
|
|
2338
|
+
} | undefined;
|
|
2339
|
+
};
|
|
2340
|
+
readonly providerMetadata?: {
|
|
2341
|
+
readonly [x: string]: {
|
|
2342
|
+
readonly [x: string]: unknown;
|
|
2343
|
+
};
|
|
2344
|
+
} | undefined;
|
|
2345
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2346
|
+
}) => any;
|
|
2347
|
+
"tool-error": (value: {
|
|
2348
|
+
readonly id: string;
|
|
2349
|
+
readonly type: "tool-error";
|
|
2350
|
+
readonly name: string;
|
|
2351
|
+
readonly message: string;
|
|
2352
|
+
readonly metadata?: {
|
|
2353
|
+
readonly [x: string]: unknown;
|
|
2354
|
+
} | undefined;
|
|
2355
|
+
readonly providerMetadata?: {
|
|
2356
|
+
readonly [x: string]: {
|
|
2357
|
+
readonly [x: string]: unknown;
|
|
2358
|
+
};
|
|
2359
|
+
} | undefined;
|
|
2360
|
+
}) => any;
|
|
2361
|
+
"step-finish": (value: {
|
|
2362
|
+
readonly type: "step-finish";
|
|
2363
|
+
readonly index: number;
|
|
2364
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2365
|
+
readonly providerMetadata?: {
|
|
2366
|
+
readonly [x: string]: {
|
|
2367
|
+
readonly [x: string]: unknown;
|
|
2368
|
+
};
|
|
2369
|
+
} | undefined;
|
|
2370
|
+
readonly usage?: Usage | undefined;
|
|
2371
|
+
}) => any;
|
|
2372
|
+
"request-finish": (value: {
|
|
2373
|
+
readonly type: "request-finish";
|
|
2374
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2375
|
+
readonly providerMetadata?: {
|
|
2376
|
+
readonly [x: string]: {
|
|
2377
|
+
readonly [x: string]: unknown;
|
|
2378
|
+
};
|
|
2379
|
+
} | undefined;
|
|
2380
|
+
readonly usage?: Usage | undefined;
|
|
2381
|
+
}) => any;
|
|
2382
|
+
"provider-error": (value: {
|
|
2383
|
+
readonly type: "provider-error";
|
|
2384
|
+
readonly message: string;
|
|
2385
|
+
readonly providerMetadata?: {
|
|
2386
|
+
readonly [x: string]: {
|
|
2387
|
+
readonly [x: string]: unknown;
|
|
2388
|
+
};
|
|
2389
|
+
} | undefined;
|
|
2390
|
+
readonly retryable?: boolean | undefined;
|
|
2391
|
+
}) => any;
|
|
2392
|
+
}>(value: {
|
|
2393
|
+
readonly id: string;
|
|
2394
|
+
readonly type: "request-start";
|
|
2395
|
+
readonly model: ModelRef;
|
|
2396
|
+
} | {
|
|
2397
|
+
readonly type: "step-start";
|
|
2398
|
+
readonly index: number;
|
|
2399
|
+
} | {
|
|
2400
|
+
readonly id: string;
|
|
2401
|
+
readonly type: "text-start";
|
|
2402
|
+
readonly providerMetadata?: {
|
|
2403
|
+
readonly [x: string]: {
|
|
2404
|
+
readonly [x: string]: unknown;
|
|
2405
|
+
};
|
|
2406
|
+
} | undefined;
|
|
2407
|
+
} | {
|
|
2408
|
+
readonly id: string;
|
|
2409
|
+
readonly type: "text-delta";
|
|
2410
|
+
readonly text: string;
|
|
2411
|
+
} | {
|
|
2412
|
+
readonly id: string;
|
|
2413
|
+
readonly type: "text-end";
|
|
2414
|
+
readonly providerMetadata?: {
|
|
2415
|
+
readonly [x: string]: {
|
|
2416
|
+
readonly [x: string]: unknown;
|
|
2417
|
+
};
|
|
2418
|
+
} | undefined;
|
|
2419
|
+
} | {
|
|
2420
|
+
readonly id: string;
|
|
2421
|
+
readonly type: "reasoning-start";
|
|
2422
|
+
readonly providerMetadata?: {
|
|
2423
|
+
readonly [x: string]: {
|
|
2424
|
+
readonly [x: string]: unknown;
|
|
2425
|
+
};
|
|
2426
|
+
} | undefined;
|
|
2427
|
+
} | {
|
|
2428
|
+
readonly id: string;
|
|
2429
|
+
readonly type: "reasoning-delta";
|
|
2430
|
+
readonly text: string;
|
|
2431
|
+
} | {
|
|
2432
|
+
readonly id: string;
|
|
2433
|
+
readonly type: "reasoning-end";
|
|
2434
|
+
readonly providerMetadata?: {
|
|
2435
|
+
readonly [x: string]: {
|
|
2436
|
+
readonly [x: string]: unknown;
|
|
2437
|
+
};
|
|
2438
|
+
} | undefined;
|
|
2439
|
+
} | {
|
|
2440
|
+
readonly id: string;
|
|
2441
|
+
readonly type: "tool-input-start";
|
|
2442
|
+
readonly name: string;
|
|
2443
|
+
readonly providerMetadata?: {
|
|
2444
|
+
readonly [x: string]: {
|
|
2445
|
+
readonly [x: string]: unknown;
|
|
2446
|
+
};
|
|
2447
|
+
} | undefined;
|
|
2448
|
+
} | {
|
|
2449
|
+
readonly id: string;
|
|
2450
|
+
readonly type: "tool-input-delta";
|
|
2451
|
+
readonly text: string;
|
|
2452
|
+
readonly name: string;
|
|
2453
|
+
} | {
|
|
2454
|
+
readonly id: string;
|
|
2455
|
+
readonly type: "tool-input-end";
|
|
2456
|
+
readonly name: string;
|
|
2457
|
+
readonly providerMetadata?: {
|
|
2458
|
+
readonly [x: string]: {
|
|
2459
|
+
readonly [x: string]: unknown;
|
|
2460
|
+
};
|
|
2461
|
+
} | undefined;
|
|
2462
|
+
} | {
|
|
2463
|
+
readonly id: string;
|
|
2464
|
+
readonly type: "tool-call";
|
|
2465
|
+
readonly name: string;
|
|
2466
|
+
readonly input: unknown;
|
|
2467
|
+
readonly providerMetadata?: {
|
|
2468
|
+
readonly [x: string]: {
|
|
2469
|
+
readonly [x: string]: unknown;
|
|
2470
|
+
};
|
|
2471
|
+
} | undefined;
|
|
2472
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2473
|
+
} | {
|
|
2474
|
+
readonly id: string;
|
|
2475
|
+
readonly type: "tool-result";
|
|
2476
|
+
readonly name: string;
|
|
2477
|
+
readonly result: {
|
|
2478
|
+
readonly type: "error" | "text" | "json";
|
|
2479
|
+
readonly value: unknown;
|
|
2480
|
+
readonly metadata?: {
|
|
2481
|
+
readonly [x: string]: unknown;
|
|
2482
|
+
} | undefined;
|
|
2483
|
+
};
|
|
2484
|
+
readonly providerMetadata?: {
|
|
2485
|
+
readonly [x: string]: {
|
|
2486
|
+
readonly [x: string]: unknown;
|
|
2487
|
+
};
|
|
2488
|
+
} | undefined;
|
|
2489
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2490
|
+
} | {
|
|
2491
|
+
readonly id: string;
|
|
2492
|
+
readonly type: "tool-error";
|
|
2493
|
+
readonly name: string;
|
|
2494
|
+
readonly message: string;
|
|
2495
|
+
readonly metadata?: {
|
|
2496
|
+
readonly [x: string]: unknown;
|
|
2497
|
+
} | undefined;
|
|
2498
|
+
readonly providerMetadata?: {
|
|
2499
|
+
readonly [x: string]: {
|
|
2500
|
+
readonly [x: string]: unknown;
|
|
2501
|
+
};
|
|
2502
|
+
} | undefined;
|
|
2503
|
+
} | {
|
|
2504
|
+
readonly type: "step-finish";
|
|
2505
|
+
readonly index: number;
|
|
2506
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2507
|
+
readonly providerMetadata?: {
|
|
2508
|
+
readonly [x: string]: {
|
|
2509
|
+
readonly [x: string]: unknown;
|
|
2510
|
+
};
|
|
2511
|
+
} | undefined;
|
|
2512
|
+
readonly usage?: Usage | undefined;
|
|
2513
|
+
} | {
|
|
2514
|
+
readonly type: "request-finish";
|
|
2515
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2516
|
+
readonly providerMetadata?: {
|
|
2517
|
+
readonly [x: string]: {
|
|
2518
|
+
readonly [x: string]: unknown;
|
|
2519
|
+
};
|
|
2520
|
+
} | undefined;
|
|
2521
|
+
readonly usage?: Usage | undefined;
|
|
2522
|
+
} | {
|
|
2523
|
+
readonly type: "provider-error";
|
|
2524
|
+
readonly message: string;
|
|
2525
|
+
readonly providerMetadata?: {
|
|
2526
|
+
readonly [x: string]: {
|
|
2527
|
+
readonly [x: string]: unknown;
|
|
2528
|
+
};
|
|
2529
|
+
} | undefined;
|
|
2530
|
+
readonly retryable?: boolean | undefined;
|
|
2531
|
+
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
2532
|
+
<Cases extends {
|
|
2533
|
+
"request-start": (value: {
|
|
2534
|
+
readonly id: string;
|
|
2535
|
+
readonly type: "request-start";
|
|
2536
|
+
readonly model: ModelRef;
|
|
2537
|
+
}) => any;
|
|
2538
|
+
"step-start": (value: {
|
|
2539
|
+
readonly type: "step-start";
|
|
2540
|
+
readonly index: number;
|
|
2541
|
+
}) => any;
|
|
2542
|
+
"text-start": (value: {
|
|
2543
|
+
readonly id: string;
|
|
2544
|
+
readonly type: "text-start";
|
|
2545
|
+
readonly providerMetadata?: {
|
|
2546
|
+
readonly [x: string]: {
|
|
2547
|
+
readonly [x: string]: unknown;
|
|
2548
|
+
};
|
|
2549
|
+
} | undefined;
|
|
2550
|
+
}) => any;
|
|
2551
|
+
"text-delta": (value: {
|
|
2552
|
+
readonly id: string;
|
|
2553
|
+
readonly type: "text-delta";
|
|
2554
|
+
readonly text: string;
|
|
2555
|
+
}) => any;
|
|
2556
|
+
"text-end": (value: {
|
|
2557
|
+
readonly id: string;
|
|
2558
|
+
readonly type: "text-end";
|
|
2559
|
+
readonly providerMetadata?: {
|
|
2560
|
+
readonly [x: string]: {
|
|
2561
|
+
readonly [x: string]: unknown;
|
|
2562
|
+
};
|
|
2563
|
+
} | undefined;
|
|
2564
|
+
}) => any;
|
|
2565
|
+
"reasoning-start": (value: {
|
|
2566
|
+
readonly id: string;
|
|
2567
|
+
readonly type: "reasoning-start";
|
|
2568
|
+
readonly providerMetadata?: {
|
|
2569
|
+
readonly [x: string]: {
|
|
2570
|
+
readonly [x: string]: unknown;
|
|
2571
|
+
};
|
|
2572
|
+
} | undefined;
|
|
2573
|
+
}) => any;
|
|
2574
|
+
"reasoning-delta": (value: {
|
|
2575
|
+
readonly id: string;
|
|
2576
|
+
readonly type: "reasoning-delta";
|
|
2577
|
+
readonly text: string;
|
|
2578
|
+
}) => any;
|
|
2579
|
+
"reasoning-end": (value: {
|
|
2580
|
+
readonly id: string;
|
|
2581
|
+
readonly type: "reasoning-end";
|
|
2582
|
+
readonly providerMetadata?: {
|
|
2583
|
+
readonly [x: string]: {
|
|
2584
|
+
readonly [x: string]: unknown;
|
|
2585
|
+
};
|
|
2586
|
+
} | undefined;
|
|
2587
|
+
}) => any;
|
|
2588
|
+
"tool-input-start": (value: {
|
|
2589
|
+
readonly id: string;
|
|
2590
|
+
readonly type: "tool-input-start";
|
|
2591
|
+
readonly name: string;
|
|
2592
|
+
readonly providerMetadata?: {
|
|
2593
|
+
readonly [x: string]: {
|
|
2594
|
+
readonly [x: string]: unknown;
|
|
2595
|
+
};
|
|
2596
|
+
} | undefined;
|
|
2597
|
+
}) => any;
|
|
2598
|
+
"tool-input-delta": (value: {
|
|
2599
|
+
readonly id: string;
|
|
2600
|
+
readonly type: "tool-input-delta";
|
|
2601
|
+
readonly text: string;
|
|
2602
|
+
readonly name: string;
|
|
2603
|
+
}) => any;
|
|
2604
|
+
"tool-input-end": (value: {
|
|
2605
|
+
readonly id: string;
|
|
2606
|
+
readonly type: "tool-input-end";
|
|
2607
|
+
readonly name: string;
|
|
2608
|
+
readonly providerMetadata?: {
|
|
2609
|
+
readonly [x: string]: {
|
|
2610
|
+
readonly [x: string]: unknown;
|
|
2611
|
+
};
|
|
2612
|
+
} | undefined;
|
|
2613
|
+
}) => any;
|
|
2614
|
+
"tool-call": (value: {
|
|
2615
|
+
readonly id: string;
|
|
2616
|
+
readonly type: "tool-call";
|
|
2617
|
+
readonly name: string;
|
|
2618
|
+
readonly input: unknown;
|
|
2619
|
+
readonly providerMetadata?: {
|
|
2620
|
+
readonly [x: string]: {
|
|
2621
|
+
readonly [x: string]: unknown;
|
|
2622
|
+
};
|
|
2623
|
+
} | undefined;
|
|
2624
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2625
|
+
}) => any;
|
|
2626
|
+
"tool-result": (value: {
|
|
2627
|
+
readonly id: string;
|
|
2628
|
+
readonly type: "tool-result";
|
|
2629
|
+
readonly name: string;
|
|
2630
|
+
readonly result: {
|
|
2631
|
+
readonly type: "error" | "text" | "json";
|
|
2632
|
+
readonly value: unknown;
|
|
2633
|
+
readonly metadata?: {
|
|
2634
|
+
readonly [x: string]: unknown;
|
|
2635
|
+
} | undefined;
|
|
2636
|
+
};
|
|
2637
|
+
readonly providerMetadata?: {
|
|
2638
|
+
readonly [x: string]: {
|
|
2639
|
+
readonly [x: string]: unknown;
|
|
2640
|
+
};
|
|
2641
|
+
} | undefined;
|
|
2642
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2643
|
+
}) => any;
|
|
2644
|
+
"tool-error": (value: {
|
|
2645
|
+
readonly id: string;
|
|
2646
|
+
readonly type: "tool-error";
|
|
2647
|
+
readonly name: string;
|
|
2648
|
+
readonly message: string;
|
|
2649
|
+
readonly metadata?: {
|
|
2650
|
+
readonly [x: string]: unknown;
|
|
2651
|
+
} | undefined;
|
|
2652
|
+
readonly providerMetadata?: {
|
|
2653
|
+
readonly [x: string]: {
|
|
2654
|
+
readonly [x: string]: unknown;
|
|
2655
|
+
};
|
|
2656
|
+
} | undefined;
|
|
2657
|
+
}) => any;
|
|
2658
|
+
"step-finish": (value: {
|
|
2659
|
+
readonly type: "step-finish";
|
|
2660
|
+
readonly index: number;
|
|
2661
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2662
|
+
readonly providerMetadata?: {
|
|
2663
|
+
readonly [x: string]: {
|
|
2664
|
+
readonly [x: string]: unknown;
|
|
2665
|
+
};
|
|
2666
|
+
} | undefined;
|
|
2667
|
+
readonly usage?: Usage | undefined;
|
|
2668
|
+
}) => any;
|
|
2669
|
+
"request-finish": (value: {
|
|
2670
|
+
readonly type: "request-finish";
|
|
2671
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2672
|
+
readonly providerMetadata?: {
|
|
2673
|
+
readonly [x: string]: {
|
|
2674
|
+
readonly [x: string]: unknown;
|
|
2675
|
+
};
|
|
2676
|
+
} | undefined;
|
|
2677
|
+
readonly usage?: Usage | undefined;
|
|
2678
|
+
}) => any;
|
|
2679
|
+
"provider-error": (value: {
|
|
2680
|
+
readonly type: "provider-error";
|
|
2681
|
+
readonly message: string;
|
|
2682
|
+
readonly providerMetadata?: {
|
|
2683
|
+
readonly [x: string]: {
|
|
2684
|
+
readonly [x: string]: unknown;
|
|
2685
|
+
};
|
|
2686
|
+
} | undefined;
|
|
2687
|
+
readonly retryable?: boolean | undefined;
|
|
2688
|
+
}) => any;
|
|
2689
|
+
}>(cases: Cases): (value: {
|
|
2690
|
+
readonly id: string;
|
|
2691
|
+
readonly type: "request-start";
|
|
2692
|
+
readonly model: ModelRef;
|
|
2693
|
+
} | {
|
|
2694
|
+
readonly type: "step-start";
|
|
2695
|
+
readonly index: number;
|
|
2696
|
+
} | {
|
|
2697
|
+
readonly id: string;
|
|
2698
|
+
readonly type: "text-start";
|
|
2699
|
+
readonly providerMetadata?: {
|
|
2700
|
+
readonly [x: string]: {
|
|
2701
|
+
readonly [x: string]: unknown;
|
|
2702
|
+
};
|
|
2703
|
+
} | undefined;
|
|
2704
|
+
} | {
|
|
2705
|
+
readonly id: string;
|
|
2706
|
+
readonly type: "text-delta";
|
|
2707
|
+
readonly text: string;
|
|
2708
|
+
} | {
|
|
2709
|
+
readonly id: string;
|
|
2710
|
+
readonly type: "text-end";
|
|
2711
|
+
readonly providerMetadata?: {
|
|
2712
|
+
readonly [x: string]: {
|
|
2713
|
+
readonly [x: string]: unknown;
|
|
2714
|
+
};
|
|
2715
|
+
} | undefined;
|
|
2716
|
+
} | {
|
|
2717
|
+
readonly id: string;
|
|
2718
|
+
readonly type: "reasoning-start";
|
|
2719
|
+
readonly providerMetadata?: {
|
|
2720
|
+
readonly [x: string]: {
|
|
2721
|
+
readonly [x: string]: unknown;
|
|
2722
|
+
};
|
|
2723
|
+
} | undefined;
|
|
2724
|
+
} | {
|
|
2725
|
+
readonly id: string;
|
|
2726
|
+
readonly type: "reasoning-delta";
|
|
2727
|
+
readonly text: string;
|
|
2728
|
+
} | {
|
|
2729
|
+
readonly id: string;
|
|
2730
|
+
readonly type: "reasoning-end";
|
|
2731
|
+
readonly providerMetadata?: {
|
|
2732
|
+
readonly [x: string]: {
|
|
2733
|
+
readonly [x: string]: unknown;
|
|
2734
|
+
};
|
|
2735
|
+
} | undefined;
|
|
2736
|
+
} | {
|
|
2737
|
+
readonly id: string;
|
|
2738
|
+
readonly type: "tool-input-start";
|
|
2739
|
+
readonly name: string;
|
|
2740
|
+
readonly providerMetadata?: {
|
|
2741
|
+
readonly [x: string]: {
|
|
2742
|
+
readonly [x: string]: unknown;
|
|
2743
|
+
};
|
|
2744
|
+
} | undefined;
|
|
2745
|
+
} | {
|
|
2746
|
+
readonly id: string;
|
|
2747
|
+
readonly type: "tool-input-delta";
|
|
2748
|
+
readonly text: string;
|
|
2749
|
+
readonly name: string;
|
|
2750
|
+
} | {
|
|
2751
|
+
readonly id: string;
|
|
2752
|
+
readonly type: "tool-input-end";
|
|
2753
|
+
readonly name: string;
|
|
2754
|
+
readonly providerMetadata?: {
|
|
2755
|
+
readonly [x: string]: {
|
|
2756
|
+
readonly [x: string]: unknown;
|
|
2757
|
+
};
|
|
2758
|
+
} | undefined;
|
|
2759
|
+
} | {
|
|
2760
|
+
readonly id: string;
|
|
2761
|
+
readonly type: "tool-call";
|
|
2762
|
+
readonly name: string;
|
|
2763
|
+
readonly input: unknown;
|
|
2764
|
+
readonly providerMetadata?: {
|
|
2765
|
+
readonly [x: string]: {
|
|
2766
|
+
readonly [x: string]: unknown;
|
|
2767
|
+
};
|
|
2768
|
+
} | undefined;
|
|
2769
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2770
|
+
} | {
|
|
2771
|
+
readonly id: string;
|
|
2772
|
+
readonly type: "tool-result";
|
|
2773
|
+
readonly name: string;
|
|
2774
|
+
readonly result: {
|
|
2775
|
+
readonly type: "error" | "text" | "json";
|
|
2776
|
+
readonly value: unknown;
|
|
2777
|
+
readonly metadata?: {
|
|
2778
|
+
readonly [x: string]: unknown;
|
|
2779
|
+
} | undefined;
|
|
2780
|
+
};
|
|
2781
|
+
readonly providerMetadata?: {
|
|
2782
|
+
readonly [x: string]: {
|
|
2783
|
+
readonly [x: string]: unknown;
|
|
2784
|
+
};
|
|
2785
|
+
} | undefined;
|
|
2786
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2787
|
+
} | {
|
|
2788
|
+
readonly id: string;
|
|
2789
|
+
readonly type: "tool-error";
|
|
2790
|
+
readonly name: string;
|
|
2791
|
+
readonly message: string;
|
|
2792
|
+
readonly metadata?: {
|
|
2793
|
+
readonly [x: string]: unknown;
|
|
2794
|
+
} | undefined;
|
|
2795
|
+
readonly providerMetadata?: {
|
|
2796
|
+
readonly [x: string]: {
|
|
2797
|
+
readonly [x: string]: unknown;
|
|
2798
|
+
};
|
|
2799
|
+
} | undefined;
|
|
2800
|
+
} | {
|
|
2801
|
+
readonly type: "step-finish";
|
|
2802
|
+
readonly index: number;
|
|
2803
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2804
|
+
readonly providerMetadata?: {
|
|
2805
|
+
readonly [x: string]: {
|
|
2806
|
+
readonly [x: string]: unknown;
|
|
2807
|
+
};
|
|
2808
|
+
} | undefined;
|
|
2809
|
+
readonly usage?: Usage | undefined;
|
|
2810
|
+
} | {
|
|
2811
|
+
readonly type: "request-finish";
|
|
2812
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2813
|
+
readonly providerMetadata?: {
|
|
2814
|
+
readonly [x: string]: {
|
|
2815
|
+
readonly [x: string]: unknown;
|
|
2816
|
+
};
|
|
2817
|
+
} | undefined;
|
|
2818
|
+
readonly usage?: Usage | undefined;
|
|
2819
|
+
} | {
|
|
2820
|
+
readonly type: "provider-error";
|
|
2821
|
+
readonly message: string;
|
|
2822
|
+
readonly providerMetadata?: {
|
|
2823
|
+
readonly [x: string]: {
|
|
2824
|
+
readonly [x: string]: unknown;
|
|
2825
|
+
};
|
|
2826
|
+
} | undefined;
|
|
2827
|
+
readonly retryable?: boolean | undefined;
|
|
2828
|
+
}) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
2829
|
+
};
|
|
2830
|
+
} & {
|
|
2831
|
+
requestStart: (input: WithID<RequestStart, ResponseID>) => {
|
|
2832
|
+
readonly id: string;
|
|
2833
|
+
readonly type: "request-start";
|
|
2834
|
+
readonly model: ModelRef;
|
|
2835
|
+
};
|
|
2836
|
+
stepStart: (input: {
|
|
2837
|
+
readonly index: number;
|
|
2838
|
+
readonly type?: "step-start" | undefined;
|
|
2839
|
+
}, options?: Schema.MakeOptions) => {
|
|
2840
|
+
readonly type: "step-start";
|
|
2841
|
+
readonly index: number;
|
|
2842
|
+
};
|
|
2843
|
+
textStart: (input: WithID<TextStart, ContentBlockID>) => {
|
|
2844
|
+
readonly id: string;
|
|
2845
|
+
readonly type: "text-start";
|
|
2846
|
+
readonly providerMetadata?: {
|
|
2847
|
+
readonly [x: string]: {
|
|
2848
|
+
readonly [x: string]: unknown;
|
|
2849
|
+
};
|
|
2850
|
+
} | undefined;
|
|
2851
|
+
};
|
|
2852
|
+
textDelta: (input: WithID<TextDelta, ContentBlockID>) => {
|
|
2853
|
+
readonly id: string;
|
|
2854
|
+
readonly type: "text-delta";
|
|
2855
|
+
readonly text: string;
|
|
2856
|
+
};
|
|
2857
|
+
textEnd: (input: WithID<TextEnd, ContentBlockID>) => {
|
|
2858
|
+
readonly id: string;
|
|
2859
|
+
readonly type: "text-end";
|
|
2860
|
+
readonly providerMetadata?: {
|
|
2861
|
+
readonly [x: string]: {
|
|
2862
|
+
readonly [x: string]: unknown;
|
|
2863
|
+
};
|
|
2864
|
+
} | undefined;
|
|
2865
|
+
};
|
|
2866
|
+
reasoningStart: (input: WithID<ReasoningStart, ContentBlockID>) => {
|
|
2867
|
+
readonly id: string;
|
|
2868
|
+
readonly type: "reasoning-start";
|
|
2869
|
+
readonly providerMetadata?: {
|
|
2870
|
+
readonly [x: string]: {
|
|
2871
|
+
readonly [x: string]: unknown;
|
|
2872
|
+
};
|
|
2873
|
+
} | undefined;
|
|
2874
|
+
};
|
|
2875
|
+
reasoningDelta: (input: WithID<ReasoningDelta, ContentBlockID>) => {
|
|
2876
|
+
readonly id: string;
|
|
2877
|
+
readonly type: "reasoning-delta";
|
|
2878
|
+
readonly text: string;
|
|
2879
|
+
};
|
|
2880
|
+
reasoningEnd: (input: WithID<ReasoningEnd, ContentBlockID>) => {
|
|
2881
|
+
readonly id: string;
|
|
2882
|
+
readonly type: "reasoning-end";
|
|
2883
|
+
readonly providerMetadata?: {
|
|
2884
|
+
readonly [x: string]: {
|
|
2885
|
+
readonly [x: string]: unknown;
|
|
2886
|
+
};
|
|
2887
|
+
} | undefined;
|
|
2888
|
+
};
|
|
2889
|
+
toolInputStart: (input: WithID<ToolInputStart, ToolCallID>) => {
|
|
2890
|
+
readonly id: string;
|
|
2891
|
+
readonly type: "tool-input-start";
|
|
2892
|
+
readonly name: string;
|
|
2893
|
+
readonly providerMetadata?: {
|
|
2894
|
+
readonly [x: string]: {
|
|
2895
|
+
readonly [x: string]: unknown;
|
|
2896
|
+
};
|
|
2897
|
+
} | undefined;
|
|
2898
|
+
};
|
|
2899
|
+
toolInputDelta: (input: WithID<ToolInputDelta, ToolCallID>) => {
|
|
2900
|
+
readonly id: string;
|
|
2901
|
+
readonly type: "tool-input-delta";
|
|
2902
|
+
readonly text: string;
|
|
2903
|
+
readonly name: string;
|
|
2904
|
+
};
|
|
2905
|
+
toolInputEnd: (input: WithID<ToolInputEnd, ToolCallID>) => {
|
|
2906
|
+
readonly id: string;
|
|
2907
|
+
readonly type: "tool-input-end";
|
|
2908
|
+
readonly name: string;
|
|
2909
|
+
readonly providerMetadata?: {
|
|
2910
|
+
readonly [x: string]: {
|
|
2911
|
+
readonly [x: string]: unknown;
|
|
2912
|
+
};
|
|
2913
|
+
} | undefined;
|
|
2914
|
+
};
|
|
2915
|
+
toolCall: (input: WithID<ToolCall, ToolCallID>) => {
|
|
2916
|
+
readonly id: string;
|
|
2917
|
+
readonly type: "tool-call";
|
|
2918
|
+
readonly name: string;
|
|
2919
|
+
readonly input: unknown;
|
|
2920
|
+
readonly providerMetadata?: {
|
|
2921
|
+
readonly [x: string]: {
|
|
2922
|
+
readonly [x: string]: unknown;
|
|
2923
|
+
};
|
|
2924
|
+
} | undefined;
|
|
2925
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2926
|
+
};
|
|
2927
|
+
toolResult: (input: WithID<ToolResult, ToolCallID>) => {
|
|
2928
|
+
readonly id: string;
|
|
2929
|
+
readonly type: "tool-result";
|
|
2930
|
+
readonly name: string;
|
|
2931
|
+
readonly result: {
|
|
2932
|
+
readonly type: "error" | "text" | "json";
|
|
2933
|
+
readonly value: unknown;
|
|
2934
|
+
readonly metadata?: {
|
|
2935
|
+
readonly [x: string]: unknown;
|
|
2936
|
+
} | undefined;
|
|
2937
|
+
};
|
|
2938
|
+
readonly providerMetadata?: {
|
|
2939
|
+
readonly [x: string]: {
|
|
2940
|
+
readonly [x: string]: unknown;
|
|
2941
|
+
};
|
|
2942
|
+
} | undefined;
|
|
2943
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2944
|
+
};
|
|
2945
|
+
toolError: (input: WithID<ToolError, ToolCallID>) => {
|
|
2946
|
+
readonly id: string;
|
|
2947
|
+
readonly type: "tool-error";
|
|
2948
|
+
readonly name: string;
|
|
2949
|
+
readonly message: string;
|
|
2950
|
+
readonly metadata?: {
|
|
2951
|
+
readonly [x: string]: unknown;
|
|
2952
|
+
} | undefined;
|
|
2953
|
+
readonly providerMetadata?: {
|
|
2954
|
+
readonly [x: string]: {
|
|
2955
|
+
readonly [x: string]: unknown;
|
|
2956
|
+
};
|
|
2957
|
+
} | undefined;
|
|
2958
|
+
};
|
|
2959
|
+
stepFinish: (input: {
|
|
2960
|
+
readonly index: number;
|
|
2961
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2962
|
+
readonly type?: "step-finish" | undefined;
|
|
2963
|
+
readonly usage?: Usage | undefined;
|
|
2964
|
+
readonly providerMetadata?: {
|
|
2965
|
+
readonly [x: string]: {
|
|
2966
|
+
readonly [x: string]: unknown;
|
|
2967
|
+
};
|
|
2968
|
+
} | undefined;
|
|
2969
|
+
}, options?: Schema.MakeOptions) => {
|
|
2970
|
+
readonly type: "step-finish";
|
|
2971
|
+
readonly index: number;
|
|
2972
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2973
|
+
readonly providerMetadata?: {
|
|
2974
|
+
readonly [x: string]: {
|
|
2975
|
+
readonly [x: string]: unknown;
|
|
2976
|
+
};
|
|
2977
|
+
} | undefined;
|
|
2978
|
+
readonly usage?: Usage | undefined;
|
|
2979
|
+
};
|
|
2980
|
+
requestFinish: (input: {
|
|
2981
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2982
|
+
readonly type?: "request-finish" | undefined;
|
|
2983
|
+
readonly usage?: Usage | undefined;
|
|
2984
|
+
readonly providerMetadata?: {
|
|
2985
|
+
readonly [x: string]: {
|
|
2986
|
+
readonly [x: string]: unknown;
|
|
2987
|
+
};
|
|
2988
|
+
} | undefined;
|
|
2989
|
+
}, options?: Schema.MakeOptions) => {
|
|
2990
|
+
readonly type: "request-finish";
|
|
2991
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2992
|
+
readonly providerMetadata?: {
|
|
2993
|
+
readonly [x: string]: {
|
|
2994
|
+
readonly [x: string]: unknown;
|
|
2995
|
+
};
|
|
2996
|
+
} | undefined;
|
|
2997
|
+
readonly usage?: Usage | undefined;
|
|
2998
|
+
};
|
|
2999
|
+
providerError: (input: {
|
|
3000
|
+
readonly message: string;
|
|
3001
|
+
readonly type?: "provider-error" | undefined;
|
|
3002
|
+
readonly retryable?: boolean | undefined;
|
|
3003
|
+
readonly providerMetadata?: {
|
|
3004
|
+
readonly [x: string]: {
|
|
3005
|
+
readonly [x: string]: unknown;
|
|
3006
|
+
};
|
|
3007
|
+
} | undefined;
|
|
3008
|
+
}, options?: Schema.MakeOptions) => {
|
|
3009
|
+
readonly type: "provider-error";
|
|
3010
|
+
readonly message: string;
|
|
3011
|
+
readonly providerMetadata?: {
|
|
3012
|
+
readonly [x: string]: {
|
|
3013
|
+
readonly [x: string]: unknown;
|
|
3014
|
+
};
|
|
3015
|
+
} | undefined;
|
|
3016
|
+
readonly retryable?: boolean | undefined;
|
|
3017
|
+
};
|
|
3018
|
+
is: {
|
|
3019
|
+
requestStart: (u: unknown) => u is {
|
|
3020
|
+
readonly id: string;
|
|
3021
|
+
readonly type: "request-start";
|
|
3022
|
+
readonly model: ModelRef;
|
|
3023
|
+
};
|
|
3024
|
+
stepStart: (u: unknown) => u is {
|
|
3025
|
+
readonly type: "step-start";
|
|
3026
|
+
readonly index: number;
|
|
3027
|
+
};
|
|
3028
|
+
textStart: (u: unknown) => u is {
|
|
3029
|
+
readonly id: string;
|
|
3030
|
+
readonly type: "text-start";
|
|
3031
|
+
readonly providerMetadata?: {
|
|
3032
|
+
readonly [x: string]: {
|
|
3033
|
+
readonly [x: string]: unknown;
|
|
3034
|
+
};
|
|
3035
|
+
} | undefined;
|
|
3036
|
+
};
|
|
3037
|
+
textDelta: (u: unknown) => u is {
|
|
3038
|
+
readonly id: string;
|
|
3039
|
+
readonly type: "text-delta";
|
|
3040
|
+
readonly text: string;
|
|
3041
|
+
};
|
|
3042
|
+
textEnd: (u: unknown) => u is {
|
|
3043
|
+
readonly id: string;
|
|
3044
|
+
readonly type: "text-end";
|
|
3045
|
+
readonly providerMetadata?: {
|
|
3046
|
+
readonly [x: string]: {
|
|
3047
|
+
readonly [x: string]: unknown;
|
|
3048
|
+
};
|
|
3049
|
+
} | undefined;
|
|
3050
|
+
};
|
|
3051
|
+
reasoningStart: (u: unknown) => u is {
|
|
3052
|
+
readonly id: string;
|
|
3053
|
+
readonly type: "reasoning-start";
|
|
3054
|
+
readonly providerMetadata?: {
|
|
3055
|
+
readonly [x: string]: {
|
|
3056
|
+
readonly [x: string]: unknown;
|
|
3057
|
+
};
|
|
3058
|
+
} | undefined;
|
|
3059
|
+
};
|
|
3060
|
+
reasoningDelta: (u: unknown) => u is {
|
|
3061
|
+
readonly id: string;
|
|
3062
|
+
readonly type: "reasoning-delta";
|
|
3063
|
+
readonly text: string;
|
|
3064
|
+
};
|
|
3065
|
+
reasoningEnd: (u: unknown) => u is {
|
|
3066
|
+
readonly id: string;
|
|
3067
|
+
readonly type: "reasoning-end";
|
|
3068
|
+
readonly providerMetadata?: {
|
|
3069
|
+
readonly [x: string]: {
|
|
3070
|
+
readonly [x: string]: unknown;
|
|
3071
|
+
};
|
|
3072
|
+
} | undefined;
|
|
3073
|
+
};
|
|
3074
|
+
toolInputStart: (u: unknown) => u is {
|
|
3075
|
+
readonly id: string;
|
|
3076
|
+
readonly type: "tool-input-start";
|
|
3077
|
+
readonly name: string;
|
|
3078
|
+
readonly providerMetadata?: {
|
|
3079
|
+
readonly [x: string]: {
|
|
3080
|
+
readonly [x: string]: unknown;
|
|
3081
|
+
};
|
|
3082
|
+
} | undefined;
|
|
3083
|
+
};
|
|
3084
|
+
toolInputDelta: (u: unknown) => u is {
|
|
3085
|
+
readonly id: string;
|
|
3086
|
+
readonly type: "tool-input-delta";
|
|
3087
|
+
readonly text: string;
|
|
3088
|
+
readonly name: string;
|
|
3089
|
+
};
|
|
3090
|
+
toolInputEnd: (u: unknown) => u is {
|
|
3091
|
+
readonly id: string;
|
|
3092
|
+
readonly type: "tool-input-end";
|
|
3093
|
+
readonly name: string;
|
|
3094
|
+
readonly providerMetadata?: {
|
|
3095
|
+
readonly [x: string]: {
|
|
3096
|
+
readonly [x: string]: unknown;
|
|
3097
|
+
};
|
|
3098
|
+
} | undefined;
|
|
3099
|
+
};
|
|
3100
|
+
toolCall: (u: unknown) => u is {
|
|
3101
|
+
readonly id: string;
|
|
3102
|
+
readonly type: "tool-call";
|
|
3103
|
+
readonly name: string;
|
|
3104
|
+
readonly input: unknown;
|
|
3105
|
+
readonly providerMetadata?: {
|
|
3106
|
+
readonly [x: string]: {
|
|
3107
|
+
readonly [x: string]: unknown;
|
|
3108
|
+
};
|
|
3109
|
+
} | undefined;
|
|
3110
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3111
|
+
};
|
|
3112
|
+
toolResult: (u: unknown) => u is {
|
|
3113
|
+
readonly id: string;
|
|
3114
|
+
readonly type: "tool-result";
|
|
3115
|
+
readonly name: string;
|
|
3116
|
+
readonly result: {
|
|
3117
|
+
readonly type: "error" | "text" | "json";
|
|
3118
|
+
readonly value: unknown;
|
|
3119
|
+
readonly metadata?: {
|
|
3120
|
+
readonly [x: string]: unknown;
|
|
3121
|
+
} | undefined;
|
|
3122
|
+
};
|
|
3123
|
+
readonly providerMetadata?: {
|
|
3124
|
+
readonly [x: string]: {
|
|
3125
|
+
readonly [x: string]: unknown;
|
|
3126
|
+
};
|
|
3127
|
+
} | undefined;
|
|
3128
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3129
|
+
};
|
|
3130
|
+
toolError: (u: unknown) => u is {
|
|
3131
|
+
readonly id: string;
|
|
3132
|
+
readonly type: "tool-error";
|
|
3133
|
+
readonly name: string;
|
|
3134
|
+
readonly message: string;
|
|
3135
|
+
readonly metadata?: {
|
|
3136
|
+
readonly [x: string]: unknown;
|
|
3137
|
+
} | undefined;
|
|
3138
|
+
readonly providerMetadata?: {
|
|
3139
|
+
readonly [x: string]: {
|
|
3140
|
+
readonly [x: string]: unknown;
|
|
3141
|
+
};
|
|
3142
|
+
} | undefined;
|
|
3143
|
+
};
|
|
3144
|
+
stepFinish: (u: unknown) => u is {
|
|
3145
|
+
readonly type: "step-finish";
|
|
3146
|
+
readonly index: number;
|
|
3147
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3148
|
+
readonly providerMetadata?: {
|
|
3149
|
+
readonly [x: string]: {
|
|
3150
|
+
readonly [x: string]: unknown;
|
|
3151
|
+
};
|
|
3152
|
+
} | undefined;
|
|
3153
|
+
readonly usage?: Usage | undefined;
|
|
3154
|
+
};
|
|
3155
|
+
requestFinish: (u: unknown) => u is {
|
|
3156
|
+
readonly type: "request-finish";
|
|
3157
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3158
|
+
readonly providerMetadata?: {
|
|
3159
|
+
readonly [x: string]: {
|
|
3160
|
+
readonly [x: string]: unknown;
|
|
3161
|
+
};
|
|
3162
|
+
} | undefined;
|
|
3163
|
+
readonly usage?: Usage | undefined;
|
|
3164
|
+
};
|
|
3165
|
+
providerError: (u: unknown) => u is {
|
|
3166
|
+
readonly type: "provider-error";
|
|
3167
|
+
readonly message: string;
|
|
3168
|
+
readonly providerMetadata?: {
|
|
3169
|
+
readonly [x: string]: {
|
|
3170
|
+
readonly [x: string]: unknown;
|
|
3171
|
+
};
|
|
3172
|
+
} | undefined;
|
|
3173
|
+
readonly retryable?: boolean | undefined;
|
|
3174
|
+
};
|
|
3175
|
+
};
|
|
3176
|
+
}>;
|
|
3177
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
3178
|
+
}>, {}>;
|
|
3179
|
+
export declare class LLMResponse extends LLMResponse_base {
|
|
3180
|
+
/** Concatenated assistant text assembled from streamed `text-delta` events. */
|
|
3181
|
+
get text(): string;
|
|
3182
|
+
/** Concatenated reasoning text assembled from streamed `reasoning-delta` events. */
|
|
3183
|
+
get reasoning(): string;
|
|
3184
|
+
/** Completed tool calls emitted by the provider. */
|
|
3185
|
+
get toolCalls(): {
|
|
3186
|
+
readonly id: string;
|
|
3187
|
+
readonly type: "tool-call";
|
|
3188
|
+
readonly name: string;
|
|
3189
|
+
readonly input: unknown;
|
|
3190
|
+
readonly providerMetadata?: {
|
|
3191
|
+
readonly [x: string]: {
|
|
3192
|
+
readonly [x: string]: unknown;
|
|
3193
|
+
};
|
|
3194
|
+
} | undefined;
|
|
3195
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3196
|
+
}[];
|
|
3197
|
+
}
|
|
3198
|
+
export declare namespace LLMResponse {
|
|
3199
|
+
type Output = LLMResponse | {
|
|
3200
|
+
readonly events: ReadonlyArray<LLMEvent>;
|
|
3201
|
+
readonly usage?: Usage;
|
|
3202
|
+
};
|
|
3203
|
+
/** Concatenate assistant text from a response or collected event list. */
|
|
3204
|
+
const text: (response: Output) => string;
|
|
3205
|
+
/** Return response usage, falling back to the latest usage-bearing event. */
|
|
3206
|
+
const usage: (response: Output) => Usage | undefined;
|
|
3207
|
+
/** Return completed tool calls from a response or collected event list. */
|
|
3208
|
+
const toolCalls: (response: Output) => {
|
|
3209
|
+
readonly id: string;
|
|
3210
|
+
readonly type: "tool-call";
|
|
3211
|
+
readonly name: string;
|
|
3212
|
+
readonly input: unknown;
|
|
3213
|
+
readonly providerMetadata?: {
|
|
3214
|
+
readonly [x: string]: {
|
|
3215
|
+
readonly [x: string]: unknown;
|
|
3216
|
+
};
|
|
3217
|
+
} | undefined;
|
|
3218
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3219
|
+
}[];
|
|
3220
|
+
/** Concatenate reasoning text from a response or collected event list. */
|
|
3221
|
+
const reasoning: (response: Output) => string;
|
|
3222
|
+
}
|
|
3223
|
+
export {};
|
|
3224
|
+
//# sourceMappingURL=events.d.ts.map
|