Skip to content

tui: 增加启动页,调整选择弹窗/对话区样式和交互细节#410

Merged
phantom5099 merged 19 commits into1024XEngineer:mainfrom
creatang:fix/tui-markdown-render-pollution
Apr 23, 2026
Merged

tui: 增加启动页,调整选择弹窗/对话区样式和交互细节#410
phantom5099 merged 19 commits into1024XEngineer:mainfrom
creatang:fix/tui-markdown-render-pollution

Conversation

@creatang
Copy link
Copy Markdown
Collaborator

@creatang creatang commented Apr 22, 2026

背景

增加启动页,调整选择弹窗/对话区样式和交互细节
#398

本次改动

1) 增加启动页

  • 使用大字形 NEOCODE
  • 未发送前锁定启动页、发送/切换 session 后进入主界面

2) Header 与全局信息层级优化

  • Header 调整为双栏结构:
    • 左侧:NeoCode / model / status
    • 右侧:cwd: ...
  • 增加窄终端下的自动裁剪与对齐兜底,保证信息可读性与稳定性

3) 选择弹窗(Select Menu)重制

  • 参考 neocode-select-menu.html 重做 picker 的视觉:
    • 居中浮层卡片样式
    • 两行列表项(主标题 + 次信息)
    • 选中态改为左侧竖线一体化指示
  • 仅调整样式与排版,不改选择逻辑和键位逻辑

4) 对话区样式统一

  • YOU/NEO 标签样式更新(更接近参考视觉)
  • YOUNEO 消息统一左侧流式布局
  • 调整正文与标签配色层级,提升深色背景下可读性

兼容性说明

  • 本次不改业务流程与 runtime 核心逻辑,主要是 TUI 渲染层与样式层优化
  • 保持原有快捷键和主要交互路径不变

测试

  • go test ./internal/tui/core/app 通过
  • go test ./internal/tui/... 本地执行中存在上游既有失败(infra/services 若干用例),与本次样式改动无直接耦合,已在本地复现并记录

fennoai[bot]

This comment was marked as outdated.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 92.78351% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/tui/core/app/update.go 78.26% 18 Missing and 2 partials ⚠️
internal/tui/core/app/view.go 87.90% 10 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@creatang creatang force-pushed the fix/tui-markdown-render-pollution branch from 50dea83 to 4e18c23 Compare April 22, 2026 15:00
@creatang
Copy link
Copy Markdown
Collaborator Author

/code 解决一下ci错误

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 22, 2026

处理结果

已修复本 PR 的 CI 阻塞问题并推送到当前分支 fix/tui-markdown-render-pollution,提交为 d881038

本次修复

  • 修复 internal/tui/core/app/startup_view.goview.go 中启动页菜单类型重名导致的编译冲突(重命名 startup_view.go 内部类型/变量)。
  • internal/tui/core/app/view.go 补齐缺失的启动页渲染辅助方法(renderStartupViewstartupTypingTextstartupBlackLinestartupCenterWithinAnchorrenderStartupMenuLinesrenderStartupInputLine),恢复测试所依赖的接口。
  • internal/tui/core/app/update.go 恢复启动页可见时的 tick 动画推进与续订逻辑,避免启动页相关测试失败。
  • 清理 view.go 未使用导入。

验证

  • go test ./internal/tui/core/app 通过
  • go test ./internal/tui/... 通过
  • go test ./... 通过

未做事项:无。

View job run

xgopilot and others added 2 commits April 22, 2026 15:16
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: creatang <165447160+creatang@users.noreply.github.com>
…lution

fix(tui): resolve startup view compile break and restore tick flow
@creatang
Copy link
Copy Markdown
Collaborator Author

@xgopilot
你是资深 Go/TUI 架构评审,请对 PR https://github.com/1024XEngineer/neo-code/pull/410(tui: 增加启动页,调整选择弹窗/对话区样式和交互细节)做严格代码审查。

请按以下流程执行,且必须先做第 1 部分再做第 2 部分:

