@opencode/ai 0.0.0-beta-19275

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 (252) hide show
  1. package/README.md +682 -0
  2. package/dist/cache-policy.d.ts +2 -0
  3. package/dist/cache-policy.js +129 -0
  4. package/dist/image-client.d.ts +19 -0
  5. package/dist/image-client.js +28 -0
  6. package/dist/image.d.ts +110 -0
  7. package/dist/image.js +103 -0
  8. package/dist/index.d.ts +18 -0
  9. package/dist/index.js +12 -0
  10. package/dist/llm.d.ts +252 -0
  11. package/dist/llm.js +74 -0
  12. package/dist/protocols/anthropic-messages.d.ts +957 -0
  13. package/dist/protocols/anthropic-messages.js +1414 -0
  14. package/dist/protocols/bedrock-converse.d.ts +499 -0
  15. package/dist/protocols/bedrock-converse.js +643 -0
  16. package/dist/protocols/bedrock-event-stream.d.ts +9 -0
  17. package/dist/protocols/bedrock-event-stream.js +97 -0
  18. package/dist/protocols/gemini.d.ts +285 -0
  19. package/dist/protocols/gemini.js +671 -0
  20. package/dist/protocols/google-images.d.ts +30 -0
  21. package/dist/protocols/google-images.js +181 -0
  22. package/dist/protocols/index.d.ts +12 -0
  23. package/dist/protocols/index.js +12 -0
  24. package/dist/protocols/meta-images.d.ts +26 -0
  25. package/dist/protocols/meta-images.js +89 -0
  26. package/dist/protocols/meta-messages.d.ts +350 -0
  27. package/dist/protocols/meta-messages.js +41 -0
  28. package/dist/protocols/meta-responses.d.ts +473 -0
  29. package/dist/protocols/meta-responses.js +173 -0
  30. package/dist/protocols/mistral-chat.d.ts +540 -0
  31. package/dist/protocols/mistral-chat.js +624 -0
  32. package/dist/protocols/open-responses-channel.d.ts +23 -0
  33. package/dist/protocols/open-responses-channel.js +141 -0
  34. package/dist/protocols/open-responses-continuation.d.ts +12 -0
  35. package/dist/protocols/open-responses-continuation.js +161 -0
  36. package/dist/protocols/open-responses.d.ts +1583 -0
  37. package/dist/protocols/open-responses.js +1206 -0
  38. package/dist/protocols/openai-chat.d.ts +860 -0
  39. package/dist/protocols/openai-chat.js +966 -0
  40. package/dist/protocols/openai-compatible-chat.d.ts +109 -0
  41. package/dist/protocols/openai-compatible-chat.js +19 -0
  42. package/dist/protocols/openai-compatible-responses.d.ts +172 -0
  43. package/dist/protocols/openai-compatible-responses.js +18 -0
  44. package/dist/protocols/openai-images.d.ts +32 -0
  45. package/dist/protocols/openai-images.js +183 -0
  46. package/dist/protocols/openai-responses.d.ts +1389 -0
  47. package/dist/protocols/openai-responses.js +260 -0
  48. package/dist/protocols/shared.d.ts +193 -0
  49. package/dist/protocols/shared.js +290 -0
  50. package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
  51. package/dist/protocols/utils/bedrock-auth.js +85 -0
  52. package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
  53. package/dist/protocols/utils/bedrock-cache.js +49 -0
  54. package/dist/protocols/utils/bedrock-media.d.ts +55 -0
  55. package/dist/protocols/utils/bedrock-media.js +73 -0
  56. package/dist/protocols/utils/cache.d.ts +6 -0
  57. package/dist/protocols/utils/cache.js +5 -0
  58. package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
  59. package/dist/protocols/utils/gemini-tool-schema.js +103 -0
  60. package/dist/protocols/utils/image-input.d.ts +21 -0
  61. package/dist/protocols/utils/image-input.js +20 -0
  62. package/dist/protocols/utils/lifecycle.d.ts +24 -0
  63. package/dist/protocols/utils/lifecycle.js +72 -0
  64. package/dist/protocols/utils/meta-image.d.ts +2 -0
  65. package/dist/protocols/utils/meta-image.js +13 -0
  66. package/dist/protocols/utils/open-responses-options.d.ts +56 -0
  67. package/dist/protocols/utils/open-responses-options.js +61 -0
  68. package/dist/protocols/utils/openai-image.d.ts +5 -0
  69. package/dist/protocols/utils/openai-image.js +18 -0
  70. package/dist/protocols/utils/openai-options.d.ts +16 -0
  71. package/dist/protocols/utils/openai-options.js +14 -0
  72. package/dist/protocols/utils/partial-json-options.d.ts +62 -0
  73. package/dist/protocols/utils/partial-json-options.js +52 -0
  74. package/dist/protocols/utils/partial-json.d.ts +8 -0
  75. package/dist/protocols/utils/partial-json.js +279 -0
  76. package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
  77. package/dist/protocols/utils/responses-checkpoint.js +107 -0
  78. package/dist/protocols/utils/responses-compaction.d.ts +4 -0
  79. package/dist/protocols/utils/responses-compaction.js +129 -0
  80. package/dist/protocols/utils/responses-hosted-tools.d.ts +26 -0
  81. package/dist/protocols/utils/responses-hosted-tools.js +32 -0
  82. package/dist/protocols/utils/tool-schema.d.ts +8 -0
  83. package/dist/protocols/utils/tool-schema.js +54 -0
  84. package/dist/protocols/utils/tool-stream.d.ts +710 -0
  85. package/dist/protocols/utils/tool-stream.js +155 -0
  86. package/dist/protocols/xai-images.d.ts +26 -0
  87. package/dist/protocols/xai-images.js +106 -0
  88. package/dist/protocols/xai-responses.d.ts +250 -0
  89. package/dist/protocols/xai-responses.js +81 -0
  90. package/dist/protocols/zai-images.d.ts +22 -0
  91. package/dist/protocols/zai-images.js +79 -0
  92. package/dist/protocols.d.ts +1 -0
  93. package/dist/protocols.js +1 -0
  94. package/dist/provider-error.d.ts +15 -0
  95. package/dist/provider-error.js +125 -0
  96. package/dist/provider-package.d.ts +11 -0
  97. package/dist/provider-package.js +1 -0
  98. package/dist/provider.d.ts +23 -0
  99. package/dist/provider.js +2 -0
  100. package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
  101. package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
  102. package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
  103. package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
  104. package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
  105. package/dist/providers/amazon-bedrock/mantle.js +1 -0
  106. package/dist/providers/amazon-bedrock-mantle.d.ts +371 -0
  107. package/dist/providers/amazon-bedrock-mantle.js +76 -0
  108. package/dist/providers/amazon-bedrock.d.ts +173 -0
  109. package/dist/providers/amazon-bedrock.js +41 -0
  110. package/dist/providers/anthropic-compatible.d.ts +304 -0
  111. package/dist/providers/anthropic-compatible.js +44 -0
  112. package/dist/providers/anthropic.d.ts +302 -0
  113. package/dist/providers/anthropic.js +39 -0
  114. package/dist/providers/azure/chat.d.ts +2 -0
  115. package/dist/providers/azure/chat.js +1 -0
  116. package/dist/providers/azure/responses.d.ts +2 -0
  117. package/dist/providers/azure/responses.js +1 -0
  118. package/dist/providers/azure.d.ts +599 -0
  119. package/dist/providers/azure.js +115 -0
  120. package/dist/providers/baseten.d.ts +229 -0
  121. package/dist/providers/baseten.js +38 -0
  122. package/dist/providers/cerebras.d.ts +228 -0
  123. package/dist/providers/cerebras.js +40 -0
  124. package/dist/providers/cloudflare-ai-gateway.d.ts +238 -0
  125. package/dist/providers/cloudflare-ai-gateway.js +59 -0
  126. package/dist/providers/cloudflare-workers-ai.d.ts +232 -0
  127. package/dist/providers/cloudflare-workers-ai.js +45 -0
  128. package/dist/providers/deepinfra.d.ts +228 -0
  129. package/dist/providers/deepinfra.js +43 -0
  130. package/dist/providers/deepseek.d.ts +229 -0
  131. package/dist/providers/deepseek.js +41 -0
  132. package/dist/providers/fireworks.d.ts +229 -0
  133. package/dist/providers/fireworks.js +38 -0
  134. package/dist/providers/google-vertex/chat.d.ts +2 -0
  135. package/dist/providers/google-vertex/chat.js +1 -0
  136. package/dist/providers/google-vertex/gemini.d.ts +2 -0
  137. package/dist/providers/google-vertex/gemini.js +1 -0
  138. package/dist/providers/google-vertex/messages.d.ts +2 -0
  139. package/dist/providers/google-vertex/messages.js +1 -0
  140. package/dist/providers/google-vertex/responses.d.ts +2 -0
  141. package/dist/providers/google-vertex/responses.js +1 -0
  142. package/dist/providers/google-vertex-chat.d.ts +133 -0
  143. package/dist/providers/google-vertex-chat.js +55 -0
  144. package/dist/providers/google-vertex-messages.d.ts +301 -0
  145. package/dist/providers/google-vertex-messages.js +75 -0
  146. package/dist/providers/google-vertex-responses.d.ts +198 -0
  147. package/dist/providers/google-vertex-responses.js +56 -0
  148. package/dist/providers/google-vertex-shared.d.ts +22 -0
  149. package/dist/providers/google-vertex-shared.js +61 -0
  150. package/dist/providers/google-vertex.d.ts +120 -0
  151. package/dist/providers/google-vertex.js +92 -0
  152. package/dist/providers/google.d.ts +115 -0
  153. package/dist/providers/google.js +42 -0
  154. package/dist/providers/groq.d.ts +315 -0
  155. package/dist/providers/groq.js +81 -0
  156. package/dist/providers/index.d.ts +28 -0
  157. package/dist/providers/index.js +28 -0
  158. package/dist/providers/meta/chat.d.ts +2 -0
  159. package/dist/providers/meta/chat.js +1 -0
  160. package/dist/providers/meta/messages.d.ts +2 -0
  161. package/dist/providers/meta/messages.js +1 -0
  162. package/dist/providers/meta/responses.d.ts +2 -0
  163. package/dist/providers/meta/responses.js +1 -0
  164. package/dist/providers/meta.d.ts +631 -0
  165. package/dist/providers/meta.js +113 -0
  166. package/dist/providers/minimax/chat.d.ts +4 -0
  167. package/dist/providers/minimax/chat.js +8 -0
  168. package/dist/providers/minimax/messages.d.ts +1 -0
  169. package/dist/providers/minimax/messages.js +1 -0
  170. package/dist/providers/minimax/responses.d.ts +4 -0
  171. package/dist/providers/minimax/responses.js +8 -0
  172. package/dist/providers/minimax.d.ts +593 -0
  173. package/dist/providers/minimax.js +89 -0
  174. package/dist/providers/mistral.d.ts +208 -0
  175. package/dist/providers/mistral.js +28 -0
  176. package/dist/providers/open-responses-options.d.ts +6 -0
  177. package/dist/providers/open-responses-options.js +1 -0
  178. package/dist/providers/openai/chat.d.ts +2 -0
  179. package/dist/providers/openai/chat.js +1 -0
  180. package/dist/providers/openai/responses.d.ts +2 -0
  181. package/dist/providers/openai/responses.js +1 -0
  182. package/dist/providers/openai-compatible/responses.d.ts +1 -0
  183. package/dist/providers/openai-compatible/responses.js +1 -0
  184. package/dist/providers/openai-compatible-responses.d.ts +196 -0
  185. package/dist/providers/openai-compatible-responses.js +32 -0
  186. package/dist/providers/openai-compatible.d.ts +131 -0
  187. package/dist/providers/openai-compatible.js +33 -0
  188. package/dist/providers/openai-options.d.ts +26 -0
  189. package/dist/providers/openai-options.js +41 -0
  190. package/dist/providers/openai.d.ts +405 -0
  191. package/dist/providers/openai.js +82 -0
  192. package/dist/providers/openrouter.d.ts +564 -0
  193. package/dist/providers/openrouter.js +114 -0
  194. package/dist/providers/togetherai.d.ts +228 -0
  195. package/dist/providers/togetherai.js +40 -0
  196. package/dist/providers/xai.d.ts +164 -0
  197. package/dist/providers/xai.js +84 -0
  198. package/dist/providers/zai.d.ts +24 -0
  199. package/dist/providers/zai.js +21 -0
  200. package/dist/providers.d.ts +1 -0
  201. package/dist/providers.js +1 -0
  202. package/dist/route/auth-options.d.ts +34 -0
  203. package/dist/route/auth-options.js +14 -0
  204. package/dist/route/auth.d.ts +51 -0
  205. package/dist/route/auth.js +87 -0
  206. package/dist/route/client.d.ts +430 -0
  207. package/dist/route/client.js +304 -0
  208. package/dist/route/endpoint.d.ts +28 -0
  209. package/dist/route/endpoint.js +21 -0
  210. package/dist/route/executor.d.ts +27 -0
  211. package/dist/route/executor.js +183 -0
  212. package/dist/route/framing.d.ts +29 -0
  213. package/dist/route/framing.js +14 -0
  214. package/dist/route/index.d.ts +16 -0
  215. package/dist/route/index.js +9 -0
  216. package/dist/route/protocol.d.ts +76 -0
  217. package/dist/route/protocol.js +16 -0
  218. package/dist/route/transport/http.d.ts +34 -0
  219. package/dist/route/transport/http.js +68 -0
  220. package/dist/route/transport/index.d.ts +41 -0
  221. package/dist/route/transport/index.js +4 -0
  222. package/dist/route/transport/websocket-channel.d.ts +57 -0
  223. package/dist/route/transport/websocket-channel.js +1 -0
  224. package/dist/route/transport/websocket.d.ts +56 -0
  225. package/dist/route/transport/websocket.js +366 -0
  226. package/dist/route.d.ts +1 -0
  227. package/dist/route.js +1 -0
  228. package/dist/schema/errors.d.ts +158 -0
  229. package/dist/schema/errors.js +120 -0
  230. package/dist/schema/events.d.ts +8123 -0
  231. package/dist/schema/events.js +550 -0
  232. package/dist/schema/ids.d.ts +17 -0
  233. package/dist/schema/ids.js +10 -0
  234. package/dist/schema/index.d.ts +5 -0
  235. package/dist/schema/index.js +5 -0
  236. package/dist/schema/messages.d.ts +646 -0
  237. package/dist/schema/messages.js +301 -0
  238. package/dist/schema/options.d.ts +157 -0
  239. package/dist/schema/options.js +187 -0
  240. package/dist/testing.d.ts +1693 -0
  241. package/dist/testing.js +129 -0
  242. package/dist/tool-history.d.ts +2 -0
  243. package/dist/tool-history.js +84 -0
  244. package/dist/tool-runtime.d.ts +15 -0
  245. package/dist/tool-runtime.js +62 -0
  246. package/dist/tool.d.ts +136 -0
  247. package/dist/tool.js +66 -0
  248. package/dist/utils/record.d.ts +2 -0
  249. package/dist/utils/record.js +2 -0
  250. package/dist/utils/sanitize.d.ts +1 -0
  251. package/dist/utils/sanitize.js +12 -0
  252. package/package.json +48 -0
