feat: add exec-bridge model flag
This commit is contained in:
@@ -47,6 +47,7 @@ Optional flags:
|
|||||||
- `--codex-command-timeout FLOAT` (default: disabled, debug defaults to 60s)
|
- `--codex-command-timeout FLOAT` (default: disabled, debug defaults to 60s)
|
||||||
- `--codex-no-child-timeout FLOAT` (default `15.0`, set `0` to disable)
|
- `--codex-no-child-timeout FLOAT` (default `15.0`, set `0` to disable)
|
||||||
- `--workdir PATH` (override `codex_workspace`)
|
- `--workdir PATH` (override `codex_workspace`)
|
||||||
|
- `--model NAME` (pass through to `codex exec`)
|
||||||
|
|
||||||
## Option 2: MCP server
|
## Option 2: MCP server
|
||||||
|
|
||||||
|
|||||||
@@ -334,6 +334,11 @@ def run(
|
|||||||
"--workdir",
|
"--workdir",
|
||||||
help="Override codex workspace (--cd) for this exec-bridge run.",
|
help="Override codex workspace (--cd) for this exec-bridge run.",
|
||||||
),
|
),
|
||||||
|
model: Optional[str] = typer.Option(
|
||||||
|
None,
|
||||||
|
"--model",
|
||||||
|
help="Codex model to pass to `codex exec`.",
|
||||||
|
),
|
||||||
) -> None:
|
) -> None:
|
||||||
setup_file_logger(log_file if log_file else None)
|
setup_file_logger(log_file if log_file else None)
|
||||||
config = load_telegram_config()
|
config = load_telegram_config()
|
||||||
@@ -354,6 +359,25 @@ def run(
|
|||||||
else:
|
else:
|
||||||
extra_args = shlex.split(str(raw_exec_args)) # e.g. "--full-auto --search"
|
extra_args = shlex.split(str(raw_exec_args)) # e.g. "--full-auto --search"
|
||||||
|
|
||||||
|
def _strip_model_args(args: list[str]) -> list[str]:
|
||||||
|
stripped: list[str] = []
|
||||||
|
i = 0
|
||||||
|
while i < len(args):
|
||||||
|
arg = args[i]
|
||||||
|
if arg in ("--model", "-m"):
|
||||||
|
i += 2
|
||||||
|
continue
|
||||||
|
if arg.startswith("--model=") or arg.startswith("-m="):
|
||||||
|
i += 1
|
||||||
|
continue
|
||||||
|
stripped.append(arg)
|
||||||
|
i += 1
|
||||||
|
return stripped
|
||||||
|
|
||||||
|
if model:
|
||||||
|
extra_args = _strip_model_args(extra_args)
|
||||||
|
extra_args.extend(["--model", model])
|
||||||
|
|
||||||
def _has_notify_override(args: list[str]) -> bool:
|
def _has_notify_override(args: list[str]) -> bool:
|
||||||
for i, arg in enumerate(args):
|
for i, arg in enumerate(args):
|
||||||
if arg in ("-c", "--config"):
|
if arg in ("-c", "--config"):
|
||||||
|
|||||||
Reference in New Issue
Block a user