先确认总体方案设计是否成立
基于 origin/main...HEAD diff 审查。
先判断本 PR 是否仍然满足仓库主链路与边界:TUI -> Gateway -> Runtime -> Provider/Tools。
判断改动是否严格收敛在 TUI 渲染层,不引入跨层直连或业务状态越界。
判断交互设计闭环是否自洽:启动页锁定/解锁、session 切换、输入发送后的状态迁移。
再确认风险点(重点)
从以下维度找风险:
方案设计风险(状态机一致性、生命周期、可维护性)
模块边界风险(TUI 是否侵入 runtime/provider/tools 语义)
交互回归风险(窄终端裁剪、header 对齐、picker 高度/宽度、消息对齐)
渲染稳定性风险(tick 续订、footer/error 自动消失、startup 与 transcript 切换)
测试充分性风险(正常路径/边界/异常分支是否覆盖)
任何结论都要给具体证据(文件+行号+触发条件)。
输出格式(必须遵守)
先输出 Findings,按严重级别排序:High -> Medium -> Low。
每条问题格式固定为:
[Severity] 文件路径:行号
问题现象
为什么是风险(影响范围)
建议修复方式
若无问题,明确写:No blocking issues found,并补充剩余测试盲区。
不要输出表扬性内容,只输出问题、风险和改进建议。
额外约束
以仓库 AGENTS.md / CLAUDE.md 为最高规范。
不做“为了兼容旧版本”而破坏当前架构的建议。
不泛泛而谈,避免无证据判断。
使用建议
把上面提示词直接贴给 AI,再附上:

PR 描述
git diff origin/main...HEAD
关键文件:internal/tui/core/app/{view.go,update.go,startup_view.go,command_menu.go}

@creatang
Copy link
Copy Markdown
Collaborator Author

/code 请解决review提到的高,中风险问题,并且提升文件测试覆盖率到百分之九十五以上

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 22, 2026

处理结果

已修复 review 提到的高/中风险问题,并补充了对应测试,代码已推送到当前 PR 分支 fix/tui-markdown-render-pollution(commit: 3bba1d1)。

已完成项

  1. 修复高风险:footer error 在空闲期可能不自动消失
  • 变更:在 showFooterError 设置错误 toast 时追加一次延迟 tick 调度,确保无外部事件也能触发过期刷新。
  • 文件:internal/tui/core/app/app.gointernal/tui/core/app/update.go
  1. 修复中风险:启动页 Esc 误退出程序
  • 变更:启动页下 EscQuit 改为关闭启动页并聚焦输入框。
  • 文件:internal/tui/core/app/update.go
  1. 修复中风险:窄宽度 Header 可能溢出
  • 变更:composeHeaderLine 在紧凑宽度下进一步收缩左侧文本并兜底保证不超宽。
  • 文件:internal/tui/core/app/view.go
  1. 修复中风险:切回草稿态会重新锁屏导致语义不一致
  • 变更:startDraftSessionsetActiveSessionID("") 不再强制重锁启动页,保持进入主界面语义一致。
  • 文件:internal/tui/core/app/update.go
  1. 测试补充与覆盖提升
  • 更新/新增了启动页按键、footer tick 分发、header 窄宽度、防回归状态切换等测试。
  • 补齐了 command_menu 新增 delegate/item 分支测试。
  • 文件:internal/tui/core/app/update_test.gointernal/tui/core/app/view_test.gointernal/tui/core/app/command_menu_test.go

本地验证

  • go test ./internal/tui/core/app 通过
  • go test ./internal/tui/... 通过
  • go test ./... 通过

说明

  • 本地可确认本次修复点与新增分支已被测试覆盖。
  • Codecov 的“按 PR 补丁/文件”最终覆盖率(是否达到 95%)以 CI 回传结果为准。

View job run

xgopilot and others added 2 commits April 22, 2026 15:58
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: creatang <165447160+creatang@users.noreply.github.com>
…lution

fix(tui): resolve startup and footer tick regressions
fennoai[bot]

This comment was marked as outdated.

fennoai[bot]

This comment was marked as outdated.

@creatang
Copy link
Copy Markdown
Collaborator Author

/code 解决review中提到的必要性问题,并作为TUI资深设计师给出对于上述review你是否进行修复,原因是什么

- remove unreachable startupVisible animation/render path
- keep startupScreenLocked as single startup source of truth
- avoid forcing global truecolor profile
- cache picker delegate styles to reduce per-row allocations
- align tests with current startup lifecycle

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: creatang <165447160+creatang@users.noreply.github.com>
@phantom5099
Copy link
Copy Markdown
Collaborator

/review

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed 4-pass review (code quality, performance, security, docs). Found 2 noteworthy issues after deduplication.

