[FEATURE] Mods: let a plugin observe or own the collapse of the AbovePrompt band ([-] mark)
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I'm building a mod (Claude Code 2.1.287, Windows 11, fullscreen layout) that draws a small panel in the AbovePrompt band and toggles it from its own [ ≡ ] button in the SessionMode footer. The open/closed state lives in $.state and is persisted with $.store.
Whenever a plugin returns its own tree for AbovePrompt, the engine draws a [-] collapse mark at the band's top-right corner. Clicking it collapses the band through engine-internal state, and:
- the plugin gets no event for that click (no
ui.press, nothing likeui.closefor panes); - the collapsed state is not on the
AbovePromptprops, so the plugin cannot read it; - there is no call to expand the band again;
- the mark cannot be hidden or covered: it is the band's last child, absolutely positioned, so it paints over the plugin's tree.
Result: after one click on [-], the plugin's own toggle looks broken. Closing and reopening the panel from the plugin's button shows ▸ plugin panel hidden · ctrl+x ctrl+a or click to show instead of the panel, until the person clicks that line. Two controls fight over the same panel, and the plugin cannot reconcile them.
Proposed Solution
Any one of these would solve it:
- Observe and veto, as with panes. Raise an event when the person collapses or expands the band (origin
person) that a hook can observe or refuse, the same wayui.closeworks for aPaneclosed from its mark. The plugin could then keep its own state in sync, or refuse the collapse and close its panel itself. - Expose the state. Add
isCollapsedto theAbovePromptprops and a call to expand the band (for example$.ui.expand({ component: 'AbovePrompt' })). - Opt out. Let a plugin that ships its own toggle ask the engine not to draw the
[-]mark for its tree.
Alternative Solutions
Moving the panel to a Pane gives an interceptable close (ui.close with origin person), but from 110 columns the pane docks as a full-height sidebar, which is not what a small panel above the prompt should be. Today I tell users not to press [-], and to click the "plugin panel hidden" line if they do.
Priority
Medium - Would be very helpful
Feature Category
Interactive mode (TUI)
Use Case Example
Minimal repro:
- A mod hooks
ui.renderfor{ component: 'AbovePrompt' }. It returns a tree while anisOpenatom is true, andnext(e)otherwise. - A footer
Button(inSessionMode) togglesisOpen. - Open the panel with the button, then click the engine's
[-]. - Toggle the button off and on: the band shows the "plugin panel hidden" line, not the panel.
Additional Context
Related: #98808 (other limits of the mod UI API). Measured on 2.1.287 in the fullscreen layout.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