chatDebugServiceImpl.ts ×25

Frontier kind: Code frontier

unlabeled · c_25d674e56304

109 tests · 10927 LOC · 49 files · introduces 0 tests · 74 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
25 ranges74 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1371 ranges10927 lines · 49 files · Browse complete extent
All tests (intent)
109 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: 74 introduced LOC across 25 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.ts 74 introduced LOC · 25 ranges

Open complete file

144
145 constructor(
146 > @IConfigurationService private readonly _configurationService: IConfigurationService, chatDebugServiceImpl.ts
147 > ) {
148 > super();
149 > }
150
151 /** Priority for deduplicating events with the same ID: lower = richer. */
166 'claude-code', // Claude Code CLI sessions
167 ]);
169 > private _isDebugEligibleSession(sessionResource: URI): boolean {
170 const sessionType = getChatSessionType(sessionResource);
171 return ChatDebugServiceImpl._debugEligibleSessionTypes.has(sessionType)
175 || this._importedSessions.has(sessionResource);
176 }
178 > /**
179 > * The in-memory event capacity for a session. Agent host (Copilot CLI)
180 > * sessions honor a dedicated, configurable cap so their (potentially large)
181 > * on-disk logs can be surfaced without changing the local-session default;
182 > * all other sessions use {@link ChatDebugServiceImpl.MAX_EVENTS_PER_SESSION}.
183 > */
184 > private _capacityForSession(sessionResource: URI): number {
185 if (!isAgentHostTarget(getChatSessionType(sessionResource))) {
186 return ChatDebugServiceImpl.MAX_EVENTS_PER_SESSION;
192 return ChatDebugServiceImpl.MAX_EVENTS_PER_SESSION;
193 }
195 > log(sessionResource: URI, name: string, details?: string, level: ChatDebugLogLevel = ChatDebugLogLevel.Info, options?: { id?: string; category?: string; parentEventId?: string }): void {
196 if (!this._isDebugEligibleSession(sessionResource)) {
197 return;
209 });
210 }
212 > addEvent(event: IChatDebugEvent): void {
213 // Resolve the session's buffer (if any) once, and its capacity. New
214 // events during streaming target an existing buffer, so we reuse its
272 this._onDidAddEvent.fire(event);
273 }
275 > addProviderEvent(event: IChatDebugEvent): void {
276 // If a re-invocation is pending for this session, clear the previously
277 // loaded provider events now that fresh data has actually arrived. This
285 this.addEvent(event);
286 }
288 > getEvents(sessionResource?: URI): readonly IChatDebugEvent[] {
289 if (sessionResource) {
290 const buffer = this._sessionBuffers.get(sessionResource);
315 return result;
316 }
318 > private _isSorted(events: IChatDebugEvent[]): boolean {
319 for (let i = 1; i < events.length; i++) {
320 if (events[i].created.getTime() < events[i - 1].created.getTime()) {
324 return true;
325 }
327 > private _deduplicateEvents(events: IChatDebugEvent[]): IChatDebugEvent[] {
328 const seen = new Map<string, number>(); // id → index in result
329 const priority = ChatDebugServiceImpl._eventKindPriority;
347 return result;
348 }
350 > getSessionResources(): readonly URI[] {
351 return [...this._sessionOrder];
352 }
354 > clear(): void {
355 > this._sessionBuffers.clear();
356 > this._sessionOrder.length = 0;
357 > this._seenEventIds.clear();
358 > this._importedSessions.clear();
359 > this._importedSessionTitles.clear();
360 > this._availableSessionResources.length = 0;
361 > this._availableSessionResourceSet.clear();
362 > this._historicalSessionTitles.clear();
363 > }
364 >
365 > /** Remove all ancillary state for an evicted session. */
366 > private _evictSession(sessionResource: URI): void {
367 this._sessionBuffers.delete(sessionResource);
368 this._seenEventIds.delete(sessionResource);
376 }
377 }
379 > registerProvider(provider: IChatDebugLogProvider): IDisposable {
380 this._providers.add(provider);
381
393 });
394 }
396 > hasInvokedProviders(sessionResource: URI): boolean {
397 return this._invocationCts.has(sessionResource);
398 }
400 > async invokeProviders(sessionResource: URI): Promise<void> {
401
402 if (!this._isDebugEligibleSession(sessionResource)) {
434 // or when the service is disposed.
435 }
437 > private async _invokeProvider(provider: IChatDebugLogProvider, sessionResource: URI, token: CancellationToken): Promise<void> {
438 try {
439 const events = await provider.provideChatDebugLog(sessionResource, token);
460 }
461 }
463 > endSession(sessionResource: URI): void {
464 const cts = this._invocationCts.get(sessionResource);
465 if (cts) {
470 this._onDidEndSession.fire(sessionResource);
471 }
473 > private _clearProviderEvents(sessionResource: URI): void {
474 const buffer = this._sessionBuffers.get(sessionResource);
475 if (buffer) {
487 this._onDidClearProviderEvents.fire(sessionResource);
488 }
490 > async resolveEvent(eventId: string): Promise<IChatDebugResolvedEventContent | undefined> {
491 for (const provider of this._providers) {
492 if (provider.resolveChatDebugLogEvent) {
503 return undefined;
504 }
506 > isCoreEvent(event: IChatDebugEvent): boolean {
507 return !this._providerEvents.has(event);
508 }
510 > setImportedSessionTitle(sessionResource: URI, title: string): void {
511 this._importedSessionTitles.set(sessionResource, title);
512 }
514 > getImportedSessionTitle(sessionResource: URI): string | undefined {
515 return this._importedSessionTitles.get(sessionResource);
516 }
518 > addAvailableSessionResources(resources: readonly { uri: URI; title?: string }[]): void {
519 let added = false;
520 for (const { uri, title } of resources) {
533 }
534 }
536 > /** Lazy fetchers for available sessions from providers. Each is invoked at most once. */
537 > private readonly _availableSessionsFetchers = new Set<{ readonly fetcher: (token: CancellationToken) => Promise<{ uri: URI; title?: string }[]>; started: boolean }>();
538 > private _availableSessionsRequested = false;
539
540 getAvailableSessionResources(): readonly URI[] {
618
619 override dispose(): void {
620 > for (const cts of this._invocationCts.values()) { chatDebugServiceImpl.ts
621 cts.cancel();
622 cts.dispose();
623 }
624 > this._invocationCts.clear(); chatDebugServiceImpl.ts
625 > this.clear();
626 > this._providers.clear();
627 > super.dispose();
628 > }
629 }