chatServiceImpl.ts ×7

Frontier kind: Code frontier

unlabeled · c_29f80fbc9dac

32 tests · 72070 LOC · 309 files · introduces 0 tests · 63 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges63 lines · 4 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
6157 ranges72070 lines · 309 files · Browse complete extent
All tests (intent)
32 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.

4 files ranked by introduced lines: 63 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts 41 introduced LOC · 7 ranges

Open complete file

1701
1702 const agentResult = await this.chatAgentService.invokeAgent(agent.id, requestProps, progressCallback, history, token);
1703 > rawResult = agentResult; chatServiceImpl.ts
1704 > agentOrCommandFollowups = this.chatAgentService.getFollowups(agent.id, requestProps, agentResult, history, followupsCancelToken);
1705 > } else if (commandPart && this.chatSlashCommandService.hasCommand(commandPart.slashCommand.command, getChatSessionType(model.sessionResource))) {
1706 if (commandPart.slashCommand.silent !== true) {
1707 request = model.addRequest(parsedRequest, { variables: [] }, attempt, options?.modeInfo);
1728 throw new Error(`Cannot handle request`);
1729 }
1731 if ((token.isCancellationRequested && !rawResult)) {
1732 return;
1733 > } else if (!request) { chatServiceImpl.ts
1734 // Silent slash command completed successfully — allow queued
1735 // requests to proceed.
1736 shouldProcessPending = !token.isCancellationRequested;
1737 return;
1738 > } else { chatServiceImpl.ts
1739 > if (!rawResult) {
1740 this.trace('sendRequest', `Provider returned no response for session ${model.sessionResource}`);
1741 rawResult = { errorDetails: { message: localize('emptyResponse', "Provider returned null response") } };
1742 }
1744 > const result = rawResult.errorDetails?.responseIsFiltered ? 'filtered' :
1745 > rawResult.errorDetails && gotProgress ? 'errorWithOutput' :
1746 > rawResult.errorDetails ? 'error' :
1747 > 'success';
1748 >
1749 > requestTelemetry.complete({
1750 > timeToFirstProgress: rawResult.timings?.firstProgress,
1751 > totalTime: rawResult.timings?.totalElapsed,
1752 > result,
1753 > requestType,
1754 > detectedAgent,
1755 > request,
1756 > });
1757 >
1758 > model.setResponse(request, rawResult);
1759 > completeResponseCreated();
1760 > this.trace('sendRequest', `Provider returned response for session ${model.sessionResource}`);
1761 >
1762 > if (rawResult.errorDetails?.isRateLimited) {
1763 this.chatEntitlementService.markAnonymousRateLimited();
1764 }
1766 > shouldProcessPending = !rawResult.errorDetails
1767 > && !token.isCancellationRequested
1768 && !request.response?.response.value.some(v => v.kind === 'confirmation' && !v.isUsed);
1769 > request.response?.complete(); chatServiceImpl.ts
1770 >
1771 > if (agentOrCommandFollowups) {
1772 > const completedRequest = request;
1773 > agentOrCommandFollowups.then(followups => {
1774 > model.setFollowups(completedRequest, followups);
1775 > const commandForTelemetry = agentSlashCommandPart ? agentSlashCommandPart.command.name : commandPart?.slashCommand.command;
1776 > this._chatServiceTelemetry.retrievedFollowups(agentPart?.agent.id ?? '', commandForTelemetry, followups?.length ?? 0);
1777 > });
1778 > }
1779 > }
1780 } catch (err) {
1781 this.logService.error(`Error while handling chat request: ${toErrorMessage(err, true)}`);
src/vs/workbench/contrib/chat/common/participants/chatAgents.ts 10 introduced LOC · 4 ranges

Open complete file

540 throw new Error(`No activated agent with id "${id}"`);
541 }
543 > this._onWillInvokeAgent.fire({ agentId: id, request });
544 > const result = await data.impl.invoke(request, progress, history, token);
545 > markChat(request.sessionResource, ChatPerfMark.AgentDidInvoke);
546 > return result;
547 }
548
561 return;
562 }
564 > data.impl.setYieldRequested?.(requestId, value);
565 }
566
567 async getFollowups(id: string, request: IChatAgentRequest, result: IChatAgentResult, history: IChatAgentHistoryEntry[], token: CancellationToken): Promise<IChatFollowup[]> {
568 > const data = this._agents.get(id); chatAgents.ts
569 > if (!data?.impl?.provideFollowups) {
570 return [];
571 }
572
573 return data.impl.provideFollowups(request, result, history, token);
574 > } chatAgents.ts
575
576 async getChatTitle(id: string, history: IChatAgentHistoryEntry[], token: CancellationToken): Promise<string | undefined> {
src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.ts 6 introduced LOC · 1 range

Open complete file

244
245 retrievedFollowups(agentId: string, command: string | undefined, numFollowups: number): void {
246 > this.telemetryService.publicLog2<ChatFollowupsRetrievedEvent, ChatFollowupsRetrievedClassification>('chatFollowupsRetrieved', { chatServiceTelemetry.ts
247 > agentId,
248 > command,
249 > numFollowups,
250 > });
251 > }
252 }
253
src/vs/workbench/contrib/chat/common/model/chatModel.ts 6 introduced LOC · 3 ranges

Open complete file

1610
1611 setFollowups(followups: IChatFollowup[] | undefined): void {
1612 > this._followups = followups; chatModel.ts
1613 > this._onDidChange.fire(defaultChatResponseModelChangeReason); // Fire so that command followups get rendered on the row
1614 > }
1615
1616 setVote(vote: ChatAgentVoteDirection): void {
3085
3086 setFollowups(request: ChatRequestModel, followups: IChatFollowup[] | undefined): void {
3087 > if (!request.response) { chatModel.ts
3088 // Maybe something went wrong?
3089 return;
3090 }
3091 > request.response.setFollowups(followups); chatModel.ts
3092 > }
3093
3094 setResponseModel(request: ChatRequestModel, response: ChatResponseModel): void {