@deepseek-ai/dsh-experimental-client-ui-forge 0.2.2-rc.5 → 0.2.3-alpha.2

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 (334) hide show
  1. package/README.i18n.yaml +12 -12
  2. package/README.md +47 -30
  3. package/README.zh.md +47 -30
  4. package/lib/client.js +18 -8
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +2444 -406
  7. package/lib/typert.host.js +3433 -950
  8. package/lib/typert.remote-client.d.ts +89 -14
  9. package/lib/typert.remote-client.d.ts.map +1 -1
  10. package/lib/typert.remote-client.js +3155 -978
  11. package/lib/types/branch-name.d.ts +30 -0
  12. package/lib/types/branch-name.d.ts.map +1 -0
  13. package/lib/types/branch-name.js.map +1 -0
  14. package/lib/types/client/AttentionIndicator.d.ts +22 -0
  15. package/lib/types/client/AttentionIndicator.d.ts.map +1 -0
  16. package/lib/types/client/AttentionIndicator.js.map +1 -0
  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/ChangeRequestCard.d.ts +87 -9
  20. package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
  21. package/lib/types/client/ChangeRequestCard.js.map +1 -1
  22. package/lib/types/client/ChangeRequestOverview.d.ts +126 -10
  23. package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
  24. package/lib/types/client/ChangeRequestOverview.js.map +1 -1
  25. package/lib/types/client/ChangeRequestsSection.d.ts +76 -0
  26. package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -0
  27. package/lib/types/client/ChangeRequestsSection.js.map +1 -0
  28. package/lib/types/client/ChangedFiles.d.ts +6 -2
  29. package/lib/types/client/ChangedFiles.d.ts.map +1 -1
  30. package/lib/types/client/ChangedFiles.js.map +1 -1
  31. package/lib/types/client/ChangesLoading.d.ts +14 -0
  32. package/lib/types/client/ChangesLoading.d.ts.map +1 -0
  33. package/lib/types/client/ChangesLoading.js.map +1 -0
  34. package/lib/types/client/ChangesTab.d.ts +62 -14
  35. package/lib/types/client/ChangesTab.d.ts.map +1 -1
  36. package/lib/types/client/ChangesTab.js.map +1 -1
  37. package/lib/types/client/ChangesTabTitle.js.map +1 -1
  38. package/lib/types/client/DiffFile.d.ts +23 -4
  39. package/lib/types/client/DiffFile.d.ts.map +1 -1
  40. package/lib/types/client/DiffFile.js.map +1 -1
  41. package/lib/types/client/EnvironmentRows.d.ts +79 -0
  42. package/lib/types/client/EnvironmentRows.d.ts.map +1 -0
  43. package/lib/types/client/EnvironmentRows.js.map +1 -0
  44. package/lib/types/client/FileTreePane.d.ts +5 -2
  45. package/lib/types/client/FileTreePane.d.ts.map +1 -1
  46. package/lib/types/client/FileTreePane.js.map +1 -1
  47. package/lib/types/client/LensFilter.d.ts +50 -0
  48. package/lib/types/client/LensFilter.d.ts.map +1 -0
  49. package/lib/types/client/LensFilter.js.map +1 -0
  50. package/lib/types/client/ReasonButton.d.ts +15 -0
  51. package/lib/types/client/ReasonButton.d.ts.map +1 -0
  52. package/lib/types/client/ReasonButton.js.map +1 -0
  53. package/lib/types/client/ReviewComposer.d.ts +11 -4
  54. package/lib/types/client/ReviewComposer.d.ts.map +1 -1
  55. package/lib/types/client/ReviewComposer.js.map +1 -1
  56. package/lib/types/client/ReviewControls.d.ts +18 -7
  57. package/lib/types/client/ReviewControls.d.ts.map +1 -1
  58. package/lib/types/client/ReviewControls.js.map +1 -1
  59. package/lib/types/client/ReviewThread.d.ts +3 -1
  60. package/lib/types/client/ReviewThread.d.ts.map +1 -1
  61. package/lib/types/client/ReviewThread.js.map +1 -1
  62. package/lib/types/client/ReviewThreads.d.ts +32 -2
  63. package/lib/types/client/ReviewThreads.d.ts.map +1 -1
  64. package/lib/types/client/ReviewThreads.js.map +1 -1
  65. package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
  66. package/lib/types/client/SessionHoverForge.js.map +1 -1
  67. package/lib/types/client/SubmitReview.d.ts +4 -4
  68. package/lib/types/client/SubmitReview.d.ts.map +1 -1
  69. package/lib/types/client/SubmitReview.js.map +1 -1
  70. package/lib/types/client/ThreadList.js.map +1 -1
  71. package/lib/types/client/ViewOptionsMenu.d.ts +7 -1
  72. package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
  73. package/lib/types/client/ViewOptionsMenu.js.map +1 -1
  74. package/lib/types/client/WorktreeNameDialog.d.ts +38 -0
  75. package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -0
  76. package/lib/types/client/WorktreeNameDialog.js.map +1 -0
  77. package/lib/types/client/WorktreeProgress.d.ts +14 -3
  78. package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
  79. package/lib/types/client/WorktreeProgress.js.map +1 -1
  80. package/lib/types/client/WorktreeToggle.d.ts +22 -15
  81. package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
  82. package/lib/types/client/WorktreeToggle.js.map +1 -1
  83. package/lib/types/client/action-notices.d.ts +25 -0
  84. package/lib/types/client/action-notices.d.ts.map +1 -0
  85. package/lib/types/client/action-notices.js.map +1 -0
  86. package/lib/types/client/annotations.d.ts +41 -0
  87. package/lib/types/client/annotations.d.ts.map +1 -0
  88. package/lib/types/client/annotations.js.map +1 -0
  89. package/lib/types/client/branch-search.d.ts +38 -0
  90. package/lib/types/client/branch-search.d.ts.map +1 -0
  91. package/lib/types/client/branch-search.js.map +1 -0
  92. package/lib/types/client/change-requests-store.d.ts +25 -0
  93. package/lib/types/client/change-requests-store.d.ts.map +1 -0
  94. package/lib/types/client/change-requests-store.js.map +1 -0
  95. package/lib/types/client/changes-address.d.ts +3 -1
  96. package/lib/types/client/changes-address.d.ts.map +1 -1
  97. package/lib/types/client/changes-address.js.map +1 -1
  98. package/lib/types/client/changes-service.d.ts +119 -0
  99. package/lib/types/client/changes-service.d.ts.map +1 -0
  100. package/lib/types/client/changes-service.js.map +1 -0
  101. package/lib/types/client/changes-store.d.ts +6 -2
  102. package/lib/types/client/changes-store.d.ts.map +1 -1
  103. package/lib/types/client/changes-store.js.map +1 -1
  104. package/lib/types/client/checkout.d.ts.map +1 -1
  105. package/lib/types/client/checkout.js.map +1 -1
  106. package/lib/types/client/diff-rows.d.ts +49 -7
  107. package/lib/types/client/diff-rows.d.ts.map +1 -1
  108. package/lib/types/client/diff-rows.js.map +1 -1
  109. package/lib/types/client/file-tree.d.ts +7 -0
  110. package/lib/types/client/file-tree.d.ts.map +1 -1
  111. package/lib/types/client/file-tree.js.map +1 -1
  112. package/lib/types/client/forge-copy.d.ts +29 -0
  113. package/lib/types/client/forge-copy.d.ts.map +1 -0
  114. package/lib/types/client/forge-copy.js.map +1 -0
  115. package/lib/types/client/format.d.ts +8 -0
  116. package/lib/types/client/format.d.ts.map +1 -1
  117. package/lib/types/client/format.js.map +1 -1
  118. package/lib/types/client/glyphs.d.ts +3 -3
  119. package/lib/types/client/glyphs.d.ts.map +1 -1
  120. package/lib/types/client/glyphs.js.map +1 -1
  121. package/lib/types/client/highlight-context.d.ts +73 -0
  122. package/lib/types/client/highlight-context.d.ts.map +1 -0
  123. package/lib/types/client/highlight-context.js.map +1 -0
  124. package/lib/types/client/index.d.ts +9 -5
  125. package/lib/types/client/index.d.ts.map +1 -1
  126. package/lib/types/client/index.js.map +1 -1
  127. package/lib/types/client/lens-filter.d.ts +69 -0
  128. package/lib/types/client/lens-filter.d.ts.map +1 -0
  129. package/lib/types/client/lens-filter.js.map +1 -0
  130. package/lib/types/client/locales.d.ts +188 -36
  131. package/lib/types/client/locales.d.ts.map +1 -1
  132. package/lib/types/client/locales.js.map +1 -1
  133. package/lib/types/client/mount.d.ts +0 -4
  134. package/lib/types/client/mount.d.ts.map +1 -1
  135. package/lib/types/client/mount.js.map +1 -1
  136. package/lib/types/client/review-page/ReviewChat.d.ts +112 -0
  137. package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -0
  138. package/lib/types/client/review-page/ReviewChat.js.map +1 -0
  139. package/lib/types/client/review-page/ReviewDetail.d.ts +56 -0
  140. package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -0
  141. package/lib/types/client/review-page/ReviewDetail.js.map +1 -0
  142. package/lib/types/client/review-page/ReviewLabels.d.ts +32 -0
  143. package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -0
  144. package/lib/types/client/review-page/ReviewLabels.js.map +1 -0
  145. package/lib/types/client/review-page/ReviewList.d.ts +68 -0
  146. package/lib/types/client/review-page/ReviewList.d.ts.map +1 -0
  147. package/lib/types/client/review-page/ReviewList.js.map +1 -0
  148. package/lib/types/client/review-page/ReviewNav.d.ts +28 -0
  149. package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -0
  150. package/lib/types/client/review-page/ReviewNav.js.map +1 -0
  151. package/lib/types/client/review-page/ReviewPage.d.ts +61 -0
  152. package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -0
  153. package/lib/types/client/review-page/ReviewPage.js.map +1 -0
  154. package/lib/types/client/review-page/ReviewStatus.d.ts +37 -0
  155. package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -0
  156. package/lib/types/client/review-page/ReviewStatus.js.map +1 -0
  157. package/lib/types/client/review-page/host-stream.d.ts +24 -0
  158. package/lib/types/client/review-page/host-stream.d.ts.map +1 -0
  159. package/lib/types/client/review-page/host-stream.js.map +1 -0
  160. package/lib/types/client/review-page/review-lists.d.ts +116 -0
  161. package/lib/types/client/review-page/review-lists.d.ts.map +1 -0
  162. package/lib/types/client/review-page/review-lists.js.map +1 -0
  163. package/lib/types/client/review-page/review-mount.d.ts +50 -0
  164. package/lib/types/client/review-page/review-mount.d.ts.map +1 -0
  165. package/lib/types/client/review-page/review-mount.js.map +1 -0
  166. package/lib/types/client/review-page/review-store.d.ts +79 -0
  167. package/lib/types/client/review-page/review-store.d.ts.map +1 -0
  168. package/lib/types/client/review-page/review-store.js.map +1 -0
  169. package/lib/types/client/review-queue.d.ts +19 -0
  170. package/lib/types/client/review-queue.d.ts.map +1 -1
  171. package/lib/types/client/review-queue.js.map +1 -1
  172. package/lib/types/client/review-threads.d.ts +0 -8
  173. package/lib/types/client/review-threads.d.ts.map +1 -1
  174. package/lib/types/client/review-threads.js.map +1 -1
  175. package/lib/types/client/review.d.ts +18 -0
  176. package/lib/types/client/review.d.ts.map +1 -1
  177. package/lib/types/client/review.js.map +1 -1
  178. package/lib/types/client/slots.d.ts +114 -0
  179. package/lib/types/client/slots.d.ts.map +1 -0
  180. package/lib/types/client/slots.js.map +1 -0
  181. package/lib/types/client/source.d.ts +29 -23
  182. package/lib/types/client/source.d.ts.map +1 -1
  183. package/lib/types/client/source.js.map +1 -1
  184. package/lib/types/client/status.d.ts +13 -2
  185. package/lib/types/client/status.d.ts.map +1 -1
  186. package/lib/types/client/status.js.map +1 -1
  187. package/lib/types/git.d.ts +4 -15
  188. package/lib/types/git.d.ts.map +1 -1
  189. package/lib/types/git.js.map +1 -1
  190. package/lib/types/index.d.ts +346 -28
  191. package/lib/types/index.d.ts.map +1 -1
  192. package/lib/types/index.js.map +1 -1
  193. package/lib/types/lens-version.d.ts +14 -0
  194. package/lib/types/lens-version.d.ts.map +1 -0
  195. package/lib/types/lens-version.js.map +1 -0
  196. package/lib/types/lenses.d.ts +122 -0
  197. package/lib/types/lenses.d.ts.map +1 -0
  198. package/lib/types/lenses.js.map +1 -0
  199. package/lib/types/local-diff.d.ts +16 -0
  200. package/lib/types/local-diff.d.ts.map +1 -1
  201. package/lib/types/local-diff.js.map +1 -1
  202. package/lib/types/panel.d.ts +59 -8
  203. package/lib/types/panel.d.ts.map +1 -1
  204. package/lib/types/panel.js.map +1 -1
  205. package/lib/types/parse.d.ts +24 -8
  206. package/lib/types/parse.d.ts.map +1 -1
  207. package/lib/types/parse.js.map +1 -1
  208. package/lib/types/review-cache.d.ts +29 -19
  209. package/lib/types/review-cache.d.ts.map +1 -1
  210. package/lib/types/review-cache.js.map +1 -1
  211. package/lib/types/states.d.ts +11 -7
  212. package/lib/types/states.d.ts.map +1 -1
  213. package/lib/types/states.js.map +1 -1
  214. package/lib/types/types.d.ts +266 -20
  215. package/lib/types/types.d.ts.map +1 -1
  216. package/lib/types/viewer-lists.d.ts +113 -0
  217. package/lib/types/viewer-lists.d.ts.map +1 -0
  218. package/lib/types/viewer-lists.js.map +1 -0
  219. package/lib/types/worktree.d.ts +20 -11
  220. package/lib/types/worktree.d.ts.map +1 -1
  221. package/lib/types/worktree.js.map +1 -1
  222. package/locale/de.json +1 -1
  223. package/locale/en.json +1 -1
  224. package/locale/es.json +1 -1
  225. package/locale/fr.json +1 -1
  226. package/locale/ja.json +1 -1
  227. package/locale/pt.json +1 -1
  228. package/locale/ru.json +1 -1
  229. package/locale/zh.json +1 -1
  230. package/package.json +61 -52
  231. package/src/branch-name.ts +74 -0
  232. package/src/client/AttentionIndicator.tsx +37 -0
  233. package/src/client/BaseMenu.module.css +0 -20
  234. package/src/client/BaseMenu.tsx +9 -52
  235. package/src/client/ChangeRequestCard.tsx +276 -131
  236. package/src/client/ChangeRequestOverview.module.css +1 -1
  237. package/src/client/ChangeRequestOverview.tsx +183 -67
  238. package/src/client/ChangeRequestsSection.tsx +234 -0
  239. package/src/client/ChangedFiles.module.css +5 -1
  240. package/src/client/ChangedFiles.tsx +72 -36
  241. package/src/client/ChangesLoading.module.css +110 -0
  242. package/src/client/ChangesLoading.tsx +69 -0
  243. package/src/client/ChangesTab.module.css +83 -114
  244. package/src/client/ChangesTab.tsx +331 -100
  245. package/src/client/ChangesTabTitle.tsx +3 -3
  246. package/src/client/DiffFile.tsx +241 -45
  247. package/src/client/EnvironmentRows.tsx +263 -0
  248. package/src/client/FileLabel.tsx +1 -1
  249. package/src/client/FileTreePane.tsx +11 -6
  250. package/src/client/{ForgeTab.module.css → Forge.module.css} +130 -275
  251. package/src/client/LensFilter.module.css +87 -0
  252. package/src/client/LensFilter.tsx +105 -0
  253. package/src/client/ReasonButton.tsx +23 -0
  254. package/src/client/ReviewComposer.module.css +2 -8
  255. package/src/client/ReviewComposer.tsx +27 -8
  256. package/src/client/ReviewControls.module.css +39 -0
  257. package/src/client/ReviewControls.tsx +71 -15
  258. package/src/client/ReviewThread.tsx +55 -30
  259. package/src/client/ReviewThreads.module.css +24 -0
  260. package/src/client/ReviewThreads.tsx +56 -21
  261. package/src/client/SessionHoverForge.tsx +2 -1
  262. package/src/client/SubmitReview.tsx +11 -8
  263. package/src/client/ThreadList.tsx +1 -1
  264. package/src/client/ViewOptionsMenu.tsx +19 -4
  265. package/src/client/WorktreeNameDialog.module.css +53 -0
  266. package/src/client/WorktreeNameDialog.tsx +93 -0
  267. package/src/client/WorktreeProgress.tsx +100 -35
  268. package/src/client/WorktreeToggle.module.css +121 -5
  269. package/src/client/WorktreeToggle.tsx +178 -61
  270. package/src/client/action-notices.ts +38 -0
  271. package/src/client/annotations.ts +105 -0
  272. package/src/client/branch-search.tsx +77 -0
  273. package/src/client/change-requests-store.ts +50 -0
  274. package/src/client/changes-address.ts +3 -1
  275. package/src/client/changes-service.ts +173 -0
  276. package/src/client/changes-store.ts +103 -91
  277. package/src/client/checkout.ts +2 -1
  278. package/src/client/diff-rows.ts +100 -16
  279. package/src/client/file-tree.ts +29 -0
  280. package/src/client/forge-copy.ts +49 -0
  281. package/src/client/format.ts +14 -0
  282. package/src/client/glyphs.tsx +12 -13
  283. package/src/client/highlight-context.ts +213 -0
  284. package/src/client/index.ts +20 -5
  285. package/src/client/lens-filter.ts +136 -0
  286. package/src/client/locales.ts +1504 -288
  287. package/src/client/mount.ts +228 -109
  288. package/src/client/review-page/ReviewChat.tsx +311 -0
  289. package/src/client/review-page/ReviewDetail.tsx +331 -0
  290. package/src/client/review-page/ReviewLabels.tsx +94 -0
  291. package/src/client/review-page/ReviewList.tsx +461 -0
  292. package/src/client/review-page/ReviewNav.tsx +47 -0
  293. package/src/client/review-page/ReviewPage.module.css +946 -0
  294. package/src/client/review-page/ReviewPage.tsx +287 -0
  295. package/src/client/review-page/ReviewStatus.tsx +259 -0
  296. package/src/client/review-page/host-stream.ts +63 -0
  297. package/src/client/review-page/review-lists.ts +207 -0
  298. package/src/client/review-page/review-mount.ts +228 -0
  299. package/src/client/review-page/review-store.ts +94 -0
  300. package/src/client/review-queue.ts +30 -0
  301. package/src/client/review-threads.ts +0 -12
  302. package/src/client/review.ts +27 -0
  303. package/src/client/slots.ts +92 -0
  304. package/src/client/source.ts +67 -43
  305. package/src/client/status.ts +16 -4
  306. package/src/git.ts +16 -38
  307. package/src/index.ts +900 -152
  308. package/src/lens-version.ts +27 -0
  309. package/src/lenses.ts +284 -0
  310. package/src/local-diff.ts +48 -1
  311. package/src/panel.ts +123 -28
  312. package/src/parse.ts +86 -10
  313. package/src/review-cache.ts +57 -37
  314. package/src/states.ts +38 -18
  315. package/src/types.ts +267 -21
  316. package/src/viewer-lists.ts +375 -0
  317. package/src/worktree.ts +64 -34
  318. package/lib/types/client/ForgeTab.d.ts +0 -65
  319. package/lib/types/client/ForgeTab.d.ts.map +0 -1
  320. package/lib/types/client/ForgeTab.js.map +0 -1
  321. package/lib/types/client/ForgeTabTitle.d.ts +0 -11
  322. package/lib/types/client/ForgeTabTitle.d.ts.map +0 -1
  323. package/lib/types/client/ForgeTabTitle.js.map +0 -1
  324. package/lib/types/client/HeaderButton.d.ts +0 -27
  325. package/lib/types/client/HeaderButton.d.ts.map +0 -1
  326. package/lib/types/client/HeaderButton.js.map +0 -1
  327. package/lib/types/client/LocalChangesCard.d.ts +0 -29
  328. package/lib/types/client/LocalChangesCard.d.ts.map +0 -1
  329. package/lib/types/client/LocalChangesCard.js.map +0 -1
  330. package/src/client/ForgeTab.tsx +0 -263
  331. package/src/client/ForgeTabTitle.tsx +0 -21
  332. package/src/client/HeaderButton.module.css +0 -29
  333. package/src/client/HeaderButton.tsx +0 -68
  334. package/src/client/LocalChangesCard.tsx +0 -83
