Repository navigation
feat(tui): port Kilo sidebar panels with slot order - #15427
Conversation
# Conflicts: # migration-tracking/progress/README.md # migration-tracking/progress/history.svg # migration-tracking/progress/progress.json # migration-tracking/progress/progress.svg # script/upstream/shared-patches.json
|
➖ v2 migration progress: 1.5% → 1.5% (+6 done, 0 total, 0 dropped; 149/9828 cells) Placement: 19 new marked lines in shared files (19 seam), 0 new Ratchets: 25 core-internal imports (base 25); shared patches by rung 28 seam, 20 patch (base 26 seam, 20 patch).
6 cells closed
|
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The incremental change re-keys the usage resource on the family's session Files Reviewed (1 file)
Previous Review Summary (commit 11b7da2)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 11b7da2)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (20 files)
Reviewed by deepseek-flash-latest · Input: 39K · Output: 4.2K · Cached: 413.4K Review guidance: REVIEW.md from base branch |
Part of #15337
What Problem This Solves
The v2 session sidebar showed only the upstream panels (Context, MCP, Todo, footer). The v1 Kilo sidebar panels were missing: the PR of the current branch, the Kilo balance and Kilo Pass, the version line, and the usage panel with tokens, cost and usage per routed model (left open by #15404, which ported
/usage). The v2 TUI slot API also had no numeric order, so a plugin could not place a panel between the upstream panels as v1 did.Why This Change Was Made
order. Each anchor is sorted stably by it; a claim without an order counts as 100, 200, ... in enable order. Without any order the result is the enable order, so upstream behavior and tests do not change. With today's upstream claims (Context, MCP, Todo, footer) this gives the v1 positions: pr 50, Context, usage 150, MCP, (indexing 225, processes 250), Todo, (memory 1000); Kilo footer 99 before the upstream footer.kilocode.sidebar.usage, order 150), as v1sidebar-usage.tsx,sidebar-usage-row.tsxandmodel-usage.ts:native.kilo.routedModelID), grouped by provider, sorted by cost, then provider and model. A step counts when it has token usage, as a v1 step-finish part. Rows expand to the token breakdown.kilocode.gatewaymodels RPC.message.listAPI and reads them again when the cost or token totals of a family session change (a finished step), as v1 read its query after each step. Title or time updates do not trigger a read.kilocode.sidebar.footer, order 99), as v1sidebar-footer.tsx: personal or team credits (error color at $2 or less), Kilo Pass usage, bonus and renewal for the personal scope. Refresh on sign-in, on the Gatewayorganizationevent (team switch), 10 s after a billed Kilo step, and every 5 minutes on a team; 30 s request timeout. Signed out, the panel sends no request. A second claim at order 101 adds the v1• Kilo <version>line below the location path.kilocode.sidebar.pr, order 50), as v1sidebar-pr.tsx:PR #<n> - <title>through theghCLI, with the v1 lookup order (tracking ref, branch, head SHA, fork parent by branch and by SHA, only PRs whose head is HEAD), 1 s per command, 20 s overall,ghprobe cached 5 minutes. Nothing shows withoutghor a PR.modelLabelis extracted fromroutedModelLabelinrouted-model.tsxso the usage rows and the routed badges use the same v1 label rules.User Impact
In a wide terminal (or with the sidebar open) the session sidebar shows, in v1 order: PR, Context, Token Usage, Models, Terminal Bench, MCP, Todo, then Balance, the location path and the Kilo version. Signed out, the balance is hidden, as on v1.
Not ported, because the backing feature is not on v2 yet:
The seam already supports their orders; the panels can follow with their features.
Evidence
v1 reference on
main:packages/opencode/src/kilocode/plugins/{sidebar-usage,sidebar-usage-row,model-usage,sidebar-footer,sidebar-pr}.tsx,packages/opencode/src/kilocode/session/model-usage.ts,packages/opencode/test/kilocode/sidebar-footer.test.ts.Automated (isolated
OPENCODE_TEST_HOME/XDG paths). First run with Bun 1.4.2; after mergingv2with the v2.1.3 sync (#15425), rerun with the pinned Bun 1.4.4:packages/tuibun test1618 pass, 2 fail (same baseline test), rootbun run check, shared-patch and annotation checks, progress map--check, plus a TUI smoke test (signed out prompt, usage panel and version line).packages/tui:bun test1613 pass, 2 fail. The 2 failures (dialog-shell-output.test.tsx, "shell output opens, follows, scrolls...") fail the same way onorigin/v2without this change.slot-order.test.ts(enable order withoutorder; the v1 sidebar order pr, context, usage, mcp, indexing, processes, todo, memory; footer 99 before upstream footer),model-usage.test.ts(routed model keying, running steps excluded, cost sort and ties, provider grouping),sidebar-usage.view.test.tsx(real app, root and subagent over two message pages: panel order Context, Token Usage, Models, Terminal Bench, MCP; family totals, cache rate, speed, routed model rows, row expansion; Balance above the path, version below),sidebar-footer.test.ts(v1 assertions: format, scope, credit label, Kilo Pass line, renewal date, billed step),sidebar-pr.test.ts(lookup order, SHA match, fork parent, nogh).packages/plugin:bun test9 pass.bun typecheckin plugin and tui; rootbun run check;bun script/check-shared-patches.ts --worktree;bun script/check-opencode-annotations.ts --worktree;bun script/upstream/placement.ts --imports(no new core-internal imports); progress map twice (identical) plus--check.Self-test, real TUI (
vscode-self-testharness,--mode none,bun dev --standaloneviascript/dev-isolated.ts, freshKILO_V2_PROFILE,env -ichild environment):kilo/kilo-auto/free: a prompt that ran one general subagent, then a switch to Laguna S 2.1 (free) and a second prompt. The sidebar showed Context, Token Usage (family totals, cache rate, speed), Models (2), then Models (3) live after the second prompt with the routed models of root and subagent; no Balance; no errors in the log. Pass.@kilocode/gateway-core/testing,KILO_API_URL,KILO_API_KEY=fixture-token), current model Kilo Auto Frontier: Terminal Bench 2.0 72.0% / $0.45, Balance $42.50 with Kilo Pass $12 / $50, bonus +$5.00, renews Nov 1, above the location path; model row expansion. Pass.ghwith the real config dir (GH_CONFIG_DIR, becausebun devisolatesHOME): the sidebar showsPR #15427 - feat(tui): port Kilo sidebar panels with slot orderabove Context, and• Kilo localbelow the location path. Pass.main, temporary HOME, same prompts and models, same fixture,BROWSER=true): same panels, order and content.Proof
Signed out, same prompts and models. v1 (
main):v2 (this PR):
Local Gateway fixture, Kilo Auto Frontier selected, one model row expanded. v1:
v2:
Differences on purpose or from missing features: v1 shows Code Indexing, LSP and Memory (not on v2); v1 shows the session ID under the title (upstream v2 sidebar does not); v1 shows the generation speed only for steps with computed metrics, v2 uses the step times as
/usagedoes (#15404). The v2 fixture screenshot above was taken before the version line was added. On the final head, same fixture (Laguna selected, so no Terminal Bench), the footer shows Balance, the location path and• Kilo localas on v1:v2 PR panel (order 50, above Context) and version line, in this worktree with this PR open (sidebar only). v1 shows the same
PR #<n> - <title>line at the top of its sidebar:Placement
orderpackages/plugin/src/tui/context.ts(1 line),packages/tui/src/plugin/api.tsx(1 line),packages/tui/src/plugin/structure.ts(1 line plus a 10-line block);shared-patches.jsonentriespackages/tui/src/kilocode/plugins/*KiloTeams,KiloUsage)packages/tui/src/plugin/builtins.ts, 6 marked linesShared upstream files:
packages/plugin/src/tui/context.ts(existing entry, text extended),packages/tui/src/plugin/api.tsxandpackages/tui/src/plugin/structure.ts(new, rung 3),packages/tui/src/plugin/builtins.ts(existing entry, text extended). Limits: files 46 to 48, markedLines 334 to 353. No new core-internal imports. No mirrored files. Startup budget: no entries, the new plugins are TUI plugins and the budget measures server plugins.Progress map
plugin: 1/34 to 7/34. module 1/26 to 6/26, test 0/6 to 1/6.Done, and why:
sidebar-usage.tsx,sidebar-usage-row.tsx,model-usage.ts,sidebar-pr.tsx,sidebar-footer.tsx->packages/tui/src/kilocode/plugins/;sidebar-footer.test.ts->packages/tui/test/kilocode/sidebar-footer.test.ts.Still open:
sidebar-indexing.tsx,sidebar-background-processes.tsx,memory-status.tsx,memory-palette.tsx: the backing features are not on v2.patch:plugin:e579fb4997a9(v1withKiloTuiPluginsinplugin/tui/internal.ts): it registers every v1 Kilo TUI plugin, most of them other units.usage-costsession/model-usage.tsand its test: the v1 server endpoint for per-model usage, also used by the VS Code extension (G2). The TUI aggregates on the client.plugincells (session switcher, remote, sandbox, attention, and more) belong to other units.Limits
bun dev,ghruns with the isolated profileHOME, so the PR panel needsGH_CONFIG_DIR(orGH_TOKEN) in the self-test; installed builds use the realHOME./connectcredential, both listed byintegration.list). The self-test covered the environment key only; no real login flow was started.