@koishi-ce/koishi 1.0.2 → 1.0.4

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 ADDED
@@ -0,0 +1,89 @@
1
+ # @koishi-ce/koishi
2
+
3
+ **简体中文** | [English](#english)
4
+
5
+ Koishi 的社区再发行版(Community Edition)主包与命令行宿主,来自 [Koishi-CE/koishi](https://github.com/Koishi-CE/koishi)——将上游 [koishijs/koishi](https://github.com/koishijs/koishi) 与 [koishijs/webui](https://github.com/koishijs/webui) 合并重构的单一 Bun workspace 单仓库。本包入口与上游 `koishi` 主包同构:合并再导出 [`@koishi-ce/core`](https://github.com/Koishi-CE/koishi/tree/main/packages/node/core) 与 [`@koishi-ce/loader`](https://github.com/Koishi-CE/koishi/tree/main/packages/node/loader),并内置 `koishi` 命令与守护进程。
6
+
7
+ 命令名保持为 `koishi`,与上游用法一致。本项目与 Koishijs 官方组织无从属关系,感谢原作者 Shigma 及所有上游贡献者,相关声明见 [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE) 与 [docs/process/upstream.md](https://github.com/Koishi-CE/koishi/blob/main/docs/process/upstream.md)。
8
+
9
+ ## 安装与启动
10
+
11
+ ```bash
12
+ npm install -g @koishi-ce/koishi
13
+ koishi start
14
+ ```
15
+
16
+ 更推荐用脚手架创建完整项目(自带控制台、市场与热重载配置):
17
+
18
+ ```bash
19
+ bunx create-koishi-ce my-app
20
+ ```
21
+
22
+ ## 命令行
23
+
24
+ | 命令 | 说明 |
25
+ | --- | --- |
26
+ | `koishi start [file]`(别名 `run`) | 启动应用,`file` 为配置文件路径 |
27
+
28
+ 选项:
29
+
30
+ | 选项 | 默认值 | 说明 |
31
+ | --- | --- | --- |
32
+ | `--debug [namespace]` | - | 开启调试日志,可限定命名空间 |
33
+ | `--log-level [level]` | 2 | 日志等级 |
34
+ | `--log-time [format]` | - | 日志时间戳格式 |
35
+
36
+ 不带子命令运行 `koishi` 时输出帮助。
37
+
38
+ ## 守护进程机制
39
+
40
+ `koishi start` 是守护父进程:以 Bun.spawn 拉起工作进程并保持 IPC 心跳,心跳超时强制终止。退出码约定:51 = 工作进程请求整体重启(配置文件或框架依赖变更),52 = 请求退出。工作进程内由 loader 读取配置、预检服务器端口(被占则干净退出)、创建应用并挂载 daemon 插件。
41
+
42
+ ## 编程式用法
43
+
44
+ ```ts
45
+ import { App, defineConfig, NodeLoader } from "@koishi-ce/koishi";
46
+ ```
47
+
48
+ 对 `koishi` / `@koishijs/core` / `@koishijs/loader` 三个上游名的兼容由 [`@koishi-ce/koishi-shim`](https://github.com/Koishi-CE/koishi/tree/main/packages/shim) 以 npm alias 承担,社区插件无需改动即可在 CE 项目中运行,详见 [packages/shim/README.md](https://github.com/Koishi-CE/koishi/blob/main/packages/shim/README.md)。
49
+
50
+ ## 许可证
51
+
52
+ [MIT](https://github.com/Koishi-CE/koishi/blob/main/LICENSE)。本包是上游 koishijs/koishi 的社区再分发,版权归属见 [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE)。
53
+
54
+ ---
55
+
56
+ ## English
57
+
58
+ The Community Edition main package and CLI host of Koishi, from [Koishi-CE/koishi](https://github.com/Koishi-CE/koishi) — a single Bun-workspace monorepo merging the upstream [koishijs/koishi](https://github.com/koishijs/koishi) and [koishijs/webui](https://github.com/koishijs/webui). Its entry mirrors the upstream `koishi` package: a merged re-export of `@koishi-ce/core` and `@koishi-ce/loader`, plus the `koishi` command and a daemon. Not affiliated with the Koishijs organization; see [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE) and [docs/process/upstream.md](https://github.com/Koishi-CE/koishi/blob/main/docs/process/upstream.md).
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ npm install -g @koishi-ce/koishi
64
+ koishi start
65
+ ```
66
+
67
+ Or scaffold a full project (console, market and HMR preconfigured):
68
+
69
+ ```bash
70
+ bunx create-koishi-ce my-app
71
+ ```
72
+
73
+ ## CLI
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.
76
+
77
+ The `start` command is a daemon parent: it spawns the worker via Bun.spawn with IPC heartbeats. 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
+
79
+ ## Programmatic usage
80
+
81
+ ```ts
82
+ import { App, defineConfig, NodeLoader } from "@koishi-ce/koishi";
83
+ ```
84
+
85
+ Compatibility with the upstream names `koishi` / `@koishijs/core` / `@koishijs/loader` is provided by `@koishi-ce/koishi-shim` via npm aliases, so community plugins run unmodified in CE projects — see [packages/shim/README.md](https://github.com/Koishi-CE/koishi/blob/main/packages/shim/README.md).
86
+
87
+ ## License
88
+
89
+ [MIT](https://github.com/Koishi-CE/koishi/blob/main/LICENSE). Community redistribution of upstream koishijs/koishi; see [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE) for attribution.
package/lib/cli/index.mjs CHANGED
@@ -7,7 +7,7 @@ var package_default = {
7
7
  name: "@koishi-ce/koishi",
8
8
  type: "module",
9
9
  description: "Cross-Platform Chatbot Framework Made with Love",
10
- version: "1.0.2",
10
+ version: "1.0.4",
11
11
  main: "lib/index.mjs",
12
12
  module: "lib/index.mjs",
13
13
  types: "lib/index.d.ts",
@@ -58,7 +58,6 @@ var package_default = {
58
58
  "@koishi-ce/plugin-proxy-agent": "workspace:*",
59
59
  "@koishi-ce/plugin-server": "workspace:*",
60
60
  "@koishi-ce/utils": "workspace:*",
61
- "@satorijs/core": "^4.6.0",
62
61
  "cac": "^7.0.0",
63
62
  "kleur": "^4.1.5"
64
63
  }
@@ -0,0 +1,2 @@
1
+ import loader_default, { Loader as Loader$1 } from "@koishi-ce/loader";
2
+ export { loader_default as n, Loader$1 as t };
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Loader } from "./index-CGzU40S-.js";
2
- export * from "@koishi-ce/loader";
1
+ import { n as loader_default, t as Loader } from "./index-B9rkkFue.js";
3
2
  export * from "@koishi-ce/core";
4
- export { Loader };
3
+ export * from "@koishi-ce/loader";
4
+ export { Loader, loader_default as default };
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Loader } from "./src-1HtO5Rx4.mjs";
2
- export * from "@koishi-ce/loader";
1
+ import { n as loader_default, t as Loader } from "./src-BnUZO8R-.mjs";
3
2
  export * from "@koishi-ce/core";
4
- export { Loader };
3
+ export * from "@koishi-ce/loader";
4
+ export { Loader, loader_default as default };
@@ -0,0 +1,3 @@
1
+ import "./rolldown-runtime-BBjsoOtd.mjs";
2
+ import loader_default, { Loader as Loader$1 } from "@koishi-ce/loader";
3
+ export { loader_default as n, Loader$1 as t };
@@ -1,7 +1,7 @@
1
- import { t as Loader } from "../index-CGzU40S-.js";
1
+ import { t as Loader } from "../index-B9rkkFue.js";
2
2
  import { Context, Dict, Schema } from "@koishi-ce/core";
3
- export * from "@koishi-ce/loader";
4
3
  export * from "@koishi-ce/core";
4
+ export * from "@koishi-ce/loader";
5
5
  //#region src/worker/daemon.d.ts
6
6
  /** 守护设置 */
7
7
  interface Config$1 {
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-BBjsoOtd.mjs";
2
- import { t as Loader } from "../src-1HtO5Rx4.mjs";
3
- import Loader$1, { resolvePlugin } from "@koishi-ce/loader";
2
+ import { t as Loader } from "../src-BnUZO8R-.mjs";
4
3
  import { Context, Logger, Schema, Time, defineProperty } from "@koishi-ce/core";
4
+ import Loader$1, { resolvePlugin } from "@koishi-ce/loader";
5
5
  import { existsSync, readFileSync } from "node:fs";
6
6
  import net from "node:net";
7
7
  import { dirname, resolve } from "node:path";
8
- export * from "@koishi-ce/loader";
9
8
  export * from "@koishi-ce/core";
9
+ export * from "@koishi-ce/loader";
10
10
  //#region src/worker/daemon.ts
11
11
  /**
12
12
  * daemon 插件:worker 子进程侧的守护逻辑。
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.2",
5
+ "version": "1.0.4",
6
6
  "main": "lib/index.mjs",
7
7
  "module": "lib/index.mjs",
8
8
  "types": "lib/index.d.ts",
@@ -62,12 +62,11 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@koishi-ce/core": "^1.0.0",
65
- "@koishi-ce/loader": "^1.0.2",
65
+ "@koishi-ce/loader": "^1.0.4",
66
66
  "@koishi-ce/plugin-http": "^1.0.0",
67
67
  "@koishi-ce/plugin-proxy-agent": "^1.0.0",
68
68
  "@koishi-ce/plugin-server": "^1.0.0",
69
69
  "@koishi-ce/utils": "^1.0.0",
70
- "@satorijs/core": "^4.6.0",
71
70
  "cac": "^7.0.0",
72
71
  "kleur": "^4.1.5"
73
72
  }
package/src/cli/index.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
+ // SPDX-License-Identifier: MIT
4
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
5
+ // Copyright (c) 2026-present Koishi-CE contributors.
6
+
3
7
  /**
4
8
  * Koishi 命令行入口。
5
9
  *
package/src/cli/start.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * `koishi start` 子命令实现:守护进程(daemon)侧的父进程逻辑。
3
7
  *
package/src/index.ts CHANGED
@@ -1,12 +1,17 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * `@koishi-ce/koishi` 包入口。
3
7
  *
4
8
  * 本文件专为不使用 CLI 的用户准备:将 core 与 loader 两包的导出合并再分发,
5
9
  * 并默认导出 NodeLoader 实现,使开发者可以直接以编程方式启动 Koishi。
10
+ * 结构与上游 koishi 主包入口同构(core + loader 合并再导出)——
11
+ * `packages/shim/koishi-shim` 据此以单一 re-export 兼任 koishi 裸名与
12
+ * `@koishijs/core` / `@koishijs/loader` 三个上游名的下游 alias 目标。
6
13
  */
7
14
 
8
- import Loader from "@koishi-ce/loader";
9
-
10
15
  export * from "@koishi-ce/core";
11
16
  export * from "@koishi-ce/loader";
12
- export { Loader };
17
+ export { default, Loader } from "@koishi-ce/loader";
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * daemon 插件:worker 子进程侧的守护逻辑。
3
7
  *
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * worker 子进程入口:真正启动 Koishi 应用的地方。
3
7
  *
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * 日志配置的解析与应用(worker 侧)。
3
7
  *
@@ -1,2 +0,0 @@
1
- import Loader$1 from "@koishi-ce/loader";
2
- export { Loader$1 as t };
@@ -1,11 +0,0 @@
1
- import "./rolldown-runtime-BBjsoOtd.mjs";
2
- import Loader$1 from "@koishi-ce/loader";
3
- //#region src/index.ts
4
- /**
5
- * `@koishi-ce/koishi` 包入口。
6
- *
7
- * 本文件专为不使用 CLI 的用户准备:将 core 与 loader 两包的导出合并再分发,
8
- * 并默认导出 NodeLoader 实现,使开发者可以直接以编程方式启动 Koishi。
9
- */
10
- //#endregion
11
- export { Loader$1 as t };
package/readme.md DELETED
@@ -1,26 +0,0 @@
1
- <div align="center">
2
- <a href="https://koishi.chat/" target="_blank">
3
- <img width="160" src="https://koishi.chat/logo.png" alt="logo">
4
- </a>
5
- <h1 id="koishi"><a href="https://github.com/Koishi-CE/koishi" target="_blank">Koishi CE</a></h1>
6
-
7
- [![npm](https://img.shields.io/npm/v/@koishi-ce/koishi?style=flat-square)](https://www.npmjs.com/package/@koishi-ce/koishi)
8
- [![GitHub](https://img.shields.io/github/license/Koishi-CE/koishi?style=flat-square)](https://github.com/Koishi-CE/koishi/blob/main/LICENSE)
9
-
10
- </div>
11
-
12
- `@koishi-ce/koishi` 是 [Koishi](https://koishi.chat) 的社区再发行版 (Community Edition) 命令行工具,来自 [Koishi-CE/koishi](https://github.com/Koishi-CE/koishi) —— 将 Koishi 核心与 webui 合并重构的单一 Bun workspace 单仓库。
13
-
14
- 命令名保持为 `koishi`,与上游用法一致:
15
-
16
- ```bash
17
- npm install -g @koishi-ce/koishi
18
- ```
19
-
20
- > 本项目与 Koishijs 官方组织无从属关系。感谢原作者 Shigma 及所有上游贡献者,相关声明见仓库根目录的 NOTICE 与 UPSTREAM 文件。
21
-
22
- ## 许可证
23
-
24
- 本包基于 [MIT](./LICENSE) 协议开源。
25
-
26
- Copyright © 2019-2023, Shigma; Koishi-CE contributors