@robota-sdk/agent-provider-openai 3.0.0-beta.63 → 3.0.0-beta.82

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 (70) hide show
  1. package/LICENSE +661 -21
  2. package/dist/node/index.cjs +1 -2
  3. package/dist/node/index.d.cts +271 -267
  4. package/dist/node/index.d.cts.map +1 -0
  5. package/dist/node/index.d.ts +271 -267
  6. package/dist/node/index.d.ts.map +1 -0
  7. package/dist/node/index.js +2 -2
  8. package/dist/node/index.js.map +1 -0
  9. package/dist/node/loggers/index.cjs +1 -0
  10. package/dist/node/loggers/index.d.cts +94 -0
  11. package/dist/node/loggers/index.d.cts.map +1 -0
  12. package/dist/node/loggers/index.d.ts +94 -0
  13. package/dist/node/loggers/index.d.ts.map +1 -0
  14. package/dist/node/loggers/index.js +2 -0
  15. package/dist/node/loggers/index.js.map +1 -0
  16. package/dist/node/payload-logger-BaW0K8yI.d.cts +61 -0
  17. package/dist/node/payload-logger-BaW0K8yI.d.cts.map +1 -0
  18. package/dist/node/payload-logger-BaW0K8yI.d.ts +61 -0
  19. package/dist/node/payload-logger-BaW0K8yI.d.ts.map +1 -0
  20. package/dist/node/rolldown-runtime-CMqjfN_6.cjs +1 -0
  21. package/package.json +69 -86
  22. package/src/index.ts +1 -0
  23. package/src/openai/__tests__/endpoint-provenance.test.ts +44 -0
  24. package/src/openai/__tests__/provider-errors.test.ts +114 -0
  25. package/src/openai/__tests__/request-format.test.ts +59 -0
  26. package/src/openai/__tests__/strict-tools-closure.test.ts +136 -0
  27. package/src/openai/__tests__/tool-schema-projection.test.ts +302 -0
  28. package/src/openai/__tests__/trace-context-wire.test.ts +114 -0
  29. package/src/openai/adapter.test.ts +494 -0
  30. package/src/openai/adapter.ts +145 -0
  31. package/src/openai/chat-completions-chat.ts +225 -0
  32. package/src/openai/executor-integration.test.ts +213 -0
  33. package/src/openai/index.ts +19 -0
  34. package/src/openai/interfaces/payload-logger.ts +48 -0
  35. package/src/openai/loggers/console-payload-logger.test.ts +173 -0
  36. package/src/openai/loggers/console-payload-logger.ts +96 -0
  37. package/src/openai/loggers/console.ts +9 -0
  38. package/src/openai/loggers/file-payload-logger.test.ts +243 -0
  39. package/src/openai/loggers/file-payload-logger.ts +124 -0
  40. package/src/openai/loggers/file.ts +9 -0
  41. package/src/openai/loggers/index.ts +12 -0
  42. package/src/openai/loggers/sanitize-openai-log-data.test.ts +89 -0
  43. package/src/openai/loggers/sanitize-openai-log-data.ts +14 -0
  44. package/src/openai/message-converter.ts +23 -0
  45. package/src/openai/model-effort-table.ts +19 -0
  46. package/src/openai/model-effort-verification-config.test.ts +45 -0
  47. package/src/openai/model-effort-verification-config.ts +35 -0
  48. package/src/openai/openai-request-format.ts +116 -0
  49. package/src/openai/parsers/response-parser.test.ts +407 -0
  50. package/src/openai/parsers/response-parser.ts +48 -0
  51. package/src/openai/provider-definition.test.ts +74 -0
  52. package/src/openai/provider-definition.ts +139 -0
  53. package/src/openai/provider.test.ts +1686 -0
  54. package/src/openai/provider.ts +392 -0
  55. package/src/openai/reasoning-effort.test.ts +272 -0
  56. package/src/openai/reasoning-effort.ts +49 -0
  57. package/src/openai/request-id.ts +39 -0
  58. package/src/openai/request-options.ts +14 -0
  59. package/src/openai/responses-chat.ts +285 -0
  60. package/src/openai/responses-converter.ts +122 -0
  61. package/src/openai/responses-parser.ts +297 -0
  62. package/src/openai/responses-stream-utils.ts +45 -0
  63. package/src/openai/responses-types.ts +193 -0
  64. package/src/openai/streaming/stream-assembler.ts +3 -0
  65. package/src/openai/types/api-types.ts +113 -0
  66. package/src/openai/types.ts +235 -0
  67. package/CHANGELOG.md +0 -614
  68. package/README.md +0 -467
  69. package/dist/browser/index.d.ts +0 -307
  70. package/dist/browser/index.js +0 -2
