Runtype Persona
Persona (@runtypelabs/persona) is an open-source, backend-agnostic chat widget: a
themeable, zero-framework chat UI that streams from any SSE-capable backend. It ships
first-party Runtype support, so the easiest production path is a Runtype chat surface
with a browser-safe clientToken. Use this skill for website widgets, assistant
layouts, deployment snippets, theming, artifacts, WebMCP page tools, and local browser
tools.
Where to Deploy
Default to Runtype. Embed against a Runtype chat surface with a browser-safe
clientToken and the widget talks to api.runtype.com directly — no proxy and no
server code. This is the recommended path and what generate_persona_embed_code
produces. If MCP is unavailable and the user wants a starter deploy, runtype persona init creates a simple agent, origin-scoped client token, and paste-ready snippet.
Persona also runs on any other streaming backend via the Persona SSE protocol, with
adapter examples for the Vercel AI SDK, OpenAI Agents, LangGraph, and the Anthropic
Claude Agent SDK, among others. Reach for a self-hosted backend or
@runtypelabs/persona-proxy only when you must hide a secret API key or front a
non-Runtype agent — otherwise the hosted clientToken embed is simpler and has fewer
moving parts.
Required First Calls
When MCP is available:
- Use
get_platform_documentation(topic="persona-embed") for current embed docs.
- Use
get_platform_documentation(topic="persona-fullscreen-assistant") for fullscreen
split-pane assistant layouts.
- Use
get_persona_theme_reference before custom themes.
- Use
generate_persona_embed_code for final snippets whenever possible.
- Read
runtype://types/surface-configs directly when surface behavior config details
matter.
Do not hand-write embed code unless the MCP tools are unavailable.
If the task needs details not listed here, fetch persona-embed,
persona-fullscreen-assistant, or types-surface-configs rather than adding
more embed prose to this skill.
Critical Constants
- Package:
@runtypelabs/persona.
- CDN base (Runtype's first-party CDN):
https://cdn.runtype.com/persona/latest for
ordinary embeds. Use cdn.runtype.com everywhere — it is required on pages deployed
through Runtype (a static app or any Runtype-hosted page): their strict CSP only allows
scripts/styles from the page origin and https://cdn.runtype.com, so third-party CDNs
(jsdelivr, unpkg, esm.sh) are blocked and fail silently. On a Runtype-deployed page,
replace latest with a pinned version (e.g. /persona/4.6.0/) so a new release can't
shift the widget code under your immutable app bundle.
- Global script:
https://cdn.runtype.com/persona/latest/install.global.js.
- ESM entry:
https://cdn.runtype.com/persona/latest/index.js.
- CSS for ESM/npm usage:
@runtypelabs/persona/widget.css (or https://cdn.runtype.com/persona/latest/widget.css for CDN/ESM installs).
- Init function:
initAgentWidget().
- Script installer lifecycle callbacks:
onScriptLoad, onLauncherShown,
onChatReady(handle), and onError.
- Ready event:
persona:chat-ready; do not use the removed persona:ready event.
- Direct
initAgentWidget() returns the handle; its onChatReady option is a fire-only
callback, not the primary way to get the handle.
- Controller events include
user:message and assistant:complete.
Common wrong answers: @runtype/persona, Persona.mount(), window.Persona,
index.umd.js, missing widget.css, persona:ready, onReady, widget:ready,
message:sent, or message:received.
Build Pattern
- Create or identify the product, agent/flow capability, and
chat surface.
- Create a scoped client token with
create_client_token.
- Generate embed code with
generate_persona_embed_code.
- For consumer-facing widgets, hide tool calls and reasoning by default.
- For internal/debug widgets, expose useful traces intentionally.
- For custom themes, set explicit high-contrast component tokens and verify header,
launcher, user message, primary button, tool call, and reasoning bubble contrast.
- Keep Persona's default HTML sanitization enabled unless all rendered content is
trusted.
- If the assistant should ask structured follow-up questions or suggest replies, set
features.askUserQuestion.expose: true or features.suggestReplies.expose: true
in the widget config instead of hand-writing duplicate local tools.
Fullscreen Assistant Layouts
For ChatGPT/Claude-style layouts, read the fullscreen assistant resource first. The
default launcher embed is not enough. Fullscreen layouts usually need full-height mode,
panel chrome changes, a persistent shell, an artifact pane, composer customization, and
layout-specific token choices.
Local Tools
Use browser-side local tools when the assistant needs to read page state or trigger UI
actions that are only available in the front end. For Persona widgets these are WebMCP
page tools registered on document.modelContext and admitted by the chat surface's
behavior.webmcp policy. Pair local tools with hidden parameters when authenticated
context should not enter model context.
Good local tool examples:
- Read current page HTML or selected DOM regions.
- Navigate to a record detail page.
- Open a modal or fill a safe form.
- Read browser-only state that has no server API.
Required WebMCP setup:
- Register page tools on
document.modelContext (e.g. registerTool(...)) in the host
page. Persona snapshots them per turn into clientTools[] and runs returned
webmcp:<name> calls back in the browser.
- Create a client token whose
allowedOrigins includes the embedding page origin.
- Enable page-tool consumption in the widget config with
webmcp: { enabled: true }.
Persona shows native approval bubbles by default; use
webmcp.autoApprove = (info) => ... only for safe reads and webmcp.onConfirm only
when the host page needs custom confirmation UI. Widget-side webmcp.allowlist is a
convenience filter, not a security boundary.
- Set the
chat surface behavior.webmcp.enabled to true.
- Add origin-scoped
behavior.webmcp.allowlist rules for page tools that should be
callable, e.g. { origin: "https://store.example.com", tools: ["search_*"] }. Use
behavior.webmcp.requireConfirmFor (a Persona-side UX hint, e.g. ["checkout_*"]) to
force per-call confirmation; server-side enforcement is enabled + allowlist.
- Use the dashboard WebMCP tab to review discovered tools and observed origins after
real traffic. Discovery records the offered page tools before allow-list filtering.
- Do not confuse WebMCP page tools with an
mcp surface. WebMCP runs inside the
browser page; an mcp surface exposes Runtype capabilities to external AI clients.
- Advanced custom chat UIs or server proxies can bypass Persona and send WebMCP-style
local tools directly to API-key
/v1/dispatch as top-level clientTools[], then
resume via /v1/dispatch/resume. This is not the default browser embed path and
must run from a trusted server or SDK process because it requires a secret API key.
Raw dispatch uses optional clientToolsPolicy.allowlist; it does not use
behavior.webmcp, client-token allowedOrigins, or dashboard discovery telemetry.
Custom public-token browser UIs should use /v1/client/chat plus
/v1/client/resume instead; that path follows the same surface behavior.webmcp
policy as Persona.
If the umbrella runtype skill is installed alongside this focused skill, its durable
references provide fallback snippets and working-mode tradeoffs. This skill must still
work when installed by itself; prefer live MCP docs over local sibling files.
Source: hashgraph-online/awesome-codex-plugins → plugins/runtypelabs/skills/skills/runtype-persona/SKILL.md
1---2name: runtype-persona3description: >- Use when embedding, deploying, configuring, styling, or debugging Runtype Persona chat widgets, fullscreen AI assistant layouts, chat surfaces, client-token installs, theme tokens, artifacts, tool/reasoning visibility, programmatic widget access, WebMCP page tools, or browser-side local tools. Prefer generate_persona_embed_code and get_persona_theme_reference over hand-written snippets.4---567# Runtype Persona89Persona (`@runtypelabs/persona`) is an open-source, backend-agnostic chat widget: a10themeable, zero-framework chat UI that streams from any SSE-capable backend. It ships11first-party Runtype support, so the easiest production path is a Runtype `chat` surface12with a browser-safe `clientToken`. Use this skill for website widgets, assistant13layouts, deployment snippets, theming, artifacts, WebMCP page tools, and local browser14tools.1516## Where to Deploy1718Default to Runtype. Embed against a Runtype `chat` surface with a browser-safe19`clientToken` and the widget talks to `api.runtype.com` directly — no proxy and no20server code. This is the recommended path and what `generate_persona_embed_code`21produces. If MCP is unavailable and the user wants a starter deploy, `runtype persona22init` creates a simple agent, origin-scoped client token, and paste-ready snippet.2324Persona also runs on any other streaming backend via the Persona SSE protocol, with25adapter examples for the Vercel AI SDK, OpenAI Agents, LangGraph, and the Anthropic26Claude Agent SDK, among others. Reach for a self-hosted backend or27`@runtypelabs/persona-proxy` only when you must hide a secret API key or front a28non-Runtype agent — otherwise the hosted `clientToken` embed is simpler and has fewer29moving parts.3031## Required First Calls3233When MCP is available:3435- Use `get_platform_documentation(topic="persona-embed")` for current embed docs.36- Use `get_platform_documentation(topic="persona-fullscreen-assistant")` for fullscreen37 split-pane assistant layouts.38- Use `get_persona_theme_reference` before custom themes.39- Use `generate_persona_embed_code` for final snippets whenever possible.40- Read `runtype://types/surface-configs` directly when surface behavior config details41 matter.4243Do not hand-write embed code unless the MCP tools are unavailable.44If the task needs details not listed here, fetch `persona-embed`,45`persona-fullscreen-assistant`, or `types-surface-configs` rather than adding46more embed prose to this skill.4748## Critical Constants4950- Package: `@runtypelabs/persona`.51- CDN base (Runtype's first-party CDN): `https://cdn.runtype.com/persona/latest` for52 ordinary embeds. Use `cdn.runtype.com` everywhere — it is **required** on pages deployed53 through Runtype (a `static` app or any Runtype-hosted page): their strict CSP only allows54 scripts/styles from the page origin and `https://cdn.runtype.com`, so third-party CDNs55 (jsdelivr, unpkg, esm.sh) are blocked and fail silently. On a Runtype-deployed page,56 replace `latest` with a pinned version (e.g. `/persona/4.6.0/`) so a new release can't57 shift the widget code under your immutable app bundle.58- Global script: `https://cdn.runtype.com/persona/latest/install.global.js`.59- ESM entry: `https://cdn.runtype.com/persona/latest/index.js`.60- CSS for ESM/npm usage: `@runtypelabs/persona/widget.css` (or `https://cdn.runtype.com/persona/latest/widget.css` for CDN/ESM installs).61- Init function: `initAgentWidget()`.62- Script installer lifecycle callbacks: `onScriptLoad`, `onLauncherShown`,63 `onChatReady(handle)`, and `onError`.64- Ready event: `persona:chat-ready`; do not use the removed `persona:ready` event.65- Direct `initAgentWidget()` returns the handle; its `onChatReady` option is a fire-only66 callback, not the primary way to get the handle.67- Controller events include `user:message` and `assistant:complete`.6869Common wrong answers: `@runtype/persona`, `Persona.mount()`, `window.Persona`,70`index.umd.js`, missing `widget.css`, `persona:ready`, `onReady`, `widget:ready`,71`message:sent`, or `message:received`.7273## Build Pattern74751. Create or identify the product, agent/flow capability, and `chat` surface.762. Create a scoped client token with `create_client_token`.773. Generate embed code with `generate_persona_embed_code`.784. For consumer-facing widgets, hide tool calls and reasoning by default.795. For internal/debug widgets, expose useful traces intentionally.806. For custom themes, set explicit high-contrast component tokens and verify header,81 launcher, user message, primary button, tool call, and reasoning bubble contrast.827. Keep Persona's default HTML sanitization enabled unless all rendered content is83 trusted.848. If the assistant should ask structured follow-up questions or suggest replies, set85 `features.askUserQuestion.expose: true` or `features.suggestReplies.expose: true`86 in the widget config instead of hand-writing duplicate local tools.8788## Fullscreen Assistant Layouts8990For ChatGPT/Claude-style layouts, read the fullscreen assistant resource first. The91default launcher embed is not enough. Fullscreen layouts usually need full-height mode,92panel chrome changes, a persistent shell, an artifact pane, composer customization, and93layout-specific token choices.9495## Local Tools9697Use browser-side local tools when the assistant needs to read page state or trigger UI98actions that are only available in the front end. For Persona widgets these are WebMCP99page tools registered on `document.modelContext` and admitted by the chat surface's100`behavior.webmcp` policy. Pair local tools with hidden parameters when authenticated101context should not enter model context.102103Good local tool examples:104105- Read current page HTML or selected DOM regions.106- Navigate to a record detail page.107- Open a modal or fill a safe form.108- Read browser-only state that has no server API.109110Required WebMCP setup:111112- Register page tools on `document.modelContext` (e.g. `registerTool(...)`) in the host113 page. Persona snapshots them per turn into `clientTools[]` and runs returned114 `webmcp:<name>` calls back in the browser.115- Create a client token whose `allowedOrigins` includes the embedding page origin.116- Enable page-tool consumption in the widget config with `webmcp: { enabled: true }`.117 Persona shows native approval bubbles by default; use118 `webmcp.autoApprove = (info) => ...` only for safe reads and `webmcp.onConfirm` only119 when the host page needs custom confirmation UI. Widget-side `webmcp.allowlist` is a120 convenience filter, not a security boundary.121- Set the `chat` surface `behavior.webmcp.enabled` to `true`.122- Add origin-scoped `behavior.webmcp.allowlist` rules for page tools that should be123 callable, e.g. `{ origin: "https://store.example.com", tools: ["search_*"] }`. Use124 `behavior.webmcp.requireConfirmFor` (a Persona-side UX hint, e.g. `["checkout_*"]`) to125 force per-call confirmation; server-side enforcement is `enabled` + `allowlist`.126- Use the dashboard WebMCP tab to review discovered tools and observed origins after127 real traffic. Discovery records the offered page tools before allow-list filtering.128- Do not confuse WebMCP page tools with an `mcp` surface. WebMCP runs inside the129 browser page; an `mcp` surface exposes Runtype capabilities to external AI clients.130- Advanced custom chat UIs or server proxies can bypass Persona and send WebMCP-style131 local tools directly to API-key `/v1/dispatch` as top-level `clientTools[]`, then132 resume via `/v1/dispatch/resume`. This is not the default browser embed path and133 must run from a trusted server or SDK process because it requires a secret API key.134 Raw dispatch uses optional `clientToolsPolicy.allowlist`; it does not use135 `behavior.webmcp`, client-token `allowedOrigins`, or dashboard discovery telemetry.136 Custom public-token browser UIs should use `/v1/client/chat` plus137 `/v1/client/resume` instead; that path follows the same surface `behavior.webmcp`138 policy as Persona.139140If the umbrella `runtype` skill is installed alongside this focused skill, its durable141references provide fallback snippets and working-mode tradeoffs. This skill must still142work when installed by itself; prefer live MCP docs over local sibling files.143144---145146**Source:** [`hashgraph-online/awesome-codex-plugins`](https://github.com/hashgraph-online/awesome-codex-plugins) → `plugins/runtypelabs/skills/skills/runtype-persona/SKILL.md`