Commit Graph
345 Commits
Author SHA1 Message Date
Igor Šćekić 4ed6ec5910 fix(core): report integration OAuth attempt state for closed handles (#16470) 2026-11-22 02:12:59 +01:00
Kirill Kalishev 7214bcc439 Merge pull request #14776 from Kilo-Org/merry-dolphin
fix: prevent a rejected attachment from discarding the prompt
2026-10-07 15:19:30 -04:00
kirillk 27eeb14206 fix(cli): relabel SVG attachments as text instead of sending them as images
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.
2026-10-07 13:09:24 -04:00
kirillk cf720c9b32 fix: address review feedback on attachment handling and draft restore
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.
2026-10-03 12:26:15 -04:00
kirillk 225c393f41 fix: prevent a rejected attachment from discarding the prompt
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.
2026-10-03 11:14:17 -04:00
kirillk 7ceaadfe18 test(cli): cover MCP OAuth cancel endpoint 2026-10-02 11:09:59 -04:00
kirillk c9632e4951 feat: consolidate MCP OAuth in core
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.
2026-10-02 09:54:42 -04:00
marius-kilocode 305588ecea fix(cli): let a bodyless upgrade request reach the latest fallback
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.
2026-09-23 09:05:57 +02:00
marius-kilocode af64102498 Merge OpenCode v1.18.21 through v1.18.26
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
2026-09-22 11:31:51 +02:00
marius-kilocode 8995256c88 refactor: kilo compat for v1.18.26 2026-09-22 10:15:20 +02:00
marius-kilocode 2129ab2257 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.20
# Conflicts:
#	bun.lock
#	packages/opencode/package.json
#	packages/opencode/src/cli/cmd/run.ts
#	packages/opencode/src/server/routes/instance/httpapi/handlers/provider.ts
#	packages/sdk/js/script/build.ts
2026-09-21 15:32:05 +02:00
marius-kilocode 93862bb100 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.18
# Conflicts:
#	nix/hashes.json
2026-09-21 14:38:21 +02:00
marius-kilocode 9a74f1ad33 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.15
# Conflicts:
#	package.json
2026-09-21 13:52:24 +02:00
kirillk 23ecd42c80 feat: move marketplace discovery and install into the CLI API
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.
2026-09-14 13:42:19 -04:00
Johnny Eric Amancio 7480a48f43 merge: reconcile latest v1.18.15 base into v1.18.18 2026-09-03 18:22:41 +02:00
Johnny Eric Amancio 0aff14dc16 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.15
# Conflicts:
#	packages/opencode/src/session/session.ts
2026-09-03 15:42:39 +02:00
Johnny Eric Amancio 3d3a722733 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.15 2026-08-28 17:25:05 +02:00
marius-kilocode 52d4247d9c feat(vscode): edit queued messages in the prompt input 2026-08-28 15:43:34 +02:00
Johnny Eric Amancio bf1cf502a3 merge: reconcile updated v1.18.15 base into v1.18.18 2026-08-27 15:28:28 +02:00
Johnny Eric Amancio 6a7d6bc002 resolve merge conflicts 2026-08-27 15:13:58 +02:00
webreflection f9ddb78b17 fix(security): @hey-api/openapi-ts updated due dependabot warnings 2026-08-26 19:32:19 +02:00
Johnny Eric Amancio 3dad775136 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.15
# Conflicts:
#	bun.lock
2026-08-26 16:04:55 +02:00
marius-kilocode e748515a2c fix(vscode): guard subagent promotion edge cases 2026-08-25 15:35:44 +02:00
Johnny Eric Amancio b8b5b15c81 resolve merge conflicts 2026-08-25 14:22:37 +02:00
Johnny Eric Amancio aeddfc6566 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.15
# Conflicts:
#	bun.lock
2026-08-25 13:51:03 +02:00
Johnny Eric Amancio c9861e9548 resolve merge conflicts 2026-08-24 15:08:20 +02:00
marius-kilocode 8d0750f563 fix(test): handle platform PTY cleanup 2026-08-24 14:24:08 +02:00
marius-kilocode 35de2d1ec2 fix(test): stabilize cross-platform PTY checks 2026-08-24 14:14:10 +02:00
Johnny Eric Amancio 6ef57a694e refactor: kilo compat for v1.18.18 2026-08-24 14:04:20 +02:00
marius-kilocode a35585ad9d test(cli): validate PTY across release targets 2026-08-24 13:46:27 +02:00
Johnny Eric Amancio c14316a7d6 Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.15 2026-08-21 16:16:07 +02:00
Rômulo Rosa Furtado 3452fa1232 Merge branch 'main' into feat/mcp-apps-experimental 2026-08-20 18:19:10 +02:00
rrosa c02134ab43 fix(cli): annotate MCP Apps changes, tighten callTool error handling
- 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
2026-08-20 07:39:59 -03:00
rrosa 36c57c12ce feat(cli): add experimental MCP Apps support with resource/tool HTTP endpoints
- 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
2026-08-20 07:28:17 -03:00
marius-kilocode 9701b518b6 Merge main into puzzling-crowberry 2026-08-19 14:53:12 +02:00
marius-kilocode ba658fc8d7 chore: checkpoint before merging main 2026-08-19 14:50:11 +02:00
Johnny Eric Amancio c50f6be6af Merge remote-tracking branch 'origin/main' into johnnyeric/kilo-opencode-v1.18.15
# Conflicts:
#	packages/opencode/src/tool/truncate.ts
#	packages/opencode/test/tool/truncation.test.ts
2026-08-19 14:25:26 +02:00
marius-kilocode ff16bc2c9c fix(agent-manager): keep PTYs durable across reloads 2026-08-18 17:28:38 +02:00
Yury Zialionka 2a63bf180e fix(ci): satisfy PR-only checks — typecheck narrowing and kilocode_change markers
- 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)
2026-08-13 22:04:23 -06:00
Yury Zialionka 8aff7ade1b Merge origin/main: reconcile with independently landed #13091 and #13113
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).
2026-08-13 21:42:43 -06:00
Yury Zialionka 4545a03604 Merge branch 'perf/httpapi-optin-git-fixtures' into integration/test-pipeline-speedup 2026-08-13 21:24:45 -06:00
Yury Zialionka 8bd77b7fd5 fix(test): isolate project.update; retry only state-reset scenarios; guard agentsReady
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.
2026-08-13 21:19:43 -06:00
Yury Zialionka 59eadf2c21 refactor(test): share the scenario header builder; simplify the retry loop
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.
2026-08-13 21:07:42 -06:00
Yury Zialionka 2ef0705a58 Merge branch 'perf/httpapi-optin-git-fixtures' into integration/test-pipeline-speedup 2026-08-13 19:43:21 -06:00
Yury Zialionka 81eeec6a7e fix(test): gate permission.create on agent-projection readiness
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.
2026-08-13 19:42:56 -06:00
Yury Zialionka 6fea3d49d0 Merge branch 'perf/httpapi-optin-git-fixtures' into integration/test-pipeline-speedup 2026-08-13 18:53:28 -06:00
Yury Zialionka ef7ce90dbe test(httpapi): exercise vcs.get against a git repo again
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.
2026-08-13 18:53:11 -06:00
Yury Zialionka 2b81730c51 Merge branch 'perf/httpapi-optin-git-fixtures' into integration/test-pipeline-speedup 2026-08-13 18:39:04 -06:00
Yury Zialionka ae3a5de98c fix(test): harden httpapi sharding against env pinning and cold-start races
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.
2026-08-13 18:38:33 -06:00
Yury Zialionka 407939c9f0 Merge branch 'perf/in-process-fast-tier' into integration/test-pipeline-speedup 2026-08-13 17:21:36 -06:00