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 { equals as objectEquals } from '../../../base/common/objects.js';
7
>
import { URI } from '../../../base/common/uri.js';
8
>
import { Emitter } from '../../../base/common/event.js';
9
>
import { ILogService } from '../../log/common/log.js';
10
>
import { IAgentHostGitStateService, META_GIT_STATE, META_GITHUB_STATE } from '../common/agentHostGitStateService.js';
11
>
import { ISessionGitHubState, readSessionGitHubState, readSessionGitState, SessionLifecycle, withSessionGitHubState, withSessionGitState, type ISessionGitState } from '../common/state/sessionState.js';
12
>
import { IAgentHostGitService } from '../common/agentHostGitService.js';
13
>
import { AgentHostStateManager, IAgentHostStateManager } from './agentHostStateManager.js';
14
>
import { ISessionDataService } from '../common/sessionDataService.js';
15
>
import { IAgentHostOctoKitService } from './shared/agentHostOctoKitService.js';
16
>
import { IAgentService } from '../common/agentService.js';
17
>
import { IAgentHostGitHubEndpointService } from './agentHostGitHubEndpointService.js';
18
>
import { Disposable, toDisposable } from '../../../base/common/lifecycle.js';
19
>
import { CancellationTokenSource } from '../../../base/common/cancellation.js';
20
>
import { ThrottlerByKey, timeout } from '../../../base/common/async.js';
21
>
import { isCancellationError } from '../../../base/common/errors.js';
22
>
23
>
export class AgentHostGitStateService extends Disposable implements IAgentHostGitStateService {
24
>
declare readonly _serviceBrand: undefined;
25
>
26
>
private readonly _onDidRefreshSessionGitState = this._register(new Emitter<string>());
27
>
readonly onDidRefreshSessionGitState = this._onDidRefreshSessionGitState.event;
28
>
29
>
private readonly _gitStateRefreshThrottler = this._register(new ThrottlerByKey<string>());
30
>
private readonly _gitStateRefreshCancellationTokenSource = new CancellationTokenSource();
31
>
32
>
constructor(
33
@IAgentHostStateManager private readonly _stateManager: AgentHostStateManager,
34
@IAgentHostGitService private readonly _gitService: IAgentHostGitService,