Agents Manager: Add zoom toggle action and improve copy action#109764
Agents Manager: Add zoom toggle action and improve copy action#109764
Conversation
Register a zoom-in/zoom-out message action on `show_component` tool messages that toggles the Gutenberg editor canvas between default and zoom-out mode using the block editor's private zoom APIs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Jetpack Cloud Live (direct link)
Automattic for Agencies Live (direct link)
Dashboard Live (dotcom) (direct link)
|
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
…blue Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move zoom logic into reusable `canvas-zoom.ts` and create a shared `unlock-private-apis.ts` utility for accessing WordPress private APIs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switch from button action to component action type using the updated agenttic-client package. Add ZoomToggleButton component with its own styles matching existing action button sizing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…action - Use `useSelect` for reactive zoom state instead of imperative reads - Use component action type with `ZoomToggleButton` component - Dynamic label based on zoom state (Zoom in / Zoom out) - Style zoom button to match existing action buttons - Remove redundant `isZoomedOut` export from canvas-zoom utility - Update agenttic-client and agenttic-ui to 0.1.56 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add CopyActionButton component with copied state feedback (check icon) - Clean up timer on unmount, handle rapid clicks - Remove dead .agents-manager-message-action-icon--copy style - Remove unnecessary label from zoom action registration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Checkpoint (1), Feedback thumbs up/down (2-3), Zoom (4), Copy (5). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…1.57 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds richer, ordered message actions to the Agents Manager chat UI—most notably a zoom toggle for show_component previews in the Gutenberg editor and an improved copy action with “copied” feedback.
Changes:
- Introduces a Zoom action (hook + button) that toggles the block editor canvas zoom for
big_sky__show_componenttool messages. - Refactors the copy action into a
CopyActionButtoncomponent with “copied” state feedback. - Adds
orderto message actions (checkpoint/feedback/zoom/copy) and aligns picker active styling with Big Sky.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates lock metadata to reflect new peer deps. |
| packages/agents-manager/package.json | Adds peer deps for @wordpress/block-editor and @wordpress/private-apis. |
| packages/agents-manager/src/utils/unlock-private-apis.ts | Centralizes Gutenberg private API opt-in and re-exports unlock. |
| packages/agents-manager/src/utils/canvas-zoom.ts | Adds zoom in/out/toggle helpers using block-editor dispatch/select. |
| packages/agents-manager/src/hooks/use-zoom-action.ts | Registers a zoom toggle action for show_component messages. |
| packages/agents-manager/src/components/zoom-action-button/index.tsx | Implements the zoom toggle UI via a compact WP Button. |
| packages/agents-manager/src/components/zoom-action-button/style.scss | Styles the zoom action button pressed/hover states. |
| packages/agents-manager/src/hooks/use-copy-action.ts | Switches from inline action to component-based copy action. |
| packages/agents-manager/src/components/copy-action-button/index.tsx | New copy button with “copied” icon/label and timeout reset. |
| packages/agents-manager/src/components/copy-action-button/style.scss | Styles the new copy action button icon/focus behavior. |
| packages/agents-manager/src/hooks/use-feedback-action.ts | Applies deterministic order to feedback actions. |
| packages/agents-manager/src/hooks/use-checkpoint-action.ts | Applies deterministic order to checkpoint/undo action. |
| packages/agents-manager/src/components/orchestrator-chat/index.tsx | Registers the new zoom action hook. |
| packages/agents-manager/src/components/agent-dock/style.scss | Adjusts message-action icon sizing and picker active outline styling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/agents-manager/src/components/zoom-action-button/index.tsx
Outdated
Show resolved
Hide resolved
35ad905 to
58576c8
Compare
These were declared as peerDependencies but most consuming packages don't provide them, causing 16 YN0002 warnings that fail CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ional Moving these to dependencies caused transitive react-dom conflicts. Instead, keep them as peer deps but mark optional so consumers that don't provide them won't trigger YN0002 warnings that fail CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Moving these packages to regular dependencies fixes the CI yarn install failure (YN0060) caused by react-autosize-textarea (a transitive dep of block-editor) requiring react-dom ^0.14.0 || ^15.0.0 || ^16.0.0, which conflicts with the project's react-dom 18.3.1. As regular dependencies they no longer create a peer requirement chain that Yarn validates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move react and react-dom from peerDependencies to devDependencies to fix a Yarn peer dependency resolution error (YN0060) that caused CI to fail during yarn install. The error occurred because calypso@workspace:client depends on both agents-manager (which declared react-dom as a peer dep) and @wordpress/edit-post (which transitively depends on react-autosize-textarea@7.1.0 — an abandoned package declaring react-dom: ^0.14 || ^15 || ^16). Yarn merged these into one resolution context and found non-overlapping ranges. Placing react/react-dom in devDependencies avoids triggering Yarn's peer dependency validation across the merged context, while still making them available for builds and tests. This follows the pattern used by @automattic/block-renderer. Also fixes dependency hygiene: - Add missing runtime deps: @automattic/viewport, @automattic/zendesk-client, @wordpress/blocks, @wordpress/html-entities, history - Add missing dev deps: @testing-library/react, @testing-library/user-event, smooch (type-only import) - Move @wordpress/base-styles to devDependencies (SCSS-only import) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
CI failed because Moving them to |
@testing-library/user-event requires @testing-library/dom as a peer dependency. Without it, Yarn fails with YN0002 in CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Part of BSKY-1858
Proposed Changes
ZoomActionButtonthat toggles the Gutenberg editor canvas zoom onshow_componenttool messagesuseCopyActiontoCopyActionButtoncomponent with copied state feedbackorderto all message actions to control rendering positionunlock-private-apisandcanvas-zoomutilitiesWhy are these changes being made?
When the AI agent renders a site preview via
show_component, users need a quick way to zoom the editor canvas in/out without navigating to the editor toolbar. Converting actions to component action types enables richer UI (reactive state, visual feedback) that button actions can't provide.Testing Instructions
2026-04-02.6.13.29.mov
2026-04-02.6.15.55.mov
Pre-merge Checklist