@zhin.js/adapter-icqq 1.1.3 → 1.1.4
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/lib/endpoint.js +8 -26
- package/package.json +7 -7
- package/src/endpoint.ts +8 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @zhin.js/adapter-icqq
|
|
2
2
|
|
|
3
|
+
## 1.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 43eda99: Unify Notice and Request payloads with their public types and runtime exports. Use camelCase fields, preserve native data under metadata, and bind canonical endpoint identity and request actions to the held generation. Remove legacy data aliases and from factories.
|
|
8
|
+
|
|
9
|
+
Keep login and lifecycle signals as independent SystemEvent payloads on system.receive, without chat conversation fields or user interaction. Update built-in adapter projections and authoring guidance.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [43eda99]
|
|
12
|
+
- Updated dependencies [0de4836]
|
|
13
|
+
- @zhin.js/core@1.1.39
|
|
14
|
+
- @zhin.js/permission@1.1.3
|
|
15
|
+
- @zhin.js/adapter@1.1.15
|
|
16
|
+
|
|
3
17
|
## 1.1.3
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/lib/endpoint.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Client, parseGroupMessageId, } from '@icqqjs/icqq';
|
|
|
2
2
|
import { inspect } from 'node:util';
|
|
3
3
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
4
|
import { Endpoint, } from 'zhin.js/adapter';
|
|
5
|
-
import { receiveOneBotLikeSideEvent,
|
|
5
|
+
import { receiveOneBotLikeSideEvent, buildSystem, toCanonicalSegments } from '@zhin.js/core';
|
|
6
6
|
import { formatCompact, getAdapterLogger, truncatePreview } from '@zhin.js/logger';
|
|
7
7
|
import { runIcqqLoginAssistStep } from './icqq-login-assist.js';
|
|
8
8
|
import { IcqqContentResolver } from './content-resolver.js';
|
|
@@ -578,16 +578,13 @@ export class IcqqEndpoint extends Endpoint {
|
|
|
578
578
|
});
|
|
579
579
|
}
|
|
580
580
|
#dispatchIcqqSystemSideEvent(type, payload) {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
$scene_type: scene_type,
|
|
589
|
-
$sub_type: sub_type,
|
|
590
|
-
$timestamp: Date.now(),
|
|
581
|
+
void this.emit('system.receive', buildSystem(payload ?? {}, {
|
|
582
|
+
id: `system:${this.endpointName}:${type}:${Date.now()}`,
|
|
583
|
+
clientAdapter: 'icqq',
|
|
584
|
+
endpointId: this.endpointName,
|
|
585
|
+
type: 'system',
|
|
586
|
+
name: `system.${type}`,
|
|
587
|
+
timestamp: Date.now(),
|
|
591
588
|
})).catch((err) => {
|
|
592
589
|
this.#logger.warn(formatCompact({
|
|
593
590
|
op: 'icqq_system_side_event_failed',
|
|
@@ -984,20 +981,5 @@ function serializeIcqqEvent(event) {
|
|
|
984
981
|
}
|
|
985
982
|
return Object.keys(out).length > 0 ? out : null;
|
|
986
983
|
}
|
|
987
|
-
function parseIcqqSystemScene(type) {
|
|
988
|
-
if (type.startsWith('login.')) {
|
|
989
|
-
return { scene_type: 'login', sub_type: type.slice('login.'.length) || 'unknown' };
|
|
990
|
-
}
|
|
991
|
-
if (type.startsWith('offline.')) {
|
|
992
|
-
return { scene_type: 'offline', sub_type: type.slice('offline.'.length) || 'unknown' };
|
|
993
|
-
}
|
|
994
|
-
if (type === 'online') {
|
|
995
|
-
return { scene_type: 'online', sub_type: 'online' };
|
|
996
|
-
}
|
|
997
|
-
if (type === 'offline') {
|
|
998
|
-
return { scene_type: 'offline', sub_type: 'offline' };
|
|
999
|
-
}
|
|
1000
|
-
return { scene_type: 'system', sub_type: type };
|
|
1001
|
-
}
|
|
1002
984
|
const INBOUND_HOLD_LIMIT = 32;
|
|
1003
985
|
const ICQQ_SERIALIZE_SKIP = ['group', 'member', 'friend', 'discuss', 'client'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-icqq",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Zhin.js ICQQ adapter — direct connection to @icqqjs/icqq",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@zhin.js/adapter": "1.1.15",
|
|
38
38
|
"@zhin.js/agent-feature": "1.1.2",
|
|
39
|
-
"@zhin.js/core": "1.1.
|
|
39
|
+
"@zhin.js/core": "1.1.39",
|
|
40
40
|
"@zhin.js/feature-kit": "1.1.2",
|
|
41
41
|
"@zhin.js/im-contract": "1.1.2",
|
|
42
42
|
"@zhin.js/logger": "1.1.1",
|
|
43
|
-
"@zhin.js/permission": "1.1.
|
|
43
|
+
"@zhin.js/permission": "1.1.3",
|
|
44
44
|
"@zhin.js/skill": "1.1.2",
|
|
45
45
|
"@zhin.js/tool": "1.1.2"
|
|
46
46
|
},
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"@icqqjs/icqq": "^1.12.2",
|
|
49
49
|
"zod": "^4.0.0",
|
|
50
50
|
"@zhin.js/adapter": "^1.1.15",
|
|
51
|
-
"@zhin.js/command": "^1.1.
|
|
52
|
-
"@zhin.js/core": "^1.1.
|
|
51
|
+
"@zhin.js/command": "^1.1.3",
|
|
52
|
+
"@zhin.js/core": "^1.1.39",
|
|
53
53
|
"@zhin.js/prompt-section": "^1.1.2",
|
|
54
|
-
"zhin.js": "^1.1.
|
|
54
|
+
"zhin.js": "^1.1.4"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"@icqqjs/icqq": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"vitest": "^4.1.10",
|
|
78
78
|
"zod": "^4.4.3",
|
|
79
79
|
"@zhin.js/prompt-section": "1.1.2",
|
|
80
|
-
"zhin.js": "1.1.
|
|
80
|
+
"zhin.js": "1.1.4"
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
"adapters",
|
package/src/endpoint.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
type EndpointSendRequest,
|
|
19
19
|
} from 'zhin.js/adapter';
|
|
20
20
|
import type { EndpointContentPort } from '@zhin.js/adapter';
|
|
21
|
-
import { receiveOneBotLikeSideEvent,
|
|
21
|
+
import { receiveOneBotLikeSideEvent, buildSystem, toCanonicalSegments, type LoginAssist } from '@zhin.js/core';
|
|
22
22
|
import type { MessageRef } from '@zhin.js/im-contract';
|
|
23
23
|
import { formatCompact, getAdapterLogger, truncatePreview } from '@zhin.js/logger';
|
|
24
24
|
import type { CapabilityId } from 'zhin.js';
|
|
@@ -659,16 +659,13 @@ export class IcqqEndpoint extends Endpoint<Client> {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
#dispatchIcqqSystemSideEvent(type: string, payload: Record<string, unknown> | null): void {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
$scene_type: scene_type,
|
|
670
|
-
$sub_type: sub_type,
|
|
671
|
-
$timestamp: Date.now(),
|
|
662
|
+
void this.emit('system.receive', buildSystem(payload ?? {}, {
|
|
663
|
+
id: `system:${this.endpointName}:${type}:${Date.now()}`,
|
|
664
|
+
clientAdapter: 'icqq',
|
|
665
|
+
endpointId: this.endpointName,
|
|
666
|
+
type: 'system',
|
|
667
|
+
name: `system.${type}`,
|
|
668
|
+
timestamp: Date.now(),
|
|
672
669
|
})).catch((err) => {
|
|
673
670
|
this.#logger.warn(formatCompact({
|
|
674
671
|
op: 'icqq_system_side_event_failed',
|
|
@@ -1063,22 +1060,6 @@ function serializeIcqqEvent(event: unknown): Record<string, unknown> | null {
|
|
|
1063
1060
|
return Object.keys(out).length > 0 ? out : null;
|
|
1064
1061
|
}
|
|
1065
1062
|
|
|
1066
|
-
function parseIcqqSystemScene(type: string): { scene_type: string; sub_type: string } {
|
|
1067
|
-
if (type.startsWith('login.')) {
|
|
1068
|
-
return { scene_type: 'login', sub_type: type.slice('login.'.length) || 'unknown' };
|
|
1069
|
-
}
|
|
1070
|
-
if (type.startsWith('offline.')) {
|
|
1071
|
-
return { scene_type: 'offline', sub_type: type.slice('offline.'.length) || 'unknown' };
|
|
1072
|
-
}
|
|
1073
|
-
if (type === 'online') {
|
|
1074
|
-
return { scene_type: 'online', sub_type: 'online' };
|
|
1075
|
-
}
|
|
1076
|
-
if (type === 'offline') {
|
|
1077
|
-
return { scene_type: 'offline', sub_type: 'offline' };
|
|
1078
|
-
}
|
|
1079
|
-
return { scene_type: 'system', sub_type: type };
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
1063
|
const INBOUND_HOLD_LIMIT = 32;
|
|
1083
1064
|
|
|
1084
1065
|
const ICQQ_SERIALIZE_SKIP = ['group', 'member', 'friend', 'discuss', 'client'] as const;
|