修复每日 Token 跨日统计、主题及新版顶栏兼容问题 - #77
Closed
kts-kris wants to merge 5 commits into
Closed
Conversation
Contributor
Author
|
感谢 @Rat0323 提供 #82 和完整复现信息。相关修复已在提交
验证结果:仓库测试 PR 版本已更新为 |
Owner
|
当前与 main 存在冲突,请先 rebase/解决冲突后重新提交。 |
Contributor
Author
|
已按维护者意见处理:没有在旧冲突分支上继续合并,而是从最新 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
该 PR 替代存在冲突的 #61,并在原有修复基础上吸收、扩展 #82 提出的新版顶栏兼容方案。
本次处理 #35、#37,并回归已关闭的 #62,重点解决以下用户问题:
处理内容与用户价值
1. 独立补齐最近 5 日历史用量
localThreadCatalog获取任务,通过workspaceFiles.read读取本机 session JSONL;Codex Token Usage时,仍可独立完成统计;用户价值: 重启 Codex、首次打开插件或切换历史任务后,不再只看到当前页面产生的局部用量,也不强制安装另一个统计插件。
2. 修复跨日累计和重复计数
token_count的真实时间归档,不再依赖 JSONL 文件创建日期;total_token_usage做差分,累计值重置时回退到last_token_usage;用户价值: 避免累计值直接相加造成虚高,也避免长期复用任务产生漏算。
3. 修复主题、输入和价格面板
html.electron-dark样式;用户价值: 深色模式下可读,编辑不丢焦点,Model 较多时仍能滚动看到底部内容。
4. 吸收并扩展 #82 的新版顶栏兼容
ApplicationMenuTopBar,并支持menubar和旧.app-header-tint;1.2.52实际 DOM,增加“顶部、全宽、可拖拽”的header.draggable几何回退,并优先选择 fixed 顶栏;header回退,避免把会话内容区的窄标题栏误认为应用顶栏;280px调整为原生窗口控制区的132px;用户价值: 新建会话、加载旧会话、窗口缩放或原生按钮后出现时,统计入口都保持在真正的窗口顶栏,不遮挡按钮,也不会在空间充足时错误缩成 icon。
5. 大会话性能回归
保留 day cache、版本签名、时间索引匹配和 MutationObserver 工具扫描 debounce。
226 个 turn、314 条工具事件的回归场景未发现性能退化。
版本与清单
1.4.18;index.json版本与脚本一致;51cfffe284ae331e4aeb5c60b2d5fe5547cb2b16c8dd90b9e2b67a7ad92d2807。自动化验证
node --check scripts/codex-daily-token-usage.js node tests/codex-daily-token-usage.test.js node --test tests/*.test.js CODEX_DAILY_TOKEN_USAGE_SCRIPT=... node ../test-codex-daily-token-usage.js git diff --check验证结果:
12/12通过;index.json版本和 SHA-256 一致性检查。真实环境验证
环境:Codex++
1.2.52,Codex Desktop26.818.41509。ApplicationMenuTopBar、.app-header-tint和menubar,脚本正确选择顶部全宽 fixed draggable header;BODY,定位为fixed;0;left=1384自动左移到left=1263;4,374,092,未发生数据丢失或重复累计。Closes #35
Closes #37
#62 已关闭,本 PR 仅做回归验证。
Related to #82