Skip to content

Skills: chatbot tool calling on the WP Abilities API - #209

Open
HardeepAsrani wants to merge 5 commits into
feat/issue-192from
feat/issue-195
Open

Skills: chatbot tool calling on the WP Abilities API#209
HardeepAsrani wants to merge 5 commits into
feat/issue-192from
feat/issue-195

Conversation

@HardeepAsrani

@HardeepAsrani HardeepAsrani commented Jul 22, 2026

Copy link
Copy Markdown
Member

Adds Skills: the chatbot can call tools during a reply, built on the WordPress Abilities API (WP 6.9+). Admins pick which of the site's registered read-only abilities the bot may use, and Hyve ships its own curated packs (WooCommerce storefront lookups and a site content search). Closes https://github.com/Codeinwp/hyve/issues/195.

Everything functional is Pro. This plugin holds the engine seams and the widget rendering; the framework, settings UI, packs, and REST routes live in the Hyve Pro PR. The platform side for Hyve Connect is in the agents PR.

Pro PR: https://github.com/Codeinwp/hyve/pull/269
Agents PR: https://github.com/Codeinwp/agents/pull/153

What it does

Skills. Under Settings, Integrations, Skills, admins enable tool calling and pick abilities from what plugins registered on the Abilities API. Only read-only abilities are offered; WordPress core's own are hidden. Skills appear grouped per plugin, with Hyve's packs first, framed as experimental.

Hyve's packs.

  • WooCommerce Experience by Hyve (pre-enabled once Skills are on, only when WooCommerce is active): product search (keyword, category, price range, stock; retries plural keywords as singular) and order status for the logged-in customer. Identity always comes from the session, never from asking the visitor.
  • Search site content (off by default): a knowledge-base miss falls back to searching published posts and pages; matched posts are cited under the reply with the standard source chips.

Display cards. A skill can return a generic display payload (list or single item: label, description, meta, image, url, optional action pills). The widget renders the cards and the model only writes a one line intro, so lists render instantly and the model cannot mangle details. Cards are stored with the transcript and replay from history.

Both engines.

  • Self-hosted: the plugin runs the OpenAI tool loop in process (cap 5 rounds, with a graceful abort that answers pending calls so the conversation is never left broken).
  • Hyve Connect: the site advertises its enabled skills to the platform with a short-lived callback token; the platform drives the loop and posts tool calls back to a new hyve/v1/skill-run route. Everything the token grants (allowlist snapshot, visitor identity) is bound server-side at mint time, and display cards plus cited posts never leave the site.

How it's split

  • Engine seams + widget (this plugin): the tool loop in the streaming and poll paths (dormant without Pro), display card rendering and history replay, source chip handling, and the Connect turn plumbing.
  • Framework, UI, packs, routes (Hyve Pro): ability discovery and mapping, the Skills settings screen, the two packs, the skill-run callback route and token binding.
  • Connect parity (agents): the OpenRouter native tool loop, the site callback client, and per-skill usage rows in the workflow view.

Manual QA

Needs an active Pro license, WordPress 6.9+, and WooCommerce for the store pack.

  1. Enable: Settings, Integrations, Skills; toggle on. Woo skills come pre-enabled, content search stays off until picked.
  2. Products: ask "Show me hoodies under 50 dollars". Expect one intro sentence plus product cards (name, price, image, link) and no follow-up chips on that turn.
  3. Order status: log in as a customer with an order and ask "Where is my order?". Expect a status line plus an order card linking to the account page. Logged out, the bot explains it cannot look orders up.
  4. Content fallback: enable Search site content, then ask about something covered by a post but not the knowledge base. Expect a text answer with source chips linking to the post.
  5. Hyve Connect: switch to Connect mode and repeat 2 to 4; behavior matches self-hosted.
  6. Off switch: disable Skills and confirm the bot behaves exactly as before.

Unit tests cover discovery and mapping, loop plumbing (call pairing, display capture and sanitizing, abort), both packs, the Connect token binding and callback, and the platform loop; Playwright covers the settings screen and widget card rendering.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

Plugin build for 5cf7088 is ready 🛎️!

The prompt reformat left apply_system_prompt without its doc comment
(PHPCS) and its inferred param/return types (PHPStan), and preg_replace's
string|null return was passed to trim. Reorder the compact_prompt helper
above apply_system_prompt so each keeps its own doc block, and cast the
preg_replace result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants