feat: 增强每日用量工具洞察与标题栏适配#43
Open
kts-kris wants to merge 4 commits into
Open
Conversation
5463f25 to
cf402d5
Compare
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.
用户价值
这次更新让 Codex Daily Token Usage 从一个简单的 Token 计数器,升级为更接近“每日 Codex 工作用量报告”的工具。
用户不只可以看到今天消耗了多少 Token,还可以进一步理解:这些用量是普通对话带来的,还是来自命令执行、MCP、插件等工具辅助工作;同时,在用户还没有手工配置 Model 单价时,也能直接基于 OpenAI API Pricing 的 Standard 参考价看到预估成本。
这对用户的直接价值是:
改动内容
1. OpenAI 模型参考价预置
1.4.12。Standard参考价,单位为USD / 1M tokens。2. 工具调用洞察
function_callpayload;mcp__server__tool这类 MCP 工具名称;exec_command。3. 标题栏动态避让
修复今日用量入口和 Codex 原生“打开位置”按钮可能重叠,以及 Codex 重启后今日用量被错误挤到左侧的问题。
现在的策略是:
pointer-events: none的非交互容器不再占用布局空间;MutationObserver、ResizeObserver和requestAnimationFrame做动态重算,覆盖“打开位置”这类后出现按钮;right坐标向外取整,避免 8px 安全间距被四舍五入吃掉。4. 关联用量修复
修复工具调用区域“关联用量”长期显示“待关联”的问题。
现在的策略是:
conversationKey;这样用户可以看到工具辅助请求大致对应的 Token 和成本,同时界面仍保留“部分为时间估算”的提示。
5. 版本和索引
codex-daily-token-usage更新到1.4.12。index.json中的版本号和sha256。66c6af995d1908961b0931d0a41dd804d807b041a4291eb86144627becca4dbe。为什么有价值
之前插件能告诉用户“用了多少 Token”,但很难解释“这些 Token 是怎么用掉的”,也要求用户先自己配置 Model 价格后才能看到成本。对真实 Codex 工作流来说,这两个问题都会影响复盘质量。
这次更新后,用户可以同时看到:
这让插件更适合日常成本观察、团队内部用量解释,以及对“为什么今天成本升高”的快速判断。
说明和边界
Standard档,参考链接:https://developers.openai.com/api/docs/pricingCache writes、Batch、Flex、Priority、工具调用按次费用、Web search 额外调用费、容器分钟费不纳入当前模型 token 成本估算。exec_command。mcp-request/tools/call或mcp__server__tool这类函数名时被统计。验证
jq empty index.jsonnode --check scripts/codex-daily-token-usage.jsnode --check ../../outputs/codex-daily-token-usage.jsCODEX_DAILY_TOKEN_USAGE_SCRIPT=scripts/codex-daily-token-usage.js node ../test-codex-daily-token-usage.jsnode ../test-codex-daily-token-usage.jsgit diff --check1.4.12;gpt-5.4、legacy text、specialized 模型;pointer-events: none的 header surface 错误挤到左侧;