@jshookmcp/jshook 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -5
- package/README.zh.md +36 -5
- package/dist/{AntiCheatDetector-S8VRj-dD.mjs → AntiCheatDetector-CqGDXmfc.mjs} +160 -54
- package/dist/{CodeInjector-4Z3ngPoX.mjs → CodeInjector-BdjRfNx7.mjs} +5 -5
- package/dist/ConsoleMonitor-DykL3IAw.mjs +2269 -0
- package/dist/{DarwinAPI-B8hg_yhz.mjs → DarwinAPI-ETyy0xyo.mjs} +1 -1
- package/dist/DetailedDataManager-HT49OrvF.mjs +217 -0
- package/dist/EventBus-DFKvADm3.mjs +141 -0
- package/dist/EvidenceGraphBridge-318Oi0Lf.mjs +153 -0
- package/dist/{ExtensionManager-D5-bO9D8.mjs → ExtensionManager-BDMsY2Dz.mjs} +27 -13
- package/dist/{FingerprintManager-BVxFJL2-.mjs → FingerprintManager-BN4UQWnX.mjs} +1 -1
- package/dist/{HardwareBreakpoint-DK1yjWkV.mjs → HardwareBreakpoint-Cc2AFq1Y.mjs} +3 -3
- package/dist/{HeapAnalyzer-CEbo10xU.mjs → HeapAnalyzer-DruMgsgj.mjs} +21 -21
- package/dist/HookGeneratorBuilders.core.generators.storage-CTbB4Lcx.mjs +566 -0
- package/dist/InstrumentationSession-DLH0vd-z.mjs +244 -0
- package/dist/{MemoryController-DdtnBdD4.mjs → MemoryController-CMtviNW_.mjs} +3 -3
- package/dist/{MemoryScanSession-RMixN3bX.mjs → MemoryScanSession-ITgb_NMi.mjs} +81 -78
- package/dist/{MemoryScanner-QjK4ld0B.mjs → MemoryScanner-CiL7Z3ey.mjs} +50 -21
- package/dist/{NativeMemoryManager.impl-CB6gJ0NM.mjs → NativeMemoryManager.impl-D9Lkovvn.mjs} +20 -56
- package/dist/{NativeMemoryManager.utils-BML4q1ry.mjs → NativeMemoryManager.utils-BBlAixF5.mjs} +1 -1
- package/dist/{PEAnalyzer-CK0xe0Fs.mjs → PEAnalyzer-DMQ44gen.mjs} +16 -16
- package/dist/PageController-BPJNqqBN.mjs +431 -0
- package/dist/{PointerChainEngine-Cd73qu5b.mjs → PointerChainEngine-K7wN8Z-w.mjs} +10 -7
- package/dist/PrerequisiteError-TuyZIs6n.mjs +20 -0
- package/dist/ProcessRegistry-zGg12QbE.mjs +74 -0
- package/dist/ResponseBuilder-CJXWmWNw.mjs +143 -0
- package/dist/ReverseEvidenceGraph-C02-gXOh.mjs +269 -0
- package/dist/ScriptManager-ZuWD-0Jg.mjs +3003 -0
- package/dist/{Speedhack-CeF0XmEz.mjs → Speedhack-D-z0umeT.mjs} +2 -2
- package/dist/{StructureAnalyzer-D4GkMduU.mjs → StructureAnalyzer-Cav5AVSL.mjs} +9 -6
- package/dist/ToolCatalog-5OJdMiF0.mjs +582 -0
- package/dist/ToolError-jh9whhMd.mjs +15 -0
- package/dist/ToolProbe-DbCFGyrg.mjs +45 -0
- package/dist/ToolRegistry-B9krbTtI.mjs +180 -0
- package/dist/ToolRouter.policy-BGDAGyeH.mjs +344 -0
- package/dist/TraceRecorder-B41Z5XBj.mjs +1286 -0
- package/dist/{Win32API-Bc0QnQsN.mjs → Win32API-C2kjj0ze.mjs} +19 -13
- package/dist/{Win32Debug-DUHt9XUn.mjs → Win32Debug-CKrGOTpo.mjs} +3 -3
- package/dist/WorkflowEngine-DJ6M4opp.mjs +569 -0
- package/dist/analysis-BHeJW2Nb.mjs +1234 -0
- package/dist/antidebug-BRKeyt27.mjs +1081 -0
- package/dist/artifactRetention-CPXkUJXp.mjs +598 -0
- package/dist/artifacts-DkfosXH3.mjs +59 -0
- package/dist/authorization-schema-DRqyJMSk.mjs +31 -0
- package/dist/betterSqlite3-DLSBZodi.mjs +74 -0
- package/dist/binary-instrument--V3MAhJ4.mjs +971 -0
- package/dist/bind-helpers-ClV34xdn.mjs +42 -0
- package/dist/boringssl-inspector-Bo_LOLaS.mjs +180 -0
- package/dist/browser-Dx3_S2cG.mjs +4369 -0
- package/dist/capabilities-CcHlvWgK.mjs +33 -0
- package/dist/concurrency-Drev_Vz9.mjs +41 -0
- package/dist/{constants-CCvsN80K.mjs → constants-CDZLOoVv.mjs} +105 -48
- package/dist/coordination-DgItD9DL.mjs +259 -0
- package/dist/debugger-RS3RSAqs.mjs +1288 -0
- package/dist/definitions-BEoYofW5.mjs +47 -0
- package/dist/definitions-BRaefg3u.mjs +365 -0
- package/dist/definitions-BbkvZkiv.mjs +96 -0
- package/dist/definitions-BtWSHJ3o.mjs +17 -0
- package/dist/definitions-C1gCHO0i.mjs +43 -0
- package/dist/definitions-CDOg_b-l.mjs +138 -0
- package/dist/definitions-CVPD9hzZ.mjs +54 -0
- package/dist/definitions-Cea8Lgl7.mjs +94 -0
- package/dist/definitions-DAgIyjxM.mjs +10 -0
- package/dist/definitions-DJA27nsL.mjs +66 -0
- package/dist/definitions-DKPFU3LW.mjs +25 -0
- package/dist/definitions-DPRpZQ96.mjs +47 -0
- package/dist/definitions-DUE5gmdn.mjs +18 -0
- package/dist/definitions-DYVjOtxa.mjs +26 -0
- package/dist/definitions-DcYLVLCo.mjs +37 -0
- package/dist/definitions-Pp5LI2H4.mjs +27 -0
- package/dist/definitions-j9KdHVNR.mjs +14 -0
- package/dist/definitions-uzkjBwa7.mjs +258 -0
- package/dist/definitions-va-AnLuQ.mjs +28 -0
- package/dist/encoding-DJeqHmpd.mjs +1079 -0
- package/dist/evidence-graph-bridge-DcYizFk2.mjs +136 -0
- package/dist/{factory-CibqTNC8.mjs → factory-C90tBff6.mjs} +41 -56
- package/dist/flat-target-session-Dgax2Cy3.mjs +29 -0
- package/dist/graphql-CoHrhweh.mjs +1197 -0
- package/dist/handlers-4jmR0nMs.mjs +898 -0
- package/dist/handlers-BAHPxcch.mjs +789 -0
- package/dist/handlers-BOs9b907.mjs +2600 -0
- package/dist/handlers-BWXEy6ef.mjs +917 -0
- package/dist/handlers-Bndn6QvE.mjs +111 -0
- package/dist/handlers-BqC4bD4s.mjs +681 -0
- package/dist/handlers-BtYq60bM2.mjs +276 -0
- package/dist/handlers-BzgcB4iv.mjs +799 -0
- package/dist/handlers-CRyRWj2b.mjs +859 -0
- package/dist/handlers-CVv2H1uq.mjs +592 -0
- package/dist/handlers-Dl5a7JS4.mjs +572 -0
- package/dist/handlers-Dx2d7jt7.mjs +2537 -0
- package/dist/handlers-Dz9PYsCa.mjs +2805 -0
- package/dist/handlers-HujRKC3b.mjs +661 -0
- package/dist/handlers.impl-XWXkQfyi.mjs +807 -0
- package/dist/hooks-B1B8NRHL.mjs +898 -0
- package/dist/index.mjs +491 -259
- package/dist/{logger-BmWzC2lM.mjs → logger-Dh_xb7_2.mjs} +14 -6
- package/dist/maintenance-PRMkLVRW.mjs +835 -0
- package/dist/manifest-67Bok-Si.mjs +58 -0
- package/dist/manifest-6lNTMZAB2.mjs +87 -0
- package/dist/manifest-B2duEHiH.mjs +90 -0
- package/dist/manifest-B6EY9Vm8.mjs +57 -0
- package/dist/manifest-B6nKSbyY.mjs +95 -0
- package/dist/manifest-BL8AQNPF.mjs +106 -0
- package/dist/manifest-BSZvJJmV.mjs +47 -0
- package/dist/manifest-BU7qzUyX.mjs +418 -0
- package/dist/manifest-Bl62e8WK.mjs +49 -0
- package/dist/manifest-Bo5cXjdt.mjs +82 -0
- package/dist/manifest-BpS4gtUK.mjs +1347 -0
- package/dist/manifest-Bv65_e2W.mjs +101 -0
- package/dist/manifest-BytNIF4Z.mjs +117 -0
- package/dist/manifest-C-xtsjS3.mjs +81 -0
- package/dist/manifest-CDYl7OhA.mjs +66 -0
- package/dist/manifest-CRZ3xmkD.mjs +61 -0
- package/dist/manifest-CoW6u4Tp.mjs +132 -0
- package/dist/manifest-Cq5zN_8A.mjs +50 -0
- package/dist/manifest-D7YZM_2e.mjs +194 -0
- package/dist/manifest-DE_VrAeQ.mjs +314 -0
- package/dist/manifest-DGsXSCpT.mjs +39 -0
- package/dist/manifest-DJ2vfEuW.mjs +156 -0
- package/dist/manifest-DPXDYhEu.mjs +80 -0
- package/dist/manifest-Dd4fQb0a.mjs +322 -0
- package/dist/manifest-Deq6opGg.mjs +223 -0
- package/dist/manifest-DfJTafJK.mjs +37 -0
- package/dist/manifest-DgOdgN_j.mjs +50 -0
- package/dist/manifest-DlbMW4v4.mjs +47 -0
- package/dist/manifest-DmVfbH0w.mjs +374 -0
- package/dist/manifest-Dog6Ddjr.mjs +109 -0
- package/dist/manifest-DvgU5FWb.mjs +58 -0
- package/dist/manifest-HsfDBs7j.mjs +50 -0
- package/dist/manifest-I8oQHvCG.mjs +186 -0
- package/dist/manifest-NvH_a-av.mjs +786 -0
- package/dist/manifest-cEJU1v0Z.mjs +129 -0
- package/dist/manifest-wOl5XLB12.mjs +112 -0
- package/dist/modules-tZozf0LQ.mjs +10635 -0
- package/dist/mojo-ipc-DXNEXEqb.mjs +640 -0
- package/dist/network-CPVvwvFg.mjs +3852 -0
- package/dist/{artifacts-BbdOMET5.mjs → outputPaths-um7lCRY3.mjs} +219 -216
- package/dist/parse-args-B4cY5Vx5.mjs +39 -0
- package/dist/platform-CYeFoTWp.mjs +2161 -0
- package/dist/process-BTbgcVc6.mjs +1306 -0
- package/dist/proxy-r8YN6nP1.mjs +192 -0
- package/dist/registry-Bl8ZQW61.mjs +34 -0
- package/dist/response-CWhh2aLo.mjs +34 -0
- package/dist/server/plugin-api.mjs +2 -2
- package/dist/shared-state-board-BoZnSoj-.mjs +586 -0
- package/dist/sourcemap-BIDHUVXy.mjs +934 -0
- package/dist/ssrf-policy-Dsqd-DTX.mjs +166 -0
- package/dist/streaming-Dal6utPp.mjs +725 -0
- package/dist/tool-builder-BHJp32mV.mjs +186 -0
- package/dist/transform-DRVgGG90.mjs +1011 -0
- package/dist/types-Bx92KJfT.mjs +4 -0
- package/dist/wasm-BYx5UOeG.mjs +1044 -0
- package/dist/webcrack-Be0_FccV.mjs +747 -0
- package/dist/workflow-BpuKEtvn.mjs +725 -0
- package/package.json +82 -49
- package/dist/ExtensionManager-CPTJhHFg.mjs +0 -2
- package/dist/ToolCatalog-Bq4V2sbJ.mjs +0 -67201
- package/dist/{CacheAdapters-CzFNpD9a.mjs → CacheAdapters-jJFy20G-.mjs} +0 -0
- package/dist/{StealthVerifier-BzBCFiwx.mjs → StealthVerifier-BWmPgQsv.mjs} +0 -0
- package/dist/{VersionDetector-CNXcvD46.mjs → VersionDetector-K3V4vGsw.mjs} +0 -0
- package/dist/{formatAddress-ChCSIRWT.mjs → formatAddress-nnMvEohD.mjs} +0 -0
- package/dist/{types-BBjOqye-.mjs → types-DDBWs9UP.mjs} +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { n as toolLookup } from "./registry-Bl8ZQW61.mjs";
|
|
2
|
+
import { n as defineMethodRegistrations } from "./bind-helpers-ClV34xdn.mjs";
|
|
3
|
+
import { t as tool } from "./tool-builder-BHJp32mV.mjs";
|
|
4
|
+
//#region src/server/domains/syscall-hook/definitions.ts
|
|
5
|
+
const BACKEND_OPTIONS = [
|
|
6
|
+
"etw",
|
|
7
|
+
"strace",
|
|
8
|
+
"dtrace"
|
|
9
|
+
];
|
|
10
|
+
const SYSCALL_EVENT_SCHEMA = {
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
timestamp: {
|
|
14
|
+
type: "number",
|
|
15
|
+
description: "Relative elapsed time in milliseconds since bpftrace start"
|
|
16
|
+
},
|
|
17
|
+
pid: {
|
|
18
|
+
type: "number",
|
|
19
|
+
description: "Process identifier"
|
|
20
|
+
},
|
|
21
|
+
syscall: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Observed syscall name"
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
type: "array",
|
|
27
|
+
description: "Stringified syscall arguments",
|
|
28
|
+
items: { type: "string" }
|
|
29
|
+
},
|
|
30
|
+
returnValue: {
|
|
31
|
+
type: "number",
|
|
32
|
+
description: "Numeric syscall return value if available"
|
|
33
|
+
},
|
|
34
|
+
duration: {
|
|
35
|
+
type: "number",
|
|
36
|
+
description: "Execution duration in milliseconds if available"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
required: [
|
|
40
|
+
"timestamp",
|
|
41
|
+
"pid",
|
|
42
|
+
"syscall",
|
|
43
|
+
"args"
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
const syscallHookToolDefinitions = [
|
|
47
|
+
tool("syscall_start_monitor", (t) => t.desc("Start syscall monitoring using ETW, strace, or dtrace.").enum("backend", BACKEND_OPTIONS, "Syscall capture backend").number("pid", "Optional PID to scope monitoring to a single process").boolean("simulate", "Use synthetic events instead of a real system tracer", { default: false }).required("backend")),
|
|
48
|
+
tool("syscall_stop_monitor", (t) => t.desc("Stop syscall monitoring.").idempotent()),
|
|
49
|
+
tool("syscall_capture_events", (t) => t.desc("Capture syscall events from the active or last monitoring session.").prop("filter", {
|
|
50
|
+
type: "object",
|
|
51
|
+
description: "Optional event filter",
|
|
52
|
+
properties: {
|
|
53
|
+
name: {
|
|
54
|
+
type: "array",
|
|
55
|
+
description: "Restrict events to specific syscall names",
|
|
56
|
+
items: { type: "string" }
|
|
57
|
+
},
|
|
58
|
+
pid: {
|
|
59
|
+
type: "number",
|
|
60
|
+
description: "Restrict events to a specific process ID"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}).query()),
|
|
64
|
+
tool("syscall_correlate_js", (t) => t.desc("Correlate captured syscalls with likely JavaScript functions.").array("syscallEvents", SYSCALL_EVENT_SCHEMA, "Syscall events to correlate").required("syscallEvents").query()),
|
|
65
|
+
tool("syscall_filter", (t) => t.desc("Filter captured syscall events by syscall name.").array("names", { type: "string" }, "Syscall names to keep").query()),
|
|
66
|
+
tool("syscall_get_stats", (t) => t.desc("Get syscall monitoring statistics.").query()),
|
|
67
|
+
tool("syscall_ebpf_trace", (t) => t.desc("Trace syscalls via Linux eBPF/bpftrace. Requires root or CAP_BPF.").number("pid", "Process ID to trace. 0 = trace all.", { default: 0 }).array("syscalls", { type: "string" }, "Specific syscall names to trace (empty = all)").number("durationSec", "Trace duration in seconds", {
|
|
68
|
+
default: 10,
|
|
69
|
+
minimum: 1,
|
|
70
|
+
maximum: 300
|
|
71
|
+
}).boolean("simulate", "Use synthetic events when bpftrace is unavailable", { default: false }).query())
|
|
72
|
+
];
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/server/domains/syscall-hook/manifest.ts
|
|
75
|
+
const DOMAIN = "syscall-hook";
|
|
76
|
+
const DEP_KEY = "syscallHookHandlers";
|
|
77
|
+
const registrations = defineMethodRegistrations({
|
|
78
|
+
domain: DOMAIN,
|
|
79
|
+
depKey: DEP_KEY,
|
|
80
|
+
lookup: toolLookup(syscallHookToolDefinitions),
|
|
81
|
+
entries: [
|
|
82
|
+
{
|
|
83
|
+
tool: "syscall_start_monitor",
|
|
84
|
+
method: "handleSyscallStartMonitor"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
tool: "syscall_stop_monitor",
|
|
88
|
+
method: "handleSyscallStopMonitor"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
tool: "syscall_capture_events",
|
|
92
|
+
method: "handleSyscallCaptureEvents"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
tool: "syscall_correlate_js",
|
|
96
|
+
method: "handleSyscallCorrelateJs"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
tool: "syscall_filter",
|
|
100
|
+
method: "handleSyscallFilter"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
tool: "syscall_get_stats",
|
|
104
|
+
method: "handleSyscallGetStats"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
tool: "syscall_ebpf_trace",
|
|
108
|
+
method: "handleSyscallEbpfTrace"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
async function ensure(ctx) {
|
|
113
|
+
const { SyscallHookHandlers } = await import("./handlers-4jmR0nMs.mjs");
|
|
114
|
+
const existing = ctx.getDomainInstance(DEP_KEY);
|
|
115
|
+
if (existing) return existing;
|
|
116
|
+
const handlers = new SyscallHookHandlers(void 0, void 0, ctx.eventBus);
|
|
117
|
+
ctx.setDomainInstance(DEP_KEY, handlers);
|
|
118
|
+
return handlers;
|
|
119
|
+
}
|
|
120
|
+
const manifest = {
|
|
121
|
+
kind: "domain-manifest",
|
|
122
|
+
version: 1,
|
|
123
|
+
domain: DOMAIN,
|
|
124
|
+
depKey: DEP_KEY,
|
|
125
|
+
profiles: ["full"],
|
|
126
|
+
ensure,
|
|
127
|
+
registrations,
|
|
128
|
+
workflowRule: {
|
|
129
|
+
patterns: [/\b(syscall|etw|strace|dtrace|kernel|system\s?call)\b/i, /(syscall|kernel).*(trace|monitor|capture|filter)/i],
|
|
130
|
+
priority: 78,
|
|
131
|
+
tools: [
|
|
132
|
+
"syscall_start_monitor",
|
|
133
|
+
"syscall_capture_events",
|
|
134
|
+
"syscall_correlate_js"
|
|
135
|
+
],
|
|
136
|
+
hint: "Syscall tracing: start monitor (ETW/strace/dtrace) → capture events → correlate with JS stacks."
|
|
137
|
+
},
|
|
138
|
+
prerequisites: {
|
|
139
|
+
syscall_start_monitor: [{
|
|
140
|
+
condition: "Administrator/root privileges required for ETW and dtrace; Linux strace needs ptrace_scope=0",
|
|
141
|
+
fix: "Run the MCP server with elevated privileges, or relax kernel restrictions on Linux"
|
|
142
|
+
}],
|
|
143
|
+
syscall_correlate_js: [{
|
|
144
|
+
condition: "A debugger or v8-inspector session must expose JS stacks",
|
|
145
|
+
fix: "Attach the debugger or v8-inspector domain before correlating"
|
|
146
|
+
}]
|
|
147
|
+
},
|
|
148
|
+
toolDependencies: [{
|
|
149
|
+
from: "memory",
|
|
150
|
+
to: "syscall-hook",
|
|
151
|
+
relation: "uses",
|
|
152
|
+
weight: .5
|
|
153
|
+
}]
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
export { manifest as default };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { n as toolLookup } from "./registry-Bl8ZQW61.mjs";
|
|
2
|
+
import { n as defineMethodRegistrations } from "./bind-helpers-ClV34xdn.mjs";
|
|
3
|
+
import { t as tool } from "./tool-builder-BHJp32mV.mjs";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
//#region src/server/domains/evidence/definitions.ts
|
|
6
|
+
const evidenceTools = [
|
|
7
|
+
tool("evidence_query", (t) => t.desc("Query reverse evidence graph by URL, function name, or script ID to find associated nodes.").enum("by", [
|
|
8
|
+
"url",
|
|
9
|
+
"function",
|
|
10
|
+
"script"
|
|
11
|
+
], "Query dimension").string("value", "Search value: URL/fragment, function name, or script ID").required("by", "value").query()),
|
|
12
|
+
tool("evidence_export", (t) => t.desc("Export the reverse evidence graph as JSON snapshot or Markdown report.").enum("format", ["json", "markdown"], "Export format").required("format").query()),
|
|
13
|
+
tool("evidence_chain", (t) => t.desc("Get full provenance chain from a node ID in specified direction").string("nodeId", "Evidence node ID to start from").enum("direction", ["forward", "backward"], "Traversal direction", { default: "forward" }).required("nodeId").query())
|
|
14
|
+
];
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/server/domains/evidence/manifest.ts
|
|
17
|
+
const DOMAIN = "evidence";
|
|
18
|
+
const DEP_KEY = "evidenceHandlers";
|
|
19
|
+
const registrations = defineMethodRegistrations({
|
|
20
|
+
domain: DOMAIN,
|
|
21
|
+
depKey: DEP_KEY,
|
|
22
|
+
lookup: toolLookup(evidenceTools),
|
|
23
|
+
entries: [
|
|
24
|
+
{
|
|
25
|
+
tool: "evidence_query",
|
|
26
|
+
method: "handleQueryDispatch"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
tool: "evidence_export",
|
|
30
|
+
method: "handleExportDispatch"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
tool: "evidence_chain",
|
|
34
|
+
method: "handleChain"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
async function ensure(ctx) {
|
|
39
|
+
const { ReverseEvidenceGraph } = await import("./ReverseEvidenceGraph-C02-gXOh.mjs").then((n) => n.t);
|
|
40
|
+
const { EvidenceGraphBridge } = await import("./EvidenceGraphBridge-318Oi0Lf.mjs");
|
|
41
|
+
const { EvidenceHandlers } = await import("./handlers-Bndn6QvE.mjs");
|
|
42
|
+
let graph = ctx.getDomainInstance("evidenceGraph");
|
|
43
|
+
if (!graph) {
|
|
44
|
+
graph = new ReverseEvidenceGraph();
|
|
45
|
+
graph.setEventBus(ctx.eventBus);
|
|
46
|
+
ctx.setDomainInstance("evidenceGraph", graph);
|
|
47
|
+
}
|
|
48
|
+
let bridge = ctx.getDomainInstance("evidenceGraphBridge");
|
|
49
|
+
if (!bridge) {
|
|
50
|
+
bridge = new EvidenceGraphBridge(graph);
|
|
51
|
+
ctx.setDomainInstance("evidenceGraphBridge", bridge);
|
|
52
|
+
}
|
|
53
|
+
ctx.getDomainInstance("instrumentationSessionManager")?.setEvidenceBridge(bridge);
|
|
54
|
+
if (!ctx.evidenceHandlers) ctx.evidenceHandlers = new EvidenceHandlers(graph);
|
|
55
|
+
const scheduler = ctx.getDomainInstance("snapshotScheduler");
|
|
56
|
+
const stateDir = ctx.getDomainInstance("snapshotStateDir");
|
|
57
|
+
graph.setPersistNotifier(scheduler ? () => scheduler.notifyDirty() : void 0);
|
|
58
|
+
if (scheduler && stateDir && !ctx.getDomainInstance("evidenceGraphSnapshotRegistered")) {
|
|
59
|
+
scheduler.register(resolve(stateDir, "evidence-graph", "current.json"), graph);
|
|
60
|
+
ctx.setDomainInstance("evidenceGraphSnapshotRegistered", true);
|
|
61
|
+
}
|
|
62
|
+
return ctx.evidenceHandlers;
|
|
63
|
+
}
|
|
64
|
+
const manifest = {
|
|
65
|
+
kind: "domain-manifest",
|
|
66
|
+
version: 1,
|
|
67
|
+
domain: DOMAIN,
|
|
68
|
+
depKey: DEP_KEY,
|
|
69
|
+
profiles: ["full"],
|
|
70
|
+
ensure,
|
|
71
|
+
workflowRule: {
|
|
72
|
+
patterns: [/(evidence|provenance|chain).*(graph|query|export|report)/i, /(证据|溯源|链).*(图|查询|导出|报告)/i],
|
|
73
|
+
priority: 90,
|
|
74
|
+
tools: ["evidence_query", "evidence_export"],
|
|
75
|
+
hint: "Evidence graph: query by URL/function/scriptId → get provenance chain → export as JSON or Markdown report"
|
|
76
|
+
},
|
|
77
|
+
registrations
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { manifest as default };
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { n as toolLookup, t as ensureBrowserCore } from "./registry-Bl8ZQW61.mjs";
|
|
2
|
+
import { n as defineMethodRegistrations } from "./bind-helpers-ClV34xdn.mjs";
|
|
3
|
+
import { n as advancedBrowserToolDefinitions, t as browserTools } from "./definitions-BRaefg3u.mjs";
|
|
4
|
+
//#region src/server/domains/browser/manifest.ts
|
|
5
|
+
const DOMAIN = "browser";
|
|
6
|
+
const DEP_KEY = "browserHandlers";
|
|
7
|
+
const registrations = defineMethodRegistrations({
|
|
8
|
+
domain: DOMAIN,
|
|
9
|
+
depKey: DEP_KEY,
|
|
10
|
+
lookup: toolLookup([...browserTools, ...advancedBrowserToolDefinitions]),
|
|
11
|
+
entries: [
|
|
12
|
+
{
|
|
13
|
+
tool: "get_detailed_data",
|
|
14
|
+
method: "handleGetDetailedData"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
tool: "browser_attach",
|
|
18
|
+
method: "handleBrowserAttach"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
tool: "browser_list_tabs",
|
|
22
|
+
method: "handleBrowserListTabs"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
tool: "browser_list_cdp_targets",
|
|
26
|
+
method: "handleBrowserListCdpTargets"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
tool: "browser_select_tab",
|
|
30
|
+
method: "handleBrowserSelectTab"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
tool: "browser_attach_cdp_target",
|
|
34
|
+
method: "handleBrowserAttachCdpTarget"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
tool: "browser_detach_cdp_target",
|
|
38
|
+
method: "handleBrowserDetachCdpTarget"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
tool: "browser_evaluate_cdp_target",
|
|
42
|
+
method: "handleBrowserEvaluateCdpTarget"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
tool: "browser_launch",
|
|
46
|
+
method: "handleBrowserLaunch"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
tool: "browser_close",
|
|
50
|
+
method: "handleBrowserClose"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
tool: "browser_status",
|
|
54
|
+
method: "handleBrowserStatus"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
tool: "page_navigate",
|
|
58
|
+
method: "handlePageNavigate"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
tool: "page_reload",
|
|
62
|
+
method: "handlePageReload"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
tool: "page_back",
|
|
66
|
+
method: "handlePageBack"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
tool: "page_forward",
|
|
70
|
+
method: "handlePageForward"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
tool: "page_click",
|
|
74
|
+
method: "handlePageClick"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
tool: "page_type",
|
|
78
|
+
method: "handlePageType"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
tool: "page_select",
|
|
82
|
+
method: "handlePageSelect"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
tool: "page_hover",
|
|
86
|
+
method: "handlePageHover"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
tool: "page_scroll",
|
|
90
|
+
method: "handlePageScroll"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
tool: "page_wait_for_selector",
|
|
94
|
+
method: "handlePageWaitForSelector"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
tool: "page_evaluate",
|
|
98
|
+
method: "handlePageEvaluate"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
tool: "page_screenshot",
|
|
102
|
+
method: "handlePageScreenshot"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
tool: "get_all_scripts",
|
|
106
|
+
method: "handleGetAllScripts"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
tool: "get_script_source",
|
|
110
|
+
method: "handleGetScriptSource"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
tool: "console_monitor",
|
|
114
|
+
method: "handleConsoleMonitor"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
tool: "console_get_logs",
|
|
118
|
+
method: "handleConsoleGetLogs"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
tool: "console_execute",
|
|
122
|
+
method: "handleConsoleExecute"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
tool: "page_inject_script",
|
|
126
|
+
method: "handlePageInjectScript"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
tool: "page_cookies",
|
|
130
|
+
method: "handlePageCookiesDispatch"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
tool: "page_set_viewport",
|
|
134
|
+
method: "handlePageSetViewport"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
tool: "page_emulate_device",
|
|
138
|
+
method: "handlePageEmulateDevice"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
tool: "page_local_storage",
|
|
142
|
+
method: "handlePageLocalStorageDispatch"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
tool: "page_press_key",
|
|
146
|
+
method: "handlePagePressKey"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
tool: "captcha_detect",
|
|
150
|
+
method: "handleCaptchaDetect"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
tool: "captcha_wait",
|
|
154
|
+
method: "handleCaptchaWait"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
tool: "captcha_config",
|
|
158
|
+
method: "handleCaptchaConfig"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
tool: "stealth_inject",
|
|
162
|
+
method: "handleStealthInject"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
tool: "stealth_set_user_agent",
|
|
166
|
+
method: "handleStealthSetUserAgent"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
tool: "stealth_configure_jitter",
|
|
170
|
+
method: "handleStealthConfigureJitter"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
tool: "stealth_generate_fingerprint",
|
|
174
|
+
method: "handleStealthGenerateFingerprint"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
tool: "stealth_verify",
|
|
178
|
+
method: "handleStealthVerify"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
tool: "camoufox_geolocation",
|
|
182
|
+
method: "handleCamoufoxGeolocation"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
tool: "camoufox_server",
|
|
186
|
+
method: "handleCamoufoxServerDispatch"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
tool: "framework_state_extract",
|
|
190
|
+
method: "handleFrameworkStateExtract"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
tool: "indexeddb_dump",
|
|
194
|
+
method: "handleIndexedDBDump"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
tool: "js_heap_search",
|
|
198
|
+
method: "handleJSHeapSearch"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
tool: "tab_workflow",
|
|
202
|
+
method: "handleTabWorkflow"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
tool: "human_mouse",
|
|
206
|
+
method: "handleHumanMouse"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
tool: "human_scroll",
|
|
210
|
+
method: "handleHumanScroll"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
tool: "human_typing",
|
|
214
|
+
method: "handleHumanTyping"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
tool: "captcha_solver_capabilities",
|
|
218
|
+
method: "handleCaptchaSolverCapabilities"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
tool: "captcha_vision_solve",
|
|
222
|
+
method: "handleCaptchaVisionSolve"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
tool: "widget_challenge_solve",
|
|
226
|
+
method: "handleWidgetChallengeSolve"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
tool: "browser_jsdom_parse",
|
|
230
|
+
method: "handleJsdomParse"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
tool: "browser_jsdom_query",
|
|
234
|
+
method: "handleJsdomQuery"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
tool: "browser_jsdom_execute",
|
|
238
|
+
method: "handleJsdomExecute"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
tool: "browser_jsdom_serialize",
|
|
242
|
+
method: "handleJsdomSerialize"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
tool: "browser_jsdom_cookies",
|
|
246
|
+
method: "handleJsdomCookies"
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
async function ensure(ctx) {
|
|
251
|
+
const { BrowserToolHandlers } = await import("./browser-Dx3_S2cG.mjs");
|
|
252
|
+
await ensureBrowserCore(ctx);
|
|
253
|
+
if (!ctx.browserHandlers) ctx.browserHandlers = new BrowserToolHandlers(ctx.collector, ctx.pageController, ctx.scriptManager, ctx.consoleMonitor, ctx.eventBus);
|
|
254
|
+
return ctx.browserHandlers;
|
|
255
|
+
}
|
|
256
|
+
const manifest = {
|
|
257
|
+
kind: "domain-manifest",
|
|
258
|
+
version: 1,
|
|
259
|
+
domain: DOMAIN,
|
|
260
|
+
depKey: DEP_KEY,
|
|
261
|
+
profiles: ["workflow", "full"],
|
|
262
|
+
ensure,
|
|
263
|
+
workflowRule: {
|
|
264
|
+
patterns: [/(browser|page|navigate|screenshot|click|type|scrape)/i, /(浏览器|页面|导航|截图|点击|输入|爬取)/i],
|
|
265
|
+
priority: 90,
|
|
266
|
+
tools: [
|
|
267
|
+
"page_navigate",
|
|
268
|
+
"page_evaluate",
|
|
269
|
+
"browser_jsdom_parse",
|
|
270
|
+
"console_get_logs",
|
|
271
|
+
"page_click",
|
|
272
|
+
"page_type",
|
|
273
|
+
"page_screenshot"
|
|
274
|
+
],
|
|
275
|
+
hint: "Browser automation workflow: bootstrap browser/page state -> inspect page state -> interact -> capture visual evidence only when needed"
|
|
276
|
+
},
|
|
277
|
+
prerequisites: {
|
|
278
|
+
page_navigate: [{
|
|
279
|
+
condition: "Browser must be launched",
|
|
280
|
+
fix: "Call browser_launch or browser_attach first"
|
|
281
|
+
}],
|
|
282
|
+
page_click: [{
|
|
283
|
+
condition: "Browser must be launched",
|
|
284
|
+
fix: "Call browser_launch or browser_attach first"
|
|
285
|
+
}],
|
|
286
|
+
page_type: [{
|
|
287
|
+
condition: "Browser must be launched",
|
|
288
|
+
fix: "Call browser_launch or browser_attach first"
|
|
289
|
+
}],
|
|
290
|
+
page_screenshot: [{
|
|
291
|
+
condition: "Browser must be launched",
|
|
292
|
+
fix: "Call browser_launch or browser_attach first"
|
|
293
|
+
}],
|
|
294
|
+
page_evaluate: [{
|
|
295
|
+
condition: "Browser must be launched",
|
|
296
|
+
fix: "Call browser_launch or browser_attach first"
|
|
297
|
+
}],
|
|
298
|
+
page_hover: [{
|
|
299
|
+
condition: "Browser must be launched",
|
|
300
|
+
fix: "Call browser_launch or browser_attach first"
|
|
301
|
+
}],
|
|
302
|
+
page_back: [{
|
|
303
|
+
condition: "Browser must be launched",
|
|
304
|
+
fix: "Call browser_launch or browser_attach first"
|
|
305
|
+
}],
|
|
306
|
+
page_forward: [{
|
|
307
|
+
condition: "Browser must be launched",
|
|
308
|
+
fix: "Call browser_launch or browser_attach first"
|
|
309
|
+
}],
|
|
310
|
+
page_reload: [{
|
|
311
|
+
condition: "Browser must be launched",
|
|
312
|
+
fix: "Call browser_launch or browser_attach first"
|
|
313
|
+
}],
|
|
314
|
+
page_scroll: [{
|
|
315
|
+
condition: "Browser must be launched",
|
|
316
|
+
fix: "Call browser_launch or browser_attach first"
|
|
317
|
+
}]
|
|
318
|
+
},
|
|
319
|
+
registrations
|
|
320
|
+
};
|
|
321
|
+
//#endregion
|
|
322
|
+
export { manifest as default };
|