Skip to content

Provide Petrinaut AI and the AI experiments demo as assistant plugins - #10104

Draft
kube wants to merge 6 commits into
claude/assistant-custom-panelfrom
claude/petrinaut-ai-own-ui
Draft

kube wants to merge 6 commits into
claude/assistant-custom-panelfrom
claude/petrinaut-ai-own-ui

Conversation

@kube

@kube kube commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Before this PR, Petrinaut AI on the demo site was the library's built-in chat, which the demo shell configured through the aiAssistant prop. The AI experiments demo used the same prop.

Plugin API gains what that chat needs: focus, collapse, start requests, a start action in the empty-canvas prompt and a preview. Website now has its own copy of the chat in plugins/_shared/chat. AssistantChat takes the plugin's api and a configuration with the PetrinautAiAssistant fields, and renders in the assistant panel through the plugin API. Petrinaut AI and the AI experiments demo are plugins that render it, with a title in the title bar. Brunch's chat comes through the aiAssistant prop in this PR.

Links

Changes

Plugin API

  • useAssistantPanel() adds focus, collapse and the start request

    focusRequest changes each time the user opens the panel.
    collapsed and setCollapsed shrink the panel to a dock in the corner and hide its title bar.
    startRequest holds the empty-canvas prompt's { text } or { action } until consumeStartRequest().

  • Empty-canvas prompt serves plugin assistants

    A typed message becomes the start request.
    assistant.startAction shows in place of Send while the input is empty.

  • AssistantPanelTitle takes onClose

    It runs when the user presses Close, before the panel closes.

  • AssistantPanelPreview renders an assistant's content outside an editor, for stories and tests
  • /ui exports AiAssistantIcon, HorizontalTabsHeader and useExperimentalIconPackEnabled

    Chat kit draws the same title bar icon and tabs as the editor.
    /ui/plugin exports ExperimentRecord for its experiment cards.

Chat kit

  • plugins/_shared/chat holds a copy of the library's chat

    Transcript, composer, tool cards, experiment cards, transports and the Voice dock, with their tests.

  • AssistantChat reaches the editor only through the plugin api

    Edits run through document.edit and diagnostics through document.diagnose().
    Experiments run through experiments.run, and tool cards reveal through editor.reveal.

  • Chat fills the panel through AssistantPanelTitle and useAssistantPanel

    Title bar shows tabs when the configuration has an additionalTab, and a title otherwise.
    Empty-canvas prompt's message or Voice start request starts the chat.

  • Kit's presentation option is deprecated

    Brunch-only UI moves into the Brunch plugin, and each assistant plugin renders its own transcript.

  • @ai-sdk/react, @ark-ui/react and vscode-languageserver-types join the website's dependencies
  • Tests compile the chat kit with the React Compiler

    React Compiler lint rules are errors under plugins/_shared/chat.
    vitest.setup.ts shims matchMedia for jsdom.

Plugins

  • Petrinaut AI is the website.petrinaut-ai plugin

    It renders the chat over /api/chat and saves each document's transcript in local storage.
    Demo shell passes it while Brunch's assistant is not ready.

  • /ai-experiments passes its scripted assistant as the website.ai-experiments-demo plugin

Test coverage

  • editor-assistant.test.tsx, ai-cta-modal.test.tsx:

    Close handler order, a start action's request until consumed, and the prompt's start action in place of Send.

  • Suites under plugins/_shared/chat:

    Run the chat in AssistantPanelPreview against an api from createTestPluginApi, tabs from additionalTab included.

  • petrinaut-ai/plugin.test.tsx:

    Empty-net prompt starts a chat in the real editor that edits the net and saves the transcript under the document's id.

  • use-local-storage-ai-messages.test.ts:

    One document's transcript replaced and cleared, the others kept.

  • local-storage-demo-app.test.tsx:

    Stock assistant default, Brunch selection and each assistant's own history, with Petrinaut AI as a plugin.

How to test

Petrinaut AI

  • Open Petrinaut preview on Vercel
  • Menu > New

    Expect empty-net prompt

  • Submit Build an SIR model in prompt

    Expect panel titled AI and net built

  • Reload page
  • Bottom bar > Show AI assistant

    Expect conversation restored

  • Menu > User settings > Plugins

    Expect Petrinaut AI tagged Assistant

AI experiments demo

  • Open AI experiments demo on Vercel
  • Bottom bar > Show AI assistant
  • Send run

    Expect experiment progress, then result card

@kube kube self-assigned this Oct 19, 2026
@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/apps labels Oct 19, 2026
@kube
kube added this pull request to stack #10107 October 19, 2026 22:04
@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Oct 20, 2026 9:15pm UTC
petrinaut Ready Ready Preview Oct 20, 2026 9:15pm UTC
petrinaut-docs Ready Ready Preview Oct 20, 2026 9:15pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 20, 2026 9:15pm UTC

Request Review

@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from 320f7e0 to c5b1b8c Compare October 19, 2026 22:49
@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from c5b1b8c to c5912c1 Compare October 20, 2026 11:28
@github-actions github-actions Bot added the type/eng > frontend Owned by the @frontend team label Oct 20, 2026
@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from c5912c1 to d17120d Compare October 20, 2026 13:41
@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from d17120d to b4f4888 Compare October 20, 2026 15:53
@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from b4f4888 to 1401ffa Compare October 20, 2026 16:04
@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from 65ad085 to 06b1a02 Compare October 20, 2026 16:16
@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from 06b1a02 to 5442882 Compare October 20, 2026 16:43
@kube
kube force-pushed the claude/petrinaut-ai-own-ui branch from 5442882 to b88b82a Compare October 20, 2026 17:08
kube added 6 commits October 20, 2026 23:09
…der in a preview

The copied chat reads the panel's focus and start requests, collapses it to the Voice dock, pauses on Close and renders in AssistantPanelPreview in tests. The empty-canvas prompt offers a plugin's start action.
The Brunch integration suite calls installPetrinautDomShims without the website's vitest setup, so its DOM tests failed to load once the shim moved out.
Brunch-only UI moves into the Brunch plugin, and each assistant plugin renders its own transcript.
The comment told hosts to render the chat as an assistant plugin's view, a field the plugin API does not have; the chat is the plugin's assistant.content. It also called the assistant panel a window.

This branch was successfully deployed

3 active deployments
Preview – petrinaut-docs — ffd9bd27 Deployed Oct 20, 2026 by vercel[bot]
Preview – hash — ffd9bd27 Deployed Oct 20, 2026 by vercel[bot]
Preview – petrinaut — ffd9bd27 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant