Metadata-Version: 2.4
Name: codex-subagent-bridge
Version: 0.1.0
Summary: Optional Codex app-server bridge for daemon subagent execution.
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Provides-Extra: test
Requires-Dist: pytest>=8.0.0; extra == "test"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: ruff<1.0.0,>=0.11.0; extra == "dev"
Requires-Dist: mypy<2.0.0,>=1.13.0; extra == "dev"

# codex-subagent-bridge

Optional bridge module that satisfies the `codex_subagent_bridge.run_subagent(...)` contract used by the orchestration layer.

It launches `codex app-server --listen stdio://`, drives one structured turn, and returns the final payload as a Python `dict`.

## Installation

From the package root:

```bash
python -m pip install -e ".[dev]"
```

Current monorepo checkout:

```bash
cd /path/to/context-alt-text-monorepo/packages/codex-subagent-bridge
python -m pip install -e ".[dev]"
```

If you do not want to install it, add `src` to `PYTHONPATH` or inject `codex_subagent_bridge` into `sys.modules` from the host process.

## Development

Run package-local commands from the package root:

```bash
make lint-bridge
make fix-lint-bridge
make format-bridge
make mypy-bridge
make test-bridge
make check-bridge
```

Direct commands also work:

```bash
PYTHONPATH=src python -m ruff check src tests
PYTHONPATH=src python -m mypy src
PYTHONPATH=src python -m pytest tests -q
```

## Runtime Behavior

- The bridge keeps the existing seam: `prompt + schema + cwd + optional env -> dict`
- `env` values are treated as local runtime hints only and become subprocess or session context for `codex app-server`
- `CODEX_REASONING_EFFORT` or `REASONING_EFFORT` map to `turn/start.effort` when set to `low`, `medium`, `high`, or `xhigh`
- MCP endpoints and credentials are not forwarded through the bridge
- Build and test commands must still come from the worktree instruction surface or the rendered prompt
- `run_subagent()` is concurrency-safe because each default call launches and tears down its own app-server process
- `CODEX_SUBAGENT_BRIDGE_SESSION_MODE=shared` opts into a reusable app-server process for compatible calls in the same `cwd`

## Integration Note

This package is intentionally small. It provides the bridge seam only; higher-level orchestration policy belongs in the caller.
