@jeffreycao/copilot-api 2.1.12 → 2.1.13
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/main.js +1 -1
- package/dist/{server-di38_SOi.js → server-DwyuQV3u.js} +9 -6
- package/dist/{server-di38_SOi.js.map → server-DwyuQV3u.js.map} +1 -1
- package/dist/{start-BAGQbk_n.js → start-CqQngxum.js} +2 -2
- package/dist/{start-BAGQbk_n.js.map → start-CqQngxum.js.map} +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -25,7 +25,7 @@ bindElectronFetch();
|
|
|
25
25
|
const { auth } = await import("./auth-PIo0IPSc.js");
|
|
26
26
|
const { debug } = await import("./debug-ChC85ySp.js");
|
|
27
27
|
const { mcp } = await import("./mcp-BG6fpi6q.js");
|
|
28
|
-
const { start } = await import("./start-
|
|
28
|
+
const { start } = await import("./start-CqQngxum.js");
|
|
29
29
|
await runMain(defineCommand({
|
|
30
30
|
meta: {
|
|
31
31
|
name: "copilot-api",
|
|
@@ -8457,7 +8457,7 @@ var ResponsesMessagesTranslationError = class extends Error {
|
|
|
8457
8457
|
}
|
|
8458
8458
|
};
|
|
8459
8459
|
function translateResponsesToMessages(payload, options) {
|
|
8460
|
-
const registry = createToolRegistry(payload);
|
|
8460
|
+
const registry = createToolRegistry(payload, options.provider);
|
|
8461
8461
|
const normalized = normalizeResponsesInput(payload.input);
|
|
8462
8462
|
const { messages, system } = translateInputToAnthropic(normalized.input, registry, payload.instructions, payload.input);
|
|
8463
8463
|
if (normalized.compaction) messages.push({
|
|
@@ -8610,10 +8610,11 @@ function normalizeResponsesInput(input) {
|
|
|
8610
8610
|
}, ...withoutTrigger.slice(latestCompactionIndex + 1)]
|
|
8611
8611
|
};
|
|
8612
8612
|
}
|
|
8613
|
-
function createToolRegistry(payload) {
|
|
8613
|
+
function createToolRegistry(payload, provider) {
|
|
8614
8614
|
const registry = {
|
|
8615
8615
|
byAlias: /* @__PURE__ */ new Map(),
|
|
8616
8616
|
byOriginal: /* @__PURE__ */ new Map(),
|
|
8617
|
+
provider,
|
|
8617
8618
|
tools: []
|
|
8618
8619
|
};
|
|
8619
8620
|
for (const tool of payload.tools ?? []) registerTool(tool, registry);
|
|
@@ -8664,7 +8665,7 @@ function registerMessagesTool(registration, registry) {
|
|
|
8664
8665
|
type: "object",
|
|
8665
8666
|
properties: {}
|
|
8666
8667
|
},
|
|
8667
|
-
...registration.kind === "custom" ? { strict: true } : {}
|
|
8668
|
+
...registration.kind === "custom" && registry.provider !== "kimi" ? { strict: true } : {}
|
|
8668
8669
|
});
|
|
8669
8670
|
return descriptor;
|
|
8670
8671
|
}
|
|
@@ -9925,6 +9926,7 @@ async function handleResponsesViaMessages(c, options) {
|
|
|
9925
9926
|
model: options.publicModel
|
|
9926
9927
|
}, {
|
|
9927
9928
|
model: options.targetModel,
|
|
9929
|
+
provider: options.provider,
|
|
9928
9930
|
publicModel: options.publicModel
|
|
9929
9931
|
});
|
|
9930
9932
|
const context = translation;
|
|
@@ -10000,6 +10002,7 @@ async function handleProviderResponsesForProvider(c, options) {
|
|
|
10000
10002
|
normalizeProviderResponsesReasoningEffort(payload, providerConfig);
|
|
10001
10003
|
if (shouldFallbackToMessages$1(c, payload.model, effectiveType)) return await handleResponsesViaMessages(c, {
|
|
10002
10004
|
payload,
|
|
10005
|
+
provider: providerConfig.name,
|
|
10003
10006
|
publicModel: options.publicModel ?? payload.model,
|
|
10004
10007
|
targetModel: `${provider}/${payload.model}`
|
|
10005
10008
|
});
|
|
@@ -10041,7 +10044,7 @@ async function handleProviderResponsesForProvider(c, options) {
|
|
|
10041
10044
|
}
|
|
10042
10045
|
const shouldFallbackToMessages$1 = (c, modelId, effectiveType) => {
|
|
10043
10046
|
if (effectiveType === "anthropic" || effectiveType === "openai-compatible") return true;
|
|
10044
|
-
if (isCodexUserAgent(c.req.header("user-agent"))) return !modelId.startsWith("gpt");
|
|
10047
|
+
if (isCodexUserAgent(c.req.header("user-agent"))) return !(modelId.startsWith("gpt") || modelId.startsWith("codex"));
|
|
10045
10048
|
return false;
|
|
10046
10049
|
};
|
|
10047
10050
|
const createProviderResponsesUsageRecorder = (payload, provider, modelConfig, pricingCurrency) => {
|
|
@@ -10298,7 +10301,7 @@ const handleResponses = async (c) => {
|
|
|
10298
10301
|
};
|
|
10299
10302
|
const isStreamingRequested = (payload) => Boolean(payload.stream);
|
|
10300
10303
|
const shouldFallbackToMessages = (c, modelId, selectedModel, responsesTransport) => {
|
|
10301
|
-
if (isCodexUserAgent(c.req.header("user-agent"))) return !modelId.startsWith("gpt");
|
|
10304
|
+
if (isCodexUserAgent(c.req.header("user-agent"))) return !(modelId.startsWith("gpt") || modelId.startsWith("codex"));
|
|
10302
10305
|
if (responsesTransport) return false;
|
|
10303
10306
|
const supportedEndpoints = selectedModel?.supported_endpoints ?? [];
|
|
10304
10307
|
return supportedEndpoints.includes("/v1/messages") || supportedEndpoints.includes("/chat/completions");
|
|
@@ -10499,4 +10502,4 @@ server.route("/:provider/images", providerImageRoutes);
|
|
|
10499
10502
|
//#endregion
|
|
10500
10503
|
export { server };
|
|
10501
10504
|
|
|
10502
|
-
//# sourceMappingURL=server-
|
|
10505
|
+
//# sourceMappingURL=server-DwyuQV3u.js.map
|