@deepseek-ai/dsh-experimental-client-ui-forge 0.2.3-alpha.1 → 0.2.3-alpha.3

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 (315) hide show
  1. package/README.i18n.yaml +8 -8
  2. package/README.md +29 -12
  3. package/README.zh.md +29 -12
  4. package/lib/client.js +21 -16
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +874 -170
  7. package/lib/typert.host.js +831 -156
  8. package/lib/typert.remote-client.d.ts +29 -11
  9. package/lib/typert.remote-client.d.ts.map +1 -1
  10. package/lib/typert.remote-client.js +727 -134
  11. package/lib/types/client/ActionToast.d.ts +1 -1
  12. package/lib/types/client/ActionToast.d.ts.map +1 -1
  13. package/lib/types/client/ActionToast.js.map +1 -1
  14. package/lib/types/client/AttentionIndicator.d.ts +1 -1
  15. package/lib/types/client/AttentionIndicator.d.ts.map +1 -1
  16. package/lib/types/client/BaseMenu.d.ts +6 -4
  17. package/lib/types/client/BaseMenu.d.ts.map +1 -1
  18. package/lib/types/client/BaseMenu.js.map +1 -1
  19. package/lib/types/client/BranchPicker.d.ts +84 -0
  20. package/lib/types/client/BranchPicker.d.ts.map +1 -0
  21. package/lib/types/client/BranchPicker.js.map +1 -0
  22. package/lib/types/client/ChangeRequestCard.d.ts +21 -12
  23. package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
  24. package/lib/types/client/ChangeRequestCard.js.map +1 -1
  25. package/lib/types/client/ChangeRequestOverview.d.ts +12 -6
  26. package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
  27. package/lib/types/client/ChangeRequestOverview.js.map +1 -1
  28. package/lib/types/client/ChangeRequestsSection.d.ts +5 -3
  29. package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -1
  30. package/lib/types/client/ChangeRequestsSection.js.map +1 -1
  31. package/lib/types/client/ChangedFiles.d.ts +1 -1
  32. package/lib/types/client/ChangedFiles.d.ts.map +1 -1
  33. package/lib/types/client/ChangedFiles.js.map +1 -1
  34. package/lib/types/client/ChangesLoading.d.ts +1 -1
  35. package/lib/types/client/ChangesLoading.d.ts.map +1 -1
  36. package/lib/types/client/ChangesTab.d.ts +15 -7
  37. package/lib/types/client/ChangesTab.d.ts.map +1 -1
  38. package/lib/types/client/ChangesTab.js.map +1 -1
  39. package/lib/types/client/ChangesTabTitle.d.ts +1 -1
  40. package/lib/types/client/ChangesTabTitle.d.ts.map +1 -1
  41. package/lib/types/client/ChangesTabTitle.js.map +1 -1
  42. package/lib/types/client/CommitMenu.d.ts +3 -3
  43. package/lib/types/client/CommitMenu.d.ts.map +1 -1
  44. package/lib/types/client/CommitMenu.js.map +1 -1
  45. package/lib/types/client/DiffFile.d.ts +16 -2
  46. package/lib/types/client/DiffFile.d.ts.map +1 -1
  47. package/lib/types/client/DiffFile.js.map +1 -1
  48. package/lib/types/client/EnvironmentRows.d.ts +6 -6
  49. package/lib/types/client/EnvironmentRows.d.ts.map +1 -1
  50. package/lib/types/client/EnvironmentRows.js.map +1 -1
  51. package/lib/types/client/FileLabel.js.map +1 -1
  52. package/lib/types/client/HeadMenu.d.ts +35 -0
  53. package/lib/types/client/HeadMenu.d.ts.map +1 -0
  54. package/lib/types/client/HeadMenu.js.map +1 -0
  55. package/lib/types/client/HostSettings.d.ts +33 -0
  56. package/lib/types/client/HostSettings.d.ts.map +1 -0
  57. package/lib/types/client/HostSettings.js.map +1 -0
  58. package/lib/types/client/LensFilter.d.ts +2 -2
  59. package/lib/types/client/LensFilter.d.ts.map +1 -1
  60. package/lib/types/client/LensFilter.js.map +1 -1
  61. package/lib/types/client/ReasonButton.js.map +1 -1
  62. package/lib/types/client/RefreshGlyph.js.map +1 -1
  63. package/lib/types/client/ReviewComposer.d.ts +1 -1
  64. package/lib/types/client/ReviewComposer.d.ts.map +1 -1
  65. package/lib/types/client/ReviewComposer.js.map +1 -1
  66. package/lib/types/client/ReviewControls.d.ts +1 -1
  67. package/lib/types/client/ReviewControls.d.ts.map +1 -1
  68. package/lib/types/client/ReviewControls.js.map +1 -1
  69. package/lib/types/client/ReviewThread.d.ts +1 -1
  70. package/lib/types/client/ReviewThread.d.ts.map +1 -1
  71. package/lib/types/client/ReviewThread.js.map +1 -1
  72. package/lib/types/client/ReviewThreads.d.ts +4 -2
  73. package/lib/types/client/ReviewThreads.d.ts.map +1 -1
  74. package/lib/types/client/ReviewThreads.js.map +1 -1
  75. package/lib/types/client/SessionHoverForge.d.ts +1 -1
  76. package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
  77. package/lib/types/client/SessionHoverForge.js.map +1 -1
  78. package/lib/types/client/SessionRowForge.d.ts +1 -1
  79. package/lib/types/client/SessionRowForge.d.ts.map +1 -1
  80. package/lib/types/client/SessionRowForge.js.map +1 -1
  81. package/lib/types/client/SubmitReview.d.ts +1 -1
  82. package/lib/types/client/SubmitReview.d.ts.map +1 -1
  83. package/lib/types/client/SubmitReview.js.map +1 -1
  84. package/lib/types/client/ThreadList.d.ts +3 -1
  85. package/lib/types/client/ThreadList.d.ts.map +1 -1
  86. package/lib/types/client/ThreadList.js.map +1 -1
  87. package/lib/types/client/ViewOptionsMenu.d.ts +1 -1
  88. package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
  89. package/lib/types/client/ViewOptionsMenu.js.map +1 -1
  90. package/lib/types/client/WorktreeNameDialog.d.ts +1 -1
  91. package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -1
  92. package/lib/types/client/WorktreeNameDialog.js.map +1 -1
  93. package/lib/types/client/WorktreeProgress.d.ts +1 -1
  94. package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
  95. package/lib/types/client/WorktreeProgress.js.map +1 -1
  96. package/lib/types/client/WorktreeSettings.d.ts +1 -1
  97. package/lib/types/client/WorktreeSettings.d.ts.map +1 -1
  98. package/lib/types/client/WorktreeSettings.js.map +1 -1
  99. package/lib/types/client/WorktreeToggle.d.ts +1 -1
  100. package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
  101. package/lib/types/client/WorktreeToggle.js.map +1 -1
  102. package/lib/types/client/annotations.d.ts +1 -1
  103. package/lib/types/client/annotations.d.ts.map +1 -1
  104. package/lib/types/client/branch-search.d.ts +1 -1
  105. package/lib/types/client/branch-search.d.ts.map +1 -1
  106. package/lib/types/client/branch-search.js.map +1 -1
  107. package/lib/types/client/changes-address.d.ts +1 -1
  108. package/lib/types/client/changes-address.d.ts.map +1 -1
  109. package/lib/types/client/changes-service.d.ts +1 -1
  110. package/lib/types/client/changes-service.d.ts.map +1 -1
  111. package/lib/types/client/changes-store.d.ts +18 -2
  112. package/lib/types/client/changes-store.d.ts.map +1 -1
  113. package/lib/types/client/changes-store.js.map +1 -1
  114. package/lib/types/client/checkout.d.ts +1 -1
  115. package/lib/types/client/checkout.d.ts.map +1 -1
  116. package/lib/types/client/code-selection.d.ts.map +1 -1
  117. package/lib/types/client/code-selection.js.map +1 -1
  118. package/lib/types/client/forge-copy.d.ts +8 -1
  119. package/lib/types/client/forge-copy.d.ts.map +1 -1
  120. package/lib/types/client/forge-copy.js.map +1 -1
  121. package/lib/types/client/format.d.ts +1 -1
  122. package/lib/types/client/format.d.ts.map +1 -1
  123. package/lib/types/client/format.js.map +1 -1
  124. package/lib/types/client/glyphs.d.ts +23 -1
  125. package/lib/types/client/glyphs.d.ts.map +1 -1
  126. package/lib/types/client/glyphs.js.map +1 -1
  127. package/lib/types/client/highlight-context.d.ts +1 -1
  128. package/lib/types/client/highlight-context.d.ts.map +1 -1
  129. package/lib/types/client/host-settings-form.d.ts +69 -0
  130. package/lib/types/client/host-settings-form.d.ts.map +1 -0
  131. package/lib/types/client/host-settings-form.js.map +1 -0
  132. package/lib/types/client/host-sign-in.d.ts +31 -0
  133. package/lib/types/client/host-sign-in.d.ts.map +1 -0
  134. package/lib/types/client/host-sign-in.js.map +1 -0
  135. package/lib/types/client/local-writes.d.ts +47 -0
  136. package/lib/types/client/local-writes.d.ts.map +1 -0
  137. package/lib/types/client/local-writes.js.map +1 -0
  138. package/lib/types/client/locales.d.ts +106 -9
  139. package/lib/types/client/locales.d.ts.map +1 -1
  140. package/lib/types/client/locales.js.map +1 -1
  141. package/lib/types/client/mount.d.ts +15 -1
  142. package/lib/types/client/mount.d.ts.map +1 -1
  143. package/lib/types/client/mount.js.map +1 -1
  144. package/lib/types/client/review-page/ReviewActivity.d.ts +44 -0
  145. package/lib/types/client/review-page/ReviewActivity.d.ts.map +1 -0
  146. package/lib/types/client/review-page/ReviewActivity.js.map +1 -0
  147. package/lib/types/client/review-page/ReviewChat.d.ts +1 -1
  148. package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -1
  149. package/lib/types/client/review-page/ReviewChat.js.map +1 -1
  150. package/lib/types/client/review-page/ReviewDetail.d.ts +23 -9
  151. package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -1
  152. package/lib/types/client/review-page/ReviewDetail.js.map +1 -1
  153. package/lib/types/client/review-page/ReviewLabels.d.ts +1 -1
  154. package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -1
  155. package/lib/types/client/review-page/ReviewLabels.js.map +1 -1
  156. package/lib/types/client/review-page/ReviewList.d.ts +10 -8
  157. package/lib/types/client/review-page/ReviewList.d.ts.map +1 -1
  158. package/lib/types/client/review-page/ReviewList.js.map +1 -1
  159. package/lib/types/client/review-page/ReviewNav.d.ts +1 -1
  160. package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -1
  161. package/lib/types/client/review-page/ReviewPage.d.ts +15 -12
  162. package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -1
  163. package/lib/types/client/review-page/ReviewPage.js.map +1 -1
  164. package/lib/types/client/review-page/ReviewSkeleton.d.ts +26 -0
  165. package/lib/types/client/review-page/ReviewSkeleton.d.ts.map +1 -0
  166. package/lib/types/client/review-page/ReviewSkeleton.js.map +1 -0
  167. package/lib/types/client/review-page/ReviewStatus.d.ts +5 -3
  168. package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -1
  169. package/lib/types/client/review-page/ReviewStatus.js.map +1 -1
  170. package/lib/types/client/review-page/review-activity.d.ts +37 -0
  171. package/lib/types/client/review-page/review-activity.d.ts.map +1 -0
  172. package/lib/types/client/review-page/review-activity.js.map +1 -0
  173. package/lib/types/client/review-page/review-lists.d.ts +48 -13
  174. package/lib/types/client/review-page/review-lists.d.ts.map +1 -1
  175. package/lib/types/client/review-page/review-lists.js.map +1 -1
  176. package/lib/types/client/review-page/review-mount.d.ts +3 -1
  177. package/lib/types/client/review-page/review-mount.d.ts.map +1 -1
  178. package/lib/types/client/review-page/review-mount.js.map +1 -1
  179. package/lib/types/client/review-page/review-store.d.ts +18 -8
  180. package/lib/types/client/review-page/review-store.d.ts.map +1 -1
  181. package/lib/types/client/review-page/review-store.js.map +1 -1
  182. package/lib/types/client/review-queue.d.ts +1 -1
  183. package/lib/types/client/review-queue.d.ts.map +1 -1
  184. package/lib/types/client/review-queue.js.map +1 -1
  185. package/lib/types/client/review-threads.d.ts +1 -1
  186. package/lib/types/client/review-threads.d.ts.map +1 -1
  187. package/lib/types/client/review.d.ts +12 -1
  188. package/lib/types/client/review.d.ts.map +1 -1
  189. package/lib/types/client/review.js.map +1 -1
  190. package/lib/types/client/row-form-labels.d.ts +12 -0
  191. package/lib/types/client/row-form-labels.d.ts.map +1 -0
  192. package/lib/types/client/row-form-labels.js.map +1 -0
  193. package/lib/types/client/session-list.d.ts +1 -1
  194. package/lib/types/client/session-list.d.ts.map +1 -1
  195. package/lib/types/client/slots.d.ts +1 -1
  196. package/lib/types/client/slots.d.ts.map +1 -1
  197. package/lib/types/client/source.d.ts +1 -1
  198. package/lib/types/client/source.d.ts.map +1 -1
  199. package/lib/types/client/status.d.ts +7 -0
  200. package/lib/types/client/status.d.ts.map +1 -1
  201. package/lib/types/client/status.js.map +1 -1
  202. package/lib/types/client/worktree-settings-form.d.ts +1 -1
  203. package/lib/types/client/worktree-settings-form.d.ts.map +1 -1
  204. package/lib/types/client/worktree-settings-form.js.map +1 -1
  205. package/lib/types/diff.d.ts.map +1 -1
  206. package/lib/types/diff.js.map +1 -1
  207. package/lib/types/git.d.ts +22 -0
  208. package/lib/types/git.d.ts.map +1 -1
  209. package/lib/types/git.js.map +1 -1
  210. package/lib/types/index.d.ts +113 -25
  211. package/lib/types/index.d.ts.map +1 -1
  212. package/lib/types/index.js.map +1 -1
  213. package/lib/types/local-diff.d.ts +81 -23
  214. package/lib/types/local-diff.d.ts.map +1 -1
  215. package/lib/types/local-diff.js.map +1 -1
  216. package/lib/types/local-write.d.ts +44 -0
  217. package/lib/types/local-write.d.ts.map +1 -0
  218. package/lib/types/local-write.js.map +1 -0
  219. package/lib/types/parse.d.ts +12 -3
  220. package/lib/types/parse.d.ts.map +1 -1
  221. package/lib/types/parse.js.map +1 -1
  222. package/lib/types/restore.d.ts +12 -0
  223. package/lib/types/restore.d.ts.map +1 -0
  224. package/lib/types/restore.js.map +1 -0
  225. package/lib/types/types.d.ts +106 -8
  226. package/lib/types/types.d.ts.map +1 -1
  227. package/lib/types/viewer-lists.d.ts +22 -13
  228. package/lib/types/viewer-lists.d.ts.map +1 -1
  229. package/lib/types/viewer-lists.js.map +1 -1
  230. package/package.json +60 -58
  231. package/src/client/ActionToast.tsx +2 -2
  232. package/src/client/AttentionIndicator.tsx +1 -1
  233. package/src/client/BaseMenu.module.css +12 -3
  234. package/src/client/BaseMenu.tsx +25 -88
  235. package/src/client/BranchPicker.tsx +161 -0
  236. package/src/client/ChangeRequestCard.tsx +138 -44
  237. package/src/client/ChangeRequestOverview.tsx +21 -9
  238. package/src/client/ChangeRequestsSection.tsx +12 -6
  239. package/src/client/ChangedFiles.tsx +2 -2
  240. package/src/client/ChangesLoading.tsx +1 -1
  241. package/src/client/ChangesTab.module.css +95 -16
  242. package/src/client/ChangesTab.tsx +190 -72
  243. package/src/client/ChangesTabTitle.tsx +2 -2
  244. package/src/client/CommitMenu.tsx +7 -5
  245. package/src/client/DiffFile.tsx +67 -11
  246. package/src/client/EnvironmentRows.tsx +21 -17
  247. package/src/client/FileLabel.tsx +1 -1
  248. package/src/client/Forge.module.css +28 -1
  249. package/src/client/HeadMenu.tsx +69 -0
  250. package/src/client/HostSettings.module.css +194 -0
  251. package/src/client/HostSettings.tsx +192 -0
  252. package/src/client/LensFilter.tsx +2 -2
  253. package/src/client/ReasonButton.tsx +1 -1
  254. package/src/client/RefreshGlyph.tsx +1 -1
  255. package/src/client/ReviewComposer.tsx +2 -2
  256. package/src/client/ReviewControls.tsx +10 -3
  257. package/src/client/ReviewThread.tsx +2 -2
  258. package/src/client/ReviewThreads.tsx +7 -4
  259. package/src/client/SessionHoverForge.tsx +2 -2
  260. package/src/client/SessionRowForge.tsx +2 -2
  261. package/src/client/SubmitReview.tsx +2 -2
  262. package/src/client/ThreadList.tsx +6 -3
  263. package/src/client/ViewOptionsMenu.tsx +2 -2
  264. package/src/client/WorktreeNameDialog.tsx +2 -2
  265. package/src/client/WorktreeProgress.tsx +2 -2
  266. package/src/client/WorktreeSettings.tsx +4 -11
  267. package/src/client/WorktreeToggle.tsx +2 -2
  268. package/src/client/annotations.ts +1 -1
  269. package/src/client/branch-search.tsx +2 -2
  270. package/src/client/changes-address.ts +1 -1
  271. package/src/client/changes-service.ts +1 -1
  272. package/src/client/changes-store.ts +49 -5
  273. package/src/client/checkout.ts +1 -1
  274. package/src/client/code-selection.ts +3 -1
  275. package/src/client/forge-copy.ts +11 -1
  276. package/src/client/format.ts +2 -2
  277. package/src/client/glyphs.tsx +50 -5
  278. package/src/client/highlight-context.ts +1 -1
  279. package/src/client/host-settings-form.ts +115 -0
  280. package/src/client/host-sign-in.ts +46 -0
  281. package/src/client/local-writes.ts +129 -0
  282. package/src/client/locales.ts +841 -65
  283. package/src/client/mount.ts +56 -7
  284. package/src/client/review-page/ReviewActivity.tsx +405 -0
  285. package/src/client/review-page/ReviewChat.tsx +2 -2
  286. package/src/client/review-page/ReviewDetail.tsx +201 -64
  287. package/src/client/review-page/ReviewLabels.tsx +2 -2
  288. package/src/client/review-page/ReviewList.tsx +153 -136
  289. package/src/client/review-page/ReviewNav.tsx +1 -1
  290. package/src/client/review-page/ReviewPage.module.css +490 -13
  291. package/src/client/review-page/ReviewPage.tsx +44 -21
  292. package/src/client/review-page/ReviewSkeleton.tsx +108 -0
  293. package/src/client/review-page/ReviewStatus.tsx +14 -9
  294. package/src/client/review-page/review-activity.ts +64 -0
  295. package/src/client/review-page/review-lists.ts +85 -22
  296. package/src/client/review-page/review-mount.ts +24 -7
  297. package/src/client/review-page/review-store.ts +24 -7
  298. package/src/client/review-queue.ts +7 -3
  299. package/src/client/review-threads.ts +1 -1
  300. package/src/client/review.ts +20 -2
  301. package/src/client/row-form-labels.ts +17 -0
  302. package/src/client/session-list.ts +1 -1
  303. package/src/client/slots.ts +1 -1
  304. package/src/client/source.ts +1 -1
  305. package/src/client/status.ts +20 -0
  306. package/src/client/worktree-settings-form.ts +1 -1
  307. package/src/diff.ts +8 -5
  308. package/src/git.ts +31 -1
  309. package/src/index.ts +241 -50
  310. package/src/local-diff.ts +151 -48
  311. package/src/local-write.ts +159 -0
  312. package/src/parse.ts +26 -4
  313. package/src/restore.ts +15 -0
  314. package/src/types.ts +97 -12
  315. package/src/viewer-lists.ts +124 -48
