feat(tui): add purple shimmer for capability keywords - #315
Conversation
tt-a1i
left a comment
There was a problem hiding this comment.
审查结论:Changes Requested
审查固定版本:665e1954475dac35c6bed125854145d78ff25daa。
解决什么问题 / 价值 / 方法
把 subagent(s)、workflow(s) 的静态紫色高亮改成逐字符流光,让输入中的能力识别反馈更明显。实现复用了现有 CapabilityIntentHighlightEditor 和 editor layer,使用 1.4 秒动画周期、120ms 刷新间隔;没有新增命令、配置或编辑器框架,也没有改动输入正文、能力分类、工具权限或模型上下文。
Findings
- Standards:未发现确认的架构或生命周期违规。
- Spec:1 项 P2,详见行内评论。#301 要求不支持动态效果时退回静态紫色,但目前 truecolor 和 256-color 两条路径都随 phase 变化,没有静态降级路径。这里不是认为所有 256-color 终端都不能播放动画。
建议只补齐这个小边界和回归测试,不必增加设置或通用动画框架。
验证证据
此前在上述 exact head 的隔离 checkout 上完成:
bun run check:通过。bun run test:Node 1071 通过、1 项平台跳过、0 失败;Vitest 30 通过。- capabilities index/UI 专项测试:20/20 通过。
git diff --check:通过。- 对实际颜色函数的探针:四个关键词在两种颜色模式下都会随 phase 改变;去除 ANSI 后文本和原生 Pi visibleWidth 保持不变。
- 对实际扩展配合模拟 host/timer 的探针:重复包装没有新增计时器,session shutdown 清理计时器,空输入不请求重绘,关键词输入会请求重绘。空输入仍有周期性读取/分类;这不是零 CPU 开销的证明。
GitHub 已有 CI 为绿色,但 PR 当前落后于 main;同步后仍需验证最终 head。
证据边界
上述是源码、自动化和模拟宿主验证,不是真实 TUI 验收。真实终端中的光标、换行及浅色主题可读性仍未由本次审查验证,不能用 CI 或模拟探针代替。没有把这些未知项报成已确认缺陷。
本次仅提交 review,没有修改代码或合并。
| const intensity = shimmerIntensity(index, characters.length, phase); | ||
| const start = | ||
| options.colorMode === "truecolor" | ||
| ? truecolorForeground(shimmerRgb(base, highlight, intensity)) |
There was a problem hiding this comment.
#301 明确要求“不支持动态效果的终端能够正常显示静态紫色”。这里的 truecolor 与 256-color 分支都使用随 phase 变化的 intensity;index.ts 也无条件传入动态 phase,并在存在关键词时每 120ms 请求刷新,因此目前没有实现该静态降级行为。实际调用探针也确认了四个关键词在两种色彩模式下 phase=0 与 0.5 的输出均不同。
这不是说 256-color 终端一定不能动画,而是颜色模式切换本身不能实现约定的静态降级。请用最小改动保留静态紫色路径,并让进入降级路径时不再触发动画刷新;补充该路径输出不随 phase 变化、不会继续动画重绘的测试即可,不需要额外配置或动画框架。
Code Review Summary结论:Changes Requested(1 项 P2) — 审查版本
本次只提交审查,未改代码、未合并。 |
Problem
OpenPI currently highlights capability intent keywords with a static purple
foreground color. The visual feedback is easy to miss and does not provide the
flowing purple shimmer effect used by Claude Code for
ultracode.Issue : #301
Value
Improve the visual feedback for capability intent keywords while keeping the
existing capability recognition and execution behavior unchanged.
Approach
subagent,subagents,workflow,and
workflows.is present.
capability loading, or permissions.
Validation
node --test --experimental-strip-types tests/extensions/capabilities/ui.test.tsImpact
shimmer instead of a static color.
Closes : #301