xiaodcs-copilot-api 2.3.9-public.3 → 2.5.1-public.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/README.md +46 -17
- package/README.zh-CN.md +46 -17
- package/dist/{auth-BiVetBYt.js → auth-D-M3qCeV.js} +79 -16
- package/dist/auth-DIGdDJx3.js +2 -0
- package/dist/{config-SytZjLq8.js → config-DnMKoKrg.js} +43 -29
- package/dist/{debug-BFadhEB4.js → debug-CuLfQpTq.js} +3 -3
- package/dist/main.js +6 -6
- package/dist/{mcp-fpSlKZxK.js → mcp-DqslOG3W.js} +1 -1
- package/dist/{mcp-server-BeNu_Edl.js → mcp-server-B-_dWuXe.js} +1 -1
- package/dist/mcp-server-Byq5DomJ.js +2 -0
- package/dist/protocol-BTFLbI8m.js +257 -0
- package/dist/provider-proxy-BbLwvtD_.js +263 -0
- package/dist/runtime-CWU5BNBf.js +442 -0
- package/dist/server-DmKNMBLd.js +13628 -0
- package/dist/{start-FFVCi8su.js → start-WdcRgBSL.js} +110 -11
- package/dist/{token-D9svRIYW.js → token-CQftvMU4.js} +48 -31
- package/dist/transport-DE8Q0wU-.js +252 -0
- package/dist/transport-HOWgkXsv.js +2 -0
- package/package.json +20 -8
- package/pages/index.html +106 -32
- package/qoder-bridge/README.md +112 -0
- package/dist/auth-Bu4MXadr.js +0 -2
- package/dist/mcp-server-DQ4r-fAy.js +0 -2
- package/dist/models-YMUf33c-.js +0 -88
- package/dist/server-CFQmvoAJ.js +0 -11710
- /package/dist/{electron-fetch-BRX-ug5E.js → electron-fetch-D5uOld7F.js} +0 -0
- /package/dist/{tls-Aq1Dd8E2.js → tls-B5VJAJJM.js} +0 -0
- /package/dist/{tool-search-Ds1vbmGG.js → tool-search-DCb3HbWj.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as getConfiguredApiKeys, K as state, M as loginCodex, a as setupGitHubToken, n as persistCodexCredentials } from "./token-
|
|
1
|
+
import { L as setConfiguredApiKeys, R as PATHS, a as normalizeProviderBaseUrl, c as setProviderConfig, l as QODER_SDK_BASE_URL, n as getRawProviderConfig, r as isSupportedProviderType, x as SUPPORTED_PROVIDER_TYPES, z as ensurePaths } from "./config-DnMKoKrg.js";
|
|
2
|
+
import { A as getConfiguredApiKeys, K as state, M as loginCodex, a as setupGitHubToken, n as persistCodexCredentials } from "./token-CQftvMU4.js";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import consola from "consola";
|
|
5
5
|
//#region src/lib/quick-providers.ts
|
|
@@ -36,11 +36,57 @@ const QUICK_PROVIDER_CONFIGS = {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
//#endregion
|
|
39
|
+
//#region src/lib/interactive-prompt.ts
|
|
40
|
+
function shouldUseClackPrompt(runtime = {
|
|
41
|
+
bunVersion: process.versions.bun,
|
|
42
|
+
platform: process.platform,
|
|
43
|
+
stdinIsTTY: process.stdin.isTTY,
|
|
44
|
+
stdoutIsTTY: process.stdout.isTTY,
|
|
45
|
+
stdoutIsTTYStream: typeof process.stdout.getColorDepth === "function"
|
|
46
|
+
}) {
|
|
47
|
+
return Boolean(runtime.platform === "win32" && runtime.bunVersion && runtime.stdinIsTTY && runtime.stdoutIsTTY && runtime.stdoutIsTTYStream);
|
|
48
|
+
}
|
|
49
|
+
function getCancelValue(options) {
|
|
50
|
+
return options.type === "select" ? options.initial : options.default ?? options.initial;
|
|
51
|
+
}
|
|
52
|
+
async function promptWithClack(message, options, backend) {
|
|
53
|
+
if (options.type === "select") {
|
|
54
|
+
const value = await backend.select({
|
|
55
|
+
message,
|
|
56
|
+
options: options.options.map((option) => typeof option === "string" ? {
|
|
57
|
+
label: option,
|
|
58
|
+
value: option
|
|
59
|
+
} : option),
|
|
60
|
+
initialValue: options.initial
|
|
61
|
+
});
|
|
62
|
+
if (backend.isCancel(value)) return getCancelValue(options);
|
|
63
|
+
return typeof value === "string" ? value : void 0;
|
|
64
|
+
}
|
|
65
|
+
const value = await backend.text({
|
|
66
|
+
message,
|
|
67
|
+
defaultValue: options.default,
|
|
68
|
+
initialValue: options.initial,
|
|
69
|
+
placeholder: options.placeholder
|
|
70
|
+
});
|
|
71
|
+
if (backend.isCancel(value)) return getCancelValue(options);
|
|
72
|
+
return typeof value === "string" ? value : void 0;
|
|
73
|
+
}
|
|
74
|
+
async function prompt(message, options) {
|
|
75
|
+
if (!shouldUseClackPrompt()) {
|
|
76
|
+
if (options.type === "select") {
|
|
77
|
+
const value = await consola.prompt(message, options);
|
|
78
|
+
return typeof value === "string" ? value : void 0;
|
|
79
|
+
}
|
|
80
|
+
return await consola.prompt(message, options);
|
|
81
|
+
}
|
|
82
|
+
return await promptWithClack(message, options, await import("@clack/prompts"));
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
39
85
|
//#region src/auth.ts
|
|
40
86
|
const authArgs = {
|
|
41
87
|
provider: {
|
|
42
88
|
type: "string",
|
|
43
|
-
description: "Provider to log in with or configure (copilot, codex, opencode-go, kimi, deepseek, dashscope, openrouter, custom)"
|
|
89
|
+
description: "Provider to log in with or configure (copilot, codex, qoder, opencode-go, kimi, deepseek, dashscope, openrouter, custom)"
|
|
44
90
|
},
|
|
45
91
|
verbose: {
|
|
46
92
|
alias: "v",
|
|
@@ -54,7 +100,11 @@ const authArgs = {
|
|
|
54
100
|
description: "Show provider access token on auth"
|
|
55
101
|
}
|
|
56
102
|
};
|
|
57
|
-
const BUILTIN_PROVIDER_NAMES = [
|
|
103
|
+
const BUILTIN_PROVIDER_NAMES = [
|
|
104
|
+
"copilot",
|
|
105
|
+
"codex",
|
|
106
|
+
"qoder"
|
|
107
|
+
];
|
|
58
108
|
const QUICK_PROVIDER_NAMES = Object.keys(QUICK_PROVIDER_CONFIGS);
|
|
59
109
|
const AUTH_PROVIDER_NAMES = [
|
|
60
110
|
...BUILTIN_PROVIDER_NAMES,
|
|
@@ -67,6 +117,7 @@ const CUSTOM_PROVIDER_AUTH_TYPES = ["x-api-key", "authorization"];
|
|
|
67
117
|
const AUTH_PROVIDER_LABELS = {
|
|
68
118
|
copilot: "GitHub Copilot",
|
|
69
119
|
codex: "OpenAI Codex",
|
|
120
|
+
qoder: "Qoder (Personal Access Token)",
|
|
70
121
|
"opencode-go": "OpenCode Go",
|
|
71
122
|
kimi: "Kimi",
|
|
72
123
|
deepseek: "DeepSeek",
|
|
@@ -91,7 +142,7 @@ async function resolveProviderSelection(providerArg) {
|
|
|
91
142
|
return providerName;
|
|
92
143
|
}
|
|
93
144
|
if (availableProviders.length === 1) return availableProviders[0];
|
|
94
|
-
const provider = await
|
|
145
|
+
const provider = await prompt("Select a provider to log in with", {
|
|
95
146
|
type: "select",
|
|
96
147
|
options: availableProviders.map((providerName) => ({
|
|
97
148
|
label: `${AUTH_PROVIDER_LABELS[providerName]} (${providerName})`,
|
|
@@ -107,7 +158,7 @@ function assertCustomProviderName(providerName) {
|
|
|
107
158
|
if (providerName === "copilot" || providerName === "codex") throw new Error(`Provider name '${providerName}' is reserved for a builtin provider`);
|
|
108
159
|
}
|
|
109
160
|
async function promptRequiredText(message, fieldName) {
|
|
110
|
-
const value = await
|
|
161
|
+
const value = await prompt(message, { type: "text" });
|
|
111
162
|
const normalizedValue = typeof value === "string" ? value.trim() : "";
|
|
112
163
|
if (!normalizedValue) throw new Error(`${fieldName} must be a non-empty string`);
|
|
113
164
|
return normalizedValue;
|
|
@@ -117,7 +168,7 @@ function canUseMaskedPrompt() {
|
|
|
117
168
|
}
|
|
118
169
|
async function promptMaskedText(message) {
|
|
119
170
|
if (!canUseMaskedPrompt()) {
|
|
120
|
-
const value = await
|
|
171
|
+
const value = await prompt(message, { type: "text" });
|
|
121
172
|
return typeof value === "string" ? value : "";
|
|
122
173
|
}
|
|
123
174
|
return await new Promise((resolve, reject) => {
|
|
@@ -180,7 +231,7 @@ async function promptCustomProviderName() {
|
|
|
180
231
|
return providerName;
|
|
181
232
|
}
|
|
182
233
|
async function promptCustomProviderType() {
|
|
183
|
-
const providerType = await
|
|
234
|
+
const providerType = await prompt("Select provider type", {
|
|
184
235
|
type: "select",
|
|
185
236
|
options: SUPPORTED_PROVIDER_TYPES.map((type) => ({
|
|
186
237
|
label: type,
|
|
@@ -191,7 +242,7 @@ async function promptCustomProviderType() {
|
|
|
191
242
|
return providerType;
|
|
192
243
|
}
|
|
193
244
|
async function promptQuickProviderType(defaultType) {
|
|
194
|
-
const providerType = await
|
|
245
|
+
const providerType = await prompt(`Select provider type (default: ${defaultType})`, {
|
|
195
246
|
type: "select",
|
|
196
247
|
options: [{
|
|
197
248
|
label: `Default (${defaultType})`,
|
|
@@ -209,11 +260,10 @@ function getDefaultProviderAuthType(providerType) {
|
|
|
209
260
|
return providerType === "anthropic" ? "x-api-key" : "authorization";
|
|
210
261
|
}
|
|
211
262
|
async function promptCustomProviderAuthType(providerType) {
|
|
212
|
-
const
|
|
213
|
-
const authType = await consola.prompt("Select provider auth type", {
|
|
263
|
+
const authType = await prompt("Select provider auth type", {
|
|
214
264
|
type: "select",
|
|
215
265
|
options: [{
|
|
216
|
-
label: `Default (${
|
|
266
|
+
label: `Default (${getDefaultProviderAuthType(providerType)})`,
|
|
217
267
|
value: CUSTOM_PROVIDER_AUTH_TYPE_OPTION
|
|
218
268
|
}, ...CUSTOM_PROVIDER_AUTH_TYPES.map((value) => ({
|
|
219
269
|
label: value,
|
|
@@ -225,7 +275,7 @@ async function promptCustomProviderAuthType(providerType) {
|
|
|
225
275
|
throw new Error("No provider auth type selected");
|
|
226
276
|
}
|
|
227
277
|
async function promptQuickProviderBaseUrl(defaultBaseUrl) {
|
|
228
|
-
const value = await
|
|
278
|
+
const value = await prompt(`Enter provider baseUrl (default: ${defaultBaseUrl})`, {
|
|
229
279
|
type: "text",
|
|
230
280
|
default: defaultBaseUrl,
|
|
231
281
|
initial: defaultBaseUrl
|
|
@@ -281,7 +331,7 @@ async function loginWithCodex() {
|
|
|
281
331
|
if (info.instructions) consola.info(info.instructions);
|
|
282
332
|
},
|
|
283
333
|
onPrompt(message) {
|
|
284
|
-
return
|
|
334
|
+
return prompt(message, { type: "text" }).then((value) => value ?? "");
|
|
285
335
|
},
|
|
286
336
|
onProgress(message) {
|
|
287
337
|
consola.debug(message);
|
|
@@ -299,6 +349,19 @@ async function loginWithProvider(provider) {
|
|
|
299
349
|
await loginWithCodex();
|
|
300
350
|
return;
|
|
301
351
|
}
|
|
352
|
+
if (provider === "qoder") {
|
|
353
|
+
const apiKey = await promptRequiredSecret("Enter Qoder Personal Access Token", "PAT");
|
|
354
|
+
const existing = getRawProviderConfig("qoder");
|
|
355
|
+
setProviderConfig("qoder", {
|
|
356
|
+
type: "openai-compatible",
|
|
357
|
+
enabled: true,
|
|
358
|
+
baseUrl: QODER_SDK_BASE_URL,
|
|
359
|
+
apiKey,
|
|
360
|
+
...existing?.models ? { models: existing.models } : {}
|
|
361
|
+
});
|
|
362
|
+
consola.success(`Qoder PAT written to ${PATHS.CONFIG_PATH}. Start the gateway normally to use qoder/<model>.`);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
302
365
|
if (isQuickProviderName(provider)) {
|
|
303
366
|
await configureQuickProvider(provider);
|
|
304
367
|
return;
|
|
@@ -311,7 +374,7 @@ async function runProviderSetup() {
|
|
|
311
374
|
await loginWithProvider(provider);
|
|
312
375
|
}
|
|
313
376
|
async function runAuthLogin(options) {
|
|
314
|
-
(await import("./tls-
|
|
377
|
+
(await import("./tls-B5VJAJJM.js")).enableSystemCACompat();
|
|
315
378
|
if (options.verbose) {
|
|
316
379
|
consola.level = 5;
|
|
317
380
|
consola.info("Verbose logging enabled");
|
|
@@ -351,7 +414,7 @@ function normalizeAuthKeyValue(value) {
|
|
|
351
414
|
return normalizedKey;
|
|
352
415
|
}
|
|
353
416
|
async function runAuthKeys(options) {
|
|
354
|
-
(await import("./tls-
|
|
417
|
+
(await import("./tls-B5VJAJJM.js")).enableSystemCACompat();
|
|
355
418
|
await ensurePaths();
|
|
356
419
|
const operations = [
|
|
357
420
|
...options.add !== void 0 ? ["add"] : [],
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { randomBytes } from "node:crypto";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import fs$1 from "node:fs/promises";
|
|
1
|
+
import fs from "node:fs/promises";
|
|
6
2
|
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { randomBytes } from "node:crypto";
|
|
5
|
+
import consola from "consola";
|
|
6
|
+
import fs$1 from "node:fs";
|
|
7
7
|
//#region src/lib/atomic-file.ts
|
|
8
8
|
const TEMP_FILE_RANDOM_BYTES = 8;
|
|
9
9
|
const fsyncDirectory = (directory) => {
|
|
10
10
|
if (process.platform === "win32") return;
|
|
11
11
|
let directoryFd;
|
|
12
12
|
try {
|
|
13
|
-
directoryFd = fs.openSync(directory, "r");
|
|
14
|
-
fs.fsyncSync(directoryFd);
|
|
13
|
+
directoryFd = fs$1.openSync(directory, "r");
|
|
14
|
+
fs$1.fsyncSync(directoryFd);
|
|
15
15
|
} catch (error) {
|
|
16
16
|
console.warn(`Failed to fsync directory: ${directory}`, error);
|
|
17
17
|
} finally {
|
|
18
18
|
if (directoryFd !== void 0) try {
|
|
19
|
-
fs.closeSync(directoryFd);
|
|
19
|
+
fs$1.closeSync(directoryFd);
|
|
20
20
|
} catch {}
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
function writeFileAtomically(filePath, content) {
|
|
24
24
|
const directory = path.dirname(filePath);
|
|
25
25
|
const tempPath = path.join(directory, `.${path.basename(filePath)}.${process.pid}.${randomBytes(TEMP_FILE_RANDOM_BYTES).toString("hex")}.tmp`);
|
|
26
|
-
fs.mkdirSync(directory, { recursive: true });
|
|
26
|
+
fs$1.mkdirSync(directory, { recursive: true });
|
|
27
27
|
let fileDescriptor;
|
|
28
28
|
let tempFileCreated = false;
|
|
29
29
|
try {
|
|
30
|
-
fileDescriptor = fs.openSync(tempPath, "wx", 384);
|
|
30
|
+
fileDescriptor = fs$1.openSync(tempPath, "wx", 384);
|
|
31
31
|
tempFileCreated = true;
|
|
32
|
-
fs.writeFileSync(fileDescriptor, content, "utf8");
|
|
33
|
-
fs.fsyncSync(fileDescriptor);
|
|
34
|
-
fs.closeSync(fileDescriptor);
|
|
32
|
+
fs$1.writeFileSync(fileDescriptor, content, "utf8");
|
|
33
|
+
fs$1.fsyncSync(fileDescriptor);
|
|
34
|
+
fs$1.closeSync(fileDescriptor);
|
|
35
35
|
fileDescriptor = void 0;
|
|
36
|
-
fs.renameSync(tempPath, filePath);
|
|
36
|
+
fs$1.renameSync(tempPath, filePath);
|
|
37
37
|
tempFileCreated = false;
|
|
38
38
|
fsyncDirectory(directory);
|
|
39
39
|
} catch (error) {
|
|
40
40
|
if (fileDescriptor !== void 0) try {
|
|
41
|
-
fs.closeSync(fileDescriptor);
|
|
41
|
+
fs$1.closeSync(fileDescriptor);
|
|
42
42
|
} catch {}
|
|
43
43
|
if (tempFileCreated) try {
|
|
44
|
-
fs.rmSync(tempPath, { force: true });
|
|
44
|
+
fs$1.rmSync(tempPath, { force: true });
|
|
45
45
|
} catch {}
|
|
46
46
|
throw error;
|
|
47
47
|
}
|
|
@@ -59,16 +59,16 @@ const PATHS = {
|
|
|
59
59
|
CONFIG_PATH: path.join(APP_DIR, "config.json")
|
|
60
60
|
};
|
|
61
61
|
async function ensurePaths() {
|
|
62
|
-
await fs
|
|
62
|
+
await fs.mkdir(path.join(PATHS.APP_DIR, AUTH_APP), { recursive: true });
|
|
63
63
|
await ensureFile(PATHS.GITHUB_TOKEN_PATH);
|
|
64
64
|
await ensureFile(PATHS.CONFIG_PATH);
|
|
65
65
|
}
|
|
66
66
|
async function ensureFile(filePath) {
|
|
67
67
|
try {
|
|
68
|
-
await fs
|
|
68
|
+
await fs.access(filePath, fs.constants.W_OK);
|
|
69
69
|
} catch {
|
|
70
|
-
await fs
|
|
71
|
-
await fs
|
|
70
|
+
await fs.writeFile(filePath, "");
|
|
71
|
+
await fs.chmod(filePath, 384);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
@@ -112,6 +112,7 @@ const defaultConfig = {
|
|
|
112
112
|
useMessagesApi: true,
|
|
113
113
|
useResponsesApiCompactionRecovery: false,
|
|
114
114
|
useResponsesApiWebSocket: true,
|
|
115
|
+
useCopilotFastTier: true,
|
|
115
116
|
responsesTransport: defaultResponsesTransportConfig,
|
|
116
117
|
useResponsesApiWebSearch: true,
|
|
117
118
|
alphaSearchCodexPriority: true,
|
|
@@ -139,11 +140,11 @@ function isNodeError(error) {
|
|
|
139
140
|
}
|
|
140
141
|
function ensureConfigFile() {
|
|
141
142
|
try {
|
|
142
|
-
fs.accessSync(PATHS.CONFIG_PATH, fs.constants.R_OK | fs.constants.W_OK);
|
|
143
|
+
fs$1.accessSync(PATHS.CONFIG_PATH, fs$1.constants.R_OK | fs$1.constants.W_OK);
|
|
143
144
|
} catch {
|
|
144
145
|
writeFileAtomically(PATHS.CONFIG_PATH, `${JSON.stringify(defaultConfig, null, 2)}\n`);
|
|
145
146
|
try {
|
|
146
|
-
fs.chmodSync(PATHS.CONFIG_PATH, 384);
|
|
147
|
+
fs$1.chmodSync(PATHS.CONFIG_PATH, 384);
|
|
147
148
|
} catch {
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
@@ -151,7 +152,7 @@ function ensureConfigFile() {
|
|
|
151
152
|
}
|
|
152
153
|
function readConfigFromDisk() {
|
|
153
154
|
ensureConfigFile();
|
|
154
|
-
const raw = fs.readFileSync(PATHS.CONFIG_PATH, "utf8");
|
|
155
|
+
const raw = fs$1.readFileSync(PATHS.CONFIG_PATH, "utf8");
|
|
155
156
|
if (!raw.trim()) {
|
|
156
157
|
writeFileAtomically(PATHS.CONFIG_PATH, `${JSON.stringify(defaultConfig, null, 2)}\n`);
|
|
157
158
|
return defaultConfig;
|
|
@@ -166,7 +167,7 @@ function readConfigFromDisk() {
|
|
|
166
167
|
}
|
|
167
168
|
function readEditableConfigFromDisk() {
|
|
168
169
|
try {
|
|
169
|
-
const raw = fs.readFileSync(PATHS.CONFIG_PATH, "utf8");
|
|
170
|
+
const raw = fs$1.readFileSync(PATHS.CONFIG_PATH, "utf8");
|
|
170
171
|
if (!raw.trim()) return {};
|
|
171
172
|
return JSON.parse(raw);
|
|
172
173
|
} catch (error) {
|
|
@@ -302,6 +303,13 @@ function isMessagesApiEnabled() {
|
|
|
302
303
|
function isResponsesApiWebSocketEnabled() {
|
|
303
304
|
return getConfig().useResponsesApiWebSocket ?? true;
|
|
304
305
|
}
|
|
306
|
+
function isCodexResponsesApiWebSocketEnabled() {
|
|
307
|
+
const config = getConfig();
|
|
308
|
+
return typeof config.useCodexResponsesApiWebSocket === "boolean" ? config.useCodexResponsesApiWebSocket : isResponsesApiWebSocketEnabled();
|
|
309
|
+
}
|
|
310
|
+
function isCopilotFastTierEnabled() {
|
|
311
|
+
return getConfig().useCopilotFastTier ?? true;
|
|
312
|
+
}
|
|
305
313
|
function getResponsesTransportConfig() {
|
|
306
314
|
const { headersTimeoutMsV2, ...config } = normalizeResponsesTransportConfig(getConfig().responsesTransport);
|
|
307
315
|
return {
|
|
@@ -440,6 +448,12 @@ function getReasoningEffortForModel(model) {
|
|
|
440
448
|
return isGpt53OrAbove(model) ? "xhigh" : "high";
|
|
441
449
|
}
|
|
442
450
|
//#endregion
|
|
451
|
+
//#region src/lib/qoder-config.ts
|
|
452
|
+
const QODER_SDK_BASE_URL = "qoder://sdk";
|
|
453
|
+
function isQoderSdkProvider(provider) {
|
|
454
|
+
return provider.name === "qoder" && provider.baseUrl === "qoder://sdk";
|
|
455
|
+
}
|
|
456
|
+
//#endregion
|
|
443
457
|
//#region src/lib/provider-config.ts
|
|
444
458
|
const OPENCODE_ANTHROPIC_MODEL_PATTERN = /^(?:qwen|minimax)/iu;
|
|
445
459
|
const OPENCODE_RESPONSES_MODEL_PATTERN = /^(?:gpt|grok|muse-spark)(?:[-_.]|$)/iu;
|
|
@@ -461,12 +475,12 @@ function resolveProviderAuthType(providerName, authType, providerType) {
|
|
|
461
475
|
consola.warn(`Provider ${providerName} has authType 'oauth2', which is only supported by the builtin codex provider, falling back to ${defaultAuthType}`);
|
|
462
476
|
return defaultAuthType;
|
|
463
477
|
}
|
|
464
|
-
if (authType === "authorization") return authType;
|
|
478
|
+
if (authType === "authorization" || authType === "azure-entra") return authType;
|
|
465
479
|
consola.warn(`Provider ${providerName} has invalid authType '${authType}', falling back to ${defaultAuthType}`);
|
|
466
480
|
return defaultAuthType;
|
|
467
481
|
}
|
|
468
482
|
function isProviderApiKeyRequired(providerName, authType) {
|
|
469
|
-
return !(providerName === "codex" && authType === "oauth2");
|
|
483
|
+
return authType !== "azure-entra" && !(providerName === "codex" && authType === "oauth2");
|
|
470
484
|
}
|
|
471
485
|
function getRawProviderConfig(name) {
|
|
472
486
|
const providerName = name.trim();
|
|
@@ -498,12 +512,12 @@ function getProviderConfig(name) {
|
|
|
498
512
|
const provider = getRawProviderConfig(providerName);
|
|
499
513
|
if (!provider) return null;
|
|
500
514
|
if (provider.enabled === false) return null;
|
|
501
|
-
const type = provider.type ?? "anthropic";
|
|
515
|
+
const type = provider.type ?? (providerName === "qoder" ? "openai-compatible" : "anthropic");
|
|
502
516
|
if (!isSupportedProviderType(type)) {
|
|
503
517
|
consola.warn(`Provider ${providerName} is ignored because type '${type}' is not supported`);
|
|
504
518
|
return null;
|
|
505
519
|
}
|
|
506
|
-
const baseUrl = normalizeProviderBaseUrl(provider.baseUrl ?? "");
|
|
520
|
+
const baseUrl = normalizeProviderBaseUrl(provider.baseUrl ?? (providerName === "qoder" ? "qoder://sdk" : ""));
|
|
507
521
|
const authType = resolveProviderAuthType(providerName, provider.authType, type);
|
|
508
522
|
const apiKey = (provider.apiKey ?? "").trim();
|
|
509
523
|
const missingFields = [...baseUrl ? [] : ["baseUrl"], ...isProviderApiKeyRequired(providerName, authType) && !apiKey ? ["apiKey"] : []];
|
|
@@ -541,4 +555,4 @@ function isReservedProviderName(name) {
|
|
|
541
555
|
return name.trim() === "copilot";
|
|
542
556
|
}
|
|
543
557
|
//#endregion
|
|
544
|
-
export {
|
|
558
|
+
export { isCodexResponsesApiWebSocketEnabled as A, writeFileAtomically as B, getAnthropicApiKey as C, getMessageApiWebSearchModel as D, getConfig as E, isResponsesApiWebSocketEnabled as F, mergeConfigWithDefaults as I, setConfiguredApiKeys as L, isMessagesApiEnabled as M, isResponsesApiCompactionRecoveryEnabled as N, getResponsesTransportConfig as O, isResponsesApiWebSearchEnabled as P, PATHS as R, getAlphaSearchModel as S, getClaudeTokenMultiplier as T, isContextManagementEnabledForResponses as _, normalizeProviderBaseUrl as a, setModelMappings as b, setProviderConfig as c, getExtraPromptForModel as d, getModelMappings as f, isContextManagementEnabledForMessages as g, getSmallModel as h, listEnabledProviders as i, isCopilotFastTierEnabled as j, isAlphaSearchCodexPriorityEnabled as k, QODER_SDK_BASE_URL as l, getReasoningEffortForModel as m, getRawProviderConfig as n, resolveEffectiveProviderType as o, getModelResponsesApiCompactThreshold as p, isSupportedProviderType as r, resolveProviderAuthType as s, getProviderConfig as t, isQoderSdkProvider as u, isGpt56OrAbove as v, getClaudeAutoModel as w, SUPPORTED_PROVIDER_TYPES as x, resolveMappedModel as y, ensurePaths as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defineCommand } from "citty";
|
|
3
|
-
import consola from "consola";
|
|
1
|
+
import { R as PATHS, i as listEnabledProviders, n as getRawProviderConfig } from "./config-DnMKoKrg.js";
|
|
4
2
|
import fs from "node:fs/promises";
|
|
5
3
|
import os from "node:os";
|
|
4
|
+
import { defineCommand } from "citty";
|
|
5
|
+
import consola from "consola";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
//#region src/debug.ts
|
|
8
8
|
async function getPackageVersion() {
|
package/dist/main.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { t as isMcpFastPath } from "./fast-path-BoMnZCVC.js";
|
|
3
3
|
//#region src/main.ts
|
|
4
4
|
if (isMcpFastPath(process.argv)) {
|
|
5
|
-
const { runMcpServer } = await import("./mcp-server-
|
|
5
|
+
const { runMcpServer } = await import("./mcp-server-Byq5DomJ.js");
|
|
6
6
|
await runMcpServer();
|
|
7
7
|
} else {
|
|
8
8
|
const { defineCommand, runMain, parseArgs } = await import("citty");
|
|
@@ -25,12 +25,12 @@ if (isMcpFastPath(process.argv)) {
|
|
|
25
25
|
if (typeof args["oauth-app"] === "string") process.env.COPILOT_API_OAUTH_APP = args["oauth-app"];
|
|
26
26
|
if (typeof args["enterprise-url"] === "string") process.env.COPILOT_API_ENTERPRISE_URL = args["enterprise-url"];
|
|
27
27
|
if (process.platform === "win32" && process.stdout.isTTY && !process.env.WT_SESSION) process.env.WT_SESSION = "copilot-api";
|
|
28
|
-
const { bindElectronFetch } = await import("./electron-fetch-
|
|
28
|
+
const { bindElectronFetch } = await import("./electron-fetch-D5uOld7F.js");
|
|
29
29
|
bindElectronFetch();
|
|
30
|
-
const { auth } = await import("./auth-
|
|
31
|
-
const { debug } = await import("./debug-
|
|
32
|
-
const { mcp } = await import("./mcp-
|
|
33
|
-
const { start } = await import("./start-
|
|
30
|
+
const { auth } = await import("./auth-DIGdDJx3.js");
|
|
31
|
+
const { debug } = await import("./debug-CuLfQpTq.js");
|
|
32
|
+
const { mcp } = await import("./mcp-DqslOG3W.js");
|
|
33
|
+
const { start } = await import("./start-WdcRgBSL.js");
|
|
34
34
|
await runMain(defineCommand({
|
|
35
35
|
meta: {
|
|
36
36
|
name: "copilot-api",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createMcpToolSearchSentinel } from "./tool-search-
|
|
1
|
+
import { n as createMcpToolSearchSentinel } from "./tool-search-DCb3HbWj.js";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|