@koishi-ce/client 1.1.1 → 1.2.1

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/app/home/home.vue CHANGED
@@ -3,17 +3,14 @@
3
3
  <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
4
 
5
5
  <!--
6
- 控制台首页:WebSocket 就绪后渲染 "home" 插槽内容(默认为欢迎卡片),
6
+ 控制台首页:WebSocket 就绪后渲染 "home" 插槽内容(默认为空——欢迎卡
7
+ 由 @koishi-ce/plugin-welcome 提供,统计面板由 plugin-analytics 提供),
7
8
  未连接时显示连接提示卡片。
8
9
  -->
9
10
  <template>
10
11
  <k-layout :main="`darker page-home${socket ? '' : ' loading'}`">
11
12
  <el-scrollbar v-if="socket">
12
- <k-slot name="home">
13
- <k-slot-item :order="1000">
14
- <welcome></welcome>
15
- </k-slot-item>
16
- </k-slot>
13
+ <k-slot name="home"></k-slot>
17
14
  </el-scrollbar>
18
15
  <div v-else>
19
16
  <k-card class="connect">{{ t('home.connecting') }}</k-card>
@@ -24,7 +21,6 @@
24
21
  <script lang="ts" setup>
25
22
  import { global, socket } from "@koishi-ce/client";
26
23
  import { useI18n } from "vue-i18n";
27
- import Welcome from "./welcome.vue";
28
24
 
29
25
  const { t } = useI18n();
30
26
  </script>
@@ -39,10 +35,6 @@ const { t } = useI18n();
39
35
  justify-content: center;
40
36
  }
41
37
 
