* Internal method to update state and notify observers.
(newState: StoreState)
| 368 | * Internal method to update state and notify observers. |
| 369 | */ |
| 370 | private updateState(newState: StoreState): void { |
| 371 | // Track history if enabled |
| 372 | if (this.maxHistorySize > 0) { |
| 373 | this.stateHistory.push(this.state) |
| 374 | if (this.stateHistory.length > this.maxHistorySize) { |
| 375 | this.stateHistory.shift() |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | this.state = newState |
| 380 | |
| 381 | // Notify observers |
| 382 | this.stateObservable.next(this.state) |
| 383 | this.agentStateObservable.next(this.state.agentState) |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | // ============================================================================= |
no test coverage detected