MingaEditor.Frontend.Protocol.GUI (Minga v0.1.0)

Copy Markdown View Source

Binary protocol encoder/decoder for GUI chrome commands (BEAM → Swift/GTK).

This module handles the structured data protocol for native GUI elements: tab bars, file trees, which-key popups, completion menus, breadcrumbs, status bars, pickers, agent chat, and theme colors. These are separate from the TUI cell-grid rendering commands in MingaEditor.Frontend.Protocol.

GUI Chrome Commands (BEAM → Frontend)

GUI chrome opcodes start at 0x70. Newer commands use the 0x90+ length-prefixed envelope so frontends can skip unknown messages.

OpcodeNameDescription
0x93gui_file_treeSemantic file tree state
0x94gui_file_tree_selectionFile tree selection-only update
0x71gui_tab_barTab bar with tab entries
0x72gui_which_keyWhich-key popup bindings
0x73gui_completionCompletion popup items
0x74gui_themeTheme color slots
0x75gui_breadcrumbPath breadcrumb segments
0x76gui_status_barStatus bar data
0x77gui_pickerFuzzy picker items + mode prefix
0x78gui_agent_chatAgent conversation view
0x79gui_gutter_sepGutter separator col + color
0x7Agui_cursorlineCursorline row + bg color
0x7Bgui_gutterStructured gutter data
0x7Cgui_bottom_panelBottom panel container state
0x7Dgui_picker_previewPicker preview content
0x7Egui_tool_managerTool manager panel
0x7Fgui_minibufferNative minibuffer + candidates
0x81gui_hover_popupNative hover tooltip popup
0x82gui_signature_helpSignature help popup
0x83gui_float_popupFloat popup window
0x84gui_split_separatorsSplit pane separator lines
0x85gui_git_statusGit status panel data
0x98gui_workspacesCanonical workspace state
0x97gui_config_stateSettings panel state
0x9Egui_search_stateSearch toolbar state
0x9Fgui_sidebarsSemantic sidebar metadata
0xA3gui_extension_runtimeGeneric extension-owned frontend runtime envelope

GUI Actions (Frontend → BEAM)

Sub-opcodeName
0x01select_tab
0x02close_tab
0x03file_tree_click
0x04file_tree_toggle
0x05completion_select
0x06breadcrumb_click
0x07toggle_panel
0x08new_tab
0x09panel_switch_tab
0x0Apanel_dismiss
0x0Bpanel_resize
0x0Copen_file
0x0Dfile_tree_new_file
0x0Efile_tree_new_folder
0x2Dfile_tree_edit_confirm
0x2Efile_tree_edit_cancel
0x2Fscroll_to_line
0x30file_tree_delete
0x0Ffile_tree_collapse_all
0x10file_tree_refresh
0x11tool_install
0x12tool_uninstall
0x13tool_update
0x14tool_dismiss
0x15agent_tool_toggle
0x16execute_command
0x17minibuffer_select
0x18git_stage_file
0x19git_unstage_file
0x1Agit_discard_file
0x1Bgit_stage_all
0x1Cgit_unstage_all
0x1Dgit_commit
0x1Egit_open_file
0x1Fworkspace_rename
0x20workspace_set_icon
0x21workspace_close
0x3Dfile_tree_open_in_split
0x3Etab_copy_path
0x3Fhover_open_action
0x40file_tree_drop
0x41fold_toggle_at_line
0x42git_open_diff
0x43config_update
0x44config_query
0x47power_thermal_state
0x48tab_reorder
0x49tab_pin
0x4Atab_unpin
0x4Btab_move_left
0x4Ctab_move_right
0x4Dobservatory_inspect
0x4Efont_size_adjust
0x4Ftimeline_navigate
0x50extension_panel_action
0x51search_query
0x52search_next
0x53search_prev
0x54search_replace
0x55search_replace_all
0x56search_dismiss
0x57sidebar_action
0x58extension_action
0x34system_will_sleep
0x35system_did_wake

Summary

Types

Clipboard target for the write opcode.

Settings state payload sent to native settings UI.

Extension overlay entry for encoding.

