import { URI } from "../../../base/common/uri.js"; import { ILinkPresentation } from "../../dataChannel/common/dataChannel.js"; /** * Dedicated URI scheme for "open this session" links surfaced in agent/tool * output (e.g. the `create_session` server tool result). A single stable * scheme keeps the chat markdown allow-list minimal and lets the Agents window * register one opener, rather than allow-listing every dynamic provider scheme. * * Shape: `agent-host-session:///` — the backend session * URI (`:/`) rearranged so the provider is the * authority and the id is the path. */ export declare const AGENT_HOST_SESSION_LINK_SCHEME = "agent-host-session"; export declare const AGENT_HOST_SESSION_LINK_PATTERN: RegExp; export declare const AGENT_HOST_SESSION_ONLY_LINK_PATTERN: RegExp; export declare const AGENT_HOST_CHAT_LINK_PATTERN: RegExp; export type AgentSessionLinkStatus = "untitled" | "inProgress" | "needsInput" | "completed" | "error"; export declare function buildAgentSessionLinkPresentation(title: string, description: string | undefined, status: AgentSessionLinkStatus, kind?: "session" | "chat"): ILinkPresentation; /** Whether {@link toolName} refers to the `create_session` server tool. */ export declare function isCreateSessionTool(toolName: string): boolean; /** Whether {@link toolName} refers to the `create_chat` server tool. */ export declare function isCreateChatTool(toolName: string): boolean; /** Whether {@link toolName} refers to the `send_message` server tool. */ export declare function isSendMessageTool(toolName: string): boolean; /** * Builds an {@link AGENT_HOST_SESSION_LINK_SCHEME} link for a backend session URI. * * Normalizes the default chat: when {@link chatId} is {@link DEFAULT_CHAT_ID} * the link is emitted **without** a `chat=` query param. The Agents window gives * the default chat a resource with no URI fragment and the link opener selects a * chat by exact URI equality, so a link carrying `chat=default` would open the * session but match no chat. Omitting the id for the default chat is an * ecosystem-wide invariant (an absent chat id already means "the default chat"), * so it is enforced here once rather than at each call site. */ export declare function buildOpenSessionLinkUri(backendSession: URI | string, chatId?: string, turnId?: string, connectionAuthority?: string): string; /** * Builds a product protocol URL that opens an agent-host session in the Agents window. * * Shape: `://agents/agent-host-session//[/chat/]`. */ export declare function buildExternalOpenSessionLinkUri(productUrlProtocol: string, backendSession: URI | string, chatId?: string, turnId?: string, connectionAuthority?: string): string; /** * Recovers the internal agent-host session link carried by an Agents product protocol URL. */ export declare function parseExternalOpenSessionLinkUri(uri: URI | string, productUrlProtocol: string): URI | undefined; /** * Recovers the backend session URI from an {@link AGENT_HOST_SESSION_LINK_SCHEME} * link, or `undefined` when the URI is not such a link. */ export declare function parseOpenSessionLinkUri(uri: URI | string): URI | undefined; /** * Recovers the target chat id carried by an {@link AGENT_HOST_SESSION_LINK_SCHEME} * link (from `create_chat`), or `undefined` when the link targets a whole session. * * Defense in depth against externally-authored links: a `chat=default` param is * treated as absent (returns `undefined`). The default chat is addressed by its * session with no chat id, so surfacing `default` here would produce a chat * resource that matches no open chat; collapsing it to `undefined` keeps such * links resolving to the default chat. */ export declare function parseOpenSessionLinkChatId(uri: URI | string): string | undefined; export declare function parseOpenSessionLinkTurnId(uri: URI | string): string | undefined; export declare function parseOpenSessionLinkConnectionAuthority(uri: URI | string): string | undefined; /** * Builds an {@link AGENT_HOST_SESSION_LINK_SCHEME} link that opens * `chatResource` (an AHP chat channel URI or a bare backend session URI) in its * recorded owning session `owner`. `defaultChat` is the owner's default chat: * it and the bare session get a session-only link, and any other chat carries * its chat id so the link opens that specific chat. Returns `undefined` when no * link can be built. * `connectionAuthority` names the client's connection to the host that owns * `owner` so the link opens on that connection; it is `undefined` for links a * host builds for its own sessions. * * This mirrors the link the host builds when resolving chat attachments so the * chat-reference chip in the input opens the exact same target. */ export declare function buildOpenSessionLinkForChat(owner: URI | string, chatResource: URI | string, defaultChat: URI | string | undefined, connectionAuthority: string | undefined): string | undefined;