@opencode/ai 2.1.3 → 2.1.4

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 (106) hide show
  1. package/dist/experimental/evaluation.js +3 -10
  2. package/dist/image-client.d.ts +8 -8
  3. package/dist/image.d.ts +148 -148
  4. package/dist/promise.d.ts +120 -120
  5. package/dist/protocols/alibaba-chat.d.ts +12 -12
  6. package/dist/protocols/alibaba-messages.d.ts +11 -11
  7. package/dist/protocols/alibaba-responses.d.ts +35 -35
  8. package/dist/protocols/anthropic-messages.d.ts +40 -44
  9. package/dist/protocols/anthropic-messages.js +3 -3
  10. package/dist/protocols/bedrock-converse.d.ts +30 -32
  11. package/dist/protocols/bedrock-converse.js +2 -3
  12. package/dist/protocols/cartesia-speech.d.ts +32 -32
  13. package/dist/protocols/cohere-chat.d.ts +7 -8
  14. package/dist/protocols/deepgram-speech.d.ts +32 -32
  15. package/dist/protocols/elevenlabs-speech.d.ts +32 -32
  16. package/dist/protocols/gemini.d.ts +34 -34
  17. package/dist/protocols/gemini.js +2 -2
  18. package/dist/protocols/google-interactions.d.ts +14 -14
  19. package/dist/protocols/google-interactions.js +2 -2
  20. package/dist/protocols/google-speech.d.ts +32 -32
  21. package/dist/protocols/google-transcription.d.ts +32 -32
  22. package/dist/protocols/meta-messages.d.ts +23 -23
  23. package/dist/protocols/meta-responses.d.ts +78 -78
  24. package/dist/protocols/mistral-chat.d.ts +81 -78
  25. package/dist/protocols/mistral-chat.js +2 -1
  26. package/dist/protocols/open-responses-channel.js +47 -46
  27. package/dist/protocols/open-responses-continuation.d.ts +8 -2
  28. package/dist/protocols/open-responses-continuation.js +3 -1
  29. package/dist/protocols/open-responses.d.ts +398 -398
  30. package/dist/protocols/open-responses.js +8 -7
  31. package/dist/protocols/openai-chat.d.ts +60 -60
  32. package/dist/protocols/openai-chat.js +3 -3
  33. package/dist/protocols/openai-compatible-chat.d.ts +13 -14
  34. package/dist/protocols/openai-compatible-responses.d.ts +36 -37
  35. package/dist/protocols/openai-images.d.ts +32 -32
  36. package/dist/protocols/openai-responses.d.ts +235 -235
  37. package/dist/protocols/openai-responses.js +1 -1
  38. package/dist/protocols/openai-speech.d.ts +32 -32
  39. package/dist/protocols/openai-transcription.d.ts +32 -32
  40. package/dist/protocols/openai-transcription.js +12 -7
  41. package/dist/protocols/utils/partial-json-options.d.ts +0 -1
  42. package/dist/protocols/utils/partial-json-options.js +0 -1
  43. package/dist/protocols/utils/tool-stream.d.ts +1 -1
  44. package/dist/protocols/venice-chat.d.ts +52 -53
  45. package/dist/protocols/venice-chat.js +6 -5
  46. package/dist/protocols/xai-responses.d.ts +78 -78
  47. package/dist/protocols/zai-chat.d.ts +33 -30
  48. package/dist/protocols/zai-chat.js +8 -3
  49. package/dist/protocols/zai-messages.d.ts +21 -19
  50. package/dist/protocols/zai-messages.js +3 -2
  51. package/dist/provider-error.js +5 -3
  52. package/dist/providers/alibaba.d.ts +69 -69
  53. package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
  54. package/dist/providers/amazon-bedrock.d.ts +15 -15
  55. package/dist/providers/anthropic-compatible.d.ts +13 -13
  56. package/dist/providers/anthropic.d.ts +13 -13
  57. package/dist/providers/azure.d.ts +106 -106
  58. package/dist/providers/baseten.d.ts +24 -24
  59. package/dist/providers/cerebras.d.ts +24 -24
  60. package/dist/providers/cloudflare-ai-gateway.d.ts +230 -227
  61. package/dist/providers/cloudflare-ai-gateway.js +1 -2
  62. package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
  63. package/dist/providers/cohere.d.ts +75 -75
  64. package/dist/providers/deepinfra.d.ts +24 -24
  65. package/dist/providers/deepseek.d.ts +24 -24
  66. package/dist/providers/digitalocean.d.ts +36 -36
  67. package/dist/providers/fireworks.d.ts +24 -24
  68. package/dist/providers/google-vertex-chat.d.ts +12 -12
  69. package/dist/providers/google-vertex-messages.d.ts +13 -13
  70. package/dist/providers/google-vertex-mistral.d.ts +17 -17
  71. package/dist/providers/google-vertex-responses.d.ts +35 -35
  72. package/dist/providers/google-vertex.d.ts +17 -17
  73. package/dist/providers/google-vertex.js +2 -2
  74. package/dist/providers/google.d.ts +17 -17
  75. package/dist/providers/groq.d.ts +24 -24
  76. package/dist/providers/meta.d.ts +179 -179
  77. package/dist/providers/minimax.d.ts +71 -71
  78. package/dist/providers/mistral.d.ts +28 -28
  79. package/dist/providers/moonshot.d.ts +202 -202
  80. package/dist/providers/open-responses-options.d.ts +0 -1
  81. package/dist/providers/open-responses-options.js +1 -1
  82. package/dist/providers/openai-compatible-responses.d.ts +35 -35
  83. package/dist/providers/openai-compatible.d.ts +12 -12
  84. package/dist/providers/openai-compatible.js +1 -1
  85. package/dist/providers/openai-options.d.ts +0 -1
  86. package/dist/providers/openai-options.js +0 -1
  87. package/dist/providers/openai.d.ts +100 -100
  88. package/dist/providers/openrouter.d.ts +36 -36
  89. package/dist/providers/togetherai.d.ts +24 -24
  90. package/dist/providers/venice.d.ts +195 -20
  91. package/dist/providers/xai.d.ts +12 -12
  92. package/dist/providers/zai-coding-plan.d.ts +149 -69
  93. package/dist/providers/zai.d.ts +84 -19
  94. package/dist/route/auth-options.d.ts +0 -3
  95. package/dist/route/auth.d.ts +0 -2
  96. package/dist/route/auth.js +0 -2
  97. package/dist/route/client.d.ts +0 -2
  98. package/dist/route/client.js +3 -4
  99. package/dist/route/executor-service.js +1 -1
  100. package/dist/speech-client.d.ts +8 -8
  101. package/dist/speech.d.ts +148 -148
  102. package/dist/transcription-client.d.ts +8 -8
  103. package/dist/transcription.d.ts +148 -148
  104. package/dist/video-client.d.ts +8 -8
  105. package/dist/video.d.ts +114 -114
  106. package/package.json +6 -5
