@jeffreycao/copilot-api 2.7.7 → 2.7.9
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-CClOz6YS.js → server-HJmO_wDI.js} +13 -12
- package/dist/server-HJmO_wDI.js.map +1 -0
- package/dist/{start-y2hlYweN.js → start-Zh1mijTN.js} +2 -2
- package/dist/{start-y2hlYweN.js.map → start-Zh1mijTN.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-CClOz6YS.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-Zh1mijTN.js");
|
|
34
34
|
const { provider } = await import("./provider-CzziTLqX.js");
|
|
35
35
|
await runMain(defineCommand({
|
|
36
36
|
meta: {
|
|
@@ -30,7 +30,7 @@ const traceIdMiddleware = async (c, next) => {
|
|
|
30
30
|
traceId,
|
|
31
31
|
startTime: Date.now(),
|
|
32
32
|
userAgent: c.req.header("user-agent") || "",
|
|
33
|
-
sessionAffinity: c.req.header("x-session-affinity") ?? c.req.header("x-client-request-id"),
|
|
33
|
+
sessionAffinity: c.req.header("x-opencode-session-id") ?? c.req.header("x-session-affinity") ?? c.req.header("x-client-request-id"),
|
|
34
34
|
parentSessionId: c.req.header("x-parent-session-id")
|
|
35
35
|
};
|
|
36
36
|
await requestContext.run(context, async () => {
|
|
@@ -6830,7 +6830,7 @@ var ResponsesMessagesTranslationError = class extends Error {
|
|
|
6830
6830
|
};
|
|
6831
6831
|
function translateResponsesToMessages(payload, options) {
|
|
6832
6832
|
removeWebSearchTool$1(payload);
|
|
6833
|
-
const registry = createToolRegistry(payload);
|
|
6833
|
+
const registry = createToolRegistry(payload, options.model);
|
|
6834
6834
|
const normalized = normalizeResponsesInput(payload.input);
|
|
6835
6835
|
const outputFormatInstruction = buildOutputFormatInstruction(payload.text?.format);
|
|
6836
6836
|
const { messages, system } = translateInputToAnthropic(normalized.input, registry, payload.instructions, payload.input, options.toolCallTips ?? false);
|
|
@@ -7008,27 +7008,28 @@ function removeWebSearchTool$1(payload) {
|
|
|
7008
7008
|
if (!Array.isArray(payload.tools) || payload.tools.length === 0) return;
|
|
7009
7009
|
payload.tools = payload.tools.filter((tool) => tool.type !== "web_search");
|
|
7010
7010
|
}
|
|
7011
|
-
function createToolRegistry(payload) {
|
|
7011
|
+
function createToolRegistry(payload, model) {
|
|
7012
|
+
const strictCustomTools = !(parseProviderModelAlias(model)?.model ?? model).toLowerCase().includes("claude");
|
|
7012
7013
|
const registry = {
|
|
7013
7014
|
byAlias: /* @__PURE__ */ new Map(),
|
|
7014
7015
|
byOriginal: /* @__PURE__ */ new Map(),
|
|
7015
7016
|
tools: []
|
|
7016
7017
|
};
|
|
7017
|
-
for (const tool of payload.tools ?? []) registerTool(tool, registry);
|
|
7018
|
+
for (const tool of payload.tools ?? []) registerTool(tool, registry, strictCustomTools);
|
|
7018
7019
|
if (Array.isArray(payload.input)) for (const item of payload.input) {
|
|
7019
7020
|
if (getItemType(item) !== "additional_tools") continue;
|
|
7020
|
-
for (const tool of getArrayField(item, "tools")) registerTool(tool, registry);
|
|
7021
|
+
for (const tool of getArrayField(item, "tools")) registerTool(tool, registry, strictCustomTools);
|
|
7021
7022
|
}
|
|
7022
7023
|
return registry;
|
|
7023
7024
|
}
|
|
7024
|
-
function registerTool(tool, registry, namespaces = []) {
|
|
7025
|
+
function registerTool(tool, registry, strictCustomTools, namespaces = []) {
|
|
7025
7026
|
if (!isRecord$1(tool)) throw new ResponsesMessagesTranslationError("Invalid Responses tool definition");
|
|
7026
7027
|
const type = getStringField$1(tool, "type");
|
|
7027
7028
|
if (type === "namespace") {
|
|
7028
7029
|
const namespaceTool = tool;
|
|
7029
7030
|
const namespace = getStringField$1(namespaceTool, "name");
|
|
7030
7031
|
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]);
|
|
7032
|
+
for (const child of namespaceTool.tools) registerTool(child, registry, strictCustomTools, [...namespaces, namespace]);
|
|
7032
7033
|
return;
|
|
7033
7034
|
}
|
|
7034
7035
|
if (type !== "function" && type !== "custom") throw new ResponsesMessagesTranslationError(`Responses Messages fallback does not support tool${type ? ` '${type}'` : " without a type"}`);
|
|
@@ -7040,9 +7041,9 @@ function registerTool(tool, registry, namespaces = []) {
|
|
|
7040
7041
|
namespace: namespaces.length > 0 ? namespaces.join(".") : void 0,
|
|
7041
7042
|
description: getOptionalStringField(tool, "description"),
|
|
7042
7043
|
parameters: type === "function" && isRecord$1(tool.parameters) ? tool.parameters : null
|
|
7043
|
-
}, registry);
|
|
7044
|
+
}, registry, strictCustomTools);
|
|
7044
7045
|
}
|
|
7045
|
-
function registerMessagesTool(registration, registry) {
|
|
7046
|
+
function registerMessagesTool(registration, registry, strictCustomTools) {
|
|
7046
7047
|
const originalKey = createOriginalToolKey(registration);
|
|
7047
7048
|
const existing = registry.byOriginal.get(originalKey);
|
|
7048
7049
|
if (existing) return existing;
|
|
@@ -7056,7 +7057,7 @@ function registerMessagesTool(registration, registry) {
|
|
|
7056
7057
|
type: "object",
|
|
7057
7058
|
properties: {}
|
|
7058
7059
|
},
|
|
7059
|
-
...registration.kind === "custom" ? { strict: true } : {}
|
|
7060
|
+
...registration.kind === "custom" && strictCustomTools ? { strict: true } : {}
|
|
7060
7061
|
});
|
|
7061
7062
|
return descriptor;
|
|
7062
7063
|
}
|
|
@@ -13063,7 +13064,7 @@ const handleResponses = async (c) => {
|
|
|
13063
13064
|
if (subagentMarker) debugJson(logger$1, "Detected Codex subagent headers:", subagentMarker);
|
|
13064
13065
|
const incomingSessionId = getIncomingResponsesSessionId(c);
|
|
13065
13066
|
const sessionId = incomingSessionId ? getUUID(incomingSessionId) : void 0;
|
|
13066
|
-
const threadId = c.req.header("thread-id");
|
|
13067
|
+
const threadId = c.req.header("thread-id") ?? c.req.header("x-opencode-session-id");
|
|
13067
13068
|
const requestId = threadId ? getUUID(threadId + "_") : generateRequestIdFromPayload({ messages: payload.input }, sessionId);
|
|
13068
13069
|
logger$1.debug("Generated request ID:", requestId);
|
|
13069
13070
|
const fallbackSessionId = sessionId ?? getUUID(requestId);
|
|
@@ -13370,4 +13371,4 @@ createServer();
|
|
|
13370
13371
|
//#endregion
|
|
13371
13372
|
export { createServer };
|
|
13372
13373
|
|
|
13373
|
-
//# sourceMappingURL=server-
|
|
13374
|
+
//# sourceMappingURL=server-HJmO_wDI.js.map
|