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 { Disposable, IDisposable } from '../../../base/common/lifecycle.js';
7
>
import { IFileService } from '../../files/common/files.js';
8
>
import { InMemoryFileSystemProvider } from '../../files/common/inMemoryFilesystemProvider.js';
9
>
import { InstantiationType, registerSingleton } from '../../instantiation/common/extensions.js';
10
>
import { createDecorator } from '../../instantiation/common/instantiation.js';
11
>
import { ILabelService } from '../../label/common/label.js';
12
>
import { AgentHostFileSystemProvider, type IRemoteFilesystemConnection } from './agentHostFileSystemProvider.js';
13
>
import { AGENT_HOST_LABEL_FORMATTER, AGENT_HOST_SCHEME } from './agentHostUri.js';
14
>
15
>
export type { IRemoteFilesystemConnection } from './agentHostFileSystemProvider.js';
16
>
17
>
/**
18
>
* Scheme used for the in-memory plugin filesystem backing synced customizations.
19
>
*
20
>
* URIs under this scheme are served by a registered {@link InMemoryFileSystemProvider}
21
>
* and are reachable by the agent host via `fetchContent`.
22
>
*/
23
>
export const SYNCED_CUSTOMIZATION_SCHEME = 'vscode-synced-customization';
24
>
25
>
export const IAgentHostFileSystemService = createDecorator<IAgentHostFileSystemService>('agentHostFileSystemService');
26
>
27
>
export interface IAgentHostFileSystemService {
28
>
readonly _serviceBrand: undefined;
29
>
30
>
/**
31
>
* Register a mapping from a URI authority to a connection so that
32
>
* `vscode-agent-host://[authority]/…` URIs resolve through this connection.
33
>
*/
34
>
registerAuthority(authority: string, connection: IRemoteFilesystemConnection): IDisposable;
35
>
36
>
/**
37
>
* Ensures the in-memory filesystem provider for synced customizations
38
>
* (`vscode-synced-customization:` scheme) is registered. Safe to call
39
>
* multiple times — only the first call registers the provider.
40
>
*/
41
>
ensureSyncedCustomizationProvider(): void;
42
>
}
43
>
44
>
class AgentHostFileSystemService extends Disposable implements IAgentHostFileSystemService {
45
>
declare readonly _serviceBrand: undefined;
46
>
47
>
private readonly _fsProvider: AgentHostFileSystemProvider;
48
>
private _syncedCustomizationProviderRegistered = false;
49
>
50
>
constructor(
51
@IFileService private readonly _fileService: IFileService,
52
@ILabelService labelService: ILabelService,