@zhin.js/adapter-discord 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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @zhin.js/adapter-discord
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
@@ -0,0 +1,41 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ /**
3
+ * Convention entry: discover `adapters/discord.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 { DiscordGatewayEndpoint, DiscordInteractionsEndpoint, } from "../lib/endpoint.js";
9
+ import { resolveDiscordConfig, } from "../lib/protocol.js";
10
+ import { discordRuntimeStateToken } from "../lib/discord-runtime-state.js";
11
+ export { DiscordGatewayEndpoint, DiscordInteractionsEndpoint, } from "../lib/endpoint.js";
12
+ export default defineAdapter({
13
+ capabilities: ['inbound', 'outbound'],
14
+ // 媒体 url 直发或由 AttachmentBuilder 物化本地文件上传;message components 原生按钮承载交互段。
15
+ segments: {
16
+ outboundMedia: ['url', 'upload'],
17
+ interactive: 'native',
18
+ },
19
+ create(context) {
20
+ const config = resolveDiscordConfig(context.config);
21
+ const gateway = context.use(messageGatewayToken);
22
+ // 注册到插件运行时状态(discord endpoint list 的"运行中"数据源)
23
+ context.use(discordRuntimeStateToken).endpoints.set(config.name, {
24
+ name: config.name,
25
+ mode: config.connection,
26
+ });
27
+ if (config.connection === 'interactions') {
28
+ return new DiscordInteractionsEndpoint({
29
+ id: context.id,
30
+ gateway,
31
+ http: context.use(httpHostToken),
32
+ config,
33
+ });
34
+ }
35
+ return new DiscordGatewayEndpoint({
36
+ id: context.id,
37
+ gateway,
38
+ config,
39
+ });
40
+ },
41
+ });
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { discordEndpointCommands } from "../../../lib/discord-endpoint-commands.js";
3
+ export default discordEndpointCommands.add;
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { discordEndpointCommands } from "../../lib/discord-endpoint-commands.js";
3
+ export default discordEndpointCommands.list;
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { discordEndpointCommands } from "../../../lib/discord-endpoint-commands.js";
3
+ export default discordEndpointCommands.remove;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-discord",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Zhin.js Discord adapter for Plugin Runtime (Gateway WebSocket)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -33,20 +33,20 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "discord.js": "^14.26.4",
36
- "@zhin.js/adapter": "1.1.1",
37
- "@zhin.js/command": "1.0.3",
38
- "@zhin.js/core": "1.4.1",
36
+ "@zhin.js/adapter": "1.1.2",
37
+ "@zhin.js/command": "1.0.4",
38
+ "@zhin.js/core": "1.4.2",
39
39
  "@zhin.js/host-http": "1.0.3",
40
40
  "@zhin.js/logger": "1.0.75",
41
41
  "@zhin.js/plugin-runtime": "1.1.1"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "zod": "^4.0.0",
45
- "@zhin.js/adapter": "1.1.1",
46
- "@zhin.js/agent": "1.0.6",
47
- "@zhin.js/core": "1.4.1",
45
+ "@zhin.js/adapter": "1.1.2",
46
+ "@zhin.js/agent": "1.0.7",
47
+ "@zhin.js/core": "1.4.2",
48
48
  "@zhin.js/plugin-runtime": "1.1.1",
49
- "zhin.js": "5.0.1"
49
+ "zhin.js": "5.0.2"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "zhin.js": {
@@ -64,14 +64,14 @@
64
64
  "typescript": "^6.0.3",
65
65
  "vitest": "^4.1.10",
66
66
  "zod": "^4.4.3",
67
- "@zhin.js/agent": "1.0.6",
67
+ "@zhin.js/agent": "1.0.7",
68
68
  "@zhin.js/host-http": "1.0.3",
69
- "zhin.js": "5.0.1"
69
+ "zhin.js": "5.0.2"
70
70
  },
71
71
  "files": [
72
72
  "adapters",
73
73
  "commands",
74
- "plugin.ts",
74
+ "plugin.js",
75
75
  "schema.json",
76
76
  "src",
77
77
  "lib",
@@ -89,7 +89,7 @@
89
89
  "zhin": {
90
90
  "protocol": 1,
91
91
  "type": "plugin",
92
- "entry": "./plugin.ts",
92
+ "entry": "./plugin.js",
93
93
  "engine": "^1.0.0",
94
94
  "runtime": "trusted",
95
95
  "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 { registerDiscordPlatformPermitChecker } from "./lib/platform-permit.js";
5
+ import { discordRuntimeStateToken } from "./lib/discord-runtime-state.js";
6
+ export default definePlugin({
7
+ name: 'discord',
8
+ metadata: {
9
+ displayName: 'Discord Gateway Adapter',
10
+ },
11
+ setup(context) {
12
+ // 运行中 endpoint 注册表(discord endpoint list 的"运行中"数据源)
13
+ context.resources.provide(discordRuntimeStateToken, createEndpointRuntimeState());
14
+ // 平台权限门禁:guild_owner / moderate_members 等(agent 工具 platformPermit)
15
+ return registerDiscordPlatformPermitChecker();
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 { registerDiscordPlatformPermitChecker } from './src/platform-permit.js';
4
- import { discordRuntimeStateToken } from './src/discord-runtime-state.js';
5
-
6
- export default definePlugin({
7
- name: 'discord',
8
- metadata: {
9
- displayName: 'Discord Gateway Adapter',
10
- },
11
- setup(context) {
12
- // 运行中 endpoint 注册表(discord endpoint list 的"运行中"数据源)
13
- context.resources.provide(discordRuntimeStateToken, createEndpointRuntimeState());
14
- // 平台权限门禁:guild_owner / moderate_members 等(agent 工具 platformPermit)
15
- return registerDiscordPlatformPermitChecker();
16
- },
17
- });