Skip to content

feat(trae): dollar-usage bars#3

Open
LeoLin990405 wants to merge 3 commits intofeat/doubao-dashboardfrom
feat/trae-dollar-usage
Open

feat(trae): dollar-usage bars#3
LeoLin990405 wants to merge 3 commits intofeat/doubao-dashboardfrom
feat/trae-dollar-usage

Conversation

@LeoLin990405
Copy link
Copy Markdown
Owner

Fetches Cloud-IDE-JWT via GetUserToken, calls user_current_entitlement_list, emits $used/$limit bars for Pro plan + Extra package.

…ment_list

- fetchJWT(session:) POSTs to .../cloudide/api/v3/common/GetUserToken with
  session cookies, returns short-lived Cloud-IDE-JWT
- fetchEntitlements(session:) calls api-sg-central.trae.ai pay endpoint
  with Bearer JWT; parses user_entitlement_pack_list
- TraeUsageSnapshot.entitlements added; toUsageSnapshot emits primary
  (Pro plan) + secondary (Extra package) as $used / $limit bars with
  next_billing_time as reset. Falls back to 7-day activity on failure.
Previously sessionLabel=Requests, weeklyLabel=Monthly (misleading since
secondary slot now carries weekly quota). Tertiary wasn't shown because
supportsOpus=false. Fix by setting:
- sessionLabel: "5h"    (primary: session 5h window)
- weeklyLabel:  "Week"  (secondary: weekly)
- opusLabel:    "Month" (tertiary: monthly)
- supportsOpus: true     (enables the tertiary slot in MenuCardView)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant