lycheedev 1.0.5 → 1.1.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.
@@ -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")
@@ -28,17 +28,30 @@ The Performance page, automatic capture, health scan and function benchmark have
28
28
 
29
29
  ## Know which client you are driving
30
30
 
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.
31
+ Four builds are supported: Retail `12.1.0` (`_retail_`), Classic `5.5.4` (`_classic_`), Classic Titan `3.80.2` (`_classic_titan_`) and WoW: Forever (无限服) `1.60.1` (`_classic_beta_`, or `_forever_`). Other folders may exist on disk — `_classic_era_`, `_anniversary_`, `_beta_` — and the addon does not serve those; `_classic_beta_` is served when it holds Forever, so never decide from the folder name. Never infer the build from the window title, and never assume `WowClassic.exe` means Classic — every non-retail build uses that name.
32
+
33
+ A folder name is a location, not an identity: the launcher reuses a test folder for whatever is on the test track, so Forever currently lives under `_classic_beta_`, which a MoP-era classic test client also uses. The CLI resolves each client from its own `.flavor.info` product code and build instead of the folder; do the same when reasoning about a machine, and never promise a build because a folder is named a certain way.
32
34
 
33
35
  Before a command that types into the game, confirm the target:
34
36
 
35
37
  ```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
38
+ lycheedev clients # every build on disk, its version, and install state
39
+ lycheedev instances # what is running now, with pid and window handle
40
+ lycheedev instances --identify # also read each window's character and build
41
+ lycheedev use [index] # pin one as the default target
42
+ lycheedev use --character <name> # pin the window reporting that character
43
+ ```
44
+
45
+ When more than one window is running and you cannot tell them apart, ask the user to run `/dev auto identify` in the windows they care about, then run `lycheedev instances --identify`. That reads a small identity QR code from the top-left corner of each window — through window capture, so no window is focused and nothing is typed — and prints the character and build behind every window:
46
+
47
+ ```text
48
+ [0] Retail pid=62460 hwnd=0x12410c7a v12.1.0.69587
49
+ character: 荔枝-白银之手 client: retail build: 12.1.0
39
50
  ```
40
51
 
41
- With several clients open, `--instance <index>` overrides the pin for one command and `--client` filters by build. Same-build instances are ambiguous and the CLI refuses to guess. Full rules and the precedence order are in [references/clients.md](references/clients.md).
52
+ Then pin the intended window by name — `lycheedev use --character 荔枝-白银之手` — and confirm that character back to the user, instead of guessing from a pid. `/dev auto unidentify` hides the marker again. The marker is not shown by default because it shares the corner with the completion notice.
53
+
54
+ With several clients open, `--instance <index>` or `--character <name>` overrides the pin for one command, and `--client` filters by build. Different builds can stay open together because each install holds its own addon copy. Two windows of the **same** build that show the **same character and realm** — or that show no marker at all — still cannot be told apart, so 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).
42
55
 
43
56
  ## Read SavedVariables
44
57
 
@@ -95,7 +108,7 @@ Use the Events page, not a guessed slash command:
95
108
  2. Select one or more events and click **Start Monitoring**.
96
109
  3. Reproduce the behavior, click **Stop Monitoring**, inspect payload arguments, and use **Save** if the evidence must be handed to an Agent.
97
110
 
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.
111
+ Event names and payload signatures are build-specific. The supported profiles are Retail `12.1.0`/Interface `120100`, Classic Mists `5.5.4`/`50504`, Classic Titan `3.80.2`/`38002`, and WoW: Forever `1.60.1`/`16001`; 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
112
 
100
113
  ## Delivery and ownership
101
114
 
@@ -14,7 +14,7 @@ data; it never runs at load. After an input-side `/reload`, the command
14
14
  `/dev auto run <task-id>` executes the block. While it runs, three RGB status
15
15
  blocks show at the top-left of the screen. When the result is committed to the
16
16
  in-memory SavedVariables database, they are replaced by one static QR code at
17
- the top-right that carries only the identity:
17
+ the top-left that carries only the identity:
18
18
  `{"v":1,"ticket":"...","task":"...","run":"...","ts":...}`. `capture`, `run`
19
19
  and `bugs` keep one WGC capture session open and poll it until that notice is
