import { Disposable } from "../../../../base/common/lifecycle.js"; import { IObservable, IReader } from "../../../../base/common/observable.js"; import { ILanguageService } from "../../../../editor/common/languages/language.service.js"; import { IModelService } from "../../../../editor/common/services/model.service.js"; import { IActionListItem } from "../../../../platform/actionWidget/browser/actionList.js"; import { IConfigurationService } from "../../../../platform/configuration/common/configuration.service.js"; import { IContextKeyService } from "../../../../platform/contextkey/common/contextkey.service.js"; import { ILogService } from "../../../../platform/log/common/log.service.js"; import { INotificationService } from "../../../../platform/notification/common/notification.service.js"; import { IStorageService } from "../../../../platform/storage/common/storage.service.js"; import { ITelemetryService } from "../../../../platform/telemetry/common/telemetry.service.js"; import { IOnboardingScenarioService } from "../../../../workbench/contrib/onboarding/common/onboardingScenarioService.service.js"; import { IChatEntitlementService } from "../../../../workbench/services/chat/common/chatEntitlementService.service.js"; import { IViewsService } from "../../../../workbench/services/views/common/viewsService.service.js"; import { IAgentWorkbenchLayoutService } from "../../../browser/workbench.service.js"; import { ISessionsProvidersService } from "../../../services/sessions/browser/sessionsProvidersService.service.js"; import { ISessionFileChange } from "../../../services/sessions/common/session.js"; import { IActiveSession } from "../../../services/sessions/common/sessionsManagement.js"; import { ISessionChangesService } from "../../changes/common/sessionChangesService.service.js"; import { WorktreeSuggestionVariant } from "../common/worktreeSuggestion.js"; import { IWorktreeSuggestionService } from "./worktreeSuggestionService.service.js"; /** A new session that would start in a folder with uncommitted changes. */ export interface IWorktreeSuggestion { readonly session: IActiveSession; /** Number of files with uncommitted changes in the session's folder. */ readonly uncommittedChanges: number; /** The folder's checked-out branch, when known. */ readonly branchName: string | undefined; } /** A row that lists uncommitted files of a suggestion, which opens them when chosen. */ export interface IUncommittedChangesListItem { readonly run: () => void; } /** What the user chose in the spotlight that appears as they send a request. */ export declare enum WorktreeSpotlightChoice { /** Send the request in a new worktree. */ Worktree = "worktree", /** Send the request on the branch. */ Branch = "branch" } export declare function worktreeSuggestionEquals(a: IWorktreeSuggestion | undefined, b: IWorktreeSuggestion | undefined): boolean; export declare class WorktreeSuggestionService extends Disposable implements IWorktreeSuggestionService { private readonly _configurationService; private readonly _storageService; private readonly _telemetryService; private readonly _chatEntitlementService; private readonly _sessionsProvidersService; private readonly _onboardingService; private readonly _modelService; private readonly _languageService; private readonly _sessionChangesService; private readonly _viewsService; private readonly _layoutService; private readonly _notificationService; private readonly _logService; readonly _serviceBrand: undefined; private readonly _preview; readonly isPreviewing: import("../../../../base/common/observable.js").IObservableWithChange; readonly variant: IObservable; private readonly _experienced; private readonly _phoneLayout; private readonly _stateChanged; /** Fires for every session config change, which includes a draft switching to Dev Container execution. */ private readonly _sessionConfigChanged; /** The state of the current preview, which starts afresh and is never stored. */ private readonly _previewState; /** The variants and sessions for which the user kept Branch isolation, as `variant:sessionId`. */ private readonly _declined; /** `action:variant:sessionId` triples already reported in this window. */ private readonly _reported; constructor(_configurationService: IConfigurationService, _storageService: IStorageService, _telemetryService: ITelemetryService, _chatEntitlementService: IChatEntitlementService, _sessionsProvidersService: ISessionsProvidersService, _onboardingService: IOnboardingScenarioService, contextKeyService: IContextKeyService, _modelService: IModelService, _languageService: ILanguageService, _sessionChangesService: ISessionChangesService, _viewsService: IViewsService, _layoutService: IAgentWorkbenchLayoutService, _notificationService: INotificationService, _logService: ILogService); getSuggestion(session: IActiveSession | undefined, reader: IReader | undefined): IWorktreeSuggestion | undefined; reportWouldShow(): void; markShown(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; markOpened(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; markAccepted(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; decline(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; hasDeclined(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion, reader: IReader | undefined): boolean; useWorktree(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): Promise; getUncommittedChanges(suggestion: IWorktreeSuggestion, reader: IReader | undefined): readonly ISessionFileChange[] | undefined; reviewChanges(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion, change?: ISessionFileChange): Promise; getUncommittedChangesListItems(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion, maxFiles: number): IActionListItem[]; isHintClosed(reader: IReader | undefined): boolean; closeHint(suggestion: IWorktreeSuggestion): void; canShowSpotlight(): boolean; showSendSpotlight(suggestion: IWorktreeSuggestion, options: { readonly reveal: () => void; }): Promise; setPreview(variant: WorktreeSuggestionVariant | undefined): void; reset(): void; /** Logs `action` once per variant and session, outside a preview. */ private _report; /** The stored state, or the state of the current preview. */ private _getState; private _updateState; }