koishi-plugin-chatluna-toolbox 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  为 ChatLuna 提供可组合的工具能力,当前包含三类功能:
4
4
 
5
5
  - 原生工具(Native Tools)
6
- - XML 工具(XML Actions)
6
+ - Character XML 工具(XML Actions)
7
7
  - 变量扩展(Variables)
8
8
 
9
9
  插件目标是把常用的群聊动作能力(如戳一戳、消息表情、撤回消息)和上下文变量能力拆分为可配置模块,便于在 Koishi + ChatLuna 场景中按需启用。
@@ -21,7 +21,7 @@
21
21
 
22
22
  QQ 头像工具会把 HTTP/HTTPS 图片先转为 OneBot `base64://` 文件再提交,避免 OneBot 端无法访问 Koishi 临时图片地址。
23
23
 
24
- ### 2) XML 工具
24
+ ### 2) Character XML 工具
25
25
  支持从模型输出中解析 XML 动作标签并执行:
26
26
 
27
27
  - `<poke id="..."/>`
@@ -49,24 +49,24 @@ QQ 头像工具会把 HTTP/HTTPS 图片先转为 OneBot `base64://` 文件再提
49
49
 
50
50
  - 开启一个 OneBot 协议(NapCat 或 LLBot)
51
51
  - 按需开启原生工具
52
- - 按需开启 XML 工具
52
+ - 按需开启 Character XML 工具
53
53
  - 按需配置变量项
54
54
 
55
55
  ### 3. 配置 XML 参考提示词
56
- 在 `XML 工具` 分组中找到 `参考提示词`,可直接使用默认模板,或根据你的 Bot 规则进行调整。
56
+ 在 `Character XML 工具` 分组中找到 `参考提示词`,可直接使用默认模板,或根据你的 Bot 规则进行调整。
57
57
 
58
58
  ### 4. 构建
59
59
 
60
60
  ```bash
61
- npm run build
61
+ yarn build
62
62
  ```
63
63
 
64
64
  ## 开发命令
65
65
 
66
66
  ```bash
67
- npm run typecheck
68
- npm run build
69
- npm run test
67
+ yarn typecheck
68
+ yarn build
69
+ yarn test
70
70
  ```
71
71
 
72
72
  ## 仓库地址
@@ -8,8 +8,8 @@ import type { SharedNavSection } from "shared-nav";
8
8
  export const NAV_SECTIONS: SharedNavSection[] = [
9
9
  { title: "基础设置", key: "basic" },
10
10
  { title: "原生工具", key: "nativeTools" },
11
- { title: "XML 工具", key: "xmlTools" },
12
- { title: "其他变量", key: "variables" },
11
+ { title: "Character XML 工具", key: "xmlTools" },
12
+ { title: "变量", key: "variables" },
13
13
  { title: "其他设置", key: "other" },
14
14
  ];
15
15
 
package/dist/index.js CHANGED
@@ -234,8 +234,8 @@ const st = /* @__PURE__ */ b({
234
234
  }, gt = /* @__PURE__ */ M(st, [["__cssModules", ht]]), pt = [
235
235
  { title: "基础设置", key: "basic" },
236
236
  { title: "原生工具", key: "nativeTools" },
237
- { title: "XML 工具", key: "xmlTools" },
238
- { title: "其他变量", key: "variables" },
237
+ { title: "Character XML 工具", key: "xmlTools" },
238
+ { title: "变量", key: "variables" },
239
239
  { title: "其他设置", key: "other" }
240
240
  ], mt = [
241
241
  "chatluna-toolbox",
package/lib/index.js CHANGED
@@ -447,7 +447,8 @@ __export(index_exports, {
447
447
  sendSetGroupCard: () => sendSetGroupCard,
448
448
  sendSetGroupSpecialTitle: () => sendSetGroupSpecialTitle,
449
449
  sendSetProfile: () => sendSetProfile,
450
- sendSetQQAvatar: () => sendSetQQAvatar
450
+ sendSetQQAvatar: () => sendSetQQAvatar,
451
+ usage: () => usage
451
452
  });
452
453
  module.exports = __toCommonJS(index_exports);
453
454
 
@@ -457,8 +458,10 @@ var import_koishi5 = require("koishi");
457
458
  // src/schema/basic-settings.ts
458
459
  var import_koishi = require("koishi");
459
460
  var BasicSettingsSchema = import_koishi.Schema.object({
460
- enableNapCatProtocol: import_koishi.Schema.boolean().default(true).description("\u542F\u7528 NapCat OneBot \u534F\u8BAE\uFF08\u4E0E LLBot \u4E8C\u9009\u4E00\uFF09"),
461
- enableLlbotProtocol: import_koishi.Schema.boolean().default(false).description("\u542F\u7528 LLBot OneBot \u534F\u8BAE\uFF08\u4E0E NapCat \u4E8C\u9009\u4E00\uFF09")
461
+ oneBotProtocol: import_koishi.Schema.union([
462
+ import_koishi.Schema.const("napcat").description("NapCat"),
463
+ import_koishi.Schema.const("llbot").description("LLBot")
464
+ ]).default("napcat").description("\u9009\u62E9 OneBot \u534F\u8BAE")
462
465
  }).description("\u57FA\u7840\u8BBE\u7F6E");
463
466
 
464
467
  // src/schema/native-tools.ts
@@ -475,95 +478,68 @@ var DEFAULT_SET_MSG_EMOJI_TOOL_DESCRIPTION = "\u5BF9\u6307\u5B9A\u6D88\u606F\u6D
475
478
  var DEFAULT_DELETE_MESSAGE_TOOL_DESCRIPTION = "\u6839\u636E\u6D88\u606F ID \u64A4\u56DE\u6307\u5B9A\u6D88\u606F\u3002";
476
479
 
477
480
  // src/schema/native-tools.ts
478
- var NativeToolsSchema = import_koishi2.Schema.object({
481
+ var EnabledNativeToolsSchema = import_koishi2.Schema.array(
482
+ import_koishi2.Schema.union([
483
+ import_koishi2.Schema.const("poke").description("\u6233\u4E00\u6233"),
484
+ import_koishi2.Schema.const("setSelfProfile").description("\u4FEE\u6539\u81EA\u8EAB\u8D26\u6237\u4FE1\u606F"),
485
+ import_koishi2.Schema.const("setQQAvatar").description("\u4FEE\u6539 QQ \u5934\u50CF"),
486
+ import_koishi2.Schema.const("setGroupCard").description("\u4FEE\u6539\u7FA4\u6210\u5458\u6635\u79F0"),
487
+ import_koishi2.Schema.const("setGroupBan").description("\u7981\u8A00\u7FA4\u6210\u5458"),
488
+ import_koishi2.Schema.const("setGroupSpecialTitle").description("\u4FEE\u6539\u7FA4\u6210\u5458\u4E13\u5C5E\u5934\u8854"),
489
+ import_koishi2.Schema.const("setMsgEmoji").description("\u6D88\u606F\u8868\u60C5"),
490
+ import_koishi2.Schema.const("deleteMessage").description("\u64A4\u56DE\u6D88\u606F")
491
+ ])
492
+ ).role("checkbox").extra("default", void 0).description(
493
+ "\u9009\u62E9\u8981\u6CE8\u518C\u5230 ChatLuna \u7684\u539F\u751F\u5DE5\u5177\uFF0C\u5DE5\u5177\u540D\u79F0\u548C\u63CF\u8FF0\u901A\u5E38\u65E0\u9700\u4FEE\u6539\uFF0C\u53EF\u5728\u4E0B\u65B9\u9AD8\u7EA7\u8BBE\u7F6E\u4E2D\u8C03\u6574"
494
+ );
495
+ var NativeToolAdvancedSettingsSchema = import_koishi2.Schema.object({
479
496
  poke: import_koishi2.Schema.object({
480
- enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u6233\u4E00\u6233\uFF08\u4E0E XML\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF09"),
497
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
481
498
  toolName: import_koishi2.Schema.string().default("poke_user").description("\u5DE5\u5177\u540D\u79F0"),
482
499
  description: import_koishi2.Schema.string().default(DEFAULT_POKE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
483
500
  }).description("\u6233\u4E00\u6233\u5DE5\u5177").collapse(),
484
501
  setSelfProfile: import_koishi2.Schema.object({
485
- enabled: import_koishi2.Schema.boolean().default(false).description(
486
- "\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u81EA\u8EAB\u8D26\u6237\u4FE1\u606F\uFF08\u652F\u6301\u6635\u79F0/\u7B7E\u540D/\u6027\u522B\uFF09"
487
- ),
502
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
488
503
  toolName: import_koishi2.Schema.string().default("set_self_profile").description("\u5DE5\u5177\u540D\u79F0"),
489
504
  description: import_koishi2.Schema.string().default(DEFAULT_SET_SELF_PROFILE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
490
505
  }).description("\u4FEE\u6539\u81EA\u8EAB\u8D26\u6237\u4FE1\u606F\u5DE5\u5177").collapse(),
491
506
  setQQAvatar: import_koishi2.Schema.object({
492
- enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u673A\u5668\u4EBA QQ \u5934\u50CF"),
507
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
493
508
  toolName: import_koishi2.Schema.string().default("set_qq_avatar").description("\u5DE5\u5177\u540D\u79F0"),
494
509
  description: import_koishi2.Schema.string().default(DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
495
510
  }).description("\u4FEE\u6539 QQ \u5934\u50CF\u5DE5\u5177").collapse(),
496
511
  setGroupCard: import_koishi2.Schema.object({
497
- enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u7FA4\u6210\u5458\u6635\u79F0"),
512
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
498
513
  toolName: import_koishi2.Schema.string().default("set_group_card").description("\u5DE5\u5177\u540D\u79F0"),
499
514
  description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_CARD_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
500
515
  }).description("\u4FEE\u6539\u7FA4\u6210\u5458\u6635\u79F0\u5DE5\u5177").collapse(),
501
516
  setGroupBan: import_koishi2.Schema.object({
502
- enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u7981\u8A00\u7FA4\u6210\u5458"),
517
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
503
518
  toolName: import_koishi2.Schema.string().default("set_group_ban").description("\u5DE5\u5177\u540D\u79F0"),
504
519
  description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_BAN_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
505
520
  }).description("\u7981\u8A00\u5DE5\u5177").collapse(),
506
521
  setGroupSpecialTitle: import_koishi2.Schema.object({
507
- enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u7FA4\u6210\u5458\u4E13\u5C5E\u5934\u8854"),
522
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
508
523
  toolName: import_koishi2.Schema.string().default("set_group_special_title").description("\u5DE5\u5177\u540D\u79F0"),
509
524
  description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
510
525
  }).description("\u4FEE\u6539\u7FA4\u6210\u5458\u4E13\u5C5E\u5934\u8854\u5DE5\u5177").collapse(),
511
526
  setMsgEmoji: import_koishi2.Schema.object({
512
- enabled: import_koishi2.Schema.boolean().default(false).description(
513
- "\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u7ED9\u6D88\u606F\u6DFB\u52A0\u8868\u60C5\uFF08\u9700 chatluna-character \u5F00\u542F enableMessageId\uFF0C\u4E0E XML\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF0C\u8868\u60C5\u5BF9\u7167\u8868\uFF1Ahttps://bot.q.qq.com/wiki/develop/pythonsdk/model/emoji.html \uFF09"
514
- ),
527
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
515
528
  toolName: import_koishi2.Schema.string().default("set_msg_emoji").description("\u5DE5\u5177\u540D\u79F0"),
516
529
  description: import_koishi2.Schema.string().default(DEFAULT_SET_MSG_EMOJI_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
517
530
  }).description("\u6D88\u606F\u8868\u60C5\u5DE5\u5177").collapse(),
518
531
  deleteMessage: import_koishi2.Schema.object({
519
- enabled: import_koishi2.Schema.boolean().default(false).description(
520
- "\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u64A4\u56DE\u6D88\u606F\uFF08\u9700 chatluna-character \u5F00\u542F enableMessageId\uFF0C\u4E0E XML\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF09"
521
- ),
532
+ enabled: import_koishi2.Schema.boolean().default(false).hidden(),
522
533
  toolName: import_koishi2.Schema.string().default("delete_msg").description("\u5DE5\u5177\u540D\u79F0"),
523
534
  description: import_koishi2.Schema.string().default(DEFAULT_DELETE_MESSAGE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
524
535
  }).description("\u64A4\u56DE\u6D88\u606F\u5DE5\u5177").collapse()
525
- }).default({
526
- poke: {
527
- enabled: false,
528
- toolName: "poke_user",
529
- description: DEFAULT_POKE_TOOL_DESCRIPTION
530
- },
531
- setSelfProfile: {
532
- enabled: false,
533
- toolName: "set_self_profile",
534
- description: DEFAULT_SET_SELF_PROFILE_TOOL_DESCRIPTION
535
- },
536
- setQQAvatar: {
537
- enabled: false,
538
- toolName: "set_qq_avatar",
539
- description: DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION
540
- },
541
- setGroupCard: {
542
- enabled: false,
543
- toolName: "set_group_card",
544
- description: DEFAULT_SET_GROUP_CARD_TOOL_DESCRIPTION
545
- },
546
- setGroupBan: {
547
- enabled: false,
548
- toolName: "set_group_ban",
549
- description: DEFAULT_SET_GROUP_BAN_TOOL_DESCRIPTION
550
- },
551
- setGroupSpecialTitle: {
552
- enabled: false,
553
- toolName: "set_group_special_title",
554
- description: DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION
555
- },
556
- setMsgEmoji: {
557
- enabled: false,
558
- toolName: "set_msg_emoji",
559
- description: DEFAULT_SET_MSG_EMOJI_TOOL_DESCRIPTION
560
- },
561
- deleteMessage: {
562
- enabled: false,
563
- toolName: "delete_msg",
564
- description: DEFAULT_DELETE_MESSAGE_TOOL_DESCRIPTION
565
- }
566
- }).description("\u539F\u751F\u5DE5\u5177");
536
+ }).description("\u9AD8\u7EA7\u8BBE\u7F6E").collapse();
537
+ var NativeToolsSchema = import_koishi2.Schema.intersect([
538
+ import_koishi2.Schema.object({
539
+ enabledNativeTools: EnabledNativeToolsSchema
540
+ }).description(""),
541
+ NativeToolAdvancedSettingsSchema
542
+ ]).description("\u539F\u751F\u5DE5\u5177");
567
543
 
568
544
  // src/schema/xml-tools.ts
569
545
  var import_koishi3 = require("koishi");
@@ -606,19 +582,19 @@ var DEFAULT_XML_REFERENCE_PROMPT = `## \u52A8\u4F5C\u6307\u4EE4
606
582
  </actions>
607
583
  \`\`\``;
608
584
  var XmlToolsSchema = import_koishi3.Schema.object({
609
- injectXmlToolAsReplyTool: import_koishi3.Schema.boolean().default(false).description("\u5C06 XML \u5DE5\u5177\u6539\u4E3A\u6CE8\u5165\u5B9E\u9A8C\u6027\u201C\u5DE5\u5177\u8C03\u7528\u56DE\u590D\u201D\u7684\u53C2\u6570\u4E2D"),
610
- enablePokeXmlTool: import_koishi3.Schema.boolean().default(false).description("\u542F\u7528 XML \u5F62\u5F0F\u7684\u6233\u4E00\u6233\u8C03\u7528\uFF08\u4E0E \u539F\u751F\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF09"),
585
+ injectXmlToolAsReplyTool: import_koishi3.Schema.boolean().default(false).description("\u5C06 XML \u5DE5\u5177\u6CE8\u5165\u5B9E\u9A8C\u6027[\u5DE5\u5177\u8C03\u7528\u56DE\u590D](https://chatluna.chat/ecosystem/other/character.html#%E9%A2%84%E8%AE%BE)\u7684\u53C2\u6570\u4E2D"),
586
+ enablePokeXmlTool: import_koishi3.Schema.boolean().default(false).description(`\u542F\u7528 XML \u6233\u4E00\u6233\u8C03\u7528\uFF0C\u4E0E**\u6233\u4E00\u6233\u5DE5\u5177**\u4E8C\u9009\u4E00`),
611
587
  enableEmojiXmlTool: import_koishi3.Schema.boolean().default(false).description(
612
- "\u542F\u7528 XML \u5F62\u5F0F\u7684\u6D88\u606F\u8868\u60C5\u8C03\u7528\uFF0C\uFF08\u9700 chatluna-character \u5F00\u542F enableMessageId\uFF0C\u4E0E \u539F\u751F\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF0Cemoji_id \u5BF9\u7167\u8868\uFF1Ahttps://bot.q.qq.com/wiki/develop/pythonsdk/model/emoji.html \uFF09"
588
+ `\u542F\u7528 XML \u6D88\u606F\u8868\u60C5\u8C03\u7528\uFF0C\u9700\`chatluna-character\`\u5F00\u542F\`enableMessageId\`\uFF0C\u4E0E**\u6D88\u606F\u8868\u60C5\u5DE5\u5177**\u4E8C\u9009\u4E00\uFF0C\u70B9\u51FB\u67E5\u770B[emoji_id \u5BF9\u7167\u8868](https://bot.q.qq.com/wiki/develop/pythonsdk/model/emoji.html)`
613
589
  ),
614
590
  enableDeleteXmlTool: import_koishi3.Schema.boolean().default(false).description(
615
- "\u542F\u7528 XML \u5F62\u5F0F\u7684\u6D88\u606F\u64A4\u56DE\u8C03\u7528\uFF08\u9700 chatluna-character \u5F00\u542F enableMessageId\uFF0C\u4E0E \u539F\u751F\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF09"
591
+ `\u542F\u7528 XML \u6D88\u606F\u64A4\u56DE\u8C03\u7528\uFF0C\u9700\`chatluna-character\`\u5F00\u542F\`enableMessageId\`\uFF0C\u4E0E**\u64A4\u56DE\u6D88\u606F\u5DE5\u5177**\u4E8C\u9009\u4E00`
616
592
  ),
617
593
  enableBanXmlTool: import_koishi3.Schema.boolean().default(false).description(
618
- "\u542F\u7528 XML \u5F62\u5F0F\u7684\u7FA4\u6210\u5458\u7981\u8A00\u8C03\u7528\uFF08\u4E0E \u539F\u751F\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF09"
594
+ `\u542F\u7528 XML \u7FA4\u6210\u5458\u7981\u8A00\u8C03\u7528\uFF0C\u4E0E**\u7981\u8A00\u5DE5\u5177**\u4E8C\u9009\u4E00`
619
595
  ),
620
- referencePrompt: import_koishi3.Schema.string().role("textarea").default(DEFAULT_XML_REFERENCE_PROMPT).description("\u6A21\u578B\u56DE\u590D XML \u53C2\u8003\u63D0\u793A\u8BCD\uFF0C\u81EA\u884C\u5199\u5165\u63D0\u793A\u8BCD\u4E2D\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6CE8\u5165\uFF1B\u82E5\u5F00\u542F\u201C\u5C06 XML \u5DE5\u5177\u6539\u4E3A\u6CE8\u5165\u5B9E\u9A8C\u6027\u5DE5\u5177\u8C03\u7528\u56DE\u590D\u201D\uFF0C\u5219\u65E0\u9700\u589E\u52A0\u989D\u5916\u63D0\u793A\u8BCD")
621
- }).description("XML \u5DE5\u5177");
596
+ referencePrompt: import_koishi3.Schema.string().role("textarea").default(DEFAULT_XML_REFERENCE_PROMPT).description("\u6A21\u578B\u56DE\u590D XML \u53C2\u8003\u63D0\u793A\u8BCD\u3002\u81EA\u884C\u5199\u5165\u63D0\u793A\u8BCD\u4E2D\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6CE8\u5165\uFF1B\u82E5\u5F00\u542F\u201C\u5C06 XML \u5DE5\u5177\u6CE8\u5165\u5B9E\u9A8C\u6027[\u5DE5\u5177\u8C03\u7528\u56DE\u590D](https://chatluna.chat/ecosystem/other/character.html#%E9%A2%84%E8%AE%BE)\u7684\u53C2\u6570\u4E2D\u201D\uFF0C\u5219\u65E0\u9700\u589E\u52A0\u989D\u5916\u63D0\u793A\u8BCD")
597
+ }).description("Character XML \u5DE5\u5177");
622
598
 
623
599
  // src/schema/variables.ts
624
600
  var import_koishi4 = require("koishi");
@@ -662,7 +638,7 @@ var VariablesSchema = import_koishi4.Schema.object({
662
638
  import_koishi4.Schema.const("joinTime").description("\u5165\u7FA4\u65F6\u95F4"),
663
639
  import_koishi4.Schema.const("lastSentTime").description("\u6700\u540E\u53D1\u8A00\u65F6\u95F4")
664
640
  ])
665
- ).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\u663E\u793A\u7684\u8BE6\u7EC6\u4FE1\u606F\u9879")
641
+ ).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\u9009\u62E9\u7528\u6237\u4FE1\u606F\u53D8\u91CF\u4E2D\u663E\u793A\u7684\u8BE6\u7EC6\u4FE1\u606F\u9879")
666
642
  }).description("\u7528\u6237\u4FE1\u606F\u53D8\u91CF").collapse(),
667
643
  botInfo: import_koishi4.Schema.object({
668
644
  variableName: import_koishi4.Schema.string().default("botInfo").description("\u53D8\u91CF\u540D\u79F0"),
@@ -679,7 +655,7 @@ var VariablesSchema = import_koishi4.Schema.object({
679
655
  import_koishi4.Schema.const("joinTime").description("\u5165\u7FA4\u65F6\u95F4"),
680
656
  import_koishi4.Schema.const("lastSentTime").description("\u6700\u540E\u53D1\u8A00\u65F6\u95F4")
681
657
  ])
682
- ).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\u663E\u793A\u7684\u673A\u5668\u4EBA\u8BE6\u7EC6\u4FE1\u606F\u9879")
658
+ ).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\u9009\u62E9\u673A\u5668\u4EBA\u4FE1\u606F\u53D8\u91CF\u4E2D\u663E\u793A\u7684\u8BE6\u7EC6\u4FE1\u606F\u9879")
683
659
  }).description("\u673A\u5668\u4EBA\u4FE1\u606F\u53D8\u91CF").collapse(),