20
20
  decoded or `--timeout` expires. The tooling then cross-checks the notice `task`
@@ -116,8 +116,27 @@ effects. Generate bounded, cancellable probes only.
116
116
  | `/dev auto show <ticket>` | Re-shows the notice for a kept historical result. |
117
117
  | `/dev auto cancel <task-id>` | Cooperative cancel; saves a cancelled report and its Ticket. |
118
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. |
119
121
  | `/dev auto stop` | Hides the notice UI only; the pending record and the busy state stay. |
120
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 |
134
+
135
+ `lycheedev instances --identify` reads the markers through window capture, so no
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.
139
+
121
140
  ### Reporting the read outcome back
122
141
 
123
142
  The plugin cannot observe whether the host actually read a result, so nothing on
@@ -151,6 +170,37 @@ Global options, valid for every subcommand:
151
170
  orchestration session, and use `--all-installations` when inspecting more
152
171
  than one.
153
172
 
173
+ ### identify
174
+
175
+ Reads the in-game identity marker from one or more game windows, so a window can
176
+ be named before anything is typed into it. Nothing observable from outside the
177
+ game says which character is behind which window; the marker is how the game
178
+ tells you.
179
+
180
+ ```text
181
+ python scripts/automation.py identify --hwnd 0x1234 [--hwnd 0x5678] [--timeout 1.5]
182
+ python scripts/automation.py identify --windows-json <instances.json>
183
+ ```
184
+
185
+ - `--windows-json <file>` takes the instance list printed by
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
+
154
204
  ### task
155
205
 
156
206
  `task upsert|remove|list` with `--install-dir <dir>` or `--profile <name>`.
@@ -168,8 +218,21 @@ python scripts/automation.py profile show --name retail-main
168
218
  ```
169
219
 
170
220
  `profile set` requires `--client`, `--wow-root` and `--addon-dir`; both
171
- directories must exist. The stored profile also records the client folder
172
- (`retail` -> `_retail_`, `classic` -> `_classic_`, `titan` -> `_classic_arena`).
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:
224
+
225
+ | `--client` | Client folder |
226
+ | --- | --- |
227
+ | `retail` | `_retail_` |
228
+ | `classic` | `_classic_` |
229
+ | `titan` | `_classic_titan_` |
230
+ | `forever` | `_classic_beta_`, or `_forever_` |
231
+
232
+ A folder name is a location rather than an identity: WoW: Forever currently ships
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.
173
236
  Profiles are written atomically to `<data-dir>/profiles.json`.
174
237
 
175
238
  ### sv find / sv read
@@ -220,7 +283,7 @@ python scripts/automation.py send --hwnd 0x1234 --text "/reload" \
220
283
 
221
284
  - `capture` opens one `windows-capture` session for the window, decodes the
222
285
  QR with `zxingcpp.read_barcodes` (QR only) and prints the notice JSON. It
223
- compares the top-right ROI on every `--interval` (default 0.1 s) until
286
+ compares the top-left ROI on every `--interval` (default 0.1 s) until
224
287
  `--timeout` (default 120 s) expires, then exits 5. Only the newest ROI is
225
288
  kept, so frames never pile up.
226
289
  - `send` always logs `command_sent` before input. When the text is `/reload`
@@ -281,7 +344,7 @@ uncertainty in your findings.
281
344
  | 2 | Task registry failure (schema, kind, marker, revision conflict, lock/limit refusal). |
282
345
  | 3 | SavedVariables read or verification failure after all attempts. |
283
346
  | 4 | Window identity, command input, or missing optional capture dependency (`windows-capture`/`numpy`/`zxing-cpp`) failure. |
284
- | 5 | No notice decoded before the timeout, or the game did not rewrite its SavedVariables file in time. |
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. |
285
348
 
286
349
  Expected failures print one `error: ...` line on stderr; they never dump a
287
350
  traceback for a missing dependency, a missing argument or a bad source file.
@@ -299,6 +362,12 @@ uses only the interfaces those versions actually expose: `read_barcodes`
299
362
  with `on_frame_arrived`/`on_closed` handlers, `start_free_threaded()` /
300
363
  `CaptureControl.stop()` and `Frame.convert_to_bgr()`.
301
364
 
365
+ `capture`, `run`, `bugs` and `identify` read the screen and need these packages;
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.
370
+
302
371
  ## Recovery
303
372
 
304
373
  ```text
@@ -316,12 +385,29 @@ record that uncertainty in your findings.
316
385
 
317
386
  ## Known verification gaps
318
387
 
319
- Live-window steps (WGC capture, SendInput delivery, real SavedVariables
320
- writes, DPI/scaling) are implemented against the verified installed package
321
- interfaces but have not been exercised in a running game. Before relying on
322
- them: run `capture`/`send` against a real client, measure the notice QR size
323
- and DPI scaling per client, confirm command input reliability, and record real
324
- reload timing. The offline-verified parts are the task registry writer, the
325
- restricted SavedVariables reader and verifier, the session log/dedup/artifacts,
326
- the notice validation and identity checks, the polling shape and the CLI exit
327
- behaviour; they are covered by `scripts/selftest_offline.py`.
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`.
@@ -13,28 +13,58 @@ The addon ships one catalog per supported build. Nothing else loads it.
13
13
  | Retail | `12.1.0` | `120100` | `Lychee Dev_Mainline.toc` | `_retail_` |
14
14
  | Classic | `5.5.4` | `50504` | `Lychee Dev_Mists.toc` | `_classic_` |
15
15
  | Classic Titan | `3.80.2` | `38002` | `Lychee Dev_Wrath.toc` | `_classic_titan_` |
16
+ | WoW: Forever (无限服) | `1.60.1` | `16001` | `Lychee Dev_Forever.toc` | `_classic_beta_` or `_forever_` |
16
17
 
17
18
  Other folders may exist on a machine (`_classic_era_`, `_anniversary_`,
18
19
  `_beta_`). They are reported as **not served by the addon** and are deliberately
19
20
  skipped. Do not install into them and do not tell the user they are supported.
20
21
 
22
+ `_classic_beta_` is the exception and must not be lumped in with those: it **is**
23
+ served when it holds WoW: Forever (see below). Never decide either way from the
24
+ folder name — read the client's own product code and build first.
25
+
21
26
  The Titan folder is `_classic_titan_`. An earlier release used
22
27
  `_classic_arena_`, which does not exist; that made an installed Titan client
23
28
  invisible to both `install` and `doctor`. If a user reports "Titan was never
24
29
  installed", check the folder name before anything else.
25
30
 
31
+ ## A folder is a location, not an identity
32
+
33
+ Do not decide the build from the folder name. The launcher reuses a test folder
34
+ for whatever is on the test track, so **WoW: Forever currently ships under
35
+ `_classic_beta_`**, a folder that a MoP-era classic test client also uses. The
36
+ same folder can therefore be two different products over time.
37
+
38
+ The signal that actually identifies a client is the client's own files:
39
+
40
+ | Signal | Where | Example |
41
+ | --- | --- | --- |
42
+ | product code | `.flavor.info` in the flavor folder | `wow_forever`, `wow_classic_titan`, `wow` |
43
+ | build | `version.txt` in the flavor folder | `1.60.1.69893` |
44
+ | exe version | file metadata on `WowClassic.exe` | `5.5.4.69585` |
45
+
46
+ Resolution order the CLI uses, and that you should follow when reasoning about a
47
+ machine: product code first, then the build, then the folder default. So
48
+ `_classic_beta_` holding `1.60.x` / `wow_forever` is **Forever**, while the same
49
+ folder holding `5.5.x` / `wow_classic_beta` is the **Classic Beta** test track.
50
+
51
+ `_forever_` is also accepted, for installs that give Forever its own folder.
52
+
26
53
  ## The executable name does not identify the build
27
54
 
28
55
  Every non-retail client ships as `WowClassic.exe`. `Wow.exe` is retail,
29
56
  `WowB.exe` is beta, and `WowVoiceProxy.exe` is a helper, not a client.
30
57
 
31
- The **install path** does identify the build, because each one lives under a
32
- `_build_` directory:
58
+ So the executable name narrows a running process to *some* non-retail client and
59
+ nothing more. The install path narrows it to one install folder — but not to a
60
+ product, because a folder can be reused (see above). Only the client's own
61
+ `.flavor.info` product code and build settle which client it is:
33
62
 
34
63
  ```text
35
- D:\Game\World of Warcraft\_retail_\Wow.exe -> retail
36
- D:\Game\World of Warcraft\_classic_\WowClassic.exe -> classic
37
- D:\Game\World of Warcraft\_classic_titan_\WowClassic.exe -> titan
64
+ D:\Game\World of Warcraft\_retail_\Wow.exe folder default: retail
65
+ D:\Game\World of Warcraft\_classic_\WowClassic.exe folder default: classic
66
+ D:\Game\World of Warcraft\_classic_titan_\WowClassic.exe folder default: titan
67
+ D:\Game\World of Warcraft\_classic_beta_\WowClassic.exe product decides: forever or classicBeta
38
68
  ```
39
69
 
40
70
  Never infer the build from the window title. Retail's title is localized (for
@@ -51,9 +81,15 @@ the addon is installed:
51
81
  retail _retail_ v12.1.0.69587 addon installed
52
82
  classic _classic_ v5.5.4.69585 addon installed
53
83
  titan _classic_titan_ v3.80.2.69496 addon installed
84
+ forever _classic_beta_ v1.60.1.69893 addon installed
54
85
  classicEra _classic_era_ v1.15.9.69547 not served by the addon
55
86
  ```
56
87
 
88
+ The `id` column already reflects the resolved product, so `forever` appearing
89
+ next to `_classic_beta_` is expected and is exactly the case a folder name alone
90
+ would get wrong. When the folder's own product code differs from the resolved
91
+ one, it is shown in brackets before the version.
92
+
57
93
  ### `lycheedev instances`
58
94
 
59
95
  Which clients are running right now, with the pid, window handle and build:
@@ -67,34 +103,91 @@ commands target this instance automatically
67
103
 
68
104
  The `[index]` is what you pass to `--instance` and to `use`.
69
105
 
106
+ ### `lycheedev instances --identify`
107
+
108
+ Reads a small identity QR code from the top-left corner of each running window and
109
+ prints the character and build behind it:
110
+
111
+ ```text
112
+ running instances:
113
+ [0] Retail pid=62460 hwnd=0x12410c7a v12.1.0.69587
114
+ character: 荔枝-白银之手 client: retail build: 12.1.0
115
+ [1] Forever pid=71824 hwnd=0x2b30e1f4 v1.60.1.69893
116
+ character: 测试小号-白银之手 client: forever build: 1.60.1
117
+
118
+ commands target this instance automatically
119
+ ```
120
+
121
+ The marker is not shown by default: it occupies the same corner as the completion
122
+ notice. Ask the user to run `/dev auto identify` **in each window they care about**,
123
+ then run this command. `/dev auto unidentify` hides it again.
124
+
125
+ Reading uses window capture (`Windows.Graphics.Capture`), so no window needs the
126
+ foreground and nothing is typed into the game. A window that shows no marker is
127
+ reported as having no identity rather than failing; that is the normal state until
128
+ the user asks for one.
129
+
130
+ Use this to turn an arbitrary index into a name the user can confirm. Tell the user
131
+ which character you are about to drive before you send anything.
132
+
70
133
  ### `lycheedev use [index]`
71
134
 
72
135
  Pin one running client as the default target, so later commands need no flag:
73
136
 
74
137
  ```text
75
- lycheedev use # the only running client
76
- lycheedev use 1 # the instance at index 1
138
+ lycheedev use # the only running client
139
+ lycheedev use 1 # the instance at index 1, when the builds differ
140
+ lycheedev use --character 荔枝-白银之手 # the window reporting that character
77
141
  lycheedev use --clear
78
142
  ```
79
143
 
80
- Only the build and the instance ordinal are stored, because pids and window
81
- handles change on every launch. The pin therefore survives a restart: it
82
- re-resolves against whatever is running now. If the pinned build is not
83
- running, commands fail with a clear message instead of typing into the wrong
84
- game.
144
+ The pin stores the build and the instance ordinal, because pids and window handles
145
+ change on every launch. When the window showed its identity marker the character is
146
+ stored too, and that is the durable half: the pin then follows the character even if
147
+ the windows are reopened in a different order. It re-resolves against whatever is
148
+ running now, and if the pinned build is not running, commands fail with a clear
149
+ message instead of typing into the wrong game.
150
+
151
+ Pinning by name is how you choose **between windows of the same build**; see the
152
+ ambiguity rule below for the case where even that cannot separate them.
85
153
 
