multica/server/pkg/agent
Jiang Bohan 8a8d3ea20e feat(usage): add per-task token usage tracking
Extract token usage from Claude Code's stream-json output in real-time
during task execution, replacing the inaccurate global JSONL log scanner.

- New `task_usage` table: tracks (task_id, provider, model) level usage
- Agent SDK: parse `message.usage` from assistant messages, accumulate
  per-model and return in Result
- Daemon: convert agent usage to entries, send with CompleteTask
- Server: store usage on task completion, expose workspace-level
  aggregation APIs (GET /api/usage/daily, GET /api/usage/summary)
2026-04-08 13:08:15 +08:00
..
agent.go feat(usage): add per-task token usage tracking 2026-04-08 13:08:15 +08:00
agent_test.go fix(agent): fix data races, add tests, and fix raw protocol detection 2026-03-24 14:21:10 +08:00
claude.go feat(usage): add per-task token usage tracking 2026-04-08 13:08:15 +08:00
claude_test.go feat(usage): add per-task token usage tracking 2026-04-08 13:08:15 +08:00
codex.go feat(logging): add structured logging across server and SDK 2026-03-26 10:57:11 +08:00
codex_test.go feat(logging): add structured logging across server and SDK 2026-03-26 10:57:11 +08:00
openclaw.go fix(agent): address openclaw review feedback 2026-04-07 14:52:54 +08:00
openclaw_test.go fix(agent): address openclaw review feedback 2026-04-07 14:52:54 +08:00
opencode.go feat(daemon): add opencode as supported agent provider (#341) 2026-04-02 17:52:07 +08:00
opencode_test.go feat(daemon): add opencode as supported agent provider (#341) 2026-04-02 17:52:07 +08:00