A UI plugin is a Python package that adds pages, blocks, chat tool renderers,
settings sections, sidebar groups, theme presets, HTTP routes and CLI commands
to the React app shell (style: app, or
style: app
AIUI_SHELL=app). Installing the package is the whole setup: the server finds
AIUI_SHELL=app
it through the praisonaiui.plugins entry point.
praisonaiui.plugins
| Dedicated Plugin SDK Guides | What it covers |
|---|---|
| Scaffolding & Types | aiui plugins init, aiui plugins types, PEP 561 py.typed, jsconfig.json/tsconfig.json |
aiui plugins init
aiui plugins types
py.typed
jsconfig.json
tsconfig.json
| Browser SDK (@aiui/sdk) | <BlockTree>, useLiveData, pageLinkProps, openWebSocket, notifications, slots & commands |
@aiui/sdk
<BlockTree>
useLiveData
pageLinkProps
openWebSocket
notifications
| Shell Hosting & CSP | create_shell_app(), strict sha256 CSP helpers, ASGI lifespan(app), manifest.builtins |
create_shell_app()
lifespan(app)
manifest.builtins
| Compiled Site & Inventory | create_site_app() (mode="static" / allow_frame_origin), list_docs_pages() / DocPageInfo |
create_site_app()
mode="static"
allow_frame_origin
list_docs_pages()
DocPageInfo
| Testing Plugins | praisonaiui.testing.plugin_test_client, assert_contract(), isolated_aiui_state() |
praisonaiui.testing.plugin_test_client
assert_contract()
isolated_aiui_state()
The smallest complete plugin lives in
examples/plugins/aiui-hello-plugin.
examples/plugins/aiui-hello-plugin
For a full-featured production plugin built on the same SDK (multi-workspace coding runs, git worktrees, diff review, approval inbox, and create_shell_app), see aiui-code (pip install aiui-code && aiui code serve --workspace .).
create_shell_app
aiui-code
pip install aiui-code && aiui code serve --workspace .
Or scaffold a new typed, tested plugin in one command:
aiui run app.py opens the app shell (style: app) unless the app, its YAML
aiui run app.py
or --style picks another style, so a plain @aiui.reply app needs no flag.
--style
@aiui.reply
AIUI_SHELL=app only switches the dashboard style to the app shell; it
dashboard
leaves an explicit chat or other React style alone (the server logs
chat
AIUI_SHELL=app ignored: style is 'chat').
AIUI_SHELL=app ignored: style is 'chat'
Then open /hello (a React page) and /hello-blocks (a server-driven page).
/hello
/hello-blocks
!!! note "Three different things are called plugins"
React app shell only. Policy in YAML extensions:.
extensions:
manifest.json
dashboard-plugins/, vanilla JS views (see Agent UI host).
dashboard-plugins/
The app shell still hosts them as legacy pages.
site.plugins
aiui.yaml
The default is nav-intercept; see
nav-intercept
Deploy to GitHub Pages → Legacy plugins.
1. The server imports each entry point once, isolates failures, and lists what
the plugin contributes in the shell manifest.
2. The shell installs window.__AIUI_SDK__ and then import()s every plugin
window.__AIUI_SDK__
import()
module named in the manifest. An import map points the bare specifiers
react, react/jsx-runtime, react-dom, react-dom/client and
react
react/jsx-runtime
react-dom
react-dom/client
@aiui/sdk at small shims that re-export the shell's own modules, so a
plugin shares the shell's single React (hooks work, nothing is bundled twice).
3. A module registers what it provides through @aiui/sdk, or default-exports
a component that the shell registers under the page id / block type / tool name.
The app's own React pages and blocks use the same mechanism. The shell and the
SDK are a small core that names no page: the chat page and its "New chat"
command are the first-party plugin builtin.chat in
builtin.chat
src/frontend/src/builtin, registered with registerPage and
src/frontend/src/builtin
registerPage
registerCommand when the manifest lists the page; the approval toasts are
registerCommand
builtin.approvals (on notify and navigate); and the core block types are
builtin.approvals
notify
navigate
registered with registerBlock. A test in the frontend
registerBlock
(shell/core-purity.test.ts) fails if the core imports a feature module or
shell/core-purity.test.ts
names a built-in page.
The value names a plugin object, a class (instantiated with no arguments) or a
zero-argument factory. The entry-point name becomes a URL segment, so it must
match [a-z0-9][a-z0-9_-]*.
[a-z0-9][a-z0-9_-]*
Every member except name is optional:
name
| Member | Returns | Effect |
|---|---|---|
| name | str | Plugin id (/api/plugins/<name>, /_plugins/<name>/, aiui <name>) |
str
/api/plugins/<name>
/_plugins/<name>/
aiui <name>
| version | str | Shown by aiui plugins list |
version
aiui plugins list
| sdk | int | Browser SDK major the plugin targets (default 1); a mismatch marks it incompatible |
sdk
int
1
incompatible
| pages() | PageSpec or dicts | Sidebar pages |
pages()
PageSpec
| blocks() | BlockSpec | Renderers for block types |
blocks()
BlockSpec
| tool_renderers() | ToolRendererSpec | Chat renderers for tool calls |
tool_renderers()
ToolRendererSpec
| routes() | Starlette routes | Mounted under /api/plugins/<name> |
routes()
| static_dir() | Path | Served at /_plugins/<name>/ |
static_dir()
Path
| features() | feature protocols | Registered like built-in features (an enabled built-in's names win) |
features()
| cli_commands() | typer.Typer or click command | aiui <name> … and aiui plugins <name> … |
cli_commands()
typer.Typer
aiui <name> …
aiui plugins <name> …
| setup(ctx) | None | Called once per create_app() with {"style", "config"} |
setup(ctx)
None
create_app()
{"style", "config"}
| lifespan(app) | async/sync context manager | Entered on ASGI startup and exited LIFO on shutdown (in both create_app() and create_shell_app()); failures are isolated per plugin |
| settings() | SettingsSectionSpec or dicts | Sections of the shell's settings dialog (below) |
settings()
SettingsSectionSpec
| nav_groups() | NavGroupSpec or dicts | The sidebar groups your pages use, with their position |
nav_groups()
NavGroupSpec
| themes() | ThemeSpec or dicts | Theme presets made of seed tokens |
themes()
ThemeSpec
| layouts() | LayoutSpec or dicts | App shell frames (ADR 0003) the viewer can pick (below) |
layouts()
LayoutSpec
PageSpec, BlockSpec, ToolRendererSpec, SettingsSectionSpec,
SettingsField, NavGroupSpec, ThemeSpec, LayoutSpec and
SettingsField
get_plugin_settings are importable from praisonaiui (or praisonaiui.plugin_registry). Dicts with
get_plugin_settings
praisonaiui
praisonaiui.plugin_registry
the same field names work too.
| kind | Renders | Needs |
kind
| react | The component from module (default export, or export) | module |
module
export
| blocks | A server-driven block tree (see below) | api_endpoint, default /api/plugins/<name>/pages/<id> |
blocks
api_endpoint
/api/plugins/<name>/pages/<id>
| iframe | module in a sandboxed iframe (no same-origin access) | module |
iframe
These three are the only kinds a plugin can use. native and legacy are
native
legacy
first-party only (the shell never imports a plugin's legacy view): a plugin
page with another kind, or a misspelt one, is dropped with a warning and
aiui plugins doctor fails on it.
aiui plugins doctor
A relative module ("hello.js") resolves into static_dir(); the server
"hello.js"
then serves /_plugins/<name>/hello.js and adds its sha384 integrity to the
/_plugins/<name>/hello.js
sha384
manifest and the import map.
The integrity is a cache-consistency check, not tamper protection: the
server hashes the file it is about to serve (re-hashed when the file changes,
so a rebuilt bundle keeps loading), which guards against a stale or partly
written file between the page render and the module fetch. Someone who can
change files in the plugin's static_dir can also change what is hashed.
static_dir
Declare integrity= on the PageSpec to pin a hash you computed at build
integrity=
time. When auth is enforced the page carries no manifest (and so no import-map
integrity) before login; the shell loads plugin modules afterwards.
When two sources use the same page id, the first wins: pages registered by the
app (aiui.register_page), then built-in pages, then entry-point plugins (in
aiui.register_page
discovery order), then dashboard-plugin folders. aiui plugins doctor warns
about shadowed ids.
Three hooks contribute to the shell itself rather than to a page. They were
added under SDK 1; a shell that has them lists the features settings,
settings
nav-groups and theme-presets in SDK_FEATURES, and an older host simply
nav-groups
theme-presets
SDK_FEATURES
never calls them.
Nav groups. NavGroupSpec(name, order=None, folded=False) names a group
NavGroupSpec(name, order=None, folded=False)
that your pages use in PageSpec.group. order places it among the groups:
PageSpec.group
order
the groups the app lists in layout.groups.order (Agent, Work, Control
layout.groups.order
Agent
Work
Control
by default) sit at 100, 200 and 300, groups without an order follow them, and
layout.groups.last (Settings) stays last. So order=250 puts the group
layout.groups.last
Settings
order=250
between Work and Control, and order=50 puts it first. folded=True starts
order=50
folded=True
the group collapsed until the viewer opens it. The app's own configuration
wins: a plugin cannot move a group that layout.groups (or
layout.groups
set_dashboard(groups=...)) names.
set_dashboard(groups=...)
Every frame lists a declared group. The classic frame shows all groups in its
sidebar; the built-in layouts, which keep the app's own groups in More (⌘K),
still show the groups plugins declared, in this order and folded as declared:
under the primary pages in chat, chat-canvas, workbench and mission,
chat-canvas
workbench
mission
in the rail in command, and under More tools in guided.
command
guided
Settings. A
SettingsSectionSpec(id, title, fields, description="", order=100) becomes a section of the shell's settings dialog, which opens from
SettingsSectionSpec(id, title, fields, description="", order=100)
"Plugin settings" (the sliders button in the classic header, a "Plugin
settings" row or rail button in every built-in layout, shown only while some
plugin has a section) or from "Plugin settings" in the command palette. Each
SettingsField(key, label="", type="string", default=None, description="", options=None)
is drawn from its type:
| type | Control | Default value |
type
| string | One-line text input | "" |
string
""
| text | Multi-line text area | "" |
text
| number | Number input | 0 |
number
0
| boolean | Switch | False |
boolean
False
| select | Select from options (strings or {"value", "label"} dicts) | the first option |
select
options
{"value", "label"}
The values are stored per plugin in
$AIUI_DATA_DIR/plugin-settings/<name>.json (default ~/.praisonaiui). The
$AIUI_DATA_DIR/plugin-settings/<name>.json
~/.praisonaiui
server serves each section at /api/plugins/<name>/settings/<id>: GET
/api/plugins/<name>/settings/<id>
GET
returns {"values": {...}} with the defaults filled in, and `PUT
{"values": {...}}
{"values": {...}}` validates every key against its field (unknown keys, wrong
types and options not in the list answer 400 with `{"error", "fields":
{key: reason}}`, and nothing is written). That path is reserved for a plugin
that declares settings(): it is matched before the plugin's own routes. It
sits under the same mount as routes(), so it is authenticated like every
route and default-deny for entry-point plugins on remote or auth-enforced
servers unless they are named in extensions.enabled.
extensions.enabled
get_plugin_settings(name, section) returns the same values to Python; a
get_plugin_settings(name, section)
stored value that no longer fits its field (an option you removed) falls back
to the default.
Theme presets. A ThemeSpec(id, label, light={}, dark={}) sets L0 seed
ThemeSpec(id, label, light={}, dark={})
tokens per colour mode: --seed-* (--seed-accent, --seed-tint,
--seed-*
--seed-accent
--seed-tint
--seed-paper, --seed-ink …), --radius, --tint-mix and --accent-mix.
--seed-paper
--seed-ink
--radius
--tint-mix
--accent-mix
Every surface, text and accent colour is derived from the seeds (see
DESIGN.md), so a preset never names a shadcn
variable. Values are plain CSS values; anything else (another property, ;,
;
braces, url(...)) is rejected. The viewer picks a preset in the command
url(...)
palette ("Sunrise theme", "Default theme"); the choice is kept per browser.
Invalid entries of all three hooks (and of layouts()) are dropped one by
one with a warning, and one hook that raises does not drop the others. The
warning is printed once per start in the aiui run terminal (and on the Logs
aiui run
page), and aiui plugins doctor runs every entry through the same checks and
fails on each one it would drop. The
contributions travel on the plugin's record in the shell manifest
(plugins[].settings, plugins[].navGroups, plugins[].themes), only for
plugins[].settings
plugins[].navGroups
plugins[].themes
plugins whose browser surfaces the viewer may load.
The pages and features that ship with PraisonAIUI use the same mechanism.
Each domain is a first-party plugin record in praisonaiui.builtin: for
praisonaiui.builtin
example builtin.chat holds the Chat and Chat + Canvas pages with the chat
and attachments features, and builtin.work holds Work Hub, Kanban and
attachments
builtin.work
Jobs Board with the kanban feature. Features with no page of their own have
kanban
a record each (builtin.tts, builtin.pwa, builtin.video …). The server
builtin.tts
builtin.pwa
builtin.video
reads pages and features through the plugin registry, so the extension policy
can switch a whole domain off:
or aiui.set_extensions(disabled=["builtin.training"]). A disabled built-in
aiui.set_extensions(disabled=["builtin.training"])
contributes no pages: they leave GET /api/pages, the shell manifest and the
GET /api/pages
sidebar. Its feature routes are not mounted (/api/training/... returns 404),
/api/training/...
the server does not load its feature modules, and a bundled dashboard-plugin
folder that belongs to it (kanban belongs to builtin.work, video-studio
video-studio
to builtin.video, the sample-board demo page in the Examples group to
sample-board
builtin.examples) is not served either. The same holds for the routes the
builtin.examples
host itself serves for a built-in: builtin.mcp owns /api/mcp/*,
builtin.mcp
/api/mcp/*
builtin.debug owns /api/debug, builtin.overview owns
builtin.debug
/api/debug
builtin.overview
GET /api/overview, builtin.feedback owns GET /api/feedback and
GET /api/overview
builtin.feedback
GET /api/feedback
builtin.jobs owns the optional /api/jobs proxy (set_jobs_proxy), so
builtin.jobs
/api/jobs
set_jobs_proxy
disabling them returns 404 there. builtin.logs serves GET /api/logs and
builtin.logs
GET /api/logs
/api/logs/* from its feature, and installs its log handler only while it is
/api/logs/*
on. With the built-in off, an entry-point
plugin may use its page ids and feature names.
A few host routes stay mounted whichever built-ins are off, because the host,
several pages or the CLI use them: GET /api/status (aiui status, the same
GET /api/status
aiui status
data as /api/overview), POST /api/feedback (the chat thumbs),
/api/overview
POST /api/feedback
/api/config, /api/gateway/status, /api/provider*, the chat protocol
/api/config
/api/gateway/status
/api/provider*
(/agents, /sessions, /run, /cancel, /teams, /starters,
/agents
/sessions
/run
/cancel
/teams
/starters
/profiles, /welcome, /api/actions/*, thread sharing), /health*, auth,
/profiles
/welcome
/api/actions/*
/health*
/api/pages, /api/features, /api/shell/manifest and /api/plugins.
/api/pages
/api/features
/api/shell/manifest
/api/plugins
Disabling builtin.config removes its page only. Where a page id is also a
builtin.config
JSON path (/agents, /sessions, or an app page named like an API), a
browser navigation to /<page id> gets the page and fetch() gets the JSON,
/<page id>
fetch()
under the dashboard and app styles.
app
tests/unit/test_route_table_snapshot.py pins the default route table.
tests/unit/test_route_table_snapshot.py
Some features are required: the server itself depends on auth, theme,
auth
theme
chat, usage, config_runtime and sessions_ext. Disabling their record
usage
config_runtime
sessions_ext
(builtin.auth, builtin.theme-picker, builtin.chat, builtin.usage,
builtin.auth
builtin.theme-picker
builtin.usage
builtin.config, builtin.sessions) removes its pages and its other
builtin.sessions
features, keeps the required feature mounted and logs a warning. Disabling
builtin.auth therefore never turns authentication off.
allowlist for third-party plugins only, so it never hides a built-in page.
builtin.
disabled: [logs]
third-party plugin called logs. A builtin. name that matches no record
logs
logs a warning.
aiui.set_pages([...])
pages.enabled / pages.disabled in config.yaml and aiui.remove_page()
pages.enabled
pages.disabled
config.yaml
aiui.remove_page()
hide single pages (their APIs stay mounted), and aiui.register_page()
aiui.register_page()
with a built-in id replaces that page.
register_feature()
the same name, as before.
GET /api/plugins?origin=builtin
origin=all
records with their status (and required: true where the host needs one
required: true
of their features). Without the parameter the endpoint lists
third-party plugins only, as before.
A plugin module is plain ESM. Write it by hand (the example uses
react/jsx-runtime directly) or build it with React and the SDK as externals:
Only those five bare specifiers are mapped. Anything else must be bundled into
the plugin file or imported by full URL.
Registration:
| Export | Use |
| SDK_VERSION | 1 |
SDK_VERSION
| SDK_FEATURES | List of capability names, for feature detection |
| registerPage(id, Component) | Component receives { page } (its manifest entry). A zero-argument arrow function is treated as a lazy loader: registerPage('x', () => import('./X.js')) |
registerPage(id, Component)
{ page }
registerPage('x', () => import('./X.js'))
| registerBlock(type, Component, options?) | Component receives { node, page }; node is { type, props, children }. It also overrides a core block type of the same name. { fallback: true } registers a default that anything else overrides |
registerBlock(type, Component, options?)
{ node, page }
node
{ type, props, children }
{ fallback: true }
| registerToolRenderer(toolName, Component) | Chat tool call UI; receives assistant-ui tool part props (toolName, args, argsText, result, status, …) |
registerToolRenderer(toolName, Component)
toolName
args
argsText
result
status
| registerSlot(name, Component, options?) | Add a component to a slot of the shell |
registerSlot(name, Component, options?)
| registerCommand(command) | Add an entry to the command palette. Returns a function that removes it. Groups list before the pages, in registration order; the groups Preferences, Layout and Theme list after them |
registerCommand(command)
Preferences
Layout
Theme
| registerView(pageId, render, cleanup?) | A vanilla view for a legacy page (same as window.aiui.registerView in custom.js) |
registerView(pageId, render, cleanup?)
window.aiui.registerView
| registerSettingsSection(section) | Add a section to the shell's settings dialog: { id, title, description?, order?, fields, load(), save(values) }, fields as in settings(). A save rejection whose error has body.fields shows those messages next to the fields. Returns a remover |
registerSettingsSection(section)
{ id, title, description?, order?, fields, load(), save(values) }
save
body.fields
| registerNavGroup(name, { order, folded }?) | Declare the sidebar group your pages use, like nav_groups(). Returns a remover |
registerNavGroup(name, { order, folded }?)
| registerThemePreset({ id, label, light?, dark? }) | Offer a seed-token theme preset, like themes(). Returns a remover |
registerThemePreset({ id, label, light?, dark? })
| registerLayout(id, meta, Frame \| loader) | Add a layout (the frame around every page). getLayouts(), useLayout(), setLayout(id), provideLayoutData(kind, feed) and useLayoutData(kind) go with it. Returns a remover |
registerLayout(id, meta, Frame \| loader)
getLayouts()
useLayout()
setLayout(id)
provideLayoutData(kind, feed)
useLayoutData(kind)
| onActivate(fn) | Run fn({ manifest }) once the app is ready |
onActivate(fn)
fn({ manifest })
| getPage, getBlock, getSlot, getToolRenderers | Registry lookups |
getPage
getBlock
getSlot
getToolRenderers
| subscribe(fn), useRegistryVersion() | React to later registrations |
subscribe(fn)
useRegistryVersion()
Shell services and components:
| navigate(pageId, { replace, params }?) | Go to a page of the app: navigate('logs') |
navigate(pageId, { replace, params }?)
navigate('logs')
| pageHref(pageId, params?) | Format an in-app page URL path (pageHref('revenue', { range: '30d' }) → /revenue?range=30d) |
pageHref(pageId, params?)
pageHref('revenue', { range: '30d' })
/revenue?range=30d
| pageLinkProps(pageId, params?, { replace }?) | Return { href, onClick } for an in-app <a> link: plain left click navigates inside the shell with no full document reload (Back/Forward work), while Cmd/Ctrl/Shift/Alt/middle-click keeps native new-tab behaviour |
pageLinkProps(pageId, params?, { replace }?)
{ href, onClick }
<a>
| useLiveData(key, fetcher, options?) | Keyed, visibility-aware live data hook shared with built-in block pages: aborts in-flight reads on key change (never flashing stale page data), retains the last result on refresh failure alongside error, skips hidden tabs, backs off on failures, and refreshes once when returning to an overdue tab |
useLiveData(key, fetcher, options?)
error
| notify(message, options?) | Show a toast. Options: type (info, success, warning, error), description, duration, id, action: { label, onClick } |
notify(message, options?)
info
success
warning
description
duration
id
action: { label, onClick }
| fetchJson(url, options?) | fetch for JSON APIs. It sends the session's gateway token to same-origin URLs only, JSON-encodes a plain-object body (the method then defaults to POST), decodes the response, and rejects with an error carrying status, url and body on a non-2xx status |
fetchJson(url, options?)
fetch
body
POST
url
| useManifest() | React hook returning the shell manifest (pages, plugins, site, layout) |
useManifest()
pages
plugins
site
layout
| getPageId(), usePageId() | The id of the page on screen ('' at /), read the way the shell's router reads the URL; the hook re-renders on navigation. Never parse location yourself |
getPageId()
usePageId()
''
/
location
| useThemeMode() | React hook returning 'light' or 'dark', updated when the viewer or the OS switches |
useThemeMode()
'light'
'dark'
| dismiss(id?) | Close a toast raised with notify(message, { id }) (all toasts without an id) |
dismiss(id?)
notify(message, { id })
| Markdown | The shell's Markdown renderer: <Markdown variant="docs">{text}</Markdown> |
Markdown
<Markdown variant="docs">{text}</Markdown>
Style with the theme's CSS variables (var(--foreground), var(--border),
var(--foreground)
var(--border)
var(--primary), …). The shell's Tailwind build only contains the classes the
var(--primary)
shell itself uses, so Tailwind classes in a plugin may not exist.
Use the services instead of globals such as window.fetch or the history API.
window.fetch
They work the same in every page kind and they are part of the SDK contract.
A command that throws, or whose promise rejects, is reported as a toast. An
onActivate hook that throws is logged and does not stop the other hooks.
onActivate
Use pageLinkProps() for in-page navigation links or tabs so ordinary clicks
pageLinkProps()
stay in the SPA shell (0 document reloads, Back works) while Cmd/Ctrl-click
still opens a new tab. Pair it with useLiveData() to share the framework's
useLiveData()
abort-on-navigation, hidden-tab pause, retry backoff, and retain-last-result logic:
A slot is a place in the shell that renders components from plugins.
| Slot | Where | Extra props |
| header:actions | The header bar, before search and the theme toggle. Not shown when the app hides the page header | |
header:actions
| sidebar:footer | The bottom of the sidebar, on desktop and in the phone menu | collapsed |
sidebar:footer
collapsed
| page:<id>:toolbar | Above the body of page <id>, for example page:logs:toolbar | |
page:<id>:toolbar
<id>
page:logs:toolbar
Every slot component receives { slot, pageId, page }: the slot name, the id
{ slot, pageId, page }
of the page on screen and its manifest entry.
{ id, order }
identity of your contribution (use the plugin name), and a lower order
comes first (default 100). Registering the same id again replaces only
100
that contribution.
replaces an earlier one. This is the original behaviour.
removed and logged; the others and the shell stay.
A layout owns the frame of the app shell: the navigation, the session list,
the top bar, side panels and the phone chrome. The page stays the page: every
page renders inside every layout, in the outlet the shell hands the frame
(ADR 0003). aiui ships six layouts
(chat, what aiui run opens; chat-canvas, the app shell's default; plus
workbench, command, guided and mission); the core's own frame is called classic. A plugin adds a
classic
layout with the same call the built-ins use.
Which layout is on screen. The server's manifest lists the layouts it
offers (layouts.available) and its default. The browser takes the first of:
layouts.available
a ?layout=<id> preview (kept for the tab, never saved), the viewer's own
?layout=<id>
choice (the palette's "Switch layout: …" commands or Settings → Appearance,
saved in this browser, only when the server allows a user choice), the server
default, the classic frame. A layout the server does not offer is never
chosen.
Declare it in Python with a layouts() hook, which returns
LayoutSpecs (or dicts with the same field names), like pages():
| LayoutSpec field | Meaning |
| id | Lower-case letters, digits and -, starting with a letter, at most 40 characters; classic is reserved |
-
| title, description | Shown in the picker (palette and Settings → Appearance) |
title
| order | Picker position (default 100; the built-ins use 10 to 50) |
| module | Required for a plugin layout: the ESM file that registers the frame. A relative path resolves into static_dir() (/_plugins/<name>/<file>) and gets an SRI integrity hash, which the import map carries like a page module's |
/_plugins/<name>/<file>
integrity
| css | Optional stylesheet, resolved the same way (its hash is cssIntegrity in the manifest and on the <link>), added when the layout first loads |
css
cssIntegrity
<link>
| home | The page / opens while this layout is on screen |
home
| primary | Page ids of the primary nav, in order (at most 7 shown; YAML layout.primary wins) |
primary
layout.primary
| look | Optional: the meta.look your frame registers (an id such as paper). When the layout is the server's default, the server sets <html data-aiui-look> from the first byte, so the look's fonts load instead of the Pro ones. It is not sent in the manifest |
look
meta.look
paper
<html data-aiui-look>
The first plugin (or built-in) to declare an id keeps it; a later one is
ignored with a warning, as is a malformed or classic id. On a remote or
auth-enforced server an entry-point plugin's layouts follow the same
default-deny rule as its pages. Configuration (which layouts are offered,
the default) is in Layouts → Plugin layouts.
Register the frame in the browser. The shell imports the module only
when the layout is first rendered, never with the other plugin modules, so an
inactive layout costs nothing. The module either calls `registerLayout(id,
meta, Frame) while it is evaluated (its meta` then replaces the manifest's
while it is evaluated (its
title and description) or default-exports the frame:
The complete example is src/frontend/e2e/fixtures/layout-plugin/ (the
src/frontend/e2e/fixtures/layout-plugin/
suite e2e/specs/layouts-host.spec.ts runs it).
e2e/specs/layouts-host.spec.ts
What the frame receives (LayoutProps):
LayoutProps
| Prop | What it is |
| Outlet | The routed page, with its error boundary, toolbar slot and loading state. Render it once, inside your main |
Outlet
main
| pageId, page, fullBleed | The page on screen, its manifest entry, and whether it asked for no padding (chat, iframes): then give the outlet the full height and no scroll |
pageId
page
fullBleed
| nav | primary (at most 7, the layout's own list), groups (every other page, by sidebar group, with folded), footer, activeId, go(pageId). Items carry id, title, href, active, navIcon, icon, group |
nav
groups
folded
footer
activeId
go(pageId)
href
active
navIcon
icon
group
| chrome | siteTitle, siteLogo, openPalette({ query? }) (the one command palette, optionally prefilled), toggleColorMode(), Slot (the shell's slot host: <chrome.Slot name="header:actions" />), mainId (give your main this id: the skip link and the palette focus it) |
chrome
siteTitle
siteLogo
openPalette({ query? })
toggleColorMode()
Slot
<chrome.Slot name="header:actions" />
mainId
| viewport | 'phone' (< 768 px), 'tablet' (< 1024 px) or 'desktop'; draw your phone frame from it |
viewport
'phone'
'tablet'
'desktop'
| layout | id, available (the offered layouts), switchTo(id) |
available
switchTo(id)
useLayout() returns { id, meta } of the layout on screen (null for the
{ id, meta }
classic frame), setLayout(id, { persist }?) switches live ('' or
setLayout(id, { persist }?)
'classic' is the classic frame), and getLayouts() lists the registered
'classic'
ones. meta.chat tells the chat page how to present itself in your frame
meta.chat
(who draws the session list, the thread style, lazy regions such as aside,
aside
turnFooter and composerTool); see the ADR. meta.look names a look of
turnFooter
composerTool
the Pro tokens the frame paints with (the shell ships paper; DESIGN.md "Looks").
Frames read data such as the session list with useLayoutData('sessions'),
useLayoutData('sessions')
which returns null while nothing provides it: render without it. The chat
feed (builtin.chat) also acts on the open chat: prefill(text) fills the
prefill(text)
composer, send?(text) sends (optional: check for it, and fall back to
send?(text)
prefill), cancel() stops the reply, and
prefill
cancel()
resolveApproval(id, approved, { always? }) decides a gate in the thread.
resolveApproval(id, approved, { always? })
Failure. A layout whose module fails to import, or whose frame throws,
is replaced by the classic frame with one toast and an aiui:plugin-error
aiui:plugin-error
event (detail.layout is its id). Other layouts are not affected.
detail.layout
Keep a frame self-contained: import React and @aiui/sdk only, style with
the theme's CSS variables, give icon-only buttons an aria-label, and make
aria-label
phone touch targets at least 44 px.
The SDK grows without a new major version, so SDK_VERSION stays 1. A named
import of an export that an older shell lacks fails when the module loads.
When a plugin must also run on older shells, use the default export and ask
before you call a newer function:
Feature names: pages, blocks, tool-renderers, slots, views,
tool-renderers
slots
views
markdown, navigate, notify, fetch-json, manifest, commands,
markdown
fetch-json
manifest
commands
activate, slots.multi (the { id, order } options and the slot hosts),
activate
slots.multi
blocks.fallback, page-id (getPageId, usePageId), theme-mode
blocks.fallback
page-id
getPageId
usePageId
theme-mode
(useThemeMode), notify.dismiss, settings (registerSettingsSection and
useThemeMode
notify.dismiss
registerSettingsSection
the settings() hook), nav-groups (registerNavGroup, nav_groups()),
registerNavGroup
theme-presets (registerThemePreset, themes()), layouts
registerThemePreset
layouts
(registerLayout, getLayouts, useLayout, setLayout, manifest
registerLayout
getLayouts
useLayout
setLayout
layouts), layout-data (provideLayoutData, useLayoutData),
layout-data
provideLayoutData
useLayoutData
slots.dispose (registerSlot returns a remover), page-links
slots.dispose
registerSlot
page-links
(pageHref, pageLinkProps), live-data (useLiveData),
pageHref
live-data
ws-transport (getWsTicket, openWebSocket) and block-tree
ws-transport
getWsTicket
block-tree
(BlockTree). A shell older than the
BlockTree
services has no SDK_FEATURES.
A plugin's routes() may include Starlette WebSocketRoute endpoints under
WebSocketRoute
/api/plugins/<name>/*. In the browser, open them with openWebSocket(path)
/api/plugins/<name>/*
openWebSocket(path)
from @aiui/sdk (feature ws-transport) so stored gateway tokens are
automatically exchanged for a single-use 60-second ticket via
POST /api/auth/ws-ticket (credentials are never attached to cross-origin URLs):
POST /api/auth/ws-ticket
Call getWsTicket() directly if you construct a custom WebSocket URL yourself.
getWsTicket()
Custom kind="react" pages and plugin layouts can compose any built-in block
kind="react"
(metric, table, diff_viewer, tree_view, timeline, status,
metric
table
diff_viewer
tree_view
timeline
button_group, …) or plugin-registered block via <BlockTree> from
button_group
@aiui/sdk (feature block-tree). The blocks engine loads lazily on first
use, so shell boot size stays unchanged:
@aiui/sdk is not an npm package: the shell provides it at runtime. Its types
are in src/frontend/src/sdk/aiui-sdk.d.ts, the frontend build also writes
src/frontend/src/sdk/aiui-sdk.d.ts
dist/aiui-sdk.d.ts, and the installed package ships the same file at
dist/aiui-sdk.d.ts
praisonaiui/templates/frontend/aiui-sdk.d.ts (find it with
praisonaiui/templates/frontend/aiui-sdk.d.ts
python -c "import praisonaiui, pathlib; print(pathlib.Path(praisonaiui.__file__).parent / 'templates/frontend/aiui-sdk.d.ts')").
python -c "import praisonaiui, pathlib; print(pathlib.Path(praisonaiui.__file__).parent / 'templates/frontend/aiui-sdk.d.ts')"
Copy the file into a plugin project and include
it in tsconfig.json (or jsconfig.json with checkJs) to type-check the
checkJs
plugin. It depends on @types/react only.
@types/react
Each module is imported once. If one fails to load (network error, syntax
error, no component to register), the shell logs it, shows a toast, fires an
aiui:plugin-error window event, and loads everything else. The page shows
"unavailable" instead of crashing. A block that throws while rendering is
replaced by an inline error; the rest of the page still renders.
A docs site can use a block whose type is named like a component
(HelloCard): <HelloCard title="Hi" /> in a page of an aiui build site
HelloCard
<HelloCard title="Hi" />
aiui build
renders it, and the build publishes the plugin's static folder with the site
(your own components).
A blocks page is data, not code: its endpoint returns a component tree and
the shell renders it with built-in React blocks. Page handlers already written
for the dashboard (aiui.register_page(handler=…) with aiui.ui.* helpers)
aiui.register_page(handler=…)
aiui.ui.*
render unchanged.
{"_components": [...]}
components
a bare list), and each item is a flat dict ({"type": "card", "title": …})
{"type": "card", "title": …}
or {"type", "props", "children"}.
{"type", "props", "children"}
action
page.actionEndpoint (set for aiui.register_page_action), else
page.actionEndpoint
aiui.register_page_action
<apiEndpoint>/action for plugin pages, else /api/pages/<id>/action.
<apiEndpoint>/action
/api/pages/<id>/action
A response with a component list replaces the page; message is shown as a
message
toast; error (or a non-2xx status) as an error toast.
registerBlock(type, C), a window.aiui.registerComponent renderer from
registerBlock(type, C)
window.aiui.registerComponent
custom.js, a block registered with { fallback: true } (the core blocks are
registered this way), then the legacy dashboard renderer, so every existing
_components type keeps working.
_components
relative, http(s), mailto: and tel: URLs (images also data:image/*).
http(s)
mailto:
tel:
data:image/*
Core block types: text, caption, header/heading, markdown_text/markdown,
caption
header
heading
markdown_text
code_block/code, json_view/json, card, metric/stat, stat_group,
code_block
code
json_view
json
card
stat
stat_group
progress_bar/progress, columns/grid, row, container,
progress_bar
progress
columns
grid
row
container
separator/divider, tabs, expander, accordion, table,
separator
divider
tabs
expander
accordion
key_value_list, list, badge, alert, callout, empty, spinner,
key_value_list
list
badge
alert
callout
empty
spinner
skeleton, toast, image_display/image, link, button/action,
skeleton
toast
image_display
image
link
button
button_group, form_action/form, text_input, number_input,
form_action
form
text_input
number_input
date_input, time_input, textarea_input, select_input,
date_input
time_input
textarea_input
select_input
checkbox_input, switch_input, radio_input, slider_input.
checkbox_input
switch_input
radio_input
slider_input
Installing a plugin means trusting it: its Python runs in the server process and
its JavaScript runs in the page with no sandbox (use kind: iframe for
kind: iframe
untrusted content). Because any installed package, including a transitive
dependency, can declare the entry point, the browser parts of entry-point
plugins (pages, blocks, tool renderers and /_plugins/<name>/) and their HTTP
routes (/api/plugins/<name>/*) are default-deny when the server requires
auth or is reached from a non-loopback address. They are listed as
disabled-by-default (and answer 404) until you enable the plugin by name.
disabled-by-default
The plugin's Python code still runs (setup(), features()): to keep an
setup()
installed package from being imported at all, put it in extensions.disabled.
extensions.disabled
extensions: [hello] is shorthand for enabled. From Python:
extensions: [hello]
enabled
aiui.set_extensions(enabled=["hello"]) (it beats YAML). A plugin object
aiui.set_extensions(enabled=["hello"])
registered with aiui.register_plugin(obj) was chosen by the app author and is
aiui.register_plugin(obj)
always trusted: the enabled allowlist does not apply to it, so
extensions: {enabled: [hello]} never switches your own plugin off. Only
extensions: {enabled: [hello]}
extensions.disabled (its name) does.
AIUI_DISABLE_PLUGIN_AUTOLOAD=1 skips the entry-point group entirely (the test
AIUI_DISABLE_PLUGIN_AUTOLOAD=1
suite sets it).
Use praisonaiui.testing.plugin_test_client to mount your plugin inside an
isolated create_shell_app(..., csp="strict") host with ASGI lifespan
create_shell_app(..., csp="strict")
lifespan
startup/shutdown active and a one-line contract check:
praisonaiui also ships a PEP 561 py.typed marker and lazy TYPE_CHECKING
TYPE_CHECKING
annotations, and aiui plugins types exports the matching @aiui/sdk
TypeScript declarations (aiui-sdk.d.ts).
aiui-sdk.d.ts
| Command | Does |
| aiui plugins init <name> [--dir PATH] [--title TEXT] [--force] | Scaffolds a complete, typed, tested plugin package (pyproject.toml, AiuiPlugin with pages()/routes()/lifespan(), zero-build ESM page using <BlockTree> + useLiveData, types/aiui-sdk.d.ts, jsconfig.json, and a passing pytest test) |
aiui plugins init <name> [--dir PATH] [--title TEXT] [--force]
pyproject.toml
AiuiPlugin
lifespan()
types/aiui-sdk.d.ts
pytest
| aiui plugins types [--out PATH] [--stdout] [--force] | Writes or prints the installed wheel's @aiui/sdk TypeScript declarations (aiui-sdk.d.ts) |
aiui plugins types [--out PATH] [--stdout] [--force]
| aiui plugins list [--json] [--config aiui.yaml] | The built-in records (builtin.<name>: status ok or disabled, whether the host requires part of it, its pages), then installed plugins with version, status (ok, error, disabled, incompatible, disabled-by-default) and load error. --json puts the built-ins under builtins |
aiui plugins list [--json] [--config aiui.yaml]
builtin.<name>
ok
disabled
--json
builtins
| aiui plugins doctor [--config aiui.yaml] [--no-builtin] | Loads each plugin and checks SDK version, static_dir(), every module file and its sha384 (pages, blocks, tool renderers, layouts), page kinds, every settings(), nav_groups(), themes() and layouts() entry, routes, CLI name clashes and page ids shadowed by built-in pages or other plugins. A page shadowed by a built-in names the builtin.<name> to add to extensions.disabled; a builtin. name that matches no record is a warning. Exits 1 on any failure |
aiui plugins doctor [--config aiui.yaml] [--no-builtin]
| aiui <plugin> …, aiui plugins <plugin> … | The plugin's own commands |
aiui <plugin> …
aiui plugins <plugin> …
aiui --help and built-in commands never import plugins; discovery runs only
aiui --help
when a command name is not a built-in one.
| Symptom | Check |
| Page says "unavailable" | aiui plugins doctor; the browser console shows the import error |
| Plugin listed as disabled-by-default | Remote or auth-enforced server: add it to extensions.enabled |
| Invalid hook call | The module bundled its own React: mark react and react/jsx-runtime external |
Invalid hook call
| does not provide an export named … | The shell is older than the SDK export the module imports: see feature detection |
does not provide an export named …
| A slot component does not appear | Check the slot name, and that the page header or sidebar is not hidden by the app |
| aiui shell not booted | The module was loaded outside the app shell (style must be app) |
aiui shell not booted
| Integrity error after editing a file | The manifest hashes the file on every request; hard-reload the page so the browser drops its cached copy |