Files
social-app/docs/plans/2026-03-16-account-and-chat-surface-language-implementation.md
T

3.2 KiB

账户页与主页工具渲染统一表面语言 Implementation Plan

For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: 统一 我的账户 页面与主页 ui_schema 渲染的视觉语言,修正 STEP 协议映射并将等待文案从“正在思考”切换为协议阶段语义。

Architecture: 设置域继续复用 AccountSurfaceScaffold + AccountSectionCard;聊天域在 UiSchemaRenderer 中重做 surface 层级与按钮/徽章/KV 呈现,保持协议字段不变。将 stage 映射改为 router/worker 协议值,在 UI 显示为“意图识别中/任务执行中/任务处理中”。

Tech Stack: Flutter, flutter_bloc, design tokens (AppColors/AppSpacing/AppRadius), AG-UI SSE protocol mapping


Task 1: 先补失败测试(Stage 文案与 UI Schema 呈现)

Files:

  • Create: apps/test/features/chat/presentation/agent_stage_mapping_test.dart
  • Modify: apps/test/features/chat/ui_schema_renderer_test.dart

Step 1: 写失败测试

  • 新增 stage 映射测试,断言 router -> intentLabelworker -> executionLabel、未知 -> processingLabel
  • 扩展 ui_schema_renderer_test.dart,断言 card surface、按钮文案、badge 仍可渲染

Step 2: 跑测试确认失败

Run: flutter test test/features/chat/presentation/agent_stage_mapping_test.dart test/features/chat/ui_schema_renderer_test.dart Expected: FAIL(映射函数/新视觉结构尚未实现)

Step 3: 最小实现使测试通过

  • 新增 stage 映射文件并接入 chat/home
  • 重构 UiSchemaRenderer 的 surface 风格并保持现有 schema 兼容

Step 4: 再跑测试确认通过

Run: flutter test test/features/chat/presentation/agent_stage_mapping_test.dart test/features/chat/ui_schema_renderer_test.dart Expected: PASS

Task 2: 重构我的账户页面为统一表面语言

Files:

  • Modify: apps/lib/features/settings/ui/screens/account_screen.dart

Step 1: 写失败测试(轻量)

  • 可选新增页面结构测试,断言标题/分组/退出按钮存在

Step 2: 运行测试确认失败(若新增测试)

Run: flutter test test/features/settings/ui/screens/... Expected: FAIL

Step 3: 最小实现

  • AccountSurfaceScaffold 承载页面
  • AccountSectionCard 承载账户菜单与安全操作分组
  • 退出登录按钮改为统一 token 风格

Step 4: 测试通过

Run: flutter test test/features/settings/ui/screens/... Expected: PASS

Task 3: 协议对齐与主页等待文案修正

Files:

  • Modify: apps/lib/features/chat/presentation/bloc/chat_bloc.dart
  • Modify: apps/lib/features/home/ui/screens/home_screen.dart
  • Create: apps/lib/features/chat/presentation/bloc/agent_stage.dart

Step 1: 保持协议语义

  • 将 step 映射改为文档约定:routerworker
  • 显示文案:意图识别中任务执行中任务处理中

Step 2: 运行相关测试

Run: flutter test test/features/chat/presentation/agent_stage_mapping_test.dart test/features/home/ui/widgets/home_screen_layout_test.dart Expected: PASS

Task 4: 全量验证

Step 1: 静态检查

Run: flutter analyze Expected: 无新增错误

Step 2: 回归测试

Run: flutter test Expected: PASS