claudestream v0.14.2 /claudestream.policy
On this page

Sandbox and permission policy types for Claude Code sessions, defining allow, deny, and approval rules for tool execution requests.

#claudestream.policy

#claudestream.policy

Sandbox and permission policy types for Claude Code sessions, defining allow, deny, and approval rules for tool execution requests.

#Allow

Allow the tool to execute.

#Deny

Deny the tool execution.

#Sandbox

Declarative sandbox configuration for a Claude Code session.

Controls which tools are available, filesystem scope, and behavior flags.

#create_sandbox

python
def create_sandbox(*, tools: list[str] | None=None, bare: bool=False, write_paths: list[str] | None=None, log_violations: bool=False, skip_permissions: bool=False) -> Sandbox

Create a validated Sandbox configuration.

Raises:

  • ValueError: If any tool name is empty or not a string.

#sandbox_to_flags

python
def sandbox_to_flags(sandbox: Sandbox | None) -> list[str]

Convert a Sandbox to CLI flags for Claude Code.

None means no sandbox flags (use defaults).

#_resolve_path

python
def _resolve_path(path: str, cwd: str) -> str

Resolve a path to an absolute, symlink-free canonical form.

#_is_within

python
def _is_within(target: str, allowed: str) -> bool

Check if target is within allowed directory (both must be realpath'd).

Uses string-prefix comparison with a trailing separator to avoid '/src/foo' matching '/src/foobar'.

#sandbox_decide

python
def sandbox_decide(sandbox: Sandbox, tool_name: str, tool_input: dict, cwd: str) -> Allow | Deny

Decide whether a tool call is allowed under the given Sandbox.

The Sandbox is the complete authority -- this always returns Allow or Deny, never None.

Search