@gitkraken/core-gitlens 0.4.0 → 0.4.100

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.
Files changed (1036) hide show
  1. package/CHANGELOG.md +71 -1
  2. package/README.md +9 -2
  3. package/dist/git/cache.d.ts +29 -2
  4. package/dist/git/cache.d.ts.map +1 -1
  5. package/dist/git/cache.js +67 -7
  6. package/dist/git/cache.js.map +1 -1
  7. package/dist/git/context.d.ts.map +1 -1
  8. package/dist/git/errors.d.ts +31 -1
  9. package/dist/git/errors.d.ts.map +1 -1
  10. package/dist/git/errors.js +29 -0
  11. package/dist/git/errors.js.map +1 -1
  12. package/dist/git/models/author.d.ts.map +1 -1
  13. package/dist/git/models/author.js.map +1 -1
  14. package/dist/git/models/autolink.d.ts.map +1 -1
  15. package/dist/git/models/autolink.js.map +1 -1
  16. package/dist/git/models/blame.d.ts.map +1 -1
  17. package/dist/git/models/blame.js.map +1 -1
  18. package/dist/git/models/branch.d.ts.map +1 -1
  19. package/dist/git/models/branch.js.map +1 -1
  20. package/dist/git/models/commit.d.ts.map +1 -1
  21. package/dist/git/models/commit.js +1 -1
  22. package/dist/git/models/commit.js.map +1 -1
  23. package/dist/git/models/contributor.d.ts.map +1 -1
  24. package/dist/git/models/contributor.js.map +1 -1
  25. package/dist/git/models/defaultBranch.d.ts.map +1 -1
  26. package/dist/git/models/defaultBranch.js.map +1 -1
  27. package/dist/git/models/diff.d.ts.map +1 -1
  28. package/dist/git/models/diff.js.map +1 -1
  29. package/dist/git/models/file.d.ts.map +1 -1
  30. package/dist/git/models/file.js.map +1 -1
  31. package/dist/git/models/fileChange.d.ts.map +1 -1
  32. package/dist/git/models/fileChange.js.map +1 -1
  33. package/dist/git/models/fileStatus.d.ts +22 -22
  34. package/dist/git/models/fileStatus.d.ts.map +1 -1
  35. package/dist/git/models/fileStatus.js.map +1 -1
  36. package/dist/git/models/graph.d.ts +122 -1
  37. package/dist/git/models/graph.d.ts.map +1 -1
  38. package/dist/git/models/graph.js +4 -0
  39. package/dist/git/models/graph.js.map +1 -1
  40. package/dist/git/models/graphSearch.d.ts.map +1 -1
  41. package/dist/git/models/graphSearch.js.map +1 -1
  42. package/dist/git/models/graphSession.d.ts +177 -0
  43. package/dist/git/models/graphSession.d.ts.map +1 -0
  44. package/dist/git/models/graphSession.js +7 -0
  45. package/dist/git/models/graphSession.js.map +1 -0
  46. package/dist/git/models/issue.d.ts +12 -2
  47. package/dist/git/models/issue.d.ts.map +1 -1
  48. package/dist/git/models/issue.js +3 -1
  49. package/dist/git/models/issue.js.map +1 -1
  50. package/dist/git/models/issueOrPullRequest.d.ts.map +1 -1
  51. package/dist/git/models/issueOrPullRequest.js.map +1 -1
  52. package/dist/git/models/lineRange.d.ts.map +1 -1
  53. package/dist/git/models/lineRange.js.map +1 -1
  54. package/dist/git/models/log.d.ts.map +1 -1
  55. package/dist/git/models/log.js.map +1 -1
  56. package/dist/git/models/mergeConflicts.d.ts.map +1 -1
  57. package/dist/git/models/mergeConflicts.js.map +1 -1
  58. package/dist/git/models/patch.d.ts.map +1 -1
  59. package/dist/git/models/patch.js.map +1 -1
  60. package/dist/git/models/pausedOperationStatus.d.ts.map +1 -1
  61. package/dist/git/models/pausedOperationStatus.js.map +1 -1
  62. package/dist/git/models/pullRequest.d.ts +27 -2
  63. package/dist/git/models/pullRequest.d.ts.map +1 -1
  64. package/dist/git/models/pullRequest.js +7 -1
  65. package/dist/git/models/pullRequest.js.map +1 -1
  66. package/dist/git/models/rebase.d.ts.map +1 -1
  67. package/dist/git/models/rebase.js.map +1 -1
  68. package/dist/git/models/reference.d.ts.map +1 -1
  69. package/dist/git/models/reference.js.map +1 -1
  70. package/dist/git/models/reflog.d.ts.map +1 -1
  71. package/dist/git/models/reflog.js.map +1 -1
  72. package/dist/git/models/remote.d.ts.map +1 -1
  73. package/dist/git/models/remote.js.map +1 -1
  74. package/dist/git/models/remoteProvider.d.ts.map +1 -1
  75. package/dist/git/models/remoteProvider.js.map +1 -1
  76. package/dist/git/models/remoteResource.d.ts.map +1 -1
  77. package/dist/git/models/remoteResource.js.map +1 -1
  78. package/dist/git/models/repository.d.ts +20 -2
  79. package/dist/git/models/repository.d.ts.map +1 -1
  80. package/dist/git/models/repository.js +19 -0
  81. package/dist/git/models/repository.js.map +1 -1
  82. package/dist/git/models/repositoryChangeEvent.d.ts.map +1 -1
  83. package/dist/git/models/repositoryChangeEvent.js.map +1 -1
  84. package/dist/git/models/repositoryIdentities.d.ts.map +1 -1
  85. package/dist/git/models/repositoryIdentities.js.map +1 -1
  86. package/dist/git/models/repositoryMetadata.d.ts.map +1 -1
  87. package/dist/git/models/repositoryMetadata.js.map +1 -1
  88. package/dist/git/models/resourceDescriptor.d.ts +16 -0
  89. package/dist/git/models/resourceDescriptor.d.ts.map +1 -1
  90. package/dist/git/models/resourceDescriptor.js.map +1 -1
  91. package/dist/git/models/revision.d.ts.map +1 -1
  92. package/dist/git/models/revision.js.map +1 -1
  93. package/dist/git/models/search.d.ts.map +1 -1
  94. package/dist/git/models/search.js.map +1 -1
  95. package/dist/git/models/shortlog.d.ts.map +1 -1
  96. package/dist/git/models/shortlog.js.map +1 -1
  97. package/dist/git/models/signature.d.ts +14 -0
  98. package/dist/git/models/signature.d.ts.map +1 -1
  99. package/dist/git/models/signature.js.map +1 -1
  100. package/dist/git/models/staging.d.ts.map +1 -1
  101. package/dist/git/models/staging.js.map +1 -1
  102. package/dist/git/models/stash.d.ts.map +1 -1
  103. package/dist/git/models/stash.js.map +1 -1
  104. package/dist/git/models/status.d.ts.map +1 -1
  105. package/dist/git/models/status.js.map +1 -1
  106. package/dist/git/models/statusFile.d.ts.map +1 -1
  107. package/dist/git/models/statusFile.js.map +1 -1
  108. package/dist/git/models/tag.d.ts +11 -1
  109. package/dist/git/models/tag.d.ts.map +1 -1
  110. package/dist/git/models/tag.js +9 -2
  111. package/dist/git/models/tag.js.map +1 -1
  112. package/dist/git/models/tree.d.ts.map +1 -1
  113. package/dist/git/models/tree.js.map +1 -1
  114. package/dist/git/models/user.d.ts.map +1 -1
  115. package/dist/git/models/user.js.map +1 -1
  116. package/dist/git/models/worktree.d.ts.map +1 -1
  117. package/dist/git/models/worktree.js.map +1 -1
  118. package/dist/git/parsers/diffParser.d.ts.map +1 -1
  119. package/dist/git/parsers/diffParser.js +1 -1
  120. package/dist/git/parsers/diffParser.js.map +1 -1
  121. package/dist/git/parsers/rebaseTodoParser.d.ts.map +1 -1
  122. package/dist/git/parsers/rebaseTodoParser.js.map +1 -1
  123. package/dist/git/providers/blame.d.ts.map +1 -1
  124. package/dist/git/providers/blame.js.map +1 -1
  125. package/dist/git/providers/branches.d.ts +8 -1
  126. package/dist/git/providers/branches.d.ts.map +1 -1
  127. package/dist/git/providers/branches.js.map +1 -1
  128. package/dist/git/providers/commits.d.ts +6 -1
  129. package/dist/git/providers/commits.d.ts.map +1 -1
  130. package/dist/git/providers/commits.js.map +1 -1
  131. package/dist/git/providers/config.d.ts +6 -2
  132. package/dist/git/providers/config.d.ts.map +1 -1
  133. package/dist/git/providers/config.js.map +1 -1
  134. package/dist/git/providers/contributors.d.ts.map +1 -1
  135. package/dist/git/providers/contributors.js.map +1 -1
  136. package/dist/git/providers/diff.d.ts.map +1 -1
  137. package/dist/git/providers/diff.js.map +1 -1
  138. package/dist/git/providers/graph.d.ts +55 -1
  139. package/dist/git/providers/graph.d.ts.map +1 -1
  140. package/dist/git/providers/graph.js.map +1 -1
  141. package/dist/git/providers/operations.d.ts.map +1 -1
  142. package/dist/git/providers/operations.js.map +1 -1
  143. package/dist/git/providers/patch.d.ts.map +1 -1
  144. package/dist/git/providers/patch.js.map +1 -1
  145. package/dist/git/providers/pausedOperations.d.ts.map +1 -1
  146. package/dist/git/providers/pausedOperations.js.map +1 -1
  147. package/dist/git/providers/provider.d.ts.map +1 -1
  148. package/dist/git/providers/provider.js.map +1 -1
  149. package/dist/git/providers/refs.d.ts.map +1 -1
  150. package/dist/git/providers/refs.js.map +1 -1
  151. package/dist/git/providers/remotes.d.ts.map +1 -1
  152. package/dist/git/providers/remotes.js.map +1 -1
  153. package/dist/git/providers/revision.d.ts.map +1 -1
  154. package/dist/git/providers/revision.js.map +1 -1
  155. package/dist/git/providers/shared/remotes.d.ts.map +1 -1
  156. package/dist/git/providers/shared/remotes.js.map +1 -1
  157. package/dist/git/providers/staging.d.ts.map +1 -1
  158. package/dist/git/providers/staging.js.map +1 -1
  159. package/dist/git/providers/stash.d.ts.map +1 -1
  160. package/dist/git/providers/stash.js.map +1 -1
  161. package/dist/git/providers/status.d.ts +1 -0
  162. package/dist/git/providers/status.d.ts.map +1 -1
  163. package/dist/git/providers/status.js.map +1 -1
  164. package/dist/git/providers/tags.d.ts.map +1 -1
  165. package/dist/git/providers/tags.js.map +1 -1
  166. package/dist/git/providers/types.d.ts.map +1 -1
  167. package/dist/git/providers/types.js.map +1 -1
  168. package/dist/git/providers/worktrees.d.ts +3 -1
  169. package/dist/git/providers/worktrees.d.ts.map +1 -1
  170. package/dist/git/providers/worktrees.js.map +1 -1
  171. package/dist/git/remotes/azure-devops.d.ts.map +1 -1
  172. package/dist/git/remotes/azure-devops.js +27 -31
  173. package/dist/git/remotes/azure-devops.js.map +1 -1
  174. package/dist/git/remotes/bitbucket-server.d.ts.map +1 -1
  175. package/dist/git/remotes/bitbucket-server.js +21 -23
  176. package/dist/git/remotes/bitbucket-server.js.map +1 -1
  177. package/dist/git/remotes/bitbucket.d.ts.map +1 -1
  178. package/dist/git/remotes/bitbucket.js +21 -23
  179. package/dist/git/remotes/bitbucket.js.map +1 -1
  180. package/dist/git/remotes/custom.d.ts.map +1 -1
  181. package/dist/git/remotes/custom.js.map +1 -1
  182. package/dist/git/remotes/gerrit.d.ts.map +1 -1
  183. package/dist/git/remotes/gerrit.js +11 -13
  184. package/dist/git/remotes/gerrit.js.map +1 -1
  185. package/dist/git/remotes/gitea.d.ts.map +1 -1
  186. package/dist/git/remotes/gitea.js +12 -14
  187. package/dist/git/remotes/gitea.js.map +1 -1
  188. package/dist/git/remotes/github.d.ts.map +1 -1
  189. package/dist/git/remotes/github.js +54 -56
  190. package/dist/git/remotes/github.js.map +1 -1
  191. package/dist/git/remotes/gitlab.d.ts.map +1 -1
  192. package/dist/git/remotes/gitlab.js +93 -95
  193. package/dist/git/remotes/gitlab.js.map +1 -1
  194. package/dist/git/remotes/google-source.d.ts.map +1 -1
  195. package/dist/git/remotes/google-source.js.map +1 -1
  196. package/dist/git/remotes/matcher.d.ts.map +1 -1
  197. package/dist/git/remotes/matcher.js.map +1 -1
  198. package/dist/git/run.types.d.ts +62 -3
  199. package/dist/git/run.types.d.ts.map +1 -1
  200. package/dist/git/service.d.ts.map +1 -1
  201. package/dist/git/utils/autolink.utils.d.ts.map +1 -1
  202. package/dist/git/utils/autolink.utils.js.map +1 -1
  203. package/dist/git/utils/blame.utils.d.ts.map +1 -1
  204. package/dist/git/utils/blame.utils.js.map +1 -1
  205. package/dist/git/utils/branch.utils.d.ts.map +1 -1
  206. package/dist/git/utils/branch.utils.js +12 -1
  207. package/dist/git/utils/branch.utils.js.map +1 -1
  208. package/dist/git/utils/commit.utils.d.ts.map +1 -1
  209. package/dist/git/utils/commit.utils.js.map +1 -1
  210. package/dist/git/utils/conflictResolution.utils.d.ts.map +1 -1
  211. package/dist/git/utils/conflictResolution.utils.js.map +1 -1
  212. package/dist/git/utils/contributor.utils.d.ts +1 -1
  213. package/dist/git/utils/contributor.utils.d.ts.map +1 -1
  214. package/dist/git/utils/contributor.utils.js +1 -2
  215. package/dist/git/utils/contributor.utils.js.map +1 -1
  216. package/dist/git/utils/fetch.utils.d.ts.map +1 -1
  217. package/dist/git/utils/fetch.utils.js.map +1 -1
  218. package/dist/git/utils/fileStatus.utils.d.ts +7 -0
  219. package/dist/git/utils/fileStatus.utils.d.ts.map +1 -1
  220. package/dist/git/utils/fileStatus.utils.js +6 -0
  221. package/dist/git/utils/fileStatus.utils.js.map +1 -1
  222. package/dist/git/utils/graph.utils.d.ts +20 -0
  223. package/dist/git/utils/graph.utils.d.ts.map +1 -0
  224. package/dist/git/utils/graph.utils.js +40 -0
  225. package/dist/git/utils/graph.utils.js.map +1 -0
  226. package/dist/git/utils/issue.utils.d.ts.map +1 -1
  227. package/dist/git/utils/issue.utils.js +1 -0
  228. package/dist/git/utils/issue.utils.js.map +1 -1
  229. package/dist/git/utils/issueOrPullRequest.utils.d.ts.map +1 -1
  230. package/dist/git/utils/issueOrPullRequest.utils.js.map +1 -1
  231. package/dist/git/utils/mergeConflicts.utils.d.ts.map +1 -1
  232. package/dist/git/utils/mergeConflicts.utils.js.map +1 -1
  233. package/dist/git/utils/pausedOperationStatus.utils.d.ts +13 -13
  234. package/dist/git/utils/pausedOperationStatus.utils.d.ts.map +1 -1
  235. package/dist/git/utils/pausedOperationStatus.utils.js.map +1 -1
  236. package/dist/git/utils/pullRequest.utils.d.ts.map +1 -1
  237. package/dist/git/utils/pullRequest.utils.js +9 -0
  238. package/dist/git/utils/pullRequest.utils.js.map +1 -1
  239. package/dist/git/utils/reachability.utils.d.ts +20 -2
  240. package/dist/git/utils/reachability.utils.d.ts.map +1 -1
  241. package/dist/git/utils/reachability.utils.js +68 -7
  242. package/dist/git/utils/reachability.utils.js.map +1 -1
  243. package/dist/git/utils/rebase.utils.d.ts.map +1 -1
  244. package/dist/git/utils/rebase.utils.js.map +1 -1
  245. package/dist/git/utils/reference.utils.d.ts.map +1 -1
  246. package/dist/git/utils/reference.utils.js.map +1 -1
  247. package/dist/git/utils/remote.utils.d.ts.map +1 -1
  248. package/dist/git/utils/remote.utils.js.map +1 -1
  249. package/dist/git/utils/repository.utils.d.ts.map +1 -1
  250. package/dist/git/utils/repository.utils.js.map +1 -1
  251. package/dist/git/utils/resourceDescriptor.utils.d.ts.map +1 -1
  252. package/dist/git/utils/resourceDescriptor.utils.js.map +1 -1
  253. package/dist/git/utils/revision.utils.d.ts.map +1 -1
  254. package/dist/git/utils/revision.utils.js.map +1 -1
  255. package/dist/git/utils/search.utils.d.ts.map +1 -1
  256. package/dist/git/utils/search.utils.js.map +1 -1
  257. package/dist/git/utils/sorting.d.ts.map +1 -1
  258. package/dist/git/utils/sorting.js.map +1 -1
  259. package/dist/git/utils/sshKey.utils.d.ts +7 -0
  260. package/dist/git/utils/sshKey.utils.d.ts.map +1 -0
  261. package/dist/git/utils/sshKey.utils.js +25 -0
  262. package/dist/git/utils/sshKey.utils.js.map +1 -0
  263. package/dist/git/utils/status.utils.d.ts.map +1 -1
  264. package/dist/git/utils/status.utils.js.map +1 -1
  265. package/dist/git/utils/statusFile.utils.d.ts.map +1 -1
  266. package/dist/git/utils/statusFile.utils.js.map +1 -1
  267. package/dist/git/utils/tag.utils.d.ts.map +1 -1
  268. package/dist/git/utils/tag.utils.js.map +1 -1
  269. package/dist/git/utils/tooltip.utils.d.ts.map +1 -1
  270. package/dist/git/utils/tooltip.utils.js.map +1 -1
  271. package/dist/git/utils/uriAuthority.d.ts.map +1 -1
  272. package/dist/git/utils/uriAuthority.js.map +1 -1
  273. package/dist/git/utils/user.utils.d.ts.map +1 -1
  274. package/dist/git/utils/user.utils.js.map +1 -1
  275. package/dist/git/utils/worktree.utils.d.ts.map +1 -1
  276. package/dist/git/utils/worktree.utils.js.map +1 -1
  277. package/dist/git/watching/changeEvent.d.ts.map +1 -1
  278. package/dist/git/watching/changeEvent.js.map +1 -1
  279. package/dist/git/watching/classifyChange.d.ts.map +1 -1
  280. package/dist/git/watching/classifyChange.js.map +1 -1
  281. package/dist/git/watching/gitIgnoreFilter.d.ts.map +1 -1
  282. package/dist/git/watching/gitIgnoreFilter.js.map +1 -1
  283. package/dist/git/watching/initWatcher.d.ts.map +1 -1
  284. package/dist/git/watching/initWatcher.js.map +1 -1
  285. package/dist/git/watching/provider.d.ts.map +1 -1
  286. package/dist/git/watching/provider.js.map +1 -1
  287. package/dist/git/watching/watchGroup.d.ts.map +1 -1
  288. package/dist/git/watching/watchGroup.js.map +1 -1
  289. package/dist/git/watching/watchService.d.ts +4 -0
  290. package/dist/git/watching/watchService.d.ts.map +1 -1
  291. package/dist/git/watching/watchService.js +15 -1
  292. package/dist/git/watching/watchService.js.map +1 -1
  293. package/dist/git/watching/watchSession.d.ts +7 -0
  294. package/dist/git/watching/watchSession.d.ts.map +1 -1
  295. package/dist/git/watching/watchSession.js +14 -2
  296. package/dist/git/watching/watchSession.js.map +1 -1
  297. package/dist/git/watching/watcherPatterns.d.ts.map +1 -1
  298. package/dist/git/watching/watcherPatterns.js.map +1 -1
  299. package/dist/git-cli/cliGitProvider.d.ts.map +1 -1
  300. package/dist/git-cli/exec/exec.d.ts.map +1 -1
  301. package/dist/git-cli/exec/exec.errors.d.ts.map +1 -1
  302. package/dist/git-cli/exec/exec.errors.js.map +1 -1
  303. package/dist/git-cli/exec/exec.js.map +1 -1
  304. package/dist/git-cli/exec/exec.types.d.ts.map +1 -1
  305. package/dist/git-cli/exec/exec.types.js.map +1 -1
  306. package/dist/git-cli/exec/features.d.ts.map +1 -1
  307. package/dist/git-cli/exec/features.js.map +1 -1
  308. package/dist/git-cli/exec/git.d.ts +19 -27
  309. package/dist/git-cli/exec/git.d.ts.map +1 -1
  310. package/dist/git-cli/exec/git.js +126 -34
  311. package/dist/git-cli/exec/git.js.map +1 -1
  312. package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
  313. package/dist/git-cli/exec/gitQueue.js.map +1 -1
  314. package/dist/git-cli/exec/locator.d.ts.map +1 -1
  315. package/dist/git-cli/exec/locator.js.map +1 -1
  316. package/dist/git-cli/parsers/blameParser.d.ts.map +1 -1
  317. package/dist/git-cli/parsers/blameParser.js.map +1 -1
  318. package/dist/git-cli/parsers/indexParser.d.ts.map +1 -1
  319. package/dist/git-cli/parsers/indexParser.js.map +1 -1
  320. package/dist/git-cli/parsers/logParser.d.ts +9 -1
  321. package/dist/git-cli/parsers/logParser.d.ts.map +1 -1
  322. package/dist/git-cli/parsers/logParser.js +141 -60
  323. package/dist/git-cli/parsers/logParser.js.map +1 -1
  324. package/dist/git-cli/parsers/mergeTreeParser.d.ts.map +1 -1
  325. package/dist/git-cli/parsers/mergeTreeParser.js.map +1 -1
  326. package/dist/git-cli/parsers/refParser.d.ts.map +1 -1
  327. package/dist/git-cli/parsers/refParser.js.map +1 -1
  328. package/dist/git-cli/parsers/reflogParser.d.ts.map +1 -1
  329. package/dist/git-cli/parsers/reflogParser.js.map +1 -1
  330. package/dist/git-cli/parsers/remoteParser.d.ts.map +1 -1
  331. package/dist/git-cli/parsers/remoteParser.js.map +1 -1
  332. package/dist/git-cli/parsers/shortlogParser.d.ts.map +1 -1
  333. package/dist/git-cli/parsers/shortlogParser.js.map +1 -1
  334. package/dist/git-cli/parsers/signatureParser.d.ts.map +1 -1
  335. package/dist/git-cli/parsers/signatureParser.js.map +1 -1
  336. package/dist/git-cli/parsers/sshSignatureParser.d.ts +21 -0
  337. package/dist/git-cli/parsers/sshSignatureParser.d.ts.map +1 -0
  338. package/dist/git-cli/parsers/sshSignatureParser.js +78 -0
  339. package/dist/git-cli/parsers/sshSignatureParser.js.map +1 -0
  340. package/dist/git-cli/parsers/statusParser.d.ts.map +1 -1
  341. package/dist/git-cli/parsers/statusParser.js.map +1 -1
  342. package/dist/git-cli/parsers/treeParser.d.ts.map +1 -1
  343. package/dist/git-cli/parsers/treeParser.js.map +1 -1
  344. package/dist/git-cli/parsers/worktreeParser.d.ts.map +1 -1
  345. package/dist/git-cli/parsers/worktreeParser.js +5 -7
  346. package/dist/git-cli/parsers/worktreeParser.js.map +1 -1
  347. package/dist/git-cli/providers/blame.d.ts.map +1 -1
  348. package/dist/git-cli/providers/blame.js.map +1 -1
  349. package/dist/git-cli/providers/branches.d.ts +1 -0
  350. package/dist/git-cli/providers/branches.d.ts.map +1 -1
  351. package/dist/git-cli/providers/branches.js +51 -32
  352. package/dist/git-cli/providers/branches.js.map +1 -1
  353. package/dist/git-cli/providers/commitFilesetUtils.d.ts.map +1 -1
  354. package/dist/git-cli/providers/commitFilesetUtils.js.map +1 -1
  355. package/dist/git-cli/providers/commits.d.ts +12 -1
  356. package/dist/git-cli/providers/commits.d.ts.map +1 -1
  357. package/dist/git-cli/providers/commits.js +89 -8
  358. package/dist/git-cli/providers/commits.js.map +1 -1
  359. package/dist/git-cli/providers/config.d.ts.map +1 -1
  360. package/dist/git-cli/providers/config.js.map +1 -1
  361. package/dist/git-cli/providers/contributors.d.ts.map +1 -1
  362. package/dist/git-cli/providers/contributors.js.map +1 -1
  363. package/dist/git-cli/providers/diff.d.ts.map +1 -1
  364. package/dist/git-cli/providers/diff.js.map +1 -1
  365. package/dist/git-cli/providers/graph.d.ts +35 -1
  366. package/dist/git-cli/providers/graph.d.ts.map +1 -1
  367. package/dist/git-cli/providers/graph.js +1434 -330
  368. package/dist/git-cli/providers/graph.js.map +1 -1
  369. package/dist/git-cli/providers/operations.d.ts.map +1 -1
  370. package/dist/git-cli/providers/operations.js.map +1 -1
  371. package/dist/git-cli/providers/patch.d.ts.map +1 -1
  372. package/dist/git-cli/providers/patch.js.map +1 -1
  373. package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
  374. package/dist/git-cli/providers/pausedOperations.js +3 -3
  375. package/dist/git-cli/providers/pausedOperations.js.map +1 -1
  376. package/dist/git-cli/providers/refs.d.ts.map +1 -1
  377. package/dist/git-cli/providers/refs.js.map +1 -1
  378. package/dist/git-cli/providers/remotes.d.ts.map +1 -1
  379. package/dist/git-cli/providers/remotes.js.map +1 -1
  380. package/dist/git-cli/providers/revision.d.ts +1 -0
  381. package/dist/git-cli/providers/revision.d.ts.map +1 -1
  382. package/dist/git-cli/providers/revision.js +33 -0
  383. package/dist/git-cli/providers/revision.js.map +1 -1
  384. package/dist/git-cli/providers/staging.d.ts.map +1 -1
  385. package/dist/git-cli/providers/staging.js.map +1 -1
  386. package/dist/git-cli/providers/stash.d.ts.map +1 -1
  387. package/dist/git-cli/providers/stash.js.map +1 -1
  388. package/dist/git-cli/providers/status.d.ts +28 -0
  389. package/dist/git-cli/providers/status.d.ts.map +1 -1
  390. package/dist/git-cli/providers/status.js +240 -154
  391. package/dist/git-cli/providers/status.js.map +1 -1
  392. package/dist/git-cli/providers/tags.d.ts.map +1 -1
  393. package/dist/git-cli/providers/tags.js +2 -1
  394. package/dist/git-cli/providers/tags.js.map +1 -1
  395. package/dist/git-cli/providers/worktrees.d.ts +2 -1
  396. package/dist/git-cli/providers/worktrees.d.ts.map +1 -1
  397. package/dist/git-cli/providers/worktrees.js +28 -3
  398. package/dist/git-cli/providers/worktrees.js.map +1 -1
  399. package/dist/git-cli/service.d.ts.map +1 -1
  400. package/dist/git-cli/service.js +8 -0
  401. package/dist/git-cli/service.js.map +1 -1
  402. package/dist/ipc/ipcServer.d.ts.map +1 -1
  403. package/dist/ipc/ipcServer.js +1 -1
  404. package/dist/ipc/ipcServer.js.map +1 -1
  405. package/dist/plus/agents/providers/claudeCodeProvider.d.ts +6 -1
  406. package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +1 -1
  407. package/dist/plus/agents/providers/claudeCodeProvider.js +19 -0
  408. package/dist/plus/agents/providers/claudeCodeProvider.js.map +1 -1
  409. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +68 -0
  410. package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -1
  411. package/dist/plus/agents/providers/claudeCodeTranscript.js +262 -8
  412. package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
  413. package/dist/plus/agents/types.d.ts +36 -2
  414. package/dist/plus/agents/types.d.ts.map +1 -1
  415. package/dist/plus/ai/constants.d.ts +1 -2
  416. package/dist/plus/ai/constants.d.ts.map +1 -1
  417. package/dist/plus/ai/constants.js +1 -8
  418. package/dist/plus/ai/constants.js.map +1 -1
  419. package/dist/plus/ai/errors.d.ts.map +1 -1
  420. package/dist/plus/ai/errors.js.map +1 -1
  421. package/dist/plus/ai/models/conversation.d.ts.map +1 -1
  422. package/dist/plus/ai/models/conversation.js.map +1 -1
  423. package/dist/plus/ai/models/model.d.ts +2 -1
  424. package/dist/plus/ai/models/model.d.ts.map +1 -1
  425. package/dist/plus/ai/models/model.js +50 -1
  426. package/dist/plus/ai/models/model.js.map +1 -1
  427. package/dist/plus/ai/models/promptTemplates.d.ts +5 -2
  428. package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
  429. package/dist/plus/ai/models/promptTemplates.js.map +1 -1
  430. package/dist/plus/ai/models/provider.d.ts.map +1 -1
  431. package/dist/plus/ai/models/provider.js.map +1 -1
  432. package/dist/plus/ai/models/results.d.ts.map +1 -1
  433. package/dist/plus/ai/models/results.js.map +1 -1
  434. package/dist/plus/ai/prompts.d.ts +1 -1
  435. package/dist/plus/ai/prompts.d.ts.map +1 -1
  436. package/dist/plus/ai/prompts.js +15 -47
  437. package/dist/plus/ai/prompts.js.map +1 -1
  438. package/dist/plus/ai/providers/anthropicProvider.d.ts +5 -0
  439. package/dist/plus/ai/providers/anthropicProvider.d.ts.map +1 -1
  440. package/dist/plus/ai/providers/anthropicProvider.js +40 -3
  441. package/dist/plus/ai/providers/anthropicProvider.js.map +1 -1
  442. package/dist/plus/ai/providers/azureProvider.d.ts.map +1 -1
  443. package/dist/plus/ai/providers/azureProvider.js.map +1 -1
  444. package/dist/plus/ai/providers/context.d.ts.map +1 -1
  445. package/dist/plus/ai/providers/context.js.map +1 -1
  446. package/dist/plus/ai/providers/deepSeekProvider.d.ts.map +1 -1
  447. package/dist/plus/ai/providers/deepSeekProvider.js +17 -1
  448. package/dist/plus/ai/providers/deepSeekProvider.js.map +1 -1
  449. package/dist/plus/ai/providers/geminiProvider.d.ts.map +1 -1
  450. package/dist/plus/ai/providers/geminiProvider.js +25 -6
  451. package/dist/plus/ai/providers/geminiProvider.js.map +1 -1
  452. package/dist/plus/ai/providers/gitkrakenProvider.d.ts.map +1 -1
  453. package/dist/plus/ai/providers/gitkrakenProvider.js +1 -0
  454. package/dist/plus/ai/providers/gitkrakenProvider.js.map +1 -1
  455. package/dist/plus/ai/providers/huggingFaceProvider.d.ts +1 -1
  456. package/dist/plus/ai/providers/huggingFaceProvider.d.ts.map +1 -1
  457. package/dist/plus/ai/providers/huggingFaceProvider.js +21 -18
  458. package/dist/plus/ai/providers/huggingFaceProvider.js.map +1 -1
  459. package/dist/plus/ai/providers/mistralProvider.d.ts.map +1 -1
  460. package/dist/plus/ai/providers/mistralProvider.js.map +1 -1
  461. package/dist/plus/ai/providers/ollamaProvider.d.ts.map +1 -1
  462. package/dist/plus/ai/providers/ollamaProvider.js.map +1 -1
  463. package/dist/plus/ai/providers/openAICompatibleProvider.d.ts.map +1 -1
  464. package/dist/plus/ai/providers/openAICompatibleProvider.js.map +1 -1
  465. package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts +10 -1
  466. package/dist/plus/ai/providers/openAICompatibleProviderBase.d.ts.map +1 -1
  467. package/dist/plus/ai/providers/openAICompatibleProviderBase.js +9 -1
  468. package/dist/plus/ai/providers/openAICompatibleProviderBase.js.map +1 -1
  469. package/dist/plus/ai/providers/openRouterProvider.d.ts.map +1 -1
  470. package/dist/plus/ai/providers/openRouterProvider.js.map +1 -1
  471. package/dist/plus/ai/providers/openaiProvider.d.ts.map +1 -1
  472. package/dist/plus/ai/providers/openaiProvider.js.map +1 -1
  473. package/dist/plus/ai/providers/xaiProvider.d.ts.map +1 -1
  474. package/dist/plus/ai/providers/xaiProvider.js +14 -1
  475. package/dist/plus/ai/providers/xaiProvider.js.map +1 -1
  476. package/dist/plus/ai/utils/ai.utils.d.ts.map +1 -1
  477. package/dist/plus/ai/utils/ai.utils.js +0 -2
  478. package/dist/plus/ai/utils/ai.utils.js.map +1 -1
  479. package/dist/plus/ai/utils/results.utils.d.ts +3 -0
  480. package/dist/plus/ai/utils/results.utils.d.ts.map +1 -1
  481. package/dist/plus/ai/utils/results.utils.js +26 -0
  482. package/dist/plus/ai/utils/results.utils.js.map +1 -1
  483. package/dist/plus/ai/utils/truncation.utils.d.ts +1 -1
  484. package/dist/plus/ai/utils/truncation.utils.d.ts.map +1 -1
  485. package/dist/plus/ai/utils/truncation.utils.js.map +1 -1
  486. package/dist/plus/git-github/api/config.d.ts.map +1 -1
  487. package/dist/plus/git-github/api/config.js.map +1 -1
  488. package/dist/plus/git-github/api/github.d.ts +66 -3
  489. package/dist/plus/git-github/api/github.d.ts.map +1 -1
  490. package/dist/plus/git-github/api/github.js +345 -74
  491. package/dist/plus/git-github/api/github.js.map +1 -1
  492. package/dist/plus/git-github/api/github.utils.d.ts.map +1 -1
  493. package/dist/plus/git-github/api/github.utils.js.map +1 -1
  494. package/dist/plus/git-github/api/token.d.ts.map +1 -1
  495. package/dist/plus/git-github/api/token.js.map +1 -1
  496. package/dist/plus/git-github/api/tokenUtils.d.ts.map +1 -1
  497. package/dist/plus/git-github/api/tokenUtils.js.map +1 -1
  498. package/dist/plus/git-github/api/types.d.ts.map +1 -1
  499. package/dist/plus/git-github/api/types.js.map +1 -1
  500. package/dist/plus/git-github/context.d.ts.map +1 -1
  501. package/dist/plus/git-github/models.d.ts +5 -0
  502. package/dist/plus/git-github/models.d.ts.map +1 -1
  503. package/dist/plus/git-github/models.js +27 -2
  504. package/dist/plus/git-github/models.js.map +1 -1
  505. package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
  506. package/dist/plus/git-github/providers/github/blame.js.map +1 -1
  507. package/dist/plus/git-github/providers/github/branches.d.ts +2 -1
  508. package/dist/plus/git-github/providers/github/branches.d.ts.map +1 -1
  509. package/dist/plus/git-github/providers/github/branches.js +7 -3
  510. package/dist/plus/git-github/providers/github/branches.js.map +1 -1
  511. package/dist/plus/git-github/providers/github/commits.d.ts.map +1 -1
  512. package/dist/plus/git-github/providers/github/commits.js.map +1 -1
  513. package/dist/plus/git-github/providers/github/config.d.ts.map +1 -1
  514. package/dist/plus/git-github/providers/github/config.js.map +1 -1
  515. package/dist/plus/git-github/providers/github/contributors.d.ts.map +1 -1
  516. package/dist/plus/git-github/providers/github/contributors.js.map +1 -1
  517. package/dist/plus/git-github/providers/github/diff.d.ts.map +1 -1
  518. package/dist/plus/git-github/providers/github/diff.js +2 -2
  519. package/dist/plus/git-github/providers/github/diff.js.map +1 -1
  520. package/dist/plus/git-github/providers/github/graph.d.ts +12 -1
  521. package/dist/plus/git-github/providers/github/graph.d.ts.map +1 -1
  522. package/dist/plus/git-github/providers/github/graph.js +85 -0
  523. package/dist/plus/git-github/providers/github/graph.js.map +1 -1
  524. package/dist/plus/git-github/providers/github/refs.d.ts.map +1 -1
  525. package/dist/plus/git-github/providers/github/refs.js.map +1 -1
  526. package/dist/plus/git-github/providers/github/remotes.d.ts.map +1 -1
  527. package/dist/plus/git-github/providers/github/remotes.js.map +1 -1
  528. package/dist/plus/git-github/providers/github/revision.d.ts.map +1 -1
  529. package/dist/plus/git-github/providers/github/revision.js.map +1 -1
  530. package/dist/plus/git-github/providers/github/status.d.ts.map +1 -1
  531. package/dist/plus/git-github/providers/github/status.js.map +1 -1
  532. package/dist/plus/git-github/providers/github/tags.d.ts.map +1 -1
  533. package/dist/plus/git-github/providers/github/tags.js +3 -1
  534. package/dist/plus/git-github/providers/github/tags.js.map +1 -1
  535. package/dist/plus/git-github/providers/githubGitProvider.d.ts.map +1 -1
  536. package/dist/plus/git-github/providers/githubGitProvider.js.map +1 -1
  537. package/dist/plus/git-github/providers/githubProvider.d.ts.map +1 -1
  538. package/dist/plus/git-github/providers/githubProvider.js.map +1 -1
  539. package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts +20 -1
  540. package/dist/plus/integrations/authentication/cloudIntegrationService.d.ts.map +1 -1
  541. package/dist/plus/integrations/authentication/cloudIntegrationService.js +134 -10
  542. package/dist/plus/integrations/authentication/cloudIntegrationService.js.map +1 -1
  543. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +52 -5
  544. package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts.map +1 -1
  545. package/dist/plus/integrations/authentication/configuredIntegrationService.js +248 -46
  546. package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
  547. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts +24 -4
  548. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.d.ts.map +1 -1
  549. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js +58 -26
  550. package/dist/plus/integrations/authentication/integrationAuthenticationProvider.js.map +1 -1
  551. package/dist/plus/integrations/authentication/integrationAuthenticationService.d.ts.map +1 -1
  552. package/dist/plus/integrations/authentication/integrationAuthenticationService.js +7 -3
  553. package/dist/plus/integrations/authentication/integrationAuthenticationService.js.map +1 -1
  554. package/dist/plus/integrations/authentication/manualTokenProvider.d.ts +1 -0
  555. package/dist/plus/integrations/authentication/manualTokenProvider.d.ts.map +1 -1
  556. package/dist/plus/integrations/authentication/manualTokenProvider.js +9 -5
  557. package/dist/plus/integrations/authentication/manualTokenProvider.js.map +1 -1
  558. package/dist/plus/integrations/authentication/models.d.ts +33 -0
  559. package/dist/plus/integrations/authentication/models.d.ts.map +1 -1
  560. package/dist/plus/integrations/authentication/models.js.map +1 -1
  561. package/dist/plus/integrations/collectionMetadata.d.ts +21 -0
  562. package/dist/plus/integrations/collectionMetadata.d.ts.map +1 -0
  563. package/dist/plus/integrations/collectionMetadata.js +121 -0
  564. package/dist/plus/integrations/collectionMetadata.js.map +1 -0
  565. package/dist/plus/integrations/constants.d.ts +12 -2
  566. package/dist/plus/integrations/constants.d.ts.map +1 -1
  567. package/dist/plus/integrations/constants.js +10 -0
  568. package/dist/plus/integrations/constants.js.map +1 -1
  569. package/dist/plus/integrations/context.d.ts +10 -6
  570. package/dist/plus/integrations/context.d.ts.map +1 -1
  571. package/dist/plus/integrations/errors.d.ts +65 -0
  572. package/dist/plus/integrations/errors.d.ts.map +1 -1
  573. package/dist/plus/integrations/errors.js +131 -0
  574. package/dist/plus/integrations/errors.js.map +1 -1
  575. package/dist/plus/integrations/index.d.ts +57 -12
  576. package/dist/plus/integrations/index.d.ts.map +1 -1
  577. package/dist/plus/integrations/index.js +39 -37
  578. package/dist/plus/integrations/index.js.map +1 -1
  579. package/dist/plus/integrations/integrationService.d.ts +293 -12
  580. package/dist/plus/integrations/integrationService.d.ts.map +1 -1
  581. package/dist/plus/integrations/integrationService.js +1305 -37
  582. package/dist/plus/integrations/integrationService.js.map +1 -1
  583. package/dist/plus/integrations/lite.d.ts +47 -0
  584. package/dist/plus/integrations/lite.d.ts.map +1 -0
  585. package/dist/plus/integrations/lite.js +141 -0
  586. package/dist/plus/integrations/lite.js.map +1 -0
  587. package/dist/plus/integrations/manager.d.ts +332 -0
  588. package/dist/plus/integrations/manager.d.ts.map +1 -0
  589. package/dist/plus/integrations/manager.js +2 -0
  590. package/dist/plus/integrations/manager.js.map +1 -0
  591. package/dist/plus/integrations/models/gitHostIntegration.d.ts +269 -10
  592. package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
  593. package/dist/plus/integrations/models/gitHostIntegration.js +712 -88
  594. package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
  595. package/dist/plus/integrations/models/integration.d.ts +88 -3
  596. package/dist/plus/integrations/models/integration.d.ts.map +1 -1
  597. package/dist/plus/integrations/models/integration.js +192 -21
  598. package/dist/plus/integrations/models/integration.js.map +1 -1
  599. package/dist/plus/integrations/models/issuesIntegration.d.ts +87 -7
  600. package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -1
  601. package/dist/plus/integrations/models/issuesIntegration.js +148 -33
  602. package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
  603. package/dist/plus/integrations/providerFilters.d.ts +12 -0
  604. package/dist/plus/integrations/providerFilters.d.ts.map +1 -0
  605. package/dist/plus/integrations/providerFilters.js +14 -0
  606. package/dist/plus/integrations/providerFilters.js.map +1 -0
  607. package/dist/plus/integrations/providers/apiClients.d.ts.map +1 -1
  608. package/dist/plus/integrations/providers/apiClients.js +3 -3
  609. package/dist/plus/integrations/providers/apiClients.js.map +1 -1
  610. package/dist/plus/integrations/providers/apiConfig.d.ts +52 -0
  611. package/dist/plus/integrations/providers/apiConfig.d.ts.map +1 -0
  612. package/dist/plus/integrations/providers/apiConfig.js +19 -0
  613. package/dist/plus/integrations/providers/apiConfig.js.map +1 -0
  614. package/dist/plus/integrations/providers/azure/azure.d.ts +14 -2
  615. package/dist/plus/integrations/providers/azure/azure.d.ts.map +1 -1
  616. package/dist/plus/integrations/providers/azure/azure.js +107 -32
  617. package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
  618. package/dist/plus/integrations/providers/azure/models.d.ts +16 -0
  619. package/dist/plus/integrations/providers/azure/models.d.ts.map +1 -1
  620. package/dist/plus/integrations/providers/azure/models.js +6 -6
  621. package/dist/plus/integrations/providers/azure/models.js.map +1 -1
  622. package/dist/plus/integrations/providers/azureDevOps.d.ts +55 -9
  623. package/dist/plus/integrations/providers/azureDevOps.d.ts.map +1 -1
  624. package/dist/plus/integrations/providers/azureDevOps.js +572 -79
  625. package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
  626. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts +13 -2
  627. package/dist/plus/integrations/providers/bitbucket/bitbucket.d.ts.map +1 -1
  628. package/dist/plus/integrations/providers/bitbucket/bitbucket.js +108 -32
  629. package/dist/plus/integrations/providers/bitbucket/bitbucket.js.map +1 -1
  630. package/dist/plus/integrations/providers/bitbucket/models.d.ts.map +1 -1
  631. package/dist/plus/integrations/providers/bitbucket/models.js.map +1 -1
  632. package/dist/plus/integrations/providers/bitbucket-server/models.d.ts +19 -1
  633. package/dist/plus/integrations/providers/bitbucket-server/models.d.ts.map +1 -1
  634. package/dist/plus/integrations/providers/bitbucket-server/models.js +20 -1
  635. package/dist/plus/integrations/providers/bitbucket-server/models.js.map +1 -1
  636. package/dist/plus/integrations/providers/bitbucket-server.d.ts +28 -4
  637. package/dist/plus/integrations/providers/bitbucket-server.d.ts.map +1 -1
  638. package/dist/plus/integrations/providers/bitbucket-server.js +110 -6
  639. package/dist/plus/integrations/providers/bitbucket-server.js.map +1 -1
  640. package/dist/plus/integrations/providers/bitbucket.d.ts +38 -4
  641. package/dist/plus/integrations/providers/bitbucket.d.ts.map +1 -1
  642. package/dist/plus/integrations/providers/bitbucket.js +330 -34
  643. package/dist/plus/integrations/providers/bitbucket.js.map +1 -1
  644. package/dist/plus/integrations/providers/github/github.d.ts.map +1 -1
  645. package/dist/plus/integrations/providers/github/github.js +1 -1
  646. package/dist/plus/integrations/providers/github/github.js.map +1 -1
  647. package/dist/plus/integrations/providers/github/github.utils.d.ts.map +1 -1
  648. package/dist/plus/integrations/providers/github/github.utils.js.map +1 -1
  649. package/dist/plus/integrations/providers/github/models.d.ts.map +1 -1
  650. package/dist/plus/integrations/providers/github/models.js.map +1 -1
  651. package/dist/plus/integrations/providers/github.d.ts +49 -6
  652. package/dist/plus/integrations/providers/github.d.ts.map +1 -1
  653. package/dist/plus/integrations/providers/github.js +289 -4
  654. package/dist/plus/integrations/providers/github.js.map +1 -1
  655. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts +11 -3
  656. package/dist/plus/integrations/providers/gitlab/gitlab.d.ts.map +1 -1
  657. package/dist/plus/integrations/providers/gitlab/gitlab.js +121 -47
  658. package/dist/plus/integrations/providers/gitlab/gitlab.js.map +1 -1
  659. package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts +6 -0
  660. package/dist/plus/integrations/providers/gitlab/gitlab.utils.d.ts.map +1 -1
  661. package/dist/plus/integrations/providers/gitlab/gitlab.utils.js +8 -0
  662. package/dist/plus/integrations/providers/gitlab/gitlab.utils.js.map +1 -1
  663. package/dist/plus/integrations/providers/gitlab/models.d.ts +10 -0
  664. package/dist/plus/integrations/providers/gitlab/models.d.ts.map +1 -1
  665. package/dist/plus/integrations/providers/gitlab/models.js +8 -5
  666. package/dist/plus/integrations/providers/gitlab/models.js.map +1 -1
  667. package/dist/plus/integrations/providers/gitlab.d.ts +50 -5
  668. package/dist/plus/integrations/providers/gitlab.d.ts.map +1 -1
  669. package/dist/plus/integrations/providers/gitlab.js +274 -8
  670. package/dist/plus/integrations/providers/gitlab.js.map +1 -1
  671. package/dist/plus/integrations/providers/jira.d.ts +13 -2
  672. package/dist/plus/integrations/providers/jira.d.ts.map +1 -1
  673. package/dist/plus/integrations/providers/jira.js +200 -30
  674. package/dist/plus/integrations/providers/jira.js.map +1 -1
  675. package/dist/plus/integrations/providers/linear.d.ts +16 -5
  676. package/dist/plus/integrations/providers/linear.d.ts.map +1 -1
  677. package/dist/plus/integrations/providers/linear.js +127 -21
  678. package/dist/plus/integrations/providers/linear.js.map +1 -1
  679. package/dist/plus/integrations/providers/models.d.ts +339 -60
  680. package/dist/plus/integrations/providers/models.d.ts.map +1 -1
  681. package/dist/plus/integrations/providers/models.js +307 -59
  682. package/dist/plus/integrations/providers/models.js.map +1 -1
  683. package/dist/plus/integrations/providers/providersApi.d.ts +144 -11
  684. package/dist/plus/integrations/providers/providersApi.d.ts.map +1 -1
  685. package/dist/plus/integrations/providers/providersApi.js +486 -55
  686. package/dist/plus/integrations/providers/providersApi.js.map +1 -1
  687. package/dist/plus/integrations/providers/trello.d.ts +47 -0
  688. package/dist/plus/integrations/providers/trello.d.ts.map +1 -0
  689. package/dist/plus/integrations/providers/trello.js +141 -0
  690. package/dist/plus/integrations/providers/trello.js.map +1 -0
  691. package/dist/plus/integrations/providers/utils/providerPaging.d.ts +29 -0
  692. package/dist/plus/integrations/providers/utils/providerPaging.d.ts.map +1 -0
  693. package/dist/plus/integrations/providers/utils/providerPaging.js +154 -0
  694. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -0
  695. package/dist/plus/integrations/providers/utils.d.ts +21 -0
  696. package/dist/plus/integrations/providers/utils.d.ts.map +1 -1
  697. package/dist/plus/integrations/providers/utils.js +57 -6
  698. package/dist/plus/integrations/providers/utils.js.map +1 -1
  699. package/dist/plus/integrations/reads/context.d.ts +52 -0
  700. package/dist/plus/integrations/reads/context.d.ts.map +1 -0
  701. package/dist/plus/integrations/reads/context.js +2 -0
  702. package/dist/plus/integrations/reads/context.js.map +1 -0
  703. package/dist/plus/integrations/reads/cursors.d.ts +66 -0
  704. package/dist/plus/integrations/reads/cursors.d.ts.map +1 -0
  705. package/dist/plus/integrations/reads/cursors.js +133 -0
  706. package/dist/plus/integrations/reads/cursors.js.map +1 -0
  707. package/dist/plus/integrations/reads/drains.d.ts +60 -0
  708. package/dist/plus/integrations/reads/drains.d.ts.map +1 -0
  709. package/dist/plus/integrations/reads/drains.js +255 -0
  710. package/dist/plus/integrations/reads/drains.js.map +1 -0
  711. package/dist/plus/integrations/reads/filters.d.ts +81 -0
  712. package/dist/plus/integrations/reads/filters.d.ts.map +1 -0
  713. package/dist/plus/integrations/reads/filters.js +87 -0
  714. package/dist/plus/integrations/reads/filters.js.map +1 -0
  715. package/dist/plus/integrations/reads/hierarchy.d.ts +17 -0
  716. package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -0
  717. package/dist/plus/integrations/reads/hierarchy.js +348 -0
  718. package/dist/plus/integrations/reads/hierarchy.js.map +1 -0
  719. package/dist/plus/integrations/reads/hierarchy.utils.d.ts +53 -0
  720. package/dist/plus/integrations/reads/hierarchy.utils.d.ts.map +1 -0
  721. package/dist/plus/integrations/reads/hierarchy.utils.js +85 -0
  722. package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -0
  723. package/dist/plus/integrations/reads/issueTracker.d.ts +19 -0
  724. package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -0
  725. package/dist/plus/integrations/reads/issueTracker.js +346 -0
  726. package/dist/plus/integrations/reads/issueTracker.js.map +1 -0
  727. package/dist/plus/integrations/reads/issues.d.ts +34 -0
  728. package/dist/plus/integrations/reads/issues.d.ts.map +1 -0
  729. package/dist/plus/integrations/reads/issues.js +244 -0
  730. package/dist/plus/integrations/reads/issues.js.map +1 -0
  731. package/dist/plus/integrations/reads/paging.d.ts +136 -0
  732. package/dist/plus/integrations/reads/paging.d.ts.map +1 -0
  733. package/dist/plus/integrations/reads/paging.js +221 -0
  734. package/dist/plus/integrations/reads/paging.js.map +1 -0
  735. package/dist/plus/integrations/reads/pullRequests.d.ts +32 -0
  736. package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -0
  737. package/dist/plus/integrations/reads/pullRequests.js +151 -0
  738. package/dist/plus/integrations/reads/pullRequests.js.map +1 -0
  739. package/dist/plus/integrations/reads/warnings.d.ts +47 -0
  740. package/dist/plus/integrations/reads/warnings.d.ts.map +1 -0
  741. package/dist/plus/integrations/reads/warnings.js +81 -0
  742. package/dist/plus/integrations/reads/warnings.js.map +1 -0
  743. package/dist/plus/integrations/results.d.ts +189 -0
  744. package/dist/plus/integrations/results.d.ts.map +1 -0
  745. package/dist/plus/integrations/results.js +62 -0
  746. package/dist/plus/integrations/results.js.map +1 -0
  747. package/dist/plus/integrations/utils/domain.utils.d.ts +5 -0
  748. package/dist/plus/integrations/utils/domain.utils.d.ts.map +1 -0
  749. package/dist/plus/integrations/utils/domain.utils.js +27 -0
  750. package/dist/plus/integrations/utils/domain.utils.js.map +1 -0
  751. package/dist/plus/integrations/utils/integration.utils.d.ts +27 -1
  752. package/dist/plus/integrations/utils/integration.utils.d.ts.map +1 -1
  753. package/dist/plus/integrations/utils/integration.utils.js +86 -15
  754. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  755. package/dist/utils/array.d.ts.map +1 -1
  756. package/dist/utils/array.js.map +1 -1
  757. package/dist/utils/brand.d.ts.map +1 -1
  758. package/dist/utils/cancellation.d.ts +13 -0
  759. package/dist/utils/cancellation.d.ts.map +1 -1
  760. package/dist/utils/cancellation.js +52 -7
  761. package/dist/utils/cancellation.js.map +1 -1
  762. package/dist/utils/charCode.d.ts.map +1 -1
  763. package/dist/utils/coalescedRun.d.ts +16 -0
  764. package/dist/utils/coalescedRun.d.ts.map +1 -0
  765. package/dist/utils/coalescedRun.js +43 -0
  766. package/dist/utils/coalescedRun.js.map +1 -0
  767. package/dist/utils/color.d.ts.map +1 -1
  768. package/dist/utils/color.js +3 -3
  769. package/dist/utils/color.js.map +1 -1
  770. package/dist/utils/date.d.ts +24 -0
  771. package/dist/utils/date.d.ts.map +1 -1
  772. package/dist/utils/date.js +62 -0
  773. package/dist/utils/date.js.map +1 -1
  774. package/dist/utils/debounce.js +1 -1
  775. package/dist/utils/debounce.js.map +1 -1
  776. package/dist/utils/decorators/debounce.d.ts.map +1 -1
  777. package/dist/utils/decorators/debounce.js.map +1 -1
  778. package/dist/utils/decorators/gate.d.ts.map +1 -1
  779. package/dist/utils/decorators/gate.js +2 -2
  780. package/dist/utils/decorators/gate.js.map +1 -1
  781. package/dist/utils/decorators/log.d.ts.map +1 -1
  782. package/dist/utils/decorators/log.js +5 -5
  783. package/dist/utils/decorators/log.js.map +1 -1
  784. package/dist/utils/decorators/memoize.d.ts.map +1 -1
  785. package/dist/utils/decorators/memoize.js +2 -2
  786. package/dist/utils/decorators/memoize.js.map +1 -1
  787. package/dist/utils/decorators/resolver.d.ts.map +1 -1
  788. package/dist/utils/decorators/resolver.js.map +1 -1
  789. package/dist/utils/decorators/sequentialize.d.ts.map +1 -1
  790. package/dist/utils/decorators/sequentialize.js +2 -2
  791. package/dist/utils/decorators/sequentialize.js.map +1 -1
  792. package/dist/utils/decorators/serializable.d.ts.map +1 -1
  793. package/dist/utils/decorators/serializable.js +1 -1
  794. package/dist/utils/decorators/serializable.js.map +1 -1
  795. package/dist/utils/dedupedAsyncCache.d.ts.map +1 -1
  796. package/dist/utils/env/browser/base64.d.ts.map +1 -1
  797. package/dist/utils/env/browser/base64.js.map +1 -1
  798. package/dist/utils/env/browser/crypto.d.ts.map +1 -1
  799. package/dist/utils/env/browser/crypto.js.map +1 -1
  800. package/dist/utils/env/browser/fs.d.ts.map +1 -1
  801. package/dist/utils/env/browser/fs.js.map +1 -1
  802. package/dist/utils/env/browser/hex.d.ts.map +1 -1
  803. package/dist/utils/env/browser/hex.js.map +1 -1
  804. package/dist/utils/env/browser/hrtime.d.ts.map +1 -1
  805. package/dist/utils/env/browser/hrtime.js.map +1 -1
  806. package/dist/utils/env/browser/logScope.d.ts.map +1 -1
  807. package/dist/utils/env/browser/logScope.js.map +1 -1
  808. package/dist/utils/env/browser/md5.d.ts.map +1 -1
  809. package/dist/utils/env/browser/md5.js.map +1 -1
  810. package/dist/utils/env/browser/platform.d.ts.map +1 -1
  811. package/dist/utils/env/browser/platform.js.map +1 -1
  812. package/dist/utils/env/node/base64.d.ts.map +1 -1
  813. package/dist/utils/env/node/base64.js.map +1 -1
  814. package/dist/utils/env/node/crypto.d.ts.map +1 -1
  815. package/dist/utils/env/node/crypto.js.map +1 -1
  816. package/dist/utils/env/node/exec.d.ts +9 -1
  817. package/dist/utils/env/node/exec.d.ts.map +1 -1
  818. package/dist/utils/env/node/exec.js +11 -4
  819. package/dist/utils/env/node/exec.js.map +1 -1
  820. package/dist/utils/env/node/fs.d.ts.map +1 -1
  821. package/dist/utils/env/node/fs.js.map +1 -1
  822. package/dist/utils/env/node/hex.d.ts.map +1 -1
  823. package/dist/utils/env/node/hex.js.map +1 -1
  824. package/dist/utils/env/node/hrtime.d.ts.map +1 -1
  825. package/dist/utils/env/node/hrtime.js.map +1 -1
  826. package/dist/utils/env/node/logScope.d.ts.map +1 -1
  827. package/dist/utils/env/node/logScope.js.map +1 -1
  828. package/dist/utils/env/node/platform.d.ts.map +1 -1
  829. package/dist/utils/env/node/platform.js.map +1 -1
  830. package/dist/utils/event.d.ts.map +1 -1
  831. package/dist/utils/event.js +18 -22
  832. package/dist/utils/event.js.map +1 -1
  833. package/dist/utils/formatter.d.ts.map +1 -1
  834. package/dist/utils/formatter.js.map +1 -1
  835. package/dist/utils/function.d.ts.map +1 -1
  836. package/dist/utils/function.js +3 -3
  837. package/dist/utils/function.js.map +1 -1
  838. package/dist/utils/hash.js.map +1 -1
  839. package/dist/utils/iterable.d.ts.map +1 -1
  840. package/dist/utils/iterable.js +2 -6
  841. package/dist/utils/iterable.js.map +1 -1
  842. package/dist/utils/lazy.d.ts.map +1 -1
  843. package/dist/utils/lazy.js.map +1 -1
  844. package/dist/utils/logger.d.ts.map +1 -1
  845. package/dist/utils/logger.js +1 -1
  846. package/dist/utils/logger.js.map +1 -1
  847. package/dist/utils/logger.scoped.js +1 -1
  848. package/dist/utils/logger.scoped.js.map +1 -1
  849. package/dist/utils/lruMap.d.ts.map +1 -1
  850. package/dist/utils/lruMap.js.map +1 -1
  851. package/dist/utils/mru.d.ts.map +1 -1
  852. package/dist/utils/mru.js.map +1 -1
  853. package/dist/utils/object.js.map +1 -1
  854. package/dist/utils/paging.d.ts +29 -0
  855. package/dist/utils/paging.d.ts.map +1 -1
  856. package/dist/utils/paging.js +18 -0
  857. package/dist/utils/paging.js.map +1 -1
  858. package/dist/utils/path.js.map +1 -1
  859. package/dist/utils/promise.d.ts +10 -0
  860. package/dist/utils/promise.d.ts.map +1 -1
  861. package/dist/utils/promise.js +26 -3
  862. package/dist/utils/promise.js.map +1 -1
  863. package/dist/utils/promiseCache.d.ts +12 -2
  864. package/dist/utils/promiseCache.d.ts.map +1 -1
  865. package/dist/utils/promiseCache.js +80 -50
  866. package/dist/utils/promiseCache.js.map +1 -1
  867. package/dist/utils/searchTree.d.ts.map +1 -1
  868. package/dist/utils/searchTree.js +4 -1
  869. package/dist/utils/searchTree.js.map +1 -1
  870. package/dist/utils/stopwatch.d.ts.map +1 -1
  871. package/dist/utils/string.js +1 -1
  872. package/dist/utils/string.js.map +1 -1
  873. package/dist/utils/subscriptionManager.d.ts.map +1 -1
  874. package/dist/utils/subscriptionManager.js.map +1 -1
  875. package/dist/utils/trie.d.ts.map +1 -1
  876. package/dist/utils/trie.js +1 -0
  877. package/dist/utils/trie.js.map +1 -1
  878. package/docs/integrations.md +372 -0
  879. package/docs/kepler-read-api-parity.md +112 -0
  880. package/package.json +238 -213
  881. package/src/git/cache.ts +75 -8
  882. package/src/git/errors.ts +36 -1
  883. package/src/git/models/commit.ts +1 -1
  884. package/src/git/models/graph.ts +147 -0
  885. package/src/git/models/graphSession.ts +205 -0
  886. package/src/git/models/issue.ts +12 -1
  887. package/src/git/models/pullRequest.ts +27 -1
  888. package/src/git/models/repository.ts +24 -1
  889. package/src/git/models/resourceDescriptor.ts +17 -0
  890. package/src/git/models/signature.ts +16 -0
  891. package/src/git/models/tag.ts +6 -1
  892. package/src/git/parsers/diffParser.ts +1 -1
  893. package/src/git/providers/branches.ts +6 -1
  894. package/src/git/providers/commits.ts +6 -1
  895. package/src/git/providers/config.ts +5 -1
  896. package/src/git/providers/graph.ts +69 -2
  897. package/src/git/providers/status.ts +1 -1
  898. package/src/git/providers/worktrees.ts +3 -1
  899. package/src/git/remotes/azure-devops.ts +29 -33
  900. package/src/git/remotes/bitbucket-server.ts +23 -25
  901. package/src/git/remotes/bitbucket.ts +23 -25
  902. package/src/git/remotes/gerrit.ts +12 -14
  903. package/src/git/remotes/gitea.ts +13 -15
  904. package/src/git/remotes/github.ts +56 -58
  905. package/src/git/remotes/gitlab.ts +102 -104
  906. package/src/git/run.types.ts +54 -4
  907. package/src/git/utils/branch.utils.ts +12 -1
  908. package/src/git/utils/contributor.utils.ts +1 -1
  909. package/src/git/utils/fileStatus.utils.ts +7 -0
  910. package/src/git/utils/graph.utils.ts +46 -0
  911. package/src/git/utils/issue.utils.ts +1 -0
  912. package/src/git/utils/pullRequest.utils.ts +9 -0
  913. package/src/git/utils/reachability.utils.ts +79 -8
  914. package/src/git/utils/sshKey.utils.ts +30 -0
  915. package/src/git/watching/watchService.ts +16 -1
  916. package/src/git/watching/watchSession.ts +20 -2
  917. package/src/git-cli/exec/git.ts +144 -42
  918. package/src/git-cli/parsers/logParser.ts +83 -1
  919. package/src/git-cli/parsers/sshSignatureParser.ts +85 -0
  920. package/src/git-cli/parsers/worktreeParser.ts +5 -7
  921. package/src/git-cli/providers/branches.ts +60 -38
  922. package/src/git-cli/providers/commits.ts +102 -9
  923. package/src/git-cli/providers/graph.ts +1771 -393
  924. package/src/git-cli/providers/pausedOperations.ts +3 -3
  925. package/src/git-cli/providers/revision.ts +42 -0
  926. package/src/git-cli/providers/status.ts +333 -178
  927. package/src/git-cli/providers/tags.ts +2 -0
  928. package/src/git-cli/providers/worktrees.ts +40 -4
  929. package/src/git-cli/service.ts +9 -0
  930. package/src/ipc/ipcServer.ts +1 -1
  931. package/src/plus/agents/providers/claudeCodeProvider.ts +25 -0
  932. package/src/plus/agents/providers/claudeCodeTranscript.ts +320 -8
  933. package/src/plus/agents/types.ts +34 -0
  934. package/src/plus/ai/constants.ts +1 -9
  935. package/src/plus/ai/models/model.ts +53 -2
  936. package/src/plus/ai/models/promptTemplates.ts +9 -2
  937. package/src/plus/ai/prompts.ts +16 -48
  938. package/src/plus/ai/providers/anthropicProvider.ts +45 -3
  939. package/src/plus/ai/providers/deepSeekProvider.ts +17 -1
  940. package/src/plus/ai/providers/geminiProvider.ts +25 -6
  941. package/src/plus/ai/providers/gitkrakenProvider.ts +2 -0
  942. package/src/plus/ai/providers/huggingFaceProvider.ts +28 -21
  943. package/src/plus/ai/providers/openAICompatibleProviderBase.ts +16 -1
  944. package/src/plus/ai/providers/xaiProvider.ts +14 -1
  945. package/src/plus/ai/utils/ai.utils.ts +0 -2
  946. package/src/plus/ai/utils/results.utils.ts +32 -0
  947. package/src/plus/ai/utils/truncation.utils.ts +0 -1
  948. package/src/plus/git-github/api/github.ts +484 -104
  949. package/src/plus/git-github/models.ts +33 -0
  950. package/src/plus/git-github/providers/github/branches.ts +6 -3
  951. package/src/plus/git-github/providers/github/diff.ts +1 -1
  952. package/src/plus/git-github/providers/github/graph.ts +131 -0
  953. package/src/plus/git-github/providers/github/tags.ts +2 -0
  954. package/src/plus/integrations/authentication/cloudIntegrationService.ts +189 -17
  955. package/src/plus/integrations/authentication/configuredIntegrationService.ts +287 -50
  956. package/src/plus/integrations/authentication/integrationAuthenticationProvider.ts +105 -31
  957. package/src/plus/integrations/authentication/integrationAuthenticationService.ts +7 -3
  958. package/src/plus/integrations/authentication/manualTokenProvider.ts +12 -5
  959. package/src/plus/integrations/authentication/models.ts +35 -1
  960. package/src/plus/integrations/collectionMetadata.ts +143 -0
  961. package/src/plus/integrations/constants.ts +21 -0
  962. package/src/plus/integrations/context.ts +8 -9
  963. package/src/plus/integrations/errors.ts +149 -0
  964. package/src/plus/integrations/index.ts +148 -51
  965. package/src/plus/integrations/integrationService.ts +1714 -49
  966. package/src/plus/integrations/lite.ts +233 -0
  967. package/src/plus/integrations/manager.ts +359 -0
  968. package/src/plus/integrations/models/gitHostIntegration.ts +1014 -121
  969. package/src/plus/integrations/models/integration.ts +293 -24
  970. package/src/plus/integrations/models/issuesIntegration.ts +178 -38
  971. package/src/plus/integrations/providerFilters.ts +12 -0
  972. package/src/plus/integrations/providers/apiClients.ts +8 -11
  973. package/src/plus/integrations/providers/apiConfig.ts +71 -0
  974. package/src/plus/integrations/providers/azure/azure.ts +164 -33
  975. package/src/plus/integrations/providers/azure/models.ts +19 -6
  976. package/src/plus/integrations/providers/azureDevOps.ts +766 -101
  977. package/src/plus/integrations/providers/bitbucket/bitbucket.ts +164 -34
  978. package/src/plus/integrations/providers/bitbucket-server/models.ts +32 -1
  979. package/src/plus/integrations/providers/bitbucket-server.ts +173 -8
  980. package/src/plus/integrations/providers/bitbucket.ts +489 -45
  981. package/src/plus/integrations/providers/github/github.ts +2 -2
  982. package/src/plus/integrations/providers/github/github.utils.ts +1 -1
  983. package/src/plus/integrations/providers/github.ts +390 -6
  984. package/src/plus/integrations/providers/gitlab/gitlab.ts +170 -60
  985. package/src/plus/integrations/providers/gitlab/gitlab.utils.ts +9 -0
  986. package/src/plus/integrations/providers/gitlab/models.ts +19 -5
  987. package/src/plus/integrations/providers/gitlab.ts +369 -10
  988. package/src/plus/integrations/providers/jira.ts +247 -42
  989. package/src/plus/integrations/providers/linear.ts +154 -27
  990. package/src/plus/integrations/providers/models.ts +583 -75
  991. package/src/plus/integrations/providers/providersApi.ts +849 -86
  992. package/src/plus/integrations/providers/trello.ts +205 -0
  993. package/src/plus/integrations/providers/utils/providerPaging.ts +177 -0
  994. package/src/plus/integrations/providers/utils.ts +68 -8
  995. package/src/plus/integrations/reads/context.ts +75 -0
  996. package/src/plus/integrations/reads/cursors.ts +224 -0
  997. package/src/plus/integrations/reads/drains.ts +343 -0
  998. package/src/plus/integrations/reads/filters.ts +124 -0
  999. package/src/plus/integrations/reads/hierarchy.ts +493 -0
  1000. package/src/plus/integrations/reads/hierarchy.utils.ts +106 -0
  1001. package/src/plus/integrations/reads/issueTracker.ts +480 -0
  1002. package/src/plus/integrations/reads/issues.ts +407 -0
  1003. package/src/plus/integrations/reads/paging.ts +277 -0
  1004. package/src/plus/integrations/reads/pullRequests.ts +267 -0
  1005. package/src/plus/integrations/reads/warnings.ts +170 -0
  1006. package/src/plus/integrations/results.ts +275 -0
  1007. package/src/plus/integrations/utils/domain.utils.ts +26 -0
  1008. package/src/plus/integrations/utils/integration.utils.ts +93 -16
  1009. package/src/utils/brand.ts +0 -2
  1010. package/src/utils/cancellation.ts +56 -7
  1011. package/src/utils/coalescedRun.ts +45 -0
  1012. package/src/utils/color.ts +3 -3
  1013. package/src/utils/date.ts +72 -0
  1014. package/src/utils/debounce.ts +1 -1
  1015. package/src/utils/decorators/gate.ts +2 -2
  1016. package/src/utils/decorators/log.ts +5 -5
  1017. package/src/utils/decorators/memoize.ts +2 -2
  1018. package/src/utils/decorators/sequentialize.ts +2 -2
  1019. package/src/utils/decorators/serializable.ts +1 -1
  1020. package/src/utils/env/node/exec.ts +20 -5
  1021. package/src/utils/event.ts +19 -25
  1022. package/src/utils/function.ts +3 -3
  1023. package/src/utils/iterable.ts +2 -6
  1024. package/src/utils/logger.scoped.ts +1 -1
  1025. package/src/utils/logger.ts +1 -1
  1026. package/src/utils/paging.ts +46 -0
  1027. package/src/utils/promise.ts +33 -3
  1028. package/src/utils/promiseCache.ts +81 -51
  1029. package/src/utils/searchTree.ts +4 -2
  1030. package/src/utils/string.ts +1 -1
  1031. package/src/utils/trie.ts +1 -0
  1032. package/dist/plus/ai/providers/githubModelsProvider.d.ts +0 -19
  1033. package/dist/plus/ai/providers/githubModelsProvider.d.ts.map +0 -1
  1034. package/dist/plus/ai/providers/githubModelsProvider.js +0 -51
  1035. package/dist/plus/ai/providers/githubModelsProvider.js.map +0 -1
  1036. package/src/plus/ai/providers/githubModelsProvider.ts +0 -92
@@ -4,16 +4,38 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ import { createRemoteProviderMatcher } from '../../git/remotes/matcher.js';
8
+ import { parseGitRemoteUrl } from '../../git/utils/remote.utils.js';
7
9
  import { gate } from '../../utils/decorators/gate.js';
8
10
  import { debug, trace } from '../../utils/decorators/log.js';
9
11
  import { fromDisposables } from '../../utils/disposable.js';
10
12
  import { Emitter } from '../../utils/event.js';
11
13
  import { filterMap, flatten } from '../../utils/iterable.js';
12
14
  import { getScopedLogger } from '../../utils/logger.scoped.js';
15
+ import { mapBounded } from '../../utils/promise.js';
16
+ import { CloudIntegrationService } from './authentication/cloudIntegrationService.js';
17
+ import { ConfiguredIntegrationService } from './authentication/configuredIntegrationService.js';
18
+ import { IntegrationAuthenticationService } from './authentication/integrationAuthenticationService.js';
13
19
  import { getSupportedCloudIntegrationIds, isSupportedCloudIntegrationId, toIntegrationId, } from './authentication/models.js';
14
- import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, IssuesCloudHostIntegrationId, } from './constants.js';
20
+ import { mergeAssessmentInto } from './collectionMetadata.js';
21
+ import { GitCloudHostIntegrationId, GitSelfManagedHostIntegrationId, IssuesCloudHostIntegrationId, providerFanOutConcurrency, } from './constants.js';
22
+ import { AuthenticationError, RequestNotFoundError } from './errors.js';
23
+ import { isIssuesIntegration } from './models/issuesIntegration.js';
15
24
  import { createApiClients } from './providers/apiClients.js';
