Repository navigation
Description
repo:cloud#5 · hotlong · session_01Q4EjjMouQg4opwRbvXunTA
Filing gate: ③ maintainer-directed task · Source: topic #37690 — Jack 2026-11-27T00:09Z:「对话界面改进 ,用fable评估,开始分拆」;Fable 评审后本卡范围缩小为只搬工具卡。
Grade: area:ai · Task · p2 · reach: 无行为变化的重构 · evidence: read(基线 objectstack main 80519b5 + PR #37720 head c2b7b6a)
Reader: 专题 objectstack#37690 的拆分卡线程(os-dev)。
Dedupe: 同 #37728,无重叠。
Blocked-by: #37728(拆分卡 A,同文件,A 合并后开工)
为什么
卡 A 之后主组件仍约 1372 行,其中 renderToolDetail 闭包约 450 行,是最大的一块,也是后续审批卡改动要动的地方。
做什么
把主组件里的 renderToolDetail 闭包搬到 ui/packages/plugin-chatbot/src/chat/toolDetail.tsx,主组件约 1372 → 920 行。
- 首选写法:模块顶层的纯函数
renderToolDetail(tool, ctx),返回的元素树与现在逐字一致(仍是<Tool key={tool.toolCallId} defaultOpen={…}>开头)。ctx是一个对象,装闭包现在读的 props、标签和回调(约 40 个:toolDecisions、onToolApprove、processVisibility、L、tt、toolStatusLabels等)。主组件原地调用renderToolDetail(tool, ctx)。 - 若改成组件
ToolDetailCard,必须同时满足:定义在模块顶层;key={tool.toolCallId}放在调用处外层;只收一个ctx对象;不新增 hook 或 memo。 writtenRecordOf、formatRecordWriteValue从卡 A 的toolRecordWrite.ts引入。
先加一条测试(不改旧测试)
在拆分之前,在基线上新增一条测试并跑绿:用户手动折叠或展开某张工具卡后,父组件 rerender(例如追加一条消息),该卡的展开状态保持不变。拆分后同一测试仍绿。这是本卡唯一允许新增的测试文件,旧测试文件一律不改。
不做
MessageItem、ChatComposer 这类按区域的拆分本轮不做:它们各要传 50 多个闭包变量,边界等第 3 段的体验改动来定。
通用约束(本专题三张拆分卡共用)
- 只搬代码,不改行为:不改 JSX 结构、className、文案键、hook 调用顺序、memo 依赖、条件分支。
- 原文件保留具名 re-export(
export { a, b } from './x',类型用export type { … }),⛔ 不用export *:docs/qa/platform-checklist/的符号锚点(scripts/symbol-anchors.mjs)只认具名导出。所有现有 import 路径保持不变。 - 测试文件不改,本卡另列的例外除外。
- 新文件不得 import 原大文件(避免环)。对
../mapMessages等反向依赖方只能import type。 - 公开入口冻结:
ui/packages/plugin-chatbot/src/index.tsx、ui/packages/plugin-chatbot/src/core.ts、ui/packages/app-shell/src/index.ts三个文件 diff 为空。 - 验收:现有测试全绿;type-check、lint、build 通过;PR 描述贴
git diff --color-moved=zebra --stat和一句说明“删除行与新增行之差只有 import/export 行”。 - changeset:放仓根
.changeset/(ui/AGENTS.md),级别patch;changeset 正文和 PR 描述都写Clause-②: no与Metadata-protocol: none两行(AGENTS.md「Post-Task Checklist」第 3 步)。不碰 CHANGELOG。 - 推送前跑 overlap-check。cloud#5027 agent 效果专题优先:它若有在飞 PR 碰同一文件,本卡让路。
Activity
objectstack-fleet commentedon Nov 27, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in area:ai · domain:ui · Task · priority:p2 ·
pm:blocked· size M; rationale: chat component split B (the tool-card renderer). It is a split card, not a topic:pm:epicis for the maintainer's topics only, so it moves frompm:epictopm:blockedon its namedBlocked-by: #37728. p2 as filed.objectstack-fleet commentedon Nov 27, 2026
repo:objectstack#1 · os-elon-musk · session_016WV4cwGVgec21LwQTtRY85
Claim: PM loop round 2 · area o1-D (hand-off 7209013967 from epic:#5027#1, accepted 7210179549; unblocked: #37728's PR #37799 merged 11:53Z as 754e216) · 2026-11-27T11:56Z
Session:
session_016WV4cwGVgec21LwQTtRY85Account:
os-elon-muskBranch:
claude/issue-37729-tool-detail-splitWorktree:
objectstack-issue-37729Domain:
domain:uiArea: o1-D
Seat:
repo:objectstack#1File surface:
ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx, newui/packages/plugin-chatbot/src/chat/toolDetail.tsx, the one new test file the card allows, one changeset (stop on breach; explain in the report)Container & model: M, mode:subagent, model: default tier (dispatch-gates --tier on ChatbotEnhanced.tsx: "no path-derived mandate"), effort: high
Clause-②: no
Metadata-protocol: none
Responsibility: n/a — not a defect card (Task)
Thread-read: 7207101921
Premise: holds — on origin/main f926dfa
ChatbotEnhanced.tsxis 1514 lines (the card's "about 1372" was read before #37799's final head; re-measured),renderToolDetailis the closure at line 539 called at line 1180, andwrittenRecordOf/formatRecordWriteValuelive inchat/toolRecordWrite.ts.Serial constraints cleared:
none: overlap-check on a probe branch touching ChatbotEnhanced.tsx and a new chat/toolDetail.tsx exit 0 against origin/main f926dfaba8; #37728 (PR #37799) and #37730 (PR #37803) merged.Pre-claim lane:
ui/packages/plugin-chatbot/**⇒domain:ui(file ownership only); not governed.Pre-claim deps:
Blocked-by: #37728closed (PR #37799 merged); seat relay 11:55Z.Prior rulings read: topic #37690 maintainer order 「对话界面改进 ,用fable评估,开始分拆」 (quoted in the card); the card's eight shared constraints (move only, named re-exports, frozen public entries) are the binding text; no ruling in the tree bounds the move.
Fold-or-serial: not folded — no other o1-D card touches plugin-chatbot except #37833's additive
useAgents.tsedit (another file).