localChatCommand.ts ×9

Frontier kind: Code frontier

unlabeled · c_2288ba1119f3

10 tests · 49985 LOC · 291 files · introduces 0 tests · 36 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges36 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5160 ranges49985 lines · 291 files · Browse complete extent
All tests (intent)
10 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: 36 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/localCommands/localChatCommand.ts 36 introduced LOC · 9 ranges

Open complete file

167 const handling = command.tryHandle(request);
168 if (handling) {
169 > void this._run(command, handling, request); localChatCommand.ts
170 > return handling;
171 > }
172 }
173 return undefined;
175
176 private async _run(command: ILocalChatCommand, handling: ILocalChatCommandHandling, request: ILocalChatCommandRequest): Promise<void> {
177 > const stopWatch = StopWatch.create(false); localChatCommand.ts
178 > try {
179 > await handling.run();
180 > } catch (err) {
181 this._logService.error(`[AgentHostLocalCommands] Command '${command.name}' failed: ${err instanceof Error ? err.message : String(err)}`, err);
182 > } finally { localChatCommand.ts
183 > // Common tail for every host-handled command: close out the turn the
184 > // reducer opened, optionally persist it as a local turn (so it
185 > // survives reload and anchors fork/truncate), then let the owner
186 > // drain any messages queued behind it.
187 > this._stateManager.dispatchServerAction(request.turnChannel, { type: ActionType.ChatTurnComplete, turnId: request.turnId, duration: Math.max(0, stopWatch.elapsed()) });
188 > if (command.recordsLocalTurn) {
189 > this._recordLocalTurn(request.turnChannel, request.turnId);
190 > }
191 > this._notifyTurnConsumable(request.turnChannel);
192 > }
193 > }
194
195 /**
201 */
202 private _recordLocalTurn(turnChannel: ProtocolURI, turnId: string): void {
203 > const chat = turnChannel; localChatCommand.ts
204 > const session = isAhpChatChannel(turnChannel) ? parseRequiredSessionUriFromChatUri(turnChannel) : turnChannel;
205 > const turns = this._stateManager.getSessionState(turnChannel)?.turns;
206 > if (!turns) {
207 return;
208 }
209 > const index = turns.findIndex(t => t.id === turnId); localChatCommand.ts
210 > if (index < 0) {
211 return;
212 }
213 > // Anchor = the nearest preceding turn in this chat that is not itself a localChatCommand.ts
214 > // local turn.
215 > let anchorTurnId: string | undefined;
216 > for (let i = index - 1; i >= 0; i--) {
217 if (!this._localTurns.isLocal(chat, turns[i].id)) {
218 anchorTurnId = turns[i].id;
220 }
221 }
222 > this._localTurns.record(session, chat, sanitizeLocalTurnForPersistence(turns[index]), anchorTurnId); localChatCommand.ts
223 > }
224 }
225
229 * PTY does not survive a reload, so only the captured output (text) is kept.
230 */
231 > function sanitizeLocalTurnForPersistence(turn: Turn): Turn { localChatCommand.ts
232 > const responseParts = turn.responseParts.map(part => {
233 if (part.kind !== ResponsePartKind.ToolCall) {
234 return part;
247 }
248 return { ...part, toolCall: { ...tc, content } };
250 > return { ...turn, responseParts };
251 > }