@@ -0,0 +1,23 @@
1
+ /** The info button of a status row that failed, whose tooltip gives the failure's reason. */
2
+
3
+ import type { ReactNode } from 'react'
4
+ import { IconInfoOutlineRegular, Tooltip } from '@deepseek-ai/dsh-client-ui-primitives'
5
+ import css from './Forge.module.css'
6
+
7
+ /**
8
+ * Render an info button that shows why a status row failed: after 500ms of
9
+ * hover, at once on keyboard focus, and on a press, which touch screens need
10
+ * because they cannot hover.
11
+ * @param props.reason - the failure's reason, such as the host's error message.
12
+ * @param props.label - accessible name of the button.
13
+ * @returns the button.
14
+ */
15
+ export function ReasonButton({ reason, label }: { readonly reason: string; readonly label: string }): ReactNode {
16
+ return (
17
+ <Tooltip label={reason} side="bottom" align="end" delayMs={500} maxWidth={320} openOnClick portal>
18
+ <button type="button" className={css.reason} aria-label={label} data-forge-reason="">
19
+ <IconInfoOutlineRegular size={16} />
20
+ </button>
21
+ </Tooltip>
22
+ )
23
+ }
@@ -1,9 +1,8 @@
1
1
  /* Inline review forms use the same field, action, and badge treatments as settings and conversation controls. */
