import { Disposable, IDisposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { URI } from "../../../../base/common/uri.js"; import { IFileService } from "../../../../platform/files/common/files.service.js"; import { IChat, ISession } from "../../../services/sessions/common/session.js"; import { IJSONEditingService } from "../../../../workbench/services/configuration/common/jsonEditing.service.js"; import { IStorageService } from "../../../../platform/storage/common/storage.service.js"; import { IPreferencesService } from "../../../../workbench/services/preferences/common/preferences.service.js"; import { IUserDataProfileService } from "../../../../workbench/services/userDataProfile/common/userDataProfile.service.js"; import { CommandString } from "../../../../workbench/contrib/tasks/common/taskConfiguration.js"; import { ISessionTaskRunnerRegistry } from "./sessionTaskRunner.service.js"; import { ISessionsTasksService } from "./sessionsTasksService.service.js"; export type TaskStorageTarget = "user" | "workspace"; type TaskRunOnOption = "default" | "folderOpen" | "worktreeCreated"; export interface ITaskRunOptions { readonly runOn?: TaskRunOnOption; } /** * Shape of a single task entry inside tasks.json. */ export interface ITaskEntry { readonly label: string; readonly task?: CommandString; readonly script?: string; readonly type?: string; readonly command?: string; readonly args?: CommandString[]; readonly inAgents?: boolean; readonly runOptions?: ITaskRunOptions; readonly windows?: { command?: string; args?: CommandString[]; }; readonly osx?: { command?: string; args?: CommandString[]; }; readonly linux?: { command?: string; args?: CommandString[]; }; readonly dependsOn?: string | readonly string[]; readonly dependsOrder?: "sequence" | "parallel"; readonly [key: string]: unknown; } export interface INonSessionTaskEntry { readonly task: ITaskEntry; readonly target: TaskStorageTarget; } /** * A session task together with the storage target it was loaded from. */ export interface ISessionTaskWithTarget { readonly task: ITaskEntry; readonly target: TaskStorageTarget; } /** * Payload fired by {@link ISessionsTasksService.onDidRunTask} after a * session task has been successfully dispatched to its runner. */ export interface ISessionTaskRunEvent { readonly task: ITaskEntry; readonly session: ISession; } export declare class SessionsTasksService extends Disposable implements ISessionsTasksService { private readonly _fileService; private readonly _jsonEditingService; private readonly _preferencesService; private readonly _taskRunnerRegistry; private readonly _storageService; readonly _serviceBrand: undefined; private static readonly _PINNED_TASK_LABELS_KEY; private static readonly _BROWSER_URLS_KEY; private static readonly _PINNED_BROWSERS_KEY; private readonly _onDidRunTask; readonly onDidRunTask: import("../../../../base/common/event.js").Event; /** The most recently used folders, each read once and again only when its `tasks.json` changes; evicted entries release their watcher. */ private readonly _folderTasks; /** The current profile's user `tasks.json`, read and watched once for all folders and re-watched when the profile changes. */ private _userTasks; private readonly _userTasksWatcher; private static readonly MaxWatchedFolders; private readonly _noTasks; private readonly _pinnedTaskLabels; private readonly _pinnedTaskObservables; private readonly _browserUrls; private readonly _browserUrlObservables; private readonly _pinnedBrowsers; private readonly _pinnedBrowserObservables; constructor(_fileService: IFileService, _jsonEditingService: IJSONEditingService, _preferencesService: IPreferencesService, _taskRunnerRegistry: ISessionTaskRunnerRegistry, _storageService: IStorageService, userDataProfileService: IUserDataProfileService); getSessionTasks(session: ISession | IChat): IObservable; getSessionTasksOnce(session: ISession | IChat): Promise; getAllTasks(session: ISession | IChat): Promise; getNonSessionTasks(session: ISession | IChat): Promise; /** * Reads tasks from both workspace and user `tasks.json` for a session, * filtering each entry through `predicate` (in addition to the supported-type * check) and tagging it with its storage target. */ private _readTasksFromBothTargets; addTaskToSessions(task: ITaskEntry, session: ISession | IChat, target: TaskStorageTarget, options?: ITaskRunOptions): Promise; createAndAddTask(label: string | undefined, command: string, session: ISession | IChat, target: TaskStorageTarget, options?: ITaskRunOptions): Promise; updateTask(originalTaskLabel: string, updatedTask: ITaskEntry, session: ISession | IChat, currentTarget: TaskStorageTarget, newTarget: TaskStorageTarget): Promise; removeTask(taskLabel: string, session: ISession | IChat, target: TaskStorageTarget): Promise; runTask(task: ITaskEntry, session: ISession, chat?: IChat): Promise; getPinnedTaskLabel(repository: URI | undefined): IObservable; setPinnedTaskLabel(repository: URI | undefined, taskLabel: string | undefined): void; getBrowserUrl(repository: URI | undefined): IObservable; setBrowserUrl(repository: URI | undefined, url: string | undefined): void; getPinnedBrowser(repository: URI | undefined): IObservable; setPinnedBrowser(repository: URI | undefined, pinned: boolean): void; private _getSessionRepo; private _getSessionFolder; private _getTasksJsonUri; private _getWorkspaceTasksJsonUri; private _getUserTasksJsonUri; private _readTasksJson; private _isSupportedTask; private _createFolderTasks; private _getUserTasks; private _watchUserTasks; dispose(): void; private _readTasks; private _loadPinnedTaskLabels; private _savePinnedTaskLabels; private _setPinnedTaskLabelForKey; private _loadBrowserUrls; private _saveBrowserUrls; private _loadPinnedBrowsers; private _savePinnedBrowsers; private _setPinnedBrowserForKey; } export {};