@zhin.js/adapter-qq 6.0.1 → 6.0.2
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 +18 -0
- package/adapters/qq.js +49 -0
- package/commands/endpoint/add/[name:string=].js +3 -0
- package/commands/endpoint/cancel.js +12 -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 +16 -0
- package/plugin.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @zhin.js/adapter-qq
|
|
2
2
|
|
|
3
|
+
## 6.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d5cd4aa: Publish Plugin Runtime entry points and convention modules as JavaScript so
|
|
8
|
+
installed npm plugins load on Node without TypeScript stripping. Workspace
|
|
9
|
+
development continues to prefer TypeScript sources for local HMR.
|
|
10
|
+
|
|
11
|
+
Remove the unconsumed legacy game hub APIs from game-kit; game navigation and
|
|
12
|
+
records now use ordinary convention commands owned by the game hub plugin.
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [d5cd4aa]
|
|
15
|
+
- @zhin.js/command@1.0.4
|
|
16
|
+
- zhin.js@5.0.2
|
|
17
|
+
- @zhin.js/adapter@1.1.2
|
|
18
|
+
- @zhin.js/core@1.4.2
|
|
19
|
+
- @zhin.js/agent@1.0.7
|
|
20
|
+
|
|
3
21
|
## 6.0.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/adapters/qq.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* Convention entry: discover `adapters/qq.ts` → defineAdapter.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAdapter } from '@zhin.js/adapter';
|
|
6
|
+
import { messageGatewayToken } from '@zhin.js/core/runtime';
|
|
7
|
+
import { httpHostToken } from '@zhin.js/host-http';
|
|
8
|
+
import { QqHttpEndpoint, QqWebsocketEndpoint } from "../lib/endpoint.js";
|
|
9
|
+
import { resolveQqConfig, } from "../lib/protocol.js";
|
|
10
|
+
import { qqRuntimeStateToken } from "../lib/qq-runtime-state.js";
|
|
11
|
+
export { QqHttpEndpoint, QqWebsocketEndpoint, } from "../lib/endpoint.js";
|
|
12
|
+
export default defineAdapter({
|
|
13
|
+
capabilities: ['inbound', 'outbound'],
|
|
14
|
+
// 媒体 url 直发,base64/path 由 SDK formatMediaData 物化走 /files 上传;
|
|
15
|
+
// markdown/keyboard 原生按钮承载交互段。
|
|
16
|
+
segments: {
|
|
17
|
+
outboundMedia: ['url', 'upload'],
|
|
18
|
+
interactive: 'native',
|
|
19
|
+
},
|
|
20
|
+
create(context) {
|
|
21
|
+
const config = resolveQqConfig(context.config);
|
|
22
|
+
const gateway = context.use(messageGatewayToken);
|
|
23
|
+
// 注册到插件运行时状态(qq endpoint list 的"运行中"数据源)
|
|
24
|
+
const state = context.use(qqRuntimeStateToken);
|
|
25
|
+
state.endpoints.set(config.name, {
|
|
26
|
+
name: config.name,
|
|
27
|
+
mode: config.mode,
|
|
28
|
+
});
|
|
29
|
+
const endpoint = (config.mode === 'webhook' || config.mode === 'middleware')
|
|
30
|
+
? new QqHttpEndpoint({
|
|
31
|
+
id: context.id,
|
|
32
|
+
gateway,
|
|
33
|
+
http: context.use(httpHostToken),
|
|
34
|
+
config,
|
|
35
|
+
})
|
|
36
|
+
: new QqWebsocketEndpoint({
|
|
37
|
+
id: context.id,
|
|
38
|
+
gateway,
|
|
39
|
+
config,
|
|
40
|
+
});
|
|
41
|
+
// 运行状态表只增不减:stop 时同步摘除,避免 stop 后 endpoint list 仍显示运行中。
|
|
42
|
+
const stopEndpoint = endpoint.stop.bind(endpoint);
|
|
43
|
+
endpoint.stop = async () => {
|
|
44
|
+
state.endpoints.delete(config.name);
|
|
45
|
+
await stopEndpoint();
|
|
46
|
+
};
|
|
47
|
+
return endpoint;
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { defineCommand } from '@zhin.js/command';
|
|
3
|
+
import { isQqEndpointOperator, QQ_ENDPOINT_FORBIDDEN, runQqEndpointCancel, } from "../../lib/qq-endpoint-commands.js";
|
|
4
|
+
import { qqRuntimeStateToken } from "../../lib/qq-runtime-state.js";
|
|
5
|
+
export default defineCommand({
|
|
6
|
+
description: '取消进行中的 QQ 扫码绑定流程',
|
|
7
|
+
execute({ config, input, use }) {
|
|
8
|
+
if (!isQqEndpointOperator(config, input))
|
|
9
|
+
return QQ_ENDPOINT_FORBIDDEN;
|
|
10
|
+
return runQqEndpointCancel(use(qqRuntimeStateToken));
|
|
11
|
+
},
|
|
12
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-qq",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "Zhin.js QQ Official adapter for Plugin Runtime (WebSocket gateway)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"qq-official-bot": "^1.2.3",
|
|
38
|
-
"@zhin.js/adapter": "1.1.
|
|
39
|
-
"@zhin.js/command": "1.0.
|
|
40
|
-
"@zhin.js/core": "1.4.
|
|
38
|
+
"@zhin.js/adapter": "1.1.2",
|
|
39
|
+
"@zhin.js/command": "1.0.4",
|
|
40
|
+
"@zhin.js/core": "1.4.2",
|
|
41
41
|
"@zhin.js/host-http": "1.0.3",
|
|
42
42
|
"@zhin.js/logger": "1.0.75",
|
|
43
43
|
"@zhin.js/plugin-runtime": "1.1.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"zod": "^4.0.0",
|
|
47
|
-
"@zhin.js/adapter": "1.1.
|
|
48
|
-
"@zhin.js/agent": "1.0.
|
|
49
|
-
"@zhin.js/core": "1.4.
|
|
47
|
+
"@zhin.js/adapter": "1.1.2",
|
|
48
|
+
"@zhin.js/agent": "1.0.7",
|
|
49
|
+
"@zhin.js/core": "1.4.2",
|
|
50
50
|
"@zhin.js/plugin-runtime": "1.1.1",
|
|
51
|
-
"zhin.js": "5.0.
|
|
51
|
+
"zhin.js": "5.0.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"zhin.js": {
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"typescript": "^6.0.3",
|
|
67
67
|
"vitest": "^4.1.10",
|
|
68
68
|
"zod": "^4.4.3",
|
|
69
|
-
"@zhin.js/agent": "1.0.
|
|
69
|
+
"@zhin.js/agent": "1.0.7",
|
|
70
70
|
"@zhin.js/host-http": "1.0.3",
|
|
71
|
-
"zhin.js": "5.0.
|
|
71
|
+
"zhin.js": "5.0.2"
|
|
72
72
|
},
|
|
73
73
|
"files": [
|
|
74
74
|
"adapters",
|
|
75
75
|
"commands",
|
|
76
|
-
"plugin.
|
|
76
|
+
"plugin.js",
|
|
77
77
|
"schema.json",
|
|
78
78
|
"src",
|
|
79
79
|
"lib",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"zhin": {
|
|
92
92
|
"protocol": 1,
|
|
93
93
|
"type": "plugin",
|
|
94
|
-
"entry": "./plugin.
|
|
94
|
+
"entry": "./plugin.js",
|
|
95
95
|
"engine": "^1.0.0",
|
|
96
96
|
"runtime": "trusted",
|
|
97
97
|
"features": [
|
package/plugin.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { definePlugin } from '@zhin.js/plugin-runtime';
|
|
3
|
+
import { registerQqPlatformPermitChecker } from "./lib/platform-permit.js";
|
|
4
|
+
import { createQqRuntimeState, qqRuntimeStateToken } from "./lib/qq-runtime-state.js";
|
|
5
|
+
export default definePlugin({
|
|
6
|
+
name: 'qq',
|
|
7
|
+
metadata: {
|
|
8
|
+
displayName: 'QQ Official WebSocket Adapter',
|
|
9
|
+
},
|
|
10
|
+
setup(context) {
|
|
11
|
+
// 运行中 endpoint 注册表 + 扫码绑定单例,供 adapter create 与 `qq endpoint` 命令共享
|
|
12
|
+
context.resources.provide(qqRuntimeStateToken, createQqRuntimeState());
|
|
13
|
+
// 平台权限门禁:guild_owner / guild_admin / manage_roles / manage_channels(agent 工具 platformPermit)
|
|
14
|
+
return registerQqPlatformPermitChecker();
|
|
15
|
+
},
|
|
16
|
+
});
|
package/plugin.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { definePlugin } from '@zhin.js/plugin-runtime';
|
|
2
|
-
import { registerQqPlatformPermitChecker } from './src/platform-permit.js';
|
|
3
|
-
import { createQqRuntimeState, qqRuntimeStateToken } from './src/qq-runtime-state.js';
|
|
4
|
-
|
|
5
|
-
export default definePlugin({
|
|
6
|
-
name: 'qq',
|
|
7
|
-
metadata: {
|
|
8
|
-
displayName: 'QQ Official WebSocket Adapter',
|
|
9
|
-
},
|
|
10
|
-
setup(context) {
|
|
11
|
-
// 运行中 endpoint 注册表 + 扫码绑定单例,供 adapter create 与 `qq endpoint` 命令共享
|
|
12
|
-
context.resources.provide(qqRuntimeStateToken, createQqRuntimeState());
|
|
13
|
-
// 平台权限门禁:guild_owner / guild_admin / manage_roles / manage_channels(agent 工具 platformPermit)
|
|
14
|
-
return registerQqPlatformPermitChecker();
|
|
15
|
-
},
|
|
16
|
-
});
|