@zhin.js/adapter-icqq 8.0.14 → 9.0.1
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 +39 -0
- package/README.md +82 -3
- package/adapters/icqq.js +1 -3
- package/adapters/icqq.ts +2 -8
- package/agent/prompt-sections/platform.ts +17 -0
- package/lib/client.d.ts +19 -0
- package/lib/client.js +3 -0
- package/lib/endpoint.d.ts +9 -6
- package/lib/endpoint.js +232 -83
- package/lib/icqq-endpoint-commands.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +21 -14
- package/plugin.js +1 -24
- package/src/client.ts +29 -0
- package/src/endpoint.ts +236 -85
- package/src/index.ts +4 -6
- package/tools/announce.js +3 -6
- package/tools/announce.ts +4 -7
- package/tools/essence.js +5 -7
- package/tools/essence.ts +6 -8
- package/tools/friend_list.js +6 -9
- package/tools/friend_list.ts +7 -10
- package/tools/group_files.js +3 -6
- package/tools/group_files.ts +4 -7
- package/tools/group_invite.js +6 -8
- package/tools/group_invite.ts +7 -9
- package/tools/group_kick.js +6 -8
- package/tools/group_kick.ts +7 -9
- package/tools/group_list.js +7 -10
- package/tools/group_list.ts +8 -11
- package/tools/group_member_info.js +3 -6
- package/tools/group_member_info.ts +3 -7
- package/tools/group_sign.js +5 -7
- package/tools/group_sign.ts +6 -8
- package/tools/list_muted.js +3 -6
- package/tools/list_muted.ts +4 -7
- package/tools/poke.js +3 -6
- package/tools/poke.ts +4 -7
- package/tools/send_user_like.js +3 -6
- package/tools/send_user_like.ts +4 -7
- package/tools/set_anonymous.js +5 -7
- package/tools/set_anonymous.ts +6 -8
- package/tools/set_mute.js +6 -8
- package/tools/set_mute.ts +7 -9
- package/tools/set_title.js +6 -8
- package/tools/set_title.ts +7 -9
- package/tools/user_info.js +3 -6
- package/tools/user_info.ts +4 -7
- package/lib/agent-prompt.d.ts +0 -2
- package/lib/agent-prompt.js +0 -97
- package/lib/icqq-agent-deps.d.ts +0 -13
- package/lib/icqq-agent-deps.js +0 -27
- package/src/agent-prompt.ts +0 -110
- package/src/icqq-agent-deps.ts +0 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-icqq",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Zhin.js ICQQ adapter — direct connection to @icqqjs/icqq",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -34,21 +34,23 @@
|
|
|
34
34
|
"directory": "plugins/adapters/icqq"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@zhin.js/adapter": "1.1
|
|
38
|
-
"@zhin.js/core": "1.5.
|
|
37
|
+
"@zhin.js/adapter": "1.2.1",
|
|
38
|
+
"@zhin.js/core": "1.5.14",
|
|
39
|
+
"@zhin.js/feature-kit": "1.0.13",
|
|
39
40
|
"@zhin.js/im-contract": "1.0.4",
|
|
40
|
-
"@zhin.js/logger": "1.0.
|
|
41
|
-
"@zhin.js/permission": "1.0.
|
|
42
|
-
"@zhin.js/tool": "1.0.
|
|
41
|
+
"@zhin.js/logger": "1.0.77",
|
|
42
|
+
"@zhin.js/permission": "1.0.4",
|
|
43
|
+
"@zhin.js/tool": "1.0.13"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"@icqqjs/icqq": "^1.12.2",
|
|
46
47
|
"zod": "^4.0.0",
|
|
47
|
-
"@zhin.js/adapter": "1.1
|
|
48
|
-
"@zhin.js/agent": "1.1.
|
|
49
|
-
"@zhin.js/command": "1.0.
|
|
50
|
-
"@zhin.js/core": "1.5.
|
|
51
|
-
"zhin.js": "
|
|
48
|
+
"@zhin.js/adapter": "1.2.1",
|
|
49
|
+
"@zhin.js/agent": "1.1.16",
|
|
50
|
+
"@zhin.js/command": "1.0.16",
|
|
51
|
+
"@zhin.js/core": "1.5.14",
|
|
52
|
+
"@zhin.js/prompt-section": "0.0.1",
|
|
53
|
+
"zhin.js": "6.0.14"
|
|
52
54
|
},
|
|
53
55
|
"peerDependenciesMeta": {
|
|
54
56
|
"@icqqjs/icqq": {
|
|
@@ -60,6 +62,9 @@
|
|
|
60
62
|
"@zhin.js/command": {
|
|
61
63
|
"optional": true
|
|
62
64
|
},
|
|
65
|
+
"@zhin.js/prompt-section": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
63
68
|
"zhin.js": {
|
|
64
69
|
"optional": true
|
|
65
70
|
},
|
|
@@ -73,8 +78,9 @@
|
|
|
73
78
|
"typescript": "^6.0.3",
|
|
74
79
|
"vitest": "^4.1.10",
|
|
75
80
|
"zod": "^4.4.3",
|
|
76
|
-
"@zhin.js/agent": "1.1.
|
|
77
|
-
"zhin.js": "
|
|
81
|
+
"@zhin.js/agent": "1.1.16",
|
|
82
|
+
"@zhin.js/prompt-section": "0.0.1",
|
|
83
|
+
"zhin.js": "6.0.14"
|
|
78
84
|
},
|
|
79
85
|
"files": [
|
|
80
86
|
"adapters",
|
|
@@ -120,6 +126,7 @@
|
|
|
120
126
|
"scripts": {
|
|
121
127
|
"build": "tsc",
|
|
122
128
|
"clean": "rimraf lib",
|
|
123
|
-
"test": "NODE_OPTIONS=--experimental-strip-types vitest run --root ../../.. plugins/adapters/icqq/tests"
|
|
129
|
+
"test": "pnpm run test:types && NODE_OPTIONS=--experimental-strip-types vitest run --root ../../.. plugins/adapters/icqq/tests",
|
|
130
|
+
"test:types": "tsc -p tsconfig.type-tests.json"
|
|
124
131
|
}
|
|
125
132
|
}
|
package/plugin.js
CHANGED
|
@@ -3,9 +3,6 @@ import { createEndpointRuntimeState } from 'zhin.js/adapter';
|
|
|
3
3
|
import { definePlugin } from 'zhin.js';
|
|
4
4
|
import { permissionHostToken, createSceneRolePlatformChecker } from '@zhin.js/permission';
|
|
5
5
|
import { icqqRuntimeStateToken } from "./lib/icqq-runtime-state.js";
|
|
6
|
-
// Module-level guard: multiple icqq instances (icqq, icqq-2, …) share this
|
|
7
|
-
// module, but the prompt contributor is per-platform — register it once.
|
|
8
|
-
let promptContributorRegistered = false;
|
|
9
6
|
export default definePlugin({
|
|
10
7
|
name: 'icqq',
|
|
11
8
|
metadata: {
|
|
@@ -17,26 +14,6 @@ export default definePlugin({
|
|
|
17
14
|
const disposePlatform = context.resources.has(permissionHostToken)
|
|
18
15
|
? context.resources.use(permissionHostToken).registerPlatform('icqq', createSceneRolePlatformChecker())
|
|
19
16
|
: undefined;
|
|
20
|
-
|
|
21
|
-
// `zhin.js/agent` is an optional peer — skip silently on IM-only installs.
|
|
22
|
-
if (promptContributorRegistered)
|
|
23
|
-
return disposePlatform;
|
|
24
|
-
let cancelled = false;
|
|
25
|
-
let unregister;
|
|
26
|
-
void Promise.all([
|
|
27
|
-
import('zhin.js/agent'),
|
|
28
|
-
import("./lib/agent-prompt.js"),
|
|
29
|
-
]).then(([agent, prompt]) => {
|
|
30
|
-
if (cancelled || promptContributorRegistered)
|
|
31
|
-
return;
|
|
32
|
-
agent.registerAgentPromptContributor(prompt.createIcqqAgentPromptContributor());
|
|
33
|
-
promptContributorRegistered = true;
|
|
34
|
-
unregister = () => agent.unregisterAgentPromptContributor('icqq');
|
|
35
|
-
}).catch(() => { });
|
|
36
|
-
return () => {
|
|
37
|
-
cancelled = true;
|
|
38
|
-
unregister?.();
|
|
39
|
-
disposePlatform?.();
|
|
40
|
-
};
|
|
17
|
+
return disposePlatform;
|
|
41
18
|
},
|
|
42
19
|
});
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Client, EventMap } from '@icqqjs/icqq';
|
|
2
|
+
import { defineEndpointClient } from 'zhin.js/adapter';
|
|
3
|
+
|
|
4
|
+
type EventPayload<TListener> = TListener extends (
|
|
5
|
+
event: infer TEvent,
|
|
6
|
+
...rest: readonly unknown[]
|
|
7
|
+
) => unknown
|
|
8
|
+
? TEvent
|
|
9
|
+
: never;
|
|
10
|
+
|
|
11
|
+
/** The actual ICQQ SDK instance exposed by every ICQQ Endpoint event. */
|
|
12
|
+
export type IcqqClient = Client;
|
|
13
|
+
|
|
14
|
+
/** Native ICQQ event-name → first public event payload, derived from the SDK SSOT. */
|
|
15
|
+
export type IcqqClientEventMap = {
|
|
16
|
+
readonly [TName in keyof EventMap]: EventPayload<EventMap[TName]>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
declare module '@zhin.js/feature-kit' {
|
|
20
|
+
interface AdapterClientRegistry {
|
|
21
|
+
readonly icqq: {
|
|
22
|
+
readonly client: IcqqClient;
|
|
23
|
+
readonly events: IcqqClientEventMap;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Typed, generation-checked identity used by handlers, commands, tools and schedules. */
|
|
29
|
+
export const icqqClient = defineEndpointClient<IcqqClient, IcqqClientEventMap>('icqq');
|