Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.

Split OMP from Pi usage - #32

Merged
makoMakoGo merged 2 commits into
personal/local-clientsfrom
codex/split-omp-from-pi
Jun 5, 2026
Merged

Split OMP from Pi usage#32
makoMakoGo merged 2 commits into
personal/local-clientsfrom
codex/split-omp-from-pi

Conversation

@makoMakoGo

@makoMakoGo makoMakoGo commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Closes #31

变更内容

  • omp 注册为独立 client id,扫描 ~/.omp/agent/sessions,不再并入 pi
  • pi 只扫描 ~/.pi/agent/sessions,解析结果继续使用 client id pi,展示为 Pi
  • omp 复用 Pi JSONL 解析格式,但解析结果使用 client id omp,CLI 通过 --client omp 过滤,TUI/frontend/wrapped 展示为 OMP
  • 移除文档中把 .omp 写在 Pi 下的描述;不引入 oh-my-pi / oh_my_pi / --omp 这类 alias
  • bump source message cache schema,避免旧缓存里 .omp 被当作 pi 的结果继续污染统计

验证

  • rtk cargo fmt
  • rtk cargo check -p tokscale-cli
  • rtk cargo test -p tokscale-core omp
  • rtk cargo test -p tokscale-cli client_filter
  • rtk cargo test -p tokscale-cli wrapped
  • rtk cargo test -p tokscale-cli test_models_client_filter_splits_pi_and_omp_sessions
  • rtk cargo test
  • rtk bun run --cwd packages/frontend test __tests__/lib/clientRegistry.test.ts
  • rtk bun run --cwd packages/frontend test __tests__/api/submit.test.ts
  • rtk bun run --cwd packages/frontend test
  • rtk bun run --cwd packages/frontend lint(0 errors;仓库现有 9 warnings)
  • rtk bun run build:cli

Summary by Sourcery

Register OMP as a first-class client separate from Pi and ensure its sessions, parsing, filtering, and presentation are handled independently across the core, CLI, and frontend.

New Features:

  • Add an OMP client that scans ~/.omp/agent/sessions and is exposed via CLI, TUI, wrapped views, and frontend as a distinct client id and label.
  • Support parsing OMP JSONL session files using the Pi session format while attributing usage to the omp client.

Bug Fixes:

  • Prevent Pi scans and statistics from including OMP session data by separating their scan paths and cache schema entries.

Enhancements:

  • Update client registries, counts, hotkeys, and defaults to include the new OMP client alongside Pi.
  • Extend CLI client filters, submission payload handling, and tests to cover the OMP client.
  • Refresh multilingual documentation to describe OMP as a separate supported client and list omp as an available --client value.
  • Bump the source message cache schema version to invalidate old caches that treated OMP sessions as Pi.

Summary by CodeRabbit

发布说明

  • 新功能

    • OMP 现已作为独立客户端支持,与 Pi 分开处理平台过滤和数据源映射
  • 文档

    • 更新了多语言 README 文档,分别说明 Pi 和 OMP 的会话路径及数据格式
  • 测试

    • 新增测试用例覆盖 OMP 客户端的显示名、Logo、会话解析及数据过滤功能

@sourcery-ai

sourcery-ai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR splits Oh My Pi (OMP) out from Pi into a first-class, independent client while reusing Pi’s JSONL format, updating scanning, parsing, CLI/TUI/frontend plumbing, tests, cache schema, and documentation accordingly.

File-Level Changes

Change Details Files
Register OMP as an independent client and update client registry invariants/tests.
  • Add ClientId::Omp with home-rooted .omp/agent/sessions JSONL source definition in clients registry
  • Shift subsequent client enum discriminants and update ClientId::COUNT and ClientId::ALL tests to expect 26 clients and new ordering
  • Add unit test ensuring OMP client metadata (paths, pattern, flags) is correctly registered
crates/tokscale-core/src/clients.rs
crates/tokscale-core/src/tui/data/mod.rs
Make OMP scanning independent from Pi and adjust scan behavior/tests.
  • Remove special-case that scanned ~/.omp/agent/sessions under ClientId::Pi
  • Ensure scan_all_clients collects OMP paths under ClientId::Omp and Pi no longer sees OMP paths
  • Add tests covering OMP-only scanning, Pi-only scanning, and combined Pi+OMP scanning
crates/tokscale-core/src/scanner.rs
Reuse Pi JSONL parsing pipeline for OMP while tagging messages with omp client id and updating cache schema.
  • Refactor Pi JSONL parser into shared helper parse_pi_format_file(client) and add parse_omp_file that sets client to "omp"
  • Wire OMP into parse_all_messages_with_pricing_with_env_strategy and parse_local_clients to parse OMP sources and count OMP messages
  • Add tests verifying OMP messages get client=omp and bump message cache schema version to 19 to invalidate old Pi/OMP caches
