Add pi coding-agent local session usage/cost analytics provider - #10
Merged
Merged
Conversation
Adds `pi` as an Analytics-coverage provider (no quota API — mirrors the claude/9router local-telemetry tier): - providers/get-pi-analytics: scans ~/.pi/agent/sessions/**/*.jsonl, aggregates today/week/month cost+tokens, 7-day trailing chart, top models, top projects. TTL-cached (120s) to avoid rescanning on every poll. - providers/get-provider-usage: fetch_pi_native() envelope, reads only the cached snapshot (never triggers a full scan itself, keeping the shared 45s dispatcher timeout safe). - providers/get-provider-health: readiness check (pi CLI or ~/.pi/agent/sessions present). Ref: FEATURE-81e2e9ff (local feature ticket, no Jira)
Wires `pi` into every place the widget/settings key off provider id strings, so it's a real, selectable provider card (not just a working backend script): - AiOverviewControlWidget.qml: availableProviderOptions, providerName, providerAccent, dashboard URL map, piAnalyticsScript property (mirrors nineRouterAnalyticsScript for Phase 3). - AiOverviewControlSettings.qml: added to the separate `allProviders` catalog that drives the provider manager UI (discovered this is a second, independent list from the widget's) + diagnostic quick-actions. - ProviderLogo.qml: fallback Material icon (smart_toy) since there's no provider-logos/pi.svg asset yet. Ref: FEATURE-81e2e9ff
Clones the 9Router extension-point pattern (Process + buffer property + conditional card block keyed by provider id) for pi's expanded view: - piStatsProcess runs providers/get-pi-analytics on the normal refresh cycle, alongside the 9router one. - Card block: metric tiles (today/week/month cost+tokens), 7-day trailing cost bar chart with hover detail, top-models table (UsageBar, cost share of week), and a top-projects table styled after Claude's existing project rows (path + token bar) — new since 9Router has no cwd/project dimension. Ref: FEATURE-81e2e9ff
- architecture.md: components list, "pi protocol" section (mirrors the Antigravity/Codex protocol write-ups), pi in the validation command example. - providers.md: pi row in the coverage matrix (Analytics, local JSONL session logs, no quota API) and in the coverage-levels legend. - README.md: provider count badge/highlight (34 → 35), pi row in "Notable integrations", pi in the CI validation snippet, architecture component list. - CHANGELOG.md: Unreleased entry. - i18n: added card.pi_details/pi_models_week/pi_month_total/pi_today to all 5 locales (parity verified: 0 drift). Ref: FEATURE-81e2e9ff
bernardopg
added a commit
that referenced
this pull request
Aug 6, 2026
Finalize the 1.9.0 changelog (pi provider + Codex reliability), credit contributors, and bump the version in plugin.json and the settings hero pill. get-codex-usage reads plugin.json dynamically. Contributions in this release: - pi coding-agent local analytics provider — Geert Theys (#10) - Codex app-server handshake stabilization — Xianggang Wang (#12, fixes #11)
Owner
|
Thank you, @gtheys! 🎉 Your pi provider has been merged and shipped in v1.9.0. It's a clean, well-scoped addition — the local-JSONL analytics approach mirrors the existing 9Router telemetry pattern nicely, and the TTL-cached envelope keeps the collapsed card cheap while the expanded "pi telemetry" card gives the full today/week/month cost + token breakdown, 7-day chart, top models, and top projects. Follow-ups I added on top of your commits while landing the release:
Your original commits are preserved with full authorship. Really appreciate the contribution — thanks for making the plugin better! 🙏 |
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.
createdAt: 2026-08-05T16:55:00Z
ticket: FEATURE-81e2e9ff
branch: feature/pi-provider-analytics
base: main
Description
Loved the claude code local statistics. As I use Pi agent I build one for that tool too. Tried to follow all standards + translations and documentation.
Summary
pi(the pi coding-agent CLI) as a new Analytics-coverage provider, reading local session telemetry from~/.pi/agent/sessions/**/*.jsonl— cost/tokens, no quota API (pi has no rate limits).fetch_pi_nativeinget-provider-usage) plus a standaloneproviders/get-pi-analyticsscript for the expanded "pi telemetry" card (today/week/month, 7-day chart, top models, top projects). TTL-cached (120s) so the session scan runs at most once per refresh window regardless of poll frequency.pieverywhere provider ids are keyed: widget'savailableProviderOptions/name/accent/dashboard maps, Settings' separateallProviderscatalog,ProviderLogofallback icon, andget-provider-health.Dependencies
Type of change
Screenshots (if any)
Collapsed and expanded pi card, verified against real session data:
pi · pi-local · Today · $6.38 · 20.3M tokNote on tests: no JS/unit test harness exists for provider scripts in this repo (bash
-n+shellcheck+qmllintare the established automated bar, all run clean).shellcheckwas unavailable in the dev environment this was built in — CI runs it.