protocolServerHandler.ts ×12

Frontier kind: Code frontier

unlabeled · c_6d5f866ef5f9

72 tests · 28450 LOC · 148 files · introduces 0 tests · 63 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges63 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2679 ranges28450 lines · 148 files · Browse complete extent
All tests (intent)
72 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: 63 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/protocolServerHandler.ts 63 introduced LOC · 12 ranges

Open complete file

555 );
556 }
558 > const client: IConnectedClient = {
559 > clientId: params.clientId,
560 > protocolVersion: negotiated,
561 > transport,
562 > subscriptions: new Map(),
563 > disposables,
564 > };
565 > this._attachConnection(params.clientId, client);
566 >
567 > this._registerClientFileSystemAuthority(params.clientId, disposables);
568 >
569 >
570 > const snapshots: IStateSnapshot[] = [];
571 > if (params.initialSubscriptions) {
572 for (const uri of params.initialSubscriptions) {
573 const snapshot = this._addInitialSubscription(client, uri.toString());
577 }
578 }
580 > return {
581 > client,
582 > response: {
583 > protocolVersion: negotiated,
584 > serverSeq: this._stateManager.serverSeq,
585 > snapshots,
586 > defaultDirectory: this._config.defaultDirectory,
587 > completionTriggerCharacters: this._config.completionTriggerCharacters,
588 > terminalCommandPrefix: this._config.terminalCommandPrefix,
589 telemetry: this._config.otlpLogEmitter ? { logs: OTLP_LOGS_CHANNEL_TEMPLATE } : undefined,
590 },
702 */
703 private _registerClientFileSystemAuthority(clientId: string, disposables: DisposableStore): void {
704 > disposables.add(this._clientFileSystemProvider.registerAuthority(clientId, { protocolServerHandler.ts
705 > resourceList: (uri) => this._sendReverseRequest(clientId, 'resourceList', { uri: uri.toString() }),
706 > resourceRead: (uri) => this._sendReverseRequest(clientId, 'resourceRead', { uri: uri.toString() }),
707 > resourceWrite: (params_) => this._sendReverseRequest(clientId, 'resourceWrite', params_),
708 > resourceCopy: (params_) => this._sendReverseRequest(clientId, 'resourceCopy', params_),
709 > resourceDelete: (params_) => this._sendReverseRequest(clientId, 'resourceDelete', params_),
710 > resourceMove: (params_) => this._sendReverseRequest(clientId, 'resourceMove', params_),
711 > resourceRequest: (params_) => this._sendReverseRequest(clientId, 'resourceRequest', params_),
712 > resourceResolve: (params_) => this._sendReverseRequest(clientId, 'resourceResolve', params_),
713 > resourceMkdir: (params_) => this._sendReverseRequest(clientId, 'resourceMkdir', params_),
714 > }));
715 > }
716
717 /**
964 */
965 private _attachConnection(clientId: string, client: IConnectedClient): void {
966 > const existing = this._clients.get(clientId); protocolServerHandler.ts
967 > if (existing?.state === 'active') {
968 existing.connections.push(client);
969 > } else { protocolServerHandler.ts
970 > existing?.disconnectTimeouts.dispose();
971 > this._clients.set(clientId, { state: 'active', connections: [client] });
972 > }
973 > this._pruneClientRecords();
974 > this._onDidChangeConnectionCount.fire(this._connectedClientCount);
975 > }
976
977 /**
1033 /** Number of clients that currently have a live connection. */
1034 private get _connectedClientCount(): number {
1035 > let count = 0; protocolServerHandler.ts
1036 > for (const record of this._clients.values()) {
1037 > if (record.state === 'active') {
1038 > count++;
1039 > }
1040 > }
1041 > return count;
1042 > }
1043
1044 /**
1052 */
1053 private _pruneClientRecords(): void {
1054 > const cutoff = Date.now() - CLIENT_TOOL_CALL_DISCONNECT_TIMEOUT * 10; protocolServerHandler.ts
1055 > for (const [clientId, record] of this._clients) {
1056 > if (record.state === 'grace'
1057 && record.disconnectTimeouts.size === 0
1058 > && record.lastSeenAt < cutoff) { protocolServerHandler.ts
1059 this._clients.delete(clientId);
1060 }
1062 > }
1063
1064 private _clearClientToolCallDisconnectTimeout(clientId: string, channel: string): void {
1612 override dispose(): void {
1613 for (const record of this._clients.values()) {
1614 > if (record.state === 'active') { protocolServerHandler.ts
1615 for (const connection of [...record.connections]) {
1616 connection.disposables.dispose();
1617 }
1618 > } else { protocolServerHandler.ts
1619 record.disconnectTimeouts.dispose();
1620 }
1622 this._clients.clear();
1623 for (const [, pending] of this._pendingReverseRequests) {