Skip to content

Commit 4566993

Browse files
authored
Merge pull request #120 from DogeLakeDev/release/daemon-0.2.3
release: SFMC 0.2.3 daemon supervisor
2 parents 651cc89 + 02203f2 commit 4566993

37 files changed

Lines changed: 1147 additions & 118 deletions

‎docs/zh/guide/config.md‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ SFMC 采用**约定优于配置(Convention over Configuration)**的设计理
9898
9999
---
100100

101-
### `bds_updater.json`:BDS 核心与进程守护
101+
### `bds_updater.json`:BDS 核心更新
102102

103-
管理 Bedrock Dedicated Server 的自动版本检测、热补丁下载、升级前安全备份与进程崩溃自启。
103+
管理 Bedrock Dedicated Server 的自动版本检测、热补丁下载与升级前安全备份。
104+
进程崩溃拉起由 `sfmc` 后台守护进程负责,不再在此配置开关。
104105

105106
```json title="configs/bds_updater.json"
106107
{
@@ -109,23 +110,19 @@ SFMC 采用**约定优于配置(Convention over Configuration)**的设计理
109110
"backup_dir": "./backups",
110111
"channel": "release",
111112
"auto_check": true,
112-
"crash_restart": true,
113-
"crash_restart_delay": 5,
114113
"preserve": ["server.properties", "whitelist.json", "permissions.json", "worlds"],
115114
"qq_notify": true
116115
}
117116
```
118117

119-
| 字段 | 类型 | 说明 |
120-
| :-------------------- | :--------- | :---------------------------------------------------------------------------------- |
121-
| `bds_path` | `string` | BDS 核心可执行程序所在目录。 |
122-
| `backup_dir` | `string` | 升级或回滚时的全量备份落盘路径(必须位于 `bds_path` 目录之外)。 |
123-
| `channel` | `string` | 更新通道:`"release"`(正式稳定版)或 `"preview"`(预览测试版)。 |
124-
| `auto_check` | `boolean` | 服务启动时是否静默请求 Mojang 官方源检测最新版本。 |
125-
| `crash_restart` | `boolean` | 当 `bedrock_server` 异常崩溃退出时,是否自动尝试拉起恢复。 |
126-
| `crash_restart_delay` | `number` | 崩溃重启前的缓冲等待时间(秒),避免因端口未释放引发频繁颠簸。 |
127-
| `preserve` | `string[]` | 覆盖更新时**绝对予以保留并自动复原**的文件/目录白名单(避免存档或基础配置被冲洗)。 |
128-
| `qq_notify` | `boolean` | 更新启动、完成或崩溃告警时,是否通过 QQ 群同步广播进度。 |
118+
| 字段 | 类型 | 说明 |
119+
| :----------- | :--------- | :---------------------------------------------------------------------------------- |
120+
| `bds_path` | `string` | BDS 核心可执行程序所在目录。 |
121+
| `backup_dir` | `string` | 升级或回滚时的全量备份落盘路径(必须位于 `bds_path` 目录之外)。 |
122+
| `channel` | `string` | 更新通道:`"release"`(正式稳定版)或 `"preview"`(预览测试版)。 |
123+
| `auto_check` | `boolean` | 服务启动时是否静默请求 Mojang 官方源检测最新版本。 |
124+
| `preserve` | `string[]` | 覆盖更新时**绝对予以保留并自动复原**的文件/目录白名单(避免存档或基础配置被冲洗)。 |
125+
| `qq_notify` | `boolean` | 更新启动、完成或崩溃告警时,是否通过 QQ 群同步广播进度。 |
129126

130127
---
131128

‎modules/sdk/@sfmc-sdk/CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @sfmc-bds/sdk
22

3+
## 0.2.1
4+
5+
### Patch Changes
6+
7+
- 5a25300: 新增 CLI 守护进程监管:退出 CLI 不停服,经命名管道 RPC 连接;移除 bds_updater 崩溃自启配置项,改由 daemon 固定拉起。正式版补丁 0.2.3。
8+
39
## 0.2.0
410

511
### Minor Changes

‎modules/sdk/@sfmc-sdk/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sfmc-bds/sdk",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "ScriptsForMinecraftServer unified SDK — SAPI/Node umbrella covering contracts, runtime, module-loader, and db/config/service capabilities.",
55
"author": "Shiroha7z",
66
"license": "ISC",

