Releases: ymstar/agentmeter
v0.4.1
v0.4.0
多 Agent 平台适配器架构
新增
- AgentAdapter 统一适配器接口
- Claude Code 适配器(从 hook.ts 提取)
- Codex CLI 适配器
- 适配器注册中心
CLI 改进
-
支持指定 agent 初始化
-
Supported Agent Platforms
claude-code Claude Code ✅ installed
codex OpenAI Codex CLI ❌ not foundUsage: 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.jsonData will be stored at ~/.agentmeter/meter.db
Run 'agentmeter dashboard' to view stats
Run 'agentmeter stats' for terminal view 仍然自动初始化 Claude Code
v0.3.4
v0.3.3
Fix: macOS stdin 读取兼容性
核心修复
readFileSync('/dev/stdin')改为readFileSync(0)— macOS 上 npx 重新启动进程时,/dev/stdin 是字符设备路径,可能无法正确读取 stdin。改用文件描述符 0,跨平台可靠。
新增
DEBUG_AGENTMETER=1环境变量 — 启用后所有静默退出点输出详细错误到 stderragentmeter debug命令 — 模型检测诊断信息
改进
- detectModel() 增加更多环境变量候选 + 读取 settings.local.json 作为 fallback
v0.3.1
v0.3.0
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 resetcommand 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
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 initv0.2.4 — Fix Model & Agent Detection
修复 Model 和 Agent Type 始终为 unknown
根因:Claude Code 的 settings.json 中配置的环境变量(ANTHROPIC_MODEL 等)不会传递给 hook 子进程,导致 detectModel() 和 detectAgentType() 检测失败。
修复:
- Model:直接读取
~/.claude/settings.json的env.ANTHROPIC_MODEL和model字段 - Agent Type:检测
~/.claude目录存在即判定为claude-code
现在新记录会正确显示 Model(如 mimo-v2.5-pro)和 Agent Type(如 claude-code)。
Upgrade
npx @ymstar/agentmeter@latest initv0.2.3 — Readable Session Labels
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 initv0.2.2 — Fix Output Tokens
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:- MCP content arrays (
{ content: [{ type: "text", text: "..." }] }) - Common output fields (
output,result,text,message,data,stdout) - JSON.stringify fallback for any object
- MCP content arrays (
- Changed
tool_responsetype tounknownfor broader compatibility
Upgrade
npx @ymstar/agentmeter@latest init