684
660
  groupInfo: import_koishi4.Schema.object({
685
661
  variableName: import_koishi4.Schema.string().default("groupInfo").description("\u53D8\u91CF\u540D\u79F0"),
@@ -692,7 +668,7 @@ var VariablesSchema = import_koishi4.Schema.object({
692
668
  import_koishi4.Schema.const("ownerList").description("\u7FA4\u4E3B\u540D\u5355"),
693
669
  import_koishi4.Schema.const("adminList").description("\u7BA1\u7406\u5458\u540D\u5355")
694
670
  ])
695
- ).role("checkbox").default([...DEFAULT_GROUP_INFO_ITEMS]).description("\u663E\u793A\u7684\u7FA4\u4FE1\u606F\u9879")
671
+ ).role("checkbox").default([...DEFAULT_GROUP_INFO_ITEMS]).description("\u9009\u62E9\u7FA4\u4FE1\u606F\u53D8\u91CF\u4E2D\u663E\u793A\u7684\u7FA4\u4FE1\u606F\u9879")
696
672
  }).description("\u7FA4\u4FE1\u606F\u53D8\u91CF").collapse(),
697
673
  groupShutList: import_koishi4.Schema.object({
698
674
  variableName: import_koishi4.Schema.string().default("groupShutList").description("\u53D8\u91CF\u540D\u79F0")
@@ -714,7 +690,7 @@ var VariablesSchema = import_koishi4.Schema.object({
714
690
  },
715
691
  groupShutList: { variableName: "groupShutList" },
716
692
  random: { variableName: "random", min: 0, max: 100 }
717
- }).description("\u5176\u4ED6\u53D8\u91CF");
693
+ }).description("\u53D8\u91CF");
718
694
 
