* fix(cli): apply permission rules to workflow and subagent tool calls
* fix(cli): apply the edit and read permissions to their tool aliases
* fix(cli): keep a path-scoped rule from changing a tool's preapproval
* fix(cli): single-source the tool-to-permission map
The workflow tool gate and the disabled-tool check each carried their own
copy of the map from a tool name to the permission that governs it. The gate
read a local map and the check read two inline arrays, so a new alias, or a
changed one, could apply to only one of them.
Export one resolver from Permission and read it from both places, and extend
the gate test to the resource tools so a drift in their aliases fails.
* test(cli): cover the workflow tool and subagent delegation wiring
The gate and the task permission check had unit tests, but nothing exercised
the session wiring that installs them. Add two test files:
- workflow-attach: reaches the real workflow branch through a provider stub and
drives the installed executor, so a whole-tool rule, an unoffered name, a
path-scoped rule and each result shape are asserted against the code that
runs them.
- named-agent-types: drives a real prompt turn whose message names a subagent,
and asserts the turn delegates and creates the child session.
Both fail when the corresponding wiring changes.
* test(cli): resolve the session service through the test layer
The named-agent test created its session through the global runtime handle.
Dispose that handle in the test instead and let the compiled layer do the
work, matching the other session tests in this directory.
* test(cli): resolve the session and prompt services in one scope
The named-agent test created its session through a separate runtime, so the
database instance it wrote to was not the one the prompt read. Resolve both
services from the same layer and create the session inside that scope.
* fix(cli): keep the tool-to-permission lookup to its own entries
A name that the map does not define resolved to an inherited built-in
member instead of itself, so the gate handed a non-string to the wildcard
matcher and the call failed with a thrown error rather than the gate's
not-available answer. The map now answers only for the entries it
declares.
Also mark the removed wildcard import in the session runtime and pin the
scoped-rule ordering and the unknown-name answer in tests.
* docs(cli): state what the workflow preapproval list contains
The gate also lists a tool that no rule covers, and one whose matching
rule is scoped to a path. The comment now says that, so a later change
does not narrow the list by mistake.
An SVG prompt attachment was decoded into synthetic text, but the retained
file part kept mime image/svg+xml. message-v2 forwards every file part that
is not text/plain, so the model still received an image/svg+xml part that
providers reject -- and because the user message is persisted, every later
turn replayed it.
Relabel markup to text/plain once, before parts are resolved. The existing
text/plain paths then do the work: a data: URL yields its source as synthetic
text, a file:// URL goes through the real Read tool (gaining its numbering and
size/binary limits), and message-v2 skips the persisted part. This also lets
the two bespoke markup branches and the base64 cap special case go away, so
the shared prompt.ts delta shrinks.
Also fix three precheck regressions this branch introduced:
- An image whose declared mime is wrong but whose bytes decode (JPEG sent as
image/png) was rejected. Photon decodes by content, so validate the sniffed
format instead. Image.dimensions covers exactly the formats Photon handles,
so it still rejects BMP, which Photon traps on.
- Line-wrapped base64 was rejected by a canonical round-trip comparison, even
though Buffer.from decodes it fine.
- A malformed non-base64 data URL threw URIError out of decodeURIComponent and
lost the message. Reject it for every mime, not just rasters: markup reaches
the same decode.
Reported by @brunoagatao.
Removing an MCP server via the marketplace (or Settings) only wrote the
config file; it never told the live MCP service. status() resurrects a
removed server's last-known state from two in-memory caches that
disconnect() only partially clears and nothing else purges, so a
server that had reached needs_auth kept reporting that status forever,
even after the config entry, companion skill, and receipt were all
correctly removed from disk.
Add MCP.Interface.remove(name), which purges clients/defs/instructions/
status/config for a server (unlike disconnect, which only disables it).
MarketplaceInstaller.removeMcp now calls it after a successful removal,
via a new Services.mcp field threaded through from the kilocode HTTP
handlers rather than Effect context, so install()/remove() stay usable
from callers without the full MCP layer.
Verified against a real installed MCP server (config entry, companion
skill, and marketplace receipt) through both a direct Effect call and
the live /kilocode/marketplace/remove HTTP endpoint: the server no
longer reappears in status() or marketplace metadata after removal.
Also syncs bun.lock's stale kilo-jetbrains version entry (7.8.1) with
the already-bumped package.json (7.8.3).
Attaching an SVG killed the entire request and permanently lost the
typed message. The prompt pipeline gated on a raw `mime.startsWith("image/")`
check and handed the bytes to Photon, a raster-only decoder, so an SVG
raised a fatal ImageDecodeError. Because the user message is persisted
last, that defect destroyed the text along with the attachment, and
prompt_async had already returned 204 and cleared the editor, leaving
nothing to recover.
Route non-raster image mimes away from the raster decoder, reusing the
existing isImageAttachment exclusions via a new classifier. SVG is now
decoded into readable source, matching how text attachments already work.
Reject an undecodable raster attachment synchronously in both prompt
routes so prompt_async can no longer promise acceptance and then fail,
and surface a readable message instead of a bunfs stack trace.
On the JetBrains side, stop claiming SVG and BMP are model-ingestible
images, keep the submitted text and attachments so a failed send can
restore them, and give a standalone error card a Dismiss action since it
has no transcript tail for Retry to continue.
A cancelled task result gave no reason, so a parent that needed the subagent's output treated it as a failure and immediately started a replacement subagent (7 of 7 live runs). Reporting 'Task cancelled by the user' stopped that (0 of 5) without instructing the model. Only an explicit stop or delete cancels a task while its parent is still awaiting it.
Move authentication-failure classification and browser ownership into the CLI protocol so clients no longer duplicate heuristics or open browsers on the backend machine. Add a non-destructive cancel endpoint, emit authorization URLs for client-driven flows, regenerate the SDK, and migrate VS Code to the typed contract while leaving the API ready for JetBrains adoption.
Double Esc in the subagent view now sends the same tree-scoped abort as VS Code's task-card Stop, so the parent keeps running and receives the existing 'Task cancelled' result. Drops the server-side interruption message; packages/opencode only gains a test pinning that the parent is not aborted.
Double Esc in a subagent view aborts only that subagent (scope=session) while the parent keeps working. The parent's task tool reports the stop as a deliberate user interruption and is told not to relaunch the subagent on its own, keeping the task_id for a user-requested resume. Exit keys need a second press in the subagent view.
The CLI publishes live tool input deltas, and the extension host parses the partial arguments into throttled pending part updates. Pending rows now show the file path, command, and a live line count, and an open write card shows the last lines of the file as the model writes it.
Upstream sync covering v1.18.21, v1.18.22, v1.18.23, v1.18.24, v1.18.25, and
v1.18.26. Conflicts resolved in favor of Kilo behavior where the fork
intentionally diverges:
- Azure plugin keeps Kilo's resource-name/base-url prompts while adopting
upstream Microsoft Entra ID sign-in through the Azure CLI
- provider request headers keep Kilo's x-kilocode-mode and X-KILOCODE-* set
alongside upstream's x-parent-session-id
- Bedrock reasoning replay filtering stays gated to Claude models
- retry keeps Kilo's behavior of not surfacing the OpenCode Go upsell
- config keeps Kilo normalization, warnings, and updateGlobal/update
delegation while adopting upstream V2-compat lowering
- session tool context keeps Kilo's processor.metadata and askPermission
Merge repairs:
- restore the SDK ./permission export and the client ./promise and UI
./file-path, ./session-diff, ./pierre subpath exports
- keep the Kilo workspace dependency for @opencode-ai/client in session-ui
- restore the HttpServerRequest import required by Kilo's SSE stream
- keep Kilo-Org repository URLs in packages/http-recorder
- remove the upstream-only SST unlock workflow
- adapt upstream tests that assert upstream behavior for Kilo divergences
Remove the /local-review and /local-review-uncommitted aliases and their static notice paths. Keep /review and its scopes as the single review command.
* fix: fix-live-session-advertiseme-4533 patch delivery
* chore: annotate kilocode_change markers for the status store
* chore: avoid the AppRuntime token in the status test comment
* fix: address-the-automated-review-8a43 patch delivery
* Fix the failed cli verification gate (kwf address-the-automated-review-8a43/gr1)
* Drop the unrelated bun.lock reorder to keep the diff minimal (kwf address-the-automated-review-8a43/s1)
* chore: cover the set() closing brace in the kilocode_change block
* fix(cli): surface real tool name when tool call repair fails
When the model emits a malformed tool call that cannot be repaired by
case-insensitive matching, experimental_repairToolCall renamed the call
to the hidden "invalid" tool. That tool is excluded from activeTools,
so the AI SDK rejected it with a confusing "unavailable tool 'invalid'"
error that did not tell the model what it did wrong.
Return null instead so the original NoSuchToolError or
InvalidToolInputError surfaces with the actual tool name and the list of
available tools, letting the model self-correct.
Fixes#6905
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
* refactor(tool): remove orphaned invalid tool
The experimental_repairToolCall fallback that produced tool calls named
"invalid" was replaced with null in this PR, so nothing generates
"invalid" tool calls anymore. Remove the now-orphaned InvalidTool
definition, its registry registration, and its TUI renderer, along with
the parameters test and snapshot that covered it.
Agent-Signature: kilo-auto/efficient-remove-orphaned-invalid-tool on behalf of maphew
* Revert "refactor(tool): remove orphaned invalid tool"
This reverts commit f6176d61f3.
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
* ci: re-trigger pipeline (flaky background-process teardown on loaded shard)
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
---------
Co-authored-by: maphew <486200+maphew@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
The diff editor tab now shows whole-file diffs (with collapsible unchanged
regions) for modified files, while inline session cards stay hunk-bounded.
diffSides resolves full before/after with a safe precedence:
1. Authoritative: query the CLI's snapshot diff (full=true&file=...), which
reads the exact turn's before/after from snapshot commits via git show and
is correct even for historical/reverted turns.
2. Fallback: reverse-apply the hunk patch onto the working-tree file locally,
so it works against the current pinned CLI until the new one is released.
3. Hunk view: if neither yields full content (drift/binary/added/deleted),
render the existing patch.
The CLI change is minimal and additive: full-content logic lives in the
kilo-owned diff-full.ts (DiffFull.detail); shared files only gain thin
kilocode_change hooks (FileDiff before/after, Snapshot.diffFile, the summary
full/file branch, and the diff query fields).