Repository navigation
Conversation
Adds ai/show-screen, which takes A2UI v0.9.1 messages and ends the turn, like ai/ask-user. The transcript renders the screen with @swissspidy/a2ui-wp (WordPress components), and a button press is sent as the person's next message, shown as the button's text. The server allows the basic catalog only, without Image, Video and AudioPlayer, and limits a screen to 20 messages and 32 KB. The client removes the media components as well and restricts openUrl to this site. A screen never writes: changes still go through a proposal and its approval card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/ai-workspace #1332 +/- ##
=======================================================
+ Coverage 85.67% 85.71% +0.03%
- Complexity 5873 5904 +31
=======================================================
Files 217 217
Lines 21466 21558 +92
=======================================================
+ Hits 18391 18478 +87
- Misses 3075 3080 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What?
Related: #1004
An experiment, not meant to merge as is. It lets the AI Workspace model show the person a small screen (a summary card, a comparison, a short form) built from A2UI messages. The screen is rendered with the WordPress component library through Pascal Birchler's a2ui-wp renderer (
@swissspidy/a2ui-wp0.2.0). A button press on the screen goes back to the model as the person's next message.Why?
Pascal's renderer draws agent-described screens with
@wordpress/components. Its README lists "tools for the agent" from the Abilities API as the next step, and that is what the workspace already has. This PR checks how the two fit together, and what it would cost to ship.How?
ai/show-screen(Show_Screen.php), modelled onai/ask-user:What the server allows:
Image,VideoandAudioPlayer, whose URLs would let the model make the browser fetch any address;createSurface;Each refusal tells the model what to change.
The system instruction gets a short A2UI guide when the tool is offered. It is adapted from a2ui-wp's agent instructions, with credit. It tells the model to use only data it looked up, and that a screen never changes the site: changes still go through a proposal and its approval card.
The transcript (
Screen.tsx) renders each screen with its own renderer instance.openUrlto this site.inertand dimmed, like a question card.A button press is sent as
[screen] <event> "<button text>" {context}, so the model gets the event and its data. The person seesChose "<button text>"and the readable values, not the JSON.The
ai/show-screentool is added to the workspace's default tool list (Tool_Selector) and to the abilities that end a turn (Turn_Runner).Two problems came up while building it:
{}into[]when it decodes the model's tool call, and the renderer refuses"context": []. The client restores empty objects undercontext,argsandtheme. Any ability that passes free-form JSON through the workspace would hit the same thing.@wordpress/icons17 or later, and the plugin has 12.2. A peer dependency cannot have its own nested copy, sowp-icons-for-a2ui(an npm alias for@wordpress/icons@19.0.0) is installed. A webpack rule points the renderer's@wordpress/iconsimport at it, and only inside that package.Use of AI Tools
AI assistance: Yes. Tool(s): Claude Code (Claude Opus 5.5). Used for: implementing the experiment and its tests, the live and browser checks, and writing this description.
I've reviewed the changes, understand them and can explain them under review. They have all been tested locally.
Testing Instructions
Chose "…"with the post title, the screen dims, and the model answers.Tests run (all passing):
PHPUnit:
tests/Integration/Includes/Experiments/AI_Workspace/Show_ScreenTest.php:test_returns_a_valid_screen_unchanged;test_refuses_an_invalid_screen, with ten cases: an image, a video, an unknown component, another catalog, nocreateSurface, twocreateSurface, adeleteSurface, two message types in one message, another version, and too large;test_refuses_outside_a_workspace_turn;test_is_hidden_from_rest;test_ends_the_turn.Tool_SelectorTestandTool_PolicyTestnow listai/show-screenamong the default workspace tools.Live check (Anthropic
claude-sonnet-5, through the workspace REST route and in the browser):@a2ui/web_core's own validation, and the counts matched the site;Browser (headless Chromium, full UI):
Chose "…", and the screen goes inert after a press;This caught a bug: the screen reset to its starting values after a press, because a new renderer was made on every render. That is fixed by keying on the messages' content.
Other checks: tsc, lint-js, phpcs and PHPStan (full project) are clean, and the build succeeds.
Not run:
Screenshots
Chose "Finish this first"with the post's title, and the model answers.Known limits
zod(required by@a2ui/web_core) and the second icons copy.@a2ui/web_coreand@swissspidy/a2ui-wpare Apache-2.0. Bundling them makes the built script GPL-3.0-or-later, and the plugin ships as GPL-2.0-or-later. This needs a decision before anything like this merges.remote-work).Changelog Entry
🤖 Generated with Claude Code