This commit is contained in:
63
src/cli.py
63
src/cli.py
@@ -5,6 +5,7 @@ import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from .agent import normalize_disabled_tools
|
||||
from .config import load_app_config
|
||||
from .models import RuntimeOptions
|
||||
from .runtime import create_openai_client, run_job
|
||||
@@ -40,8 +41,55 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
default=4,
|
||||
help="Compact model context every N steps to decay old screenshots (0 disables).",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--max-visual-context-images",
|
||||
type=int,
|
||||
default=3,
|
||||
help="Maximum screenshots/enhanced images retained in model-visible context during rebases.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--native-automation-mode",
|
||||
choices=["off", "prefer", "require_fallback"],
|
||||
default="prefer",
|
||||
help="How strongly the agent should prefer Windows-native automation helpers over pixel fallback.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dialog-timeout-seconds",
|
||||
type=float,
|
||||
default=12.0,
|
||||
help="Timeout for dialog-oriented waits and retries.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--focus-timeout-seconds",
|
||||
type=float,
|
||||
default=8.0,
|
||||
help="Timeout for focus-change waits and verification.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--ui-element-timeout-seconds",
|
||||
type=float,
|
||||
default=8.0,
|
||||
help="Timeout for native UI element lookup waits.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--max-retries-per-surface",
|
||||
type=int,
|
||||
default=3,
|
||||
help="Maximum repeated retries on the same classified window/dialog surface before the agent must pivot.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--pretty-logs",
|
||||
action="store_true",
|
||||
help="Emit expanded multi-line tool call/result logs for easier debugging.",
|
||||
)
|
||||
parser.add_argument("--disable-tool", action="append", default=[], help="Disable a tool by name.")
|
||||
parser.add_argument("--skip-safety-check", action="store_true", help="Bypass pre-flight safety check.")
|
||||
parser.add_argument(
|
||||
"--skip-safety-check",
|
||||
"--skip-safety-chec",
|
||||
dest="skip_safety_check",
|
||||
action="store_true",
|
||||
help="Bypass pre-flight safety check.",
|
||||
)
|
||||
parser.add_argument("--no-failsafe", action="store_true", help="Disable PyAutoGUI fail-safe.")
|
||||
return parser
|
||||
|
||||
@@ -57,7 +105,10 @@ def main(argv: list[str] | None = None) -> int:
|
||||
return 2
|
||||
|
||||
model = args.model or config.default_model
|
||||
disabled_tools = sorted({str(x).strip() for x in args.disable_tool if str(x).strip()})
|
||||
try:
|
||||
disabled_tools = normalize_disabled_tools(args.disable_tool)
|
||||
except ValueError as exc:
|
||||
parser.error(str(exc))
|
||||
|
||||
if not args.skip_safety_check:
|
||||
safety_client = create_openai_client(config.openai_api_key)
|
||||
@@ -92,7 +143,15 @@ def main(argv: list[str] | None = None) -> int:
|
||||
click_pause=args.click_pause,
|
||||
reasoning_effort=args.reasoning_effort,
|
||||
screen_context_decay_steps=max(0, int(args.screen_context_decay_steps)),
|
||||
max_visual_context_images=max(0, int(args.max_visual_context_images)),
|
||||
native_automation_mode=args.native_automation_mode,
|
||||
dialog_timeout_seconds=max(0.5, float(args.dialog_timeout_seconds)),
|
||||
focus_timeout_seconds=max(0.5, float(args.focus_timeout_seconds)),
|
||||
ui_element_timeout_seconds=max(0.5, float(args.ui_element_timeout_seconds)),
|
||||
max_retries_per_surface=max(1, int(args.max_retries_per_surface)),
|
||||
pretty_logs=bool(args.pretty_logs),
|
||||
disable_tools=set(disabled_tools),
|
||||
prohibited_key_combos=set(config.prohibited_key_combos),
|
||||
)
|
||||
try:
|
||||
result, artifacts = run_job(
|
||||
|
||||
Reference in New Issue
Block a user