xiaozhi-client 2.3.0-beta.9 → 2.3.1-beta.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.
|
@@ -58071,7 +58071,7 @@ var UpdateApiHandler = class extends BaseHandler {
|
|
|
58071
58071
|
import fs3 from "fs";
|
|
58072
58072
|
import path6 from "path";
|
|
58073
58073
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
58074
|
-
var VERSION2 = "2.3.
|
|
58074
|
+
var VERSION2 = "2.3.1-beta.0";
|
|
58075
58075
|
var APP_NAME = "xiaozhi-client";
|
|
58076
58076
|
var VersionUtils = class _VersionUtils {
|
|
58077
58077
|
static {
|
|
@@ -59788,7 +59788,7 @@ var VERSION2, APP_NAME, VersionUtils;
|
|
|
59788
59788
|
var init_version2 = __esm({
|
|
59789
59789
|
"../utils/version.ts"() {
|
|
59790
59790
|
"use strict";
|
|
59791
|
-
VERSION2 = "2.3.
|
|
59791
|
+
VERSION2 = "2.3.1-beta.0";
|
|
59792
59792
|
APP_NAME = "xiaozhi-client";
|
|
59793
59793
|
VersionUtils = class _VersionUtils {
|
|
59794
59794
|
static {
|
package/dist/cli/index.js
CHANGED
|
@@ -2663,9 +2663,16 @@ var init_PathUtils = __esm({
|
|
|
2663
2663
|
}
|
|
2664
2664
|
/**
|
|
2665
2665
|
* 获取项目根目录路径
|
|
2666
|
+
*
|
|
2667
|
+
* 兼容开发和构建两种环境:
|
|
2668
|
+
* - 开发环境:脚本位于 src/cli/ 下,需向上 3 级
|
|
2669
|
+
* - 构建环境:脚本位于 dist/cli/ 下,需向上 2 级
|
|
2666
2670
|
*/
|
|
2667
2671
|
static getProjectRoot() {
|
|
2668
2672
|
const scriptDir = _PathUtils.getScriptDir();
|
|
2673
|
+
if (scriptDir.endsWith("/dist/cli") || scriptDir.endsWith("\\dist\\cli")) {
|
|
2674
|
+
return path5.join(scriptDir, "..", "..");
|
|
2675
|
+
}
|
|
2669
2676
|
return path5.join(scriptDir, "..", "..", "..");
|
|
2670
2677
|
}
|
|
2671
2678
|
/**
|
|
@@ -2749,11 +2756,11 @@ var init_PathUtils = __esm({
|
|
|
2749
2756
|
}
|
|
2750
2757
|
/**
|
|
2751
2758
|
* 获取 Web 服务器启动器路径
|
|
2752
|
-
* 返回项目根目录 dist 下的 WebServerLauncher.js
|
|
2759
|
+
* 返回项目根目录 dist/backend 下的 WebServerLauncher.js
|
|
2753
2760
|
*/
|
|
2754
2761
|
static getWebServerLauncherPath() {
|
|
2755
2762
|
const projectRoot = _PathUtils.getProjectRoot();
|
|
2756
|
-
return path5.join(projectRoot, "dist", "WebServerLauncher.js");
|
|
2763
|
+
return path5.join(projectRoot, "dist", "backend", "WebServerLauncher.js");
|
|
2757
2764
|
}
|
|
2758
2765
|
/**
|
|
2759
2766
|
* 创建安全的文件路径
|
|
@@ -3754,56 +3761,40 @@ var init_ServiceManager = __esm({
|
|
|
3754
3761
|
}
|
|
3755
3762
|
}
|
|
3756
3763
|
/**
|
|
3757
|
-
*
|
|
3764
|
+
* 启动普通模式(始终以守护进程方式运行)
|
|
3758
3765
|
*/
|
|
3759
|
-
async startNormalMode(
|
|
3760
|
-
|
|
3761
|
-
await this.startWebServerInDaemon();
|
|
3762
|
-
} else {
|
|
3763
|
-
await this.startWebServerInForeground();
|
|
3764
|
-
}
|
|
3766
|
+
async startNormalMode(_options) {
|
|
3767
|
+
await this.startWebServerInDaemon();
|
|
3765
3768
|
}
|
|
3766
3769
|
/**
|
|
3767
|
-
* 启动 MCP Server
|
|
3770
|
+
* 启动 MCP Server 模式(始终以守护进程方式运行)
|
|
3768
3771
|
*/
|
|
3769
3772
|
async startMcpServerMode(options) {
|
|
3770
3773
|
const port = options.port || 3e3;
|
|
3771
3774
|
const { spawn: spawn2 } = await import("child_process");
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
env
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
MCP_SERVER_MODE: "true"
|
|
3786
|
-
}
|
|
3775
|
+
const scriptPath = PathUtils.getExecutablePath("cli");
|
|
3776
|
+
const child = spawn2(
|
|
3777
|
+
"node",
|
|
3778
|
+
[scriptPath, "start", "--server", port.toString()],
|
|
3779
|
+
{
|
|
3780
|
+
detached: true,
|
|
3781
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
3782
|
+
// 完全忽略所有 stdio,避免阻塞
|
|
3783
|
+
env: {
|
|
3784
|
+
...process.env,
|
|
3785
|
+
XIAOZHI_CONFIG_DIR: PathUtils.getConfigDir(),
|
|
3786
|
+
XIAOZHI_DAEMON: "true",
|
|
3787
|
+
MCP_SERVER_MODE: "true"
|
|
3787
3788
|
}
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
)
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
const { WebServer } = await import("../backend/WebServer.js");
|
|
3798
|
-
const server = new WebServer(port);
|
|
3799
|
-
const cleanup = /* @__PURE__ */ __name(async () => {
|
|
3800
|
-
await server.stop();
|
|
3801
|
-
process.exit(0);
|
|
3802
|
-
}, "cleanup");
|
|
3803
|
-
process.once("SIGINT", cleanup);
|
|
3804
|
-
process.once("SIGTERM", cleanup);
|
|
3805
|
-
await server.start();
|
|
3806
|
-
}
|
|
3789
|
+
}
|
|
3790
|
+
);
|
|
3791
|
+
this.processManager.savePidInfo(child.pid || 0, "daemon");
|
|
3792
|
+
child.unref();
|
|
3793
|
+
consola2.success(
|
|
3794
|
+
`MCP Server \u5DF2\u5728\u540E\u53F0\u542F\u52A8 (PID: ${child.pid}, Port: ${port})`
|
|
3795
|
+
);
|
|
3796
|
+
consola2.info("\u4F7F\u7528 'xiaozhi status' \u67E5\u770B\u72B6\u6001");
|
|
3797
|
+
process.exit(0);
|
|
3807
3798
|
}
|
|
3808
3799
|
/**
|
|
3809
3800
|
* 后台模式启动 WebServer
|
|
@@ -3826,29 +3817,18 @@ var init_ServiceManager = __esm({
|
|
|
3826
3817
|
XIAOZHI_DAEMON: "true"
|
|
3827
3818
|
}
|
|
3828
3819
|
});
|
|
3829
|
-
|
|
3820
|
+
if (!child.pid) {
|
|
3821
|
+
throw new ServiceError(
|
|
3822
|
+
"\u65E0\u6CD5\u521B\u5EFA\u5B88\u62A4\u8FDB\u7A0B\uFF08node \u542F\u52A8\u5931\u8D25\uFF09\uFF0C\u8BF7\u68C0\u67E5 Node.js \u5B89\u88C5\u662F\u5426\u6B63\u5E38"
|
|
3823
|
+
);
|
|
3824
|
+
}
|
|
3825
|
+
this.processManager.savePidInfo(child.pid, "daemon");
|
|
3830
3826
|
child.unref();
|
|
3831
3827
|
consola2.success(`\u540E\u53F0\u670D\u52A1\u5DF2\u542F\u52A8 (PID: ${child.pid})`);
|
|
3832
3828
|
consola2.info("\u4F7F\u7528 'xiaozhi status' \u67E5\u770B\u72B6\u6001");
|
|
3833
3829
|
consola2.info("\u4F7F\u7528 'xiaozhi attach' \u67E5\u770B\u65E5\u5FD7");
|
|
3834
3830
|
process.exit(0);
|
|
3835
3831
|
}
|
|
3836
|
-
/**
|
|
3837
|
-
* 前台模式启动 WebServer
|
|
3838
|
-
*/
|
|
3839
|
-
async startWebServerInForeground() {
|
|
3840
|
-
const { WebServer } = await import("../backend/WebServer.js");
|
|
3841
|
-
const server = new WebServer();
|
|
3842
|
-
const cleanup = /* @__PURE__ */ __name(async () => {
|
|
3843
|
-
await server.stop();
|
|
3844
|
-
this.processManager.cleanupPidFile();
|
|
3845
|
-
process.exit(0);
|
|
3846
|
-
}, "cleanup");
|
|
3847
|
-
process.once("SIGINT", cleanup);
|
|
3848
|
-
process.once("SIGTERM", cleanup);
|
|
3849
|
-
this.processManager.savePidInfo(process.pid, "foreground");
|
|
3850
|
-
await server.start();
|
|
3851
|
-
}
|
|
3852
3832
|
};
|
|
3853
3833
|
}
|
|
3854
3834
|
});
|
|
@@ -5630,7 +5610,7 @@ init_config();
|
|
|
5630
5610
|
import fs from "fs";
|
|
5631
5611
|
import path3 from "path";
|
|
5632
5612
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5633
|
-
var VERSION = "2.3.
|
|
5613
|
+
var VERSION = "2.3.1-beta.0";
|
|
5634
5614
|
var APP_NAME = "xiaozhi-client";
|
|
5635
5615
|
var VersionUtils = class _VersionUtils {
|
|
5636
5616
|
static {
|