修复每日 Token 跨日统计、主题及新版顶栏兼容问题 - #84
Open
kts-kris wants to merge 1 commit into
Open
Conversation
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 按维护者在 #77 中的意见重新提交,替代已关闭且与
main冲突的 #77。本次没有在旧分支上继续叠加 merge commit,而是从最新
origin/main(90e8415)新建干净分支,将最终脚本和回归测试完整移植,并仅定点更新index.json中codex-daily-token-usage的条目。冲突处理
main是当前分支的直接祖先;main1 个整理后的提交;git merge-tree --write-tree origin/main HEAD成功,无冲突;main新增的全部市场脚本;index.json只修改本插件的描述、版本和 SHA-256;665b4e7逐字节一致。处理内容与用户价值
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. 新版顶栏兼容与动态避让
ApplicationMenuTopBar、menubar和旧.app-header-tint;1.2.52的顶部全宽 fixed draggable header;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 jq empty index.json git merge-tree --write-tree origin/main HEAD验证结果:
12/12通过;真实环境验证
在 Codex++
1.2.52、Codex Desktop26.818.41509中验证:BODY,定位为fixed;Supersedes #77
Closes #35
Closes #37
#62 已关闭,本 PR 仅做回归验证。
Related to #82