@deepseek-ai/dsh-experimental-client-ui-forge 0.2.3-alpha.2 → 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.
- package/README.i18n.yaml +10 -10
- package/README.md +37 -19
- package/README.zh.md +37 -19
- package/lib/client.js +22 -17
- package/lib/client.js.map +1 -1
- package/lib/index.js +941 -188
- package/lib/typert.host.js +894 -175
- package/lib/typert.remote-client.d.ts +35 -17
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +751 -146
- package/lib/types/client/ActionToast.d.ts +1 -1
- package/lib/types/client/ActionToast.d.ts.map +1 -1
- package/lib/types/client/ActionToast.js.map +1 -1
- package/lib/types/client/BaseMenu.d.ts +6 -4
- package/lib/types/client/BaseMenu.d.ts.map +1 -1
- package/lib/types/client/BaseMenu.js.map +1 -1
- package/lib/types/client/BranchPicker.d.ts +84 -0
- package/lib/types/client/BranchPicker.d.ts.map +1 -0
- package/lib/types/client/BranchPicker.js.map +1 -0
- package/lib/types/client/ChangeRequestCard.d.ts +31 -13
- package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestCard.js.map +1 -1
- package/lib/types/client/ChangeRequestOverview.d.ts +28 -6
- package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestOverview.js.map +1 -1
- package/lib/types/client/ChangeRequestsSection.d.ts +5 -3
- package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestsSection.js.map +1 -1
- package/lib/types/client/ChangeStatus.d.ts +41 -0
- package/lib/types/client/ChangeStatus.d.ts.map +1 -0
- package/lib/types/client/ChangeStatus.js.map +1 -0
- package/lib/types/client/ChangedFiles.d.ts +1 -1
- package/lib/types/client/ChangedFiles.d.ts.map +1 -1
- package/lib/types/client/ChangedFiles.js.map +1 -1
- package/lib/types/client/ChangesLoading.d.ts +1 -1
- package/lib/types/client/ChangesLoading.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.d.ts +35 -12
- package/lib/types/client/ChangesTab.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.js.map +1 -1
- package/lib/types/client/ChangesTabTitle.d.ts +1 -1
- package/lib/types/client/ChangesTabTitle.d.ts.map +1 -1
- package/lib/types/client/ChangesTabTitle.js.map +1 -1
- package/lib/types/client/CommitMenu.d.ts +11 -8
- package/lib/types/client/CommitMenu.d.ts.map +1 -1
- package/lib/types/client/CommitMenu.js.map +1 -1
- package/lib/types/client/CopyCommandButton.d.ts +19 -0
- package/lib/types/client/CopyCommandButton.d.ts.map +1 -0
- package/lib/types/client/CopyCommandButton.js.map +1 -0
- package/lib/types/client/DiffFile.d.ts +36 -5
- package/lib/types/client/DiffFile.d.ts.map +1 -1
- package/lib/types/client/DiffFile.js.map +1 -1
- package/lib/types/client/EnvironmentRows.d.ts +6 -6
- package/lib/types/client/EnvironmentRows.d.ts.map +1 -1
- package/lib/types/client/EnvironmentRows.js.map +1 -1
- package/lib/types/client/FileLabel.d.ts +5 -5
- package/lib/types/client/FileLabel.d.ts.map +1 -1
- package/lib/types/client/FileLabel.js.map +1 -1
- package/lib/types/client/HeadMenu.d.ts +35 -0
- package/lib/types/client/HeadMenu.d.ts.map +1 -0
- package/lib/types/client/HeadMenu.js.map +1 -0
- package/lib/types/client/HostSettings.d.ts +33 -0
- package/lib/types/client/HostSettings.d.ts.map +1 -0
- package/lib/types/client/HostSettings.js.map +1 -0
- package/lib/types/client/LensFilter.d.ts +2 -2
- package/lib/types/client/LensFilter.d.ts.map +1 -1
- package/lib/types/client/LensFilter.js.map +1 -1
- package/lib/types/client/ReasonButton.js.map +1 -1
- package/lib/types/client/RefreshGlyph.js.map +1 -1
- package/lib/types/client/ReviewComposer.d.ts +1 -1
- package/lib/types/client/ReviewComposer.d.ts.map +1 -1
- package/lib/types/client/ReviewComposer.js.map +1 -1
- package/lib/types/client/ReviewControls.d.ts +1 -1
- package/lib/types/client/ReviewControls.d.ts.map +1 -1
- package/lib/types/client/ReviewControls.js.map +1 -1
- package/lib/types/client/ReviewThread.d.ts +1 -1
- package/lib/types/client/ReviewThread.d.ts.map +1 -1
- package/lib/types/client/ReviewThread.js.map +1 -1
- package/lib/types/client/ReviewThreads.d.ts +21 -4
- package/lib/types/client/ReviewThreads.d.ts.map +1 -1
- package/lib/types/client/ReviewThreads.js.map +1 -1
- package/lib/types/client/SessionHoverForge.d.ts +1 -1
- package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
- package/lib/types/client/SessionHoverForge.js.map +1 -1
- package/lib/types/client/SessionRowForge.d.ts +1 -1
- package/lib/types/client/SessionRowForge.d.ts.map +1 -1
- package/lib/types/client/SessionRowForge.js.map +1 -1
- package/lib/types/client/SubmitReview.d.ts +1 -1
- package/lib/types/client/SubmitReview.d.ts.map +1 -1
- package/lib/types/client/SubmitReview.js.map +1 -1
- package/lib/types/client/ThreadList.d.ts +3 -1
- package/lib/types/client/ThreadList.d.ts.map +1 -1
- package/lib/types/client/ThreadList.js.map +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
- package/lib/types/client/ViewOptionsMenu.js.map +1 -1
- package/lib/types/client/WorktreeNameDialog.d.ts +1 -1
- package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -1
- package/lib/types/client/WorktreeNameDialog.js.map +1 -1
- package/lib/types/client/WorktreeProgress.d.ts +1 -1
- package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
- package/lib/types/client/WorktreeProgress.js.map +1 -1
- package/lib/types/client/WorktreeSettings.d.ts +1 -1
- package/lib/types/client/WorktreeSettings.d.ts.map +1 -1
- package/lib/types/client/WorktreeSettings.js.map +1 -1
- package/lib/types/client/WorktreeToggle.d.ts +1 -1
- package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
- package/lib/types/client/WorktreeToggle.js.map +1 -1
- package/lib/types/client/annotations.d.ts +1 -1
- package/lib/types/client/annotations.d.ts.map +1 -1
- package/lib/types/client/branch-search.d.ts +1 -1
- package/lib/types/client/branch-search.d.ts.map +1 -1
- package/lib/types/client/branch-search.js.map +1 -1
- package/lib/types/client/changes-address.d.ts +1 -1
- package/lib/types/client/changes-address.d.ts.map +1 -1
- package/lib/types/client/changes-service.d.ts +1 -1
- package/lib/types/client/changes-service.d.ts.map +1 -1
- package/lib/types/client/changes-store.d.ts +25 -6
- package/lib/types/client/changes-store.d.ts.map +1 -1
- package/lib/types/client/changes-store.js.map +1 -1
- package/lib/types/client/checkout.d.ts +1 -1
- package/lib/types/client/checkout.d.ts.map +1 -1
- package/lib/types/client/code-selection.d.ts.map +1 -1
- package/lib/types/client/code-selection.js.map +1 -1
- package/lib/types/client/forge-copy.d.ts +8 -1
- package/lib/types/client/forge-copy.d.ts.map +1 -1
- package/lib/types/client/forge-copy.js.map +1 -1
- package/lib/types/client/format.d.ts +1 -1
- package/lib/types/client/format.d.ts.map +1 -1
- package/lib/types/client/format.js.map +1 -1
- package/lib/types/client/glyphs.d.ts +36 -1
- package/lib/types/client/glyphs.d.ts.map +1 -1
- package/lib/types/client/glyphs.js.map +1 -1
- package/lib/types/client/highlight-context.d.ts +1 -1
- package/lib/types/client/highlight-context.d.ts.map +1 -1
- package/lib/types/client/host-settings-form.d.ts +69 -0
- package/lib/types/client/host-settings-form.d.ts.map +1 -0
- package/lib/types/client/host-settings-form.js.map +1 -0
- package/lib/types/client/host-sign-in.d.ts +31 -0
- package/lib/types/client/host-sign-in.d.ts.map +1 -0
- package/lib/types/client/host-sign-in.js.map +1 -0
- package/lib/types/client/index.d.ts +1 -2
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/local-writes.d.ts +47 -0
- package/lib/types/client/local-writes.d.ts.map +1 -0
- package/lib/types/client/local-writes.js.map +1 -0
- package/lib/types/client/locales.d.ts +111 -13
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js.map +1 -1
- package/lib/types/client/minute-clock.d.ts +7 -0
- package/lib/types/client/minute-clock.d.ts.map +1 -0
- package/lib/types/client/minute-clock.js.map +1 -0
- package/lib/types/client/mount.d.ts +15 -1
- package/lib/types/client/mount.d.ts.map +1 -1
- package/lib/types/client/mount.js.map +1 -1
- package/lib/types/client/review-page/ReviewActivity.d.ts +44 -0
- package/lib/types/client/review-page/ReviewActivity.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewActivity.js.map +1 -0
- package/lib/types/client/review-page/ReviewChat.d.ts +1 -1
- package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewChat.js.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.d.ts +26 -9
- package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.js.map +1 -1
- package/lib/types/client/review-page/ReviewLabels.d.ts +1 -1
- package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewLabels.js.map +1 -1
- package/lib/types/client/review-page/ReviewList.d.ts +10 -8
- package/lib/types/client/review-page/ReviewList.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewList.js.map +1 -1
- package/lib/types/client/review-page/ReviewNav.d.ts +1 -1
- package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewPage.d.ts +17 -14
- package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewPage.js.map +1 -1
- package/lib/types/client/review-page/ReviewSkeleton.d.ts +26 -0
- package/lib/types/client/review-page/ReviewSkeleton.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewSkeleton.js.map +1 -0
- package/lib/types/client/review-page/ReviewStatus.d.ts +19 -13
- package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewStatus.js.map +1 -1
- package/lib/types/client/review-page/review-activity.d.ts +37 -0
- package/lib/types/client/review-page/review-activity.d.ts.map +1 -0
- package/lib/types/client/review-page/review-activity.js.map +1 -0
- package/lib/types/client/review-page/review-lists.d.ts +48 -13
- package/lib/types/client/review-page/review-lists.d.ts.map +1 -1
- package/lib/types/client/review-page/review-lists.js.map +1 -1
- package/lib/types/client/review-page/review-mount.d.ts +3 -1
- package/lib/types/client/review-page/review-mount.d.ts.map +1 -1
- package/lib/types/client/review-page/review-mount.js.map +1 -1
- package/lib/types/client/review-page/review-store.d.ts +19 -9
- package/lib/types/client/review-page/review-store.d.ts.map +1 -1
- package/lib/types/client/review-page/review-store.js.map +1 -1
- package/lib/types/client/review-queue.d.ts +1 -1
- package/lib/types/client/review-queue.d.ts.map +1 -1
- package/lib/types/client/review-queue.js.map +1 -1
- package/lib/types/client/review-threads.d.ts +15 -8
- package/lib/types/client/review-threads.d.ts.map +1 -1
- package/lib/types/client/review-threads.js.map +1 -1
- package/lib/types/client/review.d.ts +12 -1
- package/lib/types/client/review.d.ts.map +1 -1
- package/lib/types/client/review.js.map +1 -1
- package/lib/types/client/row-form-labels.d.ts +12 -0
- package/lib/types/client/row-form-labels.d.ts.map +1 -0
- package/lib/types/client/row-form-labels.js.map +1 -0
- package/lib/types/client/session-list.d.ts +1 -1
- package/lib/types/client/session-list.d.ts.map +1 -1
- package/lib/types/client/slots.d.ts +1 -1
- package/lib/types/client/slots.d.ts.map +1 -1
- package/lib/types/client/source.d.ts +1 -1
- package/lib/types/client/source.d.ts.map +1 -1
- package/lib/types/client/status.d.ts +7 -6
- package/lib/types/client/status.d.ts.map +1 -1
- package/lib/types/client/status.js.map +1 -1
- package/lib/types/client/thread-state.d.ts +2 -2
- package/lib/types/client/thread-state.d.ts.map +1 -1
- package/lib/types/client/thread-state.js.map +1 -1
- package/lib/types/client/toolbar-fold.d.ts +16 -6
- package/lib/types/client/toolbar-fold.d.ts.map +1 -1
- package/lib/types/client/toolbar-fold.js.map +1 -1
- package/lib/types/client/worktree-settings-form.d.ts +1 -1
- package/lib/types/client/worktree-settings-form.d.ts.map +1 -1
- package/lib/types/client/worktree-settings-form.js.map +1 -1
- package/lib/types/diff.d.ts.map +1 -1
- package/lib/types/diff.js.map +1 -1
- package/lib/types/git.d.ts +22 -0
- package/lib/types/git.d.ts.map +1 -1
- package/lib/types/git.js.map +1 -1
- package/lib/types/index.d.ts +137 -36
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/local-diff.d.ts +81 -23
- package/lib/types/local-diff.d.ts.map +1 -1
- package/lib/types/local-diff.js.map +1 -1
- package/lib/types/local-write.d.ts +44 -0
- package/lib/types/local-write.d.ts.map +1 -0
- package/lib/types/local-write.js.map +1 -0
- package/lib/types/panel.js.map +1 -1
- package/lib/types/parse.d.ts +12 -3
- package/lib/types/parse.d.ts.map +1 -1
- package/lib/types/parse.js.map +1 -1
- package/lib/types/restore.d.ts +12 -0
- package/lib/types/restore.d.ts.map +1 -0
- package/lib/types/restore.js.map +1 -0
- package/lib/types/types.d.ts +128 -13
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/viewer-lists.d.ts +22 -13
- package/lib/types/viewer-lists.d.ts.map +1 -1
- package/lib/types/viewer-lists.js.map +1 -1
- package/lib/types/worktree.js.map +1 -1
- package/package.json +62 -58
- package/src/client/ActionToast.tsx +2 -2
- package/src/client/BaseMenu.module.css +15 -3
- package/src/client/BaseMenu.tsx +25 -88
- package/src/client/BranchPicker.tsx +170 -0
- package/src/client/ChangeRequestCard.tsx +194 -70
- package/src/client/ChangeRequestOverview.tsx +194 -82
- package/src/client/ChangeRequestsSection.tsx +45 -14
- package/src/client/ChangeStatus.module.css +70 -0
- package/src/client/ChangeStatus.tsx +104 -0
- package/src/client/ChangedFiles.tsx +22 -9
- package/src/client/ChangesLoading.tsx +1 -1
- package/src/client/ChangesTab.module.css +181 -33
- package/src/client/ChangesTab.tsx +499 -183
- package/src/client/ChangesTabTitle.tsx +2 -2
- package/src/client/CommitMenu.tsx +83 -42
- package/src/client/CopyCommandButton.tsx +25 -0
- package/src/client/DiffFile.tsx +147 -29
- package/src/client/EnvironmentRows.tsx +34 -28
- package/src/client/FileLabel.module.css +16 -18
- package/src/client/FileLabel.tsx +16 -32
- package/src/client/Forge.module.css +26 -6
- package/src/client/HeadMenu.tsx +69 -0
- package/src/client/HostSettings.module.css +194 -0
- package/src/client/HostSettings.tsx +194 -0
- package/src/client/LensFilter.tsx +13 -11
- package/src/client/ReasonButton.tsx +1 -1
- package/src/client/RefreshGlyph.tsx +1 -1
- package/src/client/ReviewComposer.tsx +31 -19
- package/src/client/ReviewControls.tsx +18 -9
- package/src/client/ReviewThread.tsx +65 -23
- package/src/client/ReviewThreads.tsx +133 -38
- package/src/client/SessionHoverForge.tsx +2 -2
- package/src/client/SessionRowForge.tsx +2 -2
- package/src/client/SubmitReview.tsx +7 -5
- package/src/client/ThreadList.module.css +4 -3
- package/src/client/ThreadList.tsx +11 -8
- package/src/client/ViewOptionsMenu.tsx +12 -10
- package/src/client/WorktreeNameDialog.tsx +17 -13
- package/src/client/WorktreeProgress.tsx +13 -11
- package/src/client/WorktreeSettings.tsx +8 -14
- package/src/client/WorktreeToggle.tsx +67 -37
- package/src/client/annotations.ts +1 -1
- package/src/client/branch-search.tsx +2 -2
- package/src/client/changes-address.ts +1 -1
- package/src/client/changes-service.ts +1 -1
- package/src/client/changes-store.ts +57 -10
- package/src/client/checkout.ts +1 -1
- package/src/client/code-selection.ts +3 -1
- package/src/client/forge-copy.ts +11 -1
- package/src/client/format.ts +2 -2
- package/src/client/glyphs.tsx +72 -5
- package/src/client/highlight-context.ts +1 -1
- package/src/client/host-settings-form.ts +115 -0
- package/src/client/host-sign-in.ts +46 -0
- package/src/client/index.ts +1 -2
- package/src/client/local-writes.ts +129 -0
- package/src/client/locales.ts +881 -97
- package/src/client/minute-clock.ts +19 -0
- package/src/client/mount.ts +121 -57
- package/src/client/review-page/ReviewActivity.tsx +406 -0
- package/src/client/review-page/ReviewChat.tsx +48 -19
- package/src/client/review-page/ReviewDetail.tsx +246 -78
- package/src/client/review-page/ReviewLabels.tsx +2 -2
- package/src/client/review-page/ReviewList.tsx +173 -151
- package/src/client/review-page/ReviewNav.tsx +1 -1
- package/src/client/review-page/ReviewPage.module.css +571 -23
- package/src/client/review-page/ReviewPage.tsx +84 -53
- package/src/client/review-page/ReviewSkeleton.tsx +108 -0
- package/src/client/review-page/ReviewStatus.tsx +74 -44
- package/src/client/review-page/review-activity.ts +64 -0
- package/src/client/review-page/review-lists.ts +85 -22
- package/src/client/review-page/review-mount.ts +24 -7
- package/src/client/review-page/review-store.ts +24 -7
- package/src/client/review-queue.ts +7 -3
- package/src/client/review-threads.ts +24 -12
- package/src/client/review.ts +20 -2
- package/src/client/row-form-labels.ts +17 -0
- package/src/client/session-list.ts +1 -1
- package/src/client/slots.ts +1 -1
- package/src/client/source.ts +1 -1
- package/src/client/status.ts +20 -9
- package/src/client/thread-state.ts +8 -7
- package/src/client/toolbar-fold.ts +59 -14
- package/src/client/worktree-settings-form.ts +1 -1
- package/src/diff.ts +8 -5
- package/src/git.ts +31 -1
- package/src/index.ts +319 -70
- package/src/local-diff.ts +151 -48
- package/src/local-write.ts +159 -0
- package/src/panel.ts +1 -1
- package/src/parse.ts +26 -4
- package/src/restore.ts +15 -0
- package/src/types.ts +121 -17
- package/src/viewer-lists.ts +124 -48
- package/src/worktree.ts +1 -1
- package/lib/types/client/AttentionIndicator.d.ts +0 -22
- package/lib/types/client/AttentionIndicator.d.ts.map +0 -1
- package/lib/types/client/AttentionIndicator.js.map +0 -1
- package/src/client/AttentionIndicator.tsx +0 -37
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The summary tab's activity helpers: its rows, with every run of commits as one, and which comment texts start cut
|
|
3
|
+
* short.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ChangeRequestActivityItem } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
7
|
+
|
|
8
|
+
/** A commit of the activity. */
|
|
9
|
+
export type ActivityCommit = Extract<ChangeRequestActivityItem, { readonly kind: 'commit' }>
|
|
10
|
+
|
|
11
|
+
/** An activity item other than a commit. */
|
|
12
|
+
export type ActivityEvent = Exclude<ChangeRequestActivityItem, ActivityCommit>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* One row of the activity: an item other than a commit, or the commits that follow one another. `key` tells the rows of
|
|
16
|
+
* one activity apart and stays the same when a later read adds or drops other rows.
|
|
17
|
+
*/
|
|
18
|
+
export type ActivityEntry =
|
|
19
|
+
| { readonly kind: 'commits'; readonly key: string; readonly commits: readonly [ActivityCommit, ...ActivityCommit[]] }
|
|
20
|
+
| { readonly kind: 'item'; readonly key: string; readonly item: ActivityEvent }
|
|
21
|
+
|
|
22
|
+
/** Most characters of a comment text that shows whole from the start. */
|
|
23
|
+
const WHOLE_CHARACTERS = 400
|
|
24
|
+
|
|
25
|
+
/** Most lines of a comment text that shows whole from the start. */
|
|
26
|
+
const WHOLE_LINES = 6
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Lay the activity out as rows.
|
|
30
|
+
* @param items - the activity, oldest first.
|
|
31
|
+
* @returns the rows in the same order, with every run of consecutive commits as one row.
|
|
32
|
+
*/
|
|
33
|
+
export function activityEntries(items: readonly ChangeRequestActivityItem[]): readonly ActivityEntry[] {
|
|
34
|
+
const entries: ActivityEntry[] = []
|
|
35
|
+
const seen = new Map<string, number>()
|
|
36
|
+
// Two rows of one kind, time, and actor differ by their count.
|
|
37
|
+
const keyOf = (name: string): string => {
|
|
38
|
+
const count = seen.get(name) ?? 0
|
|
39
|
+
seen.set(name, count + 1)
|
|
40
|
+
return count === 0 ? name : `${name}#${count}`
|
|
41
|
+
}
|
|
42
|
+
let run: [ActivityCommit, ...ActivityCommit[]] | null = null
|
|
43
|
+
for (const item of items) {
|
|
44
|
+
if (item.kind !== 'commit') {
|
|
45
|
+
run = null
|
|
46
|
+
entries.push({ kind: 'item', key: keyOf(`${item.kind}:${item.at}:${item.actor?.login ?? ''}`), item })
|
|
47
|
+
} else if (run === null) {
|
|
48
|
+
run = [item]
|
|
49
|
+
entries.push({ kind: 'commits', key: keyOf(`commits:${item.sha}`), commits: run })
|
|
50
|
+
} else {
|
|
51
|
+
run.push(item)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return entries
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Whether a comment text starts cut short, with a control that shows the rest.
|
|
59
|
+
* @param body - Markdown source of the comment.
|
|
60
|
+
* @returns whether it is longer than the text that shows whole.
|
|
61
|
+
*/
|
|
62
|
+
export function longBody(body: string): boolean {
|
|
63
|
+
return body.length > WHOLE_CHARACTERS || body.split('\n').length > WHOLE_LINES
|
|
64
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What the review page's list column shows from the Host's list frames: one section per list with its items and the
|
|
3
|
-
* text they are searched by, the hint each item carries, the repositories the lists name, and the
|
|
3
|
+
* text they are searched by, the hint each item carries, the repositories the lists name by host, and the hosts whose
|
|
4
|
+
* read failed.
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import type { ChangeRequestSummary, ForgeFailure, ForgeViewerFilter } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
@@ -32,73 +33,130 @@ export interface ReviewSection {
|
|
|
32
33
|
readonly total: number
|
|
33
34
|
/** Whether some host listed fewer change requests than its total. */
|
|
34
35
|
readonly truncated: boolean
|
|
35
|
-
/**
|
|
36
|
-
readonly
|
|
36
|
+
/** Whether some host has neither read the list nor failed to, so its change requests are still to come. */
|
|
37
|
+
readonly pending: boolean
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
/** A repository the lists name. */
|
|
40
|
+
/** A repository the lists name, on the host that listed it. */
|
|
40
41
|
export interface ReviewRepository {
|
|
42
|
+
/** Host the repository was listed on. */
|
|
43
|
+
readonly host: string
|
|
41
44
|
/** Owner or namespace. */
|
|
42
45
|
readonly owner: string
|
|
43
46
|
/** Repository name. */
|
|
44
47
|
readonly name: string
|
|
45
48
|
}
|
|
46
49
|
|
|
50
|
+
/** What the reader narrowed the lists to: every repository of one host, or one repository. */
|
|
51
|
+
export type ReviewScope = { readonly host: string } | ReviewRepository
|
|
52
|
+
|
|
53
|
+
/** A host whose latest read of some list failed. */
|
|
54
|
+
export interface ReviewHostFailure {
|
|
55
|
+
/** Forge family of the provider that lists on the host. */
|
|
56
|
+
readonly forge: string
|
|
57
|
+
/** The host. */
|
|
58
|
+
readonly host: string
|
|
59
|
+
/** The first failure among the host's lists, in page order. */
|
|
60
|
+
readonly failure: ForgeFailure
|
|
61
|
+
/** The command that signs the provider's CLI in to the host, or null when the failure is another or the provider names none. */
|
|
62
|
+
readonly signIn: string | null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The repository a scope names.
|
|
67
|
+
* @param scope - the reader's scope, or null for every repository of every host.
|
|
68
|
+
* @returns the repository, or null for a scope that names a host only or none.
|
|
69
|
+
*/
|
|
70
|
+
export function scopeRepository(scope: ReviewScope | null): ReviewRepository | null {
|
|
71
|
+
return scope !== null && 'name' in scope ? scope : null
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Whether two scopes narrow the lists to the same host or repository.
|
|
76
|
+
* @param left - one scope, or null for none.
|
|
77
|
+
* @param right - the other scope, or null for none.
|
|
78
|
+
* @returns whether they are the same.
|
|
79
|
+
*/
|
|
80
|
+
export function sameScope(left: ReviewScope | null, right: ReviewScope | null): boolean {
|
|
81
|
+
if (left === null || right === null) return left === right
|
|
82
|
+
const one = scopeRepository(left)
|
|
83
|
+
const other = scopeRepository(right)
|
|
84
|
+
return left.host === right.host && one?.owner === other?.owner && one?.name === other?.name
|
|
85
|
+
}
|
|
86
|
+
|
|
47
87
|
/**
|
|
48
88
|
* Build the list sections from one frame.
|
|
49
89
|
* @param frame - the latest frame, or undefined before the first.
|
|
50
90
|
* @param directOnly - whether the review-requested list leaves out requests made only of one of the user's teams.
|
|
91
|
+
* @param host - the host the reader narrowed the lists to, or null for every host of the frame.
|
|
51
92
|
* @returns one section per list some host offers, in page order, each with every item most recently updated first.
|
|
52
93
|
*/
|
|
53
|
-
export function reviewSections(frame: ForgeReviewFrame | undefined, directOnly: boolean): readonly ReviewSection[] {
|
|
94
|
+
export function reviewSections(frame: ForgeReviewFrame | undefined, directOnly: boolean, host: string | null): readonly ReviewSection[] {
|
|
54
95
|
if (frame === undefined) return []
|
|
55
96
|
const sections: ReviewSection[] = []
|
|
56
97
|
for (const filter of REVIEW_FILTERS) {
|
|
57
|
-
const lists = frame.hosts.flatMap((
|
|
58
|
-
const list =
|
|
59
|
-
return list === undefined ? [] : [{ host, list }]
|
|
98
|
+
const lists = frame.hosts.flatMap((entry) => {
|
|
99
|
+
const list = entry.lists[filter]
|
|
100
|
+
return list === undefined || (host !== null && entry.host !== host) ? [] : [{ host: entry, list }]
|
|
60
101
|
})
|
|
61
102
|
if (lists.length === 0) continue
|
|
62
103
|
let items: ReviewItem[] | null = null
|
|
63
104
|
let total = 0
|
|
64
105
|
let truncated = false
|
|
65
|
-
let
|
|
66
|
-
for (const { host, list } of lists) {
|
|
67
|
-
if (list.
|
|
68
|
-
|
|
106
|
+
let pending = false
|
|
107
|
+
for (const { host: entry, list } of lists) {
|
|
108
|
+
if (list.items === null) {
|
|
109
|
+
pending ||= list.failure === null
|
|
110
|
+
continue
|
|
111
|
+
}
|
|
69
112
|
total += list.total
|
|
70
113
|
truncated ||= list.total > list.items.length
|
|
71
114
|
items ??= []
|
|
72
115
|
for (const summary of list.items) {
|
|
73
116
|
if (filter === 'review-requested' && directOnly && summary.viewerRequest !== null && summary.viewerRequest.team !== null) continue
|
|
74
|
-
items.push({ summary, forge:
|
|
117
|
+
items.push({ summary, forge: entry.forge, host: entry.host })
|
|
75
118
|
}
|
|
76
119
|
}
|
|
77
120
|
items?.sort((left, right) => Date.parse(right.summary.updatedAt) - Date.parse(left.summary.updatedAt))
|
|
78
|
-
sections.push({ filter, items, total, truncated,
|
|
121
|
+
sections.push({ filter, items, total, truncated, pending })
|
|
79
122
|
}
|
|
80
123
|
return sections
|
|
81
124
|
}
|
|
82
125
|
|
|
83
126
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
127
|
+
* List the hosts whose latest read of some list failed, so the page reports each once.
|
|
128
|
+
* @param frame - the latest frame, or undefined before the first.
|
|
129
|
+
* @param host - the host the reader narrowed the lists to, or null for every host of the frame.
|
|
130
|
+
* @returns the hosts in frame order, each with the first failure among its lists.
|
|
131
|
+
*/
|
|
132
|
+
export function reviewFailures(frame: ForgeReviewFrame | undefined, host: string | null): readonly ReviewHostFailure[] {
|
|
133
|
+
return (frame?.hosts ?? []).flatMap((entry) => {
|
|
134
|
+
if (host !== null && entry.host !== host) return []
|
|
135
|
+
const failure = REVIEW_FILTERS.map(filter => entry.lists[filter]?.failure ?? null).find(found => found !== null)
|
|
136
|
+
return failure === undefined ? [] : [{ forge: entry.forge, host: entry.host, failure, signIn: entry.signIn }]
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The text a listed change request is searched by under the client search rule: its title, number, repository, author,
|
|
142
|
+
* and host each match as a substring or a word-start fuzzy subsequence.
|
|
86
143
|
* @param item - the listed change request.
|
|
87
144
|
* @returns the search keys.
|
|
88
145
|
*/
|
|
89
146
|
export function reviewSearchKeys(item: ReviewItem): SearchKeys {
|
|
90
147
|
const { repository, number } = item.summary.ref
|
|
91
|
-
return { fuzzy: [item.summary.title, `#${number}`, `${repository.owner}/${repository.name}`, item.summary.author?.login] }
|
|
148
|
+
return { fuzzy: [item.summary.title, `#${number}`, `${repository.owner}/${repository.name}`, item.summary.author?.login, item.host] }
|
|
92
149
|
}
|
|
93
150
|
|
|
94
151
|
/**
|
|
95
|
-
* List the repositories the lists name, by owner then name.
|
|
152
|
+
* List the repositories the lists name, by host, then owner, then name.
|
|
96
153
|
* @param frame - the latest frame, or undefined before the first.
|
|
97
154
|
* @returns distinct repositories.
|
|
98
155
|
*/
|
|
99
156
|
export function reviewRepositories(frame: ForgeReviewFrame | undefined): readonly ReviewRepository[] {
|
|
100
157
|
return mergeRepositories((frame?.hosts ?? []).flatMap(host =>
|
|
101
|
-
Object.values(host.lists).flatMap(list => (list.items ?? []).map(
|
|
158
|
+
Object.values(host.lists).flatMap(list => (list.items ?? []).map(({ ref: { repository } }) =>
|
|
159
|
+
({ host: host.host, owner: repository.owner, name: repository.name })))))
|
|
102
160
|
}
|
|
103
161
|
|
|
104
162
|
/**
|
|
@@ -112,15 +170,20 @@ export function reviewListsComplete(frame: ForgeReviewFrame | undefined): boolea
|
|
|
112
170
|
&& frame.hosts.every(host => Object.values(host.lists).every(list => list.items !== null && list.failure === null))
|
|
113
171
|
}
|
|
114
172
|
|
|
173
|
+
/** A repository's place in the order {@link mergeRepositories} sorts by, which is also its identity. */
|
|
174
|
+
function repositoryKey({ host, owner, name }: ReviewRepository): string {
|
|
175
|
+
return `${host}\n${owner}/${name}`.toLowerCase()
|
|
176
|
+
}
|
|
177
|
+
|
|
115
178
|
/**
|
|
116
|
-
* Merge repositories into one list without duplicates, by owner then name.
|
|
179
|
+
* Merge repositories into one list without duplicates, by host, then owner, then name.
|
|
117
180
|
* @param groups - lists of repositories.
|
|
118
181
|
* @returns the distinct repositories, sorted as {@link reviewRepositories} sorts.
|
|
119
182
|
*/
|
|
120
183
|
export function mergeRepositories(...groups: readonly (readonly ReviewRepository[])[]): readonly ReviewRepository[] {
|
|
121
184
|
const seen = new Map<string, ReviewRepository>()
|
|
122
|
-
for (const { owner, name } of groups.flat()) seen.set(
|
|
123
|
-
return [...seen
|
|
185
|
+
for (const { host, owner, name } of groups.flat()) seen.set(repositoryKey({ host, owner, name }), { host, owner, name })
|
|
186
|
+
return [...seen].sort(([left], [right]) => left.localeCompare(right)).map(([, repository]) => repository)
|
|
124
187
|
}
|
|
125
188
|
|
|
126
189
|
/** The hint an item carries: a dictionary key and its values. */
|
|
@@ -7,10 +7,12 @@ import type { Context } from '@deepseek-ai/cordis'
|
|
|
7
7
|
import type {} from '@deepseek-ai/dsh-api-remote-access/client'
|
|
8
8
|
import type {} from '@deepseek-ai/dsh-api-session-controller/client'
|
|
9
9
|
import type {} from '@deepseek-ai/dsh-api-workspace-controller/client'
|
|
10
|
+
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
10
11
|
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
12
|
+
import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
|
|
11
13
|
import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
|
|
12
14
|
import type { MainPanelId } from '@deepseek-ai/dsh-client-ui-layout/client'
|
|
13
|
-
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
|
|
15
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
14
16
|
import type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'
|
|
15
17
|
import type {} from '@deepseek-ai/dsh-experimental-client-ui-forge/remote'
|
|
16
18
|
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
|
|
@@ -66,6 +68,8 @@ export interface ReviewPageDeps {
|
|
|
66
68
|
readonly quoteThread: ReviewPageInjected['quoteThread']
|
|
67
69
|
/** The UI language. */
|
|
68
70
|
readonly locale: HostObservable<string>
|
|
71
|
+
/** Package name of the bundle whose page on the Plugins page lists the provider rows with their host lists. */
|
|
72
|
+
readonly hostSettings: string
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
/**
|
|
@@ -82,7 +86,7 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
82
86
|
const actionsFor = (url: string, showChanges: () => void): ChangeRequestActions => ({
|
|
83
87
|
openLink,
|
|
84
88
|
copyLink: copyText,
|
|
85
|
-
retry: () => {
|
|
89
|
+
retry: async () => { settled(await remote.reviewPoll(url), 'toast.refreshFailed') },
|
|
86
90
|
markReady: async (entry) => {
|
|
87
91
|
reportAction(entry, await remote.reviewMarkReady(url), { done: 'toast.markedReady', failed: 'toast.markReadyFailed' })
|
|
88
92
|
},
|
|
@@ -90,6 +94,10 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
90
94
|
reportAction(entry, await remote.reviewMerge(url, request.method, request.headSha),
|
|
91
95
|
{ done: 'toast.merged', stale: 'toast.mergeStale', failed: 'toast.mergeFailed' })
|
|
92
96
|
},
|
|
97
|
+
autoMerge: async (entry, request) => {
|
|
98
|
+
reportAction(entry, await remote.reviewSetAutoMerge(url, request),
|
|
99
|
+
{ done: request.enabled ? 'toast.autoMergeEnabled' : 'toast.autoMergeCancelled', stale: 'toast.autoMergeStale', failed: 'toast.autoMergeFailed' })
|
|
100
|
+
},
|
|
93
101
|
readChecks: async (_url, headSha, signal) => {
|
|
94
102
|
const result = await remote.reviewChecks(url, headSha, signal)
|
|
95
103
|
if (!result.ok) throw new Error(result.error.message)
|
|
@@ -119,6 +127,7 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
119
127
|
const queues = new WeakMap<AbortSignal, ReviewQueue>()
|
|
120
128
|
const changes: ReviewChangesFace = {
|
|
121
129
|
localDiff: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
130
|
+
localWrite: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
122
131
|
diffBases: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
123
132
|
localText: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
124
133
|
localCommits: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
@@ -183,6 +192,14 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
183
192
|
void remote.requestWorktree(sessionId, null, null).then(result => settled(result, 'toast.worktreeFailed'))
|
|
184
193
|
},
|
|
185
194
|
}
|
|
195
|
+
// The Plugins page provides its navigation only while the current Peer may use it.
|
|
196
|
+
const pluginNavigation = createSnapshotStore(false)
|
|
197
|
+
ctx.inject(['pluginNavigation'], (scope: Context) => {
|
|
198
|
+
scope.effect(() => {
|
|
199
|
+
pluginNavigation.set(true)
|
|
200
|
+
return () => { pluginNavigation.set(false) }
|
|
201
|
+
}, 'forge-panel: plugin navigation presence')
|
|
202
|
+
})
|
|
186
203
|
const count = createStreamSource<ForgeReviewCountFrame, number | null>({
|
|
187
204
|
open: signal => remote.reviewCount(signal),
|
|
188
205
|
subscribeReset,
|
|
@@ -196,15 +213,15 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
196
213
|
locale: NS,
|
|
197
214
|
store: createReviewStore(),
|
|
198
215
|
inject: (): ReviewPageInjected => ({
|
|
199
|
-
hooks: { locale: deps.locale },
|
|
200
|
-
openLists: (
|
|
201
|
-
const slash = scope.indexOf('/')
|
|
202
|
-
return remote.reviewLists(slash < 0 ? null : { owner: scope.slice(0, slash), name: scope.slice(slash + 1) }, signal)
|
|
203
|
-
},
|
|
216
|
+
hooks: { locale: deps.locale, pluginNavigation },
|
|
217
|
+
openLists: (repository, signal) => remote.reviewLists(repository, signal),
|
|
204
218
|
openChangeRequest: (url, signal) => remote.reviewChangeRequest(url, signal),
|
|
205
219
|
subscribeReset,
|
|
206
220
|
refresh: async () => { settled(await remote.reviewRefresh(), 'toast.refreshFailed') },
|
|
207
221
|
readDescription: (url, signal) => remote.reviewDescription(url, signal),
|
|
222
|
+
readActivity: (url, signal) => remote.reviewActivity(url, signal),
|
|
223
|
+
addComment: (url, body) => remote.reviewComment(url, body),
|
|
224
|
+
openHostSettings: () => { ctx.get('pluginNavigation')?.openBundle(deps.hostSettings) },
|
|
208
225
|
actionsFor,
|
|
209
226
|
changes,
|
|
210
227
|
copyText,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Choices of the review page that outlive its mount: the change request shown in full, its tab, whether the list column
|
|
3
|
-
* hides, which list sections fold, the repository the lists are
|
|
3
|
+
* hides, which list sections fold, the host or repository the lists are narrowed to, the search text, the conversation the page
|
|
4
4
|
* started for each change request, and the changes view's choices for each change request.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ import { defineStore, type EngineStoreHandle } from '@deepseek-ai/dsh-client-sto
|
|
|
8
8
|
import type { ForgeViewerFilter } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
9
9
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
10
10
|
import { changesActions, type ChangesState } from '../changes-store.ts'
|
|
11
|
-
import { mergeRepositories, type ReviewRepository } from './review-lists.ts'
|
|
11
|
+
import { mergeRepositories, type ReviewRepository, type ReviewScope } from './review-lists.ts'
|
|
12
12
|
|
|
13
13
|
/** A tab of the review page's detail. */
|
|
14
14
|
export type ReviewTab = 'summary' | 'changes' | 'chat'
|
|
@@ -16,6 +16,15 @@ export type ReviewTab = 'summary' | 'changes' | 'chat'
|
|
|
16
16
|
/** How the list column shows its items: two lines each, or one line each with the rest in a hover card. */
|
|
17
17
|
export type ReviewView = 'detailed' | 'compact'
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Name the changes view of a change request in the store's `byTab`.
|
|
21
|
+
* @param url - web URL of the change request.
|
|
22
|
+
* @returns the tab id the view keeps its choices under.
|
|
23
|
+
*/
|
|
24
|
+
export function changesTabOf(url: string): string {
|
|
25
|
+
return `review:${url}`
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
/** The review page's choices, and those of its changes view by change request URL. */
|
|
20
29
|
export interface ReviewPageState extends ChangesState {
|
|
21
30
|
/** Web URL of the change request shown in full, or null. */
|
|
@@ -26,8 +35,8 @@ export interface ReviewPageState extends ChangesState {
|
|
|
26
35
|
listHidden: boolean
|
|
27
36
|
/** List sections the reader folded. */
|
|
28
37
|
folded: Partial<Record<ForgeViewerFilter, boolean>>
|
|
29
|
-
/**
|
|
30
|
-
|
|
38
|
+
/** What the lists are narrowed to: one host, one repository, or null for every repository of every host. */
|
|
39
|
+
scope: ReviewScope | null
|
|
31
40
|
/**
|
|
32
41
|
* Repositories the lists named while they were read in every repository, which the repository menu keeps offering
|
|
33
42
|
* while the lists are read in one.
|
|
@@ -55,6 +64,14 @@ const reviewActions = {
|
|
|
55
64
|
state.tab = tab
|
|
56
65
|
if (tab === 'chat' && state.selected !== null) state.unseenQuotes[state.selected] = 0
|
|
57
66
|
},
|
|
67
|
+
/**
|
|
68
|
+
* Show the changes tab with one commit chosen in the changes view of a change request, which keeps its choices from
|
|
69
|
+
* the time the detail first shows.
|
|
70
|
+
*/
|
|
71
|
+
openedCommit: (state: ReviewPageState, url: string, sha: string) => {
|
|
72
|
+
changesActions.committed(state, changesTabOf(url), { from: sha, to: sha })
|
|
73
|
+
state.tab = 'changes'
|
|
74
|
+
},
|
|
58
75
|
viewed: (state: ReviewPageState, view: ReviewView) => { state.view = view },
|
|
59
76
|
quoted: (state: ReviewPageState, url: string) => {
|
|
60
77
|
if (state.selected === url && state.tab === 'chat') return
|
|
@@ -62,14 +79,14 @@ const reviewActions = {
|
|
|
62
79
|
},
|
|
63
80
|
toggledList: (state: ReviewPageState) => { state.listHidden = !state.listHidden },
|
|
64
81
|
folded: (state: ReviewPageState, filter: ForgeViewerFilter) => { state.folded[filter] = state.folded[filter] !== true },
|
|
65
|
-
scopedTo: (state: ReviewPageState,
|
|
82
|
+
scopedTo: (state: ReviewPageState, scope: ReviewScope | null) => { state.scope = scope },
|
|
66
83
|
/**
|
|
67
84
|
* Record the repositories the lists read in every repository name: a complete read replaces the record, and a read
|
|
68
85
|
* still under way or failed in part adds to it.
|
|
69
86
|
*/
|
|
70
87
|
listed: (state: ReviewPageState, repositories: ReviewPageState['repositories'], complete: boolean) => {
|
|
71
88
|
const next = complete ? mergeRepositories(repositories) : mergeRepositories(state.repositories, repositories)
|
|
72
|
-
const names = (list: ReviewPageState['repositories']): string => list.map(item => `${item.owner}/${item.name}`).join('\n')
|
|
89
|
+
const names = (list: ReviewPageState['repositories']): string => list.map(item => `${item.host} ${item.owner}/${item.name}`).join('\n')
|
|
73
90
|
if (names(next) !== names(state.repositories)) state.repositories = [...next]
|
|
74
91
|
},
|
|
75
92
|
searched: (state: ReviewPageState, query: string) => { state.query = query },
|
|
@@ -87,7 +104,7 @@ const reviewActions = {
|
|
|
87
104
|
export function createReviewStore(): EngineStoreHandle<ReviewPageState, typeof reviewActions> {
|
|
88
105
|
return defineStore({
|
|
89
106
|
init: (): ReviewPageState => ({
|
|
90
|
-
selected: null, tab: 'summary', listHidden: false, folded: {},
|
|
107
|
+
selected: null, tab: 'summary', listHidden: false, folded: {}, scope: null, repositories: [], query: '', directOnly: false, conversations: {}, view: 'detailed', unseenQuotes: {}, byTab: {},
|
|
91
108
|
}),
|
|
92
109
|
actions: reviewActions,
|
|
93
110
|
})
|
|
@@ -14,7 +14,10 @@ const selection = z.object({
|
|
|
14
14
|
})
|
|
15
15
|
const recordedSelection = selection.extend({ source: z.discriminatedUnion('kind', [
|
|
16
16
|
selection.shape.source,
|
|
17
|
-
z.object({
|
|
17
|
+
z.object({
|
|
18
|
+
kind: z.literal('local'), scope: z.string(), base: z.string().nullable().default(null), baseRef: z.string().nullable().default(null), commits,
|
|
19
|
+
head: z.object({ key: z.string(), name: z.string(), root: z.string().nullable() }).exactOptional(),
|
|
20
|
+
}),
|
|
18
21
|
]) })
|
|
19
22
|
const record = z.discriminatedUnion('kind', [
|
|
20
23
|
z.object({ kind: z.literal('agent'), selection: recordedSelection }),
|
|
@@ -277,10 +280,11 @@ export class ReviewQueue {
|
|
|
277
280
|
* Compare review identity while allowing records from an older PR head to remain visible.
|
|
278
281
|
* @param left - recorded source.
|
|
279
282
|
* @param right - displayed source.
|
|
280
|
-
* @returns whether the sources name the same PR, or the same local scope and base ref, with the same chosen commits.
|
|
283
|
+
* @returns whether the sources name the same PR, or the same local head, scope and base ref, with the same chosen commits.
|
|
281
284
|
*/
|
|
282
285
|
export function sameReviewSource(left: ReviewSource, right: ReviewSource): boolean {
|
|
283
286
|
if (left.commits?.from !== right.commits?.from || left.commits?.to !== right.commits?.to) return false
|
|
284
|
-
return left.kind === 'local'
|
|
287
|
+
return left.kind === 'local'
|
|
288
|
+
? right.kind === 'local' && left.scope === right.scope && left.baseRef === right.baseRef && left.head?.key === right.head?.key
|
|
285
289
|
: right.kind === 'change' && left.url === right.url
|
|
286
290
|
}
|
|
@@ -3,30 +3,34 @@
|
|
|
3
3
|
* each filter of the thread list keeps, and the composer quote of a whole thread.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
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 {
|
|
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,
|
|
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:
|
|
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
|
|
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 ?
|
|
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)
|
|
52
|
-
|
|
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 {
|
package/src/client/review.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Frozen line selections shared by the diff UI, composer references, and review submission. */
|
|
2
2
|
|
|
3
|
-
import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
3
|
+
import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
4
|
import type { ForgeCommitRange, ForgeDiffFile } from '../types.ts'
|
|
5
5
|
import type { ForgePanelKey } from './locales.ts'
|
|
6
6
|
|
|
@@ -28,6 +28,7 @@ export type ReviewSource =
|
|
|
28
28
|
/**
|
|
29
29
|
* Local changes in a scope. `base` names what the `branch` scope compared with for the reader, and is null for
|
|
30
30
|
* other scopes; `baseRef` identifies the comparison: the chosen ref, or null for the automatic fork point and other scopes.
|
|
31
|
+
* `head` is absent for the Session's own checkout.
|
|
31
32
|
*/
|
|
32
33
|
| {
|
|
33
34
|
readonly kind: 'local'
|
|
@@ -35,6 +36,7 @@ export type ReviewSource =
|
|
|
35
36
|
readonly base: string | null
|
|
36
37
|
readonly baseRef: string | null
|
|
37
38
|
readonly commits: ForgeCommitRange | null
|
|
39
|
+
readonly head?: ReviewHead
|
|
38
40
|
}
|
|
39
41
|
/** A change request; `headSha` is the commit the shown changes end at: the head, or the last chosen commit. */
|
|
40
42
|
| { readonly kind: 'change'; readonly url: string; readonly headSha: string; readonly commits: ForgeCommitRange | null }
|
|
@@ -45,6 +47,16 @@ export interface ReviewSelection {
|
|
|
45
47
|
readonly comment: ReviewComment
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
/** The branch local changes showed in place of the Session's checked-out one when a comment was written. */
|
|
51
|
+
export interface ReviewHead {
|
|
52
|
+
/** Identity of the head among the heads of one Session: the branch's full ref name. */
|
|
53
|
+
readonly key: string
|
|
54
|
+
/** Branch name without its ref prefix. */
|
|
55
|
+
readonly name: string
|
|
56
|
+
/** Top-level directory of the worktree the changes were read in, or null for a branch read from its commits. */
|
|
57
|
+
readonly root: string | null
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
/**
|
|
49
61
|
* Capture a range only when both endpoints belong to the same displayed hunk.
|
|
50
62
|
* @param file - loaded diff file.
|
|
@@ -103,10 +115,16 @@ export function formatReviewComment(selection: ReviewSelection, index: number):
|
|
|
103
115
|
const commits = source.commits === null ? ''
|
|
104
116
|
: `\nCommits: ${source.commits.from === source.commits.to ? source.commits.from : `${source.commits.from}^..${source.commits.to}`}`
|
|
105
117
|
const origin = source.kind === 'change' ? `Source: ${source.url}\nCommit: ${source.headSha}${commits}`
|
|
106
|
-
: `Source: Local (${source.scope})${source.base === null ? '' : `\nBase: ${source.base}`}${commits}`
|
|
118
|
+
: `Source: Local (${source.scope})${headLines(source.head)}${source.base === null ? '' : `\nBase: ${source.base}`}${commits}`
|
|
107
119
|
return `## User Comment ${index}\nFile: ${comment.path}\nSide: ${comment.side}\nLines: ${range}\n${origin}\nDiff hunk:\n${fence}diff\n${comment.hunk}\n${fence}\nComment:\n${comment.body}`
|
|
108
120
|
}
|
|
109
121
|
|
|
122
|
+
/** The lines that say whose code a local comment quotes when it is not the Session's own checkout. */
|
|
123
|
+
function headLines(head: ReviewHead | undefined): string {
|
|
124
|
+
if (head === undefined) return ''
|
|
125
|
+
return head.root === null ? `\nBranch: ${head.name} (committed content)` : `\nWorktree: ${head.root}\nBranch: ${head.name}`
|
|
126
|
+
}
|
|
127
|
+
|
|
110
128
|
/**
|
|
111
129
|
* Check whether the current diff still contains the captured range and hunk.
|
|
112
130
|
* @param selection - saved comment source and patch.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Copy of the Plugins form that the row pages of the Forge bundle share. */
|
|
2
|
+
import type { SettingsFormLabels } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
3
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
4
|
+
import type { ForgePanelKey, NS } from './locales.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Build the form copy of one row page.
|
|
8
|
+
* @param t - forge panel copy.
|
|
9
|
+
* @param unavailable - key of the text shown while the Host does not serve the row's form.
|
|
10
|
+
* @returns the labels of the shared settings form.
|
|
11
|
+
*/
|
|
12
|
+
export function rowFormLabels(t: PropsLocale<typeof NS>['t'], unavailable: ForgePanelKey): SettingsFormLabels {
|
|
13
|
+
return {
|
|
14
|
+
unavailable: t(unavailable), readOnly: t('settings.readOnly'), saveFailed: t('settings.saveFailed'),
|
|
15
|
+
save: t('settings.save'), saving: t('settings.saving'),
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The forge facts a Session row shows, from the Session list and the change request states every row shares. */
|
|
2
2
|
|
|
3
3
|
import { useMemo } from 'react'
|
|
4
|
-
import type { HostObservable, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import type { HostObservable, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
5
5
|
import type { UseSessions } from '@deepseek-ai/dsh-client-ui-session/client'
|
|
6
6
|
import type {} from '@deepseek-ai/dsh-experimental-forge-session/types'
|
|
7
7
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
package/src/client/slots.ts
CHANGED
|
@@ -74,7 +74,7 @@ export interface ForgeReviewConversationProps {
|
|
|
74
74
|
readonly onWorkspaceSelected: WorkspaceSelectedHandler
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
77
|
+
declare module '@deepseek-ai/dsh-client-ui-slots/client' {
|
|
78
78
|
interface SlotMap {
|
|
79
79
|
/** The review page's conversation about one change request, in the Session its chat tab shows. */
|
|
80
80
|
'forge.review.conversation': { kind: 'single'; scope: 'session'; owner: ForgeReviewConversationProps }
|
package/src/client/source.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* of the Session list) and the store behind action notices.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
|
|
6
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
7
7
|
import type { ForgeChangeRequestListState, ForgeChangeRequestStatesFrame, ForgePanelState } from '../types.ts'
|
|
8
8
|
import type { ForgePanelKey } from './locales.ts'
|
|
9
9
|
|