lycheedev 1.1.1 → 2.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.
Files changed (115) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +45 -0
  3. package/THIRD_PARTY_NOTICES +812 -0
  4. package/bin/lycheedev.mjs +56 -0
  5. package/native/windows-amd64/lycheedev.exe +0 -0
  6. package/package.json +12 -33
  7. package/payload/addon/Bridge/CaptureWriter.lua +154 -0
  8. package/payload/addon/Bridge/Definitions.lua +3 -0
  9. package/payload/addon/Bridge/Identity.lua +127 -0
  10. package/{vendor/addon/Libs/AutomationQR.lua → payload/addon/Bridge/MatrixSymbol.lua} +23 -30
  11. package/payload/addon/Bridge/ProbeQueue.lua +136 -0
  12. package/payload/addon/Bridge/ProbeRunner.lua +128 -0
  13. package/payload/addon/Bridge/ReceiptView.lua +160 -0
  14. package/payload/addon/Bridge/Reentry.lua +192 -0
  15. package/payload/addon/Bridge/ReportStore.lua +153 -0
  16. package/payload/addon/Bridge/Session.lua +163 -0
  17. package/payload/addon/Clients/Evergreen.lua +2 -0
  18. package/payload/addon/Clients/Live.lua +2 -0
  19. package/payload/addon/Clients/Pandaria.lua +2 -0
  20. package/payload/addon/Clients/Titan.lua +2 -0
  21. package/payload/addon/Core/Compat.lua +59 -0
  22. package/payload/addon/Core/Controls.lua +168 -0
  23. package/{vendor/addon/Core/Bootstrap.lua → payload/addon/Core/Execute.lua} +12 -23
  24. package/{vendor → payload}/addon/Core/Inspector.lua +19 -235
  25. package/{vendor → payload}/addon/Core/Locale.lua +129 -94
  26. package/{vendor → payload}/addon/Core/Locale_enUS.lua +129 -96
  27. package/payload/addon/Core/Persistence.lua +58 -0
  28. package/payload/addon/Core/Platform.lua +58 -0
  29. package/payload/addon/Core/Runtime.lua +25 -0
  30. package/payload/addon/Core/Safety.lua +56 -0
  31. package/{vendor → payload}/addon/Core/Serializer.lua +18 -6
  32. package/payload/addon/Core/Stores.lua +611 -0
  33. package/payload/addon/Lychee Dev_Forever.toc +52 -0
  34. package/payload/addon/Lychee Dev_Mainline.toc +52 -0
  35. package/payload/addon/Lychee Dev_Mists.toc +52 -0
  36. package/payload/addon/Lychee Dev_Wrath.toc +52 -0
  37. package/payload/addon/Modules/AutomationView.lua +393 -0
  38. package/{vendor → payload}/addon/Modules/Diagnostics.lua +92 -36
  39. package/{vendor → payload}/addon/Modules/Events/Catalog.lua +9 -0
  40. package/{vendor → payload}/addon/Modules/Events/Monitor.lua +45 -5
  41. package/payload/addon/Modules/FunctionTrace.lua +150 -0
  42. package/{vendor → payload}/addon/Modules/ObjectInspector.lua +105 -31
  43. package/{vendor → payload}/addon/UI/Export.lua +64 -34
  44. package/{vendor → payload}/addon/UI/Pages/About.lua +26 -14
  45. package/payload/addon/UI/Pages/Automation.lua +446 -0
  46. package/payload/addon/UI/Pages/Diagnostics.lua +402 -0
  47. package/{vendor/addon/UI/Features.lua → payload/addon/UI/Pages/Events.lua} +192 -302
  48. package/{vendor → payload}/addon/UI/Pages/ExportRecords.lua +213 -132
  49. package/{vendor → payload}/addon/UI/Pages/Object.lua +229 -121
  50. package/payload/addon/UI/Pages/Run.lua +423 -0
  51. package/payload/addon/UI/Pages/Trace.lua +314 -0
  52. package/payload/addon/UI/TreeView.lua +246 -0
  53. package/{vendor/addon/UI/MainWindow.lua → payload/addon/UI/Widgets.lua} +89 -529
  54. package/payload/addon/UI/Window.lua +425 -0
  55. package/payload/skill/SKILL.md +87 -0
  56. package/payload/skill/agents/openai.yaml +7 -0
  57. package/payload/skill/references/addon-validation.md +42 -0
  58. package/payload/skill/references/asset-export.md +109 -0
  59. package/payload/skill/references/commands.md +169 -0
  60. package/payload/skill/references/data-investigation.md +242 -0
  61. package/payload/skill/references/error-diagnosis.md +41 -0
  62. package/payload/skill/references/installation.md +18 -0
  63. package/payload/skill/references/live-investigation.md +129 -0
  64. package/payload/skill/references/source-research.md +82 -0
  65. package/payload/skill/scripts/lycheedev.mjs +59 -0
  66. package/release.json +346 -0
  67. package/bin/lycheedev.js +0 -742
  68. package/src/addon.js +0 -95
  69. package/src/config.js +0 -68
  70. package/src/doctor.js +0 -126
  71. package/src/install.js +0 -145
  72. package/src/paths.js +0 -93
  73. package/src/py/instances.py +0 -165
  74. package/src/python.js +0 -111
  75. package/src/skill.js +0 -48
  76. package/src/wow.js +0 -541
  77. package/vendor/addon/Core/Clients/Forever.lua +0 -9
  78. package/vendor/addon/Core/Clients/Mainline.lua +0 -9
  79. package/vendor/addon/Core/Clients/Mists.lua +0 -9
  80. package/vendor/addon/Core/Clients/Titan.lua +0 -9
  81. package/vendor/addon/Core/Compatibility.lua +0 -43
  82. package/vendor/addon/Core/Database.lua +0 -859
  83. package/vendor/addon/Core/Safety.lua +0 -42
  84. package/vendor/addon/Lychee Dev_Forever.toc +0 -43
  85. package/vendor/addon/Lychee Dev_Mainline.toc +0 -43
  86. package/vendor/addon/Lychee Dev_Mists.toc +0 -43
  87. package/vendor/addon/Lychee Dev_Wrath.toc +0 -43
  88. package/vendor/addon/Modules/Automation/Controller.lua +0 -884
  89. package/vendor/addon/Modules/Automation/Report.lua +0 -409
  90. package/vendor/addon/Modules/Automation/auto/auto.lua +0 -12
  91. package/vendor/addon/Modules/FunctionTrace.lua +0 -85
  92. package/vendor/addon/UI/AutomationOverlay.lua +0 -253
  93. package/vendor/addon/UI/Pages/Automation.lua +0 -417
  94. package/vendor/addon/UI/Pages/Diagnostics.lua +0 -289
  95. package/vendor/addon/UI/Pages/Trace.lua +0 -165
  96. package/vendor/skill/SKILL.md +0 -42
  97. package/vendor/skill/agents/openai.yaml +0 -4
  98. package/vendor/skill/references/automation.md +0 -128
  99. package/vendor/skill/references/clients.md +0 -51
  100. package/vendor/skill/references/runtime-investigations.md +0 -104
  101. package/vendor/skill/scripts/automation/__init__.py +0 -1
  102. package/vendor/skill/scripts/automation/registry.py +0 -516
  103. package/vendor/skill/scripts/automation/saved_variables.py +0 -438
  104. package/vendor/skill/scripts/automation/session.py +0 -207
  105. package/vendor/skill/scripts/automation/windows.py +0 -792
  106. package/vendor/skill/scripts/automation.py +0 -1034
  107. package/vendor/skill/scripts/requirements.txt +0 -13
  108. package/vendor/skill/scripts/selftest_offline.py +0 -1061
  109. package/vendor/skill/scripts/test_input_safety.py +0 -132
  110. /package/{vendor → payload}/addon/Media/GitHub.png +0 -0
  111. /package/{vendor → payload}/addon/Media/Logo.png +0 -0
  112. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Forever.lua +0 -0
  113. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mainline.lua +0 -0
  114. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mists.lua +0 -0
  115. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Titan.lua +0 -0
@@ -1,253 +0,0 @@
1
- local ADDON_NAME, ns = ...
2
- local L = ns.L
3
-
4
- -- Screen-level automation status overlay. Everything is created lazily on the
5
- -- first Show call: while disabled this file creates no frames, registers no
6
- -- events and runs no scripts.
7
- --
8
- -- Status blocks: three 4-physical-pixel squares in RGB order at the top-left
9
- -- corner while an automation request runs. Error state lights only red.
10
- -- Completion notice: one static QR code at the top-left, encoded once per
11
- -- result and kept visible until the output-side reload, an explicit hide or a
12
- -- safe cleanup. Dark modules come from a bounded reuse pool.
13
-
14
- local POOL_LIMIT = 3000
15
- local MAX_NOTICE_UI_SIZE = 480
16
-
17
- local statusFrame
18
- local noticeFrame
19
- local identityFrame
20
- local statusBlocks
21
- local noticeTextures = {}
22
- local identityTextures = {}
23
- local lastNoticeJson
24
- local lastIdentityJson
25
-
26
- local function PhysicalUnit()
27
- if ns.Client and ns.Client.GetPhysicalPixelSize then
28
- return ns.Client.GetPhysicalPixelSize()
29
- end
30
- return 1
31
- end
32
-
33
- local function EnsureOverlay()
34
- if statusFrame then
35
- return
36
- end
37
-
38
- statusFrame = CreateFrame("Frame", "LycheeDevAutomationStatus", UIParent)
39
- statusFrame:SetFrameStrata("FULLSCREEN_DIALOG")
40
- statusFrame:SetFrameLevel(10000)
41
- statusFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
42
- statusFrame:Hide()
43
-
44
- statusBlocks = {
45
- statusFrame:CreateTexture(nil, "OVERLAY"),
46
- statusFrame:CreateTexture(nil, "OVERLAY"),
47
- statusFrame:CreateTexture(nil, "OVERLAY"),
48
- }
49
- statusBlocks[1]:SetColorTexture(0.85, 0.13, 0.15, 1)
50
- statusBlocks[2]:SetColorTexture(0.20, 0.78, 0.33, 1)
51
- statusBlocks[3]:SetColorTexture(0.24, 0.47, 0.95, 1)
52
-
53
- noticeFrame = CreateFrame("Frame", "LycheeDevAutomationNotice", UIParent)
54
- noticeFrame:SetFrameStrata("FULLSCREEN_DIALOG")
55
- noticeFrame:SetFrameLevel(10000)
56
- -- Top-left corner, matching the status blocks. The notice replaces them when
57
- -- it appears, so the two never share the corner at the same time.
58
- noticeFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
59
- local background = noticeFrame:CreateTexture(nil, "BACKGROUND")
60
- background:SetAllPoints()
61
- background:SetColorTexture(1, 1, 1, 1)
62
- noticeFrame:Hide()
63
-
64
- -- Identity marker: the same corner and the same white-card convention as the
65
- -- completion notice, but a separate frame. It answers "which character is in
66
- -- this window" for a host that can capture several windows, and it is shown
67
- -- only on explicit request so it never competes with the ticket notice.
68
- identityFrame = CreateFrame("Frame", "LycheeDevAutomationIdentity", UIParent)
69
- identityFrame:SetFrameStrata("FULLSCREEN_DIALOG")
70
- identityFrame:SetFrameLevel(10000)
71
- identityFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 16, -16)
72
- local identityBackground = identityFrame:CreateTexture(nil, "BACKGROUND")
73
- identityBackground:SetAllPoints()
74
- identityBackground:SetColorTexture(1, 1, 1, 1)
75
- identityFrame:Hide()
76
- end
77
-
78
- local function LayoutStatusBlocks(mode)
79
- local unit = PhysicalUnit()
80
- local size = math.max(1, math.floor(4 * unit + 0.5))
81
- local gap = math.max(1, math.floor(unit + 0.5))
82
- for index = 1, 3 do
83
- local block = statusBlocks[index]
84
- block:ClearAllPoints()
85
- block:SetSize(size, size)
86
- block:SetPoint("TOPLEFT", statusFrame, "TOPLEFT", (index - 1) * (size + gap), 0)
87
- block:SetShown(mode == "running" or (mode == "error" and index == 1))
88
- end
89
- statusFrame:SetSize(size * 3 + gap * 2, size)
90
- statusFrame:Show()
91
- end
92
-
93
- local function CountDarkModules(matrix)
94
- local size = #matrix
95
- local dark = 0
96
- for y = 1, size do
97
- local column = matrix[y]
98
- for x = 1, size do
99
- if column[x] and column[x] > 0 then
100
- dark = dark + 1
101
- end
102
- end
103
- end
104
- return dark, size
105
- end
106
-
107
- -- Render a QR matrix into one corner frame, reusing a bounded pool of textures.
108
- -- Both the ticket notice and the identity marker go through here, so they share
109
- -- the quiet zone, sizing and pool behaviour.
110
- local function RenderMatrixInto(frame, textures, matrix)
111
- local dark, size = CountDarkModules(matrix)
112
- if dark > POOL_LIMIT then
113
- return false
114
- end
115
-
116
- local unit = PhysicalUnit()
117
- local moduleSize = math.max(2, math.ceil(3 * unit))
118
- local quiet = moduleSize * 4
119
- if size * moduleSize + quiet * 2 > MAX_NOTICE_UI_SIZE then
120
- moduleSize = math.max(1, math.floor((MAX_NOTICE_UI_SIZE / (size + 8)) + 0.5))
121
- quiet = moduleSize * 4
122
- end
123
- local total = size * moduleSize + quiet * 2
124
- frame:SetSize(total, total)
125
-
126
- local used = 0
127
- for y = 1, size do
128
- local column = matrix[y]
129
- for x = 1, size do
130
- if column[x] and column[x] > 0 then
131
- used = used + 1
132
- local texture = textures[used]
133
- if not texture then
134
- texture = frame:CreateTexture(nil, "OVERLAY")
135
- texture:SetColorTexture(0, 0, 0, 1)
136
- textures[used] = texture
137
- end
138
- texture:SetSize(moduleSize, moduleSize)
139
- texture:ClearAllPoints()
140
- texture:SetPoint("TOPLEFT", frame, "TOPLEFT",
141
- quiet + (x - 1) * moduleSize, -(quiet + (y - 1) * moduleSize))
142
- texture:Show()
143
- end
144
- end
145
- end
146
- -- Hide leftovers from a previous, larger matrix; a stale dark module would
147
- -- corrupt the code the host is trying to read.
148
- for index = used + 1, #textures do
149
- textures[index]:Hide()
150
- end
151
- return true, used
152
- end
153
-
154
- local Overlay = {}
155
-
156
- function Overlay.ShowRunning()
157
- EnsureOverlay()
158
- -- A run in progress outranks the static identity marker: they share the
159
- -- corner, so the marker steps aside rather than overlapping the blocks.
160
- if identityFrame then
161
- identityFrame:Hide()
162
- end
163
- LayoutStatusBlocks("running")
164
- end
165
-
166
- function Overlay.ShowError()
167
- EnsureOverlay()
168
- if identityFrame then
169
- identityFrame:Hide()
170
- end
171
- LayoutStatusBlocks("error")
172
- end
173
-
174
- function Overlay.HideStatus()
175
- if statusFrame then
176
- statusFrame:Hide()
177
- end
178
- end
179
-
180
- function Overlay.ShowNotice(json)
181
- EnsureOverlay()
182
- if json == lastNoticeJson and noticeFrame:IsShown() then
183
- -- Same static notice: keep the rendered matrix, never re-encode.
184
- return true
185
- end
186
- local matrix, encodeError = ns.AutomationQR.Encode(json, 2)
187
- if not matrix or not RenderMatrixInto(noticeFrame, noticeTextures, matrix) then
188
- noticeFrame:Hide()
189
- lastNoticeJson = nil
190
- Overlay.ShowError()
191
- return false, encodeError or "render_failed"
192
- end
193
- lastNoticeJson = json
194
- -- The notice now shares the top-left corner with the status blocks, so the
195
- -- blocks step aside; the caller has already stopped the run they described.
196
- if statusFrame then
197
- statusFrame:Hide()
198
- end
199
- -- The identity marker occupies the same corner; the completion notice is the
200
- -- more urgent of the two, so it takes the corner.
201
- if identityFrame then
202
- identityFrame:Hide()
203
- end
204
- noticeFrame:Show()
205
- return true
206
- end
207
-
208
- function Overlay.HideNotice()
209
- if noticeFrame then
210
- noticeFrame:Hide()
211
- end
212
- lastNoticeJson = nil
213
- end
214
-
215
- -- Identity marker: a host able to capture several game windows reads this to
216
- -- learn which character and build each window holds, so it can offer a
217
- -- character-based choice instead of an arbitrary instance index.
218
- function Overlay.ShowIdentity(json)
219
- EnsureOverlay()
220
- if json == lastIdentityJson and identityFrame:IsShown() then
221
- return true
222
- end
223
- local matrix, encodeError = ns.AutomationQR.Encode(json, 2)
224
- if not matrix or not RenderMatrixInto(identityFrame, identityTextures, matrix) then
225
- identityFrame:Hide()
226
- lastIdentityJson = nil
227
- return false, encodeError or "render_failed"
228
- end
229
- lastIdentityJson = json
230
- -- The marker shares the top-left corner with the status blocks and the
231
- -- completion notice; only one of the three may occupy it at a time.
232
- if statusFrame then
233
- statusFrame:Hide()
234
- end
235
- if noticeFrame then
236
- noticeFrame:Hide()
237
- end
238
- identityFrame:Show()
239
- return true
240
- end
241
-
242
- function Overlay.HideIdentity()
243
- if identityFrame then
244
- identityFrame:Hide()
245
- end
246
- lastIdentityJson = nil
247
- end
248
-
249
- function Overlay.IsIdentityShown()
250
- return identityFrame ~= nil and identityFrame:IsShown()
251
- end
252
-
253
- ns.AutomationOverlay = Overlay
@@ -1,417 +0,0 @@
1
- local ADDON_NAME, ns = ...
2
- local L = ns.L
3
-
4
- local ROW_HEIGHT = 58
5
- local LIST_WIDTH = 354
6
- local REPORT_DISPLAY_BYTES = 48 * 1024
7
-
8
- local STATUS_LABELS = {
9
- running = "AUTO_STATUS_RUNNING",
10
- finalizing = "AUTO_STATUS_FINALIZING",
11
- succeeded = "AUTO_STATUS_SUCCEEDED",
12
- failed = "AUTO_STATUS_FAILED",
13
- cancelled = "AUTO_STATUS_CANCELLED",
14
- interrupted = "AUTO_STATUS_INTERRUPTED",
15
- }
16
-
17
- local KIND_LABELS = {
18
- lua = "AUTO_KIND_LUA",
19
- bug_snapshot = "AUTO_KIND_BUG",
20
- }
21
-
22
- local function GetStatusKey(status)
23
- return STATUS_LABELS[status] and L[STATUS_LABELS[status]] or tostring(status or L.UNKNOWN)
24
- end
25
-
26
- local function GetKindLabel(kind)
27
- local key = KIND_LABELS[kind]
28
- return key and L[key] or L.EXPORT_KIND_UNKNOWN
29
- end
30
-
31
- local function FormatTime(timestamp)
32
- timestamp = tonumber(timestamp) or 0
33
- if timestamp <= 0 then
34
- return L.UNKNOWN
35
- end
36
- return date("%Y-%m-%d %H:%M:%S", timestamp)
37
- end
38
-
39
- local RESULT_STATE_LABELS = {
40
- pending = "AUTO_PENDING_DISK",
41
- flushed = "AUTO_LOADED_SAVED",
42
- received = "AUTO_ACK_RECEIVED",
43
- failed = "AUTO_ACK_FAILED",
44
- expired = "AUTO_RESULT_EXPIRED",
45
- }
46
-
47
- -- The life cycle lives in one place (Core/Database.lua); the page only renders
48
- -- it, so the notice, the list and the detail pane cannot disagree.
49
- local function GetResultState(record)
50
- local state = ns.AutomationResultState(record)
51
- local key = RESULT_STATE_LABELS[state]
52
- return key and L[key] or "-"
53
- end
54
-
55
- local function CreateField(parent, labelText, x, y, width)
56
- local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
57
- label:SetPoint("TOPLEFT", x, y)
58
- label:SetText(labelText)
59
- label:SetTextColor(1, 1, 1, 0.34)
60
-
61
- local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
62
- value:SetPoint("TOPLEFT", x, y - 20)
63
- value:SetWidth(width)
64
- value:SetJustifyH("LEFT")
65
- value:SetWordWrap(false)
66
- value:SetTextColor(0.91, 0.93, 0.95, 0.92)
67
- return value
68
- end
69
-
70
- function ns.CreateAutomationPage(parent, ui)
71
- local page = CreateFrame("Frame", nil, parent)
72
- page:SetAllPoints(parent)
73
-
74
- local selectedExecutionId
75
- local rows = {}
76
- local clearConfirmed = false
77
-
78
- local heading = ui.CreateSectionLabel(page, L.TAB_AUTOMATION)
79
- heading:SetPoint("TOPLEFT", 17, -84)
80
-
81
- local countText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
82
- countText:SetPoint("LEFT", heading, "RIGHT", 12, 0)
83
- countText:SetTextColor(1, 1, 1, 0.36)
84
-
85
- local taskLabel = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
86
- taskLabel:SetPoint("TOPRIGHT", -14, -84)
87
- taskLabel:SetText(L.AUTO_FIELD_TASK)
88
- taskLabel:SetTextColor(1, 1, 1, 0.34)
89
-
90
- local taskPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 1)
91
- taskPanel:SetPoint("TOPRIGHT", -14, -104)
92
- taskPanel:SetWidth(220)
93
- taskPanel:SetHeight(30)
94
-
95
- local taskInput = CreateFrame("EditBox", nil, taskPanel)
96
- taskInput:SetPoint("TOPLEFT", 10, -1)
97
- taskInput:SetPoint("BOTTOMRIGHT", -10, 1)
98
- taskInput:SetAutoFocus(false)
99
- taskInput:SetFontObject(ChatFontNormal)
100
- taskInput:SetTextColor(0.94, 0.95, 0.96)
101
- taskInput:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
102
- taskInput:SetScript("OnEnterPressed", function(self)
103
- self:ClearFocus()
104
- if ns.Automation then
105
- ns.Automation.Run(self:GetText())
106
- end
107
- end)
108
-
109
- local runButton = ui.CreateButton(page, 96, L.AUTO_RUN, true)
110
- runButton:SetPoint("RIGHT", taskPanel, "LEFT", -8, 0)
111
- runButton:SetScript("OnClick", function()
112
- if ns.Automation then
113
- ns.Automation.Run(taskInput:GetText())
114
- end
115
- end)
116
-
117
- local cancelButton = ui.CreateButton(page, 110, L.AUTO_CANCEL, false)
118
- cancelButton:SetPoint("RIGHT", runButton, "LEFT", -8, 0)
119
-
120
- local showNoticeButton = ui.CreateButton(page, 128, L.AUTO_SHOW_NOTICE, false)
121
- showNoticeButton:SetPoint("RIGHT", cancelButton, "LEFT", -8, 0)
122
-
123
- local hideNoticeButton = ui.CreateButton(page, 118, L.AUTO_HIDE_NOTICE, false)
124
- hideNoticeButton:SetPoint("RIGHT", showNoticeButton, "LEFT", -8, 0)
125
-
126
- local clearButton = ui.CreateButton(page, 118, L.AUTO_CLEAR_HISTORY, false)
127
- clearButton:SetPoint("RIGHT", hideNoticeButton, "LEFT", -8, 0)
128
-
129
- local listPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
130
- listPanel:SetPoint("TOPLEFT", 14, -144)
131
- listPanel:SetPoint("BOTTOMLEFT", 14, 54)
132
- listPanel:SetWidth(LIST_WIDTH)
133
-
134
- local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
135
- local listContent = CreateFrame("Frame", nil, listScroll)
136
- listContent:SetWidth(LIST_WIDTH - 26)
137
- listContent:SetHeight(1)
138
- listScroll:SetScrollChild(listContent)
139
-
140
- local emptyTitle = listPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
141
- emptyTitle:SetPoint("CENTER", listPanel, "CENTER", 0, 14)
142
- emptyTitle:SetText(L.AUTO_NO_EXECUTIONS)
143
- emptyTitle:SetTextColor(1, 1, 1, 0.58)
144
-
145
- local detailPanel = CreateFrame("Frame", nil, page)
146
- detailPanel:SetPoint("TOPLEFT", listPanel, "TOPRIGHT", 12, 0)
147
- detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
148
-
149
- local detailHeading = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
150
- detailHeading:SetPoint("TOPLEFT", 4, -4)
151
- detailHeading:SetText(L.AUTO_DETAIL)
152
-
153
- local detailState = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
154
- detailState:SetPoint("TOPRIGHT", -4, -4)
155
-
156
- local taskValue = CreateField(detailPanel, L.AUTO_FIELD_TASK, 4, -48, 282)
157
- local kindValue = CreateField(detailPanel, L.EXPORT_RECORD_KIND, 314, -48, 272)
158
- local requestValue = CreateField(detailPanel, L.AUTO_FIELD_REQUEST, 4, -106, 282)
159
- local statusValue = CreateField(detailPanel, L.AUTO_FIELD_STATUS, 314, -106, 272)
160
- local startedValue = CreateField(detailPanel, L.AUTO_FIELD_STARTED, 4, -164, 282)
161
- local finishedValue = CreateField(detailPanel, L.AUTO_FIELD_FINISHED, 314, -164, 272)
162
- local revisionValue = CreateField(detailPanel, L.AUTO_FIELD_REVISION, 4, -222, 282)
163
- local errorValue = CreateField(detailPanel, L.AUTO_FIELD_ERROR, 314, -222, 272)
164
-
165
- local ticketLabel = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
166
- ticketLabel:SetPoint("TOPLEFT", 4, -284)
167
- ticketLabel:SetText(L.EXPORT_TICKET)
168
- ticketLabel:SetTextColor(1, 1, 1, 0.34)
169
-
170
- local ticketPanel = ui.CreatePanel(detailPanel, ui.editorR, ui.editorG, ui.editorB, 1)
171
- ticketPanel:SetPoint("TOPLEFT", 4, -305)
172
- ticketPanel:SetPoint("TOPRIGHT", -140, -305)
173
- ticketPanel:SetHeight(36)
174
-
175
- local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
176
- ticketBox:SetPoint("TOPLEFT", 10, -1)
177
- ticketBox:SetPoint("BOTTOMRIGHT", -10, 1)
178
- ticketBox:SetAutoFocus(false)
179
- ticketBox:SetFontObject(ChatFontNormal)
180
- ticketBox:SetTextColor(0.94, 0.95, 0.96)
181
- ticketBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
182
-
183
- local viewReportButton = ui.CreateButton(detailPanel, 118, L.AUTO_VIEW_REPORT, false)
184
- viewReportButton:SetPoint("TOPRIGHT", -4, -305)
185
-
186
- local reportArea = ui.CreateTextArea(detailPanel, true)
187
- reportArea:SetPoint("TOPLEFT", 4, -352)
188
- reportArea:SetPoint("BOTTOMRIGHT", -4, 4)
189
-
190
- local function ApplyRowState(row)
191
- local selected = row.executionId == selectedExecutionId
192
- ui.SetListRowState(row, selected, row.hovered)
193
- if selected then
194
- row.title:SetTextColor(1, 1, 1, 0.96)
195
- elseif row.hovered then
196
- row.title:SetTextColor(1, 1, 1, 0.90)
197
- else
198
- row.title:SetTextColor(1, 1, 1, 0.76)
199
- end
200
- end
201
-
202
- local function RefreshDetail()
203
- local automation = ns.GetAutomationIndex()
204
- local record = selectedExecutionId and automation
205
- and automation.records[selectedExecutionId] or nil
206
- local hasRecord = record ~= nil
207
- local resultState = GetResultState(record)
208
- local hasResult = hasRecord and record.ticket and ns.GetExport(record.ticket) ~= nil
209
-
210
- detailHeading:SetText(hasRecord and record.taskId or L.AUTO_DETAIL)
211
- detailState:SetText(hasRecord and resultState or "")
212
- detailState:SetTextColor(1, 1, 1, 0.36)
213
- taskValue:SetText(hasRecord and record.taskId or "")
214
- kindValue:SetText(hasRecord and GetKindLabel(record.kind) or "")
215
- requestValue:SetText(hasRecord and record.executionId or "")
216
- statusValue:SetText(hasRecord and GetStatusKey(record.status) or "")
217
- startedValue:SetText(hasRecord and FormatTime(record.startedAt) or "")
218
- finishedValue:SetText(hasRecord and FormatTime(record.finishedAt) or "")
219
- revisionValue:SetText(hasRecord and (record.revision or L.NOT_AVAILABLE) or "")
220
- errorValue:SetText(hasRecord and (record.errorCode or L.NOT_AVAILABLE) or "")
221
-
222
- ticketBox.savedText = hasResult and record.ticket or ""
223
- ticketBox.updatingText = true
224
- ticketBox:SetText(ticketBox.savedText)
225
- ticketBox.updatingText = nil
226
- ui.SetButtonEnabled(showNoticeButton, hasResult and not (ns.Automation and ns.Automation.IsBusy()))
227
- ui.SetButtonEnabled(viewReportButton, hasResult)
228
-
229
- if not hasResult then
230
- ui.SetReadOnlyText(reportArea, "")
231
- end
232
- end
233
-
234
- local function SelectRecord(executionId)
235
- selectedExecutionId = executionId
236
- for index = 1, #rows do
237
- ApplyRowState(rows[index])
238
- end
239
- RefreshDetail()
240
- end
241
-
242
- local function AcquireRow(index)
243
- local row = rows[index]
244
- if row then
245
- return row
246
- end
247
-
248
- row = ui.CreateListRow(listContent, ROW_HEIGHT)
249
- row:SetPoint("TOPLEFT", 0, -(index - 1) * ROW_HEIGHT)
250
- row:SetPoint("TOPRIGHT", 0, -(index - 1) * ROW_HEIGHT)
251
- row:EnableMouseWheel(true)
252
-
253
- local title = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
254
- title:SetPoint("TOPLEFT", 12, -10)
255
- title:SetPoint("TOPRIGHT", -100, -10)
256
- title:SetJustifyH("LEFT")
257
- title:SetWordWrap(false)
258
- row.title = title
259
-
260
- local status = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
261
- status:SetPoint("TOPRIGHT", -10, -10)
262
- status:SetJustifyH("RIGHT")
263
- row.status = status
264
-
265
- local meta = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
266
- meta:SetPoint("BOTTOMLEFT", 12, 9)
267
- meta:SetPoint("BOTTOMRIGHT", -10, 9)
268
- meta:SetJustifyH("LEFT")
269
- meta:SetWordWrap(false)
270
- meta:SetTextColor(1, 1, 1, 0.34)
271
- row.meta = meta
272
-
273
- row:SetScript("OnEnter", function(self)
274
- self.hovered = true
275
- ApplyRowState(self)
276
- end)
277
- row:SetScript("OnLeave", function(self)
278
- self.hovered = nil
279
- ApplyRowState(self)
280
- end)
281
- row:SetScript("OnClick", function(self)
282
- SelectRecord(self.executionId)
283
- end)
284
- row:SetScript("OnMouseWheel", listScroll.onMouseWheel)
285
- rows[index] = row
286
- return row
287
- end
288
-
289
- local function Refresh()
290
- local automation = ns.GetAutomationIndex()
291
- local order = automation and automation.order or {}
292
- countText:SetText(string.format(L.AUTO_EXECUTION_COUNT, #order))
293
- emptyTitle:SetShown(#order == 0)
294
- ui.SetButtonEnabled(clearButton, #order > 0)
295
-
296
- if clearConfirmed then
297
- clearConfirmed = false
298
- ui.SetButtonText(clearButton, L.AUTO_CLEAR_HISTORY)
299
- ui.SetButtonVariant(clearButton, "secondary")
300
- end
301
-
302
- for index = 1, #order do
303
- local record = automation.records[order[index]]
304
- local row = AcquireRow(index)
305
- row.executionId = order[index]
306
- row.title:SetText(record.taskId)
307
- local state = GetResultState(record)
308
- row.status:SetText(GetStatusKey(record.status))
309
- if record.status == "succeeded" then
310
- row.status:SetTextColor(0.42, 0.76, 0.43, 0.92)
311
- elseif record.status == "running" or record.status == "finalizing" then
312
- row.status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
313
- else
314
- row.status:SetTextColor(1, 1, 1, 0.30)
315
- end
316
- row.meta:SetText(FormatTime(record.startedAt) .. " | " .. GetKindLabel(record.kind)
317
- .. " | " .. state)
318
- row:Show()
319
- end
320
- for index = #order + 1, #rows do
321
- rows[index]:Hide()
322
- end
323
-
324
- listContent:SetHeight(math.max(1, #order * ROW_HEIGHT))
325
- listScroll:UpdateScrollChildRect()
326
- if selectedExecutionId and not (automation and automation.records[selectedExecutionId]) then
327
- selectedExecutionId = nil
328
- end
329
- if not selectedExecutionId and order[1] then
330
- selectedExecutionId = order[1]
331
- end
332
- for index = 1, #rows do
333
- ApplyRowState(rows[index])
334
- end
335
- RefreshDetail()
336
- end
337
-
338
- ticketBox:SetScript("OnTextChanged", function(self)
339
- if not self.updatingText and self:GetText() ~= self.savedText then
340
- self.updatingText = true
341
- self:SetText(self.savedText or "")
342
- self.updatingText = nil
343
- self:HighlightText()
344
- end
345
- end)
346
- ticketBox:SetScript("OnMouseUp", function()
347
- if ticketBox.savedText ~= "" then
348
- ui.SelectAllText(ticketBox)
349
- end
350
- end)
351
-
352
- cancelButton:SetScript("OnClick", function()
353
- if selectedExecutionId then
354
- local automation = ns.GetAutomationIndex()
355
- local record = automation and automation.records[selectedExecutionId] or nil
356
- if record and ns.Automation then
357
- ns.Automation.Cancel(record.taskId)
358
- end
359
- end
360
- end)
361
-
362
- showNoticeButton:SetScript("OnClick", function()
363
- if ns.Automation then
364
- ns.Automation.Show(ticketBox.savedText or "")
365
- end
366
- end)
367
-
368
- hideNoticeButton:SetScript("OnClick", function()
369
- if ns.Automation then
370
- ns.Automation.Stop()
371
- end
372
- end)
373
-
374
- clearButton:SetScript("OnClick", function()
375
- if not clearConfirmed then
376
- clearConfirmed = true
377
- ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_CACHE)
378
- ui.SetButtonVariant(clearButton, "danger")
379
- return
380
- end
381
- ns.ClearAutomationHistory()
382
- selectedExecutionId = nil
383
- Refresh()
384
- end)
385
-
386
- viewReportButton:SetScript("OnClick", function()
387
- local entry = ticketBox.savedText ~= "" and ns.GetExport(ticketBox.savedText) or nil
388
- if not entry or not entry.payload then
389
- return
390
- end
391
- local content = entry.payload.content or ""
392
- if #content > REPORT_DISPLAY_BYTES then
393
- ui.SetReadOnlyText(reportArea, content:sub(1, REPORT_DISPLAY_BYTES)
394
- .. "\n... " .. string.format(L.AUTO_REPORT_DISPLAY_LIMIT, REPORT_DISPLAY_BYTES / 1024))
395
- else
396
- ui.SetReadOnlyText(reportArea, content)
397
- end
398
- end)
399
-
400
- page.Refresh = Refresh
401
- page.SelectRecord = SelectRecord
402
- page.ticketBox = ticketBox
403
- page.taskInput = taskInput
404
- page.rows = rows
405
- page.reportArea = reportArea
406
- page.runButton = runButton
407
- page.cancelButton = cancelButton
408
- page.showNoticeButton = showNoticeButton
409
- page.hideNoticeButton = hideNoticeButton
410
- page.viewReportButton = viewReportButton
411
- page.clearButton = clearButton
412
- function page:Activate()
413
- Refresh()
414
- end
415
- Refresh()
416
- return page
417
- end