feat(api): enrich provider.list with usage freshness and recent token signals#18439
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Rebased on upstream/dev (HEAD: 11e7dae). CI re-running. |
d46899c to
11e7dae
Compare
|
Already on upstream/dev. HEAD: 11e7dae |
|
hey @LucasSantana-Dev, did you mean to attach this pr to #9281? it doesn't seem to match the feature requested there. #9281 is specifically about showing actual provider plan usage/limits in the tui, e.g. remaining quota, reset windows, and provider-specific limits for openai/codex, claude, and copilot. from the diff, this pr seems to add an isolated helper that summarizes recent local assistant-message token counts by provider and marks them fresh/stale/missing. that could maybe be useful as provider activity metadata, but it doesn't fetch provider quota/limit endpoints, expose i think you should remove |
Issue for this PR
Closes #9281
Type of change
What does this PR do?
This extends
provider.listwith server-derived usage freshness and recent token signals so clients can render provider usage state without duplicating inference logic.Added fields per provider:
usage.state:fresh | stale | missingusage.observedAtusage.ageMinutesusage.recentInputTokensusage.recentOutputTokensWhy this works: values are computed from recent assistant message usage on the server, so all clients consume one canonical classification path.
How did you verify your code works?
cd packages/opencode && bun run typecheckcd packages/opencode && bun test test/provider/usage.test.tsScreenshots / recordings
Not a UI change.
Checklist