Skip to content

Releases: ymstar/agentmeter

v0.4.1

29 May 08:00

Choose a tag to compare

Changes

  • fix: handle effort object from Claude Code — effort field sent as {"level": "high"} object caused better-sqlite3 parameter binding error, silently breaking data collection

v0.4.0

29 May 04:53

Choose a tag to compare

多 Agent 平台适配器架构

新增

  • AgentAdapter 统一适配器接口
  • Claude Code 适配器(从 hook.ts 提取)
  • Codex CLI 适配器
  • 适配器注册中心

CLI 改进

  • 支持指定 agent 初始化

  • Supported Agent Platforms

    claude-code Claude Code ✅ installed
    codex OpenAI Codex CLI ❌ not found

    Usage: agentmeter init [agent-id]
    Example: agentmeter init claude-code 列出所有支持的 agent 及状态

  • 自动检测已安装的 agent 并全部初始化

架构

  • hook.ts 使用适配器层进行模型/agent 检测

  • debug.ts 显示所有 agent 平台状态

  • 向后兼容:
    AgentMeter — Auto-detecting agents...

    Found: Claude Code
    ✅ PostToolUse hook added to ~/.claude/settings.json

    Data will be stored at ~/.agentmeter/meter.db

    Run 'agentmeter dashboard' to view stats
    Run 'agentmeter stats' for terminal view 仍然自动初始化 Claude Code

v0.3.4

29 May 04:16

Choose a tag to compare

Fix: macOS npx stdin 读取兼容性

核心修复

  • readFileSync(0) 改为异步流式 readStdin()
  • macOS 上 npx 重新启动进程时,同步文件描述符读取会失败
  • 改用 process.stdin 的 data/end 事件流式读取,跨平台可靠

改进

  • 所有错误路径现在都会输出到 stderr
  • DEBUG_AGENTMETER=1 增加成功路径日志

v0.3.3

29 May 01:34

Choose a tag to compare

Fix: macOS stdin 读取兼容性

核心修复

  • readFileSync('/dev/stdin') 改为 readFileSync(0) — macOS 上 npx 重新启动进程时,/dev/stdin 是字符设备路径,可能无法正确读取 stdin。改用文件描述符 0,跨平台可靠。

新增

  • DEBUG_AGENTMETER=1 环境变量 — 启用后所有静默退出点输出详细错误到 stderr
  • agentmeter debug 命令 — 模型检测诊断信息

改进

  • detectModel() 增加更多环境变量候选 + 读取 settings.local.json 作为 fallback

v0.3.1

28 May 04:24

Choose a tag to compare

Changes

  • SEO: optimize GitHub & npm discoverability (description, topics, keywords)
  • Fix: logo.svg bar chart overlap with title
  • Expand package.json keywords for npm search
  • Add Why AgentMeter comparison table to README

v0.3.0

22 May 07:05

Choose a tag to compare

What's New

Cache Token Tracking

  • Full pipeline: parsing, pricing, DB storage, dashboard display
  • Shows cache hit/miss rate per call and in aggregate
  • Cache-aware cost calculation (cache reads cheaper than regular input)

Multi-Model Pricing

  • Added DeepSeek (v4-flash, v4-pro, v3.2, r1)
  • Added MiMo (v2.5-pro, v2.5, v2-flash)
  • Added GLM (5.1, 5, 4.7, 4.7-flash, 4.5-air)

New Features

  • agentmeter reset command to clear all data
  • Effort level tracking (high/medium/low)
  • Duration tracking from Claude Code hook

Dashboard

  • Cache Hit Rate card with sparkline
  • Cache trend line on token usage chart
  • Cache column in Recent Calls table
  • Effort column in Recent Calls table
  • GitHub link in header

Improvements

  • Fixed agent_type detection (CLAUDECODE env var)
  • Improved model detection from settings.json
  • README: Claude Code badge, updated docs

v0.2.5 — Dashboard Overhaul

22 May 05:04

Choose a tag to compare

Dashboard 全面升级

Header

  • 渐变 Logo + "Token Usage Dashboard" tagline
  • Live 状态指示灯(绿色脉冲)
  • 刷新按钮 + 最后更新时间

Stats 卡片增强

  • Input/Output token 分拆显示(↓ 12K ↑ 8K)
  • Mini sparkline 趋势线(7 天)
  • Today 卡片显示 vs 昨天的变化百分比(↑12% / ↓5%)

新增图表

  • Cost by Model 饼图 — 各模型费用占比
  • Hourly Activity 柱状图 — 24 小时调用分布

表格增强

  • Token 列增加百分比条形图背景
  • Model/Agent 表格显示调用占比

视觉细节

  • 入场 fade-in / slide-up 动画
  • Tab 切换动画、表格行 hover 高亮边框
  • 改进的 tooltip 和 chart 交互

Upgrade

npx @ymstar/agentmeter@latest init

v0.2.4 — Fix Model & Agent Detection

22 May 04:09

Choose a tag to compare

修复 Model 和 Agent Type 始终为 unknown

根因:Claude Code 的 settings.json 中配置的环境变量(ANTHROPIC_MODEL 等)不会传递给 hook 子进程,导致 detectModel()detectAgentType() 检测失败。

修复

  • Model:直接读取 ~/.claude/settings.jsonenv.ANTHROPIC_MODELmodel 字段
  • Agent Type:检测 ~/.claude 目录存在即判定为 claude-code

现在新记录会正确显示 Model(如 mimo-v2.5-pro)和 Agent Type(如 claude-code)。

Upgrade

npx @ymstar/agentmeter@latest init

v0.2.3 — Readable Session Labels

22 May 04:03

Choose a tag to compare

Session 视图可读性优化

Session ID (UUID) 现在显示为 项目名 — 时间 格式,一眼就能看出是哪个 session。

  • Before: a1b2c3d4...
  • After: agentmeter — May 22, 12:00

UUID 仍然保留(鼠标悬停可查看)。

技术细节

  • Hook 从 cwd 字段提取项目目录名
  • DB 新增 project 列(自动迁移)
  • Dashboard session 表格显示 project — time 标签

Upgrade

npx @ymstar/agentmeter@latest init

v0.2.2 — Fix Output Tokens

22 May 02:26

Choose a tag to compare

Fix: Output Tokens no longer always 0

Claude Code PostToolUse hooks don't include token usage data in tool_response, causing all output token counts to be 0.

What changed

  • Added estimateResponseTokens() with multi-format fallback:
    1. MCP content arrays ({ content: [{ type: "text", text: "..." }] })
    2. Common output fields (output, result, text, message, data, stdout)
    3. JSON.stringify fallback for any object
  • Changed tool_response type to unknown for broader compatibility

Upgrade

npx @ymstar/agentmeter@latest init