@@ -6,10 +6,13 @@
6
6
 
7
7
  import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'
8
8
  import clsx from 'clsx'
9
- import type { HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsStore } from '@deepseek-ai/dsh-client-ui-slots'
9
+ import type {
10
+ GlobalStandardProps, HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsStore,
11
+ } from '@deepseek-ai/dsh-client-ui-slots/client'
12
+ // Type-only: the `useMediaQuery` standard prop merge.
13
+ import type {} from '@deepseek-ai/dsh-client-ui-responsive/client'
10
14
  import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store'
11
- import type { ChangeRequestDescription, ForgeReviewThread } from '@deepseek-ai/dsh-experimental-forge/types'
12
- import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
15
+ import type { ForgeReviewThread } from '@deepseek-ai/dsh-experimental-forge/types'
13
16
  import type { ForgeReviewChangeRequest, ForgeReviewFrame } from '../../types.ts'
14
17
  import type { ChangeRequestActions } from '../ChangeRequestCard.tsx'
15
18
  import type { ForgeLensDescription } from '../changes-service.ts'
@@ -17,11 +20,11 @@ import { ChangesView, type ChangesTabInjected, type ChangesViewTab } from '../Ch
17
20
  import { useHostStream, type StreamRead } from './host-stream.ts'
18
21
  import type { NS } from '../locales.ts'
19
22
  import { ReviewChat, useReviewConversation, type ReviewChatFace } from './ReviewChat.tsx'
20
- import { ReviewDetail } from './ReviewDetail.tsx'
23
+ import { ReviewDetail, type ReviewSummaryFace } from './ReviewDetail.tsx'
21
24
  import { ReviewList } from './ReviewList.tsx'
22
25
  import type { QuoteCopy, ReviewSelection } from '../review.ts'
23
- import { reviewListsComplete, reviewRepositories } from './review-lists.ts'
24
- import type { createReviewStore, ReviewTab } from './review-store.ts'
26
+ import { reviewListsComplete, reviewRepositories, scopeRepository, type ReviewRepository } from './review-lists.ts'
27
+ import { changesTabOf, type createReviewStore, type ReviewTab } from './review-store.ts'
25
28
  import type { HostStream, StreamSnapshot } from '../source.ts'
26
29
  import type { ChangesPanelState } from '../status.ts'
27
30
  import type { SessionId } from '@deepseek-ai/dsh-session/types'
@@ -38,19 +41,23 @@ export type ReviewChangesFace = Omit<ChangesTabInjected, 'keyedHooks' | 'hooks'
38
41
  const CHAT_QUOTE_COPY: QuoteCopy = { add: 'reviewPage.addToChat', added: 'reviewPage.addedToChat', failed: 'reviewPage.addToChatFailed' }
