sync update from LAN repo (source dhk-1 @ 3b1ec5b4)

This commit is contained in:
gozeros committed 2026-11-05 10:56:34 +08:00
1 parent da6521b6cb
commit 264e2200d6
995 files changed
+148105 -13399

No files matched your search

@@ -311,13 +311,13 @@ chain 模式的 Step 2 init **完全复用** `initMultiAgent`:`agentNames = ch
### 阶段 3 · 业务链条选择卡片列表(1.5 天) ✅ 已完成
**目标**:弹窗「业务链条」面板里选链条。新增 `components/BusinessChainPicker.tsx`,替换阶段 2 的占位。
- [x] 进入该 Tab 时 `listChains()` 拉本人链条 + `listAgents()` 取存活 id/名称,渲染**卡片列表**:
- [x] 进入该 Tab 时 `listChains()` 拉本人链条渲染**卡片列表**(席位存活/名称用链条响应自带的读时计算富化字段 `seat.available`/`seat.live_name`,**不再实时拉 `listAgents()`**,见 §11):
- [x] 卡片标题(链条 title)+ 「N 席」徽章 + 选中 ✓;描述行。
- [x] 标题下一排**智能体名 tag**:按链条顺序**从左到右**、不同颜色(`getAvatarTypeFor`→`chainTagClasses`),tag 之间插 `→`(`ArrowRightIcon`)箭头连接(`seats[0]` 最左、先发言)。
- [x] 底部「配置链条」按钮(跳 `roundtable/chains`)。
- [x] 空态:无链条时引导「去配置页面创建第一条业务链条」+ 按钮。
- [x] 选中一条 → 高亮(`ring-primary`);底部「进入研讨」`onConfirm({ agents: 存活席位有序, mode:"chain", chain:{id,title} })`。
- [x] 链条里有 agent 已不存在(被删)→ 该 tag 置灰删除线 + `title` 提示 + 卡片下方 amber 警告;confirm 按**存活席位**过滤;存活 < `CHAIN_MIN_SEATS` 则禁用「进入研讨」并提示。agent 列表加载失败时 `existingIds=null` → 不误判删除。
- [x] 链条里有 agent 已不存在(被删)→ 该 tag 置灰删除线 + `title` 提示 + 卡片下方 amber 警告;confirm 按**存活席位**过滤;存活 < `CHAIN_MIN_SEATS` 则禁用「进入研讨」并提示。存活判定改读 `seat.available`(undefined = 旧后端未标注 → 不误判删除)。
- **验收**:✅ typecheck 0 新增错误(总数仍 76)。卡片渲染标题 + 彩色 tag + ← 箭头;选链 → `onConfirm(mode:"chain")` → `handleConfirmAgents` 按链条顺序 `setSelectedAgents` → Step 2 左侧「参与角色」顺序 = 链条顺序(**按顺序派活在阶段 4**)。**人工 UI 验收待跑**。
- **箭头方向**(已确认):tag 左→右排列、`→`(`ArrowRightIcon`)连接,`seats[0]` 最左、先发言,箭头顺读即链条研讨顺序。
@@ -396,5 +396,42 @@ chain 模式的 Step 2 init **完全复用** `initMultiAgent`:`agentNames = ch
| 后端链条持久化 | `offline-backend-20260512/backend/packages/harness/deerflow/persistence/roundtable_chains/` | 新增 |
| 后端链条路由 | `offline-backend-20260512/backend/app/gateway/routers/roundtable_chains.py` | 新增 |
| 后端 store 接线 | `offline-backend-20260512/backend/app/gateway/deps.py`(`app.state.roundtable_chain_store`)+ `app.py` | 改 |
---
## 11. 席位富化:选链不再实时拉智能体列表(2026-10-23)
**背景**:选链全链路(弹窗打开 / 左栏点选 / 深链自动选链)此前每次都额外全量拉
`GET /api/agents`,只为两件事——席位**存活判断**(existingIds)与**最新改名**
(nameById)。慢网下这个大请求严重拖慢选链体验。
**方案**:席位展示所需信息(name 快照本就随链条落库、编辑器保存时刷新)之外,
「存活 + 最新名」由**后端在返回链条时读时计算**:
- `GET /api/roundtable-chains`(list/get/update 等)对每条链每个 seat 附带两个
**只读计算字段**(`ChainSeatResponseSchema`,不落库、create/update 请求 schema
不收,存量 seats JSON 零迁移):
- `available: bool` —— 席位智能体当前对请求用户可见(本人/内置/已发布、非私享、
非管理员隐藏,`agent_store.list_by_ids` 一次批量 SQL)且不是功能型内置
(`roundtable-intent/recommender/coordinator/report` + `roundtable-coordinator-*`
前缀,与前端 `filterRecommendCandidates` 排除集逐字对齐);
- `live_name: string | null` —— 智能体当前名称,查不到为 null。
- best-effort:agent store 不可用时跳过富化(字段缺省),前端按存活处理。
- 前端 `ChainSeat` 增加可选 `available` / `live_name`;`buildChainSeatSelection(chain,
candidates?)` 的 `candidates` 变为可选——不传时存活 = `seat.available !== false`
(undefined = 旧后端 → 视为存活,与旧版「拉取失败不判删」降级语义一致)、名称 =
`live_name ?? name ?? agent_id`。
- 去掉选链路径上的全部 `listAgents()`:`BusinessChainPicker`(打开只剩 1 个
`listChains` 请求)、`BusinessChainListDialog`(列表弹窗)、主页左栏点选
(**零网络请求**)、固定链(8BF 等)与深链自动选链。
- 「智能推荐」Tab 与链条编辑器的智能体池**保留** `listAgents()`——那两处真的需要
完整候选列表。
**兜底**:智能体在选链之后、进 Step 2 之前被删,`/api/multi-agent/init` 的后端
404 硬校验照旧兜底(现状即有,非本次引入)。
**测试**:后端 `tests/test_roundtable_chain_seat_enrichment.py`(纯函数 + schema
不落库 + store 往返);前端 `src/roundtable-planning/lib/business-chain.test.ts`
(`pnpm run test:business-chain`,esbuild 打包后 node:test)。
</content>
</invoke>