Data for a float popup.

Git toast data shown after a remote operation completes.

Git toast action for error recovery.

A semantic GUI action from the Swift/GTK frontend.

Read-only keybinding entry sent to native settings UI.

BEAM Observatory payload sent to native GUI frontends.

Semantic sidebar metadata sent to native GUI frontends.

Theme preview swatch sent to native settings UI.

macOS thermal pressure level reported by the native GUI frontend.

Functions

Builds a full settings state payload from the current config and keymap servers.

Decodes a GUI action sub-opcode and its payload into a gui_action() tuple.

Unpacks a search flags byte into a keyword list of booleans.

Encodes a clipboard_write command.

Encodes the current settings panel state for native GUI frontends.

Encodes a gui_cursor_animation command.

Encodes a gui_extension_overlay command (0x9C).

Encodes a gui_extension_panel command (0x9D).

Encodes a generic frontend-extension runtime message.

Encodes the semantic GUI file-tree command.

Encodes a lightweight file-tree selection update.

Encodes a gui_float_popup command (0x83).

Encodes optional hover popup action metadata as a forward-compatible sidecar command.

Encodes a gui_hover_popup command (0x81).

Encodes a gui_line_spacing command.

Encodes a gui_minibuffer command (0x7F).

Encodes the full GUI notification center snapshot.

Encodes the BEAM Observatory sidebar state for native GUI frontends using a 32-bit payload length envelope.

Encodes semantic sidebar metadata for native GUI frontend hosts.

Encodes a gui_signature_help command (0x82).

Encodes a gui_status_bar command from a StatusBar.Data.t() tagged union.

Encodes a gui_tab_bar command with the current tab bar state.

Encodes a gui_theme command from a Theme.t().

Encodes the tool manager panel state.

Encodes a gui_which_key command.

Encodes the canonical gui_workspaces command.

Encodes a hidden semantic GUI file-tree command while preserving the project root.

Types

clipboard_target()

@type clipboard_target() :: :general | :find

Clipboard target for the write opcode.

config_state()

@type config_state() :: %{
  options: %{required(Minga.Config.Options.option_name()) => term()},
  theme_previews: [theme_preview()],
  keybindings: [keybinding_entry()]
}

Settings state payload sent to native settings UI.

extension_overlay_entry()

@type extension_overlay_entry() :: %{
  extension: String.t(),
  overlay_id: String.t(),
  window_id: non_neg_integer(),
  row: non_neg_integer(),
  col: non_neg_integer(),
  shape: non_neg_integer(),
  fg: non_neg_integer(),
  opacity: non_neg_integer(),
  content: String.t()
}

Extension overlay entry for encoding.

file_tree_status()

@type file_tree_status() :: MingaEditor.State.FileTree.tree_status()

float_popup_data()

@type float_popup_data() :: %{
  visible: boolean(),
  title: String.t(),
  lines: [String.t()],
  width: non_neg_integer(),
  height: non_neg_integer()
}

Data for a float popup.

git_toast()

@type git_toast() :: %{
  :message => String.t(),
  :level => :success | :error,
  :action => git_toast_action(),
  optional(:dismiss_ref) => reference()
}

Git toast data shown after a remote operation completes.

git_toast_action()

@type git_toast_action() :: :pull_and_retry | nil

Git toast action for error recovery.

gui_action()

