Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ui-porting-migration

БесплатноБез исполняемых скриптовНе проверен

This skill should be used when migrating an agent UI between protocols or SDKs — OpenAI Apps SDK to portable MCP Apps, mcp-ui legacy actions to the ui/*…

TheLobbiот TheLobbi★ 22 звезды на GitHub

Об этом скилле

Porting between agent-UI protocols

Most ports are mechanical if the app was built with an adapter, and a rewrite if it was not. Establish the adapter first, then port.

The adapter layer

Every host interaction goes through one module. Components never touch window.openai, app.*, or postMessage directly.

// bridge.ts — the only file that knows which protocol you are on
export interface HostBridge {
  onToolInput(cb: (input: unknown) => void): void;
  onToolResult(cb: (result: ToolResult) => void): void;
  callTool(name: string, args: unknown): Promise<ToolResult>;
  sendMessage(text: string): Promise<void>;
  updateModelContext(ctx: unknown): Promise<void>;
  openLink(url: string): Promise<void>;
  setSize(w: number, h: number): void;
  requestDisplayMode(mode: DisplayMode): Promise<DisplayMode>;
  getContext(): HostContext | undefined;
  capabilities(): Capabilities;
}

With this in place a port is: write a new HostBridge implementation, swap the import, adjust the server registration. Without it, every component is a migration site.

Building an app that must reach two protocols at once? Implement both and select at init by probing (app.getHostCapabilities(), then window.openai, then mcp-ui postMessage liveness).

1. OpenAI Apps SDK → portable MCP Apps

The most common port, and the cheapest — ChatGPT already implements MCP Apps, so this is de-risking, not rewriting.

Server

From To
_meta["openai/outputTemplate"] _meta.ui.resourceUri
_meta["openai/widgetCSP"] _meta.ui.csp
_meta["openai/widgetPrefersBorder"] _meta.ui.prefersBorder
_meta["openai/widgetDomain"] _meta.ui.domain
_meta["openai/visibility"] _meta.ui.visibility
_meta["openai/widgetAccessible"] _meta.ui.visibility: ["model","app"]
connect_domains / resource_domains / frame_domains connectDomains / resourceDomains / frameDomains
text/html+skybridge text/html;profile=mcp-app (RESOURCE_MIME_TYPE)

Keep the openai/* aliases alongside the standard fields during rollout — ChatGPT honors both, and dual-writing means no flag day.

View

From To
window.openai.toolInput app.ontoolinput
window.openai.toolOutput app.ontoolresult
window.openai.toolResponseMetadata app.ontoolresult → params._meta
window.openai.callTool(name, args) app.callServerTool({ name, arguments })
window.openai.sendFollowUpMessage({ prompt }) app.sendMessage({ … })
window.openai.requestDisplayMode(…) app.requestDisplayMode({ mode })
window.openai.notifyIntrinsicHeight(…) app.sendSizeChanged({ width, height })
window.openai.openExternal({ href }) app.openLink({ url })
window.openai.theme app.getHostContext()?.theme
window.openai.displayMode app.getHostContext()?.displayMode
window.openai.maxHeight app.getHostContext()?.viewport?.maxHeight
window.openai.safeArea app.getHostContext()?.safeAreaInsets
window.openai.locale app.getHostContext()?.locale
window.openai.userAgent app.getHostContext()?.userAgent

No standard equivalent — keep these feature-detected: requestCheckout, uploadFile, selectFiles, getFileDownloadUrl, requestModal, widgetState / setWidgetState.

For setWidgetState, the portable substitute is app.updateModelContext() for the model-visible slice. There is no portable durable-state mechanism — that slice moves to your server.

Order of operations

  1. Introduce the adapter; components stop touching window.openai.
  2. Dual-write server _meta (standard + aliases).
  3. Swap the View to the App class, keeping window.openai fallbacks for the six extension APIs.
  4. Verify in ChatGPT (nothing should change) and in basic-host (it should now work at all).
  5. Drop the aliases once no host you support needs them.

2. mcp-ui legacy actions → the ui/* bridge

From (mcp-ui) To (MCP Apps)
postMessage({type:'tool', payload:{toolName, params}}) app.callServerTool({ name, arguments })
postMessage({type:'prompt', payload:{prompt}}) app.sendMessage({ … })
postMessage({type:'link', payload:{url}}) app.openLink({ url })
postMessage({type:'intent', payload:{intent, params}}) No direct equivalent — map to a tool call, or keep on hosts that support it
postMessage({type:'notify', payload:{message}}) app.updateModelContext(…) or an app-only tool
ui-lifecycle-iframe-ready app.connect() / ui/initialize
ui-lifecycle-iframe-render-data ui/notifications/tool-input + host context
ui-message-received / ui-message-response JSON-RPC response to tools/call

intent is the one real loss. Its value was letting the host route a user-expressed intent without the View knowing the tool name. Replacements, in order of preference: a generic server-side handle_intent tool; or

Полный SKILL.md на GitHub

Установить ui-porting-migration в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл ui-porting-migration?

This skill should be used when migrating an agent UI between protocols or SDKs — OpenAI Apps SDK to portable MCP Apps, mcp-ui legacy actions to the ui/* bridge, MCP Apps to A2UI, adding AG-UI to an existing app, the adapter layer that makes ports cheap, and the field-by-field mapping tables.

Как установить скилл ui-porting-migration?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ui-porting-migration запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить ui-porting-migration с