Admin bar: floating chat panel across every wp-admin screen#70
Merged
Conversation
Adds a global toolbar item + slide-in drawer so the agent is reachable from any wp-admin context (post editing, plugin browsing, etc.), not only from /wp-admin/admin.php?page=openclawp. - New `OpenclaWP_Admin_Bar_Panel` class wires three hooks: `admin_bar_menu` (toolbar node, priority 90, top-secondary), `admin_enqueue_scripts` (panel script + style on every admin screen), `admin_footer` (React mount point + inline toggle-script bridge). - New React entry at `blocks/chat-panel/src/view.js` mounts a 480px right-edge drawer with open/closed state persisted to localStorage (`openclawp:panel:open`). Escape closes; the toolbar `<a>` dispatches a `openclawp:panel:toggle` event the drawer listens for. - Refactor: inner conversation UI extracted to `blocks/chat-shared/ChatSurface.jsx`; both the chat block view and the new panel view import it so tool-call confirmation, session handling, and agent picking all live in one place. - Same agent-filtering rules as the chat block (workflow drafter excluded; `openclawp_chat_block_agents` filter respected). - Gated on `manage_options` by default; an `openclawp_admin_bar_panel_enabled` filter lets hosts switch it off. - Zero new dependencies — only `@automattic/agenttic-ui` (existing) and `@wordpress/components`/`@wordpress/icons` (already provided by wp). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
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
Adds a global floating chat panel reachable from a toolbar item on every wp-admin screen. Click the chat icon in the admin bar → a slide-in drawer opens on the right edge with the same chat surface as the wp-admin → openclaWP → Chat page.
admin_bar_menufor the toolbar item,admin_enqueue_scriptsfor the panel script,admin_footerfor the React mount point + inline toggle bridge.@automattic/agenttic-ui(<AgentUI>) and@wordpress/components(Button,Notice,SelectControl) — no new dependencies.blocks/chat-shared/ChatSurface.jsxso the block view and the panel view share one component (tool-call confirmation, session handling, agent picker).localStorage(openclawp:panel:open) so the panel re-opens on page nav.Esccloses.manage_optionsfor v1; anopenclawp_admin_bar_panel_enabledfilter lets hosts switch it off.openclawp_chat_block_agentsfilter respected).Why
Today openclaWP's chat only lives at
/wp-admin/admin.php?page=openclawp— you have to navigate there to talk to the agent. The floating panel makes the agent reachable from any admin context (editing a post, browsing plugins, etc.), which is the surface a regular admin actually uses.Test plan
Escwhile the drawer is open — it closes.openclawp_admin_bar_panel_enabledfilter to false — the toolbar item disappears./wp-admin/admin.php?page=openclawp) still renders identically — the shared component extraction didn't regress.Verified locally
npm run build— all bundles emit cleanly.npm run lint— clean.vendor/bin/phpunit --testsuite unit— 169/169 (was 169, no regression).🤖 Generated with Claude Code