@jshookmcp/jshook 0.2.7 → 0.2.9

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