AI Sidebar: Update Jetpack AI Sidebar contract#111814
Conversation
- Gate suppresses the legacy sidebar on non-Simple sites by the absence of jetpackAiSidebar; drops only the Jetpack provider, keeps the rest - Reader reads jetpackAiSidebar.features.*: AER single-source, Optimize Title defaults off, remove unread chatHistory/supportGuides - Narrow agentsManagerData type; update tests Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
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 |
There was a problem hiding this comment.
Pull request overview
Updates Calypso’s Agents Manager / Jetpack AI Sidebar integration to match Jetpack’s renamed inline contract (agentsManagerData.jetpackAiSidebar instead of jetpackAiSidebarPreview) and adjusts client-side gating/feature-flag behavior accordingly.
Changes:
- Switch Jetpack AI Sidebar feature flag reads to
agentsManagerData.jetpackAiSidebar.features.*and remove legacy flag fallbacks. - Update the Agents Manager “preview gate” logic to suppress legacy Jetpack sidebar mounts on non-Simple sites by the absence of
jetpackAiSidebar(while preserving non-Jetpack providers). - Narrow the inline-data typing and update affected unit tests.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/jetpack-ai-sidebar/src/index.ts | Reads the new jetpackAiSidebar config and gates suggestions/features based on enabled + features.*. |
| packages/jetpack-ai-sidebar/src/index.test.ts | Updates provider tests to use the renamed config key and new defaults/expectations. |
| packages/jetpack-ai-sidebar/src/global.d.ts | Updates the declared agentsManagerData shape to the renamed inline payload. |
| apps/agents-manager/jetpack-ai-sidebar-preview-gate.js | Changes legacy suppression behavior to key off presence/absence of jetpackAiSidebar on non-Simple sites. |
| apps/agents-manager/tests/jetpack-ai-sidebar-preview-gate.test.js | Updates gate tests for the new contract marker and legacy suppression expectations. |
| apps/agents-manager/tests/agents-manager-gutenberg.test.js | Updates gutenberg entry tests to reflect the new suppression logic (no longer depends on jetpackAiSidebarPreview). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it( 'suppresses on non-Simple sites when the legacy sidebar is the only provider', () => { | ||
| setAgentsManagerData( { | ||
| sectionName: 'gutenberg', | ||
| agentProviders: [ JETPACK_PROVIDER ], | ||
| jetpackAiSidebarPreview: { enabled: true }, | ||
| } ); |
| * @returns {boolean} True when Agents Manager should not mount at all — the legacy | ||
| * Jetpack sidebar was the only provider. | ||
| */ | ||
| export function shouldSuppressJetpackAiSidebarPreview() { |
There was a problem hiding this comment.
I'd be in favour of removing all this logic and just gating on the presence of data.jetpackAiSidebarPreview. Would that work? Default to false, true if data?.jetpackAiSidebarPreview is truthy.
Proposed Changes
Client-side half of the Jetpack AI Sidebar contract rename: Jetpack now emits
agentsManagerData.jetpackAiSidebarinstead ofjetpackAiSidebarPreview.jetpackAiSidebar. Drop only the Jetpack provider; keep the rest (Big Sky, …). Simple stays server-gated.jetpackAiSidebar.features.*. AI Editorial Review comes from that single flag; Optimize Title defaults off; remove the unreadchatHistory/supportGuides.agentsManagerDatatype and update tests.Companion: Automattic/jetpack#49489 (carries the
jetpackAiSidebarkey).Why are these changes being made?
The companion Jetpack PR renames the emitted payload key while making the sidebar honour the WordPress.com AI Assistant setting. Calypso must read the new key so feature gating stays correct after the rename.
Testing Instructions
Client half of the companion Jetpack PR — follow its testing instructions: Automattic/jetpack#49489
Pre-merge Checklist