@zhin.js/adapter-kook 5.0.3 → 6.0.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,26 @@
1
1
  # @zhin.js/adapter-kook
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7db69c1: 命令前缀改为适配器配置项:`MessageDispatcher` 不再硬编码 `/`,默认按消息所属适配器实例 config 的 `commandPrefix` 解析(默认 `''` 无前缀,任意文本按命令匹配),`endpoints[i].commandPrefix` 逐项覆盖;`ImRuntime({ commandPrefix })` 仍可设全局静态前缀。全部 20 个平台适配器 schema 新增 `commandPrefix` 属性。
8
+
9
+ BREAKING(行为变化):未配置时命令不再需要 `/` 前缀——原 `/zt` 写法不再命中,直接发 `zt` 即可;需要斜杠风格的适配器请在配置里显式设 `commandPrefix: '/'`。
10
+
11
+ - 713445c: 适配器配置格式定稿(不兼容旧格式):`plugins.<adapter>` 顶层仅共享字段 + `commandPrefix`,`endpoints[i]` 携带 endpoint 级字段(`name` + 凭据,各 schema 已类型化),`endpoints` 为必填(icqq 另需顶层 `master`);icqq 新增 `trusted` 列表(顶层/逐项均可)。scaffold-wizard 全部字段式与自定义 configure() 产出改为新格式,examples(full-bot / qq-games-bot)与 20 个适配器 README 同步迁移。
12
+ - Updated dependencies [7db69c1]
13
+ - Updated dependencies [e5c84ed]
14
+ - Updated dependencies [3ea84a0]
15
+ - Updated dependencies [1ddcd70]
16
+ - Updated dependencies [ac9da66]
17
+ - @zhin.js/core@1.4.0
18
+ - @zhin.js/adapter@1.1.0
19
+ - @zhin.js/plugin-runtime@1.1.0
20
+ - @zhin.js/agent@1.0.5
21
+ - @zhin.js/host-http@1.0.2
22
+ - zhin.js@5.0.0
23
+
3
24
  ## 5.0.3
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -38,7 +38,7 @@ pnpm add @zhin.js/adapter-kook
38
38
  | **Webhook** | 需公网 HTTPS + Host `httpHostToken`;与 WebSocket 互斥 |
39
39
  | **host-http** | 仅 Webhook 模式需要 |
40
40
 
41
- 必填字段:`token`。
41
+ 必填字段(`endpoints[i]`):`name`、`token`。
42
42
 
43
43
  ## 最小配置
44
44
 
@@ -46,9 +46,10 @@ pnpm add @zhin.js/adapter-kook
46
46
  # zhin.config.yml(Plugin Runtime)
47
47
  plugins:
48
48
  kook:
49
- name: my-kook-bot
50
- token: ${KOOK_TOKEN}
51
49
  # connection: websocket # 默认
50
+ endpoints:
51
+ - name: my-kook-bot
52
+ token: ${KOOK_TOKEN}
52
53
  ```
53
54
 
54
55
  根插件 `zhin.plugins`(或项目图)需引用 `@zhin.js/adapter-kook`(`instanceKey: kook`)。
@@ -70,12 +71,13 @@ plugins:
70
71
  ```yaml
71
72
  plugins:
72
73
  kook:
73
- name: my-kook-bot
74
- token: ${KOOK_TOKEN}
75
74
  connection: webhook
76
- verify_token: ${KOOK_VERIFY_TOKEN}
77
75
  webhookPath: /kook/webhook
78
- # encrypt_key: ${KOOK_ENCRYPT_KEY} # 启用消息加密时必填
76
+ endpoints:
77
+ - name: my-kook-bot
78
+ token: ${KOOK_TOKEN}
79
+ verify_token: ${KOOK_VERIFY_TOKEN}
80
+ # encrypt_key: ${KOOK_ENCRYPT_KEY} # 启用消息加密时必填
79
81
  ```
80
82
 
81
83
  Host 需注入 `httpHostToken`。Challenge(`type: 255`)会校验 `verify_token` 并回显 `challenge`;普通事件经 `gateway.receive` 入站,出站仍走 KOOK HTTP API。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-kook",
3
- "version": "5.0.3",
3
+ "version": "6.0.0",
4
4
  "description": "Zhin.js KOOK adapter for Plugin Runtime (WebSocket gateway or Webhook)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -34,19 +34,19 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "kook-client": "^1.0.4",
37
- "@zhin.js/adapter": "1.0.1",
38
- "@zhin.js/core": "1.3.5",
39
- "@zhin.js/host-http": "1.0.1",
37
+ "@zhin.js/adapter": "1.1.0",
38
+ "@zhin.js/core": "1.4.0",
39
+ "@zhin.js/host-http": "1.0.2",
40
40
  "@zhin.js/logger": "1.0.75",
41
- "@zhin.js/plugin-runtime": "1.0.1"
41
+ "@zhin.js/plugin-runtime": "1.1.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "zod": "^4.0.0",
45
- "@zhin.js/adapter": "1.0.1",
46
- "@zhin.js/agent": "1.0.4",
47
- "@zhin.js/core": "1.3.5",
48
- "@zhin.js/plugin-runtime": "1.0.1",
49
- "zhin.js": "4.1.3"
45
+ "@zhin.js/adapter": "1.1.0",
46
+ "@zhin.js/agent": "1.0.5",
47
+ "@zhin.js/core": "1.4.0",
48
+ "@zhin.js/plugin-runtime": "1.1.0",
49
+ "zhin.js": "5.0.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "zhin.js": {
@@ -64,9 +64,9 @@
64
64
  "typescript": "^6.0.3",
65
65
  "vitest": "^4.1.10",
66
66
  "zod": "^4.4.3",
67
- "@zhin.js/agent": "1.0.4",
68
- "@zhin.js/host-http": "1.0.1",
69
- "zhin.js": "4.1.3"
67
+ "@zhin.js/agent": "1.0.5",
68
+ "@zhin.js/host-http": "1.0.2",
69
+ "zhin.js": "5.0.0"
70
70
  },
71
71
  "files": [
72
72
  "adapters",
package/schema.json CHANGED
@@ -3,16 +3,12 @@
3
3
  "type": "object",
4
4
  "additionalProperties": false,
5
5
  "properties": {
6
- "name": {
7
- "type": "string",
8
- "default": "kook-bot"
9
- },
10
- "token": {
11
- "type": "string"
12
- },
13
6
  "connection": {
14
7
  "type": "string",
15
- "enum": ["websocket", "webhook"],
8
+ "enum": [
9
+ "websocket",
10
+ "webhook"
11
+ ],
16
12
  "default": "websocket",
17
13
  "description": "WebSocket gateway (default). webhook requires httpHostToken, verify_token, and a public HTTPS callback URL."
18
14
  },
@@ -21,14 +17,6 @@
21
17
  "default": "/kook/webhook",
22
18
  "description": "POST path registered via httpHostToken when connection is webhook."
23
19
  },
24
- "verify_token": {
25
- "type": "string",
26
- "description": "KOOK developer console verify token (required for webhook mode)."
27
- },
28
- "encrypt_key": {
29
- "type": "string",
30
- "description": "Optional Encrypt Key when message encryption is enabled in KOOK console."
31
- },
32
20
  "data_dir": {
33
21
  "type": "string"
34
22
  },
@@ -42,14 +30,63 @@
42
30
  },
43
31
  "ignore": {
44
32
  "type": "string",
45
- "enum": ["bot", "self"],
33
+ "enum": [
34
+ "bot",
35
+ "self"
36
+ ],
46
37
  "default": "bot"
47
38
  },
48
39
  "logLevel": {
49
40
  "type": "string",
50
- "enum": ["trace", "debug", "info", "warn", "error", "fatal", "mark", "off"],
41
+ "enum": [
42
+ "trace",
43
+ "debug",
44
+ "info",
45
+ "warn",
46
+ "error",
47
+ "fatal",
48
+ "mark",
49
+ "off"
50
+ ],
51
51
  "default": "info"
52
+ },
53
+ "endpoints": {
54
+ "type": "array",
55
+ "description": "多账号:一个插件实例挂多个 endpoint。每项与顶层字段同构(name 必填,其余覆盖顶层)",
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": true,
59
+ "properties": {
60
+ "name": {
61
+ "type": "string",
62
+ "description": "KOOK bot name"
63
+ },
64
+ "token": {
65
+ "type": "string",
66
+ "description": "KOOK bot token"
67
+ },
68
+ "verify_token": {
69
+ "type": "string",
70
+ "description": "KOOK developer console verify token (required for webhook mode)."
71
+ },
72
+ "encrypt_key": {
73
+ "type": "string",
74
+ "description": "Optional Encrypt Key when message encryption is enabled in KOOK console."
75
+ }
76
+ },
77
+ "required": [
78
+ "name",
79
+ "token"
80
+ ]
81
+ }
82
+ },
83
+ "commandPrefix": {
84
+ "type": "string",
85
+ "default": "",
86
+ "description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖"
52
87
  }
53
88
  },
54
- "required": ["token"]
89
+ "required": [
90
+ "endpoints"
91
+ ]
55
92
  }