Repository navigation
Conversation
4e81e7d to
42b89d4
Compare
There was a problem hiding this comment.
The Go meter looks sound. The limited state, the Escape handling and keyboard focus beside the account switcher all read correctly. I couldn't watch it work here: there's no desktop app and no Console account with Go usage. The src/usage and src/providers/models unit tests pass (87/87) with the package's preloads, and tsc -b is clean. Your before/after screenshots will cover the visual side.
Public API: unchanged. The app UI, its i18n keys and the stories runtime are all internal.
Two things are worth fixing (inline):
- The Usage dialog is now imported directly by the picker, which undoes its on-demand loading in
composer/commands.tsx. - View all usage opens the dialog without the current model or
onSwitchModel, so it can show less than/usagedoes.
| import { Menu } from "@opencode/ui/menu" | ||
| import { For } from "solid-js" | ||
| import { useLanguage } from "@/runtime/i18n/language" | ||
| import { Track } from "./dialog" |
There was a problem hiding this comment.
This import, together with the direct DialogUsage import in select-dialog.tsx, puts all of usage/dialog.tsx (and its CSS and state machine) into the model picker's bundle. composer/commands.tsx deliberately loads @/usage/dialog on demand, and on the base nothing else imports it outside stories. Vite will now warn that the module is both imported on demand and directly, and stop splitting it out. Could Track move to a small shared module, with the picker loading DialogUsage on demand the way commands.tsx does?
| } | ||
| onAdd={() => void connectOpenCode(false)} | ||
| onManage={() => void connectOpenCode(true)} | ||
| onViewUsage={() => void dialog.show(() => <DialogUsage location={location().ref} />)} |
There was a problem hiding this comment.
Opened from here, the Usage dialog has no model (or onSwitchModel). A per-model budget won't show the current model's counter, and there's no way back to the picker, unlike opening it with /usage in composer/commands.tsx. The picker already has the current model from props.model / useLocal().model. Passing it through, with onSwitchModel reopening the picker, would make both entry points show the same dialog.
The OpenCode header row of the model picker shows the workspace's Go allowance when the usage limits include one: the 5-hour window as a dashed line over the weekly window as a solid one, and the highest window's percent used, or when Go serves requests again once a window is limited. It opens a menu with the 5-hour, weekly and monthly windows, their bars and reset times, and a way to the Usage dialog. The meter is reachable with Tab beside the account switcher, and Escape closes its menu without closing the picker. No flag.
Issue for this PR
Closes #
Type of change
What does this PR do?
Stacked on #66848.
A Go usage meter sits at the end of the OpenCode header in the picker:
Trackis exported from the Usage dialog, which has no visual change.No feature flag: additive UI in the desktop app. English copy only; no existing keys removed.
Known limitations
How did you verify your code works?
bun typecheckand unit tests inpackages/app;/reviewand/rmsloppasses; visual check of every state in the desktop app (opencode-drive against a fake Console) compared with the design stories. The Usage dialog is pixel-identical before and after.Screenshots / recordings
Before/after screenshots against the design (light and dark) to follow in a comment.
Checklist