# `SmolBox.Runtime.WorkerConfig`
[🔗](https://github.com/hfiguera/smolbox/blob/v0.1.2/lib/smolbox/runtime/worker_config.ex#L1)

Host-approved managed worker, prepared artifacts, and exact profile revisions.

Artifact entries have `id`, `sha256`, `architecture`, and an absolute prepared
`.smolmachine` `path` on this worker. The operator verifies artifact digests,
neutral `/bin/true` startup, disabled workload restart, and the pinned runtime
before registering them. Managed admission compares the server-reported version
and checks readiness; the worker API cannot attest artifact contents or isolation.

`allocation_floor` is a required operator declaration with `storage_gb`,
`overlay_gb`, and `host_overhead_mb`. It must cover the largest actual disk
templates across this worker's runtime and approved artifacts, and its VMM
overhead. SmolVM 1.14.1 only grows disk templates: a smaller API request can
still expose a larger guest disk. Admission rejects profiles below these
floors. This declaration is not remotely attested or a host filesystem quota.

Version 1.14.6 requires working host `resize2fs` for disk requests below
template sizes. Verify file persistence across stop/start before admission;
see [Compatibility](compatibility.html#macos-1-14-6-prerequisites).

The initial qualification is explicitly `:development`; it does not certify
hostile multi-tenant host quotas. Requested unsupported hard controls are
rejected by `SmolBox.Profile`. Reachability alone does not qualify a worker.

# `t`

```elixir
@type t() :: %SmolBox.Runtime.WorkerConfig{
  allocation_floor: %{
    storage_gb: pos_integer(),
    overlay_gb: pos_integer(),
    host_overhead_mb: pos_integer()
  },
  architecture: String.t(),
  artifacts: [map()],
  capacity: SmolBox.Store.capacity(),
  client: SmolBox.Client.t(),
  draining: boolean(),
  platform: :linux | :macos,
  profiles: [SmolBox.Profile.t()],
  qualification: :development,
  runtime_version: String.t()
}
```

# `artifact_path`

```elixir
@spec artifact_path(t(), SmolBox.ExecutionSpec.t()) :: String.t()
```

Resolve the worker-local image path for a specification already accepted by `supports?/2`.

# `new`

```elixir
@spec new(keyword()) :: {:ok, t()} | {:error, SmolBox.Error.t()}
```

Register a worker's approved artifacts, profiles, and admission capacity.

Required keyword options:

| Option | Value |
|---|---|
| `:client` | A validated `SmolBox.Client` |
| `:platform` | `:linux` or `:macos`; initially qualified hosts are Linux x86_64 and macOS Apple Silicon |
| `:architecture` | `"x86_64"` or `"aarch64"`; macOS requires `"aarch64"` |
| `:artifacts` | 1–32 maps with exactly string keys `"id"`, `"sha256"`, `"architecture"`, and absolute worker `"path"` ending in `.smolmachine` |
| `:profiles` | 1–32 valid `SmolBox.Profile` values with unique IDs |
| `:capacity` | Atom-keyed map with `:slots`, `:cpus`, `:memory_mb`, and `:disk_gb`; each 1–1,048,576 |
| `:allocation_floor` | Atom-keyed map with `:storage_gb` and `:overlay_gb` (1–64 each), and `:host_overhead_mb` (128–16,384) |

Optional fields are `:runtime_version` (default `"1.14.6"` for Linux x86_64 or
macOS Apple Silicon; explicitly select `"1.14.1"` for an existing worker), `:qualification`
(only `:development`), and `:draining` (default `false`). Artifact IDs must be
unique and architectures must match this worker. Construction makes no worker
request or remote digest check. Profiles below the floor cannot support execution.
See [Getting started](getting-started.html) for a complete configuration.

# `supports?`

```elixir
@spec supports?(t(), SmolBox.ExecutionSpec.t()) :: boolean()
```

Check exact profile/artifact approval and allocation floors; this is not a health probe.

# `validate`

```elixir
@spec validate(term()) :: :ok | {:error, SmolBox.Error.t()}
```

Revalidate configuration shape, catalogs and declarations without contacting the worker.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
