@jeffreycao/copilot-api 2.7.8 → 2.7.10
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-VyniyKln.js → server-1fLM5e0J.js} +13 -11
- package/dist/server-1fLM5e0J.js.map +1 -0
- package/dist/{start-B2NhKxEK.js → start-DAQ6_2QN.js} +2 -2
- package/dist/{start-B2NhKxEK.js.map → start-DAQ6_2QN.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-VyniyKln.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -30,7 +30,7 @@ if (isMcpFastPath(process.argv)) {
|
|
|
30
30
|
const { auth } = await import("./auth-BzYvzeW0.js");
|
|
31
31
|
const { debug } = await import("./debug-CmL-V7Ov.js");
|
|
32
32
|
const { mcp } = await import("./mcp-Dd_hxxuG.js");
|
|
33
|
-
const { start } = await import("./start-
|
|
33
|
+
const { start } = await import("./start-DAQ6_2QN.js");
|
|
34
34
|
const { provider } = await import("./provider-CzziTLqX.js");
|
|
35
35
|
await runMain(defineCommand({
|
|
36
36
|
meta: {
|
|
@@ -4767,9 +4767,10 @@ const normalizeClaudeCodeBillingHeaderInSystem = (payload) => {
|
|
|
4767
4767
|
text: normalizeClaudeCodeBillingHeader(block.text)
|
|
4768
4768
|
} : block);
|
|
4769
4769
|
};
|
|
4770
|
+
const supportsMidSystemMessages = (model) => model.startsWith("gpt") || model.startsWith("codex") || model.startsWith("claude");
|
|
4770
4771
|
const normalizeSystemMessages = (payload) => {
|
|
4771
4772
|
normalizeClaudeCodeBillingHeaderInSystem(payload);
|
|
4772
|
-
if (
|
|
4773
|
+
if (supportsMidSystemMessages(payload.model)) return;
|
|
4773
4774
|
if (!payload.messages.some((msg) => msg.role === "system")) return;
|
|
4774
4775
|
const normalizedMessages = [];
|
|
4775
4776
|
let system = payload.system;
|
|
@@ -6830,7 +6831,7 @@ var ResponsesMessagesTranslationError = class extends Error {
|
|
|
6830
6831
|
};
|
|
6831
6832
|
function translateResponsesToMessages(payload, options) {
|
|
6832
6833
|
removeWebSearchTool$1(payload);
|
|
6833
|
-
const registry = createToolRegistry(payload);
|
|
6834
|
+
const registry = createToolRegistry(payload, options.model);
|
|
6834
6835
|
const normalized = normalizeResponsesInput(payload.input);
|
|
6835
6836
|
const outputFormatInstruction = buildOutputFormatInstruction(payload.text?.format);
|
|
6836
6837
|
const { messages, system } = translateInputToAnthropic(normalized.input, registry, payload.instructions, payload.input, options.toolCallTips ?? false);
|
|
@@ -7008,27 +7009,28 @@ function removeWebSearchTool$1(payload) {
|
|
|
7008
7009
|
if (!Array.isArray(payload.tools) || payload.tools.length === 0) return;
|
|
7009
7010
|
payload.tools = payload.tools.filter((tool) => tool.type !== "web_search");
|
|
7010
7011
|
}
|
|
7011
|
-
function createToolRegistry(payload) {
|
|
7012
|
+
function createToolRegistry(payload, model) {
|
|
7013
|
+
const strictCustomTools = !(parseProviderModelAlias(model)?.model ?? model).toLowerCase().includes("claude");
|
|
7012
7014
|
const registry = {
|
|
7013
7015
|
byAlias: /* @__PURE__ */ new Map(),
|
|
7014
7016
|
byOriginal: /* @__PURE__ */ new Map(),
|
|
7015
7017
|
tools: []
|
|
7016
7018
|
};
|
|
7017
|
-
for (const tool of payload.tools ?? []) registerTool(tool, registry);
|
|
7019
|
+
for (const tool of payload.tools ?? []) registerTool(tool, registry, strictCustomTools);
|
|
7018
7020
|
if (Array.isArray(payload.input)) for (const item of payload.input) {
|
|
7019
7021
|
if (getItemType(item) !== "additional_tools") continue;
|
|
7020
|
-
for (const tool of getArrayField(item, "tools")) registerTool(tool, registry);
|
|
7022
|
+
for (const tool of getArrayField(item, "tools")) registerTool(tool, registry, strictCustomTools);
|
|
7021
7023
|
}
|
|
7022
7024
|
return registry;
|
|
7023
7025
|
}
|
|
7024
|
-
function registerTool(tool, registry, namespaces = []) {
|
|
7026
|
+
function registerTool(tool, registry, strictCustomTools, namespaces = []) {
|
|
7025
7027
|
if (!isRecord$1(tool)) throw new ResponsesMessagesTranslationError("Invalid Responses tool definition");
|
|
7026
7028
|
const type = getStringField$1(tool, "type");
|
|
7027
7029
|
if (type === "namespace") {
|
|
7028
7030
|
const namespaceTool = tool;
|
|
7029
7031
|
const namespace = getStringField$1(namespaceTool, "name");
|
|
7030
7032
|
if (!namespace || !Array.isArray(namespaceTool.tools)) throw new ResponsesMessagesTranslationError("Responses namespace tools require a name and tools array");
|
|
7031
|
-
for (const child of namespaceTool.tools) registerTool(child, registry, [...namespaces, namespace]);
|
|
7033
|
+
for (const child of namespaceTool.tools) registerTool(child, registry, strictCustomTools, [...namespaces, namespace]);
|
|
7032
7034
|
return;
|
|
7033
7035
|
}
|
|
7034
7036
|
if (type !== "function" && type !== "custom") throw new ResponsesMessagesTranslationError(`Responses Messages fallback does not support tool${type ? ` '${type}'` : " without a type"}`);
|
|
@@ -7040,9 +7042,9 @@ function registerTool(tool, registry, namespaces = []) {
|
|
|
7040
7042
|
namespace: namespaces.length > 0 ? namespaces.join(".") : void 0,
|
|
7041
7043
|
description: getOptionalStringField(tool, "description"),
|
|
7042
7044
|
parameters: type === "function" && isRecord$1(tool.parameters) ? tool.parameters : null
|
|
7043
|
-
}, registry);
|
|
7045
|
+
}, registry, strictCustomTools);
|
|
7044
7046
|
}
|
|
7045
|
-
function registerMessagesTool(registration, registry) {
|
|
7047
|
+
function registerMessagesTool(registration, registry, strictCustomTools) {
|
|
7046
7048
|
const originalKey = createOriginalToolKey(registration);
|
|
7047
7049
|
const existing = registry.byOriginal.get(originalKey);
|
|
7048
7050
|
if (existing) return existing;
|
|
@@ -7056,7 +7058,7 @@ function registerMessagesTool(registration, registry) {
|
|
|
7056
7058
|
type: "object",
|
|
7057
7059
|
properties: {}
|
|
7058
7060
|
},
|
|
7059
|
-
...registration.kind === "custom" ? { strict: true } : {}
|
|
7061
|
+
...registration.kind === "custom" && strictCustomTools ? { strict: true } : {}
|
|
7060
7062
|
});
|
|
7061
7063
|
return descriptor;
|
|
7062
7064
|
}
|
|
@@ -13370,4 +13372,4 @@ createServer();
|
|
|
13370
13372
|
//#endregion
|
|
13371
13373
|
export { createServer };
|
|
13372
13374
|
|
|
13373
|
-
//# sourceMappingURL=server-
|
|
13375
|
+
//# sourceMappingURL=server-1fLM5e0J.js.map
|