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

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 (178) hide show
  1. package/README.i18n.yaml +10 -10
  2. package/README.md +16 -15
  3. package/README.zh.md +16 -15
  4. package/lib/client.js +18 -18
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +67 -18
  7. package/lib/typert.host.js +89 -45
  8. package/lib/typert.remote-client.d.ts +7 -7
  9. package/lib/typert.remote-client.d.ts.map +1 -1
  10. package/lib/typert.remote-client.js +48 -36
  11. package/lib/types/client/BranchPicker.d.ts.map +1 -1
  12. package/lib/types/client/BranchPicker.js.map +1 -1
  13. package/lib/types/client/ChangeRequestCard.d.ts +10 -1
  14. package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
  15. package/lib/types/client/ChangeRequestCard.js.map +1 -1
  16. package/lib/types/client/ChangeRequestOverview.d.ts +16 -0
  17. package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
  18. package/lib/types/client/ChangeRequestOverview.js.map +1 -1
  19. package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -1
  20. package/lib/types/client/ChangeRequestsSection.js.map +1 -1
  21. package/lib/types/client/ChangeStatus.d.ts +41 -0
  22. package/lib/types/client/ChangeStatus.d.ts.map +1 -0
  23. package/lib/types/client/ChangeStatus.js.map +1 -0
  24. package/lib/types/client/ChangedFiles.d.ts.map +1 -1
  25. package/lib/types/client/ChangedFiles.js.map +1 -1
  26. package/lib/types/client/ChangesTab.d.ts +23 -8
  27. package/lib/types/client/ChangesTab.d.ts.map +1 -1
  28. package/lib/types/client/ChangesTab.js.map +1 -1
  29. package/lib/types/client/CommitMenu.d.ts +8 -5
  30. package/lib/types/client/CommitMenu.d.ts.map +1 -1
  31. package/lib/types/client/CommitMenu.js.map +1 -1
  32. package/lib/types/client/CopyCommandButton.d.ts +19 -0
  33. package/lib/types/client/CopyCommandButton.d.ts.map +1 -0
  34. package/lib/types/client/CopyCommandButton.js.map +1 -0
  35. package/lib/types/client/DiffFile.d.ts +20 -3
  36. package/lib/types/client/DiffFile.d.ts.map +1 -1
  37. package/lib/types/client/DiffFile.js.map +1 -1
  38. package/lib/types/client/EnvironmentRows.d.ts.map +1 -1
  39. package/lib/types/client/EnvironmentRows.js.map +1 -1
  40. package/lib/types/client/FileLabel.d.ts +5 -5
  41. package/lib/types/client/FileLabel.d.ts.map +1 -1
  42. package/lib/types/client/FileLabel.js.map +1 -1
  43. package/lib/types/client/HostSettings.d.ts.map +1 -1
  44. package/lib/types/client/HostSettings.js.map +1 -1
  45. package/lib/types/client/LensFilter.d.ts.map +1 -1
  46. package/lib/types/client/LensFilter.js.map +1 -1
  47. package/lib/types/client/ReviewComposer.d.ts.map +1 -1
  48. package/lib/types/client/ReviewComposer.js.map +1 -1
  49. package/lib/types/client/ReviewControls.d.ts.map +1 -1
  50. package/lib/types/client/ReviewControls.js.map +1 -1
  51. package/lib/types/client/ReviewThread.d.ts.map +1 -1
  52. package/lib/types/client/ReviewThread.js.map +1 -1
  53. package/lib/types/client/ReviewThreads.d.ts +17 -2
  54. package/lib/types/client/ReviewThreads.d.ts.map +1 -1
  55. package/lib/types/client/ReviewThreads.js.map +1 -1
  56. package/lib/types/client/SubmitReview.d.ts.map +1 -1
  57. package/lib/types/client/SubmitReview.js.map +1 -1
  58. package/lib/types/client/ThreadList.d.ts.map +1 -1
  59. package/lib/types/client/ThreadList.js.map +1 -1
  60. package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
  61. package/lib/types/client/ViewOptionsMenu.js.map +1 -1
  62. package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -1
  63. package/lib/types/client/WorktreeNameDialog.js.map +1 -1
  64. package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
  65. package/lib/types/client/WorktreeProgress.js.map +1 -1
  66. package/lib/types/client/WorktreeSettings.d.ts.map +1 -1
  67. package/lib/types/client/WorktreeSettings.js.map +1 -1
  68. package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
  69. package/lib/types/client/WorktreeToggle.js.map +1 -1
  70. package/lib/types/client/changes-store.d.ts +7 -4
  71. package/lib/types/client/changes-store.d.ts.map +1 -1
  72. package/lib/types/client/changes-store.js.map +1 -1
  73. package/lib/types/client/glyphs.d.ts +14 -1
  74. package/lib/types/client/glyphs.d.ts.map +1 -1
  75. package/lib/types/client/glyphs.js.map +1 -1
  76. package/lib/types/client/index.d.ts +1 -2
  77. package/lib/types/client/index.d.ts.map +1 -1
  78. package/lib/types/client/index.js.map +1 -1
  79. package/lib/types/client/locales.d.ts +5 -4
  80. package/lib/types/client/locales.d.ts.map +1 -1
  81. package/lib/types/client/locales.js.map +1 -1
  82. package/lib/types/client/minute-clock.d.ts +7 -0
  83. package/lib/types/client/minute-clock.d.ts.map +1 -0
  84. package/lib/types/client/minute-clock.js.map +1 -0
  85. package/lib/types/client/mount.d.ts.map +1 -1
  86. package/lib/types/client/mount.js.map +1 -1
  87. package/lib/types/client/review-page/ReviewActivity.d.ts.map +1 -1
  88. package/lib/types/client/review-page/ReviewActivity.js.map +1 -1
  89. package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -1
  90. package/lib/types/client/review-page/ReviewChat.js.map +1 -1
  91. package/lib/types/client/review-page/ReviewDetail.d.ts +4 -1
  92. package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -1
  93. package/lib/types/client/review-page/ReviewDetail.js.map +1 -1
  94. package/lib/types/client/review-page/ReviewList.d.ts.map +1 -1
  95. package/lib/types/client/review-page/ReviewList.js.map +1 -1
  96. package/lib/types/client/review-page/ReviewPage.d.ts +2 -2
  97. package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -1
  98. package/lib/types/client/review-page/ReviewPage.js.map +1 -1
  99. package/lib/types/client/review-page/ReviewStatus.d.ts +17 -13
  100. package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -1
  101. package/lib/types/client/review-page/ReviewStatus.js.map +1 -1
  102. package/lib/types/client/review-page/review-store.d.ts +1 -1
  103. package/lib/types/client/review-threads.d.ts +14 -7
  104. package/lib/types/client/review-threads.d.ts.map +1 -1
  105. package/lib/types/client/review-threads.js.map +1 -1
  106. package/lib/types/client/status.d.ts +0 -6
  107. package/lib/types/client/status.d.ts.map +1 -1
  108. package/lib/types/client/status.js.map +1 -1
  109. package/lib/types/client/thread-state.d.ts +2 -2
  110. package/lib/types/client/thread-state.d.ts.map +1 -1
  111. package/lib/types/client/thread-state.js.map +1 -1
  112. package/lib/types/client/toolbar-fold.d.ts +16 -6
  113. package/lib/types/client/toolbar-fold.d.ts.map +1 -1
  114. package/lib/types/client/toolbar-fold.js.map +1 -1
  115. package/lib/types/index.d.ts +25 -12
  116. package/lib/types/index.d.ts.map +1 -1
  117. package/lib/types/index.js.map +1 -1
  118. package/lib/types/panel.js.map +1 -1
  119. package/lib/types/types.d.ts +22 -5
  120. package/lib/types/types.d.ts.map +1 -1
  121. package/lib/types/worktree.js.map +1 -1
  122. package/package.json +60 -58
  123. package/src/client/BaseMenu.module.css +6 -3
  124. package/src/client/BranchPicker.tsx +28 -19
  125. package/src/client/ChangeRequestCard.tsx +71 -41
  126. package/src/client/ChangeRequestOverview.tsx +174 -74
  127. package/src/client/ChangeRequestsSection.tsx +33 -8
  128. package/src/client/ChangeStatus.module.css +70 -0
  129. package/src/client/ChangeStatus.tsx +104 -0
  130. package/src/client/ChangedFiles.tsx +20 -7
  131. package/src/client/ChangesTab.module.css +89 -20
  132. package/src/client/ChangesTab.tsx +332 -134
  133. package/src/client/CommitMenu.tsx +77 -38
  134. package/src/client/CopyCommandButton.tsx +25 -0
  135. package/src/client/DiffFile.tsx +83 -21
  136. package/src/client/EnvironmentRows.tsx +13 -11
  137. package/src/client/FileLabel.module.css +16 -18
  138. package/src/client/FileLabel.tsx +15 -31
  139. package/src/client/Forge.module.css +3 -10
  140. package/src/client/HostSettings.tsx +10 -8
  141. package/src/client/LensFilter.tsx +11 -9
  142. package/src/client/ReviewComposer.tsx +29 -17
  143. package/src/client/ReviewControls.tsx +8 -6
  144. package/src/client/ReviewThread.tsx +63 -21
  145. package/src/client/ReviewThreads.tsx +126 -34
  146. package/src/client/SubmitReview.tsx +5 -3
  147. package/src/client/ThreadList.module.css +4 -3
  148. package/src/client/ThreadList.tsx +5 -5
  149. package/src/client/ViewOptionsMenu.tsx +10 -8
  150. package/src/client/WorktreeNameDialog.tsx +15 -11
  151. package/src/client/WorktreeProgress.tsx +11 -9
  152. package/src/client/WorktreeSettings.tsx +4 -3
  153. package/src/client/WorktreeToggle.tsx +65 -35
  154. package/src/client/changes-store.ts +8 -5
  155. package/src/client/glyphs.tsx +23 -1
  156. package/src/client/index.ts +1 -2
  157. package/src/client/locales.ts +40 -32
  158. package/src/client/minute-clock.ts +19 -0
  159. package/src/client/mount.ts +66 -51
  160. package/src/client/review-page/ReviewActivity.tsx +5 -4
  161. package/src/client/review-page/ReviewChat.tsx +46 -17
  162. package/src/client/review-page/ReviewDetail.tsx +62 -31
  163. package/src/client/review-page/ReviewList.tsx +23 -18
  164. package/src/client/review-page/ReviewPage.module.css +81 -10
  165. package/src/client/review-page/ReviewPage.tsx +43 -35
  166. package/src/client/review-page/ReviewStatus.tsx +64 -39
  167. package/src/client/review-threads.ts +23 -11
  168. package/src/client/status.ts +0 -9
  169. package/src/client/thread-state.ts +8 -7
  170. package/src/client/toolbar-fold.ts +59 -14
  171. package/src/index.ts +78 -20
  172. package/src/panel.ts +1 -1
  173. package/src/types.ts +24 -5
  174. package/src/worktree.ts +1 -1
  175. package/lib/types/client/AttentionIndicator.d.ts +0 -22
  176. package/lib/types/client/AttentionIndicator.d.ts.map +0 -1
  177. package/lib/types/client/AttentionIndicator.js.map +0 -1
  178. package/src/client/AttentionIndicator.tsx +0 -37
