agentService.ts ×7

Frontier kind: Code frontier

unlabeled · c_2c61b9cacdfa

14 tests · 50845 LOC · 304 files · introduces 0 tests · 24 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges24 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5190 ranges50845 lines · 304 files · Browse complete extent
All tests (intent)
14 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: 24 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentService.ts 24 introduced LOC · 7 ranges

Open complete file

1811
1812 async subscribe(resource: URI, clientId: string): Promise<IStateSnapshot> {
1813 > this._logService.trace(`[AgentService] subscribe: ${resource.toString()}`); agentService.ts
1814 > const resourceStr = resource.toString();
1815 > // Register the subscriber up front so a concurrent unsubscribe cannot
1816 > // evict the session state while we are awaiting restore. On any failure
1817 > // path below we must roll the registration back, otherwise the leaked
1818 > // refcount would permanently pin (or block eviction of) the resource.
1819 > // {@link addSubscriber} is the single point that triggers the
1820 > // uncommitted-changeset refresh on the 0→1 transition (covers both
1821 > // the cold-snapshot path here and the handshake fast-path used by
1822 > // {@link ProtocolServerHandler} when state is already cached).
1823 > this.addSubscriber(resource, clientId);
1824 > try {
1825 > // Check for terminal state
1826 > const terminalState = this._terminalManager.getTerminalState(resourceStr);
1827 > if (terminalState) {
1828 return { resource: resourceStr, state: terminalState, fromSeq: this._stateManager.serverSeq };
1829 }
1831 > let snapshot = this._stateManager.getSnapshot(resourceStr);
1832 > const parsedChangeset = parseChangesetUri(resourceStr);
1833 > if (snapshot && parsedChangeset && !this._stateManager.getSessionState(parsedChangeset.sessionUri)) {
1834 await this._changesetCoordinator.restoreSessionIfChangesetSubscription(resource, s => this.restoreSession(s));
1835 snapshot = this._stateManager.getSnapshot(resourceStr);
1836 }
1837 > if (!snapshot) { agentService.ts
1838 // Chat channel URIs carry their owning session URI. The chat
1839 // snapshot only materializes once that session is restored
1856 }
1857 }
1858 > if (!snapshot) { agentService.ts
1859 if (isSubagentChatUri(resource)) {
1860 // May be mid-registration; wait rather than fail immediately.
1891 // the normal state-update stream.
1892 const sessionState = this._stateManager.getSessionState(resourceStr);
1893 > if (!isAhpChatChannel(resourceStr) && sessionState && readSessionGitState(sessionState._meta) === undefined) { agentService.ts
1894 const workingDirectory = sessionState.workingDirectories?.[0]
1895 ? URI.parse(sessionState.workingDirectories[0])
1899
1900 return snapshot;
1901 > } catch (err) { agentService.ts
1902 this.unsubscribe(resource, clientId);
1903 throw err;
1904 }
1905 > } agentService.ts
1906
1907 /** Waits for an armed subagent chat to register (or its wait to time out); returns `undefined` if not armed or never registered. */