historyRecordFixtures.ts ×10

Frontier kind: Code frontier

unlabeled · c_f17863345305

7 tests · 51684 LOC · 304 files · introduces 0 tests · 93 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges93 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5422 ranges51684 lines · 304 files · Browse complete extent
All tests (intent)
7 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: 93 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/test/node/historyRecordFixtures.ts 91 introduced LOC · 10 ranges

Open complete file

172 }
173 } else if (msg.type === 'subagent_started') {
174 > subagentsByToolCallId.set(msg.toolCallId, msg); historyRecordFixtures.ts
175 } else if (msg.type === 'tool_start') {
176 if (msg.parentToolCallId) {
177 > continue; historyRecordFixtures.ts
178 > }
179 currentTurn?.pendingTools.set(msg.toolCallId, msg);
180 } else if (msg.type === 'tool_complete') {
181 if (msg.parentToolCallId) {
182 > continue; historyRecordFixtures.ts
183 > }
184 if (currentTurn) {
185 const start = currentTurn.pendingTools.get(msg.toolCallId);
189 const contentWithSubagent = msg.result.content ? [...msg.result.content] : [];
190 if (subagentEvent) {
191 > const parentSessionStr = msg.session.toString(); historyRecordFixtures.ts
192 > contentWithSubagent.push({
193 > type: ToolResultContentType.Subagent,
194 > resource: buildSubagentSessionUri(parentSessionStr, msg.toolCallId),
195 > title: subagentEvent.agentDisplayName,
196 > agentName: subagentEvent.agentName,
197 > description: subagentEvent.agentDescription,
198 > });
199 > }
200
201 const tc: ToolCallCompletedState = {
239 */
240 export function buildSubagentTurnsFromHistory(
241 > parentMessages: readonly IHistoryRecord[], historyRecordFixtures.ts
242 > parentToolCallId: string,
243 > childSessionUri: string,
244 > ): Turn[] {
245 > const innerToolCallIds = new Set<string>();
246 > for (const msg of parentMessages) {
247 > if ((msg.type === 'tool_start' || msg.type === 'tool_complete') && msg.parentToolCallId === parentToolCallId) {
248 > innerToolCallIds.add(msg.toolCallId);
249 > }
250 > }
251 >
252 > const subagentsByToolCallId = new Map<string, IHistorySubagentStartedRecord>();
253 > for (const msg of parentMessages) {
254 > if (msg.type === 'subagent_started' && innerToolCallIds.has(msg.toolCallId)) {
255 subagentsByToolCallId.set(msg.toolCallId, msg);
256 }
258 >
259 > const innerMessages = parentMessages.filter(msg => {
260 > if (msg.type === 'tool_start' || msg.type === 'tool_complete') {
261 > return msg.parentToolCallId === parentToolCallId;
262 > }
263 > if (msg.type === 'message') {
264 > return msg.parentToolCallId === parentToolCallId;
265 > }
266 > return false;
267 > });
268 >
269 > if (innerMessages.length === 0) {
270 return [];
271 }
273 > const responseParts: ResponsePart[] = [];
274 > const pendingTools = new Map<string, IHistoryToolStartRecord>();
275 >
276 > for (const msg of innerMessages) {
277 > if (msg.type === 'tool_start') {
278 > pendingTools.set(msg.toolCallId, msg);
279 > } else if (msg.type === 'tool_complete') {
280 > const start = pendingTools.get(msg.toolCallId);
281 > pendingTools.delete(msg.toolCallId);
282 >
283 > const subagentEvent = subagentsByToolCallId.get(msg.toolCallId);
284 > const contentWithSubagent = msg.result.content ? [...msg.result.content] : [];
285 > if (subagentEvent) {
286 contentWithSubagent.push({
287 type: ToolResultContentType.Subagent,
292 });
293 }
295 > const tc: ToolCallCompletedState = {
296 > status: ToolCallStatus.Completed,
297 > toolCallId: msg.toolCallId,
298 > toolName: start?.toolName ?? 'unknown',
299 > displayName: start?.displayName ?? 'Unknown Tool',
300 > invocationMessage: start?.invocationMessage ?? 'Unknown tool',
301 > toolInput: start?.toolInput,
302 > success: msg.result.success,
303 > pastTenseMessage: msg.result.pastTenseMessage,
304 > content: contentWithSubagent.length > 0 ? contentWithSubagent : undefined,
305 > error: msg.result.error,
306 > confirmed: ToolCallConfirmationReason.NotNeeded,
307 > _meta: {
308 > toolKind: start?.toolKind,
309 > language: start?.language,
310 > ...extractSubagentMeta(start),
311 > },
312 > };
313 > responseParts.push({
314 > kind: ResponsePartKind.ToolCall,
315 > toolCall: tc,
316 > });
317 > } else if (msg.type === 'message' && msg.role === 'assistant') {
318 if (msg.reasoningText) {
319 responseParts.push({
331 }
332 }
334 >
335 > if (responseParts.length === 0) {
336 return [];
337 }
339 > return [{
340 > id: generateUuid(),
341 > message: { text: '', origin: { kind: MessageKind.User } },
342 > responseParts,
343 > usage: undefined,
344 > state: TurnState.Complete,
345 > }];
346 > }
347
348 // =============================================================================
src/vs/platform/agentHost/test/node/mockAgent.ts 2 introduced LOC · 1 range

Open complete file

166 const subagentInfo = parseSubagentSessionUri(session);
167 if (subagentInfo) {
168 > return buildSubagentTurnsFromHistory(this.sessionMessages, subagentInfo.toolCallId, session.toString()); mockAgent.ts
169 > }
170 return buildTurnsFromHistory(this.sessionMessages);
171 }