assistant-ui

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Assistant UI

Assistant UI

Overview

概述

Use this skill to implement or debug assistant-ui integration end to end: CLI setup, runtime wiring, UI primitives, tool UI, and migration-safe upgrades. Load only the reference file needed for the current subtask to keep context focused.
使用此技能可端到端实现或调试assistant-ui集成:CLI设置、运行时集成、UI原语、工具UI以及可安全迁移的升级。仅加载当前子任务所需的参考文件,以保持上下文聚焦。

Workflow

工作流

  1. Classify the task before coding. Determine whether the request is setup, runtime wiring, primitives, tools, cloud persistence, or migration. If the request includes explicit exclusion language (
    without/no/not assistant-ui
    ), stop and do not use this skill.
  2. Select runtime and architecture first. Choose AI SDK, LangGraph, or external-store path before editing components.
  3. Apply setup commands with minimum blast radius. Prefer the smallest CLI operation (
    add
    for existing projects,
    create
    for new projects).
  4. Wire provider and thread lifecycle. Ensure
    AssistantRuntimeProvider
    and runtime hook are configured before Thread/Composer work.
  5. Implement tool UI using current APIs. Prefer
    useAui + Tools({ toolkit })
    for registration; use
    makeAssistantToolUI
    for UI-only bindings.
  6. Validate and migrate safely. Run dry-run upgrade checks first, then codemods, then verification.
  1. 编码前先对任务进行分类。 确定请求属于设置、运行时集成、原语、工具、云端持久化还是迁移类别。 如果请求包含明确的排除语言(
    without/no/not assistant-ui
    ),则停止操作,不要使用此技能。
  2. 先选择运行时和架构。 在编辑组件之前,选择AI SDK、LangGraph或外部存储路径。
  3. 使用影响范围最小的设置命令。 优先选择最小的CLI操作(现有项目用
    add
    ,新项目用
    create
    )。
  4. 集成提供程序和线程生命周期。 在进行Thread/Composer相关工作之前,确保已配置
    AssistantRuntimeProvider
    和运行时钩子。
  5. 使用当前API实现工具UI。 优先使用
    useAui + Tools({ toolkit })
    进行注册;对于仅UI绑定的场景,使用
    makeAssistantToolUI
  6. 安全验证与迁移。 先运行试运行升级检查,然后执行代码迁移工具(codemods),最后进行验证。

Runtime Decision Rules

运行时决策规则

  • Choose AI SDK runtime when backend communication is a chat endpoint and no graph thread state is required.
  • Choose LangGraph runtime when thread lifecycle (
    initialize/create/load
    ) and interrupts are required.
  • Choose external store runtime when app state is controlled outside assistant-ui.
  • Add Assistant Cloud only when persistence, auth-linked thread continuity, or multi-device resume is required.
Load
references/runtime-selection.md
for the matrix and expected outputs.
  • 当后端通信为聊天端点且不需要图线程状态时,选择AI SDK运行时。
  • 当需要线程生命周期(
    initialize/create/load
    )和中断功能时,选择LangGraph运行时。
  • 当应用状态由assistant-ui外部控制时,选择外部存储运行时。
  • 仅当需要持久化、与认证关联的线程连续性或多设备恢复功能时,才添加Assistant Cloud。
加载
references/runtime-selection.md
查看决策矩阵和预期输出。

Execution Protocol

执行协议

  1. Read
    references/setup-and-cli.md
    for command sequence and flags.
  2. Read exactly one runtime reference.
  • Read
    references/langgraph-runtime.md
    for LangGraph.
  • Read
    references/runtime-selection.md
    for AI SDK or external-store decisions.
  1. Read
    references/tool-ui-patterns.md
    only if tools are in scope.
  2. Read
    references/cloud-persistence.md
    only if cloud is in scope.
  3. Read
    references/troubleshooting.md
    only when failures appear.
  1. 阅读
    references/setup-and-cli.md
    了解命令序列和参数。
  2. 仅阅读一个运行时参考文件。
  • 若使用LangGraph,阅读
    references/langgraph-runtime.md
  • 若选择AI SDK或外部存储,阅读
    references/runtime-selection.md
  1. 仅当工具在任务范围内时,阅读
    references/tool-ui-patterns.md
  2. 仅当云端功能在任务范围内时,阅读
    references/cloud-persistence.md
  3. 仅当出现故障时,阅读
    references/troubleshooting.md

Output Contract

输出合约

When implementing assistant-ui tasks, deliver these artifacts unless the user scope explicitly excludes them:
  • Runtime provider wiring that matches the chosen runtime.
  • Thread and composer integration that compiles with the chosen runtime.
  • Tool registration and rendering behavior consistent with current APIs.
  • Environment variable expectations for cloud flows.
  • Upgrade path or migration notes if dependency upgrades are requested.
在实现assistant-ui任务时,除非用户明确排除,否则需交付以下成果:
  • 与所选运行时匹配的运行时提供程序集成代码。
  • 与所选运行时兼容的Thread和Composer集成代码。
  • 符合当前API的工具注册与渲染逻辑。
  • 云端流程所需的环境变量说明。
  • 若请求依赖项升级,需提供升级路径或迁移说明。

Guardrails

防护措施

  • Prefer
    Tools({ toolkit })
    over legacy registration helpers.
  • Use
    makeAssistantToolUI
    only for UI bindings to already-defined backend tools.
  • Keep LangGraph thread handling explicit:
    initialize
    ,
    create
    , and
    load
    .
  • Execute upgrade sequence in this order:
    update --dry
    ->
    upgrade
    ->
    codemod
    -> test.
  • Avoid broad documentation dumps; load only relevant references.
  • Do not activate this workflow for comparison-only requests that do not require assistant-ui implementation changes.
  • 优先使用
    Tools({ toolkit })
    而非旧版注册助手。
  • 仅在为已定义的后端工具绑定UI时使用
    makeAssistantToolUI
  • 明确处理LangGraph线程:
    initialize
    create
    load
  • 按以下顺序执行升级流程:
    update --dry
    ->
    upgrade
    ->
    codemod
    -> 测试。
  • 避免大量输出文档;仅加载相关参考文件。
  • 对于仅需对比、无需修改assistant-ui实现的请求,不要激活此工作流。

Reference Map

参考地图

  • Setup and CLI:
    references/setup-and-cli.md
  • Runtime selection:
    references/runtime-selection.md
  • LangGraph runtime wiring:
    references/langgraph-runtime.md
  • Tool UI patterns:
    references/tool-ui-patterns.md
  • Cloud persistence:
    references/cloud-persistence.md
  • Debug and recovery:
    references/troubleshooting.md
  • 设置与CLI:
    references/setup-and-cli.md
  • 运行时选择:
    references/runtime-selection.md
  • LangGraph运行时集成:
    references/langgraph-runtime.md
  • 工具UI模式:
    references/tool-ui-patterns.md
  • 云端持久化:
    references/cloud-persistence.md
  • 调试与恢复:
    references/troubleshooting.md