1303
sdkSessionId = (await this._forkChat(session, options.fork))?.sessionId;
1304
} else if (options?.sideChat) {
1305
>
const forked = await this._forkChat(session, { source: options.sideChat.source, turnId: options.sideChat.providerAnchorTurnId ?? options.sideChat.turnId });
claudeAgent.ts
1306
>
sdkSessionId = forked?.sessionId;
1307
>
const fallbackContext = options.sideChat.sourceContext ?? (!forked ? this._buildSideChatContext(session, options.sideChat.source, options.sideChat.turnId) : undefined);
1308
>
if (!forked && !fallbackContext && !options.sideChat.partialResponse) {
1309
throw new Error(`[Claude] createChat side chat: source turn ${options.sideChat.turnId} could not be forked`);
1310
}
1312
>
source: options.sideChat.source.toString(),
1313
>
turnId: options.sideChat.turnId,
1314
>
...(options.sideChat.selection ? { selection: options.sideChat.selection } : {}),
1315
>
...(options.sideChat.providerAnchorTurnId ? { providerAnchorTurnId: options.sideChat.providerAnchorTurnId } : {}),
1316
>
inheritedTurnCount: forked?.inheritedTurnCount ?? 0,
1317
>
...(fallbackContext ? { context: fallbackContext } : {}),
1318
>
...(options.sideChat.partialResponse ? { partialResponse: options.sideChat.partialResponse } : {}),
1319
>
};
1320
>
}
1321
sdkSessionId ??= generateUuid();
1322