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