crates/tokscale-core/src/sessions/pi.rs
crates/tokscale-core/src/lib.rs
crates/tokscale-core/src/message_cache.rs
Expose OMP as a first-class client in CLI filters, wrapped output, TUI, and tests.
  • Extend ClientFilter enum to include Omp and map it to ClientId::Omp and id "omp"
  • Update client_filter tests to assert only legacy-flag-backed clients plus synthetic are required, decoupling from ClientId::COUNT
  • Add OMP display name, logo mapping, default client list entry, and tests to wrapped CLI, and expose OMP in TUI client UI (display name, hotkey, key mappings, test_data_loading)
crates/tokscale-cli/src/main.rs
crates/tokscale-cli/src/commands/wrapped.rs
crates/tokscale-cli/src/tui/client_ui.rs
crates/tokscale-cli/src/tui/data/mod.rs
crates/tokscale-cli/src/tui/mod.rs
Add OMP coverage to CLI tests and frontend submission/registry behavior.
  • Augment mixed workspace fixture to include an .omp/agent/sessions JSONL file with usage data
  • Add CLI test ensuring --client pi and --client omp filters split Pi and OMP sessions into distinct entries
  • Add frontend tests and constants so submissions and registries accept and display omp as a client, including logos and colors
crates/tokscale-cli/tests/cli_tests.rs
packages/frontend/__tests__/api/submit.test.ts
packages/frontend/src/lib/constants.ts
packages/frontend/src/components/SourceLogo.tsx
packages/frontend/src/lib/types.ts
Update README docs in multiple languages to describe OMP as a separate client and expose omp in CLI/frontend docs.
  • Split Pi/OMP rows in client support tables and path tables, adding standalone OMP rows with ~/.omp paths
  • Document OMP section explaining it shares Pi JSONL format but is reported as client id omp / label OMP
  • Add omp to documented --client values and to source-filter platform lists in English, Japanese, Korean, and Simplified Chinese READMEs
README.md
README.ja.md
README.ko.md
README.zh-cn.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed7f5807-2149-4778-b933-ec31a88a83d9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/split-omp-from-pi

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request separates OMP (Oh My Pi) into an independent client distinct from the Pi client, updating the CLI, core library, and frontend to support OMP sessions. Feedback on the pull request suggests adding the Pi logo icon to the OMP entries in the localized README files to maintain visual consistency.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread README.md
Comment thread README.zh-cn.md
Comment thread README.ja.md
Comment thread README.ko.md

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The tests that assert exact positions in ClientId::ALL (e.g. indices 9..25) are quite brittle and will keep needing updates when clients are added or reordered; consider asserting presence and/or relative ordering instead of hard-coding full index sequences.
  • Pi and OMP share the same logo and color in multiple places (client_logo_url, SOURCE_LOGOS, SourceLogo switch, SOURCE_COLORS); it may be worth centralizing this mapping or adding a brief comment to avoid accidental divergence if one of them is changed later.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The tests that assert exact positions in `ClientId::ALL` (e.g. indices 9..25) are quite brittle and will keep needing updates when clients are added or reordered; consider asserting presence and/or relative ordering instead of hard-coding full index sequences.
- Pi and OMP share the same logo and color in multiple places (`client_logo_url`, `SOURCE_LOGOS`, `SourceLogo` switch, `SOURCE_COLORS`); it may be worth centralizing this mapping or adding a brief comment to avoid accidental divergence if one of them is changed later.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@makoMakoGo

Copy link
Copy Markdown
Owner Author

Bot review 处理记录:

  • Sourcery: 已把 test_client_all 从逐个 index 断言改为 ClientId::iter() 一致性 + Pi -> OMP -> Kimi 相对顺序断言。
  • Sourcery: 已在 wrapped/frontend 的 OMP logo/color 复用处加短注释,说明这是缺少专属资产时的资源占位,不改变 omp 的独立 client/display 语义。
  • Gemini Code Assist: 不采纳 README 中给 OMP 复用 Pi 图标的建议;这会在文档视觉上把 OMP alias 回 Pi。已在四个 inline threads 中说明并 resolve。

@makoMakoGo
makoMakoGo merged commit fcdcfb0 into personal/local-clients Jun 5, 2026
4 checks passed
@makoMakoGo
makoMakoGo deleted the codex/split-omp-from-pi branch June 5, 2026 19:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant