Repository navigation
Expand file tree
/
Copy pathexecution_options.py
More file actions
64 lines (49 loc) · 1.85 KB
/
Copy pathexecution_options.py
File metadata and controls
64 lines (49 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""Shared command-line options for selecting an LLM execution profile."""
from __future__ import annotations
import argparse
from core.domain.execution_security import ExecutionAccessPreset
def add_reasoning_effort_argument(parser: argparse.ArgumentParser) -> None:
"""Add the model-aware reasoning override used by every CLI surface.
The accepted levels are intentionally not an argparse ``choices`` list:
providers advertise their own capabilities at runtime, and the shared
execution-profile resolver is the single authority that validates them.
"""
parser.add_argument(
"--effort",
dest="reasoning_effort",
default=None,
metavar="LEVEL",
help=(
"Reasoning effort for this session/command: auto, off, or a "
"level supported by the selected model."
),
)
def add_access_preset_argument(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--access",
choices=("ask", "read-only", "full-access"),
default=None,
help=(
"Tool access for this command: ask, read-only, or full-access. "
"Full access disables approvals and the workspace sandbox."
),
)
def add_workspace_trust_argument(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--trust",
action="store_true",
help=(
"Trust this canonical workspace for agent execution and remember "
"the decision. This does not grant Full access."
),
)
def parse_access_preset(value: str | None) -> ExecutionAccessPreset | None:
if value is None:
return None
return ExecutionAccessPreset(value.replace("-", "_"))
__all__ = [
"add_access_preset_argument",
"add_reasoning_effort_argument",
"add_workspace_trust_argument",
"parse_access_preset",
]