719
695
  // src/schema/index.ts
720
696
  var OtherSettingsSchema = import_koishi5.Schema.object({
@@ -1323,19 +1299,18 @@ function resolveToolDescription(value, fallback) {
1323
1299
  const trimmedValue = value.trim();
1324
1300
  return trimmedValue || fallback;
1325
1301
  }
1326
- function resolveOneBotProtocol(config, log) {
1327
- if (config.enableNapCatProtocol && config.enableLlbotProtocol) {
1328
- log?.("warn", "NapCat \u4E0E LLBot \u534F\u8BAE\u540C\u65F6\u542F\u7528\uFF0C\u5C06\u4F18\u5148\u4F7F\u7528 LLBot\u3002");
1329
- return "llbot";
1302
+ function isNativeToolEnabled(config, toolKey) {
1303
+ if (config.enabledNativeTools) {
1304
+ return config.enabledNativeTools.includes(toolKey);
1330
1305
  }
1331
- if (config.enableLlbotProtocol) return "llbot";
1332
- if (config.enableNapCatProtocol) return "napcat";
1333
- log?.("warn", "\u672A\u542F\u7528 OneBot \u534F\u8BAE\u9009\u9879\uFF0C\u9ED8\u8BA4\u4F7F\u7528 NapCat\u3002");
1334
- return "napcat";
1306
+ return config[toolKey].enabled ?? false;
1307
+ }
1308
+ function resolveOneBotProtocol(config, log) {
1309
+ return config.oneBotProtocol;
1335
1310
  }
1336
1311
  function registerNativeTools(deps) {
1337
1312
  const { ctx, config, plugin, protocol, log } = deps;
1338
- if (config.poke.enabled) {
1313
+ if (isNativeToolEnabled(config, "poke")) {
1339
1314
  const toolName = resolveToolName(config.poke.toolName, "poke_user");
1340
1315
  const description = resolveToolDescription(
1341
1316
  config.poke.description,
@@ -1350,7 +1325,7 @@ function registerNativeTools(deps) {
1350
1325
  });
1351
1326
  log?.("info", `\u6233\u4E00\u6233\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
1352
1327
  }
1353
- if (config.setSelfProfile.enabled) {
1328
+ if (isNativeToolEnabled(config, "setSelfProfile")) {
1354
1329
  const toolName = resolveToolName(
1355
1330
  config.setSelfProfile.toolName,
1356
1331
  "set_self_profile"
@@ -1368,7 +1343,7 @@ function registerNativeTools(deps) {
1368
1343
  });
1369
1344
  log?.("info", `\u8BBE\u7F6E\u8D44\u6599\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
1370
1345
  }
1371
- if (config.setQQAvatar.enabled) {
1346
+ if (isNativeToolEnabled(config, "setQQAvatar")) {
1372
1347
  const toolName = resolveToolName(
1373
1348
  config.setQQAvatar.toolName,
1374
1349
  "set_qq_avatar"
@@ -1386,7 +1361,7 @@ function registerNativeTools(deps) {
1386
1361
  });
1387
1362
  log?.("info", `QQ \u5934\u50CF\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
1388
1363
  }
1389
- if (config.setGroupCard.enabled) {
1364
+ if (isNativeToolEnabled(config, "setGroupCard")) {
1390
1365
  const toolName = resolveToolName(
1391
1366
  config.setGroupCard.toolName,
1392
1367
  "set_group_card"
@@ -1404,7 +1379,7 @@ function registerNativeTools(deps) {
1404
1379
  });
1405
1380
  log?.("info", `\u7FA4\u6635\u79F0\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
1406
1381
  }
1407
- if (config.setGroupBan.enabled) {
1382
+ if (isNativeToolEnabled(config, "setGroupBan")) {
1408
1383
  const toolName = resolveToolName(
1409
1384
  config.setGroupBan.toolName,
1410
1385
  "set_group_ban"
@@ -1422,7 +1397,7 @@ function registerNativeTools(deps) {
1422
1397
  });
1423
1398
  log?.("info", `\u7FA4\u6210\u5458\u7981\u8A00\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
1424
1399
  }
1425
- if (config.setGroupSpecialTitle.enabled) {
1400
+ if (isNativeToolEnabled(config, "setGroupSpecialTitle")) {
1426
1401
  const toolName = resolveToolName(
1427
1402
  config.setGroupSpecialTitle.toolName,
1428
1403
  "set_group_special_title"
@@ -1445,7 +1420,7 @@ function registerNativeTools(deps) {
1445
1420
  });
1446
1421
  log?.("info", `\u7FA4\u4E13\u5C5E\u5934\u8854\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
1447
1422
  }
1448
- if (config.setMsgEmoji.enabled) {
1423
+ if (isNativeToolEnabled(config, "setMsgEmoji")) {
1449
1424
  const toolName = resolveToolName(
1450
1425
  config.setMsgEmoji.toolName,
1451
1426
  "set_msg_emoji"
@@ -1463,7 +1438,7 @@ function registerNativeTools(deps) {
1463
1438
  });
1464
1439
  log?.("info", `\u6D88\u606F\u8868\u60C5\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
1465
1440
  }
1466
- if (config.deleteMessage.enabled) {
1441
+ if (isNativeToolEnabled(config, "deleteMessage")) {
1467
1442
  const toolName = resolveToolName(
1468
1443
  config.deleteMessage.toolName,
1469
1444
  "delete_msg"
@@ -2829,7 +2804,7 @@ function apply(ctx, config) {
2829
2804
  registerNativeTools({ ctx, config, plugin, protocol, log });
2830
2805
  xmlRuntime = enableXmlRuntime ? registerXmlTools({ ctx, config, protocol, log }) : null;
2831
2806
  if (characterCtx && xmlRuntime?.start()) {
2832
- log("info", "XML \u5DE5\u5177\u5DF2\u542F\u7528");
2807
+ log("info", "Character XML \u5DE5\u5177\u5DF2\u542F\u7528");
2833
2808
  }
2834
2809
  log("info", "toolbox \u521D\u59CB\u5316\u5B8C\u6210");
2835
2810
  };
@@ -2858,7 +2833,7 @@ function apply(ctx, config) {
2858
2833
  });
2859
2834
  if (!xmlRuntime) return;
2860
2835
  const started = xmlRuntime.start();
2861
- if (started) log("info", "XML \u5DE5\u5177\u5DF2\u542F\u7528");
2836
+ if (started) log("info", "Character XML \u5DE5\u5177\u5DF2\u542F\u7528");
2862
2837
  });
2863
2838
  }
2864
2839
  ctx.on("dispose", dispose);
@@ -2870,6 +2845,15 @@ function apply(ctx, config) {
2870
2845
  });
2871
2846
  }
2872
2847
  }
2848
+
2849
+ // src/index.ts
2850
+ var usage = `
2851
+ ## \u4F7F\u7528\u8BF4\u660E
2852
+
2853
+ Character XML \u5DE5\u5177\u4EC5\u4F9B [koishi-plugin-chatluna-character](https://github.com/ChatLunaLab/chatluna-character) \u4F7F\u7528\uFF1B\u5982\u679C\u4F60\u53EA\u5B89\u88C5\u4E86 ChatLuna \u4E3B\u63D2\u4EF6\uFF0C\u8BF7\u4E0D\u8981\u5F00\u542F\u8FD9\u4E00\u9879\u3002
2854
+
2855
+ \u5982\u679C\u4F60\u4E0D\u786E\u5B9A\u5F53\u524D\u73AF\u5883\u662F\u5426\u9700\u8981\u8FD9\u7EC4\u80FD\u529B\uFF0C\u4F18\u5148\u4FDD\u6301\u5173\u95ED\uFF0C\u6309 README \u7684\u8BF4\u660E\u9010\u9879\u542F\u7528\u5373\u53EF\u3002
2856
+ `;
2873
2857
  // Annotate the CommonJS export names for ESM import in node:
2874
2858
  0 && (module.exports = {
2875
2859
  BasicSettingsSchema,
@@ -2917,5 +2901,6 @@ function apply(ctx, config) {
2917
2901
  sendSetGroupCard,
2918
2902
  sendSetGroupSpecialTitle,
2919
2903
  sendSetProfile,
2920
- sendSetQQAvatar
2904
+ sendSetQQAvatar,
2905
+ usage
2921
2906
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna-toolbox",
3
- "description": "为 ChatLuna 提供更多原生工具、XML 工具与变量,仅支持 onebot 平台。",
4
- "version": "0.0.16",
3
+ "description": "为 ChatLuna 提供更多原生工具、Character XML 工具与变量,仅支持 onebot 平台。",
4
+ "version": "0.0.18",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
@@ -15,6 +15,12 @@
15
15
  "type": "git",
16
16
  "url": "https://github.com/Sor85/AAAAACAT-chatluna-plugins.git"
17
17
  },
18
+ "scripts": {
19
+ "build": "tsup && vite build",
20
+ "watch": "tsup --watch",
21
+ "typecheck": "yarn workspace shared-chatluna-xmltools build && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.test.json",
22
+ "test": "vitest run"
23
+ },
18
24
  "keywords": [
19
25
  "chatbot",
20
26
  "koishi",
@@ -22,16 +28,16 @@
22
28
  "chatluna"
23
29
  ],
24
30
  "peerDependencies": {
31
+ "@koishijs/plugin-console": "^5.30.0",
25
32
  "koishi": "^4.18.7",
26
33
  "koishi-plugin-chatluna": "*",
27
- "koishi-plugin-chatluna-character": "*",
28
- "@koishijs/plugin-console": "^5.30.0"
34
+ "koishi-plugin-chatluna-character": "*"
29
35
  },
30
36
  "peerDependenciesMeta": {
31
- "koishi-plugin-chatluna-character": {
37
+ "@koishijs/plugin-console": {
32
38
  "optional": true
33
39
  },
34
- "@koishijs/plugin-console": {
40
+ "koishi-plugin-chatluna-character": {
35
41
  "optional": true
36
42
  }
37
43
  },
@@ -44,17 +50,12 @@
44
50
  "@types/node": "^22.10.1",
45
51
  "@vitejs/plugin-vue": "^6.0.2",
46
52
  "sass": "^1.77.0",
53
+ "shared-chatluna-xmltools": "0.0.1",
54
+ "shared-nav": "0.0.1",
47
55
  "tsup": "^8.0.0",
48
56
  "typescript": "^5.7.2",
49
57
  "vite": "^6.0.0",
50
58
  "vitest": "^3.2.4",
51
- "shared-chatluna-xmltools": "0.0.1",
52
- "shared-nav": "0.0.1"
53
- },
54
- "scripts": {
55
- "build": "tsup && vite build",
56
- "watch": "tsup --watch",
57
- "typecheck": "NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.test.json",
58
- "test": "vitest run"
59
+ "vue": "^3.5.21"
59
60
  }
60
61
  }