# `MingaEditor.State.InlineAsk`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/state/inline_ask.ex#L1)

Ephemeral inline ask overlays keyed by buffer.

Inline asks are presentation state only. They are not persisted and they do not create workspaces until explicitly promoted.

The shared per-buffer store mechanics (`active/2`, `put/2`, `dismiss/2`,
`session?/2`) and prompt-input mechanics (`append_input/2`, `backspace/1`,
`scroll/2`) live in `MingaEditor.InlineOverlay.Store` and
`MingaEditor.InlineOverlay.Prompt` and are reused here. This module owns
only the ask-specific shape and transitions: the read-only response
accumulation and the `:answered` terminal state.

# `status`

```elixir
@type status() :: :input | :thinking | :answered | :error
```

# `store`

```elixir
@type store() :: %{required(pid()) =&gt; t()}
```

# `t`

```elixir
@type t() :: %MingaEditor.State.InlineAsk{
  anchor_line: non_neg_integer(),
  buffer_pid: pid(),
  context_text: String.t(),
  file_label: String.t(),
  file_ref: Minga.Project.FileRef.t(),
  prompt: String.t(),
  response: String.t(),
  scroll: non_neg_integer(),
  selection_range: {non_neg_integer(), non_neg_integer()} | nil,
  session_pid: pid() | nil,
  status: status()
}
```

# `active`

```elixir
@spec active(store(), pid() | nil) :: t() | nil
```

# `agent_prompt`

```elixir
@spec agent_prompt(t()) :: String.t()
```

Builds the read-only prompt sent to the ephemeral agent session.

# `answered`

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

Marks the ask as answered.

# `append_input`

```elixir
@spec append_input(t(), String.t()) :: t()
```

# `append_response`

```elixir
@spec append_response(t(), String.t()) :: t()
```

Appends response text.

# `backspace`

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

# `dismiss`

```elixir
@spec dismiss(store(), pid() | nil) :: {store(), pid() | nil}
```

# `fail`

```elixir
@spec fail(t(), String.t()) :: t()
```

Marks the ask as failed.

# `header`

```elixir
@spec header(t()) :: String.t()
```

Returns the prompt header.

# `mark_thinking`

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

Refreshes the visible status without changing session ownership.

# `new`

```elixir
@spec new(
  pid(),
  Minga.Project.FileRef.t(),
  String.t(),
  non_neg_integer(),
  {non_neg_integer(), non_neg_integer()} | nil,
  String.t()
) :: t()
```

Creates a new ask for a buffer.

# `put`

```elixir
@spec put(store(), t()) :: store()
```

# `scroll`

```elixir
@spec scroll(t(), integer()) :: t()
```

# `session?`

```elixir
@spec session?(store(), pid()) :: boolean()
```

# `thinking`

```elixir
@spec thinking(t(), pid()) :: t()
```

Marks the ask as thinking.

---

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