@type gui_action() ::
  {:select_tab, id :: pos_integer()}
  | {:close_tab, id :: pos_integer()}
  | {:file_tree_click, index :: non_neg_integer()}
  | {:file_tree_toggle, index :: non_neg_integer()}
  | {:completion_select, index :: non_neg_integer()}
  | {:breadcrumb_click, segment_index :: non_neg_integer()}
  | {:toggle_panel, panel :: non_neg_integer()}
  | :new_tab
  | {:panel_switch_tab, tab_index :: non_neg_integer()}
  | :panel_dismiss
  | {:panel_resize, height_percent :: non_neg_integer()}
  | {:open_file, path :: String.t()}
  | {:file_tree_new_file, index :: non_neg_integer()}
  | {:file_tree_new_folder, index :: non_neg_integer()}
  | {:file_tree_edit_confirm, text :: String.t()}
  | :file_tree_edit_cancel
  | :file_tree_collapse_all
  | :file_tree_refresh
  | {:tool_install, name :: String.t()}
  | {:tool_uninstall, name :: String.t()}
  | {:tool_update, name :: String.t()}
  | :tool_dismiss
  | {:agent_tool_toggle, message_index :: non_neg_integer()}
  | {:execute_command, name :: String.t()}
  | {:minibuffer_select, candidate_index :: non_neg_integer()}
  | {:git_stage_file, path :: String.t()}
  | {:git_unstage_file, path :: String.t()}
  | {:git_discard_file, path :: String.t()}
  | :git_stage_all
  | :git_unstage_all
  | {:git_commit, message :: String.t()}
  | {:git_commit, message :: String.t(), amend? :: boolean()}
  | {:git_open_file, path :: String.t()}
  | {:git_open_diff, path :: String.t(), section :: non_neg_integer()}
  | {:workspace_rename, id :: non_neg_integer(), name :: String.t()}
  | {:workspace_set_icon, id :: non_neg_integer(), icon :: String.t()}
  | {:workspace_close, id :: non_neg_integer()}
  | {:space_leader_chord, codepoint :: non_neg_integer(),
     modifiers :: non_neg_integer()}
  | {:space_leader_retract, codepoint :: non_neg_integer(),
     modifiers :: non_neg_integer()}
  | {:find_pasteboard_search, text :: String.t(),
     direction :: non_neg_integer()}
  | :agent_approve
  | :agent_request_changes
  | :agent_dismiss
  | {:change_summary_click, index :: non_neg_integer()}
  | {:file_tree_delete, index :: non_neg_integer()}
  | {:file_tree_rename, index :: non_neg_integer()}
  | {:file_tree_duplicate, index :: non_neg_integer()}
  | {:file_tree_move, source_index :: non_neg_integer(),
     target_dir_index :: non_neg_integer()}
  | {:file_tree_drop, MingaEditor.FileTree.DropIntent.t()}
  | {:fold_toggle_at_line, window_id :: non_neg_integer(),
     buffer_line :: non_neg_integer()}
  | {:file_tree_open_in_split, index :: non_neg_integer()}
  | {:tab_copy_path, id :: pos_integer()}
  | {:tab_reorder, id :: pos_integer(), new_index :: non_neg_integer()}
  | {:tab_pin, id :: pos_integer()}
  | {:tab_unpin, id :: pos_integer()}
  | {:tab_move_left, id :: pos_integer()}
  | {:tab_move_right, id :: pos_integer()}
  | :hover_open_action
  | :system_will_sleep
  | :system_did_wake
  | {:power_thermal_state, low_power? :: boolean(), thermal_state()}
  | :cmd_copy
  | :cmd_cut
  | :git_push
  | :git_pull
  | :git_fetch
  | {:git_commit_amend, message :: String.t()}
  | :git_pull_and_retry
  | {:config_update, Minga.Config.Options.option_name(), term()}
  | :config_query
  | {:notification_dismiss, notification_id :: String.t()}
  | {:notification_action, notification_id :: String.t(),
     action_id :: String.t()}
  | {:observatory_inspect, pid_string :: String.t()}
  | {:font_size_adjust, direction :: :decrease | :increase | :reset}
  | {:search_query, query :: String.t(), flags :: non_neg_integer()}
  | :search_next
  | :search_prev
  | {:search_replace, replacement :: String.t()}
  | {:search_replace_all, replacement :: String.t()}
  | :search_dismiss
  | {:sidebar_action, sidebar_id :: String.t(), kind :: String.t(),
     action :: String.t()}
  | {:extension_action, extension_id :: String.t(), action :: String.t(),
     payload :: binary()}
  | :float_popup_dismiss

A semantic GUI action from the Swift/GTK frontend.

keybinding_entry()

@type keybinding_entry() :: %{
  mode: String.t(),
  key: String.t(),
  command: String.t(),
  description: String.t()
}

