dsh-sweeper 1.5.8 → 1.5.9
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 +1 -0
- package/lib/client.js +2 -1
- package/lib/deep.js +10 -5
- package/lib/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -273,6 +273,7 @@ node test/browser/check.mjs # 需要本机有 Chrome/Edge,或 CHROME=<p
|
|
|
273
273
|
|
|
274
274
|
## 边界与自保
|
|
275
275
|
|
|
276
|
+
- **没列出来的对话会说明**:每轮最多分析 24 段,超出的段数会写成「另有 N 段没有列出」,而不是装作全都看过。
|
|
276
277
|
- **读不下去的日志会被点名**:会话日志读到一半失败时会计入「N 段日志读不出来」,而不是悄悄从计划里消失。
|
|
277
278
|
- **失败不会藏在别的页签里**:扫描失败时,四个页签都会看到同一张错误卡与「重试扫描」,不会再出现「等待扫描」却永远等不到的情况。
|
|
278
279
|
- **读不到运行中的对话就不出报告**:列不出「哪些对话正在跑」时扫描直接失败并说明原因,宁可这次不扫,也不把还在用的文件列成候选。
|
package/lib/client.js
CHANGED
|
@@ -851,6 +851,7 @@ window.__ModuleLoader__.load({
|
|
|
851
851
|
hint: (plan.skipped
|
|
852
852
|
? '超过 ' + plan.week + ' 天未使用的 ' + plan.skipped + ' 段对话里没有留下临时产物,所以不用花 token 去问模型。'
|
|
853
853
|
: '超过 ' + plan.week + ' 天未使用、且仍然留有临时产物的对话才会出现在这里。')
|
|
854
|
+
+ (plan.more ? ' 另有 ' + plan.more + ' 段符合条件的对话没有列出(每轮有上限),下一轮「重新估算」会轮到它们。' : '')
|
|
854
855
|
+ ' 可以点「重新估算」再读一次磁盘。',
|
|
855
856
|
}) : null,
|
|
856
857
|
|
|
@@ -858,7 +859,7 @@ window.__ModuleLoader__.load({
|
|
|
858
859
|
h('div', { style: { display: 'flex', alignItems: 'center', gap: 10, padding: '11px 14px', background: T.layer, borderBottom: '1px solid ' + T.border } },
|
|
859
860
|
h('div', { style: { fontSize: 13, fontWeight: 600 } }, job && job.state !== 'running' ? '本次分析' : '待分析对话'),
|
|
860
861
|
h('span', { className: 'sw-num', style: { fontSize: 11, color: T.faint } },
|
|
861
|
-
totalN + ' 段 · ' + (job ? '本次约 ' : '预计约 ') + fmtNum(estimate) + ' tokens' + (plan && plan.skipped ? ' · ' + plan.skipped + ' 段无临时产物已跳过' : '') + (plan && plan.unreadable ? ' · ' + plan.unreadable + ' 段日志读不出来' : '')),
|
|
862
|
+
totalN + ' 段 · ' + (job ? '本次约 ' : '预计约 ') + fmtNum(estimate) + ' tokens' + (plan && plan.skipped ? ' · ' + plan.skipped + ' 段无临时产物已跳过' : '') + (plan && plan.unreadable ? ' · ' + plan.unreadable + ' 段日志读不出来' : '') + (plan && plan.more ? ' · 另有 ' + plan.more + ' 段没有列出(每次最多分析 ' + plan.sessions.length + ' 段)' : '')),
|
|
862
863
|
h('div', { style: { flex: 1 } }),
|
|
863
864
|
running ? h('span', { style: { fontSize: 11.5, color: T.accent } }, finished + ' / ' + totalN) : null,
|
|
864
865
|
),
|
package/lib/deep.js
CHANGED
|
@@ -477,7 +477,6 @@ export async function planDeep(ctx, opts = {}) {
|
|
|
477
477
|
const sessions = []
|
|
478
478
|
let skipped = 0
|
|
479
479
|
let unreadable = 0
|
|
480
|
-
let totalEstTokens = 0
|
|
481
480
|
for (const snap of list) {
|
|
482
481
|
const id = idOf(snap)
|
|
483
482
|
if (!id || liveIds.has(String(id))) continue
|
|
@@ -497,7 +496,6 @@ export async function planDeep(ctx, opts = {}) {
|
|
|
497
496
|
if (!candidates.length && !canLook) { skipped += 1; continue }
|
|
498
497
|
const digest = buildDigest(info, candidates, now, { canLook })
|
|
499
498
|
const estTokens = estimateTokens(digest) + (canLook ? 900 : 0)
|
|
500
|
-
totalEstTokens += estTokens
|
|
501
499
|
sessions.push({
|
|
502
500
|
id, title: info.title || baseOf(info.cwd || '') || id,
|
|
503
501
|
cwd: info.cwd, createdAt: info.createdAt, lastUsedAt: lastUsed,
|
|
@@ -510,10 +508,17 @@ export async function planDeep(ctx, opts = {}) {
|
|
|
510
508
|
_info: info,
|
|
511
509
|
_candidates: candidates,
|
|
512
510
|
})
|
|
513
|
-
if (sessions.length >= (opts.limit || MAX_SESSIONS)) break
|
|
514
511
|
}
|
|
515
|
-
|
|
516
|
-
|
|
512
|
+
// Rank before capping, and say how many were left out. Breaking out of the loop
|
|
513
|
+
// at the limit used to keep whatever the log listing happened to return first,
|
|
514
|
+
// and the page had no way to tell 24 of 24 from 24 of 40.
|
|
515
|
+
sessions.sort((a, b) => b.candidates - a.candidates || b.hidden - a.hidden || b.ageDays - a.ageDays)
|
|
516
|
+
const limit = opts.limit || MAX_SESSIONS
|
|
517
|
+
const more = Math.max(0, sessions.length - limit)
|
|
518
|
+
const kept = sessions.slice(0, limit)
|
|
519
|
+
// Estimate only what will actually be sent: rows the cap dropped cost nothing.
|
|
520
|
+
const totalEstTokens = kept.reduce((n, s) => n + s.estTokens, 0)
|
|
521
|
+
return { sessions: kept, more, totalEstTokens, concurrency: CONCURRENCY, week, skipped, unreadable }
|
|
517
522
|
}
|
|
518
523
|
|
|
519
524
|
/**
|
package/lib/index.js
CHANGED
|
@@ -197,6 +197,7 @@ export function apply(ctx, config = {}) {
|
|
|
197
197
|
concurrency: plan.concurrency,
|
|
198
198
|
totalEstTokens: plan.totalEstTokens,
|
|
199
199
|
skipped: plan.skipped || 0,
|
|
200
|
+
more: plan.more || 0,
|
|
200
201
|
unreadable: plan.unreadable || 0,
|
|
201
202
|
sessions: plan.sessions.map((s) => ({
|
|
202
203
|
id: s.id, title: s.title, cwd: s.cwd, ageDays: s.ageDays, toolCalls: s.toolCalls,
|