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.
Keep the base64 cap on every image/* attachment, not just rasters. Routing
SVG and icon mimes away from Photon also dropped max_base64_bytes for them,
so a large .svg could be read unbounded into memory. Only the normalize call
stays raster-gated.
Reject non-base64 data: raster URLs in the precheck. Image.normalize only
accepts base64 data URLs and fails anything else with InvalidDataUrlError,
which had the same 204-then-die ordering the precheck exists to prevent.
Document why file:// cannot be pre-validated at the HTTP boundary: reading it
there would bypass the read permission prompt and the KiloReadObject binding.
Scope the pending-send tracking to the dispatched submission. The prompt box
stays enabled during a busy turn, so the previous boolean could be cleared by
an earlier turn's message and skip the restore for a queued send. Track the
user-message count at dispatch and confirm only when it rises above that.
Release the retained submission once a send is confirmed. A pasted image is
held as a full base64 data URL, so keeping it for the panel lifetime pinned
megabytes per send.
Replace the vacuous hasDraft() test with a matched pair that differs only in
whether a draft is present; removing the guard now fails the second one.
Drop kilocode_change markers from the JetBrains file. Those mark shared
upstream code and appear nowhere else in packages/kilo-jetbrains.
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.
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.
Restoring the optional target was not enough. With a plain struct payload
Effect rejects an empty body before the handler runs, so the SDK, which
strips an empty body slot, could never reach installation.latest.
Restore the NoContent payload union and read the payload defensively, and
cover a bodyless request in the global HttpApi tests.
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
Marketplace catalog discovery, install, removal, and installed-item detection
lived in the VS Code extension, so any other editor client would have had to
reimplement catalog parsing, scope resolution, config writing, and archive
extraction.
Move that logic behind three CLI endpoints and make the extension a client of
them, so every editor shares one marketplace implementation over the SDK:
GET /kilocode/marketplace catalog + installed detection per scope
POST /kilocode/marketplace/install install an MCP server, agent, or skill
POST /kilocode/marketplace/remove remove an MCP server, agent, or skill
No user-visible change in VS Code. The panel UI and suggestion relevance stay
client-side, since relevance depends on installed VS Code extensions.
The contract is shaped for generated clients so the JetBrains plugin can build
on it: response and model schemas are named rather than inline, and install
takes an item's type, id, and content instead of a full catalog entry.
- Add kilocode_change markers to all shared upstream files touched
- Log MCP callTool failures instead of silently swallowing them
- Remove redundant type casts on the callTool result
- Make ReadResourcePayload.server required (schema-level validation)
and drop the now-dead BadRequest guard
- Remove unused meta field from ReadResourceContent schema
- Add KILO_EXPERIMENTAL_MCP_APPS runtime flag
- Expose clientName on McpTool interface and populate it during tool listing
- Add POST /experimental/resource/read and POST /experimental/mcp/call-tool HTTP endpoints
- Gate both endpoints behind experimentalMcpApps flag
- Propagate mcpApp UI metadata (resourceUri, serverId) in tool call results
when tools advertise _meta.ui.resourceUri in their definition
- Add docs/kilo-headless-embedding.md for headless and embedding capabilities
- Fix test fixtures to include clientName in McpTool mocks
- narrow the retry gate to active scenarios (TodoScenario has no reset field)
and type the retry accumulator as Result; both surfaced only in the PR
typecheck job because the scenario union changed in the main merge
- annotate every changed line in shared upstream files with kilocode_change
markers (websearch Env migration, exerciser isolation/retry, pty deadline,
storage layer-injection tests)
- drop duplicate .inProject({ git: true }) calls on the worktree scenarios
left behind by the main merge (main and this branch each added one)
Main landed the same httpapi design (git-opt-in fixtures, --shard flag)
and the same permission.create readiness wait. Resolution adopts main's
implementations and keeps this branch's unique work on top: the
--shards child-process orchestrator (adapted to main's zero-based
shard indexing), scenario retry with backoff gated on state-reset,
project.update isolation, and exerciser env stripping. Removed the
superseded agentsReady/probe machinery and this branch's duplicate
round-robin filter (double-sharding silently dropped scenarios).
Validated: coverage, auth, and 4-shard effect passes all green
(315 checks, 0 failures).
project.update PATCHes its project row; in a non-git directory that row
is the shared global project and the mutation leaked into every later
non-git scenario in the pass. It runs in an isolated git project now.
Scenario retries are gated on scenario.reset: preserveDatabase scenarios
skip resetState between attempts, so retrying them runs against state
the failed attempt already mutated and can mask a regression as FLAKY.
agentsReady refuses to run without a project directory instead of
observing a process.cwd() fallback instance the scenario never targets.
Validated: full 4-shard effect pass, 315 checks, 0 failures.
agentsReady rebuilt the x-kilo-directory header inline; it now uses the
same builder the rest of the context uses, so a future required header
cannot silently diverge. The retry loop tracks its last result instead
of index bookkeeping with an unreachable trailing return.
The agent projection fills asynchronously after instance load; a
permission evaluated before it fills resolves no agent and hits the
deny-all fallback (effect 'deny' instead of 'ask'). Sleep-based retries
recreated the race on every attempt because each retry seeds a fresh
instance. The scenario now polls GET /api/agent until the projection
is warm — gating on the precondition itself.
The git:false default left GET /vcs covering only the no-VCS
short-circuit; opting it back in restores coverage of the git
detection and branch-info path.
Shard children now strip KILO_HTTPAPI_EXERCISE_* so a pinned database
or global root cannot make concurrent shards collide on shared state.
The scenario retry gains a second, longer backoff (1s then 3s): sharded
children run fewer scenarios each, so early scenarios can land before
agent projections warm and one second is not always enough.