Repository navigation
feat(templates): finish Add in a retryable setup conversation - #198603
Conversation
The card payload reader required official: true, so a Gateway-authored card for a community plugin was dropped before it reached the chat. Plugin cards now carry the registry's official flag; skill cards stay official-only. The loading placeholder shows the official badge only for official cards. The loaded card already rechecks the Gateway's catalog answer, shows no badge for a community plugin, and offers View details instead of Install.
clawhub now takes either query (search, unchanged) or plugin, the exact ClawHub package name. The exact form looks up that one package, never falls back to search, and shows its existing card. A name ClawHub does not know, or that is not a plugin, returns an explanation and shows no card. Search still returns official plugins and skills only. An exactly named community plugin is shown with the registry's own official flag.
The release detail already validates the Template's agent id from the ClawHub manifest summary. Return it so a client can name the agent it wants before Add, without a plan.
A request with mode "chat" names the agent id it wants and carries no plan digest. The Gateway admits the agent and chat under an unused id, fetches the Template, writes its workspace, then installs declared skills, bundled plugins and MCP servers one at a time. A dependency that cannot be set up is collected instead of stopping creation, and plugins referenced on ClawHub and automations are left to the agent's conversation. Failing to fetch the Template or write its workspace removes the agent and chat this request created. The agent's first turn starts after creation and receives a setup report through buildTemplateOpeningMessage, which still returns the existing opening. The plan-based request used by the CLI is unchanged.
Chat-based Add copies the Template's CLAW.md unchanged to the workspace root as an ordinary file, bound into the same retry checkpoint as the other workspace files. A Template whose own workspace files claim that path keeps its file and the setup report says so. The saved tool allowlist gains automations, plugins and message when the Template's allowlist omits them. A Template without an allowlist inherits the operator's policy, and a tool the Template denies stays denied.
Drive templates.add.apply in chat mode against a Template fixture shaped like Travel Copilot, with real admission, workspace, bundled skill and plugin, MCP and rollback owners. A declared plugin that is installed but disabled does not block, a missing skill keeps the agent and is reported, an unfetchable Template or failed workspace write leaves no agent, chat or workspace, and a taken id yields the next unused one.
Add no longer requests templates.add.plan. It sends one chat-mode templates.add.apply with the release's package name, exact version and an agent id derived from the Template's own id, then opens the pending chat as before. The review step for plugin capability grants and skill warnings is gone from the Add path; ClawHub's audit of a flagged release still asks first. A card Add reads the release detail once, because only the detail names the Template's agent. When the Gateway answers a first Add with an error it kept nothing, so the user returns to the catalog with the error on that card.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Keep both the chat-mode routing test and main's authored MCP declaration test in templates-add.test.ts.
|
The squash commit's tree equals the merge of its parent with the creation head this branch already contains, so this branch's tree is unchanged.
Setup, Retry and upgrade evidence for the build that contains this layerThis answers the proof requests in the review of Setup turn with a real model and plugin cardReal Control UI Add of
This Template declares no automations, so this run does not show a paused automation. Failed opening, then Retry on the same agentThe paired before/after run for a failed opening turn followed by a cold Gateway restart is in #198637 (comment). After the provider was restored and the Gateway cold-restarted, Retry completed the same agent and session with Latest-stable upgrade keeps existing dataAn isolated Gateway ran official The same comment linked above also describes a four-process real-SQLite round trip of the new setup receipt fields (write, cold read, clear, cold read after clear). What this does not show
Screenshots and recordings of these runs are retained locally and have been inspected. They are not attached here because the attachment route had no authenticated browser session. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
The squash commit's tree equals the merge of its parent with the setup head this branch already contains, so this branch's tree is unchanged.
…aw#198603) * feat(clawhub): let chat plugin cards represent community plugins The card payload reader required official: true, so a Gateway-authored card for a community plugin was dropped before it reached the chat. Plugin cards now carry the registry's official flag; skill cards stay official-only. The loading placeholder shows the official badge only for official cards. The loaded card already rechecks the Gateway's catalog answer, shows no badge for a community plugin, and offers View details instead of Install. * feat(message): show one exact ClawHub plugin card by package name clawhub now takes either query (search, unchanged) or plugin, the exact ClawHub package name. The exact form looks up that one package, never falls back to search, and shows its existing card. A name ClawHub does not know, or that is not a plugin, returns an explanation and shows no card. Search still returns official plugins and skills only. An exactly named community plugin is shown with the registry's own official flag. * docs(control-ui): document exact ClawHub plugin cards * fix(chat): render source reply cards before run adoption * test(chat): classify producer display regression as Node integration * fix(message): send ClawHub cards without generated captions * perf(chat): consolidate source reply admission and card decoding * test(chat): document independent card delivery proof boundaries * refactor(chat): use native named-export lazy card loading * refactor(outbound): keep attachment normalization in payload owner * test(chat): attach profile isolation reason to the mock * feat(templates): name the Template's agent in catalog detail The release detail already validates the Template's agent id from the ClawHub manifest summary. Return it so a client can name the agent it wants before Add, without a plan. * feat(templates): add a plan-free chat mode to templates.add.apply A request with mode "chat" names the agent id it wants and carries no plan digest. The Gateway admits the agent and chat under an unused id, fetches the Template, writes its workspace, then installs declared skills, bundled plugins and MCP servers one at a time. A dependency that cannot be set up is collected instead of stopping creation, and plugins referenced on ClawHub and automations are left to the agent's conversation. Failing to fetch the Template or write its workspace removes the agent and chat this request created. The agent's first turn starts after creation and receives a setup report through buildTemplateOpeningMessage, which still returns the existing opening. The plan-based request used by the CLI is unchanged. * feat(templates): copy CLAW.md and allow setup tools in chat-based Add Chat-based Add copies the Template's CLAW.md unchanged to the workspace root as an ordinary file, bound into the same retry checkpoint as the other workspace files. A Template whose own workspace files claim that path keeps its file and the setup report says so. The saved tool allowlist gains automations, plugins and message when the Template's allowlist omits them. A Template without an allowlist inherits the operator's policy, and a tool the Template denies stays denied. * test(templates): cover chat-based Add at the Gateway request seam Drive templates.add.apply in chat mode against a Template fixture shaped like Travel Copilot, with real admission, workspace, bundled skill and plugin, MCP and rollback owners. A declared plugin that is installed but disabled does not block, a missing skill keeps the agent and is reported, an unfetchable Template or failed workspace write leaves no agent, chat or workspace, and a taken id yields the next unused one. * feat(ui): add Templates from the Control UI without a plan Add no longer requests templates.add.plan. It sends one chat-mode templates.add.apply with the release's package name, exact version and an agent id derived from the Template's own id, then opens the pending chat as before. The review step for plugin capability grants and skill warnings is gone from the Add path; ClawHub's audit of a flagged release still asks first. A card Add reads the release detail once, because only the detail names the Template's agent. When the Gateway answers a first Add with an error it kept nothing, so the user returns to the catalog with the error on that card. * docs(templates): describe plan-free Add from the Control UI * fix(templates): retain effective setup tool grants in chat Add * fix(ui): open Template chat before resolving release details * fix(templates): reserve original manifest in chat Add * fix(templates): extract Gateway Add result leaf contract * perf(templates): keep trust decoder outside shared UI boot * fix(templates): report incomplete chat Add setup truthfully * test(templates): preserve reviewed checkpoint across chat retry refusal * fix(pr): include the ClawHub trust reader in wrapper extraction * perf(templates): decode trust errors without connection adapter * fix(templates): explain reserved manifest recovery after rollback * test(templates): reconcile creation regression allocation * feat(templates): add the setup prompt for a new Template agent The Gateway is moving to create a Template agent deterministically and leave the remaining setup to the agent's own first turn. This adds the hidden prompt for that turn. It is not used yet. The prompt fixes the order of the setup conversation: greeting, paused automations from CLAW.md, added MCP servers, ClawHub plugin state and install cards, creation failures, then the author's BOOTSTRAP.md opening. Automations carry the same declaration key, schedule, session target and delivery as the Gateway installer creates today, so a second run adds no duplicates. CLAW.md and the report are author-influenced, so the prompt treats them as data. Report text reaches the model only as bounded JSON, and two rules hold whatever a workspace file says: automations stay paused, and only the user installs or enables a plugin. * feat(gateway): run a Template setup prompt with the agent's tools The Template opening turn passed an empty runtime tool allowlist, which removes every tool, so the agent could not finish its own setup. startAgentOnboardingConversation now accepts the setup prompt for a Template agent. With one, the turn sends that prompt and passes no runtime allowlist, so the agent's own tool policy decides what it can call. The prompt stays hidden from the chat as before. No caller passes a prompt yet, so the existing Template opening and New agent onboarding still run without tools. * fix(plugins): preserve exact package identity in tool inventory * feat(templates): finish Add through retryable hidden setup * docs(templates): reconcile chat Add manifest and heartbeat limits * fix(templates): present setup cards without redundant narration * fix(templates): preserve incomplete dependency results through setup retry * fix(templates): keep setup retry outcomes truthful independently
What problem this solves
Template Add can create the agent but its tools-disabled opening cannot finish the declared setup or recover a failed opening without repeating creation.
What changes
After creation, one hidden setup turn uses the new agent’s ordinary tools and retained permissions. It greets in the Template’s voice, creates declared automations paused, reports MCP sign-in needs, and shows exact-package plugin cards without installing or enabling those plugins. Explicit tool denies and operator ceilings remain authoritative.
The ordinary session owns the retryable setup continuation. Retry uses the same agent, workspace and conversation without reinstalling dependencies. When its one-shot receipt has already been consumed, Retry returns a truthful partial/unverifiable outcome instead of inventing readiness or creating another agent. Plugin inventory includes canonical package identity so the agent does not infer a plugin ID from its package name.
This layer follows #198070. Early-opening/dependency concurrency and composer responsiveness remain a separate follow-up.
Evidence
Current repair qualification
Head
577e12a6b457945be951b6e97a753b9c2cfebaef, base9ed5a58794db142be41f5e142e68a5cd92d72bd0:node scripts/test-projects.mts src/gateway/server-methods/templates-add-chat.integration.test.ts --maxWorkers=1. The same agent, workspace, edited files and dependency-install counts are preserved. External registry/model I/O is fixed; admission, config, workspace, session, rollback and retained setup ownership remain real. No new test seam or mock was introduced.Retained prior qualification
Prior setup
e68f2ecdbc3b54fea242e6ca545d1f0830bc0affaboveb7235cc095dff0eebd90cd268b2695ca96f98a08:node --import ./scripts/tsx.mjs scripts/check-control-ui-performance-base.mts b7235cc095dff0eebd90cd268b2695ca96f98a08.The prior hosted native Talk and UI failures were compared with scheduled main run43540514362 and have identical failure signatures; they are not passing CI. New-head checks still need reconciliation. No inherited-failure qualification covers an introduced defect.
Real product evidence and remaining gap
Earlier integrated Travel Copilot proof, not this exact head: baseline creation opened chat at19.9s, failed on a disabled referenced plugin at35.6s, leaving an empty workspace. Earlier integrated creation/setup opened pending chat in104ms and produced output at52.2s, preserving original CLAW.md and goplaces while leaving Expedia disabled and Travel Themes uninstalled. The later retained responsiveness recording showed the original-chat card without narration and working review navigation without installation; that follow-up is not part of this PR.
These historical screenshots do not prove the current setup head, completed plugin installation, latest-stable upgrade preservation, or final combined-head video. The historical live-card omission is addressed by the current foundation and its three producer-to-renderer paths. Fresh combined-head real Add/install/caption/video proof remains open before final delivery. No production Gateway was changed.