Add wp-ai-client, wp-ai-connectors, wp-ai-plugin (WP 7.0+ AI surfaces)#49
Open
henryperkins wants to merge 6 commits into
Open
Add wp-ai-client, wp-ai-connectors, wp-ai-plugin (WP 7.0+ AI surfaces)#49henryperkins wants to merge 6 commits into
henryperkins wants to merge 6 commits into
Conversation
Adds three skills covering the WP 7.0+ AI surface: - wp-ai-client — building AI features via wp_ai_client_prompt() and the in-core fluent prompt builder, including REST patterns, error handling, feature detection, and the using_abilities() bridge to the Abilities API. - wp-ai-connectors — writing AI provider plugins that register with AiClient::defaultRegistry() and surface in Settings -> Connectors via the Connectors API auto-discovery flow. - wp-ai-plugin — extending the canonical WordPress/ai plugin with Experiments (Abstract_Feature), paired Abilities, Guidelines, and the documented wpai_* extension hooks. Extends wp-abilities-api with WP 7.0+ client-side coverage (@wordpress/core-abilities, executeAbility, core/abilities store) and a new MCP exposure reference for routing abilities to Claude Desktop, Cursor, and ChatGPT via the MCP Adapter. Updates wordpress-router decision tree with routing entries for the new skills and the MCP sub-route. Adds four eval scenarios covering the new skills' procedures. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The compatibility contract assertion required every skill to declare WordPress 6.9 + PHP 7.2.24 in its frontmatter. The new wp-ai-client, wp-ai-connectors, and wp-ai-plugin skills target WP 7.0+ exclusively (the AI Client and Connectors API don't exist in 6.9), so they cannot honestly claim 6.9 compatibility. Accept either baseline — legacy (WP 6.9 + PHP 7.2.24) or AI-era (WP 7.0 + PHP 7.4) — and update the assertion message accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brings docs/compatibility-policy.md in line with the harness change in ca6fd44. Skills targeting WP 7.0+ AI surfaces (AI Client, Connectors API, client-side Abilities API) declare WordPress 7.0+ / PHP 7.4+; all other skills continue to declare the 6.9 / 7.2.24 default floor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add WP 7.0 AI skill set + abilities-api extensions
prompt-builder.md: the conditional autoloader used
wp_get_wp_version(), which isn't a canonical WordPress function.
Replace with feature detection on wp_ai_client_prompt() — the
standard "feature, not version" pattern.
rest-patterns.md: the image upload example had a placeholder
comment ("/* extract from data URI */") inside base64_decode(),
making the snippet syntactically incomplete. Replace with a real
data-URI parser: bounded size, allowed-subtype regex (png/jpeg/
webp), strict base64, post-upload MIME re-validation, cleanup on
failure.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match the precedent set by PR WordPress#22 (wp-plugin-directory-guidelines) and list the three new WP 7.0+ AI skills in the discoverability table.
Contributor
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Adds three skills covering WordPress 7.0+ AI surfaces —
wp-ai-client,wp-ai-connectors,wp-ai-plugin— plus additive extensions towp-abilities-apifor the WP 7.0+ JS API and the MCP Adapter. The eval harness gets an 8-line change so it accepts either the existingWP 6.9 + PHP 7.2.24baseline or a newWP 7.0 + PHP 7.4one; existing skills are unaffected.Background: this is one of the three approaches I sketched in #48 (the dual-baseline one). I'm opening it as a concrete reference for that discussion rather than asserting the policy is decided — if maintainers prefer the
class_exists-guards approach or want to keep the repo single-baseline, happy to close and reshape.Summary
wp-ai-client,wp-ai-connectors,wp-ai-plugin.wp-abilities-apifor the WP 7.0+ client-side JS API and the MCP Adapter (existing 6.9 content untouched).wordpress-routerso AI tasks route to the right skill.eval/harness/run.mjsaccepting either the existingWordPress 6.9 + PHP 7.2.24baseline or a newWordPress 7.0 + PHP 7.4baseline. Existing skills are unaffected.Diff: +2,570 / −10 across 26 files. No existing skill's frontmatter, body, or scenarios are modified.
Why dual-baseline
The new AI surfaces (
wp_ai_client_prompt(),WP_Connector_Registry, the canonical AI plugin'sAbstract_Feature) literally do not exist on 6.9. A skill targeting them with a 6.9 floor would either lie in its compatibility line or load-bearclass_exists()guards in every example — both options trade honesty for the harness check. The dual-baseline approach keeps each skill's declared floor truthful and the harness still gates against drift (now expressed against either of two named baselines).The harness change is small enough to read here:
What's added
wp-ai-client— building features with the in-core AI ClientSKILL.md plus three references (
prompt-builder.md,rest-patterns.md,error-handling.md) and adetect_ai_client.mjsscript.Anchored to canonical surfaces:
wp_ai_client_prompt(),WP_AI_Client_Prompt_Builder, theis_supported_for_*()family,using_abilities()as the bridge to the Abilities API, thewp_ai_client_prevent_promptfilter (clarifies that the filter receives a clone of the builder),GenerativeAiResult. Reference patterns include per-feature REST endpoints (vs. the high-privilege client-side prompt API), structured output viaas_json_response(), and image generation that lands in the Media Library with bounded data-URI parsing and post-upload MIME re-validation.Sources cited: the AI Client dev note,
WordPress/php-ai-client,WordPress/wp-ai-client, Trac #64591.wp-ai-connectors— provider pluginsSKILL.md plus three references (
provider-registration.md,capabilities-declaration.md,community-providers.md).Encodes the canonical bootstrap from
WordPress/ai-provider-for-anthropicv1.0.2 verbatim:AiClient::defaultRegistry()->registerProvider(Class::class)(class-name string, not instance;registerProvider, notregister),class_exists+hasProviderguards,initpriority 5 to run before_wp_connectors_initat 10, auto-discovery means you do not callWP_Connector_Registry::register()for new providers, the API key naming convention (connectors_ai_{id}_api_key, env/constant{ID}_API_KEY), and the env > constant > database priority order. Community-providers reference covers the OpenRouter (aggregator), Ollama (noneauth, local), and Mistral (direct-API) patterns.Sources cited: the Connectors API dev note, the AI Client dev note, the three flagship provider plugins, the Call for Testing post.
wp-ai-plugin— extending the canonical AI pluginSKILL.md plus four references (
experiments-framework.md,dashboard-widgets.md,guidelines-integration.md,hooks-and-filters.md).Anchored to
WordPress/aiv0.8.0 source. CoversAbstract_Feature(correct namespaceWordPress\AI\Abstracts\Abstract_Feature, notWP\AI\Features\Abstract_Feature— a common error), the two extension points (wpai_default_feature_classesfilter,wpai_register_featuresaction), the canonicalExample_Experimentas the copy-this starting point, paired-Ability registration viawp_abilities_api_init,guideline_categories()opting an Ability into Guidelines automatically,wp_supports_ai()gating, and the actualWPAI_*constant names (WPAI_PLUGIN_FILE,WPAI_PLUGIN_DIR,WPAI_PLUGIN_URL— notWPAI_FILE/WPAI_PATH/WPAI_URL). The dashboard-widgets reference explicitly states there is no AI-plugin-specific widget framework in v0.8.0 — extensions use standardwp_add_dashboard_widget().Source cited:
WordPress/ai(the source is the canonical reference) plus the AI Team blog.wp-abilities-api— additive extensionsTwo new references:
references/client-side.md— WP 7.0+ JavaScript API:@wordpress/abilitiesand@wordpress/core-abilities,registerAbility/executeAbility, thecore/abilitiesstore, how annotations (readonly/destructive/idempotent) drive the HTTP method (GET/DELETE/POST) whenexecuteAbilitycalls a server-registered ability through REST.references/mcp-exposure.md— installing the MCP Adapter via Composer, how abilities map to MCP tools, the default server vs. a custom server (create_server()has 13 parameters in v0.5.0+; the 7th is the required transports array), the twomcp_adapter_default_server_*filters, the Plain-permalinks gotcha, and Application Passwords for local Claude Desktop / Cursor integration.The SKILL.md update adds step 6 (consume from JS) wording for the WP 7.0+ surface and a new step 7 (expose via MCP). The 6.9 content is unchanged and
wp-abilities-apikeeps its 6.9 + PHP 7.2.24 baseline; the new references are additive context for sites running 7.0.wordpress-router/references/decision-tree.mdAdds entries for AI Client / Connectors API / canonical AI plugin / MCP Adapter so AI-related tasks route correctly. Existing entries unchanged.
Eval scenarios
Four new scenarios under
eval/scenarios/:ai-client-add-feature-endpoint.json— "add a 'rewrite paragraph' button to the editor"ai-connectors-register-provider.json— "build a Mistral provider plugin"ai-plugin-register-experiment.json— "add an internal-link suggestion Experiment toWordPress/ai"abilities-mcp-expose.json— "expose existing abilities to Claude Desktop via MCP"Each lists explicit success criteria pinned to method names / namespaces / hook timing — they catch the named errors a model is most likely to produce on these surfaces (e.g.,
register()vsregisterProvider(), the wrong namespace forAbstract_Feature, missingclass_existsguards).Docs
docs/compatibility-policy.md— names both baselines, documents that 7.0+ is only for skills covering features unavailable on 6.9.docs/skill-set-v1.md— lists the three new skills.README.md— adds the three new skills to the Available Skills table (matches PR New Skill: wp-plugin-directory-guidelines #22's precedent).Verification
Locally on
feat/wp-ai-skills:node eval/harness/run.mjs→OK: skills frontmatter and triage report sanity checks passed.node shared/scripts/skillpack-build.mjs --clean --out=/tmp/x --targets=codex,vscode→ both packs build.node skills/wp-ai-client/scripts/detect_ai_client.mjs→ returns the documented JSON shape on a non-WP repo.CI (
.github/workflows/ci.yml) is unchanged. Theskills-ref validatestep in CI explicitly enumerates a subset of skills today (it does not currently validatewp-rest-api,wp-phpstan,wpds,blueprint,wp-plugin-directory-guidelineseither) — I left it unchanged here so this PR is purely additive. Adding the new skills to that list is a separate cleanup if maintainers want it.Test plan
node eval/harness/run.mjspasses on CI.WordPress 7.0+PHP 7.4.WordPress 6.9+PHP 7.2.24.wordpress-routerdecision-tree changes route AI/MCP queries correctly without breaking existing routes.Example_Experiment.php, dev notes) to confirm method/namespace accuracy.Notes for maintainers
docs/ai-authorship.mdis intentionally not modified in this PR — the existing table is per-skill discretion (PR New Skill: wp-plugin-directory-guidelines #22 did not extend it either) and I'd rather follow the maintainer's preference than guess.skills/); the build script auto-discoversskills/*/SKILL.md.🤖 Generated with Claude Code