chatServiceImpl.ts ×11

Frontier kind: Code frontier

unlabeled · c_bc361c11f7cd

7 tests · 71644 LOC · 309 files · introduces 0 tests · 39 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges39 lines · 1 files
Tests
0 tests

Contains — complete concept membership

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

src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts 39 introduced LOC · 11 ranges

Open complete file

903 const hasProgressStreaming = providedSession.progressObs && providedSession.interruptActiveResponseCallback;
904 if (hasProgressStreaming) {
905 > let lastProgressLength = 0; chatServiceImpl.ts
906 >
907 > const cancellationListener = disposables.add(new MutableDisposable());
908 > const createCancellationListener = (token: CancellationToken) => {
909 return token.onCancellationRequested(() => {
910 providedSession.interruptActiveResponseCallback?.().then(userConfirmedInterruption => {
915 });
916 };
918 > const trackNewCancellableRequest = () => {
919 const cancellableRequest = this.instantiationService.createInstance(CancellableRequest, new CancellationTokenSource(), undefined, undefined, undefined);
920 this._syntheticPendingRequests.add(cancellableRequest);
923 cancellationListener.value = createCancellationListener(cancellableRequest.cancellationTokenSource.token);
924 };
926 > const ensureCancellationTracking = () => {
927 if (!this._pendingRequests.has(model.sessionResource)) {
928 trackNewCancellableRequest();
929 }
930 };
932 > if (lastRequest && !providedSession.isCompleteObs?.get()) {
933 trackNewCancellableRequest();
934 }
936 > // Handle server-initiated requests (e.g. consumed queued messages).
937 > if (providedSession.onDidStartServerRequest) {
938 disposables.add(providedSession.onDidStartServerRequest(({ prompt, variableData, timestamp, isSystemInitiated, systemInitiatedLabel, isTerminalRequest }) => {
939 // Complete any in-flight request
972 }));
973 }
975 > // Mid-turn steering for streamed sessions: dispatch a queued Steering message immediately
976 > // (the provider POSTs it server-side) rather than waiting for the turn to complete, but only
977 > // when the in-flight request is the synthetic streamed-turn tracker (or none), never a real
978 > // request. Server-managed (agent-host) queues are drained by the server, so they're excluded.
979 > if (!this._isServerManagedQueue(model.sessionResource)) {
980 > let dispatchingImmediateSteer = false;
981 > const canImmediatelyDispatch = () => {
982 if (!model.getPendingRequests().some(r => r.kind === ChatRequestQueueKind.Steering)) {
983 return false;
986 return !pending || this._syntheticPendingRequests.has(pending);
987 };
988 > disposables.add(model.onDidChangePendingRequests(() => { chatServiceImpl.ts
989 if (dispatchingImmediateSteer || !canImmediatelyDispatch()) {
990 return;
1009 });
1010 });
1011 > })); chatServiceImpl.ts
1012 > }
1013 >
1014 > // Single autorun that streams progress for whichever request is current.
1015 > disposables.add(autorun(reader => {
1016 > const progressArray = providedSession.progressObs?.read(reader) ?? [];
1017 > const isComplete = providedSession.isCompleteObs?.read(reader) ?? false;
1018 >
1019 > // Backstop: keep the streamed turn tracked as in-progress across immediate-steer dispatches.
1020 > if (!isComplete) {
1021 ensureCancellationTracking();
1022 }
1024 > // Process only new progress items
1025 > if (lastRequest && progressArray.length > lastProgressLength) {
1026 const newProgress = progressArray.slice(lastProgressLength);
1027 for (const progress of newProgress) {
1030 lastProgressLength = progressArray.length;
1031 }
1033 > // Handle completion
1034 > if (isComplete && lastRequest) {
1035 this._pendingRequests.deleteAndDispose(model.sessionResource);
1036 cancellationListener.clear();
1039 this.processPendingRequests(model.sessionResource);
1040 }
1041 > })); chatServiceImpl.ts
1042 } else {
1043 if (providedSession.isCompleteObs?.get()) {