@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
@@ -14,9 +14,9 @@
14
14
  */
15
15
  var ResponseBuilder = class {
16
16
  payload = {};
17
- _isError = false;
18
- _additionalContent = [];
19
- _useStructured = false;
17
+ hasMcpError = false;
18
+ additionalContent = [];
19
+ useStructuredContent = false;
20
20
  /** Mark as success (sets `success: true`). */
21
21
  ok() {
22
22
  this.payload.success = true;
@@ -42,12 +42,12 @@ var ResponseBuilder = class {
42
42
  }
43
43
  /** Set MCP-level `isError: true` on the response envelope. */
44
44
  mcpError() {
45
- this._isError = true;
45
+ this.hasMcpError = true;
46
46
  return this;
47
47
  }
48
48
  /** Push an image block to the final response. */
49
49
  image(base64, mimeType) {
50
- this._additionalContent.push({
50
+ this.additionalContent.push({
51
51
  type: "image",
52
52
  data: base64,
53
53
  mimeType
@@ -56,7 +56,7 @@ var ResponseBuilder = class {
56
56
  }
57
57
  /** Push an embedded resource block to the final response. */
58
58
  embeddedResource(uri, text, mimeType = "text/plain") {
59
- this._additionalContent.push({
59
+ this.additionalContent.push({
60
60
  type: "resource",
61
61
  resource: {
62
62
  uri,
@@ -68,7 +68,7 @@ var ResponseBuilder = class {
68
68
  }
69
69
  /** Send output payload natively as `structuredContent` in the MCP envelope instead of stringifying inside text block. */
70
70
  structured() {
71
- this._useStructured = true;
71
+ this.useStructuredContent = true;
72
72
  return this;
73
73
  }
74
74
  /**
@@ -81,9 +81,9 @@ var ResponseBuilder = class {
81
81
  content: [{
82
82
  type: "text",
83
83
  text: JSON.stringify(this.payload, null, 2)
84
- }, ...this._additionalContent],
85
- ...this._isError ? { isError: true } : {},
86
- ...this._useStructured ? { structuredContent: this.payload } : {}
84
+ }, ...this.additionalContent],
85
+ ...this.hasMcpError ? { isError: true } : {},
86
+ ...this.useStructuredContent ? { structuredContent: this.payload } : {}
87
87
  };
88
88
  }
89
89
  /** Alias for json(). */
@@ -1,7 +1,8 @@
1
1
  import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { B as DOM_WAIT_ELEMENT_TIMEOUT_MS, z as DOM_QUERY_DEFAULT_LIMIT } from "./constants-B0OANIBL.mjs";
3
- import { t as getCodeCacheDir } from "./outputPaths-B1uGmrWZ.mjs";
4
- import { t as PrerequisiteError } from "./PrerequisiteError-Dl33Svkz.mjs";
2
+ import { B as DOM_QUERY_DEFAULT_LIMIT, V as DOM_WAIT_ELEMENT_TIMEOUT_MS } from "./constants-CDZLOoVv.mjs";
3
+ import { t as getCodeCacheDir } from "./outputPaths-um7lCRY3.mjs";
4
+ import { t as PrerequisiteError } from "./PrerequisiteError-TuyZIs6n.mjs";
5
+ import { n as detachFromFlatTarget, t as attachToFlatTarget } from "./flat-target-session-Dgax2Cy3.mjs";
5
6
  import { createRequire } from "node:module";
6
7
  import { existsSync } from "fs";
7
8
  import path, { join } from "path";
@@ -11,7 +12,6 @@ import { promisify } from "util";
11
12
  import { connect, executablePath, launch } from "rebrowser-puppeteer-core";
12
13
  import fs, { readFile } from "fs/promises";
13
14
  import { gunzip, gzip } from "zlib";
14
- import { EventEmitter } from "node:events";
15
15
  import { homedir } from "os";
16
16
  import { setImmediate } from "node:timers/promises";
17
17
  //#region src/modules/collector/CodeCache.ts
@@ -579,122 +579,6 @@ var CodeCompressor = class {
579
579
  }
580
580
  };
581
581
  //#endregion
582
- //#region src/modules/browser/AttachedTargetSession.ts
583
- var AttachedTargetSession = class {
584
- emitter = new EventEmitter();
585
- pending = /* @__PURE__ */ new Map();
586
- nextCommandId = 1;
587
- detached = false;
588
- constructor(parentSession, sessionId) {
589
- this.parentSession = parentSession;
590
- this.sessionId = sessionId;
591
- this.parentSession.on("Target.receivedMessageFromTarget", this.handleReceivedMessage);
592
- this.parentSession.on("Target.detachedFromTarget", this.handleDetachedFromTarget);
593
- }
594
- id() {
595
- return this.sessionId;
596
- }
597
- on(event, listener) {
598
- this.emitter.on(event, listener);
599
- return this;
600
- }
601
- off(event, listener) {
602
- this.emitter.off(event, listener);
603
- return this;
604
- }
605
- async send(method, params = {}) {
606
- if (this.detached) throw new Error(`CDP target session ${this.sessionId} is detached`);
607
- const commandId = this.nextCommandId++;
608
- const message = JSON.stringify({
609
- id: commandId,
610
- method,
611
- params
612
- });
613
- return await new Promise((resolve, reject) => {
614
- this.pending.set(commandId, {
615
- resolve,
616
- reject
617
- });
618
- this.parentSession.send("Target.sendMessageToTarget", {
619
- sessionId: this.sessionId,
620
- message
621
- }).catch((error) => {
622
- this.pending.delete(commandId);
623
- reject(error);
624
- });
625
- });
626
- }
627
- async detach() {
628
- if (this.detached) return;
629
- try {
630
- await this.parentSession.send("Target.detachFromTarget", { sessionId: this.sessionId });
631
- } finally {
632
- this.dispose(/* @__PURE__ */ new Error(`CDP target session ${this.sessionId} detached`));
633
- }
634
- }
635
- handleReceivedMessage = (payload) => {
636
- if (!this.matchesSession(payload)) return;
637
- const rawMessage = this.readString(payload, "message");
638
- if (!rawMessage) return;
639
- let parsed;
640
- try {
641
- parsed = JSON.parse(rawMessage);
642
- } catch (error) {
643
- logger.debug(`[AttachedTargetSession] Failed to parse incoming target message for ${this.sessionId}: ${String(error)}`);
644
- return;
645
- }
646
- if (!this.isRecord(parsed)) return;
647
- const commandId = typeof parsed.id === "number" ? parsed.id : null;
648
- if (commandId !== null) {
649
- const pending = this.pending.get(commandId);
650
- if (!pending) return;
651
- this.pending.delete(commandId);
652
- if (parsed.error) pending.reject(this.normalizeError(parsed.error));
653
- else pending.resolve(parsed.result ?? null);
654
- return;
655
- }
656
- const method = typeof parsed.method === "string" ? parsed.method : null;
657
- if (!method) return;
658
- this.emitter.emit(method, parsed.params ?? {});
659
- };
660
- handleDetachedFromTarget = (payload) => {
661
- if (!this.matchesSession(payload)) return;
662
- this.dispose(/* @__PURE__ */ new Error(`CDP target session ${this.sessionId} detached by browser`));
663
- };
664
- matchesSession(payload) {
665
- return this.readString(payload, "sessionId") === this.sessionId;
666
- }
667
- dispose(reason) {
668
- if (this.detached) return;
669
- this.detached = true;
670
- this.parentSession.off("Target.receivedMessageFromTarget", this.handleReceivedMessage);
671
- this.parentSession.off("Target.detachedFromTarget", this.handleDetachedFromTarget);
672
- for (const pending of this.pending.values()) pending.reject(reason);
673
- this.pending.clear();
674
- this.emitter.emit("disconnected", {
675
- sessionId: this.sessionId,
676
- reason: reason.message
677
- });
678
- this.emitter.removeAllListeners();
679
- }
680
- normalizeError(error) {
681
- if (error instanceof Error) return error;
682
- if (this.isRecord(error)) {
683
- const message = typeof error.message === "string" && error.message || typeof error.data === "string" && error.data || JSON.stringify(error);
684
- return new Error(message || "CDP target command failed");
685
- }
686
- return new Error(String(error));
687
- }
688
- isRecord(value) {
689
- return typeof value === "object" && value !== null;
690
- }
691
- readString(payload, key) {
692
- if (!this.isRecord(payload)) return null;
693
- const value = payload[key];
694
- return typeof value === "string" ? value : null;
695
- }
696
- };
697
- //#endregion
698
582
  //#region src/modules/browser/BrowserTargetSessionManager.ts
699
583
  var BrowserTargetSessionManager = class {
700
584
  browserSession = null;
@@ -725,12 +609,7 @@ var BrowserTargetSessionManager = class {
725
609
  if (!target) throw new Error(`CDP target not found: ${targetId}`);
726
610
  await this.detach();
727
611
  const session = await this.ensureBrowserSession();
728
- const response = await session.send("Target.attachToTarget", {
729
- targetId,
730
- flatten: true
731
- });
732
- if (!response.sessionId) throw new Error(`Target.attachToTarget did not return sessionId for ${targetId}`);
733
- this.attachedTargetSession = new AttachedTargetSession(session, response.sessionId);
612
+ this.attachedTargetSession = await attachToFlatTarget(session, targetId);
734
613
  this.attachedTargetInfo = target;
735
614
  return target;
736
615
  }
@@ -739,10 +618,11 @@ var BrowserTargetSessionManager = class {
739
618
  this.attachedTargetInfo = null;
740
619
  return false;
741
620
  }
621
+ if (!this.browserSession) throw new Error("Browser CDP session unavailable for target detach");
742
622
  const session = this.attachedTargetSession;
623
+ await detachFromFlatTarget(this.browserSession, session);
743
624
  this.attachedTargetSession = null;
744
625
  this.attachedTargetInfo = null;
745
- await session.detach();
746
626
  return true;
747
627
  }
748
628
  getAttachedTargetSession() {
@@ -1075,7 +955,18 @@ async function collectInnerImpl(self, options) {
1075
955
  }
1076
956
  await self.init();
1077
957
  if (!self.browser) throw new Error("Browser not initialized");
1078
- const page = await self.browser.newPage();
958
+ let previousActivePageIndex = null;
959
+ const activePageContext = (typeof self.listPages === "function" ? await self.listPages().catch(() => []) : []).length > 0 && typeof self.getActivePage === "function" ? await self.getActivePage().then((page) => page.browserContext()).catch((error) => {
960
+ logger.debug("Failed to resolve active browser context before code collection:", error);
961
+ return null;
962
+ }) : null;
963
+ const temporaryContext = activePageContext === null && typeof self.browser.createBrowserContext === "function" ? await self.browser.createBrowserContext() : null;
964
+ if ((activePageContext !== null || !temporaryContext) && typeof self.getActivePageIndex === "function") try {
965
+ previousActivePageIndex = await self.getActivePageIndex();
966
+ } catch (error) {
967
+ logger.debug("Failed to capture active page index before code collection:", error);
968
+ }
969
+ const page = activePageContext !== null ? await activePageContext.newPage() : temporaryContext ? await temporaryContext.newPage() : await self.browser.newPage();
1079
970
  try {
1080
971
  const timeoutMs = options.timeout ?? self.config.timeout ?? 3e4;
1081
972
  page.setDefaultTimeout(timeoutMs);
@@ -1275,7 +1166,19 @@ async function collectInnerImpl(self, options) {
1275
1166
  self.cdpSession = null;
1276
1167
  self.cdpListeners = {};
1277
1168
  }
1278
- await page.close();
1169
+ if (temporaryContext) try {
1170
+ await temporaryContext.close();
1171
+ } catch (error) {
1172
+ logger.debug("Failed to close temporary browser context after code collection:", error);
1173
+ }
1174
+ else {
1175
+ await page.close();
1176
+ if (previousActivePageIndex !== null && typeof self.selectPage === "function") try {
1177
+ await self.selectPage(previousActivePageIndex);
1178
+ } catch (error) {
1179
+ logger.debug("Failed to restore active page after code collection:", error);
1180
+ }
1181
+ }
1279
1182
  }
1280
1183
  }
1281
1184
  //#endregion
@@ -1358,8 +1261,8 @@ function ensureElectronDownloadBehaviorCompatPatch() {
1358
1261
  electronCompatPatched = true;
1359
1262
  return;
1360
1263
  }
1361
- const originalInitialize = CRBrowserContext.prototype._initialize;
1362
- CRBrowserContext.prototype._initialize = async function patchedInitialize(...args) {
1264
+ const originalInitialize = CRBrowserContext.prototype.initialize;
1265
+ CRBrowserContext.prototype.initialize = async function patchedInitialize(...args) {
1363
1266
  try {
1364
1267
  return await originalInitialize.apply(this, args);
1365
1268
  } catch (error) {
@@ -1426,8 +1329,14 @@ function createPageAdapter(playwrightPage, pageCache) {
1426
1329
  if (typeof context.newCDPSession !== "function") throw new Error("Playwright BrowserContext does not expose newCDPSession() for the attached page.");
1427
1330
  return await context.newCDPSession(playwrightPage);
1428
1331
  },
1429
- async setUserAgent(_userAgent) {
1430
- logger.debug("[playwright-cdp-fallback] Ignoring page.setUserAgent() for attached Playwright CDP page.");
1332
+ async setUserAgent(userAgent) {
1333
+ const context = playwrightPage.context();
1334
+ if (typeof context.newCDPSession !== "function") {
1335
+ logger.debug("[playwright-cdp-fallback] Cannot apply UA override: newCDPSession unavailable.");
1336
+ return;
1337
+ }
1338
+ await (await context.newCDPSession(playwrightPage)).send("Network.setUserAgentOverride", { userAgent });
1339
+ logger.debug("[playwright-cdp-fallback] Applied user agent override via CDP session.");
1431
1340
  }
1432
1341
  }, { get(target, prop, receiver) {
1433
1342
  if (Reflect.has(target, prop)) {
@@ -1689,6 +1598,84 @@ function getTopPriorityFilesImpl(collectedFilesCache, topN, maxTotalSize) {
1689
1598
  };
1690
1599
  }
1691
1600
  //#endregion
1601
+ //#region src/modules/collector/CodeCollectorLaunchOptions.ts
1602
+ const DEFAULT_CHROME_ARGS = [
1603
+ "--no-sandbox",
1604
+ "--disable-setuid-sandbox",
1605
+ "--disable-dev-shm-usage",
1606
+ "--disable-blink-features=AutomationControlled",
1607
+ "--disable-extensions",
1608
+ "--disable-component-extensions-with-background-pages",
1609
+ "--disable-web-security",
1610
+ "--disable-features=IsolateOrigins,site-per-process",
1611
+ "--ignore-certificate-errors"
1612
+ ];
1613
+ function normalizeStringArray(values) {
1614
+ if (!Array.isArray(values)) return [];
1615
+ return values.map((value) => value.trim()).filter((value) => value.length > 0);
1616
+ }
1617
+ function splitJsFlags(value) {
1618
+ return value.split(/\s+/u).map((flag) => flag.trim()).filter((flag) => flag.length > 0);
1619
+ }
1620
+ function dedupeArgs(args) {
1621
+ const seen = /* @__PURE__ */ new Set();
1622
+ const deduped = [];
1623
+ for (const arg of args) {
1624
+ if (seen.has(arg)) continue;
1625
+ seen.add(arg);
1626
+ deduped.push(arg);
1627
+ }
1628
+ return deduped;
1629
+ }
1630
+ function mergeJsFlags(args, enableV8NativesSyntax) {
1631
+ const passthroughArgs = [];
1632
+ const jsFlags = [];
1633
+ for (let index = 0; index < args.length; index += 1) {
1634
+ const current = args[index];
1635
+ if (!current) continue;
1636
+ if (current === "--js-flags") {
1637
+ const next = args[index + 1];
1638
+ if (typeof next === "string") {
1639
+ jsFlags.push(...splitJsFlags(next));
1640
+ index += 1;
1641
+ continue;
1642
+ }
1643
+ }
1644
+ if (current.startsWith("--js-flags=")) {
1645
+ jsFlags.push(...splitJsFlags(current.slice(11)));
1646
+ continue;
1647
+ }
1648
+ passthroughArgs.push(current);
1649
+ }
1650
+ const normalizedJsFlags = dedupeArgs(jsFlags);
1651
+ const allowNativesSyntax = "--allow-natives-syntax";
1652
+ if (enableV8NativesSyntax !== false && !normalizedJsFlags.includes(allowNativesSyntax)) normalizedJsFlags.push(allowNativesSyntax);
1653
+ const filteredJsFlags = enableV8NativesSyntax === false ? normalizedJsFlags.filter((flag) => flag !== allowNativesSyntax) : normalizedJsFlags;
1654
+ return {
1655
+ args: filteredJsFlags.length > 0 ? [...dedupeArgs(passthroughArgs), `--js-flags=${filteredJsFlags.join(" ")}`] : dedupeArgs(passthroughArgs),
1656
+ v8NativeSyntaxEnabled: filteredJsFlags.includes(allowNativesSyntax)
1657
+ };
1658
+ }
1659
+ function resolveChromeLaunchOptions(config, overrides, executablePath, viewport) {
1660
+ const merged = mergeJsFlags([
1661
+ ...normalizeStringArray(config.args),
1662
+ ...normalizeStringArray(overrides?.args),
1663
+ ...DEFAULT_CHROME_ARGS,
1664
+ `--window-size=${viewport.width},${viewport.height}`
1665
+ ], overrides?.enableV8NativesSyntax);
1666
+ return {
1667
+ headless: overrides?.headless ?? config.headless,
1668
+ args: merged.args,
1669
+ executablePath,
1670
+ v8NativeSyntaxEnabled: merged.v8NativeSyntaxEnabled
1671
+ };
1672
+ }
1673
+ function sameChromeLaunchOptions(left, right) {
1674
+ if (!left) return false;
1675
+ if (left.headless !== right.headless || left.executablePath !== right.executablePath || left.v8NativeSyntaxEnabled !== right.v8NativeSyntaxEnabled || left.args.length !== right.args.length) return false;
1676
+ return left.args.every((arg, index) => arg === right.args[index]);
1677
+ }
1678
+ //#endregion
1692
1679
  //#region src/modules/collector/CodeCollector.ts
1693
1680
  var CodeCollector = class CodeCollector {
1694
1681
  config;
@@ -1714,6 +1701,7 @@ var CodeCollector = class CodeCollector {
1714
1701
  cdpListeners = {};
1715
1702
  activePageIndex = null;
1716
1703
  currentHeadless = null;
1704
+ currentLaunchOptions = null;
1717
1705
  explicitlyClosed = false;
1718
1706
  connectedToExistingBrowser = false;
1719
1707
  /** PID of the Chrome child process launched by puppeteer, used for force-kill fallback. */
@@ -1784,56 +1772,59 @@ var CodeCollector = class CodeCollector {
1784
1772
  }
1785
1773
  }
1786
1774
  async init(headless) {
1787
- if (this.browser) return;
1775
+ await this.launch(headless === void 0 ? void 0 : { headless });
1776
+ }
1777
+ async launch(overrides) {
1778
+ if (this.initPromise) await this.initPromise;
1779
+ const executablePath = this.resolveExecutablePath();
1780
+ const launchOptions = resolveChromeLaunchOptions(this.config, overrides, executablePath, this.viewport);
1781
+ if (this.browser && overrides === void 0) {
1782
+ this.explicitlyClosed = false;
1783
+ return {
1784
+ action: "reused",
1785
+ launchOptions: this.currentLaunchOptions ?? launchOptions
1786
+ };
1787
+ }
1788
+ if (this.browser && !this.connectedToExistingBrowser && sameChromeLaunchOptions(this.currentLaunchOptions, launchOptions)) {
1789
+ this.explicitlyClosed = false;
1790
+ return {
1791
+ action: "reused",
1792
+ launchOptions
1793
+ };
1794
+ }
1795
+ const action = this.browser ? "relaunched" : "launched";
1796
+ const reason = this.browser ? this.connectedToExistingBrowser ? "replacing-existing-browser-connection" : "launch-options-changed" : void 0;
1788
1797
  this.explicitlyClosed = false;
1789
- if (this.initPromise) return this.initPromise;
1790
- this.initPromise = this.initInner(headless);
1798
+ this.initPromise = this.launchInner(launchOptions);
1791
1799
  try {
1792
1800
  await this.initPromise;
1793
1801
  } finally {
1794
1802
  this.initPromise = null;
1795
1803
  }
1804
+ return {
1805
+ action,
1806
+ launchOptions,
1807
+ ...reason ? { reason } : {}
1808
+ };
1796
1809
  }
1797
- async initInner(headless) {
1798
- const useHeadless = headless ?? this.config.headless;
1799
- const executablePath = this.resolveExecutablePath();
1800
- const launchOptions = {
1801
- headless: useHeadless,
1802
- args: [
1803
- ...this.config.args || [],
1804
- "--no-sandbox",
1805
- "--disable-setuid-sandbox",
1806
- "--disable-dev-shm-usage",
1807
- "--disable-blink-features=AutomationControlled",
1808
- "--disable-extensions",
1809
- "--disable-component-extensions-with-background-pages",
1810
- "--disable-web-security",
1811
- "--disable-features=IsolateOrigins,site-per-process",
1812
- `--window-size=${this.viewport.width},${this.viewport.height}`,
1813
- "--ignore-certificate-errors"
1814
- ],
1810
+ async launchInner(launchOptions) {
1811
+ if (this.browser) await this.disposeCurrentBrowser(false);
1812
+ const browserLaunchOptions = {
1813
+ headless: launchOptions.headless,
1814
+ args: launchOptions.args,
1815
1815
  defaultViewport: this.viewport,
1816
1816
  protocolTimeout: 6e4
1817
1817
  };
1818
- if (executablePath) launchOptions.executablePath = executablePath;
1818
+ if (launchOptions.executablePath) browserLaunchOptions.executablePath = launchOptions.executablePath;
1819
1819
  logger.info("Initializing browser with anti-detection...");
1820
- this.browser = await launch(launchOptions);
1820
+ this.browser = await launch(browserLaunchOptions);
1821
1821
  this.connectedToExistingBrowser = false;
1822
1822
  this.chromePid = this.browser.process()?.pid ?? null;
1823
1823
  if (this.chromePid) logger.debug(`Chrome child process PID: ${this.chromePid}`);
1824
- this.currentHeadless = useHeadless === void 0 ? true : useHeadless !== false;
1824
+ this.currentHeadless = launchOptions.headless;
1825
+ this.currentLaunchOptions = launchOptions;
1825
1826
  this.browser.on("disconnected", () => {
1826
- logger.warn("Browser disconnected");
1827
- this.browser = null;
1828
- this.currentHeadless = null;
1829
- this.connectedToExistingBrowser = false;
1830
- this.chromePid = null;
1831
- this.browserTargetSessionManager?.dispose();
1832
- this.browserTargetSessionManager = null;
1833
- if (this.cdpSession) {
1834
- this.cdpSession = null;
1835
- this.cdpListeners = {};
1836
- }
1827
+ this.handleBrowserDisconnected();
1837
1828
  });
1838
1829
  logger.success("Browser initialized with enhanced anti-detection");
1839
1830
  }
@@ -1847,15 +1838,30 @@ var CodeCollector = class CodeCollector {
1847
1838
  if (detectedPath) return detectedPath;
1848
1839
  logger.info("No explicit browser executable configured. Falling back to Puppeteer-managed browser resolution.");
1849
1840
  }
1850
- async close() {
1841
+ handleBrowserDisconnected() {
1842
+ logger.warn("Browser disconnected");
1843
+ this.browser = null;
1844
+ this.currentHeadless = null;
1845
+ this.currentLaunchOptions = null;
1846
+ this.connectedToExistingBrowser = false;
1847
+ this.chromePid = null;
1848
+ this.browserTargetSessionManager?.dispose();
1849
+ this.browserTargetSessionManager = null;
1850
+ if (this.cdpSession) {
1851
+ this.cdpSession = null;
1852
+ this.cdpListeners = {};
1853
+ }
1854
+ }
1855
+ async disposeCurrentBrowser(markExplicitlyClosed) {
1851
1856
  await this.clearAllData();
1852
- this.explicitlyClosed = true;
1857
+ this.explicitlyClosed = markExplicitlyClosed;
1853
1858
  this.activePageIndex = null;
1854
1859
  const browser = this.browser;
1855
1860
  const disconnectOnly = this.connectedToExistingBrowser;
1856
1861
  const pid = this.chromePid;
1857
1862
  this.browser = null;
1858
1863
  this.currentHeadless = null;
1864
+ this.currentLaunchOptions = null;
1859
1865
  this.connectedToExistingBrowser = false;
1860
1866
  this.chromePid = null;
1861
1867
  await this.browserTargetSessionManager?.dispose();
@@ -1866,6 +1872,9 @@ var CodeCollector = class CodeCollector {
1866
1872
  }
1867
1873
  if (browser) if (disconnectOnly) await browser.disconnect();
1868
1874
  else await this.closeBrowserWithForceKill(browser, pid);
1875
+ }
1876
+ async close() {
1877
+ await this.disposeCurrentBrowser(true);
1869
1878
  logger.info("Browser closed and all data cleared");
1870
1879
  }
1871
1880
  /**
@@ -1926,6 +1935,14 @@ var CodeCollector = class CodeCollector {
1926
1935
  if (!lastTarget) throw new Error("Failed to get active page");
1927
1936
  return await this.resolvePageTargetHandle(lastTarget);
1928
1937
  }
1938
+ async getActivePageIndex() {
1939
+ const activePage = await this.getActivePage();
1940
+ const resolvedPages = await this.listResolvedPages();
1941
+ const exactMatch = resolvedPages.find((entry) => entry.page === activePage);
1942
+ if (exactMatch) return exactMatch.index;
1943
+ const activeUrl = activePage.url();
1944
+ return resolvedPages.find((entry) => entry.url === activeUrl)?.index ?? null;
1945
+ }
1929
1946
  async listPages() {
1930
1947
  if (!this.browser) return [];
1931
1948
  return this.getPageTargets().map((target, index) => ({
@@ -2014,7 +2031,10 @@ var CodeCollector = class CodeCollector {
2014
2031
  running: true,
2015
2032
  pagesCount: this.getPageTargets().length,
2016
2033
  version,
2017
- effectiveHeadless: this.currentHeadless ?? void 0
2034
+ effectiveHeadless: this.currentHeadless ?? void 0,
2035
+ launchSource: this.connectedToExistingBrowser ? "attached" : "launched",
2036
+ v8NativeSyntaxEnabled: this.currentLaunchOptions?.v8NativeSyntaxEnabled,
2037
+ launchArgs: this.currentLaunchOptions?.args ? [...this.currentLaunchOptions.args] : []
2018
2038
  };
2019
2039
  } catch (error) {
2020
2040
  logger.debug("Browser not running or disconnected:", error);
@@ -2068,32 +2088,15 @@ var CodeCollector = class CodeCollector {
2068
2088
  }
2069
2089
  async connect(endpointOrOptions) {
2070
2090
  this.explicitlyClosed = false;
2071
- await this.browserTargetSessionManager?.dispose();
2072
- this.browserTargetSessionManager = null;
2073
- if (this.browser) {
2074
- try {
2075
- await this.browser.disconnect();
2076
- } catch {}
2077
- this.browser = null;
2078
- this.currentHeadless = null;
2079
- }
2080
- this.activePageIndex = null;
2091
+ if (this.browser || this.browserTargetSessionManager || this.cdpSession) await this.disposeCurrentBrowser(false);
2081
2092
  const connectOptions = await this.resolveConnectOptions(endpointOrOptions);
2082
2093
  const target = connectOptions.browserWSEndpoint ?? connectOptions.browserURL ?? "auto-detected Chrome debugging endpoint";
2083
2094
  logger.info(`Connecting to existing browser: ${target}`);
2084
2095
  this.browser = await this.connectWithTimeout(connectOptions, target, endpointOrOptions);
2085
2096
  this.connectedToExistingBrowser = true;
2097
+ this.currentLaunchOptions = null;
2086
2098
  this.browser.on("disconnected", () => {
2087
- logger.warn("Browser disconnected");
2088
- this.browser = null;
2089
- this.currentHeadless = null;
2090
- this.connectedToExistingBrowser = false;
2091
- this.browserTargetSessionManager?.dispose();
2092
- this.browserTargetSessionManager = null;
2093
- if (this.cdpSession) {
2094
- this.cdpSession = null;
2095
- this.cdpListeners = {};
2096
- }
2099
+ this.handleBrowserDisconnected();
2097
2100
  });
2098
2101
  logger.success("Connected to existing browser successfully");
2099
2102
  }
@@ -2727,7 +2730,6 @@ var ScriptManager = class ScriptManager {
2727
2730
  async doInit() {
2728
2731
  const page = await this.collector.getActivePage();
2729
2732
  this.cdpSession = await page.createCDPSession();
2730
- await this.cdpSession.send("Debugger.enable");
2731
2733
  this.cdpSession.on("Debugger.scriptParsed", (params) => {
2732
2734
  const scriptInfo = {
2733
2735
  scriptId: params.scriptId,
@@ -2745,6 +2747,7 @@ var ScriptManager = class ScriptManager {
2745
2747
  }
2746
2748
  logger.debug(`Script parsed: ${params.url || "inline"} (${params.scriptId})`);
2747
2749
  });
2750
+ await this.cdpSession.send("Debugger.enable");
2748
2751
  this.initialized = true;
2749
2752
  logger.info("ScriptManager initialized");
2750
2753
  }
@@ -1,5 +1,5 @@
1
- import { _ as WriteProcessMemory, b as openProcessForMemory, c as GetProcAddress, d as ReadProcessMemory, f as VirtualAllocEx, l as MEM, m as VirtualProtectEx, o as GetModuleHandle, p as VirtualFreeEx, t as CloseHandle, u as PAGE } from "./Win32API-CePkipZY.mjs";
2
- import { l as FlushInstructionCache } from "./Win32Debug-BvKs-gxc.mjs";
1
+ import { _ as WriteProcessMemory, b as openProcessForMemory, c as GetProcAddress, d as ReadProcessMemory, f as VirtualAllocEx, l as MEM, m as VirtualProtectEx, o as GetModuleHandle, p as VirtualFreeEx, t as CloseHandle, u as PAGE } from "./Win32API-C2kjj0ze.mjs";
2
+ import { l as FlushInstructionCache } from "./Win32Debug-CKrGOTpo.mjs";
3
3
  //#region src/native/Speedhack.ts
4
4
  var Speedhack = class {
5
5
  states = /* @__PURE__ */ new Map();
@@ -1,6 +1,6 @@
1
- import { ir as STRUCT_VTABLE_MAX_FUNCTIONS, nr as STRUCT_ANALYZE_DEFAULT_SIZE, rr as STRUCT_RTTI_MAX_STRING_LEN } from "./constants-B0OANIBL.mjs";
2
- import { t as createPlatformProvider } from "./factory-DxlGh9Xf.mjs";
3
- import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-dZtA1ZGn.mjs";
1
+ import { dr as STRUCT_VTABLE_MAX_FUNCTIONS, lr as STRUCT_ANALYZE_DEFAULT_SIZE, ur as STRUCT_RTTI_MAX_STRING_LEN } from "./constants-CDZLOoVv.mjs";
2
+ import { t as createPlatformProvider } from "./factory-C90tBff6.mjs";
3
+ import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-D9Lkovvn.mjs";
4
4
  //#region src/native/StructureAnalyzer.ts
5
5
  /**
6
6
  * Structure Analyzer — heuristic memory structure inference.
@@ -13,10 +13,13 @@ import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-dZtA1ZGn.mj
13
13
  * @module StructureAnalyzer
14
14
  */
15
15
  var StructureAnalyzer = class {
16
- _provider = null;
16
+ providerCache = null;
17
17
  get provider() {
18
- if (!this._provider) this._provider = createPlatformProvider();
19
- return this._provider;
18
+ if (!this.providerCache) this.providerCache = createPlatformProvider();
19
+ return this.providerCache;
20
+ }
21
+ set provider(value) {
22
+ this.providerCache = value;
20
23
  }
21
24
  /**
22
25
  * Infer the structure layout at a given address.