@reconcrap/boss-recommend-mcp 2.0.49 → 2.0.51
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 +1 -1
- package/src/cli.js +68 -44
- package/src/core/browser/index.js +629 -23
- package/src/domains/chat/jobs.js +28 -0
- package/src/domains/chat/page-guard.js +25 -1
- package/src/domains/chat/run-service.js +4 -2
- package/src/domains/common/recovery-settle.js +159 -0
- package/src/domains/recommend/jobs.js +169 -5
- package/src/domains/recommend/refresh.js +68 -4
- package/src/domains/recommend/run-service.js +40 -9
- package/src/domains/recruit/refresh.js +1 -0
- package/src/domains/recruit/run-service.js +8 -0
- package/src/domains/recruit/search.js +52 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -7,10 +7,10 @@ import { createRequire } from "node:module";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import {
|
|
9
9
|
assertNoForbiddenCdpCalls,
|
|
10
|
-
buildBossChromeLaunchArgs,
|
|
11
10
|
bringPageToFront,
|
|
12
11
|
connectToChromeTarget,
|
|
13
12
|
enableDomains,
|
|
13
|
+
ensureChromeDebugPort,
|
|
14
14
|
getDocumentRoot,
|
|
15
15
|
querySelector,
|
|
16
16
|
sleep as sleepMs
|
|
@@ -2209,51 +2209,38 @@ async function launchChrome(options = {}) {
|
|
|
2209
2209
|
const port = parsePositivePort(options.port) || parsePositivePort(process.env.BOSS_RECOMMEND_CHROME_PORT) || 9222;
|
|
2210
2210
|
process.env.BOSS_RECOMMEND_CHROME_PORT = String(port);
|
|
2211
2211
|
const timing = getLaunchChromeTiming(options);
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
inspectTimeoutMs: timing.inspectTimeoutMs,
|
|
2222
|
-
pollMs: timing.pollMs,
|
|
2223
|
-
settleMs: timing.settleMs
|
|
2212
|
+
const userDataDir = getChromeUserDataDir(port);
|
|
2213
|
+
let chromeGuard = null;
|
|
2214
|
+
try {
|
|
2215
|
+
chromeGuard = await ensureChromeDebugPort({
|
|
2216
|
+
port,
|
|
2217
|
+
url: bossUrl,
|
|
2218
|
+
slowLive: Boolean(options["slow-live"] || options.slowLive),
|
|
2219
|
+
launchIfMissing: true,
|
|
2220
|
+
userDataDir
|
|
2224
2221
|
});
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
console.log(`CDP methods: ${frontResult.method_log.join(", ") || "none"}`);
|
|
2230
|
-
}
|
|
2231
|
-
} else {
|
|
2232
|
-
console.log(pageState.page_state?.message || "Boss recommend page is not ready.");
|
|
2222
|
+
} catch (error) {
|
|
2223
|
+
console.error(error?.message || String(error || "Chrome launch failed"));
|
|
2224
|
+
if (error?.chrome_guard) {
|
|
2225
|
+
console.error(JSON.stringify(error.chrome_guard, null, 2));
|
|
2233
2226
|
}
|
|
2234
|
-
return;
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
const chromePath = getChromeExecutable();
|
|
2238
|
-
if (!chromePath) {
|
|
2239
|
-
console.error("Chrome executable not found. Set BOSS_RECOMMEND_CHROME_PATH or install Google Chrome.");
|
|
2240
2227
|
process.exitCode = 1;
|
|
2241
2228
|
return;
|
|
2242
2229
|
}
|
|
2243
2230
|
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2231
|
+
if (chromeGuard.replaced) {
|
|
2232
|
+
console.log(`Replaced Chrome debug instance on port ${port} because required flags were missing: ${chromeGuard.missing_flags.join(", ")}`);
|
|
2233
|
+
} else if (chromeGuard.launched) {
|
|
2234
|
+
console.log(`Chrome launched with remote debugging port ${port}`);
|
|
2235
|
+
} else {
|
|
2236
|
+
console.log(`Reusing existing Chrome debug instance on port ${port} with required flags`);
|
|
2237
|
+
}
|
|
2238
|
+
console.log(`User data dir: ${chromeGuard.user_data_dir || userDataDir}`);
|
|
2239
|
+
if (chromeGuard.launched || chromeGuard.replaced) {
|
|
2240
|
+
await sleepMs(timing.settleMs + 1200);
|
|
2241
|
+
}
|
|
2255
2242
|
const pageState = await ensureBossRecommendPageReadyCdp(port, {
|
|
2256
|
-
attempts: 6,
|
|
2243
|
+
attempts: chromeGuard.launched || chromeGuard.replaced ? 6 : 2,
|
|
2257
2244
|
inspectTimeoutMs: timing.inspectTimeoutMs,
|
|
2258
2245
|
pollMs: timing.pollMs,
|
|
2259
2246
|
settleMs: timing.settleMs
|
|
@@ -2382,15 +2369,30 @@ async function printDoctor(options = {}) {
|
|
|
2382
2369
|
const configResolution = getBossScreenConfigResolution(workspaceRoot);
|
|
2383
2370
|
const calibrationResolution = getFeaturedCalibrationResolutionLocal(workspaceRoot);
|
|
2384
2371
|
const timing = getLaunchChromeTiming(options);
|
|
2372
|
+
const slowLive = Boolean(options["slow-live"] || options.slowLive);
|
|
2373
|
+
let chromeGuard = null;
|
|
2374
|
+
let chromeGuardError = null;
|
|
2375
|
+
try {
|
|
2376
|
+
chromeGuard = await ensureChromeDebugPort({
|
|
2377
|
+
port,
|
|
2378
|
+
url: bossUrl,
|
|
2379
|
+
slowLive,
|
|
2380
|
+
launchIfMissing: true,
|
|
2381
|
+
userDataDir: getChromeUserDataDir(port)
|
|
2382
|
+
});
|
|
2383
|
+
} catch (error) {
|
|
2384
|
+
chromeGuardError = error;
|
|
2385
|
+
chromeGuard = error?.chrome_guard || null;
|
|
2386
|
+
}
|
|
2385
2387
|
let pageState = await inspectBossRecommendPageStateCdp(port, {
|
|
2386
|
-
timeoutMs:
|
|
2387
|
-
pollMs:
|
|
2388
|
+
timeoutMs: slowLive ? timing.initialTimeoutMs : 2000,
|
|
2389
|
+
pollMs: slowLive ? timing.pollMs : 500
|
|
2388
2390
|
});
|
|
2389
2391
|
if (pageState.state === "RECOMMEND_READY") {
|
|
2390
2392
|
pageState = await verifyRecommendPageStableCdp(port, {
|
|
2391
|
-
settleMs:
|
|
2392
|
-
recheckTimeoutMs:
|
|
2393
|
-
pollMs:
|
|
2393
|
+
settleMs: slowLive ? timing.settleMs : 800,
|
|
2394
|
+
recheckTimeoutMs: slowLive ? timing.inspectTimeoutMs : 3000,
|
|
2395
|
+
pollMs: slowLive ? timing.pollMs : 500
|
|
2394
2396
|
});
|
|
2395
2397
|
}
|
|
2396
2398
|
const resolvedConfigPath = configResolution.resolved_path || configResolution.writable_path;
|
|
@@ -2407,6 +2409,28 @@ async function printDoctor(options = {}) {
|
|
|
2407
2409
|
? `检测到配置文件(resolved_path):${resolvedConfigPath}`
|
|
2408
2410
|
: "用户配置不存在(可通过 `boss-recommend-mcp init-config` 创建模板,或 `boss-recommend-mcp config set` 写入真实值)"
|
|
2409
2411
|
});
|
|
2412
|
+
const requiredFlags = chromeGuard?.required_flags || [];
|
|
2413
|
+
const missingFlags = chromeGuard?.missing_flags || [];
|
|
2414
|
+
const chromeFlagsOk = Boolean(chromeGuard && !chromeGuardError && chromeGuard.required_flags_ok);
|
|
2415
|
+
checks.push({
|
|
2416
|
+
key: "chrome_required_flags",
|
|
2417
|
+
ok: chromeFlagsOk,
|
|
2418
|
+
path: `http://localhost:${port}`,
|
|
2419
|
+
required_flags: requiredFlags,
|
|
2420
|
+
missing_flags: missingFlags,
|
|
2421
|
+
replaced: Boolean(chromeGuard?.replaced),
|
|
2422
|
+
close_method: chromeGuard?.close_method || null,
|
|
2423
|
+
relaunch: chromeGuard?.relaunch || null,
|
|
2424
|
+
message: chromeFlagsOk
|
|
2425
|
+
? chromeGuard?.replaced
|
|
2426
|
+
? `Chrome 调试端口 ${port} 原实例缺少必需 flags,已自动关闭并用正确 flags 重新启动。`
|
|
2427
|
+
: chromeGuard?.launched
|
|
2428
|
+
? `Chrome 调试端口 ${port} 已用必需 flags 启动。`
|
|
2429
|
+
: `Chrome 调试端口 ${port} 已确认包含必需 flags。`
|
|
2430
|
+
: chromeGuardError
|
|
2431
|
+
? `Chrome 必需 flags 检查失败:${chromeGuardError.message}`
|
|
2432
|
+
: `Chrome 调试端口 ${port} 未确认包含必需 flags。`
|
|
2433
|
+
});
|
|
2410
2434
|
checks.push({
|
|
2411
2435
|
key: "chrome_debug_port",
|
|
2412
2436
|
ok: pageState.state !== "DEBUG_PORT_UNREACHABLE",
|