@@ -1,216 +1,204 @@
1
- import OpenAI from 'openai';
2
- import { ILogger, IExecutor, TProviderOptionValueBase, AbstractAIProvider, TTextDeltaCallback, TUniversalMessage, IChatOptions, IProviderCapabilities, IProviderProfileConfig, IProviderModelCatalog, IProviderDefinition } from '@robota-sdk/agent-core';
3
-
4
- /**
5
- * Payload logging data structure
6
- */
7
- interface IOpenAILogData {
8
- model: string;
9
- messagesCount: number;
10
- hasTools: boolean;
11
- temperature?: number | undefined;
12
- maxTokens?: number | undefined;
13
- timestamp: string;
14
- requestId?: string | undefined;
15
- }
16
-
17
- /**
18
- * IPayloadLogger interface for logging OpenAI API payloads
19
- *
20
- * This interface provides a contract for different logging implementations:
21
- * - FilePayloadLogger: Node.js file-based logging
22
- * - ConsolePayloadLogger: Browser console-based logging
23
- * - Custom implementations: User-defined loggers
24
- */
25
- interface IPayloadLogger {
26
- /**
27
- * Check if logging is enabled
28
- * @returns true if logging is active, false otherwise
29
- */
30
- isEnabled(): boolean;
31
- /**
32
- * Log API payload data
33
- * @param payload - The API request/response payload data
34
- * @param type - Type of operation ('chat' or 'stream')
35
- */
36
- logPayload(payload: IOpenAILogData, type: 'chat' | 'stream'): Promise<void>;
37
- }
38
- /**
39
- * Configuration options for payload loggers
40
- */
41
- interface IPayloadLoggerOptions {
42
- /**
43
- * Whether logging is enabled
44
- * @defaultValue true
45
- */
46
- enabled?: boolean;
47
- /**
48
- * Include timestamp in log entries
49
- * @defaultValue true
50
- */
51
- includeTimestamp?: boolean;
52
- /**
53
- * Logger instance for console output
54
- * @defaultValue SilentLogger
55
- */
56
- logger?: ILogger;
57
- }
58
-
1
+ import { n as IPayloadLoggerOptions, t as IPayloadLogger } from "./payload-logger-BaW0K8yI.cjs";
2
+ import { AbstractAIProvider, IChatOptions, IExecutor, ILogger, IProviderCapabilities, IProviderDefinition, IProviderModelEffortTable, IToolSchemaProjectionProfile, TProviderOptionValueBase, TTextDeltaCallback, TUniversalMessage } from "@robota-sdk/agent-core";
3
+ import OpenAI from "openai";
4
+ //#region src/openai/types.d.ts
59
5
  type TOpenAIApiSurface = 'responses' | 'chat-completions';
60
6
  interface IOpenAIJsonSchemaDefinition {
61
- name: string;
62
- description?: string;
63
- schema?: Record<string, TOpenAIProviderOptionValue>;
64
- strict?: boolean;
7
+ name: string;
8
+ description?: string;
9
+ schema?: Record<string, TOpenAIProviderOptionValue>;
10
+ strict?: boolean;
65
11
  }
66
12
  interface IOpenAIResponsesReasoningOptions {
67
- effort?: 'low' | 'medium' | 'high';
68
- summary?: 'auto' | 'concise' | 'detailed';
13
+ effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
14
+ summary?: 'auto' | 'concise' | 'detailed';
69
15
  }
70
16
  interface IOpenAINativeWebToolsOptions {
71
- webSearch?: boolean;
72
- webFetch?: boolean;
17
+ webSearch?: boolean;
18
+ webFetch?: boolean;
73
19
  }
