Author SHA1 Message Date
ywsandClaude Opus 5.5 dd4259d41b 实验: 编队列表滑动补丁重写 (默认关闭, LCP_TEAM_SCROLL_PATCH=1 启用)
替代 66418dc 中的版本, 只验证"Windows 缺少队伍拖拽规避"这一假设:
- 几何/行程沿用 AALC build_windows_scroll_swipe_plan, 不改变 Windows 翻页标定
  (原版两端各加 60px escape);
- 参照 MuMu 在脱离段后保持 0.1s、松手前停稳 0.5s;
- 显式等待驱动分段移动: 原版后台每段 duration<0.01s, AALC _mouse_move_to
  步数为 0, 一个移动事件都不发; 前台关闭 pyautogui 默认 0.1s 停顿
  (原版单次滑动约 4.4s);
- 默认不安装, 需实机在编队界面验证后再决定是否默认开启。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 03:58:35 +00:00
10 changed files with 279 additions and 377 deletions
+9
View File
@@ -89,6 +89,14 @@ codex mcp add limbus --env PYTHONUTF8=1 -- D:\lc-mcp\vendor\aalc\.venv\Scripts\p
`超出最大尝试次数,未能进入战斗`)后仍会继续跑完并正常退出,所以 `task_status` `超出最大尝试次数,未能进入战斗`)后仍会继续跑完并正常退出,所以 `task_status`
会把日志尾部的 `[ERROR]`/异常行放进 `errors` 字段:**看到 `succeeded` 也要先看 `errors`。** 会把日志尾部的 `[ERROR]`/异常行放进 `errors` 字段:**看到 `succeeded` 也要先看 `errors`。**
### 实验:编队列表滑动补丁(默认关闭)
AALC 基类允许适配器覆盖 `mouse_swipe_for_team_scroll`“以规避队伍拖拽判定”,上游只有 MuMu 实现了。
`lc_mcp/aalc_input_patch.py` 在 Windows 前台/后台适配器上补了一个最小版本:几何与行程沿用 AALC 的
`build_windows_scroll_swipe_plan`(不改变 Windows 翻页标定),脱离段后保持 0.1 秒、松手前停稳 0.5 秒。
是否真有队伍被拖乱的问题尚无实机证据,所以默认不启用。验证方法:给常驻服务设置环境变量
`LCP_TEAM_SCROLL_PATCH=1` 后重启服务,跑一次需要选队的日常任务,核对选中的队伍、编队人数以及 `task_status` 的 `errors`。
## 环境变量 ## 环境变量
| 变量 | 默认 | 说明 | | 变量 | 默认 | 说明 |
@@ -96,6 +104,7 @@ codex mcp add limbus --env PYTHONUTF8=1 -- D:\lc-mcp\vendor\aalc\.venv\Scripts\p
| `AALC_DIR` | `vendor/aalc` | 使用其他位置的 AALC 源码 | | `AALC_DIR` | `vendor/aalc` | 使用其他位置的 AALC 源码 |
| `LCP_PORT` | 8765 | 服务/bridge 端口 | | `LCP_PORT` | 8765 | 服务/bridge 端口 |
| `LCP_KEEP_SHOTS` | 30 | 截图保留张数 | | `LCP_KEEP_SHOTS` | 30 | 截图保留张数 |
| `LCP_TEAM_SCROLL_PATCH` | 未设置 | 设为 `1` 启用实验性的编队列表滑动补丁 |
## 开发 / 测试 ## 开发 / 测试
-75
View File
@@ -1,75 +0,0 @@
# Jev deployment and live mirror controller feedback (2026-10-03)
This is a live deployment record, not a completed speedrun claim. Run
`mirror_20261003_142030` started at `2026-10-03T14:20:30.186+08:00`.
The timer includes English UI compatibility work and all interruptions.
## Deployment
- Updated main from `97eca20` to `95ae060`, preserving local AALC files.
- Restarted `LcMCPServer` and validated a fresh MCP session, screenshot/OCR,
and idle AALC task state. The desktop's old exposed transport stayed closed;
fresh subprocess MCP sessions work without another desktop restart.
- The runtime launcher now imports the repository controller and matching
modules instead of retaining an older independent script copy.
- Configured the actual `jev-1.13-free` choice endpoint at
`https://opencode.ai/zen/v1/systemone`. Credentials stay in private runtime
configuration and are excluded from this repository and feedback.
- An isolated identical route probe took 5468 ms with curl and 1859 ms with
urllib. Switched the live configuration to urllib. Actual subsequent route
calls included 1313 and 1484 ms; there are also slow requests and timeouts.
The isolated probe is not counted as a live game decision.
## Live findings and repairs
1. The restarted Steam game uses English labels. Added controller-side label
compatibility for entry, gift selection, event choices, judgement and
confirmation boundaries. Preserve the original OCR text for diagnostics.
2. `Receive` incorrectly matched the old substring check for `REC`, causing
unnecessary event advancement. Match the recording label exactly.
3. English OCR merges adjacent `Very High` labels. Derive separate explicit
rate spans; normalization is idempotent and does not invent a high rate
where OCR only says low or normal.
4. English event outcome text was offered as clickable choices. Exclude
`check`, `gain` and E.G.O Gift description lines from event buttons.
5. Repeated generic confirmation requests added API latency. Execute a sole
validated confirmation directly. Route and branch choices still use Jev.
6. Route and sinner API requests now contain current relevant observations,
rather than unrelated entry, fusion and party setup requirements.
7. Sinner candidates are constrained to the explicitly highest visible rate;
explicit OCR rates precede ambiguous colour-only candidates. The log saves
the provider's scored candidate scope. Zeros outside that scope represent
constraints, not extra probabilities returned by the API.
8. Initial candidate pruning caused a probability-set validation error. Fixed
the adaptation between scoped provider probabilities and router validation,
and added an integration regression test.
9. An enabled Commence button initially competed with sinner selection, causing
repeated selection. An enabled judgement button now takes priority.
10. Enter sometimes fails on event judgement. Added the actual observed button
as its mouse fallback. The original fallback list omitted judgement.
11. A changing event video clock reset repeat detection. Ignore both colon and
decimal clock formats when detecting unsuccessful confirmations.
12. After combat, OCR read the map heading as `Exploring Floor` or
`Exploring FloorT` without a valid digit. The old normalizer failed to mark
this as a map, so P/Enter batches continued on the map for several minutes.
Recognize the map heading independently of its floor number and retain
the previously known floor. Added a regression against continuing battle.
## Progress verified so far
- Entry blessings: base 1, 3 and 10; no enhanced blessings.
- Starter gifts: Barbed Lasso and Fluorescent Lamp.
- Actual Battery and permitted Thunderbranch obtained.
- Floor 1 pack: Nest, Workshop, and Technology, with Talisman Bundle in the
displayed clear rewards. One pack refresh was used before finding it.
- Kept the user's seven-character preset and used Enter to enter combat.
- First battle completed, then two event nodes completed. At 15:27 the
controller entered another battle using its P/Enter macro.
- No final reward or dungeon completion has been verified in this record.
The preceding interruptions do not qualify as a successful fast run.
The controller sends background game inputs. There is one game executor;
root interventions occur only after it hands off or stops. Battle batches
use P/Enter, and deterministic confirmations and event advancement avoid
per-key model decisions. Each action and timing remains in the private
runtime JSONL log; no provider key is written into it.
+3
View File
@@ -43,6 +43,9 @@ def bootstrap():
from module.logger.my_log import Logger from module.logger.my_log import Logger
Logger() Logger()
_booted = d _booted = d
# 实验: 编队列表滑动补丁, 仅在 LCP_TEAM_SCROLL_PATCH=1 时安装 (见 aalc_input_patch)
from . import aalc_input_patch
aalc_input_patch.install()
return d return d
+100
View File
@@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
"""编队列表滑动补丁 (实验, 默认关闭; LCP_TEAM_SCROLL_PATCH=1 启用)。
AALC 基类注释说 ``mouse_swipe_for_team_scroll`` 可由适配器覆盖"以规避队伍拖拽判定",
上游只有 MuMu 覆盖了它, Windows 前台/后台沿用普通列表手势。是否因此误触发队伍拖拽
尚无实机证据 (2026-10-03 的记录未在编队界面复测), 所以这里只做最小改动来验证:
- 几何与行程完全沿用 AALC 的 ``build_windows_scroll_swipe_plan``,
不改变 AALC 为 Windows 标定的翻页距离;
- 参照 MuMu, 脱离段后保持 0.1s 让游戏先认定为滚动, 松手前停稳 0.5s;
- 分段移动用显式等待驱动, 不经过适配器的 duration 参数
(BackgroundInput 在 duration < 0.01s 时步数为 0, 不发任何移动事件),
前台关闭 pyautogui 每次调用后默认的 0.1s 停顿。
"""
import os
import time
ENV_FLAG = 'LCP_TEAM_SCROLL_PATCH'
ESCAPE_HOLD_SECONDS = 0.1 # MUMU_TEAM_SCROLL_ESCAPE_HOLD_DURATION
SETTLE_SECONDS = 0.5 # MUMU_TEAM_SCROLL_SETTLE_DURATION
STEP_SECONDS = 0.01 # 与 AALC _mouse_move_to 的步长一致
def _plan(x, y, dx, dy, duration):
from module.automation.input_handlers.scroll_swipe import build_windows_scroll_swipe_plan
plan, settle = build_windows_scroll_swipe_plan(x, y, dx, dy, duration)
return plan, max(settle, SETTLE_SECONDS) if len(plan) > 1 else 0
def run_plan(plan, settle, press, move, release, sleep=None):
"""按计划拖动: 每段按耗时均匀插值, 每个插值点之间显式等待。
plan 元素为 (终点, 到达该点前的耗时); 第一段之后(脱离段)保持一小会儿。"""
sleep = sleep or time.sleep
position = plan[0][0]
press(position)
try:
for index, (point, duration) in enumerate(plan[1:]):
steps = max(1, round(duration / STEP_SECONDS))
for k in range(1, steps + 1):
ratio = k / steps
move((position[0] + (point[0] - position[0]) * ratio,
position[1] + (point[1] - position[1]) * ratio))
if duration > 0:
sleep(duration / steps)
position = point
if index == 0 and len(plan) > 2:
sleep(ESCAPE_HOLD_SECONDS)
if settle:
sleep(settle)
finally:
release(position)
def _foreground_team_scroll(self, x, y, duration=0.3, dx=0, dy=0, move_back=True):
import pyautogui
restore = self.get_mouse_position() if move_back else None
plan, settle = _plan(x, y, dx, dy, duration)
def screen(point):
return tuple(int(round(v)) for v in self.pos_offset(*point))
def press(point):
pyautogui.moveTo(*screen(point), _pause=False)
pyautogui.mouseDown(_pause=False)
run_plan(plan, settle, press,
lambda point: pyautogui.moveTo(*screen(point), _pause=False),
lambda point: pyautogui.mouseUp(*screen(point), _pause=False))
if restore:
self.mouse_move(restore)
def _background_team_scroll(self, x, y, duration=0.3, dx=0, dy=0, move_back=True):
restore = self.get_mouse_position() if move_back else None
plan, settle = _plan(x, y, dx, dy, duration)
def press(point):
self.set_mouse_pos(*point)
self.set_active()
self.mouse_down(*point)
run_plan(plan, settle, press,
lambda point: self.set_mouse_pos(*point),
lambda point: self.mouse_up(*point))
if restore:
self.mouse_move(restore)
def install(force=False):
"""给 Windows 前台/后台适配器装上编队滑动 (幂等)。未设 LCP_TEAM_SCROLL_PATCH=1 时不做任何事。"""
if not force and os.environ.get(ENV_FLAG) != '1':
return []
from module.automation.input_handlers import input as input_module
patched = []
for name, impl in (('Input', _foreground_team_scroll), ('BackgroundInput', _background_team_scroll)):
cls = getattr(input_module, name, None)
if cls is not None and cls.__dict__.get('mouse_swipe_for_team_scroll') is not impl:
cls.mouse_swipe_for_team_scroll = impl
patched.append(name)
return patched
+1 -3
View File
@@ -29,7 +29,6 @@ class Decision:
model: str | None = None model: str | None = None
fallback_reason: str | None = None fallback_reason: str | None = None
failed_jev_ms: int | None = None failed_jev_ms: int | None = None
candidate_scope: list | None = None
def _answer(answer, options): def _answer(answer, options):
@@ -91,8 +90,7 @@ class DecisionRouter:
answer = self.jev_decider(self.config, state, options, recent) answer = self.jev_decider(self.config, state, options, recent)
choice, latency, confidence, probabilities, returned_model = _answer(answer, options) choice, latency, confidence, probabilities, returned_model = _answer(answer, options)
return Decision(choice, 'jev', latency, jev_ms=latency, confidence=confidence, return Decision(choice, 'jev', latency, jev_ms=latency, confidence=confidence,
probabilities=probabilities, model=returned_model or model, probabilities=probabilities, model=returned_model or model)
candidate_scope=answer.get('candidate_scope') if isinstance(answer, dict) else None)
except urllib.error.HTTPError as error: except urllib.error.HTTPError as error:
reason = 'jev_http_%d' % error.code reason = 'jev_http_%d' % error.code
except (OSError, TimeoutError, ValueError) as error: except (OSError, TimeoutError, ValueError) as error:
+14 -86
View File
@@ -12,7 +12,6 @@ from game_scenes import battle_is_terminal, battle_is_visible, death_retry_scree
from run_state import prepare_run, save_json, record_claim, claim_is_current, complete_run from run_state import prepare_run, save_json, record_claim, claim_is_current, complete_run
from decision_router import DecisionRouter, DecisionRequired from decision_router import DecisionRouter, DecisionRequired
from jev_client import request_answer from jev_client import request_answer
from lc_scene_aliases import normalize
REPO_ROOT = Path(__file__).resolve().parents[1] REPO_ROOT = Path(__file__).resolve().parents[1]
MIRROR_ASSETS = REPO_ROOT / 'vendor' / 'aalc' / 'assets' / 'images' / 'default' / 'share' / 'mirror' MIRROR_ASSETS = REPO_ROOT / 'vendor' / 'aalc' / 'assets' / 'images' / 'default' / 'share' / 'mirror'
@@ -27,7 +26,6 @@ SYSTEM_RULES = (
'事件当前有“选择后获得”且无需判定、无需战斗的选项时直接选择它,不反复滚动;避开写着战斗胜利后的选项。' '事件当前有“选择后获得”且无需判定、无需战斗的选项时直接选择它,不反复滚动;避开写着战斗胜利后的选项。'
'确定确认/进入/开始战斗直接执行。地图优先可达事件和商店,减少战斗。' '确定确认/进入/开始战斗直接执行。地图优先可达事件和商店,减少战斗。'
'选好路线直接回车进入,关卡编队界面也直接回车开战;保留原编队,不再检查人员。' '选好路线直接回车进入,关卡编队界面也直接回车开战;保留原编队,不再检查人员。'
'候选路线已由程序核对可达和节点类型,无需再确认已完成的开局配置。多个同类型节点都可达时默认正前方,不因没有事件节点而要求分析。'
'保留当前编队。开局三级饰品三选一必须选择标准负载电池,再确认领取;不能当成额外观测拒绝。' '保留当前编队。开局三级饰品三选一必须选择标准负载电池,再确认领取;不能当成额外观测拒绝。'
'成捆的符咒++、标准负载电池和鸡胸为核心,保留不可出售或合成;仅略过单独的额外观测。其他苦难避开敌方体力上限和防御等级。' '成捆的符咒++、标准负载电池和鸡胸为核心,保留不可出售或合成;仅略过单独的额外观测。其他苦难避开敌方体力上限和防御等级。'
'3层起辛克莱1换3,黑兽奥提斯2换3,其他出战1换3。只在商店强化饰品。' '3层起辛克莱1换3,黑兽奥提斯2换3,其他出战1换3。只在商店强化饰品。'
@@ -43,13 +41,6 @@ def text_items(state):
return state.get('items') or [] return state.get('items') or []
def scene_fingerprint(state):
"""Ignore changing clocks and counters when checking failed confirmations."""
return tuple(item['text'] for item in text_items(state)
if item.get('score', 0) > .93
and not re.fullmatch(r'[0-9:.]+', item['text'].replace(' ', '')))
_SCREEN_CACHE = {} _SCREEN_CACHE = {}
@@ -243,7 +234,7 @@ def candidates(state, previous_battle=False, refresh_used=0):
'y': item['y'] + item['h']//2}}, 'y': item['y'] + item['h']//2}},
} }
return options return options
if any(re.fullmatch(r'REC[●.]*', t, re.I) for t in texts) and '选项' not in texts and not any(t in combined for t in ('选择一位罪人', '进行判定', '判定成功', '判定失败', '结果')): if any('REC' in t.upper() for t in texts) and '选项' not in texts and not any(t in combined for t in ('选择一位罪人', '进行判定', '判定成功', '判定失败', '结果')):
options['event_advance'] = {'description':'事件选项已经确定,按回车快速推进后续文本。', 'action':{'tool':'advance_dialog','args':{'presses':5}}} options['event_advance'] = {'description':'事件选项已经确定,按回车快速推进后续文本。', 'action':{'tool':'advance_dialog','args':{'presses':5}}}
return options return options
if '应该让谁' in combined and '选择一位罪人' not in combined and '进行判定' not in combined: if '应该让谁' in combined and '选择一位罪人' not in combined and '进行判定' not in combined:
@@ -525,14 +516,10 @@ def candidates(state, previous_battle=False, refresh_used=0):
options['button_%d' % index] = { options['button_%d' % index] = {
'description': '当前可见且非灰色按钮:%s;点击 OCR 中心。' % label, 'description': '当前可见且非灰色按钮:%s;点击 OCR 中心。' % label,
# 直接点已核对过的这一项: 重新按文字搜索要多一次截图+OCR, 还可能命中背景里的同名按钮 # 直接点已核对过的这一项: 重新按文字搜索要多一次截图+OCR, 还可能命中背景里的同名按钮
'action': ({'tool': 'keypress', 'args': {'key': 'enter'}} if label in ('进入', '开始战斗', '进行判定') 'action': ({'tool': 'keypress', 'args': {'key': 'enter'}} if label in ('进入', '开始战斗')
else {'tool': 'click', 'args': {'x': item['x'] + item['w']//2, else {'tool': 'click', 'args': {'x': item['x'] + item['w']//2,
'y': item['y'] + item['h']//2}}), 'y': item['y'] + item['h']//2}}),
} }
if options['button_%d' % index]['action']['tool'] == 'keypress':
options['button_%d' % index]['fallback_action'] = {
'tool': 'click', 'args': {'x': item['x'] + item['w']//2,
'y': item['y'] + item['h']//2}}
if (not battle and not in_shop and state.get('screen', {}).get('path') if (not battle and not in_shop and state.get('screen', {}).get('path')
and Path(state['screen']['path']).is_file() and Path(state['screen']['path']).is_file()
and not any(t in combined for t in ('确认', '继续', '获得E.G.O', 'SKIP', '选项'))): and not any(t in combined for t in ('确认', '继续', '获得E.G.O', 'SKIP', '选项'))):
@@ -571,9 +558,7 @@ def candidates(state, previous_battle=False, refresh_used=0):
} }
for index, item in enumerate(items): for index, item in enumerate(items):
if item['x'] > width * 0.52 and height * 0.23 < item['y'] < height * 0.75 and item['h'] > height * 0.025 and item.get('score', 0) > 0.93: if item['x'] > width * 0.52 and height * 0.23 < item['y'] < height * 0.75 and item['h'] > height * 0.025 and item.get('score', 0) > 0.93:
if (not any(t in item['text'] for t in ('判定', '获得', '成功', '全体', '战斗胜利')) if not any(t in item['text'] for t in ('判定', '获得', '成功', '全体', '战斗胜利')):
and not re.search(r'check\b|\bgain\b|\be\.?g\.?o\.?\s*gift|(?:advantage|guilt)check',
item['text'], re.I)):
outcome = ';'.join(i['text'] for i in items if i['x'] > width*.52 outcome = ';'.join(i['text'] for i in items if i['x'] > width*.52
and item['y']+item['h'] < i['y'] < item['y']+height*.085) and item['y']+item['h'] < i['y'] < item['y']+height*.085)
options['event_%d' % index] = {'description': '当前事件选项:' + item['text'] + ';结果:' + outcome, options['event_%d' % index] = {'description': '当前事件选项:' + item['text'] + ';结果:' + outcome,
@@ -582,69 +567,16 @@ def candidates(state, previous_battle=False, refresh_used=0):
def decide(cfg, state, options, recent): def decide(cfg, state, options, recent):
actions = [key for key in options if key not in ('wait', 'requires_analysis')] description = ('目标:按用户已配置的队伍和速通规则推进当前镜牢。当前楼层:%s\n当前游戏 OCR(坐标仅供辨识):\n' % state.get('floor', '尚未识别') +
route_scene = actions and all(key.startswith('route_') for key in actions) '\n'.join('%s @%d,%d' % (i['text'], i['x'], i['y']) for i in text_items(state)
sinner_scene = actions and all(key.startswith(('sinner_', 'button_')) for key in actions) and any(key.startswith('sinner_') for key in actions) if not i['text'].upper().startswith('STEAM')) +
if route_scene or sinner_scene: '\n截图视觉与可用控件观察(不是预先做出的决定):\n' +
permitted = options '\n'.join(val['description'] for key,val in options.items() if key != 'requires_analysis') +
if sinner_scene: '\n最近动作和执行结果:' + json.dumps(recent[-4:], ensure_ascii=False))
# All explicit maximum-probability cards are legal. An uncertain
# colour-only estimate must not compete with an OCR-labelled rate.
rated = [(key, re.search(r'预计成功率(极高|非常高|高)', options[key]['description']))
for key in actions if key.startswith('sinner_')]
rated = [(key, match[1]) for key, match in rated if match]
if rated:
best = 0 if any(rate != '高' for _, rate in rated) else 1
permitted = {key: options[key] for key, rate in rated
if (0 if rate != '高' else 1) == best}
# These candidates have already been validated against the live scene.
# Party setup, gifts and fusion do not affect this immediate choice.
instructions = (
'目标是最快完成镜牢,只选择所给候选。候选已核对当前画面,不需要再次核对编队或开局配置。'
+ ('地图优先商店、事件,再普通战斗,避免精英或集中战斗。同类型默认正前方 route_d;没有事件也直接选择可达战斗。'
if route_scene else
'当前是事件判定。已有进行判定按钮则选择该按钮;否则选择明确标注极高成功率的 sinner 候选,极高优于高;同档任选一个。不需要额外角色技能信息。')
+ '仅在候选互相矛盾或没有有效动作时选择 requires_analysis。')
scene = ('镜牢地图,当前高亮可达节点如下:' if route_scene else '事件选择罪人界面,已识别当前可选择的罪人和成功率如下:')
description = scene + ';'.join(options[key]['description'] for key in actions)
answer = request_answer(cfg, description,
{key: val['description'] for key, val in permitted.items()}, instructions)
if permitted is not options and answer.get('probabilities') is not None:
# The provider only scored permitted cards. The surrounding router
# validates a distribution across its original candidate set.
answer['candidate_scope'] = list(permitted)
answer['probabilities'] = {key: answer['probabilities'].get(key, 0) for key in options}
return answer
description = ('当前楼层:%s\n当前游戏文字:\n' % state.get('floor', '尚未识别') +
'\n'.join(dict.fromkeys(i['text'] for i in text_items(state)
if not i['text'].upper().startswith('STEAM'))) +
'\n最近执行结果:' + json.dumps(recent[-2:], ensure_ascii=False))
return request_answer(cfg, description, return request_answer(cfg, description,
{key: val['description'] for key, val in options.items()}, SYSTEM_RULES) {key: val['description'] for key, val in options.items()}, SYSTEM_RULES)
def unambiguous_routine(options):
"""Execute one validated confirmation; choices still go through the model."""
judges = [key for key, value in options.items() if key.startswith('button_')
and '进行判定' in value['description']]
if len(judges) == 1:
return judges[0]
actions = [key for key in options if key not in ('wait', 'requires_analysis')]
if len(actions) != 1:
return None
key = actions[0]
safe = ('modal_confirm', 'select_startup_battery', 'confirm_startup_battery',
'confirm_thunderbranch', 'confirm_reward', 'hardship_confirm',
'confirm_swap', 'buy_swap', 'claim_final', 'run_complete', 'retry_network')
if key in safe:
return key
if key.startswith('button_') and options[key]['action']['tool'] in ('click', 'keypress'):
description = options[key]['description']
if any(label in description for label in ('确认', '继续', '进入', '开始战斗', '离开', '下一层', '进行判定')):
return key
return None
def fixed_fallback(options): def fixed_fallback(options):
for key in ('run_complete','required_pack','pack_refresh','select_startup_battery','confirm_startup_battery','select_thunderbranch','confirm_thunderbranch','prepare_thrill','prepare_thunderbranch','decline_extra_observation','retry_network','buy_swap','confirm_swap','confirm_reward','hardship_confirm','modal_confirm','claim_final','close_progress'): for key in ('run_complete','required_pack','pack_refresh','select_startup_battery','confirm_startup_battery','select_thunderbranch','confirm_thunderbranch','prepare_thrill','prepare_thunderbranch','decline_extra_observation','retry_network','buy_swap','confirm_swap','confirm_reward','hardship_confirm','modal_confirm','claim_final','close_progress'):
if key in options: if key in options:
@@ -698,8 +630,7 @@ def execute(bridge, action, deadline=None):
def call(tool, args=None): def call(tool, args=None):
if STOP_FILE.exists() or deadline is not None and time.monotonic() >= deadline: if STOP_FILE.exists() or deadline is not None and time.monotonic() >= deadline:
return {'ok':False,'stopped':True} return {'ok':False,'stopped':True}
result = bridge.call(tool, args) return bridge.call(tool, args)
return normalize(result) if tool == 'get_state' else result
if action['tool'] == 'claim_final': if action['tool'] == 'claim_final':
result = call('click', action['args']) result = call('click', action['args'])
if not result.get('ok'): if not result.get('ok'):
@@ -817,12 +748,13 @@ def main(executor_decider=None):
save_json(status, {'state': 'stopped', 'step': step, 'run_id': run['run_id']}) save_json(status, {'state': 'stopped', 'step': step, 'run_id': run['run_id']})
return return
observation_started = time.monotonic() observation_started = time.monotonic()
state = normalize(bridge.call('get_state')) state = bridge.call('get_state')
observation_ms = round((time.monotonic()-observation_started)*1000) observation_ms = round((time.monotonic()-observation_started)*1000)
if not state.get('ok'): if not state.get('ok'):
state = {'ok': False, 'items': [{'text': 'MCP 截图暂不可用;游戏窗口可能正在重建。' + str(state.get('error','')), state = {'ok': False, 'items': [{'text': 'MCP 截图暂不可用;游戏窗口可能正在重建。' + str(state.get('error','')),
'x':0,'y':0,'w':0,'h':0,'score':1.0}]} 'x':0,'y':0,'w':0,'h':0,'score':1.0}]}
fingerprint = scene_fingerprint(state) fingerprint = tuple(item['text'] for item in text_items(state)
if item.get('score', 0) > 0.93 and not item['text'].replace('.', '').isdigit() and not re.fullmatch(r'[0-9:]+', item['text']))
if any('正在探' in i['text'] or '主题卡包' in i['text'] for i in text_items(state)): if any('正在探' in i['text'] or '主题卡包' in i['text'] for i in text_items(state)):
context['refresh_used'] = 0 context['refresh_used'] = 0
for item in text_items(state): for item in text_items(state):
@@ -850,7 +782,7 @@ def main(executor_decider=None):
and repeats.get((fingerprint, action_id), 0) >= 1): and repeats.get((fingerprint, action_id), 0) >= 1):
fallback = options[key].get('fallback_action') fallback = options[key].get('fallback_action')
button = next((i for i in text_items(state) button = next((i for i in text_items(state)
if i['text'].replace(' ', '') in ('进入', '开始战斗', '确认', '继续', '进行判定') if i['text'].replace(' ', '') in ('进入', '开始战斗', '确认', '继续')
and button_enabled(state, i)), None) and button_enabled(state, i)), None)
if fallback or button: if fallback or button:
options[key]['action'] = fallback or {'tool': 'click', 'args': { options[key]['action'] = fallback or {'tool': 'click', 'args': {
@@ -878,8 +810,6 @@ def main(executor_decider=None):
choice, latency = 'event_advance', 0 choice, latency = 'event_advance', 0
elif 'battle' in options: elif 'battle' in options:
choice, latency = 'battle', 0 choice, latency = 'battle', 0
elif unambiguous_routine(options):
choice, latency = unambiguous_routine(options), 0
else: else:
try: try:
decision = router.choose(state, options, recent, run['run_id']) decision = router.choose(state, options, recent, run['run_id'])
@@ -910,8 +840,6 @@ def main(executor_decider=None):
record['failed_jev_ms'] = decision.failed_jev_ms record['failed_jev_ms'] = decision.failed_jev_ms
if decision.fallback_reason: if decision.fallback_reason:
record['decision_fallback_reason'] = decision.fallback_reason record['decision_fallback_reason'] = decision.fallback_reason
if decision.candidate_scope is not None:
record['provider_candidate_scope'] = decision.candidate_scope
if choice == 'run_complete': if choice == 'run_complete':
complete_run(RUNTIME_HOME, run, context, state.get('screen')) complete_run(RUNTIME_HOME, run, context, state.get('screen'))
record['state'] = 'completed' record['state'] = 'completed'
-85
View File
@@ -1,85 +0,0 @@
"""Normalize observed English UI labels for the existing mirror controller."""
import re
LABELS = {
'confirm':'确认', 'continue':'继续', 'proceed':'继续', 'enter':'进入', 'cancel':'取消',
'leave':'离开', 'close':'关闭', 'startbattle':'开始战斗', 'startcombat':'开始战斗',
'battle!':'开始战斗', 'chainbattle!':'开始战斗',
'select':'选择', 'selectasinner':'选择一位罪人', 'chooseasinner':'选择一位罪人',
'commence':'进行判定', 'commencecheck':'进行判定', 'performcheck':'进行判定', 'checksuccess':'判定成功',
'checkfailure':'判定失败', 'checkpassed':'判定成功', 'checkfailed':'判定失败',
'result':'结果', 'options':'选项', 'choices':'选项', 'veryhigh':'极高',
'high':'高', 'shop':'商店', 'specialshop':'特殊商店', 'refresh':'刷新',
'enhancegifts':'强化饰品', 'enhancee.g.ogifts':'强化饰品', 'purchase':'购买',
'buy':'购买', 'purchased':'已购买', 'currentownedskills':'当前持有技能',
'thunderbranch':'雷枝', '雷击木':'雷枝', 'talismanbundle':'成捆的符咒',
'standard-dutybattery':'标准负载电池', 'standarddutybattery':'标准负载电池',
'thrill':'快感', 'selecte.g.ogifts':'选择E.G.O饰品',
'selecte.g.ogift':'选择E.G.O饰品', 'declinegifts':'拒绝饰品',
'declinegift':'拒绝饰品', 'refusegifts':'拒绝饰品',
'refusegift':'拒绝饰品', 'selectede.g.ogift':'选择E.G.O饰品',
'gaine.g.ogift':'获得E.G.O饰品', 'gaine.g.ogift!':'获得E.G.O饰品!',
'obtaine.g.ogift!':'获得E.G.O饰品!', 'e.g.ogiftobservation':'饰品观测',
'e.g.ogiftget!':'获得E.G.O饰品!',
'e.g.ogiftsearch':'额外观测', 'eg.dgiftsearch':'额外观测',
'nextfloor':'下一层', 'gotonextfloor':'前往下一层', 'proceedtonextfloor':'前往下一层', 'claim':'领取',
'additionalhardship':'追加的苦难', 'additionalhardships':'追加的苦难',
'obtaine.g.ogift':'获得E.G.O饰品', 'obtaine.g.ogifts':'获得E.G.O饰品',
'claimrewards':'领取奖励', 'explorationcomplete':'探索完成',
'explorationcompleted':'探索完成', 'dungeoncomplete':'探索完成',
'drive':'驾驶席', 'sinners':'罪人', 'exploring:':'探索状态',
'beforeentry':'入场前', 'retry':'重试', 'dungeonprogress':'迷宫进度',
}
def normalize(state):
if state.get('_lc_labels_normalized'):
return state
rate_items = []
for item in state.get('items') or []:
raw = item['text']
compact = re.sub(r'\s+', '', raw).lower().lstrip('×x')
compact = compact.replace('e.g.0', 'e.g.o')
text = LABELS.get(compact, raw)
if text == raw:
match = re.search(r'select(?:the)?(?:floor)?(\d+)(?:st|nd|rd|th)?floorthemepack', compact)
if not match:
match = re.search(r'selectfloorthemepack(?:for)?floor(\d+)', compact)
if not match:
match = re.search(r'selectfloor(\d+)themepack', compact)
if match:
text = '选择%s层主题卡包' % match[1]
elif re.search(r'(?:select|choose).*encounterreward', compact):
text = '选择遭遇战奖励卡'
elif re.search(r'exploring(?:floor)?\d+', compact):
text = '正在探索第%s层' % re.search(r'\d+', compact)[0]
elif compact.startswith('exploringfloor'):
# A missing/misread floor number still identifies the map.
# Leave the stored floor unchanged rather than invent a digit.
text = '正在探索 ' + raw
elif compact.startswith('select') and re.search(r'\d+/\d+', compact):
text = '选择' + re.search(r'\d+/\d+', compact)[0]
elif compact.startswith('refresh'):
text = raw.replace(raw[:7], '刷新')
elif compact.startswith('chooseacharactertoperform'):
text = '选择一位罪人'
elif re.match(r'who(?:will|should)', compact):
text = '应该让谁 ' + raw
elif compact.startswith('skillreplacement') or compact.startswith('replaceskill'):
text = '技能替换 ' + raw
# English OCR sometimes merges several adjacent probability labels.
# Keep each explicit Very High span as a separate observed candidate.
if item.get('y', 0) > state.get('screen', {}).get('h', 1080) * .8 and 'veryhigh' in compact:
for match in re.finditer('veryhigh', compact):
center = item['x'] + (match.start() + len(match[0]) / 2) * item['w'] / len(compact)
rate_items.append(dict(item, text='极高', original_text=raw,
x=round(center - 25), w=50))
for english, chinese in [('Sinclair','辛克莱'), ('Hong Lu','鸿璐'),
('Heathcliff','希斯克利夫'), ('Outis','奥提斯'), ('Gregor','格里高尔'),
('Ryoshu','良秀'), ('Faust','浮士德')]:
text = text.replace(english, chinese)
if text != raw:
item['original_text'] = raw
item['text'] = text
state['items'] = (state.get('items') or []) + rate_items
state['_lc_labels_normalized'] = True
return state
-18
View File
@@ -281,24 +281,6 @@ class SceneRegressionTest(unittest.TestCase):
self.assertEqual(options['skip_dialog']['action'], self.assertEqual(options['skip_dialog']['action'],
{'tool': 'click', 'args': {'x': 1260, 'y': 420}}) {'tool': 'click', 'args': {'x': 1260, 'y': 420}})
def test_english_receiving_text_is_not_event_rec_indicator(self):
state = {'items': [{'text': 'Receive this E.G.O Gift', 'x': 600,
'y': 300, 'w': 320, 'h': 40}]}
self.assertNotIn('event_advance', agent.candidates(state))
def test_exact_event_rec_indicator_still_advances_dialogue(self):
state = {'items': [{'text': 'REC', 'x': 900, 'y': 200, 'w': 50, 'h': 30}]}
self.assertIn('event_advance', agent.candidates(state))
def test_single_validated_confirmation_needs_no_model(self):
options = {'wait': {}, 'requires_analysis': {}, 'confirm_startup_battery': {}}
self.assertEqual(agent.unambiguous_routine(options), 'confirm_startup_battery')
def test_route_choices_and_unknown_single_actions_still_need_model(self):
for actions in ({'route_1': {}}, {'event_scroll': {}},
{'modal_confirm': {}, 'route_1': {}}):
self.assertIsNone(agent.unambiguous_routine(dict(wait={}, requires_analysis={}, **actions)))
def test_floor_three_sinclair_cannot_choose_first_floor_swap(self): def test_floor_three_sinclair_cannot_choose_first_floor_swap(self):
state = {'floor': 3, 'items': [ state = {'floor': 3, 'items': [
{'text': '当前持有技能', 'x': 900, 'y': 160, 'w': 100, 'h': 30}, {'text': '当前持有技能', 'x': 900, 'y': 160, 'w': 100, 'h': 30},
-110
View File
@@ -1,110 +0,0 @@
import sys
import unittest
from pathlib import Path
from unittest import mock
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'scripts'))
from lc_scene_aliases import normalize
import jev_mirror_agent as agent
from decision_router import DecisionRouter
class EnglishMirrorBoundaryTest(unittest.TestCase):
def test_map_header_without_recognized_floor_number_stops_battle(self):
for label in ('Exploring Floor', 'Exploring FloorT'):
with self.subTest(label=label):
state = normalize({'items': [{'text': label, 'x': 60, 'y': 131,
'w': 302, 'h': 51, 'score': .975}]})
self.assertTrue(agent.battle_is_terminal(state))
with mock.patch.object(agent, 'map_candidates', return_value={}):
self.assertNotIn('battle', agent.candidates(state, previous_battle=True))
def test_enabled_commence_precedes_reselecting_sinners(self):
options = {'button_20': {'description': '当前可见且非灰色按钮:进行判定',
'action': {'tool': 'keypress', 'args': {'key': 'enter'}}},
'sinner_1': {'description': '选择预计成功率高的罪人卡'},
'requires_analysis': {'description': '分析'}, 'wait': {'description': '等待'}}
self.assertEqual(agent.unambiguous_routine(options), 'button_20')
def test_video_clock_does_not_reset_failed_enter_detection(self):
def observation(clock, button='Proceed'):
return {'items': [{'text': text, 'score': 1} for text in (clock, button)]}
self.assertEqual(agent.scene_fingerprint(observation('00:00:42.48')),
agent.scene_fingerprint(observation('00:00:43:02')))
self.assertNotEqual(agent.scene_fingerprint(observation('00:00:43:02')),
agent.scene_fingerprint(observation('00:00:43:02', 'Commence')))
def test_commence_and_split_sinner_header_reach_judgement_boundary(self):
state = {'screen': {'w': 1920, 'h': 1080}, 'items': [
{'text': text, 'x': 1200, 'y': y, 'w': 200, 'h': 40, 'score': 1}
for text, y in [('Choose a character toperform', 445), ('Commence', 949)]]}
state = normalize(state)
self.assertTrue(agent.battle_is_terminal(state))
with mock.patch.object(agent, 'button_enabled', return_value=True):
options = agent.candidates(state)
self.assertTrue(any('进行判定' in option['description'] for option in options.values()))
judge = next(option for key, option in options.items() if key.startswith('button_')
and '进行判定' in option['description'])
self.assertEqual(judge['action']['tool'], 'keypress')
self.assertEqual(judge['fallback_action']['tool'], 'click')
def test_merged_english_probabilities_are_explicit_and_idempotent(self):
state = {'screen': {'w': 1920, 'h': 1080}, 'items': [
{'text': 'NormalVeryLowVeryHighVeryHigh', 'x': 906, 'y': 912,
'w': 400, 'h': 29, 'score': .946}]}
normalize(state)
labels = [item for item in state['items'] if item['text'] == '极高']
self.assertEqual(len(labels), 2)
self.assertTrue(all(1100 < item['x'] < 1300 for item in labels))
normalize(state)
self.assertEqual(len(state['items']), 3)
def test_english_outcome_lines_are_not_event_buttons(self):
state = {'screen': {'w': 1920, 'h': 1080}, 'items': [
{'text': text, 'x': 1096, 'y': y, 'w': 300, 'h': 31, 'score': 1}
for text, y in [('Choices', 168), ('Accept the surgery.', 295),
('RunaSloth&GloomAdvantagechecktogaina', 332),
('Keywordless E.G.O Gift.', 362),
('Break the light and run away.', 518)]]}
with mock.patch.object(agent, 'button_enabled', return_value=True):
options = agent.candidates(normalize(state))
descriptions = [value['description'] for key, value in options.items()
if key.startswith('event_') and key != 'event_scroll']
self.assertEqual(len(descriptions), 2)
self.assertTrue(any('Advantagecheck' in value for value in descriptions))
def test_empty_observation_is_not_a_normalization_error(self):
self.assertEqual(normalize({'items': None})['items'], [])
def test_route_request_keeps_observed_route_facts_and_omits_unrelated_setup(self):
options = {'route_d': {'description': '正前方有可达事件'},
'route_w': {'description': '上方有可达普通战斗'},
'wait': {'description': '等待'},
'requires_analysis': {'description': '需要分析'}}
with mock.patch.object(agent, 'request_answer', return_value={'choice': 'route_d'}) as request:
agent.decide({}, {'items': [{'text': 'irrelevant party text'}]}, options, [])
self.assertIn('正前方有可达事件', request.call_args.args[1])
self.assertNotIn('irrelevant party text', request.call_args.args[1])
self.assertNotIn('合成', request.call_args.args[3])
def test_sinner_request_only_offers_explicit_maximum_probability(self):
options = {'sinner_1': {'description': '选择预计成功率高的罪人卡'},
'sinner_2': {'description': '选择预计成功率极高的罪人卡'},
'sinner_card_3': {'description': '金黄色(高/极高)'},
'requires_analysis': {'description': '分析'}, 'wait': {'description': '等待'}}
with mock.patch.object(agent, 'request_answer', return_value={'choice': 'sinner_2'}) as request:
agent.decide({}, {}, options, [])
self.assertEqual(set(request.call_args.args[2]), {'sinner_2'})
def test_scoped_probability_distribution_passes_router_and_keeps_scope(self):
options = {'sinner_1': {'description': '选择预计成功率高的罪人卡'},
'sinner_2': {'description': '选择预计成功率极高的罪人卡'},
'requires_analysis': {'description': '分析'}, 'wait': {'description': '等待'}}
router = DecisionRouter({'model': 'test-model', 'apiKey': 'test-key'}, agent.decide)
response = {'choice': 'sinner_2', 'latency_ms': 1, 'probabilities': {'sinner_2': 1}}
with mock.patch.object(agent, 'request_answer', return_value=response):
decision = router.choose({}, options)
self.assertEqual(decision.choice, 'sinner_2')
self.assertEqual(decision.candidate_scope, ['sinner_2'])
self.assertEqual(decision.probabilities, {'sinner_1': 0, 'sinner_2': 1,
'requires_analysis': 0, 'wait': 0})
+152
View File
@@ -0,0 +1,152 @@
# -*- coding: utf-8 -*-
"""编队滑动补丁: 几何用 AALC 真实的 scroll_swipe.py, 适配器/pyautogui 用记录调用的假对象。"""
import importlib.util
import os
import sys
import types
import unittest
from unittest import mock
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, REPO)
from lc_mcp import aalc_input_patch as patch # noqa: E402
SCROLL_SWIPE = os.path.join(REPO, 'vendor', 'aalc', 'module', 'automation', 'input_handlers', 'scroll_swipe.py')
def aalc_modules(input_module=None):
"""只装入 AALC 的 scroll_swipe (纯 math) 和可选的假 input 模块, 不触发 AALC 包初始化。"""
spec = importlib.util.spec_from_file_location('module.automation.input_handlers.scroll_swipe', SCROLL_SWIPE)
scroll_swipe = importlib.util.module_from_spec(spec)
spec.loader.exec_module(scroll_swipe)
mods = {name: types.ModuleType(name) for name in
('module', 'module.automation', 'module.automation.input_handlers')}
for m in mods.values():
m.__path__ = []
handlers = mods['module.automation.input_handlers']
handlers.scroll_swipe = scroll_swipe
mods['module.automation.input_handlers.scroll_swipe'] = scroll_swipe
if input_module is not None:
handlers.input = input_module
mods['module.automation.input_handlers.input'] = input_module
mods['module.automation'].input_handlers = handlers
mods['module'].automation = mods['module.automation']
return mods, scroll_swipe
class FakeBackground:
def __init__(self):
self.calls = []
def get_mouse_position(self):
return (5, 5)
def set_active(self):
self.calls.append(('active',))
def set_mouse_pos(self, x, y, **kwargs):
self.calls.append(('pos', x, y, kwargs))
def mouse_down(self, x, y):
self.calls.append(('down', x, y))
def mouse_up(self, x, y):
self.calls.append(('up', x, y))
def mouse_move(self, coordinate):
self.calls.append(('restore', coordinate))
@unittest.skipUnless(os.path.isfile(SCROLL_SWIPE), 'AALC submodule unavailable')
class TeamScrollPatchTest(unittest.TestCase):
def setUp(self):
self.mods, self.scroll_swipe = aalc_modules()
self.sleeps = []
for p in (mock.patch.dict(sys.modules, self.mods),
mock.patch.object(patch.time, 'sleep', side_effect=self.sleeps.append)):
p.start()
self.addCleanup(p.stop)
def test_background_keeps_aalc_geometry_and_actually_moves(self):
dy = -385 * 1080 / 1440 # AALC 按名称翻页的距离
adapter = FakeBackground()
patch._background_team_scroll(adapter, 500, 600, duration=0.3, dy=dy)
moves = [c for c in adapter.calls if c[0] == 'pos']
down = next(c for c in adapter.calls if c[0] == 'down')
up = next(c for c in adapter.calls if c[0] == 'up')
self.assertEqual(down[1:], (500, 600))
self.assertAlmostEqual(up[2] - down[2], dy) # 行程与 AALC 的 Windows 标定一致
self.assertGreater(len(moves), 50) # 原补丁在此为 0 个移动事件
self.assertTrue(all(not c[3] for c in moves)) # 不经过适配器的 duration 参数
plan, settle = self.scroll_swipe.build_windows_scroll_swipe_plan(500, 600, 0, dy, 0.3)
visited = {(round(c[1], 6), round(c[2], 6)) for c in moves}
for point, _ in plan:
self.assertIn((round(point[0], 6), round(point[1], 6)), visited)
self.assertIn(patch.ESCAPE_HOLD_SECONDS, self.sleeps)
self.assertEqual(self.sleeps[-1], patch.SETTLE_SECONDS)
moving = sum(d for _, d in plan)
self.assertAlmostEqual(sum(self.sleeps), moving + patch.ESCAPE_HOLD_SECONDS + patch.SETTLE_SECONDS)
self.assertEqual(adapter.calls[-1], ('restore', (5, 5)))
def test_foreground_disables_pyautogui_pause(self):
calls = []
fake = types.SimpleNamespace(
moveTo=lambda *a, **k: calls.append(('move', a, k)),
mouseDown=lambda *a, **k: calls.append(('down', a, k)),
mouseUp=lambda *a, **k: calls.append(('up', a, k)))
adapter = FakeBackground()
adapter.pos_offset = lambda x, y: (x + 100, y + 200)
with mock.patch.dict(sys.modules, {'pyautogui': fake}):
patch._foreground_team_scroll(adapter, 500, 600, duration=0.3, dy=-288, move_back=False)
self.assertTrue(all(k.get('_pause') is False for _, _, k in calls))
self.assertEqual([c[0] for c in calls].count('down'), 1)
self.assertEqual(calls[-1][:2], ('up', (600, 512))) # 终点 (500, 312) 加窗口偏移
# pyautogui 默认每次调用后停 0.1s; 关掉后总耗时只由计划决定
self.assertLess(sum(self.sleeps), 2.0)
def test_zero_distance_presses_and_releases_in_place(self):
adapter = FakeBackground()
patch._background_team_scroll(adapter, 10, 20, dy=0, move_back=False)
self.assertEqual([c[0] for c in adapter.calls], ['pos', 'active', 'down', 'up'])
self.assertEqual(self.sleeps, [])
def test_release_happens_even_if_moving_fails(self):
adapter = FakeBackground()
adapter.set_mouse_pos = mock.Mock(side_effect=[None, RuntimeError('lost window')])
with self.assertRaises(RuntimeError):
patch._background_team_scroll(adapter, 10, 20, dy=-200)
self.assertEqual(adapter.calls[-1][0], 'up')
class InstallTest(unittest.TestCase):
def test_opt_in_and_idempotent(self):
class Input:
pass
class BackgroundInput:
pass
fake_input = types.ModuleType('module.automation.input_handlers.input')
fake_input.Input, fake_input.BackgroundInput = Input, BackgroundInput
mods = {name: types.ModuleType(name) for name in
('module', 'module.automation', 'module.automation.input_handlers')}
for m in mods.values():
m.__path__ = []
mods['module.automation.input_handlers'].input = fake_input
mods['module.automation.input_handlers.input'] = fake_input
with mock.patch.dict(sys.modules, mods):
with mock.patch.dict(os.environ, {}, clear=True):
self.assertEqual(patch.install(), []) # 默认关闭
self.assertFalse(hasattr(Input, 'mouse_swipe_for_team_scroll'))
with mock.patch.dict(os.environ, {'LCP_TEAM_SCROLL_PATCH': '1'}):
self.assertEqual(patch.install(), ['Input', 'BackgroundInput'])
self.assertIs(Input.mouse_swipe_for_team_scroll, patch._foreground_team_scroll)
self.assertIs(BackgroundInput.mouse_swipe_for_team_scroll, patch._background_team_scroll)
self.assertEqual(patch.install(), []) # 幂等
if __name__ == '__main__':
unittest.main()