@zhin.js/adapter-onebot11 1.1.21 → 1.1.23
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 +70 -0
- package/adapters/onebot11/index.js +16 -4
- package/adapters/onebot11/index.ts +16 -4
- package/lib/protocol.d.ts +2 -0
- package/lib/protocol.js +3 -0
- package/lib/side-event-dispatch.js +1 -1
- package/lib/ws-endpoint.js +2 -0
- package/lib/ws-types.d.ts +1 -0
- package/lib/wss-endpoint.js +2 -0
- package/package.json +19 -18
- package/plugin.js +1 -0
- package/src/protocol.ts +4 -0
- package/src/side-event-dispatch.ts +1 -1
- package/src/ws-endpoint.ts +2 -0
- package/src/ws-types.ts +1 -0
- package/src/wss-endpoint.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @zhin.js/adapter-onebot11
|
|
2
2
|
|
|
3
|
+
## 1.1.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bc6ccb1: Deep audit bug fixes and 7 architectural improvements:
|
|
8
|
+
- Sink Agent Turn ingress pipeline from `@zhin.js/cli` into `@zhin.js/agent/runtime` (`plugin-runtime/ingress/`) and decompose `ingress-route.ts` into modular pipeline stages.
|
|
9
|
+
- Bind Session State Plane (`JsxButtonRegistry`, `InteractionRuntime`, `RuntimeInteractiveRouter`) to `PluginIncarnationRef` so active buttons and interactions survive unrelated-plugin HMR while expiring when the owning plugin reloads, and support per-conversation fallback numbering (`numberingScope: 'conversation'`).
|
|
10
|
+
- Establish `conversation_events` as the canonical message SSOT and reference `conversation_event_id`, `conversation_key`, `platform_message_id`, and `message_key` in `agent_messages` (`AGENT_MESSAGE_QUERY_VERSION = 2`), threading `conversationSequence` across inbound and outbound delivery receipts.
|
|
11
|
+
- Push down `DatabaseContextRepository` and `DatabaseScheduleJobStorage` full-session/full-table memory scans to indexed SQL queries.
|
|
12
|
+
- Add kernel-level inbound `replyTo` and `mentioned` auto-promotion (`promoteInboundMessagePayload`) plus reusable `InboundDeduper` and `TtlLookupCache` primitives in `@zhin.js/adapter`.
|
|
13
|
+
- Add `MiddlewareContext.dispatch` (`InboundDispatchSummary`) and `onAfterDispatch` hooks for `after-dispatch` middlewares, and support incremental rendering of in-place `envelope.payload` array mutations in `OutboundDeliveryRuntime`.
|
|
14
|
+
- Unify `HistoryWindowTracker` and `AgentCompactionRuntime` token/message budgets (`resolveUnifiedHistoryAndCompactionBudget`).
|
|
15
|
+
- Fix schema validation, database transaction connection cleanup and SQLite WAL mode, schedule timer wheel head-of-line blocking, security policy bash read paths and subagent guard propagation, group merge window permission carrier handoff, micro-compact namespaced tool matching, and WebSocket force-close / inbound segment mapping across adapters.
|
|
16
|
+
- Updated dependencies [3a8504b]
|
|
17
|
+
- Updated dependencies [6163abc]
|
|
18
|
+
- Updated dependencies [fed2c27]
|
|
19
|
+
- Updated dependencies [bc6ccb1]
|
|
20
|
+
- Updated dependencies [72b5a12]
|
|
21
|
+
- Updated dependencies [aa41889]
|
|
22
|
+
- Updated dependencies [4427e72]
|
|
23
|
+
- Updated dependencies [22bd14a]
|
|
24
|
+
- @zhin.js/agent-feature@1.1.14
|
|
25
|
+
- @zhin.js/core@1.1.57
|
|
26
|
+
- @zhin.js/client@1.1.25
|
|
27
|
+
- @zhin.js/page@1.1.15
|
|
28
|
+
- @zhin.js/im-contract@1.1.12
|
|
29
|
+
- @zhin.js/adapter@1.1.29
|
|
30
|
+
- @zhin.js/host-http@1.1.15
|
|
31
|
+
- @zhin.js/feature-kit@1.1.13
|
|
32
|
+
- @zhin.js/tool@1.1.16
|
|
33
|
+
- @zhin.js/adapter-onebot-events@0.0.2
|
|
34
|
+
- @zhin.js/permission@1.1.13
|
|
35
|
+
- @zhin.js/skill@1.1.14
|
|
36
|
+
|
|
37
|
+
## 1.1.22
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- b249e5e: ADR 0044 C4:事件映射迁出 core。新增 `@zhin.js/adapter-onebot-events`,承载 OneBot v11 / NapCat / icqq 的原始通知与请求 → 标准事件映射(`receiveOneBotLikeSideEvent`、`mapNoticeParts`、`mapRequestParts`、`resolveSideEventDedupeKey` 及 OneBot 映射表,icqq 差异用覆盖表表达);KOOK、Slack 的映射迁入各自适配器;`@zhin.js/core` 只保留标准事件名、类型与 `buildNotice` / `buildRequest` / `buildSystem` / `senderFromId`,不再含任何平台名。core 不再导出上述映射函数与 `ONEBOT_/KOOK_/SLACK_NOTICE_PARTS_MAP`、`SideEventPlatform`、`OneBotLike*` 类型,适配器改从共享包导入。
|
|
42
|
+
- 41ff1a5: ADR 0044 C5: every official adapter now declares a capability `profile` (its `segments` moved into `profile.default.messaging.segments`). icqq declares the complete profile (per conversation kind: scene, all 14 actions with real limits, events, feedback, delivery) and implements the seven new management ports (`pokeUser`, `unmuteGroupMember`, `muteAllGroupMembers`, `setGroupCard`, `setGroupTitle`, `setGroupEssence`, `inviteGroupMember`) with fresh bot-role reads. qq official declares its passive reply windows; undeclared capabilities stay unsupported.
|
|
43
|
+
- cbd3f14: ADR 0044 integration and C6 guard. `delivery.spool` now reproduces the pre-0044 media rule (icqq `false`, every other official adapter `true`). icqq narrows `actions.recall.others` unless the Bot is admin or owner, and declares recall for groups. Endpoint kind capabilities merge the Endpoint's `operations` (Discord reactions keep working; Discord declares reaction feedback). Adapters in the `@zhin.js/` scope are trusted: their custom prompt text is not labelled `external_content`. Core no longer keeps a telegram/discord interactive-policy table (adapters declare `segments.interactive`). New `pnpm check:no-platform-branches` blocks platform-name branches in runtime code.
|
|
44
|
+
- 4fe49b5: 支持配置按需生效:分离保存与有效版本,独立变更先应用,账号资料更新保留连接,模型按回合使用确定版本;Console 返回结构化应用结果。监听改为仅显式 --watch 启用,开发模板显式选择源码和配置监听。
|
|
45
|
+
|
|
46
|
+
自变更消费配置应用回执,避免已处理配置被二次重载;持久化本次写入修订和应用结果,未知结果或修订冲突时停止自动续作并保留现场,恢复不会覆盖未经本次变更确认的配置。
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [b249e5e]
|
|
49
|
+
- Updated dependencies [57661f6]
|
|
50
|
+
- Updated dependencies [cbd3f14]
|
|
51
|
+
- Updated dependencies [299863a]
|
|
52
|
+
- Updated dependencies [aaa93d7]
|
|
53
|
+
- Updated dependencies [bd524d1]
|
|
54
|
+
- Updated dependencies [126ae99]
|
|
55
|
+
- Updated dependencies [4fe49b5]
|
|
56
|
+
- Updated dependencies [cce07db]
|
|
57
|
+
- Updated dependencies [b652db3]
|
|
58
|
+
- Updated dependencies [0315ba0]
|
|
59
|
+
- Updated dependencies [00be764]
|
|
60
|
+
- @zhin.js/adapter-onebot-events@0.0.1
|
|
61
|
+
- @zhin.js/core@1.1.56
|
|
62
|
+
- @zhin.js/adapter@1.1.28
|
|
63
|
+
- @zhin.js/im-contract@1.1.11
|
|
64
|
+
- @zhin.js/tool@1.1.15
|
|
65
|
+
- @zhin.js/skill@1.1.13
|
|
66
|
+
- @zhin.js/host-http@1.1.14
|
|
67
|
+
- @zhin.js/feature-kit@1.1.12
|
|
68
|
+
- @zhin.js/client@1.1.24
|
|
69
|
+
- @zhin.js/page@1.1.14
|
|
70
|
+
- @zhin.js/agent-feature@1.1.13
|
|
71
|
+
- @zhin.js/permission@1.1.12
|
|
72
|
+
|
|
3
73
|
## 1.1.21
|
|
4
74
|
|
|
5
75
|
### Patch Changes
|
|
@@ -9,11 +9,23 @@ export { OneBot11WsEndpoint } from "../../lib/ws-endpoint.js";
|
|
|
9
9
|
export { OneBot11WssEndpoint } from "../../lib/wss-endpoint.js";
|
|
10
10
|
export default defineAdapter({
|
|
11
11
|
capabilities: ['inbound', 'outbound'],
|
|
12
|
-
operations: ['recall'],
|
|
13
12
|
// OneBot file 参数原生消费 url / base64:// 媒体;无卡片交互面,交互段降级纯文本。
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
profile: {
|
|
14
|
+
default: {
|
|
15
|
+
messaging: {
|
|
16
|
+
segments: {
|
|
17
|
+
outboundMedia: ['url', 'base64'],
|
|
18
|
+
interactive: 'text',
|
|
19
|
+
},
|
|
20
|
+
quote: true,
|
|
21
|
+
recall: {},
|
|
22
|
+
},
|
|
23
|
+
actions: {
|
|
24
|
+
recall: { scopes: ['private', 'group'] },
|
|
25
|
+
quoteReply: { scopes: ['private', 'group'] },
|
|
26
|
+
},
|
|
27
|
+
delivery: { send: true, proactive: true, spool: true },
|
|
28
|
+
},
|
|
17
29
|
},
|
|
18
30
|
createAdapter: context => new Onebot11Adapter(context),
|
|
19
31
|
});
|
|
@@ -15,11 +15,23 @@ export type { OneBot11WsSocket, OneBot11WsCreateOptions } from '../../src/ws-typ
|
|
|
15
15
|
|
|
16
16
|
export default defineAdapter<OneBot11EndpointConfig>({
|
|
17
17
|
capabilities: ['inbound', 'outbound'],
|
|
18
|
-
operations: ['recall'],
|
|
19
18
|
// OneBot file 参数原生消费 url / base64:// 媒体;无卡片交互面,交互段降级纯文本。
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
profile: {
|
|
20
|
+
default: {
|
|
21
|
+
messaging: {
|
|
22
|
+
segments: {
|
|
23
|
+
outboundMedia: ['url', 'base64'],
|
|
24
|
+
interactive: 'text',
|
|
25
|
+
},
|
|
26
|
+
quote: true,
|
|
27
|
+
recall: {},
|
|
28
|
+
},
|
|
29
|
+
actions: {
|
|
30
|
+
recall: { scopes: ['private', 'group'] },
|
|
31
|
+
quoteReply: { scopes: ['private', 'group'] },
|
|
32
|
+
},
|
|
33
|
+
delivery: { send: true, proactive: true, spool: true },
|
|
34
|
+
},
|
|
23
35
|
},
|
|
24
36
|
createAdapter: context => new Onebot11Adapter(context),
|
|
25
37
|
});
|
package/lib/protocol.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { EndpointProfileConfiguration } from 'zhin.js/adapter';
|
|
|
5
5
|
* Spec: https://github.com/botuniverse/onebot-11
|
|
6
6
|
*/
|
|
7
7
|
import { type MediaRef, type ConversationRef } from '@zhin.js/im-contract';
|
|
8
|
+
import { type Segment } from '@zhin.js/core';
|
|
8
9
|
/** One endpoint config after AdapterIndex expands `plugins.<instanceKey>.endpoints`. */
|
|
9
10
|
export interface OneBot11EndpointConfig extends EndpointProfileConfiguration {
|
|
10
11
|
readonly connection?: 'ws' | 'wss';
|
|
@@ -117,6 +118,7 @@ export interface OneBot11InboundFields {
|
|
|
117
118
|
readonly replyTo: {
|
|
118
119
|
readonly id: string;
|
|
119
120
|
} | undefined;
|
|
121
|
+
readonly segments?: readonly Segment[];
|
|
120
122
|
}
|
|
121
123
|
/** 构造 gateway.receive 的 metadata 与提升字段(ws / wss 两个 endpoint 共用)。 */
|
|
122
124
|
export declare function formatInboundMetadata(ev: OneBot11Event, endpoint: string): OneBot11InboundFields;
|
package/lib/protocol.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Spec: https://github.com/botuniverse/onebot-11
|
|
5
5
|
*/
|
|
6
6
|
import { EndpointDeliveryError, isMediaRef } from '@zhin.js/im-contract';
|
|
7
|
+
import { toCanonicalSegments } from '@zhin.js/core';
|
|
7
8
|
import { formatCompact, getLogger } from '@zhin.js/logger';
|
|
8
9
|
const logger = getLogger('onebot11');
|
|
9
10
|
function normalizeConnection(connection) {
|
|
@@ -161,6 +162,7 @@ export function formatInboundMetadata(ev, endpoint) {
|
|
|
161
162
|
const nickname = senderNickname(ev);
|
|
162
163
|
const quoteId = extractQuoteId(ev);
|
|
163
164
|
const mentioned = isOneBot11BotMentioned({ selfId, message: ev.message });
|
|
165
|
+
const segments = Array.isArray(ev.message) ? toCanonicalSegments(ev.message) : undefined;
|
|
164
166
|
return {
|
|
165
167
|
metadata: Object.freeze({
|
|
166
168
|
message_type: ev.message_type,
|
|
@@ -174,6 +176,7 @@ export function formatInboundMetadata(ev, endpoint) {
|
|
|
174
176
|
endpointId: endpoint,
|
|
175
177
|
mentioned,
|
|
176
178
|
replyTo: quoteId ? { id: quoteId } : undefined,
|
|
179
|
+
...(segments?.length ? { segments } : {}),
|
|
177
180
|
};
|
|
178
181
|
}
|
|
179
182
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { receiveOneBotLikeSideEvent } from '@zhin.js/
|
|
1
|
+
import { receiveOneBotLikeSideEvent } from '@zhin.js/adapter-onebot-events';
|
|
2
2
|
import { formatCompact } from '@zhin.js/logger';
|
|
3
3
|
export function receiveOneBot11SideEvent(raw, context) {
|
|
4
4
|
const { emit, endpointKey, caller, logger } = context;
|
package/lib/ws-endpoint.js
CHANGED
|
@@ -165,6 +165,7 @@ export class OneBot11WsEndpoint extends Onebot11Client {
|
|
|
165
165
|
endpointId: inbound.endpointId,
|
|
166
166
|
...(inbound.mentioned ? { mentioned: true } : {}),
|
|
167
167
|
...(inbound.replyTo ? { replyTo: inbound.replyTo } : {}),
|
|
168
|
+
...(inbound.segments?.length ? { segments: inbound.segments } : {}),
|
|
168
169
|
metadata: inbound.metadata,
|
|
169
170
|
}).catch((err) => {
|
|
170
171
|
this.#logger.warn(formatCompact({
|
|
@@ -207,6 +208,7 @@ export class OneBot11WsEndpoint extends Onebot11Client {
|
|
|
207
208
|
}
|
|
208
209
|
try {
|
|
209
210
|
ws.close();
|
|
211
|
+
ws.terminate?.();
|
|
210
212
|
}
|
|
211
213
|
catch {
|
|
212
214
|
/* ignore */
|
package/lib/ws-types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface OneBot11WsSocket {
|
|
|
3
3
|
readonly readyState: number;
|
|
4
4
|
send(data: string): void;
|
|
5
5
|
close(code?: number, reason?: string): void;
|
|
6
|
+
terminate?(): void;
|
|
6
7
|
ping?(): void;
|
|
7
8
|
on(event: 'open' | 'message' | 'close' | 'error' | 'pong', listener: (...args: unknown[]) => void): void;
|
|
8
9
|
}
|
package/lib/wss-endpoint.js
CHANGED
|
@@ -172,6 +172,7 @@ export class OneBot11WssEndpoint extends Onebot11Client {
|
|
|
172
172
|
endpointId: inbound.endpointId,
|
|
173
173
|
...(inbound.mentioned ? { mentioned: true } : {}),
|
|
174
174
|
...(inbound.replyTo ? { replyTo: inbound.replyTo } : {}),
|
|
175
|
+
...(inbound.segments?.length ? { segments: inbound.segments } : {}),
|
|
175
176
|
metadata: inbound.metadata,
|
|
176
177
|
}).catch((err) => {
|
|
177
178
|
this.#logger.warn(formatCompact({
|
|
@@ -220,6 +221,7 @@ export class OneBot11WssEndpoint extends Onebot11Client {
|
|
|
220
221
|
}
|
|
221
222
|
try {
|
|
222
223
|
socket.close();
|
|
224
|
+
socket.terminate?.();
|
|
223
225
|
}
|
|
224
226
|
catch {
|
|
225
227
|
/* ignore */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-onebot11",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23",
|
|
4
4
|
"description": "Zhin.js OneBot 11 adapter for Plugin Runtime (WebSocket client)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -45,19 +45,20 @@
|
|
|
45
45
|
"@imhelper/onebot-v11": "1.0.7",
|
|
46
46
|
"imhelper": "1.0.7",
|
|
47
47
|
"ws": "^8.21.1",
|
|
48
|
-
"@zhin.js/adapter": "
|
|
49
|
-
"@zhin.js/
|
|
50
|
-
"@zhin.js/agent-feature": "1.1.
|
|
48
|
+
"@zhin.js/adapter-onebot-events": "0.0.2",
|
|
49
|
+
"@zhin.js/adapter": "1.1.29",
|
|
50
|
+
"@zhin.js/agent-feature": "1.1.14",
|
|
51
|
+
"@zhin.js/client": "1.1.25",
|
|
51
52
|
"@zhin.js/console-contract": "1.1.3",
|
|
52
|
-
"@zhin.js/core": "1.1.
|
|
53
|
-
"@zhin.js/feature-kit": "1.1.
|
|
54
|
-
"@zhin.js/host-http": "1.1.
|
|
55
|
-
"@zhin.js/im-contract": "1.1.
|
|
53
|
+
"@zhin.js/core": "1.1.57",
|
|
54
|
+
"@zhin.js/feature-kit": "1.1.13",
|
|
55
|
+
"@zhin.js/host-http": "1.1.15",
|
|
56
|
+
"@zhin.js/im-contract": "1.1.12",
|
|
56
57
|
"@zhin.js/logger": "1.1.2",
|
|
57
|
-
"@zhin.js/
|
|
58
|
-
"@zhin.js/
|
|
59
|
-
"@zhin.js/skill": "1.1.
|
|
60
|
-
"@zhin.js/tool": "1.1.
|
|
58
|
+
"@zhin.js/page": "1.1.15",
|
|
59
|
+
"@zhin.js/permission": "1.1.13",
|
|
60
|
+
"@zhin.js/skill": "1.1.14",
|
|
61
|
+
"@zhin.js/tool": "1.1.16"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
64
|
"@types/node": "^26.1.2",
|
|
@@ -65,15 +66,15 @@
|
|
|
65
66
|
"typescript": "^6.0.3",
|
|
66
67
|
"vitest": "^4.1.10",
|
|
67
68
|
"zod": "^4.4.3",
|
|
68
|
-
"@zhin.js/host-http": "1.1.
|
|
69
|
-
"zhin.js": "1.1.
|
|
69
|
+
"@zhin.js/host-http": "1.1.15",
|
|
70
|
+
"zhin.js": "1.1.22"
|
|
70
71
|
},
|
|
71
72
|
"peerDependencies": {
|
|
72
73
|
"zod": "^4.0.0",
|
|
73
|
-
"@zhin.js/adapter": "^1.1.
|
|
74
|
-
"@zhin.js/command": "^1.1.
|
|
75
|
-
"@zhin.js/core": "^1.1.
|
|
76
|
-
"zhin.js": "^1.1.
|
|
74
|
+
"@zhin.js/adapter": "^1.1.29",
|
|
75
|
+
"@zhin.js/command": "^1.1.15",
|
|
76
|
+
"@zhin.js/core": "^1.1.57",
|
|
77
|
+
"zhin.js": "^1.1.22"
|
|
77
78
|
},
|
|
78
79
|
"peerDependenciesMeta": {
|
|
79
80
|
"@zhin.js/command": {
|
package/plugin.js
CHANGED
|
@@ -4,6 +4,7 @@ import { permissionHostToken, createSceneRolePlatformChecker } from '@zhin.js/pe
|
|
|
4
4
|
import { createOnebot11ConsoleRpc } from "./lib/console.js";
|
|
5
5
|
export default definePlugin({
|
|
6
6
|
name: 'onebot11',
|
|
7
|
+
configUpdate: { featurePaths: [['nickname'], ['profile'], ['endpoints']] },
|
|
7
8
|
metadata: {
|
|
8
9
|
displayName: 'OneBot 11 Adapter',
|
|
9
10
|
},
|
package/src/protocol.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { EndpointProfileConfiguration } from 'zhin.js/adapter';
|
|
|
5
5
|
* Spec: https://github.com/botuniverse/onebot-11
|
|
6
6
|
*/
|
|
7
7
|
import { EndpointDeliveryError, isMediaRef, type MediaRef, type ConversationRef } from '@zhin.js/im-contract';
|
|
8
|
+
import { toCanonicalSegments, type Segment } from '@zhin.js/core';
|
|
8
9
|
import { formatCompact, getLogger } from '@zhin.js/logger';
|
|
9
10
|
|
|
10
11
|
const logger = getLogger('onebot11');
|
|
@@ -261,6 +262,7 @@ export interface OneBot11InboundFields {
|
|
|
261
262
|
readonly endpointId: string;
|
|
262
263
|
readonly mentioned: boolean;
|
|
263
264
|
readonly replyTo: { readonly id: string } | undefined;
|
|
265
|
+
readonly segments?: readonly Segment[];
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
/** 构造 gateway.receive 的 metadata 与提升字段(ws / wss 两个 endpoint 共用)。 */
|
|
@@ -272,6 +274,7 @@ export function formatInboundMetadata(
|
|
|
272
274
|
const nickname = senderNickname(ev);
|
|
273
275
|
const quoteId = extractQuoteId(ev);
|
|
274
276
|
const mentioned = isOneBot11BotMentioned({ selfId, message: ev.message });
|
|
277
|
+
const segments = Array.isArray(ev.message) ? toCanonicalSegments(ev.message) : undefined;
|
|
275
278
|
return {
|
|
276
279
|
metadata: Object.freeze({
|
|
277
280
|
message_type: ev.message_type,
|
|
@@ -285,6 +288,7 @@ export function formatInboundMetadata(
|
|
|
285
288
|
endpointId: endpoint,
|
|
286
289
|
mentioned,
|
|
287
290
|
replyTo: quoteId ? { id: quoteId } : undefined,
|
|
291
|
+
...(segments?.length ? { segments } : {}),
|
|
288
292
|
};
|
|
289
293
|
}
|
|
290
294
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { receiveOneBotLikeSideEvent } from '@zhin.js/
|
|
1
|
+
import { receiveOneBotLikeSideEvent } from '@zhin.js/adapter-onebot-events';
|
|
2
2
|
import type { EndpointEventEmitter } from 'zhin.js/adapter';
|
|
3
3
|
import { formatCompact, type getAdapterLogger } from '@zhin.js/logger';
|
|
4
4
|
import type { OneBot11Event } from './protocol.js';
|
package/src/ws-endpoint.ts
CHANGED
|
@@ -206,6 +206,7 @@ export class OneBot11WsEndpoint extends Onebot11Client implements Endpoint {
|
|
|
206
206
|
endpointId: inbound.endpointId,
|
|
207
207
|
...(inbound.mentioned ? { mentioned: true } : {}),
|
|
208
208
|
...(inbound.replyTo ? { replyTo: inbound.replyTo } : {}),
|
|
209
|
+
...(inbound.segments?.length ? { segments: inbound.segments } : {}),
|
|
209
210
|
metadata: inbound.metadata,
|
|
210
211
|
}).catch((err) => {
|
|
211
212
|
this.#logger.warn(formatCompact({
|
|
@@ -251,6 +252,7 @@ export class OneBot11WsEndpoint extends Onebot11Client implements Endpoint {
|
|
|
251
252
|
}
|
|
252
253
|
try {
|
|
253
254
|
ws.close();
|
|
255
|
+
ws.terminate?.();
|
|
254
256
|
} catch {
|
|
255
257
|
/* ignore */
|
|
256
258
|
}
|
package/src/ws-types.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface OneBot11WsSocket {
|
|
|
3
3
|
readonly readyState: number;
|
|
4
4
|
send(data: string): void;
|
|
5
5
|
close(code?: number, reason?: string): void;
|
|
6
|
+
terminate?(): void;
|
|
6
7
|
ping?(): void;
|
|
7
8
|
on(event: 'open' | 'message' | 'close' | 'error' | 'pong', listener: (...args: unknown[]) => void): void;
|
|
8
9
|
}
|
package/src/wss-endpoint.ts
CHANGED
|
@@ -208,6 +208,7 @@ export class OneBot11WssEndpoint extends Onebot11Client implements Endpoint {
|
|
|
208
208
|
endpointId: inbound.endpointId,
|
|
209
209
|
...(inbound.mentioned ? { mentioned: true } : {}),
|
|
210
210
|
...(inbound.replyTo ? { replyTo: inbound.replyTo } : {}),
|
|
211
|
+
...(inbound.segments?.length ? { segments: inbound.segments } : {}),
|
|
211
212
|
metadata: inbound.metadata,
|
|
212
213
|
}).catch((err) => {
|
|
213
214
|
this.#logger.warn(formatCompact({
|
|
@@ -257,6 +258,7 @@ export class OneBot11WssEndpoint extends Onebot11Client implements Endpoint {
|
|
|
257
258
|
}
|
|
258
259
|
try {
|
|
259
260
|
socket.close();
|
|
261
|
+
socket.terminate?.();
|
|
260
262
|
} catch {
|
|
261
263
|
/* ignore */
|
|
262
264
|
}
|