审查修复: 任务配置恢复、执行器容错与续局状态、识别性能

Browse Source
正确性
- stop_task 强杀后 run_task 的临时次数会残留在 config.yaml (AALC 中途整份存盘);
  任务启动时先落盘原值, 强停/异常退出后由 TaskRunner 用 --restore 写回,
  写回失败时拒绝启动新任务并在 task_status 显示 pending_restore
- Jev 执行器: 工具失败不再抛异常导致整局退出 (Session raise_on_error=False),
  原有的"截图暂不可用"等降级分支终于生效; 刷新计数/开战标记只在动作成功后更新
- 一局完成后归档 jev_shop_context.json, 否则 claim_requested 让下一局一启动就判定完成
- 通用按钮直接点已核对的坐标, 不再 click_text 重新搜索 (可能点到背景同名按钮)
- 认证行按字节比较, 非 ASCII 输入不再让 compare_digest 抛 TypeError
- 单实例互斥改用 use_last_error 读取 ERROR_ALREADY_EXISTS

性能
- find_image 只在窗口尺寸变化时清模板缓存 (原来每次两次全量 gc); 模板列表只扫描一次
- 截图 PNG 压缩级别 1: 1080p 存图 0.66s -> 0.19s
- 执行器每帧截图只解码一次 (button_enabled 75ms -> 0.3ms); 地图模板与 ORB 描述子按比例缓存
- 箭头模板用 imdecode 读取, 支持中文路径 (输出与 imread 逐像素一致)

测试 73 -> 84, 修改前的识别输出与修改后逐项比对一致。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yws
2026-10-03 00:31:21 +00:00
co-authored by Claude Opus 5.5
parent 5ab5fd9508
commit 030527f5de
9 changed files with 444 additions and 105 deletions
+3 -2
View File
@@ -95,8 +95,9 @@ class _Handler(socketserver.StreamRequestHandler):
def _handle_session(self):
rfile, wfile = self.rfile, self.wfile
first = rfile.readline(256).decode('utf-8', 'replace').strip()
if not (first.startswith('AUTH ') and hmac.compare_digest(first[5:], self.server.token)):
# 按字节比较: compare_digest 对含非 ASCII 字符的 str 会抛 TypeError
first = rfile.readline(256).strip()
if not (first.startswith(b'AUTH ') and hmac.compare_digest(first[5:], self.server.token.encode('ascii'))):
wfile.write(b'DENIED\n')
log('rejected connection from %s' % (self.client_address,))
return