MingaEditor.Agent.UIState.Panel (Minga v0.1.0)

Copy Markdown View Source

Prompt editing and chat display state.

Holds the data for the agent prompt (buffer, history, cursor, paste blocks) and chat display (scroll, spinner, model config, display offset). This is the "panel" half of the agent UI, separated from layout/search/preview concerns in UIState.View.

Most callers interact through UIState functions rather than accessing this struct directly.

Summary

Types

A collapsed paste block. Stores the original text and whether the block is currently expanded for editing.

t()

Prompt editing and chat display state.

Functions

Increments the message version counter. Used to invalidate the GUI fingerprint cache when message content changes (collapse toggles, new messages, etc.).

Replaces cached styled transcript runs without changing the display window.

Replaces cached transcript projection data after a transcript sync.

Clears the active file mention completion.

Clears any pending provenance jump (e.g. when the user sends a new prompt).

Clears cached transcript projection data when there is no displayable transcript.

Refreshes stale unqualified model names to the current credential-aware default.

Refreshes stale unqualified model names from a specific options server.

Creates a new panel state with truthful model defaults.

Sets whether any provider credential is configured (drives the model indicator).

Sets the active model name.

Arms a pending provenance jump (Enter from a code-provenance popup).

Sets the displayed provider name.

Stores semantic scroll state for the agent transcript panel.

Types

paste_block()

@type paste_block() :: %{text: String.t(), expanded: boolean()}

A collapsed paste block. Stores the original text and whether the block is currently expanded for editing.

rendered_message()

@type rendered_message() :: %{
  styled_lines: MingaEditor.Agent.MarkdownHighlight.styled_lines() | nil,
  markdown_blocks: [Minga.RenderModel.UI.AgentChat.MarkdownBlock.t()] | nil
}

styled_cache()

@type styled_cache() :: [rendered_message() | nil] | nil

t()

@type t() :: %MingaEditor.Agent.UIState.Panel{
  cached_display_message_pairs: [{pos_integer(), term()}],
  cached_display_messages: [term()],
  cached_line_index: [
    {non_neg_integer(), MingaEditor.Agent.Transcript.line_type()}
  ],
  cached_styled_fingerprint: non_neg_integer() | nil,
  cached_styled_messages: styled_cache(),
  credentials_configured: boolean(),
  display_start_index: non_neg_integer(),
  history_index: integer(),
  input_focused: boolean(),
  mention_completion: MingaAgent.FileMention.completion() | nil,
  message_version: non_neg_integer(),
  model_name: String.t(),
  pasted_blocks: [paste_block()],
  prompt_buffer: pid() | nil,
  prompt_history: [String.t()],
  provenance_jump: MingaEditor.Agent.ProvenanceJump.t() | nil,
  provider_name: String.t(),
  scroll: Minga.Editing.Scroll.t(),
  spinner_frame: non_neg_integer(),
  thinking_level: String.t(),
  visible: boolean()
}

Prompt editing and chat display state.

Functions

bump_message_version(panel)

@spec bump_message_version(t()) :: t()

Increments the message version counter. Used to invalidate the GUI fingerprint cache when message content changes (collapse toggles, new messages, etc.).

cache_styled_messages(panel, styled_messages, styled_fingerprint)

@spec cache_styled_messages(t(), styled_cache(), non_neg_integer() | nil) :: t()

Replaces cached styled transcript runs without changing the display window.

cache_transcript_display(panel, display, styled_messages, opts \\ [])

@spec cache_transcript_display(
  t(),
  MingaEditor.Agent.Transcript.display_result(),
  styled_cache(),
  keyword()
) :: t()

Replaces cached transcript projection data after a transcript sync.

clear_mention_completion(panel)

@spec clear_mention_completion(t()) :: t()

Clears the active file mention completion.

clear_provenance_jump(panel)

@spec clear_provenance_jump(t()) :: t()

Clears any pending provenance jump (e.g. when the user sends a new prompt).

clear_transcript_cache(panel)

@spec clear_transcript_cache(t()) :: t()

Clears cached transcript projection data when there is no displayable transcript.

ensure_configured_model(panel)

@spec ensure_configured_model(t()) :: t()

Refreshes stale unqualified model names to the current credential-aware default.

ensure_configured_model(panel, options_server)

@spec ensure_configured_model(t(), Minga.Config.Options.server()) :: t()

Refreshes stale unqualified model names from a specific options server.

new()

@spec new() :: t()

Creates a new panel state with truthful model defaults.

set_credentials_configured(panel, configured?)

@spec set_credentials_configured(t(), boolean()) :: t()

Sets whether any provider credential is configured (drives the model indicator).

set_model_name(panel, model)

@spec set_model_name(t(), String.t()) :: t()

Sets the active model name.

set_provenance_jump(panel, jump)

@spec set_provenance_jump(t(), MingaEditor.Agent.ProvenanceJump.t() | nil) :: t()

Arms a pending provenance jump (Enter from a code-provenance popup).

set_provider_name(panel, provider)

@spec set_provider_name(t(), String.t()) :: t()

Sets the displayed provider name.

set_scroll(panel, scroll)

@spec set_scroll(t(), Minga.Editing.Scroll.t()) :: t()

Stores semantic scroll state for the agent transcript panel.

styled_cache_fingerprint(theme_syntax)

@spec styled_cache_fingerprint(map() | nil) :: non_neg_integer()