@yeaft/webchat-agent 1.0.527 → 1.0.528
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/local-runtime/version.json +1 -1
- package/package.json +1 -1
- package/yeaft/engine.js +13 -1
- package/yeaft/sub-agent/execution-control.js +16 -9
- package/yeaft/sub-agent/liveness.js +20 -12
- package/yeaft/sub-agent/runner.js +12 -15
- package/yeaft/sub-agent/status.js +5 -5
- package/yeaft/tools/activation.js +1 -1
- package/yeaft/tools/agent.js +21 -40
- package/yeaft/tools/apply-patch.js +442 -134
- package/yeaft/tools/bash.js +11 -9
- package/yeaft/tools/exit-worktree.js +1 -1
- package/yeaft/tools/file-read.js +36 -4
- package/yeaft/tools/git-read.js +29 -9
- package/yeaft/tools/list-agents.js +60 -58
- package/yeaft/tools/list-tasks.js +31 -3
- package/yeaft/tools/process-runner.js +29 -1
- package/yeaft/tools/registry.js +18 -0
- package/yeaft/tools/update-agent.js +2 -1
- package/yeaft/tools/wait-agent.js +17 -17
- package/yeaft/tools/web-fetch.js +6 -1
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* from every text_delta).
|
|
25
25
|
*
|
|
26
26
|
* Every envelope includes `outputFile` (durable per-agent JSONL log) and
|
|
27
|
-
* `liveness` (toolUseCount,
|
|
27
|
+
* `liveness` (toolUseCount, usageTokens, outputChars, msSinceLastEvent, recentTools,
|
|
28
28
|
* lastEventType) so the model can distinguish "stuck" from "still
|
|
29
29
|
* working" and can Read the log directly when it needs the full
|
|
30
30
|
* timeline.
|
|
@@ -57,10 +57,10 @@ function nextStepsFor(status, opts = {}) {
|
|
|
57
57
|
}
|
|
58
58
|
if (opts.timedOut && opts.stale) {
|
|
59
59
|
return (
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
'
|
|
60
|
+
'No observable event arrived within the diagnostic threshold. This does ' +
|
|
61
|
+
'not prove the provider or tool is dead. Do NOT keep calling WaitAgent ' +
|
|
62
|
+
'in a blind loop; inspect outputFile, then use CloseAgent only if you ' +
|
|
63
|
+
'actually intend to cancel, or report that the background task is quiet.'
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
if (opts.timedOut && opts.mustCollectReply) {
|
|
@@ -197,7 +197,7 @@ export default defineTool({
|
|
|
197
197
|
en: `Wait for a sub-agent's next state change (turn end, terminal, or wait-timeout) and retrieve a status envelope.
|
|
198
198
|
|
|
199
199
|
Returns JSON with explicit \`status\`, latest \`result\` text, \`liveness\`
|
|
200
|
-
counters (toolUseCount,
|
|
200
|
+
counters (actual toolUseCount, provider usageTokens, outputChars, msSinceLastEvent, recentTools), the
|
|
201
201
|
durable \`outputFile\` path you can Read at any time, and a status-specific
|
|
202
202
|
\`next_steps\` directive telling you what to call next.
|
|
203
203
|
|
|
@@ -214,16 +214,16 @@ Status semantics:
|
|
|
214
214
|
|
|
215
215
|
After WaitAgent returns, act on the status. A non-stale timeout after PromptAgent
|
|
216
216
|
has 'mustCollectReply=true': call WaitAgent again with a larger bounded timeout in
|
|
217
|
-
the same parent turn until idle/terminal. A stale
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
the same parent turn until idle/terminal. A stale diagnostic breaks that blind
|
|
218
|
+
wait loop but does not cancel or prove failure: inspect outputFile before deciding.
|
|
219
|
+
For ordinary SpawnAgent background work, use ListAgents or later completion
|
|
220
|
+
notifications instead of repeatedly re-waiting.
|
|
220
221
|
|
|
221
222
|
The default wait is a bounded 5000ms poll; callers may request up to 300000ms
|
|
222
|
-
(5 minutes).
|
|
223
|
-
checked after each timeout, and stale/stalled is the explicit stop condition.`,
|
|
223
|
+
(5 minutes). This caps one WaitAgent call only, not the sub-agent lifetime.`,
|
|
224
224
|
zh: `等待子 Agent 的下一次状态变更(turn 结束、终止或等待超时)并获取状态信封。
|
|
225
225
|
|
|
226
|
-
返回 JSON,含明确的 status、最新的 result 文本、liveness
|
|
226
|
+
返回 JSON,含明确的 status、最新的 result 文本、liveness 计数器(实际 toolUseCount、provider usageTokens、outputChars、
|
|
227
227
|
msSinceLastEvent、recentTools)、可随时 Read 的持久化 outputFile 路径,以及状态相关的 next_steps
|
|
228
228
|
指令告诉你下一步该调用什么。
|
|
229
229
|
|
|
@@ -237,11 +237,11 @@ msSinceLastEvent、recentTools)、可随时 Read 的持久化 outputFile 路
|
|
|
237
237
|
|
|
238
238
|
PromptAgent 后若非 stale/stalled 的有界等待超时,必须在同一父级 turn 使用更大的有界 timeout
|
|
239
239
|
再次调用 WaitAgent,直到 idle/terminal;不要改用 ListAgents/notification 丢下未收集的回复。
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
若信封显示 stale/stalled,应停止盲目等待并检查 outputFile;它只是诊断,不会取消任务,也不能证明
|
|
241
|
+
provider 或工具已经卡死。仅在确实要取消时使用 CloseAgent。
|
|
242
242
|
|
|
243
243
|
普通 SpawnAgent 异步流程仍用 ListAgents 做非阻塞状态检查,并依赖后续 completion
|
|
244
|
-
notification
|
|
244
|
+
notification;默认 5000ms、最大 300000ms 仅限制单次 WaitAgent 调用,不限制子 Agent 生命周期。`
|
|
245
245
|
},
|
|
246
246
|
parameters: {
|
|
247
247
|
type: 'object',
|
|
@@ -258,8 +258,8 @@ notification;不要对普通后台任务盲目循环等待。每次等待都
|
|
|
258
258
|
minimum: 0,
|
|
259
259
|
maximum: 300000,
|
|
260
260
|
description: {
|
|
261
|
-
en: 'Maximum
|
|
262
|
-
zh: '
|
|
261
|
+
en: 'Maximum duration of this wait call, not the sub-agent lifetime (default: 5000, max: 300000)',
|
|
262
|
+
zh: '本次等待调用的最长时间,不是子 Agent 生命周期(默认 5000,最大 300000)',
|
|
263
263
|
},
|
|
264
264
|
},
|
|
265
265
|
},
|
package/yeaft/tools/web-fetch.js
CHANGED
|
@@ -9,7 +9,12 @@ import { defineTool } from './types.js';
|
|
|
9
9
|
|
|
10
10
|
/** Strip HTML tags and normalize whitespace for readability. */
|
|
11
11
|
function htmlToText(html) {
|
|
12
|
-
|
|
12
|
+
// Remove common site chrome before applying the caller's length budget.
|
|
13
|
+
// Fall back for pages whose only content is navigation; raw/API is untouched.
|
|
14
|
+
const cleaned = html.replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi, '');
|
|
15
|
+
const withoutChrome = cleaned.replace(/<(nav|footer)\b[^>]*>[\s\S]*?<\/\1>/gi, '');
|
|
16
|
+
const source = withoutChrome.replace(/<[^>]+>/g, '').trim() ? withoutChrome : cleaned;
|
|
17
|
+
return source
|
|
13
18
|
// Remove script/style blocks
|
|
14
19
|
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
15
20
|
.replace(/<style[\s\S]*?<\/style>/gi, '')
|