usage-cli 0.34.5__tar.gz → 0.34.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {usage_cli-0.34.5/usage_cli.egg-info → usage_cli-0.34.7}/PKG-INFO +20 -21
- {usage_cli-0.34.5 → usage_cli-0.34.7}/README.md +19 -20
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/dispatch_ledger.py +113 -27
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/reporter.py +30 -14
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/usage_snapshot.py +6 -3
- {usage_cli-0.34.5 → usage_cli-0.34.7}/i18n.json +55 -75
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/agy_loader.py +0 -5
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/agy_quota_probe.py +19 -1
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/muse_quota_probe.py +19 -9
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/agy.py +13 -2
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/payload.py +3 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/web_panel.py +1 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/pyproject.toml +1 -1
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_agy_loader.py +0 -21
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_agy_quota_probe.py +33 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_dispatch_ledger.py +244 -80
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_history_persist.py +73 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar_agy.py +13 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_muse_quota_probe.py +29 -3
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_panel_footer_layout.py +11 -2
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_report_cold_read.py +10 -19
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_web_panel_payload.py +52 -1
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_wintray.py +30 -1
- usage_cli-0.34.7/ui/report_ledger.py +102 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/report_styles.py +4 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7/usage_cli.egg-info}/PKG-INFO +20 -21
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/app.py +2 -0
- usage_cli-0.34.5/ui/report_ledger.py +0 -88
- {usage_cli-0.34.5 → usage_cli-0.34.7}/LICENSE +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/THIRD_PARTY_NOTICES.md +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/agy.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/claude.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/codex.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/grok.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/muse.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/rate_limits.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/registry.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/adapters/types.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/aggregator.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/blocks.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/diagnoser.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/diagnosis_snapshot.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/history_persist.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/insights.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/ledger_backfill.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/persona_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/analyzer/subscription.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/installer/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/installer/claude_pane.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/installer/codex_hook_trust.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/installer/login_item.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/installer/session_hooks.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/installer/setup_hook.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/installer/statusline_settings.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/_shared_cache_file.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/agy_disk_cache.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/cache_quarantine.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/chromium_cache.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/claude_desktop.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/claude_paths.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/claude_usage.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/codex_disk_cache.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/codex_events.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/codex_fork_replay.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/codex_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/codex_paths.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/disk_cache_common.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/disk_cache_lifecycle.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/grok_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/grok_quota_probe.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/history_disk_cache.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/history_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/jsonl_limits.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/jsonl_utils.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/loaders/muse_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/main.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/actions.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/app.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/chrome.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/fsevents_watch.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/grok.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/manual_refresh.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/menu.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/muse.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/new_badge.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/notify.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/popover.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/prefs.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/refresh.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/state.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/title.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/update.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/menubar/whats_new.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/base.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/catalog.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/dynamic_height.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/panel_scale.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/panel_window.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/panel_window_state.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/panels/window_drag.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/agy_window_keeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/burn_rate.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/codex_window_keeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/keeper_outcome.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/notifications.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/quota_snapshot.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/status_payload.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/usage_rate.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/quota/window_keeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/setup.cfg +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/setup_app.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_adapters_claude.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_adapters_codex.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_adapters_rate_limits.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_aggregator.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_agy_adapter.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_agy_disk_cache.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_agy_window_keeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_analyzer_blocks.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_analyzer_pipeline.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_app_version.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_burn_rate.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_cache_quarantine.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_check_upstream.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_chromium_cache.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_claude_desktop.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_claude_pane.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_claude_paths.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_codex_consistency.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_codex_hook_trust.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_codex_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_codex_window_keeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_compact_cards.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_desktop_fresh_cache.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_desktop_quota_display.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_desktop_quota_review.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_diagnoser.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_disk_cache_shards.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_doctor.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_dynamic_height.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_fsevents_watch.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_grok_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_grok_quota_probe.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_history_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_hook_scripts_are_standalone.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_html_report_snapshot.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_i18n_format_fallback.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_i18n_key_parity.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_i18n_packaged_path.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_insights.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_jsonl_utils.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_keeper_menu.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_keeper_outcome.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_ledger_backfill.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_login_item.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_main.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_manual_refresh.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar_grok.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar_muse.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar_notify.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar_prefs.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar_state.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_menubar_update.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_muse_coverage.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_muse_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_muse_review_regressions.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_new_badge.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_packaged_resources.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_packaging.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_panel_scale.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_panel_window_state.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_panels.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_panels_lazy_import.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_persona_loader.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_pricing.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_project_resolver.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_quota_aware.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_quota_label.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_report_daily_chart.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_report_filter_js.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_report_share_mask.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_reporter_build_data.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_service_status.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_session_resume.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_setup_app.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_setup_hook.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_setup_hook_coexistence.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_setup_hook_resume.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_setup_hook_terse.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_subprocess_utils.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_subscription.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_taskbar_menu.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_taskbar_obstacles.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_time_utils.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_tui.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_tui_sprite.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_ui_tables.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_update_checker.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_update_gate.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_update_release_notes.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_cli.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_client.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_diagnosis_snapshot.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_dir_sweeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_lang.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_logging.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_notifications.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_rate.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_snapshot.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_snapshot_replay.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_statusline.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_statusline_agy.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_statusline_forwarder.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_statusline_grok.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_terse_mode.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_usage_terse_reminder.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_whats_new.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_wheel_packaging.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_win_login_item.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_window_keeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tests/test_windows_manifest.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tui/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tui/app.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/tui/sprite.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/html_report.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/report_charts.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/report_daily_chart.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/report_filter.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/report_scripts.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/ui/tables.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/updates/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/updates/checker.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/updates/gate.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/updates/release_notes.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/updates/whats_new.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_app/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_app/cli.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_app/doctor.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_cli.egg-info/SOURCES.txt +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_cli.egg-info/dependency_links.txt +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_cli.egg-info/entry_points.txt +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_cli.egg-info/requires.txt +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_cli.egg-info/top_level.txt +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/app_version.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/i18n.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/prefs.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/pricing.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/project_resolver.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/service_status.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/subprocess_utils.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/time_utils.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/usage_dir_sweeper.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/usage_lang.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_common/usage_logging.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_quota_aware.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_session_resume.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_statusline.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_statusline_agy.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_statusline_forwarder.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_statusline_grok.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_terse_mode.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/usage_hooks/usage_terse_reminder.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/__init__.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/login_item.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/menu.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/prefs.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/quota_label.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/taskbar_menu.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/taskbar_obstacles.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/taskbar_overlay.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/watch.py +0 -0
- {usage_cli-0.34.5 → usage_cli-0.34.7}/wintray/whats_new.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: usage-cli
|
|
3
|
-
Version: 0.34.
|
|
3
|
+
Version: 0.34.7
|
|
4
4
|
Summary: usage — 在 macOS menu bar 與 Windows 系統匣顯示 Claude Code、Codex、Antigravity 用量的小工具(也提供終端機 TUI)
|
|
5
5
|
License-Expression: AGPL-3.0-only
|
|
6
6
|
Requires-Python: >=3.13
|
|
@@ -28,7 +28,7 @@ Dynamic: license-file
|
|
|
28
28
|
|
|
29
29
|
### Your Claude Code, Codex, Antigravity, Grok CLI, and Muse Code quota, always on screen.
|
|
30
30
|
|
|
31
|
-
`usage` puts your 5-hour and weekly limits in the macOS menu bar or Windows system tray,
|
|
31
|
+
`usage` puts your 5-hour and weekly limits in the macOS menu bar or Windows system tray, and turns a quota red as it nears its limit. Hitting the limit halfway through a long refactor is a bad way to find out you were running low. Now you see it coming. There's nothing to run and no page to open.
|
|
32
32
|
|
|
33
33
|
[繁體中文](docs/README.zh-TW.md) · [简体中文](docs/README.zh-CN.md) · English · [日本語](docs/README.ja.md) · [한국어](docs/README.ko.md) | [Discussions](https://github.com/aqua5230/usage/discussions) | [Landing page](https://aqua5230.github.io/usage/)
|
|
34
34
|
|
|
@@ -48,7 +48,7 @@ Dynamic: license-file
|
|
|
48
48
|
</p>
|
|
49
49
|
|
|
50
50
|
- **Every quota at a glance:** Claude Code, Codex, Antigravity, and Muse Code session and weekly limits with reset countdowns, plus Grok CLI's weekly credit.
|
|
51
|
-
- **Reads what's already on your machine:** Claude Code, Codex, Grok CLI, and Muse Code tokens and cost come from local logs. Antigravity quota comes from Google's official endpoint
|
|
51
|
+
- **Reads what's already on your machine:** Claude Code, Codex, Grok CLI, and Muse Code tokens and cost come from local logs. Antigravity quota comes from its own CLI (no model call), or from Google's official endpoint using the sign-in that CLI already stores. Muse quota comes from a small background model call through its own signed-in CLI.
|
|
52
52
|
- **Warns before tokens go to waste:** The Claude Code status line flags a bloating context window and a cold prompt cache. A banner shows Claude or Codex outages.
|
|
53
53
|
- **Helpers inside Claude Code:** A side pane, shorter replies, a progress hand-off for new sessions, and quota-aware planning. All optional.
|
|
54
54
|
- **Reports and 16 themes:** HTML reports of token trends and cost, and 16 panel themes to pick from.
|
|
@@ -95,7 +95,7 @@ Then click the menu bar or tray icon.
|
|
|
95
95
|
If you've used Codex, `usage` picks up its history automatically. For Claude Code, click the **"Set Up Status Line"** button in the app popover to install the sync hook.
|
|
96
96
|
Restart the relevant tool afterward (on macOS, fully Cmd+Q Claude Code and re-open it; on Windows, restart your terminal or start a new session).
|
|
97
97
|
|
|
98
|
-
The same button also sets up a status line for the Antigravity CLI and for Grok CLI when they are installed on your machine, and does nothing at all when they aren't. Any status line you configured there yourself is backed up first and restored when you turn the switch off.
|
|
98
|
+
The same button also sets up a status line for the Antigravity CLI and for Grok CLI when they are installed on your machine, and does nothing at all when they aren't. Any status line you configured there yourself is backed up first and restored when you turn the switch off. The switch is **⚙ Settings → Claude Code → Sync quota via status line**; with it off, the Claude quota stops updating.
|
|
99
99
|
|
|
100
100
|
Once set up, the bottom of the Claude Code window will show a status line like this:
|
|
101
101
|
|
|
@@ -107,8 +107,8 @@ Once set up, the bottom of the Claude Code window will show a status line like t
|
|
|
107
107
|
|
|
108
108
|
### On Screen
|
|
109
109
|
|
|
110
|
-
- **Menu bar monitor:**
|
|
111
|
-
- **Antigravity card:** Shows the Gemini pool by default. Tap the `Gemini ⇄` tag to
|
|
110
|
+
- **Menu bar monitor:** A quota turns red as it nears its limit. Click for the full session, weekly, and per-project breakdown. On macOS, the menu bar keeps at most three tools with the highest Session usage, in Claude → Codex → Antigravity → Grok → Muse order; the panel still shows all tools.
|
|
111
|
+
- **Antigravity card:** Shows the Gemini pool by default. Tap the `Gemini ⇄` tag to cycle through the separate Claude / GPT and Gemini 4 Argon pools; the choice is remembered. Argon has a weekly limit only.
|
|
112
112
|
- **Grok CLI card:** The weekly credit percentage from Grok CLI's local debug log. Its tokens also count toward cost and project totals.
|
|
113
113
|
- **Muse Code card:** Shows 5-hour (Session) and weekly quota with reset countdowns. Available in all 15 quota themes, with a menu bar item and optional low, exhausted, and recovered quota notifications. Hidden automatically when Muse is not installed. Tokens and cost still count toward today's cost, project totals, reports, and the CLI.
|
|
114
114
|
- **Outage alerts:** An orange-red banner when Claude Code, Claude API, or Codex API is down or degraded, read from their public status pages.
|
|
@@ -129,10 +129,10 @@ Once set up, the bottom of the Claude Code window will show a status line like t
|
|
|
129
129
|
|
|
130
130
|
### Reports and More
|
|
131
131
|
|
|
132
|
-
- **HTML reports:** Daily and weekly token trends, project rankings, cost, and a Year in Review with a contribution heatmap. Export .html, .csv, or .png fully offline, with optional project-name masking.
|
|
132
|
+
- **HTML reports:** Daily and weekly token trends, project rankings, cost, and a Year in Review with a contribution heatmap. Export .html, .csv, or .png fully offline, with optional project-name masking. If you hand work from Claude Code to Codex or Antigravity, the report shows which conversations used how much of each weekly quota.
|
|
133
133
|
- **Terminal integration:** `usage status --json` hands your Claude Code, Codex, Antigravity, Grok, and Muse quota to Starship, tmux, or your own scripts. [Ready-made snippets](docs/DEVELOPMENT.md#quota-status-for-other-tools-usage-status).
|
|
134
|
-
- **AI Update Daily:** A daily public [page](https://aqua5230.github.io/ai-updates/) of Claude Code, Codex, and
|
|
135
|
-
- **Your layout:** Drag the panel anywhere, drag quota cards to reorder them, and switch among 16 themes
|
|
134
|
+
- **AI Update Daily:** A daily public [page](https://aqua5230.github.io/ai-updates/) of changes to Claude Code, Codex, Antigravity, Grok Build, Muse Code, GitHub CLI, and usage itself, with plain-language summaries in five languages.
|
|
135
|
+
- **Your layout:** Drag the panel anywhere, drag quota cards to reorder them, and switch among 16 themes from **⚙ Settings → Switch Panel**. The UI follows your system language: Traditional Chinese, Simplified Chinese, English, Japanese, or Korean. With four or more quota cards visible, all cards switch to a compact layout; three or fewer keep the usual layout.
|
|
136
136
|
|
|
137
137
|
<details>
|
|
138
138
|
<summary>Thresholds, versions, and fine print</summary>
|
|
@@ -147,7 +147,7 @@ Once set up, the bottom of the Claude Code window will show a status line like t
|
|
|
147
147
|
- **Progress Concierge:** When you `/resume` a conversation that sat long enough for its cache to expire, it warns how many tokens the next message will re-send and suggests `/compact` first.
|
|
148
148
|
- **Beginner Mode (macOS and Windows):** Terms appear above the prompt in your UI language. Press 9 to mark them understood; skipped terms come back after 1, 3, then 7 days. Understood terms return as a one-question multiple-choice quiz 7, 21, then 60 days later, at most one a day, and a wrong answer puts the term back in the hints. `/terms` opens your term history. Picking terms asks Claude Haiku through your Claude Code, and pauses while your 5-hour quota is at 90% or more.
|
|
149
149
|
- **Quota-Aware Mode (macOS and Windows):** Claude Code gets one line with what is left and when it resets when a 5-hour quota passes 80%, 90%, or 95%, or a weekly quota passes 95%. It covers Claude Code, Codex, Antigravity, and Muse, says each level once per conversation, and treats each quota and model group separately, so a used-up one only matters for work that runs on it.
|
|
150
|
-
- **Auto-start 5-hour session:** Claude gets Haiku, Antigravity gets Gemini 3.8 Flash Low, and Codex gets its cheapest model. The quota used is negligible.
|
|
150
|
+
- **Auto-start 5-hour session:** Claude gets Haiku, Antigravity gets Gemini 3.8 Flash Low, and Codex gets its cheapest model. The quota used is negligible. The Claude and Codex pings skip your own hooks and stay out of `claude --resume` and `codex resume`.
|
|
151
151
|
- **Panel:** It stays put when another app takes focus; a second click on the menu bar icon, or Escape, closes it. Card order is shared across every theme with quota cards (all except World Cup 2026) and survives restarts.
|
|
152
152
|
- **HTML reports:** A "What you worked on" section lists the names Claude Code gave your recent conversations, and masking covers those titles too.
|
|
153
153
|
- **AI Update Daily:** Unreviewed items show the original source text. The full history is kept.
|
|
@@ -218,19 +218,18 @@ Switch between **16 visual themes** directly from the UI:
|
|
|
218
218
|
|
|
219
219
|
## Comparison
|
|
220
220
|
|
|
221
|
+
As of October 2026. ccusage and TokenTracker read many more AI tools; `usage` focuses on five and their quotas.
|
|
222
|
+
|
|
221
223
|
| Feature | usage | ccusage | TokenTracker |
|
|
222
224
|
|---------|:-----:|:-------:|:------------:|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
| Claude Code & Codex service-status alerts | ✅ | — | — |
|
|
230
|
-
| HTML deep reports & UI | ✅ | ✅ | — |
|
|
231
|
-
| Claude Code helpers (Token Saver, Progress Concierge, Beginner and Quota-Aware modes, health check) | ✅ | — | — |
|
|
225
|
+
| Menu bar or system tray app | macOS, Windows | — | macOS, Windows, Linux |
|
|
226
|
+
| Token and cost reports | ✅ | ✅ | ✅ |
|
|
227
|
+
| Live 5-hour and weekly quota | ✅ | Estimated Claude 5-hour blocks only | ✅ |
|
|
228
|
+
| Muse Code quota | ✅ | — | — |
|
|
229
|
+
| Service status from official status pages | Claude, Codex | — | 8 providers |
|
|
230
|
+
| Claude Code helpers (Token Saver, Progress Concierge, Beginner and Quota-Aware modes, side pane, health check) | ✅ | — | — |
|
|
232
231
|
| AI Update Daily | ✅ | — | — |
|
|
233
|
-
| Open-source license | AGPL-3.0 | MIT |
|
|
232
|
+
| Open-source license | AGPL-3.0 | MIT | MIT |
|
|
234
233
|
|
|
235
234
|
## When usage Isn't the Right Fit
|
|
236
235
|
|
|
@@ -271,7 +270,7 @@ If the menu bar shows `--`, it's usually not broken — there's just no local da
|
|
|
271
270
|
|
|
272
271
|
- **Local logs:** Claude Code, Codex, Grok CLI, and Muse Code token and cost numbers are read from log files on your machine. Their contents are never uploaded.
|
|
273
272
|
- **Claude Desktop:** Without the Claude Code CLI or a status line, keep Claude Desktop open and `usage` reads its local plan-usage history. No cookies, login tokens, or API calls are needed. Reset times appear only when its local cache confirms them; they are never estimated.
|
|
274
|
-
- **Antigravity**, only if you use it, needs network access: quota is fetched from Google's official quota endpoint with the OAuth credential the Antigravity CLI already stored after sign-in — read from macOS Keychain, Windows Credential Manager, or a local token file depending on CLI version. `usage` never writes that credential back and keeps any refreshed access token in memory only; the call itself reads quota metadata.
|
|
273
|
+
- **Antigravity**, only if you use it, needs network access: quota comes first from `agy -p /usage`, which makes no model call; if that fails, it is fetched from Google's official quota endpoint with the OAuth credential the Antigravity CLI already stored after sign-in — read from macOS Keychain, Windows Credential Manager, or a local token file depending on CLI version. `usage` never writes that credential back and keeps any refreshed access token in memory only; the call itself reads quota metadata.
|
|
275
274
|
- **Muse quota:** Muse stores no quota file locally. `usage` runs `muse exec --json` through Muse's own sign-in and saves the returned quota to `~/.usage/muse_quota.json`. This connects to Muse and makes a real model call, using a little Muse quota. It runs in an empty folder with `--no-session-log`. With Muse installed and a conversation available, it fetches the first snapshot; later probes require a snapshot over 30 minutes old and a newer Muse conversation. After failure, it waits at least 30 minutes and requires new Muse usage before retrying. Hide its card under **Hide sections**.
|
|
276
275
|
- **Other background network activity:** Public Claude and Codex status pages to flag outages, a public model-pricing table to estimate cost (built-in prices are used offline), and an occasional GitHub check for a new version.
|
|
277
276
|
- **Beginner Mode**, only if you turn it on, sends Claude Code's latest answer to Claude Haiku through your own Claude Code sign-in to pick terms. Your term list stays in `~/.usage/glossary.json`.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
### Your Claude Code, Codex, Antigravity, Grok CLI, and Muse Code quota, always on screen.
|
|
8
8
|
|
|
9
|
-
`usage` puts your 5-hour and weekly limits in the macOS menu bar or Windows system tray,
|
|
9
|
+
`usage` puts your 5-hour and weekly limits in the macOS menu bar or Windows system tray, and turns a quota red as it nears its limit. Hitting the limit halfway through a long refactor is a bad way to find out you were running low. Now you see it coming. There's nothing to run and no page to open.
|
|
10
10
|
|
|
11
11
|
[繁體中文](docs/README.zh-TW.md) · [简体中文](docs/README.zh-CN.md) · English · [日本語](docs/README.ja.md) · [한국어](docs/README.ko.md) | [Discussions](https://github.com/aqua5230/usage/discussions) | [Landing page](https://aqua5230.github.io/usage/)
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
28
|
- **Every quota at a glance:** Claude Code, Codex, Antigravity, and Muse Code session and weekly limits with reset countdowns, plus Grok CLI's weekly credit.
|
|
29
|
-
- **Reads what's already on your machine:** Claude Code, Codex, Grok CLI, and Muse Code tokens and cost come from local logs. Antigravity quota comes from Google's official endpoint
|
|
29
|
+
- **Reads what's already on your machine:** Claude Code, Codex, Grok CLI, and Muse Code tokens and cost come from local logs. Antigravity quota comes from its own CLI (no model call), or from Google's official endpoint using the sign-in that CLI already stores. Muse quota comes from a small background model call through its own signed-in CLI.
|
|
30
30
|
- **Warns before tokens go to waste:** The Claude Code status line flags a bloating context window and a cold prompt cache. A banner shows Claude or Codex outages.
|
|
31
31
|
- **Helpers inside Claude Code:** A side pane, shorter replies, a progress hand-off for new sessions, and quota-aware planning. All optional.
|
|
32
32
|
- **Reports and 16 themes:** HTML reports of token trends and cost, and 16 panel themes to pick from.
|
|
@@ -73,7 +73,7 @@ Then click the menu bar or tray icon.
|
|
|
73
73
|
If you've used Codex, `usage` picks up its history automatically. For Claude Code, click the **"Set Up Status Line"** button in the app popover to install the sync hook.
|
|
74
74
|
Restart the relevant tool afterward (on macOS, fully Cmd+Q Claude Code and re-open it; on Windows, restart your terminal or start a new session).
|
|
75
75
|
|
|
76
|
-
The same button also sets up a status line for the Antigravity CLI and for Grok CLI when they are installed on your machine, and does nothing at all when they aren't. Any status line you configured there yourself is backed up first and restored when you turn the switch off.
|
|
76
|
+
The same button also sets up a status line for the Antigravity CLI and for Grok CLI when they are installed on your machine, and does nothing at all when they aren't. Any status line you configured there yourself is backed up first and restored when you turn the switch off. The switch is **⚙ Settings → Claude Code → Sync quota via status line**; with it off, the Claude quota stops updating.
|
|
77
77
|
|
|
78
78
|
Once set up, the bottom of the Claude Code window will show a status line like this:
|
|
79
79
|
|
|
@@ -85,8 +85,8 @@ Once set up, the bottom of the Claude Code window will show a status line like t
|
|
|
85
85
|
|
|
86
86
|
### On Screen
|
|
87
87
|
|
|
88
|
-
- **Menu bar monitor:**
|
|
89
|
-
- **Antigravity card:** Shows the Gemini pool by default. Tap the `Gemini ⇄` tag to
|
|
88
|
+
- **Menu bar monitor:** A quota turns red as it nears its limit. Click for the full session, weekly, and per-project breakdown. On macOS, the menu bar keeps at most three tools with the highest Session usage, in Claude → Codex → Antigravity → Grok → Muse order; the panel still shows all tools.
|
|
89
|
+
- **Antigravity card:** Shows the Gemini pool by default. Tap the `Gemini ⇄` tag to cycle through the separate Claude / GPT and Gemini 4 Argon pools; the choice is remembered. Argon has a weekly limit only.
|
|
90
90
|
- **Grok CLI card:** The weekly credit percentage from Grok CLI's local debug log. Its tokens also count toward cost and project totals.
|
|
91
91
|
- **Muse Code card:** Shows 5-hour (Session) and weekly quota with reset countdowns. Available in all 15 quota themes, with a menu bar item and optional low, exhausted, and recovered quota notifications. Hidden automatically when Muse is not installed. Tokens and cost still count toward today's cost, project totals, reports, and the CLI.
|
|
92
92
|
- **Outage alerts:** An orange-red banner when Claude Code, Claude API, or Codex API is down or degraded, read from their public status pages.
|
|
@@ -107,10 +107,10 @@ Once set up, the bottom of the Claude Code window will show a status line like t
|
|
|
107
107
|
|
|
108
108
|
### Reports and More
|
|
109
109
|
|
|
110
|
-
- **HTML reports:** Daily and weekly token trends, project rankings, cost, and a Year in Review with a contribution heatmap. Export .html, .csv, or .png fully offline, with optional project-name masking.
|
|
110
|
+
- **HTML reports:** Daily and weekly token trends, project rankings, cost, and a Year in Review with a contribution heatmap. Export .html, .csv, or .png fully offline, with optional project-name masking. If you hand work from Claude Code to Codex or Antigravity, the report shows which conversations used how much of each weekly quota.
|
|
111
111
|
- **Terminal integration:** `usage status --json` hands your Claude Code, Codex, Antigravity, Grok, and Muse quota to Starship, tmux, or your own scripts. [Ready-made snippets](docs/DEVELOPMENT.md#quota-status-for-other-tools-usage-status).
|
|
112
|
-
- **AI Update Daily:** A daily public [page](https://aqua5230.github.io/ai-updates/) of Claude Code, Codex, and
|
|
113
|
-
- **Your layout:** Drag the panel anywhere, drag quota cards to reorder them, and switch among 16 themes
|
|
112
|
+
- **AI Update Daily:** A daily public [page](https://aqua5230.github.io/ai-updates/) of changes to Claude Code, Codex, Antigravity, Grok Build, Muse Code, GitHub CLI, and usage itself, with plain-language summaries in five languages.
|
|
113
|
+
- **Your layout:** Drag the panel anywhere, drag quota cards to reorder them, and switch among 16 themes from **⚙ Settings → Switch Panel**. The UI follows your system language: Traditional Chinese, Simplified Chinese, English, Japanese, or Korean. With four or more quota cards visible, all cards switch to a compact layout; three or fewer keep the usual layout.
|
|
114
114
|
|
|
115
115
|
<details>
|
|
116
116
|
<summary>Thresholds, versions, and fine print</summary>
|
|
@@ -125,7 +125,7 @@ Once set up, the bottom of the Claude Code window will show a status line like t
|
|
|
125
125
|
- **Progress Concierge:** When you `/resume` a conversation that sat long enough for its cache to expire, it warns how many tokens the next message will re-send and suggests `/compact` first.
|
|
126
126
|
- **Beginner Mode (macOS and Windows):** Terms appear above the prompt in your UI language. Press 9 to mark them understood; skipped terms come back after 1, 3, then 7 days. Understood terms return as a one-question multiple-choice quiz 7, 21, then 60 days later, at most one a day, and a wrong answer puts the term back in the hints. `/terms` opens your term history. Picking terms asks Claude Haiku through your Claude Code, and pauses while your 5-hour quota is at 90% or more.
|
|
127
127
|
- **Quota-Aware Mode (macOS and Windows):** Claude Code gets one line with what is left and when it resets when a 5-hour quota passes 80%, 90%, or 95%, or a weekly quota passes 95%. It covers Claude Code, Codex, Antigravity, and Muse, says each level once per conversation, and treats each quota and model group separately, so a used-up one only matters for work that runs on it.
|
|
128
|
-
- **Auto-start 5-hour session:** Claude gets Haiku, Antigravity gets Gemini 3.8 Flash Low, and Codex gets its cheapest model. The quota used is negligible.
|
|
128
|
+
- **Auto-start 5-hour session:** Claude gets Haiku, Antigravity gets Gemini 3.8 Flash Low, and Codex gets its cheapest model. The quota used is negligible. The Claude and Codex pings skip your own hooks and stay out of `claude --resume` and `codex resume`.
|
|
129
129
|
- **Panel:** It stays put when another app takes focus; a second click on the menu bar icon, or Escape, closes it. Card order is shared across every theme with quota cards (all except World Cup 2026) and survives restarts.
|
|
130
130
|
- **HTML reports:** A "What you worked on" section lists the names Claude Code gave your recent conversations, and masking covers those titles too.
|
|
131
131
|
- **AI Update Daily:** Unreviewed items show the original source text. The full history is kept.
|
|
@@ -196,19 +196,18 @@ Switch between **16 visual themes** directly from the UI:
|
|
|
196
196
|
|
|
197
197
|
## Comparison
|
|
198
198
|
|
|
199
|
+
As of October 2026. ccusage and TokenTracker read many more AI tools; `usage` focuses on five and their quotas.
|
|
200
|
+
|
|
199
201
|
| Feature | usage | ccusage | TokenTracker |
|
|
200
202
|
|---------|:-----:|:-------:|:------------:|
|
|
201
|
-
|
|
|
202
|
-
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
| Claude Code & Codex service-status alerts | ✅ | — | — |
|
|
208
|
-
| HTML deep reports & UI | ✅ | ✅ | — |
|
|
209
|
-
| Claude Code helpers (Token Saver, Progress Concierge, Beginner and Quota-Aware modes, health check) | ✅ | — | — |
|
|
203
|
+
| Menu bar or system tray app | macOS, Windows | — | macOS, Windows, Linux |
|
|
204
|
+
| Token and cost reports | ✅ | ✅ | ✅ |
|
|
205
|
+
| Live 5-hour and weekly quota | ✅ | Estimated Claude 5-hour blocks only | ✅ |
|
|
206
|
+
| Muse Code quota | ✅ | — | — |
|
|
207
|
+
| Service status from official status pages | Claude, Codex | — | 8 providers |
|
|
208
|
+
| Claude Code helpers (Token Saver, Progress Concierge, Beginner and Quota-Aware modes, side pane, health check) | ✅ | — | — |
|
|
210
209
|
| AI Update Daily | ✅ | — | — |
|
|
211
|
-
| Open-source license | AGPL-3.0 | MIT |
|
|
210
|
+
| Open-source license | AGPL-3.0 | MIT | MIT |
|
|
212
211
|
|
|
213
212
|
## When usage Isn't the Right Fit
|
|
214
213
|
|
|
@@ -249,7 +248,7 @@ If the menu bar shows `--`, it's usually not broken — there's just no local da
|
|
|
249
248
|
|
|
250
249
|
- **Local logs:** Claude Code, Codex, Grok CLI, and Muse Code token and cost numbers are read from log files on your machine. Their contents are never uploaded.
|
|
251
250
|
- **Claude Desktop:** Without the Claude Code CLI or a status line, keep Claude Desktop open and `usage` reads its local plan-usage history. No cookies, login tokens, or API calls are needed. Reset times appear only when its local cache confirms them; they are never estimated.
|
|
252
|
-
- **Antigravity**, only if you use it, needs network access: quota is fetched from Google's official quota endpoint with the OAuth credential the Antigravity CLI already stored after sign-in — read from macOS Keychain, Windows Credential Manager, or a local token file depending on CLI version. `usage` never writes that credential back and keeps any refreshed access token in memory only; the call itself reads quota metadata.
|
|
251
|
+
- **Antigravity**, only if you use it, needs network access: quota comes first from `agy -p /usage`, which makes no model call; if that fails, it is fetched from Google's official quota endpoint with the OAuth credential the Antigravity CLI already stored after sign-in — read from macOS Keychain, Windows Credential Manager, or a local token file depending on CLI version. `usage` never writes that credential back and keeps any refreshed access token in memory only; the call itself reads quota metadata.
|
|
253
252
|
- **Muse quota:** Muse stores no quota file locally. `usage` runs `muse exec --json` through Muse's own sign-in and saves the returned quota to `~/.usage/muse_quota.json`. This connects to Muse and makes a real model call, using a little Muse quota. It runs in an empty folder with `--no-session-log`. With Muse installed and a conversation available, it fetches the first snapshot; later probes require a snapshot over 30 minutes old and a newer Muse conversation. After failure, it waits at least 30 minutes and requires new Muse usage before retrying. Hide its card under **Hide sections**.
|
|
254
253
|
- **Other background network activity:** Public Claude and Codex status pages to flag outages, a public model-pricing table to estimate cost (built-in prices are used offline), and an occasional GitHub check for a new version.
|
|
255
254
|
- **Beginner Mode**, only if you turn it on, sends Claude Code's latest answer to Claude Haiku through your own Claude Code sign-in to pick terms. Your term list stays in `~/.usage/glossary.json`.
|
|
@@ -18,6 +18,7 @@ from adapters import rate_limits
|
|
|
18
18
|
from adapters.types import UsageEntry
|
|
19
19
|
from loaders import agy_loader, agy_quota_probe, codex_loader, muse_quota_probe
|
|
20
20
|
from loaders.claude_paths import claude_config_dirs
|
|
21
|
+
from usage_common.project_resolver import resolve_project_name
|
|
21
22
|
|
|
22
23
|
_DISPATCH = {
|
|
23
24
|
"codex": re.compile(r"(^|[;&|(\s])codex exec"),
|
|
@@ -61,7 +62,10 @@ class LedgerRow(TypedDict):
|
|
|
61
62
|
dispatch_count: int
|
|
62
63
|
claude_pct: float | None
|
|
63
64
|
codex_pct: float | None
|
|
64
|
-
|
|
65
|
+
agy_groups: dict[str, float]
|
|
66
|
+
claude_reset: bool
|
|
67
|
+
codex_reset: bool
|
|
68
|
+
agy_reset: bool
|
|
65
69
|
total_pct: float
|
|
66
70
|
|
|
67
71
|
|
|
@@ -69,6 +73,52 @@ class LedgerData(TypedDict):
|
|
|
69
73
|
rows: list[LedgerRow]
|
|
70
74
|
unowned_codex: int
|
|
71
75
|
unowned_agy: int
|
|
76
|
+
used_pct: dict[str, float]
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class LedgerBlock(TypedDict):
|
|
80
|
+
quota: str
|
|
81
|
+
used_pct: float | None
|
|
82
|
+
conversations: list[tuple[LedgerRow, float]]
|
|
83
|
+
more_count: int
|
|
84
|
+
more_pct: float
|
|
85
|
+
other_pct: float | None
|
|
86
|
+
all_reset: bool
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def ledger_blocks(rows: list[LedgerRow], used_pct: dict[str, float]) -> list[LedgerBlock]:
|
|
90
|
+
"""Select each quota's top five from every owned conversation."""
|
|
91
|
+
shares: dict[str, list[tuple[LedgerRow, float]]] = defaultdict(list)
|
|
92
|
+
for row in rows:
|
|
93
|
+
if row["codex_pct"] is not None and row["codex_pct"] > 0:
|
|
94
|
+
shares["codex"].append((row, row["codex_pct"]))
|
|
95
|
+
for group, value in row["agy_groups"].items():
|
|
96
|
+
if value > 0:
|
|
97
|
+
shares[f"antigravity:{group}"].append((row, value))
|
|
98
|
+
if any(row["codex_reset"] for row in rows):
|
|
99
|
+
shares.setdefault("codex", [])
|
|
100
|
+
blocks: list[LedgerBlock] = []
|
|
101
|
+
for quota, conversations in shares.items():
|
|
102
|
+
conversations.sort(key=lambda item: item[1], reverse=True)
|
|
103
|
+
total = sum(value for _, value in conversations)
|
|
104
|
+
used = used_pct.get(quota)
|
|
105
|
+
other = max(0.0, used - total) if used is not None else None
|
|
106
|
+
blocks.append(
|
|
107
|
+
{
|
|
108
|
+
"quota": quota,
|
|
109
|
+
"used_pct": used,
|
|
110
|
+
"conversations": conversations[:5],
|
|
111
|
+
"more_count": len(conversations[5:]),
|
|
112
|
+
"more_pct": sum(value for _, value in conversations[5:]),
|
|
113
|
+
"other_pct": other if other is not None and other >= 0.5 else None,
|
|
114
|
+
"all_reset": quota == "codex" and not conversations,
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
blocks.sort(
|
|
118
|
+
key=lambda block: sum(value for _, value in block["conversations"]) + block["more_pct"],
|
|
119
|
+
reverse=True,
|
|
120
|
+
)
|
|
121
|
+
return blocks
|
|
72
122
|
|
|
73
123
|
|
|
74
124
|
def _timestamp(value: object) -> datetime | None:
|
|
@@ -319,11 +369,15 @@ def estimate_pct(
|
|
|
319
369
|
return session_tokens / total_tokens * window.used_pct
|
|
320
370
|
|
|
321
371
|
|
|
372
|
+
SessionGroup = tuple[str, str, str]
|
|
373
|
+
|
|
374
|
+
|
|
322
375
|
def estimate_sessions(
|
|
323
376
|
entries: list[UsageEntry], windows: dict[str, QuotaWindow], now: datetime
|
|
324
|
-
) -> dict[
|
|
377
|
+
) -> tuple[dict[SessionGroup, float], set[SessionGroup]]:
|
|
325
378
|
totals: dict[str, int] = defaultdict(int)
|
|
326
379
|
sessions: dict[tuple[str, str, str], int] = defaultdict(int)
|
|
380
|
+
before_window: set[SessionGroup] = set()
|
|
327
381
|
for entry in entries:
|
|
328
382
|
group = entry.agent_id
|
|
329
383
|
if entry.agent_id == "antigravity":
|
|
@@ -351,18 +405,21 @@ def estimate_sessions(
|
|
|
351
405
|
"",
|
|
352
406
|
)
|
|
353
407
|
window = windows.get(group)
|
|
354
|
-
if window is None or not window.resets_at - window.length <= entry.timestamp <= now:
|
|
355
|
-
continue
|
|
356
408
|
tokens = entry.input_tokens + entry.output_tokens + entry.cache_creation_tokens
|
|
409
|
+
if window is None or entry.timestamp > now or tokens <= 0:
|
|
410
|
+
continue
|
|
411
|
+
key = (entry.agent_id, entry.session_id, group)
|
|
412
|
+
if entry.timestamp < window.resets_at - window.length:
|
|
413
|
+
before_window.add(key)
|
|
414
|
+
continue
|
|
357
415
|
totals[group] += tokens
|
|
358
|
-
sessions[
|
|
359
|
-
estimates: dict[
|
|
416
|
+
sessions[key] += tokens
|
|
417
|
+
estimates: dict[SessionGroup, float] = {}
|
|
360
418
|
for (agent_id, session_id, group), tokens in sessions.items():
|
|
361
419
|
value = estimate_pct(tokens, totals[group], windows.get(group), now)
|
|
362
420
|
if value is not None:
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
return estimates
|
|
421
|
+
estimates[(agent_id, session_id, group)] = value
|
|
422
|
+
return estimates, before_window - sessions.keys()
|
|
366
423
|
|
|
367
424
|
|
|
368
425
|
def _session_title(path: Path) -> str:
|
|
@@ -392,13 +449,23 @@ def _session_title(path: Path) -> str:
|
|
|
392
449
|
return title or first_text
|
|
393
450
|
|
|
394
451
|
|
|
395
|
-
def build_ledger(
|
|
452
|
+
def build_ledger(
|
|
453
|
+
estimates: dict[SessionGroup, float],
|
|
454
|
+
now: datetime,
|
|
455
|
+
reset_sessions: set[SessionGroup] | None = None,
|
|
456
|
+
used_pct: dict[str, float] | None = None,
|
|
457
|
+
) -> LedgerData:
|
|
396
458
|
cutoff = now - timedelta(days=7)
|
|
397
459
|
paths = _claude_paths(cutoff)
|
|
398
460
|
dispatches = [
|
|
399
461
|
item for path in paths for item in _read_dispatches(path) if cutoff <= item.timestamp <= now
|
|
400
462
|
]
|
|
401
|
-
empty: LedgerData = {
|
|
463
|
+
empty: LedgerData = {
|
|
464
|
+
"rows": [],
|
|
465
|
+
"unowned_codex": 0,
|
|
466
|
+
"unowned_agy": 0,
|
|
467
|
+
"used_pct": used_pct or {},
|
|
468
|
+
}
|
|
402
469
|
if not dispatches:
|
|
403
470
|
return empty
|
|
404
471
|
known_sessions = {path.stem for path in paths}
|
|
@@ -426,32 +493,51 @@ def build_ledger(estimates: dict[tuple[str, str], float | None], now: datetime)
|
|
|
426
493
|
origin = by_owner.get(owner)
|
|
427
494
|
if not origin:
|
|
428
495
|
continue
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
496
|
+
claude_pct = estimates.get(("claude-code", owner, "claude-code"))
|
|
497
|
+
codex_values = [
|
|
498
|
+
estimates[("codex", child, "codex")]
|
|
499
|
+
for child in children["codex"]
|
|
500
|
+
if ("codex", child, "codex") in estimates
|
|
501
|
+
]
|
|
502
|
+
codex_pct = sum(codex_values) if codex_values else None
|
|
503
|
+
agy_groups: dict[str, float] = {}
|
|
504
|
+
for (agent, child, group), value in estimates.items():
|
|
505
|
+
if agent == "antigravity" and child in children[agent]:
|
|
506
|
+
name = group.removeprefix("antigravity:")
|
|
507
|
+
agy_groups[name] = agy_groups.get(name, 0.0) + value
|
|
508
|
+
reset_agents = {
|
|
509
|
+
agent
|
|
510
|
+
for agent, session, _ in reset_sessions or set()
|
|
511
|
+
if (agent == "claude-code" and session == owner)
|
|
512
|
+
or session in children.get(agent, set())
|
|
513
|
+
}
|
|
437
514
|
first = min(origin, key=lambda item: item.timestamp)
|
|
438
515
|
rows.append(
|
|
439
516
|
(
|
|
440
517
|
owner,
|
|
441
518
|
{
|
|
442
519
|
"date": first.timestamp.astimezone().strftime("%Y-%m-%d"),
|
|
443
|
-
"project":
|
|
520
|
+
"project": resolve_project_name(first.cwd),
|
|
444
521
|
"title": "",
|
|
445
522
|
"dispatch_count": len(origin),
|
|
446
|
-
"claude_pct":
|
|
447
|
-
"codex_pct":
|
|
448
|
-
"
|
|
449
|
-
"
|
|
523
|
+
"claude_pct": claude_pct,
|
|
524
|
+
"codex_pct": codex_pct,
|
|
525
|
+
"agy_groups": agy_groups,
|
|
526
|
+
"claude_reset": claude_pct is None and "claude-code" in reset_agents,
|
|
527
|
+
"codex_reset": codex_pct is None and "codex" in reset_agents,
|
|
528
|
+
"agy_reset": not agy_groups and "antigravity" in reset_agents,
|
|
529
|
+
"total_pct": (claude_pct or 0) + (codex_pct or 0) + sum(agy_groups.values()),
|
|
450
530
|
},
|
|
451
531
|
)
|
|
452
532
|
)
|
|
453
533
|
rows.sort(key=lambda item: item[1]["total_pct"], reverse=True)
|
|
454
|
-
for
|
|
455
|
-
|
|
456
|
-
|
|
534
|
+
empty["rows"] = [row for _, row in rows]
|
|
535
|
+
displayed = {
|
|
536
|
+
id(row)
|
|
537
|
+
for block in ledger_blocks(empty["rows"], empty["used_pct"])
|
|
538
|
+
for row, _ in block["conversations"]
|
|
539
|
+
}
|
|
540
|
+
for owner, row in rows:
|
|
541
|
+
if id(row) in displayed:
|
|
542
|
+
row["title"] = _session_title(path_by_session[owner])
|
|
457
543
|
return empty
|
|
@@ -16,6 +16,7 @@ import logging
|
|
|
16
16
|
import os
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
import tempfile
|
|
19
|
+
import threading
|
|
19
20
|
import time
|
|
20
21
|
from typing import Any, NotRequired, TypedDict, cast
|
|
21
22
|
|
|
@@ -45,6 +46,7 @@ YEAR_LEDGER_PATH = YEAR_CACHE_PATH.with_name("year_ledger.json")
|
|
|
45
46
|
YEAR_CACHE_TTL_SECONDS = 6 * 3600
|
|
46
47
|
_YEAR_CACHE_SCHEMA = 6
|
|
47
48
|
_YEAR_LEDGER_SCHEMA = 1
|
|
49
|
+
_year_ledger_lock = threading.Lock()
|
|
48
50
|
_YEAR_LEDGER_TRIM_BUFFER_DAYS = 60
|
|
49
51
|
|
|
50
52
|
|
|
@@ -675,18 +677,21 @@ def _merge_year_ledger(
|
|
|
675
677
|
*,
|
|
676
678
|
trim_before: date,
|
|
677
679
|
) -> _YearLedger:
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
680
|
+
with _year_ledger_lock:
|
|
681
|
+
ledger = _read_year_ledger()
|
|
682
|
+
days = ledger["days"]
|
|
683
|
+
for day_key, current_day in current_days.items():
|
|
684
|
+
ledger_day = days.get(day_key)
|
|
685
|
+
if ledger_day is None or current_day["total_tokens"] >= ledger_day["total_tokens"]:
|
|
686
|
+
days[day_key] = current_day
|
|
687
|
+
|
|
688
|
+
ledger["days"] = {
|
|
689
|
+
day_key: day
|
|
690
|
+
for day_key, day in days.items()
|
|
691
|
+
if date.fromisoformat(day_key) >= trim_before
|
|
692
|
+
}
|
|
693
|
+
_write_year_ledger(ledger)
|
|
694
|
+
return ledger
|
|
690
695
|
|
|
691
696
|
|
|
692
697
|
def _build_year_output_from_ledger(
|
|
@@ -1258,7 +1263,13 @@ def build_report_data(agents: list[AgentInfo], period: str = "month") -> ReportD
|
|
|
1258
1263
|
entry for entry in weekly_entries if not ledger_backfill.is_ledger_entry(entry)
|
|
1259
1264
|
]
|
|
1260
1265
|
windows = dispatch_ledger.load_windows() if weekly_entries else {}
|
|
1261
|
-
|
|
1266
|
+
group_estimates, reset_sessions = dispatch_ledger.estimate_sessions(
|
|
1267
|
+
weekly_entries, windows, now
|
|
1268
|
+
)
|
|
1269
|
+
estimates: dict[tuple[str, str], float] = {}
|
|
1270
|
+
for (agent_id, session_id, _), value in group_estimates.items():
|
|
1271
|
+
key = (agent_id, session_id)
|
|
1272
|
+
estimates[key] = estimates.get(key, 0.0) + value
|
|
1262
1273
|
sessions_by_cost = sorted(
|
|
1263
1274
|
aggregate_sessions(real_entries), key=lambda session: session.cost_usd, reverse=True
|
|
1264
1275
|
)
|
|
@@ -1322,7 +1333,12 @@ def build_report_data(agents: list[AgentInfo], period: str = "month") -> ReportD
|
|
|
1322
1333
|
"sessions": session_rows,
|
|
1323
1334
|
"daily_trend": daily_trend,
|
|
1324
1335
|
"top_sessions": top_sessions,
|
|
1325
|
-
"dispatch_ledger": dispatch_ledger.build_ledger(
|
|
1336
|
+
"dispatch_ledger": dispatch_ledger.build_ledger(
|
|
1337
|
+
group_estimates,
|
|
1338
|
+
now,
|
|
1339
|
+
reset_sessions,
|
|
1340
|
+
{key: window.used_pct for key, window in windows.items()},
|
|
1341
|
+
),
|
|
1326
1342
|
"comparison": comparison,
|
|
1327
1343
|
"subscriptions": subscription.load_subscriptions(),
|
|
1328
1344
|
"persona": _load_persona_for_period(period),
|
|
@@ -23,6 +23,7 @@ import logging
|
|
|
23
23
|
import os
|
|
24
24
|
from pathlib import Path
|
|
25
25
|
import tempfile
|
|
26
|
+
import threading
|
|
26
27
|
from typing import NotRequired, TypeGuard, TypedDict
|
|
27
28
|
|
|
28
29
|
from adapters.types import UsageEntry
|
|
@@ -33,6 +34,7 @@ logger = logging.getLogger(__name__)
|
|
|
33
34
|
|
|
34
35
|
SNAPSHOT_PATH = Path(os.path.expanduser("~/.usage/usage_snapshot.json"))
|
|
35
36
|
SNAPSHOT_SCHEMA = 1
|
|
37
|
+
_snapshot_lock = threading.Lock()
|
|
36
38
|
|
|
37
39
|
_RowKey = tuple[str, str, str, str, str]
|
|
38
40
|
|
|
@@ -79,9 +81,10 @@ def record_entries(
|
|
|
79
81
|
) -> UsageSnapshot:
|
|
80
82
|
"""Merge this load into the on-disk snapshot and return the result."""
|
|
81
83
|
new_rows, new_headers = _aggregate_entries(entries, entry_dates)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
with _snapshot_lock:
|
|
85
|
+
merged = _merge_snapshot(_read_snapshot(), new_rows, new_headers)
|
|
86
|
+
_write_snapshot(merged)
|
|
87
|
+
return merged
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
def read_snapshot() -> UsageSnapshot:
|