@zhin.js/adapter-kook 6.0.1 → 6.0.3
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 +27 -0
- package/adapters/kook.js +42 -0
- package/commands/endpoint/add/[name:string].js +3 -0
- package/commands/endpoint/list.js +3 -0
- package/commands/endpoint/remove/[name:string].js +3 -0
- package/package.json +12 -12
- package/plugin.js +17 -0
- package/plugin.ts +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @zhin.js/adapter-kook
|
|
2
2
|
|
|
3
|
+
## 6.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [f346346]
|
|
8
|
+
- @zhin.js/agent@1.0.8
|
|
9
|
+
- @zhin.js/core@1.4.2
|
|
10
|
+
- zhin.js@5.0.2
|
|
11
|
+
|
|
12
|
+
## 6.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- d5cd4aa: Publish Plugin Runtime entry points and convention modules as JavaScript so
|
|
17
|
+
installed npm plugins load on Node without TypeScript stripping. Workspace
|
|
18
|
+
development continues to prefer TypeScript sources for local HMR.
|
|
19
|
+
|
|
20
|
+
Remove the unconsumed legacy game hub APIs from game-kit; game navigation and
|
|
21
|
+
records now use ordinary convention commands owned by the game hub plugin.
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [d5cd4aa]
|
|
24
|
+
- @zhin.js/command@1.0.4
|
|
25
|
+
- zhin.js@5.0.2
|
|
26
|
+
- @zhin.js/adapter@1.1.2
|
|
27
|
+
- @zhin.js/core@1.4.2
|
|
28
|
+
- @zhin.js/agent@1.0.7
|
|
29
|
+
|
|
3
30
|
## 6.0.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/adapters/kook.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* Convention entry: discover `adapters/kook.ts` → defineAdapter.
|
|
4
|
+
* Implementation lives under `src/` (endpoint / webhook / ws / protocol).
|
|
5
|
+
*/
|
|
6
|
+
import { defineAdapter } from '@zhin.js/adapter';
|
|
7
|
+
import { messageGatewayToken } from '@zhin.js/core/runtime';
|
|
8
|
+
import { httpHostToken } from '@zhin.js/host-http';
|
|
9
|
+
import { KookWebhookEndpoint, KookWebsocketEndpoint, } from "../lib/endpoint.js";
|
|
10
|
+
import { resolveKookConfig, } from "../lib/protocol.js";
|
|
11
|
+
import { kookRuntimeStateToken } from "../lib/kook-runtime-state.js";
|
|
12
|
+
export { KookWebhookEndpoint, KookWebsocketEndpoint, } from "../lib/endpoint.js";
|
|
13
|
+
export default defineAdapter({
|
|
14
|
+
capabilities: ['inbound', 'outbound'],
|
|
15
|
+
// KOOK 图片消息消费远程 URL;无按钮交互面,交互段降级纯文本。
|
|
16
|
+
segments: {
|
|
17
|
+
outboundMedia: ['url'],
|
|
18
|
+
interactive: 'text',
|
|
19
|
+
},
|
|
20
|
+
create(context) {
|
|
21
|
+
const config = resolveKookConfig(context.config);
|
|
22
|
+
const gateway = context.use(messageGatewayToken);
|
|
23
|
+
// 注册到插件运行时状态(kook endpoint list 的"运行中"数据源)
|
|
24
|
+
context.use(kookRuntimeStateToken).endpoints.set(config.name, {
|
|
25
|
+
name: config.name,
|
|
26
|
+
mode: config.connection,
|
|
27
|
+
});
|
|
28
|
+
if (config.connection === 'webhook') {
|
|
29
|
+
return new KookWebhookEndpoint({
|
|
30
|
+
id: context.id,
|
|
31
|
+
gateway,
|
|
32
|
+
http: context.use(httpHostToken),
|
|
33
|
+
config,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return new KookWebsocketEndpoint({
|
|
37
|
+
id: context.id,
|
|
38
|
+
gateway,
|
|
39
|
+
config,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-kook",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
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,20 +34,20 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"kook-client": "^1.0.4",
|
|
37
|
-
"@zhin.js/adapter": "1.1.
|
|
38
|
-
"@zhin.js/command": "1.0.
|
|
39
|
-
"@zhin.js/core": "1.4.
|
|
37
|
+
"@zhin.js/adapter": "1.1.2",
|
|
38
|
+
"@zhin.js/command": "1.0.4",
|
|
39
|
+
"@zhin.js/core": "1.4.2",
|
|
40
40
|
"@zhin.js/host-http": "1.0.3",
|
|
41
41
|
"@zhin.js/logger": "1.0.75",
|
|
42
42
|
"@zhin.js/plugin-runtime": "1.1.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"zod": "^4.0.0",
|
|
46
|
-
"@zhin.js/adapter": "1.1.
|
|
47
|
-
"@zhin.js/agent": "1.0.
|
|
48
|
-
"@zhin.js/core": "1.4.
|
|
46
|
+
"@zhin.js/adapter": "1.1.2",
|
|
47
|
+
"@zhin.js/agent": "1.0.8",
|
|
48
|
+
"@zhin.js/core": "1.4.2",
|
|
49
49
|
"@zhin.js/plugin-runtime": "1.1.1",
|
|
50
|
-
"zhin.js": "5.0.
|
|
50
|
+
"zhin.js": "5.0.2"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"zhin.js": {
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
66
|
"vitest": "^4.1.10",
|
|
67
67
|
"zod": "^4.4.3",
|
|
68
|
-
"@zhin.js/agent": "1.0.
|
|
68
|
+
"@zhin.js/agent": "1.0.8",
|
|
69
69
|
"@zhin.js/host-http": "1.0.3",
|
|
70
|
-
"zhin.js": "5.0.
|
|
70
|
+
"zhin.js": "5.0.2"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"adapters",
|
|
74
74
|
"commands",
|
|
75
|
-
"plugin.
|
|
75
|
+
"plugin.js",
|
|
76
76
|
"schema.json",
|
|
77
77
|
"src",
|
|
78
78
|
"lib",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"zhin": {
|
|
91
91
|
"protocol": 1,
|
|
92
92
|
"type": "plugin",
|
|
93
|
-
"entry": "./plugin.
|
|
93
|
+
"entry": "./plugin.js",
|
|
94
94
|
"engine": "^1.0.0",
|
|
95
95
|
"runtime": "trusted",
|
|
96
96
|
"features": [
|
package/plugin.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { createEndpointRuntimeState } from '@zhin.js/adapter';
|
|
3
|
+
import { definePlugin } from '@zhin.js/plugin-runtime';
|
|
4
|
+
import { registerKookPlatformPermitChecker } from "./lib/platform-permit.js";
|
|
5
|
+
import { kookRuntimeStateToken } from "./lib/kook-runtime-state.js";
|
|
6
|
+
export default definePlugin({
|
|
7
|
+
name: 'kook',
|
|
8
|
+
metadata: {
|
|
9
|
+
displayName: 'KOOK WebSocket Adapter',
|
|
10
|
+
},
|
|
11
|
+
setup(context) {
|
|
12
|
+
// 运行中 endpoint 注册表(kook endpoint list 的"运行中"数据源)
|
|
13
|
+
context.resources.provide(kookRuntimeStateToken, createEndpointRuntimeState());
|
|
14
|
+
// 平台权限门禁:guild_owner / guild_admin / channel_admin 等(agent 工具 platformPermit)
|
|
15
|
+
return registerKookPlatformPermitChecker();
|
|
16
|
+
},
|
|
17
|
+
});
|
package/plugin.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createEndpointRuntimeState } from '@zhin.js/adapter';
|
|
2
|
-
import { definePlugin } from '@zhin.js/plugin-runtime';
|
|
3
|
-
import { registerKookPlatformPermitChecker } from './src/platform-permit.js';
|
|
4
|
-
import { kookRuntimeStateToken } from './src/kook-runtime-state.js';
|
|
5
|
-
|
|
6
|
-
export default definePlugin({
|
|
7
|
-
name: 'kook',
|
|
8
|
-
metadata: {
|
|
9
|
-
displayName: 'KOOK WebSocket Adapter',
|
|
10
|
-
},
|
|
11
|
-
setup(context) {
|
|
12
|
-
// 运行中 endpoint 注册表(kook endpoint list 的"运行中"数据源)
|
|
13
|
-
context.resources.provide(kookRuntimeStateToken, createEndpointRuntimeState());
|
|
14
|
-
// 平台权限门禁:guild_owner / guild_admin / channel_admin 等(agent 工具 platformPermit)
|
|
15
|
-
return registerKookPlatformPermitChecker();
|
|
16
|
-
},
|
|
17
|
-
});
|