Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/agents/plugins/kimi/kimi.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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),
Expand Down
38 changes: 38 additions & 0 deletions src/cli/commands/doctor/checks/__tests__/doctor-checks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
},
]);
});
});

// ────────────────────────────────────────────────────────────────────────────────────
Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
6 changes: 6 additions & 0 deletions src/utils/native-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down