dsh-sweeper 1.5.7 → 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 +1 -0
- package/lib/deep.js +10 -1
- 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
|
+
- **读不下去的日志会被点名**:会话日志读到一半失败时会计入「N 段日志读不出来」,而不是悄悄从计划里消失。
|
|
276
277
|
- **失败不会藏在别的页签里**:扫描失败时,四个页签都会看到同一张错误卡与「重试扫描」,不会再出现「等待扫描」却永远等不到的情况。
|
|
277
278
|
- **读不到运行中的对话就不出报告**:列不出「哪些对话正在跑」时扫描直接失败并说明原因,宁可这次不扫,也不把还在用的文件列成候选。
|
|
278
279
|
- **模型被预算截断会说出来**:工具调用跑到上限、又没给出任何判定时,会退回单提示词再问一次;有判定但行被截断的行标「· 到工具上限,结论可能不全」,不会伪装成「看过了,很干净」。
|
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 = {
|