8000 feat(collector): read omp sessions and refresh Antigravity quota on demand by InfinityPacer · Pull Request #67 · InfinityPacer/meterleaf · GitHub
[go: up one dir, main page]

Skip to content

feat(collector): read omp sessions and refresh Antigravity quota on demand - #67

Merged
InfinityPacer merged 2 commits into
mainfrom
feat/omp-usage-agy-quota-refresh
Oct 31, 2026
Merged

InfinityPacer merged 2 commits into
mainfrom
feat/omp-usage-agy-quota-refresh

Conversation

@InfinityPacer
@InfinityPacer InfinityPacer commented Oct 31, 2026 •
Copy link
Copy Markdown
Owner

问题

  1. 在 omp 里通过 Antigravity 和 OpenCode Go 发起的请求没有进入账本,本机核对有 319 条 google-antigravity 和 184 条 opencode-go 请求从未被采集。
  2. 无界面运行(omp、Paseo 等)时 agy 状态栏脚本不会执行,Antigravity 额度缓存一直停在上次交互使用时,目前靠 macos-workstation 里的 Stop hook 每 15 分钟补一次。

结果

  • 采集器新增 omp 来源,读取 ~/.omp/agent/sessions 下的会话文件。只取已完成的助手消息,不读消息正文、标题和工作目录。opencode-go 请求归入 OpenCode Go 账户,google-antigravity 请求归入当前活跃的 Antigravity (<label>) 账户,Gemini 模型进 Gemini 池,其他模型进 Claude/GPT 池。
  • 去重不看文件路径和会话 ID,会话被移到别的工作目录或从中间分支复制了历史消息,都不会重复计入。
  • sync 发现新的 Antigravity 用量(agy 会话库或 omp)后,在同一轮运行 agy -p /usage,最多每 5 分钟一次,失败也退避 5 分钟。结果合并写回 quota-<label>.tsv(保留 plan 行和这次没刷到的窗口),新额度与新用量在同一批上传。scan 仍然只读,不触发刷新。
  • config.json 增加可选的 omp.enabled 与 omp.sessionsDir,channelAccounts.source 增加 omp,默认新增 omp:opencode-go → OpenCode Go。版本升到 0.16.0。

验证

  • bun run typecheck、bun run build、bun test tests 全部通过(615 项)。新增测试覆盖解析与四桶、会话文件迁移与分支复制不重复、标题行原地改写不重复、缺账户暂缓后补录、节流与失败退避、保留 plan 行、临时文件不残留、超时终止。
  • 本机真实数据只读扫描:scan --json 中 omp 读取 503、入账 503、无效 0,等于 jq 统计的 319 条 google-antigravity 加 184 条 opencode-go。截止 2026-10-31T13:00:00Z 的数字与设计核实值 273 和 184 一致。Token 合计与 jq 汇总逐项相同。清掉读取进度整体重读,读取 503、新入账 0。
  • 本机实际触发按需刷新:agy -p /usage 被调用,quota-tidewren.tsv 被更新,plan 行保留,current-account 未变,新额度与用量进入同一批待发送队列;5 分钟内再次触发被跳过。验证用临时数据目录且服务地址指向不可达的回环端口,没有上传任何内容,没有动 NAS。

说明

  • macos-workstation 里 agy-quota-refresh Stop hook 暂时保留,新版本发布并确认可用后再退役。两者同时存在只会多刷新几次额度。
  • omp 会话不含 Google 邮箱,Antigravity 请求以 current-account 为准,同时在 omp 里切换多个 Google 账号时无法区分。

🤖 Generated with Claude Code

InfinityPacer and others added 2 commits October 31, 2026 21:46
…emand

Read omp (oh-my-pi) session files incrementally. Completed assistant
messages become requests: opencode-go goes to the OpenCode Go account and
google-antigravity joins the active Antigravity account. Requests are
deduplicated by message id, time, channel, model and token counts, so moved
files and branched sessions do not bill twice.

When sync finds new Antigravity usage from agy or omp, run `agy -p /usage`
at most once every 5 minutes, merge the four quota windows into
quota-<label>.tsv (keeping the plan row) and upload them in the same round.
scan never triggers the refresh.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@InfinityPacer
InfinityPacer merged commit d1398f1 into main Oct 31, 2026
2 checks passed
@InfinityPacer
InfinityPacer deleted the feat/omp-usage-agy-quota-refresh branch October 31, 2026 14:12
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

0