@namzu/openai 1.3.0 → 1.5.0
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 +176 -0
- package/README.md +36 -7
- package/dist/client.d.ts +13 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +100 -8
- package/dist/client.js.map +1 -1
- package/dist/codex.d.ts +21 -0
- package/dist/codex.d.ts.map +1 -0
- package/dist/codex.js +414 -0
- package/dist/codex.js.map +1 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/client.ts +126 -23
- package/src/codex.ts +490 -0
- package/src/index.ts +23 -2
- package/src/types.ts +17 -0
package/dist/codex.js
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { ProviderRequestError, attributionHeaders, isCallerAbortError, isProviderRequestError, providerVendorError, toolResultToText, } from '@namzu/sdk';
|
|
2
|
+
import OpenAI from 'openai';
|
|
3
|
+
import { openAIReasoningEffortLevels } from './client.js';
|
|
4
|
+
export const CODEX_CAPABILITIES = {
|
|
5
|
+
supportsTools: true,
|
|
6
|
+
supportsStreaming: true,
|
|
7
|
+
supportsFunctionCalling: true,
|
|
8
|
+
supportsVision: false,
|
|
9
|
+
supportsDocuments: false,
|
|
10
|
+
};
|
|
11
|
+
const DEFAULT_CODEX_BASE_URL = 'https://chatgpt.com/backend-api/codex';
|
|
12
|
+
function sameRoute(left, right) {
|
|
13
|
+
return (left.providerId === right.providerId &&
|
|
14
|
+
left.model === right.model &&
|
|
15
|
+
left.chainIndex === right.chainIndex);
|
|
16
|
+
}
|
|
17
|
+
function record(value) {
|
|
18
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
19
|
+
? value
|
|
20
|
+
: null;
|
|
21
|
+
}
|
|
22
|
+
function isRoute(value) {
|
|
23
|
+
const route = record(value);
|
|
24
|
+
return (typeof route?.providerId === 'string' &&
|
|
25
|
+
typeof route.model === 'string' &&
|
|
26
|
+
Number.isInteger(route.chainIndex) &&
|
|
27
|
+
route.chainIndex >= 0);
|
|
28
|
+
}
|
|
29
|
+
function durableToolCalls(message) {
|
|
30
|
+
return (message.toolCalls ?? []).map((call) => ({
|
|
31
|
+
id: call.id,
|
|
32
|
+
name: call.function.name,
|
|
33
|
+
arguments: call.function.arguments,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
function isCodexReplayState(value) {
|
|
37
|
+
const state = record(value);
|
|
38
|
+
if (state?.kind !== 'namzu.codex.responses' ||
|
|
39
|
+
state.version !== 1 ||
|
|
40
|
+
!isRoute(state.route) ||
|
|
41
|
+
(state.content !== null && typeof state.content !== 'string') ||
|
|
42
|
+
!Array.isArray(state.toolCalls) ||
|
|
43
|
+
!Array.isArray(state.items)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return state.toolCalls.every((item) => {
|
|
47
|
+
const call = record(item);
|
|
48
|
+
return (typeof call?.id === 'string' &&
|
|
49
|
+
typeof call.name === 'string' &&
|
|
50
|
+
typeof call.arguments === 'string');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function replayItems(message, targetRoute) {
|
|
54
|
+
const source = message.source;
|
|
55
|
+
if (!source || source.type !== 'model' || !sameRoute(source, targetRoute))
|
|
56
|
+
return null;
|
|
57
|
+
const state = source.replayState;
|
|
58
|
+
if (!isCodexReplayState(state) || !sameRoute(state.route, source))
|
|
59
|
+
return null;
|
|
60
|
+
if (state.content !== message.content)
|
|
61
|
+
return null;
|
|
62
|
+
if (JSON.stringify(state.toolCalls) !== JSON.stringify(durableToolCalls(message)))
|
|
63
|
+
return null;
|
|
64
|
+
return state.items;
|
|
65
|
+
}
|
|
66
|
+
export function toCodexInput(messages, targetRoute) {
|
|
67
|
+
const input = [];
|
|
68
|
+
for (const message of messages) {
|
|
69
|
+
if (message.role === 'system')
|
|
70
|
+
continue;
|
|
71
|
+
if (message.role === 'user') {
|
|
72
|
+
if (message.attachments && message.attachments.length > 0) {
|
|
73
|
+
throw new Error('CodexProvider: this transport does not yet admit image or document attachments. Remove the attachment or select a provider whose declared capabilities include it.');
|
|
74
|
+
}
|
|
75
|
+
input.push({ type: 'message', role: 'user', content: message.content });
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (message.role === 'tool') {
|
|
79
|
+
input.push({
|
|
80
|
+
type: 'function_call_output',
|
|
81
|
+
call_id: message.toolCallId,
|
|
82
|
+
output: toolResultToText(message.content),
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const replayed = replayItems(message, targetRoute);
|
|
87
|
+
if (replayed) {
|
|
88
|
+
input.push(...replayed);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (message.content) {
|
|
92
|
+
input.push({
|
|
93
|
+
type: 'message',
|
|
94
|
+
role: 'assistant',
|
|
95
|
+
content: message.content,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
for (const call of message.toolCalls ?? []) {
|
|
99
|
+
input.push({
|
|
100
|
+
type: 'function_call',
|
|
101
|
+
call_id: call.id,
|
|
102
|
+
name: call.function.name,
|
|
103
|
+
arguments: call.function.arguments,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return input;
|
|
108
|
+
}
|
|
109
|
+
export function toCodexTools(params) {
|
|
110
|
+
if (!params.tools || params.tools.length === 0)
|
|
111
|
+
return undefined;
|
|
112
|
+
return params.tools.map((tool) => ({
|
|
113
|
+
type: 'function',
|
|
114
|
+
name: tool.function.name,
|
|
115
|
+
description: tool.function.description ?? '',
|
|
116
|
+
parameters: tool.function.parameters ?? {},
|
|
117
|
+
// The ChatGPT Codex backend validates `strict: true` against a narrower
|
|
118
|
+
// Responses schema than the Chat Completions endpoint. In particular,
|
|
119
|
+
// every composition branch needs an explicit type and every object
|
|
120
|
+
// property must also be required. Namzu model schemas deliberately keep
|
|
121
|
+
// conditional edit shapes optional and validate the selected shape at
|
|
122
|
+
// execution, so claiming strictness rejects the whole request before the
|
|
123
|
+
// model can answer. The Codex client uses the same boundary for its own
|
|
124
|
+
// tools: Responses function tools are sent with `strict: false` and tool
|
|
125
|
+
// inputs are validated by the runtime. `enforceToolInputSchema` remains a
|
|
126
|
+
// provider hint; this transport cannot truthfully consume it for Namzu's
|
|
127
|
+
// general tool-schema contract.
|
|
128
|
+
strict: false,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
function responseUsage(usage) {
|
|
132
|
+
const promptTokens = usage.input_tokens ?? 0;
|
|
133
|
+
const completionTokens = usage.output_tokens ?? 0;
|
|
134
|
+
return {
|
|
135
|
+
promptTokens,
|
|
136
|
+
completionTokens,
|
|
137
|
+
totalTokens: usage.total_tokens ?? promptTokens + completionTokens,
|
|
138
|
+
cachedTokens: usage.input_tokens_details?.cached_tokens ?? 0,
|
|
139
|
+
cacheWriteTokens: 0,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function buildRequest(params, model, targetRoute) {
|
|
143
|
+
const supportedEffort = openAIReasoningEffortLevels(model);
|
|
144
|
+
if (params.effort !== undefined &&
|
|
145
|
+
supportedEffort !== undefined &&
|
|
146
|
+
!supportedEffort.includes(params.effort)) {
|
|
147
|
+
throw new Error(`CodexProvider: effort "${params.effort}" is not supported by model "${model}". Supported levels: ${supportedEffort.join(', ')}. Choose one of those levels or omit \`effort\`.`);
|
|
148
|
+
}
|
|
149
|
+
if (params.thinking?.type === 'enabled') {
|
|
150
|
+
throw new Error('CodexProvider: manual thinking budgets are not a Responses API capability. Use adaptive thinking or omit `thinking`.');
|
|
151
|
+
}
|
|
152
|
+
if (params.thinking?.type === 'disabled' && params.effort !== 'none') {
|
|
153
|
+
throw new Error('CodexProvider: disabling reasoning requires `effort: "none"`; omitting that level would not prove reasoning was disabled.');
|
|
154
|
+
}
|
|
155
|
+
const instructions = params.messages
|
|
156
|
+
.filter((message) => message.role === 'system')
|
|
157
|
+
.map((message) => message.content)
|
|
158
|
+
.join('\n\n');
|
|
159
|
+
const request = {
|
|
160
|
+
model,
|
|
161
|
+
stream: true,
|
|
162
|
+
store: false,
|
|
163
|
+
instructions: instructions || undefined,
|
|
164
|
+
input: toCodexInput(params.messages, targetRoute),
|
|
165
|
+
// The Codex subscription request schema deliberately has no
|
|
166
|
+
// `max_output_tokens` member. `ChatCompletionParams.maxTokens` is a public
|
|
167
|
+
// API control, but projecting it onto this route makes the whole request
|
|
168
|
+
// invalid; the backend owns the output budget here.
|
|
169
|
+
// The subscription Responses backend expects these three fields even for a
|
|
170
|
+
// turn that exposes no tools. The ordinary public Responses endpoint admits
|
|
171
|
+
// their omission, which is why the generated client types all make them
|
|
172
|
+
// optional; the Codex wire does not have the same defaulting contract.
|
|
173
|
+
tools: toCodexTools(params) ?? [],
|
|
174
|
+
tool_choice: (params.toolChoice ?? 'auto'),
|
|
175
|
+
parallel_tool_calls: params.parallelToolCalls ?? true,
|
|
176
|
+
include: ['reasoning.encrypted_content'],
|
|
177
|
+
...(params.effort !== undefined
|
|
178
|
+
? { reasoning: { effort: params.effort, summary: 'auto' } }
|
|
179
|
+
: params.thinking?.type === 'adaptive'
|
|
180
|
+
? { reasoning: { summary: 'auto' } }
|
|
181
|
+
: {}),
|
|
182
|
+
};
|
|
183
|
+
// The installed client declaration predates the current GPT-5.6 `max`
|
|
184
|
+
// vocabulary. The model-specific admission check above is the runtime
|
|
185
|
+
// boundary; this cast only bridges that vendor declaration lag.
|
|
186
|
+
return request;
|
|
187
|
+
}
|
|
188
|
+
export class CodexProvider {
|
|
189
|
+
id = 'codex';
|
|
190
|
+
name = 'OpenAI Codex';
|
|
191
|
+
capabilities = CODEX_CAPABILITIES;
|
|
192
|
+
client;
|
|
193
|
+
defaultModel;
|
|
194
|
+
constructor(config) {
|
|
195
|
+
if (!config.accessToken)
|
|
196
|
+
throw new Error('Codex access token is required.');
|
|
197
|
+
if (!config.accountId)
|
|
198
|
+
throw new Error('Codex ChatGPT account id is required.');
|
|
199
|
+
this.client = new OpenAI({
|
|
200
|
+
apiKey: config.accessToken,
|
|
201
|
+
baseURL: config.baseURL ?? DEFAULT_CODEX_BASE_URL,
|
|
202
|
+
timeout: config.timeout,
|
|
203
|
+
defaultHeaders: {
|
|
204
|
+
...attributionHeaders(),
|
|
205
|
+
'ChatGPT-Account-Id': config.accountId,
|
|
206
|
+
originator: 'Codex Namzu',
|
|
207
|
+
'User-Agent': 'Codex Namzu/1.0',
|
|
208
|
+
...(config.defaultHeaders ?? {}),
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
this.defaultModel = config.model;
|
|
212
|
+
}
|
|
213
|
+
resolveModel(params) {
|
|
214
|
+
const model = params.model || this.defaultModel;
|
|
215
|
+
if (!model)
|
|
216
|
+
throw new Error('CodexProvider: model is required.');
|
|
217
|
+
return model;
|
|
218
|
+
}
|
|
219
|
+
reasoningEffortLevelsFor(model) {
|
|
220
|
+
return openAIReasoningEffortLevels(model);
|
|
221
|
+
}
|
|
222
|
+
async *chatStream(params) {
|
|
223
|
+
const model = this.resolveModel(params);
|
|
224
|
+
const targetRoute = params.providerRoute ?? {
|
|
225
|
+
providerId: this.id,
|
|
226
|
+
model,
|
|
227
|
+
chainIndex: 0,
|
|
228
|
+
};
|
|
229
|
+
const request = buildRequest(params, model, targetRoute);
|
|
230
|
+
let stream;
|
|
231
|
+
try {
|
|
232
|
+
stream = (await this.client.responses.create(request, {
|
|
233
|
+
signal: params.signal,
|
|
234
|
+
}));
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
if (isCallerAbortError(error, params.signal))
|
|
238
|
+
throw params.signal?.reason ?? error;
|
|
239
|
+
if (isProviderRequestError(error))
|
|
240
|
+
throw error;
|
|
241
|
+
throw providerVendorError({ providerId: this.id, error });
|
|
242
|
+
}
|
|
243
|
+
const callIndex = new Map();
|
|
244
|
+
let nextCallIndex = 0;
|
|
245
|
+
let responseId = 'codex-response';
|
|
246
|
+
try {
|
|
247
|
+
for await (const event of stream) {
|
|
248
|
+
params.signal?.throwIfAborted();
|
|
249
|
+
switch (event.type) {
|
|
250
|
+
case 'response.created':
|
|
251
|
+
responseId = event.response.id;
|
|
252
|
+
break;
|
|
253
|
+
case 'response.output_text.delta':
|
|
254
|
+
yield { id: responseId, delta: { content: event.delta } };
|
|
255
|
+
break;
|
|
256
|
+
case 'response.reasoning_summary_text.delta':
|
|
257
|
+
yield {
|
|
258
|
+
id: responseId,
|
|
259
|
+
delta: {
|
|
260
|
+
reasoning: {
|
|
261
|
+
index: event.output_index,
|
|
262
|
+
type: 'thinking',
|
|
263
|
+
text: event.delta,
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
break;
|
|
268
|
+
case 'response.reasoning_summary_text.done':
|
|
269
|
+
yield {
|
|
270
|
+
id: responseId,
|
|
271
|
+
delta: {
|
|
272
|
+
reasoning: {
|
|
273
|
+
index: event.output_index,
|
|
274
|
+
type: 'thinking',
|
|
275
|
+
done: true,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
break;
|
|
280
|
+
case 'response.output_item.added':
|
|
281
|
+
if (event.item.type === 'function_call') {
|
|
282
|
+
const index = nextCallIndex++;
|
|
283
|
+
callIndex.set(event.item.id ?? event.item.call_id, index);
|
|
284
|
+
callIndex.set(event.item.call_id, index);
|
|
285
|
+
yield {
|
|
286
|
+
id: responseId,
|
|
287
|
+
delta: {
|
|
288
|
+
toolCalls: [
|
|
289
|
+
{
|
|
290
|
+
index,
|
|
291
|
+
id: event.item.call_id,
|
|
292
|
+
type: 'function',
|
|
293
|
+
function: {
|
|
294
|
+
name: event.item.name,
|
|
295
|
+
arguments: event.item.arguments,
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
case 'response.function_call_arguments.delta': {
|
|
304
|
+
const index = callIndex.get(event.item_id) ?? event.output_index;
|
|
305
|
+
yield {
|
|
306
|
+
id: responseId,
|
|
307
|
+
delta: {
|
|
308
|
+
toolCalls: [{ index, function: { arguments: event.delta } }],
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case 'response.output_item.done':
|
|
314
|
+
if (event.item.type === 'function_call') {
|
|
315
|
+
yield {
|
|
316
|
+
id: responseId,
|
|
317
|
+
delta: {
|
|
318
|
+
toolCallEnd: {
|
|
319
|
+
index: callIndex.get(event.item.id ?? event.item.call_id) ?? event.output_index,
|
|
320
|
+
id: event.item.call_id,
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case 'response.completed': {
|
|
327
|
+
const calls = event.response.output
|
|
328
|
+
.filter((item) => item.type === 'function_call')
|
|
329
|
+
.map((item) => ({
|
|
330
|
+
id: item.call_id,
|
|
331
|
+
name: item.name,
|
|
332
|
+
arguments: item.arguments,
|
|
333
|
+
}));
|
|
334
|
+
const content = event.response.output
|
|
335
|
+
.filter((item) => item.type === 'message')
|
|
336
|
+
.flatMap((item) => item.content)
|
|
337
|
+
.filter((item) => item.type === 'output_text')
|
|
338
|
+
.map((item) => item.text)
|
|
339
|
+
.join('');
|
|
340
|
+
const replayState = {
|
|
341
|
+
kind: 'namzu.codex.responses',
|
|
342
|
+
version: 1,
|
|
343
|
+
route: targetRoute,
|
|
344
|
+
content: content || null,
|
|
345
|
+
toolCalls: calls,
|
|
346
|
+
items: event.response.output,
|
|
347
|
+
};
|
|
348
|
+
yield {
|
|
349
|
+
id: event.response.id,
|
|
350
|
+
delta: {},
|
|
351
|
+
finishReason: calls.length > 0 ? 'tool_calls' : 'stop',
|
|
352
|
+
usage: responseUsage(event.response.usage ?? {}),
|
|
353
|
+
replayState,
|
|
354
|
+
};
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
case 'error':
|
|
358
|
+
case 'response.failed':
|
|
359
|
+
throw new ProviderRequestError({
|
|
360
|
+
kind: 'server',
|
|
361
|
+
providerId: this.id,
|
|
362
|
+
detail: 'the Codex Responses stream failed',
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (error) {
|
|
368
|
+
if (isCallerAbortError(error, params.signal))
|
|
369
|
+
throw params.signal?.reason ?? error;
|
|
370
|
+
if (isProviderRequestError(error))
|
|
371
|
+
throw error;
|
|
372
|
+
throw providerVendorError({ providerId: this.id, error });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async listModels(signal) {
|
|
376
|
+
signal?.throwIfAborted();
|
|
377
|
+
const response = (await this.client.get('/models?client_version=1.0.0', {
|
|
378
|
+
signal,
|
|
379
|
+
}));
|
|
380
|
+
signal?.throwIfAborted();
|
|
381
|
+
if (!Array.isArray(response.models))
|
|
382
|
+
return [];
|
|
383
|
+
return response.models.flatMap((value) => {
|
|
384
|
+
const item = record(value);
|
|
385
|
+
if (typeof item?.slug !== 'string' || item.slug.length === 0)
|
|
386
|
+
return [];
|
|
387
|
+
if (item.visibility === 'hide' || item.visibility === 'hidden')
|
|
388
|
+
return [];
|
|
389
|
+
return [
|
|
390
|
+
{
|
|
391
|
+
id: item.slug,
|
|
392
|
+
name: typeof item.display_name === 'string' ? item.display_name : item.slug,
|
|
393
|
+
inputPrice: 0,
|
|
394
|
+
outputPrice: 0,
|
|
395
|
+
supportsToolUse: true,
|
|
396
|
+
supportsStreaming: true,
|
|
397
|
+
},
|
|
398
|
+
];
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
async probeCredential(signal) {
|
|
402
|
+
await this.listModels(signal);
|
|
403
|
+
}
|
|
404
|
+
async healthCheck() {
|
|
405
|
+
try {
|
|
406
|
+
await this.probeCredential();
|
|
407
|
+
return true;
|
|
408
|
+
}
|
|
409
|
+
catch {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../src/codex.ts"],"names":[],"mappings":"AAUA,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,GAChB,MAAM,YAAY,CAAA;AACnB,OAAO,MAAM,MAAM,QAAQ,CAAA;AAS3B,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAGzD,MAAM,CAAC,MAAM,kBAAkB,GAAyB;IACvD,aAAa,EAAE,IAAI;IACnB,iBAAiB,EAAE,IAAI;IACvB,uBAAuB,EAAE,IAAI;IAC7B,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,KAAK;CACxB,CAAA;AAED,MAAM,sBAAsB,GAAG,uCAAuC,CAAA;AAetE,SAAS,SAAS,CAAC,IAAmB,EAAE,KAAoB;IAC3D,OAAO,CACN,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;QACpC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK;QAC1B,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CACpC,CAAA;AACF,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAC1E,CAAC,CAAE,KAAiC;QACpC,CAAC,CAAC,IAAI,CAAA;AACR,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC9B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC3B,OAAO,CACN,OAAO,KAAK,EAAE,UAAU,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,K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;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,MAAoB;QACzC,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,WAAW;QAChB,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,eAAe,EAAE,CAAA;YAC5B,OAAO,IAAI,CAAA;QACZ,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,KAAK,CAAA;QACb,CAAC;IACF,CAAC;CACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { type RegisterOptions } from '@namzu/sdk';
|
|
2
2
|
import type { OpenAIProviderConfig } from './types.js';
|
|
3
|
+
import type { CodexProviderConfig } from './types.js';
|
|
3
4
|
declare module '@namzu/sdk' {
|
|
4
5
|
interface ProviderConfigRegistry {
|
|
5
6
|
openai: OpenAIProviderConfig;
|
|
7
|
+
codex: CodexProviderConfig;
|
|
6
8
|
}
|
|
7
9
|
}
|
|
10
|
+
/** Register the ChatGPT subscription-backed Codex Responses transport. */
|
|
11
|
+
export declare function registerCodex(options?: RegisterOptions): void;
|
|
8
12
|
/**
|
|
9
13
|
* Register `OpenAIProvider` under the `'openai'` type in `@namzu/sdk`'s
|
|
10
14
|
* `ProviderRegistry`. Call once at app startup before
|
|
@@ -14,6 +18,7 @@ declare module '@namzu/sdk' {
|
|
|
14
18
|
* Pass `{ replace: true }` to override.
|
|
15
19
|
*/
|
|
16
20
|
export declare function registerOpenAI(options?: RegisterOptions): void;
|
|
17
|
-
export { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js';
|
|
18
|
-
export
|
|
21
|
+
export { OPENAI_CAPABILITIES, OpenAIProvider, openAIReasoningEffortLevels, } from './client.js';
|
|
22
|
+
export { CODEX_CAPABILITIES, CodexProvider, } from './codex.js';
|
|
23
|
+
export type { CodexConfig, CodexProviderConfig, OpenAIConfig, OpenAIProviderConfig, } from './types.js';
|
|
19
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAGnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAIrD,OAAO,QAAQ,YAAY,CAAC;IAC3B,UAAU,sBAAsB;QAC/B,MAAM,EAAE,oBAAoB,CAAA;QAC5B,KAAK,EAAE,mBAAmB,CAAA;KAC1B;CACD;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAE9D;AAED,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,2BAA2B,GAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,kBAAkB,EAClB,aAAa,GACb,MAAM,YAAY,CAAA;AACnB,YAAY,EACX,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,GACpB,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ProviderRegistry } from '@namzu/sdk';
|
|
2
2
|
import { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js';
|
|
3
|
+
import { CODEX_CAPABILITIES, CodexProvider } from './codex.js';
|
|
4
|
+
/** Register the ChatGPT subscription-backed Codex Responses transport. */
|
|
5
|
+
export function registerCodex(options) {
|
|
6
|
+
ProviderRegistry.register('codex', CodexProvider, CODEX_CAPABILITIES, options);
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Register `OpenAIProvider` under the `'openai'` type in `@namzu/sdk`'s
|
|
5
10
|
* `ProviderRegistry`. Call once at app startup before
|
|
@@ -11,5 +16,6 @@ import { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js';
|
|
|
11
16
|
export function registerOpenAI(options) {
|
|
12
17
|
ProviderRegistry.register('openai', OpenAIProvider, OPENAI_CAPABILITIES, options);
|
|
13
18
|
}
|
|
14
|
-
export { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js';
|
|
19
|
+
export { OPENAI_CAPABILITIES, OpenAIProvider, openAIReasoningEffortLevels, } from './client.js';
|
|
20
|
+
export { CODEX_CAPABILITIES, CodexProvider, } from './codex.js';
|
|
15
21
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAwB,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAwB,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAa9D,0EAA0E;AAC1E,MAAM,UAAU,aAAa,CAAC,OAAyB;IACtD,gBAAgB,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAA;AAC/E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACvD,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAA;AAClF,CAAC;AAED,OAAO,EACN,mBAAmB,EACnB,cAAc,EACd,2BAA2B,GAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,kBAAkB,EAClB,aAAa,GACb,MAAM,YAAY,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -24,4 +24,19 @@ export interface OpenAIConfig {
|
|
|
24
24
|
export interface OpenAIProviderConfig extends OpenAIConfig {
|
|
25
25
|
type: 'openai';
|
|
26
26
|
}
|
|
27
|
+
/** ChatGPT subscription transport used by the Codex Responses backend. */
|
|
28
|
+
export interface CodexConfig {
|
|
29
|
+
accessToken: string;
|
|
30
|
+
accountId: string;
|
|
31
|
+
/** Default model. Can be overridden per call. */
|
|
32
|
+
model?: string;
|
|
33
|
+
/** Defaults to the ChatGPT Codex backend. */
|
|
34
|
+
baseURL?: string;
|
|
35
|
+
/** Request timeout in milliseconds. */
|
|
36
|
+
timeout?: number;
|
|
37
|
+
defaultHeaders?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
export interface CodexProviderConfig extends CodexConfig {
|
|
40
|
+
type: 'codex';
|
|
41
|
+
}
|
|
27
42
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACzD,IAAI,EAAE,QAAQ,CAAA;CACd"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACzD,IAAI,EAAE,QAAQ,CAAA;CACd;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD,IAAI,EAAE,OAAO,CAAA;CACb"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/openai",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "OpenAI
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "OpenAI API-key and ChatGPT subscription providers for @namzu/sdk, with streaming and tool use.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.0.0"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@types/node": "^22.19.17",
|
|
58
58
|
"typescript": "^5.5.0",
|
|
59
59
|
"vitest": "^3.2.6",
|
|
60
|
-
"@namzu/sdk": "^
|
|
60
|
+
"@namzu/sdk": "^31.0.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsc --build",
|