lycheedev 2.5.1 → 3.0.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/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/InputState.lua +45 -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 +165 -0
- package/payload/addon/Bridge/SlotRuntime.lua +106 -0
- package/payload/addon/Bridge/StartupBeacon.lua +8 -11
- package/payload/addon/Core/Compat.lua +7 -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 +8 -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 +39 -53
- package/payload/skill/references/commands.md +17 -15
- package/payload/skill/references/error-diagnosis.md +7 -11
- package/payload/skill/references/installation.md +6 -13
- package/payload/skill/references/live-investigation.md +193 -255
- package/payload/skill/references/live-startup.md +62 -130
- package/release.json +95 -65
- package/payload/addon/UI/Pages/Settings.lua +0 -82
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
local _, ns = ...
|
|
2
|
+
|
|
3
|
+
local engine,receiving,inputLease,expectedSlot
|
|
4
|
+
local zero=string.rep("0",32)
|
|
5
|
+
local function releaseInput()
|
|
6
|
+
receiving=false
|
|
7
|
+
if inputLease then ns.InputProtection.Release(inputLease);inputLease=nil end
|
|
8
|
+
end
|
|
9
|
+
local function protectInput()
|
|
10
|
+
if receiving then return true end
|
|
11
|
+
local reason
|
|
12
|
+
inputLease,reason=ns.InputProtection.Acquire(2,releaseInput,true)
|
|
13
|
+
if not inputLease then return nil,reason end
|
|
14
|
+
receiving=true
|
|
15
|
+
return true
|
|
16
|
+
end
|
|
17
|
+
local function activity(state,ticket)
|
|
18
|
+
if not ns.ActivityView then return end
|
|
19
|
+
if state=="idle" then ns.ActivityView.Finish(ticket)
|
|
20
|
+
elseif state=="collecting" and ns.ActivityView.Collecting then ns.ActivityView.Collecting(ticket)
|
|
21
|
+
else ns.ActivityView.Begin(ticket) end
|
|
22
|
+
end
|
|
23
|
+
local function start()
|
|
24
|
+
if engine then
|
|
25
|
+
local state=ns.Persistence.Current()
|
|
26
|
+
if ns.InputState and state and state.options.bridgeEnabled~=false then ns.InputState.Start(engine.InputIdentity) end
|
|
27
|
+
return true
|
|
28
|
+
end
|
|
29
|
+
local state,reason=ns.Persistence.Bridge();if not state then return nil,reason end
|
|
30
|
+
local build;build,reason=ns.Platform.ObserveBuild();if not build then return nil,reason end
|
|
31
|
+
local actor;actor,reason=ns.Platform.ObserveActor();if not actor then return nil,reason end
|
|
32
|
+
local epoch=state.memoryEpoch or 0
|
|
33
|
+
if (issecretvalue and issecretvalue(epoch)) or type(epoch)~="number" or epoch<0 or epoch%1~=0 or epoch>=4294967295 then return nil,"slot_epoch_invalid" end
|
|
34
|
+
local clock=ns.Compat.MonotonicSeconds();if not clock or clock>=4294967295 then return nil,"slot_clock_unavailable" end
|
|
35
|
+
-- A reload-persisted generation plus runtime clock and random suffix. The
|
|
36
|
+
-- CLI additionally binds the OS process creation identity and fresh nonce.
|
|
37
|
+
-- This token is an accidental-replay discriminator, not a secret/password.
|
|
38
|
+
state.memoryEpoch=epoch+1
|
|
39
|
+
local runtime=string.format("%08x%08x%04x%04x%04x%04x",epoch+1,math.floor(clock),math.random(0,65535),math.random(0,65535),math.random(0,65535),math.random(0,65535))
|
|
40
|
+
local available=0
|
|
41
|
+
for i=1,64 do
|
|
42
|
+
local name=string.format("Lychee Dev Slot %02d",i)
|
|
43
|
+
if ns.Compat.GetAddOnMetadata(name,"X-Lychee-Slot")==tostring(i)
|
|
44
|
+
and ns.Compat.GetAddOnMetadata(name,"Version")==ns.Release then available=available+1 end
|
|
45
|
+
end
|
|
46
|
+
ns.AutomationHistory.Begin(runtime,{character=actor.character,realm=actor.realm,guid=actor.guid,build=build.build,product=build.product})
|
|
47
|
+
engine=ns.SlotProtocol.Create({runtime=runtime,build=build.build,product=build.product,release=ns.Release,inventory=available,
|
|
48
|
+
inputState=ns.InputState and "lycheedev.input.v1" or nil,
|
|
49
|
+
actor=function()
|
|
50
|
+
local current=ns.Platform.ObserveActor()
|
|
51
|
+
if current and current.guid==actor.guid then return current end
|
|
52
|
+
end,encode=ns.CaptureWriter.Encode,
|
|
53
|
+
compile=function(code)return loadstring(code,"=LycheeMemoryProbe")end,
|
|
54
|
+
execute=ns.ProbeExecution.Run,releaseInput=releaseInput,activity=activity,observe=ns.AutomationHistory.Observe})
|
|
55
|
+
engine.Describe()
|
|
56
|
+
local current=ns.Persistence.Current()
|
|
57
|
+
if ns.InputState and current and current.options.bridgeEnabled~=false then ns.InputState.Start(engine.InputIdentity) end
|
|
58
|
+
return true
|
|
59
|
+
end
|
|
60
|
+
local function inventory()
|
|
61
|
+
for i=1,64 do
|
|
62
|
+
local name=string.format("Lychee Dev Slot %02d",i)
|
|
63
|
+
if ns.Compat.GetAddOnMetadata(name,"X-Lychee-Slot")~=tostring(i)
|
|
64
|
+
or ns.Compat.GetAddOnMetadata(name,"Version")~=ns.Release then return nil,"slot_inventory_incomplete:"..i end
|
|
65
|
+
end
|
|
66
|
+
return true
|
|
67
|
+
end
|
|
68
|
+
local function wake()
|
|
69
|
+
local state=ns.Persistence.Current()
|
|
70
|
+
if not state or state.options.bridgeEnabled==false then return nil,"slot_disabled" end
|
|
71
|
+
local ok,reason=start();if not ok then return nil,reason end
|
|
72
|
+
if ns.Platform.ObserveInputState(true)~=true and not receiving then return nil,"slot_input_not_ready" end
|
|
73
|
+
ok,reason=inventory();if not ok then return nil,reason end
|
|
74
|
+
state.options.bridgeEnabled=true -- Explicit wake opts in; explicit off stays off.
|
|
75
|
+
if ns.StartupBeacon then ns.StartupBeacon.Stop() end
|
|
76
|
+
ok,reason=protectInput();if not ok then releaseInput();return nil,reason end
|
|
77
|
+
local index=engine.NextSlot();if index>64 then releaseInput();return nil,"slot_exhausted" end
|
|
78
|
+
expectedSlot=index
|
|
79
|
+
local loaded,failure=ns.Compat.LoadInputSlot(string.format("Lychee Dev Slot %02d",index))
|
|
80
|
+
expectedSlot=nil
|
|
81
|
+
if not loaded then releaseInput();return nil,failure end
|
|
82
|
+
-- Control transactions have no long-lived keyboard ownership. A fresh
|
|
83
|
+
-- wake protects each input burst; business entry already released it.
|
|
84
|
+
releaseInput()
|
|
85
|
+
engine.Describe()
|
|
86
|
+
return true
|
|
87
|
+
end
|
|
88
|
+
local function guardedWake()
|
|
89
|
+
local ok,result,reason=pcall(wake)
|
|
90
|
+
expectedSlot=nil
|
|
91
|
+
releaseInput()
|
|
92
|
+
if not ok then return nil,"slot_wake_failed" end
|
|
93
|
+
return result,reason
|
|
94
|
+
end
|
|
95
|
+
ns.SlotRuntime={
|
|
96
|
+
Start=start,Wake=guardedWake,Close=function()releaseInput();ns.InputProtection.Cancel()end,
|
|
97
|
+
IsActive=function()return ns.InputProtection.IsActive()end,
|
|
98
|
+
Receive=function(index,envelope)
|
|
99
|
+
if not engine or index~=expectedSlot then return nil,"slot_not_requested" end
|
|
100
|
+
return engine.Receive(index,envelope)
|
|
101
|
+
end,
|
|
102
|
+
Snapshot=function()return engine and engine.Snapshot()end,
|
|
103
|
+
Register=function()
|
|
104
|
+
return ns.ReceiverBindings.Register({wake=guardedWake,submit=guardedWake,close=function()releaseInput();ns.InputProtection.Cancel()end})
|
|
105
|
+
end,
|
|
106
|
+
}
|
|
@@ -2,7 +2,7 @@ local _, ns = ...
|
|
|
2
2
|
|
|
3
3
|
-- A short-lived visual hint, never an identity or execution permission. It is
|
|
4
4
|
-- armed only for an opted-in bridge at startup and stops permanently on wake.
|
|
5
|
-
local frame,
|
|
5
|
+
local frame, block, expiry, pulse, untilTime
|
|
6
6
|
local entered, loadingDone, phase, stopped
|
|
7
7
|
local colors = {{1,0,0},{0,1,0},{0,0,1}}
|
|
8
8
|
local function stop()
|
|
@@ -12,7 +12,7 @@ local function stop()
|
|
|
12
12
|
if frame then frame:Hide(); frame:UnregisterAllEvents(); frame:SetScript("OnEvent",nil) end
|
|
13
13
|
end
|
|
14
14
|
local function paint()
|
|
15
|
-
|
|
15
|
+
block:SetColorTexture(unpack(colors[phase+1]))
|
|
16
16
|
end
|
|
17
17
|
local function tick()
|
|
18
18
|
pulse=nil
|
|
@@ -37,16 +37,12 @@ ns.StartupBeacon = {
|
|
|
37
37
|
frame:Hide(); frame:EnableMouse(false); frame:SetFrameStrata("TOOLTIP")
|
|
38
38
|
local px=ns.Compat.GetPhysicalPixelSize()
|
|
39
39
|
frame:SetPoint("TOPLEFT",UIParent,"TOPLEFT",4*px,-4*px)
|
|
40
|
-
frame:SetSize(
|
|
40
|
+
frame:SetSize(12*px,12*px)
|
|
41
41
|
local background=frame:CreateTexture(nil,"BACKGROUND")
|
|
42
42
|
background:SetAllPoints(frame); background:SetColorTexture(0,0,0,1)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
block:SetSize(8*px,8*px)
|
|
47
|
-
block:SetPoint("TOPLEFT",(2+(index-1)*10)*px,-2*px)
|
|
48
|
-
blocks[index]=block
|
|
49
|
-
end
|
|
43
|
+
block=frame:CreateTexture(nil,"ARTWORK")
|
|
44
|
+
block:SetSize(8*px,8*px)
|
|
45
|
+
block:SetPoint("TOPLEFT",2*px,-2*px)
|
|
50
46
|
stopped=false; untilTime=GetTime()+45
|
|
51
47
|
expiry=C_Timer.NewTimer(45,stop)
|
|
52
48
|
for _,event in ipairs({"PLAYER_ENTERING_WORLD","LOADING_SCREEN_DISABLED","LOADING_SCREEN_ENABLED",
|
|
@@ -54,7 +50,8 @@ ns.StartupBeacon = {
|
|
|
54
50
|
frame:SetScript("OnEvent",function(_,event,initial,reloading)
|
|
55
51
|
if event=="PLAYER_LEAVING_WORLD" or event=="PLAYER_REGEN_DISABLED" then stop(); return end
|
|
56
52
|
if event=="PLAYER_ENTERING_WORLD" then
|
|
57
|
-
if
|
|
53
|
+
if issecretvalue and (issecretvalue(initial) or issecretvalue(reloading)) then stop(); return end
|
|
54
|
+
if initial~=false or reloading~=true then stop(); return end
|
|
58
55
|
entered=true
|
|
59
56
|
elseif event=="LOADING_SCREEN_ENABLED" then
|
|
60
57
|
loadingDone=false; frame:Hide()
|
|
@@ -5,6 +5,13 @@ local ADDON_NAME, ns = ...
|
|
|
5
5
|
-- before it is compared, formatted, indexed or branched on; failures open to a
|
|
6
6
|
-- harmless visible state instead of throwing.
|
|
7
7
|
ns.Compat = {
|
|
8
|
+
LoadInputSlot = function(name)
|
|
9
|
+
if type(name)~="string" or not name:match("^Lychee Dev Slot %d%d$") then return nil,"slot_name_invalid" end
|
|
10
|
+
if type(C_AddOns)~="table" or type(C_AddOns.LoadAddOn)~="function" then return nil,"slot_loader_unavailable" end
|
|
11
|
+
local ok,loaded,reason=pcall(C_AddOns.LoadAddOn,name)
|
|
12
|
+
if not ok or (issecretvalue and (issecretvalue(loaded) or issecretvalue(reason))) then return nil,"slot_load_failed" end
|
|
13
|
+
return loaded==true and true or nil,type(reason)=="string" and reason or "slot_load_failed"
|
|
14
|
+
end,
|
|
8
15
|
ReceiverChord = function(key)
|
|
9
16
|
if (issecretvalue and issecretvalue(key)) or type(key)~="string" then return nil end
|
|
10
17
|
local number=string.match(key,"^F([1-9]%d?)$")
|
|
@@ -79,6 +79,22 @@ ns.Controls = {
|
|
|
79
79
|
end
|
|
80
80
|
local state, failure = ns.Persistence.Current()
|
|
81
81
|
if not state then return nil, failure end
|
|
82
|
+
if ns.SlotRuntime then
|
|
83
|
+
if command=="connect" or command=="bridge on" then
|
|
84
|
+
state.options.bridgeEnabled=true
|
|
85
|
+
return ns.SlotRuntime.Start()
|
|
86
|
+
elseif command=="disconnect" or command=="bridge off" then
|
|
87
|
+
state.options.bridgeEnabled=false
|
|
88
|
+
if ns.InputState then ns.InputState.Stop() end
|
|
89
|
+
ns.SlotRuntime.Close()
|
|
90
|
+
if ns.ActivityView then ns.ActivityView.Stop() end
|
|
91
|
+
return true
|
|
92
|
+
elseif command=="status" then
|
|
93
|
+
return {transport="memory-slot-v1",enabled=ns.Persistence.BridgeEnabled()}
|
|
94
|
+
else
|
|
95
|
+
return nil,"command_retired: use the memory-slot CLI"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
82
98
|
if command == "receiver reset" then
|
|
83
99
|
local profile, reason = ns.ReceiverBindings.Reset()
|
|
84
100
|
if not profile then return nil, reason end
|
|
@@ -322,10 +322,11 @@ ns.L = {
|
|
|
322
322
|
AUTO_ACK_RECEIVED = "外部已读取",
|
|
323
323
|
AUTO_ACK_FAILED = "外部读取失败",
|
|
324
324
|
AUTO_REPORT_DISPLAY_LIMIT = "显示已在 %d KB 处截断;完整报告以 Ticket 保存。",
|
|
325
|
+
AUTO_REPORT_HISTORY_LIMIT = "历史摘要已在 %d KB 处截断;完整结果保存在调用项目的 .lycheedev/live/ 中。",
|
|
325
326
|
AUTO_STATUS_RUNNING = "执行中",
|
|
326
327
|
AUTO_STATUS_FINALIZING = "整理中",
|
|
327
|
-
AUTO_STATUS_SUCCEEDED = "
|
|
328
|
-
AUTO_STATUS_FAILED = "
|
|
328
|
+
AUTO_STATUS_SUCCEEDED = "执行成功",
|
|
329
|
+
AUTO_STATUS_FAILED = "执行失败",
|
|
329
330
|
AUTO_STATUS_CANCELLED = "已取消",
|
|
330
331
|
AUTO_STATUS_INTERRUPTED = "已中断",
|
|
331
332
|
AUTO_KIND_LUA = "Lua 任务",
|
|
@@ -376,8 +377,9 @@ ns.L = {
|
|
|
376
377
|
SETTINGS_UNSAVED = "未保存",
|
|
377
378
|
RECEIVER_BINDING_CAPTURE_HELP = "单击快捷键,再按下 Ctrl+Alt 与 [、] 或 F1–F12 的组合,也可加 Shift。",
|
|
378
379
|
RECEIVER_BINDING_FIXED_HELP = "由 Agent 自动调用。此处仅供查看,无需配置。",
|
|
379
|
-
ACTIVITY_CONNECTING = "Agent
|
|
380
|
-
ACTIVITY_PROBE = "
|
|
380
|
+
ACTIVITY_CONNECTING = "Agent 接管中",
|
|
381
|
+
ACTIVITY_PROBE = "Agent 运行中",
|
|
382
|
+
ACTIVITY_COLLECTING = "结果待收取",
|
|
381
383
|
DIAGNOSTICS_SEARCH_HINT = "筛选错误关键词…",
|
|
382
384
|
RECEIVER_BINDING_PRESS = "请按组合键…",
|
|
383
385
|
REDUCE_MOTION = "减少动态效果",
|
|
@@ -327,6 +327,7 @@ local english = {
|
|
|
327
327
|
AUTO_ACK_RECEIVED = "Read by the host",
|
|
328
328
|
AUTO_ACK_FAILED = "Host read failed",
|
|
329
329
|
AUTO_REPORT_DISPLAY_LIMIT = "Display truncated at %d KB; the full report is stored under the Ticket.",
|
|
330
|
+
AUTO_REPORT_HISTORY_LIMIT = "History preview truncated at %d KB; the full result is in the calling project's .lycheedev/live/ directory.",
|
|
330
331
|
AUTO_STATUS_RUNNING = "Running",
|
|
331
332
|
AUTO_STATUS_FINALIZING = "Finalizing",
|
|
332
333
|
AUTO_STATUS_SUCCEEDED = "Succeeded",
|
|
@@ -382,8 +383,9 @@ local english = {
|
|
|
382
383
|
SETTINGS_UNSAVED = "Unsaved",
|
|
383
384
|
RECEIVER_BINDING_CAPTURE_HELP = "Click a shortcut, then press Ctrl+Alt with [, ] or F1-F12. Shift is optional.",
|
|
384
385
|
RECEIVER_BINDING_FIXED_HELP = "Used automatically by your agent. Shown for reference; no setup needed.",
|
|
385
|
-
ACTIVITY_CONNECTING = "Agent
|
|
386
|
-
ACTIVITY_PROBE = "
|
|
386
|
+
ACTIVITY_CONNECTING = "Agent in control",
|
|
387
|
+
ACTIVITY_PROBE = "Agent running",
|
|
388
|
+
ACTIVITY_COLLECTING = "Collecting result",
|
|
387
389
|
DIAGNOSTICS_SEARCH_HINT = "Filter errors by keyword...",
|
|
388
390
|
RECEIVER_BINDING_PRESS = "Press shortcut...",
|
|
389
391
|
RECEIVER_BINDINGS = "Command receiver shortcuts",
|
|
@@ -12,7 +12,7 @@ ns.Platform = {
|
|
|
12
12
|
-- A point-in-time observation, not permission to send input later. The
|
|
13
13
|
-- caller must also own a current session and observe focus after slash
|
|
14
14
|
-- dispatch unwinds. Missing or restricted APIs fail closed.
|
|
15
|
-
ObserveInputState = function()
|
|
15
|
+
ObserveInputState = function(allowFocusedInput)
|
|
16
16
|
if type(IsLoggedIn) ~= "function" or type(InCombatLockdown) ~= "function"
|
|
17
17
|
or type(GetCurrentKeyBoardFocus) ~= "function" then
|
|
18
18
|
return nil, "input_observation_unavailable"
|
|
@@ -29,7 +29,9 @@ ns.Platform = {
|
|
|
29
29
|
if combat then return false, "input_combat_lockdown" end
|
|
30
30
|
local focusOK, focus = pcall(GetCurrentKeyBoardFocus)
|
|
31
31
|
if not focusOK or restricted(focus) then return nil, "input_focus_unavailable" end
|
|
32
|
-
|
|
32
|
+
-- The slot path sends a non-text key and neither clears nor edits this
|
|
33
|
+
-- object. Other input paths still require an empty keyboard focus.
|
|
34
|
+
if focus ~= nil and allowFocusedInput ~= true then return false, "input_keyboard_focus" end
|
|
33
35
|
return true
|
|
34
36
|
end,
|
|
35
37
|
ObserveActor = function()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
local ADDON_NAME, ns = ...
|
|
2
2
|
|
|
3
|
-
ns.Release = "
|
|
3
|
+
ns.Release = "3.0.0"
|
|
4
4
|
ns.Startup = { ready = false, reason = "addon_not_loaded" }
|
|
5
5
|
-- Observability handle: mirrors the addon namespace for host-side /run
|
|
6
6
|
-- introspection (startup state, identity, commandFailure) on every client.
|
|
@@ -42,10 +42,12 @@ local function start(trigger)
|
|
|
42
42
|
started = true
|
|
43
43
|
local registered, registrationFailure = ns.Controls.Register()
|
|
44
44
|
if not registered then ns.Startup.commandFailure = registrationFailure end
|
|
45
|
-
local receiverRegistered, receiverFailure
|
|
45
|
+
local receiverRegistered, receiverFailure
|
|
46
|
+
if ns.SlotRuntime then receiverRegistered,receiverFailure=ns.SlotRuntime.Register()
|
|
47
|
+
else receiverRegistered,receiverFailure=ns.Receiver.Register() end
|
|
46
48
|
if not receiverRegistered then ns.Startup.receiverFailure = receiverFailure end
|
|
47
49
|
if ns.StartupBeacon then ns.StartupBeacon.Arm() end
|
|
48
|
-
if registered then
|
|
50
|
+
if registered and not ns.SlotRuntime then
|
|
49
51
|
local resumed, resumeFailure = ns.Reentry.Start(loader)
|
|
50
52
|
if not resumed then ns.Startup.resumeFailure = resumeFailure end
|
|
51
53
|
end
|
|
@@ -59,7 +61,16 @@ loader:SetScript("OnEvent", function(self, event, name)
|
|
|
59
61
|
if event == "ADDON_LOADED" and name ~= ADDON_NAME then return end
|
|
60
62
|
-- One-shot: the name-matched ADDON_LOADED owns startup, success or not;
|
|
61
63
|
-- PLAYER_LOGIN is the fallback trigger when that event never matched.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
if ns.SlotRuntime then
|
|
65
|
+
if start(event) then
|
|
66
|
+
-- Actor identity can be unavailable during ADDON_LOADED. The
|
|
67
|
+
-- existing one-shot loader owns the one PLAYER_LOGIN retry.
|
|
68
|
+
local ok=ns.SlotRuntime.Start()
|
|
69
|
+
if ok or event=="PLAYER_LOGIN" then self:UnregisterAllEvents();self:SetScript("OnEvent",nil) end
|
|
70
|
+
end
|
|
71
|
+
else
|
|
72
|
+
self:UnregisterAllEvents()
|
|
73
|
+
self:SetScript("OnEvent", nil)
|
|
74
|
+
start(event)
|
|
75
|
+
end
|
|
65
76
|
end)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Interface: 120100, 50504, 38002, 16001
|
|
2
2
|
## Title: Lychee Dev
|
|
3
|
-
## Version:
|
|
3
|
+
## Version: 3.0.0
|
|
4
4
|
## SavedVariables: LycheeToolkitDB
|
|
5
5
|
## SavedVariablesPerCharacter: LycheeToolkitBridgeDB
|
|
6
6
|
|
|
@@ -22,6 +22,10 @@ Core\Persistence.lua
|
|
|
22
22
|
Bridge\Session.lua
|
|
23
23
|
Core\Controls.lua
|
|
24
24
|
Bridge\CaptureWriter.lua
|
|
25
|
+
Bridge\MemoryProtocol.lua
|
|
26
|
+
Bridge\SlotProtocol.lua
|
|
27
|
+
Bridge\InputProtection.lua
|
|
28
|
+
Bridge\ProbeExecution.lua
|
|
25
29
|
Bridge\InputProtocol.lua
|
|
26
30
|
Bridge\MatrixSymbol.lua
|
|
27
31
|
Bridge\ReceiptView.lua
|
|
@@ -30,6 +34,7 @@ Bridge\ReportStore.lua
|
|
|
30
34
|
Bridge\Investigation.lua
|
|
31
35
|
Bridge\ProbeRunner.lua
|
|
32
36
|
Bridge\Definitions.lua
|
|
37
|
+
Modules\AutomationHistory.lua
|
|
33
38
|
Modules\AutomationView.lua
|
|
34
39
|
Bridge\ProbeQueue.lua
|
|
35
40
|
Bridge\Reentry.lua
|
|
@@ -37,6 +42,8 @@ Bridge\Identity.lua
|
|
|
37
42
|
Bridge\ReceiverBindings.lua
|
|
38
43
|
Bridge\StartupBeacon.lua
|
|
39
44
|
Bridge\Receiver.lua
|
|
45
|
+
Bridge\SlotRuntime.lua
|
|
46
|
+
Bridge\InputState.lua
|
|
40
47
|
# --- Event catalogs: all four load; Catalog.lua selects ns.Client's table ---
|
|
41
48
|
Modules\Events\CatalogData_Mainline.lua
|
|
42
49
|
Modules\Events\CatalogData_Mists.lua
|
|
@@ -55,7 +62,6 @@ UI\Widgets.lua
|
|
|
55
62
|
UI\TreeView.lua
|
|
56
63
|
UI\Export.lua
|
|
57
64
|
UI\Window.lua
|
|
58
|
-
UI\Pages\Settings.lua
|
|
59
65
|
# --- Workbench pages: later page modules insert their load line here ---
|
|
60
66
|
UI\Pages\About.lua
|
|
61
67
|
UI\Pages\Run.lua
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
local _, ns = ...
|
|
2
|
+
|
|
3
|
+
-- A bounded, per-character display history, not an execution/recovery journal.
|
|
4
|
+
-- SavedVariables flush on reload/logout. The CLI's project journal owns durable
|
|
5
|
+
-- evidence and retries; these records must never authorize execution.
|
|
6
|
+
local MAX_RECORDS, REPORT_BYTES = 100, 32 * 1024
|
|
7
|
+
local runtime, identity
|
|
8
|
+
local statuses = { loaded=true, running=true, reported=true, acknowledged=true, interrupted=true }
|
|
9
|
+
local phases = { prepared="loaded", running="running", reported="reported", released="acknowledged" }
|
|
10
|
+
local fields={requestId=true,runtime=true,nonce=true,observedAt=true,codeBytes=true,codeAdler32=true,
|
|
11
|
+
character=true,realm=true,guid=true,build=true,product=true,status=true,pending=true,hasReport=true,
|
|
12
|
+
reportBody=true,reportTruncated=true,probeStatus=true,errorCode=true}
|
|
13
|
+
local function safe(v) return not (issecretvalue and issecretvalue(v)) end
|
|
14
|
+
local function plain(v) return safe(v) and type(v)=="table" and getmetatable(v)==nil end
|
|
15
|
+
local function text(v,n) return safe(v) and type(v)=="string" and #v<=n end
|
|
16
|
+
local function number(v) return safe(v) and type(v)=="number" and v>=0 and v<math.huge and v%1==0 end
|
|
17
|
+
local function preview(body)
|
|
18
|
+
local last=math.min(#body,REPORT_BYTES)
|
|
19
|
+
-- CaptureWriter supplies UTF-8. Never persist half of its last codepoint.
|
|
20
|
+
if #body>last then
|
|
21
|
+
local nextByte=body:byte(last+1)
|
|
22
|
+
if nextByte>=128 and nextByte<192 then
|
|
23
|
+
while last>0 and body:byte(last)>=128 and body:byte(last)<192 do last=last-1 end
|
|
24
|
+
last=last-1
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
return body:sub(1,last)
|
|
28
|
+
end
|
|
29
|
+
local function valid(record)
|
|
30
|
+
if not plain(record) or not text(record.requestId,68) or not record.requestId:match("^MEM%-%x+$")
|
|
31
|
+
or not text(record.runtime,32) or not text(record.status,16) or not statuses[record.status]
|
|
32
|
+
or not number(record.observedAt) or not number(record.codeBytes) then return false end
|
|
33
|
+
for key in pairs(record) do if not safe(key) or not fields[key] then return false end end
|
|
34
|
+
for key,limit in pairs({nonce=32,character=256,realm=256,guid=128,build=64,product=32,
|
|
35
|
+
codeAdler32=16,reportBody=REPORT_BYTES,probeStatus=16,errorCode=128}) do
|
|
36
|
+
if record[key]~=nil and not text(record[key],limit) then return false end
|
|
37
|
+
end
|
|
38
|
+
for _,key in ipairs({"pending","hasReport","reportTruncated"}) do
|
|
39
|
+
if not safe(record[key]) or (record[key]~=nil and type(record[key])~="boolean") then return false end
|
|
40
|
+
end
|
|
41
|
+
return true
|
|
42
|
+
end
|
|
43
|
+
local function store(create)
|
|
44
|
+
local root,reason=ns.Persistence.Bridge()
|
|
45
|
+
if not root then return nil,reason end
|
|
46
|
+
local saved=root.automationHistory
|
|
47
|
+
if saved==nil and create then saved={schema=1,records={}};root.automationHistory=saved end
|
|
48
|
+
if saved==nil then return nil end
|
|
49
|
+
if not plain(saved) or not safe(saved.schema) or saved.schema~=1 or not plain(saved.records) then
|
|
50
|
+
return nil,"automation_history_invalid"
|
|
51
|
+
end
|
|
52
|
+
local count=0
|
|
53
|
+
for key,record in pairs(saved.records) do
|
|
54
|
+
count=count+1
|
|
55
|
+
if count>MAX_RECORDS or not number(key) or key<1 or key>MAX_RECORDS or not valid(record) then
|
|
56
|
+
return nil,"automation_history_invalid"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
if count~=#saved.records then return nil,"automation_history_invalid" end
|
|
60
|
+
return saved
|
|
61
|
+
end
|
|
62
|
+
local function changed()
|
|
63
|
+
if ns.AutomationView then ns.AutomationView.Changed() end
|
|
64
|
+
end
|
|
65
|
+
local function begin(current,actor)
|
|
66
|
+
runtime,identity=current,actor
|
|
67
|
+
local saved=store(false)
|
|
68
|
+
if not saved then return end
|
|
69
|
+
for _,record in ipairs(saved.records) do
|
|
70
|
+
if record.runtime~=runtime then
|
|
71
|
+
record.pending=false;record.hasReport=false
|
|
72
|
+
if record.status=="loaded" or record.status=="running" then
|
|
73
|
+
record.status="interrupted";record.errorCode="runtime_changed"
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
local function observe(op)
|
|
79
|
+
if not runtime or not identity then return nil,"automation_history_not_started" end
|
|
80
|
+
local saved,reason=store(true);if not saved then return nil,reason end
|
|
81
|
+
local requestId="MEM-"..op.envelope.ticket
|
|
82
|
+
local record
|
|
83
|
+
for _,item in ipairs(saved.records) do if item.requestId==requestId and item.runtime==runtime then record=item;break end end
|
|
84
|
+
if not record then
|
|
85
|
+
if #saved.records>=MAX_RECORDS then
|
|
86
|
+
local removed=false
|
|
87
|
+
for i,item in ipairs(saved.records) do
|
|
88
|
+
if not item.pending then table.remove(saved.records,i);removed=true;break end
|
|
89
|
+
end
|
|
90
|
+
if not removed then return nil,"automation_history_full" end
|
|
91
|
+
end
|
|
92
|
+
record={requestId=requestId,runtime=runtime,nonce=op.envelope.nonce,
|
|
93
|
+
observedAt=(time and time()) or 0,codeBytes=op.envelope.codeBytes or 0,
|
|
94
|
+
codeAdler32=string.format("%08x",op.envelope.codeChecksum or 0),
|
|
95
|
+
character=identity.character,realm=identity.realm,guid=identity.guid,build=identity.build,product=identity.product}
|
|
96
|
+
saved.records[#saved.records+1]=record
|
|
97
|
+
end
|
|
98
|
+
record.status=phases[op.state]
|
|
99
|
+
record.pending=op.state~="released"
|
|
100
|
+
record.hasReport=op.state=="reported"
|
|
101
|
+
if op.payload then
|
|
102
|
+
record.reportBody=preview(op.payload)
|
|
103
|
+
record.reportTruncated=#op.payload>REPORT_BYTES
|
|
104
|
+
record.probeStatus=op.ok and "completed" or "failed"
|
|
105
|
+
end
|
|
106
|
+
changed()
|
|
107
|
+
return true
|
|
108
|
+
end
|
|
109
|
+
ns.AutomationHistory={
|
|
110
|
+
MAX_RECORDS=MAX_RECORDS,REPORT_BYTES=REPORT_BYTES,Begin=begin,Observe=observe,
|
|
111
|
+
List=function()local saved,reason=store(false);return saved and saved.records or {},reason end,
|
|
112
|
+
Remove=function(id)
|
|
113
|
+
local saved=store(false);if not saved then return false end
|
|
114
|
+
for i,record in ipairs(saved.records) do
|
|
115
|
+
if record.requestId==id and not record.pending then table.remove(saved.records,i);return true end
|
|
116
|
+
end
|
|
117
|
+
return false
|
|
118
|
+
end,
|
|
119
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
local ADDON_NAME, ns = ...
|
|
2
2
|
|
|
3
|
-
--
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
--
|
|
7
|
-
-- records, and Execute routes through ProbeQueue.Load + ProbeRunner.Dispatch,
|
|
8
|
-
-- the exact functions the /dev bridge verbs call.
|
|
3
|
+
-- Workbench view over legacy queue records and the current memory-slot
|
|
4
|
+
-- history. Native history persists per character and is strictly read-only;
|
|
5
|
+
-- manual Execute remains solely for legacy queue entries. Neither provider
|
|
6
|
+
-- makes this page a second executor or a transport recovery journal.
|
|
9
7
|
--
|
|
10
8
|
-- Real status vocabulary (derived from the bridge surface):
|
|
11
9
|
-- queued lycheedev.queue.v1 entry registered, nothing loaded yet
|
|
@@ -147,6 +145,7 @@ local function DeriveStatus(requestId)
|
|
|
147
145
|
end
|
|
148
146
|
|
|
149
147
|
local function ApplyDerived(record)
|
|
148
|
+
if record.transport == "memory-slot" then return record end
|
|
150
149
|
record.status, record.errorCode = nil, nil
|
|
151
150
|
record.receipt, record.reportBody, record.hasReport = nil, nil, nil
|
|
152
151
|
record.probeStatus, record.probeError = nil, nil
|
|
@@ -206,6 +205,21 @@ local function Observe(incoming)
|
|
|
206
205
|
end
|
|
207
206
|
|
|
208
207
|
local function Collect()
|
|
208
|
+
if ns.AutomationHistory then
|
|
209
|
+
local current = {}
|
|
210
|
+
for _,stored in ipairs(ns.AutomationHistory.List()) do
|
|
211
|
+
local incoming={transport="memory-slot",kind=KIND_LUA}
|
|
212
|
+
for key,value in pairs(stored) do incoming[key]=value end
|
|
213
|
+
current[incoming.requestId]=true
|
|
214
|
+
Observe(incoming)
|
|
215
|
+
end
|
|
216
|
+
for index=#records,1,-1 do
|
|
217
|
+
local record=records[index]
|
|
218
|
+
if record.transport=="memory-slot" and not current[record.requestId] then
|
|
219
|
+
recordIndex[record.requestId]=nil;table.remove(records,index)
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
209
223
|
if not ns.ProbeQueue and not ns.ReportStore and not ns.Persistence then
|
|
210
224
|
return 0
|
|
211
225
|
end
|
|
@@ -300,6 +314,7 @@ local function Execute(target)
|
|
|
300
314
|
if not record then
|
|
301
315
|
return nil, "auto_execution_unknown"
|
|
302
316
|
end
|
|
317
|
+
if record.transport=="memory-slot" then return nil,"auto_history_read_only" end
|
|
303
318
|
if not ns.ProbeQueue or type(ns.ProbeQueue.Load) ~= "function"
|
|
304
319
|
or not ns.ProbeRunner or type(ns.ProbeRunner.Dispatch) ~= "function" then
|
|
305
320
|
return nil, "bridge_unavailable"
|
|
@@ -316,6 +331,7 @@ local function ShowNotice(target)
|
|
|
316
331
|
if not record then
|
|
317
332
|
return nil, "auto_execution_unknown"
|
|
318
333
|
end
|
|
334
|
+
if record.transport=="memory-slot" then return nil,"auto_notice_unavailable" end
|
|
319
335
|
local receipt = record.receipt
|
|
320
336
|
if not receipt then
|
|
321
337
|
receipt = ReportRead(record.requestId)
|
|
@@ -355,6 +371,9 @@ local function GetReportText(target)
|
|
|
355
371
|
if type(body) ~= "string" then
|
|
356
372
|
return nil, ns.L.AUTO_NO_REPORT
|
|
357
373
|
end
|
|
374
|
+
if record.reportTruncated then
|
|
375
|
+
return body .. "\n... " .. string.format(ns.L.AUTO_REPORT_HISTORY_LIMIT, ns.AutomationHistory.REPORT_BYTES / 1024)
|
|
376
|
+
end
|
|
358
377
|
if #body > REPORT_DISPLAY_BYTES then
|
|
359
378
|
return body:sub(1, REPORT_DISPLAY_BYTES)
|
|
360
379
|
.. "\n... " .. string.format(ns.L.AUTO_REPORT_DISPLAY_LIMIT, REPORT_DISPLAY_BYTES / 1024)
|
|
@@ -370,6 +389,7 @@ local function ClearRecords()
|
|
|
370
389
|
for index = #records, 1, -1 do
|
|
371
390
|
local record = records[index]
|
|
372
391
|
if not IsProtected(record) and not IsPending(record) then
|
|
392
|
+
if record.transport=="memory-slot" then ns.AutomationHistory.Remove(record.requestId) end
|
|
373
393
|
table.remove(records, index)
|
|
374
394
|
recordIndex[record.requestId] = nil
|
|
375
395
|
removed = removed + 1
|
|
@@ -100,9 +100,6 @@ local function BuildAboutPage(parent)
|
|
|
100
100
|
hasGrabber and L.ABOUT_DEPENDENCY_DETAIL or L.BUGGRABBER_UNAVAILABLE,
|
|
101
101
|
-358, hasGrabber)
|
|
102
102
|
|
|
103
|
-
CreateEnvironmentRow(page, L.ABOUT_SAFETY, L.ABOUT_SAFETY_STATUS,
|
|
104
|
-
L.ABOUT_SAFETY_TEXT, -423, false)
|
|
105
|
-
|
|
106
103
|
local githubButton = CreateFrame("Button", nil, page)
|
|
107
104
|
githubButton:SetSize(32, 32)
|
|
108
105
|
githubButton:SetPoint("BOTTOMLEFT", 17, 17)
|