fix(gateway): honor approval scope capabilities
This commit is contained in:
@@ -117,10 +117,17 @@ _BROWSER_CONTROL_PROTOCOL_VERSION = 1
|
||||
_BROWSER_CONTROL_WS_PROTOCOL = "hermes-browser-control-v1"
|
||||
_BROWSER_CONTROL_TICKET_PROTOCOL_PREFIX = "hermes-browser-control-ticket."
|
||||
|
||||
def _approval_event_choices(*, smart_denied: bool, allow_permanent: bool) -> list[str]:
|
||||
if smart_denied:
|
||||
|
||||
def _approval_event_choices(
|
||||
*, smart_denied: bool, allow_session: bool, allow_permanent: bool
|
||||
) -> list[str]:
|
||||
if smart_denied or not allow_session:
|
||||
return ["once", "deny"]
|
||||
return ["once", "session", "always", "deny"] if allow_permanent else ["once", "session", "deny"]
|
||||
return (
|
||||
["once", "session", "always", "deny"]
|
||||
if allow_permanent
|
||||
else ["once", "session", "deny"]
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
@@ -7750,6 +7757,7 @@ class APIServerAdapter(BasePlatformAdapter):
|
||||
"timestamp": time.time(),
|
||||
"choices": _approval_event_choices(
|
||||
smart_denied=bool(event.get("smart_denied")),
|
||||
allow_session=event.get("allow_session") is not False,
|
||||
allow_permanent=event.get("allow_permanent") is not False,
|
||||
),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user