Background
PR implementing model selection (#3, #34) introduces an EventBus (tokio broadcast channel) for decoupled component communication. The first events are ModelChanged and AuthChanged.
Problem
CommandResult::AuthChanged(String) is currently a special return variant that the REPL loop handles manually to update auth display state. This is the same pattern the EventBus replaces for model changes.
Proposed solution
- Remove
CommandResult::AuthChanged variant
- Have
/login and /logout commands emit Event::AuthChanged on the EventBus instead
- REPL subscribes to
AuthChanged events to update display state (same as it does for ModelChanged)
- Unifies both patterns under one mechanism
Depends on
- Model selection PR (introduces the EventBus)
Background
PR implementing model selection (#3, #34) introduces an
EventBus(tokio broadcast channel) for decoupled component communication. The first events areModelChangedandAuthChanged.Problem
CommandResult::AuthChanged(String)is currently a special return variant that the REPL loop handles manually to update auth display state. This is the same pattern the EventBus replaces for model changes.Proposed solution
CommandResult::AuthChangedvariant/loginand/logoutcommands emitEvent::AuthChangedon the EventBus insteadAuthChangedevents to update display state (same as it does forModelChanged)Depends on