42
- .k-card.welcome {
43
- margin: var(--card-margin);
44
- }
45
-
46
38
  .k-card.connect {
47
39
  width: 400px;
48
40
  max-width: 400px;
package/app/home/index.ts CHANGED
@@ -3,7 +3,8 @@
3
3
  // Copyright (c) 2026-present Koishi-CE contributors.
4
4
 
5
5
  /**
6
- * 首页插件:将 welcome 欢迎页注册为根路由 "/"
6
+ * 首页插件:将首页注册为根路由 "/",内容为 home 插槽
7
+ * (欢迎卡由 @koishi-ce/plugin-welcome 提供)。
7
8
  * order 取极大值(活动栏 top 组渲染时按 order 逆序输出,故首页位于最顶部)。
8
9
  */
9
10
 
@@ -7,15 +7,6 @@ pages:
7
7
  settings: Benutzereinstellungen
8
8
  home:
9
9
  connecting: Verbindung zum Koishi-Server wird hergestellt...
10
- welcome:
11
- title: Willkommen bei Koishi!
12
- description: Ihr Chatbot ist einsatzbereit. Wählen Sie eine der Optionen unten, um Ihre Koishi-Reise zu beginnen.
13
- docs:
14
- title: Dokumentation
15
- description: Lesen Sie die offizielle Dokumentation. Sie enthält alles, was Sie wissen möchten.
16
- forum:
17
- title: Forum
18
- description: Tauschen Sie sich im Forum mit anderen Nutzern aus. Wenn Probleme auftreten, finden Sie dort Hilfe.
19
10
  settings:
20
11
  general: Allgemeine Einstellungen
21
12
  appearance: Erscheinungsbild
@@ -7,15 +7,6 @@ pages:
7
7
  settings: User Settings
8
8
  home:
9
9
  connecting: Connecting to the Koishi server...
10
- welcome:
11
- title: Welcome to Koishi!
12
- description: Your chatbot is ready to go. Pick any option below to start your Koishi journey.
13
- docs:
14
- title: Documentation
15
- description: Read the official documentation, which contains everything you want to know.
16
- forum:
17
- title: Forum
18
- description: Talk with other users on the forum. If you run into problems, you can always ask for help there.
19
10
  settings:
20
11
  general: General Settings
21
12
  appearance: Appearance
@@ -7,15 +7,6 @@ pages:
7
7
  settings: Paramètres utilisateur
8
8
  home:
9
9
  connecting: Connexion au serveur Koishi...
10
- welcome:
11
- title: Bienvenue sur Koishi !
12
- description: Votre chatbot est prêt. Choisissez une option ci-dessous pour commencer votre aventure Koishi.
13
- docs:
14
- title: Documentation
15
- description: "Lisez la documentation officielle : elle contient tout ce que vous voulez savoir."
16
- forum:
17
- title: Forum
18
- description: Échangez avec d'autres utilisateurs sur le forum. Si vous rencontrez des problèmes, vous pouvez y demander de l'aide.
19
10
  settings:
20
11
  general: Paramètres généraux
21
12
  appearance: Apparence
@@ -7,15 +7,6 @@ pages:
7
7
  settings: ユーザー設定
8
8
  home:
9
9
  connecting: Koishi サーバーに接続しています……
10
- welcome:
11
- title: Koishi へようこそ!
12
- description: ボットの準備が整いました。以下の選択肢からどれかを選んで、Koishi の旅を始めましょう。
13
- docs:
14
- title: ドキュメントを読む
15
- description: 公式ドキュメントを読み始めましょう。知りたいことがすべて書かれています。
16
- forum:
17
- title: フォーラムへ
18
- description: フォーラムで他のユーザーと交流しましょう。問題が起きたときは、ここで助けを求めることができます。
19
10
  settings:
20
11
  general: 一般設定
21
12
  appearance: 外観設定
@@ -7,15 +7,6 @@ pages:
7
7
  settings: Настройки пользователя
8
8
  home:
9
9
  connecting: Подключение к серверу Koishi...
10
- welcome:
11
- title: Добро пожаловать в Koishi!
12
- description: Ваш бот готов к работе. Выберите любой пункт ниже, чтобы начать путешествие по Koishi.
13
- docs:
14
- title: Документация
15
- description: Начните читать официальную документацию — в ней есть всё, что вы хотите узнать.
16
- forum:
17
- title: Форум
18
- description: Общайтесь с другими пользователями на форуме. Если возникнут проблемы, здесь можно обратиться за помощью.
19
10
  settings:
20
11
  general: Общие настройки
21
12
  appearance: Оформление
@@ -7,15 +7,6 @@ pages:
7
7
  settings: 用户设置
8
8
  home:
9
9
  connecting: 正在连接到 Koishi 服务器……
10
- welcome:
11
- title: 欢迎使用 Koishi!
12
- description: 你的机器人已经准备就绪。点击下面的任一选项,开启你的 Koishi 之旅吧。
13
- docs:
14
- title: 阅读文档
15
- description: 开始阅读官方文档。官方文档里包含了你想要了解的全部内容。
16
- forum:
17
- title: 前往论坛
18
- description: 前往论坛与其他用户交流。如果你遇到了问题,可以在这里寻求帮助。
19
10
  settings:
20
11
  general: 通用设置
21
12
  appearance: 外观设置
@@ -7,15 +7,6 @@ pages:
7
7
  settings: 使用者設定
8
8
  home:
9
9
  connecting: 正在連線到 Koishi 伺服器……
10
- welcome:
11
- title: 歡迎使用 Koishi!
12
- description: 你的機器人已經準備就緒。點擊下面的任一選項,開啟你的 Koishi 之旅吧。
13
- docs:
14
- title: 閱讀文件
15
- description: 開始閱讀官方文件。官方文件裡包含了你想要了解的全部內容。
16
- forum:
17
- title: 前往論壇
18
- description: 前往論壇與其他使用者交流。如果你遇到了問題,可以在這裡尋求幫助。
19
10
  settings:
20
11
  general: 一般設定
21
12
  appearance: 外觀設定
package/lib/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as build } from "./src-HOy7ib_t.mjs";
2
+ import { t as build } from "./src-D1GR_-AS.mjs";
3
3
  import { existsSync } from "node:fs";
4
4
  import { resolve } from "node:path";
5
5
  //#endregion
