@opencode-ai/ai 0.0.0-beta-17492

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