Skip to content

feat(mobile): 命令步骤优先显示 AI 动作描述 - #2044

Open
YuMo-233 wants to merge 4 commits into
NanmiCoder:mainfrom
YuMo-233:feat/mobile-command-description
Open

YuMo-233 wants to merge 4 commits into
NanmiCoder:mainfrom
YuMo-233:feat/mobile-command-description

Conversation

@YuMo-233

@YuMo-233 YuMo-233 commented Nov 26, 2026 •

Copy link
Copy Markdown

Summary

Upstream issue: #2034 — Closes #2034

手机端命令执行标签改为优先展示模型写入的 description(人类可读动作),与桌面端 ToolCallBlock 的既有规则一致;没有 description 时保持原样,回退到「运行 + 命令首行」。

  • mobile/src/ui/chat/steps.ts:StepLabel 新增 description?: boolean;Bash / PowerShell 分支优先读取 input.description(trim 后压成单行),否则走原逻辑。
  • mobile/src/ui/chat/StepGroup.tsx:折叠行用单行渲染描述;展开后的详情先显示完整 description,再显示 $ command 与输出,长描述不会被截断后无处查看。
  • mobile/src/ui/chat/captionModel.ts:状态条中,中文/日文/韩文描述显示为「正在<描述>」,拉丁字母描述原样显示,避免「正在调用 Run tests」这类病句。
  • mobile/src/ui/chat/StatusCaption.tsx:前导词改为可收缩单行文本,长描述不会把「已运行 …」「已输出约 … tokens」挤出可视区。
  • mobile/src/core/sessionActivityModel.ts + mobile/src/ui/activity/ActivitySheet.tsx:StepLine 透传 description 标记,活动面板的子 Agent 步骤图标仍按 shell 步骤显示终端图标,不会退化成文件图标。
  • 覆盖范围:聊天步骤行、输入框上方状态条、子代理步骤行(三者共用 describeStep / StepLabel)。

Feature Quality Contract

  • Changed surface: mobile(React Native / H5)
  • Tests added or updated:
    • unit:mobile/src/ui/chat/steps.test.ts(有描述、PowerShell、空白描述回退、换行与制表符压成单行、全角空格保留)
    • unit:mobile/src/ui/chat/captionModel.test.ts(当前步骤取描述;中文/英文/日文/韩文/等批准五种文案)
    • unit:mobile/src/core/sessionActivityModel.test.ts(带描述的命令步骤保留 description 标记)
  • Coverage evidence:
    • cd mobile && bun --no-env-file test src/ui/chat/steps.test.ts src/ui/chat/captionModel.test.ts src/core/sessionActivityModel.test.ts → 103 pass / 0 fail(293 expects)
    • 全量 bun --no-env-file test src plugins → 1438 pass / 3 skip / 11 fail;git stash 基线同样 11 fail 且失败清单逐条一致,均为本机 Windows 环境既有问题(react-native-svg processColor、native network policy config plugin、LAN WebSocket、WAV upload、expo-notifications importance、ImagePreview/composer attachment),与本改动无关。CI mobile-checks 在 ubuntu 上通过。
  • E2E / live-model evidence:
    • bun run typecheck ✅、bun run lint ✅、bun run export:h5 /tmp/h5-test ✅
    • live model: not run (untrusted fork / no provider)
  • Known risk / rollback:
    • 风险低:仅在 description 存在时改变标签文案与排版;无描述时行为与之前一致。
    • 移动端仓库目前没有 React 组件渲染测试基础设施,StatusCaption 的截断与 ActivitySheet 的图标选择由静态核对与数据层用例覆盖,未加渲染测试。
    • 活动面板子 Agent 卡内的步骤行仍是单行截断,进入子会话可看到完整描述;该卡本轮不新增展开交互。
    • 回滚:revert 三个提交即可。

Verification

  • I ran the relevant local checks, or explained why they do not apply.
  • I added or updated same-area tests for every production behavior change.
  • I ran the checks selected by bun run check:impact; if I claim PR-ready/full validation, I also ran bun run verify.
  • New or changed executable production lines meet the changed-line coverage threshold, or the blocker/maintainer override is documented.
  • I attached or summarized the quality report path, JUnit/log artifact path, and pass/fail/skip counts.
  • I ran deterministic E2E/contract checks for cross-boundary changes. Live-model evidence is attached when a trusted maintainer ran it, otherwise it is explicitly marked not run.

Risk

  • This PR does not touch CLI core paths, is authored by a CODEOWNER, or has maintainer approval for allow-cli-core-change.
  • Production code changes include matching tests, or have maintainer approval for allow-missing-tests.
  • Coverage baseline/threshold changes have maintainer approval for allow-coverage-baseline-change.
  • Any quarantine-policy change has maintainer approval; deterministic provider/chat contract tests were not quarantined.
  • Provider/runtime changes are covered by offline mock/fixture contract tests; live smoke was run by a trusted maintainer or explicitly deferred.

YuMo-233 and others added 3 commits November 26, 2026 21:23
- 状态条前导词加 numberOfLines/ellipsize,承载 description 时可收窄,避免长说明溢出挤掉计时
- description 折叠换行与连续空白,防止固定高度容器被撑破
- 子 Agent 步骤行保留 description 标记,命令图标仍按终端处理
- 英文判定改用汉字检测,弯引号等排版符号不再触发「正在」前缀
- 命令步骤展开后补显完整 description,截断文本有处可查
- StatusCaption 前导词也可收缩,长 lead+object 不再挤出计时
- 假名/谚文按中文语序,描述里的全角空格保留
- 补语言判定与空白压缩的回归用例
@github-actions

Copy link
Copy Markdown

PR quality triage

Changed areas: none

CLI core policy: No CLI-core policy block detected.

Missing-test policy: No missing-test policy block detected.

Coverage baseline policy: No coverage-baseline policy block detected.

CLI core files:

  • none

Coverage policy files:

  • none

Required check plan:

  • See PR Quality / scope-plan; it is the single source of truth for selected jobs.

Test coverage signals:

  • No obvious missing-test signal from changed paths.

Risk notes:

  • No special risk notes from changed paths.

Hard merge gates come from the deterministic GitHub Actions contract lanes above.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[功能] 手机端命令执行显示 AI 动作描述

1 participant