2
- .root, .thread { box-sizing: border-box; width: calc(100% - 20px); max-width: 680px; margin: 10px; padding: 12px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: var(--dsw-font-xs-13); font-family: Inter, var(--dsw-font-family); white-space: normal; }
3
- .root { background: var(--dsw-alias-bg-layer-2); border-radius: var(--dsw-radius-lg); }
2
+ .root { box-sizing: border-box; width: calc(100% - 20px); max-width: 680px; margin: 10px; padding: 12px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); font: var(--dsw-font-xs-13); font-family: Inter, var(--dsw-font-family); white-space: normal; }
4
3
  .root:focus-within { border-color: var(--dsw-alias-border-l4); }
5
4
  /* Side by side, a comment fills its side's cell under the code instead of the row's width. */
6
- [data-forge-comments] > .root, [data-forge-comments] > .thread { width: auto; max-width: none; margin: 0; }
5
+ [data-forge-comments] > .root { width: auto; max-width: none; margin: 0; }
7
6
  .title { margin-bottom: 12px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
8
7
  /* Fixed-size textarea layout stays local during typing; native resizing can still change its outer height. */
9
8
  .input { display: block; box-sizing: border-box; width: 100%; height: 88px; min-height: 88px; contain: strict; padding: 10px 12px; resize: vertical; border: 0.5px solid var(--dsw-alias-border-l4); border-radius: var(--dsw-radius-md); outline: none; background: var(--dsw-alias-bg-layer-3); color: var(--dsw-alias-label-primary); font: inherit; }
@@ -16,11 +15,6 @@
16
15
  .gitAction { display: inline-flex; flex: none; align-items: stretch; }
17
16
  .gitMain { border-start-end-radius: 0; border-end-end-radius: 0; }
18
17
  .gitArrow { width: 30px; padding: 0; border-start-start-radius: 0; border-end-start-radius: 0; border-inline-start: 0.5px solid color-mix(in srgb, var(--dsw-alias-label-primary-foreground) 25%, transparent); }
19
- .threadHeader { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
20
- .author { font-weight: 500; }
21
- .range { color: var(--dsw-alias-label-secondary); font-size: 12px; }
22
- .commentBody { white-space: pre-wrap; overflow-wrap: anywhere; }
23
- .threadActions { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px -8px -4px; }
24
18
  .gutter { position: relative; }
25
19
  .line { display: block; width: 100%; height: 100%; padding: 0; color: inherit; text-align: inherit; cursor: pointer; border: 0; border-radius: 0; background: transparent; font: inherit; user-select: none; touch-action: pan-y; }
26
20
  .selected { background: var(--dsw-alias-interactive-bg-hover); outline: 1px solid var(--dsw-alias-border-l2); outline-offset: -1px; }
@@ -4,9 +4,10 @@ import { useEffect, useRef, useState, type ReactNode } from 'react'
4
4
  import clsx from 'clsx'
5
5
  import { Button, IconChevronDownOutlineRegular, Menu, MenuItemButton } from '@deepseek-ai/dsh-client-ui-primitives'
6
6
  import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
7
- import type { ReviewQueue } from './review-queue.ts'
8
- import { reviewRange, type ReviewSelection, type ReviewSource } from './review.ts'
7
+ import type { RemovedRecord, ReviewQueue } from './review-queue.ts'
8
+ import { INPUT_QUOTE_COPY, reviewRange, settleQuote, type QuoteCopy, type ReviewSelection, type ReviewSource } from './review.ts'
9
9
  import type { NS } from './locales.ts'
10
+ import type { ForgeCommentActionsProps } from './slots.ts'
10
11
  import css from './ReviewComposer.module.css'
11
12
 
12
13
  /** Actions supplied by the owning changes tab. */
@@ -21,14 +22,20 @@ export interface ReviewActions {
21
22
  readonly openLink?: (url: string) => void
22
23
  /** A write is running or its outcome still needs confirmation. */
23
24
  readonly publishingBlocked?: boolean
24
- /** Append an atomic quote without sending the Agent a message. */
25
- readonly addToInput: (selection: ReviewSelection) => boolean
25
+ /** Append an atomic quote without sending the Agent a message; resolves to whether it was accepted. */
26
+ readonly addToInput: (selection: ReviewSelection) => boolean | Promise<boolean>
27
+ /** Copy of the quote button, the quoted tag, and the refusal; the input's copy by default. */
28
+ readonly quoteCopy?: QuoteCopy | undefined
26
29
  /** Retain a new comment after its quote was accepted. */
27
30
  readonly onQuoted?: (selection: ReviewSelection) => void
31
+ /** Report a reference or publication receipt the reader removed from the view, so the report can offer to put it back. */
32
+ readonly onRemoved?: (removed: RemovedRecord) => void
28
33
  /** Publish one comment; an error string preserves the editor. */
29
34
  readonly publish?: (selection: ReviewSelection) => Promise<string | undefined>
30
35
  /** Add one comment to the pending review on the code host, starting one when needed; an error string preserves the editor. */
31
36
  readonly queue?: (selection: ReviewSelection) => Promise<string | undefined>
37
+ /** Draw the buttons plugins add to the form through `forge.diff.comment.actions`. */
38
+ readonly renderActions?: (owner: Omit<ForgeCommentActionsProps, 'target'>) => ReactNode
32
39
  }
33
40
 
34
41
  /**
@@ -73,6 +80,7 @@ export function ReviewComposer({ selection, actions, close, visible = true, t }:
73
80
  const [empty, setEmpty] = useState(body.current.trim() === '')
74
81
  const [busy, setBusy] = useState(false)
75
82
  const [error, setError] = useState<string | null>(null)
83
+ const copy = actions.quoteCopy ?? INPUT_QUOTE_COPY
76
84
  const running = useRef(false)
77
85
  const input = useRef<HTMLTextAreaElement>(null)
78
86
  useEffect(() => { input.current?.focus() }, [])
@@ -112,12 +120,23 @@ export function ReviewComposer({ selection, actions, close, visible = true, t }:
112
120
  <Button size="sm" className={clsx(css.cancel)} disabled={busy} onClick={close}>{t('review.cancel')}</Button>
113
121
  <Button size="sm" variant={actions.queue === undefined ? 'primary' : 'outline'} disabled={busy || empty} onClick={() => {
114
122
  const selected = comment()
115
- if (actions.addToInput(selected)) { actions.onQuoted?.(selected); close() }
116
- else setError(t('review.inputFailed'))
117
- }}>{t('review.addToInput')}</Button>
123
+ settleQuote(actions.addToInput(selected), (accepted) => {
124
+ if (accepted) { actions.onQuoted?.(selected); close() }
125
+ else setError(t(copy.failed))
126
+ })
127
+ }}>{t(copy.add)}</Button>
128
+ {actions.renderActions?.({
129
+ selection: {
130
+ path: selection.comment.path, side: selection.comment.side,
131
+ startLine: selection.comment.startLine, endLine: selection.comment.endLine,
132
+ },
133
+ empty,
134
+ busy,
135
+ send: (deliver) => { void send(async () => await deliver(body.current)) },
136
+ })}
118
137
  {visible && actions.queue !== undefined && <SplitAction disabled={busy || actions.publishingBlocked === true || empty}
119
138
  label={t(busy ? 'review.publishing' : actions.reviewStarted === true ? 'review.queue' : 'review.startReview')}
120
- run={() => { void send(actions.queue) }} menuLabel={t('review.githubActions')}
139
+ run={() => { void send(actions.queue) }} menuLabel={t('review.hostActions')}
121
140
  other={actions.publish === undefined ? undefined : t('review.publish')} menu={() => { void send(actions.publish) }} />}
122
141
  {actions.queue === undefined && actions.publish !== undefined && <Button size="sm" variant="primary"
123
142
  disabled={busy || actions.publishingBlocked === true || empty} onClick={() => { void send(actions.publish) }}>{t('review.publish')}</Button>}
@@ -55,6 +55,45 @@
55
55
  outline-offset: -2px;
56
56
  }
57
57
 
58
+ /* Segments as wide as their labels, sharing what remains equally. */
59
+ .segmented[data-sizing='content'] {
60
+ display: flex;
61
+ }
62
+
63
+ .segmented[data-sizing='content'] > .segment {
64
+ flex: 1 1 auto;
65
+ }
66
+
67
+ /* The lens above the file tree with hidden copies that measure the width each form needs. */
68
+ .lensFit {
69
+ position: relative;
70
+ width: 100%;
71
+ min-width: 0;
72
+ }
73
+
74
+ .measures {
75
+ position: absolute;
76
+ top: 0;
77
+ left: 0;
78
+ visibility: hidden;
79
+ pointer-events: none;
80
+ }
81
+
82
+ .measures > div,
83
+ .measures .segmented {
84
+ width: max-content;
85
+ }
86
+
87
+ /* A count left out of view stays in the segment's accessible name. */
88
+ .hiddenCount {
89
+ position: absolute;
90
+ width: 1px;
91
+ height: 1px;
92
+ overflow: hidden;
93
+ clip-path: inset(50%);
94
+ white-space: nowrap;
95
+ }
96
+
58
97
  .segmentLabel {
59
98
  min-width: 0;
60
99
  overflow: hidden;
@@ -4,7 +4,7 @@
4
4
  * share of shown files the reader marked viewed. The thread list shares the segmented radio group.
5
5
  */
6
6
 
7
- import { useRef, useState, type KeyboardEvent, type ReactNode } from 'react'
7
+ import { useLayoutEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'
8
8
  import { IconChevronDownOutlineRegular, Menu, Switch, Tooltip, type MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives'
9
9
  import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
10
10
  import type { ChangesLens } from './changes-store.ts'
@@ -47,15 +47,19 @@ export interface Segment<Value extends string> {
47
47
 
48
48
  /**
49
49
  * Render a radio group whose segments share its width, each with a count after its label; arrow keys, Home, and End
50
- * move between enabled segments.
51
- * @param props - the segments, the chosen value, the choose action, and the group's localized accessible name.
50
+ * move between enabled segments. Segments are equally wide, or as wide as their labels with the rest shared equally.
51
+ * Without shown counts, a segment keeps its count in its accessible name and its hover text.
52
+ * @param props - the segments, the chosen value, the choose action, the group's localized accessible name, how segments
53
+ * size, and whether counts show.
52
54
  * @returns the radio group.
53
55
  */
54
- export function SegmentedChoice<Value extends string>({ segments, value, choose, label }: {
56
+ export function SegmentedChoice<Value extends string>({ segments, value, choose, label, sizing = 'equal', counted = true }: {
55
57
  readonly segments: readonly Segment<Value>[]
56
58
  readonly value: Value
57
59
  readonly choose: (value: Value) => void
58
60
  readonly label: string
61
+ readonly sizing?: 'equal' | 'content'
62
+ readonly counted?: boolean
59
63
  }): ReactNode {
60
64
  const group = useRef<HTMLDivElement>(null)
61
65
  const enabled = segments.filter(segment => segment.disabledTip === null).map(segment => segment.value)
@@ -77,32 +81,84 @@ export function SegmentedChoice<Value extends string>({ segments, value, choose,
77
81
  group.current?.querySelector<HTMLButtonElement>(`[data-segment="${next}"]`)?.focus()
78
82
  }
79
83
  return (
80
- <div ref={group} role="radiogroup" aria-label={label} className={css.segmented}>
84
+ <div ref={group} role="radiogroup" aria-label={label} className={css.segmented} data-sizing={sizing}>
81
85
  {segments.map((segment) => {
82
86
  const button = (
83
- <button key={segment.value} type="button" role="radio" className={css.segment} aria-checked={value === segment.value}
87
+ <button type="button" role="radio" className={css.segment} aria-checked={value === segment.value}
84
88
  disabled={segment.disabledTip !== null} tabIndex={value === segment.value ? 0 : -1} data-segment={segment.value}
85
89
  onKeyDown={move} onClick={() => { choose(segment.value) }}>
86
90
  <span className={css.segmentLabel}>{segment.label}</span>
87
- <span className={css.count}>{segment.count ?? ''}</span>
91
+ <span className={counted ? css.count : css.hiddenCount}>{segment.count ?? ''}</span>
88
92
  </button>
89
93
  )
90
- return segment.disabledTip === null ? button : <Tooltip key={segment.value} label={segment.disabledTip} side="bottom">{button}</Tooltip>
94
+ const tip = segment.disabledTip ?? (counted || segment.count === null ? null : `${segment.label} ${String(segment.count)}`)
95
+ // Every segment keeps its Tooltip, disabled without hover text, so showing or hiding the counts keeps the
96
+ // button mounted and the focus on it.
97
+ return <Tooltip key={segment.value} label={tip ?? segment.label} side="bottom" delayMs={500} disabled={tip === null}>{button}</Tooltip>
91
98
  })}
92
99
  </div>
93
100
  )
94
101
  }
95
102
 
96
103
  /**
97
- * Render the lens as a radio group whose segments share its width.
98
- * @param props - the lens, its counts, whether test files hide, the choose action, and copy.
99
- * @returns the radio group.
104
+ * Render the lens above the file tree as a radio group whose segments are as wide as their labels. Counts show while
105
+ * every segment fits whole beside its count; otherwise only labels show. The widths both forms need are measured on
106
+ * hidden copies whenever the cell, the labels, the counts, or the fonts change, and `need` receives the width of the
107
+ * cell that labels alone fill, which the file tree keeps as its least width.
108
+ * @param props - the lens, its counts, whether test files hide, the choose action, copy, and the receiver of the
109
+ * labels' width.
110
+ * @returns the radio group with its hidden measures.
100
111
  */
101
- export function LensControl({ lens, counts, hideTests, choose, t }: LensProps): ReactNode {
112
+ export function LensControl({ lens, counts, hideTests, choose, t, need }: LensProps & {
113
+ /** Receives the cell width, padding included, at which the labels fit without counts. */
114
+ readonly need: (width: number) => void
115
+ }): ReactNode {
116
+ const root = useRef<HTMLDivElement>(null)
117
+ const withCounts = useRef<HTMLDivElement>(null)
118
+ const labelsOnly = useRef<HTMLDivElement>(null)
119
+ const [counted, setCounted] = useState(true)
102
120
  // A disabled lens shows no count, since hidden test files are not counted.
103
- return <SegmentedChoice label={t('lens.aria')} value={lens} choose={choose} segments={LENSES.map(item => item === 'test' && hideTests
121
+ const segments = LENSES.map((item): Segment<ChangesLens> => item === 'test' && hideTests
104
122
  ? { value: item, label: t(LENS_LABEL[item]), count: null, disabledTip: t('lens.testHidden') }
105
- : { value: item, label: t(LENS_LABEL[item]), count: counts[item], disabledTip: null })} />
123
+ : { value: item, label: t(LENS_LABEL[item]), count: counts[item], disabledTip: null })
124
+ const key = JSON.stringify(segments.map(segment => [segment.label, segment.count]))
125
+ const needRef = useRef(need)
126
+ needRef.current = need
127
+ useLayoutEffect(() => {
128
+ const element = root.current
129
+ const full = withCounts.current
130
+ const bare = labelsOnly.current
131
+ const cell = element?.parentElement
132
+ /* v8 ignore next -- the refs are attached, inside a cell, before layout effects run */
133
+ if (element === null || full === null || bare === null || cell === null || cell === undefined) return
134
+ let live = true
135
+ // Fractional widths: a segment row a fraction of a pixel short of its labels still cuts every label short.
136
+ const width = (node: Element): number => node.getBoundingClientRect().width
137
+ const measure = (): void => {
138
+ const available = width(element)
139
+ // A hidden cell, such as one below the tree's breakpoint or in a hidden tab, has no width to compare.
140
+ if (!live || available === 0) return
141
+ setCounted(width(full) <= available)
142
+ needRef.current(Math.ceil(width(bare) + width(cell) - available))
143
+ }
144
+ measure()
145
+ const observer = new ResizeObserver(measure)
146
+ observer.observe(element)
147
+ const fonts = document.fonts
148
+ fonts.addEventListener('loadingdone', measure)
149
+ return () => {
150
+ live = false
151
+ observer.disconnect()
152
+ fonts.removeEventListener('loadingdone', measure)
153
+ }
154
+ }, [key])
155
+ return <div ref={root} className={css.lensFit}>
156
+ <SegmentedChoice label={t('lens.aria')} value={lens} choose={choose} segments={segments} sizing="content" counted={counted} />
157
+ <div className={css.measures} aria-hidden="true" {...{ inert: '' }}>
158
+ <div ref={withCounts}><SegmentedChoice label="" value={lens} choose={choose} segments={segments} sizing="content" /></div>
159
+ <div ref={labelsOnly}><SegmentedChoice label="" value={lens} choose={choose} segments={segments} sizing="content" counted={false} /></div>
160
+ </div>
161
+ </div>
106
162
  }
107
163
 
108
164
  /**
@@ -149,7 +205,7 @@ export function HideTestsSwitch({ hidden, toggle, t }: PropsLocale<typeof NS> &
149
205
  readonly toggle: () => void
150
206
  }): ReactNode {
151
207
  return (
152
- <Tooltip label={t('tests.hideHint')} side="bottom">
208
+ <Tooltip label={t('tests.hideHint')} side="bottom" delayMs={500}>
153
209
  {/* A label forwards a click on its text to the switch, its first labelable descendant. */}
154
210
  <label className={css.switch} data-forge-hide-tests="">
155
211
  <Switch checked={hidden} label={t('tests.hide')} onChange={toggle} />
@@ -4,10 +4,12 @@ import { useCallback, useState, useSyncExternalStore, type ReactNode } from 'rea
4
4
  import { Button, Tag } from '@deepseek-ai/dsh-client-ui-primitives'
5
5
  import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
6
6
  import type { ReviewActions } from './ReviewComposer.tsx'
7
+ import { CardMenu, DeleteConfirm } from './ReviewThreads.tsx'
7
8
  import { EMPTY_FILE_REVIEW, type FileReviewState, type ReviewThread as Thread } from './review-queue.ts'
8
- import { reviewRange } from './review.ts'
9
+ import { INPUT_QUOTE_COPY, reviewRange, settleQuote } from './review.ts'
9
10
  import type { NS } from './locales.ts'
10
- import css from './ReviewComposer.module.css'
11
+ import css from './ReviewThreads.module.css'
12
+ import composerCss from './ReviewComposer.module.css'
11
13
 
12
14
  const noSubscription = (): (() => void) => () => {}
13
15
 
@@ -24,7 +26,9 @@ export function useFileReview(actions: ReviewActions | undefined, path: string):
24
26
  }
25
27
 
26
28
  /**
27
- * Render a saved comment at its line. A comment draft kept in the browser can be edited, deleted, or moved into the
29
+ * Render a saved comment at its line: its lines and state, the menu of its less frequent actions, its text, and Add to
30
+ * input. A reference or a publication receipt can be removed from the view, which leaves the main input and the code
31
+ * host as they are. A comment draft kept in the browser can be edited, deleted after a confirmation, or moved into the
28
32
  * pending review on the code host.
29
33
  * @param props - record, edit availability, source actions, and localized copy.
30
34
  * @returns one compact inline comment card.
@@ -35,16 +39,21 @@ export function ReviewThread({ thread, actions, locked, outdated, t }: PropsLoca
35
39
  readonly locked: boolean
36
40
  readonly outdated: boolean
37
41
  }): ReactNode {
38
- const [editing, setEditing] = useState(false)
42
+ const [mode, setMode] = useState<'view' | 'edit' | 'delete'>('view')
39
43
  const [body, setBody] = useState(thread.selection.comment.body)
40
44
  const [error, setError] = useState<string | null>(null)
41
45
  const [moving, setMoving] = useState(false)
42
46
  const comment = thread.selection.comment
43
- const quoted = editing && thread.kind === 'pending' ? { ...thread.selection, comment: { ...comment, body } } : thread.selection
47
+ // A draft published while its form is open becomes a receipt, which has neither form.
48
+ const editing = mode === 'edit' && thread.kind === 'pending'
49
+ const confirming = mode === 'delete' && thread.kind === 'pending'
50
+ const quoted = editing ? { ...thread.selection, comment: { ...comment, body } } : thread.selection
44
51
  const range = reviewRange(comment)
45
- const status = thread.kind === 'pending' ? 'review.browserDraft' : thread.kind === 'published' ? 'review.published' : 'review.quoted'
52
+ const copy = actions.quoteCopy ?? INPUT_QUOTE_COPY
53
+ const status = thread.kind === 'pending' ? 'review.browserDraft' : thread.kind === 'published' ? 'review.published' : copy.added
46
54
  const save = (): boolean => actions.records?.editThread(thread.key, body) === true
47
55
  const queue = actions.queue
56
+ const waiting = locked || moving
48
57
  /** Add the draft to the pending review on the code host, then delete it from the browser. */
49
58
  const move = async (add: NonNullable<ReviewActions['queue']>): Promise<void> => {
50
59
  setMoving(true)
@@ -59,37 +68,53 @@ export function ReviewThread({ thread, actions, locked, outdated, t }: PropsLoca
59
68
  setMoving(false)
60
69
  }
61
70
  }
62
- return <section className={css.thread} data-forge-review-thread={thread.kind} data-side={comment.side} aria-label={t('review.range', { range })}>
63
- <div className={css.threadHeader}>
64
- <span className={css.author}>{t('review.yourComment')}</span>
65
- <span className={css.range}>{range}</span>
66
- <Tag tone="neutral">{t(outdated ? 'review.outdated' : status)}</Tag>
71
+ const select = (id: string): void => {
72
+ if (id === 'edit') {
73
+ setBody(comment.body)
74
+ setMode('edit')
75
+ } else if (id === 'delete') setMode('delete')
76
+ else {
77
+ const removed = actions.records?.removeRecord(thread.key) ?? null
78
+ if (removed === null) setError(t('review.saveFailed'))
79
+ else actions.onRemoved?.(removed)
80
+ }
81
+ }
82
+ return <section className={css.card} data-forge-review-thread={thread.kind} data-side={comment.side} aria-label={t('review.range', { range })}>
83
+ <div className={css.recordHeader}>
84
+ <div className={css.recordInfo}>
85
+ <span className={css.place}>{range}</span>
86
+ <Tag tone="neutral">{t(status)}</Tag>
87
+ {outdated && <Tag tone="neutral">{t('review.outdated')}</Tag>}
88
+ </div>
89
+ {!confirming && <CardMenu label={t('review.recordActions', { range })} disabled={thread.kind === 'pending' && waiting}
90
+ select={select} items={thread.kind === 'pending'
91
+ // A draft being edited keeps Delete, the way out of a draft whose text the reader emptied.
92
+ ? [...editing ? [] : [{ id: 'edit', label: t('review.edit') }], { id: 'delete', label: t('review.remove') }]
93
+ : [{ id: 'remove', label: t('review.removeRecord') }]} />}
67
94
  </div>
68
- {editing && thread.kind === 'pending'
69
- ? <textarea autoFocus className={css.input} rows={3} value={body} disabled={locked} aria-label={t('review.comment')}
95
+ {editing
96
+ ? <textarea autoFocus className={composerCss.input} rows={3} value={body} disabled={locked} aria-label={t('review.comment')}
70
97
  onChange={(event) => {
71
98
  setBody(event.target.value)
72
99
  if (actions.records?.editThread(thread.key, event.target.value) === true) setError(null)
73
100
  else setError(t('review.saveFailed'))
74
101
  }} />
75
- : <div className={css.commentBody}>{comment.body}</div>}
76
- {error !== null && <div className={css.error} role="alert">{error}</div>}
77
- <div className={css.threadActions}>
102
+ : <div className={css.plain}>{comment.body}</div>}
103
+ {confirming && <DeleteConfirm question={t('thread.deleteConfirm')} confirmLabel={t('review.remove')} disabled={waiting} error={error}
104
+ cancel={() => { setError(null); setMode('view') }}
105
+ confirm={() => { if (actions.records?.editThread(thread.key, null) !== true) setError(t('review.saveFailed')) }} t={t} />}
106
+ {error !== null && !confirming && <div className={composerCss.error} role="alert">{error}</div>}
107
+ <div className={css.actions}>
78
108
  <Button size="sm" disabled={quoted.comment.body.trim() === ''} onClick={() => {
79
- if (!actions.addToInput(quoted)) setError(t('review.inputFailed'))
80
- }}>{t('review.addToInput')}</Button>
81
- {thread.kind === 'pending' && <>
82
- {editing
83
- ? <Button size="sm" disabled={locked || moving || body.trim() === ''} onClick={() => {
84
- if (save()) { setEditing(false); setError(null) } else setError(t('review.saveFailed'))
85
- }}>{t('review.done')}</Button>
86
- : <Button size="sm" disabled={locked || moving} onClick={() => { setBody(comment.body); setEditing(true) }}>{t('review.edit')}</Button>}
87
- <Button size="sm" disabled={locked || moving} onClick={() => {
88
- if (actions.records?.editThread(thread.key, null) !== true) setError(t('review.saveFailed'))
89
- }}>{t('review.remove')}</Button>
90
- {queue !== undefined && !editing && !outdated && <Button size="sm" disabled={locked || moving}
91
- onClick={() => { void move(queue) }}>{t(moving ? 'review.publishing' : 'review.queue')}</Button>}
92
- </>}
109
+ settleQuote(actions.addToInput(quoted), (accepted) => { if (!accepted) setError(t(copy.failed)) })
110
+ }}>{t(copy.add)}</Button>
111
+ {editing && <Button size="sm" disabled={waiting || body.trim() === ''} onClick={() => {
112
+ if (save()) { setMode('view'); setError(null) } else setError(t('review.saveFailed'))
113
+ }}>{t('review.done')}</Button>}
114
+ {thread.kind === 'pending' && queue !== undefined && mode === 'view' && !outdated && <Button size="sm" disabled={waiting}
115
+ onClick={() => { void move(queue) }}>
116
+ {t(moving ? 'review.publishing' : actions.reviewStarted === true ? 'review.queue' : 'review.startReview')}
117
+ </Button>}
93
118
  {thread.kind === 'published' && actions.openLink !== undefined && <Button size="sm" onClick={() => { actions.openLink?.(thread.url) }}>{t('review.recheck')}</Button>}
94
119
  </div>
95
120
  </section>
@@ -73,6 +73,30 @@
73
73
  overflow-wrap: anywhere;
74
74
  }
75
75
 
76
+ /* A saved comment's header keeps its menu at the top end while the lines and tags wrap beside it. */
77
+ .recordHeader {
78
+ display: flex;
79
+ align-items: flex-start;
80
+ gap: 6px;
81
+ margin-bottom: 8px;
82
+ }
83
+
84
+ .recordInfo {
85
+ display: flex;
86
+ flex: 1;
87
+ flex-wrap: wrap;
88
+ align-items: center;
89
+ gap: 6px;
90
+ min-width: 0;
91
+ min-height: 20px;
92
+ }
93
+
94
+ /* A saved comment is plain text, drawn with its line breaks. */
95
+ .plain {
96
+ white-space: pre-wrap;
97
+ overflow-wrap: anywhere;
98
+ }
99
+
76
100
  .spacer { flex: 1; }
77
101
 
78
102
  /* Text actions inside a card: no fill, accent ink, the same height as the tags beside them. */
@@ -17,6 +17,7 @@ import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
17
17
  import { formatAgo } from './format.ts'
18
18
  import { anchorRange, hunkExcerpt, type ThreadPlace } from './review-threads.ts'
19
19
  import { SplitAction } from './ReviewComposer.tsx'
20
+ import { INPUT_QUOTE_COPY, settleQuote, type QuoteCopy } from './review.ts'
20
21
  import type { NS } from './locales.ts'
21
22
  import css from './ReviewThreads.module.css'
22
23
  import composerCss from './ReviewComposer.module.css'
@@ -43,8 +44,10 @@ export interface ThreadWrites {
43
44
  export interface ThreadActions {
44
45
  /** Login of the change request's author, or null when the host hides it. */
45
46
  readonly author: string | null
46
- /** Quote the whole thread in the main input without sending it; false when the input refused it. */
47
- readonly addToInput: (thread: ForgeReviewThread, range: string | null) => boolean
47
+ /** Quote the whole thread without sending it; resolves to false when the quote was refused. */
48
+ readonly addToInput: (thread: ForgeReviewThread, range: string | null) => boolean | Promise<boolean>
49
+ /** Copy of the quote button; the input's copy by default. */
50
+ readonly quoteCopy?: QuoteCopy | undefined
48
51
  /** Open a URL outside the app. */
49
52
  readonly openLink: (url: string) => void
50
53
  /** Read a file of the change request's repository at a commit. */
@@ -167,6 +170,47 @@ function TextForm({ label, initial, busy, error, cancel, children }: {
167
170
  </div>
168
171
  }
169
172
 
173
+ /**
174
+ * Render the button that ends a card's header row and the menu of the card's less frequent actions.
175
+ * @param props - the menu's accessible name, its items, the handler of a chosen item, and availability.
176
+ * @returns the button and, while open, its menu.
177
+ */
178
+ export function CardMenu({ label, items, select, disabled = false }: {
179
+ readonly label: string
180
+ readonly items: readonly { readonly id: string; readonly label: string }[]
181
+ readonly select: (id: string) => void
182
+ readonly disabled?: boolean
183
+ }): ReactNode {
184
+ const [open, setOpen] = useState(false)
185
+ return <Menu open={open && !disabled} portal dense align="end" autoFocus onClose={() => { setOpen(false) }} items={items}
186
+ onSelect={(id) => { setOpen(false); select(id) }}
187
+ anchor={<span className={css.menuAnchor}><Tooltip label={label} side="bottom" delayMs={500}>
188
+ <button type="button" className={css.icon} disabled={disabled} aria-label={label} aria-haspopup="menu" aria-expanded={open && !disabled}
189
+ onClick={() => { setOpen(value => !value) }}><IconEllipsisOutlineRegular size={14} /></button>
190
+ </Tooltip></span>} />
191
+ }
192
+
193
+ /**
194
+ * Ask before a deletion under the content it deletes, which stays readable above the question.
195
+ * @param props - the question, the deleting answer's label, whether both answers wait, the failure, the answers, and copy.
196
+ * @returns the question with Cancel and the deleting answer.
197
+ */
198
+ export function DeleteConfirm({ question, confirmLabel, disabled, error, cancel, confirm, t }: PropsLocale<typeof NS> & {
199
+ readonly question: string
200
+ readonly confirmLabel: string
201
+ readonly disabled: boolean
202
+ readonly error: string | null
203
+ readonly cancel: () => void
204
+ readonly confirm: () => void
205
+ }): ReactNode {
206
+ return <div className={css.confirm} role="group" aria-label={question}>
207
+ <span className={css.confirmText}>{question}</span>
208
+ <Button size="sm" disabled={disabled} onClick={cancel}>{t('review.cancel')}</Button>
209
+ <Button size="sm" variant="primary" disabled={disabled} onClick={confirm}>{confirmLabel}</Button>
210
+ {error !== null && <div className={clsx(composerCss.error, css.confirmError)} role="alert">{error}</div>}
211
+ </div>
212
+ }
213
+
170
214
  /** Tells the card which of its forms hold text the reader is writing, so it does not fold them away. */
171
215
  type Drafting = (form: string, active: boolean) => void
172
216
 
@@ -185,7 +229,6 @@ function Comment({ comment, last, actions, labels, now, drafting, t }: {
185
229
  drafting(comment.id, mode === 'edit')
186
230
  return () => { drafting(comment.id, false) }
187
231
  }, [drafting, comment.id, mode])
188
- const [menu, setMenu] = useState(false)
189
232
  const writing = useWriting(t)
190
233
  const writes = actions.writes
191
234
  const login = comment.author?.login ?? null
@@ -200,19 +243,16 @@ function Comment({ comment, last, actions, labels, now, drafting, t }: {
200
243
  <div className={css.commentMain}>
201
244
  <div className={css.commentHeader}>
202
245
  <span className={css.login}>{login ?? t('thread.deletedAuthor')}</span>
203
- <span className={css.time} title={comment.createdAt}>{formatAgo(comment.createdAt, now, t) ?? comment.createdAt}</span>
246
+ <Tooltip label={comment.createdAt} side="bottom" portal delayMs={500}>
247
+ <span className={css.time}>{formatAgo(comment.createdAt, now, t) ?? comment.createdAt}</span>
248
+ </Tooltip>
204
249
  {login !== null && login === actions.author && <Tag tone="outline">{t('thread.author')}</Tag>}
205
250
  {comment.author?.bot === true && <Tag tone="outline">{t('thread.bot')}</Tag>}
206
251
  {comment.pending && <Tag tone="warning">{t('review.pending')}</Tag>}
207
252
  {(editable || deletable) && mode === 'view' && <>
208
253
  <span className={css.spacer} />
209
- <Menu open={menu} portal dense align="end" autoFocus onClose={() => { setMenu(false) }}
210
- items={[...editable ? [{ id: 'edit', label: t('review.edit') }] : [], ...deletable ? [{ id: 'delete', label: t('review.remove') }] : []]}
211
- onSelect={(id) => { setMenu(false); setMode(id === 'edit' ? 'edit' : 'delete') }}
212
- anchor={<span className={css.menuAnchor}><Tooltip label={menuLabel} side="bottom">
213
- <button type="button" className={css.icon} aria-label={menuLabel} aria-haspopup="menu" aria-expanded={menu}
214
- onClick={() => { setMenu(value => !value) }}><IconEllipsisOutlineRegular size={14} /></button>
215
- </Tooltip></span>} />
254
+ <CardMenu label={menuLabel} select={(id) => { setMode(id === 'edit' ? 'edit' : 'delete') }}
255
+ items={[...editable ? [{ id: 'edit', label: t('review.edit') }] : [], ...deletable ? [{ id: 'delete', label: t('review.remove') }] : []]} />
216
256
  </>}
217
257
  </div>
218
258
  {mode === 'edit'
@@ -225,14 +265,9 @@ function Comment({ comment, last, actions, labels, now, drafting, t }: {
225
265
  </TextForm>
226
266
  // Raw HTML renders nothing, as GitHub hides comments and unknown tags, and never enters the DOM.
227
267
  : <div className={css.body}><MarkdownText text={comment.body} labels={labels} variant="body" omitHtml /></div>}
228
- {mode === 'delete' && <div className={css.confirm} role="group" aria-label={t(last ? 'thread.deleteLast' : 'thread.deleteConfirm')}>
229
- <span className={css.confirmText}>{t(last ? 'thread.deleteLast' : 'thread.deleteConfirm')}</span>
230
- <Button size="sm" disabled={writing.busy} onClick={() => { setMode('view') }}>{t('review.cancel')}</Button>
231
- <Button size="sm" variant="primary" disabled={writing.busy} onClick={() => { void send({ kind: 'delete-comment', comment: comment.id }) }}>
232
- {t(writing.busy ? 'thread.deleting' : 'review.remove')}
233
- </Button>
234
- {writing.error !== null && <div className={clsx(composerCss.error, css.confirmError)} role="alert">{writing.error}</div>}
235
- </div>}
268
+ {mode === 'delete' && <DeleteConfirm question={t(last ? 'thread.deleteLast' : 'thread.deleteConfirm')}
269
+ confirmLabel={t(writing.busy ? 'thread.deleting' : 'review.remove')} disabled={writing.busy} error={writing.error}
270
+ cancel={() => { setMode('view') }} confirm={() => { void send({ kind: 'delete-comment', comment: comment.id }) }} t={t} />}
236
271
  </div>
237
272
  </div>
238
273
  }
@@ -354,8 +389,8 @@ export function ThreadCard({ thread, place, actions, t }: PropsLocale<typeof NS>
354
389
  </div>
355
390
  {writes !== null && thread.viewerCanReply && <Reply thread={thread} writes={writes} drafting={drafting} t={t} />}
356
391
  <div className={css.actions}>
357
- <Button size="sm" onClick={() => { if (!actions.addToInput(thread, range)) actions.inputFailed() }}>
358
- {t('review.addToInput')}
392
+ <Button size="sm" onClick={() => { settleQuote(actions.addToInput(thread, range), (accepted) => { if (!accepted) actions.inputFailed() }) }}>
393
+ {t((actions.quoteCopy ?? INPUT_QUOTE_COPY).add)}
359
394
  </Button>
360
395
  {url !== null && <Button size="sm" onClick={() => { actions.openLink(url) }}>
361
396
  <IconRightUpOutlineRegular size={14} />{t('thread.openOnHost')}
@@ -9,6 +9,7 @@ import { IconBranchOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
9
9
  import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
10
10
  // Type-only: pulls the ui-workspace SlotMap merge (the Session row seats).
11
11
  import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
12
+ import { branchLabel } from '../branch-name.ts'
12
13
  import { ChangeRequestGlyph } from './glyphs.tsx'
13
14
  import type { NS } from './locales.ts'
14
15
  import { useSessionForgeFacts, type SessionListInjected } from './session-list.ts'
@@ -41,7 +42,7 @@ export function SessionHoverForge({ sessionId, useSessions, useStates, t }: Sess
41
42
  <span className={css.hoverIcon} aria-hidden="true"><IconBranchOutlineRegular size={12} /></span>
42
43
  <span className={css.hoverBody}>
43
44
  <span className={css.hoverBranch}>{worktree.branch}</span>
44
- <span className={css.hoverNote}>{t('checkout.worktreeFrom', { base: worktree.from ?? worktree.baseCommit.slice(0, 7) })}</span>
45
+ <span className={css.hoverNote}>{t('checkout.worktreeFrom', { base: worktree.from === null ? worktree.baseCommit.slice(0, 7) : branchLabel(worktree.from) })}</span>
45
46
  </span>
46
47
  </div>
47
48
  )}