node-karin 1.12.1 → 1.13.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.13.0](https://github.com/KarinJS/Karin/compare/core-v1.12.2...core-v1.13.0) (2025-11-22)
4
+
5
+
6
+ ### ✨ Features
7
+
8
+ * 使用@karinjs/log4js 增强开发体验 ([#577](https://github.com/KarinJS/Karin/issues/577)) ([4e4f998](https://github.com/KarinJS/Karin/commit/4e4f9980cb70e7267a41d63630e9841c74bab161))
9
+
10
+
11
+ ### 🐛 Bug Fixes
12
+
13
+ * Prevent loading plugins with incompatible engine versions and add ignoreEngines option ([#571](https://github.com/KarinJS/Karin/issues/571)) ([33e3279](https://github.com/KarinJS/Karin/commit/33e3279a30908a4aad10cc9d1cba5cd16d17c382))
14
+ * 增强ffmpeg鲁棒性 ([#574](https://github.com/KarinJS/Karin/issues/574)) ([972c901](https://github.com/KarinJS/Karin/commit/972c9013b13fac197a2e1eb19a7341a3a48b380c))
15
+
16
+ ## [1.12.2](https://github.com/KarinJS/Karin/compare/core-v1.12.1...core-v1.12.2) (2025-10-20)
17
+
18
+
19
+ ### 🐛 Bug Fixes
20
+
21
+ * **update:** 增强版本比较功能,支持严格语义化版本模式 ([#568](https://github.com/KarinJS/Karin/issues/568)) ([da3843a](https://github.com/KarinJS/Karin/commit/da3843ae3c770b308583d9b0671d4dbd36ce37ec))
22
+
3
23
  ## [1.12.1](https://github.com/KarinJS/Karin/compare/core-v1.12.0...core-v1.12.1) (2025-10-17)
4
24
 
5
25
 
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { Readable } from 'node:stream';
10
10
  import { AxiosRequestConfig, AxiosResponse } from 'axios';
11
11
  import YAML from 'yaml';
12
12
  import { FSWatcher } from 'chokidar';
13
- import { exec as exec$2, ExecException as ExecException$1 } from 'node:child_process';
13
+ import { ExecException as ExecException$1, exec as exec$2 } from 'node:child_process';
14
14
  import { Request as Request$1, Router, Response, RequestHandler, Express } from 'express';
15
15
  import { exec as exec$1, ExecException } from 'child_process';
16
16
  export { ExecException } from 'child_process';
@@ -6964,6 +6964,12 @@ interface PkgData {
6964
6964
  version: string;
6965
6965
  /** 插件入口 */
6966
6966
  main: string;
6967
+ /** 官方的 engines 字段 */
6968
+ engines?: {
6969
+ karin?: string;
6970
+ ['node-karin']?: string;
6971
+ [key: string]: any;
6972
+ };
6967
6973
  karin?: {
6968
6974
  /** ts入口 */
6969
6975
  main?: string;
@@ -6981,17 +6987,18 @@ interface PkgData {
6981
6987
  files?: string[];
6982
6988
  /** 环境变量配置 */
6983
6989
  env?: PkgEnv[];
6984
- /** 引擎兼容性 官方的翻译。。。奇奇怪怪的 */
6985
- engines?: {
6986
- /**
6987
- * @description karin版本
6988
- * @example ^0.0.1
6989
- * @example >=0.0.1
6990
- * @example 0.0.1
6991
- * @example 0.0.x
6992
- */
6993
- karin?: string;
6994
- };
6990
+ /**
6991
+ * 引擎兼容性 官方的翻译。。。奇奇怪怪的
6992
+ * @description 插件的引擎兼容性配置,用于指定插件在哪些karin版本下运行。
6993
+ * @description karin版本
6994
+ * @example ^0.0.1
6995
+ * @example >=0.0.1
6996
+ * @example 0.0.1
6997
+ * @example 0.0.x
6998
+ */
6999
+ engines?: string;
7000
+ /** 忽略引擎版本检查,强制加载插件(仅适用于karin.engines,不影响package.engines) */
7001
+ ignoreEngines?: boolean;
6995
7002
  };
6996
7003
  [key: string]: any;
6997
7004
  }
@@ -8325,6 +8332,174 @@ declare const lock: {
8325
8332
  };
8326
8333
  };
8327
8334
 
8335
+ /** 版本号对比模式 */
8336
+ type CompareMode = {
8337
+ /**
8338
+ * 版本号对比模式,怎么对比才算是有更新
8339
+ *
8340
+ * **xyz 模式(默认)**
8341
+ * - 只看前三段数字 `X.Y.Z`,忽略预发布/构建后缀。
8342
+ * - 示例:
8343
+ * - 本地 `2.6.7`,远程 `2.6.8` → 有更新
8344
+ * - 本地 `2.6.7-beta.1`,远程 `2.6.7` → 无更新(都视为 `2.6.7`)
8345
+ * - 本地 `1.0.0+20230101`,远程 `1.0.1` → 有更新(只看 `1.0.0` vs `1.0.1`)
8346
+ * - 本地 `3.2.0-rc.3`,远程 `3.2.0` → 无更新(都视为 `3.2.0`)
8347
+ *
8348
+ * **semver 模式(语义化版本)**
8349
+ * - 严格遵循 [SemVer](https://semver.org/) 规则。
8350
+ * - 示例:
8351
+ * - 本地 `2.6.7-beta.1`,远程 `2.6.6` → 本地更高,已最新,不提示升级
8352
+ * - 本地 `1.0.0-alpha`,远程 `1.0.0` → 远程更高,提示升级
8353
+ * - 本地 `1.0.0+20230101`,远程 `1.0.0` → 仅比较版本核心,不比较构建元数据,视为相同
8354
+ * - 本地 `2.0.0-beta.2`,远程 `2.0.0-beta.10` → 远程更高,提示升级(按预发布号逐段比较)
8355
+ * - 本地 `3.1.0-rc.1`,远程 `3.1.0` → 远程更高,提示升级(稳定版 > 预发布)
8356
+ *
8357
+ * @default 'xyz'
8358
+ */
8359
+ compare?: 'xyz' | 'semver';
8360
+ };
8361
+ /**
8362
+ * @description 传入npm包名 检查是否存在更新
8363
+ * @param name 包名
8364
+ * @param opts 额外参数
8365
+ * @returns 是否存在更新 true: 存在更新 false: 无更新
8366
+ */
8367
+ declare const checkPkgUpdate: (name: string, opts?: CompareMode) => Promise<{
8368
+ /** 存在更新 */
8369
+ status: "yes";
8370
+ /** 本地版本号 */
8371
+ local: string;
8372
+ /** 远程版本号 */
8373
+ remote: string;
8374
+ } | {
8375
+ /** 无更新 */
8376
+ status: "no";
8377
+ /** 本地版本号 */
8378
+ local: string;
8379
+ } | {
8380
+ /** 检查发生错误 */
8381
+ status: "error";
8382
+ /** 错误信息 */
8383
+ error: Error;
8384
+ }>;
8385
+ /**
8386
+ * @description 获取指定包的本地版本号 如果获取失败则会获取package.json中的版本号
8387
+ * @param name 包名
8388
+ */
8389
+ declare const getPkgVersion: (name: string) => Promise<string>;
8390
+ /**
8391
+ * @description 获取指定包的远程版本号
8392
+ * @param name 包名
8393
+ * @param tag 标签,默认为 `latest`
8394
+ */
8395
+ declare const getRemotePkgVersion: (name: string, tag?: string) => Promise<string>;
8396
+ /**
8397
+ * @description 更新指定的npm插件
8398
+ * @param name 包名
8399
+ * @param tag 标签 默认 `latest`
8400
+ */
8401
+ declare const updatePkg: (name: string, tag?: string) => Promise<{
8402
+ /** 更新失败 */
8403
+ status: "failed";
8404
+ /** 更新失败信息 */
8405
+ data: string | ExecException$1;
8406
+ } | {
8407
+ /** 更新成功 */
8408
+ status: "ok";
8409
+ /** 更新成功信息 */
8410
+ data: string;
8411
+ /** 本地版本号 */
8412
+ local: string;
8413
+ /** 远程版本号 */
8414
+ remote: string;
8415
+ }>;
8416
+ /**
8417
+ * @description 更新全部npm插件
8418
+ */
8419
+ declare const updateAllPkg: () => Promise<string>;
8420
+ /**
8421
+ * @description 检查git插件是否有更新
8422
+ * @param filePath 插件路径
8423
+ * @param time 任务执行超时时间 默认120s
8424
+ */
8425
+ declare const checkGitPluginUpdate: (filePath: string, time?: number) => Promise<{
8426
+ /** 存在更新 */
8427
+ status: "yes";
8428
+ /** 更新内容 */
8429
+ data: string;
8430
+ /** 落后次数 */
8431
+ count: number;
8432
+ } | {
8433
+ /** 无更新 */
8434
+ status: "no";
8435
+ /** 最后更新时间描述 */
8436
+ data: string;
8437
+ } | {
8438
+ /** 检查发生错误 */
8439
+ status: "error";
8440
+ data: Error;
8441
+ }>;
8442
+ /**
8443
+ * @description 获取指定仓库的提交记录
8444
+ * @param options 参数
8445
+ * @returns 提交记录
8446
+ */
8447
+ declare const getCommit: (options: {
8448
+ /** 指令命令路径 */
8449
+ path: string;
8450
+ /** 获取几次提交 默认1次 */
8451
+ count?: number;
8452
+ /** 指定哈希 */
8453
+ hash?: string;
8454
+ /** 指定分支 */
8455
+ branch?: string;
8456
+ }) => Promise<string>;
8457
+ /**
8458
+ * @description 获取指定仓库最后一次提交哈希值
8459
+ * @param filePath - 插件相对路径
8460
+ * @param short - 是否获取短哈希 默认true
8461
+ */
8462
+ declare const getHash: (filePath: string, short?: boolean) => Promise<string>;
8463
+ /**
8464
+ * 获取指定仓库最后一次提交时间日期
8465
+ * @param filePath - 插件相对路径
8466
+ * @returns 最后一次提交时间
8467
+ * @example
8468
+ * ```ts
8469
+ * console.log(await getTime('./plugins/karin-plugin-example'))
8470
+ * // -> '2021-09-01 12:00:00'
8471
+ * ```
8472
+ */
8473
+ declare const getTime: (filePath: string) => Promise<string>;
8474
+ /**
8475
+ * @description 更新指定git插件
8476
+ * @param filePath 插件路径
8477
+ * @param cmd 执行命令 默认`git pull`
8478
+ * @param time 任务执行超时时间 默认120s
8479
+ */
8480
+ declare const updateGitPlugin: (filePath: string, cmd?: string, time?: number) => Promise<{
8481
+ /** 更新失败 */
8482
+ status: "failed";
8483
+ /** 更新失败信息 */
8484
+ data: string | ExecException$1;
8485
+ } | {
8486
+ /** 更新成功 */
8487
+ status: "ok";
8488
+ /** 更新成功信息 */
8489
+ data: string;
8490
+ /** 更新详情 */
8491
+ commit: string;
8492
+ } | {
8493
+ /** 检查发生错误 */
8494
+ status: "error";
8495
+ data: Error;
8496
+ }>;
8497
+ /**
8498
+ * @description 更新所有git插件
8499
+ * @param time 任务执行超时时间 默认120s
8500
+ */
8501
+ declare const updateAllGitPlugin: (cmd?: string, time?: number) => Promise<string>;
8502
+
8328
8503
  /**
8329
8504
  * 提取指定版本号的更新日志
8330
8505
  * @param version 版本号,可包含预发布/构建元数据(如 `-beta`)
@@ -8335,36 +8510,120 @@ declare const lock: {
8335
8510
  * - 不存在时按新 -> 旧顺序回退到不超过目标稳定版的最新版本。
8336
8511
  */
8337
8512
  declare const log: (version: string, data: string) => string | null;
8513
+ /**
8514
+ * 从指定版本开始提取连续的更新日志
8515
+ */
8516
+ declare function logs(options: LogsOptions): string;
8338
8517
  /**
8339
8518
  * 从指定版本开始提取连续的更新日志
8340
8519
  * @param version 起始版本号
8341
8520
  * @param data `CHANGELOG.md` 文件内容
8342
8521
  * @param length 提取条数,默认为 1
8343
8522
  * @param reverse 是否反向提取;`false` 向后,`true` 向前
8523
+ * @param opts 版本号对比模式
8344
8524
  * @returns 拼接后的更新日志字符串;找不到起始版本返回空字符串
8345
8525
  * @description
8346
8526
  * - 起始版本会规范化并回退到不超过目标稳定版的最新版本;
8347
8527
  * - 切片范围将做边界裁剪以避免越界。
8528
+ * @deprecated 此调用方式将在未来版本废弃,请改用对象参数重载 logs({ ... }) 进行调用
8348
8529
  */
8349
- declare const logs: (version: string, data: string, length?: number, reverse?: boolean) => string;
8530
+ declare function logs(version: string, data: string, length?: number, reverse?: boolean, opts?: CompareMode): string;
8531
+ /**
8532
+ * 提取指定版本区间的更新日志
8533
+ */
8534
+ declare function range(options: RangeOptions): string;
8350
8535
  /**
8351
8536
  * 提取指定版本区间的更新日志
8352
8537
  * @param data `CHANGELOG.md` 文件内容
8353
8538
  * @param startVersion 起始版本号(较旧)
8354
8539
  * @param endVersion 结束版本号(较新)
8540
+ * @param opts 版本号对比模式
8355
8541
  * @returns 拼接后的更新日志字符串;若任一版本无法定位返回空字符串
8356
8542
  * @description
8357
8543
  * - CHANGELOG 的版本排序约定为从新到旧;
8358
8544
  * - 若传入版本不存在,将回退到不超过目标稳定版的最新版本;
8359
8545
  * - 当 `start > end` 时会自动调整为有效区间。
8546
+ * @deprecated 此调用方式将在未来版本废弃,请改用对象参数重载 range({ ... }) 进行调用
8360
8547
  */
8361
- declare const range: (data: string, startVersion: string, endVersion: string) => string;
8548
+ declare function range(data: string, startVersion: string, endVersion: string, opts?: CompareMode): string;
8362
8549
  /**
8363
8550
  * 对更新日志进行解析并形成对象
8364
8551
  * @param data 更新日志内容
8365
8552
  * @returns 以版本号为键的更新日志对象
8366
8553
  */
8367
8554
  declare const parseChangelog: (data: string) => Record<string, string>;
8555
+ /** logs 方法的配置 */
8556
+ type LogsOptions = {
8557
+ /** 起始版本号 */
8558
+ version: string;
8559
+ /** CHANGELOG.md 内容 */
8560
+ data: string;
8561
+ /**
8562
+ * 提取条数
8563
+ * @default 1
8564
+ */
8565
+ length?: number;
8566
+ /**
8567
+ * 是否反向提取
8568
+ * @default false
8569
+ */
8570
+ reverse?: boolean;
8571
+ /**
8572
+ * 版本号对比模式,怎么对比才算是有更新
8573
+ *
8574
+ * **xyz 模式(默认)**
8575
+ * - 只看前三段数字 `X.Y.Z`,忽略预发布/构建后缀。
8576
+ * - 示例:
8577
+ * - 本地 `2.6.7`,远程 `2.6.8` → 有更新
8578
+ * - 本地 `2.6.7-beta.1`,远程 `2.6.7` → 无更新(都视为 `2.6.7`)
8579
+ * - 本地 `1.0.0+20230101`,远程 `1.0.1` → 有更新(只看 `1.0.0` vs `1.0.1`)
8580
+ * - 本地 `3.2.0-rc.3`,远程 `3.2.0` → 无更新(都视为 `3.2.0`)
8581
+ *
8582
+ * **semver 模式(语义化版本)**
8583
+ * - 严格遵循 [SemVer](https://semver.org/) 规则。
8584
+ * - 示例:
8585
+ * - 本地 `2.6.7-beta.1`,远程 `2.6.6` → 本地更高,已最新,不提示升级
8586
+ * - 本地 `1.0.0-alpha`,远程 `1.0.0` → 远程更高,提示升级
8587
+ * - 本地 `1.0.0+20230101`,远程 `1.0.0` → 仅比较版本核心,不比较构建元数据,视为相同
8588
+ * - 本地 `2.0.0-beta.2`,远程 `2.0.0-beta.10` → 远程更高,提示升级(按预发布号逐段比较)
8589
+ * - 本地 `3.1.0-rc.1`,远程 `3.1.0` → 远程更高,提示升级(稳定版 > 预发布)
8590
+ *
8591
+ * @default 'xyz'
8592
+ */
8593
+ compare?: CompareMode['compare'];
8594
+ };
8595
+ /** range 方法的配置 */
8596
+ type RangeOptions = {
8597
+ /** CHANGELOG.md 内容 */
8598
+ data: string;
8599
+ /** 起始版本号(较旧) */
8600
+ startVersion: string;
8601
+ /** 结束版本号(较新) */
8602
+ endVersion: string;
8603
+ /**
8604
+ * 版本号对比模式,怎么对比才算是有更新
8605
+ *
8606
+ * **xyz 模式(默认)**
8607
+ * - 只看前三段数字 `X.Y.Z`,忽略预发布/构建后缀。
8608
+ * - 示例:
8609
+ * - 本地 `2.6.7`,远程 `2.6.8` → 有更新
8610
+ * - 本地 `2.6.7-beta.1`,远程 `2.6.7` → 无更新(都视为 `2.6.7`)
8611
+ * - 本地 `1.0.0+20230101`,远程 `1.0.1` → 有更新(只看 `1.0.0` vs `1.0.1`)
8612
+ * - 本地 `3.2.0-rc.3`,远程 `3.2.0` → 无更新(都视为 `3.2.0`)
8613
+ *
8614
+ * **semver 模式(语义化版本)**
8615
+ * - 严格遵循 [SemVer](https://semver.org/) 规则。
8616
+ * - 示例:
8617
+ * - 本地 `2.6.7-beta.1`,远程 `2.6.6` → 本地更高,已最新,不提示升级
8618
+ * - 本地 `1.0.0-alpha`,远程 `1.0.0` → 远程更高,提示升级
8619
+ * - 本地 `1.0.0+20230101`,远程 `1.0.0` → 仅比较版本核心,不比较构建元数据,视为相同
8620
+ * - 本地 `2.0.0-beta.2`,远程 `2.0.0-beta.10` → 远程更高,提示升级(按预发布号逐段比较)
8621
+ * - 本地 `3.1.0-rc.1`,远程 `3.1.0` → 远程更高,提示升级(稳定版 > 预发布)
8622
+ *
8623
+ * @default 'xyz'
8624
+ */
8625
+ compare?: CompareMode['compare'];
8626
+ };
8368
8627
 
8369
8628
  declare const changelog_log: typeof log;
8370
8629
  declare const changelog_logs: typeof logs;
@@ -8780,7 +9039,7 @@ declare const formatTime$1: (time: number, time2?: number) => string;
8780
9039
  * 传入一个函数 判断是否是类
8781
9040
  * @param fnc 函数
8782
9041
  */
8783
- declare const isClass: (fnc: Function) => boolean;
9042
+ declare const isClass: (fnc: unknown) => fnc is Function;
8784
9043
 
8785
9044
  /**
8786
9045
  * @description 拆解错误对象 用于`JSON`序列化
@@ -8869,147 +9128,6 @@ declare const isDocker: boolean;
8869
9128
  /** 是否为root用户 仅linux */
8870
9129
  declare const isRoot: boolean;
8871
9130
 
8872
- /**
8873
- * @description 传入npm包名 检查是否存在更新
8874
- * @param name 包名
8875
- * @returns 是否存在更新 true: 存在更新 false: 无更新
8876
- */
8877
- declare const checkPkgUpdate: (name: string) => Promise<{
8878
- /** 存在更新 */
8879
- status: "yes";
8880
- /** 本地版本号 */
8881
- local: string;
8882
- /** 远程版本号 */
8883
- remote: string;
8884
- } | {
8885
- /** 无更新 */
8886
- status: "no";
8887
- /** 本地版本号 */
8888
- local: string;
8889
- } | {
8890
- /** 检查发生错误 */
8891
- status: "error";
8892
- /** 错误信息 */
8893
- error: Error;
8894
- }>;
8895
- /**
8896
- * @description 获取指定包的本地版本号 如果获取失败则会获取package.json中的版本号
8897
- * @param name 包名
8898
- */
8899
- declare const getPkgVersion: (name: string) => Promise<string>;
8900
- /**
8901
- * @description 获取指定包的远程版本号
8902
- * @param name 包名
8903
- * @param tag 标签,默认为 `latest`
8904
- */
8905
- declare const getRemotePkgVersion: (name: string, tag?: string) => Promise<string>;
8906
- /**
8907
- * @description 更新指定的npm插件
8908
- * @param name 包名
8909
- * @param tag 标签 默认 `latest`
8910
- */
8911
- declare const updatePkg: (name: string, tag?: string) => Promise<{
8912
- /** 更新失败 */
8913
- status: "failed";
8914
- /** 更新失败信息 */
8915
- data: string | ExecException$1;
8916
- } | {
8917
- /** 更新成功 */
8918
- status: "ok";
8919
- /** 更新成功信息 */
8920
- data: string;
8921
- /** 本地版本号 */
8922
- local: string;
8923
- /** 远程版本号 */
8924
- remote: string;
8925
- }>;
8926
- /**
8927
- * @description 更新全部npm插件
8928
- */
8929
- declare const updateAllPkg: () => Promise<string>;
8930
- /**
8931
- * @description 检查git插件是否有更新
8932
- * @param filePath 插件路径
8933
- * @param time 任务执行超时时间 默认120s
8934
- */
8935
- declare const checkGitPluginUpdate: (filePath: string, time?: number) => Promise<{
8936
- /** 存在更新 */
8937
- status: "yes";
8938
- /** 更新内容 */
8939
- data: string;
8940
- /** 落后次数 */
8941
- count: number;
8942
- } | {
8943
- /** 无更新 */
8944
- status: "no";
8945
- /** 最后更新时间描述 */
8946
- data: string;
8947
- } | {
8948
- /** 检查发生错误 */
8949
- status: "error";
8950
- data: Error;
8951
- }>;
8952
- /**
8953
- * @description 获取指定仓库的提交记录
8954
- * @param options 参数
8955
- * @returns 提交记录
8956
- */
8957
- declare const getCommit: (options: {
8958
- /** 指令命令路径 */
8959
- path: string;
8960
- /** 获取几次提交 默认1次 */
8961
- count?: number;
8962
- /** 指定哈希 */
8963
- hash?: string;
8964
- /** 指定分支 */
8965
- branch?: string;
8966
- }) => Promise<string>;
8967
- /**
8968
- * @description 获取指定仓库最后一次提交哈希值
8969
- * @param filePath - 插件相对路径
8970
- * @param short - 是否获取短哈希 默认true
8971
- */
8972
- declare const getHash: (filePath: string, short?: boolean) => Promise<string>;
8973
- /**
8974
- * 获取指定仓库最后一次提交时间日期
8975
- * @param filePath - 插件相对路径
8976
- * @returns 最后一次提交时间
8977
- * @example
8978
- * ```ts
8979
- * console.log(await getTime('./plugins/karin-plugin-example'))
8980
- * // -> '2021-09-01 12:00:00'
8981
- * ```
8982
- */
8983
- declare const getTime: (filePath: string) => Promise<string>;
8984
- /**
8985
- * @description 更新指定git插件
8986
- * @param filePath 插件路径
8987
- * @param cmd 执行命令 默认`git pull`
8988
- * @param time 任务执行超时时间 默认120s
8989
- */
8990
- declare const updateGitPlugin: (filePath: string, cmd?: string, time?: number) => Promise<{
8991
- /** 更新失败 */
8992
- status: "failed";
8993
- /** 更新失败信息 */
8994
- data: string | ExecException$1;
8995
- } | {
8996
- /** 更新成功 */
8997
- status: "ok";
8998
- /** 更新成功信息 */
8999
- data: string;
9000
- /** 更新详情 */
9001
- commit: string;
9002
- } | {
9003
- /** 检查发生错误 */
9004
- status: "error";
9005
- data: Error;
9006
- }>;
9007
- /**
9008
- * @description 更新所有git插件
9009
- * @param time 任务执行超时时间 默认120s
9010
- */
9011
- declare const updateAllGitPlugin: (cmd?: string, time?: number) => Promise<string>;
9012
-
9013
9131
  /**
9014
9132
  * 重启Bot
9015
9133
  * @param selfId - 机器人的id 传e.self_id
@@ -9073,6 +9191,7 @@ declare const fileToUrl: FileToUrlHandler;
9073
9191
  */
9074
9192
  declare const satisfies: (satisfies: string, version: string) => boolean;
9075
9193
 
9194
+ type index$2_CompareMode = CompareMode;
9076
9195
  declare const index$2_checkGitPluginUpdate: typeof checkGitPluginUpdate;
9077
9196
  declare const index$2_checkPkgUpdate: typeof checkPkgUpdate;
9078
9197
  declare const index$2_checkPort: typeof checkPort;
@@ -9116,7 +9235,7 @@ declare const index$2_updateGitPlugin: typeof updateGitPlugin;
9116
9235
  declare const index$2_updatePkg: typeof updatePkg;
9117
9236
  declare const index$2_waitPort: typeof waitPort;
9118
9237
  declare namespace index$2 {
9119
- export { index$2_checkGitPluginUpdate as checkGitPluginUpdate, index$2_checkPkgUpdate as checkPkgUpdate, index$2_checkPort as checkPort, index$2_errorToString as errorToString, index$2_exec as exec, index$2_ffmpeg as ffmpeg, index$2_ffplay as ffplay, index$2_ffprobe as ffprobe, index$2_fileToUrl as fileToUrl, index$2_fileToUrlHandlerKey as fileToUrlHandlerKey, formatTime$1 as formatTime, index$2_getCommit as getCommit, index$2_getHash as getHash, index$2_getPid as getPid, index$2_getPkgVersion as getPkgVersion, index$2_getRemotePkgVersion as getRemotePkgVersion, index$2_getRequestIp as getRequestIp, index$2_getTime as getTime, index$2_importModule as importModule, index$2_imports as imports, index$2_isClass as isClass, index$2_isDocker as isDocker, index$2_isIPv4Loop as isIPv4Loop, index$2_isIPv6Loop as isIPv6Loop, index$2_isLinux as isLinux, index$2_isLocalRequest as isLocalRequest, index$2_isLoopback as isLoopback, index$2_isMac as isMac, index$2_isRoot as isRoot, index$2_isWin as isWin, index$2_killApp as killApp, index$2_lock as lock, index$2_lockMethod as lockMethod, index$2_lockProp as lockProp, index$2_restart as restart, index$2_restartDirect as restartDirect, index$2_satisfies as satisfies, index$2_stringifyError as stringifyError, index$2_updateAllGitPlugin as updateAllGitPlugin, index$2_updateAllPkg as updateAllPkg, index$2_updateGitPlugin as updateGitPlugin, index$2_updatePkg as updatePkg, uptime$1 as uptime, index$2_waitPort as waitPort };
9238
+ export { type index$2_CompareMode as CompareMode, index$2_checkGitPluginUpdate as checkGitPluginUpdate, index$2_checkPkgUpdate as checkPkgUpdate, index$2_checkPort as checkPort, index$2_errorToString as errorToString, index$2_exec as exec, index$2_ffmpeg as ffmpeg, index$2_ffplay as ffplay, index$2_ffprobe as ffprobe, index$2_fileToUrl as fileToUrl, index$2_fileToUrlHandlerKey as fileToUrlHandlerKey, formatTime$1 as formatTime, index$2_getCommit as getCommit, index$2_getHash as getHash, index$2_getPid as getPid, index$2_getPkgVersion as getPkgVersion, index$2_getRemotePkgVersion as getRemotePkgVersion, index$2_getRequestIp as getRequestIp, index$2_getTime as getTime, index$2_importModule as importModule, index$2_imports as imports, index$2_isClass as isClass, index$2_isDocker as isDocker, index$2_isIPv4Loop as isIPv4Loop, index$2_isIPv6Loop as isIPv6Loop, index$2_isLinux as isLinux, index$2_isLocalRequest as isLocalRequest, index$2_isLoopback as isLoopback, index$2_isMac as isMac, index$2_isRoot as isRoot, index$2_isWin as isWin, index$2_killApp as killApp, index$2_lock as lock, index$2_lockMethod as lockMethod, index$2_lockProp as lockProp, index$2_restart as restart, index$2_restartDirect as restartDirect, index$2_satisfies as satisfies, index$2_stringifyError as stringifyError, index$2_updateAllGitPlugin as updateAllGitPlugin, index$2_updateAllPkg as updateAllPkg, index$2_updateGitPlugin as updateGitPlugin, index$2_updatePkg as updatePkg, uptime$1 as uptime, index$2_waitPort as waitPort };
9120
9239
  }
9121
9240
 
9122
9241
  /**
@@ -17668,4 +17787,4 @@ type Client = RedisClientType & {
17668
17787
  */
17669
17788
  declare const start: () => Promise<void>;
17670
17789
 
17671
- export { type Accept, type AccordionItemProps, type AccordionKV, type AccordionProProps, type AccordionProResult, type AccordionProps, type AccordionResult, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, AdapterConvertKarin, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AddDependenciesParams, type AddTaskResult, type AfterForwardMessageCallback, type AfterMessageCallback, type AllPluginMethods, type Apps, type ArrayField, type AtElement, type Author, BASE_ROUTER, BATCH_UPDATE_PLUGINS_ROUTER, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BaseForwardCallback, type BaseMessageCallback, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, CHECK_PLUGIN_ROUTER, CLOSE_TERMINAL_ROUTER, CONSOLE_ROUTER, CREATE_TERMINAL_ROUTER, type Cache, type CacheEntry, type CheckboxField, type CheckboxGroupProps, type CheckboxProps, type CheckboxResult, type Children, type CmdFnc, type Command, type CommandClass, type ComponentConfig, type ComponentProps, type ComponentType, type Components, type ComponentsClass, type Config, type Contact, type ContactElement, type Count, type CreateGroupFolderResponse, type CreatePty, type CreateTask, type CreateTaskParams, type CreateTaskResult, type CronProps, type CustomMusicElement, type CustomNodeElement, type DbStreamStatus, type DbStreams, type DefineConfig, type DependenciesManage, type DependenciesManageBase, type Dependency, type DiceElement, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectSender, type DividerField, type DividerProps, type DownloadFileErrorResult, type DownloadFileOptions, type DownloadFileResponse, type DownloadFileResult, type DownloadFileSuccessResult, type DownloadFilesOptions, EVENT_COUNT, EXIT_ROUTER, type ElementTypes, type Elements, type Env, type Event, type EventCallCallback, type EventCallHookItem, type EventParent, type EventToSubEvent, type ExecOptions$1 as ExecOptions, type ExecReturn, type ExecType, type ExtendedAxiosRequestConfig, FILE_CHANGE, type FaceElement, type FieldType, type FileElement, type FileList, type FileListMap, type FileToUrlHandler, type FileToUrlResult, type FormField, type ForwardMessageCallback, type ForwardOptions, type FriendContact, type FriendData, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendRequestOptions, type FriendSender, type FrontendInstalledPluginListResponse, GET_BOTS_ROUTER, GET_CONFIG_ROUTER, GET_DEPENDENCIES_LIST_ROUTER, GET_LOADED_COMMAND_PLUGIN_CACHE_LIST_ROUTER, GET_LOCAL_PLUGIN_FRONTEND_LIST_ROUTER, GET_LOCAL_PLUGIN_LIST_ROUTER, GET_LOG_FILE_LIST_ROUTER, GET_LOG_FILE_ROUTER, GET_LOG_ROUTER, GET_NETWORK_STATUS_ROUTER, GET_NPMRC_LIST_ROUTER, GET_NPM_BASE_CONFIG_ROUTER, GET_NPM_CONFIG_ROUTER, GET_ONLINE_PLUGIN_LIST_ROUTER, GET_PLUGIN_APPS_ROUTER, GET_PLUGIN_CONFIG_ROUTER, GET_PLUGIN_FILE_ROUTER, GET_PLUGIN_LIST_PLUGIN_ADMIN_ROUTER, GET_PLUGIN_LIST_ROUTER, GET_PLUGIN_MARKET_LIST_ROUTER, GET_TASK_LIST_ROUTER, GET_TASK_STATUS_ROUTER, GET_TERMINAL_LIST_ROUTER, GET_UPDATABLE_PLUGINS_ROUTER, GET_WEBUI_PLUGIN_LIST_ROUTER, GET_WEBUI_PLUGIN_VERSIONS_ROUTER, type GeneralHookCallback, type GeneralHookItem, type GetAiCharactersResponse, type GetAtAllCountResponse, type GetBot, type GetCommitHashOptions, type GetConfigRequest, type GetConfigResponse, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupMuteListResponse, type GetPluginLocalOptions, type GetPluginLocalReturn, type GetPluginReturn, type GetPluginType, type GetRkeyResponse, type GiftElement, type GitLocalBranches, type GitPullOptions, type GitPullResult, type GitRemoteBranches, type GithubConfig, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, type GroupData, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, type GroupMemberData, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GroupsObjectValue, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, HTTPStatusCode, type Handler, type HandlerType, type HookCache, type HookCallback, type HookEmitForward, type HookEmitMessage, type HookNext, type HookOptions, type HooksType, INSTALL_PLUGIN_ROUTER, INSTALL_WEBUI_PLUGIN_ROUTER, IS_PLUGIN_CONFIG_EXIST_ROUTER, type Icon, type ImageElement, type ImportModuleResult, type InputGroupProps, type InputProps, type InputResult, type JsonElement, type JwtVerifyBase, type JwtVerifyError, type JwtVerifyExpired, type JwtVerifyResult, type JwtVerifySuccess, type JwtVerifyUnauthorized, type KarinButton, KarinConvertAdapter, type KarinPluginAppsType, type KeyboardElement, LOGIN_ROUTER, type LoadPluginResult, type LoadedPluginCacheList, type LocalApiResponse, type LocationElement, type Log, LogMethodNames, Logger, LoggerLevel, type LongMsgElement, MANAGE_DEPENDENCIES_ROUTER, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message, MessageBase$1 as MessageBase, type MessageEventMap, type MessageEventSub, type MessageHookItem, type MessageOptions, type MessageResponse, type MusicElement, type MusicPlatform, type NetworkStatus, type NodeElement, type NormalMessageCallback, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type NpmBaseConfigResponse, type NpmRegistryResponse, type NpmrcFileResponse, type NumberField, type ObjectArrayField, type ObjectField, createMessage as OneBotCreateMessage, createNotice as OneBotCreateNotice, createRequest as OneBotCreateRequest, type Option, type Options, PING_ROUTER, PLUGIN_ADMIN_ROUTER, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PingRequestResult, type PkgData, type PkgEnv, type PkgInfo, Plugin$1 as Plugin, type PluginAdminCustomInstall, type PluginAdminCustomInstallApp, type PluginAdminInstall, type PluginAdminListResponse, type PluginAdminMarketInstall, type PluginAdminMarketInstallApp, type PluginAdminParams, type PluginAdminResult, type PluginAdminUninstall, type PluginAdminUpdate, type PluginFile, type PluginFncTypes, type PluginLists, type PluginMarketAuthor, type PluginMarketLocalBase, type PluginMarketLocalOptions, type PluginMarketOptions, type PluginMarketRequest, type PluginMarketResponse, type PluginOptions, type PluginRule, type PluginUpdateInfo, type PnpmDependencies, type PnpmDependency, type Point, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PrivatesObjectValue, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, RECV_MSG, REFRESH_ROUTER, RESTART_ROUTER, type RaceResult, type Radio, type RadioField, type RadioGroupProps, type RadioResult, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type Redis, type RemoveDependenciesParams, type Render, type RenderResult, Renderer, type Renders$1 as Renders, type Reply, type ReplyElement, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, SAVE_CONFIG_ROUTER, SAVE_NPMRC_ROUTER, SAVE_PLUGIN_CONFIG_ROUTER, SEND_MSG, SET_LOG_LEVEL_ROUTER, SYSTEM_INFO_ROUTER, SYSTEM_STATUS_KARIN_ROUTER, SYSTEM_STATUS_ROUTER, SYSTEM_STATUS_WS_ROUTER, type SandBoxAccountInfo, type SandboxMsgRecord, type SandboxSendApi, type SandboxSendSendFriendMsg, type SandboxSendSendGroupMsg, type SandboxSendSendMsg, type SaveConfigResponse, type SaveResult, type Scene, type ScreenshotClip, type ScreenshotOptions, type SectionField, type SelectField, type SelectItem, type SelectProps, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgHookItem, type SendMsgResults, type Sender, type SenderBase, type SenderGroup$1 as SenderGroup, type Sex$1 as Sex, type ShareElement, type Snapka, type SnapkaResult, type SrcReply, type StandardResult, type SwitchField, type SwitchProps, type SwitchResult, TASK_DELETE_ROUTER, TASK_LIST_ROUTER, TASK_LOGS_ROUTER, TASK_RUN_ROUTER, type Task, type TaskCallbacks, type TaskEntity, type TaskExecutor, type TaskFilter, type TaskStatus, type TaskType, type TerminalInstance, type TerminalShell, type TestNetworkRequestDetail, type TextElement, type TextField, type TitleField, UNINSTALL_PLUGIN_ROUTER, UNINSTALL_WEBUI_PLUGIN_ROUTER, UPDATE_CORE_ROUTER, UPDATE_PLUGIN_ROUTER, UPDATE_TASK_STATUS_ROUTER, UPDATE_WEBUI_PLUGIN_VERSION_ROUTER, type UnionMessage, type UnregisterBot, type UpgradeDependenciesParams, type UserInfo, type ValidationRule, type ValueType, type VideoElement, WS_CLOSE, WS_CLOSE_ONEBOT, WS_CLOSE_PUPPETEER, WS_CLOSE_SANDBOX, WS_CONNECTION, WS_CONNECTION_ONEBOT, WS_CONNECTION_PUPPETEER, WS_CONNECTION_SANDBOX, WS_CONNECTION_TERMINAL, WS_SNAPKA, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type YamlComment, YamlEditor, type YamlValue, absPath, accordion, accordionItem, accordionPro, app, applyComments, authMiddleware, base64, buffer, buildError, buildGithub, buttonHandle, cacheMap, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, checkPort, clearRequire, clearRequireFile, comment, index$1 as common, components, index as config, contact$1 as contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, convertOneBotMessageToKarin, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createAccessTokenExpiredResponse, createBadRequestResponse, createDirectMessage, createForbiddenResponse, createFriendDecreaseNotice, createFriendIncreaseNotice, createFriendMessage, createGroupAdminChangedNotice, createGroupApplyRequest, createGroupCardChangedNotice, createGroupFileUploadedNotice, createGroupHlightsChangedNotice, createGroupHonorChangedNotice, createGroupInviteRequest, createGroupLuckKingNotice, createGroupMemberAddNotice, createGroupMemberBanNotice, createGroupMemberDelNotice, createGroupMemberTitleUpdatedNotice, createGroupMessage, createGroupMessageReactionNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupSignInNotice, createGroupTempMessage, createGroupWholeBanNotice, createGuildMessage, createINIParser, createMethodNotAllowedResponse, createNotFoundResponse, createOneBotClient, createOneBotHttp, createOneBotWsServer, createPayloadTooLargeResponse, createPluginDir, createPrivateApplyRequest, createPrivateFileUploadedNotice, createPrivatePokeNotice, createPrivateRecallNotice, createRawMessage, createReceiveLikeNotice, createRefreshTokenExpiredResponse, createResponse, createServerErrorResponse, createSuccessResponse, createTaskDatabase, createUnauthorizedResponse, cron, db, debug, karin as default, defineConfig, disconnectAllOneBotServer, divider, downFile, downloadFile, errorToString, exec, executeTask, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToBase64, fileToUrl, fileToUrlHandlerKey, filesByExt, formatLogString, formatPath, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getAllFiles, getAllFilesSync, getBot, getBotCount, getCommit, getDefaultBranch, getFastGithub, getFastRegistry, getFileMessage, getFiles, getHash, getLocalBranches, getLocalCommitHash, getMimeType, getPackageJson, getPid, getPkgVersion, getPluginInfo, getPlugins, getRelPath, getRemoteBranches, getRemoteCommitHash, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTaskCallback, getTaskDatabase, getTime, gitPull, handler$1 as handler, hooks, importModule, imports, ini, initOneBotAdapter, initTaskSystem, input, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPathEqual, isPlugin, isPublic, isRoot, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, killApp, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, parseGithubUrl, pingRequest, pkgRoot, qqbotToKarin, raceRequest, randomStr, range, read, readFile, readJson, readJsonSync, redis, registerBot, registerRender, removeTaskCallback, render, renderHtml, renderMultiHtml, renderTpl, requireFile, requireFileSync, restart, restartDirect, rmSync, router, satisfies, save, type screenshot, segment, select, sendMsg$1 as sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, setTaskCallback, setTaskDatabase, splitPath, start, stream, stringifyError, switchComponent, index$2 as system, taskAdd, taskExists, taskGet, taskList, taskSystem, taskUpdateLogs, taskUpdateStatus, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, updateTaskLogs, updateTaskStatus, uptime$1 as uptime, urlToPath, waitPort, watch, watchAndMerge, write, writeJson, writeJsonSync, yaml };
17790
+ export { type Accept, type AccordionItemProps, type AccordionKV, type AccordionProProps, type AccordionProResult, type AccordionProps, type AccordionResult, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, AdapterConvertKarin, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AddDependenciesParams, type AddTaskResult, type AfterForwardMessageCallback, type AfterMessageCallback, type AllPluginMethods, type Apps, type ArrayField, type AtElement, type Author, BASE_ROUTER, BATCH_UPDATE_PLUGINS_ROUTER, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BaseForwardCallback, type BaseMessageCallback, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, CHECK_PLUGIN_ROUTER, CLOSE_TERMINAL_ROUTER, CONSOLE_ROUTER, CREATE_TERMINAL_ROUTER, type Cache, type CacheEntry, type CheckboxField, type CheckboxGroupProps, type CheckboxProps, type CheckboxResult, type Children, type CmdFnc, type Command, type CommandClass, type CompareMode, type ComponentConfig, type ComponentProps, type ComponentType, type Components, type ComponentsClass, type Config, type Contact, type ContactElement, type Count, type CreateGroupFolderResponse, type CreatePty, type CreateTask, type CreateTaskParams, type CreateTaskResult, type CronProps, type CustomMusicElement, type CustomNodeElement, type DbStreamStatus, type DbStreams, type DefineConfig, type DependenciesManage, type DependenciesManageBase, type Dependency, type DiceElement, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectSender, type DividerField, type DividerProps, type DownloadFileErrorResult, type DownloadFileOptions, type DownloadFileResponse, type DownloadFileResult, type DownloadFileSuccessResult, type DownloadFilesOptions, EVENT_COUNT, EXIT_ROUTER, type ElementTypes, type Elements, type Env, type Event, type EventCallCallback, type EventCallHookItem, type EventParent, type EventToSubEvent, type ExecOptions$1 as ExecOptions, type ExecReturn, type ExecType, type ExtendedAxiosRequestConfig, FILE_CHANGE, type FaceElement, type FieldType, type FileElement, type FileList, type FileListMap, type FileToUrlHandler, type FileToUrlResult, type FormField, type ForwardMessageCallback, type ForwardOptions, type FriendContact, type FriendData, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendRequestOptions, type FriendSender, type FrontendInstalledPluginListResponse, GET_BOTS_ROUTER, GET_CONFIG_ROUTER, GET_DEPENDENCIES_LIST_ROUTER, GET_LOADED_COMMAND_PLUGIN_CACHE_LIST_ROUTER, GET_LOCAL_PLUGIN_FRONTEND_LIST_ROUTER, GET_LOCAL_PLUGIN_LIST_ROUTER, GET_LOG_FILE_LIST_ROUTER, GET_LOG_FILE_ROUTER, GET_LOG_ROUTER, GET_NETWORK_STATUS_ROUTER, GET_NPMRC_LIST_ROUTER, GET_NPM_BASE_CONFIG_ROUTER, GET_NPM_CONFIG_ROUTER, GET_ONLINE_PLUGIN_LIST_ROUTER, GET_PLUGIN_APPS_ROUTER, GET_PLUGIN_CONFIG_ROUTER, GET_PLUGIN_FILE_ROUTER, GET_PLUGIN_LIST_PLUGIN_ADMIN_ROUTER, GET_PLUGIN_LIST_ROUTER, GET_PLUGIN_MARKET_LIST_ROUTER, GET_TASK_LIST_ROUTER, GET_TASK_STATUS_ROUTER, GET_TERMINAL_LIST_ROUTER, GET_UPDATABLE_PLUGINS_ROUTER, GET_WEBUI_PLUGIN_LIST_ROUTER, GET_WEBUI_PLUGIN_VERSIONS_ROUTER, type GeneralHookCallback, type GeneralHookItem, type GetAiCharactersResponse, type GetAtAllCountResponse, type GetBot, type GetCommitHashOptions, type GetConfigRequest, type GetConfigResponse, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupMuteListResponse, type GetPluginLocalOptions, type GetPluginLocalReturn, type GetPluginReturn, type GetPluginType, type GetRkeyResponse, type GiftElement, type GitLocalBranches, type GitPullOptions, type GitPullResult, type GitRemoteBranches, type GithubConfig, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, type GroupData, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, type GroupMemberData, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GroupsObjectValue, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, HTTPStatusCode, type Handler, type HandlerType, type HookCache, type HookCallback, type HookEmitForward, type HookEmitMessage, type HookNext, type HookOptions, type HooksType, INSTALL_PLUGIN_ROUTER, INSTALL_WEBUI_PLUGIN_ROUTER, IS_PLUGIN_CONFIG_EXIST_ROUTER, type Icon, type ImageElement, type ImportModuleResult, type InputGroupProps, type InputProps, type InputResult, type JsonElement, type JwtVerifyBase, type JwtVerifyError, type JwtVerifyExpired, type JwtVerifyResult, type JwtVerifySuccess, type JwtVerifyUnauthorized, type KarinButton, KarinConvertAdapter, type KarinPluginAppsType, type KeyboardElement, LOGIN_ROUTER, type LoadPluginResult, type LoadedPluginCacheList, type LocalApiResponse, type LocationElement, type Log, LogMethodNames, Logger, LoggerLevel, type LongMsgElement, MANAGE_DEPENDENCIES_ROUTER, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message, MessageBase$1 as MessageBase, type MessageEventMap, type MessageEventSub, type MessageHookItem, type MessageOptions, type MessageResponse, type MusicElement, type MusicPlatform, type NetworkStatus, type NodeElement, type NormalMessageCallback, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type NpmBaseConfigResponse, type NpmRegistryResponse, type NpmrcFileResponse, type NumberField, type ObjectArrayField, type ObjectField, createMessage as OneBotCreateMessage, createNotice as OneBotCreateNotice, createRequest as OneBotCreateRequest, type Option, type Options, PING_ROUTER, PLUGIN_ADMIN_ROUTER, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PingRequestResult, type PkgData, type PkgEnv, type PkgInfo, Plugin$1 as Plugin, type PluginAdminCustomInstall, type PluginAdminCustomInstallApp, type PluginAdminInstall, type PluginAdminListResponse, type PluginAdminMarketInstall, type PluginAdminMarketInstallApp, type PluginAdminParams, type PluginAdminResult, type PluginAdminUninstall, type PluginAdminUpdate, type PluginFile, type PluginFncTypes, type PluginLists, type PluginMarketAuthor, type PluginMarketLocalBase, type PluginMarketLocalOptions, type PluginMarketOptions, type PluginMarketRequest, type PluginMarketResponse, type PluginOptions, type PluginRule, type PluginUpdateInfo, type PnpmDependencies, type PnpmDependency, type Point, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PrivatesObjectValue, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, RECV_MSG, REFRESH_ROUTER, RESTART_ROUTER, type RaceResult, type Radio, type RadioField, type RadioGroupProps, type RadioResult, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type Redis, type RemoveDependenciesParams, type Render, type RenderResult, Renderer, type Renders$1 as Renders, type Reply, type ReplyElement, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, SAVE_CONFIG_ROUTER, SAVE_NPMRC_ROUTER, SAVE_PLUGIN_CONFIG_ROUTER, SEND_MSG, SET_LOG_LEVEL_ROUTER, SYSTEM_INFO_ROUTER, SYSTEM_STATUS_KARIN_ROUTER, SYSTEM_STATUS_ROUTER, SYSTEM_STATUS_WS_ROUTER, type SandBoxAccountInfo, type SandboxMsgRecord, type SandboxSendApi, type SandboxSendSendFriendMsg, type SandboxSendSendGroupMsg, type SandboxSendSendMsg, type SaveConfigResponse, type SaveResult, type Scene, type ScreenshotClip, type ScreenshotOptions, type SectionField, type SelectField, type SelectItem, type SelectProps, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgHookItem, type SendMsgResults, type Sender, type SenderBase, type SenderGroup$1 as SenderGroup, type Sex$1 as Sex, type ShareElement, type Snapka, type SnapkaResult, type SrcReply, type StandardResult, type SwitchField, type SwitchProps, type SwitchResult, TASK_DELETE_ROUTER, TASK_LIST_ROUTER, TASK_LOGS_ROUTER, TASK_RUN_ROUTER, type Task, type TaskCallbacks, type TaskEntity, type TaskExecutor, type TaskFilter, type TaskStatus, type TaskType, type TerminalInstance, type TerminalShell, type TestNetworkRequestDetail, type TextElement, type TextField, type TitleField, UNINSTALL_PLUGIN_ROUTER, UNINSTALL_WEBUI_PLUGIN_ROUTER, UPDATE_CORE_ROUTER, UPDATE_PLUGIN_ROUTER, UPDATE_TASK_STATUS_ROUTER, UPDATE_WEBUI_PLUGIN_VERSION_ROUTER, type UnionMessage, type UnregisterBot, type UpgradeDependenciesParams, type UserInfo, type ValidationRule, type ValueType, type VideoElement, WS_CLOSE, WS_CLOSE_ONEBOT, WS_CLOSE_PUPPETEER, WS_CLOSE_SANDBOX, WS_CONNECTION, WS_CONNECTION_ONEBOT, WS_CONNECTION_PUPPETEER, WS_CONNECTION_SANDBOX, WS_CONNECTION_TERMINAL, WS_SNAPKA, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type YamlComment, YamlEditor, type YamlValue, absPath, accordion, accordionItem, accordionPro, app, applyComments, authMiddleware, base64, buffer, buildError, buildGithub, buttonHandle, cacheMap, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, checkPort, clearRequire, clearRequireFile, comment, index$1 as common, components, index as config, contact$1 as contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, convertOneBotMessageToKarin, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createAccessTokenExpiredResponse, createBadRequestResponse, createDirectMessage, createForbiddenResponse, createFriendDecreaseNotice, createFriendIncreaseNotice, createFriendMessage, createGroupAdminChangedNotice, createGroupApplyRequest, createGroupCardChangedNotice, createGroupFileUploadedNotice, createGroupHlightsChangedNotice, createGroupHonorChangedNotice, createGroupInviteRequest, createGroupLuckKingNotice, createGroupMemberAddNotice, createGroupMemberBanNotice, createGroupMemberDelNotice, createGroupMemberTitleUpdatedNotice, createGroupMessage, createGroupMessageReactionNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupSignInNotice, createGroupTempMessage, createGroupWholeBanNotice, createGuildMessage, createINIParser, createMethodNotAllowedResponse, createNotFoundResponse, createOneBotClient, createOneBotHttp, createOneBotWsServer, createPayloadTooLargeResponse, createPluginDir, createPrivateApplyRequest, createPrivateFileUploadedNotice, createPrivatePokeNotice, createPrivateRecallNotice, createRawMessage, createReceiveLikeNotice, createRefreshTokenExpiredResponse, createResponse, createServerErrorResponse, createSuccessResponse, createTaskDatabase, createUnauthorizedResponse, cron, db, debug, karin as default, defineConfig, disconnectAllOneBotServer, divider, downFile, downloadFile, errorToString, exec, executeTask, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToBase64, fileToUrl, fileToUrlHandlerKey, filesByExt, formatLogString, formatPath, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getAllFiles, getAllFilesSync, getBot, getBotCount, getCommit, getDefaultBranch, getFastGithub, getFastRegistry, getFileMessage, getFiles, getHash, getLocalBranches, getLocalCommitHash, getMimeType, getPackageJson, getPid, getPkgVersion, getPluginInfo, getPlugins, getRelPath, getRemoteBranches, getRemoteCommitHash, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTaskCallback, getTaskDatabase, getTime, gitPull, handler$1 as handler, hooks, importModule, imports, ini, initOneBotAdapter, initTaskSystem, input, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPathEqual, isPlugin, isPublic, isRoot, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, killApp, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, parseGithubUrl, pingRequest, pkgRoot, qqbotToKarin, raceRequest, randomStr, range, read, readFile, readJson, readJsonSync, redis, registerBot, registerRender, removeTaskCallback, render, renderHtml, renderMultiHtml, renderTpl, requireFile, requireFileSync, restart, restartDirect, rmSync, router, satisfies, save, type screenshot, segment, select, sendMsg$1 as sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, setTaskCallback, setTaskDatabase, splitPath, start, stream, stringifyError, switchComponent, index$2 as system, taskAdd, taskExists, taskGet, taskList, taskSystem, taskUpdateLogs, taskUpdateStatus, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, updateTaskLogs, updateTaskStatus, uptime$1 as uptime, urlToPath, waitPort, watch, watchAndMerge, write, writeJson, writeJsonSync, yaml };
package/dist/index.mjs CHANGED
@@ -1960,7 +1960,49 @@ __export(changelog_exports, {
1960
1960
  parseChangelog: () => parseChangelog,
1961
1961
  range: () => range
1962
1962
  });
1963
- var escapeRegex, log, logs, range, parseChangelog, normalizeStableVersion, parseSemverParts, compareSemver, findFallbackVersionKey;
1963
+ function logs(arg1, arg2, lengthParam = 1, reverseParam = false, optsParam) {
1964
+ if (typeof lengthParam !== "number") {
1965
+ throw new TypeError("\u63D0\u53D6\u957F\u5EA6\u5FC5\u987B\u4E3A\u6570\u5B57");
1966
+ }
1967
+ const isObj = typeof arg1 === "object";
1968
+ const version2 = isObj ? arg1.version : arg1;
1969
+ const data = isObj ? arg1.data : arg2;
1970
+ const length = isObj ? arg1.length ?? 1 : lengthParam ?? 1;
1971
+ const reverse = isObj ? arg1.reverse ?? false : reverseParam ?? false;
1972
+ const compareMode = isObj ? arg1.compare ?? "xyz" : optsParam?.compare ?? "xyz";
1973
+ const list2 = parseChangelog(data);
1974
+ const keys = Object.keys(list2);
1975
+ const startKey = findFallbackVersionKey(keys, version2, { compare: compareMode });
1976
+ if (!startKey) return "";
1977
+ const index5 = keys.indexOf(startKey);
1978
+ const start3 = reverse ? index5 - length : index5;
1979
+ const end = reverse ? index5 : index5 + length;
1980
+ const sliceStart = Math.max(0, start3);
1981
+ const sliceEnd = Math.min(keys.length, end);
1982
+ const versions = keys.slice(sliceStart, sliceEnd).map((key) => list2[key] ? list2[key] : "");
1983
+ return versions.join("");
1984
+ }
1985
+ function range(arg1, startVersionArg, endVersionArg, optsParam) {
1986
+ const isObj = typeof arg1 === "object";
1987
+ const data = isObj ? arg1.data : arg1;
1988
+ const startVersion = isObj ? arg1.startVersion : startVersionArg;
1989
+ const endVersion = isObj ? arg1.endVersion : endVersionArg;
1990
+ const compareMode = isObj ? arg1.compare ?? "xyz" : optsParam?.compare ?? "xyz";
1991
+ const list2 = parseChangelog(data);
1992
+ const keys = Object.keys(list2);
1993
+ const startKey = findFallbackVersionKey(keys, startVersion, { compare: compareMode });
1994
+ const endKey = findFallbackVersionKey(keys, endVersion, { compare: compareMode });
1995
+ if (!startKey || !endKey) return "";
1996
+ const start3 = keys.indexOf(startKey);
1997
+ const end = keys.indexOf(endKey);
1998
+ if (start3 > end) {
1999
+ const versions2 = keys.slice(end, start3).map((key) => list2[key] ? list2[key] : "");
2000
+ return versions2.join("");
2001
+ }
2002
+ const versions = keys.slice(start3, end).map((key) => list2[key] ? list2[key] : "");
2003
+ return versions.join("");
2004
+ }
2005
+ var escapeRegex, log, parseChangelog, normalizeStableVersion, parseSemverParts, compareSemver, findFallbackVersionKey, parseSemverFull, compareSemverFull, compareByMode;
1964
2006
  var init_changelog = __esm({
1965
2007
  "src/utils/fs/changelog.ts"() {
1966
2008
  escapeRegex = (str) => {
@@ -1972,37 +2014,6 @@ var init_changelog = __esm({
1972
2014
  const match = data.match(regex);
1973
2015
  return match ? match[0] : null;
1974
2016
  };
1975
- logs = (version2, data, length = 1, reverse = false) => {
1976
- if (typeof length !== "number") {
1977
- throw new TypeError("\u63D0\u53D6\u957F\u5EA6\u5FC5\u987B\u4E3A\u6570\u5B57");
1978
- }
1979
- const list2 = parseChangelog(data);
1980
- const keys = Object.keys(list2);
1981
- const startKey = findFallbackVersionKey(keys, version2);
1982
- if (!startKey) return "";
1983
- const index5 = keys.indexOf(startKey);
1984
- const start3 = reverse ? index5 - length : index5;
1985
- const end = reverse ? index5 : index5 + length;
1986
- const sliceStart = Math.max(0, start3);
1987
- const sliceEnd = Math.min(keys.length, end);
1988
- const versions = keys.slice(sliceStart, sliceEnd).map((key) => list2[key] ? list2[key] : "");
1989
- return versions.join("");
1990
- };
1991
- range = (data, startVersion, endVersion) => {
1992
- const list2 = parseChangelog(data);
1993
- const keys = Object.keys(list2);
1994
- const startKey = findFallbackVersionKey(keys, startVersion);
1995
- const endKey = findFallbackVersionKey(keys, endVersion);
1996
- if (!startKey || !endKey) return "";
1997
- const start3 = keys.indexOf(startKey);
1998
- const end = keys.indexOf(endKey);
1999
- if (start3 > end) {
2000
- const versions2 = keys.slice(end, start3).map((key) => list2[key] ? list2[key] : "");
2001
- return versions2.join("");
2002
- }
2003
- const versions = keys.slice(start3, end).map((key) => list2[key] ? list2[key] : "");
2004
- return versions.join("");
2005
- };
2006
2017
  parseChangelog = (data) => {
2007
2018
  const regex = /## \[(.*?)\]([\s\S]*?)(?=## \[|$)/g;
2008
2019
  const changelog = {};
@@ -2033,18 +2044,89 @@ var init_changelog = __esm({
2033
2044
  if (pa[2] !== pb[2]) return pa[2] - pb[2];
2034
2045
  return 0;
2035
2046
  };
2036
- findFallbackVersionKey = (keys, input2) => {
2047
+ findFallbackVersionKey = (keys, input2, opts) => {
2048
+ const mode = opts?.compare ?? "xyz";
2037
2049
  if (keys.includes(input2)) return input2;
2038
- const target = normalizeStableVersion(input2);
2039
- if (keys.includes(target)) return target;
2040
- for (const key of keys) {
2041
- const kval = normalizeStableVersion(key);
2042
- if (compareSemver(kval, target) <= 0) {
2043
- return key;
2050
+ if (mode === "xyz") {
2051
+ const target = normalizeStableVersion(input2);
2052
+ if (keys.includes(target)) return target;
2053
+ for (const key of keys) {
2054
+ const kval = normalizeStableVersion(key);
2055
+ if (compareByMode(kval, target, "xyz") <= 0) {
2056
+ return key;
2057
+ }
2058
+ }
2059
+ return null;
2060
+ }
2061
+ const parsedInput = parseSemverFull(input2);
2062
+ if (!parsedInput) {
2063
+ const target = normalizeStableVersion(input2);
2064
+ if (keys.includes(target)) return target;
2065
+ for (const key of keys) {
2066
+ const kval = normalizeStableVersion(key);
2067
+ if (compareByMode(kval, target, "xyz") <= 0) {
2068
+ return key;
2069
+ }
2044
2070
  }
2071
+ return null;
2072
+ }
2073
+ for (const key of keys) {
2074
+ const parsedKey = parseSemverFull(key);
2075
+ const cmp = parsedKey ? compareSemverFull(key, input2) : compareByMode(key, input2, "xyz");
2076
+ if (cmp <= 0) return key;
2045
2077
  }
2046
2078
  return null;
2047
2079
  };
2080
+ parseSemverFull = (input2) => {
2081
+ const core = input2.split("+")[0];
2082
+ const m = core.match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-.]+))?$/);
2083
+ if (!m) return null;
2084
+ const prerelease = m[4] ? m[4].split(".").map((id) => /^\d+$/.test(id) ? Number(id) : id) : null;
2085
+ return {
2086
+ major: Number(m[1]),
2087
+ minor: Number(m[2]),
2088
+ patch: Number(m[3]),
2089
+ prerelease
2090
+ };
2091
+ };
2092
+ compareSemverFull = (a, b) => {
2093
+ const pa = parseSemverFull(a);
2094
+ const pb = parseSemverFull(b);
2095
+ if (!pa || !pb) return 0;
2096
+ if (pa.major !== pb.major) return pa.major > pb.major ? 1 : -1;
2097
+ if (pa.minor !== pb.minor) return pa.minor > pb.minor ? 1 : -1;
2098
+ if (pa.patch !== pb.patch) return pa.patch > pb.patch ? 1 : -1;
2099
+ const ra = pa.prerelease;
2100
+ const rb = pb.prerelease;
2101
+ if (!ra && !rb) return 0;
2102
+ if (!ra && rb) return 1;
2103
+ if (ra && !rb) return -1;
2104
+ const len = Math.max(ra.length, rb.length);
2105
+ for (let i = 0; i < len; i++) {
2106
+ const ai = ra[i];
2107
+ const bi = rb[i];
2108
+ if (ai === void 0) return -1;
2109
+ if (bi === void 0) return 1;
2110
+ const aNum = typeof ai === "number";
2111
+ const bNum = typeof bi === "number";
2112
+ if (aNum && bNum) {
2113
+ if (ai !== bi) return ai > bi ? 1 : -1;
2114
+ } else if (aNum !== bNum) {
2115
+ return aNum ? -1 : 1;
2116
+ } else {
2117
+ if (ai !== bi) return String(ai) > String(bi) ? 1 : -1;
2118
+ }
2119
+ }
2120
+ return 0;
2121
+ };
2122
+ compareByMode = (a, b, mode) => {
2123
+ if (mode === "xyz") {
2124
+ const an = normalizeStableVersion(a);
2125
+ const bn = normalizeStableVersion(b);
2126
+ return compareSemver(an, bn);
2127
+ }
2128
+ return compareSemverFull(a, b);
2129
+ };
2048
2130
  }
2049
2131
  });
2050
2132
 
@@ -11165,13 +11247,24 @@ var init_ffmpeg = __esm({
11165
11247
  setTimeout(async () => {
11166
11248
  const env3 = await exec("ffmpeg -version", { booleanResult: true });
11167
11249
  if (!env3) {
11168
- const cfg = await Promise.resolve().then(() => (init_config(), config_exports));
11169
- const ffmpeg2 = cfg.ffmpegPath();
11170
- const ffprobe2 = cfg.ffprobePath();
11171
- const ffplay2 = cfg.ffplayPath();
11172
- ffmpegPath2 = ffmpeg2 ? `"${ffmpeg2}"` : ffmpegPath2;
11173
- ffprobePath2 = ffprobe2 ? `"${ffprobe2}"` : ffprobePath2;
11174
- ffplayPath2 = ffplay2 ? `"${ffplay2}"` : ffplayPath2;
11250
+ try {
11251
+ const name = "@karinjs/plugin-ffmpeg";
11252
+ const plugin = await import(name);
11253
+ const ffmpeg2 = plugin.default.ffmpegPath;
11254
+ const ffprobe2 = plugin.default.ffprobePath;
11255
+ const ffplay2 = plugin.default.ffplayPath;
11256
+ ffmpegPath2 = ffmpeg2 ? `"${ffmpeg2}"` : ffmpegPath2;
11257
+ ffprobePath2 = ffprobe2 ? `"${ffprobe2}"` : ffprobePath2;
11258
+ ffplayPath2 = ffplay2 ? `"${ffplay2}"` : ffplayPath2;
11259
+ } catch {
11260
+ const cfg = await Promise.resolve().then(() => (init_config(), config_exports));
11261
+ const ffmpeg2 = cfg.ffmpegPath();
11262
+ const ffprobe2 = cfg.ffprobePath();
11263
+ const ffplay2 = cfg.ffplayPath();
11264
+ ffmpegPath2 = ffmpeg2 ? `"${ffmpeg2}"` : ffmpegPath2;
11265
+ ffprobePath2 = ffprobe2 ? `"${ffprobe2}"` : ffprobePath2;
11266
+ ffplayPath2 = ffplay2 ? `"${ffplay2}"` : ffplayPath2;
11267
+ }
11175
11268
  }
11176
11269
  }, 1e3);
11177
11270
  ffmpeg = async (cmd, options) => {
@@ -11423,21 +11516,95 @@ var init_import = __esm({
11423
11516
  };
11424
11517
  }
11425
11518
  });
11426
- var getPkg, checkPkgUpdate, getPkgVersion, getRemotePkgVersion, updatePkg, updateAllPkg, checkGitPluginUpdate, getCommit, getHash, getTime, updateGitPlugin, updateAllGitPlugin;
11519
+ var extractSemver, escapeRegex2, normalizeStableVersion2, parseSemver, compareSemver2, getPkg, checkPkgUpdate, getPkgVersion, getRemotePkgVersion, updatePkg, updateAllPkg, checkGitPluginUpdate, getCommit, getHash, getTime, updateGitPlugin, updateAllGitPlugin;
11427
11520
  var init_update = __esm({
11428
11521
  "src/utils/system/update.ts"() {
11429
11522
  init_exec();
11430
11523
  init_require();
11431
11524
  init_list();
11525
+ extractSemver = (spec) => {
11526
+ const m = spec.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?/);
11527
+ return m ? m[0] : null;
11528
+ };
11529
+ escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11530
+ normalizeStableVersion2 = (ver) => {
11531
+ const m = ver.match(/^(\d+)\.(\d+)\.(\d+)/);
11532
+ return m ? m[0] : ver;
11533
+ };
11534
+ parseSemver = (input2) => {
11535
+ const core = input2.split("+")[0];
11536
+ const m = core.match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-.]+))?$/);
11537
+ if (!m) return null;
11538
+ const prerelease = m[4] ? m[4].split(".").map((id) => /^\d+$/.test(id) ? Number(id) : id) : null;
11539
+ return {
11540
+ major: Number(m[1]),
11541
+ minor: Number(m[2]),
11542
+ patch: Number(m[3]),
11543
+ prerelease
11544
+ };
11545
+ };
11546
+ compareSemver2 = (a, b) => {
11547
+ const pa = parseSemver(a);
11548
+ const pb = parseSemver(b);
11549
+ if (!pa || !pb) return 0;
11550
+ if (pa.major !== pb.major) return pa.major > pb.major ? 1 : -1;
11551
+ if (pa.minor !== pb.minor) return pa.minor > pb.minor ? 1 : -1;
11552
+ if (pa.patch !== pb.patch) return pa.patch > pb.patch ? 1 : -1;
11553
+ const ra = pa.prerelease;
11554
+ const rb = pb.prerelease;
11555
+ if (!ra && !rb) return 0;
11556
+ if (!ra && rb) return 1;
11557
+ if (ra && !rb) return -1;
11558
+ const len = Math.max(ra.length, rb.length);
11559
+ for (let i = 0; i < len; i++) {
11560
+ const ai = ra[i];
11561
+ const bi = rb[i];
11562
+ if (ai === void 0) return -1;
11563
+ if (bi === void 0) return 1;
11564
+ const aNum = typeof ai === "number";
11565
+ const bNum = typeof bi === "number";
11566
+ if (aNum && bNum) {
11567
+ if (ai !== bi) return ai > bi ? 1 : -1;
11568
+ } else if (aNum !== bNum) {
11569
+ return aNum ? -1 : 1;
11570
+ } else {
11571
+ if (ai !== bi) return String(ai) > String(bi) ? 1 : -1;
11572
+ }
11573
+ }
11574
+ return 0;
11575
+ };
11432
11576
  getPkg = (isForcibly = false) => {
11433
11577
  return requireFile("package.json", { force: isForcibly });
11434
11578
  };
11435
- checkPkgUpdate = async (name) => {
11579
+ checkPkgUpdate = async (name, opts) => {
11436
11580
  const logger3 = global?.logger || console;
11437
11581
  try {
11438
11582
  const local = await getPkgVersion(name);
11439
11583
  const remote = await getRemotePkgVersion(name);
11440
- if (local === remote) return { status: "no", local };
11584
+ const mode = opts?.compare ?? "xyz";
11585
+ let noUpdate = false;
11586
+ if (mode === "xyz") {
11587
+ const l = normalizeStableVersion2(local);
11588
+ const r = normalizeStableVersion2(remote);
11589
+ const lm = parseSemver(l);
11590
+ const rm = parseSemver(r);
11591
+ if (lm && rm) {
11592
+ const cmp = compareSemver2(l, r);
11593
+ noUpdate = cmp >= 0;
11594
+ } else {
11595
+ noUpdate = l === r;
11596
+ }
11597
+ } else {
11598
+ const pl = parseSemver(local);
11599
+ const pr = parseSemver(remote);
11600
+ if (pl && pr) {
11601
+ const cmp = compareSemver2(local, remote);
11602
+ noUpdate = cmp >= 0;
11603
+ } else {
11604
+ noUpdate = local === remote;
11605
+ }
11606
+ }
11607
+ if (noUpdate) return { status: "no", local };
11441
11608
  return { status: "yes", local, remote };
11442
11609
  } catch (error) {
11443
11610
  logger3.error(error);
@@ -11451,18 +11618,24 @@ var init_update = __esm({
11451
11618
  if (data.includes("empty") || data.includes("extraneous")) {
11452
11619
  throw new Error(`\u83B7\u53D6\u5931\u8D25\uFF0C${name} \u672A\u5B89\u88C5`);
11453
11620
  }
11454
- const reg = new RegExp(`${name}@(\\d+\\.\\d+\\.\\d+)`, "gm");
11455
- const result = reg.exec(data);
11456
- if (result?.[1]) return result[1];
11621
+ const esc = escapeRegex2(name);
11622
+ const reg = new RegExp(`${esc}@([0-9A-Za-z-.+]+)`, "gm");
11623
+ const match = reg.exec(data);
11624
+ if (match?.[1]) {
11625
+ return match[1].trim();
11626
+ }
11457
11627
  }
11458
11628
  if (error) {
11459
- if (error?.stack?.toString().includes("empty") || error?.stack?.toString().includes("extraneous")) {
11629
+ const stack = error?.stack?.toString() || "";
11630
+ if (stack.includes("empty") || stack.includes("extraneous")) {
11460
11631
  throw new Error(`\u83B7\u53D6\u5931\u8D25\uFF0C${name} \u672A\u5B89\u88C5`);
11461
11632
  }
11462
11633
  throw error;
11463
11634
  }
11464
11635
  const pkg2 = await getPkg();
11465
- return pkg2?.dependencies?.[name] || pkg2?.devDependencies?.[name] || pkg2?.peerDependencies?.[name];
11636
+ const spec = pkg2?.dependencies?.[name] || pkg2?.devDependencies?.[name] || pkg2?.peerDependencies?.[name];
11637
+ if (!spec) return "";
11638
+ return extractSemver(spec) || spec;
11466
11639
  };
11467
11640
  getRemotePkgVersion = async (name, tag = "latest") => {
11468
11641
  const cmd = tag === "latest" ? `npm show ${name} version` : `npm show ${name} dist-tags.${tag}`;
@@ -12551,6 +12724,101 @@ var init_system2 = __esm({
12551
12724
  init_range();
12552
12725
  }
12553
12726
  });
12727
+
12728
+ // src/plugin/system/versionCheck.ts
12729
+ var cmpVer, normalizeCore, nextPatchIfGreater, calcLowerBoundSingle, calcLowerBoundBySatisfies, createPluginMismatchReporter;
12730
+ var init_versionCheck = __esm({
12731
+ "src/plugin/system/versionCheck.ts"() {
12732
+ init_system2();
12733
+ cmpVer = (a, b) => {
12734
+ const pa = a.split(".").map((n) => parseInt(n, 10) || 0);
12735
+ const pb = b.split(".").map((n) => parseInt(n, 10) || 0);
12736
+ if (pa[0] !== pb[0]) return pa[0] - pb[0];
12737
+ if (pa[1] !== pb[1]) return pa[1] - pb[1];
12738
+ return pa[2] - pb[2];
12739
+ };
12740
+ normalizeCore = (v) => {
12741
+ const core = v.replace(/[xX*]/g, "0");
12742
+ const m = core.match(/\d+\.\d+\.\d+/);
12743
+ return m ? m[0] : null;
12744
+ };
12745
+ nextPatchIfGreater = (op, core) => {
12746
+ if (op !== ">") return core;
12747
+ const [maj, min, pat] = core.split(".").map((n) => parseInt(n, 10) || 0);
12748
+ return `${maj}.${min}.${pat + 1}`;
12749
+ };
12750
+ calcLowerBoundSingle = (range3) => {
12751
+ const tokens = range3.split(/\s+/).map((t) => t.trim()).filter((t) => t && t !== "&&");
12752
+ const candidates = [];
12753
+ for (const tk of tokens) {
12754
+ const m = tk.match(/^(\^|>=|>|~)?(.+)$/);
12755
+ const op = m?.[1] || "";
12756
+ const ver = (m?.[2] || tk).trim();
12757
+ const core = normalizeCore(ver);
12758
+ if (!core) continue;
12759
+ const candidate = op === ">" ? nextPatchIfGreater(op, core) : core;
12760
+ candidates.push(candidate);
12761
+ }
12762
+ let lower = null;
12763
+ for (const v of candidates) {
12764
+ if (!satisfies(range3, v)) continue;
12765
+ if (!lower || cmpVer(v, lower) < 0) {
12766
+ lower = v;
12767
+ }
12768
+ }
12769
+ return lower;
12770
+ };
12771
+ calcLowerBoundBySatisfies = (range3) => {
12772
+ const parts = range3.split("||").map((s) => s.trim()).filter(Boolean);
12773
+ if (parts.length <= 1) return calcLowerBoundSingle(range3);
12774
+ let best = null;
12775
+ for (const part of parts) {
12776
+ const lb = calcLowerBoundSingle(part);
12777
+ if (lb && (!best || cmpVer(lb, best) < 0)) {
12778
+ best = lb;
12779
+ }
12780
+ }
12781
+ return best;
12782
+ };
12783
+ createPluginMismatchReporter = () => {
12784
+ const items = [];
12785
+ let maxRequired = null;
12786
+ const add = (name, engines) => {
12787
+ items.push({ name, engines });
12788
+ const lower = calcLowerBoundBySatisfies(engines);
12789
+ if (lower) {
12790
+ if (!maxRequired || cmpVer(lower, maxRequired) > 0) {
12791
+ maxRequired = lower;
12792
+ }
12793
+ }
12794
+ };
12795
+ const flush = async (shouldPrint = true, currentVersion) => {
12796
+ if (!items.length || !shouldPrint) return;
12797
+ const lines = [];
12798
+ lines.push(logger.yellow("\u26A0 \u4EE5\u4E0B\u63D2\u4EF6\u7248\u672C\u4E0D\u5339\u914D\u5F53\u524D Karin \u7248\u672C:"));
12799
+ lines.push("");
12800
+ for (const it of items) {
12801
+ lines.push(logger.yellow(` ${logger.blue(it.name)}: ${it.engines}`));
12802
+ }
12803
+ lines.push("");
12804
+ lines.push(logger.yellow("dependencies:"));
12805
+ if (maxRequired) {
12806
+ if (currentVersion && cmpVer(currentVersion, maxRequired) < 0) {
12807
+ lines.push(` ${logger.green("node-karin:")} ${logger.gray(currentVersion)} -> ${logger.cyan(maxRequired)}`);
12808
+ lines.push("");
12809
+ lines.push(logger.white(`\u4E3A\u8FBE\u5230\u6B64\u90E8\u5206\u63D2\u4EF6\u7684\u6700\u4F4E\u8FD0\u884C\u8981\u6C42\uFF0C\u5EFA\u8BAE\u6267\u884C\uFF1A${logger.yellow(`pnpm up node-karin@${maxRequired}`)}`));
12810
+ } else if (!currentVersion) {
12811
+ lines.push(` ${logger.green("node-karin:")} ${logger.cyan(maxRequired)}`);
12812
+ lines.push("");
12813
+ lines.push(logger.white(`\u4E3A\u8FBE\u5230\u6B64\u90E8\u5206\u63D2\u4EF6\u7684\u6700\u4F4E\u8FD0\u884C\u8981\u6C42\uFF0C\u5EFA\u8BAE\u6267\u884C\uFF1A${logger.yellow(`pnpm up node-karin@${maxRequired}`)}`));
12814
+ }
12815
+ }
12816
+ console.log(lines.join("\n"));
12817
+ };
12818
+ return { add, flush };
12819
+ };
12820
+ }
12821
+ });
12554
12822
  var isInit, cache5, resetCache, initCache, setCachedList, setCachedInfo, getCachedData, createPkg, getAppInfo, getGitInfo, getNpmInfo, getPluginsInfo, collectAppPlugins, collectGitPlugins, NPM_EXCLUDE_LIST, collectNpmPlugins, collectAllPlugins, getPlugins;
12555
12823
  var init_list = __esm({
12556
12824
  "src/plugin/system/list.ts"() {
@@ -12561,6 +12829,7 @@ var init_list = __esm({
12561
12829
  init_path();
12562
12830
  init_env3();
12563
12831
  init_require();
12832
+ init_versionCheck();
12564
12833
  isInit = true;
12565
12834
  cache5 = {
12566
12835
  list: void 0,
@@ -12724,21 +12993,33 @@ var init_list = __esm({
12724
12993
  );
12725
12994
  };
12726
12995
  collectGitPlugins = async (files, list2) => {
12996
+ const reporter = createPluginMismatchReporter();
12727
12997
  await Promise.all(
12728
12998
  files.map(async (v) => {
12729
12999
  if (!v.isDirectory()) return;
12730
13000
  if (!v.name.startsWith("karin-plugin-")) return;
12731
13001
  if (!fs5.existsSync(path4.join(karinPathPlugins, v.name, "package.json"))) return;
12732
13002
  const pkg2 = await requireFile(path4.join(karinPathPlugins, v.name, "package.json"));
12733
- const engines = pkg2?.karin?.engines?.karin || pkg2?.engines?.karin;
12734
- if (engines && !satisfies(engines, process.env.KARIN_VERSION)) {
12735
- const msg = `[getPlugins][git] ${v.name} \u8981\u6C42 node-karin \u7248\u672C\u4E3A ${engines}\uFF0C\u5F53\u524D\u4E0D\u7B26\u5408\u8981\u6C42\uFF0C\u8DF3\u8FC7\u52A0\u8F7D\u63D2\u4EF6`;
12736
- isInit && setTimeout(() => logger.error(msg), 1e3);
12737
- return;
13003
+ const ignore = pkg2?.karin?.ignoreEngines === true;
13004
+ const preferred = typeof pkg2?.karin?.engines === "string" ? pkg2.karin.engines.trim() : "";
13005
+ let fallback = "";
13006
+ if (!preferred) {
13007
+ if (typeof pkg2?.engines?.karin === "string") fallback = pkg2.engines.karin.trim();
13008
+ else if (typeof pkg2?.engines?.["node-karin"] === "string") fallback = pkg2.engines["node-karin"].trim();
13009
+ }
13010
+ const range3 = preferred || fallback;
13011
+ if (range3 && !satisfies(range3, process.env.KARIN_VERSION)) {
13012
+ if (ignore) {
13013
+ list2.push(`git:${v.name}`);
13014
+ } else {
13015
+ reporter.add(v.name, range3);
13016
+ }
13017
+ } else {
13018
+ list2.push(`git:${v.name}`);
12738
13019
  }
12739
- list2.push(`git:${v.name}`);
12740
13020
  })
12741
13021
  );
13022
+ await reporter.flush(isInit, process.env.KARIN_VERSION);
12742
13023
  const root = await requireFile("./package.json");
12743
13024
  if (root.name && root.karin) list2.push(`root:${root.name}`);
12744
13025
  };
@@ -12769,28 +13050,37 @@ var init_list = __esm({
12769
13050
  ];
12770
13051
  collectNpmPlugins = async (list2) => {
12771
13052
  logger.debug("[collectNpmPlugins] \u5F00\u59CB\u6536\u96C6NPM\u63D2\u4EF6");
12772
- const pkg2 = await requireFile("./package.json", { force: true });
13053
+ const rootPkg = await requireFile("./package.json", { force: true });
13054
+ const reporter = createPluginMismatchReporter();
12773
13055
  const dependencies = [
12774
- ...Object.keys(pkg2.dependencies || {}),
12775
- ...Object.keys(pkg2.devDependencies || {})
13056
+ ...Object.keys(rootPkg.dependencies || {}),
13057
+ ...Object.keys(rootPkg.devDependencies || {})
12776
13058
  ].filter((name) => !NPM_EXCLUDE_LIST.includes(name) && !name.startsWith("@types"));
12777
13059
  await Promise.allSettled(
12778
13060
  dependencies.map(async (name) => {
12779
13061
  const file2 = path4.join(process.cwd(), "node_modules", name, "package.json");
12780
- const pkg3 = await requireFile(file2);
12781
- if (!pkg3.karin) return;
12782
- const engines = pkg3.karin?.engines?.karin || pkg3.engines?.karin;
12783
- if (engines) {
12784
- if (!satisfies(engines, process.env.KARIN_VERSION)) {
12785
- isInit && logger.error(
12786
- `[getPlugins][npm] ${name} \u8981\u6C42 node-karin \u7248\u672C\u4E3A ${engines}\uFF0C\u5F53\u524D\u4E0D\u7B26\u5408\u8981\u6C42\uFF0C\u8DF3\u8FC7\u52A0\u8F7D\u63D2\u4EF6`
12787
- );
12788
- return;
13062
+ const depPkg = await requireFile(file2);
13063
+ if (!depPkg.karin) return;
13064
+ const ignore = depPkg?.karin?.ignoreEngines === true;
13065
+ const preferred = typeof depPkg?.karin?.engines === "string" ? depPkg.karin.engines.trim() : "";
13066
+ let fallback = "";
13067
+ if (!preferred) {
13068
+ if (typeof depPkg?.engines?.karin === "string") fallback = depPkg.engines.karin.trim();
13069
+ else if (typeof depPkg?.engines?.["node-karin"] === "string") fallback = depPkg.engines["node-karin"].trim();
13070
+ }
13071
+ const range3 = preferred || fallback;
13072
+ if (range3 && !satisfies(range3, process.env.KARIN_VERSION)) {
13073
+ if (ignore) {
13074
+ list2.push(`npm:${name}`);
13075
+ } else {
13076
+ reporter.add(name, range3);
12789
13077
  }
13078
+ } else {
13079
+ list2.push(`npm:${name}`);
12790
13080
  }
12791
- list2.push(`npm:${name}`);
12792
13081
  })
12793
13082
  );
13083
+ await reporter.flush(isInit, process.env.KARIN_VERSION);
12794
13084
  };
12795
13085
  collectAllPlugins = async (files, list2) => {
12796
13086
  await Promise.all([
@@ -22188,6 +22478,10 @@ var init_logger = __esm({
22188
22478
  return logger3.info(logger3.violet(`[Bot:${id}]`), ...args);
22189
22479
  }
22190
22480
  };
22481
+ logger3.setContextLayouts("pattern", {
22482
+ type: "pattern",
22483
+ pattern: "[%d{hh:mm:ss.SSS}][%4.4p] %m"
22484
+ });
22191
22485
  return logger3;
22192
22486
  };
22193
22487
  createLogger = () => {
@@ -22563,23 +22857,49 @@ var init_load = __esm({
22563
22857
  init_cache();
22564
22858
  init_utils();
22565
22859
  init_tools2();
22860
+ init_system2();
22566
22861
  init_class();
22567
22862
  init_file();
22568
22863
  init_import();
22569
22864
  init_internal();
22570
22865
  init_list();
22866
+ init_versionCheck();
22571
22867
  seq = 0;
22572
22868
  pkgLoads = async (pkg2, allPromises) => {
22869
+ const reporter = createPluginMismatchReporter();
22870
+ let isCompatible = true;
22871
+ let shouldLoad = true;
22872
+ if (pkg2.type !== "app") {
22873
+ const ignoreEngines = pkg2.pkgData?.karin?.ignoreEngines === true;
22874
+ const preferred = typeof pkg2.pkgData?.karin?.engines === "string" ? String(pkg2.pkgData.karin.engines).trim() : "";
22875
+ let fallback = "";
22876
+ if (!preferred) {
22877
+ if (typeof pkg2.pkgData?.engines?.karin === "string") fallback = String(pkg2.pkgData.engines.karin).trim();
22878
+ else if (typeof pkg2.pkgData?.engines?.["node-karin"] === "string") fallback = String(pkg2.pkgData.engines["node-karin"]).trim();
22879
+ }
22880
+ const range3 = preferred || fallback;
22881
+ isCompatible = !range3 || satisfies(range3, process.env.KARIN_VERSION);
22882
+ if (range3 && !isCompatible) {
22883
+ if (!ignoreEngines) {
22884
+ reporter.add(pkg2.name, range3);
22885
+ await reporter.flush(true, process.env.KARIN_VERSION);
22886
+ shouldLoad = false;
22887
+ }
22888
+ }
22889
+ }
22890
+ if (!shouldLoad) {
22891
+ return;
22892
+ }
22573
22893
  pkg2.id = ++seq;
22574
22894
  cache3.index[pkg2.id] = pkg2;
22575
22895
  const files = [];
22576
22896
  if (pkg2.type === "app") {
22577
22897
  files.push("config", "data", "resources");
22578
- } else if (Array.isArray(pkg2.pkgData.karin?.files)) {
22898
+ } else if (pkg2.pkgData.karin?.files && Array.isArray(pkg2.pkgData.karin?.files)) {
22579
22899
  files.push(...pkg2.pkgData.karin.files);
22580
22900
  }
22581
22901
  await createPluginDir(pkg2.name, files);
22582
- if (pkg2.type !== "app") {
22902
+ if (pkg2.type !== "app" && shouldLoad) {
22583
22903
  const main2 = pkg2.type === "npm" || !isTs() ? await loadMainFile(pkg2, pkg2.pkgData?.main) : await loadMainFile(pkg2, pkg2.pkgData?.karin?.main);
22584
22904
  if (main2 && main2.KARIN_PLUGIN_INIT) {
22585
22905
  try {
@@ -22590,7 +22910,7 @@ var init_load = __esm({
22590
22910
  }
22591
22911
  }
22592
22912
  }
22593
- pkg2.apps.forEach((app5) => {
22913
+ shouldLoad && pkg2.apps.forEach((app5) => {
22594
22914
  const promise = async () => {
22595
22915
  const result = await pkgLoadModule(pkg2.name, app5);
22596
22916
  pkgCache(result, pkg2, app5);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",
@@ -166,7 +166,7 @@
166
166
  "chokidar": "4.0.3",
167
167
  "express": "npm:@karinjs/express@1.0.3",
168
168
  "lodash": "npm:@karinjs/lodash@1.1.1",
169
- "log4js": "^6.9.1",
169
+ "log4js": "npm:@karinjs/log4js@1.5.4",
170
170
  "moment": "npm:@karinjs/moment@1.1.5",
171
171
  "node-schedule": "npm:@karinjs/node-schedule@1.0.0",
172
172
  "redis": "npm:@karinjs/redis@1.1.3",