copilotAgentSession.ts ×10

Frontier kind: Code frontier

unlabeled · c_59af1c2f53a6

42 tests · 43560 LOC · 242 files · introduces 0 tests · 31 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges31 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3977 ranges43560 lines · 242 files · Browse complete extent
All tests (intent)
42 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: 31 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

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

Open complete file

3218
3219 this._register(wrapper.onToolStart(e => {
3220 > if (isHiddenTool(e.data.toolName)) { copilotAgentSession.ts
3221 this._logService.trace(`[Copilot:${sessionId}] Tool started (hidden): ${e.data.toolName}`);
3222 return;
3223 }
3224 this._logService.info(`[Copilot:${sessionId}] Tool started: ${e.data.toolName}`);
3225 > let toolArgs = e.data.arguments !== undefined ? tryStringify(e.data.arguments) : undefined; copilotAgentSession.ts
3226 > let parameters: Record<string, unknown> | undefined;
3227 > if (toolArgs) {
3228 try { parameters = JSON.parse(toolArgs) as Record<string, unknown>; } catch { /* ignore */ }
3229 }
3250 }
3251 const toolKind = getToolKind(e.data.toolName);
3252 > const subagentMeta = toolKind === 'subagent' ? getSubagentMetadata(parameters) : undefined; copilotAgentSession.ts
3253 >
3254 > let contributor: { readonly kind: ToolCallContributorKind.Client; readonly clientId: string } | { readonly kind: ToolCallContributorKind.MCP; readonly customizationId: string } | undefined;
3255 > const clientToolName = this._clientToolName(e.data.toolName);
3256 > const isClientTool = this._clientToolNames.has(clientToolName);
3257 > const ownerClientId = isClientTool ? this._activeClientToolSet.ownerOf(clientToolName, this._currentTurn?.senderClientId) : undefined;
3258 > if (ownerClientId) {
3259 contributor = { kind: ToolCallContributorKind.Client, clientId: ownerClientId };
3260 } else if (e.data.mcpServerName) {
3270 // later round of reasoning (after tool_start/tool_complete)
3271 // would silently append to the pre-tool-call reasoning block.
3272 > this._currentTurn?.markdownPartIds.delete(parentToolCallId ?? ''); copilotAgentSession.ts
3273 > this._currentTurn?.reasoningPartIds.delete(parentToolCallId ?? '');
3274 >
3275 > const meta: Mutable<IToolCallMeta> = { toolKind, language: toolKind === 'terminal' ? getShellLanguage(e.data.toolName) : undefined };
3276 > if (subagentMeta?.description) {
3277 meta.subagentDescription = subagentMeta.description;
3278 }
3279 > if (subagentMeta?.agentName) { copilotAgentSession.ts
3280 meta.subagentAgentName = subagentMeta.agentName;
3281 }
3291 // eslint-disable-next-line local/code-no-untyped-meta-access -- Copilot SDK's own typed `_meta`, not the AHP protocol bag.
3292 const resourceUri = e.data.toolDescription?._meta?.ui?.resourceUri;
3293 > this._setToolCallUiMeta(meta, resourceUri, e.data.mcpServerName); copilotAgentSession.ts
3294 >
3295 > // Stash the start-time meta on the tracked tool call so the
3296 > // `tool.execution_complete` emission below can merge any
3297 > // additional namespaces (e.g. `ui`) on top without dropping
3298 > // what we already published at start time.
3299 > const tracked = this._activeToolCalls.get(e.data.toolCallId);
3300 > if (tracked) {
3301 tracked.meta = meta;
3302 }
3318 // ourselves and drop the active-tool entry so the SDK's own
3319 // tool.execution_complete for this id is suppressed.
3320 > if (isClientTool && !contributor) { copilotAgentSession.ts
3321 this._logService.warn(`[Copilot:${sessionId}] Client tool '${e.data.toolName}' started with no connected client; failing it immediately.`);
3322 this._activeToolCalls.delete(e.data.toolCallId);
3347 }
3348
3349 > const clientToolAutoApproved = contributor?.kind === ToolCallContributorKind.Client && this._lastAppliedPermissionMode === 'on'; copilotAgentSession.ts
3350 > const shouldWaitForClientToolReady = contributor?.kind === ToolCallContributorKind.Client
3351 && !isAgentCoordinationTool(e.data.toolName)
3352 && !clientToolAutoApproved;
3353 > if (shouldWaitForClientToolReady) { copilotAgentSession.ts
3354 return;
3355 }
3362 toolInput: getToolInputString(e.data.toolName, parameters, toolArgs),
3363 confirmed: ToolCallConfirmationReason.NotNeeded,
3364 > ...(clientToolAutoApproved ? { _meta: toToolCallMeta({ autoApproveBySetting: true }) } : {}), copilotAgentSession.ts
3365 > }, parentToolCallId);
3366 }));
3367