@koishi-ce/koishi 1.0.7 → 1.0.9
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 +4 -4
- package/lib/cli/index.mjs +1 -1
- package/lib/worker/index.d.ts +17 -3
- package/lib/worker/index.mjs +1 -1
- package/package.json +4 -4
- package/src/worker/index.ts +1 -1
package/README.md
CHANGED
|
@@ -33,11 +33,11 @@ bunx create-koishi-ce my-app
|
|
|
33
33
|
| `--log-level [level]` | 2 | 日志等级 |
|
|
34
34
|
| `--log-time [format]` | - | 日志时间戳格式 |
|
|
35
35
|
|
|
36
|
-
不带子命令运行 `koishi`
|
|
36
|
+
不带子命令运行 `koishi` 时输出帮助。交互终端中启动时还会打印 Koishi-CE 启动横幅与字符画(仅 TTY,输出被重定向时不打印)。
|
|
37
37
|
|
|
38
38
|
## 守护进程机制
|
|
39
39
|
|
|
40
|
-
`koishi start` 是守护父进程:以 Bun.spawn
|
|
40
|
+
`koishi start` 是守护父进程:以 Bun.spawn 拉起工作进程,工作进程运行时崩溃后默认自动重启;IPC 心跳为可选配置(默认关闭,开启后超时未收到心跳将强制终止工作进程)。退出码约定:51 = 工作进程请求整体重启(配置文件或框架依赖变更),52 = 请求退出。工作进程内由 loader 读取配置、预检服务器端口(被占则干净退出)、创建应用并挂载 daemon 插件。
|
|
41
41
|
|
|
42
42
|
## 编程式用法
|
|
43
43
|
|
|
@@ -72,9 +72,9 @@ bunx create-koishi-ce my-app
|
|
|
72
72
|
|
|
73
73
|
## CLI
|
|
74
74
|
|
|
75
|
-
`koishi start [file]` (alias `run`) starts the app, with options `--debug [namespace]`, `--log-level [level]` (default 2) and `--log-time [format]`. Running `koishi` without a subcommand prints help.
|
|
75
|
+
`koishi start [file]` (alias `run`) starts the app, with options `--debug [namespace]`, `--log-level [level]` (default 2) and `--log-time [format]`. Running `koishi` without a subcommand prints help. When started in an interactive terminal, a Koishi-CE startup banner with ASCII art is printed (TTY only, suppressed when output is redirected).
|
|
76
76
|
|
|
77
|
-
The `start` command is a daemon parent: it spawns the worker via Bun.spawn
|
|
77
|
+
The `start` command is a daemon parent: it spawns the worker via Bun.spawn and restarts it by default after runtime crashes; IPC heartbeats are optional (off by default — once enabled, a missed heartbeat force-kills the worker). Exit code 51 asks for a full restart, 52 asks to quit. The worker reads the config through the loader, prechecks server ports, creates the app and mounts the daemon plugin.
|
|
78
78
|
|
|
79
79
|
## Programmatic usage
|
|
80
80
|
|
package/lib/cli/index.mjs
CHANGED
package/lib/worker/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { t as Loader } from "../index-B9rkkFue.js";
|
|
|
2
2
|
import { Context, Dict, Schema } from "@koishi-ce/core";
|
|
3
3
|
export * from "@koishi-ce/core";
|
|
4
4
|
export * from "@koishi-ce/loader";
|
|
5
|
-
|
|
5
|
+
declare namespace daemon_d_exports {
|
|
6
|
+
export { Config$1 as Config, apply, name };
|
|
7
|
+
}
|
|
6
8
|
/** 守护设置 */
|
|
7
9
|
interface Config$1 {
|
|
8
10
|
/** 运行时崩溃后是否自动重启 */
|
|
@@ -13,8 +15,11 @@ interface Config$1 {
|
|
|
13
15
|
heartbeatTimeout?: number;
|
|
14
16
|
}
|
|
15
17
|
declare const Config$1: Schema<Config$1>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
declare const name = "daemon";
|
|
19
|
+
declare function apply(ctx: Context, config?: Config$1): void;
|
|
20
|
+
declare namespace logger_d_exports {
|
|
21
|
+
export { Config, prepare };
|
|
22
|
+
}
|
|
18
23
|
/**
|
|
19
24
|
* 配置文件形态的日志等级表。
|
|
20
25
|
* 与 @koishi-ce/utils 中的实现略有差异:此处不强制用户提供 base 等级,
|
|
@@ -37,6 +42,15 @@ interface Config {
|
|
|
37
42
|
showTime?: string | boolean;
|
|
38
43
|
}
|
|
39
44
|
declare const Config: Schema<Config>;
|
|
45
|
+
/**
|
|
46
|
+
* 在应用启动前应用日志配置。
|
|
47
|
+
*
|
|
48
|
+
* 处理顺序:配置文件中的等级表 → 时间格式与时间差显示 → CLI 环境变量覆盖 →
|
|
49
|
+
* 补全所有分组的 base 等级 → KOISHI_DEBUG 指定的命名空间设为 DEBUG 级。
|
|
50
|
+
*
|
|
51
|
+
* @param config 来自配置文件 logger 节点的设置
|
|
52
|
+
*/
|
|
53
|
+
declare function prepare(config?: Config): void;
|
|
40
54
|
//#endregion
|
|
41
55
|
//#region src/worker/index.d.ts
|
|
42
56
|
declare module "@koishi-ce/core" {
|
package/lib/worker/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@koishi-ce/koishi",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Cross-Platform Chatbot Framework Made with Love",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.9",
|
|
6
6
|
"main": "lib/index.mjs",
|
|
7
7
|
"module": "lib/index.mjs",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@koishi-ce/core": "^1.
|
|
64
|
+
"@koishi-ce/core": "^1.1.1",
|
|
65
65
|
"@koishi-ce/loader": "^1.0.6",
|
|
66
|
-
"@koishi-ce/plugin-http": "^1.0.
|
|
67
|
-
"@koishi-ce/plugin-proxy-agent": "^1.0.
|
|
66
|
+
"@koishi-ce/plugin-http": "^1.0.1",
|
|
67
|
+
"@koishi-ce/plugin-proxy-agent": "^1.0.1",
|
|
68
68
|
"@koishi-ce/plugin-server": "^1.0.1",
|
|
69
69
|
"@koishi-ce/utils": "^1.0.0",
|
|
70
70
|
"cac": "^7.0.0",
|