feat(runtimes): add Runtimes tab with usage tracking and connection test
Add a new "Runtimes" sidebar tab to manage local agent runtimes with three main capabilities: runtime status overview, token usage tracking (reading Claude Code and Codex CLI local JSONL logs via daemon), and an interactive connection test that sends a ping through the daemon to verify end-to-end agent CLI connectivity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6fd0e2b319
commit
903fbee55d
24 changed files with 1773 additions and 9 deletions
27
server/pkg/db/queries/runtime_usage.sql
Normal file
27
server/pkg/db/queries/runtime_usage.sql
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
-- name: UpsertRuntimeUsage :exec
|
||||
INSERT INTO runtime_usage (runtime_id, date, provider, model, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
ON CONFLICT (runtime_id, date, provider, model)
|
||||
DO UPDATE SET
|
||||
input_tokens = EXCLUDED.input_tokens,
|
||||
output_tokens = EXCLUDED.output_tokens,
|
||||
cache_read_tokens = EXCLUDED.cache_read_tokens,
|
||||
cache_write_tokens = EXCLUDED.cache_write_tokens,
|
||||
updated_at = now();
|
||||
|
||||
-- name: ListRuntimeUsage :many
|
||||
SELECT * FROM runtime_usage
|
||||
WHERE runtime_id = $1
|
||||
ORDER BY date DESC
|
||||
LIMIT $2;
|
||||
|
||||
-- name: GetRuntimeUsageSummary :many
|
||||
SELECT provider, model,
|
||||
SUM(input_tokens)::bigint AS total_input_tokens,
|
||||
SUM(output_tokens)::bigint AS total_output_tokens,
|
||||
SUM(cache_read_tokens)::bigint AS total_cache_read_tokens,
|
||||
SUM(cache_write_tokens)::bigint AS total_cache_write_tokens
|
||||
FROM runtime_usage
|
||||
WHERE runtime_id = $1
|
||||
GROUP BY provider, model
|
||||
ORDER BY provider, model;
|
||||
Loading…
Add table
Add a link
Reference in a new issue