@@ -1,18 +1,18 @@
1
1
  /**
2
- * The status column of the review page's summary: the merge state, the checks that need attention, each reviewer with
3
- * their outcome, and the changed lines with the linked issues, each in a block of its own. A finished change request
4
- * shows how it ended, its changed lines, and its reviewers. The blocks read the facts and run the actions of the
5
- * Session panel's change request card.
2
+ * The status blocks of a change request, which the review page's summary shows as a column and a change request's
3
+ * changes view in the Session's right sidebar opens from its header: the merge state, the checks that need attention,
4
+ * each reviewer with their outcome, and the changed lines with the linked issues, each in a block of its own. A
5
+ * finished change request shows how it ended, its changed lines, and its reviewers. The blocks read the facts and run
6
+ * the actions of the Session panel's change request card.
6
7
  */
7
8
 
8
- import { useState, type ReactNode } from 'react'
9
+ import { useCallback, useState, type ReactNode } from 'react'
9
10
  import clsx from 'clsx'
10
11
  import {
11
12
  IconChevronDownOutlineRegular, IconChevronUpOutlineRegular, IconPlusOutlineRegular, IconRefreshOutlineRegular, Menu,
12
13
  } from '@deepseek-ai/dsh-client-ui-primitives/client'
13
14
  import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
14
15
  import type { ChangeRequestCheck, ChangeRequestReviewer, ChangeRequestSnapshot } from '@deepseek-ai/dsh-experimental-forge/types'
15
- import type { ForgeReviewChangeRequest } from '../../types.ts'
16
16
  import {
17
17
  ChangesRow, FinishedRow, MergeStateRow, reviewOutcome, type ChangeRequestActions,
18
18
  } from '../ChangeRequestCard.tsx'
