@nick3/copilot-api 1.10.4 → 1.10.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/README.md +53 -8
- package/README.zh-CN.md +52 -7
- package/dist/admin/assets/{index-DG4TRVMu.js → index-BAh4eOwM.js} +36 -36
- package/dist/admin/index.html +1 -1
- package/dist/main.js +4 -2
- package/dist/main.js.map +1 -1
- package/dist/mcp-9Hgepkc5.js +37 -0
- package/dist/mcp-9Hgepkc5.js.map +1 -0
- package/dist/{proxy-BwmADhKh.js → proxy-_U-hgwIn.js} +1 -2
- package/dist/proxy-_U-hgwIn.js.map +1 -0
- package/dist/{server-DxQsi1x2.js → server-DulP9mYd.js} +251 -66
- package/dist/server-DulP9mYd.js.map +1 -0
- package/dist/{start-8QHzPrcg.js → start-CtEoE2gt.js} +3 -3
- package/dist/{start-8QHzPrcg.js.map → start-CtEoE2gt.js.map} +1 -1
- package/dist/tool-search-BrN7M0Dd.js +110 -0
- package/dist/tool-search-BrN7M0Dd.js.map +1 -0
- package/package.json +3 -6
- package/dist/proxy-BwmADhKh.js.map +0 -1
- package/dist/server-DxQsi1x2.js.map +0 -1
package/dist/admin/index.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
})()
|
|
20
20
|
</script>
|
|
21
|
-
<script type="module" crossorigin src="/admin/assets/index-
|
|
21
|
+
<script type="module" crossorigin src="/admin/assets/index-BAh4eOwM.js"></script>
|
|
22
22
|
<link rel="stylesheet" crossorigin href="/admin/assets/index-CBMFCvqO.css">
|
|
23
23
|
</head>
|
|
24
24
|
<body>
|
package/dist/main.js
CHANGED
|
@@ -22,7 +22,8 @@ if (typeof args["enterprise-url"] === "string") process.env.COPILOT_API_ENTERPRI
|
|
|
22
22
|
const { auth } = await import("./auth-B0y-2njL.js");
|
|
23
23
|
const { checkUsage } = await import("./check-usage-DdevqHE5.js");
|
|
24
24
|
const { debug } = await import("./debug-BMo6ltbp.js");
|
|
25
|
-
const {
|
|
25
|
+
const { mcp } = await import("./mcp-9Hgepkc5.js");
|
|
26
|
+
const { start } = await import("./start-CtEoE2gt.js");
|
|
26
27
|
await runMain(defineCommand({
|
|
27
28
|
meta: {
|
|
28
29
|
name: "copilot-api",
|
|
@@ -32,7 +33,8 @@ await runMain(defineCommand({
|
|
|
32
33
|
auth,
|
|
33
34
|
start,
|
|
34
35
|
"check-usage": checkUsage,
|
|
35
|
-
debug
|
|
36
|
+
debug,
|
|
37
|
+
mcp
|
|
36
38
|
},
|
|
37
39
|
args: cliArgs
|
|
38
40
|
}));
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { defineCommand, runMain, parseArgs } from \"citty\"\n\nconst cliArgs = {\n \"api-home\": {\n type: \"string\",\n description: \"Path to the API home directory.\",\n },\n \"oauth-app\": {\n type: \"string\",\n description: \"OAuth app identifier.\",\n },\n \"enterprise-url\": {\n type: \"string\",\n description: \"Enterprise URL for GitHub.\",\n },\n} as const\n\nconst args = parseArgs(process.argv, cliArgs)\n\n// Set environment variables before loading other modules\nif (typeof args[\"api-home\"] === \"string\") {\n process.env.COPILOT_API_HOME = args[\"api-home\"]\n}\nif (typeof args[\"oauth-app\"] === \"string\") {\n process.env.COPILOT_API_OAUTH_APP = args[\"oauth-app\"]\n}\nif (typeof args[\"enterprise-url\"] === \"string\") {\n process.env.COPILOT_API_ENTERPRISE_URL = args[\"enterprise-url\"]\n}\n\n// Dynamically import other modules to ensure environment variables are set\nconst { auth } = await import(\"./auth\")\nconst { checkUsage } = await import(\"./check-usage\")\nconst { debug } = await import(\"./debug\")\nconst { start } = await import(\"./start\")\n\nconst main = defineCommand({\n meta: {\n name: \"copilot-api\",\n description:\n \"A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools.\",\n },\n subCommands: { auth, start, \"check-usage\": checkUsage, debug },\n args: cliArgs,\n})\n\nawait runMain(main)\n"],"mappings":";;;AAIA,MAAM,UAAU;CACd,YAAY;EACV,MAAM;EACN,aAAa;EACd;CACD,aAAa;EACX,MAAM;EACN,aAAa;EACd;CACD,kBAAkB;EAChB,MAAM;EACN,aAAa;EACd;CACF;AAED,MAAM,OAAO,UAAU,QAAQ,MAAM,QAAQ;AAG7C,IAAI,OAAO,KAAK,gBAAgB,UAC9B,QAAQ,IAAI,mBAAmB,KAAK;AAEtC,IAAI,OAAO,KAAK,iBAAiB,UAC/B,QAAQ,IAAI,wBAAwB,KAAK;AAE3C,IAAI,OAAO,KAAK,sBAAsB,UACpC,QAAQ,IAAI,6BAA6B,KAAK;AAIhD,MAAM,EAAE,SAAS,MAAM,OAAO;AAC9B,MAAM,EAAE,eAAe,MAAM,OAAO;AACpC,MAAM,EAAE,UAAU,MAAM,OAAO;AAC/B,MAAM,EAAE,UAAU,MAAM,OAAO;AAY/B,MAAM,QAVO,cAAc;CACzB,MAAM;EACJ,MAAM;EACN,aACE;EACH;CACD,aAAa;EAAE;EAAM;EAAO,eAAe;EAAY;EAAO;
|
|
1
|
+
{"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { defineCommand, runMain, parseArgs } from \"citty\"\n\nconst cliArgs = {\n \"api-home\": {\n type: \"string\",\n description: \"Path to the API home directory.\",\n },\n \"oauth-app\": {\n type: \"string\",\n description: \"OAuth app identifier.\",\n },\n \"enterprise-url\": {\n type: \"string\",\n description: \"Enterprise URL for GitHub.\",\n },\n} as const\n\nconst args = parseArgs(process.argv, cliArgs)\n\n// Set environment variables before loading other modules\nif (typeof args[\"api-home\"] === \"string\") {\n process.env.COPILOT_API_HOME = args[\"api-home\"]\n}\nif (typeof args[\"oauth-app\"] === \"string\") {\n process.env.COPILOT_API_OAUTH_APP = args[\"oauth-app\"]\n}\nif (typeof args[\"enterprise-url\"] === \"string\") {\n process.env.COPILOT_API_ENTERPRISE_URL = args[\"enterprise-url\"]\n}\n\n// Dynamically import other modules to ensure environment variables are set\nconst { auth } = await import(\"./auth\")\nconst { checkUsage } = await import(\"./check-usage\")\nconst { debug } = await import(\"./debug\")\nconst { mcp } = await import(\"./mcp\")\nconst { start } = await import(\"./start\")\n\nconst main = defineCommand({\n meta: {\n name: \"copilot-api\",\n description:\n \"A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools.\",\n },\n subCommands: { auth, start, \"check-usage\": checkUsage, debug, mcp },\n args: cliArgs,\n})\n\nawait runMain(main)\n"],"mappings":";;;AAIA,MAAM,UAAU;CACd,YAAY;EACV,MAAM;EACN,aAAa;EACd;CACD,aAAa;EACX,MAAM;EACN,aAAa;EACd;CACD,kBAAkB;EAChB,MAAM;EACN,aAAa;EACd;CACF;AAED,MAAM,OAAO,UAAU,QAAQ,MAAM,QAAQ;AAG7C,IAAI,OAAO,KAAK,gBAAgB,UAC9B,QAAQ,IAAI,mBAAmB,KAAK;AAEtC,IAAI,OAAO,KAAK,iBAAiB,UAC/B,QAAQ,IAAI,wBAAwB,KAAK;AAE3C,IAAI,OAAO,KAAK,sBAAsB,UACpC,QAAQ,IAAI,6BAA6B,KAAK;AAIhD,MAAM,EAAE,SAAS,MAAM,OAAO;AAC9B,MAAM,EAAE,eAAe,MAAM,OAAO;AACpC,MAAM,EAAE,UAAU,MAAM,OAAO;AAC/B,MAAM,EAAE,QAAQ,MAAM,OAAO;AAC7B,MAAM,EAAE,UAAU,MAAM,OAAO;AAY/B,MAAM,QAVO,cAAc;CACzB,MAAM;EACJ,MAAM;EACN,aACE;EACH;CACD,aAAa;EAAE;EAAM;EAAO,eAAe;EAAY;EAAO;EAAK;CACnE,MAAM;CACP,CAEiB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { n as createMcpToolSearchSentinel } from "./tool-search-BrN7M0Dd.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
//#region src/mcp.ts
|
|
7
|
+
const SERVER_NAME = "tool_search";
|
|
8
|
+
const SERVER_VERSION = "1.0.0";
|
|
9
|
+
const runMcpServer = async () => {
|
|
10
|
+
const server = new McpServer({
|
|
11
|
+
name: SERVER_NAME,
|
|
12
|
+
version: SERVER_VERSION
|
|
13
|
+
});
|
|
14
|
+
server.registerTool("search", {
|
|
15
|
+
title: "Tool Search Bridge",
|
|
16
|
+
description: "Load deferred tools by exact name through the Copilot API tool_search bridge.",
|
|
17
|
+
inputSchema: { names: z.string().describe("Comma-separated exact deferred tool names to load, for example \"TaskList,TaskGet,mcp__fetch__fetch\".") },
|
|
18
|
+
_meta: { "anthropic/alwaysLoad": true }
|
|
19
|
+
}, ({ names }) => ({ content: [{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: createMcpToolSearchSentinel(names)
|
|
22
|
+
}] }));
|
|
23
|
+
await server.connect(new StdioServerTransport());
|
|
24
|
+
};
|
|
25
|
+
const mcp = defineCommand({
|
|
26
|
+
meta: {
|
|
27
|
+
name: "mcp",
|
|
28
|
+
description: "Start the Copilot API MCP tool_search bridge over stdio"
|
|
29
|
+
},
|
|
30
|
+
run() {
|
|
31
|
+
return runMcpServer();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { mcp };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=mcp-9Hgepkc5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-9Hgepkc5.js","names":[],"sources":["../src/mcp.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\"\nimport { defineCommand } from \"citty\"\nimport { z } from \"zod\"\n\nimport { createMcpToolSearchSentinel } from \"./lib/tool-search\"\n\nconst SERVER_NAME = \"tool_search\"\nconst SERVER_VERSION = \"1.0.0\"\n\nexport const runMcpServer = async (): Promise<void> => {\n const server = new McpServer({\n name: SERVER_NAME,\n version: SERVER_VERSION,\n })\n\n server.registerTool(\n \"search\",\n {\n title: \"Tool Search Bridge\",\n description:\n \"Load deferred tools by exact name through the Copilot API tool_search bridge.\",\n inputSchema: {\n names: z\n .string()\n .describe(\n 'Comma-separated exact deferred tool names to load, for example \"TaskList,TaskGet,mcp__fetch__fetch\".',\n ),\n },\n _meta: {\n \"anthropic/alwaysLoad\": true,\n },\n },\n ({ names }) => ({\n content: [\n {\n type: \"text\",\n text: createMcpToolSearchSentinel(names),\n },\n ],\n }),\n )\n\n await server.connect(new StdioServerTransport())\n}\n\nexport const mcp = defineCommand({\n meta: {\n name: \"mcp\",\n description: \"Start the Copilot API MCP tool_search bridge over stdio\",\n },\n run() {\n return runMcpServer()\n },\n})\n"],"mappings":";;;;;;AASA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAEvB,MAAa,eAAe,YAA2B;CACrD,MAAM,SAAS,IAAI,UAAU;EAC3B,MAAM;EACN,SAAS;EACV,CAAC;CAEF,OAAO,aACL,UACA;EACE,OAAO;EACP,aACE;EACF,aAAa,EACX,OAAO,EACJ,QAAQ,CACR,SACC,yGACD,EACJ;EACD,OAAO,EACL,wBAAwB,MACzB;EACF,GACA,EAAE,aAAa,EACd,SAAS,CACP;EACE,MAAM;EACN,MAAM,4BAA4B,MAAM;EACzC,CACF,EACF,EACF;CAED,MAAM,OAAO,QAAQ,IAAI,sBAAsB,CAAC;;AAGlD,MAAa,MAAM,cAAc;CAC/B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,OAAO,cAAc;;CAExB,CAAC"}
|
|
@@ -64,7 +64,6 @@ const defaultConfig = {
|
|
|
64
64
|
"gpt-5.5": "xhigh"
|
|
65
65
|
},
|
|
66
66
|
allowOriginalModelNamesForAliases: false,
|
|
67
|
-
useFunctionApplyPatch: true,
|
|
68
67
|
forceAgent: false,
|
|
69
68
|
compactUseSmallModel: true,
|
|
70
69
|
messageStartInputTokensFallback: false,
|
|
@@ -3313,4 +3312,4 @@ function initProxyFromEnv() {
|
|
|
3313
3312
|
//#endregion
|
|
3314
3313
|
export { getModelRefreshIntervalMs as A, isResponsesApiWebSocketEnabled as B, getAnthropicApiKey as C, getLogLevel as D, getExtraPromptForModel as E, isForceAgentEnabled as F, resolveModelAlias as H, isMessageStartInputTokensFallbackEnabled as I, isMessagesApiEnabled as L, getReasoningEffortForModel as M, getSmallModel as N, getModelAliases as O, isAccountAffinityEnabled as P, isResponsesApiContextManagementModel as R, getAliasTargetSet as S, getConfig as T, shouldCompactUseSmallModel as U, mergeConfigWithDefaults as V, toLocalDateString as _, stopQuotaRefreshScheduler as a, isDevModeEnabled as b, applySharedSessionAffinityRetention as c, getClientIpInfo as d, getRequestHistoryStore as f, normalizeMessagesUsage as g, normalizeEmbeddingsUsage as h, startQuotaRefreshSchedulerFromConfig as i, getProviderConfig as j, getModelAliasesInfo as k, extractResponsesUsageFromResult as l, normalizeChatCompletionsUsage as m, initProxyFromEnv as n, updateQuotaRefreshSchedulerFromConfig as o, getStatsStore as p, registerQuotaRefreshSchedulerShutdownCleanup as r, accountsManager as s, getProxyEnvDispatcher as t, extractResponsesUsageFromStreamEvent as u, copilotFetch as v, getClaudeTokenMultiplier as w, PROVIDER_TYPE_ANTHROPIC as x, flushPendingCapture as y, isResponsesApiWebSearchEnabled as z };
|
|
3315
3314
|
|
|
3316
|
-
//# sourceMappingURL=proxy-
|
|
3315
|
+
//# sourceMappingURL=proxy-_U-hgwIn.js.map
|