feat: add Kilo SDK-backed provider adapter#4089
Conversation
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).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: 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.
Avoid racing concurrent startSession calls that replace the map entry while an earlier call is still tearing down the previous context.
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.
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.
Avoid wiping a turn that concurrent steers still rely on when the original promptAsync fails after steer reuse.
Clear activeTurnId before remote abort and skip ready reset if a newer claim arrived; fail startSession when the session dies during event-pump setup.
What Changed
Add a first-party
kiloprovider adapter that runs Kilo via@kilocode/sdk(managedkilo serve+ SSE), not CLI scraping.KiloSettings(enabled,binaryPath,customModels), model defaults/display name, raw event sourcekilo.sdk.eventkiloRuntime,KiloProvider,KiloAdapter,KiloDriver,BUILT_IN_DRIVERS+ runtime layer wiringproviderID/modelIDfrom connected upstreamspromptAsync, interrupt, best-effort permission replies (once/always/reject)code; plan interaction mode → agentplanKiloIcon, settings card, model picker entryWhy
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) and provider settings with binary path onlyNo motion/interaction changes.
Checklist
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/sdkdependency,KiloRuntime(spawnkilo serve, Basic auth client, inventory load),KiloAdapter(sessions, SSE event pump →ProviderRuntimeEvent, turns with steer/interrupt, permissions/questions, MCP hook),KiloProviderhealth probe (CLI version + connected upstream models asproviderID/modelID), andKiloDriverwired intoBUILT_IN_DRIVERSwithKiloRuntimeLiveon the main server layer. Git/text generation is stubbed to fail with a clear message.Contracts & settings:
KiloSettings, legacyproviders.kilodefaults, model defaults, andkilo.sdk.eventraw source.Web: Kilo icon, settings card (binary path), model picker entry (
newbadge), 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
KiloRuntimeto spawn and supervise a local Kilo server process, construct an authenticated SDK client, and fetch provider/agent inventory with structured error handling.KiloAdapterimplementing 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.KiloDriverwiring 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.KiloRuntimeLivein the application server layer andKiloDriverin the built-in driver list, making the provider available in the settings UI and provider picker with a 'new' badge.Macroscope summarized 168b687.