Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

feat: improve modular A2UI integration

jack_ricky441c2186c5f5
diff --git a/docs/en/A2UI.md b/docs/en/A2UI.md
new file mode 100644
index 0000000000..c5ba6cd46d
--- /dev/null
+++ b/docs/en/A2UI.md
@@ -0,0 +1,85 @@
+# A2UI Generated UI
+
+A2UI is an optional generated UI capability in JiuwenSwarm, natively supported only by the Web channel. It lets an agent return standardized UI messages for forms, confirmations, structured details, comparisons, and similar workflows, then lets the Web frontend render those messages as interactive components.
+
+## Module Location
+
+Backend A2UI code lives under `jiuwenswarm/server/runtime/a2ui/`. The capability belongs to the AgentServer runtime response path and is not a top-level shared package under `jiuwenswarm/`.
+
+Frontend rendering code lives under `jiuwenswarm/channels/web/frontend/src/features/a2ui/`. The Web frontend only enters A2UI code when rendering assistant messages or sending interaction events.
+
+## Relationships
+
+| Module | Integration point | Responsibility |
+| --- | --- | --- |
+| `server/runtime/a2ui` | Backend A2UI implementation | Config parsing, Web channel policy, protocol prompts, response parsing, schema validation, repair/finalization |
+| `agents/harness/common/rails` | Response prompt rail | Inject the A2UI runtime prompt only for Web channel requests when enabled; remove it for non-Web channels or when disabled |
+| `server/runtime/agent_adapter` | Agent input/output adapter | Convert A2UI client events into model-readable prompts and finalize complete assistant responses only for the Web channel |
+| `gateway/message_handler` | Message output path | Keep a compatibility hook; non-Web channels do not run A2UI fallback or renderer logic |
+| `gateway/channel_manager/web` | Web config API | Expose the A2UI top-level toggle without exposing protocol internals |
+| `channels/web/frontend/src/features/a2ui` | Web A2UI feature | Parse `<a2ui-json>` blocks, register renderers, render components, wrap action events, fill visible choice defaults |
+| `channels/web/frontend/src/hooks/useWebSocket.ts` | Generic transport hook | Provide `sendStructuredChatContent` without importing A2UI feature code |
+
+## End-To-End Flow
+
+1. A Web user sends a natural-language message.
+2. The Agent prompt rail injects the A2UI runtime prompt when the request is from the Web channel and A2UI is enabled.
+3. The model may return normal text plus a `<a2ui-json>...</a2ui-json>` block for suitable UI workflows.
+4. The AgentServer finalizer validates the complete assistant response and invokes the repair prompt when needed.
+5. The Web frontend parses the A2UI block from the assistant message and renders components.
+6. When the user clicks a button or submits a form, the frontend wraps the A2UI client event as structured chat content.
+7. The backend converts the event into a model-readable prompt for the Web channel and continues the conversation.
+
+Non-Web channels do not enter this A2UI path: no A2UI prompt injection, no A2UI client-event prompt conversion, no A2UI response finalization, and no A2UI text fallback. They continue to use the normal text/Markdown conversation path.
+
+## Configuration
+
+Default configuration lives in `jiuwenswarm/resources/config.yaml`:
+
+```yaml
+a2ui:
+ enabled: true
+ protocol_version: "0.8"
+ stream_validation_enabled: true
+ non_web_fallback_enabled: false
+```
+
+A2UI can be controlled through:
+
+- Web config panel: the `A2UI` top-level toggle.
+- User workspace config: `a2ui.enabled` in `config.yaml`.
+- Environment variable: `JIUWENSWARM_A2UI_ENABLED=false` or `true`.
+
+`non_web_fallback_enabled` is kept only for compatibility with older configs. A2UI is currently Web-only, so non-Web channels always bypass A2UI.
+
+Legacy `JIUWENCLAW_A2UI_*` environment variables are not supported after this PR update on June 4, 2026. Use the `JIUWENSWARM_A2UI_*` prefix for all A2UI runtime overrides.
+
+## Dependency Versioning
+
+The backend SDK dependency is pinned as `a2ui-agent-sdk==0.2.1` for repeatable builds. Upgrades should update the dependency lock, rerun protocol validation tests, and verify the Web renderer build in the same change.
+
+## Boundary Rules
+
+- A2UI is optional. Disabling it, or failing to read its config, must not break the normal text/Markdown path.
+- A2UI channel support is centralized in `jiuwenswarm.server.runtime.a2ui.integration.is_a2ui_channel`; currently only `web` returns true.
+- Backend host code should call only the thin `jiuwenswarm.server.runtime.a2ui.integration` facade, not protocol, repair, or schema internals.
+- The WebSocket hook stays generic and must not import A2UI types or renderers.
+- Web A2UI logic stays under `channels/web/frontend/src/features/a2ui/` instead of spreading into generic components or transport code.
+- Non-Web channels do not perceive A2UI and do not need renderer, schema, client-event, or fallback knowledge.
+
+## Test Coverage
+
+Related tests live in:
+
+- `tests/unit_tests/a2ui/`
+- `tests/system_tests/test_a2ui_system_flow.py`
+- `jiuwenswarm/channels/web/frontend/scripts/test-a2ui-action-defaults.mjs`
+
+Common verification commands:
+
+```powershell
+uv run pytest tests/unit_tests/a2ui tests/system_tests/test_a2ui_system_flow.py -q
+cd jiuwenswarm\channels\web\frontend
+npm run build
+node scripts/test-a2ui-action-defaults.mjs
+```
diff --git a/docs/en/SUMMARY.md b/docs/en/SUMMARY.md
index 9adf51ab4c..b4df340070 100644
--- a/docs/en/SUMMARY.md
+++ b/docs/en/SUMMARY.md
@@ -6,6 +6,7 @@
- [Page overview (web UI)](Page-Overview.md)
- [E2A protocol (Gateway↔Agent)](E2A-protocol.md)
- [A2A integration](A2A.md)
+- [A2UI generated UI](A2UI.md)
- [Configuration](Configuration.md)
- [Distributed Team](DistributedTeam.md)
- [Multi-Instance](MultiInstance.md)
@@ -36,4 +37,4 @@
- [Development practices](development-practices/README.md)
- [Daily report generator practice](development-practices/JiuwenSwarm-Daily-Report-Generator.md)
- [Code review assistant practice](development-practices/JiuwenSwarm-Code-Review-Assistant.md)
-- [Linux NFS Shared Filesystem](../linux-agent-teams-shared-filesystem.md)
\ No newline at end of file
+- [Linux NFS Shared Filesystem](../linux-agent-teams-shared-filesystem.md)
diff --git a/docs/zh/A2UI-IM-channel-analysis.md b/docs/zh/A2UI-IM-channel-analysis.md
new file mode 100644
index 0000000000..396c99a5b0
--- /dev/null
+++ b/docs/zh/A2UI-IM-channel-analysis.md
@@ -0,0 +1,122 @@
+# A2UI 支持 IM Channel 的可行性分析
+
+## 背景
+
+JiuwenSwarm 的 A2UI 是 Web-only 的生成式界面能力。Web channel 具备受控前端运行时:可以解析 `<a2ui-json>` block、通过 `@a2ui/react` 渲染组件、维护 surface/data model/component state,并把点击、选择、表单提交等交互包装为 `a2ui.client_event` 发回后端。
+
+非 Web channel 不进入 A2UI 链路:不注入 A2UI prompt,不处理 A2UI client event,不执行 A2UI response finalizer,也不做 A2UI 文本 fallback。微信、飞书等 IM channel 继续走普通文本/Markdown 对话流程。
+
+A2UI 的完整闭环不是“后端生成 JSON”这么简单,而是:
+
+1. 后端生成并校验 A2UI 0.8 server-to-client message list。
+2. 客户端解析 A2UI 消息。
+3. 客户端维护 surface/data model/component state。
+4. 客户端渲染可交互 UI。
+5. 客户端把用户交互转换为标准 `a2ui.client_event`。
+6. 后端把 `a2ui.client_event` 转为模型可读 prompt,进入下一轮对话。
+
+Web channel 具备上述完整客户端能力;IM channel 当前只具备平台消息收发能力。
+
+## 1. 把 Web A2UI Renderer 搬到 IM Channel 是否可行
+
+结论:工程上“局部可行”,产品上“不建议作为 IM channel 的主方案”。
+
+| 方案 | 可行性 | 说明 |
+| --- | --- | --- |
+| 把 `@a2ui/react` renderer 原样运行在微信/飞书客户端内 | 基本不可行 | 微信、飞书原生聊天窗口不会执行 JiuwenSwarm 自带 React bundle,也不会开放任意 DOM/JS 渲染能力。 |
+| 服务端把 A2UI 渲染成图片或 HTML 链接再发到 IM | 局部可行 | 可做只读展示,但交互能力弱;点击、输入、组件状态回传仍要走平台能力或跳转 Web。 |
+| 把 A2UI 语义映射为 IM 平台原生卡片/消息 | 可行但不是搬 renderer | 需要为飞书、微信分别写 adapter,将 A2UI 组件转换成飞书卡片、微信文本/图文/可用消息形态。 |
+
+### Web Renderer 原样迁移的障碍
+
+Web A2UI renderer 依赖浏览器运行环境:
+
+- React 组件树、DOM、CSS、事件系统。
+- `@a2ui/react` 的 surface 状态管理。
+- 客户端主动调用 `processMessages` 处理 A2UI message list。
+- action bridge 把用户操作转换成结构化 `a2ui.client_event`。
+- WebSocket hook 把结构化 content 发送回后端。
+
+IM 客户端不是 JiuwenSwarm 可控的浏览器容器。飞书、微信聊天窗口只渲染平台定义的消息类型,例如文本、图片、文件、音视频、飞书 interactive card、微信/iLink 文本 item 等。它们不会加载 JiuwenSwarm Web 前端,也不会执行 `@a2ui/react`。
+
+所以,“把 Web A2UI renderer 搬到 IM channel”如果指原样复用 React renderer,本质上需要 IM 客户端提供一个可嵌入 Web runtime 的宿主,并允许 JiuwenSwarm 控制渲染和事件回传。普通聊天消息不满足这个条件。
+
+### 优势
+
+如果强行做某种“Web renderer in IM”的方案,理论收益包括:
+
+- 协议复用度最高:继续使用 A2UI 0.8,不需要为每个 IM 平台重新定义 UI 语义。
+- 展示一致性最好:Web、飞书、微信看到的理论 UI 可以保持一致。
+- 组件能力完整:表单、多选、卡片、数据模型、组件状态、action context 都可按 A2UI 原语运行。
+- 后端链路改动较小:后端仍只产出 A2UI block,客户端承担渲染。
+
+这些收益依赖一个前提:IM 客户端必须能运行 JiuwenSwarm 控制的前端 runtime。现实中这个前提通常不成立。
+
+### 劣势
+
+- 无法控制 IM 客户端渲染环境。微信、飞书聊天窗口不是通用浏览器,不会执行任意 React bundle。
+- 无法保证组件事件回传。A2UI 的关键价值在交互,而不是静态展示;没有事件回传就不是完整 A2UI。
+- 平台安全模型不允许任意脚本。IM 平台通常会限制消息中的 HTML/JS,避免钓鱼、注入和隐私风险。
+- 体验会割裂。如果用链接跳转 Web 页面承载 A2UI,用户实际离开 IM 对话上下文,回传身份、会话、授权也要重新处理。
+- 维护成本高。每个 IM 平台的卡片、按钮、表单、回调、消息长度、频控、撤回、更新机制都不同,难以用 Web renderer 直接覆盖。
+
+### 风险点
+
+| 风险 | 影响 |
+| --- | --- |
+| 平台能力不一致 | 飞书支持 interactive card 和 card action;微信/iLink 当前更偏文本消息。 |
+| 交互状态难同步 | A2UI surface/data model 状态需要客户端维护;IM 平台消息通常是一次性消息或平台卡片状态。 |
+| 事件回传不标准 | A2UI 期望 `a2ui.client_event`;IM 平台回调字段、鉴权、用户身份、消息 ID 都各不相同。 |
+| 消息更新能力有限 | A2UI 可以持续更新 surface;IM 平台对消息编辑、卡片更新、撤回、局部刷新支持不同。 |
+| 流式输出冲突 | A2UI block 需要完整校验后渲染;IM channel 当前常做流式文本聚合、分片、限流。 |
+| 安全与权限边界扩大 | 卡片 action、链接跳转、用户身份映射、跨平台回调都可能引入权限绕过或伪造交互风险。 |
+| 降级路径复杂 | 当平台卡片发送失败、客户端版本不支持、回调失败时,必须回退到文本交互。 |
+
+## 2. 是否需要微信、飞书等 IM 客户端支持或修改
+
+如果目标是“完整支持 A2UI”,需要 IM 客户端支持。这里的“客户端支持”不一定是修改微信/飞书官方客户端源码,这通常不现实;但必须满足以下任一条件:
+
+1. IM 官方客户端原生支持足够表达 A2UI 的消息组件和交互回调。
+2. IM 平台允许在消息中嵌入 JiuwenSwarm 可控的 WebView/小程序/应用页面,并能可靠回传事件。
+3. JiuwenSwarm 提供独立 companion Web 页面,IM 消息只负责打开链接,交互在 Web 页面完成。
+
+否则,IM channel 只能发送文本、图片、文件或平台有限卡片,不能承载完整 A2UI renderer。
+
+### 为什么必须有客户端支持
+
+A2UI 的核心在客户端,而不是消息文本。
+
+后端可以把 A2UI JSON 发给任何 channel,但如果客户端不理解这些 JSON,它只能显示一段原始文本,或者服务端需要做降级摘要。完整 A2UI 至少要求客户端具备:
+
+- 协议解析:识别 `beginRendering`、`surfaceUpdate`、`dataModelUpdate`、`deleteSurface`。
+- 状态管理:维护 surface、component tree、data model。
+- 组件渲染:把 TextField、MultipleChoice、Button、Card/List 等组件渲染成可操作 UI。
+- 事件采集:捕获点击、选择、输入、提交。
+- 事件回传:把交互转换成 `a2ui.client_event`,带上 action context、surfaceId、componentId。
+- 会话绑定:保证事件回到正确 channel、session、message/request。
+
+这些能力都发生在用户使用的客户端侧。服务器无法通过普通 IM 文本消息替用户完成输入控件、按钮状态、组件事件这些交互语义。
+
+## 不建议非 Web Channel 支持完整 A2UI 的逻辑
+
+不建议把“完整 A2UI”扩展到 IM channel,原因不是后端做不到,而是产品边界和平台边界不匹配。
+
+1. A2UI 是客户端渲染协议,Web 是受控客户端,IM 是第三方客户端。
+2. IM 平台支持的是“平台消息组件”,不是通用 UI runtime。
+3. 各 IM 平台能力差异太大,统一体验成本很高。
+4. A2UI 交互闭环容易在 IM 的群聊、转发、引用、多端登录、卡片过期、回调重试等场景中失真。
+5. Web-only 边界更清晰:非 Web channel 不感知 A2UI,普通聊天流程不受影响。
+
+## 建议结论
+
+不建议把 Web A2UI renderer 搬到 IM channel,也不建议把“完整 A2UI 支持”作为微信、飞书等非 Web channel 的统一目标。
+
+建议采用以下边界:
+
+1. Web channel:继续作为完整 A2UI renderer 的唯一一等支持端。
+2. Feishu channel:保持普通文本/Markdown 流程;如果未来要做平台卡片,应作为独立 Feishu card adapter 设计,不宣称完整 A2UI。
+3. WeChat channel:保持普通文本/Markdown 流程;可增强为编号选择、确认/取消、字段模板回复等“结构化文本交互”,不宣称完整 A2UI。
+4. 其他 IM channel:默认不感知 A2UI;只有当平台原生组件和回调能力足够成熟时,再按平台 adapter 模式局部支持。
+5. 如确需完整 A2UI:在 IM 内发送链接,跳转 JiuwenSwarm Web companion 页面完成交互;IM channel 只承担通知和入口。
+
+这个方向能保留 A2UI 的核心价值,同时避免把第三方 IM 客户端当作可控 Web runtime 使用。
diff --git a/docs/zh/A2UI-web-only-pr-record.md b/docs/zh/A2UI-web-only-pr-record.md
new file mode 100644
index 0000000000..28d794a802
--- /dev/null
+++ b/docs/zh/A2UI-web-only-pr-record.md
@@ -0,0 +1,40 @@
+# A2UI Web-only PR 记录
+
+## 背景
+
+A2UI 的完整能力依赖 Web 前端 renderer、浏览器状态管理和 `a2ui.client_event` 回传。微信、飞书等 IM channel 当前不是 JiuwenSwarm 可控的 Web runtime,因此不应感知 A2UI,也不应承担 A2UI fallback 逻辑。
+
+## 本次变更
+
+- 保持 Web channel 的 A2UI 支持、特性和配置入口不变。
+- 将 A2UI channel 策略集中到 `jiuwenswarm.server.runtime.a2ui.integration.is_a2ui_channel`,当前只有 `web` 支持。
+- 非 Web channel 直接 bypass A2UI:
+ - 不注入 A2UI prompt。
+ - 不把 A2UI client event 转成模型 prompt。
+ - 不执行 A2UI response finalizer。
+ - 不做 A2UI 文本 fallback。
+- 保留 gateway 侧兼容 hook 和 `non_web_fallback_enabled` 旧配置字段,但默认值改为 `false`,当前实现不再使用非 Web fallback。
+- 更新中英文 A2UI 文档和 IM channel 可行性分析,明确 Web-only 边界。
+
+## 测试记录
+
+已覆盖的关键行为:
+
+- `is_a2ui_channel` 只允许 `web`。
+- 非 Web A2UI client event 返回 `None`,进入普通 prompt 流程。
+- 非 Web assistant response 不触发 config lookup、validation 或 repair。
+- 非 Web 出站 payload 保持原样,不执行 fallback。
+- response prompt rail 仅在 Web channel 注入 A2UI prompt。
+
+验证命令:
+
+```powershell
+uv run pytest tests/unit_tests/a2ui/test_integration_bridge.py tests/unit_tests/a2ui/test_web_only_prompt_rail.py tests/unit_tests/a2ui/test_feature_config.py -q
+```
+
+结果:`18 passed`。
+
+## 后续建议
+
+- 如果未来需要飞书卡片或微信结构化文本,应按平台 adapter 独立设计,不复用 Web A2UI renderer,也不把它定义为完整 A2UI。
+- 如果 IM 需要完整 A2UI 体验,应通过 Web companion 页面承载交互,IM 只作为通知和入口。
diff --git a/docs/zh/A2UI.md b/docs/zh/A2UI.md
new file mode 100644
index 0000000000..a07bfc97fa
--- /dev/null
+++ b/docs/zh/A2UI.md
@@ -0,0 +1,85 @@
+# A2UI 生成式界面
+
+A2UI 是 JiuwenSwarm 的可选生成式界面能力,目前仅 Web channel 原生支持。它让 Agent 在适合表单、确认、结构化详情、多结果比较等场景时输出标准化 UI 消息,由 Web 前端渲染为可交互组件。
+
+## 模块位置
+
+后端 A2UI 代码位于 `jiuwenswarm/server/runtime/a2ui/`。该能力依附 AgentServer 的运行时响应链路,不作为 `jiuwenswarm/` 顶层通用模块存在。
+
+前端渲染代码位于 `jiuwenswarm/channels/web/frontend/src/features/a2ui/`。Web 前端只在渲染 assistant message 和发送交互事件时接入 A2UI。
+
+## 与主模块的关系
+
+| 模块 | 接入点 | 责任 |
+| --- | --- | --- |
+| `server/runtime/a2ui` | A2UI 后端实现 | 配置解析、Web channel 策略、协议 prompt、响应解析、schema 校验、repair/finalization |
+| `agents/harness/common/rails` | response prompt rail | Web channel 且功能开启时注入 A2UI runtime prompt;非 Web channel 或关闭时移除 |
+| `server/runtime/agent_adapter` | Agent 输入输出适配 | Web channel 将 A2UI client event 转换为模型可读 prompt,并在完整 assistant response 返回前执行 finalizer |
+| `gateway/message_handler` | 消息出口 | 保留兼容 hook;非 Web channel 不执行 A2UI fallback 或 renderer 逻辑 |
+| `gateway/channel_manager/web` | Web 配置 API | 暴露 A2UI 总开关,不暴露协议内部参数 |
+| `channels/web/frontend/src/features/a2ui` | Web A2UI feature | 解析 `<a2ui-json>` block、注册 renderer、渲染组件、包装 action event、补齐 choice 默认值 |
+| `channels/web/frontend/src/hooks/useWebSocket.ts` | 通用传输 hook | 仅提供 `sendStructuredChatContent`,不导入 A2UI feature 代码 |
+
+## 端到端链路
+
+1. Web 用户发送自然语言消息。
+2. Agent prompt rail 在 Web channel 且 A2UI 开启时注入 A2UI runtime prompt。
+3. 模型在适合场景输出文本和 `<a2ui-json>...</a2ui-json>` block。
+4. AgentServer finalizer 校验完整 assistant response;必要时调用 repair prompt 修复。
+5. Web 前端解析 assistant message 中的 A2UI block 并渲染组件。
+6. 用户点击按钮或提交表单时,前端把 A2UI client event 包装为结构化 chat content。
+7. 后端在 Web channel 把该事件转换为模型可读 prompt,进入下一轮对话。
+
+非 Web channel 不进入上述 A2UI 链路:不注入 A2UI prompt,不把结构化 A2UI client event 转换为模型 prompt,不执行 A2UI response finalizer,也不做 A2UI 文本 fallback。它们继续走普通文本/Markdown 对话流程。
+
+## 配置
+
+默认配置位于 `jiuwenswarm/resources/config.yaml`:
+
+```yaml
+a2ui:
+ enabled: true
+ protocol_version: "0.8"
+ stream_validation_enabled: true
+ non_web_fallback_enabled: false
+```
+
+可通过以下方式控制:
+
+- Web 配置页:`A2UI` 顶层开关。
+- 用户工作区配置:修改 `config.yaml` 中的 `a2ui.enabled`。
+- 环境变量:`JIUWENSWARM_A2UI_ENABLED=false` 或 `true`。
+
+`non_web_fallback_enabled` 是兼容旧配置的保留字段;当前 A2UI 为 Web-only,非 Web channel 始终 bypass A2UI。
+
+旧的 `JIUWENCLAW_A2UI_*` 环境变量在本 PR 更新后不再支持,弃用时间线为 2026-06-04 起移除兼容;A2UI 运行时覆盖项统一使用 `JIUWENSWARM_A2UI_*` 前缀。
+
+## 依赖版本
+
+后端 SDK 依赖固定为 `a2ui-agent-sdk==0.2.1`,用于保证可重复构建。升级 SDK 时应在同一次变更中更新依赖锁、重新运行协议校验测试,并验证 Web renderer 构建。
+
+## 边界原则
+
+- A2UI 是可选能力,关闭或配置读取失败时不应影响普通文本/Markdown 流程。
+- A2UI 的 channel 支持策略由 `jiuwenswarm.server.runtime.a2ui.integration.is_a2ui_channel` 统一定义;当前只有 `web` 返回 true。
+- 后端宿主代码只调用 `jiuwenswarm.server.runtime.a2ui.integration` 的薄门面,避免直接依赖协议、repair、schema 等细节。
+- WebSocket hook 保持通用结构化消息能力,不导入 A2UI 类型或 renderer。
+- Web A2UI 逻辑留在 `channels/web/frontend/src/features/a2ui/`,不散落到通用组件或传输层。
+- 非 Web 渠道不感知 A2UI:不需要理解 A2UI renderer、schema、client event 或 fallback 细节。
+
+## 测试覆盖
+
+相关测试位于:
+
+- `tests/unit_tests/a2ui/`
+- `tests/system_tests/test_a2ui_system_flow.py`
+- `jiuwenswarm/channels/web/frontend/scripts/test-a2ui-action-defaults.mjs`
+
+常用验证命令:
+
+```powershell
+uv run pytest tests/unit_tests/a2ui tests/system_tests/test_a2ui_system_flow.py -q
+cd jiuwenswarm\channels\web\frontend
+npm run build
+node scripts/test-a2ui-action-defaults.mjs
+```
diff --git a/docs/zh/SUMMARY.md b/docs/zh/SUMMARY.md
index 33aeae5553..025792ce65 100644
--- a/docs/zh/SUMMARY.md
+++ b/docs/zh/SUMMARY.md
@@ -7,6 +7,7 @@
- [页面概览](页面概览.md)
- [E2A 协议(Gateway↔Agent)](E2A-protocol.md)
- [A2A 接入说明](A2A.md)
+- [A2UI 生成式界面](A2UI.md)
- [配置说明](配置信息.md)
- [分布式 Team](分布式Team.md)
- [Agent Team 使用指南](AgentTeam.md)
diff --git a/jiuwenswarm/agents/harness/common/prompt/prompt_builder.py b/jiuwenswarm/agents/harness/common/prompt/prompt_builder.py
index ce65925073..0dfc94ab86 100644
--- a/jiuwenswarm/agents/harness/common/prompt/prompt_builder.py
+++ b/jiuwenswarm/agents/harness/common/prompt/prompt_builder.py
@@ -27,10 +27,17 @@ class PromptPriority(IntEnum):
SKILLS = 40
MEMORY = 55
RESPONSE = 60
+ A2UI = 61
WORKSPACE = 70
TODO = 85
+class LocalSectionName:
+ """Local section names for optional JiuwenSwarm prompt sections."""
+
+ A2UI = "a2ui"
+
+
# ─── response section (shared by both modes via ResponsePromptRail) ───
diff --git a/jiuwenswarm/agents/harness/common/rails/response_prompt_rail.py b/jiuwenswarm/agents/harness/common/rails/response_prompt_rail.py
index 8d9f78e8d0..66d97759d2 100644
--- a/jiuwenswarm/agents/harness/common/rails/response_prompt_rail.py
+++ b/jiuwenswarm/agents/harness/common/rails/response_prompt_rail.py
@@ -1,12 +1,23 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
"""Inject the response/message-format section before each model call."""
+
from __future__ import annotations
+import logging
+
from openjiuwen.core.single_agent.rail.base import AgentCallbackContext
+from openjiuwen.harness.prompts import PromptSection
from openjiuwen.harness.rails.base import DeepAgentRail
-from jiuwenswarm.agents.harness.common.prompt.prompt_builder import _response_prompt
+from jiuwenswarm.common.context_keys import JIUWENSWARM_CHANNEL_CONTEXT_KEY
+from jiuwenswarm.agents.harness.common.prompt.prompt_builder import (
+ LocalSectionName,
+ PromptPriority,
+ _response_prompt,
+)
+
+logger = logging.getLogger(__name__)
class ResponsePromptRail(DeepAgentRail):
@@ -24,12 +35,81 @@ class ResponsePromptRail(DeepAgentRail):
def uninit(self, agent) -> None:
if self.system_prompt_builder is not None:
self.system_prompt_builder.remove_section("response")
+ self.system_prompt_builder.remove_section(LocalSectionName.A2UI)
self.system_prompt_builder = None
+ async def before_invoke(self, ctx: AgentCallbackContext) -> None:
+ channel = self._resolve_channel(ctx)
+ extra = getattr(ctx, "extra", None)
+ if isinstance(extra, dict) and channel:
+ extra[JIUWENSWARM_CHANNEL_CONTEXT_KEY] = channel
+
async def before_model_call(self, ctx: AgentCallbackContext) -> None:
- _ = ctx
if self.system_prompt_builder is None:
return
- section = _response_prompt(self.system_prompt_builder.language or "cn")
- self.system_prompt_builder.add_section(section)
+ language = self.system_prompt_builder.language or "cn"
+ self.system_prompt_builder.add_section(_response_prompt(language))
+ self._sync_a2ui_prompt_section(self._resolve_channel(ctx))
+
+ @staticmethod
+ def _resolve_channel(ctx: AgentCallbackContext) -> str | None:
+ """Read the request channel from callback inputs when available."""
+ inputs = getattr(ctx, "inputs", None)
+ if isinstance(inputs, dict):
+ value = inputs.get("channel")
+ if value is not None:
+ return str(value)
+ else:
+ value = getattr(inputs, "channel", None)
+ if value is not None:
+ return str(value)
+
+ extra = getattr(ctx, "extra", None)
+ if isinstance(extra, dict):
+ value = extra.get(JIUWENSWARM_CHANNEL_CONTEXT_KEY)
+ if value is not None:
+ return str(value)
+
+ conversation_id = (
+ inputs.get("conversation_id")
+ if isinstance(inputs, dict)
+ else getattr(inputs, "conversation_id", None)
+ )
+ if isinstance(conversation_id, str) and "_" in conversation_id:
+ return conversation_id.split("_", 1)[0]
+
+ return "web"
+
+ def _sync_a2ui_prompt_section(self, channel: str | None) -> None:
+ """Inject or remove the A2UI prompt section from runtime config."""
+ if self.system_prompt_builder is None:
+ return
+
+ try:
+ from jiuwenswarm.server.runtime.a2ui.integration import is_a2ui_channel
+
+ if not is_a2ui_channel(channel):
+ self.system_prompt_builder.remove_section(LocalSectionName.A2UI)
+ return
+
+ from jiuwenswarm.server.runtime.a2ui.config import get_current_a2ui_config
+ from jiuwenswarm.server.runtime.a2ui.runtime.prompt import build_a2ui_prompt_section
+
+ if not get_current_a2ui_config().enabled:
+ self.system_prompt_builder.remove_section(LocalSectionName.A2UI)
+ return
+
+ self.system_prompt_builder.add_section(
+ PromptSection(
+ name=LocalSectionName.A2UI,
+ content={
+ "cn": build_a2ui_prompt_section("cn"),
+ "en": build_a2ui_prompt_section("en"),
+ },
+ priority=PromptPriority.A2UI,
+ )
+ )
+ except Exception:
+ logger.exception("Failed to sync A2UI prompt section")
+ self.system_prompt_builder.remove_section(LocalSectionName.A2UI)
diff --git a/jiuwenswarm/channels/web/frontend/package-lock.json b/jiuwenswarm/channels/web/frontend/package-lock.json
index ee7ce320c5..6641913dba 100644
--- a/jiuwenswarm/channels/web/frontend/package-lock.json
+++ b/jiuwenswarm/channels/web/frontend/package-lock.json
@@ -8,6 +8,8 @@
"name": "openjiuwen-web",
"version": "0.1.0",
"dependencies": {
+ "@a2ui/react": "0.8.0",
+ "@a2ui/web_core": "0.8.0",
"@tailwindcss/typography": "^0.5.19",
"clsx": "^2.1.0",
"html-to-image": "1.11.13",
@@ -39,6 +41,34 @@
"vite": "^5.0.0"
}
},
+ "node_modules/@a2ui/react": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/@a2ui/react/-/react-0.8.0.tgz",
+ "integrity": "sha512-FU8eDIkhWcvtx65ATrToixzO5FxnYdROfZ1k5D24V7v1EP1Or2sdytZxL3XX/lnmTAJzG7KAls77tMB9jQ4SVA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@a2ui/web_core": ">=0.8.0 <0.8.4",
+ "clsx": "^2.1.0",
+ "markdown-it": "^14.0.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "peerDependencies": {
+ "react": "^18.0.0 || ^19.0.0",
+ "react-dom": "^18.0.0 || ^19.0.0"
+ }
+ },
+ "node_modules/@a2ui/web_core": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/@a2ui/web_core/-/web_core-0.8.0.tgz",
+ "integrity": "sha512-UG8IDsiLYuZjnEmqH7129EbN1Ds3DfC8FXPSI/E+0kcZ4VGxo//Kij6ZF2jBXBKyrHYPehoDtffFFIIFvgBp6g==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "zod": "^3.25.76",
+ "zod-to-json-schema": "^3.25.1"
+ }
+ },
"node_modules/@alloc/quick-lru": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
@@ -82,7 +112,6 @@
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/code-frame": "^7.29.0",
"@babel/generator": "^7.29.0",
@@ -1472,7 +1501,6 @@
"integrity": "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@@ -1488,7 +1516,6 @@
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.27.tgz",
"integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@types/prop-types": "*",
"csstype": "^3.2.2"
@@ -1559,7 +1586,6 @@
"integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==",
"dev": true,
"license": "BSD-2-Clause",
- "peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "6.21.0",
"@typescript-eslint/types": "6.21.0",
@@ -1749,7 +1775,6 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
- "peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -1839,7 +1864,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true,
"license": "Python-2.0"
},
"node_modules/array-union": {
@@ -1970,7 +1994,6 @@
}
],
"license": "MIT",
- "peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@@ -2327,6 +2350,18 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/entities": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
+ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
"node_modules/esbuild": {
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
@@ -2396,7 +2431,6 @@
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -2988,7 +3022,6 @@
}
],
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/runtime": "^7.28.6"
},
@@ -3207,7 +3240,6 @@
"resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz",
"integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",
"license": "MIT",
- "peer": true,
"bin": {
"jiti": "bin/jiti.js"
}
@@ -3320,6 +3352,15 @@
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
"license": "MIT"
},
+ "node_modules/linkify-it": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
+ "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
+ "license": "MIT",
+ "dependencies": {
+ "uc.micro": "^2.0.0"
+ }
+ },
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
@@ -3384,6 +3425,23 @@
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
+ "node_modules/markdown-it": {
+ "version": "14.1.1",
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.1.tgz",
+ "integrity": "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==",
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1",
+ "entities": "^4.4.0",
+ "linkify-it": "^5.0.0",
+ "mdurl": "^2.0.0",
+ "punycode.js": "^2.3.1",
+ "uc.micro": "^2.1.0"
+ },
+ "bin": {
+ "markdown-it": "bin/markdown-it.mjs"
+ }
+ },
"node_modules/markdown-table": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz",
@@ -3676,6 +3734,12 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/mdurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",
+ "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==",
+ "license": "MIT"
+ },
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -4552,7 +4616,6 @@
}
],
"license": "MIT",
- "peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@@ -4720,6 +4783,15 @@
"node": ">=6"
}
},
+ "node_modules/punycode.js": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz",
+ "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/qrcode.react": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/qrcode.react/-/qrcode.react-4.2.0.tgz",
@@ -4754,7 +4826,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@@ -5235,7 +5306,6 @@
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
"integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"@alloc/quick-lru": "^5.2.0",
"arg": "^5.0.2",
@@ -5334,7 +5404,6 @@
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=12"
},
@@ -5425,7 +5494,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"devOptional": true,
"license": "Apache-2.0",
- "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -5434,6 +5502,12 @@
"node": ">=14.17"
}
},
+ "node_modules/uc.micro": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
+ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
+ "license": "MIT"
+ },
"node_modules/undici-types": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
@@ -5618,7 +5692,6 @@
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"esbuild": "^0.21.3",
"postcss": "^8.4.43",
@@ -5735,6 +5808,24 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/zod": {
+ "version": "3.25.76",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
+ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/zod-to-json-schema": {
+ "version": "3.25.2",
+ "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz",
+ "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==",
+ "license": "ISC",
+ "peerDependencies": {
+ "zod": "^3.25.28 || ^4"
+ }
+ },
"node_modules/zustand": {
"version": "4.5.7",
"resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz",
diff --git a/jiuwenswarm/channels/web/frontend/package.json b/jiuwenswarm/channels/web/frontend/package.json
index 9e0bcdf51e..2453ec27c4 100644
--- a/jiuwenswarm/channels/web/frontend/package.json
+++ b/jiuwenswarm/channels/web/frontend/package.json
@@ -12,6 +12,8 @@
"preview": "vite preview"
},
"dependencies": {
+ "@a2ui/react": "0.8.0",
+ "@a2ui/web_core": "0.8.0",
"@tailwindcss/typography": "^0.5.19",
"clsx": "^2.1.0",
"html-to-image": "1.11.13",
diff --git a/jiuwenswarm/channels/web/frontend/scripts/test-a2ui-action-defaults.mjs b/jiuwenswarm/channels/web/frontend/scripts/test-a2ui-action-defaults.mjs
new file mode 100644
index 0000000000..1bd50ef4b8
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/scripts/test-a2ui-action-defaults.mjs
@@ -0,0 +1,331 @@
+import assert from 'node:assert/strict';
+import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import ts from 'typescript';
+
+const root = new URL('..', import.meta.url);
+const sourceUrl = new URL('src/features/a2ui/actionDefaults.ts', root);
+const tempDir = await mkdtemp(join(tmpdir(), 'a2ui-action-defaults-'));
+
+async function importTsModule(url) {
+ const source = await readFile(url, 'utf8');
+ const transpiled = ts.transpileModule(source, {
+ compilerOptions: {
+ module: ts.ModuleKind.ES2020,
+ target: ts.ScriptTarget.ES2020,
+ importsNotUsedAsValues: ts.ImportsNotUsedAsValues.Remove,
+ },
+ });
+ const outputPath = join(tempDir, 'actionDefaults.mjs');
+ await writeFile(outputPath, transpiled.outputText, 'utf8');
+ return import(`file://${outputPath.replace(/\\/g, '/')}`);
+}
+
+const {
+ clearA2UIActionDefaults,
+ enrichA2UIClientEventWithDefaults,
+ recordA2UIActionDefaults,
+} = await importTsModule(sourceUrl);
+
+function selectionMessages(defaultValue = 'chinese') {
+ return [
+ { beginRendering: { surfaceId: 'surface-1', root: 'root' } },
+ {
+ surfaceUpdate: {
+ surfaceId: 'surface-1',
+ components: [
+ {
+ id: 'food-choice',
+ component: {
+ MultipleChoice: {
+ selections: { path: '/food/type' },
+ options: [
+ { label: { literalString: '中餐' }, value: defaultValue },
+ { label: { literalString: '西餐' }, value: 'western' },
+ ],
+ },
+ },
+ },
+ {
+ id: 'submit',
+ component: {
+ Button: {
+ child: 'submit-label',
+ action: {
+ name: 'submit_form',
+ context: [
+ { key: 'foodType', value: { path: '/food/type' } },
+ ],
+ },
+ },
+ },
+ },
+ ],
+ },
+ },
+ ];
+}
+
+clearA2UIActionDefaults();
+recordA2UIActionDefaults(selectionMessages());
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: { foodType: null },
+ },
+ }).userAction.context,
+ { foodType: ['chinese'] },
+ 'unmodified visible default should be sent instead of null',
+);
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: { foodType: [] },
+ },
+ }).userAction.context,
+ { foodType: ['chinese'] },
+ 'same-option selection that leaves an empty array should use visible default',
+);
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: { foodType: {} },
+ },
+ }).userAction.context,
+ { foodType: ['chinese'] },
+ 'choice context represented as an empty object should use visible default',
+);
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: { foodType: 'western' },
+ },
+ }).userAction.context,
+ { foodType: 'western' },
+ 'non-empty user selection should not be overwritten',
+);
+
+clearA2UIActionDefaults();
+recordA2UIActionDefaults([
+ {
+ surfaceUpdate: {
+ surfaceId: 'surface-1',
+ components: [
+ {
+ id: 'priority-choice',
+ component: {
+ SingleChoice: {
+ selections: { path: '/priority' },
+ options: [
+ { label: { literalString: 'Low' }, value: 'low' },
+ { label: { literalString: 'High' }, value: 'high' },
+ ],
+ },
+ },
+ },
+ {
+ id: 'submit',
+ component: {
+ Button: {
+ child: 'submit-label',
+ action: {
+ name: 'submit_form',
+ context: [{ key: 'priority', value: { path: '/priority' } }],
+ },
+ },
+ },
+ },
+ ],
+ },
+ },
+]);
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: { priority: {} },
+ },
+ }).userAction.context,
+ { priority: ['low'] },
+ 'any choice-like component with options and selections.path should provide a visible default',
+);
+
+clearA2UIActionDefaults();
+recordA2UIActionDefaults([
+ {
+ surfaceUpdate: {
+ surfaceId: 'surface-1',
+ components: [
+ {
+ id: 'rating-choice',
+ component: {
+ SingleChoice: {
+ selections: { path: '/rating' },
+ options: [
+ { label: { literalString: 'One' }, value: 1 },
+ { label: { literalString: 'Two' }, value: 2 },
+ ],
+ },
+ },
+ },
+ {
+ id: 'submit',
+ component: {
+ Button: {
+ child: 'submit-label',
+ action: {
+ name: 'submit_form',
+ context: [{ key: 'rating', value: { path: '/rating' } }],
+ },
+ },
+ },
+ },
+ ],
+ },
+ },
+]);
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: { rating: {} },
+ },
+ }).userAction.context,
+ { rating: [1] },
+ 'choice defaults should preserve non-string option values',
+);
+
+clearA2UIActionDefaults();
+recordA2UIActionDefaults([
+ {
+ surfaceUpdate: {
+ surfaceId: 'surface-1',
+ components: [
+ {
+ id: 'food-choice',
+ component: {
+ MultipleChoice: {
+ selections: { path: '/food/type', literalArray: ['fallback'] },
+ options: [],
+ },
+ },
+ },
+ {
+ id: 'submit',
+ component: {
+ Button: {
+ child: 'submit-label',
+ action: {
+ name: 'submit_form',
+ context: [{ key: 'foodType', value: { path: '/food/type' } }],
+ },
+ },
+ },
+ },
+ ],
+ },
+ },
+]);
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: {},
+ },
+ }).userAction.context,
+ { foodType: ['fallback'] },
+ 'literalArray should be used when no option is visible',
+);
+
+clearA2UIActionDefaults();
+recordA2UIActionDefaults([
+ {
+ surfaceUpdate: {
+ surfaceId: 'surface-1',
+ components: [
+ {
+ id: 'food-choice',
+ component: {
+ MultipleChoice: {
+ selections: { path: '/food/type' },
+ options: [
+ { label: { literalString: 'Chinese' }, value: 'chinese' },
+ { label: { literalString: 'Western' }, value: 'western' },
+ ],
+ },
+ },
+ },
+ ],
+ },
+ },
+]);
+recordA2UIActionDefaults([
+ {
+ surfaceUpdate: {
+ surfaceId: 'surface-1',
+ components: [
+ {
+ id: 'submit',
+ component: {
+ Button: {
+ child: 'submit-label',
+ action: {
+ name: 'submit_form',
+ context: [{ key: 'foodType', value: { path: '/food/type' } }],
+ },
+ },
+ },
+ },
+ ],
+ },
+ },
+]);
+
+assert.deepEqual(
+ enrichA2UIClientEventWithDefaults({
+ userAction: {
+ name: 'submit_form',
+ sourceComponentId: 'submit',
+ surfaceId: 'surface-1',
+ timestamp: '2026-05-30T00:00:00.000Z',
+ context: { foodType: null },
+ },
+ }).userAction.context,
+ { foodType: ['chinese'] },
+ 'defaults recorded in an earlier surface update should be available to later buttons',
+);
+
+await rm(tempDir, { recursive: true, force: true });
diff --git a/jiuwenswarm/channels/web/frontend/src/App.tsx b/jiuwenswarm/channels/web/frontend/src/App.tsx
index 80fd855aba..c8565475b6 100644
--- a/jiuwenswarm/channels/web/frontend/src/App.tsx
+++ b/jiuwenswarm/channels/web/frontend/src/App.tsx
@@ -45,6 +45,14 @@ import { useTeamPanelState } from './features/teamPanelState';
import { AgentMode, UserAnswer, ModelEntry } from './types';
import { useSessionStore, useChatStore, useTodoStore, useHarnessStore } from './stores';
import { useTranslation } from 'react-i18next';
+import {
+ normalizeA2UIEnabled,
+ setA2UIFeatureEnabled,
+} from './features/a2ui/featureConfig';
+import {
+ buildA2UIClientEventContent,
+ setA2UIActionHandler,
+} from './features/a2ui/actionBridge';
import './App.css';
type MainNavKey = 'chat' | 'skills' | 'agents' | 'teams' | 'sessions' | 'heartbeat' | 'cron' | 'channels' | 'extensions' | 'configpanel' | 'logspanel' | 'browserpanel' | 'updatepanel';
@@ -354,6 +362,7 @@ function AppContent() {
isConnected,
request,
sendMessage,
+ sendStructuredChatContent,
pause,
cancel,
supplement,
@@ -417,6 +426,7 @@ function AppContent() {
const fetchConfig = useCallback(async () => {
try {
const config = await request<Record<string, unknown>>('config.get');
+ setA2UIFeatureEnabled(normalizeA2UIEnabled(config.a2ui_enabled));
setServerConfig(config);
setConfigError(null);
} catch (error) {
@@ -527,10 +537,13 @@ function AppContent() {
'config.set',
updates
);
+ if ('a2ui_enabled' in updates) {
+ setA2UIFeatureEnabled(normalizeA2UIEnabled(updates.a2ui_enabled));
+ }
setServerConfig((prev) => {
if (!prev) return updates;
const next: Record<string, unknown> = { ...prev, ...updates };
- // 保留 memory_forbidden_description 的双语字典结构
+ // Keep the bilingual memory_forbidden_description dictionary structure.
if (typeof prev.memory_forbidden_description === 'object' && prev.memory_forbidden_description !== null
&& !Array.isArray(prev.memory_forbidden_description) && updates.memory_forbidden_description !== undefined) {
const prevDict = prev.memory_forbidden_description as Record<string, string>;
@@ -553,7 +566,7 @@ function AppContent() {
}
}, [clearRestartAutoCloseTimer, closeRestartModal, request]);
-const applyConfigSaveUiState = useCallback((appliedWithoutRestart: boolean) => {
+ const applyConfigSaveUiState = useCallback((appliedWithoutRestart: boolean) => {
setConfigError(null);
setRestartModalOpen(true);
setRestartSuccess(false);
@@ -1055,6 +1068,17 @@ for (let i = payload.team.length; i < 10; i++) {
void sendMessage(content, currentSessionId);
}, [sendMessage]);
+ useEffect(() => {
+ return setA2UIActionHandler((message) => {
+ const currentSessionId = sessionIdRef.current;
+ if (!currentSessionId || currentSessionId === 'new') return;
+ void sendStructuredChatContent(
+ buildA2UIClientEventContent(message),
+ currentSessionId,
+ );
+ });
+ }, [sendStructuredChatContent]);
+
const handleInterrupt = useCallback((newInput?: string) => {
const currentSessionId = sessionIdRef.current;
if (!currentSessionId || currentSessionId === 'new') return;
diff --git a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/ChatPanel.css b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/ChatPanel.css
index 343c525589..985f8caa99 100644
--- a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/ChatPanel.css
+++ b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/ChatPanel.css
@@ -1158,3 +1158,66 @@
color: var(--text);
font-weight: 500;
}
+
+.a2ui-message-content {
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+ min-width: 0;
+}
+
+.a2ui-message-content__surfaces {
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+ min-width: 0;
+}
+
+.a2ui-message-content .a2ui-surface {
+ max-width: 100%;
+ color: var(--text);
+}
+
+.a2ui-message-content .a2ui-card > section {
+ border: 1px solid rgba(148, 163, 184, 0.26);
+ border-radius: 12px;
+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
+ box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
+ overflow: hidden;
+}
+
+:root.a2ui-material-symbols-unavailable .a2ui-message-content .a2ui-icon {
+ display: none;
+}
+
+:root.a2ui-material-symbols-unavailable .a2ui-message-content .a2ui-icon .g-icon {
+ font-size: 0;
+}
+
+:root[data-theme="light"] .a2ui-message-content .a2ui-card > section {
+ border-color: rgba(15, 23, 42, 0.12);
+ background: #fff;
+ box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
+}
+
+.a2ui-message-content .a2ui-image {
+ width: 100%;
+ overflow: hidden;
+ border-radius: var(--radius-md);
+ background: rgba(148, 163, 184, 0.16);
+}
+
+.a2ui-message-content .a2ui-image > section {
+ display: block;
+ width: 100%;
+ height: auto;
+ min-height: 160px;
+ aspect-ratio: 16 / 9;
+}
+
+.a2ui-message-content .a2ui-image img {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: var(--object-fit, cover);
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx
index 7737ef76e7..c27535f9b2 100644
--- a/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx
+++ b/jiuwenswarm/channels/web/frontend/src/components/ChatPanel/MessageItem.tsx
@@ -22,6 +22,8 @@ import {
import { StreamingContent } from './StreamingContent';
import { ToolCallDisplay } from './ToolCallDisplay';
import { MediaRenderer } from './MediaRenderer';
+import { A2UIMessageContent } from '../../features/a2ui/A2UIMessageContent';
+import { a2uiContentToText } from '../../features/a2ui/a2uiContent';
import { formatTimestamp, onTtsStop, sanitizeTtsText } from '../../utils';
import { useSpeechSynthesis } from '../../hooks';
import clsx from 'clsx';
@@ -265,7 +267,8 @@ export function MessageItem({
if (isSpeaking) {
stop();
} else if (content) {
- const cleanContent = sanitizeTtsText(content);
+ const readableContent = a2uiContentToText(content) || content;
+ const cleanContent = sanitizeTtsText(readableContent);
if (cleanContent) {
speak(cleanContent);
}
@@ -283,11 +286,12 @@ export function MessageItem({
const handleCopy = useCallback(async () => {
if (!content) return;
+ const copyContent = a2uiContentToText(content) || content;
try {
- await navigator.clipboard.writeText(content);
+ await navigator.clipboard.writeText(copyContent);
} catch {
const textarea = document.createElement('textarea');
- textarea.value = content;
+ textarea.value = copyContent;
textarea.style.position = 'fixed';
textarea.style.opacity = '0';
document.body.appendChild(textarea);
@@ -511,7 +515,16 @@ export function MessageItem({
data-testid={!isUser ? 'thinking-panel' : undefined}
>
{isStreaming ? (
- <StreamingContent content={content} isStreaming={true} />
+ isUser ? (
+ <StreamingContent content={content} isStreaming={true} />
+ ) : (
+ <A2UIMessageContent
+ content={content}
+ messageId={id}
+ isStreaming={true}
+ testId="thinking-body"
+ />
+ )
) : (
<>
{isUser ? (
@@ -519,8 +532,9 @@ export function MessageItem({
<span className="whitespace-pre-wrap">{content}</span>
</div>
) : (
- <MarkdownMessageBody
+ <A2UIMessageContent
content={content}
+ messageId={id}
testId="thinking-body"
/>
)}
diff --git a/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx b/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx
index e0c14b7d20..c4dbad23cb 100644
--- a/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx
+++ b/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx
@@ -288,6 +288,7 @@ const FREE_SEARCH_BOOLEAN_KEYS = new Set(["free_search_ddg_enabled", "free_searc
const FREE_SEARCH_KEYS = new Set([...FREE_SEARCH_BOOLEAN_KEYS]);
const HIDDEN_CONFIG_KEYS = new Set(["free_search_proxy_url"]);
const MEMORY_KEYS = new Set(["memory_forbidden_enabled", "memory_forbidden_description"]);
+const A2UI_KEYS = new Set(["a2ui_enabled"]);
function classifyKey(key: string): string {
if (MODEL_DEFAULT_KEYS.has(key)) return "model_default";
@@ -302,6 +303,7 @@ function classifyKey(key: string): string {
if (TEAM_KEYS.has(key)) return "team";
if (FREE_SEARCH_KEYS.has(key)) return "free_search";
if (MEMORY_KEYS.has(key)) return "memory";
+ if (A2UI_KEYS.has(key)) return "a2ui";
if (key === "context_engine_enabled" || key === "kv_cache_affinity_enabled") return "context_engine";
if (key === "permissions_enabled") return "permissions";
if (key.startsWith("feishu")) return "feishu";
@@ -393,6 +395,14 @@ function getGroupIcon(tag: string) {
</svg>
);
}
+ if (tag === "a2ui") {
+ return (
+ <svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.8}>
+ <path strokeLinecap="round" strokeLinejoin="round" d="M4.5 5.25h15A1.5 1.5 0 0121 6.75v10.5a1.5 1.5 0 01-1.5 1.5h-15A1.5 1.5 0 013 17.25V6.75a1.5 1.5 0 011.5-1.5z" />
+ <path strokeLinecap="round" strokeLinejoin="round" d="M7.5 9.75h9M7.5 14.25h5.25" />
+ </svg>
+ );
+ }
return (
<svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={1.8}>
<path strokeLinecap="round" strokeLinejoin="round" d="M11.25 6h9m-9 6h9m-9 6h9M3.75 6h.008v.008H3.75V6zm0 6h.008v.008H3.75V12zm0 6h.008v.008H3.75V18z" />
@@ -414,6 +424,7 @@ function getGroupToneClass(tag: string): string {
if (tag === "memory") return "text-purple-500 bg-purple-500/10 border-purple-500/20";
if (tag === "context_engine") return "text-sky-500 bg-sky-500/10 border-sky-500/20";
if (tag === "permissions") return "text-rose-500 bg-rose-500/10 border-rose-500/20";
+ if (tag === "a2ui") return "text-fuchsia-500 bg-fuchsia-500/10 border-fuchsia-500/20";
if (tag === "email") return "text-emerald-500 bg-emerald-500/10 border-emerald-500/20";
return "text-text-muted bg-secondary/70 border-border";
}
@@ -436,7 +447,8 @@ function isBooleanKey(key: string): boolean {
key === "context_engine_enabled" ||
key === "kv_cache_affinity_enabled" ||
key === "permissions_enabled" ||
- key === "memory_forbidden_enabled"
+ key === "memory_forbidden_enabled" ||
+ key === "a2ui_enabled"
);
}
@@ -454,6 +466,7 @@ function getBooleanKeyLabel(key: string, t: (key: string) => string): string {
kv_cache_affinity_enabled: t('config.booleanLabels.kvCacheAffinity'),
permissions_enabled: t('config.booleanLabels.enabled'),
memory_forbidden_enabled: t('config.booleanLabels.enabled'),
+ a2ui_enabled: t('config.booleanLabels.enabled'),
};
return labels[key] ?? key;
}
@@ -495,9 +508,10 @@ function getGroupMeta(t: (key: string) => string): Record<string, { label: strin
team: { label: t('config.groups.team.label'), order: 7.6, hint: t('config.groups.team.hint') },
context_engine: { label: t('config.groups.contextEngine.label'), order: 8, hint: t('config.groups.contextEngine.hint') },
permissions: { label: t('config.groups.permissions.label'), order: 9, hint: t('config.groups.permissions.hint') },
- memory: { label: t('config.groups.memory.label'), order: 10, hint: t('config.groups.memory.hint') },
- email: { label: t('config.groups.email.label'), order: 11, hint: t('config.groups.email.hint') },
- other: { label: t('config.groups.other.label'), order: 12, hint: t('config.groups.other.hint') },
+ a2ui: { label: t('config.groups.a2ui.label'), order: 10, hint: t('config.groups.a2ui.hint') },
+ memory: { label: t('config.groups.memory.label'), order: 11, hint: t('config.groups.memory.hint') },
+ email: { label: t('config.groups.email.label'), order: 12, hint: t('config.groups.email.hint') },
+ other: { label: t('config.groups.other.label'), order: 13, hint: t('config.groups.other.hint') },
};
}
diff --git a/jiuwenswarm/channels/web/frontend/src/features/a2ui/A2UIMessageContent.tsx b/jiuwenswarm/channels/web/frontend/src/features/a2ui/A2UIMessageContent.tsx
new file mode 100644
index 0000000000..86b555a099
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/src/features/a2ui/A2UIMessageContent.tsx
@@ -0,0 +1,125 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+import { useEffect, useMemo } from 'react';
+import ReactMarkdown from 'react-markdown';
+import remarkGfm from 'remark-gfm';
+import { useA2UIActions } from '@a2ui/react';
+import {
+ extractA2UISurfaceIds,
+ namespaceA2UIMessages,
+ parseA2UIContent,
+ type A2UIContentPart,
+} from './a2uiContent';
+import { recordA2UIActionDefaults } from './actionDefaults';
+import { isA2UIFeatureEnabled } from './featureConfig';
+import { getA2UIRenderer } from './rendererRegistry';
+
+interface A2UIMessageContentProps {
+ content: string;
+ messageId: string;
+ isStreaming?: boolean;
+ testId?: string;
+}
+
+type RenderPart =
+ | { kind: 'text'; text: string; key: string }
+ | {
+ kind: 'a2ui';
+ key: string;
+ protocolVersion: string;
+ messages: Extract<A2UIContentPart, { kind: 'a2ui' }>['messages'];
+ surfaceIds: string[];
+ };
+
+function safeNamespace(input: string): string {
+ return input.replace(/[^A-Za-z0-9_-]/g, '_');
+}
+
+function MarkdownPart({ text }: { text: string }) {
+ return (
+ <ReactMarkdown
+ remarkPlugins={[remarkGfm]}
+ components={{
+ a: ({ href, children, ...props }) => (
+ <a href={href} target="_blank" rel="noopener noreferrer" {...props}>
+ {children}
+ </a>
+ ),
+ }}
+ >
+ {text}
+ </ReactMarkdown>
+ );
+}
+
+export function A2UIMessageContent({
+ content,
+ messageId,
+ isStreaming = false,
+ testId,
+}: A2UIMessageContentProps) {
+ const { processMessages } = useA2UIActions();
+ const namespace = useMemo(() => `msg_${safeNamespace(messageId)}`, [messageId]);
+ const a2uiEnabled = isA2UIFeatureEnabled();
+
+ const renderParts = useMemo<RenderPart[]>(() => {
+ return parseA2UIContent(content, {
+ enabled: a2uiEnabled,
+ isStreaming,
+ }).map((part, index) => {
+ if (part.kind === 'text') {
+ return {
+ kind: 'text',
+ text: part.text,
+ key: `text-${index}`,
+ };
+ }
+
+ const messages = namespaceA2UIMessages(part.messages, namespace);
+ return {
+ kind: 'a2ui',
+ key: `a2ui-${index}`,
+ protocolVersion: part.protocolVersion,
+ messages,
+ surfaceIds: extractA2UISurfaceIds(messages),
+ };
+ });
+ }, [a2uiEnabled, content, isStreaming, namespace]);
+
+ useEffect(() => {
+ for (const part of renderParts) {
+ if (a2uiEnabled && part.kind === 'a2ui') {
+ recordA2UIActionDefaults(part.messages);
+ processMessages(part.messages);
+ }
+ }
+ }, [a2uiEnabled, processMessages, renderParts]);
+
+ return (
+ <div className="chat-text a2ui-message-content" data-testid={testId}>
+ {renderParts.map((part) => {
+ if (part.kind === 'text') {
+ return <MarkdownPart key={part.key} text={part.text} />;
+ }
+
+ const Renderer = getA2UIRenderer(part.protocolVersion);
+ if (!Renderer) {
+ return (
+ <div key={part.key} className="text-sm text-danger">
+ Unsupported A2UI protocol version: {part.protocolVersion}
+ </div>
+ );
+ }
+
+ return (
+ <div key={part.key} className="a2ui-message-content__surfaces">
+ {part.surfaceIds.map((surfaceId) => (
+ <Renderer key={surfaceId} surfaceId={surfaceId} />
+ ))}
+ </div>
+ );
+ })}
+ {isStreaming && <span className="streaming-cursor" />}
+ </div>
+ );
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/features/a2ui/MultipleChoiceWithDefaults.tsx b/jiuwenswarm/channels/web/frontend/src/features/a2ui/MultipleChoiceWithDefaults.tsx
new file mode 100644
index 0000000000..6d14544242
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/src/features/a2ui/MultipleChoiceWithDefaults.tsx
@@ -0,0 +1,108 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+import { useCallback, useEffect, useId } from 'react';
+import type { CSSProperties, ChangeEvent } from 'react';
+import {
+ classMapToString,
+ stylesToObject,
+ useA2UIComponent,
+ type A2UIComponentProps,
+ type AnyComponentNode,
+ type DataValue,
+} from '@a2ui/react';
+
+type MultipleChoiceNodeLike = Extract<AnyComponentNode, { type: 'MultipleChoice' }>;
+
+function selectedValueFromData(value: DataValue | null): string | null {
+ if (Array.isArray(value)) {
+ for (const item of value) {
+ if (typeof item === 'string') {
+ return item;
+ }
+ }
+ return null;
+ }
+ return typeof value === 'string' ? value : null;
+}
+
+function isMissingSelection(value: DataValue | null): boolean {
+ return value === null || value === undefined || (Array.isArray(value) && value.length === 0);
+}
+
+export function visibleMultipleChoiceDefault(
+ props: MultipleChoiceNodeLike['properties']
+): string | null {
+ const firstOption = props.options?.find((option) => typeof option.value === 'string');
+ if (firstOption) {
+ return firstOption.value;
+ }
+ for (const item of props.selections?.literalArray ?? []) {
+ if (typeof item === 'string') {
+ return item;
+ }
+ }
+ return null;
+}
+
+export function MultipleChoiceWithDefaults({
+ node,
+ surfaceId,
+}: A2UIComponentProps<MultipleChoiceNodeLike>) {
+ const { theme, resolveString, setValue, getValue } = useA2UIComponent(node, surfaceId);
+ const props = node.properties;
+ const id = useId();
+ const selectionsPath = props.selections?.path;
+ const descriptionValue = (props as MultipleChoiceNodeLike['properties'] & {
+ description?: Parameters<typeof resolveString>[0];
+ }).description;
+ const description = resolveString(descriptionValue) ?? 'Select an item';
+ const defaultValue = visibleMultipleChoiceDefault(props);
+ const dataValue = selectionsPath ? getValue(selectionsPath) : null;
+ const selectedValue = selectedValueFromData(dataValue) ?? defaultValue ?? '';
+
+ useEffect(() => {
+ if (selectionsPath && defaultValue !== null && isMissingSelection(getValue(selectionsPath))) {
+ setValue(selectionsPath, [defaultValue]);
+ }
+ }, [defaultValue, getValue, selectionsPath, setValue]);
+
+ const handleChange = useCallback(
+ (event: ChangeEvent<HTMLSelectElement>) => {
+ if (selectionsPath) {
+ setValue(selectionsPath, [event.target.value]);
+ }
+ },
+ [selectionsPath, setValue]
+ );
+
+ const hostStyle = (
+ node.weight !== undefined ? { '--weight': node.weight } : {}
+ ) as CSSProperties;
+
+ return (
+ <div className="a2ui-multiplechoice" style={hostStyle}>
+ <section className={classMapToString(theme.components.MultipleChoice.container)}>
+ <label
+ htmlFor={id}
+ className={classMapToString(theme.components.MultipleChoice.label)}
+ >
+ {description}
+ </label>
+ <select
+ name="data"
+ id={id}
+ value={selectedValue}
+ className={classMapToString(theme.components.MultipleChoice.element)}
+ style={stylesToObject(theme.additionalStyles?.MultipleChoice)}
+ onChange={handleChange}
+ >
+ {(props.options ?? []).map((option) => (
+ <option key={option.value} value={option.value}>
+ {resolveString(option.label)}
+ </option>
+ ))}
+ </select>
+ </section>
+ </div>
+ );
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/features/a2ui/a2uiContent.ts b/jiuwenswarm/channels/web/frontend/src/features/a2ui/a2uiContent.ts
new file mode 100644
index 0000000000..58dbc14bb8
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/src/features/a2ui/a2uiContent.ts
@@ -0,0 +1,276 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+import type { ServerToClientMessage } from '@a2ui/react';
+
+export const A2UI_PROTOCOL_VERSION = '0.8';
+export const A2UI_OPEN_TAG = '<a2ui-json>';
+export const A2UI_CLOSE_TAG = '</a2ui-json>';
+
+const A2UI_MESSAGE_KEYS = [
+ 'beginRendering',
+ 'surfaceUpdate',
+ 'dataModelUpdate',
+ 'deleteSurface',
+] as const;
+
+export type A2UIProtocolVersion = typeof A2UI_PROTOCOL_VERSION;
+
+export type A2UIContentPart =
+ | { kind: 'text'; text: string }
+ | {
+ kind: 'a2ui';
+ protocolVersion: A2UIProtocolVersion;
+ messages: ServerToClientMessage[];
+ surfaceIds: string[];
+ };
+
+interface ParseA2UIContentOptions {
+ enabled?: boolean;
+ isStreaming?: boolean;
+}
+
+function isRecord(value: unknown): value is Record<string, unknown> {
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
+}
+
+function isA2UIMessage(value: unknown): value is ServerToClientMessage {
+ if (!isRecord(value)) {
+ return false;
+ }
+ return A2UI_MESSAGE_KEYS.filter((key) => key in value).length === 1;
+}
+
+function coerceA2UIMessageList(value: unknown): ServerToClientMessage[] | null {
+ if (Array.isArray(value) && value.every(isA2UIMessage)) {
+ return value;
+ }
+ if (isA2UIMessage(value)) {
+ return [value];
+ }
+ return null;
+}
+
+function parseJsonMessageList(text: string): ServerToClientMessage[] | null {
+ const trimmed = text.trim();
+ if (!trimmed || (!trimmed.startsWith('[') && !trimmed.startsWith('{'))) {
+ return null;
+ }
+ try {
+ return coerceA2UIMessageList(JSON.parse(trimmed));
+ } catch {
+ return null;
+ }
+}
+
+function parseJsonlMessages(text: string): ServerToClientMessage[] | null {
+ const lines = text
+ .split(/\r?\n/)
+ .map((line) => line.trim())
+ .filter(Boolean);
+ if (!lines.length || !lines.every((line) => line.startsWith('{') && line.endsWith('}'))) {
+ return null;
+ }
+
+ const messages: ServerToClientMessage[] = [];
+ try {
+ for (const line of lines) {
+ const parsed = JSON.parse(line);
+ if (!isA2UIMessage(parsed)) {
+ return null;
+ }
+ messages.push(parsed);
+ }
+ } catch {
+ return null;
+ }
+ return messages;
+}
+
+function parseA2UIMessageText(text: string): ServerToClientMessage[] | null {
+ return parseJsonlMessages(text) ?? parseJsonMessageList(text);
+}
+
+interface FencedA2UIBlock {
+ start: number;
+ end: number;
+ messages: ServerToClientMessage[];
+}
+
+function stripLeadingOrphanedA2UIFenceTail(text: string): string {
+ return text.replace(/^\s*(?:[}\]]\s*)+```[ \t]*/, '');
+}
+
+function findNextFencedA2UIBlock(content: string, cursor: number): FencedA2UIBlock | null {
+ const fencePattern = /```(?:json|a2ui|a2ui-json)?[ \t]*\r?\n([\s\S]*?)\r?\n```/gi;
+ fencePattern.lastIndex = cursor;
+
+ let match: RegExpExecArray | null;
+ while ((match = fencePattern.exec(content)) !== null) {
+ const messages = parseA2UIMessageText(match[1]);
+ if (messages) {
+ return {
+ start: match.index,
+ end: match.index + match[0].length,
+ messages,
+ };
+ }
+ }
+ return null;
+}
+
+function getMessageSurfaceId(message: ServerToClientMessage): string | null {
+ if (message.beginRendering?.surfaceId) {
+ return message.beginRendering.surfaceId;
+ }
+ if (message.surfaceUpdate?.surfaceId) {
+ return message.surfaceUpdate.surfaceId;
+ }
+ if (message.dataModelUpdate?.surfaceId) {
+ return message.dataModelUpdate.surfaceId;
+ }
+ if (message.deleteSurface?.surfaceId) {
+ return message.deleteSurface.surfaceId;
+ }
+ return null;
+}
+
+export function extractA2UISurfaceIds(messages: ServerToClientMessage[]): string[] {
+ const surfaceIds = new Set<string>();
+ for (const message of messages) {
+ const surfaceId = getMessageSurfaceId(message);
+ if (surfaceId) {
+ surfaceIds.add(surfaceId);
+ }
+ }
+ return Array.from(surfaceIds);
+}
+
+function makeA2UIPart(messages: ServerToClientMessage[]): A2UIContentPart {
+ return {
+ kind: 'a2ui',
+ protocolVersion: A2UI_PROTOCOL_VERSION,
+ messages,
+ surfaceIds: extractA2UISurfaceIds(messages),
+ };
+}
+
+function invalidA2UIFallback(): A2UIContentPart {
+ return {
+ kind: 'text',
+ text: '[A2UI content could not be rendered]',
+ };
+}
+
+function pendingA2UIFallback(): A2UIContentPart {
+ return {
+ kind: 'text',
+ text: 'A2UI 界面生成中...',
+ };
+}
+
+export function parseA2UIContent(
+ content: string,
+ options: ParseA2UIContentOptions = {}
+): A2UIContentPart[] {
+ if (!content) {
+ return [];
+ }
+ if (options.enabled === false) {
+ return [{ kind: 'text', text: content }];
+ }
+
+ const jsonlMessages = parseJsonlMessages(content);
+ if (jsonlMessages) {
+ return [makeA2UIPart(jsonlMessages)];
+ }
+
+ const rawJsonMessages = parseJsonMessageList(content);
+ if (rawJsonMessages) {
+ return [makeA2UIPart(rawJsonMessages)];
+ }
+
+ const parts: A2UIContentPart[] = [];
+ let cursor = 0;
+ let sawA2UIBlock = false;
+
+ while (cursor < content.length) {
+ const openIndex = content.indexOf(A2UI_OPEN_TAG, cursor);
+ const fencedBlock = findNextFencedA2UIBlock(content, cursor);
+ const fencedIndex = fencedBlock?.start ?? -1;
+
+ if (openIndex < 0 && fencedIndex < 0) {
+ const tail = content.slice(cursor);
+ if (tail) {
+ parts.push({ kind: 'text', text: tail });
+ }
+ break;
+ }
+
+ const useFence = fencedBlock !== null && (openIndex < 0 || fencedBlock.start < openIndex);
+ const blockStart = useFence ? fencedBlock.start : openIndex;
+
+ sawA2UIBlock = true;
+ if (blockStart > cursor) {
+ const textBeforeBlock = stripLeadingOrphanedA2UIFenceTail(
+ content.slice(cursor, blockStart)
+ );
+ if (textBeforeBlock.trim()) {
+ parts.push({ kind: 'text', text: textBeforeBlock });
+ }
+ }
+
+ if (useFence) {
+ parts.push(makeA2UIPart(fencedBlock.messages));
+ cursor = fencedBlock.end;
+ continue;
+ }
+
+ const bodyStart = openIndex + A2UI_OPEN_TAG.length;
+ const closeIndex = content.indexOf(A2UI_CLOSE_TAG, bodyStart);
+ if (closeIndex < 0) {
+ parts.push(options.isStreaming ? pendingA2UIFallback() : invalidA2UIFallback());
+ break;
+ }
+
+ const body = content.slice(bodyStart, closeIndex);
+ const messages = parseJsonMessageList(body);
+ parts.push(messages ? makeA2UIPart(messages) : invalidA2UIFallback());
+ cursor = closeIndex + A2UI_CLOSE_TAG.length;
+ }
+
+ return sawA2UIBlock ? parts.filter((part) => part.kind !== 'text' || part.text) : [{ kind: 'text', text: content }];
+}
+
+export function namespaceA2UIMessages(
+ messages: ServerToClientMessage[],
+ namespace: string
+): ServerToClientMessage[] {
+ return messages.map((message) => {
+ const cloned = structuredClone(message) as ServerToClientMessage;
+ if (cloned.beginRendering?.surfaceId) {
+ cloned.beginRendering.surfaceId = `${namespace}:${cloned.beginRendering.surfaceId}`;
+ }
+ if (cloned.surfaceUpdate?.surfaceId) {
+ cloned.surfaceUpdate.surfaceId = `${namespace}:${cloned.surfaceUpdate.surfaceId}`;
+ }
+ if (cloned.dataModelUpdate?.surfaceId) {
+ cloned.dataModelUpdate.surfaceId = `${namespace}:${cloned.dataModelUpdate.surfaceId}`;
+ }
+ if (cloned.deleteSurface?.surfaceId) {
+ cloned.deleteSurface.surfaceId = `${namespace}:${cloned.deleteSurface.surfaceId}`;
+ }
+ return cloned;
+ });
+}
+
+export function a2uiContentToText(content: string): string {
+ return parseA2UIContent(content)
+ .map((part) => {
+ if (part.kind === 'text') {
+ return part.text.trim();
+ }
+ return '[A2UI interactive content]';
+ })
+ .filter(Boolean)
+ .join('\n\n');
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/features/a2ui/actionBridge.ts b/jiuwenswarm/channels/web/frontend/src/features/a2ui/actionBridge.ts
new file mode 100644
index 0000000000..7bd52d628c
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/src/features/a2ui/actionBridge.ts
@@ -0,0 +1,53 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+import type { A2UIClientEventMessage } from '@a2ui/react';
+import { isA2UIFeatureEnabled } from './featureConfig';
+import { A2UI_PROTOCOL_VERSION } from './a2uiContent';
+import { enrichA2UIClientEventWithDefaults } from './actionDefaults';
+
+export interface A2UIClientEventContent {
+ type: 'a2ui.client_event';
+ protocolVersion: typeof A2UI_PROTOCOL_VERSION;
+ event: A2UIClientEventMessage;
+}
+
+type A2UIActionHandler = (
+ message: A2UIClientEventMessage
+) => void | Promise<void>;
+
+let currentHandler: A2UIActionHandler | null = null;
+
+export function buildA2UIClientEventContent(
+ message: A2UIClientEventMessage
+): A2UIClientEventContent {
+ const enrichedMessage = enrichA2UIClientEventWithDefaults(message);
+ return {
+ type: 'a2ui.client_event',
+ protocolVersion: A2UI_PROTOCOL_VERSION,
+ event: enrichedMessage,
+ };
+}
+
+export function setA2UIActionHandler(
+ handler: A2UIActionHandler | null
+): () => void {
+ currentHandler = handler;
+ return () => {
+ if (currentHandler === handler) {
+ currentHandler = null;
+ }
+ };
+}
+
+export async function dispatchA2UIAction(
+ message: A2UIClientEventMessage
+): Promise<void> {
+ if (!isA2UIFeatureEnabled()) {
+ return;
+ }
+ if (!currentHandler) {
+ console.warn('[A2UI] action ignored because no chat sender is registered');
+ return;
+ }
+ await currentHandler(message);
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/features/a2ui/actionDefaults.ts b/jiuwenswarm/channels/web/frontend/src/features/a2ui/actionDefaults.ts
new file mode 100644
index 0000000000..778226b3af
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/src/features/a2ui/actionDefaults.ts
@@ -0,0 +1,203 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+import type { A2UIClientEventMessage, ServerToClientMessage } from '@a2ui/react';
+
+type UnknownRecord = Record<string, unknown>;
+
+interface ActionDefaultEntry {
+ surfaceId: string;
+ sourceComponentId: string;
+ actionName: string;
+ defaults: Record<string, unknown>;
+}
+
+const actionDefaults = new Map<string, ActionDefaultEntry>();
+const surfaceDefaultsByPath = new Map<string, Map<string, unknown>>();
+
+function isRecord(value: unknown): value is UnknownRecord {
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
+}
+
+function componentType(component: unknown): string | null {
+ if (!isRecord(component)) {
+ return null;
+ }
+ return Object.keys(component)[0] ?? null;
+}
+
+function componentProps(component: unknown): UnknownRecord | null {
+ if (!isRecord(component)) {
+ return null;
+ }
+ const type = componentType(component);
+ if (!type || !isRecord(component[type])) {
+ return null;
+ }
+ return component[type];
+}
+
+function normalizePath(path: unknown): string | null {
+ if (typeof path !== 'string' || !path.trim()) {
+ return null;
+ }
+ const trimmed = path.trim();
+ return trimmed.startsWith('/') ? trimmed : `/${trimmed}`;
+}
+
+function visibleChoiceDefault(props: UnknownRecord): unknown {
+ const options = Array.isArray(props.options) ? props.options : [];
+ const firstOption = options.find(isRecord);
+ if (
+ firstOption &&
+ Object.prototype.hasOwnProperty.call(firstOption, 'value') &&
+ firstOption.value !== null &&
+ firstOption.value !== undefined
+ ) {
+ return firstOption.value;
+ }
+
+ const selections = isRecord(props.selections) ? props.selections : null;
+ const literalArray = Array.isArray(selections?.literalArray)
+ ? selections.literalArray
+ : [];
+ const firstLiteral = literalArray.find((value) => value !== null && value !== undefined);
+ return firstLiteral ?? null;
+}
+
+function actionName(action: UnknownRecord): string | null {
+ return typeof action.name === 'string'
+ ? action.name
+ : typeof action.actionName === 'string'
+ ? action.actionName
+ : null;
+}
+
+function actionKey(surfaceId: string, sourceComponentId: string, name: string): string {
+ return `${surfaceId}\u0000${sourceComponentId}\u0000${name}`;
+}
+
+function isEmptyActionValue(value: unknown): boolean {
+ return (
+ value === null ||
+ value === undefined ||
+ (Array.isArray(value) && value.length === 0) ||
+ (isRecord(value) && Object.keys(value).length === 0)
+ );
+}
+
+export function clearA2UIActionDefaults(): void {
+ actionDefaults.clear();
+ surfaceDefaultsByPath.clear();
+}
+
+export function recordA2UIActionDefaults(messages: ServerToClientMessage[]): void {
+ for (const message of messages) {
+ if (message.deleteSurface?.surfaceId) {
+ const surfaceId = message.deleteSurface.surfaceId;
+ surfaceDefaultsByPath.delete(surfaceId);
+ for (const [key, entry] of actionDefaults.entries()) {
+ if (entry.surfaceId === surfaceId) {
+ actionDefaults.delete(key);
+ }
+ }
+ continue;
+ }
+
+ const update = message.surfaceUpdate;
+ if (!update?.surfaceId || !Array.isArray(update.components)) {
+ continue;
+ }
+
+ const defaultsByPath = surfaceDefaultsByPath.get(update.surfaceId) ?? new Map<string, unknown>();
+ for (const instance of update.components) {
+ const props = componentProps(instance.component);
+ if (!props) {
+ continue;
+ }
+ const selections = isRecord(props.selections) ? props.selections : null;
+ const selectionsPath = normalizePath(selections?.path);
+ const defaultValue = visibleChoiceDefault(props);
+ if (selectionsPath && defaultValue !== null) {
+ defaultsByPath.set(selectionsPath, [defaultValue]);
+ }
+ }
+ if (defaultsByPath.size > 0) {
+ surfaceDefaultsByPath.set(update.surfaceId, defaultsByPath);
+ }
+
+ for (const instance of update.components) {
+ const props = componentProps(instance.component);
+ if (!props || componentType(instance.component) !== 'Button' || !isRecord(props.action)) {
+ continue;
+ }
+
+ const name = actionName(props.action);
+ if (!name || !Array.isArray(props.action.context)) {
+ continue;
+ }
+
+ const defaults: Record<string, unknown> = {};
+ for (const contextItem of props.action.context) {
+ if (!isRecord(contextItem) || typeof contextItem.key !== 'string' || !isRecord(contextItem.value)) {
+ continue;
+ }
+ const path = normalizePath(contextItem.value.path);
+ if (path && defaultsByPath.has(path)) {
+ defaults[contextItem.key] = defaultsByPath.get(path);
+ }
+ }
+
+ if (Object.keys(defaults).length > 0) {
+ actionDefaults.set(actionKey(update.surfaceId, instance.id, name), {
+ surfaceId: update.surfaceId,
+ sourceComponentId: instance.id,
+ actionName: name,
+ defaults,
+ });
+ }
+ }
+ }
+}
+
+export function enrichA2UIClientEventWithDefaults(
+ message: A2UIClientEventMessage
+): A2UIClientEventMessage {
+ const userAction = message.userAction;
+ if (!userAction) {
+ return message;
+ }
+
+ const name = actionName(userAction as unknown as UnknownRecord);
+ const sourceComponentId = userAction.sourceComponentId;
+ const surfaceId = userAction.surfaceId;
+ if (!name || !sourceComponentId || !surfaceId) {
+ return message;
+ }
+
+ const entry = actionDefaults.get(actionKey(surfaceId, sourceComponentId, name));
+ if (!entry) {
+ return message;
+ }
+
+ const currentContext = isRecord(userAction.context) ? userAction.context : {};
+ const nextContext: Record<string, unknown> = { ...currentContext };
+ let changed = false;
+ for (const [key, value] of Object.entries(entry.defaults)) {
+ if (isEmptyActionValue(nextContext[key])) {
+ nextContext[key] = value;
+ changed = true;
+ }
+ }
+
+ if (!changed) {
+ return message;
+ }
+
+ return {
+ ...message,
+ userAction: {
+ ...userAction,
+ context: nextContext,
+ },
+ };
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/features/a2ui/featureConfig.ts b/jiuwenswarm/channels/web/frontend/src/features/a2ui/featureConfig.ts
new file mode 100644
index 0000000000..38d051714a
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/src/features/a2ui/featureConfig.ts
@@ -0,0 +1,22 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+let a2uiFeatureEnabled = true;
+
+/** Set the frontend A2UI feature flag from the server config payload. */
+export function setA2UIFeatureEnabled(enabled: boolean) {
+ a2uiFeatureEnabled = enabled;
+}
+
+/** Return whether the frontend should parse and dispatch A2UI content. */
+export function isA2UIFeatureEnabled() {
+ return a2uiFeatureEnabled;
+}
+
+/** Normalize config values sent over the WebSocket config RPC boundary. */
+export function normalizeA2UIEnabled(value: unknown) {
+ if (typeof value === 'boolean') {
+ return value;
+ }
+ const text = String(value ?? 'true').trim().toLowerCase();
+ return !['0', 'false', 'no', 'off'].includes(text);
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/features/a2ui/rendererRegistry.tsx b/jiuwenswarm/channels/web/frontend/src/features/a2ui/rendererRegistry.tsx
new file mode 100644
index 0000000000..cdad864795
--- /dev/null
+++ b/jiuwenswarm/channels/web/frontend/src/features/a2ui/rendererRegistry.tsx
@@ -0,0 +1,33 @@
+// Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+import type { ComponentType } from 'react';
+import { A2UIRenderer, ComponentRegistry, registerDefaultCatalog } from '@a2ui/react';
+import { A2UI_PROTOCOL_VERSION, type A2UIProtocolVersion } from './a2uiContent';
+import { MultipleChoiceWithDefaults } from './MultipleChoiceWithDefaults';
+
+export interface A2UIRendererProps {
+ surfaceId: string;
+}
+
+const a2uiV08Registry = new ComponentRegistry();
+registerDefaultCatalog(a2uiV08Registry);
+a2uiV08Registry.register('MultipleChoice', {
+ component: MultipleChoiceWithDefaults,
+});
+
+const A2UIV08Renderer = ({ surfaceId }: A2UIRendererProps) => (
+ <A2UIRenderer surfaceId={surfaceId} registry={a2uiV08Registry} />
+);
+
+export const rendererByVersion: Record<
+ A2UIProtocolVersion,
+ ComponentType<A2UIRendererProps>
+> = {
+ [A2UI_PROTOCOL_VERSION]: A2UIV08Renderer,
+};
+
+export function getA2UIRenderer(
+ version: string
+): ComponentType<A2UIRendererProps> | null {
+ return rendererByVersion[version as A2UIProtocolVersion] ?? null;
+}
diff --git a/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts b/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts
index 4173fdfe22..03097fa4b4 100644
--- a/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts
+++ b/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts
@@ -251,6 +251,7 @@ interface UseWebSocketReturn {
options?: WebRequestOptions
) => Promise<T>;
sendMessage: (content: string, sessionId: string) => Promise<void>;
+ sendStructuredChatContent: (content: unknown, sessionId: string) => Promise<void>;
interrupt: (
sessionId: string,
intent: InterruptIntent,
@@ -765,6 +766,48 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {
]
);
+ const sendStructuredChatContent = useCallback(
+ async (content: unknown, sessionId: string) => {
+ resetContextCompressionTurn();
+ userInputVersionRef.current += 1;
+ stopAllTts();
+
+ setProcessing(true);
+ setThinking(true);
+
+ const currentMode = useSessionStore.getState().mode;
+ const selectedModel = useSessionStore.getState().selectedModelName;
+ if (currentMode === 'auto_harness') {
+ useHarnessStore.getState().reset();
+ }
+ if (currentMode === 'team') {
+ setPaused(false);
+ }
+ try {
+ await request('chat.send', {
+ session_id: sessionId,
+ content,
+ mode: currentMode,
+ ...(selectedModel ? { model_name: selectedModel } : {}),
+ });
+ } catch (error) {
+ const webError = error as WebError;
+ setConnectionStats({ lastError: webError.message });
+ setProcessing(false);
+ setThinking(false);
+ const errorMsg = webError.message || t('network.sendMessageFailed');
+ onErrorRef.current?.(errorMsg);
+ addMessage({
+ id: `error-${Date.now()}`,
+ role: 'system',
+ content: t('network.errorPrefix', { message: errorMsg }),
+ timestamp: new Date().toISOString(),
+ });
+ }
+ },
+ [addMessage, request, resetContextCompressionTurn, setProcessing, setThinking, t]
+ );
+
// 存储sendMessage函数到ref
useEffect(() => {
sendMessageRef.current = sendMessage;
@@ -2339,6 +2382,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {
connectionState,
request,
sendMessage,
+ sendStructuredChatContent,
interrupt,
pause,
cancel,
diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json
index f41e4452ca..5ac15cd782 100644
--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json
+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json
@@ -778,6 +778,7 @@
"team": { "label": "Team Configuration", "hint": "Multi-agent team settings" },
"contextEngine": { "label": "Context Compression", "hint": "Enable or disable dialogue context compression" },
"permissions": { "label": "Tool Safety Guardrail", "hint": "Enable or disable permission checks for tool calls" },
+ "a2ui": { "label": "A2UI", "hint": "Enable or disable generated UI rendering and A2UI runtime prompts." },
"memory": { "label": "Memory Sensitive Info Filter", "hint": "Configure sensitive content types forbidden from memory" },
"email": { "label": "Email Settings", "hint": "Email account and token settings" },
"other": { "label": "Other Settings", "hint": "Unclassified extended parameters" }
diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json
index ad2711a806..6f7237879c 100644
--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json
+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json
@@ -777,6 +777,7 @@
"team": { "label": "Team配置", "hint": "多智能体团队配置" },
"contextEngine": { "label": "上下文压缩", "hint": "控制对话上下文是否启用压缩" },
"permissions": { "label": "工具安全护栏", "hint": "控制工具调用时的权限检查" },
+ "a2ui": { "label": "A2UI", "hint": "开启或关闭生成式界面渲染与 A2UI 运行时提示词" },
"memory": { "label": "记忆系统敏感信息过滤", "hint": "配置禁止写入记忆的敏感信息类型" },
"email": { "label": "邮箱配置", "hint": "邮件账号与令牌参数" },
"other": { "label": "其他配置", "hint": "未归类的扩展参数" }
diff --git a/jiuwenswarm/channels/web/frontend/src/main.tsx b/jiuwenswarm/channels/web/frontend/src/main.tsx
index bb903bbcc2..b8b3f8857f 100644
--- a/jiuwenswarm/channels/web/frontend/src/main.tsx
+++ b/jiuwenswarm/channels/web/frontend/src/main.tsx
@@ -1,8 +1,38 @@
import './i18n';
import ReactDOM from 'react-dom/client';
+import { A2UIProvider } from '@a2ui/react';
+import type { A2UIClientEventMessage } from '@a2ui/react';
+import { injectStyles } from '@a2ui/react/styles';
import App from './App.tsx'
+import { dispatchA2UIAction } from './features/a2ui/actionBridge';
import './index.css'
+function flagA2UIIconFontAvailability() {
+ if (typeof document === 'undefined' || !('fonts' in document)) {
+ return
+ }
+
+ const fonts = document.fonts
+ const hasMaterialSymbols =
+ fonts.check('20px "Material Symbols Outlined"') ||
+ fonts.check('20px "Google Symbols"')
+
+ document.documentElement.classList.toggle(
+ 'a2ui-material-symbols-unavailable',
+ !hasMaterialSymbols
+ )
+}
+
+injectStyles();
+flagA2UIIconFontAvailability()
+void document.fonts?.ready.then(flagA2UIIconFontAvailability)
+
+function handleA2UIAction(message: A2UIClientEventMessage) {
+ void dispatchA2UIAction(message);
+}
+
ReactDOM.createRoot(document.getElementById('root')!).render(
- <App />,
+ <A2UIProvider onAction={handleA2UIAction}>
+ <App />
+ </A2UIProvider>,
)
diff --git a/jiuwenswarm/common/config.py b/jiuwenswarm/common/config.py
index 3860663e26..e4f270b508 100644
--- a/jiuwenswarm/common/config.py
+++ b/jiuwenswarm/common/config.py
@@ -1236,6 +1236,17 @@ def update_memory_forbidden_in_config(updates: dict[str, Any]) -> None:
dump_yaml_round_trip(CONFIG_YAML_PATH, data)
+def update_a2ui_in_config(updates: dict[str, Any]) -> None:
+ """更新 a2ui 配置段并写回 config.yaml。"""
+ data = _load_yaml_round_trip(_CONFIG_YAML_PATH)
+ if "a2ui" not in data:
+ data["a2ui"] = {}
+ section = data["a2ui"]
+ for key, value in updates.items():
+ section[key] = value
+ _dump_yaml_round_trip(_CONFIG_YAML_PATH, data)
+
+
def _deep_merge(
template: dict[str, Any],
user: dict[str, Any],
diff --git a/jiuwenswarm/common/context_keys.py b/jiuwenswarm/common/context_keys.py
new file mode 100644
index 0000000000..4746f25b29
--- /dev/null
+++ b/jiuwenswarm/common/context_keys.py
@@ -0,0 +1,13 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Shared keys for runtime callback/context dictionaries."""
+
+from __future__ import annotations
+
+
+# Agent callback context extra key used to preserve the original request channel
+# when downstream model-call inputs no longer carry channel metadata.
+JIUWENSWARM_CHANNEL_CONTEXT_KEY = "__jiuwenswarm_channel__"
+
+
+__all__ = ["JIUWENSWARM_CHANNEL_CONTEXT_KEY"]
diff --git a/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.py b/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.py
index 116ba84fc8..e6a3bf55e8 100644
--- a/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.py
+++ b/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.py
@@ -38,8 +38,14 @@ from jiuwenswarm.common.config import (
update_permissions_enabled_in_config,
update_memory_forbidden_enabled_in_config,
update_memory_forbidden_description_in_config,
+ update_a2ui_in_config,
update_updater_in_config,
)
+from jiuwenswarm.server.runtime.a2ui.integration import (
+ get_a2ui_config_payload,
+ get_default_a2ui_config_payload,
+ validate_a2ui_config_update,
+)
from jiuwenswarm.common.updater import UpdaterService
from jiuwenswarm.common.utils import (
get_agent_sessions_dir,
@@ -375,6 +381,7 @@ _CONFIG_YAML_KEYS = frozenset({
"permissions_enabled",
"memory_forbidden_enabled",
"memory_forbidden_description",
+ "a2ui_enabled",
})
@@ -636,6 +643,7 @@ def _register_web_handlers(bind: WebHandlersBindParams) -> None:
payload["memory_forbidden_enabled"] = "true" if memory_cfg.get("enabled", False) else "false"
memory_desc = memory_cfg.get("description") or {}
payload["memory_forbidden_description"] = memory_desc
+ payload.update(get_a2ui_config_payload(raw))
if not payload.get("free_search_ddg_enabled"):
payload["free_search_ddg_enabled"] = "false"
if not payload.get("free_search_bing_enabled"):
@@ -649,6 +657,8 @@ def _register_web_handlers(bind: WebHandlersBindParams) -> None:
payload.setdefault("evolution_auto_scan", "false")
payload.setdefault("memory_forbidden_enabled", "false")
payload.setdefault("memory_forbidden_description", "")
+ for key, value in get_default_a2ui_config_payload().items():
+ payload.setdefault(key, value)
payload.setdefault("free_search_ddg_enabled", "false")
payload.setdefault("free_search_bing_enabled", "false")
await channel.send_response(ws, req_id, ok=True, payload=payload)
@@ -747,6 +757,11 @@ def _register_web_handlers(bind: WebHandlersBindParams) -> None:
elif param_key == "memory_forbidden_description":
desc_val = str(val).strip()
update_memory_forbidden_description_in_config({preferred_lang: desc_val})
+ elif param_key.startswith("a2ui_"):
+ ok, update, error = validate_a2ui_config_update(param_key, val)
+ if not ok:
+ raise _ConfigBadRequest(error or "invalid A2UI config")
+ update_a2ui_in_config(update)
yaml_updated.append(param_key)
except Exception as e: # noqa: BLE001
logger.warning("[config.set] 写回 config.yaml 失败 %s: %s", param_key, e)
diff --git a/jiuwenswarm/gateway/message_handler/message_handler.py b/jiuwenswarm/gateway/message_handler/message_handler.py
index 7a4431be09..a3c8b301e9 100644
--- a/jiuwenswarm/gateway/message_handler/message_handler.py
+++ b/jiuwenswarm/gateway/message_handler/message_handler.py
@@ -53,6 +53,22 @@ _KNOWN_JIUWENSWARM_SESSION_PREFIXES = (
"whatsapp_",
)
+_A2UI_OPEN_TAG_MARKER = "<a2ui-json>"
+
+
+def apply_a2ui_text_fallback_to_gateway_payload(
+ payload: dict[str, Any],
+ *,
+ channel_id: str,
+) -> dict[str, Any]:
+ """Convert A2UI blocks to text for non-Web channel payloads."""
+ if not any(_A2UI_OPEN_TAG_MARKER in value for value in payload.values() if isinstance(value, str)):
+ return payload
+
+ from jiuwenswarm.server.runtime.a2ui.integration import apply_non_web_text_fallback_to_payload
+
+ return apply_non_web_text_fallback_to_payload(payload, channel_id=channel_id)
+
class ChannelMode(str, Enum):
@@ -1786,8 +1802,13 @@ class MessageHandler(ABC):
# 检查 payload 中是否包含 event_type,如果包含则创建事件消息
event_type = None
+ payload = resp.payload
if resp.payload and isinstance(resp.payload, dict):
- event_type_str = resp.payload.get("event_type")
+ payload = apply_a2ui_text_fallback_to_gateway_payload(
+ dict(resp.payload),
+ channel_id=resp.channel_id,
+ )
+ event_type_str = payload.get("event_type")
if isinstance(event_type_str, str):
try:
event_type = EventType(event_type_str)
@@ -1800,7 +1821,7 @@ class MessageHandler(ABC):
params={},
timestamp=time.time(),
ok=True,
- payload=resp.payload,
+ payload=payload,
event_type=event_type,
metadata=metadata,
group_digital_avatar=group_digital_avatar,
@@ -1819,7 +1840,7 @@ class MessageHandler(ABC):
params={},
timestamp=time.time(),
ok=resp.ok,
- payload=resp.payload,
+ payload=payload,
event_type=EventType.CHAT_FINAL,
metadata=metadata,
group_digital_avatar=group_digital_avatar,
@@ -1973,8 +1994,13 @@ class MessageHandler(ABC):
# 从 payload 中提取 event_type(如果存在)
event_type = None
+ payload = chunk.payload
if chunk.payload and isinstance(chunk.payload, dict):
- event_type_str = chunk.payload.get("event_type")
+ payload = apply_a2ui_text_fallback_to_gateway_payload(
+ dict(chunk.payload),
+ channel_id=chunk.channel_id,
+ )
+ event_type_str = payload.get("event_type")
if isinstance(event_type_str, str):
try:
event_type = EventType(event_type_str)
@@ -1989,7 +2015,7 @@ class MessageHandler(ABC):
params={},
timestamp=time.time(),
ok=True,
- payload=chunk.payload,
+ payload=payload,
event_type=event_type,
metadata=metadata,
group_digital_avatar=group_digital_avatar,
@@ -2669,49 +2695,50 @@ class MessageHandler(ABC):
if msg.req_method == ReqMethod.CHAT_SEND and msg.params:
content = msg.params.get("query") or msg.params.get("content") or ""
attachments = msg.params.get("attachments")
- cwd = None
- if isinstance(msg.metadata, dict):
- cwd = msg.metadata.get("cwd")
- enriched = content
- if attachments:
- enriched = self._resolve_structured_attachments(
- content,
- attachments,
- cwd=cwd,
- )
- elif content and "@" in content:
- enriched = self.resolve_at_file_references(content, cwd=cwd)
-
- # ---- Resolve @agent-xxx mentions ----
- agent_mentions = self.extract_agent_mentions(content)
- if agent_mentions:
- hint_parts = []
- for agent_name in agent_mentions:
- hint_parts.append(
- f"用户表达了调用智能体 \"{agent_name}\" 的意图。"
- f"请按需调用该智能体,并向其传递所需的上下文。"
+ if isinstance(content, str):
+ cwd = None
+ if isinstance(msg.metadata, dict):
+ cwd = msg.metadata.get("cwd")
+ enriched = content
+ if attachments:
+ enriched = self._resolve_structured_attachments(
+ content,
+ attachments,
+ cwd=cwd,
+ )
+ elif content and "@" in content:
+ enriched = self.resolve_at_file_references(content, cwd=cwd)
+
+ # ---- Resolve @agent-xxx mentions ----
+ agent_mentions = self.extract_agent_mentions(content)
+ if agent_mentions:
+ hint_parts = []
+ for agent_name in agent_mentions:
+ hint_parts.append(
+ f"用户表达了调用智能体 \"{agent_name}\" 的意图。"
+ f"请按需调用该智能体,并向其传递所需的上下文。"
+ )
+ agent_hint = "\n".join(hint_parts)
+ enriched = (
+ enriched
+ + "\n\n<system-reminder>\n"
+ + agent_hint
+ + "\n</system-reminder>"
+ )
+ logger.info(
+ "[MessageHandler] Agent mentions detected: %s",
+ agent_mentions,
)
- agent_hint = "\n".join(hint_parts)
- enriched = (
- enriched
- + "\n\n<system-reminder>\n"
- + agent_hint
- + "\n</system-reminder>"
- )
- logger.info(
- "[MessageHandler] Agent mentions detected: %s",
- agent_mentions,
- )
- if enriched != content:
- msg.params = dict(msg.params)
- msg.params["query"] = enriched
- if "content" in msg.params:
- msg.params["content"] = enriched
- logger.info(
- "[MessageHandler] attachments/agent-mentions resolved in chat.send: id=%s",
- msg.id,
- )
+ if enriched != content:
+ msg.params = dict(msg.params)
+ msg.params["query"] = enriched
+ if "content" in msg.params:
+ msg.params["content"] = enriched
+ logger.info(
+ "[MessageHandler] attachments/agent-mentions resolved in chat.send: id=%s",
+ msg.id,
+ )
logger.info(
"[MessageHandler] 从 user_messages 取出,发往 AgentServer: id=%s channel_id=%s is_stream=%s",
diff --git a/jiuwenswarm/resources/config.yaml b/jiuwenswarm/resources/config.yaml
index 38dfafa0e5..b756160acc 100644
--- a/jiuwenswarm/resources/config.yaml
+++ b/jiuwenswarm/resources/config.yaml
@@ -1,6 +1,13 @@
# 前端显示语言:zh(中文)/ en(英文),与 Web 界面语言切换同步
preferred_language: zh
+a2ui:
+ enabled: true
+ protocol_version: "0.8"
+ stream_validation_enabled: true
+ non_web_fallback_enabled: false
+ dev_smoke_tools_enabled: false
+
# 日志目录:~/.jiuwenswarm/agent/.logs/
# gateway.log / channel.log / agent_server.log 按源码路径分流;full.log 为汇总。
# level:未单独指定时的默认级别。console_level:控制台;可省略则用 level。
diff --git a/jiuwenswarm/server/runtime/a2ui/__init__.py b/jiuwenswarm/server/runtime/a2ui/__init__.py
new file mode 100644
index 0000000000..167e6691c3
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/__init__.py
@@ -0,0 +1,16 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""A2UI feature package.
+
+This package owns jiuwenswarm's A2UI integration. Core agentserver code should
+depend on the public helpers exposed here instead of reaching into protocol
+or renderer details.
+"""
+
+from jiuwenswarm.server.runtime.a2ui.config import A2UIConfig, get_a2ui_config, is_a2ui_enabled
+
+__all__ = [
+ "A2UIConfig",
+ "get_a2ui_config",
+ "is_a2ui_enabled",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/config.py b/jiuwenswarm/server/runtime/a2ui/config.py
new file mode 100644
index 0000000000..247d5e260c
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/config.py
@@ -0,0 +1,82 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Configuration helpers for the A2UI feature."""
+
+from __future__ import annotations
+
+import os
+from dataclasses import dataclass
+from typing import Any
+
+
+SUPPORTED_A2UI_PROTOCOL_VERSIONS = frozenset({"0.8"})
+
+
+@dataclass(frozen=True)
+class A2UIConfig:
+ """Runtime switches controlling the optional A2UI feature."""
+
+ enabled: bool = True
+ protocol_version: str = "0.8"
+ stream_validation_enabled: bool = True
+ non_web_fallback_enabled: bool = False
+ dev_smoke_tools_enabled: bool = False
+
+
+def _to_bool(value: Any, default: bool) -> bool:
+ """Parse config and environment boolean values with a stable default."""
+ if value is None:
+ return default
+ if isinstance(value, bool):
+ return value
+ text = str(value).strip().lower()
+ if text in {"1", "true", "yes", "on"}:
+ return True
+ if text in {"0", "false", "no", "off"}:
+ return False
+ return default
+
+
+def get_a2ui_config(config: dict[str, Any] | None = None) -> A2UIConfig:
+ """Build A2UI config from a config dictionary plus environment overrides."""
+ raw = config or {}
+ section = raw.get("a2ui") if isinstance(raw, dict) else {}
+ section = section if isinstance(section, dict) else {}
+
+ enabled = _to_bool(section.get("enabled"), True)
+ env_enabled = os.getenv("JIUWENSWARM_A2UI_ENABLED")
+ if env_enabled is not None:
+ enabled = _to_bool(env_enabled, enabled)
+
+ protocol_version = str(
+ os.getenv("JIUWENSWARM_A2UI_PROTOCOL_VERSION")
+ or section.get("protocol_version")
+ or "0.8"
+ ).strip()
+ if protocol_version not in SUPPORTED_A2UI_PROTOCOL_VERSIONS:
+ raise ValueError(f"Unsupported A2UI protocol version: {protocol_version}")
+
+ dev_smoke_tools_enabled = _to_bool(section.get("dev_smoke_tools_enabled"), False)
+ env_smoke = os.getenv("JIUWENSWARM_A2UI_SMOKE_TOOLS")
+ if env_smoke is not None:
+ dev_smoke_tools_enabled = _to_bool(env_smoke, dev_smoke_tools_enabled)
+
+ return A2UIConfig(
+ enabled=enabled,
+ protocol_version=protocol_version,
+ stream_validation_enabled=_to_bool(section.get("stream_validation_enabled"), True),
+ non_web_fallback_enabled=_to_bool(section.get("non_web_fallback_enabled"), False),
+ dev_smoke_tools_enabled=dev_smoke_tools_enabled,
+ )
+
+
+def get_current_a2ui_config() -> A2UIConfig:
+ """Read A2UI config from the active jiuwenswarm runtime config."""
+ from jiuwenswarm.common.config import get_config
+
+ return get_a2ui_config(get_config() or {})
+
+
+def is_a2ui_enabled(config: dict[str, Any] | None = None) -> bool:
+ """Return whether A2UI is enabled for the supplied config."""
+ return get_a2ui_config(config).enabled
diff --git a/jiuwenswarm/server/runtime/a2ui/integration.py b/jiuwenswarm/server/runtime/a2ui/integration.py
new file mode 100644
index 0000000000..9990594447
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/integration.py
@@ -0,0 +1,163 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Integration helpers for wiring A2UI into jiuwenswarm host modules.
+
+This module owns A2UI-specific branching that would otherwise spread across
+AgentServer, Gateway, and Web config handlers. Host modules should call these
+small helpers and keep their original control flow generic.
+"""
+
+from __future__ import annotations
+
+import logging
+from typing import Any
+
+from jiuwenswarm.server.runtime.a2ui.config import get_a2ui_config, get_current_a2ui_config
+
+logger = logging.getLogger(__name__)
+
+_WEB_CONFIG_KEY_MAP: dict[str, str] = {
+ "a2ui_enabled": "enabled",
+}
+
+_A2UI_CONFIG_DEFAULT_PAYLOAD: dict[str, str] = {
+ "a2ui_enabled": "true",
+}
+
+_A2UI_CHANNEL_ID = "web"
+
+
+def is_a2ui_channel(channel: str | None) -> bool:
+ """Return whether the channel can natively run A2UI."""
+ return str(channel or "").strip().lower() == _A2UI_CHANNEL_ID
+
+
+def _to_bool(value: Any) -> bool:
+ """Normalize Web config boolean values to Python bools."""
+ if isinstance(value, bool):
+ return value
+ return str(value).strip().lower() in {"true", "1", "yes", "on"}
+
+
+def _bool_text(value: bool) -> str:
+ """Render boolean config values in the string format used by Web config."""
+ return "true" if value else "false"
+
+
+def _get_runtime_a2ui_config():
+ """Read runtime A2UI config while preserving env-only fallback for tests."""
+ try:
+ return get_current_a2ui_config()
+ except ModuleNotFoundError as exc:
+ if exc.name != "yaml":
+ raise
+ return get_a2ui_config({})
+
+
+def _build_a2ui_client_event_prompt(content: dict[str, Any], channel: str, language: str) -> str:
+ """Delegate client-event prompt construction to the A2UI runtime package."""
+ from jiuwenswarm.server.runtime.a2ui.runtime.prompt import build_a2ui_client_event_prompt
+
+ return build_a2ui_client_event_prompt(content, channel=channel, language=language)
+
+
+def build_user_prompt_if_a2ui_event(
+ content: object,
+ *,
+ channel: str,
+ language: str,
+) -> str | None:
+ """Build a model prompt for A2UI client events when the feature is enabled.
+
+ Returns ``None`` when the payload is not an A2UI client event or when A2UI is
+ disabled, allowing the normal user prompt builder to continue unchanged.
+ """
+ if not is_a2ui_channel(channel):
+ return None
+
+ a2ui_config = _get_runtime_a2ui_config()
+ if not a2ui_config.enabled:
+ return None
+
+ if not isinstance(content, dict) or content.get("type") != "a2ui.client_event":
+ return None
+
+ return _build_a2ui_client_event_prompt(content, channel, language)
+
+
+async def finalize_assistant_response_if_a2ui(
+ content: str,
+ *,
+ channel: str | None = _A2UI_CHANNEL_ID,
+ user_query: Any,
+ request_id: str,
+ repair_call: Any,
+) -> str:
+ """Validate/repair assistant A2UI content while keeping host modules generic."""
+ if not is_a2ui_channel(channel):
+ return content
+
+ try:
+ a2ui_config = _get_runtime_a2ui_config()
+ except Exception:
+ logger.debug("A2UI response finalization skipped: config lookup failed", exc_info=True)
+ return content
+
+ from jiuwenswarm.server.runtime.a2ui.runtime.response_finalization import finalize_a2ui_assistant_content
+
+ return await finalize_a2ui_assistant_content(
+ content,
+ user_query=user_query,
+ request_id=request_id,
+ repair_call=repair_call if callable(repair_call) else None,
+ a2ui_enabled=a2ui_config.enabled,
+ )
+
+
+def apply_non_web_text_fallback_to_payload(
+ payload: dict[str, object],
+ *,
+ channel_id: str,
+) -> dict[str, object]:
+ """Retain the legacy gateway hook while keeping A2UI Web-only.
+
+ Web payloads keep raw A2UI blocks for the frontend renderer. Non-Web
+ channels bypass A2UI entirely, including the previous text fallback path.
+ """
+ return payload
+
+
+def get_a2ui_config_payload(raw_config: dict[str, object]) -> dict[str, str]:
+ """Return user-facing Web config payload fields for the A2UI section."""
+ config = get_a2ui_config(raw_config)
+ return {
+ "a2ui_enabled": _bool_text(config.enabled),
+ }
+
+
+def get_default_a2ui_config_payload() -> dict[str, str]:
+ """Return fallback Web config fields when config loading fails."""
+ return dict(_A2UI_CONFIG_DEFAULT_PAYLOAD)
+
+
+def validate_a2ui_config_update(
+ param_key: str,
+ value: object,
+) -> tuple[bool, dict[str, object], str]:
+ """Validate and map one Web A2UI config update to config.yaml keys."""
+ config_key = _WEB_CONFIG_KEY_MAP.get(param_key)
+ if config_key is None:
+ return False, {}, f"Unknown A2UI config key: {param_key}"
+
+ return True, {config_key: _to_bool(value)}, ""
+
+
+__all__ = [
+ "apply_non_web_text_fallback_to_payload",
+ "build_user_prompt_if_a2ui_event",
+ "finalize_assistant_response_if_a2ui",
+ "get_a2ui_config_payload",
+ "get_default_a2ui_config_payload",
+ "is_a2ui_channel",
+ "validate_a2ui_config_update",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/parser.py b/jiuwenswarm/server/runtime/a2ui/parser.py
new file mode 100644
index 0000000000..20aaf38b40
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/parser.py
@@ -0,0 +1,129 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""A2UI response parsing helpers."""
+
+from __future__ import annotations
+
+import copy
+import json
+from typing import Any
+
+from a2ui.parser.parser import parse_response as parse_tagged_response
+from a2ui.schema.constants import A2UI_CLOSE_TAG, A2UI_OPEN_TAG
+
+from jiuwenswarm.server.runtime.a2ui.types import A2UIResponsePart
+
+
+_A2UI_MESSAGE_KEYS = frozenset(
+ {"beginRendering", "surfaceUpdate", "dataModelUpdate", "deleteSurface"}
+)
+
+
+def is_a2ui_message(value: Any) -> bool:
+ return isinstance(value, dict) and len(_A2UI_MESSAGE_KEYS.intersection(value)) == 1
+
+
+def coerce_message_list(value: Any) -> list[dict[str, Any]] | None:
+ if isinstance(value, list) and all(is_a2ui_message(item) for item in value):
+ return [copy.deepcopy(item) for item in value]
+ if is_a2ui_message(value):
+ return [copy.deepcopy(value)]
+ return None
+
+
+def iter_tagged_block_bodies(text: str) -> list[tuple[int, str]]:
+ blocks: list[tuple[int, str]] = []
+ cursor = 0
+ while True:
+ start = text.find(A2UI_OPEN_TAG, cursor)
+ if start < 0:
+ return blocks
+ body_start = start + len(A2UI_OPEN_TAG)
+ end = text.find(A2UI_CLOSE_TAG, body_start)
+ if end < 0:
+ blocks.append((len(blocks), text[body_start:]))
+ return blocks
+ blocks.append((len(blocks), text[body_start:end]))
+ cursor = end + len(A2UI_CLOSE_TAG)
+
+
+def strip_tagged_a2ui_blocks(text: str) -> str:
+ output: list[str] = []
+ cursor = 0
+ while True:
+ start = text.find(A2UI_OPEN_TAG, cursor)
+ if start < 0:
+ output.append(text[cursor:])
+ break
+ output.append(text[cursor:start])
+ end = text.find(A2UI_CLOSE_TAG, start + len(A2UI_OPEN_TAG))
+ if end < 0:
+ break
+ cursor = end + len(A2UI_CLOSE_TAG)
+ return "".join(output).strip()
+
+
+def parse_raw_json(text: str) -> list[dict[str, Any]] | None:
+ stripped = text.strip()
+ if not stripped.startswith(("[", "{")):
+ return None
+ try:
+ return coerce_message_list(json.loads(stripped))
+ except json.JSONDecodeError:
+ return None
+
+
+def parse_jsonl(text: str) -> list[dict[str, Any]] | None:
+ lines = [line.strip() for line in text.splitlines() if line.strip()]
+ if not lines or not all(line.startswith("{") and line.endswith("}") for line in lines):
+ return None
+ messages: list[dict[str, Any]] = []
+ try:
+ for line in lines:
+ parsed = json.loads(line)
+ if not is_a2ui_message(parsed):
+ return None
+ messages.append(parsed)
+ except json.JSONDecodeError:
+ return None
+ return messages
+
+
+def parse_a2ui_response(content: str) -> list[A2UIResponsePart]:
+ text = content or ""
+ if not text.strip():
+ return []
+
+ jsonl_messages = parse_jsonl(text)
+ if jsonl_messages is not None:
+ return [A2UIResponsePart(kind="a2ui", messages=jsonl_messages)]
+
+ raw_json_messages = parse_raw_json(text)
+ if raw_json_messages is not None:
+ return [A2UIResponsePart(kind="a2ui", messages=raw_json_messages)]
+
+ parts: list[A2UIResponsePart] = []
+ for part in parse_tagged_response(text):
+ part_text = (part.text or "").strip()
+ if part_text:
+ parts.append(A2UIResponsePart(kind="text", text=part_text))
+ messages = coerce_message_list(part.a2ui_json)
+ if messages is not None:
+ parts.append(A2UIResponsePart(kind="a2ui", messages=messages))
+ return parts or [A2UIResponsePart(kind="text", text=text)]
+
+
+def may_contain_a2ui_content(content: str) -> bool:
+ text = content or ""
+ return A2UI_OPEN_TAG in text or parse_jsonl(text) is not None or parse_raw_json(text) is not None
+
+
+__all__ = [
+ "coerce_message_list",
+ "iter_tagged_block_bodies",
+ "may_contain_a2ui_content",
+ "parse_a2ui_response",
+ "parse_jsonl",
+ "parse_raw_json",
+ "strip_tagged_a2ui_blocks",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/prompt_instructions.py b/jiuwenswarm/server/runtime/a2ui/prompt_instructions.py
new file mode 100644
index 0000000000..f5fa27c8c6
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/prompt_instructions.py
@@ -0,0 +1,124 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Request-scoped A2UI prompt rail instructions."""
+
+from __future__ import annotations
+
+
+def build_a2ui_autonomy_instruction(language: str = "en") -> str:
+ template_binding_rule_en = (
+ " For repeated list/card data, use A2UI template binding correctly: "
+ "Duplicate dataModelUpdate keys are invalid. Encode arrays as one "
+ 'collection key with indexed valueMap entries such as "0", "1", where '
+ "each item contains its own nested valueMap fields. Inside template "
+ "components, use item-relative paths like 'name', 'price', or "
+ "'/item/name' for Text, Image, and Button.action.context values; do not "
+ "use collection-absolute paths such as '/phones/name' inside templates."
+ )
+ image_url_rule_en = (
+ " Do not invent image URLs. If external facts or images are needed, use "
+ "the available tools briefly, then converge to the final A2UI response. "
+ "Use a user-provided HTTPS URL or a verified stable source URL; do not "
+ "use guessed upload.wikimedia.org thumbnail paths."
+ )
+ icon_font_rule_en = (
+ " The host app may not have the Material Symbols icon font available. "
+ "Avoid A2UI Icon for semantic content such as product or status icons; "
+ "use Text literalString emoji or text labels instead so ligature fallback "
+ "text does not appear."
+ )
+ autonomy_rule_en = (
+ " A2UI is optional. Use A2UI only when a generated interface improves "
+ "the user's experience over plain text. Do not force A2UI for greetings, "
+ "short explanations, simple factual answers, or unstructured prose. Good "
+ "A2UI candidates include information collection forms, actionable "
+ "confirmations, multi-result comparison, object detail views, media-rich "
+ "cards, dashboards/status/inventory/task summaries, and tool-result "
+ "presentations. For real-world recommendation, comparison, shopping, "
+ "ranking, price, travel, restaurant, or product requests, use tools first "
+ "when available, then decide whether A2UI is the best final presentation. "
+ "If the user already provided complete structured data or asks for a demo, "
+ "you may render directly without tools. Never write tool_call, invoke, or "
+ "function-call tags as plain text."
+ )
+ requested_component_rule_en = (
+ " You must match the requested component type: for an input box or "
+ "text field request, generate TextField/Form UI; generate a card list "
+ "only when the user asks for cards or a card list. Card/list UI is "
+ "not a universal fallback. For a single object detail request, build a "
+ "single object detail layout, not a multi-card demo. Do not substitute a "
+ "fixed demo for the requested component. For any user-editable "
+ "TextField, bind TextField.text to a data model path, initialize that "
+ "path with dataModelUpdate, and include the submitted value in "
+ "Button.action.context using a path reference. Do not emit an empty "
+ "Button.action.context for form submissions."
+ + template_binding_rule_en
+ + image_url_rule_en
+ + icon_font_rule_en
+ )
+
+ template_binding_rule_zh = (
+ " 使用 List 或卡片列表展示重复数据时,dataModelUpdate 的 key 不能重复。"
+ "请把数组编码为一个集合 key,并在 valueMap 中使用 \"0\"、\"1\" 这类索引项;"
+ "每个 item 包含自己的嵌套 valueMap 字段。模板组件和 Button.action.context "
+ "内使用 item-relative path,例如 name、price 或 /item/name;"
+ "不要在模板内使用 /phones/name 这类集合绝对路径。"
+ )
+ image_url_rule_zh = (
+ " 不要编造图片 URL。如果需要外部事实或图片,可以短暂使用可用工具,"
+ "随后必须收敛到最终 A2UI 响应。使用用户提供的 HTTPS URL "
+ "或已验证的稳定来源 URL;不要使用猜测出来的 upload.wikimedia.org thumbnail 路径。"
+ )
+ autonomy_rule_zh = (
+ " A2UI 是可选能力。只有当生成式 UI 比纯文本更能改善用户体验时才使用 A2UI。"
+ "不要为寒暄、两三句话解释、简单事实回答或无结构普通文本强行生成 A2UI。"
+ "适合 A2UI 的通用场景包括:信息收集表单、可操作确认、多结果比较、"
+ "单对象详情、带媒体的卡片、仪表盘/状态/库存/任务摘要,以及工具结果的交互式展示。"
+ "对于真实世界推荐、对比、选购、排行、价格、旅行、餐厅或产品请求,"
+ "如果有可用工具,应先使用工具获取依据,再判断 A2UI 是否是最佳最终展示方式。"
+ "如果用户已经提供完整结构化数据,或明确要求演示 UI,可以直接渲染而不调用工具。"
+ "绝不能把 tool_call、invoke 或函数调用标签当作普通文本输出。"
+ )
+ requested_component_rule_zh = (
+ " 必须匹配用户请求的组件类型:如果用户要求输入框或文本框,生成 TextField/Form UI;"
+ "只有用户要求卡片或卡片列表时才生成 card list。Card/list 不是万能 fallback。"
+ "单个对象详情请求应生成单对象详情布局,不要生成多卡片 demo。"
+ "不要用固定 demo 替代用户请求的组件。对可编辑 TextField,必须把 TextField.text "
+ "绑定到 data model 路径,用 dataModelUpdate 初始化该路径,并在 Button.action.context "
+ "中用 path reference 包含提交值。表单提交不能输出空的 Button.action.context。"
+ + template_binding_rule_zh
+ + image_url_rule_zh
+ + icon_font_rule_en
+ + autonomy_rule_zh
+ )
+
+ if language in {"zh", "cn"}:
+ return (
+ "A2UI 是可选能力;不要强行使用 A2UI。"
+ "如果富交互界面比纯文本更适合当前回答,可以输出一段很短的说明,"
+ "然后输出一个合法的 <a2ui-json>...</a2ui-json> block。"
+ "如果不适合 A2UI,请直接纯文本回答。不要承诺使用 A2UI 却只输出 Markdown。"
+ "如果确实需要外部事实或图片,可以短暂使用可用工具,"
+ "随后自行判断是否用 A2UI 呈现。"
+ "block 内必须是 A2UI 0.8 server-to-client message list,"
+ "并且必须先 beginRendering,再 surfaceUpdate,再按需 dataModelUpdate。"
+ + requested_component_rule_zh
+ )
+ return (
+ "A2UI is optional. Keep tools available. If a rich interactive interface "
+ "is better than plain text for this answer, output a very short intro "
+ "followed by one valid <a2ui-json>...</a2ui-json> block. If A2UI is not "
+ "appropriate, answer in plain text. Do not promise to show the result with "
+ "A2UI and then output only Markdown. If external facts or images are needed, "
+ "use the available tools briefly, then decide whether A2UI is the best "
+ "presentation. The block must contain an A2UI 0.8 "
+ "server-to-client message list, with beginRendering before "
+ "surfaceUpdate and dataModelUpdate only when needed."
+ + autonomy_rule_en
+ + requested_component_rule_en
+ )
+
+
+__all__ = [
+ "build_a2ui_autonomy_instruction",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/protocol.py b/jiuwenswarm/server/runtime/a2ui/protocol.py
new file mode 100644
index 0000000000..cc4c825903
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/protocol.py
@@ -0,0 +1,311 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""A2UI v0.8 protocol adapter and public protocol facade."""
+
+from __future__ import annotations
+
+import json
+import logging
+from functools import lru_cache
+from pathlib import Path
+from typing import Any
+
+from a2ui.basic_catalog.provider import BasicCatalog
+from a2ui.schema.common_modifiers import remove_strict_validation
+from a2ui.schema.constants import A2UI_CLOSE_TAG, A2UI_OPEN_TAG, VERSION_0_8
+from a2ui.schema.manager import A2uiSchemaManager
+
+from jiuwenswarm.server.runtime.a2ui.parser import (
+ coerce_message_list,
+ may_contain_a2ui_content,
+ parse_a2ui_response,
+)
+from jiuwenswarm.server.runtime.a2ui.prompt_instructions import build_a2ui_autonomy_instruction
+from jiuwenswarm.server.runtime.a2ui.stream_guard import A2UIStreamGuard
+from jiuwenswarm.server.runtime.a2ui.text_formatter import format_for_text_channel
+from jiuwenswarm.server.runtime.a2ui.types import A2UIExample, A2UIResponsePart, A2UIValidationResult
+from jiuwenswarm.server.runtime.a2ui.validator import (
+ validate_a2ui_messages,
+ validate_a2ui_response,
+)
+
+
+A2UI_ACTIVE_PROTOCOL_VERSION = VERSION_0_8
+A2UI_CLIENT_EVENT_TYPE = "a2ui.client_event"
+logger = logging.getLogger(__name__)
+
+_SDK_JSON_OBJECT_WORKFLOW_LINE = (
+ "- The JSON part MUST be a single, raw JSON object (usually a list of A2UI "
+ "messages) and MUST validate against the provided A2UI JSON SCHEMA."
+)
+_JWC_JSON_LIST_WORKFLOW_LINE = (
+ "- The JSON part MUST be a JSON list of A2UI messages and MUST validate "
+ "against the provided A2UI JSON SCHEMA."
+)
+
+
+def _resources_dir() -> Path:
+ return Path(__file__).resolve().parents[1] / "resources"
+
+
+def _examples_dir(version: str) -> Path:
+ # Keep the on-disk directory version literal aligned with the SDK version.
+ return _resources_dir() / "a2ui" / "examples" / version
+
+
+def _load_json_file(path: Path) -> Any:
+ with path.open("r", encoding="utf-8") as f:
+ return json.load(f)
+
+
+def _normalize_prompt_contract(prompt: str) -> str:
+ """Remove SDK default wording that conflicts with jiuwenswarm's v0.8 contract."""
+ return prompt.replace(
+ _SDK_JSON_OBJECT_WORKFLOW_LINE,
+ _JWC_JSON_LIST_WORKFLOW_LINE,
+ )
+
+
+class A2UIProtocolSpec:
+ """Versioned A2UI protocol adapter.
+
+ The registry starts with v0.8 only. Future versions should be added as new
+ A2UIProtocolSpec instances rather than modifying call sites.
+ """
+
+ def __init__(self, version: str) -> None:
+ if version != VERSION_0_8:
+ raise ValueError(f"Unsupported A2UI protocol version: {version}")
+ self.version = version
+ self.examples_dir = _examples_dir(version)
+ self.schema_manager = A2uiSchemaManager(
+ version=version,
+ catalogs=[BasicCatalog.get_config(version=version)],
+ schema_modifiers=[remove_strict_validation],
+ )
+
+ @property
+ def catalog(self):
+ return self.schema_manager.get_selected_catalog()
+
+ def build_prompt(self, language: str = "en") -> str:
+ if language in {"zh", "cn"}:
+ role = (
+ "你是 jiuwenswarm 的 A2UI 生成器。遇到适合富交互界面的回答时,"
+ "必须生成严格符合 A2UI 0.8 schema 的消息。"
+ )
+ ui = (
+ "当用户需要列表、卡片、表单、确认结果、可点击操作或结构化信息比较时使用 A2UI。"
+ "普通解释、简短回答、敏感内容或不需要交互的回答保持纯文本。"
+ )
+ workflow = (
+ "如果使用 A2UI,回答可以包含说明文本和一个或多个 A2UI JSON block。"
+ f"每个 block 必须用 {A2UI_OPEN_TAG} 和 {A2UI_CLOSE_TAG} 包装。"
+ "block 内必须是 JSON list,list 中每个元素都是 A2UI server-to-client message。"
+ "必须先输出 beginRendering,再输出 surfaceUpdate;如果使用数据绑定,再按需输出 dataModelUpdate。"
+ "父组件必须先于子组件出现。不要输出其他协议版本的 schema、字段或组件。"
+ )
+ else:
+ role = (
+ "You are jiuwenswarm's A2UI generator. When a rich interactive "
+ "answer is appropriate, generate messages that strictly validate "
+ "against the A2UI 0.8 schema."
+ )
+ ui = (
+ "Use A2UI for lists, cards, forms, confirmations, clickable "
+ "actions, and structured comparisons. Keep ordinary explanations, "
+ "short answers, sensitive answers, and non-interactive replies as "
+ "plain text."
+ )
+ workflow = (
+ "When using A2UI, the response may contain conversational text and "
+ f"one or more A2UI JSON blocks wrapped in {A2UI_OPEN_TAG} and "
+ f"{A2UI_CLOSE_TAG}. The JSON inside each block MUST be a JSON list "
+ "of A2UI server-to-client messages. Emit beginRendering before "
+ "surfaceUpdate; include dataModelUpdate only when data binding is "
+ "needed. List parent components before child components. Do not "
+ "emit schema, fields, or components from any protocol version "
+ "other than 0.8."
+ )
+
+ workflow = f"{workflow}\n\n{build_a2ui_autonomy_instruction(language)}"
+ prompt = self.schema_manager.generate_system_prompt(
+ role_description=role,
+ workflow_description=workflow,
+ ui_description=ui,
+ include_schema=True,
+ include_examples=False,
+ validate_examples=True,
+ )
+ prompt = _normalize_prompt_contract(prompt)
+ examples = self.render_examples(validate=True)
+ if examples:
+ prompt = f"{prompt}\n\n### Examples:\n{examples}"
+ return prompt
+
+ def load_examples(self) -> list[A2UIExample]:
+ examples: list[A2UIExample] = []
+ if not self.examples_dir.exists():
+ return examples
+ for path in sorted(self.examples_dir.glob("*.json")):
+ messages = coerce_message_list(_load_json_file(path))
+ if messages is not None:
+ examples.append(A2UIExample(path.stem, path, messages))
+ return examples
+
+ def render_examples(self, *, validate: bool = False) -> str:
+ rendered: list[str] = []
+ for example in self.load_examples():
+ if validate:
+ self.validate_messages(example.messages)
+ rendered.append(
+ f"---BEGIN {example.name}---\n"
+ f"{json.dumps(example.messages, ensure_ascii=False, indent=2)}\n"
+ f"---END {example.name}---"
+ )
+ return "\n\n".join(rendered)
+
+ @staticmethod
+ def parse_response(content: str) -> list[A2UIResponsePart]:
+ return parse_a2ui_response(content)
+
+ def validate_messages(self, messages: list[dict[str, Any]]) -> None:
+ validate_a2ui_messages(self.catalog, messages)
+
+ def validate_response(self, content: str) -> A2UIValidationResult:
+ return validate_a2ui_response(
+ content,
+ parse_response=self.parse_response,
+ validate_messages=self.validate_messages,
+ )
+
+ @staticmethod
+ def may_contain_a2ui_content(content: str) -> bool:
+ """Return whether content looks like tagged, raw, or JSONL A2UI output."""
+ return may_contain_a2ui_content(content)
+
+ def build_repair_prompt(
+ self,
+ invalid_content: str,
+ validation_error: str,
+ user_query: str | None = None,
+ ) -> str:
+ query_section = (
+ f"Original user request:\n{user_query}\n\n"
+ if user_query
+ else ""
+ )
+ schema_prompt = self.build_prompt(language="en")
+ return (
+ "Your previous A2UI response was invalid. "
+ f"Validation error: {validation_error}\n\n"
+ f"{query_section}"
+ "Return only a valid A2UI 0.8 response. Every A2UI JSON block must be "
+ f"wrapped in {A2UI_OPEN_TAG} and {A2UI_CLOSE_TAG}; each block must "
+ "contain a JSON list of server-to-client messages that validates "
+ "against the provided schema. Do not call tools. Do not explain the "
+ "repair.\n\n"
+ f"Schema and examples:\n{schema_prompt}\n\n"
+ f"Invalid response:\n{invalid_content}"
+ )
+
+ def format_for_text_channel(self, content: str) -> str:
+ return format_for_text_channel(
+ content,
+ parse_response=self.parse_response,
+ validate_response=self.validate_response,
+ )
+
+
+@lru_cache(maxsize=4)
+def get_protocol_spec(version: str = A2UI_ACTIVE_PROTOCOL_VERSION) -> A2UIProtocolSpec:
+ """Return a cached protocol spec.
+
+ The A2UI schema and bundled examples are loaded once per protocol version;
+ runtime hot-reload is intentionally not supported.
+ """
+ if version != VERSION_0_8:
+ raise ValueError(f"Unsupported A2UI protocol version: {version}")
+ return A2UIProtocolSpec(version)
+
+
+def build_a2ui_prompt_section(language: str = "en") -> str:
+ return get_protocol_spec().build_prompt(language)
+
+
+def format_a2ui_for_text_channel(content: str, version: str = VERSION_0_8) -> str:
+ return get_protocol_spec(version).format_for_text_channel(content)
+
+
+def format_content_for_channel(content: str, channel_id: str | None) -> str:
+ if str(channel_id or "").lower() == "web":
+ return content
+ spec = get_protocol_spec()
+ if not spec.may_contain_a2ui_content(content):
+ return content
+ formatted = format_a2ui_for_text_channel(content)
+ return formatted or ""
+
+
+def is_a2ui_client_event(value: Any) -> bool:
+ return isinstance(value, dict) and value.get("type") == A2UI_CLIENT_EVENT_TYPE
+
+
+def _log_a2ui_client_event(event: dict[str, Any]) -> None:
+ payload = event.get("event")
+ user_action = payload.get("userAction") if isinstance(payload, dict) else None
+ if not isinstance(user_action, dict):
+ logger.info("A2UI client event received without userAction")
+ return
+
+ context = user_action.get("context")
+ context_keys = sorted(context.keys()) if isinstance(context, dict) else []
+ logger.info(
+ "A2UI client event received: action=%s surfaceId=%s "
+ "sourceComponentId=%s context_keys=%s",
+ user_action.get("name"),
+ user_action.get("surfaceId"),
+ user_action.get("sourceComponentId"),
+ context_keys,
+ )
+
+
+def build_a2ui_client_event_prompt(event: dict[str, Any], channel: str, language: str) -> str:
+ _log_a2ui_client_event(event)
+ prefix = (
+ "你收到了一次 A2UI 组件交互。请把 event.userAction.context "
+ "视为用户提交的值。对于普通表单或按钮提交,请直接、简洁地使用首选回复语言回答。"
+ "不要调用工具、读写记忆或创建文件,除非该 action 明确要求外部工作。\n"
+ if language in {"zh", "cn"}
+ else (
+ "You receive an A2UI component interaction. Treat event.userAction.context "
+ "as values submitted by the user. For normal form/button submissions, "
+ "answer directly and concisely in the preferred response language. Do not "
+ "call tools, read/write memory, or create files unless the action explicitly "
+ "requests external work.\n"
+ )
+ )
+ payload = {
+ "source": channel,
+ "preferred_response_language": language,
+ "type": A2UI_CLIENT_EVENT_TYPE,
+ "protocolVersion": event.get("protocolVersion", VERSION_0_8),
+ "event": event.get("event", {}),
+ }
+ return prefix + json.dumps(payload, ensure_ascii=False)
+
+
+__all__ = [
+ "A2UI_ACTIVE_PROTOCOL_VERSION",
+ "A2UI_CLIENT_EVENT_TYPE",
+ "A2UI_CLOSE_TAG",
+ "A2UI_OPEN_TAG",
+ "A2UIProtocolSpec",
+ "A2UIStreamGuard",
+ "build_a2ui_client_event_prompt",
+ "build_a2ui_prompt_section",
+ "format_a2ui_for_text_channel",
+ "format_content_for_channel",
+ "get_protocol_spec",
+ "is_a2ui_client_event",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/protocols/__init__.py b/jiuwenswarm/server/runtime/a2ui/protocols/__init__.py
new file mode 100644
index 0000000000..89ddd652b4
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/protocols/__init__.py
@@ -0,0 +1,10 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Versioned A2UI protocol registry exports."""
+
+from jiuwenswarm.server.runtime.a2ui.protocol import (
+ A2UIProtocolSpec,
+ get_protocol_spec,
+)
+
+__all__ = ["A2UIProtocolSpec", "get_protocol_spec"]
diff --git a/jiuwenswarm/server/runtime/a2ui/runtime/__init__.py b/jiuwenswarm/server/runtime/a2ui/runtime/__init__.py
new file mode 100644
index 0000000000..94a5935468
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/runtime/__init__.py
@@ -0,0 +1,23 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Runtime helpers for A2UI request handling."""
+
+from jiuwenswarm.server.runtime.a2ui.protocol import (
+ A2UIStreamGuard,
+ build_a2ui_client_event_prompt,
+ build_a2ui_prompt_section,
+ format_a2ui_for_text_channel,
+ format_content_for_channel,
+ is_a2ui_client_event,
+)
+from jiuwenswarm.server.runtime.a2ui.runtime.response_finalization import finalize_a2ui_assistant_content
+
+__all__ = [
+ "A2UIStreamGuard",
+ "build_a2ui_client_event_prompt",
+ "build_a2ui_prompt_section",
+ "finalize_a2ui_assistant_content",
+ "format_a2ui_for_text_channel",
+ "format_content_for_channel",
+ "is_a2ui_client_event",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/runtime/finalizer.py b/jiuwenswarm/server/runtime/a2ui/runtime/finalizer.py
new file mode 100644
index 0000000000..cfe3eb84fd
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/runtime/finalizer.py
@@ -0,0 +1,89 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Final validation and repair for model-emitted A2UI responses."""
+
+from __future__ import annotations
+
+import inspect
+from collections.abc import Callable
+from typing import Any
+
+from jiuwenswarm.server.runtime.a2ui.protocol import A2UI_OPEN_TAG, get_protocol_spec
+
+
+RepairCall = Callable[[str], Any]
+
+
+def _coerce_model_message_content(message: Any) -> str:
+ if isinstance(message, str):
+ return message
+ if isinstance(message, dict):
+ value = message.get("content") or message.get("output") or ""
+ return value if isinstance(value, str) else str(value)
+ value = getattr(message, "content", None)
+ if isinstance(value, str):
+ return value
+ value = getattr(message, "output", None)
+ if isinstance(value, str):
+ return value
+ return str(message) if message is not None else ""
+
+
+def _a2ui_failure_text(content: str, validation_error: str) -> str:
+ spec = get_protocol_spec()
+ readable = spec.format_for_text_channel(content)
+ if readable:
+ return (
+ "A2UI 界面生成失败,已退回纯文本结果。\n\n"
+ f"{readable}"
+ )
+ return (
+ "A2UI 界面生成失败,模型连续返回了不符合 A2UI 0.8 schema "
+ f"的内容。最后一次校验错误:{validation_error}"
+ )
+
+
+class A2UIResponseFinalizer:
+ """Validate, repair, or safely degrade a complete assistant response."""
+
+ async def finalize(
+ self,
+ content: str,
+ *,
+ user_query: Any,
+ request_id: str,
+ repair_call: RepairCall | None,
+ max_repair_attempts: int = 2,
+ ) -> str:
+ _ = request_id
+ if A2UI_OPEN_TAG not in (content or ""):
+ return content
+
+ spec = get_protocol_spec()
+ validation = spec.validate_response(content)
+ if validation.valid:
+ return content
+
+ repaired_content = content
+ last_error = validation.error
+ for _attempt in range(1, max_repair_attempts + 1):
+ if repair_call is None:
+ break
+ prompt = spec.build_repair_prompt(
+ invalid_content=repaired_content,
+ validation_error=last_error,
+ user_query=str(user_query or ""),
+ )
+ response = repair_call(prompt)
+ if inspect.isawaitable(response):
+ response = await response
+ repaired_content = _coerce_model_message_content(response)
+ validation = spec.validate_response(repaired_content)
+ if validation.valid:
+ return repaired_content
+ last_error = validation.error
+
+ return _a2ui_failure_text(repaired_content, last_error)
+
+
+__all__ = ["A2UIResponseFinalizer"]
diff --git a/jiuwenswarm/server/runtime/a2ui/runtime/formatter.py b/jiuwenswarm/server/runtime/a2ui/runtime/formatter.py
new file mode 100644
index 0000000000..5473b37eb8
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/runtime/formatter.py
@@ -0,0 +1,10 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Legacy A2UI text formatting helpers kept for compatibility."""
+
+from jiuwenswarm.server.runtime.a2ui.protocol import (
+ format_a2ui_for_text_channel,
+ format_content_for_channel,
+)
+
+__all__ = ["format_a2ui_for_text_channel", "format_content_for_channel"]
diff --git a/jiuwenswarm/server/runtime/a2ui/runtime/prompt.py b/jiuwenswarm/server/runtime/a2ui/runtime/prompt.py
new file mode 100644
index 0000000000..57b880fe73
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/runtime/prompt.py
@@ -0,0 +1,13 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""A2UI prompt builders."""
+
+from jiuwenswarm.server.runtime.a2ui.protocol import (
+ build_a2ui_client_event_prompt,
+ build_a2ui_prompt_section,
+)
+
+__all__ = [
+ "build_a2ui_client_event_prompt",
+ "build_a2ui_prompt_section",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/runtime/response_finalization.py b/jiuwenswarm/server/runtime/a2ui/runtime/response_finalization.py
new file mode 100644
index 0000000000..00f66f8a90
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/runtime/response_finalization.py
@@ -0,0 +1,44 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Runtime helpers for validating and repairing assistant A2UI responses."""
+
+from __future__ import annotations
+
+import logging
+from typing import Any
+
+from jiuwenswarm.server.runtime.a2ui.runtime.finalizer import A2UIResponseFinalizer, RepairCall
+
+
+logger = logging.getLogger(__name__)
+
+
+async def finalize_a2ui_assistant_content(
+ content: str,
+ *,
+ user_query: Any,
+ request_id: str,
+ repair_call: RepairCall | None,
+ a2ui_enabled: bool,
+) -> str:
+ """Validate and repair a complete assistant response when A2UI is enabled."""
+ if not a2ui_enabled or not isinstance(content, str) or "<a2ui-json>" not in content:
+ return content
+
+ try:
+ finalized = await A2UIResponseFinalizer().finalize(
+ content,
+ user_query=user_query,
+ request_id=request_id,
+ repair_call=repair_call,
+ )
+ except Exception as exc: # noqa: BLE001
+ logger.exception("A2UI response finalization failed: request_id=%s error=%s", request_id, exc)
+ return content
+
+ if finalized != content:
+ logger.info("A2UI response finalized: request_id=%s changed=true", request_id)
+ return finalized
+
+
+__all__ = ["finalize_a2ui_assistant_content"]
diff --git a/jiuwenswarm/server/runtime/a2ui/runtime/stream.py b/jiuwenswarm/server/runtime/a2ui/runtime/stream.py
new file mode 100644
index 0000000000..2f2b3884b5
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/runtime/stream.py
@@ -0,0 +1,7 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""A2UI streaming output guard."""
+
+from jiuwenswarm.server.runtime.a2ui.protocol import A2UIStreamGuard
+
+__all__ = ["A2UIStreamGuard"]
diff --git a/jiuwenswarm/server/runtime/a2ui/stream_guard.py b/jiuwenswarm/server/runtime/a2ui/stream_guard.py
new file mode 100644
index 0000000000..f8ec7d9394
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/stream_guard.py
@@ -0,0 +1,78 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Streaming guard for tagged A2UI blocks."""
+
+from __future__ import annotations
+
+from typing import Any
+
+from a2ui.schema.constants import A2UI_CLOSE_TAG, A2UI_OPEN_TAG
+
+
+class A2UIStreamGuard:
+ """Buffers A2UI blocks during streaming until they can be validated."""
+
+ def __init__(self, spec: Any | None = None) -> None:
+ if spec is None:
+ from jiuwenswarm.server.runtime.a2ui.protocol import get_protocol_spec
+
+ spec = get_protocol_spec()
+ self._spec = spec
+ self._buffer = ""
+ self._inside_block = False
+
+ def feed(self, content: str) -> list[str]:
+ if not content:
+ return []
+ self._buffer += content
+ return self._drain()
+
+ def finish(self) -> list[str]:
+ if not self._buffer:
+ return []
+ if self._inside_block:
+ fallback = self._spec.format_for_text_channel(self._buffer)
+ self._buffer = ""
+ self._inside_block = False
+ return [fallback] if fallback else []
+ remaining = self._buffer
+ self._buffer = ""
+ return [remaining] if remaining else []
+
+ def _drain(self) -> list[str]:
+ emitted: list[str] = []
+ while self._buffer:
+ if not self._inside_block:
+ start = self._buffer.find(A2UI_OPEN_TAG)
+ if start < 0:
+ # Keep a small suffix in case the tag is split across chunks.
+ keep = max(len(A2UI_OPEN_TAG) - 1, 0)
+ if len(self._buffer) <= keep:
+ break
+ emitted.append(self._buffer[:-keep])
+ self._buffer = self._buffer[-keep:]
+ break
+ if start > 0:
+ emitted.append(self._buffer[:start])
+ self._buffer = self._buffer[start:]
+ self._inside_block = True
+
+ end = self._buffer.find(A2UI_CLOSE_TAG)
+ if end < 0:
+ break
+
+ block_end = end + len(A2UI_CLOSE_TAG)
+ block = self._buffer[:block_end]
+ self._buffer = self._buffer[block_end:]
+ self._inside_block = False
+ validation = self._spec.validate_response(block)
+ if validation.valid:
+ emitted.append(block)
+ else:
+ fallback = self._spec.format_for_text_channel(block)
+ if fallback:
+ emitted.append(fallback)
+ return [item for item in emitted if item]
+
+
+__all__ = ["A2UIStreamGuard"]
diff --git a/jiuwenswarm/server/runtime/a2ui/support.py b/jiuwenswarm/server/runtime/a2ui/support.py
new file mode 100644
index 0000000000..d6bf17cc5d
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/support.py
@@ -0,0 +1,48 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Compatibility facade for the modular A2UI feature package.
+
+New code should import from the focused modules directly. This facade exposes
+the remaining A2UI protocol and formatting helpers for older internal tests.
+"""
+
+from jiuwenswarm.server.runtime.a2ui.prompt_instructions import build_a2ui_autonomy_instruction
+from jiuwenswarm.server.runtime.a2ui.protocol import (
+ A2UI_ACTIVE_PROTOCOL_VERSION,
+ A2UI_CLIENT_EVENT_TYPE,
+ A2UI_CLOSE_TAG,
+ A2UI_OPEN_TAG,
+ A2UIProtocolSpec,
+ A2UIStreamGuard,
+ build_a2ui_client_event_prompt,
+ build_a2ui_prompt_section,
+ format_a2ui_for_text_channel,
+ format_content_for_channel,
+ get_protocol_spec,
+ is_a2ui_client_event,
+)
+from jiuwenswarm.server.runtime.a2ui.types import (
+ A2UIExample,
+ A2UIResponsePart,
+ A2UIValidationResult,
+)
+
+
+__all__ = [
+ "A2UI_ACTIVE_PROTOCOL_VERSION",
+ "A2UI_CLIENT_EVENT_TYPE",
+ "A2UI_CLOSE_TAG",
+ "A2UI_OPEN_TAG",
+ "A2UIExample",
+ "A2UIProtocolSpec",
+ "A2UIResponsePart",
+ "A2UIStreamGuard",
+ "A2UIValidationResult",
+ "build_a2ui_autonomy_instruction",
+ "build_a2ui_client_event_prompt",
+ "build_a2ui_prompt_section",
+ "format_a2ui_for_text_channel",
+ "format_content_for_channel",
+ "get_protocol_spec",
+ "is_a2ui_client_event",
+]
diff --git a/jiuwenswarm/server/runtime/a2ui/text_formatter.py b/jiuwenswarm/server/runtime/a2ui/text_formatter.py
new file mode 100644
index 0000000000..bca2a5c6a4
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/text_formatter.py
@@ -0,0 +1,113 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Format A2UI responses into plain text for fallback paths."""
+
+from __future__ import annotations
+
+from collections.abc import Callable
+from typing import Any
+
+from a2ui.schema.constants import A2UI_OPEN_TAG
+
+from jiuwenswarm.server.runtime.a2ui.parser import strip_tagged_a2ui_blocks
+from jiuwenswarm.server.runtime.a2ui.types import A2UIResponsePart, A2UIValidationResult
+
+
+def _literal_value(value: Any) -> str | None:
+ if not isinstance(value, dict):
+ return None
+ for key in (
+ "literalString",
+ "literalNumber",
+ "literalBoolean",
+ "valueString",
+ "valueNumber",
+ "valueBoolean",
+ ):
+ if key in value:
+ return str(value[key])
+ return None
+
+
+def _extract_component_text(component_node: dict[str, Any]) -> list[str]:
+ component = component_node.get("component")
+ if not isinstance(component, dict):
+ return []
+
+ snippets: list[str] = []
+ for component_name, props in component.items():
+ if not isinstance(props, dict):
+ continue
+ if component_name == "Text":
+ text = _literal_value(props.get("text"))
+ if text:
+ snippets.append(text)
+ elif component_name in {"TextField", "CheckBox", "Slider"}:
+ label = _literal_value(props.get("label"))
+ if label:
+ snippets.append(label)
+ elif component_name == "MultipleChoice":
+ for option in props.get("options") or []:
+ if isinstance(option, dict):
+ label = _literal_value(option.get("label"))
+ if label:
+ snippets.append(label)
+ elif component_name == "Button":
+ action = props.get("action")
+ if isinstance(action, dict) and action.get("name"):
+ snippets.append(f"Action: {action['name']}")
+ return snippets
+
+
+def _summarize_messages(messages: list[dict[str, Any]]) -> list[str]:
+ lines: list[str] = []
+ for message in messages:
+ if "beginRendering" in message:
+ surface_id = message["beginRendering"].get("surfaceId", "default")
+ lines.append(f"A2UI surface: {surface_id}")
+ elif "surfaceUpdate" in message:
+ components = message["surfaceUpdate"].get("components") or []
+ for component in components:
+ if isinstance(component, dict):
+ lines.extend(_extract_component_text(component))
+ elif "dataModelUpdate" in message:
+ for entry in message["dataModelUpdate"].get("contents") or []:
+ if not isinstance(entry, dict):
+ continue
+ value = _literal_value(entry)
+ if value:
+ lines.append(f"{entry.get('key')}: {value}")
+ elif "deleteSurface" in message:
+ surface_id = message["deleteSurface"].get("surfaceId", "default")
+ lines.append(f"A2UI surface deleted: {surface_id}")
+ return lines
+
+
+def format_for_text_channel(
+ content: str,
+ *,
+ parse_response: Callable[[str], list[A2UIResponsePart]],
+ validate_response: Callable[[str], A2UIValidationResult],
+) -> str:
+ if A2UI_OPEN_TAG in (content or ""):
+ validation = validate_response(content)
+ if not validation.valid:
+ return strip_tagged_a2ui_blocks(content)
+ try:
+ parts = parse_response(content)
+ except Exception:
+ return ""
+ lines: list[str] = []
+ for part in parts:
+ if part.kind == "text" and part.text.strip():
+ lines.append(part.text.strip())
+ continue
+ if part.kind != "a2ui":
+ continue
+ summary = _summarize_messages(part.messages or [])
+ if summary:
+ lines.extend(summary)
+ return "\n".join(line for line in lines if line).strip()
+
+
+__all__ = ["format_for_text_channel"]
diff --git a/jiuwenswarm/server/runtime/a2ui/types.py b/jiuwenswarm/server/runtime/a2ui/types.py
new file mode 100644
index 0000000000..d6489a21dc
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/types.py
@@ -0,0 +1,35 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Shared A2UI runtime data structures."""
+
+from __future__ import annotations
+
+from dataclasses import dataclass
+from pathlib import Path
+from typing import Any, Literal
+
+
+@dataclass(frozen=True)
+class A2UIResponsePart:
+ """One parsed segment from a mixed text and A2UI assistant response."""
+
+ kind: Literal["text", "a2ui"]
+ text: str = ""
+ messages: list[dict[str, Any]] | None = None
+
+
+@dataclass(frozen=True)
+class A2UIExample:
+ """Loaded A2UI example used to ground prompt instructions."""
+
+ name: str
+ path: Path
+ messages: list[dict[str, Any]]
+
+
+@dataclass(frozen=True)
+class A2UIValidationResult:
+ """Validation outcome for model-emitted A2UI content."""
+
+ valid: bool
+ error: str = ""
diff --git a/jiuwenswarm/server/runtime/a2ui/validator.py b/jiuwenswarm/server/runtime/a2ui/validator.py
new file mode 100644
index 0000000000..de8ee2c8f2
--- /dev/null
+++ b/jiuwenswarm/server/runtime/a2ui/validator.py
@@ -0,0 +1,321 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""A2UI schema and runtime semantic validation."""
+
+from __future__ import annotations
+
+import json
+from collections.abc import Callable
+from typing import Any
+
+from jiuwenswarm.server.runtime.a2ui.parser import (
+ coerce_message_list,
+ iter_tagged_block_bodies,
+)
+from jiuwenswarm.server.runtime.a2ui.types import A2UIResponsePart, A2UIValidationResult
+
+
+def _normalize_data_path(path: Any) -> str:
+ if not isinstance(path, str) or not path.strip() or path == "/":
+ return "/"
+ return "/" + path.strip("/")
+
+
+def _join_data_path(base_path: str, key: str) -> str:
+ normalized_base = _normalize_data_path(base_path)
+ if key == ".":
+ return normalized_base
+ if normalized_base == "/":
+ return f"/{key}"
+ return f"{normalized_base}/{key}"
+
+
+def _validate_value_map_keys(entries: Any, path: str) -> None:
+ if not isinstance(entries, list):
+ return
+ seen: set[str] = set()
+ for entry in entries:
+ if not isinstance(entry, dict):
+ continue
+ key = entry.get("key")
+ if not isinstance(key, str):
+ continue
+ if key in seen:
+ raise ValueError(f"Duplicate dataModelUpdate key at {path}: {key}")
+ seen.add(key)
+ nested = entry.get("valueMap")
+ if isinstance(nested, list):
+ _validate_value_map_keys(nested, _join_data_path(path, key))
+
+
+def _index_data_model_entries(
+ entries: Any,
+ path: str,
+ index: dict[str, list[dict[str, Any]]],
+) -> None:
+ if not isinstance(entries, list):
+ return
+ index[_normalize_data_path(path)] = entries
+ for entry in entries:
+ if not isinstance(entry, dict):
+ continue
+ key = entry.get("key")
+ nested = entry.get("valueMap")
+ if isinstance(key, str) and isinstance(nested, list):
+ _index_data_model_entries(nested, _join_data_path(path, key), index)
+
+
+def _build_data_model_index(messages: list[dict[str, Any]]) -> dict[str, list[dict[str, Any]]]:
+ index: dict[str, list[dict[str, Any]]] = {}
+ for message in messages:
+ update = message.get("dataModelUpdate")
+ if not isinstance(update, dict):
+ continue
+ path = _normalize_data_path(update.get("path", "/"))
+ _index_data_model_entries(update.get("contents"), path, index)
+ return index
+
+
+def _iter_templates(value: Any) -> list[dict[str, Any]]:
+ templates: list[dict[str, Any]] = []
+ if isinstance(value, dict):
+ template = value.get("template")
+ if isinstance(template, dict):
+ templates.append(template)
+ for nested in value.values():
+ templates.extend(_iter_templates(nested))
+ elif isinstance(value, list):
+ for nested in value:
+ templates.extend(_iter_templates(nested))
+ return templates
+
+
+def _iter_component_references(value: Any, component_ids: set[str]) -> list[str]:
+ refs: list[str] = []
+ if isinstance(value, str):
+ if value in component_ids:
+ refs.append(value)
+ elif isinstance(value, dict):
+ explicit_list = value.get("explicitList")
+ if isinstance(explicit_list, list):
+ refs.extend(item for item in explicit_list if isinstance(item, str) and item in component_ids)
+ template = value.get("template")
+ if isinstance(template, dict):
+ component_id = template.get("componentId")
+ if isinstance(component_id, str) and component_id in component_ids:
+ refs.append(component_id)
+ for nested in value.values():
+ refs.extend(_iter_component_references(nested, component_ids))
+ elif isinstance(value, list):
+ for nested in value:
+ refs.extend(_iter_component_references(nested, component_ids))
+ return refs
+
+
+def _component_subtree_ids(
+ root_component_id: str,
+ components_by_id: dict[str, dict[str, Any]],
+) -> list[str]:
+ visited: set[str] = set()
+ ordered: list[str] = []
+ stack = [root_component_id]
+ component_ids = set(components_by_id)
+ while stack:
+ component_id = stack.pop()
+ if component_id in visited or component_id not in components_by_id:
+ continue
+ visited.add(component_id)
+ ordered.append(component_id)
+ refs = _iter_component_references(components_by_id[component_id], component_ids)
+ stack.extend(reversed(refs))
+ return ordered
+
+
+def _iter_binding_paths(value: Any) -> list[str]:
+ paths: list[str] = []
+ if isinstance(value, dict):
+ for key, nested in value.items():
+ if key == "dataBinding":
+ continue
+ if key == "path" and isinstance(nested, str):
+ paths.append(nested)
+ continue
+ paths.extend(_iter_binding_paths(nested))
+ elif isinstance(value, list):
+ for nested in value:
+ paths.extend(_iter_binding_paths(nested))
+ return paths
+
+
+def _is_valid_template_item_path(path: str) -> bool:
+ if not path.startswith("/"):
+ return True
+ return path in {"/item", "/text", "/label"} or path.startswith(
+ ("/item/", "/text/", "/label/")
+ )
+
+
+def _template_path_requires_object_item(path: str) -> bool:
+ if path in {"", "."}:
+ return False
+ normalized = path
+ for prefix in ("/item/", "./", "/"):
+ if normalized.startswith(prefix):
+ normalized = normalized[len(prefix):]
+ break
+ return bool(normalized and normalized not in {".", "item", "text", "label"})
+
+
+def _entry_is_object_like(entry: dict[str, Any]) -> bool:
+ if isinstance(entry.get("valueMap"), list):
+ return True
+ value = entry.get("valueString")
+ if isinstance(value, str):
+ try:
+ parsed = json.loads(value)
+ except json.JSONDecodeError:
+ return False
+ return isinstance(parsed, dict)
+ return False
+
+
+def _iter_image_url_literals(value: Any) -> list[str]:
+ urls: list[str] = []
+ if isinstance(value, dict):
+ image = value.get("Image")
+ if isinstance(image, dict):
+ url = image.get("url")
+ if isinstance(url, dict) and isinstance(url.get("literalString"), str):
+ urls.append(url["literalString"])
+ for nested in value.values():
+ urls.extend(_iter_image_url_literals(nested))
+ elif isinstance(value, list):
+ for nested in value:
+ urls.extend(_iter_image_url_literals(nested))
+ return urls
+
+
+def _validate_image_runtime_semantics(messages: list[dict[str, Any]]) -> None:
+ for url in _iter_image_url_literals(messages):
+ if url.startswith("https://upload.wikimedia.org/wikipedia/commons/thumb/"):
+ raise ValueError(
+ "A2UI Image.url must use a stable image URL. Hard-coded Wikimedia "
+ "thumbnail URLs are often guessed and can return 404; use a verified "
+ "HTTPS image URL or a Wikimedia Commons Special:FilePath URL instead."
+ )
+
+
+def _validate_template_runtime_semantics(messages: list[dict[str, Any]]) -> None:
+ data_model_index = _build_data_model_index(messages)
+ for message in messages:
+ update = message.get("dataModelUpdate")
+ if isinstance(update, dict):
+ _validate_value_map_keys(update.get("contents"), _normalize_data_path(update.get("path", "/")))
+
+ for message in messages:
+ surface_update = message.get("surfaceUpdate")
+ if not isinstance(surface_update, dict):
+ continue
+ components = surface_update.get("components")
+ if not isinstance(components, list):
+ continue
+ components_by_id = {
+ component.get("id"): component
+ for component in components
+ if isinstance(component, dict) and isinstance(component.get("id"), str)
+ }
+ for component in components_by_id.values():
+ for template in _iter_templates(component):
+ template_component_id = template.get("componentId")
+ data_binding = template.get("dataBinding")
+ if not isinstance(template_component_id, str) or not isinstance(data_binding, str):
+ continue
+ binding_path = _normalize_data_path(data_binding)
+ paths: list[str] = []
+ for component_id in _component_subtree_ids(template_component_id, components_by_id):
+ component_paths = _iter_binding_paths(components_by_id[component_id])
+ for path in component_paths:
+ if not _is_valid_template_item_path(path):
+ raise ValueError(
+ "A2UI template component paths must be item-relative; "
+ f"found {path!r} under template {template_component_id!r}. "
+ "Use paths like 'name', 'price', or '/item/name' so the "
+ "React renderer can resolve the clicked item's data."
+ )
+ paths.extend(component_paths)
+
+ entries = data_model_index.get(binding_path)
+ if not entries or not any(_template_path_requires_object_item(path) for path in paths):
+ continue
+ primitive_keys = [
+ entry.get("key")
+ for entry in entries
+ if isinstance(entry, dict) and not _entry_is_object_like(entry)
+ ]
+ if primitive_keys:
+ raise ValueError(
+ "A2UI template dataBinding must resolve to a collection of item objects; "
+ f"{binding_path} contains primitive entries {primitive_keys!r}. "
+ 'Encode repeated items as one collection key with indexed valueMap entries, '
+ 'for example key "0", key "1", each containing a nested valueMap.'
+ )
+
+
+def validate_a2ui_messages(catalog: Any, messages: list[dict[str, Any]]) -> None:
+ if not messages:
+ raise ValueError("A2UI message list is empty")
+ catalog.validator.validate(messages)
+ _validate_template_runtime_semantics(messages)
+ _validate_image_runtime_semantics(messages)
+
+
+def validate_a2ui_response(
+ content: str,
+ *,
+ parse_response: Callable[[str], list[A2UIResponsePart]],
+ validate_messages: Callable[[list[dict[str, Any]]], None],
+) -> A2UIValidationResult:
+ try:
+ tagged_blocks = iter_tagged_block_bodies(content or "")
+ if tagged_blocks:
+ for block_index, body in tagged_blocks:
+ try:
+ parsed = json.loads(body.strip())
+ except json.JSONDecodeError as exc:
+ return A2UIValidationResult(
+ valid=False,
+ error=(
+ f"A2UI block {block_index} at $: invalid JSON "
+ f"({exc.msg} at line {exc.lineno} column {exc.colno})"
+ ),
+ )
+ messages = coerce_message_list(parsed)
+ if messages is None:
+ return A2UIValidationResult(
+ valid=False,
+ error=(
+ f"A2UI block {block_index} at $: expected an A2UI "
+ "0.8 server-to-client message list"
+ ),
+ )
+ try:
+ validate_messages(messages)
+ except Exception as exc: # noqa: BLE001
+ return A2UIValidationResult(
+ valid=False,
+ error=f"A2UI block {block_index}: {exc}",
+ )
+ return A2UIValidationResult(valid=True)
+
+ for part in parse_response(content):
+ if part.kind == "a2ui":
+ validate_messages(part.messages or [])
+ return A2UIValidationResult(valid=True)
+ except Exception as exc: # noqa: BLE001
+ return A2UIValidationResult(valid=False, error=str(exc))
+
+
+__all__ = [
+ "validate_a2ui_messages",
+ "validate_a2ui_response",
+]
diff --git a/jiuwenswarm/server/runtime/agent_adapter/interface.py b/jiuwenswarm/server/runtime/agent_adapter/interface.py
index fc6571639c..f36d2ca430 100644
--- a/jiuwenswarm/server/runtime/agent_adapter/interface.py
+++ b/jiuwenswarm/server/runtime/agent_adapter/interface.py
@@ -45,6 +45,7 @@ from jiuwenswarm.common.utils import (
get_env_file,
reset_free_search_runtime_flags,
)
+from jiuwenswarm.server.runtime.a2ui.integration import finalize_assistant_response_if_a2ui
def _compact_stats_from_payload(payload: dict[str, Any]) -> dict[str, Any]:
@@ -90,6 +91,7 @@ reset_free_search_runtime_flags()
logger = logging.getLogger(__name__)
+
# SkillDev 请求方法集合(统一委托给 SkillDevService)
_SKILLDEV_METHODS: frozenset[ReqMethod] = frozenset(
m for m in ReqMethod if m.value.startswith("skilldev.")
@@ -159,9 +161,14 @@ def _handle_skills_use_slash_command(query: str) -> Tuple[list, str]:
return [], query
-def build_user_prompt(content: str, files: dict, channel: str, language: str, *,
+def build_user_prompt(content: str | dict, files: dict, channel: str, language: str, *,
trusted_dirs: list[str] | None = None, metadata: dict[str, Any] | None = None) -> str:
"""Build user prompt for the agent."""
+ from jiuwenswarm.server.runtime.a2ui.integration import build_user_prompt_if_a2ui_event
+
+ a2ui_prompt = build_user_prompt_if_a2ui_event(content, channel=channel, language=language)
+ if a2ui_prompt is not None:
+ return a2ui_prompt
interaction_prefix = ""
if metadata:
@@ -169,9 +176,12 @@ def build_user_prompt(content: str, files: dict, channel: str, language: str, *,
if interaction_ctx:
interaction_prefix = f"\n{interaction_ctx}\n\n"
- skills_to_use, new_content = _handle_skills_use_slash_command(content)
- if new_content:
- content = new_content
+ if isinstance(content, str):
+ skills_to_use, new_content = _handle_skills_use_slash_command(content)
+ if new_content:
+ content = new_content
+ else:
+ skills_to_use = []
if language == "zh":
prompt = "你收到一条消息:\n"
@@ -367,8 +377,10 @@ class JiuWenClaw:
config_base = get_config()
memory_mode = get_memory_mode(config_base)
- query = request.params.get("query", "")
- channel = request.session_id.split('_')[0] if request.session_id else "web"
+ query = request.params.get("query")
+ if query is None or query == "":
+ query = request.params.get("content", "")
+ channel = request.channel_id or (request.session_id.split('_')[0] if request.session_id else "web")
language = config_base.get("preferred_language", "zh")
# Get trusted directories from request params (passed by TUI)
@@ -868,6 +880,15 @@ class JiuWenClaw:
if result.ok and result.payload.get("content"):
content = result.payload["content"]
content_str = content if isinstance(content, str) else str(content)
+ repair_call = getattr(adapter, "repair_model_response", None)
+ content_str = await finalize_assistant_response_if_a2ui(
+ content_str,
+ channel=request.channel_id,
+ user_query=raw_query,
+ request_id=request.request_id or "",
+ repair_call=repair_call,
+ )
+ result.payload["content"] = content_str
append_history_record(
session_id=session_id,
request_id=request.request_id,
@@ -1147,6 +1168,35 @@ class JiuWenClaw:
logger.info("[JiuWenClaw] 流式处理被中断: request_id=%s", rid)
raise
+ assistant_message = final_answer_content or "".join(final_answer_chunks)
+ repair_call = getattr(adapter, "repair_model_response", None)
+ finalized_assistant_message = await finalize_assistant_response_if_a2ui(
+ assistant_message,
+ channel=cid,
+ user_query=raw_query,
+ request_id=rid or "",
+ repair_call=repair_call,
+ )
+ if finalized_assistant_message and finalized_assistant_message != assistant_message:
+ append_history_record(
+ session_id=session_id,
+ request_id=rid,
+ channel_id=cid,
+ role="assistant",
+ event_type="chat.final",
+ content=finalized_assistant_message,
+ timestamp=time.time(),
+ mode=request.params.get("mode", "unknown"),
+ )
+ final_answer_content = finalized_assistant_message
+ final_answer_chunks = []
+ yield AgentResponseChunk(
+ request_id=rid,
+ channel_id=cid,
+ payload={"event_type": "chat.final", "content": finalized_assistant_message},
+ is_complete=False,
+ )
+
# cloud memory: after chat hook
if memory_mode == "cloud":
assistant_message = final_answer_content or "".join(final_answer_chunks)
diff --git a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
index 1bd865c7b6..f55f9c6ddd 100644
--- a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
+++ b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
@@ -4763,7 +4763,7 @@ class JiuWenClawDeepAdapter:
async def _handle_slash_command(
self,
- query: str,
+ query: Any,
session_id: str = "default",
mode: str = "agent.plan",
) -> dict[str, Any] | None:
@@ -4773,6 +4773,9 @@ class JiuWenClawDeepAdapter:
The dict may contain an ``approval_chunks`` list that the caller
should forward to the frontend as separate stream events.
"""
+ if not isinstance(query, str):
+ return None
+
stripped = query.strip()
if stripped.startswith("/evolve_simplify"):
@@ -6255,6 +6258,25 @@ class JiuWenClawDeepAdapter:
logger.exception("[generate_recap] model call failed")
return None
+ async def repair_model_response(self, prompt: str) -> str | None:
+ """Run a focused repair prompt using the currently selected chat model."""
+ if self._model is None:
+ logger.warning("[JiuWenClawDeepAdapter] repair skipped: no model instance available")
+ return None
+ from openjiuwen.core.foundation.llm.schema.message import UserMessage
+
+ result = await self._model.invoke(
+ [UserMessage(content=prompt)],
+ temperature=0,
+ )
+ content = getattr(result, "content", None)
+ if isinstance(content, str):
+ return content
+ output = getattr(result, "output", None)
+ if isinstance(output, str):
+ return output
+ return str(result) if result is not None else None
+
async def _count_full_context_tokens(
self,
context: Any,
diff --git a/pyproject.toml b/pyproject.toml
index d59f9cb9ee..d09fad8edf 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,6 +12,7 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
]
dependencies = [
+ "a2ui-agent-sdk==0.2.1",
"chromadb>=1.5.0",
"ruamel.yaml>=0.18.0",
"lark-oapi>=1.5.3",
diff --git a/tests/system_tests/test_a2ui_system_flow.py b/tests/system_tests/test_a2ui_system_flow.py
new file mode 100644
index 0000000000..c42dcab627
--- /dev/null
+++ b/tests/system_tests/test_a2ui_system_flow.py
@@ -0,0 +1,85 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""System-level coverage for the A2UI response flow."""
+
+from __future__ import annotations
+
+import pytest
+
+pytestmark = [pytest.mark.integration, pytest.mark.system]
+
+
+VALID_A2UI_RESPONSE = """<a2ui-json>
+[
+ {
+ "beginRendering": {
+ "surfaceId": "system-test",
+ "root": "root"
+ }
+ },
+ {
+ "surfaceUpdate": {
+ "surfaceId": "system-test",
+ "components": [
+ {
+ "id": "root",
+ "component": {
+ "Text": {
+ "text": {
+ "literalString": "System test A2UI content"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+]
+</a2ui-json>"""
+
+
+async def test_a2ui_system_flow_accepts_event_and_valid_response(monkeypatch):
+ """Verify the A2UI host flow across config, prompt, event, and response."""
+ from jiuwenswarm.server.runtime.a2ui.config import get_a2ui_config
+ from jiuwenswarm.server.runtime.a2ui.integration import build_user_prompt_if_a2ui_event
+ from jiuwenswarm.server.runtime.a2ui.runtime.finalizer import A2UIResponseFinalizer
+ from jiuwenswarm.server.runtime.a2ui.runtime.prompt import build_a2ui_prompt_section
+ from jiuwenswarm.server.runtime.a2ui.protocol import get_protocol_spec
+
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+
+ config = get_a2ui_config({"a2ui": {"enabled": True}})
+ prompt_section = build_a2ui_prompt_section("en")
+ client_event = {
+ "type": "a2ui.client_event",
+ "event": {
+ "userAction": {
+ "name": "submit_selection",
+ "surfaceId": "system-test",
+ "sourceComponentId": "submit",
+ "context": {"selected": "alpha"},
+ }
+ },
+ }
+
+ client_prompt = build_user_prompt_if_a2ui_event(
+ client_event,
+ channel="web",
+ language="en",
+ )
+ finalized = await A2UIResponseFinalizer().finalize(
+ VALID_A2UI_RESPONSE,
+ user_query="show system test result",
+ request_id="system-a2ui-valid-response",
+ repair_call=lambda _: pytest.fail("valid A2UI response must not be repaired"),
+ )
+ validation = get_protocol_spec().validate_response(finalized)
+
+ assert config.enabled is True
+ assert "<a2ui-json>" in prompt_section
+ assert client_prompt is not None
+ assert "submit_selection" in client_prompt
+ assert "alpha" in client_prompt
+ assert finalized == VALID_A2UI_RESPONSE
+ assert validation.valid is True
diff --git a/tests/unit_tests/a2ui/test_feature_config.py b/tests/unit_tests/a2ui/test_feature_config.py
new file mode 100644
index 0000000000..ea5f3d1e1d
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_feature_config.py
@@ -0,0 +1,45 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+from __future__ import annotations
+
+
+def test_a2ui_config_defaults_enabled():
+ from jiuwenswarm.server.runtime.a2ui.config import get_a2ui_config
+
+ cfg = get_a2ui_config({})
+
+ assert cfg.enabled is True
+ assert cfg.protocol_version == "0.8"
+ assert cfg.stream_validation_enabled is True
+ assert cfg.non_web_fallback_enabled is False
+ assert cfg.dev_smoke_tools_enabled is False
+
+
+def test_a2ui_config_env_can_disable_feature(monkeypatch):
+ from jiuwenswarm.server.runtime.a2ui.config import get_a2ui_config
+
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "false")
+
+ cfg = get_a2ui_config({"a2ui": {"enabled": True}})
+
+ assert cfg.enabled is False
+
+
+def test_legacy_jiuwenclaw_env_alias_no_longer_overrides_config(monkeypatch):
+ from jiuwenswarm.server.runtime.a2ui.config import get_a2ui_config
+
+ monkeypatch.delenv("JIUWENSWARM_A2UI_ENABLED", raising=False)
+ monkeypatch.setenv("JIUWENCLAW_A2UI_ENABLED", "false")
+
+ cfg = get_a2ui_config({"a2ui": {"enabled": True}})
+
+ assert cfg.enabled is True
+
+
+def test_a2ui_config_rejects_unknown_protocol_version():
+ import pytest
+
+ from jiuwenswarm.server.runtime.a2ui.config import get_a2ui_config
+
+ with pytest.raises(ValueError, match="Unsupported A2UI protocol version"):
+ get_a2ui_config({"a2ui": {"protocol_version": "0.9"}})
diff --git a/tests/unit_tests/a2ui/test_finalizer.py b/tests/unit_tests/a2ui/test_finalizer.py
new file mode 100644
index 0000000000..add0f1e058
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_finalizer.py
@@ -0,0 +1,103 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+from types import SimpleNamespace
+
+import pytest
+
+
+VALID_A2UI_RESPONSE = """<a2ui-json>
+[
+ {
+ "beginRendering": {
+ "surfaceId": "default",
+ "root": "root"
+ }
+ },
+ {
+ "surfaceUpdate": {
+ "surfaceId": "default",
+ "components": [
+ {
+ "id": "root",
+ "component": {
+ "Text": {
+ "text": {
+ "literalString": "Valid repaired UI"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+]
+</a2ui-json>"""
+
+
+INVALID_A2UI_RESPONSE = """Here is the UI.
+<a2ui-json>
+[
+ {
+ "type": "beginRendering",
+ "version": "0.8"
+ }
+]
+</a2ui-json>"""
+
+
+async def test_a2ui_finalizer_repairs_invalid_tagged_response():
+ from jiuwenswarm.server.runtime.a2ui.runtime.finalizer import A2UIResponseFinalizer
+
+ prompts = []
+
+ async def repair_call(prompt: str):
+ prompts.append(prompt)
+ return SimpleNamespace(content=VALID_A2UI_RESPONSE)
+
+ result = await A2UIResponseFinalizer().finalize(
+ INVALID_A2UI_RESPONSE,
+ user_query="生成库存展示界面",
+ request_id="req-finalizer-repair",
+ repair_call=repair_call,
+ )
+
+ assert result == VALID_A2UI_RESPONSE
+ assert len(prompts) == 1
+ assert "生成库存展示界面" in prompts[0]
+ assert "A2UI 0.8" in prompts[0]
+
+
+async def test_a2ui_finalizer_falls_back_after_failed_repairs():
+ from jiuwenswarm.server.runtime.a2ui.runtime.finalizer import A2UIResponseFinalizer
+
+ async def repair_call(prompt: str):
+ return SimpleNamespace(content=INVALID_A2UI_RESPONSE)
+
+ result = await A2UIResponseFinalizer().finalize(
+ INVALID_A2UI_RESPONSE,
+ user_query="生成库存展示界面",
+ request_id="req-finalizer-fallback",
+ repair_call=repair_call,
+ )
+
+ assert "<a2ui-json>" not in result
+ assert "A2UI 界面生成失败" in result
+
+
+async def test_a2ui_finalizer_leaves_plain_text_untouched():
+ from jiuwenswarm.server.runtime.a2ui.runtime.finalizer import A2UIResponseFinalizer
+
+ async def repair_call(prompt: str):
+ raise AssertionError("plain text must not trigger repair")
+
+ result = await A2UIResponseFinalizer().finalize(
+ "plain answer",
+ user_query="你好",
+ request_id="req-finalizer-plain",
+ repair_call=repair_call,
+ )
+
+ assert result == "plain answer"
diff --git a/tests/unit_tests/a2ui/test_integration_bridge.py b/tests/unit_tests/a2ui/test_integration_bridge.py
new file mode 100644
index 0000000000..60fa82e44a
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_integration_bridge.py
@@ -0,0 +1,219 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Unit tests for the A2UI integration bridge.
+
+The bridge keeps A2UI-specific request/config/fallback decisions out of the
+core AgentServer and Gateway modules.
+"""
+
+from __future__ import annotations
+
+import builtins
+
+import pytest
+
+from jiuwenswarm.server.runtime.a2ui import integration
+from jiuwenswarm.server.runtime.a2ui.integration import (
+ apply_non_web_text_fallback_to_payload,
+ build_user_prompt_if_a2ui_event,
+ get_a2ui_config_payload,
+ is_a2ui_channel,
+ validate_a2ui_config_update,
+)
+
+
+def test_a2ui_channel_policy_is_web_only():
+ """A2UI should only be active for the controlled Web channel."""
+ assert is_a2ui_channel("web") is True
+ assert is_a2ui_channel("WEB") is True
+ assert is_a2ui_channel("feishu") is False
+ assert is_a2ui_channel("wechat") is False
+ assert is_a2ui_channel(None) is False
+
+
+def test_build_user_prompt_if_a2ui_event_disabled_returns_none(monkeypatch):
+ """Disabled A2UI should leave client-event payloads to normal handling."""
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "false")
+ event = {"type": "a2ui.client_event", "userAction": {"context": {"value": "ok"}}}
+
+ assert build_user_prompt_if_a2ui_event(event, channel="web", language="zh") is None
+
+
+def test_build_user_prompt_if_a2ui_event_enabled_mentions_context(monkeypatch):
+ """Enabled A2UI should translate client events into model-readable prompts."""
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+ monkeypatch.setattr(
+ integration,
+ "_build_a2ui_client_event_prompt",
+ lambda content, channel, language: (
+ f"{content['type']} on {channel}/{language}: context={content['userAction']['context']}"
+ ),
+ )
+ event = {"type": "a2ui.client_event", "userAction": {"context": {"value": "ok"}}}
+
+ prompt = build_user_prompt_if_a2ui_event(event, channel="web", language="zh")
+
+ assert prompt is not None
+ assert "a2ui.client_event" in prompt
+ assert "context" in prompt
+
+
+def test_build_user_prompt_if_a2ui_event_bypasses_non_web_channel(monkeypatch):
+ """Non-Web channels should not perceive structured A2UI client events."""
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+ event = {"type": "a2ui.client_event", "userAction": {"context": {"value": "ok"}}}
+
+ assert build_user_prompt_if_a2ui_event(event, channel="feishu", language="zh") is None
+
+
+def test_apply_non_web_text_fallback_skips_web_payload(monkeypatch):
+ """Web messages must keep raw A2UI blocks for the frontend renderer."""
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+ payload = {
+ "event_type": "chat.final",
+ "content": "hello <a2ui-json>[]</a2ui-json>",
+ }
+
+ assert apply_non_web_text_fallback_to_payload(payload, channel_id="web") is payload
+
+
+def test_apply_non_web_text_fallback_bypasses_non_web_payload(monkeypatch):
+ """Non-Web payloads should bypass A2UI fallback even when A2UI is enabled."""
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+ payload = {
+ "event_type": "chat.final",
+ "content": "hello <a2ui-json>[]</a2ui-json>",
+ }
+
+ assert apply_non_web_text_fallback_to_payload(payload, channel_id="telegram") is payload
+ assert payload["content"] == "hello <a2ui-json>[]</a2ui-json>"
+
+
+def test_message_handler_fallback_skips_a2ui_import_without_marker(monkeypatch):
+ """Gateway hot path should not import A2UI when payload has no A2UI marker."""
+ from jiuwenswarm.gateway.message_handler.message_handler import (
+ apply_a2ui_text_fallback_to_gateway_payload,
+ )
+
+ real_import = builtins.__import__
+
+ def guard_import(name, *args, **kwargs):
+ if name == "jiuwenswarm.server.runtime.a2ui.integration":
+ raise AssertionError("A2UI integration should not be imported")
+ return real_import(name, *args, **kwargs)
+
+ monkeypatch.setattr(builtins, "__import__", guard_import)
+ payload = {"event_type": "chat.final", "content": "plain text"}
+
+ assert apply_a2ui_text_fallback_to_gateway_payload(payload, channel_id="telegram") is payload
+
+
+def test_get_a2ui_config_payload_defaults():
+ """Config payloads should expose only user-facing A2UI Web keys."""
+ payload = get_a2ui_config_payload({"a2ui": {}})
+
+ assert payload == {"a2ui_enabled": "true"}
+
+
+def test_validate_a2ui_config_update_rejects_internal_keys():
+ """Internal A2UI settings should not be mutable from the Web config page."""
+ ok, update, error = validate_a2ui_config_update("a2ui_protocol_version", "0.9")
+
+ assert ok is False
+ assert update == {}
+ assert "Unknown A2UI config key" in error
+
+
+def test_validate_a2ui_config_update_maps_boolean_key():
+ """Web config keys should map to the YAML keys owned by the A2UI config."""
+ ok, update, error = validate_a2ui_config_update("a2ui_enabled", "false")
+
+ assert ok is True
+ assert update == {"enabled": False}
+ assert error == ""
+
+
+def test_normal_text_prompt_builder_keeps_string_flow(monkeypatch):
+ """Non-A2UI string input should keep the normal prompt builder path."""
+ from jiuwenswarm.server.runtime.agent_adapter.interface import build_user_prompt
+
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+
+ prompt = build_user_prompt("你好", files={}, channel="web", language="zh")
+
+ assert '"content": "你好"' in prompt
+ assert '"type": "user input"' in prompt
+
+
+def test_agent_prompt_builder_accepts_a2ui_client_event_dict(monkeypatch):
+ """Structured Web A2UI events should bypass normal text prompt wrapping."""
+ from jiuwenswarm.server.runtime.agent_adapter.interface import build_user_prompt
+
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+
+ prompt = build_user_prompt(
+ {
+ "type": "a2ui.client_event",
+ "protocolVersion": "0.8",
+ "event": {
+ "userAction": {
+ "name": "submit_form",
+ "surfaceId": "surface-1",
+ "sourceComponentId": "submit",
+ "context": {"name": "张三"},
+ },
+ },
+ },
+ files={},
+ channel="web",
+ language="zh",
+ )
+
+ assert "你收到了一次 A2UI 组件交互" in prompt
+ assert "submit_form" in prompt
+ assert "张三" in prompt
+
+
+async def test_finalize_assistant_response_if_a2ui_noops_when_config_lookup_fails(monkeypatch):
+ """A2UI finalization must not break the core agent response path."""
+ def fail_config_lookup():
+ raise RuntimeError("config unavailable")
+
+ async def repair_call(prompt: str):
+ raise AssertionError("repair should not run when A2UI config is unavailable")
+
+ monkeypatch.setattr(integration, "_get_runtime_a2ui_config", fail_config_lookup)
+
+ content = "<a2ui-json>[]</a2ui-json>"
+ result = await integration.finalize_assistant_response_if_a2ui(
+ content,
+ user_query="generate a form",
+ request_id="req-config-error",
+ repair_call=repair_call,
+ )
+
+ assert result == content
+
+
+async def test_finalize_assistant_response_if_a2ui_bypasses_non_web_channel(monkeypatch):
+ """Non-Web responses should not run A2UI config lookup, validation, or repair."""
+ def fail_config_lookup():
+ raise AssertionError("non-Web channel should bypass A2UI config lookup")
+
+ async def repair_call(prompt: str):
+ raise AssertionError("repair should not run for non-Web channels")
+
+ monkeypatch.setattr(integration, "_get_runtime_a2ui_config", fail_config_lookup)
+
+ content = "<a2ui-json>[]</a2ui-json>"
+ result = await integration.finalize_assistant_response_if_a2ui(
+ content,
+ channel="feishu",
+ user_query="generate a form",
+ request_id="req-non-web",
+ repair_call=repair_call,
+ )
+
+ assert result == content
diff --git a/tests/unit_tests/a2ui/test_module_boundaries.py b/tests/unit_tests/a2ui/test_module_boundaries.py
new file mode 100644
index 0000000000..ff5f14d8d3
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_module_boundaries.py
@@ -0,0 +1,27 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+from pathlib import Path
+
+
+ROOT = Path(__file__).resolve().parents[3]
+
+
+def test_core_agent_adapter_uses_a2ui_integration_boundary():
+ source = (ROOT / "jiuwenswarm/server/runtime/agent_adapter/interface.py").read_text(encoding="utf-8")
+
+ assert "jiuwenswarm.server.runtime.a2ui.config" not in source
+ assert "jiuwenswarm.server.runtime.a2ui.runtime.response_finalization" not in source
+ assert "jiuwenswarm.server.runtime.a2ui.integration" in source
+
+
+def test_backend_a2ui_lives_under_server_runtime():
+ assert not (ROOT / "jiuwenswarm/a2ui").exists()
+ assert (ROOT / "jiuwenswarm/server/runtime/a2ui").is_dir()
+
+
+def test_websocket_hook_keeps_a2ui_feature_outside_generic_transport():
+ source = (ROOT / "jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts").read_text(encoding="utf-8")
+
+ assert "../features/a2ui/" not in source
+ assert "sendA2UIClientEvent" not in source
+ assert "sendStructuredChatContent" in source
diff --git a/tests/unit_tests/a2ui/test_prompt_instructions.py b/tests/unit_tests/a2ui/test_prompt_instructions.py
new file mode 100644
index 0000000000..a0a62eb846
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_prompt_instructions.py
@@ -0,0 +1,57 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+from jiuwenswarm.server.runtime.a2ui.prompt_instructions import (
+ build_a2ui_autonomy_instruction,
+)
+from jiuwenswarm.server.runtime.a2ui.runtime.prompt import (
+ build_a2ui_client_event_prompt,
+ build_a2ui_prompt_section,
+)
+
+
+def test_a2ui_prompt_discourages_icon_ligature_dependency():
+ instruction = build_a2ui_autonomy_instruction("en")
+
+ assert "Avoid A2UI Icon for semantic content" in instruction
+ assert "Material Symbols" in instruction
+ assert "emoji or text labels" in instruction
+
+
+def test_a2ui_prompt_is_autonomous_not_forced():
+ instruction = build_a2ui_autonomy_instruction("en")
+
+ assert "A2UI is optional" in instruction
+ assert "If A2UI is not appropriate, answer in plain text" in instruction
+ assert "Do not promise to show the result with A2UI and then output only Markdown" in instruction
+
+
+def test_a2ui_zh_prompt_section_is_readable():
+ prompt = build_a2ui_prompt_section("zh")
+
+ assert "你是 jiuwenswarm 的 A2UI 生成器" in prompt
+ assert "当用户需要列表、卡片、表单" in prompt
+ assert "浣犳槸" not in prompt
+ assert "鐢熸垚" not in prompt
+
+
+def test_a2ui_zh_client_event_prompt_is_readable():
+ prompt = build_a2ui_client_event_prompt(
+ {
+ "type": "a2ui.client_event",
+ "event": {
+ "userAction": {
+ "name": "submit_form",
+ "surfaceId": "surface-1",
+ "sourceComponentId": "submit",
+ "context": {"name": "张三"},
+ },
+ },
+ },
+ channel="web",
+ language="zh",
+ )
+
+ assert "你收到了一次 A2UI 组件交互" in prompt
+ assert "张三" in prompt
+ assert "submit_form" in prompt
+ assert "浣犳敹" not in prompt
diff --git a/tests/unit_tests/a2ui/test_response_finalization.py b/tests/unit_tests/a2ui/test_response_finalization.py
new file mode 100644
index 0000000000..4067656258
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_response_finalization.py
@@ -0,0 +1,106 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+from types import SimpleNamespace
+
+import pytest
+
+
+VALID_A2UI_RESPONSE = """<a2ui-json>
+[
+ {
+ "beginRendering": {
+ "surfaceId": "repair-test",
+ "root": "root"
+ }
+ },
+ {
+ "surfaceUpdate": {
+ "surfaceId": "repair-test",
+ "components": [
+ {
+ "id": "root",
+ "component": {
+ "Text": {
+ "text": {
+ "literalString": "Repaired"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+]
+</a2ui-json>"""
+
+
+INVALID_A2UI_RESPONSE = """Here is a form.
+<a2ui-json>
+[
+ {
+ "type": "beginRendering",
+ "version": "0.8"
+ }
+]
+</a2ui-json>"""
+
+
+async def test_finalize_a2ui_assistant_content_repairs_invalid_response(monkeypatch):
+ from jiuwenswarm.server.runtime.a2ui.runtime.response_finalization import finalize_a2ui_assistant_content
+
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+
+ async def repair_call(prompt: str):
+ assert "A2UI 0.8" in prompt
+ return SimpleNamespace(content=VALID_A2UI_RESPONSE)
+
+ result = await finalize_a2ui_assistant_content(
+ INVALID_A2UI_RESPONSE,
+ user_query="generate a form",
+ request_id="req-repair",
+ repair_call=repair_call,
+ a2ui_enabled=True,
+ )
+
+ assert result == VALID_A2UI_RESPONSE
+
+
+async def test_finalize_a2ui_assistant_content_leaves_valid_response_unchanged(monkeypatch):
+ from jiuwenswarm.server.runtime.a2ui.runtime.response_finalization import finalize_a2ui_assistant_content
+
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+
+ async def repair_call(prompt: str):
+ raise AssertionError("valid A2UI response must not trigger repair")
+
+ result = await finalize_a2ui_assistant_content(
+ VALID_A2UI_RESPONSE,
+ user_query="generate a form",
+ request_id="req-valid",
+ repair_call=repair_call,
+ a2ui_enabled=True,
+ )
+
+ assert result == VALID_A2UI_RESPONSE
+
+
+async def test_finalize_a2ui_assistant_content_skips_when_disabled(monkeypatch):
+ from jiuwenswarm.server.runtime.a2ui.runtime.response_finalization import finalize_a2ui_assistant_content
+
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "false")
+
+ async def repair_call(prompt: str):
+ raise AssertionError("disabled A2UI must not trigger repair")
+
+ result = await finalize_a2ui_assistant_content(
+ INVALID_A2UI_RESPONSE,
+ user_query="generate a form",
+ request_id="req-disabled",
+ repair_call=repair_call,
+ a2ui_enabled=False,
+ )
+
+ assert result == INVALID_A2UI_RESPONSE
diff --git a/tests/unit_tests/a2ui/test_web_event_input_builder.py b/tests/unit_tests/a2ui/test_web_event_input_builder.py
new file mode 100644
index 0000000000..679257733f
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_web_event_input_builder.py
@@ -0,0 +1,85 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+"""Regression tests for Web A2UI client-event request shaping."""
+
+from __future__ import annotations
+
+from jiuwenswarm.common.schema.agent import AgentRequest
+from jiuwenswarm.server.runtime.agent_adapter import interface as interface_module
+
+
+def test_agent_input_builder_reads_a2ui_client_event_from_content(monkeypatch):
+ """Web A2UI client events should not need a dict-valued query param."""
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+ monkeypatch.setattr(interface_module, "get_config", lambda: {"preferred_language": "zh"})
+ monkeypatch.setattr(interface_module, "get_memory_mode", lambda _config: "disabled")
+
+ content = {
+ "type": "a2ui.client_event",
+ "protocolVersion": "0.8",
+ "event": {
+ "userAction": {
+ "name": "submit_form",
+ "surfaceId": "surface-1",
+ "sourceComponentId": "submit",
+ "context": {"name": "张三"},
+ },
+ },
+ }
+ request = AgentRequest(
+ request_id="req-a2ui-content",
+ channel_id="web",
+ session_id="web_session",
+ params={"content": content, "mode": "agent"},
+ )
+
+ inputs, _, raw_query = interface_module.JiuWenClaw().build_inputs(request)
+
+ assert raw_query == content
+ assert "submit_form" in inputs["query"]
+ assert "张三" in inputs["query"]
+
+
+def test_agent_input_builder_uses_request_channel_id_for_a2ui(monkeypatch):
+ """Web A2UI should not depend on session ids being prefixed with web_."""
+ monkeypatch.setenv("JIUWENSWARM_A2UI_ENABLED", "true")
+ monkeypatch.setattr(interface_module, "get_config", lambda: {"preferred_language": "zh"})
+ monkeypatch.setattr(interface_module, "get_memory_mode", lambda _config: "disabled")
+
+ request = AgentRequest(
+ request_id="req-web-uuid-session",
+ channel_id="web",
+ session_id="session-without-channel-prefix",
+ params={
+ "content": {
+ "type": "a2ui.client_event",
+ "event": {
+ "userAction": {
+ "name": "submit_form",
+ "surfaceId": "surface-1",
+ "sourceComponentId": "submit",
+ "context": {"name": "zhangsan"},
+ },
+ },
+ },
+ "mode": "agent",
+ },
+ )
+
+ inputs, _, _ = interface_module.JiuWenClaw().build_inputs(request)
+
+ assert inputs["channel"] == "web"
+ assert "submit_form" in inputs["query"]
+
+
+async def test_deep_adapter_slash_command_ignores_structured_query():
+ """A stale client sending dict-valued query should not crash slash routing."""
+ from jiuwenswarm.server.runtime.agent_adapter.interface_deep import JiuWenClawDeepAdapter
+
+ class SlashCommandProbe(JiuWenClawDeepAdapter):
+ async def handle_query(self, query):
+ return await self._handle_slash_command(query)
+
+ result = await SlashCommandProbe().handle_query({"type": "a2ui.client_event"})
+
+ assert result is None
diff --git a/tests/unit_tests/a2ui/test_web_only_prompt_rail.py b/tests/unit_tests/a2ui/test_web_only_prompt_rail.py
new file mode 100644
index 0000000000..89052a5546
--- /dev/null
+++ b/tests/unit_tests/a2ui/test_web_only_prompt_rail.py
@@ -0,0 +1,100 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.
+
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+from openjiuwen.core.single_agent.rail.base import InvokeInputs
+
+from jiuwenswarm.agents.harness.common.prompt.prompt_builder import LocalSectionName
+from jiuwenswarm.agents.harness.common.rails.response_prompt_rail import ResponsePromptRail
+from jiuwenswarm.server.runtime.a2ui.config import A2UIConfig
+
+
+class _FakePromptBuilder:
+ def __init__(self) -> None:
+ self.language = "en"
+ self.sections = {}
+
+ def add_section(self, section) -> None:
+ self.sections[section.name] = section
+
+ def remove_section(self, name: str) -> None:
+ self.sections.pop(name, None)
+
+
+async def test_response_prompt_rail_does_not_inject_a2ui_for_non_web_channel(monkeypatch):
+ """Non-Web model calls should not receive A2UI prompt instructions."""
+ monkeypatch.setattr(
+ "jiuwenswarm.server.runtime.a2ui.config.get_current_a2ui_config",
+ lambda: A2UIConfig(enabled=True),
+ )
+ rail = ResponsePromptRail()
+ rail.system_prompt_builder = _FakePromptBuilder()
+
+ await rail.before_model_call(SimpleNamespace(inputs={"channel": "feishu"}))
+
+ assert "response" in rail.system_prompt_builder.sections
+ assert LocalSectionName.A2UI not in rail.system_prompt_builder.sections
+
+
+async def test_response_prompt_rail_keeps_a2ui_for_web_channel(monkeypatch):
+ """Web model calls should keep existing A2UI prompt behavior."""
+ monkeypatch.setattr(
+ "jiuwenswarm.server.runtime.a2ui.config.get_current_a2ui_config",
+ lambda: A2UIConfig(enabled=True),
+ )
+ rail = ResponsePromptRail()
+ rail.system_prompt_builder = _FakePromptBuilder()
+
+ await rail.before_model_call(SimpleNamespace(inputs={"channel": "web"}))
+
+ assert "response" in rail.system_prompt_builder.sections
+ assert LocalSectionName.A2UI in rail.system_prompt_builder.sections
+
+
+async def test_response_prompt_rail_keeps_web_channel_from_invoke_context(monkeypatch):
+ """Model-call inputs drop channel, so Web channel must survive via invoke context."""
+ monkeypatch.setattr(
+ "jiuwenswarm.server.runtime.a2ui.config.get_current_a2ui_config",
+ lambda: A2UIConfig(enabled=True),
+ )
+ rail = ResponsePromptRail()
+ rail.system_prompt_builder = _FakePromptBuilder()
+ extra = {}
+
+ await rail.before_invoke(
+ SimpleNamespace(
+ inputs=InvokeInputs(query="generate an A2UI form", conversation_id="web_session_1"),
+ extra=extra,
+ )
+ )
+ await rail.before_model_call(SimpleNamespace(inputs=SimpleNamespace(), extra=extra))
+
+ assert LocalSectionName.A2UI in rail.system_prompt_builder.sections
+
+
+async def test_response_prompt_rail_keeps_non_web_bypass_from_invoke_context(monkeypatch):
+ """Non-Web channel inferred from conversation id should still bypass A2UI."""
+ monkeypatch.setattr(
+ "jiuwenswarm.server.runtime.a2ui.config.get_current_a2ui_config",
+ lambda: A2UIConfig(enabled=True),
+ )
+ rail = ResponsePromptRail()
+ rail.system_prompt_builder = _FakePromptBuilder()
+ extra = {}
+
+ await rail.before_invoke(
+ SimpleNamespace(
+ inputs=InvokeInputs(query="generate an A2UI form", conversation_id="feishu_session_1"),
+ extra=extra,
+ )
+ )
+ await rail.before_model_call(SimpleNamespace(inputs=SimpleNamespace(), extra=extra))
+
+ assert LocalSectionName.A2UI not in rail.system_prompt_builder.sections
diff --git a/uv.lock b/uv.lock
index 30094f29bb..a38c779f7d 100644
--- a/uv.lock
+++ b/uv.lock
@@ -39,6 +39,21 @@ http-server = [
{ name = "starlette" },
]
+[[package]]
+name = "a2ui-agent-sdk"
+version = "0.2.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "a2a-sdk" },
+ { name = "google-adk" },
+ { name = "google-genai" },
+ { name = "jsonschema" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/8f/a1/66106b413acf22a7531e86d9ce6663e33d8bdead5043f15cbed6e22a427f/a2ui_agent_sdk-0.2.1.tar.gz", hash = "sha256:cc42af7a1cdae5ef7b7c90a619a7497b677038558a4273c7f751e843c41fac04", size = 233418, upload-time = "2026-04-10T00:18:43.387Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/5b/21/6a10fa0e20db25825f384a6147a11fb521bb5471e2082dc9f4b471d1e3b4/a2ui_agent_sdk-0.2.1-py3-none-any.whl", hash = "sha256:36157834654c591dbe11c40131a51c9f9b54bdedcb15e789cb33eedbefddbc03", size = 73369, upload-time = "2026-04-10T00:18:41.878Z" },
+]
+
[[package]]
name = "aiofiles"
version = "25.1.0"
@@ -1164,6 +1179,41 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/d5/1f/5f4a3cd9e4440e9d9bc78ad0a91a1c8d46b4d429d5239ebe6793c9fe5c41/fsspec-2026.3.0-py3-none-any.whl", hash = "sha256:d2ceafaad1b3457968ed14efa28798162f1638dbb5d2a6868a2db002a5ee39a4", size = 202595, upload-time = "2026-03-27T19:11:13.595Z" },
]
+[[package]]
+name = "google-adk"
+version = "2.1.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "aiosqlite" },
+ { name = "authlib" },
+ { name = "click" },
+ { name = "fastapi" },
+ { name = "google-auth", extra = ["pyopenssl"] },
+ { name = "google-genai" },
+ { name = "graphviz" },
+ { name = "httpx" },
+ { name = "jsonschema" },
+ { name = "opentelemetry-api" },
+ { name = "opentelemetry-sdk" },
+ { name = "packaging" },
+ { name = "pydantic" },
+ { name = "python-dotenv" },
+ { name = "python-multipart" },
+ { name = "pyyaml" },
+ { name = "requests" },
+ { name = "starlette" },
+ { name = "tenacity" },
+ { name = "typing-extensions" },
+ { name = "tzlocal" },
+ { name = "uvicorn" },
+ { name = "watchdog" },
+ { name = "websockets" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/02/d2/58823ea0d5ac32143773d377b014123191ce420480c003190e1f86a9667c/google_adk-2.1.0.tar.gz", hash = "sha256:fd1709bf5e70e5aaa7d148c7b788d2cd00bb659ee10505a731bb2ad609d28968", size = 3340742, upload-time = "2026-05-23T00:13:56.793Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/0f/5b/56a9992b6f9447437f29e3691a487b16dfdea42aedec16ceced9de88b9f8/google_adk-2.1.0-py3-none-any.whl", hash = "sha256:4ec8a0ccdf8af90f9fa505c740cae921b47590aee3d61bca14f7bfa8bc886e4e", size = 3852259, upload-time = "2026-05-23T00:13:59.611Z" },
+]
+
[[package]]
name = "google-api-core"
version = "2.30.3"
@@ -1194,6 +1244,9 @@ wheels = [
]
[package.optional-dependencies]
+pyopenssl = [
+ { name = "pyopenssl" },
+]
requests = [
{ name = "requests" },
]
@@ -1231,6 +1284,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/b6/b0/be5d3329badb9230b765de6eea66b73abd5944bdeb5afb3562ddcd80ae84/googleapis_common_protos-1.74.0-py3-none-any.whl", hash = "sha256:702216f78610bb510e3f12ac3cafd281b7ac45cc5d86e90ad87e4d301a3426b5", size = 300743, upload-time = "2026-04-02T21:22:49.108Z" },
]
+[[package]]
+name = "graphviz"
+version = "0.21"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/f8/b3/3ac91e9be6b761a4b30d66ff165e54439dcd48b83f4e20d644867215f6ca/graphviz-0.21.tar.gz", hash = "sha256:20743e7183be82aaaa8ad6c93f8893c923bd6658a04c32ee115edb3c8a835f78", size = 200434, upload-time = "2025-06-15T09:35:05.824Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/91/4c/e0ce1ef95d4000ebc1c11801f9b944fa5910ecc15b5e351865763d8657f8/graphviz-0.21-py3-none-any.whl", hash = "sha256:54f33de9f4f911d7e84e4191749cac8cc5653f815b06738c54db9a15ab8b1e42", size = 47300, upload-time = "2025-06-15T09:35:04.433Z" },
+]
+
[[package]]
name = "greenlet"
version = "3.5.0"
@@ -1602,6 +1664,7 @@ name = "jiuwenswarm"
version = "0.2.1"
source = { editable = "." }
dependencies = [
+ { name = "a2ui-agent-sdk" },
{ name = "aiosqlite" },
{ name = "chromadb" },
{ name = "croniter" },
@@ -1704,6 +1767,7 @@ test = [
requires-dist = [
{ name = "a2a-sdk", extras = ["http-server"], marker = "extra == 'a2a'", specifier = "==1.0.0" },
{ name = "a2a-sdk", extras = ["http-server"], marker = "extra == 'test'", specifier = "==1.0.0" },
+ { name = "a2ui-agent-sdk", specifier = "==0.2.1" },
{ name = "aiosqlite", specifier = ">=0.22.1" },
{ name = "chromadb", specifier = ">=1.5.0" },
{ name = "coverage", marker = "extra == 'test'", specifier = ">=7.7.1" },
@@ -3675,6 +3739,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8a/7a/03c29c46866e266b0c705811c55c22625c349b0a80f5cf4776454b13dc4c/pyobjc_framework_webkit-12.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:1a29e334d5a7dd4a4f0b5647481b6ccf8a107b92e67b2b3c6b368c899f571965", size = 50572, upload-time = "2025-11-14T10:07:14.232Z" },
]
+[[package]]
+name = "pyopenssl"
+version = "26.2.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "cryptography" },
+ { name = "typing-extensions", marker = "python_full_version < '3.13'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/1a/51/27a5ad5f939d08f690a326ef9582cda7140555180db71695f6fb747d6a36/pyopenssl-26.2.0.tar.gz", hash = "sha256:8c6fcecd1183a7fc897548dfe388b0cdb7f37e018200d8409cf33959dbe35387", size = 182195, upload-time = "2026-05-04T23:06:09.72Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/73/b8/a0e2790ae249d6f38c9f66de7a211621a7ab2650217bcd04e1262f578a56/pyopenssl-26.2.0-py3-none-any.whl", hash = "sha256:4f9d971bc5298b8bc1fab282803da04bf000c755d4ad9d99b52de2569ca19a70", size = 55823, upload-time = "2026-05-04T23:06:08.395Z" },
+]
+
[[package]]
name = "pypdf2"
version = "3.0.1"
@@ -4541,15 +4618,15 @@ wheels = [
[[package]]
name = "starlette"
-version = "1.0.0"
+version = "0.52.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
{ name = "typing-extensions", marker = "python_full_version < '3.13'" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/81/69/17425771797c36cded50b7fe44e850315d039f28b15901ab44839e70b593/starlette-1.0.0.tar.gz", hash = "sha256:6a4beaf1f81bb472fd19ea9b918b50dc3a77a6f2e190a12954b25e6ed5eea149", size = 2655289, upload-time = "2026-03-22T18:29:46.779Z" }
+sdist = { url = "https://files.pythonhosted.org/packages/c4/68/79977123bb7be889ad680d79a40f339082c1978b5cfcf62c2d8d196873ac/starlette-0.52.1.tar.gz", hash = "sha256:834edd1b0a23167694292e94f597773bc3f89f362be6effee198165a35d62933", size = 2653702, upload-time = "2026-01-18T13:34:11.062Z" }
wheels = [
- { url = "https://files.pythonhosted.org/packages/0b/c9/584bc9651441b4ba60cc4d557d8a547b5aff901af35bda3a4ee30c819b82/starlette-1.0.0-py3-none-any.whl", hash = "sha256:d3ec55e0bb321692d275455ddfd3df75fff145d009685eb40dc91fc66b03d38b", size = 72651, upload-time = "2026-03-22T18:29:45.111Z" },
+ { url = "https://files.pythonhosted.org/packages/81/0d/13d1d239a25cbfb19e740db83143e95c772a1fe10202dda4b76792b114dd/starlette-0.52.1-py3-none-any.whl", hash = "sha256:0029d43eb3d273bc4f83a08720b4912ea4b071087a3b48db01b7c839f7954d74", size = 74272, upload-time = "2026-01-18T13:34:09.188Z" },
]
[[package]]
@@ -4811,6 +4888,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/ce/e4/dccd7f47c4b64213ac01ef921a1337ee6e30e8c6466046018326977efd95/tzdata-2026.2-py2.py3-none-any.whl", hash = "sha256:bbe9af844f658da81a5f95019480da3a89415801f6cc966806612cc7169bffe7", size = 349321, upload-time = "2026-04-24T15:22:05.876Z" },
]
+[[package]]
+name = "tzlocal"
+version = "5.3.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "tzdata", marker = "sys_platform == 'win32'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/8b/2e/c14812d3d4d9cd1773c6be938f89e5735a1f11a9f184ac3639b93cef35d5/tzlocal-5.3.1.tar.gz", hash = "sha256:cceffc7edecefea1f595541dbd6e990cb1ea3d19bf01b2809f362a03dd7921fd", size = 30761, upload-time = "2025-03-05T21:17:41.549Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/c2/14/e2a54fabd4f08cd7af1c07030603c3356b74da07f7cc056e600436edfa17/tzlocal-5.3.1-py3-none-any.whl", hash = "sha256:eb1a66c3ef5847adf7a834f1be0800581b683b5608e74f86ecbcef8ab91bb85d", size = 18026, upload-time = "2025-03-05T21:17:39.857Z" },
+]
+
[[package]]
name = "uncalled-for"
version = "0.3.1"
@@ -4879,6 +4968,33 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/f8/ba/d69adbe699b768f6b29a5eec7b47dd610bd17a69de51b251126a801369ea/uvloop-0.22.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:1f38ec5e3f18c8a10ded09742f7fb8de0108796eb673f30ce7762ce1b8550cad", size = 4239051, upload-time = "2025-10-16T22:16:43.224Z" },
]
+[[package]]
+name = "watchdog"
+version = "6.0.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/db/7d/7f3d619e951c88ed75c6037b246ddcf2d322812ee8ea189be89511721d54/watchdog-6.0.0.tar.gz", hash = "sha256:9ddf7c82fda3ae8e24decda1338ede66e1c99883db93711d8fb941eaa2d8c282", size = 131220, upload-time = "2024-11-01T14:07:13.037Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e0/24/d9be5cd6642a6aa68352ded4b4b10fb0d7889cb7f45814fb92cecd35f101/watchdog-6.0.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6eb11feb5a0d452ee41f824e271ca311a09e250441c262ca2fd7ebcf2461a06c", size = 96393, upload-time = "2024-11-01T14:06:31.756Z" },
+ { url = "https://files.pythonhosted.org/packages/63/7a/6013b0d8dbc56adca7fdd4f0beed381c59f6752341b12fa0886fa7afc78b/watchdog-6.0.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ef810fbf7b781a5a593894e4f439773830bdecb885e6880d957d5b9382a960d2", size = 88392, upload-time = "2024-11-01T14:06:32.99Z" },
+ { url = "https://files.pythonhosted.org/packages/d1/40/b75381494851556de56281e053700e46bff5b37bf4c7267e858640af5a7f/watchdog-6.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:afd0fe1b2270917c5e23c2a65ce50c2a4abb63daafb0d419fde368e272a76b7c", size = 89019, upload-time = "2024-11-01T14:06:34.963Z" },
+ { url = "https://files.pythonhosted.org/packages/39/ea/3930d07dafc9e286ed356a679aa02d777c06e9bfd1164fa7c19c288a5483/watchdog-6.0.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:bdd4e6f14b8b18c334febb9c4425a878a2ac20efd1e0b231978e7b150f92a948", size = 96471, upload-time = "2024-11-01T14:06:37.745Z" },
+ { url = "https://files.pythonhosted.org/packages/12/87/48361531f70b1f87928b045df868a9fd4e253d9ae087fa4cf3f7113be363/watchdog-6.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c7c15dda13c4eb00d6fb6fc508b3c0ed88b9d5d374056b239c4ad1611125c860", size = 88449, upload-time = "2024-11-01T14:06:39.748Z" },
+ { url = "https://files.pythonhosted.org/packages/5b/7e/8f322f5e600812e6f9a31b75d242631068ca8f4ef0582dd3ae6e72daecc8/watchdog-6.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6f10cb2d5902447c7d0da897e2c6768bca89174d0c6e1e30abec5421af97a5b0", size = 89054, upload-time = "2024-11-01T14:06:41.009Z" },
+ { url = "https://files.pythonhosted.org/packages/68/98/b0345cabdce2041a01293ba483333582891a3bd5769b08eceb0d406056ef/watchdog-6.0.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:490ab2ef84f11129844c23fb14ecf30ef3d8a6abafd3754a6f75ca1e6654136c", size = 96480, upload-time = "2024-11-01T14:06:42.952Z" },
+ { url = "https://files.pythonhosted.org/packages/85/83/cdf13902c626b28eedef7ec4f10745c52aad8a8fe7eb04ed7b1f111ca20e/watchdog-6.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:76aae96b00ae814b181bb25b1b98076d5fc84e8a53cd8885a318b42b6d3a5134", size = 88451, upload-time = "2024-11-01T14:06:45.084Z" },
+ { url = "https://files.pythonhosted.org/packages/fe/c4/225c87bae08c8b9ec99030cd48ae9c4eca050a59bf5c2255853e18c87b50/watchdog-6.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a175f755fc2279e0b7312c0035d52e27211a5bc39719dd529625b1930917345b", size = 89057, upload-time = "2024-11-01T14:06:47.324Z" },
+ { url = "https://files.pythonhosted.org/packages/a9/c7/ca4bf3e518cb57a686b2feb4f55a1892fd9a3dd13f470fca14e00f80ea36/watchdog-6.0.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:7607498efa04a3542ae3e05e64da8202e58159aa1fa4acddf7678d34a35d4f13", size = 79079, upload-time = "2024-11-01T14:06:59.472Z" },
+ { url = "https://files.pythonhosted.org/packages/5c/51/d46dc9332f9a647593c947b4b88e2381c8dfc0942d15b8edc0310fa4abb1/watchdog-6.0.0-py3-none-manylinux2014_armv7l.whl", hash = "sha256:9041567ee8953024c83343288ccc458fd0a2d811d6a0fd68c4c22609e3490379", size = 79078, upload-time = "2024-11-01T14:07:01.431Z" },
+ { url = "https://files.pythonhosted.org/packages/d4/57/04edbf5e169cd318d5f07b4766fee38e825d64b6913ca157ca32d1a42267/watchdog-6.0.0-py3-none-manylinux2014_i686.whl", hash = "sha256:82dc3e3143c7e38ec49d61af98d6558288c415eac98486a5c581726e0737c00e", size = 79076, upload-time = "2024-11-01T14:07:02.568Z" },
+ { url = "https://files.pythonhosted.org/packages/ab/cc/da8422b300e13cb187d2203f20b9253e91058aaf7db65b74142013478e66/watchdog-6.0.0-py3-none-manylinux2014_ppc64.whl", hash = "sha256:212ac9b8bf1161dc91bd09c048048a95ca3a4c4f5e5d4a7d1b1a7d5752a7f96f", size = 79077, upload-time = "2024-11-01T14:07:03.893Z" },
+ { url = "https://files.pythonhosted.org/packages/2c/3b/b8964e04ae1a025c44ba8e4291f86e97fac443bca31de8bd98d3263d2fcf/watchdog-6.0.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:e3df4cbb9a450c6d49318f6d14f4bbc80d763fa587ba46ec86f99f9e6876bb26", size = 79078, upload-time = "2024-11-01T14:07:05.189Z" },
+ { url = "https://files.pythonhosted.org/packages/62/ae/a696eb424bedff7407801c257d4b1afda455fe40821a2be430e173660e81/watchdog-6.0.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:2cce7cfc2008eb51feb6aab51251fd79b85d9894e98ba847408f662b3395ca3c", size = 79077, upload-time = "2024-11-01T14:07:06.376Z" },
+ { url = "https://files.pythonhosted.org/packages/b5/e8/dbf020b4d98251a9860752a094d09a65e1b436ad181faf929983f697048f/watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:20ffe5b202af80ab4266dcd3e91aae72bf2da48c0d33bdb15c66658e685e94e2", size = 79078, upload-time = "2024-11-01T14:07:07.547Z" },
+ { url = "https://files.pythonhosted.org/packages/07/f6/d0e5b343768e8bcb4cda79f0f2f55051bf26177ecd5651f84c07567461cf/watchdog-6.0.0-py3-none-win32.whl", hash = "sha256:07df1fdd701c5d4c8e55ef6cf55b8f0120fe1aef7ef39a1c6fc6bc2e606d517a", size = 79065, upload-time = "2024-11-01T14:07:09.525Z" },
+ { url = "https://files.pythonhosted.org/packages/db/d9/c495884c6e548fce18a8f40568ff120bc3a4b7b99813081c8ac0c936fa64/watchdog-6.0.0-py3-none-win_amd64.whl", hash = "sha256:cbafb470cf848d93b5d013e2ecb245d4aa1c8fd0504e863ccefa32445359d680", size = 79070, upload-time = "2024-11-01T14:07:10.686Z" },
+ { url = "https://files.pythonhosted.org/packages/33/e8/e40370e6d74ddba47f002a32919d91310d6074130fe4e17dabcafc15cbf1/watchdog-6.0.0-py3-none-win_ia64.whl", hash = "sha256:a1914259fa9e1454315171103c6a30961236f508b9b623eae470268bbcc6a22f", size = 79067, upload-time = "2024-11-01T14:07:11.845Z" },
+]
+
[[package]]
name = "watchfiles"
version = "1.1.1"
@@ -4954,43 +5070,44 @@ wheels = [
[[package]]
name = "websockets"
-version = "16.0"
-source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/04/24/4b2031d72e840ce4c1ccb255f693b15c334757fc50023e4db9537080b8c4/websockets-16.0.tar.gz", hash = "sha256:5f6261a5e56e8d5c42a4497b364ea24d94d9563e8fbd44e78ac40879c60179b5", size = 179346, upload-time = "2026-01-10T09:23:47.181Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/f2/db/de907251b4ff46ae804ad0409809504153b3f30984daf82a1d84a9875830/websockets-16.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:31a52addea25187bde0797a97d6fc3d2f92b6f72a9370792d65a6e84615ac8a8", size = 177340, upload-time = "2026-01-10T09:22:34.539Z" },
- { url = "https://files.pythonhosted.org/packages/f3/fa/abe89019d8d8815c8781e90d697dec52523fb8ebe308bf11664e8de1877e/websockets-16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:417b28978cdccab24f46400586d128366313e8a96312e4b9362a4af504f3bbad", size = 175022, upload-time = "2026-01-10T09:22:36.332Z" },
- { url = "https://files.pythonhosted.org/packages/58/5d/88ea17ed1ded2079358b40d31d48abe90a73c9e5819dbcde1606e991e2ad/websockets-16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:af80d74d4edfa3cb9ed973a0a5ba2b2a549371f8a741e0800cb07becdd20f23d", size = 175319, upload-time = "2026-01-10T09:22:37.602Z" },
- { url = "https://files.pythonhosted.org/packages/d2/ae/0ee92b33087a33632f37a635e11e1d99d429d3d323329675a6022312aac2/websockets-16.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:08d7af67b64d29823fed316505a89b86705f2b7981c07848fb5e3ea3020c1abe", size = 184631, upload-time = "2026-01-10T09:22:38.789Z" },
- { url = "https://files.pythonhosted.org/packages/c8/c5/27178df583b6c5b31b29f526ba2da5e2f864ecc79c99dae630a85d68c304/websockets-16.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7be95cfb0a4dae143eaed2bcba8ac23f4892d8971311f1b06f3c6b78952ee70b", size = 185870, upload-time = "2026-01-10T09:22:39.893Z" },
- { url = "https://files.pythonhosted.org/packages/87/05/536652aa84ddc1c018dbb7e2c4cbcd0db884580bf8e95aece7593fde526f/websockets-16.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d6297ce39ce5c2e6feb13c1a996a2ded3b6832155fcfc920265c76f24c7cceb5", size = 185361, upload-time = "2026-01-10T09:22:41.016Z" },
- { url = "https://files.pythonhosted.org/packages/6d/e2/d5332c90da12b1e01f06fb1b85c50cfc489783076547415bf9f0a659ec19/websockets-16.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1c1b30e4f497b0b354057f3467f56244c603a79c0d1dafce1d16c283c25f6e64", size = 184615, upload-time = "2026-01-10T09:22:42.442Z" },
- { url = "https://files.pythonhosted.org/packages/77/fb/d3f9576691cae9253b51555f841bc6600bf0a983a461c79500ace5a5b364/websockets-16.0-cp311-cp311-win32.whl", hash = "sha256:5f451484aeb5cafee1ccf789b1b66f535409d038c56966d6101740c1614b86c6", size = 178246, upload-time = "2026-01-10T09:22:43.654Z" },
- { url = "https://files.pythonhosted.org/packages/54/67/eaff76b3dbaf18dcddabc3b8c1dba50b483761cccff67793897945b37408/websockets-16.0-cp311-cp311-win_amd64.whl", hash = "sha256:8d7f0659570eefb578dacde98e24fb60af35350193e4f56e11190787bee77dac", size = 178684, upload-time = "2026-01-10T09:22:44.941Z" },
- { url = "https://files.pythonhosted.org/packages/84/7b/bac442e6b96c9d25092695578dda82403c77936104b5682307bd4deb1ad4/websockets-16.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:71c989cbf3254fbd5e84d3bff31e4da39c43f884e64f2551d14bb3c186230f00", size = 177365, upload-time = "2026-01-10T09:22:46.787Z" },
- { url = "https://files.pythonhosted.org/packages/b0/fe/136ccece61bd690d9c1f715baaeefd953bb2360134de73519d5df19d29ca/websockets-16.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:8b6e209ffee39ff1b6d0fa7bfef6de950c60dfb91b8fcead17da4ee539121a79", size = 175038, upload-time = "2026-01-10T09:22:47.999Z" },
- { url = "https://files.pythonhosted.org/packages/40/1e/9771421ac2286eaab95b8575b0cb701ae3663abf8b5e1f64f1fd90d0a673/websockets-16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:86890e837d61574c92a97496d590968b23c2ef0aeb8a9bc9421d174cd378ae39", size = 175328, upload-time = "2026-01-10T09:22:49.809Z" },
- { url = "https://files.pythonhosted.org/packages/18/29/71729b4671f21e1eaa5d6573031ab810ad2936c8175f03f97f3ff164c802/websockets-16.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:9b5aca38b67492ef518a8ab76851862488a478602229112c4b0d58d63a7a4d5c", size = 184915, upload-time = "2026-01-10T09:22:51.071Z" },
- { url = "https://files.pythonhosted.org/packages/97/bb/21c36b7dbbafc85d2d480cd65df02a1dc93bf76d97147605a8e27ff9409d/websockets-16.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e0334872c0a37b606418ac52f6ab9cfd17317ac26365f7f65e203e2d0d0d359f", size = 186152, upload-time = "2026-01-10T09:22:52.224Z" },
- { url = "https://files.pythonhosted.org/packages/4a/34/9bf8df0c0cf88fa7bfe36678dc7b02970c9a7d5e065a3099292db87b1be2/websockets-16.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a0b31e0b424cc6b5a04b8838bbaec1688834b2383256688cf47eb97412531da1", size = 185583, upload-time = "2026-01-10T09:22:53.443Z" },
- { url = "https://files.pythonhosted.org/packages/47/88/4dd516068e1a3d6ab3c7c183288404cd424a9a02d585efbac226cb61ff2d/websockets-16.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:485c49116d0af10ac698623c513c1cc01c9446c058a4e61e3bf6c19dff7335a2", size = 184880, upload-time = "2026-01-10T09:22:55.033Z" },
- { url = "https://files.pythonhosted.org/packages/91/d6/7d4553ad4bf1c0421e1ebd4b18de5d9098383b5caa1d937b63df8d04b565/websockets-16.0-cp312-cp312-win32.whl", hash = "sha256:eaded469f5e5b7294e2bdca0ab06becb6756ea86894a47806456089298813c89", size = 178261, upload-time = "2026-01-10T09:22:56.251Z" },
- { url = "https://files.pythonhosted.org/packages/c3/f0/f3a17365441ed1c27f850a80b2bc680a0fa9505d733fe152fdf5e98c1c0b/websockets-16.0-cp312-cp312-win_amd64.whl", hash = "sha256:5569417dc80977fc8c2d43a86f78e0a5a22fee17565d78621b6bb264a115d4ea", size = 178693, upload-time = "2026-01-10T09:22:57.478Z" },
- { url = "https://files.pythonhosted.org/packages/cc/9c/baa8456050d1c1b08dd0ec7346026668cbc6f145ab4e314d707bb845bf0d/websockets-16.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:878b336ac47938b474c8f982ac2f7266a540adc3fa4ad74ae96fea9823a02cc9", size = 177364, upload-time = "2026-01-10T09:22:59.333Z" },
- { url = "https://files.pythonhosted.org/packages/7e/0c/8811fc53e9bcff68fe7de2bcbe75116a8d959ac699a3200f4847a8925210/websockets-16.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:52a0fec0e6c8d9a784c2c78276a48a2bdf099e4ccc2a4cad53b27718dbfd0230", size = 175039, upload-time = "2026-01-10T09:23:01.171Z" },
- { url = "https://files.pythonhosted.org/packages/aa/82/39a5f910cb99ec0b59e482971238c845af9220d3ab9fa76dd9162cda9d62/websockets-16.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e6578ed5b6981005df1860a56e3617f14a6c307e6a71b4fff8c48fdc50f3ed2c", size = 175323, upload-time = "2026-01-10T09:23:02.341Z" },
- { url = "https://files.pythonhosted.org/packages/bd/28/0a25ee5342eb5d5f297d992a77e56892ecb65e7854c7898fb7d35e9b33bd/websockets-16.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:95724e638f0f9c350bb1c2b0a7ad0e83d9cc0c9259f3ea94e40d7b02a2179ae5", size = 184975, upload-time = "2026-01-10T09:23:03.756Z" },
- { url = "https://files.pythonhosted.org/packages/f9/66/27ea52741752f5107c2e41fda05e8395a682a1e11c4e592a809a90c6a506/websockets-16.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c0204dc62a89dc9d50d682412c10b3542d748260d743500a85c13cd1ee4bde82", size = 186203, upload-time = "2026-01-10T09:23:05.01Z" },
- { url = "https://files.pythonhosted.org/packages/37/e5/8e32857371406a757816a2b471939d51c463509be73fa538216ea52b792a/websockets-16.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:52ac480f44d32970d66763115edea932f1c5b1312de36df06d6b219f6741eed8", size = 185653, upload-time = "2026-01-10T09:23:06.301Z" },
- { url = "https://files.pythonhosted.org/packages/9b/67/f926bac29882894669368dc73f4da900fcdf47955d0a0185d60103df5737/websockets-16.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6e5a82b677f8f6f59e8dfc34ec06ca6b5b48bc4fcda346acd093694cc2c24d8f", size = 184920, upload-time = "2026-01-10T09:23:07.492Z" },
- { url = "https://files.pythonhosted.org/packages/3c/a1/3d6ccdcd125b0a42a311bcd15a7f705d688f73b2a22d8cf1c0875d35d34a/websockets-16.0-cp313-cp313-win32.whl", hash = "sha256:abf050a199613f64c886ea10f38b47770a65154dc37181bfaff70c160f45315a", size = 178255, upload-time = "2026-01-10T09:23:09.245Z" },
- { url = "https://files.pythonhosted.org/packages/6b/ae/90366304d7c2ce80f9b826096a9e9048b4bb760e44d3b873bb272cba696b/websockets-16.0-cp313-cp313-win_amd64.whl", hash = "sha256:3425ac5cf448801335d6fdc7ae1eb22072055417a96cc6b31b3861f455fbc156", size = 178689, upload-time = "2026-01-10T09:23:10.483Z" },
- { url = "https://files.pythonhosted.org/packages/72/07/c98a68571dcf256e74f1f816b8cc5eae6eb2d3d5cfa44d37f801619d9166/websockets-16.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:349f83cd6c9a415428ee1005cadb5c2c56f4389bc06a9af16103c3bc3dcc8b7d", size = 174947, upload-time = "2026-01-10T09:23:36.166Z" },
- { url = "https://files.pythonhosted.org/packages/7e/52/93e166a81e0305b33fe416338be92ae863563fe7bce446b0f687b9df5aea/websockets-16.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:4a1aba3340a8dca8db6eb5a7986157f52eb9e436b74813764241981ca4888f03", size = 175260, upload-time = "2026-01-10T09:23:37.409Z" },
- { url = "https://files.pythonhosted.org/packages/56/0c/2dbf513bafd24889d33de2ff0368190a0e69f37bcfa19009ef819fe4d507/websockets-16.0-pp311-pypy311_pp73-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f4a32d1bd841d4bcbffdcb3d2ce50c09c3909fbead375ab28d0181af89fd04da", size = 176071, upload-time = "2026-01-10T09:23:39.158Z" },
- { url = "https://files.pythonhosted.org/packages/a5/8f/aea9c71cc92bf9b6cc0f7f70df8f0b420636b6c96ef4feee1e16f80f75dd/websockets-16.0-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0298d07ee155e2e9fda5be8a9042200dd2e3bb0b8a38482156576f863a9d457c", size = 176968, upload-time = "2026-01-10T09:23:41.031Z" },
- { url = "https://files.pythonhosted.org/packages/9a/3f/f70e03f40ffc9a30d817eef7da1be72ee4956ba8d7255c399a01b135902a/websockets-16.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:a653aea902e0324b52f1613332ddf50b00c06fdaf7e92624fbf8c77c78fa5767", size = 178735, upload-time = "2026-01-10T09:23:42.259Z" },
- { url = "https://files.pythonhosted.org/packages/6f/28/258ebab549c2bf3e64d2b0217b973467394a9cea8c42f70418ca2c5d0d2e/websockets-16.0-py3-none-any.whl", hash = "sha256:1637db62fad1dc833276dded54215f2c7fa46912301a24bd94d45d46a011ceec", size = 171598, upload-time = "2026-01-10T09:23:45.395Z" },
+version = "15.0.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/21/e6/26d09fab466b7ca9c7737474c52be4f76a40301b08362eb2dbc19dcc16c1/websockets-15.0.1.tar.gz", hash = "sha256:82544de02076bafba038ce055ee6412d68da13ab47f0c60cab827346de828dee", size = 177016, upload-time = "2025-03-05T20:03:41.606Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/9f/32/18fcd5919c293a398db67443acd33fde142f283853076049824fc58e6f75/websockets-15.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:823c248b690b2fd9303ba00c4f66cd5e2d8c3ba4aa968b2779be9532a4dad431", size = 175423, upload-time = "2025-03-05T20:01:56.276Z" },
+ { url = "https://files.pythonhosted.org/packages/76/70/ba1ad96b07869275ef42e2ce21f07a5b0148936688c2baf7e4a1f60d5058/websockets-15.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678999709e68425ae2593acf2e3ebcbcf2e69885a5ee78f9eb80e6e371f1bf57", size = 173082, upload-time = "2025-03-05T20:01:57.563Z" },
+ { url = "https://files.pythonhosted.org/packages/86/f2/10b55821dd40eb696ce4704a87d57774696f9451108cff0d2824c97e0f97/websockets-15.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d50fd1ee42388dcfb2b3676132c78116490976f1300da28eb629272d5d93e905", size = 173330, upload-time = "2025-03-05T20:01:59.063Z" },
+ { url = "https://files.pythonhosted.org/packages/a5/90/1c37ae8b8a113d3daf1065222b6af61cc44102da95388ac0018fcb7d93d9/websockets-15.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d99e5546bf73dbad5bf3547174cd6cb8ba7273062a23808ffea025ecb1cf8562", size = 182878, upload-time = "2025-03-05T20:02:00.305Z" },
+ { url = "https://files.pythonhosted.org/packages/8e/8d/96e8e288b2a41dffafb78e8904ea7367ee4f891dafc2ab8d87e2124cb3d3/websockets-15.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:66dd88c918e3287efc22409d426c8f729688d89a0c587c88971a0faa2c2f3792", size = 181883, upload-time = "2025-03-05T20:02:03.148Z" },
+ { url = "https://files.pythonhosted.org/packages/93/1f/5d6dbf551766308f6f50f8baf8e9860be6182911e8106da7a7f73785f4c4/websockets-15.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8dd8327c795b3e3f219760fa603dcae1dcc148172290a8ab15158cf85a953413", size = 182252, upload-time = "2025-03-05T20:02:05.29Z" },
+ { url = "https://files.pythonhosted.org/packages/d4/78/2d4fed9123e6620cbf1706c0de8a1632e1a28e7774d94346d7de1bba2ca3/websockets-15.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fdc51055e6ff4adeb88d58a11042ec9a5eae317a0a53d12c062c8a8865909e8", size = 182521, upload-time = "2025-03-05T20:02:07.458Z" },
+ { url = "https://files.pythonhosted.org/packages/e7/3b/66d4c1b444dd1a9823c4a81f50231b921bab54eee2f69e70319b4e21f1ca/websockets-15.0.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:693f0192126df6c2327cce3baa7c06f2a117575e32ab2308f7f8216c29d9e2e3", size = 181958, upload-time = "2025-03-05T20:02:09.842Z" },
+ { url = "https://files.pythonhosted.org/packages/08/ff/e9eed2ee5fed6f76fdd6032ca5cd38c57ca9661430bb3d5fb2872dc8703c/websockets-15.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:54479983bd5fb469c38f2f5c7e3a24f9a4e70594cd68cd1fa6b9340dadaff7cf", size = 181918, upload-time = "2025-03-05T20:02:11.968Z" },
+ { url = "https://files.pythonhosted.org/packages/d8/75/994634a49b7e12532be6a42103597b71098fd25900f7437d6055ed39930a/websockets-15.0.1-cp311-cp311-win32.whl", hash = "sha256:16b6c1b3e57799b9d38427dda63edcbe4926352c47cf88588c0be4ace18dac85", size = 176388, upload-time = "2025-03-05T20:02:13.32Z" },
+ { url = "https://files.pythonhosted.org/packages/98/93/e36c73f78400a65f5e236cd376713c34182e6663f6889cd45a4a04d8f203/websockets-15.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:27ccee0071a0e75d22cb35849b1db43f2ecd3e161041ac1ee9d2352ddf72f065", size = 176828, upload-time = "2025-03-05T20:02:14.585Z" },
+ { url = "https://files.pythonhosted.org/packages/51/6b/4545a0d843594f5d0771e86463606a3988b5a09ca5123136f8a76580dd63/websockets-15.0.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:3e90baa811a5d73f3ca0bcbf32064d663ed81318ab225ee4f427ad4e26e5aff3", size = 175437, upload-time = "2025-03-05T20:02:16.706Z" },
+ { url = "https://files.pythonhosted.org/packages/f4/71/809a0f5f6a06522af902e0f2ea2757f71ead94610010cf570ab5c98e99ed/websockets-15.0.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:592f1a9fe869c778694f0aa806ba0374e97648ab57936f092fd9d87f8bc03665", size = 173096, upload-time = "2025-03-05T20:02:18.832Z" },
+ { url = "https://files.pythonhosted.org/packages/3d/69/1a681dd6f02180916f116894181eab8b2e25b31e484c5d0eae637ec01f7c/websockets-15.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0701bc3cfcb9164d04a14b149fd74be7347a530ad3bbf15ab2c678a2cd3dd9a2", size = 173332, upload-time = "2025-03-05T20:02:20.187Z" },
+ { url = "https://files.pythonhosted.org/packages/a6/02/0073b3952f5bce97eafbb35757f8d0d54812b6174ed8dd952aa08429bcc3/websockets-15.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8b56bdcdb4505c8078cb6c7157d9811a85790f2f2b3632c7d1462ab5783d215", size = 183152, upload-time = "2025-03-05T20:02:22.286Z" },
+ { url = "https://files.pythonhosted.org/packages/74/45/c205c8480eafd114b428284840da0b1be9ffd0e4f87338dc95dc6ff961a1/websockets-15.0.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0af68c55afbd5f07986df82831c7bff04846928ea8d1fd7f30052638788bc9b5", size = 182096, upload-time = "2025-03-05T20:02:24.368Z" },
+ { url = "https://files.pythonhosted.org/packages/14/8f/aa61f528fba38578ec553c145857a181384c72b98156f858ca5c8e82d9d3/websockets-15.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64dee438fed052b52e4f98f76c5790513235efaa1ef7f3f2192c392cd7c91b65", size = 182523, upload-time = "2025-03-05T20:02:25.669Z" },
+ { url = "https://files.pythonhosted.org/packages/ec/6d/0267396610add5bc0d0d3e77f546d4cd287200804fe02323797de77dbce9/websockets-15.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d5f6b181bb38171a8ad1d6aa58a67a6aa9d4b38d0f8c5f496b9e42561dfc62fe", size = 182790, upload-time = "2025-03-05T20:02:26.99Z" },
+ { url = "https://files.pythonhosted.org/packages/02/05/c68c5adbf679cf610ae2f74a9b871ae84564462955d991178f95a1ddb7dd/websockets-15.0.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5d54b09eba2bada6011aea5375542a157637b91029687eb4fdb2dab11059c1b4", size = 182165, upload-time = "2025-03-05T20:02:30.291Z" },
+ { url = "https://files.pythonhosted.org/packages/29/93/bb672df7b2f5faac89761cb5fa34f5cec45a4026c383a4b5761c6cea5c16/websockets-15.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3be571a8b5afed347da347bfcf27ba12b069d9d7f42cb8c7028b5e98bbb12597", size = 182160, upload-time = "2025-03-05T20:02:31.634Z" },
+ { url = "https://files.pythonhosted.org/packages/ff/83/de1f7709376dc3ca9b7eeb4b9a07b4526b14876b6d372a4dc62312bebee0/websockets-15.0.1-cp312-cp312-win32.whl", hash = "sha256:c338ffa0520bdb12fbc527265235639fb76e7bc7faafbb93f6ba80d9c06578a9", size = 176395, upload-time = "2025-03-05T20:02:33.017Z" },
+ { url = "https://files.pythonhosted.org/packages/7d/71/abf2ebc3bbfa40f391ce1428c7168fb20582d0ff57019b69ea20fa698043/websockets-15.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:fcd5cf9e305d7b8338754470cf69cf81f420459dbae8a3b40cee57417f4614a7", size = 176841, upload-time = "2025-03-05T20:02:34.498Z" },
+ { url = "https://files.pythonhosted.org/packages/cb/9f/51f0cf64471a9d2b4d0fc6c534f323b664e7095640c34562f5182e5a7195/websockets-15.0.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ee443ef070bb3b6ed74514f5efaa37a252af57c90eb33b956d35c8e9c10a1931", size = 175440, upload-time = "2025-03-05T20:02:36.695Z" },
+ { url = "https://files.pythonhosted.org/packages/8a/05/aa116ec9943c718905997412c5989f7ed671bc0188ee2ba89520e8765d7b/websockets-15.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5a939de6b7b4e18ca683218320fc67ea886038265fd1ed30173f5ce3f8e85675", size = 173098, upload-time = "2025-03-05T20:02:37.985Z" },
+ { url = "https://files.pythonhosted.org/packages/ff/0b/33cef55ff24f2d92924923c99926dcce78e7bd922d649467f0eda8368923/websockets-15.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:746ee8dba912cd6fc889a8147168991d50ed70447bf18bcda7039f7d2e3d9151", size = 173329, upload-time = "2025-03-05T20:02:39.298Z" },
+ { url = "https://files.pythonhosted.org/packages/31/1d/063b25dcc01faa8fada1469bdf769de3768b7044eac9d41f734fd7b6ad6d/websockets-15.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:595b6c3969023ecf9041b2936ac3827e4623bfa3ccf007575f04c5a6aa318c22", size = 183111, upload-time = "2025-03-05T20:02:40.595Z" },
+ { url = "https://files.pythonhosted.org/packages/93/53/9a87ee494a51bf63e4ec9241c1ccc4f7c2f45fff85d5bde2ff74fcb68b9e/websockets-15.0.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c714d2fc58b5ca3e285461a4cc0c9a66bd0e24c5da9911e30158286c9b5be7f", size = 182054, upload-time = "2025-03-05T20:02:41.926Z" },
+ { url = "https://files.pythonhosted.org/packages/ff/b2/83a6ddf56cdcbad4e3d841fcc55d6ba7d19aeb89c50f24dd7e859ec0805f/websockets-15.0.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f3c1e2ab208db911594ae5b4f79addeb3501604a165019dd221c0bdcabe4db8", size = 182496, upload-time = "2025-03-05T20:02:43.304Z" },
+ { url = "https://files.pythonhosted.org/packages/98/41/e7038944ed0abf34c45aa4635ba28136f06052e08fc2168520bb8b25149f/websockets-15.0.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:229cf1d3ca6c1804400b0a9790dc66528e08a6a1feec0d5040e8b9eb14422375", size = 182829, upload-time = "2025-03-05T20:02:48.812Z" },
+ { url = "https://files.pythonhosted.org/packages/e0/17/de15b6158680c7623c6ef0db361da965ab25d813ae54fcfeae2e5b9ef910/websockets-15.0.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:756c56e867a90fb00177d530dca4b097dd753cde348448a1012ed6c5131f8b7d", size = 182217, upload-time = "2025-03-05T20:02:50.14Z" },
+ { url = "https://files.pythonhosted.org/packages/33/2b/1f168cb6041853eef0362fb9554c3824367c5560cbdaad89ac40f8c2edfc/websockets-15.0.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:558d023b3df0bffe50a04e710bc87742de35060580a293c2a984299ed83bc4e4", size = 182195, upload-time = "2025-03-05T20:02:51.561Z" },
+ { url = "https://files.pythonhosted.org/packages/86/eb/20b6cdf273913d0ad05a6a14aed4b9a85591c18a987a3d47f20fa13dcc47/websockets-15.0.1-cp313-cp313-win32.whl", hash = "sha256:ba9e56e8ceeeedb2e080147ba85ffcd5cd0711b89576b83784d8605a7df455fa", size = 176393, upload-time = "2025-03-05T20:02:53.814Z" },
+ { url = "https://files.pythonhosted.org/packages/1b/6c/c65773d6cab416a64d191d6ee8a8b1c68a09970ea6909d16965d26bfed1e/websockets-15.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:e09473f095a819042ecb2ab9465aee615bd9c2028e4ef7d933600a8401c79561", size = 176837, upload-time = "2025-03-05T20:02:55.237Z" },
+ { url = "https://files.pythonhosted.org/packages/fa/a8/5b41e0da817d64113292ab1f8247140aac61cbf6cfd085d6a0fa77f4984f/websockets-15.0.1-py3-none-any.whl", hash = "sha256:f7a866fbc1e97b5c617ee4116daaa09b722101d4a3c170c787450ba409f9736f", size = 169743, upload-time = "2025-03-05T20:03:39.41Z" },
]
[[package]]