@gitkraken/core-gitlens 0.4.0 → 0.4.101

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 (1051) hide show
  1. package/CHANGELOG.md +74 -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 +135 -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 +297 -13
  580. package/dist/plus/integrations/integrationService.d.ts.map +1 -1
  581. package/dist/plus/integrations/integrationService.js +672 -36
  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 +262 -10
  592. package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
  593. package/dist/plus/integrations/models/gitHostIntegration.js +675 -101
  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 +70 -7
  600. package/dist/plus/integrations/models/issuesIntegration.d.ts.map +1 -1
  601. package/dist/plus/integrations/models/issuesIntegration.js +108 -35
  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/broaden.d.ts +20 -0
  700. package/dist/plus/integrations/reads/broaden.d.ts.map +1 -0
  701. package/dist/plus/integrations/reads/broaden.js +326 -0
  702. package/dist/plus/integrations/reads/broaden.js.map +1 -0
  703. package/dist/plus/integrations/reads/context.d.ts +74 -0
  704. package/dist/plus/integrations/reads/context.d.ts.map +1 -0
  705. package/dist/plus/integrations/reads/context.js +2 -0
  706. package/dist/plus/integrations/reads/context.js.map +1 -0
  707. package/dist/plus/integrations/reads/cursors.d.ts +66 -0
  708. package/dist/plus/integrations/reads/cursors.d.ts.map +1 -0
  709. package/dist/plus/integrations/reads/cursors.js +133 -0
  710. package/dist/plus/integrations/reads/cursors.js.map +1 -0
  711. package/dist/plus/integrations/reads/drains.d.ts +60 -0
  712. package/dist/plus/integrations/reads/drains.d.ts.map +1 -0
  713. package/dist/plus/integrations/reads/drains.js +255 -0
  714. package/dist/plus/integrations/reads/drains.js.map +1 -0
  715. package/dist/plus/integrations/reads/filters.d.ts +81 -0
  716. package/dist/plus/integrations/reads/filters.d.ts.map +1 -0
  717. package/dist/plus/integrations/reads/filters.js +87 -0
  718. package/dist/plus/integrations/reads/filters.js.map +1 -0
  719. package/dist/plus/integrations/reads/hierarchy.d.ts +17 -0
  720. package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -0
  721. package/dist/plus/integrations/reads/hierarchy.js +320 -0
  722. package/dist/plus/integrations/reads/hierarchy.js.map +1 -0
  723. package/dist/plus/integrations/reads/hierarchy.utils.d.ts +77 -0
  724. package/dist/plus/integrations/reads/hierarchy.utils.d.ts.map +1 -0
  725. package/dist/plus/integrations/reads/hierarchy.utils.js +128 -0
  726. package/dist/plus/integrations/reads/hierarchy.utils.js.map +1 -0
  727. package/dist/plus/integrations/reads/issueTracker.d.ts +19 -0
  728. package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -0
  729. package/dist/plus/integrations/reads/issueTracker.js +334 -0
  730. package/dist/plus/integrations/reads/issueTracker.js.map +1 -0
  731. package/dist/plus/integrations/reads/issues.d.ts +34 -0
  732. package/dist/plus/integrations/reads/issues.d.ts.map +1 -0
  733. package/dist/plus/integrations/reads/issues.js +244 -0
  734. package/dist/plus/integrations/reads/issues.js.map +1 -0
  735. package/dist/plus/integrations/reads/paging.d.ts +136 -0
  736. package/dist/plus/integrations/reads/paging.d.ts.map +1 -0
  737. package/dist/plus/integrations/reads/paging.js +221 -0
  738. package/dist/plus/integrations/reads/paging.js.map +1 -0
  739. package/dist/plus/integrations/reads/pullRequests.d.ts +32 -0
  740. package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -0
  741. package/dist/plus/integrations/reads/pullRequests.js +151 -0
  742. package/dist/plus/integrations/reads/pullRequests.js.map +1 -0
  743. package/dist/plus/integrations/reads/resolveRepository.d.ts +25 -0
  744. package/dist/plus/integrations/reads/resolveRepository.d.ts.map +1 -0
  745. package/dist/plus/integrations/reads/resolveRepository.js +235 -0
  746. package/dist/plus/integrations/reads/resolveRepository.js.map +1 -0
  747. package/dist/plus/integrations/reads/sweeps.d.ts +11 -0
  748. package/dist/plus/integrations/reads/sweeps.d.ts.map +1 -0
  749. package/dist/plus/integrations/reads/sweeps.js +125 -0
  750. package/dist/plus/integrations/reads/sweeps.js.map +1 -0
  751. package/dist/plus/integrations/reads/warnings.d.ts +47 -0
  752. package/dist/plus/integrations/reads/warnings.d.ts.map +1 -0
  753. package/dist/plus/integrations/reads/warnings.js +81 -0
  754. package/dist/plus/integrations/reads/warnings.js.map +1 -0
  755. package/dist/plus/integrations/results.d.ts +189 -0
  756. package/dist/plus/integrations/results.d.ts.map +1 -0
  757. package/dist/plus/integrations/results.js +62 -0
  758. package/dist/plus/integrations/results.js.map +1 -0
  759. package/dist/plus/integrations/utils/domain.utils.d.ts +5 -0
  760. package/dist/plus/integrations/utils/domain.utils.d.ts.map +1 -0
  761. package/dist/plus/integrations/utils/domain.utils.js +27 -0
  762. package/dist/plus/integrations/utils/domain.utils.js.map +1 -0
  763. package/dist/plus/integrations/utils/integration.utils.d.ts +27 -1
  764. package/dist/plus/integrations/utils/integration.utils.d.ts.map +1 -1
  765. package/dist/plus/integrations/utils/integration.utils.js +86 -15
  766. package/dist/plus/integrations/utils/integration.utils.js.map +1 -1
  767. package/dist/utils/array.d.ts.map +1 -1
  768. package/dist/utils/array.js.map +1 -1
  769. package/dist/utils/brand.d.ts.map +1 -1
  770. package/dist/utils/cancellation.d.ts +13 -0
  771. package/dist/utils/cancellation.d.ts.map +1 -1
  772. package/dist/utils/cancellation.js +52 -7
  773. package/dist/utils/cancellation.js.map +1 -1
  774. package/dist/utils/charCode.d.ts.map +1 -1
  775. package/dist/utils/coalescedRun.d.ts +16 -0
  776. package/dist/utils/coalescedRun.d.ts.map +1 -0
  777. package/dist/utils/coalescedRun.js +43 -0
  778. package/dist/utils/coalescedRun.js.map +1 -0
  779. package/dist/utils/color.d.ts.map +1 -1
  780. package/dist/utils/color.js +3 -3
  781. package/dist/utils/color.js.map +1 -1
  782. package/dist/utils/date.d.ts +24 -0
  783. package/dist/utils/date.d.ts.map +1 -1
  784. package/dist/utils/date.js +62 -0
  785. package/dist/utils/date.js.map +1 -1
  786. package/dist/utils/debounce.js +1 -1
  787. package/dist/utils/debounce.js.map +1 -1
  788. package/dist/utils/decorators/debounce.d.ts.map +1 -1
  789. package/dist/utils/decorators/debounce.js.map +1 -1
  790. package/dist/utils/decorators/gate.d.ts.map +1 -1
  791. package/dist/utils/decorators/gate.js +2 -2
  792. package/dist/utils/decorators/gate.js.map +1 -1
  793. package/dist/utils/decorators/log.d.ts.map +1 -1
  794. package/dist/utils/decorators/log.js +5 -5
  795. package/dist/utils/decorators/log.js.map +1 -1
  796. package/dist/utils/decorators/memoize.d.ts.map +1 -1
  797. package/dist/utils/decorators/memoize.js +2 -2
  798. package/dist/utils/decorators/memoize.js.map +1 -1
  799. package/dist/utils/decorators/resolver.d.ts.map +1 -1
  800. package/dist/utils/decorators/resolver.js.map +1 -1
  801. package/dist/utils/decorators/sequentialize.d.ts.map +1 -1
  802. package/dist/utils/decorators/sequentialize.js +2 -2
  803. package/dist/utils/decorators/sequentialize.js.map +1 -1
  804. package/dist/utils/decorators/serializable.d.ts.map +1 -1
  805. package/dist/utils/decorators/serializable.js +1 -1
  806. package/dist/utils/decorators/serializable.js.map +1 -1
  807. package/dist/utils/dedupedAsyncCache.d.ts.map +1 -1
  808. package/dist/utils/env/browser/base64.d.ts.map +1 -1
  809. package/dist/utils/env/browser/base64.js.map +1 -1
  810. package/dist/utils/env/browser/crypto.d.ts.map +1 -1
  811. package/dist/utils/env/browser/crypto.js.map +1 -1
  812. package/dist/utils/env/browser/fs.d.ts.map +1 -1
  813. package/dist/utils/env/browser/fs.js.map +1 -1
  814. package/dist/utils/env/browser/hex.d.ts.map +1 -1
  815. package/dist/utils/env/browser/hex.js.map +1 -1
  816. package/dist/utils/env/browser/hrtime.d.ts.map +1 -1
  817. package/dist/utils/env/browser/hrtime.js.map +1 -1
  818. package/dist/utils/env/browser/logScope.d.ts.map +1 -1
  819. package/dist/utils/env/browser/logScope.js.map +1 -1
  820. package/dist/utils/env/browser/md5.d.ts.map +1 -1
  821. package/dist/utils/env/browser/md5.js.map +1 -1
  822. package/dist/utils/env/browser/platform.d.ts.map +1 -1
  823. package/dist/utils/env/browser/platform.js.map +1 -1
  824. package/dist/utils/env/node/base64.d.ts.map +1 -1
  825. package/dist/utils/env/node/base64.js.map +1 -1
  826. package/dist/utils/env/node/crypto.d.ts.map +1 -1
  827. package/dist/utils/env/node/crypto.js.map +1 -1
  828. package/dist/utils/env/node/exec.d.ts +9 -1
  829. package/dist/utils/env/node/exec.d.ts.map +1 -1
  830. package/dist/utils/env/node/exec.js +11 -4
  831. package/dist/utils/env/node/exec.js.map +1 -1
  832. package/dist/utils/env/node/fs.d.ts.map +1 -1
  833. package/dist/utils/env/node/fs.js.map +1 -1
  834. package/dist/utils/env/node/hex.d.ts.map +1 -1
  835. package/dist/utils/env/node/hex.js.map +1 -1
  836. package/dist/utils/env/node/hrtime.d.ts.map +1 -1
  837. package/dist/utils/env/node/hrtime.js.map +1 -1
  838. package/dist/utils/env/node/logScope.d.ts.map +1 -1
  839. package/dist/utils/env/node/logScope.js.map +1 -1
  840. package/dist/utils/env/node/platform.d.ts.map +1 -1
  841. package/dist/utils/env/node/platform.js.map +1 -1
  842. package/dist/utils/event.d.ts.map +1 -1
  843. package/dist/utils/event.js +18 -22
  844. package/dist/utils/event.js.map +1 -1
  845. package/dist/utils/formatter.d.ts.map +1 -1
  846. package/dist/utils/formatter.js.map +1 -1
  847. package/dist/utils/function.d.ts.map +1 -1
  848. package/dist/utils/function.js +3 -3
  849. package/dist/utils/function.js.map +1 -1
  850. package/dist/utils/hash.js.map +1 -1
  851. package/dist/utils/iterable.d.ts.map +1 -1
  852. package/dist/utils/iterable.js +2 -6
  853. package/dist/utils/iterable.js.map +1 -1
  854. package/dist/utils/lazy.d.ts.map +1 -1
  855. package/dist/utils/lazy.js.map +1 -1
  856. package/dist/utils/logger.d.ts.map +1 -1
  857. package/dist/utils/logger.js +1 -1
  858. package/dist/utils/logger.js.map +1 -1
  859. package/dist/utils/logger.scoped.js +1 -1
  860. package/dist/utils/logger.scoped.js.map +1 -1
  861. package/dist/utils/lruMap.d.ts.map +1 -1
  862. package/dist/utils/lruMap.js.map +1 -1
  863. package/dist/utils/mru.d.ts.map +1 -1
  864. package/dist/utils/mru.js.map +1 -1
  865. package/dist/utils/object.js.map +1 -1
  866. package/dist/utils/paging.d.ts +29 -0
  867. package/dist/utils/paging.d.ts.map +1 -1
  868. package/dist/utils/paging.js +18 -0
  869. package/dist/utils/paging.js.map +1 -1
  870. package/dist/utils/path.js.map +1 -1
  871. package/dist/utils/promise.d.ts +10 -0
  872. package/dist/utils/promise.d.ts.map +1 -1
  873. package/dist/utils/promise.js +26 -3
  874. package/dist/utils/promise.js.map +1 -1
  875. package/dist/utils/promiseCache.d.ts +12 -2
  876. package/dist/utils/promiseCache.d.ts.map +1 -1
  877. package/dist/utils/promiseCache.js +80 -50
  878. package/dist/utils/promiseCache.js.map +1 -1
  879. package/dist/utils/searchTree.d.ts.map +1 -1
  880. package/dist/utils/searchTree.js +4 -1
  881. package/dist/utils/searchTree.js.map +1 -1
  882. package/dist/utils/stopwatch.d.ts.map +1 -1
  883. package/dist/utils/string.js +1 -1
  884. package/dist/utils/string.js.map +1 -1
  885. package/dist/utils/subscriptionManager.d.ts.map +1 -1
  886. package/dist/utils/subscriptionManager.js.map +1 -1
  887. package/dist/utils/trie.d.ts.map +1 -1
  888. package/dist/utils/trie.js +1 -0
  889. package/dist/utils/trie.js.map +1 -1
  890. package/docs/integrations.md +372 -0
  891. package/docs/kepler-read-api-parity.md +112 -0
  892. package/package.json +238 -213
  893. package/src/git/cache.ts +75 -8
  894. package/src/git/errors.ts +36 -1
  895. package/src/git/models/commit.ts +1 -1
  896. package/src/git/models/graph.ts +147 -0
  897. package/src/git/models/graphSession.ts +205 -0
  898. package/src/git/models/issue.ts +12 -1
  899. package/src/git/models/pullRequest.ts +27 -1
  900. package/src/git/models/repository.ts +24 -1
  901. package/src/git/models/resourceDescriptor.ts +17 -0
  902. package/src/git/models/signature.ts +16 -0
  903. package/src/git/models/tag.ts +6 -1
  904. package/src/git/parsers/diffParser.ts +1 -1
  905. package/src/git/providers/branches.ts +6 -1
  906. package/src/git/providers/commits.ts +6 -1
  907. package/src/git/providers/config.ts +5 -1
  908. package/src/git/providers/graph.ts +69 -2
  909. package/src/git/providers/status.ts +1 -1
  910. package/src/git/providers/worktrees.ts +3 -1
  911. package/src/git/remotes/azure-devops.ts +29 -33
  912. package/src/git/remotes/bitbucket-server.ts +23 -25
  913. package/src/git/remotes/bitbucket.ts +23 -25
  914. package/src/git/remotes/gerrit.ts +12 -14
  915. package/src/git/remotes/gitea.ts +13 -15
  916. package/src/git/remotes/github.ts +56 -58
  917. package/src/git/remotes/gitlab.ts +102 -104
  918. package/src/git/run.types.ts +54 -4
  919. package/src/git/utils/branch.utils.ts +12 -1
  920. package/src/git/utils/contributor.utils.ts +1 -1
  921. package/src/git/utils/fileStatus.utils.ts +7 -0
  922. package/src/git/utils/graph.utils.ts +46 -0
  923. package/src/git/utils/issue.utils.ts +1 -0
  924. package/src/git/utils/pullRequest.utils.ts +9 -0
  925. package/src/git/utils/reachability.utils.ts +79 -8
  926. package/src/git/utils/sshKey.utils.ts +30 -0
  927. package/src/git/watching/watchService.ts +16 -1
  928. package/src/git/watching/watchSession.ts +20 -2
  929. package/src/git-cli/exec/git.ts +144 -42
  930. package/src/git-cli/parsers/logParser.ts +83 -1
  931. package/src/git-cli/parsers/sshSignatureParser.ts +85 -0
  932. package/src/git-cli/parsers/worktreeParser.ts +5 -7
  933. package/src/git-cli/providers/branches.ts +60 -38
  934. package/src/git-cli/providers/commits.ts +102 -9
  935. package/src/git-cli/providers/graph.ts +1771 -393
  936. package/src/git-cli/providers/pausedOperations.ts +3 -3
  937. package/src/git-cli/providers/revision.ts +42 -0
  938. package/src/git-cli/providers/status.ts +333 -178
  939. package/src/git-cli/providers/tags.ts +2 -0
  940. package/src/git-cli/providers/worktrees.ts +40 -4
  941. package/src/git-cli/service.ts +9 -0
  942. package/src/ipc/ipcServer.ts +1 -1
  943. package/src/plus/agents/providers/claudeCodeProvider.ts +25 -0
  944. package/src/plus/agents/providers/claudeCodeTranscript.ts +320 -8
  945. package/src/plus/agents/types.ts +34 -0
  946. package/src/plus/ai/constants.ts +1 -9
  947. package/src/plus/ai/models/model.ts +53 -2
  948. package/src/plus/ai/models/promptTemplates.ts +9 -2
  949. package/src/plus/ai/prompts.ts +16 -48
  950. package/src/plus/ai/providers/anthropicProvider.ts +45 -3
  951. package/src/plus/ai/providers/deepSeekProvider.ts +17 -1
  952. package/src/plus/ai/providers/geminiProvider.ts +25 -6
  953. package/src/plus/ai/providers/gitkrakenProvider.ts +2 -0
  954. package/src/plus/ai/providers/huggingFaceProvider.ts +28 -21
  955. package/src/plus/ai/providers/openAICompatibleProviderBase.ts +16 -1
  956. package/src/plus/ai/providers/xaiProvider.ts +14 -1
  957. package/src/plus/ai/utils/ai.utils.ts +0 -2
  958. package/src/plus/ai/utils/results.utils.ts +32 -0
  959. package/src/plus/ai/utils/truncation.utils.ts +0 -1
  960. package/src/plus/git-github/api/github.ts +484 -104
  961. package/src/plus/git-github/models.ts +33 -0
  962. package/src/plus/git-github/providers/github/branches.ts +6 -3
  963. package/src/plus/git-github/providers/github/diff.ts +1 -1
  964. package/src/plus/git-github/providers/github/graph.ts +131 -0
  965. package/src/plus/git-github/providers/github/tags.ts +2 -0
  966. package/src/plus/integrations/authentication/cloudIntegrationService.ts +189 -17
  967. package/src/plus/integrations/authentication/configuredIntegrationService.ts +287 -50
  968. package/src/plus/integrations/authentication/integrationAuthenticationProvider.ts +105 -31
  969. package/src/plus/integrations/authentication/integrationAuthenticationService.ts +7 -3
  970. package/src/plus/integrations/authentication/manualTokenProvider.ts +12 -5
  971. package/src/plus/integrations/authentication/models.ts +35 -1
  972. package/src/plus/integrations/collectionMetadata.ts +143 -0
  973. package/src/plus/integrations/constants.ts +21 -0
  974. package/src/plus/integrations/context.ts +8 -9
  975. package/src/plus/integrations/errors.ts +153 -0
  976. package/src/plus/integrations/index.ts +148 -51
  977. package/src/plus/integrations/integrationService.ts +940 -49
  978. package/src/plus/integrations/lite.ts +233 -0
  979. package/src/plus/integrations/manager.ts +359 -0
  980. package/src/plus/integrations/models/gitHostIntegration.ts +1005 -134
  981. package/src/plus/integrations/models/integration.ts +293 -24
  982. package/src/plus/integrations/models/issuesIntegration.ts +132 -39
  983. package/src/plus/integrations/providerFilters.ts +12 -0
  984. package/src/plus/integrations/providers/apiClients.ts +8 -11
  985. package/src/plus/integrations/providers/apiConfig.ts +71 -0
  986. package/src/plus/integrations/providers/azure/azure.ts +164 -33
  987. package/src/plus/integrations/providers/azure/models.ts +19 -6
  988. package/src/plus/integrations/providers/azureDevOps.ts +766 -101
  989. package/src/plus/integrations/providers/bitbucket/bitbucket.ts +164 -34
  990. package/src/plus/integrations/providers/bitbucket-server/models.ts +32 -1
  991. package/src/plus/integrations/providers/bitbucket-server.ts +173 -8
  992. package/src/plus/integrations/providers/bitbucket.ts +489 -45
  993. package/src/plus/integrations/providers/github/github.ts +2 -2
  994. package/src/plus/integrations/providers/github/github.utils.ts +1 -1
  995. package/src/plus/integrations/providers/github.ts +390 -6
  996. package/src/plus/integrations/providers/gitlab/gitlab.ts +170 -60
  997. package/src/plus/integrations/providers/gitlab/gitlab.utils.ts +9 -0
  998. package/src/plus/integrations/providers/gitlab/models.ts +19 -5
  999. package/src/plus/integrations/providers/gitlab.ts +369 -10
  1000. package/src/plus/integrations/providers/jira.ts +247 -42
  1001. package/src/plus/integrations/providers/linear.ts +154 -27
  1002. package/src/plus/integrations/providers/models.ts +583 -75
  1003. package/src/plus/integrations/providers/providersApi.ts +849 -86
  1004. package/src/plus/integrations/providers/trello.ts +205 -0
  1005. package/src/plus/integrations/providers/utils/providerPaging.ts +177 -0
  1006. package/src/plus/integrations/providers/utils.ts +68 -8
  1007. package/src/plus/integrations/reads/broaden.ts +452 -0
  1008. package/src/plus/integrations/reads/context.ts +99 -0
  1009. package/src/plus/integrations/reads/cursors.ts +224 -0
  1010. package/src/plus/integrations/reads/drains.ts +343 -0
  1011. package/src/plus/integrations/reads/filters.ts +124 -0
  1012. package/src/plus/integrations/reads/hierarchy.ts +473 -0
  1013. package/src/plus/integrations/reads/hierarchy.utils.ts +155 -0
  1014. package/src/plus/integrations/reads/issueTracker.ts +468 -0
  1015. package/src/plus/integrations/reads/issues.ts +409 -0
  1016. package/src/plus/integrations/reads/paging.ts +277 -0
  1017. package/src/plus/integrations/reads/pullRequests.ts +260 -0
  1018. package/src/plus/integrations/reads/resolveRepository.ts +272 -0
  1019. package/src/plus/integrations/reads/sweeps.ts +185 -0
  1020. package/src/plus/integrations/reads/warnings.ts +170 -0
  1021. package/src/plus/integrations/results.ts +275 -0
  1022. package/src/plus/integrations/utils/domain.utils.ts +26 -0
  1023. package/src/plus/integrations/utils/integration.utils.ts +93 -16
  1024. package/src/utils/brand.ts +0 -2
  1025. package/src/utils/cancellation.ts +56 -7
  1026. package/src/utils/coalescedRun.ts +45 -0
  1027. package/src/utils/color.ts +3 -3
  1028. package/src/utils/date.ts +72 -0
  1029. package/src/utils/debounce.ts +1 -1
  1030. package/src/utils/decorators/gate.ts +2 -2
  1031. package/src/utils/decorators/log.ts +5 -5
  1032. package/src/utils/decorators/memoize.ts +2 -2
  1033. package/src/utils/decorators/sequentialize.ts +2 -2
  1034. package/src/utils/decorators/serializable.ts +1 -1
  1035. package/src/utils/env/node/exec.ts +20 -5
  1036. package/src/utils/event.ts +19 -25
  1037. package/src/utils/function.ts +3 -3
  1038. package/src/utils/iterable.ts +2 -6
  1039. package/src/utils/logger.scoped.ts +1 -1
  1040. package/src/utils/logger.ts +1 -1
  1041. package/src/utils/paging.ts +46 -0
  1042. package/src/utils/promise.ts +33 -3
  1043. package/src/utils/promiseCache.ts +81 -51
  1044. package/src/utils/searchTree.ts +4 -2
  1045. package/src/utils/string.ts +1 -1
  1046. package/src/utils/trie.ts +1 -0
  1047. package/dist/plus/ai/providers/githubModelsProvider.d.ts +0 -19
  1048. package/dist/plus/ai/providers/githubModelsProvider.d.ts.map +0 -1
  1049. package/dist/plus/ai/providers/githubModelsProvider.js +0 -51
  1050. package/dist/plus/ai/providers/githubModelsProvider.js.map +0 -1
  1051. package/src/plus/ai/providers/githubModelsProvider.ts +0 -92
@@ -57,9 +57,10 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
57
57
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
58
58
  });
59
59
  import { GitSearchError } from '../../git/errors.js';
60
+ import { graphSessionSnapshotVersion } from '../../git/models/graphSession.js';
60
61
  import { getBranchId, getBranchNameWithoutRemote, getRemoteNameFromBranchName, } from '../../git/utils/branch.utils.js';
61
- import { getChangedFilesCount } from '../../git/utils/commit.utils.js';
62
- import { createReachabilityTableBuilder } from '../../git/utils/reachability.utils.js';
62
+ import { appendRowsAtCursor, mergeAvatarsForward } from '../../git/utils/graph.utils.js';
63
+ import { computeGraphRowContextFlags, createReachabilityTableBuilder } from '../../git/utils/reachability.utils.js';
63
64
  import { isUncommitted } from '../../git/utils/revision.utils.js';
64
65
  import { getSearchQueryComparisonKey, parseSearchQueryGitCommand } from '../../git/utils/search.utils.js';
65
66
  import { getTagId } from '../../git/utils/tag.utils.js';
@@ -68,6 +69,7 @@ import { getWorktreeId, groupWorktreesByBranch } from '../../git/utils/worktree.
68
69
  import { isCancellationError } from '../../utils/cancellation.js';
69
70
  import { debug } from '../../utils/decorators/log.js';
70
71
  import { createDisposable } from '../../utils/disposable.js';
72
+ import { fnv1aHash64 } from '../../utils/hash.js';
71
73
  import { find, first, join, last } from '../../utils/iterable.js';
72
74
  import { getScopedLogger } from '../../utils/logger.scoped.js';
73
75
  import { getSettledValue } from '../../utils/promise.js';
@@ -75,6 +77,211 @@ import { gitConfigsLog } from '../exec/git.js';
75
77
  import { getGraphParser, getShaAndDatesLogParser, getShaAndDatesWithFilesLogParser, getShaAndStatsLogParser, getShaLogParser, } from '../parsers/logParser.js';
76
78
  import { convertStashesToStdin } from './stash.js';
77
79
  const progressiveSearchResultsBatchTimeMs = 500; // Send updates every 500ms (2 updates/second)
80
+ /**
81
+ * Whether a ref participates in graph row decoration (a branch/remote/tag badge) and so must be diffed by
82
+ * the R6b tip gate. Excludes `refs/stash` (handled by the stash gate) and symbolic `…/HEAD` refs (they
83
+ * mirror another ref and produce no badge of their own).
84
+ */
85
+ function isMoveableGraphRef(refname) {
86
+ if (refname === 'refs/stash' || refname === 'HEAD' || refname.endsWith('/HEAD'))
87
+ return false;
88
+ return refname.startsWith('refs/heads/') || refname.startsWith('refs/remotes/') || refname.startsWith('refs/tags/');
89
+ }
90
+ /**
91
+ * Fingerprints the GLOBAL side inputs row construction embeds into row decorations — the default branch
92
+ * (and whether a local branch shadows it), HEAD's upstream, remote urls/providers, secondary-worktree
93
+ * assignments, and the current user. These can all change WITHOUT moving any ref tip (`git remote
94
+ * set-head`, remote/user config edits, `git worktree add`), and the R6b fast path reuses prior rows
95
+ * wholesale (only flags/reachability are re-derived) — so it compares this against the seed's and falls
96
+ * back to the full walk (which rebuilds every decoration) on ANY change. Deliberately EXCLUDES what other
97
+ * gates already own — ref existence/tips (tip gate), the default worktree's checkout (HEAD gate), and
98
+ * per-branch upstream mappings (checked row-by-row against the seed's embedded pills, so tracking-branch
99
+ * CREATES stay fast) — keeping the high-frequency events (commits, branch/tag creates, fetches,
100
+ * checkouts) on the fast path. Sorted so map/list iteration order can't produce spurious mismatches.
101
+ */
102
+ function computeDecorationFingerprint(repoPath, defaultBranchName, defaultLocalName, headRefUpstreamName, branches, remotes, worktrees, currentUser) {
103
+ // Remote-head default markers read `!branchMap.has(defaultLocalName)` — a local branch appearing at (or
104
+ // vanishing from) the default's local name flips them even though the DEFAULT ref itself didn't move.
105
+ const localShadowsDefault = defaultLocalName != null && (branches?.some(b => b.name === defaultLocalName) ?? false);
106
+ const parts = [
107
+ `d:${defaultBranchName ?? ''}|${localShadowsDefault ? 's' : ''}`,
108
+ `h:${headRefUpstreamName ?? ''}`,
109
+ `u:${currentUser?.name ?? ''}|${currentUser?.email ?? ''}`,
110
+ ];
111
+ if (branches != null) {
112
+ for (const b of branches) {
113
+ // `+starred` is baked into branch pills' serialized contexts (local AND remote heads); a
114
+ // disposition change moves no ref tip, so it must bust the fingerprint. Star/unstar is rare —
115
+ // one full walk per transition is fine.
116
+ if (b.starred) {
117
+ parts.push(`s:${b.name}`);
118
+ }
119
+ }
120
+ }
121
+ if (remotes != null) {
122
+ for (const r of remotes) {
123
+ parts.push(`r:${r.name}|${r.url}|${r.provider?.gkProviderId ?? ''}`);
124
+ }
125
+ }
126
+ let defaultWorktreeBranch;
127
+ let defaultWorktreePath;
128
+ for (const w of worktrees) {
129
+ if (w.isDefault) {
130
+ defaultWorktreeBranch = w.branch?.name;
131
+ defaultWorktreePath = w.path;
132
+ continue;
133
+ }
134
+ // Only branch-attached SECONDARY worktrees decorate rows: bare/detached ones are excluded from
135
+ // `worktreesByBranch` (no pill). NOTE: `w.name` is deliberately avoided; it embeds the checked-out
136
+ // branch (and a detached sha), which would bust this on every checkout.
137
+ if (w.type !== 'branch')
138
+ continue;
139
+ parts.push(`w:${w.branch?.name ?? ''}|${w.path}`);
140
+ }
141
+ // The DEFAULT worktree's checkout flips `+checkedout` / the main-path worktree recovery on two branch
142
+ // pills. When the graph IS the default worktree, that's the ordinary HEAD move (the HEAD gate refetches
143
+ // both endpoint rows) — but a graph on a SECONDARY worktree sees no HEAD move when the MAIN worktree
144
+ // checks out, so the assignment must fingerprint there. (`w.path` for the default worktree equals the
145
+ // main repo path in this provider's normalization — pinned by a WorktreesSubProvider test.)
146
+ if (defaultWorktreePath != null && defaultWorktreePath !== repoPath) {
147
+ parts.push(`wd:${defaultWorktreeBranch ?? ''}`);
148
+ }
149
+ parts.sort();
150
+ return fnv1aHash64(parts.join('\x00'));
151
+ }
152
+ /**
153
+ * Whether the shared reachability TABLE changed between two refresh generations. The table is append-only
154
+ * within a generation (`id`), so a new `id` or a grown dictionary/sets length is an EXACT signal — a per-row
155
+ * index that re-points to an already-present set doesn't grow the table (that change rides the rows channel).
156
+ */
157
+ function reachabilityTableChanged(prior, next) {
158
+ if (prior == null || next == null)
159
+ return prior !== next;
160
+ return (prior.id !== next.id ||
161
+ prior.dictionary.length !== next.dictionary.length ||
162
+ prior.sets.length !== next.sets.length);
163
+ }
164
+ /**
165
+ * Whether the downstreams map (upstream name → tracking branch names) changed between two refresh
166
+ * generations. Order-sensitive on the arrays: a mere reorder reports "changed" and re-ships the full map,
167
+ * which is harmless — a false negative would silently drop a real upstream change, so err toward "changed".
168
+ */
169
+ function downstreamsChanged(prior, next) {
170
+ if (prior.size !== next.size)
171
+ return true;
172
+ for (const [key, priorNames] of prior) {
173
+ const nextNames = next.get(key);
174
+ if (nextNames == null || nextNames.length !== priorNames.length)
175
+ return true;
176
+ for (let i = 0; i < priorNames.length; i++) {
177
+ if (priorNames[i] !== nextNames[i])
178
+ return true;
179
+ }
180
+ }
181
+ return false;
182
+ }
183
+ /**
184
+ * Cap on the number of window rows a {@link GraphSession.serialize} persists. A longer window persists only
185
+ * its TOP slice with `hasMore` forced true (restore then behaves as a shorter loaded window — the bottom
186
+ * re-pages on demand). Pragmatic: generous enough that a typical session restores its whole window, bounded
187
+ * enough that the JSON file stays sub-MB-class (rows are a few hundred bytes each).
188
+ */
189
+ const maxPersistedGraphRows = 2000;
190
+ /** The walk-shape key (`ordering|onlyFollowFirstParent`) an incremental seed is gated on — one builder so the
191
+ * restore/refresh/rebuild sites can't drift in how they stringify it. */
192
+ function buildShapeKey(shape) {
193
+ return `${shape.ordering}|${shape.onlyFollowFirstParent}`;
194
+ }
195
+ /**
196
+ * Validates a persisted {@link GitGraphSessionSnapshot} structurally before it's trusted to seed a restore.
197
+ * Returns the discard reason on any failure (→ the caller ignores the snapshot and does a normal initial
198
+ * walk), or `undefined` when it's coherent. Never throws — a corrupt/adversarial cache must degrade to a
199
+ * full walk, never crash the open. Deep validation (does the cache match current git?) is NOT done here:
200
+ * that's the restore's immediate refresh, which reconciles a stale-but-valid snapshot against ground truth.
201
+ */
202
+ function validateGraphSnapshot(snapshot, repoPath, currentBuildShape) {
203
+ if (snapshot.v !== graphSessionSnapshotVersion)
204
+ return 'schema';
205
+ if (snapshot.repoPath !== repoPath)
206
+ return 'repo-path';
207
+ // A shape change reshapes every row's parents/order — the cached rows can't be reused.
208
+ if (snapshot.buildShape !== currentBuildShape)
209
+ return 'shape';
210
+ if (!Array.isArray(snapshot.rows) || snapshot.rows.length === 0)
211
+ return 'empty';
212
+ if (!Array.isArray(snapshot.refTips) ||
213
+ snapshot.refTips.some(t => !Array.isArray(t) || t.length !== 2 || typeof t[0] !== 'string' || typeof t[1] !== 'string')) {
214
+ return 'tips';
215
+ }
216
+ // Each row must be structurally sane — a corrupt row poisons the seed / stitch math. Duplicate shas break
217
+ // the ids set / stitch dedup (they'd re-appear as "already seen"), so reject them too.
218
+ const seenShas = new Set();
219
+ for (const row of snapshot.rows) {
220
+ if (row == null || typeof row.sha !== 'string' || !Array.isArray(row.parents) || typeof row.date !== 'number') {
221
+ return 'rows';
222
+ }
223
+ if (seenShas.has(row.sha))
224
+ return 'rows';
225
+ seenShas.add(row.sha);
226
+ }
227
+ // Every row's `reachabilityIndex` must be a valid index into the table's `sets` (the decode reads it
228
+ // directly). Guards against a truncated table / mismatched pairing.
229
+ const reachability = snapshot.reachability;
230
+ if (reachability != null && (!Array.isArray(reachability.sets) || !Array.isArray(reachability.dictionary))) {
231
+ return 'reachability';
232
+ }
233
+ const setCount = reachability?.sets?.length ?? 0;
234
+ for (const row of snapshot.rows) {
235
+ const index = row.contexts?.reachabilityIndex;
236
+ if (index != null && (!Number.isInteger(index) || index < 0 || index >= setCount))
237
+ return 'reachability';
238
+ }
239
+ // Downstreams must be `[upstream name, tracking branch names]` entries (reconstructed into a Map on restore).
240
+ if (!Array.isArray(snapshot.downstreams) ||
241
+ snapshot.downstreams.some(d => !Array.isArray(d) || d.length !== 2 || typeof d[0] !== 'string' || !Array.isArray(d[1]))) {
242
+ return 'downstreams';
243
+ }
244
+ // Per-sha stats, when present, must be `[sha, stats-object]` entries (reconstructed into a Map on restore).
245
+ if (snapshot.rowsStats != null &&
246
+ (!Array.isArray(snapshot.rowsStats) ||
247
+ snapshot.rowsStats.some(s => !Array.isArray(s) ||
248
+ s.length !== 2 ||
249
+ typeof s[0] !== 'string' ||
250
+ typeof s[1] !== 'object' ||
251
+ s[1] == null))) {
252
+ return 'rowsStats';
253
+ }
254
+ return undefined;
255
+ }
256
+ /**
257
+ * Reconstruct a persisted snapshot into the synthetic `GitGraph` a {@link GraphSession.restore} hands to its
258
+ * immediate refresh as the PRIOR generation — carrying exactly the fields the refresh's seed construction +
259
+ * change-diffing read (`refTips`, `reachability`, `rowsStats`, `downstreams`, `paging.hasMore`). Avatars are
260
+ * deliberately empty: resolved avatar URLs are webview-instance-bound and don't survive a restart, so the
261
+ * refresh re-derives them (and the write-once merge over an empty prior map is a no-op). The side-queried
262
+ * collections (`branches`/`remotes`/`stashes`/`worktrees`) aren't read by the refresh, so they're left empty.
263
+ */
264
+ function buildRestoredGraph(snapshot) {
265
+ return {
266
+ repoPath: snapshot.repoPath,
267
+ avatars: new Map(),
268
+ ids: new Set(snapshot.rows.map(r => r.sha)),
269
+ includes: snapshot.includesStats ? { stats: true } : undefined,
270
+ branches: new Map(),
271
+ remotes: new Map(),
272
+ downstreams: new Map(snapshot.downstreams),
273
+ stashes: undefined,
274
+ worktrees: undefined,
275
+ worktreesByBranch: undefined,
276
+ reachability: snapshot.reachability,
277
+ refTips: new Map(snapshot.refTips),
278
+ decorationFingerprint: snapshot.decorationFingerprint,
279
+ shallow: snapshot.shallow,
280
+ rows: snapshot.rows,
281
+ rowsStats: snapshot.rowsStats != null ? new Map(snapshot.rowsStats) : undefined,
282
+ paging: { limit: snapshot.rows.length, startingCursor: undefined, hasMore: snapshot.hasMore },
283
+ };
284
+ }
78
285
  export class GraphGitSubProvider {
79
286
  context;
80
287
  git;
@@ -86,6 +293,82 @@ export class GraphGitSubProvider {
86
293
  this.cache = cache;
87
294
  this.provider = provider;
88
295
  }
296
+ /**
297
+ * Current ref tips (canonical refname → PEELED commit sha), for the R6b fast path's gate. Peeled so an
298
+ * annotated tag maps to the commit its badge sits on — the same convention {@link GraphIncrementalSeed.tips}
299
+ * uses — and so the seed↔current diff is by commit identity. Skips nothing; the caller filters to the
300
+ * moveable ref classes it cares about.
301
+ */
302
+ async getCurrentRefTips(repoPath, cancellation) {
303
+ const result = await this.git.run({ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, errors: 'ignore' }, 'for-each-ref', '--format=%(objectname) %(*objectname) %(refname)');
304
+ const tips = new Map();
305
+ for (const line of result.stdout.split('\n')) {
306
+ // `<objectname> <peeled-objectname-or-empty> <refname>`; peeled is set only for annotated tags.
307
+ const match = /^(\S+) (\S*) (.+)$/.exec(line);
308
+ if (match == null)
309
+ continue;
310
+ tips.set(match[3], match[2] || match[1]);
311
+ }
312
+ return tips;
313
+ }
314
+ /**
315
+ * Whether the repo is a SHALLOW clone right now (a `$GIT_DIR/shallow` file exists). `git` resolves the git
316
+ * dir itself (correct in worktrees / bare / separate git-dirs), so this makes no `.git`-is-a-dir assumption.
317
+ * Returned as {@link GitGraph.shallow} and diffed by the R6b fast path's gate — an un-shallow (or re-shallow)
318
+ * while the graph was closed leaves every branch tip put yet changes what history exists below the window.
319
+ * Errors ignored → treated as NOT shallow: a git too old for `--is-shallow-repository` degrades to no-op
320
+ * detection (consistent on both the seed and the current side, so the gate can't over-fire), and a transient
321
+ * read error biases toward `false`, which — when the seed was shallow — only forces a SAFE full-walk fallback.
322
+ */
323
+ async getShallowState(repoPath, cancellation) {
324
+ const result = await this.git.run({ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, errors: 'ignore' }, 'rev-parse', '--is-shallow-repository');
325
+ return result.stdout.trim() === 'true';
326
+ }
327
+ /** Whether `oldSha` is an ancestor of `newSha` (i.e. the ref moved fast-forward). */
328
+ async isFastForward(repoPath, oldSha, newSha, cancellation) {
329
+ const result = await this.git.run({ cwd: repoPath, cancellation: cancellation, errors: 'ignore' }, 'merge-base', '--is-ancestor', oldSha, newSha);
330
+ return result.exitCode === 0;
331
+ }
332
+ async openGraphSession(repoPath, options, cancellation) {
333
+ // The session computes the walk shape (`ordering|onlyFollowFirstParent`) the SAME way `getGraph`
334
+ // derives it, so it can gate its incremental seed on a shape change (which reshapes every row's
335
+ // parents/order) exactly as the host's former `_graphBuildShape` gate did.
336
+ const getWalkShape = () => {
337
+ const cfg = this.context.config;
338
+ return {
339
+ ordering: cfg?.graph?.commitOrdering ?? cfg?.commits.ordering ?? 'date',
340
+ onlyFollowFirstParent: cfg?.graph?.onlyFollowFirstParent ?? false,
341
+ };
342
+ };
343
+ const session = new GraphSession(this, repoPath, options?.rowProcessor, getWalkShape);
344
+ // R7c restart persistence: seed from a persisted snapshot when it's structurally valid for THIS repo +
345
+ // walk shape, then immediately refresh (the snapshot is exactly an R6 seed — enumeration + the tip/FF/
346
+ // stash gates reconcile a stale one). Any validation failure discards it and falls through to a normal
347
+ // initial walk. Never trusted over git.
348
+ const restore = options?.restore;
349
+ if (restore != null) {
350
+ const shape = getWalkShape();
351
+ const reason = validateGraphSnapshot(restore, repoPath, buildShapeKey(shape));
352
+ if (reason == null) {
353
+ try {
354
+ const refresh = await session.restore(restore, options, cancellation);
355
+ options?.onRestore?.({ restored: true, rows: restore.rows.length, refresh: refresh });
356
+ return session;
357
+ }
358
+ catch {
359
+ // Belt-and-suspenders: structural validation can't catch a snapshot that reconstructs but
360
+ // throws in the restore's refresh (e.g. a garbage rev its enumerate chokes on). A corrupt
361
+ // cache must degrade to a full walk, never crash the open — report a miss and fall through.
362
+ options?.onRestore?.({ restored: false, reason: 'corrupt' });
363
+ }
364
+ }
365
+ else {
366
+ options?.onRestore?.({ restored: false, reason: reason });
367
+ }
368
+ }
369
+ await session.initialize(options, cancellation);
370
+ return session;
371
+ }
89
372
  async getGraph(repoPath, rev, options, cancellation) {
90
373
  const scope = getScopedLogger();
91
374
  const cfg = this.context.config;
@@ -93,14 +376,67 @@ export class GraphGitSubProvider {
93
376
  const ordering = cfg?.graph?.commitOrdering ?? cfg?.commits.ordering ?? 'date';
94
377
  const onlyFollowFirstParent = cfg?.graph?.onlyFollowFirstParent ?? false;
95
378
  const deferStats = options?.include?.stats;
379
+ // `let`: cleared before the fallback walk when the fast path bailed for a parent-rewriting reason
380
+ // (unshallow / replace-ref change) — those alter boundary commits' true diffs, so per-sha stats
381
+ // carried from the prior generation may be stale and must recompute.
382
+ let rowsStatsSeed = options?.rowsStatsSeed;
96
383
  const parser = getGraphParser(options?.include?.stats && !deferStats);
97
384
  const shaParser = getShaLogParser();
98
385
  const statsParser = getShaAndStatsLogParser();
99
- const [shaResult, stashResult, branchesResult, remotesResult, currentUserResult, worktreesResult] = await Promise.allSettled([
386
+ const stashPromise = this.provider.stash?.getStash(repoPath, { includeFiles: false }, cancellation);
387
+ // Pre-BUILD the first walk's stream as soon as the stash list (the spawn's only argv/stdin
388
+ // input) resolves. NOTE: `git.stream` is a lazy async generator — the process does NOT spawn
389
+ // until the walk loop's first iteration, so this achieves argv/stdin PREPARATION overlap only,
390
+ // not the git-startup overlap the original design intended (make the spawn eager — priming the
391
+ // generator — or delete this seam; tracked as a follow-up). Consumed exactly once by the first
392
+ // `getCommitsForGraphCore` call; never iterated = never spawned, so an unconsumed pre-build
393
+ // (fast-path win, error fallback) leaks nothing.
394
+ const prespawnAborter = new AbortController();
395
+ const onPrespawnCancel = () => prespawnAborter.abort();
396
+ cancellation?.addEventListener('abort', onPrespawnCancel, { once: true });
397
+ // An ALREADY-aborted signal never fires listeners added after the fact — propagate it by hand.
398
+ if (cancellation?.aborted) {
399
+ onPrespawnCancel();
400
+ }
401
+ let prespawn = (async () => {
402
+ try {
403
+ const gitStash = await stashPromise;
404
+ const { stdin } = convertStashesToStdin(gitStash?.stashes);
405
+ const args = ['log', ...parser.arguments, `--${ordering}-order`, '--all'];
406
+ if (stdin) {
407
+ args.push('--stdin');
408
+ }
409
+ if (onlyFollowFirstParent) {
410
+ args.push('--first-parent');
411
+ }
412
+ const stream = this.git.stream({
413
+ cwd: repoPath,
414
+ configs: gitConfigsLog,
415
+ cancellation: prespawnAborter.signal,
416
+ stdin: stdin,
417
+ // See the walk spawn below for why GIT_FLUSH=0.
418
+ env: { GIT_FLUSH: '0' },
419
+ }, ...args, '--');
420
+ return { stream: stream };
421
+ }
422
+ catch {
423
+ return undefined;
424
+ }
425
+ })();
426
+ // Current ref tips (peeled), captured ONCE at walk entry, overlapped with the rest of the prelude (a
427
+ // single `for-each-ref`, off the rows-walk critical path). Attached to the returned graph as `refTips`
428
+ // so the host can seed the NEXT rebuild's tip diff; the R6b fast path also reuses this same map for its
429
+ // own tip-diff gate (so there's exactly one `for-each-ref` per call whether it goes fast or full).
430
+ const refTipsPromise = this.getCurrentRefTips(repoPath, cancellation);
431
+ // Shallow state (peeled off the same prelude, off the rows-walk critical path) — stamped on the returned
432
+ // graph so the NEXT rebuild's seed can gate on an un-shallow/re-shallow, and reused by the R6b fast path's
433
+ // own shallow gate (one `rev-parse` per call whether it goes fast or full).
434
+ const shallowPromise = this.getShallowState(repoPath, cancellation);
435
+ const [shaResult, stashResult, branchesResult, remotesResult, currentUserResult, worktreesResult, defaultBranchResult,] = await Promise.allSettled([
100
436
  !isUncommitted(rev, true)
101
437
  ? this.git.run({ cwd: repoPath, configs: gitConfigsLog }, 'log', ...shaParser.arguments, '-n1', rev ?? 'HEAD', '--')
102
438
  : undefined,
103
- this.provider.stash?.getStash(repoPath, { includeFiles: false }, cancellation),
439
+ stashPromise,
104
440
  this.provider.branches.getBranches(repoPath, undefined, cancellation),
105
441
  this.provider.remotes.getRemotes(repoPath, undefined, cancellation),
106
442
  this.provider.config.getCurrentUser(repoPath),
@@ -110,12 +446,19 @@ export class GraphGitSubProvider {
110
446
  w,
111
447
  groupWorktreesByBranch(w, { includeDefault: true }),
112
448
  ]),
449
+ // Local-only: never contact the remote on the graph's hot fetch path. `isDefault` is additive,
450
+ // so it's simply absent until a background networked caller resolves origin/HEAD.
451
+ this.provider.branches.getDefaultBranchName(repoPath, undefined, { local: true }, cancellation),
113
452
  ]);
114
453
  const branches = getSettledValue(branchesResult)?.values;
115
454
  const branchMap = branches != null ? new Map(branches.map(r => [r.name, r])) : new Map();
116
455
  const headBranch = branches?.find(b => b.current);
117
456
  const headRefUpstreamName = headBranch?.upstream?.name;
118
457
  const [worktrees, worktreesByBranch] = getSettledValue(worktreesResult) ?? [[], new Map()];
458
+ // The repo's default branch (e.g. `origin/main`) reduced to its local branch name (`main`) so it
459
+ // can be matched against each local head's `tip` to flag the default-branch head additively.
460
+ const defaultBranchName = getSettledValue(defaultBranchResult);
461
+ const defaultLocalName = defaultBranchName != null ? getBranchNameWithoutRemote(defaultBranchName) : undefined;
119
462
  let branchIdOfMainWorktree;
120
463
  let mainWorktree;
121
464
  if (worktreesByBranch != null) {
@@ -131,8 +474,17 @@ export class GraphGitSubProvider {
131
474
  const currentUser = getSettledValue(currentUserResult);
132
475
  const remotes = getSettledValue(remotesResult);
133
476
  const remoteMap = remotes != null ? new Map(remotes.map(r => [r.name, r])) : new Map();
477
+ // Decoration side inputs, fingerprinted for the NEXT rebuild's metadata gate (and compared against
478
+ // the seed's by this call's fast path). Computed from the prelude's fresh queries — the same values
479
+ // row construction below embeds into row decorations.
480
+ const decorationFingerprint = computeDecorationFingerprint(repoPath, defaultBranchName, defaultLocalName, headRefUpstreamName, branches, remotes, worktrees, currentUser);
134
481
  const shas = getSettledValue(shaResult)?.stdout;
135
482
  const selectSha = shas != null ? first(shaParser.parse(shas)) : undefined;
483
+ // Resolved off the critical path (started in the prelude). Same map for the full walk's `refTips`, the
484
+ // fast path's tip-diff gate, and the fast path's `refTips`. Never rejects (errors ignored → empty map).
485
+ const refTips = await refTipsPromise;
486
+ // Same value for the full walk's `shallow`, the fast path's shallow gate, and the fast path's `shallow`.
487
+ const shallow = await shallowPromise;
136
488
  const downstreamMap = new Map();
137
489
  // There *HAS* to be a better way to get git log to return stashes, but this is the best we've found
138
490
  const gitStash = getSettledValue(stashResult);
@@ -176,9 +528,26 @@ export class GraphGitSubProvider {
176
528
  // commits. Per-row ref arrays are NOT retained — each row keeps only its set index
177
529
  // (`contexts.reachabilityIndex`), and the working `reachableRefs` entry is dropped once emitted.
178
530
  // The encoder lives next to its decoder in `reachability.utils` so the wire format can't drift.
179
- const reachabilityBuilder = createReachabilityTableBuilder();
531
+ // A caller-supplied seed CONTINUES the prior generation's table (same id, stable indices) so
532
+ // rows retained across a rebuild keep valid `reachabilityIndex` values.
533
+ const reachabilityBuilder = createReachabilityTableBuilder(options?.reachabilitySeed);
534
+ // Set-index cache keyed by the working ref-map INSTANCE: the propagation below transfers a
535
+ // row's map wholesale to its (first) parent, so an entire chain interns the same object —
536
+ // one real intern per chain instead of one per row. Maps only ever GROW (ref seeding adds
537
+ // entries), so an unchanged size proves the cached index is still exact.
538
+ const internCache = new WeakMap();
180
539
  function finalizeRowReachability(row, sha, refs) {
181
- const setIndex = reachabilityBuilder.intern(refs?.values());
540
+ let setIndex;
541
+ const cached = refs != null ? internCache.get(refs) : undefined;
542
+ if (cached != null && cached.size === refs.size) {
543
+ setIndex = cached.index;
544
+ }
545
+ else {
546
+ setIndex = reachabilityBuilder.intern(refs?.values());
547
+ if (refs != null) {
548
+ internCache.set(refs, { size: refs.size, index: setIndex });
549
+ }
550
+ }
182
551
  if (setIndex != null) {
183
552
  (row.contexts ??= {}).reachabilityIndex = setIndex;
184
553
  }
@@ -192,6 +561,338 @@ export class GraphGitSubProvider {
192
561
  let pendingRowsStatsCount = 0;
193
562
  let iterations = 0;
194
563
  let total = 0;
564
+ // Hoisted so the ordered walk AND the R6b incremental fast path share one context. It holds the
565
+ // outer accumulator sets BY REFERENCE (they mutate in place across `more()` pagination / replay), so
566
+ // building it once is equivalent to the prior per-call construction.
567
+ const rowProcessor = options?.rowProcessor;
568
+ const graphCtx = rowProcessor != null
569
+ ? {
570
+ repoPath: repoPath,
571
+ useAvatars: cfg?.graph?.avatars ?? true,
572
+ branches: branchMap,
573
+ remotes: remoteMap,
574
+ worktreesByBranch: worktreesByBranch,
575
+ branchIdOfMainWorktree: branchIdOfMainWorktree,
576
+ stashes: gitStash?.stashes,
577
+ reachableFromHEAD: reachableFromHEAD,
578
+ rewriteableFromHEAD: rewriteableFromHEAD,
579
+ tipShasWithChildren: tipShasWithChildren,
580
+ // `undefined` when HEAD has no upstream, so the processor flags nothing as
581
+ // unpublished; otherwise the live set (mutated during the walk, read by ref).
582
+ reachableFromHeadUpstream: headRefUpstreamName != null ? reachableFromHeadUpstream : undefined,
583
+ avatars: avatars,
584
+ }
585
+ : undefined;
586
+ // Parses one commit record into a row (ref badges, parents, stash vs commit) but performs NO
587
+ // reachability/HEAD/downstream accumulation — that half lives in `accumulateRowState`, so the ordered
588
+ // walk and the fast path (which replays accumulation over reused rows, deriving ref lists from their
589
+ // own decoration) share one propagation implementation. Returns `undefined` when the record dedups to
590
+ // an already-seen remapped-stash sha. Faithful extraction of the walk's former inline body — must stay
591
+ // byte-identical to it (the equivalence harness pins this).
592
+ function buildRowFromCommit(commit) {
593
+ total++;
594
+ let shaOrRemapped = remappedIds.get(commit.sha);
595
+ if (shaOrRemapped && ids.has(shaOrRemapped))
596
+ return undefined;
597
+ shaOrRemapped ??= commit.sha;
598
+ ids.add(shaOrRemapped);
599
+ const refHeads = [];
600
+ const refRemoteHeads = [];
601
+ const refTags = [];
602
+ // `head` is per-tip (drives `isCurrentHead` on the branch it decorates); `sawHead` sticks once ANY
603
+ // tip is HEAD so `accumulateRowState` seeds `reachableFromHEAD` even when HEAD isn't the last tip.
604
+ let head = false;
605
+ let sawHead = false;
606
+ if (commit.tips) {
607
+ for (let tip of commit.tips.split(', ')) {
608
+ head = false;
609
+ if (tip === 'refs/stash')
610
+ continue;
611
+ if (tip.startsWith('tag: ')) {
612
+ const tagName = tip.substring(5);
613
+ refTags.push({
614
+ id: getTagId(repoPath, tagName),
615
+ name: tagName,
616
+ // Not currently used, so don't bother looking it up
617
+ annotated: true,
618
+ });
619
+ continue;
620
+ }
621
+ if (tip.startsWith('HEAD')) {
622
+ head = true;
623
+ sawHead = true;
624
+ if (tip !== 'HEAD') {
625
+ tip = tip.substring(8);
626
+ }
627
+ }
628
+ const remoteName = getRemoteNameFromBranchName(tip);
629
+ if (remoteName) {
630
+ const remote = remoteMap.get(remoteName);
631
+ if (remote != null) {
632
+ const branchName = getBranchNameWithoutRemote(tip);
633
+ if (branchName === 'HEAD')
634
+ continue;
635
+ refRemoteHeads.push({
636
+ id: getBranchId(repoPath, true, tip),
637
+ name: branchName,
638
+ owner: remote.name,
639
+ url: remote.url,
640
+ current: tip === headRefUpstreamName,
641
+ // `defaultLocalName!` is non-null here because `tip === defaultBranchName` short-circuits when `defaultBranchName` is null.
642
+ isDefault: tip === defaultBranchName && !branchMap.has(defaultLocalName),
643
+ hostingServiceType: remote.provider?.gkProviderId,
644
+ });
645
+ continue;
646
+ }
647
+ }
648
+ const branch = branchMap.get(tip);
649
+ const branchId = branch?.id ?? getBranchId(repoPath, false, tip);
650
+ // `worktreesByBranch` has the main/default worktree removed, so recover it here.
651
+ const worktree = worktreesByBranch?.get(branchId) ??
652
+ (branchId === branchIdOfMainWorktree ? mainWorktree : undefined);
653
+ const worktreeRef = worktree != null
654
+ ? { id: getWorktreeId(repoPath, worktree.name), path: worktree.path }
655
+ : undefined;
656
+ refHeads.push({
657
+ id: branchId,
658
+ name: tip,
659
+ isCurrentHead: head,
660
+ upstream: branch?.upstream != null
661
+ ? { name: branch.upstream.name, id: getBranchId(repoPath, true, branch.upstream.name) }
662
+ : undefined,
663
+ worktree: worktreeRef,
664
+ worktreeId: worktree?.isDefault === false ? worktreeRef?.id : undefined,
665
+ isDefault: defaultLocalName != null && tip === defaultLocalName,
666
+ });
667
+ }
668
+ }
669
+ const parents = commit.parents ? commit.parents.split(' ') : [];
670
+ const stash = gitStash?.stashes.get(shaOrRemapped);
671
+ let row;
672
+ if (stash != null) {
673
+ row = {
674
+ sha: shaOrRemapped,
675
+ // Always only return the first parent for stashes, as it is a Git implementation for the index and untracked files
676
+ parents: parents.slice(0, 1),
677
+ author: currentUser?.name ?? commit.author,
678
+ email: commit.authorEmail,
679
+ date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
680
+ commitDate: Number(commit.committerDate) * 1000,
681
+ message: (stash.message ?? commit.message).trim(),
682
+ type: 'stash-node',
683
+ heads: refHeads,
684
+ remotes: refRemoteHeads,
685
+ tags: refTags,
686
+ isCurrentUser: true,
687
+ };
688
+ // Don't seed `rowStats` from `stash.stats` here: the graph's stash list is fetched with
689
+ // `includeFiles: false`, so the commit model SYNTHESIZES a zero-stats object from its empty
690
+ // fileset — seeding it marks the stash "covered" and permanently blanks it. The deferred
691
+ // stats pass owns stash stats (first-parent diff, keyed by stash sha).
692
+ }
693
+ else {
694
+ const isCurrentUser = isUserMatch(currentUser, commit.author, commit.authorEmail);
695
+ row = {
696
+ sha: shaOrRemapped,
697
+ parents: onlyFollowFirstParent ? parents.slice(0, 1) : parents,
698
+ author: commit.author,
699
+ email: commit.authorEmail,
700
+ date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
701
+ commitDate: Number(commit.committerDate) * 1000,
702
+ message: commit.message.trim(),
703
+ type: parents.length > 1 ? 'merge-node' : 'commit-node',
704
+ heads: refHeads,
705
+ remotes: refRemoteHeads,
706
+ tags: refTags,
707
+ isCurrentUser: isCurrentUser || undefined,
708
+ };
709
+ if (commit.stats != null) {
710
+ rowStats.set(shaOrRemapped, commit.stats);
711
+ }
712
+ }
713
+ return {
714
+ row: row,
715
+ refHeads: refHeads,
716
+ refRemoteHeads: refRemoteHeads,
717
+ refTags: refTags,
718
+ head: sawHead,
719
+ parents: parents,
720
+ };
721
+ }
722
+ // The propagation half of the walk, factored out so the fast path can replay it in memory over reused
723
+ // rows (passing their own `heads`/`remotes`/`tags` as the ref lists and their full `parents`). Mutates
724
+ // the shared reachability/HEAD/downstream accumulators and returns the row's post-propagation
725
+ // reachable-ref map (for interning + flag derivation). `parents` is the FULL parent list (the walk
726
+ // always propagates through every parent, even when the emitted row stores a sliced set). Faithful
727
+ // extraction of the walk's former inline body — must stay byte-identical to it.
728
+ function accumulateRowState(sha, parents, refHeads, refRemoteHeads, refTags, head, isStash) {
729
+ if (head) {
730
+ reachableFromHEAD.add(sha);
731
+ headSha ??= sha;
732
+ }
733
+ if (reachableFromHEAD.has(sha)) {
734
+ for (const parent of parents) {
735
+ reachableFromHEAD.add(parent);
736
+ }
737
+ }
738
+ // First-parent rewriteable chain from HEAD (see the field's declaration for the full rationale).
739
+ if (sha === headSha || sha === rewriteableNextSha) {
740
+ if (parents.length === 1) {
741
+ rewriteableFromHEAD.add(sha);
742
+ rewriteableNextSha = parents[0];
743
+ }
744
+ else {
745
+ rewriteableNextSha = undefined;
746
+ }
747
+ }
748
+ // A remote head with `current` set IS HEAD's tracking upstream tip (see `buildRowFromCommit`).
749
+ if (refRemoteHeads.some(r => r.current)) {
750
+ reachableFromHeadUpstream.add(sha);
751
+ }
752
+ if (reachableFromHeadUpstream.has(sha)) {
753
+ for (const parent of parents) {
754
+ reachableFromHeadUpstream.add(parent);
755
+ }
756
+ }
757
+ // Seed reachability from all ref types on this commit.
758
+ if (refHeads.length > 0 || refRemoteHeads.length > 0 || refTags.length > 0) {
759
+ let refs = reachableRefs.get(sha);
760
+ if (refs == null) {
761
+ refs = new Map();
762
+ reachableRefs.set(sha, refs);
763
+ }
764
+ for (const h of refHeads) {
765
+ refs.set(`b:${h.name}`, {
766
+ refType: 'branch',
767
+ name: h.name,
768
+ remote: false,
769
+ current: h.isCurrentHead,
770
+ });
771
+ }
772
+ for (const r of refRemoteHeads) {
773
+ const name = `${r.owner}/${r.name}`;
774
+ refs.set(`r:${name}`, { refType: 'branch', name: name, remote: true });
775
+ }
776
+ for (const t of refTags) {
777
+ refs.set(`t:${t.name}`, { refType: 'tag', name: t.name });
778
+ }
779
+ }
780
+ // Propagate reachability to parents (ownership-transfer fast path; see the `reachableRefs`
781
+ // declaration + `finalizeRowReachability` for why the first childless parent may alias the map).
782
+ const currentRefs = reachableRefs.get(sha);
783
+ if (currentRefs != null && currentRefs.size > 0) {
784
+ let transferred = false;
785
+ for (const parent of parents) {
786
+ const parentRefs = reachableRefs.get(parent);
787
+ if (parentRefs == null) {
788
+ if (transferred) {
789
+ reachableRefs.set(parent, new Map(currentRefs));
790
+ }
791
+ else {
792
+ transferred = true;
793
+ reachableRefs.set(parent, currentRefs);
794
+ }
795
+ continue;
796
+ }
797
+ for (const [key, ref] of currentRefs) {
798
+ if (!parentRefs.has(key)) {
799
+ parentRefs.set(key, ref);
800
+ }
801
+ }
802
+ }
803
+ }
804
+ // Mark any undo-eligible tip that THIS non-stash commit builds on as non-leaf (stash rows excluded).
805
+ if (!isStash) {
806
+ for (const parent of parents) {
807
+ if (undoableTipShas.has(parent)) {
808
+ tipShasWithChildren.add(parent);
809
+ }
810
+ }
811
+ }
812
+ // Downstreams: each branch tip → its upstream name.
813
+ for (const h of refHeads) {
814
+ if (h.upstream?.name != null) {
815
+ let downstreams = downstreamMap.get(h.upstream.name);
816
+ if (downstreams == null) {
817
+ downstreams = [];
818
+ downstreamMap.set(h.upstream.name, downstreams);
819
+ }
820
+ downstreams.push(h.name);
821
+ }
822
+ }
823
+ return reachableRefs.get(sha);
824
+ }
825
+ // Builds the deferred `--shortstat` query for the given rows (only shas the seed doesn't cover),
826
+ // shared by the ordered walk and the fast path. Increments `pendingRowsStatsCount` and resolves it
827
+ // when the background query completes; returns `undefined` when stats aren't requested.
828
+ const buildRowsStatsDeferred = (rows) => {
829
+ if (!deferStats)
830
+ return undefined;
831
+ pendingRowsStatsCount++;
832
+ // oxlint-disable-next-line no-async-promise-executor
833
+ const promise = new Promise(async (resolve) => {
834
+ try {
835
+ // Stats are immutable per sha — only query shas the seed doesn't already cover.
836
+ let missingStdin = '';
837
+ let missingStashStdin = '';
838
+ for (const row of rows) {
839
+ if (rowStats.has(row.sha))
840
+ continue;
841
+ const seeded = rowsStatsSeed?.get(row.sha);
842
+ if (seeded != null) {
843
+ rowStats.set(row.sha, seeded);
844
+ continue;
845
+ }
846
+ if (row.type === 'stash-node') {
847
+ missingStashStdin += `${row.sha}\n`;
848
+ }
849
+ else {
850
+ missingStdin += `${row.sha}\n`;
851
+ }
852
+ }
853
+ // Fully seeded — nothing new to compute, so no git process at all.
854
+ if (!missingStdin && !missingStashStdin)
855
+ return;
856
+ // A stash is a merge commit, so its own shortstat record is empty. Stashes get their own
857
+ // query diffed against the first parent (`-m --first-parent` — what `git stash show`
858
+ // reports), keyed directly by stash sha: no parent remapping, so none of the old
859
+ // `--no-walk` time-order races that could let the empty record win and blank the stash.
860
+ const [statsResult, stashStatsResult] = await Promise.allSettled([
861
+ missingStdin
862
+ ? this.git.run({
863
+ cwd: repoPath,
864
+ configs: gitConfigsLog,
865
+ stdin: missingStdin,
866
+ priority: 'background',
867
+ }, 'log', '--no-walk', '--stdin', ...statsParser.arguments, '--')
868
+ : undefined,
869
+ missingStashStdin
870
+ ? this.git.run({
871
+ cwd: repoPath,
872
+ configs: gitConfigsLog,
873
+ stdin: missingStashStdin,
874
+ priority: 'background',
875
+ }, 'log', '--no-walk', '--stdin', '-m', '--first-parent', ...statsParser.arguments, '--')
876
+ : undefined,
877
+ ]);
878
+ for (const result of [getSettledValue(statsResult), getSettledValue(stashStatsResult)]) {
879
+ if (!result?.stdout)
880
+ continue;
881
+ for (const stat of statsParser.parse(result.stdout)) {
882
+ // Don't overwrite stats already populated for this sha
883
+ if (rowStats.has(stat.sha))
884
+ continue;
885
+ rowStats.set(stat.sha, stat.stats);
886
+ }
887
+ }
888
+ }
889
+ finally {
890
+ pendingRowsStatsCount--;
891
+ resolve();
892
+ }
893
+ });
894
+ return { isLoaded: () => pendingRowsStatsCount === 0, promise: promise };
895
+ };
195
896
  const args = ['log', ...parser.arguments, `--${ordering}-order`, '--all'];
196
897
  if (stdin) {
197
898
  args.push('--stdin');
@@ -204,349 +905,89 @@ export class GraphGitSubProvider {
204
905
  const env_1 = { stack: [], error: void 0, hasError: false };
205
906
  try {
206
907
  iterations++;
207
- const startTotal = total;
208
- const aborter = new AbortController();
908
+ // Consume the pre-spawned first walk when available (argv identical by construction:
909
+ // no cursor on the first call); paging/retry calls spawn normally. The pre-spawn's
910
+ // aborter doubles as this call's so the limit-stop kills the right process.
911
+ const prespawned = cursor == null && prespawn != null ? await prespawn : undefined;
912
+ prespawn = undefined;
913
+ const aborter = prespawned != null ? prespawnAborter : new AbortController();
209
914
  const onAbort = () => {
210
915
  aborter.abort();
211
916
  };
212
917
  cancellation?.addEventListener('abort', onAbort, { once: true });
918
+ // An ALREADY-aborted signal (e.g. `toAbortSignal` of a cancelled token) never fires listeners
919
+ // added after the fact — without this the walk would run to completion unabortably.
920
+ if (cancellation?.aborted) {
921
+ onAbort();
922
+ }
213
923
  const _disposable = __addDisposableResource(env_1, createDisposable(() => cancellation?.removeEventListener('abort', onAbort)), false);
214
- const stream = this.git.stream({ cwd: repoPath, configs: gitConfigsLog, cancellation: aborter.signal, stdin: stdin }, ...args, cursor?.skip ? `--skip=${cursor.skip}` : undefined, '--');
924
+ const stream = prespawned?.stream ??
925
+ this.git.stream({
926
+ cwd: repoPath,
927
+ configs: gitConfigsLog,
928
+ cancellation: aborter.signal,
929
+ stdin: stdin,
930
+ // Git flushes stdout per record to a pipe, producing thousands of tiny chunks the
931
+ // node side must individually await. Full stdio buffering delivers the same bytes
932
+ // in far fewer, larger chunks — right for this bulk walk (an incremental consumer
933
+ // wanting per-record latency should NOT set this).
934
+ env: { GIT_FLUSH: '0' },
935
+ }, ...args, cursor?.skip ? `--skip=${cursor.skip}` : undefined, '--');
215
936
  const _streamDisposer = __addDisposableResource(env_1, createDisposable(() => void stream.return?.(undefined)), false);
216
937
  const rows = [];
217
- let branch;
218
- let branchId;
219
- let branchName;
220
- let head = false;
221
- let isCurrentUser = false;
222
- let refHead;
223
- let refHeads;
224
- let refRemoteHead;
225
- let refRemoteHeads;
226
- let refTag;
227
- let refTags;
228
- let parent;
229
- let parents;
230
- let remote;
231
- let remoteBranchId;
232
- let remoteName;
233
- let shaOrRemapped;
234
- let stash;
235
- let tagId;
236
- let tagName;
237
- let tip;
238
938
  let count = 0;
239
939
  let found = false;
240
940
  let hasMore = false;
241
- const rowProcessor = options?.rowProcessor;
242
- const graphCtx = rowProcessor != null
243
- ? {
244
- repoPath: repoPath,
245
- useAvatars: cfg?.graph?.avatars ?? true,
246
- branches: branchMap,
247
- remotes: remoteMap,
248
- worktreesByBranch: worktreesByBranch,
249
- branchIdOfMainWorktree: branchIdOfMainWorktree,
250
- stashes: gitStash?.stashes,
251
- reachableFromHEAD: reachableFromHEAD,
252
- rewriteableFromHEAD: rewriteableFromHEAD,
253
- tipShasWithChildren: tipShasWithChildren,
254
- // `undefined` when HEAD has no upstream, so the processor flags nothing as
255
- // unpublished; otherwise the live set (mutated during the walk, read by ref).
256
- reachableFromHeadUpstream: headRefUpstreamName != null ? reachableFromHeadUpstream : undefined,
257
- avatars: avatars,
258
- }
259
- : undefined;
260
- for await (const commit of parser.parseAsync(stream)) {
261
- // Stopping logic (check AFTER processing the commit):
262
- // - SHA + limit > 0: Find SHA, ensure at least `limit` commits loaded
263
- // - SHA + limit = 0: Find SHA, stop immediately
264
- // - No SHA + limit > 0: Load exactly `limit` commits
265
- // - No SHA + limit = 0: Load everything remaining
266
- // - SHA + limit > 0 + still unfound past 10× limit: defensive cap so an unreachable
267
- // SHA (e.g. a stale merge-base the webview hasn't yet seen invalidated) can't
268
- // walk the entire history. `hasMore=true` lets callers retry; the graph-wrapper
269
- // side deduplicates re-requests so the cap doesn't loop.
270
- if ((limit && count >= limit && (!sha || found || count >= limit * 10)) ||
271
- (!limit && sha && found)) {
272
- hasMore = true;
273
- aborter.abort();
274
- break;
275
- }
276
- if (sha && !found && commit.sha === sha) {
277
- found = true;
278
- }
279
- count++;
280
- if (ids.has(commit.sha))
281
- continue;
282
- total++;
283
- shaOrRemapped = remappedIds.get(commit.sha);
284
- if (shaOrRemapped && ids.has(shaOrRemapped))
285
- continue;
286
- shaOrRemapped ??= commit.sha;
287
- ids.add(shaOrRemapped);
288
- refHeads = [];
289
- refRemoteHeads = [];
290
- refTags = [];
291
- if (commit.tips) {
292
- for (tip of commit.tips.split(', ')) {
293
- head = false;
294
- if (tip === 'refs/stash')
295
- continue;
296
- if (tip.startsWith('tag: ')) {
297
- tagName = tip.substring(5);
298
- tagId = getTagId(repoPath, tagName);
299
- refTag = {
300
- id: tagId,
301
- name: tagName,
302
- // Not currently used, so don't bother looking it up
303
- annotated: true,
304
- };
305
- refTags.push(refTag);
306
- continue;
307
- }
308
- if (tip.startsWith('HEAD')) {
309
- head = true;
310
- reachableFromHEAD.add(shaOrRemapped);
311
- headSha ??= shaOrRemapped;
312
- if (tip !== 'HEAD') {
313
- tip = tip.substring(8);
314
- }
315
- }
316
- remoteName = getRemoteNameFromBranchName(tip);
317
- if (remoteName) {
318
- remote = remoteMap.get(remoteName);
319
- if (remote != null) {
320
- branchName = getBranchNameWithoutRemote(tip);
321
- if (branchName === 'HEAD')
322
- continue;
323
- remoteBranchId = getBranchId(repoPath, true, tip);
324
- const isHeadUpstream = tip === headRefUpstreamName;
325
- if (isHeadUpstream) {
326
- reachableFromHeadUpstream.add(shaOrRemapped);
327
- }
328
- refRemoteHead = {
329
- id: remoteBranchId,
330
- name: branchName,
331
- owner: remote.name,
332
- url: remote.url,
333
- current: isHeadUpstream,
334
- hostingServiceType: remote.provider?.gkProviderId,
335
- };
336
- refRemoteHeads.push(refRemoteHead);
337
- continue;
338
- }
339
- }
340
- branch = branchMap.get(tip);
341
- branchId = branch?.id ?? getBranchId(repoPath, false, tip);
342
- // `worktreesByBranch` has the main/default worktree removed (above), so recover it
343
- // here — Undo Commit needs to reach the main worktree's HEAD even when the active
344
- // workspace is a secondary worktree.
345
- const worktree = worktreesByBranch?.get(branchId) ??
346
- (branchId === branchIdOfMainWorktree ? mainWorktree : undefined);
347
- const worktreeRef = worktree != null
348
- ? { id: getWorktreeId(repoPath, worktree.name), path: worktree.path }
349
- : undefined;
350
- refHead = {
351
- id: branchId,
352
- name: tip,
353
- isCurrentHead: head,
354
- upstream: branch?.upstream != null
355
- ? {
356
- name: branch.upstream.name,
357
- id: getBranchId(repoPath, true, branch.upstream.name),
358
- }
359
- : undefined,
360
- worktree: worktreeRef,
361
- // Mirror `worktree.id` for `@gitkraken/gitkraken-components` — its bundled renderer
362
- // reads `head.worktreeId` to pick the WORKTREE vs HEAD ref-badge. Scope to NON-default
363
- // worktrees so the main checkout keeps its HEAD badge even though `worktree` (above)
364
- // is populated for it for Undo routing.
365
- worktreeId: worktree?.isDefault === false ? worktreeRef?.id : undefined,
366
- };
367
- refHeads.push(refHead);
368
- if (branch?.upstream?.name != null) {
369
- // Add the branch name (tip) to the upstream name entry in the downstreams map
370
- let downstreams = downstreamMap.get(branch.upstream.name);
371
- if (downstreams == null) {
372
- downstreams = [];
373
- downstreamMap.set(branch.upstream.name, downstreams);
374
- }
375
- downstreams.push(tip);
376
- }
941
+ // Batched parse when available: one awaited yield per stream chunk instead of two
942
+ // promise hops per record — the walk's async-iterator overhead collapses. The
943
+ // with-stats parser (unused here — stats are always deferred) has no batched mode,
944
+ // so wrap its per-record stream into singleton batches to keep one loop shape.
945
+ const batches = parser.parseAsyncBatched?.(stream) ??
946
+ (async function* (it) {
947
+ for await (const commit of it) {
948
+ yield [commit];
377
949
  }
378
- }
379
- parents = commit.parents ? commit.parents.split(' ') : [];
380
- if (reachableFromHEAD.has(shaOrRemapped)) {
381
- for (parent of parents) {
382
- reachableFromHEAD.add(parent);
950
+ })(parser.parseAsync(stream));
951
+ outer: for await (const batch of batches) {
952
+ for (const commit of batch) {
953
+ // Stopping logic (check AFTER processing the commit):
954
+ // - SHA + limit > 0: Find SHA, ensure at least `limit` commits loaded
955
+ // - SHA + limit = 0: Find SHA, stop immediately
956
+ // - No SHA + limit > 0: Load exactly `limit` commits
957
+ // - No SHA + limit = 0: Load everything remaining
958
+ // - SHA + limit > 0 + still unfound past 10× limit: defensive cap so an unreachable
959
+ // SHA (e.g. a stale merge-base the webview hasn't yet seen invalidated) can't
960
+ // walk the entire history. `hasMore=true` lets callers retry; the graph-wrapper
961
+ // side deduplicates re-requests so the cap doesn't loop.
962
+ if ((limit && count >= limit && (!sha || found || count >= limit * 10)) ||
963
+ (!limit && sha && found)) {
964
+ hasMore = true;
965
+ aborter.abort();
966
+ break outer;
383
967
  }
384
- }
385
- // First-parent rewriteable chain from HEAD: include each commit only while HEAD and
386
- // every commit down to it has exactly one parent. Stops at (excludes) the first merge
387
- // and the root — mirrors GitKraken's getDistinctCommitsFromHeadToFirstMergeCommit.
388
- // Off-chain commits (a merge's other-parent ancestry, or anything below the first merge)
389
- // are reachable-from-HEAD but NOT safely history-rewriteable by a plain interactive
390
- // rebase. Relies on the same "commit emitted before its parents" ordering as above.
391
- if (shaOrRemapped === headSha || shaOrRemapped === rewriteableNextSha) {
392
- if (parents.length === 1) {
393
- rewriteableFromHEAD.add(shaOrRemapped);
394
- rewriteableNextSha = parents[0];
395
- }
396
- else {
397
- // A merge (>1 parents) or the root (0 parents) terminates the chain.
398
- rewriteableNextSha = undefined;
399
- }
400
- }
401
- if (reachableFromHeadUpstream.has(shaOrRemapped)) {
402
- for (parent of parents) {
403
- reachableFromHeadUpstream.add(parent);
404
- }
405
- }
406
- // Seed reachability from all ref types on this commit
407
- if (refHeads.length > 0 || refRemoteHeads.length > 0 || refTags.length > 0) {
408
- let refs = reachableRefs.get(shaOrRemapped);
409
- if (refs == null) {
410
- refs = new Map();
411
- reachableRefs.set(shaOrRemapped, refs);
412
- }
413
- for (const h of refHeads) {
414
- const key = `b:${h.name}`;
415
- refs.set(key, { refType: 'branch', name: h.name, remote: false, current: h.isCurrentHead });
416
- }
417
- for (const r of refRemoteHeads) {
418
- const name = `${r.owner}/${r.name}`;
419
- refs.set(`r:${name}`, { refType: 'branch', name: name, remote: true });
420
- }
421
- for (const t of refTags) {
422
- refs.set(`t:${t.name}`, { refType: 'tag', name: t.name });
423
- }
424
- }
425
- // Propagate reachability to parents
426
- const currentRefs = reachableRefs.get(shaOrRemapped);
427
- if (currentRefs != null && currentRefs.size > 0) {
428
- for (parent of parents) {
429
- let parentRefs = reachableRefs.get(parent);
430
- if (parentRefs == null) {
431
- parentRefs = new Map();
432
- reachableRefs.set(parent, parentRefs);
433
- }
434
- for (const [key, ref] of currentRefs) {
435
- if (!parentRefs.has(key)) {
436
- parentRefs.set(key, ref);
437
- }
438
- }
439
- }
440
- }
441
- stash = gitStash?.stashes.get(shaOrRemapped);
442
- if (stash != null) {
443
- const refs = reachableRefs.get(shaOrRemapped);
444
- const row = {
445
- sha: shaOrRemapped,
446
- // Always only return the first parent for stashes, as it is a Git implementation for the index and untracked files
447
- parents: parents.slice(0, 1),
448
- author: currentUser?.name ?? commit.author,
449
- email: commit.authorEmail,
450
- date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
451
- commitDate: Number(commit.committerDate) * 1000,
452
- message: (stash.message ?? commit.message).trim(),
453
- type: 'stash-node',
454
- heads: refHeads,
455
- remotes: refRemoteHeads,
456
- tags: refTags,
457
- // Transient: the row processor's `+unique` decision reads this; stripped just below.
458
- // Unsorted (the consumer re-sorts after decoding) — order doesn't affect interning.
459
- reachability: refs?.size ? { partial: true, refs: [...refs.values()] } : undefined,
460
- isCurrentUser: true,
461
- };
462
- rowProcessor?.processRow(row, graphCtx);
463
- finalizeRowReachability(row, shaOrRemapped, refs);
464
- rows.push(row);
465
- if (stash.stats != null) {
466
- rowStats.set(shaOrRemapped, {
467
- files: getChangedFilesCount(stash.stats.files),
468
- additions: stash.stats.additions,
469
- deletions: stash.stats.deletions,
470
- });
471
- }
472
- }
473
- else {
474
- isCurrentUser = isUserMatch(currentUser, commit.author, commit.authorEmail);
475
- // Mark any undo-eligible tip that THIS (non-stash) commit builds on as non-leaf, so
476
- // its Undo Commit is withheld. Uses the full parent set (incl. merge second-parents)
477
- // but only records shas that are actually undo tips — newer commits are walked first,
478
- // so a tip is recorded before its own row is processed. Stash rows are intentionally
479
- // not handled here, so a stash based on a tip doesn't block undoing that tip.
480
- for (parent of parents) {
481
- if (undoableTipShas.has(parent)) {
482
- tipShasWithChildren.add(parent);
483
- }
968
+ if (sha && !found && commit.sha === sha) {
969
+ found = true;
484
970
  }
485
- const refs = reachableRefs.get(shaOrRemapped);
486
- const row = {
487
- sha: shaOrRemapped,
488
- parents: onlyFollowFirstParent ? parents.slice(0, 1) : parents,
489
- author: commit.author,
490
- email: commit.authorEmail,
491
- date: Number(ordering === 'author-date' ? commit.authorDate : commit.committerDate) * 1000,
492
- commitDate: Number(commit.committerDate) * 1000,
493
- message: commit.message.trim(),
494
- type: parents.length > 1 ? 'merge-node' : 'commit-node',
495
- heads: refHeads,
496
- remotes: refRemoteHeads,
497
- tags: refTags,
498
- // Transient: the row processor's `+unique` decision reads this; stripped just below.
499
- // Unsorted (the consumer re-sorts after decoding) — order doesn't affect interning.
500
- reachability: refs?.size ? { partial: true, refs: [...refs.values()] } : undefined,
501
- isCurrentUser: isCurrentUser || undefined,
502
- };
971
+ count++;
972
+ if (ids.has(commit.sha))
973
+ continue;
974
+ const built = buildRowFromCommit(commit);
975
+ if (built == null)
976
+ continue; // remapped-stash dedup
977
+ const { row, refHeads, refRemoteHeads, refTags, head, parents } = built;
978
+ const refs = accumulateRowState(row.sha, parents, refHeads, refRemoteHeads, refTags, head, row.type === 'stash-node');
979
+ // Transient: the row processor's `+unique` decision reads this; stripped by finalize.
980
+ // Unsorted (the consumer re-sorts after decoding) — order doesn't affect interning.
981
+ row.reachability = refs?.size ? { partial: true, refs: [...refs.values()] } : undefined;
503
982
  rowProcessor?.processRow(row, graphCtx);
504
- finalizeRowReachability(row, shaOrRemapped, refs);
983
+ finalizeRowReachability(row, row.sha, refs);
505
984
  rows.push(row);
506
- if (commit.stats != null) {
507
- rowStats.set(shaOrRemapped, commit.stats);
508
- }
509
985
  }
510
986
  }
511
987
  const startingCursor = cursor?.sha;
512
988
  const lastSha = last(ids);
513
989
  cursor = lastSha != null ? { sha: lastSha, skip: total - iterations } : undefined;
514
- let rowsStatsDeferred;
515
- if (deferStats) {
516
- pendingRowsStatsCount++;
517
- // oxlint-disable-next-line no-async-promise-executor
518
- const promise = new Promise(async (resolve) => {
519
- try {
520
- const args = [...statsParser.arguments];
521
- if (startTotal === 0) {
522
- args.push(`-n${total}`);
523
- }
524
- else {
525
- args.push(`-n${total - startTotal}`, `--skip=${startTotal}`);
526
- }
527
- args.push(`--${ordering}-order`, '--all');
528
- const statsResult = await this.git.run({ cwd: repoPath, configs: gitConfigsLog, stdin: stdin, priority: 'background' }, 'log', stdin ? '--stdin' : undefined, ...args, '--');
529
- if (statsResult.stdout) {
530
- let statShaOrRemapped;
531
- for (const stat of statsParser.parse(statsResult.stdout)) {
532
- statShaOrRemapped = remappedIds.get(stat.sha) ?? stat.sha;
533
- // Don't overwrite stats already populated for this sha
534
- if (rowStats.has(statShaOrRemapped))
535
- continue;
536
- rowStats.set(statShaOrRemapped, stat.stats);
537
- }
538
- }
539
- }
540
- finally {
541
- pendingRowsStatsCount--;
542
- resolve();
543
- }
544
- });
545
- rowsStatsDeferred = {
546
- isLoaded: () => pendingRowsStatsCount === 0,
547
- promise: promise,
548
- };
549
- }
990
+ const rowsStatsDeferred = buildRowsStatsDeferred(rows);
550
991
  return {
551
992
  repoPath: repoPath,
552
993
  avatars: avatars,
@@ -561,6 +1002,9 @@ export class GraphGitSubProvider {
561
1002
  reachableFromHEAD: reachableFromHEAD,
562
1003
  rewriteableFromHEAD: rewriteableFromHEAD,
563
1004
  reachability: reachabilityBuilder.build(),
1005
+ refTips: refTips,
1006
+ decorationFingerprint: decorationFingerprint,
1007
+ shallow: shallow,
564
1008
  rows: rows,
565
1009
  id: sha ?? rev,
566
1010
  rowsStats: rowStats,
@@ -587,6 +1031,402 @@ export class GraphGitSubProvider {
587
1031
  throw ex;
588
1032
  }
589
1033
  }
1034
+ // R6b incremental head-walk fast path: enumerate ONLY the new commits, stitch the seed's cached tail,
1035
+ // and re-derive flags/reachability in memory — instead of re-walking every loaded row. Returns
1036
+ // `undefined` (→ full walk below) on any structural change. Reports the outcome via `onIncrementalResult`.
1037
+ let incrementalFallbackReason;
1038
+ const tryIncrementalGraph = async (seed) => {
1039
+ const onResult = options?.onIncrementalResult;
1040
+ // Reports a fallback outcome; callers then `return undefined` to take the full walk.
1041
+ const fallback = (reason) => {
1042
+ incrementalFallbackReason = reason;
1043
+ onResult?.({ path: 'fallback', reason: reason });
1044
+ };
1045
+ // Cheap gates (no git).
1046
+ if (rowProcessor == null || graphCtx == null) {
1047
+ fallback('no-row-processor');
1048
+ return undefined;
1049
+ }
1050
+ // The convergence + date-boundary reasoning is only sound for `date` order.
1051
+ if (ordering !== 'date' || seed.ordering !== 'date') {
1052
+ fallback('ordering-not-date');
1053
+ return undefined;
1054
+ }
1055
+ const seedShas = new Set(seed.rows.map(r => r.sha));
1056
+ // A `rev` narrows the walk's find/stop semantics. The host's same-repo rebuild passes a rebuild
1057
+ // ANCHOR sha (the loaded window's bottom) to pin that boundary — the anchor is by construction inside
1058
+ // the seed, and the stitch + trim below preserve the seed tail, so the fast path can honor it (it
1059
+ // grows the window down to the anchor; see the window/limit shape below). A rev NOT in the seed is a
1060
+ // real out-of-window target (deep link, reveal) the fast path can't reach → full walk.
1061
+ if (rev != null && !seedShas.has(rev)) {
1062
+ fallback('rev-outside-seed');
1063
+ return undefined;
1064
+ }
1065
+ // First-parent (now or in the seed) means the emitted rows carry sliced parents the in-memory
1066
+ // re-derivation can't expand back to the full set the walk propagates through.
1067
+ if (onlyFollowFirstParent || seed.onlyFollowFirstParent) {
1068
+ fallback('first-parent');
1069
+ return undefined;
1070
+ }
1071
+ // The ACTUAL current HEAD sha (to seed reachable-from-HEAD and detect a checkout). Distinct from
1072
+ // `selectSha`, which resolves the `rev` ANCHOR — not HEAD — when a rev is passed: with no rev
1073
+ // `selectSha` already IS the resolved HEAD, otherwise take the current branch tip (also populated for
1074
+ // a detached HEAD). The graph `id` still mirrors the full walk's `selectSha ?? rev` (below).
1075
+ const currentHeadSha = rev == null ? selectSha : headBranch?.sha;
1076
+ // Reuse the prelude's tips (same repo state — nothing mutates between the prelude and here).
1077
+ const currentTips = refTips;
1078
+ // Shallow-state gate: an un-shallow (or re-shallow) while the graph was closed leaves every branch
1079
+ // tip put — so it passes the tip diff below — yet changes what history exists BELOW the loaded window
1080
+ // (a stale-false `hasMore` would hide the newly deepened commits). Any change → full walk. Checked
1081
+ // against the prelude's already-captured `shallow` (no extra git).
1082
+ if ((seed.shallow ?? false) !== shallow) {
1083
+ fallback('shallow-changed');
1084
+ return undefined;
1085
+ }
1086
+ // Replace-ref gate: `git replace` (and grafts) rewrite ancestry PRESENTATION globally, so any
1087
+ // change to the replace-ref set (`refs/replace/*`) invalidates the cached rows' parent links even when
1088
+ // no branch tip moved. An UNCHANGED set (including non-empty) stays fast-path-eligible — the seed rows
1089
+ // were built under the same replacement view. Replace refs aren't `isMoveableGraphRef`s (no badge), so
1090
+ // the tip diff below skips them; diff them here on their own.
1091
+ let seedReplaceCount = 0;
1092
+ for (const [refname, oldSha] of seed.tips) {
1093
+ if (!refname.startsWith('refs/replace/'))
1094
+ continue;
1095
+ seedReplaceCount++;
1096
+ // Removed (gone from current) or retargeted (points at a different replacement object).
1097
+ if (currentTips.get(refname) !== oldSha) {
1098
+ fallback('replace-refs-changed');
1099
+ return undefined;
1100
+ }
1101
+ }
1102
+ let currentReplaceCount = 0;
1103
+ for (const refname of currentTips.keys()) {
1104
+ if (refname.startsWith('refs/replace/')) {
1105
+ currentReplaceCount++;
1106
+ }
1107
+ }
1108
+ // Every seed replace ref is present-and-equal in current (checked above); an unequal count means a
1109
+ // replace ref was ADDED.
1110
+ if (seedReplaceCount !== currentReplaceCount) {
1111
+ fallback('replace-refs-changed');
1112
+ return undefined;
1113
+ }
1114
+ // Ref-tip diff gate: deletions + non-fast-forward moves force a full walk.
1115
+ // Reused rows whose ref badges / current-HEAD flag changed and must be rebuilt from raw git.
1116
+ const affected = new Set();
1117
+ const ffPairs = [];
1118
+ // A moved/new REMOTE ref also changes its tracking branches' ahead/behind — baked into those
1119
+ // branch pills' serialized contexts (`+ahead`/`+behind` drive Push/Pull menu gating) — while the
1120
+ // LOCAL tips stay put; refetch those rows too so a plain fetch corrects them without a full walk.
1121
+ const addTrackingBranchRows = (remoteRefname) => {
1122
+ if (branches == null || !remoteRefname.startsWith('refs/remotes/'))
1123
+ return;
1124
+ const upstreamName = remoteRefname.substring('refs/remotes/'.length);
1125
+ for (const b of branches) {
1126
+ if (b.upstream?.name === upstreamName && b.sha != null && seedShas.has(b.sha)) {
1127
+ affected.add(b.sha);
1128
+ }
1129
+ }
1130
+ };
1131
+ for (const [refname, oldSha] of seed.tips) {
1132
+ if (!isMoveableGraphRef(refname))
1133
+ continue;
1134
+ const cur = currentTips.get(refname);
1135
+ if (cur == null) {
1136
+ fallback('ref-deleted');
1137
+ return undefined;
1138
+ }
1139
+ if (cur !== oldSha) {
1140
+ ffPairs.push([oldSha, cur]);
1141
+ if (seedShas.has(oldSha)) {
1142
+ affected.add(oldSha);
1143
+ }
1144
+ if (seedShas.has(cur)) {
1145
+ affected.add(cur);
1146
+ }
1147
+ addTrackingBranchRows(refname);
1148
+ }
1149
+ }
1150
+ // New refs (present now, absent from the seed) landing on an already-loaded row.
1151
+ for (const [refname, cur] of currentTips) {
1152
+ if (!isMoveableGraphRef(refname) || seed.tips.has(refname))
1153
+ continue;
1154
+ if (seedShas.has(cur)) {
1155
+ affected.add(cur);
1156
+ }
1157
+ addTrackingBranchRows(refname);
1158
+ }
1159
+ if (ffPairs.length > 0) {
1160
+ // Bounded fan-out: a mass-moved-ref fetch can produce hundreds of pairs — an unbounded
1161
+ // `Promise.all` would monopolize (or overflow) the git queue. Small chunks stay well under the
1162
+ // queue's slot count, and the first non-fast-forward bails without paying for the rest.
1163
+ const ffCheckChunkSize = 4;
1164
+ for (let i = 0; i < ffPairs.length; i += ffCheckChunkSize) {
1165
+ const results = await Promise.all(ffPairs
1166
+ .slice(i, i + ffCheckChunkSize)
1167
+ .map(([oldSha, newSha]) => this.isFastForward(repoPath, oldSha, newSha, cancellation)));
1168
+ if (results.some(ok => !ok)) {
1169
+ fallback('ref-non-fast-forward');
1170
+ return undefined;
1171
+ }
1172
+ }
1173
+ }
1174
+ // HEAD move (checkout) — old/new HEAD rows need their `isCurrentHead` re-derived from raw git. A
1175
+ // checkout between two branches sitting on the SAME commit moves no sha yet flips which head carries
1176
+ // `isCurrentHead`, so compare the current-head ref NAME too (both are git short refnames; a detached
1177
+ // HEAD has an undefined branch name). Either sha or name differing re-derives both endpoints' rows.
1178
+ const priorHeadRow = seed.rows.find(r => r.heads?.some(h => h.isCurrentHead));
1179
+ const priorHeadSha = priorHeadRow?.sha;
1180
+ const priorHeadName = priorHeadRow?.heads?.find(h => h.isCurrentHead)?.name;
1181
+ const currentHeadName = headBranch?.name;
1182
+ if (priorHeadSha !== currentHeadSha || priorHeadName !== currentHeadName) {
1183
+ if (priorHeadSha != null && seedShas.has(priorHeadSha)) {
1184
+ affected.add(priorHeadSha);
1185
+ }
1186
+ if (currentHeadSha != null && seedShas.has(currentHeadSha)) {
1187
+ affected.add(currentHeadSha);
1188
+ }
1189
+ }
1190
+ // Stash-set gate: any push/pop/drop changes the injected rows.
1191
+ const currentStashShas = gitStash?.stashes != null ? new Set(gitStash.stashes.keys()) : new Set();
1192
+ const priorStashShas = seed.rows.filter(r => r.type === 'stash-node').map(r => r.sha);
1193
+ if (priorStashShas.length !== currentStashShas.size || priorStashShas.some(s => !currentStashShas.has(s))) {
1194
+ fallback('stash-changed');
1195
+ return undefined;
1196
+ }
1197
+ // Decoration-metadata gate: rows EMBED metadata derived from side inputs (default branch,
1198
+ // upstreams, worktree assignments, remote urls/providers, current user) that can change without
1199
+ // moving any ref tip — e.g. `git remote set-head`, `branch --set-upstream-to`, `worktree add`.
1200
+ // Reused rows keep their prior decorations (only flags/reachability are re-derived below), so ANY
1201
+ // change here must take the full walk that rebuilds them. An absent seed fingerprint (old persisted
1202
+ // snapshot) never matches — safe full fallback. Deliberately LAST of the gates so the structural
1203
+ // gates above keep their precise reasons (a deleted tracking branch reports `ref-deleted`, not this).
1204
+ if (seed.decorationFingerprint !== decorationFingerprint) {
1205
+ fallback('metadata-changed');
1206
+ return undefined;
1207
+ }
1208
+ // Per-branch upstream retargets/removals/additions on RETAINED rows: a branch pill embeds its
1209
+ // upstream, and a tip-stationary branch's row is reused as-is — so compare every seed-row pill's
1210
+ // embedded upstream against the current mapping. Kept OUT of the fingerprint so a NEW tracking
1211
+ // branch stays fast (its row is rebuilt via the `affected` refetch; a deleted one is `ref-deleted`).
1212
+ for (const r of seed.rows) {
1213
+ if (r.heads == null)
1214
+ continue;
1215
+ for (const h of r.heads) {
1216
+ const currentBranch = branchMap.get(h.name);
1217
+ if (currentBranch == null)
1218
+ continue;
1219
+ if (h.upstream?.name !== currentBranch.upstream?.name) {
1220
+ fallback('metadata-changed');
1221
+ return undefined;
1222
+ }
1223
+ }
1224
+ }
1225
+ // Enumerate the new commits (reachable now but not from any prior tip) + boundary check.
1226
+ // Stashes' rows are already in the seed, so their shas join the EXCLUSIONS (passing them via
1227
+ // `--all` would re-emit them as "new"). The exclusions are fed as `^sha` lines over stdin, NOT
1228
+ // argv — a repo can carry more distinct ref tips (tags, PR refs) than a command line holds
1229
+ // (Windows caps ~32K chars), and stdin is unbounded.
1230
+ const notShas = new Set(seed.tips.values());
1231
+ for (const s of currentStashShas) {
1232
+ notShas.add(s);
1233
+ }
1234
+ let exclusionsStdin = '';
1235
+ for (const s of notShas) {
1236
+ exclusionsStdin += `^${s}\n`;
1237
+ }
1238
+ const enumResult = await this.git.run({ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, stdin: exclusionsStdin }, 'log', ...parser.arguments, '--date-order', '--all', '--stdin', '--');
1239
+ const newCommits = [...parser.parse(enumResult.stdout)];
1240
+ // Stitch soundness: the result must equal [...new, ...seed]. That holds iff every new commit is
1241
+ // strictly newer than the seam (the max date across the seed window) — an equal/older date could
1242
+ // interleave under `--date-order`, so bail. Checked on raw dates BEFORE any mutation.
1243
+ let maxSeedDate = Number.NEGATIVE_INFINITY;
1244
+ for (const r of seed.rows) {
1245
+ if (r.date > maxSeedDate) {
1246
+ maxSeedDate = r.date;
1247
+ }
1248
+ }
1249
+ for (const c of newCommits) {
1250
+ if (Number(c.committerDate) * 1000 <= maxSeedDate) {
1251
+ fallback('date-boundary');
1252
+ return undefined;
1253
+ }
1254
+ }
1255
+ // Window/limit shape.
1256
+ const stitchedSize = newCommits.length + seed.rows.length;
1257
+ const seedHasMore = seed.hasMore === true;
1258
+ const noLimit = defaultLimit === 0;
1259
+ // The rev anchor (a seed sha) bounds the walk's BOTTOM: the full walk with `sha=rev` grows its window
1260
+ // down to (and INCLUDING) rev before honoring the limit — and with no limit it stops the instant it
1261
+ // finds rev — so the anchor row survives the trim even when `limit` alone would cut above it. Its index
1262
+ // in the assembled window `[new…, seed…]` (new commits never dedup, so `newRows.length` equals
1263
+ // `newCommits.length`): `newCommits.length + <its index in seed.rows>`.
1264
+ const revWindowIndex = rev != null ? newCommits.length + seed.rows.findIndex(r => r.sha === rev) : -1;
1265
+ // Rows the walk targets: `defaultLimit`, raised to at least include the rev anchor (with no limit + rev,
1266
+ // exactly `revWindowIndex + 1`, since the walk stops on finding rev).
1267
+ const targetRows = rev != null
1268
+ ? noLimit
1269
+ ? revWindowIndex + 1
1270
+ : Math.max(defaultLimit, revWindowIndex + 1)
1271
+ : defaultLimit;
1272
+ // The fast path can only serve rows the seed carries; if more is wanted than it holds AND there was
1273
+ // more below it, git is needed for the gap → full walk. (No rev + no limit wants everything below.)
1274
+ const wantsBelowWindow = rev != null ? targetRows > stitchedSize : noLimit || defaultLimit > stitchedSize;
1275
+ if (wantsBelowWindow && seedHasMore) {
1276
+ fallback('limit-exceeds-seed');
1277
+ return undefined;
1278
+ }
1279
+ const trimTo = rev != null
1280
+ ? Math.min(targetRows, stitchedSize)
1281
+ : noLimit
1282
+ ? stitchedSize
1283
+ : Math.min(defaultLimit, stitchedSize);
1284
+ const hasMore = trimTo < stitchedSize || seedHasMore;
1285
+ // Stashes present in the window make the `more()` skip math (records vs unique ids) ambiguous —
1286
+ // only take the fast path when nothing pages below.
1287
+ if (currentStashShas.size > 0 && hasMore) {
1288
+ fallback('stash-window-conflict');
1289
+ return undefined;
1290
+ }
1291
+ // Commit to the fast path — mutations begin here (all fallbacks are above).
1292
+ const newRows = [];
1293
+ for (const c of newCommits) {
1294
+ const built = buildRowFromCommit(c);
1295
+ if (built != null) {
1296
+ newRows.push(built.row);
1297
+ }
1298
+ }
1299
+ // Rebuild the affected reused rows from raw git (bounded `--no-walk`) so their ref badges + emojified
1300
+ // message + current-HEAD flag are exactly what a full walk would produce (git owns %D ordering).
1301
+ const refetched = new Map();
1302
+ if (affected.size > 0) {
1303
+ // SHAs over stdin, not argv — a mass-moved-ref fetch can put hundreds of retained rows in
1304
+ // `affected`, past what a command line holds (see the enumeration above).
1305
+ const refetchResult = await this.git.run({ cwd: repoPath, configs: gitConfigsLog, cancellation: cancellation, stdin: join(affected, '\n') }, 'log', ...parser.arguments, '--no-walk', '--stdin', '--');
1306
+ for (const c of parser.parse(refetchResult.stdout)) {
1307
+ const built = buildRowFromCommit(c);
1308
+ if (built != null) {
1309
+ refetched.set(built.row.sha, built.row);
1310
+ }
1311
+ }
1312
+ }
1313
+ const freshShas = new Set([...newRows.map(r => r.sha), ...refetched.keys()]);
1314
+ // Assemble [new…, reused/refetched…] and trim to the requested window (new commits push the
1315
+ // bottom rows out — exactly what a full walk at this limit does).
1316
+ const windowRows = [...newRows];
1317
+ for (const r of seed.rows) {
1318
+ windowRows.push(refetched.get(r.sha) ?? r);
1319
+ }
1320
+ windowRows.length = Math.min(windowRows.length, trimTo);
1321
+ // Building the fresh rows above populated `ids`/`total` (via `buildRowFromCommit`); reset and rebuild
1322
+ // them from the FINAL trimmed window so `ids`/`total`/the reachability boundary match a full walk
1323
+ // exactly (this is what makes `more()` continue identically).
1324
+ ids.clear();
1325
+ total = 0;
1326
+ for (const row of windowRows) {
1327
+ ids.add(row.sha);
1328
+ total++;
1329
+ const refs = accumulateRowState(row.sha, row.parents, row.heads ?? [], row.remotes ?? [], row.tags ?? [], row.sha === currentHeadSha, row.type === 'stash-node');
1330
+ if (freshShas.has(row.sha)) {
1331
+ // Fresh rows are raw — run the full processor (contexts, emojify, avatar). Reused rows keep
1332
+ // their already-processed contexts/message; only their flags (below) are recomputed.
1333
+ row.reachability = refs?.size ? { partial: true, refs: [...refs.values()] } : undefined;
1334
+ rowProcessor.processRow(row, graphCtx);
1335
+ }
1336
+ // Authoritative flags for every commit row (membership can shift on reused rows too — e.g. a new
1337
+ // interior branch flips `+unique`). Stash rows carry none.
1338
+ if (row.type !== 'stash-node') {
1339
+ (row.contexts ??= {}).flags = computeGraphRowContextFlags(row.sha, refs?.values(), graphCtx);
1340
+ }
1341
+ finalizeRowReachability(row, row.sha, refs);
1342
+ }
1343
+ // Reconstruct the walk's first-call cursor so `more()` (which re-spawns git from `--skip`) continues
1344
+ // byte-identically off the trimmed window.
1345
+ iterations = 1;
1346
+ const lastSha = last(ids);
1347
+ const cursor = lastSha != null ? { sha: lastSha, skip: total - iterations } : undefined;
1348
+ const rowsStatsDeferred = buildRowsStatsDeferred(windowRows);
1349
+ onResult?.({ path: 'fast', added: newRows.length });
1350
+ return {
1351
+ repoPath: repoPath,
1352
+ avatars: avatars,
1353
+ ids: ids,
1354
+ includes: options?.include,
1355
+ branches: branchMap,
1356
+ remotes: remoteMap,
1357
+ downstreams: downstreamMap,
1358
+ stashes: gitStash?.stashes,
1359
+ worktrees: worktrees,
1360
+ worktreesByBranch: worktreesByBranch,
1361
+ reachableFromHEAD: reachableFromHEAD,
1362
+ rewriteableFromHEAD: rewriteableFromHEAD,
1363
+ reachability: reachabilityBuilder.build(),
1364
+ refTips: refTips,
1365
+ decorationFingerprint: decorationFingerprint,
1366
+ shallow: shallow,
1367
+ rows: windowRows,
1368
+ // Mirror the full walk's `id` (`sha ?? rev`, sha = the resolved rev-or-HEAD) — NOT the actual HEAD,
1369
+ // which `currentHeadSha` now tracks separately when a rev anchor is passed.
1370
+ id: selectSha ?? rev,
1371
+ rowsStats: rowStats,
1372
+ rowsStatsDeferred: rowsStatsDeferred,
1373
+ paging: {
1374
+ limit: noLimit ? total : defaultLimit,
1375
+ startingCursor: undefined,
1376
+ hasMore: hasMore,
1377
+ },
1378
+ more: async (limit, sha, cancellation) => getCommitsForGraphCore.call(this, limit, sha, cursor, cancellation),
1379
+ };
1380
+ };
1381
+ if (options?.incrementalSeed != null) {
1382
+ let fast;
1383
+ try {
1384
+ fast = await tryIncrementalGraph(options.incrementalSeed);
1385
+ }
1386
+ catch (ex) {
1387
+ // The fast path must never fail where the full walk it accelerates would succeed — its git
1388
+ // operations have failure modes the `--all` walk doesn't (per-tip `--not` argv on huge ref
1389
+ // sets, queue-depth overflow fanning out FF checks, transient git errors). Cancellation
1390
+ // still propagates; anything else degrades to the full walk below.
1391
+ if (isCancellationError(ex) || cancellation?.aborted)
1392
+ throw ex;
1393
+ // The fast path may have died AFTER its mutation barrier (the affected-row refetch, or the
1394
+ // row processor) with the walk accumulators partially populated — a full walk over polluted
1395
+ // `ids` would silently DROP those rows (its loop dedups on `ids.has`). Reset every closure
1396
+ // accumulator to its pristine pre-walk state; the seeded reachability builder is append-only
1397
+ // and tolerates orphaned interns by design, and mutated reused-row objects are superseded by
1398
+ // the full walk's fresh rows.
1399
+ ids.clear();
1400
+ total = 0;
1401
+ iterations = 0;
1402
+ rowStats.clear();
1403
+ avatars.clear();
1404
+ reachableFromHEAD.clear();
1405
+ rewriteableFromHEAD.clear();
1406
+ reachableFromHeadUpstream.clear();
1407
+ reachableRefs.clear();
1408
+ tipShasWithChildren.clear();
1409
+ downstreamMap.clear();
1410
+ headSha = undefined;
1411
+ rewriteableNextSha = undefined;
1412
+ scope?.warn(`incremental graph walk failed; falling back to full walk; ${String(ex)}`);
1413
+ incrementalFallbackReason = 'error';
1414
+ options.onIncrementalResult?.({ path: 'fallback', reason: 'error' });
1415
+ }
1416
+ if (fast != null) {
1417
+ return fast;
1418
+ }
1419
+ // Parent-rewriting fallbacks change boundary commits' true diffs — an unshallowed parent or a
1420
+ // replace-ref retarget makes previously-computed per-sha stats stale, so the fallback walk must
1421
+ // recompute them instead of carrying the prior generation's values forward. An `error` fallback
1422
+ // recomputes too: the throw may have preceded the replace-ref/shallow gates, so staleness can't
1423
+ // be ruled out.
1424
+ if (incrementalFallbackReason === 'shallow-changed' ||
1425
+ incrementalFallbackReason === 'replace-refs-changed' ||
1426
+ incrementalFallbackReason === 'error') {
1427
+ rowsStatsSeed = undefined;
1428
+ }
1429
+ }
590
1430
  let graph = await getCommitsForGraphCore.call(this, defaultLimit, selectSha, undefined, cancellation);
591
1431
  // Spurious-empty guard: the repo has branches (so `git log --all` should yield commits) yet the
592
1432
  // log returned no rows. That's an inconsistent result — almost always a transient ref-read race
@@ -627,8 +1467,36 @@ export class GraphGitSubProvider {
627
1467
  let stashes;
628
1468
  let stdin;
629
1469
  let remappedIds;
1470
+ let resolvedShas;
630
1471
  if (shas?.size) {
631
- stdin = join(shas, '\n');
1472
+ resolvedShas = await this.provider.revision.resolveShas(repoPath, shas, cancellation);
1473
+ // Never throw on cancellation here: the outer catch wraps non-GitSearchError into
1474
+ // GitSearchError, which surfaces as a false "Invalid search pattern". Return instead.
1475
+ if (cancellation?.aborted) {
1476
+ return {
1477
+ repoPath: repoPath,
1478
+ query: search,
1479
+ queryFilters: filters,
1480
+ comparisonKey: comparisonKey,
1481
+ results: existingResults ?? new Map(),
1482
+ hasMore: true,
1483
+ };
1484
+ }
1485
+ // Short SHA(s) matched no commit: return empty (empty stdin to `--no-walk --stdin`
1486
+ // would return HEAD, so we must not fall through to git).
1487
+ if (!resolvedShas.size) {
1488
+ return {
1489
+ repoPath: repoPath,
1490
+ query: search,
1491
+ queryFilters: filters,
1492
+ comparisonKey: comparisonKey,
1493
+ results: existingResults ?? new Map(),
1494
+ hasMore: false,
1495
+ };
1496
+ }
1497
+ }
1498
+ if (resolvedShas?.size) {
1499
+ stdin = join(resolvedShas, '\n');
632
1500
  args.push('--no-walk');
633
1501
  remappedIds = new Map();
634
1502
  }
@@ -670,6 +1538,11 @@ export class GraphGitSubProvider {
670
1538
  aborter.abort();
671
1539
  };
672
1540
  cancellation?.addEventListener('abort', onAbort, { once: true });
1541
+ // An ALREADY-aborted signal (e.g. `toAbortSignal` of a cancelled token) never fires listeners
1542
+ // added after the fact — without this the walk would run to completion unabortably.
1543
+ if (cancellation?.aborted) {
1544
+ onAbort();
1545
+ }
673
1546
  const _disposable = __addDisposableResource(env_2, createDisposable(() => cancellation?.removeEventListener('abort', onAbort)), false);
674
1547
  const stream = this.git.stream({
675
1548
  cwd: repoPath,
@@ -839,4 +1712,235 @@ __decorate([
839
1712
  }),
840
1713
  })
841
1714
  ], GraphGitSubProvider.prototype, "continueSearchGraph", null);
1715
+ /**
1716
+ * CLI-backed {@link GitGraphSession}: a stateful facade over {@link GraphGitSubProvider.getGraph}. It
1717
+ * owns the canonical accumulated window and builds the R6b incremental seed internally (from the window,
1718
+ * the prior walk's tips/reachability/stats, and the walk shape), so the host no longer mirrors loaded
1719
+ * rows, stamps ref tips, or hand-assembles a seed. Behavior-neutral: `refresh`/`more` reproduce exactly
1720
+ * what the host's `getState` seed construction + `setGraph` mirror maintenance + write-once avatar merge
1721
+ * did.
1722
+ */
1723
+ class GraphSession {
1724
+ provider;
1725
+ repoPath;
1726
+ rowProcessor;
1727
+ getWalkShape;
1728
+ // Assigned by `initialize` before the session is handed out; never read before then.
1729
+ _current;
1730
+ _window = [];
1731
+ // The walk shape (`ordering|onlyFollowFirstParent`) the current window was produced under — the
1732
+ // incremental seed is only valid when the NEXT walk uses the SAME shape (a graph object doesn't
1733
+ // record its shape, so it's tracked here). Undefined until the first walk lands.
1734
+ _buildShape;
1735
+ constructor(provider, repoPath, rowProcessor, getWalkShape) {
1736
+ this.provider = provider;
1737
+ this.repoPath = repoPath;
1738
+ this.rowProcessor = rowProcessor;
1739
+ this.getWalkShape = getWalkShape;
1740
+ }
1741
+ get window() {
1742
+ return this._window;
1743
+ }
1744
+ get current() {
1745
+ return this._current;
1746
+ }
1747
+ /** First walk — no seed (nothing accumulated yet), equivalent to a plain `getGraph`. */
1748
+ async initialize(options, cancellation) {
1749
+ const shape = this.getWalkShape();
1750
+ const graph = await this.provider.getGraph(this.repoPath, options?.rev, { include: options?.include, limit: options?.limit, rowProcessor: this.rowProcessor }, cancellation);
1751
+ this.applyRebuild(graph, shape);
1752
+ }
1753
+ /**
1754
+ * R7c restart persistence. Reconstruct the prior generation from a persisted snapshot as an R6 seed
1755
+ * WITHOUT any git (its window/tips/reachability/stats become this session's prior `current`/`window`/
1756
+ * `buildShape`), then IMMEDIATELY {@link refresh} to current truth — the enumeration + tip/FF/stash gates
1757
+ * reconcile a stale snapshot (fast when unchanged, a full walk on any structural change). The session
1758
+ * handed back is ALWAYS post-refresh; the raw snapshot is never surfaced. The caller has already validated
1759
+ * the snapshot structurally. Returns the refresh outcome so the caller can report the restore result.
1760
+ */
1761
+ async restore(snapshot, options, cancellation) {
1762
+ this._window = snapshot.rows;
1763
+ this._buildShape = snapshot.buildShape;
1764
+ this._current = buildRestoredGraph(snapshot);
1765
+ // Anchor the re-walk on the window's BOTTOM commit so it spans the whole restored window (the host's
1766
+ // rebuild-anchor discipline), matching to at least the current limit so a since-grown repo still fills a
1767
+ // full page. Stash rows aren't real revs, so skip them when picking the anchor.
1768
+ let anchor;
1769
+ for (let i = snapshot.rows.length - 1; i >= 0; i--) {
1770
+ const type = snapshot.rows[i].type;
1771
+ if (type === 'commit-node' || type === 'merge-node') {
1772
+ anchor = snapshot.rows[i].sha;
1773
+ break;
1774
+ }
1775
+ }
1776
+ const limit = Math.max(snapshot.rows.length, options?.limit ?? 0);
1777
+ return this.refresh({ rev: anchor, limit: limit, include: options?.include }, cancellation);
1778
+ }
1779
+ async refresh(options, cancellation) {
1780
+ const shape = this.getWalkShape();
1781
+ const buildShape = buildShapeKey(shape);
1782
+ const prior = this._current;
1783
+ // Incremental head-walk seed: the FULL accumulated window + the prior walk's tips/reachability/stats,
1784
+ // gated on an unchanged walk shape (a first-parent/ordering change reshapes every row's parents/order,
1785
+ // so the cached rows can't be reused). Mirrors the host's former `incrementalSeed` construction and
1786
+ // `_graphBuildShape` gate — the session owns the shape, so it can't be handed a lying seed. The provider
1787
+ // still re-validates ordering/first-parent internally and falls back on any structural change.
1788
+ const incrementalSeed = options?.rebuild !== true && prior.refTips != null && this._buildShape === buildShape
1789
+ ? {
1790
+ rows: this._window,
1791
+ tips: prior.refTips,
1792
+ ordering: shape.ordering,
1793
+ reachability: prior.reachability,
1794
+ rowsStats: prior.rowsStats,
1795
+ hasMore: prior.paging?.hasMore ?? false,
1796
+ onlyFollowFirstParent: shape.onlyFollowFirstParent,
1797
+ shallow: prior.shallow,
1798
+ decorationFingerprint: prior.decorationFingerprint,
1799
+ }
1800
+ : undefined;
1801
+ let outcome;
1802
+ let graph = await this.provider.getGraph(this.repoPath, options?.rev, {
1803
+ include: options?.include,
1804
+ limit: options?.limit,
1805
+ rowProcessor: this.rowProcessor,
1806
+ // Same-repo rebuild: continue the prior reachability generation (stable indices for retained
1807
+ // rows) and reuse immutable per-sha stats — exactly the host's former same-repo seeds.
1808
+ reachabilitySeed: prior.reachability,
1809
+ rowsStatsSeed: prior.rowsStats,
1810
+ incrementalSeed: incrementalSeed,
1811
+ onIncrementalResult: o => {
1812
+ outcome = o;
1813
+ },
1814
+ }, cancellation);
1815
+ // Host-serialization backstop: the host serializes refresh against more() per repo. Should a more() still
1816
+ // land mid-refresh (`_current` swapped out from under this await), the rebuild predates that appended page
1817
+ // — refresh carries newer repo truth so we still apply it, but when the accumulated window outran the
1818
+ // rebuild the dropped page must re-page, not vanish. `paging.hasMore` is readonly, so re-wrap it truthful.
1819
+ if (this._current !== prior && graph.paging != null && this._window.length > graph.rows.length) {
1820
+ graph = { ...graph, paging: { ...graph.paging, hasMore: true } };
1821
+ }
1822
+ // Write-once cross-generation avatar merge (formerly in host `setGraph`): carry prior URLs forward
1823
+ // into the fresh graph's map without overwriting its own entries.
1824
+ mergeAvatarsForward(prior.avatars, graph.avatars);
1825
+ this.applyRebuild(graph, shape);
1826
+ // The full path (seeded fallback or unseeded full walk) re-derives everything → every channel changed.
1827
+ // The fast path derives each channel honestly from what it actually touched — a false negative is data
1828
+ // loss, so a channel is `false` only when it PROVABLY didn't change (never merely when uncertain).
1829
+ if (outcome?.path === 'fast') {
1830
+ const changed = {
1831
+ // A head-walk always reshapes the window; the publisher's ledger diff derives the precise splice
1832
+ // (including reused-row flag / reachability-index changes the re-derivation makes in place).
1833
+ rows: true,
1834
+ // The builder continues the prior generation (same id); a grown table means new dict/set entries
1835
+ // to append. A per-row index that re-points to an EXISTING set rides the rows channel, not this.
1836
+ reachability: reachabilityTableChanged(prior.reachability, graph.reachability),
1837
+ // Only NEW commit shas need stats (reused rows carry seeded, already-shipped stats), and only when
1838
+ // stats were requested at all. The host's deferred-completion hook re-marks this channel when the
1839
+ // background query lands, so this is just the synchronous signal.
1840
+ rowsStats: graph.includes?.stats === true && (outcome.added ?? 0) > 0,
1841
+ // Avatars are write-once merged across generations, so the map only grows — a larger size means
1842
+ // new emails. Value replacements (avatar proxy) ride the host's dedicated avatar path, not this.
1843
+ avatars: graph.avatars.size !== prior.avatars.size,
1844
+ // The fast path rebuilds the downstreams map from all rows; compare it against the prior.
1845
+ downstreams: downstreamsChanged(prior.downstreams, graph.downstreams),
1846
+ };
1847
+ return { path: 'fast', added: outcome.added, changed: changed };
1848
+ }
1849
+ const changed = {
1850
+ rows: true,
1851
+ reachability: true,
1852
+ rowsStats: true,
1853
+ // Ties to the rowsStatsSeed drop above: these fallbacks recompute stats for shas already shipped
1854
+ // (`error` included — it drops the seed too, so its recompute must be re-shipped, not dedup-skipped).
1855
+ rowsStatsRecomputed: outcome?.path === 'fallback' &&
1856
+ (outcome.reason === 'shallow-changed' ||
1857
+ outcome.reason === 'replace-refs-changed' ||
1858
+ outcome.reason === 'error'),
1859
+ avatars: true,
1860
+ downstreams: true,
1861
+ };
1862
+ // A seeded fallback carries its reason; an unseeded full walk (no `onIncrementalResult` fired) carries none.
1863
+ if (outcome?.path === 'fallback')
1864
+ return { path: 'full', reason: outcome.reason, changed: changed };
1865
+ return { path: 'full', changed: changed };
1866
+ }
1867
+ async more(limit, targetId, cancellation) {
1868
+ const prior = this._current;
1869
+ const updated = await prior.more?.(limit ?? 0, targetId, cancellation);
1870
+ // A refresh swapped `current` out from under the page walk (stale generation) — benign; drop it and
1871
+ // the host re-requests on the next scroll.
1872
+ if (this._current !== prior)
1873
+ return false;
1874
+ // A live page walk yielding nothing is unexpected (hasMore said otherwise).
1875
+ if (updated == null) {
1876
+ debugger;
1877
+ return false;
1878
+ }
1879
+ mergeAvatarsForward(prior.avatars, updated.avatars);
1880
+ this.applyPage(updated);
1881
+ return true;
1882
+ }
1883
+ serialize() {
1884
+ const current = this._current;
1885
+ // Nothing worth persisting: no window yet, no build shape recorded, or no ref tips (the restore's
1886
+ // tip-diff gate has nothing to diff — never true for the CLI provider, but guards a defensive future).
1887
+ if (this._window.length === 0 || this._buildShape == null || current?.refTips == null)
1888
+ return undefined;
1889
+ const [ordering, onlyFollowFirstParent] = this._buildShape.split('|');
1890
+ // Cap the persisted window to a bounded top slice; a longer window persists its top with `hasMore`
1891
+ // forced true (restore behaves as a shorter loaded window — the bottom re-pages on demand). Slicing
1892
+ // makes a new array of the SAME row objects — no mutation of the live window.
1893
+ const capped = this._window.length > maxPersistedGraphRows;
1894
+ const rows = capped ? this._window.slice(0, maxPersistedGraphRows) : this._window;
1895
+ const hasMore = capped || (current.paging?.hasMore ?? false);
1896
+ // Stats are immutable per sha; when capped, trim to the persisted shas (entries for dropped rows are
1897
+ // dead weight). The reachability table is kept whole even when capped — it's proportional to distinct
1898
+ // ref-sets (small), the persisted rows' indices stay valid, and extra sets are harmless on decode.
1899
+ let rowsStats;
1900
+ if (current.includes?.stats === true && current.rowsStats != null && current.rowsStats.size > 0) {
1901
+ const shas = capped ? new Set(rows.map(r => r.sha)) : undefined;
1902
+ rowsStats = [];
1903
+ for (const [sha, stats] of current.rowsStats) {
1904
+ if (shas != null && !shas.has(sha))
1905
+ continue;
1906
+ rowsStats.push([sha, stats]);
1907
+ }
1908
+ }
1909
+ return {
1910
+ v: graphSessionSnapshotVersion,
1911
+ repoPath: this.repoPath,
1912
+ buildShape: this._buildShape,
1913
+ ordering: ordering,
1914
+ onlyFollowFirstParent: onlyFollowFirstParent === 'true',
1915
+ rows: rows,
1916
+ refTips: [...current.refTips],
1917
+ decorationFingerprint: current.decorationFingerprint,
1918
+ reachability: current.reachability,
1919
+ rowsStats: rowsStats,
1920
+ downstreams: Array.from(current.downstreams, ([k, v]) => [k, [...v]]),
1921
+ hasMore: hasMore,
1922
+ includesStats: current.includes?.stats === true,
1923
+ shallow: current.shallow ?? false,
1924
+ };
1925
+ }
1926
+ dispose() {
1927
+ // No-op — the window lives entirely in memory. R7c restart persistence is host-driven: the host
1928
+ // serializes this session (debounced + on its own dispose) and owns the storage IO.
1929
+ }
1930
+ /** A cursor-less rebuild (full walk / fast path) IS the full window. */
1931
+ applyRebuild(graph, shape) {
1932
+ this._current = graph;
1933
+ this._window = graph.rows;
1934
+ this._buildShape = buildShapeKey(shape);
1935
+ }
1936
+ /** A page-append: keep the window up to the cursor and append the page (the reducer's cursor-anchored
1937
+ * concatenation); the walk shape is unchanged (same generation). */
1938
+ applyPage(page) {
1939
+ this._current = page;
1940
+ const startingCursor = page.paging?.startingCursor;
1941
+ // A page always carries a cursor; a cursor-less page (shouldn't happen) is treated as a full window,
1942
+ // matching the host mirror's former fallback.
1943
+ this._window = startingCursor == null ? page.rows : appendRowsAtCursor(this._window, startingCursor, page.rows);
1944
+ }
1945
+ }
842
1946
  //# sourceMappingURL=graph.js.map