• v1.2.0 e4288248b1

    v1.2.0
    Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 1m18s
    CI / Lint & Test (push) Successful in 17m11s
    CI / Build Linux (push) Successful in 19m53s
    CI / Build Windows (cross-compile) (push) Successful in 29m35s
    Stable

    naomi released this 2026-02-04 20:21:00 -08:00 | 39 commits to main since this release

    Cost Management Features

    1. Historical Cost Tracking & Persistence

    • Backend (src-tauri/src/cost_tracking.rs): Full Rust implementation for tracking daily costs with persistence via Tauri's store plugin
    • Tracks: input tokens, output tokens, cost in USD, messages sent, and session counts
    • Data stored per-day with automatic aggregation for weekly/monthly periods
    • Supports cost summary generation for any number of days (7, 30, 90, etc.)
    • CSV export functionality for cost data

    2. Cost Alert System

    • Configurable thresholds: Set daily, weekly, and monthly spending limits
    • Alert triggering: When spending exceeds thresholds, alerts are generated
    • Desktop notifications: Alerts trigger the notification system with the "Cost Alert!" sound (reuses the "oh-no.mp3" sound file)
    • Alert state resets daily to prevent duplicate notifications

    3. Per-Message Cost Attribution

    • New MessageCost type (src-tauri/src/types.rs): Tracks input tokens, output tokens, and cost USD per message
    • Cost flows through the entire pipeline:
      • Rust backend calculates cost when processing assistant messages
      • Cost data included in OutputEvent emitted to frontend
      • TypeScript receives and converts snake_case to camelCase
      • Terminal lines can display cost badges

    4. Session Recording

    • Automatic session tracking (src-tauri/src/bridge_manager.rs): Each time Claude starts, a new session is recorded
    • Sessions counted in daily cost summaries
    • Enables tracking usage patterns over time

    5. Frontend Cost Display

    StatsDisplay Component (src/lib/components/StatsDisplay.svelte)

    • Historical Costs section: Collapsible panel showing:
      • Quick stats badges (Today, Week, Month costs)
      • Expanded view with detailed cost breakdown
      • Link to settings for detailed history

    CostSummary Component (src/lib/components/CostSummary.svelte)

    • Full cost management UI in the Config Sidebar:
      • Quick stats cards (Today/Week/Month)
      • Period selector (7/30/90 days)
      • Detailed summary: total cost, average daily, messages, sessions, token counts
      • Mini bar chart showing daily spending (last 14 days)
      • CSV export button
      • Alert threshold configuration UI

    6. Cost Tracking Store (src/lib/stores/costTracking.ts)

    • Svelte store managing cost tracking state
    • Methods: refresh(), getSummary(), setAlertThresholds(), exportCsv()
    • Derived store formattedCosts for display-ready values
    • Helper functions: formatCost(), formatAlertType(), getAlertMessage()
    • Automatic alert notification triggering on refresh

    7. Notification Integration

    • New notification type: NotificationType.COST_ALERT
    • Sound: Uses "oh-no.mp3" with "Cost Alert!" phrase
    • Helper method: notificationManager.notifyCostAlert()

    8. Tauri Commands (Backend API)

    • get_today_cost: Returns today's total cost
    • get_week_cost: Returns current week's total cost
    • get_month_cost: Returns current month's total cost
    • get_cost_summary: Returns detailed summary for N days
    • get_cost_alerts: Checks thresholds and returns triggered alerts
    • set_cost_alert_thresholds: Configure daily/weekly/monthly limits
    • export_cost_csv: Generate CSV export of cost data
    • record_cost: Record a cost entry (called internally)
    • record_session: Record a new session start

    9. Supporting Infrastructure

    • Tool cache analytics (src-tauri/src/tool_cache.rs): Framework for tracking potential cache hits (for future optimisation)
    • Budget status types (src-tauri/src/stats.rs): ContextWarning, BudgetStatus, BudgetType enums for frontend budget warnings
    • Conversation utilities (src/lib/utils/conversationUtils.ts): JSON sanitisation for safe IPC, summary generation helpers

    Technical Details

    Pricing Model

    Uses Claude API pricing:

    • Sonnet: $3/$15 per MTok (input/output)
    • Opus: $15/$75 per MTok
    • Haiku: $0.25/$1.25 per MTok

    Data Flow

    1. Assistant message received in wsl_bridge.rs
    2. Cost calculated using calculate_cost()
    3. Cost recorded via record_cost() command (async)
    4. MessageCost attached to OutputEvent
    5. Frontend receives event, updates conversation store
    6. costTrackingStore.refresh() called on stats updates
    7. Alerts checked and notifications triggered if thresholds exceeded
    Downloads