feat(backend): add Kilo CLI as backend provider - #161
Conversation
Adds a Kilo CLI backend selectable via `"backend": "kilo"` in
~/.talon/talon.json. Spawns `kilo serve --hostname 127.0.0.1 --port 4097`
via cross-spawn; talks to it over the @kilocode/sdk v2 client. Mirrors
the existing OpenCode backend in shape: lifecycle management, session
handling, model catalog with provider routing, MCP server registration.
`src/backend/kilo/` (6 files, ~2050 LOC):
- index.ts exports + initKiloAgent / stopKiloServer
- server.ts server process spawn, MCP server registration,
tool overrides, plugin MCP propagation
- handler.ts query handler: stream events, tool-use propagation,
end-turn detection
- sessions.ts per-chat session state, message accumulation,
tool-call mapping
- model-provider.ts resolveModel, getModelInfo, getSettingsPresentation,
getProviders, listModels — pluggable into the
backend abstraction in core/types.ts
- models.ts model catalog (~758 LOC) with provider routing,
bucket priority, normalized lookup, query parsing
Wire-up:
- src/bootstrap.ts + Kilo branch in initBackendAndDispatcher
- src/util/config.ts `"kilo"` added to backend enum
- package.json + @kilocode/sdk@^7.2.22; lockfile regenerated
|
Drive-by CI note (not a maintainer, just observing) — second PR from this contributor in ~18 minutes (after #160). This one is fully green on first push: 21/22 jobs green, 1 skipped (Auto-Merge, expected behavior). All passing: Tests on The combined-status rollup may show "pending" — that's the legacy commit-status API not reflecting check-runs (same surface oddity as #160). The check-runs view is the source of truth. No CI noise to clear — substantive review on whether Kilo is a path Talon wants is Dylan's call. — Talon (heartbeat instance) |
The README hadn't kept pace with what landed across PRs #96, #160, #161, #165, #169, #170, and #172: - Kilo and OpenCode backends were missing or misrepresented (the badge still said "Claude Agent SDK", the backend config row listed only claude/opencode, the architecture tree didn't mention kilo, remote-server, or shared). - Discord frontend (PR #160) was absent from every list. - Triggers (PR #96) were absent from the features table. - Test count was stale at "1300+" — the suite is now 2200+ across the unit / SDK-stub / MCP-functional / integration tiers. - Prerequisites assumed a single backend (Claude CLI on PATH). Changes: - New "Backends" section explaining the three options + their transport shape + shared remote-server infrastructure. - Backends badge replaces the Claude Agent SDK badge. - Features table: dedicated "Pluggable backend" row, new "Triggers" row, MCP tools row mentions triggers. - Architecture tree refreshed: backend/registry.ts, backend/shared/, backend/remote-server/, kilo/, plus discord/ under frontend. - Backend-specific prerequisites called out under Quick Start. - Dependency rule paragraph mentions the QueryBackend interface. - Config table: backend accepts claude/kilo/opencode, frontend accepts discord, model description is backend-agnostic. - Development: test count updated to 2200+ across the tier matrix, added `npm run format`.
Summary
Adds a Kilo CLI backend selectable via
"backend": "kilo"in~/.talon/talon.json. Spawnskilo serve --hostname 127.0.0.1 --port 4097via cross-spawn; talks to it over the
@kilocode/sdkv2 client. Mirrorsthe existing OpenCode backend in shape: lifecycle management, session
handling, model catalog with provider routing, MCP server registration.
What's included
src/backend/kilo/— 6 files, ~2050 LOCindex.ts— exports +initKiloAgent/stopKiloServerentry points.server.ts— server process spawn, MCP server registration,tool overrides, plugin MCP propagation.
handler.ts— query handler: stream events, tool-use propagation,end-turn detection.
sessions.ts— per-chat session state, message accumulation,tool-call mapping.
model-provider.ts—resolveModel,getModelInfo,getSettingsPresentation,getProviders,listModels— plugsinto the
QueryBackendabstraction incore/types.ts.models.ts— model catalog (~758 LOC) with provider routing,bucket priority, normalized lookup, query parsing.
Wire-up
src/bootstrap.ts— adds Kilo branch ininitBackendAndDispatcher.src/util/config.ts—"kilo"added tobackendenum.package.json— adds@kilocode/sdk@^7.2.22; lockfile regenerated.Configuration example
{ "backend": "kilo", "model": "anthropic/claude-sonnet-4-5" }Talon will spawn
kilo serveon localhost:4097 and route queriesthrough it. Models are resolved against the Kilo catalog with the
same
provider/modelsemantics as OpenCode.Out of scope (future work)
OpenCode rendering path).