@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,216 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/network/definitions.ts
|
|
3
|
+
const networkAuthorizationSchema = {
|
|
4
|
+
allowedHosts: {
|
|
5
|
+
type: "array",
|
|
6
|
+
items: { type: "string" },
|
|
7
|
+
description: "Exact hostnames or IP literals allowed for this request."
|
|
8
|
+
},
|
|
9
|
+
allowedCidrs: {
|
|
10
|
+
type: "array",
|
|
11
|
+
items: { type: "string" },
|
|
12
|
+
description: "Explicit CIDR ranges allowed for this request."
|
|
13
|
+
},
|
|
14
|
+
allowPrivateNetwork: {
|
|
15
|
+
type: "boolean",
|
|
16
|
+
description: "Allow access to private or reserved network targets, but only when the resolved host matches allowedHosts or allowedCidrs."
|
|
17
|
+
},
|
|
18
|
+
allowInsecureHttp: {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
description: "Allow plain HTTP access to explicitly authorized targets in allowedHosts or allowedCidrs."
|
|
21
|
+
},
|
|
22
|
+
expiresAt: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Optional ISO-8601 expiry time for this authorization."
|
|
25
|
+
},
|
|
26
|
+
reason: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: "Short audit note describing why this authorization is needed."
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const advancedTools = [
|
|
32
|
+
tool("network_enable", (t) => t.desc("Enable network request monitoring. Must be called before page_navigate to capture requests.\n\nCorrect order:\n1. network_enable()\n2. page_navigate(\"https://example.com\")\n3. network_get_requests()\n\nOr use enableNetworkMonitoring parameter on page_navigate.").boolean("enableExceptions", "Also capture uncaught exceptions", { default: true })),
|
|
33
|
+
tool("network_disable", (t) => t.desc("Disable network request monitoring").destructive()),
|
|
34
|
+
tool("network_get_status", (t) => t.desc("Get network monitoring status (enabled, request count, response count)").query()),
|
|
35
|
+
tool("network_monitor", (t) => t.desc("Manage network request monitoring. Enable/disable monitoring or check status. Must enable before page_navigate to capture requests.").enum("action", [
|
|
36
|
+
"enable",
|
|
37
|
+
"disable",
|
|
38
|
+
"status"
|
|
39
|
+
], "Action to perform").boolean("enableExceptions", "Only for enable action: Also capture uncaught exceptions", { default: true }).required("action")),
|
|
40
|
+
tool("network_get_requests", (t) => t.desc("Get captured network requests. Large results (>25KB) automatically return a summary with detailId.\n\nPrerequisites:\n1. Call network_enable first\n2. Navigate to a page\n\nResponse fields:\n- requestId: unique request identifier\n- url: request URL\n- method: HTTP method (GET/POST)\n- headers: request headers\n- postData: POST body (if present)\n- timestamp: capture time\n- type: resource type (Document/Script/XHR)\n\nDefault behavior:\n- Static resources (Image/Font/Stylesheet/Media) are excluded when no filters are set\n- Results are sorted by type priority: XHR > Fetch > Document > Script > Other\n- Set any filter (url, method, etc.) to include all resource types\n\nBest practices:\n1. Use url filter to reduce result size\n2. Use offset+limit for pagination instead of multiple get_detailed_data calls\n3. Use get_detailed_data(detailId) for full data when summary is returned\n4. If 0 results returned, call console_inject_fetch_interceptor() then re-navigate to capture frontend-wrapped fetch/XHR calls").string("url", "Filter by URL substring (e.g., \"api\" matches all API URLs)").string("urlRegex", "Filter by URL regex pattern (e.g., \"/api/(v[12]|auth)/\"). Takes precedence over url substring.").string("method", "Filter by HTTP method (GET, POST, PUT, DELETE)").number("sinceTimestamp", "Only return requests after this epoch timestamp (milliseconds). Useful for incremental polling.").string("sinceRequestId", "Only return requests after this requestId (exclusive). Useful for incremental retrieval.").number("tail", "Return the last N requests (applied after all other filters). E.g., tail=5 returns the 5 most recent.").number("limit", "Maximum number of results per page (default: 100, max: 1000)", {
|
|
41
|
+
default: 100,
|
|
42
|
+
minimum: 1,
|
|
43
|
+
maximum: 1e3
|
|
44
|
+
}).number("offset", "Skip first N results for pagination (default: 0). Use page.nextOffset from previous response.", {
|
|
45
|
+
default: 0,
|
|
46
|
+
minimum: 0
|
|
47
|
+
}).boolean("autoEnable", "Auto-enable network monitoring when currently disabled", { default: true }).boolean("enableExceptions", "When autoEnable=true, also enable uncaught exception monitoring", { default: true })),
|
|
48
|
+
tool("network_get_response_body", (t) => t.desc("Get response body for a specific request. Auto-truncates responses >100KB. Use returnSummary=true for large files.").string("requestId", "Request ID (from network_get_requests)").number("maxSize", "Maximum response size in bytes", {
|
|
49
|
+
default: 1e5,
|
|
50
|
+
minimum: 1024,
|
|
51
|
+
maximum: 2e7
|
|
52
|
+
}).boolean("returnSummary", "Return only size and preview instead of full body", { default: false }).number("retries", "Retry count when response body is not yet available", {
|
|
53
|
+
default: 3,
|
|
54
|
+
minimum: 0,
|
|
55
|
+
maximum: 10
|
|
56
|
+
}).number("retryIntervalMs", "Retry interval in milliseconds", {
|
|
57
|
+
default: 500,
|
|
58
|
+
minimum: 100,
|
|
59
|
+
maximum: 1e4
|
|
60
|
+
}).boolean("autoEnable", "Auto-enable network monitoring when currently disabled", { default: false }).boolean("enableExceptions", "When autoEnable=true, also enable uncaught exception monitoring", { default: true }).required("requestId")),
|
|
61
|
+
tool("network_get_stats", (t) => t.desc("Get network statistics (total requests, response count, error rate, timing)").query()),
|
|
62
|
+
tool("performance_get_metrics", (t) => t.desc("Get page performance metrics (Web Vitals: FCP, LCP, FID, CLS)").boolean("includeTimeline", "Include detailed timeline events", { default: false }).query()),
|
|
63
|
+
tool("performance_coverage", (t) => t.desc("Start or stop JavaScript and CSS code coverage recording").enum("action", ["start", "stop"], "Coverage action").required("action")),
|
|
64
|
+
tool("performance_take_heap_snapshot", (t) => t.desc("Take a V8 heap memory snapshot")),
|
|
65
|
+
tool("performance_trace", (t) => t.desc(`Chrome Performance Trace recording. Action 'start' begins capture; 'stop' ends and saves trace file.
|
|
66
|
+
|
|
67
|
+
Captures timeline events (JS execution, layout, paint, rendering) loadable in Chrome DevTools Performance tab.`).enum("action", ["start", "stop"], "Trace action").array("categories", { type: "string" }, "Trace categories (action=start, default: devtools.timeline, v8.execute)").boolean("screenshots", "Capture screenshots during tracing (action=start, default: false)", { default: false }).string("artifactPath", "Custom output path (action=stop)").required("action")),
|
|
68
|
+
tool("profiler_cpu", (t) => t.desc(`CDP CPU profiling. Action 'start' begins recording; 'stop' ends and saves profile with top hot functions.`).enum("action", ["start", "stop"], "Profiler action").string("artifactPath", "Custom output path (action=stop)").required("action")),
|
|
69
|
+
tool("profiler_heap_sampling", (t) => t.desc(`V8 heap allocation sampling. Action 'start' begins tracking; 'stop' ends and returns top allocators.`).enum("action", ["start", "stop"], "Sampling action").number("samplingInterval", "Sampling interval bytes (action=start, default: 32768)", {
|
|
70
|
+
default: 32768,
|
|
71
|
+
minimum: 256,
|
|
72
|
+
maximum: 1048576
|
|
73
|
+
}).string("artifactPath", "Custom output path (action=stop)").number("topN", "Number of top allocators (action=stop, default: 20)", {
|
|
74
|
+
default: 20,
|
|
75
|
+
minimum: 1,
|
|
76
|
+
maximum: 100
|
|
77
|
+
}).required("action")),
|
|
78
|
+
tool("console_get_exceptions", (t) => t.desc("Get captured uncaught exceptions from the page").string("url", "Filter by URL substring").number("limit", "Maximum number of exceptions to return", {
|
|
79
|
+
default: 50,
|
|
80
|
+
minimum: 1,
|
|
81
|
+
maximum: 1e3
|
|
82
|
+
}).readOnly()),
|
|
83
|
+
tool("console_inject", (t) => t.desc(`Inject an in-page monitor/interceptor. Types:
|
|
84
|
+
- script: Track dynamically created script elements
|
|
85
|
+
- xhr: Capture AJAX request/response data
|
|
86
|
+
- fetch: Capture fetch() calls (useful when CDP misses wrapped fetch)
|
|
87
|
+
- function: Proxy-based tracer for a named global function (requires functionName)`).enum("type", [
|
|
88
|
+
"script",
|
|
89
|
+
"xhr",
|
|
90
|
+
"fetch",
|
|
91
|
+
"function"
|
|
92
|
+
], "Injection type").string("functionName", "Global function path to trace (type=function, e.g. \"window.someFunction\")").boolean("persistent", "Survive page navigations via evaluateOnNewDocument (default: false)", { default: false }).required("type").openWorld()),
|
|
93
|
+
tool("console_buffers", (t) => t.desc("Manage injected interceptor state.").enum("action", ["clear", "reset"], "Buffer action: clear buffers or reset interceptors").required("action")),
|
|
94
|
+
tool("http_request_build", (t) => t.desc("Build a raw HTTP/1.x request payload with CRLF line endings. Useful for preparing deterministic request text for http_plain_request or other raw socket tools.").string("method", "HTTP method token, e.g. GET, POST, HEAD").string("target", "Request target, such as /path, *, or an absolute-form URL").string("host", "Optional Host header value to inject when addHostHeader is enabled").object("headers", { additionalProperties: { type: "string" } }, "Optional HTTP headers to include in the request").string("body", "Optional UTF-8 request body").enum("httpVersion", ["1.0", "1.1"], "HTTP protocol version to emit. Default: 1.1", { default: "1.1" }).boolean("addHostHeader", "Auto-add the Host header when host is provided", { default: true }).boolean("addContentLength", "Auto-add Content-Length when a body is present and Transfer-Encoding is absent", { default: true }).boolean("addConnectionClose", "Auto-add Connection: close when absent", { default: true }).requiredOpenWorld("method", "target")),
|
|
95
|
+
tool("http_plain_request", (t) => t.desc("Send a raw HTTP request over plain TCP using deterministic server-side logic with DNS pinning, response parsing, and bounded capture. Non-loopback HTTP targets require explicit request-scoped authorization.").string("host", "Target hostname or IP literal").number("port", "TCP port to connect to. Default: 80", {
|
|
96
|
+
default: 80,
|
|
97
|
+
minimum: 1,
|
|
98
|
+
maximum: 65535
|
|
99
|
+
}).string("requestText", "Raw HTTP request text to send as UTF-8 bytes").object("authorization", networkAuthorizationSchema, "Request-scoped authorization policy for private-network or insecure-HTTP targets. Use exact hosts/CIDRs instead of process-wide bypasses.").number("timeoutMs", "Socket timeout in milliseconds", {
|
|
100
|
+
default: 3e4,
|
|
101
|
+
minimum: 1e3,
|
|
102
|
+
maximum: 12e4
|
|
103
|
+
}).number("maxResponseBytes", "Maximum number of raw response bytes to capture before truncating the exchange", {
|
|
104
|
+
default: 512e3,
|
|
105
|
+
minimum: 1024,
|
|
106
|
+
maximum: 10485760
|
|
107
|
+
}).requiredOpenWorld("host", "requestText")),
|
|
108
|
+
tool("http2_probe", (t) => t.desc("Probe an HTTP/2 endpoint using Node http2 with deterministic DNS pinning and bounded response capture. Reports the negotiated protocol, ALPN result, response headers, status, and a response body snippet. Non-loopback plaintext h2c targets require explicit request-scoped authorization.").string("url", "Absolute http:// or https:// URL to probe").string("method", "HTTP method token to send. Default: GET").object("headers", { additionalProperties: { type: "string" } }, "Optional request headers to include. Header names are normalized to lowercase for HTTP/2.").string("body", "Optional UTF-8 request body to send with the probe").array("alpnProtocols", { type: "string" }, "Optional ALPN preference list for TLS probes. Default: [\"h2\", \"http/1.1\"].").object("authorization", networkAuthorizationSchema, "Request-scoped authorization policy for private-network or insecure-HTTP targets. Use exact hosts/CIDRs instead of process-wide bypasses.").number("timeoutMs", "Probe timeout in milliseconds", {
|
|
109
|
+
default: 3e4,
|
|
110
|
+
minimum: 1e3,
|
|
111
|
+
maximum: 12e4
|
|
112
|
+
}).number("maxBodyBytes", "Maximum number of response body bytes to capture for the snippet before truncating", {
|
|
113
|
+
default: 32768,
|
|
114
|
+
minimum: 1024,
|
|
115
|
+
maximum: 1048576
|
|
116
|
+
}).requiredOpenWorld("url")),
|
|
117
|
+
tool("http2_frame_build", (t) => t.desc("Build a raw HTTP/2 binary frame of any supported type (DATA, SETTINGS, PING, WINDOW_UPDATE, RST_STREAM, GOAWAY, or RAW). Returns the 9-byte frame header and full frame as hex strings, ready to send over a tcp_write or tls_write channel for protocol-level fuzzing and injection.").string("frameType", "HTTP/2 frame type: DATA, SETTINGS, PING, WINDOW_UPDATE, RST_STREAM, GOAWAY, or RAW").number("streamId", "Stream identifier (0 for connection-level frames). Default: 0", {
|
|
118
|
+
default: 0,
|
|
119
|
+
minimum: 0,
|
|
120
|
+
maximum: 2147483647
|
|
121
|
+
}).number("flags", "Raw flags byte (0-255). Overrides type-specific defaults when set.", {
|
|
122
|
+
minimum: 0,
|
|
123
|
+
maximum: 255
|
|
124
|
+
}).number("frameTypeCode", "Explicit frame type code for RAW frames (0-255). Required when frameType is RAW.", {
|
|
125
|
+
minimum: 0,
|
|
126
|
+
maximum: 255
|
|
127
|
+
}).string("payloadHex", "Frame payload as a hex string. Mutually exclusive with payloadText.").string("payloadText", "Frame payload as a text string. Mutually exclusive with payloadHex.").string("payloadEncoding", "Encoding for payloadText: utf8 or ascii. Default: utf8").array("settings", {
|
|
128
|
+
type: "object",
|
|
129
|
+
properties: {
|
|
130
|
+
id: { type: "number" },
|
|
131
|
+
value: { type: "number" }
|
|
132
|
+
},
|
|
133
|
+
required: ["id", "value"]
|
|
134
|
+
}, "Array of {id, value} entries for SETTINGS frames").boolean("ack", "Set the ACK flag on SETTINGS or PING frames").string("pingOpaqueDataHex", "Exactly 8 bytes of opaque data for PING frames (hex string)").number("windowSizeIncrement", "Window size increment for WINDOW_UPDATE frames (1 to 2^31-1)").number("errorCode", "Error code for RST_STREAM or GOAWAY frames (0 to 2^32-1)").number("lastStreamId", "Last stream ID for GOAWAY frames (0 to 2^31-1)").string("debugDataText", "Optional debug data for GOAWAY frames").string("debugDataEncoding", "Encoding for debugDataText: utf8 or ascii. Default: utf8").requiredOpenWorld("frameType")),
|
|
135
|
+
tool("network_rtt_measure", (t) => t.desc("Measure round-trip time (RTT) to a target URL using TCP, TLS, or HTTP probes. Returns per-sample latencies and aggregate statistics (min/max/mean/median/p95).").string("url", "Target URL to measure RTT to").string("probeType", "Probe type: tcp, tls, or http. Default: tcp", { default: "tcp" }).number("iterations", "Number of probe iterations (1-50). Default: 5", {
|
|
136
|
+
default: 5,
|
|
137
|
+
minimum: 1,
|
|
138
|
+
maximum: 50
|
|
139
|
+
}).number("timeoutMs", "Per-probe timeout in milliseconds (100-30000). Default: 5000", {
|
|
140
|
+
default: 5e3,
|
|
141
|
+
minimum: 100,
|
|
142
|
+
maximum: 3e4
|
|
143
|
+
}).object("authorization", { additionalProperties: { type: "string" } }, "Authorization policy for network access").requiredOpenWorld("url")),
|
|
144
|
+
tool("network_extract_auth", (t) => t.desc("Scan all captured network requests and extract authentication credentials (tokens, cookies, API keys, signatures).\n\nReturns masked values (first 6 + last 4 chars) sorted by confidence.\nSources scanned: request headers, cookies, URL query params, JSON request body.\n\nUSE THIS after capturing traffic to automatically identify:\n- Bearer tokens / JWT tokens\n- Session cookies\n- Custom auth headers (X-Token, X-Signature, X-Api-Key)\n- Signing parameters in request body or query string").number("minConfidence", "Minimum confidence threshold 0-1", {
|
|
145
|
+
default: .4,
|
|
146
|
+
minimum: 0,
|
|
147
|
+
maximum: 1
|
|
148
|
+
})),
|
|
149
|
+
tool("network_export_har", (t) => t.desc("Export all captured network traffic as a standard HAR 1.2 file.\n\nHAR (HTTP Archive) files can be opened in:\n- Chrome DevTools (Network tab → Import)\n- Fiddler, Charles Proxy, Wireshark\n- Online HAR viewers\n\nUSE THIS to:\n- Save a complete traffic snapshot for offline analysis\n- Share captured API calls with other tools\n- Reproduce a full session outside the browser").string("outputPath", "File path to write the HAR file. If omitted, returns HAR as JSON.").boolean("includeBodies", "Include response bodies in the HAR (may be slow for large captures). Default: false", { default: false }).openWorld()),
|
|
150
|
+
tool("network_replay_request", (t) => t.desc("Replay a previously captured network request with optional modifications.\n\nUSE THIS to:\n- Re-send an API call with modified headers (e.g., different auth token)\n- Test how a server responds to altered request bodies\n- Verify that a captured signature is still valid\n- Reproduce a specific API call without navigating again\n\nSecurity: dryRun=true (default) previews what will be sent without actually sending.\nSet dryRun=false to execute the actual request.").string("requestId", "Request ID from network_get_requests to replay").object("headerPatch", { additionalProperties: { type: "string" } }, "Headers to add or override (key-value pairs)").string("bodyPatch", "Replace the entire request body with this string").string("methodOverride", "Override the HTTP method (e.g., change POST to GET)").string("urlOverride", "Override the request URL").object("authorization", networkAuthorizationSchema, "Request-scoped authorization policy for private-network or insecure-HTTP replay. Use exact hosts/CIDRs instead of process-wide bypasses.").string("authorizationCapability", "Base64url-encoded JSON capability for request-scoped authorization. Payload fields mirror authorization and must include requestId.").number("timeoutMs", "Request timeout in milliseconds", {
|
|
151
|
+
default: 3e4,
|
|
152
|
+
minimum: 1e3,
|
|
153
|
+
maximum: 12e4
|
|
154
|
+
}).boolean("dryRun", "If true (default), only preview the request without sending. Set false to execute.", { default: true }).requiredOpenWorld("requestId")),
|
|
155
|
+
tool("network_traceroute", (t) => t.desc("ICMP traceroute with per-hop RTT and error classification. Windows: no admin required. Linux/macOS: requires root or CAP_NET_RAW.").string("target", "Target IP address to trace route to").number("maxHops", "Maximum number of hops (1-64). Default: 30", {
|
|
156
|
+
default: 30,
|
|
157
|
+
minimum: 1,
|
|
158
|
+
maximum: 64
|
|
159
|
+
}).number("timeout", "Per-hop timeout in milliseconds (100-30000). Default: 5000", {
|
|
160
|
+
default: 5e3,
|
|
161
|
+
minimum: 100,
|
|
162
|
+
maximum: 3e4
|
|
163
|
+
}).number("packetSize", "ICMP echo request payload size in bytes (8-65500). Default: 32", {
|
|
164
|
+
default: 32,
|
|
165
|
+
minimum: 8,
|
|
166
|
+
maximum: 65500
|
|
167
|
+
}).required("target").query()),
|
|
168
|
+
tool("network_icmp_probe", (t) => t.desc("ICMP echo probe with TTL control and error classification. Windows: no admin required. Linux/macOS: requires root or CAP_NET_RAW.").string("target", "Target IP address to probe").number("ttl", "Time-to-live value (1-255). Default: 128", {
|
|
169
|
+
default: 128,
|
|
170
|
+
minimum: 1,
|
|
171
|
+
maximum: 255
|
|
172
|
+
}).number("packetSize", "ICMP echo request payload size in bytes (8-65500). Default: 32", {
|
|
173
|
+
default: 32,
|
|
174
|
+
minimum: 8,
|
|
175
|
+
maximum: 65500
|
|
176
|
+
}).number("timeout", "Timeout in milliseconds (100-30000). Default: 5000", {
|
|
177
|
+
default: 5e3,
|
|
178
|
+
minimum: 100,
|
|
179
|
+
maximum: 3e4
|
|
180
|
+
}).required("target").query()),
|
|
181
|
+
tool("network_intercept", (t) => t.desc(`Manage response interception rules using CDP Fetch domain. Actions: add (create rule), list (show active rules), disable (remove rules).
|
|
182
|
+
|
|
183
|
+
When adding rules, matched requests receive a custom response instead of the real server response.
|
|
184
|
+
URL patterns support glob (* for segment, ** for any) and regex.
|
|
185
|
+
When all rules are removed, the CDP Fetch domain is automatically disabled.`).enum("action", [
|
|
186
|
+
"add",
|
|
187
|
+
"list",
|
|
188
|
+
"disable"
|
|
189
|
+
], "Intercept operation").string("urlPattern", "URL pattern to match (action=add). Supports glob (* = segment, ** = any) or regex.").enum("urlPatternType", ["glob", "regex"], "How to interpret urlPattern", { default: "glob" }).enum("stage", ["Request", "Response"], "Intercept stage. Response (default) intercepts after server responds.", { default: "Response" }).number("responseCode", "HTTP status code to return", {
|
|
190
|
+
default: 200,
|
|
191
|
+
minimum: 100,
|
|
192
|
+
maximum: 599
|
|
193
|
+
}).object("responseHeaders", { additionalProperties: { type: "string" } }, "Custom response headers as key-value pairs.").string("responseBody", "Custom response body string.").array("rules", {
|
|
194
|
+
type: "object",
|
|
195
|
+
properties: {
|
|
196
|
+
urlPattern: { type: "string" },
|
|
197
|
+
urlPatternType: {
|
|
198
|
+
type: "string",
|
|
199
|
+
enum: ["glob", "regex"]
|
|
200
|
+
},
|
|
201
|
+
stage: {
|
|
202
|
+
type: "string",
|
|
203
|
+
enum: ["Request", "Response"]
|
|
204
|
+
},
|
|
205
|
+
responseCode: { type: "number" },
|
|
206
|
+
responseHeaders: {
|
|
207
|
+
type: "object",
|
|
208
|
+
additionalProperties: { type: "string" }
|
|
209
|
+
},
|
|
210
|
+
responseBody: { type: "string" }
|
|
211
|
+
},
|
|
212
|
+
required: ["urlPattern"]
|
|
213
|
+
}, "Batch mode: array of rule objects (action=add)").string("ruleId", "ID of the rule to remove (action=disable)").boolean("all", "Set to true to remove all rules and disable interception (action=disable)", { default: false }).required("action"))
|
|
214
|
+
];
|
|
215
|
+
//#endregion
|
|
216
|
+
export { advancedTools as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/proxy/definitions.ts
|
|
3
|
+
const PROXY_TOOLS = [
|
|
4
|
+
tool("proxy_start", (t) => t.desc("Start the Mockttp local HTTP/HTTPS proxy server. Generates a local CA if one does not exist for TLS interception.").number("port", "Port to listen on. Defaults to 8080.", { default: 8080 }).boolean("useHttps", "Whether to enable full HTTPS decryption. Defaults to true.", { default: true })),
|
|
5
|
+
tool("proxy_stop", (t) => t.desc("Stop the running Mockttp proxy server.").destructive()),
|
|
6
|
+
tool("proxy_status", (t) => t.desc("Get the current status of the proxy server and the generated CA path.").query()),
|
|
7
|
+
tool("proxy_export_ca", (t) => t.desc("Export the path or raw string of the local CA root certificate so the user can install and trust it on their target test devices.").query()),
|
|
8
|
+
tool("proxy_add_rule", (t) => t.desc("Add a new interception, forwarding, or mocking rule to the proxy.").string("action", "Action to perform when matched (forward, mock_response, block)").string("method", "HTTP method to match (e.g. GET, POST)", { default: "GET" }).string("urlPattern", "URL pattern to match (can be string or regex format like /api/.*)").number("mockStatus", "Status code to return if action is mock_response", { default: 200 }).string("mockBody", "Body to return if action is mock_response").required("action")),
|
|
9
|
+
tool("proxy_get_requests", (t) => t.desc("Retrieve the captured HTTP/HTTPS requests from the proxy buffer. You can filter by URL.").string("urlFilter", "Optional partial URL match filter.").query()),
|
|
10
|
+
tool("proxy_clear_logs", (t) => t.desc("Clear the captured HTTP/HTTPS requests buffer.").resettable()),
|
|
11
|
+
tool("proxy_setup_adb_device", (t) => t.desc("Configure an Android device via ADB to route traffic through this proxy and inject the CA certificate.").string("deviceSerial", "ADB device serial (optional if only one device is connected)."))
|
|
12
|
+
];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { PROXY_TOOLS as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/coordination/definitions.ts
|
|
3
|
+
const coordinationTools = [
|
|
4
|
+
tool("create_task_handoff", (t) => t.desc("Create a sub-task handoff for specialist agent delegation.").array("constraints", { type: "string" }, "Constraints for the specialist").string("targetDomain", "Suggested domain for the specialist").required("description")),
|
|
5
|
+
tool("complete_task_handoff", (t) => t.desc("Complete a task handoff with results. Transitions status to completed.").string("taskId", "Task ID from create_task_handoff").string("summary", "Concise summary of what was accomplished").array("keyFindings", { type: "string" }, "Key discoveries or results").array("artifacts", { type: "string" }, "Paths to generated artifact files").required("taskId", "summary")),
|
|
6
|
+
tool("get_task_context", (t) => t.desc("Read task handoff context.").query()),
|
|
7
|
+
tool("append_session_insight", (t) => t.desc("Append a discovery to the session-level knowledge accumulator shared across handoffs").enum("category", [
|
|
8
|
+
"auth",
|
|
9
|
+
"crypto",
|
|
10
|
+
"api",
|
|
11
|
+
"anti_debug",
|
|
12
|
+
"architecture",
|
|
13
|
+
"vulnerability",
|
|
14
|
+
"other"
|
|
15
|
+
], "Insight category").string("content", "The insight content").prop("confidence", {
|
|
16
|
+
type: "number",
|
|
17
|
+
description: "Confidence level 0.0-1.0",
|
|
18
|
+
minimum: 0,
|
|
19
|
+
maximum: 1
|
|
20
|
+
}).required("category", "content")),
|
|
21
|
+
tool("save_page_snapshot", (t) => t.desc("Save current page state (URL, cookies, storage) for checkpoint/restore workflows").string("label", "Human-readable label for this snapshot").readOnly()),
|
|
22
|
+
tool("restore_page_snapshot", (t) => t.desc("Restore a saved page snapshot — navigates to URL and reinjects cookies and storage").string("snapshotId", "Snapshot ID from save_page_snapshot").required("snapshotId").idempotent()),
|
|
23
|
+
tool("list_page_snapshots", (t) => t.desc("List all saved page snapshots in the current session").query())
|
|
24
|
+
];
|
|
25
|
+
//#endregion
|
|
26
|
+
export { coordinationTools as t };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/workflow/definitions.ts
|
|
3
|
+
const workflowNetworkPolicySchema = {
|
|
4
|
+
type: "object",
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
properties: {
|
|
7
|
+
allowPrivateNetwork: {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
description: "Allow access to private/reserved targets only when the request also matches allowedHosts or allowedCidrs."
|
|
10
|
+
},
|
|
11
|
+
allowInsecureHttp: {
|
|
12
|
+
type: "boolean",
|
|
13
|
+
description: "Allow non-loopback HTTP targets only when the request also matches allowedHosts or allowedCidrs."
|
|
14
|
+
},
|
|
15
|
+
allowedHosts: {
|
|
16
|
+
type: "array",
|
|
17
|
+
items: { type: "string" },
|
|
18
|
+
description: "Exact hostname or host:port allowlist for the primary target (for example [\"labs.example.com\", \"localhost:8080\"])."
|
|
19
|
+
},
|
|
20
|
+
allowedCidrs: {
|
|
21
|
+
type: "array",
|
|
22
|
+
items: { type: "string" },
|
|
23
|
+
description: "CIDR allowlist applied after DNS resolution (for example [\"10.10.0.0/16\", \"192.168.1.10/32\"])."
|
|
24
|
+
},
|
|
25
|
+
allowedRedirectHosts: {
|
|
26
|
+
type: "array",
|
|
27
|
+
items: { type: "string" },
|
|
28
|
+
description: "Optional hostname or host:port allowlist for redirect hops. When omitted, redirects inherit allowedHosts/allowedCidrs."
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
description: "Request-level network authorization policy. Use this instead of process-wide bypasses when you need to reach a real lab target, private address, or plain HTTP service."
|
|
32
|
+
};
|
|
33
|
+
const workflowToolDefinitions = [
|
|
34
|
+
tool("js_bundle_search", (t) => t.desc("Fetch a remote JavaScript bundle and search it with multiple named regex patterns in a single call.\n\nFeatures over bundle_search script:\n- Server-side fetch (no browser CORS constraints)\n- Bundle caching (5-min TTL, keyed by URL) — avoids re-downloading 1MB+ files\n- SVG/base64 false-positive filtering (`stripNoise: true` by default)\n- Per-pattern independent context window (`contextBefore`/`contextAfter`)\n- Up to `maxMatches` hits per pattern\n\nExample:\n js_bundle_search({\n url: \"https://assets.example.com/main.js\",\n patterns: [\n { name: \"tier_values\", regex: \"subscription.plus|user_tier\" },\n { name: \"payment_apis\", regex: \"/api/v1/payment/[a-z_]+\" },\n { name: \"setSubscription\", regex: \"setSubscriptionPlus\\\\([^)]{0,80}\\\\)\" }\n ]\n })").string("url", "Remote URL of the JavaScript bundle to analyze").array("patterns", {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
name: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Human-readable label for this pattern"
|
|
40
|
+
},
|
|
41
|
+
regex: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "JavaScript regex string"
|
|
44
|
+
},
|
|
45
|
+
contextBefore: {
|
|
46
|
+
type: "number",
|
|
47
|
+
description: "Characters of context before match (default: 80)"
|
|
48
|
+
},
|
|
49
|
+
contextAfter: {
|
|
50
|
+
type: "number",
|
|
51
|
+
description: "Characters of context after match (default: 80)"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
required: ["name", "regex"]
|
|
55
|
+
}, "Named regex patterns to search for").boolean("cacheBundle", "Cache the bundle for 5 minutes to avoid re-downloads", { default: true }).boolean("stripNoise", "Skip matches inside SVG path data or base64 blobs", { default: true }).number("maxMatches", "Maximum matches to return per pattern", {
|
|
56
|
+
default: 10,
|
|
57
|
+
minimum: 1,
|
|
58
|
+
maximum: 1e3
|
|
59
|
+
}).prop("networkPolicy", workflowNetworkPolicySchema).requiredOpenWorld("url", "patterns")),
|
|
60
|
+
tool("page_script_register", (t) => t.desc("Register a named reusable JavaScript snippet in the Script Library.\n\nCore ships built-in snippets such as `auth_extract`, `bundle_search`, `react_fill_form`, and `dom_find_upgrade_buttons`.\n\nRegistered scripts are executed with `page_script_run`. Scripts may reference `__params__` (set at call time via page_script_run params).").string("name", "Unique script name (e.g. \"my_extractor\")").string("code", "JavaScript expression/IIFE to register. Use `typeof __params__ !== \"undefined\" ? __params__ : {}` to safely access runtime parameters.").string("description", "Optional human-readable description of the script").required("name", "code")),
|
|
61
|
+
tool("page_script_run", (t) => t.desc("Execute a named script from the Script Library in the current page context.\n\nOptionally inject runtime parameters accessible as `__params__` inside the script.\n\nExample:\n page_script_run({ name: \"bundle_search\", params: { url: \"https://cdn.main.js\", patterns: [\"tier\", \"subscription\"] } })\n page_script_run({ name: \"auth_extract\" })").string("name", "Script name to run (built-in or registered)").prop("params", {
|
|
62
|
+
type: "object",
|
|
63
|
+
additionalProperties: true,
|
|
64
|
+
description: "Optional parameters injected as __params__ (must be JSON-serializable)"
|
|
65
|
+
}).requiredOpenWorld("name")),
|
|
66
|
+
tool("api_probe_batch", (t) => t.desc("Probe multiple API endpoints in a single browser-context fetch burst.\n\nAuto-injects Bearer token from localStorage[token] / localStorage[active_token]. Returns status codes, content types, and response snippets for matching statuses. Skips HTML responses (login-redirect false-positives).\n\nReplaces 5–30 individual page_evaluate fetch calls with one tool call.\n\n**ALWAYS start with OpenAPI/Swagger discovery paths first** — a single 200 response gives you the full API schema:\n \"/docs\", \"/openapi.json\", \"/api/docs\", \"/swagger.json\", \"/api/v1/openapi.json\", \"/api/openapi.json\"\n\nExample:\n api_probe_batch({ baseUrl: \"https://chat.qwen.ai\", paths: [\"/docs\", \"/openapi.json\", \"/api/v1/users/me\", \"/api/v1/chats/\", \"/api/admin/users\"] })").string("baseUrl", "Base URL prefix (e.g. \"https://chat.qwen.ai\") — trailing slash will be stripped").array("paths", { type: "string" }, "Paths to probe (e.g. [\"/api/v1/users\", \"/api/v1/chats\"])").enum("method", [
|
|
67
|
+
"GET",
|
|
68
|
+
"POST",
|
|
69
|
+
"PUT",
|
|
70
|
+
"DELETE",
|
|
71
|
+
"PATCH",
|
|
72
|
+
"HEAD",
|
|
73
|
+
"OPTIONS"
|
|
74
|
+
], "HTTP method for all probes", { default: "GET" }).object("headers", { additionalProperties: { type: "string" } }, "Additional HTTP headers to include in all requests").string("bodyTemplate", "JSON body string to send for POST/PUT/PATCH requests (optional)").array("includeBodyStatuses", { type: "number" }, "Status codes for which to include response body snippet (default: [200, 201, 204])").number("maxBodySnippetLength", "Max characters per response body snippet", {
|
|
75
|
+
default: 500,
|
|
76
|
+
minimum: 0,
|
|
77
|
+
maximum: 1e4
|
|
78
|
+
}).boolean("autoInjectAuth", "Auto-inject Bearer token from localStorage (token / active_token / access_token).", { default: true }).prop("networkPolicy", workflowNetworkPolicySchema).requiredOpenWorld("baseUrl", "paths")),
|
|
79
|
+
tool("list_extension_workflows", (t) => t.desc("List runtime-loaded extension workflows discovered from plugins/ or workflows/ directories, including metadata needed before execution.").query()),
|
|
80
|
+
tool("run_extension_workflow", (t) => t.desc("Execute a runtime-loaded extension workflow contract by workflowId. Supports config overrides, per-node input overrides, and an optional timeout override.").string("workflowId", "Registered extension workflow id to execute").string("profile", "Optional profile label exposed to the workflow execution context").prop("config", {
|
|
81
|
+
type: "object",
|
|
82
|
+
additionalProperties: true,
|
|
83
|
+
description: "Optional config overrides read through ctx.getConfig(path, fallback)"
|
|
84
|
+
}).prop("nodeInputOverrides", {
|
|
85
|
+
type: "object",
|
|
86
|
+
additionalProperties: {
|
|
87
|
+
type: "object",
|
|
88
|
+
additionalProperties: true
|
|
89
|
+
},
|
|
90
|
+
description: "Optional shallow input overrides keyed by workflow node id"
|
|
91
|
+
}).number("timeoutMs", "Optional override for total workflow timeout in milliseconds").requiredOpenWorld("workflowId"))
|
|
92
|
+
];
|
|
93
|
+
//#endregion
|
|
94
|
+
export { workflowToolDefinitions as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/maintenance/definitions.ts
|
|
3
|
+
const tokenBudgetTools = [
|
|
4
|
+
tool("get_token_budget_stats", (t) => t.desc("Get token budget usage stats, warnings, and optimization suggestions").query()),
|
|
5
|
+
tool("manual_token_cleanup", (t) => t.desc("Clear stale entries and reset counters to free 10-30% of token budget")),
|
|
6
|
+
tool("reset_token_budget", (t) => t.desc("Hard-reset all token budget counters. Destructive — prefer manual_token_cleanup").destructive())
|
|
7
|
+
];
|
|
8
|
+
const extensionTools = [
|
|
9
|
+
tool("list_extensions", (t) => t.desc("List all loaded plugins, workflows, and extension tools").query()),
|
|
10
|
+
tool("reload_extensions", (t) => t.desc("Reload plugins and workflows from configured directories").openWorld()),
|
|
11
|
+
tool("browse_extension_registry", (t) => t.desc("Browse the remote jshookmcp extension registry").enum("kind", [
|
|
12
|
+
"plugin",
|
|
13
|
+
"workflow",
|
|
14
|
+
"all"
|
|
15
|
+
], "Filter by extension kind", { default: "all" }).query()),
|
|
16
|
+
tool("install_extension", (t) => t.desc("Install an extension from the remote registry via git").string("slug", "Extension slug from the registry").string("targetDir", "Target directory override").requiredOpenWorld("slug"))
|
|
17
|
+
];
|
|
18
|
+
const cacheTools = [
|
|
19
|
+
tool("get_cache_stats", (t) => t.desc("Get cache statistics: entries, sizes, hit rates, and cleanup recommendations").query()),
|
|
20
|
+
tool("smart_cache_cleanup", (t) => t.desc("Evict LRU and stale entries while preserving hot data").number("targetSize", "Target size in bytes")),
|
|
21
|
+
tool("clear_all_caches", (t) => t.desc("Clear all internal caches. Destructive — prefer smart_cache_cleanup").destructive())
|
|
22
|
+
];
|
|
23
|
+
const artifactTools = [tool("cleanup_artifacts", (t) => t.desc("Clean generated artifacts using age and size retention rules").number("retentionDays", "Override retention window in days").number("maxTotalBytes", "Override maximum retained bytes").boolean("dryRun", "Preview removals without deleting").destructive()), tool("doctor_environment", (t) => t.desc("Run environment doctor for dependencies, bridge endpoints, and platform limitations").boolean("includeBridgeHealth", "Probe native-bridge / Burp endpoints").readOnly())];
|
|
24
|
+
//#endregion
|
|
25
|
+
export { tokenBudgetTools as i, cacheTools as n, extensionTools as r, artifactTools as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/transform/definitions.ts
|
|
3
|
+
const transformsEnum = [
|
|
4
|
+
"constant_fold",
|
|
5
|
+
"string_decrypt",
|
|
6
|
+
"dead_code_remove",
|
|
7
|
+
"control_flow_flatten",
|
|
8
|
+
"rename_vars"
|
|
9
|
+
];
|
|
10
|
+
const transformTools = [
|
|
11
|
+
tool("ast_transform_preview", (t) => t.desc("Preview lightweight AST-like transforms (string/regex based) and return before/after diff.").string("code", "Source code to transform.").array("transforms", {
|
|
12
|
+
type: "string",
|
|
13
|
+
enum: transformsEnum
|
|
14
|
+
}, "Ordered transform list.").boolean("preview", "Whether to generate line diff output.", { default: true }).required("code", "transforms")),
|
|
15
|
+
tool("ast_transform_chain", (t) => t.desc("Create and store an in-memory transform chain.").string("name", "Chain name.").array("transforms", {
|
|
16
|
+
type: "string",
|
|
17
|
+
enum: transformsEnum
|
|
18
|
+
}, "Ordered transform list.").string("description", "Optional chain description.").required("name", "transforms")),
|
|
19
|
+
tool("ast_transform_apply", (t) => t.desc("Apply transforms to input code or a live page scriptId.").string("scriptId", "Target script ID from page debugger context.").string("code", "Direct source code input.").string("chainName", "Use a saved transform chain by name.").array("transforms", {
|
|
20
|
+
type: "string",
|
|
21
|
+
enum: transformsEnum
|
|
22
|
+
}, "Direct transform list (used when chainName is not provided).")),
|
|
23
|
+
tool("crypto_extract_standalone", (t) => t.desc("Extract crypto/sign/encrypt function from current page and generate standalone runnable code.").string("targetFunction", "Target function name/path, e.g. \"window.sign\".").boolean("includePolyfills", "Include minimal runtime polyfills.", { default: true }).required("targetFunction")),
|
|
24
|
+
tool("crypto_test_harness", (t) => t.desc("Run extracted crypto code in worker_threads + vm sandbox and return deterministic test results.").string("code", "Standalone function code.").string("functionName", "Exported function name to execute.").array("testInputs", { type: "string" }, "Input list for test execution.").required("code", "functionName", "testInputs")),
|
|
25
|
+
tool("crypto_compare", (t) => t.desc("Compare two crypto implementations against identical test vectors.").string("code1", "Implementation A code.").string("code2", "Implementation B code.").string("functionName", "Function name shared by both implementations.").array("testInputs", { type: "string" }, "Input list for comparison.").required("code1", "code2", "functionName", "testInputs"))
|
|
26
|
+
];
|
|
27
|
+
//#endregion
|
|
28
|
+
export { transformTools as t };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/wasm/definitions.ts
|
|
3
|
+
const wasmTools = [
|
|
4
|
+
tool("wasm_dump", (t) => t.desc("Dump a WebAssembly module from the current browser page.\n\nExtracts the WASM binary via the webassembly-full hook preset, saves it to disk, and returns module metadata (hash, size, imports, exports).\n\nPrerequisites: A page with WASM must be loaded. The webassembly-full hook preset will be auto-injected if not already active.").number("moduleIndex", "Index of the WASM module to dump if multiple were loaded", { default: 0 }).string("outputPath", "Custom output file path. If omitted, auto-generates in artifacts/wasm/")),
|
|
5
|
+
tool("wasm_disassemble", (t) => t.desc("Disassemble a .wasm file to WebAssembly Text Format (WAT) using wasm2wat.\n\nRequires: wabt toolchain installed (wasm2wat in PATH).\n\nUSE THIS to read WASM bytecode as human-readable text. The output shows all functions, imports, exports, and instructions.").string("inputPath", "Path to the .wasm file to disassemble").string("outputPath", "Output .wat file path. If omitted, auto-generates in artifacts/wasm/").boolean("foldExprs", "Fold expressions for more compact output", { default: true }).required("inputPath")),
|
|
6
|
+
tool("wasm_decompile", (t) => t.desc("Decompile a .wasm file to C-like pseudo-code using wasm-decompile.\n\nRequires: wabt toolchain installed (wasm-decompile in PATH).\n\nProduces more readable output than WAT, resembling C/JavaScript syntax. Useful for understanding VMP handler logic.").string("inputPath", "Path to the .wasm file to decompile").string("outputPath", "Output file path. If omitted, auto-generates in artifacts/wasm/").required("inputPath")),
|
|
7
|
+
tool("wasm_inspect_sections", (t) => t.desc("Inspect sections and metadata of a .wasm file using wasm-objdump.\n\nRequires: wabt toolchain installed (wasm-objdump in PATH).\n\nReturns section headers, import/export tables, function signatures, and memory layout.").string("inputPath", "Path to the .wasm file to inspect").enum("sections", [
|
|
8
|
+
"headers",
|
|
9
|
+
"details",
|
|
10
|
+
"disassemble",
|
|
11
|
+
"all"
|
|
12
|
+
], "What to dump: headers (section overview), details (full metadata), disassemble (bytecode), all", { default: "details" }).required("inputPath")),
|
|
13
|
+
tool("wasm_offline_run", (t) => t.desc("Execute a specific exported function from a .wasm file offline using wasmtime or wasmer.\n\nRequires: wasmtime or wasmer installed in PATH.\n\nUSE THIS to run sign/encrypt functions extracted from WASM VMP without a browser. Provide the function name and arguments.\n\nSecurity: Runs in a sandboxed WASM runtime with no filesystem or network access.").string("inputPath", "Path to the .wasm file").string("functionName", "Name of the exported function to invoke (e.g., \"_sign\", \"encrypt\")").array("args", { type: "string" }, "Arguments to pass to the function (will be parsed as integers/floats)").enum("runtime", [
|
|
14
|
+
"wasmtime",
|
|
15
|
+
"wasmer",
|
|
16
|
+
"auto"
|
|
17
|
+
], "WASM runtime to use. \"auto\" tries wasmtime first, then wasmer", { default: "auto" }).number("timeoutMs", "Execution timeout in ms", { default: 1e4 }).required("inputPath", "functionName")),
|
|
18
|
+
tool("wasm_optimize", (t) => t.desc("Optimize a .wasm file using binaryen wasm-opt.\n\nRequires: binaryen toolchain installed (wasm-opt in PATH).\n\nApplies optimization passes (dead code elimination, constant folding, etc.) to reduce size and improve performance. Optimized output can be re-injected into the browser.").string("inputPath", "Path to the .wasm file to optimize").string("outputPath", "Output optimized .wasm file path. If omitted, auto-generates in artifacts/wasm/").enum("level", [
|
|
19
|
+
"O1",
|
|
20
|
+
"O2",
|
|
21
|
+
"O3",
|
|
22
|
+
"O4",
|
|
23
|
+
"Os",
|
|
24
|
+
"Oz"
|
|
25
|
+
], "Optimization level", { default: "O2" }).required("inputPath")),
|
|
26
|
+
tool("wasm_vmp_trace", (t) => t.desc("Trace WASM VMP (Virtual Machine Protection) opcode execution.\n\nCombines the webassembly-full hook preset with enhanced import call tracing to reconstruct VMP handler tables and execution flows.\n\nUSE THIS when a page uses WASM-based VMP to protect sign/encrypt functions. Returns:\n- Import call sequence (opcode trace)\n- Identified handler patterns\n- Input→output data flow").number("maxEvents", "Maximum import call events to capture", { default: 5e3 }).string("filterModule", "Only trace calls to this import module name (e.g., \"env\", \"wasi_snapshot_preview1\")")),
|
|
27
|
+
tool("wasm_memory_inspect", (t) => t.desc("Inspect WebAssembly.Memory contents from the browser.\n\nReads the linear memory buffer of the active WASM module, displaying it as hex dump, ASCII, or searching for patterns.\n\nUSE THIS to:\n- Examine WASM memory layout (stack, heap, data segments)\n- Find strings, keys, or encoded data in WASM memory\n- Track how input data is transformed through WASM functions").number("offset", "Starting byte offset to read from", { default: 0 }).number("length", "Number of bytes to read", { default: 256 }).enum("format", [
|
|
28
|
+
"hex",
|
|
29
|
+
"ascii",
|
|
30
|
+
"both"
|
|
31
|
+
], "Output format", { default: "both" }).string("searchPattern", "Search for this hex pattern or ASCII string in the memory range"))
|
|
32
|
+
];
|
|
33
|
+
//#endregion
|
|
34
|
+
export { wasmTools as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/encoding/definitions.ts
|
|
3
|
+
const encodingTools = [
|
|
4
|
+
tool("binary_detect_format", (t) => t.desc("Detect binary payload format/encoding via magic bytes, encoding heuristics, a...").enum("source", [
|
|
5
|
+
"base64",
|
|
6
|
+
"hex",
|
|
7
|
+
"file",
|
|
8
|
+
"raw"
|
|
9
|
+
], "How to interpret input payload").string("filePath", "File path when source=file").string("requestId", "Captured network requestId to resolve response body").required("source").query()),
|
|
10
|
+
tool("binary_decode", (t) => t.desc("Decode binary payloads into hex, utf8, or json output").string("data", "Input encoded payload").enum("encoding", [
|
|
11
|
+
"base64",
|
|
12
|
+
"hex",
|
|
13
|
+
"url",
|
|
14
|
+
"protobuf",
|
|
15
|
+
"msgpack"
|
|
16
|
+
], "Declared input encoding").enum("outputFormat", [
|
|
17
|
+
"hex",
|
|
18
|
+
"utf8",
|
|
19
|
+
"json"
|
|
20
|
+
], "Target output format", { default: "hex" }).required("data", "encoding")),
|
|
21
|
+
tool("binary_encode", (t) => t.desc("Encode utf8/hex/json input into base64/hex/url output").string("data", "Input payload").enum("inputFormat", [
|
|
22
|
+
"utf8",
|
|
23
|
+
"hex",
|
|
24
|
+
"json"
|
|
25
|
+
], "How to parse input").enum("outputEncoding", [
|
|
26
|
+
"base64",
|
|
27
|
+
"hex",
|
|
28
|
+
"url"
|
|
29
|
+
], "Desired output encoding").required("data", "inputFormat", "outputEncoding")),
|
|
30
|
+
tool("binary_entropy_analysis", (t) => t.desc("Compute Shannon entropy + byte frequency to assess plaintext/encoded/compress...").enum("source", [
|
|
31
|
+
"base64",
|
|
32
|
+
"hex",
|
|
33
|
+
"raw",
|
|
34
|
+
"file"
|
|
35
|
+
], "How to interpret input payload").string("filePath", "File path when source=file").number("blockSize", "Block size for per-block entropy", {
|
|
36
|
+
default: 256,
|
|
37
|
+
minimum: 16,
|
|
38
|
+
maximum: 8192
|
|
39
|
+
}).required("source").query()),
|
|
40
|
+
tool("protobuf_decode_raw", (t) => t.desc("Decode base64 protobuf bytes without schema using wire-type aware recursive parser").string("data", "Base64-encoded protobuf payload").number("maxDepth", "Maximum recursive decode depth", {
|
|
41
|
+
default: 5,
|
|
42
|
+
minimum: 1,
|
|
43
|
+
maximum: 20
|
|
44
|
+
}).required("data").query())
|
|
45
|
+
];
|
|
46
|
+
//#endregion
|
|
47
|
+
export { encodingTools as t };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
+
//#region src/server/domains/debugger/definitions.tools.core.ts
|
|
3
|
+
const DEBUGGER_CORE_TOOLS = [
|
|
4
|
+
tool("debugger_lifecycle", (t) => t.desc("Manage the debugger lifecycle (enable or disable)").enum("action", ["enable", "disable"], "Action to perform").required("action").idempotent()),
|
|
5
|
+
tool("debugger_pause", (t) => t.desc("Pause execution at the next statement")),
|
|
6
|
+
tool("debugger_resume", (t) => t.desc("Resume execution (continue)")),
|
|
7
|
+
tool("debugger_step", (t) => t.desc("Step execution: into (enter next call), over (skip next call), out (exit current function).").enum("direction", [
|
|
8
|
+
"into",
|
|
9
|
+
"over",
|
|
10
|
+
"out"
|
|
11
|
+
], "Step direction").required("direction")),
|
|
12
|
+
tool("breakpoint", (t) => t.desc(`Manage breakpoints: code (line/script), XHR (URL pattern), event listener, event category, and exception breakpoints.
|
|
13
|
+
|
|
14
|
+
Actions:
|
|
15
|
+
- set: Create a breakpoint. Type determines required params.
|
|
16
|
+
- remove: Remove a breakpoint by ID.
|
|
17
|
+
- list: List active breakpoints of the given type.
|
|
18
|
+
|
|
19
|
+
Types & params:
|
|
20
|
+
- code: lineNumber (required), scriptId?, columnNumber?, condition?
|
|
21
|
+
- xhr: urlPattern (required for set)
|
|
22
|
+
- event: eventName (required for set), targetName?
|
|
23
|
+
- event_category: category (required for set)
|
|
24
|
+
- exception: state (required for set)`).enum("action", [
|
|
25
|
+
"set",
|
|
26
|
+
"remove",
|
|
27
|
+
"list"
|
|
28
|
+
], "Breakpoint operation").enum("type", [
|
|
29
|
+
"code",
|
|
30
|
+
"xhr",
|
|
31
|
+
"event",
|
|
32
|
+
"event_category",
|
|
33
|
+
"exception"
|
|
34
|
+
], "Breakpoint type (default: code)", { default: "code" }).string("scriptId", "Script ID (type=code)").number("lineNumber", "Line number 0-based (type=code, action=set)").number("columnNumber", "Column number 0-based (type=code)").string("condition", "Conditional expression (type=code)").string("urlPattern", "URL pattern with wildcards (type=xhr, action=set)").string("eventName", "Event name e.g. \"click\" (type=event, action=set)").string("targetName", "Target name e.g. \"WebSocket\" (type=event)").enum("category", [
|
|
35
|
+
"mouse",
|
|
36
|
+
"keyboard",
|
|
37
|
+
"timer",
|
|
38
|
+
"websocket"
|
|
39
|
+
], "Event category (type=event_category)").enum("state", [
|
|
40
|
+
"none",
|
|
41
|
+
"uncaught",
|
|
42
|
+
"all"
|
|
43
|
+
], "Exception pause state (type=exception)").string("breakpointId", "Breakpoint ID (action=remove)").required("action").idempotent()),
|
|
44
|
+
tool("get_call_stack", (t) => t.desc("Get the current call stack (only available when paused at a breakpoint)").query()),
|
|
45
|
+
tool("debugger_evaluate", (t) => t.desc("Evaluate a JavaScript expression. context=\"frame\" evaluates in the current call frame (requires paused state); context=\"global\" evaluates in the global context (no pause required).").enum("context", ["frame", "global"], "Evaluation context", { default: "frame" }).string("expression", "JavaScript expression to evaluate").string("callFrameId", "Call frame ID (for context=frame; from get_call_stack, defaults to current frame)").requiredOpenWorld("expression")),
|
|
46
|
+
tool("debugger_wait_for_paused", (t) => t.desc("Wait for the debugger to pause (useful after setting breakpoints and triggering code)").number("timeout", "Timeout in milliseconds (default: 30000)", {
|
|
47
|
+
default: 3e4,
|
|
48
|
+
minimum: 1e3,
|
|
49
|
+
maximum: 12e4
|
|
50
|
+
}).query()),
|
|
51
|
+
tool("debugger_get_paused_state", (t) => t.desc("Get the current paused state (check if debugger is paused and why)").query()),
|
|
52
|
+
tool("get_object_properties", (t) => t.desc("Get all properties of an object (when paused, use objectId from variables)").string("objectId", "Object ID (from get_scope_variables)").required("objectId").query()),
|
|
53
|
+
tool("get_scope_variables_enhanced", (t) => t.desc(`Enhanced scope variable inspection with deep object traversal.`).string("callFrameId", "Call frame ID (from get_call_stack, defaults to current frame)").boolean("includeObjectProperties", "Expand object properties recursively (default: false)", { default: false }).number("maxDepth", "Maximum traversal depth for nested objects (default: 1)", {
|
|
54
|
+
default: 1,
|
|
55
|
+
minimum: 1,
|
|
56
|
+
maximum: 10
|
|
57
|
+
}).boolean("skipErrors", "Skip properties that throw errors during access (default: true)", { default: true }).query()),
|
|
58
|
+
tool("debugger_session", (t) => t.desc("Manage debugger sessions. Actions: save (persist current session to file), load (restore session from file/JSON), export (export session as JSON string), list (list saved sessions in ./debugger-sessions/).").enum("action", [
|
|
59
|
+
"save",
|
|
60
|
+
"load",
|
|
61
|
+
"export",
|
|
62
|
+
"list"
|
|
63
|
+
], "Session operation").string("filePath", "File path for save/load actions").string("sessionData", "Session JSON string for load action (alternative to filePath)").object("metadata", {}, "Optional metadata for save/export actions").required("action"))
|
|
64
|
+
];
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/server/domains/debugger/definitions.tools.advanced.ts
|
|
67
|
+
const DEBUGGER_ADVANCED_TOOLS = [
|
|
68
|
+
tool("watch", (t) => t.desc(`Manage watch expressions for monitoring variable values during debugging.
|
|
69
|
+
|
|
70
|
+
Actions:
|
|
71
|
+
- add: Add a watch expression (requires expression)
|
|
72
|
+
- remove: Remove by watchId
|
|
73
|
+
- list: List all watches
|
|
74
|
+
- evaluate_all: Evaluate all enabled watches (optional callFrameId)
|
|
75
|
+
- clear_all: Clear all watches`).enum("action", [
|
|
76
|
+
"add",
|
|
77
|
+
"remove",
|
|
78
|
+
"list",
|
|
79
|
+
"evaluate_all",
|
|
80
|
+
"clear_all"
|
|
81
|
+
], "Watch operation").string("expression", "JavaScript expression to watch (action=add)").string("name", "Friendly name for the watch (action=add)").string("watchId", "Watch expression ID (action=remove)").string("callFrameId", "Call frame ID (action=evaluate_all)").required("action")),
|
|
82
|
+
tool("blackbox_add", (t) => t.desc(`Blackbox scripts (skip during debugging)
|
|
83
|
+
|
|
84
|
+
Usage:
|
|
85
|
+
- Skip third-party library c...`).string("urlPattern", "URL pattern to blackbox (supports wildcards *)").required("urlPattern").idempotent()),
|
|
86
|
+
tool("blackbox_add_common", (t) => t.desc(`Blackbox all common libraries (one-click)
|
|
87
|
+
|
|
88
|
+
Includes:
|
|
89
|
+
- jquery, react, vue, an...`).idempotent()),
|
|
90
|
+
tool("blackbox_list", (t) => t.desc("List all blackboxed patterns").query())
|
|
91
|
+
];
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/server/domains/debugger/definitions.tools.ts
|
|
94
|
+
const debuggerTools = [...DEBUGGER_CORE_TOOLS, ...DEBUGGER_ADVANCED_TOOLS];
|
|
95
|
+
//#endregion
|
|
96
|
+
export { debuggerTools as t };
|