From 35dbb00eda4e221d0536823d40f93e9f041ebc8e Mon Sep 17 00:00:00 2001 From: Rati Gigauri Date: Mon, 12 Oct 2026 19:03:37 +0400 Subject: [PATCH] fix(kimi): bump supported Kimi version and fix Windows native install Bumps the Kimi supported/minimum version pins (0.42.0 -> 2.1.1), passes the target version via env on the Windows PowerShell installer (irm | iex can't take positional args), routes kimi/kimi-acp updates through the native installer instead of npm, and adds doctor-check coverage for a pinned-version match/mismatch. Generated with AI Co-Authored-By: codemie-ai --- src/agents/plugins/kimi/kimi.plugin.ts | 7 +++- .../checks/__tests__/doctor-checks.test.ts | 38 +++++++++++++++++++ src/cli/commands/update.ts | 3 ++ src/utils/native-installer.ts | 6 +++ 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/src/agents/plugins/kimi/kimi.plugin.ts b/src/agents/plugins/kimi/kimi.plugin.ts index ec225310b..ab298df36 100644 --- a/src/agents/plugins/kimi/kimi.plugin.ts +++ b/src/agents/plugins/kimi/kimi.plugin.ts @@ -23,8 +23,8 @@ import { resolveHomeDir } from '../../../utils/paths.js'; // Recommended version (one non-blocking notice on mismatch) and the hard gate // below which the agent refuses to launch. Rule: the minimum is the previously // recommended version — when bumping the former, move its old value to the latter. -const KIMI_SUPPORTED_VERSION = '0.42.0'; -const KIMI_MINIMUM_SUPPORTED_VERSION = '0.16.0'; +const KIMI_SUPPORTED_VERSION = '2.1.1'; +const KIMI_MINIMUM_SUPPORTED_VERSION = '0.42.0'; const KIMI_NATIVE_BINARY_PATH = '.kimi-code/bin/kimi'; const KIMI_INSTALLER_URLS = { @@ -191,6 +191,9 @@ export class KimiPlugin extends BaseAgentAdapter { version, { timeout: 300000, + // install.ps1 reads its version from env; install.sh takes it positionally + // and rejects both at once, so set env on Windows only. + env: process.platform === 'win32' && version ? { KIMI_VERSION: version } : undefined, verifyCommand: this.metadata.cliCommand || undefined, verifyPath: process.platform === 'win32' ? undefined : resolveHomeDir(KIMI_NATIVE_BINARY_PATH), diff --git a/src/cli/commands/doctor/checks/__tests__/doctor-checks.test.ts b/src/cli/commands/doctor/checks/__tests__/doctor-checks.test.ts index 26701e108..b9af5630c 100644 --- a/src/cli/commands/doctor/checks/__tests__/doctor-checks.test.ts +++ b/src/cli/commands/doctor/checks/__tests__/doctor-checks.test.ts @@ -322,6 +322,44 @@ describe('AgentsCheck', () => { expect(displayed).toEqual([{ status: 'ok', message: 'Gemini (2.0.0)' }]); expect(result.details).toHaveLength(1); }); + + it('reports ok when the installed version matches a pinned supportedVersion', async () => { + h.getInstalledAgentsMock.mockResolvedValue([ + { + displayName: 'Kimi Code', + getVersion: async () => '2.1.1', + checkVersionCompatibility: async () => ({ + isBelowMinimum: false, + supportedVersion: '2.1.1', + minimumSupportedVersion: '0.42.0', + }), + }, + ]); + const result = await new AgentsCheck().run(); + expect(result.details).toEqual([{ status: 'ok', message: 'Kimi Code (2.1.1)' }]); + }); + + it('warns when the installed version no longer matches a pinned supportedVersion', async () => { + h.getInstalledAgentsMock.mockResolvedValue([ + { + displayName: 'Kimi Code', + getVersion: async () => '0.42.0', + checkVersionCompatibility: async () => ({ + isBelowMinimum: false, + supportedVersion: '2.1.1', + minimumSupportedVersion: '0.42.0', + }), + }, + ]); + const result = await new AgentsCheck().run(); + expect(result.details).toEqual([ + { + status: 'warn', + message: 'Kimi Code (0.42.0) - CodeMie recommends v2.1.1', + hint: expect.stringContaining('--supported'), + }, + ]); + }); }); // ──────────────────────────────────────────────────────────────────────────────────── diff --git a/src/cli/commands/update.ts b/src/cli/commands/update.ts index fea84684d..b6636cc7c 100644 --- a/src/cli/commands/update.ts +++ b/src/cli/commands/update.ts @@ -212,6 +212,9 @@ async function updateAgent(agent: AgentAdapter, latestVersion: string): Promise< // Special handling for Claude (uses native installer) if (agent.name === 'claude' && agent.installVersion) { await agent.installVersion('supported'); + } else if ((agent.name === 'kimi' || agent.name === 'kimi-acp') && agent.installVersion) { + // Kimi is installed natively; an npm install would leave the checked binary stale + await agent.installVersion(latestVersion); } else if (agent.metadata.isBuiltIn) { // Special handling for built-in agent — update the CLI package await npm.installGlobal(CLI_PACKAGE_NAME, { version: latestVersion, force: true }); diff --git a/src/utils/native-installer.ts b/src/utils/native-installer.ts index 8da1816bd..6d266298b 100644 --- a/src/utils/native-installer.ts +++ b/src/utils/native-installer.ts @@ -112,6 +112,12 @@ function buildInstallerCommand( } // Build platform-specific command + if (platform === 'windows' && url.endsWith('.ps1')) { + // PowerShell installer: `irm | iex` can't take arguments, so scripts read their + // version from env (NativeInstallOptions.env); installFlags are not supported. + return `powershell -NoProfile -ExecutionPolicy Bypass -Command "irm ${url} | iex"`; + } + if (platform === 'windows') { // Windows CMD command (simpler and more universal than PowerShell) // Download install.cmd, execute with args, then delete