@zhin.js/adapter-napcat 5.0.1 → 5.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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @zhin.js/adapter-napcat
2
2
 
3
+ ## 5.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
+ ## 5.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
  ## 5.0.1
4
31
 
5
32
  ### Patch Changes
@@ -0,0 +1,39 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ /**
3
+ * Convention entry: discover `adapters/napcat.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 { NapCatHttpEndpoint } from "../lib/http-endpoint.js";
9
+ import { resolveNapCatConfig } from "../lib/protocol.js";
10
+ import { NapCatWsEndpoint } from "../lib/ws-endpoint.js";
11
+ import { NapCatWssEndpoint } from "../lib/wss-endpoint.js";
12
+ import { napcatRuntimeStateToken } from "../lib/napcat-runtime-state.js";
13
+ export { NapCatHttpEndpoint, } from "../lib/http-endpoint.js";
14
+ export { NapCatWsEndpoint, } from "../lib/ws-endpoint.js";
15
+ export { NapCatWssEndpoint, } from "../lib/wss-endpoint.js";
16
+ export default defineAdapter({
17
+ capabilities: ['inbound', 'outbound'],
18
+ // OneBot file 参数原生消费 url / base64:// 媒体;无卡片交互面,交互段降级纯文本。
19
+ segments: {
20
+ outboundMedia: ['url', 'base64'],
21
+ interactive: 'text',
22
+ },
23
+ create(context) {
24
+ const config = resolveNapCatConfig(context.config);
25
+ const gateway = context.use(messageGatewayToken);
26
+ // 注册到插件运行时状态(napcat endpoint list 的"运行中"数据源)
27
+ context.use(napcatRuntimeStateToken).endpoints.set(config.name, {
28
+ name: config.name,
29
+ mode: config.connection,
30
+ });
31
+ if (config.connection === 'wss') {
32
+ return new NapCatWssEndpoint({ id: context.id, gateway, http: context.use(httpHostToken), config });
33
+ }
34
+ if (config.connection === 'http') {
35
+ return new NapCatHttpEndpoint({ id: context.id, gateway, http: context.use(httpHostToken), config });
36
+ }
37
+ return new NapCatWsEndpoint({ id: context.id, gateway, config });
38
+ },
39
+ });
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { napcatEndpointCommands } from "../../../lib/napcat-endpoint-commands.js";
3
+ export default napcatEndpointCommands.add;
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { napcatEndpointCommands } from "../../lib/napcat-endpoint-commands.js";
3
+ export default napcatEndpointCommands.list;
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { napcatEndpointCommands } from "../../../lib/napcat-endpoint-commands.js";
3
+ export default napcatEndpointCommands.remove;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-napcat",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Zhin.js NapCat adapter for Plugin Runtime (WebSocket client, OneBot11 + NapCat extensions)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -15,7 +15,7 @@
15
15
  "files": [
16
16
  "adapters",
17
17
  "commands",
18
- "plugin.ts",
18
+ "plugin.js",
19
19
  "schema.json",
20
20
  "src",
21
21
  "lib",
@@ -43,9 +43,9 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "ws": "^8.21.0",
46
- "@zhin.js/adapter": "1.1.1",
47
- "@zhin.js/command": "1.0.3",
48
- "@zhin.js/core": "1.4.1",
46
+ "@zhin.js/adapter": "1.1.2",
47
+ "@zhin.js/command": "1.0.4",
48
+ "@zhin.js/core": "1.4.2",
49
49
  "@zhin.js/host-http": "1.0.3",
50
50
  "@zhin.js/logger": "1.0.75",
51
51
  "@zhin.js/plugin-runtime": "1.1.1"
@@ -56,16 +56,16 @@
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "^4.1.10",
58
58
  "zod": "^4.4.3",
59
- "@zhin.js/agent": "1.0.6",
59
+ "@zhin.js/agent": "1.0.8",
60
60
  "@zhin.js/host-http": "1.0.3"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "zod": "^4.0.0",
64
- "@zhin.js/adapter": "1.1.1",
65
- "@zhin.js/core": "1.4.1",
64
+ "@zhin.js/adapter": "1.1.2",
65
+ "@zhin.js/core": "1.4.2",
66
66
  "@zhin.js/plugin-runtime": "1.1.1",
67
- "zhin.js": "5.0.1",
68
- "@zhin.js/agent": "1.0.6"
67
+ "zhin.js": "5.0.2",
68
+ "@zhin.js/agent": "1.0.8"
69
69
  },
70
70
  "peerDependenciesMeta": {
71
71
  "zhin.js": {
@@ -93,7 +93,7 @@
93
93
  "zhin": {
94
94
  "protocol": 1,
95
95
  "type": "plugin",
96
- "entry": "./plugin.ts",
96
+ "entry": "./plugin.js",
97
97
  "engine": "^1.0.0",
98
98
  "runtime": "trusted",
99
99
  "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 { registerDefaultScenePlatformPermitChecker } from '@zhin.js/core';
5
+ import { napcatRuntimeStateToken } from "./lib/napcat-runtime-state.js";
6
+ export default definePlugin({
7
+ name: 'napcat',
8
+ metadata: {
9
+ displayName: 'NapCat Adapter',
10
+ },
11
+ setup(context) {
12
+ // 运行中 endpoint 注册表(napcat endpoint list 的"运行中"数据源)
13
+ context.resources.provide(napcatRuntimeStateToken, createEndpointRuntimeState());
14
+ // 平台权限门禁:scene_admin / scene_owner 由 sender role 判定(见各 endpoint admit metadata)
15
+ return registerDefaultScenePlatformPermitChecker('napcat');
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 { registerDefaultScenePlatformPermitChecker } from '@zhin.js/core';
4
- import { napcatRuntimeStateToken } from './src/napcat-runtime-state.js';
5
-
6
- export default definePlugin({
7
- name: 'napcat',
8
- metadata: {
9
- displayName: 'NapCat Adapter',
10
- },
11
- setup(context) {
12
- // 运行中 endpoint 注册表(napcat endpoint list 的"运行中"数据源)
13
- context.resources.provide(napcatRuntimeStateToken, createEndpointRuntimeState());
14
- // 平台权限门禁:scene_admin / scene_owner 由 sender role 判定(见各 endpoint admit metadata)
15
- return registerDefaultScenePlatformPermitChecker('napcat');
16
- },
17
- });