import { CancellationToken } from "../../../../../base/common/cancellation.js"; import { DisposableStore, IDisposable } from "../../../../../base/common/lifecycle.js"; import { URI } from "../../../../../base/common/uri.js"; import { IAgentConnection } from "../../../../../platform/agentHost/common/agentService.js"; import { AuthRequiredReason } from "../../../../../platform/agentHost/common/state/sessionActions.js"; import { type ProtectedResourceMetadata } from "../../../../../platform/agentHost/common/state/protocol/state.js"; import { IAgentHostAuthenticateRequest } from "../agentSessions/agentHost/agentHostAuth.js"; import { IChatSessionContentProvider } from "../../common/chatSessionsService.js"; import { IRemoteAgentHostConnectionCustomizationService } from "./remoteAgentHostConnectionCustomization.service.js"; export declare function authenticateWithConnectionCustomization(connection: IAgentConnection, request: IAgentHostAuthenticateRequest, customization: IRemoteAgentHostConnectionCustomization | undefined, isCurrent: () => boolean, reason?: AuthRequiredReason): Promise; /** Optional startup preparation for a selected workspace, returning a replacement host directory when needed. */ export type RemoteAgentHostSessionPreparation = (selection: URI | undefined, token: CancellationToken) => Promise; /** * Per-connection behavior a specific remote-agent-host kind can inject into the otherwise * host-agnostic remote-agent-host contribution. Connections with no customization are unaffected. */ export interface IRemoteAgentHostConnectionCustomization { /** Whether this managed connection requires workspace trust. Defaults to true. */ readonly requiresWorkspaceTrust?: boolean; /** Optional provider-specific input hint supplied by the connection owner. */ readonly inputPlaceholder?: (provider: string) => string | undefined; /** * Transform the outgoing `authenticate` request before it is sent. Must fail closed: throw rather * than forward a value that does not meet the host's contract. An expired challenge requires renewal. */ readonly authenticate?: (request: IAgentHostAuthenticateRequest, reason?: AuthRequiredReason) => Promise; /** Resolves a fresh connection-owned credential, or returns undefined for resources using normal provider recovery. */ readonly renewAuthentication?: (resource: ProtectedResourceMetadata) => Promise; /** * The backend session URI scheme for an agent provider when it differs from the provider itself. * Return `undefined` to keep scheme == provider. */ readonly backendSessionScheme?: (provider: string) => string | undefined; /** Opts a provider into display-only retention while consumed steering waits for its transcript turn. */ readonly retainConsumedSteeringMessages?: (provider: string) => boolean; /** Creates connection-scoped startup preparation, invoked only for new sessions after authentication. */ readonly createSessionPreparation?: (connection: IAgentConnection, store: DisposableStore) => RemoteAgentHostSessionPreparation; /** Optionally retains a content provider across its initial history-to-live transition. */ readonly registerChatSessionContentProvider?: (sessionType: string, provider: IChatSessionContentProvider) => IDisposable | undefined; /** Configuration a session this client provisioned is created with; forwarded to the session handler's `resolveInitialSessionConfig`. */ readonly resolveInitialSessionConfig?: (sessionResource: URI) => Record | undefined; /** Vendors whose model identifiers also address this connection's models; forwarded to the session handler's `modelIdentifierAliases`. */ readonly modelIdentifierAliases?: readonly string[]; /** Whether a title the host reports is a stand-in (e.g. the session id) rather than a title to show; forwarded to the session handler's `isSessionTitlePlaceholder`. */ readonly isSessionTitlePlaceholder?: (title: string, sessionResource: URI) => boolean; /** Uses the session title and rename channel for the default chat instead of an independent chat title. */ readonly useSessionTitleForDefaultChat?: boolean; } /** Builds a {@link IRemoteAgentHostConnectionCustomization} for a concrete connection address. */ export type RemoteAgentHostConnectionCustomizationFactory = (address: string) => IRemoteAgentHostConnectionCustomization; export declare class RemoteAgentHostConnectionCustomizationService implements IRemoteAgentHostConnectionCustomizationService { readonly _serviceBrand: undefined; private readonly _entries; register(match: (address: string) => boolean, factory: RemoteAgentHostConnectionCustomizationFactory): IDisposable; get(address: string): IRemoteAgentHostConnectionCustomization | undefined; }