365
366
private _getChatContext(chatOrSession: URI): { session: URI; sessionId: string; chatKey: string; target: ClaudeAgentSession | undefined; isPeerChat: boolean } {
367
>
// Accept either a chat channel URI or a bare session URI: per the AHP
claudeAgent.ts
368
>
// convention the default chat's URI equals the session URI, so callers
369
>
// that address the default chat by the session URI resolve here in one
370
>
// place rather than each operational method re-deriving it.
371
>
const chat = parseChatUri(chatOrSession) ? chatOrSession : URI.parse(buildDefaultChatUri(chatOrSession));
372
>
const session = URI.parse(parseRequiredSessionUriFromChatUri(chat));
373
>
const sessionId = AgentSession.id(session);
374
>
const chatKey = chat.toString();
375
>
const resolved = this._sessions.get(sessionId)?.resolveChat(chatKey);
376
>
return {
377
>
session,
378
>
sessionId,
379
>
chatKey,
380
>
target: resolved?.chatSession,
381
>
isPeerChat: resolved ? !resolved.isDefault : chatKey !== buildDefaultChatUri(session),
382
>
};
383
>
}
384
385
/**