@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.
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/dist/{AntiCheatDetector-BNk-EoBt.mjs → AntiCheatDetector-CqGDXmfc.mjs} +159 -53
- package/dist/{CodeInjector-Cq8q01kp.mjs → CodeInjector-BdjRfNx7.mjs} +5 -5
- package/dist/{ConsoleMonitor-CPVQW1Y-.mjs → ConsoleMonitor-DykL3IAw.mjs} +85 -17
- package/dist/{DetailedDataManager-BQQcxh64.mjs → DetailedDataManager-HT49OrvF.mjs} +1 -1
- package/dist/{ExtensionManager-CWYgw0YW.mjs → ExtensionManager-BDMsY2Dz.mjs} +15 -8
- package/dist/{HardwareBreakpoint-B9gZCdFP.mjs → HardwareBreakpoint-Cc2AFq1Y.mjs} +3 -3
- package/dist/{HeapAnalyzer-BLDH0dCv.mjs → HeapAnalyzer-DruMgsgj.mjs} +20 -20
- package/dist/{HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs → HookGeneratorBuilders.core.generators.storage-CTbB4Lcx.mjs} +1 -74
- package/dist/{InstrumentationSession-CvPC7Jwy.mjs → InstrumentationSession-DLH0vd-z.mjs} +2 -2
- package/dist/{MemoryController-CbVdCIJF.mjs → MemoryController-CMtviNW_.mjs} +3 -3
- package/dist/{MemoryScanSession-BsDZbLYm.mjs → MemoryScanSession-ITgb_NMi.mjs} +2 -2
- package/dist/{MemoryScanner-Bcpml6II.mjs → MemoryScanner-CiL7Z3ey.mjs} +12 -9
- package/dist/{NativeMemoryManager.impl-dZtA1ZGn.mjs → NativeMemoryManager.impl-D9Lkovvn.mjs} +13 -10
- package/dist/{NativeMemoryManager.utils-B-FjA2mJ.mjs → NativeMemoryManager.utils-BBlAixF5.mjs} +1 -1
- package/dist/{PEAnalyzer-D1lzJ_VG.mjs → PEAnalyzer-DMQ44gen.mjs} +15 -15
- package/dist/{PageController-Bqm2kZ_X.mjs → PageController-BPJNqqBN.mjs} +18 -4
- package/dist/{PointerChainEngine-BOhyVsjx.mjs → PointerChainEngine-K7wN8Z-w.mjs} +10 -7
- package/dist/ProcessRegistry-zGg12QbE.mjs +74 -0
- package/dist/{ResponseBuilder-D3iFYx2N.mjs → ResponseBuilder-CJXWmWNw.mjs} +10 -10
- package/dist/{ScriptManager-aHHq0X7U.mjs → ScriptManager-ZuWD-0Jg.mjs} +195 -192
- package/dist/{Speedhack-CqdIFlQl.mjs → Speedhack-D-z0umeT.mjs} +2 -2
- package/dist/{StructureAnalyzer-DhFaPvRO.mjs → StructureAnalyzer-Cav5AVSL.mjs} +9 -6
- package/dist/{ToolCatalog-C0JGZoOm.mjs → ToolCatalog-5OJdMiF0.mjs} +81 -81
- package/dist/{ToolProbe-oC7aPrkv.mjs → ToolProbe-DbCFGyrg.mjs} +1 -1
- package/dist/{ToolRegistry-BjaF4oNz.mjs → ToolRegistry-B9krbTtI.mjs} +51 -2
- package/dist/{ToolRouter.policy-BWV67ZK-.mjs → ToolRouter.policy-BGDAGyeH.mjs} +60 -20
- package/dist/TraceRecorder-B41Z5XBj.mjs +1286 -0
- package/dist/{Win32API-CePkipZY.mjs → Win32API-C2kjj0ze.mjs} +18 -12
- package/dist/{Win32Debug-BvKs-gxc.mjs → Win32Debug-CKrGOTpo.mjs} +2 -2
- package/dist/{WorkflowEngine-CuvkZtWu.mjs → WorkflowEngine-DJ6M4opp.mjs} +226 -255
- package/dist/analysis-BHeJW2Nb.mjs +1234 -0
- package/dist/{antidebug-CqDTB_uk.mjs → antidebug-BRKeyt27.mjs} +3 -3
- package/dist/{artifactRetention-CFEprwPw.mjs → artifactRetention-CPXkUJXp.mjs} +13 -6
- package/dist/{artifacts-Bk2-_uPq.mjs → artifacts-DkfosXH3.mjs} +1 -1
- package/dist/authorization-schema-DRqyJMSk.mjs +31 -0
- package/dist/{binary-instrument-CXfpx6fT.mjs → binary-instrument--V3MAhJ4.mjs} +19 -27
- package/dist/bind-helpers-ClV34xdn.mjs +42 -0
- package/dist/{boringssl-inspector-BH2D3VKc.mjs → boringssl-inspector-Bo_LOLaS.mjs} +1 -1
- package/dist/{browser-BpOr5PEx.mjs → browser-Dx3_S2cG.mjs} +324 -37
- package/dist/capabilities-CcHlvWgK.mjs +33 -0
- package/dist/{constants-B0OANIBL.mjs → constants-CDZLOoVv.mjs} +18 -3
- package/dist/{coordination-qUbyF8KU.mjs → coordination-DgItD9DL.mjs} +2 -2
- package/dist/{debugger-gnKxRSN0.mjs → debugger-RS3RSAqs.mjs} +30 -13
- package/dist/definitions-BEoYofW5.mjs +47 -0
- package/dist/{definitions-bAhHQJq9.mjs → definitions-BRaefg3u.mjs} +11 -5
- package/dist/{definitions-DVGfrn7y.mjs → definitions-BbkvZkiv.mjs} +2 -2
- package/dist/definitions-BtWSHJ3o.mjs +17 -0
- package/dist/{definitions-BMfYXoNC.mjs → definitions-C1gCHO0i.mjs} +1 -1
- package/dist/{definitions-C1UvM5Iy.mjs → definitions-CDOg_b-l.mjs} +14 -2
- package/dist/definitions-CVPD9hzZ.mjs +54 -0
- package/dist/{definitions-Cke7zEb8.mjs → definitions-Cea8Lgl7.mjs} +1 -1
- package/dist/definitions-DAgIyjxM.mjs +10 -0
- package/dist/{definitions-B4rAvHNZ.mjs → definitions-DJA27nsL.mjs} +12 -9
- package/dist/{definitions-ClJLzsJQ.mjs → definitions-DKPFU3LW.mjs} +1 -1
- package/dist/{definitions-D3VsGcvz.mjs → definitions-DPRpZQ96.mjs} +7 -7
- package/dist/{definitions-B18eyf0B.mjs → definitions-DUE5gmdn.mjs} +1 -1
- package/dist/definitions-DYVjOtxa.mjs +26 -0
- package/dist/{definitions-BB_4jnmy.mjs → definitions-DcYLVLCo.mjs} +1 -1
- package/dist/{definitions-Beid2EB3.mjs → definitions-Pp5LI2H4.mjs} +1 -1
- package/dist/definitions-j9KdHVNR.mjs +14 -0
- package/dist/definitions-uzkjBwa7.mjs +258 -0
- package/dist/{definitions-Cq-zroAU.mjs → definitions-va-AnLuQ.mjs} +4 -4
- package/dist/{encoding-Bvz5jLRv.mjs → encoding-DJeqHmpd.mjs} +18 -4
- package/dist/{evidence-graph-bridge-C_fv9PuC.mjs → evidence-graph-bridge-DcYizFk2.mjs} +1 -0
- package/dist/{factory-DxlGh9Xf.mjs → factory-C90tBff6.mjs} +6 -6
- package/dist/flat-target-session-Dgax2Cy3.mjs +29 -0
- package/dist/{graphql-DYWzJ29s.mjs → graphql-CoHrhweh.mjs} +205 -34
- package/dist/{handlers-C67ktuRN.mjs → handlers-4jmR0nMs.mjs} +220 -32
- package/dist/{handlers-DlCJN4Td.mjs → handlers-BAHPxcch.mjs} +122 -90
- package/dist/{handlers-9sAbfIg-.mjs → handlers-BOs9b907.mjs} +849 -801
- package/dist/{handlers-DxGIq15_2.mjs → handlers-BWXEy6ef.mjs} +16 -16
- package/dist/{handlers-tB9Mp9ZK.mjs → handlers-Bndn6QvE.mjs} +31 -4
- package/dist/{handlers-CTsDAO6p.mjs → handlers-BqC4bD4s.mjs} +1 -1
- package/dist/{handlers-C87g8oCe.mjs → handlers-BtYq60bM2.mjs} +1 -1
- package/dist/{handlers-DeLOCd5m.mjs → handlers-BzgcB4iv.mjs} +17 -17
- package/dist/{handlers-Cgyg6c0U.mjs → handlers-CRyRWj2b.mjs} +237 -23
- package/dist/{handlers-U6L4xhuF.mjs → handlers-CVv2H1uq.mjs} +24 -17
- package/dist/{handlers-tiy7EIBp.mjs → handlers-Dl5a7JS4.mjs} +3 -3
- package/dist/{handlers-D6j6yka7.mjs → handlers-Dx2d7jt7.mjs} +1893 -1480
- package/dist/{handlers-Bl8zkwz1.mjs → handlers-Dz9PYsCa.mjs} +95 -6
- package/dist/handlers-HujRKC3b.mjs +661 -0
- package/dist/{handlers.impl-DS0d9fUw.mjs → handlers.impl-XWXkQfyi.mjs} +70 -24
- package/dist/{hooks-CzCWByww.mjs → hooks-B1B8NRHL.mjs} +3 -3
- package/dist/index.mjs +154 -144
- package/dist/{maintenance-P7ePRXQC.mjs → maintenance-PRMkLVRW.mjs} +35 -30
- package/dist/manifest-67Bok-Si.mjs +58 -0
- package/dist/{manifest-B3QVVeBS.mjs → manifest-6lNTMZAB2.mjs} +33 -28
- package/dist/manifest-B2duEHiH.mjs +90 -0
- package/dist/manifest-B6EY9Vm8.mjs +57 -0
- package/dist/{manifest-gZ4s_UtG.mjs → manifest-B6nKSbyY.mjs} +32 -33
- package/dist/{manifest-2ToTpjv8.mjs → manifest-BL8AQNPF.mjs} +31 -31
- package/dist/{manifest-DzwvxPJX.mjs → manifest-BSZvJJmV.mjs} +23 -14
- package/dist/{manifest-Sc_0JQ13.mjs → manifest-BU7qzUyX.mjs} +23 -23
- package/dist/{manifest-CT7zZBV1.mjs → manifest-Bl62e8WK.mjs} +24 -23
- package/dist/manifest-Bo5cXjdt.mjs +82 -0
- package/dist/manifest-BpS4gtUK.mjs +1347 -0
- package/dist/manifest-Bv65_e2W.mjs +101 -0
- package/dist/manifest-BytNIF4Z.mjs +117 -0
- package/dist/{manifest-BqrQ4Tpj.mjs → manifest-C-xtsjS3.mjs} +23 -23
- package/dist/{manifest-NXctwWQq.mjs → manifest-CDYl7OhA.mjs} +36 -38
- package/dist/manifest-CRZ3xmkD.mjs +61 -0
- package/dist/manifest-CoW6u4Tp.mjs +132 -0
- package/dist/manifest-Cq5zN_8A.mjs +50 -0
- package/dist/{manifest-CAhOuvSl.mjs → manifest-D7YZM_2e.mjs} +75 -85
- package/dist/{manifest-DCyjf4n2.mjs → manifest-DE_VrAeQ.mjs} +27 -7
- package/dist/manifest-DGsXSCpT.mjs +39 -0
- package/dist/{manifest-BB2J8IMJ.mjs → manifest-DJ2vfEuW.mjs} +48 -41
- package/dist/{manifest-3g71z6Bg.mjs → manifest-DPXDYhEu.mjs} +26 -25
- package/dist/manifest-Dd4fQb0a.mjs +322 -0
- package/dist/{manifest-CXsRWjjI.mjs → manifest-Deq6opGg.mjs} +95 -96
- package/dist/{manifest-C9RT5nk32.mjs → manifest-DfJTafJK.mjs} +14 -11
- package/dist/manifest-DgOdgN_j.mjs +50 -0
- package/dist/{manifest-BmtZzQiQ2.mjs → manifest-DlbMW4v4.mjs} +17 -15
- package/dist/{manifest-DrbmZcFl2.mjs → manifest-DmVfbH0w.mjs} +212 -91
- package/dist/manifest-Dog6Ddjr.mjs +109 -0
- package/dist/manifest-DvgU5FWb.mjs +58 -0
- package/dist/manifest-HsfDBs7j.mjs +50 -0
- package/dist/manifest-I8oQHvCG.mjs +186 -0
- package/dist/manifest-NvH_a-av.mjs +786 -0
- package/dist/{manifest-Dh8WBmEW.mjs → manifest-cEJU1v0Z.mjs} +24 -24
- package/dist/manifest-wOl5XLB12.mjs +112 -0
- package/dist/{modules-C184v-S9.mjs → modules-tZozf0LQ.mjs} +130 -860
- package/dist/{mojo-ipc-B_H61Afw.mjs → mojo-ipc-DXNEXEqb.mjs} +141 -26
- package/dist/{network-671Cw6hV.mjs → network-CPVvwvFg.mjs} +1329 -823
- package/dist/{outputPaths-B1uGmrWZ.mjs → outputPaths-um7lCRY3.mjs} +4 -8
- package/dist/{platform-WmNn8Sxb.mjs → platform-CYeFoTWp.mjs} +101 -10
- package/dist/{process-QcbIy5Zq.mjs → process-BTbgcVc6.mjs} +251 -346
- package/dist/{proxy-DqNs0bAd.mjs → proxy-r8YN6nP1.mjs} +30 -8
- package/dist/{registry-D-6e18lB.mjs → registry-Bl8ZQW61.mjs} +3 -3
- package/dist/{response-BQVP-xUn.mjs → response-CWhh2aLo.mjs} +7 -1
- package/dist/{shared-state-board-DV-dpHFJ.mjs → shared-state-board-BoZnSoj-.mjs} +2 -2
- package/dist/{sourcemap-Dq8ez8vS.mjs → sourcemap-BIDHUVXy.mjs} +350 -66
- package/dist/{streaming-BUQ0VJsg.mjs → streaming-Dal6utPp.mjs} +13 -13
- package/dist/{tool-builder-DCbIC5Eo.mjs → tool-builder-BHJp32mV.mjs} +1 -1
- package/dist/{transform-CiYJfNX0.mjs → transform-DRVgGG90.mjs} +18 -14
- package/dist/wasm-BYx5UOeG.mjs +1044 -0
- package/dist/webcrack-Be0_FccV.mjs +747 -0
- package/dist/{workflow-f3xJOcjx.mjs → workflow-BpuKEtvn.mjs} +8 -8
- package/package.json +76 -43
- package/dist/TraceRecorder-DgxyVbdQ.mjs +0 -519
- package/dist/analysis-CL9uACt9.mjs +0 -463
- package/dist/bind-helpers-xFfRF-qm.mjs +0 -22
- package/dist/definitions-6M-eejaT.mjs +0 -53
- package/dist/definitions-B3QdlrHv.mjs +0 -34
- package/dist/definitions-CXEI7QC72.mjs +0 -216
- package/dist/definitions-C_4r7Fo-2.mjs +0 -14
- package/dist/definitions-CkFDALoa.mjs +0 -26
- package/dist/definitions-Cy3Sl6gV.mjs +0 -34
- package/dist/definitions-LKpC3-nL.mjs +0 -9
- package/dist/handlers-DdFzXLvF.mjs +0 -446
- package/dist/manifest-82baTv4U.mjs +0 -45
- package/dist/manifest-BKbgbSiY.mjs +0 -60
- package/dist/manifest-Bcf-TJzH.mjs +0 -848
- package/dist/manifest-Bnd7kqEY.mjs +0 -55
- package/dist/manifest-BqQX6OQC2.mjs +0 -65
- package/dist/manifest-Br4RPFt5.mjs +0 -370
- package/dist/manifest-C5qDjysN.mjs +0 -107
- package/dist/manifest-CBYWCUBJ.mjs +0 -51
- package/dist/manifest-CFADCRa1.mjs +0 -37
- package/dist/manifest-CQVhavRF.mjs +0 -114
- package/dist/manifest-CV12bcrF.mjs +0 -121
- package/dist/manifest-CZLUCfG02.mjs +0 -95
- package/dist/manifest-D6phHKFd.mjs +0 -131
- package/dist/manifest-DHsnKgP6.mjs +0 -60
- package/dist/manifest-Df_dliIe.mjs +0 -55
- package/dist/manifest-DhKRAT8_.mjs +0 -92
- package/dist/manifest-DlpTj4ic2.mjs +0 -193
- package/dist/manifest-DuwHjUa5.mjs +0 -70
- package/dist/manifest-qSleDqdO.mjs +0 -1023
- package/dist/wasm-DQTnHDs4.mjs +0 -531
- /package/dist/{CacheAdapters-CDe5WPSV.mjs → CacheAdapters-jJFy20G-.mjs} +0 -0
- /package/dist/{DarwinAPI-BNPxu0RH.mjs → DarwinAPI-ETyy0xyo.mjs} +0 -0
- /package/dist/{EventBus-DgPmwpeu.mjs → EventBus-DFKvADm3.mjs} +0 -0
- /package/dist/{EvidenceGraphBridge-SFesNera.mjs → EvidenceGraphBridge-318Oi0Lf.mjs} +0 -0
- /package/dist/{FingerprintManager-gzWtkKuf.mjs → FingerprintManager-BN4UQWnX.mjs} +0 -0
- /package/dist/{PrerequisiteError-Dl33Svkz.mjs → PrerequisiteError-TuyZIs6n.mjs} +0 -0
- /package/dist/{ReverseEvidenceGraph-Dlsk94LC.mjs → ReverseEvidenceGraph-C02-gXOh.mjs} +0 -0
- /package/dist/{StealthVerifier-Bo4T3bz8.mjs → StealthVerifier-BWmPgQsv.mjs} +0 -0
- /package/dist/{VersionDetector-CwVLVdDM.mjs → VersionDetector-K3V4vGsw.mjs} +0 -0
- /package/dist/{betterSqlite3-0pqusHHH.mjs → betterSqlite3-DLSBZodi.mjs} +0 -0
- /package/dist/{concurrency-Bt0yv1kJ.mjs → concurrency-Drev_Vz9.mjs} +0 -0
- /package/dist/{formatAddress-DVkj9kpI.mjs → formatAddress-nnMvEohD.mjs} +0 -0
- /package/dist/{parse-args-BlRjqlkL.mjs → parse-args-B4cY5Vx5.mjs} +0 -0
- /package/dist/{ssrf-policy-ZaUfvhq7.mjs → ssrf-policy-Dsqd-DTX.mjs} +0 -0
- /package/dist/{types-CPhOReNX.mjs → types-DDBWs9UP.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as argString, r as argNumber, s as argStringRequired, t as argBool } from "./parse-args-
|
|
2
|
-
import { t as R } from "./ResponseBuilder-
|
|
3
|
-
import "./definitions-
|
|
1
|
+
import { a as argString, r as argNumber, s as argStringRequired, t as argBool } from "./parse-args-B4cY5Vx5.mjs";
|
|
2
|
+
import { t as R } from "./ResponseBuilder-CJXWmWNw.mjs";
|
|
3
|
+
import "./definitions-j9KdHVNR.mjs";
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import * as path$1 from "path";
|
|
6
6
|
//#region src/server/domains/proxy/handlers.impl.ts
|
|
@@ -8,6 +8,16 @@ const ResponseBuilder = {
|
|
|
8
8
|
success: (data) => R.ok().merge(data).json(),
|
|
9
9
|
error: (msg) => R.fail(msg).mcpError().json()
|
|
10
10
|
};
|
|
11
|
+
function compileUrlPattern(urlPattern) {
|
|
12
|
+
const trimmed = urlPattern.trim();
|
|
13
|
+
const regexLiteral = /^\/(.+)\/([a-z]*)$/.exec(trimmed);
|
|
14
|
+
if (regexLiteral && regexLiteral[1] !== void 0) {
|
|
15
|
+
const source = regexLiteral[1];
|
|
16
|
+
const flags = regexLiteral[2] ?? "";
|
|
17
|
+
return new RegExp(source, flags);
|
|
18
|
+
}
|
|
19
|
+
return new RegExp(trimmed);
|
|
20
|
+
}
|
|
11
21
|
var ProxyHandlers = class {
|
|
12
22
|
server = null;
|
|
13
23
|
caPathDir;
|
|
@@ -105,14 +115,15 @@ var ProxyHandlers = class {
|
|
|
105
115
|
const method = (argString(args, "method") || "GET").toUpperCase();
|
|
106
116
|
const urlPattern = argString(args, "urlPattern") || ".*";
|
|
107
117
|
try {
|
|
118
|
+
const matcher = compileUrlPattern(urlPattern);
|
|
108
119
|
let builder;
|
|
109
|
-
if (method === "GET") builder = this.server.forGet(
|
|
110
|
-
else if (method === "POST") builder = this.server.forPost(
|
|
111
|
-
else if (method === "PUT") builder = this.server.forPut(
|
|
112
|
-
else if (method === "DELETE") builder = this.server.forDelete(
|
|
120
|
+
if (method === "GET") builder = this.server.forGet(matcher);
|
|
121
|
+
else if (method === "POST") builder = this.server.forPost(matcher);
|
|
122
|
+
else if (method === "PUT") builder = this.server.forPut(matcher);
|
|
123
|
+
else if (method === "DELETE") builder = this.server.forDelete(matcher);
|
|
113
124
|
else builder = this.server.forAnyRequest();
|
|
114
125
|
let endpoint;
|
|
115
|
-
if (action === "forward") endpoint = await builder.
|
|
126
|
+
if (action === "forward") endpoint = await builder.thenPassThrough();
|
|
116
127
|
else if (action === "block") endpoint = await builder.thenCloseConnection();
|
|
117
128
|
else if (action === "mock_response") {
|
|
118
129
|
const mockStatus = argNumber(args, "mockStatus") || 200;
|
|
@@ -151,6 +162,17 @@ var ProxyHandlers = class {
|
|
|
151
162
|
const deviceSerial = argString(args, "deviceSerial");
|
|
152
163
|
const deviceFlag = deviceSerial ? `-s ${deviceSerial}` : "";
|
|
153
164
|
try {
|
|
165
|
+
try {
|
|
166
|
+
await execAsync("adb version");
|
|
167
|
+
} catch (error) {
|
|
168
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
169
|
+
return R.fail(`ADB binary not available: ${message}`).merge({
|
|
170
|
+
available: false,
|
|
171
|
+
capability: "adb_binary",
|
|
172
|
+
status: "unavailable",
|
|
173
|
+
fix: "Install Android Platform Tools and ensure `adb` is available on PATH."
|
|
174
|
+
}).json();
|
|
175
|
+
}
|
|
154
176
|
await execAsync(`adb ${deviceFlag} get-state`);
|
|
155
177
|
await execAsync(`adb ${deviceFlag} push "${certPath}" /data/local/tmp/ca.pem`);
|
|
156
178
|
await execAsync(`adb ${deviceFlag} reverse tcp:${port} tcp:${port}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as DOMInspector, r as CodeCollector, t as ScriptManager } from "./ScriptManager-
|
|
2
|
-
import { t as PageController } from "./PageController-
|
|
1
|
+
import { n as DOMInspector, r as CodeCollector, t as ScriptManager } from "./ScriptManager-ZuWD-0Jg.mjs";
|
|
2
|
+
import { t as PageController } from "./PageController-BPJNqqBN.mjs";
|
|
3
3
|
//#region src/server/registry/types.ts
|
|
4
4
|
/**
|
|
5
5
|
* Helper: create a name-based lookup from a Tool array.
|
|
@@ -17,7 +17,7 @@ function toolLookup(tools) {
|
|
|
17
17
|
//#region src/server/registry/ensure-browser-core.ts
|
|
18
18
|
let ConsoleMonitorClass = null;
|
|
19
19
|
async function getConsoleMonitorClass() {
|
|
20
|
-
if (!ConsoleMonitorClass) ConsoleMonitorClass = (await import("./ConsoleMonitor-
|
|
20
|
+
if (!ConsoleMonitorClass) ConsoleMonitorClass = (await import("./ConsoleMonitor-DykL3IAw.mjs").then((n) => n.t)).ConsoleMonitor;
|
|
21
21
|
return ConsoleMonitorClass;
|
|
22
22
|
}
|
|
23
23
|
async function ensureBrowserCore(ctx) {
|
|
@@ -15,6 +15,12 @@ function asTextResponse(text, isError = false) {
|
|
|
15
15
|
function asJsonResponse(payload) {
|
|
16
16
|
return asTextResponse(JSON.stringify(payload, null, 2));
|
|
17
17
|
}
|
|
18
|
+
function isToolResponse(value) {
|
|
19
|
+
return value !== null && typeof value === "object" && Array.isArray(value.content);
|
|
20
|
+
}
|
|
21
|
+
function asToolResponse(payload) {
|
|
22
|
+
return isToolResponse(payload) ? payload : asJsonResponse(payload);
|
|
23
|
+
}
|
|
18
24
|
function asErrorResponse(error) {
|
|
19
25
|
return asTextResponse(`Error: ${toErrorMessage(error)}`, true);
|
|
20
26
|
}
|
|
@@ -25,4 +31,4 @@ function serializeError(error) {
|
|
|
25
31
|
};
|
|
26
32
|
}
|
|
27
33
|
//#endregion
|
|
28
|
-
export { serializeError as i, asJsonResponse as n, asTextResponse as r, asErrorResponse as t };
|
|
34
|
+
export { serializeError as a, asToolResponse as i, asJsonResponse as n, asTextResponse as r, asErrorResponse as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as argString, i as argObject, r as argNumber, s as argStringRequired, t as argBool } from "./parse-args-
|
|
2
|
-
import "./definitions-
|
|
1
|
+
import { a as argString, i as argObject, r as argNumber, s as argStringRequired, t as argBool } from "./parse-args-B4cY5Vx5.mjs";
|
|
2
|
+
import "./definitions-DYVjOtxa.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/utils/escapeForRegex.ts
|
|
5
5
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as resolveArtifactPath } from "./artifacts-
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
1
|
+
import { cr as SOURCEMAP_V4_RETRY_DELAY_MS, sr as SOURCEMAP_V4_RAW_FIELD_MAX_LEN } from "./constants-CDZLOoVv.mjs";
|
|
2
|
+
import { i as resolveArtifactPath } from "./artifacts-DkfosXH3.mjs";
|
|
3
|
+
import { n as detachFromFlatTarget, t as attachToFlatTarget } from "./flat-target-session-Dgax2Cy3.mjs";
|
|
4
|
+
import { s as evaluateWithTimeout } from "./PageController-BPJNqqBN.mjs";
|
|
5
|
+
import "./definitions-DAgIyjxM.mjs";
|
|
5
6
|
import { dirname, resolve } from "node:path";
|
|
6
7
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
7
8
|
//#region src/server/domains/sourcemap/handlers/shared.ts
|
|
@@ -33,6 +34,28 @@ function decodeVlqSegment(segment) {
|
|
|
33
34
|
}
|
|
34
35
|
return values;
|
|
35
36
|
}
|
|
37
|
+
function decodeVlqSegmentUnsigned(segment) {
|
|
38
|
+
const values = [];
|
|
39
|
+
let index = 0;
|
|
40
|
+
while (index < segment.length) {
|
|
41
|
+
let result = 0;
|
|
42
|
+
let shift = 0;
|
|
43
|
+
let continuation = true;
|
|
44
|
+
while (continuation) {
|
|
45
|
+
const char = segment.charAt(index);
|
|
46
|
+
if (!char) throw new Error(`Unexpected end of VLQ segment: "${segment}"`);
|
|
47
|
+
index += 1;
|
|
48
|
+
const digit = BASE64_DECODE_MAP.get(char);
|
|
49
|
+
if (digit === void 0) throw new Error(`Invalid VLQ base64 char "${char}" in segment "${segment}"`);
|
|
50
|
+
continuation = (digit & 32) !== 0;
|
|
51
|
+
const digitValue = digit & 31;
|
|
52
|
+
result += digitValue << shift;
|
|
53
|
+
shift += 5;
|
|
54
|
+
}
|
|
55
|
+
values.push(result);
|
|
56
|
+
}
|
|
57
|
+
return values;
|
|
58
|
+
}
|
|
36
59
|
function decodeMappings(mappings) {
|
|
37
60
|
if (!mappings) return [];
|
|
38
61
|
const decoded = [];
|
|
@@ -148,9 +171,6 @@ async function delay(ms) {
|
|
|
148
171
|
}
|
|
149
172
|
//#endregion
|
|
150
173
|
//#region src/server/domains/sourcemap/handlers/extension-handlers.ts
|
|
151
|
-
/**
|
|
152
|
-
* Extension-related sub-handler for sourcemap domain.
|
|
153
|
-
*/
|
|
154
174
|
var ExtensionHandlers = class {
|
|
155
175
|
state;
|
|
156
176
|
constructor(state) {
|
|
@@ -176,16 +196,13 @@ var ExtensionHandlers = class {
|
|
|
176
196
|
const code = requiredStringArg(args.code, "code");
|
|
177
197
|
const returnByValue = parseBooleanArg(args.returnByValue, true);
|
|
178
198
|
const session = await (await this.state.collector.getActivePage()).createCDPSession();
|
|
179
|
-
let
|
|
199
|
+
let attachedSession = null;
|
|
180
200
|
try {
|
|
181
201
|
const targets = await this.getExtensionTargets(session, extensionId);
|
|
182
202
|
if (targets.length === 0) throw new Error(`No background target found for extension: ${extensionId}`);
|
|
183
203
|
const preferred = this.pickPreferredExtensionTarget(targets);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
flatten: true
|
|
187
|
-
})).sessionId, "sessionId");
|
|
188
|
-
const evaluation = await this.evaluateInAttachedTarget(session, attachedSessionId, code, returnByValue);
|
|
204
|
+
attachedSession = await attachToFlatTarget(session, preferred.targetId);
|
|
205
|
+
const evaluation = await this.evaluateInAttachedTarget(attachedSession, code, returnByValue);
|
|
189
206
|
return json({
|
|
190
207
|
extensionId,
|
|
191
208
|
target: {
|
|
@@ -199,7 +216,7 @@ var ExtensionHandlers = class {
|
|
|
199
216
|
} catch (error) {
|
|
200
217
|
return fail("extension_execute_in_context", error);
|
|
201
218
|
} finally {
|
|
202
|
-
if (
|
|
219
|
+
if (attachedSession) await detachFromFlatTarget(session, attachedSession).catch(() => void 0);
|
|
203
220
|
await safeDetach(session);
|
|
204
221
|
}
|
|
205
222
|
}
|
|
@@ -241,58 +258,16 @@ var ExtensionHandlers = class {
|
|
|
241
258
|
extractExtensionId(url) {
|
|
242
259
|
return url.match(/^chrome-extension:\/\/([a-p]{32})(?:\/|$)/i)?.[1] ?? null;
|
|
243
260
|
}
|
|
244
|
-
async evaluateInAttachedTarget(session,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
expression: code,
|
|
252
|
-
returnByValue,
|
|
253
|
-
awaitPromise: true
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
const responseMessage = await new Promise((resolvePromise, rejectPromise) => {
|
|
257
|
-
const timeout = setTimeout(() => {
|
|
258
|
-
cleanup();
|
|
259
|
-
rejectPromise(/* @__PURE__ */ new Error("Runtime.evaluate timed out"));
|
|
260
|
-
}, SOURCEMAP_EXT_TIMEOUT_MS);
|
|
261
|
-
const onMessage = (payload) => {
|
|
262
|
-
const record = asRecord(payload);
|
|
263
|
-
if (asString(record.sessionId) !== sessionId) return;
|
|
264
|
-
const rawMessage = asString(record.message);
|
|
265
|
-
if (!rawMessage) return;
|
|
266
|
-
let parsed;
|
|
267
|
-
try {
|
|
268
|
-
parsed = JSON.parse(rawMessage);
|
|
269
|
-
} catch {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const parsedRecord = asRecord(parsed);
|
|
273
|
-
if (parsedRecord.id !== commandId) return;
|
|
274
|
-
cleanup();
|
|
275
|
-
resolvePromise(parsedRecord);
|
|
276
|
-
};
|
|
277
|
-
const cleanup = () => {
|
|
278
|
-
clearTimeout(timeout);
|
|
279
|
-
session.off?.("Target.receivedMessageFromTarget", onMessage);
|
|
280
|
-
};
|
|
281
|
-
session.on?.("Target.receivedMessageFromTarget", onMessage);
|
|
282
|
-
session.send("Target.sendMessageToTarget", {
|
|
283
|
-
sessionId,
|
|
284
|
-
message: commandMessage
|
|
285
|
-
}).catch((error) => {
|
|
286
|
-
cleanup();
|
|
287
|
-
rejectPromise(error);
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
const errorRecord = asRecord(responseMessage.error);
|
|
291
|
-
if (Object.keys(errorRecord).length > 0) throw new Error(asString(errorRecord.message) ?? asString(errorRecord.data) ?? "Runtime.evaluate failed");
|
|
292
|
-
const resultEnvelope = asRecord(responseMessage.result);
|
|
261
|
+
async evaluateInAttachedTarget(session, code, returnByValue) {
|
|
262
|
+
const response = asRecord(await session.send("Runtime.evaluate", {
|
|
263
|
+
expression: code,
|
|
264
|
+
returnByValue,
|
|
265
|
+
awaitPromise: true
|
|
266
|
+
}));
|
|
267
|
+
const resultEnvelope = asRecord(response.result);
|
|
293
268
|
return {
|
|
294
|
-
result: resultEnvelope.
|
|
295
|
-
exceptionDetails:
|
|
269
|
+
result: returnByValue && resultEnvelope.value !== void 0 ? resultEnvelope.value : Object.keys(resultEnvelope).length > 0 ? resultEnvelope : null,
|
|
270
|
+
exceptionDetails: response.exceptionDetails !== void 0 ? response.exceptionDetails : null
|
|
296
271
|
};
|
|
297
272
|
}
|
|
298
273
|
};
|
|
@@ -499,6 +474,14 @@ function safeTarget(value) {
|
|
|
499
474
|
/**
|
|
500
475
|
* Main sourcemap sub-handler — discover, fetch/parse, reconstruct tree.
|
|
501
476
|
*/
|
|
477
|
+
function countScopeNodes(nodes) {
|
|
478
|
+
let count = 0;
|
|
479
|
+
for (const node of nodes) {
|
|
480
|
+
if (!node) continue;
|
|
481
|
+
count += 1 + countScopeNodes(node.children);
|
|
482
|
+
}
|
|
483
|
+
return count;
|
|
484
|
+
}
|
|
502
485
|
var SourcemapHandlers = class {
|
|
503
486
|
state;
|
|
504
487
|
constructor(state) {
|
|
@@ -526,7 +509,7 @@ var SourcemapHandlers = class {
|
|
|
526
509
|
try {
|
|
527
510
|
session.on?.("Debugger.scriptParsed", onScriptParsed);
|
|
528
511
|
await session.send("Debugger.enable");
|
|
529
|
-
await delay(
|
|
512
|
+
await delay(SOURCEMAP_V4_RETRY_DELAY_MS);
|
|
530
513
|
for (const item of scripts.values()) {
|
|
531
514
|
if (item.sourceMapUrl) continue;
|
|
532
515
|
if (!item.scriptId || !item.scriptUrl) continue;
|
|
@@ -617,7 +600,305 @@ var SourcemapHandlers = class {
|
|
|
617
600
|
return fail("sourcemap_reconstruct_tree", error);
|
|
618
601
|
}
|
|
619
602
|
}
|
|
603
|
+
async handleSourcemapParseV4(args) {
|
|
604
|
+
const sourceMapUrl = requiredStringArg(args.sourceMapUrl, "sourceMapUrl");
|
|
605
|
+
const extractScopes = parseBooleanArg(args.extractScopes, true);
|
|
606
|
+
const extractDebugIds = parseBooleanArg(args.extractDebugIds, true);
|
|
607
|
+
try {
|
|
608
|
+
const raw = await fetchSourceMapText(sourceMapUrl, this.state.collector);
|
|
609
|
+
const parsed = JSON.parse(raw);
|
|
610
|
+
const names = Array.isArray(parsed.names) ? parsed.names.filter((x) => typeof x === "string") : [];
|
|
611
|
+
const sources = Array.isArray(parsed.sources) ? parsed.sources.filter((x) => typeof x === "string") : [];
|
|
612
|
+
const v3Baseline = {
|
|
613
|
+
version: parsed.version,
|
|
614
|
+
sources: sources.length,
|
|
615
|
+
names: names.length,
|
|
616
|
+
mappings: typeof parsed.mappings === "string" ? parsed.mappings.length : 0,
|
|
617
|
+
hasFile: typeof parsed.file === "string",
|
|
618
|
+
hasSourceRoot: typeof parsed.sourceRoot === "string"
|
|
619
|
+
};
|
|
620
|
+
const result = {
|
|
621
|
+
success: true,
|
|
622
|
+
sourceMapUrl,
|
|
623
|
+
version: parsed.version,
|
|
624
|
+
v3Baseline
|
|
625
|
+
};
|
|
626
|
+
if (extractDebugIds && typeof parsed.debugId === "string") {
|
|
627
|
+
const debugIdValid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(parsed.debugId);
|
|
628
|
+
result.debugId = parsed.debugId;
|
|
629
|
+
result.debugIdValid = debugIdValid;
|
|
630
|
+
}
|
|
631
|
+
const scopesField = typeof parsed.scopes === "string" ? parsed.scopes : typeof parsed.x_scopes === "string" ? parsed.x_scopes : void 0;
|
|
632
|
+
if (extractScopes && scopesField) try {
|
|
633
|
+
const decoded = decodeScopesField(scopesField, names, sources);
|
|
634
|
+
result.isV4 = true;
|
|
635
|
+
result.scopes = decoded;
|
|
636
|
+
result.scopeCount = countScopeNodes(decoded.originalScopes);
|
|
637
|
+
result.generatedRangeCount = decoded.generatedRanges.length;
|
|
638
|
+
} catch (scopeError) {
|
|
639
|
+
result.success = false;
|
|
640
|
+
result.scopeDecodeError = scopeError instanceof Error ? scopeError.message : String(scopeError);
|
|
641
|
+
result.rawScopesField = scopesField.substring(0, SOURCEMAP_V4_RAW_FIELD_MAX_LEN) + (scopesField.length > SOURCEMAP_V4_RAW_FIELD_MAX_LEN ? "..." : "");
|
|
642
|
+
result.isV4 = true;
|
|
643
|
+
}
|
|
644
|
+
const extensions = {};
|
|
645
|
+
if (parsed.x_scopeLines) extensions.x_scopeLines = parsed.x_scopeLines;
|
|
646
|
+
if (parsed.x_namesIdx) extensions.x_namesIdx = parsed.x_namesIdx;
|
|
647
|
+
if (parsed.x_computedBases) extensions.x_computedBases = parsed.x_computedBases;
|
|
648
|
+
if (Object.keys(extensions).length > 0) result.extensions = extensions;
|
|
649
|
+
if (!scopesField && !parsed.debugId && Object.keys(extensions).length === 0) {
|
|
650
|
+
result.isV4 = false;
|
|
651
|
+
result.note = "No v4 fields (scopes/debugId) found. This source map is v3 only.";
|
|
652
|
+
}
|
|
653
|
+
if (args.compareV3 === true) result.comparison = {
|
|
654
|
+
v3Only: [
|
|
655
|
+
"version",
|
|
656
|
+
"sources",
|
|
657
|
+
"names",
|
|
658
|
+
"mappings",
|
|
659
|
+
"file",
|
|
660
|
+
"sourceRoot"
|
|
661
|
+
],
|
|
662
|
+
v4Only: Object.keys(result).filter((k) => ![
|
|
663
|
+
"success",
|
|
664
|
+
"sourceMapUrl",
|
|
665
|
+
"version",
|
|
666
|
+
"v3Baseline",
|
|
667
|
+
"comparison"
|
|
668
|
+
].includes(k))
|
|
669
|
+
};
|
|
670
|
+
return json(result);
|
|
671
|
+
} catch (error) {
|
|
672
|
+
return fail("sourcemap_parse_v4", error);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
620
675
|
};
|
|
676
|
+
function decodeScopesField(scopesText, names, sources) {
|
|
677
|
+
const items = scopesText.split(",");
|
|
678
|
+
const idx = { value: 0 };
|
|
679
|
+
const originalByStartIndex = [];
|
|
680
|
+
let previousOriginalName = 0;
|
|
681
|
+
let previousOriginalKind = 0;
|
|
682
|
+
let previousOriginalVariable = 0;
|
|
683
|
+
let previousGeneratedLine = 0;
|
|
684
|
+
let previousGeneratedColumn = 0;
|
|
685
|
+
let previousDefinition = 0;
|
|
686
|
+
const readName = (absoluteIndex1Based) => absoluteIndex1Based > 0 && absoluteIndex1Based <= names.length ? names[absoluteIndex1Based - 1] : void 0;
|
|
687
|
+
function safeItem(index) {
|
|
688
|
+
return index >= 0 && index < items.length ? items[index] : void 0;
|
|
689
|
+
}
|
|
690
|
+
function parseOriginalTree(sourceIndex, previousPos) {
|
|
691
|
+
const startItem = safeItem(idx.value++);
|
|
692
|
+
if (!startItem?.startsWith("B")) throw new Error(`expected original scope start 'B', got "${startItem}"`);
|
|
693
|
+
const rawUnsigned = decodeVlqSegmentUnsigned(startItem.slice(1));
|
|
694
|
+
const rawSigned = decodeVlqSegment(startItem.slice(1));
|
|
695
|
+
let p = 0;
|
|
696
|
+
const flags = rawUnsigned[p++] ?? 0;
|
|
697
|
+
const line = previousPos.line + (rawUnsigned[p++] ?? 0);
|
|
698
|
+
const columnRaw = rawUnsigned[p++] ?? 0;
|
|
699
|
+
const column = line === previousPos.line ? previousPos.column + columnRaw : columnRaw;
|
|
700
|
+
let name;
|
|
701
|
+
if ((flags & 1) !== 0) {
|
|
702
|
+
previousOriginalName += rawSigned[p++] ?? 0;
|
|
703
|
+
name = names[previousOriginalName];
|
|
704
|
+
}
|
|
705
|
+
let kind;
|
|
706
|
+
if ((flags & 2) !== 0) {
|
|
707
|
+
previousOriginalKind += rawSigned[p++] ?? 0;
|
|
708
|
+
kind = names[previousOriginalKind];
|
|
709
|
+
}
|
|
710
|
+
const node = {
|
|
711
|
+
index: originalByStartIndex.length,
|
|
712
|
+
sourceIndex,
|
|
713
|
+
start: {
|
|
714
|
+
line,
|
|
715
|
+
column
|
|
716
|
+
},
|
|
717
|
+
end: {
|
|
718
|
+
line,
|
|
719
|
+
column
|
|
720
|
+
},
|
|
721
|
+
name,
|
|
722
|
+
kind,
|
|
723
|
+
isStackFrame: (flags & 4) !== 0,
|
|
724
|
+
variables: [],
|
|
725
|
+
children: []
|
|
726
|
+
};
|
|
727
|
+
originalByStartIndex.push(node);
|
|
728
|
+
let cursorPos = {
|
|
729
|
+
line,
|
|
730
|
+
column
|
|
731
|
+
};
|
|
732
|
+
while (idx.value < items.length) {
|
|
733
|
+
const item = items[idx.value] ?? "";
|
|
734
|
+
if (item.startsWith("D")) {
|
|
735
|
+
idx.value++;
|
|
736
|
+
const vars = decodeVlqSegment(item.slice(1));
|
|
737
|
+
for (const rawVar of vars) {
|
|
738
|
+
previousOriginalVariable += rawVar;
|
|
739
|
+
node.variables.push(names[previousOriginalVariable] ?? `<name:${previousOriginalVariable}>`);
|
|
740
|
+
}
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
if (item.startsWith("B")) {
|
|
744
|
+
const child = parseOriginalTree(sourceIndex, cursorPos);
|
|
745
|
+
cursorPos = { ...child.end };
|
|
746
|
+
node.children.push(child);
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
break;
|
|
750
|
+
}
|
|
751
|
+
const endItem = safeItem(idx.value++);
|
|
752
|
+
if (!endItem?.startsWith("C")) throw new Error(`expected original scope end 'C', got "${endItem}"`);
|
|
753
|
+
const endRaw = decodeVlqSegmentUnsigned(endItem.slice(1));
|
|
754
|
+
const endLine = cursorPos.line + (endRaw[0] ?? 0);
|
|
755
|
+
const endColumnRaw = endRaw[1] ?? 0;
|
|
756
|
+
node.end = {
|
|
757
|
+
line: endLine,
|
|
758
|
+
column: endLine === cursorPos.line ? cursorPos.column + endColumnRaw : endColumnRaw
|
|
759
|
+
};
|
|
760
|
+
return node;
|
|
761
|
+
}
|
|
762
|
+
function parseGeneratedTree(previousPos) {
|
|
763
|
+
const startItem = safeItem(idx.value++);
|
|
764
|
+
if (!startItem?.startsWith("E")) throw new Error(`expected generated range start 'E', got "${startItem}"`);
|
|
765
|
+
const rawUnsigned = decodeVlqSegmentUnsigned(startItem.slice(1));
|
|
766
|
+
const rawSigned = decodeVlqSegment(startItem.slice(1));
|
|
767
|
+
let p = 0;
|
|
768
|
+
const flags = rawUnsigned[p++] ?? 0;
|
|
769
|
+
const hasLine = (flags & 1) !== 0;
|
|
770
|
+
const line = previousPos.line + (hasLine ? rawUnsigned[p++] ?? 0 : 0);
|
|
771
|
+
const columnRaw = rawUnsigned[p++] ?? 0;
|
|
772
|
+
const column = line === previousPos.line ? previousPos.column + columnRaw : columnRaw;
|
|
773
|
+
let definitionIndex;
|
|
774
|
+
if ((flags & 2) !== 0) {
|
|
775
|
+
previousDefinition += rawSigned[p++] ?? 0;
|
|
776
|
+
definitionIndex = previousDefinition;
|
|
777
|
+
}
|
|
778
|
+
const node = {
|
|
779
|
+
start: {
|
|
780
|
+
line,
|
|
781
|
+
column
|
|
782
|
+
},
|
|
783
|
+
end: {
|
|
784
|
+
line,
|
|
785
|
+
column
|
|
786
|
+
},
|
|
787
|
+
isStackFrame: (flags & 4) !== 0,
|
|
788
|
+
isHidden: (flags & 8) !== 0,
|
|
789
|
+
definitionIndex,
|
|
790
|
+
children: []
|
|
791
|
+
};
|
|
792
|
+
const subrangeState = /* @__PURE__ */ new Map();
|
|
793
|
+
let previousVariableIndex = 0;
|
|
794
|
+
let cursorPos = {
|
|
795
|
+
line,
|
|
796
|
+
column
|
|
797
|
+
};
|
|
798
|
+
while (idx.value < items.length) {
|
|
799
|
+
const item = items[idx.value] ?? "";
|
|
800
|
+
if (item.startsWith("G")) {
|
|
801
|
+
idx.value++;
|
|
802
|
+
node.bindings = decodeVlqSegmentUnsigned(item.slice(1)).map((v) => readName(v));
|
|
803
|
+
continue;
|
|
804
|
+
}
|
|
805
|
+
if (item.startsWith("H")) {
|
|
806
|
+
idx.value++;
|
|
807
|
+
const sub = decodeVlqSegmentUnsigned(item.slice(1));
|
|
808
|
+
if (!node.bindings) node.bindings = [];
|
|
809
|
+
let s = 0;
|
|
810
|
+
previousVariableIndex += sub[s++] ?? 0;
|
|
811
|
+
const variableIndex = previousVariableIndex;
|
|
812
|
+
const ranges = [];
|
|
813
|
+
let prev = subrangeState.get(variableIndex) ?? {
|
|
814
|
+
line: node.start.line,
|
|
815
|
+
column: node.start.column
|
|
816
|
+
};
|
|
817
|
+
while (s < sub.length) {
|
|
818
|
+
const expr = readName(sub[s++] ?? 0);
|
|
819
|
+
const lineDelta = sub[s++] ?? 0;
|
|
820
|
+
const nextLine = prev.line + lineDelta;
|
|
821
|
+
const colRaw = sub[s++] ?? 0;
|
|
822
|
+
const nextColumn = nextLine === prev.line ? prev.column + colRaw : colRaw;
|
|
823
|
+
ranges.push({
|
|
824
|
+
from: {
|
|
825
|
+
line: nextLine,
|
|
826
|
+
column: nextColumn
|
|
827
|
+
},
|
|
828
|
+
expression: expr
|
|
829
|
+
});
|
|
830
|
+
prev = {
|
|
831
|
+
line: nextLine,
|
|
832
|
+
column: nextColumn
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
subrangeState.set(variableIndex, prev);
|
|
836
|
+
while (node.bindings.length <= variableIndex) node.bindings.push(void 0);
|
|
837
|
+
node.bindings[variableIndex] = ranges;
|
|
838
|
+
continue;
|
|
839
|
+
}
|
|
840
|
+
if (item.startsWith("I")) {
|
|
841
|
+
idx.value++;
|
|
842
|
+
const cs = decodeVlqSegmentUnsigned(item.slice(1));
|
|
843
|
+
node.callsite = {
|
|
844
|
+
sourceIndex: cs[0] ?? 0,
|
|
845
|
+
line: cs[1] ?? 0,
|
|
846
|
+
column: cs[2] ?? 0
|
|
847
|
+
};
|
|
848
|
+
continue;
|
|
849
|
+
}
|
|
850
|
+
if (item.startsWith("E")) {
|
|
851
|
+
const child = parseGeneratedTree(cursorPos);
|
|
852
|
+
cursorPos = { ...child.end };
|
|
853
|
+
node.children.push(child);
|
|
854
|
+
continue;
|
|
855
|
+
}
|
|
856
|
+
break;
|
|
857
|
+
}
|
|
858
|
+
const endItem = safeItem(idx.value++);
|
|
859
|
+
if (!endItem?.startsWith("F")) throw new Error(`expected generated range end 'F', got "${endItem}"`);
|
|
860
|
+
const endRaw = decodeVlqSegmentUnsigned(endItem.slice(1));
|
|
861
|
+
const endHasLine = endRaw.length === 2;
|
|
862
|
+
const endLine = cursorPos.line + (endHasLine ? endRaw[0] ?? 0 : 0);
|
|
863
|
+
const endColumnRaw = endRaw[endHasLine ? 1 : 0] ?? 0;
|
|
864
|
+
const endColumn = endLine === cursorPos.line ? cursorPos.column + endColumnRaw : endColumnRaw;
|
|
865
|
+
node.end = {
|
|
866
|
+
line: endLine,
|
|
867
|
+
column: endColumn
|
|
868
|
+
};
|
|
869
|
+
previousGeneratedLine = endLine;
|
|
870
|
+
previousGeneratedColumn = endColumn;
|
|
871
|
+
return node;
|
|
872
|
+
}
|
|
873
|
+
const originalScopes = Array.from({ length: sources.length }, () => null);
|
|
874
|
+
for (let sourceIndex = 0; sourceIndex < sources.length && idx.value < items.length; sourceIndex++) {
|
|
875
|
+
if ((items[idx.value] ?? "") === "") {
|
|
876
|
+
idx.value++;
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
if (!(items[idx.value] ?? "").startsWith("B")) break;
|
|
880
|
+
originalScopes[sourceIndex] = parseOriginalTree(sourceIndex, {
|
|
881
|
+
line: 0,
|
|
882
|
+
column: 0
|
|
883
|
+
});
|
|
884
|
+
if ((items[idx.value] ?? "") === "") idx.value++;
|
|
885
|
+
}
|
|
886
|
+
const generatedRanges = [];
|
|
887
|
+
while (idx.value < items.length) {
|
|
888
|
+
if ((items[idx.value] ?? "") === "") {
|
|
889
|
+
idx.value++;
|
|
890
|
+
continue;
|
|
891
|
+
}
|
|
892
|
+
generatedRanges.push(parseGeneratedTree({
|
|
893
|
+
line: previousGeneratedLine,
|
|
894
|
+
column: previousGeneratedColumn
|
|
895
|
+
}));
|
|
896
|
+
}
|
|
897
|
+
return {
|
|
898
|
+
originalScopes,
|
|
899
|
+
generatedRanges
|
|
900
|
+
};
|
|
901
|
+
}
|
|
621
902
|
//#endregion
|
|
622
903
|
//#region src/server/domains/sourcemap/handlers.impl.core.ts
|
|
623
904
|
var SourcemapToolHandlers = class {
|
|
@@ -645,6 +926,9 @@ var SourcemapToolHandlers = class {
|
|
|
645
926
|
handleSourcemapReconstructTree(args) {
|
|
646
927
|
return this.sourcemap.handleSourcemapReconstructTree(args);
|
|
647
928
|
}
|
|
929
|
+
handleSourcemapParseV4(args) {
|
|
930
|
+
return this.sourcemap.handleSourcemapParseV4(args);
|
|
931
|
+
}
|
|
648
932
|
};
|
|
649
933
|
//#endregion
|
|
650
934
|
export { SourcemapToolHandlers };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { o as evaluateOnNewDocumentWithTimeout, s as evaluateWithTimeout } from "./PageController-
|
|
4
|
-
import "./definitions-
|
|
2
|
+
import { Hr as WS_PAYLOAD_PREVIEW_LIMIT, Ur as WS_PAYLOAD_SAMPLE_LIMIT } from "./constants-CDZLOoVv.mjs";
|
|
3
|
+
import { o as evaluateOnNewDocumentWithTimeout, s as evaluateWithTimeout } from "./PageController-BPJNqqBN.mjs";
|
|
4
|
+
import "./definitions-DcYLVLCo.mjs";
|
|
5
5
|
//#region src/utils/RingBuffer.ts
|
|
6
6
|
/**
|
|
7
7
|
* Fixed-capacity ring buffer with O(1) push/shift.
|
|
@@ -438,16 +438,6 @@ var WsHandlers = class {
|
|
|
438
438
|
};
|
|
439
439
|
//#endregion
|
|
440
440
|
//#region src/server/domains/streaming/handlers/sse-handlers.ts
|
|
441
|
-
function toDataString(value) {
|
|
442
|
-
if (typeof value === "string") return value;
|
|
443
|
-
if (value === null || value === void 0) return "";
|
|
444
|
-
if (typeof value === "object") try {
|
|
445
|
-
return JSON.stringify(value);
|
|
446
|
-
} catch {
|
|
447
|
-
return "[unserializable]";
|
|
448
|
-
}
|
|
449
|
-
return String(value);
|
|
450
|
-
}
|
|
451
441
|
function sseInjectionFn(config) {
|
|
452
442
|
const globalWindow = window;
|
|
453
443
|
if (!globalWindow.__jshookSSEMonitor) globalWindow.__jshookSSEMonitor = {
|
|
@@ -471,6 +461,16 @@ function sseInjectionFn(config) {
|
|
|
471
461
|
return true;
|
|
472
462
|
}
|
|
473
463
|
};
|
|
464
|
+
const toDataString = (value) => {
|
|
465
|
+
if (typeof value === "string") return value;
|
|
466
|
+
if (value === null || value === void 0) return "";
|
|
467
|
+
if (typeof value === "object") try {
|
|
468
|
+
return JSON.stringify(value);
|
|
469
|
+
} catch {
|
|
470
|
+
return "[unserializable]";
|
|
471
|
+
}
|
|
472
|
+
return String(value);
|
|
473
|
+
};
|
|
474
474
|
const pushEvent = (sourceUrl, eventType, rawData, lastEventId) => {
|
|
475
475
|
if (!state.enabled || !shouldCapture(sourceUrl)) return;
|
|
476
476
|
const dataString = toDataString(rawData);
|
|
@@ -57,7 +57,7 @@ function buildTool(state) {
|
|
|
57
57
|
openWorldHint: state.annotations.openWorldHint
|
|
58
58
|
},
|
|
59
59
|
...state.asyncTask ? { execution: { taskSupport: "optional" } } : {},
|
|
60
|
-
...Object.keys(state.autocompleteHandlers).length > 0 ? {
|
|
60
|
+
...Object.keys(state.autocompleteHandlers).length > 0 ? { autocompleteHandlers: state.autocompleteHandlers } : {},
|
|
61
61
|
...state.outputSchema ? { outputSchema: state.outputSchema } : {}
|
|
62
62
|
};
|
|
63
63
|
}
|