a.footerErrorText = message
a.footerErrorUntil = a.now().Add(footerErrorFlashDuration)
// 新错误出现时主动补发一次 tick,确保空闲状态下也能驱动自动消失。
a.deferredFooterTick = appTickCmd()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium][Code Quality/Behavior] showFooterError only stores a deferred tick (deferredFooterTick) to be emitted at the start of a future Update call. When the error is produced late in the current update cycle (for example runFinishedMsg) and no further input/runtime event arrives, no tick is ever dispatched, so the footer error can stay visible indefinitely instead of auto-expiring. Consider scheduling appTickCmd() in the same update cycle that sets footerErrorUntil (or maintaining a persistent timer loop while the toast is active).

Comment thread internal/tui/core/app/app.go Outdated
transcriptContent string
transcriptScrollbarDrag bool
startupScreenLocked bool
startupIntroActive bool
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Low][Maintainability] startupIntroActive/startupIntroFrame/startupLoopFrame are added and reset in multiple paths, but there is no read-site in production code. This leaves dead state in the runtime model and increases cognitive load for future startup-screen changes. Recommend removing these fields now or wiring them into actual rendering/animation behavior with clear ownership.

@creatang
Copy link
Copy Markdown
Collaborator Author

creatang commented Apr 23, 2026

/code 查看最近的review,修复这些问题

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 23, 2026

处理结果

已修复最近 review 提到的必要性问题并推送到当前 PR 分支:fix/tui-markdown-render-pollution(commit: d70966b)。

修复内容

  1. 修复 showFooterError 自动消失驱动时机
  • 文件:internal/tui/core/app/update.go
  • 变更:新增 batchUpdateCmds,在当前 Update 返回前统一并入 deferredFooterTick,确保错误提示在“本次更新周期”即可启动过期 tick,不再依赖后续外部事件。
  • 原因:review 指出空闲场景下 footer error 可能不会自动过期,这一改动直接消除该触发条件。
  1. 移除未使用的启动页冗余状态
  • 文件:internal/tui/core/app/app.gointernal/tui/core/app/update.go
  • 变更:删除 startupIntroActive/startupIntroFrame/startupLoopFrame 字段及对应重置逻辑。
  • 原因:这些状态在生产渲染路径无读取点,仅增加维护复杂度;按 review 建议收敛模型状态。
  1. 同步更新测试以覆盖新行为
  • 文件:internal/tui/core/app/update_test.go
  • 变更:移除依赖已删除字段的断言;将会触发 footer error 的分支改为断言返回 tickMsg,验证“同轮返回即带 tick”。

验证

  • go test ./internal/tui/core/app
  • go test ./internal/tui/...

未执行项

  • 未运行 go test ./...(本次改动仅涉及 internal/tui/core/app,已完成对应模块与子树回归)。

View job run

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: creatang <165447160+creatang@users.noreply.github.com>
@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 23, 2026

处理结果

已查看最近 review 并完成必要修复,代码已推送到当前 PR 分支 fix/tui-markdown-render-pollution,提交:ede793d

本次修复

  1. 修复 footer error 的 tick 调度时机(对应 review 的 Medium)
  • 文件:internal/tui/core/app/update.go
  • 调整:在 UpdateupdateInputPanel 内统一通过 batchUpdateCmds()本轮返回前并入 deferredFooterTick,避免仅依赖“下一次 Update 才发 tick”导致空闲场景下自动过期不触发。
  • 结果:showFooterError 在当前更新周期内即可启动过期驱动。
  1. 关于启动页冗余状态(对应 review 的 Low)
  • 结论:该问题在当前分支先前提交 d70966b 已处理(相关冗余状态已移除),本次未重复改动该部分,仅做一致性校验。

测试

  • go test ./internal/tui/core/app
  • go test ./internal/tui/...

未执行项

  • 未运行 go test ./...(本次仅涉及 TUI 模块)。

View job run

xgopilot and others added 2 commits April 23, 2026 11:34
Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: creatang <165447160+creatang@users.noreply.github.com>
…lution

Fix/tui markdown render pollution
@creatang
Copy link
Copy Markdown
Collaborator Author

/code 解决现在的代码冲突

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 23, 2026

处理结果

已解决当前 PR 的代码冲突并推送到分支 fix/tui-markdown-render-pollution,提交:7420128

本次处理

  • 定位冲突来源:internal/tui/core/app/update.go(与 origin/main 合并时冲突)。
  • 对冲突代码做手工重排:
    • 保留当前分支的 workspace command 行为;
    • 调整 workspaceCommandResultMsg 与输入分支处理位置,避免与 main 删除片段发生同区块冲突;
    • 对两处返回路径改为与 main 一致的 tea.Batch(cmds...),消除残余冲突点。
  • 已执行 gofmt -w internal/tui/core/app/update.go

