Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
be159af
Fixing error on Kimi K2.5 thinking
Neonsy Jan 30, 2026
673aed1
Document fix for Kimi K2.5 error
Neonsy Jan 30, 2026
52ad122
Attempt on improving types
Neonsy Jan 30, 2026
85cf7d7
final chore cleanup
Neonsy Jan 30, 2026
2561b3f
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Jan 30, 2026
c6ddfba
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Jan 30, 2026
27d9e5e
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Jan 31, 2026
bc7f932
Merge branch 'Kilo-Org:main' into fix/kimi-k2-5_thinking-fix
Neonsy Jan 31, 2026
efe9cef
fix pnpm install:vsix for windows
Neonsy Jan 31, 2026
d901121
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 2, 2026
042d403
Fixed jetbrain check failure due to main merge
Neonsy Feb 2, 2026
baf4fc7
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 2, 2026
a5a89eb
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 3, 2026
d106d70
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 3, 2026
1d2e2dd
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 3, 2026
700651c
Added fix to make Kimi K2.5 thinking work for the other Moonshot prov…
Neonsy Feb 3, 2026
c5915c0
Fix type error
Neonsy Feb 3, 2026
6afeefe
Fix test error
Neonsy Feb 4, 2026
296084c
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 4, 2026
ff1574a
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 4, 2026
6f9496f
Removed NPX as requested
Neonsy Feb 4, 2026
0fd94d9
Fix follow up eslint error
Neonsy Feb 4, 2026
b4054e8
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 4, 2026
4bf6ca0
Merge branch 'main' into fix/kimi-k2-5_thinking-fix
Neonsy Feb 5, 2026
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
5 changes: 5 additions & 0 deletions .changeset/rare-stingrays-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Fixing error on Kimi K2.5 thinking
11 changes: 10 additions & 1 deletion jetbrains/host/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ export default [
"no-const-assign": "off",
},
},
{
files: ["scripts/**/*.js"],
languageOptions: {
globals: {
console: "readonly",
process: "readonly",
},
},
},
{
ignores: ["dist", "deps"],
},
]
]
8 changes: 5 additions & 3 deletions jetbrains/host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
"type": "module",
"scripts": {
"deps:check": "node ../../jetbrains/scripts/check-dependencies.js",
"deps:ensure": "node scripts/ensure-vscode-deps.js",
"deps:patch": "npm run deps:check && cd ../../deps/vscode && git reset --hard HEAD && git clean -fd && git apply ../patches/vscode/jetbrains.patch",
"deps:clean": "rm -rf ./deps/vscode/* || true",
"deps:copy": "npm run deps:check && npx cpy '../../deps/vscode/src/**' './deps/vscode' --parents",
"deps:clean": "del-cli ./deps/vscode --force",
"deps:copy": "npm run deps:check && cpy '../../deps/vscode/src/**' './deps/vscode' --parents",
"clean": "del-cli ./dist",
"prebuild": "node scripts/ensure-vscode-deps.js",
"build": "tsc",
"build:clean": "npm run clean && npm run build",
"start": "node ./dist/src/main.js",
"dev": "tsc && node ./dist/src/main.js",
"bundle:package": "cp ./package.json ./dist/package.json",
"bundle:package": "cpy ./package.json ./dist",
"bundle:build": "tsc --noEmit && tsup",
"lint": "eslint . --ext=ts --max-warnings=0"
},
Expand Down
100 changes: 100 additions & 0 deletions jetbrains/host/scripts/ensure-vscode-deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/usr/bin/env node

/**
* Ensure JetBrains host has a local copy of VSCode sources needed for build.
* This avoids running JetBrains plugin dependency checks (Java/Gradle).
*/

import fs from "fs"
import path from "path"
import { spawnSync } from "child_process"
import { fileURLToPath } from "url"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const hostDir = path.resolve(__dirname, "..")
const projectRoot = path.resolve(hostDir, "..", "..")

const vscodeDir = path.join(projectRoot, "deps", "vscode")
const sourceDir = path.join(vscodeDir, "src")
const targetDir = path.join(hostDir, "deps", "vscode")

const expectedSourceFile = path.join(sourceDir, "vs", "base", "common", "uri.ts")
const patchMarkerSource = path.join(
sourceDir,
"vs",
"workbench",
"services",
"extensions",
"common",
"fileRPCProtocolLogger.ts",
)
const patchMarkerTarget = path.join(
targetDir,
"vs",
"workbench",
"services",
"extensions",
"common",
"fileRPCProtocolLogger.ts",
)
const patchFile = path.join(projectRoot, "deps", "patches", "vscode", "jetbrains.patch")

function fail(message) {
console.error(message)
process.exit(1)
}

