lycheedev 1.0.6 → 1.1.1

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.
@@ -7,7 +7,7 @@ local L = ns.L
7
7
  --
8
8
  -- Status blocks: three 4-physical-pixel squares in RGB order at the top-left
9
9
  -- corner while an automation request runs. Error state lights only red.
10
- -- Completion notice: one static QR code at the top-right, encoded once per
10
+ -- Completion notice: one static QR code at the top-left, encoded once per
11
11
  -- result and kept visible until the output-side reload, an explicit hide or a
12
12
  -- safe cleanup. Dark modules come from a bounded reuse pool.
13
13
 
@@ -16,10 +16,12 @@ local MAX_NOTICE_UI_SIZE = 480
16
16
 
17
17
  local statusFrame
18
18
  local noticeFrame
19
+ local identityFrame
19
20
  local statusBlocks
20
21
  local noticeTextures = {}
21
- local noticeTextureCount = 0
22
+ local identityTextures = {}
22
23
  local lastNoticeJson
24
+ local lastIdentityJson
23
25
 
24
26
  local function PhysicalUnit()
25
27
  if ns.Client and ns.Client.GetPhysicalPixelSize then
@@ -58,6 +60,19 @@ local function EnsureOverlay()
58
60
  background:SetAllPoints()
59
61
  background:SetColorTexture(1, 1, 1, 1)
60
62
  noticeFrame:Hide()
63
+
64
+ -- Identity marker: the same corner and the same white-card convention as the
65
+ -- completion notice, but a separate frame. It answers "which character is in
66
+ -- this window" for a host that can capture several windows, and it is shown
67
+ -- only on explicit request so it never competes with the ticket notice.
68
+ identityFrame = CreateFrame("Frame", "LycheeDevAutomationIdentity", UIParent)
69
+ identityFrame:SetFrameStrata("FULLSCREEN_DIALOG")
70
+ identityFrame:SetFrameLevel(10000)
71
+ identityFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
72
+ local identityBackground = identityFrame:CreateTexture(nil, "BACKGROUND")
73
+ identityBackground:SetAllPoints()
74
+ identityBackground:SetColorTexture(1, 1, 1, 1)
75
+ identityFrame:Hide()
61
76
  end
62
77
 
63
78
  local function LayoutStatusBlocks(mode)
@@ -89,7 +104,10 @@ local function CountDarkModules(matrix)
89
104
  return dark, size
90
105
  end
91
106
 
92
- local function RenderMatrix(matrix)
107
+ -- Render a QR matrix into one corner frame, reusing a bounded pool of textures.
108
+ -- Both the ticket notice and the identity marker go through here, so they share
109
+ -- the quiet zone, sizing and pool behaviour.
110
+ local function RenderMatrixInto(frame, textures, matrix)
93
111
  local dark, size = CountDarkModules(matrix)
94
112
  if dark > POOL_LIMIT then
95
113
  return false
@@ -103,7 +121,7 @@ local function RenderMatrix(matrix)
103
121
  quiet = moduleSize * 4
104
122
  end
105
123
  local total = size * moduleSize + quiet * 2
106
- noticeFrame:SetSize(total, total)
124
+ frame:SetSize(total, total)
107
125
 
108
126
  local used = 0
109
127
  for y = 1, size do
@@ -111,36 +129,45 @@ local function RenderMatrix(matrix)
111
129
  for x = 1, size do
112
130
  if column[x] and column[x] > 0 then
113
131
  used = used + 1
114
- local texture = noticeTextures[used]
132
+ local texture = textures[used]
115
133
  if not texture then
116
- texture = noticeFrame:CreateTexture(nil, "OVERLAY")
134
+ texture = frame:CreateTexture(nil, "OVERLAY")
117
135
  texture:SetColorTexture(0, 0, 0, 1)
118
- noticeTextures[used] = texture
119
- noticeTextureCount = used
136
+ textures[used] = texture
120
137
  end
121
138
  texture:SetSize(moduleSize, moduleSize)
122
139
  texture:ClearAllPoints()
