@opencode-ai/ai 0.0.0-bootstrap.0 → 0.0.0-next-15617
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/README.md +176 -1
- package/dist/cache-policy.d.ts +2 -0
- package/dist/cache-policy.js +108 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/llm.d.ts +223 -0
- package/dist/llm.js +81 -0
- package/dist/protocols/anthropic-messages.d.ts +503 -0
- package/dist/protocols/anthropic-messages.js +745 -0
- package/dist/protocols/bedrock-converse.d.ts +476 -0
- package/dist/protocols/bedrock-converse.js +526 -0
- package/dist/protocols/bedrock-event-stream.d.ts +9 -0
- package/dist/protocols/bedrock-event-stream.js +64 -0
- package/dist/protocols/gemini.d.ts +220 -0
- package/dist/protocols/gemini.js +420 -0
- package/dist/protocols/google-vertex-anthropic.d.ts +494 -0
- package/dist/protocols/google-vertex-anthropic.js +33 -0
- package/dist/protocols/google-vertex-gemini.d.ts +59 -0
- package/dist/protocols/google-vertex-gemini.js +18 -0
- package/dist/protocols/index.d.ts +9 -0
- package/dist/protocols/index.js +9 -0
- package/dist/protocols/openai-chat.d.ts +391 -0
- package/dist/protocols/openai-chat.js +423 -0
- package/dist/protocols/openai-compatible-chat.d.ts +73 -0
- package/dist/protocols/openai-compatible-chat.js +20 -0
- package/dist/protocols/openai-compatible-responses.d.ts +85 -0
- package/dist/protocols/openai-compatible-responses.js +18 -0
- package/dist/protocols/openai-responses.d.ts +613 -0
- package/dist/protocols/openai-responses.js +828 -0
- package/dist/protocols/shared.d.ts +192 -0
- package/dist/protocols/shared.js +236 -0
- package/dist/protocols/utils/bedrock-auth.d.ts +18 -0
- package/dist/protocols/utils/bedrock-auth.js +41 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +15 -0
- package/dist/protocols/utils/bedrock-cache.js +29 -0
- package/dist/protocols/utils/bedrock-media.d.ts +49 -0
- package/dist/protocols/utils/bedrock-media.js +68 -0
- package/dist/protocols/utils/cache.d.ts +6 -0
- package/dist/protocols/utils/cache.js +8 -0
- package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
- package/dist/protocols/utils/gemini-tool-schema.js +83 -0
- package/dist/protocols/utils/lifecycle.d.ts +19 -0
- package/dist/protocols/utils/lifecycle.js +65 -0
- package/dist/protocols/utils/openai-options.d.ts +22 -0
- package/dist/protocols/utils/openai-options.js +64 -0
- package/dist/protocols/utils/tool-schema.d.ts +7 -0
- package/dist/protocols/utils/tool-schema.js +79 -0
- package/dist/protocols/utils/tool-stream.d.ts +155 -0
- package/dist/protocols/utils/tool-stream.js +136 -0
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.js +1 -0
- package/dist/provider-error.d.ts +13 -0
- package/dist/provider-error.js +122 -0
- package/dist/provider-package.d.ts +13 -0
- package/dist/provider-package.js +1 -0
- package/dist/provider.d.ts +23 -0
- package/dist/provider.js +2 -0
- package/dist/providers/amazon-bedrock.d.ts +150 -0
- package/dist/providers/amazon-bedrock.js +41 -0
- package/dist/providers/anthropic-compatible.d.ts +183 -0
- package/dist/providers/anthropic-compatible.js +44 -0
- package/dist/providers/anthropic.d.ts +181 -0
- package/dist/providers/anthropic.js +39 -0
- package/dist/providers/azure/chat.d.ts +2 -0
- package/dist/providers/azure/chat.js +1 -0
- package/dist/providers/azure/responses.d.ts +2 -0
- package/dist/providers/azure/responses.js +1 -0
- package/dist/providers/azure.d.ts +183 -0
- package/dist/providers/azure.js +89 -0
- package/dist/providers/cloudflare.d.ts +232 -0
- package/dist/providers/cloudflare.js +87 -0
- package/dist/providers/github-copilot.d.ts +167 -0
- package/dist/providers/github-copilot.js +47 -0
- package/dist/providers/google-vertex/anthropic.d.ts +2 -0
- package/dist/providers/google-vertex/anthropic.js +1 -0
- package/dist/providers/google-vertex-anthropic.d.ts +181 -0
- package/dist/providers/google-vertex-anthropic.js +46 -0
- package/dist/providers/google-vertex-shared.d.ts +22 -0
- package/dist/providers/google-vertex-shared.js +61 -0
- package/dist/providers/google-vertex.d.ts +93 -0
- package/dist/providers/google-vertex.js +49 -0
- package/dist/providers/google.d.ts +85 -0
- package/dist/providers/google.js +33 -0
- package/dist/providers/index.d.ts +15 -0
- package/dist/providers/index.js +15 -0
- package/dist/providers/openai/chat.d.ts +2 -0
- package/dist/providers/openai/chat.js +1 -0
- package/dist/providers/openai/responses.d.ts +2 -0
- package/dist/providers/openai/responses.js +1 -0
- package/dist/providers/openai-compatible/responses.d.ts +1 -0
- package/dist/providers/openai-compatible/responses.js +1 -0
- package/dist/providers/openai-compatible-profile.d.ts +43 -0
- package/dist/providers/openai-compatible-profile.js +12 -0
- package/dist/providers/openai-compatible-responses.d.ts +107 -0
- package/dist/providers/openai-compatible-responses.js +33 -0
- package/dist/providers/openai-compatible.d.ts +130 -0
- package/dist/providers/openai-compatible.js +55 -0
- package/dist/providers/openai-options.d.ts +30 -0
- package/dist/providers/openai-options.js +42 -0
- package/dist/providers/openai.d.ts +264 -0
- package/dist/providers/openai.js +62 -0
- package/dist/providers/openrouter.d.ts +321 -0
- package/dist/providers/openrouter.js +65 -0
- package/dist/providers/xai.d.ts +169 -0
- package/dist/providers/xai.js +43 -0
- package/dist/providers.d.ts +1 -0
- package/dist/providers.js +1 -0
- package/dist/route/auth-options.d.ts +34 -0
- package/dist/route/auth-options.js +14 -0
- package/dist/route/auth.d.ts +49 -0
- package/dist/route/auth.js +89 -0
- package/dist/route/client.d.ts +330 -0
- package/dist/route/client.js +211 -0
- package/dist/route/endpoint.d.ts +28 -0
- package/dist/route/endpoint.js +21 -0
- package/dist/route/executor.d.ts +12 -0
- package/dist/route/executor.js +229 -0
- package/dist/route/framing.d.ts +23 -0
- package/dist/route/framing.js +4 -0
- package/dist/route/index.d.ts +16 -0
- package/dist/route/index.js +9 -0
- package/dist/route/protocol.d.ts +76 -0
- package/dist/route/protocol.js +17 -0
- package/dist/route/transport/http.d.ts +33 -0
- package/dist/route/transport/http.js +98 -0
- package/dist/route/transport/index.d.ts +27 -0
- package/dist/route/transport/index.js +4 -0
- package/dist/route/transport/websocket.d.ts +56 -0
- package/dist/route/transport/websocket.js +181 -0
- package/dist/route.d.ts +1 -0
- package/dist/route.js +1 -0
- package/dist/schema/errors.d.ts +153 -0
- package/dist/schema/errors.js +150 -0
- package/dist/schema/events.d.ts +4292 -0
- package/dist/schema/events.js +482 -0
- package/dist/schema/ids.d.ts +30 -0
- package/dist/schema/ids.js +18 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/messages.d.ts +385 -0
- package/dist/schema/messages.js +246 -0
- package/dist/schema/options.d.ts +143 -0
- package/dist/schema/options.js +195 -0
- package/dist/tool-runtime.d.ts +15 -0
- package/dist/tool-runtime.js +35 -0
- package/dist/tool.d.ts +134 -0
- package/dist/tool.js +66 -0
- package/dist/utils/record.d.ts +2 -0
- package/dist/utils/record.js +2 -0
- package/package.json +36 -9
- package/index.js +0 -1
|
@@ -0,0 +1,4292 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { ContentBlockID, FinishReason, ProviderMetadata, ToolCallID } from "./ids";
|
|
3
|
+
import { Message, ToolOutput, ToolResultValue } from "./messages";
|
|
4
|
+
declare const Usage_base: Schema.Class<Usage, Schema.Struct<{
|
|
5
|
+
readonly inputTokens: Schema.optional<Schema.Number>;
|
|
6
|
+
readonly outputTokens: Schema.optional<Schema.Number>;
|
|
7
|
+
readonly nonCachedInputTokens: Schema.optional<Schema.Number>;
|
|
8
|
+
readonly cacheReadInputTokens: Schema.optional<Schema.Number>;
|
|
9
|
+
readonly cacheWriteInputTokens: Schema.optional<Schema.Number>;
|
|
10
|
+
readonly reasoningTokens: Schema.optional<Schema.Number>;
|
|
11
|
+
readonly totalTokens: Schema.optional<Schema.Number>;
|
|
12
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
13
|
+
}>, {}>;
|
|
14
|
+
/**
|
|
15
|
+
* Token usage reported by an LLM provider.
|
|
16
|
+
*
|
|
17
|
+
* **Inclusive totals** (match AI SDK / OpenAI / LangChain convention — a
|
|
18
|
+
* reader from any of those ecosystems sees the number they expect):
|
|
19
|
+
*
|
|
20
|
+
* - `inputTokens` — total prompt tokens, *including* cached reads/writes.
|
|
21
|
+
* - `outputTokens` — total output tokens, *including* reasoning.
|
|
22
|
+
* - `totalTokens` — provider-supplied total, or `inputTokens + outputTokens`.
|
|
23
|
+
*
|
|
24
|
+
* **Non-overlapping breakdown** (every field is independently meaningful;
|
|
25
|
+
* consumers never have to subtract):
|
|
26
|
+
*
|
|
27
|
+
* - `nonCachedInputTokens` — the "fresh" portion of the prompt.
|
|
28
|
+
* - `cacheReadInputTokens` — input tokens served from cache.
|
|
29
|
+
* - `cacheWriteInputTokens` — input tokens written to cache.
|
|
30
|
+
* - `reasoningTokens` — subset of `outputTokens` spent on hidden reasoning.
|
|
31
|
+
*
|
|
32
|
+
* **Invariant**: `nonCachedInputTokens + cacheReadInputTokens +
|
|
33
|
+
* cacheWriteInputTokens = inputTokens`, and `reasoningTokens ≤ outputTokens`.
|
|
34
|
+
* Each protocol mapper computes whichever side it doesn't get natively,
|
|
35
|
+
* with `Math.max(0, …)` clamping for defense against provider bugs. Because
|
|
36
|
+
* every breakdown field is stored independently, downstream consumers can
|
|
37
|
+
* read whatever they need (cost-by-category, context-pressure, AI-SDK-style
|
|
38
|
+
* inclusive total) without ever subtracting — eliminating the underflow
|
|
39
|
+
* class of bug where a clamped difference would silently store the wrong
|
|
40
|
+
* value.
|
|
41
|
+
*
|
|
42
|
+
* **Semantics by provider**:
|
|
43
|
+
*
|
|
44
|
+
* - OpenAI Chat / Responses / Gemini / Bedrock: provider reports inclusive
|
|
45
|
+
* `inputTokens` and an inclusive `outputTokens`; mapper subtracts to
|
|
46
|
+
* derive the breakdown.
|
|
47
|
+
* - Anthropic: provider reports the breakdown natively (`input_tokens` is
|
|
48
|
+
* non-cached only); mapper sums to derive the inclusive `inputTokens`.
|
|
49
|
+
* Anthropic does *not* break extended-thinking out of `output_tokens`, so
|
|
50
|
+
* `reasoningTokens` is `undefined` and `outputTokens` carries the
|
|
51
|
+
* combined total — a documented limitation of the Anthropic API.
|
|
52
|
+
*
|
|
53
|
+
* `providerMetadata` always carries the provider's raw usage payload —
|
|
54
|
+
* keyed by provider name (`{ openai: ... }`, `{ anthropic: ... }`, etc.)
|
|
55
|
+
* — for fields we don't normalize and for billing-level audit trails.
|
|
56
|
+
* Matches the same escape-hatch field on `LLMEvent`.
|
|
57
|
+
*/
|
|
58
|
+
export declare class Usage extends Usage_base {
|
|
59
|
+
/**
|
|
60
|
+
* Visible output tokens — `outputTokens` minus `reasoningTokens`, clamped
|
|
61
|
+
* to zero. The one place subtraction happens in this contract; the clamp
|
|
62
|
+
* means a provider reporting `reasoningTokens > outputTokens` produces a
|
|
63
|
+
* harmless zero rather than a negative that crashes downstream schemas.
|
|
64
|
+
*/
|
|
65
|
+
get visibleOutputTokens(): number;
|
|
66
|
+
static from(input: UsageInput): Usage;
|
|
67
|
+
}
|
|
68
|
+
export type UsageInput = Usage | ConstructorParameters<typeof Usage>[0];
|
|
69
|
+
export declare const StepStart: Schema.Struct<{
|
|
70
|
+
readonly type: Schema.tag<"step-start">;
|
|
71
|
+
readonly index: Schema.Number;
|
|
72
|
+
}>;
|
|
73
|
+
export type StepStart = Schema.Schema.Type<typeof StepStart>;
|
|
74
|
+
export declare const TextStart: Schema.Struct<{
|
|
75
|
+
readonly type: Schema.tag<"text-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 TextStart = Schema.Schema.Type<typeof TextStart>;
|
|
80
|
+
export declare const TextDelta: Schema.Struct<{
|
|
81
|
+
readonly type: Schema.tag<"text-delta">;
|
|
82
|
+
readonly id: Schema.String;
|
|
83
|
+
readonly text: Schema.String;
|
|
84
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
85
|
+
}>;
|
|
86
|
+
export type TextDelta = Schema.Schema.Type<typeof TextDelta>;
|
|
87
|
+
export declare const TextEnd: Schema.Struct<{
|
|
88
|
+
readonly type: Schema.tag<"text-end">;
|
|
89
|
+
readonly id: Schema.String;
|
|
90
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
91
|
+
}>;
|
|
92
|
+
export type TextEnd = Schema.Schema.Type<typeof TextEnd>;
|
|
93
|
+
export declare const ReasoningStart: Schema.Struct<{
|
|
94
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
95
|
+
readonly id: Schema.String;
|
|
96
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
97
|
+
}>;
|
|
98
|
+
export type ReasoningStart = Schema.Schema.Type<typeof ReasoningStart>;
|
|
99
|
+
export declare const ReasoningDelta: Schema.Struct<{
|
|
100
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
101
|
+
readonly id: Schema.String;
|
|
102
|
+
readonly text: Schema.String;
|
|
103
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
104
|
+
}>;
|
|
105
|
+
export type ReasoningDelta = Schema.Schema.Type<typeof ReasoningDelta>;
|
|
106
|
+
export declare const ReasoningEnd: Schema.Struct<{
|
|
107
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
108
|
+
readonly id: Schema.String;
|
|
109
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
110
|
+
}>;
|
|
111
|
+
export type ReasoningEnd = Schema.Schema.Type<typeof ReasoningEnd>;
|
|
112
|
+
export declare const ToolInputStart: Schema.Struct<{
|
|
113
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
114
|
+
readonly id: Schema.String;
|
|
115
|
+
readonly name: Schema.String;
|
|
116
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
117
|
+
}>;
|
|
118
|
+
export type ToolInputStart = Schema.Schema.Type<typeof ToolInputStart>;
|
|
119
|
+
export declare const ToolInputDelta: Schema.Struct<{
|
|
120
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
121
|
+
readonly id: Schema.String;
|
|
122
|
+
readonly name: Schema.String;
|
|
123
|
+
readonly text: Schema.String;
|
|
124
|
+
}>;
|
|
125
|
+
export type ToolInputDelta = Schema.Schema.Type<typeof ToolInputDelta>;
|
|
126
|
+
export declare const ToolInputEnd: Schema.Struct<{
|
|
127
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
128
|
+
readonly id: Schema.String;
|
|
129
|
+
readonly name: Schema.String;
|
|
130
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
131
|
+
}>;
|
|
132
|
+
export type ToolInputEnd = Schema.Schema.Type<typeof ToolInputEnd>;
|
|
133
|
+
export declare const ToolCall: Schema.Struct<{
|
|
134
|
+
readonly type: Schema.tag<"tool-call">;
|
|
135
|
+
readonly id: Schema.String;
|
|
136
|
+
readonly name: Schema.String;
|
|
137
|
+
readonly input: Schema.Unknown;
|
|
138
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
139
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
140
|
+
}>;
|
|
141
|
+
export type ToolCall = Schema.Schema.Type<typeof ToolCall>;
|
|
142
|
+
export declare const ToolResult: Schema.Struct<{
|
|
143
|
+
readonly type: Schema.tag<"tool-result">;
|
|
144
|
+
readonly id: Schema.String;
|
|
145
|
+
readonly name: Schema.String;
|
|
146
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
147
|
+
readonly type: Schema.Literal<"json">;
|
|
148
|
+
readonly value: Schema.Unknown;
|
|
149
|
+
}>, Schema.Struct<{
|
|
150
|
+
readonly type: Schema.Literal<"text">;
|
|
151
|
+
readonly value: Schema.Unknown;
|
|
152
|
+
}>, Schema.Struct<{
|
|
153
|
+
readonly type: Schema.Literal<"error">;
|
|
154
|
+
readonly value: Schema.Unknown;
|
|
155
|
+
}>, Schema.Struct<{
|
|
156
|
+
readonly type: Schema.Literal<"content">;
|
|
157
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
158
|
+
readonly type: Schema.Literal<"text">;
|
|
159
|
+
readonly text: Schema.String;
|
|
160
|
+
}>, Schema.Struct<{
|
|
161
|
+
readonly type: Schema.Literal<"file">;
|
|
162
|
+
readonly uri: Schema.String;
|
|
163
|
+
readonly mime: Schema.String;
|
|
164
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
165
|
+
}>]>>;
|
|
166
|
+
}>]> & {
|
|
167
|
+
is: (value: unknown) => value is ToolResultValue;
|
|
168
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
169
|
+
};
|
|
170
|
+
readonly output: Schema.optional<Schema.Struct<{
|
|
171
|
+
readonly structured: Schema.Unknown;
|
|
172
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
173
|
+
readonly type: Schema.Literal<"text">;
|
|
174
|
+
readonly text: Schema.String;
|
|
175
|
+
}>, Schema.Struct<{
|
|
176
|
+
readonly type: Schema.Literal<"file">;
|
|
177
|
+
readonly uri: Schema.String;
|
|
178
|
+
readonly mime: Schema.String;
|
|
179
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
180
|
+
}>]>>;
|
|
181
|
+
}> & {
|
|
182
|
+
make: (structured: unknown, content?: ReadonlyArray<import("@opencode-ai/schema/llm").ToolContent>) => ToolOutput;
|
|
183
|
+
fromResultValue: (result: ToolResultValue) => ToolOutput | undefined;
|
|
184
|
+
toResultValue: (output: ToolOutput) => ToolResultValue;
|
|
185
|
+
}>;
|
|
186
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
187
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
188
|
+
}>;
|
|
189
|
+
export type ToolResult = Schema.Schema.Type<typeof ToolResult>;
|
|
190
|
+
export declare const ToolError: Schema.Struct<{
|
|
191
|
+
readonly type: Schema.tag<"tool-error">;
|
|
192
|
+
readonly id: Schema.String;
|
|
193
|
+
readonly name: Schema.String;
|
|
194
|
+
readonly message: Schema.String;
|
|
195
|
+
readonly error: Schema.optional<Schema.Defect>;
|
|
196
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
197
|
+
}>;
|
|
198
|
+
export type ToolError = Schema.Schema.Type<typeof ToolError>;
|
|
199
|
+
export declare const StepFinish: Schema.Struct<{
|
|
200
|
+
readonly type: Schema.tag<"step-finish">;
|
|
201
|
+
readonly index: Schema.Number;
|
|
202
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
203
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
204
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
205
|
+
}>;
|
|
206
|
+
export type StepFinish = Schema.Schema.Type<typeof StepFinish>;
|
|
207
|
+
export declare const Finish: Schema.Struct<{
|
|
208
|
+
readonly type: Schema.tag<"finish">;
|
|
209
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
210
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
211
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
212
|
+
}>;
|
|
213
|
+
export type Finish = Schema.Schema.Type<typeof Finish>;
|
|
214
|
+
export declare const ProviderErrorEvent: Schema.Struct<{
|
|
215
|
+
readonly type: Schema.tag<"provider-error">;
|
|
216
|
+
readonly message: Schema.String;
|
|
217
|
+
readonly classification: Schema.optional<Schema.Literal<"context-overflow">>;
|
|
218
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
219
|
+
}>;
|
|
220
|
+
export type ProviderErrorEvent = Schema.Schema.Type<typeof ProviderErrorEvent>;
|
|
221
|
+
declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
222
|
+
readonly type: Schema.tag<"step-start">;
|
|
223
|
+
readonly index: Schema.Number;
|
|
224
|
+
}>, Schema.Struct<{
|
|
225
|
+
readonly type: Schema.tag<"text-start">;
|
|
226
|
+
readonly id: Schema.String;
|
|
227
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
228
|
+
}>, Schema.Struct<{
|
|
229
|
+
readonly type: Schema.tag<"text-delta">;
|
|
230
|
+
readonly id: Schema.String;
|
|
231
|
+
readonly text: Schema.String;
|
|
232
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
233
|
+
}>, Schema.Struct<{
|
|
234
|
+
readonly type: Schema.tag<"text-end">;
|
|
235
|
+
readonly id: Schema.String;
|
|
236
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
237
|
+
}>, Schema.Struct<{
|
|
238
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
239
|
+
readonly id: Schema.String;
|
|
240
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
241
|
+
}>, Schema.Struct<{
|
|
242
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
243
|
+
readonly id: Schema.String;
|
|
244
|
+
readonly text: Schema.String;
|
|
245
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
246
|
+
}>, Schema.Struct<{
|
|
247
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
248
|
+
readonly id: Schema.String;
|
|
249
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
250
|
+
}>, Schema.Struct<{
|
|
251
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
252
|
+
readonly id: Schema.String;
|
|
253
|
+
readonly name: Schema.String;
|
|
254
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
255
|
+
}>, Schema.Struct<{
|
|
256
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
257
|
+
readonly id: Schema.String;
|
|
258
|
+
readonly name: Schema.String;
|
|
259
|
+
readonly text: Schema.String;
|
|
260
|
+
}>, Schema.Struct<{
|
|
261
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
262
|
+
readonly id: Schema.String;
|
|
263
|
+
readonly name: Schema.String;
|
|
264
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
265
|
+
}>, Schema.Struct<{
|
|
266
|
+
readonly type: Schema.tag<"tool-call">;
|
|
267
|
+
readonly id: Schema.String;
|
|
268
|
+
readonly name: Schema.String;
|
|
269
|
+
readonly input: Schema.Unknown;
|
|
270
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
271
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
272
|
+
}>, Schema.Struct<{
|
|
273
|
+
readonly type: Schema.tag<"tool-result">;
|
|
274
|
+
readonly id: Schema.String;
|
|
275
|
+
readonly name: Schema.String;
|
|
276
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
277
|
+
readonly type: Schema.Literal<"json">;
|
|
278
|
+
readonly value: Schema.Unknown;
|
|
279
|
+
}>, Schema.Struct<{
|
|
280
|
+
readonly type: Schema.Literal<"text">;
|
|
281
|
+
readonly value: Schema.Unknown;
|
|
282
|
+
}>, Schema.Struct<{
|
|
283
|
+
readonly type: Schema.Literal<"error">;
|
|
284
|
+
readonly value: Schema.Unknown;
|
|
285
|
+
}>, Schema.Struct<{
|
|
286
|
+
readonly type: Schema.Literal<"content">;
|
|
287
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
288
|
+
readonly type: Schema.Literal<"text">;
|
|
289
|
+
readonly text: Schema.String;
|
|
290
|
+
}>, Schema.Struct<{
|
|
291
|
+
readonly type: Schema.Literal<"file">;
|
|
292
|
+
readonly uri: Schema.String;
|
|
293
|
+
readonly mime: Schema.String;
|
|
294
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
295
|
+
}>]>>;
|
|
296
|
+
}>]> & {
|
|
297
|
+
is: (value: unknown) => value is ToolResultValue;
|
|
298
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
299
|
+
};
|
|
300
|
+
readonly output: Schema.optional<Schema.Struct<{
|
|
301
|
+
readonly structured: Schema.Unknown;
|
|
302
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
303
|
+
readonly type: Schema.Literal<"text">;
|
|
304
|
+
readonly text: Schema.String;
|
|
305
|
+
}>, Schema.Struct<{
|
|
306
|
+
readonly type: Schema.Literal<"file">;
|
|
307
|
+
readonly uri: Schema.String;
|
|
308
|
+
readonly mime: Schema.String;
|
|
309
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
310
|
+
}>]>>;
|
|
311
|
+
}> & {
|
|
312
|
+
make: (structured: unknown, content?: ReadonlyArray<import("@opencode-ai/schema/llm").ToolContent>) => ToolOutput;
|
|
313
|
+
fromResultValue: (result: ToolResultValue) => ToolOutput | undefined;
|
|
314
|
+
toResultValue: (output: ToolOutput) => ToolResultValue;
|
|
315
|
+
}>;
|
|
316
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
317
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
318
|
+
}>, Schema.Struct<{
|
|
319
|
+
readonly type: Schema.tag<"tool-error">;
|
|
320
|
+
readonly id: Schema.String;
|
|
321
|
+
readonly name: Schema.String;
|
|
322
|
+
readonly message: Schema.String;
|
|
323
|
+
readonly error: Schema.optional<Schema.Defect>;
|
|
324
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
325
|
+
}>, Schema.Struct<{
|
|
326
|
+
readonly type: Schema.tag<"step-finish">;
|
|
327
|
+
readonly index: Schema.Number;
|
|
328
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
329
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
330
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
331
|
+
}>, Schema.Struct<{
|
|
332
|
+
readonly type: Schema.tag<"finish">;
|
|
333
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
334
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
335
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
336
|
+
}>, Schema.Struct<{
|
|
337
|
+
readonly type: Schema.tag<"provider-error">;
|
|
338
|
+
readonly message: Schema.String;
|
|
339
|
+
readonly classification: Schema.optional<Schema.Literal<"context-overflow">>;
|
|
340
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
341
|
+
}>]>;
|
|
342
|
+
type WithID<Event extends {
|
|
343
|
+
readonly id: unknown;
|
|
344
|
+
}, ID> = Omit<Event, "type" | "id"> & {
|
|
345
|
+
readonly id: ID | string;
|
|
346
|
+
};
|
|
347
|
+
type WithUsage<Event extends {
|
|
348
|
+
readonly usage?: Usage;
|
|
349
|
+
}> = Omit<Event, "type" | "usage"> & {
|
|
350
|
+
readonly usage?: UsageInput;
|
|
351
|
+
};
|
|
352
|
+
/**
|
|
353
|
+
* camelCase aliases for `LLMEvent.guards` (provided by `Schema.toTaggedUnion`).
|
|
354
|
+
* Lets consumers write `events.filter(LLMEvent.is.toolCall)` instead of
|
|
355
|
+
* `events.filter(LLMEvent.guards["tool-call"])`.
|
|
356
|
+
*/
|
|
357
|
+
export declare const LLMEvent: Schema.Union<readonly [Schema.Struct<{
|
|
358
|
+
readonly type: Schema.tag<"step-start">;
|
|
359
|
+
readonly index: Schema.Number;
|
|
360
|
+
}>, Schema.Struct<{
|
|
361
|
+
readonly type: Schema.tag<"text-start">;
|
|
362
|
+
readonly id: Schema.String;
|
|
363
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
364
|
+
}>, Schema.Struct<{
|
|
365
|
+
readonly type: Schema.tag<"text-delta">;
|
|
366
|
+
readonly id: Schema.String;
|
|
367
|
+
readonly text: Schema.String;
|
|
368
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
369
|
+
}>, Schema.Struct<{
|
|
370
|
+
readonly type: Schema.tag<"text-end">;
|
|
371
|
+
readonly id: Schema.String;
|
|
372
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
373
|
+
}>, Schema.Struct<{
|
|
374
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
375
|
+
readonly id: Schema.String;
|
|
376
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
377
|
+
}>, Schema.Struct<{
|
|
378
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
379
|
+
readonly id: Schema.String;
|
|
380
|
+
readonly text: Schema.String;
|
|
381
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
382
|
+
}>, Schema.Struct<{
|
|
383
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
384
|
+
readonly id: Schema.String;
|
|
385
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
386
|
+
}>, Schema.Struct<{
|
|
387
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
388
|
+
readonly id: Schema.String;
|
|
389
|
+
readonly name: Schema.String;
|
|
390
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
391
|
+
}>, Schema.Struct<{
|
|
392
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
393
|
+
readonly id: Schema.String;
|
|
394
|
+
readonly name: Schema.String;
|
|
395
|
+
readonly text: Schema.String;
|
|
396
|
+
}>, Schema.Struct<{
|
|
397
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
398
|
+
readonly id: Schema.String;
|
|
399
|
+
readonly name: Schema.String;
|
|
400
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
401
|
+
}>, Schema.Struct<{
|
|
402
|
+
readonly type: Schema.tag<"tool-call">;
|
|
403
|
+
readonly id: Schema.String;
|
|
404
|
+
readonly name: Schema.String;
|
|
405
|
+
readonly input: Schema.Unknown;
|
|
406
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
407
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
408
|
+
}>, Schema.Struct<{
|
|
409
|
+
readonly type: Schema.tag<"tool-result">;
|
|
410
|
+
readonly id: Schema.String;
|
|
411
|
+
readonly name: Schema.String;
|
|
412
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
413
|
+
readonly type: Schema.Literal<"json">;
|
|
414
|
+
readonly value: Schema.Unknown;
|
|
415
|
+
}>, Schema.Struct<{
|
|
416
|
+
readonly type: Schema.Literal<"text">;
|
|
417
|
+
readonly value: Schema.Unknown;
|
|
418
|
+
}>, Schema.Struct<{
|
|
419
|
+
readonly type: Schema.Literal<"error">;
|
|
420
|
+
readonly value: Schema.Unknown;
|
|
421
|
+
}>, Schema.Struct<{
|
|
422
|
+
readonly type: Schema.Literal<"content">;
|
|
423
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
424
|
+
readonly type: Schema.Literal<"text">;
|
|
425
|
+
readonly text: Schema.String;
|
|
426
|
+
}>, Schema.Struct<{
|
|
427
|
+
readonly type: Schema.Literal<"file">;
|
|
428
|
+
readonly uri: Schema.String;
|
|
429
|
+
readonly mime: Schema.String;
|
|
430
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
431
|
+
}>]>>;
|
|
432
|
+
}>]> & {
|
|
433
|
+
is: (value: unknown) => value is ToolResultValue;
|
|
434
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
435
|
+
};
|
|
436
|
+
readonly output: Schema.optional<Schema.Struct<{
|
|
437
|
+
readonly structured: Schema.Unknown;
|
|
438
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
439
|
+
readonly type: Schema.Literal<"text">;
|
|
440
|
+
readonly text: Schema.String;
|
|
441
|
+
}>, Schema.Struct<{
|
|
442
|
+
readonly type: Schema.Literal<"file">;
|
|
443
|
+
readonly uri: Schema.String;
|
|
444
|
+
readonly mime: Schema.String;
|
|
445
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
446
|
+
}>]>>;
|
|
447
|
+
}> & {
|
|
448
|
+
make: (structured: unknown, content?: ReadonlyArray<import("@opencode-ai/schema/llm").ToolContent>) => ToolOutput;
|
|
449
|
+
fromResultValue: (result: ToolResultValue) => ToolOutput | undefined;
|
|
450
|
+
toResultValue: (output: ToolOutput) => ToolResultValue;
|
|
451
|
+
}>;
|
|
452
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
453
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
454
|
+
}>, Schema.Struct<{
|
|
455
|
+
readonly type: Schema.tag<"tool-error">;
|
|
456
|
+
readonly id: Schema.String;
|
|
457
|
+
readonly name: Schema.String;
|
|
458
|
+
readonly message: Schema.String;
|
|
459
|
+
readonly error: Schema.optional<Schema.Defect>;
|
|
460
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
461
|
+
}>, Schema.Struct<{
|
|
462
|
+
readonly type: Schema.tag<"step-finish">;
|
|
463
|
+
readonly index: Schema.Number;
|
|
464
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
465
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
466
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
467
|
+
}>, Schema.Struct<{
|
|
468
|
+
readonly type: Schema.tag<"finish">;
|
|
469
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
470
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
471
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
472
|
+
}>, Schema.Struct<{
|
|
473
|
+
readonly type: Schema.tag<"provider-error">;
|
|
474
|
+
readonly message: Schema.String;
|
|
475
|
+
readonly classification: Schema.optional<Schema.Literal<"context-overflow">>;
|
|
476
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
477
|
+
}>]> & {
|
|
478
|
+
readonly cases: {
|
|
479
|
+
"step-start": Schema.Struct<{
|
|
480
|
+
readonly type: Schema.tag<"step-start">;
|
|
481
|
+
readonly index: Schema.Number;
|
|
482
|
+
}>;
|
|
483
|
+
"text-start": Schema.Struct<{
|
|
484
|
+
readonly type: Schema.tag<"text-start">;
|
|
485
|
+
readonly id: Schema.String;
|
|
486
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
487
|
+
}>;
|
|
488
|
+
"text-delta": Schema.Struct<{
|
|
489
|
+
readonly type: Schema.tag<"text-delta">;
|
|
490
|
+
readonly id: Schema.String;
|
|
491
|
+
readonly text: Schema.String;
|
|
492
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
493
|
+
}>;
|
|
494
|
+
"text-end": Schema.Struct<{
|
|
495
|
+
readonly type: Schema.tag<"text-end">;
|
|
496
|
+
readonly id: Schema.String;
|
|
497
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
498
|
+
}>;
|
|
499
|
+
"reasoning-start": Schema.Struct<{
|
|
500
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
501
|
+
readonly id: Schema.String;
|
|
502
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
503
|
+
}>;
|
|
504
|
+
"reasoning-delta": Schema.Struct<{
|
|
505
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
506
|
+
readonly id: Schema.String;
|
|
507
|
+
readonly text: Schema.String;
|
|
508
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
509
|
+
}>;
|
|
510
|
+
"reasoning-end": Schema.Struct<{
|
|
511
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
512
|
+
readonly id: Schema.String;
|
|
513
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
514
|
+
}>;
|
|
515
|
+
"tool-input-start": Schema.Struct<{
|
|
516
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
517
|
+
readonly id: Schema.String;
|
|
518
|
+
readonly name: Schema.String;
|
|
519
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
520
|
+
}>;
|
|
521
|
+
"tool-input-delta": Schema.Struct<{
|
|
522
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
523
|
+
readonly id: Schema.String;
|
|
524
|
+
readonly name: Schema.String;
|
|
525
|
+
readonly text: Schema.String;
|
|
526
|
+
}>;
|
|
527
|
+
"tool-input-end": Schema.Struct<{
|
|
528
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
529
|
+
readonly id: Schema.String;
|
|
530
|
+
readonly name: Schema.String;
|
|
531
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
532
|
+
}>;
|
|
533
|
+
"tool-call": Schema.Struct<{
|
|
534
|
+
readonly type: Schema.tag<"tool-call">;
|
|
535
|
+
readonly id: Schema.String;
|
|
536
|
+
readonly name: Schema.String;
|
|
537
|
+
readonly input: Schema.Unknown;
|
|
538
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
539
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
540
|
+
}>;
|
|
541
|
+
"tool-result": Schema.Struct<{
|
|
542
|
+
readonly type: Schema.tag<"tool-result">;
|
|
543
|
+
readonly id: Schema.String;
|
|
544
|
+
readonly name: Schema.String;
|
|
545
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
546
|
+
readonly type: Schema.Literal<"json">;
|
|
547
|
+
readonly value: Schema.Unknown;
|
|
548
|
+
}>, Schema.Struct<{
|
|
549
|
+
readonly type: Schema.Literal<"text">;
|
|
550
|
+
readonly value: Schema.Unknown;
|
|
551
|
+
}>, Schema.Struct<{
|
|
552
|
+
readonly type: Schema.Literal<"error">;
|
|
553
|
+
readonly value: Schema.Unknown;
|
|
554
|
+
}>, Schema.Struct<{
|
|
555
|
+
readonly type: Schema.Literal<"content">;
|
|
556
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
557
|
+
readonly type: Schema.Literal<"text">;
|
|
558
|
+
readonly text: Schema.String;
|
|
559
|
+
}>, Schema.Struct<{
|
|
560
|
+
readonly type: Schema.Literal<"file">;
|
|
561
|
+
readonly uri: Schema.String;
|
|
562
|
+
readonly mime: Schema.String;
|
|
563
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
564
|
+
}>]>>;
|
|
565
|
+
}>]> & {
|
|
566
|
+
is: (value: unknown) => value is ToolResultValue;
|
|
567
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
568
|
+
};
|
|
569
|
+
readonly output: Schema.optional<Schema.Struct<{
|
|
570
|
+
readonly structured: Schema.Unknown;
|
|
571
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
572
|
+
readonly type: Schema.Literal<"text">;
|
|
573
|
+
readonly text: Schema.String;
|
|
574
|
+
}>, Schema.Struct<{
|
|
575
|
+
readonly type: Schema.Literal<"file">;
|
|
576
|
+
readonly uri: Schema.String;
|
|
577
|
+
readonly mime: Schema.String;
|
|
578
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
579
|
+
}>]>>;
|
|
580
|
+
}> & {
|
|
581
|
+
make: (structured: unknown, content?: ReadonlyArray<import("@opencode-ai/schema/llm").ToolContent>) => ToolOutput;
|
|
582
|
+
fromResultValue: (result: ToolResultValue) => ToolOutput | undefined;
|
|
583
|
+
toResultValue: (output: ToolOutput) => ToolResultValue;
|
|
584
|
+
}>;
|
|
585
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
586
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
587
|
+
}>;
|
|
588
|
+
"tool-error": Schema.Struct<{
|
|
589
|
+
readonly type: Schema.tag<"tool-error">;
|
|
590
|
+
readonly id: Schema.String;
|
|
591
|
+
readonly name: Schema.String;
|
|
592
|
+
readonly message: Schema.String;
|
|
593
|
+
readonly error: Schema.optional<Schema.Defect>;
|
|
594
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
595
|
+
}>;
|
|
596
|
+
"step-finish": Schema.Struct<{
|
|
597
|
+
readonly type: Schema.tag<"step-finish">;
|
|
598
|
+
readonly index: Schema.Number;
|
|
599
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
600
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
601
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
602
|
+
}>;
|
|
603
|
+
finish: Schema.Struct<{
|
|
604
|
+
readonly type: Schema.tag<"finish">;
|
|
605
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
606
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
607
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
608
|
+
}>;
|
|
609
|
+
"provider-error": Schema.Struct<{
|
|
610
|
+
readonly type: Schema.tag<"provider-error">;
|
|
611
|
+
readonly message: Schema.String;
|
|
612
|
+
readonly classification: Schema.optional<Schema.Literal<"context-overflow">>;
|
|
613
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
614
|
+
}>;
|
|
615
|
+
};
|
|
616
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
617
|
+
readonly type: "step-start";
|
|
618
|
+
readonly index: number;
|
|
619
|
+
} | {
|
|
620
|
+
readonly type: "text-start";
|
|
621
|
+
readonly id: string;
|
|
622
|
+
readonly providerMetadata?: {
|
|
623
|
+
readonly [x: string]: {
|
|
624
|
+
readonly [x: string]: unknown;
|
|
625
|
+
};
|
|
626
|
+
} | undefined;
|
|
627
|
+
} | {
|
|
628
|
+
readonly type: "text-delta";
|
|
629
|
+
readonly id: string;
|
|
630
|
+
readonly text: string;
|
|
631
|
+
readonly providerMetadata?: {
|
|
632
|
+
readonly [x: string]: {
|
|
633
|
+
readonly [x: string]: unknown;
|
|
634
|
+
};
|
|
635
|
+
} | undefined;
|
|
636
|
+
} | {
|
|
637
|
+
readonly type: "text-end";
|
|
638
|
+
readonly id: string;
|
|
639
|
+
readonly providerMetadata?: {
|
|
640
|
+
readonly [x: string]: {
|
|
641
|
+
readonly [x: string]: unknown;
|
|
642
|
+
};
|
|
643
|
+
} | undefined;
|
|
644
|
+
} | {
|
|
645
|
+
readonly type: "reasoning-start";
|
|
646
|
+
readonly id: string;
|
|
647
|
+
readonly providerMetadata?: {
|
|
648
|
+
readonly [x: string]: {
|
|
649
|
+
readonly [x: string]: unknown;
|
|
650
|
+
};
|
|
651
|
+
} | undefined;
|
|
652
|
+
} | {
|
|
653
|
+
readonly type: "reasoning-delta";
|
|
654
|
+
readonly id: string;
|
|
655
|
+
readonly text: string;
|
|
656
|
+
readonly providerMetadata?: {
|
|
657
|
+
readonly [x: string]: {
|
|
658
|
+
readonly [x: string]: unknown;
|
|
659
|
+
};
|
|
660
|
+
} | undefined;
|
|
661
|
+
} | {
|
|
662
|
+
readonly type: "reasoning-end";
|
|
663
|
+
readonly id: string;
|
|
664
|
+
readonly providerMetadata?: {
|
|
665
|
+
readonly [x: string]: {
|
|
666
|
+
readonly [x: string]: unknown;
|
|
667
|
+
};
|
|
668
|
+
} | undefined;
|
|
669
|
+
} | {
|
|
670
|
+
readonly type: "tool-input-start";
|
|
671
|
+
readonly id: string;
|
|
672
|
+
readonly name: string;
|
|
673
|
+
readonly providerMetadata?: {
|
|
674
|
+
readonly [x: string]: {
|
|
675
|
+
readonly [x: string]: unknown;
|
|
676
|
+
};
|
|
677
|
+
} | undefined;
|
|
678
|
+
} | {
|
|
679
|
+
readonly type: "tool-input-delta";
|
|
680
|
+
readonly id: string;
|
|
681
|
+
readonly name: string;
|
|
682
|
+
readonly text: string;
|
|
683
|
+
} | {
|
|
684
|
+
readonly type: "tool-input-end";
|
|
685
|
+
readonly id: string;
|
|
686
|
+
readonly name: string;
|
|
687
|
+
readonly providerMetadata?: {
|
|
688
|
+
readonly [x: string]: {
|
|
689
|
+
readonly [x: string]: unknown;
|
|
690
|
+
};
|
|
691
|
+
} | undefined;
|
|
692
|
+
} | {
|
|
693
|
+
readonly type: "tool-call";
|
|
694
|
+
readonly id: string;
|
|
695
|
+
readonly name: string;
|
|
696
|
+
readonly input: unknown;
|
|
697
|
+
readonly providerExecuted?: boolean | undefined;
|
|
698
|
+
readonly providerMetadata?: {
|
|
699
|
+
readonly [x: string]: {
|
|
700
|
+
readonly [x: string]: unknown;
|
|
701
|
+
};
|
|
702
|
+
} | undefined;
|
|
703
|
+
} | {
|
|
704
|
+
readonly type: "tool-result";
|
|
705
|
+
readonly id: string;
|
|
706
|
+
readonly name: string;
|
|
707
|
+
readonly result: {
|
|
708
|
+
readonly type: "json";
|
|
709
|
+
readonly value: unknown;
|
|
710
|
+
} | {
|
|
711
|
+
readonly type: "text";
|
|
712
|
+
readonly value: unknown;
|
|
713
|
+
} | {
|
|
714
|
+
readonly type: "error";
|
|
715
|
+
readonly value: unknown;
|
|
716
|
+
} | {
|
|
717
|
+
readonly type: "content";
|
|
718
|
+
readonly value: readonly ({
|
|
719
|
+
readonly type: "text";
|
|
720
|
+
readonly text: string;
|
|
721
|
+
} | {
|
|
722
|
+
readonly type: "file";
|
|
723
|
+
readonly uri: string;
|
|
724
|
+
readonly mime: string;
|
|
725
|
+
readonly name?: string | undefined;
|
|
726
|
+
})[];
|
|
727
|
+
};
|
|
728
|
+
readonly output?: {
|
|
729
|
+
readonly structured: unknown;
|
|
730
|
+
readonly content: readonly ({
|
|
731
|
+
readonly type: "text";
|
|
732
|
+
readonly text: string;
|
|
733
|
+
} | {
|
|
734
|
+
readonly type: "file";
|
|
735
|
+
readonly uri: string;
|
|
736
|
+
readonly mime: string;
|
|
737
|
+
readonly name?: string | undefined;
|
|
738
|
+
})[];
|
|
739
|
+
} | undefined;
|
|
740
|
+
readonly providerExecuted?: boolean | undefined;
|
|
741
|
+
readonly providerMetadata?: {
|
|
742
|
+
readonly [x: string]: {
|
|
743
|
+
readonly [x: string]: unknown;
|
|
744
|
+
};
|
|
745
|
+
} | undefined;
|
|
746
|
+
} | {
|
|
747
|
+
readonly type: "tool-error";
|
|
748
|
+
readonly id: string;
|
|
749
|
+
readonly name: string;
|
|
750
|
+
readonly message: string;
|
|
751
|
+
readonly error?: unknown;
|
|
752
|
+
readonly providerMetadata?: {
|
|
753
|
+
readonly [x: string]: {
|
|
754
|
+
readonly [x: string]: unknown;
|
|
755
|
+
};
|
|
756
|
+
} | undefined;
|
|
757
|
+
} | {
|
|
758
|
+
readonly type: "step-finish";
|
|
759
|
+
readonly index: number;
|
|
760
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
761
|
+
readonly usage?: Usage | undefined;
|
|
762
|
+
readonly providerMetadata?: {
|
|
763
|
+
readonly [x: string]: {
|
|
764
|
+
readonly [x: string]: unknown;
|
|
765
|
+
};
|
|
766
|
+
} | undefined;
|
|
767
|
+
} | {
|
|
768
|
+
readonly type: "finish";
|
|
769
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
770
|
+
readonly usage?: Usage | undefined;
|
|
771
|
+
readonly providerMetadata?: {
|
|
772
|
+
readonly [x: string]: {
|
|
773
|
+
readonly [x: string]: unknown;
|
|
774
|
+
};
|
|
775
|
+
} | undefined;
|
|
776
|
+
} | {
|
|
777
|
+
readonly type: "provider-error";
|
|
778
|
+
readonly message: string;
|
|
779
|
+
readonly classification?: "context-overflow" | undefined;
|
|
780
|
+
readonly providerMetadata?: {
|
|
781
|
+
readonly [x: string]: {
|
|
782
|
+
readonly [x: string]: unknown;
|
|
783
|
+
};
|
|
784
|
+
} | undefined;
|
|
785
|
+
}) => value is Extract<{
|
|
786
|
+
readonly type: "step-start";
|
|
787
|
+
readonly index: number;
|
|
788
|
+
}, {
|
|
789
|
+
readonly type: Keys;
|
|
790
|
+
}> | Extract<{
|
|
791
|
+
readonly type: "text-start";
|
|
792
|
+
readonly id: string;
|
|
793
|
+
readonly providerMetadata?: {
|
|
794
|
+
readonly [x: string]: {
|
|
795
|
+
readonly [x: string]: unknown;
|
|
796
|
+
};
|
|
797
|
+
} | undefined;
|
|
798
|
+
}, {
|
|
799
|
+
readonly type: Keys;
|
|
800
|
+
}> | Extract<{
|
|
801
|
+
readonly type: "text-delta";
|
|
802
|
+
readonly id: string;
|
|
803
|
+
readonly text: string;
|
|
804
|
+
readonly providerMetadata?: {
|
|
805
|
+
readonly [x: string]: {
|
|
806
|
+
readonly [x: string]: unknown;
|
|
807
|
+
};
|
|
808
|
+
} | undefined;
|
|
809
|
+
}, {
|
|
810
|
+
readonly type: Keys;
|
|
811
|
+
}> | Extract<{
|
|
812
|
+
readonly type: "text-end";
|
|
813
|
+
readonly id: string;
|
|
814
|
+
readonly providerMetadata?: {
|
|
815
|
+
readonly [x: string]: {
|
|
816
|
+
readonly [x: string]: unknown;
|
|
817
|
+
};
|
|
818
|
+
} | undefined;
|
|
819
|
+
}, {
|
|
820
|
+
readonly type: Keys;
|
|
821
|
+
}> | Extract<{
|
|
822
|
+
readonly type: "reasoning-start";
|
|
823
|
+
readonly id: string;
|
|
824
|
+
readonly providerMetadata?: {
|
|
825
|
+
readonly [x: string]: {
|
|
826
|
+
readonly [x: string]: unknown;
|
|
827
|
+
};
|
|
828
|
+
} | undefined;
|
|
829
|
+
}, {
|
|
830
|
+
readonly type: Keys;
|
|
831
|
+
}> | Extract<{
|
|
832
|
+
readonly type: "reasoning-delta";
|
|
833
|
+
readonly id: string;
|
|
834
|
+
readonly text: string;
|
|
835
|
+
readonly providerMetadata?: {
|
|
836
|
+
readonly [x: string]: {
|
|
837
|
+
readonly [x: string]: unknown;
|
|
838
|
+
};
|
|
839
|
+
} | undefined;
|
|
840
|
+
}, {
|
|
841
|
+
readonly type: Keys;
|
|
842
|
+
}> | Extract<{
|
|
843
|
+
readonly type: "reasoning-end";
|
|
844
|
+
readonly id: string;
|
|
845
|
+
readonly providerMetadata?: {
|
|
846
|
+
readonly [x: string]: {
|
|
847
|
+
readonly [x: string]: unknown;
|
|
848
|
+
};
|
|
849
|
+
} | undefined;
|
|
850
|
+
}, {
|
|
851
|
+
readonly type: Keys;
|
|
852
|
+
}> | Extract<{
|
|
853
|
+
readonly type: "tool-input-start";
|
|
854
|
+
readonly id: string;
|
|
855
|
+
readonly name: string;
|
|
856
|
+
readonly providerMetadata?: {
|
|
857
|
+
readonly [x: string]: {
|
|
858
|
+
readonly [x: string]: unknown;
|
|
859
|
+
};
|
|
860
|
+
} | undefined;
|
|
861
|
+
}, {
|
|
862
|
+
readonly type: Keys;
|
|
863
|
+
}> | Extract<{
|
|
864
|
+
readonly type: "tool-input-delta";
|
|
865
|
+
readonly id: string;
|
|
866
|
+
readonly name: string;
|
|
867
|
+
readonly text: string;
|
|
868
|
+
}, {
|
|
869
|
+
readonly type: Keys;
|
|
870
|
+
}> | Extract<{
|
|
871
|
+
readonly type: "tool-input-end";
|
|
872
|
+
readonly id: string;
|
|
873
|
+
readonly name: string;
|
|
874
|
+
readonly providerMetadata?: {
|
|
875
|
+
readonly [x: string]: {
|
|
876
|
+
readonly [x: string]: unknown;
|
|
877
|
+
};
|
|
878
|
+
} | undefined;
|
|
879
|
+
}, {
|
|
880
|
+
readonly type: Keys;
|
|
881
|
+
}> | Extract<{
|
|
882
|
+
readonly type: "tool-call";
|
|
883
|
+
readonly id: string;
|
|
884
|
+
readonly name: string;
|
|
885
|
+
readonly input: unknown;
|
|
886
|
+
readonly providerExecuted?: boolean | undefined;
|
|
887
|
+
readonly providerMetadata?: {
|
|
888
|
+
readonly [x: string]: {
|
|
889
|
+
readonly [x: string]: unknown;
|
|
890
|
+
};
|
|
891
|
+
} | undefined;
|
|
892
|
+
}, {
|
|
893
|
+
readonly type: Keys;
|
|
894
|
+
}> | Extract<{
|
|
895
|
+
readonly type: "tool-result";
|
|
896
|
+
readonly id: string;
|
|
897
|
+
readonly name: string;
|
|
898
|
+
readonly result: {
|
|
899
|
+
readonly type: "json";
|
|
900
|
+
readonly value: unknown;
|
|
901
|
+
} | {
|
|
902
|
+
readonly type: "text";
|
|
903
|
+
readonly value: unknown;
|
|
904
|
+
} | {
|
|
905
|
+
readonly type: "error";
|
|
906
|
+
readonly value: unknown;
|
|
907
|
+
} | {
|
|
908
|
+
readonly type: "content";
|
|
909
|
+
readonly value: readonly ({
|
|
910
|
+
readonly type: "text";
|
|
911
|
+
readonly text: string;
|
|
912
|
+
} | {
|
|
913
|
+
readonly type: "file";
|
|
914
|
+
readonly uri: string;
|
|
915
|
+
readonly mime: string;
|
|
916
|
+
readonly name?: string | undefined;
|
|
917
|
+
})[];
|
|
918
|
+
};
|
|
919
|
+
readonly output?: {
|
|
920
|
+
readonly structured: unknown;
|
|
921
|
+
readonly content: readonly ({
|
|
922
|
+
readonly type: "text";
|
|
923
|
+
readonly text: string;
|
|
924
|
+
} | {
|
|
925
|
+
readonly type: "file";
|
|
926
|
+
readonly uri: string;
|
|
927
|
+
readonly mime: string;
|
|
928
|
+
readonly name?: string | undefined;
|
|
929
|
+
})[];
|
|
930
|
+
} | undefined;
|
|
931
|
+
readonly providerExecuted?: boolean | undefined;
|
|
932
|
+
readonly providerMetadata?: {
|
|
933
|
+
readonly [x: string]: {
|
|
934
|
+
readonly [x: string]: unknown;
|
|
935
|
+
};
|
|
936
|
+
} | undefined;
|
|
937
|
+
}, {
|
|
938
|
+
readonly type: Keys;
|
|
939
|
+
}> | Extract<{
|
|
940
|
+
readonly type: "tool-error";
|
|
941
|
+
readonly id: string;
|
|
942
|
+
readonly name: string;
|
|
943
|
+
readonly message: string;
|
|
944
|
+
readonly error?: unknown;
|
|
945
|
+
readonly providerMetadata?: {
|
|
946
|
+
readonly [x: string]: {
|
|
947
|
+
readonly [x: string]: unknown;
|
|
948
|
+
};
|
|
949
|
+
} | undefined;
|
|
950
|
+
}, {
|
|
951
|
+
readonly type: Keys;
|
|
952
|
+
}> | Extract<{
|
|
953
|
+
readonly type: "step-finish";
|
|
954
|
+
readonly index: number;
|
|
955
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
956
|
+
readonly usage?: Usage | undefined;
|
|
957
|
+
readonly providerMetadata?: {
|
|
958
|
+
readonly [x: string]: {
|
|
959
|
+
readonly [x: string]: unknown;
|
|
960
|
+
};
|
|
961
|
+
} | undefined;
|
|
962
|
+
}, {
|
|
963
|
+
readonly type: Keys;
|
|
964
|
+
}> | Extract<{
|
|
965
|
+
readonly type: "finish";
|
|
966
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
967
|
+
readonly usage?: Usage | undefined;
|
|
968
|
+
readonly providerMetadata?: {
|
|
969
|
+
readonly [x: string]: {
|
|
970
|
+
readonly [x: string]: unknown;
|
|
971
|
+
};
|
|
972
|
+
} | undefined;
|
|
973
|
+
}, {
|
|
974
|
+
readonly type: Keys;
|
|
975
|
+
}> | Extract<{
|
|
976
|
+
readonly type: "provider-error";
|
|
977
|
+
readonly message: string;
|
|
978
|
+
readonly classification?: "context-overflow" | undefined;
|
|
979
|
+
readonly providerMetadata?: {
|
|
980
|
+
readonly [x: string]: {
|
|
981
|
+
readonly [x: string]: unknown;
|
|
982
|
+
};
|
|
983
|
+
} | undefined;
|
|
984
|
+
}, {
|
|
985
|
+
readonly type: Keys;
|
|
986
|
+
}>;
|
|
987
|
+
readonly guards: {
|
|
988
|
+
"step-start": (u: unknown) => u is {
|
|
989
|
+
readonly type: "step-start";
|
|
990
|
+
readonly index: number;
|
|
991
|
+
};
|
|
992
|
+
"text-start": (u: unknown) => u is {
|
|
993
|
+
readonly type: "text-start";
|
|
994
|
+
readonly id: string;
|
|
995
|
+
readonly providerMetadata?: {
|
|
996
|
+
readonly [x: string]: {
|
|
997
|
+
readonly [x: string]: unknown;
|
|
998
|
+
};
|
|
999
|
+
} | undefined;
|
|
1000
|
+
};
|
|
1001
|
+
"text-delta": (u: unknown) => u is {
|
|
1002
|
+
readonly type: "text-delta";
|
|
1003
|
+
readonly id: string;
|
|
1004
|
+
readonly text: string;
|
|
1005
|
+
readonly providerMetadata?: {
|
|
1006
|
+
readonly [x: string]: {
|
|
1007
|
+
readonly [x: string]: unknown;
|
|
1008
|
+
};
|
|
1009
|
+
} | undefined;
|
|
1010
|
+
};
|
|
1011
|
+
"text-end": (u: unknown) => u is {
|
|
1012
|
+
readonly type: "text-end";
|
|
1013
|
+
readonly id: string;
|
|
1014
|
+
readonly providerMetadata?: {
|
|
1015
|
+
readonly [x: string]: {
|
|
1016
|
+
readonly [x: string]: unknown;
|
|
1017
|
+
};
|
|
1018
|
+
} | undefined;
|
|
1019
|
+
};
|
|
1020
|
+
"reasoning-start": (u: unknown) => u is {
|
|
1021
|
+
readonly type: "reasoning-start";
|
|
1022
|
+
readonly id: string;
|
|
1023
|
+
readonly providerMetadata?: {
|
|
1024
|
+
readonly [x: string]: {
|
|
1025
|
+
readonly [x: string]: unknown;
|
|
1026
|
+
};
|
|
1027
|
+
} | undefined;
|
|
1028
|
+
};
|
|
1029
|
+
"reasoning-delta": (u: unknown) => u is {
|
|
1030
|
+
readonly type: "reasoning-delta";
|
|
1031
|
+
readonly id: string;
|
|
1032
|
+
readonly text: string;
|
|
1033
|
+
readonly providerMetadata?: {
|
|
1034
|
+
readonly [x: string]: {
|
|
1035
|
+
readonly [x: string]: unknown;
|
|
1036
|
+
};
|
|
1037
|
+
} | undefined;
|
|
1038
|
+
};
|
|
1039
|
+
"reasoning-end": (u: unknown) => u is {
|
|
1040
|
+
readonly type: "reasoning-end";
|
|
1041
|
+
readonly id: string;
|
|
1042
|
+
readonly providerMetadata?: {
|
|
1043
|
+
readonly [x: string]: {
|
|
1044
|
+
readonly [x: string]: unknown;
|
|
1045
|
+
};
|
|
1046
|
+
} | undefined;
|
|
1047
|
+
};
|
|
1048
|
+
"tool-input-start": (u: unknown) => u is {
|
|
1049
|
+
readonly type: "tool-input-start";
|
|
1050
|
+
readonly id: string;
|
|
1051
|
+
readonly name: string;
|
|
1052
|
+
readonly providerMetadata?: {
|
|
1053
|
+
readonly [x: string]: {
|
|
1054
|
+
readonly [x: string]: unknown;
|
|
1055
|
+
};
|
|
1056
|
+
} | undefined;
|
|
1057
|
+
};
|
|
1058
|
+
"tool-input-delta": (u: unknown) => u is {
|
|
1059
|
+
readonly type: "tool-input-delta";
|
|
1060
|
+
readonly id: string;
|
|
1061
|
+
readonly name: string;
|
|
1062
|
+
readonly text: string;
|
|
1063
|
+
};
|
|
1064
|
+
"tool-input-end": (u: unknown) => u is {
|
|
1065
|
+
readonly type: "tool-input-end";
|
|
1066
|
+
readonly id: string;
|
|
1067
|
+
readonly name: string;
|
|
1068
|
+
readonly providerMetadata?: {
|
|
1069
|
+
readonly [x: string]: {
|
|
1070
|
+
readonly [x: string]: unknown;
|
|
1071
|
+
};
|
|
1072
|
+
} | undefined;
|
|
1073
|
+
};
|
|
1074
|
+
"tool-call": (u: unknown) => u is {
|
|
1075
|
+
readonly type: "tool-call";
|
|
1076
|
+
readonly id: string;
|
|
1077
|
+
readonly name: string;
|
|
1078
|
+
readonly input: unknown;
|
|
1079
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1080
|
+
readonly providerMetadata?: {
|
|
1081
|
+
readonly [x: string]: {
|
|
1082
|
+
readonly [x: string]: unknown;
|
|
1083
|
+
};
|
|
1084
|
+
} | undefined;
|
|
1085
|
+
};
|
|
1086
|
+
"tool-result": (u: unknown) => u is {
|
|
1087
|
+
readonly type: "tool-result";
|
|
1088
|
+
readonly id: string;
|
|
1089
|
+
readonly name: string;
|
|
1090
|
+
readonly result: {
|
|
1091
|
+
readonly type: "json";
|
|
1092
|
+
readonly value: unknown;
|
|
1093
|
+
} | {
|
|
1094
|
+
readonly type: "text";
|
|
1095
|
+
readonly value: unknown;
|
|
1096
|
+
} | {
|
|
1097
|
+
readonly type: "error";
|
|
1098
|
+
readonly value: unknown;
|
|
1099
|
+
} | {
|
|
1100
|
+
readonly type: "content";
|
|
1101
|
+
readonly value: readonly ({
|
|
1102
|
+
readonly type: "text";
|
|
1103
|
+
readonly text: string;
|
|
1104
|
+
} | {
|
|
1105
|
+
readonly type: "file";
|
|
1106
|
+
readonly uri: string;
|
|
1107
|
+
readonly mime: string;
|
|
1108
|
+
readonly name?: string | undefined;
|
|
1109
|
+
})[];
|
|
1110
|
+
};
|
|
1111
|
+
readonly output?: {
|
|
1112
|
+
readonly structured: unknown;
|
|
1113
|
+
readonly content: readonly ({
|
|
1114
|
+
readonly type: "text";
|
|
1115
|
+
readonly text: string;
|
|
1116
|
+
} | {
|
|
1117
|
+
readonly type: "file";
|
|
1118
|
+
readonly uri: string;
|
|
1119
|
+
readonly mime: string;
|
|
1120
|
+
readonly name?: string | undefined;
|
|
1121
|
+
})[];
|
|
1122
|
+
} | undefined;
|
|
1123
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1124
|
+
readonly providerMetadata?: {
|
|
1125
|
+
readonly [x: string]: {
|
|
1126
|
+
readonly [x: string]: unknown;
|
|
1127
|
+
};
|
|
1128
|
+
} | undefined;
|
|
1129
|
+
};
|
|
1130
|
+
"tool-error": (u: unknown) => u is {
|
|
1131
|
+
readonly type: "tool-error";
|
|
1132
|
+
readonly id: string;
|
|
1133
|
+
readonly name: string;
|
|
1134
|
+
readonly message: string;
|
|
1135
|
+
readonly error?: unknown;
|
|
1136
|
+
readonly providerMetadata?: {
|
|
1137
|
+
readonly [x: string]: {
|
|
1138
|
+
readonly [x: string]: unknown;
|
|
1139
|
+
};
|
|
1140
|
+
} | undefined;
|
|
1141
|
+
};
|
|
1142
|
+
"step-finish": (u: unknown) => u is {
|
|
1143
|
+
readonly type: "step-finish";
|
|
1144
|
+
readonly index: number;
|
|
1145
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1146
|
+
readonly usage?: Usage | undefined;
|
|
1147
|
+
readonly providerMetadata?: {
|
|
1148
|
+
readonly [x: string]: {
|
|
1149
|
+
readonly [x: string]: unknown;
|
|
1150
|
+
};
|
|
1151
|
+
} | undefined;
|
|
1152
|
+
};
|
|
1153
|
+
finish: (u: unknown) => u is {
|
|
1154
|
+
readonly type: "finish";
|
|
1155
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1156
|
+
readonly usage?: Usage | undefined;
|
|
1157
|
+
readonly providerMetadata?: {
|
|
1158
|
+
readonly [x: string]: {
|
|
1159
|
+
readonly [x: string]: unknown;
|
|
1160
|
+
};
|
|
1161
|
+
} | undefined;
|
|
1162
|
+
};
|
|
1163
|
+
"provider-error": (u: unknown) => u is {
|
|
1164
|
+
readonly type: "provider-error";
|
|
1165
|
+
readonly message: string;
|
|
1166
|
+
readonly classification?: "context-overflow" | undefined;
|
|
1167
|
+
readonly providerMetadata?: {
|
|
1168
|
+
readonly [x: string]: {
|
|
1169
|
+
readonly [x: string]: unknown;
|
|
1170
|
+
};
|
|
1171
|
+
} | undefined;
|
|
1172
|
+
};
|
|
1173
|
+
};
|
|
1174
|
+
readonly match: {
|
|
1175
|
+
<Cases extends {
|
|
1176
|
+
"step-start": (value: {
|
|
1177
|
+
readonly type: "step-start";
|
|
1178
|
+
readonly index: number;
|
|
1179
|
+
}) => any;
|
|
1180
|
+
"text-start": (value: {
|
|
1181
|
+
readonly type: "text-start";
|
|
1182
|
+
readonly id: string;
|
|
1183
|
+
readonly providerMetadata?: {
|
|
1184
|
+
readonly [x: string]: {
|
|
1185
|
+
readonly [x: string]: unknown;
|
|
1186
|
+
};
|
|
1187
|
+
} | undefined;
|
|
1188
|
+
}) => any;
|
|
1189
|
+
"text-delta": (value: {
|
|
1190
|
+
readonly type: "text-delta";
|
|
1191
|
+
readonly id: string;
|
|
1192
|
+
readonly text: string;
|
|
1193
|
+
readonly providerMetadata?: {
|
|
1194
|
+
readonly [x: string]: {
|
|
1195
|
+
readonly [x: string]: unknown;
|
|
1196
|
+
};
|
|
1197
|
+
} | undefined;
|
|
1198
|
+
}) => any;
|
|
1199
|
+
"text-end": (value: {
|
|
1200
|
+
readonly type: "text-end";
|
|
1201
|
+
readonly id: string;
|
|
1202
|
+
readonly providerMetadata?: {
|
|
1203
|
+
readonly [x: string]: {
|
|
1204
|
+
readonly [x: string]: unknown;
|
|
1205
|
+
};
|
|
1206
|
+
} | undefined;
|
|
1207
|
+
}) => any;
|
|
1208
|
+
"reasoning-start": (value: {
|
|
1209
|
+
readonly type: "reasoning-start";
|
|
1210
|
+
readonly id: string;
|
|
1211
|
+
readonly providerMetadata?: {
|
|
1212
|
+
readonly [x: string]: {
|
|
1213
|
+
readonly [x: string]: unknown;
|
|
1214
|
+
};
|
|
1215
|
+
} | undefined;
|
|
1216
|
+
}) => any;
|
|
1217
|
+
"reasoning-delta": (value: {
|
|
1218
|
+
readonly type: "reasoning-delta";
|
|
1219
|
+
readonly id: string;
|
|
1220
|
+
readonly text: string;
|
|
1221
|
+
readonly providerMetadata?: {
|
|
1222
|
+
readonly [x: string]: {
|
|
1223
|
+
readonly [x: string]: unknown;
|
|
1224
|
+
};
|
|
1225
|
+
} | undefined;
|
|
1226
|
+
}) => any;
|
|
1227
|
+
"reasoning-end": (value: {
|
|
1228
|
+
readonly type: "reasoning-end";
|
|
1229
|
+
readonly id: string;
|
|
1230
|
+
readonly providerMetadata?: {
|
|
1231
|
+
readonly [x: string]: {
|
|
1232
|
+
readonly [x: string]: unknown;
|
|
1233
|
+
};
|
|
1234
|
+
} | undefined;
|
|
1235
|
+
}) => any;
|
|
1236
|
+
"tool-input-start": (value: {
|
|
1237
|
+
readonly type: "tool-input-start";
|
|
1238
|
+
readonly id: string;
|
|
1239
|
+
readonly name: string;
|
|
1240
|
+
readonly providerMetadata?: {
|
|
1241
|
+
readonly [x: string]: {
|
|
1242
|
+
readonly [x: string]: unknown;
|
|
1243
|
+
};
|
|
1244
|
+
} | undefined;
|
|
1245
|
+
}) => any;
|
|
1246
|
+
"tool-input-delta": (value: {
|
|
1247
|
+
readonly type: "tool-input-delta";
|
|
1248
|
+
readonly id: string;
|
|
1249
|
+
readonly name: string;
|
|
1250
|
+
readonly text: string;
|
|
1251
|
+
}) => any;
|
|
1252
|
+
"tool-input-end": (value: {
|
|
1253
|
+
readonly type: "tool-input-end";
|
|
1254
|
+
readonly id: string;
|
|
1255
|
+
readonly name: string;
|
|
1256
|
+
readonly providerMetadata?: {
|
|
1257
|
+
readonly [x: string]: {
|
|
1258
|
+
readonly [x: string]: unknown;
|
|
1259
|
+
};
|
|
1260
|
+
} | undefined;
|
|
1261
|
+
}) => any;
|
|
1262
|
+
"tool-call": (value: {
|
|
1263
|
+
readonly type: "tool-call";
|
|
1264
|
+
readonly id: string;
|
|
1265
|
+
readonly name: string;
|
|
1266
|
+
readonly input: unknown;
|
|
1267
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1268
|
+
readonly providerMetadata?: {
|
|
1269
|
+
readonly [x: string]: {
|
|
1270
|
+
readonly [x: string]: unknown;
|
|
1271
|
+
};
|
|
1272
|
+
} | undefined;
|
|
1273
|
+
}) => any;
|
|
1274
|
+
"tool-result": (value: {
|
|
1275
|
+
readonly type: "tool-result";
|
|
1276
|
+
readonly id: string;
|
|
1277
|
+
readonly name: string;
|
|
1278
|
+
readonly result: {
|
|
1279
|
+
readonly type: "json";
|
|
1280
|
+
readonly value: unknown;
|
|
1281
|
+
} | {
|
|
1282
|
+
readonly type: "text";
|
|
1283
|
+
readonly value: unknown;
|
|
1284
|
+
} | {
|
|
1285
|
+
readonly type: "error";
|
|
1286
|
+
readonly value: unknown;
|
|
1287
|
+
} | {
|
|
1288
|
+
readonly type: "content";
|
|
1289
|
+
readonly value: readonly ({
|
|
1290
|
+
readonly type: "text";
|
|
1291
|
+
readonly text: string;
|
|
1292
|
+
} | {
|
|
1293
|
+
readonly type: "file";
|
|
1294
|
+
readonly uri: string;
|
|
1295
|
+
readonly mime: string;
|
|
1296
|
+
readonly name?: string | undefined;
|
|
1297
|
+
})[];
|
|
1298
|
+
};
|
|
1299
|
+
readonly output?: {
|
|
1300
|
+
readonly structured: unknown;
|
|
1301
|
+
readonly content: readonly ({
|
|
1302
|
+
readonly type: "text";
|
|
1303
|
+
readonly text: string;
|
|
1304
|
+
} | {
|
|
1305
|
+
readonly type: "file";
|
|
1306
|
+
readonly uri: string;
|
|
1307
|
+
readonly mime: string;
|
|
1308
|
+
readonly name?: string | undefined;
|
|
1309
|
+
})[];
|
|
1310
|
+
} | undefined;
|
|
1311
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1312
|
+
readonly providerMetadata?: {
|
|
1313
|
+
readonly [x: string]: {
|
|
1314
|
+
readonly [x: string]: unknown;
|
|
1315
|
+
};
|
|
1316
|
+
} | undefined;
|
|
1317
|
+
}) => any;
|
|
1318
|
+
"tool-error": (value: {
|
|
1319
|
+
readonly type: "tool-error";
|
|
1320
|
+
readonly id: string;
|
|
1321
|
+
readonly name: string;
|
|
1322
|
+
readonly message: string;
|
|
1323
|
+
readonly error?: unknown;
|
|
1324
|
+
readonly providerMetadata?: {
|
|
1325
|
+
readonly [x: string]: {
|
|
1326
|
+
readonly [x: string]: unknown;
|
|
1327
|
+
};
|
|
1328
|
+
} | undefined;
|
|
1329
|
+
}) => any;
|
|
1330
|
+
"step-finish": (value: {
|
|
1331
|
+
readonly type: "step-finish";
|
|
1332
|
+
readonly index: number;
|
|
1333
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1334
|
+
readonly usage?: Usage | undefined;
|
|
1335
|
+
readonly providerMetadata?: {
|
|
1336
|
+
readonly [x: string]: {
|
|
1337
|
+
readonly [x: string]: unknown;
|
|
1338
|
+
};
|
|
1339
|
+
} | undefined;
|
|
1340
|
+
}) => any;
|
|
1341
|
+
finish: (value: {
|
|
1342
|
+
readonly type: "finish";
|
|
1343
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1344
|
+
readonly usage?: Usage | undefined;
|
|
1345
|
+
readonly providerMetadata?: {
|
|
1346
|
+
readonly [x: string]: {
|
|
1347
|
+
readonly [x: string]: unknown;
|
|
1348
|
+
};
|
|
1349
|
+
} | undefined;
|
|
1350
|
+
}) => any;
|
|
1351
|
+
"provider-error": (value: {
|
|
1352
|
+
readonly type: "provider-error";
|
|
1353
|
+
readonly message: string;
|
|
1354
|
+
readonly classification?: "context-overflow" | undefined;
|
|
1355
|
+
readonly providerMetadata?: {
|
|
1356
|
+
readonly [x: string]: {
|
|
1357
|
+
readonly [x: string]: unknown;
|
|
1358
|
+
};
|
|
1359
|
+
} | undefined;
|
|
1360
|
+
}) => any;
|
|
1361
|
+
}>(value: {
|
|
1362
|
+
readonly type: "step-start";
|
|
1363
|
+
readonly index: number;
|
|
1364
|
+
} | {
|
|
1365
|
+
readonly type: "text-start";
|
|
1366
|
+
readonly id: string;
|
|
1367
|
+
readonly providerMetadata?: {
|
|
1368
|
+
readonly [x: string]: {
|
|
1369
|
+
readonly [x: string]: unknown;
|
|
1370
|
+
};
|
|
1371
|
+
} | undefined;
|
|
1372
|
+
} | {
|
|
1373
|
+
readonly type: "text-delta";
|
|
1374
|
+
readonly id: string;
|
|
1375
|
+
readonly text: string;
|
|
1376
|
+
readonly providerMetadata?: {
|
|
1377
|
+
readonly [x: string]: {
|
|
1378
|
+
readonly [x: string]: unknown;
|
|
1379
|
+
};
|
|
1380
|
+
} | undefined;
|
|
1381
|
+
} | {
|
|
1382
|
+
readonly type: "text-end";
|
|
1383
|
+
readonly id: string;
|
|
1384
|
+
readonly providerMetadata?: {
|
|
1385
|
+
readonly [x: string]: {
|
|
1386
|
+
readonly [x: string]: unknown;
|
|
1387
|
+
};
|
|
1388
|
+
} | undefined;
|
|
1389
|
+
} | {
|
|
1390
|
+
readonly type: "reasoning-start";
|
|
1391
|
+
readonly id: string;
|
|
1392
|
+
readonly providerMetadata?: {
|
|
1393
|
+
readonly [x: string]: {
|
|
1394
|
+
readonly [x: string]: unknown;
|
|
1395
|
+
};
|
|
1396
|
+
} | undefined;
|
|
1397
|
+
} | {
|
|
1398
|
+
readonly type: "reasoning-delta";
|
|
1399
|
+
readonly id: string;
|
|
1400
|
+
readonly text: string;
|
|
1401
|
+
readonly providerMetadata?: {
|
|
1402
|
+
readonly [x: string]: {
|
|
1403
|
+
readonly [x: string]: unknown;
|
|
1404
|
+
};
|
|
1405
|
+
} | undefined;
|
|
1406
|
+
} | {
|
|
1407
|
+
readonly type: "reasoning-end";
|
|
1408
|
+
readonly id: string;
|
|
1409
|
+
readonly providerMetadata?: {
|
|
1410
|
+
readonly [x: string]: {
|
|
1411
|
+
readonly [x: string]: unknown;
|
|
1412
|
+
};
|
|
1413
|
+
} | undefined;
|
|
1414
|
+
} | {
|
|
1415
|
+
readonly type: "tool-input-start";
|
|
1416
|
+
readonly id: string;
|
|
1417
|
+
readonly name: string;
|
|
1418
|
+
readonly providerMetadata?: {
|
|
1419
|
+
readonly [x: string]: {
|
|
1420
|
+
readonly [x: string]: unknown;
|
|
1421
|
+
};
|
|
1422
|
+
} | undefined;
|
|
1423
|
+
} | {
|
|
1424
|
+
readonly type: "tool-input-delta";
|
|
1425
|
+
readonly id: string;
|
|
1426
|
+
readonly name: string;
|
|
1427
|
+
readonly text: string;
|
|
1428
|
+
} | {
|
|
1429
|
+
readonly type: "tool-input-end";
|
|
1430
|
+
readonly id: string;
|
|
1431
|
+
readonly name: string;
|
|
1432
|
+
readonly providerMetadata?: {
|
|
1433
|
+
readonly [x: string]: {
|
|
1434
|
+
readonly [x: string]: unknown;
|
|
1435
|
+
};
|
|
1436
|
+
} | undefined;
|
|
1437
|
+
} | {
|
|
1438
|
+
readonly type: "tool-call";
|
|
1439
|
+
readonly id: string;
|
|
1440
|
+
readonly name: string;
|
|
1441
|
+
readonly input: unknown;
|
|
1442
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1443
|
+
readonly providerMetadata?: {
|
|
1444
|
+
readonly [x: string]: {
|
|
1445
|
+
readonly [x: string]: unknown;
|
|
1446
|
+
};
|
|
1447
|
+
} | undefined;
|
|
1448
|
+
} | {
|
|
1449
|
+
readonly type: "tool-result";
|
|
1450
|
+
readonly id: string;
|
|
1451
|
+
readonly name: string;
|
|
1452
|
+
readonly result: {
|
|
1453
|
+
readonly type: "json";
|
|
1454
|
+
readonly value: unknown;
|
|
1455
|
+
} | {
|
|
1456
|
+
readonly type: "text";
|
|
1457
|
+
readonly value: unknown;
|
|
1458
|
+
} | {
|
|
1459
|
+
readonly type: "error";
|
|
1460
|
+
readonly value: unknown;
|
|
1461
|
+
} | {
|
|
1462
|
+
readonly type: "content";
|
|
1463
|
+
readonly value: readonly ({
|
|
1464
|
+
readonly type: "text";
|
|
1465
|
+
readonly text: string;
|
|
1466
|
+
} | {
|
|
1467
|
+
readonly type: "file";
|
|
1468
|
+
readonly uri: string;
|
|
1469
|
+
readonly mime: string;
|
|
1470
|
+
readonly name?: string | undefined;
|
|
1471
|
+
})[];
|
|
1472
|
+
};
|
|
1473
|
+
readonly output?: {
|
|
1474
|
+
readonly structured: unknown;
|
|
1475
|
+
readonly content: readonly ({
|
|
1476
|
+
readonly type: "text";
|
|
1477
|
+
readonly text: string;
|
|
1478
|
+
} | {
|
|
1479
|
+
readonly type: "file";
|
|
1480
|
+
readonly uri: string;
|
|
1481
|
+
readonly mime: string;
|
|
1482
|
+
readonly name?: string | undefined;
|
|
1483
|
+
})[];
|
|
1484
|
+
} | undefined;
|
|
1485
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1486
|
+
readonly providerMetadata?: {
|
|
1487
|
+
readonly [x: string]: {
|
|
1488
|
+
readonly [x: string]: unknown;
|
|
1489
|
+
};
|
|
1490
|
+
} | undefined;
|
|
1491
|
+
} | {
|
|
1492
|
+
readonly type: "tool-error";
|
|
1493
|
+
readonly id: string;
|
|
1494
|
+
readonly name: string;
|
|
1495
|
+
readonly message: string;
|
|
1496
|
+
readonly error?: unknown;
|
|
1497
|
+
readonly providerMetadata?: {
|
|
1498
|
+
readonly [x: string]: {
|
|
1499
|
+
readonly [x: string]: unknown;
|
|
1500
|
+
};
|
|
1501
|
+
} | undefined;
|
|
1502
|
+
} | {
|
|
1503
|
+
readonly type: "step-finish";
|
|
1504
|
+
readonly index: number;
|
|
1505
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1506
|
+
readonly usage?: Usage | undefined;
|
|
1507
|
+
readonly providerMetadata?: {
|
|
1508
|
+
readonly [x: string]: {
|
|
1509
|
+
readonly [x: string]: unknown;
|
|
1510
|
+
};
|
|
1511
|
+
} | undefined;
|
|
1512
|
+
} | {
|
|
1513
|
+
readonly type: "finish";
|
|
1514
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1515
|
+
readonly usage?: Usage | undefined;
|
|
1516
|
+
readonly providerMetadata?: {
|
|
1517
|
+
readonly [x: string]: {
|
|
1518
|
+
readonly [x: string]: unknown;
|
|
1519
|
+
};
|
|
1520
|
+
} | undefined;
|
|
1521
|
+
} | {
|
|
1522
|
+
readonly type: "provider-error";
|
|
1523
|
+
readonly message: string;
|
|
1524
|
+
readonly classification?: "context-overflow" | undefined;
|
|
1525
|
+
readonly providerMetadata?: {
|
|
1526
|
+
readonly [x: string]: {
|
|
1527
|
+
readonly [x: string]: unknown;
|
|
1528
|
+
};
|
|
1529
|
+
} | undefined;
|
|
1530
|
+
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
1531
|
+
<Cases extends {
|
|
1532
|
+
"step-start": (value: {
|
|
1533
|
+
readonly type: "step-start";
|
|
1534
|
+
readonly index: number;
|
|
1535
|
+
}) => any;
|
|
1536
|
+
"text-start": (value: {
|
|
1537
|
+
readonly type: "text-start";
|
|
1538
|
+
readonly id: string;
|
|
1539
|
+
readonly providerMetadata?: {
|
|
1540
|
+
readonly [x: string]: {
|
|
1541
|
+
readonly [x: string]: unknown;
|
|
1542
|
+
};
|
|
1543
|
+
} | undefined;
|
|
1544
|
+
}) => any;
|
|
1545
|
+
"text-delta": (value: {
|
|
1546
|
+
readonly type: "text-delta";
|
|
1547
|
+
readonly id: string;
|
|
1548
|
+
readonly text: string;
|
|
1549
|
+
readonly providerMetadata?: {
|
|
1550
|
+
readonly [x: string]: {
|
|
1551
|
+
readonly [x: string]: unknown;
|
|
1552
|
+
};
|
|
1553
|
+
} | undefined;
|
|
1554
|
+
}) => any;
|
|
1555
|
+
"text-end": (value: {
|
|
1556
|
+
readonly type: "text-end";
|
|
1557
|
+
readonly id: string;
|
|
1558
|
+
readonly providerMetadata?: {
|
|
1559
|
+
readonly [x: string]: {
|
|
1560
|
+
readonly [x: string]: unknown;
|
|
1561
|
+
};
|
|
1562
|
+
} | undefined;
|
|
1563
|
+
}) => any;
|
|
1564
|
+
"reasoning-start": (value: {
|
|
1565
|
+
readonly type: "reasoning-start";
|
|
1566
|
+
readonly id: string;
|
|
1567
|
+
readonly providerMetadata?: {
|
|
1568
|
+
readonly [x: string]: {
|
|
1569
|
+
readonly [x: string]: unknown;
|
|
1570
|
+
};
|
|
1571
|
+
} | undefined;
|
|
1572
|
+
}) => any;
|
|
1573
|
+
"reasoning-delta": (value: {
|
|
1574
|
+
readonly type: "reasoning-delta";
|
|
1575
|
+
readonly id: string;
|
|
1576
|
+
readonly text: string;
|
|
1577
|
+
readonly providerMetadata?: {
|
|
1578
|
+
readonly [x: string]: {
|
|
1579
|
+
readonly [x: string]: unknown;
|
|
1580
|
+
};
|
|
1581
|
+
} | undefined;
|
|
1582
|
+
}) => any;
|
|
1583
|
+
"reasoning-end": (value: {
|
|
1584
|
+
readonly type: "reasoning-end";
|
|
1585
|
+
readonly id: string;
|
|
1586
|
+
readonly providerMetadata?: {
|
|
1587
|
+
readonly [x: string]: {
|
|
1588
|
+
readonly [x: string]: unknown;
|
|
1589
|
+
};
|
|
1590
|
+
} | undefined;
|
|
1591
|
+
}) => any;
|
|
1592
|
+
"tool-input-start": (value: {
|
|
1593
|
+
readonly type: "tool-input-start";
|
|
1594
|
+
readonly id: string;
|
|
1595
|
+
readonly name: string;
|
|
1596
|
+
readonly providerMetadata?: {
|
|
1597
|
+
readonly [x: string]: {
|
|
1598
|
+
readonly [x: string]: unknown;
|
|
1599
|
+
};
|
|
1600
|
+
} | undefined;
|
|
1601
|
+
}) => any;
|
|
1602
|
+
"tool-input-delta": (value: {
|
|
1603
|
+
readonly type: "tool-input-delta";
|
|
1604
|
+
readonly id: string;
|
|
1605
|
+
readonly name: string;
|
|
1606
|
+
readonly text: string;
|
|
1607
|
+
}) => any;
|
|
1608
|
+
"tool-input-end": (value: {
|
|
1609
|
+
readonly type: "tool-input-end";
|
|
1610
|
+
readonly id: string;
|
|
1611
|
+
readonly name: string;
|
|
1612
|
+
readonly providerMetadata?: {
|
|
1613
|
+
readonly [x: string]: {
|
|
1614
|
+
readonly [x: string]: unknown;
|
|
1615
|
+
};
|
|
1616
|
+
} | undefined;
|
|
1617
|
+
}) => any;
|
|
1618
|
+
"tool-call": (value: {
|
|
1619
|
+
readonly type: "tool-call";
|
|
1620
|
+
readonly id: string;
|
|
1621
|
+
readonly name: string;
|
|
1622
|
+
readonly input: unknown;
|
|
1623
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1624
|
+
readonly providerMetadata?: {
|
|
1625
|
+
readonly [x: string]: {
|
|
1626
|
+
readonly [x: string]: unknown;
|
|
1627
|
+
};
|
|
1628
|
+
} | undefined;
|
|
1629
|
+
}) => any;
|
|
1630
|
+
"tool-result": (value: {
|
|
1631
|
+
readonly type: "tool-result";
|
|
1632
|
+
readonly id: string;
|
|
1633
|
+
readonly name: string;
|
|
1634
|
+
readonly result: {
|
|
1635
|
+
readonly type: "json";
|
|
1636
|
+
readonly value: unknown;
|
|
1637
|
+
} | {
|
|
1638
|
+
readonly type: "text";
|
|
1639
|
+
readonly value: unknown;
|
|
1640
|
+
} | {
|
|
1641
|
+
readonly type: "error";
|
|
1642
|
+
readonly value: unknown;
|
|
1643
|
+
} | {
|
|
1644
|
+
readonly type: "content";
|
|
1645
|
+
readonly value: readonly ({
|
|
1646
|
+
readonly type: "text";
|
|
1647
|
+
readonly text: string;
|
|
1648
|
+
} | {
|
|
1649
|
+
readonly type: "file";
|
|
1650
|
+
readonly uri: string;
|
|
1651
|
+
readonly mime: string;
|
|
1652
|
+
readonly name?: string | undefined;
|
|
1653
|
+
})[];
|
|
1654
|
+
};
|
|
1655
|
+
readonly output?: {
|
|
1656
|
+
readonly structured: unknown;
|
|
1657
|
+
readonly content: readonly ({
|
|
1658
|
+
readonly type: "text";
|
|
1659
|
+
readonly text: string;
|
|
1660
|
+
} | {
|
|
1661
|
+
readonly type: "file";
|
|
1662
|
+
readonly uri: string;
|
|
1663
|
+
readonly mime: string;
|
|
1664
|
+
readonly name?: string | undefined;
|
|
1665
|
+
})[];
|
|
1666
|
+
} | undefined;
|
|
1667
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1668
|
+
readonly providerMetadata?: {
|
|
1669
|
+
readonly [x: string]: {
|
|
1670
|
+
readonly [x: string]: unknown;
|
|
1671
|
+
};
|
|
1672
|
+
} | undefined;
|
|
1673
|
+
}) => any;
|
|
1674
|
+
"tool-error": (value: {
|
|
1675
|
+
readonly type: "tool-error";
|
|
1676
|
+
readonly id: string;
|
|
1677
|
+
readonly name: string;
|
|
1678
|
+
readonly message: string;
|
|
1679
|
+
readonly error?: unknown;
|
|
1680
|
+
readonly providerMetadata?: {
|
|
1681
|
+
readonly [x: string]: {
|
|
1682
|
+
readonly [x: string]: unknown;
|
|
1683
|
+
};
|
|
1684
|
+
} | undefined;
|
|
1685
|
+
}) => any;
|
|
1686
|
+
"step-finish": (value: {
|
|
1687
|
+
readonly type: "step-finish";
|
|
1688
|
+
readonly index: number;
|
|
1689
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1690
|
+
readonly usage?: Usage | undefined;
|
|
1691
|
+
readonly providerMetadata?: {
|
|
1692
|
+
readonly [x: string]: {
|
|
1693
|
+
readonly [x: string]: unknown;
|
|
1694
|
+
};
|
|
1695
|
+
} | undefined;
|
|
1696
|
+
}) => any;
|
|
1697
|
+
finish: (value: {
|
|
1698
|
+
readonly type: "finish";
|
|
1699
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1700
|
+
readonly usage?: Usage | undefined;
|
|
1701
|
+
readonly providerMetadata?: {
|
|
1702
|
+
readonly [x: string]: {
|
|
1703
|
+
readonly [x: string]: unknown;
|
|
1704
|
+
};
|
|
1705
|
+
} | undefined;
|
|
1706
|
+
}) => any;
|
|
1707
|
+
"provider-error": (value: {
|
|
1708
|
+
readonly type: "provider-error";
|
|
1709
|
+
readonly message: string;
|
|
1710
|
+
readonly classification?: "context-overflow" | undefined;
|
|
1711
|
+
readonly providerMetadata?: {
|
|
1712
|
+
readonly [x: string]: {
|
|
1713
|
+
readonly [x: string]: unknown;
|
|
1714
|
+
};
|
|
1715
|
+
} | undefined;
|
|
1716
|
+
}) => any;
|
|
1717
|
+
}>(cases: Cases): (value: {
|
|
1718
|
+
readonly type: "step-start";
|
|
1719
|
+
readonly index: number;
|
|
1720
|
+
} | {
|
|
1721
|
+
readonly type: "text-start";
|
|
1722
|
+
readonly id: string;
|
|
1723
|
+
readonly providerMetadata?: {
|
|
1724
|
+
readonly [x: string]: {
|
|
1725
|
+
readonly [x: string]: unknown;
|
|
1726
|
+
};
|
|
1727
|
+
} | undefined;
|
|
1728
|
+
} | {
|
|
1729
|
+
readonly type: "text-delta";
|
|
1730
|
+
readonly id: string;
|
|
1731
|
+
readonly text: string;
|
|
1732
|
+
readonly providerMetadata?: {
|
|
1733
|
+
readonly [x: string]: {
|
|
1734
|
+
readonly [x: string]: unknown;
|
|
1735
|
+
};
|
|
1736
|
+
} | undefined;
|
|
1737
|
+
} | {
|
|
1738
|
+
readonly type: "text-end";
|
|
1739
|
+
readonly id: string;
|
|
1740
|
+
readonly providerMetadata?: {
|
|
1741
|
+
readonly [x: string]: {
|
|
1742
|
+
readonly [x: string]: unknown;
|
|
1743
|
+
};
|
|
1744
|
+
} | undefined;
|
|
1745
|
+
} | {
|
|
1746
|
+
readonly type: "reasoning-start";
|
|
1747
|
+
readonly id: string;
|
|
1748
|
+
readonly providerMetadata?: {
|
|
1749
|
+
readonly [x: string]: {
|
|
1750
|
+
readonly [x: string]: unknown;
|
|
1751
|
+
};
|
|
1752
|
+
} | undefined;
|
|
1753
|
+
} | {
|
|
1754
|
+
readonly type: "reasoning-delta";
|
|
1755
|
+
readonly id: string;
|
|
1756
|
+
readonly text: string;
|
|
1757
|
+
readonly providerMetadata?: {
|
|
1758
|
+
readonly [x: string]: {
|
|
1759
|
+
readonly [x: string]: unknown;
|
|
1760
|
+
};
|
|
1761
|
+
} | undefined;
|
|
1762
|
+
} | {
|
|
1763
|
+
readonly type: "reasoning-end";
|
|
1764
|
+
readonly id: string;
|
|
1765
|
+
readonly providerMetadata?: {
|
|
1766
|
+
readonly [x: string]: {
|
|
1767
|
+
readonly [x: string]: unknown;
|
|
1768
|
+
};
|
|
1769
|
+
} | undefined;
|
|
1770
|
+
} | {
|
|
1771
|
+
readonly type: "tool-input-start";
|
|
1772
|
+
readonly id: string;
|
|
1773
|
+
readonly name: string;
|
|
1774
|
+
readonly providerMetadata?: {
|
|
1775
|
+
readonly [x: string]: {
|
|
1776
|
+
readonly [x: string]: unknown;
|
|
1777
|
+
};
|
|
1778
|
+
} | undefined;
|
|
1779
|
+
} | {
|
|
1780
|
+
readonly type: "tool-input-delta";
|
|
1781
|
+
readonly id: string;
|
|
1782
|
+
readonly name: string;
|
|
1783
|
+
readonly text: string;
|
|
1784
|
+
} | {
|
|
1785
|
+
readonly type: "tool-input-end";
|
|
1786
|
+
readonly id: string;
|
|
1787
|
+
readonly name: string;
|
|
1788
|
+
readonly providerMetadata?: {
|
|
1789
|
+
readonly [x: string]: {
|
|
1790
|
+
readonly [x: string]: unknown;
|
|
1791
|
+
};
|
|
1792
|
+
} | undefined;
|
|
1793
|
+
} | {
|
|
1794
|
+
readonly type: "tool-call";
|
|
1795
|
+
readonly id: string;
|
|
1796
|
+
readonly name: string;
|
|
1797
|
+
readonly input: unknown;
|
|
1798
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1799
|
+
readonly providerMetadata?: {
|
|
1800
|
+
readonly [x: string]: {
|
|
1801
|
+
readonly [x: string]: unknown;
|
|
1802
|
+
};
|
|
1803
|
+
} | undefined;
|
|
1804
|
+
} | {
|
|
1805
|
+
readonly type: "tool-result";
|
|
1806
|
+
readonly id: string;
|
|
1807
|
+
readonly name: string;
|
|
1808
|
+
readonly result: {
|
|
1809
|
+
readonly type: "json";
|
|
1810
|
+
readonly value: unknown;
|
|
1811
|
+
} | {
|
|
1812
|
+
readonly type: "text";
|
|
1813
|
+
readonly value: unknown;
|
|
1814
|
+
} | {
|
|
1815
|
+
readonly type: "error";
|
|
1816
|
+
readonly value: unknown;
|
|
1817
|
+
} | {
|
|
1818
|
+
readonly type: "content";
|
|
1819
|
+
readonly value: readonly ({
|
|
1820
|
+
readonly type: "text";
|
|
1821
|
+
readonly text: string;
|
|
1822
|
+
} | {
|
|
1823
|
+
readonly type: "file";
|
|
1824
|
+
readonly uri: string;
|
|
1825
|
+
readonly mime: string;
|
|
1826
|
+
readonly name?: string | undefined;
|
|
1827
|
+
})[];
|
|
1828
|
+
};
|
|
1829
|
+
readonly output?: {
|
|
1830
|
+
readonly structured: unknown;
|
|
1831
|
+
readonly content: readonly ({
|
|
1832
|
+
readonly type: "text";
|
|
1833
|
+
readonly text: string;
|
|
1834
|
+
} | {
|
|
1835
|
+
readonly type: "file";
|
|
1836
|
+
readonly uri: string;
|
|
1837
|
+
readonly mime: string;
|
|
1838
|
+
readonly name?: string | undefined;
|
|
1839
|
+
})[];
|
|
1840
|
+
} | undefined;
|
|
1841
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1842
|
+
readonly providerMetadata?: {
|
|
1843
|
+
readonly [x: string]: {
|
|
1844
|
+
readonly [x: string]: unknown;
|
|
1845
|
+
};
|
|
1846
|
+
} | undefined;
|
|
1847
|
+
} | {
|
|
1848
|
+
readonly type: "tool-error";
|
|
1849
|
+
readonly id: string;
|
|
1850
|
+
readonly name: string;
|
|
1851
|
+
readonly message: string;
|
|
1852
|
+
readonly error?: unknown;
|
|
1853
|
+
readonly providerMetadata?: {
|
|
1854
|
+
readonly [x: string]: {
|
|
1855
|
+
readonly [x: string]: unknown;
|
|
1856
|
+
};
|
|
1857
|
+
} | undefined;
|
|
1858
|
+
} | {
|
|
1859
|
+
readonly type: "step-finish";
|
|
1860
|
+
readonly index: number;
|
|
1861
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1862
|
+
readonly usage?: Usage | undefined;
|
|
1863
|
+
readonly providerMetadata?: {
|
|
1864
|
+
readonly [x: string]: {
|
|
1865
|
+
readonly [x: string]: unknown;
|
|
1866
|
+
};
|
|
1867
|
+
} | undefined;
|
|
1868
|
+
} | {
|
|
1869
|
+
readonly type: "finish";
|
|
1870
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
1871
|
+
readonly usage?: Usage | undefined;
|
|
1872
|
+
readonly providerMetadata?: {
|
|
1873
|
+
readonly [x: string]: {
|
|
1874
|
+
readonly [x: string]: unknown;
|
|
1875
|
+
};
|
|
1876
|
+
} | undefined;
|
|
1877
|
+
} | {
|
|
1878
|
+
readonly type: "provider-error";
|
|
1879
|
+
readonly message: string;
|
|
1880
|
+
readonly classification?: "context-overflow" | undefined;
|
|
1881
|
+
readonly providerMetadata?: {
|
|
1882
|
+
readonly [x: string]: {
|
|
1883
|
+
readonly [x: string]: unknown;
|
|
1884
|
+
};
|
|
1885
|
+
} | undefined;
|
|
1886
|
+
}) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
1887
|
+
};
|
|
1888
|
+
} & {
|
|
1889
|
+
stepStart: (input: {
|
|
1890
|
+
readonly index: number;
|
|
1891
|
+
readonly type?: "step-start" | undefined;
|
|
1892
|
+
}, options?: Schema.MakeOptions) => {
|
|
1893
|
+
readonly type: "step-start";
|
|
1894
|
+
readonly index: number;
|
|
1895
|
+
};
|
|
1896
|
+
textStart: (input: WithID<TextStart, ContentBlockID>) => {
|
|
1897
|
+
readonly type: "text-start";
|
|
1898
|
+
readonly id: string;
|
|
1899
|
+
readonly providerMetadata?: {
|
|
1900
|
+
readonly [x: string]: {
|
|
1901
|
+
readonly [x: string]: unknown;
|
|
1902
|
+
};
|
|
1903
|
+
} | undefined;
|
|
1904
|
+
};
|
|
1905
|
+
textDelta: (input: WithID<TextDelta, ContentBlockID>) => {
|
|
1906
|
+
readonly type: "text-delta";
|
|
1907
|
+
readonly id: string;
|
|
1908
|
+
readonly text: string;
|
|
1909
|
+
readonly providerMetadata?: {
|
|
1910
|
+
readonly [x: string]: {
|
|
1911
|
+
readonly [x: string]: unknown;
|
|
1912
|
+
};
|
|
1913
|
+
} | undefined;
|
|
1914
|
+
};
|
|
1915
|
+
textEnd: (input: WithID<TextEnd, ContentBlockID>) => {
|
|
1916
|
+
readonly type: "text-end";
|
|
1917
|
+
readonly id: string;
|
|
1918
|
+
readonly providerMetadata?: {
|
|
1919
|
+
readonly [x: string]: {
|
|
1920
|
+
readonly [x: string]: unknown;
|
|
1921
|
+
};
|
|
1922
|
+
} | undefined;
|
|
1923
|
+
};
|
|
1924
|
+
reasoningStart: (input: WithID<ReasoningStart, ContentBlockID>) => {
|
|
1925
|
+
readonly type: "reasoning-start";
|
|
1926
|
+
readonly id: string;
|
|
1927
|
+
readonly providerMetadata?: {
|
|
1928
|
+
readonly [x: string]: {
|
|
1929
|
+
readonly [x: string]: unknown;
|
|
1930
|
+
};
|
|
1931
|
+
} | undefined;
|
|
1932
|
+
};
|
|
1933
|
+
reasoningDelta: (input: WithID<ReasoningDelta, ContentBlockID>) => {
|
|
1934
|
+
readonly type: "reasoning-delta";
|
|
1935
|
+
readonly id: string;
|
|
1936
|
+
readonly text: string;
|
|
1937
|
+
readonly providerMetadata?: {
|
|
1938
|
+
readonly [x: string]: {
|
|
1939
|
+
readonly [x: string]: unknown;
|
|
1940
|
+
};
|
|
1941
|
+
} | undefined;
|
|
1942
|
+
};
|
|
1943
|
+
reasoningEnd: (input: WithID<ReasoningEnd, ContentBlockID>) => {
|
|
1944
|
+
readonly type: "reasoning-end";
|
|
1945
|
+
readonly id: string;
|
|
1946
|
+
readonly providerMetadata?: {
|
|
1947
|
+
readonly [x: string]: {
|
|
1948
|
+
readonly [x: string]: unknown;
|
|
1949
|
+
};
|
|
1950
|
+
} | undefined;
|
|
1951
|
+
};
|
|
1952
|
+
toolInputStart: (input: WithID<ToolInputStart, ToolCallID>) => {
|
|
1953
|
+
readonly type: "tool-input-start";
|
|
1954
|
+
readonly id: string;
|
|
1955
|
+
readonly name: string;
|
|
1956
|
+
readonly providerMetadata?: {
|
|
1957
|
+
readonly [x: string]: {
|
|
1958
|
+
readonly [x: string]: unknown;
|
|
1959
|
+
};
|
|
1960
|
+
} | undefined;
|
|
1961
|
+
};
|
|
1962
|
+
toolInputDelta: (input: WithID<ToolInputDelta, ToolCallID>) => {
|
|
1963
|
+
readonly type: "tool-input-delta";
|
|
1964
|
+
readonly id: string;
|
|
1965
|
+
readonly name: string;
|
|
1966
|
+
readonly text: string;
|
|
1967
|
+
};
|
|
1968
|
+
toolInputEnd: (input: WithID<ToolInputEnd, ToolCallID>) => {
|
|
1969
|
+
readonly type: "tool-input-end";
|
|
1970
|
+
readonly id: string;
|
|
1971
|
+
readonly name: string;
|
|
1972
|
+
readonly providerMetadata?: {
|
|
1973
|
+
readonly [x: string]: {
|
|
1974
|
+
readonly [x: string]: unknown;
|
|
1975
|
+
};
|
|
1976
|
+
} | undefined;
|
|
1977
|
+
};
|
|
1978
|
+
toolCall: (input: WithID<ToolCall, ToolCallID>) => {
|
|
1979
|
+
readonly type: "tool-call";
|
|
1980
|
+
readonly id: string;
|
|
1981
|
+
readonly name: string;
|
|
1982
|
+
readonly input: unknown;
|
|
1983
|
+
readonly providerExecuted?: boolean | undefined;
|
|
1984
|
+
readonly providerMetadata?: {
|
|
1985
|
+
readonly [x: string]: {
|
|
1986
|
+
readonly [x: string]: unknown;
|
|
1987
|
+
};
|
|
1988
|
+
} | undefined;
|
|
1989
|
+
};
|
|
1990
|
+
toolResult: (input: WithID<ToolResult, ToolCallID>) => {
|
|
1991
|
+
readonly type: "tool-result";
|
|
1992
|
+
readonly id: string;
|
|
1993
|
+
readonly name: string;
|
|
1994
|
+
readonly result: {
|
|
1995
|
+
readonly type: "json";
|
|
1996
|
+
readonly value: unknown;
|
|
1997
|
+
} | {
|
|
1998
|
+
readonly type: "text";
|
|
1999
|
+
readonly value: unknown;
|
|
2000
|
+
} | {
|
|
2001
|
+
readonly type: "error";
|
|
2002
|
+
readonly value: unknown;
|
|
2003
|
+
} | {
|
|
2004
|
+
readonly type: "content";
|
|
2005
|
+
readonly value: readonly ({
|
|
2006
|
+
readonly type: "text";
|
|
2007
|
+
readonly text: string;
|
|
2008
|
+
} | {
|
|
2009
|
+
readonly type: "file";
|
|
2010
|
+
readonly uri: string;
|
|
2011
|
+
readonly mime: string;
|
|
2012
|
+
readonly name?: string | undefined;
|
|
2013
|
+
})[];
|
|
2014
|
+
};
|
|
2015
|
+
readonly output?: {
|
|
2016
|
+
readonly structured: unknown;
|
|
2017
|
+
readonly content: readonly ({
|
|
2018
|
+
readonly type: "text";
|
|
2019
|
+
readonly text: string;
|
|
2020
|
+
} | {
|
|
2021
|
+
readonly type: "file";
|
|
2022
|
+
readonly uri: string;
|
|
2023
|
+
readonly mime: string;
|
|
2024
|
+
readonly name?: string | undefined;
|
|
2025
|
+
})[];
|
|
2026
|
+
} | undefined;
|
|
2027
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2028
|
+
readonly providerMetadata?: {
|
|
2029
|
+
readonly [x: string]: {
|
|
2030
|
+
readonly [x: string]: unknown;
|
|
2031
|
+
};
|
|
2032
|
+
} | undefined;
|
|
2033
|
+
};
|
|
2034
|
+
toolError: (input: WithID<ToolError, ToolCallID>) => {
|
|
2035
|
+
readonly type: "tool-error";
|
|
2036
|
+
readonly id: string;
|
|
2037
|
+
readonly name: string;
|
|
2038
|
+
readonly message: string;
|
|
2039
|
+
readonly error?: unknown;
|
|
2040
|
+
readonly providerMetadata?: {
|
|
2041
|
+
readonly [x: string]: {
|
|
2042
|
+
readonly [x: string]: unknown;
|
|
2043
|
+
};
|
|
2044
|
+
} | undefined;
|
|
2045
|
+
};
|
|
2046
|
+
stepFinish: (input: WithUsage<StepFinish>) => {
|
|
2047
|
+
readonly type: "step-finish";
|
|
2048
|
+
readonly index: number;
|
|
2049
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2050
|
+
readonly usage?: Usage | undefined;
|
|
2051
|
+
readonly providerMetadata?: {
|
|
2052
|
+
readonly [x: string]: {
|
|
2053
|
+
readonly [x: string]: unknown;
|
|
2054
|
+
};
|
|
2055
|
+
} | undefined;
|
|
2056
|
+
};
|
|
2057
|
+
finish: (input: WithUsage<Finish>) => {
|
|
2058
|
+
readonly type: "finish";
|
|
2059
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2060
|
+
readonly usage?: Usage | undefined;
|
|
2061
|
+
readonly providerMetadata?: {
|
|
2062
|
+
readonly [x: string]: {
|
|
2063
|
+
readonly [x: string]: unknown;
|
|
2064
|
+
};
|
|
2065
|
+
} | undefined;
|
|
2066
|
+
};
|
|
2067
|
+
providerError: (input: {
|
|
2068
|
+
readonly message: string;
|
|
2069
|
+
readonly type?: "provider-error" | undefined;
|
|
2070
|
+
readonly classification?: "context-overflow" | undefined;
|
|
2071
|
+
readonly providerMetadata?: {
|
|
2072
|
+
readonly [x: string]: {
|
|
2073
|
+
readonly [x: string]: unknown;
|
|
2074
|
+
};
|
|
2075
|
+
} | undefined;
|
|
2076
|
+
}, options?: Schema.MakeOptions) => {
|
|
2077
|
+
readonly type: "provider-error";
|
|
2078
|
+
readonly message: string;
|
|
2079
|
+
readonly classification?: "context-overflow" | undefined;
|
|
2080
|
+
readonly providerMetadata?: {
|
|
2081
|
+
readonly [x: string]: {
|
|
2082
|
+
readonly [x: string]: unknown;
|
|
2083
|
+
};
|
|
2084
|
+
} | undefined;
|
|
2085
|
+
};
|
|
2086
|
+
is: {
|
|
2087
|
+
stepStart: (u: unknown) => u is {
|
|
2088
|
+
readonly type: "step-start";
|
|
2089
|
+
readonly index: number;
|
|
2090
|
+
};
|
|
2091
|
+
textStart: (u: unknown) => u is {
|
|
2092
|
+
readonly type: "text-start";
|
|
2093
|
+
readonly id: string;
|
|
2094
|
+
readonly providerMetadata?: {
|
|
2095
|
+
readonly [x: string]: {
|
|
2096
|
+
readonly [x: string]: unknown;
|
|
2097
|
+
};
|
|
2098
|
+
} | undefined;
|
|
2099
|
+
};
|
|
2100
|
+
textDelta: (u: unknown) => u is {
|
|
2101
|
+
readonly type: "text-delta";
|
|
2102
|
+
readonly id: string;
|
|
2103
|
+
readonly text: string;
|
|
2104
|
+
readonly providerMetadata?: {
|
|
2105
|
+
readonly [x: string]: {
|
|
2106
|
+
readonly [x: string]: unknown;
|
|
2107
|
+
};
|
|
2108
|
+
} | undefined;
|
|
2109
|
+
};
|
|
2110
|
+
textEnd: (u: unknown) => u is {
|
|
2111
|
+
readonly type: "text-end";
|
|
2112
|
+
readonly id: string;
|
|
2113
|
+
readonly providerMetadata?: {
|
|
2114
|
+
readonly [x: string]: {
|
|
2115
|
+
readonly [x: string]: unknown;
|
|
2116
|
+
};
|
|
2117
|
+
} | undefined;
|
|
2118
|
+
};
|
|
2119
|
+
reasoningStart: (u: unknown) => u is {
|
|
2120
|
+
readonly type: "reasoning-start";
|
|
2121
|
+
readonly id: string;
|
|
2122
|
+
readonly providerMetadata?: {
|
|
2123
|
+
readonly [x: string]: {
|
|
2124
|
+
readonly [x: string]: unknown;
|
|
2125
|
+
};
|
|
2126
|
+
} | undefined;
|
|
2127
|
+
};
|
|
2128
|
+
reasoningDelta: (u: unknown) => u is {
|
|
2129
|
+
readonly type: "reasoning-delta";
|
|
2130
|
+
readonly id: string;
|
|
2131
|
+
readonly text: string;
|
|
2132
|
+
readonly providerMetadata?: {
|
|
2133
|
+
readonly [x: string]: {
|
|
2134
|
+
readonly [x: string]: unknown;
|
|
2135
|
+
};
|
|
2136
|
+
} | undefined;
|
|
2137
|
+
};
|
|
2138
|
+
reasoningEnd: (u: unknown) => u is {
|
|
2139
|
+
readonly type: "reasoning-end";
|
|
2140
|
+
readonly id: string;
|
|
2141
|
+
readonly providerMetadata?: {
|
|
2142
|
+
readonly [x: string]: {
|
|
2143
|
+
readonly [x: string]: unknown;
|
|
2144
|
+
};
|
|
2145
|
+
} | undefined;
|
|
2146
|
+
};
|
|
2147
|
+
toolInputStart: (u: unknown) => u is {
|
|
2148
|
+
readonly type: "tool-input-start";
|
|
2149
|
+
readonly id: string;
|
|
2150
|
+
readonly name: string;
|
|
2151
|
+
readonly providerMetadata?: {
|
|
2152
|
+
readonly [x: string]: {
|
|
2153
|
+
readonly [x: string]: unknown;
|
|
2154
|
+
};
|
|
2155
|
+
} | undefined;
|
|
2156
|
+
};
|
|
2157
|
+
toolInputDelta: (u: unknown) => u is {
|
|
2158
|
+
readonly type: "tool-input-delta";
|
|
2159
|
+
readonly id: string;
|
|
2160
|
+
readonly name: string;
|
|
2161
|
+
readonly text: string;
|
|
2162
|
+
};
|
|
2163
|
+
toolInputEnd: (u: unknown) => u is {
|
|
2164
|
+
readonly type: "tool-input-end";
|
|
2165
|
+
readonly id: string;
|
|
2166
|
+
readonly name: string;
|
|
2167
|
+
readonly providerMetadata?: {
|
|
2168
|
+
readonly [x: string]: {
|
|
2169
|
+
readonly [x: string]: unknown;
|
|
2170
|
+
};
|
|
2171
|
+
} | undefined;
|
|
2172
|
+
};
|
|
2173
|
+
toolCall: (u: unknown) => u is {
|
|
2174
|
+
readonly type: "tool-call";
|
|
2175
|
+
readonly id: string;
|
|
2176
|
+
readonly name: string;
|
|
2177
|
+
readonly input: unknown;
|
|
2178
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2179
|
+
readonly providerMetadata?: {
|
|
2180
|
+
readonly [x: string]: {
|
|
2181
|
+
readonly [x: string]: unknown;
|
|
2182
|
+
};
|
|
2183
|
+
} | undefined;
|
|
2184
|
+
};
|
|
2185
|
+
toolResult: (u: unknown) => u is {
|
|
2186
|
+
readonly type: "tool-result";
|
|
2187
|
+
readonly id: string;
|
|
2188
|
+
readonly name: string;
|
|
2189
|
+
readonly result: {
|
|
2190
|
+
readonly type: "json";
|
|
2191
|
+
readonly value: unknown;
|
|
2192
|
+
} | {
|
|
2193
|
+
readonly type: "text";
|
|
2194
|
+
readonly value: unknown;
|
|
2195
|
+
} | {
|
|
2196
|
+
readonly type: "error";
|
|
2197
|
+
readonly value: unknown;
|
|
2198
|
+
} | {
|
|
2199
|
+
readonly type: "content";
|
|
2200
|
+
readonly value: readonly ({
|
|
2201
|
+
readonly type: "text";
|
|
2202
|
+
readonly text: string;
|
|
2203
|
+
} | {
|
|
2204
|
+
readonly type: "file";
|
|
2205
|
+
readonly uri: string;
|
|
2206
|
+
readonly mime: string;
|
|
2207
|
+
readonly name?: string | undefined;
|
|
2208
|
+
})[];
|
|
2209
|
+
};
|
|
2210
|
+
readonly output?: {
|
|
2211
|
+
readonly structured: unknown;
|
|
2212
|
+
readonly content: readonly ({
|
|
2213
|
+
readonly type: "text";
|
|
2214
|
+
readonly text: string;
|
|
2215
|
+
} | {
|
|
2216
|
+
readonly type: "file";
|
|
2217
|
+
readonly uri: string;
|
|
2218
|
+
readonly mime: string;
|
|
2219
|
+
readonly name?: string | undefined;
|
|
2220
|
+
})[];
|
|
2221
|
+
} | undefined;
|
|
2222
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2223
|
+
readonly providerMetadata?: {
|
|
2224
|
+
readonly [x: string]: {
|
|
2225
|
+
readonly [x: string]: unknown;
|
|
2226
|
+
};
|
|
2227
|
+
} | undefined;
|
|
2228
|
+
};
|
|
2229
|
+
toolError: (u: unknown) => u is {
|
|
2230
|
+
readonly type: "tool-error";
|
|
2231
|
+
readonly id: string;
|
|
2232
|
+
readonly name: string;
|
|
2233
|
+
readonly message: string;
|
|
2234
|
+
readonly error?: unknown;
|
|
2235
|
+
readonly providerMetadata?: {
|
|
2236
|
+
readonly [x: string]: {
|
|
2237
|
+
readonly [x: string]: unknown;
|
|
2238
|
+
};
|
|
2239
|
+
} | undefined;
|
|
2240
|
+
};
|
|
2241
|
+
stepFinish: (u: unknown) => u is {
|
|
2242
|
+
readonly type: "step-finish";
|
|
2243
|
+
readonly index: number;
|
|
2244
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2245
|
+
readonly usage?: Usage | undefined;
|
|
2246
|
+
readonly providerMetadata?: {
|
|
2247
|
+
readonly [x: string]: {
|
|
2248
|
+
readonly [x: string]: unknown;
|
|
2249
|
+
};
|
|
2250
|
+
} | undefined;
|
|
2251
|
+
};
|
|
2252
|
+
finish: (u: unknown) => u is {
|
|
2253
|
+
readonly type: "finish";
|
|
2254
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2255
|
+
readonly usage?: Usage | undefined;
|
|
2256
|
+
readonly providerMetadata?: {
|
|
2257
|
+
readonly [x: string]: {
|
|
2258
|
+
readonly [x: string]: unknown;
|
|
2259
|
+
};
|
|
2260
|
+
} | undefined;
|
|
2261
|
+
};
|
|
2262
|
+
providerError: (u: unknown) => u is {
|
|
2263
|
+
readonly type: "provider-error";
|
|
2264
|
+
readonly message: string;
|
|
2265
|
+
readonly classification?: "context-overflow" | undefined;
|
|
2266
|
+
readonly providerMetadata?: {
|
|
2267
|
+
readonly [x: string]: {
|
|
2268
|
+
readonly [x: string]: unknown;
|
|
2269
|
+
};
|
|
2270
|
+
} | undefined;
|
|
2271
|
+
};
|
|
2272
|
+
};
|
|
2273
|
+
};
|
|
2274
|
+
export type LLMEvent = Schema.Schema.Type<typeof llmEventTagged>;
|
|
2275
|
+
declare const PreparedRequest_base: Schema.Class<PreparedRequest, Schema.Struct<{
|
|
2276
|
+
readonly id: Schema.String;
|
|
2277
|
+
readonly route: Schema.String;
|
|
2278
|
+
readonly protocol: Schema.String;
|
|
2279
|
+
readonly model: Schema.declare<import("./options").Model, import("./options").Model>;
|
|
2280
|
+
readonly body: Schema.Unknown;
|
|
2281
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
2282
|
+
}>, {}>;
|
|
2283
|
+
export declare class PreparedRequest extends PreparedRequest_base {
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* A `PreparedRequest` whose `body` is typed as `Body`. Use with the generic
|
|
2287
|
+
* on `LLMClient.prepare<Body>(...)` when the caller knows which route their
|
|
2288
|
+
* request will resolve to and wants its native shape statically exposed
|
|
2289
|
+
* (debug UIs, request previews, plan rendering).
|
|
2290
|
+
*
|
|
2291
|
+
* The runtime body is identical — the route still emits `body: unknown` — so
|
|
2292
|
+
* this is a type-level assertion the caller makes about what they expect to
|
|
2293
|
+
* find. The prepare runtime does not validate the assertion.
|
|
2294
|
+
*/
|
|
2295
|
+
export type PreparedRequestOf<Body> = Omit<PreparedRequest, "body"> & {
|
|
2296
|
+
readonly body: Body;
|
|
2297
|
+
};
|
|
2298
|
+
interface ContentAssembly {
|
|
2299
|
+
readonly contentIndex: number;
|
|
2300
|
+
readonly text: string;
|
|
2301
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
2302
|
+
}
|
|
2303
|
+
interface ToolInputAssembly {
|
|
2304
|
+
readonly name: string;
|
|
2305
|
+
readonly text: string;
|
|
2306
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
2307
|
+
}
|
|
2308
|
+
interface ResponseState {
|
|
2309
|
+
readonly events: ReadonlyArray<LLMEvent>;
|
|
2310
|
+
readonly message: Message;
|
|
2311
|
+
readonly usage?: Usage;
|
|
2312
|
+
readonly finishReason?: FinishReason;
|
|
2313
|
+
readonly textParts: Readonly<Record<string, ContentAssembly>>;
|
|
2314
|
+
readonly reasoningParts: Readonly<Record<string, ContentAssembly>>;
|
|
2315
|
+
readonly toolInputs: Readonly<Record<string, ToolInputAssembly>>;
|
|
2316
|
+
}
|
|
2317
|
+
declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
2318
|
+
readonly message: typeof Message;
|
|
2319
|
+
readonly events: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2320
|
+
readonly type: Schema.tag<"step-start">;
|
|
2321
|
+
readonly index: Schema.Number;
|
|
2322
|
+
}>, Schema.Struct<{
|
|
2323
|
+
readonly type: Schema.tag<"text-start">;
|
|
2324
|
+
readonly id: Schema.String;
|
|
2325
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2326
|
+
}>, Schema.Struct<{
|
|
2327
|
+
readonly type: Schema.tag<"text-delta">;
|
|
2328
|
+
readonly id: Schema.String;
|
|
2329
|
+
readonly text: Schema.String;
|
|
2330
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2331
|
+
}>, Schema.Struct<{
|
|
2332
|
+
readonly type: Schema.tag<"text-end">;
|
|
2333
|
+
readonly id: Schema.String;
|
|
2334
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2335
|
+
}>, Schema.Struct<{
|
|
2336
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
2337
|
+
readonly id: Schema.String;
|
|
2338
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2339
|
+
}>, Schema.Struct<{
|
|
2340
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
2341
|
+
readonly id: Schema.String;
|
|
2342
|
+
readonly text: Schema.String;
|
|
2343
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2344
|
+
}>, Schema.Struct<{
|
|
2345
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
2346
|
+
readonly id: Schema.String;
|
|
2347
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2348
|
+
}>, Schema.Struct<{
|
|
2349
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
2350
|
+
readonly id: Schema.String;
|
|
2351
|
+
readonly name: Schema.String;
|
|
2352
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2353
|
+
}>, Schema.Struct<{
|
|
2354
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
2355
|
+
readonly id: Schema.String;
|
|
2356
|
+
readonly name: Schema.String;
|
|
2357
|
+
readonly text: Schema.String;
|
|
2358
|
+
}>, Schema.Struct<{
|
|
2359
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
2360
|
+
readonly id: Schema.String;
|
|
2361
|
+
readonly name: Schema.String;
|
|
2362
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2363
|
+
}>, Schema.Struct<{
|
|
2364
|
+
readonly type: Schema.tag<"tool-call">;
|
|
2365
|
+
readonly id: Schema.String;
|
|
2366
|
+
readonly name: Schema.String;
|
|
2367
|
+
readonly input: Schema.Unknown;
|
|
2368
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
2369
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2370
|
+
}>, Schema.Struct<{
|
|
2371
|
+
readonly type: Schema.tag<"tool-result">;
|
|
2372
|
+
readonly id: Schema.String;
|
|
2373
|
+
readonly name: Schema.String;
|
|
2374
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
2375
|
+
readonly type: Schema.Literal<"json">;
|
|
2376
|
+
readonly value: Schema.Unknown;
|
|
2377
|
+
}>, Schema.Struct<{
|
|
2378
|
+
readonly type: Schema.Literal<"text">;
|
|
2379
|
+
readonly value: Schema.Unknown;
|
|
2380
|
+
}>, Schema.Struct<{
|
|
2381
|
+
readonly type: Schema.Literal<"error">;
|
|
2382
|
+
readonly value: Schema.Unknown;
|
|
2383
|
+
}>, Schema.Struct<{
|
|
2384
|
+
readonly type: Schema.Literal<"content">;
|
|
2385
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2386
|
+
readonly type: Schema.Literal<"text">;
|
|
2387
|
+
readonly text: Schema.String;
|
|
2388
|
+
}>, Schema.Struct<{
|
|
2389
|
+
readonly type: Schema.Literal<"file">;
|
|
2390
|
+
readonly uri: Schema.String;
|
|
2391
|
+
readonly mime: Schema.String;
|
|
2392
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
2393
|
+
}>]>>;
|
|
2394
|
+
}>]> & {
|
|
2395
|
+
is: (value: unknown) => value is ToolResultValue;
|
|
2396
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
2397
|
+
};
|
|
2398
|
+
readonly output: Schema.optional<Schema.Struct<{
|
|
2399
|
+
readonly structured: Schema.Unknown;
|
|
2400
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2401
|
+
readonly type: Schema.Literal<"text">;
|
|
2402
|
+
readonly text: Schema.String;
|
|
2403
|
+
}>, Schema.Struct<{
|
|
2404
|
+
readonly type: Schema.Literal<"file">;
|
|
2405
|
+
readonly uri: Schema.String;
|
|
2406
|
+
readonly mime: Schema.String;
|
|
2407
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
2408
|
+
}>]>>;
|
|
2409
|
+
}> & {
|
|
2410
|
+
make: (structured: unknown, content?: ReadonlyArray<import("@opencode-ai/schema/llm").ToolContent>) => ToolOutput;
|
|
2411
|
+
fromResultValue: (result: ToolResultValue) => ToolOutput | undefined;
|
|
2412
|
+
toResultValue: (output: ToolOutput) => ToolResultValue;
|
|
2413
|
+
}>;
|
|
2414
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
2415
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2416
|
+
}>, Schema.Struct<{
|
|
2417
|
+
readonly type: Schema.tag<"tool-error">;
|
|
2418
|
+
readonly id: Schema.String;
|
|
2419
|
+
readonly name: Schema.String;
|
|
2420
|
+
readonly message: Schema.String;
|
|
2421
|
+
readonly error: Schema.optional<Schema.Defect>;
|
|
2422
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2423
|
+
}>, Schema.Struct<{
|
|
2424
|
+
readonly type: Schema.tag<"step-finish">;
|
|
2425
|
+
readonly index: Schema.Number;
|
|
2426
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
2427
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
2428
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2429
|
+
}>, Schema.Struct<{
|
|
2430
|
+
readonly type: Schema.tag<"finish">;
|
|
2431
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
2432
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
2433
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2434
|
+
}>, Schema.Struct<{
|
|
2435
|
+
readonly type: Schema.tag<"provider-error">;
|
|
2436
|
+
readonly message: Schema.String;
|
|
2437
|
+
readonly classification: Schema.optional<Schema.Literal<"context-overflow">>;
|
|
2438
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2439
|
+
}>]> & {
|
|
2440
|
+
readonly cases: {
|
|
2441
|
+
"step-start": Schema.Struct<{
|
|
2442
|
+
readonly type: Schema.tag<"step-start">;
|
|
2443
|
+
readonly index: Schema.Number;
|
|
2444
|
+
}>;
|
|
2445
|
+
"text-start": Schema.Struct<{
|
|
2446
|
+
readonly type: Schema.tag<"text-start">;
|
|
2447
|
+
readonly id: Schema.String;
|
|
2448
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2449
|
+
}>;
|
|
2450
|
+
"text-delta": Schema.Struct<{
|
|
2451
|
+
readonly type: Schema.tag<"text-delta">;
|
|
2452
|
+
readonly id: Schema.String;
|
|
2453
|
+
readonly text: Schema.String;
|
|
2454
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2455
|
+
}>;
|
|
2456
|
+
"text-end": Schema.Struct<{
|
|
2457
|
+
readonly type: Schema.tag<"text-end">;
|
|
2458
|
+
readonly id: Schema.String;
|
|
2459
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2460
|
+
}>;
|
|
2461
|
+
"reasoning-start": Schema.Struct<{
|
|
2462
|
+
readonly type: Schema.tag<"reasoning-start">;
|
|
2463
|
+
readonly id: Schema.String;
|
|
2464
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2465
|
+
}>;
|
|
2466
|
+
"reasoning-delta": Schema.Struct<{
|
|
2467
|
+
readonly type: Schema.tag<"reasoning-delta">;
|
|
2468
|
+
readonly id: Schema.String;
|
|
2469
|
+
readonly text: Schema.String;
|
|
2470
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2471
|
+
}>;
|
|
2472
|
+
"reasoning-end": Schema.Struct<{
|
|
2473
|
+
readonly type: Schema.tag<"reasoning-end">;
|
|
2474
|
+
readonly id: Schema.String;
|
|
2475
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2476
|
+
}>;
|
|
2477
|
+
"tool-input-start": Schema.Struct<{
|
|
2478
|
+
readonly type: Schema.tag<"tool-input-start">;
|
|
2479
|
+
readonly id: Schema.String;
|
|
2480
|
+
readonly name: Schema.String;
|
|
2481
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2482
|
+
}>;
|
|
2483
|
+
"tool-input-delta": Schema.Struct<{
|
|
2484
|
+
readonly type: Schema.tag<"tool-input-delta">;
|
|
2485
|
+
readonly id: Schema.String;
|
|
2486
|
+
readonly name: Schema.String;
|
|
2487
|
+
readonly text: Schema.String;
|
|
2488
|
+
}>;
|
|
2489
|
+
"tool-input-end": Schema.Struct<{
|
|
2490
|
+
readonly type: Schema.tag<"tool-input-end">;
|
|
2491
|
+
readonly id: Schema.String;
|
|
2492
|
+
readonly name: Schema.String;
|
|
2493
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2494
|
+
}>;
|
|
2495
|
+
"tool-call": Schema.Struct<{
|
|
2496
|
+
readonly type: Schema.tag<"tool-call">;
|
|
2497
|
+
readonly id: Schema.String;
|
|
2498
|
+
readonly name: Schema.String;
|
|
2499
|
+
readonly input: Schema.Unknown;
|
|
2500
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
2501
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2502
|
+
}>;
|
|
2503
|
+
"tool-result": Schema.Struct<{
|
|
2504
|
+
readonly type: Schema.tag<"tool-result">;
|
|
2505
|
+
readonly id: Schema.String;
|
|
2506
|
+
readonly name: Schema.String;
|
|
2507
|
+
readonly result: Schema.Union<readonly [Schema.Struct<{
|
|
2508
|
+
readonly type: Schema.Literal<"json">;
|
|
2509
|
+
readonly value: Schema.Unknown;
|
|
2510
|
+
}>, Schema.Struct<{
|
|
2511
|
+
readonly type: Schema.Literal<"text">;
|
|
2512
|
+
readonly value: Schema.Unknown;
|
|
2513
|
+
}>, Schema.Struct<{
|
|
2514
|
+
readonly type: Schema.Literal<"error">;
|
|
2515
|
+
readonly value: Schema.Unknown;
|
|
2516
|
+
}>, Schema.Struct<{
|
|
2517
|
+
readonly type: Schema.Literal<"content">;
|
|
2518
|
+
readonly value: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2519
|
+
readonly type: Schema.Literal<"text">;
|
|
2520
|
+
readonly text: Schema.String;
|
|
2521
|
+
}>, Schema.Struct<{
|
|
2522
|
+
readonly type: Schema.Literal<"file">;
|
|
2523
|
+
readonly uri: Schema.String;
|
|
2524
|
+
readonly mime: Schema.String;
|
|
2525
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
2526
|
+
}>]>>;
|
|
2527
|
+
}>]> & {
|
|
2528
|
+
is: (value: unknown) => value is ToolResultValue;
|
|
2529
|
+
make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue;
|
|
2530
|
+
};
|
|
2531
|
+
readonly output: Schema.optional<Schema.Struct<{
|
|
2532
|
+
readonly structured: Schema.Unknown;
|
|
2533
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
2534
|
+
readonly type: Schema.Literal<"text">;
|
|
2535
|
+
readonly text: Schema.String;
|
|
2536
|
+
}>, Schema.Struct<{
|
|
2537
|
+
readonly type: Schema.Literal<"file">;
|
|
2538
|
+
readonly uri: Schema.String;
|
|
2539
|
+
readonly mime: Schema.String;
|
|
2540
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
2541
|
+
}>]>>;
|
|
2542
|
+
}> & {
|
|
2543
|
+
make: (structured: unknown, content?: ReadonlyArray<import("@opencode-ai/schema/llm").ToolContent>) => ToolOutput;
|
|
2544
|
+
fromResultValue: (result: ToolResultValue) => ToolOutput | undefined;
|
|
2545
|
+
toResultValue: (output: ToolOutput) => ToolResultValue;
|
|
2546
|
+
}>;
|
|
2547
|
+
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
2548
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2549
|
+
}>;
|
|
2550
|
+
"tool-error": Schema.Struct<{
|
|
2551
|
+
readonly type: Schema.tag<"tool-error">;
|
|
2552
|
+
readonly id: Schema.String;
|
|
2553
|
+
readonly name: Schema.String;
|
|
2554
|
+
readonly message: Schema.String;
|
|
2555
|
+
readonly error: Schema.optional<Schema.Defect>;
|
|
2556
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2557
|
+
}>;
|
|
2558
|
+
"step-finish": Schema.Struct<{
|
|
2559
|
+
readonly type: Schema.tag<"step-finish">;
|
|
2560
|
+
readonly index: Schema.Number;
|
|
2561
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
2562
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
2563
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2564
|
+
}>;
|
|
2565
|
+
finish: Schema.Struct<{
|
|
2566
|
+
readonly type: Schema.tag<"finish">;
|
|
2567
|
+
readonly reason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
2568
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
2569
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2570
|
+
}>;
|
|
2571
|
+
"provider-error": Schema.Struct<{
|
|
2572
|
+
readonly type: Schema.tag<"provider-error">;
|
|
2573
|
+
readonly message: Schema.String;
|
|
2574
|
+
readonly classification: Schema.optional<Schema.Literal<"context-overflow">>;
|
|
2575
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2576
|
+
}>;
|
|
2577
|
+
};
|
|
2578
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
2579
|
+
readonly type: "step-start";
|
|
2580
|
+
readonly index: number;
|
|
2581
|
+
} | {
|
|
2582
|
+
readonly type: "text-start";
|
|
2583
|
+
readonly id: string;
|
|
2584
|
+
readonly providerMetadata?: {
|
|
2585
|
+
readonly [x: string]: {
|
|
2586
|
+
readonly [x: string]: unknown;
|
|
2587
|
+
};
|
|
2588
|
+
} | undefined;
|
|
2589
|
+
} | {
|
|
2590
|
+
readonly type: "text-delta";
|
|
2591
|
+
readonly id: string;
|
|
2592
|
+
readonly text: string;
|
|
2593
|
+
readonly providerMetadata?: {
|
|
2594
|
+
readonly [x: string]: {
|
|
2595
|
+
readonly [x: string]: unknown;
|
|
2596
|
+
};
|
|
2597
|
+
} | undefined;
|
|
2598
|
+
} | {
|
|
2599
|
+
readonly type: "text-end";
|
|
2600
|
+
readonly id: string;
|
|
2601
|
+
readonly providerMetadata?: {
|
|
2602
|
+
readonly [x: string]: {
|
|
2603
|
+
readonly [x: string]: unknown;
|
|
2604
|
+
};
|
|
2605
|
+
} | undefined;
|
|
2606
|
+
} | {
|
|
2607
|
+
readonly type: "reasoning-start";
|
|
2608
|
+
readonly id: string;
|
|
2609
|
+
readonly providerMetadata?: {
|
|
2610
|
+
readonly [x: string]: {
|
|
2611
|
+
readonly [x: string]: unknown;
|
|
2612
|
+
};
|
|
2613
|
+
} | undefined;
|
|
2614
|
+
} | {
|
|
2615
|
+
readonly type: "reasoning-delta";
|
|
2616
|
+
readonly id: string;
|
|
2617
|
+
readonly text: string;
|
|
2618
|
+
readonly providerMetadata?: {
|
|
2619
|
+
readonly [x: string]: {
|
|
2620
|
+
readonly [x: string]: unknown;
|
|
2621
|
+
};
|
|
2622
|
+
} | undefined;
|
|
2623
|
+
} | {
|
|
2624
|
+
readonly type: "reasoning-end";
|
|
2625
|
+
readonly id: string;
|
|
2626
|
+
readonly providerMetadata?: {
|
|
2627
|
+
readonly [x: string]: {
|
|
2628
|
+
readonly [x: string]: unknown;
|
|
2629
|
+
};
|
|
2630
|
+
} | undefined;
|
|
2631
|
+
} | {
|
|
2632
|
+
readonly type: "tool-input-start";
|
|
2633
|
+
readonly id: string;
|
|
2634
|
+
readonly name: string;
|
|
2635
|
+
readonly providerMetadata?: {
|
|
2636
|
+
readonly [x: string]: {
|
|
2637
|
+
readonly [x: string]: unknown;
|
|
2638
|
+
};
|
|
2639
|
+
} | undefined;
|
|
2640
|
+
} | {
|
|
2641
|
+
readonly type: "tool-input-delta";
|
|
2642
|
+
readonly id: string;
|
|
2643
|
+
readonly name: string;
|
|
2644
|
+
readonly text: string;
|
|
2645
|
+
} | {
|
|
2646
|
+
readonly type: "tool-input-end";
|
|
2647
|
+
readonly id: string;
|
|
2648
|
+
readonly name: string;
|
|
2649
|
+
readonly providerMetadata?: {
|
|
2650
|
+
readonly [x: string]: {
|
|
2651
|
+
readonly [x: string]: unknown;
|
|
2652
|
+
};
|
|
2653
|
+
} | undefined;
|
|
2654
|
+
} | {
|
|
2655
|
+
readonly type: "tool-call";
|
|
2656
|
+
readonly id: string;
|
|
2657
|
+
readonly name: string;
|
|
2658
|
+
readonly input: unknown;
|
|
2659
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2660
|
+
readonly providerMetadata?: {
|
|
2661
|
+
readonly [x: string]: {
|
|
2662
|
+
readonly [x: string]: unknown;
|
|
2663
|
+
};
|
|
2664
|
+
} | undefined;
|
|
2665
|
+
} | {
|
|
2666
|
+
readonly type: "tool-result";
|
|
2667
|
+
readonly id: string;
|
|
2668
|
+
readonly name: string;
|
|
2669
|
+
readonly result: {
|
|
2670
|
+
readonly type: "json";
|
|
2671
|
+
readonly value: unknown;
|
|
2672
|
+
} | {
|
|
2673
|
+
readonly type: "text";
|
|
2674
|
+
readonly value: unknown;
|
|
2675
|
+
} | {
|
|
2676
|
+
readonly type: "error";
|
|
2677
|
+
readonly value: unknown;
|
|
2678
|
+
} | {
|
|
2679
|
+
readonly type: "content";
|
|
2680
|
+
readonly value: readonly ({
|
|
2681
|
+
readonly type: "text";
|
|
2682
|
+
readonly text: string;
|
|
2683
|
+
} | {
|
|
2684
|
+
readonly type: "file";
|
|
2685
|
+
readonly uri: string;
|
|
2686
|
+
readonly mime: string;
|
|
2687
|
+
readonly name?: string | undefined;
|
|
2688
|
+
})[];
|
|
2689
|
+
};
|
|
2690
|
+
readonly output?: {
|
|
2691
|
+
readonly structured: unknown;
|
|
2692
|
+
readonly content: readonly ({
|
|
2693
|
+
readonly type: "text";
|
|
2694
|
+
readonly text: string;
|
|
2695
|
+
} | {
|
|
2696
|
+
readonly type: "file";
|
|
2697
|
+
readonly uri: string;
|
|
2698
|
+
readonly mime: string;
|
|
2699
|
+
readonly name?: string | undefined;
|
|
2700
|
+
})[];
|
|
2701
|
+
} | undefined;
|
|
2702
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2703
|
+
readonly providerMetadata?: {
|
|
2704
|
+
readonly [x: string]: {
|
|
2705
|
+
readonly [x: string]: unknown;
|
|
2706
|
+
};
|
|
2707
|
+
} | undefined;
|
|
2708
|
+
} | {
|
|
2709
|
+
readonly type: "tool-error";
|
|
2710
|
+
readonly id: string;
|
|
2711
|
+
readonly name: string;
|
|
2712
|
+
readonly message: string;
|
|
2713
|
+
readonly error?: unknown;
|
|
2714
|
+
readonly providerMetadata?: {
|
|
2715
|
+
readonly [x: string]: {
|
|
2716
|
+
readonly [x: string]: unknown;
|
|
2717
|
+
};
|
|
2718
|
+
} | undefined;
|
|
2719
|
+
} | {
|
|
2720
|
+
readonly type: "step-finish";
|
|
2721
|
+
readonly index: number;
|
|
2722
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2723
|
+
readonly usage?: Usage | undefined;
|
|
2724
|
+
readonly providerMetadata?: {
|
|
2725
|
+
readonly [x: string]: {
|
|
2726
|
+
readonly [x: string]: unknown;
|
|
2727
|
+
};
|
|
2728
|
+
} | undefined;
|
|
2729
|
+
} | {
|
|
2730
|
+
readonly type: "finish";
|
|
2731
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2732
|
+
readonly usage?: Usage | undefined;
|
|
2733
|
+
readonly providerMetadata?: {
|
|
2734
|
+
readonly [x: string]: {
|
|
2735
|
+
readonly [x: string]: unknown;
|
|
2736
|
+
};
|
|
2737
|
+
} | undefined;
|
|
2738
|
+
} | {
|
|
2739
|
+
readonly type: "provider-error";
|
|
2740
|
+
readonly message: string;
|
|
2741
|
+
readonly classification?: "context-overflow" | undefined;
|
|
2742
|
+
readonly providerMetadata?: {
|
|
2743
|
+
readonly [x: string]: {
|
|
2744
|
+
readonly [x: string]: unknown;
|
|
2745
|
+
};
|
|
2746
|
+
} | undefined;
|
|
2747
|
+
}) => value is Extract<{
|
|
2748
|
+
readonly type: "step-start";
|
|
2749
|
+
readonly index: number;
|
|
2750
|
+
}, {
|
|
2751
|
+
readonly type: Keys;
|
|
2752
|
+
}> | Extract<{
|
|
2753
|
+
readonly type: "text-start";
|
|
2754
|
+
readonly id: string;
|
|
2755
|
+
readonly providerMetadata?: {
|
|
2756
|
+
readonly [x: string]: {
|
|
2757
|
+
readonly [x: string]: unknown;
|
|
2758
|
+
};
|
|
2759
|
+
} | undefined;
|
|
2760
|
+
}, {
|
|
2761
|
+
readonly type: Keys;
|
|
2762
|
+
}> | Extract<{
|
|
2763
|
+
readonly type: "text-delta";
|
|
2764
|
+
readonly id: string;
|
|
2765
|
+
readonly text: string;
|
|
2766
|
+
readonly providerMetadata?: {
|
|
2767
|
+
readonly [x: string]: {
|
|
2768
|
+
readonly [x: string]: unknown;
|
|
2769
|
+
};
|
|
2770
|
+
} | undefined;
|
|
2771
|
+
}, {
|
|
2772
|
+
readonly type: Keys;
|
|
2773
|
+
}> | Extract<{
|
|
2774
|
+
readonly type: "text-end";
|
|
2775
|
+
readonly id: string;
|
|
2776
|
+
readonly providerMetadata?: {
|
|
2777
|
+
readonly [x: string]: {
|
|
2778
|
+
readonly [x: string]: unknown;
|
|
2779
|
+
};
|
|
2780
|
+
} | undefined;
|
|
2781
|
+
}, {
|
|
2782
|
+
readonly type: Keys;
|
|
2783
|
+
}> | Extract<{
|
|
2784
|
+
readonly type: "reasoning-start";
|
|
2785
|
+
readonly id: string;
|
|
2786
|
+
readonly providerMetadata?: {
|
|
2787
|
+
readonly [x: string]: {
|
|
2788
|
+
readonly [x: string]: unknown;
|
|
2789
|
+
};
|
|
2790
|
+
} | undefined;
|
|
2791
|
+
}, {
|
|
2792
|
+
readonly type: Keys;
|
|
2793
|
+
}> | Extract<{
|
|
2794
|
+
readonly type: "reasoning-delta";
|
|
2795
|
+
readonly id: string;
|
|
2796
|
+
readonly text: string;
|
|
2797
|
+
readonly providerMetadata?: {
|
|
2798
|
+
readonly [x: string]: {
|
|
2799
|
+
readonly [x: string]: unknown;
|
|
2800
|
+
};
|
|
2801
|
+
} | undefined;
|
|
2802
|
+
}, {
|
|
2803
|
+
readonly type: Keys;
|
|
2804
|
+
}> | Extract<{
|
|
2805
|
+
readonly type: "reasoning-end";
|
|
2806
|
+
readonly id: string;
|
|
2807
|
+
readonly providerMetadata?: {
|
|
2808
|
+
readonly [x: string]: {
|
|
2809
|
+
readonly [x: string]: unknown;
|
|
2810
|
+
};
|
|
2811
|
+
} | undefined;
|
|
2812
|
+
}, {
|
|
2813
|
+
readonly type: Keys;
|
|
2814
|
+
}> | Extract<{
|
|
2815
|
+
readonly type: "tool-input-start";
|
|
2816
|
+
readonly id: string;
|
|
2817
|
+
readonly name: string;
|
|
2818
|
+
readonly providerMetadata?: {
|
|
2819
|
+
readonly [x: string]: {
|
|
2820
|
+
readonly [x: string]: unknown;
|
|
2821
|
+
};
|
|
2822
|
+
} | undefined;
|
|
2823
|
+
}, {
|
|
2824
|
+
readonly type: Keys;
|
|
2825
|
+
}> | Extract<{
|
|
2826
|
+
readonly type: "tool-input-delta";
|
|
2827
|
+
readonly id: string;
|
|
2828
|
+
readonly name: string;
|
|
2829
|
+
readonly text: string;
|
|
2830
|
+
}, {
|
|
2831
|
+
readonly type: Keys;
|
|
2832
|
+
}> | Extract<{
|
|
2833
|
+
readonly type: "tool-input-end";
|
|
2834
|
+
readonly id: string;
|
|
2835
|
+
readonly name: string;
|
|
2836
|
+
readonly providerMetadata?: {
|
|
2837
|
+
readonly [x: string]: {
|
|
2838
|
+
readonly [x: string]: unknown;
|
|
2839
|
+
};
|
|
2840
|
+
} | undefined;
|
|
2841
|
+
}, {
|
|
2842
|
+
readonly type: Keys;
|
|
2843
|
+
}> | Extract<{
|
|
2844
|
+
readonly type: "tool-call";
|
|
2845
|
+
readonly id: string;
|
|
2846
|
+
readonly name: string;
|
|
2847
|
+
readonly input: unknown;
|
|
2848
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2849
|
+
readonly providerMetadata?: {
|
|
2850
|
+
readonly [x: string]: {
|
|
2851
|
+
readonly [x: string]: unknown;
|
|
2852
|
+
};
|
|
2853
|
+
} | undefined;
|
|
2854
|
+
}, {
|
|
2855
|
+
readonly type: Keys;
|
|
2856
|
+
}> | Extract<{
|
|
2857
|
+
readonly type: "tool-result";
|
|
2858
|
+
readonly id: string;
|
|
2859
|
+
readonly name: string;
|
|
2860
|
+
readonly result: {
|
|
2861
|
+
readonly type: "json";
|
|
2862
|
+
readonly value: unknown;
|
|
2863
|
+
} | {
|
|
2864
|
+
readonly type: "text";
|
|
2865
|
+
readonly value: unknown;
|
|
2866
|
+
} | {
|
|
2867
|
+
readonly type: "error";
|
|
2868
|
+
readonly value: unknown;
|
|
2869
|
+
} | {
|
|
2870
|
+
readonly type: "content";
|
|
2871
|
+
readonly value: readonly ({
|
|
2872
|
+
readonly type: "text";
|
|
2873
|
+
readonly text: string;
|
|
2874
|
+
} | {
|
|
2875
|
+
readonly type: "file";
|
|
2876
|
+
readonly uri: string;
|
|
2877
|
+
readonly mime: string;
|
|
2878
|
+
readonly name?: string | undefined;
|
|
2879
|
+
})[];
|
|
2880
|
+
};
|
|
2881
|
+
readonly output?: {
|
|
2882
|
+
readonly structured: unknown;
|
|
2883
|
+
readonly content: readonly ({
|
|
2884
|
+
readonly type: "text";
|
|
2885
|
+
readonly text: string;
|
|
2886
|
+
} | {
|
|
2887
|
+
readonly type: "file";
|
|
2888
|
+
readonly uri: string;
|
|
2889
|
+
readonly mime: string;
|
|
2890
|
+
readonly name?: string | undefined;
|
|
2891
|
+
})[];
|
|
2892
|
+
} | undefined;
|
|
2893
|
+
readonly providerExecuted?: boolean | undefined;
|
|
2894
|
+
readonly providerMetadata?: {
|
|
2895
|
+
readonly [x: string]: {
|
|
2896
|
+
readonly [x: string]: unknown;
|
|
2897
|
+
};
|
|
2898
|
+
} | undefined;
|
|
2899
|
+
}, {
|
|
2900
|
+
readonly type: Keys;
|
|
2901
|
+
}> | Extract<{
|
|
2902
|
+
readonly type: "tool-error";
|
|
2903
|
+
readonly id: string;
|
|
2904
|
+
readonly name: string;
|
|
2905
|
+
readonly message: string;
|
|
2906
|
+
readonly error?: unknown;
|
|
2907
|
+
readonly providerMetadata?: {
|
|
2908
|
+
readonly [x: string]: {
|
|
2909
|
+
readonly [x: string]: unknown;
|
|
2910
|
+
};
|
|
2911
|
+
} | undefined;
|
|
2912
|
+
}, {
|
|
2913
|
+
readonly type: Keys;
|
|
2914
|
+
}> | Extract<{
|
|
2915
|
+
readonly type: "step-finish";
|
|
2916
|
+
readonly index: number;
|
|
2917
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2918
|
+
readonly usage?: Usage | undefined;
|
|
2919
|
+
readonly providerMetadata?: {
|
|
2920
|
+
readonly [x: string]: {
|
|
2921
|
+
readonly [x: string]: unknown;
|
|
2922
|
+
};
|
|
2923
|
+
} | undefined;
|
|
2924
|
+
}, {
|
|
2925
|
+
readonly type: Keys;
|
|
2926
|
+
}> | Extract<{
|
|
2927
|
+
readonly type: "finish";
|
|
2928
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
2929
|
+
readonly usage?: Usage | undefined;
|
|
2930
|
+
readonly providerMetadata?: {
|
|
2931
|
+
readonly [x: string]: {
|
|
2932
|
+
readonly [x: string]: unknown;
|
|
2933
|
+
};
|
|
2934
|
+
} | undefined;
|
|
2935
|
+
}, {
|
|
2936
|
+
readonly type: Keys;
|
|
2937
|
+
}> | Extract<{
|
|
2938
|
+
readonly type: "provider-error";
|
|
2939
|
+
readonly message: string;
|
|
2940
|
+
readonly classification?: "context-overflow" | undefined;
|
|
2941
|
+
readonly providerMetadata?: {
|
|
2942
|
+
readonly [x: string]: {
|
|
2943
|
+
readonly [x: string]: unknown;
|
|
2944
|
+
};
|
|
2945
|
+
} | undefined;
|
|
2946
|
+
}, {
|
|
2947
|
+
readonly type: Keys;
|
|
2948
|
+
}>;
|
|
2949
|
+
readonly guards: {
|
|
2950
|
+
"step-start": (u: unknown) => u is {
|
|
2951
|
+
readonly type: "step-start";
|
|
2952
|
+
readonly index: number;
|
|
2953
|
+
};
|
|
2954
|
+
"text-start": (u: unknown) => u is {
|
|
2955
|
+
readonly type: "text-start";
|
|
2956
|
+
readonly id: string;
|
|
2957
|
+
readonly providerMetadata?: {
|
|
2958
|
+
readonly [x: string]: {
|
|
2959
|
+
readonly [x: string]: unknown;
|
|
2960
|
+
};
|
|
2961
|
+
} | undefined;
|
|
2962
|
+
};
|
|
2963
|
+
"text-delta": (u: unknown) => u is {
|
|
2964
|
+
readonly type: "text-delta";
|
|
2965
|
+
readonly id: string;
|
|
2966
|
+
readonly text: string;
|
|
2967
|
+
readonly providerMetadata?: {
|
|
2968
|
+
readonly [x: string]: {
|
|
2969
|
+
readonly [x: string]: unknown;
|
|
2970
|
+
};
|
|
2971
|
+
} | undefined;
|
|
2972
|
+
};
|
|
2973
|
+
"text-end": (u: unknown) => u is {
|
|
2974
|
+
readonly type: "text-end";
|
|
2975
|
+
readonly id: string;
|
|
2976
|
+
readonly providerMetadata?: {
|
|
2977
|
+
readonly [x: string]: {
|
|
2978
|
+
readonly [x: string]: unknown;
|
|
2979
|
+
};
|
|
2980
|
+
} | undefined;
|
|
2981
|
+
};
|
|
2982
|
+
"reasoning-start": (u: unknown) => u is {
|
|
2983
|
+
readonly type: "reasoning-start";
|
|
2984
|
+
readonly id: string;
|
|
2985
|
+
readonly providerMetadata?: {
|
|
2986
|
+
readonly [x: string]: {
|
|
2987
|
+
readonly [x: string]: unknown;
|
|
2988
|
+
};
|
|
2989
|
+
} | undefined;
|
|
2990
|
+
};
|
|
2991
|
+
"reasoning-delta": (u: unknown) => u is {
|
|
2992
|
+
readonly type: "reasoning-delta";
|
|
2993
|
+
readonly id: string;
|
|
2994
|
+
readonly text: string;
|
|
2995
|
+
readonly providerMetadata?: {
|
|
2996
|
+
readonly [x: string]: {
|
|
2997
|
+
readonly [x: string]: unknown;
|
|
2998
|
+
};
|
|
2999
|
+
} | undefined;
|
|
3000
|
+
};
|
|
3001
|
+
"reasoning-end": (u: unknown) => u is {
|
|
3002
|
+
readonly type: "reasoning-end";
|
|
3003
|
+
readonly id: string;
|
|
3004
|
+
readonly providerMetadata?: {
|
|
3005
|
+
readonly [x: string]: {
|
|
3006
|
+
readonly [x: string]: unknown;
|
|
3007
|
+
};
|
|
3008
|
+
} | undefined;
|
|
3009
|
+
};
|
|
3010
|
+
"tool-input-start": (u: unknown) => u is {
|
|
3011
|
+
readonly type: "tool-input-start";
|
|
3012
|
+
readonly id: string;
|
|
3013
|
+
readonly name: string;
|
|
3014
|
+
readonly providerMetadata?: {
|
|
3015
|
+
readonly [x: string]: {
|
|
3016
|
+
readonly [x: string]: unknown;
|
|
3017
|
+
};
|
|
3018
|
+
} | undefined;
|
|
3019
|
+
};
|
|
3020
|
+
"tool-input-delta": (u: unknown) => u is {
|
|
3021
|
+
readonly type: "tool-input-delta";
|
|
3022
|
+
readonly id: string;
|
|
3023
|
+
readonly name: string;
|
|
3024
|
+
readonly text: string;
|
|
3025
|
+
};
|
|
3026
|
+
"tool-input-end": (u: unknown) => u is {
|
|
3027
|
+
readonly type: "tool-input-end";
|
|
3028
|
+
readonly id: string;
|
|
3029
|
+
readonly name: string;
|
|
3030
|
+
readonly providerMetadata?: {
|
|
3031
|
+
readonly [x: string]: {
|
|
3032
|
+
readonly [x: string]: unknown;
|
|
3033
|
+
};
|
|
3034
|
+
} | undefined;
|
|
3035
|
+
};
|
|
3036
|
+
"tool-call": (u: unknown) => u is {
|
|
3037
|
+
readonly type: "tool-call";
|
|
3038
|
+
readonly id: string;
|
|
3039
|
+
readonly name: string;
|
|
3040
|
+
readonly input: unknown;
|
|
3041
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3042
|
+
readonly providerMetadata?: {
|
|
3043
|
+
readonly [x: string]: {
|
|
3044
|
+
readonly [x: string]: unknown;
|
|
3045
|
+
};
|
|
3046
|
+
} | undefined;
|
|
3047
|
+
};
|
|
3048
|
+
"tool-result": (u: unknown) => u is {
|
|
3049
|
+
readonly type: "tool-result";
|
|
3050
|
+
readonly id: string;
|
|
3051
|
+
readonly name: string;
|
|
3052
|
+
readonly result: {
|
|
3053
|
+
readonly type: "json";
|
|
3054
|
+
readonly value: unknown;
|
|
3055
|
+
} | {
|
|
3056
|
+
readonly type: "text";
|
|
3057
|
+
readonly value: unknown;
|
|
3058
|
+
} | {
|
|
3059
|
+
readonly type: "error";
|
|
3060
|
+
readonly value: unknown;
|
|
3061
|
+
} | {
|
|
3062
|
+
readonly type: "content";
|
|
3063
|
+
readonly value: readonly ({
|
|
3064
|
+
readonly type: "text";
|
|
3065
|
+
readonly text: string;
|
|
3066
|
+
} | {
|
|
3067
|
+
readonly type: "file";
|
|
3068
|
+
readonly uri: string;
|
|
3069
|
+
readonly mime: string;
|
|
3070
|
+
readonly name?: string | undefined;
|
|
3071
|
+
})[];
|
|
3072
|
+
};
|
|
3073
|
+
readonly output?: {
|
|
3074
|
+
readonly structured: unknown;
|
|
3075
|
+
readonly content: readonly ({
|
|
3076
|
+
readonly type: "text";
|
|
3077
|
+
readonly text: string;
|
|
3078
|
+
} | {
|
|
3079
|
+
readonly type: "file";
|
|
3080
|
+
readonly uri: string;
|
|
3081
|
+
readonly mime: string;
|
|
3082
|
+
readonly name?: string | undefined;
|
|
3083
|
+
})[];
|
|
3084
|
+
} | undefined;
|
|
3085
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3086
|
+
readonly providerMetadata?: {
|
|
3087
|
+
readonly [x: string]: {
|
|
3088
|
+
readonly [x: string]: unknown;
|
|
3089
|
+
};
|
|
3090
|
+
} | undefined;
|
|
3091
|
+
};
|
|
3092
|
+
"tool-error": (u: unknown) => u is {
|
|
3093
|
+
readonly type: "tool-error";
|
|
3094
|
+
readonly id: string;
|
|
3095
|
+
readonly name: string;
|
|
3096
|
+
readonly message: string;
|
|
3097
|
+
readonly error?: unknown;
|
|
3098
|
+
readonly providerMetadata?: {
|
|
3099
|
+
readonly [x: string]: {
|
|
3100
|
+
readonly [x: string]: unknown;
|
|
3101
|
+
};
|
|
3102
|
+
} | undefined;
|
|
3103
|
+
};
|
|
3104
|
+
"step-finish": (u: unknown) => u is {
|
|
3105
|
+
readonly type: "step-finish";
|
|
3106
|
+
readonly index: number;
|
|
3107
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3108
|
+
readonly usage?: Usage | undefined;
|
|
3109
|
+
readonly providerMetadata?: {
|
|
3110
|
+
readonly [x: string]: {
|
|
3111
|
+
readonly [x: string]: unknown;
|
|
3112
|
+
};
|
|
3113
|
+
} | undefined;
|
|
3114
|
+
};
|
|
3115
|
+
finish: (u: unknown) => u is {
|
|
3116
|
+
readonly type: "finish";
|
|
3117
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3118
|
+
readonly usage?: Usage | undefined;
|
|
3119
|
+
readonly providerMetadata?: {
|
|
3120
|
+
readonly [x: string]: {
|
|
3121
|
+
readonly [x: string]: unknown;
|
|
3122
|
+
};
|
|
3123
|
+
} | undefined;
|
|
3124
|
+
};
|
|
3125
|
+
"provider-error": (u: unknown) => u is {
|
|
3126
|
+
readonly type: "provider-error";
|
|
3127
|
+
readonly message: string;
|
|
3128
|
+
readonly classification?: "context-overflow" | undefined;
|
|
3129
|
+
readonly providerMetadata?: {
|
|
3130
|
+
readonly [x: string]: {
|
|
3131
|
+
readonly [x: string]: unknown;
|
|
3132
|
+
};
|
|
3133
|
+
} | undefined;
|
|
3134
|
+
};
|
|
3135
|
+
};
|
|
3136
|
+
readonly match: {
|
|
3137
|
+
<Cases extends {
|
|
3138
|
+
"step-start": (value: {
|
|
3139
|
+
readonly type: "step-start";
|
|
3140
|
+
readonly index: number;
|
|
3141
|
+
}) => any;
|
|
3142
|
+
"text-start": (value: {
|
|
3143
|
+
readonly type: "text-start";
|
|
3144
|
+
readonly id: string;
|
|
3145
|
+
readonly providerMetadata?: {
|
|
3146
|
+
readonly [x: string]: {
|
|
3147
|
+
readonly [x: string]: unknown;
|
|
3148
|
+
};
|
|
3149
|
+
} | undefined;
|
|
3150
|
+
}) => any;
|
|
3151
|
+
"text-delta": (value: {
|
|
3152
|
+
readonly type: "text-delta";
|
|
3153
|
+
readonly id: string;
|
|
3154
|
+
readonly text: string;
|
|
3155
|
+
readonly providerMetadata?: {
|
|
3156
|
+
readonly [x: string]: {
|
|
3157
|
+
readonly [x: string]: unknown;
|
|
3158
|
+
};
|
|
3159
|
+
} | undefined;
|
|
3160
|
+
}) => any;
|
|
3161
|
+
"text-end": (value: {
|
|
3162
|
+
readonly type: "text-end";
|
|
3163
|
+
readonly id: string;
|
|
3164
|
+
readonly providerMetadata?: {
|
|
3165
|
+
readonly [x: string]: {
|
|
3166
|
+
readonly [x: string]: unknown;
|
|
3167
|
+
};
|
|
3168
|
+
} | undefined;
|
|
3169
|
+
}) => any;
|
|
3170
|
+
"reasoning-start": (value: {
|
|
3171
|
+
readonly type: "reasoning-start";
|
|
3172
|
+
readonly id: string;
|
|
3173
|
+
readonly providerMetadata?: {
|
|
3174
|
+
readonly [x: string]: {
|
|
3175
|
+
readonly [x: string]: unknown;
|
|
3176
|
+
};
|
|
3177
|
+
} | undefined;
|
|
3178
|
+
}) => any;
|
|
3179
|
+
"reasoning-delta": (value: {
|
|
3180
|
+
readonly type: "reasoning-delta";
|
|
3181
|
+
readonly id: string;
|
|
3182
|
+
readonly text: string;
|
|
3183
|
+
readonly providerMetadata?: {
|
|
3184
|
+
readonly [x: string]: {
|
|
3185
|
+
readonly [x: string]: unknown;
|
|
3186
|
+
};
|
|
3187
|
+
} | undefined;
|
|
3188
|
+
}) => any;
|
|
3189
|
+
"reasoning-end": (value: {
|
|
3190
|
+
readonly type: "reasoning-end";
|
|
3191
|
+
readonly id: string;
|
|
3192
|
+
readonly providerMetadata?: {
|
|
3193
|
+
readonly [x: string]: {
|
|
3194
|
+
readonly [x: string]: unknown;
|
|
3195
|
+
};
|
|
3196
|
+
} | undefined;
|
|
3197
|
+
}) => any;
|
|
3198
|
+
"tool-input-start": (value: {
|
|
3199
|
+
readonly type: "tool-input-start";
|
|
3200
|
+
readonly id: string;
|
|
3201
|
+
readonly name: string;
|
|
3202
|
+
readonly providerMetadata?: {
|
|
3203
|
+
readonly [x: string]: {
|
|
3204
|
+
readonly [x: string]: unknown;
|
|
3205
|
+
};
|
|
3206
|
+
} | undefined;
|
|
3207
|
+
}) => any;
|
|
3208
|
+
"tool-input-delta": (value: {
|
|
3209
|
+
readonly type: "tool-input-delta";
|
|
3210
|
+
readonly id: string;
|
|
3211
|
+
readonly name: string;
|
|
3212
|
+
readonly text: string;
|
|
3213
|
+
}) => any;
|
|
3214
|
+
"tool-input-end": (value: {
|
|
3215
|
+
readonly type: "tool-input-end";
|
|
3216
|
+
readonly id: string;
|
|
3217
|
+
readonly name: string;
|
|
3218
|
+
readonly providerMetadata?: {
|
|
3219
|
+
readonly [x: string]: {
|
|
3220
|
+
readonly [x: string]: unknown;
|
|
3221
|
+
};
|
|
3222
|
+
} | undefined;
|
|
3223
|
+
}) => any;
|
|
3224
|
+
"tool-call": (value: {
|
|
3225
|
+
readonly type: "tool-call";
|
|
3226
|
+
readonly id: string;
|
|
3227
|
+
readonly name: string;
|
|
3228
|
+
readonly input: unknown;
|
|
3229
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3230
|
+
readonly providerMetadata?: {
|
|
3231
|
+
readonly [x: string]: {
|
|
3232
|
+
readonly [x: string]: unknown;
|
|
3233
|
+
};
|
|
3234
|
+
} | undefined;
|
|
3235
|
+
}) => any;
|
|
3236
|
+
"tool-result": (value: {
|
|
3237
|
+
readonly type: "tool-result";
|
|
3238
|
+
readonly id: string;
|
|
3239
|
+
readonly name: string;
|
|
3240
|
+
readonly result: {
|
|
3241
|
+
readonly type: "json";
|
|
3242
|
+
readonly value: unknown;
|
|
3243
|
+
} | {
|
|
3244
|
+
readonly type: "text";
|
|
3245
|
+
readonly value: unknown;
|
|
3246
|
+
} | {
|
|
3247
|
+
readonly type: "error";
|
|
3248
|
+
readonly value: unknown;
|
|
3249
|
+
} | {
|
|
3250
|
+
readonly type: "content";
|
|
3251
|
+
readonly value: readonly ({
|
|
3252
|
+
readonly type: "text";
|
|
3253
|
+
readonly text: string;
|
|
3254
|
+
} | {
|
|
3255
|
+
readonly type: "file";
|
|
3256
|
+
readonly uri: string;
|
|
3257
|
+
readonly mime: string;
|
|
3258
|
+
readonly name?: string | undefined;
|
|
3259
|
+
})[];
|
|
3260
|
+
};
|
|
3261
|
+
readonly output?: {
|
|
3262
|
+
readonly structured: unknown;
|
|
3263
|
+
readonly content: readonly ({
|
|
3264
|
+
readonly type: "text";
|
|
3265
|
+
readonly text: string;
|
|
3266
|
+
} | {
|
|
3267
|
+
readonly type: "file";
|
|
3268
|
+
readonly uri: string;
|
|
3269
|
+
readonly mime: string;
|
|
3270
|
+
readonly name?: string | undefined;
|
|
3271
|
+
})[];
|
|
3272
|
+
} | undefined;
|
|
3273
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3274
|
+
readonly providerMetadata?: {
|
|
3275
|
+
readonly [x: string]: {
|
|
3276
|
+
readonly [x: string]: unknown;
|
|
3277
|
+
};
|
|
3278
|
+
} | undefined;
|
|
3279
|
+
}) => any;
|
|
3280
|
+
"tool-error": (value: {
|
|
3281
|
+
readonly type: "tool-error";
|
|
3282
|
+
readonly id: string;
|
|
3283
|
+
readonly name: string;
|
|
3284
|
+
readonly message: string;
|
|
3285
|
+
readonly error?: unknown;
|
|
3286
|
+
readonly providerMetadata?: {
|
|
3287
|
+
readonly [x: string]: {
|
|
3288
|
+
readonly [x: string]: unknown;
|
|
3289
|
+
};
|
|
3290
|
+
} | undefined;
|
|
3291
|
+
}) => any;
|
|
3292
|
+
"step-finish": (value: {
|
|
3293
|
+
readonly type: "step-finish";
|
|
3294
|
+
readonly index: number;
|
|
3295
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3296
|
+
readonly usage?: Usage | undefined;
|
|
3297
|
+
readonly providerMetadata?: {
|
|
3298
|
+
readonly [x: string]: {
|
|
3299
|
+
readonly [x: string]: unknown;
|
|
3300
|
+
};
|
|
3301
|
+
} | undefined;
|
|
3302
|
+
}) => any;
|
|
3303
|
+
finish: (value: {
|
|
3304
|
+
readonly type: "finish";
|
|
3305
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3306
|
+
readonly usage?: Usage | undefined;
|
|
3307
|
+
readonly providerMetadata?: {
|
|
3308
|
+
readonly [x: string]: {
|
|
3309
|
+
readonly [x: string]: unknown;
|
|
3310
|
+
};
|
|
3311
|
+
} | undefined;
|
|
3312
|
+
}) => any;
|
|
3313
|
+
"provider-error": (value: {
|
|
3314
|
+
readonly type: "provider-error";
|
|
3315
|
+
readonly message: string;
|
|
3316
|
+
readonly classification?: "context-overflow" | undefined;
|
|
3317
|
+
readonly providerMetadata?: {
|
|
3318
|
+
readonly [x: string]: {
|
|
3319
|
+
readonly [x: string]: unknown;
|
|
3320
|
+
};
|
|
3321
|
+
} | undefined;
|
|
3322
|
+
}) => any;
|
|
3323
|
+
}>(value: {
|
|
3324
|
+
readonly type: "step-start";
|
|
3325
|
+
readonly index: number;
|
|
3326
|
+
} | {
|
|
3327
|
+
readonly type: "text-start";
|
|
3328
|
+
readonly id: string;
|
|
3329
|
+
readonly providerMetadata?: {
|
|
3330
|
+
readonly [x: string]: {
|
|
3331
|
+
readonly [x: string]: unknown;
|
|
3332
|
+
};
|
|
3333
|
+
} | undefined;
|
|
3334
|
+
} | {
|
|
3335
|
+
readonly type: "text-delta";
|
|
3336
|
+
readonly id: string;
|
|
3337
|
+
readonly text: string;
|
|
3338
|
+
readonly providerMetadata?: {
|
|
3339
|
+
readonly [x: string]: {
|
|
3340
|
+
readonly [x: string]: unknown;
|
|
3341
|
+
};
|
|
3342
|
+
} | undefined;
|
|
3343
|
+
} | {
|
|
3344
|
+
readonly type: "text-end";
|
|
3345
|
+
readonly id: string;
|
|
3346
|
+
readonly providerMetadata?: {
|
|
3347
|
+
readonly [x: string]: {
|
|
3348
|
+
readonly [x: string]: unknown;
|
|
3349
|
+
};
|
|
3350
|
+
} | undefined;
|
|
3351
|
+
} | {
|
|
3352
|
+
readonly type: "reasoning-start";
|
|
3353
|
+
readonly id: string;
|
|
3354
|
+
readonly providerMetadata?: {
|
|
3355
|
+
readonly [x: string]: {
|
|
3356
|
+
readonly [x: string]: unknown;
|
|
3357
|
+
};
|
|
3358
|
+
} | undefined;
|
|
3359
|
+
} | {
|
|
3360
|
+
readonly type: "reasoning-delta";
|
|
3361
|
+
readonly id: string;
|
|
3362
|
+
readonly text: string;
|
|
3363
|
+
readonly providerMetadata?: {
|
|
3364
|
+
readonly [x: string]: {
|
|
3365
|
+
readonly [x: string]: unknown;
|
|
3366
|
+
};
|
|
3367
|
+
} | undefined;
|
|
3368
|
+
} | {
|
|
3369
|
+
readonly type: "reasoning-end";
|
|
3370
|
+
readonly id: string;
|
|
3371
|
+
readonly providerMetadata?: {
|
|
3372
|
+
readonly [x: string]: {
|
|
3373
|
+
readonly [x: string]: unknown;
|
|
3374
|
+
};
|
|
3375
|
+
} | undefined;
|
|
3376
|
+
} | {
|
|
3377
|
+
readonly type: "tool-input-start";
|
|
3378
|
+
readonly id: string;
|
|
3379
|
+
readonly name: string;
|
|
3380
|
+
readonly providerMetadata?: {
|
|
3381
|
+
readonly [x: string]: {
|
|
3382
|
+
readonly [x: string]: unknown;
|
|
3383
|
+
};
|
|
3384
|
+
} | undefined;
|
|
3385
|
+
} | {
|
|
3386
|
+
readonly type: "tool-input-delta";
|
|
3387
|
+
readonly id: string;
|
|
3388
|
+
readonly name: string;
|
|
3389
|
+
readonly text: string;
|
|
3390
|
+
} | {
|
|
3391
|
+
readonly type: "tool-input-end";
|
|
3392
|
+
readonly id: string;
|
|
3393
|
+
readonly name: string;
|
|
3394
|
+
readonly providerMetadata?: {
|
|
3395
|
+
readonly [x: string]: {
|
|
3396
|
+
readonly [x: string]: unknown;
|
|
3397
|
+
};
|
|
3398
|
+
} | undefined;
|
|
3399
|
+
} | {
|
|
3400
|
+
readonly type: "tool-call";
|
|
3401
|
+
readonly id: string;
|
|
3402
|
+
readonly name: string;
|
|
3403
|
+
readonly input: unknown;
|
|
3404
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3405
|
+
readonly providerMetadata?: {
|
|
3406
|
+
readonly [x: string]: {
|
|
3407
|
+
readonly [x: string]: unknown;
|
|
3408
|
+
};
|
|
3409
|
+
} | undefined;
|
|
3410
|
+
} | {
|
|
3411
|
+
readonly type: "tool-result";
|
|
3412
|
+
readonly id: string;
|
|
3413
|
+
readonly name: string;
|
|
3414
|
+
readonly result: {
|
|
3415
|
+
readonly type: "json";
|
|
3416
|
+
readonly value: unknown;
|
|
3417
|
+
} | {
|
|
3418
|
+
readonly type: "text";
|
|
3419
|
+
readonly value: unknown;
|
|
3420
|
+
} | {
|
|
3421
|
+
readonly type: "error";
|
|
3422
|
+
readonly value: unknown;
|
|
3423
|
+
} | {
|
|
3424
|
+
readonly type: "content";
|
|
3425
|
+
readonly value: readonly ({
|
|
3426
|
+
readonly type: "text";
|
|
3427
|
+
readonly text: string;
|
|
3428
|
+
} | {
|
|
3429
|
+
readonly type: "file";
|
|
3430
|
+
readonly uri: string;
|
|
3431
|
+
readonly mime: string;
|
|
3432
|
+
readonly name?: string | undefined;
|
|
3433
|
+
})[];
|
|
3434
|
+
};
|
|
3435
|
+
readonly output?: {
|
|
3436
|
+
readonly structured: unknown;
|
|
3437
|
+
readonly content: readonly ({
|
|
3438
|
+
readonly type: "text";
|
|
3439
|
+
readonly text: string;
|
|
3440
|
+
} | {
|
|
3441
|
+
readonly type: "file";
|
|
3442
|
+
readonly uri: string;
|
|
3443
|
+
readonly mime: string;
|
|
3444
|
+
readonly name?: string | undefined;
|
|
3445
|
+
})[];
|
|
3446
|
+
} | undefined;
|
|
3447
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3448
|
+
readonly providerMetadata?: {
|
|
3449
|
+
readonly [x: string]: {
|
|
3450
|
+
readonly [x: string]: unknown;
|
|
3451
|
+
};
|
|
3452
|
+
} | undefined;
|
|
3453
|
+
} | {
|
|
3454
|
+
readonly type: "tool-error";
|
|
3455
|
+
readonly id: string;
|
|
3456
|
+
readonly name: string;
|
|
3457
|
+
readonly message: string;
|
|
3458
|
+
readonly error?: unknown;
|
|
3459
|
+
readonly providerMetadata?: {
|
|
3460
|
+
readonly [x: string]: {
|
|
3461
|
+
readonly [x: string]: unknown;
|
|
3462
|
+
};
|
|
3463
|
+
} | undefined;
|
|
3464
|
+
} | {
|
|
3465
|
+
readonly type: "step-finish";
|
|
3466
|
+
readonly index: number;
|
|
3467
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3468
|
+
readonly usage?: Usage | undefined;
|
|
3469
|
+
readonly providerMetadata?: {
|
|
3470
|
+
readonly [x: string]: {
|
|
3471
|
+
readonly [x: string]: unknown;
|
|
3472
|
+
};
|
|
3473
|
+
} | undefined;
|
|
3474
|
+
} | {
|
|
3475
|
+
readonly type: "finish";
|
|
3476
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3477
|
+
readonly usage?: Usage | undefined;
|
|
3478
|
+
readonly providerMetadata?: {
|
|
3479
|
+
readonly [x: string]: {
|
|
3480
|
+
readonly [x: string]: unknown;
|
|
3481
|
+
};
|
|
3482
|
+
} | undefined;
|
|
3483
|
+
} | {
|
|
3484
|
+
readonly type: "provider-error";
|
|
3485
|
+
readonly message: string;
|
|
3486
|
+
readonly classification?: "context-overflow" | undefined;
|
|
3487
|
+
readonly providerMetadata?: {
|
|
3488
|
+
readonly [x: string]: {
|
|
3489
|
+
readonly [x: string]: unknown;
|
|
3490
|
+
};
|
|
3491
|
+
} | undefined;
|
|
3492
|
+
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
3493
|
+
<Cases extends {
|
|
3494
|
+
"step-start": (value: {
|
|
3495
|
+
readonly type: "step-start";
|
|
3496
|
+
readonly index: number;
|
|
3497
|
+
}) => any;
|
|
3498
|
+
"text-start": (value: {
|
|
3499
|
+
readonly type: "text-start";
|
|
3500
|
+
readonly id: string;
|
|
3501
|
+
readonly providerMetadata?: {
|
|
3502
|
+
readonly [x: string]: {
|
|
3503
|
+
readonly [x: string]: unknown;
|
|
3504
|
+
};
|
|
3505
|
+
} | undefined;
|
|
3506
|
+
}) => any;
|
|
3507
|
+
"text-delta": (value: {
|
|
3508
|
+
readonly type: "text-delta";
|
|
3509
|
+
readonly id: string;
|
|
3510
|
+
readonly text: string;
|
|
3511
|
+
readonly providerMetadata?: {
|
|
3512
|
+
readonly [x: string]: {
|
|
3513
|
+
readonly [x: string]: unknown;
|
|
3514
|
+
};
|
|
3515
|
+
} | undefined;
|
|
3516
|
+
}) => any;
|
|
3517
|
+
"text-end": (value: {
|
|
3518
|
+
readonly type: "text-end";
|
|
3519
|
+
readonly id: string;
|
|
3520
|
+
readonly providerMetadata?: {
|
|
3521
|
+
readonly [x: string]: {
|
|
3522
|
+
readonly [x: string]: unknown;
|
|
3523
|
+
};
|
|
3524
|
+
} | undefined;
|
|
3525
|
+
}) => any;
|
|
3526
|
+
"reasoning-start": (value: {
|
|
3527
|
+
readonly type: "reasoning-start";
|
|
3528
|
+
readonly id: string;
|
|
3529
|
+
readonly providerMetadata?: {
|
|
3530
|
+
readonly [x: string]: {
|
|
3531
|
+
readonly [x: string]: unknown;
|
|
3532
|
+
};
|
|
3533
|
+
} | undefined;
|
|
3534
|
+
}) => any;
|
|
3535
|
+
"reasoning-delta": (value: {
|
|
3536
|
+
readonly type: "reasoning-delta";
|
|
3537
|
+
readonly id: string;
|
|
3538
|
+
readonly text: string;
|
|
3539
|
+
readonly providerMetadata?: {
|
|
3540
|
+
readonly [x: string]: {
|
|
3541
|
+
readonly [x: string]: unknown;
|
|
3542
|
+
};
|
|
3543
|
+
} | undefined;
|
|
3544
|
+
}) => any;
|
|
3545
|
+
"reasoning-end": (value: {
|
|
3546
|
+
readonly type: "reasoning-end";
|
|
3547
|
+
readonly id: string;
|
|
3548
|
+
readonly providerMetadata?: {
|
|
3549
|
+
readonly [x: string]: {
|
|
3550
|
+
readonly [x: string]: unknown;
|
|
3551
|
+
};
|
|
3552
|
+
} | undefined;
|
|
3553
|
+
}) => any;
|
|
3554
|
+
"tool-input-start": (value: {
|
|
3555
|
+
readonly type: "tool-input-start";
|
|
3556
|
+
readonly id: string;
|
|
3557
|
+
readonly name: string;
|
|
3558
|
+
readonly providerMetadata?: {
|
|
3559
|
+
readonly [x: string]: {
|
|
3560
|
+
readonly [x: string]: unknown;
|
|
3561
|
+
};
|
|
3562
|
+
} | undefined;
|
|
3563
|
+
}) => any;
|
|
3564
|
+
"tool-input-delta": (value: {
|
|
3565
|
+
readonly type: "tool-input-delta";
|
|
3566
|
+
readonly id: string;
|
|
3567
|
+
readonly name: string;
|
|
3568
|
+
readonly text: string;
|
|
3569
|
+
}) => any;
|
|
3570
|
+
"tool-input-end": (value: {
|
|
3571
|
+
readonly type: "tool-input-end";
|
|
3572
|
+
readonly id: string;
|
|
3573
|
+
readonly name: string;
|
|
3574
|
+
readonly providerMetadata?: {
|
|
3575
|
+
readonly [x: string]: {
|
|
3576
|
+
readonly [x: string]: unknown;
|
|
3577
|
+
};
|
|
3578
|
+
} | undefined;
|
|
3579
|
+
}) => any;
|
|
3580
|
+
"tool-call": (value: {
|
|
3581
|
+
readonly type: "tool-call";
|
|
3582
|
+
readonly id: string;
|
|
3583
|
+
readonly name: string;
|
|
3584
|
+
readonly input: unknown;
|
|
3585
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3586
|
+
readonly providerMetadata?: {
|
|
3587
|
+
readonly [x: string]: {
|
|
3588
|
+
readonly [x: string]: unknown;
|
|
3589
|
+
};
|
|
3590
|
+
} | undefined;
|
|
3591
|
+
}) => any;
|
|
3592
|
+
"tool-result": (value: {
|
|
3593
|
+
readonly type: "tool-result";
|
|
3594
|
+
readonly id: string;
|
|
3595
|
+
readonly name: string;
|
|
3596
|
+
readonly result: {
|
|
3597
|
+
readonly type: "json";
|
|
3598
|
+
readonly value: unknown;
|
|
3599
|
+
} | {
|
|
3600
|
+
readonly type: "text";
|
|
3601
|
+
readonly value: unknown;
|
|
3602
|
+
} | {
|
|
3603
|
+
readonly type: "error";
|
|
3604
|
+
readonly value: unknown;
|
|
3605
|
+
} | {
|
|
3606
|
+
readonly type: "content";
|
|
3607
|
+
readonly value: readonly ({
|
|
3608
|
+
readonly type: "text";
|
|
3609
|
+
readonly text: string;
|
|
3610
|
+
} | {
|
|
3611
|
+
readonly type: "file";
|
|
3612
|
+
readonly uri: string;
|
|
3613
|
+
readonly mime: string;
|
|
3614
|
+
readonly name?: string | undefined;
|
|
3615
|
+
})[];
|
|
3616
|
+
};
|
|
3617
|
+
readonly output?: {
|
|
3618
|
+
readonly structured: unknown;
|
|
3619
|
+
readonly content: readonly ({
|
|
3620
|
+
readonly type: "text";
|
|
3621
|
+
readonly text: string;
|
|
3622
|
+
} | {
|
|
3623
|
+
readonly type: "file";
|
|
3624
|
+
readonly uri: string;
|
|
3625
|
+
readonly mime: string;
|
|
3626
|
+
readonly name?: string | undefined;
|
|
3627
|
+
})[];
|
|
3628
|
+
} | undefined;
|
|
3629
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3630
|
+
readonly providerMetadata?: {
|
|
3631
|
+
readonly [x: string]: {
|
|
3632
|
+
readonly [x: string]: unknown;
|
|
3633
|
+
};
|
|
3634
|
+
} | undefined;
|
|
3635
|
+
}) => any;
|
|
3636
|
+
"tool-error": (value: {
|
|
3637
|
+
readonly type: "tool-error";
|
|
3638
|
+
readonly id: string;
|
|
3639
|
+
readonly name: string;
|
|
3640
|
+
readonly message: string;
|
|
3641
|
+
readonly error?: unknown;
|
|
3642
|
+
readonly providerMetadata?: {
|
|
3643
|
+
readonly [x: string]: {
|
|
3644
|
+
readonly [x: string]: unknown;
|
|
3645
|
+
};
|
|
3646
|
+
} | undefined;
|
|
3647
|
+
}) => any;
|
|
3648
|
+
"step-finish": (value: {
|
|
3649
|
+
readonly type: "step-finish";
|
|
3650
|
+
readonly index: number;
|
|
3651
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3652
|
+
readonly usage?: Usage | undefined;
|
|
3653
|
+
readonly providerMetadata?: {
|
|
3654
|
+
readonly [x: string]: {
|
|
3655
|
+
readonly [x: string]: unknown;
|
|
3656
|
+
};
|
|
3657
|
+
} | undefined;
|
|
3658
|
+
}) => any;
|
|
3659
|
+
finish: (value: {
|
|
3660
|
+
readonly type: "finish";
|
|
3661
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3662
|
+
readonly usage?: Usage | undefined;
|
|
3663
|
+
readonly providerMetadata?: {
|
|
3664
|
+
readonly [x: string]: {
|
|
3665
|
+
readonly [x: string]: unknown;
|
|
3666
|
+
};
|
|
3667
|
+
} | undefined;
|
|
3668
|
+
}) => any;
|
|
3669
|
+
"provider-error": (value: {
|
|
3670
|
+
readonly type: "provider-error";
|
|
3671
|
+
readonly message: string;
|
|
3672
|
+
readonly classification?: "context-overflow" | undefined;
|
|
3673
|
+
readonly providerMetadata?: {
|
|
3674
|
+
readonly [x: string]: {
|
|
3675
|
+
readonly [x: string]: unknown;
|
|
3676
|
+
};
|
|
3677
|
+
} | undefined;
|
|
3678
|
+
}) => any;
|
|
3679
|
+
}>(cases: Cases): (value: {
|
|
3680
|
+
readonly type: "step-start";
|
|
3681
|
+
readonly index: number;
|
|
3682
|
+
} | {
|
|
3683
|
+
readonly type: "text-start";
|
|
3684
|
+
readonly id: string;
|
|
3685
|
+
readonly providerMetadata?: {
|
|
3686
|
+
readonly [x: string]: {
|
|
3687
|
+
readonly [x: string]: unknown;
|
|
3688
|
+
};
|
|
3689
|
+
} | undefined;
|
|
3690
|
+
} | {
|
|
3691
|
+
readonly type: "text-delta";
|
|
3692
|
+
readonly id: string;
|
|
3693
|
+
readonly text: string;
|
|
3694
|
+
readonly providerMetadata?: {
|
|
3695
|
+
readonly [x: string]: {
|
|
3696
|
+
readonly [x: string]: unknown;
|
|
3697
|
+
};
|
|
3698
|
+
} | undefined;
|
|
3699
|
+
} | {
|
|
3700
|
+
readonly type: "text-end";
|
|
3701
|
+
readonly id: string;
|
|
3702
|
+
readonly providerMetadata?: {
|
|
3703
|
+
readonly [x: string]: {
|
|
3704
|
+
readonly [x: string]: unknown;
|
|
3705
|
+
};
|
|
3706
|
+
} | undefined;
|
|
3707
|
+
} | {
|
|
3708
|
+
readonly type: "reasoning-start";
|
|
3709
|
+
readonly id: string;
|
|
3710
|
+
readonly providerMetadata?: {
|
|
3711
|
+
readonly [x: string]: {
|
|
3712
|
+
readonly [x: string]: unknown;
|
|
3713
|
+
};
|
|
3714
|
+
} | undefined;
|
|
3715
|
+
} | {
|
|
3716
|
+
readonly type: "reasoning-delta";
|
|
3717
|
+
readonly id: string;
|
|
3718
|
+
readonly text: string;
|
|
3719
|
+
readonly providerMetadata?: {
|
|
3720
|
+
readonly [x: string]: {
|
|
3721
|
+
readonly [x: string]: unknown;
|
|
3722
|
+
};
|
|
3723
|
+
} | undefined;
|
|
3724
|
+
} | {
|
|
3725
|
+
readonly type: "reasoning-end";
|
|
3726
|
+
readonly id: string;
|
|
3727
|
+
readonly providerMetadata?: {
|
|
3728
|
+
readonly [x: string]: {
|
|
3729
|
+
readonly [x: string]: unknown;
|
|
3730
|
+
};
|
|
3731
|
+
} | undefined;
|
|
3732
|
+
} | {
|
|
3733
|
+
readonly type: "tool-input-start";
|
|
3734
|
+
readonly id: string;
|
|
3735
|
+
readonly name: string;
|
|
3736
|
+
readonly providerMetadata?: {
|
|
3737
|
+
readonly [x: string]: {
|
|
3738
|
+
readonly [x: string]: unknown;
|
|
3739
|
+
};
|
|
3740
|
+
} | undefined;
|
|
3741
|
+
} | {
|
|
3742
|
+
readonly type: "tool-input-delta";
|
|
3743
|
+
readonly id: string;
|
|
3744
|
+
readonly name: string;
|
|
3745
|
+
readonly text: string;
|
|
3746
|
+
} | {
|
|
3747
|
+
readonly type: "tool-input-end";
|
|
3748
|
+
readonly id: string;
|
|
3749
|
+
readonly name: string;
|
|
3750
|
+
readonly providerMetadata?: {
|
|
3751
|
+
readonly [x: string]: {
|
|
3752
|
+
readonly [x: string]: unknown;
|
|
3753
|
+
};
|
|
3754
|
+
} | undefined;
|
|
3755
|
+
} | {
|
|
3756
|
+
readonly type: "tool-call";
|
|
3757
|
+
readonly id: string;
|
|
3758
|
+
readonly name: string;
|
|
3759
|
+
readonly input: unknown;
|
|
3760
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3761
|
+
readonly providerMetadata?: {
|
|
3762
|
+
readonly [x: string]: {
|
|
3763
|
+
readonly [x: string]: unknown;
|
|
3764
|
+
};
|
|
3765
|
+
} | undefined;
|
|
3766
|
+
} | {
|
|
3767
|
+
readonly type: "tool-result";
|
|
3768
|
+
readonly id: string;
|
|
3769
|
+
readonly name: string;
|
|
3770
|
+
readonly result: {
|
|
3771
|
+
readonly type: "json";
|
|
3772
|
+
readonly value: unknown;
|
|
3773
|
+
} | {
|
|
3774
|
+
readonly type: "text";
|
|
3775
|
+
readonly value: unknown;
|
|
3776
|
+
} | {
|
|
3777
|
+
readonly type: "error";
|
|
3778
|
+
readonly value: unknown;
|
|
3779
|
+
} | {
|
|
3780
|
+
readonly type: "content";
|
|
3781
|
+
readonly value: readonly ({
|
|
3782
|
+
readonly type: "text";
|
|
3783
|
+
readonly text: string;
|
|
3784
|
+
} | {
|
|
3785
|
+
readonly type: "file";
|
|
3786
|
+
readonly uri: string;
|
|
3787
|
+
readonly mime: string;
|
|
3788
|
+
readonly name?: string | undefined;
|
|
3789
|
+
})[];
|
|
3790
|
+
};
|
|
3791
|
+
readonly output?: {
|
|
3792
|
+
readonly structured: unknown;
|
|
3793
|
+
readonly content: readonly ({
|
|
3794
|
+
readonly type: "text";
|
|
3795
|
+
readonly text: string;
|
|
3796
|
+
} | {
|
|
3797
|
+
readonly type: "file";
|
|
3798
|
+
readonly uri: string;
|
|
3799
|
+
readonly mime: string;
|
|
3800
|
+
readonly name?: string | undefined;
|
|
3801
|
+
})[];
|
|
3802
|
+
} | undefined;
|
|
3803
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3804
|
+
readonly providerMetadata?: {
|
|
3805
|
+
readonly [x: string]: {
|
|
3806
|
+
readonly [x: string]: unknown;
|
|
3807
|
+
};
|
|
3808
|
+
} | undefined;
|
|
3809
|
+
} | {
|
|
3810
|
+
readonly type: "tool-error";
|
|
3811
|
+
readonly id: string;
|
|
3812
|
+
readonly name: string;
|
|
3813
|
+
readonly message: string;
|
|
3814
|
+
readonly error?: unknown;
|
|
3815
|
+
readonly providerMetadata?: {
|
|
3816
|
+
readonly [x: string]: {
|
|
3817
|
+
readonly [x: string]: unknown;
|
|
3818
|
+
};
|
|
3819
|
+
} | undefined;
|
|
3820
|
+
} | {
|
|
3821
|
+
readonly type: "step-finish";
|
|
3822
|
+
readonly index: number;
|
|
3823
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3824
|
+
readonly usage?: Usage | undefined;
|
|
3825
|
+
readonly providerMetadata?: {
|
|
3826
|
+
readonly [x: string]: {
|
|
3827
|
+
readonly [x: string]: unknown;
|
|
3828
|
+
};
|
|
3829
|
+
} | undefined;
|
|
3830
|
+
} | {
|
|
3831
|
+
readonly type: "finish";
|
|
3832
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
3833
|
+
readonly usage?: Usage | undefined;
|
|
3834
|
+
readonly providerMetadata?: {
|
|
3835
|
+
readonly [x: string]: {
|
|
3836
|
+
readonly [x: string]: unknown;
|
|
3837
|
+
};
|
|
3838
|
+
} | undefined;
|
|
3839
|
+
} | {
|
|
3840
|
+
readonly type: "provider-error";
|
|
3841
|
+
readonly message: string;
|
|
3842
|
+
readonly classification?: "context-overflow" | undefined;
|
|
3843
|
+
readonly providerMetadata?: {
|
|
3844
|
+
readonly [x: string]: {
|
|
3845
|
+
readonly [x: string]: unknown;
|
|
3846
|
+
};
|
|
3847
|
+
} | undefined;
|
|
3848
|
+
}) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
3849
|
+
};
|
|
3850
|
+
} & {
|
|
3851
|
+
stepStart: (input: {
|
|
3852
|
+
readonly index: number;
|
|
3853
|
+
readonly type?: "step-start" | undefined;
|
|
3854
|
+
}, options?: Schema.MakeOptions) => {
|
|
3855
|
+
readonly type: "step-start";
|
|
3856
|
+
readonly index: number;
|
|
3857
|
+
};
|
|
3858
|
+
textStart: (input: WithID<TextStart, ContentBlockID>) => {
|
|
3859
|
+
readonly type: "text-start";
|
|
3860
|
+
readonly id: string;
|
|
3861
|
+
readonly providerMetadata?: {
|
|
3862
|
+
readonly [x: string]: {
|
|
3863
|
+
readonly [x: string]: unknown;
|
|
3864
|
+
};
|
|
3865
|
+
} | undefined;
|
|
3866
|
+
};
|
|
3867
|
+
textDelta: (input: WithID<TextDelta, ContentBlockID>) => {
|
|
3868
|
+
readonly type: "text-delta";
|
|
3869
|
+
readonly id: string;
|
|
3870
|
+
readonly text: string;
|
|
3871
|
+
readonly providerMetadata?: {
|
|
3872
|
+
readonly [x: string]: {
|
|
3873
|
+
readonly [x: string]: unknown;
|
|
3874
|
+
};
|
|
3875
|
+
} | undefined;
|
|
3876
|
+
};
|
|
3877
|
+
textEnd: (input: WithID<TextEnd, ContentBlockID>) => {
|
|
3878
|
+
readonly type: "text-end";
|
|
3879
|
+
readonly id: string;
|
|
3880
|
+
readonly providerMetadata?: {
|
|
3881
|
+
readonly [x: string]: {
|
|
3882
|
+
readonly [x: string]: unknown;
|
|
3883
|
+
};
|
|
3884
|
+
} | undefined;
|
|
3885
|
+
};
|
|
3886
|
+
reasoningStart: (input: WithID<ReasoningStart, ContentBlockID>) => {
|
|
3887
|
+
readonly type: "reasoning-start";
|
|
3888
|
+
readonly id: string;
|
|
3889
|
+
readonly providerMetadata?: {
|
|
3890
|
+
readonly [x: string]: {
|
|
3891
|
+
readonly [x: string]: unknown;
|
|
3892
|
+
};
|
|
3893
|
+
} | undefined;
|
|
3894
|
+
};
|
|
3895
|
+
reasoningDelta: (input: WithID<ReasoningDelta, ContentBlockID>) => {
|
|
3896
|
+
readonly type: "reasoning-delta";
|
|
3897
|
+
readonly id: string;
|
|
3898
|
+
readonly text: string;
|
|
3899
|
+
readonly providerMetadata?: {
|
|
3900
|
+
readonly [x: string]: {
|
|
3901
|
+
readonly [x: string]: unknown;
|
|
3902
|
+
};
|
|
3903
|
+
} | undefined;
|
|
3904
|
+
};
|
|
3905
|
+
reasoningEnd: (input: WithID<ReasoningEnd, ContentBlockID>) => {
|
|
3906
|
+
readonly type: "reasoning-end";
|
|
3907
|
+
readonly id: string;
|
|
3908
|
+
readonly providerMetadata?: {
|
|
3909
|
+
readonly [x: string]: {
|
|
3910
|
+
readonly [x: string]: unknown;
|
|
3911
|
+
};
|
|
3912
|
+
} | undefined;
|
|
3913
|
+
};
|
|
3914
|
+
toolInputStart: (input: WithID<ToolInputStart, ToolCallID>) => {
|
|
3915
|
+
readonly type: "tool-input-start";
|
|
3916
|
+
readonly id: string;
|
|
3917
|
+
readonly name: string;
|
|
3918
|
+
readonly providerMetadata?: {
|
|
3919
|
+
readonly [x: string]: {
|
|
3920
|
+
readonly [x: string]: unknown;
|
|
3921
|
+
};
|
|
3922
|
+
} | undefined;
|
|
3923
|
+
};
|
|
3924
|
+
toolInputDelta: (input: WithID<ToolInputDelta, ToolCallID>) => {
|
|
3925
|
+
readonly type: "tool-input-delta";
|
|
3926
|
+
readonly id: string;
|
|
3927
|
+
readonly name: string;
|
|
3928
|
+
readonly text: string;
|
|
3929
|
+
};
|
|
3930
|
+
toolInputEnd: (input: WithID<ToolInputEnd, ToolCallID>) => {
|
|
3931
|
+
readonly type: "tool-input-end";
|
|
3932
|
+
readonly id: string;
|
|
3933
|
+
readonly name: string;
|
|
3934
|
+
readonly providerMetadata?: {
|
|
3935
|
+
readonly [x: string]: {
|
|
3936
|
+
readonly [x: string]: unknown;
|
|
3937
|
+
};
|
|
3938
|
+
} | undefined;
|
|
3939
|
+
};
|
|
3940
|
+
toolCall: (input: WithID<ToolCall, ToolCallID>) => {
|
|
3941
|
+
readonly type: "tool-call";
|
|
3942
|
+
readonly id: string;
|
|
3943
|
+
readonly name: string;
|
|
3944
|
+
readonly input: unknown;
|
|
3945
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3946
|
+
readonly providerMetadata?: {
|
|
3947
|
+
readonly [x: string]: {
|
|
3948
|
+
readonly [x: string]: unknown;
|
|
3949
|
+
};
|
|
3950
|
+
} | undefined;
|
|
3951
|
+
};
|
|
3952
|
+
toolResult: (input: WithID<ToolResult, ToolCallID>) => {
|
|
3953
|
+
readonly type: "tool-result";
|
|
3954
|
+
readonly id: string;
|
|
3955
|
+
readonly name: string;
|
|
3956
|
+
readonly result: {
|
|
3957
|
+
readonly type: "json";
|
|
3958
|
+
readonly value: unknown;
|
|
3959
|
+
} | {
|
|
3960
|
+
readonly type: "text";
|
|
3961
|
+
readonly value: unknown;
|
|
3962
|
+
} | {
|
|
3963
|
+
readonly type: "error";
|
|
3964
|
+
readonly value: unknown;
|
|
3965
|
+
} | {
|
|
3966
|
+
readonly type: "content";
|
|
3967
|
+
readonly value: readonly ({
|
|
3968
|
+
readonly type: "text";
|
|
3969
|
+
readonly text: string;
|
|
3970
|
+
} | {
|
|
3971
|
+
readonly type: "file";
|
|
3972
|
+
readonly uri: string;
|
|
3973
|
+
readonly mime: string;
|
|
3974
|
+
readonly name?: string | undefined;
|
|
3975
|
+
})[];
|
|
3976
|
+
};
|
|
3977
|
+
readonly output?: {
|
|
3978
|
+
readonly structured: unknown;
|
|
3979
|
+
readonly content: readonly ({
|
|
3980
|
+
readonly type: "text";
|
|
3981
|
+
readonly text: string;
|
|
3982
|
+
} | {
|
|
3983
|
+
readonly type: "file";
|
|
3984
|
+
readonly uri: string;
|
|
3985
|
+
readonly mime: string;
|
|
3986
|
+
readonly name?: string | undefined;
|
|
3987
|
+
})[];
|
|
3988
|
+
} | undefined;
|
|
3989
|
+
readonly providerExecuted?: boolean | undefined;
|
|
3990
|
+
readonly providerMetadata?: {
|
|
3991
|
+
readonly [x: string]: {
|
|
3992
|
+
readonly [x: string]: unknown;
|
|
3993
|
+
};
|
|
3994
|
+
} | undefined;
|
|
3995
|
+
};
|
|
3996
|
+
toolError: (input: WithID<ToolError, ToolCallID>) => {
|
|
3997
|
+
readonly type: "tool-error";
|
|
3998
|
+
readonly id: string;
|
|
3999
|
+
readonly name: string;
|
|
4000
|
+
readonly message: string;
|
|
4001
|
+
readonly error?: unknown;
|
|
4002
|
+
readonly providerMetadata?: {
|
|
4003
|
+
readonly [x: string]: {
|
|
4004
|
+
readonly [x: string]: unknown;
|
|
4005
|
+
};
|
|
4006
|
+
} | undefined;
|
|
4007
|
+
};
|
|
4008
|
+
stepFinish: (input: WithUsage<StepFinish>) => {
|
|
4009
|
+
readonly type: "step-finish";
|
|
4010
|
+
readonly index: number;
|
|
4011
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
4012
|
+
readonly usage?: Usage | undefined;
|
|
4013
|
+
readonly providerMetadata?: {
|
|
4014
|
+
readonly [x: string]: {
|
|
4015
|
+
readonly [x: string]: unknown;
|
|
4016
|
+
};
|
|
4017
|
+
} | undefined;
|
|
4018
|
+
};
|
|
4019
|
+
finish: (input: WithUsage<Finish>) => {
|
|
4020
|
+
readonly type: "finish";
|
|
4021
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
4022
|
+
readonly usage?: Usage | undefined;
|
|
4023
|
+
readonly providerMetadata?: {
|
|
4024
|
+
readonly [x: string]: {
|
|
4025
|
+
readonly [x: string]: unknown;
|
|
4026
|
+
};
|
|
4027
|
+
} | undefined;
|
|
4028
|
+
};
|
|
4029
|
+
providerError: (input: {
|
|
4030
|
+
readonly message: string;
|
|
4031
|
+
readonly type?: "provider-error" | undefined;
|
|
4032
|
+
readonly classification?: "context-overflow" | undefined;
|
|
4033
|
+
readonly providerMetadata?: {
|
|
4034
|
+
readonly [x: string]: {
|
|
4035
|
+
readonly [x: string]: unknown;
|
|
4036
|
+
};
|
|
4037
|
+
} | undefined;
|
|
4038
|
+
}, options?: Schema.MakeOptions) => {
|
|
4039
|
+
readonly type: "provider-error";
|
|
4040
|
+
readonly message: string;
|
|
4041
|
+
readonly classification?: "context-overflow" | undefined;
|
|
4042
|
+
readonly providerMetadata?: {
|
|
4043
|
+
readonly [x: string]: {
|
|
4044
|
+
readonly [x: string]: unknown;
|
|
4045
|
+
};
|
|
4046
|
+
} | undefined;
|
|
4047
|
+
};
|
|
4048
|
+
is: {
|
|
4049
|
+
stepStart: (u: unknown) => u is {
|
|
4050
|
+
readonly type: "step-start";
|
|
4051
|
+
readonly index: number;
|
|
4052
|
+
};
|
|
4053
|
+
textStart: (u: unknown) => u is {
|
|
4054
|
+
readonly type: "text-start";
|
|
4055
|
+
readonly id: string;
|
|
4056
|
+
readonly providerMetadata?: {
|
|
4057
|
+
readonly [x: string]: {
|
|
4058
|
+
readonly [x: string]: unknown;
|
|
4059
|
+
};
|
|
4060
|
+
} | undefined;
|
|
4061
|
+
};
|
|
4062
|
+
textDelta: (u: unknown) => u is {
|
|
4063
|
+
readonly type: "text-delta";
|
|
4064
|
+
readonly id: string;
|
|
4065
|
+
readonly text: string;
|
|
4066
|
+
readonly providerMetadata?: {
|
|
4067
|
+
readonly [x: string]: {
|
|
4068
|
+
readonly [x: string]: unknown;
|
|
4069
|
+
};
|
|
4070
|
+
} | undefined;
|
|
4071
|
+
};
|
|
4072
|
+
textEnd: (u: unknown) => u is {
|
|
4073
|
+
readonly type: "text-end";
|
|
4074
|
+
readonly id: string;
|
|
4075
|
+
readonly providerMetadata?: {
|
|
4076
|
+
readonly [x: string]: {
|
|
4077
|
+
readonly [x: string]: unknown;
|
|
4078
|
+
};
|
|
4079
|
+
} | undefined;
|
|
4080
|
+
};
|
|
4081
|
+
reasoningStart: (u: unknown) => u is {
|
|
4082
|
+
readonly type: "reasoning-start";
|
|
4083
|
+
readonly id: string;
|
|
4084
|
+
readonly providerMetadata?: {
|
|
4085
|
+
readonly [x: string]: {
|
|
4086
|
+
readonly [x: string]: unknown;
|
|
4087
|
+
};
|
|
4088
|
+
} | undefined;
|
|
4089
|
+
};
|
|
4090
|
+
reasoningDelta: (u: unknown) => u is {
|
|
4091
|
+
readonly type: "reasoning-delta";
|
|
4092
|
+
readonly id: string;
|
|
4093
|
+
readonly text: string;
|
|
4094
|
+
readonly providerMetadata?: {
|
|
4095
|
+
readonly [x: string]: {
|
|
4096
|
+
readonly [x: string]: unknown;
|
|
4097
|
+
};
|
|
4098
|
+
} | undefined;
|
|
4099
|
+
};
|
|
4100
|
+
reasoningEnd: (u: unknown) => u is {
|
|
4101
|
+
readonly type: "reasoning-end";
|
|
4102
|
+
readonly id: string;
|
|
4103
|
+
readonly providerMetadata?: {
|
|
4104
|
+
readonly [x: string]: {
|
|
4105
|
+
readonly [x: string]: unknown;
|
|
4106
|
+
};
|
|
4107
|
+
} | undefined;
|
|
4108
|
+
};
|
|
4109
|
+
toolInputStart: (u: unknown) => u is {
|
|
4110
|
+
readonly type: "tool-input-start";
|
|
4111
|
+
readonly id: string;
|
|
4112
|
+
readonly name: string;
|
|
4113
|
+
readonly providerMetadata?: {
|
|
4114
|
+
readonly [x: string]: {
|
|
4115
|
+
readonly [x: string]: unknown;
|
|
4116
|
+
};
|
|
4117
|
+
} | undefined;
|
|
4118
|
+
};
|
|
4119
|
+
toolInputDelta: (u: unknown) => u is {
|
|
4120
|
+
readonly type: "tool-input-delta";
|
|
4121
|
+
readonly id: string;
|
|
4122
|
+
readonly name: string;
|
|
4123
|
+
readonly text: string;
|
|
4124
|
+
};
|
|
4125
|
+
toolInputEnd: (u: unknown) => u is {
|
|
4126
|
+
readonly type: "tool-input-end";
|
|
4127
|
+
readonly id: string;
|
|
4128
|
+
readonly name: string;
|
|
4129
|
+
readonly providerMetadata?: {
|
|
4130
|
+
readonly [x: string]: {
|
|
4131
|
+
readonly [x: string]: unknown;
|
|
4132
|
+
};
|
|
4133
|
+
} | undefined;
|
|
4134
|
+
};
|
|
4135
|
+
toolCall: (u: unknown) => u is {
|
|
4136
|
+
readonly type: "tool-call";
|
|
4137
|
+
readonly id: string;
|
|
4138
|
+
readonly name: string;
|
|
4139
|
+
readonly input: unknown;
|
|
4140
|
+
readonly providerExecuted?: boolean | undefined;
|
|
4141
|
+
readonly providerMetadata?: {
|
|
4142
|
+
readonly [x: string]: {
|
|
4143
|
+
readonly [x: string]: unknown;
|
|
4144
|
+
};
|
|
4145
|
+
} | undefined;
|
|
4146
|
+
};
|
|
4147
|
+
toolResult: (u: unknown) => u is {
|
|
4148
|
+
readonly type: "tool-result";
|
|
4149
|
+
readonly id: string;
|
|
4150
|
+
readonly name: string;
|
|
4151
|
+
readonly result: {
|
|
4152
|
+
readonly type: "json";
|
|
4153
|
+
readonly value: unknown;
|
|
4154
|
+
} | {
|
|
4155
|
+
readonly type: "text";
|
|
4156
|
+
readonly value: unknown;
|
|
4157
|
+
} | {
|
|
4158
|
+
readonly type: "error";
|
|
4159
|
+
readonly value: unknown;
|
|
4160
|
+
} | {
|
|
4161
|
+
readonly type: "content";
|
|
4162
|
+
readonly value: readonly ({
|
|
4163
|
+
readonly type: "text";
|
|
4164
|
+
readonly text: string;
|
|
4165
|
+
} | {
|
|
4166
|
+
readonly type: "file";
|
|
4167
|
+
readonly uri: string;
|
|
4168
|
+
readonly mime: string;
|
|
4169
|
+
readonly name?: string | undefined;
|
|
4170
|
+
})[];
|
|
4171
|
+
};
|
|
4172
|
+
readonly output?: {
|
|
4173
|
+
readonly structured: unknown;
|
|
4174
|
+
readonly content: readonly ({
|
|
4175
|
+
readonly type: "text";
|
|
4176
|
+
readonly text: string;
|
|
4177
|
+
} | {
|
|
4178
|
+
readonly type: "file";
|
|
4179
|
+
readonly uri: string;
|
|
4180
|
+
readonly mime: string;
|
|
4181
|
+
readonly name?: string | undefined;
|
|
4182
|
+
})[];
|
|
4183
|
+
} | undefined;
|
|
4184
|
+
readonly providerExecuted?: boolean | undefined;
|
|
4185
|
+
readonly providerMetadata?: {
|
|
4186
|
+
readonly [x: string]: {
|
|
4187
|
+
readonly [x: string]: unknown;
|
|
4188
|
+
};
|
|
4189
|
+
} | undefined;
|
|
4190
|
+
};
|
|
4191
|
+
toolError: (u: unknown) => u is {
|
|
4192
|
+
readonly type: "tool-error";
|
|
4193
|
+
readonly id: string;
|
|
4194
|
+
readonly name: string;
|
|
4195
|
+
readonly message: string;
|
|
4196
|
+
readonly error?: unknown;
|
|
4197
|
+
readonly providerMetadata?: {
|
|
4198
|
+
readonly [x: string]: {
|
|
4199
|
+
readonly [x: string]: unknown;
|
|
4200
|
+
};
|
|
4201
|
+
} | undefined;
|
|
4202
|
+
};
|
|
4203
|
+
stepFinish: (u: unknown) => u is {
|
|
4204
|
+
readonly type: "step-finish";
|
|
4205
|
+
readonly index: number;
|
|
4206
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
4207
|
+
readonly usage?: Usage | undefined;
|
|
4208
|
+
readonly providerMetadata?: {
|
|
4209
|
+
readonly [x: string]: {
|
|
4210
|
+
readonly [x: string]: unknown;
|
|
4211
|
+
};
|
|
4212
|
+
} | undefined;
|
|
4213
|
+
};
|
|
4214
|
+
finish: (u: unknown) => u is {
|
|
4215
|
+
readonly type: "finish";
|
|
4216
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
4217
|
+
readonly usage?: Usage | undefined;
|
|
4218
|
+
readonly providerMetadata?: {
|
|
4219
|
+
readonly [x: string]: {
|
|
4220
|
+
readonly [x: string]: unknown;
|
|
4221
|
+
};
|
|
4222
|
+
} | undefined;
|
|
4223
|
+
};
|
|
4224
|
+
providerError: (u: unknown) => u is {
|
|
4225
|
+
readonly type: "provider-error";
|
|
4226
|
+
readonly message: string;
|
|
4227
|
+
readonly classification?: "context-overflow" | undefined;
|
|
4228
|
+
readonly providerMetadata?: {
|
|
4229
|
+
readonly [x: string]: {
|
|
4230
|
+
readonly [x: string]: unknown;
|
|
4231
|
+
};
|
|
4232
|
+
} | undefined;
|
|
4233
|
+
};
|
|
4234
|
+
};
|
|
4235
|
+
}>;
|
|
4236
|
+
readonly usage: Schema.optional<typeof Usage>;
|
|
4237
|
+
readonly finishReason: Schema.Literals<readonly ["stop", "length", "tool-calls", "content-filter", "error", "unknown"]>;
|
|
4238
|
+
}>, {}>;
|
|
4239
|
+
export declare class LLMResponse extends LLMResponse_base {
|
|
4240
|
+
/** Concatenated assistant text assembled from streamed `text-delta` events. */
|
|
4241
|
+
get text(): string;
|
|
4242
|
+
/** Concatenated reasoning text assembled from streamed `reasoning-delta` events. */
|
|
4243
|
+
get reasoning(): string;
|
|
4244
|
+
/** Completed tool calls emitted by the provider. */
|
|
4245
|
+
get toolCalls(): {
|
|
4246
|
+
readonly type: "tool-call";
|
|
4247
|
+
readonly id: string;
|
|
4248
|
+
readonly name: string;
|
|
4249
|
+
readonly input: unknown;
|
|
4250
|
+
readonly providerExecuted?: boolean | undefined;
|
|
4251
|
+
readonly providerMetadata?: {
|
|
4252
|
+
readonly [x: string]: {
|
|
4253
|
+
readonly [x: string]: unknown;
|
|
4254
|
+
};
|
|
4255
|
+
} | undefined;
|
|
4256
|
+
}[];
|
|
4257
|
+
}
|
|
4258
|
+
export declare namespace LLMResponse {
|
|
4259
|
+
type State = ResponseState;
|
|
4260
|
+
type Output = LLMResponse | {
|
|
4261
|
+
readonly events: ReadonlyArray<LLMEvent>;
|
|
4262
|
+
readonly usage?: Usage;
|
|
4263
|
+
};
|
|
4264
|
+
/** Initial reducer state for assembling one provider attempt. */
|
|
4265
|
+
const empty: () => ResponseState;
|
|
4266
|
+
/** Purely fold one provider-neutral event into the attempt assembly state. */
|
|
4267
|
+
const reduce: (state: ResponseState, event: LLMEvent) => ResponseState;
|
|
4268
|
+
/** Return a completed response only after a terminal finish or provider error. */
|
|
4269
|
+
const complete: (state: State) => LLMResponse | undefined;
|
|
4270
|
+
/** Convenience reducer for callers that already have a collected event list. */
|
|
4271
|
+
const fromEvents: (events: ReadonlyArray<LLMEvent>) => LLMResponse | undefined;
|
|
4272
|
+
/** Concatenate assistant text from a response or collected event list. */
|
|
4273
|
+
const text: (response: Output) => string;
|
|
4274
|
+
/** Return response usage, falling back to the latest usage-bearing event. */
|
|
4275
|
+
const usage: (response: Output) => Usage | undefined;
|
|
4276
|
+
/** Return completed tool calls from a response or collected event list. */
|
|
4277
|
+
const toolCalls: (response: Output) => {
|
|
4278
|
+
readonly type: "tool-call";
|
|
4279
|
+
readonly id: string;
|
|
4280
|
+
readonly name: string;
|
|
4281
|
+
readonly input: unknown;
|
|
4282
|
+
readonly providerExecuted?: boolean | undefined;
|
|
4283
|
+
readonly providerMetadata?: {
|
|
4284
|
+
readonly [x: string]: {
|
|
4285
|
+
readonly [x: string]: unknown;
|
|
4286
|
+
};
|
|
4287
|
+
} | undefined;
|
|
4288
|
+
}[];
|
|
4289
|
+
/** Concatenate reasoning text from a response or collected event list. */
|
|
4290
|
+
const reasoning: (response: Output) => string;
|
|
4291
|
+
}
|
|
4292
|
+
export {};
|