74
20
  /**
75
21
  * Valid provider option value types
76
22
  */
77
23
  type TOpenAIProviderOptionValue = string | number | boolean | undefined | null | IOpenAIJsonSchemaDefinition | IOpenAINativeWebToolsOptions | IOpenAIResponsesReasoningOptions | OpenAI | IPayloadLogger | ILogger | IExecutor | TProviderOptionValueBase | TOpenAIProviderOptionValue[] | {
78
- [key: string]: TOpenAIProviderOptionValue;
24
+ [key: string]: TOpenAIProviderOptionValue;
79
25
  };
80
26
  /**
81
27
  * OpenAI provider options
82
28
  */
83
29
  interface IOpenAIProviderOptions {
84
- /**
85
- * Additional provider-specific options
86
- */
87
- [key: string]: TOpenAIProviderOptionValue;
88
- /**
89
- * OpenAI API key (required when client is not provided)
90
- */
91
- apiKey?: string;
92
- /**
93
- * OpenAI organization ID (optional)
94
- */
95
- organization?: string;
96
- /**
97
- * API request timeout (milliseconds)
98
- */
99
- timeout?: number;
100
- /**
101
- * API base URL (default: 'https://api.openai.com/v1')
102
- */
103
- baseURL?: string;
104
- /**
105
- * Default model used when chat options do not provide a model.
106
- */
107
- defaultModel?: string;
108
- /**
109
- * API surface to use for direct OpenAI calls.
110
- *
111
- * Defaults to Responses for official OpenAI calls. Profiles with baseURL use
112
- * Chat Completions by default for OpenAI-compatible endpoint compatibility.
113
- */
114
- apiSurface?: TOpenAIApiSurface;
115
- /**
116
- * Response format (default: 'text')
117
- * - 'text': Plain text response
118
- * - 'json_object': JSON object mode (requires system message)
119
- * - 'json_schema': Structured Outputs with schema validation
120
- */
121
- responseFormat?: 'text' | 'json_object' | 'json_schema';
122
- /**
123
- * JSON schema for structured outputs (required when responseFormat is 'json_schema')
124
- */
125
- jsonSchema?: IOpenAIJsonSchemaDefinition;
126
- /**
127
- * Responses API reasoning controls. Hidden reasoning is never exposed in message
128
- * content; only explicit summaries/encrypted items requested here are represented.
129
- */
130
- reasoning?: IOpenAIResponsesReasoningOptions;
131
- /**
132
- * Whether OpenAI should store Responses API results. Defaults to OpenAI API behavior.
133
- */
134
- store?: boolean;
135
- /**
136
- * Include encrypted reasoning items for stateless reasoning continuation.
137
- */
138
- includeEncryptedReasoning?: boolean;
139
- /**
140
- * Opt into strict custom function parameter validation where supported.
141
- */
142
- strictTools?: boolean;
143
- /**
144
- * Provider-native hosted web tool request from provider profile options.
145
- *
146
- * OpenAI-compatible Chat Completions endpoints do not support this Robota
147
- * native web contract. The provider rejects unsupported configurations before
148
- * any model request is sent.
149
- */
150
- nativeWebTools?: IOpenAINativeWebToolsOptions;
151
- /**
152
- * OpenAI client instance (optional: will be created from apiKey if not provided)
153
- */
154
- client?: OpenAI;
155
- /**
156
- * Payload logger instance for debugging API requests/responses
157
- *
158
- * Use different implementations based on your environment:
159
- * - FilePayloadLogger: Node.js file-based logging
160
- * - ConsolePayloadLogger: Browser console-based logging
161
- * - Custom: Implement IPayloadLogger interface
162
- *
163
- * @example
164
- * ```typescript
165
- * // Node.js
166
- * import { FilePayloadLogger } from '@robota-sdk/agent-provider-openai/loggers/file';
167
- * const provider = new OpenAIProvider({
168
- * client: openaiClient,
169
- * payloadLogger: new FilePayloadLogger({ logDir: './logs/openai' })
170
- * });
171
- *
172
- * // Browser
173
- * import { ConsolePayloadLogger } from '@robota-sdk/agent-provider-openai/loggers/console';
174
- * const provider = new OpenAIProvider({
175
- * client: openaiClient,
176
- * payloadLogger: new ConsolePayloadLogger()
177
- * });
178
- * ```
179
- */
180
- payloadLogger?: IPayloadLogger;
181
- /**
182
- * Optional executor for handling AI requests
183
- *
184
- * When provided, the provider will delegate all chat operations to this executor
185
- * instead of making direct API calls. This enables remote execution capabilities.
186
- *
187
- * @example
188
- * ```typescript
189
- * import { LocalExecutor, RemoteExecutor } from '@robota-sdk/agent-core';
190
- *
191
- * // Local execution (registers this provider)
192
- * const localExecutor = new LocalExecutor();
193
- * localExecutor.registerProvider('openai', new OpenAIProvider({ apiKey: 'sk-...' }));
194
- *
195
- * // Remote execution
196
- * const remoteExecutor = new RemoteExecutor({
197
- * serverUrl: 'https://api.robota.io',
198
- * userApiKey: 'user-token-123'
199
- * });
200
- *
201
- * const provider = new OpenAIProvider({
202
- * executor: remoteExecutor // No direct API key needed
203
- * });
204
- * ```
205
- */
206
- executor?: IExecutor;
207
- /**
208
- * Logger instance for internal OpenAI provider logging
209
- * @defaultValue SilentLogger
210
- */
211
- logger?: ILogger;
30
+ /**
31
+ * Additional provider-specific options
32
+ */
33
+ [key: string]: TOpenAIProviderOptionValue;
34
+ /**
35
+ * OpenAI API key (required when client is not provided)
36
+ */
37
+ apiKey?: string;
38
+ /**
39
+ * OpenAI organization ID (optional)
40
+ */
41
+ organization?: string;
42
+ /**
43
+ * API request timeout (milliseconds)
44
+ */
45
+ timeout?: number;
46
+ /**
47
+ * Whether to request token usage on streaming turns via
48
+ * `stream_options: { include_usage: true }` (default `true`). Set `false` for
49
+ * OpenAI-compatible endpoints that reject `stream_options`; usage is then absent
50
+ * on streaming turns for this provider.
51
+ */
52
+ includeStreamUsage?: boolean;
53
+ /**
54
+ * API base URL (default: `'https://api.openai.com/v1'`).
55
+ *
56
+ * Point this at ANY OpenAI-compatible endpoint — this provider is a protocol
57
+ * client, not an OpenAI-vendor lock:
58
+ *
59
+ * - AI gateways: Vercel AI Gateway, LiteLLM, OpenRouter, …
60
+ * - Hosted compatibles: Azure OpenAI, Groq, Together, …
61
+ * - Local/self-hosted: vLLM, Ollama, LM Studio, …
62
+ *
63
+ * Setting `baseURL` switches the default {@link apiSurface} to
64
+ * `'chat-completions'` for broad endpoint compatibility (official OpenAI calls
65
+ * default to the Responses API). Model slugs are passed through verbatim, so
66
+ * gateway-namespaced ids like `anthropic/claude-sonnet-4-5` or
67
+ * `meta-llama/llama-3.1-70b` work as `defaultModel`/`model` values — streaming
68
+ * and tool calling ride the same chat-completions protocol.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * // Vercel AI Gateway with a non-OpenAI model slug
73
+ * createOpenAIProvider({
74
+ * apiKey: process.env.AI_GATEWAY_API_KEY,
75
+ * baseURL: 'https://ai-gateway.vercel.sh/v1',
76
+ * defaultModel: 'anthropic/claude-sonnet-4-5',
77
+ * });
78
+ * ```
79
+ */
80
+ baseURL?: string;
81
+ /**
82
+ * Default model used when chat options do not provide a model.
83
+ */
84
+ defaultModel?: string;
85
+ /**
86
+ * API surface to use for direct OpenAI calls.
87
+ *
88
+ * Defaults to Responses for official OpenAI calls. Profiles with baseURL use
89
+ * Chat Completions by default for OpenAI-compatible endpoint compatibility.
90
+ */
91
+ apiSurface?: TOpenAIApiSurface;
92
+ /**
93
+ * Response format (default: 'text')
94
+ * - 'text': Plain text response
95
+ * - 'json_object': JSON object mode (requires system message)
96
+ * - 'json_schema': Structured Outputs with schema validation
97
+ */
98
+ responseFormat?: 'text' | 'json_object' | 'json_schema';
99
+ /**
100
+ * JSON schema for structured outputs (required when responseFormat is 'json_schema')
101
+ */
102
+ jsonSchema?: IOpenAIJsonSchemaDefinition;
103
+ /**
104
+ * Responses API reasoning controls. Hidden reasoning is never exposed in message
105
+ * content; only explicit summaries/encrypted items requested here are represented.
106
+ */
107
+ reasoning?: IOpenAIResponsesReasoningOptions;
108
+ /**
109
+ * Whether OpenAI should store Responses API results. Defaults to OpenAI API behavior.
110
+ */
111
+ store?: boolean;
112
+ /**
113
+ * Include encrypted reasoning items for stateless reasoning continuation.
114
+ */
115
+ includeEncryptedReasoning?: boolean;
116
+ /**
117
+ * Opt into strict custom function parameter validation where supported.
118
+ *
119
+ * PROV-007: the tool schema is rewritten for strict mode on the way out — every object node,
120
+ * nested ones included, is closed and given a complete `required` list. That transformation is
121
+ * lossy, so it runs ONLY when this flag is on; with it off the schema is forwarded exactly as
122
+ * authored.
123
+ *
124
+ * What "lossy" means for a caller: strict mode has no way to say "optional", so a field the
125
+ * schema marked optional becomes required and gains a `null` branch. The model must then supply
126
+ * the key explicitly, with `null` standing for "not provided". A tool whose handler distinguishes
127
+ * an absent key from a null value will see the difference.
128
+ */
129
+ strictTools?: boolean;
130
+ /**
131
+ * Provider-native hosted web tool request from provider profile options.
132
+ *
133
+ * OpenAI-compatible Chat Completions endpoints do not support this Robota
134
+ * native web contract. The provider rejects unsupported configurations before
135
+ * any model request is sent.
136
+ */
137
+ nativeWebTools?: IOpenAINativeWebToolsOptions;
138
+ /**
139
+ * OpenAI client instance (optional: will be created from apiKey if not provided)
140
+ */
141
+ client?: OpenAI;
142
+ /**
143
+ * Payload logger instance for debugging API requests/responses
144
+ *
145
+ * Use different implementations based on your environment:
146
+ * - FilePayloadLogger: Node.js file-based logging
147
+ * - ConsolePayloadLogger: Browser console-based logging
148
+ * - Custom: Implement IPayloadLogger interface
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * // Node.js
153
+ * import { FilePayloadLogger } from '@robota-sdk/agent-provider-openai/loggers';
154
+ * const provider = new OpenAIProvider({
155
+ * client: openaiClient,
156
+ * payloadLogger: new FilePayloadLogger({ logDir: './logs/openai' })
157
+ * });
158
+ *
159
+ * // Browser
160
+ * import { ConsolePayloadLogger } from '@robota-sdk/agent-provider-openai/loggers';
161
+ * const provider = new OpenAIProvider({
162
+ * client: openaiClient,
163
+ * payloadLogger: new ConsolePayloadLogger()
164
+ * });
165
+ * ```
166
+ */
167
+ payloadLogger?: IPayloadLogger;
168
+ /**
169
+ * Optional executor for handling AI requests
170
+ *
171
+ * When provided, the provider will delegate all chat operations to this executor
172
+ * instead of making direct API calls. This enables remote execution capabilities.
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * import { LocalExecutor, RemoteExecutor } from '@robota-sdk/agent-core';
177
+ *
178
+ * // Local execution (registers this provider)
179
+ * const localExecutor = new LocalExecutor();
180
+ * localExecutor.registerProvider('openai', new OpenAIProvider({ apiKey: 'sk-...' }));
181
+ *
182
+ * // Remote execution
183
+ * const remoteExecutor = new RemoteExecutor({
184
+ * serverUrl: 'https://api.robota.io',
185
+ * userApiKey: 'user-token-123'
186
+ * });
187
+ *
188
+ * const provider = new OpenAIProvider({
189
+ * executor: remoteExecutor // No direct API key needed
190
+ * });
191
+ * ```
192
+ */
193
+ executor?: IExecutor;
194
+ /**
195
+ * Logger instance for internal OpenAI provider logging
196
+ * @defaultValue SilentLogger
197
+ */
198
+ logger?: ILogger;
212
199
  }
