# `Imp.Tracking.WandB`
[🔗](https://github.com/deepfates/imp/blob/v0.18.1/lib/imp/tracking/wandb/client.ex#L1)

Isolated client for the W&B 0.21.x run protocol.

The public API is transport-independent and keeps run state immutable. Pass
the returned client from each successful operation into the next operation.

## Version sensitivity

W&B's GraphQL and `file_stream` interfaces are internal protocols, not stable
public APIs. This implementation is pinned to wire behavior from the official
W&B SDK v0.21.3 in an isolated internal module. A W&B SDK or server upgrade
requires recording and comparing the requests before changing that module.

`:gepa_v0_1_1` finish semantics reproduce GEPA v0.1.1, whose context manager
calls `wandb.finish()` without propagating exception status. `:accurate`
semantics convert failed outcomes to a nonzero W&B exit code.

# `outcome`

```elixir
@type outcome() ::
  :success
  | :finished
  | :failed
  | :failure
  | :killed
  | :cancelled
  | :error
  | {:failed, non_neg_integer()}
```

# `status_mode`

```elixir
@type status_mode() :: :gepa_v0_1_1 | :accurate
```

# `t`

```elixir
@type t() :: %Imp.Tracking.WandB{
  authorization: term(),
  base_url: term(),
  entity: term(),
  finished?: term(),
  group: term(),
  history_offset: term(),
  id: term(),
  job_type: term(),
  last_step: term(),
  name: term(),
  notes: term(),
  project: term(),
  request_opts: term(),
  resume: term(),
  status_mode: term(),
  storage_id: term(),
  summary: term(),
  tags: term(),
  transport: term()
}
```

# `finish`

```elixir
@spec finish(t(), outcome()) :: {:ok, t()} | {:error, term()}
```

Sends the terminal W&B file-stream payload.

# `init`

```elixir
@spec init(t(), keyword() | map()) :: {:ok, t()} | {:error, term()}
```

Verifies credentials, resolves the entity, and creates or resumes a run.

# `log`

```elixir
@spec log(t(), map(), keyword()) :: {:ok, t()} | {:error, term()}
```

Appends one history row and enforces strictly increasing steps.

# `log_html`

```elixir
@spec log_html(t(), String.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, term()}
```

Uploads HTML and logs it to history; by default it also replaces that summary key.

# `log_table`

```elixir
@spec log_table(t(), String.t(), [String.t()], [list()], keyword()) ::
  {:ok, t()} | {:error, term()}
```

Uploads a W&B table file and logs its media reference as a history row.

# `merge_summary`

```elixir
@spec merge_summary(t(), map()) :: {:ok, t()} | {:error, term()}
```

Merges values into the local summary and sends a full replacement.

# `new`

```elixir
@spec new(keyword()) :: t()
```

Creates a client without making a network request.

# `replace_summary`

```elixir
@spec replace_summary(t(), map()) :: {:ok, t()} | {:error, term()}
```

Replaces the complete W&B summary document at file-stream offset zero.

---

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