1562
1563
private _getChatContext(chatOrSession: URI): { session: URI; sessionId: string; chatKey: string; target: CopilotAgentSession | undefined; isPeerChat: boolean } {
1564
>
// Accept either a chat channel URI or a bare session URI: per the AHP
copilotAgent.ts
1565
>
// convention the default chat's URI equals the session URI, so callers
1566
>
// that address the default chat by the session URI resolve here in one
1567
>
// place rather than each operational method re-deriving it.
1568
>
const chat = parseChatUri(chatOrSession) ? chatOrSession : URI.parse(buildDefaultChatUri(chatOrSession));
1569
>
const session = URI.parse(parseRequiredSessionUriFromChatUri(chat));
1570
>
const sessionId = AgentSession.id(session);
1571
>
const chatKey = chat.toString();
1572
>
const resolved = this._sessions.get(sessionId)?.resolveChat(chatKey);
1573
>
return {
1574
>
session,
1575
>
sessionId,
1576
>
chatKey,
1577
>
target: resolved?.chatSession,
1578
>
isPeerChat: resolved ? !resolved.isDefault : chatKey !== buildDefaultChatUri(session),
1579
>
};
1580
>
}
1581
1582
/**