16
- import { convertRemoteProviderIdToIntegrationId, getIntegrationIdForRemote, isCloudGitSelfManagedHostIntegrationId, isGitCloudHostIntegrationId, isGitSelfManagedHostIntegrationId, } from './utils/integration.utils.js';
25
+ import { fromProviderPullRequest, isAzureCloudDomain, isBitbucketCloudDomain, isGitHubDotCom, isGitLabDotCom, providersMetadata, } from './providers/models.js';
26
+ import { getBroadenIssuesCursor, isBroadenIssuesOrgExhausted, toBroadenIssuesCursor, } from './reads/cursors.js';
27
+ import { drainPullRequests, drainRepositories, getCurrentAccountId, resolvePullRequestSweepTargets, runCaptured, } from './reads/drains.js';
28
+ import { getSupportedFilters, resolveAccountWidePullRequestFilters, resolvePullRequestFilters, } from './reads/filters.js';
29
+ import { listOrgs, listProjects, listRepos } from './reads/hierarchy.js';
30
+ import { listIssuesPage } from './reads/issues.js';
31
+ import { listIssueTrackerIssuesPage } from './reads/issueTracker.js';
32
+ import { resolveContinuation, toProviderPageInfo } from './reads/paging.js';
33
+ import { listPullRequestsPage } from './reads/pullRequests.js';
34
+ import { gitHostOnlySurfaceWarning, issuesUnsupportedWarning, noConnectionWarning, otherWarning, unsupportedAccountWidePullRequestFiltersWarning, unsupportedFiltersWarning, } from './reads/warnings.js';
35
+ import { appendDedupedWarning, toProviderWarning } from './results.js';
36
+ import { hostFromDomain } from './utils/domain.utils.js';
37
+ import { convertRemoteProviderIdToIntegrationId, getIntegrationIdForRemote, isCloudGitSelfManagedHostIntegrationId, isGitCloudHostIntegrationId, isGitHostIntegration, isGitSelfManagedHostIntegrationId, isIssuesHostIntegrationId, isNonExpiringZeroTokenIntegrationId, remoteProviderTypeForConfig, remoteProviderTypeForIntegration, } from './utils/integration.utils.js';
38
+ const maxSmallIntegerV8 = 2 ** 30 - 1; // Max number that can be stored in V8's smis (small integers)
17
39
  export class IntegrationService {
18
40
  authenticationService;
19
41
  configuredIntegrationService;
@@ -112,7 +134,26 @@ export class IntegrationService {
112
134
  }
113
135
  return true;
114
136
  }
137
+ /**
138
+ * Starts the cloud connect flow without skipping an already-connected provider, allowing the host/GK Dev
139
+ * flow to add another account for that provider instead of treating the existing primary as sufficient.
140
+ * Returns whether a new connection was actually added (measured by a new cloud connection id appearing),
141
+ * since {@link connectCloudIntegrations} only reports provider-level success and can't detect a newly added
142
+ * secondary for an already-connected provider.
143
+ */
144
+ async connectSecondary(id, source) {
145
+ const before = new Set(this.getConfigured(id, { cloud: true }).map(c => c.id));
146
+ await this.connectCloudIntegrations({ integrationIds: [id], skipIfConnected: false }, source);
147
+ return this.getConfigured(id, { cloud: true }).some(c => !before.has(c.id));
148
+ }
115
149
  async get(id, domain) {
150
+ // Normalize to a bare host before anything keys off it. Callers pass a self-managed domain in both shapes
151
+ // — a full URL from a stored session/descriptor, a bare host from `hostFromDomain` — and the cache key is
152
+ // `${id}:${domain}`, so the same host arriving in two shapes would build two instances (and two
153
+ // "primaries") for one host.
154
+ if (isGitSelfManagedHostIntegrationId(id)) {
155
+ domain = hostFromDomain(domain) ?? domain;
156
+ }
116
157
  let integration = this.getCached(id, domain);
117
158
  if (integration == null) {
118
159
  switch (id) {
@@ -127,7 +168,7 @@ export class IntegrationService {
127
168
  return integration;
128
169
  const configured = this.getConfigured(GitSelfManagedHostIntegrationId.CloudGitHubEnterprise);
129
170
  if (configured.length) {
130
- const { domain: configuredDomain } = configured[0];
171
+ const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
131
172
  if (configuredDomain == null)
132
173
  throw new Error(`Domain is required for '${id}' integration`);
133
174
  integration = new (await import(/* webpackChunkName: "integrations" */ './providers/github.js')).GitHubEnterpriseIntegration(this.ctx, this.authenticationService, this.getProvidersApi.bind(this), this._onDidChangeIntegrationConnection, configuredDomain);
@@ -150,7 +191,7 @@ export class IntegrationService {
150
191
  return integration;
151
192
  const configured = this.getConfigured(GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted);
152
193
  if (configured.length) {
153
- const { domain: configuredDomain } = configured[0];
194
+ const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
154
195
  if (configuredDomain == null)
155
196
  throw new Error(`Domain is required for '${id}' integration`);
156
197
  integration = new (await import(/* webpackChunkName: "integrations" */ './providers/gitlab.js')).GitLabSelfHostedIntegration(this.ctx, this.authenticationService, this.getProvidersApi.bind(this), this._onDidChangeIntegrationConnection, configuredDomain);
@@ -173,7 +214,7 @@ export class IntegrationService {
173
214
  return integration;
174
215
  const configured = this.getConfigured(GitSelfManagedHostIntegrationId.BitbucketServer);
175
216
  if (configured.length) {
176
- const { domain: configuredDomain } = configured[0];
217
+ const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
177
218
  if (configuredDomain == null)
178
219
  throw new Error(`Domain is required for '${id}' integration`);
179
220
  integration = new (await import(/* webpackChunkName: "integrations" */ './providers/bitbucket-server.js')).BitbucketServerIntegration(this.ctx, this.authenticationService, this.getProvidersApi.bind(this), this._onDidChangeIntegrationConnection, configuredDomain);
@@ -196,7 +237,7 @@ export class IntegrationService {
196
237
  return integration;
197
238
  const configured = this.getConfigured(GitSelfManagedHostIntegrationId.AzureDevOpsServer);
198
239
  if (configured.length) {
199
- const { domain: configuredDomain } = configured[0];
240
+ const { domain: configuredDomain } = configured.find(c => c.primary) ?? configured[0];
200
241
  if (configuredDomain == null)
201
242
  throw new Error(`Domain is required for '${id}' integration`);
202
243
  integration = new (await import(/* webpackChunkName: "integrations" */ './providers/azureDevOps.js')).AzureDevOpsServerIntegration(this.ctx, this.authenticationService, this.getProvidersApi.bind(this), this._onDidChangeIntegrationConnection, configuredDomain);
@@ -214,6 +255,9 @@ export class IntegrationService {
214
255
  case IssuesCloudHostIntegrationId.Linear:
215
256
  integration = new (await import(/* webpackChunkName: "integrations" */ './providers/linear.js')).LinearIntegration(this.ctx, this.authenticationService, this.getProvidersApi.bind(this), this._onDidChangeIntegrationConnection);
216
257
  break;
258
+ case IssuesCloudHostIntegrationId.Trello:
259
+ integration = new (await import(/* webpackChunkName: "integrations" */ './providers/trello.js')).TrelloIntegration(this.ctx, this.authenticationService, this.getProvidersApi.bind(this), this._onDidChangeIntegrationConnection);
260
+ break;
217
261
  default:
218
262
  throw new Error(`Integration with '${id}' is not supported`);
219
263
  }
@@ -224,6 +268,14 @@ export class IntegrationService {
224
268
  getConfigured(id, options) {
225
269
  return this.configuredIntegrationService.getConfigured(id, options);
226
270
  }
271
+ /**
272
+ * The filters this provider's reads accept — part of the public {@link IntegrationManager} contract, so it
273
+ * stays a method here even though it needs no instance state; see {@link getSupportedFilters} for the
274
+ * capability table itself and why a consumer should intersect against it before reading.
275
+ */
276
+ getSupportedFilters(providerId) {
277
+ return getSupportedFilters(providerId);
278
+ }
227
279
  /**
228
280
  * Returns the connected integration for a `GitRemote`, if any.
229
281
  * Internal counterpart to the host's `getRemoteIntegration(remote)` helper.
@@ -332,20 +384,20 @@ export class IntegrationService {
332
384
  }
333
385
  return this.getMyIssuesCore(integrations);
334
386
  }
335
- async getMyCurrentAccounts(integrationIds) {
387
+ async getMyCurrentAccounts(integrationIds, connectionId) {
336
388
  const accounts = new Map();
337
389
  await Promise.allSettled(integrationIds.map(async (integrationId) => {
338
- const integration = await this.get(integrationId);
390
+ const integration = await this.getIntegrationForRead(integrationId, connectionId);
339
391
  if (integration == null)
340
392
  return;
341
- const account = await integration.getCurrentAccount();
393
+ const account = await integration.getCurrentAccount({ connectionId: connectionId });
342
394
  if (account) {
343
395
  accounts.set(integrationId, account);
344
396
  }
345
397
  }));
346
398
  return accounts;
347
399
  }
348
- async getMyPullRequests(integrationIds, cancellation, silent) {
400
+ async getMyPullRequests(integrationIds, cancellation, silent, options) {
349
401
  const integrations = new Map();
350
402
  for (const integrationId of integrationIds?.length
351
403
  ? integrationIds
@@ -361,15 +413,15 @@ export class IntegrationService {
361
413
  }
362
414
  if (integrations.size === 0)
363
415
  return undefined;
364
- return this.getMyPullRequestsCore(integrations, cancellation, silent);
416
+ return this.getMyPullRequestsCore(integrations, cancellation, silent, options);
365
417
  }
366
- async getMyPullRequestsCore(integrations, cancellation, silent) {
418
+ async getMyPullRequestsCore(integrations, cancellation, silent, options) {
367
419
  const start = performance.now();
368
420
  const promises = [];
369
421
  for (const [integration, repos] of integrations) {
370
422
  if (integration == null)
371
423
  continue;
372
- promises.push(integration.searchMyPullRequests(repos, cancellation, silent));
424
+ promises.push(integration.searchMyPullRequests(repos, cancellation, silent, undefined, undefined, options));
373
425
  }
374
426
  const results = await Promise.allSettled(promises);
375
427
  const successfulResults = [
@@ -418,17 +470,871 @@ export class IntegrationService {
418
470
  }
419
471
  return this.getMyPullRequestsCore(integrations);
420
472
  }
473
+ // #region ProviderBackend surface (#5438)
474
+ //
475
+ // Generic discovery (orgs/projects/repos) and page-oriented reads that Kepler's ProviderBackend
476
+ // adapter maps to its own DTOs. All results are neutral (`ProviderResult`/`ProviderPagedResult`) and
477
+ // carry per-provider warnings recovered from the read cores, so a single provider's auth/rate-limit
478
+ // failure degrades to a warning instead of failing the whole call. The reads are repo-scoped (they
479
+ // compose the git-host `*Result` cores); account-scoped fan-out is the adapter's responsibility.
480
+ /**
481
+ * Warnings for an early-returning read where the integration couldn't be resolved. When a specific
482
+ * `connectionId` or self-managed `domain` was requested, a missing integration means that target is
483
+ * unavailable — surface a `no-connection` warning + `fetchFailed` so the caller can tell it apart from
484
+ * a truly empty account. Without an explicit target, it's simply not connected, which stays a silent
485
+ * empty result.
486
+ */
487
+ earlyReturnConnectionWarnings(id, connectionId, domain) {
488
+ const requestedDomain = isGitSelfManagedHostIntegrationId(id) ? domain : undefined;
489
+ const invalidDomain = this.isEmptyExplicitSelector(domain);
490
+ if (connectionId == null && requestedDomain == null && !invalidDomain) {
491
+ return { warnings: [], fetchFailed: false };
492
+ }
493
+ const resolvedDomain = invalidDomain
494
+ ? domain?.trim()
495
+ : this.resolveDomainForRead(id, connectionId, requestedDomain);
496
+ return { warnings: [noConnectionWarning(id, resolvedDomain, connectionId)], fetchFailed: true };
497
+ }
498
+ isEmptyExplicitSelector(value) {
499
+ return value?.trim().length === 0;
500
+ }
501
+ domainForRead(integration, id, connectionId, domain) {
502
+ if (!isGitSelfManagedHostIntegrationId(id)) {
503
+ return connectionId != null ? this.getConfiguredConnectionDomain(id, connectionId) : integration.domain;
504
+ }
505
+ return this.resolveDomainForRead(id, connectionId, domain) ?? integration.domain;
506
+ }
507
+ /**
508
+ * Resolves the right integration instance for a read. A configured connection domain takes precedence over
509
+ * an explicit fallback domain; the latter lets external/manual authentication providers address a
510
+ * self-managed host without persisting `ConfiguredIntegrationService` state.
511
+ */
512
+ async getIntegrationForRead(id, connectionId, domain) {
513
+ // Empty explicit selectors are invalid targets, not an instruction to fall back to the primary
514
+ // connection. Keep this at the common read boundary so every public surface behaves consistently.
515
+ if (this.isEmptyExplicitSelector(connectionId) || this.isEmptyExplicitSelector(domain))
516
+ return undefined;
517
+ const resolvedDomain = this.resolveDomainForRead(id, connectionId, domain);
518
+ try {
519
+ return await this.get(id, resolvedDomain);
520
+ }
521
+ catch {
522
+ return undefined;
523
+ }
524
+ }
525
+ resolveDomainForRead(id, connectionId, domain) {
526
+ if (!isGitSelfManagedHostIntegrationId(id))
527
+ return undefined;
528
+ return ((connectionId != null ? this.getConfiguredConnectionDomain(id, connectionId) : undefined) ??
529
+ hostFromDomain(domain) ??
530
+ // With no explicit target, pin the primary configured host rather than leaving the domain undefined:
531
+ // `get(id, undefined)` falls back to `findCachedById`, which returns the FIRST entry by Map insertion
532
+ // order. With two hosts of the same provider that makes the instance depend on which host happened to
533
+ // be constructed first, so orgs/repos could come from one host and PRs from another in the same UI.
534
+ this.primaryConfiguredDomain(id));
535
+ }
536
+ /** The primary configured host for a self-managed provider (first configured when none is flagged primary). */
537
+ primaryConfiguredDomain(id) {
538
+ const configured = this.getConfigured(id);
539
+ return (configured.find(c => c.primary) ?? configured[0])?.domain;
540
+ }
541
+ /**
542
+ * Forces a real session refresh before a read when `forceSync` is set, so the read consumes a freshly
543
+ * exchanged token rather than a possibly-stale cached one. Both paths refresh, by different mechanisms: a
544
+ * per-connection (`connectionId`) read syncs that specific connection's session directly through the auth
545
+ * provider (the integration's primary-only sync path would never reach a secondary account), while a
546
+ * primary read syncs via the integration's own cloud-connection machinery.
547
+ * Best-effort — a failed sync is swallowed so the read still proceeds (and surfaces its own warning).
548
+ */
549
+ async forceRefreshIfRequested(integration, forceSync, connectionId) {
550
+ if (forceSync !== true)
551
+ return;
552
+ try {
553
+ if (connectionId != null) {
554
+ // Refresh the specific connection's session directly; the primary-only sync path below would not
555
+ // reach a secondary account. `cloud: true` is required for multi-account backend connections.
556
+ const authProvider = await this.authenticationService.get(integration.authProvider.id);
557
+ const descriptor = { ...integration.authProviderDescriptor, connectionId: connectionId, cloud: true };
558
+ await authProvider?.deleteSession(descriptor);
559
+ await authProvider?.getSession(descriptor, { sync: true });
560
+ }
561
+ else {
562
+ await integration.syncCloudConnection('connected', true);
563
+ }
564
+ }
565
+ catch { }
566
+ }
567
+ /**
568
+ * Lists the orgs/workspaces/groups (and issue-tracker resources) visible to the user, unified into
569
+ * {@link ProviderOrganization}. Scoped to `providerId` when given, otherwise fanned out over every
570
+ * supported provider. `connectionId` only makes sense with a single `providerId`.
571
+ */
572
+ async listOrgs(options) {
573
+ return listOrgs(this, options);
574
+ }
575
+ /**
576
+ * Lists the projects visible to the user, unified into the {@link ProviderOrganization}
577
+ * `{ providerId, id, name, org?, url }` shape. Covers issue-tracker providers (Jira/Linear, which expose
578
+ * projects under their resources) *and* git hosts that have a project tier (Azure DevOps, whose repos are
579
+ * org + project scoped). Scoped to `providerId` when given, else fanned out over both the supported issue
580
+ * trackers and Azure DevOps. Providers with no project tier (GitHub, GitLab, Bitbucket) contribute nothing.
581
+ */
582
+ async listProjects(options) {
583
+ return listProjects(this, options);
584
+ }
585
+ /**
586
+ * Lists repositories under an org for a git-host provider, one page at a time. Pass `page` (1-based)
587
+ * to advance; the returned `cursor` is only meaningful for cursor-only hosts.
588
+ */
589
+ async listRepos(options) {
590
+ return listRepos(this, options);
591
+ }
592
+ /**
593
+ * Reads one page of the user's pull requests for the given git-host provider. With `repos`, reads those
594
+ * repos' PRs (translating `page` ↔ the provider's opaque cursor) and maps the raw provider PRs to
595
+ * {@link PullRequestShape}. With no `repos`, reads the current user's PRs account-wide — the
596
+ * repo-scoped core rejects an empty `repos` input for GitHub/Bitbucket/Azure, so route to the
597
+ * account-wide `searchMyPullRequests` core instead (which is already user-scoped and returns shapes).
598
+ */
599
+ async listPullRequestsPage(options) {
600
+ return listPullRequestsPage(this, options);
601
+ }
602
+ async listIssuesPage(options) {
603
+ return listIssuesPage(this, options);
604
+ }
605
+ /**
606
+ * Reads the user's issues from an issue-tracker provider (Jira/Linear/Trello), whose issues live under
607
+ * resource → project (not repos), so they can't go through {@link listIssuesPage} (git-host, repo-scoped).
608
+ * Returns the normalized {@link IssueShape} these providers produce, aggregated across the projects of the
609
+ * given `org` (or every visible resource/project when omitted). `includeAllAssignees` drops the
610
+ * "assigned to me" scoping so unassigned issues are included. Best-effort: a per-step failure becomes a
611
+ * warning without failing the whole read.
612
+ *
613
+ * Paginated by project: these providers have no single cross-project issue cursor, so a page is a bounded
614
+ * window of projects (each drained by its own read). Pagination is opt-in — a caller that supplies none of
615
+ * `page`/`cursor`/`itemsPerPage` reads every matched project in one page (`hasMore: false`), preserving the
616
+ * "aggregate everything" contract for callers that don't page. When any of those is supplied, the read is
617
+ * windowed to `itemsPerPage` projects (default 20) advanced 1-based via `page`/`cursor`, with `hasMore`/
618
+ * `cursor` carrying the next window. Note: a project's own read has an internal page backstop (see the
619
+ * per-provider drains); if a single project exceeds it, its extra issues can't be paged from here, but that
620
+ * incompleteness IS surfaced as `page.truncated` (Jira/Linear report the backstop hit) rather than passed
621
+ * off as a complete read.
622
+ *
623
+ * Takes no `domain`, unlike the git-host reads: every issue-tracker provider is cloud-only
624
+ * ({@link IssuesCloudHostIntegrationId}), so there is no self-managed host to address.
625
+ */
626
+ async listIssueTrackerIssuesPage(options) {
627
+ return listIssueTrackerIssuesPage(this, options);
628
+ }
629
+ /**
630
+ * Sweeps the user's pull requests across providers by draining every page (an "all-pages" read),
631
+ * returning the neutral sweep result with per-provider warnings. `truncated` is set when a provider
632
+ * hit `maxPages` with more still available; `fetchFailed` when a drain aborted on a read error.
633
+ * `targets` selects a connection/domain independently for each provider. The legacy `connectionId` is
634
+ * honored only when `providerIds` resolves to a single provider (otherwise ambiguous).
635
+ */
636
+ async sweepPullRequests(options) {
637
+ const { targets, attributeUnavailableProviders } = resolvePullRequestSweepTargets(options);
638
+ const maxPages = options?.maxPages ?? 100;
639
+ const repos = options?.repos ?? [];
640
+ const results = await mapBounded(targets, providerFanOutConcurrency, async (target) => {
641
+ const { providerId: id, connectionId, domain: requestedDomain } = target;
642
+ if (isIssuesHostIntegrationId(id)) {
643
+ return {
644
+ items: [],
645
+ warnings: [gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')],
646
+ fetchFailed: true,
647
+ truncated: false,
648
+ providerId: id,
649
+ failedProvider: true,
650
+ };
651
+ }
652
+ const integration = await this.getIntegrationForRead(id, connectionId, requestedDomain);
653
+ if (integration == null) {
654
+ // A requested connection that can't be resolved is a broken connection — surface it as a
655
+ // warning + fetchFailed rather than dropping the provider's slice silently.
656
+ const early = this.earlyReturnConnectionWarnings(id, connectionId, requestedDomain);
657
+ if (early.warnings.length === 0 && !attributeUnavailableProviders)
658
+ return undefined;
659
+ return {
660
+ items: [],
661
+ warnings: early.warnings.length !== 0
662
+ ? early.warnings
663
+ : [noConnectionWarning(id, requestedDomain, connectionId)],
664
+ fetchFailed: true,
665
+ truncated: false,
666
+ providerId: id,
667
+ failedProvider: true,
668
+ };
669
+ }
670
+ if (!isGitHostIntegration(integration)) {
671
+ return {
672
+ items: [],
673
+ warnings: [gitHostOnlySurfaceWarning(id, requestedDomain, connectionId, 'pull request sweeps')],
674
+ fetchFailed: true,
675
+ truncated: false,
676
+ providerId: id,
677
+ failedProvider: true,
678
+ };
679
+ }
680
+ await this.forceRefreshIfRequested(integration, options?.forceSync, connectionId);
681
+ const domain = this.domainForRead(integration, id, connectionId, requestedDomain);
682
+ const accountWide = repos.length === 0;
683
+ const requestedFilters = target.filters ?? options?.filters;
684
+ const resolved = accountWide
685
+ ? resolveAccountWidePullRequestFilters(id, requestedFilters)
686
+ : resolvePullRequestFilters(id, requestedFilters);
687
+ if (resolved.unsupported) {
688
+ return {
689
+ items: [],
690
+ warnings: [
691
+ accountWide
692
+ ? unsupportedAccountWidePullRequestFiltersWarning(id, domain, connectionId, requestedFilters ?? [])
693
+ : unsupportedFiltersWarning(id, domain, connectionId),
694
+ ],
695
+ fetchFailed: true,
696
+ truncated: false,
697
+ providerId: id,
698
+ failedProvider: true,
699
+ };
700
+ }
701
+ const drain = await drainPullRequests(integration, id, domain, repos, options?.states, resolved.filters, accountWide ? (options?.includeReviewRequested ?? false) : false, connectionId, maxPages, attributeUnavailableProviders);
702
+ const currentAccountId = drain.items.some(pr => pr.author != null)
703
+ ? await getCurrentAccountId(integration, connectionId)
704
+ : undefined;
705
+ // Normalize the raw provider-apis PRs to the GitLens-owned shape here, where the per-provider
706
+ // `integration` (the mapper's provider reference) is in scope; the aggregation below only sees drains.
707
+ return {
708
+ ...drain,
709
+ items: drain.items.map(pr => fromProviderPullRequest(pr, integration, { currentAccountId: currentAccountId })),
710
+ providerId: id,
711
+ };
712
+ });
713
+ const items = [];
714
+ const warnings = [];
715
+ const failedProviderIds = new Set();
716
+ const incompleteProviderIds = new Set();
717
+ let fetchFailed = false;
718
+ let truncated = false;
719
+ for (const drain of results) {
720
+ if (drain == null) {
721
+ continue;
722
+ }
723
+ items.push(...drain.items);
724
+ for (const w of drain.warnings) {
725
+ appendDedupedWarning(warnings, w);
726
+ }
727
+ if (drain.fetchFailed) {
728
+ fetchFailed = true;
729
+ }
730
+ if (drain.failedProvider) {
731
+ failedProviderIds.add(drain.providerId);
732
+ }
733
+ else if (drain.fetchFailed || drain.truncated) {
734
+ incompleteProviderIds.add(drain.providerId);
735
+ }
736
+ if (drain.truncated) {
737
+ truncated = true;
738
+ }
739
+ }
740
+ return {
741
+ items: items,
742
+ warnings: warnings,
743
+ // `allPages` asserts completeness — it must be false when any provider truncated (a single-page
744
+ // account-wide read that couldn't confirm it drained everything) OR a drain aborted on a read
745
+ // failure (its slice is incomplete). Either way the sweep did not read every page.
746
+ page: {
747
+ currentPage: 1,
748
+ itemsPerPage: items.length,
749
+ allPages: !truncated && !fetchFailed,
750
+ truncated: truncated || undefined,
751
+ },
752
+ // A sweep drains every page itself and exposes no cursor to resume — so `hasMore` must be false even
753
+ // when the read was incomplete. Terminal incompleteness is expressed through `page.truncated` +
754
+ // `allPages: false` + warnings; setting `hasMore: true` here would make a consumer that drains while
755
+ // `hasMore` re-run the identical sweep forever with no cursor to advance.
756
+ hasMore: false,
757
+ fetchFailed: fetchFailed || undefined,
758
+ failedProviderIds: [...failedProviderIds],
759
+ incompleteProviderIds: [...incompleteProviderIds],
760
+ };
761
+ }
762
+ /**
763
+ * Closed/merged counterpart of {@link sweepPullRequests}, feeding Kepler's Kanban "done" column. Applies
764
+ * the native cross-provider state filter (`Closed` + `Merged`) so it works beyond GitHub.
765
+ */
766
+ async sweepClosedPullRequests(options) {
767
+ return this.sweepPullRequests({
768
+ ...options,
769
+ states: ['closed', 'merged'],
770
+ });
771
+ }
772
+ /**
773
+ * Broadens the user's issues by fanning out over the supplied orgs: for each org it lists the org's
774
+ * repositories, then reads that org's issues. A per-org failure becomes a warning without failing the
775
+ * whole fan-out. `broadenedProviderIds` lists the distinct providers whose issue read resolved (even
776
+ * if every issue duplicated a baseline). `failedProviderIds` identifies providers with no usable org;
777
+ * `incompleteProviderIds` identifies providers with both a usable org and a failed/truncated sibling.
778
+ * `fanOutCount` is the number of org work items spawned.
779
+ * Each org may carry its own `connectionId` (and, for a self-managed host with no configured connection, its
780
+ * own `domain`) to target a specific account — the fan-out spans providers, so the target is scoped per org
781
+ * rather than globally.
782
+ */
783
+ async broadenIssues(options) {
784
+ const page = Math.max(1, Math.trunc(options.page ?? 1));
785
+ // Kepler's existing contract persists only a page number. When no opaque continuation was supplied,
786
+ // advance through prior pages internally so cursor-only providers still return the requested page.
787
+ // Each recursive call below carries a cursor, so it bypasses this block and performs exactly one round.
788
+ if (options.cursor == null && page > 1) {
789
+ let cursor;
790
+ let previous;
791
+ const traversalWarnings = [];
792
+ const broadenedProviderIds = new Set();
793
+ const failedProviderIds = new Set();
794
+ const incompleteProviderIds = new Set();
795
+ const mergeProviderAttribution = (result) => {
796
+ for (const providerId of result.failedProviderIds) {
797
+ if (broadenedProviderIds.has(providerId) || result.broadenedProviderIds.includes(providerId)) {
798
+ incompleteProviderIds.add(providerId);
799
+ }
800
+ else {
801
+ failedProviderIds.add(providerId);
802
+ }
803
+ }
804
+ for (const providerId of result.incompleteProviderIds) {
805
+ failedProviderIds.delete(providerId);
806
+ incompleteProviderIds.add(providerId);
807
+ }
808
+ for (const providerId of result.broadenedProviderIds) {
809
+ broadenedProviderIds.add(providerId);
810
+ if (failedProviderIds.delete(providerId)) {
811
+ incompleteProviderIds.add(providerId);
812
+ }
813
+ }
814
+ };
815
+ let traversalFetchFailed = false;
816
+ let traversalTruncated = false;
817
+ for (let currentPage = 1; currentPage < page; currentPage++) {
818
+ previous = await this.broadenIssues({
819
+ ...options,
820
+ page: currentPage,
821
+ cursor: cursor,
822
+ // A forced refresh belongs to the logical read, not every cursor-advancement round.
823
+ forceSync: currentPage === 1 ? options.forceSync : false,
824
+ });
825
+ for (const warning of previous.warnings) {
826
+ appendDedupedWarning(traversalWarnings, warning);
827
+ }
828
+ mergeProviderAttribution(previous);
829
+ traversalFetchFailed ||= previous.fetchFailed === true;
830
+ traversalTruncated ||= previous.page.truncated === true;
831
+ if (!previous.hasMore || previous.cursor == null) {
832
+ return {
833
+ items: [],
834
+ warnings: traversalWarnings,
835
+ page: {
836
+ currentPage: page,
837
+ itemsPerPage: 0,
838
+ truncated: traversalTruncated || undefined,
839
+ },
840
+ hasMore: false,
841
+ fetchFailed: traversalFetchFailed || undefined,
842
+ broadenedProviderIds: [...broadenedProviderIds],
843
+ failedProviderIds: [...failedProviderIds],
844
+ incompleteProviderIds: [...incompleteProviderIds],
845
+ fanOutCount: options.orgs.length,
846
+ };
847
+ }
848
+ cursor = previous.cursor;
849
+ }
850
+ const requested = await this.broadenIssues({ ...options, page: page, cursor: cursor, forceSync: false });
851
+ for (const warning of requested.warnings) {
852
+ appendDedupedWarning(traversalWarnings, warning);
853
+ }
854
+ mergeProviderAttribution(requested);
855
+ return {
856
+ ...requested,
857
+ warnings: traversalWarnings,
858
+ page: {
859
+ ...requested.page,
860
+ truncated: traversalTruncated || requested.page.truncated === true || undefined,
861
+ },
862
+ fetchFailed: traversalFetchFailed || requested.fetchFailed === true || undefined,
863
+ broadenedProviderIds: [...broadenedProviderIds],
864
+ failedProviderIds: [...failedProviderIds],
865
+ incompleteProviderIds: [...incompleteProviderIds],
866
+ };
867
+ }
868
+ const results = await mapBounded(options.orgs, providerFanOutConcurrency, async (org) => {
869
+ const connectionId = org.connectionId;
870
+ const requestedDomain = org.domain;
871
+ const cursorDomain = hostFromDomain(requestedDomain) ?? requestedDomain;
872
+ // An org slice that yielded no issues and has nothing to continue: the org's identity (which the
873
+ // aggregation below keys the per-org cursor bundle by) plus why it produced nothing. `exhausted` marks
874
+ // an org a prior round already drained, so it stays skipped rather than being re-read from page 1.
875
+ const barrenSlice = (warnings, flags) => ({
876
+ items: [],
877
+ warnings: warnings,
878
+ broadenedProviderIds: [],
879
+ providerId: org.providerId,
880
+ org: org.name,
881
+ connectionId: connectionId,
882
+ domain: cursorDomain,
883
+ nextCursor: undefined,
884
+ hasMore: false,
885
+ exhausted: flags?.exhausted ?? false,
886
+ fetchFailed: flags?.fetchFailed ?? false,
887
+ truncated: flags?.truncated ?? false,
888
+ });
889
+ if (isIssuesHostIntegrationId(org.providerId)) {
890
+ return barrenSlice([gitHostOnlySurfaceWarning(org.providerId, requestedDomain, connectionId, 'issue broadening')], { fetchFailed: true });
891
+ }
892
+ const integration = await this.getIntegrationForRead(org.providerId, connectionId, requestedDomain);
893
+ if (integration == null) {
894
+ // A requested connection or domain that can't be resolved is a broken target — surface it as a
895
+ // warning + fetchFailed rather than dropping the org silently.
896
+ const early = this.earlyReturnConnectionWarnings(org.providerId, connectionId, requestedDomain);
897
+ return barrenSlice(early.warnings.length > 0
898
+ ? early.warnings
899
+ : [noConnectionWarning(org.providerId, requestedDomain, connectionId)], { fetchFailed: true });
900
+ }
901
+ if (!isGitHostIntegration(integration)) {
902
+ return barrenSlice([gitHostOnlySurfaceWarning(org.providerId, requestedDomain, connectionId, 'issue broadening')], { fetchFailed: true });
903
+ }
904
+ // A git host whose issue tracker is deprecated (Bitbucket) exposes no issues here — surface a
905
+ // warning + fetchFailed and skip it (no repo drain), so broadening never serves a legacy source.
906
+ if (!integration.supportsIssues) {
907
+ return barrenSlice([
908
+ issuesUnsupportedWarning(org.providerId, this.domainForRead(integration, org.providerId, connectionId, requestedDomain), connectionId),
909
+ ], { fetchFailed: true });
910
+ }
911
+ // An org a prior round already drained must not be re-read: cursor-only providers would answer a
912
+ // fresh page-1 request with their first page again, duplicating issues across rounds. Skip it
913
+ // before any work (including the repo drain) and keep it marked exhausted so it stays skipped
914
+ // for the rest of the fan-out.
915
+ if (isBroadenIssuesOrgExhausted(options.cursor, org, options.orgs.length)) {
916
+ return barrenSlice([], { exhausted: true });
917
+ }
918
+ await this.forceRefreshIfRequested(integration, options.forceSync, connectionId);
919
+ const domain = this.domainForRead(integration, org.providerId, connectionId, requestedDomain);
920
+ const reposDrain = await drainRepositories(integration, org.providerId, domain, org.name, undefined, connectionId, 100);
921
+ const warnings = [...reposDrain.warnings];
922
+ const fetchFailed = reposDrain.fetchFailed;
923
+ const truncated = reposDrain.truncated;
924
+ const repos = reposDrain.repos.map(r => ({ ...r }));
925
+ if (repos.length === 0) {
926
+ return barrenSlice(warnings, { fetchFailed: fetchFailed, truncated: truncated });
927
+ }
928
+ // Broaden = "all visible": drop the assigned-to-me filter so unassigned issues are included.
929
+ const cursor = getBroadenIssuesCursor(options.cursor, org, page, options.orgs.length);
930
+ const issuesCaptured = await runCaptured(org.providerId, domain, connectionId, () =>
931
+ // Normalized shapes seam, uniform with listIssuesPage.
932
+ integration.getMyIssuesForReposAsShapesResult(repos, {
933
+ includeAllAssignees: true,
934
+ cursor: cursor,
935
+ }, connectionId), { warnOnMissingSession: true });
936
+ if (issuesCaptured.warning != null) {
937
+ warnings.push(issuesCaptured.warning);
938
+ }
939
+ const issuesAssessment = mergeAssessmentInto(warnings, org.providerId, domain, connectionId, issuesCaptured.value?.metadata);
940
+ let issuesFetchFailed = issuesAssessment.fetchFailed || (issuesCaptured.warning != null && issuesCaptured.value == null);
941
+ const items = [];
942
+ let hasMore = false;
943
+ let nextCursor;
944
+ let retryPage;
945
+ // Carry a truncation signal from the issue read too: a provider that couldn't confirm it drained
946
+ // a repo (`paging.truncated`) means this org's issues may be incomplete, on top of any repo-drain
947
+ // truncation already captured above.
948
+ let issuesTruncated = false;
949
+ if (issuesCaptured.value != null) {
950
+ items.push(...issuesCaptured.value.values);
951
+ const paged = toProviderPageInfo(issuesCaptured.value.values.length, issuesCaptured.value.paging);
952
+ // An org that reports another page but no usable cursor can't be resumed: it would neither be
953
+ // recorded in the composite cursor nor marked exhausted, so the next round would re-read its
954
+ // page 1 and repeat every issue. Treat it as terminal-but-incomplete (which also marks the org
955
+ // exhausted below, since `exhausted` keys off `!hasMore`).
956
+ const continuation = resolveContinuation(paged, undefined);
957
+ hasMore = continuation.hasMore;
958
+ nextCursor = continuation.cursor;
959
+ issuesTruncated = continuation.truncated || issuesAssessment.truncated;
960
+ }
961
+ else if (issuesCaptured.warning != null || cursor != null) {
962
+ // Keep the exact position that failed. Without this retry cursor a multi-org continuation would
963
+ // omit this org from the bundle, then synthesize the next numbered page and silently skip the
964
+ // failed page. The synthesized page cursor is also actionable for a first-page cursor-only read:
965
+ // that provider ignores the page marker and retries its first page. A retry slot alone is NOT
966
+ // forward progress, though: advertising `hasMore` for a persistent failure would make an infinite
967
+ // query request it forever. Healthy sibling continuations set `hasMore` independently.
968
+ if (cursor != null) {
969
+ nextCursor = cursor;
970
+ if (issuesCaptured.warning == null) {
971
+ appendDedupedWarning(warnings, otherWarning(org.providerId, domain, connectionId, 'Issue continuation returned no result and must be retried'));
972
+ issuesFetchFailed = true;
973
+ issuesTruncated = true;
974
+ }
975
+ }
976
+ else {
977
+ retryPage = page;
978
+ }
979
+ }
980
+ return {
981
+ items: items,
982
+ warnings: warnings,
983
+ broadenedProviderIds: issuesCaptured.value != null ? [org.providerId] : [],
984
+ providerId: org.providerId,
985
+ org: org.name,
986
+ connectionId: connectionId,
987
+ domain: cursorDomain,
988
+ nextCursor: nextCursor,
989
+ retryPage: retryPage,
990
+ hasMore: hasMore,
991
+ // Exhausted once a successful read reports no more pages — recorded in the cursor so later
992
+ // rounds skip it while other orgs keep paging.
993
+ exhausted: issuesCaptured.value != null && !hasMore,
994
+ fetchFailed: fetchFailed || issuesFetchFailed,
995
+ truncated: truncated || issuesTruncated,
996
+ };
997
+ });
998
+ const items = [];
999
+ const warnings = [];
1000
+ const broadenedProviderIds = new Set();
1001
+ const problemProviderIds = new Set();
1002
+ const cursors = [];
1003
+ const exhausted = [];
1004
+ let hasMore = false;
1005
+ let fetchFailed = false;
1006
+ let truncated = false;
1007
+ for (const result of results) {
1008
+ if (result == null) {
1009
+ continue;
1010
+ }
1011
+ items.push(...result.items);
1012
+ warnings.push(...result.warnings);
1013
+ for (const id of result.broadenedProviderIds) {
1014
+ broadenedProviderIds.add(id);
1015
+ }
1016
+ const retryPage = 'retryPage' in result ? result.retryPage : undefined;
1017
+ if (result.nextCursor != null || retryPage != null) {
1018
+ cursors.push({
1019
+ providerId: result.providerId,
1020
+ org: result.org,
1021
+ connectionId: result.connectionId,
1022
+ domain: result.domain,
1023
+ cursor: result.nextCursor,
1024
+ retryPage: retryPage,
1025
+ });
1026
+ }
1027
+ if (result.exhausted) {
1028
+ exhausted.push({
1029
+ providerId: result.providerId,
1030
+ org: result.org,
1031
+ connectionId: result.connectionId,
1032
+ domain: result.domain,
1033
+ });
1034
+ }
1035
+ if (result.hasMore) {
1036
+ hasMore = true;
1037
+ }
1038
+ if (result.fetchFailed) {
1039
+ fetchFailed = true;
1040
+ }
1041
+ if (result.truncated) {
1042
+ truncated = true;
1043
+ }
1044
+ if (result.fetchFailed || result.truncated) {
1045
+ problemProviderIds.add(result.providerId);
1046
+ }
1047
+ }
1048
+ const cursor = toBroadenIssuesCursor(cursors, exhausted, options.orgs.length);
1049
+ const failedProviderIds = [];
1050
+ const incompleteProviderIds = [];
1051
+ for (const providerId of problemProviderIds) {
1052
+ if (broadenedProviderIds.has(providerId)) {
1053
+ incompleteProviderIds.push(providerId);
1054
+ }
1055
+ else {
1056
+ failedProviderIds.push(providerId);
1057
+ }
1058
+ }
1059
+ return {
1060
+ items: items,
1061
+ warnings: warnings,
1062
+ // `currentPage` is positional, per ProviderPageInfo.currentPage: this fan-out has no provider-reported
1063
+ // page of its own (its cursor is a per-org bundle, not a page), so the position is the one the caller
1064
+ // addressed — the `page` it supplied, or the page the internal traversal advanced to.
1065
+ page: { currentPage: page, itemsPerPage: items.length, truncated: truncated || undefined },
1066
+ // `hasMore` promises a resumable continuation, so it must be true ONLY when a real cursor was
1067
+ // produced. Repo-drain truncation (a backstop hit with no persisted repo cursor) can't be resumed —
1068
+ // re-invoking would re-drain the same repos and repeat issues — so it is surfaced as the terminal
1069
+ // `page.truncated` incompleteness signal instead of `hasMore`, matching listRepos. Guard `hasMore`
1070
+ // against a missing cursor so we never advertise a continuation the caller can't make.
1071
+ hasMore: hasMore && cursor != null,
1072
+ cursor: cursor,
1073
+ fetchFailed: fetchFailed || undefined,
1074
+ broadenedProviderIds: [...broadenedProviderIds],
1075
+ failedProviderIds: failedProviderIds,
1076
+ incompleteProviderIds: incompleteProviderIds,
1077
+ fanOutCount: options.orgs.length,
1078
+ };
1079
+ }
1080
+ /**
1081
+ * Resolves a repository from a remote URL to its provider identity, using core-gitlens' remote matcher
1082
+ * plus the provider's `getRepo` (the equivalent of `gk repo resolve`). Supports every provider whose
1083
+ * client exposes `getRepo`. Per-request outcomes preserve the distinctions consumers need for their
1084
+ * canonicalization policy.
1085
+ */
1086
+ async resolveRepository(options) {
1087
+ const result = (status) => ({
1088
+ resolution: { status: status },
1089
+ });
1090
+ const [scheme, parsedDomain, path] = parseGitRemoteUrl(options.remoteUrl);
1091
+ const parsedHost = hostFromDomain(parsedDomain);
1092
+ const explicitHost = hostFromDomain(options.host);
1093
+ if (parsedHost != null && explicitHost != null && parsedHost !== explicitHost) {
1094
+ return result('host-mismatch');
1095
+ }
1096
+ const matcherDomain = parsedDomain || options.host || '';
1097
+ // An explicit cloud provider must agree with the remote's canonical cloud host. Without this guard the
1098
+ // synthetic matcher below can reinterpret, for example, a gitlab.com URL as GitHub and then resolve a
1099
+ // homonymous owner/repo through the wrong account. Match once without caller configs/synthetic entries;
1100
+ // Azure's matcher also normalizes ssh.dev.azure.com and vs-ssh.visualstudio.com to their web host.
1101
+ if (options.providerId != null && isGitCloudHostIntegrationId(options.providerId)) {
1102
+ const nativeProvider = createRemoteProviderMatcher([])(options.remoteUrl, matcherDomain, path, scheme);
1103
+ const nativeId = nativeProvider != null ? getIntegrationIdForRemote(nativeProvider) : undefined;
1104
+ const nativeDomain = nativeProvider?.domain ?? matcherDomain;
1105
+ const canonicalHost = options.providerId === GitCloudHostIntegrationId.GitHub
1106
+ ? isGitHubDotCom(nativeDomain)
1107
+ : options.providerId === GitCloudHostIntegrationId.GitLab
1108
+ ? isGitLabDotCom(nativeDomain)
1109
+ : options.providerId === GitCloudHostIntegrationId.Bitbucket
1110
+ ? isBitbucketCloudDomain(nativeDomain)
1111
+ : isAzureCloudDomain(nativeDomain);
1112
+ if (nativeId !== options.providerId || !canonicalHost)
1113
+ return result('host-mismatch');
1114
+ }
1115
+ // Matcher configs: host remote configs (self-managed/custom domains) plus a synthetic entry for an
1116
+ // explicit providerId + host, so a custom domain still maps to the right provider for path parsing.
1117
+ const configs = [];
1118
+ for (const cfg of this.ctx.config.getRemoteConfigs()) {
1119
+ const type = remoteProviderTypeForConfig(cfg.type);
1120
+ if (type == null)
1121
+ continue;
1122
+ // Forward both domain- and regex-based custom remotes (carrying any protocol override), so a
1123
+ // regex-configured host resolves instead of falling through to `unsupported`.
1124
+ if (cfg.domain) {
1125
+ configs.push({ type: type, domain: cfg.domain, protocol: cfg.protocol });
1126
+ }
1127
+ else if (cfg.regex) {
1128
+ configs.push({ type: type, regex: cfg.regex, protocol: cfg.protocol });
1129
+ }
1130
+ }
1131
+ if (options.providerId != null) {
1132
+ const type = remoteProviderTypeForIntegration(options.providerId);
1133
+ const domain = parsedDomain || options.host;
1134
+ if (type != null && domain) {
1135
+ // The synthetic exact-domain entry is unshifted to the front, so it wins the match over the
1136
+ // user's own config for the same host. Carry that config's protocol override across (matched by
1137
+ // domain or regex, mirroring `ignoreSSLErrors`) so a self-managed host configured for a custom
1138
+ // protocol — e.g. plain `http` — isn't silently downgraded to the provider default here.
1139
+ const lowerDomain = domain.toLowerCase();
1140
+ const protocol = configs.find(c => {
1141
+ if (c.type !== type)
1142
+ return false;
1143
+ if (c.domain != null)
1144
+ return c.domain.toLowerCase() === lowerDomain;
1145
+ // Truthy (not just non-null): an empty regex would compile to a match-everything pattern.
1146
+ if (c.regex) {
1147
+ try {
1148
+ return new RegExp(c.regex, 'i').test(lowerDomain);
1149
+ }
1150
+ catch {
1151
+ return false;
1152
+ }
1153
+ }
1154
+ return false;
1155
+ })?.protocol;
1156
+ configs.unshift({ type: type, domain: domain, protocol: protocol });
1157
+ }
1158
+ }
1159
+ const provider = createRemoteProviderMatcher(configs)(options.remoteUrl, matcherDomain, path, scheme);
1160
+ if (provider == null)
1161
+ return result('invalid-remote-url');
1162
+ let id = options.providerId ?? getIntegrationIdForRemote(provider);
1163
+ // Custom Azure DevOps Server domains matched via getRemoteConfigs return undefined from
1164
+ // getIntegrationIdForRemote because the provider is marked custom; map them to the server id so the
1165
+ // project-scoped lookup uses that host's configured connection and API base URL.
1166
+ if (id == null && provider.id === 'azure-devops' && provider.custom) {
1167
+ id = GitSelfManagedHostIntegrationId.AzureDevOpsServer;
1168
+ }
1169
+ if (id == null)
1170
+ return result('unsupported-provider');
1171
+ const owner = provider.owner;
1172
+ const name = provider.repoName;
1173
+ if (owner == null || name == null)
1174
+ return result('invalid-remote-url');
1175
+ // On a self-managed host, resolve only against a TRUSTED host: the pinned connection's configured
1176
+ // domain, the explicit `domain`, or — when neither was supplied — a configured host matching the
1177
+ // remote's. That last case keeps `remoteUrl` (repository-supplied) out of the trusted path: it selects
1178
+ // among hosts the user already authenticated and can never introduce a new one. Resolving `owner/repo`
1179
+ // against some other host's account would, if that host has the same owner/repo, return a confidently
1180
+ // wrong identity — and would seed the domain-keyed integration cache (never evicted before dispose) with
1181
+ // an entry derived from repository data.
1182
+ const urlHost = hostFromDomain(provider.domain);
1183
+ // Normalize BOTH sides before comparing: a stored connection domain is usually a full URL
1184
+ // (`https://git.example.com`) while `urlHost` is already a bare host, so a raw compare would fail on
1185
+ // scheme/trailing-slash alone and wrongly reject a correctly-configured connection.
1186
+ let trustedHost = options.connectionId != null || options.domain != null
1187
+ ? hostFromDomain(this.resolveDomainForRead(id, options.connectionId, options.domain))
1188
+ : undefined;
1189
+ if (isGitSelfManagedHostIntegrationId(id)) {
1190
+ const configuredHosts = this.getConfigured(id).map(c => hostFromDomain(c.domain));
1191
+ if (trustedHost == null && urlHost != null) {
1192
+ trustedHost = configuredHosts.find(host => host === urlHost);
1193
+ }
1194
+ // A configured host that doesn't match the remote's is a genuine mismatch. With nothing configured
1195
+ // there is no host to mismatch against — it's simply not connected, so fall through to the
1196
+ // `unauthorized` path below (still WITHOUT resolving by the URL domain, so repo data can't seed the
1197
+ // cache).
1198
+ if (trustedHost == null && configuredHosts.length !== 0)
1199
+ return result('host-mismatch');
1200
+ if (trustedHost != null && urlHost != null && trustedHost !== urlHost)
1201
+ return result('host-mismatch');
1202
+ }
1203
+ let integration;
1204
+ try {
1205
+ // Resolve the instance through the trusted target (as `getIntegrationForRead` does):
1206
+ // `resolveReadSession` looks the session up against the instance's domain-scoped descriptor, so
1207
+ // selecting the instance by the URL domain could miss the session and degrade to `no-connection`.
1208
+ integration = isGitSelfManagedHostIntegrationId(id)
1209
+ ? trustedHost != null
1210
+ ? await this.getIntegrationForRead(id, options.connectionId, trustedHost)
1211
+ : undefined
1212
+ : await this.get(id, provider.domain);
1213
+ }
1214
+ catch {
1215
+ integration = undefined;
1216
+ }
1217
+ if (integration == null) {
1218
+ // Attach a warning, as the thrown-AuthenticationError branch below does: a consumer driving auth
1219
+ // recovery off `warning.kind` would otherwise get nothing for an unresolvable target.
1220
+ return {
1221
+ resolution: {
1222
+ status: 'unauthorized',
1223
+ warning: noConnectionWarning(id, provider.domain, options.connectionId),
1224
+ },
1225
+ };
1226
+ }
1227
+ // Issue trackers have no `getRepo` client; a git host without `getRepoFn` leaves `getRepoInfo`
1228
+ // undefined. Either way this provider can't resolve repositories.
1229
+ if (isIssuesIntegration(integration) || integration.getRepoInfo == null) {
1230
+ return result('unsupported-provider');
1231
+ }
1232
+ // Azure repos are org + project scoped; the remote provider exposes project as `providerDesc.repoDomain`.
1233
+ const project = provider.id === 'azure-devops' ? provider.providerDesc?.repoDomain : undefined;
1234
+ const domain = provider.domain;
1235
+ // Azure's lookup is project-scoped and returns `undefined` without one, which the connection-gap branch
1236
+ // below would misreport as `unauthorized` (driving a pointless reconnect). A remote URL that carries no
1237
+ // project simply can't address an Azure repo.
1238
+ if (provider.id === 'azure-devops' && project == null)
1239
+ return result('invalid-remote-url');
1240
+ try {
1241
+ const repo = await integration.getRepoInfo({
1242
+ owner: owner,
1243
+ name: name,
1244
+ project: project,
1245
+ connectionId: options.connectionId,
1246
+ });
1247
+ if (repo == null) {
1248
+ // `getRepoInfo` returns undefined only when no session could be resolved (not connected, or the
1249
+ // requested connection is gone) — a real 404 throws below. So this is a connection gap. Attach a
1250
+ // warning so a consumer driving auth recovery off `warning.kind` sees the same signal it gets from
1251
+ // the thrown-AuthenticationError branch below; without it, the most common unauthorized case is
1252
+ // silent.
1253
+ return {
1254
+ resolution: {
1255
+ status: 'unauthorized',
1256
+ warning: noConnectionWarning(id, domain, options.connectionId),
1257
+ },
1258
+ };
1259
+ }
1260
+ // Prefer the provider's canonical namespace/name (GitHub's REST/GraphQL lookup follows the 301
1261
+ // rename redirect, so a stale old name resolves to the new canonical identity), falling back to the
1262
+ // parsed remote when the response omits them. `renamed` is a case-insensitive compare of input vs
1263
+ // canonical, mirroring gkcli's `EqualFold`, so hosts that merely echo the input casing (e.g.
1264
+ // Bitbucket Server/Azure) don't get spuriously flagged.
1265
+ const canonicalOwner = repo.namespace || owner;
1266
+ const canonicalName = repo.name || name;
1267
+ const renamed = canonicalOwner.toLowerCase() !== owner.toLowerCase() ||
1268
+ canonicalName.toLowerCase() !== name.toLowerCase();
1269
+ const identity = {
1270
+ providerId: id,
1271
+ domain: domain,
1272
+ owner: canonicalOwner,
1273
+ name: canonicalName,
1274
+ project: project,
1275
+ remoteUrl: options.remoteUrl,
1276
+ renamed: renamed,
1277
+ };
1278
+ return { resolution: { status: 'resolved', identity: identity } };
1279
+ }
1280
+ catch (ex) {
1281
+ // Order matters: 404 throws RequestNotFoundError (not `undefined`), so check not-found before auth
1282
+ // and before the generic 5xx/unknown bucket — never classify a 401/403 as not-found.
1283
+ let resolution;
1284
+ if (ex instanceof RequestNotFoundError) {
1285
+ resolution = { status: 'not-found' };
1286
+ }
1287
+ else if (ex instanceof AuthenticationError) {
1288
+ resolution = {
1289
+ status: 'unauthorized',
1290
+ warning: toProviderWarning(id, domain, options.connectionId, ex),
1291
+ };
1292
+ }
1293
+ else {
1294
+ resolution = {
1295
+ status: 'undetermined',
1296
+ warning: toProviderWarning(id, domain, options.connectionId, ex),
1297
+ };
1298
+ }
1299
+ return { resolution: resolution };
1300
+ }
1301
+ }
1302
+ // #endregion ProviderBackend surface (#5438)
421
1303
  _ignoreSSLErrors = new Map();
422
1304
  ignoreSSLErrors(integration) {
423
1305
  if (this.ctx.http.isWeb)
424
1306
  return false;
425
- let ignoreSSLErrors = this._ignoreSSLErrors.get(integration.id);
1307
+ // Key by id + domain: the config lookup is domain-scoped, so a value computed for one self-managed
1308
+ // domain must not be reused for another domain of the same provider.
1309
+ const cacheKey = `${integration.id}:${integration.domain ?? ''}`;
1310
+ let ignoreSSLErrors = this._ignoreSSLErrors.get(cacheKey);
426
1311
  if (ignoreSSLErrors === undefined) {
427
- const cfg = this.ctx.config
428
- .getRemoteConfigs()
429
- .find(remote => remote.type.toLowerCase() === integration.id && remote.domain === integration.domain);
1312
+ // Normalize both sides to a RemoteProviderId before comparing: a lowercased config type
1313
+ // (e.g. `AzureDevOps` → `azuredevops`, `BitbucketServer` → `bitbucketserver`) does not equal the
1314
+ // integration id (`azureDevOps`, `bitbucket-server`), so a plain `toLowerCase()` compare misses them.
1315
+ const integrationRemoteType = remoteProviderTypeForIntegration(integration.id);
1316
+ const cfg = this.ctx.config.getRemoteConfigs().find(remote => {
1317
+ if (integration.domain == null || integrationRemoteType == null)
1318
+ return false;
1319
+ if (remoteProviderTypeForConfig(remote.type) !== integrationRemoteType)
1320
+ return false;
1321
+ // Match domain- and regex-based remotes alike, so `ignoreSSLErrors` applies to a regex-configured
1322
+ // self-managed host too (mirrors the matcher's own regex handling).
1323
+ if (remote.domain != null)
1324
+ return remote.domain === integration.domain;
1325
+ // Truthy (not just non-null): an empty regex would compile to a match-everything pattern.
1326
+ if (remote.regex) {
1327
+ try {
1328
+ return new RegExp(remote.regex, 'i').test(integration.domain);
1329
+ }
1330
+ catch {
1331
+ return false;
1332
+ }
1333
+ }
1334
+ return false;
1335
+ });
430
1336
  ignoreSSLErrors = cfg?.ignoreSSLErrors ?? false;
431
- this._ignoreSSLErrors.set(integration.id, ignoreSSLErrors);
1337
+ this._ignoreSSLErrors.set(cacheKey, ignoreSSLErrors);
432
1338
  }
433
1339
  return ignoreSSLErrors;
434
1340
  }
@@ -511,7 +1417,16 @@ export class IntegrationService {
511
1417
  async function load() {
512
1418
  return new (await import(/* webpackChunkName: "integrations" */ './providers/providersApi.js')).ProvidersApi(authenticationService);
513
1419
  }
514
- this._providersApi = load();
1420
+ // Never keep a rejected promise cached: a single failure (a module-resolution error, a transient
1421
+ // construction failure) would otherwise poison every `ProvidersApi` read for the lifetime of the
1422
+ // service, so consumers get instant empty results with no way to recover short of a restart.
1423
+ const loading = (this._providersApi = load());
1424
+ void loading.catch(() => {
1425
+ // Only clear our own attempt, so a newer load already in flight isn't dropped
1426
+ if (this._providersApi === loading) {
1427
+ this._providersApi = undefined;
1428
+ }
1429
+ });
515
1430
  }
516
1431
  return this._providersApi;
517
1432
  }
@@ -523,23 +1438,48 @@ export class IntegrationService {
523
1438
  }
524
1439
  async *getSupportedCloudIntegrations(domainsById) {
525
1440
  for (const id of getSupportedCloudIntegrationIds()) {
526
- if (isCloudGitSelfManagedHostIntegrationId(id) && !domainsById.has(id)) {
527
- // Try getting whatever we have now because we will need to disconnect
1441
+ if (isCloudGitSelfManagedHostIntegrationId(id)) {
1442
+ const domains = new Set(domainsById.get(id) ?? []);
1443
+ for (const domain of this.configuredIntegrationService
1444
+ .getConfigured(id, { cloud: true })
1445
+ .map(c => c.domain)
1446
+ .filter((domain) => domain != null && domain.length > 0)) {
1447
+ domains.add(hostFromDomain(domain) ?? domain);
1448
+ }
1449
+ if (domains.size !== 0) {
1450
+ for (const domain of domains) {
1451
+ const integration = await this.get(id, domain);
1452
+ if (integration != null) {
1453
+ yield integration;
1454
+ }
1455
+ }
1456
+ continue;
1457
+ }
1458
+ // Try getting whatever we have now because we will need to disconnect.
528
1459
  const integration = await this.get(id, undefined);
529
1460
  if (integration != null) {
530
1461
  yield integration;
531
1462
  }
1463
+ continue;
532
1464
  }
533
- else {
534
- const integration = await this.get(id, domainsById.get(id));
535
- if (integration != null) {
536
- yield integration;
537
- }
1465
+ const integration = await this.get(id);
1466
+ if (integration != null) {
1467
+ yield integration;
538
1468
  }
539
1469
  }
540
1470
  }
1471
+ getCloudConnectionState(integration, connectedIntegrations, domainsById) {
1472
+ if (isCloudGitSelfManagedHostIntegrationId(integration.id)) {
1473
+ const host = hostFromDomain(integration.domain) ?? integration.domain;
1474
+ return domainsById.get(integration.id)?.has(host) ? 'connected' : 'disconnected';
1475
+ }
1476
+ return connectedIntegrations.has(integration.id) ? 'connected' : 'disconnected';
1477
+ }
541
1478
  findCachedById(id) {
542
- const key = this.getCacheKey(id, '');
1479
+ const cached = this._integrations.get(id);
1480
+ if (cached != null)
1481
+ return cached;
1482
+ const key = `${id}:`;
543
1483
  for (const [k, integration] of this._integrations) {
544
1484
  if (k.startsWith(key)) {
545
1485
  return integration;
@@ -547,40 +1487,295 @@ export class IntegrationService {
547
1487
  }
548
1488
  return undefined;
549
1489
  }
1490
+ getCachedForDomain(id, domain) {
1491
+ return isGitSelfManagedHostIntegrationId(id) ? this.getCached(id, domain) : this.findCachedById(id);
1492
+ }
1493
+ getConfiguredCloudConnection(id, connectionId) {
1494
+ const connection = this.configuredIntegrationService
1495
+ .getConfigured(id, { cloud: true })
1496
+ .find(c => c.id === connectionId);
1497
+ if (connection == null) {
1498
+ throw new Error(`Connection '${connectionId}' is not configured for '${id}'`);
1499
+ }
1500
+ return connection;
1501
+ }
1502
+ getConfiguredConnectionDomain(id, connectionId) {
1503
+ if (!isGitSelfManagedHostIntegrationId(id))
1504
+ return undefined;
1505
+ return this.configuredIntegrationService.getConfigured(id).find(c => c.id === connectionId)?.domain;
1506
+ }
1507
+ getCloudPrimaryConnectionIdsByDomain(id) {
1508
+ const primaryByDomain = new Map();
1509
+ const fallbackByDomain = new Map();
1510
+ for (const descriptor of this.configuredIntegrationService.getConfigured(id, { cloud: true })) {
1511
+ const domain = isGitSelfManagedHostIntegrationId(id)
1512
+ ? (hostFromDomain(descriptor.domain) ?? descriptor.domain)
1513
+ : undefined;
1514
+ if (!fallbackByDomain.has(domain)) {
1515
+ fallbackByDomain.set(domain, descriptor.id);
1516
+ }
1517
+ if (descriptor.primary && !primaryByDomain.has(domain)) {
1518
+ primaryByDomain.set(domain, descriptor.id);
1519
+ }
1520
+ }
1521
+ for (const [domain, connectionId] of fallbackByDomain) {
1522
+ if (!primaryByDomain.has(domain)) {
1523
+ primaryByDomain.set(domain, connectionId);
1524
+ }
1525
+ }
1526
+ return primaryByDomain;
1527
+ }
550
1528
  async syncCloudIntegrations(forceConnect) {
551
1529
  const scope = getScopedLogger();
552
1530
  const connectedIntegrations = new Set();
553
1531
  const domainsById = new Map();
1532
+ const connectionsById = new Map();
554
1533
  const loggedIn = (await this.ctx.account.getAccount()) != null;
555
1534
  if (loggedIn) {
556
1535
  const connections = await this.authenticationService.cloudIntegrations.getConnections();
557
1536
  if (connections == null)
558
1537
  return;
559
- connections.map(p => {
1538
+ for (const p of connections) {
560
1539
  const integrationId = toIntegrationId[p.provider];
561
1540
  // GKDev includes some integrations like "google" that we don't support
562
1541
  if (integrationId == null)
563
- return;
564
- connectedIntegrations.add(toIntegrationId[p.provider]);
1542
+ continue;
1543
+ connectedIntegrations.add(integrationId);
1544
+ const list = connectionsById.get(integrationId);
1545
+ if (list != null) {
1546
+ list.push(p);
1547
+ }
1548
+ else {
1549
+ connectionsById.set(integrationId, [p]);
1550
+ }
565
1551
  if (p.domain?.length > 0) {
566
- try {
567
- const host = new URL(p.domain).host;
568
- domainsById.set(integrationId, host);
1552
+ const host = hostFromDomain(p.domain);
1553
+ if (host != null) {
1554
+ let domains = domainsById.get(integrationId);
1555
+ if (domains == null) {
1556
+ domains = new Set();
1557
+ domainsById.set(integrationId, domains);
1558
+ }
1559
+ domains.add(host);
569
1560
  }
570
- catch {
1561
+ else {
571
1562
  scope?.warn(`Invalid domain for ${integrationId} integration: ${p.domain}. Ignoring.`);
572
1563
  }
573
1564
  }
574
- });
1565
+ }
575
1566
  }
576
1567
  for await (const integration of this.getSupportedCloudIntegrations(domainsById)) {
577
- await integration.syncCloudConnection(connectedIntegrations.has(integration.id) ? 'connected' : 'disconnected', forceConnect);
1568
+ await integration.syncCloudConnection(this.getCloudConnectionState(integration, connectedIntegrations, domainsById), forceConnect);
1569
+ }
1570
+ // Persist every account when the backend advertises per-connection identity (multi-account). This
1571
+ // is a strict no-op for backends that return a single, id-less connection per provider.
1572
+ for (const [integrationId, connections] of connectionsById) {
1573
+ await this.reconcileCloudConnections(integrationId, connections, forceConnect);
578
1574
  }
579
1575
  this.ctx.hooks?.connection?.onConnectedChanged?.({
580
1576
  integrationIds: [...connectedIntegrations.values()],
581
1577
  });
582
1578
  return connectedIntegrations;
583
1579
  }
1580
+ /**
1581
+ * Whether the user has locally disconnected this provider/host. Mirrors the integration model's
1582
+ * `connected:${key}` workspace flag (key = id for cloud, `${id}:${domain}` for self-managed), which is
1583
+ * set to `false` on a local disconnect and cleared on (re)connect.
1584
+ */
1585
+ isLocallyDisconnected(id, host) {
1586
+ const key = isGitSelfManagedHostIntegrationId(id) ? `connected:${id}:${host ?? ''}` : `connected:${id}`;
1587
+ return this.ctx.storage.getWorkspace(key) === false;
1588
+ }
1589
+ /**
1590
+ * Reconciles the locally stored connections for a provider with what the backend reports, so that
1591
+ * multiple accounts on the same provider coexist. Only engages when the backend provides
1592
+ * per-connection ids; otherwise the single-connection flow above already handled the primary.
1593
+ */
1594
+ async reconcileCloudConnections(id, connections, forceConnect) {
1595
+ const scope = getScopedLogger();
1596
+ const identified = connections.filter((c) => c.id != null);
1597
+ if (identified.length === 0)
1598
+ return;
1599
+ // Capture the effective primary before any mutation (sync store, prune-driven promotion, or the
1600
+ // backend primary selection below) so we can tell whether it actually changed. The prune step can
1601
+ // promote a secondary to primary via removeConfigured, so sampling this after pruning would miss it.
1602
+ const primaryBefore = this.getCloudPrimaryConnectionIdsByDomain(id);
1603
+ const cloudIntegrations = this.authenticationService.cloudIntegrations;
1604
+ // Fetch + store each connection's session so getConfigured() reflects every account.
1605
+ const syncedIds = new Set();
1606
+ const syncEligibleIds = new Set();
1607
+ const syncedPrimaryIdsByDomain = new Map();
1608
+ // Snapshot existing cloud descriptors by id once, so the per-connection account-name lookup below is
1609
+ // O(1) instead of re-filtering the whole configured list each iteration (O(n²) with multi-account).
1610
+ // Each backend connection id is processed once, so reading the pre-loop snapshot is sufficient.
1611
+ const existingById = new Map(this.configuredIntegrationService.getConfigured(id, { cloud: true }).map(c => [c.id, c]));
1612
+ for (const connection of identified) {
1613
+ // The wire `domain` is usually a full URL, though cloud providers can return a bare host.
1614
+ // Self-managed integrations are keyed/constructed by host.
1615
+ const host = hostFromDomain(connection.domain);
1616
+ // Self-managed connections are keyed by host, so an unparseable/empty domain would store the
1617
+ // session and descriptor under an empty host — producing ambiguous keys (`connected:<id>:`) that
1618
+ // break later resolution and local-disconnect checks. Skip such a connection rather than corrupt
1619
+ // state; cloud providers key off their canonical domain and are unaffected.
1620
+ if (isGitSelfManagedHostIntegrationId(id) && !host) {
1621
+ scope?.warn(`Skipping connection '${connection.id}' for ${id}: unresolved host from domain`);
1622
+ continue;
1623
+ }
1624
+ // Don't resurrect a connection the user disconnected locally: a host "disconnect" only clears
1625
+ // local state (the backend still lists the token), so without this the next non-forced sync would
1626
+ // re-store the secret/config. A forced reconnect clears this flag (in the sync loop above) before
1627
+ // reconcile runs, so it proceeds normally.
1628
+ if (this.isLocallyDisconnected(id, host))
1629
+ continue;
1630
+ syncEligibleIds.add(connection.id);
1631
+ // On a routine (non-forced) check-in, skip the token fetch + secret write for a connection we
1632
+ // already have stored and that hasn't expired: nothing to refresh, so avoid the extra GK API
1633
+ // traffic and secret churn. Still treat it as synced (so it doesn't trip the prune guard) and
1634
+ // record its primary below. Forced syncs, new connections, and expired tokens fall through and
1635
+ // fetch as before.
1636
+ const cached = existingById.get(connection.id);
1637
+ if (!forceConnect && cached != null && !isDescriptorExpired(cached)) {
1638
+ syncedIds.add(connection.id);
1639
+ if (connection.primary) {
1640
+ const domain = isGitSelfManagedHostIntegrationId(id) ? host : undefined;
1641
+ if (!syncedPrimaryIdsByDomain.has(domain)) {
1642
+ syncedPrimaryIdsByDomain.set(domain, connection.id);
1643
+ }
1644
+ }
1645
+ continue;
1646
+ }
1647
+ try {
1648
+ const session = await cloudIntegrations.getConnectionSession(id, undefined, connection.id);
1649
+ if (session == null)
1650
+ continue;
1651
+ let providerSession = toProviderSession(id, connection, session, host);
1652
+ // Resolve a human-readable account handle with the same precedence as the gk CLI:
1653
+ // (1) the value the backend put on the connection, (2) a previously-resolved name cached in
1654
+ // our configured store (keyed by connection id), (3) a live provider-API lookup. This keeps
1655
+ // provider round-trips to the first sight of a connection; degrade to undefined on failure.
1656
+ const existing = existingById.get(connection.id);
1657
+ const accountName = normalizeAccountName(connection.accountName) ??
1658
+ normalizeAccountName(existing?.accountName) ??
1659
+ (await this.resolveAccountName(id, host, providerSession));
1660
+ if (accountName != null) {
1661
+ providerSession = {
1662
+ ...providerSession,
1663
+ account: { ...providerSession.account, label: accountName },
1664
+ };
1665
+ }
1666
+ await this.configuredIntegrationService.storeSession(id, providerSession);
1667
+ syncedIds.add(connection.id);
1668
+ if (connection.primary) {
1669
+ const domain = isGitSelfManagedHostIntegrationId(id) ? host : undefined;
1670
+ if (!syncedPrimaryIdsByDomain.has(domain)) {
1671
+ syncedPrimaryIdsByDomain.set(domain, connection.id);
1672
+ }
1673
+ }
1674
+ }
1675
+ catch (ex) {
1676
+ scope?.warn(`Failed to sync connection '${connection.id}' for ${id}: ${ex instanceof Error ? ex.message : String(ex)}`);
1677
+ }
1678
+ }
1679
+ // Prune stored cloud connections that no longer exist on the backend — but only when every backend
1680
+ // connection that should sync did sync this cycle. Otherwise a transient token fetch failure would
1681
+ // delete a still-valid connection with no replacement (e.g. a legacy single connection during the
1682
+ // backend id rollout); defer pruning to a later clean cycle. Deliberately skipped connections (local
1683
+ // disconnects or invalid self-managed hosts) don't block pruning of unrelated stale descriptors.
1684
+ // Scope deletes to cloud so a local PAT sharing the id survives.
1685
+ const prunedDomains = new Set();
1686
+ if ([...syncEligibleIds].every(connectionId => syncedIds.has(connectionId))) {
1687
+ const liveIds = new Set(identified.map(c => c.id));
1688
+ for (const descriptor of this.configuredIntegrationService.getConfigured(id, { cloud: true })) {
1689
+ if (!liveIds.has(descriptor.id)) {
1690
+ prunedDomains.add(isGitSelfManagedHostIntegrationId(id) ? descriptor.domain : undefined);
1691
+ await this.configuredIntegrationService.deleteConnection(id, descriptor.id, true);
1692
+ }
1693
+ }
1694
+ }
1695
+ // Apply the backend's primary selection, then refresh any warm model only when the effective primary
1696
+ // actually changed (vs the pre-reconcile value captured above). switchConnection() drops the in-memory
1697
+ // session and fires change events, so calling it on every check-in (when the primary is unchanged)
1698
+ // causes needless churn for multi-account providers. Self-managed providers can have one primary per
1699
+ // host, so apply and refresh by host scope rather than by provider id alone.
1700
+ for (const connectionId of syncedPrimaryIdsByDomain.values()) {
1701
+ await this.configuredIntegrationService.setPrimaryConnection(id, connectionId);
1702
+ }
1703
+ const primaryAfter = this.getCloudPrimaryConnectionIdsByDomain(id);
1704
+ const domains = new Set(primaryBefore.keys());
1705
+ for (const domain of primaryAfter.keys()) {
1706
+ domains.add(domain);
1707
+ }
1708
+ for (const domain of prunedDomains) {
1709
+ domains.add(domain);
1710
+ }
1711
+ for (const domain of domains) {
1712
+ if (primaryBefore.get(domain) === primaryAfter.get(domain) && !prunedDomains.has(domain))
1713
+ continue;
1714
+ this.getCachedForDomain(id, domain)?.switchConnection();
1715
+ }
1716
+ }
1717
+ /**
1718
+ * Switches the default connection for a provider to `connectionId` (its backend token id). Performs
1719
+ * the server-side primary switch first, then mirrors it locally and refreshes any warm model. Throws
1720
+ * if the backend switch fails so the caller can surface it (local state stays untouched).
1721
+ */
1722
+ async setPrimaryConnection(id, connectionId) {
1723
+ const connection = this.getConfiguredCloudConnection(id, connectionId);
1724
+ if (!(await this.authenticationService.cloudIntegrations.setPrimaryConnection(id, connectionId))) {
1725
+ throw new Error(`Failed to set primary connection '${connectionId}' for '${id}'`);
1726
+ }
1727
+ await this.configuredIntegrationService.setPrimaryConnection(id, connectionId);
1728
+ this.getCachedForDomain(id, connection.domain)?.switchConnection();
1729
+ }
1730
+ /**
1731
+ * Removes a single connection for a provider by its backend token id. The backend removes the
1732
+ * connection (auto-promoting a secondary to primary when the removed one was primary); we then mirror
1733
+ * that locally and refresh any warm model. Unlike {@link IntegrationBase.disconnect}, this targets one
1734
+ * account. This always talks to the cloud backend, so the local mirror is cloud-scoped and preserves any
1735
+ * local PAT that happens to share the same id.
1736
+ * Throws if the backend delete fails so the caller can surface it (local state stays untouched).
1737
+ */
1738
+ async deleteConnection(id, connectionId) {
1739
+ const connection = this.getConfiguredCloudConnection(id, connectionId);
1740
+ if (!(await this.authenticationService.cloudIntegrations.disconnectConnection(id, connectionId))) {
1741
+ throw new Error(`Failed to delete connection '${connectionId}' for '${id}'`);
1742
+ }
1743
+ await this.configuredIntegrationService.deleteConnection(id, connectionId, true);
1744
+ this.getCachedForDomain(id, connection.domain)?.switchConnection();
1745
+ }
1746
+ /**
1747
+ * Resolves a human-readable account handle (e.g. the GitHub login) for a connection by asking the
1748
+ * provider API with that connection's token. The token backend doesn't expose it. Routes through the
1749
+ * integration model so the correct provider API base URL (incl. self-managed domains) and auth type
1750
+ * are used. Best-effort: returns undefined on any failure so callers degrade gracefully.
1751
+ */
1752
+ async resolveAccountName(id, host, session) {
1753
+ const scope = getScopedLogger();
1754
+ try {
1755
+ // Route through the integration so the correct provider API base URL (incl. the self-managed
1756
+ // host) and auth type are used. Cloud providers ignore the host.
1757
+ const integration = await this.get(id, host);
1758
+ const account = await integration?.getProviderAccountForSession(session);
1759
+ return account?.username ?? account?.name ?? undefined;
1760
+ }
1761
+ catch (ex) {
1762
+ scope?.warn(`Failed to resolve account name for '${id}': ${ex instanceof Error ? ex.message : String(ex)}`);
1763
+ return undefined;
1764
+ }
1765
+ }
1766
+ /**
1767
+ * Forces a refresh of connected cloud integrations from the backend (equivalent to a "--sync" list),
1768
+ * reconciling local state (multi-account connections, primary flags, account names) so a subsequent
1769
+ * {@link getConfigured} reflects the latest server-side connections. Intended for consumers that need
1770
+ * an up-to-date connection list on demand. Rejects when the authoritative backend connection list cannot
1771
+ * be read, so callers never mistake stale local state for a successful refresh.
1772
+ */
1773
+ async refreshConnections() {
1774
+ const connected = await this.syncCloudIntegrations(true);
1775
+ if (connected == null) {
1776
+ throw new Error('Failed to refresh provider connections');
1777
+ }
1778
+ }
584
1779
  }
585
1780
  __decorate([
586
1781
  debug()
@@ -599,7 +1794,10 @@ __decorate([
599
1794
  ], IntegrationService.prototype, "getMyIssuesForRemotes", null);
600
1795
  __decorate([
601
1796
  debug({
602
- args: integrationIds => ({ integrationIds: integrationIds?.length ? integrationIds.join(',') : '<undefined>' }),
1797
+ args: (integrationIds, connectionId) => ({
1798
+ integrationIds: integrationIds?.length ? integrationIds.join(',') : '<undefined>',
1799
+ connectionId: connectionId ?? '<primary>',
1800
+ }),
603
1801
  })
604
1802
  ], IntegrationService.prototype, "getMyCurrentAccounts", null);
605
1803
  __decorate([
@@ -624,4 +1822,74 @@ __decorate([
624
1822
  gate(),
625
1823
  trace()
626
1824
  ], IntegrationService.prototype, "syncCloudIntegrations", null);
1825
+ /** Internal factory used by the GitLens host and integration tests that need the full service surface. */
1826
+ export function createIntegrationService(ctx) {
1827
+ const configured = new ConfiguredIntegrationService(ctx);
1828
+ const cloud = new CloudIntegrationService(ctx);
1829
+ let service;
1830
+ const auth = new IntegrationAuthenticationService(configured, ctx, () => service, cloud);
1831
+ service = new IntegrationService(auth, configured, ctx);
1832
+ void purgeRetiredIntegrationStorage(ctx, configured);
1833
+ return service;
1834
+ }
1835
+ const retiredIntegrationsStorageKey = 'integrations:migrated:cloudOnly';
1836
+ async function purgeRetiredIntegrationStorage(ctx, configured) {
1837
+ if (ctx.storage.get(retiredIntegrationsStorageKey))
1838
+ return;
1839
+ try {
1840
+ await configured.purgeStoredConfiguration(['github-enterprise', 'gitlab-self-hosted']);
1841
+ await ctx.storage.store(retiredIntegrationsStorageKey, true);
1842
+ }
1843
+ catch {
1844
+ // Best-effort cleanup retries on the next startup while the migration flag remains unset.
1845
+ }
1846
+ }
1847
+ function protocolFromDomain(domain) {
1848
+ const value = domain?.trim();
1849
+ if (!value)
1850
+ return undefined;
1851
+ if (!/^[a-z][a-z\d+\-.]*:\/\//i.test(value))
1852
+ return undefined;
1853
+ try {
1854
+ return new URL(value).protocol || undefined;
1855
+ }
1856
+ catch {
1857
+ return undefined;
1858
+ }
1859
+ }
1860
+ function normalizeAccountName(accountName) {
1861
+ const value = accountName?.trim();
1862
+ return value ? value : undefined;
1863
+ }
1864
+ /**
1865
+ * Whether a stored connection descriptor's token has expired. A missing `expiresAt` is treated as
1866
+ * not-expired (non-expiring/legacy tokens, e.g. GitHub and self-managed cloud, carry no meaningful
1867
+ * expiry), matching the session-expiry checks elsewhere.
1868
+ */
1869
+ function isDescriptorExpired(descriptor) {
1870
+ if (descriptor.expiresAt == null)
1871
+ return false;
1872
+ return new Date(descriptor.expiresAt).getTime() < Date.now();
1873
+ }
1874
+ function toProviderSession(id, connection, session, host) {
1875
+ // GitHub, the cloud self-managed hosts, and Trello return `expiresIn: 0` for a non-expiring token; left
1876
+ // as 0 the session's `expiresAt` would be `now` and rejected as expired on the next read. Map it to the
1877
+ // maximum expiry (mirrors the auth provider's own guard).
1878
+ const expiresIn = session.expiresIn === 0 && isNonExpiringZeroTokenIntegrationId(id) ? maxSmallIntegerV8 : session.expiresIn;
1879
+ const protocol = protocolFromDomain(connection.domain);
1880
+ return {
1881
+ id: connection.id,
1882
+ accessToken: session.accessToken,
1883
+ account: { id: '', label: '' },
1884
+ scopes: session.scopes ? session.scopes.split(',') : [],
1885
+ cloud: true,
1886
+ type: session.type,
1887
+ expiresAt: new Date(expiresIn * 1000 + Date.now()),
1888
+ // Self-managed connections are keyed by their host; cloud providers use the canonical domain.
1889
+ domain: isGitSelfManagedHostIntegrationId(id) ? (host ?? '') : (providersMetadata[id]?.domain ?? ''),
1890
+ ...(protocol != null ? { protocol: protocol } : {}),
1891
+ // Carried for providers whose client needs an app key alongside the token (e.g. Trello).
1892
+ ...(session.appKey != null ? { appKey: session.appKey } : {}),
1893
+ };
1894
+ }
627
1895
  //# sourceMappingURL=integrationService.js.map