Commit Graph

5808 Commits

Author SHA1 Message Date
Marian Alexandru Alecu 0cbf9b040b Merge pull request #10050 from Kilo-Org/fix/suggest-local-review-more-often
fix(cli): suggest reviews more often
2026-05-08 12:58:26 +03:00
Christiaan Arnoldus 0397767075 Merge pull request #10014 from Kilo-Org/fix/kilo-provider-cost-anthropic-messages
fix(cli): extract Kilo provider cost from Anthropic Messages and OpenAI Responses APIs (OpenRouter)
2026-05-08 10:51:01 +02:00
Alex Alecu d403075d3e fix(cli): skip review prompts after review fixes 2026-05-08 11:46:07 +03:00
kiloconnect[bot] 45f12a6a70 docs(cli): update providerCost section heading for new transports 2026-05-08 08:26:39 +00:00
kiloconnect[bot] c8446f5231 docs(cli): clarify why Kilo prefers upstream cost over gateway cost
Kilo isn't always BYOK; what matters here is that Kilo doesn't charge a
per-request fee on top of the upstream inference cost. So for the Kilo
provider, the gateway/marketplace `cost` would understate the user's true
spend — always prefer the upstream/market cost when present.
2026-05-08 08:19:44 +00:00
Christiaan Arnoldus cc74d169ff Merge pull request #9969 from Kilo-Org/fix/cli-prompt-loop-missing-finish-reason
fix(cli): prevent agent loop hang when stream ends without stop_reason
2026-05-08 10:10:48 +02:00
Alex Alecu f1ae973c53 fix(cli): suggest local reviews more often 2026-05-08 11:06:33 +03:00
Marius 9de7c986e7 Support Kilo-hosted indexing embeddings (#9851)
* feat: support Kilo-hosted indexing embeddings

* fix: format indexing settings

* fix: serialize local model persistence

* fix: annotate local model persistence

* fix: stabilize MCP OAuth browser test

* fix: annotate MCP OAuth test wait

* fix: keep KiloProvider under line cap

* fix: align Kilo indexing auth defaults

* fix(vscode): add missing indexing translations

* feat(indexing): fetch Kilo embedding model catalog

* fix(indexing): align Kilo embedding metadata fallback

* fix(gateway): remove unused indexing dependency

* fix(indexing): keep fallback catalog webview safe

* fix(agent-manager): include embedding model provider

* fix(vscode): provide embedding models in stories

* refactor(indexing): rely on Cloud embedding catalog

* fix(indexing): hydrate Kilo model metadata from Cloud

* fix(indexing): clear model when switching provider
2026-05-07 17:14:26 +02:00
Christiaan Arnoldus 3b81a88ac5 Merge pull request #10009 from Kilo-Org/refactor/narrow-openai-responses-markers
refactor(cli): narrow kilocode_change markers around Responses-API guard
2026-05-07 16:59:56 +02:00
kiloconnect[bot] c8073d9014 fix(cli): also extract Kilo cost from OpenAI Responses API responses
Refactor providerCost to read `usage.raw.cost_details.upstream_inference_cost`,
which both `@ai-sdk/anthropic` (`convertAnthropicUsage`) and `@ai-sdk/openai`
(`convertOpenAIResponsesUsage`) populate with the verbatim OpenRouter usage
object. This unifies the Anthropic Messages and OpenAI Responses cost paths
through a single branch and removes the redundant `metadata.anthropic.usage`
branch (the SDK exposes the same data under both keys for Anthropic, and only
under `raw` for Responses).
2026-05-07 14:51:18 +00:00
kilo-agent 36a265520f drop restored upstream comments
They're upstream opencode comments, not kilo changes, so they
shouldn't live inside kilocode_change markers — and outside the
markers they add noise to this PR's diff. Drop them.
2026-05-07 14:48:31 +00:00
kiloconnect[bot] 2f2e92b223 fix(cli): wrap signature in kilocode_change block markers 2026-05-07 14:40:40 +00:00
kiloconnect[bot] ab049fa6dd chore(cli): mark editorContext param as kilocode_change in system prompt
Add missing kilocode_change marker to the editorContext param in
the environment Effect.fn implementation; the interface signature
already had a marker but the implementation didn't.
2026-05-07 14:37:06 +00:00
kiloconnect[bot] 861eb522ad fix(cli): never use gateway-fee cost for Anthropic Messages paths
For the Anthropic Messages API (via OpenRouter or Vercel AI Gateway), the
top-level `cost` field is the gateway fee that Kilo paid (typically 0 for
BYOK), not the user's true spend. Only use `upstream_inference_cost` /
`marketCost`; fall back to the token-based calculation when those are
absent.
2026-05-07 14:27:14 +00:00
Marius d2ae16a921 fix: support Azure provider endpoint setup (#10016)
Allow Azure provider connections to capture resource names or endpoint URLs so GPT-5 deployments can use the native Azure path instead of generic OpenAI-compatible setup.
2026-05-07 16:03:40 +02:00
Marius 03630064ad fix(cli): recover compaction from payload limits (#10012) 2026-05-07 16:01:25 +02:00
kiloconnect[bot] 3423870eea fix(cli): extract Kilo provider cost from Anthropic Messages API responses
Cost reporting already worked when Kilo used OpenRouter chat completions
internally. Extend providerCost to also read cost from the Anthropic
Messages API stream metadata, covering both OpenRouter (Anthropic-style
`usage.cost` / `cost_details.upstream_inference_cost`) and Vercel AI
Gateway (`gateway.cost` / `gateway.marketCost`).
2026-05-07 13:07:52 +00:00
kilo-agent 9cec88dac1 minimize diff: keep only gpt-5 Responses-API block changes
Revert the file-wide marker shape fixes from fix-kilocode-markers.ts
since they touch unrelated code. Scope this PR to the two review
findings in the gpt-5 block:

- Replace nativeOpenAI refactor with upstream's if (===||===) form
  plus inline // kilocode_change markers on the added npm entries;
  restores the upstream reasoningSummary comment.
- Restore the upstream textVerbosity comments, keep the new provider
  gate wrapped in kilocode_change start/end.
2026-05-07 12:53:32 +00:00
Christiaan Arnoldus fc8c204a23 Merge pull request #9997 from Kilo-Org/fix/drop-max-tokens-gpt5-openai-compatible
fix(cli): drop max_tokens for gpt-5 models on @ai-sdk/openai-compatible
2026-05-07 14:50:32 +02:00
Mark IJbema 3fb2e5d7e9 Merge pull request #9977 from Kilo-Org/mark/inline-tool-registry-overrides
refactor(cli): inline override predicates in tool registry
2026-05-07 14:45:23 +02:00
kilo-agent fa759d41bc address review: run fix-kilocode-markers on transform.ts
- Reverts the nativeOpenAI refactor; restores upstream's reasoningSummary
  guard structure + comment so added npm entries stay inside a single
  marker block.
- Includes the opencode textVerbosity comment that was dropped.
- Also fixes pre-existing marker shape issues elsewhere in the same file
  flagged by script/upstream/fix-kilocode-markers.ts.
2026-05-07 12:32:09 +00:00
Christiaan Arnoldus 2fdd46e205 Merge branch 'main' into fix/cli-prompt-loop-missing-finish-reason 2026-05-07 14:28:55 +02:00
Mark IJbema 4c49b8778f undo order change 2026-05-07 14:25:55 +02:00
kilo-agent 50be3fc766 refactor(cli): narrow kilocode_change markers around Responses-API guard
Minimizes the diff from upstream opencode by restoring upstream's
original reasoningSummary guard structure and comment, and scoping
kilocode_change markers to only the Kilo-specific additions:
two extra provider npm names and the new textVerbosity provider gate.
2026-05-07 12:22:46 +00:00
Marius 9e17137870 fix(cli): recover provider finish errors (#10006) 2026-05-07 14:21:01 +02:00
Christiaan Arnoldus 2d2cf1f708 Merge pull request #8263 from VastCosmic/fix/openai-compat-reasoning-params
fix: gate OpenAI Responses API params for openai-compatible providers
2026-05-07 14:20:50 +02:00
Mark IJbema 61e52b1c6a refactor(cli): reduce upstream drift in tool registry
Keep upstream's `question` tool binding and `questionEnabled` boolean
names, restore upstream's `tool.plan` position at the end of the builtin
array, and group Kilo-only additions in a single marker block. Removes
outer markers that were wrapping unchanged upstream lines as Kilo-owned
scope.
2026-05-07 14:20:45 +02:00
Marius 98f5f65c1a Support global and project indexing toggles (#9993)
* fix: support global indexing enablement

* chore: update kilo-vscode visual regression baselines

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-05-07 14:15:48 +02:00
kiloconnect[bot] 8c1b7d7155 refactor(cli): inline gpt-5 max_tokens drop instead of internal plugin
Replaces the plugin approach with a narrow conditional at the single call
site in session/llm.ts where maxOutputTokens is passed to chat.params.
No new file, no new test file, one kilocode_change block.
2026-05-07 11:53:02 +00:00
kiloconnect[bot] de9f11e399 fix(cli): drop max_tokens for gpt-5 models on @ai-sdk/openai-compatible
gpt-5 models rejected via openai-compatible proxies (e.g. LiteLLM) because
the SDK emits max_tokens while OpenAI requires max_completion_tokens and
the compatible SDK cannot rename the field. Clear the cap so the upstream
default output budget applies.
2026-05-07 10:36:33 +00:00
Mark IJbema ae933fc087 Merge branch 'main' into mark/inline-tool-registry-overrides 2026-05-07 12:26:29 +02:00
Mark IJbema 361fea31ec Merge pull request #9978 from Kilo-Org/markijbema/kilo-opencode-v1.14.33
Upstream merge v1.14.33
2026-05-07 11:56:06 +02:00
Marius 3095efcc4c fix(vscode): restore inline tool diffs (#9688)
* fix(vscode): restore inline tool diffs

* fix(vscode): render tool patches in kilo ui

* style: format long regex assignments and add change marker comment

Reformat multi-line regex match assignments in kilo-ui-contract test
to satisfy line length limits, and annotate the `contents(diff)` call
in session-diff with a kilocode_change tracking comment.

* fix(kilo-vscode): append trailing newlines to expected diff content assertions

Update test expectations in diff-session-source to include trailing
newlines in before/after content, matching actual file content behavior.

* fix(vscode): guard empty-patch diffs in session turn accordion

Match diff-session-source.ts:99 behavior by short-circuiting contents()
when the patch is empty (binary or summarized files), so the accordion
content stays empty instead of rendering a confusing whitespace-only
diff.

---------

Co-authored-by: Imanol Maiztegui <imanol.mzd@gmail.com>
2026-05-07 11:01:47 +02:00
Mark IJbema a2bb05726f Merge remote-tracking branch 'origin/main' into markijbema/kilo-opencode-v1.14.33 2026-05-07 10:44:08 +02:00
Mark IJbema 279b604537 fix(cli): restore external_directory whitelist in explore patch
Upstream 2283979199 (Preapprove agent tmp directory access) extended the
agent.ts whitelistedDirs with Global.Path.tmp/*, and the new v1.14.33 test
asserts tmp/agent-work -> allow on the explore agent. Kilo's patchAgents
replaces the whole explore permission and had only Truncate.GLOB in its
external_directory block, so both /some/other/path (expected ask) and
tmp/agent-work (expected allow) resolved to deny via the outer '*':'deny'
catch-all (findLast picks it over any defaults external_directory rule).

Commit d2e21c5006 tried to fix this by dropping the '*':'ask' on the
assumption that defaults already provided it — that rationale was wrong,
since defaults' rules come before the patch's catch-all in the merged
ruleset. Mirror upstream's inline shape instead: thread whitelistedDirs
through to patchAgents and rebuild the explore external_directory as
{ '*':'ask', ...whitelistedDirs -> 'allow' }, matching what upstream's
explore does natively.
2026-05-07 10:09:02 +02:00
Josh Holmer c1ea8100e1 fix(core): ensure user permission overrides apply correctly (#9975) 2026-05-07 09:29:26 +02:00
Josh Lambert bef0183738 fix(vscode): close runtime telemetry consent gap with the CLI
The previous `watchTelemetryState` fix updated the webview UI in real
time but left the CLI subprocess's PostHog client stuck on its
spawn-time `KILO_TELEMETRY_LEVEL` value. A user who started VS Code
with telemetry off and toggled it on at runtime saw the thumbs UI
appear (good) but every webview event was silently dropped at the
CLI's `Client.capture()` gate (bad).

Add a runtime sync channel:

- New `POST /telemetry/setEnabled` Hono route on the CLI server that
  calls `Telemetry.setEnabled(enabled)` to flip the `posthog-node`
  client's opt state.
- New `TelemetryProxy.setEnabled(enabled)` method that POSTs to it,
  using the same fire-and-forget pattern as `capture`.
- Extension calls `telemetry.setEnabled(vscode.env.isTelemetryEnabled)`
  immediately after `telemetry.configure(...)` on every `connected`
  state change, so a freshly-spawned CLI gets corrected even when its
  spawn-time env var is stale.
- Extension subscribes to `vscode.env.onDidChangeTelemetryEnabled` to
  forward runtime consent changes to the CLI as they happen.

All three changes live in Kilo-owned files (the route is already a
`kilocode_change - new file`, and the extension is Kilo-only). Zero
upstream OpenCode merge surface.

Closes #9872 fully (the previous `d67c5e307c` covered only the webview
UI).
2026-05-06 23:29:55 -04:00
Josh Lambert 363e337ca8 refactor: move feedback additions out of upstream-shared files
Addresses review feedback: Kilo-specific additions belong in Kilo-owned
packages so the diff against upstream OpenCode stays minimal.

- Icons: move thumbs-up/-down/-up-filled/-down-filled paths from
  packages/ui/src/components/icon.tsx into packages/kilo-ui's icon
  registry. Extend the kilo-ui Icon registry to carry per-icon viewBox
  (Heroicons thumbs are 20x20; existing Kilo icons are 16x16). Replace
  packages/kilo-ui/src/components/icon-button.tsx (previously a re-export
  of @opencode-ai/ui/icon-button) with a local implementation that
  uses the kilo-ui Icon so the new names resolve.

- i18n: move the three feedback strings (helpful, notHelpful,
  clearRating) from each of 19 packages/ui/src/i18n/<locale>.ts files
  into the corresponding packages/kilo-i18n/src/<locale>.ts. The
  webview's language.tsx already merges kilo-i18n on top of upstream,
  so the runtime keys remain available.

- TUI: extract submitFeedback from
  packages/opencode/src/cli/cmd/tui/routes/session/index.tsx into a
  new Kilo-owned helper at
  packages/opencode/src/kilocode/cli/cmd/tui/feedback.ts. The session
  route now imports and invokes it, passing { toast, session, messages }.
  Also tightens the Kilo Gateway gate from startsWith("kilo") to
  === "kilo" to match the equivalent fix in the webview.
2026-05-06 23:29:55 -04:00
Josh Lambert 0eab152b25 fix: use <leader>= for thumbs-up keybind and wrap story providers
- Replace <leader>+ with <leader>= in messages_feedback_up: the TUI
  parser normalizes <leader> to 'leader+' and splits on '+', producing
  an empty key name for '<leader>+' so the binding never fires. The
  = key sits on the same physical key as + on most layouts, pairs
  visually with <leader>-, and parses to a real key name.
- Wrap StoryProviders with FeedbackProvider so stories that render
  VscodeSessionTurn (e.g. Diff Summary Collapsed) don't throw
  'useFeedback must be used within a FeedbackProvider' under
  Storybook visual regression.
- Sync changeset and docs page to mention the new keybind.
2026-05-06 23:28:50 -04:00
Josh Lambert dcaccf3865 feat: per-message thumbs up/down feedback
Adds thumbs up/down buttons next to the copy button on every assistant
message in the VS Code sidebar, and <leader>+/<leader>- keybinds in the
TUI. UI state is in-memory only — ratings reset on reload / session
switch. Persistence can be added later without changing the telemetry
contract.

Events are sent to PostHog via the existing telemetry pipeline. For
Kilo Gateway turns the payload includes session and message IDs so
feedback can be correlated against gateway logs; for direct providers
those IDs are omitted since we cannot correlate them to upstream data.
2026-05-06 23:28:50 -04:00
Mark IJbema d2e21c5006 fix(cli): address CI test failures
- InstanceStore: run Instance.provide init inside the ALS context so KilocodeBootstrap (and any forkDetach work it spawns like KiloIndexing.init) can read Instance.directory. Upstream refactor moved init out of the ALS scope; kilo-main's pre-merge Instance.provide wrapped it. Without this, KiloIndexing.init silently fails with "No context found for instance".
- kilocode/agent: thread worktree through planGuard/patchAgents instead of reading Instance.worktree at agent state construction time. Agent state is built inside Effect (no ALS) via InstanceState.make — reading the ALS-backed Instance.worktree there crashed under the new architecture.
- kilocode/agent: drop the "*": "ask" from explore external_directory — defaults already provides it, and redefining here overwrites the tmp/skill allowlist via findLast().
- test/server/httpapi-instance.test.ts: revert the ported Hono-bridge tests. Upstream put the same tests in httpapi-instance.legacy.test.ts (renamed file); the port duplicated them.
- test/server/httpapi-instance.legacy.test.ts: mark the catalog test test.skip with Kilo's original rationale (/agent 500s via the bridge; the bridge is not enabled in any production client).
- test/server/httpapi-ui.test.ts: delete. Tests upstream's proxy-to-app.opencode.ai fallback that Kilo intentionally removed (src/server/routes/ui.ts kilocode_change).
- test/server/httpapi-raw-route-auth.test.ts: basic("opencode", ...) → basic("kilo", ...) to match the Kilo username default.
- test/provider/models.test.ts: skip describe block. Upstream tests assert raw-fixture passthrough but Kilo's ModelsDev.get() filters/injects providers based on Config.get(), which needs an Instance context the test doesn't provide.
2026-05-06 22:25:16 +02:00
Mark IJbema 71bb5a1253 fix(cli): use established double-cast for PromptInput in HttpApi handler
Replace 'as SessionPrompt.PromptInput' with 'as unknown as SessionPrompt.PromptInput' to match the pre-existing pattern in the legacy Hono handler (instance/session.ts:901,936). The single cast was rejected by TypeScript because the schema-derived ctx.payload has readonly arrays while Kilo's PromptInput override declares parts as mutable PartInputUnion[]. The double cast is the established Kilo workaround for this readonly→mutable mismatch and keeps the Kilo diff vs upstream minimal.
2026-05-06 21:58:47 +02:00
Mark IJbema 5f5853a2e3 fix: align Kilo source/tests with v1.14.33 API renames
Mechanical follow-up to the v1.14.33 merge:

- src/server/routes/ui.ts: remove dead proxy fallback (proxy/createHash/csp were intentionally commented out by Kilo; the Effect/Promise paths still referenced them)
- src/kilocode/{plan-followup,session/prompt}.ts: pass Instance.current to Session.plan(input, instance)
- src/server/routes/instance/httpapi/handlers/session.ts: cast PromptPayload spread to PromptInput (readonly→mutable schema/runtime mismatch)
- src/plugin/index.ts: cast external @opencode-ai/plugin auth plugins through unknown to bridge to local @kilocode/plugin types
- script/build.ts: drop duplicate sourcemap key (Kilo's release-aware version wins)
- test/kilocode/indexing-{startup,worktree}.test.ts: switch from Instance.disposeAll/InstanceBootstrap-as-effect to disposeAllInstances/getBootstrapRunEffect
- test/kilocode/model-cache-org.test.ts: convert Instance.provide init from async fn to Effect
- test/kilocode/kilo-loader-auth.test.ts: drop ModelsDev.Data.reset() (no longer exists)
- test/kilocode/plan-exit-detection.test.ts, plan-followup.test.ts: pass Instance.current to Session.plan
- test/kilocode/{plan-followup,session-list}.test.ts: replace Session.list() with AppRuntime.runPromise(Session.Service.use((svc) => svc.list()))
2026-05-06 21:53:19 +02:00
Mark IJbema 1ea9ad2af0 resolve merge conflicts 2026-05-06 21:32:26 +02:00
Catriel Müller f40970557f refactor: renegare sdk 2026-05-06 14:26:06 -03:00
Catriel Müller 7bb9914a06 refactor: update implementation 2026-05-06 14:01:53 -03:00
Catriel Müller 622e1263d2 refactor: address comments 2026-05-06 14:01:53 -03:00
Catriel Müller 4aedc1b47f fix: ulid 2026-05-06 14:01:53 -03:00
Catriel Müller 98866740af feat: kiloclaw chat rework 2026-05-06 14:01:51 -03:00
Marius e5e9d0ba37 Delete custom providers from config (#9921)
* fix: delete custom providers from config

* fix: clear project custom provider config
2026-05-06 17:12:23 +02:00