import { IDisposable } from "../../../base/common/lifecycle.js"; import { IObservable } from "../../../base/common/observable.js"; import { URI } from "../../../sessions/sessions.web.main.internal.js"; import { AgentHostResourceIdentity, IResourceListResult, IResourceReadResult, AgentHostPermissionMode, IPendingResourceRequest } from "./agentHostResourceService.js"; import { ResourceRequestParams } from "./state/protocol/commands.js"; import { ResourceWriteParams, ResourceDeleteParams, ResourceMoveParams, ResourceCopyParams, ResourceResolveParams, ResourceResolveResult, ResourceMkdirParams } from "./state/sessionProtocol.js"; export declare const IAgentHostResourceService: import("../../instantiation/common/instantiation.js").ServiceIdentifier; /** * Single owner of agent-host-facing filesystem operations and the * permission policy that gates them. Combines what were previously two * services (`IAgentHostPermissionService` + `IAgentHostVirtualResourceProvider`) * into one consistent interface used by both the in-process local channel * and the remote protocol client. * * Each FS method is gated by a permission check keyed on * {@link AgentHostResourceIdentity}: a normalized network host for remote * agent hosts, or {@link LOCAL_AGENT_HOST_RESOURCE_IDENTITY} for the local * utility-process host. * Denied operations throw {@link AgentHostResourcePermissionError} carrying * the {@link ResourceRequestParams} that, if granted, would unlock the * operation. * * Read operations transparently fall back to virtual content (untitled * documents, notebook cells, ...) when the local file service cannot * resolve the URI. */ export interface IAgentHostResourceService { readonly _serviceBrand: undefined; list(identity: AgentHostResourceIdentity, uri: URI): Promise; read(identity: AgentHostResourceIdentity, uri: URI): Promise; write(identity: AgentHostResourceIdentity, params: ResourceWriteParams): Promise; del(identity: AgentHostResourceIdentity, params: ResourceDeleteParams): Promise; move(identity: AgentHostResourceIdentity, params: ResourceMoveParams): Promise; copy(identity: AgentHostResourceIdentity, params: ResourceCopyParams): Promise; resolve(identity: AgentHostResourceIdentity, params: ResourceResolveParams): Promise; mkdir(identity: AgentHostResourceIdentity, params: ResourceMkdirParams): Promise; /** * Returns whether {@link uri} is already granted for {@link mode} on the * given identity. */ check(identity: AgentHostResourceIdentity, uri: URI, mode: AgentHostPermissionMode): Promise; /** * Handle an inbound `resourceRequest` from a host. Resolves once access * is granted (immediately, if already covered); rejects with a * `CancellationError` if the user denies or the connection closes. */ request(identity: AgentHostResourceIdentity, params: ResourceRequestParams): Promise; /** Per-address observable of pending requests for UI surfaces. */ pendingFor(address: string): IObservable; /** Observable of all pending requests across every address. */ readonly allPending: IObservable; /** * Find a pending request by id, across all addresses. Returns * `undefined` once the request has been resolved or rejected. */ findPending(id: string): IPendingResourceRequest | undefined; /** * Register an implicit read grant for {@link uri} (and descendants) on the * given identity. */ grantImplicitRead(identity: AgentHostResourceIdentity, uri: URI): IDisposable; /** Drops grants and pending requests owned by a closed connection. */ connectionClosed(identity: AgentHostResourceIdentity): void; }