/** * Resource-address codec for an embedded subagent Session chat. * * Mirrors `@deepseek-ai/dsh-client-ui-subagent`'s own `subagentChatAddress` * (the `dsh-resource://subagentchat/session/?parent&mode` form the * native right Sidebar roots its `subagentchat` pages under). Copied rather * than imported: the package exports no helpers and the plugin must not depend * on its internals. Kept dependency-free so it is unit-testable in node. * * @module */ import type { SidebarSubagentAddress } from '../../context-types.ts' /** Resource-address prefix for an embedded Session chat. */ export const SUBAGENT_CHAT_ADDRESS = 'dsh-resource://subagentchat/session/' /** The native right Sidebar page kind an embedded Session chat opens as. */ export const SUBAGENT_CHAT_KIND = 'subagentchat' /** * Address one subagent Session together with the routing facts needed to * restore it. * @param address - durable direct-parent subagent address. * @returns canonical Sidebar resource address. */ export function subagentChatAddress(address: SidebarSubagentAddress): string { const query = new URLSearchParams({ parent: address.parentSessionId, mode: address.mode, }) return `${SUBAGENT_CHAT_ADDRESS}${encodeURIComponent(address.childSessionId)}?${query.toString()}` }