Interface modules
Ready made AI interfaces for your site, already wired to the visitor's AI Wallet and to your MCP tools. A chat in a side panel, a popup, inline in the page, a full page AI mode, and a search bar that answers.
The interface modules are the AI features a site adds in a few lines, with no interface to build. Each one runs the conversation on the visitor's own AI through AI Wallet, calls your site's tools from your MCP server, and draws the whole exchange.
| Form | React | Web Component | Page |
|---|---|---|---|
| A chat docked in a side panel at the page's edge | AiChatPanel | <aiconnect-chat variant="panel"> | Side panel |
| A floating button that opens a chat popup | AiChatPopup | <aiconnect-chat variant="popup"> | Popup |
| A chat inline in the page | AiChatInline | <aiconnect-chat variant="inline"> | Inline chat |
| A full page AI mode | AiChatPage | <aiconnect-chat variant="page"> | Full page |
| A search bar that answers | AiSearch | <aiconnect-search> | Search bar |
The React components come with @tensorpass/aiconnect-react. The Web Components are the same modules in one script for sites without React, such as WordPress pages: see Web Components.
What every module does
- Streams the answer. The text appears as the visitor's model writes it, with a cyan caret at its end. Light Markdown (bold, lists, links, code) is drawn as formatting.
- Shows the tool calls as they run. Each call of one of your tools gets a row with a cyan light while it runs, a check once its result is back, and the arguments the model chose.
- Names the account that answers. The header shows the account and its model as the wallet reports them (
state.providerNameandstate.model), with the wallet's arcs lit while the answer streams. - Handles the connect and install steps. Until the visitor's AI is connected, the module shows the step the visitor is at: connect the wallet, add it to the browser, approve the site, or try again after a refusal. Its button opens the connect window. A question asked before the connection stays on screen and goes out once the wallet connects the site.
- Runs the guards. Every conversation runs in salted envelopes, with a question guard and an answer guard against prompt injection, leaks and exfiltration, tuned by the
guardsprop. See Guards. - Takes files and voice. With
attachments, the visitor drops, pastes or attaches images, PDFs and text files, and dictates a question with the microphone. Each file reaches the model as the account that answers reads it, and the dictation lands in the question field. See Files and voice. - Offers Stop. While an answer streams, the send button becomes Stop. Stopping ends the answer in the wallet too and keeps the text written so far.
- Follows your design system. Every color, the font, the radii and the sizes come from the
--aic-*tokens, in light, dark and right to left. See Theming the modules. - Speaks English, French, Hebrew, Arabic and Chinese. The provider's
localesets the language of the modules and of the connect window. Hebrew and Arabic lay the module out right to left, and the side panel and the popup move to the left edge.
Quickstart
Install the packages and wrap your app in AiConnectProvider, as in the React quickstart. The stylesheet @tensorpass/aiconnect-react/styles.css carries the modules' styles with the connect window's.
npm install @tensorpass/aiconnect @tensorpass/aiconnect-reactThen render a module where it belongs. This popup answers from the tools of your MCP server:
import { AiChatPopup } from '@tensorpass/aiconnect-react';
const SYSTEM = 'You recommend books from this site\'s catalog. Always search the catalog before recommending.';
export function App() {
return (
<>
<YourSite />
<AiChatPopup system={SYSTEM} mcp="/api/mcp" suggestions={['A calm book for tonight']} />
</>
);
}import { AiConnect } from '@tensorpass/aiconnect';
import { AiConnectProvider } from '@tensorpass/aiconnect-react';
import '@tensorpass/aiconnect-react/styles.css';
const client = new AiConnect();
createRoot(document.getElementById('root')!).render(
<AiConnectProvider client={client} locale="en">
<App />
</AiConnectProvider>,
);The module needs nothing else: the visitor clicks the floating button, connects their AI from the popup the first time, and asks. A visitor who does not have the wallet yet gets a link to the AI Wallet page.
In a Next.js App Router site, render the modules from a client component inside your provider, as the Next.js quickstart does for the provider itself.
Props every module takes
Prop
Type
- system. The instructions the visitor's model gets before the first question: what the site is, which tools to use and how to answer.
- tools and mcp. Where your tools come from. Give one of them. Keep a
toolsobject stable across renders, for example by building it once outside the component. - title, intro and placeholder. Your own words for the header, for the heading of an empty conversation, and for the question box. Without them the module uses its built in copy in the provider's language.
- suggestions. Questions shown in an empty conversation, sent with one click.
- toolLabels. A plain name per tool, shown while it runs, such as
{ search_books: 'Searching the catalog' }. Without one, the row shows the tool's own name. - guards. Your values for the guards every conversation runs under: your internal names, the hosts and addresses an answer may give, the tools whose activity shows, your safe answer.
- renderToolResults. Draws a turn's tool results your way. See Your own result cards.
- attachments. Lets the visitor drop, paste or attach images, PDFs and text files, and dictate a question. See Files and voice.
- analytics. A name for the module's actions in your click analytics. The install and connect buttons, the send button, the suggestions, and the attach and microphone buttons carry
data-analyticswith it, such aschat-install,chat-connect,chat-send,chat-suggestion,chat-attachandchat-voice. - ref. Receives the module's handle, whose
ask(question)sends a question as if the visitor had typed it in the module. A module that floats opens first, so a field of your own, such as an ask bar in your page's opening, can open the side panel with the visitor's question. See Send a question from your own field.
The side panel, the popup and the full page also take how they open:
Prop
Type
Leave open out to let the module keep its state. Give open and onOpenChange to open it from your own button, and hideLauncher to hide the module's own.
Your own result cards
renderToolResults receives each turn, with the visitor's question, the answer so far and every tool call with its raw result, and returns what to draw under the answer. It runs again as the answer streams, so cards can follow the names the answer gives.
This example draws a card for each book that the search returned and that the answer names. The cards follow the answer's order:
import type { ChatTurn } from '@tensorpass/aiconnect-react';
function renderBooks(turn: ChatTurn) {
const books = suggestedBooks(turn);
if (books.length === 0) {
return null;
}
return (
<ul className={styles.suggestions}>
{books.map((book) => <li key={book.id}><BookCard book={book} /></li>)}
</ul>
);
}
<AiChatPanel system={SYSTEM_PROMPT} mcp="/api/mcp" renderToolResults={renderBooks} />;The cards render inside the module, so your own stylesheet styles them.
Languages
AiConnectProvider takes locale (en, fr, he, ar or zh, Chinese in its simplified script) for the connect window and the modules together. The modules' built in copy is builtInModuleMessages. Pass moduleMessages to the provider to write the whole copy yourself, and set its dir to rtl for a right to left language.
Prop
Type
The modules also show the connect window's own copy for the connection steps, from messages.
Theming the modules
The modules read the tokens of the theming guide and these ones of their own:
| Token | Light | Dark | What it styles |
|---|---|---|---|
--aic-mono | 'Reddit Mono', ui-monospace, monospace | same | Tool names, the model's name and code in answers. |
--aic-stripe | #15161a | #050506 | The stripe of the key card beside the account that answers. |
--aic-fill | ink at 7% over the surface | same rule | The visitor's question and the model's tag. Set it to override the mix. |
--aic-ink-2 | ink at 84% over the surface | same rule | The answer's text. Set it to override the mix. |
--aic-panel-width | 420px | same | The side panel's width. |
--aic-popup-width | 400px | same | The popup's width. |
--aic-popup-height | 640px | same | The popup's height. |
--aic-inline-height | 560px | same | The inline chat's height. |
--aic-page-width | 760px | same | The column of the full page mode. |
--aic-layer | 990 | same | The stacking level of the side panel, the popup, its button and the full page. The connect window sits at 1000, above them. |
--aic-fill and --aic-ink-2 are mixed from your --aic-ink and --aic-surface when you do not set them, so a site that sets its own palette gets matching shades. Dark mode follows data-aic-theme, as for the connect window.
A bookshop's theme sets its font and a warm palette, and it widens the panel:
:root {
--aic-font: var(--font-lora), serif;
--aic-ink: #2b2622;
--aic-muted: #625a52;
--aic-ground: #f5f0e8;
--aic-border: #e4dccf;
--aic-accent: #7a4b2a;
--aic-panel-width: 440px;
}Next steps
- Pick a form: side panel, popup, inline chat, full page or search bar.
- Add the modules to a page without React with one script tag.
- Tune the guards to your site.
- Serve your tools with the MCP guide.
Site key
Get the public site key that turns on the TensorPass sign in for visitors without AI Wallet, on the TensorPass site owners' page, from a coding agent through the TensorPass account MCP server or from the command line, and where to put it for each stack.
Side panel
A chat docked at the edge of the page, opened from its own button or from yours, that stays open while the visitor browses.