@robota-sdk/agent-provider-openai 3.0.0-beta.99 → 3.0.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,345 @@
1
1
  # @robota-sdk/agent-provider-openai
2
2
 
3
+ ## 3.0.2
4
+ ### Patch Changes
5
+
6
+ - @robota-sdk/agent-core@3.0.2
7
+ - @robota-sdk/agent-provider-openai-compatible@3.0.2
8
+
9
+ ## 3.0.1
10
+ ### Patch Changes
11
+
12
+ - @robota-sdk/agent-core@3.0.1
13
+ - @robota-sdk/agent-provider-openai-compatible@3.0.1
14
+
15
+ ## 3.0.0
16
+ ### Minor Changes
17
+
18
+ - 1698be4: A child-process subagent can no longer send the parent's provider credential to a different
19
+ endpoint.
20
+
21
+ - **Before spawning a child**, the parent compares every environment variable that decides where
22
+ the provider connects or which credential it sends. If the child's environment differs, the job
23
+ is refused before the credential leaves the parent. The error names the variable, never its
24
+ value. The variables compared are:
25
+ - the proxy and TLS variables;
26
+ - the variables the provider's SDK reads, such as `OPENAI_BASE_URL`, `ANTHROPIC_AUTH_TOKEN` and
27
+ the Vertex settings;
28
+ - the credential's own variable.
29
+ - **The child** repeats the check before it builds its provider. It builds that provider from the
30
+ parent's effective connection exactly: it no longer fills in a base URL, options or a default
31
+ credential from its own registry, and a credential reference that resolves to nothing is refused.
32
+ - **Where the effective connection comes from:** the parent applies its own definition defaults
33
+ (base URL, options). `profileName` is sent only when it names the connection actually sent.
34
+ - **New contracts:**
35
+ - `IProviderDefinition.destinationEnvironment`, declared by every built-in provider.
36
+ - `createProviderFromExactProfile`, `connectionEnvironmentNames`,
37
+ `findConnectionEnvironmentDivergence`, `sealConnectionEnvironment`,
38
+ `verifyConnectionEnvironment` and `TRANSPORT_ENVIRONMENT`.
39
+ - The start payload's `connectionCheck`.
40
+ - The child-process runner's `providerDefinitions` option, now required: a provider with no
41
+ definition there is refused, because its connection cannot be checked.
42
+ - 4c73a0b: Provider failures keep the vendor's HTTP status and error type. `ProviderError` gains `status` and `type`, adapters throw `ProviderError` (or `RateLimitError` for a rate limit) instead of a bare `Error`, an Anthropic mid-stream `overloaded_error` event surfaces as a `ProviderError` with that type, and media errors carry `status`. New `classifyProviderFailure` says whether a failure is worth retrying on another model, and `toProviderError` is the shared adapter mapping.
43
+ - 04a6de4: **Reasoning text a provider streams now reaches the editor as an ACP `agent_thought_chunk`, through a new `thinking_delta` session event.**
44
+
45
+ `IChatOptions.onThinkingDelta`, `IRunOptions.onThinkingDelta` and `IResumeExecutionOptions.onThinkingDelta`
46
+ (typed `TThinkingDeltaCallback`) carry reasoning text from a provider through the run, and the session
47
+ options (`ISessionOptions.onThinkingDelta`, `ICreateSessionOptions.onThinkingDelta`) hand it to the
48
+ session's owner. `InteractiveSession` emits it as `thinking_delta(delta)`, beside `text_delta`. The
49
+ text is never part of the reply: it is not appended to the conversation, not streamed through
50
+ `onTextDelta`, and the core adds no record of its own for it (no text-delta log entry, no
51
+ `provider_stream_raw_delta`); a provider's own native payload capture and response metadata keep
52
+ what the provider sent, as before. A reasoning delta counts as provider activity for the idle
53
+ timeout whether or not anyone listens to it, so a model that is only thinking is not cut off. The
54
+ existing `thinking(isThinking)` event is unchanged and remains the busy indicator. Where a provider
55
+ sends no reasoning text, nothing is emitted and nothing new is switched on.
56
+
57
+ `@robota-sdk/agent-interface-session` is a major change because a new session event name makes an
58
+ exhaustive map over the event names stop compiling until it classifies the event.
59
+
60
+ `@robota-sdk/agent-transport-acp` sends each non-empty `thinking_delta` to the editor as an
61
+ `agent_thought_chunk`, in order with the message chunks, so `robota acp` shows the model's reasoning
62
+ in the editor. A turn that streamed only thoughts still shows its result text, because only reply
63
+ text marks a turn as streamed. The WebSocket wire, the HTTP stream, headless stream-json, `query()`
64
+ and the terminal UI do not carry the new event in this change (`@robota-sdk/agent-transport` and
65
+ `@robota-sdk/agent-ui-terminal` classify it as non-surface). A forked skill and an in-process subagent
66
+ pass their reply text up but not their reasoning.
67
+
68
+ Two providers already receive reasoning text and now report it. `@robota-sdk/agent-provider-openai`
69
+ passes `response.reasoning_summary_text.delta` events of a streamed Responses call to
70
+ `onThinkingDelta`; the API sends them only when the provider profile asks for a reasoning summary, and
71
+ no request option changed; a summary streamed in several parts, and the summary of a later reasoning
72
+ item, each start on a new paragraph (`\n\n`) so the parts do not run together.
73
+ `@robota-sdk/agent-provider-openai-compatible` reports the text of Gemma's thought channel, which the
74
+ provider already removed from the reply, as it streams across chunk boundaries, with each later
75
+ channel of one reply on a new paragraph; the reply text is unchanged. No other provider reports
76
+ reasoning, and Anthropic thinking is not enabled. A model fallback chain still moves to the next model when only reasoning had streamed.
77
+
78
+ The scripted test provider (`@robota-sdk/agent-core/testing`) accepts an optional `thinking` string on
79
+ a turn and delivers it through `onThinkingDelta` before the turn's text; the scripted session harness
80
+ collects `thinking_delta` and now keeps a scripted tool-call turn's `usage`, which it used to drop.
81
+ - 7937c19: Split the `@robota-sdk/agent-provider` monolith into SDK-aligned leaf packages (ARCH-PROVIDER-002 Stage A). The single package that hard-bundled all three vendor SDKs (`@anthropic-ai/sdk`, `openai`, `@google/genai`) is **removed** and replaced by per-vendor leaves, each depending only on `@robota-sdk/agent-core` + its one SDK: `@robota-sdk/agent-provider-anthropic`, `@robota-sdk/agent-provider-openai`, `@robota-sdk/agent-provider-openai-compatible` (DeepSeek/Qwen/Gemma over the shared OpenAI-compatible base), `@robota-sdk/agent-provider-gemini` (+ a `./google` entry), and `@robota-sdk/agent-provider-bytedance` (media/video `IVideoGenerationProvider`). The aggregated `createDefaultProviderDefinitions()` now lives in the new `@robota-sdk/agent-builtin-providers` leaf.
82
+
83
+ Migration: replace `@robota-sdk/agent-provider/<vendor>` imports with the corresponding `@robota-sdk/agent-provider-<vendor>` package (`/deepseek`, `/qwen`, `/gemma` → `@robota-sdk/agent-provider-openai-compatible`; `/google` → `@robota-sdk/agent-provider-gemini/google`), and import `createDefaultProviderDefinitions` from `@robota-sdk/agent-builtin-providers`. Consumers now pull only the vendor SDK(s) they actually use.
84
+
85
+ ### Patch Changes
86
+
87
+ - 8bd5fac: Cached input tokens are no longer dropped (#3209 R3). The OpenAI and OpenAI-compatible adapters read
88
+ `prompt_tokens_details.cached_tokens` (Chat Completions, including the final streamed usage chunk) and
89
+ `input_tokens_details.cached_tokens` (Responses, OpenAI and Qwen) into `cacheReadTokens` on the message
90
+ usage: the part of the prompt served from the provider's prompt cache, present only when reported.
91
+ It reaches the committed assistant message, `readTokenUsageFromMessage()`, and the
92
+ `provider_call_completed` execution event, so a consumer can apply the cache discount.
93
+
94
+ New `sumMessagesUsage(messages)` sums the usage on assistant messages (with `cacheReadTokens` when any
95
+ reported it), so one run's usage is `sumMessagesUsage(agent.getHistory().slice(before))` without
96
+ converting through `messageToHistoryEntry` (#3209 S1). `sumHistoryUsage` returns the same triple as before.
97
+
98
+ A forced-summary reply now keeps the usage its provider reported the same way a tool round's reply
99
+ does: an endpoint that omits `total_tokens` no longer loses exactly the summary call's usage (#3209 N3). Counts
100
+ the adapter could not attest as a consistent total are recorded with `usageProvenance: 'partial'`.
101
+ - 274328f: `OpenAIProvider({ strictTools: true })` now requests strict function calling on the Chat Completions
102
+ surface too (each tool is sent with `function.strict: true`), not only on the Responses surface. This
103
+ matters for every provider created with a `baseURL`, which defaults to Chat Completions. With
104
+ `strictTools` off the request is unchanged. `convertToOpenAICompatibleTools` accepts an optional
105
+ `{ strict }` argument.
106
+ - 57280bf: Every published package now declares `"engines": { "node": ">=22.12.0" }`. Before, 27 of the 38
107
+ packages declared no floor (`agent-core`, `agent-tools` and every provider among them),
108
+ `agent-session` and `agent-file-authority` declared `>=20.19.0`, and the other nine declared
109
+ `>=22.0.0`, so a consumer on Node 20 saw at most a warning from a transitive dependency.
110
+
111
+ Why 22.12: `agent-cli` and `agent-ui-terminal` need Node 22 through `ink` 7, and the CommonJS entries
112
+ of `agent-tools` and its dependents, `agent-transport`/`node` and its dependents, and
113
+ `agent-ui-terminal` `require()` ESM-only dependencies (`p-limit`, `jose`, `chalk`), which Node 22
114
+ supports unflagged only from 22.12. `engines` is advisory unless the consumer enables `engine-strict`.
115
+
116
+ No code changes: `tsdown` now reads `node22.12.0` as its build target from the field.
117
+ - 643effb: Aborting a run now cancels the provider's HTTP request on every call path. The non-streaming
118
+ `chat()` request — the one a forced end-of-round summary makes — sent no `AbortSignal` on OpenAI
119
+ Chat Completions, DeepSeek, Qwen (Chat Completions) and Gemma, so an aborted run left that request
120
+ running to completion; the same held for `chatStream()` on DeepSeek, Qwen (Chat Completions), Gemma
121
+ and Anthropic. Each now hands the call's `signal` to the SDK request.
122
+ - 18c0d5c: Every published package now exports `./package.json`, so `require('<package>/package.json')` and
123
+ `import('<package>/package.json', { with: { type: 'json' } })` work instead of failing with
124
+ `ERR_PACKAGE_PATH_NOT_EXPORTED`, and each tarball now ships the package's `CHANGELOG.md`.
125
+ - 3ab2eca: - External presets accept every permission mode a session does, `auto` included; `auto` used to fail validation.
126
+ - `createDagFramework({ ports: { costMeta } })` wires cost-metadata management; without it cost operations still report that they are unsupported.
127
+ - `startCli()` runs the subagent worker when a subagent starts the embedder's entry script again, as the product executable already did; an embedded CLI used to start a second CLI there.
128
+ - The provider `executor` option docs no longer import a `RemoteExecutor` that does not exist, and `IRemoteExecutorConfig` is marked deprecated: nothing implements a remote executor.
129
+ - 2c612ba: Release the migrated Robota product with its public SDK namespace, robota command, compatible SDK exports, internal product configuration, and verified CLI startup and delivery corrections.
130
+ - 9fbab1b: Provider DIP Stage B (ARCH-PROVIDER-003), part 1: collapse infrastructure. Adds the
131
+ provider-registry-driven `@robota-sdk/dag-node-llm-text` node that supersedes the
132
+ per-vendor LLM nodes + router, relocates the provider config resolver into
133
+ `agent-core`, adds SSOT cost/allowedModels fields, inverts the `llm-text` validator
134
+ tombstone, and wires `createDagFramework({ providers })`. Additive — the per-vendor
135
+ nodes still exist; consumer migration + their removal follow in part 2.
136
+ - 4f3c075: Assemble complete, verified package generations before switching build output; preserve the previous generation on build failure and pack only verified regular-file images. Include copied CLI web assets in affected-build ordering and artifact transfer. Preserve the CLI version in managed build paths. Public runtime contracts remain compatible (patch).
137
+ - b6d14ce: Make the universal JSON-schema subset able to express an object, so a nested `z.object()` keeps its
138
+ properties and required fields instead of reaching the model as `{ "type": "object" }`. Tools and
139
+ structured-output schemas with one level of nesting are now advertised in full and enforced on the
140
+ tool-input path; `z.union` / `z.discriminatedUnion` / `z.literal` are supported and map to `anyOf`
141
+ and single-value enums; `.nullable()` keeps its null branch; and Zod's `strip`, `strict` and
142
+ `passthrough` modes stop collapsing into two `additionalProperties` emissions. Fixes the shipped
143
+ `Computer` and `AskUserQuestion` built-ins, whose action and question fields were being dropped
144
+ entirely.
145
+
146
+ `agent-core` is **minor**, not patch: `IObjectParameterSchema` is a new export, and
147
+ `IParameterSchema.type` became optional (a union node carries `anyOf` instead of a type), which is a
148
+ consumer-visible type change — two call sites in this repo needed editing to keep compiling.
149
+ `additionalProperties` also widened to `boolean | IParameterSchema`, and `required` and `anyOf` are
150
+ new members. The provider packages are **patch**: each adapts to the widened subset without changing
151
+ its own public surface.
152
+ - 93d061d: CORE-043: structured output now knows which transport can carry the schema before the first call
153
+
154
+ `run(input, { output })` asked every provider for `responseFormat: { type: 'json_schema' }`. A
155
+ provider whose surface cannot express that accepted the option and dropped it — and the schema was
156
+ stated in words only by the RETRY feedback turn, which runs on attempt two. So against such a
157
+ provider, attempt one carried nothing describing the required shape and could only succeed by luck:
158
+ the advertised three attempts were really two, and the first was spent discovering something the
159
+ capability table already knew.
160
+
161
+ A `(provider, model)` pair now resolves to a mechanism (`response_schema` / `json_object` / `none`)
162
+ and a provenance (`catalog` / `vendor-default` / `undeclared` / `unverified-endpoint`), and the
163
+ request is shaped to match at the one seam that holds both the resolved provider and the outgoing
164
+ messages. When the wire cannot carry the shape, the schema is stated in the prompt on the FIRST
165
+ attempt. Each structured request emits a `structured_output_transport` event reporting what the
166
+ request actually did.
167
+
168
+ - `IAIProvider.endpointIsVendorDefault?()` — a provider configured with a custom `baseURL` reports
169
+ it, so the runtime stops claiming enforcement a gateway may not provide. Separate from
170
+ `capabilityTable?()` on purpose: `@robota-sdk/agent-provider-openai` declares no table (nobody has
171
+ verified one) and must still be able to answer.
172
+ - DeepSeek's capability table declared `json_schema`; DeepSeek guarantees the response PARSES but
173
+ takes no schema parameter. Corrected to `json_object`.
174
+ - A provider that declares nothing is still sent the request unchanged — silence is not a denial.
175
+ - 7d9cc66: Add owner-hosted organization control and OpenAI-wire gateway composition with anchored authority, mandatory verified audit, durable effect reservations, provider inventory cleanup and private content receipts. OpenAI profiles can opt into operation identities preserved across SDK retries.
176
+ - 7d9cc66: Retain typed text and image observations alongside structured tool data through runtime settlement, history, and recovery. Deliver tool images as native content in OpenAI Responses and Anthropic requests, retain structured error receipts, include media in bounded result admission, and reject malformed MCP image observations with reconciliation state intact.
177
+ - f5ea8b6: Add the `extraBody` provider option (and `options.extraBody` in provider profiles): JSON fields
178
+ merged as top-level fields into every Chat Completions and Responses request body, for
179
+ endpoint-specific options such as a gateway's upstream settings. It is copied at construction,
180
+ rejects fields the provider manages and non-JSON values before any request, and cannot be used
181
+ with an executor. Omitting it leaves requests unchanged.
182
+ - 7d9cc66: Preserve admitted tool text and source attribution on Chat Completions requests and transmit tool images as call-linked native vision observations.
183
+ - 9c6a8db: Provider adapters now throw the specific typed failure a vendor response describes, instead of a
184
+ generic `ProviderError` carrying only its status. A 401/403 (or a vendor-specific authentication type)
185
+ becomes an `AuthenticationError`; a response naming an unavailable model — by code or, when the vendor
186
+ gives neither (Anthropic's and Gemini's real bodies carry no distinguishing code), by its message —
187
+ becomes a `ModelNotAvailableError`, whose `model` is now optional since a bare HTTP status does not
188
+ always name one; a transport failure becomes a `NetworkError`, which now also carries the provider
189
+ name. A 429's `retry-after` header (a delta or an HTTP-date) is read into `RateLimitError.retryAfter`
190
+ when the vendor sends one.
191
+
192
+ Vendor error text is scrubbed of anything that reads like a credential — an `Authorization`/`Bearer`
193
+ value, an API key in a header, query string or JSON body, a bare `sk-`/`AIza…` token — before it is
194
+ kept on any of these typed errors, so a misconfigured self-hosted gateway that echoes a request back
195
+ can no longer leak one into a message or a "Details" disclosure. The new `scrubSecrets` export applies
196
+ the same scrubbing to arbitrary text.
197
+ - 261bfc5: Add a constructor and profile `parallelToolCalls` boolean that forwards the native generation
198
+ policy on Chat Completions and Responses, preserving explicit false across streaming and
199
+ non-streaming calls. Omission preserves existing behavior. Reject malformed or unsupported
200
+ configurations before dispatch, retain the policy despite caller option mutation, and preserve
201
+ all returned calls and usage without claiming a call-count or execution-order guarantee.
202
+ - 7d9cc66: Retain typed resource and audio observations alongside structured tool results through history, durable receipts, recovery, size admission, and session persistence. Preserve opaque resource references without fetching them, project embedded text and explicit unsupported binary/audio diagnostics into provider requests and compaction transcripts, and validate persisted observation shapes on reload.
203
+ - ebd40a0: Harden on-disk log permissions against CWE-377 (SEC-003, CodeQL `js/insecure-temporary-file`).
204
+
205
+ Session logs, externalized session payloads, and OpenAI request/response payload logs all carry
206
+ conversation and prompt content, but were created with the process umask (typically `0644`) inside a
207
+ caller-supplied directory that may be shared or world-writable. They are now created owner-only
208
+ (`0600`), and the directories that hold them are created `0700`.
209
+
210
+ This is a permissions change only — file locations, names, formats, and APIs are unchanged. Anything
211
+ that read these logs as a _different_ OS user will no longer be able to; the owning user is
212
+ unaffected.
213
+ - b185f55: Send the configured `parallelToolCalls` policy on Chat Completions only for requests that include
214
+ tools, so a provider with an explicit policy no longer sends the field on tool-less calls, where it
215
+ constrains nothing and a Chat Completions endpoint may reject it. The Responses surface still sends an explicit policy on every request.
216
+ - Updated dependencies [7b6234c]
217
+ - Updated dependencies [4eea54b]
218
+ - Updated dependencies [1698be4]
219
+ - Updated dependencies [d4189b9]
220
+ - Updated dependencies [9edae52]
221
+ - Updated dependencies [4078a72]
222
+ - Updated dependencies [4c73a0b]
223
+ - Updated dependencies [196a900]
224
+ - Updated dependencies [f336838]
225
+ - Updated dependencies [34e50f0]
226
+ - Updated dependencies [722e88a]
227
+ - Updated dependencies [d23c848]
228
+ - Updated dependencies [3038eb7]
229
+ - Updated dependencies [02b7452]
230
+ - Updated dependencies [e689c8e]
231
+ - Updated dependencies [ec5e477]
232
+ - Updated dependencies [c7f9203]
233
+ - Updated dependencies [be0e53c]
234
+ - Updated dependencies [8bd5fac]
235
+ - Updated dependencies [274328f]
236
+ - Updated dependencies [57280bf]
237
+ - Updated dependencies [5033dd9]
238
+ - Updated dependencies [643effb]
239
+ - Updated dependencies [18c0d5c]
240
+ - Updated dependencies [dbd888d]
241
+ - Updated dependencies [1887e54]
242
+ - Updated dependencies [9f46375]
243
+ - Updated dependencies [41cca13]
244
+ - Updated dependencies [ada3841]
245
+ - Updated dependencies [5093a30]
246
+ - Updated dependencies [94b2c87]
247
+ - Updated dependencies [3ab2eca]
248
+ - Updated dependencies [2c612ba]
249
+ - Updated dependencies [66af868]
250
+ - Updated dependencies [04a6de4]
251
+ - Updated dependencies [0ba247b]
252
+ - Updated dependencies [6f41c53]
253
+ - Updated dependencies [fec722f]
254
+ - Updated dependencies [2d3b2c0]
255
+ - Updated dependencies [4772067]
256
+ - Updated dependencies [7937c19]
257
+ - Updated dependencies [9fbab1b]
258
+ - Updated dependencies [a009f5b]
259
+ - Updated dependencies [c207a31]
260
+ - Updated dependencies [9b4f63b]
261
+ - Updated dependencies [4f3c075]
262
+ - Updated dependencies [475e085]
263
+ - Updated dependencies [e477440]
264
+ - Updated dependencies [9dcb5da]
265
+ - Updated dependencies [a95ca85]
266
+ - Updated dependencies [b6d14ce]
267
+ - Updated dependencies [0382a51]
268
+ - Updated dependencies [93d061d]
269
+ - Updated dependencies [39554a1]
270
+ - Updated dependencies [d28430a]
271
+ - Updated dependencies [7d9cc66]
272
+ - Updated dependencies [7d9cc66]
273
+ - Updated dependencies [7d9cc66]
274
+ - Updated dependencies [df02568]
275
+ - Updated dependencies [07b627f]
276
+ - Updated dependencies [d0de5b2]
277
+ - Updated dependencies [7d9cc66]
278
+ - Updated dependencies [2916d00]
279
+ - Updated dependencies [7669851]
280
+ - Updated dependencies [9c6a8db]
281
+ - Updated dependencies [dfb9b15]
282
+ - Updated dependencies [7d9cc66]
283
+ - Updated dependencies [7d9cc66]
284
+ - Updated dependencies [d6b9404]
285
+ - Updated dependencies [62663ae]
286
+ - Updated dependencies [23a30cd]
287
+ - Updated dependencies [7d9cc66]
288
+ - Updated dependencies [9814afc]
289
+ - Updated dependencies [7d9cc66]
290
+ - Updated dependencies [02053ec]
291
+ - @robota-sdk/agent-core@3.0.0
292
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0
293
+
294
+ ## 3.0.0-beta.106
295
+ ### Patch Changes
296
+
297
+ - @robota-sdk/agent-core@3.0.0-beta.106
298
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0-beta.106
299
+
300
+ ## 3.0.0-beta.105
301
+ ### Patch Changes
302
+
303
+ - @robota-sdk/agent-core@3.0.0-beta.105
304
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0-beta.105
305
+
306
+ ## 3.0.0-beta.104
307
+ ### Patch Changes
308
+
309
+ - @robota-sdk/agent-core@3.0.0-beta.104
310
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0-beta.104
311
+
312
+ ## 3.0.0-beta.103
313
+ ### Patch Changes
314
+
315
+ - Updated dependencies [6f41c53]
316
+ - @robota-sdk/agent-core@3.0.0-beta.103
317
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0-beta.103
318
+
319
+ ## 3.0.0-beta.102
320
+ ### Patch Changes
321
+
322
+ - @robota-sdk/agent-core@3.0.0-beta.102
323
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0-beta.102
324
+
325
+ ## 3.0.0-beta.101
326
+ ### Patch Changes
327
+
328
+ - Updated dependencies [62663ae]
329
+ - @robota-sdk/agent-core@3.0.0-beta.101
330
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0-beta.101
331
+
332
+ ## 3.0.0-beta.100
333
+ ### Patch Changes
334
+
335
+ - f5ea8b6: Add the `extraBody` provider option (and `options.extraBody` in provider profiles): JSON fields
336
+ merged as top-level fields into every Chat Completions and Responses request body, for
337
+ endpoint-specific options such as a gateway's upstream settings. It is copied at construction,
338
+ rejects fields the provider manages and non-JSON values before any request, and cannot be used
339
+ with an executor. Omitting it leaves requests unchanged.
340
+ - @robota-sdk/agent-core@3.0.0-beta.100
341
+ - @robota-sdk/agent-provider-openai-compatible@3.0.0-beta.100
342
+
3
343
  ## 3.0.0-beta.99
4
344
  ### Patch Changes
5
345
 
package/README.md CHANGED
@@ -91,6 +91,40 @@ handlers. All returned calls and usage remain visible, even if an endpoint retur
91
91
  under `false`. A compatible endpoint may reject or ignore the field; verify support for the endpoint
92
92
  and model you use.
93
93
 
94
+ ### Extra request-body fields
95
+
96
+ Only the fields this provider manages, and those in `extraBody`, are sent; other unknown constructor
97
+ or chat-option keys never reach the endpoint. Set `extraBody` for endpoint-specific options the
98
+ provider does not model, such as a gateway's upstream settings. Its fields are merged as top-level
99
+ fields into every request body on both API surfaces, with or without tools, for plain `chat()`,
100
+ callback-driven `chat()` and `chatStream()`, and raw-payload request events show the merged body:
101
+
102
+ ```typescript
103
+ const provider = new OpenAIProvider({
104
+ apiKey: process.env.GATEWAY_API_KEY,
105
+ baseURL: 'https://gateway.example.com/v1',
106
+ parallelToolCalls: false,
107
+ extraBody: { providerOptions: { upstream: { disableParallelToolUse: true } } },
108
+ });
109
+ ```
110
+
111
+ The value is copied at construction; later changes to the object do not change requests, and an
112
+ empty object is the same as omitting it. It must be JSON data: `null`, booleans, strings, finite
113
+ numbers, arrays and plain objects; anything JSON serialization would drop or alter (`undefined`,
114
+ functions, `NaN`, `Date`, class instances, cycles) makes the constructor throw. So does a field
115
+ the provider writes on either surface, or one that would change the response shape it parses or
116
+ add server-side history to the full history it already sends: `model`, `messages`, `input`,
117
+ `previous_response_id`, `conversation`, `tools`, `tool_choice`, `parallel_tool_calls`,
118
+ `functions`, `function_call`, `web_search_options`, `stream`, `stream_options`, `n`,
119
+ `background`, `modalities`, `audio`, `response_format`, `text`, `max_tokens`,
120
+ `max_completion_tokens`, `max_output_tokens`, `temperature`, `reasoning`, `reasoning_effort`,
121
+ `include` and `store`. Use the typed provider or chat option where one exists; the list applies to
122
+ both surfaces, so a field the provider writes only on the other surface is refused too. Provider
123
+ profiles accept the same object in `options.extraBody`. Like an explicit `parallelToolCalls`, it
124
+ cannot be used with an executor; set it on the provider the executor runs instead. The endpoint
125
+ decides what the fields do, and they are sent, like the rest of the body, to the configured
126
+ endpoint.
127
+
94
128
  ### Reasoning effort and web tools
95
129
 
96
130
  A reasoning-effort selection (`defaultModel.effort` on a `ConversationAgent` agent, or `effort` on a chat call)
@@ -117,7 +151,8 @@ required; the constructor throws otherwise.
117
151
  | `organization` | `string` | OpenAI organization ID. |
118
152
  | `timeout` | `number` | Request timeout in milliseconds. |
119
153
  | `strictTools` | `boolean` | Closes tool object schemas and requests OpenAI strict function calling (see above). |
120
- | `parallelToolCalls` | `boolean` | Captured native parallel function-call generation policy; omitted by default and incompatible with executors. |
154
+ | `parallelToolCalls` | `boolean` | Captured native parallel function-call generation policy; omitted by default and incompatible with executors. |
155
+ | `extraBody` | `TOpenAIExtraBody` | JSON fields merged into every request body; provider-managed fields are rejected (see above). |
121
156
  | `responseFormat` | `'text' \| 'json_object' \| 'json_schema'` | Response format; `'json_schema'` uses `jsonSchema`. |
122
157
  | `jsonSchema` | `IOpenAIJsonSchemaDefinition` | Schema for Structured Outputs when `responseFormat` is `'json_schema'`. |
123
158
  | `reasoning` | `IOpenAIResponsesReasoningOptions` | Responses API reasoning controls (`effort`, `summary`). |
@@ -1,3 +1,3 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs");let t=require("node:crypto"),n=require("@robota-sdk/agent-core"),r=require("openai");r=e.t(r,1);let i=require("@robota-sdk/agent-provider-openai-compatible/shared");function a(e){return(0,i.convertToOpenAICompatibleMessages)(e)}function o(e,t){return(0,i.convertToOpenAICompatibleTools)(e,{strict:t===!0})}function ee(e,t){return t?.type===void 0?e:t.type===`json_schema`?{...e,responseFormat:`json_schema`,jsonSchema:{name:t.name??`structured_output`,schema:t.schema}}:{...e,responseFormat:t.type}}function s(e){if(e.responseFormat===void 0||e.responseFormat===`text`)return;if(e.responseFormat===`json_object`)return{type:`json_object`};let t=c(e);return{type:`json_schema`,json_schema:{name:t.name,schema:t.schema,...t.description!==void 0&&{description:t.description},...t.strict!==void 0&&{strict:t.strict}}}}function te(e){if(e.responseFormat===void 0||e.responseFormat===`text`)return;if(e.responseFormat===`json_object`)return{format:{type:`json_object`}};let t=c(e);return{format:{type:`json_schema`,name:t.name,schema:t.schema,...t.description!==void 0&&{description:t.description},...t.strict!==void 0&&{strict:t.strict}}}}function c(e){let t=e.jsonSchema;if(e.responseFormat!==`json_schema`)throw Error(`Unsupported OpenAI response format: ${e.responseFormat}`);if(!t?.schema)throw Error(`OpenAI jsonSchema.schema is required when responseFormat is json_schema`);return{name:t.name,schema:t.schema,...t.description!==void 0&&{description:t.description},...t.strict!==void 0&&{strict:t.strict}}}function l(e,t){if(e!==void 0){if(typeof e!=`boolean`)throw Error(`parallelToolCalls must be a boolean`);if(t!==void 0&&t!==`chat-completions`&&t!==`responses`)throw Error(`parallelToolCalls requires a supported OpenAI API surface`);return e}}function u(e,t){if(e!==void 0&&t)throw Error(`parallelToolCalls cannot be used with an executor`)}function d(e){return e===void 0?{}:{parallel_tool_calls:e}}async function f(e){if(typeof e.withResponse==`function`){let{data:t,request_id:n}=await e.withResponse();return{data:t,...typeof n==`string`&&n.length>0&&{providerRequestId:n}}}return{data:await e}}function p(e){let t=e?._request_id;return typeof t==`string`&&t.length>0?t:void 0}function m(e,t){return t===void 0?e:{...e,metadata:{...e.metadata,providerRequestId:t}}}function h(e,t){let n=t!==void 0&&Object.keys(t).length>0;if(!(!e&&!n))return{...e?{signal:e}:{},...n?{headers:{...t}}:{}}}async function g(e){let t=S(e.client);try{let n=y(e);if(e.chatOptions?.onTextDelta??e.onTextDelta)return await b(t,e,{...n,stream:!0,...v(e)});await x(e,n,`chat`),e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`request`,payload:n});let r=h(e.chatOptions?.signal,e.requestHeaders),i=r?await t.chat.completions.create(n,r):await t.chat.completions.create(n);return e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`response`,payload:i}),m(e.responseParser.parseResponse(i),p(i))}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI chat failed`)}}async function*_(e){let t=S(e.client);try{let n={...y(e),stream:!0,...v(e)};await x(e,n,`stream`),e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`request`,payload:n});let{data:r,providerRequestId:a}=await f(t.chat.completions.create(n,h(e.chatOptions?.signal,e.requestHeaders)));for await(let t of(0,i.observeProviderNativeRawPayloadStream)(r,{provider:`openai`,apiSurface:`chat-completions`,onProviderNativeRawPayload:e.chatOptions?.onProviderNativeRawPayload})){let n=e.responseParser.parseStreamingChunk(t);n&&(yield m(n,a))}}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI stream failed`)}}function v(e){return e.providerOptions.includeStreamUsage===!1?{}:{stream_options:{include_usage:!0}}}function y(e){let t=a(e.messages),n=e.chatOptions?.model??e.providerOptions.defaultModel;if(!n)throw Error(`Model is required in chat options. Please specify a model in defaultModel configuration.`);let r=s(ee(e.providerOptions,e.chatOptions?.responseFormat));return{model:n,messages:t,...e.chatOptions?.temperature!==void 0&&{temperature:e.chatOptions.temperature},...e.chatOptions?.maxTokens!==void 0&&{max_tokens:e.chatOptions.maxTokens},...e.chatOptions?.tools&&{tools:o(e.chatOptions.tools,e.providerOptions.strictTools),tool_choice:(0,i.toOpenAICompatibleToolChoice)(e.chatOptions.toolChoice),...d(e.parallelToolCalls)},...r!==void 0&&{response_format:r}}}async function b(e,t,r){try{await x(t,r,`stream`),t.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`request`,payload:r});let{data:n,providerRequestId:a}=await f(e.chat.completions.create(r,h(t.chatOptions?.signal,t.requestHeaders)));return m(await(0,i.assembleOpenAICompatibleStream)({stream:(0,i.observeProviderNativeRawPayloadStream)(n,{provider:`openai`,apiSurface:`chat-completions`,onProviderNativeRawPayload:t.chatOptions?.onProviderNativeRawPayload}),onTextDelta:t.chatOptions?.onTextDelta??t.onTextDelta,signal:t.chatOptions?.signal}),a)}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI stream failed`)}}async function x(e,t,n){if(!e.payloadLogger?.isEnabled())return;let r={model:t.model,messagesCount:t.messages.length,hasTools:!!t.tools,temperature:t.temperature??void 0,maxTokens:t.max_tokens??void 0,timestamp:new Date().toISOString()};await e.payloadLogger.logPayload(r,n)}function S(e){if(!e)throw Error(`OpenAI client not available. Either provide a client/apiKey or use an executor.`);return e}const C={verifiedAt:`2026-09-11`,sourceUrl:`https://platform.openai.com/docs/api-reference/responses`,models:{"gpt-5.1":{supportedEfforts:[`none`,`low`,`medium`,`high`],defaultEffort:`none`,nativeControlId:`responses.reasoning.effort`}}};var w=class{parser;constructor(e){this.parser=new i.OpenAICompatibleResponseParser({logger:e})}parseResponse(e){try{return this.parser.parseResponse(e)}catch(e){let t=T(e instanceof Error?e.message:`OpenAI response parsing failed`);throw Error(`OpenAI response parsing failed: ${t}`)}}parseStreamingChunk(e){try{return this.parser.parseStreamingChunk(e)}catch(e){let t=T(e instanceof Error?e.message:`OpenAI chunk parsing failed`);throw Error(`OpenAI chunk parsing failed: ${t}`)}}};function T(e){return e.replace(/^OpenAI-compatible response parsing failed: /,``).replace(/^OpenAI-compatible chunk parsing failed: /,``).replace(`OpenAI-compatible response`,`OpenAI response`)}function ne(e){return e}function re(e,t){if(t===void 0)return e;if(t.effective===null||t.disposition===`model-default`){if(e?.effort!==void 0)throw Error(`Static reasoning.effort ${e.effort} conflicts with ${t.disposition===`model-default`?`provider-default selection`:`an effort resolution that does not apply a native control`}.`);return e}let n=ne(t.effective);if(e?.effort!==void 0&&e.effort!==n)throw Error(`Resolved effort ${n} conflicts with static reasoning.effort ${e.effort}.`);return{...e,effort:n}}function ie(e){return e.flatMap(e=>oe(e))}function ae(e,t){let n=t??!1,r=e?.map(e=>({type:`function`,name:e.name,description:e.description,parameters:e.parameters,strict:n}))??[];return r.length>0?r:void 0}function oe(e){if(e.role===`user`)return[D(`user`,ce(e.content,e.parts))];if(e.role===`system`)return[D(`system`,e.content)];if(e.role===`tool`){if(!e.toolCallId||e.toolCallId.trim().length===0)throw Error(`Tool message missing toolCallId: ${JSON.stringify(e)}`);return[{type:`function_call_output`,call_id:e.toolCallId,output:e.parts?.length?[...e.content&&!e.parts.some(t=>t.type===`text`&&t.text===e.content)?[{type:`input_text`,text:e.content}]:[],...e.parts.map(E)]:e.content||``}]}return se(e)}function se(e){let t=[];e.content&&e.content.length>0&&t.push(D(`assistant`,e.content));for(let n of e.toolCalls??[])t.push({type:`function_call`,call_id:n.id,name:n.function.name,arguments:n.function.arguments});return t.length===0&&t.push(D(`assistant`,``)),t}function ce(e,t){if(!t||t.length===0)return e;let n=t.map(e=>E(e));return e.length>0&&!t.some(e=>e.type===`text`)?[{type:`input_text`,text:e},...n]:n}function E(e){return e.type===`text`?{type:`input_text`,text:e.text}:e.type===`image_uri`?{type:`input_image`,image_url:e.uri}:e.type===`image_inline`?{type:`input_image`,image_url:`data:${e.mimeType};base64,${e.data}`}:{type:`input_text`,text:(0,n.nonVisualObservationText)(e)??`Unsupported observation`}}function D(e,t){return{role:e,content:t}}async function*le(e,t){let n=e[Symbol.asyncIterator]();try{for(;!t?.aborted;){let e=await ue(n,t);if(e.done||t?.aborted)break;yield e.value}}finally{t?.aborted&&await n.return?.()}}async function ue(e,t){if(!t)return e.next();if(t.aborted)return{done:!0,value:void 0};let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});try{return await Promise.race([e.next(),r])}finally{n&&t.removeEventListener(`abort`,n)}}function de(e){G(e);let t=e.output??[];return M({content:e.output_text??R(t),toolCalls:F(t),response:e,reasoning:V(t)})}async function fe(e){let t={textParts:[],toolCalls:[],reasoning:U(),thought:{sentText:!1}};for await(let n of le(e.stream,e.signal))pe(t,n,e);return t.completedResponse===void 0?M({content:t.textParts.join(``),toolCalls:t.toolCalls,reasoning:t.reasoning}):j(t)}function pe(e,t,n){if(t.type===`response.output_text.delta`){e.textParts.push(t.delta),n.onTextDelta?.(t.delta);return}if(t.type===`response.reasoning_summary_part.added`){O(e.thought,t);return}if(t.type===`response.reasoning_summary_text.delta`){O(e.thought,t),n.onThinkingDelta?.(k(e.thought,t.delta));return}if(t.type===`response.completed`){e.completedResponse=t.response,W(e.reasoning,V(t.response.output??[]));return}if(t.type===`response.output_item.done`){A(e,t.item);return}if(t.type===`response.error`||t.type===`response.failed`||t.type===`response.incomplete`)throw Error(`OpenAI Responses API failed: ${he(t)}`)}function O(e,t){(t.item_id!==void 0||t.summary_index!==void 0)&&(e.currentPart=`${t.item_id??``}#${t.summary_index??0}`)}function k(e,t){if(t.length===0)return t;let n=e.sentText&&e.currentPart!==e.sentPart;return e.sentText=!0,e.sentPart=e.currentPart,n?`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs");let t=require("node:crypto"),n=require("@robota-sdk/agent-core"),r=require("openai");r=e.t(r,1);let i=require("@robota-sdk/agent-provider-openai-compatible/shared");const a=new Set(`model.messages.input.previous_response_id.conversation.tools.tool_choice.parallel_tool_calls.functions.function_call.web_search_options.stream.stream_options.n.background.modalities.audio.response_format.text.max_tokens.max_completion_tokens.max_output_tokens.temperature.reasoning.reasoning_effort.include.store`.split(`.`));function o(e){if(e===void 0)return;if(!l(e))throw Error(`extraBody must be a plain JSON object`);let t=d(e,new Set);for(let e of Object.keys(t))if(a.has(e))throw Error(`extraBody cannot set the provider-managed field ${e}`);return Object.keys(t).length===0?void 0:t}function s(e,t){if(e!==void 0&&t)throw Error(`extraBody cannot be used with an executor`)}function c(e){return e===void 0?{}:d(e,new Set)}function l(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function u(e,t){if(e===null||typeof e==`boolean`||typeof e==`string`||typeof e==`number`&&Number.isFinite(e))return e;if(Array.isArray(e))return ee(e,t);if(l(e))return d(e,t);throw p()}function ee(e,t){if(f(e,t),Object.keys(e).length!==e.length)throw p();let n=[];for(let r=0;r<e.length;r+=1){if(!(r in e))throw p();n.push(u(e[r],t))}return t.delete(e),n}function d(e,t){f(e,t);let n=Reflect.ownKeys(e).map(n=>{if(typeof n!=`string`||!Object.prototype.propertyIsEnumerable.call(e,n))throw p();return[n,u(Reflect.get(e,n),t)]});return t.delete(e),Object.fromEntries(n)}function f(e,t){if(t.has(e))throw p();t.add(e)}function p(){return Error(`extraBody must contain only JSON data: null, booleans, strings, finite numbers, arrays and plain objects`)}function te(e){return(0,i.convertToOpenAICompatibleMessages)(e)}function ne(e,t){return(0,i.convertToOpenAICompatibleTools)(e,{strict:t===!0})}function re(e,t){return t?.type===void 0?e:t.type===`json_schema`?{...e,responseFormat:`json_schema`,jsonSchema:{name:t.name??`structured_output`,schema:t.schema}}:{...e,responseFormat:t.type}}function ie(e){if(e.responseFormat===void 0||e.responseFormat===`text`)return;if(e.responseFormat===`json_object`)return{type:`json_object`};let t=m(e);return{type:`json_schema`,json_schema:{name:t.name,schema:t.schema,...t.description!==void 0&&{description:t.description},...t.strict!==void 0&&{strict:t.strict}}}}function ae(e){if(e.responseFormat===void 0||e.responseFormat===`text`)return;if(e.responseFormat===`json_object`)return{format:{type:`json_object`}};let t=m(e);return{format:{type:`json_schema`,name:t.name,schema:t.schema,...t.description!==void 0&&{description:t.description},...t.strict!==void 0&&{strict:t.strict}}}}function m(e){let t=e.jsonSchema;if(e.responseFormat!==`json_schema`)throw Error(`Unsupported OpenAI response format: ${e.responseFormat}`);if(!t?.schema)throw Error(`OpenAI jsonSchema.schema is required when responseFormat is json_schema`);return{name:t.name,schema:t.schema,...t.description!==void 0&&{description:t.description},...t.strict!==void 0&&{strict:t.strict}}}function h(e,t){if(e!==void 0){if(typeof e!=`boolean`)throw Error(`parallelToolCalls must be a boolean`);if(t!==void 0&&t!==`chat-completions`&&t!==`responses`)throw Error(`parallelToolCalls requires a supported OpenAI API surface`);return e}}function g(e,t){if(e!==void 0&&t)throw Error(`parallelToolCalls cannot be used with an executor`)}function _(e){return e===void 0?{}:{parallel_tool_calls:e}}async function v(e){if(typeof e.withResponse==`function`){let{data:t,request_id:n}=await e.withResponse();return{data:t,...typeof n==`string`&&n.length>0&&{providerRequestId:n}}}return{data:await e}}function y(e){let t=e?._request_id;return typeof t==`string`&&t.length>0?t:void 0}function b(e,t){return t===void 0?e:{...e,metadata:{...e.metadata,providerRequestId:t}}}function x(e,t){let n=t!==void 0&&Object.keys(t).length>0;if(!(!e&&!n))return{...e?{signal:e}:{},...n?{headers:{...t}}:{}}}async function oe(e){let t=E(e.client);try{let n=w(e);if(e.chatOptions?.onTextDelta??e.onTextDelta)return await se(t,e,{...n,stream:!0,...C(e)});await T(e,n,`chat`),e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`request`,payload:n});let r=x(e.chatOptions?.signal,e.requestHeaders),i=r?await t.chat.completions.create(n,r):await t.chat.completions.create(n);return e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`response`,payload:i}),b(e.responseParser.parseResponse(i),y(i))}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI chat failed`)}}async function*S(e){let t=E(e.client);try{let n={...w(e),stream:!0,...C(e)};await T(e,n,`stream`),e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`request`,payload:n});let{data:r,providerRequestId:a}=await v(t.chat.completions.create(n,x(e.chatOptions?.signal,e.requestHeaders)));for await(let t of(0,i.observeProviderNativeRawPayloadStream)(r,{provider:`openai`,apiSurface:`chat-completions`,onProviderNativeRawPayload:e.chatOptions?.onProviderNativeRawPayload})){let n=e.responseParser.parseStreamingChunk(t);n&&(yield b(n,a))}}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI stream failed`)}}function C(e){return e.providerOptions.includeStreamUsage===!1?{}:{stream_options:{include_usage:!0}}}function w(e){let t=te(e.messages),n=e.chatOptions?.model??e.providerOptions.defaultModel;if(!n)throw Error(`Model is required in chat options. Please specify a model in defaultModel configuration.`);let r=ie(re(e.providerOptions,e.chatOptions?.responseFormat));return{...c(e.extraBody),model:n,messages:t,...e.chatOptions?.temperature!==void 0&&{temperature:e.chatOptions.temperature},...e.chatOptions?.maxTokens!==void 0&&{max_tokens:e.chatOptions.maxTokens},...e.chatOptions?.tools&&{tools:ne(e.chatOptions.tools,e.providerOptions.strictTools),tool_choice:(0,i.toOpenAICompatibleToolChoice)(e.chatOptions.toolChoice),..._(e.parallelToolCalls)},...r!==void 0&&{response_format:r}}}async function se(e,t,r){try{await T(t,r,`stream`),t.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`chat-completions`,payloadKind:`request`,payload:r});let{data:n,providerRequestId:a}=await v(e.chat.completions.create(r,x(t.chatOptions?.signal,t.requestHeaders)));return b(await(0,i.assembleOpenAICompatibleStream)({stream:(0,i.observeProviderNativeRawPayloadStream)(n,{provider:`openai`,apiSurface:`chat-completions`,onProviderNativeRawPayload:t.chatOptions?.onProviderNativeRawPayload}),onTextDelta:t.chatOptions?.onTextDelta??t.onTextDelta,signal:t.chatOptions?.signal}),a)}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI stream failed`)}}async function T(e,t,n){if(!e.payloadLogger?.isEnabled())return;let r={model:t.model,messagesCount:t.messages.length,hasTools:!!t.tools,temperature:t.temperature??void 0,maxTokens:t.max_tokens??void 0,timestamp:new Date().toISOString()};await e.payloadLogger.logPayload(r,n)}function E(e){if(!e)throw Error(`OpenAI client not available. Either provide a client/apiKey or use an executor.`);return e}const ce={verifiedAt:`2026-09-11`,sourceUrl:`https://platform.openai.com/docs/api-reference/responses`,models:{"gpt-5.1":{supportedEfforts:[`none`,`low`,`medium`,`high`],defaultEffort:`none`,nativeControlId:`responses.reasoning.effort`}}};var le=class{parser;constructor(e){this.parser=new i.OpenAICompatibleResponseParser({logger:e})}parseResponse(e){try{return this.parser.parseResponse(e)}catch(e){let t=D(e instanceof Error?e.message:`OpenAI response parsing failed`);throw Error(`OpenAI response parsing failed: ${t}`)}}parseStreamingChunk(e){try{return this.parser.parseStreamingChunk(e)}catch(e){let t=D(e instanceof Error?e.message:`OpenAI chunk parsing failed`);throw Error(`OpenAI chunk parsing failed: ${t}`)}}};function D(e){return e.replace(/^OpenAI-compatible response parsing failed: /,``).replace(/^OpenAI-compatible chunk parsing failed: /,``).replace(`OpenAI-compatible response`,`OpenAI response`)}function ue(e){return e}function de(e,t){if(t===void 0)return e;if(t.effective===null||t.disposition===`model-default`){if(e?.effort!==void 0)throw Error(`Static reasoning.effort ${e.effort} conflicts with ${t.disposition===`model-default`?`provider-default selection`:`an effort resolution that does not apply a native control`}.`);return e}let n=ue(t.effective);if(e?.effort!==void 0&&e.effort!==n)throw Error(`Resolved effort ${n} conflicts with static reasoning.effort ${e.effort}.`);return{...e,effort:n}}function fe(e){return e.flatMap(e=>me(e))}function pe(e,t){let n=t??!1,r=e?.map(e=>({type:`function`,name:e.name,description:e.description,parameters:e.parameters,strict:n}))??[];return r.length>0?r:void 0}function me(e){if(e.role===`user`)return[k(`user`,ge(e.content,e.parts))];if(e.role===`system`)return[k(`system`,e.content)];if(e.role===`tool`){if(!e.toolCallId||e.toolCallId.trim().length===0)throw Error(`Tool message missing toolCallId: ${JSON.stringify(e)}`);return[{type:`function_call_output`,call_id:e.toolCallId,output:e.parts?.length?[...e.content&&!e.parts.some(t=>t.type===`text`&&t.text===e.content)?[{type:`input_text`,text:e.content}]:[],...e.parts.map(O)]:e.content||``}]}return he(e)}function he(e){let t=[];e.content&&e.content.length>0&&t.push(k(`assistant`,e.content));for(let n of e.toolCalls??[])t.push({type:`function_call`,call_id:n.id,name:n.function.name,arguments:n.function.arguments});return t.length===0&&t.push(k(`assistant`,``)),t}function ge(e,t){if(!t||t.length===0)return e;let n=t.map(e=>O(e));return e.length>0&&!t.some(e=>e.type===`text`)?[{type:`input_text`,text:e},...n]:n}function O(e){return e.type===`text`?{type:`input_text`,text:e.text}:e.type===`image_uri`?{type:`input_image`,image_url:e.uri}:e.type===`image_inline`?{type:`input_image`,image_url:`data:${e.mimeType};base64,${e.data}`}:{type:`input_text`,text:(0,n.nonVisualObservationText)(e)??`Unsupported observation`}}function k(e,t){return{role:e,content:t}}async function*_e(e,t){let n=e[Symbol.asyncIterator]();try{for(;!t?.aborted;){let e=await ve(n,t);if(e.done||t?.aborted)break;yield e.value}}finally{t?.aborted&&await n.return?.()}}async function ve(e,t){if(!t)return e.next();if(t.aborted)return{done:!0,value:void 0};let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});try{return await Promise.race([e.next(),r])}finally{n&&t.removeEventListener(`abort`,n)}}function A(e){G(e);let t=e.output??[];return I({content:e.output_text??B(t),toolCalls:L(t),response:e,reasoning:V(t)})}async function j(e){let t={textParts:[],toolCalls:[],reasoning:U(),thought:{sentText:!1}};for await(let n of _e(e.stream,e.signal))M(t,n,e);return t.completedResponse===void 0?I({content:t.textParts.join(``),toolCalls:t.toolCalls,reasoning:t.reasoning}):ye(t)}function M(e,t,n){if(t.type===`response.output_text.delta`){e.textParts.push(t.delta),n.onTextDelta?.(t.delta);return}if(t.type===`response.reasoning_summary_part.added`){N(e.thought,t);return}if(t.type===`response.reasoning_summary_text.delta`){N(e.thought,t),n.onThinkingDelta?.(P(e.thought,t.delta));return}if(t.type===`response.completed`){e.completedResponse=t.response,W(e.reasoning,V(t.response.output??[]));return}if(t.type===`response.output_item.done`){F(e,t.item);return}if(t.type===`response.error`||t.type===`response.failed`||t.type===`response.incomplete`)throw Error(`OpenAI Responses API failed: ${Te(t)}`)}function N(e,t){(t.item_id!==void 0||t.summary_index!==void 0)&&(e.currentPart=`${t.item_id??``}#${t.summary_index??0}`)}function P(e,t){if(t.length===0)return t;let n=e.sentText&&e.currentPart!==e.sentPart;return e.sentText=!0,e.sentPart=e.currentPart,n?`
2
2
 
3
- ${t}`:t}function A(e,t){if(I(t)){e.toolCalls.push(L(t));return}H(t)&&W(e.reasoning,V([t]))}function j(e){let t=e.completedResponse;if(t===void 0)throw Error(`OpenAI Responses stream completed without response metadata`);G(t);let n=t.output??[],r=F(n),i=e.textParts.length>0?e.textParts.join(``):t.output_text??R(n),a=V(n);return W(a,e.reasoning),M({content:i,toolCalls:r.length>0?r:e.toolCalls,response:t,reasoning:a})}function M(e){return{id:(0,t.randomUUID)(),role:`assistant`,content:e.content,state:`complete`,timestamp:new Date,...e.toolCalls.length>0&&{toolCalls:e.toolCalls},...e.response?.usage!==void 0&&{usage:P(e.response.usage)},metadata:{...N(e.response,e.reasoning),...e.response?.usage!==void 0&&{usageProvenance:e.response.usage.input_tokens!==void 0&&e.response.usage.output_tokens!==void 0&&e.response.usage.total_tokens!==void 0?`complete`:`partial`}}}}function N(e,t){return{providerApiSurface:`responses`,...e?.id!==void 0&&{responseId:e.id},...e?.model!==void 0&&{model:e.model},...e?.status!==void 0&&{finishReason:e.status},...t.reasoningSummaryCount>0&&{reasoningSummaryCount:t.reasoningSummaryCount,reasoningSummaries:t.reasoningSummaries},...t.hasEncryptedReasoning&&{hasEncryptedReasoning:!0}}}function P(e){let t=e.input_tokens_details?.cached_tokens;return{promptTokens:e.input_tokens??0,completionTokens:e.output_tokens??0,...e.total_tokens!==void 0&&{totalTokens:e.total_tokens},...typeof t==`number`&&{cacheReadTokens:t}}}function F(e){return e.filter(I).map(e=>L(e))}function I(e){return e.type===`function_call`&&`call_id`in e&&`name`in e&&`arguments`in e}function L(e){return{id:e.call_id,type:`function`,function:{name:e.name,arguments:e.arguments}}}function R(e){return e.filter(B).flatMap(e=>e.content).map(z).join(``)}function z(e){return e.type===`refusal`?e.refusal:e.text}function B(e){return e.type===`message`&&`content`in e&&Array.isArray(e.content)}function V(e){let t=U();for(let n of e){if(!H(n))continue;let e=n.summary?.map(e=>e.text).filter(me)??[];t.reasoningSummaryCount+=e.length,t.reasoningSummaries.push(...e),t.hasEncryptedReasoning=t.hasEncryptedReasoning||!!n.encrypted_content}return t}function H(e){return e.type===`reasoning`}function U(){return{reasoningSummaryCount:0,reasoningSummaries:[],hasEncryptedReasoning:!1}}function W(e,t){e.reasoningSummaryCount+=t.reasoningSummaryCount,e.reasoningSummaries.push(...t.reasoningSummaries),e.hasEncryptedReasoning=e.hasEncryptedReasoning||t.hasEncryptedReasoning}function me(e){return e!==void 0}function G(e){if(e.status===`failed`||e.status===`incomplete`)throw Error(`OpenAI Responses API failed: ${e.error?.message??e.status}`)}function he(e){return e.message??e.error?.message??e.response?.error?.message??`unknown error`}async function ge(e){let t=e.chatOptions?.onTextDelta??e.onTextDelta;if(t)return K({...e,chatOptions:{...e.chatOptions,onTextDelta:t}});if(!e.client)throw Error(`OpenAI Responses client not available.`);try{let t=q(e);e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`responses`,payloadKind:`request`,payload:t});let n=await e.client.responses.create(t,h(e.chatOptions?.signal,e.requestHeaders));return e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`responses`,payloadKind:`response`,payload:n}),m(de(n),p(n))}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI responses failed`)}}async function*_e(e){let t={deltas:[]},n=e.chatOptions?.onTextDelta??e.onTextDelta,r=K({...e,chatOptions:{...e.chatOptions,onTextDelta:e=>{n?.(e),xe(t,ye(e))}}}).then(e=>Se(t,e)).catch(e=>Ce(t,Ee(e)));yield*be(t),await r}async function K(e){if(!e.client)throw Error(`OpenAI Responses client not available.`);try{let t=ve(e);e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`responses`,payloadKind:`request`,payload:t});let{data:n,providerRequestId:r}=await f(e.client.responses.create(t,h(e.chatOptions?.signal,e.requestHeaders)));return m(await fe({stream:(0,i.observeProviderNativeRawPayloadStream)(n,{provider:`openai`,apiSurface:`responses`,onProviderNativeRawPayload:e.chatOptions?.onProviderNativeRawPayload}),onTextDelta:e.chatOptions?.onTextDelta,onThinkingDelta:e.chatOptions?.onThinkingDelta,signal:e.chatOptions?.signal}),r)}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI responses stream failed`)}}function q(e){let t=e.chatOptions?.model??e.providerOptions.defaultModel;if(!t)throw Error(`Model is required in chat options. Please specify a model in defaultModel configuration.`);let n=ae(e.chatOptions?.tools,e.providerOptions.strictTools),r=te(e.providerOptions),a=re(e.providerOptions.reasoning,e.chatOptions?.effortResolution);return{model:t,...d(e.parallelToolCalls),input:ie(e.messages),...n!==void 0&&{tools:n,tool_choice:(0,i.toOpenAIResponsesToolChoice)(e.chatOptions?.toolChoice)},...e.chatOptions?.temperature!==void 0&&{temperature:e.chatOptions.temperature},...e.chatOptions?.maxTokens!==void 0&&{max_output_tokens:e.chatOptions.maxTokens},...r!==void 0&&{text:r},...a!==void 0&&{reasoning:a},...e.providerOptions.includeEncryptedReasoning===!0&&{include:[`reasoning.encrypted_content`]},...e.providerOptions.store!==void 0&&{store:e.providerOptions.store}}}function ve(e){return{...q(e),stream:!0}}function ye(e){return{id:(0,t.randomUUID)(),role:`assistant`,content:e,state:`complete`,timestamp:new Date,metadata:{providerApiSurface:`responses`,isStreamChunk:!0,isComplete:!1}}}async function*be(e){for(;;){let t=e.deltas.shift();if(t!==void 0){yield t;continue}if(e.error!==void 0)throw e.error;if(e.finalMessage!==void 0){yield Te(e.finalMessage);return}await we(e)}}function xe(e,t){e.deltas.push(t),J(e)}function Se(e,t){e.finalMessage=t,J(e)}function Ce(e,t){e.error=t,J(e)}function we(e){return new Promise(t=>{e.wake=t})}function J(e){e.wake?.(),e.wake=void 0}function Te(e){return{...e,content:``,metadata:{...e.metadata,isStreamChunk:!0,isComplete:!0}}}function Ee(e){return e instanceof Error?e:Error(String(e))}var Y=class extends n.AbstractAIProvider{name=`openai`;version=`1.0.0`;client;options;apiSurface;parallelToolCalls;payloadLogger;responseParser;onTextDelta;constructor(e){if(super(e.logger||n.SilentLogger),this.options=e,this.parallelToolCalls=l(e.parallelToolCalls,e.apiSurface),u(this.parallelToolCalls,e.executor!==void 0),this.apiSurface=De(e),Oe(this.apiSurface,e.nativeWebTools),e.executor&&(this.executor=e.executor),!this.executor)if(e.client)this.client=e.client;else if(e.apiKey)this.client=new r.default({apiKey:e.apiKey,...e.organization&&{organization:e.organization},...e.timeout&&{timeout:e.timeout},...e.baseURL&&{baseURL:e.baseURL}});else throw Error(`Either OpenAI client, apiKey, or executor is required`);this.responseParser=new w(this.logger),this.payloadLogger=e.payloadLogger}async chat(e,t){u(this.parallelToolCalls,this.executor!==void 0),this.validateMessages(e),this.validateNativeWebTools(t?.nativeWebTools);let n=this.resolveEffortOptions(t);if(this.executor)try{let t=await this.executeViaExecutorOrDirect(e,n);return t.modelEffortOutcome===void 0&&this.publishModelEffortOutcome(n,`opaque-executor`),t.message}catch(e){throw this.logger.error(`OpenAI Provider executor chat error:`,e instanceof Error?e.message:String(e)),e}if(this.apiSurface===`responses`){let t=await ge({client:this.client,messages:e,chatOptions:this.projectChatOptions(n),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(n)});return this.publishModelEffortOutcome(n),t}let r=await g({client:this.client,messages:e,chatOptions:this.projectChatOptions(n),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,payloadLogger:this.payloadLogger,responseParser:this.responseParser,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(n)});return this.publishModelEffortOutcome(n),r}async*chatStream(e,t){u(this.parallelToolCalls,this.executor!==void 0),this.validateNativeWebTools(t?.nativeWebTools);let n=this.resolveEffortOptions(t);if(this.executor)try{let t=!1;for await(let r of this.executeStreamViaExecutorOrDirect(e,n))r.kind===`message`?yield r.message:t=r.modelEffortOutcome!==void 0;t||this.publishModelEffortOutcome(n,`opaque-executor`);return}catch(e){throw this.logger.error(`OpenAI Provider executor stream error:`,e instanceof Error?e.message:String(e)),e}yield*this.streamDirect(e,n)}async*streamDirect(e,t){if(this.apiSurface===`responses`){yield*_e({client:this.client,messages:e,chatOptions:this.projectChatOptions(t),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(t)}),this.publishModelEffortOutcome(t);return}yield*_({client:this.client,messages:e,chatOptions:this.projectChatOptions(t),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,payloadLogger:this.payloadLogger,responseParser:this.responseParser,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(t)}),this.publishModelEffortOutcome(t)}endpointIsVendorDefault(){return this.options.baseURL===void 0}canPropagateTraceContext(){return!this.executor&&this.effectiveBaseUrl()!==void 0}effectiveBaseUrl(){let e=this.client?.baseURL;return typeof e==`string`&&e.length>0?e:void 0}traceRequestHeaders(e){return{...this.canPropagateTraceContext()?(0,n.traceHeadersFor)(this.effectiveBaseUrl(),e?.outboundTraceContext):{},...this.options.durableOperations===!0?{"Idempotency-Key":(0,t.randomUUID)()}:{}}}effortTable(){return this.endpointIsVendorDefault()&&this.apiSurface===`responses`?C:void 0}resolveEffortOptions(e){if(e?.effort===void 0||e.effortResolution!==void 0)return e;let t=e.model??this.options.defaultModel;return t===void 0?e:{...e,effortResolution:(0,n.resolveModelEffort)(this.effortTable(),t,e.effort)}}projectionProfile(){return this.options.strictTools?{...n.STRICT_TOOL_SCHEMA_PROFILE,providerName:`openai`}:{...n.PERMISSIVE_TOOL_SCHEMA_PROFILE,providerName:`openai`}}projectChatOptions(e){if(!e?.tools)return e;let t=e.model??this.options.defaultModel??``,n=this.projectTools(e.tools,t);return{...e,tools:n&&n.length>0?n:void 0}}publishModelEffortOutcome(e,t){let r=e?.effortResolution,i=e?.onModelEffortOutcome;if(r===void 0||i===void 0)return;let a=t===void 0?r.effective!==null&&r.disposition!==`model-default`?{state:`sent`,id:`responses.reasoning.effort`}:{state:`omitted`,reason:r.disposition===`model-default`?`provider-default-selection`:`model-effort-not-applied`}:{state:`omitted`,reason:t},o=t===void 0?{state:`sent`}:{state:`not-dispatched`,reason:t};try{i((0,n.createModelEffortOutcome)(r,{nativeControl:a,providerDispatch:o}))}catch(e){this.logger.warn(`Model-effort outcome observer failed`,{error:e instanceof Error?e.message:String(e)})}}supportsTools(){return!0}getCapabilities(){let e=this.apiSurface===`chat-completions`?`openai-compatible-chat-completions`:`openai-responses`;return{functionCalling:{supported:!0},nativeWebTools:{webSearch:{supported:!1,enabled:!1,source:e,reason:X(this.apiSurface,`search`)},webFetch:{supported:!1,enabled:!1,source:e,reason:X(this.apiSurface,`fetch`)}}}}validateConfig(){return!!this.client&&!!this.options}async dispose(){}validateMessages(e){super.validateMessages(e);for(let t of e)if(t.role===`assistant`){let e=t;if(e.toolCalls&&e.toolCalls.length>0&&e.content===``)continue}}};function De(e){return e.apiSurface===void 0?e.baseURL?`chat-completions`:`responses`:e.apiSurface}function X(e,t){return e===`chat-completions`?`OpenAI-compatible Chat Completions endpoints support declared function tools, not provider-native web ${t}.`:`OpenAI Responses native web ${t} is not wired in this provider version.`}function Oe(e,t){if(t?.webSearch===!0||t?.webFetch===!0)throw Error(`Provider openai native web search/fetch is not supported for apiSurface ${e} in this provider version.`)}var ke=class{static filterMessagesForOpenAI(e){return e.filter(e=>e.role===`user`||e.role===`assistant`||e.role===`system`||e.role===`tool`&&!!(e.toolCallId&&e.toolCallId.trim()!==``&&e.toolCallId!==`unknown`))}static toOpenAIFormat(e){return this.filterMessagesForOpenAI(e).map(e=>this.convertMessage(e))}static convertMessage(e){let t=e.role;if(t===`user`)return{role:`user`,content:e.content};if(t===`assistant`){let t=e;return t.toolCalls&&t.toolCalls.length>0?{role:`assistant`,content:t.content===``?null:t.content||null,tool_calls:t.toolCalls.map(e=>({id:e.id,type:`function`,function:{name:e.function.name,arguments:e.function.arguments}}))}:{role:`assistant`,content:t.content===null||t.content===``?null:t.content||``}}if(t===`system`)return{role:`system`,content:e.content};if(t===`tool`){if(!e.toolCallId||e.toolCallId.trim()===``)throw Error(`Tool message missing toolCallId: ${JSON.stringify(e)}`);return{role:`tool`,content:e.content,tool_call_id:e.toolCallId}}throw Error(`Unsupported message role: ${t}`)}static addSystemPromptIfNeeded(e,t){return!t||e.some(e=>e.role===`system`)?e:[{role:`system`,content:t},...e]}};const Z=`$ENV:OPENAI_API_KEY`,Ae=[{kind:`api-key`,label:`OpenAI API keys`,url:`https://platform.openai.com/api-keys`,sourceUrl:`https://developers.openai.com/api/reference/overview#authentication`,lastVerifiedAt:`2026-05-08`}];function je(){return{type:`openai`,displayName:`OpenAI`,description:`GPT series — general-purpose assistant. API key required.`,category:`cloud-paid`,costPerTokenUsd:.001,defaults:{apiKey:Z},endpoint:{host:`api.openai.com`,port:443},modelCatalog:{status:`unavailable`,sourceUrl:`https://platform.openai.com/docs/api-reference/models/list`,message:`OpenAI model availability should be discovered live from GET /v1/models.`},setupHelpLinks:Ae,setupSteps:[{key:`model`,title:`OpenAI model`,required:!0},{key:`apiKey`,title:`OpenAI API key`,defaultValue:Z,masked:!0}],requiresApiKey:!0,probeProfile:i.probeOpenAICompatibleProfile,destinationEnvironment:[`OPENAI_BASE_URL`,`OPENAI_ORG_ID`,`OPENAI_PROJECT_ID`],createProvider:e=>{let t=l(e.options?.parallelToolCalls,e.options?.apiSurface),n=Me(e.options),r=Ne(e.options);return Pe(e.baseURL,n,r),new Y({apiKey:Q(e.apiKey),...e.baseURL!==void 0&&{baseURL:e.baseURL},...e.timeout!==void 0&&{timeout:e.timeout},...n!==void 0&&{apiSurface:n},...t!==void 0&&{parallelToolCalls:t},...r!==void 0&&{nativeWebTools:r},...e.options?.durableOperations===!0&&{durableOperations:!0},defaultModel:e.model})}}}function Q(e){if(!e)throw Error(`Provider openai requires apiKey`);return e}function Me(e){let t=e?.apiSurface;if(t===`responses`||t===`chat-completions`)return t}function Ne(e){let t=$(e?.nativeWebTools)??$(e?.builtInWebTools);if(t!==void 0)return t}function $(e){if(e==null||e instanceof Date||Array.isArray(e)||typeof e!=`object`)return;let t=e.webSearch,n=e.webFetch;return{...typeof t==`boolean`&&{webSearch:t},...typeof n==`boolean`&&{webFetch:n}}}function Pe(e,t,n){if(n?.webSearch===!0||n?.webFetch===!0)throw Error(e!==void 0||t===`chat-completions`?`Provider openai profile uses an OpenAI-compatible Chat Completions endpoint; native web search/fetch is not supported for this profile. Use local WebSearch/WebFetch tools or a provider with documented hosted web support.`:`Provider openai native web search/fetch is not wired in this provider version. Use local WebSearch/WebFetch tools or a provider with documented hosted web support.`)}exports.DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE=Z,exports.DEFAULT_OPENAI_PROVIDER_MODEL=void 0,exports.OpenAIConversationAdapter=ke,exports.OpenAIProvider=Y,exports.createOpenAIProviderDefinition=je;
3
+ ${t}`:t}function F(e,t){if(R(t)){e.toolCalls.push(z(t));return}H(t)&&W(e.reasoning,V([t]))}function ye(e){let t=e.completedResponse;if(t===void 0)throw Error(`OpenAI Responses stream completed without response metadata`);G(t);let n=t.output??[],r=L(n),i=e.textParts.length>0?e.textParts.join(``):t.output_text??B(n),a=V(n);return W(a,e.reasoning),I({content:i,toolCalls:r.length>0?r:e.toolCalls,response:t,reasoning:a})}function I(e){return{id:(0,t.randomUUID)(),role:`assistant`,content:e.content,state:`complete`,timestamp:new Date,...e.toolCalls.length>0&&{toolCalls:e.toolCalls},...e.response?.usage!==void 0&&{usage:xe(e.response.usage)},metadata:{...be(e.response,e.reasoning),...e.response?.usage!==void 0&&{usageProvenance:e.response.usage.input_tokens!==void 0&&e.response.usage.output_tokens!==void 0&&e.response.usage.total_tokens!==void 0?`complete`:`partial`}}}}function be(e,t){return{providerApiSurface:`responses`,...e?.id!==void 0&&{responseId:e.id},...e?.model!==void 0&&{model:e.model},...e?.status!==void 0&&{finishReason:e.status},...t.reasoningSummaryCount>0&&{reasoningSummaryCount:t.reasoningSummaryCount,reasoningSummaries:t.reasoningSummaries},...t.hasEncryptedReasoning&&{hasEncryptedReasoning:!0}}}function xe(e){let t=e.input_tokens_details?.cached_tokens;return{promptTokens:e.input_tokens??0,completionTokens:e.output_tokens??0,...e.total_tokens!==void 0&&{totalTokens:e.total_tokens},...typeof t==`number`&&{cacheReadTokens:t}}}function L(e){return e.filter(R).map(e=>z(e))}function R(e){return e.type===`function_call`&&`call_id`in e&&`name`in e&&`arguments`in e}function z(e){return{id:e.call_id,type:`function`,function:{name:e.name,arguments:e.arguments}}}function B(e){return e.filter(Ce).flatMap(e=>e.content).map(Se).join(``)}function Se(e){return e.type===`refusal`?e.refusal:e.text}function Ce(e){return e.type===`message`&&`content`in e&&Array.isArray(e.content)}function V(e){let t=U();for(let n of e){if(!H(n))continue;let e=n.summary?.map(e=>e.text).filter(we)??[];t.reasoningSummaryCount+=e.length,t.reasoningSummaries.push(...e),t.hasEncryptedReasoning=t.hasEncryptedReasoning||!!n.encrypted_content}return t}function H(e){return e.type===`reasoning`}function U(){return{reasoningSummaryCount:0,reasoningSummaries:[],hasEncryptedReasoning:!1}}function W(e,t){e.reasoningSummaryCount+=t.reasoningSummaryCount,e.reasoningSummaries.push(...t.reasoningSummaries),e.hasEncryptedReasoning=e.hasEncryptedReasoning||t.hasEncryptedReasoning}function we(e){return e!==void 0}function G(e){if(e.status===`failed`||e.status===`incomplete`)throw Error(`OpenAI Responses API failed: ${e.error?.message??e.status}`)}function Te(e){return e.message??e.error?.message??e.response?.error?.message??`unknown error`}async function Ee(e){let t=e.chatOptions?.onTextDelta??e.onTextDelta;if(t)return K({...e,chatOptions:{...e.chatOptions,onTextDelta:t}});if(!e.client)throw Error(`OpenAI Responses client not available.`);try{let t=q(e);e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`responses`,payloadKind:`request`,payload:t});let n=await e.client.responses.create(t,x(e.chatOptions?.signal,e.requestHeaders));return e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`responses`,payloadKind:`response`,payload:n}),b(A(n),y(n))}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI responses failed`)}}async function*De(e){let t={deltas:[]},n=e.chatOptions?.onTextDelta??e.onTextDelta,r=K({...e,chatOptions:{...e.chatOptions,onTextDelta:e=>{n?.(e),je(t,ke(e))}}}).then(e=>Me(t,e)).catch(e=>Ne(t,Ie(e)));yield*Ae(t),await r}async function K(e){if(!e.client)throw Error(`OpenAI Responses client not available.`);try{let t=Oe(e);e.chatOptions?.onProviderNativeRawPayload?.({provider:`openai`,apiSurface:`responses`,payloadKind:`request`,payload:t});let{data:n,providerRequestId:r}=await v(e.client.responses.create(t,x(e.chatOptions?.signal,e.requestHeaders)));return b(await j({stream:(0,i.observeProviderNativeRawPayloadStream)(n,{provider:`openai`,apiSurface:`responses`,onProviderNativeRawPayload:e.chatOptions?.onProviderNativeRawPayload}),onTextDelta:e.chatOptions?.onTextDelta,onThinkingDelta:e.chatOptions?.onThinkingDelta,signal:e.chatOptions?.signal}),r)}catch(e){throw(0,n.toProviderError)(e,`openai`,`OpenAI responses stream failed`)}}function q(e){let t=e.chatOptions?.model??e.providerOptions.defaultModel;if(!t)throw Error(`Model is required in chat options. Please specify a model in defaultModel configuration.`);let n=pe(e.chatOptions?.tools,e.providerOptions.strictTools),r=ae(e.providerOptions),a=de(e.providerOptions.reasoning,e.chatOptions?.effortResolution);return{...c(e.extraBody),model:t,..._(e.parallelToolCalls),input:fe(e.messages),...n!==void 0&&{tools:n,tool_choice:(0,i.toOpenAIResponsesToolChoice)(e.chatOptions?.toolChoice)},...e.chatOptions?.temperature!==void 0&&{temperature:e.chatOptions.temperature},...e.chatOptions?.maxTokens!==void 0&&{max_output_tokens:e.chatOptions.maxTokens},...r!==void 0&&{text:r},...a!==void 0&&{reasoning:a},...e.providerOptions.includeEncryptedReasoning===!0&&{include:[`reasoning.encrypted_content`]},...e.providerOptions.store!==void 0&&{store:e.providerOptions.store}}}function Oe(e){return{...q(e),stream:!0}}function ke(e){return{id:(0,t.randomUUID)(),role:`assistant`,content:e,state:`complete`,timestamp:new Date,metadata:{providerApiSurface:`responses`,isStreamChunk:!0,isComplete:!1}}}async function*Ae(e){for(;;){let t=e.deltas.shift();if(t!==void 0){yield t;continue}if(e.error!==void 0)throw e.error;if(e.finalMessage!==void 0){yield Fe(e.finalMessage);return}await Pe(e)}}function je(e,t){e.deltas.push(t),J(e)}function Me(e,t){e.finalMessage=t,J(e)}function Ne(e,t){e.error=t,J(e)}function Pe(e){return new Promise(t=>{e.wake=t})}function J(e){e.wake?.(),e.wake=void 0}function Fe(e){return{...e,content:``,metadata:{...e.metadata,isStreamChunk:!0,isComplete:!0}}}function Ie(e){return e instanceof Error?e:Error(String(e))}var Y=class extends n.AbstractAIProvider{name=`openai`;version=`1.0.0`;client;options;apiSurface;parallelToolCalls;extraBody;payloadLogger;responseParser;onTextDelta;constructor(e){if(super(e.logger||n.SilentLogger),this.options=e,this.parallelToolCalls=h(e.parallelToolCalls,e.apiSurface),g(this.parallelToolCalls,e.executor!==void 0),this.extraBody=o(e.extraBody),s(this.extraBody,e.executor!==void 0),this.apiSurface=Le(e),Z(this.apiSurface,e.nativeWebTools),e.executor&&(this.executor=e.executor),!this.executor)if(e.client)this.client=e.client;else if(e.apiKey)this.client=new r.default({apiKey:e.apiKey,...e.organization&&{organization:e.organization},...e.timeout&&{timeout:e.timeout},...e.baseURL&&{baseURL:e.baseURL}});else throw Error(`Either OpenAI client, apiKey, or executor is required`);this.responseParser=new le(this.logger),this.payloadLogger=e.payloadLogger}async chat(e,t){g(this.parallelToolCalls,this.executor!==void 0),s(this.extraBody,this.executor!==void 0),this.validateMessages(e),this.validateNativeWebTools(t?.nativeWebTools);let n=this.resolveEffortOptions(t);if(this.executor)try{let t=await this.executeViaExecutorOrDirect(e,n);return t.modelEffortOutcome===void 0&&this.publishModelEffortOutcome(n,`opaque-executor`),t.message}catch(e){throw this.logger.error(`OpenAI Provider executor chat error:`,e instanceof Error?e.message:String(e)),e}if(this.apiSurface===`responses`){let t=await Ee({client:this.client,messages:e,chatOptions:this.projectChatOptions(n),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,extraBody:this.extraBody,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(n)});return this.publishModelEffortOutcome(n),t}let r=await oe({client:this.client,messages:e,chatOptions:this.projectChatOptions(n),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,extraBody:this.extraBody,payloadLogger:this.payloadLogger,responseParser:this.responseParser,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(n)});return this.publishModelEffortOutcome(n),r}async*chatStream(e,t){g(this.parallelToolCalls,this.executor!==void 0),s(this.extraBody,this.executor!==void 0),this.validateNativeWebTools(t?.nativeWebTools);let n=this.resolveEffortOptions(t);if(this.executor)try{let t=!1;for await(let r of this.executeStreamViaExecutorOrDirect(e,n))r.kind===`message`?yield r.message:t=r.modelEffortOutcome!==void 0;t||this.publishModelEffortOutcome(n,`opaque-executor`);return}catch(e){throw this.logger.error(`OpenAI Provider executor stream error:`,e instanceof Error?e.message:String(e)),e}yield*this.streamDirect(e,n)}async*streamDirect(e,t){if(this.apiSurface===`responses`){yield*De({client:this.client,messages:e,chatOptions:this.projectChatOptions(t),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,extraBody:this.extraBody,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(t)}),this.publishModelEffortOutcome(t);return}yield*S({client:this.client,messages:e,chatOptions:this.projectChatOptions(t),providerOptions:this.options,parallelToolCalls:this.parallelToolCalls,extraBody:this.extraBody,payloadLogger:this.payloadLogger,responseParser:this.responseParser,onTextDelta:this.onTextDelta,requestHeaders:this.traceRequestHeaders(t)}),this.publishModelEffortOutcome(t)}endpointIsVendorDefault(){return this.options.baseURL===void 0}canPropagateTraceContext(){return!this.executor&&this.effectiveBaseUrl()!==void 0}effectiveBaseUrl(){let e=this.client?.baseURL;return typeof e==`string`&&e.length>0?e:void 0}traceRequestHeaders(e){return{...this.canPropagateTraceContext()?(0,n.traceHeadersFor)(this.effectiveBaseUrl(),e?.outboundTraceContext):{},...this.options.durableOperations===!0?{"Idempotency-Key":(0,t.randomUUID)()}:{}}}effortTable(){return this.endpointIsVendorDefault()&&this.apiSurface===`responses`?ce:void 0}resolveEffortOptions(e){if(e?.effort===void 0||e.effortResolution!==void 0)return e;let t=e.model??this.options.defaultModel;return t===void 0?e:{...e,effortResolution:(0,n.resolveModelEffort)(this.effortTable(),t,e.effort)}}projectionProfile(){return this.options.strictTools?{...n.STRICT_TOOL_SCHEMA_PROFILE,providerName:`openai`}:{...n.PERMISSIVE_TOOL_SCHEMA_PROFILE,providerName:`openai`}}projectChatOptions(e){if(!e?.tools)return e;let t=e.model??this.options.defaultModel??``,n=this.projectTools(e.tools,t);return{...e,tools:n&&n.length>0?n:void 0}}publishModelEffortOutcome(e,t){let r=e?.effortResolution,i=e?.onModelEffortOutcome;if(r===void 0||i===void 0)return;let a=t===void 0?r.effective!==null&&r.disposition!==`model-default`?{state:`sent`,id:`responses.reasoning.effort`}:{state:`omitted`,reason:r.disposition===`model-default`?`provider-default-selection`:`model-effort-not-applied`}:{state:`omitted`,reason:t},o=t===void 0?{state:`sent`}:{state:`not-dispatched`,reason:t};try{i((0,n.createModelEffortOutcome)(r,{nativeControl:a,providerDispatch:o}))}catch(e){this.logger.warn(`Model-effort outcome observer failed`,{error:e instanceof Error?e.message:String(e)})}}supportsTools(){return!0}getCapabilities(){let e=this.apiSurface===`chat-completions`?`openai-compatible-chat-completions`:`openai-responses`;return{functionCalling:{supported:!0},nativeWebTools:{webSearch:{supported:!1,enabled:!1,source:e,reason:X(this.apiSurface,`search`)},webFetch:{supported:!1,enabled:!1,source:e,reason:X(this.apiSurface,`fetch`)}}}}validateConfig(){return!!this.client&&!!this.options}async dispose(){}validateMessages(e){super.validateMessages(e);for(let t of e)if(t.role===`assistant`){let e=t;if(e.toolCalls&&e.toolCalls.length>0&&e.content===``)continue}}};function Le(e){return e.apiSurface===void 0?e.baseURL?`chat-completions`:`responses`:e.apiSurface}function X(e,t){return e===`chat-completions`?`OpenAI-compatible Chat Completions endpoints support declared function tools, not provider-native web ${t}.`:`OpenAI Responses native web ${t} is not wired in this provider version.`}function Z(e,t){if(t?.webSearch===!0||t?.webFetch===!0)throw Error(`Provider openai native web search/fetch is not supported for apiSurface ${e} in this provider version.`)}var Re=class{static filterMessagesForOpenAI(e){return e.filter(e=>e.role===`user`||e.role===`assistant`||e.role===`system`||e.role===`tool`&&!!(e.toolCallId&&e.toolCallId.trim()!==``&&e.toolCallId!==`unknown`))}static toOpenAIFormat(e){return this.filterMessagesForOpenAI(e).map(e=>this.convertMessage(e))}static convertMessage(e){let t=e.role;if(t===`user`)return{role:`user`,content:e.content};if(t===`assistant`){let t=e;return t.toolCalls&&t.toolCalls.length>0?{role:`assistant`,content:t.content===``?null:t.content||null,tool_calls:t.toolCalls.map(e=>({id:e.id,type:`function`,function:{name:e.function.name,arguments:e.function.arguments}}))}:{role:`assistant`,content:t.content===null||t.content===``?null:t.content||``}}if(t===`system`)return{role:`system`,content:e.content};if(t===`tool`){if(!e.toolCallId||e.toolCallId.trim()===``)throw Error(`Tool message missing toolCallId: ${JSON.stringify(e)}`);return{role:`tool`,content:e.content,tool_call_id:e.toolCallId}}throw Error(`Unsupported message role: ${t}`)}static addSystemPromptIfNeeded(e,t){return!t||e.some(e=>e.role===`system`)?e:[{role:`system`,content:t},...e]}};const Q=`$ENV:OPENAI_API_KEY`,ze=[{kind:`api-key`,label:`OpenAI API keys`,url:`https://platform.openai.com/api-keys`,sourceUrl:`https://developers.openai.com/api/reference/overview#authentication`,lastVerifiedAt:`2026-05-08`}];function Be(){return{type:`openai`,displayName:`OpenAI`,description:`GPT series — general-purpose assistant. API key required.`,category:`cloud-paid`,costPerTokenUsd:.001,defaults:{apiKey:Q},endpoint:{host:`api.openai.com`,port:443},modelCatalog:{status:`unavailable`,sourceUrl:`https://platform.openai.com/docs/api-reference/models/list`,message:`OpenAI model availability should be discovered live from GET /v1/models.`},setupHelpLinks:ze,setupSteps:[{key:`model`,title:`OpenAI model`,required:!0},{key:`apiKey`,title:`OpenAI API key`,defaultValue:Q,masked:!0}],requiresApiKey:!0,probeProfile:i.probeOpenAICompatibleProfile,destinationEnvironment:[`OPENAI_BASE_URL`,`OPENAI_ORG_ID`,`OPENAI_PROJECT_ID`],createProvider:e=>{let t=h(e.options?.parallelToolCalls,e.options?.apiSurface),n=o(e.options?.extraBody),r=He(e.options),i=Ue(e.options);return We(e.baseURL,r,i),new Y({apiKey:Ve(e.apiKey),...e.baseURL!==void 0&&{baseURL:e.baseURL},...e.timeout!==void 0&&{timeout:e.timeout},...r!==void 0&&{apiSurface:r},...t!==void 0&&{parallelToolCalls:t},...n!==void 0&&{extraBody:n},...i!==void 0&&{nativeWebTools:i},...e.options?.durableOperations===!0&&{durableOperations:!0},defaultModel:e.model})}}}function Ve(e){if(!e)throw Error(`Provider openai requires apiKey`);return e}function He(e){let t=e?.apiSurface;if(t===`responses`||t===`chat-completions`)return t}function Ue(e){let t=$(e?.nativeWebTools)??$(e?.builtInWebTools);if(t!==void 0)return t}function $(e){if(e==null||e instanceof Date||Array.isArray(e)||typeof e!=`object`)return;let t=e.webSearch,n=e.webFetch;return{...typeof t==`boolean`&&{webSearch:t},...typeof n==`boolean`&&{webFetch:n}}}function We(e,t,n){if(n?.webSearch===!0||n?.webFetch===!0)throw Error(e!==void 0||t===`chat-completions`?`Provider openai profile uses an OpenAI-compatible Chat Completions endpoint; native web search/fetch is not supported for this profile. Use local WebSearch/WebFetch tools or a provider with documented hosted web support.`:`Provider openai native web search/fetch is not wired in this provider version. Use local WebSearch/WebFetch tools or a provider with documented hosted web support.`)}exports.DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE=Q,exports.DEFAULT_OPENAI_PROVIDER_MODEL=void 0,exports.OpenAIConversationAdapter=Re,exports.OpenAIProvider=Y,exports.createOpenAIProviderDefinition=Be;
@@ -17,10 +17,16 @@ interface IOpenAINativeWebToolsOptions {
17
17
  webSearch?: boolean;
18
18
  webFetch?: boolean;
19
19
  }
