Automattic / Automattic/frontend-agent-chat
Allow frontend chat for resolved non-user audience principals
- Dominant language
- PHP
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
Frontend Agent Chat currently hides the FAB for anonymous visitors because it depends on `frontend_agent_chat_list_accessible_agents()`, while `frontend_agent_chat_user_can_see()` explicitly bails when `! is_user_logged_in()`. That is correct for public internet defaults, but it prevents trusted non-user audiences from using selected frontend agents.
## Concrete scenario
A WP Cloud runtime can be private/proxied at the edge. Public internet receives a 403 before WordPress, while requests that reach WordPress can represent an internal audience. The FAB should be able to appear for that audience once Agents API/Data Machine resolve and authorize an audience principal.
## Proposed shape
- Replace the hard logged-in-user visibility gate with a generic "current principal can access at viewer/operator role" check.
- Continue hiding the FAB when no principal or accessible agent exists.
- Avoid site-specific bypass filters; consume the generic Agents API/Data Machine audience access contract.
## Acceptance criteria
- Logged-in user behavior is unchanged.
- Anonymous public visitors still see nothing unless a host resolves an authorized principal/audience.
- A trusted audience principal can list accessible agents and use the chat widget.
- The widget can require operator access when chat execution needs operator-level tools.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing frontend_agent_chat_list_accessible_agents() and frontend_agent_chat_user_can_see(), then inspect the Agents API/Data Machine audience access contract they consume. Verify that logged-in behavior remains unchanged, public anonymous requests remain hidden, and a resolved authorized audience principal can list agents and use the widget with viewer or operator requirements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, authorization, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100