agentService.ts ×9

Frontier kind: Code frontier

unlabeled · c_4f6aba2ff01c

8 tests · 51221 LOC · 304 files · introduces 0 tests · 52 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges52 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5282 ranges51221 lines · 304 files · Browse complete extent
All tests (intent)
8 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: 52 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentService.ts 52 introduced LOC · 9 ranges

Open complete file

1196 let sideChatOrigin: ChatOrigin | undefined;
1197 if (options?.sideChat) {
1198 > const resolvedSideChat = this._resolveSideChatOrigin(session, options.sideChat); agentService.ts
1199 > sideChatOrigin = resolvedSideChat.origin;
1200 > createOptions = {
1201 > ...options,
1202 > sideChat: {
1203 > ...options.sideChat,
1204 > source: URI.parse(resolvedSideChat.sourceChat),
1205 > ...(resolvedSideChat.providerAnchorTurnId ? { providerAnchorTurnId: resolvedSideChat.providerAnchorTurnId } : {}),
1206 > ...(resolvedSideChat.sourceContext ? { sourceContext: resolvedSideChat.sourceContext } : {}),
1207 > ...(resolvedSideChat.partialResponse ? { partialResponse: resolvedSideChat.partialResponse } : {}),
1208 > },
1209 > };
1210 > }
1211 if (options?.fork) {
1212 const sourceKey = options.fork.source.toString();
1292 */
1293 private _resolveSideChatOrigin(session: URI, sideChat: IAgentCreateChatSideChatSource): { origin: ChatOrigin; sourceChat: string; selection?: IAgentCreateChatSideChatSelection; providerAnchorTurnId?: string; sourceContext?: string; partialResponse?: string } {
1294 > const sessionKey = session.toString(); agentService.ts
1295 > const sourceKey = sideChat.source.toString();
1296 > const { sourceChatKey, sourceSessionKey, sourceState } = this._resolveSessionSourceChat(session, sideChat.source);
1297 > // The source chat MUST belong to the target session. Older callers may
1298 > // still address the main chat by session URI; synced AHP clients send the
1299 > // actual default-chat URI.
1300 > if (sourceSessionKey !== sessionKey) {
1301 throw new Error(`[AgentService] createChat: side chat source ${sourceKey} does not belong to session ${sessionKey}`);
1302 }
1303 // The bounded turn must be a real completed or currently-active turn.
1304 > const activeTurn = sourceState?.activeTurn?.id === sideChat.turnId ? sourceState.activeTurn : undefined; agentService.ts
1305 > const hasCompletedTurn = sourceState?.turns.some(t => t.id === sideChat.turnId) ?? false;
1306 > if (!hasCompletedTurn && !activeTurn) {
1307 throw new Error(`[AgentService] createChat: side chat source turn ${sideChat.turnId} not found in ${sourceKey}`);
1308 }
1309 const isLocalSourceTurn = !activeTurn && this._localTurns.isLocal(sourceChatKey, sideChat.turnId);
1310 > const providerAnchorTurnId = isLocalSourceTurn ? this._localTurns.resolveConcreteTurnId(sourceChatKey, sideChat.turnId) : undefined; agentService.ts
1311 > const partialResponse = getSideChatPartialResponse(activeTurn);
1312 > const sourceContext = (activeTurn || isLocalSourceTurn)
1313 ? buildBoundedSideChatSourceContext(sourceState?.turns ?? [], sideChat.turnId, activeTurn)
1314 : undefined;
1315 > const selection = sideChat.selection?.text.trim() agentService.ts
1316 ? sideChat.selection
1317 : sideChat.selection
1318 ? (() => { throw new Error('[AgentService] createChat: side chat selection text must be non-empty'); })()
1319 : undefined;
1320 > return { agentService.ts
1321 > origin: {
1322 > kind: ChatOriginKind.SideChat,
1323 > chat: sourceChatKey,
1324 > turnId: sideChat.turnId,
1325 > ...(selection ? { selection } : {}),
1326 > },
1327 > sourceChat: sourceChatKey,
1328 > ...(selection ? { selection } : {}),
1329 > ...(providerAnchorTurnId ? { providerAnchorTurnId } : {}),
1330 > ...(sourceContext ? { sourceContext } : {}),
1331 > ...(partialResponse ? { partialResponse } : {}),
1332 > };
1333 > }
1334
1335 private _resolveSessionSourceChat(session: URI, source: URI): { sourceChatKey: string; sourceSessionKey: string; sourceState: ReturnType<AgentHostStateManager['getChatState']> | undefined } {
1336 > const sessionKey = session.toString(); agentService.ts
1337 > const sourceKey = source.toString();
1338 > const sourceSessionKey = isAhpChatChannel(sourceKey) ? parseRequiredSessionUriFromChatUri(sourceKey) : sourceKey;
1339 > const defaultChatKey = this._stateManager.getSessionState(sessionKey)?.defaultChat ?? buildDefaultChatUri(sessionKey);
1340 > const sourceChatKey = sourceKey === sessionKey
1341 ? defaultChatKey
1342 : this._stateManager.getChatState(sourceKey)
1345 ? defaultChatKey
1346 : sourceKey;
1347 > return { agentService.ts
1348 > sourceSessionKey,
1349 > sourceChatKey,
1350 > sourceState: sourceChatKey === defaultChatKey
1351 ? (this._stateManager.getChatState(defaultChatKey) ?? this._stateManager.getDefaultChatState(sessionKey))
1352 : this._stateManager.getChatState(sourceChatKey),
1353 > }; agentService.ts
1354 > }
1355
1356 async disposeChat(session: URI, chat: URI): Promise<void> {