@opencode-ai/ai 0.0.0-bootstrap.0 → 0.0.0-next-15617

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +176 -1
  2. package/dist/cache-policy.d.ts +2 -0
  3. package/dist/cache-policy.js +108 -0
  4. package/dist/index.d.ts +14 -0
  5. package/dist/index.js +9 -0
  6. package/dist/llm.d.ts +223 -0
  7. package/dist/llm.js +81 -0
  8. package/dist/protocols/anthropic-messages.d.ts +503 -0
  9. package/dist/protocols/anthropic-messages.js +745 -0
  10. package/dist/protocols/bedrock-converse.d.ts +476 -0
  11. package/dist/protocols/bedrock-converse.js +526 -0
  12. package/dist/protocols/bedrock-event-stream.d.ts +9 -0
  13. package/dist/protocols/bedrock-event-stream.js +64 -0
  14. package/dist/protocols/gemini.d.ts +220 -0
  15. package/dist/protocols/gemini.js +420 -0
  16. package/dist/protocols/google-vertex-anthropic.d.ts +494 -0
  17. package/dist/protocols/google-vertex-anthropic.js +33 -0
  18. package/dist/protocols/google-vertex-gemini.d.ts +59 -0
  19. package/dist/protocols/google-vertex-gemini.js +18 -0
  20. package/dist/protocols/index.d.ts +9 -0
  21. package/dist/protocols/index.js +9 -0
  22. package/dist/protocols/openai-chat.d.ts +391 -0
  23. package/dist/protocols/openai-chat.js +423 -0
  24. package/dist/protocols/openai-compatible-chat.d.ts +73 -0
  25. package/dist/protocols/openai-compatible-chat.js +20 -0
  26. package/dist/protocols/openai-compatible-responses.d.ts +85 -0
  27. package/dist/protocols/openai-compatible-responses.js +18 -0
  28. package/dist/protocols/openai-responses.d.ts +613 -0
  29. package/dist/protocols/openai-responses.js +828 -0
  30. package/dist/protocols/shared.d.ts +192 -0
  31. package/dist/protocols/shared.js +236 -0
  32. package/dist/protocols/utils/bedrock-auth.d.ts +18 -0
  33. package/dist/protocols/utils/bedrock-auth.js +41 -0
  34. package/dist/protocols/utils/bedrock-cache.d.ts +15 -0
  35. package/dist/protocols/utils/bedrock-cache.js +29 -0
  36. package/dist/protocols/utils/bedrock-media.d.ts +49 -0
  37. package/dist/protocols/utils/bedrock-media.js +68 -0
  38. package/dist/protocols/utils/cache.d.ts +6 -0
  39. package/dist/protocols/utils/cache.js +8 -0
  40. package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
  41. package/dist/protocols/utils/gemini-tool-schema.js +83 -0
  42. package/dist/protocols/utils/lifecycle.d.ts +19 -0
  43. package/dist/protocols/utils/lifecycle.js +65 -0
  44. package/dist/protocols/utils/openai-options.d.ts +22 -0
  45. package/dist/protocols/utils/openai-options.js +64 -0
  46. package/dist/protocols/utils/tool-schema.d.ts +7 -0
  47. package/dist/protocols/utils/tool-schema.js +79 -0
  48. package/dist/protocols/utils/tool-stream.d.ts +155 -0
  49. package/dist/protocols/utils/tool-stream.js +136 -0
  50. package/dist/protocols.d.ts +1 -0
  51. package/dist/protocols.js +1 -0
  52. package/dist/provider-error.d.ts +13 -0
  53. package/dist/provider-error.js +122 -0
  54. package/dist/provider-package.d.ts +13 -0
  55. package/dist/provider-package.js +1 -0
  56. package/dist/provider.d.ts +23 -0
  57. package/dist/provider.js +2 -0
  58. package/dist/providers/amazon-bedrock.d.ts +150 -0
  59. package/dist/providers/amazon-bedrock.js +41 -0
  60. package/dist/providers/anthropic-compatible.d.ts +183 -0
  61. package/dist/providers/anthropic-compatible.js +44 -0
  62. package/dist/providers/anthropic.d.ts +181 -0
  63. package/dist/providers/anthropic.js +39 -0
  64. package/dist/providers/azure/chat.d.ts +2 -0
  65. package/dist/providers/azure/chat.js +1 -0
  66. package/dist/providers/azure/responses.d.ts +2 -0
  67. package/dist/providers/azure/responses.js +1 -0
  68. package/dist/providers/azure.d.ts +183 -0
  69. package/dist/providers/azure.js +89 -0
  70. package/dist/providers/cloudflare.d.ts +232 -0
  71. package/dist/providers/cloudflare.js +87 -0
  72. package/dist/providers/github-copilot.d.ts +167 -0
  73. package/dist/providers/github-copilot.js +47 -0
  74. package/dist/providers/google-vertex/anthropic.d.ts +2 -0
  75. package/dist/providers/google-vertex/anthropic.js +1 -0
  76. package/dist/providers/google-vertex-anthropic.d.ts +181 -0
  77. package/dist/providers/google-vertex-anthropic.js +46 -0
  78. package/dist/providers/google-vertex-shared.d.ts +22 -0
  79. package/dist/providers/google-vertex-shared.js +61 -0
  80. package/dist/providers/google-vertex.d.ts +93 -0
  81. package/dist/providers/google-vertex.js +49 -0
  82. package/dist/providers/google.d.ts +85 -0
  83. package/dist/providers/google.js +33 -0
  84. package/dist/providers/index.d.ts +15 -0
  85. package/dist/providers/index.js +15 -0
  86. package/dist/providers/openai/chat.d.ts +2 -0
  87. package/dist/providers/openai/chat.js +1 -0
  88. package/dist/providers/openai/responses.d.ts +2 -0
  89. package/dist/providers/openai/responses.js +1 -0
  90. package/dist/providers/openai-compatible/responses.d.ts +1 -0
  91. package/dist/providers/openai-compatible/responses.js +1 -0
  92. package/dist/providers/openai-compatible-profile.d.ts +43 -0
  93. package/dist/providers/openai-compatible-profile.js +12 -0
  94. package/dist/providers/openai-compatible-responses.d.ts +107 -0
  95. package/dist/providers/openai-compatible-responses.js +33 -0
  96. package/dist/providers/openai-compatible.d.ts +130 -0
  97. package/dist/providers/openai-compatible.js +55 -0
  98. package/dist/providers/openai-options.d.ts +30 -0
  99. package/dist/providers/openai-options.js +42 -0
  100. package/dist/providers/openai.d.ts +264 -0
  101. package/dist/providers/openai.js +62 -0
  102. package/dist/providers/openrouter.d.ts +321 -0
  103. package/dist/providers/openrouter.js +65 -0
  104. package/dist/providers/xai.d.ts +169 -0
  105. package/dist/providers/xai.js +43 -0
  106. package/dist/providers.d.ts +1 -0
  107. package/dist/providers.js +1 -0
  108. package/dist/route/auth-options.d.ts +34 -0
  109. package/dist/route/auth-options.js +14 -0
  110. package/dist/route/auth.d.ts +49 -0
  111. package/dist/route/auth.js +89 -0
  112. package/dist/route/client.d.ts +330 -0
  113. package/dist/route/client.js +211 -0
  114. package/dist/route/endpoint.d.ts +28 -0
  115. package/dist/route/endpoint.js +21 -0
  116. package/dist/route/executor.d.ts +12 -0
  117. package/dist/route/executor.js +229 -0
  118. package/dist/route/framing.d.ts +23 -0
  119. package/dist/route/framing.js +4 -0
  120. package/dist/route/index.d.ts +16 -0
  121. package/dist/route/index.js +9 -0
  122. package/dist/route/protocol.d.ts +76 -0
  123. package/dist/route/protocol.js +17 -0
  124. package/dist/route/transport/http.d.ts +33 -0
  125. package/dist/route/transport/http.js +98 -0
  126. package/dist/route/transport/index.d.ts +27 -0
  127. package/dist/route/transport/index.js +4 -0
  128. package/dist/route/transport/websocket.d.ts +56 -0
  129. package/dist/route/transport/websocket.js +181 -0
  130. package/dist/route.d.ts +1 -0
  131. package/dist/route.js +1 -0
  132. package/dist/schema/errors.d.ts +153 -0
  133. package/dist/schema/errors.js +150 -0
  134. package/dist/schema/events.d.ts +4292 -0
  135. package/dist/schema/events.js +482 -0
  136. package/dist/schema/ids.d.ts +30 -0
  137. package/dist/schema/ids.js +18 -0
  138. package/dist/schema/index.d.ts +5 -0
  139. package/dist/schema/index.js +5 -0
  140. package/dist/schema/messages.d.ts +385 -0
  141. package/dist/schema/messages.js +246 -0
  142. package/dist/schema/options.d.ts +143 -0
  143. package/dist/schema/options.js +195 -0
  144. package/dist/tool-runtime.d.ts +15 -0
  145. package/dist/tool-runtime.js +35 -0
  146. package/dist/tool.d.ts +134 -0
  147. package/dist/tool.js +66 -0
  148. package/dist/utils/record.d.ts +2 -0
  149. package/dist/utils/record.js +2 -0
  150. package/package.json +36 -9
  151. package/index.js +0 -1