213
-
200
+ //#endregion
201
+ //#region src/openai/provider.d.ts
214
202
  /**
215
203
  * OpenAI provider implementation for Robota
216
204
  *
@@ -220,30 +208,66 @@ interface IOpenAIProviderOptions {
220
208
  * @public
221
209
  */
222
210
  declare class OpenAIProvider extends AbstractAIProvider {
223
- readonly name = "openai";
224
- readonly version = "1.0.0";
225
- private readonly client?;
226
- private readonly options;
227
- private readonly apiSurface;
228
- private readonly payloadLogger;
229
- private readonly responseParser;
230
- /**
231
- * Optional callback for text deltas during streaming.
232
- * Set by the consumer (e.g., Session) to receive real-time text chunks.
233
- * When set, chat() uses streaming internally while still returning
234
- * the complete assembled message.
235
- */
236
- onTextDelta?: TTextDeltaCallback;
237
- constructor(options: IOpenAIProviderOptions);
238
- chat(messages: TUniversalMessage[], options?: IChatOptions): Promise<TUniversalMessage>;
239
- chatStream(messages: TUniversalMessage[], options?: IChatOptions): AsyncIterable<TUniversalMessage>;
240
- supportsTools(): boolean;
241
- getCapabilities(): IProviderCapabilities;
242
- validateConfig(): boolean;
243
- dispose(): Promise<void>;
244
- protected validateMessages(messages: TUniversalMessage[]): void;
211
+ readonly name = "openai";
212
+ readonly version = "1.0.0";
213
+ private readonly client?;
214
+ private readonly options;
215
+ private readonly apiSurface;
216
+ private readonly payloadLogger;
217
+ private readonly responseParser;
218
+ /**
219
+ * Optional callback for text deltas during streaming.
220
+ * Set by the consumer (e.g., Session) to receive real-time text chunks.
221
+ * When set, chat() uses streaming internally while still returning
222
+ * the complete assembled message.
223
+ */
224
+ onTextDelta?: TTextDeltaCallback;
225
+ constructor(options: IOpenAIProviderOptions);
226
+ chat(messages: TUniversalMessage[], options?: IChatOptions): Promise<TUniversalMessage>;
227
+ chatStream(messages: TUniversalMessage[], options?: IChatOptions): AsyncIterable<TUniversalMessage>;
228
+ private streamDirect;
229
+ /**
230
+ * CORE-043: this provider declares no capability table — nobody has verified one for OpenAI, and
231
+ * inventing one would be a fabricated claim. It can still answer THIS question honestly, which is
232
+ * why the endpoint signal is not a field on the table.
233
+ *
234
+ * It matters most here of all the providers: setting `baseURL` also switches the API surface to
235
+ * `chat-completions` (see `resolveApiSurface`), so the advertised gateway configuration is exactly
236
+ * the one where a structured request is least likely to be enforced by whatever is on the far end.
237
+ */
238
+ endpointIsVendorDefault(): boolean;
239
+ /**
240
+ * The client's own base URL is the origin every request goes to (the SDK has already applied a
241
+ * constructor option or `OPENAI_BASE_URL`). An executor sends elsewhere, and an injected client
242
+ * whose base URL cannot be read gives no origin to compare, so neither can propagate.
243
+ */
244
+ canPropagateTraceContext(): boolean;
245
+ private effectiveBaseUrl;
246
+ private traceRequestHeaders;
247
+ effortTable(): IProviderModelEffortTable | undefined;
248
+ private resolveEffortOptions;
249
+ /**
250
+ * MCP-005: strict mode's supported subset is documented; non-strict accepts standard JSON Schema.
251
+ * Both the Responses and Chat Completions surfaces honor `strictTools` identically (§ Profiles).
252
+ */
253
+ protected projectionProfile(): IToolSchemaProjectionProfile | undefined;
254
+ /**
255
+ * Project `chatOptions.tools` through `projectionProfile()` before either request-building module
256
+ * (`responses-chat.ts`, `chat-completions-chat.ts`) sees them — the module helpers receive the
257
+ * projected array as a parameter; `options.tools` itself is never mutated. An empty projected array
258
+ * (every tool quarantined) becomes `undefined` so the downstream `tools &&` truthiness checks treat
259
+ * it the same as "no tools", not as a zero-length `tools: []` request field.
260
+ */
261
+ private projectChatOptions;
262
+ private publishModelEffortOutcome;
263
+ supportsTools(): boolean;
264
+ getCapabilities(): IProviderCapabilities;
265
+ validateConfig(): boolean;
266
+ dispose(): Promise<void>;
267
+ protected validateMessages(messages: TUniversalMessage[]): void;
245
268
  }
