lycheedev 1.2.0 → 2.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.
Files changed (118) 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 +128 -93
  26. package/{vendor → payload}/addon/Core/Locale_enUS.lua +128 -95
  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 -746
  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 -44
  85. package/vendor/addon/Lychee Dev_Mainline.toc +0 -44
  86. package/vendor/addon/Lychee Dev_Mists.toc +0 -44
  87. package/vendor/addon/Lychee Dev_Wrath.toc +0 -44
  88. package/vendor/addon/Modules/Automation/Controller.lua +0 -896
  89. package/vendor/addon/Modules/Automation/Reload.lua +0 -101
  90. package/vendor/addon/Modules/Automation/Report.lua +0 -409
  91. package/vendor/addon/Modules/Automation/auto/auto.lua +0 -12
  92. package/vendor/addon/Modules/FunctionTrace.lua +0 -85
  93. package/vendor/addon/UI/AutomationOverlay.lua +0 -253
  94. package/vendor/addon/UI/Pages/Automation.lua +0 -417
  95. package/vendor/addon/UI/Pages/Diagnostics.lua +0 -289
  96. package/vendor/addon/UI/Pages/Trace.lua +0 -165
  97. package/vendor/skill/SKILL.md +0 -44
  98. package/vendor/skill/agents/openai.yaml +0 -4
  99. package/vendor/skill/references/automation.md +0 -130
  100. package/vendor/skill/references/clients.md +0 -51
  101. package/vendor/skill/references/runtime-investigations.md +0 -104
  102. package/vendor/skill/scripts/automation/__init__.py +0 -1
  103. package/vendor/skill/scripts/automation/registry.py +0 -516
  104. package/vendor/skill/scripts/automation/reload.py +0 -121
  105. package/vendor/skill/scripts/automation/saved_variables.py +0 -438
  106. package/vendor/skill/scripts/automation/session.py +0 -207
  107. package/vendor/skill/scripts/automation/windows.py +0 -792
  108. package/vendor/skill/scripts/automation.py +0 -1067
  109. package/vendor/skill/scripts/requirements.txt +0 -13
  110. package/vendor/skill/scripts/selftest_offline.py +0 -1061
  111. package/vendor/skill/scripts/test_input_safety.py +0 -132
  112. package/vendor/skill/scripts/test_reload.py +0 -120
  113. /package/{vendor → payload}/addon/Media/GitHub.png +0 -0
  114. /package/{vendor → payload}/addon/Media/Logo.png +0 -0
  115. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Forever.lua +0 -0
  116. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mainline.lua +0 -0
  117. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mists.lua +0 -0
  118. /package/{vendor → payload}/addon/Modules/Events/CatalogData_Titan.lua +0 -0
@@ -0,0 +1,402 @@
1
+ local ADDON_NAME, ns = ...
2
+ local L = ns.L
3
+
4
+ -- Diagnostics workbench page: bounded !BugGrabber error browsing with a scope
5
+ -- toggle, keyword search, a two-click clear and the agent report pane. The
6
+ -- provider is a SOFT integration: nothing is fabricated when it is missing.
7
+ local ERROR_ROW_HEIGHT = 44
8
+ local ERROR_LIST_WIDTH = 430
9
+ local VISIBLE_ROWS = 16
10
+
11
+ -- The single built page instance; only read by the shell export hook.
12
+ local builtPage
13
+
14
+ local function IsSecret(value)
15
+ return issecretvalue and issecretvalue(value)
16
+ end
17
+
18
+ local function SafeNumber(value)
19
+ if value == nil or IsSecret(value) then
20
+ return nil
21
+ end
22
+ return tonumber(value)
23
+ end
24
+
25
+ local function CreateLineInput(parent)
26
+ local W = ns.Widgets
27
+ local colors = W.Colors
28
+ local panel = W.CreatePanel(parent, colors.editor[1], colors.editor[2], colors.editor[3], 1)
29
+ local editBox = CreateFrame("EditBox", nil, panel)
30
+ editBox:SetAutoFocus(false)
31
+ editBox:SetFontObject(ChatFontNormal)
32
+ editBox:SetTextColor(0.94, 0.95, 0.96)
33
+ editBox:SetTextInsets(9, 9, 0, 0)
34
+ editBox:SetPoint("TOPLEFT", 1, -1)
35
+ editBox:SetPoint("BOTTOMRIGHT", -1, 1)
36
+ editBox:SetScript("OnEscapePressed", function(self)
37
+ self:ClearFocus()
38
+ end)
39
+ editBox:SetScript("OnEditFocusGained", function()
40
+ W.SetBorderColor(panel, true, 0.75)
41
+ end)
42
+ editBox:SetScript("OnEditFocusLost", function()
43
+ W.SetBorderColor(panel, false)
44
+ end)
45
+ panel.editBox = editBox
46
+ return panel
47
+ end
48
+
49
+ local function BuildDiagnosticsPage(parent)
50
+ local W = ns.Widgets
51
+ local colors = W.Colors
52
+ local layout = ns.Workbench.Layout
53
+ local accent = colors.accent
54
+
55
+ local page = CreateFrame("Frame", nil, parent)
56
+ page:SetAllPoints(parent)
57
+
58
+ local refreshButton = W.CreateButton(page, 92, L.REFRESH, false)
59
+ refreshButton:SetPoint("TOPRIGHT", -14, -84)
60
+ local clearButton = W.CreateButton(page, 178, L.CLEAR_ERRORS, false)
61
+ clearButton:SetPoint("RIGHT", refreshButton, "LEFT", -8, 0)
62
+
63
+ local status = page:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
64
+ status:SetPoint("TOPLEFT", 17, -94)
65
+ status:SetPoint("RIGHT", clearButton, "LEFT", -10, 0)
66
+ status:SetJustifyH("LEFT")
67
+ local function SetStatus(text, errorState)
68
+ local r = errorState and accent[1] or 0.55
69
+ local g = errorState and accent[2] or 0.60
70
+ local b = errorState and accent[3] or 0.65
71
+ status:SetText(text or "")
72
+ status:SetTextColor(r, g, b, 0.92)
73
+ end
74
+
75
+ local errorsView = CreateFrame("Frame", nil, page)
76
+ errorsView:SetPoint("TOPLEFT", 0, -126)
77
+ errorsView:SetPoint("BOTTOMRIGHT")
78
+
79
+ local currentScope = W.CreateButton(errorsView, 104, L.CURRENT_SESSION, "selected")
80
+ currentScope:SetPoint("TOPLEFT", 14, 0)
81
+ local allScope = W.CreateButton(errorsView, 104, L.ALL_SESSIONS, "secondary")
82
+ allScope:SetPoint("LEFT", currentScope, "RIGHT", 8, 0)
83
+ local searchPanel = CreateLineInput(errorsView)
84
+ searchPanel:SetPoint("TOPLEFT", allScope, "TOPRIGHT", 14, 0)
85
+ searchPanel:SetWidth(260)
86
+ searchPanel:SetHeight(28)
87
+ local searchButton = W.CreateButton(errorsView, 76, L.SEARCH, false)
88
+ searchButton:SetPoint("LEFT", searchPanel, "RIGHT", 8, 0)
89
+ local selectReport = W.CreateButton(errorsView, 110, L.SELECT_REPORT, false)
90
+ selectReport:SetPoint("TOPRIGHT", -14, 0)
91
+ local exportReport = W.CreateButton(errorsView, 92, L.SAVE_TO_DISK, false)
92
+ exportReport:SetPoint("RIGHT", selectReport, "LEFT", -8, 0)
93
+ page.currentScope = currentScope
94
+ page.allScope = allScope
95
+ page.refreshButton = refreshButton
96
+ page.clearButton = clearButton
97
+ page.selectReport = selectReport
98
+ page.exportReport = exportReport
99
+ page.searchPanel = searchPanel
100
+ page.searchButton = searchButton
101
+
102
+ local listLabel = W.CreateSectionLabel(errorsView, L.ERROR_LIST)
103
+ listLabel:SetPoint("TOPLEFT", 17, -48)
104
+ local reportLabel = W.CreateSectionLabel(errorsView, L.AGENT_REPORT)
105
+ reportLabel:SetPoint("TOPLEFT", ERROR_LIST_WIDTH + 29, -48)
106
+
107
+ local listPanel = W.CreatePanel(errorsView, colors.editor[1], colors.editor[2], colors.editor[3], 0.78)
108
+ listPanel:SetPoint("TOPLEFT", 14, -68)
109
+ listPanel:SetPoint("BOTTOMLEFT", 14, 54)
110
+ listPanel:SetWidth(ERROR_LIST_WIDTH)
111
+ page.listPanel = listPanel
112
+ local errorScroll = W.CreateScrollArea(listPanel, 8, 8, 7, 8)
113
+ local errorContent = CreateFrame("Frame", nil, errorScroll)
114
+ errorContent:SetWidth(ERROR_LIST_WIDTH - 26)
115
+ errorContent:SetHeight(1)
116
+ errorScroll:SetScrollChild(errorContent)
117
+ local errorEmpty = listPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
118
+ errorEmpty:SetPoint("TOP", 0, -24)
119
+ errorEmpty:SetText(L.NO_ERRORS)
120
+ errorEmpty:SetTextColor(1, 1, 1, 0.32)
121
+
122
+ local reportPanel = W.CreateTextArea(errorsView, true)
123
+ reportPanel:SetPoint("TOPLEFT", ERROR_LIST_WIDTH + 26, -68)
124
+ reportPanel:SetPoint("BOTTOMRIGHT", -14, 54)
125
+ reportPanel.editBox:SetWidth(layout.WINDOW_WIDTH - ERROR_LIST_WIDTH - 78)
126
+ reportPanel.editBox:SetScript("OnMouseUp", function(self)
127
+ self:SetFocus()
128
+ end)
129
+ W.SetReadOnlyText(reportPanel, L.SELECT_ERROR_DETAIL)
130
+ page.reportPanel = reportPanel
131
+
132
+ local errors = {}
133
+ local selectedError
134
+ local errorRows = {}
135
+ page.errorRows = errorRows
136
+ local scope = "current"
137
+ local confirmClear = false
138
+ local callbackOwner = {}
139
+ local callbackRegistered = false
140
+ local refreshQueued = false
141
+ local pageActive = false
142
+
143
+ local function ResetClearConfirm()
144
+ confirmClear = false
145
+ W.SetButtonText(clearButton, L.CLEAR_ERRORS)
146
+ W.SetButtonVariant(clearButton, "secondary")
147
+ end
148
+
149
+ local function ApplyErrorRowStyle(row)
150
+ local selected = row.errorEntry == selectedError
151
+ W.SetListRowState(row, selected, row.isHovered)
152
+ end
153
+
154
+ local RefreshErrors
155
+ local RefreshErrorsFromSource
156
+
157
+ local function CreateErrorRow(index)
158
+ local row = W.CreateListRow(errorContent, ERROR_ROW_HEIGHT)
159
+ row:SetWidth(ERROR_LIST_WIDTH - 26)
160
+ local message = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
161
+ message:SetPoint("TOPLEFT", 9, -6)
162
+ message:SetPoint("TOPRIGHT", -54, -6)
163
+ message:SetJustifyH("LEFT")
164
+ message:SetWordWrap(false)
165
+ row.message = message
166
+ local count = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
167
+ count:SetPoint("TOPRIGHT", -9, -6)
168
+ count:SetTextColor(1, 1, 1, 0.42)
169
+ row.count = count
170
+ local metadata = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
171
+ metadata:SetPoint("BOTTOMLEFT", 9, 5)
172
+ metadata:SetPoint("BOTTOMRIGHT", -9, 5)
173
+ metadata:SetJustifyH("LEFT")
174
+ metadata:SetWordWrap(false)
175
+ metadata:SetTextColor(1, 1, 1, 0.34)
176
+ row.metadata = metadata
177
+ row:SetScript("OnEnter", function(self)
178
+ self.isHovered = true
179
+ ApplyErrorRowStyle(self)
180
+ end)
181
+ row:SetScript("OnLeave", function(self)
182
+ self.isHovered = nil
183
+ ApplyErrorRowStyle(self)
184
+ end)
185
+ row:SetScript("OnClick", function(self)
186
+ selectedError = self.errorEntry
187
+ W.SetReadOnlyText(reportPanel, ns.Diagnostics.FormatAgentReport(selectedError))
188
+ RefreshErrors()
189
+ end)
190
+ errorRows[index] = row
191
+ return row
192
+ end
193
+
194
+ RefreshErrors = function()
195
+ for index = 1, #errorRows do
196
+ errorRows[index]:Hide()
197
+ end
198
+ local offset = errorScroll:GetVerticalScroll()
199
+ if issecretvalue and issecretvalue(offset) then
200
+ offset = 0
201
+ end
202
+ local first = math.floor((offset or 0) / ERROR_ROW_HEIGHT) + 1
203
+ local last = math.min(#errors, first + VISIBLE_ROWS - 1)
204
+ local pool = 0
205
+ for itemIndex = first, last do
206
+ pool = pool + 1
207
+ local entry = errors[itemIndex]
208
+ local row = errorRows[pool] or CreateErrorRow(pool)
209
+ row.errorEntry = entry
210
+ row:ClearAllPoints()
211
+ row:SetPoint("TOPLEFT", 0, -((itemIndex - 1) * ERROR_ROW_HEIGHT))
212
+ row.message:SetText(ns.Diagnostics.SafeText(entry.message):match("([^\r\n]+)") or L.UNKNOWN_ERROR)
213
+ row.count:SetText("x" .. (SafeNumber(entry.counter) or 1))
214
+ row.metadata:SetText(string.format(L.ERROR_ROW_META,
215
+ SafeNumber(entry.session) or -1,
216
+ SafeNumber(entry.time) and date("%m-%d %H:%M:%S", SafeNumber(entry.time)) or L.UNKNOWN_TIME))
217
+ ApplyErrorRowStyle(row)
218
+ row:Show()
219
+ end
220
+ errorContent:SetHeight(math.max(1, #errors * ERROR_ROW_HEIGHT))
221
+ errorScroll:UpdateScrollChildRect()
222
+ errorEmpty:SetShown(#errors == 0)
223
+ W.SetButtonEnabled(clearButton, #errors > 0)
224
+ W.SetButtonEnabled(selectReport, selectedError ~= nil)
225
+ W.SetButtonEnabled(exportReport, #errors > 0)
226
+ end
227
+
228
+ RefreshErrorsFromSource = function()
229
+ ResetClearConfirm()
230
+ local succeeded, snapshot, errorMessage = ns.Diagnostics.GetErrors(scope, searchPanel.editBox:GetText())
231
+ if not succeeded then
232
+ errors = {}
233
+ selectedError = nil
234
+ SetStatus(errorMessage, true)
235
+ RefreshErrors()
236
+ return
237
+ end
238
+ errors = snapshot.errors
239
+ selectedError = nil
240
+ W.SetReadOnlyText(reportPanel, L.SELECT_ERROR_DETAIL)
241
+ SetStatus(string.format(scope == "current" and L.CURRENT_ERRORS_STATUS or L.ALL_ERRORS_STATUS, #errors), false)
242
+ RefreshErrors()
243
+ end
244
+
245
+ local function SetScope(newScope)
246
+ scope = newScope
247
+ W.SetButtonVariant(currentScope, scope == "current" and "selected" or "secondary")
248
+ W.SetButtonVariant(allScope, scope == "all" and "selected" or "secondary")
249
+ RefreshErrorsFromSource()
250
+ end
251
+
252
+ local function QueueErrorRefresh()
253
+ if refreshQueued then
254
+ return
255
+ end
256
+ refreshQueued = true
257
+ C_Timer.After(0, function()
258
+ refreshQueued = false
259
+ if pageActive then
260
+ RefreshErrorsFromSource()
261
+ end
262
+ end)
263
+ end
264
+
265
+ local function RegisterErrorCallback()
266
+ if callbackRegistered or not EventRegistry then
267
+ return
268
+ end
269
+ EventRegistry:RegisterCallback("BugGrabber.BugGrabbed", QueueErrorRefresh, callbackOwner)
270
+ callbackRegistered = true
271
+ end
272
+
273
+ local function UnregisterErrorCallback()
274
+ if not callbackRegistered or not EventRegistry then
275
+ return
276
+ end
277
+ EventRegistry:UnregisterCallback("BugGrabber.BugGrabbed", callbackOwner)
278
+ callbackRegistered = false
279
+ end
280
+
281
+ errorScroll.onVerticalScrollChanged = function()
282
+ RefreshErrors()
283
+ end
284
+ currentScope:SetScript("OnClick", function()
285
+ SetScope("current")
286
+ end)
287
+ allScope:SetScript("OnClick", function()
288
+ SetScope("all")
289
+ end)
290
+ searchButton:SetScript("OnClick", RefreshErrorsFromSource)
291
+ searchPanel.editBox:SetScript("OnEnterPressed", RefreshErrorsFromSource)
292
+ selectReport:SetScript("OnClick", function()
293
+ if selectedError then
294
+ W.SetReadOnlyText(reportPanel, ns.Diagnostics.FormatAgentReport(selectedError))
295
+ W.SelectAllText(reportPanel)
296
+ else
297
+ SetStatus(L.SELECT_ERROR_FIRST, true)
298
+ end
299
+ end)
300
+ exportReport:SetScript("OnClick", function()
301
+ if ns.Safety.IsCombatBlocked() then
302
+ ns.Safety.PrintBlocked()
303
+ return
304
+ end
305
+ local kind, title, content, metadata = page.GetErrorLogPayload()
306
+ if not kind then
307
+ SetStatus(L.NO_ERRORS, true)
308
+ return
309
+ end
310
+ ns.Workbench.SaveToDisk(kind, title, content, metadata)
311
+ end)
312
+ refreshButton:SetScript("OnClick", RefreshErrorsFromSource)
313
+
314
+ -- Two-click destructive confirm; the arm state is also announced in the
315
+ -- status line and disarmed by every refresh.
316
+ clearButton:SetScript("OnClick", function()
317
+ if ns.Safety.IsCombatBlocked() then
318
+ ns.Safety.PrintBlocked()
319
+ return
320
+ end
321
+ if not confirmClear then
322
+ confirmClear = true
323
+ W.SetButtonText(clearButton, L.CONFIRM_CLEAR_ERRORS)
324
+ W.SetButtonVariant(clearButton, "danger")
325
+ SetStatus(L.CONFIRM_CLEAR_ERRORS, true)
326
+ return
327
+ end
328
+ ResetClearConfirm()
329
+ local succeeded, message = ns.Diagnostics.ResetErrors()
330
+ SetStatus(message, not succeeded)
331
+ if succeeded then
332
+ RefreshErrorsFromSource()
333
+ end
334
+ end)
335
+
336
+ function page.HandleActivate()
337
+ pageActive = true
338
+ RegisterErrorCallback()
339
+ RefreshErrorsFromSource()
340
+ end
341
+
342
+ -- One payload builder shared by the page Save button and the shell export
343
+ -- hook; both funnel into the single export UI.
344
+ function page.GetErrorLogPayload()
345
+ if #errors == 0 then
346
+ return nil
347
+ end
348
+ local captured = errors
349
+ return "error_log", L.ERROR_LIST, function()
350
+ local text = ns.Serializer.SerializeForExport(captured)
351
+ return text
352
+ end, { scope = scope, query = searchPanel.editBox:GetText(), recordCount = #captured }
353
+ end
354
+
355
+ function page.HandleSuspend()
356
+ pageActive = false
357
+ UnregisterErrorCallback()
358
+ end
359
+
360
+ function page.HandleShutdown()
361
+ pageActive = false
362
+ UnregisterErrorCallback()
363
+ end
364
+
365
+ W.SetButtonEnabled(clearButton, false)
366
+ W.SetButtonEnabled(selectReport, false)
367
+ W.SetButtonEnabled(exportReport, false)
368
+ SetStatus(L.READY, false)
369
+ builtPage = page
370
+ return page
371
+ end
372
+
373
+ ns.Workbench.RegisterPage({
374
+ key = "diagnostics",
375
+ titleKey = "TAB_DIAGNOSTICS",
376
+ build = BuildDiagnosticsPage,
377
+ activate = function(page)
378
+ if page and page.HandleActivate then
379
+ page:HandleActivate()
380
+ end
381
+ end,
382
+ suspend = function(page)
383
+ if page and page.HandleSuspend then
384
+ page:HandleSuspend()
385
+ end
386
+ end,
387
+ shutdown = function(page)
388
+ if page and page.HandleShutdown then
389
+ page:HandleShutdown()
390
+ end
391
+ end,
392
+ })
393
+
394
+ ns.Workbench.RegisterExportHook({
395
+ key = "diagnostics",
396
+ GetPayload = function()
397
+ if not builtPage then
398
+ return nil
399
+ end
400
+ return builtPage.GetErrorLogPayload()
401
+ end,
402
+ })