diff options
| author | Adam Malczewski <[email protected]> | 2026-06-02 13:08:36 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-02 13:08:36 +0900 |
| commit | b734eb96bf0af267fdfbef85df51940ca0b4e8c7 (patch) | |
| tree | 3815dc9e569bb57384f53d9042288ff831f02e74 /packaging | |
| parent | 3f629a8469fe483243671e1ca15582a111e96541 (diff) | |
| download | dispatch-b734eb96bf0af267fdfbef85df51940ca0b4e8c7.tar.gz dispatch-b734eb96bf0af267fdfbef85df51940ca0b4e8c7.zip | |
feat: persist per-tab token/cache usage across reload
Persist usage as invisible type:"usage" chunk rows (side channel):
- core: add "usage" ChunkType + UsageData; exclude usage rows from
getChunksForTab/getTotalChunkCount; add getUsageStatsForTab aggregate
(exported from barrel); defensive skip in groupRowsToMessages.
- api: agent-manager accumulates per-attempt usageRows and flushes them in
the same atomic appendChunks call as the turn's content (discarded on a
superseded fallback attempt). GET /tabs enriches rows with usageStats.
- frontend: hydrateFromBackend seeds cacheStats from usageStats (reload only;
no re-seed on statuses reconnect, so no double-count with live events).
Tests: core DB-backed usage persistence/aggregate; api usage-row-per-event +
fallback discard; routes GET /tabs usageStats; frontend hydrate seed +
no-double-count + live-accumulation-after-seed. 495 -> 509 passing.
Diffstat (limited to 'packaging')
0 files changed, 0 insertions, 0 deletions
