import { CancellationToken } from "../../../base/common/cancellation.js"; import { URI, type Event } from "../../../sessions/sessions.web.main.internal.js"; import { AuthenticateParams } from "./agent.js"; import { ICloudSandboxPreparedReservation, ICloudSandboxSubmittedDraft, ICloudSandboxCreatedSession, type CloudSandboxConnectResult, type ICloudSandboxAuthenticationTarget, type ICloudSandboxConnectionRequest, type ICloudSandboxCreateSessionRequest, type ICloudSandboxDiscoveryOptions, type ICloudSandboxDiscoveryResult, type ICloudSandboxEnvironment, type ICloudSandboxIdentityToken, type ICloudSandboxModelCatalog, type ICloudSandboxPreparedAuthentication, type ICloudSandboxReservedSession, type ICloudSandboxReserveSessionRequest, type ICloudSandboxSealedToken, type ICloudSandboxSealTokenRequest, type ICloudSandboxSessionFeedConnection, type IMissionControlEnvironment, type ICloudSandboxConnectOptions } from "./cloudSandboxAgentHost.js"; import { IReplayedTaskHistory } from "./taskEventReplay.js"; export declare const ICloudSandboxDraftPreparationService: import("../../instantiation/common/instantiation.js").ServiceIdentifier; /** Owns draft reservations and confirmed submission identities independently of either chat UI. */ export interface ICloudSandboxDraftPreparationService { readonly _serviceBrand: undefined; /** Start at most one reservation for an eligible draft, without submitting its prompt or publishing a session. */ prepare(draftResource: URI, repoNwo?: string): void; /** Release unused preparation when the resolved repository changes, without starting or replacing it. */ updateRepository(draftResource: URI, repoNwo: string | undefined): void; /** Take preparation once for Send and wait for its receipt, not environment readiness. Missing or failed optional preparation returns undefined. */ take(draftResource: URI, token: CancellationToken): Promise; /** Get a confirmed submission for retry without claiming or creating another task. */ getSubmittedDraft(draftResource: URI): ICloudSandboxSubmittedDraft | undefined; /** Retain the confirmed response for a handed-off reservation; this never restores deletion ownership. */ markSubmitted(reservation: ICloudSandboxPreparedReservation, created: ICloudSandboxCreatedSession, repoNwo: string | undefined): void; /** Return the receipt from take for cleanup only when task creation was not dispatched. */ release(prepared: ICloudSandboxPreparedReservation): Promise; /** Release unused preparation without allowing subsequent typing to replace it. */ discard(draftResource: URI): Promise; /** Release all unused preparations, retaining one-shot draft records and leaving Send's claims alone. */ clear(): Promise; /** Forget the logical draft, including confirmed submission identities, while releasing only unused preparation. */ forget(draftResource: URI): Promise; } export declare const ICloudSandboxApiService: import("../../instantiation/common/instantiation.js").ServiceIdentifier; /** Account identity and control-plane APIs for sandbox credentials, discovery, and persisted history. */ export interface ICloudSandboxApiService { readonly _serviceBrand: undefined; /** Account identity after authentication changes, or undefined when signed out. */ readonly onDidChangeAccount: Event; /** Resolves an opaque, credential-free account key using the same identity as task requests. */ getAccountKey(): Promise; /** Acquire an identity credential for the expected account, sharing requests and optionally replacing the cached token. */ getIdentityToken(accountKey: string, token: CancellationToken, forceRefresh?: boolean): Promise; /** Seal a supplied credential without caching or local encryption fallback; disposing the service cancels pending sealing. */ sealToken(request: ICloudSandboxSealTokenRequest, token: CancellationToken): Promise; /** Start minting immediately and seal when the target is ready; errors remain observable even when awaited later. */ prepareSandboxAuthentication(accountKey: string, target: Promise, token: CancellationToken, forceRefresh?: boolean): Promise; /** Negotiate the account's task feed; undefined means the server has not enabled it. */ connectSessionFeed(token: CancellationToken): Promise; /** Account-authorized cloud model catalog, available before a sandbox is provisioned. */ listModels(token: CancellationToken): Promise; /** * Mint a fresh client Web PubSub connection token for a new logical connection. May resolve to a * "waking" result the caller should retry. */ connect(request: ICloudSandboxConnectionRequest, token: CancellationToken): Promise; /** * Refresh the credentials for an existing logical connection identified by {@link clientId} * (e.g. after the access token expired). */ reconnect(request: ICloudSandboxConnectionRequest, clientId: string, token: CancellationToken): Promise; /** * Read an environment's current record. `status` is derived from heartbeat age, so it says * whether the environment is running — not whether a dormant one can be woken, which Mission * Control only discovers by attempting the resume behind `/connect`. */ getEnvironment(environmentId: string, token: CancellationToken): Promise; /** Lists the authenticated account's environments without attaching or provisioning compute. */ listEnvironments(token: CancellationToken, options?: { readonly refresh?: boolean; }): Promise; /** Hard-delete an environment owned by the expected account; managed sandboxes also delete backing compute and storage. */ deleteEnvironment(environmentId: string, token: CancellationToken, expectedAccountKey: string): Promise; /** Returns fresh credential-free inventory for the current account without issuing a request. */ getCachedEnvironments(): readonly IMissionControlEnvironment[] | undefined; /** Enumerate sandbox sessions, or refresh only the tasks named by feed notifications. */ listSessions(token: CancellationToken, options?: ICloudSandboxDiscoveryOptions): Promise; /** Reserve or renew an unsubmitted task for the draft's repository or default compute scope. */ reserveSession(request: ICloudSandboxReserveSessionRequest, token: CancellationToken): Promise; /** * Create a sandbox task and bound session, optionally consuming a reservation or reusing an online environment. * The optional callback reports the HTTP dispatch attempt, after local validation and authentication. */ createSession(request: ICloudSandboxCreateSessionRequest, token: CancellationToken, onRequest?: () => void): Promise; /** Soft-delete the task without waking the sandbox, optionally requiring the account that created it. */ deleteTask(taskId: string, token: CancellationToken, expectedAccountKey?: string): Promise; /** Rename the Mission Control task without waking the sandbox. */ renameTask(taskId: string, title: string, token: CancellationToken): Promise; /** Archive or unarchive the Mission Control task without waking the sandbox. */ setTaskArchived(taskId: string, archived: boolean, token: CancellationToken): Promise; /** * Reads fresh recorded history without a live sandbox (`undefined` when absent); `diagnosticId` remains local. * Optional callbacks preview authenticated cached history and validate snapshots before cache replacement. */ getSessionHistory(taskId: string, token: CancellationToken, diagnosticId?: string, onCachedHistory?: (history: IReplayedTaskHistory) => void, canCacheHistory?: (history: IReplayedTaskHistory | undefined) => boolean): Promise; /** Prevent in-flight reads from refilling the cache; preserve stored data only when live history matches. */ invalidateSessionHistory(taskId: string, preserveCached?: boolean): void; /** Drop recorded data and cancel reads for an account/feature lifetime or a removed task. */ clearSessionHistory(taskId?: string): void; } export declare const ICloudSandboxAgentHostService: import("../../instantiation/common/instantiation.js").ServiceIdentifier; /** * Renderer-side coordinator that establishes and manages live Agent Host * Protocol relay connections to Copilot cloud sandbox environments. Mints * credentials via {@link ICloudSandboxApiService}, opens a * {@link WebPubSubRelayTransport}, drives the AHP handshake (including the * sealed-token `authenticate`), and registers the connection with * {@link IRemoteAgentHostService} so it surfaces as a native agent-host session. */ export interface ICloudSandboxAgentHostService { readonly _serviceBrand: undefined; /** * Establish (or reuse) a live AHP relay connection to the given sandbox * environment. Resolves with the connection's display address once the * connection is registered with {@link IRemoteAgentHostService}. * * Retries while the environment is waking (bounded), honoring the * server-provided Retry-After delay. */ connect(options: ICloudSandboxConnectOptions, token: CancellationToken): Promise; /** Disconnect a sandbox address and discard its staged credentials. */ disconnect(addressOrEnvironmentId: string): Promise; /** * The sealed GitHub token for a live connection to the given environment, as minted by * `/connect` and refreshed by `/reconnect`, or `undefined` when there is no connection. */ getSealedGitHubToken(environmentId: string): string | undefined; /** Resolves identity-only authentication for a user-local host; the protocol client seals it for each handshake. */ resolveUserLocalAuthentication(environmentId: string, resource: string, forceRefresh?: boolean): Promise; /** Renew a live connection's sealed credential, rejecting missing or reused envelopes while sharing its refresh and retry budget. */ refreshSealedGitHubToken(environmentId: string): Promise; }