@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,226 @@
1
+ /* Worktree creation card in the composer context stack: the dock column and
2
+ panel surface of the Goal, Todo, and Queue cards. */
3
+ .dock {
4
+ box-sizing: border-box;
5
+ width: calc(
6
+ 100% -
7
+ var(--dsh-composer-side-clearance) -
8
+ var(--dsh-composer-side-clearance) -
9
+ var(--dsh-composer-dock-inset) -
10
+ var(--dsh-composer-dock-inset) -
11
+ var(--dsh-composer-dock-inset) -
12
+ var(--dsh-composer-dock-inset)
13
+ );
14
+ margin: 0 auto;
15
+ }
16
+
17
+ .card {
18
+ position: relative;
19
+ isolation: isolate;
20
+ box-sizing: border-box;
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: 6px;
24
+ width: 100%;
25
+ max-width: calc(var(--dsh-composer-card-max-width) - 4 * var(--dsh-composer-dock-inset));
26
+ margin: 0 auto;
27
+ padding: 10px 8px 6px 12px;
28
+ border: 0;
29
+ --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);
30
+ border-radius: var(--dsw-radius-md);
31
+ box-shadow: var(--dsw-elevation-panel);
32
+ color: var(--dsw-alias-label-primary);
33
+ font-size: 13px;
34
+ line-height: 20px;
35
+ /* Elevated surface, as the menu background below makes it: the failure text
36
+ scrolls once it reaches its height cap, so the thumb takes the l2 pair.
37
+ Declared on the card, whose custom properties inherit down to the box that
38
+ scrolls (see ui-theme styles/scrollbar.css for the rebinding contract). */
39
+ --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);
40
+ --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);
41
+ }
42
+
43
+ .card::before {
44
+ position: absolute;
45
+ z-index: -1;
46
+ inset: 0;
47
+ border-radius: inherit;
48
+ background: var(--dsw-specific-menu);
49
+ backdrop-filter: var(--dsw-menu-backdrop-filter);
50
+ content: '';
51
+ pointer-events: none;
52
+ }
53
+
54
+ .header {
55
+ display: flex;
56
+ align-items: center;
57
+ gap: 8px;
58
+ min-width: 0;
59
+ padding-right: 4px;
60
+ }
61
+
62
+ .glyph {
63
+ flex: none;
64
+ color: var(--dsw-alias-label-tertiary);
65
+ }
66
+
67
+ .warning {
68
+ flex: none;
69
+ color: var(--dsw-alias-state-warn-primary);
70
+ }
71
+
72
+ .title {
73
+ flex: none;
74
+ font-weight: 500;
75
+ }
76
+
77
+ .branch,
78
+ .code {
79
+ min-width: 0;
80
+ overflow: hidden;
81
+ color: var(--dsw-alias-label-tertiary);
82
+ font-family: var(--ds-font-family-code);
83
+ font-size: 12px;
84
+ text-overflow: ellipsis;
85
+ white-space: nowrap;
86
+ }
87
+
88
+ .steps {
89
+ display: flex;
90
+ flex-direction: column;
91
+ gap: 2px;
92
+ margin: 0;
93
+ padding: 0 0 0 22px;
94
+ list-style: none;
95
+ }
96
+
97
+ .step {
98
+ display: flex;
99
+ align-items: center;
100
+ gap: 8px;
101
+ min-height: 24px;
102
+ color: var(--dsw-alias-label-secondary);
103
+ }
104
+
105
+ .step[data-state='running'] {
106
+ color: var(--dsw-alias-label-primary);
107
+ }
108
+
109
+ .step[data-state='failed'] {
110
+ color: var(--dsw-alias-state-error-primary);
111
+ }
112
+
113
+ .step svg {
114
+ flex: none;
115
+ }
116
+
117
+ .done {
118
+ color: var(--dsw-alias-state-success-primary);
119
+ }
120
+
121
+ .failed {
122
+ color: var(--dsw-alias-state-error-primary);
123
+ }
124
+
125
+ /* An empty ring for a step that has not started, the size of the step glyphs. */
126
+ .waiting {
127
+ flex: none;
128
+ box-sizing: border-box;
129
+ width: 14px;
130
+ height: 14px;
131
+ border: 1.5px solid var(--dsw-alias-label-dimmed);
132
+ border-radius: 50%;
133
+ corner-shape: round;
134
+ }
135
+
136
+ .details {
137
+ display: grid;
138
+ grid-template-columns: auto minmax(0, 1fr);
139
+ gap: 2px 12px;
140
+ margin: 2px 0 0 22px;
141
+ color: var(--dsw-alias-label-secondary);
142
+ font-size: 12px;
143
+ line-height: 18px;
144
+ }
145
+
146
+ .details dt {
147
+ color: var(--dsw-alias-label-tertiary);
148
+ }
149
+
150
+ .details dd {
151
+ margin: 0;
152
+ }
153
+
154
+ .message {
155
+ max-height: 120px;
156
+ overflow-y: auto;
157
+ overflow-wrap: anywhere;
158
+ white-space: pre-wrap;
159
+ }
160
+
161
+ .footer {
162
+ display: flex;
163
+ align-items: center;
164
+ justify-content: space-between;
165
+ gap: 8px;
166
+ min-height: 28px;
167
+ }
168
+
169
+ .disclosure {
170
+ display: inline-flex;
171
+ align-items: center;
172
+ gap: 4px;
173
+ height: 28px;
174
+ padding: 0 6px;
175
+ border: 0;
176
+ border-radius: var(--dsw-radius-sm);
177
+ background: transparent;
178
+ color: var(--dsw-alias-label-tertiary);
179
+ font: inherit;
180
+ font-size: 12px;
181
+ cursor: pointer;
182
+ }
183
+
184
+ .disclosure:focus-visible {
185
+ background: var(--dsw-alias-interactive-bg-hover);
186
+ color: var(--dsw-alias-label-secondary);
187
+ }
188
+
189
+ @media (hover: hover) {
190
+ .disclosure:hover {
191
+ background: var(--dsw-alias-interactive-bg-hover);
192
+ color: var(--dsw-alias-label-secondary);
193
+ }
194
+ }
195
+
196
+ .chevron,
197
+ .chevronOpen {
198
+ flex: none;
199
+ transition: transform 120ms ease;
200
+ }
201
+
202
+ .chevronOpen {
203
+ transform: rotate(90deg);
204
+ }
205
+
206
+ .actions {
207
+ display: inline-flex;
208
+ flex-wrap: wrap;
209
+ justify-content: flex-end;
210
+ gap: 4px;
211
+ margin-left: auto;
212
+ }
213
+
214
+ /* Explanation and restore failure under the header of the removed-worktree card. */
215
+ .note,
216
+ .error {
217
+ margin: 0 0 0 22px;
218
+ color: var(--dsw-alias-label-secondary);
219
+ font-size: 12px;
220
+ line-height: 18px;
221
+ }
222
+
223
+ .error {
224
+ color: var(--dsw-alias-state-error-primary);
225
+ overflow-wrap: anywhere;
226
+ }
@@ -0,0 +1,280 @@
1
+ /**
2
+ * Card above the composer while a Session's worktree is created, while a message
3
+ * waits after a failed or stopped attempt, and when its worktree is gone or
4
+ * being restored.
5
+ */
6
+
7
+ import { useState, type ReactNode } from 'react'
8
+ import {
9
+ Button, IconBranchOutlineRegular, IconCheckOutlineRegular, IconChevronRightOutlineRegular, IconCloseOutlineRegular, StateDot,
10
+ } from '@deepseek-ai/dsh-client-ui-primitives'
11
+ import type { HostObservable, InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
12
+ import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
13
+ import { assertNever } from '@deepseek-ai/dsh-util-values'
14
+ import type { ForgeMissingWorktree, ForgePanelWorktree, ForgeSessionWorktree, ForgeWorktreeRestoration } from '../types.ts'
15
+ import type { ForgePanelKey, NS } from './locales.ts'
16
+ import type { PanelSnapshot } from './source.ts'
17
+ import css from './WorktreeProgress.module.css'
18
+
19
+ /** Business face of the card. */
20
+ export interface WorktreeProgressInjected {
21
+ /** Panel snapshot of the Session; the renderer binds it as `usePanel`. */
22
+ readonly hooks: { readonly panel: HostObservable<PanelSnapshot> }
23
+ /** Stop the running attempt a message waits for; the message keeps waiting. */
24
+ readonly stop: () => void
25
+ /** Make another attempt at the worktree a message waits for. */
26
+ readonly retry: () => void
27
+ /** Withdraw the worktree request, so the waiting message goes on without a worktree. */
28
+ readonly withdraw: () => void
29
+ /**
30
+ * Check out the removed worktree again.
31
+ * @returns the failure text, or undefined once it is restored.
32
+ */
33
+ readonly restore: () => Promise<string | undefined>
34
+ /** Move the Session back to the source checkout of its removed worktree. */
35
+ readonly leave: () => void
36
+ }
37
+
38
+ /** Full props of the card. */
39
+ export type WorktreeProgressProps = InjectFace<WorktreeProgressInjected> & PropsLocale<typeof NS>
40
+
41
+ type Translate = WorktreeProgressProps['t']
42
+
43
+ type StepState = 'done' | 'running' | 'waiting' | 'failed'
44
+
45
+ type Phase = 'prepare' | 'checkout'
46
+
47
+ type StepList = readonly { readonly phase: Phase; readonly label: ForgePanelKey }[]
48
+
49
+ const CREATION_STEPS: StepList = [
50
+ { phase: 'prepare', label: 'creation.prepare' },
51
+ { phase: 'checkout', label: 'creation.checkout' },
52
+ ]
53
+
54
+ const RESTORATION_STEPS: StepList = [
55
+ { phase: 'prepare', label: 'restoration.prepare' },
56
+ { phase: 'checkout', label: 'creation.checkout' },
57
+ ]
58
+
59
+ function stepState(current: 'prepare' | 'checkout', failed: boolean, phase: 'prepare' | 'checkout'): StepState {
60
+ if (phase === current) return failed ? 'failed' : 'running'
61
+ return phase === 'prepare' ? 'done' : 'waiting'
62
+ }
63
+
64
+ function Steps({ steps, phase, failed, t }: {
65
+ readonly steps: StepList
66
+ readonly phase: Phase
67
+ readonly failed: boolean
68
+ readonly t: Translate
69
+ }): ReactNode {
70
+ return (
71
+ <ul className={css.steps}>
72
+ {steps.map(step => (
73
+ <li key={step.phase} className={css.step} data-state={stepState(phase, failed, step.phase)}>
74
+ <StepIcon state={stepState(phase, failed, step.phase)} />
75
+ <span>{t(step.label)}</span>
76
+ </li>
77
+ ))}
78
+ </ul>
79
+ )
80
+ }
81
+
82
+ function StepIcon({ state }: { readonly state: StepState }): ReactNode {
83
+ switch (state) {
84
+ case 'done': return <IconCheckOutlineRegular size={14} className={css.done} />
85
+ case 'running': return <StateDot state="ongoing" size={14} />
86
+ case 'failed': return <IconCloseOutlineRegular size={14} className={css.failed} />
87
+ case 'waiting': return <span className={css.waiting} aria-hidden="true" />
88
+ /* v8 ignore next -- closed StepState union exhaustiveness guard */
89
+ default: return assertNever(state, 'StepState')
90
+ }
91
+ }
92
+
93
+ /** One creation as the card shows it: the running attempt, or the failed or stopped one a message waits after. */
94
+ interface CreationView {
95
+ readonly state: 'running' | 'failed' | 'stopped'
96
+ readonly phase: 'prepare' | 'checkout'
97
+ readonly branch: string | null
98
+ readonly from: string | null
99
+ /** Failure text, or null unless the attempt failed. */
100
+ readonly message: string | null
101
+ /** Whether a message waits for the running attempt, which can then be stopped. */
102
+ readonly held: boolean
103
+ }
104
+
105
+ /** The running attempt, else the failed or stopped one a message waits after, or undefined without either. */
106
+ function creationOf(worktree: ForgePanelWorktree): CreationView | undefined {
107
+ const { creation, failure, waiting } = worktree
108
+ if (creation !== null) return { ...creation, state: 'running', message: null }
109
+ if (waiting !== 'creation') return undefined
110
+ if (failure !== null) return { ...failure, state: 'failed', held: false }
111
+ return { state: 'stopped', phase: 'prepare', branch: null, from: worktree.request?.from ?? null, message: null, held: false }
112
+ }
113
+
114
+ function Details({ creation, t }: { readonly creation: CreationView; readonly t: Translate }): ReactNode {
115
+ return (
116
+ <dl className={css.details}>
117
+ {creation.branch !== null && (
118
+ <>
119
+ <dt>{t('creation.branch')}</dt>
120
+ <dd className={css.code}>{creation.branch}</dd>
121
+ </>
122
+ )}
123
+ <dt>{t('creation.base')}</dt>
124
+ <dd className={css.code}>{creation.from ?? t('creation.head')}</dd>
125
+ {creation.message !== null && (
126
+ <>
127
+ <dt>{t('creation.error')}</dt>
128
+ <dd className={css.message}>{creation.message}</dd>
129
+ </>
130
+ )}
131
+ </dl>
132
+ )
133
+ }
134
+
135
+ const CREATION_TITLE: Record<CreationView['state'], ForgePanelKey> = {
136
+ running: 'creation.title',
137
+ failed: 'creation.failed',
138
+ stopped: 'creation.stopped',
139
+ }
140
+
141
+ function CreationCard({ creation, stop, retry, withdraw, t }: {
142
+ readonly creation: CreationView
143
+ readonly stop: WorktreeProgressInjected['stop']
144
+ readonly retry: WorktreeProgressInjected['retry']
145
+ readonly withdraw: WorktreeProgressInjected['withdraw']
146
+ readonly t: Translate
147
+ }): ReactNode {
148
+ const [open, setOpen] = useState(false)
149
+ const running = creation.state === 'running'
150
+ const failed = creation.state === 'failed'
151
+ const title = t(CREATION_TITLE[creation.state])
152
+ return (
153
+ <div className={css.dock} data-forge-creation={running ? creation.phase : creation.state}>
154
+ <section className={css.card} aria-label={title} aria-busy={running}>
155
+ <div className={css.header}>
156
+ <IconBranchOutlineRegular size={14} className={css.glyph} />
157
+ <span className={css.title}>{title}</span>
158
+ {creation.branch !== null && <span className={css.branch}>{creation.branch}</span>}
159
+ </div>
160
+ {creation.state !== 'stopped' && <Steps steps={CREATION_STEPS} phase={creation.phase} failed={failed} t={t} />}
161
+ {(open || failed) && <Details creation={creation} t={t} />}
162
+ {!running && <p className={css.note}>{t('creation.waiting')}</p>}
163
+ <div className={css.footer}>
164
+ {running && (
165
+ <button type="button" className={css.disclosure} aria-expanded={open} onClick={() => { setOpen(!open) }}>
166
+ <IconChevronRightOutlineRegular size={12} className={open ? css.chevronOpen : css.chevron} />
167
+ {t('creation.details')}
168
+ </button>
169
+ )}
170
+ {!running && (
171
+ <span className={css.actions}>
172
+ <Button size="sm" variant="primary" onClick={retry}>{t('creation.retry')}</Button>
173
+ <Button size="sm" variant="ghost" onClick={withdraw}>{t('creation.skip')}</Button>
174
+ </span>
175
+ )}
176
+ {creation.held && (
177
+ <span className={css.actions}>
178
+ <Button size="sm" variant="ghost" icon={<IconCloseOutlineRegular size={14} />} onClick={stop}>{t('creation.cancel')}</Button>
179
+ </span>
180
+ )}
181
+ </div>
182
+ </section>
183
+ </div>
184
+ )
185
+ }
186
+
187
+ function MissingCard({ created, missing, restoration, waiting, restore, leave, t }: {
188
+ readonly created: ForgeSessionWorktree
189
+ readonly missing: ForgeMissingWorktree
190
+ /** The running restoration, from whichever surface started it. */
191
+ readonly restoration: ForgeWorktreeRestoration | null
192
+ /** Whether a message waits for the worktree to be restored or left. */
193
+ readonly waiting: boolean
194
+ readonly restore: WorktreeProgressInjected['restore']
195
+ readonly leave: WorktreeProgressInjected['leave']
196
+ readonly t: Translate
197
+ }): ReactNode {
198
+ const [restoring, setRestoring] = useState(false)
199
+ const [error, setError] = useState<string | null>(null)
200
+ const start = (): void => {
201
+ setRestoring(true)
202
+ setError(null)
203
+ void restore().then(
204
+ (failure) => {
205
+ setRestoring(false)
206
+ setError(failure ?? null)
207
+ },
208
+ (failure: unknown) => {
209
+ setRestoring(false)
210
+ setError(failure instanceof Error ? failure.message : String(failure))
211
+ },
212
+ )
213
+ }
214
+ // The restore this card asked for runs before the Host names its first step.
215
+ const phase = restoration?.phase ?? (restoring ? 'prepare' : null)
216
+ if (phase !== null) {
217
+ return (
218
+ <div className={css.dock} data-forge-missing="" data-forge-restoration={phase}>
219
+ <section className={css.card} aria-label={t('restoration.title')} aria-busy={true}>
220
+ <div className={css.header}>
221
+ <IconBranchOutlineRegular size={14} className={css.glyph} />
222
+ <span className={css.title}>{t('restoration.title')}</span>
223
+ <span className={css.branch}>{created.branch}</span>
224
+ </div>
225
+ <Steps steps={RESTORATION_STEPS} phase={phase} failed={false} t={t} />
226
+ </section>
227
+ </div>
228
+ )
229
+ }
230
+ return (
231
+ <div className={css.dock} data-forge-missing="">
232
+ <section className={css.card} aria-label={t('missing.title')}>
233
+ <div className={css.header}>
234
+ <IconBranchOutlineRegular size={14} className={css.warning} />
235
+ <span className={css.title}>{t('missing.title')}</span>
236
+ <span className={css.branch}>{created.branch}</span>
237
+ </div>
238
+ <p className={css.note}>{t(missing.branchExists === null ? 'missing.unknown' : missing.branchExists ? 'missing.kept' : 'missing.recreated', { branch: created.branch })}</p>
239
+ {waiting && <p className={css.note}>{t('missing.waiting')}</p>}
240
+ {error !== null && <p className={css.error}>{error}</p>}
241
+ <div className={css.footer}>
242
+ <span className={css.actions}>
243
+ <Button size="sm" variant="primary" onClick={start}>{t('missing.restore')}</Button>
244
+ <Button size="sm" variant="ghost" onClick={leave}>{t('missing.leave')}</Button>
245
+ </span>
246
+ </div>
247
+ </section>
248
+ </div>
249
+ )
250
+ }
251
+
252
+ /**
253
+ * Render the worktree card of a Session: the running attempt at its
254
+ * requested worktree, which can be stopped while a message waits for it; the
255
+ * failed or stopped attempt a message waits after, with another attempt or
256
+ * withdrawing the request so the message goes on without a worktree; or the
257
+ * removal of the worktree the Session works in, with restoring it, whose
258
+ * steps the card follows, and returning to the source checkout, after which
259
+ * a waiting message goes on.
260
+ * @param props - panel hook, actions, and copy.
261
+ * @returns the card, or nothing while no attempt runs, no message waits, and the worktree exists.
262
+ */
263
+ export function WorktreeProgress({ usePanel, stop, retry, withdraw, restore, leave, t }: WorktreeProgressProps): ReactNode {
264
+ const worktree = usePanel(snapshot => snapshot.state?.worktree ?? null)
265
+ if (worktree === null) return null
266
+ const creation = creationOf(worktree)
267
+ if (creation !== undefined) return <CreationCard creation={creation} stop={stop} retry={retry} withdraw={withdraw} t={t} />
268
+ if (worktree.missing === null || worktree.created === null) return null
269
+ return (
270
+ <MissingCard
271
+ created={worktree.created}
272
+ missing={worktree.missing}
273
+ restoration={worktree.restoration}
274
+ waiting={worktree.waiting === 'restoration'}
275
+ restore={restore}
276
+ leave={leave}
277
+ t={t}
278
+ />
279
+ )
280
+ }
@@ -0,0 +1,29 @@
1
+ /* The worktree row page: one switch row under the Plugins form's tokens. */
2
+ .row {
3
+ display: flex;
4
+ align-items: center;
5
+ justify-content: space-between;
6
+ gap: 24px;
7
+ padding: 12px 0;
8
+ }
9
+
10
+ .text {
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: 4px;
14
+ min-width: 0;
15
+ }
16
+
17
+ .title {
18
+ font-size: 13px;
19
+ font-weight: 500;
20
+ line-height: 1.5;
21
+ color: var(--dsw-alias-label-primary);
22
+ }
23
+
24
+ .description {
25
+ margin: 0;
26
+ font-size: 12px;
27
+ line-height: 18px;
28
+ color: var(--dsw-alias-label-secondary);
29
+ }
@@ -0,0 +1,42 @@
1
+ /** The worktree service's row page on the Plugins page: the archive cleanup switch. */
2
+ import { useId } from 'react'
3
+ import { SettingsForm, Switch } from '@deepseek-ai/dsh-client-ui-primitives'
4
+ import type { SettingsFormLabels } from '@deepseek-ai/dsh-client-ui-primitives'
5
+ import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
6
+ import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
7
+ import type { NS } from './locales.ts'
8
+ import type { WorktreeSettingsInjected } from './worktree-settings-form.ts'
9
+ import css from './WorktreeSettings.module.css'
10
+
11
+ export type WorktreeSettingsProps = PropsRuntime<'plugins.row.config'> & PropsLocale<typeof NS> & InjectFace<WorktreeSettingsInjected>
12
+
13
+ function formLabels(t: WorktreeSettingsProps['t']): SettingsFormLabels {
14
+ return {
15
+ unavailable: t('settings.unavailable'), readOnly: t('settings.readOnly'), saveFailed: t('settings.saveFailed'),
16
+ save: t('settings.save'), saving: t('settings.saving'),
17
+ }
18
+ }
19
+
20
+ /**
21
+ * Render the worktree row's configuration: one switch that keeps every
22
+ * checkout when its Session is archived. The summary view names the switch.
23
+ * @param props - the Plugins page view, the staged form, and its actions.
24
+ * @returns the row page's form, or the summary line.
25
+ */
26
+ export function WorktreeSettings(props: WorktreeSettingsProps) {
27
+ const { t } = props
28
+ const id = useId()
29
+ const state = props.useWorktreeForm(value => value)
30
+ if (props.view === 'summary') return t('settings.retainOnArchive.title')
31
+ const disabled = !state.writable || state.saving
32
+ return <SettingsForm labels={formLabels(t)} state={state} onSave={props.save} onDiscard={props.discard}>
33
+ <div className={css.row}>
34
+ <div className={css.text}>
35
+ <label className={css.title} htmlFor={id}>{t('settings.retainOnArchive.title')}</label>
36
+ <p className={css.description}>{t('settings.retainOnArchive.description')}</p>
37
+ </div>
38
+ <Switch checked={state.retainOnArchive.text === 'true'} disabled={disabled} label={t('settings.retainOnArchive.title')}
39
+ onChange={(next) => { props.edit('retainOnArchive', next ? 'true' : 'false') }} />
40
+ </div>
41
+ </SettingsForm>
42
+ }
@@ -0,0 +1,132 @@
1
+ /* Worktree option at the right of the New Session row: the compact 28px chip
2
+ geometry and secondary ink of the composer mode controls. */
3
+ .root {
4
+ display: inline-flex;
5
+ flex: none;
6
+ align-items: center;
7
+ gap: 2px;
8
+ min-width: 0;
9
+ }
10
+
11
+ .toggle,
12
+ .base,
13
+ .current {
14
+ display: inline-flex;
15
+ align-items: center;
16
+ gap: 6px;
17
+ min-width: 0;
18
+ height: 28px;
19
+ padding: 0 8px;
20
+ border: none;
21
+ border-radius: var(--dsw-radius-sm);
22
+ background: transparent;
23
+ color: var(--dsw-alias-label-secondary);
24
+ font-size: 13px;
25
+ font-weight: 500;
26
+ line-height: 20px;
27
+ white-space: nowrap;
28
+ cursor: pointer;
29
+ }
30
+
31
+ @media (hover: hover) {
32
+ .toggle:hover:not([data-disabled]),
33
+ .base:hover:not(:disabled) {
34
+ background: var(--dsw-alias-interactive-bg-hover);
35
+ }
36
+ }
37
+
38
+ .toggle[data-disabled] {
39
+ color: var(--dsw-alias-label-dimmed);
40
+ cursor: default;
41
+ }
42
+
43
+ .base {
44
+ gap: 4px;
45
+ max-width: 200px;
46
+ padding-right: 4px;
47
+ }
48
+
49
+ .current {
50
+ box-sizing: content-box;
51
+ max-width: 200px;
52
+ font-family: inherit;
53
+ }
54
+
55
+ .current svg {
56
+ flex: none;
57
+ }
58
+
59
+ .base:focus-visible,
60
+ .current:focus-visible,
61
+ .toggle:has(.checkbox:focus-visible) {
62
+ outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
63
+ outline-offset: 2px;
64
+ }
65
+
66
+ .base:disabled {
67
+ cursor: progress;
68
+ }
69
+
70
+ .checkbox {
71
+ flex: none;
72
+ width: 14px;
73
+ height: 14px;
74
+ margin: 0;
75
+ accent-color: var(--dsw-alias-brand-primary);
76
+ cursor: inherit;
77
+ }
78
+
79
+ .checkbox:focus-visible {
80
+ outline: none;
81
+ }
82
+
83
+ .baseLabel {
84
+ min-width: 0;
85
+ overflow: hidden;
86
+ text-overflow: ellipsis;
87
+ }
88
+
89
+ .chevron {
90
+ flex: none;
91
+ color: var(--dsw-alias-label-tertiary);
92
+ transition: transform 120ms ease;
93
+ }
94
+
95
+ .chevronOpen {
96
+ transform: rotate(180deg);
97
+ }
98
+
99
+ .option {
100
+ display: inline-flex;
101
+ align-items: baseline;
102
+ gap: 8px;
103
+ min-width: 0;
104
+ }
105
+
106
+ .optionName {
107
+ min-width: 0;
108
+ overflow: hidden;
109
+ font-family: var(--ds-font-family-code);
110
+ font-size: 12px;
111
+ text-overflow: ellipsis;
112
+ white-space: nowrap;
113
+ }
114
+
115
+ .optionNote {
116
+ flex: none;
117
+ color: var(--dsw-alias-label-tertiary);
118
+ font-size: 12px;
119
+ }
120
+
121
+ @media (max-width: 600px) {
122
+ .root {
123
+ flex-direction: column;
124
+ align-items: flex-end;
125
+ gap: 0;
126
+ }
127
+
128
+ .base,
129
+ .current {
130
+ max-width: 120px;
131
+ }
132
+ }