1128
this._sideEffects.generateForkedTitle(summary.resource, undefined, importedTurns, importedTitle);
1129
}
1131
>
// Provisional sessions defer the `sessionAdded` notification and
1132
>
// the `SessionReady` lifecycle transition until the agent fires
1133
>
// {@link IAgent.onDidMaterializeSession} (typically on first
1134
>
// `sendMessage`). Until then, the state exists in memory so
1135
>
// clients can subscribe and stream config / model changes that
1136
>
// the agent will pick up at materialization time.
1137
>
const summary = this._buildInitialSummary(provider, session, config, created, '');
1138
>
const state = this._stateManager.createSession(summary, { emitNotification: !created.provisional });
1139
>
state.config = sessionConfig;
1140
>
state.activeClients = config?.activeClient ? [config.activeClient] : [];
1141
>
if (initialCustomizations && initialCustomizations.length > 0) {
1142
state.customizations = [...initialCustomizations];
1143
}
1145
>
// Persist initial config values so a subsequent `restoreSession` can
1146
>
// re-hydrate them. We persist the full resolved values (not just the
1147
>
// user's input) so clients can render them on restore without having
1148
>
// to re-resolve. Mid-session changes are persisted by `AgentSideEffects`
1149
>
// when handling `SessionConfigChanged`.
1150
if (sessionConfig?.values && Object.keys(sessionConfig.values).length > 0 && !created.provisional) {
1151
this._persistConfigValues(session, sessionConfig.values);
1152
}
1154
>
this._changesetCoordinator.onSessionCreated(session.toString());
1155
>
1156
>
if (!created.provisional) {
1157
// Persist the AH-owned workspace-less marker now that the session DB
1158
// exists, from the value `_buildInitialSummary` inferred. Provisional