Skip to content

Agents Manager show Sources component#109436

Open
jcheringer wants to merge 3 commits intotrunkfrom
update/agents-manager-sources
Open

Agents Manager show Sources component#109436
jcheringer wants to merge 3 commits intotrunkfrom
update/agents-manager-sources

Conversation

@jcheringer
Copy link
Contributor

@jcheringer jcheringer commented Mar 21, 2026

Fixes BSKY-1582

Depends on 305-ghe-Automattic/agenttic

Summary

  • Add SourcesDisplay component that renders a collapsible FoldableCard with deduplicated source links (page icon + title + chevron)
  • Intercept data content blocks with a sources array in process-tool-messages.ts and replace them with the SourcesDisplay component
  • Handle source link clicks with the same support-article detection logic as CustomALink (navigates to /post?link=... for support articles, records Tracks events)
  • Add @automattic/components as an explicit dependency (was already used implicitly via SummaryButton)

Context

The workflow agent (wpcom-workflow-support_chat) returns support article sources alongside its text responses. After agenttic-client normalizes these into { type: 'data', data: { sources } } content blocks, this PR picks them up and renders a proper collapsible sources card instead of raw JSON.

Test plan

Setup (until the agenttic-client dependency is published)

This PR depends on unreleased changes in @automattic/agenttic-client. To test locally:

  1. Clone the agenttic repo and checkout 305-ghe-Automattic/agenttic
  2. Build and pack the client package:
    cd agenttic/packages/agenttic-client
    pnpm build
    pnpm pack
  3. In Calypso, temporarily point the dependency to the packed tarball:
    # Replace all agenttic-client references
    - "@automattic/agenttic-client": "^0.1.54",
    + "@automattic/agenttic-client": "/path/to/agenttic/packages/agenttic-client/automattic-agenttic-client-0.1.54.tgz",
  4. Run yarn install in Calypso root
  5. Sync the agents manager app with your sandbox

Testing

  • Make sure the Unified Experience is enabled - https://wordpress.com/wp-admin/profile.php
  • Navigate to a page where the AI Chat is available and add ?agent=wpcom-workflow-support_chat to the URL
  • Ask a question that triggers sources (e.g. "How to add a domain?")
  • Verify the text answer renders normally and a collapsed "Sources" card appears
  • Expand the sources card and verify source links are listed with page icon + title + chevron
  • Click a source link — support articles should open in the post view, external links should open normally
  • Reload the page and verify sources still appear correctly on the reloaded conversation
  • Verify the sources card does not interfere with feedback action buttons (thumbs up/down)

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@jcheringer jcheringer self-assigned this Mar 21, 2026
@jcheringer jcheringer requested a review from a team March 21, 2026 01:15
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 21, 2026
@jcheringer jcheringer marked this pull request as ready for review March 21, 2026 01:16
@matticbot
Copy link
Contributor

matticbot commented Mar 21, 2026

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • agents-manager
  • help-center
  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/agents-manager-sources on your sandbox.

@jcheringer jcheringer force-pushed the update/agents-manager-sources branch from ef89ab2 to 1cc9196 Compare March 21, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants