@gitkraken/core-gitlens 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/dist/git/cache.d.ts +31 -0
- package/dist/git/cache.js +101 -30
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +3 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/errors.d.ts +3 -1
- package/dist/git/errors.js +4 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +90 -1
- package/dist/git/models/pullRequest.js +18 -2
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/providers/shared/remotes.js +2 -0
- package/dist/git/providers/shared/remotes.js.map +1 -1
- package/dist/git/utils/pullRequest.utils.d.ts +72 -1
- package/dist/git/utils/pullRequest.utils.js +99 -1
- package/dist/git/utils/pullRequest.utils.js.map +1 -1
- package/dist/git/utils/repository.utils.d.ts +6 -0
- package/dist/git/utils/repository.utils.js +14 -2
- package/dist/git/utils/repository.utils.js.map +1 -1
- package/dist/git/watching/gitDirPoller.d.ts +10 -1
- package/dist/git/watching/gitDirPoller.js +9 -3
- package/dist/git/watching/gitDirPoller.js.map +1 -1
- package/dist/git/watching/unwatchedCacheValidator.d.ts +144 -0
- package/dist/git/watching/unwatchedCacheValidator.js +884 -0
- package/dist/git/watching/unwatchedCacheValidator.js.map +1 -0
- package/dist/git/watching/watchGroup.d.ts +2 -0
- package/dist/git/watching/watchGroup.js +4 -8
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +23 -0
- package/dist/git/watching/watchService.js +42 -2
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +2 -0
- package/dist/git/watching/watchSession.js +3 -2
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git-cli/cliGitProvider.js +1 -1
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/commandClassifier.d.ts +31 -1
- package/dist/git-cli/exec/commandClassifier.js +67 -16
- package/dist/git-cli/exec/commandClassifier.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +46 -2
- package/dist/git-cli/exec/git.js +80 -7
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitDirResolver.d.ts +11 -0
- package/dist/git-cli/exec/gitDirResolver.js +34 -1
- package/dist/git-cli/exec/gitDirResolver.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.js +2 -28
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +1 -0
- package/dist/git-cli/providers/branches.js +6 -0
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +13 -1
- package/dist/git-cli/providers/config.js +48 -14
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +1 -0
- package/dist/git-cli/providers/pausedOperations.js +4 -0
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/revision.js +2 -0
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/git-cli/providers/worktrees.js +2 -0
- package/dist/git-cli/providers/worktrees.js.map +1 -1
- package/dist/git-cli/service.d.ts +25 -1
- package/dist/git-cli/service.js +45 -0
- package/dist/git-cli/service.js.map +1 -1
- package/dist/plus/ai/errors.d.ts +8 -2
- package/dist/plus/ai/errors.js +15 -3
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/git-github/api/config.d.ts +11 -0
- package/dist/plus/git-github/api/config.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +82 -1
- package/dist/plus/git-github/api/github.js +304 -7
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/models.d.ts +61 -1
- package/dist/plus/git-github/models.js +49 -3
- package/dist/plus/git-github/models.js.map +1 -1
- package/dist/plus/integrations/context.d.ts +12 -0
- package/dist/plus/integrations/fieldPresence.d.ts +16 -1
- package/dist/plus/integrations/fieldPresence.js +37 -10
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +12 -0
- package/dist/plus/integrations/integrationService.js +4 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +38 -0
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +41 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +51 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +23 -2
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/github/github.js +2 -1
- package/dist/plus/integrations/providers/github/github.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +21 -1
- package/dist/plus/integrations/providers/github.js +71 -6
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/reads/context.d.ts +7 -0
- package/dist/plus/integrations/reads/drains.d.ts +1 -1
- package/dist/plus/integrations/reads/drains.js +2 -1
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/etag.js +13 -0
- package/dist/plus/integrations/reads/etag.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBatch.d.ts +6 -2
- package/dist/plus/integrations/reads/pullRequestBatch.js +9 -2
- package/dist/plus/integrations/reads/pullRequestBatch.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequestBranches.d.ts +2 -0
- package/dist/plus/integrations/reads/pullRequestBranches.js +3 -1
- package/dist/plus/integrations/reads/pullRequestBranches.js.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.d.ts +2 -0
- package/dist/plus/integrations/reads/pullRequests.js +2 -1
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.d.ts +2 -0
- package/dist/plus/integrations/reads/searchPullRequests.js +2 -1
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/docs/integrations.md +77 -15
- package/package.json +1 -1
|
@@ -22,7 +22,11 @@ export interface CliGitServiceOptions {
|
|
|
22
22
|
locator?: () => Promise<GitLocation>;
|
|
23
23
|
/** Host-provided context hooks (cache events, workspace, integrations, telemetry, fs) */
|
|
24
24
|
context: CliGitProviderOptions['context'];
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Git execution options passed through to the underlying Git executor. `gitOptions.isTrusted(repoPath)` is the
|
|
27
|
+
* per-repository trust gate: a `false` answer rejects git runs in that path with `WorkspaceUntrustedError` before
|
|
28
|
+
* any process starts. It applies only when `context.workspace.isTrusted` is unset; that flag wins when present.
|
|
29
|
+
*/
|
|
26
30
|
gitOptions?: CliGitProviderOptions['gitOptions'];
|
|
27
31
|
/** Use an existing Cache instance, or one will be created */
|
|
28
32
|
cache?: CliGitProviderOptions['cache'];
|
|
@@ -40,6 +44,26 @@ export interface CliGitServiceOptions {
|
|
|
40
44
|
* watcher is asked.
|
|
41
45
|
*/
|
|
42
46
|
watchPolling?: WatchPollingOptions;
|
|
47
|
+
/**
|
|
48
|
+
* Keeps the caches that never expire (branches, current branch, refs, tags, remotes, worktrees, stashes, gk config,
|
|
49
|
+
* paused operation, and what derives from them) fresh for repositories whose `.git` directory nothing watches:
|
|
50
|
+
* before such a read, stats the files a watcher would have reported, and lists the ref directories and worktree
|
|
51
|
+
* admin entries, applying what moved as a watcher event would. Files git writes by rename are read only once the
|
|
52
|
+
* directory they're in moved, so a read of an idle repository costs a stat per git dir, per ref directory, per
|
|
53
|
+
* linked worktree and per file git writes in place, at most once per 250ms per repository; a watched one costs
|
|
54
|
+
* nothing, unless its watch is suspended, which holds what it hears until it resumes. Never runs git: a repository
|
|
55
|
+
* whose git dir nothing resolved yet is read from its own files, and one whose files can't show it (bare, a
|
|
56
|
+
* submodule, `--separate-git-dir`, `core.worktree`) isn't validated until a read resolves it, its files looked at
|
|
57
|
+
* again every 30 seconds. What moves in a worktree under an {@link ignoredWorktreeFolders} folder clears nothing. Without a
|
|
58
|
+
* {@link watchingProvider}, every repository counts as unwatched. A read waits at most `timeoutMs` (default 1000)
|
|
59
|
+
* for the stats, then is served from the cache, and the stats run one at a time per repository and two at once
|
|
60
|
+
* overall. A stat on a hung mount holds one of Node's file-system threads until it returns; one outstanding past
|
|
61
|
+
* `timeoutMs` lets other repositories' stats go on, as long as the stats hold all but two of the threads
|
|
62
|
+
* (`UV_THREADPOOL_SIZE`, default 4), which leaves the host two. Off by default.
|
|
63
|
+
*/
|
|
64
|
+
validateUnwatchedCaches?: boolean | {
|
|
65
|
+
readonly timeoutMs?: number;
|
|
66
|
+
};
|
|
43
67
|
/** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */
|
|
44
68
|
verifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];
|
|
45
69
|
}
|
package/dist/git-cli/service.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { fileUri } from "../utils/uri.js";
|
|
2
|
+
import { isNotFound } from "../git/watching/watchGroup.js";
|
|
2
3
|
import { GitService } from "../git/service.js";
|
|
3
4
|
import { CliGitProvider } from "./cliGitProvider.js";
|
|
5
|
+
import { UnwatchedCacheValidator } from "../git/watching/unwatchedCacheValidator.js";
|
|
4
6
|
import { findGitPath } from "./exec/locator.js";
|
|
7
|
+
import { env } from "node:process";
|
|
5
8
|
//#region ../git-cli/src/service.ts
|
|
6
9
|
/**
|
|
7
10
|
* Creates a ready-to-use {@link GitService} backed by the CLI git provider.
|
|
@@ -39,6 +42,43 @@ function createCliGitService(options) {
|
|
|
39
42
|
refreshIndexAfterWrites: options.refreshIndexAfterWrites
|
|
40
43
|
});
|
|
41
44
|
service.register(provider, () => true);
|
|
45
|
+
if (options.validateUnwatchedCaches) {
|
|
46
|
+
const fs = options.context.fs;
|
|
47
|
+
const validator = new UnwatchedCacheValidator({
|
|
48
|
+
cache: provider.cache,
|
|
49
|
+
timeoutMs: typeof options.validateUnwatchedCaches === "object" ? options.validateUnwatchedCaches.timeoutMs : void 0,
|
|
50
|
+
maxFsThreads: getThreadPoolSize() - 2,
|
|
51
|
+
stat: async (path) => {
|
|
52
|
+
try {
|
|
53
|
+
const stat = await fs.stat(fileUri(path));
|
|
54
|
+
return stat != null ? {
|
|
55
|
+
mtime: stat.mtime,
|
|
56
|
+
size: stat.size
|
|
57
|
+
} : void 0;
|
|
58
|
+
} catch (ex) {
|
|
59
|
+
if (isNotFound(ex)) return void 0;
|
|
60
|
+
throw ex;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
readDirectory: (path) => fs.readDirectory(fileUri(path)),
|
|
64
|
+
readFile: async (path) => {
|
|
65
|
+
try {
|
|
66
|
+
return await fs.readFile(fileUri(path));
|
|
67
|
+
} catch (ex) {
|
|
68
|
+
if (isNotFound(ex)) return void 0;
|
|
69
|
+
throw ex;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
getIgnoredWorktreeRoots: (repoPath) => provider.cache.gitDir.get(repoPath) != null ? provider.getIgnoredWorktreeRoots(repoPath) : Promise.resolve([]),
|
|
73
|
+
resolveGitDir: (repoPath) => provider.config.resolveGitDirWithoutGit(repoPath),
|
|
74
|
+
isWatched: (repoPath) => service.watchService?.isRepoWatched(repoPath) ?? false
|
|
75
|
+
});
|
|
76
|
+
provider.cache.setReadValidator((repoPath) => validator.validate(repoPath), () => validator.getResourceUsage());
|
|
77
|
+
service.watchService?.onDidChangeRepoWatched((e) => {
|
|
78
|
+
if (e.watched) validator.onWatched(e.repoPath);
|
|
79
|
+
else validator.onUnwatched(e.repoPath);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
42
82
|
service.watchService?.onDidChangeWorkingTree((repoPath) => provider.cache.onWorkingTreeChanged(repoPath));
|
|
43
83
|
service.watchService?.onDidChangeRepository((e) => {
|
|
44
84
|
const changes = e.getUnannouncedChanges();
|
|
@@ -47,6 +87,11 @@ function createCliGitService(options) {
|
|
|
47
87
|
service.watchService?.onDidChangeFetchHead((repoPath) => provider.cache.onRepositoryChanged(repoPath, ["lastFetched"]));
|
|
48
88
|
return service;
|
|
49
89
|
}
|
|
90
|
+
/** The size of libuv's thread pool, which runs Node's file-system calls, as libuv reads it at its first use */
|
|
91
|
+
function getThreadPoolSize() {
|
|
92
|
+
const size = Number.parseInt(env.UV_THREADPOOL_SIZE ?? "", 10);
|
|
93
|
+
return Number.isNaN(size) ? 4 : Math.min(Math.max(size, 1), 1024);
|
|
94
|
+
}
|
|
50
95
|
//#endregion
|
|
51
96
|
export { createCliGitService };
|
|
52
97
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","names":[],"sources":["../../../git-cli/src/service.ts"],"sourcesContent":["import { GitService } from '@gitlens/git/service.js';\nimport type { FileWatchingProvider } from '@gitlens/git/watching/provider.js';\nimport type { WatchPollingOptions } from '@gitlens/git/watching/watchService.js';\nimport type { WorktreeSummaryServiceOptions } from '@gitlens/git/watching/worktreeSummary.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderOptions } from './cliGitProvider.js';\nimport { CliGitProvider } from './cliGitProvider.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { findGitPath } from './exec/locator.js';\n\n/**\n * Options for {@link createCliGitService}.\n */\nexport interface CliGitServiceOptions {\n\t/**\n\t * Path(s) to the git binary.\n\t * Auto-detected if omitted (searches PATH, platform-specific locations).\n\t * Ignored when {@link locator} is provided.\n\t */\n\tgitPath?: string | string[];\n\n\t/**\n\t * Custom git binary resolver. When provided, used instead of the\n\t * default `findGitPath(gitPath)` lookup.\n\t */\n\tlocator?: () => Promise<GitLocation>;\n\n\t/** Host-provided context hooks (cache events, workspace, integrations, telemetry, fs) */\n\tcontext: CliGitProviderOptions['context'];\n\n\t/** Git execution options passed through to the underlying Git executor */\n\tgitOptions?: CliGitProviderOptions['gitOptions'];\n\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: CliGitProviderOptions['cache'];\n\n\t/** Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist */\n\tignoredWorktreeFolders?: CliGitProviderOptions['ignoredWorktreeFolders'];\n\n\t/** Refreshes a checkout's index after core's own writes rewrote it (see `CliGitProviderOptions`); off by default */\n\trefreshIndexAfterWrites?: CliGitProviderOptions['refreshIndexAfterWrites'];\n\n\t/**\n\t * Filesystem watching provider. When provided, the {@link GitService}\n\t * will watch repositories for changes (file creates, edits, deletes).\n\t */\n\twatchingProvider?: FileWatchingProvider;\n\n\t/**\n\t * Polls in place of (or beside) the watchers {@link watchingProvider} reports it can't trust. When omitted, no\n\t * watcher is asked.\n\t */\n\twatchPolling?: WatchPollingOptions;\n\n\t/** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */\n\tverifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];\n}\n\n/**\n * Creates a ready-to-use {@link GitService} backed by the CLI git provider.\n *\n * This is the primary entry point for standalone (non-VS Code) consumers\n * of the `@gitlens/git-cli` library. It creates a singleton {@link GitService},\n * wires up a {@link CliGitProvider}, and registers it for all repository paths.\n *\n * @example\n * ```typescript\n * const git = createCliGitService({ context: {} });\n *\n * const repo = git.forRepo('/path/to/repo')!;\n * const branches = await repo.branches.getBranches();\n * const status = await repo.status.getStatus();\n * await repo.ops!.fetch({ remote: 'origin' });\n *\n * git.dispose(); // cleans up provider, cache, and module-level state\n * ```\n */\nexport function createCliGitService(options: CliGitServiceOptions): GitService {\n\tconst service = GitService.createSingleton(options.watchingProvider, {\n\t\twatchPolling: options.watchPolling,\n\t\tverifyBaseRemeasure: options.verifyBaseRemeasure,\n\t\t// The host's file system reads the shared `.git/config` the watch service compares reports of\n\t\treadFile: path => options.context.fs.readFile(fileUri(path)),\n\t\t// And lists the directory the admin entries of its worktrees are in\n\t\treadDirectory: path => options.context.fs.readDirectory(fileUri(path)),\n\t});\n\n\tconst locator = options.locator ?? (() => findGitPath(options.gitPath ?? null));\n\tconst provider = new CliGitProvider({\n\t\tcontext: options.context,\n\t\tlocator: locator,\n\t\tgitOptions: options.gitOptions,\n\t\tcache: options.cache,\n\t\tignoredWorktreeFolders: options.ignoredWorktreeFolders,\n\t\trefreshIndexAfterWrites: options.refreshIndexAfterWrites,\n\t});\n\n\tservice.register(provider, () => true);\n\n\t// Advance the provider cache's status generation clock from the watch session's global events — the standalone\n\t// analogue of what the VS Code host wires in `GitProviderService`. Without this, a consumer that passes a\n\t// `watchingProvider` and drives watch sessions gets FS events but a FROZEN clock, so `dedupeByStatusGeneration`\n\t// degrades to the pre-change/post-change stale-join this branch exists to fix. Standalone has no `Repository`\n\t// models, so there are no force-fired `closed`/`lastFetched` bypassing the session for the global repo event to\n\t// miss. Subscriptions are torn down with the service (its `watchService`'s emitters are disposed on dispose).\n\tservice.watchService?.onDidChangeWorkingTree(repoPath => provider.cache.onWorkingTreeChanged(repoPath));\n\t// Announced kinds were evicted when core announced its write; evicting them again would discard what the host\n\t// re-read since\n\tservice.watchService?.onDidChangeRepository(e => {\n\t\tconst changes = e.getUnannouncedChanges();\n\t\tif (changes.length) {\n\t\t\tprovider.cache.onRepositoryChanged(e.repoPath, changes, { movedWorktrees: e.movedWorktrees });\n\t\t}\n\t});\n\t// FETCH_HEAD maps to no session change, and there's no `Repository` model here to force-fire `lastFetched` (as\n\t// the VS Code host does), so bridge it straight to the cache or the last-fetched time is never re-read.\n\tservice.watchService?.onDidChangeFetchHead(repoPath =>\n\t\tprovider.cache.onRepositoryChanged(repoPath, ['lastFetched']),\n\t);\n\treturn service;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6EA,SAAgB,oBAAoB,SAA2C;CAC9E,MAAM,UAAU,WAAW,gBAAgB,QAAQ,kBAAkB;EACpE,cAAc,QAAQ;EACtB,qBAAqB,QAAQ;EAE7B,WAAU,SAAQ,QAAQ,QAAQ,GAAG,SAAS,QAAQ,IAAI,CAAC;EAE3D,gBAAe,SAAQ,QAAQ,QAAQ,GAAG,cAAc,QAAQ,IAAI,CAAC;CACtE,CAAC;CAED,MAAM,UAAU,QAAQ,kBAAkB,YAAY,QAAQ,WAAW,IAAI;CAC7E,MAAM,WAAW,IAAI,eAAe;EACnC,SAAS,QAAQ;EACR;EACT,YAAY,QAAQ;EACpB,OAAO,QAAQ;EACf,wBAAwB,QAAQ;EAChC,yBAAyB,QAAQ;CAClC,CAAC;CAED,QAAQ,SAAS,gBAAgB,IAAI;CAQrC,QAAQ,cAAc,wBAAuB,aAAY,SAAS,MAAM,qBAAqB,QAAQ,CAAC;CAGtG,QAAQ,cAAc,uBAAsB,MAAK;EAChD,MAAM,UAAU,EAAE,sBAAsB;EACxC,IAAI,QAAQ,QACX,SAAS,MAAM,oBAAoB,EAAE,UAAU,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAC;CAE9F,CAAC;CAGD,QAAQ,cAAc,sBAAqB,aAC1C,SAAS,MAAM,oBAAoB,UAAU,CAAC,aAAa,CAAC,CAC7D;CACA,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"service.js","names":[],"sources":["../../../git-cli/src/service.ts"],"sourcesContent":["import { env } from 'node:process';\nimport { GitService } from '@gitlens/git/service.js';\nimport type { FileWatchingProvider } from '@gitlens/git/watching/provider.js';\nimport { UnwatchedCacheValidator } from '@gitlens/git/watching/unwatchedCacheValidator.js';\nimport { isNotFound } from '@gitlens/git/watching/watchGroup.js';\nimport type { WatchPollingOptions } from '@gitlens/git/watching/watchService.js';\nimport type { WorktreeSummaryServiceOptions } from '@gitlens/git/watching/worktreeSummary.js';\nimport { fileUri } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderOptions } from './cliGitProvider.js';\nimport { CliGitProvider } from './cliGitProvider.js';\nimport type { GitLocation } from './exec/locator.js';\nimport { findGitPath } from './exec/locator.js';\n\n/**\n * Options for {@link createCliGitService}.\n */\nexport interface CliGitServiceOptions {\n\t/**\n\t * Path(s) to the git binary.\n\t * Auto-detected if omitted (searches PATH, platform-specific locations).\n\t * Ignored when {@link locator} is provided.\n\t */\n\tgitPath?: string | string[];\n\n\t/**\n\t * Custom git binary resolver. When provided, used instead of the\n\t * default `findGitPath(gitPath)` lookup.\n\t */\n\tlocator?: () => Promise<GitLocation>;\n\n\t/** Host-provided context hooks (cache events, workspace, integrations, telemetry, fs) */\n\tcontext: CliGitProviderOptions['context'];\n\n\t/**\n\t * Git execution options passed through to the underlying Git executor. `gitOptions.isTrusted(repoPath)` is the\n\t * per-repository trust gate: a `false` answer rejects git runs in that path with `WorkspaceUntrustedError` before\n\t * any process starts. It applies only when `context.workspace.isTrusted` is unset; that flag wins when present.\n\t */\n\tgitOptions?: CliGitProviderOptions['gitOptions'];\n\n\t/** Use an existing Cache instance, or one will be created */\n\tcache?: CliGitProviderOptions['cache'];\n\n\t/** Folders, relative to a repository's common git dir, whose worktrees core acts as if didn't exist */\n\tignoredWorktreeFolders?: CliGitProviderOptions['ignoredWorktreeFolders'];\n\n\t/** Refreshes a checkout's index after core's own writes rewrote it (see `CliGitProviderOptions`); off by default */\n\trefreshIndexAfterWrites?: CliGitProviderOptions['refreshIndexAfterWrites'];\n\n\t/**\n\t * Filesystem watching provider. When provided, the {@link GitService}\n\t * will watch repositories for changes (file creates, edits, deletes).\n\t */\n\twatchingProvider?: FileWatchingProvider;\n\n\t/**\n\t * Polls in place of (or beside) the watchers {@link watchingProvider} reports it can't trust. When omitted, no\n\t * watcher is asked.\n\t */\n\twatchPolling?: WatchPollingOptions;\n\n\t/**\n\t * Keeps the caches that never expire (branches, current branch, refs, tags, remotes, worktrees, stashes, gk config,\n\t * paused operation, and what derives from them) fresh for repositories whose `.git` directory nothing watches:\n\t * before such a read, stats the files a watcher would have reported, and lists the ref directories and worktree\n\t * admin entries, applying what moved as a watcher event would. Files git writes by rename are read only once the\n\t * directory they're in moved, so a read of an idle repository costs a stat per git dir, per ref directory, per\n\t * linked worktree and per file git writes in place, at most once per 250ms per repository; a watched one costs\n\t * nothing, unless its watch is suspended, which holds what it hears until it resumes. Never runs git: a repository\n\t * whose git dir nothing resolved yet is read from its own files, and one whose files can't show it (bare, a\n\t * submodule, `--separate-git-dir`, `core.worktree`) isn't validated until a read resolves it, its files looked at\n\t * again every 30 seconds. What moves in a worktree under an {@link ignoredWorktreeFolders} folder clears nothing. Without a\n\t * {@link watchingProvider}, every repository counts as unwatched. A read waits at most `timeoutMs` (default 1000)\n\t * for the stats, then is served from the cache, and the stats run one at a time per repository and two at once\n\t * overall. A stat on a hung mount holds one of Node's file-system threads until it returns; one outstanding past\n\t * `timeoutMs` lets other repositories' stats go on, as long as the stats hold all but two of the threads\n\t * (`UV_THREADPOOL_SIZE`, default 4), which leaves the host two. Off by default.\n\t */\n\tvalidateUnwatchedCaches?: boolean | { readonly timeoutMs?: number };\n\n\t/** For tests only; production never passes it (see `WorktreeSummaryServiceOptions.verifyBaseRemeasure`) */\n\tverifyBaseRemeasure?: WorktreeSummaryServiceOptions['verifyBaseRemeasure'];\n}\n\n/**\n * Creates a ready-to-use {@link GitService} backed by the CLI git provider.\n *\n * This is the primary entry point for standalone (non-VS Code) consumers\n * of the `@gitlens/git-cli` library. It creates a singleton {@link GitService},\n * wires up a {@link CliGitProvider}, and registers it for all repository paths.\n *\n * @example\n * ```typescript\n * const git = createCliGitService({ context: {} });\n *\n * const repo = git.forRepo('/path/to/repo')!;\n * const branches = await repo.branches.getBranches();\n * const status = await repo.status.getStatus();\n * await repo.ops!.fetch({ remote: 'origin' });\n *\n * git.dispose(); // cleans up provider, cache, and module-level state\n * ```\n */\nexport function createCliGitService(options: CliGitServiceOptions): GitService {\n\tconst service = GitService.createSingleton(options.watchingProvider, {\n\t\twatchPolling: options.watchPolling,\n\t\tverifyBaseRemeasure: options.verifyBaseRemeasure,\n\t\t// The host's file system reads the shared `.git/config` the watch service compares reports of\n\t\treadFile: path => options.context.fs.readFile(fileUri(path)),\n\t\t// And lists the directory the admin entries of its worktrees are in\n\t\treadDirectory: path => options.context.fs.readDirectory(fileUri(path)),\n\t});\n\n\tconst locator = options.locator ?? (() => findGitPath(options.gitPath ?? null));\n\tconst provider = new CliGitProvider({\n\t\tcontext: options.context,\n\t\tlocator: locator,\n\t\tgitOptions: options.gitOptions,\n\t\tcache: options.cache,\n\t\tignoredWorktreeFolders: options.ignoredWorktreeFolders,\n\t\trefreshIndexAfterWrites: options.refreshIndexAfterWrites,\n\t});\n\n\tservice.register(provider, () => true);\n\n\tif (options.validateUnwatchedCaches) {\n\t\tconst fs = options.context.fs;\n\t\tconst validator = new UnwatchedCacheValidator({\n\t\t\tcache: provider.cache,\n\t\t\ttimeoutMs:\n\t\t\t\ttypeof options.validateUnwatchedCaches === 'object'\n\t\t\t\t\t? options.validateUnwatchedCaches.timeoutMs\n\t\t\t\t\t: undefined,\n\t\t\tmaxFsThreads: getThreadPoolSize() - 2,\n\t\t\tstat: async path => {\n\t\t\t\ttry {\n\t\t\t\t\tconst stat = await fs.stat(fileUri(path));\n\t\t\t\t\treturn stat != null ? { mtime: stat.mtime, size: stat.size } : undefined;\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\treadDirectory: path => fs.readDirectory(fileUri(path)),\n\t\t\treadFile: async path => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await fs.readFile(fileUri(path));\n\t\t\t\t} catch (ex) {\n\t\t\t\t\tif (isNotFound(ex)) return undefined;\n\n\t\t\t\t\tthrow ex;\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Only for a path whose git dir is cached, which it finds the common git dir from without running git\n\t\t\tgetIgnoredWorktreeRoots: repoPath =>\n\t\t\t\tprovider.cache.gitDir.get(repoPath) != null\n\t\t\t\t\t? provider.getIgnoredWorktreeRoots(repoPath)\n\t\t\t\t\t: Promise.resolve([]),\n\t\t\tresolveGitDir: repoPath => provider.config.resolveGitDirWithoutGit(repoPath),\n\t\t\t// The watch service keys repositories as the cache does (`getRepositoryKey` normalizes a file path alike)\n\t\t\tisWatched: repoPath => service.watchService?.isRepoWatched(repoPath) ?? false,\n\t\t});\n\t\tprovider.cache.setReadValidator(\n\t\t\trepoPath => validator.validate(repoPath),\n\t\t\t() => validator.getResourceUsage(),\n\t\t);\n\t\tservice.watchService?.onDidChangeRepoWatched(e => {\n\t\t\tif (e.watched) {\n\t\t\t\tvalidator.onWatched(e.repoPath);\n\t\t\t} else {\n\t\t\t\tvalidator.onUnwatched(e.repoPath);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Advance the provider cache's status generation clock from the watch session's global events — the standalone\n\t// analogue of what the VS Code host wires in `GitProviderService`. Without this, a consumer that passes a\n\t// `watchingProvider` and drives watch sessions gets FS events but a FROZEN clock, so `dedupeByStatusGeneration`\n\t// degrades to the pre-change/post-change stale-join this branch exists to fix. Standalone has no `Repository`\n\t// models, so there are no force-fired `closed`/`lastFetched` bypassing the session for the global repo event to\n\t// miss. Subscriptions are torn down with the service (its `watchService`'s emitters are disposed on dispose).\n\tservice.watchService?.onDidChangeWorkingTree(repoPath => provider.cache.onWorkingTreeChanged(repoPath));\n\t// Announced kinds were evicted when core announced its write; evicting them again would discard what the host\n\t// re-read since\n\tservice.watchService?.onDidChangeRepository(e => {\n\t\tconst changes = e.getUnannouncedChanges();\n\t\tif (changes.length) {\n\t\t\tprovider.cache.onRepositoryChanged(e.repoPath, changes, { movedWorktrees: e.movedWorktrees });\n\t\t}\n\t});\n\t// FETCH_HEAD maps to no session change, and there's no `Repository` model here to force-fire `lastFetched` (as\n\t// the VS Code host does), so bridge it straight to the cache or the last-fetched time is never re-read.\n\tservice.watchService?.onDidChangeFetchHead(repoPath =>\n\t\tprovider.cache.onRepositoryChanged(repoPath, ['lastFetched']),\n\t);\n\treturn service;\n}\n\n/** The size of libuv's thread pool, which runs Node's file-system calls, as libuv reads it at its first use */\nfunction getThreadPoolSize(): number {\n\tconst size = Number.parseInt(env.UV_THREADPOOL_SIZE ?? '', 10);\n\treturn Number.isNaN(size) ? 4 : Math.min(Math.max(size, 1), 1024);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,SAAgB,oBAAoB,SAA2C;CAC9E,MAAM,UAAU,WAAW,gBAAgB,QAAQ,kBAAkB;EACpE,cAAc,QAAQ;EACtB,qBAAqB,QAAQ;EAE7B,WAAU,SAAQ,QAAQ,QAAQ,GAAG,SAAS,QAAQ,IAAI,CAAC;EAE3D,gBAAe,SAAQ,QAAQ,QAAQ,GAAG,cAAc,QAAQ,IAAI,CAAC;CACtE,CAAC;CAED,MAAM,UAAU,QAAQ,kBAAkB,YAAY,QAAQ,WAAW,IAAI;CAC7E,MAAM,WAAW,IAAI,eAAe;EACnC,SAAS,QAAQ;EACR;EACT,YAAY,QAAQ;EACpB,OAAO,QAAQ;EACf,wBAAwB,QAAQ;EAChC,yBAAyB,QAAQ;CAClC,CAAC;CAED,QAAQ,SAAS,gBAAgB,IAAI;CAErC,IAAI,QAAQ,yBAAyB;EACpC,MAAM,KAAK,QAAQ,QAAQ;EAC3B,MAAM,YAAY,IAAI,wBAAwB;GAC7C,OAAO,SAAS;GAChB,WACC,OAAO,QAAQ,4BAA4B,WACxC,QAAQ,wBAAwB,YAChC,KAAA;GACJ,cAAc,kBAAkB,IAAI;GACpC,MAAM,OAAM,SAAQ;IACnB,IAAI;KACH,MAAM,OAAO,MAAM,GAAG,KAAK,QAAQ,IAAI,CAAC;KACxC,OAAO,QAAQ,OAAO;MAAE,OAAO,KAAK;MAAO,MAAM,KAAK;KAAK,IAAI,KAAA;IAChE,SAAS,IAAI;KACZ,IAAI,WAAW,EAAE,GAAG,OAAO,KAAA;KAE3B,MAAM;IACP;GACD;GACA,gBAAe,SAAQ,GAAG,cAAc,QAAQ,IAAI,CAAC;GACrD,UAAU,OAAM,SAAQ;IACvB,IAAI;KACH,OAAO,MAAM,GAAG,SAAS,QAAQ,IAAI,CAAC;IACvC,SAAS,IAAI;KACZ,IAAI,WAAW,EAAE,GAAG,OAAO,KAAA;KAE3B,MAAM;IACP;GACD;GAEA,0BAAyB,aACxB,SAAS,MAAM,OAAO,IAAI,QAAQ,KAAK,OACpC,SAAS,wBAAwB,QAAQ,IACzC,QAAQ,QAAQ,CAAC,CAAC;GACtB,gBAAe,aAAY,SAAS,OAAO,wBAAwB,QAAQ;GAE3E,YAAW,aAAY,QAAQ,cAAc,cAAc,QAAQ,KAAK;EACzE,CAAC;EACD,SAAS,MAAM,kBACd,aAAY,UAAU,SAAS,QAAQ,SACjC,UAAU,iBAAiB,CAClC;EACA,QAAQ,cAAc,wBAAuB,MAAK;GACjD,IAAI,EAAE,SACL,UAAU,UAAU,EAAE,QAAQ;QAE9B,UAAU,YAAY,EAAE,QAAQ;EAElC,CAAC;CACF;CAQA,QAAQ,cAAc,wBAAuB,aAAY,SAAS,MAAM,qBAAqB,QAAQ,CAAC;CAGtG,QAAQ,cAAc,uBAAsB,MAAK;EAChD,MAAM,UAAU,EAAE,sBAAsB;EACxC,IAAI,QAAQ,QACX,SAAS,MAAM,oBAAoB,EAAE,UAAU,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAC;CAE9F,CAAC;CAGD,QAAQ,cAAc,sBAAqB,aAC1C,SAAS,MAAM,oBAAoB,UAAU,CAAC,aAAa,CAAC,CAC7D;CACA,OAAO;AACR;;AAGA,SAAS,oBAA4B;CACpC,MAAM,OAAO,OAAO,SAAS,IAAI,sBAAsB,IAAI,EAAE;CAC7D,OAAO,OAAO,MAAM,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,IAAI;AACjE"}
|
package/dist/plus/ai/errors.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AIModel } from "./models/model.js";
|
|
1
2
|
//#region ../plus/ai/src/errors.d.ts
|
|
2
3
|
export declare const enum AIErrorReason {
|
|
3
4
|
DeniedByOrganization = 0,
|
|
@@ -12,13 +13,18 @@ export declare const enum AIErrorReason {
|
|
|
12
13
|
Unauthorized = 9,
|
|
13
14
|
UserQuotaExceeded = 10,
|
|
14
15
|
NoNetwork = 11,
|
|
15
|
-
Unreachable = 12
|
|
16
|
+
Unreachable = 12,
|
|
17
|
+
ModelUnavailable = 13
|
|
16
18
|
}
|
|
17
19
|
export declare class AIError extends Error {
|
|
18
20
|
readonly diagnosticMessage: string;
|
|
19
21
|
readonly original?: Error;
|
|
20
22
|
readonly reason: AIErrorReason | undefined;
|
|
21
|
-
|
|
23
|
+
/** Optional provider context. Omitted preserves the legacy GitKraken quota message and credit offers, so a
|
|
24
|
+
* non-GitKraken provider must pass its own to get provider-neutral text (and no credit offers). Also names
|
|
25
|
+
* the provider in the model-unavailable message. */
|
|
26
|
+
readonly provider?: AIModel['provider'];
|
|
27
|
+
constructor(reason: AIErrorReason, original?: Error, provider?: AIModel['provider']);
|
|
22
28
|
get diagnosticString(): string;
|
|
23
29
|
}
|
|
24
30
|
export declare class AuthenticationRequiredError extends Error {
|
package/dist/plus/ai/errors.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { gitKrakenProviderDescriptor } from "./constants.js";
|
|
1
2
|
import * as l10n from "@vscode/l10n";
|
|
2
3
|
//#region ../plus/ai/src/errors.ts
|
|
3
4
|
let AIErrorReason = /* @__PURE__ */ function(AIErrorReason) {
|
|
@@ -14,13 +15,18 @@ let AIErrorReason = /* @__PURE__ */ function(AIErrorReason) {
|
|
|
14
15
|
AIErrorReason[AIErrorReason["UserQuotaExceeded"] = 10] = "UserQuotaExceeded";
|
|
15
16
|
AIErrorReason[AIErrorReason["NoNetwork"] = 11] = "NoNetwork";
|
|
16
17
|
AIErrorReason[AIErrorReason["Unreachable"] = 12] = "Unreachable";
|
|
18
|
+
AIErrorReason[AIErrorReason["ModelUnavailable"] = 13] = "ModelUnavailable";
|
|
17
19
|
return AIErrorReason;
|
|
18
20
|
}({});
|
|
19
21
|
var AIError = class extends Error {
|
|
20
22
|
diagnosticMessage;
|
|
21
23
|
original;
|
|
22
24
|
reason;
|
|
23
|
-
|
|
25
|
+
/** Optional provider context. Omitted preserves the legacy GitKraken quota message and credit offers, so a
|
|
26
|
+
* non-GitKraken provider must pass its own to get provider-neutral text (and no credit offers). Also names
|
|
27
|
+
* the provider in the model-unavailable message. */
|
|
28
|
+
provider;
|
|
29
|
+
constructor(reason, original, provider) {
|
|
24
30
|
let message;
|
|
25
31
|
let diagnosticMessage;
|
|
26
32
|
switch (reason) {
|
|
@@ -34,7 +40,7 @@ var AIError = class extends Error {
|
|
|
34
40
|
break;
|
|
35
41
|
case 10:
|
|
36
42
|
diagnosticMessage = "You have exceeded your user token limit";
|
|
37
|
-
message = l10n.t("You’ve reached the weekly AI usage included in your plan.");
|
|
43
|
+
message = provider != null && provider.id !== gitKrakenProviderDescriptor.id ? l10n.t("You’ve reached the AI usage limit for {0}. Check your plan and usage with {0}, or switch to a different provider.", provider.name) : l10n.t("You’ve reached the weekly AI usage included in your plan.");
|
|
38
44
|
break;
|
|
39
45
|
case 4:
|
|
40
46
|
diagnosticMessage = "Rate limit exceeded";
|
|
@@ -64,6 +70,10 @@ var AIError = class extends Error {
|
|
|
64
70
|
diagnosticMessage = "Model not supported for this request";
|
|
65
71
|
message = l10n.t("Model not supported for this request");
|
|
66
72
|
break;
|
|
73
|
+
case 13:
|
|
74
|
+
diagnosticMessage = "Model is no longer available";
|
|
75
|
+
message = provider != null ? l10n.t("The selected model is no longer available from {0}. Switch to a different model and try again.", provider.name) : l10n.t("The selected model is no longer available. Switch to a different model and try again.");
|
|
76
|
+
break;
|
|
67
77
|
case 9:
|
|
68
78
|
diagnosticMessage = "You are not authorized to use the specified provider or model";
|
|
69
79
|
message = l10n.t("You are not authorized to use the specified provider or model");
|
|
@@ -84,6 +94,7 @@ var AIError = class extends Error {
|
|
|
84
94
|
this.diagnosticMessage = diagnosticMessage;
|
|
85
95
|
this.original = original;
|
|
86
96
|
this.reason = reason;
|
|
97
|
+
this.provider = provider;
|
|
87
98
|
Error.captureStackTrace?.(this, new.target);
|
|
88
99
|
}
|
|
89
100
|
get diagnosticString() {
|
|
@@ -157,7 +168,8 @@ function isAIUnavailableError(ex) {
|
|
|
157
168
|
case 10:
|
|
158
169
|
case 11:
|
|
159
170
|
case 12:
|
|
160
|
-
case 7:
|
|
171
|
+
case 7:
|
|
172
|
+
case 13: return true;
|
|
161
173
|
default: return false;
|
|
162
174
|
}
|
|
163
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":[],"sources":["../../../../plus/ai/src/errors.ts"],"sourcesContent":["import * as l10n from '@vscode/l10n';\n\nexport const enum AIErrorReason {\n\tDeniedByOrganization,\n\tDeniedByUser,\n\tNoEntitlement,\n\tNoRequestData,\n\tRateLimitExceeded,\n\tRateLimitOrFundsExceeded,\n\tRequestTooLarge,\n\tModelNotSupported,\n\tServiceCapacityExceeded,\n\tUnauthorized,\n\tUserQuotaExceeded,\n\tNoNetwork,\n\tUnreachable,\n}\n\nexport class AIError extends Error {\n\treadonly diagnosticMessage: string;\n\treadonly original?: Error;\n\treadonly reason: AIErrorReason | undefined;\n\n\tconstructor(reason: AIErrorReason, original?: Error) {\n\t\tlet message: string;\n\t\tlet diagnosticMessage: string;\n\t\tswitch (reason) {\n\t\t\tcase AIErrorReason.NoEntitlement:\n\t\t\t\tdiagnosticMessage = 'You do not have the required entitlement to use this feature';\n\t\t\t\tmessage = l10n.t('You do not have the required entitlement to use this feature');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.RequestTooLarge:\n\t\t\t\tdiagnosticMessage = 'The request is too large';\n\t\t\t\tmessage = l10n.t('The request is too large');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.UserQuotaExceeded:\n\t\t\t\tdiagnosticMessage = 'You have exceeded your user token limit';\n\t\t\t\tmessage = l10n.t('You’ve reached the weekly AI usage included in your plan.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.RateLimitExceeded:\n\t\t\t\tdiagnosticMessage = 'Rate limit exceeded';\n\t\t\t\tmessage = l10n.t('Rate limit exceeded.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.RateLimitOrFundsExceeded:\n\t\t\t\tdiagnosticMessage = 'Rate limit exceeded or your account is out of funds';\n\t\t\t\tmessage = l10n.t('Rate limit exceeded or your account is out of funds.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.ServiceCapacityExceeded:\n\t\t\t\tdiagnosticMessage = 'Service capacity exceeded';\n\t\t\t\tmessage = l10n.t('Service capacity exceeded.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.NoNetwork:\n\t\t\t\tdiagnosticMessage = 'Unable to reach the AI service. Please check your internet connection.';\n\t\t\t\tmessage = l10n.t('Unable to reach the AI service. Please check your internet connection.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.Unreachable:\n\t\t\t\tdiagnosticMessage = 'The AI service is temporarily unreachable.';\n\t\t\t\tmessage = l10n.t('The AI service is temporarily unreachable.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.NoRequestData:\n\t\t\t\tdiagnosticMessage = original?.message ?? 'No data was provided for the request';\n\t\t\t\tmessage = original?.message ?? l10n.t('No data was provided for the request');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.ModelNotSupported:\n\t\t\t\tdiagnosticMessage = 'Model not supported for this request';\n\t\t\t\tmessage = l10n.t('Model not supported for this request');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.Unauthorized:\n\t\t\t\tdiagnosticMessage = 'You are not authorized to use the specified provider or model';\n\t\t\t\tmessage = l10n.t('You are not authorized to use the specified provider or model');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.DeniedByOrganization:\n\t\t\t\tdiagnosticMessage = 'Your organization has denied access to the specified provider or model';\n\t\t\t\tmessage = l10n.t('Your organization has denied access to the specified provider or model');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.DeniedByUser:\n\t\t\t\tdiagnosticMessage = 'You have denied access to the specified provider or model';\n\t\t\t\tmessage = l10n.t('You have denied access to the specified provider or model');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdiagnosticMessage = original?.message ?? 'An unknown error occurred';\n\t\t\t\tmessage = original?.message ?? l10n.t('An unknown error occurred');\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper(message);\n\n\t\tthis.diagnosticMessage = diagnosticMessage;\n\t\tthis.original = original;\n\t\tthis.reason = reason;\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n\n\tget diagnosticString(): string {\n\t\treturn `${this.name}: ${this.diagnosticMessage}`;\n\t}\n}\n\nexport class AuthenticationRequiredError extends Error {\n\tconstructor() {\n\t\tsuper(l10n.t('Authentication required'));\n\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\nexport class AINoRequestDataError extends AIError {\n\tconstructor(message?: string) {\n\t\tsuper(AIErrorReason.NoRequestData, message ? new Error(message) : undefined);\n\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\nconst noNetworkErrorCodes = new Set([\n\t'ENOTFOUND',\n\t'ECONNREFUSED',\n\t'EAI_AGAIN',\n\t'EHOSTUNREACH',\n\t'ENETUNREACH',\n\t'ENETDOWN',\n\t'UND_ERR_CONNECT_TIMEOUT',\n]);\n\nconst unreachableErrorCodes = new Set(['ECONNRESET', 'ETIMEDOUT', 'UND_ERR_SOCKET']);\n\nexport function classifyNetworkError(ex: unknown): AIErrorReason.NoNetwork | AIErrorReason.Unreachable | undefined {\n\tlet current: unknown = ex;\n\tlet sawFetchFailed = false;\n\tfor (let depth = 0; depth < 5 && current != null; depth++) {\n\t\tif (!(current instanceof Error)) break;\n\n\t\tif (current.name === 'TypeError' && current.message === 'fetch failed') {\n\t\t\tsawFetchFailed = true;\n\t\t}\n\t\tconst code = (current as { code?: unknown }).code;\n\t\tif (typeof code === 'string') {\n\t\t\tif (noNetworkErrorCodes.has(code)) return AIErrorReason.NoNetwork;\n\t\t\tif (unreachableErrorCodes.has(code)) return AIErrorReason.Unreachable;\n\t\t}\n\n\t\tcurrent = (current as { cause?: unknown }).cause;\n\t}\n\treturn sawFetchFailed ? AIErrorReason.NoNetwork : undefined;\n}\n\n/**\n * Whether an error means AI itself is unavailable, rather than this particular request being\n * unacceptable. The distinction matters to any caller running a loop: an unavailable-AI failure will\n * repeat identically for every remaining item, so the loop should stop and say so, while a\n * request-shaped failure (too large, no data) may well succeed on the next item.\n *\n * `RequestTooLarge` and `NoRequestData` are therefore deliberately excluded — they're properties of\n * the one request that failed.\n *\n * An `AuthenticationRequiredError` (expired GitKraken session) counts too: it isn't an `AIError`, but\n * every remaining request will fail identically until the user signs in again.\n */\nexport function isAIUnavailableError(ex: unknown): ex is AIError | AuthenticationRequiredError {\n\tif (ex instanceof AuthenticationRequiredError) return true;\n\tif (!(ex instanceof AIError)) return false;\n\n\tswitch (ex.reason) {\n\t\tcase AIErrorReason.DeniedByOrganization:\n\t\tcase AIErrorReason.DeniedByUser:\n\t\tcase AIErrorReason.NoEntitlement:\n\t\tcase AIErrorReason.RateLimitExceeded:\n\t\tcase AIErrorReason.RateLimitOrFundsExceeded:\n\t\tcase AIErrorReason.ServiceCapacityExceeded:\n\t\tcase AIErrorReason.Unauthorized:\n\t\tcase AIErrorReason.UserQuotaExceeded:\n\t\tcase AIErrorReason.NoNetwork:\n\t\tcase AIErrorReason.Unreachable:\n\t\tcase AIErrorReason.ModelNotSupported:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n"],"mappings":";;AAEA,IAAkB,gBAAX,yBAAA,eAAA;CACN,cAAA,cAAA,0BAAA,KAAA;CACA,cAAA,cAAA,kBAAA,KAAA;CACA,cAAA,cAAA,mBAAA,KAAA;CACA,cAAA,cAAA,mBAAA,KAAA;CACA,cAAA,cAAA,uBAAA,KAAA;CACA,cAAA,cAAA,8BAAA,KAAA;CACA,cAAA,cAAA,qBAAA,KAAA;CACA,cAAA,cAAA,uBAAA,KAAA;CACA,cAAA,cAAA,6BAAA,KAAA;CACA,cAAA,cAAA,kBAAA,KAAA;CACA,cAAA,cAAA,uBAAA,MAAA;CACA,cAAA,cAAA,eAAA,MAAA;CACA,cAAA,cAAA,iBAAA,MAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAa,UAAb,cAA6B,MAAM;CAClC;CACA;CACA;CAEA,YAAY,QAAuB,UAAkB;EACpD,IAAI;EACJ,IAAI;EACJ,QAAQ,QAAR;GACC,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,8DAA8D;IAC/E;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,0BAA0B;IAC3C;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,2DAA2D;IAC5E;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,sBAAsB;IACvC;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,sDAAsD;IACvE;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,4BAA4B;IAC7C;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,wEAAwE;IACzF;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,4CAA4C;IAC7D;GACD,KAAA;IACC,oBAAoB,UAAU,WAAW;IACzC,UAAU,UAAU,WAAW,KAAK,EAAE,sCAAsC;IAC5E;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,sCAAsC;IACvD;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,+DAA+D;IAChF;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,wEAAwE;IACzF;GACD,KAAA;IACC,oBAAoB;IACpB,UAAU,KAAK,EAAE,2DAA2D;IAC5E;GACD;IACC,oBAAoB,UAAU,WAAW;IACzC,UAAU,UAAU,WAAW,KAAK,EAAE,2BAA2B;EAEnE;EAEA,MAAM,OAAO;EAEb,KAAK,oBAAoB;EACzB,KAAK,WAAW;EAChB,KAAK,SAAS;EACd,MAAM,oBAAoB,MAAM,UAAU;CAC3C;CAEA,IAAI,mBAA2B;EAC9B,OAAO,GAAG,KAAK,KAAK,IAAI,KAAK;CAC9B;AACD;AAEA,IAAa,8BAAb,cAAiD,MAAM;CACtD,cAAc;EACb,MAAM,KAAK,EAAE,yBAAyB,CAAC;EAEvC,MAAM,oBAAoB,MAAM,UAAU;CAC3C;AACD;AAEA,IAAa,uBAAb,cAA0C,QAAQ;CACjD,YAAY,SAAkB;EAC7B,MAAA,GAAmC,UAAU,IAAI,MAAM,OAAO,IAAI,KAAA,CAAS;EAE3E,MAAM,oBAAoB,MAAM,UAAU;CAC3C;AACD;AAEA,MAAM,sCAAsB,IAAI,IAAI;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAED,MAAM,wCAAwB,IAAI,IAAI;CAAC;CAAc;CAAa;AAAgB,CAAC;AAEnF,SAAgB,qBAAqB,IAA8E;CAClH,IAAI,UAAmB;CACvB,IAAI,iBAAiB;CACrB,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,WAAW,MAAM,SAAS;EAC1D,IAAI,EAAE,mBAAmB,QAAQ;EAEjC,IAAI,QAAQ,SAAS,eAAe,QAAQ,YAAY,gBACvD,iBAAiB;EAElB,MAAM,OAAQ,QAA+B;EAC7C,IAAI,OAAO,SAAS,UAAU;GAC7B,IAAI,oBAAoB,IAAI,IAAI,GAAG,OAAA;GACnC,IAAI,sBAAsB,IAAI,IAAI,GAAG,OAAA;EACtC;EAEA,UAAW,QAAgC;CAC5C;CACA,OAAO,iBAAA,KAA2C,KAAA;AACnD;;;;;;;;;;;;;AAcA,SAAgB,qBAAqB,IAA0D;CAC9F,IAAI,cAAc,6BAA6B,OAAO;CACtD,IAAI,EAAE,cAAc,UAAU,OAAO;CAErC,QAAQ,GAAG,QAAX;EACC,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA;EACA,KAAA,GACC,OAAO;EACR,SACC,OAAO;CACT;AACD"}
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../../../../plus/ai/src/errors.ts"],"sourcesContent":["import * as l10n from '@vscode/l10n';\nimport { gitKrakenProviderDescriptor } from './constants.js';\nimport type { AIModel } from './models/model.js';\n\nexport const enum AIErrorReason {\n\tDeniedByOrganization,\n\tDeniedByUser,\n\tNoEntitlement,\n\tNoRequestData,\n\tRateLimitExceeded,\n\tRateLimitOrFundsExceeded,\n\tRequestTooLarge,\n\tModelNotSupported,\n\tServiceCapacityExceeded,\n\tUnauthorized,\n\tUserQuotaExceeded,\n\tNoNetwork,\n\tUnreachable,\n\tModelUnavailable,\n}\n\nexport class AIError extends Error {\n\treadonly diagnosticMessage: string;\n\treadonly original?: Error;\n\treadonly reason: AIErrorReason | undefined;\n\t/** Optional provider context. Omitted preserves the legacy GitKraken quota message and credit offers, so a\n\t * non-GitKraken provider must pass its own to get provider-neutral text (and no credit offers). Also names\n\t * the provider in the model-unavailable message. */\n\treadonly provider?: AIModel['provider'];\n\n\tconstructor(reason: AIErrorReason, original?: Error, provider?: AIModel['provider']) {\n\t\tlet message: string;\n\t\tlet diagnosticMessage: string;\n\t\tswitch (reason) {\n\t\t\tcase AIErrorReason.NoEntitlement:\n\t\t\t\tdiagnosticMessage = 'You do not have the required entitlement to use this feature';\n\t\t\t\tmessage = l10n.t('You do not have the required entitlement to use this feature');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.RequestTooLarge:\n\t\t\t\tdiagnosticMessage = 'The request is too large';\n\t\t\t\tmessage = l10n.t('The request is too large');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.UserQuotaExceeded:\n\t\t\t\tdiagnosticMessage = 'You have exceeded your user token limit';\n\t\t\t\tmessage =\n\t\t\t\t\tprovider != null && provider.id !== gitKrakenProviderDescriptor.id\n\t\t\t\t\t\t? l10n.t(\n\t\t\t\t\t\t\t\t'You’ve reached the AI usage limit for {0}. Check your plan and usage with {0}, or switch to a different provider.',\n\t\t\t\t\t\t\t\tprovider.name,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: l10n.t('You’ve reached the weekly AI usage included in your plan.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.RateLimitExceeded:\n\t\t\t\tdiagnosticMessage = 'Rate limit exceeded';\n\t\t\t\tmessage = l10n.t('Rate limit exceeded.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.RateLimitOrFundsExceeded:\n\t\t\t\tdiagnosticMessage = 'Rate limit exceeded or your account is out of funds';\n\t\t\t\tmessage = l10n.t('Rate limit exceeded or your account is out of funds.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.ServiceCapacityExceeded:\n\t\t\t\tdiagnosticMessage = 'Service capacity exceeded';\n\t\t\t\tmessage = l10n.t('Service capacity exceeded.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.NoNetwork:\n\t\t\t\tdiagnosticMessage = 'Unable to reach the AI service. Please check your internet connection.';\n\t\t\t\tmessage = l10n.t('Unable to reach the AI service. Please check your internet connection.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.Unreachable:\n\t\t\t\tdiagnosticMessage = 'The AI service is temporarily unreachable.';\n\t\t\t\tmessage = l10n.t('The AI service is temporarily unreachable.');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.NoRequestData:\n\t\t\t\tdiagnosticMessage = original?.message ?? 'No data was provided for the request';\n\t\t\t\tmessage = original?.message ?? l10n.t('No data was provided for the request');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.ModelNotSupported:\n\t\t\t\tdiagnosticMessage = 'Model not supported for this request';\n\t\t\t\tmessage = l10n.t('Model not supported for this request');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.ModelUnavailable:\n\t\t\t\tdiagnosticMessage = 'Model is no longer available';\n\t\t\t\tmessage =\n\t\t\t\t\tprovider != null\n\t\t\t\t\t\t? l10n.t(\n\t\t\t\t\t\t\t\t'The selected model is no longer available from {0}. Switch to a different model and try again.',\n\t\t\t\t\t\t\t\tprovider.name,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: l10n.t(\n\t\t\t\t\t\t\t\t'The selected model is no longer available. Switch to a different model and try again.',\n\t\t\t\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.Unauthorized:\n\t\t\t\tdiagnosticMessage = 'You are not authorized to use the specified provider or model';\n\t\t\t\tmessage = l10n.t('You are not authorized to use the specified provider or model');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.DeniedByOrganization:\n\t\t\t\tdiagnosticMessage = 'Your organization has denied access to the specified provider or model';\n\t\t\t\tmessage = l10n.t('Your organization has denied access to the specified provider or model');\n\t\t\t\tbreak;\n\t\t\tcase AIErrorReason.DeniedByUser:\n\t\t\t\tdiagnosticMessage = 'You have denied access to the specified provider or model';\n\t\t\t\tmessage = l10n.t('You have denied access to the specified provider or model');\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tdiagnosticMessage = original?.message ?? 'An unknown error occurred';\n\t\t\t\tmessage = original?.message ?? l10n.t('An unknown error occurred');\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper(message);\n\n\t\tthis.diagnosticMessage = diagnosticMessage;\n\t\tthis.original = original;\n\t\tthis.reason = reason;\n\t\tthis.provider = provider;\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n\n\tget diagnosticString(): string {\n\t\treturn `${this.name}: ${this.diagnosticMessage}`;\n\t}\n}\n\nexport class AuthenticationRequiredError extends Error {\n\tconstructor() {\n\t\tsuper(l10n.t('Authentication required'));\n\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\nexport class AINoRequestDataError extends AIError {\n\tconstructor(message?: string) {\n\t\tsuper(AIErrorReason.NoRequestData, message ? new Error(message) : undefined);\n\n\t\tError.captureStackTrace?.(this, new.target);\n\t}\n}\n\nconst noNetworkErrorCodes = new Set([\n\t'ENOTFOUND',\n\t'ECONNREFUSED',\n\t'EAI_AGAIN',\n\t'EHOSTUNREACH',\n\t'ENETUNREACH',\n\t'ENETDOWN',\n\t'UND_ERR_CONNECT_TIMEOUT',\n]);\n\nconst unreachableErrorCodes = new Set(['ECONNRESET', 'ETIMEDOUT', 'UND_ERR_SOCKET']);\n\nexport function classifyNetworkError(ex: unknown): AIErrorReason.NoNetwork | AIErrorReason.Unreachable | undefined {\n\tlet current: unknown = ex;\n\tlet sawFetchFailed = false;\n\tfor (let depth = 0; depth < 5 && current != null; depth++) {\n\t\tif (!(current instanceof Error)) break;\n\n\t\tif (current.name === 'TypeError' && current.message === 'fetch failed') {\n\t\t\tsawFetchFailed = true;\n\t\t}\n\t\tconst code = (current as { code?: unknown }).code;\n\t\tif (typeof code === 'string') {\n\t\t\tif (noNetworkErrorCodes.has(code)) return AIErrorReason.NoNetwork;\n\t\t\tif (unreachableErrorCodes.has(code)) return AIErrorReason.Unreachable;\n\t\t}\n\n\t\tcurrent = (current as { cause?: unknown }).cause;\n\t}\n\treturn sawFetchFailed ? AIErrorReason.NoNetwork : undefined;\n}\n\n/**\n * Whether an error means AI itself is unavailable, rather than this particular request being\n * unacceptable. The distinction matters to any caller running a loop: an unavailable-AI failure will\n * repeat identically for every remaining item, so the loop should stop and say so, while a\n * request-shaped failure (too large, no data) may well succeed on the next item.\n *\n * `RequestTooLarge` and `NoRequestData` are therefore deliberately excluded — they're properties of\n * the one request that failed.\n *\n * An `AuthenticationRequiredError` (expired GitKraken session) counts too: it isn't an `AIError`, but\n * every remaining request will fail identically until the user signs in again.\n */\nexport function isAIUnavailableError(ex: unknown): ex is AIError | AuthenticationRequiredError {\n\tif (ex instanceof AuthenticationRequiredError) return true;\n\tif (!(ex instanceof AIError)) return false;\n\n\tswitch (ex.reason) {\n\t\tcase AIErrorReason.DeniedByOrganization:\n\t\tcase AIErrorReason.DeniedByUser:\n\t\tcase AIErrorReason.NoEntitlement:\n\t\tcase AIErrorReason.RateLimitExceeded:\n\t\tcase AIErrorReason.RateLimitOrFundsExceeded:\n\t\tcase AIErrorReason.ServiceCapacityExceeded:\n\t\tcase AIErrorReason.Unauthorized:\n\t\tcase AIErrorReason.UserQuotaExceeded:\n\t\tcase AIErrorReason.NoNetwork:\n\t\tcase AIErrorReason.Unreachable:\n\t\tcase AIErrorReason.ModelNotSupported:\n\t\tcase AIErrorReason.ModelUnavailable:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -63,6 +63,17 @@ export interface GitHubApiConfig {
|
|
|
63
63
|
* Only used when `getLaunchpadIncludedOrganizations` returns empty.
|
|
64
64
|
*/
|
|
65
65
|
getLaunchpadIgnoredOrganizations?(): string[];
|
|
66
|
+
/**
|
|
67
|
+
* Pull request read knobs. `mergeQueue: true` makes GitHub.com pull request reads select merge-queue data (the
|
|
68
|
+
* queue entry, whether the base branch requires a queue, and the latest queue removal) and the etag cheap check
|
|
69
|
+
* select its queue state. Off (omitted) by default: the selection costs a GitHub rate-limit request per pull
|
|
70
|
+
* request read, and makes a queued pull request's etag change with every queue state change. A read's own
|
|
71
|
+
* `mergeQueue` option, where it takes one, overrides this. Read on every query build, so a change applies from
|
|
72
|
+
* the next read.
|
|
73
|
+
*/
|
|
74
|
+
getPullRequestReadOptions?(): {
|
|
75
|
+
readonly mergeQueue?: boolean;
|
|
76
|
+
};
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
68
79
|
* The maximum number of results GitHub's search will serve for ONE query, however it is paged. A search whose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../../../../plus/git-github/src/api/config.ts"],"sourcesContent":["import type { AuthenticationError } from '@gitlens/git/errors.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\n\n/**\n * VS Code-free configuration interface for {@link GitHubApi}.\n *\n * The extension creates an instance by wiring VS Code-specific values\n * (settings, proxy agent, SSL wrapper, UI dialogs) into these callbacks.\n * The package never imports anything from VS Code.\n */\nexport interface GitHubApiConfig {\n\t/** Whether we're running in a web worker (vscode.dev) vs Node.js desktop. */\n\treadonly isWeb: boolean;\n\n\t/** The `fetch` implementation to use for HTTP requests. */\n\treadonly fetch: (url: string, init?: any) => Promise<Response>;\n\n\t/**\n\t * Wraps an async operation so that TLS certificate validation\n\t * is disabled when the provider's `getIgnoreSSLErrors()` returns `'force'`.\n\t */\n\twrapForForcedInsecureSSL<T>(ignoreSSLErrors: boolean | 'force', fn: () => Promise<T>): Promise<T>;\n\n\t/**\n\t * Fires when proxy/SSL configuration changes, so the API can reset\n\t * its HTTP caches (proxy agent, default request instances, etc.).\n\t */\n\tonConfigChanged?(listener: () => void): { dispose(): void };\n\n\t/**\n\t * Called when authentication fails (401/403) and reauthentication might help.\n\t *\n\t * The extension shows a dialog and calls `provider.reauthenticate()` if\n\t * the user confirms. Returns `true` if the user chose to reauthenticate,\n\t * allowing the package to reset caches and fire `onDidReauthenticate`.\n\t */\n\tonAuthenticationFailure?(error: AuthenticationError, provider: Provider | undefined): Promise<boolean>;\n\n\t/**\n\t * Called on server errors (500/502/503) or timeouts.\n\t * The extension decides how to present this (notification, status bar, etc.).\n\t */\n\tonRequestError?(provider: Provider | undefined, message: string): void;\n\n\t/**\n\t * Called for debug-mode error display (only when `Logger.isDebugging`).\n\t * The extension may show an error notification or log it.\n\t */\n\tonDebugError?(message: string): void;\n\n\t// These are passed through config because they come from VS Code settings.\n\t// The code in GitHubApi's searchMyPullRequests has \"Hack\" comments noting\n\t// these should eventually be passed through method options instead.\n\n\t/**\n\t * Returns the Launchpad search query limit (max PRs to fetch).\n\t * Defaults to 100 if not provided.\n\t */\n\tgetLaunchpadQueryLimit?(): number;\n\n\t/**\n\t * Returns repositories to exclude from Launchpad search queries.\n\t * Format: `owner/repo` strings.\n\t */\n\tgetLaunchpadIgnoredRepositories?(): string[];\n\n\t/**\n\t * Returns organizations to include in Launchpad search queries.\n\t * When non-empty, only these orgs are searched.\n\t */\n\tgetLaunchpadIncludedOrganizations?(): string[];\n\n\t/**\n\t * Returns organizations to exclude from Launchpad search queries.\n\t * Only used when `getLaunchpadIncludedOrganizations` returns empty.\n\t */\n\tgetLaunchpadIgnoredOrganizations?(): string[];\n}\n\n/**\n * The maximum number of results GitHub's search will serve for ONE query, however it is paged. A search whose\n * `issueCount` exceeds this cannot be read in full: the items past the ceiling are UNREACHABLE, not merely\n * unfetched — no budget, no retry and no cursor returns them.\n *\n * It lives in this leaf module rather than beside the search that detects it because the facade's\n * provider-agnostic metadata table reports the same ceiling to consumers, and the two must be one number: a\n * duplicated literal drifts silently, and drift here means quoting a limit the client doesn't enforce. Importing\n * it from `github.ts` would have pulled that module — and its octokit dependencies — eagerly into the graph of\n * one of the most widely imported modules in the integrations package, for the sake of a single integer.\n */\nexport const githubSearchResultLimit = 1000;\n"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../../../../plus/git-github/src/api/config.ts"],"sourcesContent":["import type { AuthenticationError } from '@gitlens/git/errors.js';\nimport type { Provider } from '@gitlens/git/models/remoteProvider.js';\n\n/**\n * VS Code-free configuration interface for {@link GitHubApi}.\n *\n * The extension creates an instance by wiring VS Code-specific values\n * (settings, proxy agent, SSL wrapper, UI dialogs) into these callbacks.\n * The package never imports anything from VS Code.\n */\nexport interface GitHubApiConfig {\n\t/** Whether we're running in a web worker (vscode.dev) vs Node.js desktop. */\n\treadonly isWeb: boolean;\n\n\t/** The `fetch` implementation to use for HTTP requests. */\n\treadonly fetch: (url: string, init?: any) => Promise<Response>;\n\n\t/**\n\t * Wraps an async operation so that TLS certificate validation\n\t * is disabled when the provider's `getIgnoreSSLErrors()` returns `'force'`.\n\t */\n\twrapForForcedInsecureSSL<T>(ignoreSSLErrors: boolean | 'force', fn: () => Promise<T>): Promise<T>;\n\n\t/**\n\t * Fires when proxy/SSL configuration changes, so the API can reset\n\t * its HTTP caches (proxy agent, default request instances, etc.).\n\t */\n\tonConfigChanged?(listener: () => void): { dispose(): void };\n\n\t/**\n\t * Called when authentication fails (401/403) and reauthentication might help.\n\t *\n\t * The extension shows a dialog and calls `provider.reauthenticate()` if\n\t * the user confirms. Returns `true` if the user chose to reauthenticate,\n\t * allowing the package to reset caches and fire `onDidReauthenticate`.\n\t */\n\tonAuthenticationFailure?(error: AuthenticationError, provider: Provider | undefined): Promise<boolean>;\n\n\t/**\n\t * Called on server errors (500/502/503) or timeouts.\n\t * The extension decides how to present this (notification, status bar, etc.).\n\t */\n\tonRequestError?(provider: Provider | undefined, message: string): void;\n\n\t/**\n\t * Called for debug-mode error display (only when `Logger.isDebugging`).\n\t * The extension may show an error notification or log it.\n\t */\n\tonDebugError?(message: string): void;\n\n\t// These are passed through config because they come from VS Code settings.\n\t// The code in GitHubApi's searchMyPullRequests has \"Hack\" comments noting\n\t// these should eventually be passed through method options instead.\n\n\t/**\n\t * Returns the Launchpad search query limit (max PRs to fetch).\n\t * Defaults to 100 if not provided.\n\t */\n\tgetLaunchpadQueryLimit?(): number;\n\n\t/**\n\t * Returns repositories to exclude from Launchpad search queries.\n\t * Format: `owner/repo` strings.\n\t */\n\tgetLaunchpadIgnoredRepositories?(): string[];\n\n\t/**\n\t * Returns organizations to include in Launchpad search queries.\n\t * When non-empty, only these orgs are searched.\n\t */\n\tgetLaunchpadIncludedOrganizations?(): string[];\n\n\t/**\n\t * Returns organizations to exclude from Launchpad search queries.\n\t * Only used when `getLaunchpadIncludedOrganizations` returns empty.\n\t */\n\tgetLaunchpadIgnoredOrganizations?(): string[];\n\n\t/**\n\t * Pull request read knobs. `mergeQueue: true` makes GitHub.com pull request reads select merge-queue data (the\n\t * queue entry, whether the base branch requires a queue, and the latest queue removal) and the etag cheap check\n\t * select its queue state. Off (omitted) by default: the selection costs a GitHub rate-limit request per pull\n\t * request read, and makes a queued pull request's etag change with every queue state change. A read's own\n\t * `mergeQueue` option, where it takes one, overrides this. Read on every query build, so a change applies from\n\t * the next read.\n\t */\n\tgetPullRequestReadOptions?(): { readonly mergeQueue?: boolean };\n}\n\n/**\n * The maximum number of results GitHub's search will serve for ONE query, however it is paged. A search whose\n * `issueCount` exceeds this cannot be read in full: the items past the ceiling are UNREACHABLE, not merely\n * unfetched — no budget, no retry and no cursor returns them.\n *\n * It lives in this leaf module rather than beside the search that detects it because the facade's\n * provider-agnostic metadata table reports the same ceiling to consumers, and the two must be one number: a\n * duplicated literal drifts silently, and drift here means quoting a limit the client doesn't enforce. Importing\n * it from `github.ts` would have pulled that module — and its octokit dependencies — eagerly into the graph of\n * one of the most widely imported modules in the integrations package, for the sake of a single integer.\n */\nexport const githubSearchResultLimit = 1000;\n"],"mappings":";;;;;;;;;;;;AAoGA,MAAa,0BAA0B"}
|
|
@@ -6,7 +6,7 @@ import { Provider } from "../../../git/models/remoteProvider.js";
|
|
|
6
6
|
import { GitUser } from "../../../git/models/user.js";
|
|
7
7
|
import { IssueOrPullRequest, IssueOrPullRequestState } from "../../../git/models/issueOrPullRequest.js";
|
|
8
8
|
import { Issue, IssueSearchCriteria, IssueShape, IssueSorting } from "../../../git/models/issue.js";
|
|
9
|
-
import { PullRequest, PullRequestMergeMethod, PullRequestSearchCriteria, PullRequestShape, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
|
|
9
|
+
import { PullRequest, PullRequestMergeMethod, PullRequestMergeQueueActionFailureReason, PullRequestMergeQueueActionResult, PullRequestMergeQueueEntry, PullRequestSearchCriteria, PullRequestShape, PullRequestStateFilter } from "../../../git/models/pullRequest.js";
|
|
10
10
|
import { Account, UnidentifiedAuthor } from "../../../git/models/author.js";
|
|
11
11
|
import { DefaultBranch } from "../../../git/models/defaultBranch.js";
|
|
12
12
|
import { RepositoryMetadata } from "../../../git/models/repositoryMetadata.js";
|
|
@@ -110,15 +110,27 @@ export declare class GitHubApi {
|
|
|
110
110
|
getPullRequest(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, number: number, options?: {
|
|
111
111
|
baseUrl?: string;
|
|
112
112
|
avatarSize?: number;
|
|
113
|
+
/**
|
|
114
|
+
* Whether this read selects merge-queue data, over the host's `getPullRequestReadOptions`. GitHub.com only.
|
|
115
|
+
*/
|
|
116
|
+
mergeQueue?: boolean;
|
|
113
117
|
}): Promise<PullRequest | undefined>;
|
|
114
118
|
getPullRequestForBranch(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, branch: string, options?: {
|
|
115
119
|
baseUrl?: string;
|
|
116
120
|
avatarSize?: number;
|
|
117
121
|
include?: GitHubPullRequestState[];
|
|
122
|
+
/**
|
|
123
|
+
* Whether this read selects merge-queue data, over the host's `getPullRequestReadOptions`. GitHub.com only.
|
|
124
|
+
*/
|
|
125
|
+
mergeQueue?: boolean;
|
|
118
126
|
}): Promise<PullRequest | undefined>;
|
|
119
127
|
getPullRequestForCommit(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, rev: string, options?: {
|
|
120
128
|
baseUrl?: string;
|
|
121
129
|
avatarSize?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Whether this read selects merge-queue data, over the host's `getPullRequestReadOptions`. GitHub.com only.
|
|
132
|
+
*/
|
|
133
|
+
mergeQueue?: boolean;
|
|
122
134
|
}, cancellation?: AbortSignal): Promise<PullRequest | undefined>;
|
|
123
135
|
getRepositoryMetadata(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, options?: {
|
|
124
136
|
baseUrl?: string;
|
|
@@ -271,6 +283,10 @@ export declare class GitHubApi {
|
|
|
271
283
|
* an explicit relationship qualifier such as `author:@me` or `review-requested:@me`.
|
|
272
284
|
*/
|
|
273
285
|
includeDefaultInvolvement?: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Whether this read selects merge-queue data, over the host's `getPullRequestReadOptions`. GitHub.com only.
|
|
288
|
+
*/
|
|
289
|
+
mergeQueue?: boolean;
|
|
274
290
|
}, cancellation?: AbortSignal): Promise<{
|
|
275
291
|
values: PullRequest[];
|
|
276
292
|
cursor?: string;
|
|
@@ -296,6 +312,10 @@ export declare class GitHubApi {
|
|
|
296
312
|
avatarSize?: number;
|
|
297
313
|
silent?: boolean;
|
|
298
314
|
state?: PullRequestStateFilter;
|
|
315
|
+
/**
|
|
316
|
+
* Whether this read selects merge-queue data, over the host's `getPullRequestReadOptions`. GitHub.com only.
|
|
317
|
+
*/
|
|
318
|
+
mergeQueue?: boolean;
|
|
299
319
|
}, cancellation?: AbortSignal): Promise<PullRequest[]>;
|
|
300
320
|
/**
|
|
301
321
|
* The current user's issues: authored ∪ assigned ∪ mentioned, each its own aliased search behind one composite
|
|
@@ -453,6 +473,7 @@ export declare class GitHubApi {
|
|
|
453
473
|
}[], options?: {
|
|
454
474
|
baseUrl?: string;
|
|
455
475
|
avatarSize?: number;
|
|
476
|
+
mergeQueue?: boolean;
|
|
456
477
|
}, cancellation?: AbortSignal): Promise<PromiseSettledResult<PullRequest | undefined>[]>;
|
|
457
478
|
/**
|
|
458
479
|
* The cheap check behind the batch reads' etags: {@link getPullRequestsBatch}'s aliased document, slot rules and
|
|
@@ -470,6 +491,7 @@ export declare class GitHubApi {
|
|
|
470
491
|
}[], options?: {
|
|
471
492
|
baseUrl?: string;
|
|
472
493
|
etagIncludes?: readonly GitHubPullRequestEtagInclude[];
|
|
494
|
+
mergeQueue?: boolean;
|
|
473
495
|
}, cancellation?: AbortSignal): Promise<PromiseSettledResult<GitHubPullRequestEtagNode | undefined>[]>;
|
|
474
496
|
/**
|
|
475
497
|
* The issue twin of {@link getPullRequestsEtagFieldsBatch}: {@link getIssuesBatch}'s aliased document, slot
|
|
@@ -525,6 +547,7 @@ export declare class GitHubApi {
|
|
|
525
547
|
baseUrl?: string;
|
|
526
548
|
avatarSize?: number;
|
|
527
549
|
limit: number;
|
|
550
|
+
mergeQueue?: boolean;
|
|
528
551
|
}, cancellation?: AbortSignal): Promise<PromiseSettledResult<{
|
|
529
552
|
pullRequests: PullRequest[][];
|
|
530
553
|
truncated: boolean;
|
|
@@ -625,6 +648,10 @@ export declare class GitHubApi {
|
|
|
625
648
|
* them and LOWERS it from four on.
|
|
626
649
|
*/
|
|
627
650
|
summary?: boolean;
|
|
651
|
+
/**
|
|
652
|
+
* Whether this read selects merge-queue data, over the host's `getPullRequestReadOptions`. GitHub.com only.
|
|
653
|
+
*/
|
|
654
|
+
mergeQueue?: boolean;
|
|
628
655
|
}, cancellation?: AbortSignal): Promise<PullRequestSearchResult | undefined>;
|
|
629
656
|
searchPullRequests(provider: Provider, token: GitHubTokenInfo, options?: {
|
|
630
657
|
search?: string;
|
|
@@ -633,6 +660,10 @@ export declare class GitHubApi {
|
|
|
633
660
|
baseUrl?: string;
|
|
634
661
|
avatarSize?: number;
|
|
635
662
|
include?: IssueOrPullRequestState[];
|
|
663
|
+
/**
|
|
664
|
+
* Whether this read selects merge-queue data, over the host's `getPullRequestReadOptions`. GitHub.com only.
|
|
665
|
+
*/
|
|
666
|
+
mergeQueue?: boolean;
|
|
636
667
|
}, cancellation?: AbortSignal): Promise<PullRequest[]>;
|
|
637
668
|
/**
|
|
638
669
|
* Every stack in the repository, each with its members bottom to top.
|
|
@@ -647,6 +678,20 @@ export declare class GitHubApi {
|
|
|
647
678
|
getRepositoryStacks(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, options?: {
|
|
648
679
|
baseUrl?: string;
|
|
649
680
|
}, cancellation?: AbortSignal): Promise<GitHubStackResource[] | undefined>;
|
|
681
|
+
/**
|
|
682
|
+
* The merge-queue entries of the given base branches, keyed by pull request number, in one request — each
|
|
683
|
+
* branch's queue is an alias on the one `repository` selection. For list surfaces whose pull requests arrive
|
|
684
|
+
* through provider-apis' repository-scoped read, which selects no `mergeQueueEntry`; callers join by number.
|
|
685
|
+
*
|
|
686
|
+
* INTERIM: remove once provider-apis carries the merge-queue entry on its pull requests (goals S6).
|
|
687
|
+
*
|
|
688
|
+
* github.com only, like the `mergeQueueEntry` selection: `undefined` on GitHub Enterprise Server, whose schema
|
|
689
|
+
* isn't verified to have `mergeQueue`, and for a repository GitHub reports not found. A branch without a queue
|
|
690
|
+
* contributes nothing. At most the first 100 entries of each queue are read.
|
|
691
|
+
*/
|
|
692
|
+
getMergeQueueEntriesForBranches(provider: Provider, token: GitHubTokenInfo, owner: string, repo: string, branches: readonly string[], options?: {
|
|
693
|
+
baseUrl?: string;
|
|
694
|
+
}, cancellation?: AbortSignal): Promise<Map<number, PullRequestMergeQueueEntry> | undefined>;
|
|
650
695
|
/**
|
|
651
696
|
* Merges a stacked pull request, and with it every layer below it.
|
|
652
697
|
*
|
|
@@ -662,7 +707,43 @@ export declare class GitHubApi {
|
|
|
662
707
|
mergeMethod?: PullRequestMergeMethod;
|
|
663
708
|
baseUrl?: string;
|
|
664
709
|
}, cancellation?: AbortSignal): Promise<boolean>;
|
|
710
|
+
/**
|
|
711
|
+
* Adds a pull request to its base branch's merge queue, at the back (no `jump`). GitHub takes no merge method here:
|
|
712
|
+
* the base branch's ruleset decides it. `expectedHeadSha` makes GitHub refuse a head that moved since it was read.
|
|
713
|
+
*
|
|
714
|
+
* GitHub's refusals come back as a `failed` result saying why (see {@link toGitHubMergeQueueActionFailure}),
|
|
715
|
+
* without prompting to re-authenticate on a FORBIDDEN, which here means the account may not queue, not that the
|
|
716
|
+
* token is bad. A failure to reach GitHub, a refused credential or a rate limit is thrown as from any other request,
|
|
717
|
+
* and cancellation throws `CancellationError`. Like every mutation it is never retried. github.com only, like the
|
|
718
|
+
* merge-queue reads: `unsupported` on GitHub Enterprise Server, whose schema isn't verified to have it.
|
|
719
|
+
*/
|
|
720
|
+
enqueuePullRequest(provider: Provider, token: GitHubTokenInfo, nodeId: string, expectedHeadSha: string, options?: {
|
|
721
|
+
baseUrl?: string;
|
|
722
|
+
}, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
723
|
+
/**
|
|
724
|
+
* Removes a pull request from its base branch's merge queue, losing its place there. Fails and throws as
|
|
725
|
+
* {@link enqueuePullRequest} does, and is github.com only like it.
|
|
726
|
+
*/
|
|
727
|
+
dequeuePullRequest(provider: Provider, token: GitHubTokenInfo, nodeId: string, options?: {
|
|
728
|
+
baseUrl?: string;
|
|
729
|
+
}, cancellation?: AbortSignal): Promise<PullRequestMergeQueueActionResult>;
|
|
665
730
|
}
|
|
731
|
+
/**
|
|
732
|
+
* Why GitHub refused to add a pull request to its merge queue or remove it, from the error its GraphQL answer carried
|
|
733
|
+
* (`errors[]`, which `graphql` throws as a `GraphqlResponseError`, or wraps in an `AuthenticationError` for FORBIDDEN
|
|
734
|
+
* and a `RequestNotFoundError` for NOT_FOUND). `undefined` for anything that isn't GitHub's answer about the action
|
|
735
|
+
* — a failure to reach it, a refused credential (HTTP 401/403), a rate limit — which the caller handles like any
|
|
736
|
+
* other request's failure.
|
|
737
|
+
*
|
|
738
|
+
* Only the wordings observed live (2026-11-06; see {@link mergeQueueActionFailurePatterns}) are recognized. Dequeue's
|
|
739
|
+
* refusal is generic and embeds the pull request's title, so it is never matched by wording and maps to `unknown`.
|
|
740
|
+
* When no message matches, the error's `type` decides (FORBIDDEN is `permission`), and anything else is `unknown`.
|
|
741
|
+
* The message is GitHub's own, for logs, never for display.
|
|
742
|
+
*/
|
|
743
|
+
export declare function toGitHubMergeQueueActionFailure(ex: unknown): {
|
|
744
|
+
reason: PullRequestMergeQueueActionFailureReason;
|
|
745
|
+
message: string;
|
|
746
|
+
} | undefined;
|
|
666
747
|
export declare function toGitHubSearchStateQualifier(include: IssueOrPullRequestState[] | undefined): string;
|
|
667
748
|
export declare function filterPullRequestsBySearchState<T extends {
|
|
668
749
|
state: IssueOrPullRequestState;
|