39
42
 
40
43
  /** Business face of the review page. */
41
- export interface ReviewPageInjected {
42
- /** The UI language; the renderer binds it as `useLocale`. */
43
- readonly hooks: { readonly locale: HostObservable<string> }
44
- /** Open the list stream of one repository, named `owner/name`, or of every repository for the empty string. */
45
- readonly openLists: (scope: string, signal: AbortSignal) => HostStream<ForgeReviewFrame>
44
+ export interface ReviewPageInjected extends ReviewSummaryFace {
45
+ readonly hooks: {
46
+ /** The UI language; the renderer binds it as `useLocale`. */
47
+ readonly locale: HostObservable<string>
48
+ /** Whether the Plugins page can be opened; the renderer binds it as `usePluginNavigation`. */
49
+ readonly pluginNavigation: HostObservable<boolean>
50
+ }
51
+ /** Open the list stream of one repository on its host, or of every repository of every host for null. */
52
+ readonly openLists: (repository: ReviewRepository | null, signal: AbortSignal) => HostStream<ForgeReviewFrame>
46
53
  /** Open the stream of one change request by URL. */
47
54
  readonly openChangeRequest: (url: string, signal: AbortSignal) => HostStream<ForgeReviewChangeRequest>
48
55
  /** Subscribe to transport resets, after which open streams no longer deliver. */
49
56
  readonly subscribeReset: (listener: () => void) => () => void
50
57
  /** Read every list again; settles once the Host accepted the request, after reporting a failure. */
51
58
  readonly refresh: () => Promise<void>
52
- /** Read the description and labels of a change request. */
53
- readonly readDescription: (url: string, signal: AbortSignal) => Promise<RemoteResult<ChangeRequestDescription>>
59
+ /** Open the Plugins page where the providers' hosts are listed, while `pluginNavigation` holds. */
60
+ readonly openHostSettings: () => void
54
61
  /** The card actions acting on one change request; `showChanges` opens the changes tab. */
55
62
  readonly actionsFor: (url: string, showChanges: () => void) => ChangeRequestActions
56
63
  /** Reads and writes of the changes view. */
@@ -68,6 +75,7 @@ export interface ReviewPageInjected {
68
75
  /** Full props of the review page. */
69
76
  export type ReviewPageProps = InjectFace<ReviewPageInjected> & PropsStore<ReturnType<typeof createReviewStore>>
70
77
  & Pick<PropsRenderSlots<'forge.review.conversation'>, 'renderSlot' | 'SessionProvider'> & PropsLocale<typeof NS>
78
+ & Pick<GlobalStandardProps, 'useMediaQuery'>
71
79
 
72
80
  /** Selector hooks over a fixed value, for the parts of the changes view the review page does not offer. */
73
81
  function fixedHook<T>(value: T): SnapshotSelectorHook<T> {
@@ -108,7 +116,7 @@ function ReviewChanges({ frame, visible, changes, useStore, actions, t }: {
108
116
  return () => { controller.abort() }
109
117
  }, [url])
110
118
  const tab = useMemo((): ChangesViewTab | null => lifetime === null ? null : {
111
- id: `review:${url}`, visible, navigation: { address: url, params: undefined, revision: 1 }, signal: lifetime.signal,
119
+ id: changesTabOf(url), visible, navigation: { address: url, params: undefined, revision: 1 }, signal: lifetime.signal,
112
120
  actions: { bindCommands: NO_BINDING },
113
121
  }, [url, visible, lifetime])
114
122
  const source = useMemo(() => ({ kind: 'change' as const, url }), [url])
@@ -136,6 +144,7 @@ interface DetailPaneProps {
136
144
  readonly conversationId: SessionId | undefined
137
145
  readonly onConversation: (sessionId: SessionId | null) => void
138
146
  readonly unseenQuotes: number
147
+ readonly coarsePointer: boolean
139
148
  readonly page: ReviewPageProps
140
149
  }
141
150
 
@@ -146,9 +155,11 @@ interface DetailPaneProps {
146
155
  * @returns the detail.
147
156
  */
148
157
  function DetailPane({
149
- url, read, tab, listHidden, now, locale, cardActions, conversationId, onConversation, unseenQuotes, page,
158
+ url, read, tab, listHidden, now, locale, cardActions, conversationId, onConversation, unseenQuotes, coarsePointer, page,
150
159
  }: DetailPaneProps): ReactNode {
151
- const { actions, changes, chat, quoteReview, quoteThread, readDescription, renderSlot, SessionProvider, useStore, t } = page
160
+ const { actions, changes, chat, quoteReview, quoteThread, readDescription, readActivity, addComment, renderSlot } = page
161
+ const { SessionProvider, useStore, t } = page
162
+ const hostSettings = page.usePluginNavigation(value => value)
152
163
  const conversation = useReviewConversation(read.frame, conversationId, onConversation, chat)
153
164
  const { start } = conversation
154
165
  const quoteChanges = useMemo(() => {
@@ -171,6 +182,7 @@ function DetailPane({
171
182
  read={read}
172
183
  tab={tab}
173
184
  onTab={(value: ReviewTab) => { actions.tabbed(value) }}
185
+ onOpenCommit={(sha: string) => { actions.openedCommit(url, sha) }}
174
186
  listHidden={listHidden}
175
187
  onToggleList={() => { actions.toggledList() }}
176
188
  onBack={() => { actions.select(null) }}
@@ -178,6 +190,9 @@ function DetailPane({
178
190
  locale={locale}
179
191
  actions={cardActions}
180
192
  readDescription={readDescription}
193
+ readActivity={readActivity}
194
+ addComment={addComment}
195
+ onAddHost={hostSettings ? page.openHostSettings : undefined}
181
196
  renderChanges={frame => (
182
197
  <ReviewChanges frame={frame} visible={tab === 'changes'} changes={quoteChanges} useStore={useStore} actions={actions} t={t} />
183
198
  )}
@@ -186,6 +201,7 @@ function DetailPane({
186
201
  renderSlot={renderSlot} SessionProvider={SessionProvider} t={t} />
187
202
  )}
188
203
  unseenQuotes={unseenQuotes}
204
+ coarsePointer={coarsePointer}
189
205
  t={t}
190
206
  />
191
207
  )
@@ -193,18 +209,20 @@ function DetailPane({
193
209
 
194
210
  /**
195
211
  * Render the review page.
196
- * @param props - the Host streams and reads, the card actions, the page store, and copy.
212
+ * @param props - the Host streams and reads, the card actions, the page store, the media query hook, and copy.
197
213
  * @returns the page.
198
214
  */
199
215
  export function ReviewPage(props: ReviewPageProps): ReactNode {
200
216
  const { useLocale, openLists, openChangeRequest, subscribeReset, refresh, actionsFor, copyText, useStore, actions, t } = props
201
217
  const locale = useLocale(value => value)
218
+ const coarsePointer = props.useMediaQuery('(pointer: coarse)')
202
219
  const now = useMinuteClock()
203
220
  const selected = useStore(state => state.selected)
204
221
  const tab = useStore(state => state.tab)
205
222
  const listHidden = useStore(state => state.listHidden)
206
223
  const folded = useStore(state => state.folded)
207
- const repository = useStore(state => state.repository)
224
+ const scope = useStore(state => state.scope)
225
+ const repository = scopeRepository(scope)
208
226
  const repositories = useStore(state => state.repositories)
209
227
  const query = useStore(state => state.query)
210
228
  const directOnly = useStore(state => state.directOnly)
@@ -214,8 +232,11 @@ export function ReviewPage(props: ReviewPageProps): ReactNode {
214
232
  const onConversation = useMemo(() => selected === null ? null : (sessionId: SessionId | null) => {
215
233
  actions.conversed(selected, sessionId)
216
234
  }, [actions, selected])
217
- const scope = repository === null ? '' : `${repository.owner}/${repository.name}`
218
- const lists = useHostStream(openLists, scope, subscribeReset)
235
+ // A scope that names a host only narrows the lists of every repository on the page; one repository is read on its host.
236
+ const listsKey = repository === null ? '' : JSON.stringify([repository.host, repository.owner, repository.name])
237
+ const openScoped = useCallback((_key: string, signal: AbortSignal) => openLists(repository, signal), [openLists, repository])
238
+ const lists = useHostStream(openScoped, listsKey, subscribeReset)
239
+ const hostSettings = props.usePluginNavigation(value => value)
219
240
  // Lists read in one repository name only that one, so the repository menu's offer is recorded while they are read in all.
220
241
  const listsFrame = lists.frame
221
242
  useEffect(() => {
@@ -238,7 +259,7 @@ export function ReviewPage(props: ReviewPageProps): ReactNode {
238
259
  stopped={lists.stopped}
239
260
  selected={selected}
240
261
  query={query}
241
- repository={repository}
262
+ scope={scope}
242
263
  repositories={repositories}
243
264
  directOnly={directOnly}
244
265
  folded={folded}
@@ -254,6 +275,7 @@ export function ReviewPage(props: ReviewPageProps): ReactNode {
254
275
  onRefresh={startRefresh}
255
276
  onRetry={lists.retry}
256
277
  copyText={copyText}
278
+ onOpenSettings={hostSettings ? props.openHostSettings : undefined}
257
279
  t={t}
258
280
  />
259
281
  {selected === null || cardActions === null || onConversation === null
@@ -278,6 +300,7 @@ export function ReviewPage(props: ReviewPageProps): ReactNode {
278
300
  conversationId={conversation}
279
301
  onConversation={onConversation}
280
302
  unseenQuotes={unseenQuotes}
303
+ coarsePointer={coarsePointer}
281
304
  page={props}
282
305
  />
283
306
  )}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Skeletons of the review page's detail, drawn while a change request, its description, or its activity is read.
3
+ * Each row is as tall as the content it stands for, so the content replaces it without moving what follows.
4
+ */
5
+
6
+ import type { ReactNode } from 'react'
7
+ import clsx from 'clsx'
8
+ import loading from '../ChangesLoading.module.css'
9
+ import css from './ReviewPage.module.css'
10
+
11
+ /** Widths of the description's lines in percent; zero is the gap between two paragraphs. */
12
+ const DESCRIPTION_LINES = [96, 100, 88, 54, 0, 92, 70, 38] as const
13
+
14
+ /** Rows of each block of the status column, as the width of each row's text in percent; a headed block has a caption row. */
15
+ const STATUS_BLOCKS: readonly { readonly head: boolean; readonly rows: readonly number[] }[] = [
16
+ { head: false, rows: [58] },
17
+ { head: true, rows: [46, 62, 40] },
18
+ { head: true, rows: [34, 30] },
19
+ { head: false, rows: [28] },
20
+ ]
21
+
22
+ function Fill({ className, width }: { readonly className?: string | undefined; readonly width?: string | undefined }): ReactNode {
23
+ return <span className={clsx(loading.fill, className)} style={width === undefined ? undefined : { width }} />
24
+ }
25
+
26
+ function Lines({ widths }: { readonly widths: readonly number[] }): ReactNode {
27
+ return (
28
+ <div className={css.skeletonLines}>
29
+ {widths.map((width, index) => width === 0 ? <i key={index} /> : <Fill key={index} width={`${width}%`} />)}
30
+ </div>
31
+ )
32
+ }
33
+
34
+ function Row({ width, timed = false }: { readonly width: number; readonly timed?: boolean }): ReactNode {
35
+ return (
36
+ <div className={css.skeletonRow}>
37
+ <Fill className={css.skeletonGlyph} />
38
+ <Fill className={css.skeletonBar} width={`${width}%`} />
39
+ {timed && <Fill className={css.skeletonTime} />}
40
+ </div>
41
+ )
42
+ }
43
+
44
+ /**
45
+ * Draw the title, the line under it, and the tabs of a change request that is not read yet.
46
+ * @returns the three rows, hidden from assistive technology.
47
+ */
48
+ export function HeaderSkeleton(): ReactNode {
49
+ return (
50
+ <>
51
+ <div className={css.skeletonTitle} aria-hidden="true"><Fill /></div>
52
+ <div className={css.skeletonDetailMeta} aria-hidden="true"><Fill /></div>
53
+ <div className={css.tabs} aria-hidden="true">
54
+ {[0, 1, 2].map(tab => <span key={tab} className={css.skeletonTab}><Fill /></span>)}
55
+ </div>
56
+ </>
57
+ )
58
+ }
59
+
60
+ /**
61
+ * Draw the lines of a description that is not read yet.
62
+ * @returns the lines, hidden from assistive technology.
63
+ */
64
+ export function DescriptionSkeleton(): ReactNode {
65
+ return <div aria-hidden="true" data-forge-review-skeleton="description"><Lines widths={DESCRIPTION_LINES} /></div>
66
+ }
67
+
68
+ /**
69
+ * Draw the rows of an activity that is not read yet: two lines, a comment card, and one more line.
70
+ * @returns the rows, hidden from assistive technology.
71
+ */
72
+ export function ActivitySkeleton(): ReactNode {
73
+ return (
74
+ <div className={css.activityLines} aria-hidden="true" data-forge-review-skeleton="activity">
75
+ <Row width={34} timed />
76
+ <Row width={52} timed />
77
+ <div className={css.activityComment}>
78
+ <div className={css.activityCommentHead}>
79
+ <Fill className={css.skeletonAvatar} />
80
+ <Fill className={css.skeletonBar} width="96px" />
81
+ </div>
82
+ <Lines widths={[94, 60]} />
83
+ </div>
84
+ <Row width={40} timed />
85
+ </div>
86
+ )
87
+ }
88
+
89
+ /**
90
+ * Draw the blocks of a status column that is not read yet.
91
+ * @returns the blocks, hidden from assistive technology.
92
+ */
93
+ export function StatusSkeleton(): ReactNode {
94
+ return (
95
+ <aside className={css.facts} aria-hidden="true" data-forge-review-skeleton="status">
96
+ {STATUS_BLOCKS.map((block, index) => (
97
+ <div key={index} className={css.statusSection}>
98
+ {block.head && (
99
+ <div className={css.statusHead}><Fill className={css.skeletonBar} width="36px" /><Fill className={css.skeletonSummary} /></div>
100
+ )}
101
+ <div className={clsx(css.statusList, !block.head && css.skeletonHeadless)}>
102
+ {block.rows.map((width, row) => <Row key={row} width={width} />)}
103
+ </div>
104
+ </div>
105
+ ))}
106
+ </aside>
107
+ )
108
+ }
@@ -9,8 +9,8 @@ import { useState, type ReactNode } from 'react'
9
9
  import clsx from 'clsx'
10
10
  import {
11
11
  IconChevronDownOutlineRegular, IconChevronUpOutlineRegular, IconPlusOutlineRegular, IconRefreshOutlineRegular, Menu,
12
- } from '@deepseek-ai/dsh-client-ui-primitives'
13
- import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
12
+ } from '@deepseek-ai/dsh-client-ui-primitives/client'
13
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
14
14
  import type { ChangeRequestCheck, ChangeRequestReviewer, ChangeRequestSnapshot } from '@deepseek-ai/dsh-experimental-forge/types'
15
15
  import type { ForgeReviewChangeRequest } from '../../types.ts'
16
16
  import {
@@ -133,7 +133,7 @@ function Checks({ frame, snapshot, actions, t }: StatusProps): ReactNode {
133
133
  * latest outcome or pending request. When the signed-in user may request reviews of an open change request, its last
134
134
  * line opens the menu that asks a reviewer again or searches for someone else.
135
135
  */
136
- function Reviewers({ frame, snapshot, actions, t }: StatusProps): ReactNode {
136
+ function Reviewers({ frame, snapshot, actions, coarsePointer, t }: StatusProps & { readonly coarsePointer: boolean }): ReactNode {
137
137
  const [all, setAll] = useState(false)
138
138
  const [open, setOpen] = useState(false)
139
139
  const [searching, setSearching] = useState(false)
@@ -171,7 +171,7 @@ function Reviewers({ frame, snapshot, actions, t }: StatusProps): ReactNode {
171
171
  </button>
172
172
  )}
173
173
  {requesting !== undefined && (
174
- <Menu open={open} onClose={close} portal dense align="start" listClassName={overview.menu}
174
+ <Menu open={open} onClose={close} portal dense align="start" className={css.statusAnchor} listClassName={overview.menu}
175
175
  anchor={(
176
176
  <button type="button" className={clsx(css.statusLine, css.statusLineButton, css.statusAction)} aria-haspopup="menu"
177
177
  aria-expanded={open} disabled={busy} data-forge-review-request="" onClick={() => { if (open) close(); else setOpen(true) }}>
@@ -181,7 +181,7 @@ function Reviewers({ frame, snapshot, actions, t }: StatusProps): ReactNode {
181
181
  )}>
182
182
  {searching || again.length === 0
183
183
  ? (
184
- <ReviewerSearch url={snapshot.url} list={requesting.list} t={t} choose={(login) => {
184
+ <ReviewerSearch url={snapshot.url} list={requesting.list} coarsePointer={coarsePointer} t={t} choose={(login) => {
185
185
  close()
186
186
  run(() => requesting.ask(frame, [{ kind: 'user', login }]))
187
187
  }} />
@@ -216,13 +216,15 @@ export interface StatusProps {
216
216
  /**
217
217
  * Render the status column.
218
218
  * @param props - the change request, its snapshot, how rows name it, the current time, the actions, the number
219
- * locale, and copy.
219
+ * locale, whether the page's primary pointer is coarse, which keeps the reviewer search from focusing its field, and
220
+ * copy.
220
221
  * @returns the blocks.
221
222
  */
222
- export function ReviewStatus({ frame, snapshot, name, now, actions, locale, t }: StatusProps & {
223
+ export function ReviewStatus({ frame, snapshot, name, now, actions, locale, coarsePointer, t }: StatusProps & {
223
224
  readonly name: string
224
225
  readonly now: number
225
226
  readonly locale: string
227
+ readonly coarsePointer: boolean
226
228
  }): ReactNode {
227
229
  const changes = <ChangesRow entry={frame} snapshot={snapshot} name={name} actions={actions} locale={locale} t={t} />
228
230
  if (snapshot.state !== 'open') {
@@ -234,7 +236,9 @@ export function ReviewStatus({ frame, snapshot, name, now, actions, locale, t }:
234
236
  {changes}
235
237
  </div>
236
238
  </div>
237
- {snapshot.reviewers.length > 0 && <Reviewers frame={frame} snapshot={snapshot} actions={actions} t={t} />}
239
+ {snapshot.reviewers.length > 0 && (
240
+ <Reviewers frame={frame} snapshot={snapshot} actions={actions} coarsePointer={coarsePointer} t={t} />
241
+ )}
238
242
  </>
239
243
  )
240
244
  }
@@ -247,7 +251,8 @@ export function ReviewStatus({ frame, snapshot, name, now, actions, locale, t }:
247
251
  </div>
248
252
  {/* A new head starts both blocks afresh: their folds, and the checks read for the previous head. */}
249
253
  <Checks key={`checks:${snapshot.headSha}`} frame={frame} snapshot={snapshot} actions={actions} t={t} />
250
- <Reviewers key={`reviewers:${snapshot.headSha}`} frame={frame} snapshot={snapshot} actions={actions} t={t} />
254
+ <Reviewers key={`reviewers:${snapshot.headSha}`} frame={frame} snapshot={snapshot} actions={actions}
255
+ coarsePointer={coarsePointer} t={t} />
251
256
  <div className={css.statusCard} data-forge-review-changes="">
252
257
  <div className={css.statusRows}>
253
258
  {changes}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The summary tab's activity helpers: its rows, with every run of commits as one, and which comment texts start cut
3
+ * short.
4
+ */
5
+
6
+ import type { ChangeRequestActivityItem } from '@deepseek-ai/dsh-experimental-forge/types'
7
+
8
+ /** A commit of the activity. */
9
+ export type ActivityCommit = Extract<ChangeRequestActivityItem, { readonly kind: 'commit' }>
10
+
11
+ /** An activity item other than a commit. */
12
+ export type ActivityEvent = Exclude<ChangeRequestActivityItem, ActivityCommit>
13
+
14
+ /**
15
+ * One row of the activity: an item other than a commit, or the commits that follow one another. `key` tells the rows of
16
+ * one activity apart and stays the same when a later read adds or drops other rows.
17
+ */
18
+ export type ActivityEntry =
19
+ | { readonly kind: 'commits'; readonly key: string; readonly commits: readonly [ActivityCommit, ...ActivityCommit[]] }
20
+ | { readonly kind: 'item'; readonly key: string; readonly item: ActivityEvent }
21
+
22
+ /** Most characters of a comment text that shows whole from the start. */
23
+ const WHOLE_CHARACTERS = 400
24
+
25
+ /** Most lines of a comment text that shows whole from the start. */
26
+ const WHOLE_LINES = 6
27
+
28
+ /**
29
+ * Lay the activity out as rows.
30
+ * @param items - the activity, oldest first.
31
+ * @returns the rows in the same order, with every run of consecutive commits as one row.
32
+ */
33
+ export function activityEntries(items: readonly ChangeRequestActivityItem[]): readonly ActivityEntry[] {
34
+ const entries: ActivityEntry[] = []
35
+ const seen = new Map<string, number>()
36
+ // Two rows of one kind, time, and actor differ by their count.
37
+ const keyOf = (name: string): string => {
38
+ const count = seen.get(name) ?? 0
39
+ seen.set(name, count + 1)
40
+ return count === 0 ? name : `${name}#${count}`
41
+ }
42
+ let run: [ActivityCommit, ...ActivityCommit[]] | null = null
43
+ for (const item of items) {
44
+ if (item.kind !== 'commit') {
45
+ run = null
46
+ entries.push({ kind: 'item', key: keyOf(`${item.kind}:${item.at}:${item.actor?.login ?? ''}`), item })
47
+ } else if (run === null) {
48
+ run = [item]
49
+ entries.push({ kind: 'commits', key: keyOf(`commits:${item.sha}`), commits: run })
50
+ } else {
51
+ run.push(item)
52
+ }
53
+ }
54
+ return entries
55
+ }
56
+
57
+ /**
58
+ * Whether a comment text starts cut short, with a control that shows the rest.
59
+ * @param body - Markdown source of the comment.
60
+ * @returns whether it is longer than the text that shows whole.
61
+ */
62
+ export function longBody(body: string): boolean {
63
+ return body.length > WHOLE_CHARACTERS || body.split('\n').length > WHOLE_LINES
64
+ }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * What the review page's list column shows from the Host's list frames: one section per list with its items and the
3
- * text they are searched by, the hint each item carries, the repositories the lists name, and the failure each section reports.
3
+ * text they are searched by, the hint each item carries, the repositories the lists name by host, and the hosts whose
4
+ * read failed.
4
5
  */
5
6
 
6
7
  import type { ChangeRequestSummary, ForgeFailure, ForgeViewerFilter } from '@deepseek-ai/dsh-experimental-forge/types'
@@ -32,73 +33,130 @@ export interface ReviewSection {
32
33
  readonly total: number
33
34
  /** Whether some host listed fewer change requests than its total. */
34
35
  readonly truncated: boolean
35
- /** The first failure of the latest read on any host, or null. */
36
- readonly failure: { readonly host: string; readonly forge: string; readonly failure: ForgeFailure } | null
36
+ /** Whether some host has neither read the list nor failed to, so its change requests are still to come. */
37
+ readonly pending: boolean
37
38
  }
38
39
 
39
- /** A repository the lists name. */
40
+ /** A repository the lists name, on the host that listed it. */
40
41
  export interface ReviewRepository {
42
+ /** Host the repository was listed on. */
43
+ readonly host: string
41
44
  /** Owner or namespace. */
42
45
  readonly owner: string
43
46
  /** Repository name. */
44
47
  readonly name: string
45
48
  }
46
49
 
50
+ /** What the reader narrowed the lists to: every repository of one host, or one repository. */
51
+ export type ReviewScope = { readonly host: string } | ReviewRepository
52
+
53
+ /** A host whose latest read of some list failed. */
54
+ export interface ReviewHostFailure {
55
+ /** Forge family of the provider that lists on the host. */
56
+ readonly forge: string
57
+ /** The host. */
58
+ readonly host: string
59
+ /** The first failure among the host's lists, in page order. */
60
+ readonly failure: ForgeFailure
61
+ /** The command that signs the provider's CLI in to the host, or null when the failure is another or the provider names none. */
62
+ readonly signIn: string | null
63
+ }
64
+
65
+ /**
66
+ * The repository a scope names.
67
+ * @param scope - the reader's scope, or null for every repository of every host.
68
+ * @returns the repository, or null for a scope that names a host only or none.
69
+ */
70
+ export function scopeRepository(scope: ReviewScope | null): ReviewRepository | null {
71
+ return scope !== null && 'name' in scope ? scope : null
72
+ }
73
+
74
+ /**
75
+ * Whether two scopes narrow the lists to the same host or repository.
76
+ * @param left - one scope, or null for none.
77
+ * @param right - the other scope, or null for none.
78
+ * @returns whether they are the same.
79
+ */
80
+ export function sameScope(left: ReviewScope | null, right: ReviewScope | null): boolean {
81
+ if (left === null || right === null) return left === right
82
+ const one = scopeRepository(left)
83
+ const other = scopeRepository(right)
84
+ return left.host === right.host && one?.owner === other?.owner && one?.name === other?.name
85
+ }
86
+
47
87
  /**
48
88
  * Build the list sections from one frame.
49
89
  * @param frame - the latest frame, or undefined before the first.
50
90
  * @param directOnly - whether the review-requested list leaves out requests made only of one of the user's teams.
91
+ * @param host - the host the reader narrowed the lists to, or null for every host of the frame.
51
92
  * @returns one section per list some host offers, in page order, each with every item most recently updated first.
52
93
  */
53
- export function reviewSections(frame: ForgeReviewFrame | undefined, directOnly: boolean): readonly ReviewSection[] {
94
+ export function reviewSections(frame: ForgeReviewFrame | undefined, directOnly: boolean, host: string | null): readonly ReviewSection[] {
54
95
  if (frame === undefined) return []
55
96
  const sections: ReviewSection[] = []
56
97
  for (const filter of REVIEW_FILTERS) {
57
- const lists = frame.hosts.flatMap((host) => {
58
- const list = host.lists[filter]
59
- return list === undefined ? [] : [{ host, list }]
98
+ const lists = frame.hosts.flatMap((entry) => {
99
+ const list = entry.lists[filter]
100
+ return list === undefined || (host !== null && entry.host !== host) ? [] : [{ host: entry, list }]
60
101
  })
61
102
  if (lists.length === 0) continue
62
103
  let items: ReviewItem[] | null = null
63
104
  let total = 0
64
105
  let truncated = false
65
- let failure: ReviewSection['failure'] = null
66
- for (const { host, list } of lists) {
67
- if (list.failure !== null && failure === null) failure = { host: host.host, forge: host.forge, failure: list.failure }
68
- if (list.items === null) continue
106
+ let pending = false
107
+ for (const { host: entry, list } of lists) {
108
+ if (list.items === null) {
109
+ pending ||= list.failure === null
110
+ continue
111
+ }
69
112
  total += list.total
70
113
  truncated ||= list.total > list.items.length
71
114
  items ??= []
72
115
  for (const summary of list.items) {
73
116
  if (filter === 'review-requested' && directOnly && summary.viewerRequest !== null && summary.viewerRequest.team !== null) continue
74
- items.push({ summary, forge: host.forge, host: host.host })
117
+ items.push({ summary, forge: entry.forge, host: entry.host })
75
118
  }
76
119
  }
77
120
  items?.sort((left, right) => Date.parse(right.summary.updatedAt) - Date.parse(left.summary.updatedAt))
78
- sections.push({ filter, items, total, truncated, failure })
121
+ sections.push({ filter, items, total, truncated, pending })
79
122
  }
80
123
  return sections
81
124
  }
82
125
 
83
126
  /**
84
- * The text a listed change request is searched by under the client search rule: its title, number, repository, and
85
- * author each match as a substring or a word-start fuzzy subsequence.
127
+ * List the hosts whose latest read of some list failed, so the page reports each once.
128
+ * @param frame - the latest frame, or undefined before the first.
129
+ * @param host - the host the reader narrowed the lists to, or null for every host of the frame.
130
+ * @returns the hosts in frame order, each with the first failure among its lists.
131
+ */
132
+ export function reviewFailures(frame: ForgeReviewFrame | undefined, host: string | null): readonly ReviewHostFailure[] {
133
+ return (frame?.hosts ?? []).flatMap((entry) => {
134
+ if (host !== null && entry.host !== host) return []
135
+ const failure = REVIEW_FILTERS.map(filter => entry.lists[filter]?.failure ?? null).find(found => found !== null)
136
+ return failure === undefined ? [] : [{ forge: entry.forge, host: entry.host, failure, signIn: entry.signIn }]
137
+ })
138
+ }
139
+
140
+ /**
141
+ * The text a listed change request is searched by under the client search rule: its title, number, repository, author,
142
+ * and host each match as a substring or a word-start fuzzy subsequence.
86
143
  * @param item - the listed change request.
87
144
  * @returns the search keys.
88
145
  */
89
146
  export function reviewSearchKeys(item: ReviewItem): SearchKeys {
90
147
  const { repository, number } = item.summary.ref
91
- return { fuzzy: [item.summary.title, `#${number}`, `${repository.owner}/${repository.name}`, item.summary.author?.login] }
148
+ return { fuzzy: [item.summary.title, `#${number}`, `${repository.owner}/${repository.name}`, item.summary.author?.login, item.host] }
92
149
  }
93
150
 
94
151
  /**
95
- * List the repositories the lists name, by owner then name.
152
+ * List the repositories the lists name, by host, then owner, then name.
96
153
  * @param frame - the latest frame, or undefined before the first.
97
154
  * @returns distinct repositories.
98
155
  */
99
156
  export function reviewRepositories(frame: ForgeReviewFrame | undefined): readonly ReviewRepository[] {
100
157
  return mergeRepositories((frame?.hosts ?? []).flatMap(host =>
101
- Object.values(host.lists).flatMap(list => (list.items ?? []).map(item => item.ref.repository))))
158
+ Object.values(host.lists).flatMap(list => (list.items ?? []).map(({ ref: { repository } }) =>
159
+ ({ host: host.host, owner: repository.owner, name: repository.name })))))
102
160
  }
103
161
 
104
162
  /**
@@ -112,15 +170,20 @@ export function reviewListsComplete(frame: ForgeReviewFrame | undefined): boolea
112
170
  && frame.hosts.every(host => Object.values(host.lists).every(list => list.items !== null && list.failure === null))
113
171
  }
114
172
 
173
+ /** A repository's place in the order {@link mergeRepositories} sorts by, which is also its identity. */
174
+ function repositoryKey({ host, owner, name }: ReviewRepository): string {
175
+ return `${host}\n${owner}/${name}`.toLowerCase()
176
+ }
177
+
115
178
  /**
116
- * Merge repositories into one list without duplicates, by owner then name.
179
+ * Merge repositories into one list without duplicates, by host, then owner, then name.
117
180
  * @param groups - lists of repositories.
118
181
  * @returns the distinct repositories, sorted as {@link reviewRepositories} sorts.
119
182
  */
120
183
  export function mergeRepositories(...groups: readonly (readonly ReviewRepository[])[]): readonly ReviewRepository[] {
121
184
  const seen = new Map<string, ReviewRepository>()
122
- for (const { owner, name } of groups.flat()) seen.set(`${owner}/${name}`.toLowerCase(), { owner, name })
123
- return [...seen.values()].sort((left, right) => `${left.owner}/${left.name}`.localeCompare(`${right.owner}/${right.name}`))
185
+ for (const { host, owner, name } of groups.flat()) seen.set(repositoryKey({ host, owner, name }), { host, owner, name })
186
+ return [...seen].sort(([left], [right]) => left.localeCompare(right)).map(([, repository]) => repository)
124
187
  }
125
188
 
126
189
  /** The hint an item carries: a dictionary key and its values. */