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.
1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 |
# File 'lib/claude_agent_sdk/types.rb', line 1682 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.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def allow_unsandboxed_commands @allow_unsandboxed_commands end |
#auto_allow_bash_if_sandboxed ⇒ Object
Returns the value of attribute auto_allow_bash_if_sandboxed.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 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.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def enable_weaker_nested_sandbox @enable_weaker_nested_sandbox end |
#enable_weaker_network_isolation ⇒ Object
Returns the value of attribute enable_weaker_network_isolation.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def enable_weaker_network_isolation @enable_weaker_network_isolation end |
#enabled ⇒ Object
Returns the value of attribute enabled.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def enabled @enabled end |
#excluded_commands ⇒ Object
Returns the value of attribute excluded_commands.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def excluded_commands @excluded_commands end |
#fail_if_unavailable ⇒ Object
Returns the value of attribute fail_if_unavailable.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def fail_if_unavailable @fail_if_unavailable end |
#filesystem ⇒ Object
Returns the value of attribute filesystem.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def filesystem @filesystem end |
#ignore_violations ⇒ Object
Returns the value of attribute ignore_violations.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def ignore_violations @ignore_violations end |
#network ⇒ Object
Returns the value of attribute network.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def network @network end |
#ripgrep ⇒ Object
Returns the value of attribute ripgrep.
1677 1678 1679 |
# File 'lib/claude_agent_sdk/types.rb', line 1677 def ripgrep @ripgrep end |
Instance Method Details
#to_h ⇒ Object
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 |
# File 'lib/claude_agent_sdk/types.rb', line 1708 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 |