@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,186 @@
|
|
|
1
|
+
//#region src/server/registry/tool-builder.ts
|
|
2
|
+
function createInitialState(name) {
|
|
3
|
+
return {
|
|
4
|
+
name,
|
|
5
|
+
description: "",
|
|
6
|
+
properties: {},
|
|
7
|
+
required: [],
|
|
8
|
+
annotations: {
|
|
9
|
+
readOnlyHint: false,
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
idempotentHint: false,
|
|
12
|
+
openWorldHint: false
|
|
13
|
+
},
|
|
14
|
+
asyncTask: false,
|
|
15
|
+
autocompleteHandlers: {},
|
|
16
|
+
outputSchema: void 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function defaults(opts) {
|
|
20
|
+
if (opts?.default === void 0) return {};
|
|
21
|
+
return { default: opts.default };
|
|
22
|
+
}
|
|
23
|
+
function withState(state, patch) {
|
|
24
|
+
return {
|
|
25
|
+
...state,
|
|
26
|
+
...patch
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function withProperty(state, name, schema) {
|
|
30
|
+
return withState(state, { properties: {
|
|
31
|
+
...state.properties,
|
|
32
|
+
[name]: schema
|
|
33
|
+
} });
|
|
34
|
+
}
|
|
35
|
+
function withRequiredNames(state, names) {
|
|
36
|
+
return withState(state, { required: [...state.required, ...names] });
|
|
37
|
+
}
|
|
38
|
+
function withAnnotations(state, patch) {
|
|
39
|
+
return withState(state, { annotations: {
|
|
40
|
+
...state.annotations,
|
|
41
|
+
...patch
|
|
42
|
+
} });
|
|
43
|
+
}
|
|
44
|
+
function buildTool(state) {
|
|
45
|
+
return {
|
|
46
|
+
name: state.name,
|
|
47
|
+
description: state.description,
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: state.properties,
|
|
51
|
+
...state.required.length > 0 ? { required: [...state.required] } : {}
|
|
52
|
+
},
|
|
53
|
+
annotations: {
|
|
54
|
+
readOnlyHint: state.annotations.readOnlyHint,
|
|
55
|
+
destructiveHint: state.annotations.destructiveHint,
|
|
56
|
+
idempotentHint: state.annotations.idempotentHint,
|
|
57
|
+
openWorldHint: state.annotations.openWorldHint
|
|
58
|
+
},
|
|
59
|
+
...state.asyncTask ? { execution: { taskSupport: "optional" } } : {},
|
|
60
|
+
...Object.keys(state.autocompleteHandlers).length > 0 ? { __autocomplete: state.autocompleteHandlers } : {},
|
|
61
|
+
...state.outputSchema ? { outputSchema: state.outputSchema } : {}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function createBuilder(state, tracker) {
|
|
65
|
+
const next = (updated) => {
|
|
66
|
+
const nextBuilder = createBuilder(updated, tracker);
|
|
67
|
+
if (tracker) tracker.latest = nextBuilder;
|
|
68
|
+
return nextBuilder;
|
|
69
|
+
};
|
|
70
|
+
const builder = {
|
|
71
|
+
desc(description) {
|
|
72
|
+
return next(withState(state, { description }));
|
|
73
|
+
},
|
|
74
|
+
string(name, description, opts) {
|
|
75
|
+
const schema = {
|
|
76
|
+
type: "string",
|
|
77
|
+
description,
|
|
78
|
+
...defaults(opts)
|
|
79
|
+
};
|
|
80
|
+
if (opts?.pattern) schema.pattern = opts.pattern;
|
|
81
|
+
return next(withProperty(state, name, schema));
|
|
82
|
+
},
|
|
83
|
+
number(name, description, opts) {
|
|
84
|
+
const schema = {
|
|
85
|
+
type: "number",
|
|
86
|
+
description,
|
|
87
|
+
...defaults(opts)
|
|
88
|
+
};
|
|
89
|
+
if (opts?.minimum !== void 0) schema.minimum = opts.minimum;
|
|
90
|
+
if (opts?.maximum !== void 0) schema.maximum = opts.maximum;
|
|
91
|
+
return next(withProperty(state, name, schema));
|
|
92
|
+
},
|
|
93
|
+
integer(name, description, opts) {
|
|
94
|
+
const schema = {
|
|
95
|
+
type: "integer",
|
|
96
|
+
description,
|
|
97
|
+
...defaults(opts)
|
|
98
|
+
};
|
|
99
|
+
if (opts?.minimum !== void 0) schema.minimum = opts.minimum;
|
|
100
|
+
if (opts?.maximum !== void 0) schema.maximum = opts.maximum;
|
|
101
|
+
return next(withProperty(state, name, schema));
|
|
102
|
+
},
|
|
103
|
+
boolean(name, description, opts) {
|
|
104
|
+
return next(withProperty(state, name, {
|
|
105
|
+
type: "boolean",
|
|
106
|
+
description,
|
|
107
|
+
...defaults(opts)
|
|
108
|
+
}));
|
|
109
|
+
},
|
|
110
|
+
enum(name, values, description, opts) {
|
|
111
|
+
return next(withProperty(state, name, {
|
|
112
|
+
type: "string",
|
|
113
|
+
enum: values,
|
|
114
|
+
description,
|
|
115
|
+
...defaults(opts)
|
|
116
|
+
}));
|
|
117
|
+
},
|
|
118
|
+
array(name, items, description) {
|
|
119
|
+
return next(withProperty(state, name, {
|
|
120
|
+
type: "array",
|
|
121
|
+
items,
|
|
122
|
+
description
|
|
123
|
+
}));
|
|
124
|
+
},
|
|
125
|
+
object(name, props, description, opts) {
|
|
126
|
+
return next(withProperty(state, name, {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: props,
|
|
129
|
+
description,
|
|
130
|
+
...opts?.required ? { required: opts.required } : {}
|
|
131
|
+
}));
|
|
132
|
+
},
|
|
133
|
+
prop(name, schema) {
|
|
134
|
+
return next(withProperty(state, name, schema));
|
|
135
|
+
},
|
|
136
|
+
required(...names) {
|
|
137
|
+
return next(withRequiredNames(state, names));
|
|
138
|
+
},
|
|
139
|
+
requiredOpenWorld(...names) {
|
|
140
|
+
return this.required(...names).openWorld();
|
|
141
|
+
},
|
|
142
|
+
readOnly() {
|
|
143
|
+
return next(withAnnotations(state, { readOnlyHint: true }));
|
|
144
|
+
},
|
|
145
|
+
destructive() {
|
|
146
|
+
return next(withAnnotations(state, { destructiveHint: true }));
|
|
147
|
+
},
|
|
148
|
+
idempotent() {
|
|
149
|
+
return next(withAnnotations(state, { idempotentHint: true }));
|
|
150
|
+
},
|
|
151
|
+
openWorld() {
|
|
152
|
+
return next(withAnnotations(state, { openWorldHint: true }));
|
|
153
|
+
},
|
|
154
|
+
query() {
|
|
155
|
+
return this.readOnly().idempotent();
|
|
156
|
+
},
|
|
157
|
+
resettable() {
|
|
158
|
+
return this.destructive().idempotent();
|
|
159
|
+
},
|
|
160
|
+
asyncTask() {
|
|
161
|
+
return next(withState(state, { asyncTask: true }));
|
|
162
|
+
},
|
|
163
|
+
autocomplete(argName, handler) {
|
|
164
|
+
return next(withState(state, { autocompleteHandlers: {
|
|
165
|
+
...state.autocompleteHandlers,
|
|
166
|
+
[argName]: handler
|
|
167
|
+
} }));
|
|
168
|
+
},
|
|
169
|
+
outputSchema(schema) {
|
|
170
|
+
return next(withState(state, { outputSchema: schema }));
|
|
171
|
+
},
|
|
172
|
+
build() {
|
|
173
|
+
return buildTool(state);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
if (tracker && !tracker.latest) tracker.latest = builder;
|
|
177
|
+
return builder;
|
|
178
|
+
}
|
|
179
|
+
/** Create a new tool definition with fluent builder API. */
|
|
180
|
+
function tool(name, configure) {
|
|
181
|
+
const tracker = {};
|
|
182
|
+
const builder = createBuilder(createInitialState(name), tracker);
|
|
183
|
+
return (configure(builder) ?? tracker.latest ?? builder).build();
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
export { tool as t };
|