Skip to content

feat(pi): add Pi and Oh My Pi support#219

Closed
timseriakov wants to merge 2 commits into
vakovalskii:mainfrom
timseriakov:feature/pi-agent-support
Closed

feat(pi): add Pi and Oh My Pi support#219
timseriakov wants to merge 2 commits into
vakovalskii:mainfrom
timseriakov:feature/pi-agent-support

Conversation

@timseriakov
Copy link
Copy Markdown
Contributor

@timseriakov timseriakov commented May 24, 2026

Summary

Adds first-class Pi and Oh My Pi support to Codbash.

Pi and Oh My Pi (Fork of Pi) sessions now show up in the dashboard alongside the existing agents, can be searched, previewed, opened in detail, resumed from the UI/CLI, included in analytics, and shown separately in leaderboard stats.

Companion PR

What's new

Surface Change
Agent detection Detects Pi via pi and Oh My Pi via omp, with Settings detection metadata and tests.
Session loading Reads Pi / Oh My Pi JSONL sessions from their agent directories, including canonical nested session layouts.
Session detail Parses messages, timestamps, projects, models, token usage, and cost metadata into the existing session/detail UI shape.
Resume / launch Generates shell-safe Pi / Oh My Pi resume commands and launches terminal resumes through the existing /api/launch flow.
Sidebar Adds separate Pi and Oh My Pi filters in the Agents section and Sidebar settings.
Analytics Includes Pi / Oh My Pi sessions in cost and usage analytics using real usage/cost data when present.
Leaderboard Splits Pi and Oh My Pi into separate leaderboard agent keys and badges.
Docs Updates supported-agent documentation and architecture notes for Pi / Oh My Pi data sources.

Implementation details

Backend

  • Adds Pi / Oh My Pi session scanners in src/data.js.
  • Normalizes Pi / Oh My Pi usage fields into Codbash token and cost fields.
  • Tracks agent_variant so Pi and Oh My Pi can share the pi tool integration while remaining distinguishable in filters and analytics.
  • Stores resume_target for JSONL-backed sessions so resumes can target the exact session file.
  • Validates Pi / Oh My Pi resume targets against scanned session files and keeps safe session IDs separate from JSONL resume paths for terminal tracking.
  • Extends agent detection, settings validation, CLI listing/resume support, WSL home discovery, active-session detection, markdown export, and terminal launch command construction.

Frontend

  • Adds Pi / Oh My Pi labels, badges, filters, sidebar entries, install metadata, and detail actions.
  • Wires Pi / Oh My Pi into calendar, heatmap, analytics, leaderboard, and session rendering paths.
  • Sends JSONL resume targets for Pi / Oh My Pi detail and project “Last” resume flows.
  • Keeps normal UI casing as Pi / Oh My Pi; leaderboard badges remain lowercase (pi, ohmypi) to match existing leaderboard style.

Tests

  • Adds Pi / Oh My Pi parser, scanner, nested cache invalidation, resume-target parsing, and leaderboard coverage in test/pi-session.test.js.
  • Extends agent detection, settings, sidebar config, frontend escaping, WSL discovery, terminal launch, and Pi feature-parity tests for Pi / Oh My Pi behavior.

Test plan

  • node --test
  • Focused regression tests: node --test test/pi-session.test.js test/sidebar-config.test.js test/frontend-escaping.test.js
  • Isolated dashboard smoke fixture: /api/sessions returns Pi and Oh My Pi JSONL sessions with resume_target.
  • Browser smoke: All Sessions renders Pi and Oh My Pi sessions.
  • Browser smoke: sidebar filters isolate Pi and Oh My Pi separately.
  • Browser smoke: Pi detail view renders messages, model/title context, and Resume action.
  • Browser smoke: Resume action sends safe sessionId plus JSONL resumeTarget to /api/launch (fetch intercepted; no real terminal/agent launched).
  • Browser smoke: Analytics includes Pi/OhMyPi cost coverage.
  • Browser smoke: Leaderboard shows separate pi and ohmypi rows with violet badge styling.
  • Manual: click Resume for a real Pi / Oh My Pi session and confirm the terminal resumes it.

Verified locally

  • node --test → 142 pass, 0 fail, 2 skipped
  • Manual Oh My Pi resume by JSONL path:
    • omp --resume <jsonl path> --print 'respond ok'ok

Files

  • README.md
  • docs/ARCHITECTURE.md
  • bin/cli.js
  • src/agents-detect.js
  • src/data.js
  • src/frontend/analytics.js
  • src/frontend/app.js
  • src/frontend/calendar.js
  • src/frontend/detail.js
  • src/frontend/heatmap.js
  • src/frontend/index.html
  • src/frontend/leaderboard.js
  • src/frontend/sidebar-config.js
  • src/frontend/styles.css
  • src/server.js
  • src/settings.js
  • src/terminals.js
  • test/agents-detect.test.js
  • test/frontend-escaping.test.js
  • test/pi-session.test.js
  • test/settings.test.js
  • test/sidebar-config.test.js
  • test/terminals-windows-launch.test.js
  • test/wsl-windows.test.js

@timseriakov timseriakov force-pushed the feature/pi-agent-support branch 2 times, most recently from 293d694 to 383a9e9 Compare May 24, 2026 19:24
timseriakov added a commit to timseriakov/codedash-leaderboard that referenced this pull request May 24, 2026
Add pi and ohmypi to the frontend agent badge color map so production badges use the shared violet styling instead of the unknown-agent fallback.

Related to vakovalskii/codbash#219.
Adds Pi and Oh My Pi as first-class agents instead of treating them as a combined sidebar entry. The sidebar exposes separate Pi and Oh My Pi filters, while leaderboard aggregation keeps their stats distinct and renders lowercase badges only in the leaderboard context.

Resume reliability:

- Scan Pi and Oh My Pi session directories recursively enough to find canonical nested ~/.omp/agent/sessions/<project> JSONL files.
- Store resume_target on scanned sessions and use the JSONL path for Pi and Oh My Pi copy, CLI, and UI resume commands.
- Pass resumeTarget through /api/launch separately from sessionId so terminal tracking remains keyed by safe IDs while Pi and Oh My Pi resumes can use validated session file paths.
- Quote resume targets before passing them to pi/omp launch commands.

Analytics/UI:

- Split leaderboard agent keys for Pi vs Oh My Pi instead of aggregating under pi.
- Remove the combined Pi/OhMyPi install/sidebar item; keep Pi and Oh My Pi as separate sidebar entries.
- Keep proper display casing outside Leaderboard and lowercase badges inside Leaderboard.

Tests:

- node --test
- Manual: omp --resume <jsonl path> --print 'respond ok'
@timseriakov timseriakov force-pushed the feature/pi-agent-support branch from 383a9e9 to 6314043 Compare May 24, 2026 21:36
@timseriakov timseriakov deleted the feature/pi-agent-support branch May 24, 2026 21:40
@timseriakov
Copy link
Copy Markdown
Contributor Author

Superseded by #221 using branch feat/pi-agent-support to match the repository branch naming convention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant