54
/** Builds an {@link AGENT_HOST_SESSION_LINK_SCHEME} link for a backend session URI. */
55
export function buildOpenSessionLinkUri(backendSession: URI | string, chatId?: string): string {
57
>
const rawId = AgentSession.id(backendSession);
58
>
if (!provider) {
59
throw new Error(`Cannot build open-session link: missing provider in ${backendSession.toString()}`);
60
}
61
>
const base = URI.from({ scheme: AGENT_HOST_SESSION_LINK_SCHEME, authority: provider, path: `/${rawId}` }).toString();
openSessionLink.ts
62
>
return chatId ? `${base}?chat=${encodeURIComponent(chatId)}` : base;
63
>
}
64
65
/**