if (!fs.existsSync(sourceDir) || !fs.existsSync(expectedSourceFile)) {
fail(
[
"VSCode submodule is missing or incomplete.",
"Run: git submodule update --init --recursive deps/vscode",
].join("\n"),
)
}

if (!fs.existsSync(patchMarkerSource)) {
const status = spawnSync("git", ["status", "--porcelain"], {
cwd: vscodeDir,
encoding: "utf8",
})
if (status.status !== 0) {
fail("Failed to check VSCode submodule status. Ensure git is available.")
}

if ((status.stdout || "").trim().length > 0) {
fail(
[
"VSCode submodule has local changes. Cannot apply JetBrains patch automatically.",
"Stash or reset submodule changes, then run:",
" pnpm run deps:patch",
].join("\n"),
)
}

const apply = spawnSync("git", ["apply", patchFile], {
cwd: vscodeDir,
stdio: "inherit",
})
if (apply.status !== 0) {
fail("Failed to apply JetBrains patch to VSCode submodule.")
}

if (!fs.existsSync(patchMarkerSource)) {
fail("JetBrains patch did not apply cleanly to the VSCode submodule.")
}
}

if (fs.existsSync(patchMarkerTarget)) {
process.exit(0)
}

fs.rmSync(targetDir, { recursive: true, force: true })
fs.mkdirSync(targetDir, { recursive: true })
fs.cpSync(sourceDir, targetDir, { recursive: true })

if (!fs.existsSync(patchMarkerTarget)) {
fail("Failed to copy VSCode sources into jetbrains/host/deps/vscode.")
}
30 changes: 15 additions & 15 deletions jetbrains/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
"mkdirp": "^3.0.1"
},
"scripts": {
"clean": "./gradlew clean",
"build": "./gradlew buildPlugin -PdebugMode=idea",
"run": "./gradlew runIde -PdebugMode=idea",
"run:bundle": "./gradlew runIde -PdebugMode=release",
"bundle": "./gradlew buildPlugin -PdebugMode=release",
"clean": "node scripts/run-gradle.js clean",
"build": "node scripts/run-gradle.js buildPlugin -PdebugMode=idea",
"run": "node scripts/run-gradle.js runIde -PdebugMode=idea",
"run:bundle": "node scripts/run-gradle.js runIde -PdebugMode=release",
"bundle": "node scripts/run-gradle.js buildPlugin -PdebugMode=release",
"bundle:name": "node scripts/get_bundle_name.js",
"clean:kilocode": "npx del-cli ./plugins/kilocode --force && npx mkdirp ./plugins/kilocode",
"copy:kilocode": "npx cpy '../../bin-unpacked/extension/**' './plugins/kilocode/extension' --parents",
"clean:resource-kilocode": "npx del-cli ../resources/kilocode --force",
"copy:resource-kilocode": "npx cpy '../../bin-unpacked/extension/**' '../resources/kilocode' --parents",
"clean:resource-host": "npx del-cli ../resources/runtime --force",
"copy:resource-host": "npx cpy '../host/dist/**' '../resources/runtime' --parents",
"clean:resource-logs": "npx del-cli ../resources/logs --force",
"copy:resource-logs": "npx mkdirp ../resources/logs",
"clean:resource-nodemodules": "npx del-cli ../resources/node_modules --force && npx del-cli ../resources/package.json --force",
"clean:kilocode": "del-cli ./plugins/kilocode --force && mkdirp ./plugins/kilocode",
"copy:kilocode": "cpy '../../bin-unpacked/extension/**' './plugins/kilocode/extension' --parents",
"clean:resource-kilocode": "del-cli ../resources/kilocode --force",
"copy:resource-kilocode": "cpy '../../bin-unpacked/extension/**' '../resources/kilocode' --parents",
"clean:resource-host": "del-cli ../resources/runtime --force",
"copy:resource-host": "cpy '../host/dist/**' '../resources/runtime' --parents",
"clean:resource-logs": "del-cli ../resources/logs --force",
"copy:resource-logs": "mkdirp ../resources/logs",
"clean:resource-nodemodules": "del-cli ../resources/node_modules --force && del-cli ../resources/package.json --force",
"copy:resource-nodemodules": "cp ../host/package.json ../resources/package.json && npm install --prefix ../resources",
"propDep": "npx del-cli ./propDep.txt --force && npm ls --omit=dev --all --parseable --prefix ../resources > ./prodDep.txt",
"propDep": "del-cli ./propDep.txt --force && npm ls --omit=dev --all --parseable --prefix ../resources > ./prodDep.txt",
"sync:version": "node scripts/sync_version.js",
"sync:changelog": "node scripts/update_change_notes.js"
}
Expand Down
107 changes: 107 additions & 0 deletions jetbrains/plugin/scripts/run-gradle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env node

