lycheedev 1.1.0 → 1.2.0
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/bin/lycheedev.js +9 -3
- package/package.json +1 -1
- package/vendor/addon/Core/Locale.lua +1 -1
- package/vendor/addon/Core/Locale_enUS.lua +1 -1
- package/vendor/addon/Lychee Dev_Forever.toc +2 -1
- package/vendor/addon/Lychee Dev_Mainline.toc +2 -1
- package/vendor/addon/Lychee Dev_Mists.toc +2 -1
- package/vendor/addon/Lychee Dev_Wrath.toc +2 -1
- package/vendor/addon/Modules/Automation/Controller.lua +49 -7
- package/vendor/addon/Modules/Automation/Reload.lua +101 -0
- package/vendor/skill/SKILL.md +24 -109
- package/vendor/skill/agents/openai.yaml +3 -3
- package/vendor/skill/references/automation.md +81 -364
- package/vendor/skill/references/clients.md +28 -193
- package/vendor/skill/references/runtime-investigations.md +7 -0
- package/vendor/skill/scripts/automation/reload.py +121 -0
- package/vendor/skill/scripts/automation/windows.py +119 -50
- package/vendor/skill/scripts/automation.py +112 -20
- package/vendor/skill/scripts/selftest_offline.py +63 -72
- package/vendor/skill/scripts/test_input_safety.py +132 -0
- package/vendor/skill/scripts/test_reload.py +120 -0
|
@@ -1,413 +1,130 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
This reference covers the automated loop between an Agent, the Python tooling
|
|
4
|
-
in `scripts/`, and the in-game Automation page (`/dev` > Automation). The full
|
|
5
|
-
design lives in the addon repository at
|
|
6
|
-
`add-on/docs/design/AutomationOpticalTransport.md`; this page is the practical
|
|
7
|
-
contract and describes the CLI exactly as implemented.
|
|
8
|
-
|
|
9
|
-
## The loop in one paragraph
|
|
10
|
-
|
|
11
|
-
You (the Agent) prepare a bounded Lua probe and deliver it as one task block in
|
|
12
|
-
the installed `Modules/Automation/auto/auto.lua`. The block only registers
|
|
13
|
-
data; it never runs at load. After an input-side `/reload`, the command
|
|
14
|
-
`/dev auto run <task-id>` executes the block. While it runs, three RGB status
|
|
15
|
-
blocks show at the top-left of the screen. When the result is committed to the
|
|
16
|
-
in-memory SavedVariables database, they are replaced by one static QR code at
|
|
17
|
-
the top-left that carries only the identity:
|
|
18
|
-
`{"v":1,"ticket":"...","task":"...","run":"...","ts":...}`. `capture`, `run`
|
|
19
|
-
and `bugs` keep one WGC capture session open and poll it until that notice is
|
|
20
|
-
decoded or `--timeout` expires. The tooling then cross-checks the notice `task`
|
|
21
|
-
and `run` against the request it actually delivered, logs a `reload_requested`
|
|
22
|
-
intent, sends one `/reload` so the game writes the database to disk, then reads
|
|
23
|
-
the exact Ticket out of the SavedVariables file, verifies its identity,
|
|
24
|
-
payload and checksum, and stores the complete report as local artifacts.
|
|
25
|
-
`/dev auto bug <n>` skips the task file and the input-side reload; it snapshots
|
|
26
|
-
recent error records and follows the same notice -> reload -> read path.
|
|
27
|
-
|
|
28
|
-
## Hard rules
|
|
29
|
-
|
|
30
|
-
- One execution per client at a time: while a request is running the addon
|
|
31
|
-
answers new requests with a busy message. Finished results that you have not
|
|
32
|
-
acknowledged may queue up to three; only the cap refuses new work, and a
|
|
33
|
-
reload resets the count.
|
|
34
|
-
- Always acknowledge what you read. The addon cannot see whether a result was
|
|
35
|
-
picked up, so run `ack --status received` (or `failed`) after reading one.
|
|
36
|
-
Without it the result keeps occupying a backlog slot until a reload.
|
|
37
|
-
- The same `requestId` never executes twice in one session; re-running the
|
|
38
|
-
command re-shows the same notice instead.
|
|
39
|
-
- Results awaiting their reload are protected: normal export pruning, record
|
|
40
|
-
deletion and cache clears skip them. `/dev auto stop` only hides the notice
|
|
41
|
-
UI; it never cancels a run and never deletes pending results.
|
|
42
|
-
- One notice triggers at most one reload. The host log deduplicates on
|
|
43
|
-
`(installation, requestId, ticket)`; after a script restart, check the log
|
|
44
|
-
and the SavedVariables file before repeating anything.
|
|
45
|
-
- A decoded notice is accepted only when its `task` (and `run`, when known)
|
|
46
|
-
matches the command that was just delivered. A stale QR left on screen from
|
|
47
|
-
an earlier run is logged as `notice_identity_mismatch` and ignored.
|
|
48
|
-
- Host wait timeouts mean "unknown", not "failed": never auto-rerun a task
|
|
49
|
-
because its notice was missed. Inspect first (see Recovery).
|
|
50
|
-
|
|
51
|
-
## Task blocks
|
|
52
|
-
|
|
53
|
-
Write task blocks only through the CLI so locking, escaping and limits stay
|
|
54
|
-
correct:
|
|
1
|
+
# 后台自动化闭环
|
|
55
2
|
|
|
56
|
-
|
|
57
|
-
python scripts/automation.py task upsert --install-dir <addon dir> \
|
|
58
|
-
--id inspect-example --source-file probe.lua \
|
|
59
|
-
--request-id req-20260912-000001-aaaaaa --revision rev-1
|
|
60
|
-
python scripts/automation.py task list --install-dir <addon dir>
|
|
61
|
-
python scripts/automation.py task remove --install-dir <addon dir> --id inspect-example
|
|
62
|
-
```
|
|
3
|
+
检索:目标绑定、任务区块、状态、执行、错误快照、ACK、恢复、清理、证据。
|
|
63
4
|
|
|
64
|
-
|
|
65
|
-
never remove or rewrite another task's block.
|
|
66
|
-
- A new execution needs a new `requestId`. Updating the source always means a
|
|
67
|
-
new `requestId` and a new `revision`.
|
|
68
|
-
- The writer verifies `--expect-revision` on replacement, holds an exclusive
|
|
69
|
-
lock file (`auto.lua.lock` in the installation directory), preserves
|
|
70
|
-
everything outside the `BEGIN`/`END LYCHEE DEV TASK` markers verbatim, and
|
|
71
|
-
replaces the file atomically. It refuses more than 16 blocks, more than
|
|
72
|
-
1 MiB of registry, or a source over 256 KiB.
|
|
73
|
-
- The source file is read as raw bytes and must be valid UTF-8, but it does not
|
|
74
|
-
have to be ASCII: the generated Lua shell stays ASCII and escapes every
|
|
75
|
-
non-ASCII byte as `\ddd`. `sourceBytes` and the block's `sourceChecksum` are
|
|
76
|
-
computed on those exact source bytes, so a CRLF source file keeps its CRLF.
|
|
77
|
-
- `task upsert` prints one JSON object:
|
|
78
|
-
`{"taskId":...,"requestId":...,"revision":...,"sourceBytes":N,"fileHash":"<sha256 of the written file>"}`.
|
|
79
|
-
`fileHash` is recorded after the atomic write, so it identifies the file
|
|
80
|
-
revision another writer may have replaced.
|
|
81
|
-
- `task list` prints `taskId<TAB>requestId<TAB>revision<TAB>sourceBytesB`;
|
|
82
|
-
`task remove` prints `removed <id>` or `<id> not present`.
|
|
83
|
-
- Task sources must be Lua 5.1 with clear boundaries: register cleanup
|
|
84
|
-
handlers with `ctx.OnCleanup(fn)`, stop your own timers/frames/events there.
|
|
85
|
-
- Release packaging always ships an empty registry; keep local probes out of
|
|
86
|
-
commits.
|
|
87
|
-
|
|
88
|
-
## The execution context
|
|
89
|
-
|
|
90
|
-
The task runs with full access to WoW globals inside a captured environment:
|
|
91
|
-
|
|
92
|
-
- `print(...)` — captured into the report stdout (bounded by the block's
|
|
93
|
-
`outputLimit`, default 384 KiB).
|
|
94
|
-
- `Finish(value, ...)` — complete the task successfully with return values.
|
|
95
|
-
- `Fail(message[, code])` — complete as failed.
|
|
96
|
-
- `SetAsync()` — declare the task asynchronous; the chunk returning then does
|
|
97
|
-
NOT complete it. Sync tasks end when they return; async tasks must call
|
|
98
|
-
`Finish`/`Fail` from their own callbacks. Late callbacks are ignored.
|
|
99
|
-
- `IsCancelled()` — cooperative cancel flag; `/dev auto cancel <task-id>`
|
|
100
|
-
finalizes the run as `cancelled` and runs your cleanup handlers.
|
|
101
|
-
- `OnCleanup(fn)` — register cleanup; handlers run on any finalization.
|
|
102
|
-
- `Log(message)` — bounded lifecycle log line (128 entries / 16 KiB in the
|
|
103
|
-
report).
|
|
104
|
-
|
|
105
|
-
The architecture cannot force-stop an infinite loop and cannot roll back side
|
|
106
|
-
effects. Generate bounded, cancellable probes only.
|
|
107
|
-
|
|
108
|
-
## In-game commands
|
|
109
|
-
|
|
110
|
-
| Command | Behavior |
|
|
111
|
-
| --- | --- |
|
|
112
|
-
| `/dev` | Opens the workbench (unchanged). |
|
|
113
|
-
| `/dev auto run <task-id>` | Validates the loaded block and executes its current request. |
|
|
114
|
-
| `/dev auto bug <1-100> [request-id]` | Snapshots up to 100 saved error records (all sessions, provider storage order, newest last-first). |
|
|
115
|
-
| `/dev auto status <task-id>` | Prints the latest execution state; re-shows the notice when the result still exists. |
|
|
116
|
-
| `/dev auto show <ticket>` | Re-shows the notice for a kept historical result. |
|
|
117
|
-
| `/dev auto cancel <task-id>` | Cooperative cancel; saves a cancelled report and its Ticket. |
|
|
118
|
-
| `/dev auto ack <ticket> received\|failed` | Records that the host read this ticket (or failed to). Clears the pending-flush block so the next run can start **without a reload**. |
|
|
119
|
-
| `/dev auto identify` | Shows the identity marker: a small QR code at the top-left carrying this character, realm, client and build, so a host with several windows open can learn which window is which. Not shown by default; it shares the corner with the completion notice. |
|
|
120
|
-
| `/dev auto unidentify` | Hides the identity marker. |
|
|
121
|
-
| `/dev auto stop` | Hides the notice UI only; the pending record and the busy state stay. |
|
|
122
|
-
|
|
123
|
-
### Identity marker vs completion notice
|
|
124
|
-
|
|
125
|
-
Both are small JSON QR codes at the top-left, and they are told apart by shape, not
|
|
126
|
-
by position:
|
|
127
|
-
|
|
128
|
-
| | identity marker | completion notice |
|
|
129
|
-
| --- | --- | --- |
|
|
130
|
-
| has `id` + `client` | yes | no |
|
|
131
|
-
| has `ticket` + `task` + `run` | no | yes |
|
|
132
|
-
| shown when | the user runs `/dev auto identify` | a result is committed |
|
|
133
|
-
| purpose | identify the window before input | deliver the ticket after a run |
|
|
5
|
+
## 工具与协议
|
|
134
6
|
|
|
135
|
-
|
|
136
|
-
window is focused and nothing is typed. This is what lets a caller name the window
|
|
137
|
-
it is about to drive instead of guessing from a pid. Two windows showing the same
|
|
138
|
-
character and realm remain indistinguishable.
|
|
7
|
+
发送使用 Python `scripts/automation.py` 的 `--mode messages`(当前默认);读取使用 WGC + zxing-cpp。不要重写 ctypes 投递、拼接临时按键脚本或改成 GDI。Node CLI 负责安装/发现,游戏与 SV 逻辑由 Python 持有。
|
|
139
8
|
|
|
140
|
-
|
|
9
|
+
运行时 RGB 色块表示状态;完成 QR 只包含版本、Ticket、task、requestId、时间戳等短元数据:
|
|
141
10
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
disk write, the controller answers every new request with the busy message, and
|
|
145
|
-
that block only ends with a reload — unless you tell it what happened:
|
|
146
|
-
|
|
147
|
-
```text
|
|
148
|
-
python scripts/automation.py --installation retail-main ack \
|
|
149
|
-
--hwnd 0x1234 --ticket LYCHEE-... --status received
|
|
11
|
+
```json
|
|
12
|
+
{"v":1,"ticket":"LYCHEE-...","task":"probe","run":"req-...","ts":1234567890}
|
|
150
13
|
```
|
|
151
14
|
|
|
152
|
-
|
|
153
|
-
Use `--status failed` when the read failed; the reason stays in your host log.
|
|
154
|
-
The index record keeps `receivedAt` and `receivedStatus`, and the Automation page
|
|
155
|
-
shows "Read by the host" / "Host read failed" instead of a permanent
|
|
156
|
-
"Awaiting reload". Acknowledging an unknown ticket or an invalid status changes
|
|
157
|
-
nothing and reports why.
|
|
15
|
+
无论正文大小,一律在输出 reload 后读取 SavedVariables。二维码不承担正文传输。成功/失败/取消都可能生成报告,必须读取报告的 status/complete/incompleteReasons,不能看见二维码就说调查成功。
|
|
158
16
|
|
|
159
|
-
|
|
160
|
-
`requestType` `bug`; its `params` are `{"count": n, "scope": ...}`.
|
|
17
|
+
固定一个稳定的 `--installation` 标识(对应安装目录与会话绑定),并在所有命令中沿用同一个 `--data-dir`。宿主默认目录是 `%LOCALAPPDATA%/LycheeDev/automation`,保存 `session.log.jsonl`、配置和 `received/<Ticket>/` 下的 evidence/report/content 文件。插件内存中的数据库只有在 reload、退出或登出后才落盘。
|
|
161
18
|
|
|
162
|
-
##
|
|
19
|
+
## 职责和完成边界
|
|
163
20
|
|
|
164
|
-
|
|
21
|
+
Agent 负责目标选择、设计有界 Lua、连续推进各阶段、解释异常。Python 负责注册表原子更新、输入、QR 校验、reload 去重、SV 校验和 ACK。当前不存在一个涵盖所有步骤的 `workflow` 命令;用下面的真实命令连续编排,不让用户逐条接力。
|
|
165
22
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
23
|
+
| 阶段 | 通过证据 | 下一步 |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| 目标绑定 | 本次进程与产品/角色/安装匹配 | 写自己的任务区块 |
|
|
26
|
+
| 源码已准备 | upsert 的 hash/requestId/revision | 输入侧 reload 使新源码加载 |
|
|
27
|
+
| 输入已提交 | command_submitted,仅表示投递完成 | 等待匹配 task/run 的完成 QR |
|
|
28
|
+
| 游戏已完成 | 匹配 QR | 输出 reload 一次 |
|
|
29
|
+
| 已落盘读取 | 精确 Ticket、环境、完整性和校验通过 | ACK received |
|
|
30
|
+
| ACK 已确认 | Ticket/nonce/status 匹配 | 按该 nonce 清理并观察码消失 |
|
|
31
|
+
| 已收尾 | ticket_ack_cleared;自有测试资源处理完成 | 向用户报告结果 |
|
|
172
32
|
|
|
173
|
-
|
|
33
|
+
`run`/`bugs` 当前负责到 SV 读取,不自动执行 `ack`。返回 0 后必须继续 ACK。`send` 返回 0 不能当作游戏成功。`recover` 没有未决 reload 也不证明 ACK/界面清理完成,需要检查对应阶段事件。
|
|
174
34
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
tells you.
|
|
35
|
+
## 准备任务
|
|
36
|
+
|
|
37
|
+
目标目录是 `<addon>/Modules/Automation/auto/auto.lua`,按 task-id 分区。只能通过注册表工具改自己的区块,保留别人的块和标记外文本:
|
|
179
38
|
|
|
180
39
|
```text
|
|
181
|
-
python scripts/automation.py
|
|
182
|
-
python scripts/automation.py identify --windows-json <instances.json>
|
|
40
|
+
python <skill>/scripts/automation.py --installation <binding> task upsert --install-dir <addon> --id <task> --source-file <probe.lua> --request-id <request> --revision <revision> --expected-interface <interface>
|
|
183
41
|
```
|
|
184
42
|
|
|
185
|
-
-
|
|
186
|
-
`lycheedev instances`; each entry needs an `hwnd`. Prefer this when probing
|
|
187
|
-
several windows, because the list survives the trip intact.
|
|
188
|
-
- Prints one entry per window, in the input order, as JSON:
|
|
189
|
-
`{"hwnd":...,"pid":...,"flavorId":...,"identity":{...}|null,"error":null|"..."}`.
|
|
190
|
-
- **`identity: null` is not an error.** It is the ordinary state until the user
|
|
191
|
-
runs `/dev auto identify` in that window. Only `error` marks a window that
|
|
192
|
-
could not be probed.
|
|
193
|
-
- Exit code 5 means no window yielded a marker (including when every window was
|
|
194
|
-
unreadable); a partly readable set exits 0. A missing capture package exits 4.
|
|
195
|
-
- Capture reads the window surface directly, so **no window needs the
|
|
196
|
-
foreground** and nothing is typed. Windows are probed concurrently.
|
|
197
|
-
- A window showing the completion notice instead of a marker is not
|
|
198
|
-
mis-identified: the two payloads are told apart by shape, not position.
|
|
199
|
-
|
|
200
|
-
Ask the user to run `/dev auto identify` in each window they care about, then
|
|
201
|
-
probe, then confirm the character back to them before sending any command.
|
|
202
|
-
`/dev auto unidentify` hides the marker again.
|
|
203
|
-
|
|
204
|
-
### task
|
|
205
|
-
|
|
206
|
-
`task upsert|remove|list` with `--install-dir <dir>` or `--profile <name>`.
|
|
207
|
-
Upsert also takes `--id`, `--source-file`, `--request-id`, `--revision`,
|
|
208
|
-
`--expect-revision`, `--created-at`, `--expires-at`, `--expected-interface`
|
|
209
|
-
and `--output-limit`. Generated IDs are `req-<UTC stamp>-<hex>`.
|
|
210
|
-
|
|
211
|
-
### profile
|
|
43
|
+
task-id 是 `[A-Za-z0-9_-]{1,64}`;requestId 建议只用字母、数字、点、连字符(兼容插件与 Python)。一项新执行分配新 requestId,源码变化同时换 revision;超时恢复保持原 requestId。更新已有块时用 `--expect-revision` 防覆盖。
|
|
212
44
|
|
|
213
|
-
|
|
214
|
-
python scripts/automation.py profile set --name retail-main --client retail \
|
|
215
|
-
--wow-root <WoW root> --addon-dir <addon dir> \
|
|
216
|
-
--sv-path "<WoW>/WTF/Account/<account>/SavedVariables/Lychee Dev.lua"
|
|
217
|
-
python scripts/automation.py profile show --name retail-main
|
|
218
|
-
```
|
|
45
|
+
源码是 UTF-8 Lua 5.1,最多 256 KiB;注册表最多 16 块/1 MiB。标准输出限制默认 384 KiB、最大 512 KiB,以实际安装工具限制为准。不要用不受支持的 schema/kind 扩展协议。区块只注册数据,不会加载即执行。
|
|
219
46
|
|
|
220
|
-
`
|
|
221
|
-
directories must exist. `--client` accepts `retail`, `classic`, `titan` and
|
|
222
|
-
`forever`. The stored profile records the client folder, and every accepted
|
|
223
|
-
location for that client is kept so a build that moved folders still resolves:
|
|
47
|
+
同步调查返回紧凑结构。异步调查调用 `SetAsync()`,通过 `Finish(...)` 或 `Fail(message, code)` 完成,用 `OnCleanup(fn)` 释放自己创建的资源,检查 `IsCancelled()`;`Log` 与 `print` 输出有界。不得返回尚未完成的表并指望后来修改自动保存。
|
|
224
48
|
|
|
225
|
-
|
|
226
|
-
| --- | --- |
|
|
227
|
-
| `retail` | `_retail_` |
|
|
228
|
-
| `classic` | `_classic_` |
|
|
229
|
-
| `titan` | `_classic_titan_` |
|
|
230
|
-
| `forever` | `_classic_beta_`, or `_forever_` |
|
|
49
|
+
输入侧 reload 使用下面的专用命令。Python 生成 nonce,插件保存一次性请求后重载;新 Lua 会话收到重载的 `PLAYER_ENTERING_WORLD` 和 `LOADING_SCREEN_DISABLED`、核对角色及命令模块后才显示 ready QR。Python 在本地解码并按 nonce 清理,正常只返回 `reload_ready` JSON,不向 Agent 传图。SV mtime 变化和固定等待都不能替代就绪握手。该协议需要插件和脚本配套更新,旧插件不能识别时应停止,不自动降级或循环重载。
|
|
231
50
|
|
|
232
|
-
|
|
233
|
-
in `_classic_beta_` on the test track, which a MoP-era classic test client also
|
|
234
|
-
uses. `sv find` therefore tries every accepted folder under `--wow-root` and
|
|
235
|
-
falls back to the root itself, rather than trusting the recorded name.
|
|
236
|
-
Profiles are written atomically to `<data-dir>/profiles.json`.
|
|
51
|
+
## 执行已绑定账户的任务
|
|
237
52
|
|
|
238
|
-
|
|
53
|
+
下面示例的全局 `--data-dir`(如有)放在子命令前。全部窗口操作沿用本次绑定:
|
|
239
54
|
|
|
240
55
|
```text
|
|
241
|
-
python scripts/automation.py --installation
|
|
242
|
-
python scripts/automation.py --installation
|
|
243
|
-
--ticket LYCHEE-... --task inspect-example --request-id req-... --revision rev-1
|
|
56
|
+
python <skill>/scripts/automation.py --installation <binding> reload --mode messages --hwnd <hwnd> --pid <pid> --exe-path <exe> --timeout 60
|
|
57
|
+
python <skill>/scripts/automation.py --installation <binding> run --mode messages --hwnd <hwnd> --pid <pid> --exe-path <exe> --task <task> --install-dir <addon> --sv <verified-sv> --timeout 120
|
|
244
58
|
```
|
|
245
59
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
refuses any file that is not named `Lychee Dev.lua` and refuses `.bak`.
|
|
252
|
-
- Optional identity checks: `--task`, `--request-id`, `--revision`,
|
|
253
|
-
`--created-at`, `--request-type task|bug`.
|
|
254
|
-
- `--retries` (default 3) and `--retry-delay` (default 0.5 s) bound the reads
|
|
255
|
-
of a torn, replaced or temporarily unreadable file; the failure message
|
|
256
|
-
reports how many attempts were made.
|
|
257
|
-
- The reader uses a restricted parser (no Lua evaluation), exactly locates
|
|
258
|
-
`LycheeDevDB.exports.records[TICKET]`, verifies the envelope (`schema`,
|
|
259
|
-
`ticket`, `createdAt`), the payload (`mediaType` `application/json`,
|
|
260
|
-
`encoding` `utf-8`, real UTF-8 byte count against `byteCount`, 1 MiB report
|
|
261
|
-
limit), the metadata identity (`taskId`, `executionId`, `revision`,
|
|
262
|
-
`resultSchema`, terminal `status`, `complete`, `checksumAlgorithm adler32`)
|
|
263
|
-
and recomputes the Adler-32 `contentChecksum`. It then parses the inner
|
|
264
|
-
`lychee.automation.result.v1` JSON report and verifies its version, terminal
|
|
265
|
-
status, `complete`/`incompleteReasons`, client/character `environment`,
|
|
266
|
-
`requestType` and, for bug reports, `params`.
|
|
267
|
-
- Success prints
|
|
268
|
-
`{"ticket":...,"status":...,"complete":...,"byteCount":N,"sha256":"...","attempts":N,"artifacts":{...}}`.
|
|
269
|
-
- Artifacts (`evidence.json`, `report.json`, `content.json`) land under
|
|
270
|
-
`<data-dir>/received/<ticket>/` and are written byte-for-byte: the recorded
|
|
271
|
-
`byteCount` and SHA-256 describe the exact bytes on disk, with no newline
|
|
272
|
-
translation of `payload.content`. The host log records `received` with the
|
|
273
|
-
attempt count and whether the file changed during the read.
|
|
274
|
-
|
|
275
|
-
### capture / send
|
|
60
|
+
只有 `reload` 返回 0、状态为 `reload_ready` 后才运行下一条命令。`run` 读取安装区块的 requestId/revision,提交 `/dev auto run <task>`,过滤旧完成码,记录输出 reload 去重键,通过同一个握手等待就绪,再校验 SV 并保存完整报告。输出重载将已核对的 Ticket 传给插件,不覆盖其他待处理回执。
|
|
61
|
+
|
|
62
|
+
日志分别记录 `reload_handshake_requested`、`reload_ready_confirmed`、`reload_ready_cleared`。超时返回原 nonce、失败阶段和本地 `reload/<nonce>/timeout.png`(没有图像时为 null),不上传图片正文。仅失败时 Agent 才有必要打开图片。恢复命令为 `reload --resume <nonce>`,沿用相同 installation/HWND/PID/exe;它绝不再次发送重载,确认过 ready 则只补清理。marker 最长存活 120 秒,超出后保持未解决,不自动制造新重载。
|
|
63
|
+
|
|
64
|
+
账户未绑定时按 [clients.md](clients.md) 分段执行:`send` 运行、`capture` 取码、Agent 验证 task/run、带 requestId/Ticket 发送一次 `/reload`、定位精确记录,再 `sv read`。`capture` 本身只验证 QR 格式,不知道本次预期 task/run,不能拿任何码直接触发 reload。
|
|
276
65
|
|
|
277
66
|
```text
|
|
278
|
-
python scripts/automation.py
|
|
279
|
-
|
|
280
|
-
python scripts/automation.py send --hwnd
|
|
281
|
-
|
|
67
|
+
python <skill>/scripts/automation.py --installation <binding> send --mode messages --hwnd <hwnd> --pid <pid> --exe-path <exe> --text "/dev auto run <task>"
|
|
68
|
+
python <skill>/scripts/automation.py capture --hwnd <hwnd> --pid <pid> --exe-path <exe> --timeout 120
|
|
69
|
+
python <skill>/scripts/automation.py --installation <binding> send --mode messages --hwnd <hwnd> --pid <pid> --exe-path <exe> --text "/reload" --request-id <request> --ticket <ticket>
|
|
70
|
+
python <skill>/scripts/automation.py --installation <binding> sv read --sv <matched-sv> --ticket <ticket> --task <task> --request-id <request> --revision <revision> --request-type task
|
|
282
71
|
```
|
|
283
72
|
|
|
284
|
-
|
|
285
|
-
QR with `zxingcpp.read_barcodes` (QR only) and prints the notice JSON. It
|
|
286
|
-
compares the top-left ROI on every `--interval` (default 0.1 s) until
|
|
287
|
-
`--timeout` (default 120 s) expires, then exits 5. Only the newest ROI is
|
|
288
|
-
kept, so frames never pile up.
|
|
289
|
-
- `send` always logs `command_sent` before input. When the text is `/reload`
|
|
290
|
-
and both `--request-id` and `--ticket` are given it also applies the reload
|
|
291
|
-
dedup key, so the same notice can never trigger a second reload.
|
|
292
|
-
- Both confirm the window identity (HWND, and `--pid`/`--exe-path` when given)
|
|
293
|
-
immediately before use and re-check the foreground before typing.
|
|
73
|
+
同一个 `(installation, requestId, Ticket)` 的输出 reload 只允许自动发一次。写盘暂时未完成时进行有界读取等待,不重跑 Lua。
|
|
294
74
|
|
|
295
|
-
|
|
75
|
+
## 最近 n 条错误
|
|
296
76
|
|
|
297
77
|
```text
|
|
298
|
-
python scripts/automation.py --installation
|
|
299
|
-
--task inspect-example --sv "<...>/Lychee Dev.lua" --hwnd 0x1234 \
|
|
300
|
-
--install-dir <addon dir> [--request-id req-...] [--revision rev-1] \
|
|
301
|
-
[--timeout 120] [--interval 0.1]
|
|
302
|
-
python scripts/automation.py --installation retail-main bugs \
|
|
303
|
-
--count 20 --sv "<...>/Lychee Dev.lua" --hwnd 0x1234 [--timeout 120] [--interval 0.1]
|
|
78
|
+
python <skill>/scripts/automation.py --installation <binding> bugs --mode messages --hwnd <hwnd> --pid <pid> --exe-path <exe> --count <n> --request-id <request> --sv <verified-sv> --timeout 120
|
|
304
79
|
```
|
|
305
80
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
(read from `Modules/Automation/auto/auto.lua` when `--install-dir` or
|
|
312
|
-
`--profile` is given). A missing task block is an explicit failure.
|
|
313
|
-
- `bugs` validates that `--count` is 1-100 without silently fixing it,
|
|
314
|
-
delivers `/dev auto bug <count>` and requires a notice with task `bug`.
|
|
315
|
-
- On a matching notice both flows log the `reload_requested` intent, snapshot
|
|
316
|
-
the SV file, send one `/reload`, wait for the file to change within
|
|
317
|
-
`--timeout`, then run the same verification as `sv read`.
|
|
318
|
-
- Because a task can run far longer than one capture interval, the capture
|
|
319
|
-
session stays open for the whole wait; it stops when the notice is decoded,
|
|
320
|
-
the window closes, or the timeout expires.
|
|
321
|
-
|
|
322
|
-
### status / recover
|
|
81
|
+
n 在 1–100 之间。该流程发送 `/dev auto bug <n> <request>`,完成码 task 为 `bug`,内层报告 requestType 为 `bug`。数量是上限;按 provider storage order 读取可能跨会话的现有日志,不能未经核对就声称是本次测试产生的 n 个错误。报告保留 scope/排序信息,不用 metadata 代替错误正文。账户未知时同样分段定位 Ticket。
|
|
82
|
+
|
|
83
|
+
## ACK 与正常收尾
|
|
84
|
+
|
|
85
|
+
SV 内容已完整验证后发送 received;读失败但已明确决定结束本次接收才用 failed,不把一次暂时读盘失败直接 ACK 为失败。
|
|
323
86
|
|
|
324
87
|
```text
|
|
325
|
-
python scripts/automation.py --installation
|
|
326
|
-
python scripts/automation.py --installation retail-main recover
|
|
88
|
+
python <skill>/scripts/automation.py --installation <binding> ack --mode messages --hwnd <hwnd> --pid <pid> --exe-path <exe> --ticket <ticket> --status received --timeout 30
|
|
327
89
|
```
|
|
328
90
|
|
|
329
|
-
|
|
330
|
-
to read every scope). `status` prints the most recent records (`--limit`,
|
|
331
|
-
default 20; 0 prints all). `recover` prints recent records and lists tickets
|
|
332
|
-
whose reload was requested but never received. For those, read the
|
|
333
|
-
SavedVariables file first: if the Ticket is already on disk, run `sv read`
|
|
334
|
-
directly; if not, exactly one explicit reload retry is allowed — never a loop.
|
|
335
|
-
If the game crashed before writing, the report is lost; record that
|
|
336
|
-
uncertainty in your findings.
|
|
91
|
+
`run`/`bugs` 已通过握手确认输出 reload 后进入世界;ACK 前不需要再次给 Agent 看截图。若是旧版或手动 `/reload`,仍须有明确就绪证据。ACK 分配新 nonce,等待含该 nonce、Ticket 和 outcome 的 QR;随后发送 `/dev auto unidentify <nonce>`,只隐藏对应 ACK 标记,再观察该码消失。`ticket_ack_confirmed` 和 `ticket_ack_cleared` 分开记录;确认成功但清理超时不等于任务失败。
|
|
337
92
|
|
|
338
|
-
|
|
93
|
+
旧版插件只支持两参数 ACK,不支持 nonce 清理。使用前核对工具与插件协议版本;授权的测试/更新应备份后同步相应源码并 reload。不能在旧插件上持续重试不支持的命令。`/dev auto unidentify` 无参数会隐藏身份标记,仅在明确属于自己的标记且没有新回执时用;不能用通用 stop 掩盖未处理证据。
|
|
339
94
|
|
|
340
|
-
|
|
341
|
-
| --- | --- |
|
|
342
|
-
| 0 | Success. |
|
|
343
|
-
| 1 | Invalid usage, missing binding/profile, unsafe path refused, non-UTF-8 source, or an unexpected failure (with traceback). |
|
|
344
|
-
| 2 | Task registry failure (schema, kind, marker, revision conflict, lock/limit refusal). |
|
|
345
|
-
| 3 | SavedVariables read or verification failure after all attempts. |
|
|
346
|
-
| 4 | Window identity, command input, or missing optional capture dependency (`windows-capture`/`numpy`/`zxing-cpp`) failure. |
|
|
347
|
-
| 5 | No notice decoded before the timeout, no window yielded an identity marker, or the game did not rewrite its SavedVariables file in time. |
|
|
95
|
+
读取 ACK 不需要又一次输出 reload;receivedAt/receivedStatus 留在内存,下一次正常 reload 才持久化。不要为了把确认再确认一遍制造无限 ACK/reload 环。
|
|
348
96
|
|
|
349
|
-
|
|
350
|
-
traceback for a missing dependency, a missing argument or a bad source file.
|
|
97
|
+
自有临时任务结束后用 `task remove --install-dir <addon> --id <task>` 清理磁盘区块,保留证据和他人区块;是否额外 reload 清除内存定义按实际需要决定,不为界面整洁无条件多做 reload。
|
|
351
98
|
|
|
352
|
-
##
|
|
99
|
+
## 完整报告校验
|
|
353
100
|
|
|
354
|
-
|
|
355
|
-
python -m pip install --target <dir> -r scripts/requirements.txt
|
|
356
|
-
```
|
|
101
|
+
读取当前 `Lychee Dev.lua`,用受限 Lua 数据解析器定位 `LycheeDevDB.exports.records[Ticket]`。校验 envelope schema/ticket/createdAt、payload 的 UTF-8 字节数与编码、Adler-32、metadata taskId/executionId/revision、内层 schema/status/complete/requestType。Agent 另将 environment 的角色/服务器/产品/build 与当前绑定比较;当前 reader 验证环境结构,不替 Agent 证明它就是选定窗口。
|
|
357
102
|
|
|
358
|
-
`
|
|
359
|
-
`windows-capture==2.0.1`, `numpy==2.5.3`, `opencv-python==5.0.0.93`. The code
|
|
360
|
-
uses only the interfaces those versions actually expose: `read_barcodes`
|
|
361
|
-
(zxing-cpp 3.x, `read_bars` does not exist), `WindowsCapture(window_hwnd=...)`
|
|
362
|
-
with `on_frame_arrived`/`on_closed` handlers, `start_free_threaded()` /
|
|
363
|
-
`CaptureControl.stop()` and `Frame.convert_to_bgr()`.
|
|
103
|
+
`received/<Ticket>/content.json` 是字节精确的完整 payload,report.json 是解析报告,evidence.json 是外层证据。报告给用户时引用实际文件与 Ticket,不能只给 QR 截图或日志摘要。
|
|
364
104
|
|
|
365
|
-
|
|
366
|
-
without them they fail with an explicit dependency message and exit 4 rather than
|
|
367
|
-
a traceback. `send` and `ack` import the same module but only use ctypes, so
|
|
368
|
-
keyboard delivery works without them. Everything else — `task`, `profile`, `sv`,
|
|
369
|
-
`status`, `recover` — runs on the standard library alone.
|
|
105
|
+
## 中断、超时与恢复
|
|
370
106
|
|
|
371
|
-
|
|
107
|
+
先读本 installation 的 `status`/`recover`、本次保存的 task/request/Ticket 和当前画面;不要从第一条命令重新开始。
|
|
372
108
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
109
|
+
| 停留状态 | 恢复动作 |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| 已 upsert、未确认加载 | 核对源码与客户端状态,完成输入侧 reload,不运行旧区块 |
|
|
112
|
+
| 已提交、无完成码 | 有界等待/只读观察;超时记 unresolved,不自动生成新 request 重跑 |
|
|
113
|
+
| 完成码在屏幕 | 校验 task/run;查是否已请求 reload、Ticket 是否已在 SV,再决定推进 |
|
|
114
|
+
| 已请求 reload、读不到 Ticket | 等待写盘并搜索该安装所有候选;拒绝 newest-file 猜测 |
|
|
115
|
+
| SV 已验证、ACK 未完成 | 只继续 ACK,不重新执行任务或输出 reload |
|
|
116
|
+
| ACK 已确认、码仍显示 | 从日志取原 nonce,仅补对应 unidentify 和读取验证 |
|
|
117
|
+
| HWND/PID/角色变了 | 重新绑定,再恢复只读阶段;不沿用旧窗口序号 |
|
|
118
|
+
| 留有自有未提交草稿 | 核对仍是原窗口,取消草稿;不按 Enter“继续” |
|
|
119
|
+
|
|
120
|
+
仅在证据证明上次 reload 未执行且任务仍在内存,并处于现有授权内时,允许一次明确记录的恢复 reload;不循环试错。游戏崩溃前未落盘的内容可能丢失,应直接说明。
|
|
121
|
+
|
|
122
|
+
后台 PostMessage 不使用前台/剪贴板,但队列接受不证明 Escape 被消费或焦点处于聊天框。不要把 SendInput 当补救。输入错误后检查状态,修复明确原因或报告阻塞;不要留下未说明的测试草稿再开始别的用例。
|
|
123
|
+
|
|
124
|
+
退出码:0 为该命令完成,1 为参数/绑定错误,2 为注册表错误,3 为 SV 读取或验证失败,4 为窗口/输入/依赖问题,5 为回执、写盘或清理观察超时。已经确认的阶段不能因后续阶段失败而被抹掉。
|
|
125
|
+
|
|
126
|
+
## 依赖与验证范围
|
|
127
|
+
|
|
128
|
+
Python 图像依赖放在 `~/.lycheedev/python`,通过 PYTHONPATH 加载,使用随工具 requirements.txt 的版本;不要装进用户 site-packages。后台发送只依赖 ctypes;QR 读取及 ACK 的确认/清理需要 WGC、numpy、zxing-cpp。缺依赖时先在受管目录修复,不切换传输通道。
|
|
377
129
|
|
|
378
|
-
|
|
379
|
-
requested but never received. For those, read the SavedVariables file first:
|
|
380
|
-
if the Ticket is already on disk, run `sv read` directly; if not, exactly one
|
|
381
|
-
explicit reload retry is allowed — never a loop. `run_unresolved`,
|
|
382
|
-
`sv_write_timeout` and `notice_identity_mismatch` records tell you which step
|
|
383
|
-
stopped and why. If the game crashed before writing, the report is lost;
|
|
384
|
-
record that uncertainty in your findings.
|
|
385
|
-
|
|
386
|
-
## Known verification gaps
|
|
387
|
-
|
|
388
|
-
Do not describe these as proven, and do not repeat them as if they were:
|
|
389
|
-
|
|
390
|
-
- **On-screen rendering of the notice and identity QR codes.** The encoding
|
|
391
|
-
round-trips (the addon's own Lua encoder produces a matrix that the host's
|
|
392
|
-
`zxing-cpp` decoder reads back, at every module size from 2 to 8 px), but the
|
|
393
|
-
actual pixels drawn by the game have not been measured. Marker size and
|
|
394
|
-
scannability under DPI/UI scaling, occlusion, minimization, exclusive
|
|
395
|
-
fullscreen and HDR are all unmeasured.
|
|
396
|
-
- **Identity probe against a window that really shows a marker.** The capture
|
|
397
|
-
pipeline itself has been exercised on a live client (frames arrive in 78-94 ms,
|
|
398
|
-
~3 ms to decode an empty ROI, no frame errors), but no probe has yet read a
|
|
399
|
-
marker the game actually rendered. `/dev auto identify` has not been run in a
|
|
400
|
-
game.
|
|
401
|
-
- **SendInput delivery reliability.** Keyboard input reaches the foreground
|
|
402
|
-
window through the focus-verify-paste-confirm sequence; whether the game
|
|
403
|
-
processes a given slash command still depends on client state, and `SendInput`
|
|
404
|
-
returning success does not prove it did.
|
|
405
|
-
- **Real SavedVariables write timing** and the reload cost of a large report.
|
|
406
|
-
- **WoW: Forever in a running client.** Its TOC, client profile and event catalog
|
|
407
|
-
are statically verified and pass the four-client matrix, but the addon has not
|
|
408
|
-
been loaded in a Forever client.
|
|
409
|
-
|
|
410
|
-
The offline-verified parts are the task registry writer, the restricted
|
|
411
|
-
SavedVariables reader and verifier, the session log/dedup/artifacts, the notice
|
|
412
|
-
validation, the identity marker shape and probe concurrency, the polling shape
|
|
413
|
-
and the CLI exit behaviour; they are covered by `scripts/selftest_offline.py`.
|
|
130
|
+
已有实机证据:Retail 12.1.0.69875 / Interface 120100 后台身份 QR、13,019 字节任务报告、reload 落盘和 nonce ACK 已通过。四客户端离线矩阵通过不等于四客户端实机通过;最小化、全部编辑状态、句柄重用仍未完整验证。同一 Retail 实例的 ACK 自动收尾已实测:确认后按 nonce 隐藏,WGC 再读取无残留码;测试禁止调用前台激活、SendInput 与剪贴板入口,仍成功。不要将该结果扩大为所有客户端/窗口状态都通过。
|