Options accepted by :func:`run_headless`. Kept as a plain dataclass (no Click/argparse coupling) so the CLI layer and tests can construct it independently.
| 70 | |
| 71 | @dataclass |
| 72 | class HeadlessOptions: |
| 73 | """Options accepted by :func:`run_headless`. |
| 74 | |
| 75 | Kept as a plain dataclass (no Click/argparse coupling) so the CLI layer |
| 76 | and tests can construct it independently. |
| 77 | """ |
| 78 | |
| 79 | prompt: str | None = None |
| 80 | output_format: str = "text" |
| 81 | input_format: str = "text" |
| 82 | provider_name: str | None = None |
| 83 | model: str | None = None |
| 84 | max_turns: int = 20 |
| 85 | # ``skip_permissions`` is a backward-compat alias for the boolean form |
| 86 | # of ``--dangerously-skip-permissions``. ``permission_mode`` and |
| 87 | # ``is_bypass_permissions_mode_available`` were added in round 5 to |
| 88 | # mirror the TS reference's resolved state. When ``skip_permissions`` |
| 89 | # is True we treat it as ``permission_mode='bypassPermissions'`` and |
| 90 | # ``is_bypass_permissions_mode_available=True``. |
| 91 | skip_permissions: bool = False |
| 92 | permission_mode: str = "default" |
| 93 | is_bypass_permissions_mode_available: bool = False |
| 94 | allowed_tools: tuple[str, ...] = () |
| 95 | disallowed_tools: tuple[str, ...] = () |
| 96 | include_partial_messages: bool = False |
| 97 | verbose: bool = False |
| 98 | |
| 99 | # Mostly for tests: override streams so we can capture output. |
| 100 | stdin: IO[str] | None = None |
| 101 | stdout: IO[str] | None = None |
| 102 | stderr: IO[str] | None = None |
| 103 | |
| 104 | # Workspace root override (default: cwd). |
| 105 | workspace_root: Path | None = None |
| 106 | |
| 107 | |
| 108 | def run_headless(options: HeadlessOptions) -> int: |
no outgoing calls