import { CancellationToken } from "../../../../../base/common/cancellation.js"; import { Event } from "../../../../../base/common/event.js"; import { Disposable, type IReference } from "../../../../../base/common/lifecycle.js"; import { type IObservable } from "../../../../../base/common/observable.js"; import { URI } from "../../../../../base/common/uri.js"; import { type IAgentConnection } from "../../../../../platform/agentHost/common/agentService.js"; import { type IAgentSubscription } from "../../../../../platform/agentHost/common/state/agentSubscription.js"; import { type AutomationState } from "../../../../../platform/agentHost/common/state/protocol/state.js"; import { StateComponents } from "../../../../../platform/agentHost/common/state/sessionState.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IStorageService } from "../../../../../platform/storage/common/storage.service.js"; import { IAgentHostActiveClientService } from "../../../../../workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.service.js"; import { type AutomationTarget, type IAutomationDescriptor, type IAutomationRun } from "../../../../../workbench/contrib/chat/common/automations/automation.js"; import { type AutomationCatalogueState, type AutomationHistoryState, type AutomationMutationGuard, type IAutomationCustomizationChoice, type IAutomationRunRequestResult, type ICreateAutomationOptions, type IGuardedAutomationUpdateResult, type IUpdateAutomationOptions, type IDeleteAutomationOptions } from "../../../../../workbench/contrib/chat/common/automations/automationService.js"; import type { ISessionsProviderAutomations } from "../../../../services/sessions/common/sessionsProvider.js"; /** The AHP connection surface for Automation catalogue subscriptions and commands. */ export type IAgentHostAutomationConnection = Pick & { getSubscription(kind: StateComponents.AutomationCatalog, resource: URI, owner: string): IReference>; }; /** Translation between host-local resources and editor-facing provider identities. */ export interface IAgentHostAutomationBoundaryMapper { toHost(resource: URI): URI; fromHost(resource: URI): URI; resourceSchemeForProvider(provider: string): string; sessionResource?(resource: URI): URI | undefined; /** Exact advertised backend identity; undefined until this host resolves the archived session. */ resolveBackendSession?(resource: URI): URI | undefined; readonly onDidChangeSessionResolution?: Event; providerForSessionScheme?(scheme: string): string; providerForResourceScheme?(scheme: string): string | undefined; } /** * Connection-scoped projection of one host's Automation catalogue, forwarding definition and manual-run requests over AHP. * The host retains scheduling, execution, persistence, and run-lifecycle authority. */ export declare class AgentHostAutomationStore extends Disposable implements ISessionsProviderAutomations { private readonly _providerId; private readonly _connection; private readonly _boundaryMapper; private readonly _logService; private readonly _storageService; private readonly _activeClientService; private readonly _catalogReference; private readonly _catalog; private readonly _catalogChanged; private readonly _catalogError; private readonly _runsForCache; private readonly _pendingWaits; private _pendingWaitIds; private readonly _archiveKey; private readonly _archivedRuns; private readonly _cleanupKey; private readonly _deletionRequestKey; private readonly _deletingResources; private readonly _historyDeletionChanged; private readonly _historyDeletionPromises; readonly automations: IObservable; /** Authoritative host runs, including those of retained history owners, merged with historical archive rows. */ readonly runs: IObservable; readonly catalogueState: IObservable; readonly canCreateAutomation: import("../../../../../base/common/observable.js").IObservableWithChange; constructor(_providerId: string, _connection: IAgentHostAutomationConnection, _boundaryMapper: IAgentHostAutomationBoundaryMapper | undefined, _logService: ILogService, _storageService: IStorageService, _activeClientService: IAgentHostActiveClientService); getAutomation(id: string): IAutomationDescriptor | undefined; getAutomationHistoryName(id: string): string | undefined; getAutomationHistoryState(id: string): AutomationHistoryState | undefined; canRunAutomation(automationId: string): boolean; canUpdateAutomation(automationId: string): boolean; canDeleteAutomation(automationId: string): boolean; canDeleteAutomationHistory(automationId: string): boolean; supportsDeleteHistoryChoice(automationId: string): boolean; runsFor(automationId: string): IObservable; createAutomation(options: ICreateAutomationOptions, mutationGuard?: AutomationMutationGuard): Promise; updateAutomation(id: string, patch: IUpdateAutomationOptions, mutationGuard?: AutomationMutationGuard): Promise; updateAutomationIfUnchanged(id: string, patch: IUpdateAutomationOptions, expected: IAutomationDescriptor, mutationGuard?: AutomationMutationGuard): Promise; getCustomizationChoices(target: AutomationTarget, existingId: string | undefined, token: CancellationToken): Promise; private _customizationLabel; deleteAutomation(id: string, mutationGuard?: AutomationMutationGuard, options?: IDeleteAutomationOptions): Promise; private _deleteWithHistoryChoice; deleteAutomationHistory(id: string): Promise; private _coalesceHistoryDeletion; private _doExecuteHistoryDeletion; runAutomation(automationId: string, token?: CancellationToken): Promise; private _projectSessionResource; getActiveRunFor(automationId: string): IAutomationRun | undefined; private _projectAutomations; private _projectRuns; private _projectAutomation; private _projectTarget; private _projectRun; private _findAutomationEntry; private _resourceId; private _requireAutomation; private _operationAvailable; private _requireOperation; private _requireProjectedAutomation; private _createDescriptor; private _replaceDescriptor; private _isCustomizationTargetUnchanged; private _acquireCustomizationScope; private _captureCustomizations; private _definitionFromDescriptor; private _toHostModelId; private _providerFromModelId; private _projectModelId; private _applyPatch; private _dispatchAndWait; private _waitForCatalog; private _prepareArchiveCleanup; private _createHistoryDeletionRequest; private _resumeHistoryDeletion; private _readHistoryDeletionRequests; private _requireHistoryDeletionRequests; private _writeHistoryDeletionRequests; private _recordArchiveCleanupIntent; private _readCleanupIntents; private _writeCleanupIntents; private _reconcileArchiveCleanup; private _removeArchivedRows; private _loadArchivedRuns; }