openSessionLink.ts ×7

Frontier kind: Code frontier

unlabeled · c_fde2c4a9d854

1297 tests · 13968 LOC · 45 files · introduces 0 tests · 58 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges58 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
898 ranges13968 lines · 45 files · Browse complete extent
All tests (intent)
1297 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 58 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/common/openSessionLink.ts 58 introduced LOC · 7 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- openSessionLink.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { URI } from '../../../base/common/uri.js';
7 > import { AgentSession } from './agentService.js';
8 >
9 > /**
10 > * Dedicated URI scheme for "open this session" links surfaced in agent/tool
11 > * output (e.g. the `create_session` server tool result). A single stable
12 > * scheme keeps the chat markdown allow-list minimal and lets the Agents window
13 > * register one opener, rather than allow-listing every dynamic provider scheme.
14 > *
15 > * Shape: `agent-host-session://<provider>/<rawSessionId>` — the backend session
16 > * URI (`<provider>:/<rawSessionId>`) rearranged so the provider is the
17 > * authority and the id is the path.
18 > */
19 > export const AGENT_HOST_SESSION_LINK_SCHEME = 'agent-host-session';
20 >
21 > /** Name of the `create_session` server tool. */
22 > export const CREATE_SESSION_TOOL_NAME = 'create_session';
23 >
24 > /** Name of the `create_chat` server tool. */
25 > export const CREATE_CHAT_TOOL_NAME = 'create_chat';
26 >
27 > /** Name of the `send_message` server tool. */
28 > export const SEND_MESSAGE_TOOL_NAME = 'send_message';
29 >
30 > /**
31 > * Whether {@link toolName} (as seen on a tool call) matches {@link bareName}.
32 > * Accepts the bare name and a transport prefix such as Claude's
33 > * `mcp__<server>__<name>` (matched as a `__`-delimited suffix).
34 > */
35 function matchesToolName(toolName: string, bareName: string): boolean {
36 return toolName === bareName || toolName.endsWith(`__${bareName}`);
37 }
39 > /** Whether {@link toolName} refers to the `create_session` server tool. */
40 > export function isCreateSessionTool(toolName: string): boolean {
41 return matchesToolName(toolName, CREATE_SESSION_TOOL_NAME);
42 }
44 > /** Whether {@link toolName} refers to the `create_chat` server tool. */
45 > export function isCreateChatTool(toolName: string): boolean {
46 return matchesToolName(toolName, CREATE_CHAT_TOOL_NAME);
47 }
49 > /** Whether {@link toolName} refers to the `send_message` server tool. */
50 > export function isSendMessageTool(toolName: string): boolean {
51 return matchesToolName(toolName, SEND_MESSAGE_TOOL_NAME);
52 }
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 {
56 const provider = AgentSession.provider(backendSession);
57 const rawId = AgentSession.id(backendSession);
62 return chatId ? `${base}?chat=${encodeURIComponent(chatId)}` : base;
63 }
65 > /**
66 > * Recovers the backend session URI from an {@link AGENT_HOST_SESSION_LINK_SCHEME}
67 > * link, or `undefined` when the URI is not such a link.
68 > */
69 > export function parseOpenSessionLinkUri(uri: URI | string): URI | undefined {
70 const parsed = typeof uri === 'string' ? URI.parse(uri) : uri;
71 if (parsed.scheme !== AGENT_HOST_SESSION_LINK_SCHEME || !parsed.authority) {
78 return AgentSession.uri(parsed.authority, rawId);
79 }
81 > /**
82 > * Recovers the target chat id carried by an {@link AGENT_HOST_SESSION_LINK_SCHEME}
83 > * link (from `create_chat`), or `undefined` when the link targets a whole session.
84 > */
85 > export function parseOpenSessionLinkChatId(uri: URI | string): string | undefined {
86 const parsed = typeof uri === 'string' ? URI.parse(uri) : uri;
87 if (parsed.scheme !== AGENT_HOST_SESSION_LINK_SCHEME) {