claudeMapSessionEvents.ts ×7

Frontier kind: Code frontier

unlabeled · c_d798974d39f1

12 tests · 24144 LOC · 107 files · introduces 0 tests · 69 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges69 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1929 ranges24144 lines · 107 files · Browse complete extent
All tests (intent)
12 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.

2 files ranked by introduced lines: 69 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/claude/claudeMapSessionEvents.ts 45 introduced LOC · 7 ranges

Open complete file

135 */
136 lookupToolCall(toolUseId: string): { turnId: string; toolName: string } | undefined {
137 > const entry = this.toolCalls.lookup(toolUseId); claudeMapSessionEvents.ts
138 > return entry ? { turnId: entry.turnId, toolName: entry.toolName } : undefined;
139 > }
140
141 /** Drain cross-message tracking once a `tool_result` is delivered. */
328 return [];
329 }
331 > const signals: AgentSignal[] = [];
332 > for (const block of content) {
333 > if (block.type !== 'tool_result') {
334 continue;
335 }
336 > const tracked = state.lookupToolCall(block.tool_use_id); claudeMapSessionEvents.ts
337 > if (!tracked) {
338 logService.warn(`[claudeMapSessionEvents] tool_result for unknown tool_use_id ${block.tool_use_id}`);
339 continue;
341 const isError = block.is_error === true;
342 const content: ToolResultContent[] = extractToolResultContent(block.content) ?? [];
343 > const fileEdit = state.takeFileEdit(block.tool_use_id); claudeMapSessionEvents.ts
344 > if (fileEdit) {
345 content.push(fileEdit);
346 }
347 const info = state.toolCalls.lookup(block.tool_use_id)?.info;
348 > const resultText = content claudeMapSessionEvents.ts
349 > .filter((c): c is { type: ToolResultContentType.Text; text: string } => c.type === ToolResultContentType.Text)
350 > .map(c => c.text)
351 > .join('\n');
352 > const pastTenseMessage: StringOrMarkdown = info
353 ? getClaudePastTenseMessage(info.toolName, info.displayName, info.parsedInput, !isError, resultText)
354 : `${getClaudeToolDisplayName(tracked.toolName)} finished`;
355 > // A denied/cancelled tool surfaces as an `is_error` result whose content claudeMapSessionEvents.ts
356 > // is the deny `message` we returned from `canUseTool`; classify it so the
357 > // telemetry reports `userCancelled` rather than a generic error.
358 > const denialCode = isError ? claudeToolDenialCode(resultText) : undefined;
359 > signals.push({
360 > kind: 'action',
361 > resource: chat,
362 > action: {
363 > type: ActionType.ChatToolCallComplete,
364 > turnId: tracked.turnId,
365 > toolCallId: block.tool_use_id,
366 > result: {
367 > success: !isError,
368 > pastTenseMessage,
369 > content: content.length > 0 ? content : undefined,
370 > ...(denialCode ? { error: { message: resultText, code: denialCode } } : {}),
371 > },
372 > },
373 > });
374 > state.completeToolCall(block.tool_use_id);
375 > // Phase 12 — foreground subagent completion. A tool_result for a
376 > // known spawning Task/Agent tool_use fires `subagent_completed`
377 > // UNLESS the spawning entry has been flagged background, in which
378 > // case completion is deferred to a later `task_notification`.
379 > const spawn = registry.getSpawn(block.tool_use_id);
380 > if (spawn && !spawn.background && spawn.markCompleted()) {
381 signals.push({
382 kind: 'subagent_completed',
386 registry.removeSpawn(block.tool_use_id);
387 }
389 > return signals;
390 > }
391
392 /**
src/vs/platform/agentHost/test/node/claudeMapSessionEventsTestUtils.ts 24 introduced LOC · 1 range

Open complete file

280 */
281 export function makeUserToolResultMessage(
282 > sessionId: string, claudeMapSessionEventsTestUtils.ts
283 > toolUseId: string,
284 > content: string | Array<{ type: 'text'; text: string }>,
285 > options?: { isError?: boolean },
286 > ): SDKUserMessage {
287 > return {
288 > type: 'user',
289 > message: {
290 > role: 'user',
291 > content: [
292 > {
293 > type: 'tool_result',
294 > tool_use_id: toolUseId,
295 > content,
296 > ...(options?.isError ? { is_error: true } : {}),
297 > },
298 > ],
299 > },
300 > parent_tool_use_id: null,
301 > isSynthetic: true,
302 > uuid: TEST_UUID,
303 > session_id: sessionId,
304 > };
305 > }