@reconcrap/boss-recommend-mcp 1.1.10 → 1.1.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/package.json
CHANGED
|
@@ -36,6 +36,29 @@ function normalizeText(value) {
|
|
|
36
36
|
return String(value || "").replace(/\s+/g, " ").trim();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function sanitizeUrl(value) {
|
|
40
|
+
const raw = String(value || "").replace(/\s+/g, " ").trim();
|
|
41
|
+
const cleaned = raw
|
|
42
|
+
.replace(/^\uFEFF/, "")
|
|
43
|
+
.replace(/[\u200B-\u200F\u2028-\u202F\u2060-\u2064\uFEFF]/g, "")
|
|
44
|
+
.replace(/^["']|["']$/g, "");
|
|
45
|
+
return cleaned.replace(/\/+$/, "");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function validateUrlString(raw) {
|
|
49
|
+
const sanitized = sanitizeUrl(raw);
|
|
50
|
+
if (!sanitized) return { ok: false, error: "baseUrl 为空" };
|
|
51
|
+
try {
|
|
52
|
+
const url = new URL(sanitized);
|
|
53
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") {
|
|
54
|
+
return { ok: false, error: `协议无效: ${url.protocol} (期望 http 或 https)` };
|
|
55
|
+
}
|
|
56
|
+
return { ok: true, sanitized, full: sanitized };
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return { ok: false, error: `URL 格式无效: ${e.message}`, raw };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
39
62
|
function parsePositiveInteger(raw) {
|
|
40
63
|
const value = Number.parseInt(String(raw || ""), 10);
|
|
41
64
|
return Number.isFinite(value) && value > 0 ? value : null;
|
|
@@ -1487,6 +1510,13 @@ const jsReloadRecommendFrame = `(() => {
|
|
|
1487
1510
|
class RecommendScreenCli {
|
|
1488
1511
|
constructor(args) {
|
|
1489
1512
|
this.args = args;
|
|
1513
|
+
const baseUrlCheck = validateUrlString(this.args.baseUrl);
|
|
1514
|
+
if (this.args.baseUrl && !baseUrlCheck.ok) {
|
|
1515
|
+
log(`[警告] baseUrl 校验失败: ${baseUrlCheck.error}, 原始值=${JSON.stringify(this.args.baseUrl)}`);
|
|
1516
|
+
}
|
|
1517
|
+
if (baseUrlCheck.sanitized) {
|
|
1518
|
+
this.args.baseUrl = baseUrlCheck.sanitized;
|
|
1519
|
+
}
|
|
1490
1520
|
this.client = null;
|
|
1491
1521
|
this.Runtime = null;
|
|
1492
1522
|
this.Input = null;
|
|
@@ -1988,7 +2018,7 @@ class RecommendScreenCli {
|
|
|
1988
2018
|
async pressEsc() {
|
|
1989
2019
|
await this.Input.dispatchKeyEvent({ type: "keyDown", windowsVirtualKeyCode: 27, key: "Escape", code: "Escape" });
|
|
1990
2020
|
await this.Input.dispatchKeyEvent({ type: "keyUp", windowsVirtualKeyCode: 27, key: "Escape", code: "Escape" });
|
|
1991
|
-
}
|
|
2021
|
+
}
|
|
1992
2022
|
async ensureDetailOpen() {
|
|
1993
2023
|
for (let index = 0; index < 20; index += 1) {
|
|
1994
2024
|
const state = await this.evaluate(jsWaitForDetail);
|
|
@@ -2308,7 +2338,9 @@ class RecommendScreenCli {
|
|
|
2308
2338
|
|
|
2309
2339
|
async callVisionModel(imagePath) {
|
|
2310
2340
|
const imageBase64 = fs.readFileSync(imagePath, "base64");
|
|
2311
|
-
const
|
|
2341
|
+
const rawBaseUrl = this.args.baseUrl;
|
|
2342
|
+
log(`[callVisionModel] baseUrl 原始值类型=${typeof rawBaseUrl}, 长度=${rawBaseUrl != null ? String(rawBaseUrl).length : "null/undefined"}, JSON编码=${JSON.stringify(rawBaseUrl)}`);
|
|
2343
|
+
const baseUrl = String(rawBaseUrl || "").replace(/\/$/, "");
|
|
2312
2344
|
const payload = {
|
|
2313
2345
|
model: this.args.model,
|
|
2314
2346
|
temperature: 0.1,
|
|
@@ -2364,7 +2396,9 @@ class RecommendScreenCli {
|
|
|
2364
2396
|
|
|
2365
2397
|
async callTextModel(resumeText) {
|
|
2366
2398
|
const safeResumeText = String(resumeText || "").slice(0, 28000);
|
|
2367
|
-
const
|
|
2399
|
+
const rawBaseUrl = this.args.baseUrl;
|
|
2400
|
+
log(`[callTextModel] baseUrl 原始值类型=${typeof rawBaseUrl}, 长度=${rawBaseUrl != null ? String(rawBaseUrl).length : "null/undefined"}, JSON编码=${JSON.stringify(rawBaseUrl)}`);
|
|
2401
|
+
const baseUrl = String(rawBaseUrl || "").replace(/\/$/, "");
|
|
2368
2402
|
const payload = {
|
|
2369
2403
|
model: this.args.model,
|
|
2370
2404
|
temperature: 0.1,
|
|
@@ -3030,4 +3064,4 @@ if (require.main === module) {
|
|
|
3030
3064
|
}
|
|
3031
3065
|
};
|
|
3032
3066
|
}
|
|
3033
|
-
|
|
3067
|
+
|