lycheedev 3.1.2 → 3.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.
Files changed (77) hide show
  1. package/README.md +16 -38
  2. package/THIRD_PARTY_NOTICES +4 -314
  3. package/bin/lycheedev.mjs +1 -1
  4. package/bin/update.mjs +26 -32
  5. package/native/windows-amd64/lycheedev.exe +0 -0
  6. package/package.json +1 -1
  7. package/payload/addon/Bindings.xml +12 -0
  8. package/payload/addon/Bridge/ActivityView.lua +2 -5
  9. package/payload/addon/Bridge/CaptureWriter.lua +9 -115
  10. package/payload/addon/Bridge/FocusBindings.lua +71 -0
  11. package/payload/addon/Bridge/InputProtection.lua +2 -9
  12. package/payload/addon/Bridge/InputState.lua +15 -19
  13. package/payload/addon/Bridge/MemoryProtocol.lua +1 -1
  14. package/payload/addon/Bridge/ProbeExecution.lua +1 -0
  15. package/payload/addon/Bridge/ReceiverBindings.lua +73 -279
  16. package/payload/addon/Bridge/SlotProtocol.lua +30 -12
  17. package/payload/addon/Bridge/SlotRuntime.lua +9 -12
  18. package/payload/addon/Core/ClientGate.lua +2 -0
  19. package/payload/addon/Core/Compat.lua +25 -24
  20. package/payload/addon/Core/Controls.lua +27 -248
  21. package/payload/addon/Core/Execute.lua +22 -19
  22. package/payload/addon/Core/Locale.lua +4 -116
  23. package/payload/addon/Core/Locale_enUS.lua +4 -116
  24. package/payload/addon/Core/Persistence.lua +2 -2
  25. package/payload/addon/Core/Runtime.lua +46 -64
  26. package/payload/addon/Core/Serializer.lua +9 -1
  27. package/payload/addon/Core/Startup.lua +20 -0
  28. package/payload/addon/Core/Stores.lua +63 -95
  29. package/payload/addon/LICENSE +21 -0
  30. package/payload/addon/Lychee Dev.toc +10 -21
  31. package/payload/addon/Modules/AutomationView.lua +47 -383
  32. package/payload/addon/Modules/Diagnostics.lua +0 -4
  33. package/payload/addon/Modules/Events/Catalog.lua +1 -1
  34. package/payload/addon/Modules/Events/CatalogData_Anniversary.lua +1489 -0
  35. package/payload/addon/Modules/Events/CatalogData_Era.lua +1489 -0
  36. package/payload/addon/Modules/FunctionTrace.lua +17 -6
  37. package/payload/addon/Modules/ObjectInspector.lua +27 -25
  38. package/payload/addon/THIRD_PARTY_NOTICES +483 -0
  39. package/payload/addon/UI/Pages/Automation.lua +7 -64
  40. package/payload/addon/UI/Pages/Events.lua +0 -4
  41. package/payload/addon/UI/Pages/ExportRecords.lua +1 -1
  42. package/payload/addon/UI/Pages/Object.lua +5 -4
  43. package/payload/addon/UI/Pages/Run.lua +7 -1
  44. package/payload/addon/UI/TreeView.lua +0 -11
  45. package/payload/addon/UI/Widgets.lua +0 -102
  46. package/payload/addon/UI/Window.lua +0 -6
  47. package/payload/skill/SKILL.md +11 -2
  48. package/payload/skill/references/commands.md +17 -27
  49. package/payload/skill/references/data-hotfix.md +6 -3
  50. package/payload/skill/references/data-investigation.md +5 -2
  51. package/payload/skill/references/data-tables.md +4 -0
  52. package/payload/skill/references/data-targets.md +4 -2
  53. package/payload/skill/references/installation.md +9 -3
  54. package/payload/skill/references/live-investigation.md +14 -6
  55. package/payload/skill/references/live-probes.md +9 -8
  56. package/payload/skill/references/live-recovery.md +67 -43
  57. package/payload/skill/references/live-startup.md +97 -76
  58. package/payload/skill/references/runtime-investigations.md +10 -8
  59. package/payload/skill/references/source-preparation.md +23 -2
  60. package/payload/skill/references/source-research.md +58 -5
  61. package/payload/skill/scripts/lycheedev.mjs +16 -12
  62. package/release.json +136 -176
  63. package/payload/addon/Bridge/Definitions.lua +0 -3
  64. package/payload/addon/Bridge/FaultRunner.lua +0 -44
  65. package/payload/addon/Bridge/Identity.lua +0 -127
  66. package/payload/addon/Bridge/InputProtocol.lua +0 -76
  67. package/payload/addon/Bridge/InputSignal.lua +0 -36
  68. package/payload/addon/Bridge/Investigation.lua +0 -159
  69. package/payload/addon/Bridge/MatrixSymbol.lua +0 -1169
  70. package/payload/addon/Bridge/ProbeQueue.lua +0 -205
  71. package/payload/addon/Bridge/ProbeRunner.lua +0 -349
  72. package/payload/addon/Bridge/ReceiptView.lua +0 -316
  73. package/payload/addon/Bridge/Receiver.lua +0 -326
  74. package/payload/addon/Bridge/Reentry.lua +0 -261
  75. package/payload/addon/Bridge/ReportStore.lua +0 -224
  76. package/payload/addon/Bridge/Session.lua +0 -173
  77. package/payload/addon/Bridge/StartupBeacon.lua +0 -63
