@maintainer-pro/ai-ui
v0.2.16
Published
Embeddable chat widget for Maintainer Pro (script tag, any frontend)
Downloads
2,665
Readme
@maintainer-pro/ai-ui
Embeddable chat widget for Maintainer Pro. Framework-agnostic: a script tag. There is no React component export.
The IIFE bundles React, styles (shadow DOM), and the chat UI. The host page does not need React, Tailwind, or @assistant-ui/react.
The widget calls a chat HTTP API (/api/chat). Coding agents run in @maintainer-pro/ai-cli on a server — not in the browser.
Local development
Install next to @maintainer-pro/ai-server (the local chat server / sidecar). Do not add this package to the host frontend.
npm install @maintainer-pro/ai-ui @maintainer-pro/ai-serverai-server serves /ai-ui.iife.js from node_modules. Load it from the sidecar origin (http://localhost:3100 in the setup guide):
<script src="http://localhost:3100/embed-config.js"></script>
<script src="http://localhost:3100/ai-ui.iife.js"></script>
<script>
var cfg = window.__MAINTAINER_PRO__ || {};
AiUi.init({
apiUrl: "http://localhost:3100/api/chat",
title: "AI Assistant",
maintainerProUrl: cfg.maintainerProUrl || undefined,
maintainerProApiKey: cfg.maintainerProApiKey || undefined,
});
</script>When the sidecar also serves the page (empty folder), use same-origin paths: /embed-config.js, /ai-ui.iife.js, apiUrl: "/api/chat".
Do not copy ai-ui.iife.js into the host during local setup. That file goes stale. To refresh the UI: npm update @maintainer-pro/ai-ui in the sidecar workspace and restart ai-server.
/embed-config.js comes from server env. Do not bake MAINTAINER_PRO_CLIENT_API_KEY into HTML.
init owns the FAB, side panel, default users, and browser context. Optional: layout, pushSelector, title, getData, tools.
Production
ai-server is a local chat server. It is not deployed with the product by default. localhost:3100 will not exist in production, so a page that still points there will show no widget.
For production:
- Serve
dist/ai-ui.iife.jsas a static file (hostpublic/, CDN, or unpkg / jsDelivr). - Point
apiUrland embed-config at a production chat API (your server using@maintainer-pro/ai-cli, orai-serveronly if that machine really runs a coding-agent CLI — or a customAiProvider). - Keep the client key on the server. Do not bake it into the static page.
Types
import type { AiUiInitOptions } from "@maintainer-pro/ai-ui";The browser runtime is dist/ai-ui.iife.js (window.AiUi).
Related packages
| Package | Role |
|---------|------|
| @maintainer-pro/ai-cli | Talks to coding agents |
| @maintainer-pro/ai-server | Local Node chat server (sidecar) |
