文件最后提交记录最后更新时间
fix(stats): simplify React version pinning fix Fixes #938 26 天前
chore: reformat 2 天前
fix(stats): preserved service-tier across incremental parseSessionFile offsets Stats sync depends on service_tier_change entries to derive priority premium requests since 69043d307 stopped folding priority-tier into per-message premiumRequests. parseSessionFile(path, fromOffset) initialized currentServiceTier to undefined per call, so an incremental resume past the tier change attributed subsequent priority OpenAI replies with premiumRequests: 0. When fromOffset > 0, parseSessionFile now replays bytes[0..start] purely to seed currentServiceTier from the latest service_tier_change before parsing the unprocessed tail. Bytes are already loaded, so no extra I/O. 17 天前
chore: bump version to 15.1.6 13 天前
refactor: consolidated module import paths - Removed custom TypeScript path aliases and the associated transformation script. - Replaced aliased imports with direct @oh-my-pi package imports for improved clarity. - Simplified internal module references by removing explicit /index suffixes. 4 个月前
fix(stats): simplify React version pinning fix Fixes #938 26 天前
chore: bump version to 15.7.4 1 天前
feat(coding-agent): added real-time OAuth provider authentication validation with status indicators - Added real-time OAuth provider authentication validation with visual status indicators (checking, valid, invalid). - Added validateAuth and requestRender options to OAuthSelectorComponent for custom authentication validation and UI refresh callbacks. - Changed OAuth provider selector to display live authentication status instead of static login state. - Updated logout flow to refresh OAuth provider authentication state before showing selector. 3 个月前
chore(deps): bump catalog packages to latest - Update all npm catalog entries to current latest versions - Major: diff ^8 -> ^9 - Bump @typescript/native-preview to 7.0.0-dev.20260425.1 - packages/stats/tsconfig.client.json: drop react/react-dom from explicit types (auto-resolved via react-jsx) 1 个月前
refactor: restructured monorepo TypeScript config and build tasks for unified setup - Migrated all package tsconfig files to extend tsconfig.workspace.json for unified TypeScript configuration across monorepo. - Consolidated build and check scripts across 10+ packages to use biome for linting/formatting with separate type checking via tsgo. - Renamed build scripts from build:native and build:binary to build for simplified command naming across packages/natives and packages/coding-agent. - Refactored CI workflow to invoke bun tasks instead of inline shell scripts, reducing workflow complexity by 40+ lines. - Removed sync-exports.ts and repro-stuck.ts scripts; deleted path aliases from tsconfig.base.json in favor of workspace-based configuration. - Updated turbo.json with new task definitions (check:types, lint, fmt, fix) and removed build:native/embed:native tasks. 1 个月前
chore(config): organized publish type mapping from src to dist/types - Added declaration-only compiler options to multiple package publish tsconfig files. - Standardized publish include/exclude settings to emit types from src into dist/types. - Added manifest rewrite helpers to remap type paths from ./src to ./dist/types/*.d.ts. - Updated publish flow to append dist/types/extra files and skip publish build/rewrite for native packages. 16 天前
chore(config): organized publish type mapping from src to dist/types - Added declaration-only compiler options to multiple package publish tsconfig files. - Standardized publish include/exclude settings to emit types from src into dist/types. - Added manifest rewrite helpers to remap type paths from ./src to ./dist/types/*.d.ts. - Updated publish flow to append dist/types/extra files and skip publish build/rewrite for native packages. 16 天前
README.md

@oh-my-pi/omp-stats

Local observability dashboard for AI usage statistics.

Features

  • Session log parsing: Reads JSONL session logs from ~/.omp/agent/sessions/
  • SQLite aggregation: Efficient stats storage and querying using bun:sqlite
  • Web dashboard: Real-time metrics visualization with Chart.js
  • Incremental sync: Only processes new/modified log entries

Metrics Tracked

Metric Calculation
Tokens/s output_tokens / (duration / 1000)
Cache Rate cache_read / (input + cache_read) * 100
Error Rate count(stopReason=error) / total_calls * 100
Total Cost Sum of usage.cost.total
Avg Latency Mean of duration
TTFT Mean of ttft (time to first token)

Usage

Via CLI

# Start dashboard server (default: http://localhost:3847)
omp stats

# Custom port
omp stats --port 8080

# Print summary to console
omp stats --summary

# Output as JSON (for scripting)
omp stats --json

Programmatic

import { getDashboardStats, syncAllSessions } from "@oh-my-pi/omp-stats";

// Sync session logs to database
const { processed, files } = await syncAllSessions();

// Get aggregated stats
const stats = await getDashboardStats();
console.log(stats.overall.totalCost);
console.log(stats.byModel[0].avgTokensPerSecond);

API Endpoints

Endpoint Description
GET /api/stats Overall stats with all breakdowns
GET /api/stats/models Per-model statistics
GET /api/stats/folders Per-folder/project statistics
GET /api/stats/timeseries Hourly time series data
GET /api/sync Trigger sync and return counts

Data Storage

  • Session logs: ~/.omp/agent/sessions/ (JSONL files)
  • Stats database: ~/.omp/stats.db (SQLite)

Dashboard

The web dashboard provides:

  • Overall metrics cards (requests, cost, cache rate, error rate, duration, tokens/s)
  • Time series chart showing requests and errors over time
  • Per-model breakdown table
  • Per-folder breakdown table
  • Auto-refresh every 30 seconds

License

MIT