PiChamber runs your existing pi extensions inside every session. Extensions load from the same locations as the pi CLI — ~/.pi/agent/extensions/ (global) and .pi/extensions/ (project-local, after project trust) — and keep their tools, commands, events, and session state.
On top of that, an extension can ask questions, add cards to the chat, put controls in the composer and panels on the rail through six functions on globalThis.pichamber (see The PiChamber extension API), and a tool can draw its own view of a call in the chat (see Tool views). Views and panels can be blocks or your own HTML page (see Your own pages).
What works out of the box
| Extension capability | Behavior in PiChamber |
|---|---|
pi.registerTool() | Tools are callable by the model; results render as tool cards |
pi.registerCommand() | Invokable from the composer as /command args |
| Lifecycle + agent events | Fully supported (tool_call, before_agent_start, compaction, …) |
ctx.ui.select / confirm / input / editor | Rendered as a blocking dialog in the chat; the extension waits for your answer. A multi-line title shows its first line as a small label and the rest below it as written |
ctx.ui.notify | Shown as a row in the chat where it arrived; live only, not saved to the session |
ctx.ui.setStatus(key, text) | Shown above the composer until cleared |
ctx.ui.setWidget(key, lines) | Lines shown above (or below) the composer |
pi.appendEntry() / pi.sendMessage() | Visible in the chat transcript (see below). Text laid out for the terminal (a box, bars, lined-up columns) reads as a report: the box as a title, Label: value lines as fields, a line over an indented block as its section label, columns and bars in mono, sentences as text |
registerMessageRenderer() (custom message renderers) | Rendered lines shown as the message body; Show more (expanded lines) and Raw (raw text) on its header line (see below). A box background filling every line, its padding, and "press the expand key" hints are left out; plain lines that only repeat the message text show the text instead |
ctx.ui.custom() | Drawn in the chat on a terminal screen in the colours of your Pi theme (Pi's default theme follows PiChamber's light or dark mode; a theme you set in Pi keeps its own colours): inline components take the composer's place, overlays float over the chat. Keys, clicks, drags and the mouse wheel go to the component (Shift+drag selects text). On a phone or tablet a tap is a click, a swipe scrolls, and a key bar adds Esc, Tab, the arrows, Enter and the on-screen keyboard; with a mouse, Show key buttons adds the same bar and Copy text copies what the component drew. An overlay that an extension hides below a certain screen size (visible in its overlay options) is listed above the composer instead; Show draws it at your screen's width so you can answer it, and Hide on its title puts it away again. ctx.mode is "tui", so extensions that check for it run (see Extension interface) |
Other TUI-only surfaces (setHeader/setFooter, onTerminalInput, setEditorComponent, autocomplete providers, theme switching) | Intentional no-ops; use the PiChamber extension API instead |
Lines an extension draws with Pi's theme (theme.fg("accent", ...) and the like) take your Pi theme's colours wherever Pi would draw them: custom() components, tool renders, message renderers, widgets and statuses. Outside a custom() component they sit on PiChamber's background, so a Pi theme made for the other appearance (Pi's dark theme while PiChamber is light) falls back to PiChamber's colours there. Dialogs and notices use PiChamber's colours.
Extension errors don't abort your session — they surface as an error entry so you can see what failed.
Turning extensions on and off
Settings → Extensions & Plugins → Pi extensions lists what Pi loads, the
same list pi config shows in a terminal. It reads and writes Pi's own
settings files, so a change made here applies in the pi CLI too, and a change
made in the CLI shows up here.
- Global has a switch per extension. Off means Pi stops loading it in every project.
- This project appears when a folder is open. Each extension has a switch for that project only. An extension you switch away from its global setting says "On in this project only" or "Off in this project only". Switch it back and the project follows the global setting again. Pi must trust the project first; until then the page shows the global list without controls.
- Packages installed with
pi installor from Browse are listed with their version and extensions. An npm package shows Update to X when npm has a newer version; a package pinned to a version (npm:name@1.2.3) is left as it is. Remove deletes a package the waypi removedoes: an npm or git package's files are deleted, a local folder is only dropped from settings and stays on disk. A global package is removed from Global, a project's package from This project. - Built into Pi lists the extensions that ship with Pi (
mcp,codemode,tool-search). Pi's llama.cpp provider is not offered because PiChamber does not load it.
Running sessions pick a change up when they are idle. The page changes Pi on the machine that runs the PiChamber server, also when you open it from a phone or another computer. Skills, prompt templates, and themes from packages keep their own pages.
Finding and installing packages
Browse, at the top of Settings → Extensions & Plugins, searches the Pi
packages on npm: every npm package with the pi-package keyword, the same
list as Pi's package gallery. PiChamber hosts no registry of its own. The
PiChamber server asks npm and reads only each package's metadata (name,
description, version, maintainer, license, downloads, links), never its
README or images.
- Featured is a short list kept in the PiChamber repository. The server checks it for changes every few hours and falls back to the copy it shipped with.
- Enhanced for PiChamber shows packages that add features only
PiChamber shows, built with the PiChamber plugin SDK, as their authors
mark them. Every Pi package works in PiChamber; these do more here. A package's page checks that its
package.jsonreally says so. - PiChamber's own plugins never show as results. When a search matches one, it shows first with its switch, since it is already installed.
Install asks where to load the package: every project (pi install) or
only the open project (pi install -l), which Pi must trust first. A package
runs as code with Pi's access on the server's machine, so install only
packages you trust. The install runs in the background; the package shows
under Packages when it is done.
Marking a package as enhanced for PiChamber
Add the pichamber keyword next to pi-package in package.json,
and declare a pichamber block with the API version you target:
{
"keywords": ["pi-package", "pichamber"],
"pichamber": { "apiVersion": 1 }
}
The keyword puts the package under Enhanced for PiChamber in Browse; the block is what its page checks. Installed packages with the block get an Enhanced tag with the PiChamber mark under Packages. They load as plain Pi packages, here and in the terminal.
When your extension replaces a plugin
Pi loads only one extension for each tool, command, or flag name. PiChamber's
plugins and Pi's built-ins step aside for your own extension, so a plugin can
be switched on and still not be loaded. For example, your own subagent
extension takes the place of the Sub-agents plugin.
When a session is running in the folder, the page shows it. The plugin's row says "Not loaded" and names the extension, and the plugin's own page has a button that turns that extension off. The extension's row says what it was loaded in place of. With no session running there is nothing to compare, so no notice shows.
Extension interface
Settings → Sessions → Extension interface chooses what extensions are told about the interface. It applies to sessions started after you change it.
- Terminal UI (default):
ctx.modeis"tui". Extensions that check for a terminal draw their own components withctx.ui.custom(), as in the pi CLI, and you answer with the keys they show. - Standard dialogs:
ctx.modeis"rpc", pi's mode for frontends. Each extension decides what to do without a terminal. Some ask withctx.ui.selectorconfirm, which PiChamber shows as clickable dialogs. Some show less or skip their screen, and some may pick a default answer without asking. Extensions that callctx.ui.custom()without checking the mode still draw their terminal UI.
Compatibility principle
PiChamber adapts itself to pi extensions rather than the other way around. An
extension that knows nothing about PiChamber keeps working: its tools, commands,
hooks (tool_call, before_agent_start, context, before_provider_request,
compaction, session_*, agent_*, turn_*, message_*, tool_execution_*,
input, user_bash, etc.), prompt modifications, and ctx.ui dialogs all run
inside the daemon's pi runtime via the SDK's canonical discovery and trust flow
(~/.pi/agent/extensions, .pi/extensions, package pi.extensions).
Everything below is optional.
The PiChamber extension API
Everything PiChamber adds for extensions is a function on one object,
globalThis.pichamber. It is there only inside PiChamber, so checking for it
is also how you detect PiChamber:
const { pichamber } = globalThis;
pi.registerCommand('status', {
handler: async (_args, ctx) => {
if (!pichamber) return ctx.ui.notify('All green', 'info'); // plain pi CLI
await pichamber.card(ctx, { title: 'Status', component: 'markdown', props: { body: 'All green' } });
},
});
| Call | What the user sees | Returns |
|---|---|---|
pichamber.choose(ctx, title, choices, options?) | A question with up to 12 choices | { id, note? }, or undefined when dismissed |
pichamber.form(ctx, title, fields, options?) | One dialog with up to 12 fields | { fieldId: value }, or undefined when cancelled |
pichamber.openUrl(ctx, url) | A link to open on their device | true when shown or opened |
pichamber.card(ctx, card) | A card in the chat, saved with the session | nothing |
pichamber.control(ctx, control) | A control in the composer | nothing |
pichamber.panel(ctx, panel) | A panel on the rail, live while the session runs | nothing |
pichamber.apiVersion | 1 |
The rules are the same for every function:
ctxfirst. It is thectxpi hands your tool, command or event handler, and tells PiChamber which session is asking.- A promise back. Bad input (a card with an unknown component, a control without a command), or a
ctxfrom outside a PiChamber session, rejects with aTypeErrorthat names the function. Await the call to see that error; a call you do not await fails quietly and never stops the server. - Clicks run your commands. A card button, a panel button or a composer control names one
of your registered commands, with or without the leading
/: a letter or digit first, then letters, digits,_,.,:or-, up to 128 characters. A click runs it at once, also while the agent works, and adds nothing to the transcript. A command your extension did not register in that session is refused, never sent to the model as a message. - Nothing is on pi's
ctx.ui. A method pi adds later can never clash with ours.
A child process your extension starts can check process.env.PICHAMBER === "1".
Types
pichamber.d.ts declares the whole API and imports nothing. It ships in the
@pi-chamber/web package:
import type { PiChamber } from '@pi-chamber/web/pichamber';
const pichamber = (globalThis as { pichamber?: PiChamber }).pichamber;
You can also copy the file next to your extension. A full working extension
is packages/web/server/lib/pi/fixtures/pichamber-gui-demo.ts.
Versions and updating your extension
pichamber.apiVersion is the one version of this API. It is 1.
- New functions and new optional fields do not change it. Test for what
you need:
if (pichamber?.card). - A change that would break an extension raises it, and the release notes for that PiChamber version list every such change with the line to replace.
- The
apiVersionin your package'spichamberblock says which version you wrote for.
Moving from 1.0.6, 1.0.7, or a 1.0.8 release candidate
| You wrote | Write now |
|---|---|
pichamber.ui.choose(ctx, …), .ui.form, .ui.openUrl | pichamber.choose(ctx, …), pichamber.form, pichamber.openUrl |
pi.appendEntry('pichamber.ui', card) | pichamber.card(ctx, card) |
pi.events.emit('pichamber:composer', control) | pichamber.control(ctx, control) |
pichamber.version | pichamber.apiVersion |
globalThis.__PICHAMBER__ to detect PiChamber | globalThis.pichamber |
ctx.ui.form(…), ctx.ui.openUrl(…) | pichamber.form(ctx, …), pichamber.openUrl(ctx, …) |
protocol and version fields in a card | leave them out |
a card with an id (live panel), pichamber.app | removed; neither was ever drawn |
keyword pichamber-plugin | keyword pichamber |
Cards already saved in sessions as pichamber.ui keep rendering, and
__PICHAMBER__ is still set for extensions that check it.
Questions and forms
ctx.ui.select, confirm, input and editor are pi's own dialogs and work
as they do in the terminal. PiChamber adds two more.
const answer = await pichamber.choose(ctx, 'Which pricing header?', [
{ id: 'a', label: 'Compact', description: 'One row' },
{ id: 'b', label: 'Tall', description: 'Logo above the plans' },
], { allowNote: true });
// { id: 'b', note: 'darker please' } or undefined
options.toolCallId names the tool call that asks, options.message adds a
line under the title, and signal and timeout close the question without
an answer.
const values = await pichamber.form(ctx, 'Spawn agent', [
{ id: 'name', label: 'Name', required: true },
{ id: 'level', label: 'Level', type: 'select', options: ['low', 'high'] },
{ id: 'tests', label: 'Run tests', type: 'checkbox' },
]);
// { name: 'scout', level: 'high', tests: 'true' } or undefined
Field types are text, textarea, number (min, max), select
(options) and checkbox. Answers are checked against the fields before
your await returns. Every value is a string.
Editor dialogs
ctx.ui.editor(title, prefill) opens a multiline blocking dialog. Submit
returns the current text, including an empty string. Cancel returns
undefined.
Cards
await pichamber.card(ctx, {
title: 'Explore progress',
component: 'progress',
props: { label: 'Files indexed', value: 40, max: 100 },
actions: [{ label: 'Focus repo', command: 'explore:focus', args: 'src' }],
});
A card is one component, or a few blocks (below), with an optional title and
up to 8 buttons. It is saved with the session, so it is there after a reload
and on a device that opens the session later. Each call adds a new card, unless you give an id.
Updating a card
Give a card an id (lowercase letters, digits, ., _ and -, up to 64),
and calling pichamber.card again with that id replaces it where it is in
the chat. Use it for something that changes after you first show it, such as a
job that starts and later finishes:
await pichamber.card(ctx, { id: `deploy-${run}`, title: 'Deploy', component: 'badges', props: { items: [{ label: 'running', tone: 'info' }] } });
// later
await pichamber.card(ctx, { id: `deploy-${run}`, title: 'Deploy', component: 'badges', props: { items: [{ label: 'live', tone: 'success' }] } });
Every call is still saved in the session, so update when something changes, not on every tick. A card the session cannot show with its own id (an id used in another branch of the session, for example) is drawn on its own.
// markdown
{ component: "markdown", props: { body: "**Indexed** 12 files" } }
// key-value rows
{ component: "kv", props: { rows: [{ label: "Files", value: "12", tone: "info" }] } }
// list
{ component: "list", props: { items: [{ label: "src/", value: "42 files" }] } }
// table
{ component: "table", props: { columns: ["File", "Status"], rows: [["a.ts", "done"]] } }
// progress bar (value/max)
{ component: "progress", props: { label: "Indexing", value: 40, max: 100 } }
// badges
{ component: "badges", props: { items: [{ label: "passing", tone: "success" }, "3 skipped"] } }
// code block
{ component: "code", props: { language: "ts", code: "const x = 1;" } }
// a run's steps, oldest first: tool calls in mono, what the agent said in text
{ component: "steps", props: { steps: [
{ kind: "text", text: "Looking at the failing test first." },
{ kind: "tool", text: "$ npm test", state: "failed" },
{ kind: "tool", text: "read src/app.ts", state: "working" },
] } }
steps lists a run the way PiChamber's own Sub-agents view does: each step
is a tool call or text the agent said, state: "failed" marks a failed
call and state: "working" the one in progress. The latest 200 steps show,
each up to 2,000 characters. Inside a panel row's detail, a section per
part (Task, Steps, Answer) gives the same layout as that view.
Cards of blocks
Instead of one component, a card can hold blocks, the ones a panel or tool
view uses (see Panels), up to 50. Use them for work you track as
it goes, such as runs you started in the background: an items row per run,
with its state, updated through the card's id.
await pichamber.card(ctx, {
id: `crew-${run}`,
title: 'Parallel of 2',
blocks: [{ component: 'items', props: { items: [
{ id: 'scout', number: 1, title: 'scout', description: 'Map the API routes', status: { state: 'done' }, meta: '12s' },
{ id: 'tester', number: 2, title: 'tester', description: 'Run the unit tests', status: { state: 'working' } },
] } }],
actions: [{ label: 'Open in panel', variant: 'ghost', open: { panel: 'acme-crew' } }],
});
In a card, items always draw as rows. When the card has an action that
opens a panel, pressing a row opens that panel at the row with the same id.
An action has a label and a command, and optionally args, variant
(default, outline, ghost), icon, disabled, loading, confirm (a
question asked before it runs) and promptForArgs ({ label, placeholder },
asks for the arguments first). An action can open one of the session's panels
instead: { label: 'Open run', open: { panel: 'acme-crew', item: 'run-1' } }.
A card is stored as a session entry labelled pichamber.card, the entry
pi.appendEntry('pichamber.card', card) writes, and
pi.sendMessage({ customType: 'pichamber.card', details: card, … }) shows
the same card as a message the model also reads. Custom entries and messages
with any other label show as a plain collapsed card.
Composer controls
let planOn = false;
const declare = (ctx) => pichamber?.control(ctx, {
id: 'plan', kind: 'toggle', label: 'Plan', value: planOn, command: 'plan',
});
pi.on('session_start', (_event, ctx) => declare(ctx));
pi.registerCommand('plan', {
handler: async (_args, ctx) => { planOn = !planOn; await declare(ctx); },
});
Your extension keeps the value. A click runs your command, and your command declares the control again with the new value.
// A cycle: each option has its own command.
pichamber.control(ctx, {
id: 'mode', kind: 'cycle', label: 'Mode', value: 'balance',
options: [
{ value: 'economy', label: 'Economy', command: 'economy' },
{ value: 'balance', label: 'Balance', command: 'balance' },
],
});
// A button that runs a command.
pichamber.control(ctx, { id: 'review', kind: 'action', label: 'Review', command: 'review --staged' });
// A menu: one pill for several commands.
pichamber.control(ctx, {
id: 'tools', kind: 'menu', label: 'Tools',
items: [
{ id: 'review', label: 'Review', command: 'review --staged', description: 'Staged changes only' },
{ id: 'lint', label: 'Lint', command: 'lint' },
{ separator: true },
{ id: 'deploy', label: 'Deploy', command: 'deploy', disabled: !ready },
],
});
// Take a control away.
pichamber.control(ctx, { id: 'plan', remove: true });
id: lowercase letters, digits and dashes, up to 40 characters. Declaring the same id again replaces the control.kind:toggle,cycle(2 to 12options),action, ormenu(1 to 12items, with{ separator: true }between groups). A menu item has anid(unique in the menu),label,command, and optionaldescriptionanddisabled.- If you have several actions, put them in one menu rather than a pill each.
label(up to 40 characters),description(up to 200) andiconare the pill's text, tooltip and icon.- A session shows its first 16 controls. Controls clear when the session
reloads, so declare them at
session_start.
On desktop each control is a pill beside the model picker; on phones they are rows in the composer controls sheet. A toggle, an action, or a cycle with up to 3 options acts when clicked. A menu, or a cycle with more options, opens a list, and its pill shows a chevron. If a control's command changes the model or thinking level, the composer follows it.
A new session has its controls before you send anything. When you open one,
PiChamber starts a session for it in the background, so your extensions load
and declare their controls as usual. Until that is ready, the composer shows
the controls the folder had last time. A click made before then waits and
runs once the session is ready. Your first message goes to that same
session, so a mode you picked is still picked. If you close the draft or
pick another folder, the background session ends. Nothing is written to disk
until you send, and the session list never shows it. Your extension sees an
ordinary session_start, so it needs no changes.
Panels
await pichamber.panel(ctx, {
id: 'acme-crew', // per session: prefix it with your package name
title: 'Crew', // up to 40 characters, needed the first time
icon: 'robot-2',
badge: '2 working', // up to 24 characters
count: 2, // 0 to 999, on the rail item
attention: 'warning', // or 'error'; null clears it
body: { blocks: [
{ component: 'section', props: { title: 'Runs', count: 2, blocks: [
{ component: 'items', props: { items: [
{ id: 'run-1', title: 'Scout', status: { label: 'working', tone: 'info' }, progress: 0.4,
step: 'read src/app.ts', detail: [{ component: 'markdown', props: { body: 'Log…' } }] },
] } },
] } },
{ component: 'actions', props: { actions: [{ label: 'Stop all', command: 'crew-stop' }] } },
] },
});
await pichamber.panel(ctx, { id: 'acme-crew', count: 1 }); // the rest stays
await pichamber.panel(ctx, { id: 'acme-crew', remove: true });
A panel is live: it is not saved with the session, and it ends with the
session. Declare it at session_start. Each call replaces the fields it
gives and keeps the others; null clears an optional field.
- A body is a list of blocks: the card components plus
section({ title, count?, collapsed?, blocks }),items({ layout?: 'list' | 'cards', items }) andactions({ actions }). - An item has an
id(lowercase letters, digits,.,_,-, up to 64, unique in its block), atitle(80), and optionallydescription(200),meta(40),status,icon,number(0 to 9999, before the title),progress(0 to 1),step(120) anddetail(blocks the row opens). statusis{ label?, tone?, state? }. Astate(done,failed,working,waitingorstopped) draws its icon and fills in the word and tone you leave out:{ state: 'done' }is a green "Done".workingdraws like the agent's own working line, the pixel grid with the word shimmering, in place of any tone.iconis a tile beside the title:{ provider: 'anthropic' }for a model provider's logo, or an icon name. Leave it out when it would only repeat what the title says.- Limits: 8 panels per session, 200 blocks and 500 items per body counted
through sections and details, blocks nested at most 4 deep, 200 items per
itemsblock, 8 actions peractionsblock, 256 KB per panel. - Updates reach the browser at most every 100 ms, latest state first. An update that changes nothing is not sent, and one that leaves the body as it was sends only the rest, so a counter or badge you update often stays cheap.
- A session may call
pichamber.panel10 times a second, with bursts of 60. Calls past that are held, not rejected: the held calls for a panel merge the way updates do, and apply as soon as the limit allows, so the last state you send always lands. A held call that turns out invalid is dropped, since it has already resolved. - A body can be your own page instead of blocks; see Your own pages.
- When extensions reload, panels stay on screen. Your extension has 3 seconds
after its new
session_startto declare them again; the rest close. - A tab stays open per folder, so it can show while a session without that panel is open; it then says the panel is not running in this session.
Tool views
A tool can draw its own view of a call in the chat: put pichamber on the
result's details. Put it on partial onUpdate details too, and the view
updates while the call runs.
pi.registerTool({
name: 'crew',
// ...
async execute(toolCallId, params, signal, onUpdate, ctx) {
const runs = await runCrew(params, (partial) => onUpdate?.({
content: [{ type: 'text', text: 'Working…' }],
details: { runs: partial, pichamber: view(partial) },
}));
return { content: [{ type: 'text', text: summary(runs) }], details: { runs, pichamber: view(runs) } };
},
});
const view = (runs) => ({
view: {
title: 'Crew', // up to 80 characters
meta: `${runs.length} agents`, // up to 40
blocks: [{ component: 'items', props: { layout: 'cards', items: runs.map((run) => ({
id: run.id, title: run.agent, description: run.task, status: { label: run.state, tone: 'info' },
})) } }],
},
open: { panel: 'acme-crew' }, // optional: rows open this panel at their item
});
- The view draws between the turn's activity and its reply, in place of the call's usual look. It uses the same blocks as panels.
- Details are saved with the session, so the view is drawn again after a
reload. Keep
detailssmall: aviewof blocks over 64 KB as JSON is ignored (a page, 256 KB). - With
open, the view has "Open in panel" and each row opens the panel at that row, while the session has that panel. A saved view whose panel is not running draws without links. Phones have no side panel, so there the view has no "Open in panel": a row opens the panel as a sheet at that row. - Nothing checks a view when your tool returns, because the result is already saved: a view PiChamber cannot draw is ignored and the call keeps its usual look, and an invalid row or button is dropped. Try your view in PiChamber while you write it.
PiChamberToolDetailsinpichamber.d.tstypesdetails.pichamber.
Your own pages
When blocks are not enough, draw the view or panel yourself: give html
(and data) in place of blocks.
const page = `
<ul id="runs"></ul>
<script>
pichamber.onData((runs) => {
document.getElementById('runs').replaceChildren(...runs.map((run) => {
const row = document.createElement('li');
const rerun = document.createElement('button');
rerun.textContent = 'Run again';
rerun.onclick = () => pichamber.run('crew-rerun', run.id).catch(() => {});
row.append(run.agent + ' ', rerun);
return row;
}));
});
</script>`;
// A tool view: send the same html with each update; only the data changes.
details: { runs, pichamber: { view: { title: 'Crew', html: page, data: runs }, open: { panel: 'acme-crew' } } }
// A panel, then new data without reloading the page.
await pichamber.panel(ctx, { id: 'acme-crew', title: 'Crew', body: { html: page, data: runs } });
await pichamber.panel(ctx, { id: 'acme-crew', body: { data: runs } });
- The page runs in the sandboxed frame Visuals pages use. It cannot reach
PiChamber, its storage or cookies, or the network: put your scripts,
styles and images (as
data:URLs) in the HTML. - It gets the theme as CSS variables (
--pc-bg,--pc-fg,--pc-muted,--pc-border,--pc-surface,--pc-accent,--pc-good,--pc-warn,--pc-bad,--pc-c1to--pc-c5,--pc-font,--pc-mono), and plain headings, tables, buttons and inputs already look like PiChamber. The standard MCP Apps names (--color-background-primary,--color-text-secondary,--color-border-primary,--font-sans,--border-radius-mdand the rest) are set too, so a page written for those hosts picks up PiChamber's theme. - For something in progress, use
<pc-working></pc-working>: the app's working mark, the pixel grid the agent shows while it works.<pc-working label="Reviewing"></pc-working>adds the word, shimmering like the agent's working line. Please use it instead of a spinner, so work in progress looks the same everywhere. - Three more elements draw what panels draw, so a page looks the same
without styling it:
<pc-row heading="scout" description="Map the repo" meta="1m 20s" state="done" interactive></pc-row>: a panel item row. Usenumberin front of the heading,stepin place ofdescriptionfor what a working run is doing, andstatusandtoneto change the status word and colour. Withinteractiveit is a button: listen forclick.<pc-status state="failed"></pc-status>: a status mark and word.stateisdone,failed,working,waitingorstopped;labelchanges the word,tone(success,error,warning,info,neutral) the colour, andshow="mark"orshow="word"draws one half.<pc-markdown>## Answer …</pc-markdown>: Markdown drawn like the chat's, from its text or itstextproperty. Links open only forhttp,httpsandmailto, and no HTML in the text is drawn.
window.pichamberin the page:dataandonData(callback),itemandonItem(callback)(the panel row the user opened),run(command, args?)andopen(panel, item?). The callbacks run at once and on every change.PiChamberPageinpichamber.d.tstypes it.runruns one of your session's registered commands, like a card button, andopenopens a panel; in a panel, opening the same panel sets itsitem, so a page can do list then detail. Both count only right after a click in the page, so a page cannot act on its own.- A page can run any command and open any panel of its session, not only
your extension's. Write the page's markup yourself, and put text you did
not write (a fetched page, a tool's output, the model's words) in with
textContentor<pc-markdown>, never as HTML. - When a panel page opens one of its rows, PiChamber shows its own Back bar above the page, which goes back to the list. Don't draw a back link of your own.
- The page loads once and stays loaded while its
datachanges. It reloads when its HTML or PiChamber's theme changes, starting from the latest data. - In the chat, the frame grows to fit the page, and opens at the height the page had last time, so the chat doesn't jump when you scroll back. In a panel, it fills the panel and the page scrolls.
- A tool view's page may be up to 256 KB with its data; a panel, 256 KB in
all.
datais anything JSON can carry.
What pi's own API shows as
Custom message renderers
When an extension registers a message renderer (for example a
subagent-notification renderer), the daemon renders the custom message at
100 columns and attaches the ANSI lines to the message. PiChamber shows those
lines as the message body. Show more on the message's header line swaps to
the expanded lines, and Raw beside it opens the original text plus details.
A background filling every line (a terminal box), the box's padding, and
lines naming a terminal key to expand are left out, and prose lines wrap.
Plain lines that only repeat the message text show the text instead.
Messages without a renderer keep the existing note display.
Live state (ctx.ui.setStatus, ctx.ui.setWidget, open dialogs, composer
controls, panels) is kept per session on the server and sent with the session
snapshot, so a device that connects later sees it. All of it travels through
the normal authenticated event stream (/api/pi/events).
Notes for project-local extensions
Project-local extensions participate in pi's standard trust flow. When PiChamber opens a project that hasn't been trusted yet, pi resolves trust exactly as it does on the CLI.
Security and limits
- Declarative payloads are validated and truncated (keys ≤128, titles ≤256, badge items ≤24, table rows ≤200, messages ≤50k). Unknown card components never execute code.
- Card actions, panel actions, tool view buttons and composer controls run only slash commands the session's extensions register, through an authenticated request — never arbitrary function calls, and never a message to the model. A tool view's buttons come from the tool that wrote the details, so they are as trustworthy as that tool.
- Extension UI state is scoped per
sessionIdand never leaks across sessions or directory scopes. - Raw HTML in extension messages is rendered as inert text and sanitized.
Pages you draw yourself (
htmlin a tool view or panel) run in a sandboxed frame with no network and no access to PiChamber; theirrunandopencount only right after a click in the page. A click elsewhere in PiChamber does not count, and a browser that cannot tell where the click was runs nothing for the page. GET /api/pi/extensionsreturns opaque extension ids only — server filesystem paths never cross the API boundary.
User-authored command triggers
Users can pin any registered slash command as a quick-action button near the
composer and optionally bind a global keybinding to it (Settings → Shortcuts →
Command triggers). Triggers are stored in shared ui-settings, fire the same
authenticated prompt path, and always match after built-in shortcuts so they
can never shadow core actions. This restores CLI-style muscle memory (for
example cycling model modes without touching the mouse) for extensions that
register commands instead of terminal keyboard hooks — pi.registerShortcut()
remains TUI-only and does not fire in PiChamber sessions.