@jeffreycao/copilot-api 2.7.5 → 2.7.6
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/{auth-CJH114yD.js → auth-MHYBC-Hj.js} +4 -4
- package/dist/{auth-CJH114yD.js.map → auth-MHYBC-Hj.js.map} +1 -1
- package/dist/auth-u5nqh-_U.js +2 -0
- package/dist/{config-D1F-TyTn.js → config-CZdq_04f.js} +2 -2
- package/dist/{config-D1F-TyTn.js.map → config-CZdq_04f.js.map} +1 -1
- package/dist/{config-store-Bgmf82i_.js → config-store-BD3_fWvY.js} +96 -6
- package/dist/config-store-BD3_fWvY.js.map +1 -0
- package/dist/{copilot-runtime-DcUOmm60.js → copilot-runtime-D-_s8L_X.js} +3 -3
- package/dist/{copilot-runtime-DcUOmm60.js.map → copilot-runtime-D-_s8L_X.js.map} +1 -1
- package/dist/{debug-EkODckEE.js → debug-C8yoWFl7.js} +3 -3
- package/dist/{debug-EkODckEE.js.map → debug-C8yoWFl7.js.map} +1 -1
- package/dist/main.js +6 -6
- package/dist/{mcp-CuZyqwi8.js → mcp-Dd_hxxuG.js} +2 -2
- package/dist/{mcp-CuZyqwi8.js.map → mcp-Dd_hxxuG.js.map} +1 -1
- package/dist/mcp-server-CEfcUYiN.js +2 -0
- package/dist/{mcp-server-CKEydKaf.js → mcp-server-CTGaok8g.js} +2 -2
- package/dist/{mcp-server-CKEydKaf.js.map → mcp-server-CTGaok8g.js.map} +1 -1
- package/dist/{provider-DXivPd6W.js → provider-BNOCmFw9.js} +2 -2
- package/dist/{provider-DXivPd6W.js.map → provider-BNOCmFw9.js.map} +1 -1
- package/dist/{provider-management-DiQ92JMT.js → provider-management-Du98I_tf.js} +2 -3
- package/dist/{provider-management-DiQ92JMT.js.map → provider-management-Du98I_tf.js.map} +1 -1
- package/dist/{server-CrRNnmrV.js → server-CB_RoZhM.js} +24 -12
- package/dist/server-CB_RoZhM.js.map +1 -0
- package/dist/{start-Caypc0jJ.js → start-oHifz6_B.js} +7 -8
- package/dist/{start-Caypc0jJ.js.map → start-oHifz6_B.js.map} +1 -1
- package/dist/{token-ByHtI6Ox.js → token-D84GjiaE.js} +4 -13
- package/dist/token-D84GjiaE.js.map +1 -0
- package/dist/{tool-search-BgFcDbNQ.js → tool-search-CcvaqM03.js} +3 -1
- package/dist/tool-search-CcvaqM03.js.map +1 -0
- package/package.json +1 -1
- package/dist/auth-q4_lJtX6.js +0 -2
- package/dist/config-store-Bgmf82i_.js.map +0 -1
- package/dist/github-copilot-provider-Cx4Afaco.js +0 -79
- package/dist/github-copilot-provider-Cx4Afaco.js.map +0 -1
- package/dist/mcp-server-BH-SFdCD.js +0 -2
- package/dist/server-CrRNnmrV.js.map +0 -1
- package/dist/token-ByHtI6Ox.js.map +0 -1
- package/dist/tool-search-BgFcDbNQ.js.map +0 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { a as getAnthropicApiKey, c as getConfig, f as isAlphaSearchCodexPriorityEnabled, h as isResponsesApiWebSocketEnabled, i as getAlphaSearchModel, l as getMessageApiWebSearchModel, m as isResponsesApiWebSearchEnabled, o as getClaudeAutoModel, p as isMessagesApiEnabled, s as getClaudeTokenMultiplier, u as getUpstreamTransportConfig, v as reloadConfig, x as PATHS } from "./config-store-
|
|
2
|
-
import { C as isGpt56OrAbove, S as isContextManagementEnabledForResponses, T as setModelMappings, _ as getModelResponsesApiCompactThreshold$1, b as getSmallModelForProvider, d as getOpencodeGoModelIds, f as getOpencodeGoModelRecords, g as getModelMappings, h as getExtraPromptForModel, i as listEnabledProviders, l as getModelsDevModelMaxOutputTokens, n as getRawProviderConfig, o as resolveEffectiveProviderType, s as resolveProviderConfigForModel, t as getProviderConfig, u as getOpencodeGoModelConfig, v as getReasoningEffortForModel, w as resolveMappedModel, x as isContextManagementEnabledForMessages, y as getSmallModel } from "./config-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import { n as stopModelsRefreshLoop, t as setupCopilotRuntime } from "./copilot-runtime-DcUOmm60.js";
|
|
1
|
+
import { A as forwardError, C as GITHUB_COPILOT_PROVIDER, D as HTTPError, E as state, T as isGitHubCopilotEnabled, a as getAnthropicApiKey, c as getConfig, f as isAlphaSearchCodexPriorityEnabled, h as isResponsesApiWebSocketEnabled, i as getAlphaSearchModel, l as getMessageApiWebSearchModel, m as isResponsesApiWebSearchEnabled, o as getClaudeAutoModel, p as isMessagesApiEnabled, s as getClaudeTokenMultiplier, u as getUpstreamTransportConfig, v as reloadConfig, x as PATHS } from "./config-store-BD3_fWvY.js";
|
|
2
|
+
import { C as isGpt56OrAbove, S as isContextManagementEnabledForResponses, T as setModelMappings, _ as getModelResponsesApiCompactThreshold$1, b as getSmallModelForProvider, d as getOpencodeGoModelIds, f as getOpencodeGoModelRecords, g as getModelMappings, h as getExtraPromptForModel, i as listEnabledProviders, l as getModelsDevModelMaxOutputTokens, n as getRawProviderConfig, o as resolveEffectiveProviderType, s as resolveProviderConfigForModel, t as getProviderConfig, u as getOpencodeGoModelConfig, v as getReasoningEffortForModel, w as resolveMappedModel, x as isContextManagementEnabledForMessages, y as getSmallModel } from "./config-CZdq_04f.js";
|
|
3
|
+
import { $ as resolveTraceId$1, C as isOpencodeOauthApp, E as prepareMessageProxyHeaders, G as XAI_API_BASE_URL, J as CODEX_API_BASE_URL, L as getXaiAccessToken, M as compactTextOnlyGuard, N as createAuthMiddleware, O as compactAutoContinuePromptStarts, P as getConfiguredAdminApiKeys, Q as requestContext, S as copilotWebSocketHeaders, T as prepareInteractionHeaders, U as readGitHubToken, W as readGitHubTokenFromEnv, X as forwardCodexResponses, Y as buildCodexRequestHeaders, Z as generateTraceId, _ as parseUserIdMetadata, at as createPooledWebSocketStream, b as copilotHeaders, ct as stripInternalRequestHeaders, d as generateRequestIdFromPayload, et as fetchUpstreamWithLifecycle, f as getRootSessionId, g as isResponsesStream, h as isNullish, it as getResponsesStreamTerminalDisposition, j as compactSystemPromptStarts, k as compactMessageSections, m as isAsyncIterable, n as invalidateCodexRuntime, nt as createResponsesSafeStream, ot as createWebSocketUrl, p as getUUID, rt as encodePoolKeyPart, s as setupCodexToken, tt as createResponsesHttpEventStream, u as stopCopilotRefreshLoop, v as getCopilotUsage, w as prepareForCompact, y as copilotBaseUrl } from "./token-D84GjiaE.js";
|
|
4
|
+
import { a as isDeferredToolName, c as parseMcpToolSearchSentinel, d as shouldEnableResponsesToolSearch, i as isBridgeToolSearchName, l as resolveBridgeToolSearchName, o as listDeferredToolNames, r as formatToolSearchBridgeArguments, s as normalizeToolSearchBridgeArguments, t as BRIDGE_TOOL_SEARCH_NAME, u as selectDeferredToolsByNames } from "./tool-search-CcvaqM03.js";
|
|
5
|
+
import { n as isProviderAgentModelVisible, t as getProviderAgentModels } from "./provider-management-Du98I_tf.js";
|
|
6
|
+
import { n as stopModelsRefreshLoop, t as setupCopilotRuntime } from "./copilot-runtime-D-_s8L_X.js";
|
|
8
7
|
import consola from "consola";
|
|
9
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
9
|
import fs, { createWriteStream, readFileSync, rmSync } from "node:fs";
|
|
@@ -4809,6 +4808,13 @@ const getCompactType = (anthropicPayload) => {
|
|
|
4809
4808
|
if (system.some((msg) => typeof msg.text === "string" && compactSystemPromptStarts.some((promptStart) => msg.text.startsWith(promptStart)))) return 1;
|
|
4810
4809
|
return 0;
|
|
4811
4810
|
};
|
|
4811
|
+
const applyClaudeNoToolsEffort = (payload, userAgent) => {
|
|
4812
|
+
if (!isClaudeUserAgent(userAgent) || (payload.tools?.length ?? 0) > 0) return;
|
|
4813
|
+
payload.output_config = {
|
|
4814
|
+
...payload.output_config,
|
|
4815
|
+
effort: "low"
|
|
4816
|
+
};
|
|
4817
|
+
};
|
|
4812
4818
|
/**
|
|
4813
4819
|
* True for Claude Code background security-monitor requests: no tools,
|
|
4814
4820
|
* `stop_sequences: ["</block>"]`, and a system prompt starting with the
|
|
@@ -5083,7 +5089,10 @@ const prepareMessagesApiPayload = (payload, selectedModel) => {
|
|
|
5083
5089
|
if (effort === "none" || effort === "minimal") effort = "low";
|
|
5084
5090
|
const reasoningEffort = selectedModel.capabilities.supports.reasoning_effort;
|
|
5085
5091
|
if (reasoningEffort && !reasoningEffort.includes(effort)) effort = reasoningEffort.at(-1);
|
|
5086
|
-
payload.output_config = {
|
|
5092
|
+
payload.output_config = {
|
|
5093
|
+
...payload.output_config,
|
|
5094
|
+
effort
|
|
5095
|
+
};
|
|
5087
5096
|
}
|
|
5088
5097
|
const modelSupports = selectedModel?.capabilities.supports;
|
|
5089
5098
|
if (!modelSupports?.adaptive_thinking) {
|
|
@@ -8173,6 +8182,7 @@ async function handleProviderMessages(c) {
|
|
|
8173
8182
|
const provider = c.req.param("provider");
|
|
8174
8183
|
const payload = await c.req.json();
|
|
8175
8184
|
payload.model = fromClaudeDiscoveryModelId(payload.model);
|
|
8185
|
+
applyClaudeNoToolsEffort(payload, c.req.header("user-agent"));
|
|
8176
8186
|
const claudeAutoModel = getClaudeAutoModel();
|
|
8177
8187
|
if (claudeAutoModel && isClaudeAutoModelRequest(payload)) {
|
|
8178
8188
|
consola.debug(`Claude auto model override (${provider}): ${payload.model} -> ${claudeAutoModel}`);
|
|
@@ -9232,6 +9242,7 @@ const messagesFlowHandlers = {
|
|
|
9232
9242
|
async function handleCompletion(c) {
|
|
9233
9243
|
const anthropicPayload = await c.req.json();
|
|
9234
9244
|
anthropicPayload.model = fromClaudeDiscoveryModelId(anthropicPayload.model);
|
|
9245
|
+
applyClaudeNoToolsEffort(anthropicPayload, c.req.header("user-agent"));
|
|
9235
9246
|
return await handleCompletionPayload(c, anthropicPayload);
|
|
9236
9247
|
}
|
|
9237
9248
|
async function handleCompletionPayload(c, anthropicPayload, dispatchOptions = {}) {
|
|
@@ -9248,11 +9259,12 @@ async function handleCompletionPayload(c, anthropicPayload, dispatchOptions = {}
|
|
|
9248
9259
|
});
|
|
9249
9260
|
if (webSearchResult) return webSearchResult;
|
|
9250
9261
|
}
|
|
9251
|
-
const claudeAutoModel = getClaudeAutoModel();
|
|
9262
|
+
const claudeAutoModel = getClaudeAutoModel(true);
|
|
9252
9263
|
const shouldUseClaudeAutoModel = Boolean(!dispatchOptions.skipClaudeAutoModel && claudeAutoModel && isClaudeAutoModelRequest(anthropicPayload));
|
|
9253
9264
|
if (claudeAutoModel && shouldUseClaudeAutoModel) {
|
|
9254
|
-
|
|
9255
|
-
anthropicPayload.model
|
|
9265
|
+
const resolvedClaudeAutoModel = dispatchOptions.skipModelMapping ? claudeAutoModel : resolveMappedModel(claudeAutoModel);
|
|
9266
|
+
consola.debug(`Claude auto model override: ${anthropicPayload.model} -> ${resolvedClaudeAutoModel}`);
|
|
9267
|
+
anthropicPayload.model = resolvedClaudeAutoModel;
|
|
9256
9268
|
}
|
|
9257
9269
|
const providerModelAlias = await resolveConfiguredProviderModelAlias(anthropicPayload.model, providerMessagesHandlerDependencies.resolveProviderConfig);
|
|
9258
9270
|
if (providerModelAlias) {
|
|
@@ -13175,4 +13187,4 @@ createServer();
|
|
|
13175
13187
|
//#endregion
|
|
13176
13188
|
export { createServer };
|
|
13177
13189
|
|
|
13178
|
-
//# sourceMappingURL=server-
|
|
13190
|
+
//# sourceMappingURL=server-CB_RoZhM.js.map
|