@@ -0,0 +1,1583 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { HttpTransport } from "../route/transport/index.js";
3
+ import { Protocol } from "../route/protocol.js";
4
+ import { AIError, LLMEvent, Usage, type LLMRequest, type MediaPart, type ProviderMetadata, type ToolDefinition } from "../schema/index.js";
5
+ import { ProviderShared } from "./shared.js";
6
+ import { OpenResponsesOptions } from "./utils/open-responses-options.js";
7
+ import { Lifecycle } from "./utils/lifecycle.js";
8
+ import { ToolStream } from "./utils/tool-stream.js";
9
+ export declare const PATH = "/responses";
10
+ export declare const OpenResponsesInputText: Schema.Struct<{
11
+ readonly type: Schema.tag<"input_text">;
12
+ readonly text: Schema.String;
13
+ }>;
14
+ export declare const OpenResponsesInputImage: Schema.Struct<{
15
+ readonly type: Schema.tag<"input_image">;
16
+ readonly image_url: Schema.String;
17
+ readonly detail: Schema.optional<Schema.String>;
18
+ }>;
19
+ export declare const OpenResponsesInputFile: Schema.Struct<{
20
+ readonly type: Schema.tag<"input_file">;
21
+ readonly filename: Schema.String;
22
+ readonly detail: Schema.optional<Schema.String>;
23
+ readonly file_data: Schema.optional<Schema.String>;
24
+ readonly file_url: Schema.optional<Schema.String>;
25
+ }>;
26
+ declare const MediaInput: Schema.Union<readonly [Schema.Struct<{
27
+ readonly type: Schema.tag<"input_image">;
28
+ readonly image_url: Schema.String;
29
+ readonly detail: Schema.optional<Schema.String>;
30
+ }>, Schema.Struct<{
31
+ readonly type: Schema.tag<"input_file">;
32
+ readonly filename: Schema.String;
33
+ readonly detail: Schema.optional<Schema.String>;
34
+ readonly file_data: Schema.optional<Schema.String>;
35
+ readonly file_url: Schema.optional<Schema.String>;
36
+ }>]>;
37
+ export type MediaInput = Schema.Schema.Type<typeof MediaInput>;
38
+ export declare const OpenResponsesOutputText: Schema.Struct<{
39
+ readonly type: Schema.tag<"output_text">;
40
+ readonly text: Schema.String;
41
+ }>;
42
+ export declare const MessagePhase: Schema.NullOr<Schema.Literals<readonly ["commentary", "final_answer"]>>;
43
+ type MessagePhase = Schema.Schema.Type<typeof MessagePhase>;
44
+ export declare const MessageMetadata: Schema.Struct<{
45
+ readonly itemId: Schema.optional<Schema.String>;
46
+ readonly type: Schema.optional<Schema.Literal<"message">>;
47
+ readonly status: Schema.optional<Schema.String>;
48
+ readonly phase: Schema.optional<Schema.NullOr<Schema.Literals<readonly ["commentary", "final_answer"]>>>;
49
+ }>;
50
+ export declare const OpenResponsesReasoningItem: Schema.Struct<{
51
+ readonly type: Schema.tag<"reasoning">;
52
+ readonly id: Schema.optionalKey<Schema.String>;
53
+ readonly summary: Schema.$Array<Schema.Struct<{
54
+ readonly type: Schema.tag<"summary_text">;
55
+ readonly text: Schema.String;
56
+ }>>;
57
+ readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
58
+ }>;
59
+ export declare const HostedToolItem: Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
60
+ readonly type: Schema.tag<"web_search_call">;
61
+ readonly id: Schema.String;
62
+ readonly status: Schema.optional<Schema.String>;
63
+ readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
64
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
65
+ readonly type: Schema.tag<"file_search_call">;
66
+ readonly id: Schema.String;
67
+ readonly status: Schema.optional<Schema.String>;
68
+ readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
69
+ readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
70
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
71
+ readonly type: Schema.tag<"code_interpreter_call">;
72
+ readonly id: Schema.String;
73
+ readonly status: Schema.optional<Schema.String>;
74
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
75
+ readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
76
+ readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
77
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
78
+ readonly type: Schema.tag<"mcp_call">;
79
+ readonly id: Schema.String;
80
+ readonly status: Schema.optional<Schema.String>;
81
+ readonly server_label: Schema.optional<Schema.String>;
82
+ readonly name: Schema.optional<Schema.String>;
83
+ readonly arguments: Schema.optional<Schema.String>;
84
+ readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
85
+ readonly error: Schema.optional<Schema.Unknown>;
86
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>;
87
+ export type HostedToolItem = Schema.Schema.Type<typeof HostedToolItem>;
88
+ export declare const CompactionItem: Schema.Struct<{
89
+ readonly type: Schema.Literal<"compaction">;
90
+ readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
91
+ readonly encrypted_content: Schema.String;
92
+ }>;
93
+ export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
94
+ readonly type: Schema.Literal<"compaction">;
95
+ readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
96
+ readonly encrypted_content: Schema.String;
97
+ }>, Schema.Struct<{
98
+ readonly role: Schema.tag<"system">;
99
+ readonly content: Schema.String;
100
+ }>, Schema.Struct<{
101
+ readonly role: Schema.tag<"developer">;
102
+ readonly content: Schema.String;
103
+ }>, Schema.Struct<{
104
+ readonly role: Schema.tag<"user">;
105
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
106
+ readonly type: Schema.tag<"input_text">;
107
+ readonly text: Schema.String;
108
+ }>, Schema.Union<readonly [Schema.Struct<{
109
+ readonly type: Schema.tag<"input_image">;
110
+ readonly image_url: Schema.String;
111
+ readonly detail: Schema.optional<Schema.String>;
112
+ }>, Schema.Struct<{
113
+ readonly type: Schema.tag<"input_file">;
114
+ readonly filename: Schema.String;
115
+ readonly detail: Schema.optional<Schema.String>;
116
+ readonly file_data: Schema.optional<Schema.String>;
117
+ readonly file_url: Schema.optional<Schema.String>;
118
+ }>]>]>>;
119
+ readonly type: Schema.optional<Schema.Literal<"message">>;
120
+ readonly id: Schema.optional<Schema.String>;
121
+ readonly status: Schema.optional<Schema.String>;
122
+ }>, Schema.Struct<{
123
+ readonly type: Schema.tag<"message">;
124
+ readonly id: Schema.optionalKey<Schema.String>;
125
+ readonly role: Schema.tag<"assistant">;
126
+ readonly content: Schema.$Array<Schema.Struct<{
127
+ readonly type: Schema.tag<"output_text">;
128
+ readonly text: Schema.String;
129
+ }>>;
130
+ readonly phase: Schema.optionalKey<Schema.NullOr<Schema.Literals<readonly ["commentary", "final_answer"]>>>;
131
+ readonly status: Schema.optional<Schema.String>;
132
+ }>, Schema.Struct<{
133
+ readonly type: Schema.tag<"reasoning">;
134
+ readonly id: Schema.optionalKey<Schema.String>;
135
+ readonly summary: Schema.$Array<Schema.Struct<{
136
+ readonly type: Schema.tag<"summary_text">;
137
+ readonly text: Schema.String;
138
+ }>>;
139
+ readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
140
+ }>, Schema.Struct<{
141
+ readonly type: Schema.tag<"function_call">;
142
+ readonly id: Schema.optionalKey<Schema.String>;
143
+ readonly call_id: Schema.String;
144
+ readonly name: Schema.String;
145
+ readonly namespace: Schema.optional<Schema.String>;
146
+ readonly arguments: Schema.String;
147
+ }>, Schema.Struct<{
148
+ readonly type: Schema.tag<"function_call_output">;
149
+ readonly call_id: Schema.String;
150
+ readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
151
+ readonly type: Schema.tag<"input_text">;
152
+ readonly text: Schema.String;
153
+ }>, Schema.Struct<{
154
+ readonly type: Schema.tag<"input_image">;
155
+ readonly image_url: Schema.String;
156
+ readonly detail: Schema.optional<Schema.String>;
157
+ }>, Schema.Struct<{
158
+ readonly type: Schema.tag<"input_file">;
159
+ readonly filename: Schema.String;
160
+ readonly detail: Schema.optional<Schema.String>;
161
+ readonly file_data: Schema.optional<Schema.String>;
162
+ readonly file_url: Schema.optional<Schema.String>;
163
+ }>, Schema.Struct<{
164
+ readonly type: Schema.tag<"input_video">;
165
+ readonly video_url: Schema.String;
166
+ }>]>>]>;
167
+ }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
168
+ readonly type: Schema.tag<"web_search_call">;
169
+ readonly id: Schema.String;
170
+ readonly status: Schema.optional<Schema.String>;
171
+ readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
172
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
173
+ readonly type: Schema.tag<"file_search_call">;
174
+ readonly id: Schema.String;
175
+ readonly status: Schema.optional<Schema.String>;
176
+ readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
177
+ readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
178
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
179
+ readonly type: Schema.tag<"code_interpreter_call">;
180
+ readonly id: Schema.String;
181
+ readonly status: Schema.optional<Schema.String>;
182
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
183
+ readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
184
+ readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
185
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
186
+ readonly type: Schema.tag<"mcp_call">;
187
+ readonly id: Schema.String;
188
+ readonly status: Schema.optional<Schema.String>;
189
+ readonly server_label: Schema.optional<Schema.String>;
190
+ readonly name: Schema.optional<Schema.String>;
191
+ readonly arguments: Schema.optional<Schema.String>;
192
+ readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
193
+ readonly error: Schema.optional<Schema.Unknown>;
194
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>;
195
+ type OpenResponsesInputItem = Schema.Schema.Type<typeof InputItem>;
196
+ export type HostedToolReplayItem = {
197
+ readonly type: string;
198
+ readonly id: string;
199
+ readonly [key: string]: unknown;
200
+ };
201
+ type LoweredInputItem = OpenResponsesInputItem | HostedToolReplayItem | {
202
+ readonly type: "message";
203
+ readonly id?: string;
204
+ readonly role: "assistant";
205
+ readonly content: ReadonlyArray<{
206
+ readonly type: "output_text";
207
+ readonly text: string;
208
+ }>;
209
+ readonly phase?: MessagePhase | null;
210
+ };
211
+ export declare const Tool: Schema.Struct<{
212
+ readonly type: Schema.tag<"function">;
213
+ readonly name: Schema.String;
214
+ readonly description: Schema.String;
215
+ readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
216
+ readonly strict: Schema.optional<Schema.Boolean>;
217
+ }>;
218
+ export declare const ToolChoice: Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
219
+ readonly type: Schema.tag<"function">;
220
+ readonly name: Schema.String;
221
+ }>, Schema.Struct<{
222
+ readonly type: Schema.tag<"allowed_tools">;
223
+ readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
224
+ readonly tools: Schema.$Array<Schema.Struct<{
225
+ readonly type: Schema.tag<"function">;
226
+ readonly name: Schema.String;
227
+ }>>;
228
+ }>]>;
229
+ export declare const coreFields: {
230
+ model: Schema.String;
231
+ input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
232
+ readonly type: Schema.Literal<"compaction">;
233
+ readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
234
+ readonly encrypted_content: Schema.String;
235
+ }>, Schema.Struct<{
236
+ readonly role: Schema.tag<"system">;
237
+ readonly content: Schema.String;
238
+ }>, Schema.Struct<{
239
+ readonly role: Schema.tag<"developer">;
240
+ readonly content: Schema.String;
241
+ }>, Schema.Struct<{
242
+ readonly role: Schema.tag<"user">;
243
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
244
+ readonly type: Schema.tag<"input_text">;
245
+ readonly text: Schema.String;
246
+ }>, Schema.Union<readonly [Schema.Struct<{
247
+ readonly type: Schema.tag<"input_image">;
248
+ readonly image_url: Schema.String;
249
+ readonly detail: Schema.optional<Schema.String>;
250
+ }>, Schema.Struct<{
251
+ readonly type: Schema.tag<"input_file">;
252
+ readonly filename: Schema.String;
253
+ readonly detail: Schema.optional<Schema.String>;
254
+ readonly file_data: Schema.optional<Schema.String>;
255
+ readonly file_url: Schema.optional<Schema.String>;
256
+ }>]>]>>;
257
+ readonly type: Schema.optional<Schema.Literal<"message">>;
258
+ readonly id: Schema.optional<Schema.String>;
259
+ readonly status: Schema.optional<Schema.String>;
260
+ }>, Schema.Struct<{
261
+ readonly type: Schema.tag<"message">;
262
+ readonly id: Schema.optionalKey<Schema.String>;
263
+ readonly role: Schema.tag<"assistant">;
264
+ readonly content: Schema.$Array<Schema.Struct<{
265
+ readonly type: Schema.tag<"output_text">;
266
+ readonly text: Schema.String;
267
+ }>>;
268
+ readonly phase: Schema.optionalKey<Schema.NullOr<Schema.Literals<readonly ["commentary", "final_answer"]>>>;
269
+ readonly status: Schema.optional<Schema.String>;
270
+ }>, Schema.Struct<{
271
+ readonly type: Schema.tag<"reasoning">;
272
+ readonly id: Schema.optionalKey<Schema.String>;
273
+ readonly summary: Schema.$Array<Schema.Struct<{
274
+ readonly type: Schema.tag<"summary_text">;
275
+ readonly text: Schema.String;
276
+ }>>;
277
+ readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
278
+ }>, Schema.Struct<{
279
+ readonly type: Schema.tag<"function_call">;
280
+ readonly id: Schema.optionalKey<Schema.String>;
281
+ readonly call_id: Schema.String;
282
+ readonly name: Schema.String;
283
+ readonly namespace: Schema.optional<Schema.String>;
284
+ readonly arguments: Schema.String;
285
+ }>, Schema.Struct<{
286
+ readonly type: Schema.tag<"function_call_output">;
287
+ readonly call_id: Schema.String;
288
+ readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
289
+ readonly type: Schema.tag<"input_text">;
290
+ readonly text: Schema.String;
291
+ }>, Schema.Struct<{
292
+ readonly type: Schema.tag<"input_image">;
293
+ readonly image_url: Schema.String;
294
+ readonly detail: Schema.optional<Schema.String>;
295
+ }>, Schema.Struct<{
296
+ readonly type: Schema.tag<"input_file">;
297
+ readonly filename: Schema.String;
298
+ readonly detail: Schema.optional<Schema.String>;
299
+ readonly file_data: Schema.optional<Schema.String>;
300
+ readonly file_url: Schema.optional<Schema.String>;
301
+ }>, Schema.Struct<{
302
+ readonly type: Schema.tag<"input_video">;
303
+ readonly video_url: Schema.String;
304
+ }>]>>]>;
305
+ }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
306
+ readonly type: Schema.tag<"web_search_call">;
307
+ readonly id: Schema.String;
308
+ readonly status: Schema.optional<Schema.String>;
309
+ readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
310
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
311
+ readonly type: Schema.tag<"file_search_call">;
312
+ readonly id: Schema.String;
313
+ readonly status: Schema.optional<Schema.String>;
314
+ readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
315
+ readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
316
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
317
+ readonly type: Schema.tag<"code_interpreter_call">;
318
+ readonly id: Schema.String;
319
+ readonly status: Schema.optional<Schema.String>;
320
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
321
+ readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
322
+ readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
323
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
324
+ readonly type: Schema.tag<"mcp_call">;
325
+ readonly id: Schema.String;
326
+ readonly status: Schema.optional<Schema.String>;
327
+ readonly server_label: Schema.optional<Schema.String>;
328
+ readonly name: Schema.optional<Schema.String>;
329
+ readonly arguments: Schema.optional<Schema.String>;
330
+ readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
331
+ readonly error: Schema.optional<Schema.Unknown>;
332
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>;
333
+ instructions: Schema.optional<Schema.String>;
334
+ tools: Schema.optional<Schema.$Array<Schema.Struct<{
335
+ readonly type: Schema.tag<"function">;
336
+ readonly name: Schema.String;
337
+ readonly description: Schema.String;
338
+ readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
339
+ readonly strict: Schema.optional<Schema.Boolean>;
340
+ }>>>;
341
+ tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
342
+ readonly type: Schema.tag<"function">;
343
+ readonly name: Schema.String;
344
+ }>, Schema.Struct<{
345
+ readonly type: Schema.tag<"allowed_tools">;
346
+ readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
347
+ readonly tools: Schema.$Array<Schema.Struct<{
348
+ readonly type: Schema.tag<"function">;
349
+ readonly name: Schema.String;
350
+ }>>;
351
+ }>]>>;
352
+ store: Schema.optional<Schema.Boolean>;
353
+ metadata: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
354
+ safety_identifier: Schema.optional<Schema.String>;
355
+ stream_options: Schema.optional<Schema.Struct<{
356
+ readonly include_obfuscation: Schema.optional<Schema.Boolean>;
357
+ }>>;
358
+ top_logprobs: Schema.optional<Schema.Int>;
359
+ truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
360
+ service_tier: Schema.optional<Schema.declare<OpenResponsesOptions.ServiceTier, OpenResponsesOptions.ServiceTier>>;
361
+ prompt_cache_key: Schema.optional<Schema.String>;
362
+ include: Schema.optional<Schema.$Array<Schema.declare<OpenResponsesOptions.ResponseIncludable, OpenResponsesOptions.ResponseIncludable>>>;
363
+ reasoning: Schema.optional<Schema.Struct<{
364
+ readonly effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
365
+ readonly summary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
366
+ }>>;
367
+ text: Schema.optional<Schema.Struct<{
368
+ readonly verbosity: Schema.optional<Schema.declare<OpenResponsesOptions.TextVerbosity, OpenResponsesOptions.TextVerbosity>>;
369
+ }>>;
370
+ max_output_tokens: Schema.optional<Schema.Number>;
371
+ max_tool_calls: Schema.optional<Schema.Int>;
372
+ parallel_tool_calls: Schema.optional<Schema.Boolean>;
373
+ temperature: Schema.optional<Schema.Number>;
374
+ top_p: Schema.optional<Schema.Number>;
375
+ presence_penalty: Schema.optional<Schema.Number>;
376
+ frequency_penalty: Schema.optional<Schema.Number>;
377
+ };
378
+ declare const OpenResponsesBody: Schema.Struct<{
379
+ readonly stream: Schema.Literal<true>;
380
+ readonly model: Schema.String;
381
+ readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
382
+ readonly type: Schema.Literal<"compaction">;
383
+ readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
384
+ readonly encrypted_content: Schema.String;
385
+ }>, Schema.Struct<{
386
+ readonly role: Schema.tag<"system">;
387
+ readonly content: Schema.String;
388
+ }>, Schema.Struct<{
389
+ readonly role: Schema.tag<"developer">;
390
+ readonly content: Schema.String;
391
+ }>, Schema.Struct<{
392
+ readonly role: Schema.tag<"user">;
393
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
394
+ readonly type: Schema.tag<"input_text">;
395
+ readonly text: Schema.String;
396
+ }>, Schema.Union<readonly [Schema.Struct<{
397
+ readonly type: Schema.tag<"input_image">;
398
+ readonly image_url: Schema.String;
399
+ readonly detail: Schema.optional<Schema.String>;
400
+ }>, Schema.Struct<{
401
+ readonly type: Schema.tag<"input_file">;
402
+ readonly filename: Schema.String;
403
+ readonly detail: Schema.optional<Schema.String>;
404
+ readonly file_data: Schema.optional<Schema.String>;
405
+ readonly file_url: Schema.optional<Schema.String>;
406
+ }>]>]>>;
407
+ readonly type: Schema.optional<Schema.Literal<"message">>;
408
+ readonly id: Schema.optional<Schema.String>;
409
+ readonly status: Schema.optional<Schema.String>;
410
+ }>, Schema.Struct<{
411
+ readonly type: Schema.tag<"message">;
412
+ readonly id: Schema.optionalKey<Schema.String>;
413
+ readonly role: Schema.tag<"assistant">;
414
+ readonly content: Schema.$Array<Schema.Struct<{
415
+ readonly type: Schema.tag<"output_text">;
416
+ readonly text: Schema.String;
417
+ }>>;
418
+ readonly phase: Schema.optionalKey<Schema.NullOr<Schema.Literals<readonly ["commentary", "final_answer"]>>>;
419
+ readonly status: Schema.optional<Schema.String>;
420
+ }>, Schema.Struct<{
421
+ readonly type: Schema.tag<"reasoning">;
422
+ readonly id: Schema.optionalKey<Schema.String>;
423
+ readonly summary: Schema.$Array<Schema.Struct<{
424
+ readonly type: Schema.tag<"summary_text">;
425
+ readonly text: Schema.String;
426
+ }>>;
427
+ readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
428
+ }>, Schema.Struct<{
429
+ readonly type: Schema.tag<"function_call">;
430
+ readonly id: Schema.optionalKey<Schema.String>;
431
+ readonly call_id: Schema.String;
432
+ readonly name: Schema.String;
433
+ readonly namespace: Schema.optional<Schema.String>;
434
+ readonly arguments: Schema.String;
435
+ }>, Schema.Struct<{
436
+ readonly type: Schema.tag<"function_call_output">;
437
+ readonly call_id: Schema.String;
438
+ readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
439
+ readonly type: Schema.tag<"input_text">;
440
+ readonly text: Schema.String;
441
+ }>, Schema.Struct<{
442
+ readonly type: Schema.tag<"input_image">;
443
+ readonly image_url: Schema.String;
444
+ readonly detail: Schema.optional<Schema.String>;
445
+ }>, Schema.Struct<{
446
+ readonly type: Schema.tag<"input_file">;
447
+ readonly filename: Schema.String;
448
+ readonly detail: Schema.optional<Schema.String>;
449
+ readonly file_data: Schema.optional<Schema.String>;
450
+ readonly file_url: Schema.optional<Schema.String>;
451
+ }>, Schema.Struct<{
452
+ readonly type: Schema.tag<"input_video">;
453
+ readonly video_url: Schema.String;
454
+ }>]>>]>;
455
+ }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
456
+ readonly type: Schema.tag<"web_search_call">;
457
+ readonly id: Schema.String;
458
+ readonly status: Schema.optional<Schema.String>;
459
+ readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
460
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
461
+ readonly type: Schema.tag<"file_search_call">;
462
+ readonly id: Schema.String;
463
+ readonly status: Schema.optional<Schema.String>;
464
+ readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
465
+ readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
466
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
467
+ readonly type: Schema.tag<"code_interpreter_call">;
468
+ readonly id: Schema.String;
469
+ readonly status: Schema.optional<Schema.String>;
470
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
471
+ readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
472
+ readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
473
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
474
+ readonly type: Schema.tag<"mcp_call">;
475
+ readonly id: Schema.String;
476
+ readonly status: Schema.optional<Schema.String>;
477
+ readonly server_label: Schema.optional<Schema.String>;
478
+ readonly name: Schema.optional<Schema.String>;
479
+ readonly arguments: Schema.optional<Schema.String>;
480
+ readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
481
+ readonly error: Schema.optional<Schema.Unknown>;
482
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>;
483
+ readonly instructions: Schema.optional<Schema.String>;
484
+ readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{
485
+ readonly type: Schema.tag<"function">;
486
+ readonly name: Schema.String;
487
+ readonly description: Schema.String;
488
+ readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
489
+ readonly strict: Schema.optional<Schema.Boolean>;
490
+ }>>>;
491
+ readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
492
+ readonly type: Schema.tag<"function">;
493
+ readonly name: Schema.String;
494
+ }>, Schema.Struct<{
495
+ readonly type: Schema.tag<"allowed_tools">;
496
+ readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
497
+ readonly tools: Schema.$Array<Schema.Struct<{
498
+ readonly type: Schema.tag<"function">;
499
+ readonly name: Schema.String;
500
+ }>>;
501
+ }>]>>;
502
+ readonly store: Schema.optional<Schema.Boolean>;
503
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
504
+ readonly safety_identifier: Schema.optional<Schema.String>;
505
+ readonly stream_options: Schema.optional<Schema.Struct<{
506
+ readonly include_obfuscation: Schema.optional<Schema.Boolean>;
507
+ }>>;
508
+ readonly top_logprobs: Schema.optional<Schema.Int>;
509
+ readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
510
+ readonly service_tier: Schema.optional<Schema.declare<OpenResponsesOptions.ServiceTier, OpenResponsesOptions.ServiceTier>>;
511
+ readonly prompt_cache_key: Schema.optional<Schema.String>;
512
+ readonly include: Schema.optional<Schema.$Array<Schema.declare<OpenResponsesOptions.ResponseIncludable, OpenResponsesOptions.ResponseIncludable>>>;
513
+ readonly reasoning: Schema.optional<Schema.Struct<{
514
+ readonly effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
515
+ readonly summary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
516
+ }>>;
517
+ readonly text: Schema.optional<Schema.Struct<{
518
+ readonly verbosity: Schema.optional<Schema.declare<OpenResponsesOptions.TextVerbosity, OpenResponsesOptions.TextVerbosity>>;
519
+ }>>;
520
+ readonly max_output_tokens: Schema.optional<Schema.Number>;
521
+ readonly max_tool_calls: Schema.optional<Schema.Int>;
522
+ readonly parallel_tool_calls: Schema.optional<Schema.Boolean>;
523
+ readonly temperature: Schema.optional<Schema.Number>;
524
+ readonly top_p: Schema.optional<Schema.Number>;
525
+ readonly presence_penalty: Schema.optional<Schema.Number>;
526
+ readonly frequency_penalty: Schema.optional<Schema.Number>;
527
+ }>;
528
+ export type OpenResponsesBody = Schema.Schema.Type<typeof OpenResponsesBody>;
529
+ export declare const OpenResponsesUsage: Schema.Struct<{
530
+ readonly input_tokens: Schema.optional<Schema.Number>;
531
+ readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
532
+ readonly cached_tokens: Schema.optional<Schema.Number>;
533
+ readonly cache_write_tokens: Schema.optional<Schema.Number>;
534
+ }>>>;
535
+ readonly output_tokens: Schema.optional<Schema.Number>;
536
+ readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
537
+ readonly reasoning_tokens: Schema.optional<Schema.Number>;
538
+ }>>>;
539
+ readonly total_tokens: Schema.optional<Schema.Number>;
540
+ }>;
541
+ type OpenResponsesUsage = Schema.Schema.Type<typeof OpenResponsesUsage>;
542
+ export declare const StreamItem: Schema.StructWithRest<Schema.Struct<{
543
+ readonly type: Schema.String;
544
+ readonly id: Schema.optional<Schema.String>;
545
+ readonly call_id: Schema.optional<Schema.String>;
546
+ readonly name: Schema.optional<Schema.String>;
547
+ readonly namespace: Schema.optional<Schema.String>;
548
+ readonly arguments: Schema.optional<Schema.String>;
549
+ readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
550
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
551
+ export type StreamItem = Schema.Schema.Type<typeof StreamItem>;
552
+ export type OutputItem = StreamItem & {
553
+ readonly id: string;
554
+ };
555
+ export declare const WebSocketErrorEvent: Schema.StructWithRest<Schema.Struct<{
556
+ readonly type: Schema.tag<"error">;
557
+ readonly status: Schema.optional<Schema.Number>;
558
+ readonly status_code: Schema.optional<Schema.Number>;
559
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
560
+ readonly message: Schema.optional<Schema.String>;
561
+ readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
562
+ readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
563
+ readonly type: Schema.optional<Schema.NullOr<Schema.String>>;
564
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
565
+ readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
566
+ readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
567
+ }>>>;
568
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>>;
569
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
570
+ export declare const decodeKnownErrorEvent: (event: Event) => Effect.Effect<{
571
+ readonly [x: string]: unknown;
572
+ readonly type: "error";
573
+ readonly status?: number | undefined;
574
+ readonly code?: string | null | undefined;
575
+ readonly message?: string | undefined;
576
+ readonly headers?: {
577
+ readonly [x: string]: string | number | boolean;
578
+ } | undefined;
579
+ readonly error?: {
580
+ readonly type?: string | null | undefined;
581
+ readonly code?: string | null | undefined;
582
+ readonly message?: string | null | undefined;
583
+ readonly param?: string | null | undefined;
584
+ } | null | undefined;
585
+ readonly param?: string | null | undefined;
586
+ readonly status_code?: number | undefined;
587
+ }, Schema.SchemaError, never>;
588
+ export declare const Event: Schema.StructWithRest<Schema.Struct<{
589
+ readonly type: Schema.String;
590
+ readonly delta: Schema.optional<Schema.String>;
591
+ readonly arguments: Schema.optional<Schema.String>;
592
+ readonly text: Schema.optional<Schema.String>;
593
+ readonly item_id: Schema.optional<Schema.String>;
594
+ readonly output_index: Schema.optional<Schema.Number>;
595
+ readonly summary_index: Schema.optional<Schema.Number>;
596
+ readonly item: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
597
+ readonly type: Schema.String;
598
+ readonly id: Schema.optional<Schema.String>;
599
+ readonly call_id: Schema.optional<Schema.String>;
600
+ readonly name: Schema.optional<Schema.String>;
601
+ readonly namespace: Schema.optional<Schema.String>;
602
+ readonly arguments: Schema.optional<Schema.String>;
603
+ readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
604
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
605
+ readonly response: Schema.optional<Schema.StructWithRest<Schema.Struct<{
606
+ readonly id: Schema.optional<Schema.String>;
607
+ readonly service_tier: Schema.optional<Schema.NullOr<Schema.String>>;
608
+ readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
609
+ readonly reason: Schema.optional<Schema.String>;
610
+ }>>>;
611
+ readonly output: Schema.optional<Schema.$Array<Schema.StructWithRest<Schema.Struct<{
612
+ readonly type: Schema.String;
613
+ readonly id: Schema.optional<Schema.String>;
614
+ readonly call_id: Schema.optional<Schema.String>;
615
+ readonly name: Schema.optional<Schema.String>;
616
+ readonly namespace: Schema.optional<Schema.String>;
617
+ readonly arguments: Schema.optional<Schema.String>;
618
+ readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
619
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
620
+ readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
621
+ readonly input_tokens: Schema.optional<Schema.Number>;
622
+ readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
623
+ readonly cached_tokens: Schema.optional<Schema.Number>;
624
+ readonly cache_write_tokens: Schema.optional<Schema.Number>;
625
+ }>>>;
626
+ readonly output_tokens: Schema.optional<Schema.Number>;
627
+ readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
628
+ readonly reasoning_tokens: Schema.optional<Schema.Number>;
629
+ }>>>;
630
+ readonly total_tokens: Schema.optional<Schema.Number>;
631
+ }>>>;
632
+ readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
633
+ readonly type: Schema.optional<Schema.NullOr<Schema.String>>;
634
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
635
+ readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
636
+ readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
637
+ }>>>;
638
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
639
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
640
+ readonly message: Schema.optional<Schema.String>;
641
+ readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
642
+ readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
643
+ readonly type: Schema.optional<Schema.NullOr<Schema.String>>;
644
+ readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
645
+ readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
646
+ readonly param: Schema.optional<Schema.NullOr<Schema.String>>;
647
+ }>>>;
648
+ readonly status: Schema.optional<Schema.Unknown>;
649
+ readonly status_code: Schema.optional<Schema.Unknown>;
650
+ readonly headers: Schema.optional<Schema.Unknown>;
651
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
652
+ export type Event = Schema.Schema.Type<typeof Event>;
653
+ export type NormalizedEvent = Event & {
654
+ readonly item?: OutputItem | null;
655
+ };
656
+ export interface ProviderAdapter {
657
+ readonly id: string;
658
+ readonly name: string;
659
+ readonly lowerMedia?: (input: {
660
+ readonly part: MediaPart;
661
+ readonly media: ProviderShared.NormalizedMedia;
662
+ readonly request: LLMRequest;
663
+ }) => MediaInput | undefined;
664
+ readonly restoreHostedToolItem?: (item: unknown) => HostedToolReplayItem | undefined;
665
+ }
666
+ export interface ParserState {
667
+ readonly provider: LLMRequest["model"]["provider"];
668
+ readonly completedCompactions: ReadonlySet<string>;
669
+ readonly id: string;
670
+ readonly name: string;
671
+ readonly providerMetadataKey: string;
672
+ readonly tools: ToolStream.State<string>;
673
+ readonly hasFunctionCall: boolean;
674
+ readonly lifecycle: Lifecycle.State;
675
+ readonly outputItems: Readonly<Record<number, string>>;
676
+ readonly message: {
677
+ readonly id: string;
678
+ readonly phase: MessagePhase | null | undefined;
679
+ } | undefined;
680
+ readonly reasoningItems: Readonly<Record<string, ReasoningStreamItem>>;
681
+ }
682
+ type ReasoningSummaryStatus = "active" | "can-conclude" | "concluded";
683
+ interface ReasoningStreamItem {
684
+ readonly encryptedContent: string | null | undefined;
685
+ readonly summaryParts: Readonly<Record<number, ReasoningSummaryStatus>>;
686
+ readonly deltaIndexes: ReadonlySet<number>;
687
+ }
688
+ export declare const lowerTool: (protocolName: string, tool: ToolDefinition, inputSchema: {
689
+ readonly [x: string]: unknown;
690
+ }) => Effect.Effect<{
691
+ type: "function";
692
+ name: string;
693
+ description: string;
694
+ parameters: {
695
+ readonly [x: string]: unknown;
696
+ };
697
+ strict: boolean;
698
+ }, AIError, never>;
699
+ export declare const lowerToolChoice: (protocolName: string, toolChoice: NonNullable<LLMRequest["toolChoice"]>) => Effect.Effect<"required" | "auto" | "none" | {
700
+ type: "function";
701
+ name: string;
702
+ }, AIError, never>;
703
+ export declare const lowerConversation: (request: LLMRequest<import("../schema/options.js").LanguageModel<{
704
+ readonly [x: string]: unknown;
705
+ }, import("../route.js").CompactionOperations | undefined>>, adapter: ProviderAdapter) => Effect.Effect<{
706
+ instructions?: string | undefined;
707
+ model: string & import("effect/Brand").Brand<"AI.ModelID">;
708
+ input: LoweredInputItem[];
709
+ }, AIError, never>;
710
+ export declare const lowerGeneration: (request: LLMRequest) => {
711
+ truncation?: "auto" | "disabled" | undefined;
712
+ parallel_tool_calls?: boolean | undefined;
713
+ max_tool_calls?: number | undefined;
714
+ service_tier?: OpenResponsesOptions.ServiceTier | undefined;
715
+ text?: {
716
+ verbosity: OpenResponsesOptions.TextVerbosity;
717
+ } | undefined;
718
+ reasoning?: {
719
+ effort: OpenResponsesOptions.ReasoningEffort | undefined;
720
+ summary: "auto" | "concise" | "detailed" | undefined;
721
+ } | undefined;
722
+ include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
723
+ prompt_cache_key?: string | undefined;
724
+ top_logprobs?: number | undefined;
725
+ stream_options?: {
726
+ include_obfuscation: boolean;
727
+ } | undefined;
728
+ safety_identifier?: string | undefined;
729
+ metadata?: {
730
+ readonly [x: string]: string;
731
+ } | undefined;
732
+ store?: boolean | undefined;
733
+ stream: true;
734
+ max_output_tokens: number | undefined;
735
+ temperature: number | undefined;
736
+ top_p: number | undefined;
737
+ presence_penalty: number | undefined;
738
+ frequency_penalty: number | undefined;
739
+ };
740
+ export declare const resolveParallelToolCalls: (request: LLMRequest) => boolean | undefined;
741
+ export declare const allowedToolChoice: (request: LLMRequest) => {
742
+ type: "allowed_tools";
743
+ mode: "required" | "auto" | "none";
744
+ tools: {
745
+ type: "function";
746
+ name: string;
747
+ }[];
748
+ } | undefined;
749
+ export declare const fromRequestWithAdapter: (request: LLMRequest<import("../schema/options.js").LanguageModel<{
750
+ readonly [x: string]: unknown;
751
+ }, import("../route.js").CompactionOperations | undefined>>, adapter: ProviderAdapter) => Effect.Effect<{
752
+ tools: {
753
+ type: "function";
754
+ name: string;
755
+ description: string;
756
+ parameters: {
757
+ readonly [x: string]: unknown;
758
+ };
759
+ strict: boolean;
760
+ }[] | undefined;
761
+ tool_choice: "required" | "auto" | "none" | {
762
+ type: "allowed_tools";
763
+ mode: "required" | "auto" | "none";
764
+ tools: {
765
+ type: "function";
766
+ name: string;
767
+ }[];
768
+ } | {
769
+ type: "function";
770
+ name: string;
771
+ } | undefined;
772
+ truncation?: "auto" | "disabled" | undefined;
773
+ parallel_tool_calls?: boolean | undefined;
774
+ max_tool_calls?: number | undefined;
775
+ service_tier?: OpenResponsesOptions.ServiceTier | undefined;
776
+ text?: {
777
+ verbosity: OpenResponsesOptions.TextVerbosity;
778
+ } | undefined;
779
+ reasoning?: {
780
+ effort: OpenResponsesOptions.ReasoningEffort | undefined;
781
+ summary: "auto" | "concise" | "detailed" | undefined;
782
+ } | undefined;
783
+ include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
784
+ prompt_cache_key?: string | undefined;
785
+ top_logprobs?: number | undefined;
786
+ stream_options?: {
787
+ include_obfuscation: boolean;
788
+ } | undefined;
789
+ safety_identifier?: string | undefined;
790
+ metadata?: {
791
+ readonly [x: string]: string;
792
+ } | undefined;
793
+ store?: boolean | undefined;
794
+ stream: true;
795
+ max_output_tokens: number | undefined;
796
+ temperature: number | undefined;
797
+ top_p: number | undefined;
798
+ presence_penalty: number | undefined;
799
+ frequency_penalty: number | undefined;
800
+ instructions?: string | undefined;
801
+ model: string & import("effect/Brand").Brand<"AI.ModelID">;
802
+ input: LoweredInputItem[];
803
+ }, AIError, never>;
804
+ export declare const fromRequest: (request: LLMRequest<import("../schema/options.js").LanguageModel<{
805
+ readonly [x: string]: unknown;
806
+ }, import("../route.js").CompactionOperations | undefined>>) => Effect.Effect<{
807
+ readonly input: readonly ({
808
+ readonly [x: string]: unknown;
809
+ readonly id: string;
810
+ readonly type: "web_search_call";
811
+ readonly status?: string | undefined;
812
+ readonly action?: {
813
+ readonly [x: string]: unknown;
814
+ } | null | undefined;
815
+ } | {
816
+ readonly [x: string]: unknown;
817
+ readonly id: string;
818
+ readonly type: "file_search_call";
819
+ readonly status?: string | undefined;
820
+ readonly queries?: readonly string[] | undefined;
821
+ readonly results?: readonly {
822
+ readonly [x: string]: unknown;
823
+ }[] | null | undefined;
824
+ } | {
825
+ readonly [x: string]: unknown;
826
+ readonly id: string;
827
+ readonly type: "code_interpreter_call";
828
+ readonly status?: string | undefined;
829
+ readonly code?: string | null | undefined;
830
+ readonly container_id?: string | null | undefined;
831
+ readonly outputs?: readonly {
832
+ readonly [x: string]: unknown;
833
+ }[] | null | undefined;
834
+ } | {
835
+ readonly [x: string]: unknown;
836
+ readonly id: string;
837
+ readonly type: "mcp_call";
838
+ readonly status?: string | undefined;
839
+ readonly name?: string | undefined;
840
+ readonly output?: string | null | undefined;
841
+ readonly error?: unknown;
842
+ readonly arguments?: string | undefined;
843
+ readonly server_label?: string | undefined;
844
+ } | {
845
+ readonly type: "reasoning";
846
+ readonly summary: readonly {
847
+ readonly type: "summary_text";
848
+ readonly text: string;
849
+ }[];
850
+ readonly id?: string | undefined;
851
+ readonly encrypted_content?: string | null | undefined;
852
+ } | {
853
+ readonly type: "compaction";
854
+ readonly encrypted_content: string;
855
+ readonly id?: string | null | undefined;
856
+ } | {
857
+ readonly role: "system";
858
+ readonly content: string;
859
+ } | {
860
+ readonly role: "developer";
861
+ readonly content: string;
862
+ } | {
863
+ readonly content: readonly ({
864
+ readonly type: "input_image";
865
+ readonly image_url: string;
866
+ readonly detail?: string | undefined;
867
+ } | {
868
+ readonly type: "input_file";
869
+ readonly filename: string;
870
+ readonly detail?: string | undefined;
871
+ readonly file_data?: string | undefined;
872
+ readonly file_url?: string | undefined;
873
+ } | {
874
+ readonly type: "input_text";
875
+ readonly text: string;
876
+ })[];
877
+ readonly role: "user";
878
+ readonly id?: string | undefined;
879
+ readonly type?: "message" | undefined;
880
+ readonly status?: string | undefined;
881
+ } | {
882
+ readonly type: "message";
883
+ readonly content: readonly {
884
+ readonly type: "output_text";
885
+ readonly text: string;
886
+ }[];
887
+ readonly role: "assistant";
888
+ readonly id?: string | undefined;
889
+ readonly status?: string | undefined;
890
+ readonly phase?: "commentary" | "final_answer" | null | undefined;
891
+ } | {
892
+ readonly type: "function_call";
893
+ readonly name: string;
894
+ readonly arguments: string;
895
+ readonly call_id: string;
896
+ readonly id?: string | undefined;
897
+ readonly namespace?: string | undefined;
898
+ } | {
899
+ readonly type: "function_call_output";
900
+ readonly call_id: string;
901
+ readonly output: string | readonly ({
902
+ readonly type: "input_image";
903
+ readonly image_url: string;
904
+ readonly detail?: string | undefined;
905
+ } | {
906
+ readonly type: "input_file";
907
+ readonly filename: string;
908
+ readonly detail?: string | undefined;
909
+ readonly file_data?: string | undefined;
910
+ readonly file_url?: string | undefined;
911
+ } | {
912
+ readonly type: "input_text";
913
+ readonly text: string;
914
+ } | {
915
+ readonly type: "input_video";
916
+ readonly video_url: string;
917
+ })[];
918
+ })[];
919
+ readonly model: string;
920
+ readonly stream: true;
921
+ readonly metadata?: {
922
+ readonly [x: string]: string;
923
+ } | undefined;
924
+ readonly instructions?: string | undefined;
925
+ readonly reasoning?: {
926
+ readonly summary?: "auto" | "concise" | "detailed" | undefined;
927
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
928
+ } | undefined;
929
+ readonly tools?: readonly {
930
+ readonly type: "function";
931
+ readonly description: string;
932
+ readonly name: string;
933
+ readonly parameters: {
934
+ readonly [x: string]: unknown;
935
+ };
936
+ readonly strict?: boolean | undefined;
937
+ }[] | undefined;
938
+ readonly text?: {
939
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
940
+ } | undefined;
941
+ readonly temperature?: number | undefined;
942
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
943
+ readonly tool_choice?: "required" | "auto" | "none" | {
944
+ readonly type: "function";
945
+ readonly name: string;
946
+ } | {
947
+ readonly type: "allowed_tools";
948
+ readonly mode: "required" | "auto" | "none";
949
+ readonly tools: readonly {
950
+ readonly type: "function";
951
+ readonly name: string;
952
+ }[];
953
+ } | undefined;
954
+ readonly top_p?: number | undefined;
955
+ readonly frequency_penalty?: number | undefined;
956
+ readonly presence_penalty?: number | undefined;
957
+ readonly prompt_cache_key?: string | undefined;
958
+ readonly parallel_tool_calls?: boolean | undefined;
959
+ readonly store?: boolean | undefined;
960
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
961
+ readonly truncation?: "auto" | "disabled" | undefined;
962
+ readonly stream_options?: {
963
+ readonly include_obfuscation?: boolean | undefined;
964
+ } | undefined;
965
+ readonly safety_identifier?: string | undefined;
966
+ readonly top_logprobs?: number | undefined;
967
+ readonly max_output_tokens?: number | undefined;
968
+ readonly max_tool_calls?: number | undefined;
969
+ }, AIError, never>;
970
+ export declare const mapUsage: (usage: OpenResponsesUsage | null | undefined, providerMetadataKey: string) => Usage | undefined;
971
+ export declare const metadataKey: (model: LLMRequest["model"]) => string;
972
+ export declare const providerMetadata: (state: ParserState, metadata: Record<string, unknown>) => ProviderMetadata;
973
+ export type StepResult = readonly [ParserState, ReadonlyArray<LLMEvent>];
974
+ export declare const terminal: (event: Event) => boolean;
975
+ export declare const normalize: (state: Pick<ParserState, "outputItems">, input: Event) => NormalizedEvent;
976
+ export declare const onReasoningDelta: (state: ParserState, event: Event, itemID: string) => StepResult;
977
+ export declare const onReasoningDone: (state: ParserState, event: Event, itemID: string) => StepResult;
978
+ export declare const providerFailure: (event: Event, fallback: string, body?: string) => AIError;
979
+ export declare const step: (state: ParserState, event: NormalizedEvent) => AIError | Effect.Effect<[ParserState, readonly (({
980
+ readonly type: "compaction";
981
+ readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
982
+ readonly id?: string | undefined;
983
+ readonly text?: string | null | undefined;
984
+ readonly encrypted?: string | undefined;
985
+ } & ({
986
+ readonly encrypted: string;
987
+ readonly text?: never;
988
+ } | {
989
+ readonly text: string | null;
990
+ readonly encrypted?: never;
991
+ })) | {
992
+ readonly type: "step-start";
993
+ readonly index: number;
994
+ } | {
995
+ readonly id: string;
996
+ readonly type: "text-start";
997
+ readonly providerMetadata?: {
998
+ readonly [x: string]: {
999
+ readonly [x: string]: unknown;
1000
+ };
1001
+ } | undefined;
1002
+ } | {
1003
+ readonly id: string;
1004
+ readonly type: "text-delta";
1005
+ readonly text: string;
1006
+ readonly providerMetadata?: {
1007
+ readonly [x: string]: {
1008
+ readonly [x: string]: unknown;
1009
+ };
1010
+ } | undefined;
1011
+ } | {
1012
+ readonly id: string;
1013
+ readonly type: "text-end";
1014
+ readonly text?: string | undefined;
1015
+ readonly providerMetadata?: {
1016
+ readonly [x: string]: {
1017
+ readonly [x: string]: unknown;
1018
+ };
1019
+ } | undefined;
1020
+ } | {
1021
+ readonly id: string;
1022
+ readonly type: "reasoning-start";
1023
+ readonly providerMetadata?: {
1024
+ readonly [x: string]: {
1025
+ readonly [x: string]: unknown;
1026
+ };
1027
+ } | undefined;
1028
+ } | {
1029
+ readonly id: string;
1030
+ readonly type: "reasoning-delta";
1031
+ readonly text: string;
1032
+ readonly providerMetadata?: {
1033
+ readonly [x: string]: {
1034
+ readonly [x: string]: unknown;
1035
+ };
1036
+ } | undefined;
1037
+ } | {
1038
+ readonly id: string;
1039
+ readonly type: "reasoning-end";
1040
+ readonly text?: string | undefined;
1041
+ readonly providerMetadata?: {
1042
+ readonly [x: string]: {
1043
+ readonly [x: string]: unknown;
1044
+ };
1045
+ } | undefined;
1046
+ } | {
1047
+ readonly id: string;
1048
+ readonly type: "tool-input-start";
1049
+ readonly name: string;
1050
+ readonly providerMetadata?: {
1051
+ readonly [x: string]: {
1052
+ readonly [x: string]: unknown;
1053
+ };
1054
+ } | undefined;
1055
+ readonly namespace?: string | undefined;
1056
+ readonly providerExecuted?: boolean | undefined;
1057
+ } | {
1058
+ readonly id: string;
1059
+ readonly type: "tool-input-delta";
1060
+ readonly name: string;
1061
+ readonly text: string;
1062
+ readonly input?: unknown;
1063
+ readonly namespace?: string | undefined;
1064
+ } | {
1065
+ readonly id: string;
1066
+ readonly type: "tool-input-end";
1067
+ readonly name: string;
1068
+ readonly providerMetadata?: {
1069
+ readonly [x: string]: {
1070
+ readonly [x: string]: unknown;
1071
+ };
1072
+ } | undefined;
1073
+ readonly namespace?: string | undefined;
1074
+ } | {
1075
+ readonly id: string;
1076
+ readonly type: "tool-input-error";
1077
+ readonly name: string;
1078
+ readonly raw: string;
1079
+ readonly namespace?: string | undefined;
1080
+ } | {
1081
+ readonly id: string;
1082
+ readonly type: "tool-call";
1083
+ readonly name: string;
1084
+ readonly input: unknown;
1085
+ readonly providerMetadata?: {
1086
+ readonly [x: string]: {
1087
+ readonly [x: string]: unknown;
1088
+ };
1089
+ } | undefined;
1090
+ readonly namespace?: string | undefined;
1091
+ readonly providerExecuted?: boolean | undefined;
1092
+ } | {
1093
+ readonly id: string;
1094
+ readonly type: "tool-result";
1095
+ readonly name: string;
1096
+ readonly result: {
1097
+ readonly type: "json";
1098
+ readonly value: unknown;
1099
+ } | {
1100
+ readonly type: "text";
1101
+ readonly value: unknown;
1102
+ } | {
1103
+ readonly type: "error";
1104
+ readonly value: unknown;
1105
+ } | {
1106
+ readonly type: "content";
1107
+ readonly value: readonly ({
1108
+ readonly type: "text";
1109
+ readonly text: string;
1110
+ } | {
1111
+ readonly type: "file";
1112
+ readonly uri: string;
1113
+ readonly mime: string;
1114
+ readonly name?: string | undefined;
1115
+ })[];
1116
+ };
1117
+ readonly output?: {
1118
+ readonly structured: unknown;
1119
+ readonly content: readonly ({
1120
+ readonly type: "text";
1121
+ readonly text: string;
1122
+ } | {
1123
+ readonly type: "file";
1124
+ readonly uri: string;
1125
+ readonly mime: string;
1126
+ readonly name?: string | undefined;
1127
+ })[];
1128
+ } | undefined;
1129
+ readonly providerMetadata?: {
1130
+ readonly [x: string]: {
1131
+ readonly [x: string]: unknown;
1132
+ };
1133
+ } | undefined;
1134
+ readonly namespace?: string | undefined;
1135
+ readonly providerExecuted?: boolean | undefined;
1136
+ } | {
1137
+ readonly id: string;
1138
+ readonly type: "tool-error";
1139
+ readonly name: string;
1140
+ readonly message: string;
1141
+ readonly error?: unknown;
1142
+ readonly providerMetadata?: {
1143
+ readonly [x: string]: {
1144
+ readonly [x: string]: unknown;
1145
+ };
1146
+ } | undefined;
1147
+ readonly namespace?: string | undefined;
1148
+ } | {
1149
+ readonly type: "step-finish";
1150
+ readonly reason: {
1151
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
1152
+ readonly raw?: string | undefined;
1153
+ };
1154
+ readonly index: number;
1155
+ readonly providerMetadata?: {
1156
+ readonly [x: string]: {
1157
+ readonly [x: string]: unknown;
1158
+ };
1159
+ } | undefined;
1160
+ readonly usage?: Usage | undefined;
1161
+ } | {
1162
+ readonly type: "finish";
1163
+ readonly reason: {
1164
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
1165
+ readonly raw?: string | undefined;
1166
+ };
1167
+ readonly providerMetadata?: {
1168
+ readonly [x: string]: {
1169
+ readonly [x: string]: unknown;
1170
+ };
1171
+ } | undefined;
1172
+ readonly usage?: Usage | undefined;
1173
+ } | {
1174
+ readonly type: "provider-error";
1175
+ readonly message: string;
1176
+ readonly providerMetadata?: {
1177
+ readonly [x: string]: {
1178
+ readonly [x: string]: unknown;
1179
+ };
1180
+ } | undefined;
1181
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
1182
+ })[]], AIError, never> | Effect.Effect<StepResult, never, never>;
1183
+ /**
1184
+ * The provider-neutral Open Responses protocol. Provider-specific Responses
1185
+ * implementations compose this baseline with their own tools and event variants.
1186
+ */
1187
+ export declare const initial: (request: LLMRequest, adapter?: ProviderAdapter) => ParserState;
1188
+ export declare const protocol: Protocol<{
1189
+ readonly input: readonly ({
1190
+ readonly [x: string]: unknown;
1191
+ readonly id: string;
1192
+ readonly type: "web_search_call";
1193
+ readonly status?: string | undefined;
1194
+ readonly action?: {
1195
+ readonly [x: string]: unknown;
1196
+ } | null | undefined;
1197
+ } | {
1198
+ readonly [x: string]: unknown;
1199
+ readonly id: string;
1200
+ readonly type: "file_search_call";
1201
+ readonly status?: string | undefined;
1202
+ readonly queries?: readonly string[] | undefined;
1203
+ readonly results?: readonly {
1204
+ readonly [x: string]: unknown;
1205
+ }[] | null | undefined;
1206
+ } | {
1207
+ readonly [x: string]: unknown;
1208
+ readonly id: string;
1209
+ readonly type: "code_interpreter_call";
1210
+ readonly status?: string | undefined;
1211
+ readonly code?: string | null | undefined;
1212
+ readonly container_id?: string | null | undefined;
1213
+ readonly outputs?: readonly {
1214
+ readonly [x: string]: unknown;
1215
+ }[] | null | undefined;
1216
+ } | {
1217
+ readonly [x: string]: unknown;
1218
+ readonly id: string;
1219
+ readonly type: "mcp_call";
1220
+ readonly status?: string | undefined;
1221
+ readonly name?: string | undefined;
1222
+ readonly output?: string | null | undefined;
1223
+ readonly error?: unknown;
1224
+ readonly arguments?: string | undefined;
1225
+ readonly server_label?: string | undefined;
1226
+ } | {
1227
+ readonly type: "reasoning";
1228
+ readonly summary: readonly {
1229
+ readonly type: "summary_text";
1230
+ readonly text: string;
1231
+ }[];
1232
+ readonly id?: string | undefined;
1233
+ readonly encrypted_content?: string | null | undefined;
1234
+ } | {
1235
+ readonly type: "compaction";
1236
+ readonly encrypted_content: string;
1237
+ readonly id?: string | null | undefined;
1238
+ } | {
1239
+ readonly role: "system";
1240
+ readonly content: string;
1241
+ } | {
1242
+ readonly role: "developer";
1243
+ readonly content: string;
1244
+ } | {
1245
+ readonly content: readonly ({
1246
+ readonly type: "input_image";
1247
+ readonly image_url: string;
1248
+ readonly detail?: string | undefined;
1249
+ } | {
1250
+ readonly type: "input_file";
1251
+ readonly filename: string;
1252
+ readonly detail?: string | undefined;
1253
+ readonly file_data?: string | undefined;
1254
+ readonly file_url?: string | undefined;
1255
+ } | {
1256
+ readonly type: "input_text";
1257
+ readonly text: string;
1258
+ })[];
1259
+ readonly role: "user";
1260
+ readonly id?: string | undefined;
1261
+ readonly type?: "message" | undefined;
1262
+ readonly status?: string | undefined;
1263
+ } | {
1264
+ readonly type: "message";
1265
+ readonly content: readonly {
1266
+ readonly type: "output_text";
1267
+ readonly text: string;
1268
+ }[];
1269
+ readonly role: "assistant";
1270
+ readonly id?: string | undefined;
1271
+ readonly status?: string | undefined;
1272
+ readonly phase?: "commentary" | "final_answer" | null | undefined;
1273
+ } | {
1274
+ readonly type: "function_call";
1275
+ readonly name: string;
1276
+ readonly arguments: string;
1277
+ readonly call_id: string;
1278
+ readonly id?: string | undefined;
1279
+ readonly namespace?: string | undefined;
1280
+ } | {
1281
+ readonly type: "function_call_output";
1282
+ readonly call_id: string;
1283
+ readonly output: string | readonly ({
1284
+ readonly type: "input_image";
1285
+ readonly image_url: string;
1286
+ readonly detail?: string | undefined;
1287
+ } | {
1288
+ readonly type: "input_file";
1289
+ readonly filename: string;
1290
+ readonly detail?: string | undefined;
1291
+ readonly file_data?: string | undefined;
1292
+ readonly file_url?: string | undefined;
1293
+ } | {
1294
+ readonly type: "input_text";
1295
+ readonly text: string;
1296
+ } | {
1297
+ readonly type: "input_video";
1298
+ readonly video_url: string;
1299
+ })[];
1300
+ })[];
1301
+ readonly model: string;
1302
+ readonly stream: true;
1303
+ readonly metadata?: {
1304
+ readonly [x: string]: string;
1305
+ } | undefined;
1306
+ readonly instructions?: string | undefined;
1307
+ readonly reasoning?: {
1308
+ readonly summary?: "auto" | "concise" | "detailed" | undefined;
1309
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1310
+ } | undefined;
1311
+ readonly tools?: readonly {
1312
+ readonly type: "function";
1313
+ readonly description: string;
1314
+ readonly name: string;
1315
+ readonly parameters: {
1316
+ readonly [x: string]: unknown;
1317
+ };
1318
+ readonly strict?: boolean | undefined;
1319
+ }[] | undefined;
1320
+ readonly text?: {
1321
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
1322
+ } | undefined;
1323
+ readonly temperature?: number | undefined;
1324
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
1325
+ readonly tool_choice?: "required" | "auto" | "none" | {
1326
+ readonly type: "function";
1327
+ readonly name: string;
1328
+ } | {
1329
+ readonly type: "allowed_tools";
1330
+ readonly mode: "required" | "auto" | "none";
1331
+ readonly tools: readonly {
1332
+ readonly type: "function";
1333
+ readonly name: string;
1334
+ }[];
1335
+ } | undefined;
1336
+ readonly top_p?: number | undefined;
1337
+ readonly frequency_penalty?: number | undefined;
1338
+ readonly presence_penalty?: number | undefined;
1339
+ readonly prompt_cache_key?: string | undefined;
1340
+ readonly parallel_tool_calls?: boolean | undefined;
1341
+ readonly store?: boolean | undefined;
1342
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
1343
+ readonly truncation?: "auto" | "disabled" | undefined;
1344
+ readonly stream_options?: {
1345
+ readonly include_obfuscation?: boolean | undefined;
1346
+ } | undefined;
1347
+ readonly safety_identifier?: string | undefined;
1348
+ readonly top_logprobs?: number | undefined;
1349
+ readonly max_output_tokens?: number | undefined;
1350
+ readonly max_tool_calls?: number | undefined;
1351
+ }, string, {
1352
+ readonly [x: string]: unknown;
1353
+ readonly type: string;
1354
+ readonly status?: unknown;
1355
+ readonly code?: string | null | undefined;
1356
+ readonly message?: string | undefined;
1357
+ readonly headers?: unknown;
1358
+ readonly text?: string | undefined;
1359
+ readonly error?: {
1360
+ readonly type?: string | null | undefined;
1361
+ readonly code?: string | null | undefined;
1362
+ readonly message?: string | null | undefined;
1363
+ readonly param?: string | null | undefined;
1364
+ } | null | undefined;
1365
+ readonly item?: {
1366
+ readonly [x: string]: unknown;
1367
+ readonly type: string;
1368
+ readonly id?: string | undefined;
1369
+ readonly name?: string | undefined;
1370
+ readonly namespace?: string | undefined;
1371
+ readonly arguments?: string | undefined;
1372
+ readonly encrypted_content?: string | null | undefined;
1373
+ readonly call_id?: string | undefined;
1374
+ } | null | undefined;
1375
+ readonly delta?: string | undefined;
1376
+ readonly response?: {
1377
+ readonly [x: string]: unknown;
1378
+ readonly id?: string | undefined;
1379
+ readonly output?: readonly {
1380
+ readonly [x: string]: unknown;
1381
+ readonly type: string;
1382
+ readonly id?: string | undefined;
1383
+ readonly name?: string | undefined;
1384
+ readonly namespace?: string | undefined;
1385
+ readonly arguments?: string | undefined;
1386
+ readonly encrypted_content?: string | null | undefined;
1387
+ readonly call_id?: string | undefined;
1388
+ }[] | undefined;
1389
+ readonly error?: {
1390
+ readonly type?: string | null | undefined;
1391
+ readonly code?: string | null | undefined;
1392
+ readonly message?: string | null | undefined;
1393
+ readonly param?: string | null | undefined;
1394
+ } | null | undefined;
1395
+ readonly usage?: {
1396
+ readonly input_tokens?: number | undefined;
1397
+ readonly output_tokens?: number | undefined;
1398
+ readonly output_tokens_details?: {
1399
+ readonly reasoning_tokens?: number | undefined;
1400
+ } | null | undefined;
1401
+ readonly total_tokens?: number | undefined;
1402
+ readonly input_tokens_details?: {
1403
+ readonly cached_tokens?: number | undefined;
1404
+ readonly cache_write_tokens?: number | undefined;
1405
+ } | null | undefined;
1406
+ } | null | undefined;
1407
+ readonly service_tier?: string | null | undefined;
1408
+ readonly incomplete_details?: {
1409
+ readonly reason?: string | undefined;
1410
+ } | null | undefined;
1411
+ } | undefined;
1412
+ readonly arguments?: string | undefined;
1413
+ readonly param?: string | null | undefined;
1414
+ readonly status_code?: unknown;
1415
+ readonly item_id?: string | undefined;
1416
+ readonly output_index?: number | undefined;
1417
+ readonly summary_index?: number | undefined;
1418
+ }, ParserState>;
1419
+ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1420
+ readonly input: readonly ({
1421
+ readonly [x: string]: unknown;
1422
+ readonly id: string;
1423
+ readonly type: "web_search_call";
1424
+ readonly status?: string | undefined;
1425
+ readonly action?: {
1426
+ readonly [x: string]: unknown;
1427
+ } | null | undefined;
1428
+ } | {
1429
+ readonly [x: string]: unknown;
1430
+ readonly id: string;
1431
+ readonly type: "file_search_call";
1432
+ readonly status?: string | undefined;
1433
+ readonly queries?: readonly string[] | undefined;
1434
+ readonly results?: readonly {
1435
+ readonly [x: string]: unknown;
1436
+ }[] | null | undefined;
1437
+ } | {
1438
+ readonly [x: string]: unknown;
1439
+ readonly id: string;
1440
+ readonly type: "code_interpreter_call";
1441
+ readonly status?: string | undefined;
1442
+ readonly code?: string | null | undefined;
1443
+ readonly container_id?: string | null | undefined;
1444
+ readonly outputs?: readonly {
1445
+ readonly [x: string]: unknown;
1446
+ }[] | null | undefined;
1447
+ } | {
1448
+ readonly [x: string]: unknown;
1449
+ readonly id: string;
1450
+ readonly type: "mcp_call";
1451
+ readonly status?: string | undefined;
1452
+ readonly name?: string | undefined;
1453
+ readonly output?: string | null | undefined;
1454
+ readonly error?: unknown;
1455
+ readonly arguments?: string | undefined;
1456
+ readonly server_label?: string | undefined;
1457
+ } | {
1458
+ readonly type: "reasoning";
1459
+ readonly summary: readonly {
1460
+ readonly type: "summary_text";
1461
+ readonly text: string;
1462
+ }[];
1463
+ readonly id?: string | undefined;
1464
+ readonly encrypted_content?: string | null | undefined;
1465
+ } | {
1466
+ readonly type: "compaction";
1467
+ readonly encrypted_content: string;
1468
+ readonly id?: string | null | undefined;
1469
+ } | {
1470
+ readonly role: "system";
1471
+ readonly content: string;
1472
+ } | {
1473
+ readonly role: "developer";
1474
+ readonly content: string;
1475
+ } | {
1476
+ readonly content: readonly ({
1477
+ readonly type: "input_image";
1478
+ readonly image_url: string;
1479
+ readonly detail?: string | undefined;
1480
+ } | {
1481
+ readonly type: "input_file";
1482
+ readonly filename: string;
1483
+ readonly detail?: string | undefined;
1484
+ readonly file_data?: string | undefined;
1485
+ readonly file_url?: string | undefined;
1486
+ } | {
1487
+ readonly type: "input_text";
1488
+ readonly text: string;
1489
+ })[];
1490
+ readonly role: "user";
1491
+ readonly id?: string | undefined;
1492
+ readonly type?: "message" | undefined;
1493
+ readonly status?: string | undefined;
1494
+ } | {
1495
+ readonly type: "message";
1496
+ readonly content: readonly {
1497
+ readonly type: "output_text";
1498
+ readonly text: string;
1499
+ }[];
1500
+ readonly role: "assistant";
1501
+ readonly id?: string | undefined;
1502
+ readonly status?: string | undefined;
1503
+ readonly phase?: "commentary" | "final_answer" | null | undefined;
1504
+ } | {
1505
+ readonly type: "function_call";
1506
+ readonly name: string;
1507
+ readonly arguments: string;
1508
+ readonly call_id: string;
1509
+ readonly id?: string | undefined;
1510
+ readonly namespace?: string | undefined;
1511
+ } | {
1512
+ readonly type: "function_call_output";
1513
+ readonly call_id: string;
1514
+ readonly output: string | readonly ({
1515
+ readonly type: "input_image";
1516
+ readonly image_url: string;
1517
+ readonly detail?: string | undefined;
1518
+ } | {
1519
+ readonly type: "input_file";
1520
+ readonly filename: string;
1521
+ readonly detail?: string | undefined;
1522
+ readonly file_data?: string | undefined;
1523
+ readonly file_url?: string | undefined;
1524
+ } | {
1525
+ readonly type: "input_text";
1526
+ readonly text: string;
1527
+ } | {
1528
+ readonly type: "input_video";
1529
+ readonly video_url: string;
1530
+ })[];
1531
+ })[];
1532
+ readonly model: string;
1533
+ readonly stream: true;
1534
+ readonly metadata?: {
1535
+ readonly [x: string]: string;
1536
+ } | undefined;
1537
+ readonly instructions?: string | undefined;
1538
+ readonly reasoning?: {
1539
+ readonly summary?: "auto" | "concise" | "detailed" | undefined;
1540
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1541
+ } | undefined;
1542
+ readonly tools?: readonly {
1543
+ readonly type: "function";
1544
+ readonly description: string;
1545
+ readonly name: string;
1546
+ readonly parameters: {
1547
+ readonly [x: string]: unknown;
1548
+ };
1549
+ readonly strict?: boolean | undefined;
1550
+ }[] | undefined;
1551
+ readonly text?: {
1552
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
1553
+ } | undefined;
1554
+ readonly temperature?: number | undefined;
1555
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
1556
+ readonly tool_choice?: "required" | "auto" | "none" | {
1557
+ readonly type: "function";
1558
+ readonly name: string;
1559
+ } | {
1560
+ readonly type: "allowed_tools";
1561
+ readonly mode: "required" | "auto" | "none";
1562
+ readonly tools: readonly {
1563
+ readonly type: "function";
1564
+ readonly name: string;
1565
+ }[];
1566
+ } | undefined;
1567
+ readonly top_p?: number | undefined;
1568
+ readonly frequency_penalty?: number | undefined;
1569
+ readonly presence_penalty?: number | undefined;
1570
+ readonly prompt_cache_key?: string | undefined;
1571
+ readonly parallel_tool_calls?: boolean | undefined;
1572
+ readonly store?: boolean | undefined;
1573
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
1574
+ readonly truncation?: "auto" | "disabled" | undefined;
1575
+ readonly stream_options?: {
1576
+ readonly include_obfuscation?: boolean | undefined;
1577
+ } | undefined;
1578
+ readonly safety_identifier?: string | undefined;
1579
+ readonly top_logprobs?: number | undefined;
1580
+ readonly max_output_tokens?: number | undefined;
1581
+ readonly max_tool_calls?: number | undefined;
1582
+ }, string>;
1583
+ export * as OpenResponses from "./open-responses.js";