Skip to content

feat(providers): run omo prompts through a shared pi CLI runtime - #41

Merged
devswha merged 1 commit into
mainfrom
feat/omo-send-runtime
Aug 13, 2026
Merged

feat(providers): run omo prompts through a shared pi CLI runtime#41
devswha merged 1 commit into
mainfrom
feat/omo-send-runtime

Conversation

@devswha

@devswha devswha commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Builds on #39, which added omo as a discovery/transcript provider. This wires the send path so omo sessions can actually be driven from ChatMux.

What changed

  • new server/pi-cli.ts: argv builder, event normalizer, and child lifecycle for the pi-derived CLIs, parameterized by a descriptor
  • server/omp-cli.ts reduced to thin wrappers over it; every export keeps its signature, so existing callers and omp-cli.test.ts are untouched
  • new server/omo-cli.ts + omo-cli.test.ts
  • spawnFns.omo / abortFns.omo registered in server/index.js

Why extracted rather than copied

The two CLIs agree on every flag the runtime uses (--mode json --print, --resume, --model, --thinking, @<image>) and on every event field the normalizer reads. Duplicating ~250 lines of process plumbing to change one string would have been the alternative.

Contract confirmed by capture, not assumption

A real omo --mode json --print run emits:

{"type":"session","version":3,"id":"019ff9fa-…","cwd":"/tmp/omo-json-probe"}
{"type":"message_update","assistantMessageEvent":{"type":"text_delta","delta":"ok"}}
{"type":"tool_execution_start","toolCallId":"toolu_01Fq…","toolName":"read","args":{"path":"…/sample.txt"}}
{"type":"tool_execution_end","toolCallId":"toolu_01Fq…","result":{"content":[{"type":"text","text":"probe file\n"}]},"isError":false}

Identical field names to Oh My Pi. omo additionally emits turn_start, turn_end, agent_start, agent_settled, entry_appended, tool_hook_status, and message_update:text_start|text_end|toolcall_*; all are ignored, and a test pins that they stay ignored so a future mapping change is deliberate.

Both CLIs also write plain log lines to stdout next to the JSON; the reader already skips unparseable lines.

stdin must be closed

A headless run with inherited stdin produced zero bytes and timed out; the same command with < /dev/null exited 0 and streamed the events above. The spawn already uses stdio: ['ignore', 'pipe', 'pipe'], so this is satisfied — it is called out in a comment because it is silent and total when violated.

Capability matrix unchanged

supportsImages and supportsAbort stay false for omo, mirroring the existing deliberate Oh My Pi posture (implemented in the runtime, hidden in the matrix) rather than unilaterally enabling controls.

Verification

server/omo-cli.test.ts (6 tests) and the untouched omp-cli.test.ts (3 tests) pass together, which is what shows the extraction preserved behavior. Full gate: typecheck, lint, identity, server 917, client 262.

omo accepts the same non-interactive flags as Oh My Pi and emits the same JSON
event stream, so the runtime is extracted rather than copied: pi-cli.ts owns the
argv builder, the event normalizer, and the child lifecycle, and each CLI
supplies only a descriptor. omp-cli.ts keeps its public surface as thin wrappers
so existing callers and tests are untouched.

Contract confirmed by capturing a real run of each CLI, not by assuming
symmetry. omo emits session, message_update text/thinking deltas, and
tool_execution_start/end with identical field names, plus extra envelopes
(turn_start, agent_settled, tool_hook_status) and plain log lines on stdout,
which the reader already skips.

stdin must be closed. Both CLIs block forever on an inherited stdin: a headless
run produced zero bytes until stdin was /dev/null, which the existing
stdio: ['ignore', ...] spawn already satisfies.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@devswha
devswha merged commit 3da7a90 into main Aug 13, 2026
2 checks passed
@devswha
devswha deleted the feat/omo-send-runtime branch August 13, 2026 07:28
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