chatServiceImpl.ts ×5

Frontier kind: Code frontier

unlabeled · c_c014bae3b7dc

8 tests · 71326 LOC · 309 files · introduces 0 tests · 31 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges31 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
6006 ranges71326 lines · 309 files · Browse complete extent
All tests (intent)
8 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: 31 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts 27 introduced LOC · 5 ranges

Open complete file

1159 const materialized = await this._materializeUntitledSession(sessionResource, request, options, model);
1160 if (materialized) {
1161 > model = materialized.model; chatServiceImpl.ts
1162 > sessionResource = materialized.sessionResource;
1163 > newSessionResource = materialized.newSessionResource;
1164 > }
1165 }
1166 if (model.isReadOnly.get()) {
1272
1273 const newItem = await this.chatSessionService.createNewChatSessionItem(getChatSessionType(untitledResource), { prompt: requestText, command: commandPart?.text, initialSessionOptions, untitledResource }, CancellationToken.None);
1274 > if (!newItem) { chatServiceImpl.ts
1275 materialized.complete(undefined);
1276 return undefined;
1277 }
1279 > // Register the inverse alias before loading so session-option lookups
1280 > // for the new resource resolve to the untitled session's options.
1281 > this.chatSessionService.registerSessionResourceAlias(untitledResource, newItem.resource);
1282 >
1283 > // Do not dispose tempRef as per 6bc5ae80de9caffb21e9eb58e18b5ca24fa2d6e8
1284 > const tempRef = await this.loadRemoteSession(newItem.resource, untitledModel.initialLocation, CancellationToken.None);
1285 > const realModel = tempRef?.object as ChatModel | undefined;
1286 if (!realModel) {
1287 throw new Error(`Failed to load session for resource: ${newItem.resource}`);
1288 }
1290 > // Update the new model's contributed session with initialSessionOptions
1291 > // so that the agent receives them when invoked.
1292 > if (initialSessionOptions) {
1293 this.chatSessionService.updateSessionOptions(realModel.sessionResource, initialSessionOptions);
1294 }
1296 > // Publish the forward mapping only after a successful load (see
1297 > // `setMaterializedSessionResource`).
1298 > this.chatSessionService.setMaterializedSessionResource(untitledResource, newItem.resource);
1299 > materialized.complete(newItem.resource);
1300 > // If this ever logs twice for the
1301 > // same untitled resource (different real resources), a single send
1302 > // produced duplicate sessions.
1303 > this.info('materializeUntitledSession', `Materialized untitled session ${untitledResource.toString()} into real session ${newItem.resource.toString()}`);
1304 > return { model: realModel, sessionResource: newItem.resource, newSessionResource: newItem.resource };
1305 } catch (err) {
1306 // Resolve (not reject) so a concurrent waiter degrades to the normal
src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts 4 introduced LOC · 2 ranges

Open complete file

308
309 registerSessionResourceAlias(untitledResource: URI, realResource: URI): void {
310 > this._resourceAliases.set(realResource, untitledResource); mockChatSessionsService.ts
311 > }
312
313 setMaterializedSessionResource(untitledResource: URI, realResource: URI): void {
314 > this._realResources.set(untitledResource, realResource); mockChatSessionsService.ts
315 > }
316
317 getMaterializedSessionResource(untitledResource: URI): URI | undefined {