‎modules/sdk/@sfmc-sdk/schemas/bds_updater.schema.json‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "https://github.com/DogeLakeDev/ScriptsForMinecraftServer/schemas/bds_updater.schema.json",
44
"title": "SFMC bds_updater",
5-
"description": "BDS 自动更新与进程管理配置。由 bds-tools(check-update / bds-manager)读取;路径请用双反斜杠或正斜杠。",
5+
"description": "BDS 自动更新配置。由 bds-tools(check-update)读取;崩溃拉起由 sfmc daemon 负责。路径请用双反斜杠或正斜杠。",
66
"type": "object",
77
"additionalProperties": false,
88
"properties": {
@@ -39,18 +39,6 @@
3939
"type": "boolean",
4040
"description": "启动时是否自动检查 BDS 更新"
4141
},
42-
"crash_restart": {
43-
"type": "boolean",
44-
"description": "BDS 异常退出时是否自动拉起"
45-
},
46-
"crash_restart_delay": {
47-
"type": "number",
48-
"description": "崩溃重启前等待秒数(可选)"
49-
},
50-
"auto_restart": {
51-
"type": "boolean",
52-
"description": "旧字段:兼容保留,用于推断是否启用 QQ 等相关自动行为"
53-
},
5442
"version_mode": {
5543
"type": "string",
5644
"enum": ["bedrock-oss", "endstone"],

‎modules/sdk/@sfmc-sdk/src/node/config/index.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ export interface BdsUpdaterConfig {
66
bds_path?: string;
77
backup_dir?: string;
88
channel?: "release" | "preview" | string;
9-
auto_restart?: boolean;
109
auto_check?: boolean;
11-
crash_restart?: boolean;
12-
crash_restart_delay?: number;
1310
qq_notify?: boolean;
1411
qq_config?: string;
1512
preserve?: string[];
@@ -239,8 +236,6 @@ export const DEFAULT_BDS_UPDATER_CONFIG: BdsUpdaterConfig = {
239236
qq_notify: false,
240237
qq_config: "../configs/qq_config.json",
241238
auto_check: true,
242-
crash_restart: true,
243-
auto_restart: true,
244239
};
245240

246241
/** permissions.json 根为数组;默认空表 */

‎packages/bds-tools/CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @sfmc-bds/bds-tools
22

3+
## 0.2.1
4+
5+
### Patch Changes
6+
7+
- 5a25300: 新增 CLI 守护进程监管:退出 CLI 不停服,经命名管道 RPC 连接;移除 bds_updater 崩溃自启配置项,改由 daemon 固定拉起。正式版补丁 0.2.3。
8+
- Updated dependencies [5a25300]
9+
- @sfmc-bds/sdk@0.2.1
10+
311
## 0.2.0
412

513
### Minor Changes

‎packages/bds-tools/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sfmc-bds/bds-tools",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "SFMC BDS auto-updater, lifecycle manager, and behavior-pack assembler",
55
"author": "Shiroha7z",
66
"license": "AGPL-3.0-only",

‎packages/bds-tools/src/bds-manager.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,17 @@ export interface BdsManagerOptions {
5757
interface CachedProc {
5858
process: ReturnType<typeof spawn> | null;
5959
isManualStop: boolean;
60-
crashRestart: boolean;
60+
/** 独立运行 bds-manager 时的崩溃拉起延迟(秒);守护由 sfmc daemon 负责时不读配置 */
6161
crashDelayMs: number;
6262
exePath: string;
6363
bdsPath: string;
6464
}
6565

6666
let cached: CachedProc | null = null;
6767

68+
/** 独立入口崩溃拉起默认等待(毫秒);配置项已移除,固定值避免与 daemon 监管重复暴露开关 */
69+
const STANDALONE_CRASH_DELAY_MS = 5_000;
70+
6871
function ensureProc(): CachedProc {
6972
if (cached) return cached;
7073
const cfg = loadConfig();
@@ -74,8 +77,7 @@ function ensureProc(): CachedProc {
7477
cached = {
7578
process: null,
7679
isManualStop: false,
77-
crashRestart: cfg.crash_restart !== false,
78-
crashDelayMs: (cfg.crash_restart_delay ?? 5) * 1000,
80+
crashDelayMs: STANDALONE_CRASH_DELAY_MS,
7981
exePath,
8082
bdsPath: bds_path,
8183
};
@@ -224,7 +226,7 @@ export function createBdsManager(options: BdsManagerOptions = {}): BdsManager {
224226
} else {
225227
void postBdsLifecycleEvent("stop");
226228
}
227-
if (!wasManual && p.crashRestart && isMain()) {
229+
if (!wasManual && isMain()) {
228230
log.info(`BDS 意外退出,${p.crashDelayMs / 1000}s 后自动重启...`);
229231
setTimeout(() => {
230232
start().catch((e) => log.error(`自动重启失败: ${e.message}`));

‎packages/bds-tools/src/check-update.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function buildContext(): UpdateContext {
8080
bdsPath: bds_path,
8181
backupDir: backup_dir,
8282
preserve,
83-
autoRestart: !args["no-start"] && cfg.auto_restart !== false,
83+
autoRestart: !args["no-start"],
8484
qqNotify: !!cfg.qq_notify,
8585
};
8686
}

‎packages/bds-tools/src/types.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ export interface BdsUpdaterConfig {
66
bds_path?: string;
77
backup_dir?: string;
88
channel?: "release" | "preview" | string;
9-
auto_restart?: boolean;
109
auto_check?: boolean;
11-
crash_restart?: boolean;
12-
crash_restart_delay?: number;
1310
qq_notify?: boolean;
1411
qq_config?: string;
1512
preserve?: string[];

0 commit comments

Comments
 (0)