@@ -158,27 +158,10 @@ export declare const protocol: Protocol<{
158
158
  readonly contents: readonly {
159
159
  readonly role?: "model" | "user" | null | undefined;
160
160
  readonly parts?: readonly ({
161
- readonly inlineData: {
162
- readonly mimeType: string;
163
- readonly data: string;
164
- };
165
- readonly thoughtSignature?: string | null | undefined;
166
- } | {
167
- readonly text: string;
168
- readonly thought?: boolean | null | undefined;
169
- readonly thoughtSignature?: string | null | undefined;
170
- } | {
171
161
  readonly fileData: {
172
162
  readonly mimeType: string;
173
163
  readonly fileUri: string;
174
164
  };
175
- } | {
176
- readonly functionCall: {
177
- readonly id?: string | null | undefined;
178
- readonly name: string;
179
- readonly args?: unknown;
180
- };
181
- readonly thoughtSignature?: string | null | undefined;
182
165
  } | {
183
166
  readonly functionResponse: {
184
167
  readonly id?: string | undefined;
@@ -192,6 +175,23 @@ export declare const protocol: Protocol<{
192
175
  readonly thoughtSignature?: string | null | undefined;
193
176
  }[] | undefined;
194
177
  };
178
+ } | {
179
+ readonly text: string;
180
+ readonly thought?: boolean | null | undefined;
181
+ readonly thoughtSignature?: string | null | undefined;
182
+ } | {
183
+ readonly inlineData: {
184
+ readonly mimeType: string;
185
+ readonly data: string;
186
+ };
187
+ readonly thoughtSignature?: string | null | undefined;
188
+ } | {
189
+ readonly functionCall: {
190
+ readonly id?: string | null | undefined;
191
+ readonly name: string;
192
+ readonly args?: unknown;
193
+ };
194
+ readonly thoughtSignature?: string | null | undefined;
195
195
  })[] | null | undefined;
196
196
  }[];
197
197
  readonly labels?: {
@@ -298,27 +298,10 @@ export declare const route: Route<{
298
298
  readonly contents: readonly {
299
299
  readonly role?: "model" | "user" | null | undefined;
300
300
  readonly parts?: readonly ({
301
- readonly inlineData: {
302
- readonly mimeType: string;
303
- readonly data: string;
304
- };
305
- readonly thoughtSignature?: string | null | undefined;
306
- } | {
307
- readonly text: string;
308
- readonly thought?: boolean | null | undefined;
309
- readonly thoughtSignature?: string | null | undefined;
310
- } | {
311
301
  readonly fileData: {
312
302
  readonly mimeType: string;
313
303
  readonly fileUri: string;
314
304
  };
315
- } | {
316
- readonly functionCall: {
317
- readonly id?: string | null | undefined;
318
- readonly name: string;
319
- readonly args?: unknown;
320
- };
321
- readonly thoughtSignature?: string | null | undefined;
322
305
  } | {
323
306
  readonly functionResponse: {
324
307
  readonly id?: string | undefined;
@@ -332,6 +315,23 @@ export declare const route: Route<{
332
315
  readonly thoughtSignature?: string | null | undefined;
333
316
  }[] | undefined;
334
317
  };
318
+ } | {
319
+ readonly text: string;
320
+ readonly thought?: boolean | null | undefined;
321
+ readonly thoughtSignature?: string | null | undefined;
322
+ } | {
323
+ readonly inlineData: {
324
+ readonly mimeType: string;
325
+ readonly data: string;
326
+ };
327
+ readonly thoughtSignature?: string | null | undefined;
328
+ } | {
329
+ readonly functionCall: {
330
+ readonly id?: string | null | undefined;
331
+ readonly name: string;
332
+ readonly args?: unknown;
333
+ };
334
+ readonly thoughtSignature?: string | null | undefined;
335
335
  })[] | null | undefined;
336
336
  }[];
337
337
  readonly labels?: {
@@ -224,7 +224,7 @@ const lowerToolCall = (part, omitIds, metadataKey) => ({
224
224
  });
225
225
  const lowerMessages = Effect.fnUntraced(function* (request) {
226
226
  const contents = [];
227
- const metadataKey = request.model.route.providerMetadataKey ?? String(request.model.provider);
227
+ const metadataKey = request.model.route.providerMetadataKey ?? request.model.provider;
228
228
  const omitCallIds = omitsFunctionCallIds(request.model.id);
229
229
  const legacyToolMedia = routesLegacyToolMedia(request.model.id);
230
230
  let pendingMedia;
@@ -750,7 +750,7 @@ export const protocol = Protocol.make({
750
750
  event: Schema.Union([Schema.instanceOf(NextRequest), GeminiEvent]),
751
751
  initial: (request) => ({
752
752
  route: `${request.model.provider}/${request.model.route.id}`,
753
- providerMetadataKey: request.model.route.providerMetadataKey ?? String(request.model.provider),
753
+ providerMetadataKey: request.model.route.providerMetadataKey ?? request.model.provider,
754
754
  hasToolCalls: false,
755
755
  lifecycle: Lifecycle.initial(),
756
756
  nextReasoningId: 0,
@@ -42,13 +42,13 @@ export declare const protocol: Protocol<{
42
42
  readonly input: readonly ({
43
43
  readonly type: "model_output" | "user_input";
44
44
  readonly content: readonly ({
45
+ readonly type: "text";
46
+ readonly text: string;
47
+ } | {
45
48
  readonly type: "audio" | "document" | "image" | "video";
46
49
  readonly data?: string | undefined;
47
50
  readonly uri?: string | undefined;
48
51
  readonly mime_type: string;
49
- } | {
50
- readonly type: "text";
51
- readonly text: string;
52
52
  })[];
53
53
  } | {
54
54
  readonly type: "thought";
@@ -99,6 +99,8 @@ export declare const protocol: Protocol<{
99
99
  } | undefined;
100
100
  };
101
101
  }, string, {
102
+ readonly event_type: "unknown";
103
+ } | {
102
104
  readonly event_type: "step.start";
103
105
  readonly index: number;
104
106
  readonly step: {
@@ -122,6 +124,9 @@ export declare const protocol: Protocol<{
122
124
  readonly event_type: "step.delta";
123
125
  readonly index: number;
124
126
  readonly delta: {
127
+ readonly type: "unknown";
128
+ readonly rawType: string;
129
+ } | {
125
130
  readonly type: "text";
126
131
  readonly text: string;
127
132
  } | {
@@ -136,9 +141,6 @@ export declare const protocol: Protocol<{
136
141
  readonly type: "text";
137
142
  readonly text: string;
138
143
  };
139
- } | {
140
- readonly type: "unknown";
141
- readonly rawType: string;
142
144
  };
143
145
  } | {
144
146
  readonly event_type: "step.stop";
@@ -148,10 +150,6 @@ export declare const protocol: Protocol<{
148
150
  readonly interaction: {
149
151
  readonly id?: string | undefined;
150
152
  };
151
- } | {
152
- readonly event_type: "interaction.status_update";
153
- readonly interaction_id?: string | undefined;
154
- readonly status: string;
155
153
  } | {
156
154
  readonly event_type: "interaction.completed";
157
155
  readonly interaction: {
@@ -172,20 +170,22 @@ export declare const protocol: Protocol<{
172
170
  readonly event_type: "error";
173
171
  readonly error: unknown;
174
172
  } | {
175
- readonly event_type: "unknown";
173
+ readonly event_type: "interaction.status_update";
174
+ readonly interaction_id?: string | undefined;
175
+ readonly status: string;
176
176
  }, ParserState>;
177
177
  export declare const route: Route<{
178
178
  readonly model: string;
179
179
  readonly input: readonly ({
180
180
  readonly type: "model_output" | "user_input";
181
181
  readonly content: readonly ({
182
+ readonly type: "text";
183
+ readonly text: string;
184
+ } | {
182
185
  readonly type: "audio" | "document" | "image" | "video";
183
186
  readonly data?: string | undefined;
184
187
  readonly uri?: string | undefined;
185
188
  readonly mime_type: string;
186
- } | {
187
- readonly type: "text";
188
- readonly text: string;
189
189
  })[];
190
190
  } | {
191
191
  readonly type: "thought";
@@ -184,7 +184,7 @@ const signature = (metadata, key) => {
184
184
  };
185
185
  const lowerMessages = Effect.fnUntraced(function* (request) {
186
186
  const steps = [];
187
- const key = request.model.route.providerMetadataKey ?? String(request.model.provider);
187
+ const key = request.model.route.providerMetadataKey ?? request.model.provider;
188
188
  for (const message of request.messages) {
189
189
  if (message.role === "system") {
190
190
  const part = yield* ProviderShared.wrappedSystemUpdate("Google Interactions", message);
@@ -476,7 +476,7 @@ export const protocol = Protocol.make({
476
476
  event: Protocol.jsonEvent(Event),
477
477
  initial: (request) => ({
478
478
  route: `${request.model.provider}/${ADAPTER}`,
479
- metadataKey: request.model.route.providerMetadataKey ?? String(request.model.provider),
479
+ metadataKey: request.model.route.providerMetadataKey ?? request.model.provider,
480
480
  lifecycle: Lifecycle.initial(),
481
481
  steps: {},
482
482
  tools: ToolStream.empty(),
@@ -26,14 +26,6 @@ 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 type: "generation-queued";
30
- readonly id: string;
31
- readonly position?: number | undefined;
32
- } | {
33
- readonly type: "generation-progress";
34
- readonly id: string;
35
- readonly progress?: number | undefined;
36
- } | {
37
29
  readonly type: "audio-delta";
38
30
  readonly chunk: Uint8Array<ArrayBufferLike>;
39
31
  } | {
@@ -43,18 +35,18 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
43
35
  readonly startSeconds: number;
44
36
  readonly endSeconds: number;
45
37
  }[];
38
+ } | {
39
+ readonly type: "generation-queued";
40
+ readonly id: string;
41
+ readonly position?: number | undefined;
42
+ } | {
43
+ readonly type: "generation-progress";
44
+ readonly id: string;
45
+ readonly progress?: number | undefined;
46
46
  } | {
47
47
  readonly type: "finish";
48
48
  readonly audio: import("../media.js").Asset;
49
49
  readonly usage?: {
50
- readonly type: "tokens";
51
- readonly input?: number | undefined;
52
- readonly output?: number | undefined;
53
- readonly total?: number | undefined;
54
- readonly details?: {
55
- readonly [x: string]: unknown;
56
- } | undefined;
57
- } | {
58
50
  readonly type: "seconds";
59
51
  readonly seconds: number;
60
52
  } | {
@@ -66,6 +58,14 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
66
58
  } | {
67
59
  readonly type: "compute";
68
60
  readonly seconds: number;
61
+ } | {
62
+ readonly type: "tokens";
63
+ readonly input?: number | undefined;
64
+ readonly output?: number | undefined;
65
+ readonly total?: number | undefined;
66
+ readonly details?: {
67
+ readonly [x: string]: unknown;
68
+ } | undefined;
69
69
  } | undefined;
70
70
  readonly notices?: readonly {
71
71
  readonly type: "filtered" | "moderated" | "other";
@@ -85,14 +85,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
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 type: "generation-queued";
89
- readonly id: string;
90
- readonly position?: number | undefined;
91
- } | {
92
- readonly type: "generation-progress";
93
- readonly id: string;
94
- readonly progress?: number | undefined;
95
- } | {
96
88
  readonly type: "audio-delta";
97
89
  readonly chunk: Uint8Array<ArrayBufferLike>;
98
90
  } | {
@@ -102,18 +94,18 @@ export declare const GoogleSpeech: {
102
94
  readonly startSeconds: number;
103
95
  readonly endSeconds: number;
104
96
  }[];
97
+ } | {
98
+ readonly type: "generation-queued";
99
+ readonly id: string;
100
+ readonly position?: number | undefined;
101
+ } | {
102
+ readonly type: "generation-progress";
103
+ readonly id: string;
104
+ readonly progress?: number | undefined;
105
105
  } | {
106
106
  readonly type: "finish";
107
107
  readonly audio: import("../media.js").Asset;
108
108
  readonly usage?: {
109
- readonly type: "tokens";
110
- readonly input?: number | undefined;
111
- readonly output?: number | undefined;
112
- readonly total?: number | undefined;
113
- readonly details?: {
114
- readonly [x: string]: unknown;
115
- } | undefined;
116
- } | {
117
109
  readonly type: "seconds";
118
110
  readonly seconds: number;
119
111
  } | {
@@ -125,6 +117,14 @@ export declare const GoogleSpeech: {
125
117
  } | {
126
118
  readonly type: "compute";
127
119
  readonly seconds: number;
120
+ } | {
121
+ readonly type: "tokens";
122
+ readonly input?: number | undefined;
123
+ readonly output?: number | undefined;
124
+ readonly total?: number | undefined;
125
+ readonly details?: {
126
+ readonly [x: string]: unknown;
127
+ } | undefined;
128
128
  } | undefined;
129
129
  readonly notices?: readonly {
130
130
  readonly type: "filtered" | "moderated" | "other";
@@ -22,14 +22,6 @@ interface State extends GeminiGenerateContent.Metadata {
22
22
  readonly words: Array<TranscriptionWord>;
23
23
  }
24
24
  export declare const protocol: MediaProtocol.Streamed<Request, {
25
- readonly type: "generation-queued";
26
- readonly id: string;
27
- readonly position?: number | undefined;
28
- } | {
29
- readonly type: "generation-progress";
30
- readonly id: string;
31
- readonly progress?: number | undefined;
32
- } | {
33
25
  readonly type: "text-delta";
34
26
  readonly delta: string;
35
27
  } | {
@@ -40,6 +32,14 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
40
32
  readonly endSeconds: number;
41
33
  readonly speaker?: string | undefined;
42
34
  };
35
+ } | {
36
+ readonly type: "generation-queued";
37
+ readonly id: string;
38
+ readonly position?: number | undefined;
39
+ } | {
40
+ readonly type: "generation-progress";
41
+ readonly id: string;
42
+ readonly progress?: number | undefined;
43
43
  } | {
44
44
  readonly text: string;
45
45
  readonly segments?: readonly {
@@ -58,14 +58,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
58
58
  readonly language?: string | undefined;
59
59
  readonly durationSeconds?: number | undefined;
60
60
  readonly usage?: {
61
- readonly type: "tokens";
62
- readonly input?: number | undefined;
63
- readonly output?: number | undefined;
64
- readonly total?: number | undefined;
65
- readonly details?: {
66
- readonly [x: string]: unknown;
67
- } | undefined;
68
- } | {
69
61
  readonly type: "seconds";
70
62
  readonly seconds: number;
71
63
  } | {
@@ -77,6 +69,14 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
77
69
  } | {
78
70
  readonly type: "compute";
79
71
  readonly seconds: number;
72
+ } | {
73
+ readonly type: "tokens";
74
+ readonly input?: number | undefined;
75
+ readonly output?: number | undefined;
76
+ readonly total?: number | undefined;
77
+ readonly details?: {
78
+ readonly [x: string]: unknown;
79
+ } | undefined;
80
80
  } | undefined;
81
81
  readonly notices?: readonly {
82
82
  readonly type: "filtered" | "moderated" | "other";
@@ -97,14 +97,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
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 type: "generation-queued";
101
- readonly id: string;
102
- readonly position?: number | undefined;
103
- } | {
104
- readonly type: "generation-progress";
105
- readonly id: string;
106
- readonly progress?: number | undefined;
107
- } | {
108
100
  readonly type: "text-delta";
109
101
  readonly delta: string;
110
102
  } | {
@@ -115,6 +107,14 @@ export declare const GoogleTranscription: {
115
107
  readonly endSeconds: number;
116
108
  readonly speaker?: string | undefined;
117
109
  };
110
+ } | {
111
+ readonly type: "generation-queued";
112
+ readonly id: string;
113
+ readonly position?: number | undefined;
114
+ } | {
115
+ readonly type: "generation-progress";
116
+ readonly id: string;
117
+ readonly progress?: number | undefined;
118
118
  } | {
119
119
  readonly text: string;
120
120
  readonly segments?: readonly {
@@ -133,14 +133,6 @@ export declare const GoogleTranscription: {
133
133
  readonly language?: string | undefined;
134
134
  readonly durationSeconds?: number | undefined;
135
135
  readonly usage?: {
136
- readonly type: "tokens";
137
- readonly input?: number | undefined;
138
- readonly output?: number | undefined;
139
- readonly total?: number | undefined;
140
- readonly details?: {
141
- readonly [x: string]: unknown;
142
- } | undefined;
143
- } | {
144
136
  readonly type: "seconds";
145
137
  readonly seconds: number;
146
138
  } | {
@@ -152,6 +144,14 @@ export declare const GoogleTranscription: {
152
144
  } | {
153
145
  readonly type: "compute";
154
146
  readonly seconds: number;
147
+ } | {
148
+ readonly type: "tokens";
149
+ readonly input?: number | undefined;
150
+ readonly output?: number | undefined;
151
+ readonly total?: number | undefined;
152
+ readonly details?: {
153
+ readonly [x: string]: unknown;
154
+ } | undefined;
155
155
  } | undefined;
156
156
  readonly notices?: readonly {
157
157
  readonly type: "filtered" | "moderated" | "other";
@@ -141,23 +141,15 @@ export declare const protocol: Protocol<{
141
141
  } | {
142
142
  readonly role: "assistant";
143
143
  readonly content: readonly ({
144
+ readonly type: "compaction";
145
+ readonly content: string | null;
146
+ } | {
144
147
  readonly type: "text";
145
148
  readonly text: string;
146
149
  readonly cache_control?: {
147
150
  readonly type: "ephemeral";
148
151
  readonly ttl?: "1h" | "5m" | undefined;
149
152
  } | undefined;
150
- } | {
151
- readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
152
- readonly tool_use_id: string;
153
- readonly content: unknown;
154
- readonly cache_control?: {
155
- readonly type: "ephemeral";
156
- readonly ttl?: "1h" | "5m" | undefined;
157
- } | undefined;
158
- } | {
159
- readonly type: "compaction";
160
- readonly content: string | null;
161
153
  } | {
162
154
  readonly type: "thinking";
163
155
  readonly thinking: string;
@@ -191,6 +183,14 @@ export declare const protocol: Protocol<{
191
183
  readonly type: "ephemeral";
192
184
  readonly ttl?: "1h" | "5m" | undefined;
193
185
  } | undefined;
186
+ } | {
187
+ readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
188
+ readonly tool_use_id: string;
189
+ readonly content: unknown;
190
+ readonly cache_control?: {
191
+ readonly type: "ephemeral";
192
+ readonly ttl?: "1h" | "5m" | undefined;
193
+ } | undefined;
194
194
  })[];
195
195
  } | {
196
196
  readonly role: "system";
@@ -221,6 +221,8 @@ export declare const protocol: Protocol<{
221
221
  readonly top_k?: number | undefined;
222
222
  readonly stop_sequences?: readonly string[] | undefined;
223
223
  readonly thinking?: {
224
+ readonly type: "between_tools" | "disabled";
225
+ } | {
224
226
  readonly display?: import("../schema/options.js").OpenString<"omitted" | "summarized"> | undefined;
225
227
  readonly block_binding?: {
226
228
  readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"drop_block" | "error"> | undefined;
@@ -233,8 +235,6 @@ export declare const protocol: Protocol<{
233
235
  readonly prefix_mismatch_behavior?: import("../schema/options.js").OpenString<"drop_block" | "error"> | undefined;
234
236
  } | undefined;
235
237
  readonly type: "adaptive";
236
- } | {
237
- readonly type: "between_tools" | "disabled";
238
238
  } | undefined;
239
239
  readonly output_config?: {
240
240
  readonly effort?: string | undefined;
@@ -261,16 +261,6 @@ export declare const protocol: Protocol<{
261
261
  } | undefined;
262
262
  readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
263
263
  readonly tools?: readonly ({
264
- readonly name: string;
265
- readonly description: string;
266
- readonly input_schema: {
267
- readonly [x: string]: unknown;
268
- };
269
- readonly cache_control?: {
270
- readonly type: "ephemeral";
271
- readonly ttl?: "1h" | "5m" | undefined;
272
- } | undefined;
273
- } | {
274
264
  readonly type: "web_search";
275
265
  readonly name: "web_search";
276
266
  readonly user_location?: {
@@ -280,6 +270,16 @@ export declare const protocol: Protocol<{
280
270
  readonly country?: string | undefined;
281
271
  readonly timezone?: string | undefined;
282
272
  } | undefined;
273
+ } | {
274
+ readonly name: string;
275
+ readonly description: string;
276
+ readonly input_schema: {
277
+ readonly [x: string]: unknown;
278
+ };
279
+ readonly cache_control?: {
280
+ readonly type: "ephemeral";
281
+ readonly ttl?: "1h" | "5m" | undefined;
282
+ } | undefined;
283
283
  })[] | undefined;
284
284
  }, string, {
285
285
  readonly [x: string]: unknown;