dsh-vscode-mode 0.27.0 → 0.27.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-vscode-mode",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "DSH 上的类 VSCode 编码体验:Monaco 编辑器(文件页签/QuickOpen/状态栏,可驻 DSH 0.1.5+ 官方右侧 Sidebar 与对话同屏)+ 命令栏(Ctrl+Shift+P)与可扩展指令系统 + VS Code 兼容代码片段(.code-snippets 全局/项目,IntelliSense 展开)+ Agent 编辑差异审查(整文件差异/采纳/拒绝/归档/回滚)+ SVN 集成(侧栏变更面板/日志弹窗/并排差异)+ 语言服务器(LSP)智能(跳转定义/引用/hover/大纲 + VSIX 扩展市场安装),状态持久化到工作区旁车,界面状态(页签/光标/侧栏/编辑 Tab/导航历史)镜像到 DSH home 跨重启恢复",
5
5
  "icon": "assets/icon.svg",
6
6
  "keywords": [
@@ -7,6 +7,22 @@
7
7
  * 作者 ddj 2026年10月27号
8
8
  */
9
9
  import { sessionErrorText } from './sessionError.js'
10
+ import type { ReviewDetail } from '../shared/review.js'
11
+
12
+ /**
13
+ * @public
14
+ * @author ddj 2026年11月5号
15
+ * @description 仅收敛已成功生成的空文本净差异;不把定位失败、二进制或生成异常当作已解决。
16
+ * @param detail 已加载的权威详情
17
+ * @returns 是否可以无写盘结案
18
+ */
19
+ export function emptyTextReview(detail: ReviewDetail | null): boolean {
20
+ if (!detail || detail.item.decision !== 'pending' || !detail.item.current) return false
21
+ if (detail.capability.keep !== true || detail.diff.kind !== 'text') return false
22
+
23
+ return detail.diff.hunks.length === 0 && detail.blocks.length === 0
24
+ && detail.item.added === 0 && detail.item.deleted === 0
25
+ }
10
26
 
11
27
  /** 官方差异栏输入:全部来自 EditorView dock 快照,不读取磁盘或 RPC。 */
12
28
  export interface ReviewBarInput {
@@ -26,6 +26,31 @@ export function diffPathKey(path: string): string {
26
26
  return pathKeyFor(path, false)
27
27
  }
28
28
 
29
+ /**
30
+ * @public
31
+ * @author ddj 2026年11月5号
32
+ * @description: 解析编辑器权威审查路径,累计待审优先,详情与工具栏共用同一来源。
33
+ * @param path 当前文件
34
+ * @param page 权威审查元数据
35
+ * @param sameFile 工作区路径比较器,缺省按完整路径键比较
36
+ * @returns 后端审查路径;未接管时返回 null
37
+ */
38
+ export function reviewPathOf(
39
+ path: string | null, page: ReviewPage | null,
40
+ sameFile: (left: string, right: string) => boolean = (left, right) => diffPathKey(left) === diffPathKey(right),
41
+ ): string | null {
42
+ if (!path || !page) return null
43
+
44
+ for (const item of page.items) {
45
+ if (!item.id.startsWith(PENDING_PREFIX)) continue
46
+ const currentPath = item.currentPath || item.path
47
+ const identity = item.id.slice(PENDING_PREFIX.length)
48
+ if (sameFile(currentPath, path) || sameFile(identity, path)) return currentPath
49
+ }
50
+
51
+ return page.overview?.coveredPaths.find((candidate) => sameFile(candidate, path)) ?? null
52
+ }
53
+
29
54
  /** @public @author ddj 2026年10月26号 @param path Current editor file. @param page Authoritative metadata, including decided paths. @returns Whether legacy actions must be hidden for this file. */
30
55
  export function officialPath(path: string, page: ReviewPage | null): boolean {
31
56
  const key = diffPathKey(path)
@@ -90,10 +115,11 @@ function pendingRowsOf(page: ReviewPage | null): { rows: DiffFile[]; covered: Se
90
115
  }
91
116
 
92
117
  /** @public @author ddj 2026年10月26号 @param records Tool-call history. @param page Official file navigation, never only its first 50 rows. @returns Pending first, then official; legacy paths remain explicitly labelled. */
93
- export function diffSummary(records: RecordView[], page: ReviewPage | null): DiffSummary {
118
+ export function diffSummary(records: (RecordView & { archived?: boolean })[], page: ReviewPage | null): DiffSummary {
94
119
  const pending = pendingRowsOf(page)
95
120
  // 同一路径只留一个权威:待审接管后,官方汇总行与历史留痕行都让位。
96
- const legacy = summarize(records.filter((record) => !pending.covered.has(diffPathKey(record.path)) && !officialPath(record.path, page)))
121
+ const legacy = summarize(records.filter((record) => record.archived !== true
122
+ && !pending.covered.has(diffPathKey(record.path)) && !officialPath(record.path, page)))
97
123
  const files: DiffFile[] = [...pending.rows]
98
124
  for (const file of page?.overview?.files ?? []) {
99
125
  if (pending.covered.has(diffPathKey(file.path))) continue
@@ -29,7 +29,7 @@ import { toastDom } from '../externalOpen.js'
29
29
  import { ReviewAllConfirm } from './ReviewAllConfirm.js'
30
30
  import { reviewRegions } from '../../shared/reviewRegions.js'
31
31
  import { PENDING_PREFIX } from '../../shared/pendingReview.js'
32
- import { coveredPathKeys, diffPathKey, diffSummary } from '../state/diffSummary.js'
32
+ import { coveredPathKeys, diffPathKey, diffSummary, reviewPathOf } from '../state/diffSummary.js'
33
33
  import { emitFileChanged, emitRefresh } from '../events.js'
34
34
  import { langOf, loadMonaco, snippetLanguageOf } from '../monaco/loader.js'
35
35
  import { bindEditActions, runEditAction } from '../monaco/editActions.js'
@@ -136,7 +136,7 @@ import { clampToolbarPosition, loadToolbarPosition, saveToolbarPosition } from '
136
136
  import { editorModelPathOf } from '../dap/modelPath.js'
137
137
  import { dapTrace } from '../dap/trace.js'
138
138
  import { isSessionMissingError, sessionErrorText, sessionMissingDetail, sessionMissingTitle } from '../sessionError.js'
139
- import { officialDownView, SESSION_DOWN_NOTICE, SIDECAR_KEEP_DONE } from '../reviewBar.js'
139
+ import { emptyTextReview, officialDownView, SESSION_DOWN_NOTICE, SIDECAR_KEEP_DONE } from '../reviewBar.js'
140
140
 
141
141
  /** 官方差异读取失败前缀:仅用于清理同源陈旧错误,不吞并保存类错误。@author ddj 2026年10月27号 */
142
142
  const REVIEW_LOAD_ERROR = '官方差异读取失败:'
@@ -595,14 +595,9 @@ export function EditorView(props) {
595
595
  const controller = new AbortController()
596
596
  // 待审条目也走同一条行内差异通道:它由累计基线投影而来,形状与官方条目一致,
597
597
  // 因此编辑器里天然就能画行内差异与 Keep/Undo 药丸,不必另开一个窄面板。
598
- const pendingPath = (review.page?.items ?? [])
599
- .filter((item) => String(item.id).startsWith(PENDING_PREFIX))
600
- .map((item) => item.currentPath || item.path)
601
- .find((path) => sameFile(path, active))
602
- const coveredPath = review.page?.overview?.coveredPaths.find((path) => sameFile(path, active))
603
- const reviewPath = coveredPath ?? pendingPath
604
- dbg(sessionId, `[DEBUG reviewPath] active=${active ?? '(null)'} covered=${coveredPath ?? '(none)'}`
605
- + ` pending=${pendingPath ?? '(none)'} coveredCount=${review.page?.overview?.coveredPaths.length ?? -1}`
598
+ const reviewPath = reviewPathOf(active, review.page, sameFile)
599
+ dbg(sessionId, `[DEBUG reviewPath] active=${active ?? '(null)'} resolved=${reviewPath ?? '(none)'}`
600
+ + ` coveredCount=${review.page?.overview?.coveredPaths.length ?? -1}`
606
601
  + ` items=${review.page?.items?.length ?? -1} overview=${review.page?.overview ? 1 : 0}`)
607
602
  if (!active || !reviewPath) {
608
603
  setOfficialDetail(null)
@@ -696,9 +691,11 @@ export function EditorView(props) {
696
691
  const decideRegions = React.useMemo(() => [...pendingRegions, ...staleRegions], [pendingRegions, staleRegions])
697
692
  // 记录的改动已全部不在当前文件中时没有可见差异可审:自动结案,不再让「改动已失效」占用差异栏。
698
693
  React.useEffect(() => {
699
- if (!officialDetail || contentReady !== true || batchBusyRef.current) return
700
- if (pendingRegions.length > 0 || staleRegions.length === 0) return
701
- if (noBlocks || officialDetail.capability?.keep !== true) return
694
+ if (!officialDetail || batchBusyRef.current) return
695
+ // 空净差异只依赖权威快照,不依赖编辑器磁盘加载;定位失效仍须等待当前内容就绪。
696
+ const emptyText = emptyTextReview(officialDetail)
697
+ if (!emptyText && (contentReady !== true || pendingRegions.length > 0 || staleRegions.length === 0 || noBlocks)) return
698
+ if (officialDetail.capability?.keep !== true) return
702
699
  if (dirtyRef.current[active]) return
703
700
 
704
701
  void settleInvisibleRecord(officialDetail)
@@ -3552,7 +3549,7 @@ export function EditorView(props) {
3552
3549
  const allPending = React.useMemo(() => {
3553
3550
  const out = []
3554
3551
  for (const rec of Object.values(records)) {
3555
- if (rec.superseded === true || coveredPaths.has(diffPathKey(rec.path))) continue
3552
+ if (rec.archived === true || rec.superseded === true || coveredPaths.has(diffPathKey(rec.path))) continue
3556
3553
  const perHunk = Array.isArray(rec.decisions?.perHunk) ? rec.decisions.perHunk : []
3557
3554
  const hunks = Array.isArray(rec.hunks) ? rec.hunks : []
3558
3555
  for (let i = 0; i < hunks.length; i++) {
@@ -4962,7 +4959,7 @@ export function EditorView(props) {
4962
4959
  * @author ddj 2026年09月29号
4963
4960
  * @returns 含布局及操作回调的差异快照
4964
4961
  */
4965
- const officialFile = review.page?.overview?.coveredPaths.find((path) => sameFile(path, active))
4962
+ const officialFile = reviewPathOf(active, review.page, sameFile)
4966
4963
  // 官方通道自身的失败(list 失败 / 缺 overview)只影响官方栏,不能混进保存类错误。
4967
4964
  const officialDown = officialFile ? null : officialDownView(review.error)
4968
4965
  const rawReviewError = review.error || error
@@ -4,6 +4,7 @@
4
4
  * @author ddj 2026年10月29号
5
5
  */
6
6
  import type { PendingEarlier, PendingLineage } from '../shared/pendingReview.js'
7
+ import { logicalLines } from '../shared/lineEndings.js'
7
8
 
8
9
  /** 内存态条目:比展示投影多保存两侧全文。 */
9
10
  export interface PendingEntry {
@@ -50,12 +51,17 @@ export function sameEntryText(left: string, right: string): boolean {
50
51
 
51
52
  /**
52
53
  * @author ddj 2026年10月29号
53
- * @description: 净零判定:基线等于当前内容即为已解决,但条目仍留在列表等待移除。
54
+ * @description: 净零判定与文本差异生成器保持逻辑行口径一致;只忽略 BOM 和换行编码,不改存储原文。
54
55
  * @param entry 待审条目
55
56
  * @returns 是否已无净差异
56
57
  */
57
58
  export function isSettled(entry: PendingEntry): boolean {
58
- return sameEntryText(entry.oldText, entry.newText)
59
+ if (sameEntryText(entry.oldText, entry.newText)) return true
60
+
61
+ const baselineLines = logicalLines(entry.oldText)
62
+ const currentLines = logicalLines(entry.newText)
63
+ return baselineLines.length === currentLines.length
64
+ && baselineLines.every((line, index) => line === currentLines[index])
59
65
  }
60
66
 
61
67
  /**