diff --git a/skills/runtype-admin/SKILL.md b/skills/runtype-admin/SKILL.md index 51d0308..2451a91 100644 --- a/skills/runtype-admin/SKILL.md +++ b/skills/runtype-admin/SKILL.md @@ -67,6 +67,10 @@ Discover before you act: Surfaces belong to a product. List or change them with the product ID in hand. +When the server lists `delegate_to_runtype`, delegate debugging that needs trace, fix, +and verify, and audits that page across many entities: the digest keeps large payloads +out of your context. Single lookups and edits to a known id are faster as direct calls. + Use `list_model_configs` to see which models the account can run. `list_available_models` is the platform catalog: its `isEnabled` and `isDefault` fields are always null or false, so it cannot tell you whether a model is enabled. @@ -218,7 +222,8 @@ permission is missing, or request a new key: 1. Call `request_api_key` with the narrowest `permissions` that cover the task and a specific `reason`. Keep the returned `codeVerifier`. It cannot be recovered. 2. Wait for a person to approve the request in the dashboard. -3. Redeem it with `runtype api-keys claim --verifier `, or with +3. Redeem it with `RUNTYPE_KEY_REQUEST_VERIFIER= runtype api-keys claim ` (older + CLIs: `--verifier `), or with `claim_api_key` using the default `delivery: "secret"`. Never print the key into the conversation. diff --git a/skills/runtype-build-product/SKILL.md b/skills/runtype-build-product/SKILL.md index c93def2..8eb7cc1 100644 --- a/skills/runtype-build-product/SKILL.md +++ b/skills/runtype-build-product/SKILL.md @@ -17,6 +17,20 @@ If the Runtype MCP tools are not available, run `runtype install-mcp` for the cu agent harness. Until the tools appear, call them through the CLI with `runtype mcp tools` and `runtype mcp call `. For sign-in and account setup, use the `runtype` skill. +## Delegate or drive + +If the Runtype MCP server lists `delegate_to_runtype`, hand it the build when the work +stays inside the Runtype account and takes four or more dependent calls (build, validate, +test-run). On a host that runs it as an MCP task (Claude Code's main conversation), three +calls is enough. Put the goal, every decision and target id, and the acceptance check in +`task` up front, relay the `task_url`, and verify anything the digest marks untested. + +Drive the steps yourself (below) when the change is one or two calls or an edit to a +known id, when the user wants to steer each step, when the result feeds code you are +writing, or when it needs local files, secrets, provider keys, or client tokens. The +delegate cannot see or create those. Only the self-driven path needs +`get_build_instructions`. + ## Required first calls Before designing or creating resources: diff --git a/skills/runtype-persona/SKILL.md b/skills/runtype-persona/SKILL.md index 19c53ae..b7102e3 100644 --- a/skills/runtype-persona/SKILL.md +++ b/skills/runtype-persona/SKILL.md @@ -99,7 +99,7 @@ as a `version` or `cdn` key in `data-config`. version requires exactly one agent in `agentIds`. A token with no target resolves like any run that names no version, so depending on your organization's live-default setting, a saved agent edit can reach the widget immediately. -4. Generate embed code with `generate_persona_embed_code`. +4. Generate embed code with `generate_persona_embed_code`, then add `future: { v5Defaults: true }` to the widget config to use the V5 default styles. Under V5, the artifact pane is on by default; set `features.artifacts.enabled` to `false` to turn it off. For a coordinated look without hand-written tokens, set the top-level `brand` option (`accent`, `neutral`, `font`, `radius`, `density`, `elevation`). Explicit `theme` values still win. 5. For consumer-facing widgets, hide tool calls and reasoning by default. 6. For internal or debug widgets, expose useful traces intentionally. 7. For custom themes, set explicit high-contrast component tokens and verify header, @@ -136,6 +136,12 @@ and layout-specific token choices. ## Local Tools +Before designing or auditing page tools, read +[`webmcp-authoring.md`](references/webmcp-authoring.md). Use its +journey, trust, confirmation, and evaluation checklist alongside the platform +configuration below. Upstream WebMCP skills supplement these rules; they do not +override Runtype authorization or Persona's compatibility contracts. + 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 diff --git a/skills/runtype-persona/references/webmcp-authoring.md b/skills/runtype-persona/references/webmcp-authoring.md new file mode 100644 index 0000000..f0a246c --- /dev/null +++ b/skills/runtype-persona/references/webmcp-authoring.md @@ -0,0 +1,84 @@ +# Design and verify WebMCP page tools + +Use this guide when an assistant needs state or UI that exists only in the +browser. Keep backend work in server-side tools. Read `persona-embed` for the +current client-token, surface, and widget configuration before writing an embed. + +## Design the user journey first + +1. Describe the user's goal and starting state, including authentication, + selected items, open forms, and unsaved changes. +2. Role-play a successful conversation and an ambiguous request. Decide where + the assistant must ask for clarification or hand control to the user. +3. Give each tool one distinct capability. Describe what it does and when to + choose it. Keep navigation separate from an action that commits a purchase, + sends a message, publishes content, or deletes data. +4. Register tools only while their page state exists. Remove owned + registrations with an `AbortController` when the component unmounts. +5. Validate arguments at runtime, recheck the current resource and permissions, + honor cancellation, and await the visible state update before returning. + Return an actionable error for stale selections or unsaved work. + +For example, `get_cart` reads the cart, while `open_checkout` opens a review +screen. Neither places an order. Keep the final purchase behind the site's +authenticated, user-confirmed checkout. Never accept a model-authored +`confirmed: true` argument as proof of consent. + +## Declare behavior without granting permission + +- Set `readOnlyHint: true` only for tools that change neither application state + nor the visible UI. Navigation is not read-only. +- Set `consequentialHint: true` for tools that commit significant real-world + actions. Opening a review screen is different from committing the action. +- Set `untrustedContentHint: true` when results contain user-authored or + third-party text, even when your own database stores that text. A read-only + query can return untrusted content. +- Treat every hint as advisory. Missing or false hints do not grant permission, + authorize a resource, prove consent, or establish replay safety. +- Keep Persona's confirmation defaults. Use a host-owned, explicitly reviewed + safe-read policy for `webmcp.autoApprove`, not arbitrary page-authored hints. + Do not change the voice lane's existing policy as part of an authoring task. +- Keep origin-scoped surface allowlists and client-token origin restrictions. + Browser confirmation, `requireConfirmFor`, and client-side filters do not + replace server-side authorization. Tool outputs are data, never instructions + that can authorize a subsequent action. + +## Use native authoring types without replacing compatibility code + +The upstream `webmcp-types` package can infer an `execute` callback's arguments +from a literal `inputSchema`. Add it as a development dependency to the app +authoring the tools and activate it in that app's TypeScript configuration. +It is distinct from `@mcp-b/webmcp-types`. Types do not validate runtime input, +install WebMCP, or establish browser support. + +Do not replace Persona's structural consumer types, v5 fallback, dual-generation +bridge, or public declarations with native-only types. Test declaration builds +and supported browser/polyfill combinations before changing those contracts. + +## Verify behavior at separate layers + +- Run deterministic callback and bridge tests for invalid arguments, stale + resources, declined confirmation, cancellation, unmount, and completed UI + updates. Confirm that a declined action has no side effect. +- Run model evaluations for tool choice, argument extraction, ambiguity, and + recovery after errors. Include an injected instruction in a tool result and + verify it does not cause an unauthorized action. A passing schema-only + evaluation does not prove approval enforcement or prompt-injection safety. +- Inspect tools on every relevant route and state in a native WebMCP browser + and through Persona's supported polyfill paths. Missing browser support is + not evidence that the app registers no tools. + +Use synthetic data. Keep provider keys server-side, opt into paid evaluations, +and record the model, runner version, run count, and failures. Do not describe +unrun model evaluations as passing. + +## Further reading + +- [Google's WebMCP authoring skill](https://github.com/GoogleChromeLabs/webmcp-tools/tree/main/webmcp-skills) + provides journey design, role-play, and evaluation workflows. Adapt it to the + policies above; its authoring budgets are not new Runtype platform limits. +- [Native WebMCP types](https://github.com/webmachinelearning/webmcp-types) +- [Persona's typed tools and evaluation example](https://github.com/runtypelabs/persona/tree/main/examples/webmcp-typed-tools) + +This is coding-agent guidance. It is not an A2A `AgentSkill` or a deployed +Runtype Agent Skill bundle. diff --git a/skills/runtype/SKILL.md b/skills/runtype/SKILL.md index d745dc0..7f20d33 100644 --- a/skills/runtype/SKILL.md +++ b/skills/runtype/SKILL.md @@ -59,7 +59,12 @@ your session. A written configuration does not prove that the connection is acti CLI writes the key to a local key file. From MCP, call `request_api_key`, keep the `codeVerifier` it returns, and redeem the approved request with `claim_api_key`. Its default delivery stores the key as a Runtype secret and returns only a `{{secret:KEY}}` - reference, so the key is never shown in the conversation. + reference, so the key is never shown in the conversation. When the key must be collected + on a machine with no Runtype login (a fresh sandbox, for example), file the request with + `--allow-unauthenticated-claim` (MCP `allow_unauthenticated_claim: true`) and redeem it + there with `RUNTYPE_KEY_REQUEST_VERIFIER= runtype api-keys claim `. + The key is limited to scopes you already hold and lasts at most 7 days. Treat the + verifier like the key itself. - **MCP.** Run `runtype install-mcp` for the current coding assistant, follow the action or restart it reports, then confirm the account with `runtype auth whoami --no-tty`. diff --git a/skills/runtype/references/mcp-tools.md b/skills/runtype/references/mcp-tools.md index b563b65..ae7c60a 100644 --- a/skills/runtype/references/mcp-tools.md +++ b/skills/runtype/references/mcp-tools.md @@ -357,7 +357,7 @@ Bring-your-own provider credentials: `list_provider_keys`, `create_provider_key` | `check_delegation` | Long-poll a running delegation for events since `after` | | `cancel_delegation` | Stop a running delegation; completed changes stay | -When the account has the flag, the server instructions recommend delegating multi-step work (build or change a flow, agent, product, surface or tool; debug a run; load records; run evals). Pass `wait_seconds: 240` on Claude Code; keep it under 60 on clients with a 60-second tool timeout. A result with `status: input_required` carries a `question`; answer it with `delegate_to_runtype { task_id, task: }`. +When the account has the flag, the server instructions recommend delegating work that stays inside the account and takes four or more dependent calls, would need `get_build_instructions`, or reads many entities to produce a small answer. Call tools directly for single reads, known-id edits, output that feeds your code, `submit_batch` and `run_simulation`, and anything that needs local files, secrets, keys, or client tokens. On a host that runs the call as an MCP task (Claude Code 2.1.304+, main conversation), the bar drops to three calls, the call returns at once, and the host delivers the digest; `wait_seconds` is ignored there. Elsewhere, leave `wait_seconds` unset unless you know your tool-call timeout: the server defaults to 240 on Claude Code and 45 elsewhere. Then follow the result's `next_step`. A result with `status: input_required` carries a `question`; answer it with `delegate_to_runtype { task_id, task: }`. Start with the `index` topic (task-to-topic map). Useful documentation topics include `platform-catalog`, `surface-types`, `flow-step-types`, `models`, `product-schema`, `types-fpo`, `types-flow-steps`, `types-entities`, `types-surface-configs`, `orthogonal-tools`, `builtin-tools`, `agent-skills`, `external-tools`, `external-agents`, `evals`, `limits`, `validation-errors`, `setup-readiness`, `dashboard-links`, `mock-ecommerce`, `persona-embed`, `persona-fullscreen-assistant`, and `sdk-reference`. diff --git a/skills/runtype/references/persona-widget.md b/skills/runtype/references/persona-widget.md index 951336f..8890746 100644 --- a/skills/runtype/references/persona-widget.md +++ b/skills/runtype/references/persona-widget.md @@ -13,6 +13,7 @@ For current WebMCP and fullscreen layout details, prefer `persona-embed`, - [Client token](#client-token) - [Three integration options](#three-integration-options) - [Config reference](#config-reference) +- [V5 defaults and brand](#v5-defaults-and-brand) - [Programmatic access](#programmatic-access) - [WebMCP page tools](#webmcp-page-tools) - [Built-in client tools](#built-in-client-tools) @@ -64,21 +65,59 @@ A chat surface is optional: a token that names the agent in `agentIds` works on ## Current defaults to preserve -- Script-tag installs use the tiny `launcher.global.js` fast path for ordinary floating launchers and defer the full widget until first open when safe. -- Persona sanitizes rendered message HTML with DOMPurify by default. Keep `config.sanitize` enabled unless all rendered content is trusted. -- Shadow DOM is opt-in with `useShadowDom: true`; the default is `false` for CSS compatibility. -- For programmatic access, prefer `onChatReady` or `persona:chat-ready`. +These apply under V4 and V5 unless noted. Under `future.v5Defaults: true`, the look +changes as described in [V5 defaults and brand](#v5-defaults-and-brand), but the +behavior in this list stays the same. + +- Script-tag installs use the tiny `launcher.global.js` fast path for ordinary floating launchers and defer the full widget until first open when safe. With V5 defaults, the deferred launcher renders the same circle launcher as the full widget. +- Persona sanitizes rendered message HTML with DOMPurify by default. Keep `config.sanitize` enabled unless all rendered content is trusted. V5 does not change this. +- Shadow DOM is opt-in with `useShadowDom: true`; the default is `false` for CSS compatibility. V5 does not change this. +- For programmatic access, prefer `onChatReady` or `persona:chat-ready`. V5 does not change this. + +## V5 defaults and brand + +`future.v5Defaults: true` opts in to the V5 default styles. V4 stays the default until +you set the flag. The flag selects defaults only: explicit options and theme tokens always +win, and each affected setting stays independently configurable. + +With V5 defaults: + +- The launcher is a round button (`launcher.variant: "circle"`). Set `launcher.variant` to `"pill"` to keep the text-and-icon launcher. +- The composer is an overlay (`composer.placement: "overlay"`) with a fade over the transcript. +- Tool calls, reasoning, and approvals render as compact activity and decision rows. +- Artifacts are enabled, including the artifact pane. Set `features.artifacts.enabled` to `false` to turn off the pane, artifact cards, and inline previews. + +Use the top-level `brand` option to coordinate colors, typography, corners, density, and +elevation. Every field is optional, and it works with or without V5 defaults: + +- `accent`: Hex, `rgb()`, or `rgba()` with alpha 1. Drives accent colors, buttons, links, and focus. +- `neutral`: Same formats as `accent`. Drives backgrounds, surfaces, text, and borders. When `colorScheme` is omitted, a dark neutral selects dark mode. +- `font`: A CSS font-family string. Load custom fonts in the host page. +- `radius`: `none`, `sm`, `md`, or `lg` (0, 4, 8, or 16px). Circular controls stay circular. +- `density`: `compact`, `comfortable`, or `spacious`. Sets type size and header height. +- `elevation`: `flat`, `subtle`, or `raised`. Sets shadows and borders. + +```ts +config: { + future: { v5Defaults: true }, + brand: { accent: '#7c3aed', radius: 'lg', elevation: 'subtle' }, +} +``` + +Explicit `theme` and `darkTheme` values override `brand`. For example, an explicit +`theme.components.panel.borderRadius` wins over the brand's corners. ## Three integration options ### Option 1: Script installer (simplest) -One script tag, no CSS import needed. +One script tag, no CSS import needed. The `data-config` attribute turns on the V5 default styles. ```html ``` @@ -89,7 +128,7 @@ To mount in a specific container: ``` @@ -114,6 +153,7 @@ included, on `window.siteAgentConfig` and load the installer): config: { apiUrl: 'https://api.runtype.com', clientToken: 'YOUR_CLIENT_TOKEN', + future: { v5Defaults: true }, parserType: 'json', postprocessMessage: ({ text }) => markdownPostprocessor(text), launcher: { @@ -141,6 +181,7 @@ initAgentWidget({ target: '#chat', config: { ...DEFAULT_WIDGET_CONFIG, + future: { v5Defaults: true }, apiUrl: 'https://api.runtype.com', clientToken: 'YOUR_CLIENT_TOKEN', parserType: 'json', @@ -151,24 +192,26 @@ initAgentWidget({ ## Config reference -| Property | Type | Notes | -| ---------------------------------------- | ----------------------------- | ----------------------------------------------------------------- | -| `target` | string \| HTMLElement | CSS selector or DOM element | -| `useShadowDom` | boolean | Style isolation (default false) | -| `config.apiUrl` | string | `https://api.runtype.com` (or another configured Runtype API URL) | -| `config.clientToken` | string | Browser-safe client token from `create_client_token` | -| `config.parserType` | `'json'` | Always `'json'` for Runtype streams | -| `config.postprocessMessage` | function | Use `markdownPostprocessor` for rich text | -| `config.launcher` | object | `{ enabled, title, subtitle, position }` | -| `config.colorScheme` | `'light' \| 'dark' \| 'auto'` | Theme mode | -| `config.theme` | `DeepPartial` | Light theme overrides | -| `config.darkTheme` | `DeepPartial` | Dark theme overrides | -| `config.sanitize` | `boolean \| (html) => string` | Sanitize rendered message HTML; default uses DOMPurify | -| `config.webmcp` | object | Widget-side WebMCP page-tool discovery/execution config | -| `config.features.askUserQuestion.expose` | boolean | Advertise built-in LOCAL `ask_user_question` via `clientTools[]` | -| `config.features.suggestReplies.expose` | boolean | Advertise built-in LOCAL `suggest_replies` via `clientTools[]` | -| `windowKey` | string | Stores handle on `window[windowKey]` for programmatic access | -| `onChatReady` | `(handle) => void` | Callback when the controller API is callable | +| Property | Type | Notes | +| ---------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| `target` | string \| HTMLElement | CSS selector or DOM element | +| `useShadowDom` | boolean | Style isolation (default false) | +| `config.apiUrl` | string | `https://api.runtype.com` (or another configured Runtype API URL) | +| `config.clientToken` | string | Browser-safe client token from `create_client_token` | +| `config.parserType` | `'json'` | Always `'json'` for Runtype streams | +| `config.postprocessMessage` | function | Use `markdownPostprocessor` for rich text | +| `config.launcher` | object | `{ enabled, title, subtitle, position }` | +| `config.colorScheme` | `'light' \| 'dark' \| 'auto'` | Theme mode | +| `config.future.v5Defaults` | boolean | Selects the V5 default styles; explicit options and theme tokens still win (default false) | +| `config.brand` | object | Coordinated `accent`, `neutral`, `font`, `radius`, `density`, `elevation`; see [V5 defaults and brand](#v5-defaults-and-brand) | +| `config.theme` | `DeepPartial` | Light theme overrides | +| `config.darkTheme` | `DeepPartial` | Dark theme overrides | +| `config.sanitize` | `boolean \| (html) => string` | Sanitize rendered message HTML; default uses DOMPurify | +| `config.webmcp` | object | Widget-side WebMCP page-tool discovery/execution config | +| `config.features.askUserQuestion.expose` | boolean | Advertise built-in LOCAL `ask_user_question` via `clientTools[]` | +| `config.features.suggestReplies.expose` | boolean | Advertise built-in LOCAL `suggest_replies` via `clientTools[]` | +| `windowKey` | string | Stores handle on `window[windowKey]` for programmatic access | +| `onChatReady` | `(handle) => void` | Callback when the controller API is callable | ## Programmatic access @@ -180,7 +223,7 @@ Three ways. Pick by context. ``` @@ -190,6 +233,7 @@ Three ways. Pick by context.