@corbat-tech/coco 2.4.0 → 2.4.2
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/cli/index.js +59 -32
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -768,6 +768,20 @@ function createAnthropicProvider(config) {
|
|
|
768
768
|
}
|
|
769
769
|
return provider;
|
|
770
770
|
}
|
|
771
|
+
function createKimiCodeProvider(config) {
|
|
772
|
+
const provider = new AnthropicProvider("kimi-code", "Kimi Code");
|
|
773
|
+
const kimiCodeConfig = {
|
|
774
|
+
...config,
|
|
775
|
+
baseUrl: config?.baseUrl ?? process.env["KIMI_CODE_BASE_URL"] ?? "https://api.kimi.com/coding",
|
|
776
|
+
apiKey: config?.apiKey ?? process.env["KIMI_CODE_API_KEY"],
|
|
777
|
+
model: config?.model ?? "kimi-for-coding"
|
|
778
|
+
};
|
|
779
|
+
if (kimiCodeConfig.apiKey) {
|
|
780
|
+
provider.initialize(kimiCodeConfig).catch(() => {
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
return provider;
|
|
784
|
+
}
|
|
771
785
|
var DEFAULT_MODEL, CONTEXT_WINDOWS, AnthropicProvider;
|
|
772
786
|
var init_anthropic = __esm({
|
|
773
787
|
"src/providers/anthropic.ts"() {
|
|
@@ -775,6 +789,8 @@ var init_anthropic = __esm({
|
|
|
775
789
|
init_retry();
|
|
776
790
|
DEFAULT_MODEL = "claude-opus-4-6-20260115";
|
|
777
791
|
CONTEXT_WINDOWS = {
|
|
792
|
+
// Kimi Code model (Anthropic-compatible endpoint)
|
|
793
|
+
"kimi-for-coding": 131072,
|
|
778
794
|
// Claude 4.6 (latest, Jan 2026) - 200K-1M context, 128K output
|
|
779
795
|
"claude-opus-4-6-20260115": 2e5,
|
|
780
796
|
// Claude 4.5 models (Nov 2025)
|
|
@@ -797,11 +813,15 @@ var init_anthropic = __esm({
|
|
|
797
813
|
"claude-3-haiku-20240307": 2e5
|
|
798
814
|
};
|
|
799
815
|
AnthropicProvider = class {
|
|
800
|
-
id
|
|
801
|
-
name
|
|
816
|
+
id;
|
|
817
|
+
name;
|
|
802
818
|
client = null;
|
|
803
819
|
config = {};
|
|
804
820
|
retryConfig = DEFAULT_RETRY_CONFIG;
|
|
821
|
+
constructor(id = "anthropic", name = "Anthropic Claude") {
|
|
822
|
+
this.id = id;
|
|
823
|
+
this.name = name;
|
|
824
|
+
}
|
|
805
825
|
/**
|
|
806
826
|
* Initialize the provider
|
|
807
827
|
*/
|
|
@@ -1206,20 +1226,6 @@ function createKimiProvider(config) {
|
|
|
1206
1226
|
}
|
|
1207
1227
|
return provider;
|
|
1208
1228
|
}
|
|
1209
|
-
function createKimiCodeProvider(config) {
|
|
1210
|
-
const provider = new OpenAIProvider("kimi-code", "Kimi Code");
|
|
1211
|
-
const kimiCodeConfig = {
|
|
1212
|
-
...config,
|
|
1213
|
-
baseUrl: config?.baseUrl ?? process.env["KIMI_CODE_BASE_URL"] ?? "https://api.kimi.com/coding/v1",
|
|
1214
|
-
apiKey: config?.apiKey ?? process.env["KIMI_CODE_API_KEY"],
|
|
1215
|
-
model: config?.model ?? "kimi-for-coding"
|
|
1216
|
-
};
|
|
1217
|
-
if (kimiCodeConfig.apiKey) {
|
|
1218
|
-
provider.initialize(kimiCodeConfig).catch(() => {
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
return provider;
|
|
1222
|
-
}
|
|
1223
1229
|
var DEFAULT_MODEL2, CONTEXT_WINDOWS2, MODELS_WITHOUT_TEMPERATURE, LOCAL_MODEL_PATTERNS, MODELS_WITH_THINKING_MODE, OpenAIProvider;
|
|
1224
1230
|
var init_openai = __esm({
|
|
1225
1231
|
"src/providers/openai.ts"() {
|
|
@@ -1252,7 +1258,6 @@ var init_openai = __esm({
|
|
|
1252
1258
|
"kimi-k2.5": 262144,
|
|
1253
1259
|
"kimi-k2-0324": 131072,
|
|
1254
1260
|
"kimi-latest": 131072,
|
|
1255
|
-
"kimi-for-coding": 131072,
|
|
1256
1261
|
"moonshot-v1-8k": 8e3,
|
|
1257
1262
|
"moonshot-v1-32k": 32e3,
|
|
1258
1263
|
"moonshot-v1-128k": 128e3,
|
|
@@ -1329,12 +1334,7 @@ var init_openai = __esm({
|
|
|
1329
1334
|
"gemma",
|
|
1330
1335
|
"starcoder"
|
|
1331
1336
|
];
|
|
1332
|
-
MODELS_WITH_THINKING_MODE = [
|
|
1333
|
-
"kimi-k2.5",
|
|
1334
|
-
"kimi-k2-0324",
|
|
1335
|
-
"kimi-latest",
|
|
1336
|
-
"kimi-for-coding"
|
|
1337
|
-
];
|
|
1337
|
+
MODELS_WITH_THINKING_MODE = ["kimi-k2.5", "kimi-k2-0324", "kimi-latest"];
|
|
1338
1338
|
OpenAIProvider = class {
|
|
1339
1339
|
id;
|
|
1340
1340
|
name;
|
|
@@ -4513,7 +4513,7 @@ function getBaseUrl(provider) {
|
|
|
4513
4513
|
case "kimi":
|
|
4514
4514
|
return process.env["KIMI_BASE_URL"] ?? "https://api.moonshot.ai/v1";
|
|
4515
4515
|
case "kimi-code":
|
|
4516
|
-
return process.env["KIMI_CODE_BASE_URL"] ?? "https://api.kimi.com/coding
|
|
4516
|
+
return process.env["KIMI_CODE_BASE_URL"] ?? "https://api.kimi.com/coding";
|
|
4517
4517
|
case "lmstudio":
|
|
4518
4518
|
return process.env["LMSTUDIO_BASE_URL"] ?? "http://localhost:1234/v1";
|
|
4519
4519
|
case "ollama":
|
|
@@ -4533,7 +4533,7 @@ function getBaseUrl(provider) {
|
|
|
4533
4533
|
case "huggingface":
|
|
4534
4534
|
return process.env["HF_BASE_URL"] ?? "https://api-inference.huggingface.co/v1";
|
|
4535
4535
|
case "qwen":
|
|
4536
|
-
return process.env["DASHSCOPE_BASE_URL"] ?? "https://dashscope.aliyuncs.com/compatible-mode/v1";
|
|
4536
|
+
return process.env["DASHSCOPE_BASE_URL"] ?? "https://dashscope-intl.aliyuncs.com/compatible-mode/v1";
|
|
4537
4537
|
default:
|
|
4538
4538
|
return void 0;
|
|
4539
4539
|
}
|
|
@@ -4791,7 +4791,7 @@ async function createProvider(type, config = {}) {
|
|
|
4791
4791
|
break;
|
|
4792
4792
|
case "qwen":
|
|
4793
4793
|
provider = new OpenAIProvider("qwen", "Alibaba Qwen");
|
|
4794
|
-
mergedConfig.baseUrl = mergedConfig.baseUrl ?? "https://dashscope.aliyuncs.com/compatible-mode/v1";
|
|
4794
|
+
mergedConfig.baseUrl = mergedConfig.baseUrl ?? "https://dashscope-intl.aliyuncs.com/compatible-mode/v1";
|
|
4795
4795
|
break;
|
|
4796
4796
|
default:
|
|
4797
4797
|
throw new ProviderError(`Unknown provider type: ${type}`, {
|
|
@@ -24196,9 +24196,9 @@ var PROVIDER_DEFINITIONS = {
|
|
|
24196
24196
|
emoji: "\u{1F7E6}",
|
|
24197
24197
|
description: "Qwen models via Alibaba DashScope \u2014 strong coding at low cost",
|
|
24198
24198
|
envVar: "DASHSCOPE_API_KEY",
|
|
24199
|
-
apiKeyUrl: "https://
|
|
24199
|
+
apiKeyUrl: "https://modelstudio.console.alibabacloud.com",
|
|
24200
24200
|
docsUrl: "https://help.aliyun.com/zh/model-studio/developer-reference/",
|
|
24201
|
-
baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
24201
|
+
baseUrl: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
|
|
24202
24202
|
supportsCustomModels: true,
|
|
24203
24203
|
openaiCompatible: true,
|
|
24204
24204
|
paymentType: "api",
|
|
@@ -28512,6 +28512,18 @@ async function testConnection(provider, apiKey, model, baseUrl) {
|
|
|
28512
28512
|
p25.log.message(chalk25.dim(" \u2022 Ensure your account has credits"));
|
|
28513
28513
|
p25.log.message(chalk25.dim(" \u2022 Try model: moonshot-v1-8k (most compatible)"));
|
|
28514
28514
|
}
|
|
28515
|
+
if (provider.id === "qwen") {
|
|
28516
|
+
p25.log.message(chalk25.dim("\n\u{1F7E6} Alibaba Qwen specific:"));
|
|
28517
|
+
p25.log.message(chalk25.dim(" \u2022 International console: modelstudio.console.alibabacloud.com"));
|
|
28518
|
+
p25.log.message(chalk25.dim(" \u2022 International API endpoint: dashscope-intl.aliyuncs.com"));
|
|
28519
|
+
p25.log.message(chalk25.dim(" \u2022 China domestic endpoint: dashscope.aliyuncs.com"));
|
|
28520
|
+
p25.log.message(
|
|
28521
|
+
chalk25.dim(
|
|
28522
|
+
" \u2022 If using China endpoint, set: DASHSCOPE_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1"
|
|
28523
|
+
)
|
|
28524
|
+
);
|
|
28525
|
+
p25.log.message(chalk25.dim(" \u2022 Ensure your account has API access enabled"));
|
|
28526
|
+
}
|
|
28515
28527
|
return false;
|
|
28516
28528
|
}
|
|
28517
28529
|
spinner19.stop(chalk25.green("\u2705 Connected successfully!"));
|
|
@@ -28822,10 +28834,6 @@ async function selectProviderInteractively(providers, currentProviderId) {
|
|
|
28822
28834
|
line += chalk25.bgBlue.white(truncate(provider.description, descWidth, "\u2026"));
|
|
28823
28835
|
process.stdout.write(line + "\n");
|
|
28824
28836
|
totalLines++;
|
|
28825
|
-
if (provider.description.length > descWidth) {
|
|
28826
|
-
process.stdout.write(chalk25.bgBlue.white(` ${provider.description}`) + "\n");
|
|
28827
|
-
totalLines++;
|
|
28828
|
-
}
|
|
28829
28837
|
} else {
|
|
28830
28838
|
const marker = isCurrent ? chalk25.green(" \u25CF ") : chalk25.dim(" \u25CB ");
|
|
28831
28839
|
const status = provider.isConfigured ? chalk25.green("\u2713") : chalk25.dim("\u25CB");
|
|
@@ -43682,9 +43690,28 @@ async function startRepl(options = {}) {
|
|
|
43682
43690
|
if (!input && !hasPendingImage()) continue;
|
|
43683
43691
|
let agentMessage = null;
|
|
43684
43692
|
if (input && isSlashCommand(input)) {
|
|
43693
|
+
const prevProviderType = session.config.provider.type;
|
|
43694
|
+
const prevProviderModel = session.config.provider.model;
|
|
43685
43695
|
const { command, args } = parseSlashCommand(input);
|
|
43686
43696
|
const commandResult = await executeSlashCommand(command, args, session);
|
|
43687
43697
|
if (commandResult.shouldExit) break;
|
|
43698
|
+
if (session.config.provider.type !== prevProviderType || session.config.provider.model !== prevProviderModel) {
|
|
43699
|
+
try {
|
|
43700
|
+
const newInternalId = getInternalProviderId(session.config.provider.type);
|
|
43701
|
+
provider = await createProvider(newInternalId, {
|
|
43702
|
+
model: session.config.provider.model || void 0,
|
|
43703
|
+
maxTokens: session.config.provider.maxTokens
|
|
43704
|
+
});
|
|
43705
|
+
setAgentProvider(provider);
|
|
43706
|
+
initializeContextManager(session, provider);
|
|
43707
|
+
} catch (err) {
|
|
43708
|
+
session.config.provider.type = prevProviderType;
|
|
43709
|
+
session.config.provider.model = prevProviderModel;
|
|
43710
|
+
renderError(
|
|
43711
|
+
`Failed to switch provider: ${err instanceof Error ? err.message : String(err)}`
|
|
43712
|
+
);
|
|
43713
|
+
}
|
|
43714
|
+
}
|
|
43688
43715
|
if (commandResult.forkPrompt) {
|
|
43689
43716
|
agentMessage = commandResult.forkPrompt;
|
|
43690
43717
|
} else if (hasPendingImage()) {
|