@@ -22,7 +22,7 @@ import {
22
22
  } from '../ChangeRequestOverview.tsx'
23
23
  import { CheckGlyph } from '../glyphs.tsx'
24
24
  import type { NS } from '../locales.ts'
25
- import { checkCounts } from '../status.ts'
25
+ import { checkCounts, type ChangeRequestEntry } from '../status.ts'
26
26
  import overview from '../ChangeRequestOverview.module.css'
27
27
  import forge from '../Forge.module.css'
28
28
  import css from './ReviewPage.module.css'
@@ -93,6 +93,7 @@ function Checks({ frame, snapshot, actions, t }: StatusProps): ReactNode {
93
93
  // The list is replaced as a whole with each snapshot, and check names can repeat, so lines are keyed by position.
94
94
  const lines = (checks: readonly ChangeRequestCheck[]): ReactNode =>
95
95
  checks.map((check, index) => <CheckLine key={index} check={check} openLink={actions.openLink} t={t} />)
96
+ const toggleAll = useCallback((): void => { setAll(!all) }, [all])
96
97
  return (
97
98
  <section className={css.statusSection} aria-label={label} data-forge-review-checks="">
98
99
  <h3 className={css.statusHead}>
@@ -113,7 +114,7 @@ function Checks({ frame, snapshot, actions, t }: StatusProps): ReactNode {
113
114
  : lines(listed)}
114
115
  <ChecksReadStatus read={read} retry={retry} t={t} />
115
116
  {displayed.checks.length > listed.length && (
116
- <Fold expanded={all} total={displayed.checks.length} onToggle={() => { setAll(!all) }} t={t} />
117
+ <Fold expanded={all} total={displayed.checks.length} onToggle={toggleAll} t={t} />
117
118
  )}
118
119
  {rerun !== undefined && (
119
120
  <button type="button" className={clsx(css.statusLine, css.statusLineButton, css.statusAction)} disabled={busy}
@@ -128,6 +129,33 @@ function Checks({ frame, snapshot, actions, t }: StatusProps): ReactNode {
128
129
  )
129
130
  }
130
131
 
132
+ /** The rows of the reviewers menu: a search for someone to ask, or the reviewers to ask again beside the wider search. */
133
+ function RequestReviewRows({ url, list, again, searching, coarsePointer, ask, frame, close, run, onSearch, t }: {
134
+ readonly url: string
135
+ readonly list: NonNullable<ChangeRequestActions['reviewerCandidates']>
136
+ readonly again: readonly ChangeRequestReviewer[]
137
+ readonly searching: boolean
138
+ readonly coarsePointer: boolean
139
+ readonly ask: NonNullable<ChangeRequestActions['requestReviews']>
140
+ readonly frame: ChangeRequestEntry
141
+ readonly close: () => void
142
+ readonly run: (action: () => Promise<void>) => void
143
+ readonly onSearch: () => void
144
+ readonly t: Translate
145
+ }) {
146
+ const choose = useCallback((login: string): void => {
147
+ close()
148
+ run(() => ask(frame, [{ kind: 'user', login }]))
149
+ }, [ask, close, frame, run])
150
+ const request = useCallback((reviewer: Pick<ChangeRequestReviewer, 'kind' | 'login'>): void => {
151
+ close()
152
+ run(() => ask(frame, [reviewer]))
153
+ }, [ask, close, frame, run])
154
+ return searching || again.length === 0
155
+ ? <ReviewerSearch url={url} list={list} coarsePointer={coarsePointer} t={t} choose={choose} />
156
+ : <ReviewRequestItems again={again} separated={false} onSearch={onSearch} t={t} onRequest={request} />
157
+ }
158
+
131
159
  /**
132
160
  * The reviewers block: the aggregate outcome of an open change request in its heading, then each reviewer with their
133
161
  * latest outcome or pending request. When the signed-in user may request reviews of an open change request, its last
@@ -147,10 +175,12 @@ function Reviewers({ frame, snapshot, actions, coarsePointer, t }: StatusProps &
147
175
  ? { ask: requestReviews, list: reviewerCandidates }
148
176
  : undefined
149
177
  const again = reviewersToAskAgain(reviewers)
150
- const close = (): void => {
178
+ const close = useCallback((): void => {
151
179
  setOpen(false)
152
180
  setSearching(false)
153
- }
181
+ }, [])
182
+ const toggleAll = useCallback((): void => { setAll(!all) }, [all])
183
+ const startSearch = useCallback((): void => { setSearching(true) }, [])
154
184
  const lined = reviewers.length > 0 || snapshot.reviewersTruncated || requesting !== undefined
155
185
  return (
156
186
  <section className={css.statusSection} aria-label={label} data-forge-review-reviewers="">
@@ -163,7 +193,7 @@ function Reviewers({ frame, snapshot, actions, coarsePointer, t }: StatusProps &
163
193
  {(all ? reviewers : reviewers.slice(0, LISTED)).map(reviewer => (
164
194
  <ReviewerLine key={`${reviewer.kind}:${reviewer.login}`} reviewer={reviewer} headSha={snapshot.headSha} t={t} />
165
195
  ))}
166
- {reviewers.length > LISTED && <Fold expanded={all} total={reviewers.length} onToggle={() => { setAll(!all) }} t={t} />}
196
+ {reviewers.length > LISTED && <Fold expanded={all} total={reviewers.length} onToggle={toggleAll} t={t} />}
167
197
  {snapshot.reviewersTruncated && (
168
198
  <button type="button" className={clsx(css.statusLine, css.statusLineButton, css.statusFold)}
169
199
  onClick={() => { actions.openLink(snapshot.url) }}>
@@ -179,20 +209,8 @@ function Reviewers({ frame, snapshot, actions, coarsePointer, t }: StatusProps &
179
209
  {t('reviewPage.requestReview')}
180
210
  </button>
181
211
  )}>
182
- {searching || again.length === 0
183
- ? (
184
- <ReviewerSearch url={snapshot.url} list={requesting.list} coarsePointer={coarsePointer} t={t} choose={(login) => {
185
- close()
186
- run(() => requesting.ask(frame, [{ kind: 'user', login }]))
187
- }} />
188
- )
189
- : (
190
- <ReviewRequestItems again={again} separated={false} onSearch={() => { setSearching(true) }} t={t}
191
- onRequest={(reviewer: Pick<ChangeRequestReviewer, 'kind' | 'login'>) => {
192
- close()
193
- run(() => requesting.ask(frame, [reviewer]))
194
- }} />
195
- )}
212
+ <RequestReviewRows url={snapshot.url} list={requesting.list} again={again} searching={searching}
213
+ coarsePointer={coarsePointer} ask={requesting.ask} frame={frame} close={close} run={run} onSearch={startSearch} t={t} />
196
214
  </Menu>
197
215
  )}
198
216
  </div>
@@ -201,32 +219,37 @@ function Reviewers({ frame, snapshot, actions, coarsePointer, t }: StatusProps &
201
219
  )
202
220
  }
203
221
 
204
- /** Props of the status column and of its blocks. */
222
+ /** The actions the status blocks run. */
223
+ export type StatusActions = Pick<ChangeRequestActions,
224
+ 'openLink' | 'readChecks' | 'rerunChecks' | 'requestReviews' | 'reviewerCandidates' | 'updateBranch' | 'viewChanges'>
225
+
226
+ /** Props of the status blocks. */
205
227
  export interface StatusProps {
206
228
  /** The change request. */
207
- readonly frame: ForgeReviewChangeRequest
229
+ readonly frame: ChangeRequestEntry
208
230
  /** Its latest snapshot. */
209
231
  readonly snapshot: ChangeRequestSnapshot
210
- /** The actions the page offers on it. */
211
- readonly actions: ChangeRequestActions
232
+ /** The actions the surface offers on it. */
233
+ readonly actions: StatusActions
212
234
  /** Forge panel copy. */
213
235
  readonly t: Translate
214
236
  }
215
237
 
216
238
  /**
217
- * Render the status column.
239
+ * Render the status blocks.
218
240
  * @param props - the change request, its snapshot, how rows name it, the current time, the actions, the number
219
- * locale, whether the page's primary pointer is coarse, which keeps the reviewer search from focusing its field, and
220
- * copy.
241
+ * locale, whether the page's primary pointer is coarse, which keeps the reviewer search from focusing its field,
242
+ * whether the changed lines show, which the changes view itself leaves out, and copy.
221
243
  * @returns the blocks.
222
244
  */
223
- export function ReviewStatus({ frame, snapshot, name, now, actions, locale, coarsePointer, t }: StatusProps & {
245
+ export function ReviewStatus({ frame, snapshot, name, now, actions, locale, coarsePointer, lines = true, t }: StatusProps & {
224
246
  readonly name: string
225
247
  readonly now: number
226
248
  readonly locale: string
227
249
  readonly coarsePointer: boolean
250
+ readonly lines?: boolean | undefined
228
251
  }): ReactNode {
229
- const changes = <ChangesRow entry={frame} snapshot={snapshot} name={name} actions={actions} locale={locale} t={t} />
252
+ const changes = lines && <ChangesRow entry={frame} snapshot={snapshot} name={name} actions={actions} locale={locale} t={t} />
230
253
  if (snapshot.state !== 'open') {
231
254
  return (
232
255
  <>
@@ -253,12 +276,14 @@ export function ReviewStatus({ frame, snapshot, name, now, actions, locale, coar
253
276
  <Checks key={`checks:${snapshot.headSha}`} frame={frame} snapshot={snapshot} actions={actions} t={t} />
254
277
  <Reviewers key={`reviewers:${snapshot.headSha}`} frame={frame} snapshot={snapshot} actions={actions}
255
278
  coarsePointer={coarsePointer} t={t} />
256
- <div className={css.statusCard} data-forge-review-changes="">
257
- <div className={css.statusRows}>
258
- {changes}
259
- <IssuesRow snapshot={snapshot} openLink={actions.openLink} t={t} />
279
+ {(lines || snapshot.closingIssues.length > 0) && (
280
+ <div className={css.statusCard} data-forge-review-changes="">
281
+ <div className={css.statusRows}>
282
+ {changes}
283
+ <IssuesRow snapshot={snapshot} openLink={actions.openLink} t={t} />
284
+ </div>
260
285
  </div>
261
- </div>
286
+ )}
262
287
  </>
263
288
  )
264
289
  }
@@ -6,27 +6,31 @@
6
6
  import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives/client'
7
7
  import type { ForgeAnchor, ForgeReviewThread } from '@deepseek-ai/dsh-experimental-forge/types'
8
8
  import { assertNever } from '@deepseek-ai/dsh-util-values'
9
- import type { ForgeCommitRange, ForgeDiffFile, ForgeDiffHunk } from '../types.ts'
9
+ import type { ForgeChangeCommits, ForgeDiffFile, ForgeDiffHunk } from '../types.ts'
10
10
  import { hunkRows } from './diff-rows.ts'
11
11
 
12
12
  /** The changes a view shows, which decides where a thread can sit. */
13
13
  export interface ThreadView {
14
14
  /** Head commit the threads were read at. */
15
15
  readonly head: string
16
- /** Commit the shown changes end at: the head, or the last chosen commit. */
16
+ /** Commit the shown changes end at: the head, the last chosen commit, or the commit the changes go up to. */
17
17
  readonly end: string
18
- /** Chosen consecutive commits, or null for the whole change request. */
19
- readonly commits: ForgeCommitRange | null
18
+ /** Chosen consecutive commits, the commit the changes go up to, or null for the whole change request. */
19
+ readonly commits: ForgeChangeCommits | null
20
+ /** Commits threads were written on that the code host answered it does not have. */
21
+ readonly gone: ReadonlySet<string>
20
22
  }
21
23
 
22
24
  /**
23
25
  * Where a thread shows in the changes view: on lines of one side, at the top of its file, in its file's outdated
24
- * section, or nowhere in the file because the chosen commits do not hold the lines it is on.
26
+ * section, or nowhere in the file because the chosen commits do not hold the lines it is on. An outdated thread is
27
+ * `lost` when no view can show the lines it was written on: the code host recorded no commit for it, or no longer
28
+ * has that commit.
25
29
  */
26
30
  export type ThreadPlace =
27
31
  | { readonly kind: 'line'; readonly side: 'L' | 'R'; readonly startLine: number; readonly endLine: number }
28
32
  | { readonly kind: 'file' }
29
- | { readonly kind: 'outdated' }
33
+ | { readonly kind: 'outdated'; readonly lost: boolean }
30
34
  | { readonly kind: 'elsewhere' }
31
35
 
32
36
  /** One filter of the thread list: the threads by whether they are resolved. */
@@ -38,18 +42,26 @@ export const THREAD_FILTERS: readonly ThreadFilter[] = ['unresolved', 'resolved'
38
42
  /**
39
43
  * Place a thread in a view. The whole change request shows a thread at its position on the head. Chosen commits show
40
44
  * only a new-side thread whose lines number the file at the last chosen commit: its position on the head when the
41
- * commits end at the head, else the lines it was written on at that commit. The old side of chosen commits starts
42
- * at the parent of the first commit, which no thread position numbers.
45
+ * commits end at the head, else the lines it was written on at that commit. The old side of consecutive commits starts
46
+ * at the parent of the first commit, which no thread position numbers. Changes up to a commit start at the change
47
+ * request's base, which the old-side lines of a thread written on that commit number, so they show its old-side
48
+ * threads too.
43
49
  * @param thread - the thread.
44
50
  * @param view - the shown changes.
45
51
  * @returns where the thread shows.
46
52
  */
47
53
  export function placeThread(thread: ForgeReviewThread, view: ThreadView): ThreadPlace {
48
54
  if (thread.subject === 'file') return { kind: 'file' }
49
- if (view.commits === null) return thread.current === null ? { kind: 'outdated' } : onLines(thread.side, thread.current)
55
+ if (view.commits === null) return thread.current === null ? outdated(thread, view) : onLines(thread.side, thread.current)
50
56
  if (thread.side === 'R' && thread.current !== null && view.end === view.head) return onLines('R', thread.current)
51
- if (thread.side === 'R' && thread.original !== null && thread.original.commit === view.end) return onLines('R', thread.original)
52
- return thread.current === null ? { kind: 'outdated' } : { kind: 'elsewhere' }
57
+ if ((thread.side === 'R' || 'upTo' in view.commits) && thread.original !== null && thread.original.commit === view.end) {
58
+ return onLines(thread.side, thread.original)
59
+ }
60
+ return thread.current === null ? outdated(thread, view) : { kind: 'elsewhere' }
61
+ }
62
+
63
+ function outdated(thread: ForgeReviewThread, view: ThreadView): ThreadPlace {
64
+ return { kind: 'outdated', lost: thread.original === null || view.gone.has(thread.original.commit) }
53
65
  }
54
66
 
55
67
  function onLines(side: 'L' | 'R', anchor: ForgeAnchor): ThreadPlace {
@@ -128,15 +128,6 @@ export type ChangesPanelState = Pick<ForgePanelState, 'checkout' | 'repository'
128
128
  readonly changeRequests: readonly ChangeRequestEntry[]
129
129
  }
130
130
 
131
- /**
132
- * Whether a change request needs the user, the condition its card draws as `blocked`.
133
- * @param entry - bound change request.
134
- * @returns whether the header marks it.
135
- */
136
- export function needsAttention(entry: ForgePanelChangeRequest): boolean {
137
- return toneOf(entry.snapshot) === 'blocked'
138
- }
139
-
140
131
  /**
141
132
  * Pick the cards a Session's panel opens before the user expands or collapses
142
133
  * one: the card of the only bound change request, whatever its state; none
@@ -3,7 +3,7 @@
3
3
  import { useEffect, useMemo, useRef, useState } from 'react'
4
4
  import type { ForgeReviewData, ForgeReviewThread } from '@deepseek-ai/dsh-experimental-forge/types'
5
5
  import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
6
- import type { LineThread } from './ReviewThreads.tsx'
6
+ import type { LineThread, OutdatedThread } from './ReviewThreads.tsx'
7
7
  import { placeThread, type ThreadPlace, type ThreadView } from './review-threads.ts'
8
8
 
9
9
  /** What the changes view knows about its change request when it reads threads. */
@@ -70,7 +70,7 @@ export function useThreadRead(input: ThreadReadInput): ThreadReadState {
70
70
  export interface PlacedFileThreads {
71
71
  readonly lines: readonly LineThread[]
72
72
  readonly file: readonly ForgeReviewThread[]
73
- readonly outdated: readonly ForgeReviewThread[]
73
+ readonly outdated: readonly OutdatedThread[]
74
74
  readonly unresolved: number
75
75
  }
76
76
 
@@ -101,13 +101,14 @@ const NONE: PlacedThreads = { entries: [], files: new Map(), unresolved: new Map
101
101
  export function usePlacedThreads(review: ForgeReviewData | null, view: ThreadView | null): PlacedThreads {
102
102
  const commits = view?.commits ?? null
103
103
  const end = view?.end ?? null
104
+ const gone = view?.gone ?? null
104
105
  return useMemo(() => {
105
- if (review === null || end === null) return NONE
106
+ if (review === null || end === null || gone === null) return NONE
106
107
  const entries: PlacedThread[] = []
107
- const files = new Map<string, { lines: LineThread[]; file: ForgeReviewThread[]; outdated: ForgeReviewThread[]; unresolved: number }>()
108
+ const files = new Map<string, { lines: LineThread[]; file: ForgeReviewThread[]; outdated: OutdatedThread[]; unresolved: number }>()
108
109
  const unresolved = new Map<string, number>()
109
110
  for (const thread of review.threads) {
110
- const place = placeThread(thread, { head: review.headSha, end, commits })
111
+ const place = placeThread(thread, { head: review.headSha, end, commits, gone })
111
112
  entries.push({ thread, place })
112
113
  let group = files.get(thread.path)
113
114
  if (group === undefined) {
@@ -116,12 +117,12 @@ export function usePlacedThreads(review: ForgeReviewData | null, view: ThreadVie
116
117
  }
117
118
  if (place.kind === 'line') group.lines.push({ thread, place })
118
119
  else if (place.kind === 'file') group.file.push(thread)
119
- else if (place.kind === 'outdated') group.outdated.push(thread)
120
+ else if (place.kind === 'outdated') group.outdated.push({ thread, place })
120
121
  if (!thread.resolved) {
121
122
  group.unresolved += 1
122
123
  unresolved.set(thread.path, group.unresolved)
123
124
  }
124
125
  }
125
126
  return { entries, files, unresolved }
126
- }, [review, end, commits])
127
+ }, [review, end, commits, gone])
127
128
  }
@@ -1,7 +1,12 @@
1
- /** Width-driven folding of the changes toolbar into its More menu. */
1
+ /**
2
+ * Width-driven folding of the two rows above the changed files: the toolbar's controls into its More menu, and the
3
+ * header's controls into their compact forms.
4
+ */
2
5
 
3
- /** Fold levels, from none to the deepest: level 1 folds the line totals, expansion, side by side, and wrapping; level 2
4
- * the test switch, with the progress label shortened to the bare count beside its ring; level 3 refresh. */
6
+ /** Fold levels, from none to the deepest. In the toolbar, level 1 folds the line totals, expansion, side by side, and
7
+ * wrapping; level 2 the test switch, with the progress label shortened to the bare count beside its ring; level 3
8
+ * refresh. In the header, level 1 draws the labelled buttons as icons; level 2 hides the arrow between the branches;
9
+ * level 3 hides the commit picker while it shows every commit. */
5
10
  export const DEEPEST_FOLD = 3
6
11
 
7
12
  /**
@@ -34,27 +39,48 @@ function demand(row: HTMLElement, gap: number): number {
34
39
  return width + Math.max(0, items - 1) * gap
35
40
  }
36
41
 
42
+ /** Whether the toolbar row's items fit on one line at the level it shows. */
43
+ function toolbarFits(row: HTMLElement): boolean {
44
+ const style = getComputedStyle(row)
45
+ const available = row.getBoundingClientRect().width - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight)
46
+ return demand(row, parseFloat(style.columnGap)) <= available
47
+ }
48
+
49
+ /** Width in pixels a name marked `data-fold-floor` keeps before the header folds a control: about thirteen characters. */
50
+ const NAME_FLOOR = 96
51
+
37
52
  /**
38
- * Keep a toolbar row on one line by setting `data-fold` to the shallowest level whose items fit, measuring each level's
39
- * demand synchronously; the row's styles hide each level's items and show the More button. Content, size, and font
40
- * changes measure again.
41
- * @param row - the toolbar row; its children are the items, and the one with `data-fold-spacer` takes the slack.
53
+ * Whether the header row fits at the level it shows: nothing reaches past its edge, and every name marked
54
+ * `data-fold-floor` shows whole or at least {@link NAME_FLOOR} wide. The names shorten to make room, so the row's
55
+ * items always add up to its width and the names' own widths tell a crowded row.
56
+ */
57
+ function headerFits(row: HTMLElement): boolean {
58
+ if (row.scrollWidth > row.clientWidth) return false
59
+ for (const name of row.querySelectorAll<HTMLElement>('[data-fold-floor]')) {
60
+ if (name.clientWidth < Math.min(name.scrollWidth, NAME_FLOOR)) return false
61
+ }
62
+ return true
63
+ }
64
+
65
+ /**
66
+ * Keep a row on one line by setting an attribute to the shallowest level that fits, laying out each level
67
+ * synchronously; the row's styles draw each level. Content, size, and font changes measure again.
68
+ * @param row - the row; its children are observed for size changes.
69
+ * @param attribute - the attribute that names the level.
70
+ * @param fits - whether the row fits at the level the attribute names.
42
71
  * @returns Disconnect the observers and the font listener.
43
72
  */
44
- export function observeToolbarFold(row: HTMLElement): () => void {
73
+ function observeFold(row: HTMLElement, attribute: string, fits: (row: HTMLElement) => boolean): () => void {
45
74
  const resize = new ResizeObserver(() => { measure() })
46
75
  const measure = (): void => {
47
76
  // Items React adds after the first measure are observed too; observing an observed element again does nothing.
48
77
  for (const child of row.children) resize.observe(child)
49
- const style = getComputedStyle(row)
50
- const available = row.getBoundingClientRect().width - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight)
51
- const gap = parseFloat(style.columnGap)
52
78
  let level = 0
53
79
  for (; level < DEEPEST_FOLD; level += 1) {
54
- row.setAttribute('data-fold', String(level))
55
- if (demand(row, gap) <= available) break
80
+ row.setAttribute(attribute, String(level))
81
+ if (fits(row)) break
56
82
  }
57
- row.setAttribute('data-fold', String(level))
83
+ row.setAttribute(attribute, String(level))
58
84
  }
59
85
  resize.observe(row)
60
86
  const mutation = new MutationObserver(measure)
@@ -68,3 +94,22 @@ export function observeToolbarFold(row: HTMLElement): () => void {
68
94
  fonts.removeEventListener('loadingdone', measure)
69
95
  }
70
96
  }
97
+
98
+ /**
99
+ * Keep the toolbar row on one line by its `data-fold`: its styles hide each level's items and show the More button.
100
+ * @param row - the toolbar row; its children are the items, and the one with `data-fold-spacer` takes the slack.
101
+ * @returns Disconnect the observers and the font listener.
102
+ */
103
+ export function observeToolbarFold(row: HTMLElement): () => void {
104
+ return observeFold(row, 'data-fold', toolbarFits)
105
+ }
106
+
107
+ /**
108
+ * Keep the header row on one line by its `data-header-fold`: the names in it shorten first, down to the floor, and
109
+ * then its styles draw each level's compact forms.
110
+ * @param row - the header row; the texts with `data-fold-floor` are the names that shorten.
111
+ * @returns Disconnect the observers and the font listener.
112
+ */
113
+ export function observeHeaderFold(row: HTMLElement): () => void {
114
+ return observeFold(row, 'data-header-fold', headerFits)
115
+ }
package/src/index.ts CHANGED
@@ -15,7 +15,7 @@ import type {
15
15
  } from '@deepseek-ai/dsh-experimental-forge'
16
16
  import type { SessionChangeRequest } from '@deepseek-ai/dsh-experimental-forge-session'
17
17
  import type { WorktreeCleanup } from '@deepseek-ai/dsh-experimental-worktree/types'
18
- import { appendPluginRecord } from '@deepseek-ai/dsh-session'
18
+ import { appendPluginRecord } from '@deepseek-ai/dsh-session-store'
19
19
  import type { Session, SessionEvent, SessionId, UserMessage } from '@deepseek-ai/dsh-session'
20
20
  import type { ProjectionHandle } from '@deepseek-ai/dsh-session-projection'
21
21
  import type {} from '@deepseek-ai/dsh-session-projection-cache'
@@ -46,7 +46,7 @@ import { ChangeRequestStates, changeRequestStatesDomain } from './states.ts'
46
46
  import { Reader, ViewerLists } from './viewer-lists.ts'
47
47
  import type { KeptPanel, PanelConfig } from './panel.ts'
48
48
  import type {
49
- Config, ForgeBaseBranches, ForgeChangeRequestDiff, ForgeChangeRequestStatesFrame, ForgeCommitRange, ForgeDiffFile,
49
+ Config, ForgeBaseBranches, ForgeChangeCommits, ForgeChangeRequestDiff, ForgeChangeRequestStatesFrame, ForgeCommitRange, ForgeDiffFile,
50
50
  ForgeReviewChangeRequest, ForgeReviewCountFrame, ForgeReviewFrame, ForgeReviewRepository,
51
51
  ForgeExtensionState, ForgeLens, ForgeLensFrame, ForgeLensRequest, ForgeLocalCommits, ForgeLocalDiff, ForgeLocalScope,
52
52
  ForgeLocalWrite, ForgeLocalWriteResult,
@@ -531,16 +531,16 @@ export class ForgePanelController extends TypertRemoteService {
531
531
  }
532
532
 
533
533
  /**
534
- * Read the changes of a change request the review page shows, or of consecutive commits of it.
534
+ * Read the changes of a change request the review page shows, of consecutive commits of it, or of it up to one commit.
535
535
  * @param url - web URL of the change request.
536
- * @param commits - consecutive commits of the change request, or null for all of it.
536
+ * @param commits - consecutive commits of the change request, the commit its changes go up to, or null for all of it.
537
537
  * @param signal - request cancellation.
538
538
  * @returns the files and the commit they end at, without a local checkout count.
539
539
  * @throws as {@link ForgePanelController.changeRequestDiff} does, with `forgePanel/unrecognized-url` in place of
540
540
  * `forgePanel/not-bound`.
541
541
  */
542
542
  @Remote
543
- async reviewDiff(url: string, commits: ForgeCommitRange | null, signal: AbortSignal): Promise<ForgeChangeRequestDiff> {
543
+ async reviewDiff(url: string, commits: ForgeChangeCommits | null, signal: AbortSignal): Promise<ForgeChangeRequestDiff> {
544
544
  signal.throwIfAborted()
545
545
  return await this.readDiff(this.served(url), commits, signal, async () => await Promise.resolve(null))
546
546
  }
@@ -992,24 +992,29 @@ export class ForgePanelController extends TypertRemoteService {
992
992
  * of the commit the diff ends at. Without `commits` the diff covers the change
993
993
  * request at the head commit of its latest status; a patch already read at the
994
994
  * same head commit and base branch is reused from memory with its attributes, for
995
- * any Session, until `maxCachedDiffBytes` evicts it. With `commits`, it covers those
996
- * commits, from the first one's first parent to the last, and is read every time.
995
+ * any Session, until `maxCachedDiffBytes` evicts it. With consecutive `commits`, it covers those
996
+ * commits, from the first one's first parent to the last; with `commits` up to one commit, it covers
997
+ * the change request as that commit ended it, from the merge base of the status's base commit with
998
+ * that commit, which the host reads by name whether or not the change request still lists it. Either
999
+ * is read every time.
997
1000
  * @param session - Session the change request is bound to.
998
1001
  * @param url - binding URL of the change request.
999
- * @param commits - consecutive commits of the change request, or null for all of it.
1002
+ * @param commits - consecutive commits of the change request, the commit its changes go up to, or null for all of it.
1000
1003
  * @param signal - request cancellation.
1001
1004
  * @returns the files, the commit they end at, each file's web page, and the commits the checkout has beyond the head.
1002
1005
  * @throws `forgePanel/not-bound` unless the URL is a visible binding of the Session that a provider serves;
1003
- * `forgePanel/commits-missing` when chosen commits are not among the change request's commits in order;
1006
+ * `forgePanel/commits-missing` when chosen commits are not among the change request's commits in order, and for a
1007
+ * commit to go up to that is not a full object name or that the host does not have;
1004
1008
  * `forgePanel/commits-not-linear` when a chosen commit's first parent is not the commit listed before it;
1005
1009
  * `forgePanel/stale-head` without `commits` when the head moved past the latest status, which is then polled again;
1006
1010
  * `forgePanel/diff-too-large` when the host or its provider refuses the diff over a size limit;
1007
- * `forgePanel/diff-failed` before its status was read, for a first chosen commit without a parent, and when the host
1008
- * does not provide the commits, the diff, or an existing `.gitattributes` otherwise.
1011
+ * `forgePanel/diff-failed` before its status was read, for a first chosen commit without a parent, for changes up
1012
+ * to a commit while the status names no base commit, and when the host does not provide the commits, the merge
1013
+ * base, the diff, or an existing `.gitattributes` otherwise.
1009
1014
  */
1010
1015
  @Remote
1011
1016
  async changeRequestDiff(
1012
- session: Session, url: string, commits: ForgeCommitRange | null, signal: AbortSignal,
1017
+ session: Session, url: string, commits: ForgeChangeCommits | null, signal: AbortSignal,
1013
1018
  ): Promise<ForgeChangeRequestDiff> {
1014
1019
  signal.throwIfAborted()
1015
1020
  return await this.readDiff(this.bound(session, url), commits, signal, async (headBranch, headSha) => {
@@ -1557,6 +1562,35 @@ export class ForgePanelController extends TypertRemoteService {
1557
1562
  return { files: this.layers.classify(parseDiff(patch), attributes), parent }
1558
1563
  }
1559
1564
 
1565
+ /**
1566
+ * The files of a change request up to a commit, from the merge base of the status's base commit with it, which is
1567
+ * returned too. The provider reads that commit by name, so it may have left the change request's listed commits; a
1568
+ * commit the host does not have is refused as `forgePanel/commits-missing`.
1569
+ */
1570
+ private async filesUpTo(
1571
+ ref: ChangeRequestRef, snapshot: ChangeRequestSnapshot, commit: string, signal: AbortSignal,
1572
+ ): Promise<{ readonly files: ForgeDiffFile[]; readonly parent: string }> {
1573
+ if (!isCommit(commit)) throw new RemoteError('forgePanel/commits-missing', 'The chosen commit is not a full object name', {})
1574
+ if (snapshot.baseSha === undefined) {
1575
+ throw new RemoteError('forgePanel/diff-failed', 'The code host provider reports no base commit to compare from', {})
1576
+ }
1577
+ const base = await this.home.forge.mergeBase(ref, snapshot.baseSha, commit, signal)
1578
+ if (typeof base !== 'string') throw upToError(base)
1579
+ const { patch, attributes } = await this.patchAt(ref, commit, async (operation) => {
1580
+ const compared = await this.home.forge.compare(ref, base, commit, operation)
1581
+ if (typeof compared !== 'string') throw upToError(compared)
1582
+ return compared
1583
+ }, signal)
1584
+ return { files: this.layers.classify(parseDiff(patch), attributes), parent: base }
1585
+ }
1586
+
1587
+ /** The files of chosen commits of a change request with the commit their old side shows. */
1588
+ private async chosenFiles(
1589
+ ref: ChangeRequestRef, snapshot: ChangeRequestSnapshot, commits: ForgeChangeCommits, signal: AbortSignal,
1590
+ ): Promise<{ readonly files: ForgeDiffFile[]; readonly parent: string }> {
1591
+ return 'upTo' in commits ? await this.filesUpTo(ref, snapshot, commits.upTo, signal) : await this.commitFiles(ref, commits, signal)
1592
+ }
1593
+
1560
1594
  /**
1561
1595
  * Read a patch that ends at `commit` together with the root `.gitattributes` at that commit. A failed patch read
1562
1596
  * cancels the attributes read. Both reads end before the result: the patch's failure passes on first, and the
@@ -1643,9 +1677,9 @@ export class ForgePanelController extends TypertRemoteService {
1643
1677
  return result
1644
1678
  }
1645
1679
 
1646
- /** Read the changes of a change request at the head of its latest status, or of chosen commits; `ahead` counts local commits. */
1680
+ /** Read the changes of a change request at the head of its latest status, or of its chosen commits; `ahead` counts local commits. */
1647
1681
  private async readDiff(
1648
- target: ChangeRequestTarget, commits: ForgeCommitRange | null, signal: AbortSignal,
1682
+ target: ChangeRequestTarget, commits: ForgeChangeCommits | null, signal: AbortSignal,
1649
1683
  ahead: (headBranch: string, headSha: string) => Promise<number | null>,
1650
1684
  ): Promise<ForgeChangeRequestDiff> {
1651
1685
  const { ref, update } = target
@@ -1653,9 +1687,10 @@ export class ForgePanelController extends TypertRemoteService {
1653
1687
  throw new RemoteError('forgePanel/diff-failed', 'The change request status has not been read yet', {})
1654
1688
  }
1655
1689
  if (commits !== null) {
1656
- const { files } = await this.commitFiles(ref, commits, signal)
1657
- const fileUrls = Object.fromEntries(files.map(file => [file.path, this.home.forge.fileUrl(ref, commits.to, file.path)]))
1658
- return { headSha: commits.to, files, localAhead: null, fileUrls }
1690
+ const { files } = await this.chosenFiles(ref, update.snapshot, commits, signal)
1691
+ const end = lastOf(commits)
1692
+ const fileUrls = Object.fromEntries(files.map(file => [file.path, this.home.forge.fileUrl(ref, end, file.path)]))
1693
+ return { headSha: end, files, localAhead: null, fileUrls }
1659
1694
  }
1660
1695
  const { headSha, headBranch } = update.snapshot
1661
1696
  const files = await this.headFiles(ref, update.snapshot, signal)
@@ -1925,6 +1960,9 @@ export class ForgePanelController extends TypertRemoteService {
1925
1960
  let files: ForgeDiffFile[]
1926
1961
  let newCommit: string
1927
1962
  let oldCommit: (inner: AbortSignal) => Promise<string>
1963
+ // A lens sees changes up to a commit as the whole change request with that commit as its head.
1964
+ let shownHead = snapshot.headSha
1965
+ let shownRange: ForgeCommitRange | null = null
1928
1966
  if (commits === null) {
1929
1967
  files = await this.headFiles(ref, snapshot, signal)
1930
1968
  newCommit = snapshot.headSha
@@ -1940,14 +1978,16 @@ export class ForgePanelController extends TypertRemoteService {
1940
1978
  }
1941
1979
  }
1942
1980
  } else {
1943
- const read = await this.commitFiles(ref, commits, signal)
1981
+ const read = await this.chosenFiles(ref, snapshot, commits, signal)
1944
1982
  files = read.files
1945
- newCommit = commits.to
1983
+ newCommit = lastOf(commits)
1946
1984
  oldCommit = () => Promise.resolve(read.parent)
1985
+ if ('upTo' in commits) shownHead = commits.upTo
1986
+ else shownRange = commits
1947
1987
  }
1948
1988
  return {
1949
1989
  key: JSON.stringify(['change', changeRequestKey(ref), newCommit, commits]),
1950
- source: { kind: 'change', ref, headSha: snapshot.headSha, commits },
1990
+ source: { kind: 'change', ref, headSha: shownHead, commits: shownRange },
1951
1991
  files,
1952
1992
  read: async (side, file, inner) => {
1953
1993
  if (file.binary || (side === 'old' ? file.status === 'added' : file.status === 'deleted')) return null
@@ -1988,6 +2028,15 @@ export class ForgePanelController extends TypertRemoteService {
1988
2028
  }
1989
2029
  }
1990
2030
 
2031
+ /**
2032
+ * Name the commit that chosen commits of a change request end at.
2033
+ * @param commits - the chosen commits.
2034
+ * @returns the last commit's object name.
2035
+ */
2036
+ function lastOf(commits: ForgeChangeCommits): string {
2037
+ return 'upTo' in commits ? commits.upTo : commits.to
2038
+ }
2039
+
1991
2040
  /**
1992
2041
  * Whether a value names a full commit object name.
1993
2042
  * @param value - the value from the browser.
@@ -2046,6 +2095,15 @@ function readError(failure: ForgeFailure): RemoteError {
2046
2095
  }
2047
2096
  }
2048
2097
 
2098
+ /**
2099
+ * Report why the code host did not provide the merge base or the diff of the changes up to a commit.
2100
+ * @param failure - the provider's failure.
2101
+ * @returns `forgePanel/commits-missing` when the host does not have the commit, else what {@link readError} reports.
2102
+ */
2103
+ function upToError(failure: ForgeFailure): RemoteError {
2104
+ return failure.code === 'not-found' ? new RemoteError('forgePanel/commits-missing', failure.message, {}) : readError(failure)
2105
+ }
2106
+
2049
2107
  /**
2050
2108
  * Report why the code host did not provide review threads.
2051
2109
  * @param failure - the provider's failure.
package/src/panel.ts CHANGED
@@ -6,7 +6,7 @@ import type { ChangeRequestRef, ChangeRequestSnapshot, ForgeReadiness, ForgeRepo
6
6
  import type { SessionChangeRequest } from '@deepseek-ai/dsh-experimental-forge-session'
7
7
  import type {} from '@deepseek-ai/dsh-experimental-worktree'
8
8
  import type {} from '@deepseek-ai/dsh-sandbox-policy'
9
- import { pluginRecordOf } from '@deepseek-ai/dsh-session'
9
+ import { pluginRecordOf } from '@deepseek-ai/dsh-session-store'
10
10
  import type { Session, SessionEvent } from '@deepseek-ai/dsh-session'
11
11
  import type { ProjectionHandle } from '@deepseek-ai/dsh-session-projection'
12
12
  import { deadline } from '@deepseek-ai/dsh-timeout'