@zhin.js/adapter-milky 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 +27 -0
- package/adapters/milky.js +56 -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 +11 -11
- package/plugin.js +14 -0
- package/plugin.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @zhin.js/adapter-milky
|
|
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,56 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* Convention entry: discover `adapters/milky.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 { MilkySseEndpoint, MilkyWebhookEndpoint, MilkyWssEndpoint, MilkyWsEndpoint, } from "../lib/endpoint.js";
|
|
9
|
+
import { resolveMilkyConfig, } from "../lib/protocol.js";
|
|
10
|
+
import { milkyRuntimeStateToken } from "../lib/milky-runtime-state.js";
|
|
11
|
+
export { MilkySseEndpoint, MilkyWebhookEndpoint, MilkyWssEndpoint, MilkyWsEndpoint, } from "../lib/endpoint.js";
|
|
12
|
+
export default defineAdapter({
|
|
13
|
+
capabilities: ['inbound', 'outbound'],
|
|
14
|
+
// Milky 协议资源 uri 消费 http(s):// 与 base64:// 形式;无卡片交互面,交互段降级纯文本。
|
|
15
|
+
segments: {
|
|
16
|
+
outboundMedia: ['url', 'base64'],
|
|
17
|
+
interactive: 'text',
|
|
18
|
+
},
|
|
19
|
+
create(context) {
|
|
20
|
+
const config = resolveMilkyConfig(context.config);
|
|
21
|
+
const gateway = context.use(messageGatewayToken);
|
|
22
|
+
// 注册到插件运行时状态(milky endpoint list 的"运行中"数据源)
|
|
23
|
+
context.use(milkyRuntimeStateToken).endpoints.set(config.name, {
|
|
24
|
+
name: config.name,
|
|
25
|
+
mode: config.connection,
|
|
26
|
+
});
|
|
27
|
+
if (config.connection === 'webhook') {
|
|
28
|
+
return new MilkyWebhookEndpoint({
|
|
29
|
+
id: context.id,
|
|
30
|
+
gateway,
|
|
31
|
+
http: context.use(httpHostToken),
|
|
32
|
+
config,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (config.connection === 'wss') {
|
|
36
|
+
return new MilkyWssEndpoint({
|
|
37
|
+
id: context.id,
|
|
38
|
+
gateway,
|
|
39
|
+
http: context.use(httpHostToken),
|
|
40
|
+
config,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (config.connection === 'sse') {
|
|
44
|
+
return new MilkySseEndpoint({
|
|
45
|
+
id: context.id,
|
|
46
|
+
gateway,
|
|
47
|
+
config,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return new MilkyWsEndpoint({
|
|
51
|
+
id: context.id,
|
|
52
|
+
gateway,
|
|
53
|
+
config,
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-milky",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Zhin.js Milky 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.
|
|
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.
|
|
44
|
-
"@zhin.js/command": "1.0.
|
|
45
|
-
"@zhin.js/core": "1.4.
|
|
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"
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"typescript": "^6.0.3",
|
|
54
54
|
"vitest": "^4.1.10",
|
|
55
55
|
"zod": "^4.4.3",
|
|
56
|
-
"@zhin.js/agent": "1.0.
|
|
56
|
+
"@zhin.js/agent": "1.0.8",
|
|
57
57
|
"@zhin.js/host-http": "1.0.3"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"zod": "^4.0.0",
|
|
61
|
-
"@zhin.js/adapter": "1.1.
|
|
62
|
-
"@zhin.js/core": "1.4.
|
|
61
|
+
"@zhin.js/adapter": "1.1.2",
|
|
62
|
+
"@zhin.js/core": "1.4.2",
|
|
63
63
|
"@zhin.js/plugin-runtime": "1.1.1",
|
|
64
|
-
"zhin.js": "5.0.
|
|
65
|
-
"@zhin.js/agent": "1.0.
|
|
64
|
+
"zhin.js": "5.0.2",
|
|
65
|
+
"@zhin.js/agent": "1.0.8"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"zhin.js": {
|
|
@@ -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,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 { milkyRuntimeStateToken } from "./lib/milky-runtime-state.js";
|
|
5
|
+
export default definePlugin({
|
|
6
|
+
name: 'milky',
|
|
7
|
+
metadata: {
|
|
8
|
+
displayName: 'Milky Adapter',
|
|
9
|
+
},
|
|
10
|
+
setup(context) {
|
|
11
|
+
// 运行中 endpoint 注册表(milky endpoint list 的"运行中"数据源)
|
|
12
|
+
context.resources.provide(milkyRuntimeStateToken, 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 { milkyRuntimeStateToken } from './src/milky-runtime-state.js';
|
|
4
|
-
|
|
5
|
-
export default definePlugin({
|
|
6
|
-
name: 'milky',
|
|
7
|
-
metadata: {
|
|
8
|
-
displayName: 'Milky Adapter',
|
|
9
|
-
},
|
|
10
|
-
setup(context) {
|
|
11
|
-
// 运行中 endpoint 注册表(milky endpoint list 的"运行中"数据源)
|
|
12
|
-
context.resources.provide(milkyRuntimeStateToken, createEndpointRuntimeState());
|
|
13
|
-
},
|
|
14
|
-
});
|