@moonshot-ai/kimi-code 0.14.2 → 0.14.3
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.mjs +41 -6
- package/package.json +4 -4
package/dist/main.mjs
CHANGED
|
@@ -121453,7 +121453,7 @@ var McpConnectionManager = class {
|
|
|
121453
121453
|
const startupClient = this.createClient(entry.config, entry.name);
|
|
121454
121454
|
client = startupClient;
|
|
121455
121455
|
entry.client = startupClient;
|
|
121456
|
-
const tools = await withTimeout(this.connectAndDiscoverTools(startupClient), timeoutMs, () => {
|
|
121456
|
+
const tools = await withTimeout$1(this.connectAndDiscoverTools(startupClient), timeoutMs, () => {
|
|
121457
121457
|
this.closeRuntimeClient(startupClient);
|
|
121458
121458
|
});
|
|
121459
121459
|
if (!this.isCurrent(entry, attemptId)) {
|
|
@@ -121607,7 +121607,7 @@ function stderrTail(client) {
|
|
|
121607
121607
|
if (snapshot.length === 0) return void 0;
|
|
121608
121608
|
return snapshot.trimEnd();
|
|
121609
121609
|
}
|
|
121610
|
-
async function withTimeout(promise, timeoutMs, onTimeout) {
|
|
121610
|
+
async function withTimeout$1(promise, timeoutMs, onTimeout) {
|
|
121611
121611
|
let timer;
|
|
121612
121612
|
try {
|
|
121613
121613
|
return await new Promise((resolve, reject) => {
|
|
@@ -158078,6 +158078,7 @@ async function loadManagedUsageReport(host) {
|
|
|
158078
158078
|
}
|
|
158079
158079
|
//#endregion
|
|
158080
158080
|
//#region src/tui/commands/config.ts
|
|
158081
|
+
const MODEL_PICKER_REFRESH_TIMEOUT_MS = 2e3;
|
|
158081
158082
|
async function handlePlanCommand(host, args) {
|
|
158082
158083
|
const session = host.session;
|
|
158083
158084
|
if (session === void 0) {
|
|
@@ -158222,8 +158223,9 @@ async function handleThemeCommand(host, args) {
|
|
|
158222
158223
|
}
|
|
158223
158224
|
await applyThemeChoice(host, theme);
|
|
158224
158225
|
}
|
|
158225
|
-
function handleModelCommand(host, args) {
|
|
158226
|
+
async function handleModelCommand(host, args) {
|
|
158226
158227
|
const alias = args.trim();
|
|
158228
|
+
await refreshModelsForPicker(host);
|
|
158227
158229
|
if (alias.length === 0) {
|
|
158228
158230
|
showModelPicker(host);
|
|
158229
158231
|
return;
|
|
@@ -158247,6 +158249,27 @@ function showEditorPicker(host) {
|
|
|
158247
158249
|
}
|
|
158248
158250
|
}));
|
|
158249
158251
|
}
|
|
158252
|
+
async function refreshModelsForPicker(host) {
|
|
158253
|
+
try {
|
|
158254
|
+
const result = await withTimeout(host.authFlow.refreshOAuthProviderModels(), MODEL_PICKER_REFRESH_TIMEOUT_MS);
|
|
158255
|
+
if (result === void 0) return;
|
|
158256
|
+
for (const f of result.failed) host.showStatus(`Skipped refreshing ${f.provider}: ${f.reason}`, "warning");
|
|
158257
|
+
} catch (error) {
|
|
158258
|
+
host.showStatus(`Skipped refreshing models: ${formatErrorMessage$2(error)}`, "warning");
|
|
158259
|
+
}
|
|
158260
|
+
}
|
|
158261
|
+
async function withTimeout(promise, timeoutMs) {
|
|
158262
|
+
let timeout;
|
|
158263
|
+
try {
|
|
158264
|
+
return await Promise.race([promise, new Promise((resolve) => {
|
|
158265
|
+
timeout = setTimeout(() => {
|
|
158266
|
+
resolve(void 0);
|
|
158267
|
+
}, timeoutMs);
|
|
158268
|
+
})]);
|
|
158269
|
+
} finally {
|
|
158270
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
158271
|
+
}
|
|
158272
|
+
}
|
|
158250
158273
|
async function applyEditorChoice(host, value) {
|
|
158251
158274
|
if (value === (host.state.appState.editorCommand ?? "") && value.length > 0) {
|
|
158252
158275
|
host.showStatus(`Editor unchanged: ${value.length > 0 ? value : "auto-detect"}`);
|
|
@@ -167039,7 +167062,7 @@ async function handleBuiltInSlashCommand(host, name, args) {
|
|
|
167039
167062
|
await handleThemeCommand(host, args);
|
|
167040
167063
|
return;
|
|
167041
167064
|
case "model":
|
|
167042
|
-
handleModelCommand(host, args);
|
|
167065
|
+
await handleModelCommand(host, args);
|
|
167043
167066
|
return;
|
|
167044
167067
|
case "provider":
|
|
167045
167068
|
await handleProviderCommand(host);
|
|
@@ -170115,10 +170138,11 @@ function pickDefaultModel(config, providerId, models) {
|
|
|
170115
170138
|
}
|
|
170116
170139
|
return firstModel.id;
|
|
170117
170140
|
}
|
|
170118
|
-
async function refreshAllProviderModels(host) {
|
|
170141
|
+
async function refreshAllProviderModels(host, options = {}) {
|
|
170119
170142
|
const changed = [];
|
|
170120
170143
|
const unchanged = [];
|
|
170121
170144
|
const failed = [];
|
|
170145
|
+
const scope = options.scope ?? "all";
|
|
170122
170146
|
let config = await host.getConfig();
|
|
170123
170147
|
const managedProvider = config.providers[KIMI_CODE_PROVIDER_NAME];
|
|
170124
170148
|
if (managedProvider !== void 0 && managedProvider.type === "kimi" && managedProvider.oauth !== void 0) try {
|
|
@@ -170168,6 +170192,11 @@ async function refreshAllProviderModels(host) {
|
|
|
170168
170192
|
reason: error instanceof Error ? error.message : String(error)
|
|
170169
170193
|
});
|
|
170170
170194
|
}
|
|
170195
|
+
if (scope === "oauth") return {
|
|
170196
|
+
changed,
|
|
170197
|
+
unchanged,
|
|
170198
|
+
failed
|
|
170199
|
+
};
|
|
170171
170200
|
const openPlatformIds = Object.keys(config.providers).filter((id) => isOpenPlatformId(id));
|
|
170172
170201
|
for (const providerId of openPlatformIds) {
|
|
170173
170202
|
const platform = getOpenPlatformById(providerId);
|
|
@@ -170422,6 +170451,12 @@ var AuthFlowController = class {
|
|
|
170422
170451
|
* and returned instead of thrown.
|
|
170423
170452
|
*/
|
|
170424
170453
|
async refreshProviderModels() {
|
|
170454
|
+
return this.refreshProviderModelsWithScope("all");
|
|
170455
|
+
}
|
|
170456
|
+
async refreshOAuthProviderModels() {
|
|
170457
|
+
return this.refreshProviderModelsWithScope("oauth");
|
|
170458
|
+
}
|
|
170459
|
+
async refreshProviderModelsWithScope(scope) {
|
|
170425
170460
|
const { host } = this;
|
|
170426
170461
|
const result = await refreshAllProviderModels({
|
|
170427
170462
|
getConfig: () => host.harness.getConfig({ reload: true }),
|
|
@@ -170430,7 +170465,7 @@ var AuthFlowController = class {
|
|
|
170430
170465
|
resolveOAuthToken: async (providerName, oauthRef) => {
|
|
170431
170466
|
return host.harness.auth.resolveOAuthTokenProvider(providerName, oauthRef).getAccessToken();
|
|
170432
170467
|
}
|
|
170433
|
-
});
|
|
170468
|
+
}, { scope });
|
|
170434
170469
|
if (result.changed.length > 0) await this.refreshAvailableModels();
|
|
170435
170470
|
return result;
|
|
170436
170471
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonshot-ai/kimi-code",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "The Starting Point for Next-Gen Agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Moonshot AI",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"postject": "1.0.0-alpha.6",
|
|
61
61
|
"tsx": "^4.21.0",
|
|
62
62
|
"yazl": "^3.3.1",
|
|
63
|
-
"@moonshot-ai/kimi-code-oauth": "^0.2.2",
|
|
64
63
|
"@moonshot-ai/acp-adapter": "^0.2.5",
|
|
65
64
|
"@moonshot-ai/kimi-telemetry": "^0.1.1",
|
|
66
|
-
"@moonshot-ai/kimi-code-
|
|
67
|
-
"@moonshot-ai/migration-legacy": "^0.1.12"
|
|
65
|
+
"@moonshot-ai/kimi-code-oauth": "^0.2.2",
|
|
66
|
+
"@moonshot-ai/migration-legacy": "^0.1.12",
|
|
67
|
+
"@moonshot-ai/kimi-code-sdk": "^0.9.3"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=22.19.0"
|