Repository navigation
feat(gateway): add enterprise account, modes, notifications, media, and FIM RPCs - #15072
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental pass over the changes since Files Reviewed (7 files)
Previous Review Summaries (4 snapshots, latest commit 13a0e85)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 13a0e85)Status: No Issues Found | Recommendation: Merge Incremental pass over the changes since
Files Reviewed (12 files)
Previous review (commit aa5fc75)Status: No Issues Found | Recommendation: Merge The five findings from the prior review remain resolved at Files Reviewed (10 files)
Previous review (commit 8ee1830)Status: No Issues Found | Recommendation: Merge All five findings from the previous review are resolved at commit
Files Reviewed (2 files)
Previous review (commit d70a90f)Status: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (13 files)
Reviewed by deepseek-v4.1-flash · Input: 60.4K · Output: 14.4K · Cached: 708.4K |
…401 retry, and profile name with v1
Stacked on #15067.
Part of #14991 (and #13750), PR 4 of the Gateway series. Plan units
U-E1-03(balance, Kilo Pass, BYOK, coding plans, modes, notifications),U-E1-08(Gateway client RPC contract), andU-E6-08(FIM and Next Edit routing).What Problem This Solves
In PR 3 (#15067), the
kilocode.gatewayRPC surface exposedprofile,organization.set,models, andsession.metadata, while IDE and TUI clients also need the remaining v1 Gateway endpoints for account balance, Kilo Pass state, BYOK entries, coding plans and quota windows, organization custom modes, user notifications, image and transcription model catalogs, and FIM / Next Edit endpoint routing.Why This Change Was Made
Following the architecture in #14991 and #15060:
packages/kilo-gateway-core:KiloProfile.balance(src/profile.ts): fetchesGET /api/profile/balancewithx-kilocode-organizationidwhen a team is active.KiloTrpc(src/trpc.ts): size-capped (512 KiB), timeout-bounded (5s) tRPC query client forkiloPass.getState(filtering to live statusesactive,past_due,trialing),byok.list,codingPlans.listSubscriptions, andcodingPlans.getUsage(validating unique quota windows and matching subscription ID).KiloModes(src/modes.ts): fetchesGET /api/organizations/{id}/modeswith a 5-minute per-organization cache (clearCache()on team switch).KiloNotifications(src/notifications.ts): fetchesGET /api/users/notificationswith Kilo attribution headers.KiloModels.imageModelsandKiloModels.transcriptionModels(src/models.ts): fetches image-capable models (output_modalitiesincludes"image") and transcription models (GET /api/gateway/transcription-models).KiloAutocomplete(src/autocomplete.ts): portsAUTOCOMPLETE_MODELS,getAutocompleteModel,resolveFimTarget(/api/fim/completions, Mistral, Inception),resolveEditTarget(/api/edit/completions, Inception),extractFencedBody, andrequestMistralFim.kilocode.gatewayRPC surface (packages/core/src/kilocode/gateway-rpc.ts,gateway.ts):authStatus,balance,kiloPass,byok,codingPlans,codingPlanUsage,modes,notifications,models.images,models.transcriptions,autocomplete.fimTarget, andautocomplete.editTarget./kilo-accountcommand (packages/tui/src/kilocode/gateway.tsx):/kilo-account(aliases/balance,/kilo-pass) to display the active Kilo Gateway account email, personal/team scope, balance, Kilo Pass usage, and organization custom modes.Shared upstream files changed
None in this PR (all changes are in Kilo-owned paths
packages/kilo-gateway-core/**,packages/core/**/kilocode/**, andpackages/tui/**/kilocode/**).User Impact
/kilo-account(/balance,/kilo-pass) displays the signed-in account, active team scope, credit balance, Kilo Pass usage, and team modes in the TUI.authStatus,balance,kiloPass,byok,codingPlans,codingPlanUsage,modes,notifications,models.images,models.transcriptions,autocomplete.fimTarget, andautocomplete.editTargetover the typedkilocode.gatewayRPC surface.Evidence
Automated checks
bun script/check-opencode-annotations.ts:ok (39 shared files against 4d9678a79d6)bun script/check-shared-patches.ts:ok(0 new shared upstream files touched)bun run --cwd packages/kilo-gateway-core typecheck && bun run --cwd packages/kilo-gateway-core build: passbun run --cwd packages/core typecheck: passbun run --cwd packages/tui typecheck: passbun test --cwd packages/kilo-gateway-core: 36 pass, 0 fail (123 assertions)bun test --cwd packages/core test/kilocode/gateway.test.ts test/plugin/provider-kilo.test.ts: 14 pass, 0 fail (72 assertions)bun test --cwd packages/tui test/kilocode/gateway.test.ts: 2 pass, 0 fail (4 assertions)TUI Self-Test
/kilo-accountdialog:/kilo-accountdialog (showing account email, team scope, balance, Kilo Pass, and team modes):