246
-
269
+ //#endregion
270
+ //#region src/openai/adapter.d.ts
247
271
  /**
248
272
  * OpenAI Conversation Adapter
249
273
  *
@@ -253,55 +277,35 @@ declare class OpenAIProvider extends AbstractAIProvider {
253
277
  * @public
254
278
  */
255
279
  declare class OpenAIConversationAdapter {
256
- /**
257
- * Filter messages for OpenAI compatibility
258
- *
259
- * OpenAI has specific requirements:
260
- * - Tool messages must have valid toolCallId
261
- * - Messages must be in proper sequence
262
- * - Tool messages without toolCallId should be excluded
263
- */
264
- static filterMessagesForOpenAI(messages: TUniversalMessage[]): TUniversalMessage[];
265
- /**
266
- * Convert TUniversalMessage array to OpenAI message format
267
- * Now properly handles tool messages for OpenAI's tool calling feature
268
- */
269
- static toOpenAIFormat(messages: TUniversalMessage[]): OpenAI.Chat.ChatCompletionMessageParam[];
270
- /**
271
- * Convert a single TUniversalMessage to OpenAI format
272
- * Handles all message types including tool messages
273
- */
274
- static convertMessage(msg: TUniversalMessage): OpenAI.Chat.ChatCompletionMessageParam;
275
- /**
276
- * Add system prompt to message array if needed
277
- */
278
- static addSystemPromptIfNeeded(messages: OpenAI.Chat.ChatCompletionMessageParam[], systemPrompt?: string): OpenAI.Chat.ChatCompletionMessageParam[];
279
- }
280
-
281
- interface IOpenAIModelCatalogResponse {
282
- data?: readonly IOpenAIModelCatalogResource[];
283
- }
284
- interface IOpenAIModelCatalogResource {
285
- id?: string;
286
- }
287
- interface IOpenAIModelCatalogFetchInit {
288
- headers: Record<string, string>;
289
- }
290
- interface IOpenAIModelCatalogFetchResponse {
291
- ok: boolean;
292
- status: number;
293
- statusText?: string;
294
- json: () => Promise<IOpenAIModelCatalogResponse>;
295
- }
296
- type TOpenAIModelCatalogFetch = (url: string, init: IOpenAIModelCatalogFetchInit) => Promise<IOpenAIModelCatalogFetchResponse>;
297
- interface IRefreshOpenAIModelCatalogOptions {
298
- fetcher?: TOpenAIModelCatalogFetch;
299
- now?: () => Date;
280
+ /**
281
+ * Filter messages for OpenAI compatibility
282
+ *
283
+ * OpenAI has specific requirements:
284
+ * - Tool messages must have valid toolCallId
285
+ * - Messages must be in proper sequence
286
+ * - Tool messages without toolCallId should be excluded
287
+ */
288
+ static filterMessagesForOpenAI(messages: TUniversalMessage[]): TUniversalMessage[];
289
+ /**
290
+ * Convert TUniversalMessage array to OpenAI message format
291
+ * Now properly handles tool messages for OpenAI's tool calling feature
292
+ */
293
+ static toOpenAIFormat(messages: TUniversalMessage[]): OpenAI.Chat.ChatCompletionMessageParam[];
294
+ /**
295
+ * Convert a single TUniversalMessage to OpenAI format
296
+ * Handles all message types including tool messages
297
+ */
298
+ static convertMessage(msg: TUniversalMessage): OpenAI.Chat.ChatCompletionMessageParam;
299
+ /**
300
+ * Add system prompt to message array if needed
301
+ */
302
+ static addSystemPromptIfNeeded(messages: OpenAI.Chat.ChatCompletionMessageParam[], systemPrompt?: string): OpenAI.Chat.ChatCompletionMessageParam[];
300
303
  }