@@ -0,0 +1,503 @@
1
+ import { Schema } from "effect";
2
+ import { Route } from "../route/client";
3
+ import { Protocol } from "../route/protocol";
4
+ import { Lifecycle } from "./utils/lifecycle";
5
+ import { ToolStream } from "./utils/tool-stream";
6
+ export declare const DEFAULT_BASE_URL = "https://api.anthropic.com/v1";
7
+ export declare const PATH = "/messages";
8
+ export declare const AnthropicMessagesBody: Schema.Struct<{
9
+ model: Schema.String;
10
+ system: Schema.optional<Schema.$Array<Schema.Struct<{
11
+ readonly type: Schema.tag<"text">;
12
+ readonly text: Schema.String;
13
+ readonly cache_control: Schema.optional<Schema.Struct<{
14
+ readonly type: Schema.tag<"ephemeral">;
15
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
16
+ }>>;
17
+ }>>>;
18
+ messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
19
+ readonly role: Schema.Literal<"user">;
20
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
21
+ readonly type: Schema.tag<"text">;
22
+ readonly text: Schema.String;
23
+ readonly cache_control: Schema.optional<Schema.Struct<{
24
+ readonly type: Schema.tag<"ephemeral">;
25
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
26
+ }>>;
27
+ }>, Schema.Struct<{
28
+ readonly type: Schema.tag<"image">;
29
+ readonly source: Schema.Struct<{
30
+ readonly type: Schema.tag<"base64">;
31
+ readonly media_type: Schema.String;
32
+ readonly data: Schema.String;
33
+ }>;
34
+ readonly cache_control: Schema.optional<Schema.Struct<{
35
+ readonly type: Schema.tag<"ephemeral">;
36
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
37
+ }>>;
38
+ }>, Schema.Struct<{
39
+ readonly type: Schema.tag<"tool_result">;
40
+ readonly tool_use_id: Schema.String;
41
+ readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
42
+ readonly type: Schema.tag<"text">;
43
+ readonly text: Schema.String;
44
+ readonly cache_control: Schema.optional<Schema.Struct<{
45
+ readonly type: Schema.tag<"ephemeral">;
46
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
47
+ }>>;
48
+ }>, Schema.Struct<{
49
+ readonly type: Schema.tag<"image">;
50
+ readonly source: Schema.Struct<{
51
+ readonly type: Schema.tag<"base64">;
52
+ readonly media_type: Schema.String;
53
+ readonly data: Schema.String;
54
+ }>;
55
+ readonly cache_control: Schema.optional<Schema.Struct<{
56
+ readonly type: Schema.tag<"ephemeral">;
57
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
58
+ }>>;
59
+ }>]>>]>;
60
+ readonly is_error: Schema.optional<Schema.Boolean>;
61
+ readonly cache_control: Schema.optional<Schema.Struct<{
62
+ readonly type: Schema.tag<"ephemeral">;
63
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
64
+ }>>;
65
+ }>]>>;
66
+ }>, Schema.Struct<{
67
+ readonly role: Schema.Literal<"assistant">;
68
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
69
+ readonly type: Schema.tag<"text">;
70
+ readonly text: Schema.String;
71
+ readonly cache_control: Schema.optional<Schema.Struct<{
72
+ readonly type: Schema.tag<"ephemeral">;
73
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
74
+ }>>;
75
+ }>, Schema.Struct<{
76
+ readonly type: Schema.tag<"thinking">;
77
+ readonly thinking: Schema.String;
78
+ readonly signature: Schema.optional<Schema.String>;
79
+ readonly cache_control: Schema.optional<Schema.Struct<{
80
+ readonly type: Schema.tag<"ephemeral">;
81
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
82
+ }>>;
83
+ }>, Schema.Struct<{
84
+ readonly type: Schema.tag<"tool_use">;
85
+ readonly id: Schema.String;
86
+ readonly name: Schema.String;
87
+ readonly input: Schema.Unknown;
88
+ readonly cache_control: Schema.optional<Schema.Struct<{
89
+ readonly type: Schema.tag<"ephemeral">;
90
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
91
+ }>>;
92
+ }>, Schema.Struct<{
93
+ readonly type: Schema.tag<"server_tool_use">;
94
+ readonly id: Schema.String;
95
+ readonly name: Schema.String;
96
+ readonly input: Schema.Unknown;
97
+ readonly cache_control: Schema.optional<Schema.Struct<{
98
+ readonly type: Schema.tag<"ephemeral">;
99
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
100
+ }>>;
101
+ }>, Schema.Struct<{
102
+ readonly type: Schema.Literals<readonly ["web_search_tool_result", "code_execution_tool_result", "web_fetch_tool_result"]>;
103
+ readonly tool_use_id: Schema.String;
104
+ readonly content: Schema.Unknown;
105
+ readonly cache_control: Schema.optional<Schema.Struct<{
106
+ readonly type: Schema.tag<"ephemeral">;
107
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
108
+ }>>;
109
+ }>]>>;
110
+ }>, Schema.Struct<{
111
+ readonly role: Schema.Literal<"system">;
112
+ readonly content: Schema.$Array<Schema.Struct<{
113
+ readonly type: Schema.tag<"text">;
114
+ readonly text: Schema.String;
115
+ readonly cache_control: Schema.optional<Schema.Struct<{
116
+ readonly type: Schema.tag<"ephemeral">;
117
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
118
+ }>>;
119
+ }>>;
120
+ }>]>>;
121
+ tools: Schema.optional<Schema.$Array<Schema.Struct<{
122
+ readonly name: Schema.String;
123
+ readonly description: Schema.String;
124
+ readonly input_schema: Schema.$Record<Schema.String, Schema.Unknown>;
125
+ readonly cache_control: Schema.optional<Schema.Struct<{
126
+ readonly type: Schema.tag<"ephemeral">;
127
+ readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
128
+ }>>;
129
+ }>>>;
130
+ tool_choice: Schema.optional<Schema.Union<readonly [Schema.Struct<{
131
+ readonly type: Schema.Literals<readonly ["auto", "any"]>;
132
+ }>, Schema.Struct<{
133
+ readonly type: Schema.tag<"tool">;
134
+ readonly name: Schema.String;
135
+ }>]>>;
136
+ stream: Schema.Literal<true>;
137
+ max_tokens: Schema.Number;
138
+ temperature: Schema.optional<Schema.Number>;
139
+ top_p: Schema.optional<Schema.Number>;
140
+ top_k: Schema.optional<Schema.Number>;
141
+ stop_sequences: Schema.optional<Schema.$Array<Schema.String>>;
142
+ thinking: Schema.optional<Schema.Union<readonly [Schema.Struct<{
143
+ readonly type: Schema.tag<"enabled">;
144
+ readonly budget_tokens: Schema.Number;
145
+ }>, Schema.Struct<{
146
+ readonly type: Schema.tag<"adaptive">;
147
+ readonly display: Schema.optional<Schema.Literals<readonly ["summarized", "omitted"]>>;
148
+ }>, Schema.Struct<{
149
+ readonly type: Schema.tag<"disabled">;
150
+ }>]>>;
151
+ output_config: Schema.optional<Schema.Struct<{
152
+ readonly effort: Schema.optional<Schema.String>;
153
+ }>>;
154
+ }>;
155
+ export type AnthropicMessagesBody = Schema.Schema.Type<typeof AnthropicMessagesBody>;
156
+ /**
157
+ * The Anthropic Messages protocol — request body construction, body schema,
158
+ * and the streaming-event state machine. Used by native Anthropic Cloud and
159
+ * (once registered) Vertex Anthropic / Bedrock-hosted Anthropic passthrough.
160
+ */
161
+ export declare const protocol: Protocol<{
162
+ readonly model: string;
163
+ readonly messages: readonly ({
164
+ readonly role: "user";
165
+ readonly content: readonly ({
166
+ readonly type: "text";
167
+ readonly text: string;
168
+ readonly cache_control?: {
169
+ readonly type: "ephemeral";
170
+ readonly ttl?: "1h" | "5m" | undefined;
171
+ } | undefined;
172
+ } | {
173
+ readonly type: "image";
174
+ readonly source: {
175
+ readonly type: "base64";
176
+ readonly media_type: string;
177
+ readonly data: string;
178
+ };
179
+ readonly cache_control?: {
180
+ readonly type: "ephemeral";
181
+ readonly ttl?: "1h" | "5m" | undefined;
182
+ } | undefined;
183
+ } | {
184
+ readonly type: "tool_result";
185
+ readonly tool_use_id: string;
186
+ readonly content: string | readonly ({
187
+ readonly type: "text";
188
+ readonly text: string;
189
+ readonly cache_control?: {
190
+ readonly type: "ephemeral";
191
+ readonly ttl?: "1h" | "5m" | undefined;
192
+ } | undefined;
193
+ } | {
194
+ readonly type: "image";
195
+ readonly source: {
196
+ readonly type: "base64";
197
+ readonly media_type: string;
198
+ readonly data: string;
199
+ };
200
+ readonly cache_control?: {
201
+ readonly type: "ephemeral";
202
+ readonly ttl?: "1h" | "5m" | undefined;
203
+ } | undefined;
204
+ })[];
205
+ readonly is_error?: boolean | undefined;
206
+ readonly cache_control?: {
207
+ readonly type: "ephemeral";
208
+ readonly ttl?: "1h" | "5m" | undefined;
209
+ } | undefined;
210
+ })[];
211
+ } | {
212
+ readonly role: "assistant";
213
+ readonly content: readonly ({
214
+ readonly type: "text";
215
+ readonly text: string;
216
+ readonly cache_control?: {
217
+ readonly type: "ephemeral";
218
+ readonly ttl?: "1h" | "5m" | undefined;
219
+ } | undefined;
220
+ } | {
221
+ readonly type: "tool_use";
222
+ readonly id: string;
223
+ readonly name: string;
224
+ readonly input: unknown;
225
+ readonly cache_control?: {
226
+ readonly type: "ephemeral";
227
+ readonly ttl?: "1h" | "5m" | undefined;
228
+ } | undefined;
229
+ } | {
230
+ readonly type: "server_tool_use";
231
+ readonly id: string;
232
+ readonly name: string;
233
+ readonly input: unknown;
234
+ readonly cache_control?: {
235
+ readonly type: "ephemeral";
236
+ readonly ttl?: "1h" | "5m" | undefined;
237
+ } | undefined;
238
+ } | {
239
+ readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
240
+ readonly tool_use_id: string;
241
+ readonly content: unknown;
242
+ readonly cache_control?: {
243
+ readonly type: "ephemeral";
244
+ readonly ttl?: "1h" | "5m" | undefined;
245
+ } | undefined;
246
+ } | {
247
+ readonly type: "thinking";
248
+ readonly thinking: string;
249
+ readonly signature?: string | undefined;
250
+ readonly cache_control?: {
251
+ readonly type: "ephemeral";
252
+ readonly ttl?: "1h" | "5m" | undefined;
253
+ } | undefined;
254
+ })[];
255
+ } | {
256
+ readonly role: "system";
257
+ readonly content: readonly {
258
+ readonly type: "text";
259
+ readonly text: string;
260
+ readonly cache_control?: {
261
+ readonly type: "ephemeral";
262
+ readonly ttl?: "1h" | "5m" | undefined;
263
+ } | undefined;
264
+ }[];
265
+ })[];
266
+ readonly stream: true;
267
+ readonly max_tokens: number;
268
+ readonly system?: readonly {
269
+ readonly type: "text";
270
+ readonly text: string;
271
+ readonly cache_control?: {
272
+ readonly type: "ephemeral";
273
+ readonly ttl?: "1h" | "5m" | undefined;
274
+ } | undefined;
275
+ }[] | undefined;
276
+ readonly tools?: readonly {
277
+ readonly name: string;
278
+ readonly description: string;
279
+ readonly input_schema: {
280
+ readonly [x: string]: unknown;
281
+ };
282
+ readonly cache_control?: {
283
+ readonly type: "ephemeral";
284
+ readonly ttl?: "1h" | "5m" | undefined;
285
+ } | undefined;
286
+ }[] | undefined;
287
+ readonly tool_choice?: {
288
+ readonly type: "auto" | "any";
289
+ } | {
290
+ readonly type: "tool";
291
+ readonly name: string;
292
+ } | undefined;
293
+ readonly temperature?: number | undefined;
294
+ readonly top_p?: number | undefined;
295
+ readonly top_k?: number | undefined;
296
+ readonly stop_sequences?: readonly string[] | undefined;
297
+ readonly thinking?: {
298
+ readonly type: "enabled";
299
+ readonly budget_tokens: number;
300
+ } | {
301
+ readonly type: "adaptive";
302
+ readonly display?: "summarized" | "omitted" | undefined;
303
+ } | {
304
+ readonly type: "disabled";
305
+ } | undefined;
306
+ readonly output_config?: {
307
+ readonly effort?: string | undefined;
308
+ } | undefined;
309
+ }, string, {
310
+ readonly type: string;
311
+ readonly index?: number | undefined;
312
+ readonly message?: {
313
+ readonly usage?: {
314
+ readonly input_tokens?: number | undefined;
315
+ readonly output_tokens?: number | undefined;
316
+ readonly cache_creation_input_tokens?: number | null | undefined;
317
+ readonly cache_read_input_tokens?: number | null | undefined;
318
+ } | undefined;
319
+ } | undefined;
320
+ readonly content_block?: {
321
+ readonly type: string;
322
+ readonly id?: string | undefined;
323
+ readonly name?: string | undefined;
324
+ readonly text?: string | undefined;
325
+ readonly thinking?: string | undefined;
326
+ readonly signature?: string | undefined;
327
+ readonly input?: unknown;
328
+ readonly tool_use_id?: string | undefined;
329
+ readonly content?: unknown;
330
+ } | undefined;
331
+ readonly delta?: {
332
+ readonly type?: string | undefined;
333
+ readonly text?: string | undefined;
334
+ readonly thinking?: string | undefined;
335
+ readonly partial_json?: string | undefined;
336
+ readonly signature?: string | undefined;
337
+ readonly stop_reason?: string | null | undefined;
338
+ readonly stop_sequence?: string | null | undefined;
339
+ } | undefined;
340
+ readonly usage?: {
341
+ readonly input_tokens?: number | undefined;
342
+ readonly output_tokens?: number | undefined;
343
+ readonly cache_creation_input_tokens?: number | null | undefined;
344
+ readonly cache_read_input_tokens?: number | null | undefined;
345
+ } | undefined;
346
+ readonly error?: {
347
+ readonly type?: string | undefined;
348
+ readonly message?: string | undefined;
349
+ } | undefined;
350
+ }, {
351
+ tools: Partial<Record<number, ToolStream.PendingTool>>;
352
+ lifecycle: Lifecycle.State;
353
+ }>;
354
+ export declare const route: Route<{
355
+ readonly model: string;
356
+ readonly messages: readonly ({
357
+ readonly role: "user";
358
+ readonly content: readonly ({
359
+ readonly type: "text";
360
+ readonly text: string;
361
+ readonly cache_control?: {
362
+ readonly type: "ephemeral";
363
+ readonly ttl?: "1h" | "5m" | undefined;
364
+ } | undefined;
365
+ } | {
366
+ readonly type: "image";
367
+ readonly source: {
368
+ readonly type: "base64";
369
+ readonly media_type: string;
370
+ readonly data: string;
371
+ };
372
+ readonly cache_control?: {
373
+ readonly type: "ephemeral";
374
+ readonly ttl?: "1h" | "5m" | undefined;
375
+ } | undefined;
376
+ } | {
377
+ readonly type: "tool_result";
378
+ readonly tool_use_id: string;
379
+ readonly content: string | readonly ({
380
+ readonly type: "text";
381
+ readonly text: string;
382
+ readonly cache_control?: {
383
+ readonly type: "ephemeral";
384
+ readonly ttl?: "1h" | "5m" | undefined;
385
+ } | undefined;
386
+ } | {
387
+ readonly type: "image";
388
+ readonly source: {
389
+ readonly type: "base64";
390
+ readonly media_type: string;
391
+ readonly data: string;
392
+ };
393
+ readonly cache_control?: {
394
+ readonly type: "ephemeral";
395
+ readonly ttl?: "1h" | "5m" | undefined;
396
+ } | undefined;
397
+ })[];
398
+ readonly is_error?: boolean | undefined;
399
+ readonly cache_control?: {
400
+ readonly type: "ephemeral";
401
+ readonly ttl?: "1h" | "5m" | undefined;
402
+ } | undefined;
403
+ })[];
404
+ } | {
405
+ readonly role: "assistant";
406
+ readonly content: readonly ({
407
+ readonly type: "text";
408
+ readonly text: string;
409
+ readonly cache_control?: {
410
+ readonly type: "ephemeral";
411
+ readonly ttl?: "1h" | "5m" | undefined;
412
+ } | undefined;
413
+ } | {
414
+ readonly type: "tool_use";
415
+ readonly id: string;
416
+ readonly name: string;
417
+ readonly input: unknown;
418
+ readonly cache_control?: {
419
+ readonly type: "ephemeral";
420
+ readonly ttl?: "1h" | "5m" | undefined;
421
+ } | undefined;
422
+ } | {
423
+ readonly type: "server_tool_use";
424
+ readonly id: string;
425
+ readonly name: string;
426
+ readonly input: unknown;
427
+ readonly cache_control?: {
428
+ readonly type: "ephemeral";
429
+ readonly ttl?: "1h" | "5m" | undefined;
430
+ } | undefined;
431
+ } | {
432
+ readonly type: "web_search_tool_result" | "code_execution_tool_result" | "web_fetch_tool_result";
433
+ readonly tool_use_id: string;
434
+ readonly content: unknown;
435
+ readonly cache_control?: {
436
+ readonly type: "ephemeral";
437
+ readonly ttl?: "1h" | "5m" | undefined;
438
+ } | undefined;
439
+ } | {
440
+ readonly type: "thinking";
441
+ readonly thinking: string;
442
+ readonly signature?: string | undefined;
443
+ readonly cache_control?: {
444
+ readonly type: "ephemeral";
445
+ readonly ttl?: "1h" | "5m" | undefined;
446
+ } | undefined;
447
+ })[];
448
+ } | {
449
+ readonly role: "system";
450
+ readonly content: readonly {
451
+ readonly type: "text";
452
+ readonly text: string;
453
+ readonly cache_control?: {
454
+ readonly type: "ephemeral";
455
+ readonly ttl?: "1h" | "5m" | undefined;
456
+ } | undefined;
457
+ }[];
458
+ })[];
459
+ readonly stream: true;
460
+ readonly max_tokens: number;
461
+ readonly system?: readonly {
462
+ readonly type: "text";
463
+ readonly text: string;
464
+ readonly cache_control?: {
465
+ readonly type: "ephemeral";
466
+ readonly ttl?: "1h" | "5m" | undefined;
467
+ } | undefined;
468
+ }[] | undefined;
469
+ readonly tools?: readonly {
470
+ readonly name: string;
471
+ readonly description: string;
472
+ readonly input_schema: {
473
+ readonly [x: string]: unknown;
474
+ };
475
+ readonly cache_control?: {
476
+ readonly type: "ephemeral";
477
+ readonly ttl?: "1h" | "5m" | undefined;
478
+ } | undefined;
479
+ }[] | undefined;
480
+ readonly tool_choice?: {
481
+ readonly type: "auto" | "any";
482
+ } | {
483
+ readonly type: "tool";
484
+ readonly name: string;
485
+ } | undefined;
486
+ readonly temperature?: number | undefined;
487
+ readonly top_p?: number | undefined;
488
+ readonly top_k?: number | undefined;
489
+ readonly stop_sequences?: readonly string[] | undefined;
490
+ readonly thinking?: {
491
+ readonly type: "enabled";
492
+ readonly budget_tokens: number;
493
+ } | {
494
+ readonly type: "adaptive";
495
+ readonly display?: "summarized" | "omitted" | undefined;
496
+ } | {
497
+ readonly type: "disabled";
498
+ } | undefined;
499
+ readonly output_config?: {
500
+ readonly effort?: string | undefined;
501
+ } | undefined;
502
+ }, import("../route/transport/http").HttpPrepared<string>>;
503
+ export * as AnthropicMessages from "./anthropic-messages";