lycheedev 3.1.1 → 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.
- package/README.md +16 -38
- package/THIRD_PARTY_NOTICES +4 -314
- package/bin/lycheedev.mjs +1 -1
- package/bin/update.mjs +26 -32
- package/native/windows-amd64/lycheedev.exe +0 -0
- package/package.json +1 -1
- package/payload/addon/Bindings.xml +12 -0
- package/payload/addon/Bridge/ActivityView.lua +2 -5
- package/payload/addon/Bridge/CaptureWriter.lua +9 -115
- package/payload/addon/Bridge/FocusBindings.lua +71 -0
- package/payload/addon/Bridge/InputProtection.lua +2 -9
- package/payload/addon/Bridge/InputState.lua +15 -19
- package/payload/addon/Bridge/MemoryProtocol.lua +1 -1
- package/payload/addon/Bridge/ProbeExecution.lua +1 -0
- package/payload/addon/Bridge/ReceiverBindings.lua +73 -279
- package/payload/addon/Bridge/SlotProtocol.lua +30 -12
- package/payload/addon/Bridge/SlotRuntime.lua +9 -12
- package/payload/addon/Core/ClientGate.lua +2 -0
- package/payload/addon/Core/Compat.lua +25 -24
- package/payload/addon/Core/Controls.lua +27 -248
- package/payload/addon/Core/Execute.lua +22 -19
- package/payload/addon/Core/Locale.lua +4 -116
- package/payload/addon/Core/Locale_enUS.lua +4 -116
- package/payload/addon/Core/Persistence.lua +2 -2
- package/payload/addon/Core/Runtime.lua +46 -64
- package/payload/addon/Core/Serializer.lua +9 -1
- package/payload/addon/Core/Startup.lua +20 -0
- package/payload/addon/Core/Stores.lua +63 -95
- package/payload/addon/LICENSE +21 -0
- package/payload/addon/Lychee Dev.toc +10 -21
- package/payload/addon/Modules/AutomationView.lua +47 -383
- package/payload/addon/Modules/Diagnostics.lua +0 -4
- package/payload/addon/Modules/Events/Catalog.lua +1 -1
- package/payload/addon/Modules/Events/CatalogData_Anniversary.lua +1489 -0
- package/payload/addon/Modules/Events/CatalogData_Era.lua +1489 -0
- package/payload/addon/Modules/FunctionTrace.lua +17 -6
- package/payload/addon/Modules/ObjectInspector.lua +27 -25
- package/payload/addon/THIRD_PARTY_NOTICES +483 -0
- package/payload/addon/UI/Pages/Automation.lua +7 -64
- package/payload/addon/UI/Pages/Events.lua +0 -4
- package/payload/addon/UI/Pages/ExportRecords.lua +1 -1
- package/payload/addon/UI/Pages/Object.lua +5 -4
- package/payload/addon/UI/Pages/Run.lua +7 -1
- package/payload/addon/UI/TreeView.lua +0 -11
- package/payload/addon/UI/Widgets.lua +0 -102
- package/payload/addon/UI/Window.lua +0 -6
- package/payload/skill/SKILL.md +11 -2
- package/payload/skill/references/commands.md +17 -27
- package/payload/skill/references/data-hotfix.md +6 -3
- package/payload/skill/references/data-investigation.md +5 -2
- package/payload/skill/references/data-tables.md +4 -0
- package/payload/skill/references/data-targets.md +4 -2
- package/payload/skill/references/installation.md +9 -3
- package/payload/skill/references/live-investigation.md +14 -6
- package/payload/skill/references/live-probes.md +9 -8
- package/payload/skill/references/live-recovery.md +75 -42
- package/payload/skill/references/live-startup.md +97 -76
- package/payload/skill/references/runtime-investigations.md +10 -8
- package/payload/skill/references/source-preparation.md +23 -2
- package/payload/skill/references/source-research.md +58 -5
- package/payload/skill/scripts/lycheedev.mjs +16 -12
- package/release.json +136 -176
- package/payload/addon/Bridge/Definitions.lua +0 -3
- package/payload/addon/Bridge/FaultRunner.lua +0 -44
- package/payload/addon/Bridge/Identity.lua +0 -127
- package/payload/addon/Bridge/InputProtocol.lua +0 -76
- package/payload/addon/Bridge/InputSignal.lua +0 -36
- package/payload/addon/Bridge/Investigation.lua +0 -159
- package/payload/addon/Bridge/MatrixSymbol.lua +0 -1169
- package/payload/addon/Bridge/ProbeQueue.lua +0 -205
- package/payload/addon/Bridge/ProbeRunner.lua +0 -349
- package/payload/addon/Bridge/ReceiptView.lua +0 -316
- package/payload/addon/Bridge/Receiver.lua +0 -326
- package/payload/addon/Bridge/Reentry.lua +0 -261
- package/payload/addon/Bridge/ReportStore.lua +0 -224
- package/payload/addon/Bridge/Session.lua +0 -173
- package/payload/addon/Bridge/StartupBeacon.lua +0 -63
|
@@ -1,316 +1,110 @@
|
|
|
1
1
|
local _, ns = ...
|
|
2
2
|
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
local
|
|
6
|
-
local
|
|
7
|
-
local
|
|
8
|
-
local
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
local
|
|
16
|
-
|
|
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
|
|
46
|
-
if
|
|
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
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
|
105
|
-
|
|
106
|
-
|
|
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,
|
|
36
|
+
if not profile[action] then return nil, "receiver_binding_unavailable:" .. action end
|
|
131
37
|
end
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
local
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
70
|
+
if #assigned > 0 then SaveBindings(GetCurrentBindingSet()) end
|
|
71
|
+
return current()
|
|
204
72
|
end
|
|
205
73
|
local function defer(event)
|
|
206
|
-
|
|
207
|
-
|
|
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
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
266
|
-
|
|
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
|
|
286
|
-
|
|
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
|
-
|
|
302
|
-
local
|
|
303
|
-
if
|
|
304
|
-
|
|
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=
|
|
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=="
|
|
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
|
-
|
|
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="
|
|
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="
|
|
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
|
|
93
|
-
|
|
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~="
|
|
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,
|
|
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
|
|
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="
|
|
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="
|
|
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")=="
|
|
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 "
|
|
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")~="
|
|
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(
|
|
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
|
}
|