301
- declare function refreshOpenAIModelCatalog(profile: IProviderProfileConfig, options?: IRefreshOpenAIModelCatalogOptions): Promise<IProviderModelCatalog>;
302
-
304
+ //#endregion
305
+ //#region src/openai/provider-definition.d.ts
303
306
  declare const DEFAULT_OPENAI_PROVIDER_MODEL: string | undefined;
304
307
  declare const DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE = "$ENV:OPENAI_API_KEY";
305
308
  declare function createOpenAIProviderDefinition(): IProviderDefinition;
306
-
307
- export { DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE, DEFAULT_OPENAI_PROVIDER_MODEL, type IOpenAIJsonSchemaDefinition, type IOpenAIModelCatalogFetchInit, type IOpenAIModelCatalogFetchResponse, type IOpenAIModelCatalogResource, type IOpenAIModelCatalogResponse, type IOpenAINativeWebToolsOptions, type IOpenAIProviderOptions, type IOpenAIResponsesReasoningOptions, type IPayloadLogger, type IPayloadLoggerOptions, type IRefreshOpenAIModelCatalogOptions, OpenAIConversationAdapter, OpenAIProvider, type TOpenAIApiSurface, type TOpenAIModelCatalogFetch, type TOpenAIProviderOptionValue, createOpenAIProviderDefinition, refreshOpenAIModelCatalog };
309
+ //#endregion
310
+ export { DEFAULT_OPENAI_PROVIDER_API_KEY_REFERENCE, DEFAULT_OPENAI_PROVIDER_MODEL, IOpenAIJsonSchemaDefinition, IOpenAINativeWebToolsOptions, IOpenAIProviderOptions, IOpenAIResponsesReasoningOptions, type IPayloadLogger, type IPayloadLoggerOptions, OpenAIConversationAdapter, OpenAIProvider, TOpenAIApiSurface, TOpenAIProviderOptionValue, createOpenAIProviderDefinition };
311
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +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;;;;GAId,cAAc;;;;EAKf;;;;EAKA;;;;EAKA;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA;;;;EAKA;;;;;;;EAQA,aAAa;;;;;;;EAQb;;;;EAKA,aAAa;;;;;EAMb,YAAY;;;;EAKZ;;;;EAKA;;;;;;;;;;;;;;EAeA;;;;;;;;EASA,iBAAiB;;;;EAKjB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BT,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BhB,WAAW;;;;;EAMX,SAAS;;;;;;;;;;;;cCrME,uBAAuB;WAChB;WACA;mBAED;mBACA;mBACA;mBACA;mBACA;;;;;;;EAQjB,cAAc;EAEF,YAAA,SAAS;EA6BN,KACb,UAAU,qBACV,UAAU,eACT,QAAQ;EAgDK,WACd,UAAU,qBACV,UAAU,eACT,cAAc;UAiCF;;;;;;;;;;EAuCf;;;;;;EASA;UAIQ;UAKA;EAKC,eAAe;UAMhB;;;;;YAcW,qBAAqB;;;;;;;;UAahC;UAYA;EAiCC;EAIA,mBAAmB;EAwBnB;EAIM,WAAW;YAIP,iBAAiB,UAAU;;;;;;;;;;;;cC/UnC;;;;;;;;;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;;;;cC1HJ;cACA;iBAeG,kCAAkC"}