@eoasmxd/freya 0.4.2 → 0.4.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/README.md +22 -1
- package/core/package.json +2 -2
- package/doc/_index.md +1 -1
- package/doc/installation-guide.md +41 -6
- package/freya.js +16 -1
- package/package.json +2 -2
- package/plugins/plugin-gemini/package.json +1 -1
- package/plugins/plugin-openai/package.json +1 -1
- package/plugins/plugin-telegram-channel/package.json +1 -1
- package/plugins/plugin-tool-fs/package.json +1 -1
- package/plugins/plugin-tool-memory/package.json +1 -1
- package/plugins/plugin-tool-mysql/package.json +1 -1
- package/plugins/plugin-tool-web/package.json +1 -1
- package/plugins/plugin-wecom-channel/package.json +1 -1
- package/plugins/plugin-weixin-channel/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +33,30 @@ freya --no-cli
|
|
|
33
33
|
freya stop
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
### 方式二:通过 Docker 运行(推荐,免环境配置)
|
|
37
|
+
|
|
38
|
+
无需安装 Node.js 与包管理环境,直接通过容器一键启动(支持配置与会话数据持久化):
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# 启动并挂载持久化数据目录(宿主机 ./freya-data 映射至容器 /data)
|
|
42
|
+
docker run -d \
|
|
43
|
+
--name freya \
|
|
44
|
+
-p 3000:3000 \
|
|
45
|
+
-v $(pwd)/freya-data:/data \
|
|
46
|
+
--restart unless-stopped \
|
|
47
|
+
ghcr.io/eoasmxd/freya:latest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
或使用本地源码构建镜像运行:
|
|
51
|
+
```bash
|
|
52
|
+
# 本地构建并启动
|
|
53
|
+
docker build -t freya .
|
|
54
|
+
docker run -d --name freya -p 3000:3000 -v $(pwd)/freya-data:/data freya
|
|
55
|
+
```
|
|
56
|
+
|
|
36
57
|
---
|
|
37
58
|
|
|
38
|
-
###
|
|
59
|
+
### 方式三:从源码构建运行
|
|
39
60
|
|
|
40
61
|
运行环境要求:**Node.js** (>= 22.0.0) 和 **pnpm** (9.x)。
|
|
41
62
|
|
package/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eoasmxd/freya-core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"clean": "rm -rf dist"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@eoasmxd/freya-sdk": "^0.4.
|
|
19
|
+
"@eoasmxd/freya-sdk": "^0.4.3",
|
|
20
20
|
"ws": "^8.18.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
package/doc/_index.md
CHANGED
|
@@ -49,24 +49,59 @@ freya stop
|
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
|
-
## 3.
|
|
52
|
+
## 3. 方式二:通过 Docker 容器化部署与维护(推荐)
|
|
53
|
+
|
|
54
|
+
适合希望免去 Node.js 环境配置、开箱即用、或在云服务器/NAS 上实现轻量化私有部署的用户。
|
|
55
|
+
|
|
56
|
+
### 3.1 启动服务并持久化存储
|
|
57
|
+
在终端执行以下命令拉取官方最新镜像并常驻启动(Web 服务映射至 3000 端口,并将宿主机当前目录下的 `freya-data` 挂载到容器内持久化数据目录):
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
docker run -d \
|
|
61
|
+
--name freya \
|
|
62
|
+
-p 3000:3000 \
|
|
63
|
+
-v $(pwd)/freya-data:/data \
|
|
64
|
+
--restart unless-stopped \
|
|
65
|
+
ghcr.io/eoasmxd/freya:latest
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
*也可以使用本地源码直接构建镜像并运行:*
|
|
69
|
+
```bash
|
|
70
|
+
docker build -t freya .
|
|
71
|
+
docker run -d --name freya -p 3000:3000 -v $(pwd)/freya-data:/data freya
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 3.2 停止与重启服务
|
|
75
|
+
* **临时停止**:`docker stop freya`
|
|
76
|
+
* **重新唤醒**:`docker start freya`
|
|
77
|
+
* **重启服务**:`docker restart freya`
|
|
78
|
+
|
|
79
|
+
### 3.3 容器版本平滑更新
|
|
80
|
+
当发布了新的镜像版本时,执行以下三步即可无损升级:
|
|
81
|
+
1. **拉取最新镜像**:`docker pull ghcr.io/eoasmxd/freya:latest`
|
|
82
|
+
2. **销毁旧容器**:`docker rm -f freya`(用户配置与会话记忆均保留在 `./freya-data` 挂载目录中,数据安全无损)
|
|
83
|
+
3. **重新拉起服务**:重新执行 3.1 中的 `docker run` 命令即可。
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 4. 方式三:从源码克隆编译与维护(开发模式)
|
|
53
88
|
|
|
54
89
|
适合需要进行二次开发、编写自定义插件或深入学习 Freya 微内核架构的开发者。
|
|
55
90
|
|
|
56
|
-
###
|
|
91
|
+
### 4.1 安装依赖
|
|
57
92
|
克隆项目后,在根目录下安装全量 workspace 依赖:
|
|
58
93
|
```bash
|
|
59
94
|
pnpm install
|
|
60
95
|
```
|
|
61
96
|
|
|
62
|
-
###
|
|
97
|
+
### 4.2 编译打包
|
|
63
98
|
执行代码级编译与物理打包汇总:
|
|
64
99
|
```bash
|
|
65
100
|
pnpm build
|
|
66
101
|
```
|
|
67
102
|
*该命令会编译 core/sdk/ui 与所有插件,并在根目录下生成最终分发包 `dist/`。*
|
|
68
103
|
|
|
69
|
-
###
|
|
104
|
+
### 4.3 启动服务
|
|
70
105
|
根据开发测试需求选择启动模式:
|
|
71
106
|
* **前台开发运行**(带 CLI 终端交互):
|
|
72
107
|
```bash
|
|
@@ -77,13 +112,13 @@ pnpm build
|
|
|
77
112
|
pnpm freya --no-cli
|
|
78
113
|
```
|
|
79
114
|
|
|
80
|
-
###
|
|
115
|
+
### 4.4 停止服务
|
|
81
116
|
若需要结束后台常驻的子进程,在根目录下执行:
|
|
82
117
|
```bash
|
|
83
118
|
pnpm stop
|
|
84
119
|
```
|
|
85
120
|
|
|
86
|
-
###
|
|
121
|
+
### 4.5 手动版本更新与代码同步
|
|
87
122
|
当拉取代码仓库最新修改时,在根目录下执行:
|
|
88
123
|
1. **停止后台进程**:`pnpm stop`
|
|
89
124
|
2. **拉取最新源码**:`git pull origin main`
|
package/freya.js
CHANGED
|
@@ -97,11 +97,16 @@ async function getCliEnabled(args) {
|
|
|
97
97
|
return true;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
function isForegroundMode(args) {
|
|
101
|
+
return args.includes('--foreground') || process.env.FREYA_FOREGROUND === 'true';
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
await checkSingleInstance();
|
|
101
105
|
|
|
102
106
|
const cliEnabled = await getCliEnabled(process.argv);
|
|
107
|
+
const isForeground = isForegroundMode(process.argv);
|
|
103
108
|
|
|
104
|
-
if (!cliEnabled) {
|
|
109
|
+
if (!cliEnabled && !isForeground) {
|
|
105
110
|
const child = fork(coreIndex, process.argv.slice(2), {
|
|
106
111
|
detached: true,
|
|
107
112
|
stdio: 'ignore',
|
|
@@ -129,6 +134,16 @@ if (!cliEnabled) {
|
|
|
129
134
|
}
|
|
130
135
|
});
|
|
131
136
|
|
|
137
|
+
const forwardSignal = (signal) => {
|
|
138
|
+
if (child.pid) {
|
|
139
|
+
try {
|
|
140
|
+
process.kill(child.pid, signal);
|
|
141
|
+
} catch { }
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
process.on('SIGTERM', () => forwardSignal('SIGTERM'));
|
|
145
|
+
process.on('SIGINT', () => forwardSignal('SIGINT'));
|
|
146
|
+
|
|
132
147
|
child.on('exit', (code) => {
|
|
133
148
|
process.exit(code ?? 0);
|
|
134
149
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eoasmxd/freya",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Freya - 微内核智能体系统",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"src"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@eoasmxd/freya-sdk": "^0.4.
|
|
38
|
+
"@eoasmxd/freya-sdk": "^0.4.3",
|
|
39
39
|
"ws": "^8.18.0",
|
|
40
40
|
"mysql2": "^3.11.0",
|
|
41
41
|
"qrcode": "^1.5.4"
|