node-karin 1.15.5 → 1.16.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/adapter-BqlH3u3X.mjs +218 -0
  3. package/dist/app-DdMQbBEY.mjs +4109 -0
  4. package/dist/cache-CPcPeo6N.mjs +163 -0
  5. package/dist/chunk-NzVPYdc1.mjs +21 -0
  6. package/dist/cli/index.cjs +10900 -1
  7. package/dist/cli/index.d.ts +1 -1
  8. package/dist/cli/index.mjs +10770 -10224
  9. package/dist/file-ZGuqNDd-.mjs +15987 -0
  10. package/dist/file-dGy9of8-.mjs +268 -0
  11. package/dist/fsSync-Cf5MWILk.mjs +65 -0
  12. package/dist/index.d.ts +12235 -12738
  13. package/dist/index.mjs +2054 -25247
  14. package/dist/internal-DupfycKE.mjs +597 -0
  15. package/dist/kv-DZp4UIxg.mjs +192 -0
  16. package/dist/module/art-template.d.ts +2 -13
  17. package/dist/module/art-template.mjs +3 -1
  18. package/dist/module/axios.d.ts +3 -2
  19. package/dist/module/axios.mjs +5 -2
  20. package/dist/module/chalk.d.ts +3 -2
  21. package/dist/module/chalk.mjs +5 -2
  22. package/dist/module/chokidar.d.ts +3 -2
  23. package/dist/module/chokidar.mjs +5 -2
  24. package/dist/module/express.d.ts +2 -1
  25. package/dist/module/express.mjs +3 -1
  26. package/dist/module/lodash.d.ts +2 -1
  27. package/dist/module/lodash.mjs +3 -1
  28. package/dist/module/log4js.d.ts +3 -2
  29. package/dist/module/log4js.mjs +5 -2
  30. package/dist/module/moment.d.ts +2 -1
  31. package/dist/module/moment.mjs +3 -1
  32. package/dist/module/node-schedule.d.ts +3 -2
  33. package/dist/module/node-schedule.mjs +5 -2
  34. package/dist/module/redis.d.ts +3 -2
  35. package/dist/module/redis.mjs +5 -2
  36. package/dist/module/sqlite3.d.ts +3 -2
  37. package/dist/module/sqlite3.mjs +5 -2
  38. package/dist/module/ws.d.ts +3 -2
  39. package/dist/module/ws.mjs +5 -2
  40. package/dist/module/yaml.d.ts +3 -2
  41. package/dist/module/yaml.mjs +5 -2
  42. package/dist/queue-CnKedaZA.mjs +70 -0
  43. package/dist/redis-aLJ7wbJH.mjs +1556 -0
  44. package/dist/render-DPqueDZr.mjs +170 -0
  45. package/dist/root.d.ts +46 -46
  46. package/dist/root.mjs +136 -93
  47. package/dist/router-zPSN9-tY.mjs +124 -0
  48. package/dist/server-DT64D-m-.mjs +38 -0
  49. package/dist/snapka-BTlnZOyI.mjs +450 -0
  50. package/dist/sqlite-Dcj9jlW9.mjs +307 -0
  51. package/dist/start/app.d.ts +1 -1
  52. package/dist/start/app.mjs +14 -7
  53. package/dist/start/index.d.ts +1 -1
  54. package/dist/start/index.mjs +325 -656
  55. package/dist/template-Djk6y0uC.mjs +133 -0
  56. package/dist/terminalManager-Lxa8Sm06.mjs +783 -0
  57. package/dist/uptime-C121X_rq.mjs +210 -0
  58. package/dist/web/{CompressaPRO-GX.woff2.br → CompressaPRO-GX.woff2} +0 -0
  59. package/dist/web/assets/css/style-CBB8wM_W.css +14880 -0
  60. package/dist/web/assets/js/entry-Blf4Trpx.js +258540 -0
  61. package/dist/web/{googleapis.woff2.br → googleapis.woff2} +0 -0
  62. package/dist/web/index.html +2 -15
  63. package/dist/web/karin.png +0 -0
  64. package/dist/web/sha256.min.js +9 -0
  65. package/dist/ws-BLDoC2gV.mjs +80 -0
  66. package/dist/ws-CcoWd3Ar.mjs +106 -0
  67. package/package.json +7 -7
  68. package/dist/global.d.d.ts +0 -68
  69. package/dist/types-hAhbXJDZ.d.ts +0 -109
  70. package/dist/web/assets/css/components-ep7vm38G.css +0 -1
  71. package/dist/web/assets/css/index-Dadvd9mn.css.br +0 -0
  72. package/dist/web/assets/css/vendor-editor-CFbL2ovg.css.br +0 -0
  73. package/dist/web/assets/css/vendor-others-ZgkIHsf0.css +0 -1
  74. package/dist/web/assets/js/components-CU2xw4lY.js.br +0 -0
  75. package/dist/web/assets/js/entry-Dvb7eYLE.js.br +0 -0
  76. package/dist/web/assets/js/hooks-CRfhs4ON.js.br +0 -0
  77. package/dist/web/assets/js/page-404.tsx-DYMd_RI_.js +0 -1
  78. package/dist/web/assets/js/page-dashboard-CG60V_Z-.js.br +0 -0
  79. package/dist/web/assets/js/page-loading.tsx-wY8a9me3.js.br +0 -0
  80. package/dist/web/assets/js/page-login.tsx-B54ZOEZB.js.br +0 -0
  81. package/dist/web/assets/js/utils-C9nWTSuo.js +0 -2
  82. package/dist/web/assets/js/vendor-editor-BmqYP7lh.js.br +0 -0
  83. package/dist/web/assets/js/vendor-heroui-ClBCy2zk.js.br +0 -0
  84. package/dist/web/assets/js/vendor-others-6GiMrjd4.js.br +0 -0
  85. package/dist/web/assets/js/vendor-react-Dc9jdQiK.js.br +0 -0
  86. package/dist/web/assets/js/vendor-ui-utils-D0xkboLL.js.br +0 -0
  87. package/dist/web/assets/js/vendor-visual-saF8KLH_.js.br +0 -0
  88. package/dist/web/karin.png.br +0 -0
  89. package/dist/web/sha256.min.js.br +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.16.1](https://github.com/KarinJS/Karin/compare/core-v1.16.0...core-v1.16.1) (2026-06-11)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * ci ([#659](https://github.com/KarinJS/Karin/issues/659)) ([f3f169f](https://github.com/KarinJS/Karin/commit/f3f169fa896427f70e4dbaaaa580598ca76c8dd3))
9
+
10
+ ## [1.16.0](https://github.com/KarinJS/Karin/compare/core-v1.15.5...core-v1.16.0) (2026-06-11)
11
+
12
+
13
+ ### ✨ Features
14
+
15
+ * **cli-Internal:** add LICENSE and tsdown configuration files ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
16
+ * **cli:** add LICENSE file ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
17
+ * **core:** add LICENSE and tsdown configuration files ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
18
+ * **create-karin:** add LICENSE and tsdown configuration files ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
19
+ * **karin-plugin-js:** add LICENSE file ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
20
+ * **karin-plugin-ts:** add LICENSE file ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
21
+ * **onebot:** add LICENSE and tsdown configuration files ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
22
+ * **pm2:** add LICENSE file ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
23
+ * **types:** add LICENSE file ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
24
+ * **web:** add PluginWebConfigPage component for custom plugin configuration ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
25
+ * **web:** add PluginWebConfigPage component for custom plugin configuration ([#654](https://github.com/KarinJS/Karin/issues/654)) ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
26
+ * 为PluginWebConfigPage添加sandbox属性以增强安全性 ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
27
+ * 更新resolveConfigPage逻辑,确保正确处理页面配置 ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
28
+
29
+
30
+ ### 🐛 Bug Fixes
31
+
32
+ * 优化PluginRow组件配置入口判断逻辑 ([faa725b](https://github.com/KarinJS/Karin/commit/faa725b36300a400c137ed9f625c34321a2198a0))
33
+
3
34
  ## [1.15.5](https://github.com/KarinJS/Karin/compare/core-v1.15.4...core-v1.15.5) (2026-04-25)
4
35
 
5
36
 
@@ -0,0 +1,218 @@
1
+ import { consolePath } from "./root.mjs";
2
+ import { Fr as createIdGenerator, Mr as text, Nr as AdapterBase, P as registerBot, U as contactFriend, W as contactGroup, X as senderGroup, Y as senderFriend, gt as createGroupMessage, li as buffer, rt as createFriendMessage, u as adapter } from "./file-ZGuqNDd-.mjs";
3
+ import { r as listeners } from "./internal-DupfycKE.mjs";
4
+ import { t as initRender } from "./render-DPqueDZr.mjs";
5
+ import path from "node:path";
6
+ import fs from "node:fs";
7
+
8
+ //#region src/adapter/input/index.ts
9
+ const getMessageId = createIdGenerator();
10
+ const getFileId = createIdGenerator();
11
+ const botID = "console";
12
+ /**
13
+ * 控制台交互适配器
14
+ * @class AdapterConsole
15
+ */
16
+ var AdapterConsole = class extends AdapterBase {
17
+ constructor() {
18
+ super();
19
+ listeners.on("karin:adapter:open", () => process.stdin.on("data", (data) => this.createEvent(data)));
20
+ listeners.on("karin:adapter:close", () => process.stdin.removeAllListeners("data"));
21
+ this.adapter.name = "@karinjs/console";
22
+ this.adapter.communication = "other";
23
+ this.adapter.platform = "other";
24
+ this.adapter.standard = "other";
25
+ this.adapter.version = process.env.KARIN_VERSION;
26
+ this.account.name = botID;
27
+ this.account.uid = botID;
28
+ this.account.uin = botID;
29
+ this.account.selfId = botID;
30
+ this.account.avatar = "https://p.qlogo.cn/gh/967068507/967068507/0";
31
+ listeners.emit("karin:adapter:open");
32
+ }
33
+ get selfId() {
34
+ return this.account.selfId;
35
+ }
36
+ async createEvent(data) {
37
+ const text$1 = data.toString().trim();
38
+ const seq = Math.floor(Math.random() * 1e9);
39
+ const time = Date.now();
40
+ /** 如果是日志等级更新命令 */
41
+ if (text$1.startsWith("log")) {
42
+ const level = text$1.replace(/^log/, "").trim();
43
+ if (level) {
44
+ if ([
45
+ "trace",
46
+ "debug",
47
+ "info",
48
+ "warn",
49
+ "error",
50
+ "fatal"
51
+ ].includes(level)) {
52
+ const { updateLevel } = await import("./file-ZGuqNDd-.mjs").then((n) => n.Qn);
53
+ updateLevel(level);
54
+ logger.info(`日志等级已更新为: ${level}`);
55
+ return;
56
+ }
57
+ }
58
+ }
59
+ if (text$1 === "rs" || text$1 === "restart") {
60
+ process.send(JSON.stringify({ type: "restart" }));
61
+ return;
62
+ }
63
+ if (text$1 === "stop") {
64
+ process.send(JSON.stringify({ type: "stop" }));
65
+ return;
66
+ }
67
+ /** 如果带`group`前缀 则视为群环境 */
68
+ if (text$1.startsWith("group")) {
69
+ const contact = contactGroup("10010");
70
+ createGroupMessage({
71
+ bot: this,
72
+ contact,
73
+ elements: [text(text$1.replace(/^group/, "").trim())],
74
+ eventId: `${botID}${time}`,
75
+ messageId: `${botID}${time}`,
76
+ messageSeq: seq,
77
+ rawEvent: { data },
78
+ sender: senderGroup(botID, "member"),
79
+ time,
80
+ srcReply: (elements) => this.sendMsg(contact, elements)
81
+ });
82
+ return;
83
+ }
84
+ const contact = contactFriend(botID);
85
+ createFriendMessage({
86
+ bot: this,
87
+ contact,
88
+ elements: [text(text$1.replace(/^group/, "").trim())],
89
+ eventId: `${botID}.${time}`,
90
+ messageId: `${botID}.${time}`,
91
+ messageSeq: seq,
92
+ rawEvent: { data },
93
+ sender: senderFriend(botID, ""),
94
+ time,
95
+ srcReply: (elements) => this.sendMsg(contact, elements)
96
+ });
97
+ }
98
+ async sendMsg(contact, elements, _) {
99
+ const time = Date.now();
100
+ const messageId = getMessageId().toString();
101
+ const result = {
102
+ message_id: messageId,
103
+ messageId,
104
+ time,
105
+ messageTime: time,
106
+ rawData: {}
107
+ };
108
+ const msg = [];
109
+ for (const v of elements) {
110
+ if (v.type === "at") {
111
+ msg.push(`[at:${v.targetId}]`);
112
+ continue;
113
+ }
114
+ if (v.type === "text") {
115
+ msg.push(v.text);
116
+ continue;
117
+ }
118
+ if (v.type === "image" || v.type === "record" || v.type === "video") {
119
+ let ext = ".png";
120
+ if (v.type === "video") ext = ".mp4";
121
+ if (v.type === "record") ext = ".mp3";
122
+ const url = v.file.startsWith("http") ? v.file : await this.getUrl(v.file, ext);
123
+ msg.push(`[${v.type}: ${logger.blue(url)} ]`);
124
+ continue;
125
+ }
126
+ msg.push(JSON.stringify(v));
127
+ }
128
+ if (contact.scene === "group") {
129
+ msg.unshift(logger.green("Send group message: "));
130
+ logger.info(msg.join(""));
131
+ } else {
132
+ msg.unshift(logger.green("Send private message: "));
133
+ logger.info(msg.join(""));
134
+ }
135
+ return result;
136
+ }
137
+ async getUrl(data, ext) {
138
+ const cfg = adapter();
139
+ const name = getFileId().toString();
140
+ const file = path.join(consolePath, `${name}${ext}`);
141
+ await fs.promises.writeFile(file, await buffer(data));
142
+ if (cfg.console.isLocal) return `http://127.0.0.1:${process.env.HTTP_PORT}/api/v1/console/${name}${ext}`;
143
+ if (cfg.console.host) return `${cfg.console.host}/api/v1/console/${name}${ext}?token=${cfg.console.token}`;
144
+ return `http://127.0.0.1:${process.env.HTTP_PORT}/api/v1/console/${name}${ext}?token=${cfg.console.token}`;
145
+ }
146
+ async getAvatarUrl(userId, _) {
147
+ if (userId === botID) return process.env.ADAPTER_CONSOLE_AVATAR || "https://p.qlogo.cn/gh/967068507/967068507/0";
148
+ return "";
149
+ }
150
+ async getGroupAvatarUrl(_, __, ___) {
151
+ return "https://p.qlogo.cn/gh/967068507/967068507/0";
152
+ }
153
+ async recallMsg(_, messageId) {
154
+ logger.info(`[recallMsg] ${messageId}`);
155
+ }
156
+ async sendLike(targetId, count) {
157
+ logger.info(`[sendLike] ${targetId} ${count}`);
158
+ }
159
+ async groupKickMember(groupId, targetId, rejectAddRequest, kickReason) {
160
+ logger.info(`[groupKickMember] ${groupId} ${targetId} ${rejectAddRequest} ${kickReason}`);
161
+ }
162
+ async setGroupMute(groupId, targetId, duration) {
163
+ logger.info(`[setGroupMute] ${groupId} ${targetId} ${duration}`);
164
+ }
165
+ async setGroupAllMute(groupId, isBan) {
166
+ logger.info(`[setGroupAllMute] ${groupId} ${isBan}`);
167
+ }
168
+ async setGroupAdmin(groupId, targetId, isAdmin) {
169
+ logger.info(`[setGroupAdmin] ${groupId} ${targetId} ${isAdmin}`);
170
+ }
171
+ async setGroupMemberCard(groupId, targetId, card) {
172
+ logger.info(`[setGroupMemberCard] ${groupId} ${targetId} ${card}`);
173
+ }
174
+ async setGroupName(groupId, groupName) {
175
+ logger.info(`[setGroupName] ${groupId} ${groupName}`);
176
+ }
177
+ async setGroupQuit(groupId, isDismiss) {
178
+ logger.info(`[setGroupQuit] ${groupId} ${isDismiss}`);
179
+ }
180
+ async setGroupMemberTitle(groupId, targetId, title) {
181
+ logger.info(`[setGroupMemberTitle] ${groupId} ${targetId} ${title}`);
182
+ }
183
+ async getFriendList(refresh) {
184
+ logger.info(`[getFriendList] ${refresh}`);
185
+ return [];
186
+ }
187
+ async getGroupList(refresh) {
188
+ logger.info(`[getGroupList] ${refresh}`);
189
+ return [];
190
+ }
191
+ async getGroupMemberList(groupId, refresh) {
192
+ logger.info(`[getGroupMemberList] ${groupId} ${refresh}`);
193
+ return [];
194
+ }
195
+ async getGroupHonor(groupId) {
196
+ logger.info(`[getGroupHonor] ${groupId}`);
197
+ return [];
198
+ }
199
+ async setFriendApplyResult(requestId, isApprove, remark) {
200
+ logger.info(`[setFriendApplyResult] ${requestId} ${isApprove} ${remark}`);
201
+ }
202
+ async setGroupApplyResult(requestId, isApprove, denyReason) {
203
+ logger.info(`[setGroupApplyResult] ${requestId} ${isApprove} ${denyReason}`);
204
+ }
205
+ async setInvitedJoinGroupResult(requestId, isApprove) {
206
+ logger.info(`[setInvitedJoinGroupResult] ${requestId} ${isApprove}`);
207
+ }
208
+ async setMsgReaction(contact, messageId, faceId, isSet) {
209
+ logger.info(`[setMsgReaction] ${contact} ${messageId} ${faceId} ${isSet}`);
210
+ }
211
+ async uploadFile(contact, file, name, folder) {
212
+ logger.info(`[uploadFile] ${contact} ${file} ${name} ${folder}`);
213
+ }
214
+ };
215
+ registerBot("other", new AdapterConsole());
216
+
217
+ //#endregion
218
+ export { };