Skip to main content

Module settings_editor

Module settings_editor 

Source
Expand description

Plugin custom-editor JSON-RPC payloads (Path B Phase 4).

When a user opens a plugin-declared settings field whose editor is "custom", Synaps and the plugin exchange these typed messages over the existing JSON-RPC channel:

synaps → plugin   settings.editor.open      { category, field }
plugin → synaps   settings.editor.render    { rows, cursor?, footer? }   (notification, repeated)
synaps → plugin   settings.editor.key       { key }                      (per keypress)
plugin → synaps   settings.editor.commit    { value }                    (when user accepts)

The render notification is a server-push that may be emitted multiple times as the plugin’s editor state evolves; consumers should debounce at the UI layer to avoid flicker.

Wire shape mirrors extensions::commands::CommandOutputEvent. This module owns only the typed contracts and a small parser; the settings UI glue (overlay rendering, key dispatch, debounce) lives in chatui/settings/.

Structs§

SettingsEditorCloseParams
settings.editor.close — either side may emit this to dismiss the overlay (e.g. plugin-side cancellation).
SettingsEditorCommitParams
settings.editor.commit — plugin → synaps notification when the user accepts a value. Synaps writes value to the plugin’s config namespace at (category, field) and closes the overlay.
SettingsEditorKeyParams
settings.editor.key — synaps → plugin notification on each keypress while a custom editor is focused. key is the string form produced by crossterm::event::KeyEvent (e.g. "Down", "Enter", "Esc", "Char(' ')" — the exact lexicon is documented alongside the keybind subsystem).
SettingsEditorOpenParams
settings.editor.open — synaps → plugin request when the user opens a custom editor for (category, field).
SettingsEditorRenderParams
settings.editor.render — plugin → synaps notification carrying the current visual state of the editor body.
SettingsEditorRow
A single row in the custom editor body.

Enums§

InboundSettingsEditorFrame
Normalised view of a single inbound frame. Distinguishes the four notifications the core can receive from the plugin side. (The open/key requests originate from the core and are typed via the individual params structs above.)
SettingsEditorParseError
Errors returned when parsing a JSON-RPC frame whose method belongs to the settings.editor.* family but whose params don’t match the expected shape.

Constants§

METHOD_CLOSE
METHOD_COMMIT
METHOD_KEY
METHOD_OPEN
METHOD_RENDER

Functions§

parse_inbound
Parse the params object of a settings.editor.* notification.