Class: ClaudeAgentSDK::SandboxSettings
- Inherits:
-
Object
- Object
- ClaudeAgentSDK::SandboxSettings
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Sandbox settings for isolated command execution
Instance Attribute Summary collapse
-
#allow_unsandboxed_commands ⇒ Object
Returns the value of attribute allow_unsandboxed_commands.
-
#auto_allow_bash_if_sandboxed ⇒ Object
Returns the value of attribute auto_allow_bash_if_sandboxed.
-
#enable_weaker_nested_sandbox ⇒ Object
Returns the value of attribute enable_weaker_nested_sandbox.
-
#enable_weaker_network_isolation ⇒ Object
Returns the value of attribute enable_weaker_network_isolation.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#excluded_commands ⇒ Object
Returns the value of attribute excluded_commands.
-
#fail_if_unavailable ⇒ Object
Returns the value of attribute fail_if_unavailable.
-
#filesystem ⇒ Object
Returns the value of attribute filesystem.
-
#ignore_violations ⇒ Object
Returns the value of attribute ignore_violations.
-
#network ⇒ Object
Returns the value of attribute network.
-
#ripgrep ⇒ Object
Returns the value of attribute ripgrep.
Instance Method Summary collapse
-
#initialize(enabled: nil, fail_if_unavailable: nil, auto_allow_bash_if_sandboxed: nil, excluded_commands: nil, allow_unsandboxed_commands: nil, network: nil, filesystem: nil, ignore_violations: nil, enable_weaker_nested_sandbox: nil, enable_weaker_network_isolation: nil, ripgrep: nil) ⇒ SandboxSettings
constructor
A new instance of SandboxSettings.
- #to_h ⇒ Object
Constructor Details
#initialize(enabled: nil, fail_if_unavailable: nil, auto_allow_bash_if_sandboxed: nil, excluded_commands: nil, allow_unsandboxed_commands: nil, network: nil, filesystem: nil, ignore_violations: nil, enable_weaker_nested_sandbox: nil, enable_weaker_network_isolation: nil, ripgrep: nil) ⇒ SandboxSettings
Returns a new instance of SandboxSettings.
1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 |
# File 'lib/claude_agent_sdk/types.rb', line 1661 def initialize( enabled: nil, fail_if_unavailable: nil, auto_allow_bash_if_sandboxed: nil, excluded_commands: nil, allow_unsandboxed_commands: nil, network: nil, filesystem: nil, ignore_violations: nil, enable_weaker_nested_sandbox: nil, enable_weaker_network_isolation: nil, ripgrep: nil ) @enabled = enabled @fail_if_unavailable = fail_if_unavailable @auto_allow_bash_if_sandboxed = auto_allow_bash_if_sandboxed @excluded_commands = excluded_commands # Array of commands to exclude @allow_unsandboxed_commands = allow_unsandboxed_commands @network = network # SandboxNetworkConfig instance @filesystem = filesystem # SandboxFilesystemConfig instance @ignore_violations = ignore_violations # Hash of { category => [patterns] } @enable_weaker_nested_sandbox = enable_weaker_nested_sandbox @enable_weaker_network_isolation = enable_weaker_network_isolation # macOS only @ripgrep = ripgrep # Hash with :command and optional :args end |
Instance Attribute Details
#allow_unsandboxed_commands ⇒ Object
Returns the value of attribute allow_unsandboxed_commands.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def allow_unsandboxed_commands @allow_unsandboxed_commands end |
#auto_allow_bash_if_sandboxed ⇒ Object
Returns the value of attribute auto_allow_bash_if_sandboxed.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def auto_allow_bash_if_sandboxed @auto_allow_bash_if_sandboxed end |
#enable_weaker_nested_sandbox ⇒ Object
Returns the value of attribute enable_weaker_nested_sandbox.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def enable_weaker_nested_sandbox @enable_weaker_nested_sandbox end |
#enable_weaker_network_isolation ⇒ Object
Returns the value of attribute enable_weaker_network_isolation.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def enable_weaker_network_isolation @enable_weaker_network_isolation end |
#enabled ⇒ Object
Returns the value of attribute enabled.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def enabled @enabled end |
#excluded_commands ⇒ Object
Returns the value of attribute excluded_commands.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def excluded_commands @excluded_commands end |
#fail_if_unavailable ⇒ Object
Returns the value of attribute fail_if_unavailable.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def fail_if_unavailable @fail_if_unavailable end |
#filesystem ⇒ Object
Returns the value of attribute filesystem.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def filesystem @filesystem end |
#ignore_violations ⇒ Object
Returns the value of attribute ignore_violations.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def ignore_violations @ignore_violations end |
#network ⇒ Object
Returns the value of attribute network.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def network @network end |
#ripgrep ⇒ Object
Returns the value of attribute ripgrep.
1656 1657 1658 |
# File 'lib/claude_agent_sdk/types.rb', line 1656 def ripgrep @ripgrep end |
Instance Method Details
#to_h ⇒ Object
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 |
# File 'lib/claude_agent_sdk/types.rb', line 1687 def to_h result = {} result[:enabled] = @enabled unless @enabled.nil? result[:failIfUnavailable] = @fail_if_unavailable unless @fail_if_unavailable.nil? result[:autoAllowBashIfSandboxed] = @auto_allow_bash_if_sandboxed unless @auto_allow_bash_if_sandboxed.nil? result[:excludedCommands] = @excluded_commands if @excluded_commands result[:allowUnsandboxedCommands] = @allow_unsandboxed_commands unless @allow_unsandboxed_commands.nil? result[:network] = @network.is_a?(SandboxNetworkConfig) ? @network.to_h : @network if @network result[:filesystem] = @filesystem.is_a?(SandboxFilesystemConfig) ? @filesystem.to_h : @filesystem if @filesystem result[:ignoreViolations] = @ignore_violations if @ignore_violations result[:enableWeakerNestedSandbox] = @enable_weaker_nested_sandbox unless @enable_weaker_nested_sandbox.nil? result[:enableWeakerNetworkIsolation] = @enable_weaker_network_isolation unless @enable_weaker_network_isolation.nil? result[:ripgrep] = @ripgrep if @ripgrep result end |