@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
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Service } from "@deepseek-ai/cordis";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { changeRequestKey } from "@deepseek-ai/dsh-experimental-forge";
4
- import { appendPluginRecord, pluginRecordOf } from "@deepseek-ai/dsh-session";
4
+ import { appendPluginRecord, pluginRecordOf } from "@deepseek-ai/dsh-session-store";
5
5
  import { MAX_TIMER_DELAY_MS, deadline, timeoutOf } from "@deepseek-ai/dsh-timeout";
6
6
  import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
7
7
  import { assertNever } from "@deepseek-ai/dsh-util-values";
@@ -5732,9 +5732,9 @@ let ForgePanelController = (() => {
5732
5732
  return await this.publishReview(this.served(url).ref, request, signal);
5733
5733
  }
5734
5734
  /**
5735
- * Read the changes of a change request the review page shows, or of consecutive commits of it.
5735
+ * Read the changes of a change request the review page shows, of consecutive commits of it, or of it up to one commit.
5736
5736
  * @param url - web URL of the change request.
5737
- * @param commits - consecutive commits of the change request, or null for all of it.
5737
+ * @param commits - consecutive commits of the change request, the commit its changes go up to, or null for all of it.
5738
5738
  * @param signal - request cancellation.
5739
5739
  * @returns the files and the commit they end at, without a local checkout count.
5740
5740
  * @throws as {@link ForgePanelController.changeRequestDiff} does, with `forgePanel/unrecognized-url` in place of
@@ -6153,20 +6153,25 @@ let ForgePanelController = (() => {
6153
6153
  * of the commit the diff ends at. Without `commits` the diff covers the change
6154
6154
  * request at the head commit of its latest status; a patch already read at the
6155
6155
  * same head commit and base branch is reused from memory with its attributes, for
6156
- * any Session, until `maxCachedDiffBytes` evicts it. With `commits`, it covers those
6157
- * commits, from the first one's first parent to the last, and is read every time.
6156
+ * any Session, until `maxCachedDiffBytes` evicts it. With consecutive `commits`, it covers those
6157
+ * commits, from the first one's first parent to the last; with `commits` up to one commit, it covers
6158
+ * the change request as that commit ended it, from the merge base of the status's base commit with
6159
+ * that commit, which the host reads by name whether or not the change request still lists it. Either
6160
+ * is read every time.
6158
6161
  * @param session - Session the change request is bound to.
6159
6162
  * @param url - binding URL of the change request.
6160
- * @param commits - consecutive commits of the change request, or null for all of it.
6163
+ * @param commits - consecutive commits of the change request, the commit its changes go up to, or null for all of it.
6161
6164
  * @param signal - request cancellation.
6162
6165
  * @returns the files, the commit they end at, each file's web page, and the commits the checkout has beyond the head.
6163
6166
  * @throws `forgePanel/not-bound` unless the URL is a visible binding of the Session that a provider serves;
6164
- * `forgePanel/commits-missing` when chosen commits are not among the change request's commits in order;
6167
+ * `forgePanel/commits-missing` when chosen commits are not among the change request's commits in order, and for a
6168
+ * commit to go up to that is not a full object name or that the host does not have;
6165
6169
  * `forgePanel/commits-not-linear` when a chosen commit's first parent is not the commit listed before it;
6166
6170
  * `forgePanel/stale-head` without `commits` when the head moved past the latest status, which is then polled again;
6167
6171
  * `forgePanel/diff-too-large` when the host or its provider refuses the diff over a size limit;
6168
- * `forgePanel/diff-failed` before its status was read, for a first chosen commit without a parent, and when the host
6169
- * does not provide the commits, the diff, or an existing `.gitattributes` otherwise.
6172
+ * `forgePanel/diff-failed` before its status was read, for a first chosen commit without a parent, for changes up
6173
+ * to a commit while the status names no base commit, and when the host does not provide the commits, the merge
6174
+ * base, the diff, or an existing `.gitattributes` otherwise.
6170
6175
  */
6171
6176
  async changeRequestDiff(session, url, commits, signal) {
6172
6177
  signal.throwIfAborted();
@@ -6668,6 +6673,30 @@ let ForgePanelController = (() => {
6668
6673
  };
6669
6674
  }
6670
6675
  /**
6676
+ * The files of a change request up to a commit, from the merge base of the status's base commit with it, which is
6677
+ * returned too. The provider reads that commit by name, so it may have left the change request's listed commits; a
6678
+ * commit the host does not have is refused as `forgePanel/commits-missing`.
6679
+ */
6680
+ async filesUpTo(ref, snapshot, commit, signal) {
6681
+ if (!isCommit(commit)) throw new RemoteError("forgePanel/commits-missing", "The chosen commit is not a full object name", {});
6682
+ if (snapshot.baseSha === void 0) throw new RemoteError("forgePanel/diff-failed", "The code host provider reports no base commit to compare from", {});
6683
+ const base = await this.home.forge.mergeBase(ref, snapshot.baseSha, commit, signal);
6684
+ if (typeof base !== "string") throw upToError(base);
6685
+ const { patch, attributes } = await this.patchAt(ref, commit, async (operation) => {
6686
+ const compared = await this.home.forge.compare(ref, base, commit, operation);
6687
+ if (typeof compared !== "string") throw upToError(compared);
6688
+ return compared;
6689
+ }, signal);
6690
+ return {
6691
+ files: this.layers.classify(parseDiff(patch), attributes),
6692
+ parent: base
6693
+ };
6694
+ }
6695
+ /** The files of chosen commits of a change request with the commit their old side shows. */
6696
+ async chosenFiles(ref, snapshot, commits, signal) {
6697
+ return "upTo" in commits ? await this.filesUpTo(ref, snapshot, commits.upTo, signal) : await this.commitFiles(ref, commits, signal);
6698
+ }
6699
+ /**
6671
6700
  * Read a patch that ends at `commit` together with the root `.gitattributes` at that commit. A failed patch read
6672
6701
  * cancels the attributes read. Both reads end before the result: the patch's failure passes on first, and the
6673
6702
  * attributes failure only after the patch was read, so the outcome does not depend on which read ends first.
@@ -6760,18 +6789,18 @@ let ForgePanelController = (() => {
6760
6789
  if (result.headSha !== headSha) throw new RemoteError("forgePanel/stale-head", "The change request head changed; refresh its status", {});
6761
6790
  return result;
6762
6791
  }
6763
- /** Read the changes of a change request at the head of its latest status, or of chosen commits; `ahead` counts local commits. */
6792
+ /** Read the changes of a change request at the head of its latest status, or of its chosen commits; `ahead` counts local commits. */
6764
6793
  async readDiff(target, commits, signal, ahead) {
6765
6794
  const { ref, update } = target;
6766
6795
  if (update === null || !("snapshot" in update)) throw new RemoteError("forgePanel/diff-failed", "The change request status has not been read yet", {});
6767
6796
  if (commits !== null) {
6768
- const { files } = await this.commitFiles(ref, commits, signal);
6769
- const fileUrls = Object.fromEntries(files.map((file) => [file.path, this.home.forge.fileUrl(ref, commits.to, file.path)]));
6797
+ const { files } = await this.chosenFiles(ref, update.snapshot, commits, signal);
6798
+ const end = lastOf(commits);
6770
6799
  return {
6771
- headSha: commits.to,
6800
+ headSha: end,
6772
6801
  files,
6773
6802
  localAhead: null,
6774
- fileUrls
6803
+ fileUrls: Object.fromEntries(files.map((file) => [file.path, this.home.forge.fileUrl(ref, end, file.path)]))
6775
6804
  };
6776
6805
  }
6777
6806
  const { headSha, headBranch } = update.snapshot;
@@ -7033,6 +7062,8 @@ let ForgePanelController = (() => {
7033
7062
  let files;
7034
7063
  let newCommit;
7035
7064
  let oldCommit;
7065
+ let shownHead = snapshot.headSha;
7066
+ let shownRange = null;
7036
7067
  if (commits === null) {
7037
7068
  files = await this.headFiles(ref, snapshot, signal);
7038
7069
  newCommit = snapshot.headSha;
@@ -7047,10 +7078,12 @@ let ForgePanelController = (() => {
7047
7078
  }
7048
7079
  };
7049
7080
  } else {
7050
- const read = await this.commitFiles(ref, commits, signal);
7081
+ const read = await this.chosenFiles(ref, snapshot, commits, signal);
7051
7082
  files = read.files;
7052
- newCommit = commits.to;
7083
+ newCommit = lastOf(commits);
7053
7084
  oldCommit = () => Promise.resolve(read.parent);
7085
+ if ("upTo" in commits) shownHead = commits.upTo;
7086
+ else shownRange = commits;
7054
7087
  }
7055
7088
  return {
7056
7089
  key: JSON.stringify([
@@ -7062,8 +7095,8 @@ let ForgePanelController = (() => {
7062
7095
  source: {
7063
7096
  kind: "change",
7064
7097
  ref,
7065
- headSha: snapshot.headSha,
7066
- commits
7098
+ headSha: shownHead,
7099
+ commits: shownRange
7067
7100
  },
7068
7101
  files,
7069
7102
  read: async (side, file, inner) => {
@@ -7102,6 +7135,14 @@ let ForgePanelController = (() => {
7102
7135
  };
7103
7136
  })();
7104
7137
  /**
7138
+ * Name the commit that chosen commits of a change request end at.
7139
+ * @param commits - the chosen commits.
7140
+ * @returns the last commit's object name.
7141
+ */
7142
+ function lastOf(commits) {
7143
+ return "upTo" in commits ? commits.upTo : commits.to;
7144
+ }
7145
+ /**
7105
7146
  * Whether a value names a full commit object name.
7106
7147
  * @param value - the value from the browser.
7107
7148
  * @returns whether it is 40 or 64 hexadecimal digits.
@@ -7155,6 +7196,14 @@ function readError(failure) {
7155
7196
  }
7156
7197
  }
7157
7198
  /**
7199
+ * Report why the code host did not provide the merge base or the diff of the changes up to a commit.
7200
+ * @param failure - the provider's failure.
7201
+ * @returns `forgePanel/commits-missing` when the host does not have the commit, else what {@link readError} reports.
7202
+ */
7203
+ function upToError(failure) {
7204
+ return failure.code === "not-found" ? new RemoteError("forgePanel/commits-missing", failure.message, {}) : readError(failure);
7205
+ }
7206
+ /**
7158
7207
  * Report why the code host did not provide review threads.
7159
7208
  * @param failure - the provider's failure.
7160
7209
  * @returns `forgePanel/stale-head` for a head that moved, `forgePanel/review-unsupported` for a provider without