[codex] 发布 Codex Token Usage 0.1.6:账本聚合与历史恢复#7
Open
kokotao 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.
背景
codex-token-usage-script源码仓库需要与已经发布到 ScriptMarket 的0.1.6保持一致。本次主要补齐 token 统计账本聚合、会话/轮次隔离、历史恢复能力,以及对应的测试覆盖。用户侧问题
在旧实现中,存在几类明显问题:
调用 1 次。根因分析
根因主要有三类:
本次改动
1. 双层账本聚合
requestTotalTokens、inputTotalTokens、outputTotalTokens、cachedReadTokens、totalEstimated等字段。2. 隔离与去重增强
3. 历史恢复能力
restoreHistoryForConversation(conversationId, options)。4. 展示与调试能力
export()导出调试快照。5. 版本升级
package.json升级到0.1.6index.json更新版本、描述和 sha256验证
已执行并通过:
node --check scripts/codex-token-usage.jsnpm testnpm run check:index其中测试结果为
40/40通过。备注
程序重启后“无缓存恢复历史统计”的完整能力,需要宿主侧提供
thread usage historybridge;对应宿主改动已在配套 PR 中处理。本 PR 聚焦源码仓库与已发布市场版本对齐。