Read-only keybinding entry sent to native settings UI.

observatory_data()

@type observatory_data() :: MingaEditor.Observatory.Data.t()

BEAM Observatory payload sent to native GUI frontends.

sidebar_metadata()

@type sidebar_metadata() :: %{
  :id => String.t(),
  :display_name => String.t(),
  :semantic_kind => String.t(),
  :icon => String.t(),
  :order => non_neg_integer(),
  :visible? => boolean(),
  :focused? => boolean(),
  :preferred_width => non_neg_integer(),
  optional(:badge_count) => non_neg_integer() | nil
}

Semantic sidebar metadata sent to native GUI frontends.

theme_preview()

@type theme_preview() :: %{
  name: String.t(),
  atom: String.t(),
  editor_bg: non_neg_integer(),
  editor_fg: non_neg_integer(),
  accent: non_neg_integer()
}

Theme preview swatch sent to native settings UI.

thermal_state()

@type thermal_state() ::
  :nominal | :fair | :serious | :critical | {:unknown, non_neg_integer()}

macOS thermal pressure level reported by the native GUI frontend.

Functions

config_state(options_server \\ Options.default_server(), keymap_server \\ Minga.Keymap.default_server())

Builds a full settings state payload from the current config and keymap servers.

decode_gui_action(arg1, payload)

@spec decode_gui_action(non_neg_integer(), binary()) :: {:ok, gui_action()} | :error

Decodes a GUI action sub-opcode and its payload into a gui_action() tuple.

Called from Protocol.decode_event/1 when the outer opcode is 0x07 (gui_action).

decode_search_flags(flags)

@spec decode_search_flags(non_neg_integer()) :: [
  replace_mode: boolean(),
  case_sensitive: boolean(),
  whole_word: boolean(),
  regex: boolean()
]

Unpacks a search flags byte into a keyword list of booleans.

encode_clipboard_write(text, target \\ :general)

@spec encode_clipboard_write(String.t(), clipboard_target()) :: binary()

Encodes a clipboard_write command.

Uses the forward-compatible 0x90+ format: opcode(1) + payload_length(2) + payload. Payload: target(1) + text_length(2) + text(text_length).

Target: 0 = general pasteboard (Cmd+C), 1 = find pasteboard (Cmd+E).

encode_gui_config_state(map)

@spec encode_gui_config_state(config_state()) :: binary()

Encodes the current settings panel state for native GUI frontends.

