lov-integrate-agent-uiux
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent 对话界面 · Agent Chat UI
Agent 对话界面 · Agent Chat UI
Integrate a production-shaped Agent conversation surface into an existing app.
The deliverable includes a normalized transcript contract, accessible UI
components, target-stack adapters, and a verification report.
将面向生产环境的 Agent 对话界面集成到现有应用中。
交付内容包括标准化对话记录契约、无障碍 UI
组件、目标技术栈适配器和验证报告。
Triggers
触发条件
Activate when
启用条件
- 用户说“参考这个 AI 聊天记录,帮我接入一套 Agent 对话 UI 组件”。
- 用户说“把工具调用、运行状态、Markdown 和输入框整合进现有 App”。
- The user asks to “integrate agent chat UI” or “build reusable AI conversation components”.
- 用户说“参考这个 AI 聊天记录,帮我接入一套 Agent 对话 UI 组件”。
- 用户说“把工具调用、运行状态、Markdown 和输入框整合进现有 App”。
- 用户要求“integrate agent chat UI”或“build reusable AI conversation components”。
Do not activate when
不应启用的条件
- 只生成整套新应用外壳;使用 app generator 能力,并将本 Skill 作为可选下游。
- 只修手机端溢出、安全区或响应式布局;使用 mobile adaptation 能力。
- 只连接模型 API、鉴权或计费且不需要对话显示;使用对应 LLM integration 能力。
- 只做视觉重绘、不需要 Agent 消息语义和状态契约;使用 frontend design 能力。
- 只生成整套新应用外壳;使用 app generator 能力,并将本 Skill 作为可选下游。
- 只修复手机端溢出、安全区或响应式布局;使用 mobile adaptation 能力。
- 只连接模型 API、鉴权或计费且不需要对话显示;使用对应的 LLM integration 能力。
- 只做视觉重绘、不需要 Agent 消息语义和状态契约;使用 frontend design 能力。
User Profile (cross-session)
用户 Profile(跨会话)
Read on every invocation. Resolve user, brand, workspace, shared
preferences, and records without copying
personal values into this portable source. Persist only direct durable user
statements through , then report the saved Profile path.
See .
skill.yamlskills.lov-integrate-agent-uiuxscripts/profile_store.pyreferences/user-profile.md每次调用时都要读取 。解析用户、品牌、工作区、共享偏好以及
记录,但不要将个人值复制到此可移植源文件中。
仅通过 持久保存用户直接陈述的持久信息,然后报告已保存的 Profile 路径。
参见 。
skill.yamlskills.lov-integrate-agent-uiuxscripts/profile_store.pyreferences/user-profile.mdSkill Group Composition
Skill 组构成
Read before composing adjacent capabilities.
Sibling Skills are optional artifact handoffs and never hidden dependencies.
references/skill-composition.md在组合相邻能力之前,读取 。
同级 Skill 是可选的产物交接,不是隐藏依赖。
references/skill-composition.mdRequired resources
必需资源
Resolve from the active Skill context, then verify:
SKILL_DIR$SKILL_DIR/scripts/agent_uiux.py$SKILL_DIR/assets/common$SKILL_DIR/assets/react-native$SKILL_DIR/assets/react$SKILL_DIR/references/integration-contract.md$SKILL_DIR/references/yoda-mobile-patterns.md$SKILL_DIR/references/acceptance-checklist.md
从当前 Skill 上下文解析 ,然后验证:
SKILL_DIR$SKILL_DIR/scripts/agent_uiux.py$SKILL_DIR/assets/common$SKILL_DIR/assets/react-native$SKILL_DIR/assets/react$SKILL_DIR/references/integration-contract.md$SKILL_DIR/references/yoda-mobile-patterns.md$SKILL_DIR/references/acceptance-checklist.md
Workflow (MANDATORY)
工作流(强制执行)
Step 0: Read context and protect the target
第 0 步:读取上下文并保护目标
- Read repository instructions, current working tree state, package manifest, UI conventions, existing chat components, and supported platforms.
- Read the shared Profile using when a Profile is configured.
scripts/profile_store.py read --skill-id lov-integrate-agent-uiux --pretty - Preserve unrelated edits. Do not overwrite an occupied component directory unless the user explicitly authorizes replacement and the old files are backed up.
- Read and
references/integration-contract.mdbefore designing the adapter.references/yoda-mobile-patterns.md
- 读取仓库说明、当前工作树状态、包清单、UI 规范、现有聊天组件和受支持的平台。
- 配置了 Profile 时,使用 读取共享 Profile。
scripts/profile_store.py read --skill-id lov-integrate-agent-uiux --pretty - 保留无关的修改。除非用户明确授权替换并已备份旧文件,否则不得覆盖已被占用的组件目录。
- 在设计适配器之前,读取 和
references/integration-contract.md。references/yoda-mobile-patterns.md
Step 1: Audit the host application
第 1 步:审计宿主应用
Run the deterministic audit:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" audit <project-path> --format jsonConfirm the detected stack, source root, package manager, existing design tokens,
message data source, send/retry contract, realtime mechanism, and test commands.
If the stack is not React Native/Expo or React Web, use the neutral contract as
the implementation source and state that the bundled scaffold is unavailable.
运行确定性审计:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" audit <project-path> --format json确认检测到的技术栈、源代码根目录、包管理器、现有 design tokens、消息数据源、
发送/重试契约、实时通信机制和测试命令。
如果技术栈不是 React Native/Expo 或 React Web,则使用中性契约作为实现依据,
并说明随附的脚手架不可用。
Step 2: Map real data to the normalized contract
第 2 步:将真实数据映射到标准化契约
Create one adapter from the host's transport/domain objects to ,
, , and . Keep API calls,
SSE/WebSocket/polling, persistence, and provider-specific fields outside the UI
components. Preserve stable message and tool-call IDs.
AgentMessageAgentSessionStateAgentAttachmentPendingInteractionRequired semantic coverage:
- user, assistant, tool, and status roles;
- commentary versus final assistant phases;
- running, completed, and failed tool states;
- Markdown, plain text, and code;
- pending choice, confirmation, or text interactions;
- session working, waiting, error, completed, and idle states;
- idempotent send/retry identity and preserved composer draft on failure.
创建一个适配器,将宿主应用的传输层/领域对象映射到 、
、 和 。将 API 调用、
SSE/WebSocket/polling、持久化以及 provider 专属字段保留在 UI 组件之外。
保持消息和工具调用 ID 稳定。
AgentMessageAgentSessionStateAgentAttachmentPendingInteraction必须覆盖以下语义:
- 、
user、assistant和tool角色;status - 与最终
commentary阶段;assistant - 、
running和completed工具状态;failed - Markdown、纯文本和代码;
- 待处理的选择、确认或文本交互;
- 会话的 、
working、waiting、error和completed状态;idle - 幂等的发送/重试标识,并在失败时保留输入区草稿。
Step 3: Scaffold the target-stack components
第 3 步:为目标技术栈生成组件脚手架
Preview first:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" scaffold <project-path> --dry-runThen scaffold into the detected source tree:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" scaffold <project-path>Use or only to override a wrong detection.
Use to follow an established component layout.
The command refuses occupied targets; do not use without explicit user
authorization. Import files directly from their source modules rather than
adding a re-export barrel when the host forbids re-exports.
--stack react-native--stack react--component-dir <relative-path>--force先进行预览:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" scaffold <project-path> --dry-run然后将脚手架生成到检测到的源代码目录中:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" scaffold <project-path>仅在检测结果错误时,使用 或 覆盖检测值。
使用 遵循既有的组件目录布局。
该命令会拒绝写入已被占用的目标;未经用户明确授权,不得使用 。
如果宿主应用禁止 re-export,应直接从源模块导入文件,而不是添加 re-export barrel。
--stack react-native--stack react--component-dir <relative-path>--forceStep 4: Integrate into the real screen
第 4 步:集成到实际界面
- Bind normalized messages, session state, pending interaction, draft, and send
callback to .
AgentConversation - Map host design tokens into ; do not hard-code product branding.
AgentUiTheme - Keep the newest content visible only while the user is already near the end; expose a jump-to-latest control otherwise.
- Group adjacent tool events and keep tool details collapsed by default.
- Keep input editable and preserved across recoverable send failures. Surface a copyable request/context ID in diagnostics without exposing secrets.
- Add loading, empty, offline, waiting, error, disabled, and long-content states.
- Preserve keyboard, safe-area, screen-reader, reduced-motion, localization, and minimum touch-target behavior of the host platform.
- 将标准化消息、会话状态、待处理交互、草稿和发送回调绑定到 。
AgentConversation - 将宿主应用的 design tokens 映射到 ;不要硬编码产品品牌。
AgentUiTheme - 仅当用户已经接近末尾时,才保持最新内容可见;否则提供跳转到最新消息的控件。
- 对相邻的工具事件进行分组,并默认折叠工具详情。
- 保持输入框可编辑,并在可恢复的发送失败后保留输入内容。在诊断信息中提供可复制的请求/上下文 ID,但不得暴露密钥。
- 添加加载、空、离线、等待、错误、禁用和长内容状态。
- 保留宿主平台对键盘、安全区、屏幕阅读器、减少动效、本地化和最小触控目标的行为支持。
Step 5: Verify the integrated result
第 5 步:验证集成结果
Run the structural verifier:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" verify <project-path>Then run the host's format, lint, typecheck, tests, and build commands. Exercise
the smallest real end-to-end conversation covering user text, assistant Markdown,
a running then completed tool group, a pending interaction, send failure/retry,
and a final response. For native mobile changes, follow the host repository's
real-device requirement; a static build is not device verification.
Apply every item in . Record the real input,
minimum prompt, output paths, commands, and observed evidence in the task result.
Do not invent screenshots, scores, latency wins, or device proof.
references/acceptance-checklist.md运行结构验证器:
bash
python3 "$SKILL_DIR/scripts/agent_uiux.py" verify <project-path>然后执行宿主应用的格式化、lint、typecheck、测试和构建命令。
至少演练一次规模最小但真实的端到端对话,覆盖用户文本、assistant Markdown、
先处于 后变为 的工具组、待处理交互、发送失败/重试以及最终回复。
对于原生移动端更改,遵循宿主仓库的真机要求;静态构建不等同于真机验证。
runningcompleted逐项落实 中的要求。在任务结果中记录真实输入、
最小提示词、输出路径、命令和观察到的证据。
不要虚构截图、评分、延迟收益或真机证明。
references/acceptance-checklist.mdOutput contract
输出契约
Return:
- the detected stack and normalized data mapping;
- created or changed component and adapter paths;
- supported conversation states and any consciously deferred state;
- structural verification plus host test/build/runtime evidence;
- remaining gaps, especially realtime, device, accessibility, or provider limits.
返回:
- 检测到的技术栈和标准化数据映射;
- 已创建或修改的组件和适配器路径;
- 支持的会话状态以及有意暂缓的状态;
- 结构验证结果,以及宿主测试/构建/运行时证据;
- 剩余缺口,尤其是实时通信、真机、无障碍或 provider 限制。
Dependencies
依赖项
- Skill runtime: Python 3.8+; PyYAML only for validating the Skill itself.
- React Native scaffold: ,
react; Expo is supported but optional.react-native - React Web scaffold: ,
react; no UI or Markdown package is required.react-dom - Host-specific icons, animation, Markdown, transport, and state libraries remain optional.
- Skill 运行时:Python 3.8+;仅在验证 Skill 本身时需要 PyYAML。
- React Native 脚手架:、
react;支持 Expo,但为可选项。react-native - React Web 脚手架:、
react;不需要 UI 或 Markdown 包。react-dom - 宿主专属的图标、动画、Markdown、传输和状态库仍为可选项。