-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Context
I'm writing a pi extension (peculiars) that shows witty context-aware status messages as the agent works — different quips for reading files, running commands, editing, thinking, etc.
The extension uses two APIs for maximum coverage:
ctx.ui.setWorkingMessage(text)— replaces the working indicator (designed for exactly this use case)ctx.ui.setStatus(key, text)— persistent footer/header status
Problem
In the Emacs RPC client, setWorkingMessage falls through to the unsupported method handler in pi-coding-agent--handle-extension-ui-request:
(pcase method
("notify" ...)
("confirm" ...)
("select" ...)
("input" ...)
("set_editor_text" ...)
("setStatus" ...)
(_ (pi-coding-agent--extension-ui-unsupported event proc)))setStatus works and shows in the header-line after the │ separator, but that position feels disconnected from the spinner — the natural home for working messages.
Suggestion
Add a setWorkingMessage handler that displays the text adjacent to the braille spinner in the header-line. When the message is cleared (setWorkingMessage() with no arg), it reverts to the default spinner-only display.
Something like:
("setWorkingMessage"
(let ((text (plist-get event :message)))
(setq pi-coding-agent--working-message text)
(force-mode-line-update t)))Then in pi-coding-agent--header-line-string, after status-str:
(when pi-coding-agent--working-message
(concat " " (propertize pi-coding-agent--working-message
'face 'pi-coding-agent-retry-notice)))This would give the layout:
Sonnet 4 • high ⠹ 📖 Skimming through the source… 42 msgs (65%)
Current workaround
Using setStatus which works but places the text after stats:
Sonnet 4 • high ⠹ 42 msgs (65%) │ 📖 Skimming through the source…
Thanks for the great Emacs integration!