20
+ /** A JSON value sent through {@link IOpenAIProviderOptions.extraBody}. */
21
+ type TOpenAIExtraBodyValue = string | number | boolean | null | readonly TOpenAIExtraBodyValue[] | {
22
+ readonly [key: string]: TOpenAIExtraBodyValue;
23
+ };
24
+ /** Top-level request-body fields sent through {@link IOpenAIProviderOptions.extraBody}. */
25
+ type TOpenAIExtraBody = Readonly<Record<string, TOpenAIExtraBodyValue>>;
20
26
  /**
21
27
  * Valid provider option value types
22
28
  */
23
- type TOpenAIProviderOptionValue = string | number | boolean | undefined | null | IOpenAIJsonSchemaDefinition | IOpenAINativeWebToolsOptions | IOpenAIResponsesReasoningOptions | OpenAI | IPayloadLogger | ILogger | IExecutor | TProviderOptionValueBase | TOpenAIProviderOptionValue[] | {
29
+ type TOpenAIProviderOptionValue = string | number | boolean | undefined | null | IOpenAIJsonSchemaDefinition | IOpenAINativeWebToolsOptions | IOpenAIResponsesReasoningOptions | TOpenAIExtraBody | OpenAI | IPayloadLogger | ILogger | IExecutor | TProviderOptionValueBase | TOpenAIProviderOptionValue[] | {
24
30
  [key: string]: TOpenAIProviderOptionValue;
25
31
  };
26
32
  /**
@@ -139,6 +145,13 @@ interface IOpenAIProviderOptions {
139
145
  * argument validity or execution order. Explicit values cannot be used with an executor.
140
146
  */
141
147
  readonly parallelToolCalls?: boolean;
148
+ /**
149
+ * JSON fields merged as top-level fields into every request body on both API surfaces, for
150
+ * endpoint-specific options this provider does not model (for example a gateway's upstream
151
+ * options). Copied at construction; an empty object is the same as omitting it. Fields the
152
+ * provider manages and non-JSON values are rejected, and it cannot be used with an executor.
153
+ */
154
+ readonly extraBody?: TOpenAIExtraBody;
142
155
  /**
143
156
  * Provider-native hosted web tool request from provider profile options.
144
157
  *
@@ -220,6 +233,7 @@ declare class OpenAIProvider extends AbstractAIProvider {
220
233
  private readonly options;
221
234
  private readonly apiSurface;
222
235
  private readonly parallelToolCalls;
236
+ private readonly extraBody;
223
237
  private readonly payloadLogger;
224
238
  private readonly responseParser;
225
239
  /**
@@ -314,5 +328,5 @@ declare const DEFAULT_OPENAI_PROVIDER_MODEL: string | undefined;
314
328
  declare const DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE = "$ENV:OPENAI_API_KEY";
315
329
  declare function createOpenAIProviderDefinition(): IProviderDefinition;
316
330
  //#endregion
317
- export { DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE, DEFAULT_OPENAI_PROVIDER_MODEL, IOpenAIJsonSchemaDefinition, IOpenAINativeWebToolsOptions, IOpenAIProviderOptions, IOpenAIResponsesReasoningOptions, type IPayloadLogger, type IPayloadLoggerOptions, OpenAIConversationAdapter, OpenAIProvider, TOpenAIApiSurface, TOpenAIProviderOptionValue, createOpenAIProviderDefinition };
331
+ export { DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE, DEFAULT_OPENAI_PROVIDER_MODEL, IOpenAIJsonSchemaDefinition, IOpenAINativeWebToolsOptions, IOpenAIProviderOptions, IOpenAIResponsesReasoningOptions, type IPayloadLogger, type IPayloadLoggerOptions, OpenAIConversationAdapter, OpenAIProvider, TOpenAIApiSurface, TOpenAIExtraBody, TOpenAIExtraBodyValue, TOpenAIProviderOptionValue, createOpenAIProviderDefinition };
318
332
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/openai/types.ts","../../src/openai/provider.ts","../../src/openai/adapter.ts","../../src/openai/provider-definition.ts"],"mappings":";;;;KAIY;UAEK;EACf;EACA;EACA,SAAS,eAAe;EACxB;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;;;;KAMU,4EAMR,8BACA,+BACA,mCACA,SACA,iBACA,UACA,YACA,2BACA;GACG,cAAc;;;;;UAKJ;;EAEf;;;;GAIC,cAAc;;;;EAKf;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA;;;;EAKA;;;;;;;EAQA,aAAa;;;;;;;EAQb;;;;EAKA,aAAa;;;;;EAMb,YAAY;;;;EAKZ;;;;EAKA;;;;;;;;;;;;;;;;;EAkBA;;;;;;;WAQS;;;;;;;;EAST,iBAAiB;;;;EAKjB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BT,gBAAgB;;;;;;;;;;;;;;;;;;EAmBhB,WAAW;;;;;EAMX,SAAS;;;;;;;;;;;;cC1ME,uBAAuB;WAChB;WACA;mBAED;mBACA;mBACA;mBACA;mBACA;mBACA;;;;;;;EAQjB,cAAc;EAEF,YAAA,SAAS;EA+BN,KACb,UAAU,qBACV,UAAU,eACT,QAAQ;EAmDK,WACd,UAAU,qBACV,UAAU,eACT,cAAc;UAkCF;;;;;;;;;;EAyCf;;;;;;EASA;UAIQ;UAKA;EASC,eAAe;UAMhB;;;;;YAcW,qBAAqB;;;;;;;;UAahC;UAYA;EAiCC;EAIA,mBAAmB;EAwBnB;EAIM,WAAW;YAIP,iBAAiB,UAAU;;;;;;;;;;;;cC9VnC;;;;;;;;;SASJ,wBAAwB,UAAU,sBAAsB;;;;;SAqBxD,eAAe,UAAU,sBAAsB,OAAO,KAAK;;;;;SAU3D,eAAe,KAAK,oBAAoB,OAAO,KAAK;;;;SA2EpD,wBACL,UAAU,OAAO,KAAK,8BACtB,wBACC,OAAO,KAAK;;;;cCzHJ;cACA;iBAeG,kCAAkC"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/openai/types.ts","../../src/openai/provider.ts","../../src/openai/adapter.ts","../../src/openai/provider-definition.ts"],"mappings":";;;;KAIY;UAEK;EACf;EACA;EACA,SAAS,eAAe;EACxB;;UAGe;EACf;EACA;;UAGe;EACf;EACA;;;KAIU,oEAKC;YACG,cAAc;;;KAGlB,mBAAmB,SAAS,eAAe;;;;KAK3C,4EAMR,8BACA,+BACA,mCACA,mBACA,SACA,iBACA,UACA,YACA,2BACA;GACG,cAAc;;;;;UAKJ;;EAEf;;;;GAIC,cAAc;;;;EAKf;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA;;;;EAKA;;;;;;;EAQA,aAAa;;;;;;;EAQb;;;;EAKA,aAAa;;;;;EAMb,YAAY;;;;EAKZ;;;;EAKA;;;;;;;;;;;;;;;;;EAkBA;;;;;;;WAQS;;;;;;;WAQA,YAAY;;;;;;;;EASrB,iBAAiB;;;;EAKjB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BT,gBAAgB;;;;;;;;;;;;;;;;;;EAmBhB,WAAW;;;;;EAMX,SAAS;;;;;;;;;;;;cC9NE,uBAAuB;WAChB;WACA;mBAED;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;;;;;;;EAQjB,cAAc;EAEF,YAAA,SAAS;EAiCN,KACb,UAAU,qBACV,UAAU,eACT,QAAQ;EAsDK,WACd,UAAU,qBACV,UAAU,eACT,cAAc;UAmCF;;;;;;;;;;EA2Cf;;;;;;EASA;UAIQ;UAKA;EASC,eAAe;UAMhB;;;;;YAcW,qBAAqB;;;;;;;;UAahC;UAYA;EAiCC;EAIA,mBAAmB;EAwBnB;EAIM,WAAW;YAIP,iBAAiB,UAAU;;;;;;;;;;;;cCxWnC;;;;;;;;;SASJ,wBAAwB,UAAU,sBAAsB;;;;;SAqBxD,eAAe,UAAU,sBAAsB,OAAO,KAAK;;;;;SAU3D,eAAe,KAAK,oBAAoB,OAAO,KAAK;;;;SA2EpD,wBACL,UAAU,OAAO,KAAK,8BACtB,wBACC,OAAO,KAAK;;;;cCxHJ;cACA;iBAeG,kCAAkC"}