@jeffreycao/copilot-api 2.2.10 → 2.2.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-DEEWMydw.js → server-D_qrybxD.js} +87 -32
- package/dist/server-D_qrybxD.js.map +1 -0
- package/dist/{start-tknmnmUA.js → start-DmLlG7PU.js} +2 -2
- package/dist/{start-tknmnmUA.js.map → start-DmLlG7PU.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-DEEWMydw.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -30,7 +30,7 @@ if (isMcpFastPath(process.argv)) {
|
|
|
30
30
|
const { auth } = await import("./auth-C-RWNXGU.js");
|
|
31
31
|
const { debug } = await import("./debug-41w6Whae.js");
|
|
32
32
|
const { mcp } = await import("./mcp-fpSlKZxK.js");
|
|
33
|
-
const { start } = await import("./start-
|
|
33
|
+
const { start } = await import("./start-DmLlG7PU.js");
|
|
34
34
|
await runMain(defineCommand({
|
|
35
35
|
meta: {
|
|
36
36
|
name: "copilot-api",
|
|
@@ -576,9 +576,19 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
576
576
|
inputModalities: ["text"],
|
|
577
577
|
maxOutputTokens: 64e3,
|
|
578
578
|
pricing: {
|
|
579
|
-
cachedInput: .
|
|
580
|
-
input:
|
|
581
|
-
output:
|
|
579
|
+
cachedInput: .1,
|
|
580
|
+
input: 3,
|
|
581
|
+
output: 9
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
"deepseek-v4-flash-vision-exp": {
|
|
585
|
+
contextWindow: 1e6,
|
|
586
|
+
inputModalities: ["text", "image"],
|
|
587
|
+
maxOutputTokens: 64e3,
|
|
588
|
+
pricing: {
|
|
589
|
+
cachedInput: .1,
|
|
590
|
+
input: 3,
|
|
591
|
+
output: 9
|
|
582
592
|
}
|
|
583
593
|
},
|
|
584
594
|
"deepseek-v4-pro": {
|
|
@@ -586,9 +596,9 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
586
596
|
inputModalities: ["text"],
|
|
587
597
|
maxOutputTokens: 64e3,
|
|
588
598
|
pricing: {
|
|
589
|
-
cachedInput: .
|
|
590
|
-
input:
|
|
591
|
-
output:
|
|
599
|
+
cachedInput: .3,
|
|
600
|
+
input: 9,
|
|
601
|
+
output: 27
|
|
592
602
|
}
|
|
593
603
|
}
|
|
594
604
|
},
|
|
@@ -661,19 +671,34 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
661
671
|
inputModalities: ["text"],
|
|
662
672
|
maxOutputTokens: 64e3,
|
|
663
673
|
pricing: {
|
|
664
|
-
cachedInput: .
|
|
665
|
-
input: .
|
|
666
|
-
output: .
|
|
674
|
+
cachedInput: .007,
|
|
675
|
+
input: .22,
|
|
676
|
+
output: .66
|
|
667
677
|
}
|
|
668
678
|
},
|
|
679
|
+
"deepseek-v4-flash-vision-exp": {
|
|
680
|
+
contextWindow: 1e6,
|
|
681
|
+
inputModalities: ["text", "image"],
|
|
682
|
+
maxOutputTokens: 384e3,
|
|
683
|
+
pricing: {
|
|
684
|
+
cachedInput: .007,
|
|
685
|
+
input: .22,
|
|
686
|
+
output: .66
|
|
687
|
+
},
|
|
688
|
+
reasoningEfforts: [
|
|
689
|
+
"low",
|
|
690
|
+
"high",
|
|
691
|
+
"max"
|
|
692
|
+
]
|
|
693
|
+
},
|
|
669
694
|
"deepseek-v4-pro": {
|
|
670
695
|
contextWindow: 1e6,
|
|
671
696
|
inputModalities: ["text"],
|
|
672
697
|
maxOutputTokens: 64e3,
|
|
673
698
|
pricing: {
|
|
674
|
-
cachedInput: .
|
|
675
|
-
input:
|
|
676
|
-
output:
|
|
699
|
+
cachedInput: .022,
|
|
700
|
+
input: .66,
|
|
701
|
+
output: 1.98
|
|
677
702
|
}
|
|
678
703
|
},
|
|
679
704
|
"kimi-k2.7-code": {
|
|
@@ -781,6 +806,21 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
781
806
|
maxInputTokens: 512e3,
|
|
782
807
|
output: 2.4
|
|
783
808
|
}] }
|
|
809
|
+
},
|
|
810
|
+
"ox-alpha-free": {
|
|
811
|
+
contextWindow: 1e6,
|
|
812
|
+
inputModalities: ["text", "image"],
|
|
813
|
+
maxOutputTokens: 131072,
|
|
814
|
+
pricing: {
|
|
815
|
+
cachedInput: 0,
|
|
816
|
+
input: 0,
|
|
817
|
+
output: 0
|
|
818
|
+
},
|
|
819
|
+
reasoningEfforts: [
|
|
820
|
+
"low",
|
|
821
|
+
"high",
|
|
822
|
+
"max"
|
|
823
|
+
]
|
|
784
824
|
}
|
|
785
825
|
},
|
|
786
826
|
kimi: {
|
|
@@ -8440,6 +8480,14 @@ const MESSAGES_COMPACTION_PROMPT = [
|
|
|
8440
8480
|
"",
|
|
8441
8481
|
compactTextOnlyGuard
|
|
8442
8482
|
].join("\n");
|
|
8483
|
+
const MESSAGES_TOOL_CALL_TIPS = [
|
|
8484
|
+
"# Tool Call Tips",
|
|
8485
|
+
"- Do NOT call `exec_command` directly; that tool does not exist. Use `functions__exec` to run commands instead.",
|
|
8486
|
+
"- The functions__exec tool accepts parameters only as {\"input\":\"...\"}; put the complete executable code inside input, including properly constructed tools.exec_command(...) calls and text(...) output handling.",
|
|
8487
|
+
"- Construct all tools.exec_command(...) arguments strictly according to its tool definition, and use OS/shell-compatible commands for Windows, Linux, and macOS.",
|
|
8488
|
+
"- Always assign the awaited tools.exec_command(...) call to a variable, then forward its output with text(result.output) and inspect result.exit_code; unforwarded output is silently dropped and makes results look empty.",
|
|
8489
|
+
"- Read files with the OS-native command (Get-Content/Test-Path on Windows PowerShell, cat/ls on POSIX), quote paths containing spaces, and verify the forwarded output is non-empty before concluding a file was read."
|
|
8490
|
+
].join("\n");
|
|
8443
8491
|
const COMPACTION_REPLAY_PROMPT = "The previous conversation was compacted. Continue from this handoff summary:\n\n";
|
|
8444
8492
|
const MAX_DEVELOPER_PROMPTS = 5;
|
|
8445
8493
|
const TOOL_NAME_PATTERN = /^[A-Za-z0-9_-]{1,64}$/u;
|
|
@@ -8460,7 +8508,7 @@ var ResponsesMessagesTranslationError = class extends Error {
|
|
|
8460
8508
|
function translateResponsesToMessages(payload, options) {
|
|
8461
8509
|
const registry = createToolRegistry(payload);
|
|
8462
8510
|
const normalized = normalizeResponsesInput(payload.input);
|
|
8463
|
-
const { messages, system } = translateInputToAnthropic(normalized.input, registry, payload.instructions, payload.input);
|
|
8511
|
+
const { messages, system } = translateInputToAnthropic(normalized.input, registry, payload.instructions, payload.input, options.toolCallTips ?? false);
|
|
8464
8512
|
if (normalized.compaction) messages.push({
|
|
8465
8513
|
role: "user",
|
|
8466
8514
|
content: MESSAGES_COMPACTION_PROMPT
|
|
@@ -8669,7 +8717,7 @@ function registerMessagesTool(registration, registry) {
|
|
|
8669
8717
|
});
|
|
8670
8718
|
return descriptor;
|
|
8671
8719
|
}
|
|
8672
|
-
function translateInputToAnthropic(input, registry, instructions, originalInput) {
|
|
8720
|
+
function translateInputToAnthropic(input, registry, instructions, originalInput, toolCallTips) {
|
|
8673
8721
|
const messages = [];
|
|
8674
8722
|
const system = [];
|
|
8675
8723
|
if (instructions?.trim()) system.push({
|
|
@@ -8677,20 +8725,29 @@ function translateInputToAnthropic(input, registry, instructions, originalInput)
|
|
|
8677
8725
|
text: instructions
|
|
8678
8726
|
});
|
|
8679
8727
|
appendDeveloperPrompts(system, originalInput);
|
|
8680
|
-
if (typeof input === "string") {
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
system
|
|
8688
|
-
};
|
|
8689
|
-
}
|
|
8690
|
-
if (!Array.isArray(input)) return {
|
|
8728
|
+
if (typeof input === "string") messages.push({
|
|
8729
|
+
role: "user",
|
|
8730
|
+
content: input
|
|
8731
|
+
});
|
|
8732
|
+
else if (Array.isArray(input)) translateInputItems(input, messages, system, registry);
|
|
8733
|
+
if (toolCallTips) appendToolCallTips(system);
|
|
8734
|
+
return {
|
|
8691
8735
|
messages,
|
|
8692
8736
|
system
|
|
8693
8737
|
};
|
|
8738
|
+
}
|
|
8739
|
+
function appendToolCallTips(system) {
|
|
8740
|
+
const lastSystemBlock = system.at(-1);
|
|
8741
|
+
if (!lastSystemBlock) {
|
|
8742
|
+
system.push({
|
|
8743
|
+
type: "text",
|
|
8744
|
+
text: MESSAGES_TOOL_CALL_TIPS
|
|
8745
|
+
});
|
|
8746
|
+
return;
|
|
8747
|
+
}
|
|
8748
|
+
lastSystemBlock.text = `${lastSystemBlock.text}\n\n${MESSAGES_TOOL_CALL_TIPS}`;
|
|
8749
|
+
}
|
|
8750
|
+
function translateInputItems(input, messages, system, registry) {
|
|
8694
8751
|
let userMessageSeen = false;
|
|
8695
8752
|
for (const item of input) {
|
|
8696
8753
|
const type = getItemType(item);
|
|
@@ -8726,10 +8783,6 @@ function translateInputToAnthropic(input, registry, instructions, originalInput)
|
|
|
8726
8783
|
default: throw new ResponsesMessagesTranslationError(`Responses Messages fallback does not support input item type '${type}'`);
|
|
8727
8784
|
}
|
|
8728
8785
|
}
|
|
8729
|
-
return {
|
|
8730
|
-
messages,
|
|
8731
|
-
system
|
|
8732
|
-
};
|
|
8733
8786
|
}
|
|
8734
8787
|
function translateInputMessage(item, messages, system, userMessageSeen) {
|
|
8735
8788
|
if (!isRecord(item)) throw new ResponsesMessagesTranslationError("Invalid Responses message item");
|
|
@@ -9938,13 +9991,15 @@ async function handleResponsesViaMessages(c, options) {
|
|
|
9938
9991
|
model: options.publicModel
|
|
9939
9992
|
}, {
|
|
9940
9993
|
model: options.targetModel,
|
|
9941
|
-
publicModel: options.publicModel
|
|
9994
|
+
publicModel: options.publicModel,
|
|
9995
|
+
toolCallTips: isCodexUserAgent(c.req.header("user-agent"))
|
|
9942
9996
|
});
|
|
9943
9997
|
const context = translation;
|
|
9944
9998
|
debugJson(logger$3, "Translated Messages request:", {
|
|
9945
9999
|
payload: translation.messagesPayload,
|
|
9946
10000
|
publicModel: options.publicModel,
|
|
9947
|
-
targetModel: options.targetModel
|
|
10001
|
+
targetModel: options.targetModel,
|
|
10002
|
+
userAgent: c.req.header("user-agent") ?? ""
|
|
9948
10003
|
});
|
|
9949
10004
|
const messagesResponse = await responsesMessagesDependencies.handleCompletionPayload(c, translation.messagesPayload, {
|
|
9950
10005
|
compactType: translation.compaction ? 1 : void 0,
|
|
@@ -10514,4 +10569,4 @@ server.route("/:provider/images", providerImageRoutes);
|
|
|
10514
10569
|
//#endregion
|
|
10515
10570
|
export { server };
|
|
10516
10571
|
|
|
10517
|
-
//# sourceMappingURL=server-
|
|
10572
|
+
//# sourceMappingURL=server-D_qrybxD.js.map
|