# `MingaEditor.Shell.Traditional.Observatory`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/shell/traditional/observatory.ex#L1)

Pure lifecycle owner for the Traditional shell's BEAM Observatory.

Refresh timers are correlated by semantic tokens. Expiring a scheduled
refresh moves it to an in-flight state, and only the matching result can
install data and arm the next refresh. Closing clears every surface value,
so delayed ticks and results cannot restore a hidden observatory.

# `phase`

```elixir
@type phase() :: :idle | :scheduled | :collecting
```

# `t`

```elixir
@type t() :: %MingaEditor.Shell.Traditional.Observatory{
  data: MingaEditor.Observatory.Data.t() | nil,
  inspection: MingaEditor.Observatory.Inspection.t() | nil,
  phase: phase(),
  timer: reference() | nil,
  token: reference() | nil,
  visible: boolean()
}
```

# `timer`

```elixir
@type timer() :: {reference(), reference()}
```

# `close`

```elixir
@spec close(t()) :: t()
```

Closes the surface and invalidates scheduled or in-flight refreshes.

# `collecting?`

```elixir
@spec collecting?(t(), reference()) :: boolean()
```

Returns whether a collection token is currently in flight.

# `complete`

```elixir
@spec complete(t(), reference(), MingaEditor.Observatory.Data.t(), timer()) ::
  {:accepted | :stale, t()}
```

Completes a matching collection and schedules the next refresh.

# `data`

```elixir
@spec data(t()) :: MingaEditor.Observatory.Data.t() | nil
```

Returns the latest collected Observatory data.

# `expire`

```elixir
@spec expire(t(), reference()) :: {:collect | :stale, t()}
```

Expires a matching scheduled refresh and marks its collection in flight.

# `inspect`

```elixir
@spec inspect(t(), MingaEditor.Observatory.Inspection.t() | nil) :: t()
```

Shows or dismisses the process inspection float.

# `inspection`

```elixir
@spec inspection(t()) :: MingaEditor.Observatory.Inspection.t() | nil
```

Returns the active process inspection, when present.

# `open`

```elixir
@spec open(t(), timer() | nil) :: t()
```

Opens the surface and installs its first scheduled refresh.

# `replace_data`

```elixir
@spec replace_data(t(), MingaEditor.Observatory.Data.t() | nil) :: t()
```

Installs data without changing refresh correlation.

# `timer`

```elixir
@spec timer(t()) :: reference() | nil
```

Returns the timer handle that an effectful workflow should cancel.

# `visible?`

```elixir
@spec visible?(t()) :: boolean()
```

Returns whether the Observatory surface is visible.

---

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