| Crates.io | scarab-nav-protocol |
| lib.rs | scarab-nav-protocol |
| version | 0.1.0 |
| created_at | 2025-12-02 00:14:41.367697+00 |
| updated_at | 2025-12-02 00:14:41.367697+00 |
| description | Protocol definitions for Scarab Navigation System - enabling keyboard-driven navigation for TUI applications |
| homepage | https://github.com/raibid-labs/scarab-nav-protocol |
| repository | https://github.com/raibid-labs/scarab-nav-protocol |
| max_upload_size | |
| id | 1960902 |
| size | 17,171 |
Enable keyboard-driven, Vimium/Vimium-C style navigation for TUI applications (like tolaria-lens) running within the scarab terminal environment.
Current navigation plugins in scarab rely on screen-scraping (regex on character buffers). This fails to identify semantic UI elements like buttons, lists, or tabs that don't look like URLs.
The solution involves a side-channel communication protocol where the TUI application reports its interactive layout to the host (scarab).
We define a lightweight IPC protocol (JSON or Protobuf over Unix Domain Socket) for apps to report their UI state.
Message Structure:
message UpdateLayout {
// Unique ID for the window/pane
string window_id = 1;
// List of interactive zones
repeated InteractiveElement elements = 2;
}
message InteractiveElement {
// Unique stable ID for the element (optional, for debugging)
string id = 1;
// Screen coordinates (relative to the terminal window)
uint32 x = 2;
uint32 y = 3;
uint32 width = 4;
uint32 height = 5;
// Type of element (helps with styling the hint)
ElementType type = 6;
// Optional: Description for screen readers / accessibility
string description = 7;
}
enum ElementType {
BUTTON = 0;
INPUT = 1;
LINK = 2;
LIST_ITEM = 3;
TAB = 4;
}
/tmp/scarab-nav-<pid>.sock).SCARAB_NAV_SOCKET for child processes.UpdateLayout messages.Map<WindowID, List<InteractiveElement>>.f):
(x, y) of the selected element.(center_x, center_y) of the element.ratatui), it "records" the areas of interactive widgets.frame.render_widget can capture the Rect and push it to a thread-local list.Rects and send it to SCARAB_NAV_SOCKET.ratatui and most modern TUI libs).scarab-nav-client)Create a small Rust crate scarab-nav-client that handles:
ratatui widgets.In tolaria-lens/src/app.rs:
NavClient on startup.render():
// Example pseudo-code
let nav_recorder = NavRecorder::new();
// When rendering a widget
let area = chunks[1];
nav_recorder.register(area, ElementType::Button, "Click Me");
frame.render_widget(my_widget, area);
// End of frame
nav_recorder.flush(&app.nav_client);
Since Hibana has a "pluggable kernel", we can add a NavigationService to the kernel that apps can optionally talk to, which then bridges to Scarab. However, direct socket communication from the UI process is simpler and lower latency.
UpdateLayout protobuf in hibana/proto (or a new shared scarab-protocol crate).scarab-nav-client crate.tolaria-lens as a proof of concept.