hocai-connect 0.10.3 → 0.12.0
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 +38 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -39734,7 +39734,7 @@ var TOOLS = {
|
|
|
39734
39734
|
],
|
|
39735
39735
|
WORK: ["Read", "Write", "Edit", "Glob", "Grep"]
|
|
39736
39736
|
};
|
|
39737
|
-
var VERSION = "0.
|
|
39737
|
+
var VERSION = "0.12.0";
|
|
39738
39738
|
function claudeArgs(job, o, port) {
|
|
39739
39739
|
const mcp = {
|
|
39740
39740
|
mcpServers: {
|
|
@@ -39786,6 +39786,7 @@ function buildHttpServer(o) {
|
|
|
39786
39786
|
const checkOrigin = (req, res) => {
|
|
39787
39787
|
const origin = req.headers.origin;
|
|
39788
39788
|
if (!origin || !o.origins.includes(origin)) {
|
|
39789
|
+
if (origin) cors(res, origin);
|
|
39789
39790
|
json3(res, 403, { error: "Ch\u1EC9 trang hocAI m\u1EDBi g\u1ECDi \u0111\u01B0\u1EE3c c\u1EA7u n\u1ED1i n\xE0y" });
|
|
39790
39791
|
return false;
|
|
39791
39792
|
}
|
|
@@ -39926,7 +39927,13 @@ function buildHttpServer(o) {
|
|
|
39926
39927
|
res.writeHead(204).end();
|
|
39927
39928
|
return;
|
|
39928
39929
|
}
|
|
39929
|
-
|
|
39930
|
+
const me = o.me();
|
|
39931
|
+
const hoi = new URL(req.url ?? "/", "http://x").searchParams.get("user");
|
|
39932
|
+
json3(res, 200, {
|
|
39933
|
+
ten: "hocai-connect",
|
|
39934
|
+
phienBan: VERSION,
|
|
39935
|
+
user: me ? { ten: me.ten, ...hoi ? { khop: hoi === me.id } : {} } : me
|
|
39936
|
+
});
|
|
39930
39937
|
return;
|
|
39931
39938
|
}
|
|
39932
39939
|
if (path === "/choose-folder") {
|
|
@@ -40242,6 +40249,24 @@ async function latestVersion(pkg = "hocai-connect") {
|
|
|
40242
40249
|
return null;
|
|
40243
40250
|
}
|
|
40244
40251
|
}
|
|
40252
|
+
function defaultOrigins(env) {
|
|
40253
|
+
if (env && env.trim()) return env.split(",").map((s) => s.trim()).filter(Boolean);
|
|
40254
|
+
return [
|
|
40255
|
+
"https://camerasrent.com",
|
|
40256
|
+
"https://www.camerasrent.com",
|
|
40257
|
+
// Giữ lại cho tới khi không còn helper nào trỏ vào đây nữa.
|
|
40258
|
+
"http://103.154.62.225:8090"
|
|
40259
|
+
// KHÔNG có localhost ở đây, và đây là chốt chứ không phải thiếu sót.
|
|
40260
|
+
//
|
|
40261
|
+
// 5173 là cổng MẶC ĐỊNH của Vite. Gói này chạy trên máy học viên, mà họ
|
|
40262
|
+
// đang học lập trình — bất kỳ dự án Vite nào họ mở cũng thành một gốc hợp
|
|
40263
|
+
// lệ, và trang đó chiếm được cầu nối trên máy họ.
|
|
40264
|
+
//
|
|
40265
|
+
// Người phát triển hocAI đặt `HOCAI_WEB_ORIGINS` là xong (xem script
|
|
40266
|
+
// `dev:mcp:http`). Học viên thì không có cách nào gỡ một gốc đã nướng sẵn
|
|
40267
|
+
// vào gói.
|
|
40268
|
+
];
|
|
40269
|
+
}
|
|
40245
40270
|
|
|
40246
40271
|
// apps/mcp/src/cli.ts
|
|
40247
40272
|
var HOCAI_DIR = (0, import_node_path5.join)((0, import_node_os3.homedir)(), ".hocai");
|
|
@@ -40249,7 +40274,7 @@ var CREDS = (0, import_node_path5.join)(HOCAI_DIR, "config.json");
|
|
|
40249
40274
|
var APP_DIR = (0, import_node_path5.join)(HOCAI_DIR, "app");
|
|
40250
40275
|
var APP_CLI = (0, import_node_path5.join)(APP_DIR, "cli.js");
|
|
40251
40276
|
var LOG_DIR = (0, import_node_path5.join)(HOCAI_DIR, "log");
|
|
40252
|
-
var WEB = () => process.env.HOCAI_WEB_URL ?? "
|
|
40277
|
+
var WEB = () => process.env.HOCAI_WEB_URL ?? "https://camerasrent.com";
|
|
40253
40278
|
var API_DEFAULT = () => process.env.HOCAI_API_URL ?? `${WEB()}/api`;
|
|
40254
40279
|
var PORT = Number(process.env.MCP_HTTP_PORT ?? 4100);
|
|
40255
40280
|
var say = (s) => process.stderr.write(s + "\n");
|
|
@@ -40419,7 +40444,7 @@ function goDichVu() {
|
|
|
40419
40444
|
for (const c of p.uninstall) chay(c, true);
|
|
40420
40445
|
if (p.file) (0, import_node_fs3.rmSync)(p.file, { force: true });
|
|
40421
40446
|
}
|
|
40422
|
-
var LENH = ["mcp", "run", "update", "status", "stop", "logs", "quen", "help", "--help", "-h"];
|
|
40447
|
+
var LENH = ["mcp", "run", "update", "status", "stop", "logs", "quen", "help", "--help", "-h", "entry"];
|
|
40423
40448
|
var TRO_GIUP = `hocai-connect \u2014 n\u1ED1i Claude tr\xEAn m\xE1y b\u1EA1n v\xE0o hocAI
|
|
40424
40449
|
|
|
40425
40450
|
npx hocai-connect c\xE0i v\xE0 b\u1EADt. M\xE1y t\u1EF1 n\u1ED1i l\u1EA1i m\u1ED7i l\u1EA7n b\u1EADt m\xE1y.
|
|
@@ -40436,6 +40461,10 @@ async function main() {
|
|
|
40436
40461
|
say(TRO_GIUP);
|
|
40437
40462
|
return;
|
|
40438
40463
|
}
|
|
40464
|
+
if (cmd === "entry") {
|
|
40465
|
+
process.stdout.write(__filename + "\n");
|
|
40466
|
+
return;
|
|
40467
|
+
}
|
|
40439
40468
|
if (cmd && !LENH.includes(cmd)) {
|
|
40440
40469
|
say(`Kh\xF4ng c\xF3 l\u1EC7nh "${cmd}".`);
|
|
40441
40470
|
say("");
|
|
@@ -40554,7 +40583,11 @@ async function main() {
|
|
|
40554
40583
|
}
|
|
40555
40584
|
const srv = buildHttpServer({
|
|
40556
40585
|
token: creds.token,
|
|
40557
|
-
|
|
40586
|
+
// Danh sách CỐ ĐỊNH gồm cả địa chỉ cũ, không ghép từ `WEB()`.
|
|
40587
|
+
//
|
|
40588
|
+
// Ghép từ `WEB()` thì đổi `WEB()` là mất gốc cũ, và mọi helper đã cài từ
|
|
40589
|
+
// chối trang mới trong im lặng. Xem `defaultOrigins`.
|
|
40590
|
+
origins: defaultOrigins(process.env.HOCAI_WEB_ORIGINS),
|
|
40558
40591
|
claudeBin: claudeBin(),
|
|
40559
40592
|
me: identity.current
|
|
40560
40593
|
});
|