import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { IRequestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service"; import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service"; import { IAuthenticationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service"; import { IPluginGitService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/pluginGitService.service"; /** * Browser implementation of {@link IPluginGitService}. * * `git` is not available in the browser, so plugin contents are reconstructed * from the GitHub REST API: `/git/trees/{sha}?recursive=1` for the listing and * `/git/blobs/{blob_sha}` for each file's bytes. Both live on `api.github.com`, * which is the only GitHub host that handles CORS with auth headers — the * `/tarball/` endpoint redirects to `codeload.github.com` (no CORS) and * `raw.githubusercontent.com` rejects the OPTIONS preflight forced by * `Authorization: Bearer`. * * Only HTTPS GitHub clone URLs are supported; everything else throws an * actionable localized error pointing at desktop or a remote agent host. * * Per-target metadata is persisted via {@link IStorageService} so `revParse` * answers locally, `pull()` skips the re-download when the upstream SHA has * not moved, and the persisted SHA feeds `CustomizationRef.nonce` for AHP * dedupe. */ export declare class BrowserPluginGitCommandService implements IPluginGitService { private readonly _fileService; private readonly _logService; private readonly _requestService; private readonly _storageService; private readonly _authenticationService; readonly _serviceBrand: undefined; private _cache; constructor(_fileService: IFileService, _logService: ILogService, _requestService: IRequestService, _storageService: IStorageService, _authenticationService: IAuthenticationService); cloneRepository(cloneUrl: string, targetDir: URI, ref?: string, token?: CancellationToken): Promise; pull(repoDir: URI, token?: CancellationToken): Promise; checkout(repoDir: URI, treeish: string, _detached?: boolean, token?: CancellationToken): Promise; revParse(repoDir: URI, ref: string): Promise; fetch(_repoDir: URI, _token?: CancellationToken): Promise; fetchRepository(_repoDir: URI, _token?: CancellationToken): Promise; revListCount(_repoDir: URI, _fromRef: string, _toRef: string): Promise; private _parseOrThrow; private _maybeLogTransientError; /** * Best-effort silent lookup of an existing GitHub session token. Returns * `undefined` when no session is available; callers fall back to anonymous, * which still works for public repos. Prefers a `repo`-scoped session when * multiple are present (e.g. EMU + personal). */ private _lookupGitHubToken; private _requestGitHubToken; private _cacheKey; private _pruneStaleEntries; private _ensureCacheLoaded; private _getCacheEntry; private _setCacheEntry; private _persistCache; }