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
@@ -0,0 +1,52 @@
1
+ ## Interface: 50504
2
+ ## Title: Lychee Dev
3
+ ## Version: 2.0.0
4
+ ## SavedVariables: LycheeToolkitDB
5
+
6
+ Clients\Pandaria.lua
7
+ # --- Toolkit 2.0 core engines (Locale, Compat, Serializer, Inspector, Safety, Execute, Stores) ---
8
+ Core\Locale.lua
9
+ Core\Locale_enUS.lua
10
+ Core\Compat.lua
11
+ Core\Serializer.lua
12
+ Core\Inspector.lua
13
+ Core\Safety.lua
14
+ Core\Execute.lua
15
+ Core\Stores.lua
16
+ Core\Platform.lua
17
+ Core\Persistence.lua
18
+ Bridge\Session.lua
19
+ Core\Controls.lua
20
+ Bridge\CaptureWriter.lua
21
+ Bridge\MatrixSymbol.lua
22
+ Bridge\ReceiptView.lua
23
+ Bridge\ReportStore.lua
24
+ Bridge\ProbeRunner.lua
25
+ Bridge\Definitions.lua
26
+ Modules\AutomationView.lua
27
+ Bridge\ProbeQueue.lua
28
+ Bridge\Reentry.lua
29
+ Bridge\Identity.lua
30
+ # --- Workbench feature modules (object inspection, function trace, diagnostics) ---
31
+ Modules\ObjectInspector.lua
32
+ Modules\FunctionTrace.lua
33
+ Modules\Diagnostics.lua
34
+ # --- Event catalog (per client) and bounded monitor ---
35
+ Modules\Events\CatalogData_Mists.lua
36
+ Modules\Events\Catalog.lua
37
+ Modules\Events\Monitor.lua
38
+ # --- Workbench UI foundation (Widgets, TreeView, Export popup, Window shell) ---
39
+ UI\Widgets.lua
40
+ UI\TreeView.lua
41
+ UI\Export.lua
42
+ UI\Window.lua
43
+ # --- Workbench pages: later page modules insert their load line here ---
44
+ UI\Pages\About.lua
45
+ UI\Pages\Run.lua
46
+ UI\Pages\Object.lua
47
+ UI\Pages\Trace.lua
48
+ UI\Pages\Diagnostics.lua
49
+ UI\Pages\Events.lua
50
+ UI\Pages\Automation.lua
51
+ UI\Pages\ExportRecords.lua
52
+ Core\Runtime.lua
@@ -0,0 +1,52 @@
1
+ ## Interface: 38002
2
+ ## Title: Lychee Dev
3
+ ## Version: 2.0.0
4
+ ## SavedVariables: LycheeToolkitDB
5
+
6
+ Clients\Titan.lua
7
+ # --- Toolkit 2.0 core engines (Locale, Compat, Serializer, Inspector, Safety, Execute, Stores) ---
8
+ Core\Locale.lua
9
+ Core\Locale_enUS.lua
10
+ Core\Compat.lua
11
+ Core\Serializer.lua
12
+ Core\Inspector.lua
13
+ Core\Safety.lua
14
+ Core\Execute.lua
15
+ Core\Stores.lua
16
+ Core\Platform.lua
17
+ Core\Persistence.lua
18
+ Bridge\Session.lua
19
+ Core\Controls.lua
20
+ Bridge\CaptureWriter.lua
21
+ Bridge\MatrixSymbol.lua
22
+ Bridge\ReceiptView.lua
23
+ Bridge\ReportStore.lua
24
+ Bridge\ProbeRunner.lua
25
+ Bridge\Definitions.lua
26
+ Modules\AutomationView.lua
27
+ Bridge\ProbeQueue.lua
28
+ Bridge\Reentry.lua
29
+ Bridge\Identity.lua
30
+ # --- Workbench feature modules (object inspection, function trace, diagnostics) ---
31
+ Modules\ObjectInspector.lua
32
+ Modules\FunctionTrace.lua
33
+ Modules\Diagnostics.lua
34
+ # --- Event catalog (per client) and bounded monitor ---
35
+ Modules\Events\CatalogData_Titan.lua
36
+ Modules\Events\Catalog.lua
37
+ Modules\Events\Monitor.lua
38
+ # --- Workbench UI foundation (Widgets, TreeView, Export popup, Window shell) ---
39
+ UI\Widgets.lua
40
+ UI\TreeView.lua
41
+ UI\Export.lua
42
+ UI\Window.lua
43
+ # --- Workbench pages: later page modules insert their load line here ---
44
+ UI\Pages\About.lua
45
+ UI\Pages\Run.lua
46
+ UI\Pages\Object.lua
47
+ UI\Pages\Trace.lua
48
+ UI\Pages\Diagnostics.lua
49
+ UI\Pages\Events.lua
50
+ UI\Pages\Automation.lua
51
+ UI\Pages\ExportRecords.lua
52
+ Core\Runtime.lua
@@ -0,0 +1,393 @@
1
+ local ADDON_NAME, ns = ...
2
+
3
+ -- View-model for the workbench Automation page. It is a bounded, session-only
4
+ -- observation list over the SAME game-side probe machinery the CLI drives
5
+ -- (ns.ProbeQueue / ns.ProbeRunner / ns.ReportStore). There is no second
6
+ -- executor and no task registry here: every status is derived from the bridge
7
+ -- records, and Execute routes through ProbeQueue.Load + ProbeRunner.Dispatch,
8
+ -- the exact functions the /dev bridge verbs call.
9
+ --
10
+ -- Real status vocabulary (derived from the bridge surface):
11
+ -- queued lycheedev.queue.v1 entry registered, nothing loaded yet
12
+ -- loaded ProbeRunner retains the request (its internal loaded /
13
+ -- running / unresolved states are not externally separable)
14
+ -- reported ReportStore retains the report (awaiting acknowledgement)
15
+ -- acknowledged report acknowledged and removed (acknowledge lifecycle done)
16
+ -- cleared retired: no queue entry, no runner request, no report
17
+ -- unavailable derivation failed; errorCode carries the bridge error code
18
+ local MAX_RECORDS = 200
19
+ local REPORT_DISPLAY_BYTES = 48 * 1024
20
+ local KIND_LUA = "lua"
21
+
22
+ -- Captured before Bridge/ProbeQueue.lua takes ownership of the table (see the
23
+ -- TOC order note). Strictly read-only: used to list queued request ids and
24
+ -- their code digests. When nil (different load order or bridge), the list can
25
+ -- only show report-backed history and says so through HasQueueRegistry().
26
+ local queueDefinitions = ns.ProbeDefinitions
27
+
28
+ local records = {}
29
+ local recordIndex = {}
30
+ local observedSequence = 0
31
+
32
+ local function Restricted(value)
33
+ return issecretvalue and issecretvalue(value)
34
+ end
35
+
36
+ local function RequestId(value)
37
+ return not Restricted(value) and type(value) == "string"
38
+ and #value > 0 and #value <= 128
39
+ and string.match(value, "^[%w_%-]+$") ~= nil
40
+ end
41
+
42
+ local function BoundedText(value, limit)
43
+ if Restricted(value) or type(value) ~= "string" then
44
+ return nil
45
+ end
46
+ if #value > limit then
47
+ return value:sub(1, limit)
48
+ end
49
+ return value
50
+ end
51
+
52
+ -- Display-only bounded pattern reads over stored report/receipt text. Nothing
53
+ -- is evaluated or rewritten; the stored bodies stay byte-identical.
54
+ local function ReadSignalField(receipt, pattern)
55
+ if Restricted(receipt) or type(receipt) ~= "string" then
56
+ return nil
57
+ end
58
+ return string.match(receipt, pattern)
59
+ end
60
+
61
+ local function IsPending(record)
62
+ return record.pending == true or record.hasReport == true
63
+ end
64
+
65
+ local function IsProtected(record)
66
+ return record.protected == true
67
+ end
68
+
69
+ local function PruneRecordSlot()
70
+ if #records < MAX_RECORDS then
71
+ return true
72
+ end
73
+ for index = 1, #records do
74
+ local record = records[index]
75
+ if not IsProtected(record) and not IsPending(record) then
76
+ table.remove(records, index)
77
+ recordIndex[record.requestId] = nil
78
+ return true
79
+ end
80
+ end
81
+ return false
82
+ end
83
+
84
+ local function ReportRead(requestId)
85
+ if not ns.ReportStore or type(ns.ReportStore.Read) ~= "function" then
86
+ return nil, "bridge_unavailable"
87
+ end
88
+ return ns.ReportStore.Read(requestId)
89
+ end
90
+
91
+ -- Side-effect-free status derivation from the bridge records only.
92
+ local function DeriveStatus(requestId)
93
+ local receipt, bodyOrReason = ReportRead(requestId)
94
+ if receipt then
95
+ return "reported", nil, receipt, bodyOrReason
96
+ end
97
+ if bodyOrReason ~= "report_unavailable" then
98
+ return "unavailable", bodyOrReason
99
+ end
100
+
101
+ if ns.ReportStore and type(ns.ReportStore.Acknowledged) == "function" then
102
+ local acknowledged = ns.ReportStore.Acknowledged(requestId)
103
+ if acknowledged then
104
+ return "acknowledged", nil, acknowledged
105
+ end
106
+ end
107
+
108
+ if not ns.ProbeRunner or type(ns.ProbeRunner.Reported) ~= "function"
109
+ or type(ns.ProbeRunner.VerifyAbsent) ~= "function" then
110
+ return "unavailable", "bridge_unavailable"
111
+ end
112
+ local reportedReceipt, reportedReason = ns.ProbeRunner.Reported(requestId)
113
+ if reportedReceipt then
114
+ return "reported", nil, reportedReceipt
115
+ end
116
+ if reportedReason == "report_unavailable" then
117
+ -- Runner reported once and the report was acknowledged away.
118
+ return "acknowledged"
119
+ elseif reportedReason ~= "probe_not_reported" then
120
+ return "unavailable", reportedReason
121
+ end
122
+
123
+ local absent, probeReason = ns.ProbeRunner.VerifyAbsent(requestId)
124
+ if absent == true then
125
+ if not ns.ProbeQueue or type(ns.ProbeQueue.ReloadScope) ~= "function" then
126
+ return "unavailable", "bridge_unavailable"
127
+ end
128
+ local scope, scopeReason = ns.ProbeQueue.ReloadScope(requestId)
129
+ if scope then
130
+ return "queued"
131
+ elseif scopeReason == "queue_request_missing" then
132
+ return "cleared"
133
+ end
134
+ return "unavailable", scopeReason
135
+ elseif probeReason == "probe_still_retained" then
136
+ return "loaded"
137
+ end
138
+ return "unavailable", probeReason
139
+ end
140
+
141
+ local function ApplyDerived(record)
142
+ record.status, record.errorCode = nil, nil
143
+ record.receipt, record.reportBody, record.hasReport = nil, nil, nil
144
+ record.probeStatus, record.probeError = nil, nil
145
+
146
+ local status, errorCode, receipt, body = DeriveStatus(record.requestId)
147
+ record.status = status
148
+ record.errorCode = errorCode
149
+ if receipt then
150
+ record.receipt = receipt
151
+ record.hasReport = status == "reported" and true or nil
152
+ record.signalKind = ReadSignalField(receipt, '"kind":"(%a+)"')
153
+ local sequence = ReadSignalField(receipt, '"sequence":(%d+)')
154
+ record.sequence = sequence and tonumber(sequence) or nil
155
+ if record.codeBytes == nil then
156
+ local codeBytes = ReadSignalField(receipt, '"codeBytes":(%d+)')
157
+ record.codeBytes = codeBytes and tonumber(codeBytes) or nil
158
+ end
159
+ if record.codeAdler32 == nil then
160
+ record.codeAdler32 = ReadSignalField(receipt, '"codeAdler32":"([0-9a-f]+)"')
161
+ end
162
+ end
163
+ if status == "reported" and type(body) == "string" and not Restricted(body) then
164
+ record.reportBody = body
165
+ record.probeStatus = string.match(body, '"probeStatus":"(%a+)"')
166
+ record.probeError = BoundedText(string.match(body, '"error":"([^"]*)"'), 128)
167
+ end
168
+ return record
169
+ end
170
+
171
+ local function Observe(incoming)
172
+ if type(incoming) ~= "table" or not RequestId(incoming.requestId) then
173
+ return nil, "auto_invalid_request"
174
+ end
175
+ local requestId = incoming.requestId
176
+ local record = recordIndex[requestId]
177
+ if not record then
178
+ if not PruneRecordSlot() then
179
+ return nil, "auto_record_limit"
180
+ end
181
+ observedSequence = observedSequence + 1
182
+ record = { requestId = requestId, observedSeq = observedSequence }
183
+ records[#records + 1] = record
184
+ recordIndex[requestId] = record
185
+ end
186
+ for key, value in pairs(incoming) do
187
+ if key ~= "requestId" and key ~= "observedSeq" then
188
+ record[key] = value
189
+ end
190
+ end
191
+ if type(record.observedAt) ~= "number" then
192
+ record.observedAt = (time and time()) or 0
193
+ end
194
+ if type(record.kind) ~= "string" then
195
+ record.kind = KIND_LUA
196
+ end
197
+ return record
198
+ end
199
+
200
+ local function Collect()
201
+ if not ns.ProbeQueue and not ns.ReportStore and not ns.Persistence then
202
+ return 0
203
+ end
204
+
205
+ local discovered, seen = {}, {}
206
+ local entries
207
+ if type(queueDefinitions) == "table" and not Restricted(queueDefinitions) then
208
+ entries = queueDefinitions.entries
209
+ if type(entries) == "table" and not Restricted(entries) then
210
+ for id in pairs(entries) do
211
+ if RequestId(id) and not seen[id] then
212
+ seen[id] = true
213
+ discovered[#discovered + 1] = id
214
+ end
215
+ end
216
+ end
217
+ end
218
+
219
+ local state
220
+ if ns.Persistence and type(ns.Persistence.Current) == "function" then
221
+ state = ns.Persistence.Current()
222
+ end
223
+ if type(state) == "table" and not Restricted(state) then
224
+ local reports = state.reports
225
+ if type(reports) == "table" and not Restricted(reports) then
226
+ for id in pairs(reports) do
227
+ if RequestId(id) and not seen[id] then
228
+ seen[id] = true
229
+ discovered[#discovered + 1] = id
230
+ end
231
+ end
232
+ end
233
+ local ticket = state.reentry
234
+ if type(ticket) == "table" and not Restricted(ticket) and RequestId(ticket.requestId)
235
+ and not seen[ticket.requestId] then
236
+ seen[ticket.requestId] = true
237
+ discovered[#discovered + 1] = ticket.requestId
238
+ end
239
+ end
240
+
241
+ -- Deterministic within one pass; across passes later-observed ids are
242
+ -- newer (they get the higher observation sequence).
243
+ table.sort(discovered)
244
+ for index = 1, #discovered do
245
+ local requestId = discovered[index]
246
+ local record = recordIndex[requestId]
247
+ if not record then
248
+ record = Observe({ requestId = requestId })
249
+ end
250
+ if record then
251
+ local entry = entries and entries[requestId] or nil
252
+ if type(entry) == "table" and not Restricted(entry) then
253
+ record.codeBytes = entry.codeBytes
254
+ record.codeSHA256 = entry.codeSHA256
255
+ record.codeAdler32 = entry.codeAdler32
256
+ end
257
+ ApplyDerived(record)
258
+ end
259
+ end
260
+ return #discovered
261
+ end
262
+
263
+ local function GetOrder()
264
+ local order = {}
265
+ for index = #records, 1, -1 do
266
+ order[#order + 1] = records[index].requestId
267
+ end
268
+ return order
269
+ end
270
+
271
+ local function GetRecord(target)
272
+ if type(target) == "table" then
273
+ return target
274
+ end
275
+ return RequestId(target) and recordIndex[target] or nil
276
+ end
277
+
278
+ local function RefreshRecord(target)
279
+ local record = GetRecord(target)
280
+ if not record then
281
+ return nil, "auto_execution_unknown"
282
+ end
283
+ ApplyDerived(record)
284
+ return record
285
+ end
286
+
287
+ -- Manual execute: the same two calls the /dev bridge load/run verbs make, in
288
+ -- the same order. When the bridge or session context is absent the honest
289
+ -- bridge error code is returned instead of inventing one.
290
+ local function Execute(target)
291
+ local record = GetRecord(target)
292
+ if not record then
293
+ return nil, "auto_execution_unknown"
294
+ end
295
+ if not ns.ProbeQueue or type(ns.ProbeQueue.Load) ~= "function"
296
+ or not ns.ProbeRunner or type(ns.ProbeRunner.Dispatch) ~= "function" then
297
+ return nil, "bridge_unavailable"
298
+ end
299
+ local loadReceipt, loadReason = ns.ProbeQueue.Load(record.requestId)
300
+ if not loadReceipt and loadReason ~= "probe_request_exists" then
301
+ return nil, loadReason
302
+ end
303
+ return ns.ProbeRunner.Dispatch(record.requestId)
304
+ end
305
+
306
+ local function ShowNotice(target)
307
+ local record = GetRecord(target)
308
+ if not record then
309
+ return nil, "auto_execution_unknown"
310
+ end
311
+ local receipt = record.receipt
312
+ if not receipt then
313
+ receipt = ReportRead(record.requestId)
314
+ end
315
+ if Restricted(receipt) or type(receipt) ~= "string" or #receipt == 0 then
316
+ return nil, "auto_notice_unavailable"
317
+ end
318
+ if not ns.ReceiptView or type(ns.ReceiptView.Show) ~= "function" then
319
+ return nil, "bridge_unavailable"
320
+ end
321
+ -- Read-only redisplay through the one overlay system.
322
+ return ns.ReceiptView.Show(receipt)
323
+ end
324
+
325
+ local function HideNotice()
326
+ if ns.ReceiptView and type(ns.ReceiptView.Hide) == "function" then
327
+ ns.ReceiptView.Hide()
328
+ end
329
+ return true
330
+ end
331
+
332
+ -- Display text for the report view. The 48 KB display cap only bounds the
333
+ -- returned string; the stored body is never modified.
334
+ local function GetReportText(target)
335
+ local record = GetRecord(target)
336
+ if not record then
337
+ return nil, "auto_execution_unknown"
338
+ end
339
+ local body = record.reportBody
340
+ if body == nil then
341
+ local receipt, stored = ReportRead(record.requestId)
342
+ body = receipt and stored or nil
343
+ end
344
+ if Restricted(body) then
345
+ return "<secret>"
346
+ end
347
+ if type(body) ~= "string" then
348
+ return nil, ns.L.AUTO_NO_REPORT
349
+ end
350
+ if #body > REPORT_DISPLAY_BYTES then
351
+ return body:sub(1, REPORT_DISPLAY_BYTES)
352
+ .. "\n... " .. string.format(ns.L.AUTO_REPORT_DISPLAY_LIMIT, REPORT_DISPLAY_BYTES / 1024)
353
+ end
354
+ return body
355
+ end
356
+
357
+ -- Mirrors ns.Stores protection semantics and the ReportStore acknowledge
358
+ -- lifecycle: records that are protected, or pending (a report the store still
359
+ -- retains), survive the clear.
360
+ local function ClearRecords()
361
+ local removed = 0
362
+ for index = #records, 1, -1 do
363
+ local record = records[index]
364
+ if not IsProtected(record) and not IsPending(record) then
365
+ table.remove(records, index)
366
+ recordIndex[record.requestId] = nil
367
+ removed = removed + 1
368
+ end
369
+ end
370
+ return removed
371
+ end
372
+
373
+ ns.AutomationView = {
374
+ MAX_RECORDS = MAX_RECORDS,
375
+ REPORT_DISPLAY_BYTES = REPORT_DISPLAY_BYTES,
376
+ Observe = Observe,
377
+ Collect = Collect,
378
+ GetOrder = GetOrder,
379
+ GetRecord = GetRecord,
380
+ GetCount = function()
381
+ return #records
382
+ end,
383
+ DeriveStatus = DeriveStatus,
384
+ RefreshRecord = RefreshRecord,
385
+ Execute = Execute,
386
+ ShowNotice = ShowNotice,
387
+ HideNotice = HideNotice,
388
+ GetReportText = GetReportText,
389
+ ClearRecords = ClearRecords,
390
+ HasQueueRegistry = function()
391
+ return type(queueDefinitions) == "table" and type(queueDefinitions.entries) == "table"
392
+ end,
393
+ }