Skip to content

Add Oh My Pi as a native RPC harness - #930

Open
fauzanazz wants to merge 4 commits into
zeronsh:mainfrom
fauzanazz:feat/omp-native-rpc
Open

fauzanazz wants to merge 4 commits into
zeronsh:mainfrom
fauzanazz:feat/omp-native-rpc

Conversation

@fauzanazz

@fauzanazz fauzanazz commented Oct 16, 2026 •

Copy link
Copy Markdown

Summary

Adds Oh My Pi (omp) as a harness, driven over its native JSONL RPC on top of the native Pi RPC driver (#630). Closes #151. Related: #467, #87, #432 (both ACP-based).

  • Why a separate module: OMP's RPC is a superset of Pi's but not wire-identical, so pointing PiHarness at omp fails at launch (--no-themes is an unknown flag). crates/harness/src/omp reuses Pi's transport, normalizer, dialogs and MCP bridge, and implements OMP's own lifecycle. The contract is in crates/harness/src/omp/PROTOCOL.md; user docs in docs/omp.md.
  • OMP lifecycle: omp --mode rpc-ui --allow-home (min 18.11.0).
    • A turn ends when every prompt completes (prompt_result, or agentInvoked: false), and waits for session_settled when background work is pending.
    • Steering always sends set_steering_mode all (session-scoped in OMP, never persisted). Interrupt uses abort_and_restore_queue (OMP has no clear_queue).
    • Commands come from get_available_commands / available_commands_update. Models and per-model thinking levels come from omp models --json (no model calls).
    • Sessions are title-line JSONL files resumed with --resume <file>; the index lives in <agent>/zeron-sessions.
    • The agent dir follows OMP's resolution: named profile, then PI_CODING_AGENT_DIR, then ~/.omp/agent.
  • Shared Pi-family changes — please review closely; Pi behavior is meant to be unchanged:
    • pi/rpc.rs: reads the ready handshake and reassembles v2 rpc_chunk frames (64 MiB cap).
    • Normalizer and dialogs get small dialect hooks: label, glob, edit diffs, auto_compaction_*, UI cancel.
    • pi/mcp.mjs: registers bridge tools with loadMode: "essential". OMP hides discoverable extension tools from the model; Pi ignores the field.
    • executable::parse_version accepts omp/18.11.1.
  • Wiring: HarnessId::Omp in proto, engine registry, harness updates (omp update, npm @oh-my-pi/pi-coding-agent), install (curl -fsSL https://omp.sh/install | sh), skills (.omp/skills, skill: commands), client catalog, zgx mark/update name/provider search terms, iOS brand mark, landing page, READMEs.
  • Accounts: OMP keeps its own logins (omp login); Zeron lists no OMP accounts.
  • crates/ui: per review, no desktop v2 changes. One commit keeps three HarnessId::Omp match arms (pickers.rs, settings/harnesses.rs, shell/harness_updates.rs) only so the workspace compiles.
  • Compatibility — please check: HarnessId::Omp ("omp") is a new value of a strict serde enum, added the same way as the existing harnesses. An older peer that receives a frame naming omp (for example, a chat hosted with OMP on a newer device) cannot parse that frame. I did not add a capability gate. Tell me if you want one, or a lenient HarnessId parse. No persisted keys or RPC methods are renamed.
  • New dependency use: zeron-harness now uses the existing workspace rusqlite. It opens OMP's agent.db read-only to key the model-catalog cache on the credential listing (provider, credential_type, enabled). It never reads token data. Any error falls back to an empty key.
  • Processes: the harness spawns omp like the Pi driver does: an owned process tree, an interrupt grace period, then kill. With an explicit agent dir it sets PI_CODING_AGENT_DIR and removes OMP_PROFILE/PI_PROFILE for the child only (a named profile would override the dir).

Review guide

Suggested order:

  1. crates/harness/src/pi/**: behavior-preserving refactor so OMP reuses Pi's spawn, transport, dialogs, normalizer and session-file helpers. Upstream Pi tests are unchanged and pass.
  2. crates/harness/src/omp/** + PROTOCOL.md: the OMP dialect.
  3. Wiring: one-line HarnessId::Omp arms in proto, engine (registry, accounts, updates + npm owner), client catalog, install, skills.
  4. Clients: zgx mark, update name and search terms; iOS mark; landing/READMEs.
  5. crates/ui: three match arms only.

Test plan

Added:

  • crates/harness/tests/omp_rpc.rs (16 tests) with the harness-omp-fixture peer, which speaks the OMP dialect: ready, v1/v2 framing with an oversized get_state, prompt_result, session_settled, steering bursts, abort_and_restore_queue, unknown get_commands/clear_queue, title-line sessions, profile precedence.
  • crates/engine/tests/misc/omp_resume.rs: idle crash then resume through dispatch; a timed-out dialog does not strand the session.
  • crates/harness/tests/omp_live.rs (#[ignore], real omp, isolated home, local mock provider, no model API calls).

Ran on the rebased head (macOS arm64):

  • cargo test --locked -p zeron-harness: all suites pass (521 lib)
  • cargo test --locked -p zeron-harness --features native-fixture --test omp_rpc --test pi_rpc: omp_rpc 16, pi_rpc 18 pass
  • cargo test --locked -p zeron-engine --test misc omp_ / pi_: 2 + 2 pass; --lib harness_updates: 82 pass
  • cargo test --locked -p zeron-engine --lib: 894 pass, 1 fails: uploads::tests::chat_images_read_only_raster_files_inside_the_chat_folder (macOS /var → /private/var tempdir link; uploads.rs is untouched by this PR)
  • cargo test --locked -p zeron-ui --lib -- --test-threads=1: 1998 pass
  • cargo test -p zeron-harness --test omp_live -- --ignored: 4 pass against omp 18.18.3; pi_live 2 pass against pi 1.3.0
  • cargo check --workspace --all-targets and cargo check --manifest-path apps/zgx/Cargo.toml --all-targets: no errors
  • cargo clippy --all-targets (harness, engine): no warnings on lines this PR adds. skills.rs already fails non_octal_unix_permissions on main.

Manual, forked app with a real model:
These ran through the forked engine with zeron mcp (list_models, create_chat, send_message, interrupt_chat, respond_to_input):

  • Model list with per-model thinking levels
  • Chat reply; Zeron MCP tool call (zeron/whoami); shell tool
  • Steer mid-turn; interrupt (tool child reaped)
  • Resume after engine restart
  • Agent ask dialog answered in Zeron
  • zgx (desktop v3): model picker, Settings → Providers and a chat with Oh My Pi, in dark and light mode (screenshots below)
  • Windows and Linux: not tested
  • iOS app build in Xcode: not done (BrandMarks.swift only adds an omp case)

Screenshots

Captured from zgx (desktop v3, macOS) on the rebased head, with an isolated engine. Personal data is pixelated.

Model picker, Oh My Pi tab with models from omp models --json and the thinking control:

Dark Light
Oh My Pi model picker, dark Oh My Pi model picker, light

Settings → Providers, the Oh My Pi card:

Dark Light
Providers, dark Providers, light

Chat with Oh My Pi:

Dark Light
Oh My Pi chat, dark Oh My Pi chat, light

@fauzanazz fauzanazz mentioned this pull request Oct 16, 2026
@fauzanazz
fauzanazz force-pushed the feat/omp-native-rpc branch 2 times, most recently from 4a666e8 to 401d106 Compare October 26, 2026 04:06
@D3rKlabauter

Copy link
Copy Markdown

Nice! Would be great to get this merged - thank you for working on this!

@wingleeio

Copy link
Copy Markdown
Contributor

Thank you for this. Zeron's desktop is now v3 (apps/zgx), which replaces crates/ui. The rest of this PR is still wanted: could you drop the crates/ui changes and rebase on main?

@fauzanazz

Copy link
Copy Markdown
Author

Sure! Thanks for the reponds. Will send it asap

@fauzanazz
fauzanazz force-pushed the feat/omp-native-rpc branch from df05c64 to a5098aa Compare November 9, 2026 10:56
@fauzanazz

Copy link
Copy Markdown
Author

Thanks! Rebased on main and dropped the crates/ui changes (icon, picker, settings). One small commit, ui: compile with the Omp harness id, keeps three match arms in crates/ui so the workspace still builds now that HarnessId::Omp exists; happy to drop it if you'd rather handle that differently. On the zgx side, Omp is covered in the agent mark, provider search terms and the updates list. Omp also joins the npm owner table, so updates follow whatever installed it, the same way they do for Pi.

The rebase needed a force-push. I also trimmed duplicate tests and dropped unrelated rustfmt hunks. The description now has a review guide, the test plan for the rebased head, and zgx screenshots (dark and light).

Drive `omp --mode rpc-ui --allow-home` (Oh My Pi >= 18.11.0) directly,
reusing the native Pi driver's transport, normalizer, dialogs and MCP
bridge. OMP-specific lifecycle: ready handshake with v2 rpc_chunk
frames, prompt_result / session_settled turn completion,
abort_and_restore_queue interrupts, get_available_commands, title-line
session files resumed with --resume, and `omp models --json` discovery.
The OMP process and its model probe start through the engine's agent
ledger (`process::spawn_agent`), like every other agent.

Wired through proto, engine registry, harness updates, client catalog,
iOS brand mark and docs (docs/omp.md, crates/harness/src/omp/PROTOCOL.md).
Covered by a native fixture suite, an engine resume test and ignored
real-omp tests.
OMP's tool names and argument shapes (glob, old_string/new_string, edits
without a new text) now apply to OMP alone, and the version parser strips
only an omp/ prefix, so Pi and the other agents map as they did on main.

A steer OMP refuses no longer gets a Steered receipt, and the model
listing keeps draining stderr past its cap.

This branch has not been deployed

No deployments
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.

Please add omp

3 participants