copilotTestEvents.ts ×1

Frontier kind: Code frontier

unlabeled · c_dbcd70c9755c

43 tests · 32733 LOC · 176 files · introduces 0 tests · 147 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
1 range147 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2704 ranges32733 lines · 176 files · Browse complete extent
All tests (intent)
43 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: 147 introduced LOC across 1 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/test/node/copilotTestEvents.ts 147 introduced LOC · 1 range

Open complete file

1 > /*--------------------------------------------------------------------------------------------- copilotTestEvents.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import type { Attachment, SessionEvent, SessionEventPayload, ToolExecutionCompleteContent } from '@github/copilot-sdk';
7 >
8 > // =============================================================================
9 > // Minimal session-event shapes for tests
10 > // =============================================================================
11 > // Production (`node/copilot/mapSessionEvents.ts`) consumes the real SDK
12 > // `SessionEvent` union. The SDK members require envelope fields the mapper
13 > // never reads (`parentId`, `timestamp`, `ephemeral`, …) plus stricter `data`
14 > // shapes, which makes hand-written event literals noisy. These ergonomic
15 > // subsets let tests construct only the fields the mapper actually reads; feed
16 > // them to the production mapper via {@link toSessionEvents}.
17 >
18 > export interface ISessionEventToolStart {
19 > type: 'tool.execution_start';
20 > /** Envelope-level sub-agent instance id; resolved to the parent tool call id via `subagent.started`. */
21 > agentId?: string;
22 > data: {
23 > toolCallId: string;
24 > toolName: string;
25 > arguments?: unknown;
26 > mcpServerName?: string;
27 > mcpToolName?: string;
28 > toolDescription?: unknown;
29 > /** @deprecated Use the envelope-level {@link ISessionEventToolStart.agentId} instead. */
30 > parentToolCallId?: string;
31 > };
32 > }
33 >
34 > export interface ISessionEventToolComplete {
35 > type: 'tool.execution_complete';
36 > /** Envelope-level sub-agent instance id. See {@link ISessionEventToolStart.agentId}. */
37 > agentId?: string;
38 > data: {
39 > toolCallId: string;
40 > success: boolean;
41 > result?: {
42 > /** `content` is result text; `contents` are typed SDK result blocks such as `shell_exit`. */
43 > content?: string;
44 > contents?: ToolExecutionCompleteContent[];
45 > };
46 > error?: { message: string; code?: string };
47 > isUserRequested?: boolean;
48 > toolTelemetry?: unknown;
49 > mcpServerName?: string;
50 > mcpToolName?: string;
51 > toolDescription?: unknown;
52 > /** @deprecated Use the envelope-level {@link ISessionEventToolComplete.agentId} instead. */
53 > parentToolCallId?: string;
54 > };
55 > }
56 >
57 > export interface ISessionEventMessage {
58 > type: 'assistant.message' | 'user.message';
59 > /** SDK envelope-level event id, used as the protocol turn id. */
60 > id?: string;
61 > /** Envelope-level sub-agent instance id. See {@link ISessionEventToolStart.agentId}. */
62 > agentId?: string;
63 > data: {
64 > messageId?: string;
65 > interactionId?: string;
66 > content?: string;
67 > toolRequests?: readonly { toolCallId: string; name: string; arguments?: unknown; type?: 'function' | 'custom'; mcpServerName?: string; mcpToolName?: string; toolDescription?: unknown }[];
68 > reasoningOpaque?: string;
69 > reasoningText?: string;
70 > encryptedContent?: string;
71 > /** @deprecated Use the envelope-level {@link ISessionEventMessage.agentId} instead. */
72 > parentToolCallId?: string;
73 > /** Origin of the message; a non-`'user'` value marks an SDK-injected message that should be hidden. */
74 > source?: string;
75 > attachments?: readonly Attachment[];
76 > };
77 > }
78 >
79 > /** Minimal event shape for `skill.invoked`, used to synthesize a tool-style render. */
80 > export interface ISessionEventSkillInvoked {
81 > type: 'skill.invoked';
82 > id?: string;
83 > /** Envelope-level sub-agent instance id. */
84 > agentId?: string;
85 > data: {
86 > name: string;
87 > path?: string;
88 > description?: string;
89 > };
90 > }
91 >
92 > export interface ISessionEventSubagentStarted {
93 > type: 'subagent.started';
94 > /** Envelope-level sub-agent instance id resolved back to {@link ISessionEventSubagentStarted.data.toolCallId}. */
95 > agentId?: string;
96 > data: {
97 > toolCallId: string;
98 > agentName: string;
99 > agentDisplayName: string;
100 > agentDescription: string;
101 > };
102 > }
103 >
104 > export interface ISessionEventAbort {
105 > type: 'abort';
106 > /** Envelope-level sub-agent instance id. */
107 > agentId?: string;
108 > data: {
109 > reason: string;
110 > };
111 > }
112 >
113 > export interface ISessionEventAssistantTurn {
114 > type: 'assistant.turn_start' | 'assistant.turn_end';
115 > agentId?: string;
116 > data: {
117 > turnId: string;
118 > interactionId?: string;
119 > };
120 > }
121 >
122 > export interface ISessionEventSystemNotification {
123 > type: 'system.notification';
124 > id?: string;
125 > data: SessionEventPayload<'system.notification'>['data'];
126 > }
127 >
128 > /** Minimal event shape for session history mapping. */
129 > export type ISessionEvent =
130 > | ISessionEventToolStart
131 > | ISessionEventToolComplete
132 > | ISessionEventMessage
133 > | ISessionEventSubagentStarted
134 > | ISessionEventSkillInvoked
135 > | ISessionEventAbort
136 > | ISessionEventAssistantTurn
137 > | ISessionEventSystemNotification
138 > | { type: string; data?: unknown };
139 >
140 > /**
141 > * Widens ergonomic {@link ISessionEvent} test fixtures to the real SDK
142 > * {@link SessionEvent} union so they can be fed to the production
143 > * `mapSessionEvents`. The test shapes deliberately omit envelope fields the
144 > * mapper ignores (`parentId`, `timestamp`, …), so this is a safe deliberate
145 > * widening rather than a representation of real SDK events.
146 > */
147 > export function toSessionEvents(events: readonly ISessionEvent[]): SessionEvent[] {
148 return events as unknown as SessionEvent[];
149 }