123
- texture:SetPoint("TOPLEFT", noticeFrame, "TOPLEFT",
140
+ texture:SetPoint("TOPLEFT", frame, "TOPLEFT",
124
141
  quiet + (x - 1) * moduleSize, -(quiet + (y - 1) * moduleSize))
125
142
  texture:Show()
126
143
  end
127
144
  end
128
145
  end
129
- for index = used + 1, noticeTextureCount do
130
- noticeTextures[index]:Hide()
146
+ -- Hide leftovers from a previous, larger matrix; a stale dark module would
147
+ -- corrupt the code the host is trying to read.
148
+ for index = used + 1, #textures do
149
+ textures[index]:Hide()
131
150
  end
132
- return true
151
+ return true, used
133
152
  end
134
153
 
135
154
  local Overlay = {}
136
155
 
137
156
  function Overlay.ShowRunning()
138
157
  EnsureOverlay()
158
+ -- A run in progress outranks the static identity marker: they share the
159
+ -- corner, so the marker steps aside rather than overlapping the blocks.
160
+ if identityFrame then
161
+ identityFrame:Hide()
162
+ end
139
163
  LayoutStatusBlocks("running")
140
164
  end
141
165
 
142
166
  function Overlay.ShowError()
143
167
  EnsureOverlay()
168
+ if identityFrame then
169
+ identityFrame:Hide()
170
+ end
144
171
  LayoutStatusBlocks("error")
145
172
  end
146
173
 
@@ -157,7 +184,7 @@ function Overlay.ShowNotice(json)
157
184
  return true
158
185
  end
159
186
  local matrix, encodeError = ns.AutomationQR.Encode(json, 2)
160
- if not matrix or not RenderMatrix(matrix) then
187
+ if not matrix or not RenderMatrixInto(noticeFrame, noticeTextures, matrix) then
161
188
  noticeFrame:Hide()
162
189
  lastNoticeJson = nil
163
190
  Overlay.ShowError()
@@ -169,6 +196,11 @@ function Overlay.ShowNotice(json)
169
196
  if statusFrame then
170
197
  statusFrame:Hide()
171
198
  end
199
+ -- The identity marker occupies the same corner; the completion notice is the
200
+ -- more urgent of the two, so it takes the corner.
201
+ if identityFrame then
202
+ identityFrame:Hide()
203
+ end
172
204
  noticeFrame:Show()
173
205
  return true
174
206
  end
@@ -180,4 +212,42 @@ function Overlay.HideNotice()
180
212
  lastNoticeJson = nil
181
213
  end
182
214
 
215
+ -- Identity marker: a host able to capture several game windows reads this to
216
+ -- learn which character and build each window holds, so it can offer a
217
+ -- character-based choice instead of an arbitrary instance index.
218
+ function Overlay.ShowIdentity(json)
219
+ EnsureOverlay()
220
+ if json == lastIdentityJson and identityFrame:IsShown() then
221
+ return true
222
+ end
223
+ local matrix, encodeError = ns.AutomationQR.Encode(json, 2)
224
+ if not matrix or not RenderMatrixInto(identityFrame, identityTextures, matrix) then
225
+ identityFrame:Hide()
226
+ lastIdentityJson = nil
227
+ return false, encodeError or "render_failed"
228
+ end
229
+ lastIdentityJson = json
230
+ -- The marker shares the top-left corner with the status blocks and the
231
+ -- completion notice; only one of the three may occupy it at a time.
232
+ if statusFrame then
233
+ statusFrame:Hide()
234
+ end
235
+ if noticeFrame then
236
+ noticeFrame:Hide()
237
+ end
238
+ identityFrame:Show()
239
+ return true
240
+ end
241
+
242
+ function Overlay.HideIdentity()
243
+ if identityFrame then
244
+ identityFrame:Hide()
245
+ end
246
+ lastIdentityJson = nil
247
+ end
248
+
249
+ function Overlay.IsIdentityShown()
250
+ return identityFrame ~= nil and identityFrame:IsShown()
251
+ end
252
+
183
253
  ns.AutomationOverlay = Overlay
@@ -56,7 +56,10 @@ function ns.CreateAboutPage(parent, ui)
56
56
  description:SetText(L.ABOUT_DESCRIPTION)
57
57
  description:SetTextColor(0.92, 0.94, 0.96, 0.92)
58
58
 
59
- local version = "0.7.2"
59
+ -- Fallback only: the TOC is the source of truth and overrides this on the
60
+ -- next line. Keep it aligned with the release version so a metadata failure
61
+ -- cannot display an unrelated old number.
62
+ local version = "1.0.6"
60
63
  version = ns.Client.GetAddOnMetadata(ADDON_NAME, "Version") or version
61
64
 
62
65
  local accent = page:CreateTexture(nil, "ARTWORK")
@@ -1,116 +1,42 @@
1
1
  ---
2
2
  name: lychee-dev
3
- description: Use when working with the Lychee Dev WoW addon to read persisted runtime evidence by Ticket or prepare bounded /run memory/CPU investigations, object inspection, and event monitoring. Do not use for generic WoW API research or unrelated addon implementation.
3
+ description: 编排 Lychee Dev 的 WoW 后台自动化任务、错误快照、二维码回执和 SavedVariables Ticket 读取;也用于有界 Run 性能调查、对象检查与事件监控。不用于无关插件实现或通用 WoW API 查询。
4
4
  ---
5
5
 
6
- # Lychee Dev skill
6
+ # Lychee Dev
7
7
 
8
- Use this skill as the operational guide for Lychee Dev, an in-game evidence workbench. The desired output is either (a) an evidence-backed diagnosis from SavedVariables or (b) a command/workflow the user can paste into WoW and report back.
8
+ 把用户的调查问题变成完整、可追溯的游戏运行证据。已获授权的自动化应连续完成发送、读取、确认和收尾,不能停在“已发送”、二维码出现或脚本生成。
9
9
 
10
- Detail lives in `references/`. Read the one that matches the task instead of guessing:
10
+ ## 按任务读取资料
11
11
 
12
- | Reference | Read it when |
13
- | --- | --- |
14
- | [references/clients.md](references/clients.md) | Any command that types into the game, or the user has several builds or instances open |
15
- | [references/automation.md](references/automation.md) | Authorized scripted task delivery: task blocks, run, notice, reload, receipt |
16
- | [references/runtime-investigations.md](references/runtime-investigations.md) | Designing a memory/CPU probe |
12
+ - 要操作正在运行的游戏:先读 [clients.md](references/clients.md),确定版本、实例和安装位置。
13
+ - 要执行自动任务、获取最近 n 条错误、ACK 或恢复中断:读 [automation.md](references/automation.md),按其闭环继续到完成。
14
+ - 设计内存/CPU 调查:另读 [runtime-investigations.md](references/runtime-investigations.md)。只读已有 Ticket 不需要准备新探针。
17
15
 
18
- ## Choose the workflow
16
+ ## 默认后台通路
19
17
 
20
- - **Persisted evidence:** locate the WoW `WTF` SavedVariables file, find the exact Ticket, and read the complete payload.
21
- - **Run:** open `/dev`, use the Run page, and paste `/run` or `/script` Lua.
22
- - **Automated task delivery:** when the user authorized scripted task delivery and reload, use the Python tooling in `scripts/` to upsert a task block, run it, decode the completion notice, reload once, and read the Ticket. Read [references/automation.md](references/automation.md) first; live-window steps still need per-host verification.
23
- - **Memory/CPU investigation:** use Run with a question-specific script; read [references/runtime-investigations.md](references/runtime-investigations.md) before designing a probe.
24
- - **Objects:** open `/dev` > Objects and inspect a global/object path or use the mouse picker.
25
- - **Events:** open `/dev` > Events, search the current client's catalog, select events, start monitoring, reproduce the behavior, then stop and save.
18
+ 使用随 Skill 附带的 `scripts/automation.py`。发送显式传 `--mode messages`,通过 PostMessage 投递到绑定的 HWND;WGC 直接捕获窗口,zxing-cpp 解码。两者都不要求窗口获得前台焦点,不使用 GDI 截屏,也不需要剪贴板。不要自行换成 SetForegroundWindow、SendInput、点击聊天框或要求用户粘贴。
26
19
 
27
- The Performance page, automatic capture, health scan and function benchmark have been removed. Run, Objects, Events, Trace, Errors and Saved Records remain available. Do not route a new investigation to the removed UI. There are no separate `/object` or `/event` slash commands. Do not invent them; give the `/dev` UI steps instead.
20
+ 工具仍保留显式 `foreground` 模式;它不是后台通路的自动降级方案。后台异常时检查状态和证据,不把失败直接转成人工提交。用户明确选择人工 Run 时,才按该方式组织。
28
21
 
29
- ## Know which client you are driving
22
+ 无焦点要求不等于所有窗口状态都可用:最小化、客户端切换、战斗、尚未载入世界、其他游戏编辑框和自定义聊天键位可能影响操作。只报告本次实际验证的客户端/版本/状态。消息成功入队不证明游戏执行;二维码出现不证明 SV 已落盘。
30
23
 
31
- Three builds are supported: Retail `12.1.0` (`_retail_`), Classic `5.5.4` (`_classic_`) and Classic Titan `3.80.2` (`_classic_titan_`). Other folders may exist on disk but the addon does not serve them. Never infer the build from the window title, and never assume `WowClassic.exe` means Classic — every non-retail build uses that name.
24
+ ## 完成标准
32
25
 
33
- Before a command that types into the game, confirm the target:
26
+ 一次自动调查需要取得匹配 task/requestId/Ticket 的完整报告,核对身份与校验信息、保存证据、确认 ACK,并完成该回执的界面清理。未完成的阶段必须明确说明。不要为了清理画面重跑任务。
34
27
 
35
- ```text
36
- lycheedev clients # every build on disk, its version, and install state
37
- lycheedev instances # what is running now, with pid and window handle
38
- lycheedev use [index] # pin one as the default target
39
- ```
28
+ - 接收已有 Ticket:先找精确记录,禁止重新执行原任务来“获取同样结果”。
29
+ - 新任务:只在目标安装目录 `Modules/Automation/auto/auto.lua` 更新自己拥有的 task-id 区块;同一次逻辑执行保持 requestId 不变。
30
+ - 错误调查:`bugs --count n` 获取最多 n 条已有错误,不制造新错误填满数量。
31
+ - 完整内容始终走 SV;超过 10 KB 不切换传输方式,不把正文塞进二维码。
32
+ - 测试也是完整工作:每个用例结束或中断时处理自己留下的草稿、回执与任务块,再报告状态;不要在没有解释的情况下留在下一用例的中间步骤。
40
33
 
41
- With several clients open, `--instance <index>` overrides the pin for one command and `--client` filters by build. Different builds can stay open together because the install path separates them. Two windows of the **same** build cannot be told apart from outside the game, so the CLI refuses and names the pids to close — ask the user to close all but one instead of picking for them. Full rules and the precedence order are in [references/clients.md](references/clients.md).
34
+ 保留当前会话已给出的授权,不重复请求常规步骤确认。调查授权不意味着可覆盖其他任务、重置数据库或发布插件;共享游戏实例存在实际占用时先协调。
42
35
 
43
- ## Read SavedVariables
36
+ ## 已有证据与人工工具
44
37
 
45
- 1. Search the user's WoW installation for the global SavedVariables file, normally `WTF/Account/<account>/SavedVariables/Lychee Dev.lua`. The exact account/realm path is installation-specific. Use a filename search or `rg` for `LycheeDevDB`/the Ticket rather than assuming a path.
46
- 2. Treat the file as data, not trusted code. Do not `dofile` or execute an unknown SavedVariables file in the host environment. Use a restricted Lua parser/sandbox or inspect the relevant assignment safely.
47
- 3. For a Ticket `LYCHEE-...`, read:
38
+ SV 是数据:用受限解析器读取,不能在宿主执行 Lua。主记录位于 `LycheeDevDB.exports.records[TICKET]`,完整内容是 `payload.content`;`history` 与 metadata 都不能代替完整报告。未知/较新字段应保留,已有旧性能记录仍可作为历史证据。
48
39
 
49
- ```text
50
- LycheeDevDB.exports.records[TICKET]
51
- LycheeDevDB.exports.records[TICKET].payload.content
52
- ```
40
+ 用户选择手动操作时:Run 支持 `/run` 或 `/script` 和 Lua 5.1;异步调查使用验证过的完成写入机制。对象检查走 `/dev > Objects`,事件监控走 `/dev > Events`。没有独立 `/object`、`/event` 命令;Performance、自动性能采集、health scan 和 benchmark 页面已移除。脚本必须有界,异步资源用清理回调释放,不对可能为 secret 的值直接比较或格式化。
53
41
 
54
- Validate `schema == "lychee.evidence.v1"`, and use `source.kind`, `source.title`, `source.path`, `environment`, and `createdAt` to identify the record. Validate the report schema inside the payload separately; record-level schema/source do not belong to `metadata`. Prefer the exact Ticket already supplied to the owning task, including directly delivered messages; do not ask the user to resend it to several tasks. The payload is the authoritative complete report; `metadata` is bounded context, not a replacement for it.
55
- Current kinds include `run_result`, `object_snapshot`, `object_node`, `event_log`, `function_trace`, `error_log`, and `automation_result` (whose payload is one `lychee.automation.result.v1` JSON report and whose `metadata.contentChecksum` is an Adler-32 over the exact payload bytes). Legacy `performance_*` records remain valid historical evidence; read their complete payload without requiring the deleted module or discarding them.
56
- 4. `LycheeDevDB.exports.order` is newest-first. Recent ad-hoc runs are in `LycheeDevDB.history` and may contain `code`, `result`, and a bounded `tree`; they are not the same as a saved export. Old installations may contain `DumperDB`, which the addon migrates into `LycheeDevDB`.
57
- 5. A record created in-game is only in memory until `/reload`, logout, or exit. If the user has not completed one of those writes, explain that the Ticket cannot yet be found on disk. Exports and history are bounded and older entries can be pruned.
58
-
59
- When reporting persisted evidence, quote the Ticket, source kind, client environment, and the exact payload path. Do not claim that a record is absent until the likely SavedVariables locations and the exact Ticket have been searched.
60
-
61
- ## Run commands
62
-
63
- The runner accepts either `/run` or `/script` prefixes and evaluates Lua 5.1 code. Prefer returning a compact structured report; use `print` for short scalar messages. Check the installed runner and serializer limits before delivery. A returned value is captured immediately, so an asynchronous script needs a verified completion/export writer; do not return an unfinished table and assume later mutations will be saved.
64
-
65
- ```text
66
- /run print(GetBuildInfo())
67
- /run return { addon = MyAddon, profile = MyAddonDB and MyAddonDB.profile }
68
- /script return UIParent and { name = UIParent:GetName(), shown = UIParent:IsShown() }
69
- ```
70
-
71
- Give commands that are explicit and bounded. Avoid unbounded table walks, per-frame polling, network calls, protected UI mutations, and writes to SavedVariables unless the user explicitly requests them. Lychee Dev truncates large run output, and combat blocks the workbench and active inspection/monitoring tools.
72
-
73
- One complete investigation does not mean pasting a bundle of implementation source. Use Run for a small probe; for large source-dependent studies, use a verified independent diagnostic carrier and a short entry command, with its installation/loading and cleanup explained. Never assume WoW can read arbitrary host files or hot-load Lua. When the user asks for one paste, cover the automatic matrix from one practical entry point and one final report; list external actions and missing coverage honestly. For a requested check, include the exact pasteable command, what result to expect, and what field or error the user should report back. If a value may be secret in combat, tell the user to leave combat before running it and do not suggest comparing or formatting that value.
74
-
75
- ## Object inspection
76
-
77
- Use the Objects page for live object state. Valid paths are `_G`, dot-separated identifiers, numeric indexes, and quoted string indexes, for example:
78
-
79
- ```text
80
- _G.MyAddon
81
- MyAddon.db.profile
82
- _G["MyAddon"]["db"]
83
- UIParent
84
- ```
85
-
86
- The page can search globals or fields, expand tables, show frame overview/children/regions, and save an object snapshot or node. The mouse picker temporarily hides the window; press `F` or `Enter` to capture the object under the cursor, `Esc` to cancel. If a path is not known, use a short run command to return the candidate global, then inspect that path in Objects.
87
-
88
- Never promise a complete object graph: inspection is bounded, cyclic tables are marked, and secret combat values stop the read. Protected Blizzard frames must not be mutated as part of a diagnostic command.
89
-
90
- ## Event monitoring
91
-
92
- Use the Events page, not a guessed slash command:
93
-
94
- 1. Search for the uppercase event name in the catalog shown for the running client (for example `PLAYER_TARGET_CHANGED`).
95
- 2. Select one or more events and click **Start Monitoring**.
96
- 3. Reproduce the behavior, click **Stop Monitoring**, inspect payload arguments, and use **Save** if the evidence must be handed to an Agent.
97
-
98
- Event names and payload signatures are build-specific. The supported profiles are Retail `12.1.0`/Interface `120100`, Classic Mists `5.5.4`/`50504`, and Classic Titan `3.80.2`/`38002`; do not transfer a signature between profiles without checking the catalog. `ALL`/“monitor all events” is an explicit diagnostic mode, not a default recommendation. Monitoring is bounded (newest 500 records; at most 16 arguments per record, each shortened), and it stops on combat entry.
99
-
100
- ## Delivery and ownership
101
-
102
- Use available computer controls only within the authorized workflow. Inspect their actual capabilities before attempting game input; a browser-only tool cannot type into WoW. After a failed input attempt, verify focus/state once and use one manual paste when reliable native input is unavailable. Do not loop speculative key presses.
103
-
104
- If the user authorized clipboard delivery, announce the exact script/version, write it, and read back the clipboard to verify equality. Keep that version stable while awaiting execution. A revision needs an explicit replacement notice and a new verification; another task's clipboard, game session, or pending probe is not yours to replace.
105
-
106
- Do not deploy addon changes or run destructive Provider/storage experiments merely to diagnose a problem. Preserve the current task's decision scope: a request for a proposal remains a proposal; an authorized implementation can proceed. A past project's memory target or plan-only decision is not a universal skill restriction.
107
-
108
- ## Handoff format
109
-
110
- For a command request, answer with:
111
-
112
- 1. **Paste:** the exact `/run` or `/script` text, or the `/dev` page and fields to use.
113
- 2. **Reproduce:** the short action sequence and when to start/stop monitoring.
114
- 3. **Report back:** the expected output fields or the Ticket to copy after saving and reloading.
115
-
116
- For a Ticket request, return the record's `source.kind`, client/build, creation time, payload path, and a concise evidence-based finding. Keep observations separate from hypotheses, and state when the evidence is truncated, pending disk write, client-specific, or blocked by combat/secret values.
42
+ 结果说明以用户问题的结论开头,附 Ticket、客户端实际版本、完整 payload 路径和验证边界。区分“提交”“游戏完成”“报告读取”“收尾完成”,不要用一个“成功”掩盖中间阶段。
@@ -1,4 +1,4 @@
1
1
  interface:
2
- display_name: "Lychee Dev skill"
3
- short_description: "Read WoW evidence and prepare bounded Run investigations"
4
- default_prompt: "Use $lychee-dev to investigate a specific WoW issue through Lychee Dev Run, one bounded script, and complete Ticket evidence."
2
+ display_name: "Lychee Dev"
3
+ short_description: "Orchestrate background WoW tasks and verified Ticket evidence"
4
+ default_prompt: "Use $lychee-dev to complete a background WoW investigation through verified Ticket evidence, acknowledgement, cleanup, and recovery if interrupted."