Skip to content

feat: add Kilo SDK-backed provider adapter#4089

Open
Githubguy132010 wants to merge 11 commits into
pingdotgg:mainfrom
Githubguy132010:feat/kilo-provider-adapter
Open

feat: add Kilo SDK-backed provider adapter#4089
Githubguy132010 wants to merge 11 commits into
pingdotgg:mainfrom
Githubguy132010:feat/kilo-provider-adapter

Conversation

@Githubguy132010

@Githubguy132010 Githubguy132010 commented Jul 17, 2026

Copy link
Copy Markdown

What Changed

Add a first-party kilo provider adapter that runs Kilo via @kilocode/sdk (managed kilo serve + SSE), not CLI scraping.

  • Contracts: KiloSettings (enabled, binaryPath, customModels), model defaults/display name, raw event source kilo.sdk.event
  • Server: kiloRuntime, KiloProvider, KiloAdapter, KiloDriver, BUILT_IN_DRIVERS + runtime layer wiring
  • Models inventory as flattened providerID/modelID from connected upstreams
  • Session/stream: start, promptAsync, interrupt, best-effort permission replies (once/always/reject)
  • Agents hidden in v1: default agent code; plan interaction mode → agent plan
  • UI: KiloIcon, settings card, model picker entry
  • Unit tests for runtime helpers, probe/flatten, adapter core paths, registry hydration

Why

Users need Kilo as a top-level T3 provider with the same reliability pattern as OpenCode (SDK + managed server), not a brittle CLI wrapper. Scope stays v1: no agent picker, no external server URL/password settings, no hard resume guarantees, text-gen intentionally unsupported.

UI Changes

  • New Kilo logo in provider icon map / settings
  • Kilo appears in model picker (sidebar badge: new) and provider settings with binary path only

No motion/interaction changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes (N/A — no animation changes)

Note

Medium Risk
Large new adapter/runtime surface manages child processes, auth, and session lifecycle alongside existing providers; failures are mostly isolated to the new driver but bugs could affect thread orchestration or leak processes.

Overview
Adds Kilo as a first-class built-in provider, following the same managed-server + SDK pattern as OpenCode rather than CLI scraping.

Server: New @kilocode/sdk dependency, KiloRuntime (spawn kilo serve, Basic auth client, inventory load), KiloAdapter (sessions, SSE event pump → ProviderRuntimeEvent, turns with steer/interrupt, permissions/questions, MCP hook), KiloProvider health probe (CLI version + connected upstream models as providerID/modelID), and KiloDriver wired into BUILT_IN_DRIVERS with KiloRuntimeLive on the main server layer. Git/text generation is stubbed to fail with a clear message.

Contracts & settings: KiloSettings, legacy providers.kilo defaults, model defaults, and kilo.sdk.event raw source.

Web: Kilo icon, settings card (binary path), model picker entry (new badge), and display-name mapping.

Tests: Runtime helpers, adapter flows, provider flatten/probe, and registry tests updated for a sixth driver.

Reviewed by Cursor Bugbot for commit 168b687. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add Kilo SDK-backed provider adapter, driver, and runtime to the server

  • Adds KiloRuntime to spawn and supervise a local Kilo server process, construct an authenticated SDK client, and fetch provider/agent inventory with structured error handling.
  • Adds KiloAdapter implementing the full session lifecycle: start/stop sessions, send turns with text and attachments, interrupt turns, handle permission and user-input prompts, roll back thread history, and stream runtime events.
  • Adds KiloDriver wiring the adapter and a stub text generation service (all text generation operations return unsupported errors) into a managed provider instance with 5-minute snapshot refresh.
  • Registers KiloRuntimeLive in the application server layer and KiloDriver in the built-in driver list, making the provider available in the settings UI and provider picker with a 'new' badge.
  • Risk: text generation features (commit messages, PR content, branch names, thread titles) are unsupported for the Kilo provider and will return errors.

Macroscope summarized 168b687.

Add a first-party `kilo` provider that spawns managed `kilo serve`,
inventories connected models as providerID/modelID, and streams turns
via @kilocode/sdk (OpenCode-shaped runtime/adapter pattern).
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4bbf56d5-4dd7-4792-b22a-ccd12fc770b9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Jul 17, 2026
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts Outdated
Comment thread apps/server/src/provider/kiloRuntime.ts Outdated
Comment thread apps/server/src/provider/kiloRuntime.ts
Comment thread apps/server/src/provider/kiloRuntime.ts
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Comment thread pnpm-lock.yaml Outdated
Comment thread apps/server/src/provider/kiloRuntime.ts
@macroscopeapp

macroscopeapp Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces an entirely new provider integration (Kilo SDK) with ~3500 lines of new code including a new driver, adapter, runtime, provider layer, and UI components. New features of this scope introducing new integrations and user-facing behavior warrant human review.

You can customize Macroscope's approvability policy. Learn more.

Keep draining Kilo serve stdout/stderr after ready, terminate on startup
timeout, clear interrupt/failed turn state, and drop phantom lockfile deps.
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts Outdated
Avoid racing concurrent startSession calls that replace the map entry
while an earlier call is still tearing down the previous context.
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Comment thread apps/server/src/provider/kiloRuntime.ts Outdated
Treat unexpected clean event-stream ends as session transport errors, and
stop retaining stdout/stderr after ready while still draining pipes.
Prevents clean-stream-end teardown from racing permission-reply tests.
Avoid hanging the adapter layer teardown while still preventing clean
stream-end from racing mid-test permission replies.
Stop retaining stdout/stderr after ready while still draining pipes.
Leave clean SSE completion silent (matches OpenCode) so finite test
streams do not race session teardown.
Comment thread apps/server/src/provider/kiloRuntime.ts
Avoid dropping concurrent stderr diagnostics between URL detection and
startup completion.
Serialize steer-vs-open with Ref.modify so two idle sendTurn calls cannot
both emit turn.started or orphan the first turn id.
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts Outdated
Avoid wiping a turn that concurrent steers still rely on when the
original promptAsync fails after steer reuse.
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Comment thread apps/server/src/provider/Layers/KiloAdapter.ts
Clear activeTurnId before remote abort and skip ready reset if a newer
claim arrived; fail startSession when the session dies during event-pump setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant