agentpage 0.0.43 → 0.0.44
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/dist/index.mjs +16 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -227,17 +227,27 @@ function isPotentialDomMutation(toolName, toolInput) {
|
|
|
227
227
|
/**
|
|
228
228
|
* 判定动作是否为"确定性推进"——比 isPotentialDomMutation 更窄。
|
|
229
229
|
*
|
|
230
|
-
*
|
|
230
|
+
* 包含以下必定产生可见状态变化或属于显式用户意图的动作:
|
|
231
231
|
* - 表单输入类:fill / type / select_option / clear / check / uncheck
|
|
232
|
+
* - 键盘动作类:press(Enter 提交、Tab 切焦等均属用户显式操作)
|
|
232
233
|
* - 导航类:navigate.*
|
|
234
|
+
* - 自定义工具:非 SDK 内置工具(dom/navigate/page_info/wait/evaluate)
|
|
235
|
+
* 均由开发者注册、模型有意调用,视为确定性推进
|
|
233
236
|
*
|
|
234
237
|
* click 不在此列——因为 click 可能点了但完全没效果(如点击无 click listener 的元素)。
|
|
235
238
|
*
|
|
236
|
-
*
|
|
239
|
+
* 用途:协议缺失计数重置与豁免。仅当本轮有"确定性推进"时才重置协议缺失计数器,
|
|
237
240
|
* 避免模型反复点击无效目标导致死循环。
|
|
238
241
|
*/
|
|
239
242
|
function isConfirmedProgressAction(toolName, toolInput) {
|
|
240
243
|
if (toolName === "navigate") return true;
|
|
244
|
+
if (![
|
|
245
|
+
"dom",
|
|
246
|
+
"navigate",
|
|
247
|
+
"page_info",
|
|
248
|
+
"wait",
|
|
249
|
+
"evaluate"
|
|
250
|
+
].includes(toolName)) return true;
|
|
241
251
|
if (toolName !== "dom") return false;
|
|
242
252
|
const action = getToolAction(toolInput);
|
|
243
253
|
if (!action) return false;
|
|
@@ -247,7 +257,8 @@ function isConfirmedProgressAction(toolName, toolInput) {
|
|
|
247
257
|
"select_option",
|
|
248
258
|
"clear",
|
|
249
259
|
"check",
|
|
250
|
-
"uncheck"
|
|
260
|
+
"uncheck",
|
|
261
|
+
"press"
|
|
251
262
|
].includes(action);
|
|
252
263
|
}
|
|
253
264
|
/**
|
|
@@ -1029,9 +1040,8 @@ async function executeAgentLoop(params) {
|
|
|
1029
1040
|
if (nextByHeuristic !== remainingInstruction) {
|
|
1030
1041
|
remainingInstruction = nextByHeuristic;
|
|
1031
1042
|
consecutiveNoProtocolRounds = 0;
|
|
1032
|
-
} else if (executedTaskCalls.length > 0)
|
|
1033
|
-
|
|
1034
|
-
}
|
|
1043
|
+
} else if (executedTaskCalls.length > 0) if (!roundHasConfirmedProgress || roundHasError) consecutiveNoProtocolRounds += 1;
|
|
1044
|
+
else consecutiveNoProtocolRounds = 0;
|
|
1035
1045
|
}
|
|
1036
1046
|
previousRoundModelOutput = parsedInstructionState.hasRemainingProtocol ? normalizeModelOutput(response.text) : `REMAINING: ${remainingInstruction || "DONE"}`;
|
|
1037
1047
|
lastRoundHadError = roundHasError;
|