@opencode/ai 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/decision.d.ts +4 -3
  2. package/dist/decision.js +3 -2
  3. package/dist/embedding.d.ts +4 -3
  4. package/dist/embedding.js +3 -2
  5. package/dist/experimental/cloudflare-run-extraction.js +1 -2
  6. package/dist/experimental/realtime.d.ts +12 -43
  7. package/dist/experimental/realtime.js +14 -30
  8. package/dist/experimental.d.ts +1 -1
  9. package/dist/image.js +1 -1
  10. package/dist/media-model.d.ts +5 -4
  11. package/dist/media-model.js +5 -4
  12. package/dist/media.js +4 -17
  13. package/dist/protocols/anthropic-messages.js +7 -11
  14. package/dist/protocols/bedrock-converse.js +6 -6
  15. package/dist/protocols/cohere-chat.js +3 -3
  16. package/dist/protocols/gemini.js +6 -10
  17. package/dist/protocols/google-interactions.d.ts +299 -6
  18. package/dist/protocols/google-interactions.js +251 -33
  19. package/dist/protocols/meta-messages.js +3 -3
  20. package/dist/protocols/minimax-video.js +7 -1
  21. package/dist/protocols/mistral-chat.d.ts +1 -0
  22. package/dist/protocols/mistral-chat.js +3 -3
  23. package/dist/protocols/open-responses-continuation.js +2 -0
  24. package/dist/protocols/open-responses.d.ts +162 -114
  25. package/dist/protocols/open-responses.js +12 -7
  26. package/dist/protocols/openai-chat.d.ts +1 -0
  27. package/dist/protocols/openai-chat.js +6 -5
  28. package/dist/protocols/openai-responses.js +2 -1
  29. package/dist/protocols/shared.d.ts +12 -1
  30. package/dist/protocols/shared.js +56 -9
  31. package/dist/protocols/utils/gateway-protocol.js +1 -0
  32. package/dist/protocols/utils/gemini-generate-content.d.ts +4 -0
  33. package/dist/protocols/utils/gemini-generate-content.js +5 -1
  34. package/dist/protocols/utils/responses-compaction.js +10 -4
  35. package/dist/protocols/xai-responses.d.ts +2 -1
  36. package/dist/protocols/xai-responses.js +4 -1
  37. package/dist/provider-error.js +3 -1
  38. package/dist/providers/alibaba.js +2 -3
  39. package/dist/providers/assemblyai.d.ts +2 -4
  40. package/dist/providers/azure.js +5 -11
  41. package/dist/providers/baseten.js +2 -3
  42. package/dist/providers/byteplus.d.ts +2 -4
  43. package/dist/providers/cartesia.d.ts +2 -4
  44. package/dist/providers/cloudflare-ai-gateway.js +3 -3
  45. package/dist/providers/cloudflare-workers-ai.js +2 -3
  46. package/dist/providers/cohere.js +2 -3
  47. package/dist/providers/deepgram.d.ts +2 -4
  48. package/dist/providers/deepinfra.js +2 -3
  49. package/dist/providers/digitalocean.js +3 -5
  50. package/dist/providers/elevenlabs.d.ts +2 -4
  51. package/dist/providers/fireworks.js +2 -3
  52. package/dist/providers/google-vertex-interactions.d.ts +12 -3
  53. package/dist/providers/google-vertex-interactions.js +1 -2
  54. package/dist/providers/google-vertex.js +6 -2
  55. package/dist/providers/google.d.ts +20 -3
  56. package/dist/providers/google.js +7 -4
  57. package/dist/providers/openai-compatible.js +3 -5
  58. package/dist/providers/openai.js +4 -10
  59. package/dist/providers/opencode.d.ts +2 -4
  60. package/dist/providers/opencode.js +2 -3
  61. package/dist/providers/openrouter.js +3 -5
  62. package/dist/providers/typesafe-ai.d.ts +2 -4
  63. package/dist/providers/typesafe-ai.js +2 -3
  64. package/dist/providers/vercel-ai-gateway.js +3 -5
  65. package/dist/providers/volcengine.d.ts +2 -4
  66. package/dist/route/decision.d.ts +4 -7
  67. package/dist/route/decision.js +8 -10
  68. package/dist/route/embedding.d.ts +4 -7
  69. package/dist/route/embedding.js +4 -7
  70. package/dist/route/executor-service.d.ts +20 -3
  71. package/dist/route/executor-service.js +72 -2
  72. package/dist/route/executor.d.ts +5 -5
  73. package/dist/route/executor.js +68 -73
  74. package/dist/route/media-protocol.d.ts +2 -1
  75. package/dist/route/media-protocol.js +2 -10
  76. package/dist/route/media.d.ts +6 -8
  77. package/dist/route/media.js +8 -8
  78. package/dist/route/protocol.d.ts +2 -0
  79. package/dist/route/protocol.js +4 -1
  80. package/dist/route/transport/http.d.ts +1 -2
  81. package/dist/route/transport/http.js +5 -28
  82. package/dist/schema/errors.js +2 -1
  83. package/dist/schema/options.d.ts +1 -1
  84. package/dist/speech.js +1 -1
  85. package/dist/transcription.js +1 -1
  86. package/dist/video.js +1 -1
  87. package/package.json +3 -3