@@ -1,316 +1,110 @@
1
1
  local _, ns = ...
2
2
 
3
- -- These are runtime override bindings. Only our SavedVariables option is
4
- -- written; the player's account key bindings are never saved or replaced.
5
- local defaults = { wake = "ALT-CTRL-]", submit = "ALT-CTRL-SHIFT-]", close = "ALT-CTRL-[" }
6
- local nativePrimary = { wake = "ALT-CTRL-F12", submit = "ALT-CTRL-SHIFT-F12", close = "ALT-CTRL-[" }
7
- local nativeFallback = { wake = "ALT-CTRL-F11", submit = "ALT-CTRL-SHIFT-F11", close = "ALT-CTRL-[" }
8
- local actions = { "wake", "submit", "close" }
9
- local owner, buttons, handlers, effective
10
- local nativeWarningPrinted = false
3
+ -- Real Bindings.xml actions: defaults are assigned only to free keys. The
4
+ -- current binding set remains authoritative, including changes in Settings.
5
+ local actions = { "wake", "reload" }
6
+ local defaults = { wake = "ALT-CTRL-F12", reload = "ALT-CTRL-F11" }
7
+ local fallback = { wake = "ALT-CTRL-F10", reload = "ALT-CTRL-F9" }
8
+ local handlers, deferred
9
+ _G.BINDING_HEADER_LYCHEEDEV = "Lychee Dev"
10
+ _G.BINDING_NAME_LYCHEEDEV_WAKE = ns.L.NATIVE_RECEIVER_BINDING_WAKE
11
+ _G.BINDING_NAME_LYCHEEDEV_RELOAD = ns.L.NATIVE_RECEIVER_BINDING_RELOAD
11
12
  local function restricted(value) return issecretvalue and issecretvalue(value) end
12
- local function copy(profile)
13
- return { wake = profile.wake, submit = profile.submit, close = profile.close }
14
- end
15
- local function terminal(chord)
16
- if restricted(chord) or type(chord) ~= "string" or #chord > 24 then return nil end
17
- local key = string.match(chord, "^ALT%-CTRL%-SHIFT%-(.+)$")
18
- or string.match(chord, "^ALT%-CTRL%-(.+)$")
19
- if key == "[" or key == "]" then return key end
20
- if type(key) == "string" then
21
- local n = string.match(key, "^F([1-9]%d?)$")
22
- if n and tonumber(n) <= 12 and key == "F" .. tostring(tonumber(n)) then return key end
23
- end
24
- return nil
25
- end
26
- local function validate(profile)
27
- if restricted(profile) or type(profile) ~= "table" then return nil, "receiver_binding_invalid" end
28
- local keys, seen = {}, {}
29
- for _, action in ipairs(actions) do
30
- local chord = profile[action]
31
- local key = terminal(chord)
32
- if not key then return nil, "receiver_binding_invalid" end
33
- if seen[chord] then return nil, "receiver_binding_duplicate" end
34
- seen[chord], keys[action] = true, key
35
- end
36
- -- Focused EditBox key events do not reliably carry physical modifier state
37
- -- on the tested PostMessage path. Closing must have a unique terminal key.
38
- if keys.close == keys.wake or keys.close == keys.submit then
39
- return nil, "receiver_close_key_conflict"
40
- end
41
- return copy(profile)
13
+ local function actionName(action) return "LYCHEEDEV_" .. string.upper(action) end
14
+ local function validChord(chord)
15
+ if restricted(chord) or type(chord) ~= "string" then return false end
16
+ local key = chord:match("^ALT%-CTRL%-F(%d+)$")
17
+ return key ~= nil and tonumber(key) >= 1 and tonumber(key) <= 12 and tostring(tonumber(key)) == key
42
18
  end
43
19
  local function noncombat()
44
20
  if type(InCombatLockdown) ~= "function" then return nil, "receiver_combat_unavailable" end
45
- local ok, combat = pcall(InCombatLockdown)
46
- if not ok or restricted(combat) or type(combat) ~= "boolean" then
47
- return nil, "receiver_combat_unavailable"
48
- end
21
+ local combat = InCombatLockdown()
22
+ if restricted(combat) or type(combat) ~= "boolean" then return nil, "receiver_combat_unavailable" end
49
23
  if combat then return nil, "receiver_combat" end
50
24
  return true
51
25
  end
52
- local function bindingAction(action)
53
- return "CLICK LycheeDevReceiver" .. string.upper(string.sub(action, 1, 1)) .. string.sub(action, 2) .. ":LeftButton"
54
- end
55
- local function bindingDetail(value)
56
- if restricted(value) or type(value) ~= "string" then return nil end
57
- return string.sub(value, 1, 128):gsub("[%z\1-\31\127]", "?")
58
- end
59
- local function conflict(profile)
60
- if type(GetBindingAction) ~= "function" then return nil, "receiver_bindings_unavailable" end
61
- for _, action in ipairs(actions) do
62
- local chord = profile[action]
63
- for _, override in ipairs({ false, true }) do
64
- local ok, bound = pcall(GetBindingAction, chord, override)
65
- if not ok or restricted(bound) or (bound ~= nil and type(bound) ~= "string") then
66
- return nil, "receiver_bindings_unavailable"
67
- end
68
- if bound and bound ~= "" and bound ~= "NONE" and bound ~= bindingAction(action) then
69
- return nil, "receiver_binding_conflict:" .. action .. ":" .. chord, bindingDetail(bound)
70
- end
71
- end
72
- end
73
- return true
74
- end
75
- local function clear()
76
- if type(ClearOverrideBindings) ~= "function" then return nil, "receiver_bindings_unavailable" end
77
- local ok = pcall(ClearOverrideBindings, owner)
78
- if not ok then return nil, "receiver_bindings_unavailable" end
79
- return true
80
- end
81
- local function install(profile)
82
- if not buttons then
83
- buttons = {}
84
- for _, action in ipairs(actions) do
85
- local button = CreateFrame("Button", "LycheeDevReceiver" .. string.upper(string.sub(action, 1, 1)) .. string.sub(action, 2), UIParent)
86
- button:RegisterForClicks("AnyDown")
87
- button:SetScript("OnClick", handlers[action])
88
- buttons[action] = button
89
- end
90
- end
91
- local clean, failure = clear()
92
- if not clean then return nil, failure end
93
- for _, action in ipairs(actions) do
94
- local ok, result = pcall(SetOverrideBindingClick, owner, false, profile[action], buttons[action]:GetName())
95
- if not ok or result == false then
96
- clear()
97
- return nil, "receiver_bindings_unavailable"
98
- end
26
+ local function current()
27
+ if type(GetBindingKey) ~= "function" or type(GetBindingAction) ~= "function" then
28
+ return nil, "receiver_bindings_unavailable"
99
29
  end
100
- -- The API call can succeed while a higher-priority override still wins.
101
- -- Do not advertise a configured chord unless the actual lookup resolves
102
- -- to the button that owns that action.
30
+ local profile = {}
103
31
  for _, action in ipairs(actions) do
104
- local ok, resolved = pcall(GetBindingAction, profile[action], true)
105
- if not ok or restricted(resolved) or type(resolved) ~= "string"
106
- or resolved ~= bindingAction(action) then
107
- clear()
108
- return nil, "receiver_binding_ineffective:" .. action .. ":" .. profile[action], bindingDetail(resolved)
109
- end
110
- end
111
- return true
112
- end
113
- local function apply(profile)
114
- local valid, failure = validate(profile)
115
- if not valid then return nil, failure end
116
- local ready, detail
117
- ready, failure = noncombat()
118
- if not ready then return nil, failure end
119
- ready, failure, detail = conflict(valid)
120
- if not ready then return nil, failure, detail end
121
- local prior = effective and copy(effective)
122
- ready, failure, detail = install(valid)
123
- if not ready then
124
- if prior then
125
- local restored = install(prior)
126
- effective = restored and prior or nil
127
- else
128
- effective = nil
32
+ local name = actionName(action)
33
+ for _, key in ipairs({ GetBindingKey(name) }) do
34
+ if validChord(key) and GetBindingAction(key, true) == name then profile[action] = key; break end
129
35
  end
130
- return nil, failure, detail
36
+ if not profile[action] then return nil, "receiver_binding_unavailable:" .. action end
131
37
  end
132
- effective = valid
133
- return copy(valid)
134
- end
135
- local function nativeConflict(reason)
38
+ return profile
39
+ end
40
+ local function installDefaults()
41
+ local ready, reason = noncombat()
42
+ if not ready then return nil, reason end
43
+ if type(SetBinding) ~= "function" or type(GetBindingKey) ~= "function"
44
+ or type(GetBindingAction) ~= "function" or type(SaveBindings) ~= "function"
45
+ or type(GetCurrentBindingSet) ~= "function" then return nil, "receiver_bindings_unavailable" end
46
+ local pending = {}
136
47
  for _, action in ipairs(actions) do
137
- local suffix = action .. ":" .. nativePrimary[action]
138
- if reason == "receiver_binding_conflict:" .. suffix
139
- or reason == "receiver_binding_ineffective:" .. suffix then return true end
140
- end
141
- return false
142
- end
143
- local function displayChord(chord)
144
- return chord:gsub("ALT%-CTRL%-SHIFT%-", "Ctrl+Alt+Shift+"):gsub("ALT%-CTRL%-", "Ctrl+Alt+")
145
- end
146
- local function nativeFailureText(reason, profile)
147
- local locale = ns.L or {}
148
- for _, action in ipairs(actions) do
149
- local suffix = action .. ":" .. profile[action]
150
- local label = locale["NATIVE_RECEIVER_BINDING_" .. string.upper(action)] or action
151
- if reason == "receiver_binding_conflict:" .. suffix then
152
- return string.format(locale.NATIVE_RECEIVER_BINDING_CONFLICT or "%s shortcut %s is occupied", label, displayChord(profile[action]))
153
- elseif reason == "receiver_binding_ineffective:" .. suffix then
154
- return string.format(locale.NATIVE_RECEIVER_BINDING_INEFFECTIVE or "%s shortcut %s is ineffective", label, displayChord(profile[action]))
155
- end
156
- end
157
- return tostring(reason)
158
- end
159
- local function applyNative(warn)
160
- local profile, failure, detail = apply(nativePrimary)
161
- if profile or not nativeConflict(failure) then return profile, failure end
162
- local primaryFailure, primaryDetail = failure, detail
163
- profile, failure, detail = apply(nativeFallback)
164
- if warn and not nativeWarningPrinted then
165
- nativeWarningPrinted = true
166
- local locale = ns.L or {}
167
- local unknown = locale.NOT_AVAILABLE or "unavailable"
168
- local text
169
- if profile then
170
- text = string.format(locale.NATIVE_RECEIVER_BINDING_FALLBACK
171
- or "%s (binding action: %s). Selected fallback shortcuts: wake %s, submit %s, close %s.",
172
- nativeFailureText(primaryFailure, nativePrimary), primaryDetail or unknown,
173
- displayChord(profile.wake), displayChord(profile.submit), displayChord(profile.close))
174
- else
175
- text = string.format(locale.NATIVE_RECEIVER_BINDING_BLOCKED
176
- or "Primary and fallback shortcuts are unavailable; input is blocked. Primary: %s (binding action: %s); fallback: %s (binding action: %s). Existing bindings were preserved.",
177
- nativeFailureText(primaryFailure, nativePrimary), primaryDetail or unknown,
178
- nativeFailureText(failure, nativeFallback), detail or unknown)
48
+ -- An existing assignment belongs to the user, even if unsupported or
49
+ -- currently masked by another addon's override. Never replace it.
50
+ if not GetBindingKey(actionName(action)) then
51
+ for _, profile in ipairs({ defaults, fallback }) do
52
+ local key = profile[action]
53
+ local bound, effective = GetBindingAction(key, false), GetBindingAction(key, true)
54
+ if (not bound or bound == "" or bound == "NONE")
55
+ and (not effective or effective == "" or effective == "NONE") then
56
+ pending[#pending + 1] = { key = key, action = actionName(action) }
57
+ break
58
+ end
59
+ end
179
60
  end
180
- print("|cffd83b4eLychee Dev:|r " .. text)
181
61
  end
182
- return profile, failure
183
- end
184
- local function stored()
185
- if ns.SlotRuntime then return copy(defaults) end
186
- local state, failure = ns.Persistence.Current()
187
- if not state then return nil, failure end
188
- local profile = state.options and state.options.receiverBindings
189
- if profile == nil then return copy(defaults) end
190
- return validate(profile)
191
- end
192
- local function current()
193
- if not effective then return nil, "receiver_bindings_unavailable" end
194
- if type(GetBindingAction) ~= "function" then return nil, "receiver_bindings_unavailable" end
195
- for _, action in ipairs(actions) do
196
- local ok, resolved = pcall(GetBindingAction, effective[action], true)
197
- if not ok or restricted(resolved) or type(resolved) ~= "string"
198
- or not buttons or not buttons[action]
199
- or resolved ~= bindingAction(action) then
200
- return nil, "receiver_binding_ineffective:" .. action .. ":" .. effective[action]
62
+ local assigned = {}
63
+ for _, entry in ipairs(pending) do
64
+ if not SetBinding(entry.key, entry.action) then
65
+ for _, key in ipairs(assigned) do SetBinding(key) end
66
+ return nil, "receiver_bindings_unavailable"
201
67
  end
68
+ assigned[#assigned + 1] = entry.key
202
69
  end
203
- return copy(effective)
70
+ if #assigned > 0 then SaveBindings(GetCurrentBindingSet()) end
71
+ return current()
204
72
  end
205
73
  local function defer(event)
206
- owner:RegisterEvent(event)
207
- owner:SetScript("OnEvent", function(self)
74
+ if not deferred then deferred = CreateFrame("Frame") end
75
+ deferred:RegisterEvent(event)
76
+ deferred:SetScript("OnEvent", function(self)
208
77
  self:UnregisterAllEvents(); self:SetScript("OnEvent", nil)
209
- local profile, failure = stored()
210
- local ready
211
- if profile then
212
- if ns.SlotRuntime then ready, failure = applyNative(true)
213
- else ready, failure = apply(profile) end
214
- end
215
- if not ready and failure == "receiver_combat" then defer("PLAYER_REGEN_ENABLED")
216
- elseif not ready then ns.Startup.receiverFailure = failure end
78
+ local ok, reason = installDefaults()
79
+ if not ok and reason == "receiver_combat" then defer("PLAYER_REGEN_ENABLED")
80
+ elseif ns.Startup then ns.Startup.receiverFailure = reason end
81
+ if ns.Bootstrap then ns.Bootstrap.Publish() end
217
82
  end)
218
83
  return true
219
84
  end
220
-
221
85
  ns.ReceiverBindings = {
222
- Defaults = function() return copy(defaults) end,
86
+ Dispatch = function(action)
87
+ if not handlers or not handlers[action] then return nil, "receiver_binding_not_ready" end
88
+ return handlers[action]()
89
+ end,
223
90
  Current = current,
224
91
  Display = function(action)
225
92
  local profile = current()
226
- if not profile or not profile[action] then return nil end
227
- return string.gsub(profile[action], "ALT%-CTRL%-SHIFT%-", "Ctrl+Alt+Shift+")
228
- :gsub("ALT%-CTRL%-", "Ctrl+Alt+")
229
- end,
230
- MatchKey = function(key, action)
231
- if restricted(key) or type(key) ~= "string" or not effective or not effective[action] then return false end
232
- return key == terminal(effective[action])
233
- end,
234
- ConfigureProfile = function(profile)
235
- if ns.SlotRuntime then return nil,"receiver_bindings_fixed" end
236
- if ns.Receiver and ns.Receiver.IsActive and ns.Receiver.IsActive() then return nil,"receiver_active" end
237
- if not owner then return nil,"receiver_bindings_unavailable" end
238
- local state,failure=ns.Persistence.Current()
239
- if not state then return nil,failure end
240
- local applied
241
- applied,failure=apply(profile)
242
- if not applied then return nil,failure end
243
- state.options.receiverBindings=copy(applied)
244
- return copy(applied)
245
- end,
246
- Configure = function(action, chord)
247
- if ns.SlotRuntime then return nil,"receiver_bindings_fixed" end
248
- if action ~= "wake" and action ~= "submit" and action ~= "close" then return nil, "receiver_binding_action_invalid" end
249
- if ns.Receiver and type(ns.Receiver.IsActive) == "function" and ns.Receiver.IsActive() then
250
- return nil, "receiver_active"
251
- end
252
- if not owner then return nil, "receiver_bindings_unavailable" end
253
- local state, failure = ns.Persistence.Current()
254
- if not state then return nil, failure end
255
- local proposed = copy(effective or defaults)
256
- proposed[action] = chord
257
- local applied
258
- applied, failure = apply(proposed)
259
- if not applied then return nil, failure end
260
- state.options = state.options or {}
261
- state.options.receiverBindings = applied
262
- return copy(applied)
93
+ return profile and profile[action] and profile[action]:gsub("ALT%-CTRL%-", "Ctrl+Alt+")
263
94
  end,
264
95
  Reset = function()
265
- if ns.SlotRuntime and ns.SlotRuntime.IsActive and ns.SlotRuntime.IsActive() then
266
- return nil, "receiver_active"
267
- end
268
- if ns.Receiver and type(ns.Receiver.IsActive) == "function" and ns.Receiver.IsActive() then
269
- return nil, "receiver_active"
270
- end
271
- if not owner then return nil, "receiver_bindings_unavailable" end
272
- -- Native keys are fixed; explicit recovery reapplies only our runtime
273
- -- overrides and preserves the saved legacy profile.
274
- if ns.SlotRuntime then return applyNative(true) end
275
- local state, failure = ns.Persistence.Current()
276
- if not state then return nil, failure end
277
- local applied
278
- applied, failure = apply(defaults)
279
- if not applied then return nil, failure end
280
- state.options = state.options or {}
281
- state.options.receiverBindings = nil
282
- return copy(applied)
96
+ if ns.InputProtection and ns.InputProtection.IsActive() then return nil, "receiver_active" end
97
+ return installDefaults()
283
98
  end,
284
99
  Register = function(callbacks)
285
- if owner then
286
- local profile, failure = current()
287
- return profile and true or nil, failure
288
- end
289
- if not ns.Startup.ready then return nil, "addon_not_ready" end
290
- if type(callbacks) ~= "table" or type(callbacks.wake) ~= "function"
291
- or type(callbacks.submit) ~= "function" or type(callbacks.close) ~= "function" then
100
+ if handlers then local profile, reason = current(); return profile and true or nil, reason end
101
+ if type(callbacks) ~= "table" or type(callbacks.wake) ~= "function" or type(callbacks.reload) ~= "function" then
292
102
  return nil, "receiver_binding_callbacks_invalid"
293
103
  end
294
- if type(SetOverrideBindingClick) ~= "function" or type(CreateFrame) ~= "function" then
295
- return nil, "receiver_bindings_unavailable"
296
- end
297
- if ns.SlotRuntime then
298
- defaults = copy(nativePrimary)
299
- end
300
104
  handlers = callbacks
301
- owner = CreateFrame("Frame", nil, UIParent)
302
- local loggedIn = true
303
- if type(IsLoggedIn) == "function" then
304
- local ok, result = pcall(IsLoggedIn)
305
- loggedIn = ok and not restricted(result) and result == true
306
- end
307
- if not loggedIn then return defer("PLAYER_LOGIN") end
308
- local profile, failure = stored()
309
- if not profile then return nil, failure end
310
- local ready
311
- if ns.SlotRuntime then ready, failure = applyNative(true)
312
- else ready, failure = apply(profile) end
313
- if not ready and failure == "receiver_combat" then return defer("PLAYER_REGEN_ENABLED") end
314
- return ready and true or nil, failure
105
+ if type(IsLoggedIn) == "function" and IsLoggedIn() ~= true then return defer("PLAYER_LOGIN") end
106
+ local profile, reason = installDefaults()
107
+ if not profile and reason == "receiver_combat" then return defer("PLAYER_REGEN_ENABLED") end
108
+ return profile and true or nil, reason
315
109
  end,
316
110
  }
@@ -3,7 +3,7 @@ local _, ns = ...
3
3
  -- Pure bounded protocol engine. Host input, frames, file loading and async
4
4
  -- execution are adapters; there is only one owner and one active business job.
5
5
  local ZERO=string.rep("0",32)
6
- local LIMIT=200
6
+ local LIMIT=500
7
7
  local MAX_OPERATIONS=math.floor((LIMIT-16)/4)
8
8
  local function plain(v)return not (issecretvalue and issecretvalue(v)) and type(v)=="table" and getmetatable(v)==nil end
9
9
  local function safe(v)return not (issecretvalue and issecretvalue(v))end
@@ -26,14 +26,18 @@ ns.SlotProtocol = { Count=LIMIT, Create=function(adapter)
26
26
  local sequence,count,cursor=0,0,1
27
27
  local consumed,operations,receipts={},{},{}
28
28
  local descriptor
29
+ local closing=false
29
30
  -- Passive copies only. Public maps must never alias protocol state: callers
30
31
  -- may inspect or overwrite them without changing nonce/owner decisions.
31
32
  local mailbox,mailboxReceipts,mailboxBodies
32
33
  local api={}
33
34
  function api.AttachMailbox(publication)
34
- assert(plain(publication) and publication.schema=="lycheedev.mailbox.v1"
35
+ assert(plain(publication) and publication.schema=="Lycheedev mailbox protocol v1"
35
36
  and publication.runtime==adapter.runtime and publication.release==adapter.release,"invalid slot mailbox")
36
- mailbox,mailboxReceipts,mailboxBodies=publication,{},{}
37
+ -- A fixed non-token key keeps each public hash allocated before the
38
+ -- first receipt and after the last BODY is released. Missing token
39
+ -- lookups remain absent; private protocol maps contain only records.
40
+ mailbox,mailboxReceipts,mailboxBodies=publication,{schema=publication.schema},{schema=publication.schema}
37
41
  rawset(mailbox,"receipts",mailboxReceipts);rawset(mailbox,"bodies",mailboxBodies)
38
42
  rawset(mailbox,"identity",descriptor)
39
43
  for nonce,record in pairs(receipts) do rawset(mailboxReceipts,nonce,record) end
@@ -64,7 +68,7 @@ ns.SlotProtocol = { Count=LIMIT, Create=function(adapter)
64
68
  if sequence>=4294967295 then return nil,"slot_sequence_exhausted" end
65
69
  local a=actor();if not a then return nil,"slot_actor_unavailable" end
66
70
  sequence=sequence+1
67
- local value={schema="lycheedev.slot.v3",runtime=adapter.runtime,owner=owner or "",fence=fence or 0,
71
+ local value={schema="Lycheedev mailbox protocol v1",runtime=adapter.runtime,owner=owner or "",fence=fence or 0,
68
72
  nonce=e.nonce,ticket=e.ticket or ZERO,action=e.action,state=state,sequence=sequence,
69
73
  nextSlot=nextSlot(),slots=LIMIT,character=a.character,realm=a.realm,guid=a.guid,
70
74
  build=adapter.build,product=adapter.product,release=adapter.release,inventory=adapter.inventory,inputState=adapter.inputState}
@@ -78,7 +82,7 @@ ns.SlotProtocol = { Count=LIMIT, Create=function(adapter)
78
82
  end
79
83
  function api.Describe()
80
84
  local a=actor();if not a then return nil,"slot_actor_unavailable" end
81
- local text=encode({schema="lycheedev.slot.identity.v2",runtime=adapter.runtime,owner=owner or "",fence=fence or 0,
85
+ local text=encode({schema="Lycheedev mailbox protocol v1",runtime=adapter.runtime,owner=owner or "",fence=fence or 0,
82
86
  nextSlot=nextSlot(),slots=LIMIT,character=a.character,realm=a.realm,guid=a.guid,
83
87
  build=adapter.build,product=adapter.product,release=adapter.release,inventory=adapter.inventory,inputState=adapter.inputState},16384)
84
88
  if not text then return nil,"slot_identity_encoding" end
@@ -89,17 +93,18 @@ ns.SlotProtocol = { Count=LIMIT, Create=function(adapter)
89
93
  local function finish(op,ok,value,metadata)
90
94
  if op.state~="running" then return nil,"slot_not_running" end
91
95
  op.resourcesReleased=not metadata or metadata.resourcesReleased~=false
92
- local text,reason=encode({ok=ok,result=ok and value or nil,error=not ok and value or nil,
93
- resourcesReleased=op.resourcesReleased,logs=metadata and metadata.logs or nil},524288)
96
+ local report={ok=ok,resourcesReleased=op.resourcesReleased,logs=metadata and metadata.logs or nil}
97
+ if ok then report.result=value else report.error=value end
98
+ local text,reason=encode(report,524288)
94
99
  if not text then ok=false;text=assert(encode({ok=false,error=type(reason)=="string" and reason or "report_encoding_failed"},16384)) end
95
100
  -- Store body and outcome before constructing its public response.
96
101
  op.payload=text;op.bytes=#text;op.checksum=wire.Checksum(text)
97
102
  op.body=assert(wire.Encode(op.envelope.nonce,adapter.runtime,op.envelope.ticket,3,3,op.sequence,text))
98
103
  if mailboxBodies then rawset(mailboxBodies,op.envelope.ticket,op.body) end
99
- op.state="reported";op.ok=ok
104
+ op.state="reported";op.ok=ok;op.execution=nil
100
105
  observe(op)
101
106
  local record,value=publish(op.envelope,"reported",{reportBytes=op.bytes,reportChecksum=op.checksum,challenge=op.challenge})
102
- if adapter.activity then adapter.activity("collecting",op.envelope.ticket) end
107
+ if adapter.activity and not closing then adapter.activity("collecting",op.envelope.ticket) end
103
108
  return record,value
104
109
  end
105
110
  local function reject(e,reason)
@@ -114,7 +119,7 @@ ns.SlotProtocol = { Count=LIMIT, Create=function(adapter)
114
119
  if not plain(e) then return nil,"slot_envelope_invalid" end
115
120
  -- Never inspect or execute encoded business code before these checks.
116
121
  for _,key in ipairs({"schema","index","runtime","owner","fence","nonce","ticket","action","guid","build","challenge","preparedNonce","reportBytes","reportChecksum"}) do if not safe(e[key]) then return nil,"slot_secret_envelope" end end
117
- if e.schema~="lycheedev.slot.v3" or e.index~=index or not wire.Token(e.nonce)
122
+ if e.schema~="Lycheedev mailbox protocol v1" or e.index~=index or not wire.Token(e.nonce)
118
123
  or not wire.Token(e.ticket) or not wire.Token(e.owner) or not wire.Token(e.runtime) then return nil,"slot_envelope_invalid" end
119
124
  if e.runtime~=adapter.runtime then
120
125
  if type(e.guid)~="string" or type(e.build)~="string"
@@ -164,7 +169,8 @@ ns.SlotProtocol = { Count=LIMIT, Create=function(adapter)
164
169
  local record,value=publish(e,"accepted")
165
170
  if adapter.releaseInput then adapter.releaseInput() end
166
171
  if adapter.activity then adapter.activity("running",e.ticket) end
167
- local ok,reason=pcall(adapter.execute,op.fn,op.envelope.budget,function(ok,result,metadata)return finish(op,ok,result,metadata)end)
172
+ local ok,execution=pcall(adapter.execute,op.fn,op.envelope.budget,function(ok,result,metadata)return finish(op,ok,result,metadata)end)
173
+ if ok and op.state=="running" then op.execution=execution end
168
174
  if not ok and op.state=="running" then finish(op,false,"probe_executor_error") end
169
175
  return record,value
170
176
  elseif e.action=="confirm" then
@@ -192,13 +198,25 @@ ns.SlotProtocol = { Count=LIMIT, Create=function(adapter)
192
198
  return reject(e,"slot_action_invalid")
193
199
  end
194
200
  function api.NextSlot()return nextSlot()end
201
+ function api.Close()
202
+ closing=true
203
+ if active and active.state=="running" and active.execution then
204
+ active.execution:Cancel()
205
+ active.execution=nil
206
+ end
207
+ if pending then
208
+ local op=pending;pending=nil;active=op;op.state="running"
209
+ finish(op,false,"probe_cancelled")
210
+ end
211
+ closing=false
212
+ end
195
213
  function api.InputIdentity()
196
214
  local a=actor();if not a then return nil end
197
215
  return {runtime=adapter.runtime,owner=owner or "",fence=fence or 0,nextSlot=nextSlot(),
198
216
  guid=a.guid,build=adapter.build,character=a.character,realm=a.realm}
199
217
  end
200
218
  function api.Snapshot()
201
- -- At most 200 receipts/consumed bits and 46 operation fact objects.
219
+ -- At most 500 receipts/consumed bits and 121 operation fact objects.
202
220
  -- Immutable strings may be shared; execution functions, callbacks,
203
221
  -- code and writable private tables never leave the engine.
204
222
  local result={descriptor=descriptor,receipts={},operations={},owner=owner,fence=fence,consumed={}}
@@ -8,13 +8,13 @@ local zero=string.rep("0",32)
8
8
  local attemptSequence,attemptActive,attemptReceived,lastAttempt=0,false,false,nil
9
9
  local attemptReasons={slot_input_not_ready=true,input_protection_not_ready=true,input_protection_busy=true,
10
10
  input_protection_unavailable=true,input_protection_timer_unavailable=true,slot_exhausted=true,
11
- slot_loader_no_dispatch=true,slot_inventory_incomplete=true,slot_load_failed=true,slot_wake_failed=true}
11
+ slot_loader_no_dispatch=true,slot_inventory_incomplete=true,slot_load_failed=true,slot_addon_disabled=true,slot_wake_failed=true}
12
12
  local function noteAttempt(stage,reason,slot)
13
13
  if not attemptActive or not runtimeToken or not engine then return end
14
14
  if reason and not attemptReasons[reason] then
15
15
  reason=type(reason)=="string" and reason:match("^slot_inventory_incomplete:") and "slot_inventory_incomplete" or "slot_wake_rejected"
16
16
  end
17
- lastAttempt={schema="lycheedev.input-attempt.v1",runtime=runtimeToken,attemptSeq=attemptSequence,
17
+ lastAttempt={schema="Lycheedev mailbox protocol v1",runtime=runtimeToken,attemptSeq=attemptSequence,
18
18
  slot=slot or engine.NextSlot(),stage=stage,reason=reason or "",received=attemptReceived}
19
19
  end
20
20
  local function attemptSnapshot()
@@ -42,7 +42,7 @@ local function activity(state,ticket)
42
42
  end
43
43
  local function publishMailbox(runtime)
44
44
  if not mailbox then
45
- mailbox={schema="lycheedev.mailbox.v1",release=ns.Release,runtime=runtime,receipts={},bodies={}}
45
+ mailbox={schema="Lycheedev mailbox protocol v1",release=ns.Release,runtime=runtime,receipts={},bodies={}}
46
46
  engine.AttachMailbox(mailbox)
47
47
  end
48
48
  ns.Mailbox=mailbox
@@ -77,11 +77,11 @@ local function start()
77
77
  local name=string.format("Lychee Dev Slot %02d",i)
78
78
  if ns.Compat.GetAddOnMetadata(name,"X-Lychee-Slot")==tostring(i)
79
79
  and ns.Compat.GetAddOnMetadata(name,"Version")==ns.Release
80
- and ns.Compat.GetAddOnMetadata(name,"X-Lychee-Transport")=="memory-slot-v3" then available=available+1 end
80
+ and ns.Compat.GetAddOnMetadata(name,"X-Lychee-Transport")=="Lycheedev mailbox protocol v1" then available=available+1 end
81
81
  end
82
82
  ns.AutomationHistory.Begin(runtime,{character=actor.character,realm=actor.realm,guid=actor.guid,build=build.build,product=build.product})
83
83
  engine=ns.SlotProtocol.Create({runtime=runtime,build=build.build,product=build.product,release=ns.Release,inventory=available,
84
- inputState=ns.InputState and "lycheedev.input.hybrid.v2" or nil,
84
+ inputState=ns.InputState and "Lycheedev mailbox protocol v1" or nil,
85
85
  actor=function()
86
86
  local current=ns.Platform.ObserveActor()
87
87
  if current and current.guid==actor.guid then return current end
@@ -101,7 +101,7 @@ local function inventory()
101
101
  local name=string.format("Lychee Dev Slot %02d",i)
102
102
  if ns.Compat.GetAddOnMetadata(name,"X-Lychee-Slot")~=tostring(i)
103
103
  or ns.Compat.GetAddOnMetadata(name,"Version")~=ns.Release
104
- or ns.Compat.GetAddOnMetadata(name,"X-Lychee-Transport")~="memory-slot-v3" then return nil,"slot_inventory_incomplete:"..i end
104
+ or ns.Compat.GetAddOnMetadata(name,"X-Lychee-Transport")~="Lycheedev mailbox protocol v1" then return nil,"slot_inventory_incomplete:"..i end
105
105
  end
106
106
  return true
107
107
  end
@@ -112,10 +112,9 @@ local function wake()
112
112
  if attemptActive then attemptSequence=attemptSequence+1;attemptReceived=false;lastAttempt=nil end
113
113
  local ok,reason=start();if not ok then return nil,reason end
114
114
  noteAttempt("entered")
115
- if ns.Platform.ObserveInputState(true)~=true and not receiving then return nil,"slot_input_not_ready" end
115
+ if ns.Platform.ObserveInputState(ns.FocusBindings and ns.FocusBindings.Ready())~=true then return nil,"slot_input_not_ready" end
116
116
  ok,reason=inventory();if not ok then return nil,reason end
117
117
  state.options.bridgeEnabled=true -- Explicit wake opts in; explicit off stays off.
118
- if ns.StartupBeacon then ns.StartupBeacon.Stop() end
119
118
  ok,reason=protectInput();if not ok then releaseInput();return nil,reason end
120
119
  -- One wake may traverse foreign/empty physical slots, but can process at
121
120
  -- most one own-runtime envelope. A rejected own envelope is still a stop.
@@ -127,7 +126,7 @@ local function wake()
127
126
  noteAttempt("loading",nil,index)
128
127
  local loaded,failure=ns.Compat.LoadInputSlot(string.format("Lychee Dev Slot %02d",index))
129
128
  expectedSlot=nil
130
- if not loaded then noteAttempt("load_failed","slot_load_failed",index);releaseInput();engine.Describe();return nil,failure end
129
+ if not loaded then noteAttempt("load_failed",failure=="slot_addon_disabled" and failure or "slot_load_failed",index);releaseInput();engine.Describe();return nil,failure end
131
130
  if skipLoaded==nil then noteAttempt("no_dispatch","slot_loader_no_dispatch",index);releaseInput();engine.Describe();return nil,"slot_loader_no_dispatch" end
132
131
  if not skipLoaded then break end
133
132
  end
@@ -156,6 +155,7 @@ local function guardedWake()
156
155
  end
157
156
  local function close()
158
157
  releaseInput()
158
+ if engine then engine.Close() end
159
159
  ns.InputProtection.Cancel()
160
160
  if ns.InputState then ns.InputState.Refresh() end
161
161
  end
@@ -172,7 +172,4 @@ ns.SlotRuntime={
172
172
  return record,value
173
173
  end,
174
174
  Snapshot=function()return engine and engine.Snapshot()end,
175
- Register=function()
176
- return ns.ReceiverBindings.Register({wake=guardedWake,submit=guardedWake,close=close})
177
- end,
178
175
  }
@@ -11,6 +11,8 @@ ns.Client = nil
11
11
  local baselines = {
12
12
  { product = "forever", version = "1.60.1", interface = 16001 },
13
13
  { product = "classic", version = "5.5.4", interface = 50504 },
14
+ { product = "classic-era", version = "1.15.9", interface = 11509 },
15
+ { product = "anniversary", version = "2.5.6", interface = 20506 },
14
16
  { product = "titan", version = "3.80.2", interface = 38002 },
15
17
  { product = "retail", version = "12.1.0", interface = 120100 },
16
18
  }