Skip to content

feat: deliver local usage workbench 0.4.0 - #5

Merged
LeemanCheung merged 64 commits into
mainfrom
feat/local-usage-workbench
Sep 12, 2026
Merged

LeemanCheung merged 64 commits into
mainfrom
feat/local-usage-workbench

Conversation

@LeemanCheung

Copy link
Copy Markdown
Owner

变更

新增「设置 → 用量工作台 / Usage workbench」,保留原 Token 用量页、原会话 projection 与原静态价格表。

  • 无模型本地体检、固定 revision 的分页收据、默认隐藏标识的 JSON/Markdown 导出。
  • 精确 provider/model 匹配的版本化价卡,USD/CNY 分离、生效区间、分时/阶梯规则,以及明确的未知/部分/区间状态;DeepSeek 模板不伪装成已联网核验的价格。
  • 独立持久辅助分析账本:多次模型调用累加、同一流累计 usage 替换、失败/取消/未知/重启恢复及显式清空。
  • 7/30/90 日变化贡献、主项目与标签、滚动 30 日 Token 与金额预算、人工验收的配对实验、缓存/费率情景试算。
  • 脱敏数字周报、默认关闭且由 Host 复核授权的同页面摘要、中英文及窄屏适配。

验证

候选验证记录:https://github.com/LeemanCheung/dsh-token-usage/actions/runs/34675499677

Host、Client、构建配置类型检查通过;26 个测试文件、184 项回归通过;10 个 Chromium 工作流用例通过;重复构建的三个产物 SHA-256 一致;源码与重新生成的 lib 已一并提交。浏览器截图、结果 JSON 与日志保存在该运行的 verification evidence artifact。

本 PR 的常规 CI 会从已提交源码重新执行全部检查,不依赖临时集成脚本,并额外验证 npm 文件白名单及提交的 lib 与重建结果完全一致。已移除全部 .candidate 文件和三个临时候选/诊断工作流,常规 CI 保留验证证据上传。

边界

浏览器测试真实挂载 React 工作台、调用真实 Host RPC 并使用文件持久化;DSH 事件与模型传输为合成 fixture,不声称已在用户生产 DSH 安装中调用真实提供方或核验真实账单。预算只提示,不阻断、不改路由。不同币种不相加,未知费用不记为零,验收质量不由执行完成状态推断。

生成文件 lib/client.js 的行尾空格检查单独豁免,避免对依赖模板字符串做盲目裁剪;源码检查、重复构建哈希及 lib 一致性门槛均保留。

github-actions Bot and others added 27 commits September 12, 2026 04:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T05:33:02.954957Z 0e9c8cd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@LeemanCheung
LeemanCheung merged commit 2d73b2b into main Sep 12, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e9c8cd900

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/workbench/host.ts
try {
const raw = storage.get().data
state = raw ? boundedParse(stateSchema, JSON.parse(raw)) : emptyState()
state.ledger = state.ledger.map(entry => entry.status === 'running' ? { ...entry, status: 'interrupted', endedAt: new Date().toISOString() } : entry)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist recovered interrupted ledger entries

After a Host restart, this updates running entries only in memory and never writes the recovered state back to settings. If the Host restarts again before another configuration or ledger mutation, the stored entry is still running, so endedAt is regenerated at the later startup and the audit record loses the actual first interruption time. Persist the recovery transition once parsing succeeds so restart recovery is durable.

Useful? React with 👍 / 👎.

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.

1 participant