Commit Graph
3489 Commits
Author SHA1 Message Date
Alex Alecu 573680446e publish bus event after TsClient diagnostics 2026-03-17 11:26:04 +02:00
Alex Alecu bf5b827f2f add timeout to TsClient diagnostic wait 2026-03-17 11:26:04 +02:00
Alex Alecu be5709066f kill stuck tsgo process after timeout 2026-03-17 11:26:04 +02:00
Marian Alexandru Alecu 12ef3336ef Merge branch 'main' into feat/process-diagnostics-status-dialog 2026-03-17 10:58:28 +02:00
Imanol Maiztegui 0484318191 Granular bash permission rules (#7091)
* fix: renamed pattern arrays used for permission rules

* fix: rename savePatternRules to saveAlwaysRules

* feat: generate hierarchical always patterns in bash tool

* feat: validate saveAlwaysRules against always array only

* feat: pass always field through extension bridge to webview

* feat: show hierarchical always patterns in PermissionDock dropdown

* fix: rename pattern to rule in PermissionDock translations, styles, and data-slots

* fix(vscode): correct auto-run comment in PermissionDock

* feat(kilo-vscode): strip trailing wildcard from permission rule labels

* fix: deduplicate permission rules and strip wildcards from display labels

* refactor: move hierarchy to metadata.rules, restore always to arity prefix

* feat: pass always field to permission dock for non-bash tool rules

* fix: correct bash test assertion to check metadata.rules and fix indentation

* fix: hide permission rules dropdown for non-bash tools

* fix: align always-rules route descriptions, whitespace, and restore multi-command tests
2026-03-16 17:43:16 +01:00
John Brick 4c5bd13687 fix: use correct config.json schema URL (app.kilo.ai) (#7086)
The $schema URL in source code and documentation referenced
https://kilo.ai/config.json which returns 404. The correct URL
is https://app.kilo.ai/config.json (already used in test files).

Updated all remaining references in:
- packages/opencode/src/config/config.ts (4 occurrences)
- packages/kilo-docs/pages/code-with-ai/platforms/cli.md (4 occurrences)
- packages/kilo-docs/pages/customize/custom-subagents.md (1 occurrence)

Fixes #7063
2026-03-16 16:38:55 +00:00
Marius 88a55980e9 fix: guard temperature and prevent prompt injection in enhance-prompt (#7103)
* fix: use direct generateText for prompt enhancement instead of LLM.stream

* fix: guard temperature for models that disable it, move instruction to system message

- Check model.capabilities.temperature before setting temperature
- Move the enhance instruction to a system message to prevent user text
  from overriding the instruction via prompt injection
2026-03-16 16:21:27 +00:00
Marian Alexandru Alecu c45bee361f Merge branch 'main' into feat/process-diagnostics-status-dialog 2026-03-16 17:14:58 +02:00
Mark IJbema b8e196d151 fix: also remove mode from legacy .kilocodemodes files used by ModesMigrator
Agent.remove() now also scans the .kilocodemodes YAML files that
ModesMigrator reads (VSCode global storage, ~/.kilocode/cli/global/,
~/.kilocodemodes, project .kilocodemodes) and removes the matching
entry by slug, so migrated modes don't reappear after deletion.
2026-03-16 16:01:19 +01:00
Mark IJbema 0b702ea1d7 feat: add backend route to delete custom mode files from disk
Replace the config disable:true approach with a proper Agent.remove()
function that scans config directories for the agent's markdown file
and deletes it, then refreshes state via Instance.dispose().

- Add Agent.remove() in agent.ts with RemoveError
- Add POST /kilocode/agent/remove route
- Mount KilocodeRoutes in server.ts
- Update KiloProvider to call the new backend route
- Regenerate SDK
2026-03-16 15:54:45 +01:00
Marius 91aa29ba83 fix: use direct generateText for prompt enhancement instead of LLM.stream (#7101) 2026-03-16 15:31:40 +01:00
Alex Alecu 2602c6701d fix: resolve workspace-local tsc from node_modules
Bun.which('tsc') only finds a globally installed tsc. Most projects
have typescript in node_modules without a global install. Walk up
from root looking for node_modules/typescript/bin/tsc before falling
back to the global tsc.
2026-03-16 16:14:10 +02:00
Alex Alecu 6c3a662bb9 fix: fallback to TsClient when tsgo LSP spawn fails in experimental mode
When KILO_EXPERIMENTAL_LSP_TOOL is on but tsgo binary is missing,
spawn() returns undefined and schedule() marks typescript as broken.
Now falls back to the lightweight TsClient instead of losing TS
diagnostics entirely.
2026-03-16 16:14:05 +02:00
Christiaan Arnoldus 7e69e22afe Merge pull request #7071 from Kilo-Org/revert-6629-fix/remove-duplicate-reasoning-hack
de-duplicate reasoning hack for OpenRouter
2026-03-16 15:04:52 +01:00
Alex Alecu 215770fa9e feat: use persistent tsgo --lsp server when KILO_EXPERIMENTAL_LSP_TOOL is enabled
When the flag is set, Typescript.spawn() resolves the native tsgo binary
and starts it with --lsp --stdio as a persistent LSP server, providing
full diagnostics, hover, go-to-definition, etc. The TsClient lightweight
fallback (tsgo --noEmit on demand) remains the default when the flag is
not set.

- Export native_tsgo() from ts-check.ts for reuse by the LSP server spawn
- Restore Typescript.spawn() body gated on KILO_EXPERIMENTAL_LSP_TOOL
- Gate TsClient short-circuit in index.ts on !Flag.KILO_EXPERIMENTAL_LSP_TOOL
2026-03-16 15:59:05 +02:00
Alex Alecu e3cbc1b3ec refactor: remove process tree status dialog feature
Remove the /process server route, ProcessInfo module, and all
process-related UI in the status dialog (formatBytes, shortCommand,
refresh timer, process JSX). This simplifies the status dialog and
removes ~460 lines of code that added process tree diagnostics.
2026-03-16 15:59:05 +02:00
Marian Alexandru Alecu a8f167e041 Merge branch 'main' into feat/process-diagnostics-status-dialog 2026-03-16 15:58:26 +02:00
Mark IJbema bce8c6e6dd fix: validate skill location against registry before deletion and re-sync webview on failure 2026-03-16 13:43:34 +01:00
Christiaan Arnoldus 269fd052e3 Adjust for OpenRouter, some improvements 2026-03-16 13:36:10 +01:00
Alex Alecu 7078246d7d perf: enable --incremental for warm tsgo runs (~200-400ms after first check)
tsgo writes a .tsbuildinfo cache so subsequent runs skip re-checking
unchanged files. First edit is still ~1.3s cold, but every edit after
that reuses the cache and drops to ~200-400ms — matching the old
language server latency with zero persistent memory.
2026-03-16 14:15:05 +02:00
Mark IJbema cfe4e8c46c fix: switch skill removal to POST with JSON body instead of DELETE with query params
File paths as query parameters can fail due to URL encoding issues.
Switch to POST /kilocode/skill/remove with the location in the JSON
request body, which avoids encoding problems entirely.

Also log the SDK error response to aid debugging.
2026-03-16 13:04:07 +01:00
Mark IJbema 9507b01c4c fix: rely on optimistic removal instead of stale backend response
The DELETE endpoint was returning data that somehow rendered as empty
rows in the webview. Simplify the approach:

- Webview optimistically removes the skill from its signal immediately
- Extension fires DELETE to the backend (deletes from disk + cache)
- Extension invalidates cachedSkillsMessage so next tab visit fetches
  fresh data
- No second skillsLoaded message is sent after removal, avoiding the
  stale data overwrite that caused the UI corruption
2026-03-16 13:04:07 +01:00
Mark IJbema f998ee32dc fix: return updated skills list from DELETE endpoint to fix stale UI
The DELETE /kilocode/skill endpoint now returns the updated skills
list (Skill.Info[]) instead of a boolean. The extension uses this
response directly to update the webview, eliminating the need for a
separate GET /skill round-trip that could return stale cached data.

Also normalize paths in Skill.remove() with path.resolve() to ensure
location strings match regardless of path format differences.
2026-03-16 13:04:07 +01:00
Mark IJbema 2d9e447399 refactor: rename to KilocodeRoutes at /kilocode prefix
Rename routes/skill.ts to routes/kilocode.ts with KilocodeRoutes
export, mounted at /kilocode. This is the single home for all future
kilo-specific CLI endpoints, avoiding conflicts with the existing
/kilo gateway routes and keeping all kilo changes out of server.ts.

SDK: client.kilocode.removeSkill()
2026-03-16 13:04:07 +01:00
Mark IJbema 07d16dff23 refactor: move DELETE /skill to dedicated route file
Extract the inline DELETE /skill endpoint from server.ts into a
dedicated packages/opencode/src/server/routes/skill.ts file, reducing
kilo-specific changes in the shared server.ts and minimizing future
merge conflicts with upstream.

The route is mounted at /skill and uses the same lazy() pattern as
other kilo-specific route files (telemetry, enhance-prompt, etc.).
2026-03-16 13:04:07 +01:00
Mark IJbema ec544e8288 feat: add DELETE /skill endpoint and use CLI backend for skill removal
Add Skill.remove() that deletes the skill directory from disk and
mutates the cached Instance.state in-place so subsequent GET /skill
calls return the updated list.

Add DELETE /skill?location=... server endpoint, regenerate the SDK,
and update KiloProvider to call the SDK method instead of deleting
files directly from the extension.
2026-03-16 13:04:07 +01:00
Alex Alecu 08675183b5 fix: defer tsgo to waitForDiagnostics, skip warm-up calls
notify.open() is now a no-op. Warm-up calls from read.ts
(touchFile(path, false)) no longer spawn tsgo processes.
Only write/edit/apply_patch trigger a check via waitForDiagnostics().
2026-03-16 12:05:25 +02:00
Alex Alecu f9ea76843c fix: resolve native tsgo binary directly, skip node.js wrapper
The node_modules/.bin/tsgo script is a node.js wrapper that spawns a
node process just to execFileSync the native binary. This caused a
3+ GB node process visible in the process tree.

Now resolve the platform-specific native binary directly from
@typescript/native-preview-{platform}-{arch}, walking up the
directory tree including bun's hoisted .bun/ layout.
2026-03-16 12:05:20 +02:00
Christiaan Arnoldus 971935f2a3 Revert "fix: remove duplicate reasoning hack for kilo provider" 2026-03-16 11:00:42 +01:00
Alex Alecu 722c5852ec feat: replace typescript-language-server with lightweight tsgo client
Short-circuit getClients() to create a TsClient for TypeScript files
instead of spawning typescript-language-server. The server's spawn()
now returns undefined; root() and extensions are preserved for routing.

Drops ~500MB persistent memory to ~50MB peak / 0 idle per session.
2026-03-16 11:51:39 +02:00
Alex Alecu f8ed8ee844 feat: add lightweight LSPClient adapter backed by tsgo diagnostics
Duck-types LSPClient.Info without spawning a persistent process.
Runs TsCheck on notify.open(), coalesces rapid calls, and provides
a stub connection for unsupported LSP operations (hover, definition).
2026-03-16 11:51:34 +02:00
Alex Alecu 2191d094c5 feat: add tsgo/tsc diagnostic runner for lightweight TypeScript checking
Shells out to tsgo --noEmit (with tsc fallback) and parses the
file(line,col): error TSxxxx: message output into Diagnostic[].
Uses ~50MB peak memory and 0 idle, replacing the need for a
persistent typescript-language-server process.
2026-03-16 11:51:30 +02:00
Alex Alecu 7888b6f83d fix: cap tsserver memory at 1.5 GB and disable automatic typing acquisition
Pass maxTsServerMemory (1536 MB) and disableAutomaticTypingAcquisition
via typescript-language-server initialization options to prevent tsserver
from consuming 2.5+ GB on large monorepos. This reduces peak memory
from ~2.8 GB to ~1.5 GB for the entire TypeScript LSP subsystem.
2026-03-16 11:09:46 +02:00
Alex Alecu 03afafbdc3 fix: use ucomm for reliable ps parsing and extract script names from args
On macOS, ps -o comm= is an alias for command (full path + args), which
broke whitespace-based column parsing, producing garbled labels like
'.nvm → en'. Switch to ucomm which returns just the executable basename.

Also improve shortCommand to extract .js/.ts script basenames from path
arguments, so node processes show useful labels like 'node → tsserver'
instead of just 'node'.
2026-03-16 11:02:44 +02:00
Alex Alecu bde1f0cadf feat: display process tree with memory usage in TUI status dialog
Show all related processes (self + children) with PID, command name,
and RSS memory in the /status dialog. Highlights processes exceeding
512 MB in warning color. Auto-refreshes every 3 seconds while the
dialog is open to track memory changes in real time.
2026-03-16 10:52:11 +02:00
Alex Alecu dff17ba39d feat: add GET /process server route for process status
Expose process tree and memory info via a new API endpoint that returns
the current process stats, V8 heap breakdown, and all child processes
with their RSS memory usage.
2026-03-16 10:51:58 +02:00
Alex Alecu 346387e276 feat: add process tree utility for memory diagnostics
Add ProcessInfo module that collects PID, command, RSS memory, and V8
heap stats for the current process and all descendant child processes.
Uses ps and pgrep to walk the process tree on macOS/Linux.
2026-03-16 10:51:53 +02:00
Imanol Maizteguiandgithub-actions[bot] 9e84e952ac Permissions: styling and tooltips (#7025)
* feat(kilo-vscode): Improved permission styling

* chore(kilo-vscode): Added translations for permission tooltips

* fix(kilo-vscode): Formatting

* chore: update kilo-vscode visual regression baselines

* feat(kilo-vscode): Improved border styles for permissions

* chore: update kilo-vscode visual regression baselines

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-13 16:19:24 +01:00
Kevin van Dijk 83cef06f0d Merge pull request #6989 from Kilo-Org/kevinvandijk/kilo-opencode-v1.2.17
OpenCode v1.2.17
2026-03-13 14:06:54 +01:00
Imanol Maizteguiandgithub-actions[bot] a913731700 Permission toggles per-pattern in permission dock (#6977)
* feat(kilo-vscode): Granular permission layout

* formatting

* chore: update kilo-vscode visual regression baselines

* fix: Make sure pattern permissions are correctly saved

* fix: Only save patterns originally sent

* chore: Moved pattern permission logic to its own endpoint

* tests: Unit tests for pattern permissions handling

* fix: Avoid race conditions on permission reply messages

* fix: Handle missing requestId on pattern permission request

* fix: Return NotFoundError when input.requestID missing

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-13 13:56:57 +01:00
Kevin van Dijk 4e227ca318 Merge branch 'main' into kevinvandijk/kilo-opencode-v1.2.17 2026-03-13 13:55:22 +01:00
marius-kiloclawandmarius-kiloclaw 7473015ef9 fix(mcp-migrator): handle malformed JSON in legacy .kilocode/mcp.json (#7012)
readMcpSettings() called JSON.parse() without try/catch. In migrate(),
if .kilocode/mcp.json existed but contained malformed JSON, the uncaught
exception propagated out of the dual-read loop, preventing .kilo/mcp.json
from ever being read. The outer loadMcpConfig() catch returned {} instead
of the valid config — silently losing MCP server configuration.

Wrap the file read + parse in try/catch, log a warning, and return null
so the loop continues to the next config directory.

Regression tests added for both readMcpSettings (unit) and migrate
(integration) to prove the bug and verify the fix.

Refs: #6881

Co-authored-by: marius-kiloclaw <marius-kiloclaw@users.noreply.github.com>
2026-03-13 13:26:37 +01:00
Christiaan Arnoldus 24ff41a268 Apply suggestions from code review
Co-authored-by: Christiaan Arnoldus <christiaan.arnoldus@outlook.com>
2026-03-13 09:45:16 +01:00
Apoorv Saxena f24df95fee Merge branch 'main' into feat/inception-mercury2-reasoning-effort 2026-03-12 23:09:42 +05:30
Joshua Lambert d8511dcd28 Merge pull request #6772 from Kilo-Org/kilo-1773033860831
rebrand: replace OpenCode with Kilo in OAuth callback pages and auth metadata
2026-03-12 10:54:18 -04:00
Evgeny Shurakov 01a336fdfb fix(cli): guard against malformed JSON in import response 2026-03-12 14:07:13 +01:00
Evgeny Shurakov a0f6700cb1 fix(cli): respect KILO_SESSION_INGEST_URL in import command 2026-03-12 14:00:35 +01:00
Evgeny Shurakov 57dd8f8c25 fix(cli): restore Kilo share URL support in import command
The upstream merge (v1.1.54) overwrote Kilo-specific URL handling with
the opencode ShareNext flow, breaking import for app.kilo.ai/s/ URLs.

Restore parsing of https://app.kilo.ai/s/<id> and fetching from
ingest.kilosessions.ai instead of the opncd.ai share API.
2026-03-12 13:54:34 +01:00
Kevin van Dijk 6498fdaaa2 Merge branch 'main' into kevinvandijk/kilo-opencode-v1.2.17 2026-03-12 13:21:08 +01:00
Kevin van Dijk 3dc3af6a7d Re-add kilocode changes to refactored thread file 2026-03-12 13:14:05 +01:00