Parity oracle (#2119): production no longer pushes config_state through this function. config_state is emitted in-frame by Minga.Frontend.Adapter.GUI.ConfigStateEncoder from the cached snapshot the builder projects via MingaEditor.RenderModel.UI.ConfigStateBuilder. The projection helpers below (config_state/2, settings_option?/1) are still live: the builder and the GUI action handler use them. This encoder is retained only as the byte-for-byte oracle for the GUI protocol tests.

encode_gui_cursor_animation(enabled)

@spec encode_gui_cursor_animation(boolean()) :: binary()

Encodes a gui_cursor_animation command.

Parity oracle (#2119): production no longer pushes cursor animation through this function. cursor_animation is emitted in-frame by Minga.Frontend.Adapter.GUI.CursorAnimationEncoder; this encoder is retained only as the byte-for-byte oracle for the GUI protocol tests.

Sends whether the GUI renderer should animate cursor movement. Reduce Motion can still disable animation on the frontend. Uses the forward-compatible 0x90+ format: opcode(1) + payload_length(2) + enabled(1).

encode_gui_extension_overlays(entries)

@spec encode_gui_extension_overlays([extension_overlay_entry()]) :: binary()

Encodes a gui_extension_overlay command (0x9C).

Sends all active extension overlays for the current frame. Uses the forward-compatible 0x90+ format: opcode(1) + payload_length(2) + payload.

Payload: count(1) + per overlay: extension_name_len(1) + extension_name(utf8) + overlay_id_len(1) + overlay_id(utf8) + window_id(2) + row(2) + col(2) + shape(1) + fg_r(1) + fg_g(1) + fg_b(1) + opacity(1) + content_len(2) + content(utf8).

encode_gui_extension_panels(panels)

@spec encode_gui_extension_panels([Minga.Extension.Panel.entry()]) :: binary()

Encodes a gui_extension_panel command (0x9D).

Sends all visible extension panels with their structured content. Uses the forward-compatible 0x90+ format: opcode(1) + payload_length(2) + payload.

Payload: panel_count(1) + per panel: ext_name_len(1) + ext_name + panel_id_len(1) + panel_id + title_len(1) + title + position(1) + size_type(1) + size_value(1) + visible(1) + block_count(1) + content blocks.

Each content block: type(1) + type-specific payload.

encode_gui_extension_runtime(extension_id, channel, payload)

@spec encode_gui_extension_runtime(String.t(), String.t(), binary()) :: binary()

Encodes a generic frontend-extension runtime message.

Shared protocol owns only the envelope. The named frontend extension owns the payload schema and decoder.

Format: opcode(1) + payload_length(4) + extension_id_len(2) + extension_id + channel_len(2) + channel + payload.

encode_gui_file_tree(root_path, tree_width, status, focused?, rows)

@spec encode_gui_file_tree(
  String.t() | nil,
  non_neg_integer(),
  file_tree_status(),
  boolean(),
  [
    MingaEditor.FileTree.Row.t()
  ]
) :: binary()

Encodes the semantic GUI file-tree command.

Wire format uses a 32-bit length-prefixed envelope:

opcode(1) + payload_len(4) + payload(payload_len)

Payload v2:

version(1) + tree_flags(1) + tree_state(1) + selected_id_len(2) + selected_id + root_len(2) + root + tree_width(2) + row_count(2) + error_reason_len(2) + error_reason + rows...

Per row:

stable_hash(4) + row_flags(2) + depth(1) + git_status(1) + diagnostics(8) + guide_count(1) + guides + id + path + rel_path + name + icon + editing_type(1) + editing_text + icon_color(3)

String fields use uint16 byte lengths except icon, which uses a uint8 byte length. icon_color is three bytes (R, G, B), following the editing payload.

encode_gui_file_tree_selection(selected_id, focused?)

@spec encode_gui_file_tree_selection(String.t(), boolean()) :: binary()

Encodes a lightweight file-tree selection update.

encode_gui_float_popup(map)

@spec encode_gui_float_popup(float_popup_data()) :: binary()

Encodes a gui_float_popup command (0x83).

Wire format: opcode(1) + visible(1) + width(2) + height(2) + title_len(2) + title(title_len) + line_count(2) + lines...

Each line: text_len(2) + text(text_len)

When visible=0, no further fields are sent.

encode_gui_hover_action(arg1)

@spec encode_gui_hover_action(MingaEditor.HoverPopup.t() | nil) :: binary()

Encodes optional hover popup action metadata as a forward-compatible sidecar command.

encode_gui_hover_popup(popup)

@spec encode_gui_hover_popup(MingaEditor.HoverPopup.t() | nil) :: binary()

Encodes a gui_hover_popup command (0x81).

Wire format: opcode(1) + visible(1) + anchor_row(2) + anchor_col(2) + focused(1) + scroll_offset(2) + line_count(2) + lines...

Each line: line_type(1) + segment_count(2) + segments...

Each segment: standard: style(1) + text_len(2) + text(text_len) syntaxHighlighted: style(1=13) + fg_r(1) + fg_g(1) + fg_b(1) + flags(1) + text_len(2) + text(text_len)

Line types: 0=text, 1=code, 2=code_header, 3=header, 4=blockquote, 5=list_item, 6=rule, 7=empty

Segment styles: 0=plain, 1=bold, 2=italic, 3=bold_italic, 4=code, 5=code_block, 6=code_content, 7=header1, 8=header2, 9=header3, 10=blockquote, 11=list_bullet, 12=rule, 13=syntaxHighlighted

encode_gui_line_spacing(spacing)

@spec encode_gui_line_spacing(number()) :: binary()

Encodes a gui_line_spacing command.

Parity oracle (#2119): production no longer pushes line spacing through this function. line_spacing is emitted in-frame by Minga.Frontend.Adapter.GUI.LineSpacingEncoder; this encoder is retained only as the byte-for-byte oracle for the GUI protocol tests.

Uses the forward-compatible 0x90+ format: opcode(1) + payload_length(2) + payload. Payload: spacing_x100(2) — the spacing multiplier times 100 as a 16-bit unsigned integer. For example, 1.2 is encoded as 120, 1.0 as 100.

encode_gui_minibuffer(data)

@spec encode_gui_minibuffer(MingaEditor.MinibufferData.t()) :: binary()

Encodes a gui_minibuffer command (0x7F).

Sends structured minibuffer state to the GUI frontend for native rendering. Includes mode, prompt, input text, cursor position, context string, and completion candidates.

When visible is false, sends a single hide byte. When visible, encodes the full payload including any completion candidates.

encode_gui_notifications(center)

@spec encode_gui_notifications(MingaEditor.UI.NotificationCenter.t()) :: binary()

Encodes the full GUI notification center snapshot.

Wire format (opcode 0x99): opcode(1) + payload_len(2) + version(1) + count(2) + notifications...

Each notification: id + level(1) + flags(1) + created_at(8) + updated_at(8) + auto_dismiss_ms(4) + title + body + source + action_count(1) + actions...

Strings are u16 length-prefixed. auto_dismiss_ms uses 0xFFFFFFFF for nil.

encode_gui_observatory(data)

@spec encode_gui_observatory(observatory_data()) :: binary()

Encodes the BEAM Observatory sidebar state for native GUI frontends using a 32-bit payload length envelope.

encode_gui_search_state(active, match_count, current_index, flags)

@spec encode_gui_search_state(
  boolean(),
  non_neg_integer(),
  non_neg_integer(),
  MingaEditor.State.Search.gui_search() | %{}
) :: binary()

Encodes the GUI search toolbar state.

Uses the forward-compatible 0x90+ format: opcode(1) + payload_length(2) + payload. Payload: active(1) + match_count(2) + current_index(2) + flags(1).

Flags bits: bit 0 = replace_mode, bit 1 = case_sensitive, bit 2 = whole_word, bit 3 = regex.

encode_gui_sidebars(sidebars, active_id)

@spec encode_gui_sidebars([sidebar_metadata()], String.t() | nil) :: binary()

Encodes semantic sidebar metadata for native GUI frontend hosts.

encode_gui_signature_help(sh)

@spec encode_gui_signature_help(MingaEditor.SignatureHelp.t() | nil) :: binary()

Encodes a gui_signature_help command (0x82).

Wire format: opcode(1) + visible(1) + anchor_row(2) + anchor_col(2) + active_signature(1) + active_parameter(1) + signature_count(1) + signatures...

Each signature: label_len(2) + label + doc_len(2) + doc + param_count(1) + params...

Each parameter: label_len(2) + label + doc_len(2) + doc

encode_gui_status_bar(status_bar_data)

@spec encode_gui_status_bar(MingaEditor.StatusBar.Data.t()) :: binary()

Encodes a gui_status_bar command from a StatusBar.Data.t() tagged union.

Wire format (opcode 0x76, sectioned):

[opcode:1][section_count:1][section_id:1][section_len:2][payload:N]...

Sections are self-describing: each starts with a 1-byte ID and 2-byte length. Unknown sections are skipped by the frontend. New fields can be added without changing the decoder for existing sections.

Section IDs: 0x01 - Identity: content_kind, mode, flags 0x02 - Cursor: cursor_line, cursor_col, line_count 0x03 - Diagnostics: error/warning/info/hint counts, diagnostic_hint 0x04 - Language: lsp_status, parser_status 0x05 - Git: branch, added, modified, deleted 0x06 - File: icon, icon_color, filename, filetype 0x07 - Message: status message 0x08 - Recording: macro_recording 0x09 - Agent: model_name, message_count, session_status, agent_status, background_count, background_label, active_tool_name 0x0A - Indent: indent_type, indent_size 0x0B - ModelineSegments: named configured left/right styled modeline segments 0x0C - Selection: selection_mode, selection_size 0x0D - Workspace: active workspace summary

encode_gui_status_bar(arg, chrome_state)

@spec encode_gui_status_bar(
  MingaEditor.StatusBar.Data.t(),
  MingaEditor.Session.ChromeState.t() | nil
) ::
  binary()

encode_gui_tab_bar(tab_bar_or_chrome_state, active_win_buffer \\ nil)

@spec encode_gui_tab_bar(
  MingaEditor.State.TabBar.t() | MingaEditor.Session.ChromeState.t(),
  pid() | nil
) :: binary()

Encodes a gui_tab_bar command with the current tab bar state.

Each tab entry includes: flags byte (is_active, is_dirty, is_agent, has_attention, agent_status in upper bits), tab id, group_id for workspace grouping, Nerd Font icon, and display label. When the active tab is omitted from ChromeState.visible_tabs, active_index is 255 to signal that no visible tab is active.

encode_gui_theme(theme)

@spec encode_gui_theme(MingaEditor.UI.Theme.t()) :: binary()

Encodes a gui_theme command from a Theme.t().

Takes a Theme.t() and produces a binary with {slot_id:u8, r:u8, g:u8, b:u8} entries for every color slot the GUI needs. Colors that are nil are skipped.

encode_gui_tool_manager(arg1)

@spec encode_gui_tool_manager(map() | nil) :: binary()

Encodes the tool manager panel state.

Parity oracle / future wiring (#2119): this opcode has no live BEAM emitter. The macOS frontend has a fully wired decode -> ToolManagerState -> ToolManagerView path designed to be BEAM-driven, but the BEAM half (a semantic tool-manager model and emission) was never built, and building it is out of scope here and blocked by the semantic-surface freeze. Rather than orphan the frontend decoder and break the GUI protocol round-trip tests, this encoder is retained as the byte-for-byte parity oracle until a tool-manager feature is built on the semantic path. The gui_protocol_test.exs round-trip suite exercises it.

Sends a rich structured view of all available tools with their install status, versions, categories, and progress info. The GUI frontend renders this as a native management panel.

Wire format

When visible:
  opcode(1) + 1(1) + filter(1) + selected_index(2) + tool_count(2) + tools...

Per tool:
  name_len(1) + name(name_len) + label_len(1) + label(label_len)
  + desc_len(2) + desc(desc_len) + category(1) + status(1)
  + method(1) + language_count(1) + languages...
  + version_len(1) + version(version_len)
  + homepage_len(2) + homepage(homepage_len)
  + provides_count(1) + provides...
  + error_reason_len(2) + error_reason(error_reason_len)

Per language:
  lang_len(1) + lang(lang_len)

Per provides:
  cmd_len(1) + cmd(cmd_len)

When hidden:
  opcode(1) + 0(1)

Status values

ValueStatus
0not_installed
1installed
2installing
3update_available
4failed

Category values

ValueCategory
0lsp_server
1formatter
2linter
3debugger

Method values

ValueMethod
0npm
1pip
2cargo
3go_install
4github_release

Filter values

ValueFilter
0all
1installed
2not_installed
3lsp_servers
4formatters

encode_gui_which_key(map)

@spec encode_gui_which_key(MingaEditor.State.WhichKey.t()) :: binary()

Encodes a gui_which_key command.

encode_gui_workspaces(chrome_state)

@spec encode_gui_workspaces(MingaEditor.Session.ChromeState.t()) :: binary()

Encodes the canonical gui_workspaces command.

Wire format: opcode(1) + payload_len(2) + payload

Payload: version(1) + active_workspace_id(2) + mode(1) + flags(1) + workspace_count(1)

  • workspaces... + visible_tab_count(2) + visible_tabs...

encode_hidden_gui_file_tree(root_path)

@spec encode_hidden_gui_file_tree(String.t() | nil) :: binary()

Encodes a hidden semantic GUI file-tree command while preserving the project root.

overlay_shape_byte(arg1)

@spec overlay_shape_byte(atom()) :: non_neg_integer()

settings_option?(name)

@spec settings_option?(atom()) :: boolean()