import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service"; import { AgentHostPermissionMode, IPendingResourceRequest, IResourceListResult, IResourceReadResult } from "../../../../platform/agentHost/common/agentHostResourceService.js"; import { IAgentHostResourceService } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostResourceService.service"; import { ResourceCopyParams, ResourceDeleteParams, ResourceMkdirParams, ResourceMoveParams, ResourceRequestParams, ResourceResolveParams, ResourceResolveResult, ResourceWriteParams } from "@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/commands"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; /** * Default implementation of {@link IAgentHostResourceService} — the unified * owner of agent-host-facing filesystem operations and the permission * policy that gates them. Reads transparently fall back to * {@link ITextModelService} so virtual resources (untitled documents, * notebook cells, ...) work without the host having to know about them. * * Permission storage shape (in user settings): * * ```jsonc * "chat.agentHost.localFilePermissions": { * "localhost:3000": { * "file:///Users/me/.gitconfig": "r", * "file:///Users/me/.agentConfig": "rw" * }, * "local": { ... } * } * ``` * * - Keys are addresses normalized via {@link normalizeRemoteAgentHostAddress}, * with the in-process local agent host keyed under `'local'`. * - Values are URI strings → `r` | `rw`. Descendant URIs are covered by a * parent grant. */ export declare class AgentHostResourceService extends Disposable implements IAgentHostResourceService { private readonly _configurationService; private readonly _fileService; private readonly _textModelService; private readonly _logService; readonly _serviceBrand: undefined; private readonly _inMemoryGrants; private readonly _pending; readonly allPending: IObservable; constructor(_configurationService: IConfigurationService, _fileService: IFileService, _textModelService: ITextModelService, _logService: ILogService); list(address: string, uri: URI): Promise; read(address: string, uri: URI): Promise; write(address: string, params: ResourceWriteParams): Promise; del(address: string, params: ResourceDeleteParams): Promise; move(address: string, params: ResourceMoveParams): Promise; copy(address: string, params: ResourceCopyParams): Promise; resolve(address: string, params: ResourceResolveParams): Promise; mkdir(address: string, params: ResourceMkdirParams): Promise; check(address: string, uri: URI, mode: AgentHostPermissionMode): Promise; request(address: string, params: ResourceRequestParams): Promise; pendingFor(address: string): IObservable; findPending(id: string): IPendingResourceRequest | undefined; grantImplicitRead(address: string, uri: URI): IDisposable; connectionClosed(address: string): void; private _gate; private _readVirtual; /** * Write {@link bytes} as text into the resolved text model for {@link uri}, * if one can be resolved and is writable. Returns `true` when the model was * updated, `false` otherwise (no provider, readonly, decode failure). */ private _writeVirtual; /** * Resolve {@link uri} via {@link ITextModelService} and synthesize a * {@link ResourceResolveResult} so virtual resources stat as `File` with * a size matching their text content. Returns `undefined` if no model * can be resolved. */ private _statVirtual; /** * Resolve {@link uri} against the local filesystem, collapsing `..` * segments and following symlinks so the policy check sees the same * path the OS will actually open. For URIs that don't exist (e.g. a * `resourceWrite` for a new file), realpath the deepest existing * ancestor and re-append the leaf. */ private _canonicalize; private _isCovered; private _enqueue; private _resolve; private _dropPending; private _readPersistedGrants; private _persistGrant; private _inspectScopedSetting; }