@zhin.js/adapter-milky 6.0.14 → 7.0.0
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 +14 -0
- package/adapters/milky.js +1 -0
- package/adapters/milky.ts +1 -0
- package/lib/sse-endpoint.d.ts +2 -1
- package/lib/sse-endpoint.js +2 -1
- package/lib/webhook-endpoint.d.ts +2 -1
- package/lib/webhook-endpoint.js +2 -0
- package/lib/ws-endpoint.d.ts +2 -1
- package/lib/ws-endpoint.js +2 -1
- package/lib/wss-endpoint.d.ts +2 -1
- package/lib/wss-endpoint.js +2 -0
- package/package.json +11 -11
- package/src/sse-endpoint.ts +3 -0
- package/src/webhook-endpoint.ts +7 -4
- package/src/ws-endpoint.ts +3 -0
- package/src/wss-endpoint.ts +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @zhin.js/adapter-milky
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f2c532f: Expose exact per-Endpoint message operations through one validated Adapter capability model, route Core control calls through declared active capabilities, and connect existing recall, edit, reaction, and typing implementations across platform adapters.
|
|
8
|
+
- Updated dependencies [b10d058]
|
|
9
|
+
- Updated dependencies [f2c532f]
|
|
10
|
+
- Updated dependencies [3dbf990]
|
|
11
|
+
- @zhin.js/host-http@1.0.12
|
|
12
|
+
- @zhin.js/adapter@1.2.0
|
|
13
|
+
- @zhin.js/core@1.5.13
|
|
14
|
+
- @zhin.js/agent@1.1.15
|
|
15
|
+
- zhin.js@6.0.13
|
|
16
|
+
|
|
3
17
|
## 6.0.14
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/adapters/milky.js
CHANGED
|
@@ -11,6 +11,7 @@ import { milkyRuntimeStateToken } from "../lib/milky-runtime-state.js";
|
|
|
11
11
|
export { MilkySseEndpoint, MilkyWebhookEndpoint, MilkyWssEndpoint, MilkyWsEndpoint, } from "../lib/endpoint.js";
|
|
12
12
|
export default defineAdapter({
|
|
13
13
|
capabilities: ['inbound', 'outbound'],
|
|
14
|
+
operations: ['recall'],
|
|
14
15
|
// Milky 协议资源 uri 消费 http(s):// 与 base64:// 形式;无卡片交互面,交互段降级纯文本。
|
|
15
16
|
segments: {
|
|
16
17
|
outboundMedia: ['url', 'base64'],
|
package/adapters/milky.ts
CHANGED
package/lib/sse-endpoint.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Milky SSE client endpoint — GET text/event-stream on /event.
|
|
3
3
|
*/
|
|
4
|
-
import { type EndpointInstance, type EndpointManagement, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
4
|
+
import { type EndpointControl, type EndpointInstance, type EndpointManagement, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
5
5
|
import type { MessageGateway, SideEventGateway } from '@zhin.js/core/runtime';
|
|
6
6
|
import type { CapabilityId } from 'zhin.js';
|
|
7
7
|
import { callApi, type MilkyEvent, type MilkySseConfig } from './protocol.js';
|
|
@@ -24,6 +24,7 @@ export interface MilkySseEndpointOptions {
|
|
|
24
24
|
export declare class MilkySseEndpoint implements EndpointInstance {
|
|
25
25
|
#private;
|
|
26
26
|
readonly management: EndpointManagement;
|
|
27
|
+
readonly control: EndpointControl;
|
|
27
28
|
constructor(options: MilkySseEndpointOptions);
|
|
28
29
|
start(): Promise<void>;
|
|
29
30
|
open(): void;
|
package/lib/sse-endpoint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Milky SSE client endpoint — GET text/event-stream on /event.
|
|
3
3
|
*/
|
|
4
|
-
import { createEndpointLifecycle, } from 'zhin.js/adapter';
|
|
4
|
+
import { createRecallEndpointControl, createEndpointLifecycle, } from 'zhin.js/adapter';
|
|
5
5
|
import { formatCompact, getAdapterLogger } from '@zhin.js/logger';
|
|
6
6
|
import { createMilkyEndpointManagement } from './endpoint-management.js';
|
|
7
7
|
import { registerMilkyAgentEndpoint } from './milky-agent-deps.js';
|
|
@@ -12,6 +12,7 @@ export class MilkySseEndpoint {
|
|
|
12
12
|
#options;
|
|
13
13
|
#callApi;
|
|
14
14
|
management = createMilkyEndpointManagement(this);
|
|
15
|
+
control = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
15
16
|
#lifecycle;
|
|
16
17
|
#stream;
|
|
17
18
|
#open = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EndpointControl, type EndpointInstance, type EndpointManagement, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
2
2
|
import type { MessageGateway, SideEventGateway } from '@zhin.js/core/runtime';
|
|
3
3
|
import type { HttpHost } from '@zhin.js/host-http';
|
|
4
4
|
import type { CapabilityId } from 'zhin.js';
|
|
@@ -14,6 +14,7 @@ export interface MilkyWebhookEndpointOptions {
|
|
|
14
14
|
export declare class MilkyWebhookEndpoint implements EndpointInstance {
|
|
15
15
|
#private;
|
|
16
16
|
readonly management: EndpointManagement;
|
|
17
|
+
readonly control: EndpointControl;
|
|
17
18
|
constructor(options: MilkyWebhookEndpointOptions);
|
|
18
19
|
start(): Promise<void>;
|
|
19
20
|
open(): void;
|
package/lib/webhook-endpoint.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRecallEndpointControl, } from 'zhin.js/adapter';
|
|
1
2
|
import { formatCompact, getAdapterLogger } from '@zhin.js/logger';
|
|
2
3
|
import { readRequestBody, verifyMilkyAccessToken } from './milky-auth.js';
|
|
3
4
|
import { createMilkyEndpointManagement } from './endpoint-management.js';
|
|
@@ -8,6 +9,7 @@ export class MilkyWebhookEndpoint {
|
|
|
8
9
|
#options;
|
|
9
10
|
#callApi;
|
|
10
11
|
management = createMilkyEndpointManagement(this);
|
|
12
|
+
control = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
11
13
|
#routeReleases = [];
|
|
12
14
|
#open = false;
|
|
13
15
|
#started = false;
|
package/lib/ws-endpoint.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EndpointInstance, type EndpointManagement, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
1
|
+
import { type EndpointControl, type EndpointInstance, type EndpointManagement, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
2
2
|
import type { MessageGateway, SideEventGateway } from '@zhin.js/core/runtime';
|
|
3
3
|
import type { CapabilityId } from 'zhin.js';
|
|
4
4
|
import { callApi, type MilkyEvent, type MilkyWsConfig } from './protocol.js';
|
|
@@ -14,6 +14,7 @@ export interface MilkyWsEndpointOptions {
|
|
|
14
14
|
export declare class MilkyWsEndpoint implements EndpointInstance {
|
|
15
15
|
#private;
|
|
16
16
|
readonly management: EndpointManagement;
|
|
17
|
+
readonly control: EndpointControl;
|
|
17
18
|
constructor(options: MilkyWsEndpointOptions);
|
|
18
19
|
start(): Promise<void>;
|
|
19
20
|
open(): void;
|
package/lib/ws-endpoint.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Milky WS client endpoint — outbound connect to Milky protocol server.
|
|
3
3
|
*/
|
|
4
4
|
import WebSocket from 'ws';
|
|
5
|
-
import { createEndpointLifecycle, } from 'zhin.js/adapter';
|
|
5
|
+
import { createRecallEndpointControl, createEndpointLifecycle, } from 'zhin.js/adapter';
|
|
6
6
|
import { formatCompact, getAdapterLogger } from '@zhin.js/logger';
|
|
7
7
|
import { createMilkyEndpointManagement } from './endpoint-management.js';
|
|
8
8
|
import { registerMilkyAgentEndpoint } from './milky-agent-deps.js';
|
|
@@ -13,6 +13,7 @@ export class MilkyWsEndpoint {
|
|
|
13
13
|
#options;
|
|
14
14
|
#callApi;
|
|
15
15
|
management = createMilkyEndpointManagement(this);
|
|
16
|
+
control = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
16
17
|
#lifecycle;
|
|
17
18
|
#ws;
|
|
18
19
|
#open = false;
|
package/lib/wss-endpoint.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EndpointControl, type EndpointInstance, type EndpointManagement, type EndpointSendRequest } from 'zhin.js/adapter';
|
|
2
2
|
import type { MessageGateway, SideEventGateway } from '@zhin.js/core/runtime';
|
|
3
3
|
import type { HttpHost } from '@zhin.js/host-http';
|
|
4
4
|
import type { CapabilityId } from 'zhin.js';
|
|
@@ -14,6 +14,7 @@ export interface MilkyWssEndpointOptions {
|
|
|
14
14
|
export declare class MilkyWssEndpoint implements EndpointInstance {
|
|
15
15
|
#private;
|
|
16
16
|
readonly management: EndpointManagement;
|
|
17
|
+
readonly control: EndpointControl;
|
|
17
18
|
constructor(options: MilkyWssEndpointOptions);
|
|
18
19
|
start(): Promise<void>;
|
|
19
20
|
open(): void;
|
package/lib/wss-endpoint.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Milky reverse WSS endpoint — httpHostToken WS upgrade inbound + baseUrl HTTP API outbound.
|
|
3
3
|
*/
|
|
4
4
|
import { clearInterval } from 'node:timers';
|
|
5
|
+
import { createRecallEndpointControl, } from 'zhin.js/adapter';
|
|
5
6
|
import { formatCompact, getAdapterLogger } from '@zhin.js/logger';
|
|
6
7
|
import { verifyMilkyAccessToken } from './milky-auth.js';
|
|
7
8
|
import { createMilkyEndpointManagement } from './endpoint-management.js';
|
|
@@ -13,6 +14,7 @@ export class MilkyWssEndpoint {
|
|
|
13
14
|
#options;
|
|
14
15
|
#callApi;
|
|
15
16
|
management = createMilkyEndpointManagement(this);
|
|
17
|
+
control = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
16
18
|
#ws;
|
|
17
19
|
#wsRelease;
|
|
18
20
|
#heartbeatTimer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-milky",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Zhin.js Milky adapter for Plugin Runtime (WebSocket client)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"ws": "^8.21.1",
|
|
43
|
-
"@zhin.js/adapter": "1.
|
|
44
|
-
"@zhin.js/core": "1.5.
|
|
45
|
-
"@zhin.js/host-http": "1.0.
|
|
43
|
+
"@zhin.js/adapter": "1.2.0",
|
|
44
|
+
"@zhin.js/core": "1.5.13",
|
|
45
|
+
"@zhin.js/host-http": "1.0.12",
|
|
46
46
|
"@zhin.js/im-contract": "1.0.4",
|
|
47
47
|
"@zhin.js/logger": "1.0.76"
|
|
48
48
|
},
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
"typescript": "^6.0.3",
|
|
53
53
|
"vitest": "^4.1.10",
|
|
54
54
|
"zod": "^4.4.3",
|
|
55
|
-
"@zhin.js/agent": "1.1.
|
|
56
|
-
"@zhin.js/host-http": "1.0.
|
|
57
|
-
"zhin.js": "6.0.
|
|
55
|
+
"@zhin.js/agent": "1.1.15",
|
|
56
|
+
"@zhin.js/host-http": "1.0.12",
|
|
57
|
+
"zhin.js": "6.0.13"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"zod": "^4.0.0",
|
|
61
|
-
"@zhin.js/adapter": "1.
|
|
62
|
-
"@zhin.js/agent": "1.1.
|
|
61
|
+
"@zhin.js/adapter": "1.2.0",
|
|
62
|
+
"@zhin.js/agent": "1.1.15",
|
|
63
63
|
"@zhin.js/command": "1.0.15",
|
|
64
|
-
"@zhin.js/core": "1.5.
|
|
65
|
-
"zhin.js": "6.0.
|
|
64
|
+
"@zhin.js/core": "1.5.13",
|
|
65
|
+
"zhin.js": "6.0.13"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"@zhin.js/agent": {
|
package/src/sse-endpoint.ts
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Milky SSE client endpoint — GET text/event-stream on /event.
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
+
createRecallEndpointControl,
|
|
5
6
|
createEndpointLifecycle,
|
|
6
7
|
type EndpointConnectHandle,
|
|
8
|
+
type EndpointControl,
|
|
7
9
|
type EndpointInstance,
|
|
8
10
|
type EndpointLifecycle,
|
|
9
11
|
type EndpointManagement,
|
|
@@ -58,6 +60,7 @@ export class MilkySseEndpoint implements EndpointInstance {
|
|
|
58
60
|
readonly #options: MilkySseEndpointOptions;
|
|
59
61
|
readonly #callApi: typeof callApi;
|
|
60
62
|
readonly management: EndpointManagement = createMilkyEndpointManagement(this);
|
|
63
|
+
readonly control: EndpointControl = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
61
64
|
readonly #lifecycle: EndpointLifecycle;
|
|
62
65
|
#stream?: SseClientHandle;
|
|
63
66
|
#open = false;
|
package/src/webhook-endpoint.ts
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Milky webhook endpoint — httpHostToken POST inbound + baseUrl HTTP API outbound.
|
|
3
3
|
*/
|
|
4
4
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {
|
|
6
|
+
createRecallEndpointControl,
|
|
7
|
+
type EndpointControl,
|
|
8
|
+
type EndpointInstance,
|
|
9
|
+
type EndpointManagement,
|
|
10
|
+
type EndpointSendRequest,
|
|
9
11
|
} from 'zhin.js/adapter';
|
|
10
12
|
import type { MessageGateway, SideEventGateway } from '@zhin.js/core/runtime';
|
|
11
13
|
import type { HttpHost, HttpRouteRegistration } from '@zhin.js/host-http';
|
|
@@ -48,6 +50,7 @@ export class MilkyWebhookEndpoint implements EndpointInstance {
|
|
|
48
50
|
readonly #options: MilkyWebhookEndpointOptions;
|
|
49
51
|
readonly #callApi: typeof callApi;
|
|
50
52
|
readonly management: EndpointManagement = createMilkyEndpointManagement(this);
|
|
53
|
+
readonly control: EndpointControl = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
51
54
|
#routeReleases: HttpRouteRegistration[] = [];
|
|
52
55
|
#open = false;
|
|
53
56
|
#started = false;
|
package/src/ws-endpoint.ts
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import WebSocket from 'ws';
|
|
5
5
|
import {
|
|
6
|
+
createRecallEndpointControl,
|
|
6
7
|
createEndpointLifecycle,
|
|
7
8
|
type EndpointConnectHandle,
|
|
9
|
+
type EndpointControl,
|
|
8
10
|
type EndpointInstance,
|
|
9
11
|
type EndpointLifecycle,
|
|
10
12
|
type EndpointManagement,
|
|
@@ -56,6 +58,7 @@ export class MilkyWsEndpoint implements EndpointInstance {
|
|
|
56
58
|
readonly #options: MilkyWsEndpointOptions;
|
|
57
59
|
readonly #callApi: typeof callApi;
|
|
58
60
|
readonly management: EndpointManagement = createMilkyEndpointManagement(this);
|
|
61
|
+
readonly control: EndpointControl = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
59
62
|
readonly #lifecycle: EndpointLifecycle;
|
|
60
63
|
#ws?: MilkyWsSocket;
|
|
61
64
|
#open = false;
|
package/src/wss-endpoint.ts
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Milky reverse WSS endpoint — httpHostToken WS upgrade inbound + baseUrl HTTP API outbound.
|
|
3
3
|
*/
|
|
4
4
|
import { clearInterval } from 'node:timers';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {
|
|
6
|
+
createRecallEndpointControl,
|
|
7
|
+
type EndpointControl,
|
|
8
|
+
type EndpointInstance,
|
|
9
|
+
type EndpointManagement,
|
|
10
|
+
type EndpointSendRequest,
|
|
9
11
|
} from 'zhin.js/adapter';
|
|
10
12
|
import type { MessageGateway, SideEventGateway } from '@zhin.js/core/runtime';
|
|
11
13
|
import type { HttpHost, WsConnection } from '@zhin.js/host-http';
|
|
@@ -51,6 +53,7 @@ export class MilkyWssEndpoint implements EndpointInstance {
|
|
|
51
53
|
readonly #options: MilkyWssEndpointOptions;
|
|
52
54
|
readonly #callApi: typeof callApi;
|
|
53
55
|
readonly management: EndpointManagement = createMilkyEndpointManagement(this);
|
|
56
|
+
readonly control: EndpointControl = createRecallEndpointControl((id) => this.recallMessage(id));
|
|
54
57
|
#ws?: MilkyWsSocket;
|
|
55
58
|
#wsRelease?: () => void;
|
|
56
59
|
#heartbeatTimer?: NodeJS.Timeout;
|