dsh-sweeper 1.5.4 → 1.5.5
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/agent.js +5 -1
- package/lib/client.js +2 -1
- package/lib/deep-agent.js +2 -0
- package/lib/deep.js +3 -0
- package/lib/index.js +2 -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
|
+
- **模型被预算截断会说出来**:工具调用跑到上限、又没给出任何判定时,会退回单提示词再问一次;有判定但行被截断的行标「· 到工具上限,结论可能不全」,不会伪装成「看过了,很干净」。
|
|
276
277
|
- **动不了文件时说得清楚**:权限、占用、磁盘满这类系统错误会翻成一句话(`MOVE_ERRORS`),不再把 `EPERM` 直接丢到页面上;未列出的代码也会写成「系统拒绝了这次操作(CODE)」。
|
|
277
278
|
- **重新扫描不会打断正在跑的深度分析**:报告换了,但运行中的那一轮继续,页面继续轮询;结果里的每个路径在移动前都会对磁盘重新校验。
|
|
278
279
|
- **模型读报告期间如果你重扫了**,这一轮复核会被丢弃并返回 409,什么都不移动——判定针对的是你刚才看的那份报告。
|
package/lib/agent.js
CHANGED
|
@@ -83,7 +83,7 @@ export async function runAgentLoop(ctx, opts) {
|
|
|
83
83
|
}]
|
|
84
84
|
|
|
85
85
|
const trace = []
|
|
86
|
-
const summary = { turns: 0, calls: 0, text: '', finished: false }
|
|
86
|
+
const summary = { turns: 0, calls: 0, text: '', finished: false, exhausted: null }
|
|
87
87
|
try {
|
|
88
88
|
for (let turn = 0; turn < maxTurns; turn += 1) {
|
|
89
89
|
// One prepared call per turn: the host marks a prepared call dispatched
|
|
@@ -124,6 +124,7 @@ export async function runAgentLoop(ctx, opts) {
|
|
|
124
124
|
})
|
|
125
125
|
for (const block of calls) {
|
|
126
126
|
if (summary.calls >= maxCalls) {
|
|
127
|
+
summary.exhausted = summary.exhausted || 'calls'
|
|
127
128
|
messages.push(toolMessage(block.id, 'tool call budget for this conversation is used up; answer with what you have', true))
|
|
128
129
|
continue
|
|
129
130
|
}
|
|
@@ -166,6 +167,9 @@ export async function runAgentLoop(ctx, opts) {
|
|
|
166
167
|
clearTimeout(timer)
|
|
167
168
|
if (external && typeof external.removeEventListener === 'function') external.removeEventListener('abort', onAbort)
|
|
168
169
|
}
|
|
170
|
+
// A loop that ran out of turns never got a chance to answer; the caller has
|
|
171
|
+
// to say so, or a budget cut looks exactly like "found nothing".
|
|
172
|
+
if (!summary.finished) summary.exhausted = summary.exhausted || 'turns'
|
|
169
173
|
return { ...summary, trace }
|
|
170
174
|
}
|
|
171
175
|
|
package/lib/client.js
CHANGED
|
@@ -127,6 +127,7 @@ window.__ModuleLoader__.load({
|
|
|
127
127
|
[/batch is busy/i, '这个批次正在被恢复或删除,稍等一下'],
|
|
128
128
|
[/bad batch id/i, '批次号不合法'],
|
|
129
129
|
[/already gone/i, '这一批已经被删掉了(可能是另一个标签页刚删的)'],
|
|
130
|
+
[/the model used its tool budget without answering/i, '模型把工具调用次数用完了,还没给出结论'],
|
|
130
131
|
[/the folder for that file is gone/i, '原来的文件夹已经不在了,文件还在回收站里'],
|
|
131
132
|
[/permission denied while moving the file/i, '系统不让动这个文件(可能被程序占用,或被安全软件拦住)'],
|
|
132
133
|
[/the file is still open by another program/i, '还有程序在用这个文件,关掉它再试'],
|
|
@@ -874,7 +875,7 @@ window.__ModuleLoader__.load({
|
|
|
874
875
|
+ (s.hidden ? '(另有 ' + fmtNum(s.hidden) + ' 个没发送给模型)' : '')),
|
|
875
876
|
),
|
|
876
877
|
s.error ? h('div', { title: s.error, style: { fontSize: 10.5, color: T.danger, maxWidth: 220, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' } }, s.error) : null,
|
|
877
|
-
s.status === 'done' ? h('span', { className: 'sw-num', style: { fontSize: 11, color: T.faint } }, (s.ms ? (s.ms / 1000).toFixed(1) + 's' : '') + (s.calls ? ' · 工具 ' + s.calls + ' 次' : '') + (s.found ? ' · ' + s.found + ' 项' : '')) : null,
|
|
878
|
+
s.status === 'done' ? h('span', { className: 'sw-num', style: { fontSize: 11, color: T.faint } }, (s.ms ? (s.ms / 1000).toFixed(1) + 's' : '') + (s.calls ? ' · 工具 ' + s.calls + ' 次' : '') + (s.found ? ' · ' + s.found + ' 项' : '') + (s.cutShort ? ' · 到工具上限,结论可能不全' : '')) : null,
|
|
878
879
|
h(Chip, { tone: toneOf(s.status), dot: s.status === 'running' }, statusOf(s.status)),
|
|
879
880
|
))),
|
|
880
881
|
) : null,
|
package/lib/deep-agent.js
CHANGED
|
@@ -83,6 +83,8 @@ export async function auditWithTools(ctx, info, digest, opts = {}) {
|
|
|
83
83
|
verdict: parseVerdict(result.text),
|
|
84
84
|
turns: result.turns,
|
|
85
85
|
calls: result.calls,
|
|
86
|
+
finished: result.finished === true,
|
|
87
|
+
exhausted: result.exhausted || null,
|
|
86
88
|
ms: Date.now() - started,
|
|
87
89
|
trace: result.trace,
|
|
88
90
|
text: result.text,
|
package/lib/deep.js
CHANGED
|
@@ -573,10 +573,13 @@ export async function runDeep(ctx, sessions, opts = {}) {
|
|
|
573
573
|
deny: [dshHome(), trashRoot()],
|
|
574
574
|
})
|
|
575
575
|
const verdict = audited.verdict
|
|
576
|
+
const decided = (verdict.sweep || []).length + (verdict.optional || []).length + (verdict.keep || []).length
|
|
577
|
+
if (!audited.finished && decided === 0) throw new Error('the model used its tool budget without answering')
|
|
576
578
|
return {
|
|
577
579
|
ok: true,
|
|
578
580
|
parsed: verdict,
|
|
579
581
|
agent: true,
|
|
582
|
+
cutShort: !audited.finished,
|
|
580
583
|
turns: audited.turns,
|
|
581
584
|
calls: audited.calls,
|
|
582
585
|
ms: audited.ms,
|
package/lib/index.js
CHANGED
|
@@ -230,7 +230,7 @@ export function apply(ctx, config = {}) {
|
|
|
230
230
|
id, title: s.title, cwd: s.cwd, ageDays: s.ageDays, toolCalls: s.toolCalls,
|
|
231
231
|
candidates: s.candidates, hidden: s.hidden || 0, truncated: !!s.truncated,
|
|
232
232
|
estTokens: s.estTokens, status: s.status,
|
|
233
|
-
agent: s.agent === true, turns: s.turns || 0, calls: s.calls || 0,
|
|
233
|
+
agent: s.agent === true, turns: s.turns || 0, calls: s.calls || 0, cutShort: s.cutShort === true,
|
|
234
234
|
ms: s.ms, error: s.error, found: s.items.length,
|
|
235
235
|
debug: job.debug ? s.debug : undefined,
|
|
236
236
|
}
|
|
@@ -695,6 +695,7 @@ export function apply(ctx, config = {}) {
|
|
|
695
695
|
row.agent = payload.agent === true
|
|
696
696
|
row.turns = payload.turns || 0
|
|
697
697
|
row.calls = payload.calls || 0
|
|
698
|
+
row.cutShort = payload.cutShort === true
|
|
698
699
|
row.ms = payload.ms || 0
|
|
699
700
|
row.estTokens = payload.estTokens || row.estTokens
|
|
700
701
|
job.done += 1
|