@@ -108,10 +108,6 @@ const GeminiThinkingConfig = Schema.Struct({
108
108
  includeThoughts: Schema.optional(Schema.Boolean),
109
109
  thinkingLevel: Schema.optional(GeminiThinkingLevel),
110
110
  });
111
- const GeminiSafetySetting = Schema.Struct({
112
- category: knownString(),
113
- threshold: knownString(),
114
- });
115
111
  // =============================================================================
116
112
  // Provider Options
117
113
  // =============================================================================
@@ -124,7 +120,7 @@ const GeminiThinkingConfigInput = Schema.Struct({
124
120
  });
125
121
  const Options = Schema.Struct({
126
122
  cachedContent: lenient(Schema.String),
127
- safetySettings: lenient(Schema.Array(GeminiSafetySetting)),
123
+ safetySettings: lenient(Schema.Array(GeminiGenerateContent.SafetySetting)),
128
124
  serviceTier: lenient(knownString()),
129
125
  thinkingConfig: lenient(GeminiThinkingConfigInput),
130
126
  });
@@ -144,7 +140,7 @@ const GeminiBodyFields = {
144
140
  cachedContent: Schema.optional(Schema.String),
145
141
  contents: Schema.Array(GeminiContent),
146
142
  labels: Schema.optional(Schema.Record(Schema.String, Schema.String)),
147
- safetySettings: optionalArray(GeminiSafetySetting),
143
+ safetySettings: optionalArray(GeminiGenerateContent.SafetySetting),
148
144
  serviceTier: Schema.optional(Schema.String),
149
145
  systemInstruction: Schema.optional(GeminiSystemInstruction),
150
146
  tools: optionalArray(GeminiTool),
@@ -343,8 +339,8 @@ const lowerMessages = Effect.fnUntraced(function* (request) {
343
339
  return contents;
344
340
  });
345
341
  const fromRequest = Effect.fn("Gemini.fromRequest")(function* (request) {
346
- const flattened = ProviderShared.flattenToolRequest(request);
347
- const hasTools = flattened.tools.length > 0;
342
+ const definitions = ProviderShared.flattenTools(request.tools);
343
+ const hasTools = definitions.length > 0;
348
344
  const options = yield* decodeOptions(request.providerOptions ?? {});
349
345
  const generationConfig = {
350
346
  maxOutputTokens: request.maxTokens,
@@ -368,14 +364,14 @@ const fromRequest = Effect.fn("Gemini.fromRequest")(function* (request) {
368
364
  };
369
365
  return {
370
366
  cachedContent: options.cachedContent,
371
- contents: yield* lowerMessages(flattened.request),
367
+ contents: yield* lowerMessages(request),
372
368
  safetySettings: options.safetySettings,
373
369
  serviceTier: options.serviceTier,
374
370
  systemInstruction: request.system.length === 0 ? undefined : { parts: request.system.map((part) => ({ text: part.text })) },
375
371
  tools: hasTools
376
372
  ? [
377
373
  {
378
- functionDeclarations: flattened.tools.map(lowerTool),
374
+ functionDeclarations: definitions.map(lowerTool),
379
375
  },
380
376
  ]
381
377
  : undefined,
@@ -1,6 +1,7 @@
1
1
  import { Effect, Schema } from "effect";
2
2
  import { Route } from "../route/client.js";
3
3
  import { Protocol } from "../route/protocol.js";
4
+ import { HttpTransport, type Transport, type TransportPrepareInput } from "../route/transport/index.js";
4
5
  import { AIError } from "../schema/index.js";
5
6
  import { Media } from "../media.js";
6
7
  import { Lifecycle } from "./utils/lifecycle.js";
@@ -12,9 +13,87 @@ declare const Options: Schema.Struct<{
12
13
  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>>;
13
14
  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>>;
14
15
  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>>;
16
+ readonly safetySettings: Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<Schema.$Array<Schema.Struct<{
17
+ readonly category: Schema.declare<import("../schema/options.js").OpenString<"HARM_CATEGORY_CIVIC_INTEGRITY" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_UNSPECIFIED">, import("../schema/options.js").OpenString<"HARM_CATEGORY_CIVIC_INTEGRITY" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_UNSPECIFIED">>;
18
+ readonly threshold: Schema.declare<import("../schema/options.js").OpenString<"BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_NONE" | "BLOCK_ONLY_HIGH" | "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "OFF">, import("../schema/options.js").OpenString<"BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_NONE" | "BLOCK_ONLY_HIGH" | "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "OFF">>;
19
+ }>>>, never>>;
15
20
  }>;
16
21
  export type OptionsInput = typeof Options.Encoded;
17
22
  export type ProviderOptionsInput = OptionsInput;
23
+ declare const Body: Schema.Struct<{
24
+ readonly model: Schema.String;
25
+ readonly input: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
26
+ readonly type: Schema.Literals<readonly ["user_input", "model_output"]>;
27
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
28
+ readonly type: Schema.Literal<"text">;
29
+ readonly text: Schema.String;
30
+ }>, Schema.Struct<{
31
+ readonly type: Schema.Literals<readonly ["image", "audio", "video", "document"]>;
32
+ readonly data: Schema.optional<Schema.String>;
33
+ readonly uri: Schema.optional<Schema.String>;
34
+ readonly mime_type: Schema.String;
35
+ }>]>>;
36
+ }>, Schema.Struct<{
37
+ readonly type: Schema.Literal<"thought">;
38
+ readonly signature: Schema.optional<Schema.String>;
39
+ readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
40
+ readonly type: Schema.Literal<"text">;
41
+ readonly text: Schema.String;
42
+ }>>>;
43
+ }>, Schema.Struct<{
44
+ readonly type: Schema.Literal<"function_call">;
45
+ readonly id: Schema.String;
46
+ readonly name: Schema.String;
47
+ readonly arguments: Schema.Unknown;
48
+ readonly signature: Schema.optional<Schema.String>;
49
+ }>, Schema.Struct<{
50
+ readonly type: Schema.Literal<"function_result">;
51
+ readonly call_id: Schema.String;
52
+ readonly name: Schema.String;
53
+ readonly result: Schema.Unknown;
54
+ readonly is_error: Schema.optional<Schema.Boolean>;
55
+ }>]>>>;
56
+ readonly stream: Schema.Literal<true>;
57
+ readonly store: Schema.Boolean;
58
+ readonly previous_interaction_id: Schema.optional<Schema.String>;
59
+ readonly continuation_token: Schema.optional<Schema.String>;
60
+ readonly system_instruction: Schema.optional<Schema.String>;
61
+ readonly service_tier: Schema.optional<Schema.String>;
62
+ readonly safety_settings: Schema.optional<Schema.$Array<Schema.Struct<{
63
+ readonly type: Schema.String;
64
+ readonly threshold: Schema.String;
65
+ }>>>;
66
+ readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{
67
+ readonly type: Schema.Literal<"function">;
68
+ readonly name: Schema.String;
69
+ readonly description: Schema.String;
70
+ readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
71
+ }>>>;
72
+ readonly generation_config: Schema.Struct<{
73
+ readonly max_output_tokens: Schema.optional<Schema.Number>;
74
+ readonly temperature: Schema.optional<Schema.Number>;
75
+ readonly top_p: Schema.optional<Schema.Number>;
76
+ readonly seed: Schema.optional<Schema.Number>;
77
+ readonly stop_sequences: Schema.optional<Schema.$Array<Schema.String>>;
78
+ readonly thinking_level: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal">, import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal">>>;
79
+ readonly thinking_summaries: Schema.optional<Schema.String>;
80
+ readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "any", "none"]>, Schema.Struct<{
81
+ readonly allowed_tools: Schema.Struct<{
82
+ readonly mode: Schema.Literal<"any">;
83
+ readonly tools: Schema.$Array<Schema.String>;
84
+ }>;
85
+ }>]>>;
86
+ }>;
87
+ }>;
88
+ declare const RawUsage: Schema.StructWithRest<Schema.Struct<{
89
+ readonly total_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
90
+ readonly total_cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
91
+ readonly total_output_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
92
+ readonly total_thought_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
93
+ readonly total_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
94
+ readonly raw_prompt_token: Schema.optional<Schema.NullOr<Schema.Number>>;
95
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
96
+ type RawUsage = typeof RawUsage.Type;
18
97
  declare const OutputStep: Schema.Struct<{
19
98
  readonly type: Schema.String;
20
99
  readonly id: Schema.optional<Schema.String>;
@@ -31,10 +110,105 @@ declare const OutputStep: Schema.Struct<{
31
110
  }>>>;
32
111
  }>;
33
112
  type OutputStep = typeof OutputStep.Type;
113
+ declare const Event: Schema.Union<readonly [Schema.Struct<{
114
+ readonly event_type: Schema.Literal<"step.start">;
115
+ readonly index: Schema.Number;
116
+ readonly step: Schema.Struct<{
117
+ readonly type: Schema.String;
118
+ readonly id: Schema.optional<Schema.String>;
119
+ readonly name: Schema.optional<Schema.String>;
120
+ readonly arguments: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
121
+ readonly signature: Schema.optional<Schema.String>;
122
+ readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
123
+ readonly type: Schema.Literal<"text">;
124
+ readonly text: Schema.String;
125
+ }>>>;
126
+ readonly content: Schema.optional<Schema.$Array<Schema.Struct<{
127
+ readonly type: Schema.String;
128
+ readonly text: Schema.optional<Schema.String>;
129
+ }>>>;
130
+ }>;
131
+ }>, Schema.Struct<{
132
+ readonly event_type: Schema.Literal<"step.delta">;
133
+ readonly index: Schema.Number;
134
+ readonly delta: Schema.Union<readonly [Schema.Struct<{
135
+ readonly type: Schema.Literal<"text">;
136
+ readonly text: Schema.String;
137
+ }>, Schema.Struct<{
138
+ readonly type: Schema.Literal<"arguments_delta">;
139
+ readonly arguments: Schema.String;
140
+ }>, Schema.Struct<{
141
+ readonly type: Schema.Literal<"thought_signature">;
142
+ readonly signature: Schema.String;
143
+ }>, Schema.Struct<{
144
+ readonly type: Schema.Literal<"thought_summary">;
145
+ readonly content: Schema.Struct<{
146
+ readonly type: Schema.Literal<"text">;
147
+ readonly text: Schema.String;
148
+ }>;
149
+ }>, Schema.decodeTo<Schema.Struct<{
150
+ readonly type: Schema.Literal<"unknown">;
151
+ readonly rawType: Schema.String;
152
+ }>, Schema.Struct<{
153
+ readonly type: Schema.String;
154
+ }>, never, never>]>;
155
+ }>, Schema.Struct<{
156
+ readonly event_type: Schema.Literal<"step.stop">;
157
+ readonly index: Schema.Number;
158
+ }>, Schema.Struct<{
159
+ readonly event_type: Schema.Literal<"interaction.created">;
160
+ readonly interaction: Schema.Struct<{
161
+ readonly id: Schema.optional<Schema.String>;
162
+ }>;
163
+ }>, Schema.Struct<{
164
+ readonly event_type: Schema.Literal<"interaction.status_update">;
165
+ readonly interaction_id: Schema.optional<Schema.String>;
166
+ readonly status: Schema.String;
167
+ readonly continuation_token: Schema.optional<Schema.NullOr<Schema.String>>;
168
+ readonly usage: Schema.optional<Schema.StructWithRest<Schema.Struct<{
169
+ readonly total_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
170
+ readonly total_cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
171
+ readonly total_output_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
172
+ readonly total_thought_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
173
+ readonly total_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
174
+ readonly raw_prompt_token: Schema.optional<Schema.NullOr<Schema.Number>>;
175
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
176
+ }>, Schema.Struct<{
177
+ readonly event_type: Schema.Literal<"interaction.completed">;
178
+ readonly interaction: Schema.StructWithRest<Schema.Struct<{
179
+ readonly id: Schema.optional<Schema.String>;
180
+ readonly status: Schema.String;
181
+ readonly continuation_token: Schema.optional<Schema.NullOr<Schema.String>>;
182
+ readonly usage: Schema.optional<Schema.StructWithRest<Schema.Struct<{
183
+ readonly total_input_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
184
+ readonly total_cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
185
+ readonly total_output_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
186
+ readonly total_thought_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
187
+ readonly total_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
188
+ readonly raw_prompt_token: Schema.optional<Schema.NullOr<Schema.Number>>;
189
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
190
+ readonly errors: Schema.optional<Schema.$Array<Schema.Struct<{
191
+ readonly code: Schema.optional<Schema.String>;
192
+ readonly message: Schema.optional<Schema.String>;
193
+ }>>>;
194
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
195
+ }>, Schema.Struct<{
196
+ readonly event_type: Schema.Literal<"error">;
197
+ readonly error: Schema.optionalKey<Schema.Unknown>;
198
+ }>, Schema.decodeTo<Schema.Struct<{
199
+ readonly event_type: Schema.Literal<"unknown">;
200
+ }>, Schema.Struct<{
201
+ readonly event_type: Schema.String;
202
+ }>, never, never>]>;
203
+ type Event = typeof Event.Type;
34
204
  interface ParserState {
35
205
  readonly route: string;
36
206
  readonly metadataKey: string;
37
207
  readonly lifecycle: Lifecycle.State;
208
+ readonly hop: number;
209
+ readonly hasToolCalls: boolean;
210
+ readonly usage?: RawUsage;
211
+ readonly continuedUsage: ReadonlyArray<RawUsage | undefined>;
38
212
  readonly steps: Partial<Record<number, OutputStep>>;
39
213
  readonly tools: ToolStream.State<number>;
40
214
  }
@@ -49,9 +223,17 @@ export declare const mediaContent: (asset: Media.Asset) => Effect.Effect<{
49
223
  data: string;
50
224
  mime_type: string;
51
225
  }, AIError, never>;
226
+ declare class NextRequest {
227
+ }
228
+ type Body = typeof Body.Type;
229
+ export interface Prepared {
230
+ readonly http: HttpTransport.HttpPrepared<string>;
231
+ readonly input: TransportPrepareInput<Body>;
232
+ }
233
+ export declare const transport: Transport<Body, Prepared, Event | NextRequest>;
52
234
  export declare const protocol: Protocol<{
53
235
  readonly model: string;
54
- readonly input: readonly ({
236
+ readonly input?: readonly ({
55
237
  readonly type: "model_output" | "user_input";
56
238
  readonly content: readonly ({
57
239
  readonly type: "text";
@@ -81,12 +263,17 @@ export declare const protocol: Protocol<{
81
263
  readonly name: string;
82
264
  readonly result: unknown;
83
265
  readonly is_error?: boolean | undefined;
84
- })[];
266
+ })[] | undefined;
85
267
  readonly stream: true;
86
268
  readonly store: boolean;
87
269
  readonly previous_interaction_id?: string | undefined;
270
+ readonly continuation_token?: string | undefined;
88
271
  readonly system_instruction?: string | undefined;
89
272
  readonly service_tier?: string | undefined;
273
+ readonly safety_settings?: readonly {
274
+ readonly type: string;
275
+ readonly threshold: string;
276
+ }[] | undefined;
90
277
  readonly tools?: readonly {
91
278
  readonly type: "function";
92
279
  readonly name: string;
@@ -110,7 +297,97 @@ export declare const protocol: Protocol<{
110
297
  };
111
298
  } | undefined;
112
299
  };
113
- }, string, {
300
+ }, string | NextRequest | {
301
+ readonly event_type: "unknown";
302
+ } | {
303
+ readonly event_type: "step.start";
304
+ readonly index: number;
305
+ readonly step: {
306
+ readonly type: string;
307
+ readonly id?: string | undefined;
308
+ readonly name?: string | undefined;
309
+ readonly arguments?: {
310
+ readonly [x: string]: unknown;
311
+ } | undefined;
312
+ readonly signature?: string | undefined;
313
+ readonly summary?: readonly {
314
+ readonly type: "text";
315
+ readonly text: string;
316
+ }[] | undefined;
317
+ readonly content?: readonly {
318
+ readonly type: string;
319
+ readonly text?: string | undefined;
320
+ }[] | undefined;
321
+ };
322
+ } | {
323
+ readonly event_type: "step.delta";
324
+ readonly index: number;
325
+ readonly delta: {
326
+ readonly type: "unknown";
327
+ readonly rawType: string;
328
+ } | {
329
+ readonly type: "text";
330
+ readonly text: string;
331
+ } | {
332
+ readonly type: "arguments_delta";
333
+ readonly arguments: string;
334
+ } | {
335
+ readonly type: "thought_signature";
336
+ readonly signature: string;
337
+ } | {
338
+ readonly type: "thought_summary";
339
+ readonly content: {
340
+ readonly type: "text";
341
+ readonly text: string;
342
+ };
343
+ };
344
+ } | {
345
+ readonly event_type: "step.stop";
346
+ readonly index: number;
347
+ } | {
348
+ readonly event_type: "interaction.created";
349
+ readonly interaction: {
350
+ readonly id?: string | undefined;
351
+ };
352
+ } | {
353
+ readonly event_type: "interaction.completed";
354
+ readonly interaction: {
355
+ readonly [x: string]: unknown;
356
+ readonly id?: string | undefined;
357
+ readonly status: string;
358
+ readonly continuation_token?: string | null | undefined;
359
+ readonly usage?: {
360
+ readonly [x: string]: unknown;
361
+ readonly total_input_tokens?: number | null | undefined;
362
+ readonly total_cached_tokens?: number | null | undefined;
363
+ readonly total_output_tokens?: number | null | undefined;
364
+ readonly total_thought_tokens?: number | null | undefined;
365
+ readonly total_tokens?: number | null | undefined;
366
+ readonly raw_prompt_token?: number | null | undefined;
367
+ } | undefined;
368
+ readonly errors?: readonly {
369
+ readonly code?: string | undefined;
370
+ readonly message?: string | undefined;
371
+ }[] | undefined;
372
+ };
373
+ } | {
374
+ readonly event_type: "interaction.status_update";
375
+ readonly interaction_id?: string | undefined;
376
+ readonly status: string;
377
+ readonly continuation_token?: string | null | undefined;
378
+ readonly usage?: {
379
+ readonly [x: string]: unknown;
380
+ readonly total_input_tokens?: number | null | undefined;
381
+ readonly total_cached_tokens?: number | null | undefined;
382
+ readonly total_output_tokens?: number | null | undefined;
383
+ readonly total_thought_tokens?: number | null | undefined;
384
+ readonly total_tokens?: number | null | undefined;
385
+ readonly raw_prompt_token?: number | null | undefined;
386
+ } | undefined;
387
+ } | {
388
+ readonly event_type: "error";
389
+ readonly error?: unknown;
390
+ }, NextRequest | {
114
391
  readonly event_type: "unknown";
115
392
  } | {
116
393
  readonly event_type: "step.start";
@@ -168,6 +445,7 @@ export declare const protocol: Protocol<{
168
445
  readonly [x: string]: unknown;
169
446
  readonly id?: string | undefined;
170
447
  readonly status: string;
448
+ readonly continuation_token?: string | null | undefined;
171
449
  readonly usage?: {
172
450
  readonly [x: string]: unknown;
173
451
  readonly total_input_tokens?: number | null | undefined;
@@ -186,13 +464,23 @@ export declare const protocol: Protocol<{
186
464
  readonly event_type: "interaction.status_update";
187
465
  readonly interaction_id?: string | undefined;
188
466
  readonly status: string;
467
+ readonly continuation_token?: string | null | undefined;
468
+ readonly usage?: {
469
+ readonly [x: string]: unknown;
470
+ readonly total_input_tokens?: number | null | undefined;
471
+ readonly total_cached_tokens?: number | null | undefined;
472
+ readonly total_output_tokens?: number | null | undefined;
473
+ readonly total_thought_tokens?: number | null | undefined;
474
+ readonly total_tokens?: number | null | undefined;
475
+ readonly raw_prompt_token?: number | null | undefined;
476
+ } | undefined;
189
477
  } | {
190
478
  readonly event_type: "error";
191
479
  readonly error?: unknown;
192
480
  }, ParserState>;
193
481
  export declare const route: Route<{
194
482
  readonly model: string;
195
- readonly input: readonly ({
483
+ readonly input?: readonly ({
196
484
  readonly type: "model_output" | "user_input";
197
485
  readonly content: readonly ({
198
486
  readonly type: "text";
@@ -222,12 +510,17 @@ export declare const route: Route<{
222
510
  readonly name: string;
223
511
  readonly result: unknown;
224
512
  readonly is_error?: boolean | undefined;
225
- })[];
513
+ })[] | undefined;
226
514
  readonly stream: true;
227
515
  readonly store: boolean;
228
516
  readonly previous_interaction_id?: string | undefined;
517
+ readonly continuation_token?: string | undefined;
229
518
  readonly system_instruction?: string | undefined;
230
519
  readonly service_tier?: string | undefined;
520
+ readonly safety_settings?: readonly {
521
+ readonly type: string;
522
+ readonly threshold: string;
523
+ }[] | undefined;
231
524
  readonly tools?: readonly {
232
525
  readonly type: "function";
233
526
  readonly name: string;
@@ -251,5 +544,5 @@ export declare const route: Route<{
251
544
  };
252
545
  } | undefined;
253
546
  };
254
- }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
547
+ }, Prepared, import("../route/client.js").CompactionOperations | undefined>;
255
548
  export * as GoogleInteractions from "./google-interactions.js";