buildSessionEvents.ts ×5

Frontier kind: Code frontier

unlabeled · c_0540a83d2077

3 tests · 33322 LOC · 176 files · introduces 0 tests · 40 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges40 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2895 ranges33322 lines · 176 files · Browse complete extent
All tests (intent)
3 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: 40 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/buildSessionEvents.ts 40 introduced LOC · 5 ranges

Open complete file

88 /** Emits the `tool.execution_start` + `tool.execution_complete` pair for a completed tool call. */
89 const pushCompletedToolCall = (tc: ToolCallCompletedState): void => {
90 > let toolArguments: Record<string, unknown> | undefined; buildSessionEvents.ts
91 > if (tc.toolInput) {
92 try {
93 const parsed = JSON.parse(tc.toolInput);
100 }
101 }
102 > // If the tool call carries sub-agent identity, emit `subagent.started` buildSessionEvents.ts
103 > // first so a resume reconstructs the sub-agent name/description onto the
104 > // parent tool call (the SDK keys this by `toolCallId`). Required fields
105 > // fall back to the title so the event stays well-formed.
106 > const subagent = tc.content?.find((c): c is ToolResultSubagentContent => c.type === ToolResultContentType.Subagent);
107 > if (subagent) {
108 push({
109 id: generateUuid(),
119 });
120 }
121 > push({ buildSessionEvents.ts
122 > id: generateUuid(),
123 > parentId,
124 > timestamp: nextTimestamp(),
125 > type: 'tool.execution_start',
126 > data: {
127 > toolCallId: tc.toolCallId,
128 > toolName: tc.toolName,
129 > ...(toolArguments ? { arguments: toolArguments } : {}),
130 > },
131 > });
132 > const resultText = extractToolResultText(tc.content);
133 > push({
134 > id: generateUuid(),
135 > parentId,
136 > timestamp: nextTimestamp(),
137 > type: 'tool.execution_complete',
138 > data: {
139 > toolCallId: tc.toolCallId,
140 > success: tc.success,
141 > ...(tc.success ? { result: { content: resultText } } : {}),
142 > ...(tc.error ? { error: { message: tc.error.message, ...(tc.error.code ? { code: tc.error.code } : {}) } } : {}),
143 > },
144 > });
145 > };
146
147 push({
215 reasoning += part.content;
216 } else if (part.kind === ResponsePartKind.ToolCall && part.toolCall.status === ToolCallStatus.Completed) {
217 > // Flush accumulated assistant text before the tool call so the buildSessionEvents.ts
218 > // reconstructed part order matches the original interleaving.
219 > flushAssistantMessage();
220 > pushCompletedToolCall(part.toolCall);
221 > }
222 // Content refs and system notifications are not yet translated.
223 }
244
245 /** Concatenates the text of a completed tool call's textual result content blocks. */
246 > function extractToolResultText(content: readonly ToolResultContent[] | undefined): string { buildSessionEvents.ts
247 > if (!content) {
248 return '';
249 }