# Class LittleGhost::Sandboxes::Seatbelt

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/Sandboxes/Seatbelt.html

Runs child programs under macOS Seatbelt. Seatbelt grants access to the
workspace's existing physical paths; it does not create Linux-style bind
mounts or virtual path aliases. Child processes inherit the profile, but macOS
cannot provide PID-namespace ownership for detached descendants.

## Inheritance

`LittleGhost::Sandboxes::Seatbelt < LittleGhost::Sandbox::IsolatedBackend`

## Class methods

<a id="method-c-backend_capabilities"></a>
### `.backend_capabilities`

```ruby
.backend_capabilities()
```

Capabilities the Seatbelt backend can enforce before a Policy narrows them.

<a id="method-c-new"></a>
### `.new`

```ruby
.new(workspace:, policy: nil, profiles: {}, limits: {},
        executable: DEFAULT_EXECUTABLE, platform: RUBY_PLATFORM)
```

Builds a Seatbelt backend around `workspace` without opening it.

<a id="method-c-probe"></a>
### `.probe`

```ruby
.probe(executable: DEFAULT_EXECUTABLE, platform: RUBY_PLATFORM)
```

Reports whether Seatbelt is available and returns its capabilities.

## Instance methods

<a id="method-i-capabilities"></a>
### `#capabilities`

```ruby
#capabilities()
```

Effective capabilities after the configured root-filesystem policy is applied.

<a id="method-i-close"></a>
### `#close`

```ruby
#close()
```

Removes temporary storage owned by this backend. Safe to call more than once.

<a id="method-i-execute_program"></a>
### `#execute_program`

```ruby
#execute_program(command, timeout:, context: nil, max_output_bytes: nil,
        environment: {}, inherit_environment: false, scope: nil, cwd: nil)
```

Runs `command` to completion under Seatbelt and returns its bounded stdout,
stderr, and exit status.

<a id="method-i-open"></a>
### `#open`

```ruby
#open(run: nil)
```

Validates Seatbelt and the Workspace, then creates owned temporary storage.
Returns `self`.

<a id="method-i-start_program"></a>
### `#start_program`

```ruby
#start_program(command, context: nil, environment: {}, inherit_environment: false,
        scope: nil, cwd: nil, output_bytes: nil, memory_bytes: nil, cpu_seconds: nil, file_bytes: nil,
        allow_subprocesses: false)
```

Starts `command` under Seatbelt and returns an owned ProcessSession. The
caller must close the returned session.
