feat(matrix): Matrix messages panel in mesh dashboard - #53
Merged
Conversation
… endpoints - Add _matrix_config() reads homeserver/token/room_id from env or ~/.config/sourceos/matrix.yaml - Add _matrix_recent_messages(n) fetches CS API dir=b, filters m.text, reverses newest-last - Inject matrix_messages + matrix_room_id into gather_state() - Dashboard: Matrix Room card after Runbooks — shows sender, timestamp, body (120 chars) - GET /api/matrix/rooms proxies joined_rooms CS API (5s timeout, graceful error envelope) - GET /api/matrix/messages returns last 20 messages for Lua/WezTerm consumers
…le-pipe, ctx turtle-matrix-bridge: - `send` reads stdin when piped (cmd | mx now works) - `pipe` — stdin → formatted code block, --lang flag for syntax hint - `reply <event_id> <text>` — threaded Matrix reply - `react <event_id> <emoji>` — emoji reaction on any event - `edit <event_id> <new_text>` — in-place message edit - `rooms` — list joined rooms with display names - `messages [n]` — fetch last n messages with sender + timestamp - `wormhole-pipe` — stdin → temp file → wormhole send → posts code to room - `ctx` — post active.json + mesh tail as a context snapshot - `-r <room>` flag on all commands (no positional-only room arg) - Smart lang detection from file extension + content shebang/prefix - `_lang_for(path)` maps 15 extensions to highlight languages Shell surface: - `mx` — reads stdin when piped; `k3s get pods | mx` just works - `mxpipe [--lang <l>]` — pipe stdin as code block - `mxw` — detects pipe mode: `k3s logs pod | mxw` sends via wormhole - `mxreply <eid> <text>` — threaded reply - `mxreact <eid> <emoji>` — reaction - `mxedit <eid> <text>` — edit message - `mxrooms` — list joined rooms - `mxlog [n]` — print last n messages from room - `mxctx` — post context snapshot to room Palette: 9 Matrix entries; all new verbs reachable via CMD+P
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_matrix_config()— readsMATRIX_HOMESERVER_URL/MATRIX_ACCESS_TOKEN/MATRIX_BOT_ROOM_IDfrom env, falling back to~/.config/sourceos/matrix.yaml(same key-set the bridge uses)_matrix_recent_messages(n)— callsGET /_matrix/client/v3/rooms/{room}/messages?dir=b&limit={n}viaurllib.request(3 s timeout), filtersm.textevents, reverses to newest-last; returns[]silently on any error so the dashboard stays healthy when Matrix is unconfiguredgather_state()extended withmatrix_messages(8 most-recent) andmatrix_room_idsender,HH:MMtimestamp, and up to 120 chars of body per message; empty state prompts to configureMATRIX_BOT_ROOM_IDGET /api/matrix/rooms— proxies/_matrix/client/v3/joined_roomswith the configured bearer token (5 s timeout); returns{"rooms": [], "error": "..."}on failureGET /api/matrix/messages— returns{"messages": [...]}for last 20 messages, used by future Lua/WezTerm pane consumersTest plan
python3 -m py_compile assets/sourceos/bin/turtle-mesh-servepasses (verified before commit)/api/matrix/roomsreturns{"rooms":[],"error":"Matrix not configured"}/api/matrix/roomsreturns joined room list;/api/matrix/messagesreturns up to 20 messages