@zhin.js/adapter-onebot12 4.0.1 → 4.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,22 @@
1
1
  # @zhin.js/adapter-onebot12
2
2
 
3
+ ## 4.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
+
3
20
  ## 4.0.1
4
21
 
5
22
  ### Patch Changes
@@ -0,0 +1,54 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ /**
3
+ * Convention entry: discover `adapters/onebot12.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 { OneBot12WebhookEndpoint } from "../lib/webhook.js";
9
+ import { OneBot12WsEndpoint } from "../lib/ws-endpoint.js";
10
+ import { OneBot12WssEndpoint } from "../lib/wss-endpoint.js";
11
+ import { resolveOneBot12Config, } from "../lib/protocol.js";
12
+ import { onebot12RuntimeStateToken } from "../lib/onebot12-runtime-state.js";
13
+ export { OneBot12WebhookEndpoint } from "../lib/webhook.js";
14
+ export { OneBot12WsEndpoint } from "../lib/ws-endpoint.js";
15
+ export { OneBot12WssEndpoint } from "../lib/wss-endpoint.js";
16
+ export default defineAdapter({
17
+ capabilities: ['inbound', 'outbound'],
18
+ // 媒体段经 upload_file 物化为 file_id(spec 正式投递);上传失败降级扩展字段透传。
19
+ // 无卡片交互面,交互段降级纯文本。
20
+ segments: {
21
+ outboundMedia: ['url', 'path', 'base64', 'upload'],
22
+ interactive: 'text',
23
+ },
24
+ create(context) {
25
+ const config = resolveOneBot12Config(context.config);
26
+ const gateway = context.use(messageGatewayToken);
27
+ // 注册到插件运行时状态(onebot12 endpoint list 的"运行中"数据源)
28
+ context.use(onebot12RuntimeStateToken).endpoints.set(config.name, {
29
+ name: config.name,
30
+ mode: config.connection,
31
+ });
32
+ if (config.connection === 'webhook') {
33
+ return new OneBot12WebhookEndpoint({
34
+ id: context.id,
35
+ gateway,
36
+ http: context.use(httpHostToken),
37
+ config,
38
+ });
39
+ }
40
+ if (config.connection === 'wss') {
41
+ return new OneBot12WssEndpoint({
42
+ id: context.id,
43
+ gateway,
44
+ http: context.use(httpHostToken),
45
+ config,
46
+ });
47
+ }
48
+ return new OneBot12WsEndpoint({
49
+ id: context.id,
50
+ gateway,
51
+ config,
52
+ });
53
+ },
54
+ });
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { onebot12EndpointCommands } from "../../../lib/onebot12-endpoint-commands.js";
3
+ export default onebot12EndpointCommands.add;
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { onebot12EndpointCommands } from "../../lib/onebot12-endpoint-commands.js";
3
+ export default onebot12EndpointCommands.list;
@@ -0,0 +1,3 @@
1
+ // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
+ import { onebot12EndpointCommands } from "../../../lib/onebot12-endpoint-commands.js";
3
+ export default onebot12EndpointCommands.remove;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-onebot12",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Zhin.js OneBot 12 adapter for Plugin Runtime (WebSocket client)",
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",
@@ -40,9 +40,9 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "ws": "^8.21.0",
43
- "@zhin.js/adapter": "1.1.1",
44
- "@zhin.js/command": "1.0.3",
45
- "@zhin.js/core": "1.4.1",
43
+ "@zhin.js/adapter": "1.1.2",
44
+ "@zhin.js/command": "1.0.4",
45
+ "@zhin.js/core": "1.4.2",
46
46
  "@zhin.js/host-http": "1.0.3",
47
47
  "@zhin.js/logger": "1.0.75",
48
48
  "@zhin.js/plugin-runtime": "1.1.1"
@@ -55,10 +55,10 @@
55
55
  "@zhin.js/host-http": "1.0.3"
56
56
  },
57
57
  "peerDependencies": {
58
- "@zhin.js/adapter": "1.1.1",
59
- "@zhin.js/core": "1.4.1",
58
+ "@zhin.js/adapter": "1.1.2",
59
+ "@zhin.js/core": "1.4.2",
60
60
  "@zhin.js/plugin-runtime": "1.1.1",
61
- "zhin.js": "5.0.1"
61
+ "zhin.js": "5.0.2"
62
62
  },
63
63
  "peerDependenciesMeta": {
64
64
  "zhin.js": {
@@ -80,7 +80,7 @@
80
80
  "zhin": {
81
81
  "protocol": 1,
82
82
  "type": "plugin",
83
- "entry": "./plugin.ts",
83
+ "entry": "./plugin.js",
84
84
  "engine": "^1.0.0",
85
85
  "runtime": "trusted",
86
86
  "features": [
package/plugin.js ADDED
@@ -0,0 +1,14 @@
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 { onebot12RuntimeStateToken } from "./lib/onebot12-runtime-state.js";
5
+ export default definePlugin({
6
+ name: 'onebot12',
7
+ metadata: {
8
+ displayName: 'OneBot 12 Adapter',
9
+ },
10
+ setup(context) {
11
+ // 运行中 endpoint 注册表(onebot12 endpoint list 的"运行中"数据源)
12
+ context.resources.provide(onebot12RuntimeStateToken, createEndpointRuntimeState());
13
+ },
14
+ });
package/plugin.ts DELETED
@@ -1,14 +0,0 @@
1
- import { createEndpointRuntimeState } from '@zhin.js/adapter';
2
- import { definePlugin } from '@zhin.js/plugin-runtime';
3
- import { onebot12RuntimeStateToken } from './src/onebot12-runtime-state.js';
4
-
5
- export default definePlugin({
6
- name: 'onebot12',
7
- metadata: {
8
- displayName: 'OneBot 12 Adapter',
9
- },
10
- setup(context) {
11
- // 运行中 endpoint 注册表(onebot12 endpoint list 的"运行中"数据源)
12
- context.resources.provide(onebot12RuntimeStateToken, createEndpointRuntimeState());
13
- },
14
- });