Repository navigation
Show live model usage in an Analytics surface from the rail - #219
Merged
Merged
Conversation
Each turn that calls a model, Auto or not, now adds one row to app/usage.jsonl: tool, model, thread, project, account, and the turn's input, cache reads and writes (summed over every call by UsageMeter) and output. Prompts, files and replies are never recorded; costs stay null. A ledger failure is logged and never changes the turn. The rail's new Analytics icon opens the existing usage dashboard on those rows. The dashboard keeps its own global styles, so it runs as a separate document in a WorkspaceBrowser view served from modex-analytics://app/ in an in-memory session, with the rows at usage.json and every other request refused. Its Demo Data wording now appears only in the standalone preview. Settings > General can hide the icon; the Store app leaves Analytics out. Coven-Harness: Claude Code / claude-opus-5-5
# Conflicts: # apps/desktop/src/renderer/App.tsx # apps/desktop/src/shared/types.ts # docs/status.md
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| handle("claude:login", () => claudeLogin.run(resolveCli("claude", sessionCliSettings.claude_bin))); | ||
| handle("claude:cancelLogin", () => claudeLogin.cancel()); | ||
| handle("usage:list", (req) => usageLedger.list(req ?? {}), { localOnly: true }); | ||
| handle("analytics:show", ({ bounds }) => workspaceAnalytics?.show(bounds) ?? null, { localOnly: true }); |
Settings opens on Auto routing, so the rail option was never on screen. Coven-Harness: Claude Code / claude-opus-5-5
Settings: keep both new checkboxes, the Fable-to-Opus fallback from #210 and Show Analytics in the rail. Coven-Harness: Claude Code / claude-opus-5-5
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an Analytics icon to the rail. It opens the usage dashboard from #135 as a third surface beside Chat and Space, showing live usage recorded on this Mac instead of fixture data.
What's recorded
app/usage.jsonl(mode 0600):claude-codeorcodex), the model, the thread, the project and the Codex account binding;UsageMeternow sums input and both cache counts over every call (TurnUsage.totals). Its existing fields are unchanged, and Auto routing reads them as before.How it's shown
:root,*,button, plus.sidebarand.main), and so is the app's. So the dashboard runs as its own document in aWorkspaceBrowserview, the pattern Knowledge and Canvas already use.dist/usage-preview, now packaged) onmodex-analytics://app/in an in-memory session, with the rows atusage.json:window.modexandrequireare undefined).demoprop, default true), soe2e/usage.spec.tskeeps its fixture behavior.Layoutand applies right away. The Store app leaves Analytics out.Verification
pnpm build,pnpm typecheckand the full unit suite pass. The three failures in a run at load average around 75 (two Knowledge tests, one terminal-cleanup test) pass when rerun alone.test/analytics.test.ts:e2e/analytics.spec.ts: on a seeded row, it opens Analytics from the rail and reads the dashboard's own document. It checks for the live banner, no Demo stamp and no bridge, then hides the icon from Settings, which returns to Chat.showevent. The display is asleep, so the window server never reports the window visible; existing specs fail the same way, and Record native window show before E2E observers connect #213's harness change doesn't help. CI's macOS run is the check for this spec.Docs:
docs/usage-preview.md→docs/analytics.md(what is recorded, how it's shown, the standalone preview) and adocs/status.mdentry.