agentService.ts ×11

Frontier kind: Code frontier

unlabeled · c_f9c2592683cc

4 tests · 49999 LOC · 290 files · introduces 0 tests · 61 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
20 ranges61 lines · 4 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5130 ranges49999 lines · 290 files · Browse complete extent
All tests (intent)
4 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: 61 introduced LOC across 20 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentService.ts 39 introduced LOC · 11 ranges

Open complete file

789 return s;
790 }
791 > try { agentService.ts
792 > // Batch the always-required keys (title / read / archive
793 > // flags) with any keys the changeset coordinator asks for
794 > // so the session DB is hit exactly once. The coordinator
795 > // returns `undefined` when a live source can already
796 > // answer the catalogue question, avoiding the
797 > // potentially-large persisted blobs entirely.
798 > const sessionStr = s.session.toString();
799 > const changesetKeys = this._changesetCoordinator.getListMetadataKeys(sessionStr);
800 > const metadataKeys: Record<string, true> = changesetKeys
801 > ? { customTitle: true, isRead: true, [AH_META_IS_ARCHIVED_DB_KEY]: true, [AH_META_IS_DONE_DB_KEY]: true, [AH_META_WORKSPACELESS_DB_KEY]: true, [PEER_CHAT_BACKING_METADATA_KEY]: true, [WORKTREE_META_REPOSITORY_ROOT]: true, ...GIT_DB_METADATA_KEYS, ...changesetKeys }
802 : { customTitle: true, isRead: true, [AH_META_IS_ARCHIVED_DB_KEY]: true, [AH_META_IS_DONE_DB_KEY]: true, [AH_META_WORKSPACELESS_DB_KEY]: true, [PEER_CHAT_BACKING_METADATA_KEY]: true, [WORKTREE_META_REPOSITORY_ROOT]: true, ...GIT_DB_METADATA_KEYS };
803 const m = await ref.object.getMetadataObject(metadataKeys);
804 > // This session is an internal peer-chat backing (e.g. a agentService.ts
805 > // Claude peer chat's SDK session, enumerated by the agent's
806 > // own `listSessions`). Drop it so it never leaks as a
807 > // standalone top-level session — mirrors the subagent filter
808 > // on the state-manager overlay path below.
809 > if (m[PEER_CHAT_BACKING_METADATA_KEY]) {
810 return undefined;
811 }
812 > let updated = s; agentService.ts
813 > if (m.customTitle) {
814 updated = { ...updated, summary: m.customTitle };
815 }
816 > if (m.isRead !== undefined) { agentService.ts
817 updated = { ...updated, isRead: m.isRead === 'true' };
818 }
819 > if (m[AH_META_IS_ARCHIVED_DB_KEY] !== undefined) { agentService.ts
820 updated = { ...updated, isArchived: m[AH_META_IS_ARCHIVED_DB_KEY] === 'true' };
821 > } else if (m[AH_META_IS_DONE_DB_KEY] !== undefined) { agentService.ts
822 updated = { ...updated, isArchived: m[AH_META_IS_DONE_DB_KEY] === 'true' };
823 }
824 > if (m[META_GIT_STATE]) { agentService.ts
825 try {
826 const gitState = JSON.parse(m[META_GIT_STATE]) as ISessionGitState;
830 }
831 }
832 > if (m[META_GITHUB_STATE]) { agentService.ts
833 try {
834 const gitHubState = JSON.parse(m[META_GITHUB_STATE]) as ISessionGitHubState;
838 }
839 }
841 > if (m[AH_META_WORKSPACELESS_DB_KEY] !== undefined) {
842 updated = { ...updated, _meta: withSessionWorkspaceless(updated._meta, m[AH_META_WORKSPACELESS_DB_KEY] === 'true') };
843 }
845 > // Worktree-isolated sessions run out of `<repo>.worktrees/<name>` but
846 > // must group under the repository in the sessions UI. Merge the repo
847 > // project persisted alongside the worktree metadata so a list refresh
848 > // doesn't revert the workspace name to the worktree directory. No-op
849 > // for folder sessions (key absent).
850 > const worktreeProject = worktreeProjectFromRepositoryRoot(m[WORKTREE_META_REPOSITORY_ROOT]);
851 > if (worktreeProject) {
852 updated = { ...updated, project: worktreeProject };
853 }
855 > return this._changesetCoordinator.decorateListEntry(updated, m as Record<string, string | undefined>);
856 > } finally {
857 > ref.dispose();
858 > }
859 } catch (e) {
860 this._logService.warn(`[AgentService] Failed to read session metadata overlay for ${s.session}`, e);
src/vs/platform/agentHost/node/agentHostChangesetService.ts 15 introduced LOC · 6 ranges

Open complete file

227
228 getListMetadataKeys(sessionUri: ProtocolURI): Record<string, true> | undefined {
229 > // Fast path: a live `summary.changes` (loaded session) or a ready live agentHostChangesetService.ts
230 > // `changeKind: 'session'` changeset state (registered but not-yet-
231 > // restored session) is authoritative, so the caller can skip loading
232 > // the potentially-large persisted diff blobs.
233 > const liveSummaryChanges = this._stateManager.getSessionSummary(sessionUri)?.changes;
234 > if (liveSummaryChanges) {
235 return undefined;
236 }
237 > const liveSession = this._stateManager.getChangesetState(buildSessionChangesetUri(sessionUri)); agentHostChangesetService.ts
238 > if (liveSession?.status === ChangesetStatus.Ready) {
239 return undefined;
240 }
241 > return CHANGESET_DB_METADATA_KEYS; agentHostChangesetService.ts
242 > }
243
244 computeListEntryChanges(sessionUri: ProtocolURI, metadata: Record<string, string | undefined>): ChangesSummary | undefined {
245 > // Loaded session: the caller has already projected agentHostChangesetService.ts
246 > // `state.summary.changes` onto the entry. Nothing to overlay.
247 > if (this._stateManager.getSessionState(sessionUri)) {
248 return undefined;
249 }
276 const branchRaw = metadata[META_CHANGESET_BRANCH];
277 const legacyRaw = metadata[META_LEGACY_DIFFS];
278 > if (branchRaw === undefined && legacyRaw === undefined) { agentHostChangesetService.ts
279 return undefined;
280 }
293
294 return undefined;
296
297 isStaticChangesetComputeActive(changesetUri: ProtocolURI): boolean {
src/vs/platform/agentHost/node/agentHostChangesetCoordinator.ts 5 introduced LOC · 2 ranges

Open complete file

303 */
304 getListMetadataKeys(sessionStr: string): Record<string, true> | undefined {
305 > return this._changesets.getListMetadataKeys(sessionStr); agentHostChangesetCoordinator.ts
306 > }
307
308 /**
313 */
314 decorateListEntry(entry: IAgentSessionMetadata, metadata: IChangesetSessionMetadata): IAgentSessionMetadata {
315 > const changes = this._changesets.computeListEntryChanges(entry.session.toString(), metadata); agentHostChangesetCoordinator.ts
316 > return changes ? { ...entry, changes } : entry;
317 > }
318
319 // ---- Git state events -------------------------------------------------
src/vs/platform/agentHost/node/shared/worktreeIsolation.ts 2 introduced LOC · 1 range

Open complete file

812 */
813 export function worktreeProjectFromRepositoryRoot(repositoryRootRaw: string | undefined): IAgentSessionProjectInfo | undefined {
814 > return repositoryRootRaw ? projectFromRepositoryRoot(URI.parse(repositoryRootRaw)) : undefined; worktreeIsolation.ts
815 > }
816
817 function errorMessage(error: unknown): string {