/**
* Cross-platform Gradle wrapper script that checks for Java availability
* before running Gradle commands. This allows the JetBrains plugin build
* to gracefully skip when Java is not installed (e.g., when building only
* the VSCode extension).
*/

import { spawn } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Get the command to run from command line arguments
const args = process.argv.slice(2);
const command = args.join(' ');

if (!command) {
console.error('Usage: node scripts/run-gradle.js <gradle-command>');
process.exit(1);
}

// Check if Java is available
function checkJava() {
return new Promise((resolve) => {
const javaProcess = spawn('java', ['-version'], {
stdio: ['ignore', 'pipe', 'pipe'],
shell: true,
});

let output = '';
let error = '';

javaProcess.stdout.on('data', (data) => {
output += data.toString();
});

javaProcess.stderr.on('data', (data) => {
error += data.toString();
});

javaProcess.on('close', (code) => {
// Java -version outputs to stderr on most systems
const versionOutput = error || output;
resolve(code === 0 && versionOutput.includes('version'));
});

javaProcess.on('error', () => {
resolve(false);
});

// Timeout after 5 seconds
setTimeout(() => {
javaProcess.kill();
resolve(false);
}, 5000);
});
}

// Run Gradle command
function runGradle(command) {
return new Promise((resolve, reject) => {
const isWindows = process.platform === 'win32';
const gradleCmd = isWindows ? 'gradlew.bat' : './gradlew';

const gradleProcess = spawn(gradleCmd, args, {
stdio: 'inherit',
shell: true,
cwd: path.join(__dirname, '..'),
});

gradleProcess.on('close', (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`Gradle command exited with code ${code}`));
}
});

gradleProcess.on('error', (err) => {
reject(err);
});
});
}

async function main() {
const javaAvailable = await checkJava();

if (!javaAvailable) {
console.warn('Warning: Java is not installed or not available in PATH.');
console.warn('Skipping Gradle command:', command);
console.warn('This is expected if you are only building the VSCode extension.');
process.exit(0);
}

try {
await runGradle(command);
} catch (error) {
console.error('Gradle command failed:', error.message);
process.exit(1);
}
}

main();
2 changes: 1 addition & 1 deletion packages/types/src/providers/synthetic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export const syntheticModels: Record<string, ModelInfo> = {
supportsComputerUse: false,
supportsReasoningEffort: false,
supportsReasoningBudget: false,
supportedParameters: [],
// kilocode_change: omit supportedParameters so defaults apply
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,52 @@ describe("BaseOpenAiCompatibleProvider", () => {
)
})

// kilocode_change start
it("should omit temperature when model does not support it", async () => {
mockCreate.mockImplementationOnce(() => {
return {
[Symbol.asyncIterator]: () => ({
async next() {
return { done: true }
},
}),
}
})

class NoTempProvider extends BaseOpenAiCompatibleProvider<"test-model"> {
constructor(apiKey: string) {
const testModels: Record<"test-model", ModelInfo> = {
"test-model": {
maxTokens: 4096,
contextWindow: 128000,
supportsImages: false,
supportsPromptCache: false,
inputPrice: 0.5,
outputPrice: 1.5,
supportsTemperature: false,
},
}

super({
providerName: "NoTempProvider",
baseURL: "https://test.example.com/v1",
defaultProviderModelId: "test-model",
providerModels: testModels,
apiKey,
})
}
}

const noTempHandler = new NoTempProvider("test-api-key")
const messageGenerator = noTempHandler.createMessage("system prompt", [])
await messageGenerator.next()

expect(mockCreate).toHaveBeenCalled()
const callArgs = mockCreate.mock.calls[0][0]
expect(callArgs).not.toHaveProperty("temperature")
})
// kilocode_change end

it("should yield usage data from stream", async () => {
mockCreate.mockImplementationOnce(() => {
return {
Expand Down
16 changes: 16 additions & 0 deletions src/api/providers/__tests__/moonshot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,22 @@ describe("MoonshotHandler", () => {
expect(usageChunks[0].cacheWriteTokens).toBe(0)
expect(usageChunks[0].cacheReadTokens).toBe(2)
})

// kilocode_change start
it("should omit temperature for models that do not support it", async () => {
const handlerWithFixedTempModel = new MoonshotHandler({
...mockOptions,
apiModelId: "kimi-k2.5",
})

const stream = handlerWithFixedTempModel.createMessage(systemPrompt, messages)
await stream.next()

expect(mockCreate).toHaveBeenCalled()
const callArgs = mockCreate.mock.calls[0][0]
expect(callArgs).not.toHaveProperty("temperature")
})
// kilocode_change end
})

describe("completePrompt", () => {
Expand Down
Loading
Loading