2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { CancellationToken } from '../../../base/common/cancellation.js';
7
>
import { toErrorMessage } from '../../../base/common/errorMessage.js';
8
>
import { Disposable, DisposableMap, toDisposable, type IDisposable } from '../../../base/common/lifecycle.js';
9
>
import { parseChangesetUri } from '../common/changesetUri.js';
10
>
import type { InvokeChangesetOperationParams, InvokeChangesetOperationResult } from '../common/state/protocol/channels-changeset/commands.js';
11
>
import { AHP_SESSION_NOT_FOUND, JsonRpcErrorCodes, ProtocolError } from '../common/state/sessionProtocol.js';
12
>
import { ActionType } from '../common/state/sessionActions.js';
13
>
import { ChangesetOperationScope, ChangesetOperationStatus, ChangesetOperationTargetKind, ISessionGitHubState, readSessionGitHubState, readSessionGitState, type ChangesetOperation, type ErrorInfo, type ISessionGitState } from '../common/state/sessionState.js';
14
>
import type { IChangesetOperationContribution, IAgentHostChangesetOperationService, IChangesetOperationContext, IChangesetOperationHandler, IChangesetOperationRegistry } from '../common/agentHostChangesetOperationService.js';
15
>
import { AgentHostStateManager, IAgentHostStateManager } from './agentHostStateManager.js';
16
>
import { IAgentHostChangesetSubscriptionService } from '../common/agentHostChangesetSubscriptionService.js';
17
>
import { IAgentHostGitStateService } from '../common/agentHostGitStateService.js';
18
>
19
>
export class AgentHostChangesetOperationService extends Disposable implements IAgentHostChangesetOperationService {
20
>
declare readonly _serviceBrand: undefined;
21
>
22
>
private readonly _registry: IChangesetOperationRegistry;
23
>
private readonly _handlerRegistrations = this._register(new DisposableMap<IChangesetOperationContribution>());
24
>
private readonly _changesetOperationHandlers = new Map<string, IChangesetOperationHandler>();
25
>
private readonly _inFlightOperations = new Map<string, Promise<InvokeChangesetOperationResult>>();
26
>
27
>
constructor(
28
@IAgentHostStateManager private readonly _stateManager: AgentHostStateManager,
29
@IAgentHostGitStateService private readonly _gitStateService: IAgentHostGitStateService,