ShellApprovalStorage#
Build extensions, choose hooks, and manage request-scoped state. See the guide.
- class zett_agent.extensions.shell_approval.ShellApprovalStorage(*args, **kwargs)[source]#
Persistence boundary for session policy and remembered commands.
- async get_session_mode(session_id)[source]#
Return the persisted approval policy for one session.
- Parameters:
session_id (str)
- Return type:
- async set_session_mode(session_id, mode)[source]#
Persist the approval policy for one session.
- Parameters:
session_id (str)
mode (ShellApprovalMode)
- Return type:
None
- async clear_session_mode(session_id)[source]#
Remove the persisted approval policy for one session.
- Parameters:
session_id (str)
- Return type:
None
- async is_allowed(session_id, command, work_dir=None)[source]#
Return whether one session permits execution of one exact command in one directory.
work_diris the directory the call named, orNonewhen it runs in the working directory. It is part of the question: the same command string can act on a different tree through it.It is the text the call named, not the path it resolves to, so
sub,./suband a symbolic link are three keys for one place. An entry stored beforework_direxisted was approved for the working directory, so it does not cover a call that names one.- Parameters:
session_id (str)
command (str)
work_dir (str | None)
- Return type:
bool