diff --git a/README.md b/README.md index 5ae71fd3e..cb130a280 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Each Telegram topic maps to one tmux window. With Herdr, it maps instead to one ## What You Can Do - **Start from one line** — `codex ccgram fix the hook timeout` creates the session, binds the topic, and forwards the instruction; `/bind` adopts an already-running window -- **Auto-detect providers** — Supports Claude Code, Codex, Gemini, Pi, and Shell simultaneously +- **Auto-detect providers** — Supports Claude Code, Codex, Gemini, Pi, omo, and Shell simultaneously - **Monitor live** — Terminal screenshots on demand or auto-refresh every 5 seconds - **Topic-aware command panels** — Four safe General controls; session-specific CCGram actions and original agent command names in each topic - **Send commands** — Slash commands, voice messages (transcribed via Whisper), or raw shell input diff --git a/docs/providers.md b/docs/providers.md index 0b6badd0f..713bffd7c 100644 --- a/docs/providers.md +++ b/docs/providers.md @@ -334,6 +334,44 @@ The automatic menu above is the primary control; the toolbar remains a fallback: Override with a `[providers.pi]` block in `~/.ccgram/toolbar.toml`. +## omo + +[omo](https://github.com/) is an omo-ai distribution built on +`@code-yeongyu/senpi`, a Pi fork. Its sessions, TUI parser and Telegram command +list are shared with Pi, so CCGram serves both through the same code path. + +Unlike Pi, omo ships no `cc-thingz` hook runner: CCGram marks the provider as +hook-less (`ccgram doctor` reports "hook check skipped") and relies on transcript +scanning only. State lives under `~/.omo/agent`; the agent directory is resolved +from `OMO_CODING_AGENT_DIR`, then `SENPI_CODING_AGENT_DIR`, then +`PI_CODING_AGENT_DIR`, matching omo's own resolution order. + +### Launch + +The default command is `omo`; override it with `CCGRAM_OMO_COMMAND`. YOLO mode +appends `--permission-preset full-access`, which omo needs to run unattended - +without it the agent waits on approval prompts Telegram cannot answer. + +### Detection + +The omo launcher is a JS entry point, so tmux reports `bun` as the pane command. +CCGram therefore asks for the pane title on `bun`/`node` panes and matches omo's +window title (`OmO - `); a process literally named `omo`, and the +`@code-yeongyu/senpi` path markers used by the agterm backend, are recognised as +well. + +### Transcript + +`~/.omo/agent/sessions/----/_.jsonl`, with the same +JSONL v3 header as Pi. Resume uses `--session `, and `--continue` +serves the Continue button. + +### Model selection + +`/model` in omo prints the model list into the transcript instead of opening a +modal selector, so it is not advertised as a TUI picker; pin the model in the +launch command when a specific one is required. + ## Shell The shell provider opens a plain shell session in tmux. It has no hooks, no transcript, and no resume/continue support — shell sessions are ephemeral. diff --git a/src/ccgram/config.py b/src/ccgram/config.py index efed4ca07..14547d8dc 100644 --- a/src/ccgram/config.py +++ b/src/ccgram/config.py @@ -29,6 +29,7 @@ "antigravity", "claude", "codex", + "omo", "pi", "shell", ) diff --git a/src/ccgram/handlers/agent_command.py b/src/ccgram/handlers/agent_command.py index 4e77f93f0..d1f49276d 100644 --- a/src/ccgram/handlers/agent_command.py +++ b/src/ccgram/handlers/agent_command.py @@ -51,7 +51,7 @@ _BUTTONS_PER_ROW = 3 # Stable order also defines the provider-button layout; labels stay in one place. -_PROVIDER_ORDER = ("antigravity", "claude", "codex", "gemini", "pi", "shell") +_PROVIDER_ORDER = ("antigravity", "claude", "codex", "gemini", "omo", "pi", "shell") _VALID_NAMES = frozenset(_PROVIDER_ORDER) | {"auto"} diff --git a/src/ccgram/handlers/commands/forward.py b/src/ccgram/handlers/commands/forward.py index 44446b11e..273e23bf6 100644 --- a/src/ccgram/handlers/commands/forward.py +++ b/src/ccgram/handlers/commands/forward.py @@ -29,6 +29,7 @@ get_provider_for_window, ) from ... import window_query +from ...providers.pi import PI_LIKE_PROVIDERS from ...telegram_client import PTBTelegramClient from ...window_state_store import window_store from ...thread_router import thread_router @@ -99,7 +100,10 @@ def _default_command_args(cc_name: str, args: str, display: str) -> str: def _provider_command_name(provider_name: str, cc_name: str) -> str: """Apply provider-specific compatibility aliases before forwarding.""" - if provider_name == "pi" and cc_name.lower() == _PI_CLEAR_ALIAS_COMMAND: + if ( + provider_name in PI_LIKE_PROVIDERS + and cc_name.lower() == _PI_CLEAR_ALIAS_COMMAND + ): return _PI_NEW_COMMAND return cc_name @@ -111,7 +115,7 @@ def _is_session_reset_command(provider_name: str, cc_slash: str) -> bool: if len(parts) > 1: return False return command == _PI_CLEAR_ALIAS_COMMAND or ( - provider_name == "pi" and command == _PI_NEW_COMMAND + provider_name in PI_LIKE_PROVIDERS and command == _PI_NEW_COMMAND ) @@ -327,7 +331,7 @@ async def forward_command_handler( cc_slash = f"/{cc_name} {args}".rstrip() if args else f"/{cc_name}" status_like = cc_name.lower() in {"status", "stats"} - if provider_name == "pi" and cc_name.lower() == _PI_FOLLOWUP_COMMAND: + if provider_name in PI_LIKE_PROVIDERS and cc_name.lower() == _PI_FOLLOWUP_COMMAND: await _handle_pi_followup_command( update.message, user.id, diff --git a/src/ccgram/providers/__init__.py b/src/ccgram/providers/__init__.py index f46fe6f8f..5c2b177f9 100644 --- a/src/ccgram/providers/__init__.py +++ b/src/ccgram/providers/__init__.py @@ -37,6 +37,9 @@ "claude": "--dangerously-skip-permissions", "codex": "--dangerously-bypass-approvals-and-sandbox", "gemini": "--yolo", + # ccgram launches in yolo mode by default; without this flag omo would + # stop on approval prompts nobody can answer from Telegram. + "omo": "--permission-preset full-access", } @@ -125,6 +128,9 @@ def _ensure_registered() -> None: # Lazy: provider classes register against the registry at import; defer until the registry factory runs from ccgram.providers.gemini import GeminiProvider + # Lazy: provider classes register against the registry at import; defer until the registry factory runs + from ccgram.providers.omo import OmoProvider + # Lazy: provider classes register against the registry at import; defer until the registry factory runs from ccgram.providers.pi import PiProvider @@ -135,6 +141,7 @@ def _ensure_registered() -> None: registry.register("claude", ClaudeProvider) registry.register("codex", CodexProvider) registry.register("gemini", GeminiProvider) + registry.register("omo", OmoProvider) registry.register("pi", PiProvider) registry.register("shell", ShellProvider) _registered = True @@ -249,7 +256,7 @@ def detect_provider_from_command(pane_current_command: str) -> str: # Match basename only (first token) to avoid false positives # from paths like /home/claude/bin/vim basename = os.path.basename(cmd.split()[0]) - for name in ("antigravity", "claude", "codex", "gemini", "pi"): + for name in ("antigravity", "claude", "codex", "gemini", "omo", "pi"): if ( basename == name or (name == "antigravity" and basename == "agy") @@ -300,8 +307,12 @@ def detect_provider_from_transcript_path(transcript_path: str) -> str: return "claude" if "/.gemini/" in normalized and "/chats/" in normalized: return "gemini" - if "/.pi/agent/sessions/" in normalized: - return "pi" + for marker, provider in ( + ("/.omo/agent/sessions/", "omo"), + ("/.pi/agent/sessions/", "pi"), + ): + if marker in normalized: + return provider return "" diff --git a/src/ccgram/providers/omo.py b/src/ccgram/providers/omo.py new file mode 100644 index 000000000..d492c7d54 --- /dev/null +++ b/src/ccgram/providers/omo.py @@ -0,0 +1,241 @@ +"""omo coding agent provider — omo-ai on top of @code-yeongyu/senpi. + +omo is a senpi (pi fork) distribution: it keeps pi's JSONL v3 session format +but stores state under ``~/.omo/agent`` and reports a different TUI title. +Everything non-obvious is therefore inherited: session discovery, the +``--session``/``--continue`` resume flags and the TUI parser all come from +PiProvider; this module only overrides identity, state location and the +detection hints a window started as a JS interpreter needs. + +Session path: ``~/.omo/agent/sessions/----/_.jsonl`` + +State directory resolution mirrors omo itself +(``omo-ai/bin/lib/agent-dir.js``): ``OMO_CODING_AGENT_DIR`` → +``SENPI_CODING_AGENT_DIR`` → ``PI_CODING_AGENT_DIR`` → ``~/.omo/agent``. +``OMO_AGENT_DIR`` is *not* part of that chain — it addresses the omo daemon, +not the session store. + +Detection: when omo is launched from its bin shim, tmux reports +``pane_current_command=bun`` (the CLI is JS). The basename tables therefore +cannot name it; the pane title set by omo's TUI (``OmO - ``) can. +``requires_pane_title_for_detection`` asks the caller to fetch the title for +interpreter processes and ``detect_from_pane_title`` performs the match. +""" + +from __future__ import annotations + +import json +import os +from dataclasses import replace +from pathlib import Path + +from ccgram.providers.base import SessionStartEvent +from ccgram.providers.pi import PiProvider, encode_cwd_dirname, provider_sessions_dir + +# Mirrors omo's own resolution order (omo-ai/bin/lib/agent-dir.js). +_AGENT_DIR_ENV = "OMO_CODING_AGENT_DIR" +_AGENT_DIR_FALLBACKS = ("SENPI_CODING_AGENT_DIR", "PI_CODING_AGENT_DIR") + +#: Interpreters that can host a JS agent CLI. A pane whose foreground +#: process is one of these needs the pane title to tell the agents apart. +_INTERPRETER_BASENAMES = frozenset({"bun", "bunx", "node", "npx"}) + +#: omo's TUI window title starts with this marker (observed: "OmO - "). +_TITLE_PREFIX = "omo" + +#: How far up the process tree to look for the pane's shell when matching a +#: session holder; omo runs as a direct child of the pane shell. +_MAX_PARENT_HOPS = 8 + +#: Clock skew allowance when comparing a holder's recorded process start with +#: the live process start; anything larger means the pid was reused. +_START_TIME_TOLERANCE_MS = 5000 + + +def _pane_pids(window_key: str) -> set[int]: + """Return the pane pids of ``window_key`` (``ccgram:@N``), empty on failure.""" + window_id = window_key.rsplit(":", 1)[-1] + try: + # Lazy: the multiplexer is wired by bootstrap and absent in imports. + from ccgram.multiplexer import get_multiplexer + + session = get_multiplexer("tmux").get_session() + window = ( + session.windows.get(window_id=window_id, default=None) if session else None + ) + except (RuntimeError, OSError, AttributeError): # fmt: skip + return set() + pids: set[int] = set() + for pane in window.panes if window is not None else []: + try: + pids.add(int(pane.pane_pid)) + except (TypeError, ValueError): # fmt: skip + continue + return pids + + +def _holder_pid_map(sessions_dir: Path) -> dict[int, str]: + """Map pid → session id from omo's ``session-holders//.json``. + + Holder files outlive their process, and Linux reuses pids, so an entry is + only trusted when the live process started when the holder says it did. + """ + holders: dict[int, str] = {} + try: + entries = sessions_dir.glob("*/session-holders/*/*.json") + except OSError: + return holders + for entry in entries: + try: + payload = json.loads(entry.read_text()) + pid = int(payload.get("pid", 0)) + recorded_start = int(payload.get("processStartedAtMs", 0)) + except (OSError, ValueError, TypeError): # fmt: skip + continue + if pid <= 0: + continue + live_start = _process_started_ms(pid) + if live_start is None: + continue + if ( + recorded_start + and abs(live_start - recorded_start) > _START_TIME_TOLERANCE_MS + ): + continue + holders[pid] = entry.parent.name + return holders + + +def _process_started_ms(pid: int) -> int | None: + """Return when ``pid`` started, in ms since the epoch, or None if gone.""" + try: + stat = Path(f"/proc/{pid}/stat").read_text() + boot = next( + int(line.split()[1]) + for line in Path("/proc/stat").read_text().splitlines() + if line.startswith("btime") + ) + except (OSError, ValueError, StopIteration): # fmt: skip + return None + fields = stat[stat.rfind(")") + 2 :].split() + try: + start_ticks = int(fields[19]) + except (IndexError, ValueError): # fmt: skip + return None + return boot * 1000 + int(start_ticks * 1000 / os.sysconf("SC_CLK_TCK")) + + +def _descends_from(pid: int, ancestors: set[int]) -> bool: + """Return whether ``pid`` or one of its parents is in ``ancestors``.""" + current = pid + for _ in range(_MAX_PARENT_HOPS): + if current in ancestors: + return True + try: + status = Path(f"/proc/{current}/status").read_text() + except OSError: + return False + parent = 0 + for line in status.splitlines(): + if line.startswith("PPid:"): + parent = int(line.split()[1]) + break + if parent <= 1 or parent == current: + return False + current = parent + return False + + +class OmoProvider(PiProvider): + """AgentProvider implementation for the omo coding agent CLI.""" + + def _sessions_dir(self) -> Path: + return provider_sessions_dir( + (_AGENT_DIR_ENV, *_AGENT_DIR_FALLBACKS), (".omo", "agent") + ) + + _CAPS = replace( + PiProvider._CAPS, + name="omo", + launch_command="omo", + # omo ships no cc-thingz hook runner; the transcript is the only + # status source, exactly like a hookless pi. + supports_hook=False, + hook_install_managed_by_ccgram=False, + # `/model` in omo prints a list into the transcript instead of + # opening a modal picker, so advertising it would offer a picker that + # cannot be driven. The owner only needs the default model anyway. + tui_picker_commands=frozenset( + name for name in PiProvider._CAPS.tui_picker_commands if name != "model" + ), + ) + + # ── Exact window → session binding ─────────────────────────────────── + + def discover_transcript( + self, + cwd: str, + window_key: str, + *, + max_age: float | None = None, + ) -> SessionStartEvent | None: + """Bind the window to the session its own process holds. + + Newest-file discovery is ambiguous whenever another omo process writes + into the same cwd (probes, cron runs, a second window): the newest + transcript may belong to nobody in this window, and the topic then + tracks a file that never grows. omo records ownership as + ``session-holders//.json``, so the pane's process tree + names the session exactly. Fall back to the inherited scan when the + holder is absent (older omo builds, foreign launchers). + """ + exact = self._session_for_window(cwd, window_key) + if exact is not None: + return exact + return super().discover_transcript(cwd, window_key, max_age=max_age) + + def _session_for_window( + self, cwd: str, window_key: str + ) -> SessionStartEvent | None: + """Return the session held by this window's process tree, if any.""" + panes = _pane_pids(window_key) + if not panes: + return None + sessions_dir = self._sessions_dir() + session_dir = sessions_dir / encode_cwd_dirname(cwd) + for pid, session_id in _holder_pid_map(sessions_dir).items(): + if not _descends_from(pid, panes): + continue + matches = sorted(session_dir.glob(f"*{session_id}.jsonl")) + if not matches: + continue + return SessionStartEvent( + session_id=session_id, + cwd=cwd, + transcript_path=str(matches[-1]), + window_key=window_key, + ) + return None + + # ── Detection hints ────────────────────────────────────────────────── + + @staticmethod + def _is_interpreter(pane_current_command: str) -> bool: + command = pane_current_command.strip().lower() + if not command: + return False + basename = command.split()[0].rsplit("/", 1)[-1] + return basename in _INTERPRETER_BASENAMES + + def requires_pane_title_for_detection(self, pane_current_command: str) -> bool: + """A bun/node pane may be pi, omo or something else — ask the title.""" + return self._is_interpreter(pane_current_command) + + def detect_from_pane_title( + self, pane_current_command: str, pane_title: str + ) -> bool: + """Match omo's TUI title (``OmO - ``) on interpreter panes.""" + if not self._is_interpreter(pane_current_command): + return False + title = " ".join(pane_title.split()).lower() + return title.startswith(_TITLE_PREFIX) diff --git a/src/ccgram/providers/pi.py b/src/ccgram/providers/pi.py index eda200fb6..d4ef0f432 100644 --- a/src/ccgram/providers/pi.py +++ b/src/ccgram/providers/pi.py @@ -55,6 +55,10 @@ def _pi_sessions_dir() -> Path: # How many recent session files to inspect when searching for a cwd match. _DISCOVERY_SCAN_LIMIT = 20 +#: Providers that share pi's transcript format and follow-up input contract. +#: Kept here so session_protocol modules import one authority, not copies. +PI_LIKE_PROVIDERS: frozenset[str] = frozenset({"pi", "omo"}) + def encode_cwd_dirname(cwd: str) -> str: """Encode a working directory into pi's session subdirectory name. @@ -72,7 +76,12 @@ def encode_cwd_dirname(cwd: str) -> str: def _candidate_transcripts(cwd: str) -> list[tuple[float, Path]]: """Return ``(mtime, path)`` tuples for this cwd's sessions, newest first.""" - session_dir = _pi_sessions_dir() / encode_cwd_dirname(cwd) + return _scan_sessions(_pi_sessions_dir(), cwd) + + +def _scan_sessions(sessions_dir: Path, cwd: str) -> list[tuple[float, Path]]: + """List the JSONL transcripts for ``cwd`` under ``sessions_dir``, newest first.""" + session_dir = sessions_dir / encode_cwd_dirname(cwd) if not session_dir.is_dir(): return [] results: list[tuple[float, Path]] = [] @@ -90,9 +99,28 @@ def _candidate_transcripts(cwd: str) -> list[tuple[float, Path]]: return results +def provider_sessions_dir( + env_names: tuple[str, ...], default_parts: tuple[str, ...] +) -> Path: + """Resolve ``/sessions`` for forks that do not use pi's env name.""" + for name in env_names: + configured = os.environ.get(name) + if configured and configured.strip(): + return Path(configured.strip()).expanduser() / "sessions" + return Path.home().joinpath(*default_parts) / "sessions" + + class PiProvider(JsonlProvider): """AgentProvider implementation for the pi coding agent CLI.""" + def _sessions_dir(self) -> Path: + """Pi's session directory; module-level seam kept for tests and forks.""" + return _pi_sessions_dir() + + def _candidate_transcripts(self, cwd: str) -> list[tuple[float, Path]]: + """Return ``(mtime, path)`` tuples for this cwd's sessions, newest first.""" + return _scan_sessions(self._sessions_dir(), cwd) + _CAPS = ProviderCapabilities( name="pi", launch_command="pi", @@ -169,7 +197,7 @@ def discover_transcript( except OSError: return None - for mtime, path in _candidate_transcripts(cwd)[:_DISCOVERY_SCAN_LIMIT]: + for mtime, path in self._candidate_transcripts(cwd)[:_DISCOVERY_SCAN_LIMIT]: if age_limit > 0 and now - mtime > age_limit: break header = read_session_header(str(path)) diff --git a/src/ccgram/providers/process_detection.py b/src/ccgram/providers/process_detection.py index c8897bd32..0f820460c 100644 --- a/src/ccgram/providers/process_detection.py +++ b/src/ccgram/providers/process_detection.py @@ -49,6 +49,7 @@ (frozenset({"claude", "ce", "cc-mirror", "zai"}), "claude"), (frozenset({"codex"}), "codex"), (frozenset({"gemini"}), "gemini"), + (frozenset({"omo"}), "omo"), (frozenset({"pi"}), "pi"), ) @@ -59,6 +60,9 @@ (("claude-code", "cc-team"), "claude"), (("@openai/codex", "/codex/", "/codex-"), "codex"), (("gemini-cli",), "gemini"), + # omo ships as a JS CLI under @code-yeongyu/senpi with its plugin package; + # the bin shim re-execs under bun, so only the path identifies it. + (("@code-yeongyu/senpi", "/senpi/", "/omo-ai/"), "omo"), (("@mariozechner/pi-coding-agent", "/pi-coding-agent/"), "pi"), ) @@ -92,8 +96,8 @@ def classify_provider_from_argv(argv: Sequence[str]) -> str: Skips wrapper tokens (``node``, ``bun``, ``sudo``, …) and matches the first meaningful token against known provider names or path markers. - Returns provider name (``"claude"``, ``"codex"``, ``"gemini"``, ``"pi"``, - ``"shell"``) or empty string if unrecognised. + Returns provider name (``"claude"``, ``"codex"``, ``"gemini"``, ``"omo"``, + ``"pi"``, ``"shell"``) or empty string if unrecognised. """ for token in argv: cleaned = os.path.basename(token).lower().lstrip("-") diff --git a/src/ccgram/session_map.py b/src/ccgram/session_map.py index 7f0b7b158..01795f389 100644 --- a/src/ccgram/session_map.py +++ b/src/ccgram/session_map.py @@ -34,6 +34,7 @@ import aiofiles from .config import config +from .providers.pi import PI_LIKE_PROVIDERS from .herdr_targets import is_herdr_session_target from .hooks.state_files import StateFileValidationError, parse_session_map_entry from .utils import atomic_write_json, log_throttle_reset, log_throttled @@ -887,7 +888,7 @@ def write_hookless_session_map( pending_key = pending_pi_replay_key(session_id) existing = session_map.get(window_key) - replay_from_start = provider_name == "pi" and ( + replay_from_start = provider_name in PI_LIKE_PROVIDERS and ( pending_key in session_map or ( isinstance(existing, dict) diff --git a/src/ccgram/session_protocol/actions.py b/src/ccgram/session_protocol/actions.py index 34e8358dc..897acde84 100644 --- a/src/ccgram/session_protocol/actions.py +++ b/src/ccgram/session_protocol/actions.py @@ -11,6 +11,7 @@ from typing import TYPE_CHECKING, Any from uuid import UUID +from ..providers.pi import PI_LIKE_PROVIDERS from .backend import Target from .input_lock import input_lock from .models import ( @@ -393,7 +394,11 @@ def _validate_action_capability( "unsupported_action", "Session does not support this action", ) - if internal and action.kind == "message.followup" and target.provider != "pi": + if ( + internal + and action.kind == "message.followup" + and target.provider not in PI_LIKE_PROVIDERS + ): raise ProtocolError( 422, "unsupported_action", diff --git a/src/ccgram/session_protocol/backend.py b/src/ccgram/session_protocol/backend.py index 6116c8d61..c9ad7a914 100644 --- a/src/ccgram/session_protocol/backend.py +++ b/src/ccgram/session_protocol/backend.py @@ -21,6 +21,7 @@ resolve_launch_command, TerminalMenu, ) +from ..providers.pi import PI_LIKE_PROVIDERS from ..providers.process_detection import classify_provider_from_argv from ..providers.shell_infra import KNOWN_SHELLS, match_prompt from ..window_state_ports import identity_state @@ -36,6 +37,12 @@ ) from .models import ProtocolError, Status, utc_now +#: Providers whose transcripts feed structured history. pi-family forks share +#: pi's JSONL format, so they join the literal set without a second table. +_TRANSCRIPT_HISTORY_PROVIDERS: frozenset[str] = ( + frozenset({"claude", "codex", "gemini", "antigravity"}) | PI_LIKE_PROVIDERS +) + logger = logging.getLogger(__name__) _CREATION_UNCONFIRMED = ( @@ -215,7 +222,7 @@ async def _target( else "" ) transcript = identity.transcript_path if conversation_id and identity else None - if history_provider not in {"claude", "codex", "gemini", "pi", "antigravity"}: + if history_provider not in _TRANSCRIPT_HISTORY_PROVIDERS: transcript = None panes = await self.mux.list_panes(window.window_id) active = next((p for p in panes if p.active), None) @@ -380,7 +387,7 @@ async def send_key(self, target: Target, key: str) -> bool: return await self.mux.send(target.id, key, enter=False, literal=False, raw=True) async def send_followup(self, target: Target, text: str) -> bool: - if target.provider != "pi": + if target.provider not in PI_LIKE_PROVIDERS: raise ProtocolError( 422, "unsupported_action", diff --git a/src/ccgram/session_protocol/messages.py b/src/ccgram/session_protocol/messages.py index 7d0732f07..edf682ebd 100644 --- a/src/ccgram/session_protocol/messages.py +++ b/src/ccgram/session_protocol/messages.py @@ -14,6 +14,7 @@ from datetime import UTC, datetime from typing import Any +from ..providers.pi import PI_LIKE_PROVIDERS from .models import Message, Part _PART_FIELDS = frozenset(part_field.name for part_field in fields(Part)) - {"id"} @@ -508,7 +509,11 @@ def _chat(entry: SourceEntry, provider: str) -> TranscriptRecord | None: if role not in _CHAT_ROLES: return None parts, results = _content(msg.get("content")) - if provider == "pi" and role == "assistant" and msg.get("stopReason") == "error": + if ( + provider in PI_LIKE_PROVIDERS + and role == "assistant" + and msg.get("stopReason") == "error" + ): error_message = msg.get("errorMessage") error_text = ( error_message.strip() @@ -807,7 +812,7 @@ def parse_records( else _claude(entry, parser_state) if provider == "claude" else _pi(entry) - if provider == "pi" + if provider in PI_LIKE_PROVIDERS else None ) if record is None or record.role not in {"user", "agent"}: diff --git a/src/ccgram/toolbar_config.py b/src/ccgram/toolbar_config.py index 475600bf1..a1f52eaeb 100644 --- a/src/ccgram/toolbar_config.py +++ b/src/ccgram/toolbar_config.py @@ -228,6 +228,15 @@ def _b( ("last", "getfile", "close"), ), ), + "omo": ToolbarLayout( + style="emoji_text", + buttons=( + ("screen", "ctrlc", "live"), + ("esc", "tab", "model"), + ("up", "enter", "down"), + ("last", "getfile", "close"), + ), + ), "pi": ToolbarLayout( style="emoji_text", buttons=(