@gitkraken/core-gitlens 0.28.0 → 0.30.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 +48 -1
- package/dist/git/cache.d.ts +39 -1
- package/dist/git/cache.js +108 -7
- package/dist/git/cache.js.map +1 -1
- package/dist/git/providers/branches.d.ts +17 -12
- package/dist/git/providers/revision.d.ts +4 -0
- package/dist/git/watching/worktreeSummary.d.ts +16 -7
- package/dist/git/watching/worktreeSummary.js +44 -14
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/cliGitProvider.js +3 -3
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/exec.d.ts +2 -2
- package/dist/git-cli/exec/exec.js +2 -2
- package/dist/git-cli/exec/gitDirResolver.d.ts +6 -1
- package/dist/git-cli/exec/gitDirResolver.js +9 -4
- package/dist/git-cli/exec/gitDirResolver.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +91 -13
- package/dist/git-cli/providers/branches.js +673 -176
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.js +1 -1
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/revision.d.ts +4 -0
- package/dist/git-cli/providers/revision.js +64 -3
- package/dist/git-cli/providers/revision.js.map +1 -1
- package/dist/ipc/ipcServer.d.ts +6 -1
- package/dist/ipc/ipcServer.js +15 -6
- package/dist/ipc/ipcServer.js.map +1 -1
- package/dist/plus/ai/errors.js +4 -4
- package/dist/plus/ai/errors.js.map +1 -1
- package/dist/plus/ai/models/model.d.ts +1 -1
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +45 -2
- package/dist/plus/ai/models/results.d.ts +41 -0
- package/dist/plus/ai/models/results.js +14 -0
- package/dist/plus/ai/models/results.js.map +1 -0
- package/dist/plus/ai/prompts.d.ts +6 -0
- package/dist/plus/ai/prompts.js +255 -5
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/ai/providers/gitkrakenProvider.js +2 -2
- package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js +1 -0
- package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
- package/dist/plus/ai/utils/ai.utils.d.ts +4 -0
- package/dist/plus/ai/utils/ai.utils.js +8 -1
- package/dist/plus/ai/utils/ai.utils.js.map +1 -1
- package/dist/plus/ai/utils/results.utils.d.ts +15 -1
- package/dist/plus/ai/utils/results.utils.js +80 -4
- package/dist/plus/ai/utils/results.utils.js.map +1 -1
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js +2 -0
- package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
- package/dist/plus/integrations/authentication/models.d.ts +1 -1
- package/dist/plus/integrations/authentication/models.js +2 -0
- package/dist/plus/integrations/authentication/models.js.map +1 -1
- package/dist/plus/integrations/constants.d.ts +2 -1
- package/dist/plus/integrations/constants.js +12 -2
- package/dist/plus/integrations/constants.js.map +1 -1
- package/dist/plus/integrations/fieldPresence.js +17 -1
- package/dist/plus/integrations/fieldPresence.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +1 -1
- package/dist/plus/integrations/integrationService.js +8 -2
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/lite.js +5 -6
- package/dist/plus/integrations/lite.js.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +11 -1
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/asana.d.ts +91 -0
- package/dist/plus/integrations/providers/asana.js +344 -0
- package/dist/plus/integrations/providers/asana.js.map +1 -0
- package/dist/plus/integrations/providers/azure/azure.js +3 -2
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/models.js +3 -2
- package/dist/plus/integrations/providers/azure/models.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +7 -1
- package/dist/plus/integrations/providers/azureDevOps.js +9 -1
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/discovery.js +2 -1
- package/dist/plus/integrations/providers/bitbucket-server/discovery.js.map +1 -1
- package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +2 -2
- package/dist/plus/integrations/providers/github.js +2 -2
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/issueSorts.d.ts +5 -0
- package/dist/plus/integrations/providers/issueSorts.js +6 -1
- package/dist/plus/integrations/providers/issueSorts.js.map +1 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js +2 -1
- package/dist/plus/integrations/providers/jiraIssueByKey.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +19 -3
- package/dist/plus/integrations/providers/models.js +12 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/providers/providerApiClient.d.ts +0 -3
- package/dist/plus/integrations/providers/providerApiClient.js +1 -3
- package/dist/plus/integrations/providers/providerApiClient.js.map +1 -1
- package/dist/plus/integrations/providers/providersApi.d.ts +22 -1
- package/dist/plus/integrations/providers/providersApi.js +63 -12
- package/dist/plus/integrations/providers/providersApi.js.map +1 -1
- package/dist/plus/integrations/providers/utils.d.ts +1 -0
- package/dist/plus/integrations/providers/utils.js +8 -2
- package/dist/plus/integrations/providers/utils.js.map +1 -1
- package/dist/plus/integrations/reads/hierarchy.utils.d.ts +3 -3
- package/dist/plus/integrations/reads/hierarchy.utils.js +4 -4
- package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +29 -21
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/dist/plus/integrations/results.d.ts +18 -10
- package/dist/plus/integrations/results.js.map +1 -1
- package/dist/plus/integrations/utils/domain.utils.js +2 -1
- package/dist/plus/integrations/utils/domain.utils.js.map +1 -1
- package/dist/plus/integrations/utils/integration.utils.js +5 -13
- package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
- package/dist/utils/diff.d.ts +19 -0
- package/dist/utils/diff.js +121 -3
- package/dist/utils/diff.js.map +1 -1
- package/dist/utils/env/node/exec.d.ts +0 -1
- package/dist/utils/env/node/exec.js +2 -14
- package/dist/utils/env/node/exec.js.map +1 -1
- package/dist/utils/path.d.ts +2 -0
- package/dist/utils/path.js +7 -1
- package/dist/utils/path.js.map +1 -1
- package/docs/integrations.md +72 -43
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revision.js","names":[],"sources":["../../../../git-cli/src/providers/revision.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport { ShowError } from '@gitlens/git/errors.js';\nimport type { GitFileStatus } from '@gitlens/git/models/fileStatus.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTreeEntry } from '@gitlens/git/models/tree.js';\nimport type { GitRevisionSubProvider, ResolvedRevision } from '@gitlens/git/providers/revision.js';\nimport {\n\tisRevisionWithSuffix,\n\tisSha,\n\tisUncommitted,\n\tisUncommittedStaged,\n\tisUncommittedWithParentSuffix,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { CancellationError } from '@gitlens/utils/cancellation.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { first } from '@gitlens/utils/iterable.js';\nimport { splitPath } from '@gitlens/utils/path.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { toFsPath } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport type { GitErrorHandling, GitRunOptions } from '../exec/exec.types.js';\nimport type { Git } from '../exec/git.js';\nimport {\n\tbatchLiteralPathspecs,\n\tdefaultExceptionHandler,\n\tgetGitCommandError,\n\tgitConfigsLog,\n\tGitErrors,\n} from '../exec/git.js';\nimport { parseGitLsFilesStaged } from '../parsers/indexParser.js';\nimport { getShaAndFileSummaryLogParser } from '../parsers/logParser.js';\nimport { parseGitTree } from '../parsers/treeParser.js';\n\nconst emptyArray: readonly GitTreeEntry[] = Object.freeze([]);\n\nexport class RevisionGitSubProvider implements GitRevisionSubProvider {\n\tconstructor(\n\t\tprivate readonly context: GitServiceContext,\n\t\tprivate readonly git: Git,\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: CliGitProviderInternal,\n\t) {}\n\n\texists(\n\t\trepoPath: string,\n\t\tpath: string,\n\t\trevOrOptions?: string | { untracked?: 'only' | 'include' },\n\t): Promise<boolean> {\n\t\tlet rev: string | undefined;\n\t\tlet untracked: 'only' | 'include' | undefined;\n\t\tif (typeof revOrOptions === 'string') {\n\t\t\trev = revOrOptions;\n\t\t} else if (revOrOptions != null) {\n\t\t\tuntracked = revOrOptions.untracked;\n\t\t}\n\n\t\tconst cacheKey = `${path}\\0${rev ?? ''}\\0${untracked ?? ''}`;\n\t\treturn this.cache.fileExistence.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst args = ['ls-files'];\n\t\t\tif (rev) {\n\t\t\t\tif (!isUncommitted(rev)) {\n\t\t\t\t\targs.push(`--with-tree=${rev}`);\n\t\t\t\t} else if (isUncommittedStaged(rev)) {\n\t\t\t\t\targs.push('--stage');\n\t\t\t\t}\n\t\t\t} else if (untracked === 'only') {\n\t\t\t\targs.push('-o');\n\t\t\t} else if (untracked === 'include') {\n\t\t\t\t// Tracked (cached) OR untracked (others)\n\t\t\t\targs.push('-c', '-o');\n\t\t\t}\n\n\t\t\tconst result = await this.git.run({ cwd: repoPath, errors: 'ignore' }, ...args, '--', path);\n\t\t\treturn Boolean(result.stdout.trim());\n\t\t});\n\t}\n\n\t/** `hash-object` without `-w` computes the id in the repository's format without storing anything */\n\t@debug({ quiet: true })\n\tgetEmptyTreeSha(repoPath: string): Promise<string> {\n\t\treturn this.cache.getEmptyTreeSha(repoPath, async () => {\n\t\t\tconst result = await this.git.run(\n\t\t\t\t{ cwd: repoPath, stdin: '', errors: 'throw' },\n\t\t\t\t'hash-object',\n\t\t\t\t'-t',\n\t\t\t\t'tree',\n\t\t\t\t'--stdin',\n\t\t\t);\n\t\t\treturn result.stdout.trim();\n\t\t});\n\t}\n\n\t@gate()\n\t@debug({ quiet: true })\n\tgetRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined> {\n\t\tconst [relativePath, root] = splitPath(path, repoPath);\n\t\treturn this.showContentCore<Buffer>(root, relativePath, rev, { encoding: 'buffer', errors: 'throw' });\n\t}\n\n\t@debug({ quiet: true })\n\tasync getSubmoduleHead(repoPath: string, submodulePath: string): Promise<string | undefined> {\n\t\t// Verify the path is a submodule (gitlink commit) in the parent tree, not just a regular directory\n\t\tconst treeEntry = await this.getTreeEntryForRevision(repoPath, submodulePath, 'HEAD');\n\t\tif (treeEntry?.type !== 'commit') return undefined;\n\n\t\tconst [relativePath, root] = splitPath(submodulePath, repoPath);\n\t\tconst submoduleFullPath = this.provider.getAbsoluteUri(relativePath, root).fsPath;\n\n\t\tconst result = await this.git.run({ cwd: submoduleFullPath, errors: 'ignore' }, 'rev-parse', 'HEAD');\n\t\tconst sha = result.stdout.trim();\n\t\treturn sha || undefined;\n\t}\n\n\t@gate()\n\t@debug({ quiet: true })\n\tasync getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined> {\n\t\tif (!repoPath || !path) return undefined;\n\n\t\tconst [relativePath, root] = splitPath(path, repoPath);\n\n\t\tif (isUncommittedStaged(rev)) {\n\t\t\tlet result = await this.git.run(\n\t\t\t\t{ cwd: root, errors: 'ignore' },\n\t\t\t\t'ls-files',\n\t\t\t\t'-z',\n\t\t\t\t'--stage',\n\t\t\t\t'--',\n\t\t\t\trelativePath,\n\t\t\t);\n\n\t\t\tconst entries = parseGitLsFilesStaged(result.stdout, true);\n\t\t\tif (entries.length === 0) return undefined;\n\n\t\t\tconst entry = entries[0];\n\t\t\tresult = await this.git.run({ cwd: root }, 'cat-file', '-s', entry.oid);\n\t\t\tconst size = parseInt(result.stdout.trim(), 10) || 0;\n\n\t\t\treturn { ref: rev, oid: entry.oid, path: relativePath, size: size, type: 'blob' };\n\t\t}\n\n\t\tconst [entry] = await this.getTreeForRevisionCore(repoPath, rev, path);\n\t\treturn entry;\n\t}\n\n\t@debug({ quiet: true })\n\tasync getTrackedFiles(\n\t\trepoPath: string,\n\t\toptions?: { paths?: readonly string[] },\n\t\tcancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tif (!repoPath) return [];\n\n\t\tconst paths = options?.paths;\n\t\t// No pathspec means \"everything\" to git, which is not what an empty list asks for\n\t\tif (paths != null && !paths.length) return [];\n\n\t\tconst prefix = ['ls-files', '-z'];\n\t\t// A single run when unscoped, otherwise batched to stay under the command-line length limit\n\t\tconst batches = paths != null ? batchLiteralPathspecs(paths, prefix) : [undefined];\n\n\t\t// Unmerged entries are listed once per stage, and a path can sit under more than one scope\n\t\tconst files = new Set<string>();\n\t\tfor (const batch of batches) {\n\t\t\tconst result = await this.git.run(\n\t\t\t\t{ cwd: repoPath, errors: 'ignore', cancellation: cancellation },\n\t\t\t\t...prefix,\n\t\t\t\t...(batch != null ? ['--', ...batch] : []),\n\t\t\t);\n\t\t\t// `errors: 'ignore'` resolves an abort as an empty listing, which would read as a folder with no files\n\t\t\tif (result.completion.status === 'cancelled' || cancellation?.aborted) throw new CancellationError();\n\n\t\t\tfor (const file of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\t\tif (file) {\n\t\t\t\t\tfiles.add(file);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn [...files];\n\t}\n\n\t@debug({ quiet: true })\n\tasync getTreeForRevision(\n\t\trepoPath: string,\n\t\trev: string,\n\t\toptions?: { paths?: readonly string[] },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitTreeEntry[]> {\n\t\tif (!repoPath) return [];\n\n\t\tconst paths = options?.paths;\n\t\tif (paths == null) return this.getTreeForRevisionCore(repoPath, rev, undefined, undefined, cancellation);\n\t\t// No pathspec means \"everything\" to git, which is not what an empty list asks for\n\t\tif (!paths.length) return [];\n\n\t\t// A scope's ancestor folders are listed with it, and a path can sit under more than one scope\n\t\tconst seen = new Set<string>();\n\t\tconst entries: GitTreeEntry[] = [];\n\t\tfor (const batch of batchLiteralPathspecs(paths, ['ls-tree', '-lrt', rev])) {\n\t\t\tfor (const entry of await this.getTreeForRevisionCore(repoPath, rev, undefined, batch, cancellation)) {\n\t\t\t\tif (!seen.has(entry.path)) {\n\t\t\t\t\tseen.add(entry.path);\n\t\t\t\t\tentries.push(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn entries;\n\t}\n\n\t/**\n\t * A read with a signal skips the gate, whose default key can't tell signals apart (one caller's abort would cancel\n\t * another's read) and which keeps an instance property per key for good (a key per signal would grow without end).\n\t * `git.run` still joins such a read to an identical one with the same signal\n\t */\n\tprivate getTreeForRevisionCore(\n\t\trepoPath: string,\n\t\trev: string,\n\t\tpath?: string,\n\t\tpathspecs?: readonly string[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitTreeEntry[]> {\n\t\treturn cancellation != null\n\t\t\t? this.lsTree(repoPath, rev, path, pathspecs, cancellation)\n\t\t\t: this.getTreeForRevisionGated(repoPath, rev, path, pathspecs);\n\t}\n\n\t@gate()\n\tprivate getTreeForRevisionGated(\n\t\trepoPath: string,\n\t\trev: string,\n\t\tpath?: string,\n\t\tpathspecs?: readonly string[],\n\t): Promise<GitTreeEntry[]> {\n\t\treturn this.lsTree(repoPath, rev, path, pathspecs);\n\t}\n\n\tprivate async lsTree(\n\t\trepoPath: string,\n\t\trev: string,\n\t\tpath?: string,\n\t\tpathspecs?: readonly string[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitTreeEntry[]> {\n\t\tconst hasPath = Boolean(path);\n\t\tconst args = hasPath\n\t\t\t? ['ls-tree', '-l', rev, '--', path]\n\t\t\t: ['ls-tree', '-lrt', rev, '--', ...(pathspecs ?? [])];\n\t\tconst result = await this.git.run({ cwd: repoPath, errors: 'ignore', cancellation: cancellation }, ...args);\n\t\t// `errors: 'ignore'` resolves an abort as an empty tree, which would read as a folder with no entries\n\t\tif (result.completion.status === 'cancelled' || cancellation?.aborted) throw new CancellationError();\n\n\t\tconst data = result.stdout.trim();\n\t\tif (!data) return emptyArray as GitTreeEntry[];\n\n\t\treturn parseGitTree(data, rev, hasPath);\n\t}\n\n\tprivate async showContentCore<T extends string | Buffer>(\n\t\trepoPath: string | undefined,\n\t\tpath: string,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tencoding?: string;\n\t\t\terrors?: GitErrorHandling;\n\t\t},\n\t): Promise<T | undefined> {\n\t\tconst [file, root] = splitPath(path, repoPath, true);\n\n\t\tif (isUncommittedStaged(rev)) {\n\t\t\trev = ':';\n\t\t}\n\t\tif (isUncommitted(rev)) throw new Error(`ref=${rev} is uncommitted`);\n\n\t\tconst opts: GitRunOptions = {\n\t\t\tconfigs: gitConfigsLog,\n\t\t\tcwd: root,\n\t\t\tencoding: options?.encoding ?? 'utf8',\n\t\t\terrors: 'throw',\n\t\t};\n\t\tconst args = rev.endsWith(':') ? `${rev}./${file}` : `${rev}:./${file}`;\n\t\tconst params = ['show', '--textconv', args, '--'];\n\n\t\ttry {\n\t\t\tconst result = await this.git.run<T>(opts, ...params);\n\t\t\treturn result.stdout;\n\t\t} catch (ex) {\n\t\t\tconst msg: string = ex?.toString() ?? '';\n\t\t\tif (rev === ':' && GitErrors.badRevision.test(msg)) {\n\t\t\t\treturn this.showContentCore<T>(repoPath, path, 'HEAD:', options);\n\t\t\t}\n\n\t\t\tconst error = getGitCommandError(\n\t\t\t\t'show',\n\t\t\t\tex,\n\t\t\t\treason =>\n\t\t\t\t\tnew ShowError(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason: reason ?? 'other',\n\t\t\t\t\t\t\trev: rev,\n\t\t\t\t\t\t\tpath: path,\n\t\t\t\t\t\t\tgitCommand: { repoPath: repoPath ?? '', args: params },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tex,\n\t\t\t\t\t),\n\t\t\t);\n\t\t\tif (options?.errors === 'throw') throw error;\n\n\t\t\tif (\n\t\t\t\tShowError.is(error, 'invalidObject') ||\n\t\t\t\tShowError.is(error, 'invalidRevision') ||\n\t\t\t\tShowError.is(error, 'notFound') ||\n\t\t\t\tShowError.is(error, 'notInRevision')\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tdefaultExceptionHandler(ex, opts.cwd);\n\t\t\treturn '' as T;\n\t\t}\n\t}\n\n\t@debug({ quiet: true, args: (repoPath, shas) => ({ repoPath: repoPath, shas: `${shas.size} value(s)` }) })\n\tasync resolveShas(repoPath: string, shas: ReadonlySet<string>, cancellation?: AbortSignal): Promise<Set<string>> {\n\t\tconst resolved = new Set<string>();\n\t\tconst prefixes: string[] = [];\n\n\t\tfor (const value of shas) {\n\t\t\t// Pure hex 4-40 chars: resolve to full commit SHA(s) via disambiguation. Everything else\n\t\t\t// (refs, suffixed SHAs like `^`/`~1`/`:path`, non-hex, <4 hex) passes through unchanged.\n\t\t\tif (/^[0-9a-f]{4,40}$/i.test(value)) {\n\t\t\t\tprefixes.push(value);\n\t\t\t} else {\n\t\t\t\tresolved.add(value);\n\t\t\t}\n\t\t}\n\n\t\tif (prefixes.length) {\n\t\t\t// List every object (any type) whose id starts with any prefix (empty + exit 0 if none)\n\t\t\tconst rp = await this.git.run(\n\t\t\t\t{ cwd: repoPath, cancellation: cancellation, errors: 'ignore' },\n\t\t\t\t'rev-parse',\n\t\t\t\t...prefixes.map(p => `--disambiguate=${p}`),\n\t\t\t);\n\t\t\tconst oids = rp.stdout.split('\\n').filter(Boolean);\n\t\t\tif (oids.length) {\n\t\t\t\t// `--disambiguate` has no type filter, so keep only commit objects\n\t\t\t\tconst cf = await this.git.run(\n\t\t\t\t\t{ cwd: repoPath, cancellation: cancellation, errors: 'ignore', stdin: `${oids.join('\\n')}\\n` },\n\t\t\t\t\t'cat-file',\n\t\t\t\t\t'--batch-check=%(objectname) %(objecttype)',\n\t\t\t\t);\n\t\t\t\tfor (const line of cf.stdout.split('\\n')) {\n\t\t\t\t\tconst [oid, type] = line.split(' ');\n\t\t\t\t\tif (type === 'commit') {\n\t\t\t\t\t\tresolved.add(oid);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn resolved;\n\t}\n\n\t@debug({ quiet: true })\n\tasync resolveRevision(\n\t\trepoPath: string,\n\t\tref: string,\n\t\tpathOrUri?: string | Uri,\n\t\toptions?: { force?: boolean },\n\t): Promise<ResolvedRevision> {\n\t\tconst path = pathOrUri != null ? toFsPath(pathOrUri) : undefined;\n\t\tif (!ref || ref === deletedOrMissing) return { sha: ref, revision: ref };\n\n\t\tif (path == null) {\n\t\t\tif (isSha(ref)) return { sha: ref, revision: ref };\n\t\t\tif (ref.endsWith('^3')) return { sha: ref, revision: ref };\n\t\t} else if (isUncommitted(ref)) {\n\t\t\t// Uncommitted refs depend on index/working-tree state — resolve without caching\n\t\t\treturn this.resolveRevisionCore(repoPath, ref, path);\n\t\t}\n\n\t\tconst key = path != null ? `${ref}|${this.provider.getRelativePath(path, repoPath)}` : ref;\n\t\tif (options?.force) {\n\t\t\t// Hard-delete first: a later caller must never join a read that started before this one.\n\t\t\tthis.cache.resolvedRevisions.delete(repoPath, key);\n\t\t}\n\n\t\treturn this.cache.resolvedRevisions.getOrCreate(repoPath, key, () =>\n\t\t\tthis.resolveRevisionCore(repoPath, ref, path, options?.force),\n\t\t);\n\t}\n\n\tprivate async resolveRevisionCore(\n\t\trepoPath: string,\n\t\tref: string,\n\t\tpath: string | undefined,\n\t\tforce?: boolean,\n\t): Promise<ResolvedRevision> {\n\t\tif (path == null) {\n\t\t\tconst sha = await this.provider.refs.validateReference(repoPath, ref, force ? { force: true } : undefined);\n\t\t\tif (sha == null) return { sha: ref, revision: ref };\n\n\t\t\treturn {\n\t\t\t\tsha: sha,\n\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? sha : ref,\n\t\t\t};\n\t\t}\n\n\t\tif (isUncommittedWithParentSuffix(ref)) {\n\t\t\tref = 'HEAD';\n\t\t}\n\t\tconst relativePath = this.provider.getRelativePath(path, repoPath);\n\n\t\tif (isUncommitted(ref)) {\n\t\t\tif (!isUncommittedStaged(ref)) {\n\t\t\t\treturn { sha: ref, revision: ref };\n\t\t\t}\n\n\t\t\t// Ensure that the file is actually staged\n\t\t\tconst status = await this.provider.status.getStatusForFile?.(repoPath, relativePath, { renames: false });\n\t\t\tif (status?.indexStatus) return { sha: ref, revision: ref };\n\n\t\t\tref = 'HEAD';\n\t\t}\n\n\t\tconst resolvedRevisionCaching = { cache: this.cache.gitResults, options: { accessTTL: 5 * 60 * 1000 } };\n\n\t\tconst parser = getShaAndFileSummaryLogParser();\n\t\tlet result = await this.git.run(\n\t\t\t// Forced here only: this read is keyed by `ref`, which can move; the follow-up below is keyed by a sha\n\t\t\t{ cwd: repoPath, errors: 'ignore', caching: { ...resolvedRevisionCaching, force: force } },\n\t\t\t'log',\n\t\t\t...parser.arguments,\n\t\t\t'-n1',\n\t\t\tref,\n\t\t\t'--',\n\t\t\trelativePath,\n\t\t);\n\n\t\tlet commit = first(parser.parse(result.stdout));\n\t\tlet file = commit?.files.find(f => f.path === relativePath);\n\t\tif (file == null) {\n\t\t\treturn {\n\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t};\n\t\t}\n\n\t\tif (file.status === 'A') {\n\t\t\treturn {\n\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t\tstatus: file.status as GitFileStatus,\n\t\t\t\toriginalPath: file.originalPath,\n\t\t\t};\n\t\t}\n\n\t\tif (file.status === 'D') {\n\t\t\t// If the file was deleted, check if it was moved or renamed\n\t\t\tresult = await this.git.run(\n\t\t\t\t{ cwd: repoPath, errors: 'ignore', caching: resolvedRevisionCaching },\n\t\t\t\t'log',\n\t\t\t\t...parser.arguments,\n\t\t\t\t'-n1',\n\n\t\t\t\tcommit!.sha,\n\t\t\t\t'--',\n\t\t\t);\n\n\t\t\tcommit = first(parser.parse(result.stdout));\n\t\t\tfile = commit?.files.find(f => f.path === relativePath || f.originalPath === relativePath);\n\t\t\tif (file == null) {\n\t\t\t\treturn {\n\t\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t// If it looks like non-sha like without a suffix then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t\tstatus: file.status as GitFileStatus,\n\t\t\t\tpath: file.path,\n\t\t\t\toriginalPath: file.originalPath,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\tstatus: file.status as GitFileStatus,\n\t\t\toriginalPath: file.originalPath,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,aAAsC,OAAO,OAAO,CAA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,OAAA;GAEb,UAAU,qBAAqB,GAAG,IAAK,QAAQ,OAAO,MAAO;GAC7D,QAAQ,KAAK;GACb,cAAc,KAAK;EACpB;CACD;AACD;AAraE,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,mBAAA,IAAA;AAcrB,WAAA,CAAA,KAAK,GACL,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,sBAAA,IAAA;AAMrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,oBAAA,IAAA;AAcrB,WAAA,CAAA,KAAK,GACL,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,2BAAA,IAAA;AA8BrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,mBAAA,IAAA;AAoCrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,sBAAA,IAAA;AA6CrB,WAAA,CAAA,KAAK,CAAA,GAAA,uBAAA,WAAA,2BAAA,IAAA;AA+FL,WAAA,CAAA,MAAM;CAAE,OAAO;CAAM,OAAO,UAAU,UAAU;EAAY;EAAU,MAAM,GAAG,KAAK,KAAK;CAAW;AAAG,CAAC,CAAA,GAAA,uBAAA,WAAA,eAAA,IAAA;AA0CxG,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,mBAAA,IAAA"}
|
|
1
|
+
{"version":3,"file":"revision.js","names":[],"sources":["../../../../git-cli/src/providers/revision.ts"],"sourcesContent":["import type { Cache } from '@gitlens/git/cache.js';\nimport type { GitServiceContext } from '@gitlens/git/context.js';\nimport { ShowError } from '@gitlens/git/errors.js';\nimport type { GitFileStatus } from '@gitlens/git/models/fileStatus.js';\nimport { deletedOrMissing } from '@gitlens/git/models/revision.js';\nimport type { GitTreeEntry } from '@gitlens/git/models/tree.js';\nimport type { GitRevisionSubProvider, ResolvedRevision } from '@gitlens/git/providers/revision.js';\nimport {\n\tisRevisionWithSuffix,\n\tisSha,\n\tisUncommitted,\n\tisUncommittedStaged,\n\tisUncommittedWithParentSuffix,\n} from '@gitlens/git/utils/revision.utils.js';\nimport { CancellationError } from '@gitlens/utils/cancellation.js';\nimport { gate } from '@gitlens/utils/decorators/gate.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport { first } from '@gitlens/utils/iterable.js';\nimport { joinPaths, splitPath } from '@gitlens/utils/path.js';\nimport { iterateByDelimiter } from '@gitlens/utils/string.js';\nimport type { Uri } from '@gitlens/utils/uri.js';\nimport { toFsPath } from '@gitlens/utils/uri.js';\nimport type { CliGitProviderInternal } from '../cliGitProvider.js';\nimport type { GitErrorHandling, GitRunOptions } from '../exec/exec.types.js';\nimport type { Git } from '../exec/git.js';\nimport {\n\tbatchLiteralPathspecs,\n\tdefaultExceptionHandler,\n\tgetGitCommandError,\n\tgitConfigsLog,\n\tGitErrors,\n} from '../exec/git.js';\nimport { parseGitLsFilesStaged } from '../parsers/indexParser.js';\nimport { getShaAndFileSummaryLogParser } from '../parsers/logParser.js';\nimport { parseGitTree } from '../parsers/treeParser.js';\n\nconst emptyArray: readonly GitTreeEntry[] = Object.freeze([]);\n\nexport class RevisionGitSubProvider implements GitRevisionSubProvider {\n\tconstructor(\n\t\tprivate readonly context: GitServiceContext,\n\t\tprivate readonly git: Git,\n\t\tprivate readonly cache: Cache,\n\t\tprivate readonly provider: CliGitProviderInternal,\n\t) {}\n\n\texists(\n\t\trepoPath: string,\n\t\tpath: string,\n\t\trevOrOptions?: string | { untracked?: 'only' | 'include' },\n\t): Promise<boolean> {\n\t\tlet rev: string | undefined;\n\t\tlet untracked: 'only' | 'include' | undefined;\n\t\tif (typeof revOrOptions === 'string') {\n\t\t\trev = revOrOptions;\n\t\t} else if (revOrOptions != null) {\n\t\t\tuntracked = revOrOptions.untracked;\n\t\t}\n\n\t\tconst cacheKey = `${path}\\0${rev ?? ''}\\0${untracked ?? ''}`;\n\t\treturn this.cache.fileExistence.getOrCreate(repoPath, cacheKey, async () => {\n\t\t\tconst args = ['ls-files'];\n\t\t\tif (rev) {\n\t\t\t\tif (!isUncommitted(rev)) {\n\t\t\t\t\targs.push(`--with-tree=${rev}`);\n\t\t\t\t} else if (isUncommittedStaged(rev)) {\n\t\t\t\t\targs.push('--stage');\n\t\t\t\t}\n\t\t\t} else if (untracked === 'only') {\n\t\t\t\targs.push('-o');\n\t\t\t} else if (untracked === 'include') {\n\t\t\t\t// Tracked (cached) OR untracked (others)\n\t\t\t\targs.push('-c', '-o');\n\t\t\t}\n\n\t\t\t// Literal, or a missing `[id]/page.tsx` would count as existing whenever `i/page.tsx` does\n\t\t\tconst result = await this.git.run({ cwd: repoPath, errors: 'ignore' }, ...args, '--', `:(literal)${path}`);\n\t\t\treturn Boolean(result.stdout.trim());\n\t\t});\n\t}\n\n\t@debug()\n\tasync getBlobIds(\n\t\trepoPath: string,\n\t\tpaths: readonly string[],\n\t\tsource: 'index' | 'working',\n\t\tcancellation?: AbortSignal,\n\t): Promise<Map<string, string>> {\n\t\tconst ids = new Map<string, string>();\n\t\tif (paths.length === 0) return ids;\n\n\t\tif (source === 'index') {\n\t\t\t// Literal pathspecs, so a file named like `[id]/page.tsx` doesn't also match `i/page.tsx`\n\t\t\tconst prefix = ['ls-files', '-z', '--stage'];\n\t\t\tfor (const batch of batchLiteralPathspecs(paths, prefix)) {\n\t\t\t\tconst result = await this.git.run(\n\t\t\t\t\t{ cwd: repoPath, cancellation: cancellation, errors: 'ignore' },\n\t\t\t\t\t...prefix,\n\t\t\t\t\t'--',\n\t\t\t\t\t...batch,\n\t\t\t\t);\n\t\t\t\tfor (const entry of parseGitLsFilesStaged(result.stdout, false)) {\n\t\t\t\t\t// A conflicted path lists one entry per stage; the first is as good an identity as any\n\t\t\t\t\tif (!ids.has(entry.path)) {\n\t\t\t\t\t\tids.set(entry.path, entry.oid);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ids;\n\t\t}\n\n\t\t// `hash-object` without `-w` computes ids without storing anything; `--stdin-paths` hashes them\n\t\t// all in one process, printing one line per path in input order. A path it can't hash (a\n\t\t// submodule, a directory, a missing or unreadable file) ends the run right there, after the ids\n\t\t// of the paths before it — so the first missing line names the culprit, and the rest resume in\n\t\t// a new run after it.\n\t\tconst unhashable: string[] = [];\n\t\tlet start = 0;\n\t\twhile (start < paths.length) {\n\t\t\tconst pending = paths.slice(start);\n\t\t\tconst result = await this.git.run(\n\t\t\t\t{ cwd: repoPath, cancellation: cancellation, errors: 'ignore', stdin: `${pending.join('\\n')}\\n` },\n\t\t\t\t'hash-object',\n\t\t\t\t'--stdin-paths',\n\t\t\t);\n\t\t\tconst lines = result.stdout.split('\\n');\n\t\t\tlet hashed = 0;\n\t\t\twhile (hashed < pending.length) {\n\t\t\t\tconst oid = lines[hashed]?.trim();\n\t\t\t\tif (!oid) break;\n\n\t\t\t\tids.set(pending[hashed], oid);\n\t\t\t\thashed++;\n\t\t\t}\n\t\t\tif (hashed === pending.length) break;\n\t\t\t// Only a run that exited with an error stopped at a path; a cancelled or never-started one\n\t\t\t// says nothing about which path is to blame\n\t\t\tif (result.completion.status !== 'exited' || result.completion.code === 0) break;\n\n\t\t\tunhashable.push(pending[hashed]);\n\t\t\tstart += hashed + 1;\n\t\t}\n\n\t\tif (unhashable.length && !cancellation?.aborted) {\n\t\t\tawait Promise.all(\n\t\t\t\tunhashable.map(async path => {\n\t\t\t\t\tconst oid = await this.getCheckedOutSubmoduleCommit(repoPath, path, cancellation);\n\t\t\t\t\tif (oid) {\n\t\t\t\t\t\tids.set(path, oid);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn ids;\n\t}\n\n\t/** The commit checked out in the submodule at `path` — what the index records for it too, so its id\n\t * moves when the submodule does. Anything else that couldn't be hashed has no id. */\n\tprivate async getCheckedOutSubmoduleCommit(\n\t\trepoPath: string,\n\t\tpath: string,\n\t\tcancellation: AbortSignal | undefined,\n\t): Promise<string | undefined> {\n\t\t// Inside a plain directory git finds the outer repository and reports a non-empty prefix (`dir/`);\n\t\t// only the top of a repository of its own answers with an empty one\n\t\tconst result = await this.git.run(\n\t\t\t{ cwd: joinPaths(repoPath, path), cancellation: cancellation, errors: 'ignore' },\n\t\t\t'rev-parse',\n\t\t\t'--show-prefix',\n\t\t\t'HEAD',\n\t\t);\n\t\tif (result.completion.status !== 'exited' || result.completion.code !== 0) return undefined;\n\n\t\tconst [prefix, sha] = result.stdout.split('\\n');\n\t\treturn prefix === '' ? sha?.trim() || undefined : undefined;\n\t}\n\n\t/** `hash-object` without `-w` computes the id in the repository's format without storing anything */\n\t@debug({ quiet: true })\n\tgetEmptyTreeSha(repoPath: string): Promise<string> {\n\t\treturn this.cache.getEmptyTreeSha(repoPath, async () => {\n\t\t\tconst result = await this.git.run(\n\t\t\t\t{ cwd: repoPath, stdin: '', errors: 'throw' },\n\t\t\t\t'hash-object',\n\t\t\t\t'-t',\n\t\t\t\t'tree',\n\t\t\t\t'--stdin',\n\t\t\t);\n\t\t\treturn result.stdout.trim();\n\t\t});\n\t}\n\n\t@gate()\n\t@debug({ quiet: true })\n\tgetRevisionContent(repoPath: string, path: string, rev: string): Promise<Uint8Array | undefined> {\n\t\tconst [relativePath, root] = splitPath(path, repoPath);\n\t\treturn this.showContentCore<Buffer>(root, relativePath, rev, { encoding: 'buffer', errors: 'throw' });\n\t}\n\n\t@debug({ quiet: true })\n\tasync getSubmoduleHead(repoPath: string, submodulePath: string): Promise<string | undefined> {\n\t\t// Verify the path is a submodule (gitlink commit) in the parent tree, not just a regular directory\n\t\tconst treeEntry = await this.getTreeEntryForRevision(repoPath, submodulePath, 'HEAD');\n\t\tif (treeEntry?.type !== 'commit') return undefined;\n\n\t\tconst [relativePath, root] = splitPath(submodulePath, repoPath);\n\t\tconst submoduleFullPath = this.provider.getAbsoluteUri(relativePath, root).fsPath;\n\n\t\tconst result = await this.git.run({ cwd: submoduleFullPath, errors: 'ignore' }, 'rev-parse', 'HEAD');\n\t\tconst sha = result.stdout.trim();\n\t\treturn sha || undefined;\n\t}\n\n\t@gate()\n\t@debug({ quiet: true })\n\tasync getTreeEntryForRevision(repoPath: string, path: string, rev: string): Promise<GitTreeEntry | undefined> {\n\t\tif (!repoPath || !path) return undefined;\n\n\t\tconst [relativePath, root] = splitPath(path, repoPath);\n\n\t\tif (isUncommittedStaged(rev)) {\n\t\t\tlet result = await this.git.run(\n\t\t\t\t{ cwd: root, errors: 'ignore' },\n\t\t\t\t'ls-files',\n\t\t\t\t'-z',\n\t\t\t\t'--stage',\n\t\t\t\t'--',\n\t\t\t\t// Literal, or a glob-like name could read the entry of a different file that it matches\n\t\t\t\t`:(literal)${relativePath}`,\n\t\t\t);\n\n\t\t\tconst entries = parseGitLsFilesStaged(result.stdout, true);\n\t\t\tif (entries.length === 0) return undefined;\n\n\t\t\tconst entry = entries[0];\n\t\t\tresult = await this.git.run({ cwd: root }, 'cat-file', '-s', entry.oid);\n\t\t\tconst size = parseInt(result.stdout.trim(), 10) || 0;\n\n\t\t\treturn { ref: rev, oid: entry.oid, path: relativePath, size: size, type: 'blob' };\n\t\t}\n\n\t\tconst [entry] = await this.getTreeForRevisionCore(repoPath, rev, path);\n\t\treturn entry;\n\t}\n\n\t@debug({ quiet: true })\n\tasync getTrackedFiles(\n\t\trepoPath: string,\n\t\toptions?: { paths?: readonly string[] },\n\t\tcancellation?: AbortSignal,\n\t): Promise<string[]> {\n\t\tif (!repoPath) return [];\n\n\t\tconst paths = options?.paths;\n\t\t// No pathspec means \"everything\" to git, which is not what an empty list asks for\n\t\tif (paths != null && !paths.length) return [];\n\n\t\tconst prefix = ['ls-files', '-z'];\n\t\t// A single run when unscoped, otherwise batched to stay under the command-line length limit\n\t\tconst batches = paths != null ? batchLiteralPathspecs(paths, prefix) : [undefined];\n\n\t\t// Unmerged entries are listed once per stage, and a path can sit under more than one scope\n\t\tconst files = new Set<string>();\n\t\tfor (const batch of batches) {\n\t\t\tconst result = await this.git.run(\n\t\t\t\t{ cwd: repoPath, errors: 'ignore', cancellation: cancellation },\n\t\t\t\t...prefix,\n\t\t\t\t...(batch != null ? ['--', ...batch] : []),\n\t\t\t);\n\t\t\t// `errors: 'ignore'` resolves an abort as an empty listing, which would read as a folder with no files\n\t\t\tif (result.completion.status === 'cancelled' || cancellation?.aborted) throw new CancellationError();\n\n\t\t\tfor (const file of iterateByDelimiter(result.stdout, '\\0')) {\n\t\t\t\tif (file) {\n\t\t\t\t\tfiles.add(file);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn [...files];\n\t}\n\n\t@debug({ quiet: true })\n\tasync getTreeForRevision(\n\t\trepoPath: string,\n\t\trev: string,\n\t\toptions?: { paths?: readonly string[] },\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitTreeEntry[]> {\n\t\tif (!repoPath) return [];\n\n\t\tconst paths = options?.paths;\n\t\tif (paths == null) return this.getTreeForRevisionCore(repoPath, rev, undefined, undefined, cancellation);\n\t\t// No pathspec means \"everything\" to git, which is not what an empty list asks for\n\t\tif (!paths.length) return [];\n\n\t\t// A scope's ancestor folders are listed with it, and a path can sit under more than one scope\n\t\tconst seen = new Set<string>();\n\t\tconst entries: GitTreeEntry[] = [];\n\t\tfor (const batch of batchLiteralPathspecs(paths, ['ls-tree', '-lrt', rev])) {\n\t\t\tfor (const entry of await this.getTreeForRevisionCore(repoPath, rev, undefined, batch, cancellation)) {\n\t\t\t\tif (!seen.has(entry.path)) {\n\t\t\t\t\tseen.add(entry.path);\n\t\t\t\t\tentries.push(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn entries;\n\t}\n\n\t/**\n\t * A read with a signal skips the gate, whose default key can't tell signals apart (one caller's abort would cancel\n\t * another's read) and which keeps an instance property per key for good (a key per signal would grow without end).\n\t * `git.run` still joins such a read to an identical one with the same signal\n\t */\n\tprivate getTreeForRevisionCore(\n\t\trepoPath: string,\n\t\trev: string,\n\t\tpath?: string,\n\t\tpathspecs?: readonly string[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitTreeEntry[]> {\n\t\treturn cancellation != null\n\t\t\t? this.lsTree(repoPath, rev, path, pathspecs, cancellation)\n\t\t\t: this.getTreeForRevisionGated(repoPath, rev, path, pathspecs);\n\t}\n\n\t@gate()\n\tprivate getTreeForRevisionGated(\n\t\trepoPath: string,\n\t\trev: string,\n\t\tpath?: string,\n\t\tpathspecs?: readonly string[],\n\t): Promise<GitTreeEntry[]> {\n\t\treturn this.lsTree(repoPath, rev, path, pathspecs);\n\t}\n\n\tprivate async lsTree(\n\t\trepoPath: string,\n\t\trev: string,\n\t\tpath?: string,\n\t\tpathspecs?: readonly string[],\n\t\tcancellation?: AbortSignal,\n\t): Promise<GitTreeEntry[]> {\n\t\tconst hasPath = Boolean(path);\n\t\tconst args = hasPath\n\t\t\t? ['ls-tree', '-l', rev, '--', path]\n\t\t\t: ['ls-tree', '-lrt', rev, '--', ...(pathspecs ?? [])];\n\t\tconst result = await this.git.run({ cwd: repoPath, errors: 'ignore', cancellation: cancellation }, ...args);\n\t\t// `errors: 'ignore'` resolves an abort as an empty tree, which would read as a folder with no entries\n\t\tif (result.completion.status === 'cancelled' || cancellation?.aborted) throw new CancellationError();\n\n\t\tconst data = result.stdout.trim();\n\t\tif (!data) return emptyArray as GitTreeEntry[];\n\n\t\treturn parseGitTree(data, rev, hasPath);\n\t}\n\n\tprivate async showContentCore<T extends string | Buffer>(\n\t\trepoPath: string | undefined,\n\t\tpath: string,\n\t\trev: string,\n\t\toptions?: {\n\t\t\tencoding?: string;\n\t\t\terrors?: GitErrorHandling;\n\t\t},\n\t): Promise<T | undefined> {\n\t\tconst [file, root] = splitPath(path, repoPath, true);\n\n\t\tif (isUncommittedStaged(rev)) {\n\t\t\trev = ':';\n\t\t}\n\t\tif (isUncommitted(rev)) throw new Error(`ref=${rev} is uncommitted`);\n\n\t\tconst opts: GitRunOptions = {\n\t\t\tconfigs: gitConfigsLog,\n\t\t\tcwd: root,\n\t\t\tencoding: options?.encoding ?? 'utf8',\n\t\t\terrors: 'throw',\n\t\t};\n\t\tconst args = rev.endsWith(':') ? `${rev}./${file}` : `${rev}:./${file}`;\n\t\tconst params = ['show', '--textconv', args, '--'];\n\n\t\ttry {\n\t\t\tconst result = await this.git.run<T>(opts, ...params);\n\t\t\treturn result.stdout;\n\t\t} catch (ex) {\n\t\t\tconst msg: string = ex?.toString() ?? '';\n\t\t\tif (rev === ':' && GitErrors.badRevision.test(msg)) {\n\t\t\t\treturn this.showContentCore<T>(repoPath, path, 'HEAD:', options);\n\t\t\t}\n\n\t\t\tconst error = getGitCommandError(\n\t\t\t\t'show',\n\t\t\t\tex,\n\t\t\t\treason =>\n\t\t\t\t\tnew ShowError(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treason: reason ?? 'other',\n\t\t\t\t\t\t\trev: rev,\n\t\t\t\t\t\t\tpath: path,\n\t\t\t\t\t\t\tgitCommand: { repoPath: repoPath ?? '', args: params },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tex,\n\t\t\t\t\t),\n\t\t\t);\n\t\t\tif (options?.errors === 'throw') throw error;\n\n\t\t\tif (\n\t\t\t\tShowError.is(error, 'invalidObject') ||\n\t\t\t\tShowError.is(error, 'invalidRevision') ||\n\t\t\t\tShowError.is(error, 'notFound') ||\n\t\t\t\tShowError.is(error, 'notInRevision')\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tdefaultExceptionHandler(ex, opts.cwd);\n\t\t\treturn '' as T;\n\t\t}\n\t}\n\n\t@debug({ quiet: true, args: (repoPath, shas) => ({ repoPath: repoPath, shas: `${shas.size} value(s)` }) })\n\tasync resolveShas(repoPath: string, shas: ReadonlySet<string>, cancellation?: AbortSignal): Promise<Set<string>> {\n\t\tconst resolved = new Set<string>();\n\t\tconst prefixes: string[] = [];\n\n\t\tfor (const value of shas) {\n\t\t\t// Pure hex 4-40 chars: resolve to full commit SHA(s) via disambiguation. Everything else\n\t\t\t// (refs, suffixed SHAs like `^`/`~1`/`:path`, non-hex, <4 hex) passes through unchanged.\n\t\t\tif (/^[0-9a-f]{4,40}$/i.test(value)) {\n\t\t\t\tprefixes.push(value);\n\t\t\t} else {\n\t\t\t\tresolved.add(value);\n\t\t\t}\n\t\t}\n\n\t\tif (prefixes.length) {\n\t\t\t// List every object (any type) whose id starts with any prefix (empty + exit 0 if none)\n\t\t\tconst rp = await this.git.run(\n\t\t\t\t{ cwd: repoPath, cancellation: cancellation, errors: 'ignore' },\n\t\t\t\t'rev-parse',\n\t\t\t\t...prefixes.map(p => `--disambiguate=${p}`),\n\t\t\t);\n\t\t\tconst oids = rp.stdout.split('\\n').filter(Boolean);\n\t\t\tif (oids.length) {\n\t\t\t\t// `--disambiguate` has no type filter, so keep only commit objects\n\t\t\t\tconst cf = await this.git.run(\n\t\t\t\t\t{ cwd: repoPath, cancellation: cancellation, errors: 'ignore', stdin: `${oids.join('\\n')}\\n` },\n\t\t\t\t\t'cat-file',\n\t\t\t\t\t'--batch-check=%(objectname) %(objecttype)',\n\t\t\t\t);\n\t\t\t\tfor (const line of cf.stdout.split('\\n')) {\n\t\t\t\t\tconst [oid, type] = line.split(' ');\n\t\t\t\t\tif (type === 'commit') {\n\t\t\t\t\t\tresolved.add(oid);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn resolved;\n\t}\n\n\t@debug({ quiet: true })\n\tasync resolveRevision(\n\t\trepoPath: string,\n\t\tref: string,\n\t\tpathOrUri?: string | Uri,\n\t\toptions?: { force?: boolean },\n\t): Promise<ResolvedRevision> {\n\t\tconst path = pathOrUri != null ? toFsPath(pathOrUri) : undefined;\n\t\tif (!ref || ref === deletedOrMissing) return { sha: ref, revision: ref };\n\n\t\tif (path == null) {\n\t\t\tif (isSha(ref)) return { sha: ref, revision: ref };\n\t\t\tif (ref.endsWith('^3')) return { sha: ref, revision: ref };\n\t\t} else if (isUncommitted(ref)) {\n\t\t\t// Uncommitted refs depend on index/working-tree state — resolve without caching\n\t\t\treturn this.resolveRevisionCore(repoPath, ref, path);\n\t\t}\n\n\t\tconst key = path != null ? `${ref}|${this.provider.getRelativePath(path, repoPath)}` : ref;\n\t\tif (options?.force) {\n\t\t\t// Hard-delete first: a later caller must never join a read that started before this one.\n\t\t\tthis.cache.resolvedRevisions.delete(repoPath, key);\n\t\t}\n\n\t\treturn this.cache.resolvedRevisions.getOrCreate(repoPath, key, () =>\n\t\t\tthis.resolveRevisionCore(repoPath, ref, path, options?.force),\n\t\t);\n\t}\n\n\tprivate async resolveRevisionCore(\n\t\trepoPath: string,\n\t\tref: string,\n\t\tpath: string | undefined,\n\t\tforce?: boolean,\n\t): Promise<ResolvedRevision> {\n\t\tif (path == null) {\n\t\t\tconst sha = await this.provider.refs.validateReference(repoPath, ref, force ? { force: true } : undefined);\n\t\t\tif (sha == null) return { sha: ref, revision: ref };\n\n\t\t\treturn {\n\t\t\t\tsha: sha,\n\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? sha : ref,\n\t\t\t};\n\t\t}\n\n\t\tif (isUncommittedWithParentSuffix(ref)) {\n\t\t\tref = 'HEAD';\n\t\t}\n\t\tconst relativePath = this.provider.getRelativePath(path, repoPath);\n\n\t\tif (isUncommitted(ref)) {\n\t\t\tif (!isUncommittedStaged(ref)) {\n\t\t\t\treturn { sha: ref, revision: ref };\n\t\t\t}\n\n\t\t\t// Ensure that the file is actually staged\n\t\t\tconst status = await this.provider.status.getStatusForFile?.(repoPath, relativePath, { renames: false });\n\t\t\tif (status?.indexStatus) return { sha: ref, revision: ref };\n\n\t\t\tref = 'HEAD';\n\t\t}\n\n\t\tconst resolvedRevisionCaching = { cache: this.cache.gitResults, options: { accessTTL: 5 * 60 * 1000 } };\n\n\t\tconst parser = getShaAndFileSummaryLogParser();\n\t\tlet result = await this.git.run(\n\t\t\t// Forced here only: this read is keyed by `ref`, which can move; the follow-up below is keyed by a sha\n\t\t\t{ cwd: repoPath, errors: 'ignore', caching: { ...resolvedRevisionCaching, force: force } },\n\t\t\t'log',\n\t\t\t...parser.arguments,\n\t\t\t'-n1',\n\t\t\tref,\n\t\t\t'--',\n\t\t\trelativePath,\n\t\t);\n\n\t\tlet commit = first(parser.parse(result.stdout));\n\t\tlet file = commit?.files.find(f => f.path === relativePath);\n\t\tif (file == null) {\n\t\t\treturn {\n\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t};\n\t\t}\n\n\t\tif (file.status === 'A') {\n\t\t\treturn {\n\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t\tstatus: file.status as GitFileStatus,\n\t\t\t\toriginalPath: file.originalPath,\n\t\t\t};\n\t\t}\n\n\t\tif (file.status === 'D') {\n\t\t\t// If the file was deleted, check if it was moved or renamed\n\t\t\tresult = await this.git.run(\n\t\t\t\t{ cwd: repoPath, errors: 'ignore', caching: resolvedRevisionCaching },\n\t\t\t\t'log',\n\t\t\t\t...parser.arguments,\n\t\t\t\t'-n1',\n\n\t\t\t\tcommit!.sha,\n\t\t\t\t'--',\n\t\t\t);\n\n\t\t\tcommit = first(parser.parse(result.stdout));\n\t\t\tfile = commit?.files.find(f => f.path === relativePath || f.originalPath === relativePath);\n\t\t\tif (file == null) {\n\t\t\t\treturn {\n\t\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t\t// If it looks like non-sha like without a suffix then preserve it as the friendly name\n\t\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\t\tstatus: file.status as GitFileStatus,\n\t\t\t\tpath: file.path,\n\t\t\t\toriginalPath: file.originalPath,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsha: commit?.sha ?? deletedOrMissing,\n\t\t\t// If it looks like non-sha like then preserve it as the friendly name\n\t\t\trevision: isRevisionWithSuffix(ref) ? (commit?.sha ?? ref) : ref,\n\t\t\tstatus: file.status as GitFileStatus,\n\t\t\toriginalPath: file.originalPath,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,MAAM,aAAsC,OAAO,OAAO,CAAC,CAAC;AAE5D,IAAa,yBAAb,MAAsE;CAEnD;CACA;CACA;CACA;CAJlB,YACC,SACA,KACA,OACA,UACC;EAJgB,KAAA,UAAA;EACA,KAAA,MAAA;EACA,KAAA,QAAA;EACA,KAAA,WAAA;CACf;CAEH,OACC,UACA,MACA,cACmB;EACnB,IAAI;EACJ,IAAI;EACJ,IAAI,OAAO,iBAAiB,UAC3B,MAAM;OACA,IAAI,gBAAgB,MAC1B,YAAY,aAAa;EAG1B,MAAM,WAAW,GAAG,KAAK,IAAI,OAAO,GAAG,IAAI,aAAa;EACxD,OAAO,KAAK,MAAM,cAAc,YAAY,UAAU,UAAU,YAAY;GAC3E,MAAM,OAAO,CAAC,UAAU;GACxB,IAAI,KAAK;IACR,IAAI,CAAC,cAAc,GAAG,GACrB,KAAK,KAAK,eAAe,KAAK;SACxB,IAAI,oBAAoB,GAAG,GACjC,KAAK,KAAK,SAAS;GAErB,OAAO,IAAI,cAAc,QACxB,KAAK,KAAK,IAAI;QACR,IAAI,cAAc,WAExB,KAAK,KAAK,MAAM,IAAI;GAIrB,MAAM,SAAS,MAAM,KAAK,IAAI,IA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GAAA,uBAAA,WAAA,mBAAA,IAAA;AAcrB,WAAA,CAAA,KAAK,GACL,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,sBAAA,IAAA;AAMrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,oBAAA,IAAA;AAcrB,WAAA,CAAA,KAAK,GACL,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,2BAAA,IAAA;AA+BrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,mBAAA,IAAA;AAoCrB,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,sBAAA,IAAA;AA6CrB,WAAA,CAAA,KAAK,CAAA,GAAA,uBAAA,WAAA,2BAAA,IAAA;AA+FL,WAAA,CAAA,MAAM;CAAE,OAAO;CAAM,OAAO,UAAU,UAAU;EAAY;EAAU,MAAM,GAAG,KAAK,KAAK;CAAW;AAAG,CAAC,CAAA,GAAA,uBAAA,WAAA,eAAA,IAAA;AA0CxG,WAAA,CAAA,MAAM,EAAE,OAAO,KAAK,CAAC,CAAA,GAAA,uBAAA,WAAA,mBAAA,IAAA"}
|
package/dist/ipc/ipcServer.d.ts
CHANGED
|
@@ -15,7 +15,12 @@ export declare class IpcServer<Request = unknown, Response = void> implements Un
|
|
|
15
15
|
dispose(): void;
|
|
16
16
|
[Symbol.dispose](): void;
|
|
17
17
|
shutdown(): Promise<void>;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Registers a handler under `/{name}`. The server's token authorizes every route; a `routeToken`
|
|
20
|
+
* additionally authorizes this route alone — for a caller that must reach one route (e.g. an agent
|
|
21
|
+
* told where to report) without being handed the key to all of them.
|
|
22
|
+
*/
|
|
23
|
+
registerHandler(name: string, handler: IpcHandler<Request, Response>, routeToken?: string): UnifiedDisposable;
|
|
19
24
|
private onRequest;
|
|
20
25
|
}
|
|
21
26
|
//#endregion
|
package/dist/ipc/ipcServer.js
CHANGED
|
@@ -57,10 +57,18 @@ var IpcServer = class {
|
|
|
57
57
|
this.server.close(() => resolve());
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Registers a handler under `/{name}`. The server's token authorizes every route; a `routeToken`
|
|
62
|
+
* additionally authorizes this route alone — for a caller that must reach one route (e.g. an agent
|
|
63
|
+
* told where to report) without being handed the key to all of them.
|
|
64
|
+
*/
|
|
65
|
+
registerHandler(name, handler, routeToken) {
|
|
61
66
|
const path = `/${name}`;
|
|
62
67
|
if (this.handlers.has(path)) throw new Error(`IPC handler '${name}' is already registered`);
|
|
63
|
-
this.handlers.set(path,
|
|
68
|
+
this.handlers.set(path, {
|
|
69
|
+
handler,
|
|
70
|
+
routeToken
|
|
71
|
+
});
|
|
64
72
|
return createDisposable(() => this.handlers.delete(path));
|
|
65
73
|
}
|
|
66
74
|
onRequest(req, res) {
|
|
@@ -74,14 +82,15 @@ var IpcServer = class {
|
|
|
74
82
|
} catch {
|
|
75
83
|
pathname = req.url;
|
|
76
84
|
}
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
85
|
+
const registration = this.handlers.get(pathname);
|
|
86
|
+
if (registration == null) {
|
|
79
87
|
scope?.warn(`IPC handler for ${pathname} not found`);
|
|
80
88
|
res.writeHead(404);
|
|
81
89
|
res.end();
|
|
82
90
|
return;
|
|
83
91
|
}
|
|
84
|
-
|
|
92
|
+
const authHeader = req.headers["authorization"];
|
|
93
|
+
if (authHeader !== `Bearer ${this.ipcToken}` && (registration.routeToken == null || authHeader !== `Bearer ${registration.routeToken}`)) {
|
|
85
94
|
_logger.warn(scope, `IPC handler for ${req.url} unauthorized`);
|
|
86
95
|
res.writeHead(401);
|
|
87
96
|
res.end();
|
|
@@ -113,7 +122,7 @@ var IpcServer = class {
|
|
|
113
122
|
return;
|
|
114
123
|
}
|
|
115
124
|
try {
|
|
116
|
-
const result = await handler(data, searchParams);
|
|
125
|
+
const result = await registration.handler(data, searchParams);
|
|
117
126
|
if (result == null) {
|
|
118
127
|
res.writeHead(200);
|
|
119
128
|
res.end();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipcServer.js","names":[],"sources":["../../../ipc/src/ipcServer.ts"],"sourcesContent":["import type { IncomingMessage, Server, ServerResponse } from 'http';\nimport { createServer } from 'http';\nimport { uuid } from '@gitlens/utils/crypto.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { UnifiedDisposable } from '@gitlens/utils/disposable.js';\nimport { createDisposable } from '@gitlens/utils/disposable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\n\nexport interface IpcHandler<Request = unknown, Response = void> {\n\t(request: Request | undefined, searchParams: URLSearchParams): Promise<Response>;\n}\n\nexport async function createIpcServer<Request = unknown, Response = void>(): Promise<IpcServer<Request, Response>> {\n\tconst server = createServer();\n\tconst token = uuid();\n\n\treturn new Promise<IpcServer<Request, Response>>((resolve, reject) => {\n\t\ttry {\n\t\t\tserver.on('error', ex => {\n\t\t\t\tLogger.error(ex, 'IPC server error');\n\t\t\t\treject(ex);\n\t\t\t});\n\n\t\t\t// Let the OS assign an available port by listening on port 0\n\t\t\tserver.listen(0, '127.0.0.1', () => {\n\t\t\t\tconst address = server.address();\n\t\t\t\tif (address == null || typeof address === 'string') {\n\t\t\t\t\treject(new Error('Failed to get server address'));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst port = address.port;\n\t\t\t\tconst serverUrl = `http://127.0.0.1:${port}`;\n\t\t\t\tresolve(new IpcServer(serverUrl, port, token, server));\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\t// oxlint-disable-next-line typescript/prefer-promise-reject-errors\n\t\t\treject(ex);\n\t\t}\n\t});\n}\n\nexport class IpcServer<Request = unknown, Response = void> implements UnifiedDisposable {\n\tprivate readonly handlers = new Map
|
|
1
|
+
{"version":3,"file":"ipcServer.js","names":[],"sources":["../../../ipc/src/ipcServer.ts"],"sourcesContent":["import type { IncomingMessage, Server, ServerResponse } from 'http';\nimport { createServer } from 'http';\nimport { uuid } from '@gitlens/utils/crypto.js';\nimport { debug } from '@gitlens/utils/decorators/log.js';\nimport type { UnifiedDisposable } from '@gitlens/utils/disposable.js';\nimport { createDisposable } from '@gitlens/utils/disposable.js';\nimport { Logger } from '@gitlens/utils/logger.js';\nimport { getScopedLogger } from '@gitlens/utils/logger.scoped.js';\n\nexport interface IpcHandler<Request = unknown, Response = void> {\n\t(request: Request | undefined, searchParams: URLSearchParams): Promise<Response>;\n}\n\nexport async function createIpcServer<Request = unknown, Response = void>(): Promise<IpcServer<Request, Response>> {\n\tconst server = createServer();\n\tconst token = uuid();\n\n\treturn new Promise<IpcServer<Request, Response>>((resolve, reject) => {\n\t\ttry {\n\t\t\tserver.on('error', ex => {\n\t\t\t\tLogger.error(ex, 'IPC server error');\n\t\t\t\treject(ex);\n\t\t\t});\n\n\t\t\t// Let the OS assign an available port by listening on port 0\n\t\t\tserver.listen(0, '127.0.0.1', () => {\n\t\t\t\tconst address = server.address();\n\t\t\t\tif (address == null || typeof address === 'string') {\n\t\t\t\t\treject(new Error('Failed to get server address'));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst port = address.port;\n\t\t\t\tconst serverUrl = `http://127.0.0.1:${port}`;\n\t\t\t\tresolve(new IpcServer(serverUrl, port, token, server));\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\t// oxlint-disable-next-line typescript/prefer-promise-reject-errors\n\t\t\treject(ex);\n\t\t}\n\t});\n}\n\nexport class IpcServer<Request = unknown, Response = void> implements UnifiedDisposable {\n\tprivate readonly handlers = new Map<\n\t\tstring | undefined,\n\t\t{ handler: IpcHandler<Request, Response>; routeToken: string | undefined }\n\t>();\n\n\tconstructor(\n\t\treadonly ipcAddress: string,\n\t\treadonly ipcPort: number,\n\t\treadonly ipcToken: string,\n\t\tprivate server: Server,\n\t) {\n\t\tserver\n\t\t\t.on('listening', () => {\n\t\t\t\tLogger.trace(`IPC server listening on ${this.ipcAddress}`);\n\t\t\t})\n\t\t\t.on('request', this.onRequest.bind(this));\n\t}\n\n\tdispose(): void {\n\t\tthis.handlers.clear();\n\t\tthis.server.close();\n\t}\n\n\t[Symbol.dispose](): void {\n\t\tthis.dispose();\n\t}\n\n\t// Awaits server close; use only when deterministic teardown is required (e.g., tests).\n\t// Production callers should use dispose() — UnifiedDisposable contract is sync.\n\tshutdown(): Promise<void> {\n\t\tthis.handlers.clear();\n\t\treturn new Promise<void>(resolve => {\n\t\t\tthis.server.close(() => resolve());\n\t\t});\n\t}\n\n\t/**\n\t * Registers a handler under `/{name}`. The server's token authorizes every route; a `routeToken`\n\t * additionally authorizes this route alone — for a caller that must reach one route (e.g. an agent\n\t * told where to report) without being handed the key to all of them.\n\t */\n\tregisterHandler(name: string, handler: IpcHandler<Request, Response>, routeToken?: string): UnifiedDisposable {\n\t\tconst path = `/${name}`;\n\t\tif (this.handlers.has(path)) {\n\t\t\tthrow new Error(`IPC handler '${name}' is already registered`);\n\t\t}\n\n\t\tthis.handlers.set(path, { handler: handler, routeToken: routeToken });\n\t\treturn createDisposable(() => this.handlers.delete(path));\n\t}\n\n\t@debug({ args: false })\n\tprivate onRequest(req: IncomingMessage, res: ServerResponse): void {\n\t\tconst scope = getScopedLogger();\n\n\t\t// Parse URL to extract pathname for routing and query parameters\n\t\tlet pathname: string | undefined;\n\t\tlet searchParams = new URLSearchParams();\n\t\ttry {\n\t\t\tconst url = new URL(req.url ?? '', this.ipcAddress);\n\t\t\tpathname = url.pathname;\n\t\t\tsearchParams = url.searchParams;\n\t\t} catch {\n\t\t\tpathname = req.url;\n\t\t}\n\n\t\tconst registration = this.handlers.get(pathname);\n\t\tif (registration == null) {\n\t\t\tscope?.warn(`IPC handler for ${pathname} not found`);\n\t\t\tres.writeHead(404);\n\t\t\tres.end();\n\t\t\treturn;\n\t\t}\n\n\t\t// Add bearer token authorization\n\t\tconst authHeader = req.headers['authorization'];\n\t\tif (\n\t\t\tauthHeader !== `Bearer ${this.ipcToken}` &&\n\t\t\t(registration.routeToken == null || authHeader !== `Bearer ${registration.routeToken}`)\n\t\t) {\n\t\t\tLogger.warn(scope, `IPC handler for ${req.url} unauthorized`);\n\t\t\tres.writeHead(401);\n\t\t\tres.end();\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxBodySize = 10_485_760; // 10 MB\n\t\tlet bodySize = 0;\n\t\tconst chunks: Uint8Array[] = [];\n\t\treq.on('data', (d: Uint8Array) => {\n\t\t\tbodySize += d.length;\n\t\t\tif (bodySize > maxBodySize) {\n\t\t\t\tres.writeHead(413);\n\t\t\t\tres.end();\n\t\t\t\treq.destroy();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tchunks.push(d);\n\t\t});\n\t\treq.on('end', async () => {\n\t\t\tif (bodySize > maxBodySize) return;\n\n\t\t\tconst body = Buffer.concat(chunks).toString('utf8');\n\n\t\t\tlet data: Request | undefined;\n\t\t\ttry {\n\t\t\t\tdata = body ? (JSON.parse(body) as Request) : undefined;\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex, 'Invalid JSON in IPC request body', { body: body });\n\t\t\t\tres.writeHead(400);\n\t\t\t\tres.end('Invalid JSON');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst result = await registration.handler(data, searchParams);\n\t\t\t\tif (result == null) {\n\t\t\t\t\tres.writeHead(200);\n\t\t\t\t\tres.end();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (typeof result === 'string') {\n\t\t\t\t\tres.writeHead(200);\n\t\t\t\t\tres.end(result);\n\t\t\t\t} else {\n\t\t\t\t\tres.writeHead(200);\n\t\t\t\t\tres.end(JSON.stringify(result));\n\t\t\t\t}\n\t\t\t} catch (ex) {\n\t\t\t\tscope?.error(ex, 'IP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,IAAgB,KAAA;GAC/C,SAAS,IAAI;IACZ,OAAO,MAAM,IAAI,oCAAoC,EAAQ,KAAK,CAAC;IACnE,IAAI,UAAU,GAAG;IACjB,IAAI,IAAI,cAAc;IACtB;GACD;GAEA,IAAI;IACH,MAAM,SAAS,MAAM,aAAa,QAAQ,MAAM,YAAY;IAC5D,IAAI,UAAU,MAAM;KACnB,IAAI,UAAU,GAAG;KACjB,IAAI,IAAI;KACR;IACD;IAEA,IAAI,OAAO,WAAW,UAAU;KAC/B,IAAI,UAAU,GAAG;KACjB,IAAI,IAAI,MAAM;IACf,OAAO;KACN,IAAI,UAAU,GAAG;KACjB,IAAI,IAAI,KAAK,UAAU,MAAM,CAAC;IAC/B;GACD,SAAS,IAAI;IACZ,OAAO,MAAM,IAAI,qBAAqB,IAAI;IAC1C,IAAI,UAAU,GAAG;IACjB,IAAI,IAAI;GACT;EACD,CAAC;CACF;AACD;AAtFE,WAAA,CAAA,MAAM,EAAE,MAAM,MAAM,CAAC,CAAA,GAAA,UAAA,WAAA,aAAA,IAAA"}
|
package/dist/plus/ai/errors.js
CHANGED
|
@@ -34,19 +34,19 @@ var AIError = class extends Error {
|
|
|
34
34
|
break;
|
|
35
35
|
case 10:
|
|
36
36
|
diagnosticMessage = "You have exceeded your user token limit";
|
|
37
|
-
message = l10n.t("You
|
|
37
|
+
message = l10n.t("You’ve reached the weekly AI usage included in your plan.");
|
|
38
38
|
break;
|
|
39
39
|
case 4:
|
|
40
40
|
diagnosticMessage = "Rate limit exceeded";
|
|
41
|
-
message = l10n.t("Rate limit exceeded");
|
|
41
|
+
message = l10n.t("Rate limit exceeded.");
|
|
42
42
|
break;
|
|
43
43
|
case 5:
|
|
44
44
|
diagnosticMessage = "Rate limit exceeded or your account is out of funds";
|
|
45
|
-
message = l10n.t("Rate limit exceeded or your account is out of funds");
|
|
45
|
+
message = l10n.t("Rate limit exceeded or your account is out of funds.");
|
|
46
46
|
break;
|
|
47
47
|
case 8:
|
|
48
48
|
diagnosticMessage = "Service capacity exceeded";
|
|
49
|
-
message = l10n.t("Service capacity exceeded");
|
|
49
|
+
message = l10n.t("Service capacity exceeded.");
|
|
50
50
|
break;
|
|
51
51
|
case 11:
|
|
52
52
|
diagnosticMessage = "Unable to reach the AI service. Please check your internet connection.";
|
|
@@ -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
|
|
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;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AI;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"}
|
|
@@ -24,7 +24,7 @@ export interface AIModelDescriptor<Provider extends AIProviders = AIProviders, M
|
|
|
24
24
|
readonly provider: Provider;
|
|
25
25
|
readonly model: Model;
|
|
26
26
|
}
|
|
27
|
-
export type AIActionType = 'explain-changes' | 'review-changes' | 'generate-commitMessage' | 'generate-stashMessage' | 'generate-changelog' | `generate-create-${'cloudPatch' | 'pullRequest'}` | 'generate-commits' | 'conflict-resolution' | 'generate-searchQuery';
|
|
27
|
+
export type AIActionType = 'explain-changes' | 'review-changes' | 'review-orient' | 'generate-commitMessage' | 'generate-stashMessage' | 'generate-changelog' | `generate-create-${'cloudPatch' | 'pullRequest'}` | 'generate-commits' | 'conflict-resolution' | 'generate-searchQuery';
|
|
28
28
|
export interface AIProviderDescriptor<T extends AIProviders = AIProviders> {
|
|
29
29
|
readonly id: T;
|
|
30
30
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","names":[],"sources":["../../../../../plus/ai/src/models/model.ts"],"sourcesContent":["import type { AIPrimaryProviders, AIProviders, OpenAIProviders } from '../constants.js';\n\nexport interface AIModel<Provider extends AIProviders = AIProviders, Model extends string = string> {\n\treadonly id: Model;\n\treadonly name: string;\n\treadonly maxTokens: { readonly input: number; readonly output: number | undefined };\n\treadonly provider: {\n\t\treadonly id: Provider;\n\t\treadonly name: string;\n\t};\n\n\treadonly default?: boolean;\n\treadonly hidden?: boolean;\n\n\treadonly temperature?: number | null;\n\n\treadonly consumptionRateLabel?: string;\n\n\t/** Whether the model supports native structured output (JSON schema); absent means capable\n\t * (new models default on). Populated by dynamic catalogs (GitKraken, OpenRouter) and set to\n\t * false on legacy static-registry entries; provider-wide gaps override the provider hook */\n\treadonly supportsStructuredOutputs?: boolean;\n}\n\nexport interface AIModelDescriptor<Provider extends AIProviders = AIProviders, Model extends string = string> {\n\treadonly provider: Provider;\n\treadonly model: Model;\n}\n\nexport type AIActionType =\n\t| 'explain-changes'\n\t| 'review-changes'\n\t| 'generate-commitMessage'\n\t| 'generate-stashMessage'\n\t| 'generate-changelog'\n\t| `generate-create-${'cloudPatch' | 'pullRequest'}`\n\t| 'generate-commits'\n\t| 'conflict-resolution'\n\t| 'generate-searchQuery';\n\nexport interface AIProviderDescriptor<T extends AIProviders = AIProviders> {\n\treadonly id: T;\n\treadonly name: string;\n\treadonly primary: T extends AIPrimaryProviders ? true : false;\n\treadonly requiresAccount: boolean;\n\treadonly requiresUserKey: boolean;\n\n\treadonly type?: never;\n}\n\nexport interface AIProviderDescriptorWithConfiguration<\n\tT extends AIProviders = AIProviders,\n> extends AIProviderDescriptor<T> {\n\treadonly configured: boolean;\n}\n\nexport const openAIModels = <T extends OpenAIProviders>(provider: AIProviderDescriptor<T>): AIModel<T>[] => [\n\t{\n\t\tid: 'gpt-5.6',\n\t\tname: 'GPT-5.6 Sol',\n\t\tmaxTokens: { input: 922000, output: 128000 }, // 1.05M context, but OpenAI caps input at 922k\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.6-sol',\n\t\tname: 'GPT-5.6 Sol',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.6-terra',\n\t\tname: 'GPT-5.6 Terra',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.6-luna',\n\t\tname: 'GPT-5.6 Luna',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t\tdefault: true,\n\t},\n\t{\n\t\tid: 'gpt-5.5',\n\t\tname: 'GPT-5.5',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.5-pro',\n\t\tname: 'GPT-5.5 Pro',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.4',\n\t\tname: 'GPT-5.4',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.4-mini',\n\t\tname: 'GPT-5.4 mini',\n\t\tmaxTokens: { input: 272000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.4-nano',\n\t\tname: 'GPT-5.4 nano',\n\t\tmaxTokens: { input: 272000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.3-codex',\n\t\tname: 'GPT-5.3 Codex',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.2',\n\t\tname: 'GPT-5.2',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.2-2025-12-11',\n\t\tname: 'GPT-5.2 (2025-12-11)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.1',\n\t\tname: 'GPT-5.1',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.1-2025-11-13',\n\t\tname: 'GPT-5.1 (2025-11-13)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5',\n\t\tname: 'GPT-5',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-2025-08-07',\n\t\tname: 'GPT-5 (2025-08-07)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-mini',\n\t\tname: 'GPT-5 mini',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-mini-2025-08-07',\n\t\tname: 'GPT-5 mini (2025-08-07)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-nano',\n\t\tname: 'GPT-5 nano',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-nano-2025-08-07',\n\t\tname: 'GPT-5 nano (2025-08-07)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-pro',\n\t\tname: 'GPT-5 Pro',\n\t\tmaxTokens: { input: 400000, output: 272000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-pro-2025-10-06',\n\t\tname: 'GPT-5 Pro (2025-10-06)',\n\t\tmaxTokens: { input: 400000, output: 272000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1',\n\t\tname: 'GPT-4.1',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-2025-04-14',\n\t\tname: 'GPT-4.1 (2025-04-14)',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-mini',\n\t\tname: 'GPT-4.1 mini',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-mini-2025-04-14',\n\t\tname: 'GPT-4.1 mini (2025-04-14)',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-nano',\n\t\tname: 'GPT-4.1 nano',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-nano-2025-04-14',\n\t\tname: 'GPT-4.1 nano (2025-04-14)',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o4-mini',\n\t\tname: 'o4 mini',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o4-mini-2025-04-16',\n\t\tname: 'o4 mini (2025-04-16)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-deep-research',\n\t\tname: 'o3 Deep Research',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-deep-research-2025-06-26',\n\t\tname: 'o3 Deep Research (2025-06-26)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3',\n\t\tname: 'o3',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-2025-04-16',\n\t\tname: 'o3 (2025-04-16)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-pro',\n\t\tname: 'o3 Pro',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-mini',\n\t\tname: 'o3 mini',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-mini-2025-01-31',\n\t\tname: 'o3 mini (2025-01-31)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o1',\n\t\tname: 'o1',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o1-2024-12-17',\n\t\tname: 'o1 (2024-12-17)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o1-preview',\n\t\tname: 'o1 preview',\n\t\tmaxTokens: { input: 128000, output: 32768 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'o1-preview-2024-09-12',\n\t\tname: 'o1 preview (2024-09-12)',\n\t\tmaxTokens: { input: 128000, output: 32768 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'o1-mini',\n\t\tname: 'o1 mini',\n\t\tmaxTokens: { input: 128000, output: 65536 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'o1-mini-2024-09-12',\n\t\tname: 'o1 mini (2024-09-12)',\n\t\tmaxTokens: { input: 128000, output: 65536 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4o',\n\t\tname: 'GPT-4o',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-2024-11-20',\n\t\tname: 'GPT-4o (2024-11-20)',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-2024-08-06',\n\t\tname: 'GPT-4o (2024-08-06)',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-2024-05-13',\n\t\tname: 'GPT-4o (2024-05-13)',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\t// json_schema needs gpt-4o-2024-08-06+ (or o1+); the flagged legacy ids reject it with a 400\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'chatgpt-4o-latest',\n\t\tname: 'GPT-4o',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4o-mini',\n\t\tname: 'GPT-4o mini',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-mini-2024-07-18',\n\t\tname: 'GPT-4o mini (2024-07-18)',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4-turbo',\n\t\tname: 'GPT-4 Turbo',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-turbo-2024-04-09',\n\t\tname: 'GPT-4 Turbo preview (2024-04-09)',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-turbo-preview',\n\t\tname: 'GPT-4 Turbo preview',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-0125-preview',\n\t\tname: 'GPT-4 0125 preview',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-1106-preview',\n\t\tname: 'GPT-4 1106 preview',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4',\n\t\tname: 'GPT-4',\n\t\tmaxTokens: { input: 8192, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-0613',\n\t\tname: 'GPT-4 0613',\n\t\tmaxTokens: { input: 8192, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-32k',\n\t\tname: 'GPT-4 32k',\n\t\tmaxTokens: { input: 32768, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-32k-0613',\n\t\tname: 'GPT-4 32k 0613',\n\t\tmaxTokens: { input: 32768, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo',\n\t\tname: 'GPT-3.5 Turbo',\n\t\tmaxTokens: { input: 16385, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo-0125',\n\t\tname: 'GPT-3.5 Turbo 0125',\n\t\tmaxTokens: { input: 16385, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo-1106',\n\t\tname: 'GPT-3.5 Turbo 1106',\n\t\tmaxTokens: { input: 16385, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo-16k',\n\t\tname: 'GPT-3.5 Turbo 16k',\n\t\tmaxTokens: { input: 16385, output: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EACV,QAAQ;EACR,2BAA2B;CAC5B;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAO,QAAQ;EAAK;EAC9B;EACV,QAAQ;EACR,2BAA2B;CAC5B;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAO,QAAQ;EAAK;EAC9B;EACV,QAAQ;EACR,2BAA2B;CAC5B;AACD"}
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../../../../plus/ai/src/models/model.ts"],"sourcesContent":["import type { AIPrimaryProviders, AIProviders, OpenAIProviders } from '../constants.js';\n\nexport interface AIModel<Provider extends AIProviders = AIProviders, Model extends string = string> {\n\treadonly id: Model;\n\treadonly name: string;\n\treadonly maxTokens: { readonly input: number; readonly output: number | undefined };\n\treadonly provider: {\n\t\treadonly id: Provider;\n\t\treadonly name: string;\n\t};\n\n\treadonly default?: boolean;\n\treadonly hidden?: boolean;\n\n\treadonly temperature?: number | null;\n\n\treadonly consumptionRateLabel?: string;\n\n\t/** Whether the model supports native structured output (JSON schema); absent means capable\n\t * (new models default on). Populated by dynamic catalogs (GitKraken, OpenRouter) and set to\n\t * false on legacy static-registry entries; provider-wide gaps override the provider hook */\n\treadonly supportsStructuredOutputs?: boolean;\n}\n\nexport interface AIModelDescriptor<Provider extends AIProviders = AIProviders, Model extends string = string> {\n\treadonly provider: Provider;\n\treadonly model: Model;\n}\n\nexport type AIActionType =\n\t| 'explain-changes'\n\t| 'review-changes'\n\t| 'review-orient'\n\t| 'generate-commitMessage'\n\t| 'generate-stashMessage'\n\t| 'generate-changelog'\n\t| `generate-create-${'cloudPatch' | 'pullRequest'}`\n\t| 'generate-commits'\n\t| 'conflict-resolution'\n\t| 'generate-searchQuery';\n\nexport interface AIProviderDescriptor<T extends AIProviders = AIProviders> {\n\treadonly id: T;\n\treadonly name: string;\n\treadonly primary: T extends AIPrimaryProviders ? true : false;\n\treadonly requiresAccount: boolean;\n\treadonly requiresUserKey: boolean;\n\n\treadonly type?: never;\n}\n\nexport interface AIProviderDescriptorWithConfiguration<\n\tT extends AIProviders = AIProviders,\n> extends AIProviderDescriptor<T> {\n\treadonly configured: boolean;\n}\n\nexport const openAIModels = <T extends OpenAIProviders>(provider: AIProviderDescriptor<T>): AIModel<T>[] => [\n\t{\n\t\tid: 'gpt-5.6',\n\t\tname: 'GPT-5.6 Sol',\n\t\tmaxTokens: { input: 922000, output: 128000 }, // 1.05M context, but OpenAI caps input at 922k\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.6-sol',\n\t\tname: 'GPT-5.6 Sol',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.6-terra',\n\t\tname: 'GPT-5.6 Terra',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.6-luna',\n\t\tname: 'GPT-5.6 Luna',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t\tdefault: true,\n\t},\n\t{\n\t\tid: 'gpt-5.5',\n\t\tname: 'GPT-5.5',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.5-pro',\n\t\tname: 'GPT-5.5 Pro',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.4',\n\t\tname: 'GPT-5.4',\n\t\tmaxTokens: { input: 922000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.4-mini',\n\t\tname: 'GPT-5.4 mini',\n\t\tmaxTokens: { input: 272000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.4-nano',\n\t\tname: 'GPT-5.4 nano',\n\t\tmaxTokens: { input: 272000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'gpt-5.3-codex',\n\t\tname: 'GPT-5.3 Codex',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.2',\n\t\tname: 'GPT-5.2',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.2-2025-12-11',\n\t\tname: 'GPT-5.2 (2025-12-11)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.1',\n\t\tname: 'GPT-5.1',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5.1-2025-11-13',\n\t\tname: 'GPT-5.1 (2025-11-13)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5',\n\t\tname: 'GPT-5',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-2025-08-07',\n\t\tname: 'GPT-5 (2025-08-07)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-mini',\n\t\tname: 'GPT-5 mini',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-mini-2025-08-07',\n\t\tname: 'GPT-5 mini (2025-08-07)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-nano',\n\t\tname: 'GPT-5 nano',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-nano-2025-08-07',\n\t\tname: 'GPT-5 nano (2025-08-07)',\n\t\tmaxTokens: { input: 400000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-pro',\n\t\tname: 'GPT-5 Pro',\n\t\tmaxTokens: { input: 400000, output: 272000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-5-pro-2025-10-06',\n\t\tname: 'GPT-5 Pro (2025-10-06)',\n\t\tmaxTokens: { input: 400000, output: 272000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1',\n\t\tname: 'GPT-4.1',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-2025-04-14',\n\t\tname: 'GPT-4.1 (2025-04-14)',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-mini',\n\t\tname: 'GPT-4.1 mini',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-mini-2025-04-14',\n\t\tname: 'GPT-4.1 mini (2025-04-14)',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-nano',\n\t\tname: 'GPT-4.1 nano',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4.1-nano-2025-04-14',\n\t\tname: 'GPT-4.1 nano (2025-04-14)',\n\t\tmaxTokens: { input: 1047576, output: 32768 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o4-mini',\n\t\tname: 'o4 mini',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o4-mini-2025-04-16',\n\t\tname: 'o4 mini (2025-04-16)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-deep-research',\n\t\tname: 'o3 Deep Research',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-deep-research-2025-06-26',\n\t\tname: 'o3 Deep Research (2025-06-26)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3',\n\t\tname: 'o3',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-2025-04-16',\n\t\tname: 'o3 (2025-04-16)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-pro',\n\t\tname: 'o3 Pro',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-mini',\n\t\tname: 'o3 mini',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o3-mini-2025-01-31',\n\t\tname: 'o3 mini (2025-01-31)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o1',\n\t\tname: 'o1',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o1-2024-12-17',\n\t\tname: 'o1 (2024-12-17)',\n\t\tmaxTokens: { input: 200000, output: 100000 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'o1-preview',\n\t\tname: 'o1 preview',\n\t\tmaxTokens: { input: 128000, output: 32768 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'o1-preview-2024-09-12',\n\t\tname: 'o1 preview (2024-09-12)',\n\t\tmaxTokens: { input: 128000, output: 32768 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'o1-mini',\n\t\tname: 'o1 mini',\n\t\tmaxTokens: { input: 128000, output: 65536 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'o1-mini-2024-09-12',\n\t\tname: 'o1 mini (2024-09-12)',\n\t\tmaxTokens: { input: 128000, output: 65536 },\n\t\tprovider: provider,\n\t\ttemperature: null,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4o',\n\t\tname: 'GPT-4o',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-2024-11-20',\n\t\tname: 'GPT-4o (2024-11-20)',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-2024-08-06',\n\t\tname: 'GPT-4o (2024-08-06)',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-2024-05-13',\n\t\tname: 'GPT-4o (2024-05-13)',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\t// json_schema needs gpt-4o-2024-08-06+ (or o1+); the flagged legacy ids reject it with a 400\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'chatgpt-4o-latest',\n\t\tname: 'GPT-4o',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4o-mini',\n\t\tname: 'GPT-4o mini',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4o-mini-2024-07-18',\n\t\tname: 'GPT-4o mini (2024-07-18)',\n\t\tmaxTokens: { input: 128000, output: 16384 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'gpt-4-turbo',\n\t\tname: 'GPT-4 Turbo',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-turbo-2024-04-09',\n\t\tname: 'GPT-4 Turbo preview (2024-04-09)',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-turbo-preview',\n\t\tname: 'GPT-4 Turbo preview',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-0125-preview',\n\t\tname: 'GPT-4 0125 preview',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-1106-preview',\n\t\tname: 'GPT-4 1106 preview',\n\t\tmaxTokens: { input: 128000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4',\n\t\tname: 'GPT-4',\n\t\tmaxTokens: { input: 8192, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-0613',\n\t\tname: 'GPT-4 0613',\n\t\tmaxTokens: { input: 8192, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-32k',\n\t\tname: 'GPT-4 32k',\n\t\tmaxTokens: { input: 32768, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-4-32k-0613',\n\t\tname: 'GPT-4 32k 0613',\n\t\tmaxTokens: { input: 32768, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo',\n\t\tname: 'GPT-3.5 Turbo',\n\t\tmaxTokens: { input: 16385, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo-0125',\n\t\tname: 'GPT-3.5 Turbo 0125',\n\t\tmaxTokens: { input: 16385, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo-1106',\n\t\tname: 'GPT-3.5 Turbo 1106',\n\t\tmaxTokens: { input: 16385, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'gpt-3.5-turbo-16k',\n\t\tname: 'GPT-3.5 Turbo 16k',\n\t\tmaxTokens: { input: 16385, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n];\n"],"mappings":";AAyDA,MAAa,gBAA2C,aAAoD;CAC3G;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;CACX;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;EACV,QAAQ;CACT;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;CACX;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;EACV,SAAS;CACV;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;CACX;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;EACV,QAAQ;CACT;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;CACX;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;CACX;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;CACX;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;EACV,QAAQ;CACT;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAAO;EACjC;EACV,QAAQ;CACT;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAQ,QAAQ;EAA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BAA2B;CAC5B;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAO,QAAQ;EAAK;EAC9B;EACV,QAAQ;EACR,2BAA2B;CAC5B;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAO,QAAQ;EAAK;EAC9B;EACV,QAAQ;EACR,2BAA2B;CAC5B;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAO,QAAQ;EAAK;EAC9B;EACV,QAAQ;EACR,2BAA2B;CAC5B;AACD"}
|
|
@@ -75,6 +75,49 @@ interface ReviewOverviewPromptTemplateContext {
|
|
|
75
75
|
context?: string;
|
|
76
76
|
instructions?: string;
|
|
77
77
|
}
|
|
78
|
+
interface ReviewOrientPromptTemplateContext {
|
|
79
|
+
files: string;
|
|
80
|
+
message: string;
|
|
81
|
+
context?: string;
|
|
82
|
+
instructions?: string;
|
|
83
|
+
}
|
|
84
|
+
interface DeepReviewPromptTemplateContext {
|
|
85
|
+
scopeLabel: string;
|
|
86
|
+
/** Shell command that shows the changes under review */
|
|
87
|
+
diffCommand: string;
|
|
88
|
+
/** The changed files, one per line */
|
|
89
|
+
files: string;
|
|
90
|
+
/** Where to POST findings, and the bearer token the request must carry */
|
|
91
|
+
endpoint: string;
|
|
92
|
+
token: string;
|
|
93
|
+
/** What an earlier review already found, with what the reader said about it — a whole section, with
|
|
94
|
+
* its own instructions, or nothing when no review ran before this one */
|
|
95
|
+
priorFindings?: string;
|
|
96
|
+
instructions?: string;
|
|
97
|
+
}
|
|
98
|
+
/** A reader's question or remark on one finding, for the review agent to take up — not a whole review */
|
|
99
|
+
interface DeepReviewOrientPromptTemplateContext {
|
|
100
|
+
scopeLabel: string;
|
|
101
|
+
/** Shell command that shows the changes under review */
|
|
102
|
+
diffCommand: string;
|
|
103
|
+
/** Where to POST, and the bearer token the request must carry */
|
|
104
|
+
endpoint: string;
|
|
105
|
+
token: string;
|
|
106
|
+
instructions?: string;
|
|
107
|
+
}
|
|
108
|
+
interface DeepReviewFocusPromptTemplateContext {
|
|
109
|
+
scopeLabel: string;
|
|
110
|
+
/** Shell command that shows the changes under review */
|
|
111
|
+
diffCommand: string;
|
|
112
|
+
/** The finding as context: id, severity, state, places, text and what has been said about it */
|
|
113
|
+
finding: string;
|
|
114
|
+
/** What the reader just said about it */
|
|
115
|
+
question: string;
|
|
116
|
+
/** Where to POST, and the bearer token the request must carry */
|
|
117
|
+
endpoint: string;
|
|
118
|
+
token: string;
|
|
119
|
+
instructions?: string;
|
|
120
|
+
}
|
|
78
121
|
interface ReviewDetailPromptTemplateContext {
|
|
79
122
|
diff: string;
|
|
80
123
|
overview: string;
|
|
@@ -96,9 +139,9 @@ interface StartWorkIssuePromptTemplateContext {
|
|
|
96
139
|
issue: string;
|
|
97
140
|
instructions?: string;
|
|
98
141
|
}
|
|
99
|
-
export type PromptTemplateType = 'generate-commitMessage' | 'generate-stashMessage' | 'generate-changelog' | `generate-create-${'cloudPatch' | 'pullRequest'}` | 'generate-commits' | 'generate-searchQuery' | 'explain-changes' | 'review-changes' | 'review-overview' | 'review-detail' | 'review-refine' | 'address-review-findings' | 'start-review-pullRequest' | 'start-work-issue';
|
|
142
|
+
export type PromptTemplateType = 'generate-commitMessage' | 'generate-stashMessage' | 'generate-changelog' | `generate-create-${'cloudPatch' | 'pullRequest'}` | 'generate-commits' | 'generate-searchQuery' | 'explain-changes' | 'review-changes' | 'review-overview' | 'review-orient' | 'review-detail' | 'review-refine' | 'address-review-findings' | 'deep-review' | 'deep-review-focus' | 'deep-review-orient' | 'start-review-pullRequest' | 'start-work-issue';
|
|
100
143
|
type PromptTemplateVersions = '' | '_v2' | '_v3' | '_v4';
|
|
101
144
|
export type PromptTemplateId<T extends PromptTemplateType = PromptTemplateType> = `${T}${PromptTemplateVersions}`;
|
|
102
|
-
export type PromptTemplateContext<T extends PromptTemplateType> = T extends 'generate-commitMessage' ? CommitMessagePromptTemplateContext : T extends 'generate-stashMessage' ? StashMessagePromptTemplateContext : T extends 'generate-create-cloudPatch' ? CreateDraftPromptTemplateContext : T extends 'generate-create-pullRequest' ? CreatePullRequestPromptTemplateContext : T extends 'generate-changelog' ? ChangelogPromptTemplateContext : T extends 'generate-commits' ? GenerateCommitsPromptTemplateContext : T extends 'generate-searchQuery' ? SearchQueryPromptTemplateContext : T extends 'explain-changes' ? ExplainChangesPromptTemplateContext : T extends 'review-changes' ? ReviewChangesPromptTemplateContext : T extends 'review-overview' ? ReviewOverviewPromptTemplateContext : T extends 'review-detail' ? ReviewDetailPromptTemplateContext : T extends 'review-refine' ? ReviewRefinePromptTemplateContext : T extends 'address-review-findings' ? AddressReviewFindingsPromptTemplateContext : T extends 'start-review-pullRequest' ? ReviewPullRequestPromptTemplateContext : T extends 'start-work-issue' ? StartWorkIssuePromptTemplateContext : never;
|
|
145
|
+
export type PromptTemplateContext<T extends PromptTemplateType> = T extends 'generate-commitMessage' ? CommitMessagePromptTemplateContext : T extends 'generate-stashMessage' ? StashMessagePromptTemplateContext : T extends 'generate-create-cloudPatch' ? CreateDraftPromptTemplateContext : T extends 'generate-create-pullRequest' ? CreatePullRequestPromptTemplateContext : T extends 'generate-changelog' ? ChangelogPromptTemplateContext : T extends 'generate-commits' ? GenerateCommitsPromptTemplateContext : T extends 'generate-searchQuery' ? SearchQueryPromptTemplateContext : T extends 'explain-changes' ? ExplainChangesPromptTemplateContext : T extends 'review-changes' ? ReviewChangesPromptTemplateContext : T extends 'review-overview' ? ReviewOverviewPromptTemplateContext : T extends 'review-orient' ? ReviewOrientPromptTemplateContext : T extends 'review-detail' ? ReviewDetailPromptTemplateContext : T extends 'review-refine' ? ReviewRefinePromptTemplateContext : T extends 'address-review-findings' ? AddressReviewFindingsPromptTemplateContext : T extends 'deep-review' ? DeepReviewPromptTemplateContext : T extends 'deep-review-focus' ? DeepReviewFocusPromptTemplateContext : T extends 'deep-review-orient' ? DeepReviewOrientPromptTemplateContext : T extends 'start-review-pullRequest' ? ReviewPullRequestPromptTemplateContext : T extends 'start-work-issue' ? StartWorkIssuePromptTemplateContext : never;
|
|
103
146
|
//#endregion
|
|
104
147
|
//# sourceMappingURL=promptTemplates.d.ts.map
|
|
@@ -4,6 +4,14 @@ export type AISummarizedResult = {
|
|
|
4
4
|
body: string;
|
|
5
5
|
};
|
|
6
6
|
export type AIReviewSeverity = 'critical' | 'warning' | 'suggestion';
|
|
7
|
+
/** One place a finding holds: a file, and the lines in it when the finding is tied to lines. */
|
|
8
|
+
export interface AIReviewFindingLocation {
|
|
9
|
+
readonly filePath: string;
|
|
10
|
+
readonly lineRange?: {
|
|
11
|
+
readonly start: number;
|
|
12
|
+
readonly end: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
7
15
|
export interface AIReviewFinding {
|
|
8
16
|
readonly id: string;
|
|
9
17
|
readonly severity: AIReviewSeverity;
|
|
@@ -11,12 +19,23 @@ export interface AIReviewFinding {
|
|
|
11
19
|
/** Whether `title` is a synthetic protocol fallback and should be localized at presentation boundaries. */
|
|
12
20
|
readonly titleIsFallback?: boolean;
|
|
13
21
|
readonly description: string;
|
|
22
|
+
/** The finding's first place — see {@link locations} for all of them */
|
|
14
23
|
readonly filePath?: string;
|
|
15
24
|
readonly lineRange?: {
|
|
16
25
|
readonly start: number;
|
|
17
26
|
readonly end: number;
|
|
18
27
|
};
|
|
28
|
+
/** Every place the finding holds, the first being `filePath`/`lineRange` — present only when there is
|
|
29
|
+
* more than one (the same mistake repeated, a contract broken on both of its sides). One finding,
|
|
30
|
+
* marked at each place. */
|
|
31
|
+
readonly locations?: readonly AIReviewFindingLocation[];
|
|
32
|
+
/** Who produced the finding; absent = the model's own review run. `agent` = reported back by a
|
|
33
|
+
* delegated deep review, which could build, test and read beyond the diff. `user` = the reader's own
|
|
34
|
+
* comment on a line of the diff — no severity of its own, the text is the description. */
|
|
35
|
+
readonly source?: 'agent' | 'user';
|
|
19
36
|
}
|
|
37
|
+
/** Every place a finding holds — `locations` when it has several, else its one file (none for a general remark). */
|
|
38
|
+
export declare function getReviewFindingLocations(finding: AIReviewFinding): readonly AIReviewFindingLocation[];
|
|
20
39
|
export interface AIReviewFocusArea {
|
|
21
40
|
readonly id: string;
|
|
22
41
|
readonly label: string;
|
|
@@ -35,5 +54,27 @@ export interface AIReviewResult {
|
|
|
35
54
|
export interface AIReviewDetailResult {
|
|
36
55
|
readonly findings: readonly AIReviewFinding[];
|
|
37
56
|
}
|
|
57
|
+
/** One stop of an orient pass: a file and the one line that says why it is in the change. */
|
|
58
|
+
export interface AIReviewOrientFile {
|
|
59
|
+
readonly path: string;
|
|
60
|
+
readonly note: string;
|
|
61
|
+
}
|
|
62
|
+
export type AIReviewOrientGroupKind = 'core' | 'supporting' | 'mechanical';
|
|
63
|
+
export interface AIReviewOrientGroup {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly label: string;
|
|
66
|
+
readonly labelIsFallback?: boolean;
|
|
67
|
+
/** `core` = read first, `supporting` = follows from the core, `mechanical` = skim (lockfiles, generated, renames) —
|
|
68
|
+
* orders the groups; the reader sees the label and summary, not the kind */
|
|
69
|
+
readonly kind: AIReviewOrientGroupKind;
|
|
70
|
+
/** A sentence or two on what this group changes and why its files belong together */
|
|
71
|
+
readonly summary: string;
|
|
72
|
+
readonly files: readonly AIReviewOrientFile[];
|
|
73
|
+
}
|
|
74
|
+
/** The orient pass's output: not a verdict, a reading order — groups in the order to read them. */
|
|
75
|
+
export interface AIReviewOrientResult {
|
|
76
|
+
readonly overview: string;
|
|
77
|
+
readonly groups: readonly AIReviewOrientGroup[];
|
|
78
|
+
}
|
|
38
79
|
//#endregion
|
|
39
80
|
//# sourceMappingURL=results.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../plus/ai/src/models/results.ts
|
|
2
|
+
/** Every place a finding holds — `locations` when it has several, else its one file (none for a general remark). */
|
|
3
|
+
function getReviewFindingLocations(finding) {
|
|
4
|
+
if (finding.locations?.length) return finding.locations;
|
|
5
|
+
if (finding.filePath == null) return [];
|
|
6
|
+
return [{
|
|
7
|
+
filePath: finding.filePath,
|
|
8
|
+
lineRange: finding.lineRange
|
|
9
|
+
}];
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getReviewFindingLocations };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","names":[],"sources":["../../../../../plus/ai/src/models/results.ts"],"sourcesContent":["export type AISummarizedResult = { summary: string; body: string };\n\nexport type AIReviewSeverity = 'critical' | 'warning' | 'suggestion';\n\n/** One place a finding holds: a file, and the lines in it when the finding is tied to lines. */\nexport interface AIReviewFindingLocation {\n\treadonly filePath: string;\n\treadonly lineRange?: { readonly start: number; readonly end: number };\n}\n\nexport interface AIReviewFinding {\n\treadonly id: string;\n\treadonly severity: AIReviewSeverity;\n\treadonly title: string;\n\t/** Whether `title` is a synthetic protocol fallback and should be localized at presentation boundaries. */\n\treadonly titleIsFallback?: boolean;\n\treadonly description: string;\n\t/** The finding's first place — see {@link locations} for all of them */\n\treadonly filePath?: string;\n\treadonly lineRange?: { readonly start: number; readonly end: number };\n\t/** Every place the finding holds, the first being `filePath`/`lineRange` — present only when there is\n\t * more than one (the same mistake repeated, a contract broken on both of its sides). One finding,\n\t * marked at each place. */\n\treadonly locations?: readonly AIReviewFindingLocation[];\n\t/** Who produced the finding; absent = the model's own review run. `agent` = reported back by a\n\t * delegated deep review, which could build, test and read beyond the diff. `user` = the reader's own\n\t * comment on a line of the diff — no severity of its own, the text is the description. */\n\treadonly source?: 'agent' | 'user';\n}\n\n/** Every place a finding holds — `locations` when it has several, else its one file (none for a general remark). */\nexport function getReviewFindingLocations(finding: AIReviewFinding): readonly AIReviewFindingLocation[] {\n\tif (finding.locations?.length) return finding.locations;\n\tif (finding.filePath == null) return [];\n\n\treturn [{ filePath: finding.filePath, lineRange: finding.lineRange }];\n}\n\nexport interface AIReviewFocusArea {\n\treadonly id: string;\n\treadonly label: string;\n\t/** Whether `label` is a synthetic protocol fallback and should be localized at presentation boundaries. */\n\treadonly labelIsFallback?: boolean;\n\treadonly rationale: string;\n\treadonly severity: AIReviewSeverity;\n\treadonly files: readonly string[];\n\treadonly findings?: readonly AIReviewFinding[];\n}\n\nexport interface AIReviewResult {\n\treadonly overview: string;\n\treadonly focusAreas: readonly AIReviewFocusArea[];\n\treadonly mode: 'single-pass' | 'two-pass';\n}\n\nexport interface AIReviewDetailResult {\n\treadonly findings: readonly AIReviewFinding[];\n}\n\n/** One stop of an orient pass: a file and the one line that says why it is in the change. */\nexport interface AIReviewOrientFile {\n\treadonly path: string;\n\treadonly note: string;\n}\n\nexport type AIReviewOrientGroupKind = 'core' | 'supporting' | 'mechanical';\n\nexport interface AIReviewOrientGroup {\n\treadonly id: string;\n\treadonly label: string;\n\treadonly labelIsFallback?: boolean;\n\t/** `core` = read first, `supporting` = follows from the core, `mechanical` = skim (lockfiles, generated, renames) —\n\t * orders the groups; the reader sees the label and summary, not the kind */\n\treadonly kind: AIReviewOrientGroupKind;\n\t/** A sentence or two on what this group changes and why its files belong together */\n\treadonly summary: string;\n\treadonly files: readonly AIReviewOrientFile[];\n}\n\n/** The orient pass's output: not a verdict, a reading order — groups in the order to read them. */\nexport interface AIReviewOrientResult {\n\treadonly overview: string;\n\treadonly groups: readonly AIReviewOrientGroup[];\n}\n"],"mappings":";;AA+BA,SAAgB,0BAA0B,SAA8D;CACvG,IAAI,QAAQ,WAAW,QAAQ,OAAO,QAAQ;CAC9C,IAAI,QAAQ,YAAY,MAAM,OAAO,CAAC;CAEtC,OAAO,CAAC;EAAE,UAAU,QAAQ;EAAU,WAAW,QAAQ;CAAU,CAAC;AACrE"}
|