Skip to content

v2.1.16

Choose a tag to compare

@github-actions github-actions released this 26 May 18:46
· 200 commits to main since this release
a33f477

Codex App Transfer v2.1.16

中文

Token 用量统计 + 启用按钮重启解耦

本版主要补全两个长期用户痛点:① 新增独立 Usage tab 展示对话 token 用量(单对话 / 按日 / 按模型聚合,真实数据 28896 turns / 194 conversations / 3.8B tokens 测过);② 解耦『启用』按钮跟『重启 Codex Desktop』的强绑定 — 之前误点重启会让 Codex 进程被杀、对话上下文 / 草稿 / 思考过程全丢。

  • 新增 Usage tab(MOC-15 / PR #280):sidebar 第 4 个入口,4 张顶部 KPI 卡(总 input / output / tokens / conversations)+ 三视图切换(按日 / 按模型 / 按对话)+ ccusage 同款表格形态(Date / Model / Input / Output / Reasoning / Total / Turns / Last)。零 chart lib 依赖。
  • 用量解析层完全 vendor 自 ryoppippi/ccusage(MIT,v20.0.5,upstream commit 2b9599ca):新 crate crates/usage_tracker/src/vendored_ccusage/ 直接 vendor adapter/codex/{parser,types,paths}.rs + types.rs / fast.rs / home.rs / date_utils.rs / utils.rs。详细借鉴清单见 ACKNOWLEDGEMENTS.md
  • 后端 HTTP API GET /api/usage/summary?tz= via tokio::task::spawn_blocking,不阻塞 axum runtime。本机 1.2GB / 261 文件 release build 扫 + 聚合 ~1-2s。
  • 解耦『启用』按钮跟『重启 Codex』(MOC-20 / PR #282):移除 applyProviderToDesktop / set-default action 内的强制 showRestartReminder() modal 调用。Apply 现在只写配置 + toast 提示。
  • header 右上角新增 ↻ icon-only 按钮(齿轮左侧,跟 .theme-btn 同款样式),点击直接调 POST /api/desktop/restart-codex-app。重启进行中 icon 旋转 + button disabled 视觉反馈。
  • restartCodexAppNow 兼容三种按钮形态(modal 纯文本 / icon + label span / icon-only),避免之前 button.textContent = 抹掉 icon DOM 的 UI degrade bug。

验证

  • cargo fmt --check / cargo check --workspace
  • cargo test -p codex-app-transfer-usage-tracker(7 tests pass,含 ccusage 原 fixture)
  • 真机 ~/.codex/sessions/ 1.2GB / 261 rollout files smoke test
  • mac-app 本地 build 手测:Usage tab 三视图切换 / KPI 卡 / 列对齐 / 头部 ↻ 重启按钮 / 启用按钮静默 toast

English

Token usage stats + Enable button restart decoupling

This release closes two long-standing user pain points: ① a dedicated Usage tab showing per-conversation token consumption (daily / by-model / by-conversation aggregations, tested with real data — 28896 turns / 194 conversations / 3.8B tokens); ② decoupling Apply / Set-default from the forced "Restart Codex Desktop" modal — previously a misclick on the modal killed the Codex process and lost in-flight conversation context / drafts / reasoning.

  • New Usage tab (MOC-15 / PR #280): 4th sidebar entry, 4 top KPI cards (total input / output / tokens / conversations) + 3-view switcher (daily / by model / by conversation) + ccusage-style table (Date / Model / Input / Output / Reasoning / Total / Turns / Last). Zero chart-lib dependency.
  • Usage parsing layer vendored verbatim from ryoppippi/ccusage (MIT, v20.0.5, upstream commit 2b9599ca): new crate crates/usage_tracker/src/vendored_ccusage/ containing adapter/codex/{parser,types,paths}.rs plus types.rs / fast.rs / home.rs / date_utils.rs / utils.rs. Full borrowing inventory in ACKNOWLEDGEMENTS.md.
  • Backend HTTP API GET /api/usage/summary?tz= runs via tokio::task::spawn_blocking, never blocking the axum runtime. Local 1.2GB / 261 files scans + aggregates in ~1-2s on release build.
  • Decoupled Apply from Restart Codex (MOC-20 / PR #282): removed forced showRestartReminder() modal calls from applyProviderToDesktop and the set-default action. Apply now silently writes config + shows a toast.
  • New ↻ icon-only button in the header top-right (left of the gear, same .theme-btn style), directly calling POST /api/desktop/restart-codex-app. Icon spins while restart is in progress + button is disabled for visual feedback.
  • restartCodexAppNow now supports three button shapes (modal plain text / icon + label span / icon-only), fixing the previous UI degrade bug where button.textContent = wiped out icon DOM children.

Verification

  • cargo fmt --check / cargo check --workspace
  • cargo test -p codex-app-transfer-usage-tracker (7 tests pass, includes ccusage upstream fixtures)
  • Real-data smoke test on ~/.codex/sessions/ 1.2GB / 261 rollout files
  • Local mac-app build manual test: Usage tab three-view switch / KPI cards / column alignment / header ↻ restart button / silent Apply toast