lycheedev 3.1.2 → 3.2.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 (77) hide show
  1. package/README.md +16 -38
  2. package/THIRD_PARTY_NOTICES +4 -314
  3. package/bin/lycheedev.mjs +1 -1
  4. package/bin/update.mjs +26 -32
  5. package/native/windows-amd64/lycheedev.exe +0 -0
  6. package/package.json +1 -1
  7. package/payload/addon/Bindings.xml +12 -0
  8. package/payload/addon/Bridge/ActivityView.lua +2 -5
  9. package/payload/addon/Bridge/CaptureWriter.lua +9 -115
  10. package/payload/addon/Bridge/FocusBindings.lua +71 -0
  11. package/payload/addon/Bridge/InputProtection.lua +2 -9
  12. package/payload/addon/Bridge/InputState.lua +15 -19
  13. package/payload/addon/Bridge/MemoryProtocol.lua +1 -1
  14. package/payload/addon/Bridge/ProbeExecution.lua +1 -0
  15. package/payload/addon/Bridge/ReceiverBindings.lua +73 -279
  16. package/payload/addon/Bridge/SlotProtocol.lua +30 -12
  17. package/payload/addon/Bridge/SlotRuntime.lua +9 -12
  18. package/payload/addon/Core/ClientGate.lua +2 -0
  19. package/payload/addon/Core/Compat.lua +25 -24
  20. package/payload/addon/Core/Controls.lua +27 -248
  21. package/payload/addon/Core/Execute.lua +22 -19
  22. package/payload/addon/Core/Locale.lua +4 -116
  23. package/payload/addon/Core/Locale_enUS.lua +4 -116
  24. package/payload/addon/Core/Persistence.lua +2 -2
  25. package/payload/addon/Core/Runtime.lua +46 -64
  26. package/payload/addon/Core/Serializer.lua +9 -1
  27. package/payload/addon/Core/Startup.lua +20 -0
  28. package/payload/addon/Core/Stores.lua +63 -95
  29. package/payload/addon/LICENSE +21 -0
  30. package/payload/addon/Lychee Dev.toc +10 -21
  31. package/payload/addon/Modules/AutomationView.lua +47 -383
  32. package/payload/addon/Modules/Diagnostics.lua +0 -4
  33. package/payload/addon/Modules/Events/Catalog.lua +1 -1
  34. package/payload/addon/Modules/Events/CatalogData_Anniversary.lua +1489 -0
  35. package/payload/addon/Modules/Events/CatalogData_Era.lua +1489 -0
  36. package/payload/addon/Modules/FunctionTrace.lua +17 -6
  37. package/payload/addon/Modules/ObjectInspector.lua +27 -25
  38. package/payload/addon/THIRD_PARTY_NOTICES +483 -0
  39. package/payload/addon/UI/Pages/Automation.lua +7 -64
  40. package/payload/addon/UI/Pages/Events.lua +0 -4
  41. package/payload/addon/UI/Pages/ExportRecords.lua +1 -1
  42. package/payload/addon/UI/Pages/Object.lua +5 -4
  43. package/payload/addon/UI/Pages/Run.lua +7 -1
  44. package/payload/addon/UI/TreeView.lua +0 -11
  45. package/payload/addon/UI/Widgets.lua +0 -102
  46. package/payload/addon/UI/Window.lua +0 -6
  47. package/payload/skill/SKILL.md +11 -2
  48. package/payload/skill/references/commands.md +17 -27
  49. package/payload/skill/references/data-hotfix.md +6 -3
  50. package/payload/skill/references/data-investigation.md +5 -2
  51. package/payload/skill/references/data-tables.md +4 -0
  52. package/payload/skill/references/data-targets.md +4 -2
  53. package/payload/skill/references/installation.md +9 -3
  54. package/payload/skill/references/live-investigation.md +14 -6
  55. package/payload/skill/references/live-probes.md +9 -8
  56. package/payload/skill/references/live-recovery.md +67 -43
  57. package/payload/skill/references/live-startup.md +97 -76
  58. package/payload/skill/references/runtime-investigations.md +10 -8
  59. package/payload/skill/references/source-preparation.md +23 -2
  60. package/payload/skill/references/source-research.md +58 -5
  61. package/payload/skill/scripts/lycheedev.mjs +16 -12
  62. package/release.json +136 -176
  63. package/payload/addon/Bridge/Definitions.lua +0 -3
  64. package/payload/addon/Bridge/FaultRunner.lua +0 -44
  65. package/payload/addon/Bridge/Identity.lua +0 -127
  66. package/payload/addon/Bridge/InputProtocol.lua +0 -76
  67. package/payload/addon/Bridge/InputSignal.lua +0 -36
  68. package/payload/addon/Bridge/Investigation.lua +0 -159
  69. package/payload/addon/Bridge/MatrixSymbol.lua +0 -1169
  70. package/payload/addon/Bridge/ProbeQueue.lua +0 -205
  71. package/payload/addon/Bridge/ProbeRunner.lua +0 -349
  72. package/payload/addon/Bridge/ReceiptView.lua +0 -316
  73. package/payload/addon/Bridge/Receiver.lua +0 -326
  74. package/payload/addon/Bridge/Reentry.lua +0 -261
  75. package/payload/addon/Bridge/ReportStore.lua +0 -224
  76. package/payload/addon/Bridge/Session.lua +0 -173
  77. package/payload/addon/Bridge/StartupBeacon.lua +0 -63
@@ -5,6 +5,29 @@ 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
+ CanReload = function()
9
+ if type(IsLoggedIn) ~= "function" or type(InCombatLockdown) ~= "function" then return nil,"input_observation_unavailable" end
10
+ local loggedIn,combat=IsLoggedIn(),InCombatLockdown()
11
+ if issecretvalue and (issecretvalue(loggedIn) or issecretvalue(combat)) then return nil,"input_observation_unavailable" end
12
+ if loggedIn~=true then return nil,"input_not_logged_in" end
13
+ if combat~=false then return nil,"input_combat_lockdown" end
14
+ return true
15
+ end,
16
+ ObserveChatFocus = function(owner, callback)
17
+ if not EventRegistry or type(EventRegistry.RegisterCallback) ~= "function" then return end
18
+ EventRegistry:RegisterCallback("ChatFrame.OnEditBoxFocusGained", callback, owner)
19
+ EventRegistry:RegisterCallback("ChatFrame.OnEditBoxFocusLost", callback, owner)
20
+ end,
21
+ StopObservingChatFocus = function(owner)
22
+ if not EventRegistry or type(EventRegistry.UnregisterCallback) ~= "function" then return end
23
+ EventRegistry:UnregisterCallback("ChatFrame.OnEditBoxFocusGained", owner)
24
+ EventRegistry:UnregisterCallback("ChatFrame.OnEditBoxFocusLost", owner)
25
+ end,
26
+ ReloadUI = function()
27
+ if C_UI and type(C_UI.Reload) == "function" then C_UI.Reload(); return true end
28
+ if type(ReloadUI) == "function" then ReloadUI(); return true end
29
+ return nil, "reload_unavailable"
30
+ end,
8
31
  -- Pinned PlayerScriptDocumentation declares this on Retail/Classic/Titan.
9
32
  InWorld = function()
10
33
  if type(IsPlayerInWorld)~="function" then return nil end
@@ -15,10 +38,11 @@ ns.Compat = {
15
38
  LoadInputSlot = function(name)
16
39
  if type(name)~="string" then return nil,"slot_name_invalid" end
17
40
  local index=tonumber(name:match("^Lychee Dev Slot (%d+)$"))
18
- if not index or index<1 or index>200 or name~=string.format("Lychee Dev Slot %02d",index) then return nil,"slot_name_invalid" end
41
+ if not index or index<1 or index>ns.SlotProtocol.Count or name~=string.format("Lychee Dev Slot %02d",index) then return nil,"slot_name_invalid" end
19
42
  if type(C_AddOns)~="table" or type(C_AddOns.LoadAddOn)~="function" then return nil,"slot_loader_unavailable" end
20
43
  local ok,loaded,reason=pcall(C_AddOns.LoadAddOn,name)
21
44
  if not ok or (issecretvalue and (issecretvalue(loaded) or issecretvalue(reason))) then return nil,"slot_load_failed" end
45
+ if loaded~=true and reason=="DISABLED" then return nil,"slot_addon_disabled" end
22
46
  return loaded==true and true or nil,type(reason)=="string" and reason or "slot_load_failed"
23
47
  end,
24
48
  ReceiverChord = function(key)
@@ -66,27 +90,4 @@ ns.Compat = {
66
90
  end
67
91
  return foci[1]
68
92
  end,
69
-
70
- -- UI units per physical screen pixel, for screen-space overlays. The
71
- -- caller multiplies by a physical-pixel target to get UI units.
72
- --
73
- -- Only the width ratio is trustworthy: GetScreenWidth and the physical
74
- -- width are both display measurements. GetScreenHeight is NOT usable as a
75
- -- fallback, because the engines disagree about what it returns (Retail
76
- -- reports the UIParent height, Classic the display height), so a ratio
77
- -- built from it inflates or shrinks an overlay by a large factor on exactly
78
- -- the clients that lack GetPhysicalScreenSize. When the physical width is
79
- -- unavailable this reports 1: one UI unit per pixel, the neutral answer.
80
- GetPhysicalPixelSize = function()
81
- if GetPhysicalScreenSize and GetScreenWidth then
82
- local succeeded, width = pcall(GetPhysicalScreenSize)
83
- local uiWidth = GetScreenWidth()
84
- if succeeded and not (issecretvalue and (issecretvalue(width) or issecretvalue(uiWidth)))
85
- and type(width) == "number" and width > 0 and width < math.huge
86
- and type(uiWidth) == "number" and uiWidth > 0 and uiWidth < math.huge then
87
- return math.min(uiWidth / width, 1)
88
- end
89
- end
90
- return 1
91
- end,
92
93
  }
@@ -1,260 +1,39 @@
1
1
  local ADDON_NAME, ns = ...
2
-
3
2
  local registered = false
4
- local function restricted(value)
5
- return issecretvalue and issecretvalue(value)
6
- end
7
-
3
+ local function restricted(value) return issecretvalue and issecretvalue(value) end
8
4
  ns.Controls = {
9
5
  Handle = function(message)
10
- if restricted(message) or type(message) ~= "string" or #message > 256 then
11
- return nil, "command_invalid_input"
12
- end
13
- local trimmed = string.match(message, "^%s*(.-)%s*$")
14
- local command = string.lower(trimmed)
15
- local receiverAction, receiverChord = string.match(trimmed, "^receiver%s+bind%s+(%S+)%s+(%S+)$")
16
- if receiverAction then
17
- receiverAction, receiverChord = string.lower(receiverAction), string.upper(receiverChord)
18
- end
19
- local nonce = string.match(command, "^bridge bind ([0-9a-f]+)$")
20
- local identify = string.match(command, "^bridge identify ([0-9a-f]+)$")
21
- local prefix, verb, requestId = string.match(trimmed, "^(%S+)%s+(%S+)%s+([%w_%-]+)$")
22
- local action, reportSequence
23
- local verifyPrefix, verifyVerb, verifyRequest, cleanupNonce = string.match(trimmed, "^(%S+)%s+(%S+)%s+([%w_%-]+)%s+([0-9a-f]+)$")
24
- if verifyPrefix and string.lower(verifyPrefix) == "bridge" and string.lower(verifyVerb) == "verify"
25
- and #verifyRequest <= 128 and #cleanupNonce == 32 then
26
- action, requestId = "verify", verifyRequest
27
- end
28
- if verifyPrefix and string.lower(verifyPrefix)=="bridge" and
29
- (verifyVerb=="observe" or verifyVerb=="finish") and #verifyRequest<=80 and #cleanupNonce==32 then
30
- action,requestId=verifyVerb,verifyRequest
31
- end
32
- if verifyPrefix and string.lower(verifyPrefix) == "bridge" and string.lower(verifyVerb) == "clean"
33
- and #verifyRequest <= 128 and #cleanupNonce == 32 then
34
- action, requestId = "clean", verifyRequest
35
- end
36
- if verifyPrefix and string.lower(verifyPrefix) == "bridge" and string.lower(verifyVerb) == "prepare"
37
- and #verifyRequest <= 128 and #cleanupNonce == 32 then
38
- action, requestId = "prepare", verifyRequest
39
- end
40
- if verifyPrefix and string.lower(verifyPrefix) == "bridge" and string.lower(verifyVerb) == "ack"
41
- and #verifyRequest <= 128 and #cleanupNonce <= 16 and string.match(cleanupNonce, "^[1-9]%d*$") then
42
- action, requestId, reportSequence = "ack", verifyRequest, tonumber(cleanupNonce)
43
- end
44
- if verifyPrefix and string.lower(verifyPrefix) == "bridge" and string.lower(verifyVerb) == "bugs"
45
- and #verifyRequest <= 128 and #cleanupNonce <= 3 and string.match(cleanupNonce,"^%d+$") then
46
- action,requestId,reportSequence="bugs",verifyRequest,tonumber(cleanupNonce)
47
- end
48
- if verifyPrefix and string.lower(verifyPrefix) == "bridge" and string.lower(verifyVerb) == "bugs-ack"
49
- and #verifyRequest <= 128 and #cleanupNonce <= 16 and string.match(cleanupNonce,"^[1-9]%d*$") then
50
- action,requestId,reportSequence="bugs-ack",verifyRequest,tonumber(cleanupNonce)
51
- end
52
- if verifyPrefix and string.lower(verifyPrefix) == "bridge" and string.lower(verifyVerb) == "flush"
53
- and #verifyRequest <= 128 and #cleanupNonce == 32 then
54
- action,requestId="flush",verifyRequest
55
- end
56
- if command == "bridge ready" then action = "ready" end
57
- if command == "bridge hide" then action = "hide" end
58
- local resetNonce = string.match(command, "^bridge reset ([0-9a-f]+)$")
59
- if resetNonce and #resetNonce == 32 then action = "reset" end
60
- if prefix and string.lower(prefix) == "bridge" and #requestId <= 128 then
61
- verb = string.lower(verb)
62
- if verb == "load" or verb == "run" or verb == "reload" then action = verb end
63
- if verb == "refresh" and #requestId == 32 and string.match(requestId,"^[0-9a-f]+$") then action = verb end
64
- end
65
- if command ~= "" and command ~= "status" and command ~= "connect" and command ~= "disconnect" and command ~= "bridge on" and command ~= "bridge off"
66
- and command ~= "bridge unbind" and command ~= "receiver reset"
67
- and not receiverAction and not nonce and not identify and not action then
68
- return nil, "usage: /dev status | connect | disconnect | receiver bind <wake|submit|close> <chord> | receiver reset"
69
- end
70
- if not ns.Startup.ready then return nil, ns.Startup.reason or "addon_not_ready" end
71
- -- Bare /dev toggles the workbench. Everything below keeps the exact
72
- -- status/connect/disconnect/bridge parsing contract.
73
- if command == "" then
74
- local shown, reason = ns.Workbench.Toggle()
75
- if reason then
76
- print("|cffd83b4eLychee Dev:|r " .. tostring(reason))
77
- end
6
+ if restricted(message) or type(message) ~= "string" or #message > 256 then return nil,"command_invalid_input" end
7
+ local command=string.lower(string.match(message,"^%s*(.-)%s*$"))
8
+ if command~="" and command~="status" and command~="connect" and command~="disconnect"
9
+ and command~="bridge on" and command~="bridge off" and command~="receiver reset" then
10
+ if command:match("^bridge ") then return nil,"command_retired: use the memory-slot CLI" end
11
+ return nil,"usage: /dev status | connect | disconnect | receiver reset"
12
+ end
13
+ if not ns.Startup.ready then return nil,ns.Startup.reason or "addon_not_ready" end
14
+ if command=="" then
15
+ local shown,reason=ns.Workbench.Toggle()
16
+ if reason then print("|cffd83b4eLychee Dev:|r "..tostring(reason)) end
78
17
  return true
79
18
  end
80
- local state, failure = ns.Persistence.Current()
81
- if not state then return nil, failure end
82
- if ns.SlotRuntime then
83
- if command=="receiver reset" then
84
- local profile, reason = ns.ReceiverBindings.Reset()
85
- if not profile then return nil, reason end
86
- if ns.InputState then ns.InputState.Refresh() end
87
- return "receiver bindings reset"
88
- elseif command=="connect" or command=="bridge on" then
89
- state.options.bridgeEnabled=true
90
- return ns.SlotRuntime.Start()
91
- elseif command=="disconnect" or command=="bridge off" then
92
- state.options.bridgeEnabled=false
93
- if ns.InputState then ns.InputState.Stop() end
94
- ns.SlotRuntime.Close()
95
- if ns.ActivityView then ns.ActivityView.Stop() end
96
- return true
97
- elseif command=="status" then
98
- return {transport="memory-slot-v1",enabled=ns.Persistence.BridgeEnabled()}
99
- else
100
- return nil,"command_retired: use the memory-slot CLI"
101
- end
102
- end
103
- if command == "receiver reset" then
104
- local profile, reason = ns.ReceiverBindings.Reset()
105
- if not profile then return nil, reason end
19
+ local state,failure=ns.Persistence.Current()
20
+ if not state then return nil,failure end
21
+ if command=="receiver reset" then
22
+ local profile,reason=ns.ReceiverBindings.Reset()
23
+ if not profile then return nil,reason end
24
+ ns.InputState.Refresh()
106
25
  return "receiver bindings reset"
107
- end
108
- if receiverAction then
109
- local profile, reason = ns.ReceiverBindings.Configure(receiverAction, receiverChord)
110
- if not profile then return nil, reason end
111
- return "receiver " .. receiverAction .. " = " .. profile[receiverAction]
112
- end
113
- if command == "connect" then
114
- if not state.options then state.options = {} end
115
- local previous = state.options.bridgeEnabled
116
- state.options.bridgeEnabled = true
117
- local connected, reason = ns.Session.Connect()
118
- if not connected then state.options.bridgeEnabled = previous; return nil, reason end
119
- action = "ready"
120
- end
121
- if identify then
122
- -- Identity markers are session-free and never disturb another
123
- -- operation's displayed receipt: Trigger fails closed when busy.
124
- local receipt, reason = ns.Identity.Trigger(identify)
125
- if not receipt then return nil, reason end
126
- local function refreshIdentity() return ns.Identity.Refresh(identify) end
127
- local shown, displayFailure = ns.ReceiptView.ShowIdentity(receipt, refreshIdentity)
128
- if not shown then return nil, displayFailure end
129
- ns.Identity.WhenInputReady(function(ready)
130
- if not ready then return end
131
- local refreshed, refreshFailure = ns.Identity.Refresh(identify)
132
- if not refreshed then print("Lychee Dev: " .. refreshFailure); return end
133
- local visible, showFailure = ns.ReceiptView.ShowIdentity(refreshed, refreshIdentity)
134
- if not visible then ns.ReceiptView.Hide(); print("Lychee Dev: " .. showFailure) end
135
- end)
136
- return receipt
137
- end
138
- if action == "hide" then
139
- -- Dismissal answers no new receipt: success must not re-display a
140
- -- card or print, otherwise the command would defeat itself.
141
- local dismissed, reason = ns.ReceiptView.Dismiss()
142
- if not dismissed then return nil, reason end
26
+ elseif command=="connect" or command=="bridge on" then
27
+ state.options.bridgeEnabled=true
28
+ return ns.SlotRuntime.Start()
29
+ elseif command=="disconnect" or command=="bridge off" then
30
+ state.options.bridgeEnabled=false
31
+ ns.InputState.Stop()
32
+ ns.SlotRuntime.Close()
33
+ ns.ActivityView.Stop()
143
34
  return true
144
35
  end
145
- if action == "reset" then
146
- -- Recovery trigger, not an operation: the nonce-correlated receipt
147
- -- proves this exact trigger reached a live runtime and unblocked
148
- -- its queue. The card displays session-free, like an identity.
149
- local receipt, reason = ns.ProbeQueue.Reset(resetNonce)
150
- if not receipt then return nil, reason end
151
- local shown, displayFailure = ns.ReceiptView.ShowIdentity(receipt, nil)
152
- if not shown then return nil, displayFailure end
153
- return receipt
154
- end
155
- if action then
156
- if action == "refresh" then return ns.Reentry.Refresh(requestId) end
157
- if action == "prepare" then return ns.Reentry.LoadQueue(requestId, cleanupNonce) end
158
- if action == "clean" then return ns.Reentry.Reload(requestId, cleanupNonce) end
159
- if action == "reload" then return ns.Reentry.Reload(requestId) end
160
- if action == "flush" then return ns.Reentry.Flush(requestId,cleanupNonce) end
161
- if action == "observe" or action == "finish" then
162
- local receipt,reason
163
- if action=="finish" then receipt,reason=ns.Investigation.Finish(requestId,cleanupNonce)
164
- else receipt,reason=ns.Investigation.Observe(requestId,cleanupNonce) end
165
- if not receipt then return nil,reason end
166
- if action=="finish" then return ns.ReceiptView.ShowTransient(receipt,3) end
167
- local function refresh()
168
- local current,failure,signal=ns.Investigation.ReadyReceipt(requestId)
169
- if not current then return nil,failure end
170
- return receipt,current,signal
171
- end
172
- local shown,failure=ns.ReceiptView.Show(receipt,nil,refresh)
173
- if not shown then return nil,failure end
174
- ns.Session.WhenInputReady(function(ready)
175
- if not ready then return end
176
- local current,_,signal=ns.Investigation.ReadyReceipt(requestId)
177
- if current then ns.ReceiptView.Show(receipt,current,refresh,signal) end
178
- end)
179
- return receipt
180
- end
181
- -- Remove the old optical signal before loading or executing work.
182
- -- Preserve request ID case; only command words are case-insensitive.
183
- ns.Session.CancelInputWait()
184
- ns.ReceiptView.Hide()
185
- local receipt, reason
186
- if action == "load" then receipt, reason = ns.ProbeQueue.Load(requestId)
187
- elseif action == "ready" then receipt, reason = ns.Session.ReadyReceipt()
188
- elseif action == "ack" then receipt, reason = ns.ProbeQueue.Acknowledge(requestId, reportSequence)
189
- elseif action == "bugs" then receipt, reason = ns.FaultRunner.Run(requestId,reportSequence)
190
- elseif action == "bugs-ack" then receipt, reason = ns.FaultRunner.Acknowledge(requestId,reportSequence)
191
- elseif action == "verify" then receipt, reason = ns.ProbeQueue.VerifyRetired(requestId, cleanupNonce)
192
- else receipt, reason = ns.ProbeRunner.Dispatch(requestId) end
193
- if not receipt then return nil, reason end
194
- if action == "run" and receipt == true then return true end
195
- local paired = action == "run" or action == "ack" or action == "bugs" or action == "bugs-ack"
196
- local refresh
197
- if paired or action == "ready" or action == "load" then
198
- refresh = function()
199
- if action == "load" then return ns.ProbeRunner.RefreshLoaded(requestId) end
200
- local current, failure, signal = ns.Session.ReadyReceipt()
201
- if not current then return nil, failure end
202
- if paired then return receipt, current, signal end
203
- return current
204
- end
205
- end
206
- local shown, displayFailure = ns.ReceiptView.Show(receipt, nil, refresh)
207
- if not shown then return nil, displayFailure end
208
- if action == "load" or action == "ready" or action == "run" or action == "ack" or action == "bugs" or action == "bugs-ack" then
209
- ns.Session.WhenInputReady(function(ready)
210
- if not ready then return end
211
- local refreshed, refreshFailure, signal
212
- if action == "ready" or action == "run" or action == "ack" or action == "bugs" or action == "bugs-ack" then refreshed, refreshFailure, signal = ns.Session.ReadyReceipt()
213
- else refreshed, refreshFailure = ns.ProbeRunner.RefreshLoaded(requestId) end
214
- if not refreshed then print("Lychee Dev: " .. refreshFailure); return end
215
- local visible, reason
216
- if paired then visible, reason = ns.ReceiptView.Show(receipt, refreshed, refresh, signal)
217
- else visible, reason = ns.ReceiptView.Show(refreshed, nil, refresh) end
218
- if not visible then ns.ReceiptView.Hide(); print("Lychee Dev: " .. reason); return end
219
- if action ~= "run" and action ~= "ack" and action ~= "bugs" and action ~= "bugs-ack" then receipt = refreshed end
220
- end)
221
- end
222
- if command == "connect" then
223
- local active = ns.Session.Current()
224
- return { connected = true, character = active.character, realm = active.realm,
225
- product = ns.Startup.identity.product, build = ns.Startup.identity.build }
226
- end
227
- return receipt
228
- end
229
- if command == "bridge on" or command == "bridge off" or command == "disconnect" then
230
- if not state.options then state.options = {} end
231
- -- Disabled is the default, not a persisted copy of that default.
232
- -- Reports survive opt-out; disabling never acknowledges or deletes.
233
- state.options.bridgeEnabled = command == "bridge on" and true or nil
234
- if command ~= "bridge on" then
235
- if ns.StartupBeacon then ns.StartupBeacon.Stop() end
236
- if ns.Reentry then ns.Reentry.Cancel(true) end
237
- ns.Session.Release(); ns.ReceiptView.Hide()
238
- end
239
- end
240
- if command == "bridge unbind" then
241
- if ns.Reentry then ns.Reentry.Cancel(true) end
242
- ns.Session.Release(); ns.ReceiptView.Hide()
243
- end
244
- if nonce then
245
- local bound, reason = ns.Session.Bind(nonce)
246
- if not bound then return nil, reason end
247
- end
248
- local enabled = state.options and state.options.bridgeEnabled == true or false
249
- local session = ns.Session.Current()
250
- return {
251
- release = ns.Release, product = ns.Startup.identity.product,
252
- build = ns.Startup.identity.build, enabled = enabled,
253
- bound = session ~= nil, session = session,
254
- -- Configuration is not input eligibility. Session binding and the
255
- -- live transport must supply their own observed readiness later.
256
- inputReady = false, reason = enabled and "transport_unavailable" or "bridge_disabled",
257
- }
36
+ return {transport="Lycheedev mailbox protocol v1",enabled=ns.Persistence.BridgeEnabled()}
258
37
  end,
259
38
  Register = function()
260
39
  if registered then return true end
@@ -97,24 +97,27 @@ function ns.Execute(code)
97
97
  local packed = Pack(pcall(chunk))
98
98
  local succeeded = packed[1]
99
99
 
100
- if not succeeded then
101
- AddOutput(output, L.RUNTIME_ERROR .. tostring(packed[2]))
102
- return false, table.concat(output.parts), code
103
- end
104
-
105
- local values = { n = packed.n - 1 }
106
- for index = 2, packed.n do
107
- values[index - 1] = packed[index]
108
- end
109
-
110
- if values.n > 0 then
111
- AddOutput(output, ns.Serializer.SerializeValues(values))
112
- end
113
-
114
- if #output.parts == 0 then
115
- AddOutput(output, L.COMPLETED_NO_OUTPUT)
100
+ local formatted, liveTree, storedTree = pcall(function()
101
+ if not succeeded then
102
+ AddOutput(output, L.RUNTIME_ERROR .. tostring(packed[2]))
103
+ return
104
+ end
105
+ local values = { n = packed.n - 1 }
106
+ for index = 2, packed.n do values[index - 1] = packed[index] end
107
+ if values.n > 0 then AddOutput(output, ns.Serializer.SerializeValues(values)) end
108
+ if #output.parts == 0 then AddOutput(output, L.COMPLETED_NO_OUTPUT) end
109
+ return ns.Inspector.CreateLiveTree(values), ns.Inspector.CreateStoredTree(values)
110
+ end)
111
+ if not formatted then
112
+ -- The chunk already ran. Formatting is a separate boundary and must
113
+ -- never replay it or stringify another untrusted error object.
114
+ local diagnostic = L.RESULT_FORMAT_ERROR
115
+ if type(liveTree) == "string" and not (issecretvalue and issecretvalue(liveTree)) then
116
+ diagnostic = diagnostic .. liveTree:sub(1, 512)
117
+ end
118
+ local captured = table.concat(output.parts)
119
+ local remaining = math.max(0, MAX_CAPTURE_BYTES - #diagnostic - 1)
120
+ return false, captured:sub(1, remaining) .. "\n" .. diagnostic, code
116
121
  end
117
-
118
- return true, table.concat(output.parts), code,
119
- ns.Inspector.CreateLiveTree(values), ns.Inspector.CreateStoredTree(values)
122
+ return succeeded, table.concat(output.parts), code, liveTree, storedTree
120
123
  end