@opencode/ai 2.0.32 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-client.d.ts +2 -2
- package/dist/experimental/evaluation-client.d.ts +1 -1
- package/dist/experimental/evaluation.d.ts +20 -20
- package/dist/experimental/realtime.d.ts +6 -14
- package/dist/experimental/realtime.js +28 -3
- package/dist/experimental/system-one.d.ts +1 -1
- package/dist/image-client.d.ts +8 -8
- package/dist/image.d.ts +593 -437
- package/dist/llm.d.ts +51 -51
- package/dist/media-client.d.ts +1 -1
- package/dist/media.d.ts +4 -4
- package/dist/promise.d.ts +199 -198
- package/dist/protocols/alibaba-chat.d.ts +81 -82
- package/dist/protocols/alibaba-chat.js +0 -1
- package/dist/protocols/alibaba-messages.d.ts +99 -99
- package/dist/protocols/alibaba-responses.d.ts +120 -120
- package/dist/protocols/anthropic-messages.d.ts +187 -187
- package/dist/protocols/anthropic-messages.js +3 -2
- package/dist/protocols/assemblyai-transcription.d.ts +1 -1
- package/dist/protocols/bedrock-converse.d.ts +75 -79
- package/dist/protocols/bfl-images.d.ts +1 -1
- package/dist/protocols/cartesia-speech.d.ts +17 -17
- package/dist/protocols/cohere-chat.d.ts +26 -23
- package/dist/protocols/cohere-chat.js +22 -1
- package/dist/protocols/deepgram-speech.d.ts +17 -17
- package/dist/protocols/deepgram-transcription.d.ts +1 -1
- package/dist/protocols/elevenlabs-speech.d.ts +17 -17
- package/dist/protocols/elevenlabs-transcription.d.ts +1 -1
- package/dist/protocols/fal-images.d.ts +1 -1
- package/dist/protocols/fal-video.d.ts +1 -1
- package/dist/protocols/gemini.d.ts +55 -55
- package/dist/protocols/google-images.d.ts +1 -1
- package/dist/protocols/google-interactions.d.ts +64 -62
- package/dist/protocols/google-interactions.js +19 -1
- package/dist/protocols/google-speech.d.ts +17 -17
- package/dist/protocols/google-transcription.d.ts +47 -47
- package/dist/protocols/google-video.d.ts +1 -1
- package/dist/protocols/meta-messages.d.ts +121 -121
- package/dist/protocols/meta-responses.d.ts +201 -201
- package/dist/protocols/mistral-chat.d.ts +45 -45
- package/dist/protocols/open-responses-channel.d.ts +1 -1
- package/dist/protocols/open-responses.d.ts +584 -450
- package/dist/protocols/open-responses.js +27 -35
- package/dist/protocols/openai-chat.d.ts +248 -248
- package/dist/protocols/openai-chat.js +11 -42
- package/dist/protocols/openai-compatible-chat.d.ts +32 -32
- package/dist/protocols/openai-compatible-responses.d.ts +88 -88
- package/dist/protocols/openai-images.d.ts +17 -17
- package/dist/protocols/openai-responses.d.ts +567 -567
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/openai-speech.d.ts +17 -17
- package/dist/protocols/openai-transcription.d.ts +47 -47
- package/dist/protocols/replicate-images.d.ts +1 -1
- package/dist/protocols/runway-video.d.ts +1 -1
- package/dist/protocols/shared.d.ts +12 -1
- package/dist/protocols/shared.js +17 -1
- package/dist/protocols/stability-images.d.ts +2 -2
- package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
- package/dist/protocols/utils/bedrock-media.d.ts +4 -4
- package/dist/protocols/utils/openai-options.d.ts +1 -1
- package/dist/protocols/utils/speech-stream.d.ts +1 -1
- package/dist/protocols/utils/tool-schema.d.ts +10 -5
- package/dist/protocols/utils/tool-stream.d.ts +152 -152
- package/dist/protocols/venice-chat.d.ts +109 -110
- package/dist/protocols/venice-chat.js +0 -1
- package/dist/protocols/xai-images.d.ts +1 -1
- package/dist/protocols/xai-responses.d.ts +79 -79
- package/dist/protocols/xai-video.d.ts +1 -1
- package/dist/protocols/zai-chat.d.ts +77 -78
- package/dist/protocols/zai-chat.js +0 -1
- package/dist/protocols/zai-images.d.ts +1 -1
- package/dist/protocols/zai-messages.d.ts +97 -97
- package/dist/providers/alibaba.d.ts +222 -283
- package/dist/providers/amazon-bedrock-mantle.d.ts +291 -298
- package/dist/providers/amazon-bedrock.d.ts +22 -28
- package/dist/providers/anthropic-compatible.d.ts +86 -90
- package/dist/providers/anthropic.d.ts +86 -90
- package/dist/providers/assemblyai.d.ts +2 -6
- package/dist/providers/azure.d.ts +228 -238
- package/dist/providers/baseten.d.ts +66 -70
- package/dist/providers/black-forest-labs.d.ts +2 -6
- package/dist/providers/cartesia.d.ts +2 -6
- package/dist/providers/cerebras.d.ts +66 -70
- package/dist/providers/cerebras.js +0 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +352 -356
- package/dist/providers/cloudflare-workers-ai.d.ts +66 -70
- package/dist/providers/cohere.d.ts +122 -132
- package/dist/providers/cohere.js +0 -2
- package/dist/providers/deepgram.d.ts +2 -7
- package/dist/providers/deepinfra.d.ts +66 -70
- package/dist/providers/deepinfra.js +0 -1
- package/dist/providers/deepseek.d.ts +66 -70
- package/dist/providers/deepseek.js +1 -1
- package/dist/providers/digitalocean.d.ts +137 -141
- package/dist/providers/elevenlabs.d.ts +2 -7
- package/dist/providers/fal.d.ts +2 -7
- package/dist/providers/fireworks.d.ts +66 -70
- package/dist/providers/google-vertex-chat.d.ts +34 -38
- package/dist/providers/google-vertex-interactions.d.ts +31 -41
- package/dist/providers/google-vertex-messages.d.ts +81 -85
- package/dist/providers/google-vertex-mistral.d.ts +23 -27
- package/dist/providers/google-vertex-responses.d.ts +90 -94
- package/dist/providers/google-vertex.d.ts +26 -30
- package/dist/providers/google.d.ts +94 -109
- package/dist/providers/groq.d.ts +111 -115
- package/dist/providers/groq.js +0 -1
- package/dist/providers/meta.d.ts +309 -317
- package/dist/providers/meta.js +1 -1
- package/dist/providers/minimax.d.ts +296 -303
- package/dist/providers/minimax.js +1 -1
- package/dist/providers/mistral.d.ts +22 -26
- package/dist/providers/moonshot.d.ts +296 -303
- package/dist/providers/moonshot.js +0 -1
- package/dist/providers/openai-compatible-responses.d.ts +90 -94
- package/dist/providers/openai-compatible.d.ts +34 -38
- package/dist/providers/openai.d.ts +93 -108
- package/dist/providers/opencode.d.ts +2 -8
- package/dist/providers/openrouter.d.ts +137 -144
- package/dist/providers/replicate.d.ts +2 -6
- package/dist/providers/runway.d.ts +2 -6
- package/dist/providers/stability.d.ts +2 -7
- package/dist/providers/togetherai.d.ts +66 -70
- package/dist/providers/togetherai.js +1 -1
- package/dist/providers/typesafe-ai.d.ts +2 -8
- package/dist/providers/venice.d.ts +58 -63
- package/dist/providers/vercel-ai-gateway.d.ts +2 -12
- package/dist/providers/xai.d.ts +38 -50
- package/dist/providers/zai-coding-plan.d.ts +206 -213
- package/dist/providers/zai.d.ts +40 -46
- package/dist/route/client.d.ts +51 -51
- package/dist/route/media-protocol.d.ts +1 -1
- package/dist/route/transport/http.d.ts +1 -1
- package/dist/route/transport/websocket.d.ts +8 -8
- package/dist/schema/errors.d.ts +19 -19
- package/dist/schema/events.d.ts +3090 -3288
- package/dist/schema/messages.d.ts +8 -7
- package/dist/schema/options.d.ts +2 -1
- package/dist/schema/options.js +2 -1
- package/dist/speech-client.d.ts +8 -8
- package/dist/speech.d.ts +434 -398
- package/dist/testing.d.ts +338 -338
- package/dist/tool-runtime.d.ts +1 -1
- package/dist/transcription-client.d.ts +23 -23
- package/dist/transcription.d.ts +562 -646
- package/dist/utils/sanitize.d.ts +4 -0
- package/dist/utils/sanitize.js +23 -6
- package/dist/video-client.d.ts +8 -8
- package/dist/video.d.ts +416 -372
- package/package.json +6 -6
|
@@ -7,9 +7,9 @@ export declare const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.c
|
|
|
7
7
|
declare const Options: Schema.Struct<{
|
|
8
8
|
readonly previousInteractionId: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.String>, never>>;
|
|
9
9
|
readonly store: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.Boolean>, never>>;
|
|
10
|
-
readonly thinkingLevel: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"
|
|
10
|
+
readonly thinkingLevel: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal">, import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal">>>, never>>;
|
|
11
11
|
readonly thinkingSummaries: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"auto" | "none">, import("../schema/options.js").OpenString<"auto" | "none">>>, never>>;
|
|
12
|
-
readonly serviceTier: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"
|
|
12
|
+
readonly serviceTier: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.declare<import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard">, import("../schema/options.js").OpenString<"deferred" | "flex" | "priority" | "standard">>>, never>>;
|
|
13
13
|
}>;
|
|
14
14
|
export type OptionsInput = typeof Options.Encoded;
|
|
15
15
|
export type ProviderOptionsInput = OptionsInput;
|
|
@@ -38,66 +38,66 @@ interface ParserState {
|
|
|
38
38
|
readonly completed: boolean;
|
|
39
39
|
}
|
|
40
40
|
export declare const protocol: Protocol<{
|
|
41
|
+
readonly model: string;
|
|
41
42
|
readonly input: readonly ({
|
|
42
|
-
readonly type: "
|
|
43
|
+
readonly type: "model_output" | "user_input";
|
|
43
44
|
readonly content: readonly ({
|
|
44
|
-
readonly type: "
|
|
45
|
-
readonly text: string;
|
|
46
|
-
} | {
|
|
47
|
-
readonly type: "image" | "document" | "video" | "audio";
|
|
48
|
-
readonly mime_type: string;
|
|
45
|
+
readonly type: "audio" | "document" | "image" | "video";
|
|
49
46
|
readonly data?: string | undefined;
|
|
50
47
|
readonly uri?: string | undefined;
|
|
48
|
+
readonly mime_type: string;
|
|
49
|
+
} | {
|
|
50
|
+
readonly type: "text";
|
|
51
|
+
readonly text: string;
|
|
51
52
|
})[];
|
|
52
53
|
} | {
|
|
53
54
|
readonly type: "thought";
|
|
55
|
+
readonly signature?: string | undefined;
|
|
54
56
|
readonly summary?: readonly {
|
|
55
57
|
readonly type: "text";
|
|
56
58
|
readonly text: string;
|
|
57
59
|
}[] | undefined;
|
|
58
|
-
readonly signature?: string | undefined;
|
|
59
60
|
} | {
|
|
60
|
-
readonly id: string;
|
|
61
61
|
readonly type: "function_call";
|
|
62
|
+
readonly id: string;
|
|
62
63
|
readonly name: string;
|
|
63
64
|
readonly arguments: unknown;
|
|
64
65
|
readonly signature?: string | undefined;
|
|
65
66
|
} | {
|
|
66
67
|
readonly type: "function_result";
|
|
68
|
+
readonly call_id: string;
|
|
67
69
|
readonly name: string;
|
|
68
70
|
readonly result: unknown;
|
|
69
|
-
readonly call_id: string;
|
|
70
71
|
readonly is_error?: boolean | undefined;
|
|
71
72
|
})[];
|
|
72
|
-
readonly model: string;
|
|
73
73
|
readonly stream: true;
|
|
74
74
|
readonly store: boolean;
|
|
75
|
+
readonly previous_interaction_id?: string | undefined;
|
|
76
|
+
readonly system_instruction?: string | undefined;
|
|
77
|
+
readonly service_tier?: string | undefined;
|
|
78
|
+
readonly tools?: readonly {
|
|
79
|
+
readonly type: "function";
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly description: string;
|
|
82
|
+
readonly parameters: {
|
|
83
|
+
readonly [x: string]: unknown;
|
|
84
|
+
};
|
|
85
|
+
}[] | undefined;
|
|
75
86
|
readonly generation_config: {
|
|
87
|
+
readonly max_output_tokens?: number | undefined;
|
|
76
88
|
readonly temperature?: number | undefined;
|
|
89
|
+
readonly top_p?: number | undefined;
|
|
77
90
|
readonly seed?: number | undefined;
|
|
78
|
-
readonly
|
|
91
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
92
|
+
readonly thinking_level?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
93
|
+
readonly thinking_summaries?: string | undefined;
|
|
94
|
+
readonly tool_choice?: "any" | "auto" | "none" | {
|
|
79
95
|
readonly allowed_tools: {
|
|
80
96
|
readonly mode: "any";
|
|
81
97
|
readonly tools: readonly string[];
|
|
82
98
|
};
|
|
83
99
|
} | undefined;
|
|
84
|
-
readonly top_p?: number | undefined;
|
|
85
|
-
readonly stop_sequences?: readonly string[] | undefined;
|
|
86
|
-
readonly max_output_tokens?: number | undefined;
|
|
87
|
-
readonly thinking_level?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
|
|
88
|
-
readonly thinking_summaries?: string | undefined;
|
|
89
100
|
};
|
|
90
|
-
readonly tools?: readonly {
|
|
91
|
-
readonly type: "function";
|
|
92
|
-
readonly name: string;
|
|
93
|
-
readonly description: string;
|
|
94
|
-
readonly parameters: {
|
|
95
|
-
readonly [x: string]: unknown;
|
|
96
|
-
};
|
|
97
|
-
}[] | undefined;
|
|
98
|
-
readonly service_tier?: string | undefined;
|
|
99
|
-
readonly previous_interaction_id?: string | undefined;
|
|
100
|
-
readonly system_instruction?: string | undefined;
|
|
101
101
|
}, string, {
|
|
102
102
|
readonly event_type: "step.start";
|
|
103
103
|
readonly index: number;
|
|
@@ -105,6 +105,10 @@ export declare const protocol: Protocol<{
|
|
|
105
105
|
readonly type: string;
|
|
106
106
|
readonly id?: string | undefined;
|
|
107
107
|
readonly name?: string | undefined;
|
|
108
|
+
readonly arguments?: {
|
|
109
|
+
readonly [x: string]: unknown;
|
|
110
|
+
} | undefined;
|
|
111
|
+
readonly signature?: string | undefined;
|
|
108
112
|
readonly summary?: readonly {
|
|
109
113
|
readonly type: "text";
|
|
110
114
|
readonly text: string;
|
|
@@ -113,10 +117,6 @@ export declare const protocol: Protocol<{
|
|
|
113
117
|
readonly type: string;
|
|
114
118
|
readonly text?: string | undefined;
|
|
115
119
|
}[] | undefined;
|
|
116
|
-
readonly signature?: string | undefined;
|
|
117
|
-
readonly arguments?: {
|
|
118
|
-
readonly [x: string]: unknown;
|
|
119
|
-
} | undefined;
|
|
120
120
|
};
|
|
121
121
|
} | {
|
|
122
122
|
readonly event_type: "step.delta";
|
|
@@ -148,15 +148,15 @@ export declare const protocol: Protocol<{
|
|
|
148
148
|
readonly id?: string | undefined;
|
|
149
149
|
};
|
|
150
150
|
} | {
|
|
151
|
-
readonly status: string;
|
|
152
151
|
readonly event_type: "interaction.status_update";
|
|
153
152
|
readonly interaction_id?: string | undefined;
|
|
153
|
+
readonly status: string;
|
|
154
154
|
} | {
|
|
155
155
|
readonly event_type: "interaction.completed";
|
|
156
156
|
readonly interaction: {
|
|
157
157
|
readonly [x: string]: unknown;
|
|
158
|
-
readonly status: string;
|
|
159
158
|
readonly id?: string | undefined;
|
|
159
|
+
readonly status: string;
|
|
160
160
|
readonly usage?: {
|
|
161
161
|
readonly [x: string]: unknown;
|
|
162
162
|
readonly total_input_tokens?: number | null | undefined;
|
|
@@ -170,67 +170,69 @@ export declare const protocol: Protocol<{
|
|
|
170
170
|
} | {
|
|
171
171
|
readonly event_type: "error";
|
|
172
172
|
readonly error: unknown;
|
|
173
|
+
} | {
|
|
174
|
+
readonly event_type: "unknown";
|
|
173
175
|
}, ParserState>;
|
|
174
176
|
export declare const route: Route<{
|
|
177
|
+
readonly model: string;
|
|
175
178
|
readonly input: readonly ({
|
|
176
|
-
readonly type: "
|
|
179
|
+
readonly type: "model_output" | "user_input";
|
|
177
180
|
readonly content: readonly ({
|
|
178
|
-
readonly type: "
|
|
179
|
-
readonly text: string;
|
|
180
|
-
} | {
|
|
181
|
-
readonly type: "image" | "document" | "video" | "audio";
|
|
182
|
-
readonly mime_type: string;
|
|
181
|
+
readonly type: "audio" | "document" | "image" | "video";
|
|
183
182
|
readonly data?: string | undefined;
|
|
184
183
|
readonly uri?: string | undefined;
|
|
184
|
+
readonly mime_type: string;
|
|
185
|
+
} | {
|
|
186
|
+
readonly type: "text";
|
|
187
|
+
readonly text: string;
|
|
185
188
|
})[];
|
|
186
189
|
} | {
|
|
187
190
|
readonly type: "thought";
|
|
191
|
+
readonly signature?: string | undefined;
|
|
188
192
|
readonly summary?: readonly {
|
|
189
193
|
readonly type: "text";
|
|
190
194
|
readonly text: string;
|
|
191
195
|
}[] | undefined;
|
|
192
|
-
readonly signature?: string | undefined;
|
|
193
196
|
} | {
|
|
194
|
-
readonly id: string;
|
|
195
197
|
readonly type: "function_call";
|
|
198
|
+
readonly id: string;
|
|
196
199
|
readonly name: string;
|
|
197
200
|
readonly arguments: unknown;
|
|
198
201
|
readonly signature?: string | undefined;
|
|
199
202
|
} | {
|
|
200
203
|
readonly type: "function_result";
|
|
204
|
+
readonly call_id: string;
|
|
201
205
|
readonly name: string;
|
|
202
206
|
readonly result: unknown;
|
|
203
|
-
readonly call_id: string;
|
|
204
207
|
readonly is_error?: boolean | undefined;
|
|
205
208
|
})[];
|
|
206
|
-
readonly model: string;
|
|
207
209
|
readonly stream: true;
|
|
208
210
|
readonly store: boolean;
|
|
211
|
+
readonly previous_interaction_id?: string | undefined;
|
|
212
|
+
readonly system_instruction?: string | undefined;
|
|
213
|
+
readonly service_tier?: string | undefined;
|
|
214
|
+
readonly tools?: readonly {
|
|
215
|
+
readonly type: "function";
|
|
216
|
+
readonly name: string;
|
|
217
|
+
readonly description: string;
|
|
218
|
+
readonly parameters: {
|
|
219
|
+
readonly [x: string]: unknown;
|
|
220
|
+
};
|
|
221
|
+
}[] | undefined;
|
|
209
222
|
readonly generation_config: {
|
|
223
|
+
readonly max_output_tokens?: number | undefined;
|
|
210
224
|
readonly temperature?: number | undefined;
|
|
225
|
+
readonly top_p?: number | undefined;
|
|
211
226
|
readonly seed?: number | undefined;
|
|
212
|
-
readonly
|
|
227
|
+
readonly stop_sequences?: readonly string[] | undefined;
|
|
228
|
+
readonly thinking_level?: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal"> | undefined;
|
|
229
|
+
readonly thinking_summaries?: string | undefined;
|
|
230
|
+
readonly tool_choice?: "any" | "auto" | "none" | {
|
|
213
231
|
readonly allowed_tools: {
|
|
214
232
|
readonly mode: "any";
|
|
215
233
|
readonly tools: readonly string[];
|
|
216
234
|
};
|
|
217
235
|
} | undefined;
|
|
218
|
-
readonly top_p?: number | undefined;
|
|
219
|
-
readonly stop_sequences?: readonly string[] | undefined;
|
|
220
|
-
readonly max_output_tokens?: number | undefined;
|
|
221
|
-
readonly thinking_level?: import("../schema/options.js").OpenString<"minimal" | "low" | "medium" | "high"> | undefined;
|
|
222
|
-
readonly thinking_summaries?: string | undefined;
|
|
223
236
|
};
|
|
224
|
-
readonly tools?: readonly {
|
|
225
|
-
readonly type: "function";
|
|
226
|
-
readonly name: string;
|
|
227
|
-
readonly description: string;
|
|
228
|
-
readonly parameters: {
|
|
229
|
-
readonly [x: string]: unknown;
|
|
230
|
-
};
|
|
231
|
-
}[] | undefined;
|
|
232
|
-
readonly service_tier?: string | undefined;
|
|
233
|
-
readonly previous_interaction_id?: string | undefined;
|
|
234
|
-
readonly system_instruction?: string | undefined;
|
|
235
237
|
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
236
238
|
export * as GoogleInteractions from "./google-interactions.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, Schema } from "effect";
|
|
1
|
+
import { Effect, Schema, SchemaGetter } from "effect";
|
|
2
2
|
import { Route } from "../route/client.js";
|
|
3
3
|
import { Auth } from "../route/auth.js";
|
|
4
4
|
import { Endpoint } from "../route/endpoint.js";
|
|
@@ -121,6 +121,22 @@ const Interaction = Schema.StructWithRest(Schema.Struct({
|
|
|
121
121
|
status: Schema.String,
|
|
122
122
|
usage: Schema.optional(RawUsage),
|
|
123
123
|
}), [Schema.Record(Schema.String, Schema.Unknown)]);
|
|
124
|
+
const KNOWN_EVENT_TYPES = new Set([
|
|
125
|
+
"step.start",
|
|
126
|
+
"step.delta",
|
|
127
|
+
"step.stop",
|
|
128
|
+
"interaction.created",
|
|
129
|
+
"interaction.status_update",
|
|
130
|
+
"interaction.completed",
|
|
131
|
+
"error",
|
|
132
|
+
]);
|
|
133
|
+
// Google may add stream event types. Unknown types are ignored, while a malformed known type still fails decoding.
|
|
134
|
+
const UnknownEvent = Schema.Struct({
|
|
135
|
+
event_type: Schema.String.check(Schema.makeFilter((type) => !KNOWN_EVENT_TYPES.has(type))),
|
|
136
|
+
}).pipe(Schema.decodeTo(Schema.Struct({ event_type: Schema.Literal("unknown") }), {
|
|
137
|
+
decode: SchemaGetter.transform(() => ({ event_type: "unknown" })),
|
|
138
|
+
encode: SchemaGetter.forbidden(() => "Unknown Google Interactions stream events are decode-only"),
|
|
139
|
+
}));
|
|
124
140
|
const Event = Schema.Union([
|
|
125
141
|
Schema.Struct({ event_type: Schema.Literal("step.start"), index: Schema.Number, step: OutputStep }),
|
|
126
142
|
Schema.Struct({ event_type: Schema.Literal("step.delta"), index: Schema.Number, delta: Delta }),
|
|
@@ -136,6 +152,7 @@ const Event = Schema.Union([
|
|
|
136
152
|
}),
|
|
137
153
|
Schema.Struct({ event_type: Schema.Literal("interaction.completed"), interaction: Interaction }),
|
|
138
154
|
Schema.Struct({ event_type: Schema.Literal("error"), error: Schema.Unknown }),
|
|
155
|
+
UnknownEvent,
|
|
139
156
|
]);
|
|
140
157
|
// =============================================================================
|
|
141
158
|
// Request Body Construction
|
|
@@ -403,6 +420,7 @@ const step = Effect.fnUntraced(function* (state, event) {
|
|
|
403
420
|
return yield* onStop(state, event.index);
|
|
404
421
|
case "interaction.created":
|
|
405
422
|
case "interaction.status_update":
|
|
423
|
+
case "unknown":
|
|
406
424
|
return [state, []];
|
|
407
425
|
case "error":
|
|
408
426
|
return yield* new AIError({
|
|
@@ -26,12 +26,12 @@ interface State extends SpeechStream.Audio, GeminiGenerateContent.Metadata {
|
|
|
26
26
|
readonly mimeType?: string;
|
|
27
27
|
}
|
|
28
28
|
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
29
|
-
readonly id: string;
|
|
30
29
|
readonly type: "generation-queued";
|
|
30
|
+
readonly id: string;
|
|
31
31
|
readonly position?: number | undefined;
|
|
32
32
|
} | {
|
|
33
|
-
readonly id: string;
|
|
34
33
|
readonly type: "generation-progress";
|
|
34
|
+
readonly id: string;
|
|
35
35
|
readonly progress?: number | undefined;
|
|
36
36
|
} | {
|
|
37
37
|
readonly type: "audio-delta";
|
|
@@ -46,11 +46,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
46
46
|
} | {
|
|
47
47
|
readonly type: "finish";
|
|
48
48
|
readonly audio: import("../media.js").Asset;
|
|
49
|
-
readonly providerMetadata?: {
|
|
50
|
-
readonly [x: string]: {
|
|
51
|
-
readonly [x: string]: unknown;
|
|
52
|
-
};
|
|
53
|
-
} | undefined;
|
|
54
49
|
readonly usage?: {
|
|
55
50
|
readonly type: "tokens";
|
|
56
51
|
readonly input?: number | undefined;
|
|
@@ -73,7 +68,7 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
73
68
|
readonly seconds: number;
|
|
74
69
|
} | undefined;
|
|
75
70
|
readonly notices?: readonly {
|
|
76
|
-
readonly type: "
|
|
71
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
77
72
|
readonly message: string;
|
|
78
73
|
readonly providerMetadata?: {
|
|
79
74
|
readonly [x: string]: {
|
|
@@ -81,16 +76,21 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
81
76
|
};
|
|
82
77
|
} | undefined;
|
|
83
78
|
}[] | undefined;
|
|
79
|
+
readonly providerMetadata?: {
|
|
80
|
+
readonly [x: string]: {
|
|
81
|
+
readonly [x: string]: unknown;
|
|
82
|
+
};
|
|
83
|
+
} | undefined;
|
|
84
84
|
}, string, State>;
|
|
85
85
|
export declare const model: (input: MediaRoute.ModelInput) => SpeechModel<GoogleSpeechOptions>;
|
|
86
86
|
export declare const GoogleSpeech: {
|
|
87
87
|
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
88
|
-
readonly id: string;
|
|
89
88
|
readonly type: "generation-queued";
|
|
89
|
+
readonly id: string;
|
|
90
90
|
readonly position?: number | undefined;
|
|
91
91
|
} | {
|
|
92
|
-
readonly id: string;
|
|
93
92
|
readonly type: "generation-progress";
|
|
93
|
+
readonly id: string;
|
|
94
94
|
readonly progress?: number | undefined;
|
|
95
95
|
} | {
|
|
96
96
|
readonly type: "audio-delta";
|
|
@@ -105,11 +105,6 @@ export declare const GoogleSpeech: {
|
|
|
105
105
|
} | {
|
|
106
106
|
readonly type: "finish";
|
|
107
107
|
readonly audio: import("../media.js").Asset;
|
|
108
|
-
readonly providerMetadata?: {
|
|
109
|
-
readonly [x: string]: {
|
|
110
|
-
readonly [x: string]: unknown;
|
|
111
|
-
};
|
|
112
|
-
} | undefined;
|
|
113
108
|
readonly usage?: {
|
|
114
109
|
readonly type: "tokens";
|
|
115
110
|
readonly input?: number | undefined;
|
|
@@ -132,7 +127,7 @@ export declare const GoogleSpeech: {
|
|
|
132
127
|
readonly seconds: number;
|
|
133
128
|
} | undefined;
|
|
134
129
|
readonly notices?: readonly {
|
|
135
|
-
readonly type: "
|
|
130
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
136
131
|
readonly message: string;
|
|
137
132
|
readonly providerMetadata?: {
|
|
138
133
|
readonly [x: string]: {
|
|
@@ -140,7 +135,12 @@ export declare const GoogleSpeech: {
|
|
|
140
135
|
};
|
|
141
136
|
} | undefined;
|
|
142
137
|
}[] | undefined;
|
|
138
|
+
readonly providerMetadata?: {
|
|
139
|
+
readonly [x: string]: {
|
|
140
|
+
readonly [x: string]: unknown;
|
|
141
|
+
};
|
|
142
|
+
} | undefined;
|
|
143
143
|
}, string, State>;
|
|
144
|
-
readonly model:
|
|
144
|
+
readonly model: typeof model;
|
|
145
145
|
};
|
|
146
146
|
export {};
|
|
@@ -22,12 +22,12 @@ interface State extends GeminiGenerateContent.Metadata {
|
|
|
22
22
|
readonly words: Array<TranscriptionWord>;
|
|
23
23
|
}
|
|
24
24
|
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
25
|
-
readonly id: string;
|
|
26
25
|
readonly type: "generation-queued";
|
|
26
|
+
readonly id: string;
|
|
27
27
|
readonly position?: number | undefined;
|
|
28
28
|
} | {
|
|
29
|
-
readonly id: string;
|
|
30
29
|
readonly type: "generation-progress";
|
|
30
|
+
readonly id: string;
|
|
31
31
|
readonly progress?: number | undefined;
|
|
32
32
|
} | {
|
|
33
33
|
readonly type: "text-delta";
|
|
@@ -41,14 +41,22 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
41
41
|
readonly speaker?: string | undefined;
|
|
42
42
|
};
|
|
43
43
|
} | {
|
|
44
|
-
readonly type: "finish";
|
|
45
44
|
readonly text: string;
|
|
45
|
+
readonly segments?: readonly {
|
|
46
|
+
readonly text: string;
|
|
47
|
+
readonly startSeconds: number;
|
|
48
|
+
readonly endSeconds: number;
|
|
49
|
+
readonly speaker?: string | undefined;
|
|
50
|
+
}[] | undefined;
|
|
51
|
+
readonly words?: readonly {
|
|
52
|
+
readonly text: string;
|
|
53
|
+
readonly startSeconds: number;
|
|
54
|
+
readonly endSeconds: number;
|
|
55
|
+
readonly speaker?: string | undefined;
|
|
56
|
+
readonly confidence?: number | undefined;
|
|
57
|
+
}[] | undefined;
|
|
58
|
+
readonly language?: string | undefined;
|
|
46
59
|
readonly durationSeconds?: number | undefined;
|
|
47
|
-
readonly providerMetadata?: {
|
|
48
|
-
readonly [x: string]: {
|
|
49
|
-
readonly [x: string]: unknown;
|
|
50
|
-
};
|
|
51
|
-
} | undefined;
|
|
52
60
|
readonly usage?: {
|
|
53
61
|
readonly type: "tokens";
|
|
54
62
|
readonly input?: number | undefined;
|
|
@@ -71,7 +79,7 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
71
79
|
readonly seconds: number;
|
|
72
80
|
} | undefined;
|
|
73
81
|
readonly notices?: readonly {
|
|
74
|
-
readonly type: "
|
|
82
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
75
83
|
readonly message: string;
|
|
76
84
|
readonly providerMetadata?: {
|
|
77
85
|
readonly [x: string]: {
|
|
@@ -79,30 +87,22 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
79
87
|
};
|
|
80
88
|
} | undefined;
|
|
81
89
|
}[] | undefined;
|
|
82
|
-
readonly
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}[] | undefined;
|
|
89
|
-
readonly words?: readonly {
|
|
90
|
-
readonly text: string;
|
|
91
|
-
readonly startSeconds: number;
|
|
92
|
-
readonly endSeconds: number;
|
|
93
|
-
readonly speaker?: string | undefined;
|
|
94
|
-
readonly confidence?: number | undefined;
|
|
95
|
-
}[] | undefined;
|
|
90
|
+
readonly providerMetadata?: {
|
|
91
|
+
readonly [x: string]: {
|
|
92
|
+
readonly [x: string]: unknown;
|
|
93
|
+
};
|
|
94
|
+
} | undefined;
|
|
95
|
+
readonly type: "finish";
|
|
96
96
|
}, string, State>;
|
|
97
97
|
export declare const model: (input: MediaRoute.ModelInput) => TranscriptionModel<GoogleTranscriptionOptions>;
|
|
98
98
|
export declare const GoogleTranscription: {
|
|
99
99
|
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
100
|
-
readonly id: string;
|
|
101
100
|
readonly type: "generation-queued";
|
|
101
|
+
readonly id: string;
|
|
102
102
|
readonly position?: number | undefined;
|
|
103
103
|
} | {
|
|
104
|
-
readonly id: string;
|
|
105
104
|
readonly type: "generation-progress";
|
|
105
|
+
readonly id: string;
|
|
106
106
|
readonly progress?: number | undefined;
|
|
107
107
|
} | {
|
|
108
108
|
readonly type: "text-delta";
|
|
@@ -116,14 +116,22 @@ export declare const GoogleTranscription: {
|
|
|
116
116
|
readonly speaker?: string | undefined;
|
|
117
117
|
};
|
|
118
118
|
} | {
|
|
119
|
-
readonly type: "finish";
|
|
120
119
|
readonly text: string;
|
|
120
|
+
readonly segments?: readonly {
|
|
121
|
+
readonly text: string;
|
|
122
|
+
readonly startSeconds: number;
|
|
123
|
+
readonly endSeconds: number;
|
|
124
|
+
readonly speaker?: string | undefined;
|
|
125
|
+
}[] | undefined;
|
|
126
|
+
readonly words?: readonly {
|
|
127
|
+
readonly text: string;
|
|
128
|
+
readonly startSeconds: number;
|
|
129
|
+
readonly endSeconds: number;
|
|
130
|
+
readonly speaker?: string | undefined;
|
|
131
|
+
readonly confidence?: number | undefined;
|
|
132
|
+
}[] | undefined;
|
|
133
|
+
readonly language?: string | undefined;
|
|
121
134
|
readonly durationSeconds?: number | undefined;
|
|
122
|
-
readonly providerMetadata?: {
|
|
123
|
-
readonly [x: string]: {
|
|
124
|
-
readonly [x: string]: unknown;
|
|
125
|
-
};
|
|
126
|
-
} | undefined;
|
|
127
135
|
readonly usage?: {
|
|
128
136
|
readonly type: "tokens";
|
|
129
137
|
readonly input?: number | undefined;
|
|
@@ -146,7 +154,7 @@ export declare const GoogleTranscription: {
|
|
|
146
154
|
readonly seconds: number;
|
|
147
155
|
} | undefined;
|
|
148
156
|
readonly notices?: readonly {
|
|
149
|
-
readonly type: "
|
|
157
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
150
158
|
readonly message: string;
|
|
151
159
|
readonly providerMetadata?: {
|
|
152
160
|
readonly [x: string]: {
|
|
@@ -154,21 +162,13 @@ export declare const GoogleTranscription: {
|
|
|
154
162
|
};
|
|
155
163
|
} | undefined;
|
|
156
164
|
}[] | undefined;
|
|
157
|
-
readonly
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}[] | undefined;
|
|
164
|
-
readonly words?: readonly {
|
|
165
|
-
readonly text: string;
|
|
166
|
-
readonly startSeconds: number;
|
|
167
|
-
readonly endSeconds: number;
|
|
168
|
-
readonly speaker?: string | undefined;
|
|
169
|
-
readonly confidence?: number | undefined;
|
|
170
|
-
}[] | undefined;
|
|
165
|
+
readonly providerMetadata?: {
|
|
166
|
+
readonly [x: string]: {
|
|
167
|
+
readonly [x: string]: unknown;
|
|
168
|
+
};
|
|
169
|
+
} | undefined;
|
|
170
|
+
readonly type: "finish";
|
|
171
171
|
}, string, State>;
|
|
172
|
-
readonly model:
|
|
172
|
+
readonly model: typeof model;
|
|
173
173
|
};
|
|
174
174
|
export {};
|
|
@@ -22,5 +22,5 @@ export declare const GoogleVideo: {
|
|
|
22
22
|
readonly protocol: MediaProtocol.Queued<Request, VideoResponse, {
|
|
23
23
|
readonly operation: string;
|
|
24
24
|
}>;
|
|
25
|
-
readonly model:
|
|
25
|
+
readonly model: typeof model;
|
|
26
26
|
};
|