@jshookmcp/jshook 0.2.9 → 0.3.1

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 (316) hide show
  1. package/README.md +25 -50
  2. package/README.zh.md +25 -48
  3. package/dist/AntiCheatDetector-CGVGNfy5.mjs +1 -0
  4. package/dist/CacheAdapters-CdAxBmVW.mjs +1 -0
  5. package/dist/CodeInjector-BlgyqTOk.mjs +1 -0
  6. package/dist/ConsoleMonitor-Dkqc0HNi.mjs +490 -0
  7. package/dist/DOMInspector-BYY_EJ0C.mjs +95 -0
  8. package/dist/DarwinAPI-DC4HGGLl.mjs +1 -0
  9. package/dist/DetailedDataManager-BniBJlVv.mjs +1 -0
  10. package/dist/EventBus-DgciURGg.mjs +1 -0
  11. package/dist/EvidenceGraphBridge-BIfgB7HP.mjs +1 -0
  12. package/dist/ExtensionManager-erMpqcLk.mjs +1 -0
  13. package/dist/FingerprintManager-N7BZqjxP.mjs +1 -0
  14. package/dist/HardwareBreakpoint-OcJqNFVc.mjs +1 -0
  15. package/dist/HeapAnalyzer-CqAxZzeS.mjs +1 -0
  16. package/dist/{HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs → HookGeneratorBuilders.core.generators.storage-Bf1fbrNK.mjs} +66 -174
  17. package/dist/InstrumentationSession-DxXs0sCp.mjs +1 -0
  18. package/dist/MCPServer.search.handlers.domain-DVbWL1bT.mjs +1 -0
  19. package/dist/MemoryController-BaqstM5w.mjs +2 -0
  20. package/dist/MemoryScanSession-CaxAjZJf.mjs +1 -0
  21. package/dist/MemoryScanner-BLYnMJy6.mjs +1 -0
  22. package/dist/NativeMemoryManager.impl-CI554XbY.mjs +1 -0
  23. package/dist/NativeMemoryManager.utils-DM4NC3FE.mjs +1 -0
  24. package/dist/PEAnalyzer-DJyaJTQJ.mjs +1 -0
  25. package/dist/PageController-D9jVkH0i.mjs +1 -0
  26. package/dist/PointerChainEngine-5nF9eNlu.mjs +1 -0
  27. package/dist/PrerequisiteError-Bl3dK8XA.mjs +1 -0
  28. package/dist/ProcessRegistry-Hf12LlR9.mjs +1 -0
  29. package/dist/ResponseBuilder-B2lu4KEl.mjs +1 -0
  30. package/dist/ReverseEvidenceGraph-B931HeoW.mjs +2 -0
  31. package/dist/ScriptManager-fgqiALgj.mjs +7 -0
  32. package/dist/Speedhack-l6s8L2Qw.mjs +1 -0
  33. package/dist/StealthVerifier-Dhbj4B4P.mjs +1 -0
  34. package/dist/StructureAnalyzer-A-WamfYE.mjs +2 -0
  35. package/dist/ToolCatalog-D_IKl1Hu.mjs +1 -0
  36. package/dist/ToolError-DWU_z7gp.mjs +1 -0
  37. package/dist/ToolProbe-xsfALmN3.mjs +1 -0
  38. package/dist/ToolRegistry-B0Zs-phN.mjs +1 -0
  39. package/dist/ToolRouter.policy-CFHoN_Lw.mjs +4 -0
  40. package/dist/TraceRecorder-Dd8jLXpi.mjs +272 -0
  41. package/dist/VersionDetector-DMoUWyNm.mjs +9 -0
  42. package/dist/Win32API-Bhi5xFBe.mjs +1 -0
  43. package/dist/Win32Debug-CQteFL4F.mjs +1 -0
  44. package/dist/WorkflowEngine-CxEp2WXH.mjs +1 -0
  45. package/dist/analysis-BuR-NgX8.mjs +5 -0
  46. package/dist/{antidebug-CqDTB_uk.mjs → antidebug-BOTZH6-0.mjs} +8 -259
  47. package/dist/artifactRetention-NBdncOEW.mjs +1 -0
  48. package/dist/artifacts-B5xQuEa_.mjs +1 -0
  49. package/dist/authorization-schema-B40obG1A.mjs +1 -0
  50. package/dist/betterSqlite3-CGaxz4AX.mjs +1 -0
  51. package/dist/binary-instrument-Cf9qqLlM.mjs +7 -0
  52. package/dist/bind-helpers-BlAOQrFQ.mjs +1 -0
  53. package/dist/boringssl-inspector-BST5vtKx.mjs +2 -0
  54. package/dist/browser-C4Le3xqA.mjs +11 -0
  55. package/dist/capabilities-DbYCv-HF.mjs +1 -0
  56. package/dist/chunk-C_pMuVsO.mjs +1 -0
  57. package/dist/collector-CKO8RPK8.mjs +1 -0
  58. package/dist/concurrency-CcK46d0h.mjs +1 -0
  59. package/dist/constants-Cp6hBrrx.mjs +1 -0
  60. package/dist/coordination-BbijHEHH.mjs +1 -0
  61. package/dist/debugger-CRJq_krh.mjs +1 -0
  62. package/dist/definitions-BGobEDQa.mjs +1 -0
  63. package/dist/definitions-BGwNSkVm.mjs +1 -0
  64. package/dist/definitions-BbxOUiP-.mjs +1 -0
  65. package/dist/definitions-CCP9gphV.mjs +1 -0
  66. package/dist/definitions-CIO9O-Sw.mjs +1 -0
  67. package/dist/definitions-CYFbewnd.mjs +1 -0
  68. package/dist/definitions-CdWEuIkI.mjs +1 -0
  69. package/dist/definitions-CoQFbggH.mjs +1 -0
  70. package/dist/definitions-CuJRsJ6N.mjs +1 -0
  71. package/dist/definitions-DI9YXsJk.mjs +1 -0
  72. package/dist/definitions-DJklW2sS.mjs +1 -0
  73. package/dist/definitions-DZ8uKusP.mjs +1 -0
  74. package/dist/definitions-Dds_zrWx.mjs +1 -0
  75. package/dist/definitions-Dgrg7f3D.mjs +1 -0
  76. package/dist/definitions-DtE0XLrT.mjs +1 -0
  77. package/dist/definitions-LaYTuwQd.mjs +26 -0
  78. package/dist/definitions-NoVp_9Pm.mjs +1 -0
  79. package/dist/definitions-OvGsfxdt.mjs +1 -0
  80. package/dist/definitions-jXPaVy4P.mjs +1 -0
  81. package/dist/encoding-DGcr6Aj_.mjs +2 -0
  82. package/dist/ensure-browser-core-Buls24LQ.mjs +1 -0
  83. package/dist/evidence-graph-bridge-B0yhGPcs.mjs +1 -0
  84. package/dist/factory-Cx_1LorX.mjs +1 -0
  85. package/dist/flat-target-session-CO5g78k3.mjs +1 -0
  86. package/dist/formatAddress-C7j2fDlM.mjs +1 -0
  87. package/dist/graphql-HLf3MS8H.mjs +62 -0
  88. package/dist/handlers-BLMa4X7l.mjs +54 -0
  89. package/dist/handlers-BP12ZsWc.mjs +4 -0
  90. package/dist/handlers-BZoPla6E.mjs +1 -0
  91. package/dist/handlers-BggKiVx9.mjs +2 -0
  92. package/dist/handlers-D3iev8g1.mjs +1 -0
  93. package/dist/handlers-D49r1-1P.mjs +1 -0
  94. package/dist/handlers-DCE45Ww8.mjs +2 -0
  95. package/dist/handlers-DW5AbYs5.mjs +5 -0
  96. package/dist/handlers-De5u62Ga2.mjs +1 -0
  97. package/dist/handlers-DmQzIc44.mjs +31 -0
  98. package/dist/handlers-DnJRGp7t.mjs +302 -0
  99. package/dist/handlers-Dv_runVv.mjs +2 -0
  100. package/dist/handlers-S9Ws0IGy.mjs +2 -0
  101. package/dist/{handlers-Bl8zkwz1.mjs → handlers-pVNpaw4A.mjs} +144 -841
  102. package/dist/handlers.impl-CD2_kOcC.mjs +1 -0
  103. package/dist/hooks-DDKppogd.mjs +600 -0
  104. package/dist/index.mjs +12 -5225
  105. package/dist/logger-sBC6IdRT.mjs +1 -0
  106. package/dist/maintenance-CutEO84j.mjs +1 -0
  107. package/dist/manifest-BFGxlDRh.mjs +123 -0
  108. package/dist/manifest-BPuE6oH2.mjs +1 -0
  109. package/dist/manifest-BXry5N09.mjs +1 -0
  110. package/dist/manifest-BeP_zJGb2.mjs +1 -0
  111. package/dist/manifest-C0g67k6U.mjs +1 -0
  112. package/dist/manifest-C1nZkTkO.mjs +1 -0
  113. package/dist/manifest-C7qV1z7F.mjs +1 -0
  114. package/dist/manifest-CDeUZGUZ.mjs +1 -0
  115. package/dist/manifest-CDiCtaQT.mjs +1 -0
  116. package/dist/manifest-CFn0359q2.mjs +1 -0
  117. package/dist/manifest-CGq4NpqH2.mjs +1 -0
  118. package/dist/manifest-CJMGt7Qy.mjs +1 -0
  119. package/dist/manifest-CRIJq4Hs.mjs +1 -0
  120. package/dist/manifest-C_hEIjSx.mjs +1 -0
  121. package/dist/manifest-CeQmtQOY.mjs +1 -0
  122. package/dist/manifest-Cq0j7GZt.mjs +1 -0
  123. package/dist/manifest-CtPmHAdn.mjs +1 -0
  124. package/dist/manifest-Cx2IVMUY.mjs +1 -0
  125. package/dist/manifest-D16xPXro.mjs +1 -0
  126. package/dist/manifest-D44TaRJU.mjs +1 -0
  127. package/dist/manifest-D610kxZr.mjs +2 -0
  128. package/dist/manifest-DC-SMF6b.mjs +1 -0
  129. package/dist/manifest-DD3rtxvV.mjs +1 -0
  130. package/dist/manifest-DKUorv5M.mjs +1 -0
  131. package/dist/manifest-DMJlcsTR.mjs +1 -0
  132. package/dist/manifest-DWUUWBz0.mjs +1 -0
  133. package/dist/manifest-De-6Wf2R.mjs +1 -0
  134. package/dist/manifest-Dgh0uDW-.mjs +1 -0
  135. package/dist/manifest-Dm0o3i2U.mjs +1 -0
  136. package/dist/manifest-DsVh7Y4U.mjs +1 -0
  137. package/dist/manifest-DtEFSRaq.mjs +1 -0
  138. package/dist/manifest-H-EpAyZQ.mjs +1 -0
  139. package/dist/manifest-ais9Afrw.mjs +1 -0
  140. package/dist/manifest-tmb54wmA.mjs +1 -0
  141. package/dist/manifest-yu2xiQqe.mjs +1 -0
  142. package/dist/manifest-zrbrpKCC.mjs +1 -0
  143. package/dist/matchesWildcardPattern-BGqLSmEs.mjs +1 -0
  144. package/dist/modules-p-PUNv9r.mjs +332 -0
  145. package/dist/mojo-ipc-VGlv3Qyp.mjs +9 -0
  146. package/dist/network-BjZ1Y-GB.mjs +7 -0
  147. package/dist/outputPaths-BonGThuc.mjs +2 -0
  148. package/dist/parse-args-Cuk7-xUt.mjs +1 -0
  149. package/dist/platform-C446Lf97.mjs +93 -0
  150. package/dist/playwright-cdp-fallback-BwVR-_T3.mjs +1 -0
  151. package/dist/process-C9f2A5zk.mjs +962 -0
  152. package/dist/proxy-CvRepxgV.mjs +1 -0
  153. package/dist/registry-DUHIPE-v.mjs +1 -0
  154. package/dist/response-C7rKQst4.mjs +1 -0
  155. package/dist/search-defaults-D2bY-rzH.mjs +1 -0
  156. package/dist/server/plugin-api.mjs +1 -293
  157. package/dist/shared-state-board-Cyg-xh_k.mjs +1 -0
  158. package/dist/sourcemap-D6Q1UuAp.mjs +1 -0
  159. package/dist/ssrf-policy-T96MR3r6.mjs +1 -0
  160. package/dist/streaming-CTX58tbb.mjs +1 -0
  161. package/dist/tool-builder-CI9914Tf.mjs +1 -0
  162. package/dist/transform-Cv9P2vVD.mjs +103 -0
  163. package/dist/types-CuyefmGT.mjs +1 -0
  164. package/dist/types-DtThH00r.mjs +1 -0
  165. package/dist/wasm-DaJa8J0V.mjs +174 -0
  166. package/dist/webcrack-CsLLJIs9.mjs +46 -0
  167. package/dist/workflow-CYIXtrWD.mjs +101 -0
  168. package/package.json +12 -7
  169. package/dist/AntiCheatDetector-BNk-EoBt.mjs +0 -244
  170. package/dist/CacheAdapters-CDe5WPSV.mjs +0 -80
  171. package/dist/CodeInjector-Cq8q01kp.mjs +0 -150
  172. package/dist/ConsoleMonitor-CPVQW1Y-.mjs +0 -2201
  173. package/dist/DarwinAPI-BNPxu0RH.mjs +0 -363
  174. package/dist/DetailedDataManager-BQQcxh64.mjs +0 -217
  175. package/dist/EventBus-DgPmwpeu.mjs +0 -141
  176. package/dist/EvidenceGraphBridge-SFesNera.mjs +0 -153
  177. package/dist/ExtensionManager-CWYgw0YW.mjs +0 -714
  178. package/dist/FingerprintManager-gzWtkKuf.mjs +0 -96
  179. package/dist/HardwareBreakpoint-B9gZCdFP.mjs +0 -239
  180. package/dist/HeapAnalyzer-BLDH0dCv.mjs +0 -284
  181. package/dist/InstrumentationSession-CvPC7Jwy.mjs +0 -244
  182. package/dist/MemoryController-CbVdCIJF.mjs +0 -167
  183. package/dist/MemoryScanSession-BsDZbLYm.mjs +0 -278
  184. package/dist/MemoryScanner-Bcpml6II.mjs +0 -425
  185. package/dist/NativeMemoryManager.impl-dZtA1ZGn.mjs +0 -482
  186. package/dist/NativeMemoryManager.utils-B-FjA2mJ.mjs +0 -165
  187. package/dist/PEAnalyzer-D1lzJ_VG.mjs +0 -385
  188. package/dist/PageController-Bqm2kZ_X.mjs +0 -417
  189. package/dist/PointerChainEngine-BOhyVsjx.mjs +0 -322
  190. package/dist/PrerequisiteError-Dl33Svkz.mjs +0 -20
  191. package/dist/ResponseBuilder-D3iFYx2N.mjs +0 -143
  192. package/dist/ReverseEvidenceGraph-Dlsk94LC.mjs +0 -269
  193. package/dist/ScriptManager-aHHq0X7U.mjs +0 -3000
  194. package/dist/Speedhack-CqdIFlQl.mjs +0 -156
  195. package/dist/StealthVerifier-Bo4T3bz8.mjs +0 -135
  196. package/dist/StructureAnalyzer-DhFaPvRO.mjs +0 -426
  197. package/dist/ToolCatalog-C0JGZoOm.mjs +0 -582
  198. package/dist/ToolError-jh9whhMd.mjs +0 -15
  199. package/dist/ToolProbe-oC7aPrkv.mjs +0 -45
  200. package/dist/ToolRegistry-BjaF4oNz.mjs +0 -131
  201. package/dist/ToolRouter.policy-BWV67ZK-.mjs +0 -304
  202. package/dist/TraceRecorder-DgxyVbdQ.mjs +0 -519
  203. package/dist/VersionDetector-CwVLVdDM.mjs +0 -104
  204. package/dist/Win32API-CePkipZY.mjs +0 -340
  205. package/dist/Win32Debug-BvKs-gxc.mjs +0 -274
  206. package/dist/WorkflowEngine-CuvkZtWu.mjs +0 -598
  207. package/dist/analysis-CL9uACt9.mjs +0 -463
  208. package/dist/artifactRetention-CFEprwPw.mjs +0 -591
  209. package/dist/artifacts-Bk2-_uPq.mjs +0 -59
  210. package/dist/betterSqlite3-0pqusHHH.mjs +0 -74
  211. package/dist/binary-instrument-CXfpx6fT.mjs +0 -979
  212. package/dist/bind-helpers-xFfRF-qm.mjs +0 -22
  213. package/dist/boringssl-inspector-BH2D3VKc.mjs +0 -180
  214. package/dist/browser-BpOr5PEx.mjs +0 -4082
  215. package/dist/chunk-CjcI7cDX.mjs +0 -15
  216. package/dist/concurrency-Bt0yv1kJ.mjs +0 -41
  217. package/dist/constants-B0OANIBL.mjs +0 -519
  218. package/dist/coordination-qUbyF8KU.mjs +0 -259
  219. package/dist/debugger-gnKxRSN0.mjs +0 -1271
  220. package/dist/definitions-6M-eejaT.mjs +0 -53
  221. package/dist/definitions-B18eyf0B.mjs +0 -18
  222. package/dist/definitions-B3QdlrHv.mjs +0 -34
  223. package/dist/definitions-B4rAvHNZ.mjs +0 -63
  224. package/dist/definitions-BB_4jnmy.mjs +0 -37
  225. package/dist/definitions-BMfYXoNC.mjs +0 -43
  226. package/dist/definitions-Beid2EB3.mjs +0 -27
  227. package/dist/definitions-C1UvM5Iy.mjs +0 -126
  228. package/dist/definitions-CXEI7QC72.mjs +0 -216
  229. package/dist/definitions-C_4r7Fo-2.mjs +0 -14
  230. package/dist/definitions-CkFDALoa.mjs +0 -26
  231. package/dist/definitions-Cke7zEb8.mjs +0 -94
  232. package/dist/definitions-ClJLzsJQ.mjs +0 -25
  233. package/dist/definitions-Cq-zroAU.mjs +0 -28
  234. package/dist/definitions-Cy3Sl6gV.mjs +0 -34
  235. package/dist/definitions-D3VsGcvz.mjs +0 -47
  236. package/dist/definitions-DVGfrn7y.mjs +0 -96
  237. package/dist/definitions-LKpC3-nL.mjs +0 -9
  238. package/dist/definitions-bAhHQJq9.mjs +0 -359
  239. package/dist/encoding-Bvz5jLRv.mjs +0 -1065
  240. package/dist/evidence-graph-bridge-C_fv9PuC.mjs +0 -135
  241. package/dist/factory-DxlGh9Xf.mjs +0 -575
  242. package/dist/formatAddress-DVkj9kpI.mjs +0 -17
  243. package/dist/graphql-DYWzJ29s.mjs +0 -1026
  244. package/dist/handlers-9sAbfIg-.mjs +0 -2552
  245. package/dist/handlers-C67ktuRN.mjs +0 -710
  246. package/dist/handlers-C87g8oCe.mjs +0 -276
  247. package/dist/handlers-CTsDAO6p.mjs +0 -681
  248. package/dist/handlers-Cgyg6c0U.mjs +0 -645
  249. package/dist/handlers-D6j6yka7.mjs +0 -2124
  250. package/dist/handlers-DdFzXLvF.mjs +0 -446
  251. package/dist/handlers-DeLOCd5m.mjs +0 -799
  252. package/dist/handlers-DlCJN4Td.mjs +0 -757
  253. package/dist/handlers-DxGIq15_2.mjs +0 -917
  254. package/dist/handlers-U6L4xhuF.mjs +0 -585
  255. package/dist/handlers-tB9Mp9ZK.mjs +0 -84
  256. package/dist/handlers-tiy7EIBp.mjs +0 -572
  257. package/dist/handlers.impl-DS0d9fUw.mjs +0 -761
  258. package/dist/hooks-CzCWByww.mjs +0 -898
  259. package/dist/logger-Dh_xb7_2.mjs +0 -93
  260. package/dist/maintenance-P7ePRXQC.mjs +0 -830
  261. package/dist/manifest-2ToTpjv8.mjs +0 -106
  262. package/dist/manifest-3g71z6Bg.mjs +0 -79
  263. package/dist/manifest-82baTv4U.mjs +0 -45
  264. package/dist/manifest-B3QVVeBS.mjs +0 -82
  265. package/dist/manifest-BB2J8IMJ.mjs +0 -149
  266. package/dist/manifest-BKbgbSiY.mjs +0 -60
  267. package/dist/manifest-Bcf-TJzH.mjs +0 -848
  268. package/dist/manifest-BmtZzQiQ2.mjs +0 -45
  269. package/dist/manifest-Bnd7kqEY.mjs +0 -55
  270. package/dist/manifest-BqQX6OQC2.mjs +0 -65
  271. package/dist/manifest-BqrQ4Tpj.mjs +0 -81
  272. package/dist/manifest-Br4RPFt5.mjs +0 -370
  273. package/dist/manifest-C5qDjysN.mjs +0 -107
  274. package/dist/manifest-C9RT5nk32.mjs +0 -34
  275. package/dist/manifest-CAhOuvSl.mjs +0 -204
  276. package/dist/manifest-CBYWCUBJ.mjs +0 -51
  277. package/dist/manifest-CFADCRa1.mjs +0 -37
  278. package/dist/manifest-CQVhavRF.mjs +0 -114
  279. package/dist/manifest-CT7zZBV1.mjs +0 -48
  280. package/dist/manifest-CV12bcrF.mjs +0 -121
  281. package/dist/manifest-CXsRWjjI.mjs +0 -224
  282. package/dist/manifest-CZLUCfG02.mjs +0 -95
  283. package/dist/manifest-D6phHKFd.mjs +0 -131
  284. package/dist/manifest-DCyjf4n2.mjs +0 -294
  285. package/dist/manifest-DHsnKgP6.mjs +0 -60
  286. package/dist/manifest-Df_dliIe.mjs +0 -55
  287. package/dist/manifest-Dh8WBmEW.mjs +0 -129
  288. package/dist/manifest-DhKRAT8_.mjs +0 -92
  289. package/dist/manifest-DlpTj4ic2.mjs +0 -193
  290. package/dist/manifest-DrbmZcFl2.mjs +0 -253
  291. package/dist/manifest-DuwHjUa5.mjs +0 -70
  292. package/dist/manifest-DzwvxPJX.mjs +0 -38
  293. package/dist/manifest-NXctwWQq.mjs +0 -68
  294. package/dist/manifest-Sc_0JQ13.mjs +0 -418
  295. package/dist/manifest-gZ4s_UtG.mjs +0 -96
  296. package/dist/manifest-qSleDqdO.mjs +0 -1023
  297. package/dist/modules-C184v-S9.mjs +0 -11365
  298. package/dist/mojo-ipc-B_H61Afw.mjs +0 -525
  299. package/dist/network-671Cw6hV.mjs +0 -3346
  300. package/dist/outputPaths-B1uGmrWZ.mjs +0 -1145
  301. package/dist/parse-args-BlRjqlkL.mjs +0 -39
  302. package/dist/platform-WmNn8Sxb.mjs +0 -2070
  303. package/dist/process-QcbIy5Zq.mjs +0 -1401
  304. package/dist/proxy-DqNs0bAd.mjs +0 -170
  305. package/dist/registry-D-6e18lB.mjs +0 -34
  306. package/dist/response-BQVP-xUn.mjs +0 -28
  307. package/dist/shared-state-board-DV-dpHFJ.mjs +0 -586
  308. package/dist/sourcemap-Dq8ez8vS.mjs +0 -650
  309. package/dist/ssrf-policy-ZaUfvhq7.mjs +0 -166
  310. package/dist/streaming-BUQ0VJsg.mjs +0 -725
  311. package/dist/tool-builder-DCbIC5Eo.mjs +0 -186
  312. package/dist/transform-CiYJfNX0.mjs +0 -1007
  313. package/dist/types-Bx92KJfT.mjs +0 -4
  314. package/dist/types-CPhOReNX.mjs +0 -37
  315. package/dist/wasm-DQTnHDs4.mjs +0 -531
  316. package/dist/workflow-f3xJOcjx.mjs +0 -725
@@ -1,363 +0,0 @@
1
- import { t as __exportAll } from "./chunk-CjcI7cDX.mjs";
2
- import { t as logger } from "./logger-Dh_xb7_2.mjs";
3
- import koffi from "koffi";
4
- //#region src/native/platform/darwin/DarwinAPI.ts
5
- /**
6
- * Darwin (macOS) API Bindings using koffi FFI
7
- * Direct native calls to libSystem.B.dylib Mach kernel APIs
8
- *
9
- * This is the macOS counterpart to Win32API.ts — provides raw Mach API
10
- * function wrappers that DarwinMemoryProvider consumes.
11
- *
12
- * Pattern: lazy library loading, inline koffi function signatures,
13
- * Buffer-based struct parsing (no koffi struct registration to avoid
14
- * "Duplicate type name" errors in test environments).
15
- *
16
- * @module platform/darwin/DarwinAPI
17
- */
18
- var DarwinAPI_exports = /* @__PURE__ */ __exportAll({
19
- KERN: () => KERN,
20
- SM: () => SM,
21
- VM_FLAGS: () => VM_FLAGS,
22
- VM_PROT: () => VM_PROT,
23
- VM_REGION_BASIC_INFO_64: () => 9,
24
- VM_REGION_BASIC_INFO_COUNT_64: () => 9,
25
- dyldGetImageHeader: () => dyldGetImageHeader,
26
- dyldGetImageName: () => dyldGetImageName,
27
- dyldImageCount: () => dyldImageCount,
28
- isDarwin: () => isDarwin,
29
- isKoffiAvailableOnDarwin: () => isKoffiAvailableOnDarwin,
30
- kernReturnName: () => kernReturnName,
31
- machPortDeallocate: () => machPortDeallocate,
32
- machTaskSelf: () => machTaskSelf,
33
- machVmAllocate: () => machVmAllocate,
34
- machVmDeallocate: () => machVmDeallocate,
35
- machVmProtect: () => machVmProtect,
36
- machVmReadOverwrite: () => machVmReadOverwrite,
37
- machVmRegion: () => machVmRegion,
38
- machVmWrite: () => machVmWrite,
39
- taskForPid: () => taskForPid,
40
- taskResume: () => taskResume,
41
- taskSuspend: () => taskSuspend
42
- });
43
- /** Mach kernel return codes */
44
- const KERN = {
45
- SUCCESS: 0,
46
- INVALID_ADDRESS: 1,
47
- PROTECTION_FAILURE: 2,
48
- NO_SPACE: 3,
49
- INVALID_ARGUMENT: 4,
50
- FAILURE: 5,
51
- RESOURCE_SHORTAGE: 6,
52
- NOT_RECEIVER: 7,
53
- NO_ACCESS: 8,
54
- MEMORY_FAILURE: 9,
55
- MEMORY_ERROR: 10,
56
- ALREADY_IN_SET: 11,
57
- NOT_IN_SET: 12,
58
- NAME_EXISTS: 13,
59
- ABORTED: 14,
60
- INVALID_NAME: 15,
61
- INVALID_TASK: 16,
62
- INVALID_RIGHT: 17,
63
- INVALID_VALUE: 18,
64
- UREFS_OVERFLOW: 19,
65
- INVALID_CAPABILITY: 20,
66
- RIGHT_EXISTS: 21,
67
- INVALID_HOST: 22,
68
- MEMORY_PRESENT: 23,
69
- MEMORY_DATA_MOVED: 24,
70
- MEMORY_RESTART_COPY: 25,
71
- INVALID_PROCESSOR_SET: 26,
72
- POLICY_LIMIT: 27,
73
- INVALID_POLICY: 28,
74
- INVALID_OBJECT: 29,
75
- ALREADY_WAITING: 30,
76
- DEFAULT_SET: 31,
77
- EXCEPTION_PROTECTED: 32,
78
- INVALID_LEDGER: 33,
79
- INVALID_MEMORY_CONTROL: 34,
80
- INVALID_SECURITY: 35,
81
- NOT_DEPRESSED: 36,
82
- TERMINATED: 37,
83
- LOCK_SET_DESTROYED: 38,
84
- LOCK_UNSTABLE: 39,
85
- LOCK_OWNED: 40,
86
- LOCK_OWNED_SELF: 41,
87
- SEMAPHORE_DESTROYED: 42,
88
- RPC_SERVER_TERMINATED: 43,
89
- RPC_TERMINATE_ORPHAN: 44,
90
- RPC_CONTINUE_ORPHAN: 45,
91
- NOT_SUPPORTED: 46,
92
- NODE_DOWN: 47,
93
- NOT_WAITING: 48,
94
- OPERATION_TIMED_OUT: 49,
95
- CODESIGN_ERROR: 50,
96
- POLICY_STATIC: 51
97
- };
98
- /** Human-readable kernel return code names */
99
- const KERN_NAMES = {
100
- [KERN.SUCCESS]: "KERN_SUCCESS",
101
- [KERN.INVALID_ADDRESS]: "KERN_INVALID_ADDRESS",
102
- [KERN.PROTECTION_FAILURE]: "KERN_PROTECTION_FAILURE",
103
- [KERN.NO_SPACE]: "KERN_NO_SPACE",
104
- [KERN.INVALID_ARGUMENT]: "KERN_INVALID_ARGUMENT",
105
- [KERN.FAILURE]: "KERN_FAILURE",
106
- [KERN.NO_ACCESS]: "KERN_NO_ACCESS",
107
- [KERN.INVALID_TASK]: "KERN_INVALID_TASK",
108
- [KERN.INVALID_RIGHT]: "KERN_INVALID_RIGHT",
109
- [KERN.CODESIGN_ERROR]: "KERN_CODESIGN_ERROR"
110
- };
111
- /** Get human-readable name for a kern_return_t value */
112
- function kernReturnName(kr) {
113
- return KERN_NAMES[kr] ?? `KERN_UNKNOWN(${kr})`;
114
- }
115
- /** VM protection flags */
116
- const VM_PROT = {
117
- NONE: 0,
118
- READ: 1,
119
- WRITE: 2,
120
- EXECUTE: 4,
121
- ALL: 7
122
- };
123
- /** VM allocation flags */
124
- const VM_FLAGS = {
125
- FIXED: 0,
126
- ANYWHERE: 1,
127
- PURGABLE: 2,
128
- RANDOM_ADDR: 8,
129
- OVERWRITE: 16384
130
- };
131
- /** VM region share modes */
132
- const SM = {
133
- COW: 1,
134
- PRIVATE: 2,
135
- EMPTY: 3,
136
- SHARED: 4,
137
- TRUESHARED: 5,
138
- PRIVATE_ALIASED: 6,
139
- SHARED_ALIASED: 7,
140
- LARGE_PAGE: 8
141
- };
142
- let libSystem = null;
143
- let koffiAvailableDarwin = null;
144
- /**
145
- * Check if running on macOS
146
- */
147
- function isDarwin() {
148
- return process.platform === "darwin";
149
- }
150
- /**
151
- * Check if koffi can load libSystem.B.dylib on macOS
152
- */
153
- function isKoffiAvailableOnDarwin() {
154
- if (koffiAvailableDarwin !== null) return koffiAvailableDarwin;
155
- try {
156
- koffi.load("/usr/lib/libSystem.B.dylib").unload();
157
- koffiAvailableDarwin = true;
158
- return true;
159
- } catch {
160
- koffiAvailableDarwin = false;
161
- return false;
162
- }
163
- }
164
- /**
165
- * Get or load libSystem.B.dylib (lazy)
166
- */
167
- function getLibSystem() {
168
- if (!libSystem) {
169
- libSystem = koffi.load("/usr/lib/libSystem.B.dylib");
170
- logger.debug("Loaded libSystem.B.dylib via koffi");
171
- }
172
- return libSystem;
173
- }
174
- /**
175
- * Get the current task's Mach port (mach_task_self_)
176
- * On macOS, mach_task_self() is actually a macro accessing the global mach_task_self_ variable.
177
- * For koffi, we call mach_task_self_ which is the actual symbol.
178
- */
179
- function machTaskSelf() {
180
- return getLibSystem().func("uint32 mach_task_self()")();
181
- }
182
- /**
183
- * Get a Mach task port for a target process
184
- *
185
- * Requires root privileges or debugger entitlement (com.apple.security.cs.debugger)
186
- *
187
- * @param targetTask - The task port of the caller (use machTaskSelf())
188
- * @param pid - Target process PID
189
- * @returns { kr, task } where kr is kern_return_t and task is the Mach task port
190
- */
191
- function taskForPid(targetTask, pid) {
192
- const fn = getLibSystem().func("int32 task_for_pid(uint32, int32, _Out_ uint32 *)");
193
- const taskBuf = Buffer.alloc(4);
194
- return {
195
- kr: fn(targetTask, pid, taskBuf),
196
- task: taskBuf.readUInt32LE(0)
197
- };
198
- }
199
- /**
200
- * Deallocate a Mach port right
201
- *
202
- * @param task - The task owning the port
203
- * @param name - The port name to deallocate
204
- * @returns kern_return_t
205
- */
206
- function machPortDeallocate(task, name) {
207
- return getLibSystem().func("int32 mach_port_deallocate(uint32, uint32)")(task, name);
208
- }
209
- /**
210
- * Read memory from a remote process using mach_vm_read_overwrite.
211
- *
212
- * We use _overwrite variant because it writes directly into our pre-allocated
213
- * buffer, avoiding kernel-allocated memory and the need for mach_vm_deallocate.
214
- *
215
- * @param task - Target task port
216
- * @param address - Source address in target process
217
- * @param size - Number of bytes to read
218
- * @returns { kr, data, outsize }
219
- */
220
- function machVmReadOverwrite(task, address, size) {
221
- const fn = getLibSystem().func("int32 mach_vm_read_overwrite(uint32, uint64, uint64, _Out_ uint8_t *, uint64, _Out_ uint64 *)");
222
- const data = Buffer.alloc(size);
223
- const outsizeBuf = Buffer.alloc(8);
224
- return {
225
- kr: fn(task, address, BigInt(size), data, BigInt(size), outsizeBuf),
226
- data,
227
- outsize: outsizeBuf.readBigUInt64LE(0)
228
- };
229
- }
230
- /**
231
- * Write memory to a remote process using mach_vm_write.
232
- *
233
- * @param task - Target task port
234
- * @param address - Destination address in target process
235
- * @param data - Data to write
236
- * @returns kern_return_t
237
- */
238
- function machVmWrite(task, address, data) {
239
- return getLibSystem().func("int32 mach_vm_write(uint32, uint64, uint8_t *, uint32)")(task, address, data, data.length);
240
- }
241
- /**
242
- * Query a memory region in a remote process using mach_vm_region.
243
- *
244
- * Returns vm_region_basic_info_data_64_t which is 36 bytes:
245
- * protection(4) + max_protection(4) + inheritance(4) + shared(4) +
246
- * reserved(4) + offset(8) + behavior(4) + user_wired_count(4)
247
- *
248
- * @param task - Target task port
249
- * @param address - Address to query (will be rounded down to region start)
250
- * @returns { kr, address, size, info, objectName }
251
- */
252
- function machVmRegion(task, address) {
253
- const fn = getLibSystem().func("int32 mach_vm_region(uint32, _Inout_ uint64 *, _Out_ uint64 *, int32, _Out_ uint8_t *, _Inout_ uint32 *, _Out_ uint32 *)");
254
- const addressBuf = Buffer.alloc(8);
255
- addressBuf.writeBigUInt64LE(address);
256
- const sizeBuf = Buffer.alloc(8);
257
- const infoBuf = Buffer.alloc(36);
258
- const infoCntBuf = Buffer.alloc(4);
259
- infoCntBuf.writeUInt32LE(9);
260
- const kr = fn(task, addressBuf, sizeBuf, 9, infoBuf, infoCntBuf, Buffer.alloc(4));
261
- const info = {
262
- protection: infoBuf.readUInt32LE(0),
263
- max_protection: infoBuf.readUInt32LE(4),
264
- inheritance: infoBuf.readUInt32LE(8),
265
- shared: infoBuf.readUInt32LE(12) !== 0,
266
- reserved: infoBuf.readUInt32LE(16) !== 0,
267
- offset: infoBuf.readBigUInt64LE(20),
268
- behavior: infoBuf.readUInt32LE(28),
269
- user_wired_count: infoBuf.readUInt32LE(32)
270
- };
271
- return {
272
- kr,
273
- address: addressBuf.readBigUInt64LE(0),
274
- size: sizeBuf.readBigUInt64LE(0),
275
- info
276
- };
277
- }
278
- /**
279
- * Change memory protection for a region in a remote process.
280
- *
281
- * @param task - Target task port
282
- * @param address - Start address of the region
283
- * @param size - Size of the region
284
- * @param setMaximum - If true, sets maximum protection (needed for W^X workarounds)
285
- * @param newProtection - New VM_PROT_* flags
286
- * @returns kern_return_t
287
- */
288
- function machVmProtect(task, address, size, setMaximum, newProtection) {
289
- return getLibSystem().func("int32 mach_vm_protect(uint32, uint64, uint64, int32, int32)")(task, address, size, setMaximum ? 1 : 0, newProtection);
290
- }
291
- /**
292
- * Allocate memory in a remote process.
293
- *
294
- * @param task - Target task port
295
- * @param size - Number of bytes to allocate
296
- * @param flags - VM_FLAGS_* (typically VM_FLAGS_ANYWHERE)
297
- * @returns { kr, address }
298
- */
299
- function machVmAllocate(task, size, flags) {
300
- const fn = getLibSystem().func("int32 mach_vm_allocate(uint32, _Inout_ uint64 *, uint64, int32)");
301
- const addressBuf = Buffer.alloc(8);
302
- addressBuf.writeBigUInt64LE(0n);
303
- return {
304
- kr: fn(task, addressBuf, size, flags),
305
- address: addressBuf.readBigUInt64LE(0)
306
- };
307
- }
308
- /**
309
- * Deallocate (free) memory in a remote process.
310
- *
311
- * @param task - Target task port
312
- * @param address - Start address of the region to free
313
- * @param size - Size of the region to free
314
- * @returns kern_return_t
315
- */
316
- function machVmDeallocate(task, address, size) {
317
- return getLibSystem().func("int32 mach_vm_deallocate(uint32, uint64, uint64)")(task, address, size);
318
- }
319
- /**
320
- * Suspend all threads in a task (freeze target process).
321
- *
322
- * This pauses the entire process — useful for consistent memory snapshots.
323
- * Must be paired with `taskResume()` to avoid leaving the target frozen.
324
- *
325
- * @param task - Target task port (from taskForPid)
326
- * @returns kern_return_t
327
- */
328
- function taskSuspend(task) {
329
- return getLibSystem().func("int32 task_suspend(uint32)")(task);
330
- }
331
- /**
332
- * Resume all threads in a previously-suspended task.
333
- *
334
- * @param task - Target task port (from taskForPid)
335
- * @returns kern_return_t
336
- */
337
- function taskResume(task) {
338
- return getLibSystem().func("int32 task_resume(uint32)")(task);
339
- }
340
- /**
341
- * Get the number of loaded images in the current process.
342
- * Note: For remote process module enumeration, we need to read
343
- * dyld_all_image_infos from the target process memory instead.
344
- */
345
- function dyldImageCount() {
346
- return getLibSystem().func("uint32 _dyld_image_count()")();
347
- }
348
- /**
349
- * Get the name of a loaded image by index (current process only).
350
- */
351
- function dyldGetImageName(index) {
352
- const ptr = getLibSystem().func("const char * _dyld_get_image_name(uint32)")(index);
353
- return ptr ? String(ptr) : "";
354
- }
355
- /**
356
- * Get the Mach header pointer of a loaded image by index (current process only).
357
- */
358
- function dyldGetImageHeader(index) {
359
- const fn = getLibSystem().func("void * _dyld_get_image_header(uint32)");
360
- return BigInt(fn(index));
361
- }
362
- //#endregion
363
- export { machVmReadOverwrite as _, VM_PROT as a, taskForPid as b, dyldImageCount as c, kernReturnName as d, machPortDeallocate as f, machVmProtect as g, machVmDeallocate as h, VM_FLAGS as i, isDarwin as l, machVmAllocate as m, KERN as n, dyldGetImageHeader as o, machTaskSelf as p, SM as r, dyldGetImageName as s, DarwinAPI_exports as t, isKoffiAvailableOnDarwin as u, machVmRegion as v, machVmWrite as y };
@@ -1,217 +0,0 @@
1
- import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { I as DETAILED_DATA_DEFAULT_TTL_MS, L as DETAILED_DATA_MAX_TTL_MS, R as DETAILED_DATA_SMART_THRESHOLD_BYTES } from "./constants-B0OANIBL.mjs";
3
- //#region src/utils/DetailedDataManager.ts
4
- var DetailedDataManager = class DetailedDataManager {
5
- static instance;
6
- cache = /* @__PURE__ */ new Map();
7
- cleanupInterval = null;
8
- DEFAULT_TTL = DETAILED_DATA_DEFAULT_TTL_MS;
9
- MAX_TTL = DETAILED_DATA_MAX_TTL_MS;
10
- MAX_CACHE_SIZE = 100;
11
- AUTO_EXTEND_ON_ACCESS = true;
12
- EXTEND_DURATION = 900 * 1e3;
13
- /** Memo cache to avoid re-serializing the same object within a single call chain */
14
- serializationMemo = /* @__PURE__ */ new WeakMap();
15
- constructor() {
16
- this.cleanupInterval = setInterval(() => this.cleanup(), 300 * 1e3);
17
- if (typeof this.cleanupInterval === "object" && "unref" in this.cleanupInterval) this.cleanupInterval.unref();
18
- }
19
- /** @deprecated Use constructor injection. Kept for backward compatibility. */
20
- static getInstance() {
21
- if (!this.instance) this.instance = new DetailedDataManager();
22
- return this.instance;
23
- }
24
- shutdown() {
25
- if (this.cleanupInterval) {
26
- clearInterval(this.cleanupInterval);
27
- this.cleanupInterval = null;
28
- }
29
- this.cache.clear();
30
- DetailedDataManager.instance = void 0;
31
- logger.info("DetailedDataManager shut down");
32
- }
33
- /**
34
- * Serialize data with memoization to avoid redundant JSON.stringify calls.
35
- * Objects are cached in a WeakMap so the memo is automatically GC'd.
36
- */
37
- serializeWithMemo(data) {
38
- if (data !== null && typeof data === "object") {
39
- const cached = this.serializationMemo.get(data);
40
- if (cached) return cached;
41
- }
42
- const json = JSON.stringify(data);
43
- const result = {
44
- json,
45
- size: json.length
46
- };
47
- if (data !== null && typeof data === "object") this.serializationMemo.set(data, result);
48
- return result;
49
- }
50
- isRecord(value) {
51
- return value !== null && typeof value === "object";
52
- }
53
- readPathSegment(value, key) {
54
- return Object(value)[key];
55
- }
56
- smartHandle(data, threshold = DETAILED_DATA_SMART_THRESHOLD_BYTES) {
57
- if (data === null || data === void 0) return data;
58
- if (typeof data !== "object" && typeof data !== "string") return data;
59
- if (typeof data === "string") {
60
- if (data.length <= threshold) return data;
61
- }
62
- const { json: jsonStr, size } = this.serializeWithMemo(data);
63
- if (size <= threshold) return data;
64
- logger.info(`Data too large (${(size / 1024).toFixed(1)}KB), returning summary with detailId`);
65
- return this.createDetailedResponseWithSize(data, jsonStr, size);
66
- }
67
- createDetailedResponseWithSize(data, jsonStr, size) {
68
- const detailId = this.storeWithSize(data, size);
69
- return {
70
- summary: this.generateSummaryFromJson(data, jsonStr, size),
71
- detailId,
72
- hint: `Data too large. Use get_detailed_data("${detailId}") to retrieve full data, or get_detailed_data("${detailId}", path="key.subkey") for specific part.`,
73
- expiresAt: Date.now() + this.DEFAULT_TTL
74
- };
75
- }
76
- store(data, customTTL) {
77
- const { size } = this.serializeWithMemo(data);
78
- return this.storeWithSize(data, size, customTTL);
79
- }
80
- storeWithSize(data, size, customTTL) {
81
- if (this.cache.size >= this.MAX_CACHE_SIZE) this.evictLRU();
82
- const detailId = `detail_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
83
- const now = Date.now();
84
- const ttl = customTTL || this.DEFAULT_TTL;
85
- const entry = {
86
- data,
87
- expiresAt: now + ttl,
88
- createdAt: now,
89
- lastAccessedAt: now,
90
- accessCount: 0,
91
- size
92
- };
93
- this.cache.set(detailId, entry);
94
- logger.debug(`Stored detailed data: ${detailId}, size: ${(size / 1024).toFixed(1)}KB, expires in ${ttl / 1e3}s`);
95
- return detailId;
96
- }
97
- retrieve(detailId, path) {
98
- const cached = this.cache.get(detailId);
99
- if (!cached) throw new Error(`DetailId not found or expired: ${detailId}`);
100
- const now = Date.now();
101
- if (now > cached.expiresAt) {
102
- this.cache.delete(detailId);
103
- throw new Error(`DetailId expired: ${detailId}`);
104
- }
105
- cached.lastAccessedAt = now;
106
- cached.accessCount++;
107
- if (this.AUTO_EXTEND_ON_ACCESS) {
108
- if (cached.expiresAt - now < 300 * 1e3) {
109
- cached.expiresAt = Math.min(now + this.EXTEND_DURATION, now + this.MAX_TTL);
110
- logger.debug(`Auto-extended detailId ${detailId}, new expiry: ${new Date(cached.expiresAt).toISOString()}`);
111
- }
112
- }
113
- if (path) return this.getByPath(cached.data, path);
114
- return cached.data;
115
- }
116
- getByPath(obj, path) {
117
- const keys = path.split(".");
118
- let current = obj;
119
- for (const key of keys) {
120
- if (current === null || current === void 0) throw new Error(`Path not found: ${path} (stopped at ${key})`);
121
- current = this.readPathSegment(current, key);
122
- }
123
- return current;
124
- }
125
- generateSummaryFromJson(data, jsonStr, size) {
126
- const summary = {
127
- type: Array.isArray(data) ? "array" : typeof data,
128
- size,
129
- sizeKB: (size / 1024).toFixed(1) + "KB",
130
- preview: jsonStr.substring(0, 200) + (size > 200 ? "..." : "")
131
- };
132
- if (this.isRecord(data)) {
133
- const keys = Object.keys(data);
134
- summary.structure = { keys: keys.slice(0, 50) };
135
- if (!Array.isArray(data)) {
136
- const methods = keys.filter((k) => typeof data[k] === "function");
137
- const properties = keys.filter((k) => typeof data[k] !== "function");
138
- summary.structure.methods = methods.slice(0, 30);
139
- summary.structure.properties = properties.slice(0, 50);
140
- } else summary.structure.length = data.length;
141
- }
142
- return summary;
143
- }
144
- cleanup() {
145
- const now = Date.now();
146
- let cleaned = 0;
147
- for (const [id, cached] of this.cache.entries()) if (now > cached.expiresAt) {
148
- this.cache.delete(id);
149
- cleaned++;
150
- }
151
- if (cleaned > 0) logger.debug(`Cleaned ${cleaned} expired detailed data entries`);
152
- }
153
- evictLRU() {
154
- if (this.cache.size === 0) return;
155
- let oldestId = null;
156
- let oldestAccessTime = Infinity;
157
- for (const [id, entry] of this.cache.entries()) if (entry.lastAccessedAt < oldestAccessTime) {
158
- oldestAccessTime = entry.lastAccessedAt;
159
- oldestId = id;
160
- }
161
- if (oldestId) {
162
- const entry = this.cache.get(oldestId);
163
- this.cache.delete(oldestId);
164
- logger.info(`Evicted LRU entry: ${oldestId}, last accessed: ${new Date(entry.lastAccessedAt).toISOString()}, access count: ${entry.accessCount}`);
165
- }
166
- }
167
- extend(detailId, additionalTime) {
168
- const cached = this.cache.get(detailId);
169
- if (!cached) throw new Error(`DetailId not found: ${detailId}`);
170
- const now = Date.now();
171
- if (now > cached.expiresAt) throw new Error(`DetailId already expired: ${detailId}`);
172
- const extendBy = additionalTime || this.EXTEND_DURATION;
173
- const newExpiresAt = Math.min(cached.expiresAt + extendBy, now + this.MAX_TTL);
174
- cached.expiresAt = newExpiresAt;
175
- logger.info(`Extended detailId ${detailId} by ${extendBy / 1e3}s, new expiry: ${new Date(newExpiresAt).toISOString()}`);
176
- }
177
- getStats() {
178
- let totalSize = 0;
179
- let totalAccessCount = 0;
180
- const entries = Array.from(this.cache.values());
181
- for (const entry of entries) {
182
- totalSize += entry.size;
183
- totalAccessCount += entry.accessCount;
184
- }
185
- return {
186
- cacheSize: this.cache.size,
187
- maxCacheSize: this.MAX_CACHE_SIZE,
188
- defaultTTLSeconds: this.DEFAULT_TTL / 1e3,
189
- maxTTLSeconds: this.MAX_TTL / 1e3,
190
- totalSizeKB: (totalSize / 1024).toFixed(1),
191
- avgAccessCount: entries.length > 0 ? (totalAccessCount / entries.length).toFixed(1) : "0",
192
- autoExtendEnabled: this.AUTO_EXTEND_ON_ACCESS,
193
- extendDurationSeconds: this.EXTEND_DURATION / 1e3
194
- };
195
- }
196
- getDetailedStats() {
197
- const now = Date.now();
198
- const entries = Array.from(this.cache.entries()).map(([id, entry]) => ({
199
- detailId: id,
200
- sizeKB: (entry.size / 1024).toFixed(1),
201
- createdAt: new Date(entry.createdAt).toISOString(),
202
- lastAccessedAt: new Date(entry.lastAccessedAt).toISOString(),
203
- expiresAt: new Date(entry.expiresAt).toISOString(),
204
- remainingSeconds: Math.max(0, Math.floor((entry.expiresAt - now) / 1e3)),
205
- accessCount: entry.accessCount,
206
- isExpired: now > entry.expiresAt
207
- }));
208
- entries.sort((a, b) => new Date(b.lastAccessedAt).getTime() - new Date(a.lastAccessedAt).getTime());
209
- return entries;
210
- }
211
- clear() {
212
- this.cache.clear();
213
- logger.info("Cleared all detailed data cache");
214
- }
215
- };
216
- //#endregion
217
- export { DetailedDataManager as t };