@jeffreycao/copilot-api 1.11.6 → 1.11.8
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-BoJeL2Ok.js → server-XtSUkgmF.js} +22 -1
- package/dist/server-XtSUkgmF.js.map +1 -0
- package/dist/{start-Cc04L2jJ.js → start-DzSny0Ha.js} +2 -2
- package/dist/{start-Cc04L2jJ.js.map → start-DzSny0Ha.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-BoJeL2Ok.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -43,7 +43,7 @@ const { auth } = await import("./auth-BOghei1C.js");
|
|
|
43
43
|
const { checkUsage } = await import("./check-usage-BuLKteH9.js");
|
|
44
44
|
const { debug } = await import("./debug-BiX0ewij.js");
|
|
45
45
|
const { mcp } = await import("./mcp-DZgcvqQY.js");
|
|
46
|
-
const { start } = await import("./start-
|
|
46
|
+
const { start } = await import("./start-DzSny0Ha.js");
|
|
47
47
|
await runMain(defineCommand({
|
|
48
48
|
meta: {
|
|
49
49
|
name: "copilot-api",
|
|
@@ -1985,6 +1985,8 @@ const IDE_EXECUTE_CODE_TOOL = "mcp__ide__executeCode";
|
|
|
1985
1985
|
const IDE_GET_DIAGNOSTICS_TOOL = "mcp__ide__getDiagnostics";
|
|
1986
1986
|
const IDE_GET_DIAGNOSTICS_DESCRIPTION = "Get language diagnostics from VS Code. Returns errors, warnings, information, and hints for files in the workspace.";
|
|
1987
1987
|
const PDF_FILE_READ_PREFIX = "PDF file read:";
|
|
1988
|
+
const CLAUDE_CODE_BILLING_HEADER_PREFIX = "x-anthropic-billing-header:";
|
|
1989
|
+
const CLAUDE_CODE_CCH_SEGMENT_PATTERN = /(^|;\s*)cch=[^;]+;/u;
|
|
1988
1990
|
const createTextBlock = (text) => ({
|
|
1989
1991
|
type: "text",
|
|
1990
1992
|
text
|
|
@@ -2039,7 +2041,25 @@ const prependSystemContentToUserMessage = (message, addition) => {
|
|
|
2039
2041
|
}
|
|
2040
2042
|
message.content = [...toSystemTextBlocks(addition), ...typeof message.content === "string" ? [createTextBlock(message.content)] : message.content];
|
|
2041
2043
|
};
|
|
2044
|
+
const normalizeClaudeCodeBillingHeader = (text) => {
|
|
2045
|
+
if (!text.startsWith(CLAUDE_CODE_BILLING_HEADER_PREFIX)) return text;
|
|
2046
|
+
return text.replace(CLAUDE_CODE_CCH_SEGMENT_PATTERN, "$1cch=<stable>;");
|
|
2047
|
+
};
|
|
2048
|
+
const normalizeClaudeCodeBillingHeaderInSystem = (payload) => {
|
|
2049
|
+
const system = payload.system;
|
|
2050
|
+
if (!system) return;
|
|
2051
|
+
if (typeof system === "string") {
|
|
2052
|
+
payload.system = normalizeClaudeCodeBillingHeader(system);
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
if (system.length === 0) return;
|
|
2056
|
+
payload.system = system.map((block, index) => index === 0 ? {
|
|
2057
|
+
...block,
|
|
2058
|
+
text: normalizeClaudeCodeBillingHeader(block.text)
|
|
2059
|
+
} : block);
|
|
2060
|
+
};
|
|
2042
2061
|
const normalizeSystemMessages = (payload) => {
|
|
2062
|
+
normalizeClaudeCodeBillingHeaderInSystem(payload);
|
|
2043
2063
|
if (!payload.messages.some((msg) => msg.role === "system")) return;
|
|
2044
2064
|
const normalizedMessages = [];
|
|
2045
2065
|
let system = payload.system;
|
|
@@ -4538,6 +4558,7 @@ const createUsageRecorder = (payload, sessionId, webSearchModel) => webSearchFlo
|
|
|
4538
4558
|
*/
|
|
4539
4559
|
const tryHandleWebSearch = async (c, payload, options) => {
|
|
4540
4560
|
if (!hasWebSearchServerTool(payload)) return null;
|
|
4561
|
+
normalizeSystemMessages(payload);
|
|
4541
4562
|
const route = resolveWebSearchRoute(payload, {
|
|
4542
4563
|
webSearchModel: getMessageApiWebSearchModel(),
|
|
4543
4564
|
responsesWebSearchEnabled: isResponsesApiWebSearchEnabled()
|
|
@@ -6169,4 +6190,4 @@ server.route("/:provider/v1/models", providerModelRoutes);
|
|
|
6169
6190
|
//#endregion
|
|
6170
6191
|
export { server };
|
|
6171
6192
|
|
|
6172
|
-
//# sourceMappingURL=server-
|
|
6193
|
+
//# sourceMappingURL=server-XtSUkgmF.js.map
|