dsh-vscode-mode 0.23.4 → 0.24.0
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.md +118 -24
- package/lib/client.js +202 -15
- package/lib/client.js.map +2 -2
- package/lib/index.js +60 -16
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/loadFailure.ts +84 -0
- package/src/client/monaco/loader.ts +9 -6
- package/src/client/pdf/pdfLoader.ts +10 -4
- package/src/client/rpc.ts +54 -10
- package/src/client/state/diffSummary.ts +4 -0
- package/src/client/ui/DiffBadge.ts +2 -2
- package/src/client/ui/EditorView.ts +2 -1
- package/src/pending/decide.ts +9 -2
- package/src/pending/store.ts +13 -9
- package/src/pendingCompat.ts +7 -1
- package/src/pendingRpc.ts +5 -2
- package/src/reviewDb.ts +25 -0
- package/src/reviewRpc.ts +7 -3
- package/src/shared/remoteChannel.ts +59 -0
- package/src/shared/rpc.ts +2 -2
package/lib/index.js
CHANGED
|
@@ -7652,6 +7652,27 @@ function reviewPage(cwd, cursor = 0, history = false, path) {
|
|
|
7652
7652
|
/**
|
|
7653
7653
|
* @public
|
|
7654
7654
|
* @author ddj 2026年10月31号
|
|
7655
|
+
* @description: 该会话里由官方记录判为「整文件新增」的文件身份集合。待审条目命中时基线要置空:
|
|
7656
|
+
* 文件是本会话新建的,累计基线只是会话自己的中间产物,拿它做旧侧会把新增文件渲染成一堆修改块。
|
|
7657
|
+
* @param cwd 迁移后的工作区
|
|
7658
|
+
* @param sessionId 会话
|
|
7659
|
+
* @returns 整文件新增的文件身份集合
|
|
7660
|
+
*/
|
|
7661
|
+
function addedFiles(cwd, sessionId) {
|
|
7662
|
+
try {
|
|
7663
|
+
const db = dbFor(cwd);
|
|
7664
|
+
if (!db.prepare("SELECT 1 FROM sqlite_master WHERE name='review_files' AND type='table'").get()) return /* @__PURE__ */ new Set();
|
|
7665
|
+
const rows = db.prepare(`SELECT identity FROM (SELECT identity,
|
|
7666
|
+
json_extract(diff,'$.before') AS before, ROW_NUMBER() OVER (PARTITION BY identity ORDER BY turn, seq) AS rank
|
|
7667
|
+
FROM review_files WHERE session_id=?) WHERE rank=1 AND before=0`).all(sessionId);
|
|
7668
|
+
return new Set(rows.map((row) => String(row.identity)));
|
|
7669
|
+
} catch {
|
|
7670
|
+
return /* @__PURE__ */ new Set();
|
|
7671
|
+
}
|
|
7672
|
+
}
|
|
7673
|
+
/**
|
|
7674
|
+
* @public
|
|
7675
|
+
* @author ddj 2026年10月31号
|
|
7655
7676
|
* @description: 该文件是否还有未处理的官方待审改动。缺失文件预览据此区分「需要去差异栏 Keep 结案」
|
|
7656
7677
|
* 与「记录都已处理、可直接关闭标签页」,避免已结案的删除文件继续提示待审。
|
|
7657
7678
|
* @param cwd Migrated workspace
|
|
@@ -9297,10 +9318,22 @@ function capabilityOf(entry, flags) {
|
|
|
9297
9318
|
* @author ddj 2026年10月29号
|
|
9298
9319
|
* @description: 供详情接口复用的差异构造。
|
|
9299
9320
|
* @param entry 待审条目
|
|
9321
|
+
* @param baselineEmpty 基线置空:文件由本次会话新建,旧基线只是会话自己的中间产物
|
|
9300
9322
|
* @returns 官方差异
|
|
9301
9323
|
*/
|
|
9302
|
-
function diffOf(entry) {
|
|
9303
|
-
return textDiff(entry.path, entry.path, entry.oldText, entry.newText);
|
|
9324
|
+
function diffOf(entry, baselineEmpty = false) {
|
|
9325
|
+
if (!baselineEmpty) return textDiff(entry.path, entry.path, entry.oldText, entry.newText);
|
|
9326
|
+
if (entry.newText === "") return textDiff(entry.path, entry.path, "", "");
|
|
9327
|
+
const diff = textDiff(entry.path, entry.path, "", entry.newText);
|
|
9328
|
+
if (diff.kind !== "text") return diff;
|
|
9329
|
+
return {
|
|
9330
|
+
...diff,
|
|
9331
|
+
hunks: diff.hunks.map((hunk) => ({
|
|
9332
|
+
...hunk,
|
|
9333
|
+
oldLines: 0,
|
|
9334
|
+
lines: hunk.lines.filter((line) => line !== "-")
|
|
9335
|
+
}))
|
|
9336
|
+
};
|
|
9304
9337
|
}
|
|
9305
9338
|
//#endregion
|
|
9306
9339
|
//#region src/pending/persist.ts
|
|
@@ -9560,10 +9593,11 @@ function flagsOfRow(row) {
|
|
|
9560
9593
|
* @author ddj 2026年10月29号
|
|
9561
9594
|
* @description: 统计一次差异的增删行数;非文本差异统一记 0/0。
|
|
9562
9595
|
* @param entry 待审条目
|
|
9596
|
+
* @param baselineEmpty 基线置空(新建文件按全量新增计)
|
|
9563
9597
|
* @returns 增删行数
|
|
9564
9598
|
*/
|
|
9565
|
-
function countsOf(entry) {
|
|
9566
|
-
const diff = diffOf(entry);
|
|
9599
|
+
function countsOf(entry, baselineEmpty = false) {
|
|
9600
|
+
const diff = diffOf(entry, baselineEmpty);
|
|
9567
9601
|
if (diff.kind !== "text") return {
|
|
9568
9602
|
added: 0,
|
|
9569
9603
|
deleted: 0
|
|
@@ -9633,11 +9667,12 @@ function foldWrite(stored, write) {
|
|
|
9633
9667
|
* @author ddj 2026年10月29号
|
|
9634
9668
|
* @description: 条目转列表投影,已解决条目仍保留但不可再决定。
|
|
9635
9669
|
* @param stored 条目与标记
|
|
9670
|
+
* @param baselineEmpty 基线置空(新建文件按全量新增计)
|
|
9636
9671
|
* @returns 列表项
|
|
9637
9672
|
*/
|
|
9638
|
-
function itemOf(stored) {
|
|
9673
|
+
function itemOf(stored, baselineEmpty = false) {
|
|
9639
9674
|
const { entry, flags } = stored;
|
|
9640
|
-
const counts = countsOf(entry);
|
|
9675
|
+
const counts = countsOf(entry, baselineEmpty);
|
|
9641
9676
|
const item = {
|
|
9642
9677
|
id: entry.id,
|
|
9643
9678
|
path: entry.path,
|
|
@@ -9662,12 +9697,13 @@ function itemOf(stored) {
|
|
|
9662
9697
|
* @description: 读一页待审条目,按更新时间升序;会话过滤走血缘集合。
|
|
9663
9698
|
* @param cwd 工作区
|
|
9664
9699
|
* @param sessionId 当前会话
|
|
9700
|
+
* @param wholeAdd 本次会话新建的文件身份集合,命中时基线置空
|
|
9665
9701
|
* @returns 列表
|
|
9666
9702
|
*/
|
|
9667
|
-
function loadPage(cwd, sessionId) {
|
|
9703
|
+
function loadPage(cwd, sessionId, wholeAdd) {
|
|
9668
9704
|
const all = loadEntries(cwd);
|
|
9669
9705
|
const visible = sessionId ? all.filter((stored) => stored.entry.sessionIds.includes(sessionId)) : all;
|
|
9670
|
-
const items = visible.map(itemOf);
|
|
9706
|
+
const items = visible.map((stored) => itemOf(stored, wholeAdd?.has(stored.entry.id) === true));
|
|
9671
9707
|
const gaps = [];
|
|
9672
9708
|
for (const stored of visible) if (stored.flags.oversized) gaps.push(`${stored.entry.path}: 文本超出上限,仅保留标记`);
|
|
9673
9709
|
return {
|
|
@@ -9682,14 +9718,15 @@ function loadPage(cwd, sessionId) {
|
|
|
9682
9718
|
* @description: 读单条详情,包含可交给现有面板渲染的差异与块决定。
|
|
9683
9719
|
* @param cwd 工作区
|
|
9684
9720
|
* @param id 条目身份
|
|
9721
|
+
* @param baselineEmpty 基线置空(新建文件按全量新增渲染)
|
|
9685
9722
|
* @returns 详情,条目不存在时 null
|
|
9686
9723
|
*/
|
|
9687
|
-
function loadDetail(cwd, id) {
|
|
9724
|
+
function loadDetail(cwd, id, baselineEmpty = false) {
|
|
9688
9725
|
const stored = loadEntries(cwd).find((item) => item.entry.id === id);
|
|
9689
9726
|
if (!stored) return null;
|
|
9690
|
-
const diff = diffOf(stored.entry);
|
|
9727
|
+
const diff = diffOf(stored.entry, baselineEmpty);
|
|
9691
9728
|
return {
|
|
9692
|
-
item: itemOf(stored),
|
|
9729
|
+
item: itemOf(stored, baselineEmpty),
|
|
9693
9730
|
diff,
|
|
9694
9731
|
blocks: blockStatesOf(stored.entry),
|
|
9695
9732
|
capability: capabilityOf(stored.entry, stored.flags)
|
|
@@ -10249,7 +10286,11 @@ function pendingCovers(cwd, path) {
|
|
|
10249
10286
|
* @returns 合并后的页
|
|
10250
10287
|
*/
|
|
10251
10288
|
function mergedPage(official, pending, cwd) {
|
|
10252
|
-
const covered = new Set(
|
|
10289
|
+
const covered = /* @__PURE__ */ new Set();
|
|
10290
|
+
for (const item of pending.items) {
|
|
10291
|
+
covered.add(pathKey$1(item.path));
|
|
10292
|
+
covered.add(pathKey$1(item.id));
|
|
10293
|
+
}
|
|
10253
10294
|
const kept = official.items.filter((item) => !covered.has(pathKey$1(item.currentPath)) && !covered.has(pathKey$1(item.path)));
|
|
10254
10295
|
return {
|
|
10255
10296
|
items: [...pending.items.map((item) => pendingItemOf(item, cwd)), ...kept],
|
|
@@ -16154,7 +16195,7 @@ function reviewHandlers(ctx, registry) {
|
|
|
16154
16195
|
*/
|
|
16155
16196
|
function pendingPageOf(cwd, sessionId) {
|
|
16156
16197
|
try {
|
|
16157
|
-
const page = loadPage(cwd, sessionId);
|
|
16198
|
+
const page = loadPage(cwd, sessionId, addedFiles(cwd, sessionId));
|
|
16158
16199
|
return page.items.some((item) => item.settled === true) ? {
|
|
16159
16200
|
...page,
|
|
16160
16201
|
items: page.items.filter((item) => item.settled !== true)
|
|
@@ -16201,7 +16242,8 @@ function reviewHandlers(ctx, registry) {
|
|
|
16201
16242
|
const scope = await scopeOf(args.sessionId);
|
|
16202
16243
|
const cwd = scope.cwd;
|
|
16203
16244
|
if (args.id.startsWith("pending:")) {
|
|
16204
|
-
const
|
|
16245
|
+
const entryId = args.id.slice(8);
|
|
16246
|
+
const detail = loadDetail(cwd, entryId, addedFiles(cwd, args.sessionId).has(entryId));
|
|
16205
16247
|
if (!detail) return {
|
|
16206
16248
|
ok: false,
|
|
16207
16249
|
error: "待审条目不存在"
|
|
@@ -16350,7 +16392,7 @@ function readHandlers(kit) {
|
|
|
16350
16392
|
return {
|
|
16351
16393
|
"edrv.pending.list": async (args) => {
|
|
16352
16394
|
const cwd = await kit.read(args.sessionId);
|
|
16353
|
-
const page = loadPage(cwd, args.sessionId);
|
|
16395
|
+
const page = loadPage(cwd, args.sessionId, addedFiles(cwd, args.sessionId));
|
|
16354
16396
|
for (const item of page.items) trackPendingCover(cwd, item.path, true);
|
|
16355
16397
|
return {
|
|
16356
16398
|
ok: true,
|
|
@@ -16358,7 +16400,9 @@ function readHandlers(kit) {
|
|
|
16358
16400
|
};
|
|
16359
16401
|
},
|
|
16360
16402
|
"edrv.pending.detail": async (args) => {
|
|
16361
|
-
const
|
|
16403
|
+
const cwd = await kit.read(args.sessionId);
|
|
16404
|
+
const rawId = pendingRawId(args.id);
|
|
16405
|
+
const detail = loadDetail(cwd, rawId, addedFiles(cwd, args.sessionId).has(rawId));
|
|
16362
16406
|
return detail ? {
|
|
16363
16407
|
ok: true,
|
|
16364
16408
|
detail
|