Skip to content

Update agent-usage extension#27121

Open
GarrickZ2 wants to merge 6 commits intoraycast:mainfrom
GarrickZ2:ext/agent-usage
Open

Update agent-usage extension#27121
GarrickZ2 wants to merge 6 commits intoraycast:mainfrom
GarrickZ2:ext/agent-usage

Conversation

@GarrickZ2
Copy link
Copy Markdown
Contributor

@GarrickZ2 GarrickZ2 commented Apr 12, 2026

Description

Add MiniMax as a new single-account provider for tracking AI coding assistant usage. MiniMax exposes 5h interval and weekly remaining quotas via their /v1/api/openplatform/coding_plan/remains API.

Screencast

image

Checklist

- Merge branch \'contributions/merge-1776027765274\'
- Pull contributions
- Add MiniMax provider support
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: agent-usage Issues related to the agent-usage extension platform: macOS platform: Windows labels Apr 12, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

raycastbot commented Apr 12, 2026

Thank you for your contribution! 🎉

🔔 @natsustan @alexibuild @AdrianBonpin you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="ext/agent-usage"
FORK_URL="https://github.com/GarrickZ2/raycast-extensions.git"
EXTENSION_NAME="agent-usage"
REPO_NAME="raycast-extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

@GarrickZ2 GarrickZ2 marked this pull request as ready for review April 12, 2026 21:50
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 12, 2026

Greptile Summary

This PR adds MiniMax as a new single-account provider, following the established pattern of auth resolution (preferences → OpenCode → shell env), a custom fetcher hook, and a renderer. The implementation is structurally sound but contains one correctness bug in renderer.tsx: all three display functions (formatMiniMaxUsageText, renderMiniMaxDetail, getMiniMaxAccessory) pass current_interval_usage_count (amount consumed) to getRemainingPercent as the "remaining" argument, inverting every percentage shown — users see "X% remaining" when X is actually the used fraction. This is the same bug that was previously fixed for z.ai.

Confidence Score: 4/5

Not safe to merge until the inverted percentage calculation in renderer.tsx is fixed.

One P1 logic bug causes all MiniMax usage percentages and the pie icon to display the used fraction instead of the remaining fraction, which is the core data shown to users. All other files are structurally correct and follow established patterns.

extensions/agent-usage/src/minimax/renderer.tsx — all three exported functions pass usage_count instead of (total - usage_count) to getRemainingPercent.

Important Files Changed

Filename Overview
extensions/agent-usage/src/minimax/renderer.tsx New renderer for MiniMax usage display; contains a P1 bug where current_interval_usage_count (used count) is passed as the "remaining" argument to getRemainingPercent in all three exported functions, causing inverted percentages throughout the UI.
extensions/agent-usage/src/minimax/auth.ts New auth module resolving MiniMax token from preferences, OpenCode auth file, or shell env var; follows the same pattern as other providers and looks correct.
extensions/agent-usage/src/minimax/fetcher.ts New fetcher hook for MiniMax usage API; request-ID race-condition guard is correctly implemented and matches the pattern used by other providers.
extensions/agent-usage/src/minimax/types.ts Type definitions for MiniMax API response, usage, and error; cleanly mirrors the API shape.
extensions/agent-usage/src/agent-usage-menubar.tsx MiniMax wired into the menu bar; minimaxState is redundantly added to visibleAgents deps (already covered by singleAgents), and isMinimaxVisible is absent from singleAgents deps (minor, not a real bug due to transitivity).
extensions/agent-usage/src/agent-usage.tsx MiniMax cleanly added to the main command registry and state; follows the exact same pattern as existing providers.
extensions/agent-usage/CHANGELOG.md New changelog entry uses a hardcoded date (2026-04-12) instead of the required {PR_MERGE_DATE} placeholder.
extensions/agent-usage/package.json Adds showMinimax checkbox preference and minimaxApiToken password preference; correctly structured and matches existing provider patterns.
extensions/agent-usage/src/agents/types.ts Adds "minimax" to the AgentId union type; straightforward change.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/agent-usage/src/minimax/renderer.tsx
Line: 35-38

Comment:
**Usage count passed as remaining count — percentages are inverted**

`current_interval_usage_count` is the number of requests/tokens **already consumed**, but `getRemainingPercent` expects the **remaining** quantity as its first argument. The result is that every percentage displayed says "X% remaining" when it actually shows "X% used" — so a user who has used 80% of their quota sees "80% remaining" instead of "20% remaining". The pie icon in `getMiniMaxAccessory` is correspondingly inverted.

The exact same bug was fixed for z.ai in a previous PR ("Fix z.ai percentage calculation — API's `percentage` field is 'percentage used' not 'percentage remaining'"). The fix should subtract usage from total before passing it in:

```suggestion
      const percent = getRemainingPercent(
        codingModel.current_interval_total_count - codingModel.current_interval_usage_count,
        codingModel.current_interval_total_count,
      );
```

This same incorrect pattern also affects the weekly section in `formatMiniMaxUsageText`, and both sections in `renderMiniMaxDetail` and `getMiniMaxAccessory`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/agent-usage/CHANGELOG.md
Line: 3

Comment:
**Hardcoded date instead of `{PR_MERGE_DATE}` placeholder**

New changelog entries for open PRs must use the `{PR_MERGE_DATE}` template variable so the merge date is filled in automatically at release time.

```suggestion
## [Add MiniMax Provider] - {PR_MERGE_DATE}
```

**Rule Used:** What: Changelog entries must use `{PR_MERGE_DATE}`... ([source](https://app.greptile.com/review/custom-context?memory=c2214c11-df56-490a-b1c0-09a385df481a))

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/agent-usage/src/agent-usage-menubar.tsx
Line: 243

Comment:
**Redundant `minimaxState` in `visibleAgents` deps**

`minimaxState` is already captured inside `singleAgents`, which is itself a dep of this memo. Adding the raw `minimaxState` object here means `visibleAgents` re-runs every time any property of `minimaxState` changes — even changes already handled by `singleAgents` updating. The previous agents (antigravity, zai, etc.) are not listed individually here; `minimaxState` should be removed for consistency and to avoid unnecessary re-renders.

```suggestion
    [singleAgents, codexAgents, kimiAgents, syntheticAgents, zaiAgents],
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Add MiniMax provider support" | Re-trigger Greptile

Comment thread extensions/agent-usage/src/minimax/renderer.tsx
Comment thread extensions/agent-usage/CHANGELOG.md Outdated
Comment thread extensions/agent-usage/src/agent-usage-menubar.tsx Outdated
GarrickZ2 and others added 4 commits April 12, 2026 15:01
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- Replace MiniMax placeholder icon with branded SVG
- Pull contributions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension: agent-usage Issues related to the agent-usage extension extension fix / improvement Label for PRs with extension's fix improvements platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants