copilotAgentSession.ts ×10

Frontier kind: Joint frontier

unlabeled · c_62a6c3eeab76

1 test · 44118 LOC · 243 files · introduces 1 test · 47 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges47 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
4144 ranges44118 lines · 243 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

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

src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts 47 introduced LOC · 10 ranges

Open complete file

1099 skipPermission: true,
1100 handler: async (_args: Record<string, unknown>, invocation) => {
1101 > try { copilotAgentSession.ts
1102 > const candidates = this._toToolSearchCandidates(invocation.availableTools);
1103 > const clientResult = await this._pendingClientToolCalls.registerAndFire(
1104 > invocation.toolCallId,
1105 > () => this._emitToolSearchReady(invocation.toolCallId, candidates),
1106 > );
1107 > return this._toToolSearchResult(clientResult, invocation.availableTools);
1108 > } catch (error) {
1109 this._logService.error(error, `[Copilot:${this.sessionId}] Failed in tool-search handler: toolCallId=${invocation.toolCallId}`);
1110 return this._toolSearchFailure(getErrorMessage(error));
1111 }
1113 };
1114 }
1139 private _clientToolName(toolName: string): string {
1140 return this._isToolSearchActive()
1141 > && toolName === RUNTIME_TOOL_SEARCH_TOOL_NAME copilotAgentSession.ts
1142 > ? CLIENT_TOOL_SEARCH_REFERENCE_NAME
1143 : toolName;
1144 }
1145
1146 private _toToolSearchCandidates(availableTools: readonly CurrentToolMetadata[] | undefined): readonly IToolSearchCandidate[] {
1147 > return (availableTools ?? []) copilotAgentSession.ts
1148 > .filter(tool => tool.deferLoading)
1149 > .map(tool => ({
1150 > name: tool.name,
1151 > description: tool.description ?? '',
1152 > }));
1153 > }
1154
1155 private _emitToolSearchReady(toolCallId: string, candidates: readonly IToolSearchCandidate[]): void {
1156 > const tracked = this._activeToolCalls.get(toolCallId); copilotAgentSession.ts
1157 > if (!tracked) {
1158 throw new Error(`Tool-search call '${toolCallId}' was not tracked.`);
1159 }
1160 > this._emitAction({ copilotAgentSession.ts
1161 > type: ActionType.ChatToolCallReady,
1162 > turnId: this._turnId,
1163 > toolCallId,
1164 > invocationMessage: getInvocationMessage(tracked.toolName, tracked.displayName, tracked.parameters),
1165 > toolInput: getToolInputString(tracked.toolName, tracked.parameters, tracked.parameters ? tryStringify(tracked.parameters) : undefined),
1166 > confirmed: ToolCallConfirmationReason.NotNeeded,
1167 > _meta: toToolCallMeta({ ...(tracked.meta ?? {}), toolSearchCandidates: candidates }),
1168 > }, tracked.parentToolCallId);
1169 > }
1170
1171 private _toolSearchFailure(message: string): ToolResultObject {
1174
1175 private _toToolSearchResult(clientResult: ToolResultObject, availableTools: readonly CurrentToolMetadata[] | undefined): ToolResultObject {
1176 > const deferred = new Set<string>(); copilotAgentSession.ts
1177 > for (const tool of availableTools ?? []) {
1178 > if (tool.deferLoading) {
1179 > deferred.add(tool.name);
1180 > if (tool.namespacedName) {
1181 deferred.add(tool.namespacedName);
1182 }
1184 > }
1185 > const clientNames = this._parseToolSearchNames(clientResult.textResultForLlm);
1186 > const toolReferences = clientNames.filter(name => deferred.has(name));
1187 > this._logService.info(`[Copilot:${this.sessionId}] tool_search override: availableTools=${availableTools?.length ?? 0}, deferred=${deferred.size}, clientMatched=[${clientNames.join(', ')}] -> toolReferences=[${toolReferences.join(', ')}]`);
1188 > return { ...clientResult, toolReferences };
1189 > }
1190
1191 private _parseToolSearchNames(text: string): string[] {
1192 > try { copilotAgentSession.ts
1193 > const parsed = JSON.parse(text);
1194 > return Array.isArray(parsed) ? parsed.filter((name): name is string => typeof name === 'string') : [];
1195 > } catch {
1196 return [];
1197 }
1199
1200 /**