import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { IAgentHostService } from "../../../../../../platform/agentHost/common/agentService.service.js"; import type { AgentSdkDownloadStatus, IAgentSdkSetupInfo } from "../../../../../../platform/agentHost/common/agentSdkSetup.js"; import type { RootState } from "../../../../../../platform/agentHost/common/state/protocol/state.js"; import { IDefaultAccountService } from "../../../../../../platform/defaultAccount/common/defaultAccount.service.js"; import { IWorkbenchContribution } from "../../../../../common/contributions.js"; import { type AgentSdkSetupState } from "@codingame/monaco-vscode-chat-service-override/vscode/vs/workbench/services/agentHost/browser/agentSdkSetupService"; import { IAgentSdkSetupService } from "../../../../../services/agentHost/browser/agentSdkSetupService.service.js"; import { ICodexAccountService } from "../../../../../services/agentHost/browser/codexAccountService.service.js"; import { IChatEntitlementService } from "../../../../../services/chat/common/chatEntitlementService.service.js"; import { IChatInputNotification } from "../../widget/input/chatInputNotificationService.js"; import { IChatInputNotificationService } from "../../widget/input/chatInputNotificationService.service.js"; import { ILanguageModelsService } from "../../../common/languageModels.service.js"; /** Everything one agent's {@link AgentSdkSetupState} is decided from. */ export interface IAgentSdkSetupStateInputs { /** Whether the user is signed in to GitHub (the shared Copilot route is already configured). */ readonly signedIn: boolean; /** Whether entitlement has settled; before that "signed out" is not yet a fact. */ readonly entitlementResolved: boolean; readonly download: AgentSdkDownloadStatus; /** Whether a fetch has been asked for and the host has not answered yet. */ readonly downloadRequested: boolean; /** Whether this agent has published any model — its own report of "I found an account". */ readonly hasModels: boolean; /** State of an agent-owned sign-in route; absent when the agent has no such route. */ readonly agentAccountState?: "unresolved" | "needsSignIn" | "available"; } /** * The whole decision, as one pure function: what the banner renders and what the * funnel records are two readings of this one state. * * The download is offered before any other check, because it applies to * everyone: we fetch a large SDK onto the user's machine, and that is worth * saying whether or not they have models already. */ export declare function getAgentSdkSetupState(inputs: IAgentSdkSetupStateInputs): AgentSdkSetupState | undefined; /** * The state worth reporting to the funnel, or `undefined` when it adds * nothing to what was last reported for this agent — `_update()` re-runs on every * model, entitlement and root-state change. Comparing against the last *reported* * state also counts each step once per user: a download that fails back to the * offer is the same person still being asked. */ export declare function getAgentSdkSetupStateToReport(previous: AgentSdkSetupState | undefined, state: AgentSdkSetupState | undefined): AgentSdkSetupState | undefined; /** * The session type an agent's sessions run under, derived the same way * `AgentHostChatContribution` derives it — so agent #3 needs no edit here. * Scoped to the window's ambient host, which is itself the remote in a remote * window; the Sessions app's additional `remote--` * connections are outside this banner, as they are the Copilot one. */ export declare function agentSdkSetupSessionType(agent: string): string; /** * Each agent's own display name, keyed by provider id. Taken from root state * rather than the setup channel: the host describes every agent there already, * and a second wire source for one string would be free to disagree. Templating * is also what keeps user-facing text out of the host — what crosses the wire is * a proper noun the workbench cannot invent. */ export declare function getAgentDisplayNames(state: RootState | Error | undefined): ReadonlyMap; export declare function agentSdkSetupNotificationId(agent: string): string; /** * Whether an agent advertised demand-driven setup for the given session type. * Pickers use the capability itself rather than a currently visible banner: * an already-authenticated account has no banner, but still needs selection to * activate the agent and enumerate its models. */ export declare function hasAgentSdkSetupForSessionType(setups: readonly IAgentSdkSetupInfo[], sessionType: string): boolean; /** * Render one agent's banner, or `undefined` when it has nothing to say. * * Every string is a template this layer owns, filled with the proper nouns the * agent declared (`displayName`, `signInProviderName`) and varied by the routes * it offers — nothing a person reads crosses the wire. The download lines * never tie the SDK to an account: it is the same SDK behind the Copilot proxy, * a subscription or a BYO key. */ export declare function createAgentSdkSetupNotification(setup: IAgentSdkSetupInfo, displayName: string, state: AgentSdkSetupState | undefined, hasModels?: boolean, includeGitHubSignIn?: boolean): IChatInputNotification | undefined; export declare const AGENT_SDK_SETUP_DOWNLOAD_COMMAND_ID = "workbench.action.chat.agentHost.downloadAgentSdk"; export declare const AGENT_SDK_SETUP_OPEN_DOCS_COMMAND_ID = "workbench.action.chat.agentHost.openAgentSetupDocs"; export declare const AGENT_SDK_SETUP_RELOAD_COMMAND_ID = "workbench.action.chat.agentHost.reloadAgentConfiguration"; export declare const AGENT_SDK_SETUP_GITHUB_SIGN_IN_COMMAND_ID = "workbench.action.chat.agentHost.signInToGitHubForAgent"; export declare const AGENT_SDK_SETUP_SIGN_IN_COMMAND_ID = "workbench.action.chat.agentHost.signInToAgent"; /** * Offers the SDK download, and explains a missing account once it is on disk, * for every agent whose setup lives outside the app. * * Sibling to `AgentHostSignedOutModelsNotification`, which stays Copilot-scoped * — these are different asks aimed at different people and share only the * notification machinery. */ export declare class AgentHostSdkSetupNotificationContribution extends Disposable implements IWorkbenchContribution { private readonly _chatInputNotificationService; private readonly _agentSdkSetupService; private readonly _defaultAccountService; private readonly _languageModelsService; private readonly _chatEntitlementService; private readonly _agentHostService; private readonly _codexAccountService; static readonly ID = "workbench.contrib.agentHostSdkSetupNotification"; /** Pushed notification content by id, so an unchanged answer is not re-pushed (which would clear a dismissal and re-announce). */ private readonly _shown; /** Last state reported per agent, so a re-render is not a second event. */ private readonly _lastReported; constructor(_chatInputNotificationService: IChatInputNotificationService, _agentSdkSetupService: IAgentSdkSetupService, _defaultAccountService: IDefaultAccountService, _languageModelsService: ILanguageModelsService, _chatEntitlementService: IChatEntitlementService, _agentHostService: IAgentHostService, _codexAccountService: ICodexAccountService); private _update; }