@jshookmcp/jshook 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -5
- package/README.zh.md +36 -5
- package/dist/{AntiCheatDetector-S8VRj-dD.mjs → AntiCheatDetector-BNk-EoBt.mjs} +3 -3
- package/dist/{CodeInjector-4Z3ngPoX.mjs → CodeInjector-Cq8q01kp.mjs} +5 -5
- package/dist/ConsoleMonitor-CPVQW1Y-.mjs +2201 -0
- package/dist/{DarwinAPI-B8hg_yhz.mjs → DarwinAPI-BNPxu0RH.mjs} +1 -1
- package/dist/DetailedDataManager-BQQcxh64.mjs +217 -0
- package/dist/EventBus-DgPmwpeu.mjs +141 -0
- package/dist/EvidenceGraphBridge-SFesNera.mjs +153 -0
- package/dist/{ExtensionManager-CZ6IveoV.mjs → ExtensionManager-CWYgw0YW.mjs} +13 -6
- package/dist/{FingerprintManager-BVxFJL2-.mjs → FingerprintManager-gzWtkKuf.mjs} +1 -1
- package/dist/{HardwareBreakpoint-DK1yjWkV.mjs → HardwareBreakpoint-B9gZCdFP.mjs} +3 -3
- package/dist/{HeapAnalyzer-CEbo10xU.mjs → HeapAnalyzer-BLDH0dCv.mjs} +4 -4
- package/dist/HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs +639 -0
- package/dist/InstrumentationSession-CvPC7Jwy.mjs +244 -0
- package/dist/{MemoryController-DdtnBdD4.mjs → MemoryController-CbVdCIJF.mjs} +3 -3
- package/dist/{MemoryScanSession-RMixN3bX.mjs → MemoryScanSession-BsDZbLYm.mjs} +81 -78
- package/dist/{MemoryScanner-QjK4ld0B.mjs → MemoryScanner-Bcpml6II.mjs} +44 -18
- package/dist/{NativeMemoryManager.impl-CB6gJ0NM.mjs → NativeMemoryManager.impl-dZtA1ZGn.mjs} +14 -53
- package/dist/{NativeMemoryManager.utils-BML4q1ry.mjs → NativeMemoryManager.utils-B-FjA2mJ.mjs} +1 -1
- package/dist/{PEAnalyzer-CK0xe0Fs.mjs → PEAnalyzer-D1lzJ_VG.mjs} +2 -2
- package/dist/PageController-Bqm2kZ_X.mjs +417 -0
- package/dist/{PointerChainEngine-Cd73qu5b.mjs → PointerChainEngine-BOhyVsjx.mjs} +4 -4
- package/dist/PrerequisiteError-Dl33Svkz.mjs +20 -0
- package/dist/ResponseBuilder-D3iFYx2N.mjs +143 -0
- package/dist/ReverseEvidenceGraph-Dlsk94LC.mjs +269 -0
- package/dist/ScriptManager-aHHq0X7U.mjs +3000 -0
- package/dist/{Speedhack-CeF0XmEz.mjs → Speedhack-CqdIFlQl.mjs} +2 -2
- package/dist/{StructureAnalyzer-D4GkMduU.mjs → StructureAnalyzer-DhFaPvRO.mjs} +3 -3
- package/dist/ToolCatalog-C0JGZoOm.mjs +582 -0
- package/dist/ToolError-jh9whhMd.mjs +15 -0
- package/dist/ToolProbe-oC7aPrkv.mjs +45 -0
- package/dist/ToolRegistry-BjaF4oNz.mjs +131 -0
- package/dist/ToolRouter.policy-BWV67ZK-.mjs +304 -0
- package/dist/TraceRecorder-DgxyVbdQ.mjs +519 -0
- package/dist/{Win32API-Bc0QnQsN.mjs → Win32API-CePkipZY.mjs} +1 -1
- package/dist/{Win32Debug-DUHt9XUn.mjs → Win32Debug-BvKs-gxc.mjs} +2 -2
- package/dist/WorkflowEngine-CuvkZtWu.mjs +598 -0
- package/dist/analysis-CL9uACt9.mjs +463 -0
- package/dist/antidebug-CqDTB_uk.mjs +1081 -0
- package/dist/artifactRetention-CFEprwPw.mjs +591 -0
- package/dist/artifacts-Bk2-_uPq.mjs +59 -0
- package/dist/betterSqlite3-0pqusHHH.mjs +74 -0
- package/dist/binary-instrument-CXfpx6fT.mjs +979 -0
- package/dist/bind-helpers-xFfRF-qm.mjs +22 -0
- package/dist/boringssl-inspector-BH2D3VKc.mjs +180 -0
- package/dist/browser-BpOr5PEx.mjs +4082 -0
- package/dist/concurrency-Bt0yv1kJ.mjs +41 -0
- package/dist/{constants-CCvsN80K.mjs → constants-B0OANIBL.mjs} +88 -46
- package/dist/coordination-qUbyF8KU.mjs +259 -0
- package/dist/debugger-gnKxRSN0.mjs +1271 -0
- package/dist/definitions-6M-eejaT.mjs +53 -0
- package/dist/definitions-B18eyf0B.mjs +18 -0
- package/dist/definitions-B3QdlrHv.mjs +34 -0
- package/dist/definitions-B4rAvHNZ.mjs +63 -0
- package/dist/definitions-BB_4jnmy.mjs +37 -0
- package/dist/definitions-BMfYXoNC.mjs +43 -0
- package/dist/definitions-Beid2EB3.mjs +27 -0
- package/dist/definitions-C1UvM5Iy.mjs +126 -0
- package/dist/definitions-CXEI7QC72.mjs +216 -0
- package/dist/definitions-C_4r7Fo-2.mjs +14 -0
- package/dist/definitions-CkFDALoa.mjs +26 -0
- package/dist/definitions-Cke7zEb8.mjs +94 -0
- package/dist/definitions-ClJLzsJQ.mjs +25 -0
- package/dist/definitions-Cq-zroAU.mjs +28 -0
- package/dist/definitions-Cy3Sl6gV.mjs +34 -0
- package/dist/definitions-D3VsGcvz.mjs +47 -0
- package/dist/definitions-DVGfrn7y.mjs +96 -0
- package/dist/definitions-LKpC3-nL.mjs +9 -0
- package/dist/definitions-bAhHQJq9.mjs +359 -0
- package/dist/encoding-Bvz5jLRv.mjs +1065 -0
- package/dist/evidence-graph-bridge-C_fv9PuC.mjs +135 -0
- package/dist/{factory-CibqTNC8.mjs → factory-DxlGh9Xf.mjs} +37 -52
- package/dist/graphql-DYWzJ29s.mjs +1026 -0
- package/dist/handlers-9sAbfIg-.mjs +2552 -0
- package/dist/handlers-Bl8zkwz1.mjs +2716 -0
- package/dist/handlers-C67ktuRN.mjs +710 -0
- package/dist/handlers-C87g8oCe.mjs +276 -0
- package/dist/handlers-CTsDAO6p.mjs +681 -0
- package/dist/handlers-Cgyg6c0U.mjs +645 -0
- package/dist/handlers-D6j6yka7.mjs +2124 -0
- package/dist/handlers-DdFzXLvF.mjs +446 -0
- package/dist/handlers-DeLOCd5m.mjs +799 -0
- package/dist/handlers-DlCJN4Td.mjs +757 -0
- package/dist/handlers-DxGIq15_2.mjs +917 -0
- package/dist/handlers-U6L4xhuF.mjs +585 -0
- package/dist/handlers-tB9Mp9ZK.mjs +84 -0
- package/dist/handlers-tiy7EIBp.mjs +572 -0
- package/dist/handlers.impl-DS0d9fUw.mjs +761 -0
- package/dist/hooks-CzCWByww.mjs +898 -0
- package/dist/index.mjs +384 -155
- package/dist/{logger-BmWzC2lM.mjs → logger-Dh_xb7_2.mjs} +14 -6
- package/dist/maintenance-P7ePRXQC.mjs +830 -0
- package/dist/manifest-2ToTpjv8.mjs +106 -0
- package/dist/manifest-3g71z6Bg.mjs +79 -0
- package/dist/manifest-82baTv4U.mjs +45 -0
- package/dist/manifest-B3QVVeBS.mjs +82 -0
- package/dist/manifest-BB2J8IMJ.mjs +149 -0
- package/dist/manifest-BKbgbSiY.mjs +60 -0
- package/dist/manifest-Bcf-TJzH.mjs +848 -0
- package/dist/manifest-BmtZzQiQ2.mjs +45 -0
- package/dist/manifest-Bnd7kqEY.mjs +55 -0
- package/dist/manifest-BqQX6OQC2.mjs +65 -0
- package/dist/manifest-BqrQ4Tpj.mjs +81 -0
- package/dist/manifest-Br4RPFt5.mjs +370 -0
- package/dist/manifest-C5qDjysN.mjs +107 -0
- package/dist/manifest-C9RT5nk32.mjs +34 -0
- package/dist/manifest-CAhOuvSl.mjs +204 -0
- package/dist/manifest-CBYWCUBJ.mjs +51 -0
- package/dist/manifest-CFADCRa1.mjs +37 -0
- package/dist/manifest-CQVhavRF.mjs +114 -0
- package/dist/manifest-CT7zZBV1.mjs +48 -0
- package/dist/manifest-CV12bcrF.mjs +121 -0
- package/dist/manifest-CXsRWjjI.mjs +224 -0
- package/dist/manifest-CZLUCfG02.mjs +95 -0
- package/dist/manifest-D6phHKFd.mjs +131 -0
- package/dist/manifest-DCyjf4n2.mjs +294 -0
- package/dist/manifest-DHsnKgP6.mjs +60 -0
- package/dist/manifest-Df_dliIe.mjs +55 -0
- package/dist/manifest-Dh8WBmEW.mjs +129 -0
- package/dist/manifest-DhKRAT8_.mjs +92 -0
- package/dist/manifest-DlpTj4ic2.mjs +193 -0
- package/dist/manifest-DrbmZcFl2.mjs +253 -0
- package/dist/manifest-DuwHjUa5.mjs +70 -0
- package/dist/manifest-DzwvxPJX.mjs +38 -0
- package/dist/manifest-NXctwWQq.mjs +68 -0
- package/dist/manifest-Sc_0JQ13.mjs +418 -0
- package/dist/manifest-gZ4s_UtG.mjs +96 -0
- package/dist/manifest-qSleDqdO.mjs +1023 -0
- package/dist/modules-C184v-S9.mjs +11365 -0
- package/dist/mojo-ipc-B_H61Afw.mjs +525 -0
- package/dist/network-671Cw6hV.mjs +3346 -0
- package/dist/{artifacts-BbdOMET5.mjs → outputPaths-B1uGmrWZ.mjs} +219 -212
- package/dist/parse-args-BlRjqlkL.mjs +39 -0
- package/dist/platform-WmNn8Sxb.mjs +2070 -0
- package/dist/process-QcbIy5Zq.mjs +1401 -0
- package/dist/proxy-DqNs0bAd.mjs +170 -0
- package/dist/registry-D-6e18lB.mjs +34 -0
- package/dist/response-BQVP-xUn.mjs +28 -0
- package/dist/server/plugin-api.mjs +2 -2
- package/dist/shared-state-board-DV-dpHFJ.mjs +586 -0
- package/dist/sourcemap-Dq8ez8vS.mjs +650 -0
- package/dist/ssrf-policy-ZaUfvhq7.mjs +166 -0
- package/dist/streaming-BUQ0VJsg.mjs +725 -0
- package/dist/tool-builder-DCbIC5Eo.mjs +186 -0
- package/dist/transform-CiYJfNX0.mjs +1007 -0
- package/dist/types-Bx92KJfT.mjs +4 -0
- package/dist/wasm-DQTnHDs4.mjs +531 -0
- package/dist/workflow-f3xJOcjx.mjs +725 -0
- package/package.json +48 -78
- package/dist/ExtensionManager-DqUSOamB.mjs +0 -2
- package/dist/ToolCatalog-CnwmMIw3.mjs +0 -61483
- package/dist/{CacheAdapters-CzFNpD9a.mjs → CacheAdapters-CDe5WPSV.mjs} +0 -0
- package/dist/{StealthVerifier-BzBCFiwx.mjs → StealthVerifier-Bo4T3bz8.mjs} +0 -0
- package/dist/{VersionDetector-CNXcvD46.mjs → VersionDetector-CwVLVdDM.mjs} +0 -0
- package/dist/{formatAddress-ChCSIRWT.mjs → formatAddress-DVkj9kpI.mjs} +0 -0
- package/dist/{types-BBjOqye-.mjs → types-CPhOReNX.mjs} +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/utils/concurrency.ts
|
|
2
|
+
function pLimit(concurrency) {
|
|
3
|
+
if (concurrency < 1) throw new RangeError("concurrency must be >= 1");
|
|
4
|
+
let activeCount = 0;
|
|
5
|
+
const queue = [];
|
|
6
|
+
function next() {
|
|
7
|
+
if (queue.length > 0 && activeCount < concurrency) {
|
|
8
|
+
activeCount++;
|
|
9
|
+
queue.shift()();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function run(fn) {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const execute = async () => {
|
|
15
|
+
try {
|
|
16
|
+
resolve(await fn());
|
|
17
|
+
} catch (err) {
|
|
18
|
+
reject(err);
|
|
19
|
+
} finally {
|
|
20
|
+
activeCount--;
|
|
21
|
+
next();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (activeCount < concurrency) {
|
|
25
|
+
activeCount++;
|
|
26
|
+
execute();
|
|
27
|
+
} else queue.push(() => {
|
|
28
|
+
execute();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return run;
|
|
33
|
+
}
|
|
34
|
+
/** External CLI calls, HAR export, large file I/O */
|
|
35
|
+
const ioLimit = pLimit(parseInt(process.env.jshook_IO_CONCURRENCY || "4", 10));
|
|
36
|
+
/** CPU-heavy: AST parsing, deobfuscation, binary decoding */
|
|
37
|
+
const cpuLimit = pLimit(parseInt(process.env.jshook_CPU_CONCURRENCY || "2", 10));
|
|
38
|
+
/** CDP-heavy: heap snapshots, traces, profiling */
|
|
39
|
+
const cdpLimit = pLimit(parseInt(process.env.jshook_CDP_CONCURRENCY || "2", 10));
|
|
40
|
+
//#endregion
|
|
41
|
+
export { cpuLimit as n, ioLimit as r, cdpLimit as t };
|
|
@@ -105,8 +105,8 @@ const TRANSFORM_WORKER_TIMEOUT_MS = int("TRANSFORM_WORKER_TIMEOUT_MS", 15e3);
|
|
|
105
105
|
int("TRANSFORM_VM_SCRIPT_TIMEOUT_MS", 5e3);
|
|
106
106
|
const TRANSFORM_CRYPTO_POOL_MAX_WORKERS = int("TRANSFORM_CRYPTO_POOL_MAX_WORKERS", 4);
|
|
107
107
|
const TRANSFORM_CRYPTO_POOL_IDLE_TIMEOUT_MS = int("TRANSFORM_CRYPTO_POOL_IDLE_TIMEOUT_MS", 3e4);
|
|
108
|
-
const TRANSFORM_CRYPTO_POOL_MAX_OLD_GEN_MB = int("TRANSFORM_CRYPTO_POOL_MAX_OLD_GEN_MB",
|
|
109
|
-
const TRANSFORM_CRYPTO_POOL_MAX_YOUNG_GEN_MB = int("TRANSFORM_CRYPTO_POOL_MAX_YOUNG_GEN_MB",
|
|
108
|
+
const TRANSFORM_CRYPTO_POOL_MAX_OLD_GEN_MB = int("TRANSFORM_CRYPTO_POOL_MAX_OLD_GEN_MB", 64);
|
|
109
|
+
const TRANSFORM_CRYPTO_POOL_MAX_YOUNG_GEN_MB = int("TRANSFORM_CRYPTO_POOL_MAX_YOUNG_GEN_MB", 16);
|
|
110
110
|
int("EMULATOR_FETCH_GOTO_TIMEOUT_MS", 3e4);
|
|
111
111
|
const WASM_TOOL_TIMEOUT_MS = int("WASM_TOOL_TIMEOUT_MS", 6e4);
|
|
112
112
|
int("WASM_OFFLINE_RUN_TIMEOUT_MS", 1e4);
|
|
@@ -125,17 +125,17 @@ int("NETWORK_REPLAY_TIMEOUT_MS", 3e4);
|
|
|
125
125
|
int("NETWORK_REPLAY_MAX_BODY_BYTES", 512e3);
|
|
126
126
|
const NETWORK_REPLAY_MAX_REDIRECTS = int("NETWORK_REPLAY_MAX_REDIRECTS", 5);
|
|
127
127
|
const NETWORK_HAR_BODY_CONCURRENCY = int("NETWORK_HAR_BODY_CONCURRENCY", 4);
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
int("WORKFLOW_BATCH_MAX_ACCOUNTS", 50);
|
|
129
|
+
int("WORKFLOW_BATCH_MAX_CONCURRENCY", 1);
|
|
130
130
|
int("WORKFLOW_REGISTER_ACCOUNT_TIMEOUT_MS", 6e4);
|
|
131
131
|
int("WORKFLOW_ACTION_DELAY_MS", 1e3);
|
|
132
132
|
int("WORKFLOW_SETTLE_DELAY_MS", 2e3);
|
|
133
133
|
int("WORKFLOW_INPUT_DELAY_MS", 1500);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
int("WORKFLOW_BATCH_MAX_RETRIES", 3);
|
|
135
|
+
int("WORKFLOW_BATCH_MAX_BACKOFF_MS", 3e4);
|
|
136
|
+
int("WORKFLOW_BATCH_MAX_TIMEOUT_MS", 3e5);
|
|
137
|
+
int("WORKFLOW_BATCH_RETRY_BACKOFF_MS", 2e3);
|
|
138
|
+
int("WORKFLOW_BATCH_TIMEOUT_PER_ACCOUNT_MS", 9e4);
|
|
139
139
|
const WORKFLOW_JS_BUNDLE_MAX_SIZE_BYTES = int("WORKFLOW_JS_BUNDLE_MAX_SIZE_BYTES", 20 * 1024 * 1024);
|
|
140
140
|
const WORKFLOW_JS_BUNDLE_MAX_REDIRECTS = int("WORKFLOW_JS_BUNDLE_MAX_REDIRECTS", 5);
|
|
141
141
|
const WORKFLOW_JS_BUNDLE_FETCH_TIMEOUT_MS = int("WORKFLOW_JS_BUNDLE_FETCH_TIMEOUT_MS", 3e4);
|
|
@@ -200,9 +200,6 @@ const COMPOUND_LONG_WINDOW_MS = int("COMPOUND_LONG_WINDOW_MS", 3e5);
|
|
|
200
200
|
/**
|
|
201
201
|
* GraphBoost-inspired search enhancements (see GraphBoost paper §4).
|
|
202
202
|
*
|
|
203
|
-
* SEARCH_TFIDF_COSINE_WEIGHT: weight of TF-IDF cosine similarity in hybrid
|
|
204
|
-
* scoring (0 = BM25 only, 1 = cosine only). Mirrors §4.1.3 hybrid retrieval.
|
|
205
|
-
*
|
|
206
203
|
* SEARCH_AFFINITY_BOOST_FACTOR: bonus applied to prefix-group neighbors of
|
|
207
204
|
* top search results. Mirrors §4.1.4 dependency hull expansion.
|
|
208
205
|
*
|
|
@@ -215,10 +212,9 @@ const COMPOUND_LONG_WINDOW_MS = int("COMPOUND_LONG_WINDOW_MS", 3e5);
|
|
|
215
212
|
* Mirrors §4.3 CSAPC cross-session caching. Raised to 500 to match the
|
|
216
213
|
* 431+ tool catalog size and reduce warm-cache miss rate.
|
|
217
214
|
*/
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
const SEARCH_DOMAIN_HUB_THRESHOLD = int("SEARCH_DOMAIN_HUB_THRESHOLD", 3);
|
|
215
|
+
const SEARCH_AFFINITY_BOOST_FACTOR = float("SEARCH_AFFINITY_BOOST_FACTOR", .36);
|
|
216
|
+
const SEARCH_AFFINITY_TOP_N = int("SEARCH_AFFINITY_TOP_N", 7);
|
|
217
|
+
const SEARCH_DOMAIN_HUB_THRESHOLD = int("SEARCH_DOMAIN_HUB_THRESHOLD", 6);
|
|
222
218
|
const SEARCH_QUERY_CACHE_CAPACITY = int("SEARCH_QUERY_CACHE_CAPACITY", 500);
|
|
223
219
|
/**
|
|
224
220
|
* Cache invalidation tolerance: cached entries are reusable while the
|
|
@@ -240,13 +236,13 @@ const SEARCH_CACHE_VECTOR_WEIGHT_TOLERANCE = float("SEARCH_CACHE_VECTOR_WEIGHT_T
|
|
|
240
236
|
* SEARCH_SYNONYM_EXPANSION_LIMIT: max synonym tokens added per original query term.
|
|
241
237
|
* SEARCH_PARAM_TOKEN_WEIGHT: weight for tool parameter name tokens in the index.
|
|
242
238
|
*/
|
|
243
|
-
const SEARCH_TRIGRAM_WEIGHT = float("SEARCH_TRIGRAM_WEIGHT", .
|
|
244
|
-
const SEARCH_TRIGRAM_THRESHOLD = float("SEARCH_TRIGRAM_THRESHOLD", .
|
|
245
|
-
const SEARCH_RRF_K = int("SEARCH_RRF_K",
|
|
246
|
-
const SEARCH_RRF_RESCALE_FACTOR = float("SEARCH_RRF_RESCALE_FACTOR",
|
|
247
|
-
const SEARCH_RRF_BM25_BLEND = float("SEARCH_RRF_BM25_BLEND", .
|
|
248
|
-
const SEARCH_SYNONYM_EXPANSION_LIMIT = int("SEARCH_SYNONYM_EXPANSION_LIMIT",
|
|
249
|
-
const SEARCH_PARAM_TOKEN_WEIGHT = float("SEARCH_PARAM_TOKEN_WEIGHT",
|
|
239
|
+
const SEARCH_TRIGRAM_WEIGHT = float("SEARCH_TRIGRAM_WEIGHT", .03);
|
|
240
|
+
const SEARCH_TRIGRAM_THRESHOLD = float("SEARCH_TRIGRAM_THRESHOLD", .15);
|
|
241
|
+
const SEARCH_RRF_K = int("SEARCH_RRF_K", 102);
|
|
242
|
+
const SEARCH_RRF_RESCALE_FACTOR = float("SEARCH_RRF_RESCALE_FACTOR", 2200);
|
|
243
|
+
const SEARCH_RRF_BM25_BLEND = float("SEARCH_RRF_BM25_BLEND", .76);
|
|
244
|
+
const SEARCH_SYNONYM_EXPANSION_LIMIT = int("SEARCH_SYNONYM_EXPANSION_LIMIT", 1);
|
|
245
|
+
const SEARCH_PARAM_TOKEN_WEIGHT = float("SEARCH_PARAM_TOKEN_WEIGHT", 3.4);
|
|
250
246
|
/**
|
|
251
247
|
* BM25 scoring parameters.
|
|
252
248
|
*
|
|
@@ -255,8 +251,8 @@ const SEARCH_PARAM_TOKEN_WEIGHT = float("SEARCH_PARAM_TOKEN_WEIGHT", 1.5);
|
|
|
255
251
|
* The previous hardcoded value of 0.3 under-penalized long descriptions,
|
|
256
252
|
* allowing verbose tools to crowd the top results.
|
|
257
253
|
*/
|
|
258
|
-
const SEARCH_BM25_K1 = float("SEARCH_BM25_K1",
|
|
259
|
-
const SEARCH_BM25_B = float("SEARCH_BM25_B", .
|
|
254
|
+
const SEARCH_BM25_K1 = float("SEARCH_BM25_K1", .8);
|
|
255
|
+
const SEARCH_BM25_B = float("SEARCH_BM25_B", .65);
|
|
260
256
|
/**
|
|
261
257
|
* Dense vector search (Phase 8 — Hybrid Semantic Routing).
|
|
262
258
|
*
|
|
@@ -271,17 +267,28 @@ const SEARCH_BM25_B = float("SEARCH_BM25_B", .75);
|
|
|
271
267
|
*/
|
|
272
268
|
const SEARCH_VECTOR_ENABLED = bool("SEARCH_VECTOR_ENABLED", true);
|
|
273
269
|
const SEARCH_VECTOR_MODEL_ID = str("SEARCH_VECTOR_MODEL_ID", "Xenova/bge-micro-v2");
|
|
274
|
-
const SEARCH_VECTOR_COSINE_WEIGHT = float("SEARCH_VECTOR_COSINE_WEIGHT", .
|
|
270
|
+
const SEARCH_VECTOR_COSINE_WEIGHT = float("SEARCH_VECTOR_COSINE_WEIGHT", .69);
|
|
275
271
|
const SEARCH_VECTOR_DYNAMIC_WEIGHT = bool("SEARCH_VECTOR_DYNAMIC_WEIGHT", true);
|
|
276
|
-
const SEARCH_VECTOR_LEARN_UP = float("SEARCH_VECTOR_LEARN_UP", .
|
|
277
|
-
const SEARCH_VECTOR_LEARN_DOWN = float("SEARCH_VECTOR_LEARN_DOWN", .
|
|
278
|
-
const SEARCH_VECTOR_LEARN_TOP_N = int("SEARCH_VECTOR_LEARN_TOP_N",
|
|
272
|
+
const SEARCH_VECTOR_LEARN_UP = float("SEARCH_VECTOR_LEARN_UP", .07);
|
|
273
|
+
const SEARCH_VECTOR_LEARN_DOWN = float("SEARCH_VECTOR_LEARN_DOWN", .02);
|
|
274
|
+
const SEARCH_VECTOR_LEARN_TOP_N = int("SEARCH_VECTOR_LEARN_TOP_N", 6);
|
|
275
|
+
/**
|
|
276
|
+
* SEARCH_VECTOR_BM25_SKIP_THRESHOLD: when the top BM25 score meets or exceeds
|
|
277
|
+
* this value, dense vector scoring is skipped — the text signal is already
|
|
278
|
+
* strong enough that embeddings rarely change the ranking.
|
|
279
|
+
* Set to 0 to always run vector scoring (original behavior).
|
|
280
|
+
*/
|
|
281
|
+
const SEARCH_VECTOR_BM25_SKIP_THRESHOLD = float("SEARCH_VECTOR_BM25_SKIP_THRESHOLD", 5);
|
|
279
282
|
/**
|
|
280
283
|
* Profile tier-aware ranking: tools whose domain is not visible under the
|
|
281
284
|
* caller's active tier (search ⊂ workflow ⊂ full) are not filtered out but
|
|
282
285
|
* downweighted by this multiplier (0..1). Setting to 1 disables the penalty.
|
|
283
286
|
*/
|
|
284
|
-
const SEARCH_TIER_PENALTY = float("SEARCH_TIER_PENALTY", .
|
|
287
|
+
const SEARCH_TIER_PENALTY = float("SEARCH_TIER_PENALTY", .35);
|
|
288
|
+
/** Per-profile tier penalty overrides. When set, these take precedence over SEARCH_TIER_PENALTY. */
|
|
289
|
+
const SEARCH_TIER_PENALTY_SEARCH = float("SEARCH_TIER_PENALTY_SEARCH", .88);
|
|
290
|
+
const SEARCH_TIER_PENALTY_WORKFLOW = float("SEARCH_TIER_PENALTY_WORKFLOW", .52);
|
|
291
|
+
const SEARCH_TIER_PENALTY_FULL = float("SEARCH_TIER_PENALTY_FULL", .64);
|
|
285
292
|
/**
|
|
286
293
|
* Recency / frequency boost: tools invoked within SEARCH_RECENCY_WINDOW_MS
|
|
287
294
|
* receive a log-scaled boost up to SEARCH_RECENCY_MAX_BOOST. Helps user-
|
|
@@ -291,7 +298,7 @@ const SEARCH_TIER_PENALTY = float("SEARCH_TIER_PENALTY", .7);
|
|
|
291
298
|
* long sessions; evicted entries are the oldest insertions (LRU).
|
|
292
299
|
*/
|
|
293
300
|
const SEARCH_RECENCY_WINDOW_MS = int("SEARCH_RECENCY_WINDOW_MS", 30 * 6e4);
|
|
294
|
-
const SEARCH_RECENCY_MAX_BOOST = float("SEARCH_RECENCY_MAX_BOOST", .
|
|
301
|
+
const SEARCH_RECENCY_MAX_BOOST = float("SEARCH_RECENCY_MAX_BOOST", .75);
|
|
295
302
|
const SEARCH_RECENCY_TRACKER_MAX = int("SEARCH_RECENCY_TRACKER_MAX", 200);
|
|
296
303
|
/**
|
|
297
304
|
* Additional fine-grained scoring knobs. These used to be hardcoded; moving
|
|
@@ -312,11 +319,11 @@ const SEARCH_RECENCY_TRACKER_MAX = int("SEARCH_RECENCY_TRACKER_MAX", 200);
|
|
|
312
319
|
* PREDICTIVE_MAX_SECOND_ORDER_KEYS — upper bound on the second-order
|
|
313
320
|
* Markov table to keep memory usage predictable.
|
|
314
321
|
*/
|
|
315
|
-
const SEARCH_EXACT_NAME_MATCH_MULTIPLIER = float("SEARCH_EXACT_NAME_MATCH_MULTIPLIER",
|
|
316
|
-
const SEARCH_DOMAIN_HUB_BOOST_MULTIPLIER = float("SEARCH_DOMAIN_HUB_BOOST_MULTIPLIER", 1.
|
|
317
|
-
const SEARCH_AFFINITY_BASE_WEIGHT = float("SEARCH_AFFINITY_BASE_WEIGHT", .
|
|
322
|
+
const SEARCH_EXACT_NAME_MATCH_MULTIPLIER = float("SEARCH_EXACT_NAME_MATCH_MULTIPLIER", 5.8);
|
|
323
|
+
const SEARCH_DOMAIN_HUB_BOOST_MULTIPLIER = float("SEARCH_DOMAIN_HUB_BOOST_MULTIPLIER", 1.11);
|
|
324
|
+
const SEARCH_AFFINITY_BASE_WEIGHT = float("SEARCH_AFFINITY_BASE_WEIGHT", .1);
|
|
318
325
|
const SEARCH_COVERAGE_PRECISION_FACTOR = float("SEARCH_COVERAGE_PRECISION_FACTOR", .5);
|
|
319
|
-
const SEARCH_PREFIX_MATCH_MULTIPLIER = float("SEARCH_PREFIX_MATCH_MULTIPLIER", .
|
|
326
|
+
const SEARCH_PREFIX_MATCH_MULTIPLIER = float("SEARCH_PREFIX_MATCH_MULTIPLIER", .32);
|
|
320
327
|
const PREDICTIVE_MAX_SECOND_ORDER_KEYS = int("PREDICTIVE_MAX_SECOND_ORDER_KEYS", 1e3);
|
|
321
328
|
const EXTENSION_GIT_CLONE_TIMEOUT_MS = int("EXTENSION_GIT_CLONE_TIMEOUT_MS", 6e4);
|
|
322
329
|
const EXTENSION_GIT_CHECKOUT_TIMEOUT_MS = int("EXTENSION_GIT_CHECKOUT_TIMEOUT_MS", 3e4);
|
|
@@ -361,23 +368,23 @@ int("ADV_DEOBF_LLM_MAX_TOKENS", 3e3);
|
|
|
361
368
|
int("VM_DEOBF_LLM_MAX_TOKENS", 4e3);
|
|
362
369
|
int("DEOBF_LLM_MAX_TOKENS", 2e3);
|
|
363
370
|
int("CRYPTO_DETECT_LLM_MAX_TOKENS", 2e3);
|
|
364
|
-
int("MEMORY_READ_TIMEOUT_MS", 1e4);
|
|
371
|
+
const MEMORY_READ_TIMEOUT_MS = int("MEMORY_READ_TIMEOUT_MS", 1e4);
|
|
365
372
|
const MEMORY_MAX_READ_BYTES = int("MEMORY_MAX_READ_BYTES", 16 * 1024 * 1024);
|
|
366
|
-
int("MEMORY_WRITE_TIMEOUT_MS", 1e4);
|
|
373
|
+
const MEMORY_WRITE_TIMEOUT_MS = int("MEMORY_WRITE_TIMEOUT_MS", 1e4);
|
|
367
374
|
const MEMORY_MAX_WRITE_BYTES = int("MEMORY_MAX_WRITE_BYTES", 16 * 1024);
|
|
368
|
-
int("MEMORY_DUMP_TIMEOUT_MS", 6e4);
|
|
369
|
-
int("MEMORY_SCAN_TIMEOUT_MS", 12e4);
|
|
370
|
-
int("MEMORY_SCAN_MAX_BUFFER_BYTES", 1024 * 1024 * 50);
|
|
375
|
+
const MEMORY_DUMP_TIMEOUT_MS = int("MEMORY_DUMP_TIMEOUT_MS", 6e4);
|
|
376
|
+
const MEMORY_SCAN_TIMEOUT_MS = int("MEMORY_SCAN_TIMEOUT_MS", 12e4);
|
|
377
|
+
const MEMORY_SCAN_MAX_BUFFER_BYTES = int("MEMORY_SCAN_MAX_BUFFER_BYTES", 1024 * 1024 * 50);
|
|
371
378
|
const MEMORY_SCAN_MAX_RESULTS = int("MEMORY_SCAN_MAX_RESULTS", 1e4);
|
|
372
379
|
int("MEMORY_SCAN_MAX_REGIONS", 5e4);
|
|
373
380
|
int("MEMORY_SCAN_REGION_MAX_BYTES", 16777216);
|
|
374
|
-
int("MEMORY_INJECT_TIMEOUT_MS", 3e4);
|
|
381
|
+
const MEMORY_INJECT_TIMEOUT_MS = int("MEMORY_INJECT_TIMEOUT_MS", 3e4);
|
|
375
382
|
const ENABLE_INJECTION_TOOLS = bool("ENABLE_INJECTION_TOOLS", true);
|
|
376
383
|
int("MEMORY_MONITOR_INTERVAL_MS", 1e3);
|
|
377
|
-
int("MEMORY_VMMAP_TIMEOUT_MS", 15e3);
|
|
378
|
-
int("MEMORY_PROTECTION_QUERY_TIMEOUT_MS", 15e3);
|
|
379
|
-
int("MEMORY_PROTECTION_PWSH_TIMEOUT_MS", 3e4);
|
|
380
|
-
int("NATIVE_ADMIN_CHECK_TIMEOUT_MS", 5e3);
|
|
384
|
+
const MEMORY_VMMAP_TIMEOUT_MS = int("MEMORY_VMMAP_TIMEOUT_MS", 15e3);
|
|
385
|
+
const MEMORY_PROTECTION_QUERY_TIMEOUT_MS = int("MEMORY_PROTECTION_QUERY_TIMEOUT_MS", 15e3);
|
|
386
|
+
const MEMORY_PROTECTION_PWSH_TIMEOUT_MS = int("MEMORY_PROTECTION_PWSH_TIMEOUT_MS", 3e4);
|
|
387
|
+
const NATIVE_ADMIN_CHECK_TIMEOUT_MS = int("NATIVE_ADMIN_CHECK_TIMEOUT_MS", 5e3);
|
|
381
388
|
int("NATIVE_SCAN_MAX_RESULTS", 1e4);
|
|
382
389
|
/** Launch wait after spawning a debug process (Linux/Mac). */
|
|
383
390
|
const PROCESS_LAUNCH_WAIT_MS = int("PROCESS_LAUNCH_WAIT_MS", 2e3);
|
|
@@ -459,6 +466,12 @@ const HTTP_RATE_LIMIT_MAX_IPS = int("HTTP_RATE_LIMIT_MAX_IPS", 1e4);
|
|
|
459
466
|
/** Frequency of the HTTP transport's rate-limit + session cleanup sweep. */
|
|
460
467
|
const HTTP_CLEANUP_INTERVAL_MS = int("HTTP_CLEANUP_INTERVAL_MS", 5 * 6e4);
|
|
461
468
|
int("SSE_HEARTBEAT_MS", 3e4);
|
|
469
|
+
/**
|
|
470
|
+
* When true, strip parameter descriptions from registered tool schemas
|
|
471
|
+
* to reduce the tools/list payload. Full schemas remain available via
|
|
472
|
+
* the describe_tool meta-tool. Default: true for full profile.
|
|
473
|
+
*/
|
|
474
|
+
const MCP_COMPACT_SCHEMA = bool("MCP_COMPACT_SCHEMA", true);
|
|
462
475
|
/** Hard ceiling applied to user-supplied sandbox exec timeouts. */
|
|
463
476
|
const SANDBOX_MAX_TIMEOUT_MS = int("SANDBOX_MAX_TIMEOUT_MS", 3e4);
|
|
464
477
|
int("NATIVE_BRIDGE_TIMEOUT_MS", 15e3);
|
|
@@ -473,5 +486,34 @@ int("ORCHESTRATOR_STEP_TIMEOUT_MS", 1e4);
|
|
|
473
486
|
const MACRO_DEFAULT_TIMEOUT_MS = int("MACRO_DEFAULT_TIMEOUT_MS", 12e4);
|
|
474
487
|
/** Default per-invocation timeout for built-in macro definitions. */
|
|
475
488
|
const MACRO_BUILTIN_TIMEOUT_MS = int("MACRO_BUILTIN_TIMEOUT_MS", 6e4);
|
|
489
|
+
/** Timeout for waiting on an iframe selector during frame resolution. */
|
|
490
|
+
const PAGE_FRAME_SELECTOR_TIMEOUT_MS = int("PAGE_FRAME_SELECTOR_TIMEOUT_MS", 1e4);
|
|
491
|
+
/** Timeout for waitForNetworkIdle in PageController. */
|
|
492
|
+
const PAGE_NETWORK_IDLE_TIMEOUT_MS = int("PAGE_NETWORK_IDLE_TIMEOUT_MS", 3e4);
|
|
493
|
+
/** Default limit for querySelectorAll results in DOMInspector. */
|
|
494
|
+
const DOM_QUERY_DEFAULT_LIMIT = int("DOM_QUERY_DEFAULT_LIMIT", 50);
|
|
495
|
+
/** Timeout for waitForElement (waitForSelector) in DOMInspector. */
|
|
496
|
+
const DOM_WAIT_ELEMENT_TIMEOUT_MS = int("DOM_WAIT_ELEMENT_TIMEOUT_MS", 3e4);
|
|
497
|
+
int("BROWSER_POOL_IDLE_TIMEOUT_MS", 3e5);
|
|
498
|
+
int("BROWSER_POOL_MAX_TABS", 10);
|
|
499
|
+
/** Default timeout for a single ICMP ping probe. */
|
|
500
|
+
const ICMP_PROBE_TIMEOUT_MS = int("ICMP_PROBE_TIMEOUT_MS", 5e3);
|
|
501
|
+
/** Default max hops for traceroute. */
|
|
502
|
+
const ICMP_TRACEROUTE_MAX_HOPS = int("ICMP_TRACEROUTE_MAX_HOPS", 30);
|
|
503
|
+
/** Default ICMP packet payload size in bytes. */
|
|
504
|
+
const ICMP_DEFAULT_PACKET_SIZE = int("ICMP_DEFAULT_PACKET_SIZE", 32);
|
|
505
|
+
int("ADB_VERSION_CHECK_TIMEOUT_MS", 5e3);
|
|
506
|
+
/** Timeout for page.goto when restoring a page snapshot. */
|
|
507
|
+
const COORDINATION_GOTO_TIMEOUT_MS = int("COORDINATION_GOTO_TIMEOUT_MS", 3e4);
|
|
508
|
+
/** Capacity of the ring-buffer audit trail for memory operations. */
|
|
509
|
+
const MEMORY_AUDIT_TRAIL_CAPACITY = int("MEMORY_AUDIT_TRAIL_CAPACITY", 5e3);
|
|
510
|
+
/** Timeout for process stop/continue signals during memory scan. */
|
|
511
|
+
const MEMORY_PROCESS_SIGNAL_TIMEOUT_MS = int("MEMORY_PROCESS_SIGNAL_TIMEOUT_MS", 2e3);
|
|
512
|
+
/** Timeout for shell probes during memory availability detection. */
|
|
513
|
+
const MEMORY_PROBE_CMD_TIMEOUT_MS = int("MEMORY_PROBE_CMD_TIMEOUT_MS", 5e3);
|
|
514
|
+
/** Timeout for vmmap and similar region enumeration subprocesses. */
|
|
515
|
+
const MEMORY_VMMAP_ENUM_TIMEOUT_MS = int("MEMORY_VMMAP_ENUM_TIMEOUT_MS", 15e3);
|
|
516
|
+
/** Timeout for PowerShell-based module listing subprocesses. */
|
|
517
|
+
const MEMORY_MODULES_TIMEOUT_MS = int("MEMORY_MODULES_TIMEOUT_MS", 3e4);
|
|
476
518
|
//#endregion
|
|
477
|
-
export {
|
|
519
|
+
export { GHIDRA_TIMEOUT_MS as $, SEARCH_WORKFLOW_DOMAIN_BOOST_MULTIPLIER as $n, PREDICTIVE_DECAY_FACTOR as $t, COMPOUND_EVENT_WINDOW_MS as A, SEARCH_PREFIX_MATCH_MULTIPLIER as An, WS_PAYLOAD_SAMPLE_LIMIT as Ar, MEMORY_MODULES_TIMEOUT_MS as At, DOM_WAIT_ELEMENT_TIMEOUT_MS as B, SEARCH_TIER_PENALTY_FULL as Bn, MEMORY_VMMAP_TIMEOUT_MS as Bt, CAPTCHA_MAX_TIMEOUT_MS as C, SEARCH_BM25_K1 as Cn, WORKFLOW_BUNDLE_CACHE_MAX_BYTES as Cr, MCP_HTTP_REQUEST_TIMEOUT_MS as Ct, CAPTCHA_SOLVER_BASE_URL as D, SEARCH_DOMAIN_HUB_THRESHOLD as Dn, WORKFLOW_JS_BUNDLE_MAX_SIZE_BYTES as Dr, MEMORY_INJECT_TIMEOUT_MS as Dt, CAPTCHA_RESULT_TIMEOUT_MS as E, SEARCH_DOMAIN_HUB_BOOST_MULTIPLIER as En, WORKFLOW_JS_BUNDLE_MAX_REDIRECTS as Er, MEMORY_DUMP_TIMEOUT_MS as Et, DEFAULT_DEBUG_PORT as F, SEARCH_RRF_BM25_BLEND as Fn, MEMORY_READ_TIMEOUT_MS as Ft, EXTERNAL_TOOL_MAX_STDERR_BYTES as G, SEARCH_VECTOR_BM25_SKIP_THRESHOLD as Gn, NETWORK_REPLAY_MAX_REDIRECTS as Gt, EXTENSION_GIT_CHECKOUT_TIMEOUT_MS as H, SEARCH_TIER_PENALTY_WORKFLOW as Hn, MOJO_MONITOR_TIMEOUT_MS as Ht, DETAILED_DATA_DEFAULT_TTL_MS as I, SEARCH_RRF_K as In, MEMORY_SCAN_MAX_BUFFER_BYTES as It, EXTERNAL_TOOL_PROBE_TIMEOUT_MS as J, SEARCH_VECTOR_ENABLED as Jn, POINTER_CHAIN_MAX_DEPTH as Jt, EXTERNAL_TOOL_MAX_STDOUT_BYTES as K, SEARCH_VECTOR_COSINE_WEIGHT as Kn, PAGE_FRAME_SELECTOR_TIMEOUT_MS as Kt, DETAILED_DATA_MAX_TTL_MS as L, SEARCH_RRF_RESCALE_FACTOR as Ln, MEMORY_SCAN_MAX_RESULTS as Lt, COORDINATION_GOTO_TIMEOUT_MS as M, SEARCH_RECENCY_MAX_BOOST as Mn, MEMORY_PROCESS_SIGNAL_TIMEOUT_MS as Mt, DEBUGGER_WAIT_FOR_PAUSED_TIMEOUT_MS as N, SEARCH_RECENCY_TRACKER_MAX as Nn, MEMORY_PROTECTION_PWSH_TIMEOUT_MS as Nt, CAPTCHA_SUBMIT_TIMEOUT_MS as O, SEARCH_EXACT_NAME_MATCH_MULTIPLIER as On, WRITE_HISTORY_MAX as Or, MEMORY_MAX_READ_BYTES as Ot, DEBUG_PORT_CANDIDATES as P, SEARCH_RECENCY_WINDOW_MS as Pn, MEMORY_PROTECTION_QUERY_TIMEOUT_MS as Pt, GHIDRA_BRIDGE_ENDPOINT as Q, SEARCH_VECTOR_MODEL_ID as Qn, PREDICTIVE_CONFIDENCE_THRESHOLD as Qt, DETAILED_DATA_SMART_THRESHOLD_BYTES as R, SEARCH_SYNONYM_EXPANSION_LIMIT as Rn, MEMORY_SCAN_TIMEOUT_MS as Rt, CAPTCHA_MAX_RETRIES as S, SEARCH_BM25_B as Sn, WORKER_POOL_MIN_WORKERS as Sr, MCP_HTTP_KEEPALIVE_TIMEOUT_MS as St, CAPTCHA_POLL_INTERVAL_MS as T, SEARCH_COVERAGE_PRECISION_FACTOR as Tn, WORKFLOW_JS_BUNDLE_FETCH_TIMEOUT_MS as Tr, MEMORY_AVAILABILITY_CACHE_TTL_MS as Tt, EXTENSION_GIT_CLONE_TIMEOUT_MS as U, SEARCH_TRIGRAM_THRESHOLD as Un, NATIVE_ADMIN_CHECK_TIMEOUT_MS as Ut, ENABLE_INJECTION_TOOLS as V, SEARCH_TIER_PENALTY_SEARCH as Vn, MEMORY_WRITE_TIMEOUT_MS as Vt, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS as W, SEARCH_TRIGRAM_WEIGHT as Wn, NETWORK_HAR_BODY_CONCURRENCY as Wt, FREEZE_DEFAULT_INTERVAL_MS as X, SEARCH_VECTOR_LEARN_TOP_N as Xn, POINTER_CHAIN_MAX_RESULTS as Xt, EXTERNAL_TOOL_TIMEOUT_MS as Y, SEARCH_VECTOR_LEARN_DOWN as Yn, POINTER_CHAIN_MAX_OFFSET as Yt, FRIDA_TIMEOUT_MS as Z, SEARCH_VECTOR_LEARN_UP as Zn, POINTER_CHAIN_SCAN_CHUNK_SIZE as Zt, BREAKPOINT_TRACE_MAX_HITS as _, SCAN_UNKNOWN_INITIAL_MAX_ADDRESSES as _n, WIN_DEBUG_PORT_POLL_ATTEMPTS as _r, MACRO_BUILTIN_TIMEOUT_MS as _t, ACTIVATION_TTL_MINUTES as a, RUNTIME_ERROR_WINDOW_MS as an, TOKEN_BUDGET_MAX_TOKENS as ar, HEAP_ENUMERATE_MAX_BLOCKS as at, CAPTCHA_DEFAULT_RETRIES as b, SEARCH_AFFINITY_BOOST_FACTOR as bn, WORKER_POOL_JOB_TIMEOUT_MS as br, MCP_HTTP_FORCE_CLOSE_TIMEOUT_MS as bt, ADB_WEBVIEW_HTTP_TIMEOUT_MS as c, SANDBOX_MEMORY_LIMIT_MB as cn, TRANSFORM_CRYPTO_POOL_MAX_WORKERS as cr, HEAP_SUSPICIOUS_BLOCK_SIZE as ct, ANALYSIS_MAX_SAFE_RESPONSE_BYTES as d, SCAN_DISPLAY_RESULTS_LIMIT as dn, UNIDBG_TIMEOUT_MS as dr, ICMP_DEFAULT_PACKET_SIZE as dt, PREDICTIVE_MAX_HISTORY as en, SHUTDOWN_TIMEOUT_MS as er, GRAPHQL_MAX_GRAPH_EDGES as et, ANALYSIS_MAX_SUMMARY_FILES as f, SCAN_GROUP_MAX_PATTERN_SIZE as fn, V8_BYTECODE_SUBPROC_TIMEOUT_MS as fr, ICMP_PROBE_TIMEOUT_MS as ft, BREAKPOINT_HIT_TIMEOUT_MS as g, SCAN_SESSION_TTL_MS as gn, WEBHOOK_PROCESS_TIMEOUT_MS as gr, JSVMP_MAX_ITERATIONS as gt, AUTOPRUNE_MANUAL_INACTIVITY_MS as h, SCAN_SESSION_MAX_COUNT as hn, WATCH_EVAL_TIMEOUT_MS as hr, JSVMP_DEOBFUSCATE_TIMEOUT_MS as ht, ACTIVATION_EVENT_HISTORY_MAX as i, RUNTIME_ERROR_THRESHOLD as in, STRUCT_VTABLE_MAX_FUNCTIONS as ir, GRAPHQL_MAX_SCHEMA_CHARS as it, COMPOUND_LONG_WINDOW_MS as j, SEARCH_QUERY_CACHE_CAPACITY as jn, MEMORY_PROBE_CMD_TIMEOUT_MS as jt, CODE_CAVE_MIN_SIZE as k, SEARCH_PARAM_TOKEN_WEIGHT as kn, WS_PAYLOAD_PREVIEW_LIMIT as kr, MEMORY_MAX_WRITE_BYTES as kt, ADB_WEBVIEW_WS_TIMEOUT_MS as l, SANDBOX_STACK_SIZE_MB as ln, TRANSFORM_CRYPTO_POOL_MAX_YOUNG_GEN_MB as lr, HTTP_CLEANUP_INTERVAL_MS as lt, AUTOPRUNE_CHECK_INTERVAL_MS as m, SCAN_POINTER_MAX_RESULTS as mn, WASM_TOOL_TIMEOUT_MS as mr, IDA_BRIDGE_ENDPOINT as mt, ACTIVATION_COMPOUND_EVAL_EVERY as n, PROCESS_LAUNCH_WAIT_MS as nn, STRUCT_ANALYZE_DEFAULT_SIZE as nr, GRAPHQL_MAX_PREVIEW_CHARS as nt, ADB_DEFAULT_TIMEOUT_MS as o, SANDBOX_EXEC_TIMEOUT_MS as on, TRANSFORM_CRYPTO_POOL_IDLE_TIMEOUT_MS as or, HEAP_SPRAY_SIZE_TOLERANCE as ot, AUTOPRUNE_AUTO_INACTIVITY_MS as p, SCAN_MAX_RESULTS_PER_SCAN as pn, WASM_OPTIMIZE_TIMEOUT_MS as pr, ICMP_TRACEROUTE_MAX_HOPS as pt, EXTERNAL_TOOL_PROBE_CACHE_TTL_MS as q, SEARCH_VECTOR_DYNAMIC_WEIGHT as qn, PAGE_NETWORK_IDLE_TIMEOUT_MS as qt, ACTIVATION_COOLDOWN_MS as r, PROCESS_LIST_MAX_BUFFER_BYTES as rn, STRUCT_RTTI_MAX_STRING_LEN as rr, GRAPHQL_MAX_QUERY_CHARS as rt, ADB_SHELL_TIMEOUT_MS as s, SANDBOX_MAX_TIMEOUT_MS as sn, TRANSFORM_CRYPTO_POOL_MAX_OLD_GEN_MB as sr, HEAP_SPRAY_THRESHOLD as st, ACTIVATION_BOOST_WINDOW_MS as t, PREDICTIVE_MAX_SECOND_ORDER_KEYS as tn, SOURCEMAP_EXT_TIMEOUT_MS as tr, GRAPHQL_MAX_GRAPH_NODES as tt, ANALYSIS_MAX_SAFE_COLLECTED_BYTES as u, SANDBOX_TERMINATE_GRACE_MS as un, TRANSFORM_WORKER_TIMEOUT_MS as ur, HTTP_RATE_LIMIT_MAX_IPS as ut, CACHE_GLOBAL_MAX_SIZE_BYTES as v, SCRIPTS_MAX_CAP as vn, WIN_DEBUG_PORT_POLL_INTERVAL_MS as vr, MACRO_DEFAULT_TIMEOUT_MS as vt, CAPTCHA_MIN_TIMEOUT_MS as w, SEARCH_CACHE_VECTOR_WEIGHT_TOLERANCE as wn, WORKFLOW_BUNDLE_CACHE_TTL_MS as wr, MEMORY_AUDIT_TRAIL_CAPACITY as wt, CAPTCHA_DEFAULT_TIMEOUT_MS as x, SEARCH_AFFINITY_TOP_N as xn, WORKER_POOL_MAX_WORKERS as xr, MCP_HTTP_HEADERS_TIMEOUT_MS as xt, CACHE_LOW_HIT_RATE_THRESHOLD as y, SEARCH_AFFINITY_BASE_WEIGHT as yn, WORKER_POOL_IDLE_TIMEOUT_MS as yr, MCP_COMPACT_SCHEMA as yt, DOM_QUERY_DEFAULT_LIMIT as z, SEARCH_TIER_PENALTY as zn, MEMORY_VMMAP_ENUM_TIMEOUT_MS as zt };
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { M as COORDINATION_GOTO_TIMEOUT_MS } from "./constants-B0OANIBL.mjs";
|
|
2
|
+
import "./definitions-CkFDALoa.mjs";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
//#region src/server/domains/coordination/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Coordination domain handler — manages Planner/Specialist Agent handoffs
|
|
7
|
+
* and session-level insight accumulation.
|
|
8
|
+
*
|
|
9
|
+
* All state is in-memory for the lifetime of the MCP session.
|
|
10
|
+
* No persistence — handoffs and insights are ephemeral by design
|
|
11
|
+
* (use the knowledge-base plugin repository for cross-session persistence).
|
|
12
|
+
*/
|
|
13
|
+
var CoordinationHandlers = class {
|
|
14
|
+
handoffs = /* @__PURE__ */ new Map();
|
|
15
|
+
insights = [];
|
|
16
|
+
ctx;
|
|
17
|
+
constructor(ctx) {
|
|
18
|
+
this.ctx = ctx;
|
|
19
|
+
}
|
|
20
|
+
async handleCreateTaskHandoff(args) {
|
|
21
|
+
const description = args.description;
|
|
22
|
+
const constraints = args.constraints;
|
|
23
|
+
const targetDomain = args.targetDomain;
|
|
24
|
+
let pageUrl;
|
|
25
|
+
try {
|
|
26
|
+
const pc = this.ctx.pageController;
|
|
27
|
+
if (pc) {
|
|
28
|
+
const resolvedPage = await pc.getPage?.();
|
|
29
|
+
if (resolvedPage && typeof resolvedPage.url === "function") pageUrl = resolvedPage.url();
|
|
30
|
+
}
|
|
31
|
+
} catch {}
|
|
32
|
+
const handoff = {
|
|
33
|
+
id: randomUUID().slice(0, 8),
|
|
34
|
+
status: "pending",
|
|
35
|
+
description,
|
|
36
|
+
constraints,
|
|
37
|
+
targetDomain,
|
|
38
|
+
pageUrl,
|
|
39
|
+
createdAt: Date.now()
|
|
40
|
+
};
|
|
41
|
+
this.handoffs.set(handoff.id, handoff);
|
|
42
|
+
return {
|
|
43
|
+
taskId: handoff.id,
|
|
44
|
+
status: handoff.status,
|
|
45
|
+
description: handoff.description,
|
|
46
|
+
constraints: handoff.constraints,
|
|
47
|
+
targetDomain: handoff.targetDomain,
|
|
48
|
+
pageUrl: handoff.pageUrl,
|
|
49
|
+
createdAt: new Date(handoff.createdAt).toISOString(),
|
|
50
|
+
totalActiveHandoffs: this.handoffs.size
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async handleCompleteTaskHandoff(args) {
|
|
54
|
+
const taskId = args.taskId;
|
|
55
|
+
const summary = args.summary;
|
|
56
|
+
const keyFindings = args.keyFindings;
|
|
57
|
+
const artifacts = args.artifacts;
|
|
58
|
+
const handoff = this.handoffs.get(taskId);
|
|
59
|
+
if (!handoff) throw new Error(`Task handoff "${taskId}" not found. Active IDs: ${[...this.handoffs.keys()].join(", ") || "(none)"}`);
|
|
60
|
+
if (handoff.status === "completed") throw new Error(`Task handoff "${taskId}" is already completed`);
|
|
61
|
+
handoff.status = "completed";
|
|
62
|
+
handoff.completedAt = Date.now();
|
|
63
|
+
handoff.summary = summary;
|
|
64
|
+
handoff.keyFindings = keyFindings;
|
|
65
|
+
handoff.artifacts = artifacts;
|
|
66
|
+
return {
|
|
67
|
+
taskId: handoff.id,
|
|
68
|
+
status: "completed",
|
|
69
|
+
summary: handoff.summary,
|
|
70
|
+
keyFindings: handoff.keyFindings,
|
|
71
|
+
artifacts: handoff.artifacts,
|
|
72
|
+
durationMs: handoff.completedAt - handoff.createdAt
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async handleGetTaskContext(args) {
|
|
76
|
+
const taskId = args.taskId;
|
|
77
|
+
if (taskId) {
|
|
78
|
+
const handoff = this.handoffs.get(taskId);
|
|
79
|
+
if (!handoff) throw new Error(`Task handoff "${taskId}" not found`);
|
|
80
|
+
return { handoff: this.serializeHandoff(handoff) };
|
|
81
|
+
}
|
|
82
|
+
const handoffs = [...this.handoffs.values()].map((h) => this.serializeHandoff(h));
|
|
83
|
+
const active = handoffs.filter((h) => h.status !== "completed");
|
|
84
|
+
const completed = handoffs.filter((h) => h.status === "completed");
|
|
85
|
+
return {
|
|
86
|
+
active,
|
|
87
|
+
completed,
|
|
88
|
+
sessionInsights: this.insights.map((i) => ({
|
|
89
|
+
id: i.id,
|
|
90
|
+
category: i.category,
|
|
91
|
+
content: i.content,
|
|
92
|
+
confidence: i.confidence,
|
|
93
|
+
timestamp: new Date(i.timestamp).toISOString(),
|
|
94
|
+
sourceTaskId: i.sourceTaskId
|
|
95
|
+
})),
|
|
96
|
+
summary: {
|
|
97
|
+
totalActive: active.length,
|
|
98
|
+
totalCompleted: completed.length,
|
|
99
|
+
totalInsights: this.insights.length
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
async handleAppendSessionInsight(args) {
|
|
104
|
+
const category = args.category;
|
|
105
|
+
const content = args.content;
|
|
106
|
+
const confidence = args.confidence ?? 1;
|
|
107
|
+
const activeHandoff = [...this.handoffs.values()].find((h) => h.status === "in_progress" || h.status === "pending");
|
|
108
|
+
const insight = {
|
|
109
|
+
id: randomUUID().slice(0, 8),
|
|
110
|
+
category,
|
|
111
|
+
content,
|
|
112
|
+
confidence,
|
|
113
|
+
timestamp: Date.now(),
|
|
114
|
+
sourceTaskId: activeHandoff?.id
|
|
115
|
+
};
|
|
116
|
+
this.insights.push(insight);
|
|
117
|
+
return {
|
|
118
|
+
insightId: insight.id,
|
|
119
|
+
category: insight.category,
|
|
120
|
+
totalInsights: this.insights.length,
|
|
121
|
+
totalByCategory: this.getInsightCountByCategory()
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
serializeHandoff(h) {
|
|
125
|
+
return {
|
|
126
|
+
taskId: h.id,
|
|
127
|
+
status: h.status,
|
|
128
|
+
description: h.description,
|
|
129
|
+
constraints: h.constraints,
|
|
130
|
+
targetDomain: h.targetDomain,
|
|
131
|
+
pageUrl: h.pageUrl,
|
|
132
|
+
createdAt: new Date(h.createdAt).toISOString(),
|
|
133
|
+
completedAt: h.completedAt ? new Date(h.completedAt).toISOString() : void 0,
|
|
134
|
+
summary: h.summary,
|
|
135
|
+
keyFindings: h.keyFindings,
|
|
136
|
+
artifacts: h.artifacts
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
getInsightCountByCategory() {
|
|
140
|
+
const counts = {};
|
|
141
|
+
for (const insight of this.insights) counts[insight.category] = (counts[insight.category] ?? 0) + 1;
|
|
142
|
+
return counts;
|
|
143
|
+
}
|
|
144
|
+
snapshots = /* @__PURE__ */ new Map();
|
|
145
|
+
async handleSavePageSnapshot(args) {
|
|
146
|
+
const label = args.label;
|
|
147
|
+
const pc = this.ctx.pageController;
|
|
148
|
+
if (!pc) throw new Error("No page controller available");
|
|
149
|
+
const page = await pc.getPage();
|
|
150
|
+
if (!page) throw new Error("No active page to snapshot");
|
|
151
|
+
const url = page.url();
|
|
152
|
+
let cookies = [];
|
|
153
|
+
try {
|
|
154
|
+
const cdp = await page.createCDPSession();
|
|
155
|
+
cookies = (await cdp.send("Network.getAllCookies")).cookies.map((c) => ({
|
|
156
|
+
name: c.name,
|
|
157
|
+
value: c.value,
|
|
158
|
+
domain: c.domain,
|
|
159
|
+
path: c.path
|
|
160
|
+
}));
|
|
161
|
+
await cdp.detach();
|
|
162
|
+
} catch {}
|
|
163
|
+
let localStorage = {};
|
|
164
|
+
let sessionStorage = {};
|
|
165
|
+
try {
|
|
166
|
+
localStorage = await page.evaluate(() => {
|
|
167
|
+
const ls = {};
|
|
168
|
+
for (let i = 0; i < window.localStorage.length; i++) {
|
|
169
|
+
const key = window.localStorage.key(i);
|
|
170
|
+
if (key) ls[key] = window.localStorage.getItem(key) ?? "";
|
|
171
|
+
}
|
|
172
|
+
return ls;
|
|
173
|
+
});
|
|
174
|
+
sessionStorage = await page.evaluate(() => {
|
|
175
|
+
const ss = {};
|
|
176
|
+
for (let i = 0; i < window.sessionStorage.length; i++) {
|
|
177
|
+
const key = window.sessionStorage.key(i);
|
|
178
|
+
if (key) ss[key] = window.sessionStorage.getItem(key) ?? "";
|
|
179
|
+
}
|
|
180
|
+
return ss;
|
|
181
|
+
});
|
|
182
|
+
} catch {}
|
|
183
|
+
const snapshot = {
|
|
184
|
+
id: randomUUID().slice(0, 8),
|
|
185
|
+
url,
|
|
186
|
+
cookies,
|
|
187
|
+
localStorage,
|
|
188
|
+
sessionStorage,
|
|
189
|
+
timestamp: Date.now(),
|
|
190
|
+
label
|
|
191
|
+
};
|
|
192
|
+
this.snapshots.set(snapshot.id, snapshot);
|
|
193
|
+
return {
|
|
194
|
+
snapshotId: snapshot.id,
|
|
195
|
+
url: snapshot.url,
|
|
196
|
+
cookieCount: snapshot.cookies.length,
|
|
197
|
+
localStorageKeys: Object.keys(snapshot.localStorage).length,
|
|
198
|
+
sessionStorageKeys: Object.keys(snapshot.sessionStorage).length,
|
|
199
|
+
label: snapshot.label
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
async handleRestorePageSnapshot(args) {
|
|
203
|
+
const snapshotId = args.snapshotId;
|
|
204
|
+
if (!snapshotId) throw new Error("snapshotId is required");
|
|
205
|
+
const snapshot = this.snapshots.get(snapshotId);
|
|
206
|
+
if (!snapshot) throw new Error(`Snapshot "${snapshotId}" not found`);
|
|
207
|
+
const pc = this.ctx.pageController;
|
|
208
|
+
if (!pc) throw new Error("No page controller available");
|
|
209
|
+
const page = await pc.getPage();
|
|
210
|
+
if (!page) throw new Error("No active page for restoration");
|
|
211
|
+
await page.goto(snapshot.url, {
|
|
212
|
+
waitUntil: "domcontentloaded",
|
|
213
|
+
timeout: COORDINATION_GOTO_TIMEOUT_MS
|
|
214
|
+
});
|
|
215
|
+
if (snapshot.cookies.length > 0) try {
|
|
216
|
+
const cdp = await page.createCDPSession();
|
|
217
|
+
await cdp.send("Network.setCookies", { cookies: snapshot.cookies.map((c) => ({
|
|
218
|
+
name: c.name,
|
|
219
|
+
value: c.value,
|
|
220
|
+
domain: c.domain,
|
|
221
|
+
path: c.path
|
|
222
|
+
})) });
|
|
223
|
+
await cdp.detach();
|
|
224
|
+
} catch {}
|
|
225
|
+
try {
|
|
226
|
+
await page.evaluate((ls, ss) => {
|
|
227
|
+
window.localStorage.clear();
|
|
228
|
+
for (const [k, v] of Object.entries(ls)) window.localStorage.setItem(k, v);
|
|
229
|
+
window.sessionStorage.clear();
|
|
230
|
+
for (const [k, v] of Object.entries(ss)) window.sessionStorage.setItem(k, v);
|
|
231
|
+
}, snapshot.localStorage, snapshot.sessionStorage);
|
|
232
|
+
} catch {}
|
|
233
|
+
return {
|
|
234
|
+
restored: true,
|
|
235
|
+
snapshotId: snapshot.id,
|
|
236
|
+
url: snapshot.url,
|
|
237
|
+
cookiesRestored: snapshot.cookies.length,
|
|
238
|
+
localStorageKeysRestored: Object.keys(snapshot.localStorage).length,
|
|
239
|
+
sessionStorageKeysRestored: Object.keys(snapshot.sessionStorage).length
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
async handleListPageSnapshots() {
|
|
243
|
+
const list = [...this.snapshots.values()].map((s) => ({
|
|
244
|
+
id: s.id,
|
|
245
|
+
url: s.url,
|
|
246
|
+
label: s.label,
|
|
247
|
+
cookieCount: s.cookies.length,
|
|
248
|
+
localStorageKeys: Object.keys(s.localStorage).length,
|
|
249
|
+
sessionStorageKeys: Object.keys(s.sessionStorage).length,
|
|
250
|
+
createdAt: new Date(s.timestamp).toISOString()
|
|
251
|
+
}));
|
|
252
|
+
return {
|
|
253
|
+
snapshots: list,
|
|
254
|
+
total: list.length
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
//#endregion
|
|
259
|
+
export { CoordinationHandlers };
|