Skip to content

[global] ai-usage: adds the Shima AI usage dashboard - #757

Closed
methos28 wants to merge 6 commits into
Ryoku-dev:unstable-devfrom
methos28:ai-usage
Closed

methos28 wants to merge 6 commits into
Ryoku-dev:unstable-devfrom
methos28:ai-usage

Conversation

@methos28

@methos28 methos28 commented Nov 7, 2026 •

Copy link
Copy Markdown

What changed

Add a built-in AI usage dashboard to Shima for OpenCode and Codex.

After updating, AI Usage appears directly in Shima Settings / Island / Desktop page / Your modules. Users enable it there without a separate installation. Existing selections are preserved, and installed custom copies take precedence.

  • Show sessions, token history, model breakdowns, fixed 7/30/45-day trends and a 63-day activity grid.
  • Extend the existing collectors while preserving cache fields used by other shell widgets. Support current and older OpenCode stores, and deduplicate copied, moved, truncated and replayed Codex rollouts.
  • Display reported ChatGPT quota windows and reset times through Codex's local app-server. API-key and Bedrock accounts do not reuse previous ChatGPT quotas.
  • Show Codex Est. Spending using public model prices saved per day in private monthly ledgers. Missing historical prices remain unpriced, and partial or stale coverage is disclosed. This is an API-equivalent estimate, not a bill or wallet balance. Pricing downloads do not use login credentials. OpenCode retains its recorded local costs.
  • Bound RPC reads, clean up child processes and write private caches atomically. Preserve the desktop-widget registry, existing widget content, example-install API, packaged collector lookup and environment override.

Only OpenCode and Codex are selectable. Claude remains withheld pending collector validation with real usage data.

Area

global: Shima widget, usage collectors, shared module discovery/loading, tests and CI.

How it was tested

Deployed the standalone module and Codex collector on a live Ryoku desktop. Checked dashboard alignment, sessions, estimated spending and an authenticated Plus quota refresh. The full Ryoku checkout was not redeployed.

All 46 automated tests passed on the submitted fork tree:

  • python3 tests/codex-usage-regression.py: 31 tests.
  • python3 tests/ai-usage-widget.py: 7 tests.
  • python3 tests/custom-widget-install.py: 8 tests.

Coverage includes fresh-profile settings availability, packaged load paths, custom-copy precedence, duplicate prevention and reactive module discovery in an isolated Quickshell runtime.

OpenCode/Codex shell fixtures, the isolated cache contract, QML compilation/lint/binding gates, delivery verification, WM isolation and normal commit/push hooks also passed.

Pricing tests use isolated state without live downloads. API-key/Bedrock switch tests use fake credentials; those modes were not tested with real accounts. Upstream CI still needs confirmation.

Checklist

  • One logical feature, with clear [global] ai-usage: ... commit subjects.
  • Root CHANGELOG.md updated under Unreleased / Added.
  • Git hooks pass locally; --no-verify was not used.
  • Shell syntax and project QML lint/binding gates pass. No Lua changes.
  • No duplicated configuration, dead code or commented-out code.
  • Repository documentation updated for the new behavior and layout.

Ships the widget, both collectors, the shipped-widget loader seam,
tests and CI for the Shima AI usage module. Only OpenCode and Codex
appear in the agent menus; a third agent stays out until its
collector publishes the same history.

Note: New: AI usage module on the Shima Island
Replace the duplicated agent and period menus with one AiUsageMenu
component and drop three unused period properties. Skip Codex rollout
lines that cannot affect history, and hoist the clock out of the
session loop.
Stack the caption beside the metric and give the row an explicit
width, so the text stays inside the card and the card keeps its
original height.
Track Codex API-equivalent spending with private monthly ledgers and saved
daily prices. Mark missing history and stale rates while preserving the
compact layout and other agents' recorded costs.

Bound stdio RPC reads, clean up failed child processes and publish private
caches atomically. Prevent API-key and Bedrock accounts from displaying
previous subscription quotas.

Restore the shared example-install entry point, preserve existing widget
content and stage installs before publishing them. Keep the packaged
collector lookup and environment override intact.

Validate with 43 collector, widget and shared compatibility tests, both
collector fixtures, the cache contract, QML, delivery and WM isolation.

Note: New: Codex shows estimated monthly spending from saved daily prices
Note: Fixed: AI usage preserves compact layouts and existing widgets
Document the AI usage widget under Unreleased / Added, including OpenCode
recorded costs and the meaning and coverage of Codex estimated spending.
Offer packaged AI Usage under Your modules without a manual widget
installation. Keep activation optional and prefer installed user copies.

Use one module catalog for settings and the Island loader while preserving
the desktop widget registry and manual install behavior.

Cover fresh profiles, user-copy precedence, packaged load paths and reactive
QML typed lists. All 46 focused tests and the delivery gates pass.

Note: Fixed: AI usage appears in Island settings after an update
@methos28
methos28 changed the base branch from main to unstable-dev November 7, 2026 18:38
@methos28
methos28 marked this pull request as ready for review November 7, 2026 18:40
@methos28 methos28 closed this Nov 8, 2026
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