import type { CodeWindow } from "../../../../../../base/browser/window.js"; import { Event } from "../../../../../../base/common/event.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { type IObservable } from "../../../../../../base/common/observable.js"; import { type ComputerUsePermission, type ComputerUsePermissionState, type IComputerUseSetupActionV1, type IComputerUseStatusV1 } from "../../../../../../platform/agentHost/common/computerUse.js"; import { IKeybindingService } from "../../../../../../platform/keybinding/common/keybinding.service.js"; import { ILayoutService } from "../../../../../../platform/layout/browser/layoutService.service.js"; import { IHostService } from "../../../../../services/host/browser/host.service.js"; /** Lets the setup modal hand Copilot Computer Use to System Settings by hand; only desktop clients can. */ export interface IComputerUseHelperAppSupport { /** Drags the app at `path` out of `targetWindow` as a file; call it from a `dragstart` handler that cancels the HTML drag. */ startDrag(path: string, targetWindow: CodeWindow): void; } /** The status the setup modal shows and the actions it sends. */ export interface IComputerUseSetupModel { /** The local Agent Host's setup status; `undefined` while it publishes none. */ readonly status: IObservable; /** Present when this client can hand Copilot Computer Use to System Settings by hand. */ readonly helperApp?: IComputerUseHelperAppSupport; /** Sends `action` for the current round of setup `setupId`; `false` when the setup doesn't offer it now. */ request(setupId: string, action: IComputerUseSetupActionV1): boolean; } /** One permission the setup needs. */ export interface IComputerUseSetupRowView { readonly permission: ComputerUsePermission; readonly state: ComputerUsePermissionState; /** Whether the user turns this permission on next: the first one that isn't granted while the setup waits. */ readonly current: boolean; } /** What the modal shows for a setup that waits, or that just became ready. */ export interface IComputerUseSetupView { readonly setupId: string; readonly state: "needsPermissions" | "working" | "ready"; readonly rows: readonly IComputerUseSetupRowView[]; /** Whether the current row's Allow in Settings sends `allow` now. */ readonly canAllow: boolean; /** Whether checking again sends `recheck` now. */ readonly canRecheck: boolean; /** Why the last check the user asked for changed nothing. */ readonly error?: string; } /** The localized name of a macOS permission. */ export declare function getComputerUsePermissionLabel(permission: ComputerUsePermission): string; /** Derives what the modal shows for setup `setupId` from the host's status; `undefined` once the modal must close. */ export declare function getComputerUseSetupView(status: IComputerUseStatusV1 | undefined, setupId: string): IComputerUseSetupView | undefined; /** What the setup modal's body needs from the modal around it. */ export interface IComputerUseSetupPanelOptions { /** Fires `true` when the window gains focus and `false` when it loses it. */ readonly onDidChangeWindowFocus: Event; /** Closes the modal; the panel calls it once its setup no longer waits. */ readonly close: () => void; } /** * The body of the setup modal. It renders the host's status for one setup, one permission at a time, and sends the * user's explicit actions; it never decides whether a permission is granted. After the user goes to System Settings to * turn a permission on, it checks again once when the window regains focus, unless macOS confirmed the permission * meanwhile. It closes the modal once the setup no longer waits. */ export declare class ComputerUseSetupPanel extends Disposable { private readonly _model; private readonly _options; readonly element: HTMLElement; /** Copilot Computer Use's icon, which the modal shows above its title. */ readonly appIcon: HTMLElement; private readonly _appIconImage; private readonly _rows; /** The app, for dragging into a System Settings list; in the current row while this client can drag it. */ private readonly _helperApp; private readonly _helperAppIcon; private readonly _closeWhenReady; private _setupId; private _view; /** Whether the host is checking the setup's permissions again. */ private _checking; /** The app the modal offers for dragging into System Settings, if any. */ private _helperAppPath; /** Set when the user went to macOS to grant a permission: once the window loses and regains focus, check again. */ private _returnWatch; private _recheckOnReturn; constructor(_model: IComputerUseSetupModel, setupId: string, _options: IComputerUseSetupPanelOptions); /** The view currently shown; `undefined` once the panel closed the modal. */ get view(): IComputerUseSetupView | undefined; /** Follows setup `setupId` from now on. */ setTarget(setupId: string): void; /** Moves focus to the current row's Allow in Settings, if a row is current. */ focus(): void; private _createRow; private _render; /** The modal the panel is the body of; focus anywhere in it counts as focus in the setup. */ private _getModal; private _getCurrentAllow; private _announce; private _allow; private _recheck; private _startHelperAppDrag; private _onWindowFocus; /** Checks again once the user came back, as soon as the plugin waits for the setup's next step. */ private _recheckIfReturned; } /** The setup modal: one per window, opened from the chat's setup card while its setup waits. */ export declare class ComputerUseSetupDialog extends Disposable { private readonly _dialog; private readonly _panel; constructor(model: IComputerUseSetupModel, setupId: string, layoutService: ILayoutService, keybindingService: IKeybindingService, hostService: IHostService); /** Shows the modal while its setup waits; resolves once it closed. */ show(): Promise; /** Brings the open modal to setup `setupId`. */ reveal(setupId: string): void; }