mapSessionEvents.ts ×12

Frontier kind: Code frontier

unlabeled · c_421b3700f5ad

22 tests · 32913 LOC · 175 files · introduces 0 tests · 47 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges47 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2811 ranges32913 lines · 175 files · Browse complete extent
All tests (intent)
22 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: 47 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts 47 introduced LOC · 12 ranges

Open complete file

154 }
155
156 > function readStringProperty(source: unknown, key: string): string | undefined { mapSessionEvents.ts
157 > if (!source || typeof source !== 'object' || Array.isArray(source)) {
158 return undefined;
159 }
160 > const value = (source as Record<string, unknown>)[key]; mapSessionEvents.ts
161 > return typeof value === 'string' && value.length > 0 ? value : undefined;
162 > }
163
164 > function readMcpUiResourceUri(source: unknown): string | undefined { mapSessionEvents.ts
165 > if (!source || typeof source !== 'object' || Array.isArray(source)) {
166 return undefined;
167 }
168 > const toolDescription = (source as Record<string, unknown>)['toolDescription']; mapSessionEvents.ts
169 > if (!toolDescription || typeof toolDescription !== 'object' || Array.isArray(toolDescription)) {
170 return undefined;
171 }
172 const meta = (toolDescription as Record<string, unknown>)['_meta'];
173 > if (!meta || typeof meta !== 'object' || Array.isArray(meta)) { mapSessionEvents.ts
174 return undefined;
175 }
176 const ui = (meta as Record<string, unknown>)['ui'];
177 > if (!ui || typeof ui !== 'object' || Array.isArray(ui)) { mapSessionEvents.ts
178 return undefined;
179 }
181 }
182
183 > function makeToolStartInfo(toolName: string, rawArguments: unknown, parentToolCallId: string | undefined, workingDirectory: URI | undefined, source: unknown): IToolStartInfo | undefined { mapSessionEvents.ts
184 > if (isHiddenTool(toolName)) {
185 return undefined;
186 }
187 > const rawArgs = rawArguments !== undefined ? tryStringify(rawArguments) : undefined; mapSessionEvents.ts
188 > let parameters: Record<string, unknown> | undefined;
189 > if (rawArgs) {
190 try { parameters = JSON.parse(rawArgs) as Record<string, unknown>; } catch { /* ignore */ }
191 }
192 > // stripRedundantCdPrefix mutates `parameters` and signals via its mapSessionEvents.ts
193 > // return value. We re-stringify only when it changed something so
194 > // `getToolInputString` sees the cleaned command line.
195 > const cleaned = stripRedundantCdPrefix(toolName, parameters, workingDirectory) ? tryStringify(parameters) : undefined;
196 > const toolArgs = cleaned ?? rawArgs;
197 > const toolKind = getToolKind(toolName);
198 > const subagentMeta = toolKind === 'subagent' ? getSubagentMetadata(parameters) : undefined;
199 > const displayName = getToolDisplayName(toolName);
200 > return {
201 > toolName,
202 > displayName,
203 > invocationMessage: getInvocationMessage(toolName, displayName, parameters),
204 > toolInput: getToolInputString(toolName, parameters, toolArgs),
205 > toolKind,
206 > language: toolKind === 'terminal' ? getShellLanguage(toolName) : undefined,
207 > intention: getShellIntention(toolName, parameters),
208 > subagentAgentName: subagentMeta?.agentName,
209 > subagentDescription: subagentMeta?.description,
210 > parameters,
211 > parentToolCallId,
212 > mcpServerName: readStringProperty(source, 'mcpServerName'),
213 > mcpToolName: readStringProperty(source, 'mcpToolName'),
214 > mcpUiResourceUri: readMcpUiResourceUri(source),
215 > };
216 > }
217
218 function finalizeTurn(builder: ITurnBuilder, state: TurnState): Turn {
277 }
278 if (e.type === 'tool.execution_complete') {
279 > completionsByCallId.set(e.data.toolCallId, e.data); mapSessionEvents.ts
280 > }
281 if (e.type === 'tool.execution_start') {
282 const d = e.data;
524 }
525 case 'tool.execution_complete': {
526 > const d = e.data; mapSessionEvents.ts
527 > const info = toolInfoByCallId.get(d.toolCallId);
528 > if (!info) {
529 // Orphan complete (no matching start), or hidden tool.
530 continue;
559 // When a parent tool call that spawned a subagent completes,
560 // flush the subagent's accumulated turn.
561 > if (!parentToolCallId && subagentInfoByToolCallId.has(d.toolCallId)) { mapSessionEvents.ts
562 flushSubagent(d.toolCallId);
563 }