You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emit `usage-delta` events on AI SDK `finish-step`, allowing the UI to
display live token counts as the AI generates multi-step responses.
https://github.com/user-attachments/assets/80cd3a98-e7fa-415f-9ac6-7b7a241a7a5a
## Changes
**Backend:**
- Add `UsageDeltaEvent` type emitted on each `finish-step`
- `StreamManager` emits usage after each tool call step completes
- Forward events through `AIService` → `AgentSession` → IPC
**Frontend:**
- `StreamingMessageAggregator` stores active stream usage per messageId
- `WorkspaceStore` exposes `liveUsage` in `WorkspaceUsageState`
- `CostsTab`, `RightSidebar`, `ChatMetaSidebar` consume `liveUsage` for
real-time context window display
**Tests:**
- Unit tests for usage-delta handling in `StreamingMessageAggregator`
- Integration test for usage-delta events during multi-step streams
## Testing
This feature has been tested with OpenAI, Anthropic & Google.
---
_Generated with `mux`_
0 commit comments