@jshookmcp/jshook 0.2.8 → 0.3.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 (162) hide show
  1. package/README.md +36 -5
  2. package/README.zh.md +36 -5
  3. package/dist/{AntiCheatDetector-S8VRj-dD.mjs → AntiCheatDetector-CqGDXmfc.mjs} +160 -54
  4. package/dist/{CodeInjector-4Z3ngPoX.mjs → CodeInjector-BdjRfNx7.mjs} +5 -5
  5. package/dist/ConsoleMonitor-DykL3IAw.mjs +2269 -0
  6. package/dist/{DarwinAPI-B8hg_yhz.mjs → DarwinAPI-ETyy0xyo.mjs} +1 -1
  7. package/dist/DetailedDataManager-HT49OrvF.mjs +217 -0
  8. package/dist/EventBus-DFKvADm3.mjs +141 -0
  9. package/dist/EvidenceGraphBridge-318Oi0Lf.mjs +153 -0
  10. package/dist/{ExtensionManager-D5-bO9D8.mjs → ExtensionManager-BDMsY2Dz.mjs} +27 -13
  11. package/dist/{FingerprintManager-BVxFJL2-.mjs → FingerprintManager-BN4UQWnX.mjs} +1 -1
  12. package/dist/{HardwareBreakpoint-DK1yjWkV.mjs → HardwareBreakpoint-Cc2AFq1Y.mjs} +3 -3
  13. package/dist/{HeapAnalyzer-CEbo10xU.mjs → HeapAnalyzer-DruMgsgj.mjs} +21 -21
  14. package/dist/HookGeneratorBuilders.core.generators.storage-CTbB4Lcx.mjs +566 -0
  15. package/dist/InstrumentationSession-DLH0vd-z.mjs +244 -0
  16. package/dist/{MemoryController-DdtnBdD4.mjs → MemoryController-CMtviNW_.mjs} +3 -3
  17. package/dist/{MemoryScanSession-RMixN3bX.mjs → MemoryScanSession-ITgb_NMi.mjs} +81 -78
  18. package/dist/{MemoryScanner-QjK4ld0B.mjs → MemoryScanner-CiL7Z3ey.mjs} +50 -21
  19. package/dist/{NativeMemoryManager.impl-CB6gJ0NM.mjs → NativeMemoryManager.impl-D9Lkovvn.mjs} +20 -56
  20. package/dist/{NativeMemoryManager.utils-BML4q1ry.mjs → NativeMemoryManager.utils-BBlAixF5.mjs} +1 -1
  21. package/dist/{PEAnalyzer-CK0xe0Fs.mjs → PEAnalyzer-DMQ44gen.mjs} +16 -16
  22. package/dist/PageController-BPJNqqBN.mjs +431 -0
  23. package/dist/{PointerChainEngine-Cd73qu5b.mjs → PointerChainEngine-K7wN8Z-w.mjs} +10 -7
  24. package/dist/PrerequisiteError-TuyZIs6n.mjs +20 -0
  25. package/dist/ProcessRegistry-zGg12QbE.mjs +74 -0
  26. package/dist/ResponseBuilder-CJXWmWNw.mjs +143 -0
  27. package/dist/ReverseEvidenceGraph-C02-gXOh.mjs +269 -0
  28. package/dist/ScriptManager-ZuWD-0Jg.mjs +3003 -0
  29. package/dist/{Speedhack-CeF0XmEz.mjs → Speedhack-D-z0umeT.mjs} +2 -2
  30. package/dist/{StructureAnalyzer-D4GkMduU.mjs → StructureAnalyzer-Cav5AVSL.mjs} +9 -6
  31. package/dist/ToolCatalog-5OJdMiF0.mjs +582 -0
  32. package/dist/ToolError-jh9whhMd.mjs +15 -0
  33. package/dist/ToolProbe-DbCFGyrg.mjs +45 -0
  34. package/dist/ToolRegistry-B9krbTtI.mjs +180 -0
  35. package/dist/ToolRouter.policy-BGDAGyeH.mjs +344 -0
  36. package/dist/TraceRecorder-B41Z5XBj.mjs +1286 -0
  37. package/dist/{Win32API-Bc0QnQsN.mjs → Win32API-C2kjj0ze.mjs} +19 -13
  38. package/dist/{Win32Debug-DUHt9XUn.mjs → Win32Debug-CKrGOTpo.mjs} +3 -3
  39. package/dist/WorkflowEngine-DJ6M4opp.mjs +569 -0
  40. package/dist/analysis-BHeJW2Nb.mjs +1234 -0
  41. package/dist/antidebug-BRKeyt27.mjs +1081 -0
  42. package/dist/artifactRetention-CPXkUJXp.mjs +598 -0
  43. package/dist/artifacts-DkfosXH3.mjs +59 -0
  44. package/dist/authorization-schema-DRqyJMSk.mjs +31 -0
  45. package/dist/betterSqlite3-DLSBZodi.mjs +74 -0
  46. package/dist/binary-instrument--V3MAhJ4.mjs +971 -0
  47. package/dist/bind-helpers-ClV34xdn.mjs +42 -0
  48. package/dist/boringssl-inspector-Bo_LOLaS.mjs +180 -0
  49. package/dist/browser-Dx3_S2cG.mjs +4369 -0
  50. package/dist/capabilities-CcHlvWgK.mjs +33 -0
  51. package/dist/concurrency-Drev_Vz9.mjs +41 -0
  52. package/dist/{constants-CCvsN80K.mjs → constants-CDZLOoVv.mjs} +105 -48
  53. package/dist/coordination-DgItD9DL.mjs +259 -0
  54. package/dist/debugger-RS3RSAqs.mjs +1288 -0
  55. package/dist/definitions-BEoYofW5.mjs +47 -0
  56. package/dist/definitions-BRaefg3u.mjs +365 -0
  57. package/dist/definitions-BbkvZkiv.mjs +96 -0
  58. package/dist/definitions-BtWSHJ3o.mjs +17 -0
  59. package/dist/definitions-C1gCHO0i.mjs +43 -0
  60. package/dist/definitions-CDOg_b-l.mjs +138 -0
  61. package/dist/definitions-CVPD9hzZ.mjs +54 -0
  62. package/dist/definitions-Cea8Lgl7.mjs +94 -0
  63. package/dist/definitions-DAgIyjxM.mjs +10 -0
  64. package/dist/definitions-DJA27nsL.mjs +66 -0
  65. package/dist/definitions-DKPFU3LW.mjs +25 -0
  66. package/dist/definitions-DPRpZQ96.mjs +47 -0
  67. package/dist/definitions-DUE5gmdn.mjs +18 -0
  68. package/dist/definitions-DYVjOtxa.mjs +26 -0
  69. package/dist/definitions-DcYLVLCo.mjs +37 -0
  70. package/dist/definitions-Pp5LI2H4.mjs +27 -0
  71. package/dist/definitions-j9KdHVNR.mjs +14 -0
  72. package/dist/definitions-uzkjBwa7.mjs +258 -0
  73. package/dist/definitions-va-AnLuQ.mjs +28 -0
  74. package/dist/encoding-DJeqHmpd.mjs +1079 -0
  75. package/dist/evidence-graph-bridge-DcYizFk2.mjs +136 -0
  76. package/dist/{factory-CibqTNC8.mjs → factory-C90tBff6.mjs} +41 -56
  77. package/dist/flat-target-session-Dgax2Cy3.mjs +29 -0
  78. package/dist/graphql-CoHrhweh.mjs +1197 -0
  79. package/dist/handlers-4jmR0nMs.mjs +898 -0
  80. package/dist/handlers-BAHPxcch.mjs +789 -0
  81. package/dist/handlers-BOs9b907.mjs +2600 -0
  82. package/dist/handlers-BWXEy6ef.mjs +917 -0
  83. package/dist/handlers-Bndn6QvE.mjs +111 -0
  84. package/dist/handlers-BqC4bD4s.mjs +681 -0
  85. package/dist/handlers-BtYq60bM2.mjs +276 -0
  86. package/dist/handlers-BzgcB4iv.mjs +799 -0
  87. package/dist/handlers-CRyRWj2b.mjs +859 -0
  88. package/dist/handlers-CVv2H1uq.mjs +592 -0
  89. package/dist/handlers-Dl5a7JS4.mjs +572 -0
  90. package/dist/handlers-Dx2d7jt7.mjs +2537 -0
  91. package/dist/handlers-Dz9PYsCa.mjs +2805 -0
  92. package/dist/handlers-HujRKC3b.mjs +661 -0
  93. package/dist/handlers.impl-XWXkQfyi.mjs +807 -0
  94. package/dist/hooks-B1B8NRHL.mjs +898 -0
  95. package/dist/index.mjs +491 -259
  96. package/dist/{logger-BmWzC2lM.mjs → logger-Dh_xb7_2.mjs} +14 -6
  97. package/dist/maintenance-PRMkLVRW.mjs +835 -0
  98. package/dist/manifest-67Bok-Si.mjs +58 -0
  99. package/dist/manifest-6lNTMZAB2.mjs +87 -0
  100. package/dist/manifest-B2duEHiH.mjs +90 -0
  101. package/dist/manifest-B6EY9Vm8.mjs +57 -0
  102. package/dist/manifest-B6nKSbyY.mjs +95 -0
  103. package/dist/manifest-BL8AQNPF.mjs +106 -0
  104. package/dist/manifest-BSZvJJmV.mjs +47 -0
  105. package/dist/manifest-BU7qzUyX.mjs +418 -0
  106. package/dist/manifest-Bl62e8WK.mjs +49 -0
  107. package/dist/manifest-Bo5cXjdt.mjs +82 -0
  108. package/dist/manifest-BpS4gtUK.mjs +1347 -0
  109. package/dist/manifest-Bv65_e2W.mjs +101 -0
  110. package/dist/manifest-BytNIF4Z.mjs +117 -0
  111. package/dist/manifest-C-xtsjS3.mjs +81 -0
  112. package/dist/manifest-CDYl7OhA.mjs +66 -0
  113. package/dist/manifest-CRZ3xmkD.mjs +61 -0
  114. package/dist/manifest-CoW6u4Tp.mjs +132 -0
  115. package/dist/manifest-Cq5zN_8A.mjs +50 -0
  116. package/dist/manifest-D7YZM_2e.mjs +194 -0
  117. package/dist/manifest-DE_VrAeQ.mjs +314 -0
  118. package/dist/manifest-DGsXSCpT.mjs +39 -0
  119. package/dist/manifest-DJ2vfEuW.mjs +156 -0
  120. package/dist/manifest-DPXDYhEu.mjs +80 -0
  121. package/dist/manifest-Dd4fQb0a.mjs +322 -0
  122. package/dist/manifest-Deq6opGg.mjs +223 -0
  123. package/dist/manifest-DfJTafJK.mjs +37 -0
  124. package/dist/manifest-DgOdgN_j.mjs +50 -0
  125. package/dist/manifest-DlbMW4v4.mjs +47 -0
  126. package/dist/manifest-DmVfbH0w.mjs +374 -0
  127. package/dist/manifest-Dog6Ddjr.mjs +109 -0
  128. package/dist/manifest-DvgU5FWb.mjs +58 -0
  129. package/dist/manifest-HsfDBs7j.mjs +50 -0
  130. package/dist/manifest-I8oQHvCG.mjs +186 -0
  131. package/dist/manifest-NvH_a-av.mjs +786 -0
  132. package/dist/manifest-cEJU1v0Z.mjs +129 -0
  133. package/dist/manifest-wOl5XLB12.mjs +112 -0
  134. package/dist/modules-tZozf0LQ.mjs +10635 -0
  135. package/dist/mojo-ipc-DXNEXEqb.mjs +640 -0
  136. package/dist/network-CPVvwvFg.mjs +3852 -0
  137. package/dist/{artifacts-BbdOMET5.mjs → outputPaths-um7lCRY3.mjs} +219 -216
  138. package/dist/parse-args-B4cY5Vx5.mjs +39 -0
  139. package/dist/platform-CYeFoTWp.mjs +2161 -0
  140. package/dist/process-BTbgcVc6.mjs +1306 -0
  141. package/dist/proxy-r8YN6nP1.mjs +192 -0
  142. package/dist/registry-Bl8ZQW61.mjs +34 -0
  143. package/dist/response-CWhh2aLo.mjs +34 -0
  144. package/dist/server/plugin-api.mjs +2 -2
  145. package/dist/shared-state-board-BoZnSoj-.mjs +586 -0
  146. package/dist/sourcemap-BIDHUVXy.mjs +934 -0
  147. package/dist/ssrf-policy-Dsqd-DTX.mjs +166 -0
  148. package/dist/streaming-Dal6utPp.mjs +725 -0
  149. package/dist/tool-builder-BHJp32mV.mjs +186 -0
  150. package/dist/transform-DRVgGG90.mjs +1011 -0
  151. package/dist/types-Bx92KJfT.mjs +4 -0
  152. package/dist/wasm-BYx5UOeG.mjs +1044 -0
  153. package/dist/webcrack-Be0_FccV.mjs +747 -0
  154. package/dist/workflow-BpuKEtvn.mjs +725 -0
  155. package/package.json +82 -49
  156. package/dist/ExtensionManager-CPTJhHFg.mjs +0 -2
  157. package/dist/ToolCatalog-Bq4V2sbJ.mjs +0 -67201
  158. package/dist/{CacheAdapters-CzFNpD9a.mjs → CacheAdapters-jJFy20G-.mjs} +0 -0
  159. package/dist/{StealthVerifier-BzBCFiwx.mjs → StealthVerifier-BWmPgQsv.mjs} +0 -0
  160. package/dist/{VersionDetector-CNXcvD46.mjs → VersionDetector-K3V4vGsw.mjs} +0 -0
  161. package/dist/{formatAddress-ChCSIRWT.mjs → formatAddress-nnMvEohD.mjs} +0 -0
  162. package/dist/{types-BBjOqye-.mjs → types-DDBWs9UP.mjs} +1 -1
@@ -0,0 +1,1288 @@
1
+ import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
+ import { t as ToolError } from "./ToolError-jh9whhMd.mjs";
3
+ import { a as argString, i as argObject, r as argNumber, t as argBool } from "./parse-args-B4cY5Vx5.mjs";
4
+ import "./definitions-BbkvZkiv.mjs";
5
+ //#region src/server/domains/debugger/handlers/debugger-control.ts
6
+ var DebuggerControlHandlers = class {
7
+ constructor(deps) {
8
+ this.deps = deps;
9
+ }
10
+ async handleDebuggerLifecycle(args) {
11
+ if (args.action === "enable") {
12
+ await this.deps.debuggerManager.init();
13
+ await this.deps.runtimeInspector.init();
14
+ await this.deps.debuggerManager.initAdvancedFeatures(this.deps.runtimeInspector);
15
+ return { content: [{
16
+ type: "text",
17
+ text: JSON.stringify({
18
+ success: true,
19
+ message: "Debugger enabled",
20
+ enabled: this.deps.debuggerManager.isEnabled()
21
+ }, null, 2)
22
+ }] };
23
+ } else {
24
+ await this.deps.debuggerManager.disable();
25
+ await this.deps.runtimeInspector.disable();
26
+ return { content: [{
27
+ type: "text",
28
+ text: JSON.stringify({
29
+ success: true,
30
+ message: "Debugger disabled"
31
+ }, null, 2)
32
+ }] };
33
+ }
34
+ }
35
+ async handleDebuggerPause(_args) {
36
+ await this.deps.debuggerManager.pause();
37
+ try {
38
+ const pausedState = await this.deps.debuggerManager.waitForPaused(500);
39
+ return { content: [{
40
+ type: "text",
41
+ text: JSON.stringify({
42
+ success: true,
43
+ paused: true,
44
+ message: "Execution paused",
45
+ reason: pausedState.reason,
46
+ location: pausedState.callFrames[0]?.location
47
+ }, null, 2)
48
+ }] };
49
+ } catch {
50
+ return { content: [{
51
+ type: "text",
52
+ text: JSON.stringify({
53
+ success: true,
54
+ paused: false,
55
+ message: "Pause requested; no paused event observed yet"
56
+ }, null, 2)
57
+ }] };
58
+ }
59
+ }
60
+ async handleDebuggerResume(_args) {
61
+ const wasPaused = this.deps.debuggerManager.getPausedState() !== null;
62
+ await this.deps.debuggerManager.resume();
63
+ return { content: [{
64
+ type: "text",
65
+ text: JSON.stringify({
66
+ success: true,
67
+ resumed: wasPaused,
68
+ message: wasPaused ? "Execution resumed" : "Resume requested; debugger was not paused"
69
+ }, null, 2)
70
+ }] };
71
+ }
72
+ };
73
+ //#endregion
74
+ //#region src/server/domains/debugger/handlers/debugger-stepping.ts
75
+ var DebuggerSteppingHandlers = class {
76
+ constructor(deps) {
77
+ this.deps = deps;
78
+ }
79
+ async handleDebuggerStepInto(_args) {
80
+ const mgr = this.deps.debuggerManager;
81
+ if (!mgr.isEnabled()) return { content: [{
82
+ type: "text",
83
+ text: JSON.stringify({
84
+ success: false,
85
+ error: "Debugger not enabled",
86
+ hint: "Call debugger_lifecycle({ action: 'enable' })() first to enable the debugger"
87
+ }, null, 2)
88
+ }] };
89
+ if (!mgr.isPaused()) return { content: [{
90
+ type: "text",
91
+ text: JSON.stringify({
92
+ success: false,
93
+ error: "Cannot step while not paused",
94
+ hint: "The debugger must be paused at a breakpoint to perform step operations. Set one with breakpoint({ action: 'set', type: 'code', ... }) or pause with debugger_pause().",
95
+ currentState: "running"
96
+ }, null, 2)
97
+ }] };
98
+ try {
99
+ await mgr.stepInto();
100
+ return { content: [{
101
+ type: "text",
102
+ text: JSON.stringify({
103
+ success: true,
104
+ message: "Stepped into"
105
+ }, null, 2)
106
+ }] };
107
+ } catch (error) {
108
+ const errorMsg = error instanceof Error ? error.message : String(error);
109
+ logger.error(`Step into failed: ${errorMsg}`);
110
+ return { content: [{
111
+ type: "text",
112
+ text: JSON.stringify({
113
+ success: false,
114
+ error: errorMsg
115
+ }, null, 2)
116
+ }] };
117
+ }
118
+ }
119
+ async handleDebuggerStepOver(_args) {
120
+ const mgr = this.deps.debuggerManager;
121
+ if (!mgr.isEnabled()) return { content: [{
122
+ type: "text",
123
+ text: JSON.stringify({
124
+ success: false,
125
+ error: "Debugger not enabled",
126
+ hint: "Call debugger_lifecycle({ action: 'enable' })() first to enable the debugger"
127
+ }, null, 2)
128
+ }] };
129
+ if (!mgr.isPaused()) return { content: [{
130
+ type: "text",
131
+ text: JSON.stringify({
132
+ success: false,
133
+ error: "Cannot step while not paused",
134
+ hint: "The debugger must be paused at a breakpoint to perform step operations. Set one with breakpoint({ action: 'set', type: 'code', ... }) or pause with debugger_pause().",
135
+ currentState: "running"
136
+ }, null, 2)
137
+ }] };
138
+ try {
139
+ await mgr.stepOver();
140
+ return { content: [{
141
+ type: "text",
142
+ text: JSON.stringify({
143
+ success: true,
144
+ message: "Stepped over"
145
+ }, null, 2)
146
+ }] };
147
+ } catch (error) {
148
+ const errorMsg = error instanceof Error ? error.message : String(error);
149
+ logger.error(`Step over failed: ${errorMsg}`);
150
+ return { content: [{
151
+ type: "text",
152
+ text: JSON.stringify({
153
+ success: false,
154
+ error: errorMsg
155
+ }, null, 2)
156
+ }] };
157
+ }
158
+ }
159
+ async handleDebuggerStepOut(_args) {
160
+ const mgr = this.deps.debuggerManager;
161
+ if (!mgr.isEnabled()) return { content: [{
162
+ type: "text",
163
+ text: JSON.stringify({
164
+ success: false,
165
+ error: "Debugger not enabled",
166
+ hint: "Call debugger_lifecycle({ action: 'enable' })() first to enable the debugger"
167
+ }, null, 2)
168
+ }] };
169
+ if (!mgr.isPaused()) return { content: [{
170
+ type: "text",
171
+ text: JSON.stringify({
172
+ success: false,
173
+ error: "Cannot step out while not paused",
174
+ hint: "The debugger must be paused at a breakpoint to perform step out. Set one with breakpoint({ action: 'set', type: 'code', ... }) or pause with debugger_pause().",
175
+ currentState: "running"
176
+ }, null, 2)
177
+ }] };
178
+ try {
179
+ await mgr.stepOut();
180
+ return { content: [{
181
+ type: "text",
182
+ text: JSON.stringify({
183
+ success: true,
184
+ message: "Stepped out"
185
+ }, null, 2)
186
+ }] };
187
+ } catch (error) {
188
+ const errorMsg = error instanceof Error ? error.message : String(error);
189
+ logger.error(`Step out failed: ${errorMsg}`);
190
+ return { content: [{
191
+ type: "text",
192
+ text: JSON.stringify({
193
+ success: false,
194
+ error: errorMsg
195
+ }, null, 2)
196
+ }] };
197
+ }
198
+ }
199
+ };
200
+ //#endregion
201
+ //#region src/server/domains/debugger/handlers/debugger-evaluate.ts
202
+ var DebuggerEvaluateHandlers = class {
203
+ constructor(deps) {
204
+ this.deps = deps;
205
+ }
206
+ async handleDebuggerEvaluate(args) {
207
+ const expression = argString(args, "expression", "");
208
+ const callFrameId = argString(args, "callFrameId");
209
+ const result = await this.deps.runtimeInspector.evaluate(expression, callFrameId);
210
+ return { content: [{
211
+ type: "text",
212
+ text: JSON.stringify({
213
+ success: true,
214
+ expression,
215
+ result
216
+ }, null, 2)
217
+ }] };
218
+ }
219
+ async handleDebuggerEvaluateGlobal(args) {
220
+ const expression = argString(args, "expression", "");
221
+ const result = await this.deps.runtimeInspector.evaluateGlobal(expression);
222
+ return { content: [{
223
+ type: "text",
224
+ text: JSON.stringify({
225
+ success: true,
226
+ expression,
227
+ result
228
+ }, null, 2)
229
+ }] };
230
+ }
231
+ };
232
+ //#endregion
233
+ //#region src/server/domains/debugger/handlers/debugger-state.ts
234
+ var DebuggerStateHandlers = class {
235
+ constructor(deps) {
236
+ this.deps = deps;
237
+ }
238
+ async handleDebuggerWaitForPaused(args) {
239
+ const timeout = argNumber(args, "timeout", 3e4);
240
+ try {
241
+ const pausedState = await this.deps.debuggerManager.waitForPaused(timeout);
242
+ return { content: [{
243
+ type: "text",
244
+ text: JSON.stringify({
245
+ success: true,
246
+ paused: true,
247
+ reason: pausedState.reason,
248
+ location: pausedState.callFrames[0]?.location,
249
+ hitBreakpoints: pausedState.hitBreakpoints
250
+ }, null, 2)
251
+ }] };
252
+ } catch (error) {
253
+ if (error instanceof ToolError) throw error;
254
+ return { content: [{
255
+ type: "text",
256
+ text: JSON.stringify({
257
+ success: false,
258
+ paused: false,
259
+ message: error instanceof Error ? error.message : "Timeout waiting for paused event"
260
+ }, null, 2)
261
+ }] };
262
+ }
263
+ }
264
+ async handleDebuggerGetPausedState(_args) {
265
+ const pausedState = this.deps.debuggerManager.getPausedState();
266
+ if (!pausedState) return { content: [{
267
+ type: "text",
268
+ text: JSON.stringify({
269
+ paused: false,
270
+ message: "Debugger is not paused"
271
+ }, null, 2)
272
+ }] };
273
+ return { content: [{
274
+ type: "text",
275
+ text: JSON.stringify({
276
+ paused: true,
277
+ reason: pausedState.reason,
278
+ frameCount: pausedState.callFrames.length,
279
+ topFrame: {
280
+ functionName: pausedState.callFrames[0]?.functionName,
281
+ location: pausedState.callFrames[0]?.location
282
+ },
283
+ hitBreakpoints: pausedState.hitBreakpoints,
284
+ timestamp: pausedState.timestamp
285
+ }, null, 2)
286
+ }] };
287
+ }
288
+ async handleGetCallStack(_args) {
289
+ const callStack = await this.deps.runtimeInspector.getCallStack();
290
+ if (!callStack) return { content: [{
291
+ type: "text",
292
+ text: JSON.stringify({
293
+ success: false,
294
+ message: "Not in paused state. Set a breakpoint and trigger it first."
295
+ }, null, 2)
296
+ }] };
297
+ return { content: [{
298
+ type: "text",
299
+ text: JSON.stringify({
300
+ success: true,
301
+ callStack: {
302
+ frameCount: callStack.callFrames.length,
303
+ reason: callStack.reason,
304
+ frames: callStack.callFrames.map((frame, index) => ({
305
+ index,
306
+ callFrameId: frame.callFrameId,
307
+ functionName: frame.functionName,
308
+ location: `${frame.location.url}:${frame.location.lineNumber}:${frame.location.columnNumber}`,
309
+ scopeCount: frame.scopeChain.length
310
+ }))
311
+ }
312
+ }, null, 2)
313
+ }] };
314
+ }
315
+ };
316
+ //#endregion
317
+ //#region src/server/domains/debugger/handlers/session-management.ts
318
+ function getErrorMessage$5(error) {
319
+ if (typeof error === "object" && error !== null && "message" in error) {
320
+ const message = error.message;
321
+ if (typeof message === "string" && message.length > 0) return message;
322
+ }
323
+ return String(error);
324
+ }
325
+ var SessionManagementHandlers = class {
326
+ constructor(deps) {
327
+ this.deps = deps;
328
+ }
329
+ async handleSaveSession(args) {
330
+ const filePath = argString(args, "filePath");
331
+ const metadata = argObject(args, "metadata");
332
+ try {
333
+ const savedPath = await this.deps.debuggerManager.saveSession(filePath, metadata);
334
+ return { content: [{
335
+ type: "text",
336
+ text: JSON.stringify({
337
+ success: true,
338
+ message: "Session saved successfully",
339
+ filePath: savedPath,
340
+ breakpointCount: this.deps.debuggerManager.listBreakpoints().length
341
+ }, null, 2)
342
+ }] };
343
+ } catch (error) {
344
+ return { content: [{
345
+ type: "text",
346
+ text: JSON.stringify({
347
+ success: false,
348
+ message: "Failed to save session",
349
+ error: getErrorMessage$5(error)
350
+ }, null, 2)
351
+ }] };
352
+ }
353
+ }
354
+ async handleLoadSession(args) {
355
+ const filePath = argString(args, "filePath");
356
+ const sessionData = argString(args, "sessionData");
357
+ try {
358
+ if (filePath) await this.deps.debuggerManager.loadSessionFromFile(filePath);
359
+ else if (sessionData) await this.deps.debuggerManager.importSession(sessionData);
360
+ else throw new Error("Either filePath or sessionData must be provided");
361
+ return { content: [{
362
+ type: "text",
363
+ text: JSON.stringify({
364
+ success: true,
365
+ message: "Session loaded successfully",
366
+ breakpointCount: this.deps.debuggerManager.listBreakpoints().length,
367
+ pauseOnExceptions: this.deps.debuggerManager.getPauseOnExceptionsState()
368
+ }, null, 2)
369
+ }] };
370
+ } catch (error) {
371
+ return { content: [{
372
+ type: "text",
373
+ text: JSON.stringify({
374
+ success: false,
375
+ message: "Failed to load session",
376
+ error: getErrorMessage$5(error)
377
+ }, null, 2)
378
+ }] };
379
+ }
380
+ }
381
+ async handleExportSession(args) {
382
+ const metadata = argObject(args, "metadata");
383
+ try {
384
+ const session = this.deps.debuggerManager.exportSession(metadata);
385
+ return { content: [{
386
+ type: "text",
387
+ text: JSON.stringify({
388
+ success: true,
389
+ message: "Session exported successfully",
390
+ session
391
+ }, null, 2)
392
+ }] };
393
+ } catch (error) {
394
+ return { content: [{
395
+ type: "text",
396
+ text: JSON.stringify({
397
+ success: false,
398
+ message: "Failed to export session",
399
+ error: getErrorMessage$5(error)
400
+ }, null, 2)
401
+ }] };
402
+ }
403
+ }
404
+ async handleListSessions(_args) {
405
+ try {
406
+ const sessions = await this.deps.debuggerManager.listSavedSessions();
407
+ return { content: [{
408
+ type: "text",
409
+ text: JSON.stringify({
410
+ success: true,
411
+ count: sessions.length,
412
+ sessions: sessions.map((s) => ({
413
+ path: s.path,
414
+ timestamp: s.timestamp,
415
+ date: new Date(s.timestamp).toISOString(),
416
+ metadata: s.metadata
417
+ }))
418
+ }, null, 2)
419
+ }] };
420
+ } catch (error) {
421
+ return { content: [{
422
+ type: "text",
423
+ text: JSON.stringify({
424
+ success: false,
425
+ message: "Failed to list sessions",
426
+ error: getErrorMessage$5(error)
427
+ }, null, 2)
428
+ }] };
429
+ }
430
+ }
431
+ };
432
+ //#endregion
433
+ //#region src/server/domains/debugger/handlers/breakpoint-basic.ts
434
+ var BreakpointBasicHandlers = class {
435
+ constructor(deps) {
436
+ this.deps = deps;
437
+ }
438
+ async handleBreakpointSet(args) {
439
+ const url = argString(args, "url");
440
+ const scriptId = argString(args, "scriptId");
441
+ const lineNumber = argNumber(args, "lineNumber", 0);
442
+ const columnNumber = argNumber(args, "columnNumber");
443
+ const condition = argString(args, "condition");
444
+ let breakpoint;
445
+ if (url) breakpoint = await this.deps.debuggerManager.setBreakpointByUrl({
446
+ url,
447
+ lineNumber,
448
+ columnNumber,
449
+ condition
450
+ });
451
+ else if (scriptId) breakpoint = await this.deps.debuggerManager.setBreakpoint({
452
+ scriptId,
453
+ lineNumber,
454
+ columnNumber,
455
+ condition
456
+ });
457
+ else throw new Error("Either url or scriptId must be provided");
458
+ this.deps.eventBus?.emit("debugger:breakpoint_hit", {
459
+ scriptId: breakpoint.location?.scriptId ?? scriptId ?? "",
460
+ lineNumber: breakpoint.location?.lineNumber ?? lineNumber,
461
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
462
+ });
463
+ return { content: [{
464
+ type: "text",
465
+ text: JSON.stringify({
466
+ success: true,
467
+ breakpoint: {
468
+ breakpointId: breakpoint.breakpointId,
469
+ location: breakpoint.location,
470
+ condition: breakpoint.condition,
471
+ enabled: breakpoint.enabled
472
+ }
473
+ }, null, 2)
474
+ }] };
475
+ }
476
+ async handleBreakpointRemove(args) {
477
+ const breakpointId = argString(args, "breakpointId", "");
478
+ await this.deps.debuggerManager.removeBreakpoint(breakpointId);
479
+ return { content: [{
480
+ type: "text",
481
+ text: JSON.stringify({
482
+ success: true,
483
+ message: `Breakpoint ${breakpointId} removed`
484
+ }, null, 2)
485
+ }] };
486
+ }
487
+ async handleBreakpointList(_args) {
488
+ const breakpoints = this.deps.debuggerManager.listBreakpoints();
489
+ return { content: [{
490
+ type: "text",
491
+ text: JSON.stringify({
492
+ count: breakpoints.length,
493
+ breakpoints: breakpoints.map((bp) => ({
494
+ breakpointId: bp.breakpointId,
495
+ location: bp.location,
496
+ condition: bp.condition,
497
+ enabled: bp.enabled,
498
+ hitCount: bp.hitCount
499
+ }))
500
+ }, null, 2)
501
+ }] };
502
+ }
503
+ };
504
+ //#endregion
505
+ //#region src/server/domains/debugger/handlers/breakpoint-exception.ts
506
+ var BreakpointExceptionHandlers = class {
507
+ constructor(deps) {
508
+ this.deps = deps;
509
+ }
510
+ async handleBreakpointSetOnException(args) {
511
+ const state = argString(args, "state", "none");
512
+ await this.deps.debuggerManager.setPauseOnExceptions(state);
513
+ return { content: [{
514
+ type: "text",
515
+ text: JSON.stringify({
516
+ success: true,
517
+ message: `Pause on exceptions set to: ${state}`,
518
+ state
519
+ }, null, 2)
520
+ }] };
521
+ }
522
+ };
523
+ //#endregion
524
+ //#region src/server/domains/debugger/handlers/xhr-breakpoint.ts
525
+ function hasEnsureAdvancedFeatures$2(manager) {
526
+ return typeof manager.ensureAdvancedFeatures === "function";
527
+ }
528
+ function getErrorMessage$4(error) {
529
+ if (typeof error === "object" && error !== null && "message" in error) {
530
+ const message = error.message;
531
+ if (typeof message === "string" && message.length > 0) return message;
532
+ }
533
+ return String(error);
534
+ }
535
+ var XHRBreakpointHandlers = class {
536
+ constructor(deps) {
537
+ this.deps = deps;
538
+ }
539
+ async ensureAdvancedFeaturesIfSupported() {
540
+ if (hasEnsureAdvancedFeatures$2(this.deps.debuggerManager)) await this.deps.debuggerManager.ensureAdvancedFeatures();
541
+ }
542
+ async handleXHRBreakpointSet(args) {
543
+ try {
544
+ const urlPattern = argString(args, "urlPattern", "");
545
+ await this.ensureAdvancedFeaturesIfSupported();
546
+ const breakpointId = await this.deps.debuggerManager.getXHRManager().setXHRBreakpoint(urlPattern);
547
+ return { content: [{
548
+ type: "text",
549
+ text: JSON.stringify({
550
+ success: true,
551
+ message: "XHR breakpoint set",
552
+ breakpointId,
553
+ urlPattern
554
+ }, null, 2)
555
+ }] };
556
+ } catch (error) {
557
+ return { content: [{
558
+ type: "text",
559
+ text: JSON.stringify({
560
+ success: false,
561
+ message: "Failed to set XHR breakpoint",
562
+ error: getErrorMessage$4(error)
563
+ }, null, 2)
564
+ }] };
565
+ }
566
+ }
567
+ async handleXHRBreakpointRemove(args) {
568
+ try {
569
+ const breakpointId = argString(args, "breakpointId", "");
570
+ await this.ensureAdvancedFeaturesIfSupported();
571
+ const removed = await this.deps.debuggerManager.getXHRManager().removeXHRBreakpoint(breakpointId);
572
+ return { content: [{
573
+ type: "text",
574
+ text: JSON.stringify({
575
+ success: removed,
576
+ message: removed ? "XHR breakpoint removed" : "XHR breakpoint not found",
577
+ breakpointId
578
+ }, null, 2)
579
+ }] };
580
+ } catch (error) {
581
+ return { content: [{
582
+ type: "text",
583
+ text: JSON.stringify({
584
+ success: false,
585
+ message: "Failed to remove XHR breakpoint",
586
+ error: getErrorMessage$4(error)
587
+ }, null, 2)
588
+ }] };
589
+ }
590
+ }
591
+ async handleXHRBreakpointList(_args) {
592
+ try {
593
+ await this.ensureAdvancedFeaturesIfSupported();
594
+ const breakpoints = this.deps.debuggerManager.getXHRManager().getAllXHRBreakpoints();
595
+ return { content: [{
596
+ type: "text",
597
+ text: JSON.stringify({
598
+ success: true,
599
+ message: `Found ${breakpoints.length} XHR breakpoint(s)`,
600
+ breakpoints
601
+ }, null, 2)
602
+ }] };
603
+ } catch (error) {
604
+ return { content: [{
605
+ type: "text",
606
+ text: JSON.stringify({
607
+ success: false,
608
+ message: "Failed to list XHR breakpoints",
609
+ error: getErrorMessage$4(error)
610
+ }, null, 2)
611
+ }] };
612
+ }
613
+ }
614
+ };
615
+ //#endregion
616
+ //#region src/server/domains/debugger/handlers/event-breakpoint.ts
617
+ function hasEnsureAdvancedFeatures$1(manager) {
618
+ return typeof manager.ensureAdvancedFeatures === "function";
619
+ }
620
+ function getErrorMessage$3(error) {
621
+ if (typeof error === "object" && error !== null && "message" in error) {
622
+ const message = error.message;
623
+ if (typeof message === "string" && message.length > 0) return message;
624
+ }
625
+ return String(error);
626
+ }
627
+ var EventBreakpointHandlers = class {
628
+ constructor(deps) {
629
+ this.deps = deps;
630
+ }
631
+ async ensureAdvancedFeaturesIfSupported() {
632
+ if (hasEnsureAdvancedFeatures$1(this.deps.debuggerManager)) await this.deps.debuggerManager.ensureAdvancedFeatures();
633
+ }
634
+ async handleEventBreakpointSet(args) {
635
+ try {
636
+ const eventName = argString(args, "eventName", "");
637
+ const targetName = argString(args, "targetName");
638
+ await this.ensureAdvancedFeaturesIfSupported();
639
+ const breakpointId = await this.deps.debuggerManager.getEventManager().setEventListenerBreakpoint(eventName, targetName);
640
+ return { content: [{
641
+ type: "text",
642
+ text: JSON.stringify({
643
+ success: true,
644
+ message: "Event breakpoint set",
645
+ breakpointId,
646
+ eventName,
647
+ targetName
648
+ }, null, 2)
649
+ }] };
650
+ } catch (error) {
651
+ return { content: [{
652
+ type: "text",
653
+ text: JSON.stringify({
654
+ success: false,
655
+ message: "Failed to set event breakpoint",
656
+ error: getErrorMessage$3(error)
657
+ }, null, 2)
658
+ }] };
659
+ }
660
+ }
661
+ async handleEventBreakpointSetCategory(args) {
662
+ try {
663
+ const category = argString(args, "category", "");
664
+ await this.ensureAdvancedFeaturesIfSupported();
665
+ const eventManager = this.deps.debuggerManager.getEventManager();
666
+ let breakpointIds;
667
+ switch (category) {
668
+ case "mouse":
669
+ breakpointIds = await eventManager.setMouseEventBreakpoints();
670
+ break;
671
+ case "keyboard":
672
+ breakpointIds = await eventManager.setKeyboardEventBreakpoints();
673
+ break;
674
+ case "timer":
675
+ breakpointIds = await eventManager.setTimerEventBreakpoints();
676
+ break;
677
+ case "websocket":
678
+ breakpointIds = await eventManager.setWebSocketEventBreakpoints();
679
+ break;
680
+ default: throw new Error(`Unknown category: ${category}`);
681
+ }
682
+ return { content: [{
683
+ type: "text",
684
+ text: JSON.stringify({
685
+ success: true,
686
+ message: `Set ${breakpointIds.length} ${category} event breakpoint(s)`,
687
+ category,
688
+ breakpointIds
689
+ }, null, 2)
690
+ }] };
691
+ } catch (error) {
692
+ return { content: [{
693
+ type: "text",
694
+ text: JSON.stringify({
695
+ success: false,
696
+ message: "Failed to set event breakpoints",
697
+ error: getErrorMessage$3(error)
698
+ }, null, 2)
699
+ }] };
700
+ }
701
+ }
702
+ async handleEventBreakpointRemove(args) {
703
+ try {
704
+ const breakpointId = argString(args, "breakpointId", "");
705
+ await this.ensureAdvancedFeaturesIfSupported();
706
+ const removed = await this.deps.debuggerManager.getEventManager().removeEventListenerBreakpoint(breakpointId);
707
+ return { content: [{
708
+ type: "text",
709
+ text: JSON.stringify({
710
+ success: removed,
711
+ message: removed ? "Event breakpoint removed" : "Event breakpoint not found",
712
+ breakpointId
713
+ }, null, 2)
714
+ }] };
715
+ } catch (error) {
716
+ return { content: [{
717
+ type: "text",
718
+ text: JSON.stringify({
719
+ success: false,
720
+ message: "Failed to remove event breakpoint",
721
+ error: getErrorMessage$3(error)
722
+ }, null, 2)
723
+ }] };
724
+ }
725
+ }
726
+ async handleEventBreakpointList(_args) {
727
+ try {
728
+ await this.ensureAdvancedFeaturesIfSupported();
729
+ const breakpoints = this.deps.debuggerManager.getEventManager().getAllEventBreakpoints();
730
+ return { content: [{
731
+ type: "text",
732
+ text: JSON.stringify({
733
+ success: true,
734
+ message: `Found ${breakpoints.length} event breakpoint(s)`,
735
+ breakpoints
736
+ }, null, 2)
737
+ }] };
738
+ } catch (error) {
739
+ return { content: [{
740
+ type: "text",
741
+ text: JSON.stringify({
742
+ success: false,
743
+ message: "Failed to list event breakpoints",
744
+ error: getErrorMessage$3(error)
745
+ }, null, 2)
746
+ }] };
747
+ }
748
+ }
749
+ };
750
+ //#endregion
751
+ //#region src/server/domains/debugger/handlers/watch-expressions.ts
752
+ function getErrorMessage$2(error) {
753
+ if (typeof error === "object" && error !== null && "message" in error) {
754
+ const message = error.message;
755
+ if (typeof message === "string" && message.length > 0) return message;
756
+ }
757
+ return String(error);
758
+ }
759
+ var WatchExpressionsHandlers = class {
760
+ constructor(deps) {
761
+ this.deps = deps;
762
+ }
763
+ async handleWatchAdd(args) {
764
+ try {
765
+ const expression = argString(args, "expression", "");
766
+ const name = argString(args, "name");
767
+ const watchId = this.deps.debuggerManager.getWatchManager().addWatch(expression, name);
768
+ return { content: [{
769
+ type: "text",
770
+ text: JSON.stringify({
771
+ success: true,
772
+ message: "Watch expression added",
773
+ watchId,
774
+ expression,
775
+ name: name || expression
776
+ }, null, 2)
777
+ }] };
778
+ } catch (error) {
779
+ return { content: [{
780
+ type: "text",
781
+ text: JSON.stringify({
782
+ success: false,
783
+ message: "Failed to add watch expression",
784
+ error: getErrorMessage$2(error)
785
+ }, null, 2)
786
+ }] };
787
+ }
788
+ }
789
+ async handleWatchRemove(args) {
790
+ try {
791
+ const watchId = argString(args, "watchId", "");
792
+ const removed = this.deps.debuggerManager.getWatchManager().removeWatch(watchId);
793
+ return { content: [{
794
+ type: "text",
795
+ text: JSON.stringify({
796
+ success: removed,
797
+ message: removed ? "Watch expression removed" : "Watch expression not found",
798
+ watchId
799
+ }, null, 2)
800
+ }] };
801
+ } catch (error) {
802
+ return { content: [{
803
+ type: "text",
804
+ text: JSON.stringify({
805
+ success: false,
806
+ message: "Failed to remove watch expression",
807
+ error: getErrorMessage$2(error)
808
+ }, null, 2)
809
+ }] };
810
+ }
811
+ }
812
+ async handleWatchList(_args) {
813
+ try {
814
+ const watches = this.deps.debuggerManager.getWatchManager().getAllWatches();
815
+ return { content: [{
816
+ type: "text",
817
+ text: JSON.stringify({
818
+ success: true,
819
+ message: `Found ${watches.length} watch expression(s)`,
820
+ watches
821
+ }, null, 2)
822
+ }] };
823
+ } catch (error) {
824
+ return { content: [{
825
+ type: "text",
826
+ text: JSON.stringify({
827
+ success: false,
828
+ message: "Failed to list watch expressions",
829
+ error: getErrorMessage$2(error)
830
+ }, null, 2)
831
+ }] };
832
+ }
833
+ }
834
+ async handleWatchEvaluateAll(args) {
835
+ try {
836
+ const callFrameId = argString(args, "callFrameId");
837
+ const results = await this.deps.debuggerManager.getWatchManager().evaluateAll(callFrameId);
838
+ return { content: [{
839
+ type: "text",
840
+ text: JSON.stringify({
841
+ success: true,
842
+ message: `Evaluated ${results.length} watch expression(s)`,
843
+ results
844
+ }, null, 2)
845
+ }] };
846
+ } catch (error) {
847
+ return { content: [{
848
+ type: "text",
849
+ text: JSON.stringify({
850
+ success: false,
851
+ message: "Failed to evaluate watch expressions",
852
+ error: getErrorMessage$2(error)
853
+ }, null, 2)
854
+ }] };
855
+ }
856
+ }
857
+ async handleWatchClearAll(_args) {
858
+ try {
859
+ this.deps.debuggerManager.getWatchManager().clearAll();
860
+ return { content: [{
861
+ type: "text",
862
+ text: JSON.stringify({
863
+ success: true,
864
+ message: "All watch expressions cleared"
865
+ }, null, 2)
866
+ }] };
867
+ } catch (error) {
868
+ return { content: [{
869
+ type: "text",
870
+ text: JSON.stringify({
871
+ success: false,
872
+ message: "Failed to clear watch expressions",
873
+ error: getErrorMessage$2(error)
874
+ }, null, 2)
875
+ }] };
876
+ }
877
+ }
878
+ };
879
+ //#endregion
880
+ //#region src/server/domains/debugger/handlers/scope-inspection.ts
881
+ const getErrorMessage$1 = (error, fallback) => {
882
+ if (error instanceof Error) return error.message;
883
+ if (typeof error === "object" && error !== null && "message" in error) {
884
+ const message = error.message;
885
+ if (typeof message === "string") return message;
886
+ }
887
+ return fallback;
888
+ };
889
+ var ScopeInspectionHandlers = class {
890
+ constructor(deps) {
891
+ this.deps = deps;
892
+ }
893
+ async handleGetScopeVariablesEnhanced(args) {
894
+ const callFrameId = argString(args, "callFrameId");
895
+ const includeObjectProperties = argBool(args, "includeObjectProperties");
896
+ const maxDepth = argNumber(args, "maxDepth");
897
+ const skipErrors = argBool(args, "skipErrors", true);
898
+ try {
899
+ const result = await this.deps.debuggerManager.getScopeVariables({
900
+ callFrameId,
901
+ includeObjectProperties,
902
+ maxDepth,
903
+ skipErrors
904
+ });
905
+ return { content: [{
906
+ type: "text",
907
+ text: JSON.stringify(result, null, 2)
908
+ }] };
909
+ } catch (error) {
910
+ return { content: [{
911
+ type: "text",
912
+ text: JSON.stringify({
913
+ success: false,
914
+ message: getErrorMessage$1(error, "Failed to get scope variables"),
915
+ error: String(error)
916
+ }, null, 2)
917
+ }] };
918
+ }
919
+ }
920
+ async handleGetObjectProperties(args) {
921
+ const objectId = argString(args, "objectId", "");
922
+ if (!objectId) return { content: [{
923
+ type: "text",
924
+ text: JSON.stringify({
925
+ success: false,
926
+ message: "objectId parameter is required"
927
+ }, null, 2)
928
+ }] };
929
+ try {
930
+ const properties = await this.deps.debuggerManager.getObjectPropertiesById(objectId);
931
+ return { content: [{
932
+ type: "text",
933
+ text: JSON.stringify({
934
+ success: true,
935
+ propertyCount: properties.length,
936
+ properties
937
+ }, null, 2)
938
+ }] };
939
+ } catch (error) {
940
+ return { content: [{
941
+ type: "text",
942
+ text: JSON.stringify({
943
+ success: false,
944
+ message: getErrorMessage$1(error, "Failed to get object properties"),
945
+ error: String(error)
946
+ }, null, 2)
947
+ }] };
948
+ }
949
+ }
950
+ };
951
+ //#endregion
952
+ //#region src/server/domains/debugger/handlers/blackbox-handlers.ts
953
+ function hasEnsureAdvancedFeatures(manager) {
954
+ return typeof manager.ensureAdvancedFeatures === "function";
955
+ }
956
+ function getErrorMessage(error) {
957
+ if (typeof error === "object" && error !== null && "message" in error) {
958
+ const message = error.message;
959
+ if (typeof message === "string" && message.length > 0) return message;
960
+ }
961
+ return String(error);
962
+ }
963
+ var BlackboxHandlers = class {
964
+ constructor(deps) {
965
+ this.deps = deps;
966
+ }
967
+ async ensureAdvancedFeaturesIfSupported() {
968
+ if (hasEnsureAdvancedFeatures(this.deps.debuggerManager)) await this.deps.debuggerManager.ensureAdvancedFeatures();
969
+ }
970
+ async getBlackboxManager() {
971
+ await this.ensureAdvancedFeaturesIfSupported();
972
+ return this.deps.debuggerManager.getBlackboxManager();
973
+ }
974
+ async handleBlackboxAdd(args) {
975
+ try {
976
+ const urlPattern = argString(args, "urlPattern", "");
977
+ await (await this.getBlackboxManager()).blackboxByPattern(urlPattern);
978
+ return { content: [{
979
+ type: "text",
980
+ text: JSON.stringify({
981
+ success: true,
982
+ message: "Script pattern blackboxed",
983
+ urlPattern
984
+ }, null, 2)
985
+ }] };
986
+ } catch (error) {
987
+ return { content: [{
988
+ type: "text",
989
+ text: JSON.stringify({
990
+ success: false,
991
+ message: "Failed to add blackbox pattern",
992
+ error: getErrorMessage(error)
993
+ }, null, 2)
994
+ }] };
995
+ }
996
+ }
997
+ async handleBlackboxAddCommon(_args) {
998
+ try {
999
+ await (await this.getBlackboxManager()).blackboxCommonLibraries();
1000
+ return { content: [{
1001
+ type: "text",
1002
+ text: JSON.stringify({
1003
+ success: true,
1004
+ message: "Blackboxed common library patterns"
1005
+ }, null, 2)
1006
+ }] };
1007
+ } catch (error) {
1008
+ return { content: [{
1009
+ type: "text",
1010
+ text: JSON.stringify({
1011
+ success: false,
1012
+ message: "Failed to add common blackbox patterns",
1013
+ error: getErrorMessage(error)
1014
+ }, null, 2)
1015
+ }] };
1016
+ }
1017
+ }
1018
+ async handleBlackboxList(_args) {
1019
+ try {
1020
+ const patterns = (await this.getBlackboxManager()).getAllBlackboxedPatterns();
1021
+ return { content: [{
1022
+ type: "text",
1023
+ text: JSON.stringify({
1024
+ success: true,
1025
+ message: `Found ${patterns.length} blackboxed pattern(s)`,
1026
+ patterns
1027
+ }, null, 2)
1028
+ }] };
1029
+ } catch (error) {
1030
+ return { content: [{
1031
+ type: "text",
1032
+ text: JSON.stringify({
1033
+ success: false,
1034
+ message: "Failed to list blackbox patterns",
1035
+ error: getErrorMessage(error)
1036
+ }, null, 2)
1037
+ }] };
1038
+ }
1039
+ }
1040
+ };
1041
+ //#endregion
1042
+ //#region src/server/domains/debugger/handlers.ts
1043
+ var DebuggerToolHandlers = class {
1044
+ debuggerManager;
1045
+ runtimeInspector;
1046
+ debuggerControl;
1047
+ debuggerStepping;
1048
+ debuggerEvaluate;
1049
+ debuggerState;
1050
+ sessionManagement;
1051
+ breakpointBasic;
1052
+ breakpointException;
1053
+ xhrBreakpoint;
1054
+ eventBreakpoint;
1055
+ watchExpressions;
1056
+ scopeInspection;
1057
+ blackbox;
1058
+ constructor(debuggerManager, runtimeInspector, eventBus) {
1059
+ this.debuggerManager = debuggerManager;
1060
+ this.runtimeInspector = runtimeInspector;
1061
+ const commonDeps = {
1062
+ debuggerManager: this.debuggerManager,
1063
+ runtimeInspector: this.runtimeInspector
1064
+ };
1065
+ this.debuggerControl = new DebuggerControlHandlers(commonDeps);
1066
+ this.debuggerStepping = new DebuggerSteppingHandlers({ debuggerManager: this.debuggerManager });
1067
+ this.debuggerEvaluate = new DebuggerEvaluateHandlers({ runtimeInspector: this.runtimeInspector });
1068
+ this.debuggerState = new DebuggerStateHandlers(commonDeps);
1069
+ this.sessionManagement = new SessionManagementHandlers({ debuggerManager: this.debuggerManager });
1070
+ this.breakpointBasic = new BreakpointBasicHandlers({
1071
+ debuggerManager: this.debuggerManager,
1072
+ eventBus
1073
+ });
1074
+ this.breakpointException = new BreakpointExceptionHandlers({ debuggerManager: this.debuggerManager });
1075
+ this.xhrBreakpoint = new XHRBreakpointHandlers({ debuggerManager: this.debuggerManager });
1076
+ this.eventBreakpoint = new EventBreakpointHandlers({ debuggerManager: this.debuggerManager });
1077
+ this.watchExpressions = new WatchExpressionsHandlers({ debuggerManager: this.debuggerManager });
1078
+ this.scopeInspection = new ScopeInspectionHandlers(commonDeps);
1079
+ this.blackbox = new BlackboxHandlers({ debuggerManager: this.debuggerManager });
1080
+ }
1081
+ async handleDebuggerLifecycle(args) {
1082
+ return this.debuggerControl.handleDebuggerLifecycle(args);
1083
+ }
1084
+ async handleDebuggerPause(args) {
1085
+ return this.debuggerControl.handleDebuggerPause(args);
1086
+ }
1087
+ async handleDebuggerResume(args) {
1088
+ return this.debuggerControl.handleDebuggerResume(args);
1089
+ }
1090
+ async handleDebuggerStepInto(args) {
1091
+ return this.debuggerStepping.handleDebuggerStepInto(args);
1092
+ }
1093
+ async handleDebuggerStepOver(args) {
1094
+ return this.debuggerStepping.handleDebuggerStepOver(args);
1095
+ }
1096
+ async handleDebuggerStepOut(args) {
1097
+ return this.debuggerStepping.handleDebuggerStepOut(args);
1098
+ }
1099
+ async handleDebuggerEvaluate(args) {
1100
+ return this.debuggerEvaluate.handleDebuggerEvaluate(args);
1101
+ }
1102
+ async handleDebuggerEvaluateGlobal(args) {
1103
+ return this.debuggerEvaluate.handleDebuggerEvaluateGlobal(args);
1104
+ }
1105
+ async handleDebuggerWaitForPaused(args) {
1106
+ return this.debuggerState.handleDebuggerWaitForPaused(args);
1107
+ }
1108
+ async handleDebuggerGetPausedState(args) {
1109
+ return this.debuggerState.handleDebuggerGetPausedState(args);
1110
+ }
1111
+ async handleGetCallStack(args) {
1112
+ return this.debuggerState.handleGetCallStack(args);
1113
+ }
1114
+ async handleSaveSession(args) {
1115
+ return this.sessionManagement.handleSaveSession(args);
1116
+ }
1117
+ async handleLoadSession(args) {
1118
+ return this.sessionManagement.handleLoadSession(args);
1119
+ }
1120
+ async handleExportSession(args) {
1121
+ return this.sessionManagement.handleExportSession(args);
1122
+ }
1123
+ async handleListSessions(args) {
1124
+ return this.sessionManagement.handleListSessions(args);
1125
+ }
1126
+ async handleBreakpointSet(args) {
1127
+ return this.breakpointBasic.handleBreakpointSet(args);
1128
+ }
1129
+ async handleBreakpointRemove(args) {
1130
+ return this.breakpointBasic.handleBreakpointRemove(args);
1131
+ }
1132
+ async handleBreakpointList(args) {
1133
+ return this.breakpointBasic.handleBreakpointList(args);
1134
+ }
1135
+ async handleBreakpointSetOnException(args) {
1136
+ return this.breakpointException.handleBreakpointSetOnException(args);
1137
+ }
1138
+ async handleXHRBreakpointSet(args) {
1139
+ return this.xhrBreakpoint.handleXHRBreakpointSet(args);
1140
+ }
1141
+ async handleXHRBreakpointRemove(args) {
1142
+ return this.xhrBreakpoint.handleXHRBreakpointRemove(args);
1143
+ }
1144
+ async handleXHRBreakpointList(args) {
1145
+ return this.xhrBreakpoint.handleXHRBreakpointList(args);
1146
+ }
1147
+ async handleEventBreakpointSet(args) {
1148
+ return this.eventBreakpoint.handleEventBreakpointSet(args);
1149
+ }
1150
+ async handleEventBreakpointSetCategory(args) {
1151
+ return this.eventBreakpoint.handleEventBreakpointSetCategory(args);
1152
+ }
1153
+ async handleEventBreakpointRemove(args) {
1154
+ return this.eventBreakpoint.handleEventBreakpointRemove(args);
1155
+ }
1156
+ async handleEventBreakpointList(args) {
1157
+ return this.eventBreakpoint.handleEventBreakpointList(args);
1158
+ }
1159
+ async handleWatchAdd(args) {
1160
+ return this.watchExpressions.handleWatchAdd(args);
1161
+ }
1162
+ async handleWatchRemove(args) {
1163
+ return this.watchExpressions.handleWatchRemove(args);
1164
+ }
1165
+ async handleWatchList(args) {
1166
+ return this.watchExpressions.handleWatchList(args);
1167
+ }
1168
+ async handleWatchEvaluateAll(args) {
1169
+ return this.watchExpressions.handleWatchEvaluateAll(args);
1170
+ }
1171
+ async handleWatchClearAll(args) {
1172
+ return this.watchExpressions.handleWatchClearAll(args);
1173
+ }
1174
+ async handleGetScopeVariablesEnhanced(args) {
1175
+ return this.scopeInspection.handleGetScopeVariablesEnhanced(args);
1176
+ }
1177
+ async handleGetObjectProperties(args) {
1178
+ return this.scopeInspection.handleGetObjectProperties(args);
1179
+ }
1180
+ async handleBlackboxAdd(args) {
1181
+ return this.blackbox.handleBlackboxAdd(args);
1182
+ }
1183
+ async handleBlackboxAddCommon(args) {
1184
+ return this.blackbox.handleBlackboxAddCommon(args);
1185
+ }
1186
+ async handleBlackboxList(args) {
1187
+ return this.blackbox.handleBlackboxList(args);
1188
+ }
1189
+ /** breakpoint(action, type, ...) — unified breakpoint management */
1190
+ async handleBreakpoint(args) {
1191
+ const action = String(args["action"] ?? "");
1192
+ const type = String(args["type"] ?? "code");
1193
+ switch (type) {
1194
+ case "code":
1195
+ switch (action) {
1196
+ case "set": return this.breakpointBasic.handleBreakpointSet(args);
1197
+ case "remove": return this.breakpointBasic.handleBreakpointRemove(args);
1198
+ case "list": return this.breakpointBasic.handleBreakpointList(args);
1199
+ }
1200
+ break;
1201
+ case "xhr":
1202
+ switch (action) {
1203
+ case "set": return this.xhrBreakpoint.handleXHRBreakpointSet(args);
1204
+ case "remove": return this.xhrBreakpoint.handleXHRBreakpointRemove(args);
1205
+ case "list": return this.xhrBreakpoint.handleXHRBreakpointList(args);
1206
+ }
1207
+ break;
1208
+ case "event":
1209
+ switch (action) {
1210
+ case "set": return this.eventBreakpoint.handleEventBreakpointSet(args);
1211
+ case "remove": return this.eventBreakpoint.handleEventBreakpointRemove(args);
1212
+ case "list": return this.eventBreakpoint.handleEventBreakpointList(args);
1213
+ }
1214
+ break;
1215
+ case "event_category":
1216
+ if (action === "set") return this.eventBreakpoint.handleEventBreakpointSetCategory(args);
1217
+ break;
1218
+ case "exception":
1219
+ if (action === "set") return this.breakpointException.handleBreakpointSetOnException(args);
1220
+ break;
1221
+ }
1222
+ return { content: [{
1223
+ type: "text",
1224
+ text: JSON.stringify({
1225
+ success: false,
1226
+ error: `Invalid breakpoint action/type: ${action}/${type}. Valid types: code, xhr, event, event_category, exception. Valid actions: set, remove, list.`
1227
+ })
1228
+ }] };
1229
+ }
1230
+ /** watch(action) — unified watch expression management */
1231
+ async handleWatch(args) {
1232
+ const action = String(args["action"] ?? "");
1233
+ switch (action) {
1234
+ case "add": return this.watchExpressions.handleWatchAdd(args);
1235
+ case "remove": return this.watchExpressions.handleWatchRemove(args);
1236
+ case "list": return this.watchExpressions.handleWatchList(args);
1237
+ case "evaluate_all": return this.watchExpressions.handleWatchEvaluateAll(args);
1238
+ case "clear_all": return this.watchExpressions.handleWatchClearAll(args);
1239
+ default: return { content: [{
1240
+ type: "text",
1241
+ text: JSON.stringify({
1242
+ success: false,
1243
+ error: `Unknown watch action: ${action}. Valid: add, remove, list, evaluate_all, clear_all`
1244
+ })
1245
+ }] };
1246
+ }
1247
+ }
1248
+ /** debugger_step(direction: 'into'|'over'|'out') */
1249
+ async handleDebuggerStep(args) {
1250
+ const direction = String(args["direction"] ?? "over");
1251
+ switch (direction) {
1252
+ case "into": return this.debuggerStepping.handleDebuggerStepInto(args);
1253
+ case "over": return this.debuggerStepping.handleDebuggerStepOver(args);
1254
+ case "out": return this.debuggerStepping.handleDebuggerStepOut(args);
1255
+ default: return { content: [{
1256
+ type: "text",
1257
+ text: JSON.stringify({
1258
+ success: false,
1259
+ error: `Unknown direction: ${direction}. Valid: into, over, out`
1260
+ })
1261
+ }] };
1262
+ }
1263
+ }
1264
+ /** debugger_evaluate(context: 'frame'|'global') */
1265
+ async handleDebuggerEvaluateDispatch(args) {
1266
+ if (String(args["context"] ?? "frame") === "global") return this.debuggerEvaluate.handleDebuggerEvaluateGlobal(args);
1267
+ return this.debuggerEvaluate.handleDebuggerEvaluate(args);
1268
+ }
1269
+ /** debugger_session(action: 'save'|'load'|'export'|'list') */
1270
+ async handleDebuggerSession(args) {
1271
+ const action = String(args["action"] ?? "");
1272
+ switch (action) {
1273
+ case "save": return this.sessionManagement.handleSaveSession(args);
1274
+ case "load": return this.sessionManagement.handleLoadSession(args);
1275
+ case "export": return this.sessionManagement.handleExportSession(args);
1276
+ case "list": return this.sessionManagement.handleListSessions(args);
1277
+ default: return { content: [{
1278
+ type: "text",
1279
+ text: JSON.stringify({
1280
+ success: false,
1281
+ error: `Unknown action: ${action}. Valid actions: save, load, export, list`
1282
+ })
1283
+ }] };
1284
+ }
1285
+ }
1286
+ };
1287
+ //#endregion
1288
+ export { DebuggerToolHandlers };