Metadata-Version: 2.4
Name: codex-ipc
Version: 0.1.3
Summary: Add your description here
Requires-Python: >=3.12
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

# codex-ipc

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_ipc 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 vendored app-server SDK uses its normal runtime
resolver. Pass a `codex_app_server.AppServerConfig` as `app_server_config` when
you need full control over app-server launch arguments.

## TUI demo

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

```bash
uv run --extra tui codex-ipc-demo --codex-bin /opt/homebrew/bin/codex
```

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