Repository navigation
feat(kilo-plugin): serve a Kilo v2 handshake as plugin RPC - #15285
Conversation
Add the kilocode.handshake RPC contract and its plugin. The handshake returns the product, version and channel of the server, so a client can confirm that it talks to a Kilo v2 server. Kilo route groups are plugin RPCs that the host registers through KiloPlugins and the server serves at POST /api/rpc/:rpcID/:method. A host test starts the host entry and calls the handshake and a Gateway route through the generated client. Part 1 of U-E1-08.
|
➖ v2 migration progress: 0.9% → 0.9% (+1 done, 0 total, 0 dropped; 90/9829 cells) Placement: 0 new marked lines in shared files, 1 new Ratchets: 9 core-internal imports (base 9); shared patches by rung 20 seam, 7 patch (base 20 seam, 7 patch).
1 cells closed
|
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of The previous SUGGESTION about stale shared-patch counts is resolved: the U-E1-08 row now states 27 files / 204 marked / 39 unmarked, matching the Observation (not counted as a finding; the Files Reviewed (2 files in this step; 11 files overall)
Previous Review Summaries (4 snapshots, latest commit 476e4f4)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 476e4f4)Status: No Issues Found | Recommendation: Merge Incremental review of The PR's own diff against the new base ( No new inline comments. Files Reviewed (1 file in this step; 11 files overall)
Previous review (commit 7e17e57)Status: No Issues Found | Recommendation: Merge Incremental review of The handshake contract, plugin, No new inline comments. Files Reviewed (1 file in this step; 11 files overall)
Previous review (commit 7cb656d)Status: 1 Issue Found | Recommendation: Address before merge Incremental review, base moved to Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (11 files)
Fix these issues in Kilo Cloud Previous review (commit 12b1c32)Status: No Issues Found | Recommendation: Merge Kilo-owned placement only: the handshake contract lives in Files Reviewed (11 files)
Reviewed by deepseek-flash-latest · Input: 36K · Output: 19.5K · Cached: 783K Review guidance: REVIEW.md from base branch |
…pc-routes # Conflicts: # migration-tracking/progress/README.md
…pc-routes # Conflicts: # migration-tracking/plans/kilo-v2-migration-plan.md # migration-tracking/progress/README.md # migration-tracking/progress/history.svg # migration-tracking/progress/progress.json # migration-tracking/progress/progress.svg
What Problem This Solves
A VS Code or JetBrains client that connects to a v2 server cannot tell a Kilo v2 server from an upstream OpenCode server.
GET /api/inforeports a version but no product name, and the OpenAPI title is "opencode". Also, the v2 line had no stated rule for how a Kilo route group (the v1/kilocode/*HttpApi groups) reaches the server.Why This Change Was Made
Part 1 of U-E1-08 (Kilo server extension surface).
KiloPlugins. The contract is inpackages/schema/src/kilocode/<feature>.ts, the plugin registers the handlers withctx.rpc.register, and upstreamrpc.callserves it atPOST /api/rpc/:rpcID/:method. The host already registersKiloPlugins, so this needs no new mount point and no seam. The comment onKiloPluginsnow states the rule.kilocode.handshakeRPC (packages/schema/src/kilocode/handshake.ts, pluginpackages/kilo-plugin/src/handshake/index.ts). Methodgetreturns{ product: "kilo", version, channel }, from the app identity that the host gives the server (ctx.app).{"output":{"product":"kilo",...}}.rpc.unavailable./api/rpcroute)./reload, watcher policy, capabilities in the handshake.GET /api/pluginalready lists the activekilocode.*plugins, so a capability list would repeat it.User Impact
No visible change in the TUI. Clients can call
client.rpc(KiloHandshakeRpc.Definition).get({})(contract from@opencode/schema/kilocode/handshake) to confirm a Kilo v2 server before they use v2 routes. Kotlin clients can callPOST /api/rpc/kilocode.handshake/getwith{"input":{}}.Placement
kilocode.handshakecontract and pluginschema/src/kilocode/handshake.ts,kilo-plugin/src/handshake/index.tsKiloPluginsinkilo-plugin/src/index.ts,kilo_port(server:5e0f8563b425)Shared upstream files changed: none. Core-internal imports added: none. Mirrored files: none. Shared patches: none changed by this PR. The baseline is 27 files, 204 marked, 39 unmarked in
script/upstream/shared-patches.jsonafter the config discovery seam (#15282).Progress map
server: 0/96 to 1/96. patch 0/10 to 1/10; landed 1 plugin.Done, and why:
patch:server:5e0f8563b425, v1server/routes/instance/httpapi/api.ts:29imported the Kilo HttpApi groups into the upstream Api. v2 serves each Kilo group as the RPC of a plugin inKiloPlugins. Each group module keeps its own open cell.Still open:
patch:server:6125d390ed46(v1httpapi/server.ts:125): it also provides the v1 listener layer (CORS, presence), which is not ported.servercells: later parts of U-E1-08 and the feature units of each group.Corrections: the contract was first named
server.ts. The progress map matches module cells by feature and file name, so that name closed two unrelated v1 cells (kilocode/server/server.ts, the OpenAPI title, andkilocode/server/httpapi/server.ts, the listener layer). The file is namedhandshake.tsso only the verified cell closes.Evidence
packages/kilo-cli/test/handshake.test.ts: starts the host entry asserve --stdiowith isolated HOME and XDG andKILO_SERVER_PASSWORD, then calls the handshake andkilocode.gatewayauthStatusthrough the generated client against a local stand-in for the Kilo API. Pass.bun typecheck:packages/schema,packages/kilo-plugin,packages/kilo-clipass.bun testwith isolated HOME and XDG: schema 68/68, kilo-plugin 25/25, kilo-cli 11/11.bun run startupin packages/kilo-cli): pass. New budgetkilocode.handshake: 50instartup-budget.json, the same value as the other Kilo plugins (measured median 0 ms on CI and locally); the ratchet requires a budget for each Kilo plugin.bun run check:generated(packages/client): no drift. Plugin RPC methods are not in the OpenAPI surface.bun script/check-shared-patches.ts --worktree,bun script/check-opencode-annotations.ts --worktree,bun script/upstream/placement.ts --imports: ok.bun script/upstream/progress.tstwice (identical), then--check: up to date.env KILO_V2_PROFILE=/tmp/kilo-v2-handshake KILO_SERVER_PASSWORD=selftest bun dev serve --port 47123, then curl:POST /api/rpc/kilocode.handshake/get, with and without a location:{"output":{"product":"kilo","version":"local","channel":"local"}}POST /api/rpc/kilocode.gateway/authStatus: answeredrpc.method_not_found; no auth: 401; no errors in the logv2(pass): built the host withbun run script/build.ts --single --skip-web-ui(Bun 1.4.2), then a client script startedbin/kilo serve --stdiowith isolated HOME and XDG,KILO_SERVER_PASSWORDandKILO_CLIENT=vscode, as an IDE would:{"product":"kilo","version":"0.0.0-plugin-rpc-routes-202610210645","channel":"plugin-rpc-routes"}, the build version and channel (/api/inforeports the same version).productstayskilowithKILO_CLIENT=vscode.kilocode.gatewayauthStatusanswered;/api/pluginlistskilocode.handshake,kilocode.gateway,kilo.agent,kilo.agent.ceilingas active; no password: 401; the server exits with code 0 when stdin closescreateRouteswithout overrides):{"type":"rpc.unavailable","message":"RPC is unavailable: kilocode.handshake"}kilo7.8.12 with isolated HOME and XDG): 404 with v1 credentials (userkilo), 401 with useropencode. A client that sendsopencodecredentials to a v1 server gets 401, not 404.bun run check: lint passes. Typecheck fails locally in upstream packages (ai,cli,server, ...) because a worktree nested in another checkout resolves@types/nodefrom the parent checkout. These packages do not import the changed files.Limits: the version is
localuntil a Kilo build definesOPENCODE_VERSIONandOPENCODE_CHANNEL.