import { CancellationToken } from "../../../../../base/common/cancellation.js"; import { Disposable } from "../../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../../base/common/observable.js"; import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js"; import { IDefaultAccountService } from "../../../../../platform/defaultAccount/common/defaultAccount.service.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IProductService } from "../../../../../platform/product/common/productService.service.js"; import { ITelemetryService } from "../../../../../platform/telemetry/common/telemetry.service.js"; import { IWorkbenchContribution } from "../../../../common/contributions.js"; import { IAuthenticationService } from "../../../../services/authentication/common/authentication.service.js"; import { IChatEntitlementService } from "../../../../services/chat/common/chatEntitlementService.service.js"; import { IChatMicrosoftSignInProbeService } from "./chatSetupMicrosoftProbe.service.js"; export declare enum MicrosoftSignInProbeOutcome { Linked = "linked", NotLinked = "notLinked", NoMicrosoftAccounts = "noMicrosoftAccounts", Error = "error" } export interface IMicrosoftSignInProbeResult { readonly outcome: MicrosoftSignInProbeOutcome; /** How many Microsoft work or school accounts could be asked about. */ readonly microsoftAccounts: number; } /** * Checks, without showing the user anything, whether any Microsoft work or school account on this * device is linked by GitHub to a GitHub account (for example, an Enterprise Managed User). * * Every step is silent. The Microsoft tokens are never handed to extensions other than the two * authentication providers. The GitHub provider revokes the token it mints to answer where the host * and build allow it, and otherwise leaves it to expire (see {@link ENTRA_EXCHANGE_PROBE_OPTION}). * Both options are reserved for the workbench, so extensions cannot run this check. * * @param gitHubProviderId The GitHub authentication provider that sign-in would use. * @throws {@link CancellationError} when `token` is cancelled; any provider failure is rethrown. */ export declare function probeMicrosoftSignIn(authenticationService: IAuthenticationService, gitHubProviderId: string, token: CancellationToken): Promise; export declare class ChatMicrosoftSignInProbeService extends Disposable implements IChatMicrosoftSignInProbeService { private readonly authenticationService; private readonly chatEntitlementService; private readonly configurationService; private readonly productService; private readonly logService; private readonly telemetryService; readonly _serviceBrand: undefined; readonly offerMicrosoftSignIn: IObservable; private readonly mode; private readonly gitHubProviderId; /** What the mode and the probes say, before whether offering Microsoft can matter at all. */ private readonly offered; /** The GitHub provider a probe found a linked account for. */ private readonly linkedGitHubProviderId; /** * Runs one probe at a time for each GitHub provider. The authentication service cannot cancel a * request once a provider has it, so a running probe is never abandoned: whatever asks for a probe * meanwhile, such as a dialog or a Microsoft sign-in, is coalesced into one more probe after it. */ private readonly probes; /** Stops a running probe from asking GitHub, and so from minting a token, once this service is gone. */ private readonly disposed; /** * Cancelled, and replaced, whenever a Microsoft account is added or removed: a probe still running * then answers for accounts that may be gone, so its answer is discarded. */ private accountsCancellation; constructor(authenticationService: IAuthenticationService, defaultAccountService: IDefaultAccountService, chatEntitlementService: IChatEntitlementService, configurationService: IConfigurationService, productService: IProductService, logService: ILogService, telemetryService: ITelemetryService); notifySignInShown(): void; /** Whether "Continue with Microsoft" can matter at all, in any mode: independent of the experiment arm. */ private isProbeRelevant; /** * Logs the setting's experiment trigger, unless the user or a policy chose a mode themselves: the * assigned default then has no effect, and that holds the same in every arm. */ private logExperimentTrigger; private probe; private runProbe; private report; } /** Creates {@link IChatMicrosoftSignInProbeService} after startup, so it can probe before a dialog needs the answer. */ export declare class ChatMicrosoftSignInProbeContribution implements IWorkbenchContribution { static readonly ID = "workbench.contrib.chatMicrosoftSignInProbe"; constructor(_microsoftSignInProbeService: IChatMicrosoftSignInProbeService); }