import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { FileType, IFileChange, IFileDeleteOptions, IFileOverwriteOptions, IFileSystemProvider, IFileWriteOptions, IStat } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files"; import { type ResourceDeleteParams, type ResourceDeleteResult, type ResourceListResult, type ResourceMoveParams, type ResourceMoveResult, type ResourceReadResult, type ResourceRequestParams, type ResourceRequestResult, type ResourceWriteParams, type ResourceWriteResult } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/commands"; /** * Interface for performing resource operations on a remote endpoint. * * Both {@link IAgentConnection} (client→server) and client-exposed * filesystems (server→client) satisfy this contract. */ export interface IRemoteFilesystemConnection { resourceList(uri: URI): Promise; resourceRead(uri: URI): Promise; resourceWrite(params: ResourceWriteParams): Promise; resourceDelete(params: ResourceDeleteParams): Promise; resourceMove(params: ResourceMoveParams): Promise; /** * Negotiate access to a resource the receiver mediates. Optional because * not every connection in the codebase carries one — only the agent-host * server-to-client direction needs to send `resourceRequest` today. */ resourceRequest?(params: ResourceRequestParams): Promise; } /** * Build a {@link AGENT_HOST_SCHEME} URI for a given connection authority * and remote path. Assumes the remote path is a `file://` resource. */ export declare function agentHostUri(authority: string, path: string): URI; /** * Extract the remote filesystem path from a {@link AGENT_HOST_SCHEME} URI. */ export declare function agentHostRemotePath(uri: URI): string; /** * {@link IFileSystemProvider} that proxies filesystem operations * through a {@link IRemoteFilesystemConnection}. * * URIs encode the original scheme and authority in the path so any remote * resource can be represented. Subclasses provide the URI decode function * and scheme-specific helpers. * * Individual connections are identified by the URI's authority component. */ export declare abstract class AHPFileSystemProvider extends Disposable implements IFileSystemProvider { readonly capabilities: number; private readonly _onDidChangeCapabilities; readonly onDidChangeCapabilities: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; private readonly _onDidChangeFile; readonly onDidChangeFile: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; private readonly _authorityToConnection; /** * Register a mapping from a URI authority to a connection. * Returns a disposable that unregisters the mapping. */ registerAuthority(authority: string, connection: IRemoteFilesystemConnection): IDisposable; /** Decode a provider URI back to the original URI for the remote endpoint. */ protected abstract _decodeUri(resource: URI): URI; watch(): IDisposable; stat(resource: URI): Promise; readdir(resource: URI): Promise<[ string, FileType ][]>; readFile(resource: URI): Promise; writeFile(resource: URI, content: Uint8Array, _opts: IFileWriteOptions): Promise; mkdir(): Promise; delete(resource: URI, opts: IFileDeleteOptions): Promise; rename(from: URI, to: URI, opts: IFileOverwriteOptions): Promise; /** * Negotiate access to {@link resource} with the receiver, asking for the * granted modes in {@link opts}. Used after a `NoPermissions` failure to * prompt the receiver to grant access; the caller can then retry. * * Resolves on success. Rejects if the receiver denies, the connection * is missing, or the connection doesn't implement `resourceRequest`. */ requestResourceAccess(resource: URI, opts: { readonly read?: boolean; readonly write?: boolean; }): Promise; private _getConnection; /** * Translate a thrown error from a {@link IRemoteFilesystemConnection} * into a {@link FileSystemProviderError}. Preserves `PermissionDenied` * (-32009) as `NoPermissions` so callers can distinguish a * permission failure from `NotFound` and decide whether to negotiate * via {@link requestResourceAccess}. */ private _mapError; private _listDirectory; } /** * Filesystem provider for accessing agent host files from the * client side. Registered under the `vscode-agent-host` scheme. * * ``` * vscode-agent-host://[connectionAuthority]/[originalScheme]/[originalAuthority]/[originalPath] * ``` */ export declare class AgentHostFileSystemProvider extends AHPFileSystemProvider { protected _decodeUri(resource: URI): URI; }