@kenkaiiii/gg-ai 4.2.2 → 4.2.4
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/dist/index.cjs +1093 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +235 -0
- package/dist/index.d.ts +235 -5
- package/dist/index.js +1051 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
- package/dist/errors.d.ts +0 -12
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -17
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/providers/anthropic.d.ts +0 -4
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js +0 -207
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/openai-codex.d.ts +0 -4
- package/dist/providers/openai-codex.d.ts.map +0 -1
- package/dist/providers/openai-codex.js +0 -338
- package/dist/providers/openai-codex.js.map +0 -1
- package/dist/providers/openai.d.ts +0 -4
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js +0 -182
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/transform.d.ts +0 -30
- package/dist/providers/transform.d.ts.map +0 -1
- package/dist/providers/transform.js +0 -323
- package/dist/providers/transform.js.map +0 -1
- package/dist/stream.d.ts +0 -19
- package/dist/stream.d.ts.map +0 -1
- package/dist/stream.js +0 -44
- package/dist/stream.js.map +0 -1
- package/dist/types.d.ts +0 -167
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/event-stream.d.ts +0 -38
- package/dist/utils/event-stream.d.ts.map +0 -1
- package/dist/utils/event-stream.js +0 -100
- package/dist/utils/event-stream.js.map +0 -1
- package/dist/utils/zod-to-json-schema.d.ts +0 -7
- package/dist/utils/zod-to-json-schema.d.ts.map +0 -1
- package/dist/utils/zod-to-json-schema.js +0 -12
- package/dist/utils/zod-to-json-schema.js.map +0 -1
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import os from "node:os";
|
|
2
|
-
import { ProviderError } from "../errors.js";
|
|
3
|
-
import { StreamResult } from "../utils/event-stream.js";
|
|
4
|
-
import { zodToJsonSchema } from "../utils/zod-to-json-schema.js";
|
|
5
|
-
const DEFAULT_BASE_URL = "https://chatgpt.com/backend-api";
|
|
6
|
-
export function streamOpenAICodex(options) {
|
|
7
|
-
const result = new StreamResult();
|
|
8
|
-
runStream(options, result).catch((err) => result.abort(toError(err)));
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
async function runStream(options, result) {
|
|
12
|
-
const baseUrl = (options.baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
13
|
-
const url = `${baseUrl}/codex/responses`;
|
|
14
|
-
const { system, input } = toCodexInput(options.messages);
|
|
15
|
-
const body = {
|
|
16
|
-
model: options.model,
|
|
17
|
-
store: false,
|
|
18
|
-
stream: true,
|
|
19
|
-
instructions: system,
|
|
20
|
-
input,
|
|
21
|
-
tool_choice: "auto",
|
|
22
|
-
parallel_tool_calls: true,
|
|
23
|
-
include: ["reasoning.encrypted_content"],
|
|
24
|
-
};
|
|
25
|
-
if (options.tools?.length) {
|
|
26
|
-
body.tools = toCodexTools(options.tools);
|
|
27
|
-
}
|
|
28
|
-
if (options.temperature != null && !options.thinking) {
|
|
29
|
-
body.temperature = options.temperature;
|
|
30
|
-
}
|
|
31
|
-
if (options.thinking) {
|
|
32
|
-
body.reasoning = {
|
|
33
|
-
effort: options.thinking,
|
|
34
|
-
summary: "auto",
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
const headers = {
|
|
38
|
-
"Content-Type": "application/json",
|
|
39
|
-
Accept: "text/event-stream",
|
|
40
|
-
Authorization: `Bearer ${options.apiKey}`,
|
|
41
|
-
"OpenAI-Beta": "responses=experimental",
|
|
42
|
-
originator: "ggcoder",
|
|
43
|
-
"User-Agent": `ggcoder (${os.platform()} ${os.release()}; ${os.arch()})`,
|
|
44
|
-
};
|
|
45
|
-
if (options.accountId) {
|
|
46
|
-
headers["chatgpt-account-id"] = options.accountId;
|
|
47
|
-
}
|
|
48
|
-
const response = await fetch(url, {
|
|
49
|
-
method: "POST",
|
|
50
|
-
headers,
|
|
51
|
-
body: JSON.stringify(body),
|
|
52
|
-
signal: options.signal,
|
|
53
|
-
});
|
|
54
|
-
if (!response.ok) {
|
|
55
|
-
const text = await response.text().catch(() => "");
|
|
56
|
-
let message = `Codex API error (${response.status}): ${text}`;
|
|
57
|
-
// Add helpful context for common errors
|
|
58
|
-
if (response.status === 400 && text.includes("not supported")) {
|
|
59
|
-
message +=
|
|
60
|
-
`\n\nHint: Codex models require a ChatGPT Plus ($20/mo) or Pro ($200/mo) subscription. ` +
|
|
61
|
-
`The "codex-spark" variants require ChatGPT Pro. ` +
|
|
62
|
-
`Ensure your account has an active subscription at https://chatgpt.com/settings`;
|
|
63
|
-
}
|
|
64
|
-
throw new ProviderError("openai", message, {
|
|
65
|
-
statusCode: response.status,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (!response.body) {
|
|
69
|
-
throw new ProviderError("openai", "No response body from Codex API");
|
|
70
|
-
}
|
|
71
|
-
const contentParts = [];
|
|
72
|
-
let textAccum = "";
|
|
73
|
-
const toolCalls = new Map();
|
|
74
|
-
let inputTokens = 0;
|
|
75
|
-
let outputTokens = 0;
|
|
76
|
-
for await (const event of parseSSE(response.body)) {
|
|
77
|
-
const type = event.type;
|
|
78
|
-
if (!type)
|
|
79
|
-
continue;
|
|
80
|
-
if (type === "error") {
|
|
81
|
-
const msg = event.message || JSON.stringify(event);
|
|
82
|
-
throw new ProviderError("openai", `Codex error: ${msg}`);
|
|
83
|
-
}
|
|
84
|
-
if (type === "response.failed") {
|
|
85
|
-
const msg = event.error?.message || "Codex response failed";
|
|
86
|
-
throw new ProviderError("openai", msg);
|
|
87
|
-
}
|
|
88
|
-
// Text delta
|
|
89
|
-
if (type === "response.output_text.delta") {
|
|
90
|
-
const delta = event.delta;
|
|
91
|
-
textAccum += delta;
|
|
92
|
-
result.push({ type: "text_delta", text: delta });
|
|
93
|
-
}
|
|
94
|
-
// Thinking delta
|
|
95
|
-
if (type === "response.reasoning_summary_text.delta") {
|
|
96
|
-
const delta = event.delta;
|
|
97
|
-
result.push({ type: "thinking_delta", text: delta });
|
|
98
|
-
}
|
|
99
|
-
// Tool call started
|
|
100
|
-
if (type === "response.output_item.added") {
|
|
101
|
-
const item = event.item;
|
|
102
|
-
if (item?.type === "function_call") {
|
|
103
|
-
const callId = item.call_id;
|
|
104
|
-
const itemId = item.id;
|
|
105
|
-
const id = `${callId}|${itemId}`;
|
|
106
|
-
const name = item.name;
|
|
107
|
-
toolCalls.set(id, { id, name, argsJson: item.arguments || "" });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
// Tool call arguments delta
|
|
111
|
-
if (type === "response.function_call_arguments.delta") {
|
|
112
|
-
const delta = event.delta;
|
|
113
|
-
const itemId = event.item_id;
|
|
114
|
-
// Find the matching tool call
|
|
115
|
-
for (const [key, tc] of toolCalls) {
|
|
116
|
-
if (key.endsWith(`|${itemId}`)) {
|
|
117
|
-
tc.argsJson += delta;
|
|
118
|
-
result.push({
|
|
119
|
-
type: "toolcall_delta",
|
|
120
|
-
id: tc.id,
|
|
121
|
-
name: tc.name,
|
|
122
|
-
argsJson: delta,
|
|
123
|
-
});
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// Tool call arguments done
|
|
129
|
-
if (type === "response.function_call_arguments.done") {
|
|
130
|
-
const itemId = event.item_id;
|
|
131
|
-
const argsStr = event.arguments;
|
|
132
|
-
for (const [key, tc] of toolCalls) {
|
|
133
|
-
if (key.endsWith(`|${itemId}`)) {
|
|
134
|
-
tc.argsJson = argsStr;
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
// Item done — finalize tool call
|
|
140
|
-
if (type === "response.output_item.done") {
|
|
141
|
-
const item = event.item;
|
|
142
|
-
if (item?.type === "function_call") {
|
|
143
|
-
const callId = item.call_id;
|
|
144
|
-
const itemId = item.id;
|
|
145
|
-
const id = `${callId}|${itemId}`;
|
|
146
|
-
const tc = toolCalls.get(id);
|
|
147
|
-
if (tc) {
|
|
148
|
-
let args = {};
|
|
149
|
-
try {
|
|
150
|
-
args = JSON.parse(tc.argsJson);
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
/* malformed JSON */
|
|
154
|
-
}
|
|
155
|
-
result.push({
|
|
156
|
-
type: "toolcall_done",
|
|
157
|
-
id: tc.id,
|
|
158
|
-
name: tc.name,
|
|
159
|
-
args,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
// Response completed
|
|
165
|
-
if (type === "response.completed" || type === "response.done") {
|
|
166
|
-
const resp = event.response;
|
|
167
|
-
const usage = resp?.usage;
|
|
168
|
-
if (usage) {
|
|
169
|
-
inputTokens = usage.input_tokens ?? 0;
|
|
170
|
-
outputTokens = usage.output_tokens ?? 0;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// Finalize content parts
|
|
175
|
-
if (textAccum) {
|
|
176
|
-
contentParts.push({ type: "text", text: textAccum });
|
|
177
|
-
}
|
|
178
|
-
for (const [, tc] of toolCalls) {
|
|
179
|
-
let args = {};
|
|
180
|
-
try {
|
|
181
|
-
args = JSON.parse(tc.argsJson);
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
/* malformed JSON */
|
|
185
|
-
}
|
|
186
|
-
const toolCall = {
|
|
187
|
-
type: "tool_call",
|
|
188
|
-
id: tc.id,
|
|
189
|
-
name: tc.name,
|
|
190
|
-
args,
|
|
191
|
-
};
|
|
192
|
-
contentParts.push(toolCall);
|
|
193
|
-
}
|
|
194
|
-
const hasToolCalls = contentParts.some((p) => p.type === "tool_call");
|
|
195
|
-
const stopReason = hasToolCalls ? "tool_use" : "end_turn";
|
|
196
|
-
const streamResponse = {
|
|
197
|
-
message: {
|
|
198
|
-
role: "assistant",
|
|
199
|
-
content: contentParts.length > 0 ? contentParts : textAccum || "",
|
|
200
|
-
},
|
|
201
|
-
stopReason,
|
|
202
|
-
usage: { inputTokens, outputTokens },
|
|
203
|
-
};
|
|
204
|
-
result.push({ type: "done", stopReason });
|
|
205
|
-
result.complete(streamResponse);
|
|
206
|
-
}
|
|
207
|
-
// ── SSE Parser ─────────────────────────────────────────────
|
|
208
|
-
async function* parseSSE(body) {
|
|
209
|
-
const reader = body.getReader();
|
|
210
|
-
const decoder = new TextDecoder();
|
|
211
|
-
let buffer = "";
|
|
212
|
-
try {
|
|
213
|
-
while (true) {
|
|
214
|
-
const { done, value } = await reader.read();
|
|
215
|
-
if (done)
|
|
216
|
-
break;
|
|
217
|
-
buffer += decoder.decode(value, { stream: true });
|
|
218
|
-
let idx = buffer.indexOf("\n\n");
|
|
219
|
-
while (idx !== -1) {
|
|
220
|
-
const chunk = buffer.slice(0, idx);
|
|
221
|
-
buffer = buffer.slice(idx + 2);
|
|
222
|
-
const dataLines = chunk
|
|
223
|
-
.split("\n")
|
|
224
|
-
.filter((l) => l.startsWith("data:"))
|
|
225
|
-
.map((l) => l.slice(5).trim());
|
|
226
|
-
if (dataLines.length > 0) {
|
|
227
|
-
const data = dataLines.join("\n").trim();
|
|
228
|
-
if (data && data !== "[DONE]") {
|
|
229
|
-
try {
|
|
230
|
-
yield JSON.parse(data);
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
// skip malformed JSON
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
idx = buffer.indexOf("\n\n");
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
finally {
|
|
242
|
-
reader.releaseLock();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
// ── Message Conversion ─────────────────────────────────────
|
|
246
|
-
function toCodexInput(messages) {
|
|
247
|
-
let system;
|
|
248
|
-
const input = [];
|
|
249
|
-
for (const msg of messages) {
|
|
250
|
-
if (msg.role === "system") {
|
|
251
|
-
system = msg.content;
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
if (msg.role === "user") {
|
|
255
|
-
const content = typeof msg.content === "string"
|
|
256
|
-
? [{ type: "input_text", text: msg.content }]
|
|
257
|
-
: msg.content.map((part) => {
|
|
258
|
-
if (part.type === "text")
|
|
259
|
-
return { type: "input_text", text: part.text };
|
|
260
|
-
return {
|
|
261
|
-
type: "input_image",
|
|
262
|
-
detail: "auto",
|
|
263
|
-
image_url: `data:${part.mediaType};base64,${part.data}`,
|
|
264
|
-
};
|
|
265
|
-
});
|
|
266
|
-
input.push({ role: "user", content });
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
if (msg.role === "assistant") {
|
|
270
|
-
if (typeof msg.content === "string") {
|
|
271
|
-
input.push({
|
|
272
|
-
type: "message",
|
|
273
|
-
role: "assistant",
|
|
274
|
-
content: [{ type: "output_text", text: msg.content, annotations: [] }],
|
|
275
|
-
status: "completed",
|
|
276
|
-
});
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
for (const part of msg.content) {
|
|
280
|
-
if (part.type === "text") {
|
|
281
|
-
input.push({
|
|
282
|
-
type: "message",
|
|
283
|
-
role: "assistant",
|
|
284
|
-
content: [{ type: "output_text", text: part.text, annotations: [] }],
|
|
285
|
-
status: "completed",
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
else if (part.type === "tool_call") {
|
|
289
|
-
const [callId, itemId] = part.id.includes("|")
|
|
290
|
-
? part.id.split("|", 2)
|
|
291
|
-
: [part.id, part.id];
|
|
292
|
-
input.push({
|
|
293
|
-
type: "function_call",
|
|
294
|
-
id: itemId,
|
|
295
|
-
call_id: callId,
|
|
296
|
-
name: part.name,
|
|
297
|
-
arguments: JSON.stringify(part.args),
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
// thinking parts are skipped for codex input
|
|
301
|
-
}
|
|
302
|
-
continue;
|
|
303
|
-
}
|
|
304
|
-
if (msg.role === "tool") {
|
|
305
|
-
for (const result of msg.content) {
|
|
306
|
-
const [callId] = result.toolCallId.includes("|")
|
|
307
|
-
? result.toolCallId.split("|", 2)
|
|
308
|
-
: [result.toolCallId];
|
|
309
|
-
input.push({
|
|
310
|
-
type: "function_call_output",
|
|
311
|
-
call_id: callId,
|
|
312
|
-
output: result.content,
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return { system, input };
|
|
318
|
-
}
|
|
319
|
-
// ── Tool Conversion ────────────────────────────────────────
|
|
320
|
-
function toCodexTools(tools) {
|
|
321
|
-
return tools.map((tool) => ({
|
|
322
|
-
type: "function",
|
|
323
|
-
name: tool.name,
|
|
324
|
-
description: tool.description,
|
|
325
|
-
parameters: tool.rawInputSchema ?? zodToJsonSchema(tool.parameters),
|
|
326
|
-
strict: null,
|
|
327
|
-
}));
|
|
328
|
-
}
|
|
329
|
-
// ── Error Handling ─────────────────────────────────────────
|
|
330
|
-
function toError(err) {
|
|
331
|
-
if (err instanceof ProviderError)
|
|
332
|
-
return err;
|
|
333
|
-
if (err instanceof Error) {
|
|
334
|
-
return new ProviderError("openai", err.message, { cause: err });
|
|
335
|
-
}
|
|
336
|
-
return new ProviderError("openai", String(err));
|
|
337
|
-
}
|
|
338
|
-
//# sourceMappingURL=openai-codex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai-codex.js","sourceRoot":"","sources":["../../src/providers/openai-codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AASzB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,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AAI,EAAE,UAAU;QAChB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,cAAc,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;QACnE,MAAM,EAAE,IAAI;KACb,CAAC,CAAC,CAAC;AACN,CAAC;AAED,8DAA8D;AAE9D,SAAS,OAAO,CAAC,GAAY;IAC3B,IAAI,GAAG,YAAY,aAAa;QAAE,OAAO,GAAG,CAAC;IAC7C,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,IAAI,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,aAAa,EAA4B,MAAM,aAAa,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AASxD,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAIjE"}
|
package/dist/providers/openai.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import OpenAI from "openai";
|
|
2
|
-
import { ProviderError } from "../errors.js";
|
|
3
|
-
import { StreamResult } from "../utils/event-stream.js";
|
|
4
|
-
import { normalizeOpenAIStopReason, toOpenAIMessages, toOpenAIReasoningEffort, toOpenAIToolChoice, toOpenAITools, } from "./transform.js";
|
|
5
|
-
export function streamOpenAI(options) {
|
|
6
|
-
const result = new StreamResult();
|
|
7
|
-
runStream(options, result).catch((err) => result.abort(toError(err)));
|
|
8
|
-
return result;
|
|
9
|
-
}
|
|
10
|
-
async function runStream(options, result) {
|
|
11
|
-
const client = new OpenAI({
|
|
12
|
-
apiKey: options.apiKey,
|
|
13
|
-
...(options.baseUrl ? { baseURL: options.baseUrl } : {}),
|
|
14
|
-
});
|
|
15
|
-
// GLM and Moonshot use a custom `thinking` body param instead of `reasoning_effort`
|
|
16
|
-
const usesThinkingParam = options.provider === "glm" || options.provider === "moonshot";
|
|
17
|
-
const messages = toOpenAIMessages(options.messages);
|
|
18
|
-
const params = {
|
|
19
|
-
model: options.model,
|
|
20
|
-
messages,
|
|
21
|
-
stream: true,
|
|
22
|
-
...(options.maxTokens ? { max_tokens: options.maxTokens } : {}),
|
|
23
|
-
...(options.temperature != null && !options.thinking
|
|
24
|
-
? { temperature: options.temperature }
|
|
25
|
-
: {}),
|
|
26
|
-
...(options.topP != null ? { top_p: options.topP } : {}),
|
|
27
|
-
...(options.stop ? { stop: options.stop } : {}),
|
|
28
|
-
...(options.thinking && !usesThinkingParam
|
|
29
|
-
? { reasoning_effort: toOpenAIReasoningEffort(options.thinking) }
|
|
30
|
-
: {}),
|
|
31
|
-
...(options.tools?.length ? { tools: toOpenAITools(options.tools) } : {}),
|
|
32
|
-
...(options.toolChoice && options.tools?.length
|
|
33
|
-
? { tool_choice: toOpenAIToolChoice(options.toolChoice) }
|
|
34
|
-
: {}),
|
|
35
|
-
stream_options: { include_usage: true },
|
|
36
|
-
};
|
|
37
|
-
// Inject provider-native web search tools (non-standard, bypass SDK types)
|
|
38
|
-
if (options.webSearch) {
|
|
39
|
-
if (options.provider === "moonshot") {
|
|
40
|
-
const raw = params;
|
|
41
|
-
const tools = (raw.tools ?? []).slice();
|
|
42
|
-
tools.push({ type: "builtin_function", function: { name: "$web_search" } });
|
|
43
|
-
raw.tools = tools;
|
|
44
|
-
}
|
|
45
|
-
// GLM (Z.AI): web search is provided via MCP servers, not inline tools
|
|
46
|
-
// OpenAI: Chat Completions API does not support web search
|
|
47
|
-
}
|
|
48
|
-
// Inject custom thinking param for GLM/Moonshot (not part of OpenAI spec)
|
|
49
|
-
if (usesThinkingParam) {
|
|
50
|
-
params.thinking = options.thinking
|
|
51
|
-
? { type: "enabled" }
|
|
52
|
-
: { type: "disabled" };
|
|
53
|
-
}
|
|
54
|
-
const stream = await client.chat.completions.create(params, {
|
|
55
|
-
signal: options.signal ?? undefined,
|
|
56
|
-
});
|
|
57
|
-
const contentParts = [];
|
|
58
|
-
const toolCallAccum = new Map();
|
|
59
|
-
let textAccum = "";
|
|
60
|
-
let thinkingAccum = "";
|
|
61
|
-
let inputTokens = 0;
|
|
62
|
-
let outputTokens = 0;
|
|
63
|
-
let cacheRead = 0;
|
|
64
|
-
let finishReason = null;
|
|
65
|
-
for await (const chunk of stream) {
|
|
66
|
-
const choice = chunk.choices?.[0];
|
|
67
|
-
if (chunk.usage) {
|
|
68
|
-
inputTokens = chunk.usage.prompt_tokens;
|
|
69
|
-
outputTokens = chunk.usage.completion_tokens;
|
|
70
|
-
const details = chunk.usage.prompt_tokens_details;
|
|
71
|
-
if (details?.cached_tokens) {
|
|
72
|
-
cacheRead = details.cached_tokens;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (!choice)
|
|
76
|
-
continue;
|
|
77
|
-
if (choice.finish_reason) {
|
|
78
|
-
finishReason = choice.finish_reason;
|
|
79
|
-
}
|
|
80
|
-
const delta = choice.delta;
|
|
81
|
-
// Reasoning/thinking delta (GLM, Moonshot)
|
|
82
|
-
const reasoningContent = delta.reasoning_content;
|
|
83
|
-
if (typeof reasoningContent === "string" && reasoningContent) {
|
|
84
|
-
thinkingAccum += reasoningContent;
|
|
85
|
-
result.push({ type: "thinking_delta", text: reasoningContent });
|
|
86
|
-
}
|
|
87
|
-
// Text delta
|
|
88
|
-
if (delta.content) {
|
|
89
|
-
textAccum += delta.content;
|
|
90
|
-
result.push({ type: "text_delta", text: delta.content });
|
|
91
|
-
}
|
|
92
|
-
// Tool call deltas
|
|
93
|
-
if (delta.tool_calls) {
|
|
94
|
-
for (const tc of delta.tool_calls) {
|
|
95
|
-
let accum = toolCallAccum.get(tc.index);
|
|
96
|
-
if (!accum) {
|
|
97
|
-
accum = {
|
|
98
|
-
id: tc.id ?? "",
|
|
99
|
-
name: tc.function?.name ?? "",
|
|
100
|
-
argsJson: "",
|
|
101
|
-
};
|
|
102
|
-
toolCallAccum.set(tc.index, accum);
|
|
103
|
-
}
|
|
104
|
-
if (tc.id)
|
|
105
|
-
accum.id = tc.id;
|
|
106
|
-
if (tc.function?.name)
|
|
107
|
-
accum.name = tc.function.name;
|
|
108
|
-
if (tc.function?.arguments) {
|
|
109
|
-
accum.argsJson += tc.function.arguments;
|
|
110
|
-
result.push({
|
|
111
|
-
type: "toolcall_delta",
|
|
112
|
-
id: accum.id,
|
|
113
|
-
name: accum.name,
|
|
114
|
-
argsJson: tc.function.arguments,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// Finalize thinking content (GLM, Moonshot reasoning_content)
|
|
121
|
-
if (thinkingAccum) {
|
|
122
|
-
contentParts.push({ type: "thinking", text: thinkingAccum });
|
|
123
|
-
}
|
|
124
|
-
// Finalize text content
|
|
125
|
-
if (textAccum) {
|
|
126
|
-
contentParts.push({ type: "text", text: textAccum });
|
|
127
|
-
}
|
|
128
|
-
// Finalize tool calls
|
|
129
|
-
for (const [, tc] of toolCallAccum) {
|
|
130
|
-
let args = {};
|
|
131
|
-
try {
|
|
132
|
-
args = JSON.parse(tc.argsJson);
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
// malformed JSON — keep empty
|
|
136
|
-
}
|
|
137
|
-
const toolCall = {
|
|
138
|
-
type: "tool_call",
|
|
139
|
-
id: tc.id,
|
|
140
|
-
name: tc.name,
|
|
141
|
-
args,
|
|
142
|
-
};
|
|
143
|
-
contentParts.push(toolCall);
|
|
144
|
-
result.push({
|
|
145
|
-
type: "toolcall_done",
|
|
146
|
-
id: tc.id,
|
|
147
|
-
name: tc.name,
|
|
148
|
-
args,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
const stopReason = normalizeOpenAIStopReason(finishReason);
|
|
152
|
-
const response = {
|
|
153
|
-
message: {
|
|
154
|
-
role: "assistant",
|
|
155
|
-
content: contentParts.length > 0 ? contentParts : textAccum || "",
|
|
156
|
-
},
|
|
157
|
-
stopReason,
|
|
158
|
-
usage: { inputTokens, outputTokens, ...(cacheRead > 0 && { cacheRead }) },
|
|
159
|
-
};
|
|
160
|
-
result.push({ type: "done", stopReason });
|
|
161
|
-
result.complete(response);
|
|
162
|
-
}
|
|
163
|
-
function toError(err) {
|
|
164
|
-
if (err instanceof OpenAI.APIError) {
|
|
165
|
-
// Include full error body for debugging — GLM/Moonshot use non-standard error shapes
|
|
166
|
-
let msg = err.message;
|
|
167
|
-
const body = err.error;
|
|
168
|
-
if (body) {
|
|
169
|
-
// Append raw error body so debug logs capture the exact API response
|
|
170
|
-
msg += ` | body: ${JSON.stringify(body)}`;
|
|
171
|
-
}
|
|
172
|
-
return new ProviderError("openai", msg, {
|
|
173
|
-
statusCode: err.status,
|
|
174
|
-
cause: err,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
if (err instanceof Error) {
|
|
178
|
-
return new ProviderError("openai", err.message, { cause: err });
|
|
179
|
-
}
|
|
180
|
-
return new ProviderError("openai", String(err));
|
|
181
|
-
}
|
|
182
|
-
//# sourceMappingURL=openai.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,GACd,MAAM,gBAAgB,C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ACD,OAAO,IAAI,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type Anthropic from "@anthropic-ai/sdk";
|
|
2
|
-
import type OpenAI from "openai";
|
|
3
|
-
import type { CacheRetention, Message, StopReason, ThinkingLevel, Tool, ToolChoice } from "../types.js";
|
|
4
|
-
export declare function toAnthropicCacheControl(retention: CacheRetention | undefined, baseUrl: string | undefined): {
|
|
5
|
-
type: "ephemeral";
|
|
6
|
-
ttl?: "1h";
|
|
7
|
-
} | undefined;
|
|
8
|
-
export declare function toAnthropicMessages(messages: Message[], cacheControl?: {
|
|
9
|
-
type: "ephemeral";
|
|
10
|
-
ttl?: "1h";
|
|
11
|
-
}): {
|
|
12
|
-
system: Anthropic.TextBlockParam[] | undefined;
|
|
13
|
-
messages: Anthropic.MessageParam[];
|
|
14
|
-
};
|
|
15
|
-
export declare function toAnthropicTools(tools: Tool[]): Anthropic.Tool[];
|
|
16
|
-
export declare function toAnthropicToolChoice(choice: ToolChoice): Anthropic.ToolChoice;
|
|
17
|
-
export declare function toAnthropicThinking(level: ThinkingLevel, maxTokens: number, model: string): {
|
|
18
|
-
thinking: Anthropic.ThinkingConfigParam;
|
|
19
|
-
maxTokens: number;
|
|
20
|
-
outputConfig?: {
|
|
21
|
-
effort: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare function toOpenAIMessages(messages: Message[]): OpenAI.ChatCompletionMessageParam[];
|
|
25
|
-
export declare function toOpenAITools(tools: Tool[]): OpenAI.ChatCompletionTool[];
|
|
26
|
-
export declare function toOpenAIToolChoice(choice: ToolChoice): OpenAI.ChatCompletionToolChoiceOption;
|
|
27
|
-
export declare function toOpenAIReasoningEffort(level: ThinkingLevel): "low" | "medium" | "high";
|
|
28
|
-
export declare function normalizeAnthropicStopReason(reason: string | null): StopReason;
|
|
29
|
-
export declare function normalizeOpenAIStopReason(reason: string | null): StopReason;
|
|
30
|
-
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/providers/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EACV,cAAc,EAEd,OAAO,EACP,UAAU,EAGV,aAAa,EACb,IAAI,EACJ,UAAU,EACX,MAAM,aAAa,CAAC;AAKrB,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CAM/C;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,OAAO,EAAE,EACnB,YAAY,CAAC,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,GAC/C;IACD,MAAM,EAAE,SAAS,CAAC,cAAc,EAAE,GAAG,SAAS,CAAC;IAC/C,QAAQ,EAAE,SAAS,CAAC,YAAY,EAAE,CAAC;CACpC,CAyIA;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,CAOhE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC,UAAU,CAK9E;AAMD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ;IACD,QAAQ,EAAE,SAAS,CAAC,mBAAmB,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAA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