Metadata-Version: 2.4
Name: open-codex-bridge
Version: 0.1.9
Summary: Python bridge for Codex app-server sessions and live conversation state
Requires-Python: >=3.12
Requires-Dist: openai-codex==0.144.4
Requires-Dist: pydantic>=2.12
Provides-Extra: tui
Requires-Dist: pillow>=12.2.0; extra == 'tui'
Requires-Dist: rich>=15.0.0; extra == 'tui'
Requires-Dist: textual>=8.2.5; extra == 'tui'
Description-Content-Type: text/markdown

# open-codex-bridge

Python facade for running Codex app-server sessions and sharing their live
conversation state over the Codex IPC owner/follower protocol.

## Library usage

```python
from pathlib import Path

from codex_bridge import CodexIpcConfig, CodexIpcSession


async def main() -> None:
    config = CodexIpcConfig(
        codex_bin=Path("/opt/homebrew/bin/codex"),
        host_id="local",
        model="gpt-5.4",
        reasoning_effort="high",
    )

    async with CodexIpcSession(config) as session:
        thread = await session.start_new_thread()
        print(f"started {thread.id}")

        async for state in session.watch_state():
            # Forward this raw conversation state to a browser over WebSocket.
            print(state)


async def resume_existing(thread_id: str) -> None:
    async with CodexIpcSession(CodexIpcConfig(thread_id=thread_id)) as session:
        await session.hydrate_initial_state()
        await session.run_prompt("Summarize the current repo", wait_for_completion=True)
```

If `codex_bin` is omitted, the Codex SDK uses its pinned runtime resolver.
Pass an `openai_codex.CodexConfig` as `codex_config` when
you need full control over app-server launch arguments.

## SSH app-server

SSH websocket transport is an `open-codex-bridge` extension, not part of the official
`openai-codex` SDK:

```python
from codex_bridge import (
    AppServerConfig,
    CodexIpcConfig,
    SshConnectionConfig,
    SshWebsocketAppServerConfig,
)

config = CodexIpcConfig(
    codex_config=AppServerConfig(
        ssh_websocket=SshWebsocketAppServerConfig(
            connection=SshConnectionConfig(host="builder.example.com"),
            remote_cwd="/srv/project",
        )
    )
)
```

The older `app_server_config` argument remains available as a compatibility
alias for existing consumers.

## TUI demo

The TUI is a development tool and is kept out of the core dependency set:

```bash
uv run --extra tui python examples/demo.py --codex-bin /opt/homebrew/bin/codex
```

Core imports such as `import codex_bridge` do not require `textual`, `rich`, or
`pillow`.
