@jeffreycao/copilot-api 2.7.10 → 2.7.11
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-1fLM5e0J.js → server-Dvvc9z2P.js} +47 -8
- package/dist/server-Dvvc9z2P.js.map +1 -0
- package/dist/{start-DAQ6_2QN.js → start-Dqv75dA4.js} +2 -2
- package/dist/{start-DAQ6_2QN.js.map → start-Dqv75dA4.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-1fLM5e0J.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-Dqv75dA4.js");
|
|
34
34
|
const { provider } = await import("./provider-CzziTLqX.js");
|
|
35
35
|
await runMain(defineCommand({
|
|
36
36
|
meta: {
|
|
@@ -510,6 +510,10 @@ const CODEX_LUNA_PRICING = { tiers: [{
|
|
|
510
510
|
output: .75
|
|
511
511
|
}] };
|
|
512
512
|
const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
513
|
+
static providerDefaults = {
|
|
514
|
+
codex: { supportPdf: true },
|
|
515
|
+
xai: { supportPdf: true }
|
|
516
|
+
};
|
|
513
517
|
static catalog = {
|
|
514
518
|
xai: { "grok-4.7": {
|
|
515
519
|
contextWindow: 5e5,
|
|
@@ -878,6 +882,9 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
878
882
|
if (provider === "opencode-go") return getOpencodeGoModelIds();
|
|
879
883
|
return Object.keys(this.modelCatalog[provider] ?? {});
|
|
880
884
|
}
|
|
885
|
+
getProviderDefaults(providerName) {
|
|
886
|
+
return BuiltinProviderModelRegistry.providerDefaults[this.normalizeKey(providerName)];
|
|
887
|
+
}
|
|
881
888
|
normalizeKey(value) {
|
|
882
889
|
return value.trim().toLowerCase();
|
|
883
890
|
}
|
|
@@ -4083,6 +4090,25 @@ const imageRoutes = new Hono();
|
|
|
4083
4090
|
imageRoutes.post("/generations", handleImagesGenerations);
|
|
4084
4091
|
imageRoutes.post("/edits", handleImagesEdits);
|
|
4085
4092
|
//#endregion
|
|
4093
|
+
//#region src/lib/model-pdf-support.ts
|
|
4094
|
+
function resolveModelPdfSupport(provider, options) {
|
|
4095
|
+
if (options.supportPdf !== void 0) return options.supportPdf;
|
|
4096
|
+
return options.builtinSupportPdf === true || provider === "github-copilot" && Array.isArray(options.supportedMediaTypes) && options.supportedMediaTypes.includes("application/pdf") || Array.isArray(options.catalogInputModalities) && options.catalogInputModalities.includes("pdf");
|
|
4097
|
+
}
|
|
4098
|
+
function getProviderModelPdfSupport(modelId, provider, selectedModel) {
|
|
4099
|
+
const rawId = selectedModel?.id ?? modelId;
|
|
4100
|
+
const modelConfig = provider.models?.[rawId] ?? provider.models?.[modelId];
|
|
4101
|
+
const catalogProvider = provider.modelsDevProviderId || provider.name;
|
|
4102
|
+
const catalog = getModelsDevModel(catalogProvider, rawId) ?? getModelsDevModel(catalogProvider, modelId);
|
|
4103
|
+
const builtin = builtinProviderModelRegistry.getModelConfig(provider.name, rawId);
|
|
4104
|
+
return resolveModelPdfSupport(provider.name, {
|
|
4105
|
+
supportPdf: modelConfig?.supportPdf,
|
|
4106
|
+
catalogInputModalities: catalog?.modalities?.input,
|
|
4107
|
+
supportedMediaTypes: selectedModel?.capabilities.limits.vision?.supported_media_types,
|
|
4108
|
+
builtinSupportPdf: builtin?.supportPdf ?? builtinProviderModelRegistry.getProviderDefaults(provider.name)?.supportPdf
|
|
4109
|
+
});
|
|
4110
|
+
}
|
|
4111
|
+
//#endregion
|
|
4086
4112
|
//#region src/lib/claude-models.ts
|
|
4087
4113
|
const DISCOVERY_MODEL_PREFIX = "my-claude-";
|
|
4088
4114
|
const DISCOVERY_MODEL_SUFFIX = "[1m]";
|
|
@@ -5168,10 +5194,11 @@ async function handleProviderCountTokensForProvider(c, options) {
|
|
|
5168
5194
|
type: "invalid_request_error"
|
|
5169
5195
|
} }, 404);
|
|
5170
5196
|
const modelConfig = providerConfig.models?.[modelId];
|
|
5171
|
-
const
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5197
|
+
const effectiveType = resolveEffectiveProviderType(providerConfig, modelId);
|
|
5198
|
+
const openAIPayload = translateToOpenAI(anthropicPayload, {
|
|
5199
|
+
supportPdf: getProviderModelPdfSupport(modelId, providerConfig),
|
|
5200
|
+
...effectiveType === "openai-compatible" && { toolContentSupportType: modelConfig?.toolContentSupportType ?? [] }
|
|
5201
|
+
});
|
|
5175
5202
|
const selectedModel = createFallbackModel(modelId);
|
|
5176
5203
|
const tokenCount = await getTokenCount(openAIPayload, selectedModel);
|
|
5177
5204
|
const finalTokenCount = tokenCount.input + tokenCount.output;
|
|
@@ -5247,11 +5274,14 @@ async function handleCountTokens(c) {
|
|
|
5247
5274
|
const anthropicResult = await countTokensViaAnthropic(c, anthropicPayload);
|
|
5248
5275
|
if (anthropicResult) return anthropicResult;
|
|
5249
5276
|
const anthropicBeta = c.req.header("anthropic-beta");
|
|
5250
|
-
const openAIPayload = translateToOpenAI(anthropicPayload);
|
|
5251
5277
|
const requestedModel = anthropicPayload.model;
|
|
5252
5278
|
const resolve = resolveCountTokensModel(requestedModel);
|
|
5253
5279
|
const selectedModel = resolve.model;
|
|
5254
5280
|
anthropicPayload.model = selectedModel.id;
|
|
5281
|
+
const openAIPayload = translateToOpenAI(anthropicPayload, { supportPdf: getProviderModelPdfSupport(requestedModel, {
|
|
5282
|
+
...getRawProviderConfig(GITHUB_COPILOT_PROVIDER),
|
|
5283
|
+
name: GITHUB_COPILOT_PROVIDER
|
|
5284
|
+
}, selectedModel) });
|
|
5255
5285
|
if (resolve.fallback) consola.warn(`Model '${requestedModel}' not found, using o200k_base fallback tokenizer`);
|
|
5256
5286
|
const tokenCount = await getTokenCount(openAIPayload, selectedModel);
|
|
5257
5287
|
if (anthropicPayload.tools && anthropicPayload.tools.length > 0) {
|
|
@@ -8512,7 +8542,7 @@ const handleOpenAICompatibleProviderMessages = async (c, options) => {
|
|
|
8512
8542
|
};
|
|
8513
8543
|
const createOpenAICompatiblePayload = (payload, modelConfig, providerConfig) => {
|
|
8514
8544
|
const openAIPayload = translateToOpenAI(payload, {
|
|
8515
|
-
supportPdf:
|
|
8545
|
+
supportPdf: getProviderModelPdfSupport(payload.model, providerConfig),
|
|
8516
8546
|
toolContentSupportType: modelConfig?.toolContentSupportType ?? []
|
|
8517
8547
|
});
|
|
8518
8548
|
const isDashScopeProvider = isDashScopeAliyunProvider(providerConfig);
|
|
@@ -8955,6 +8985,10 @@ const messagesApiFlowDependencies = {
|
|
|
8955
8985
|
const handleWithChatCompletions = async (c, anthropicPayload, options) => {
|
|
8956
8986
|
const { logger, selectedModel, subagentMarker, requestId, sessionId, compactType } = options;
|
|
8957
8987
|
const openAIPayload = translateToOpenAI(anthropicPayload, {
|
|
8988
|
+
supportPdf: getProviderModelPdfSupport(anthropicPayload.model, {
|
|
8989
|
+
...getRawProviderConfig(GITHUB_COPILOT_PROVIDER),
|
|
8990
|
+
name: GITHUB_COPILOT_PROVIDER
|
|
8991
|
+
}, selectedModel),
|
|
8958
8992
|
validateReasoningEffort: true,
|
|
8959
8993
|
reasoningEffortSupport: selectedModel?.capabilities.supports.reasoning_effort
|
|
8960
8994
|
});
|
|
@@ -11663,7 +11697,12 @@ function toOpencodeModel(model, contextWindow) {
|
|
|
11663
11697
|
]), catalog?.limit?.context, builtin?.contextWindow, 2e5);
|
|
11664
11698
|
const inputLimit = positiveInteger(getFirstPositiveNumber(limits, ["max_prompt_tokens"]), catalog?.limit?.input);
|
|
11665
11699
|
const supportedMediaTypes = stringList(getRecordField(limits, "vision")?.supported_media_types);
|
|
11666
|
-
const supportPdf =
|
|
11700
|
+
const supportPdf = resolveModelPdfSupport(provider, {
|
|
11701
|
+
supportPdf: modelConfig?.supportPdf,
|
|
11702
|
+
supportedMediaTypes,
|
|
11703
|
+
catalogInputModalities: catalog?.modalities?.input,
|
|
11704
|
+
builtinSupportPdf: builtin?.supportPdf ?? builtinProviderModelRegistry.getProviderDefaults(provider)?.supportPdf
|
|
11705
|
+
});
|
|
11667
11706
|
const input = [...stringList(modelConfig?.inputModalities) ?? stringList(model.input_modalities ?? getRecordField(model, "modalities")?.input ?? model.modalities ?? getRecordField(model, "architecture")?.input_modalities) ?? (typeof supports?.vision === "boolean" ? ["text", ...supports.vision ? ["image"] : []] : void 0) ?? catalog?.modalities?.input ?? builtin?.inputModalities ?? ["text"]].filter((modality) => modality !== "pdf" || supportPdf);
|
|
11668
11707
|
if (supportPdf && !input.includes("pdf")) input.push("pdf");
|
|
11669
11708
|
const efforts = normalizeEffortValues(stringList(modelConfig?.reasoningEfforts ?? model.reasoning_efforts ?? supports?.reasoning_effort) ?? catalogEffortValues(catalog) ?? builtin?.reasoningEfforts);
|
|
@@ -13372,4 +13411,4 @@ createServer();
|
|
|
13372
13411
|
//#endregion
|
|
13373
13412
|
export { createServer };
|
|
13374
13413
|
|
|
13375
|
-
//# sourceMappingURL=server-
|
|
13414
|
+
//# sourceMappingURL=server-Dvvc9z2P.js.map
|