agentSideEffects.ts ×6

Frontier kind: Code frontier

unlabeled · c_1929c6bb4b35

307 tests · 40783 LOC · 233 files · introduces 0 tests · 88 LOC · 5 files

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges88 lines · 5 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3686 ranges40783 lines · 233 files · Browse complete extent
All tests (intent)
307 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.

5 files ranked by introduced lines: 88 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentSideEffects.ts 49 introduced LOC · 6 ranges

Open complete file

166
167 constructor(
168 > private readonly _stateManager: AgentHostStateManager, agentSideEffects.ts
169 > private readonly _options: IAgentSideEffectsOptions,
170 > @IInstantiationService instantiationService: IInstantiationService,
171 > @ILogService private readonly _logService: ILogService,
172 > @IAgentHostChangesetService private readonly _changesets: IAgentHostChangesetService,
173 > @ITelemetryService private readonly _telemetryService: ITelemetryService,
174 > @IAgentHostCheckpointService private readonly _checkpointService: IAgentHostCheckpointService,
175 > ) {
176 > super();
177 > this._telemetryReporter = new AgentHostTelemetryReporter(this._telemetryService);
178 > this._turnTracker = new AgentHostTurnTracker(this._telemetryReporter);
179 > this._toolCallTracker = this._register(new AgentHostToolCallTracker(this._telemetryReporter));
180 > this._permissionManager = this._register(instantiationService.createInstance(SessionPermissionManager, this._stateManager, {}));
181 > this._localCommands = this._register(instantiationService.createInstance(
182 > AgentHostLocalCommands,
183 > this._stateManager,
184 > this._options.localTurns,
185 > // Draining the queue re-enters agent lookup / telemetry / sendMessage,
186 > // which is this class's responsibility, so the dispatcher hands the
187 > // turn back here once it has completed a host-handled command.
188 > (turnChannel: ProtocolURI) => this._tryConsumeNextQueuedMessage(turnChannel),
189 > ));
190 > this._titleController = this._register(instantiationService.createInstance(AgentHostSessionTitleController, this._stateManager, {
191 > sessionDataService: this._options.sessionDataService,
192 > getGitHubCopilotToken: this._options.getGitHubCopilotToken,
193 > copilotApiService: this._options.copilotApiService,
194 > }));
195 >
196 > // Whenever the agents observable changes, publish to root state.
197 > this._register(autorun(reader => {
198 > const agents = this._options.agents.read(reader);
199 > this._publishAgentInfos(agents, reader);
200 > }));
201 >
202 > // Server-dispatched ChatToolCallComplete actions (e.g. from
203 > // the disconnect timeout in ProtocolServerHandler) bypass
204 > // handleAction, so the agent's SDK deferred never resolves.
205 > // Listen for these envelopes and notify the agent directly.
206 > this._register(this._stateManager.onDidEmitEnvelope(envelope => {
207 if (isAhpChatChannel(envelope.channel) && isChatAction(envelope.action)) {
208 if (envelope.action.type === ActionType.ChatTurnCancelled) {
231 this._persistChatDraft(envelope.channel, envelope.action.draft);
232 }
233 > })); agentSideEffects.ts
234 > }
235
236 /**
238 */
239 private _publishAgentInfos(agents: readonly IAgent[], reader?: IReader): void {
240 > const infos: AgentInfo[] = agents.map(a => { agentSideEffects.ts
241 const d = a.getDescriptor();
242 const protectedResources = a.getProtectedResources();
260 capabilities: d.capabilities ? { ...d.capabilities } : undefined,
261 };
263 > if (equals(this._lastAgentInfos, infos)) {
264 return;
265 }
266 this._lastAgentInfos = infos;
267 this._stateManager.dispatchServerAction(ROOT_STATE_URI, { type: ActionType.RootAgentsChanged, agents: infos });
269
270 private async _publishSessionCustomizations(agent: IAgent, session: ProtocolURI): Promise<void> {
1693
1694 override dispose(): void {
1695 > this._toolCallAgents.clear(); agentSideEffects.ts
1696 > this._toolCallTracker.clear();
1697 > super.dispose();
1698 > }
1699 }
1700
src/vs/platform/agentHost/node/localCommands/localChatCommand.ts 25 introduced LOC · 2 ranges

Open complete file

112
113 createAll(context: ILocalChatCommandContext): ILocalChatCommand[] {
114 > return this._ctors.map(ctor => new ctor(context)); localChatCommand.ts
115 > }
116 }
117
131
132 constructor(
133 > private readonly _stateManager: AgentHostStateManager, localChatCommand.ts
134 > private readonly _localTurns: AgentHostLocalTurns,
135 > /**
136 > * Invoked after a handled turn is completed so the owner can start the
137 > * next queued message. Draining re-enters the agent-send pipeline, which
138 > * is the owner's concern — not the dispatcher's.
139 > */
140 > private readonly _notifyTurnConsumable: (turnChannel: ProtocolURI) => void,
141 > @ILogService private readonly _logService: ILogService,
142 > @IAgentHostTerminalManager private readonly _terminalManager: IAgentHostTerminalManager,
143 > @ISessionDataService private readonly _sessionDataService: ISessionDataService,
144 > ) {
145 > super();
146 > const context: ILocalChatCommandContext = {
147 > logService: this._logService,
148 > terminalManager: this._terminalManager,
149 > dispatch: (channel, action) => this._stateManager.dispatchServerAction(channel, action),
150 > getState: channel => this._stateManager.getSessionState(channel),
151 > updateChatTitle: (session, chat, title) => this._stateManager.updateChatTitle(session, chat, title),
152 > persistSessionFlag: (session, key, value) => persistSessionMetadata(this._sessionDataService, this._logService, session, key, value),
153 > };
154 > this._commands = LocalChatCommandRegistry.createAll(context).map(command => this._register(command));
155 > }
156
157 /**
src/vs/platform/agentHost/node/agentHostToolCallTracker.ts 6 introduced LOC · 2 ranges

Open complete file

91
92 constructor(private readonly _reporter: AgentHostTelemetryReporter) {
94 > }
95
96 toolCallStarted(provider: string, session: string, toolCallId: string, toolName: string, contributor: ToolCallContributor | undefined): void {
193
194 clear(): void {
195 > this._toolCalls.clear(); agentHostToolCallTracker.ts
196 > this._toolCallStallTimers.clearAndDisposeAll();
197 > this._stalledToolCalls.clear();
198 > }
199
200 private _key(session: string, toolCallId: string): string {
src/vs/platform/agentHost/node/localCommands/bangLocalCommand.ts 6 introduced LOC · 2 ranges

Open complete file

31
32 constructor(private readonly _context: ILocalChatCommandContext) {
33 > super(); bangLocalCommand.ts
34 > this._register(toDisposable(() => {
35 > for (const terminalUri of this._terminals) {
36 this._context.terminalManager.disposeTerminal(terminalUri);
37 }
38 > this._terminals.clear(); bangLocalCommand.ts
39 > }));
40 > }
41
42 tryHandle(request: ILocalChatCommandRequest): ILocalChatCommandHandling | undefined {
src/vs/platform/agentHost/node/localCommands/renameLocalCommand.ts 2 introduced LOC · 1 range

Open complete file

23
24 constructor(private readonly _context: ILocalChatCommandContext) {
25 > super(); renameLocalCommand.ts
26 > }
27
28 tryHandle(request: ILocalChatCommandRequest): ILocalChatCommandHandling | undefined {