sessionPluginBundler.ts ×6

Frontier kind: Code frontier

unlabeled · c_f442aec93991

34 tests · 50508 LOC · 299 files · introduces 0 tests · 70 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges70 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4680 ranges50508 lines · 299 files · Browse complete extent
All tests (intent)
34 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: 70 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/sessionPluginBundler.ts 70 introduced LOC · 6 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- sessionPluginBundler.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { VSBuffer } from '../../../../base/common/buffer.js';
7 > import { CancellationToken } from '../../../../base/common/cancellation.js';
8 > import { hash } from '../../../../base/common/hash.js';
9 > import { Disposable } from '../../../../base/common/lifecycle.js';
10 > import { basename, dirname } from '../../../../base/common/resources.js';
11 > import { URI } from '../../../../base/common/uri.js';
12 > import { IFileService } from '../../../files/common/files.js';
13 > import { IAgentPluginManager } from '../../common/agentPluginManager.js';
14 > import { customizationId, type ClientPluginCustomization } from '../../common/state/sessionState.js';
15 > import { CustomizationType, type URI as ProtocolURI } from '../../common/state/protocol/state.js';
16 > import { DiscoveredType, type IDiscoveredDirectory } from '../copilot/sessionCustomizationDiscovery.js';
17 >
18 > const DISPLAY_NAME = 'VS Code Synced Data';
19 > const HOST_DISCOVERY_DIR = 'host-discovery';
20 >
21 > const MANIFEST_CONTENT = JSON.stringify({
22 > name: DISPLAY_NAME,
23 > description: 'Customization data discovered from this workspace and your home directory',
24 > }, null, '\t');
25 >
26 > /**
27 > * Maps a {@link DiscoveredType} to the plugin sub-directory under which that
28 > * component type lives in the Open Plugin format.
29 > */
30 function pluginDirForType(type: DiscoveredType): string | undefined {
31 switch (type) {
37 }
38 }
40 > interface IBundleResult {
41 > readonly ref: ClientPluginCustomization;
42 > }
43 >
44 > /**
45 > * Bundles host-discovered customization files into an Open Plugin layout
46 > * on real disk under `<agentPluginManager.basePath>/host-discovery/<hash>/`.
47 > *
48 > * Writing to a real directory (rather than an in-memory provider) is
49 > * required because the Copilot SDK subprocess receives skill directories
50 > * and hook commands as on-disk paths via `fsPath`, and because the
51 > * workbench fetches files through the agent-host filesystem bridge —
52 > * neither of which can read a host-side in-memory FS.
53 > *
54 > * The directory is namespaced by a hash of the working directory so
55 > * concurrent sessions on different folders don't collide. Repeated
56 > * `bundle()` calls with identical content reuse the prior bundle (nonce
57 > * match) and skip the rewrite.
58 > */
59 > export class SessionPluginBundler extends Disposable {
60 >
61 > private readonly _rootUri: URI;
62 > private _lastNonce: string | undefined;
63 >
64 > constructor(
65 workingDirectory: URI,
66 @IFileService private readonly _fileService: IFileService,
71 this._rootUri = URI.joinPath(pluginManager.basePath, HOST_DISCOVERY_DIR, authority);
72 }
74 > get rootUri(): URI {
75 return this._rootUri;
76 }
78 > get lastNonce(): string | undefined {
79 return this._lastNonce;
80 }
82 > /**
83 > * Bundles the given files into the on-disk plugin directory.
84 > *
85 > * Overwrites any previous bundle for this working directory. Returns a
86 > * {@link ClientPluginCustomization} pointing at the on-disk plugin root
87 > * with a content-based nonce, or `undefined` when there are no files or
88 > * cancellation was requested.
89 > */
90 > async bundle(directories: readonly IDiscoveredDirectory[], token: CancellationToken = CancellationToken.None): Promise<IBundleResult | undefined> {
91 if (directories.length === 0 || token.isCancellationRequested) {
92 return undefined;