546
*/
547
createSession(summary: SessionSummary, options?: { readonly emitNotification?: boolean }): SessionState {
549
>
const existing = this._sessionStates.get(key);
550
>
if (existing) {
551
this._logService.warn(`[AgentHostStateManager] Session already exists: ${key}`);
552
return existing.state;
553
}
555
>
const state = createSessionState(summary);
556
>
this._sessionStates.set(key, this._newEntry(state, summary));
557
>
this._ensureDefaultChat(key, summary);
558
>
559
>
this._logService.trace(`[AgentHostStateManager] Created session: ${key}`);
560
>
561
>
if (options?.emitNotification !== false) {
562
// Announcing the summary to the notifier is what makes
563
// its later flush emit incremental updates and what makes