opencode-copilot-chat
opencode-copilot-chat copied to clipboard
feat: manual usage targets + live pricing for Go tracker
Summary
Adds manual Go usage target configuration and fixes cost estimation to use live models.dev pricing instead of a stale hardcoded table.
Closes
Closes #23
Changes
Manual Usage Targets (showUsageTargetEditor)
- New command "OpenCode Go: Set Usage Targets..." opens 5 sequential input boxes pre-filled with current values:
- Session spent (rolling 5h, limit $12)
- Weekly spent (Mon–Mon UTC, limit $30)
- Monthly spent (limit $60)
- Monthly reset day (1–31)
- Monthly reset hour (0–23 UTC)
- Press Enter on any input to keep the current value; Escape cancels the entire flow.
- Targets are persisted in
globalStateas baseline amounts with a customexpiresAtfor the monthly anchor.
Monthly Reset Display Fix
buildSummaryFromTrackedandbuildSummaryFromRowsnow usebaseline.monthly.expiresAtasresetsAtwhen available, so the "resets in Xd Yh" text reflects the user-configured anchor date instead of the auto-calculated month end.
Webview / Status Bar Cleanup
- Removed button and scripts from the usage webview (now display-only SVG).
- Status bar click disabled (hover-only via tooltip).
- Tooltip links to the
setUsageTargetscommand.
Live Pricing Fallback
- Injected a
CostResolvercallback intoGoUsageTrackerthat reads from the livemodels.devmetadata snapshot. - Cost resolution priority: per-request
externalCost→ live snapshot → bundled static table. - The hardcoded
GO_MODEL_PRICINGis kept only as a last-resort fallback.
Commits
d031457— feat: add manual usage targets editor for Go usage tracker094978e— fix: use live models.dev pricing instead of hardcoded fallback in Go tracker