Files
Teknium 64d4862c3d refactor(acp): one edit-mode table for both ACP servers
gateway_session_meta.py copied HermesACPAgent._MODES and both policy maps.
The table now lives in acp_adapter/modes.py; server.py's class attributes
and the gateway path import it. No behavior change.

Refs #134889 (ACP-7)
2026-10-18 20:58:13 -07:00

19 lines
983 B
Python

"""ACP's edit modes, one table for the in-process server and the gateway path.
mode id -> (edit approval policy, display name, description). On the gateway path the policy is the
session's own on the owner (``session.mutate edit_policy``), enforced where the edit runs
(``gateway/session_local_editor.py``); sensitive paths always ask.
"""
DEFAULT_MODE = "default"
DEFAULT_EDIT_APPROVAL_POLICY = "ask"
EDIT_APPROVAL_POLICY_CONFIG_ID = "edit_approval_policy"
MODES: dict[str, tuple[str, str, str]] = {
"default": ("ask", "Default", "Ask before edits."),
"accept_edits": ("workspace_session", "Accept Edits",
"Auto-allow workspace and temp-dir edits; still asks for sensitive paths."),
"dont_ask": ("session", "Don't Ask", "Auto-allow file edits for this session except sensitive paths."),
}
MODE_TO_EDIT_APPROVAL_POLICY = {mode: spec[0] for mode, spec in MODES.items()}
EDIT_APPROVAL_POLICY_TO_MODE = {spec[0]: mode for mode, spec in MODES.items()}