@@ -16,7 +16,7 @@ import { resolve } from "node:path";
16
16
  const { version } = {
17
17
  name: "@koishi-ce/client",
18
18
  description: "Koishi Console Client",
19
- version: "1.1.1",
19
+ version: "1.2.1",
20
20
  type: "module",
21
21
  main: "client/index.ts",
22
22
  exports: {
@@ -65,6 +65,7 @@ const { version } = {
65
65
  "element-plus": "^2.14.5",
66
66
  "marked-vue": "^1.3.0",
67
67
  "sass-embedded": "^1.102.0",
68
+ "typescript": "^5.0.0",
68
69
  "unocss": "^66.8.1",
69
70
  "vite": "^8.2.2",
70
71
  "vue": "^3.5.42",
package/lib/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createServer, t as build } from "./src-HOy7ib_t.mjs";
1
+ import { n as createServer, t as build } from "./src-D1GR_-AS.mjs";
2
2
  export { build, createServer };
@@ -34,7 +34,19 @@ async function collectWorkspaceAliases() {
34
34
  return aliases;
35
35
  }
36
36
  const workspaceAliases = await collectWorkspaceAliases();
37
- const runtimeShimPath = (workspaceAliases["@koishi-ce/components"] ?? "").replace(/client\/index\.ts$/, "client/schemastery-vue-runtime.ts");
37
+ function locateRuntimeShim() {
38
+ const fromAlias = (workspaceAliases["@koishi-ce/components"] ?? "").replace(/client\/index\.ts$/, "client/schemastery-vue-runtime.ts");
39
+ if (fromAlias) return fromAlias;
40
+ let dir = resolve(import.meta.dir, "..");
41
+ while (true) {
42
+ const candidate = `${dir}/node_modules/@koishi-ce/components/client/schemastery-vue-runtime.ts`;
43
+ if (existsSync(candidate)) return candidate.replace(/\\/g, "/");
44
+ const parent = resolve(dir, "..");
45
+ if (parent === dir) return "";
46
+ dir = parent;
47
+ }
48
+ }
49
+ const runtimeShimPath = locateRuntimeShim();
38
50
  /**
39
51
  * 构建单个 webui 插件的前端产物。
40
52
  *
@@ -90,7 +102,7 @@ async function build(root, config = {}) {
90
102
  "vue-i18n": "@koishi-ce/client",
91
103
  "@koishi-ce/components": "@koishi-ce/client",
92
104
  "@koishijs/components": workspaceAliases["@koishi-ce/components"],
93
- "schemastery-vue/client": runtimeShimPath
105
+ ...runtimeShimPath ? { "schemastery-vue/client": runtimeShimPath } : {}
94
106
  } },
95
107
  define: { "process.env.NODE_ENV": "\"production\"" }
96
108
  }, config));
@@ -149,18 +161,22 @@ async function createServer(baseDir, config = {}) {
149
161
  "../vue.js": "vue",
150
162
  "../vue-router.js": "vue-router",
151
163
  "../vueuse.js": "@vueuse/core",
152
- "schemastery-vue/client": runtimeShimPath
164
+ ...runtimeShimPath ? { "schemastery-vue/client": runtimeShimPath } : {}
153
165
  }
154
166
  },
155
- optimizeDeps: { include: [
156
- "vue",
157
- "vue-router",
158
- "element-plus",
159
- "@vueuse/core",
160
- "@popperjs/core",
161
- "marked",
162
- "xss"
163
- ] },
167
+ optimizeDeps: {
168
+ include: [
169
+ "vue",
170
+ "vue-router",
171
+ "element-plus",
172
+ "@vueuse/core",
173
+ "@popperjs/core",
174
+ "marked",
175
+ "xss",
176
+ "reggol"
177
+ ],
178
+ exclude: ["@koishi-ce/client", "@koishi-ce/components"]
179
+ },
164
180
  build: { rollupOptions: { input: `${root}/index.html` } }
165
181
  }, config));
166
182
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@koishi-ce/client",
3
3
  "description": "Koishi Console Client",
4
- "version": "1.1.1",
4
+ "version": "1.2.1",
5
5
  "type": "module",
6
6
  "main": "client/index.ts",
7
7
  "exports": {
@@ -48,7 +48,7 @@
48
48
  "build"
49
49
  ],
50
50
  "dependencies": {
51
- "@koishi-ce/components": "^1.0.2",
51
+ "@koishi-ce/components": "^1.0.3",
52
52
  "@satorijs/protocol": "^1.7.0",
53
53
  "@vitejs/plugin-vue": "^6.0.8",
54
54
  "@vueuse/core": "^14.4.0",
@@ -57,6 +57,7 @@
57
57
  "element-plus": "^2.14.5",
58
58
  "marked-vue": "^1.3.0",
59
59
  "sass-embedded": "^1.102.0",
60
+ "typescript": "^5.0.0",
60
61
  "unocss": "^66.8.1",
61
62
  "vite": "^8.2.2",
62
63
  "vue": "^3.5.42",
@@ -65,6 +66,6 @@
65
66
  },
66
67
  "devDependencies": {
67
68
  "@koishi-ce/koishi": "^1.0.11",
68
- "@koishi-ce/plugin-console": "^1.2.0"
69
+ "@koishi-ce/plugin-console": "^1.3.1"
69
70
  }
70
71
  }
package/src/index.ts CHANGED
@@ -82,14 +82,34 @@ async function collectWorkspaceAliases(): Promise<
82
82
  const workspaceAliases = await collectWorkspaceAliases();
83
83
 
84
84
  // 虚拟子路径 "schemastery-vue/client" 的运行时载体(补齐真实包缺失的
85
- // SchemaBase 具名导出)绝对路径,从 components 包的工作区别名推导;
86
- // 类型面由根 tsconfig.client.json 的 paths 解析到 schemastery-vue-client.ts
87
- const runtimeShimPath = (
88
- workspaceAliases["@koishi-ce/components"] ?? ""
89
- ).replace(
90
- /client\/index\.ts$/,
91
- "client/schemastery-vue-runtime.ts",
92
- );
85
+ // SchemaBase 具名导出)绝对路径;类型面由根 tsconfig.client.json
86
+ // paths 解析到 schemastery-vue-client.ts
87
+ // 优先从 components 包的工作区别名推导;下游(npm 安装)形态下工作区
88
+ // 别名表为空,从本包根向父级逐级 node_modules 纯 fs 探测 components
89
+ // (不走解析 API:Bun 会把失败的解析按父目录快照缓存,刚装好的包可能
90
+ // 探不到)。两者都失败时返回空串,别名表须省略该键——空串值的 alias
91
+ // 会让 vite/rolldown 以空 specifier 解析直接报错。
92
+ function locateRuntimeShim(): string {
93
+ const fromAlias = (
94
+ workspaceAliases["@koishi-ce/components"] ?? ""
95
+ ).replace(
96
+ /client\/index\.ts$/,
97
+ "client/schemastery-vue-runtime.ts",
98
+ );
99
+ if (fromAlias) return fromAlias;
100
+ // 源码形态(src/)与产物形态(lib/)都在包根下一级,先回到包根
101
+ let dir = resolve(import.meta.dir, "..");
102
+ while (true) {
103
+ const candidate = `${dir}/node_modules/@koishi-ce/components/client/schemastery-vue-runtime.ts`;
104
+ if (existsSync(candidate))
105
+ return candidate.replace(/\\/g, "/");
106
+ const parent = resolve(dir, "..");
107
+ if (parent === dir) return "";
108
+ dir = parent;
109
+ }
110
+ }
111
+
112
+ const runtimeShimPath = locateRuntimeShim();
93
113
 
94
114
  /**
95
115
  * 构建单个 webui 插件的前端产物。
@@ -208,8 +228,13 @@ export async function build(
208
228
  workspaceAliases["@koishi-ce/components"],
209
229
  // 虚拟子路径的运行时载体(补齐真实包缺失的 SchemaBase
210
230
  // 具名导出);类型面由 tsconfig.client.json 的 paths
211
- // 解析到 schemastery-vue-client.ts
212
- "schemastery-vue/client": runtimeShimPath,
231
+ // 解析到 schemastery-vue-client.ts。下游探测失败时
232
+ // 省略该键(空串值会炸 resolve)
233
+ ...(runtimeShimPath
234
+ ? {
235
+ "schemastery-vue/client": runtimeShimPath,
236
+ }
237
+ : {}),
213
238
  },
214
239
  },
215
240
  define: {
@@ -314,8 +339,13 @@ export async function createServer(
314
339
  "../vue.js": "vue",
315
340
  "../vue-router.js": "vue-router",
316
341
  "../vueuse.js": "@vueuse/core",
317
- // 虚拟子路径的运行时载体(同 build 的别名说明)
318
- "schemastery-vue/client": runtimeShimPath,
342
+ // 虚拟子路径的运行时载体(同 build 的别名说明);
343
+ // 下游探测失败时省略该键(空串值会炸 resolve)
344
+ ...(runtimeShimPath
345
+ ? {
346
+ "schemastery-vue/client": runtimeShimPath,
347
+ }
348
+ : {}),
319
349
  },
320
350
  },
321
351
  optimizeDeps: {
@@ -327,6 +357,20 @@ export async function createServer(
327
357
  "@popperjs/core",
328
358
  "marked",
329
359
  "xss",
360
+ // logger 的前端值导入 reggol,其 browser 入口 external 了
361
+ // CJS 依赖 object-inspect;不经预打包裸 ESM 导入 CJS 会
362
+ // 报「does not provide an export named 'default'」
363
+ "reggol",
364
+ ],
365
+ // 宿主与组件库以 TS 源码 + .yml 词典的形态发布,必须走
366
+ // dev transform 管道逐文件服务(yaml 插件在此生效);
367
+ // 一旦落入依赖预打包,rolldown 会把 .yml 当 JS 解析,
368
+ // 直接报 PARSE_ERROR。工作区内两者经工作区别名映射为
369
+ // 绝对路径、天然不进 optimizer;下游 npm 安装形态下别名
370
+ // 表为空、以裸包名参与解析,须在此显式排除
371
+ exclude: [
372
+ "@koishi-ce/client",
373
+ "@koishi-ce/components",
330
374
  ],
331
375
  },
332
376
  build: {
@@ -1,98 +0,0 @@
1
- <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
- <!-- Copyright (c) 2019-present Shigma and Koishijs contributors. -->
3
- <!-- Copyright (c) 2026-present Koishi-CE contributors. -->
4
-
5
- <!--
6
- 欢迎卡片:文档 / 社区论坛等入口链接。
7
- 文案走宿主全局词典(client/locales/,7 语种),
8
- 其余扩展可通过 "welcome-choice" 插槽追加自定义入口。
9
- -->
10
- <template>
11
- <div class="k-card welcome">
12
- <h1>{{ t('welcome.title') }}</h1>
13
- <p>{{ t('welcome.description') }}</p>
14
- <div class="choices">
15
- <k-slot name="welcome-choice">
16
- <k-slot-item :order="1000">
17
- <a class="choice" href="https://koishi.chat" rel="noopener noreferer" target="_blank">
18
- <h2>{{ t('welcome.docs.title') }}</h2>
19
- <p>{{ t('welcome.docs.description') }}</p>
20
- </a>
21
- </k-slot-item>
22
- <k-slot-item :order="500">
23
- <a class="choice" href="https://k.ilharp.cc" rel="noopener noreferer" target="_blank">
24
- <h2>{{ t('welcome.forum.title') }}</h2>
25
- <p>{{ t('welcome.forum.description') }}</p>
26
- </a>
27
- </k-slot-item>
28
- </k-slot>
29
- </div>
30
- </div>
31
- </template>
32
-
33
- <script lang="ts" setup>
34
- import { useI18n } from "vue-i18n";
35
-
36
- // 全局 composer:词典由宿主 $i18n 服务在挂载前注入
37
- const { t } = useI18n();
38
- </script>
39
-
40
- <style lang="scss">
41
-
42
- .page-home .welcome {
43
- --welcome-title: 2.5rem;
44
- --welcome-padding: 3rem 3rem;
45
- --welcome-choice-padding: 0.5rem 1.5rem;
46
- --welcome-gap: 2rem;
47
-
48
- padding: var(--welcome-padding);
49
-
50
- h1 {
51
- font-size: var(--welcome-title);
52
- margin-top: 0;
53
- }
54
-
55
- h1 + p {
56
- margin: var(--welcome-gap) 0;
57
- }
58
-
59
- .choices {
60
- display: flex;
61
- flex-flow: row wrap;
62
- gap: var(--welcome-gap);
63
- }
64
-
65
- .choice {
66
- flex: 1 0 auto;
67
- display: inline-block;
68
- width: 280px;
69
- box-sizing: border-box;
70
- padding: var(--welcome-choice-padding);
71
- border: 1px solid var(--k-color-divider);
72
- border-radius: 6px;
73
- cursor: pointer;
74
- transition: var(--color-transition);
75
-
76
- &:hover {
77
- background-color: var(--k-side-color);
78
- }
79
-
80
- h2 {
81
- font-size: 1.25rem;
82
- margin-top: 1rem;
83
- }
84
-
85
- p {
86
- font-size: 0.9375rem;
87
- }
88
- }
89
-
90
- @media screen and (max-width: 768px) {
91
- --welcome-title: 2rem;
92
- --welcome-padding: 1.5rem 1.5rem;
93
- --welcome-gap: 1.5rem;
94
- --welcome-choice-padding: 0.5rem 1.5rem;
95
- }
96
- }
97
-
98
- </style>