agentService.ts ×4

Frontier kind: Code frontier

unlabeled · c_a5f81c3b58dd

11 tests · 49893 LOC · 290 files · introduces 0 tests · 47 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges47 lines · 2 files
Tests
0 tests

Contains — complete concept membership

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

src/vs/platform/agentHost/node/agentService.ts 43 introduced LOC · 4 ranges

Open complete file

776
777 async listSessions(): Promise<IAgentSessionMetadata[]> {
778 > this._logService.trace('[AgentService] listSessions called'); agentService.ts
779 > const results = await Promise.all(
780 > [...this._providers.values()].map(p => p.listSessions())
781 > );
782 > const flat = results.flat();
783 >
784 > // Overlay persisted custom titles from per-session databases.
785 > const overlaid = await Promise.all(flat.map(async (s): Promise<IAgentSessionMetadata | undefined> => {
786 try {
787 const ref = await this._sessionDataService.tryOpenDatabase(s.session);
861 }
862 return s;
863 > })); agentService.ts
864 > const result = overlaid.filter((s): s is IAgentSessionMetadata => s !== undefined);
865 >
866 > // Overlay live session state from the state manager.
867 > // For the title, prefer the state manager's value when it is
868 > // non-empty, so SDK-sourced titles are not overwritten by the
869 > // initial empty placeholder. The default changeset catalogue lives
870 > // on `state.changesets` (seeded after `createSession` /
871 > // `restoreSession` and refreshed after each compute pass) and the
872 > // chip aggregate on the catalog summary's `changes`; both must be
873 > // surfaced here so a fresh `listSessions` call returns the same values
874 > // subscribers see via the per-session action stream and
875 > // `notify/sessionSummaryChanged`.
876 > const withStatus = result.map(s => {
877 const liveSummary = this._stateManager.getSessionSummary(s.session.toString());
878 if (liveSummary) {
905 }
906 return s;
907 > }); agentService.ts
908 >
909 > // Overlay any session known to state but missing from the providers'
910 > // `listSessions` snapshot, so renderer-side caches don't evict a
911 > // live/active session (which would close the chat view holding the
912 > // in-flight response bubble). Two cases need this: a provider can
913 > // transiently drop a session (e.g. `CopilotAgent.listSessions` returns
914 > // an empty array right after `session/turnComplete`), and a provisional
915 > // session (created but not yet materialized — see `createSession`) that
916 > // has had any turn activity must stay visible until it materializes.
917 > // Idle provisional sessions are deliberately *not* overlaid so the
918 > // new-session composer's eagerly-created session doesn't leak into the
919 > // list before its first message (#321269).
920 > const known = new Set(withStatus.map(s => s.session.toString()));
921 > const additions: IAgentSessionMetadata[] = [];
922 > for (const summary of this._stateManager.getOverlaySessionSummaries()) {
923 if (known.has(summary.resource)) {
924 continue;
950 });
951 }
952 > const combined = additions.length > 0 ? [...withStatus, ...additions] : withStatus; agentService.ts
953 >
954 > this._logService.trace(`[AgentService] listSessions returned ${combined.length} sessions (${additions.length} state-manager fallback)`);
955 > return combined;
956 > }
957
958 async createSession(config?: IAgentCreateSessionConfig): Promise<URI> {
src/vs/platform/agentHost/node/agentHostStateManager.ts 4 introduced LOC · 2 ranges

Open complete file

429 */
430 getOverlaySessionSummaries(): SessionSummary[] {
431 > const summaries: SessionSummary[] = []; agentHostStateManager.ts
432 > for (const [key, entry] of this._sessionStates) {
433 // Turn activity lives on the session's default chat after the
434 // multi-chat protocol move, so consult that chat's turns/activeTurn.
439 summaries.push(this._toSummary(key, entry));
440 }
441 > return summaries; agentHostStateManager.ts
442 > }
443
444 /**