ornold-mcp 1.0.2 → 1.0.3
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/dist/cli.js +373 -67
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2035,23 +2035,38 @@ var getArg = (name) => {
|
|
|
2035
2035
|
const i = args.indexOf(`--${name}`);
|
|
2036
2036
|
return i >= 0 ? args[i + 1] : void 0;
|
|
2037
2037
|
};
|
|
2038
|
-
|
|
2039
|
-
|
|
2038
|
+
var getArgAny = (...names) => names.map((name) => getArg(name)).find((value) => value !== void 0);
|
|
2039
|
+
var getEnvAny = (...names) => names.map((name) => process.env[name]).find((value) => value !== void 0 && value !== "");
|
|
2040
|
+
function getOptionalPort(argNames, envNames) {
|
|
2041
|
+
const raw = getArgAny(...Array.isArray(argNames) ? argNames : [argNames]) ?? getEnvAny(...Array.isArray(envNames) ? envNames : [envNames]);
|
|
2040
2042
|
if (raw === void 0 || raw === "") return void 0;
|
|
2041
2043
|
const port = Number.parseInt(raw, 10);
|
|
2042
2044
|
if (!Number.isFinite(port) || port <= 0) {
|
|
2043
|
-
|
|
2045
|
+
const flagName = Array.isArray(argNames) ? argNames[0] : argNames;
|
|
2046
|
+
console.error(`[ornold] Invalid --${flagName}: ${raw}`);
|
|
2044
2047
|
process.exit(1);
|
|
2045
2048
|
}
|
|
2046
2049
|
return port;
|
|
2047
2050
|
}
|
|
2051
|
+
function getOptionalString(argNames, envNames) {
|
|
2052
|
+
const raw = getArgAny(...Array.isArray(argNames) ? argNames : [argNames]) ?? getEnvAny(...Array.isArray(envNames) ? envNames : [envNames]);
|
|
2053
|
+
if (raw === void 0) return void 0;
|
|
2054
|
+
const value = raw.trim();
|
|
2055
|
+
return value === "" ? void 0 : value;
|
|
2056
|
+
}
|
|
2048
2057
|
var TOKEN = getArg("token") || process.env.ORNOLD_TOKEN || "";
|
|
2049
2058
|
var SERVER_URL = getArg("server") || process.env.ORNOLD_SERVER || "wss://ornold-mcp.fly.dev/bridge";
|
|
2050
2059
|
var LINKEN_PORT = getOptionalPort("linken-port", "LINKEN_PORT");
|
|
2060
|
+
var WADEX_PORT = getOptionalPort("wadex-port", "WADEX_PORT");
|
|
2051
2061
|
var DOLPHIN_PORT = getOptionalPort("dolphin-port", "DOLPHIN_PORT");
|
|
2062
|
+
var DOLPHIN_API_TOKEN = getOptionalString("dolphin-token", "DOLPHIN_API_TOKEN");
|
|
2063
|
+
var VISION_PORT = getOptionalPort(["vision-port", "vision-local-port"], ["VISION_PORT", "VISION_LOCAL_PORT"]);
|
|
2064
|
+
var VISION_TOKEN = getOptionalString(["vision-token", "vision-x-token"], ["VISION_TOKEN", "VISION_X_TOKEN"]);
|
|
2052
2065
|
var ENABLED_VENDORS = [
|
|
2053
2066
|
...LINKEN_PORT !== void 0 ? ["linken"] : [],
|
|
2054
|
-
...
|
|
2067
|
+
...WADEX_PORT !== void 0 ? ["wadex"] : [],
|
|
2068
|
+
...DOLPHIN_PORT !== void 0 || DOLPHIN_API_TOKEN !== void 0 ? ["dolphin"] : [],
|
|
2069
|
+
...VISION_TOKEN !== void 0 ? ["vision"] : []
|
|
2055
2070
|
];
|
|
2056
2071
|
function getPackageVersion() {
|
|
2057
2072
|
try {
|
|
@@ -2159,6 +2174,77 @@ function getSelectorTarget(params) {
|
|
|
2159
2174
|
}
|
|
2160
2175
|
return selector ? { selector } : { ref };
|
|
2161
2176
|
}
|
|
2177
|
+
function appendQueryValue(params, key, value) {
|
|
2178
|
+
if (value === void 0 || value === null) return;
|
|
2179
|
+
if (Array.isArray(value)) {
|
|
2180
|
+
for (const item of value) appendQueryValue(params, key, item);
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
if (typeof value === "object") {
|
|
2184
|
+
params.append(key, JSON.stringify(value));
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
params.append(key, String(value));
|
|
2188
|
+
}
|
|
2189
|
+
function withQuery(path2, query) {
|
|
2190
|
+
if (!query) return path2;
|
|
2191
|
+
const params = new URLSearchParams();
|
|
2192
|
+
for (const [key, value] of Object.entries(query)) {
|
|
2193
|
+
appendQueryValue(params, key, value);
|
|
2194
|
+
}
|
|
2195
|
+
const search = params.toString();
|
|
2196
|
+
return search ? `${path2}?${search}` : path2;
|
|
2197
|
+
}
|
|
2198
|
+
async function runVendorRequest(vendor, params) {
|
|
2199
|
+
const target = params.target === "local" ? "local" : "cloud";
|
|
2200
|
+
const path2 = typeof params.path === "string" ? params.path : "/";
|
|
2201
|
+
const method = typeof params.method === "string" ? params.method : "GET";
|
|
2202
|
+
const query = params.query && typeof params.query === "object" ? params.query : void 0;
|
|
2203
|
+
let url;
|
|
2204
|
+
const headers = {};
|
|
2205
|
+
if (vendor === "dolphin") {
|
|
2206
|
+
if (target === "cloud") {
|
|
2207
|
+
if (!DOLPHIN_API_TOKEN) {
|
|
2208
|
+
return { content: "DOLPHIN_API_TOKEN is not configured on this machine.", isError: true };
|
|
2209
|
+
}
|
|
2210
|
+
url = `https://dolphin-anty-api.com${withQuery(path2, query)}`;
|
|
2211
|
+
headers.Authorization = `Bearer ${DOLPHIN_API_TOKEN}`;
|
|
2212
|
+
} else {
|
|
2213
|
+
if (DOLPHIN_PORT === void 0) {
|
|
2214
|
+
return { content: "Dolphin local port is not configured on this machine.", isError: true };
|
|
2215
|
+
}
|
|
2216
|
+
url = `http://127.0.0.1:${DOLPHIN_PORT}${withQuery(path2, query)}`;
|
|
2217
|
+
}
|
|
2218
|
+
} else {
|
|
2219
|
+
if (!VISION_TOKEN) {
|
|
2220
|
+
return { content: "VISION_TOKEN is not configured on this machine.", isError: true };
|
|
2221
|
+
}
|
|
2222
|
+
headers["X-Token"] = VISION_TOKEN;
|
|
2223
|
+
if (target === "cloud") {
|
|
2224
|
+
url = `https://v1.empr.cloud/api/v1${withQuery(path2, query)}`;
|
|
2225
|
+
} else {
|
|
2226
|
+
if (VISION_PORT === void 0) {
|
|
2227
|
+
return { content: "Vision local port is not configured on this machine.", isError: true };
|
|
2228
|
+
}
|
|
2229
|
+
url = `http://127.0.0.1:${VISION_PORT}${withQuery(path2, query)}`;
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
if (params.body !== void 0) {
|
|
2233
|
+
headers["Content-Type"] = "application/json";
|
|
2234
|
+
}
|
|
2235
|
+
const resp = await fetch(url, {
|
|
2236
|
+
method,
|
|
2237
|
+
headers,
|
|
2238
|
+
body: params.body !== void 0 ? JSON.stringify(params.body) : void 0,
|
|
2239
|
+
signal: AbortSignal.timeout(3e4)
|
|
2240
|
+
});
|
|
2241
|
+
const data = await resp.text();
|
|
2242
|
+
try {
|
|
2243
|
+
return { content: JSON.stringify(JSON.parse(data)), isError: !resp.ok };
|
|
2244
|
+
} catch {
|
|
2245
|
+
return { content: data, isError: !resp.ok };
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2162
2248
|
async function handleExecuteCommand(msg) {
|
|
2163
2249
|
const { command, params } = msg;
|
|
2164
2250
|
try {
|
|
@@ -2417,6 +2503,10 @@ ${result.snapshot || ""}`;
|
|
|
2417
2503
|
return { content: data, isError: !resp.ok };
|
|
2418
2504
|
}
|
|
2419
2505
|
}
|
|
2506
|
+
case "dolphin_request":
|
|
2507
|
+
return await runVendorRequest("dolphin", params);
|
|
2508
|
+
case "vision_request":
|
|
2509
|
+
return await runVendorRequest("vision", params);
|
|
2420
2510
|
default:
|
|
2421
2511
|
return { content: `Unknown command: ${command}`, isError: true };
|
|
2422
2512
|
}
|
|
@@ -2443,95 +2533,302 @@ async function toolHandler(tool, args2) {
|
|
|
2443
2533
|
const result = await callServer(tool, args2);
|
|
2444
2534
|
return textResult(result.content, result.isError);
|
|
2445
2535
|
}
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2536
|
+
var sphereStatusArg = z.enum(["stopped", "running", "imported", "warmup", "automationRunning"]).optional();
|
|
2537
|
+
var sphereProxyTypeArg = z.enum(["notSet", "socks5", "http", "ssh", "liveSocks5", "liveHttp", "direct", "tor", "localhost", "freeProxy"]);
|
|
2538
|
+
var visionFolderIconArg = z.enum([
|
|
2539
|
+
"Cloud",
|
|
2540
|
+
"Google",
|
|
2541
|
+
"Facebook",
|
|
2542
|
+
"TikTok",
|
|
2543
|
+
"Amazon",
|
|
2544
|
+
"Bitcoin",
|
|
2545
|
+
"Meta",
|
|
2546
|
+
"PayPal",
|
|
2547
|
+
"Discord",
|
|
2548
|
+
"Twitter",
|
|
2549
|
+
"Vkontakte",
|
|
2550
|
+
"Youtube",
|
|
2551
|
+
"Tinder",
|
|
2552
|
+
"Onlyfans",
|
|
2553
|
+
"Threads"
|
|
2554
|
+
]);
|
|
2555
|
+
var visionFolderColorArg = z.enum([
|
|
2556
|
+
"#FFC1073D",
|
|
2557
|
+
"#C8E4FFCD",
|
|
2558
|
+
"#3366FF3D",
|
|
2559
|
+
"#54D62C3D",
|
|
2560
|
+
"#FF48423D",
|
|
2561
|
+
"#919EAB3D"
|
|
2562
|
+
]);
|
|
2563
|
+
var visionPlatformArg = z.enum(["macos", "windows", "linux"]);
|
|
2564
|
+
var visionProfilePlatformArg = z.enum(["Windows", "MacOS", "Linux", "windows", "macos", "linux"]);
|
|
2565
|
+
var visionBrowserArg = z.enum(["Chrome", "chrome"]);
|
|
2566
|
+
var visionProxyTypeArg = z.enum(["HTTP", "SOCKS4", "SOCKS5", "SSH", "http", "socks4", "socks5", "ssh"]);
|
|
2567
|
+
function registerSphereTools(server, prefix, label) {
|
|
2568
|
+
server.tool(`${prefix}_get_instances`, `Get list of ${label} sessions`, {
|
|
2569
|
+
status: sphereStatusArg,
|
|
2449
2570
|
proxy_info: z.boolean().optional()
|
|
2450
|
-
}, (args2) => toolHandler(
|
|
2451
|
-
server.tool(
|
|
2571
|
+
}, (args2) => toolHandler(`${prefix}_get_instances`, args2));
|
|
2572
|
+
server.tool(`${prefix}_create_quick_sessions`, `Create ${label} sessions`, {
|
|
2452
2573
|
count: z.number().optional()
|
|
2453
|
-
}, (args2) => toolHandler(
|
|
2454
|
-
server.tool(
|
|
2574
|
+
}, (args2) => toolHandler(`${prefix}_create_quick_sessions`, args2));
|
|
2575
|
+
server.tool(`${prefix}_start_instances`, `Start ${label} browser sessions`, {
|
|
2455
2576
|
uuids: z.array(z.string()),
|
|
2456
2577
|
headless: z.boolean().optional(),
|
|
2457
2578
|
debug_port: z.number().optional(),
|
|
2458
2579
|
_scope: z.string().optional()
|
|
2459
|
-
}, (args2) => toolHandler(
|
|
2460
|
-
server.tool(
|
|
2580
|
+
}, (args2) => toolHandler(`${prefix}_start_instances`, args2));
|
|
2581
|
+
server.tool(`${prefix}_stop_instances`, `Stop ${label} sessions`, {
|
|
2461
2582
|
uuids: z.array(z.string())
|
|
2462
|
-
}, (args2) => toolHandler(
|
|
2463
|
-
server.tool(
|
|
2583
|
+
}, (args2) => toolHandler(`${prefix}_stop_instances`, args2));
|
|
2584
|
+
server.tool(`${prefix}_session_info`, `Get ${label} session details`, {
|
|
2464
2585
|
uuid: z.string()
|
|
2465
|
-
}, (args2) => toolHandler(
|
|
2466
|
-
server.tool(
|
|
2586
|
+
}, (args2) => toolHandler(`${prefix}_session_info`, args2));
|
|
2587
|
+
server.tool(`${prefix}_force_stop`, `Force stop ${label} session`, {
|
|
2467
2588
|
uuid: z.string()
|
|
2468
|
-
}, (args2) => toolHandler(
|
|
2469
|
-
server.tool(
|
|
2589
|
+
}, (args2) => toolHandler(`${prefix}_force_stop`, args2));
|
|
2590
|
+
server.tool(`${prefix}_delete_sessions`, `Delete ${label} sessions`, {
|
|
2470
2591
|
uuid: z.string().optional(),
|
|
2471
2592
|
uuids: z.array(z.string()).optional()
|
|
2472
|
-
}, (args2) => toolHandler(
|
|
2473
|
-
server.tool(
|
|
2474
|
-
server.tool(
|
|
2593
|
+
}, (args2) => toolHandler(`${prefix}_delete_sessions`, args2));
|
|
2594
|
+
server.tool(`${prefix}_unlock_stopped_sessions`, `Unlock stopped ${label} sessions`, {}, () => toolHandler(`${prefix}_unlock_stopped_sessions`, {}));
|
|
2595
|
+
server.tool(`${prefix}_set_session_name`, `Rename ${label} session`, {
|
|
2475
2596
|
uuid: z.string(),
|
|
2476
2597
|
name: z.string()
|
|
2477
|
-
}, (args2) => toolHandler(
|
|
2478
|
-
server.tool(
|
|
2598
|
+
}, (args2) => toolHandler(`${prefix}_set_session_name`, args2));
|
|
2599
|
+
server.tool(`${prefix}_set_connection`, `Set proxy for ${label} session`, {
|
|
2479
2600
|
uuid: z.string(),
|
|
2480
|
-
type:
|
|
2601
|
+
type: sphereProxyTypeArg,
|
|
2481
2602
|
ip: z.string().optional(),
|
|
2482
2603
|
port: z.number().optional(),
|
|
2483
2604
|
login: z.string().optional(),
|
|
2484
2605
|
password: z.string().optional()
|
|
2485
|
-
}, (args2) => toolHandler(
|
|
2486
|
-
server.tool(
|
|
2606
|
+
}, (args2) => toolHandler(`${prefix}_set_connection`, args2));
|
|
2607
|
+
server.tool(`${prefix}_check_connection`, `Check proxy for ${label} session`, {
|
|
2487
2608
|
uuid: z.string()
|
|
2488
|
-
}, (args2) => toolHandler(
|
|
2489
|
-
server.tool(
|
|
2609
|
+
}, (args2) => toolHandler(`${prefix}_check_connection`, args2));
|
|
2610
|
+
server.tool(`${prefix}_set_geo`, `Set ${label} geolocation`, {
|
|
2490
2611
|
uuid: z.string(),
|
|
2491
2612
|
timezone: z.string().optional(),
|
|
2492
2613
|
language: z.string().optional(),
|
|
2493
2614
|
latitude: z.number().optional(),
|
|
2494
2615
|
longitude: z.number().optional()
|
|
2495
|
-
}, (args2) => toolHandler(
|
|
2496
|
-
server.tool(
|
|
2616
|
+
}, (args2) => toolHandler(`${prefix}_set_geo`, args2));
|
|
2617
|
+
server.tool(`${prefix}_set_useragent`, `Set ${label} user agent`, {
|
|
2497
2618
|
uuid: z.string(),
|
|
2498
2619
|
useragent: z.string()
|
|
2499
|
-
}, (args2) => toolHandler(
|
|
2500
|
-
server.tool(
|
|
2620
|
+
}, (args2) => toolHandler(`${prefix}_set_useragent`, args2));
|
|
2621
|
+
server.tool(`${prefix}_import_cookies`, `Import cookies into ${label} session`, {
|
|
2501
2622
|
uuid: z.string(),
|
|
2502
2623
|
file_path: z.string().optional(),
|
|
2503
2624
|
json: z.string().optional()
|
|
2504
|
-
}, (args2) => toolHandler(
|
|
2505
|
-
server.tool(
|
|
2625
|
+
}, (args2) => toolHandler(`${prefix}_import_cookies`, args2));
|
|
2626
|
+
server.tool(`${prefix}_export_cookies`, `Export cookies from ${label} sessions`, {
|
|
2506
2627
|
uuids: z.array(z.string()),
|
|
2507
2628
|
folder_path: z.string()
|
|
2508
|
-
}, (args2) => toolHandler(
|
|
2509
|
-
server.tool(
|
|
2629
|
+
}, (args2) => toolHandler(`${prefix}_export_cookies`, args2));
|
|
2630
|
+
server.tool(`${prefix}_start_warmup`, `Start ${label} session warmup`, {
|
|
2510
2631
|
uuid: z.string(),
|
|
2511
2632
|
url_count: z.number().optional(),
|
|
2512
2633
|
time_per_url: z.number().optional(),
|
|
2513
2634
|
view_depth: z.number().optional(),
|
|
2514
2635
|
urls: z.array(z.string()).optional()
|
|
2515
|
-
}, (args2) => toolHandler(
|
|
2516
|
-
server.tool(
|
|
2517
|
-
server.tool(
|
|
2636
|
+
}, (args2) => toolHandler(`${prefix}_start_warmup`, args2));
|
|
2637
|
+
server.tool(`${prefix}_get_providers`, `List ${label} providers`, {}, () => toolHandler(`${prefix}_get_providers`, {}));
|
|
2638
|
+
server.tool(`${prefix}_set_active_provider`, `Set active ${label} provider`, {
|
|
2518
2639
|
uuid: z.string()
|
|
2519
|
-
}, (args2) => toolHandler(
|
|
2520
|
-
server.tool(
|
|
2640
|
+
}, (args2) => toolHandler(`${prefix}_set_active_provider`, args2));
|
|
2641
|
+
server.tool(`${prefix}_delete_provider`, `Delete ${label} provider`, {
|
|
2521
2642
|
uuid: z.string()
|
|
2522
|
-
}, (args2) => toolHandler(
|
|
2523
|
-
server.tool(
|
|
2524
|
-
server.tool(
|
|
2643
|
+
}, (args2) => toolHandler(`${prefix}_delete_provider`, args2));
|
|
2644
|
+
server.tool(`${prefix}_get_desktops`, `List ${label} desktops`, {}, () => toolHandler(`${prefix}_get_desktops`, {}));
|
|
2645
|
+
server.tool(`${prefix}_create_desktop`, `Create ${label} desktop`, {
|
|
2525
2646
|
name: z.string(),
|
|
2526
2647
|
team_uuid: z.string().optional()
|
|
2527
|
-
}, (args2) => toolHandler(
|
|
2528
|
-
server.tool(
|
|
2648
|
+
}, (args2) => toolHandler(`${prefix}_create_desktop`, args2));
|
|
2649
|
+
server.tool(`${prefix}_set_active_desktop`, `Set active ${label} desktop`, {
|
|
2529
2650
|
uuid: z.string()
|
|
2530
|
-
}, (args2) => toolHandler(
|
|
2531
|
-
server.tool(
|
|
2651
|
+
}, (args2) => toolHandler(`${prefix}_set_active_desktop`, args2));
|
|
2652
|
+
server.tool(`${prefix}_delete_desktop`, `Delete ${label} desktop`, {
|
|
2532
2653
|
uuid: z.string()
|
|
2533
|
-
}, (args2) => toolHandler(
|
|
2534
|
-
server.tool(
|
|
2654
|
+
}, (args2) => toolHandler(`${prefix}_delete_desktop`, args2));
|
|
2655
|
+
server.tool(`${prefix}_optimize_storage`, `Optimize ${label} storage`, {}, () => toolHandler(`${prefix}_optimize_storage`, {}));
|
|
2656
|
+
}
|
|
2657
|
+
function registerDolphinTools(server) {
|
|
2658
|
+
if (DOLPHIN_API_TOKEN !== void 0) {
|
|
2659
|
+
server.tool("dolphin_get_profiles", "Get list of Dolphin Anty browser profiles", {
|
|
2660
|
+
limit: z.number().optional(),
|
|
2661
|
+
page: z.number().optional(),
|
|
2662
|
+
query: z.string().optional(),
|
|
2663
|
+
tags: z.array(z.string()).optional(),
|
|
2664
|
+
statuses: z.array(z.number()).optional(),
|
|
2665
|
+
mainWebsites: z.array(z.string()).optional()
|
|
2666
|
+
}, (args2) => toolHandler("dolphin_get_profiles", args2));
|
|
2667
|
+
}
|
|
2668
|
+
if (DOLPHIN_PORT !== void 0) {
|
|
2669
|
+
server.tool("dolphin_start_profile", "Start a Dolphin Anty browser profile", {
|
|
2670
|
+
profile_id: z.number(),
|
|
2671
|
+
headless: z.boolean().optional(),
|
|
2672
|
+
_scope: z.string().optional()
|
|
2673
|
+
}, (args2) => toolHandler("dolphin_start_profile", args2));
|
|
2674
|
+
server.tool("dolphin_stop_profile", "Stop a running Dolphin Anty browser profile", {
|
|
2675
|
+
profile_id: z.number()
|
|
2676
|
+
}, (args2) => toolHandler("dolphin_stop_profile", args2));
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
function registerVisionTools(server) {
|
|
2680
|
+
if (VISION_TOKEN === void 0) {
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
server.tool("vision_get_folders", "Get Vision Browser folders via Cloud API", {}, () => toolHandler("vision_get_folders", {}));
|
|
2684
|
+
server.tool("vision_create_folder", "Create a Vision Browser folder via Cloud API", {
|
|
2685
|
+
folder_name: z.string(),
|
|
2686
|
+
folder_icon: visionFolderIconArg,
|
|
2687
|
+
folder_color: visionFolderColorArg
|
|
2688
|
+
}, (args2) => toolHandler("vision_create_folder", args2));
|
|
2689
|
+
server.tool("vision_update_folder", "Update a Vision Browser folder via Cloud API", {
|
|
2690
|
+
folder_id: z.string(),
|
|
2691
|
+
folder_name: z.string().optional(),
|
|
2692
|
+
folder_icon: visionFolderIconArg.optional(),
|
|
2693
|
+
folder_color: visionFolderColorArg.optional()
|
|
2694
|
+
}, (args2) => toolHandler("vision_update_folder", args2));
|
|
2695
|
+
server.tool("vision_delete_folder", "Delete a Vision Browser folder via Cloud API", {
|
|
2696
|
+
folder_id: z.string()
|
|
2697
|
+
}, (args2) => toolHandler("vision_delete_folder", args2));
|
|
2698
|
+
server.tool("vision_get_profiles", "Get Vision Browser profiles from a specific folder via Cloud API", {
|
|
2699
|
+
folder_id: z.string(),
|
|
2700
|
+
name: z.string().optional(),
|
|
2701
|
+
pn: z.number().optional(),
|
|
2702
|
+
ps: z.number().optional()
|
|
2703
|
+
}, (args2) => toolHandler("vision_get_profiles", args2));
|
|
2704
|
+
server.tool("vision_get_profile", "Get a specific Vision Browser profile via Cloud API", {
|
|
2705
|
+
folder_id: z.string(),
|
|
2706
|
+
profile_id: z.string()
|
|
2707
|
+
}, (args2) => toolHandler("vision_get_profile", args2));
|
|
2708
|
+
server.tool("vision_get_fingerprint", "Get a Vision Browser fingerprint via Cloud API", {
|
|
2709
|
+
platform: visionPlatformArg,
|
|
2710
|
+
version: z.number().optional()
|
|
2711
|
+
}, (args2) => toolHandler("vision_get_fingerprint", args2));
|
|
2712
|
+
server.tool("vision_import_cookies", "Import cookies into a Vision Browser profile via Cloud API", {
|
|
2713
|
+
folder_id: z.string(),
|
|
2714
|
+
profile_id: z.string(),
|
|
2715
|
+
cookies: z.array(z.object({
|
|
2716
|
+
name: z.string(),
|
|
2717
|
+
value: z.string(),
|
|
2718
|
+
path: z.string(),
|
|
2719
|
+
domain: z.string(),
|
|
2720
|
+
expires: z.number().optional()
|
|
2721
|
+
}).passthrough())
|
|
2722
|
+
}, (args2) => toolHandler("vision_import_cookies", args2));
|
|
2723
|
+
server.tool("vision_get_cookies", "Get cookies from a Vision Browser profile via Cloud API", {
|
|
2724
|
+
folder_id: z.string(),
|
|
2725
|
+
profile_id: z.string()
|
|
2726
|
+
}, (args2) => toolHandler("vision_get_cookies", args2));
|
|
2727
|
+
server.tool("vision_create_profile", "Create a Vision Browser profile via Cloud API", {
|
|
2728
|
+
folder_id: z.string(),
|
|
2729
|
+
profile_name: z.string(),
|
|
2730
|
+
profile_notes: z.string().nullable().optional(),
|
|
2731
|
+
profile_tags: z.array(z.string()).optional(),
|
|
2732
|
+
new_profile_tags: z.array(z.string()).optional(),
|
|
2733
|
+
proxy_id: z.string().nullable().optional(),
|
|
2734
|
+
profile_status: z.array(z.string()).nullable().optional(),
|
|
2735
|
+
platform: visionProfilePlatformArg,
|
|
2736
|
+
browser: visionBrowserArg,
|
|
2737
|
+
fingerprint: z.object({
|
|
2738
|
+
webrtc_pref: z.unknown(),
|
|
2739
|
+
webgl_pref: z.unknown(),
|
|
2740
|
+
canvas_pref: z.unknown(),
|
|
2741
|
+
ports_protection: z.array(z.number())
|
|
2742
|
+
}).passthrough()
|
|
2743
|
+
}, (args2) => toolHandler("vision_create_profile", args2));
|
|
2744
|
+
server.tool("vision_update_profile", "Update a Vision Browser profile via Cloud API", {
|
|
2745
|
+
folder_id: z.string(),
|
|
2746
|
+
profile_id: z.string(),
|
|
2747
|
+
profile_name: z.string().optional(),
|
|
2748
|
+
profile_notes: z.string().optional(),
|
|
2749
|
+
profile_tags: z.array(z.string()).optional(),
|
|
2750
|
+
new_profile_tags: z.array(z.string()).optional(),
|
|
2751
|
+
profile_status: z.string().nullable().optional(),
|
|
2752
|
+
pinned: z.boolean().optional(),
|
|
2753
|
+
proxy_id: z.union([z.string(), z.object({ id: z.string() })]).optional()
|
|
2754
|
+
}, (args2) => toolHandler("vision_update_profile", args2));
|
|
2755
|
+
server.tool("vision_delete_profile", "Delete a Vision Browser profile via Cloud API", {
|
|
2756
|
+
folder_id: z.string(),
|
|
2757
|
+
profile_id: z.string()
|
|
2758
|
+
}, (args2) => toolHandler("vision_delete_profile", args2));
|
|
2759
|
+
server.tool("vision_get_proxies", "Get Vision Browser proxies from a specific folder via Cloud API", {
|
|
2760
|
+
folder_id: z.string()
|
|
2761
|
+
}, (args2) => toolHandler("vision_get_proxies", args2));
|
|
2762
|
+
server.tool("vision_create_proxies", "Create Vision Browser proxies inside a folder via Cloud API", {
|
|
2763
|
+
folder_id: z.string(),
|
|
2764
|
+
proxies: z.array(z.object({
|
|
2765
|
+
proxy_name: z.string(),
|
|
2766
|
+
proxy_type: visionProxyTypeArg,
|
|
2767
|
+
proxy_ip: z.string(),
|
|
2768
|
+
proxy_port: z.number(),
|
|
2769
|
+
proxy_username: z.string().optional(),
|
|
2770
|
+
proxy_password: z.string().optional(),
|
|
2771
|
+
update_url: z.string().optional(),
|
|
2772
|
+
proxy_geo: z.record(z.unknown()).optional()
|
|
2773
|
+
}).passthrough())
|
|
2774
|
+
}, (args2) => toolHandler("vision_create_proxies", args2));
|
|
2775
|
+
server.tool("vision_update_proxy", "Update a Vision Browser proxy via Cloud API", {
|
|
2776
|
+
folder_id: z.string(),
|
|
2777
|
+
proxy_id: z.string(),
|
|
2778
|
+
proxy_name: z.string(),
|
|
2779
|
+
proxy_type: visionProxyTypeArg,
|
|
2780
|
+
proxy_ip: z.string(),
|
|
2781
|
+
proxy_port: z.number(),
|
|
2782
|
+
proxy_username: z.string().optional(),
|
|
2783
|
+
proxy_password: z.string().optional(),
|
|
2784
|
+
update_url: z.string().optional(),
|
|
2785
|
+
proxy_geo: z.record(z.unknown()).optional()
|
|
2786
|
+
}, (args2) => toolHandler("vision_update_proxy", args2));
|
|
2787
|
+
server.tool("vision_delete_proxies", "Delete Vision Browser proxies inside a folder via Cloud API", {
|
|
2788
|
+
folder_id: z.string(),
|
|
2789
|
+
proxy_ids: z.array(z.string())
|
|
2790
|
+
}, (args2) => toolHandler("vision_delete_proxies", args2));
|
|
2791
|
+
server.tool("vision_get_statuses", "Get Vision Browser statuses from a specific folder via Cloud API", {
|
|
2792
|
+
folder_id: z.string()
|
|
2793
|
+
}, (args2) => toolHandler("vision_get_statuses", args2));
|
|
2794
|
+
server.tool("vision_get_tags", "Get Vision Browser tags from a specific folder via Cloud API", {
|
|
2795
|
+
folder_id: z.string()
|
|
2796
|
+
}, (args2) => toolHandler("vision_get_tags", args2));
|
|
2797
|
+
server.tool("vision_create_tags", "Create Vision Browser tags inside a folder via Cloud API", {
|
|
2798
|
+
folder_id: z.string(),
|
|
2799
|
+
tags: z.array(z.string())
|
|
2800
|
+
}, (args2) => toolHandler("vision_create_tags", args2));
|
|
2801
|
+
server.tool("vision_update_tag", "Update a Vision Browser tag via Cloud API", {
|
|
2802
|
+
folder_id: z.string(),
|
|
2803
|
+
tag_id: z.string(),
|
|
2804
|
+
name: z.string()
|
|
2805
|
+
}, (args2) => toolHandler("vision_update_tag", args2));
|
|
2806
|
+
server.tool("vision_delete_tags", "Delete Vision Browser tags via Cloud API", {
|
|
2807
|
+
folder_id: z.string(),
|
|
2808
|
+
tag_ids: z.array(z.string())
|
|
2809
|
+
}, (args2) => toolHandler("vision_delete_tags", args2));
|
|
2810
|
+
server.tool("vision_create_statuses", "Create Vision Browser statuses via Cloud API", {
|
|
2811
|
+
folder_id: z.string(),
|
|
2812
|
+
statuses: z.array(z.tuple([z.string(), z.string()]))
|
|
2813
|
+
}, (args2) => toolHandler("vision_create_statuses", args2));
|
|
2814
|
+
server.tool("vision_update_status", "Update a Vision Browser status via Cloud API", {
|
|
2815
|
+
folder_id: z.string(),
|
|
2816
|
+
status_id: z.string(),
|
|
2817
|
+
name: z.string(),
|
|
2818
|
+
color: z.string()
|
|
2819
|
+
}, (args2) => toolHandler("vision_update_status", args2));
|
|
2820
|
+
server.tool("vision_delete_statuses", "Delete Vision Browser statuses via Cloud API", {
|
|
2821
|
+
folder_id: z.string(),
|
|
2822
|
+
status_ids: z.array(z.string())
|
|
2823
|
+
}, (args2) => toolHandler("vision_delete_statuses", args2));
|
|
2824
|
+
if (VISION_PORT !== void 0) {
|
|
2825
|
+
server.tool("vision_get_languages", "Get available Vision Browser languages from the local API", {}, () => toolHandler("vision_get_languages", {}));
|
|
2826
|
+
server.tool("vision_get_timezones", "Get available Vision Browser timezones from the local API", {}, () => toolHandler("vision_get_timezones", {}));
|
|
2827
|
+
server.tool("vision_get_renderers", "Get available Vision Browser renderers from the local API", {
|
|
2828
|
+
os: visionPlatformArg,
|
|
2829
|
+
version: z.number().optional()
|
|
2830
|
+
}, (args2) => toolHandler("vision_get_renderers", args2));
|
|
2831
|
+
}
|
|
2535
2832
|
}
|
|
2536
2833
|
var browserIdsArg = z.array(z.string()).optional();
|
|
2537
2834
|
var browserScopeArg = z.string().optional();
|
|
@@ -2711,18 +3008,10 @@ function createServer() {
|
|
|
2711
3008
|
browserIds: browserIdsArg,
|
|
2712
3009
|
_scope: browserScopeArg
|
|
2713
3010
|
}, (args2) => toolHandler("browser_run_recorded_flow", args2));
|
|
2714
|
-
if (LINKEN_PORT !== void 0)
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
if (
|
|
2718
|
-
server.tool("dolphin_get_profiles", "List Dolphin profiles", {}, () => toolHandler("dolphin_get_profiles", {}));
|
|
2719
|
-
server.tool("dolphin_start_profile", "Start Dolphin profile", {
|
|
2720
|
-
profileId: z.string()
|
|
2721
|
-
}, (args2) => toolHandler("dolphin_start_profile", args2));
|
|
2722
|
-
server.tool("dolphin_stop_profile", "Stop Dolphin profile", {
|
|
2723
|
-
profileId: z.string()
|
|
2724
|
-
}, (args2) => toolHandler("dolphin_stop_profile", args2));
|
|
2725
|
-
}
|
|
3011
|
+
if (LINKEN_PORT !== void 0) registerSphereTools(server, "linken", "Linken Sphere");
|
|
3012
|
+
if (WADEX_PORT !== void 0) registerSphereTools(server, "wadex", "Wade X");
|
|
3013
|
+
if (DOLPHIN_PORT !== void 0 || DOLPHIN_API_TOKEN !== void 0) registerDolphinTools(server);
|
|
3014
|
+
if (VISION_TOKEN !== void 0) registerVisionTools(server);
|
|
2726
3015
|
server.tool("browser_detect_captcha", "Detect captcha on page", {
|
|
2727
3016
|
browserIds: browserIdsArg,
|
|
2728
3017
|
_scope: browserScopeArg
|
|
@@ -2758,23 +3047,40 @@ function createServer() {
|
|
|
2758
3047
|
async function main() {
|
|
2759
3048
|
await connectServer();
|
|
2760
3049
|
if (ENABLED_VENDORS.length === 0) {
|
|
2761
|
-
console.error("[ornold] No antidetect
|
|
3050
|
+
console.error("[ornold] No antidetect vendors configured. Only browser_* and captcha_* tools will be available.");
|
|
2762
3051
|
}
|
|
2763
|
-
for (const [name, port
|
|
3052
|
+
for (const [name, port, path2, headers] of [
|
|
3053
|
+
["linken", LINKEN_PORT, "/sessions", void 0],
|
|
3054
|
+
["wadex", WADEX_PORT, "/sessions", void 0],
|
|
3055
|
+
["dolphin", DOLPHIN_PORT, "/v1.0/browser_profiles", void 0],
|
|
3056
|
+
["vision", VISION_PORT, "/variations/language", VISION_TOKEN ? { "X-Token": VISION_TOKEN } : void 0]
|
|
3057
|
+
]) {
|
|
2764
3058
|
if (port === void 0) continue;
|
|
2765
3059
|
try {
|
|
2766
|
-
const resp = await fetch(`http://127.0.0.1:${port}
|
|
3060
|
+
const resp = await fetch(`http://127.0.0.1:${port}${path2}`, { headers, signal: AbortSignal.timeout(2e3) });
|
|
2767
3061
|
if (resp.ok) console.error(`[ornold] ${name}: detected on port ${port}`);
|
|
2768
3062
|
} catch {
|
|
2769
3063
|
}
|
|
2770
3064
|
}
|
|
3065
|
+
if (DOLPHIN_API_TOKEN !== void 0) {
|
|
3066
|
+
console.error("[ornold] dolphin: cloud token configured");
|
|
3067
|
+
}
|
|
3068
|
+
if (VISION_TOKEN !== void 0) {
|
|
3069
|
+
console.error(`[ornold] vision: cloud token configured${VISION_PORT !== void 0 ? `, local port ${VISION_PORT}` : ""}`);
|
|
3070
|
+
}
|
|
2771
3071
|
ws?.send(JSON.stringify({
|
|
2772
3072
|
type: "bridge_hello",
|
|
2773
3073
|
hostname: (await import("os")).hostname(),
|
|
2774
3074
|
config: {
|
|
2775
3075
|
enabledVendors: ENABLED_VENDORS,
|
|
2776
3076
|
...LINKEN_PORT !== void 0 ? { linkenPort: LINKEN_PORT } : {},
|
|
2777
|
-
...
|
|
3077
|
+
...WADEX_PORT !== void 0 ? { wadexPort: WADEX_PORT } : {},
|
|
3078
|
+
...DOLPHIN_PORT !== void 0 ? { dolphinPort: DOLPHIN_PORT } : {},
|
|
3079
|
+
...VISION_PORT !== void 0 ? { visionPort: VISION_PORT } : {},
|
|
3080
|
+
dolphinCloud: DOLPHIN_API_TOKEN !== void 0,
|
|
3081
|
+
dolphinLocal: DOLPHIN_PORT !== void 0,
|
|
3082
|
+
visionCloud: VISION_TOKEN !== void 0,
|
|
3083
|
+
visionLocal: VISION_TOKEN !== void 0 && VISION_PORT !== void 0
|
|
2778
3084
|
}
|
|
2779
3085
|
}));
|
|
2780
3086
|
const server = createServer();
|