import { BaseActionViewItem } from "../../../../../../base/browser/ui/actionbar/actionViewItems.js"; import { CancellationToken } from "../../../../../../base/common/cancellation.js"; import { IMarkdownString } from "../../../../../../base/common/htmlContent.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { IActionListOptions } from "../../../../../../platform/actionWidget/browser/actionList.js"; import { IActionWidgetService } from "../../../../../../platform/actionWidget/browser/actionWidget.service.js"; import { IAgentHostEnablementService } from "../../../../../../platform/agentHost/common/agentHostEnablementService.service.js"; import { IAgentHostService } from "../../../../../../platform/agentHost/common/agentService.service.js"; import { IAgentHostConnectionsService } from "../../../../../../platform/agentHost/common/agentHostConnectionsService.service.js"; import type { SessionConfigPropertySchema, SessionConfigSchema } from "../../../../../../platform/agentHost/common/state/protocol/commands.js"; import { IHoverService } from "../../../../../../platform/hover/browser/hover.service.js"; import { IContextViewService } from "../../../../../../platform/contextview/browser/contextView.service.js"; import { ILogService } from "../../../../../../platform/log/common/log.service.js"; import { IOpenerService } from "../../../../../../platform/opener/common/opener.service.js"; import { IManagedSettingsService } from "../../../../../../platform/policy/common/copilotManagedSettings.service.js"; import { IDialogService } from "../../../../../../platform/dialogs/common/dialogs.service.js"; import { IStorageService } from "../../../../../../platform/storage/common/storage.service.js"; import { AgentSandboxSettingId } from "../../../../../../platform/sandbox/common/settings.js"; import { IAction } from "../../../../../../base/common/actions.js"; import { IConfigurationService } from "../../../../../../platform/configuration/common/configuration.service.js"; import { IWorkspaceContextService } from "../../../../../../platform/workspace/common/workspace.service.js"; import type { IChatWidget } from "../../chat.js"; import { IChatSessionsService } from "../../../common/chatSessionsService.service.js"; import { IAgentHostSessionWorkingDirectoryResolver } from "./agentHostSessionWorkingDirectoryResolver.service.js"; import { IAgentHostNewSessionFolderService } from "./agentHostNewSessionFolderService.service.js"; import { IAgentHostUntitledProvisionalSessionService } from "./agentHostUntitledProvisionalSessionService.service.js"; import { IChatPhoneInputPresenter } from "../../widget/input/chatPhoneInputPresenter.service.js"; import { isWellKnownAutoApproveSchema } from "./agentHostModePickerPresentation.js"; import { IPreferencesService } from "../../../../../services/preferences/common/preferences.service.js"; import { IWorkbenchEnvironmentService } from "../../../../../services/environment/common/environmentService.service.js"; /** A section of the combined mode and permissions menu. */ export type AgentHostPickerSection = "mode" | "permissions"; export { isWellKnownAutoApproveSchema }; interface IConfigPickerItem { readonly id?: string; readonly value: string; readonly label: string; readonly description?: string; readonly checked?: boolean; readonly disabled?: boolean; /** Whether enterprise policy known to this client explains why the item is disabled. */ readonly disabledByPolicy?: boolean; } export declare function getAgentHostSandboxSettingId(sessionType: string | undefined): AgentSandboxSettingId.AgentSandboxEnabled | undefined; export declare function getConfigPickerTriggerLabel(schema: SessionConfigPropertySchema, value: unknown | undefined): string; export declare function getConfigPickerAccessibleTriggerLabel(label: string, sandboxed: boolean): string; export declare function getConfigPickerTriggerHover(property: string, schema: SessionConfigPropertySchema, value: unknown | undefined, isReadOnly: boolean, sandboxed?: boolean): string; export declare function getConfigPickerItemHover(property: string, item: IConfigPickerItem, disabled: boolean): string | IMarkdownString | undefined; export declare function getConfigPickerListOptions(property: string): IActionListOptions | undefined; /** * The set of well-known session-config property names that are either handled * by dedicated UI or intentionally hidden from the workbench chat-input chip * lane. The generic-fallback chip lane filters these out so unknown properties * advertised by an agent get their own chip. * * `Permissions` has no chip — it is surfaced through other UI — but is * included so the generic lane does not invent a chip for it. * * Host-owned worktree configuration also has no chip. Including those properties * here keeps the generic lane from surfacing them in the chat input. The same * applies to `ShellInitScripts`, which is generated rather than user-edited: * `readOnly` keeps it out of the session-settings file but does not by itself * suppress the generic chip. */ export declare const WELL_KNOWN_PICKER_PROPERTIES: ReadonlySet; /** * Whether the given `(property, schema)` pair is handled outside the * generic-fallback chip lane. This includes properties rendered by dedicated * chip widgets and properties intentionally hidden from workbench chat. * * For most well-known keys this is purely a property-name check. AutoApprove is * special: only well-known schema shapes are claimed by the dedicated picker; * non-conforming schemas (e.g. Claude's approval mode) fall through to the * generic lane. */ export declare function isClaimedByDedicatedPicker(property: string, schema: SessionConfigPropertySchema, configSchema?: SessionConfigSchema): boolean; export declare function isGenericConfigPickerProperty(property: string, schema: SessionConfigPropertySchema, isStartedSession: boolean, configSchema?: SessionConfigSchema): boolean; /** * Resolves which config value a chat-input chip should display, given the * server's session-state value and the workbench overlay value. * * Precedence depends on the session lifecycle: * - Untitled (pre-send): the workbench overlay is authoritative — it reflects * synchronous chip edits before the provisional backend echoes them, so it * wins over server state. * - Running (titled): the *server* is authoritative. The overlay is only * refreshed on manual chip edits, so server-driven changes (e.g. Plan → * Autopilot when the user approves a plan) must win, otherwise a stale * overlay value would shadow them. */ export declare function resolveConfigChipValue(isUntitled: boolean, serverValue: unknown, overlayValue: unknown, schemaDefault: unknown): unknown; /** * One workbench chat-input chip bound to a single agent-host session-config * property. Used both for dedicated well-known property chips * (`SessionConfigKey.Mode`, `.AutoApprove`) and for generic per-property chips * advertised by an agent's config schema but not known to VS Code. */ export declare class AgentHostChatInputPicker extends Disposable { private readonly _widget; private readonly _property; private readonly _agentHostService; private readonly _actionWidgetService; private readonly _hoverService; private readonly _openerService; private readonly _workingDirectoryResolver; private readonly _workspaceContextService; private readonly _provisional; private readonly _configurationService; private readonly _newSessionFolderService; private readonly _dialogService; private readonly _storageService; private readonly _agentHostEnablementService; private readonly _phoneInputPresenter; private readonly _preferencesService; private readonly _logService; private readonly _connectionsService; private readonly _environmentService; private readonly _contextViewService; private readonly _managedSettingsService; private readonly _chatSessionsService; private _container; private _trigger; private _pickerVisible; private _generic; private _initialResolved; private readonly _initialConfig; private readonly _renderDisposables; private readonly _splitTrigger; private readonly _pickerDisposables; private readonly _draftListeners; private readonly _sandboxConfigChanged; private readonly _filterDelayer; private readonly _subRef; private _sessionGeneration; constructor(_widget: IChatWidget, _property: string, _agentHostService: IAgentHostService, _actionWidgetService: IActionWidgetService, _hoverService: IHoverService, _openerService: IOpenerService, _workingDirectoryResolver: IAgentHostSessionWorkingDirectoryResolver, _workspaceContextService: IWorkspaceContextService, _provisional: IAgentHostUntitledProvisionalSessionService, _configurationService: IConfigurationService, _newSessionFolderService: IAgentHostNewSessionFolderService, _dialogService: IDialogService, _storageService: IStorageService, _agentHostEnablementService: IAgentHostEnablementService, _phoneInputPresenter: IChatPhoneInputPresenter, _preferencesService: IPreferencesService, _logService: ILogService, _connectionsService: IAgentHostConnectionsService, _environmentService: IWorkbenchEnvironmentService, _contextViewService: IContextViewService, _managedSettingsService: IManagedSettingsService, _chatSessionsService: IChatSessionsService); render(container: HTMLElement, generic?: boolean): void; show(anchor: HTMLElement): void; /** The rendered control that opens this picker, if it is currently shown. */ get triggerElement(): HTMLElement | undefined; /** The open menu, or `undefined` while it is closed. */ get menuElement(): HTMLElement | undefined; /** Whether this mode picker also offers the permission levels, in a separate section. */ get combinesPermissions(): boolean; /** * Shows the menu with `section` expanded and its header focused. If the combined menu is * already open, collapses the other section and expands `section` after a short pause, so * the menu visibly moves between sections. */ showSection(section: AgentHostPickerSection, token: CancellationToken): Promise; /** Closes the menu if it is open. */ hideMenu(): void; private _setSectionExpanded; private _reattach; private _cancelInitialResolve; private _refreshInitialResolved; private _renderChip; /** * Whether the picker's chat may set its property for itself but the chat's * own values are not known yet: its value is still the session's, so the * picker shows as resolving and cannot be opened or written. */ private _isChatConfigResolving; private _renderTrigger; private _refreshTrigger; private _isSandboxed; private _isModePickerCombined; private _getModePickerPermissions; private _isCurrentTarget; private _canEdit; private _bindContext; private _readContext; private _getActionItems; private _hidePicker; private _showPicker; private _selectItem; private _getSandboxSettingId; private _isSandboxingEnabled; private _readSandboxToggleState; private _getSandboxStandaloneToggle; private _getItems; private _fromCompletion; private _readWorkingDirectory; private _readCurrentValues; /** The effective config of this picker's chat: its session's, with the chat's own values applied. */ private _readChatConfig; /** Confirms an elevated approval selection before writing through its host binding. */ private _confirmAndSetValue; private _setValue; } export declare class AgentHostChatInputPickerActionViewItem extends BaseActionViewItem { private readonly _picker; constructor(action: IAction, _picker: AgentHostChatInputPicker, onDidDispose?: () => void); render(container: HTMLElement): void; }