@deepseek-ai/dsh-experimental-client-ui-forge 0.2.2-alpha.3 → 0.2.2-rc.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 (272) hide show
  1. package/README.i18n.yaml +8 -8
  2. package/README.md +41 -14
  3. package/README.zh.md +40 -13
  4. package/lib/client.js +13 -11800
  5. package/lib/client.js.map +1 -0
  6. package/lib/index.js +1340 -115
  7. package/lib/typert.host.js +1715 -212
  8. package/lib/typert.remote-client.d.ts +42 -5
  9. package/lib/typert.remote-client.d.ts.map +1 -0
  10. package/lib/typert.remote-client.js +1523 -244
  11. package/lib/types/client/ActionToast.d.ts.map +1 -0
  12. package/lib/types/client/ActionToast.js.map +1 -0
  13. package/lib/types/client/BaseMenu.d.ts +30 -0
  14. package/lib/types/client/BaseMenu.d.ts.map +1 -0
  15. package/lib/types/client/BaseMenu.js.map +1 -0
  16. package/lib/types/client/ChangeRequestCard.d.ts +9 -5
  17. package/lib/types/client/ChangeRequestCard.d.ts.map +1 -0
  18. package/lib/types/client/ChangeRequestCard.js.map +1 -0
  19. package/lib/types/client/ChangeRequestOverview.d.ts +124 -0
  20. package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -0
  21. package/lib/types/client/ChangeRequestOverview.js.map +1 -0
  22. package/lib/types/client/ChangedFiles.d.ts +2 -0
  23. package/lib/types/client/ChangedFiles.d.ts.map +1 -0
  24. package/lib/types/client/ChangedFiles.js.map +1 -0
  25. package/lib/types/client/ChangesTab.d.ts +30 -5
  26. package/lib/types/client/ChangesTab.d.ts.map +1 -0
  27. package/lib/types/client/ChangesTab.js.map +1 -0
  28. package/lib/types/client/ChangesTabTitle.d.ts.map +1 -0
  29. package/lib/types/client/ChangesTabTitle.js.map +1 -0
  30. package/lib/types/client/CommitMenu.d.ts +41 -0
  31. package/lib/types/client/CommitMenu.d.ts.map +1 -0
  32. package/lib/types/client/CommitMenu.js.map +1 -0
  33. package/lib/types/client/DiffFile.d.ts +47 -15
  34. package/lib/types/client/DiffFile.d.ts.map +1 -0
  35. package/lib/types/client/DiffFile.js.map +1 -0
  36. package/lib/types/client/FileLabel.d.ts.map +1 -0
  37. package/lib/types/client/FileLabel.js.map +1 -0
  38. package/lib/types/client/FileTreePane.d.ts +4 -2
  39. package/lib/types/client/FileTreePane.d.ts.map +1 -0
  40. package/lib/types/client/FileTreePane.js.map +1 -0
  41. package/lib/types/client/ForgeTab.d.ts +9 -1
  42. package/lib/types/client/ForgeTab.d.ts.map +1 -0
  43. package/lib/types/client/ForgeTab.js.map +1 -0
  44. package/lib/types/client/ForgeTabTitle.d.ts.map +1 -0
  45. package/lib/types/client/ForgeTabTitle.js.map +1 -0
  46. package/lib/types/client/HeaderButton.d.ts.map +1 -0
  47. package/lib/types/client/HeaderButton.js.map +1 -0
  48. package/lib/types/client/LocalChangesCard.d.ts.map +1 -0
  49. package/lib/types/client/LocalChangesCard.js.map +1 -0
  50. package/lib/types/client/RefreshGlyph.d.ts.map +1 -0
  51. package/lib/types/client/RefreshGlyph.js.map +1 -0
  52. package/lib/types/client/ReviewComposer.d.ts +20 -6
  53. package/lib/types/client/ReviewComposer.d.ts.map +1 -0
  54. package/lib/types/client/ReviewComposer.js.map +1 -0
  55. package/lib/types/client/ReviewControls.d.ts +79 -0
  56. package/lib/types/client/ReviewControls.d.ts.map +1 -0
  57. package/lib/types/client/ReviewControls.js.map +1 -0
  58. package/lib/types/client/ReviewThread.d.ts +4 -4
  59. package/lib/types/client/ReviewThread.d.ts.map +1 -0
  60. package/lib/types/client/ReviewThread.js.map +1 -0
  61. package/lib/types/client/ReviewThreads.d.ts +108 -0
  62. package/lib/types/client/ReviewThreads.d.ts.map +1 -0
  63. package/lib/types/client/ReviewThreads.js.map +1 -0
  64. package/lib/types/client/SessionHoverForge.d.ts.map +1 -0
  65. package/lib/types/client/SessionHoverForge.js.map +1 -0
  66. package/lib/types/client/SessionRowForge.d.ts +1 -1
  67. package/lib/types/client/SessionRowForge.d.ts.map +1 -0
  68. package/lib/types/client/SessionRowForge.js.map +1 -0
  69. package/lib/types/client/SubmitReview.d.ts +12 -4
  70. package/lib/types/client/SubmitReview.d.ts.map +1 -0
  71. package/lib/types/client/SubmitReview.js.map +1 -0
  72. package/lib/types/client/ThreadList.d.ts +43 -0
  73. package/lib/types/client/ThreadList.d.ts.map +1 -0
  74. package/lib/types/client/ThreadList.js.map +1 -0
  75. package/lib/types/client/ViewOptionsMenu.d.ts +31 -0
  76. package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -0
  77. package/lib/types/client/ViewOptionsMenu.js.map +1 -0
  78. package/lib/types/client/WorktreeProgress.d.ts.map +1 -0
  79. package/lib/types/client/WorktreeProgress.js.map +1 -0
  80. package/lib/types/client/WorktreeSettings.d.ts +12 -0
  81. package/lib/types/client/WorktreeSettings.d.ts.map +1 -0
  82. package/lib/types/client/WorktreeSettings.js.map +1 -0
  83. package/lib/types/client/WorktreeToggle.d.ts.map +1 -0
  84. package/lib/types/client/WorktreeToggle.js.map +1 -0
  85. package/lib/types/client/changes-address.d.ts.map +1 -0
  86. package/lib/types/client/changes-address.js.map +1 -0
  87. package/lib/types/client/changes-store.d.ts +20 -5
  88. package/lib/types/client/changes-store.d.ts.map +1 -0
  89. package/lib/types/client/changes-store.js.map +1 -0
  90. package/lib/types/client/checkout.d.ts.map +1 -0
  91. package/lib/types/client/checkout.js.map +1 -0
  92. package/lib/types/client/code-selection.d.ts.map +1 -0
  93. package/lib/types/client/code-selection.js.map +1 -0
  94. package/lib/types/client/diff-rows.d.ts.map +1 -0
  95. package/lib/types/client/diff-rows.js.map +1 -0
  96. package/lib/types/client/file-tree.d.ts.map +1 -0
  97. package/lib/types/client/file-tree.js.map +1 -0
  98. package/lib/types/client/format.d.ts.map +1 -0
  99. package/lib/types/client/format.js.map +1 -0
  100. package/lib/types/client/glyphs.d.ts +4 -2
  101. package/lib/types/client/glyphs.d.ts.map +1 -0
  102. package/lib/types/client/glyphs.js.map +1 -0
  103. package/lib/types/client/host-viewed.d.ts +84 -0
  104. package/lib/types/client/host-viewed.d.ts.map +1 -0
  105. package/lib/types/client/host-viewed.js.map +1 -0
  106. package/lib/types/client/index.d.ts.map +1 -0
  107. package/lib/types/client/index.js.map +1 -0
  108. package/lib/types/client/locales.d.ts +175 -3
  109. package/lib/types/client/locales.d.ts.map +1 -0
  110. package/lib/types/client/locales.js.map +1 -0
  111. package/lib/types/client/menu-search.d.ts +10 -0
  112. package/lib/types/client/menu-search.d.ts.map +1 -0
  113. package/lib/types/client/menu-search.js.map +1 -0
  114. package/lib/types/client/mount.d.ts +4 -0
  115. package/lib/types/client/mount.d.ts.map +1 -0
  116. package/lib/types/client/mount.js.map +1 -0
  117. package/lib/types/client/review-queue.d.ts +5 -8
  118. package/lib/types/client/review-queue.d.ts.map +1 -0
  119. package/lib/types/client/review-queue.js.map +1 -0
  120. package/lib/types/client/review-threads.d.ts +108 -0
  121. package/lib/types/client/review-threads.d.ts.map +1 -0
  122. package/lib/types/client/review-threads.js.map +1 -0
  123. package/lib/types/client/review.d.ts +31 -4
  124. package/lib/types/client/review.d.ts.map +1 -0
  125. package/lib/types/client/review.js.map +1 -0
  126. package/lib/types/client/section-reach.d.ts +26 -0
  127. package/lib/types/client/section-reach.d.ts.map +1 -0
  128. package/lib/types/client/section-reach.js.map +1 -0
  129. package/lib/types/client/session-list.d.ts.map +1 -0
  130. package/lib/types/client/session-list.js.map +1 -0
  131. package/lib/types/client/source.d.ts.map +1 -0
  132. package/lib/types/client/source.js.map +1 -0
  133. package/lib/types/client/status.d.ts.map +1 -0
  134. package/lib/types/client/status.js.map +1 -0
  135. package/lib/types/client/thread-state.d.ts +68 -0
  136. package/lib/types/client/thread-state.d.ts.map +1 -0
  137. package/lib/types/client/thread-state.js.map +1 -0
  138. package/lib/types/client/toolbar-fold.d.ts +19 -0
  139. package/lib/types/client/toolbar-fold.d.ts.map +1 -0
  140. package/lib/types/client/toolbar-fold.js.map +1 -0
  141. package/lib/types/client/viewed-files.d.ts +70 -0
  142. package/lib/types/client/viewed-files.d.ts.map +1 -0
  143. package/lib/types/client/viewed-files.js.map +1 -0
  144. package/lib/types/client/worktree-settings-form.d.ts +32 -0
  145. package/lib/types/client/worktree-settings-form.d.ts.map +1 -0
  146. package/lib/types/client/worktree-settings-form.js.map +1 -0
  147. package/lib/types/commit-range.d.ts +17 -0
  148. package/lib/types/commit-range.d.ts.map +1 -0
  149. package/lib/types/commit-range.js.map +1 -0
  150. package/lib/types/diff.d.ts +10 -2
  151. package/lib/types/diff.d.ts.map +1 -0
  152. package/lib/types/diff.js.map +1 -0
  153. package/lib/types/git.d.ts.map +1 -0
  154. package/lib/types/git.js.map +1 -0
  155. package/lib/types/index.d.ts +194 -14
  156. package/lib/types/index.d.ts.map +1 -0
  157. package/lib/types/index.js.map +1 -0
  158. package/lib/types/layers.d.ts +66 -0
  159. package/lib/types/layers.d.ts.map +1 -0
  160. package/lib/types/layers.js.map +1 -0
  161. package/lib/types/local-diff.d.ts +54 -6
  162. package/lib/types/local-diff.d.ts.map +1 -0
  163. package/lib/types/local-diff.js.map +1 -0
  164. package/lib/types/panel.d.ts.map +1 -0
  165. package/lib/types/panel.js.map +1 -0
  166. package/lib/types/parse.d.ts +16 -0
  167. package/lib/types/parse.d.ts.map +1 -0
  168. package/lib/types/parse.js.map +1 -0
  169. package/lib/types/patch-cache.d.ts +12 -7
  170. package/lib/types/patch-cache.d.ts.map +1 -0
  171. package/lib/types/patch-cache.js.map +1 -0
  172. package/lib/types/review-cache.d.ts +54 -0
  173. package/lib/types/review-cache.d.ts.map +1 -0
  174. package/lib/types/review-cache.js.map +1 -0
  175. package/lib/types/states.d.ts.map +1 -0
  176. package/lib/types/states.js.map +1 -0
  177. package/lib/types/types.d.ts +113 -11
  178. package/lib/types/types.d.ts.map +1 -0
  179. package/lib/types/types.js.map +1 -0
  180. package/lib/types/wildmatch.d.ts +14 -0
  181. package/lib/types/wildmatch.d.ts.map +1 -0
  182. package/lib/types/wildmatch.js.map +1 -0
  183. package/lib/types/worktree.d.ts +8 -6
  184. package/lib/types/worktree.d.ts.map +1 -0
  185. package/lib/types/worktree.js.map +1 -0
  186. package/package.json +59 -49
  187. package/src/client/ActionToast.tsx +38 -0
  188. package/src/client/BaseMenu.module.css +153 -0
  189. package/src/client/BaseMenu.tsx +180 -0
  190. package/src/client/ChangeRequestCard.tsx +439 -0
  191. package/src/client/ChangeRequestOverview.module.css +196 -0
  192. package/src/client/ChangeRequestOverview.tsx +620 -0
  193. package/src/client/ChangedFiles.module.css +26 -0
  194. package/src/client/ChangedFiles.tsx +144 -0
  195. package/src/client/ChangesTab.module.css +984 -0
  196. package/src/client/ChangesTab.tsx +1288 -0
  197. package/src/client/ChangesTabTitle.tsx +28 -0
  198. package/src/client/CommitMenu.module.css +139 -0
  199. package/src/client/CommitMenu.tsx +186 -0
  200. package/src/client/DiffFile.tsx +621 -0
  201. package/src/client/FileLabel.module.css +53 -0
  202. package/src/client/FileLabel.tsx +66 -0
  203. package/src/client/FileTreePane.module.css +10 -0
  204. package/src/client/FileTreePane.tsx +79 -0
  205. package/src/client/ForgeTab.module.css +627 -0
  206. package/src/client/ForgeTab.tsx +263 -0
  207. package/src/client/ForgeTabTitle.tsx +21 -0
  208. package/src/client/HeaderButton.module.css +29 -0
  209. package/src/client/HeaderButton.tsx +68 -0
  210. package/src/client/LocalChangesCard.tsx +83 -0
  211. package/src/client/RefreshGlyph.module.css +22 -0
  212. package/src/client/RefreshGlyph.tsx +35 -0
  213. package/src/client/ReviewComposer.module.css +37 -0
  214. package/src/client/ReviewComposer.tsx +128 -0
  215. package/src/client/ReviewControls.module.css +162 -0
  216. package/src/client/ReviewControls.tsx +191 -0
  217. package/src/client/ReviewThread.tsx +96 -0
  218. package/src/client/ReviewThreads.module.css +326 -0
  219. package/src/client/ReviewThreads.tsx +443 -0
  220. package/src/client/SessionHoverForge.tsx +72 -0
  221. package/src/client/SessionList.module.css +85 -0
  222. package/src/client/SessionRowForge.tsx +86 -0
  223. package/src/client/SubmitReview.module.css +26 -0
  224. package/src/client/SubmitReview.tsx +95 -0
  225. package/src/client/ThreadList.module.css +218 -0
  226. package/src/client/ThreadList.tsx +165 -0
  227. package/src/client/ViewOptionsMenu.tsx +79 -0
  228. package/src/client/WorktreeProgress.module.css +226 -0
  229. package/src/client/WorktreeProgress.tsx +280 -0
  230. package/src/client/WorktreeSettings.module.css +29 -0
  231. package/src/client/WorktreeSettings.tsx +42 -0
  232. package/src/client/WorktreeToggle.module.css +132 -0
  233. package/src/client/WorktreeToggle.tsx +165 -0
  234. package/src/client/changes-address.ts +110 -0
  235. package/src/client/changes-store.ts +155 -0
  236. package/src/client/checkout.ts +75 -0
  237. package/src/client/code-selection.ts +53 -0
  238. package/src/client/diff-rows.ts +199 -0
  239. package/src/client/file-tree.ts +86 -0
  240. package/src/client/format.ts +37 -0
  241. package/src/client/glyphs.tsx +151 -0
  242. package/src/client/host-viewed.ts +195 -0
  243. package/src/client/index.ts +31 -0
  244. package/src/client/locales.ts +3446 -0
  245. package/src/client/menu-search.ts +16 -0
  246. package/src/client/mount.ts +439 -0
  247. package/src/client/review-queue.ts +256 -0
  248. package/src/client/review-threads.ts +204 -0
  249. package/src/client/review.ts +120 -0
  250. package/src/client/section-reach.ts +61 -0
  251. package/src/client/session-list.ts +79 -0
  252. package/src/client/source.ts +274 -0
  253. package/src/client/status.ts +171 -0
  254. package/src/client/thread-state.ts +127 -0
  255. package/src/client/toolbar-fold.ts +70 -0
  256. package/src/client/viewed-files.ts +178 -0
  257. package/src/client/worktree-settings-form.ts +43 -0
  258. package/src/commit-range.ts +27 -0
  259. package/src/css-modules.d.ts +5 -0
  260. package/src/diff.ts +162 -0
  261. package/src/git.ts +293 -0
  262. package/src/index.ts +1162 -0
  263. package/src/layers.ts +163 -0
  264. package/src/local-diff.ts +438 -0
  265. package/src/panel.ts +422 -0
  266. package/src/parse.ts +137 -0
  267. package/src/patch-cache.ts +73 -0
  268. package/src/review-cache.ts +98 -0
  269. package/src/states.ts +350 -0
  270. package/src/types.ts +504 -0
  271. package/src/wildmatch.ts +121 -0
  272. package/src/worktree.ts +576 -0
@@ -0,0 +1,263 @@
1
+ /** Body of the forge sidebar tab: where the Session works, its local changes, and the change requests it created or pushed. */
2
+
3
+ import { useEffect, useState, type ReactNode } from 'react'
4
+ import {
5
+ Button, IconBranchOutlineRegular, IconCopyOutlineRegular, IconFolderCloseRegular, IconWarningTriangleOutlineRegular, StateDot, Tooltip,
6
+ } from '@deepseek-ai/dsh-client-ui-primitives'
7
+ import type { HostObservable, InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
8
+ import type { RemoteHostFacts } from '@deepseek-ai/dsh-api-remotes/client'
9
+ import type { MergeRequest } from '@deepseek-ai/dsh-experimental-forge/types'
10
+ import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
11
+ import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client'
12
+ import type { ForgePanelChangeRequest, ForgePanelState } from '../types.ts'
13
+ import { changesAddress, type ChangesSource } from './changes-address.ts'
14
+ import { ChangeRequestCard, type ChangeRequestActions } from './ChangeRequestCard.tsx'
15
+ import { checkoutLabel } from './checkout.ts'
16
+ import { LocalChangesCard } from './LocalChangesCard.tsx'
17
+ import type { NS } from './locales.ts'
18
+ import { RefreshGlyph } from './RefreshGlyph.tsx'
19
+ import type { PanelSnapshot } from './source.ts'
20
+ import { defaultExpanded, openChangeRequestOf } from './status.ts'
21
+ import css from './ForgeTab.module.css'
22
+
23
+ /** Business face of the tab body. */
24
+ export interface ForgeTabInjected {
25
+ /** Panel snapshot of the Session and the Host facts; the renderer binds them as `usePanel` and `useHost`. */
26
+ readonly hooks: {
27
+ readonly panel: HostObservable<PanelSnapshot>
28
+ readonly host: HostObservable<RemoteHostFacts>
29
+ readonly locale: HostObservable<string>
30
+ }
31
+ /** Open the stream again after it ended. */
32
+ readonly reconnect: () => void
33
+ /**
34
+ * Reinspect the checkout, probe sign-in, and poll the change requests;
35
+ * settles once the Host has inspected and probed, after reporting a failure.
36
+ */
37
+ readonly refresh: () => Promise<void>
38
+ /** Remove a change request from the Session, offering to undo it. */
39
+ readonly remove: (entry: ForgePanelChangeRequest) => void
40
+ /** Mark a draft ready for review; settles once the outcome is reported. */
41
+ readonly markReady: (entry: ForgePanelChangeRequest) => Promise<void>
42
+ /** Merge a change request as `request` describes; settles once the outcome is reported. */
43
+ readonly merge: (entry: ForgePanelChangeRequest, request: MergeRequest) => Promise<void>
44
+ /** Read the complete checks of an opened change request. */
45
+ readonly readChecks: NonNullable<ChangeRequestActions['readChecks']>
46
+ /** Rerun the failed checks or one check; settles once the outcome is reported. */
47
+ readonly rerunChecks: NonNullable<ChangeRequestActions['rerunChecks']>
48
+ /** Request reviews from more reviewers; settles once the outcome is reported. */
49
+ readonly requestReviews: NonNullable<ChangeRequestActions['requestReviews']>
50
+ /** List accounts a review can be requested from. */
51
+ readonly reviewerCandidates: NonNullable<ChangeRequestActions['reviewerCandidates']>
52
+ /** Bring the base branch's new commits into the head branch; settles once the outcome is reported. */
53
+ readonly updateBranch: NonNullable<ChangeRequestActions['updateBranch']>
54
+ /** Check the removed worktree of the Session out again, reporting the outcome. */
55
+ readonly restore: () => void
56
+ /** Open a URL outside the app. */
57
+ readonly openLink: (url: string) => void
58
+ /** Copy text to the clipboard and report the outcome. */
59
+ readonly copyText: (text: string) => void
60
+ /** Copy a path to the clipboard and report the outcome. */
61
+ readonly copyPath: (path: string) => void
62
+ /** Record whether the tab is visible, for the header entry's pressed state. */
63
+ readonly reportVisible: (visible: boolean) => void
64
+ /** Ask the Session's Agent to create a change request for its changes, reporting the outcome. */
65
+ readonly createChangeRequest: () => void
66
+ }
67
+
68
+ /** Full props of the tab body. */
69
+ export type ForgeTabProps =
70
+ Pick<PropsRuntime<'sidebar.right.pane.tab'>, 'useTabInfo' | 'sessionId'>
71
+ & InjectFace<ForgeTabInjected>
72
+ & PropsLocale<typeof NS>
73
+
74
+ type Translate = ForgeTabProps['t']
75
+
76
+ function Checkout({ state, home, restore, copyPath, t }: {
77
+ readonly state: ForgePanelState
78
+ readonly home: string | undefined
79
+ readonly restore: () => void
80
+ readonly copyPath: (path: string) => void
81
+ readonly t: Translate
82
+ }): ReactNode {
83
+ const checkout = state.checkout
84
+ const label = checkoutLabel(state, home, t)
85
+ if (label === undefined) {
86
+ if (checkout.state === 'none') return <div className={css.checkout}>{t('checkout.none')}</div>
87
+ if (checkout.state !== 'failed') return null
88
+ return (
89
+ <Tooltip label={checkout.message} side="bottom">
90
+ <div className={css.checkout} tabIndex={0}>{t('checkout.failed')}</div>
91
+ </Tooltip>
92
+ )
93
+ }
94
+ const copyLabel = t(label.worktree ? 'checkout.copyWorktreePath' : 'checkout.copyProjectPath')
95
+ return (
96
+ <div className={css.checkout} data-forge-checkout="" data-missing={label.missing ? '' : undefined}>
97
+ <Tooltip label={label.tooltip} side="bottom">
98
+ <span className={css.checkoutName} tabIndex={0}>
99
+ {label.missing
100
+ ? <IconWarningTriangleOutlineRegular size={14} className={css.checkoutIcon} />
101
+ : label.worktree
102
+ ? <IconBranchOutlineRegular size={14} className={css.checkoutIcon} />
103
+ : <IconFolderCloseRegular size={14} className={css.checkoutIcon} />}
104
+ {label.detached && <span>{t('checkout.detached')}</span>}
105
+ {label.detached && label.name !== null && <span aria-hidden="true">·</span>}
106
+ {label.name !== null && <span className={css.checkoutBranch}>{label.name}</span>}
107
+ </span>
108
+ </Tooltip>
109
+ <span className={css.checkoutNote}>{label.kind}</span>
110
+ <Tooltip label={copyLabel} side="bottom">
111
+ <button type="button" className={`${css.iconButton} ${css.checkoutCopy}`} aria-label={copyLabel} onClick={() => { copyPath(label.path) }}>
112
+ <IconCopyOutlineRegular size={14} />
113
+ </button>
114
+ </Tooltip>
115
+ {label.missing && (
116
+ <Button
117
+ size="sm"
118
+ variant="outline"
119
+ disabled={state.worktree.restoration !== null}
120
+ icon={state.worktree.restoration === null ? undefined : <StateDot state="ongoing" size={14} />}
121
+ onClick={restore}
122
+ >
123
+ {t('checkout.restore')}
124
+ </Button>
125
+ )}
126
+ </div>
127
+ )
128
+ }
129
+
130
+ function SignIn({ state, copyText, t }: {
131
+ readonly state: ForgePanelState
132
+ readonly copyText: (text: string) => void
133
+ readonly t: Translate
134
+ }): ReactNode {
135
+ const { repository, readiness } = state
136
+ if (repository === null || readiness === null || readiness.state === 'ready') return null
137
+ const host = repository.host
138
+ if (readiness.state === 'unavailable') {
139
+ return <div className={css.banner} role="status">{t('signin.unavailable', { host, message: readiness.message ?? '' })}</div>
140
+ }
141
+ const command = repository.forge === 'github' ? `gh auth login --hostname ${host}` : undefined
142
+ return (
143
+ <div className={css.banner} role="status">
144
+ <span>{t('signin.title', { host })}</span>
145
+ {command === undefined
146
+ ? readiness.message !== null && <span className={css.bannerDetail}>{readiness.message}</span>
147
+ : (
148
+ <>
149
+ <code className={css.bannerCommand}>{command}</code>
150
+ <Button size="sm" variant="outline" className={css.bannerAction} onClick={() => { copyText(command) }}>
151
+ {t('signin.copy')}
152
+ </Button>
153
+ </>
154
+ )}
155
+ </div>
156
+ )
157
+ }
158
+
159
+ /**
160
+ * Render the forge tab of one Session. The local changes card shows whenever
161
+ * the `branch` scope changes files, independently of bound change requests.
162
+ * The only open change request starts expanded; once the
163
+ * user expands or collapses a card, the panel keeps that choice across later updates.
164
+ * @param props - tab information, panel snapshot and Host facts hooks, actions, and copy.
165
+ * @returns the tab body.
166
+ */
167
+ export function ForgeTab({
168
+ useTabInfo, sessionId, usePanel, useHost, useLocale, reconnect, refresh, remove, markReady, merge, readChecks, restore,
169
+ rerunChecks, requestReviews, reviewerCandidates, updateBranch, openLink, copyText, copyPath,
170
+ reportVisible, createChangeRequest, t,
171
+ }: ForgeTabProps): ReactNode {
172
+ const snapshot = usePanel(current => current)
173
+ const home = useHost(facts => facts.home)
174
+ const locale = useLocale(value => value)
175
+ const { tab } = useTabInfo()
176
+ const visible = tab.visible
177
+ const [chosen, setChosen] = useState<ReadonlySet<string> | null>(null)
178
+ const [refreshing, setRefreshing] = useState(false)
179
+ useEffect(() => {
180
+ reportVisible(visible)
181
+ }, [reportVisible, visible])
182
+ useEffect(() => () => { reportVisible(false) }, [reportVisible])
183
+ const state = snapshot.state
184
+ const disconnected = snapshot.disconnected && (
185
+ <div className={css.disconnected} role="status">
186
+ <span>{t('stream.failed')}</span>
187
+ <Button size="sm" variant="outline" onClick={reconnect}>{t('retry')}</Button>
188
+ </div>
189
+ )
190
+ if (state === null) return <div className={css.centered}>{disconnected || <StateDot state="ongoing" />}</div>
191
+ const viewChanges = (source: ChangesSource, path?: string): void => {
192
+ tab.actions.openResource(changesAddress({ sessionId, source }), path === undefined ? undefined : { params: { path } })
193
+ }
194
+ const startRefresh = (): void => {
195
+ if (refreshing) return
196
+ setRefreshing(true)
197
+ void refresh().finally(() => { setRefreshing(false) })
198
+ }
199
+ const actions: ChangeRequestActions = {
200
+ openLink, copyLink: copyText, retry: startRefresh, remove, markReady, merge, readChecks,
201
+ rerunChecks, requestReviews, reviewerCandidates, updateBranch,
202
+ viewChanges: (entry) => { viewChanges({ kind: 'change', url: entry.url }) },
203
+ }
204
+ const local = state.local !== null && state.local.files.length > 0 ? state.local : null
205
+ const expanded = chosen ?? defaultExpanded(state.changeRequests)
206
+ const toggle = (url: string): void => {
207
+ const next = new Set(expanded)
208
+ if (next.has(url)) next.delete(url)
209
+ else next.add(url)
210
+ setChosen(next)
211
+ }
212
+ const now = Date.now()
213
+ const count = state.changeRequests.length
214
+ return (
215
+ <div className={css.root} data-forge-panel="">
216
+ {disconnected}
217
+ <Checkout state={state} home={home} restore={restore} copyPath={copyPath} t={t} />
218
+ {local !== null && (
219
+ <LocalChangesCard
220
+ local={local}
221
+ creatable={state.repository !== null && openChangeRequestOf(state) === undefined}
222
+ view={(path) => { viewChanges({ kind: 'local' }, path) }}
223
+ create={createChangeRequest}
224
+ t={t}
225
+ />
226
+ )}
227
+ <section className={css.section}>
228
+ <div className={css.sectionHeader}>
229
+ <h3 className={css.sectionTitle}>{t('changes.title', { count })}</h3>
230
+ <Tooltip label={t('refresh')} side="top">
231
+ <button type="button" className={css.iconButton} aria-label={t('refresh')} aria-disabled={refreshing} onClick={startRefresh}>
232
+ <RefreshGlyph busy={refreshing} size={14} />
233
+ </button>
234
+ </Tooltip>
235
+ </div>
236
+ <SignIn state={state} copyText={copyText} t={t} />
237
+ {count === 0
238
+ ? (
239
+ <div className={css.empty}>
240
+ <p className={css.emptyTitle}>{t('changes.empty')}</p>
241
+ <p className={css.emptyHint}>{t('changes.emptyHint')}</p>
242
+ </div>
243
+ )
244
+ : (
245
+ <ul className={css.list}>
246
+ {state.changeRequests.map(entry => (
247
+ <ChangeRequestCard
248
+ key={entry.url}
249
+ entry={entry}
250
+ expanded={expanded.has(entry.url)}
251
+ onToggle={() => { toggle(entry.url) }}
252
+ now={now}
253
+ actions={actions}
254
+ locale={locale}
255
+ t={t}
256
+ />
257
+ ))}
258
+ </ul>
259
+ )}
260
+ </section>
261
+ </div>
262
+ )
263
+ }
@@ -0,0 +1,21 @@
1
+ /** Chip title of the forge tab: the change request glyph and the localized tab name. */
2
+
3
+ import type { ReactNode } from 'react'
4
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
5
+ import { ChangeRequestGlyph } from './glyphs.tsx'
6
+ import type { NS } from './locales.ts'
7
+ import css from './ForgeTab.module.css'
8
+
9
+ /**
10
+ * Render the tab chip title in the current UI language.
11
+ * @param props - forge panel copy.
12
+ * @returns the glyph followed by the tab name.
13
+ */
14
+ export function ForgeTabTitle({ t }: PropsLocale<typeof NS>): ReactNode {
15
+ return (
16
+ <>
17
+ <span className={css.titleIcon}><ChangeRequestGlyph tone="open" tinted={false} size={16} /></span>
18
+ <span className={css.titleText}>{t('tab.title')}</span>
19
+ </>
20
+ )
21
+ }
@@ -0,0 +1,29 @@
1
+ /* Icon-only header entry: the shared compact Button owns the radius, height,
2
+ and interaction fills, as for the header's other actions; the status dot
3
+ sits at the glyph's top-right corner. */
4
+ .trigger {
5
+ position: relative;
6
+ flex: none;
7
+ width: 28px;
8
+ padding: 0;
9
+ color: var(--dsw-alias-label-secondary);
10
+ }
11
+
12
+ /* The forge tab is visible; the pressed fill outranks the Button's hover fill. */
13
+ .trigger[aria-pressed='true'] {
14
+ color: var(--dsw-alias-label-primary);
15
+ background: var(--dsw-alias-interactive-bg-active);
16
+ }
17
+
18
+ @media (hover: hover) {
19
+ .trigger[aria-pressed='true']:hover:not(:disabled) {
20
+ color: var(--dsw-alias-label-primary);
21
+ background: var(--dsw-alias-interactive-bg-active);
22
+ }
23
+ }
24
+
25
+ .dot {
26
+ position: absolute;
27
+ top: 6px;
28
+ right: 6px;
29
+ }
@@ -0,0 +1,68 @@
1
+ /** Session header entry that shows or hides the forge tab and marks change requests that need attention. */
2
+
3
+ import type { ReactNode } from 'react'
4
+ import { Button, StateDot, Tooltip } from '@deepseek-ai/dsh-client-ui-primitives'
5
+ import type { HostObservable, InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
6
+ import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
7
+ import { ChangeRequestGlyph } from './glyphs.tsx'
8
+ import type { NS } from './locales.ts'
9
+ import type { PanelSnapshot } from './source.ts'
10
+ import { needsAttention } from './status.ts'
11
+ import css from './HeaderButton.module.css'
12
+
13
+ /** Business face of the header entry. */
14
+ export interface HeaderButtonInjected {
15
+ /** Panel snapshot and tab visibility of the Session; the renderer binds them as `usePanel` and `useVisible`. */
16
+ readonly hooks: { readonly panel: HostObservable<PanelSnapshot>; readonly visible: HostObservable<boolean> }
17
+ /**
18
+ * Hide the forge tab when it is visible, otherwise open or reveal it.
19
+ * @param visible - whether the tab is visible now.
20
+ */
21
+ readonly toggle: (visible: boolean) => void
22
+ }
23
+
24
+ /** Full props of the header entry. */
25
+ export type HeaderButtonProps = InjectFace<HeaderButtonInjected> & PropsLocale<typeof NS>
26
+
27
+ /**
28
+ * Show the entry once the Session has bound change requests or its directory
29
+ * is known to be inside a Git checkout: after an inspection found one or
30
+ * failed, or while a later inspection runs for a directory whose repository
31
+ * is already known.
32
+ * @param snapshot - panel snapshot.
33
+ * @returns whether the entry shows.
34
+ */
35
+ function shown(snapshot: PanelSnapshot): boolean {
36
+ const state = snapshot.state
37
+ if (state === null) return false
38
+ return state.changeRequests.length > 0 || state.checkout.state === 'ready' || state.checkout.state === 'failed'
39
+ || (state.checkout.state === 'pending' && state.repository !== null)
40
+ }
41
+
42
+ /**
43
+ * Render the header entry.
44
+ * @param props - panel snapshot and visibility hooks, the toggle, and copy.
45
+ * @returns the entry, or nothing outside a Git checkout without bound change requests.
46
+ */
47
+ export function HeaderButton({ usePanel, useVisible, toggle, t }: HeaderButtonProps): ReactNode {
48
+ const visible = usePanel(shown)
49
+ const attention = usePanel(snapshot => snapshot.state?.changeRequests.some(needsAttention) === true)
50
+ const pressed = useVisible(current => current)
51
+ if (!visible) return null
52
+ const label = t(attention ? 'header.attention' : 'header.label')
53
+ return (
54
+ <Tooltip label={label} side="bottom">
55
+ <Button
56
+ size="sm"
57
+ className={css.trigger}
58
+ aria-label={label}
59
+ aria-pressed={pressed}
60
+ data-forge-header=""
61
+ onClick={() => { toggle(pressed) }}
62
+ >
63
+ <ChangeRequestGlyph tone="open" tinted={false} size={16} />
64
+ {attention && <StateDot state="error" size={6} className={css.dot} />}
65
+ </Button>
66
+ </Tooltip>
67
+ )
68
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The panel card of the checkout's `branch` scope changes, independent of
3
+ * change request bindings: file counts and paths open the local changes view,
4
+ * and an optional action asks the Agent for a change request.
5
+ */
6
+
7
+ import { useState, type ReactNode } from 'react'
8
+ import { Button, IconChevronDownOutlineRegular, IconListPenOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
9
+ import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
10
+ import type { ForgeLocalChanges } from '../types.ts'
11
+ import { Counts } from './DiffFile.tsx'
12
+ import { FileLabel } from './FileLabel.tsx'
13
+ import type { NS } from './locales.ts'
14
+ import css from './ChangesTab.module.css'
15
+
16
+ /** Props of the local changes card. */
17
+ export interface LocalChangesCardProps {
18
+ /** Files the `branch` scope changes and the ref it compares with. */
19
+ readonly local: ForgeLocalChanges
20
+ /** Whether the card offers to create a change request. */
21
+ readonly creatable: boolean
22
+ /** Open the changes view, scrolled to `path` when given. */
23
+ readonly view: (path?: string) => void
24
+ /** Ask the Agent to create a change request for the changes. */
25
+ readonly create: () => void
26
+ /** Forge panel copy. */
27
+ readonly t: PropsLocale<typeof NS>['t']
28
+ }
29
+
30
+ /**
31
+ * Render the local changes card; the file list starts collapsed.
32
+ * @param props - the changes, the view and create actions, and copy.
33
+ * @returns the card.
34
+ */
35
+ export function LocalChangesCard({ local, creatable, view, create, t }: LocalChangesCardProps): ReactNode {
36
+ const [open, setOpen] = useState(false)
37
+ let additions = 0
38
+ let deletions = 0
39
+ for (const file of local.files) {
40
+ additions += file.additions
41
+ deletions += file.deletions
42
+ }
43
+ const count = local.files.length
44
+ return (
45
+ <section className={css.local} data-forge-local="">
46
+ <div className={css.localHead}>
47
+ <button type="button" className={css.localToggle} aria-expanded={open} onClick={() => { setOpen(value => !value) }}>
48
+ {t('changes.local.title')}
49
+ <IconChevronDownOutlineRegular size={12} />
50
+ </button>
51
+ <span className={css.localRefs}>{t('changes.local.refs', { head: 'HEAD', base: local.base })}</span>
52
+ </div>
53
+ <div className={css.localRow}>
54
+ <button
55
+ type="button"
56
+ className={css.localView}
57
+ aria-label={t('changes.local.viewAria', { count, added: additions, deleted: deletions })}
58
+ onClick={() => { view() }}
59
+ >
60
+ <IconListPenOutlineRegular size={15} />
61
+ <Counts file={{ additions, deletions, binary: false }} t={t} />
62
+ <span aria-hidden="true">·</span>
63
+ <span>{t('changes.local.files', { count })}</span>
64
+ </button>
65
+ {creatable && (
66
+ <Button size="sm" variant="outline" className={css.localCreate} onClick={create}>{t('changes.local.create')}</Button>
67
+ )}
68
+ </div>
69
+ {open && (
70
+ <ul className={css.localFiles}>
71
+ {local.files.map(file => (
72
+ <li key={file.path}>
73
+ <button type="button" className={css.localFile} onClick={() => { view(file.path) }}>
74
+ <FileLabel path={file.path} className={css.menuPath} />
75
+ <Counts file={file} t={t} />
76
+ </button>
77
+ </li>
78
+ ))}
79
+ </ul>
80
+ )}
81
+ </section>
82
+ )
83
+ }
@@ -0,0 +1,22 @@
1
+ .glyph {
2
+ display: inline-flex;
3
+ }
4
+
5
+ .glyph[data-turning] {
6
+ animation: forge-refresh-turn 1s linear infinite;
7
+ }
8
+
9
+ @keyframes forge-refresh-turn {
10
+ to { transform: rotate(360deg); }
11
+ }
12
+
13
+ /* Reduced motion dims the glyph instead; the dim still fires the iteration events that end a turn. */
14
+ @media (prefers-reduced-motion: reduce) {
15
+ .glyph[data-turning] {
16
+ animation-name: forge-refresh-dim;
17
+ }
18
+ }
19
+
20
+ @keyframes forge-refresh-dim {
21
+ 50% { opacity: 0.4; }
22
+ }
@@ -0,0 +1,35 @@
1
+ /** Refresh glyph that turns while a refresh runs. */
2
+
3
+ import { useState, type ReactNode } from 'react'
4
+ import { IconRefreshOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
5
+ import css from './RefreshGlyph.module.css'
6
+
7
+ /** Props of the refresh glyph. */
8
+ export interface RefreshGlyphProps {
9
+ /** Whether the refresh runs. */
10
+ readonly busy: boolean
11
+ /** Glyph size in pixels. */
12
+ readonly size: number
13
+ }
14
+
15
+ /**
16
+ * Render the refresh glyph. It turns while `busy` and, once `busy` ends,
17
+ * completes the turn under way, so a quick refresh still shows a whole turn
18
+ * and the glyph stops upright. Under reduced motion it dims and returns instead of turning.
19
+ * @param props - whether the refresh runs, and the glyph size.
20
+ * @returns the glyph.
21
+ */
22
+ export function RefreshGlyph({ busy, size }: RefreshGlyphProps): ReactNode {
23
+ // Set when a turn starts and cleared at the first turn boundary after `busy` ends.
24
+ const [turning, setTurning] = useState(false)
25
+ return (
26
+ <span
27
+ className={css.glyph}
28
+ data-turning={busy || turning ? '' : undefined}
29
+ onAnimationStart={() => { setTurning(true) }}
30
+ onAnimationIteration={() => { if (!busy) setTurning(false) }}
31
+ >
32
+ <IconRefreshOutlineRegular size={size} />
33
+ </span>
34
+ )
35
+ }
@@ -0,0 +1,37 @@
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); }
4
+ .root:focus-within { border-color: var(--dsw-alias-border-l4); }
5
+ /* 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; }
7
+ .title { margin-bottom: 12px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
8
+ /* Fixed-size textarea layout stays local during typing; native resizing can still change its outer height. */
9
+ .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; }
10
+ .input::placeholder { color: var(--dsw-alias-label-dimmed); }
11
+ .input:focus { border-color: var(--dsw-alias-state-business-primary); }
12
+ .root .input { padding: 0; border: 0; border-radius: 0; background: transparent; }
13
+ .actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 10px; margin-top: 10px; border-top: 0.5px solid var(--dsw-alias-border-l2); }
14
+ .cancel { margin-inline-end: auto; }
15
+ .error { margin-top: 8px; color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }
16
+ .gitAction { display: inline-flex; flex: none; align-items: stretch; }
17
+ .gitMain { border-start-end-radius: 0; border-end-end-radius: 0; }
18
+ .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
+ .gutter { position: relative; }
25
+ .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
+ .selected { background: var(--dsw-alias-interactive-bg-hover); outline: 1px solid var(--dsw-alias-border-l2); outline-offset: -1px; }
27
+ @media (hover: hover) { .line:hover { color: var(--dsw-alias-state-business-primary); } }
28
+ @media (pointer: coarse) { .input { font-size: 16px; } .line { min-height: 28px; } }
29
+
30
+ /* The plus starts just inside the number's padding and covers the sign column, or the empty lane side-by-side cells keep instead, so the line number and the code stay clickable. */
31
+ .add, .hoverAdd { position: absolute; z-index: 1; inset-inline-start: calc(100% - 4px); top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--dsw-radius-xs); background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-foreground); font: inherit; cursor: pointer; user-select: none; }
32
+ /* Unified rows that show both numbers move the left plus past the right number too; it paints over that number's padding. The plus inherits the code font because the number width is measured in `ch`. */
33
+ [data-review]:not([data-split]):not([data-single-side]) [data-review-side="L"] .add,
34
+ [data-review]:not([data-split]):not([data-single-side]) [data-review-side="L"] .hoverAdd { inset-inline-start: calc(100% + var(--forge-number-width, 3.5em) - 4px); }
35
+ /* The mouse shortcut appears only for the hovered side of a row: a split cell or a unified line. */
36
+ .hoverAdd { display: none; }
37
+ @media (hover: hover) { [data-diff-side]:hover .hoverAdd, [data-diff-line]:hover .hoverAdd { display: inline-flex; } }