feat: add context window usage display to task session (#66)
* feat: add context window usage display to task session - Add TokenUsageDisplay component showing context window usage as a horizontal progress bar - Add useSessionContextWindow hook with proper Zustand reactivity (subscribe to primitives) - Add ContextWindowState to store with setContextWindow action - Backend: propagate context_window data through orchestrator, watcher, and lifecycle events - WebSocket handler extracts context_window from session.state_changed metadata - Display positioned on left side of action bar, updates in real-time * refactor: remove agent stream event WebSocket broadcasting Agent stream events (message_chunk, tool_call, etc.) are now handled internally by the lifecycle manager rather than being broadcast to the frontend. Messages are accumulated and flushed as comments at step boundaries.
This commit is contained in:
@@ -901,6 +901,24 @@ func (m *Manager) handleAgentEvent(execution *AgentExecution, event agentctl.Age
|
||||
|
||||
// Handle permission request inline
|
||||
m.handlePermissionRequestEvent(execution, event)
|
||||
|
||||
case "context_window":
|
||||
m.logger.Debug("context window update received",
|
||||
zap.String("execution_id", execution.ID),
|
||||
zap.Int64("size", event.ContextWindowSize),
|
||||
zap.Int64("used", event.ContextWindowUsed),
|
||||
zap.Float64("efficiency", event.ContextEfficiency))
|
||||
|
||||
// Publish context window event to event bus for orchestrator to persist
|
||||
m.eventPublisher.PublishContextWindow(
|
||||
execution,
|
||||
event.ContextWindowSize,
|
||||
event.ContextWindowUsed,
|
||||
event.ContextWindowRemaining,
|
||||
event.ContextEfficiency,
|
||||
)
|
||||
// Return early - context window events don't need to be published as stream events
|
||||
return
|
||||
}
|
||||
|
||||
// Publish agent stream event to event bus for WebSocket streaming
|
||||
|
||||
Reference in New Issue
Block a user