86
154
  ## Choosing a target: precedence
87
155
 
88
156
  1. `--hwnd` / `--pid` — explicit, for scripted use
89
157
  2. `--instance <index>` — one command only, overrides the pin
90
- 3. the saved pin from `use`
91
- 4. `--client retail|classic|titan` — filter by build
92
- 5. the single running instance, when there is exactly one
158
+ 3. `--character <name>` — the window reporting that character (`Name` or `Name-Realm`)
159
+ 4. the saved pin from `use`
160
+ 5. `--client retail|classic|titan|forever` — filter by build
161
+ 6. the single running instance, when there is exactly one
162
+
163
+ Several instances of **different** builds are safe to keep open: the install path
164
+ separates them, so `--client` picks one.
165
+
166
+ Several instances of the **same** build are distinguishable only when each window
167
+ reports a different character. Show the markers (`/dev auto identify` in each
168
+ window) and then either pass `--character <name>` or pin by name:
169
+
170
+ ```text
171
+ lycheedev use --character 荔枝-白银之手
172
+ ```
173
+
174
+ `use` probes the markers by itself when several windows share a build, because
175
+ reading them is capture-only and types nothing.
176
+
177
+ Two windows reporting the **same character and realm** — or two windows that show
178
+ no marker at all — are genuinely indistinguishable. Pinning an ordinal there would
179
+ only look precise while risking a slash command in the wrong game, so the CLI
180
+ refuses and names the pids to close:
181
+
182
+ ```text
183
+ error: 2 Retail clients cannot be told apart
184
+ close all but one, or close these pids: 62460, 71824
185
+ or run `/dev auto identify` in each game window and then
186
+ `lycheedev use --character <name>`
187
+ ```
93
188
 
94
- Several instances of **different** builds are separated by `--client`. Several
95
- instances of the **same** build are genuinely ambiguous: the CLI prints the
96
- table and fails instead of guessing, because a wrong guess types a slash command
97
- into the wrong game.
189
+ **In that case ask the user to close all but one window of that build.** Do not
190
+ invent a way to pick between them, and do not offer to pin one by pid.
98
191
 
99
192
  ## Multiple installations
100
193
 
@@ -105,15 +198,19 @@ inspect a second root without changing the saved one.
105
198
 
106
199
  ## What cannot be done from outside the game
107
200
 
108
- - The **character** on a running client is not readable without a
109
- build-specific memory reader. Nothing here guesses it. Two instances of the
110
- same build can only be told apart by pid, window handle or index.
111
- - The **account** behind a running client is likewise not exposed. SavedVariables
112
- files are per account, and the newest file is not necessarily the live
113
- session's account when several accounts are configured.
114
- - WoW ignores posted window messages, so keyboard delivery needs the window in
115
- the foreground. That is why targeting the right window matters.
116
-
117
- If the user must be certain which client is which, ask them to run a trivial
118
- in-game command (`/dev auto status <task>`) in the window they mean, or to close
119
- the others.
201
+ - The **character** behind a window is not passively observable. It only becomes
202
+ readable when the addon is loaded in that client and the user shows the identity
203
+ marker (`/dev auto identify`), which `instances --identify` then reads. Without
204
+ that cooperation, two instances of the same build can only be referred to by pid,
205
+ window handle or index — never by name, and never guessed.
206
+ - Two windows showing the **same character and realm** stay indistinguishable even
207
+ with the marker, because the marker content is identical.
208
+ - The **account** behind a running client is not exposed. SavedVariables files are
209
+ per account, and the newest file is not necessarily the live session's account
210
+ when several accounts are configured.
211
+ - WoW ignores posted window messages, so keyboard delivery needs the window in the
212
+ foreground. That is why targeting the right window matters.
213
+
214
+ If the user must be certain which client is which, and the marker is unavailable,
215
+ ask them to run a trivial in-game command (`/dev auto status <task>`) in the window
216
+ they mean, or to close the others.