@jeffreycao/copilot-api 2.3.7 → 2.3.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/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/{auth-OxiT7vCr.js → auth-Clwq9PQr.js} +4 -4
- package/dist/auth-Clwq9PQr.js.map +1 -0
- package/dist/auth-DgKX2oyO.js +2 -0
- package/dist/{config-CEGVuc_4.js → config-ByEK-9s6.js} +2 -2
- package/dist/{config-CEGVuc_4.js.map → config-ByEK-9s6.js.map} +1 -1
- package/dist/{debug-Db0SCVSP.js → debug-BHOitPm3.js} +2 -2
- package/dist/{debug-Db0SCVSP.js.map → debug-BHOitPm3.js.map} +1 -1
- package/dist/main.js +3 -3
- package/dist/{models-Bd9M8jdy.js → models-CSfL5LfA.js} +2 -2
- package/dist/{models-Bd9M8jdy.js.map → models-CSfL5LfA.js.map} +1 -1
- package/dist/{server-DR94qLzm.js → server-COi_U11S.js} +41 -25
- package/dist/server-COi_U11S.js.map +1 -0
- package/dist/{start-Cfg3jwGS.js → start-CNoTESAC.js} +6 -6
- package/dist/{start-Cfg3jwGS.js.map → start-CNoTESAC.js.map} +1 -1
- package/dist/{token-C3cN0vNj.js → token--nvbqUZm.js} +4 -4
- package/dist/token--nvbqUZm.js.map +1 -0
- package/package.json +1 -1
- package/dist/auth-B-ry4rJx.js +0 -2
- package/dist/auth-OxiT7vCr.js.map +0 -1
- package/dist/server-DR94qLzm.js.map +0 -1
- package/dist/token-C3cN0vNj.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as isResponsesApiWebSocketEnabled, C as getClaudeTokenMultiplier, D as isAlphaSearchCodexPriorityEnabled, E as getResponsesTransportConfig, N as PATHS, O as isMessagesApiEnabled, S as getClaudeAutoModel, T as getMessageApiWebSearchModel, _ as resolveMappedModel, b as getAlphaSearchModel, d as getModelResponsesApiCompactThreshold$1, f as getReasoningEffortForModel, g as isGpt56OrAbove, h as isContextManagementEnabledForResponses, i as listEnabledProviders, k as isResponsesApiWebSearchEnabled, l as getExtraPromptForModel, m as isContextManagementEnabledForMessages, n as getRawProviderConfig, o as resolveEffectiveProviderType, p as getSmallModel, s as resolveProviderAuthType, t as getProviderConfig, u as getModelMappings, v as setModelMappings, x as getAnthropicApiKey } from "./config-
|
|
2
|
-
import { B as fetchResponsesWithLifecycle, C as compactAutoContinuePromptStarts, D as compactTextOnlyGuard, E as compactSystemPromptStarts, F as forwardCodexResponses, G as createWebSocketUrl, H as encodePoolKeyPart, I as generateTraceId, J as forwardError, K as state, L as requestContext, N as CODEX_API_BASE_URL, O as createAuthMiddleware, P as buildCodexRequestHeaders, R as resolveTraceId$1, U as isTerminalResponsesStreamChunk, V as createResponsesSafeStream, W as createPooledWebSocketStream, b as prepareInteractionHeaders, c as getUUID, d as isResponsesStream, f as parseUserIdMetadata, g as copilotHeaders, h as copilotBaseUrl, k as getConfiguredAdminApiKeys, l as isAsyncIterable, o as generateRequestIdFromPayload, p as getCopilotUsage, q as HTTPError, r as setupCodexToken, s as getRootSessionId, u as isNullish, v as copilotWebSocketHeaders, w as compactMessageSections, x as prepareMessageProxyHeaders, y as prepareForCompact, z as createResponsesHttpEventStream } from "./token
|
|
1
|
+
import { A as isResponsesApiWebSocketEnabled, C as getClaudeTokenMultiplier, D as isAlphaSearchCodexPriorityEnabled, E as getResponsesTransportConfig, N as PATHS, O as isMessagesApiEnabled, S as getClaudeAutoModel, T as getMessageApiWebSearchModel, _ as resolveMappedModel, b as getAlphaSearchModel, d as getModelResponsesApiCompactThreshold$1, f as getReasoningEffortForModel, g as isGpt56OrAbove, h as isContextManagementEnabledForResponses, i as listEnabledProviders, k as isResponsesApiWebSearchEnabled, l as getExtraPromptForModel, m as isContextManagementEnabledForMessages, n as getRawProviderConfig, o as resolveEffectiveProviderType, p as getSmallModel, s as resolveProviderAuthType, t as getProviderConfig, u as getModelMappings, v as setModelMappings, x as getAnthropicApiKey } from "./config-ByEK-9s6.js";
|
|
2
|
+
import { B as fetchResponsesWithLifecycle, C as compactAutoContinuePromptStarts, D as compactTextOnlyGuard, E as compactSystemPromptStarts, F as forwardCodexResponses, G as createWebSocketUrl, H as encodePoolKeyPart, I as generateTraceId, J as forwardError, K as state, L as requestContext, N as CODEX_API_BASE_URL, O as createAuthMiddleware, P as buildCodexRequestHeaders, R as resolveTraceId$1, U as isTerminalResponsesStreamChunk, V as createResponsesSafeStream, W as createPooledWebSocketStream, b as prepareInteractionHeaders, c as getUUID, d as isResponsesStream, f as parseUserIdMetadata, g as copilotHeaders, h as copilotBaseUrl, k as getConfiguredAdminApiKeys, l as isAsyncIterable, o as generateRequestIdFromPayload, p as getCopilotUsage, q as HTTPError, r as setupCodexToken, s as getRootSessionId, u as isNullish, v as copilotWebSocketHeaders, w as compactMessageSections, x as prepareMessageProxyHeaders, y as prepareForCompact, z as createResponsesHttpEventStream } from "./token--nvbqUZm.js";
|
|
3
3
|
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-Ds1vbmGG.js";
|
|
4
|
-
import { i as toClientModelId, r as normalizeSdkModelId, t as findEndpointModel } from "./models-
|
|
4
|
+
import { i as toClientModelId, r as normalizeSdkModelId, t as findEndpointModel } from "./models-CSfL5LfA.js";
|
|
5
5
|
import consola from "consola";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import fs, { readFileSync } from "node:fs";
|
|
@@ -660,6 +660,38 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
660
660
|
output: 4.4
|
|
661
661
|
}
|
|
662
662
|
},
|
|
663
|
+
"glm-5.3-flash": {
|
|
664
|
+
contextWindow: 1e6,
|
|
665
|
+
inputModalities: ["text", "image"],
|
|
666
|
+
maxOutputTokens: 131072,
|
|
667
|
+
pricing: {
|
|
668
|
+
cachedInput: .015,
|
|
669
|
+
input: .075,
|
|
670
|
+
output: .25
|
|
671
|
+
},
|
|
672
|
+
reasoningEfforts: [
|
|
673
|
+
"low",
|
|
674
|
+
"high",
|
|
675
|
+
"max"
|
|
676
|
+
]
|
|
677
|
+
},
|
|
678
|
+
"muse-spark-1.2-contributor": {
|
|
679
|
+
contextWindow: 1048576,
|
|
680
|
+
inputModalities: ["text", "image"],
|
|
681
|
+
maxOutputTokens: 131072,
|
|
682
|
+
pricing: {
|
|
683
|
+
cachedInput: .002,
|
|
684
|
+
input: .1,
|
|
685
|
+
output: .2
|
|
686
|
+
},
|
|
687
|
+
reasoningEfforts: [
|
|
688
|
+
"minimal",
|
|
689
|
+
"low",
|
|
690
|
+
"medium",
|
|
691
|
+
"high",
|
|
692
|
+
"xhigh"
|
|
693
|
+
]
|
|
694
|
+
},
|
|
663
695
|
"grok-4.5": {
|
|
664
696
|
contextWindow: 5e5,
|
|
665
697
|
defaultReasoningEffort: "high",
|
|
@@ -821,21 +853,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
821
853
|
maxInputTokens: 512e3,
|
|
822
854
|
output: 2.4
|
|
823
855
|
}] }
|
|
824
|
-
},
|
|
825
|
-
"ox-alpha-free": {
|
|
826
|
-
contextWindow: 1e6,
|
|
827
|
-
inputModalities: ["text", "image"],
|
|
828
|
-
maxOutputTokens: 131072,
|
|
829
|
-
pricing: {
|
|
830
|
-
cachedInput: 0,
|
|
831
|
-
input: 0,
|
|
832
|
-
output: 0
|
|
833
|
-
},
|
|
834
|
-
reasoningEfforts: [
|
|
835
|
-
"low",
|
|
836
|
-
"high",
|
|
837
|
-
"max"
|
|
838
|
-
]
|
|
839
856
|
}
|
|
840
857
|
},
|
|
841
858
|
kimi: {
|
|
@@ -2082,8 +2099,8 @@ const createPooledResponsesWebSocketStream = (request) => {
|
|
|
2082
2099
|
openTimeoutMs: transportConfig.websocketOpenTimeoutMs,
|
|
2083
2100
|
poolIdleTimeoutMs: transportConfig.websocketPoolIdleTimeoutMs,
|
|
2084
2101
|
streamInactivityTimeoutMs: transportConfig.streamInactivityTimeoutMs,
|
|
2085
|
-
streamErrorMessage: "Responses websocket stream error",
|
|
2086
|
-
terminalChunkMissingMessage: "Responses websocket ended without a terminal response"
|
|
2102
|
+
streamErrorMessage: "Upstream connection lost, Responses websocket stream error",
|
|
2103
|
+
terminalChunkMissingMessage: "Responses websocket ended without a terminal response, retry your request."
|
|
2087
2104
|
}), { signal: request.signal });
|
|
2088
2105
|
};
|
|
2089
2106
|
const buildResponsesWebSocketPayload = (payload, initiator) => {
|
|
@@ -3570,7 +3587,6 @@ function mapOpenAIStopReasonToAnthropic(finishReason) {
|
|
|
3570
3587
|
content_filter: "end_turn"
|
|
3571
3588
|
}[finishReason];
|
|
3572
3589
|
}
|
|
3573
|
-
const COPILOT_TOOL_CONTENT_SUPPORT_TYPE = ["array", "image"];
|
|
3574
3590
|
function translateToOpenAI(payload, options = {}) {
|
|
3575
3591
|
const modelId = payload.model;
|
|
3576
3592
|
const model = state.models?.data.find((m) => m.id === modelId);
|
|
@@ -3583,7 +3599,7 @@ function translateToOpenAI(payload, options = {}) {
|
|
|
3583
3599
|
model: modelId,
|
|
3584
3600
|
messages: translateAnthropicMessagesToOpenAI(payload, modelId, {
|
|
3585
3601
|
supportPdf: options.supportPdf ?? false,
|
|
3586
|
-
toolContentSupportType: options.toolContentSupportType ??
|
|
3602
|
+
toolContentSupportType: options.toolContentSupportType ?? []
|
|
3587
3603
|
}),
|
|
3588
3604
|
max_completion_tokens: payload.max_tokens,
|
|
3589
3605
|
stop: payload.stop_sequences,
|
|
@@ -4820,7 +4836,7 @@ function translateErrorToAnthropicErrorEvent() {
|
|
|
4820
4836
|
type: "error",
|
|
4821
4837
|
error: {
|
|
4822
4838
|
type: "api_error",
|
|
4823
|
-
message: "An unexpected error occurred during streaming."
|
|
4839
|
+
message: "An unexpected error occurred during streaming, retry your request."
|
|
4824
4840
|
}
|
|
4825
4841
|
};
|
|
4826
4842
|
}
|
|
@@ -7461,7 +7477,7 @@ const handleWithResponsesApi = async (c, anthropicPayload, options) => {
|
|
|
7461
7477
|
}
|
|
7462
7478
|
if (!streamState.messageCompleted) {
|
|
7463
7479
|
logger.warn("Responses stream ended without completion; sending error event");
|
|
7464
|
-
const errorEvent = buildErrorEvent("Responses stream ended without completion");
|
|
7480
|
+
const errorEvent = buildErrorEvent("Responses stream ended without completion, retry your request.");
|
|
7465
7481
|
await stream.writeSSE({
|
|
7466
7482
|
event: errorEvent.type,
|
|
7467
7483
|
data: JSON.stringify(errorEvent)
|
|
@@ -10716,4 +10732,4 @@ server.route("/:provider/images", providerImageRoutes);
|
|
|
10716
10732
|
//#endregion
|
|
10717
10733
|
export { server };
|
|
10718
10734
|
|
|
10719
|
-
//# sourceMappingURL=server-
|
|
10735
|
+
//# sourceMappingURL=server-COi_U11S.js.map
|