验证

  • go test ./internal/tui/core/app 通过。
  • 三方合并校验:git merge-tree --write-tree --messages --name-only HEAD origin/mainCONFLICT 输出(update.go 冲突已消除)。

未执行项

  • 未运行 go test ./...(本次仅改动 internal/tui/core/app/update.go)。

View job run

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: creatang <165447160+creatang@users.noreply.github.com>
@creatang
Copy link
Copy Markdown
Collaborator Author

/code 解决冲突后ci不通过了,请解决这个问题

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 23, 2026

处理结果

已定位并修复这次“解决冲突后 CI 不通过”的问题,修复已推送到当前 PR 分支 fix/tui-markdown-render-pollution

根因

失败并非来自 TUI 测试,而是 CI 的网关文档一致性检查:

  • 失败步骤:Verify gateway docs are generated / make docs-gateway-check
  • 触发点:docs/reference/gateway-rpc-api.md 的自动生成示例中 payload_version 与当前生成产物不一致(CI 日志显示应为 4)。

本次修复

  • 新增并同步文档文件:docs/reference/gateway-rpc-api.md
  • 将自动生成示例片段中的目标字段更新为:"payload_version": 4
  • 提交:c5a8d89

验证

  • go test ./internal/tui/... 通过
  • go test ./... 通过
  • go test ./... -covermode=atomic -coverprofile=coverage.out 通过

未执行项

  • git-push-fork 技能尝试执行 fork 内 PR 更新脚本时,当前环境 gh 认证不可用(提示需 gh auth login);但代码已成功推送到触发分支,当前上游 PR 会自动包含该提交。

View job run

xgopilot and others added 2 commits April 23, 2026 12:05
@creatang
Copy link
Copy Markdown
Collaborator Author

/code 请本次解决完ci问题和冲突后可以通过测试!!!

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 23, 2026

处理结果

已完成本次“冲突 + CI 问题”修复,并推送到当前 PR 分支 fix/tui-markdown-render-pollution,提交:2b04ef6

根因与修复

CI 失败来自编译错误:internal/tui/core/app/update.go 在冲突处理后残留了对已移除 workspace-command 逻辑的引用(如 workspaceCommandResultMsgrunWorkspaceCommand 等),导致 go test 构建阶段失败。

本次已在 update.go 中移除这些失效引用分支,仅保留当前有效的输入/运行路径,避免跨分支残留符号污染构建。

校验结果

  • go test ./internal/tui/core/app
  • go test ./internal/tui/...
  • go test ./...
  • git merge-tree --write-tree --messages --name-only HEAD origin/main 无冲突输出 ✅

未完成项

  • 无。

View job run

…solution

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: creatang <165447160+creatang@users.noreply.github.com>
@creatang
Copy link
Copy Markdown
Collaborator Author

/code CI问题主要为一下,请解决
Run make docs-gateway-check
Gateway JSON 示例已更新:docs/reference/gateway-rpc-api.md
diff --git a/docs/reference/gateway-rpc-api.md b/docs/reference/gateway-rpc-api.md
index e379f89..6082aae 100644
--- a/docs/reference/gateway-rpc-api.md
+++ b/docs/reference/gateway-rpc-api.md
@@ -1319,7 +1319,7 @@ Notification:
"payload": {
"delta": "正在分析请求..."
},

  •    "payload_version": 2,
    
  •    "payload_version": 4,
       "phase": "reasoning",
       "runtime_event_type": "agent_chunk",
       "timestamp": "2026-04-22T09:01:02.123456789Z",
    

make: *** [Makefile:11: docs-gateway-check] Error 1
Error: Process completed with exit code 2.

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 23, 2026

处理结果

  • 已修复 docs/reference/gateway-rpc-api.md 示例差异:payload_version2 更新为 4
  • 本地已验证:make docs-gateway-check 通过。
  • 本地提交已生成:5ea75c2 (docs(gateway): refresh RPC example payload_version)。

阻塞项

当前无法将提交推送到 PR 分支(fork 权限不足):

To https://github.com/creatang/neo-code.git
 ! [remote rejected] HEAD -> fork-pr-410-1776942750 (permission denied)
error: failed to push some refs to 'https://github.com/creatang/neo-code.git'

请为 creatang/neo-code 安装/授权 xgopilot GitHub App 后再触发一次,我会继续把这次修复推送到该 PR 分支。

View job run

@phantom5099 phantom5099 merged commit 82671c7 into 1024XEngineer:main Apr 23, 2026
2 checks passed
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.

4 participants