import { IObservable, IReader } from "../../../../base/common/observable.js"; import { IActionListItem } from "../../../../platform/actionWidget/browser/actionList.js"; import { ISessionFileChange } from "../../../services/sessions/common/session.js"; import { IActiveSession } from "../../../services/sessions/common/sessionsManagement.js"; import { WorktreeSuggestionVariant } from "../common/worktreeSuggestion.js"; import { IWorktreeSuggestion, IUncommittedChangesListItem, WorktreeSpotlightChoice } from "./worktreeSuggestionService.js"; export interface IWorktreeSuggestionService { readonly _serviceBrand: undefined; /** The presentation selected by {@link WORKTREE_SUGGESTION_SETTING}, or by a developer preview. */ readonly variant: IObservable; /** Whether a developer preview of a presentation is active in this window. */ readonly isPreviewing: IObservable; /** * The suggestion every arm would make for `session`: a new session with Branch isolation in a folder * with uncommitted changes, for someone who already started a few sessions, where New Worktree is * available. It ignores state that only the treatments write, such as a closed hint or a spotlight * that was already shown, so it can decide the experiment trigger. */ getSuggestion(session: IActiveSession | undefined, reader: IReader | undefined): IWorktreeSuggestion | undefined; /** Logs the experiment trigger once a suggestion would appear in any arm. */ reportWouldShow(): void; /** Records that `variant` presented the suggestion for its session. */ markShown(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; /** Records that the user opened the isolation picker from the suggestion, or to list its uncommitted files. */ markOpened(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; /** Records that the user chose New Worktree for the session while `variant` presented the suggestion. */ markAccepted(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; /** Records that the user kept Branch isolation for the session while `variant` presented the suggestion. */ decline(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): void; /** Whether the user kept Branch isolation for the suggestion's session while `variant` presented it, in this window. */ hasDeclined(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion, reader: IReader | undefined): boolean; /** * Switches the session to a new worktree and records the acceptance. Reports a failure to the user * and resolves to `false` instead of rejecting. */ useWorktree(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion): Promise; /** * The files with uncommitted changes in the suggestion's folder, as the provider reports them in the * session's uncommitted changes. `undefined` while they load, or when the provider does not report them. */ getUncommittedChanges(suggestion: IWorktreeSuggestion, reader: IReader | undefined): readonly ISessionFileChange[] | undefined; /** Opens the suggestion's uncommitted changes in the Changes editor and view, revealing `change` when given. */ reviewChanges(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion, change?: ISessionFileChange): Promise; /** * The rows that list up to `maxFiles` of the suggestion's uncommitted files, which a picker can show among * its options, followed by a row that stands for the rest and opens all of them. A single remaining file * is listed instead. */ getUncommittedChangesListItems(variant: WorktreeSuggestionVariant, suggestion: IWorktreeSuggestion, maxFiles: number): IActionListItem[]; /** Whether the user closed the inline hint, which then never shows again. */ isHintClosed(reader: IReader | undefined): boolean; /** Stops showing the inline hint. */ closeHint(suggestion: IWorktreeSuggestion): void; /** Whether the spotlight may still run: once per user while automatic onboarding is enabled, or in a preview. */ canShowSpotlight(): boolean; /** * Spotlights the isolation picker as the user sends a request, offering to send it in a new worktree. * `reveal` first shows the picker if it is collapsed. Escape sends it on Branch. Resolves to the user's * choice, or `undefined` when the spotlight could not show, for example while another one does. * A preview, or a spotlight that could not show, leaves the user's one-time spotlight to show later. */ showSendSpotlight(suggestion: IWorktreeSuggestion, options: { readonly reveal: () => void; }): Promise; /** * Previews `variant` in this window regardless of usage and earlier responses, which the preview neither * reads nor changes. The inline hint shows in a preview even before the user started enough sessions for * the banners below the input. `undefined` ends the preview. */ setPreview(variant: WorktreeSuggestionVariant | undefined): void; /** Forgets earlier responses, so a closed hint and a spotlight that was shown can appear again. */ reset(): void; } export declare const IWorktreeSuggestionService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier;