@jshookmcp/jshook 0.2.9 → 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 (187) hide show
  1. package/README.md +2 -2
  2. package/README.zh.md +2 -2
  3. package/dist/{AntiCheatDetector-BNk-EoBt.mjs → AntiCheatDetector-CqGDXmfc.mjs} +159 -53
  4. package/dist/{CodeInjector-Cq8q01kp.mjs → CodeInjector-BdjRfNx7.mjs} +5 -5
  5. package/dist/{ConsoleMonitor-CPVQW1Y-.mjs → ConsoleMonitor-DykL3IAw.mjs} +85 -17
  6. package/dist/{DetailedDataManager-BQQcxh64.mjs → DetailedDataManager-HT49OrvF.mjs} +1 -1
  7. package/dist/{ExtensionManager-CWYgw0YW.mjs → ExtensionManager-BDMsY2Dz.mjs} +15 -8
  8. package/dist/{HardwareBreakpoint-B9gZCdFP.mjs → HardwareBreakpoint-Cc2AFq1Y.mjs} +3 -3
  9. package/dist/{HeapAnalyzer-BLDH0dCv.mjs → HeapAnalyzer-DruMgsgj.mjs} +20 -20
  10. package/dist/{HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs → HookGeneratorBuilders.core.generators.storage-CTbB4Lcx.mjs} +1 -74
  11. package/dist/{InstrumentationSession-CvPC7Jwy.mjs → InstrumentationSession-DLH0vd-z.mjs} +2 -2
  12. package/dist/{MemoryController-CbVdCIJF.mjs → MemoryController-CMtviNW_.mjs} +3 -3
  13. package/dist/{MemoryScanSession-BsDZbLYm.mjs → MemoryScanSession-ITgb_NMi.mjs} +2 -2
  14. package/dist/{MemoryScanner-Bcpml6II.mjs → MemoryScanner-CiL7Z3ey.mjs} +12 -9
  15. package/dist/{NativeMemoryManager.impl-dZtA1ZGn.mjs → NativeMemoryManager.impl-D9Lkovvn.mjs} +13 -10
  16. package/dist/{NativeMemoryManager.utils-B-FjA2mJ.mjs → NativeMemoryManager.utils-BBlAixF5.mjs} +1 -1
  17. package/dist/{PEAnalyzer-D1lzJ_VG.mjs → PEAnalyzer-DMQ44gen.mjs} +15 -15
  18. package/dist/{PageController-Bqm2kZ_X.mjs → PageController-BPJNqqBN.mjs} +18 -4
  19. package/dist/{PointerChainEngine-BOhyVsjx.mjs → PointerChainEngine-K7wN8Z-w.mjs} +10 -7
  20. package/dist/ProcessRegistry-zGg12QbE.mjs +74 -0
  21. package/dist/{ResponseBuilder-D3iFYx2N.mjs → ResponseBuilder-CJXWmWNw.mjs} +10 -10
  22. package/dist/{ScriptManager-aHHq0X7U.mjs → ScriptManager-ZuWD-0Jg.mjs} +195 -192
  23. package/dist/{Speedhack-CqdIFlQl.mjs → Speedhack-D-z0umeT.mjs} +2 -2
  24. package/dist/{StructureAnalyzer-DhFaPvRO.mjs → StructureAnalyzer-Cav5AVSL.mjs} +9 -6
  25. package/dist/{ToolCatalog-C0JGZoOm.mjs → ToolCatalog-5OJdMiF0.mjs} +81 -81
  26. package/dist/{ToolProbe-oC7aPrkv.mjs → ToolProbe-DbCFGyrg.mjs} +1 -1
  27. package/dist/{ToolRegistry-BjaF4oNz.mjs → ToolRegistry-B9krbTtI.mjs} +51 -2
  28. package/dist/{ToolRouter.policy-BWV67ZK-.mjs → ToolRouter.policy-BGDAGyeH.mjs} +60 -20
  29. package/dist/TraceRecorder-B41Z5XBj.mjs +1286 -0
  30. package/dist/{Win32API-CePkipZY.mjs → Win32API-C2kjj0ze.mjs} +18 -12
  31. package/dist/{Win32Debug-BvKs-gxc.mjs → Win32Debug-CKrGOTpo.mjs} +2 -2
  32. package/dist/{WorkflowEngine-CuvkZtWu.mjs → WorkflowEngine-DJ6M4opp.mjs} +226 -255
  33. package/dist/analysis-BHeJW2Nb.mjs +1234 -0
  34. package/dist/{antidebug-CqDTB_uk.mjs → antidebug-BRKeyt27.mjs} +3 -3
  35. package/dist/{artifactRetention-CFEprwPw.mjs → artifactRetention-CPXkUJXp.mjs} +13 -6
  36. package/dist/{artifacts-Bk2-_uPq.mjs → artifacts-DkfosXH3.mjs} +1 -1
  37. package/dist/authorization-schema-DRqyJMSk.mjs +31 -0
  38. package/dist/{binary-instrument-CXfpx6fT.mjs → binary-instrument--V3MAhJ4.mjs} +19 -27
  39. package/dist/bind-helpers-ClV34xdn.mjs +42 -0
  40. package/dist/{boringssl-inspector-BH2D3VKc.mjs → boringssl-inspector-Bo_LOLaS.mjs} +1 -1
  41. package/dist/{browser-BpOr5PEx.mjs → browser-Dx3_S2cG.mjs} +324 -37
  42. package/dist/capabilities-CcHlvWgK.mjs +33 -0
  43. package/dist/{constants-B0OANIBL.mjs → constants-CDZLOoVv.mjs} +18 -3
  44. package/dist/{coordination-qUbyF8KU.mjs → coordination-DgItD9DL.mjs} +2 -2
  45. package/dist/{debugger-gnKxRSN0.mjs → debugger-RS3RSAqs.mjs} +30 -13
  46. package/dist/definitions-BEoYofW5.mjs +47 -0
  47. package/dist/{definitions-bAhHQJq9.mjs → definitions-BRaefg3u.mjs} +11 -5
  48. package/dist/{definitions-DVGfrn7y.mjs → definitions-BbkvZkiv.mjs} +2 -2
  49. package/dist/definitions-BtWSHJ3o.mjs +17 -0
  50. package/dist/{definitions-BMfYXoNC.mjs → definitions-C1gCHO0i.mjs} +1 -1
  51. package/dist/{definitions-C1UvM5Iy.mjs → definitions-CDOg_b-l.mjs} +14 -2
  52. package/dist/definitions-CVPD9hzZ.mjs +54 -0
  53. package/dist/{definitions-Cke7zEb8.mjs → definitions-Cea8Lgl7.mjs} +1 -1
  54. package/dist/definitions-DAgIyjxM.mjs +10 -0
  55. package/dist/{definitions-B4rAvHNZ.mjs → definitions-DJA27nsL.mjs} +12 -9
  56. package/dist/{definitions-ClJLzsJQ.mjs → definitions-DKPFU3LW.mjs} +1 -1
  57. package/dist/{definitions-D3VsGcvz.mjs → definitions-DPRpZQ96.mjs} +7 -7
  58. package/dist/{definitions-B18eyf0B.mjs → definitions-DUE5gmdn.mjs} +1 -1
  59. package/dist/definitions-DYVjOtxa.mjs +26 -0
  60. package/dist/{definitions-BB_4jnmy.mjs → definitions-DcYLVLCo.mjs} +1 -1
  61. package/dist/{definitions-Beid2EB3.mjs → definitions-Pp5LI2H4.mjs} +1 -1
  62. package/dist/definitions-j9KdHVNR.mjs +14 -0
  63. package/dist/definitions-uzkjBwa7.mjs +258 -0
  64. package/dist/{definitions-Cq-zroAU.mjs → definitions-va-AnLuQ.mjs} +4 -4
  65. package/dist/{encoding-Bvz5jLRv.mjs → encoding-DJeqHmpd.mjs} +18 -4
  66. package/dist/{evidence-graph-bridge-C_fv9PuC.mjs → evidence-graph-bridge-DcYizFk2.mjs} +1 -0
  67. package/dist/{factory-DxlGh9Xf.mjs → factory-C90tBff6.mjs} +6 -6
  68. package/dist/flat-target-session-Dgax2Cy3.mjs +29 -0
  69. package/dist/{graphql-DYWzJ29s.mjs → graphql-CoHrhweh.mjs} +205 -34
  70. package/dist/{handlers-C67ktuRN.mjs → handlers-4jmR0nMs.mjs} +220 -32
  71. package/dist/{handlers-DlCJN4Td.mjs → handlers-BAHPxcch.mjs} +122 -90
  72. package/dist/{handlers-9sAbfIg-.mjs → handlers-BOs9b907.mjs} +849 -801
  73. package/dist/{handlers-DxGIq15_2.mjs → handlers-BWXEy6ef.mjs} +16 -16
  74. package/dist/{handlers-tB9Mp9ZK.mjs → handlers-Bndn6QvE.mjs} +31 -4
  75. package/dist/{handlers-CTsDAO6p.mjs → handlers-BqC4bD4s.mjs} +1 -1
  76. package/dist/{handlers-C87g8oCe.mjs → handlers-BtYq60bM2.mjs} +1 -1
  77. package/dist/{handlers-DeLOCd5m.mjs → handlers-BzgcB4iv.mjs} +17 -17
  78. package/dist/{handlers-Cgyg6c0U.mjs → handlers-CRyRWj2b.mjs} +237 -23
  79. package/dist/{handlers-U6L4xhuF.mjs → handlers-CVv2H1uq.mjs} +24 -17
  80. package/dist/{handlers-tiy7EIBp.mjs → handlers-Dl5a7JS4.mjs} +3 -3
  81. package/dist/{handlers-D6j6yka7.mjs → handlers-Dx2d7jt7.mjs} +1893 -1480
  82. package/dist/{handlers-Bl8zkwz1.mjs → handlers-Dz9PYsCa.mjs} +95 -6
  83. package/dist/handlers-HujRKC3b.mjs +661 -0
  84. package/dist/{handlers.impl-DS0d9fUw.mjs → handlers.impl-XWXkQfyi.mjs} +70 -24
  85. package/dist/{hooks-CzCWByww.mjs → hooks-B1B8NRHL.mjs} +3 -3
  86. package/dist/index.mjs +154 -144
  87. package/dist/{maintenance-P7ePRXQC.mjs → maintenance-PRMkLVRW.mjs} +35 -30
  88. package/dist/manifest-67Bok-Si.mjs +58 -0
  89. package/dist/{manifest-B3QVVeBS.mjs → manifest-6lNTMZAB2.mjs} +33 -28
  90. package/dist/manifest-B2duEHiH.mjs +90 -0
  91. package/dist/manifest-B6EY9Vm8.mjs +57 -0
  92. package/dist/{manifest-gZ4s_UtG.mjs → manifest-B6nKSbyY.mjs} +32 -33
  93. package/dist/{manifest-2ToTpjv8.mjs → manifest-BL8AQNPF.mjs} +31 -31
  94. package/dist/{manifest-DzwvxPJX.mjs → manifest-BSZvJJmV.mjs} +23 -14
  95. package/dist/{manifest-Sc_0JQ13.mjs → manifest-BU7qzUyX.mjs} +23 -23
  96. package/dist/{manifest-CT7zZBV1.mjs → manifest-Bl62e8WK.mjs} +24 -23
  97. package/dist/manifest-Bo5cXjdt.mjs +82 -0
  98. package/dist/manifest-BpS4gtUK.mjs +1347 -0
  99. package/dist/manifest-Bv65_e2W.mjs +101 -0
  100. package/dist/manifest-BytNIF4Z.mjs +117 -0
  101. package/dist/{manifest-BqrQ4Tpj.mjs → manifest-C-xtsjS3.mjs} +23 -23
  102. package/dist/{manifest-NXctwWQq.mjs → manifest-CDYl7OhA.mjs} +36 -38
  103. package/dist/manifest-CRZ3xmkD.mjs +61 -0
  104. package/dist/manifest-CoW6u4Tp.mjs +132 -0
  105. package/dist/manifest-Cq5zN_8A.mjs +50 -0
  106. package/dist/{manifest-CAhOuvSl.mjs → manifest-D7YZM_2e.mjs} +75 -85
  107. package/dist/{manifest-DCyjf4n2.mjs → manifest-DE_VrAeQ.mjs} +27 -7
  108. package/dist/manifest-DGsXSCpT.mjs +39 -0
  109. package/dist/{manifest-BB2J8IMJ.mjs → manifest-DJ2vfEuW.mjs} +48 -41
  110. package/dist/{manifest-3g71z6Bg.mjs → manifest-DPXDYhEu.mjs} +26 -25
  111. package/dist/manifest-Dd4fQb0a.mjs +322 -0
  112. package/dist/{manifest-CXsRWjjI.mjs → manifest-Deq6opGg.mjs} +95 -96
  113. package/dist/{manifest-C9RT5nk32.mjs → manifest-DfJTafJK.mjs} +14 -11
  114. package/dist/manifest-DgOdgN_j.mjs +50 -0
  115. package/dist/{manifest-BmtZzQiQ2.mjs → manifest-DlbMW4v4.mjs} +17 -15
  116. package/dist/{manifest-DrbmZcFl2.mjs → manifest-DmVfbH0w.mjs} +212 -91
  117. package/dist/manifest-Dog6Ddjr.mjs +109 -0
  118. package/dist/manifest-DvgU5FWb.mjs +58 -0
  119. package/dist/manifest-HsfDBs7j.mjs +50 -0
  120. package/dist/manifest-I8oQHvCG.mjs +186 -0
  121. package/dist/manifest-NvH_a-av.mjs +786 -0
  122. package/dist/{manifest-Dh8WBmEW.mjs → manifest-cEJU1v0Z.mjs} +24 -24
  123. package/dist/manifest-wOl5XLB12.mjs +112 -0
  124. package/dist/{modules-C184v-S9.mjs → modules-tZozf0LQ.mjs} +130 -860
  125. package/dist/{mojo-ipc-B_H61Afw.mjs → mojo-ipc-DXNEXEqb.mjs} +141 -26
  126. package/dist/{network-671Cw6hV.mjs → network-CPVvwvFg.mjs} +1329 -823
  127. package/dist/{outputPaths-B1uGmrWZ.mjs → outputPaths-um7lCRY3.mjs} +4 -8
  128. package/dist/{platform-WmNn8Sxb.mjs → platform-CYeFoTWp.mjs} +101 -10
  129. package/dist/{process-QcbIy5Zq.mjs → process-BTbgcVc6.mjs} +251 -346
  130. package/dist/{proxy-DqNs0bAd.mjs → proxy-r8YN6nP1.mjs} +30 -8
  131. package/dist/{registry-D-6e18lB.mjs → registry-Bl8ZQW61.mjs} +3 -3
  132. package/dist/{response-BQVP-xUn.mjs → response-CWhh2aLo.mjs} +7 -1
  133. package/dist/{shared-state-board-DV-dpHFJ.mjs → shared-state-board-BoZnSoj-.mjs} +2 -2
  134. package/dist/{sourcemap-Dq8ez8vS.mjs → sourcemap-BIDHUVXy.mjs} +350 -66
  135. package/dist/{streaming-BUQ0VJsg.mjs → streaming-Dal6utPp.mjs} +13 -13
  136. package/dist/{tool-builder-DCbIC5Eo.mjs → tool-builder-BHJp32mV.mjs} +1 -1
  137. package/dist/{transform-CiYJfNX0.mjs → transform-DRVgGG90.mjs} +18 -14
  138. package/dist/wasm-BYx5UOeG.mjs +1044 -0
  139. package/dist/webcrack-Be0_FccV.mjs +747 -0
  140. package/dist/{workflow-f3xJOcjx.mjs → workflow-BpuKEtvn.mjs} +8 -8
  141. package/package.json +76 -43
  142. package/dist/TraceRecorder-DgxyVbdQ.mjs +0 -519
  143. package/dist/analysis-CL9uACt9.mjs +0 -463
  144. package/dist/bind-helpers-xFfRF-qm.mjs +0 -22
  145. package/dist/definitions-6M-eejaT.mjs +0 -53
  146. package/dist/definitions-B3QdlrHv.mjs +0 -34
  147. package/dist/definitions-CXEI7QC72.mjs +0 -216
  148. package/dist/definitions-C_4r7Fo-2.mjs +0 -14
  149. package/dist/definitions-CkFDALoa.mjs +0 -26
  150. package/dist/definitions-Cy3Sl6gV.mjs +0 -34
  151. package/dist/definitions-LKpC3-nL.mjs +0 -9
  152. package/dist/handlers-DdFzXLvF.mjs +0 -446
  153. package/dist/manifest-82baTv4U.mjs +0 -45
  154. package/dist/manifest-BKbgbSiY.mjs +0 -60
  155. package/dist/manifest-Bcf-TJzH.mjs +0 -848
  156. package/dist/manifest-Bnd7kqEY.mjs +0 -55
  157. package/dist/manifest-BqQX6OQC2.mjs +0 -65
  158. package/dist/manifest-Br4RPFt5.mjs +0 -370
  159. package/dist/manifest-C5qDjysN.mjs +0 -107
  160. package/dist/manifest-CBYWCUBJ.mjs +0 -51
  161. package/dist/manifest-CFADCRa1.mjs +0 -37
  162. package/dist/manifest-CQVhavRF.mjs +0 -114
  163. package/dist/manifest-CV12bcrF.mjs +0 -121
  164. package/dist/manifest-CZLUCfG02.mjs +0 -95
  165. package/dist/manifest-D6phHKFd.mjs +0 -131
  166. package/dist/manifest-DHsnKgP6.mjs +0 -60
  167. package/dist/manifest-Df_dliIe.mjs +0 -55
  168. package/dist/manifest-DhKRAT8_.mjs +0 -92
  169. package/dist/manifest-DlpTj4ic2.mjs +0 -193
  170. package/dist/manifest-DuwHjUa5.mjs +0 -70
  171. package/dist/manifest-qSleDqdO.mjs +0 -1023
  172. package/dist/wasm-DQTnHDs4.mjs +0 -531
  173. /package/dist/{CacheAdapters-CDe5WPSV.mjs → CacheAdapters-jJFy20G-.mjs} +0 -0
  174. /package/dist/{DarwinAPI-BNPxu0RH.mjs → DarwinAPI-ETyy0xyo.mjs} +0 -0
  175. /package/dist/{EventBus-DgPmwpeu.mjs → EventBus-DFKvADm3.mjs} +0 -0
  176. /package/dist/{EvidenceGraphBridge-SFesNera.mjs → EvidenceGraphBridge-318Oi0Lf.mjs} +0 -0
  177. /package/dist/{FingerprintManager-gzWtkKuf.mjs → FingerprintManager-BN4UQWnX.mjs} +0 -0
  178. /package/dist/{PrerequisiteError-Dl33Svkz.mjs → PrerequisiteError-TuyZIs6n.mjs} +0 -0
  179. /package/dist/{ReverseEvidenceGraph-Dlsk94LC.mjs → ReverseEvidenceGraph-C02-gXOh.mjs} +0 -0
  180. /package/dist/{StealthVerifier-Bo4T3bz8.mjs → StealthVerifier-BWmPgQsv.mjs} +0 -0
  181. /package/dist/{VersionDetector-CwVLVdDM.mjs → VersionDetector-K3V4vGsw.mjs} +0 -0
  182. /package/dist/{betterSqlite3-0pqusHHH.mjs → betterSqlite3-DLSBZodi.mjs} +0 -0
  183. /package/dist/{concurrency-Bt0yv1kJ.mjs → concurrency-Drev_Vz9.mjs} +0 -0
  184. /package/dist/{formatAddress-DVkj9kpI.mjs → formatAddress-nnMvEohD.mjs} +0 -0
  185. /package/dist/{parse-args-BlRjqlkL.mjs → parse-args-B4cY5Vx5.mjs} +0 -0
  186. /package/dist/{ssrf-policy-ZaUfvhq7.mjs → ssrf-policy-Dsqd-DTX.mjs} +0 -0
  187. /package/dist/{types-CPhOReNX.mjs → types-DDBWs9UP.mjs} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { at as HEAP_ENUMERATE_MAX_BLOCKS, ct as HEAP_SUSPICIOUS_BLOCK_SIZE, ot as HEAP_SPRAY_SIZE_TOLERANCE, st as HEAP_SPRAY_THRESHOLD } from "./constants-B0OANIBL.mjs";
3
- import { b as openProcessForMemory, d as ReadProcessMemory, t as CloseHandle } from "./Win32API-CePkipZY.mjs";
4
- import { m as TH32CS } from "./Win32Debug-BvKs-gxc.mjs";
2
+ import { ct as HEAP_SPRAY_THRESHOLD, lt as HEAP_SUSPICIOUS_BLOCK_SIZE, ot as HEAP_ENUMERATE_MAX_BLOCKS, st as HEAP_SPRAY_SIZE_TOLERANCE } from "./constants-CDZLOoVv.mjs";
3
+ import { b as openProcessForMemory, d as ReadProcessMemory, t as CloseHandle } from "./Win32API-C2kjj0ze.mjs";
4
+ import { m as TH32CS } from "./Win32Debug-CKrGOTpo.mjs";
5
5
  import koffi from "koffi";
6
6
  //#region src/native/HeapAnalyzer.types.ts
7
7
  /** Heap block flags */
@@ -25,7 +25,7 @@ const HF32 = {
25
25
  *
26
26
  * @module HeapAnalyzer
27
27
  */
28
- let _heapApis = null;
28
+ let heapApisCache = null;
29
29
  function loadHeapApis() {
30
30
  const k32 = koffi.load("kernel32.dll");
31
31
  return {
@@ -44,8 +44,8 @@ function loadHeapApis() {
44
44
  };
45
45
  }
46
46
  function getHeapApis() {
47
- if (!_heapApis) _heapApis = loadHeapApis();
48
- return _heapApis;
47
+ if (!heapApisCache) heapApisCache = loadHeapApis();
48
+ return heapApisCache;
49
49
  }
50
50
  const SIZE_RANGES = [
51
51
  [
@@ -113,7 +113,7 @@ var HeapAnalyzer = class {
113
113
  const processId = hlBuf.readUInt32LE(8);
114
114
  const heapId = hlBuf.readBigUInt64LE(12);
115
115
  const flags = hlBuf.readUInt32LE(20);
116
- const blocks = await this._enumerateBlocksInternal(pid, heapId, HEAP_ENUMERATE_MAX_BLOCKS);
116
+ const blocks = await this.enumerateBlocksInternal(pid, heapId, HEAP_ENUMERATE_MAX_BLOCKS);
117
117
  heaps.push({
118
118
  heapId: `0x${heapId.toString(16)}`,
119
119
  processId,
@@ -130,7 +130,7 @@ var HeapAnalyzer = class {
130
130
  }
131
131
  return {
132
132
  heaps,
133
- stats: this._computeStats(heaps, [])
133
+ stats: this.computeStats(heaps, [])
134
134
  };
135
135
  }
136
136
  /**
@@ -139,7 +139,7 @@ var HeapAnalyzer = class {
139
139
  async enumerateBlocks(pid, heapId, options) {
140
140
  const id = BigInt(heapId);
141
141
  const max = options?.maxBlocks ?? HEAP_ENUMERATE_MAX_BLOCKS;
142
- return this._enumerateBlocksInternal(pid, id, max);
142
+ return this.enumerateBlocksInternal(pid, id, max);
143
143
  }
144
144
  /**
145
145
  * Get full statistical breakdown for all heaps.
@@ -148,10 +148,10 @@ var HeapAnalyzer = class {
148
148
  const { heaps } = await this.enumerateHeaps(pid);
149
149
  const allBlocks = [];
150
150
  for (const heap of heaps) {
151
- const blocks = await this._enumerateBlocksInternal(pid, BigInt(heap.heapId), HEAP_ENUMERATE_MAX_BLOCKS);
151
+ const blocks = await this.enumerateBlocksInternal(pid, BigInt(heap.heapId), HEAP_ENUMERATE_MAX_BLOCKS);
152
152
  allBlocks.push(...blocks);
153
153
  }
154
- return this._computeStats(heaps, allBlocks);
154
+ return this.computeStats(heaps, allBlocks);
155
155
  }
156
156
  /**
157
157
  * Detect heap anomalies: spray, UAF heuristic, suspicious sizes.
@@ -160,14 +160,14 @@ var HeapAnalyzer = class {
160
160
  const anomalies = [];
161
161
  const { heaps } = await this.enumerateHeaps(pid);
162
162
  for (const heap of heaps) {
163
- const blocks = await this._enumerateBlocksInternal(pid, BigInt(heap.heapId), HEAP_ENUMERATE_MAX_BLOCKS);
164
- this._detectSpray(blocks, heap.heapId, anomalies);
165
- this._detectSuspiciousSizes(blocks, heap.heapId, anomalies);
166
- await this._detectPossibleUAF(pid, blocks, heap.heapId, anomalies);
163
+ const blocks = await this.enumerateBlocksInternal(pid, BigInt(heap.heapId), HEAP_ENUMERATE_MAX_BLOCKS);
164
+ this.detectSpray(blocks, heap.heapId, anomalies);
165
+ this.detectSuspiciousSizes(blocks, heap.heapId, anomalies);
166
+ await this.detectPossibleUaf(pid, blocks, heap.heapId, anomalies);
167
167
  }
168
168
  return anomalies;
169
169
  }
170
- async _enumerateBlocksInternal(pid, heapId, maxBlocks) {
170
+ async enumerateBlocksInternal(pid, heapId, maxBlocks) {
171
171
  const apis = getHeapApis();
172
172
  const blocks = [];
173
173
  const heBuf = Buffer.alloc(apis.HEAPENTRY32_SIZE);
@@ -189,7 +189,7 @@ var HeapAnalyzer = class {
189
189
  }
190
190
  return blocks;
191
191
  }
192
- _computeStats(heaps, blocks) {
192
+ computeStats(heaps, blocks) {
193
193
  const buckets = SIZE_RANGES.map(([range]) => ({
194
194
  range,
195
195
  count: 0,
@@ -223,7 +223,7 @@ var HeapAnalyzer = class {
223
223
  fragmentationRatio: totalSize > 0 ? freeSize / totalSize : 0
224
224
  };
225
225
  }
226
- _detectSpray(blocks, heapId, anomalies) {
226
+ detectSpray(blocks, heapId, anomalies) {
227
227
  const sizeGroups = /* @__PURE__ */ new Map();
228
228
  for (const block of blocks) {
229
229
  if (block.isFree) continue;
@@ -240,7 +240,7 @@ var HeapAnalyzer = class {
240
240
  heapId
241
241
  });
242
242
  }
243
- _detectSuspiciousSizes(blocks, heapId, anomalies) {
243
+ detectSuspiciousSizes(blocks, heapId, anomalies) {
244
244
  for (const block of blocks) if (block.size === 0) anomalies.push({
245
245
  type: "suspicious_size",
246
246
  severity: "medium",
@@ -256,7 +256,7 @@ var HeapAnalyzer = class {
256
256
  heapId
257
257
  });
258
258
  }
259
- async _detectPossibleUAF(pid, blocks, heapId, anomalies) {
259
+ async detectPossibleUaf(pid, blocks, heapId, anomalies) {
260
260
  const sampled = blocks.filter((b) => b.isFree && b.size >= 8).slice(0, 100);
261
261
  let hProcess = null;
262
262
  try {
@@ -1,76 +1,3 @@
1
- import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { W as EXTERNAL_TOOL_FORCE_KILL_GRACE_MS } from "./constants-B0OANIBL.mjs";
3
- //#region src/utils/ProcessRegistry.ts
4
- /**
5
- * Global singleton registry to track and safely terminate orphaned child
6
- * processes and worker threads upon server shutdown.
7
- */
8
- var ProcessRegistrySingleton = class {
9
- processes = /* @__PURE__ */ new Set();
10
- /**
11
- * Register a ChildProcess or Worker for automatic cleanup on shutdown.
12
- */
13
- register(proc) {
14
- if (!proc) return;
15
- this.processes.add(proc);
16
- if ("kill" in proc) proc.once("close", () => this.unregister(proc));
17
- else if ("terminate" in proc) {
18
- if (typeof proc.once === "function") proc.once("exit", () => this.unregister(proc));
19
- else if (typeof proc.on === "function") proc.on("exit", () => this.unregister(proc));
20
- }
21
- }
22
- /**
23
- * Unregister a process/worker.
24
- */
25
- unregister(proc) {
26
- if (!proc) return;
27
- this.processes.delete(proc);
28
- }
29
- /**
30
- * Terminate all tracked processes and workers.
31
- * Sends SIGTERM, then after a grace period sends SIGKILL.
32
- */
33
- async terminateAll() {
34
- if (this.processes.size === 0) return;
35
- logger.debug(`[ProcessRegistry] Attempting to terminate ${this.processes.size} active processes/workers...`);
36
- const terminationPromises = [];
37
- for (const proc of this.processes) if ("terminate" in proc) terminationPromises.push(proc.terminate().then(() => {
38
- this.processes.delete(proc);
39
- }).catch((err) => {
40
- logger.warn(`[ProcessRegistry] Error terminating worker: ${err.message}`);
41
- }));
42
- else if ("kill" in proc) terminationPromises.push(new Promise((resolve) => {
43
- if (proc.killed || proc.exitCode !== null || proc.signalCode !== null) {
44
- this.processes.delete(proc);
45
- return resolve();
46
- }
47
- proc.kill("SIGTERM");
48
- let settled = false;
49
- const handleExit = () => {
50
- if (settled) return;
51
- settled = true;
52
- this.processes.delete(proc);
53
- resolve();
54
- };
55
- proc.once("exit", handleExit);
56
- proc.once("close", handleExit);
57
- setTimeout(() => {
58
- if (!settled && !proc.killed && proc.exitCode === null) {
59
- logger.debug(`[ProcessRegistry] Force killing child process PID ${proc.pid}`);
60
- try {
61
- proc.kill("SIGKILL");
62
- } catch {}
63
- handleExit();
64
- }
65
- }, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS).unref();
66
- }));
67
- await Promise.race([Promise.all(terminationPromises), new Promise((resolve) => setTimeout(resolve, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS + 1e3).unref())]);
68
- this.processes.clear();
69
- logger.debug(`[ProcessRegistry] Termination sweep complete.`);
70
- }
71
- };
72
- const ProcessRegistry = new ProcessRegistrySingleton();
73
- //#endregion
74
1
  //#region src/modules/hook/HookGeneratorBuilders.core.generators.runtime.ts
75
2
  function generateFunctionHook(target, action, customCode, condition, performance = false) {
76
3
  return `
@@ -636,4 +563,4 @@ function getInjectionInstructions(type) {
636
563
  return `This hook script monitors ${type} operations. Inject it into the target page via page_evaluate or console_execute to activate.`;
637
564
  }
638
565
  //#endregion
639
- export { generateEvalHook as a, generateObjectMethodHook as c, generateAntiDebugBypass as i, ProcessRegistry as l, generateLocalStorageHook as n, generateFunctionHook as o, getInjectionInstructions as r, generateHookTemplate as s, generateCookieHook as t };
566
+ export { generateEvalHook as a, generateObjectMethodHook as c, generateAntiDebugBypass as i, generateLocalStorageHook as n, generateFunctionHook as o, getInjectionInstructions as r, generateHookTemplate as s, generateCookieHook as t };
@@ -1,7 +1,7 @@
1
1
  //#region src/server/instrumentation/InstrumentationSession.ts
2
- let _nextId = 0;
2
+ let nextId = 0;
3
3
  function uid(prefix) {
4
- return `${prefix}-${Date.now().toString(36)}-${(++_nextId).toString(36)}`;
4
+ return `${prefix}-${Date.now().toString(36)}-${(++nextId).toString(36)}`;
5
5
  }
6
6
  function isRecord(value) {
7
7
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -1,6 +1,6 @@
1
- import { Or as WRITE_HISTORY_MAX, X as FREEZE_DEFAULT_INTERVAL_MS } from "./constants-B0OANIBL.mjs";
2
- import { _ as WriteProcessMemory, b as openProcessForMemory, d as ReadProcessMemory, m as VirtualProtectEx, t as CloseHandle, u as PAGE } from "./Win32API-CePkipZY.mjs";
3
- import { i as parsePattern } from "./NativeMemoryManager.utils-B-FjA2mJ.mjs";
1
+ import { Vr as WRITE_HISTORY_MAX, Z as FREEZE_DEFAULT_INTERVAL_MS } from "./constants-CDZLOoVv.mjs";
2
+ import { _ as WriteProcessMemory, b as openProcessForMemory, d as ReadProcessMemory, m as VirtualProtectEx, t as CloseHandle, u as PAGE } from "./Win32API-C2kjj0ze.mjs";
3
+ import { i as parsePattern } from "./NativeMemoryManager.utils-BBlAixF5.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  //#region src/native/MemoryController.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { gn as SCAN_SESSION_TTL_MS, hn as SCAN_SESSION_MAX_COUNT } from "./constants-B0OANIBL.mjs";
2
- import { n as parseAddress, t as formatAddress } from "./formatAddress-DVkj9kpI.mjs";
1
+ import { Sn as SCAN_SESSION_TTL_MS, xn as SCAN_SESSION_MAX_COUNT } from "./constants-CDZLOoVv.mjs";
2
+ import { n as parseAddress, t as formatAddress } from "./formatAddress-nnMvEohD.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  //#region src/native/ScanComparators.ts
5
5
  const FLOAT_EPSILON = 1e-6;
@@ -1,9 +1,9 @@
1
- import { _n as SCAN_UNKNOWN_INITIAL_MAX_ADDRESSES, dn as SCAN_DISPLAY_RESULTS_LIMIT, fn as SCAN_GROUP_MAX_PATTERN_SIZE, mn as SCAN_POINTER_MAX_RESULTS, pn as SCAN_MAX_RESULTS_PER_SCAN } from "./constants-B0OANIBL.mjs";
2
- import { t as createPlatformProvider } from "./factory-DxlGh9Xf.mjs";
3
- import { i as parsePattern } from "./NativeMemoryManager.utils-B-FjA2mJ.mjs";
4
- import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-dZtA1ZGn.mjs";
5
- import { n as parseAddress, t as formatAddress } from "./formatAddress-DVkj9kpI.mjs";
6
- import { n as getDefaultAlignment, r as getValueSize, scanSessionManager, t as compareScanValues } from "./MemoryScanSession-BsDZbLYm.mjs";
1
+ import { Cn as SCAN_UNKNOWN_INITIAL_MAX_ADDRESSES, _n as SCAN_DISPLAY_RESULTS_LIMIT, bn as SCAN_POINTER_MAX_RESULTS, vn as SCAN_GROUP_MAX_PATTERN_SIZE, yn as SCAN_MAX_RESULTS_PER_SCAN } from "./constants-CDZLOoVv.mjs";
2
+ import { t as createPlatformProvider } from "./factory-C90tBff6.mjs";
3
+ import { i as parsePattern } from "./NativeMemoryManager.utils-BBlAixF5.mjs";
4
+ import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-D9Lkovvn.mjs";
5
+ import { n as parseAddress, t as formatAddress } from "./formatAddress-nnMvEohD.mjs";
6
+ import { n as getDefaultAlignment, r as getValueSize, scanSessionManager, t as compareScanValues } from "./MemoryScanSession-ITgb_NMi.mjs";
7
7
  //#region src/native/MemoryScanner.ts
8
8
  /**
9
9
  * Memory Scanner — orchestrates iterative scan workflows.
@@ -21,10 +21,13 @@ import { n as getDefaultAlignment, r as getValueSize, scanSessionManager, t as c
21
21
  */
22
22
  var MemoryScanner = class {
23
23
  nmm;
24
- _provider = null;
24
+ providerCache = null;
25
25
  get provider() {
26
- if (!this._provider) this._provider = createPlatformProvider();
27
- return this._provider;
26
+ if (!this.providerCache) this.providerCache = createPlatformProvider();
27
+ return this.providerCache;
28
+ }
29
+ set provider(value) {
30
+ this.providerCache = value;
28
31
  }
29
32
  constructor(nmm) {
30
33
  this.nmm = nmm;
@@ -1,8 +1,8 @@
1
1
  import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { v as isKoffiAvailable, y as isWindows } from "./Win32API-CePkipZY.mjs";
3
- import { n as cpuLimit } from "./concurrency-Bt0yv1kJ.mjs";
4
- import { t as createPlatformProvider } from "./factory-DxlGh9Xf.mjs";
5
- import { i as parsePattern, t as findPatternInBuffer } from "./NativeMemoryManager.utils-B-FjA2mJ.mjs";
2
+ import { v as isKoffiAvailable, y as isWindows } from "./Win32API-C2kjj0ze.mjs";
3
+ import { n as cpuLimit } from "./concurrency-Drev_Vz9.mjs";
4
+ import { t as createPlatformProvider } from "./factory-C90tBff6.mjs";
5
+ import { i as parsePattern, t as findPatternInBuffer } from "./NativeMemoryManager.utils-BBlAixF5.mjs";
6
6
  import { exec } from "node:child_process";
7
7
  import { promisify } from "node:util";
8
8
  //#region src/native/NativeMemoryManager.availability.ts
@@ -96,11 +96,14 @@ function scanRegionInChunks(region, patternBytes, mask, readChunk, chunkSize = S
96
96
  * Win32-only methods (injection, debug) are guarded by platform checks.
97
97
  */
98
98
  var NativeMemoryManager = class {
99
- _provider = null;
99
+ providerCache = null;
100
100
  /** Lazily create the platform memory provider */
101
101
  get provider() {
102
- if (!this._provider) this._provider = createPlatformProvider();
103
- return this._provider;
102
+ if (!this.providerCache) this.providerCache = createPlatformProvider();
103
+ return this.providerCache;
104
+ }
105
+ set provider(value) {
106
+ this.providerCache = value;
104
107
  }
105
108
  async checkAvailability() {
106
109
  return checkNativeMemoryAvailability(execAsync);
@@ -324,7 +327,7 @@ var NativeMemoryManager = class {
324
327
  error: "DLL injection is only supported on Windows"
325
328
  };
326
329
  try {
327
- const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, CreateRemoteThread, GetModuleHandle, GetProcAddress, PAGE, MEM } = await import("./Win32API-CePkipZY.mjs").then((n) => n.g);
330
+ const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, CreateRemoteThread, GetModuleHandle, GetProcAddress, PAGE, MEM } = await import("./Win32API-C2kjj0ze.mjs").then((n) => n.g);
328
331
  const handle = openProcessForMemory(pid, true);
329
332
  try {
330
333
  const loadLibraryAddr = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
@@ -374,7 +377,7 @@ var NativeMemoryManager = class {
374
377
  let buffer;
375
378
  if (encoding === "base64") buffer = Buffer.from(shellcode, "base64");
376
379
  else buffer = Buffer.from(shellcode.replace(/\s/g, ""), "hex");
377
- const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, VirtualProtectEx, CreateRemoteThread, PAGE, MEM } = await import("./Win32API-CePkipZY.mjs").then((n) => n.g);
380
+ const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, VirtualProtectEx, CreateRemoteThread, PAGE, MEM } = await import("./Win32API-C2kjj0ze.mjs").then((n) => n.g);
378
381
  const handle = openProcessForMemory(pid, true);
379
382
  try {
380
383
  const remoteMem = VirtualAllocEx(handle, 0n, buffer.length, MEM.COMMIT | MEM.RESERVE, PAGE.READWRITE);
@@ -421,7 +424,7 @@ var NativeMemoryManager = class {
421
424
  error: "Debug port check is only supported on Windows"
422
425
  };
423
426
  try {
424
- const { openProcessForMemory, CloseHandle, NtQueryInformationProcess } = await import("./Win32API-CePkipZY.mjs").then((n) => n.g);
427
+ const { openProcessForMemory, CloseHandle, NtQueryInformationProcess } = await import("./Win32API-C2kjj0ze.mjs").then((n) => n.g);
425
428
  const handle = openProcessForMemory(pid, false);
426
429
  try {
427
430
  const { status, debugPort } = NtQueryInformationProcess(handle, 7);
@@ -1,4 +1,4 @@
1
- import { u as PAGE, v as isKoffiAvailable$1 } from "./Win32API-CePkipZY.mjs";
1
+ import { u as PAGE, v as isKoffiAvailable$1 } from "./Win32API-C2kjj0ze.mjs";
2
2
  //#region src/native/NativeMemoryManager.utils.ts
3
3
  function isKoffiAvailable() {
4
4
  return isKoffiAvailable$1();
@@ -1,5 +1,5 @@
1
1
  import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { a as GetModuleFileNameEx, b as openProcessForMemory, d as ReadProcessMemory, i as GetModuleBaseName, n as EnumProcessModules, s as GetModuleInformation, t as CloseHandle } from "./Win32API-CePkipZY.mjs";
2
+ import { a as GetModuleFileNameEx, b as openProcessForMemory, d as ReadProcessMemory, i as GetModuleBaseName, n as EnumProcessModules, s as GetModuleInformation, t as CloseHandle } from "./Win32API-C2kjj0ze.mjs";
3
3
  import { promises } from "node:fs";
4
4
  //#region src/native/PEAnalyzer.types.ts
5
5
  /** PE section characteristic flags */
@@ -104,7 +104,7 @@ var PEAnalyzer = class {
104
104
  const base = BigInt(moduleBase);
105
105
  const hProcess = openProcessForMemory(pid);
106
106
  try {
107
- const headers = await this._readCoreHeaders(hProcess, base);
107
+ const headers = await this.readCoreHeaders(hProcess, base);
108
108
  const sections = [];
109
109
  for (let i = 0; i < headers.numSections; i++) {
110
110
  const off = headers.firstSectionOffset + i * SECTION_HEADER_SIZE;
@@ -138,7 +138,7 @@ var PEAnalyzer = class {
138
138
  const base = BigInt(moduleBase);
139
139
  const hProcess = openProcessForMemory(pid);
140
140
  try {
141
- const headers = await this._readCoreHeaders(hProcess, base);
141
+ const headers = await this.readCoreHeaders(hProcess, base);
142
142
  const importRva = headers.dataDirectories[IMAGE_DIRECTORY_ENTRY.IMPORT];
143
143
  if (!importRva || importRva.rva === 0) return [];
144
144
  const imports = [];
@@ -151,7 +151,7 @@ var PEAnalyzer = class {
151
151
  const nullIdx = nameData.indexOf(0);
152
152
  const dllName = nameData.subarray(0, nullIdx > 0 ? nullIdx : 256).toString("ascii");
153
153
  const originalFirstThunkRva = desc.readUInt32LE(0) || desc.readUInt32LE(16);
154
- const functions = this._readThunkArray(hProcess, base, originalFirstThunkRva, headers.isPE32Plus);
154
+ const functions = this.readThunkArray(hProcess, base, originalFirstThunkRva, headers.isPE32Plus);
155
155
  imports.push({
156
156
  dllName,
157
157
  functions
@@ -170,7 +170,7 @@ var PEAnalyzer = class {
170
170
  const base = BigInt(moduleBase);
171
171
  const hProcess = openProcessForMemory(pid);
172
172
  try {
173
- const exportDir = (await this._readCoreHeaders(hProcess, base)).dataDirectories[IMAGE_DIRECTORY_ENTRY.EXPORT];
173
+ const exportDir = (await this.readCoreHeaders(hProcess, base)).dataDirectories[IMAGE_DIRECTORY_ENTRY.EXPORT];
174
174
  if (!exportDir || exportDir.rva === 0) return [];
175
175
  const expData = ReadProcessMemory(hProcess, base + BigInt(exportDir.rva), 40);
176
176
  const numberOfNames = expData.readUInt32LE(24);
@@ -213,7 +213,7 @@ var PEAnalyzer = class {
213
213
  const hProcess = openProcessForMemory(pid);
214
214
  const detections = [];
215
215
  try {
216
- const modules = this._enumerateModulesInternal(hProcess);
216
+ const modules = this.enumerateModulesInternal(hProcess);
217
217
  const targets = moduleName ? modules.filter((m) => m.name.toLowerCase().includes(moduleName.toLowerCase())) : modules;
218
218
  for (const mod of targets) try {
219
219
  const diskData = await promises.readFile(mod.path);
@@ -222,12 +222,12 @@ var PEAnalyzer = class {
222
222
  const funcRva = parseInt(exp.rva, 16);
223
223
  if (funcRva === 0 || exp.forwardedTo) continue;
224
224
  const memBytes = ReadProcessMemory(hProcess, BigInt(mod.base) + BigInt(funcRva), COMPARE_BYTES);
225
- const diskOffset = this._rvaToFileOffset(diskData, funcRva);
225
+ const diskOffset = this.rvaToFileOffset(diskData, funcRva);
226
226
  if (diskOffset < 0 || diskOffset + COMPARE_BYTES > diskData.length) continue;
227
227
  const diskBytes = diskData.subarray(diskOffset, diskOffset + COMPARE_BYTES);
228
228
  if (!memBytes.equals(diskBytes)) {
229
- const hookType = this._classifyHook(memBytes);
230
- const jumpTarget = this._decodeJumpTarget(memBytes, BigInt(mod.base) + BigInt(funcRva));
229
+ const hookType = this.classifyHook(memBytes);
230
+ const jumpTarget = this.decodeJumpTarget(memBytes, BigInt(mod.base) + BigInt(funcRva));
231
231
  detections.push({
232
232
  address: `0x${(BigInt(mod.base) + BigInt(funcRva)).toString(16)}`,
233
233
  moduleName: mod.name,
@@ -273,7 +273,7 @@ var PEAnalyzer = class {
273
273
  });
274
274
  return anomalies;
275
275
  }
276
- async _readCoreHeaders(hProcess, base) {
276
+ async readCoreHeaders(hProcess, base) {
277
277
  const e_lfanew = ReadProcessMemory(hProcess, base, 64).readUInt32LE(60);
278
278
  const ntData = ReadProcessMemory(hProcess, base + BigInt(e_lfanew), 264);
279
279
  const numSections = ntData.readUInt16LE(6);
@@ -296,7 +296,7 @@ var PEAnalyzer = class {
296
296
  dataDirectories
297
297
  };
298
298
  }
299
- _readThunkArray(hProcess, base, thunkRva, isPE32Plus) {
299
+ readThunkArray(hProcess, base, thunkRva, isPE32Plus) {
300
300
  const thunkSize = isPE32Plus ? 8 : 4;
301
301
  const functions = [];
302
302
  const IMAGE_ORDINAL_FLAG = isPE32Plus ? 9223372036854775808n : 2147483648n;
@@ -326,7 +326,7 @@ var PEAnalyzer = class {
326
326
  }
327
327
  return functions;
328
328
  }
329
- _enumerateModulesInternal(hProcess) {
329
+ enumerateModulesInternal(hProcess) {
330
330
  const modules = [];
331
331
  try {
332
332
  const { modules: modHandles, count } = EnumProcessModules(hProcess);
@@ -347,7 +347,7 @@ var PEAnalyzer = class {
347
347
  }
348
348
  return modules;
349
349
  }
350
- _rvaToFileOffset(peData, rva) {
350
+ rvaToFileOffset(peData, rva) {
351
351
  const e_lfanew = peData.readUInt32LE(60);
352
352
  const numSections = peData.readUInt16LE(e_lfanew + 6);
353
353
  const sizeOfOptionalHeader = peData.readUInt16LE(e_lfanew + 20);
@@ -362,13 +362,13 @@ var PEAnalyzer = class {
362
362
  }
363
363
  return -1;
364
364
  }
365
- _classifyHook(memBytes) {
365
+ classifyHook(memBytes) {
366
366
  if (memBytes[0] === 233) return "jmp_rel32";
367
367
  if (memBytes[0] === 255 && memBytes[1] === 37) return "jmp_abs64";
368
368
  if (memBytes[0] === 104 && memBytes[5] === 195) return "push_ret";
369
369
  return "unknown";
370
370
  }
371
- _decodeJumpTarget(memBytes, funcAddr) {
371
+ decodeJumpTarget(memBytes, funcAddr) {
372
372
  if (memBytes[0] === 233) {
373
373
  const rel32 = memBytes.readInt32LE(1);
374
374
  return `0x${(funcAddr + 5n + BigInt(rel32)).toString(16)}`;
@@ -1,11 +1,14 @@
1
1
  import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { Kt as PAGE_FRAME_SELECTOR_TIMEOUT_MS, qt as PAGE_NETWORK_IDLE_TIMEOUT_MS } from "./constants-B0OANIBL.mjs";
2
+ import { Jt as PAGE_NETWORK_IDLE_TIMEOUT_MS, qt as PAGE_FRAME_SELECTOR_TIMEOUT_MS } from "./constants-CDZLOoVv.mjs";
3
3
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
4
4
  //#region src/modules/collector/PageController.ts
5
5
  var PageController = class {
6
6
  constructor(collector) {
7
7
  this.collector = collector;
8
8
  }
9
+ async getBrowser() {
10
+ return this.collector.getBrowser();
11
+ }
9
12
  hasAttachedTargetSession() {
10
13
  return this.collector.getAttachedTargetSession() !== null;
11
14
  }
@@ -58,11 +61,22 @@ var PageController = class {
58
61
  }
59
62
  async click(selector, options, frameOptions) {
60
63
  const page = await this.collector.getActivePage();
61
- await (await this.resolveFrame(page, frameOptions)).click(selector, {
64
+ const context = await this.resolveFrame(page, frameOptions);
65
+ const timeout = options?.timeout;
66
+ const clickOptions = {
62
67
  button: options?.button || "left",
63
68
  clickCount: options?.clickCount || 1,
64
69
  delay: options?.delay
65
- });
70
+ };
71
+ if (options?.offset) clickOptions.offset = options.offset;
72
+ if (typeof timeout === "number" && Number.isFinite(timeout) && timeout > 0) {
73
+ page.setDefaultTimeout(timeout);
74
+ try {
75
+ await context.click(selector, clickOptions);
76
+ } finally {
77
+ page.setDefaultTimeout(this.collector["config"]?.timeout ?? 3e4);
78
+ }
79
+ } else await context.click(selector, clickOptions);
66
80
  logger.info(`Clicked: ${selector}${frameOptions?.frameUrl || frameOptions?.frameSelector ? " (in frame)" : ""}`);
67
81
  }
68
82
  async type(selector, text, options, frameOptions) {
@@ -168,7 +182,7 @@ var PageController = class {
168
182
  return page.frames().map((frame) => ({
169
183
  url: frame.url(),
170
184
  name: frame.name() || "",
171
- id: frame._id || "",
185
+ id: frame["_id"] || "",
172
186
  isMainFrame: frame === mainFrame
173
187
  }));
174
188
  }
@@ -1,7 +1,7 @@
1
- import { Jt as POINTER_CHAIN_MAX_DEPTH, Xt as POINTER_CHAIN_MAX_RESULTS, Yt as POINTER_CHAIN_MAX_OFFSET, Zt as POINTER_CHAIN_SCAN_CHUNK_SIZE } from "./constants-B0OANIBL.mjs";
2
- import { t as createPlatformProvider } from "./factory-DxlGh9Xf.mjs";
3
- import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-dZtA1ZGn.mjs";
4
- import { n as parseAddress, t as formatAddress } from "./formatAddress-DVkj9kpI.mjs";
1
+ import { Qt as POINTER_CHAIN_SCAN_CHUNK_SIZE, Xt as POINTER_CHAIN_MAX_OFFSET, Yt as POINTER_CHAIN_MAX_DEPTH, Zt as POINTER_CHAIN_MAX_RESULTS } from "./constants-CDZLOoVv.mjs";
2
+ import { t as createPlatformProvider } from "./factory-C90tBff6.mjs";
3
+ import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-D9Lkovvn.mjs";
4
+ import { n as parseAddress, t as formatAddress } from "./formatAddress-nnMvEohD.mjs";
5
5
  import { randomUUID } from "node:crypto";
6
6
  //#region src/native/PointerChainEngine.ts
7
7
  /**
@@ -15,10 +15,13 @@ import { randomUUID } from "node:crypto";
15
15
  * @module PointerChainEngine
16
16
  */
17
17
  var PointerChainEngine = class {
18
- _provider = null;
18
+ providerCache = null;
19
19
  get provider() {
20
- if (!this._provider) this._provider = createPlatformProvider();
21
- return this._provider;
20
+ if (!this.providerCache) this.providerCache = createPlatformProvider();
21
+ return this.providerCache;
22
+ }
23
+ set provider(value) {
24
+ this.providerCache = value;
22
25
  }
23
26
  /**
24
27
  * Multi-level BFS pointer scan.
@@ -0,0 +1,74 @@
1
+ import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
+ import { G as EXTERNAL_TOOL_FORCE_KILL_GRACE_MS } from "./constants-CDZLOoVv.mjs";
3
+ //#region src/utils/ProcessRegistry.ts
4
+ /**
5
+ * Global singleton registry to track and safely terminate orphaned child
6
+ * processes and worker threads upon server shutdown.
7
+ */
8
+ var ProcessRegistrySingleton = class {
9
+ processes = /* @__PURE__ */ new Set();
10
+ /**
11
+ * Register a ChildProcess or Worker for automatic cleanup on shutdown.
12
+ */
13
+ register(proc) {
14
+ if (!proc) return;
15
+ this.processes.add(proc);
16
+ if ("kill" in proc) proc.once("close", () => this.unregister(proc));
17
+ else if ("terminate" in proc) {
18
+ if (typeof proc.once === "function") proc.once("exit", () => this.unregister(proc));
19
+ else if (typeof proc.on === "function") proc.on("exit", () => this.unregister(proc));
20
+ }
21
+ }
22
+ /**
23
+ * Unregister a process/worker.
24
+ */
25
+ unregister(proc) {
26
+ if (!proc) return;
27
+ this.processes.delete(proc);
28
+ }
29
+ /**
30
+ * Terminate all tracked processes and workers.
31
+ * Sends SIGTERM, then after a grace period sends SIGKILL.
32
+ */
33
+ async terminateAll() {
34
+ if (this.processes.size === 0) return;
35
+ logger.debug(`[ProcessRegistry] Attempting to terminate ${this.processes.size} active processes/workers...`);
36
+ const terminationPromises = [];
37
+ for (const proc of this.processes) if ("terminate" in proc) terminationPromises.push(proc.terminate().then(() => {
38
+ this.processes.delete(proc);
39
+ }).catch((err) => {
40
+ logger.warn(`[ProcessRegistry] Error terminating worker: ${err.message}`);
41
+ }));
42
+ else if ("kill" in proc) terminationPromises.push(new Promise((resolve) => {
43
+ if (proc.killed || proc.exitCode !== null || proc.signalCode !== null) {
44
+ this.processes.delete(proc);
45
+ return resolve();
46
+ }
47
+ proc.kill("SIGTERM");
48
+ let settled = false;
49
+ const handleExit = () => {
50
+ if (settled) return;
51
+ settled = true;
52
+ this.processes.delete(proc);
53
+ resolve();
54
+ };
55
+ proc.once("exit", handleExit);
56
+ proc.once("close", handleExit);
57
+ setTimeout(() => {
58
+ if (!settled && !proc.killed && proc.exitCode === null) {
59
+ logger.debug(`[ProcessRegistry] Force killing child process PID ${proc.pid}`);
60
+ try {
61
+ proc.kill("SIGKILL");
62
+ } catch {}
63
+ handleExit();
64
+ }
65
+ }, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS).unref();
66
+ }));
67
+ await Promise.race([Promise.all(terminationPromises), new Promise((resolve) => setTimeout(resolve, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS + 1e3).unref())]);
68
+ this.processes.clear();
69
+ logger.debug(`[ProcessRegistry] Termination sweep complete.`);
70
+ }
71
+ };
72
+ const ProcessRegistry = new ProcessRegistrySingleton();
73
+ //#endregion
74
+ export { ProcessRegistry as t };