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: org:objectstack-ai is:issue ChatbotEnhanced split 47 条,均为已关 build 期卡,无重叠;除 #37720 外 44 个 open PR 无一碰本文件(2026-11-27 00:15Z 核)。
Blocked-by: #37682(PR #37720 删 build 对话前端,本文件被它删 4465 行,合并后才能开工)
为什么
ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx 删完 build 后仍有 3335 行,其中主组件 1372 行、Props 接口 272 行,其余是可独立的类型、子组件和工具函数。后续体验改进(反馈、审批卡、思考时间线等)都要改这个文件,先拆开降低冲突和审阅成本。
做什么
主文件只留主组件 ChatbotEnhanced、只被主组件用的 formatMessageProps 和两个 PLAIN_SURFACE_* 常量,以及对搬走符号的具名 re-export。预计约 3335 → 1700 行。新文件放 ui/packages/plugin-chatbot/src/chat/(plugin-chatbot 内相对 import 不带 .js 后缀,跟现有写法一致):
types.ts:ChatbotEnhancedMessage、ChatbotEnhancedToolInvocation、ChatChart、ChatSource、ChatbotLabels、ChatbotEnhancedProps、ChatbotProcessVisibility、ChatbotSurface、ChatbotModelOption、ToolDecisionState、TurnLiveness。对../mapMessages只能import type(mapMessages.ts:28反向引用这些类型)。ModelPicker.tsx:ModelPicker、drawnMultiplierOf、EXPENSIVE_MODEL_MULTIPLIER、OUTSIDE_MODELS。liveness.tsx:useTurnLiveness、LivenessIndicator、LIVENESS_QUIET_AFTER_SECONDS、useIsOffline、formatElapsed、ThinkingDots、AssistantThinkingMessage、MessageAvatar。toolSummary.tsx:getToolState、getToolStateRank、ToolSummaryState、ToolSummaryGroup、shouldRenderDetailedTool、summarizeTools、ToolPhaseSummary、ToolPhaseStep、foldToolPhaseSteps、isPlumbingTool、PLUMBING_TOOL_NAMES、ToolActivitySummary、ToolActivitySummaryLabels、ToolSummaryIcon、getToolSummaryStatus、ToolRunningTimer、usePhaseElapsed、phaseClock、SmartToolOutput、looksLikeJson。依赖方向只能toolSummary → liveness(ToolRunningTimer用useIsOffline、formatElapsed)。answerLayout.tsx:layoutAnswer、AnswerBlock、AnswerCharts、isToolCallPlaceholder。toolRecordWrite.ts:writtenRecordOf、formatRecordWriteValue(只被工具卡用,卡 B 会接着用)。composerNotices.tsx:ErrorBanner、ComposerNotice、SendErrorNotice、formatSizeLimit、useAiQuotaCopy。
⛔ 模块级单例只能有一份:phaseClock(模块级 Map,注释写明“pane 重挂载时保留计时”)必须和 usePhaseElapsed 一起搬进 toolSummary.tsx,不得留副本。
上面没点名的私有辅助跟它唯一的使用者走;有疑问时留在原文件,在 PR 描述里列出。行号会因 #37720 合并后的 main 变化,以符号名为准。
内部消费方(FloatingChatbot、chatMessageAdapter、mapMessages、renderer、toolResultParsers、useAiModels、useHitlInChat)不用改,经 re-export 照常工作。
不做
主组件内部的拆分(卡 B);mapMessages.ts、useObjectChat.ts;任何体验改动。
通用约束(本专题三张拆分卡共用)
- 只搬代码,不改行为:不改 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
repo:cloud#5 · hotlong · session_01Q4EjjMouQg4opwRbvXunTA
Claim: PM loop round 1 · epic #37690, maintainer order 「对话界面改进 ,用fable评估,开始分拆」 · 2026-11-27T00:28Z
Session:
session_01Q4EjjMouQg4opwRbvXunTAThread session:
session_01Q4EjjMaLacWen8f2akYQCJAccount:
hotlongBranch:
claude/project-thread-dvvo6jWorktree:
objectstack-issue-37728Domain:
domain:uiSeat:
repo:cloud#5File surface:
ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx, new files underui/packages/plugin-chatbot/src/chat/named on the card, one changeset (stop on breach; explain in the report)Container & model:
M,mode:thread,model: default (no path-derived mandate),effort: highClause-②: no
Metadata-protocol: none
Responsibility: n/a — not a defect card (maintainer-directed task)
Thread-read: none
Premise: holds (symbol list read against PR #37720 head c2b7b6a and reviewed by Fable; re-check every symbol on main after #37720 merges)
Serial constraints cleared: Blocked-by #37682 — PR #37720 (draft) rewrites this file; start from main after it merges, rehearsal on its head only, push nothing before. Sibling #37730 is another package, parallel; #37729 (same file) waits for this card. No cloud#5027 PR touches this file at claim time; overlap-check before every push.
Order: the card body itself (plan record: project file
ai-chat/split-plan-r2.md)objectstack-fleet commentedon Nov 27, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in area:ai · domain:ui · Task · priority:p2 ·
pm:dispatched· size M; rationale: chat component split A, a behaviour-neutral move of ChatbotEnhanced's types, sub-components and helpers. It is the maintainer-ordered follow-on to the build UI removal, and its body names #37682 as the blocker; the claim waits for #37682's PR. p2 as filed.