dsh-sweeper 1.5.6 → 1.5.8
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 +2 -0
- package/lib/client.js +16 -3
- package/lib/deep.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -273,6 +273,8 @@ node test/browser/check.mjs # 需要本机有 Chrome/Edge,或 CHROME=<p
|
|
|
273
273
|
|
|
274
274
|
## 边界与自保
|
|
275
275
|
|
|
276
|
+
- **读不下去的日志会被点名**:会话日志读到一半失败时会计入「N 段日志读不出来」,而不是悄悄从计划里消失。
|
|
277
|
+
- **失败不会藏在别的页签里**:扫描失败时,四个页签都会看到同一张错误卡与「重试扫描」,不会再出现「等待扫描」却永远等不到的情况。
|
|
276
278
|
- **读不到运行中的对话就不出报告**:列不出「哪些对话正在跑」时扫描直接失败并说明原因,宁可这次不扫,也不把还在用的文件列成候选。
|
|
277
279
|
- **模型被预算截断会说出来**:工具调用跑到上限、又没给出任何判定时,会退回单提示词再问一次;有判定但行被截断的行标「· 到工具上限,结论可能不全」,不会伪装成「看过了,很干净」。
|
|
278
280
|
- **动不了文件时说得清楚**:权限、占用、磁盘满这类系统错误会翻成一句话(`MOVE_ERRORS`),不再把 `EPERM` 直接丢到页面上;未列出的代码也会写成「系统拒绝了这次操作(CODE)」。
|
package/lib/client.js
CHANGED
|
@@ -1015,6 +1015,7 @@ window.__ModuleLoader__.load({
|
|
|
1015
1015
|
const startingRef = useRef(false)
|
|
1016
1016
|
|
|
1017
1017
|
const scanning = status === 'loading' || status === 'refreshing' || !!bgScan
|
|
1018
|
+
const scanFailed = status === 'error'
|
|
1018
1019
|
|
|
1019
1020
|
const load = useCallback((force, keepReview) => {
|
|
1020
1021
|
// Two quick clicks used to race: the slower response could land last and
|
|
@@ -1514,17 +1515,17 @@ window.__ModuleLoader__.load({
|
|
|
1514
1515
|
h(Stat, {
|
|
1515
1516
|
label: '无脑删', tone: 'success',
|
|
1516
1517
|
value: report ? fmtNum(report.tiers.safe.count) + ' 项' : '—',
|
|
1517
|
-
sub: report ? fmtBytes(report.tiers.safe.bytes) + ' · 可直接清理' : '等待扫描',
|
|
1518
|
+
sub: report ? fmtBytes(report.tiers.safe.bytes) + ' · 可直接清理' : (scanFailed ? '扫描失败' : '等待扫描'),
|
|
1518
1519
|
}),
|
|
1519
1520
|
h(Stat, {
|
|
1520
1521
|
label: '需要确认', tone: 'warn',
|
|
1521
1522
|
value: report ? fmtNum(report.tiers.unsure.count) + ' 项' : '—',
|
|
1522
|
-
sub: report ? fmtBytes(report.tiers.unsure.bytes) + ' · 逐项勾选' : '等待扫描',
|
|
1523
|
+
sub: report ? fmtBytes(report.tiers.unsure.bytes) + ' · 逐项勾选' : (scanFailed ? '扫描失败' : '等待扫描'),
|
|
1523
1524
|
}),
|
|
1524
1525
|
h(Stat, {
|
|
1525
1526
|
label: '受保护',
|
|
1526
1527
|
value: report ? fmtNum(report.protected.recent + report.protected.live + report.protected.tracked + (report.protected.unsafe || 0)) : '—',
|
|
1527
|
-
sub: report ? report.weekDays + ' 天内用过 / 活跃会话 / git 跟踪' : '等待扫描',
|
|
1528
|
+
sub: report ? report.weekDays + ' 天内用过 / 活跃会话 / git 跟踪' : (scanFailed ? '扫描失败' : '等待扫描'),
|
|
1528
1529
|
}),
|
|
1529
1530
|
h(Stat, {
|
|
1530
1531
|
label: '回收站',
|
|
@@ -1573,6 +1574,18 @@ window.__ModuleLoader__.load({
|
|
|
1573
1574
|
'可以离开这个页面,扫描会在后台继续;回来时接着显示进度,不会从头再来。'),
|
|
1574
1575
|
) : null,
|
|
1575
1576
|
|
|
1577
|
+
// The report panel owns the detailed error card, but a user on any other
|
|
1578
|
+
// tab used to see only "等待扫描" in the header — as if the pass had not
|
|
1579
|
+
// started yet. Name the failure wherever they are, with the same retry.
|
|
1580
|
+
scanFailed && tab !== 'report' ? h('div', { className: 'sw-card', style: { marginTop: 12, padding: '14px 16px' } },
|
|
1581
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, color: T.danger, fontWeight: 600, fontSize: 13 } },
|
|
1582
|
+
h(Icon, { name: 'alert', size: 16 }), '扫描失败'),
|
|
1583
|
+
h('div', { style: { marginTop: 6, fontSize: 12, color: T.dim, lineHeight: 1.7, wordBreak: 'break-word' } },
|
|
1584
|
+
(error || '未知错误') + '(没有文件被移动)'),
|
|
1585
|
+
h('div', { style: { marginTop: 12 } },
|
|
1586
|
+
h(Btn, { label: '重试扫描', kind: 'primary', icon: h(Icon, { name: 'refresh', size: 14 }), onClick: () => load(true), disabled: scanning })),
|
|
1587
|
+
) : null,
|
|
1588
|
+
|
|
1576
1589
|
tab === 'report' ? h(ReportPanel, {
|
|
1577
1590
|
// The banner above already explains a running pass; letting the panel
|
|
1578
1591
|
// show its own "reading logs" skeleton too reads like two scans.
|
package/lib/deep.js
CHANGED
|
@@ -110,7 +110,11 @@ async function readAll(handle, limit = 200_000) {
|
|
|
110
110
|
let off = 0
|
|
111
111
|
for (;;) {
|
|
112
112
|
let page
|
|
113
|
-
try { page = await handle.read(off, PAGE) } catch {
|
|
113
|
+
try { page = await handle.read(off, PAGE) } catch {
|
|
114
|
+
// A read that dies is not the end of the log. Callers have to be able to tell
|
|
115
|
+
// "this log is short" from "this log stopped answering halfway".
|
|
116
|
+
return { events, truncated: events.length > 0, failed: true }
|
|
117
|
+
}
|
|
114
118
|
const list = Array.isArray(page) ? page : (page && page.events) || []
|
|
115
119
|
if (!list.length) return { events, truncated: false }
|
|
116
120
|
for (const ev of list) events.push(ev)
|
|
@@ -153,6 +157,11 @@ export async function describeSession(ctx, persistence, snapshot) {
|
|
|
153
157
|
try { await handle.close() } catch { /* the host may not expose close */ }
|
|
154
158
|
}
|
|
155
159
|
const events = read.events
|
|
160
|
+
if (read.failed && !events.length) {
|
|
161
|
+
const e = new Error('unreadable session log: the first page could not be read')
|
|
162
|
+
e.code = 'SWEEPER_UNREADABLE'
|
|
163
|
+
throw e
|
|
164
|
+
}
|
|
156
165
|
if (!events.length) return null
|
|
157
166
|
|
|
158
167
|
const info = {
|