lycheedev 2.5.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/native/windows-amd64/lycheedev.exe +0 -0
- package/package.json +1 -1
- package/payload/addon/Bridge/ActivityView.lua +26 -12
- package/payload/addon/Bridge/InputProtection.lua +63 -0
- package/payload/addon/Bridge/InputSignal.lua +36 -0
- package/payload/addon/Bridge/InputState.lua +93 -0
- package/payload/addon/Bridge/MemoryProtocol.lua +31 -0
- package/payload/addon/Bridge/ProbeExecution.lua +147 -0
- package/payload/addon/Bridge/ReceiverBindings.lua +6 -0
- package/payload/addon/Bridge/SlotProtocol.lua +172 -0
- package/payload/addon/Bridge/SlotRuntime.lua +125 -0
- package/payload/addon/Bridge/StartupBeacon.lua +8 -11
- package/payload/addon/Core/Compat.lua +16 -0
- package/payload/addon/Core/Controls.lua +16 -0
- package/payload/addon/Core/Locale.lua +6 -4
- package/payload/addon/Core/Locale_enUS.lua +4 -2
- package/payload/addon/Core/Platform.lua +4 -2
- package/payload/addon/Core/Runtime.lua +17 -6
- package/payload/addon/Lychee Dev.toc +9 -2
- package/payload/addon/Modules/AutomationHistory.lua +119 -0
- package/payload/addon/Modules/AutomationView.lua +26 -6
- package/payload/addon/UI/Pages/About.lua +0 -3
- package/payload/addon/UI/Pages/Automation.lua +40 -27
- package/payload/addon/UI/Pages/Diagnostics.lua +2 -4
- package/payload/addon/UI/Pages/Object.lua +0 -1
- package/payload/addon/UI/Pages/Run.lua +2 -1
- package/payload/addon/UI/Pages/Trace.lua +0 -1
- package/payload/addon/UI/Theme.lua +3 -2
- package/payload/addon/UI/Widgets.lua +32 -22
- package/payload/addon/UI/Window.lua +3 -35
- package/payload/skill/SKILL.md +89 -162
- package/payload/skill/agents/openai.yaml +2 -2
- package/payload/skill/references/asset-export.md +1 -1
- package/payload/skill/references/commands.md +37 -35
- package/payload/skill/references/data-hotfix.md +112 -0
- package/payload/skill/references/data-investigation.md +74 -320
- package/payload/skill/references/data-recovery.md +55 -0
- package/payload/skill/references/data-tables.md +170 -0
- package/payload/skill/references/data-targets.md +93 -0
- package/payload/skill/references/error-diagnosis.md +8 -12
- package/payload/skill/references/installation.md +20 -13
- package/payload/skill/references/live-investigation.md +84 -367
- package/payload/skill/references/live-probes.md +160 -0
- package/payload/skill/references/live-recovery.md +190 -0
- package/payload/skill/references/live-startup.md +63 -133
- package/payload/skill/references/runtime-investigations.md +17 -3
- package/payload/skill/references/source-preparation.md +58 -0
- package/payload/skill/references/source-relations.md +51 -0
- package/payload/skill/references/source-research.md +66 -162
- package/payload/skill/references/source-value-flow.md +48 -0
- package/release.json +155 -75
- package/payload/addon/UI/Pages/Settings.lua +0 -82
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,14 +2,17 @@ local _, ns = ...
|
|
|
2
2
|
|
|
3
3
|
-- Presentation has no input authority. The receiver owns the short input
|
|
4
4
|
-- shield; this independent, click-through companion owns only task feedback.
|
|
5
|
-
local frame, receiving, requestId, startedAt, failed
|
|
5
|
+
local frame, receiving, requestId, startedAt, failed, collecting, collectionTimer
|
|
6
|
+
local function clearTimer()
|
|
7
|
+
if collectionTimer then collectionTimer:Cancel();collectionTimer=nil end
|
|
8
|
+
end
|
|
6
9
|
local function create()
|
|
7
10
|
frame = CreateFrame("Frame", nil, UIParent)
|
|
8
11
|
frame:Hide()
|
|
9
|
-
frame:SetSize(120,
|
|
12
|
+
frame:SetSize(120, 120)
|
|
10
13
|
frame:SetFrameStrata("DIALOG")
|
|
11
14
|
frame:EnableMouse(false)
|
|
12
|
-
frame:SetPoint("TOPLEFT", UIParent, "TOPLEFT",
|
|
15
|
+
frame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 8, -12)
|
|
13
16
|
local anchor = CreateFrame("Frame", nil, frame)
|
|
14
17
|
anchor:SetSize(96, 96)
|
|
15
18
|
anchor:SetPoint("TOP", frame, "TOP", 0, 0)
|
|
@@ -19,13 +22,11 @@ local function create()
|
|
|
19
22
|
frame.logo:SetTexture(ns.Widgets.LOGO_TEXTURE)
|
|
20
23
|
frame.logo:SetTexCoord(0, 1, 0, 1)
|
|
21
24
|
frame.label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
22
|
-
ns.Theme.SetFont(frame.label,
|
|
25
|
+
ns.Theme.SetFont(frame.label, 14, ns.Theme.text)
|
|
23
26
|
frame.label:SetPoint("TOP", anchor, "BOTTOM", 0, 0)
|
|
24
27
|
frame:SetScript("OnHide", function(self) self:SetScript("OnUpdate", nil) end)
|
|
25
28
|
end
|
|
26
|
-
local function anchor()
|
|
27
|
-
if frame and not failed then ns.ReceiptView.AnchorCompanion(frame) end
|
|
28
|
-
end
|
|
29
|
+
local function anchor() end -- Position belongs to this view, never a receipt.
|
|
29
30
|
local function render()
|
|
30
31
|
if not receiving and not requestId then
|
|
31
32
|
if frame then frame:SetScript("OnUpdate", nil); frame:Hide() end
|
|
@@ -34,7 +35,7 @@ local function render()
|
|
|
34
35
|
end
|
|
35
36
|
if not frame then create() end
|
|
36
37
|
startedAt = startedAt or GetTime()
|
|
37
|
-
frame.label:SetText(receiving and ns.L.ACTIVITY_CONNECTING or ns.L.ACTIVITY_PROBE)
|
|
38
|
+
frame.label:SetText(receiving and ns.L.ACTIVITY_CONNECTING or collecting and ns.L.ACTIVITY_COLLECTING or ns.L.ACTIVITY_PROBE)
|
|
38
39
|
anchor()
|
|
39
40
|
local current = ns.Persistence.Current()
|
|
40
41
|
local reduced = current and current.options and current.options.reducedMotion == true
|
|
@@ -51,6 +52,7 @@ local function update()
|
|
|
51
52
|
-- Cosmetic failure cannot interrupt execution or retain an input
|
|
52
53
|
-- shield. Fence repeated construction attempts for this runtime.
|
|
53
54
|
failed = true
|
|
55
|
+
clearTimer()
|
|
54
56
|
if frame then
|
|
55
57
|
if frame.SetScript then pcall(frame.SetScript,frame,"OnUpdate",nil) end
|
|
56
58
|
if frame.Hide then pcall(frame.Hide,frame) end
|
|
@@ -59,12 +61,24 @@ local function update()
|
|
|
59
61
|
end
|
|
60
62
|
ns.ActivityView = {
|
|
61
63
|
Receiving = function(value) receiving = value == true; update() end,
|
|
62
|
-
Begin = function(id) requestId = id; update() end,
|
|
64
|
+
Begin = function(id) clearTimer();collecting=false;requestId = id; update() end,
|
|
65
|
+
Collecting = function(id)
|
|
66
|
+
clearTimer();requestId=id;collecting=true;update()
|
|
67
|
+
if C_Timer and C_Timer.NewTimer then collectionTimer=C_Timer.NewTimer(20,function()
|
|
68
|
+
collectionTimer=nil
|
|
69
|
+
if requestId~=id or not collecting then return end
|
|
70
|
+
if frame then frame:SetScript("OnUpdate",nil) end
|
|
71
|
+
collectionTimer=C_Timer.NewTimer(5,function()
|
|
72
|
+
collectionTimer=nil
|
|
73
|
+
if requestId==id and collecting then requestId=nil;collecting=false;update() end
|
|
74
|
+
end)
|
|
75
|
+
end) end
|
|
76
|
+
end,
|
|
63
77
|
Finish = function(id)
|
|
64
|
-
if requestId == id then requestId = nil; update() end
|
|
78
|
+
if requestId == id then clearTimer();requestId = nil;collecting=false; update() end
|
|
65
79
|
end,
|
|
66
|
-
Stop = function() receiving, requestId = false, nil; update() end,
|
|
80
|
+
Stop = function() clearTimer();receiving, requestId, collecting = false, nil, false; update() end,
|
|
67
81
|
Refresh = update,
|
|
68
82
|
Anchor = anchor,
|
|
69
|
-
Current = function() return receiving and "connecting" or requestId and "probe" or nil, requestId end,
|
|
83
|
+
Current = function() return receiving and "connecting" or collecting and "collecting" or requestId and "probe" or nil, requestId end,
|
|
70
84
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
local _, ns = ...
|
|
2
|
+
|
|
3
|
+
-- One short, runtime-local lease. No UI or event work until explicitly acquired.
|
|
4
|
+
-- This shields this game's UI; it is not a system-wide keyboard/mouse lock.
|
|
5
|
+
local frame, active, unavailable
|
|
6
|
+
local function release(token, reason)
|
|
7
|
+
if not active or active ~= token then return false end
|
|
8
|
+
local prior=active;active=nil
|
|
9
|
+
if prior.timer then pcall(prior.timer.Cancel,prior.timer) end
|
|
10
|
+
frame:Hide();frame:UnregisterAllEvents();frame:SetScript("OnEvent",nil)
|
|
11
|
+
if ns.ActivityView then pcall(ns.ActivityView.Receiving,false) end
|
|
12
|
+
if reason and prior.interrupted then prior.interrupted(reason) end
|
|
13
|
+
return true
|
|
14
|
+
end
|
|
15
|
+
ns.InputProtection={
|
|
16
|
+
Acquire=function(seconds, interrupted, transport)
|
|
17
|
+
if unavailable then return nil,"input_protection_unavailable" end
|
|
18
|
+
if active then return nil,"input_protection_busy" end
|
|
19
|
+
if (issecretvalue and issecretvalue(seconds)) or type(seconds)~="number"
|
|
20
|
+
or seconds~=seconds or seconds<=0 or seconds==math.huge then return nil,"input_protection_invalid_budget" end
|
|
21
|
+
if ns.Platform.ObserveInputState(transport==true)~=true then return nil,"input_protection_not_ready" end
|
|
22
|
+
if not C_Timer or type(C_Timer.NewTimer)~="function" then return nil,"input_protection_timer_unavailable" end
|
|
23
|
+
if not frame then
|
|
24
|
+
local candidate
|
|
25
|
+
local created=pcall(function()
|
|
26
|
+
candidate=CreateFrame("Frame",nil,UIParent)
|
|
27
|
+
candidate:Hide();candidate:SetAllPoints(UIParent);candidate:SetFrameStrata("TOOLTIP")
|
|
28
|
+
candidate:EnableMouse(true);candidate:EnableMouseWheel(true);candidate:EnableKeyboard(true)
|
|
29
|
+
candidate:SetScript("OnKeyDown",function(self,key)
|
|
30
|
+
local chord=ns.Compat.ReceiverChord(key)
|
|
31
|
+
local token=active
|
|
32
|
+
self:SetPropagateKeyboardInput(false)
|
|
33
|
+
if chord=="ALT-CTRL-[" then release(token,"input_protection_cancelled");return end
|
|
34
|
+
if token and token.transport then
|
|
35
|
+
self:SetPropagateKeyboardInput(chord=="ALT-CTRL-F12" or chord=="ALT-CTRL-SHIFT-F12")
|
|
36
|
+
end
|
|
37
|
+
end)
|
|
38
|
+
end)
|
|
39
|
+
if not created then
|
|
40
|
+
unavailable=true
|
|
41
|
+
if candidate then pcall(candidate.Hide,candidate) end
|
|
42
|
+
return nil,"input_protection_unavailable"
|
|
43
|
+
end
|
|
44
|
+
frame=candidate
|
|
45
|
+
end
|
|
46
|
+
local token={interrupted=interrupted,transport=transport==true}
|
|
47
|
+
active=token
|
|
48
|
+
local ok=pcall(function()
|
|
49
|
+
token.timer=C_Timer.NewTimer(seconds,function()release(token,"input_protection_timeout")end)
|
|
50
|
+
assert(token.timer,"input_protection_timer_unavailable")
|
|
51
|
+
frame:RegisterEvent("PLAYER_REGEN_DISABLED");frame:RegisterEvent("PLAYER_LEAVING_WORLD")
|
|
52
|
+
frame:SetScript("OnEvent",function(_,event)release(token,event=="PLAYER_REGEN_DISABLED"
|
|
53
|
+
and "input_protection_combat" or "input_protection_world_changed")end)
|
|
54
|
+
frame:Show()
|
|
55
|
+
if ns.ActivityView then ns.ActivityView.Receiving(true) end
|
|
56
|
+
end)
|
|
57
|
+
if not ok then release(token);return nil,"input_protection_unavailable" end
|
|
58
|
+
return token
|
|
59
|
+
end,
|
|
60
|
+
Release=function(token)return release(token)end,
|
|
61
|
+
Cancel=function()return release(active,"input_protection_cancelled")end,
|
|
62
|
+
IsActive=function()return active~=nil end,
|
|
63
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
local _, ns = ...
|
|
2
|
+
|
|
3
|
+
-- Three physical 2x2 cells. This display owns no input or independent clock.
|
|
4
|
+
local frame,blocks,lastScale
|
|
5
|
+
local colors={red={1,0,0},green={0,1,0},blue={0,0,1},black={0,0,0},white={1,1,1}}
|
|
6
|
+
local codes={ready={"green","white"},input_keyboard_focus={"red","blue"},input_combat_lockdown={"blue","red"},unknown={"white","black"}}
|
|
7
|
+
local function create()
|
|
8
|
+
if frame then return frame end
|
|
9
|
+
frame=CreateFrame("Frame",nil,UIParent)
|
|
10
|
+
frame:Hide();frame:EnableMouse(false);frame:SetFrameStrata("TOOLTIP");frame:SetFrameLevel(10000)
|
|
11
|
+
blocks={}
|
|
12
|
+
for i=1,3 do blocks[i]=frame:CreateTexture(nil,"ARTWORK") end
|
|
13
|
+
return frame
|
|
14
|
+
end
|
|
15
|
+
ns.InputSignal={
|
|
16
|
+
Frame=create,
|
|
17
|
+
Hide=function()if blocks then for _,block in ipairs(blocks) do block:Hide() end end end,
|
|
18
|
+
Render=function(state,heartbeat)
|
|
19
|
+
local code=codes[state]
|
|
20
|
+
if not frame or not code then return nil end
|
|
21
|
+
local px=ns.Compat.GetPhysicalPixelSize()
|
|
22
|
+
if (issecretvalue and issecretvalue(px)) or type(px)~="number" or px~=px or px<=0 or px==math.huge then return nil end
|
|
23
|
+
if px~=lastScale then
|
|
24
|
+
frame:ClearAllPoints();frame:SetPoint("TOPLEFT",UIParent,"TOPLEFT",0,0);frame:SetSize(6*px,2*px)
|
|
25
|
+
for i,block in ipairs(blocks) do
|
|
26
|
+
block:SetPoint("TOPLEFT",frame,"TOPLEFT",(i-1)*2*px,0);block:SetSize(2*px,2*px)
|
|
27
|
+
end
|
|
28
|
+
lastScale=px
|
|
29
|
+
end
|
|
30
|
+
for i=1,2 do local c=colors[code[i]];blocks[i]:SetColorTexture(c[1],c[2],c[3],1) end
|
|
31
|
+
local value=heartbeat and 1 or 0
|
|
32
|
+
blocks[3]:SetColorTexture(value,value,value,1)
|
|
33
|
+
for _,block in ipairs(blocks) do block:Show() end
|
|
34
|
+
frame:Show();return true
|
|
35
|
+
end,
|
|
36
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
local _, ns = ...
|
|
2
|
+
|
|
3
|
+
-- Owner-approved native transport telemetry. One sampler/display, no input
|
|
4
|
+
-- hooks or focus mutation. Explicit bridge-off removes all recurring work.
|
|
5
|
+
local frame, provider, record, last, sequence, lastTick
|
|
6
|
+
local loading,leaving,refreshing,heartbeat
|
|
7
|
+
local zero=string.rep("0",32)
|
|
8
|
+
local function nativeBindingsReady()
|
|
9
|
+
if not ns.SlotRuntime then return true end
|
|
10
|
+
if not ns.ReceiverBindings or type(ns.ReceiverBindings.Current)~="function" then return false end
|
|
11
|
+
local ok,profile=pcall(ns.ReceiverBindings.Current)
|
|
12
|
+
if not ok or (issecretvalue and issecretvalue(profile)) or type(profile)~="table" then return false end
|
|
13
|
+
for _,key in ipairs({"wake","submit","close"}) do
|
|
14
|
+
if issecretvalue and issecretvalue(profile[key]) then return false end
|
|
15
|
+
end
|
|
16
|
+
return profile.wake=="ALT-CTRL-F12" and profile.submit=="ALT-CTRL-SHIFT-F12" and profile.close=="ALT-CTRL-["
|
|
17
|
+
end
|
|
18
|
+
local function hide()record=nil;ns.InputSignal.Hide() end
|
|
19
|
+
local function sample()
|
|
20
|
+
if loading or leaving or ns.Compat.InWorld()~=true then hide();return end
|
|
21
|
+
local identity=provider and provider()
|
|
22
|
+
if not identity then hide();return end
|
|
23
|
+
local tick=ns.Compat.MonotonicSeconds()
|
|
24
|
+
if not tick or (lastTick and tick<lastTick) then hide();return end
|
|
25
|
+
lastTick=tick
|
|
26
|
+
local ready,reason=ns.Platform.ObserveInputState()
|
|
27
|
+
if issecretvalue and (issecretvalue(ready) or issecretvalue(reason)) then ready,reason=nil,"input_observation_unavailable" end
|
|
28
|
+
if not nativeBindingsReady() then ready,reason=false,"input_binding_unavailable" end
|
|
29
|
+
if ready~=true and (type(reason)~="string" or reason=="") then reason="input_observation_unavailable" end
|
|
30
|
+
sequence=sequence+1
|
|
31
|
+
if sequence>=4294967295 then ns.InputState.Stop();return end
|
|
32
|
+
identity.schema="lycheedev.input.v1"
|
|
33
|
+
identity.sampleMillis=math.floor(tick*1000)
|
|
34
|
+
identity.inputBlocked=ready~=true
|
|
35
|
+
identity.reason=reason or ""
|
|
36
|
+
local text=ns.CaptureWriter.Encode(identity,2048)
|
|
37
|
+
if not text then hide();return end
|
|
38
|
+
record=ns.MemoryProtocol.Encode(identity.runtime,identity.runtime,zero,5,1,sequence,text)
|
|
39
|
+
if not record then hide();return end
|
|
40
|
+
local state=ready==true and "ready" or (reason=="input_keyboard_focus" or reason=="input_combat_lockdown") and reason or "unknown"
|
|
41
|
+
local nextHeartbeat=not heartbeat
|
|
42
|
+
if not ns.InputSignal.Render(state,nextHeartbeat) then hide();return end
|
|
43
|
+
heartbeat=nextHeartbeat
|
|
44
|
+
end
|
|
45
|
+
local function refresh()
|
|
46
|
+
if refreshing or not provider or not frame or not frame:GetScript("OnUpdate") then return end
|
|
47
|
+
refreshing=true
|
|
48
|
+
local ok=pcall(sample)
|
|
49
|
+
refreshing=false
|
|
50
|
+
if not ok then hide() end
|
|
51
|
+
end
|
|
52
|
+
ns.InputState={
|
|
53
|
+
Start=function(observe)
|
|
54
|
+
provider=observe
|
|
55
|
+
if frame and frame:GetScript("OnUpdate") then return true end
|
|
56
|
+
sequence,last=sequence or 0,0
|
|
57
|
+
if not frame then frame=ns.InputSignal.Frame() end
|
|
58
|
+
loading,leaving=false,false
|
|
59
|
+
for _,event in ipairs({"PLAYER_ENTERING_WORLD","PLAYER_LEAVING_WORLD","LOADING_SCREEN_ENABLED","LOADING_SCREEN_DISABLED","PLAYER_REGEN_ENABLED","PLAYER_REGEN_DISABLED"}) do frame:RegisterEvent(event) end
|
|
60
|
+
frame:SetScript("OnEvent",function(_,event)
|
|
61
|
+
if not provider then return end
|
|
62
|
+
if event=="PLAYER_LEAVING_WORLD" then leaving=true;hide();return end
|
|
63
|
+
if event=="LOADING_SCREEN_ENABLED" then loading=true;hide();return end
|
|
64
|
+
if event=="PLAYER_ENTERING_WORLD" then leaving=false end
|
|
65
|
+
if event=="LOADING_SCREEN_DISABLED" then loading=false end
|
|
66
|
+
refresh()
|
|
67
|
+
end)
|
|
68
|
+
frame:SetScript("OnHide",hide)
|
|
69
|
+
frame:SetScript("OnShow",refresh)
|
|
70
|
+
frame:SetScript("OnUpdate",function(_,elapsed)
|
|
71
|
+
last=last+elapsed
|
|
72
|
+
if last<1 then return end
|
|
73
|
+
last=0
|
|
74
|
+
refresh()
|
|
75
|
+
end)
|
|
76
|
+
refreshing=true;frame:Show();refreshing=false
|
|
77
|
+
refresh()
|
|
78
|
+
return true
|
|
79
|
+
end,
|
|
80
|
+
-- Transaction completion refreshes facts without moving the periodic tick.
|
|
81
|
+
Refresh=refresh,
|
|
82
|
+
Stop=function()
|
|
83
|
+
if frame then
|
|
84
|
+
frame:SetScript("OnUpdate",nil);frame:SetScript("OnEvent",nil)
|
|
85
|
+
frame:SetScript("OnShow",nil);frame:SetScript("OnHide",nil);frame:UnregisterAllEvents()
|
|
86
|
+
end
|
|
87
|
+
provider,record,lastTick=nil,nil,nil
|
|
88
|
+
hide()
|
|
89
|
+
if frame then frame:Hide() end
|
|
90
|
+
if ns.StartupBeacon then ns.StartupBeacon.Stop() end
|
|
91
|
+
end,
|
|
92
|
+
Snapshot=function()return record end,
|
|
93
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
local _, ns = ...
|
|
2
|
+
|
|
3
|
+
-- Immutable binary strings are retained by the transport. Finding one is not
|
|
4
|
+
-- publication proof: the host must request a fresh confirmation of live state.
|
|
5
|
+
local function u32(n)
|
|
6
|
+
return string.char(n%256,math.floor(n/256)%256,math.floor(n/65536)%256,math.floor(n/16777216)%256)
|
|
7
|
+
end
|
|
8
|
+
local function token(value)
|
|
9
|
+
return not (issecretvalue and issecretvalue(value)) and type(value)=="string"
|
|
10
|
+
and #value==32 and value:match("^[0-9a-f]+$")~=nil
|
|
11
|
+
end
|
|
12
|
+
local function raw(hex)
|
|
13
|
+
return (hex:gsub("..",function(pair)return string.char(tonumber(pair,16))end))
|
|
14
|
+
end
|
|
15
|
+
local function checksum(value)
|
|
16
|
+
return tonumber(ns.CaptureWriter.DigestBytes(value),16)
|
|
17
|
+
end
|
|
18
|
+
ns.MemoryProtocol = {
|
|
19
|
+
Token=token, Checksum=checksum,
|
|
20
|
+
Encode=function(nonce,runtime,ticket,kind,state,sequence,payload)
|
|
21
|
+
if not token(nonce) or not token(runtime) or not token(ticket)
|
|
22
|
+
or type(payload)~="string" or #payload>524288
|
|
23
|
+
or kind<1 or kind>5 or state<1 or state>255
|
|
24
|
+
or type(sequence)~="number" or sequence<0 or sequence>=4294967296 or sequence%1~=0 then
|
|
25
|
+
return nil,"memory_record_invalid"
|
|
26
|
+
end
|
|
27
|
+
local header="LYCMEM05"..raw(nonce)..raw(runtime)..raw(ticket)
|
|
28
|
+
..string.char(kind,state,0,0)..u32(sequence)..u32(#payload)..u32(checksum(payload))..u32(80)
|
|
29
|
+
return header..u32(checksum(header))..payload.."LYCEND05"..raw(nonce)..raw(runtime)
|
|
30
|
+
end,
|
|
31
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
local _, ns = ...
|
|
2
|
+
|
|
3
|
+
-- Runtime-local execution, independent of transport, display and persistence.
|
|
4
|
+
-- Async callbacks are bounded; Lua pcall is not a synchronous CPU sandbox.
|
|
5
|
+
ns.ProbeExecution={Run=function(fn,budget,done)
|
|
6
|
+
local live,async,depth=true,false,0
|
|
7
|
+
local started=ns.Compat.MonotonicSeconds()
|
|
8
|
+
local timer,pending
|
|
9
|
+
local cleanups,logs={},{}
|
|
10
|
+
local callbacks,logBytes=0,0
|
|
11
|
+
local protection,protectionUsed,guardFrame
|
|
12
|
+
local guards,events={},{}
|
|
13
|
+
local api={}
|
|
14
|
+
local function finish()
|
|
15
|
+
if not live or not pending or depth>0 then return end
|
|
16
|
+
live=false
|
|
17
|
+
local outcome=pending;pending=nil
|
|
18
|
+
if timer then pcall(timer.Cancel,timer);timer=nil end
|
|
19
|
+
local clean=true
|
|
20
|
+
-- Release our lease before user cleanup, even if that cleanup throws.
|
|
21
|
+
if protection then
|
|
22
|
+
if not pcall(ns.InputProtection.Release,protection) then clean=false end
|
|
23
|
+
protection=nil
|
|
24
|
+
end
|
|
25
|
+
if guardFrame then
|
|
26
|
+
if not pcall(function()guardFrame:UnregisterAllEvents();guardFrame:SetScript("OnEvent",nil)end) then clean=false end
|
|
27
|
+
end
|
|
28
|
+
for i=#cleanups,1,-1 do if not pcall(cleanups[i]) then clean=false end end
|
|
29
|
+
cleanups={}
|
|
30
|
+
done(outcome.ok,outcome.value,{resourcesReleased=clean,logs=logs})
|
|
31
|
+
end
|
|
32
|
+
local function settle(ok,value)
|
|
33
|
+
if not live then return nil,"probe_not_running" end
|
|
34
|
+
if not pending or not ok then pending={ok=ok,value=value} end
|
|
35
|
+
finish();return true
|
|
36
|
+
end
|
|
37
|
+
local function checkGuards()
|
|
38
|
+
for _,guard in ipairs(guards) do
|
|
39
|
+
local ok,value=pcall(guard.check)
|
|
40
|
+
if not ok or (issecretvalue and issecretvalue(value)) or value~=true then
|
|
41
|
+
settle(false,guard.reason);return nil,guard.reason
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
return true
|
|
45
|
+
end
|
|
46
|
+
function api:Guard(check, watchedEvents, reason)
|
|
47
|
+
if not live or pending or type(check)~="function" or #guards>=8
|
|
48
|
+
or (issecretvalue and issecretvalue(reason)) or type(reason)~="string" or #reason==0 or #reason>128
|
|
49
|
+
or type(watchedEvents)~="table" or getmetatable(watchedEvents) then return nil,"probe_invalid_guard" end
|
|
50
|
+
local newEvents={}
|
|
51
|
+
for i,event in ipairs(watchedEvents) do
|
|
52
|
+
if i>8 or (issecretvalue and issecretvalue(event)) or type(event)~="string"
|
|
53
|
+
or #event>80 or not event:match("^[A-Z][A-Z0-9_]+$") then return nil,"probe_invalid_guard_event" end
|
|
54
|
+
newEvents[event]=true
|
|
55
|
+
end
|
|
56
|
+
local count=0
|
|
57
|
+
for _ in pairs(events) do count=count+1 end
|
|
58
|
+
for event in pairs(newEvents) do if not events[event] then count=count+1 end end
|
|
59
|
+
if count>8 then return nil,"probe_guard_event_limit" end
|
|
60
|
+
guards[#guards+1]={check=check,reason=reason}
|
|
61
|
+
local ok,failure=checkGuards();if not ok then return nil,failure end
|
|
62
|
+
if next(newEvents) then
|
|
63
|
+
local registered=pcall(function()
|
|
64
|
+
if not guardFrame then
|
|
65
|
+
guardFrame=CreateFrame("Frame")
|
|
66
|
+
guardFrame:SetScript("OnEvent",function()if live and not pending then checkGuards() end end)
|
|
67
|
+
end
|
|
68
|
+
for event in pairs(newEvents) do guardFrame:RegisterEvent(event);events[event]=true end
|
|
69
|
+
end)
|
|
70
|
+
if not registered then settle(false,"probe_guard_event_unavailable");return nil,"probe_guard_event_unavailable" end
|
|
71
|
+
end
|
|
72
|
+
return true
|
|
73
|
+
end
|
|
74
|
+
function api:ProtectInput(seconds)
|
|
75
|
+
if not live or pending or protectionUsed then return nil,"probe_input_protection_used" end
|
|
76
|
+
if (issecretvalue and issecretvalue(seconds)) or type(seconds)~="number" or seconds~=seconds
|
|
77
|
+
or seconds<=0 or seconds==math.huge or not started then return nil,"probe_invalid_protection_budget" end
|
|
78
|
+
local remaining=budget-(ns.Compat.MonotonicSeconds()-started)
|
|
79
|
+
if seconds>remaining then return nil,"probe_budget_exhausted" end
|
|
80
|
+
local ok,reason=checkGuards();if not ok then return nil,reason end
|
|
81
|
+
if not ns.InputProtection then return nil,"probe_input_protection_unavailable" end
|
|
82
|
+
protection,reason=ns.InputProtection.Acquire(seconds,function(failure)
|
|
83
|
+
protection=nil;settle(false,failure)
|
|
84
|
+
end)
|
|
85
|
+
if not protection then return nil,reason end
|
|
86
|
+
protectionUsed=true;return true
|
|
87
|
+
end
|
|
88
|
+
function api:ReleaseInput()
|
|
89
|
+
if not protection then return false end
|
|
90
|
+
local token=protection;protection=nil
|
|
91
|
+
return ns.InputProtection.Release(token)
|
|
92
|
+
end
|
|
93
|
+
function api:IsInputProtected()return protection~=nil end
|
|
94
|
+
function api:Async(seconds)
|
|
95
|
+
if not live or async or not started or type(seconds)~="number" or seconds<1 or seconds>budget then return nil,"probe_invalid_async_budget" end
|
|
96
|
+
if type(C_Timer)~="table" or type(C_Timer.NewTimer)~="function" then return nil,"probe_async_unavailable" end
|
|
97
|
+
local remaining=seconds-(ns.Compat.MonotonicSeconds()-started)
|
|
98
|
+
if remaining<=0 then return nil,"probe_budget_exhausted" end
|
|
99
|
+
timer=C_Timer.NewTimer(remaining,function()settle(false,"probe_timeout")end)
|
|
100
|
+
if not timer then return nil,"probe_async_unavailable" end
|
|
101
|
+
async=true;return true
|
|
102
|
+
end
|
|
103
|
+
function api:Finish(value)
|
|
104
|
+
if not live then return nil,"probe_not_running" end
|
|
105
|
+
local valid,reason=checkGuards();if not valid then return nil,reason end
|
|
106
|
+
return settle(true,value)
|
|
107
|
+
end
|
|
108
|
+
function api:Fail(value)
|
|
109
|
+
if (issecretvalue and issecretvalue(value)) or type(value)~="string" or #value>4096 then value="probe_runtime_error" end
|
|
110
|
+
return settle(false,value)
|
|
111
|
+
end
|
|
112
|
+
function api:Callback(callback)
|
|
113
|
+
if not live or type(callback)~="function" or callbacks>=16 then return nil,"probe_callback_limit" end
|
|
114
|
+
callbacks=callbacks+1
|
|
115
|
+
return function(...)
|
|
116
|
+
if not live or pending then return nil,"probe_callback_inactive" end
|
|
117
|
+
local valid,reason=checkGuards();if not valid then return nil,reason end
|
|
118
|
+
depth=depth+1;local ok,result=pcall(callback,...);depth=depth-1
|
|
119
|
+
if not ok then api:Fail(result) else finish() end
|
|
120
|
+
return ok,result
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
function api:OnCleanup(callback)
|
|
124
|
+
if not live or type(callback)~="function" or #cleanups>=16 then return nil,"probe_cleanup_limit" end
|
|
125
|
+
cleanups[#cleanups+1]=callback;return true
|
|
126
|
+
end
|
|
127
|
+
function api:Log(...)
|
|
128
|
+
if not live or #logs>=100 or logBytes>=32768 then return nil,"probe_log_limit" end
|
|
129
|
+
local parts={}
|
|
130
|
+
for i=1,select("#",...) do
|
|
131
|
+
local value=select(i,...)
|
|
132
|
+
if issecretvalue and issecretvalue(value) then parts[i]="<secret>"
|
|
133
|
+
elseif type(value)=="string" or type(value)=="number" or type(value)=="boolean" then parts[i]=tostring(value)
|
|
134
|
+
else parts[i]="<unsupported>" end
|
|
135
|
+
end
|
|
136
|
+
local line=table.concat(parts," "):sub(1,32768-logBytes)
|
|
137
|
+
logs[#logs+1]=line;logBytes=logBytes+#line;return true
|
|
138
|
+
end
|
|
139
|
+
function api:IsCancelled()return not live end
|
|
140
|
+
depth=1;local ok,result=pcall(fn,api);depth=0
|
|
141
|
+
if not ok then api:Fail(result)
|
|
142
|
+
elseif pending then finish()
|
|
143
|
+
elseif not async then
|
|
144
|
+
local valid=checkGuards();if valid then settle(true,result) end
|
|
145
|
+
end
|
|
146
|
+
return api
|
|
147
|
+
end}
|
|
@@ -126,6 +126,7 @@ local function apply(profile)
|
|
|
126
126
|
return copy(valid)
|
|
127
127
|
end
|
|
128
128
|
local function stored()
|
|
129
|
+
if ns.SlotRuntime then return copy(defaults) end
|
|
129
130
|
local state, failure = ns.Persistence.Current()
|
|
130
131
|
if not state then return nil, failure end
|
|
131
132
|
local profile = state.options and state.options.receiverBindings
|
|
@@ -172,6 +173,7 @@ ns.ReceiverBindings = {
|
|
|
172
173
|
return key == terminal(effective[action])
|
|
173
174
|
end,
|
|
174
175
|
ConfigureProfile = function(profile)
|
|
176
|
+
if ns.SlotRuntime then return nil,"receiver_bindings_fixed" end
|
|
175
177
|
if ns.Receiver and ns.Receiver.IsActive and ns.Receiver.IsActive() then return nil,"receiver_active" end
|
|
176
178
|
if not owner then return nil,"receiver_bindings_unavailable" end
|
|
177
179
|
local state,failure=ns.Persistence.Current()
|
|
@@ -183,6 +185,7 @@ ns.ReceiverBindings = {
|
|
|
183
185
|
return copy(applied)
|
|
184
186
|
end,
|
|
185
187
|
Configure = function(action, chord)
|
|
188
|
+
if ns.SlotRuntime then return nil,"receiver_bindings_fixed" end
|
|
186
189
|
if action ~= "wake" and action ~= "submit" and action ~= "close" then return nil, "receiver_binding_action_invalid" end
|
|
187
190
|
if ns.Receiver and type(ns.Receiver.IsActive) == "function" and ns.Receiver.IsActive() then
|
|
188
191
|
return nil, "receiver_active"
|
|
@@ -223,6 +226,9 @@ ns.ReceiverBindings = {
|
|
|
223
226
|
if type(SetOverrideBindingClick) ~= "function" or type(CreateFrame) ~= "function" then
|
|
224
227
|
return nil, "receiver_bindings_unavailable"
|
|
225
228
|
end
|
|
229
|
+
if ns.SlotRuntime then
|
|
230
|
+
defaults = {wake="ALT-CTRL-F12",submit="ALT-CTRL-SHIFT-F12",close="ALT-CTRL-["}
|
|
231
|
+
end
|
|
226
232
|
handlers = callbacks
|
|
227
233
|
owner = CreateFrame("Frame", nil, UIParent)
|
|
228
234
|
local loggedIn = true
|