@godscene/shared 1.7.11
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 +9 -0
- package/dist/es/baseDB.mjs +109 -0
- package/dist/es/cli/cli-args.mjs +95 -0
- package/dist/es/cli/cli-error.mjs +24 -0
- package/dist/es/cli/cli-runner.mjs +122 -0
- package/dist/es/cli/index.mjs +4 -0
- package/dist/es/common.mjs +37 -0
- package/dist/es/constants/example-code.mjs +227 -0
- package/dist/es/constants/index.mjs +124 -0
- package/dist/es/env/basic.mjs +6 -0
- package/dist/es/env/constants.mjs +110 -0
- package/dist/es/env/global-config-manager.mjs +94 -0
- package/dist/es/env/helper.mjs +43 -0
- package/dist/es/env/index.mjs +5 -0
- package/dist/es/env/init-debug.mjs +18 -0
- package/dist/es/env/model-config-manager.mjs +79 -0
- package/dist/es/env/parse-model-config.mjs +165 -0
- package/dist/es/env/types.mjs +232 -0
- package/dist/es/env/utils.mjs +18 -0
- package/dist/es/extractor/constants.mjs +2 -0
- package/dist/es/extractor/cs_postmessage.mjs +61 -0
- package/dist/es/extractor/customLocator.mjs +641 -0
- package/dist/es/extractor/debug.mjs +6 -0
- package/dist/es/extractor/dom-util.mjs +96 -0
- package/dist/es/extractor/index.mjs +5 -0
- package/dist/es/extractor/locator.mjs +250 -0
- package/dist/es/extractor/tree.mjs +78 -0
- package/dist/es/extractor/util.mjs +245 -0
- package/dist/es/extractor/web-extractor.mjs +393 -0
- package/dist/es/img/box-select.mjs +824 -0
- package/dist/es/img/canvas-fallback.mjs +238 -0
- package/dist/es/img/get-photon.mjs +45 -0
- package/dist/es/img/get-sharp.mjs +11 -0
- package/dist/es/img/index.mjs +4 -0
- package/dist/es/img/info.mjs +35 -0
- package/dist/es/img/transform.mjs +275 -0
- package/dist/es/index.mjs +2 -0
- package/dist/es/key-alias-utils.mjs +19 -0
- package/dist/es/logger.mjs +64 -0
- package/dist/es/mcp/base-server.mjs +282 -0
- package/dist/es/mcp/base-tools.mjs +159 -0
- package/dist/es/mcp/chrome-path.mjs +35 -0
- package/dist/es/mcp/cli-report-session.mjs +78 -0
- package/dist/es/mcp/error-formatter.mjs +19 -0
- package/dist/es/mcp/index.mjs +9 -0
- package/dist/es/mcp/init-arg-utils.mjs +38 -0
- package/dist/es/mcp/inject-report-html-plugin.mjs +53 -0
- package/dist/es/mcp/launcher-helper.mjs +52 -0
- package/dist/es/mcp/tool-generator.mjs +419 -0
- package/dist/es/mcp/types.mjs +3 -0
- package/dist/es/node/fs.mjs +44 -0
- package/dist/es/node/index.mjs +2 -0
- package/dist/es/node/port.mjs +24 -0
- package/dist/es/polyfills/async-hooks.mjs +2 -0
- package/dist/es/polyfills/index.mjs +1 -0
- package/dist/es/types/index.mjs +3 -0
- package/dist/es/us-keyboard-layout.mjs +1414 -0
- package/dist/es/us-keyboard-layout.mjs.LICENSE.txt +5 -0
- package/dist/es/utils.mjs +72 -0
- package/dist/es/zod-schema-utils.mjs +54 -0
- package/dist/lib/baseDB.js +149 -0
- package/dist/lib/cli/cli-args.js +138 -0
- package/dist/lib/cli/cli-error.js +61 -0
- package/dist/lib/cli/cli-runner.js +181 -0
- package/dist/lib/cli/index.js +53 -0
- package/dist/lib/common.js +93 -0
- package/dist/lib/constants/example-code.js +264 -0
- package/dist/lib/constants/index.js +221 -0
- package/dist/lib/env/basic.js +40 -0
- package/dist/lib/env/constants.js +153 -0
- package/dist/lib/env/global-config-manager.js +128 -0
- package/dist/lib/env/helper.js +80 -0
- package/dist/lib/env/index.js +90 -0
- package/dist/lib/env/init-debug.js +52 -0
- package/dist/lib/env/model-config-manager.js +113 -0
- package/dist/lib/env/parse-model-config.js +211 -0
- package/dist/lib/env/types.js +572 -0
- package/dist/lib/env/utils.js +61 -0
- package/dist/lib/extractor/constants.js +42 -0
- package/dist/lib/extractor/cs_postmessage.js +98 -0
- package/dist/lib/extractor/customLocator.js +693 -0
- package/dist/lib/extractor/debug.js +12 -0
- package/dist/lib/extractor/dom-util.js +157 -0
- package/dist/lib/extractor/index.js +87 -0
- package/dist/lib/extractor/locator.js +296 -0
- package/dist/lib/extractor/tree.js +124 -0
- package/dist/lib/extractor/util.js +336 -0
- package/dist/lib/extractor/web-extractor.js +442 -0
- package/dist/lib/img/box-select.js +875 -0
- package/dist/lib/img/canvas-fallback.js +305 -0
- package/dist/lib/img/get-photon.js +82 -0
- package/dist/lib/img/get-sharp.js +45 -0
- package/dist/lib/img/index.js +95 -0
- package/dist/lib/img/info.js +92 -0
- package/dist/lib/img/transform.js +364 -0
- package/dist/lib/index.js +36 -0
- package/dist/lib/key-alias-utils.js +62 -0
- package/dist/lib/logger.js +114 -0
- package/dist/lib/mcp/base-server.js +332 -0
- package/dist/lib/mcp/base-tools.js +193 -0
- package/dist/lib/mcp/chrome-path.js +72 -0
- package/dist/lib/mcp/cli-report-session.js +121 -0
- package/dist/lib/mcp/error-formatter.js +53 -0
- package/dist/lib/mcp/index.js +114 -0
- package/dist/lib/mcp/init-arg-utils.js +78 -0
- package/dist/lib/mcp/inject-report-html-plugin.js +98 -0
- package/dist/lib/mcp/launcher-helper.js +86 -0
- package/dist/lib/mcp/tool-generator.js +456 -0
- package/dist/lib/mcp/types.js +40 -0
- package/dist/lib/node/fs.js +97 -0
- package/dist/lib/node/index.js +65 -0
- package/dist/lib/node/port.js +61 -0
- package/dist/lib/polyfills/async-hooks.js +36 -0
- package/dist/lib/polyfills/index.js +58 -0
- package/dist/lib/types/index.js +37 -0
- package/dist/lib/us-keyboard-layout.js +1457 -0
- package/dist/lib/us-keyboard-layout.js.LICENSE.txt +5 -0
- package/dist/lib/utils.js +148 -0
- package/dist/lib/zod-schema-utils.js +97 -0
- package/dist/types/baseDB.d.ts +25 -0
- package/dist/types/cli/cli-args.d.ts +8 -0
- package/dist/types/cli/cli-error.d.ts +5 -0
- package/dist/types/cli/cli-runner.d.ts +19 -0
- package/dist/types/cli/index.d.ts +4 -0
- package/dist/types/common.d.ts +12 -0
- package/dist/types/constants/example-code.d.ts +2 -0
- package/dist/types/constants/index.d.ts +61 -0
- package/dist/types/env/basic.d.ts +6 -0
- package/dist/types/env/constants.d.ts +50 -0
- package/dist/types/env/global-config-manager.d.ts +32 -0
- package/dist/types/env/helper.d.ts +4 -0
- package/dist/types/env/index.d.ts +4 -0
- package/dist/types/env/init-debug.d.ts +1 -0
- package/dist/types/env/model-config-manager.d.ts +25 -0
- package/dist/types/env/parse-model-config.d.ts +31 -0
- package/dist/types/env/types.d.ts +339 -0
- package/dist/types/env/utils.d.ts +7 -0
- package/dist/types/extractor/constants.d.ts +1 -0
- package/dist/types/extractor/cs_postmessage.d.ts +2 -0
- package/dist/types/extractor/customLocator.d.ts +69 -0
- package/dist/types/extractor/debug.d.ts +1 -0
- package/dist/types/extractor/dom-util.d.ts +57 -0
- package/dist/types/extractor/index.d.ts +33 -0
- package/dist/types/extractor/locator.d.ts +9 -0
- package/dist/types/extractor/tree.d.ts +6 -0
- package/dist/types/extractor/util.d.ts +47 -0
- package/dist/types/extractor/web-extractor.d.ts +24 -0
- package/dist/types/img/box-select.d.ts +26 -0
- package/dist/types/img/canvas-fallback.d.ts +105 -0
- package/dist/types/img/get-photon.d.ts +19 -0
- package/dist/types/img/get-sharp.d.ts +3 -0
- package/dist/types/img/index.d.ts +3 -0
- package/dist/types/img/info.d.ts +34 -0
- package/dist/types/img/transform.d.ts +98 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/key-alias-utils.d.ts +9 -0
- package/dist/types/logger.d.ts +5 -0
- package/dist/types/mcp/base-server.d.ts +93 -0
- package/dist/types/mcp/base-tools.d.ts +148 -0
- package/dist/types/mcp/chrome-path.d.ts +2 -0
- package/dist/types/mcp/cli-report-session.d.ts +12 -0
- package/dist/types/mcp/error-formatter.d.ts +12 -0
- package/dist/types/mcp/index.d.ts +9 -0
- package/dist/types/mcp/init-arg-utils.d.ts +13 -0
- package/dist/types/mcp/inject-report-html-plugin.d.ts +18 -0
- package/dist/types/mcp/launcher-helper.d.ts +94 -0
- package/dist/types/mcp/tool-generator.d.ts +10 -0
- package/dist/types/mcp/types.d.ts +113 -0
- package/dist/types/node/fs.d.ts +15 -0
- package/dist/types/node/index.d.ts +2 -0
- package/dist/types/node/port.d.ts +8 -0
- package/dist/types/polyfills/async-hooks.d.ts +6 -0
- package/dist/types/polyfills/index.d.ts +4 -0
- package/dist/types/types/index.d.ts +36 -0
- package/dist/types/us-keyboard-layout.d.ts +32 -0
- package/dist/types/utils.d.ts +34 -0
- package/dist/types/zod-schema-utils.d.ts +23 -0
- package/package.json +125 -0
- package/src/baseDB.ts +158 -0
- package/src/cli/cli-args.ts +173 -0
- package/src/cli/cli-error.ts +24 -0
- package/src/cli/cli-runner.ts +230 -0
- package/src/cli/index.ts +4 -0
- package/src/common.ts +67 -0
- package/src/constants/example-code.ts +227 -0
- package/src/constants/index.ts +139 -0
- package/src/env/basic.ts +12 -0
- package/src/env/constants.ts +303 -0
- package/src/env/global-config-manager.ts +191 -0
- package/src/env/helper.ts +58 -0
- package/src/env/index.ts +4 -0
- package/src/env/init-debug.ts +34 -0
- package/src/env/model-config-manager.ts +149 -0
- package/src/env/parse-model-config.ts +357 -0
- package/src/env/types.ts +583 -0
- package/src/env/utils.ts +39 -0
- package/src/extractor/constants.ts +5 -0
- package/src/extractor/cs_postmessage.ts +136 -0
- package/src/extractor/customLocator.ts +1245 -0
- package/src/extractor/debug.ts +10 -0
- package/src/extractor/dom-util.ts +231 -0
- package/src/extractor/index.ts +50 -0
- package/src/extractor/locator.ts +469 -0
- package/src/extractor/tree.ts +179 -0
- package/src/extractor/util.ts +482 -0
- package/src/extractor/web-extractor.ts +617 -0
- package/src/img/box-select.ts +588 -0
- package/src/img/canvas-fallback.ts +393 -0
- package/src/img/get-photon.ts +108 -0
- package/src/img/get-sharp.ts +18 -0
- package/src/img/index.ts +27 -0
- package/src/img/info.ts +102 -0
- package/src/img/transform.ts +553 -0
- package/src/index.ts +1 -0
- package/src/key-alias-utils.ts +23 -0
- package/src/logger.ts +96 -0
- package/src/mcp/base-server.ts +500 -0
- package/src/mcp/base-tools.ts +391 -0
- package/src/mcp/chrome-path.ts +48 -0
- package/src/mcp/cli-report-session.ts +130 -0
- package/src/mcp/error-formatter.ts +52 -0
- package/src/mcp/index.ts +9 -0
- package/src/mcp/init-arg-utils.ts +105 -0
- package/src/mcp/inject-report-html-plugin.ts +119 -0
- package/src/mcp/launcher-helper.ts +200 -0
- package/src/mcp/tool-generator.ts +658 -0
- package/src/mcp/types.ts +131 -0
- package/src/node/fs.ts +84 -0
- package/src/node/index.ts +2 -0
- package/src/node/port.ts +37 -0
- package/src/polyfills/async-hooks.ts +6 -0
- package/src/polyfills/index.ts +4 -0
- package/src/types/index.ts +54 -0
- package/src/us-keyboard-layout.ts +723 -0
- package/src/utils.ts +149 -0
- package/src/zod-schema-utils.ts +133 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createCliReportSession: ()=>createCliReportSession,
|
|
28
|
+
generateCliReportSession: ()=>generateCliReportSession,
|
|
29
|
+
readCliReportSession: ()=>readCliReportSession,
|
|
30
|
+
writeCliReportSession: ()=>writeCliReportSession
|
|
31
|
+
});
|
|
32
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
33
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
34
|
+
const external_common_js_namespaceObject = require("../common.js");
|
|
35
|
+
const sessionDirName = 'cli-report-session';
|
|
36
|
+
function sanitizeSessionName(sessionName) {
|
|
37
|
+
return sessionName.replace(/[^a-zA-Z0-9._-]/g, '_') || 'default';
|
|
38
|
+
}
|
|
39
|
+
function sanitizeFileSegment(segment) {
|
|
40
|
+
const sanitized = segment.replace(/[^a-zA-Z0-9._-]/g, '_') || 'unknown';
|
|
41
|
+
return sanitized.slice(0, 80);
|
|
42
|
+
}
|
|
43
|
+
function ensureHtmlFileName(reportFileName) {
|
|
44
|
+
return reportFileName.endsWith('.html') ? reportFileName : `${reportFileName}.html`;
|
|
45
|
+
}
|
|
46
|
+
function formatDateForFileName(date) {
|
|
47
|
+
const pad = (value)=>String(value).padStart(2, '0');
|
|
48
|
+
const day = [
|
|
49
|
+
date.getFullYear(),
|
|
50
|
+
pad(date.getMonth() + 1),
|
|
51
|
+
pad(date.getDate())
|
|
52
|
+
].join('-');
|
|
53
|
+
const time = [
|
|
54
|
+
pad(date.getHours()),
|
|
55
|
+
pad(date.getMinutes()),
|
|
56
|
+
pad(date.getSeconds())
|
|
57
|
+
].join('-');
|
|
58
|
+
return `${day}_${time}`;
|
|
59
|
+
}
|
|
60
|
+
function randomId() {
|
|
61
|
+
return Math.random().toString(36).slice(2, 10);
|
|
62
|
+
}
|
|
63
|
+
function getCliReportSessionDir() {
|
|
64
|
+
const dir = (0, external_node_path_namespaceObject.join)((0, external_common_js_namespaceObject.getMidsceneRunBaseDir)(), sessionDirName);
|
|
65
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(dir)) (0, external_node_fs_namespaceObject.mkdirSync)(dir, {
|
|
66
|
+
recursive: true
|
|
67
|
+
});
|
|
68
|
+
return dir;
|
|
69
|
+
}
|
|
70
|
+
function getCliReportSessionPath(sessionName) {
|
|
71
|
+
return (0, external_node_path_namespaceObject.join)(getCliReportSessionDir(), `${sanitizeSessionName(sessionName)}.json`);
|
|
72
|
+
}
|
|
73
|
+
function generateCliReportSession(sessionName, targetIdentity) {
|
|
74
|
+
const identitySegment = targetIdentity ? `-${sanitizeFileSegment(targetIdentity)}` : '';
|
|
75
|
+
const reportFileName = `${sanitizeSessionName(sessionName)}${identitySegment}-${formatDateForFileName(new Date())}-${randomId()}`;
|
|
76
|
+
const reportPath = (0, external_node_path_namespaceObject.join)((0, external_common_js_namespaceObject.getMidsceneRunSubDir)('report'), ensureHtmlFileName(reportFileName));
|
|
77
|
+
const session = {
|
|
78
|
+
version: 1,
|
|
79
|
+
sessionName,
|
|
80
|
+
...targetIdentity ? {
|
|
81
|
+
targetIdentity
|
|
82
|
+
} : {},
|
|
83
|
+
reportFileName,
|
|
84
|
+
reportPath,
|
|
85
|
+
createdAt: Date.now()
|
|
86
|
+
};
|
|
87
|
+
return session;
|
|
88
|
+
}
|
|
89
|
+
function writeCliReportSession(session) {
|
|
90
|
+
(0, external_node_fs_namespaceObject.writeFileSync)(getCliReportSessionPath(session.sessionName), JSON.stringify(session, null, 2), 'utf-8');
|
|
91
|
+
}
|
|
92
|
+
function createCliReportSession(sessionName, targetIdentity) {
|
|
93
|
+
const session = generateCliReportSession(sessionName, targetIdentity);
|
|
94
|
+
writeCliReportSession(session);
|
|
95
|
+
return session;
|
|
96
|
+
}
|
|
97
|
+
function readCliReportSession(sessionName) {
|
|
98
|
+
const sessionPath = getCliReportSessionPath(sessionName);
|
|
99
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(sessionPath)) return;
|
|
100
|
+
try {
|
|
101
|
+
const raw = (0, external_node_fs_namespaceObject.readFileSync)(sessionPath, 'utf-8');
|
|
102
|
+
const parsed = JSON.parse(raw);
|
|
103
|
+
if (1 !== parsed.version || parsed.sessionName !== sessionName || 'string' != typeof parsed.reportFileName || !parsed.reportFileName.trim() || /[\\/]/.test(parsed.reportFileName)) return;
|
|
104
|
+
return parsed;
|
|
105
|
+
} catch {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.createCliReportSession = __webpack_exports__.createCliReportSession;
|
|
110
|
+
exports.generateCliReportSession = __webpack_exports__.generateCliReportSession;
|
|
111
|
+
exports.readCliReportSession = __webpack_exports__.readCliReportSession;
|
|
112
|
+
exports.writeCliReportSession = __webpack_exports__.writeCliReportSession;
|
|
113
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
114
|
+
"createCliReportSession",
|
|
115
|
+
"generateCliReportSession",
|
|
116
|
+
"readCliReportSession",
|
|
117
|
+
"writeCliReportSession"
|
|
118
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
119
|
+
Object.defineProperty(exports, '__esModule', {
|
|
120
|
+
value: true
|
|
121
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
getErrorMessage: ()=>getErrorMessage
|
|
28
|
+
});
|
|
29
|
+
function getErrorMessage(error) {
|
|
30
|
+
if (error instanceof Error) return error.message;
|
|
31
|
+
if (null == error) return String(error);
|
|
32
|
+
if ('object' != typeof error) return String(error);
|
|
33
|
+
const candidate = extractStringMessage(error);
|
|
34
|
+
if (candidate) return candidate;
|
|
35
|
+
try {
|
|
36
|
+
return JSON.stringify(error);
|
|
37
|
+
} catch {
|
|
38
|
+
return Object.prototype.toString.call(error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function extractStringMessage(error) {
|
|
42
|
+
const anyError = error;
|
|
43
|
+
if ('string' == typeof anyError.message && anyError.message) return anyError.message;
|
|
44
|
+
if (anyError.error && 'string' == typeof anyError.error.message && anyError.error.message) return anyError.error.message;
|
|
45
|
+
if (anyError.cause && 'string' == typeof anyError.cause.message && anyError.cause.message) return anyError.cause.message;
|
|
46
|
+
}
|
|
47
|
+
exports.getErrorMessage = __webpack_exports__.getErrorMessage;
|
|
48
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
49
|
+
"getErrorMessage"
|
|
50
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./base-server" (module) {
|
|
4
|
+
module.exports = require("./base-server.js");
|
|
5
|
+
},
|
|
6
|
+
"./base-tools" (module) {
|
|
7
|
+
module.exports = require("./base-tools.js");
|
|
8
|
+
},
|
|
9
|
+
"./chrome-path" (module) {
|
|
10
|
+
module.exports = require("./chrome-path.js");
|
|
11
|
+
},
|
|
12
|
+
"./error-formatter" (module) {
|
|
13
|
+
module.exports = require("./error-formatter.js");
|
|
14
|
+
},
|
|
15
|
+
"./init-arg-utils" (module) {
|
|
16
|
+
module.exports = require("./init-arg-utils.js");
|
|
17
|
+
},
|
|
18
|
+
"./inject-report-html-plugin" (module) {
|
|
19
|
+
module.exports = require("./inject-report-html-plugin.js");
|
|
20
|
+
},
|
|
21
|
+
"./launcher-helper" (module) {
|
|
22
|
+
module.exports = require("./launcher-helper.js");
|
|
23
|
+
},
|
|
24
|
+
"./tool-generator" (module) {
|
|
25
|
+
module.exports = require("./tool-generator.js");
|
|
26
|
+
},
|
|
27
|
+
"./types" (module) {
|
|
28
|
+
module.exports = require("./types.js");
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var __webpack_module_cache__ = {};
|
|
32
|
+
function __webpack_require__(moduleId) {
|
|
33
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
34
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
35
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
36
|
+
exports: {}
|
|
37
|
+
};
|
|
38
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
39
|
+
return module.exports;
|
|
40
|
+
}
|
|
41
|
+
(()=>{
|
|
42
|
+
__webpack_require__.n = (module)=>{
|
|
43
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
44
|
+
__webpack_require__.d(getter, {
|
|
45
|
+
a: getter
|
|
46
|
+
});
|
|
47
|
+
return getter;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
(()=>{
|
|
51
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
52
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: definition[key]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
})();
|
|
58
|
+
(()=>{
|
|
59
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
60
|
+
})();
|
|
61
|
+
(()=>{
|
|
62
|
+
__webpack_require__.r = (exports1)=>{
|
|
63
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
64
|
+
value: 'Module'
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
67
|
+
value: true
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
})();
|
|
71
|
+
var __webpack_exports__ = {};
|
|
72
|
+
(()=>{
|
|
73
|
+
__webpack_require__.r(__webpack_exports__);
|
|
74
|
+
var _base_server__rspack_import_0 = __webpack_require__("./base-server");
|
|
75
|
+
var __rspack_reexport = {};
|
|
76
|
+
for(const __rspack_import_key in _base_server__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_base_server__rspack_import_0[__rspack_import_key];
|
|
77
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
78
|
+
var _base_tools__rspack_import_1 = __webpack_require__("./base-tools");
|
|
79
|
+
var __rspack_reexport = {};
|
|
80
|
+
for(const __rspack_import_key in _base_tools__rspack_import_1)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_base_tools__rspack_import_1[__rspack_import_key];
|
|
81
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
82
|
+
var _init_arg_utils__rspack_import_2 = __webpack_require__("./init-arg-utils");
|
|
83
|
+
var __rspack_reexport = {};
|
|
84
|
+
for(const __rspack_import_key in _init_arg_utils__rspack_import_2)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_init_arg_utils__rspack_import_2[__rspack_import_key];
|
|
85
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
86
|
+
var _error_formatter__rspack_import_3 = __webpack_require__("./error-formatter");
|
|
87
|
+
var __rspack_reexport = {};
|
|
88
|
+
for(const __rspack_import_key in _error_formatter__rspack_import_3)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_error_formatter__rspack_import_3[__rspack_import_key];
|
|
89
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
90
|
+
var _tool_generator__rspack_import_4 = __webpack_require__("./tool-generator");
|
|
91
|
+
var __rspack_reexport = {};
|
|
92
|
+
for(const __rspack_import_key in _tool_generator__rspack_import_4)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_tool_generator__rspack_import_4[__rspack_import_key];
|
|
93
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
94
|
+
var _types__rspack_import_5 = __webpack_require__("./types");
|
|
95
|
+
var __rspack_reexport = {};
|
|
96
|
+
for(const __rspack_import_key in _types__rspack_import_5)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_5[__rspack_import_key];
|
|
97
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
98
|
+
var _inject_report_html_plugin__rspack_import_6 = __webpack_require__("./inject-report-html-plugin");
|
|
99
|
+
var __rspack_reexport = {};
|
|
100
|
+
for(const __rspack_import_key in _inject_report_html_plugin__rspack_import_6)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_inject_report_html_plugin__rspack_import_6[__rspack_import_key];
|
|
101
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
102
|
+
var _launcher_helper__rspack_import_7 = __webpack_require__("./launcher-helper");
|
|
103
|
+
var __rspack_reexport = {};
|
|
104
|
+
for(const __rspack_import_key in _launcher_helper__rspack_import_7)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_launcher_helper__rspack_import_7[__rspack_import_key];
|
|
105
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
106
|
+
var _chrome_path__rspack_import_8 = __webpack_require__("./chrome-path");
|
|
107
|
+
var __rspack_reexport = {};
|
|
108
|
+
for(const __rspack_import_key in _chrome_path__rspack_import_8)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_chrome_path__rspack_import_8[__rspack_import_key];
|
|
109
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
110
|
+
})();
|
|
111
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
112
|
+
Object.defineProperty(exports, '__esModule', {
|
|
113
|
+
value: true
|
|
114
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createNamespacedInitArgSchema: ()=>createNamespacedInitArgSchema,
|
|
28
|
+
extractNamespacedArgs: ()=>extractNamespacedArgs,
|
|
29
|
+
sanitizeNamespacedArgs: ()=>sanitizeNamespacedArgs
|
|
30
|
+
});
|
|
31
|
+
const external_key_alias_utils_js_namespaceObject = require("../key-alias-utils.js");
|
|
32
|
+
function readAliasedValue(args, key) {
|
|
33
|
+
for (const alias of (0, external_key_alias_utils_js_namespaceObject.getKeyAliases)(key))if (alias in args) return args[alias];
|
|
34
|
+
}
|
|
35
|
+
function readNamespacedArg(args, namespace, key) {
|
|
36
|
+
const namespacedArgs = readAliasedValue(args, namespace);
|
|
37
|
+
if ((0, external_key_alias_utils_js_namespaceObject.isRecord)(namespacedArgs)) {
|
|
38
|
+
const nestedValue = readAliasedValue(namespacedArgs, key);
|
|
39
|
+
if (void 0 !== nestedValue) return nestedValue;
|
|
40
|
+
}
|
|
41
|
+
const dottedValue = readAliasedValue(args, `${namespace}.${key}`);
|
|
42
|
+
if (void 0 !== dottedValue) return dottedValue;
|
|
43
|
+
const directValue = readAliasedValue(args, key);
|
|
44
|
+
if (void 0 !== directValue) return directValue;
|
|
45
|
+
}
|
|
46
|
+
function extractNamespacedArgs(args, namespace, keys) {
|
|
47
|
+
const extracted = {};
|
|
48
|
+
for (const key of keys){
|
|
49
|
+
const value = readNamespacedArg(args, namespace, key);
|
|
50
|
+
if (void 0 !== value) extracted[key] = value;
|
|
51
|
+
}
|
|
52
|
+
return Object.keys(extracted).length > 0 ? extracted : void 0;
|
|
53
|
+
}
|
|
54
|
+
function sanitizeNamespacedArgs(args, namespace, keys) {
|
|
55
|
+
const excludedKeys = new Set((0, external_key_alias_utils_js_namespaceObject.getKeyAliases)(namespace));
|
|
56
|
+
for (const key of keys){
|
|
57
|
+
for (const alias of (0, external_key_alias_utils_js_namespaceObject.getKeyAliases)(key))excludedKeys.add(alias);
|
|
58
|
+
for (const alias of (0, external_key_alias_utils_js_namespaceObject.getKeyAliases)(`${namespace}.${key}`))excludedKeys.add(alias);
|
|
59
|
+
}
|
|
60
|
+
return Object.fromEntries(Object.entries(args).filter(([key])=>!excludedKeys.has(key)));
|
|
61
|
+
}
|
|
62
|
+
function createNamespacedInitArgSchema(namespace, shape) {
|
|
63
|
+
return Object.fromEntries(Object.entries(shape).map(([key, value])=>[
|
|
64
|
+
`${namespace}.${key}`,
|
|
65
|
+
value
|
|
66
|
+
]));
|
|
67
|
+
}
|
|
68
|
+
exports.createNamespacedInitArgSchema = __webpack_exports__.createNamespacedInitArgSchema;
|
|
69
|
+
exports.extractNamespacedArgs = __webpack_exports__.extractNamespacedArgs;
|
|
70
|
+
exports.sanitizeNamespacedArgs = __webpack_exports__.sanitizeNamespacedArgs;
|
|
71
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
72
|
+
"createNamespacedInitArgSchema",
|
|
73
|
+
"extractNamespacedArgs",
|
|
74
|
+
"sanitizeNamespacedArgs"
|
|
75
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
76
|
+
Object.defineProperty(exports, '__esModule', {
|
|
77
|
+
value: true
|
|
78
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
injectReportHtmlFromCore: ()=>injectReportHtmlFromCore
|
|
37
|
+
});
|
|
38
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
39
|
+
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
40
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
41
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
42
|
+
const MAGIC_STRING = 'REPLACE_ME_WITH_REPORT_HTML';
|
|
43
|
+
const REPLACED_MARK = '/*REPORT_HTML_REPLACED*/';
|
|
44
|
+
const REG_EXP_FOR_REPLACE = /\/\*REPORT_HTML_REPLACED\*\/.*/;
|
|
45
|
+
function injectReportHtmlFromCore(packageDir) {
|
|
46
|
+
return {
|
|
47
|
+
name: 'inject-report-html-from-core',
|
|
48
|
+
setup (api) {
|
|
49
|
+
api.onAfterBuild(()=>{
|
|
50
|
+
const coreUtilsPath = external_node_path_default().resolve(packageDir, '..', 'core', 'dist', 'lib', 'utils.js');
|
|
51
|
+
if (!external_node_fs_default().existsSync(coreUtilsPath)) return void console.warn('[inject-report-html] @godscene/core dist not found, skipping');
|
|
52
|
+
const coreContent = external_node_fs_default().readFileSync(coreUtilsPath, 'utf-8');
|
|
53
|
+
if (!coreContent.includes(REPLACED_MARK)) return void console.warn('[inject-report-html] HTML not found in core dist. Ensure report builds first.');
|
|
54
|
+
const markerIndex = coreContent.indexOf(REPLACED_MARK);
|
|
55
|
+
const jsonStart = markerIndex + REPLACED_MARK.length;
|
|
56
|
+
let jsonEnd = jsonStart;
|
|
57
|
+
if ('"' === coreContent[jsonStart]) {
|
|
58
|
+
jsonEnd = jsonStart + 1;
|
|
59
|
+
while(jsonEnd < coreContent.length)if ('\\' === coreContent[jsonEnd]) jsonEnd += 2;
|
|
60
|
+
else if ('"' === coreContent[jsonEnd]) {
|
|
61
|
+
jsonEnd += 1;
|
|
62
|
+
break;
|
|
63
|
+
} else jsonEnd += 1;
|
|
64
|
+
}
|
|
65
|
+
const jsonString = coreContent.slice(jsonStart, jsonEnd);
|
|
66
|
+
if (!jsonString || jsonString.length < 10) return void console.warn('[inject-report-html] Failed to extract HTML from core');
|
|
67
|
+
const finalContent = `${REPLACED_MARK}${jsonString}`;
|
|
68
|
+
const distDir = external_node_path_default().join(packageDir, 'dist');
|
|
69
|
+
if (!external_node_fs_default().existsSync(distDir)) return;
|
|
70
|
+
const jsFiles = external_node_fs_default().readdirSync(distDir).filter((f)=>f.endsWith('.js'));
|
|
71
|
+
let injectedCount = 0;
|
|
72
|
+
for (const file of jsFiles){
|
|
73
|
+
const filePath = external_node_path_default().join(distDir, file);
|
|
74
|
+
const content = external_node_fs_default().readFileSync(filePath, 'utf-8');
|
|
75
|
+
if (content.includes(REPLACED_MARK)) {
|
|
76
|
+
if (REG_EXP_FOR_REPLACE.test(content)) {
|
|
77
|
+
external_node_fs_default().writeFileSync(filePath, content.replace(REG_EXP_FOR_REPLACE, ()=>finalContent));
|
|
78
|
+
console.log(`[inject-report-html] Updated: ${file}`);
|
|
79
|
+
injectedCount++;
|
|
80
|
+
}
|
|
81
|
+
} else if (content.includes(`'${MAGIC_STRING}'`)) {
|
|
82
|
+
external_node_fs_default().writeFileSync(filePath, content.replace(`'${MAGIC_STRING}'`, ()=>finalContent));
|
|
83
|
+
console.log(`[inject-report-html] Injected: ${file}`);
|
|
84
|
+
injectedCount++;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (injectedCount > 0) console.log(`[inject-report-html] Completed: ${injectedCount} file(s)`);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
exports.injectReportHtmlFromCore = __webpack_exports__.injectReportHtmlFromCore;
|
|
93
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
94
|
+
"injectReportHtmlFromCore"
|
|
95
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
96
|
+
Object.defineProperty(exports, '__esModule', {
|
|
97
|
+
value: true
|
|
98
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createMCPServerLauncher: ()=>createMCPServerLauncher
|
|
28
|
+
});
|
|
29
|
+
function createMCPServerLauncher(config) {
|
|
30
|
+
const { agent, platformName, ToolsManagerClass, MCPServerClass } = config;
|
|
31
|
+
function validateAgent() {
|
|
32
|
+
const device = agent.interface;
|
|
33
|
+
if (!device) throw new Error(`Agent must have an 'interface' property that references the underlying device.
|
|
34
|
+
Please ensure your agent instance is properly initialized with a device interface.
|
|
35
|
+
Expected: agent.interface to be defined, but got: ${typeof device}
|
|
36
|
+
Solution: Check that your agent constructor properly sets the interface property.`);
|
|
37
|
+
}
|
|
38
|
+
function createToolsManager() {
|
|
39
|
+
const toolsManager = new ToolsManagerClass();
|
|
40
|
+
toolsManager.agent = agent;
|
|
41
|
+
return toolsManager;
|
|
42
|
+
}
|
|
43
|
+
function logStartupInfo(mode, additionalInfo) {
|
|
44
|
+
const device = agent.interface;
|
|
45
|
+
console.log(`Starting Midscene ${platformName} MCP Server (${mode})...`);
|
|
46
|
+
console.log(`Agent: ${agent.constructor.name}`);
|
|
47
|
+
console.log(`Device: ${device.constructor.name}`);
|
|
48
|
+
if (additionalInfo?.port !== void 0) console.log(`Port: ${additionalInfo.port}`);
|
|
49
|
+
if (additionalInfo?.host) console.log(`Host: ${additionalInfo.host}`);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
async launch (options = {}) {
|
|
53
|
+
const { verbose = true } = options;
|
|
54
|
+
validateAgent();
|
|
55
|
+
if (verbose) logStartupInfo('stdio');
|
|
56
|
+
const toolsManager = createToolsManager();
|
|
57
|
+
const server = new MCPServerClass(toolsManager);
|
|
58
|
+
const result = await server.launch();
|
|
59
|
+
if (verbose) console.log(`${platformName} MCP Server started (stdio mode)`);
|
|
60
|
+
return result;
|
|
61
|
+
},
|
|
62
|
+
async launchHttp (options) {
|
|
63
|
+
const { port, host = 'localhost', verbose = true } = options;
|
|
64
|
+
validateAgent();
|
|
65
|
+
if (verbose) logStartupInfo('HTTP', {
|
|
66
|
+
port,
|
|
67
|
+
host
|
|
68
|
+
});
|
|
69
|
+
const toolsManager = createToolsManager();
|
|
70
|
+
const server = new MCPServerClass(toolsManager);
|
|
71
|
+
const result = await server.launchHttp({
|
|
72
|
+
port,
|
|
73
|
+
host
|
|
74
|
+
});
|
|
75
|
+
if (verbose) console.log(`${platformName} MCP Server started on http://${result.host}:${result.port}/mcp`);
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
exports.createMCPServerLauncher = __webpack_exports__.createMCPServerLauncher;
|
|
81
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
82
|
+
"createMCPServerLauncher"
|
|
83
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
84
|
+
Object.defineProperty(exports, '__esModule', {
|
|
85
|
+
value: true
|
|
86
|
+
});
|