@zhin.js/adapter-icqq 8.0.8 → 8.0.10
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 +34 -0
- package/README.md +36 -28
- package/adapters/icqq.js +4 -9
- package/adapters/icqq.ts +5 -14
- package/agent/PERMITS.md +2 -0
- package/lib/agent-prompt.js +17 -22
- package/lib/cq-message.d.ts +2 -2
- package/lib/cq-message.js +7 -2
- package/lib/endpoint.d.ts +4 -74
- package/lib/endpoint.js +348 -507
- package/lib/forward-msg.d.ts +7 -8
- package/lib/forward-msg.js +11 -24
- package/lib/icqq-agent-deps.d.ts +3 -15
- package/lib/icqq-agent-deps.js +0 -5
- package/lib/icqq-endpoint-commands.js +4 -13
- package/lib/icqq-guild.d.ts +15 -11
- package/lib/icqq-guild.js +9 -17
- package/lib/icqq-inbound.d.ts +20 -20
- package/lib/icqq-inbound.js +9 -9
- package/lib/icqq-inbox.d.ts +2 -10
- package/lib/index.d.ts +2 -3
- package/lib/index.js +2 -3
- package/lib/outbound-media.d.ts +3 -8
- package/lib/outbound-media.js +3 -8
- package/lib/protocol.d.ts +38 -57
- package/lib/protocol.js +67 -21
- package/lib/types.d.ts +4 -40
- package/lib/types.js +0 -5
- package/package.json +26 -14
- package/plugin.js +6 -1
- package/schema.json +119 -61
- package/src/agent-prompt.ts +17 -22
- package/src/cq-message.ts +7 -2
- package/src/endpoint.ts +359 -600
- package/src/forward-msg.ts +12 -26
- package/src/icqq-agent-deps.ts +3 -17
- package/src/icqq-endpoint-commands.ts +4 -13
- package/src/icqq-guild.ts +16 -25
- package/src/icqq-inbound.ts +26 -26
- package/src/icqq-inbox.ts +2 -10
- package/src/icqqjs-icqq.d.ts +88 -0
- package/src/index.ts +2 -9
- package/src/outbound-media.ts +4 -9
- package/src/protocol.ts +108 -66
- package/src/types.ts +4 -41
- package/tools/announce.js +19 -0
- package/tools/announce.ts +18 -0
- package/tools/essence.js +24 -0
- package/{agent/tools → tools}/essence.ts +8 -8
- package/tools/friend_list.js +20 -0
- package/{agent/tools → tools}/friend_list.ts +7 -7
- package/tools/group_files.js +25 -0
- package/tools/group_files.ts +23 -0
- package/tools/group_invite.js +25 -0
- package/tools/group_invite.ts +22 -0
- package/tools/group_kick.js +28 -0
- package/tools/group_kick.ts +24 -0
- package/tools/group_list.js +21 -0
- package/{agent/tools → tools}/group_list.ts +7 -7
- package/tools/group_sign.js +21 -0
- package/tools/group_sign.ts +19 -0
- package/tools/list_muted.js +20 -0
- package/tools/list_muted.ts +19 -0
- package/tools/poke.js +19 -0
- package/tools/poke.ts +18 -0
- package/tools/send_user_like.js +28 -0
- package/tools/send_user_like.ts +25 -0
- package/tools/set_anonymous.js +23 -0
- package/tools/set_anonymous.ts +21 -0
- package/tools/set_mute.js +26 -0
- package/tools/set_mute.ts +23 -0
- package/tools/set_title.js +27 -0
- package/tools/set_title.ts +24 -0
- package/tools/user_info.js +17 -0
- package/tools/user_info.ts +16 -0
- package/agent/tools/announce.ts +0 -21
- package/agent/tools/group_files.ts +0 -27
- package/agent/tools/group_invite.ts +0 -20
- package/agent/tools/group_sign.ts +0 -19
- package/agent/tools/list_muted.ts +0 -22
- package/agent/tools/poke.ts +0 -20
- package/agent/tools/send_user_like.ts +0 -22
- package/agent/tools/set_anonymous.ts +0 -22
- package/agent/tools/set_title.ts +0 -25
- package/lib/ipc-client.d.ts +0 -73
- package/lib/ipc-client.js +0 -358
- package/src/ipc-client.ts +0 -417
package/lib/protocol.d.ts
CHANGED
|
@@ -1,51 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IPC 协议类型定义与 Action 常量 (ported from @icqqjs/cli)
|
|
3
|
-
*
|
|
4
|
-
* CLI 与守护进程通过 Unix Domain Socket 通信,
|
|
5
|
-
* 使用 JSON + 换行符(\n)分隔的文本协议。
|
|
6
|
-
*
|
|
7
|
-
* 通信流程(@icqqjs/cli `src/daemon/protocol.ts`):
|
|
8
|
-
* 1. CLI 连接 Socket → auth(token)
|
|
9
|
-
* 2. 认证通过后发送 IpcRequest → 等待 IpcResponse
|
|
10
|
-
* 3. 认证通过后自动接收 icqq 事件推送(IpcEvent),断开连接自动停止
|
|
11
|
-
*
|
|
12
|
-
* 登录相关:**推送**走 IpcEvent(`system.login.*`)。
|
|
13
|
-
*/
|
|
14
1
|
import type { ConversationRef } from '@zhin.js/im-contract';
|
|
15
2
|
import type { MessageSegment } from "zhin.js";
|
|
16
|
-
|
|
17
|
-
export type IpcRequest = {
|
|
18
|
-
id: string;
|
|
19
|
-
action: string;
|
|
20
|
-
params: Record<string, unknown>;
|
|
21
|
-
};
|
|
22
|
-
/** Daemon → CLI 响应 */
|
|
23
|
-
export type IpcResponse = {
|
|
3
|
+
export type ActionResult = {
|
|
24
4
|
id: string;
|
|
25
5
|
ok: boolean;
|
|
26
6
|
data?: unknown;
|
|
27
7
|
error?: string;
|
|
28
8
|
};
|
|
29
|
-
|
|
30
|
-
* Daemon → CLI 事件推送(icqq client.em 分发的全部事件)
|
|
31
|
-
*
|
|
32
|
-
* 登录/重连时推送 `system.login.*`(如 `system.login.auth` 含 url + device),
|
|
33
|
-
* 语义在 `event` 字段,不在 OneBot 式 `post_type` 里。
|
|
34
|
-
*/
|
|
35
|
-
export type IpcEvent = {
|
|
36
|
-
/** 固定为 `"*"`,客户端应忽略,由本地 handler 按 `event` 过滤 */
|
|
37
|
-
id: string;
|
|
38
|
-
/** icqq 事件名,如 `system.login.auth`、`message.group.normal` */
|
|
39
|
-
event: string;
|
|
40
|
-
/** icqq 事件 toJSON 后的 plain object */
|
|
41
|
-
data: unknown;
|
|
42
|
-
};
|
|
43
|
-
export type IpcMessage = IpcResponse | IpcEvent;
|
|
44
|
-
export type { IcqqIpcMessageEvent } from "./icqq-inbound.js";
|
|
45
|
-
/** 从 IPC 入站 payload 解析可用于引用/撤回的消息 ID */
|
|
9
|
+
export type { IcqqMessageEvent } from "./icqq-inbound.js";
|
|
46
10
|
export { resolveIcqqInboundMessageId } from "./icqq-inbound.js";
|
|
47
|
-
|
|
48
|
-
export interface IpcGuildMessageEventData {
|
|
11
|
+
export interface GuildMessageEventData {
|
|
49
12
|
type: "guild";
|
|
50
13
|
guild_id: string;
|
|
51
14
|
guild_name: string;
|
|
@@ -58,7 +21,7 @@ export interface IpcGuildMessageEventData {
|
|
|
58
21
|
seq: number;
|
|
59
22
|
}
|
|
60
23
|
/**
|
|
61
|
-
*
|
|
24
|
+
* 所有操作常量(@icqqjs/icqq)
|
|
62
25
|
*/
|
|
63
26
|
export declare const Actions: {
|
|
64
27
|
readonly PING: "ping";
|
|
@@ -202,22 +165,34 @@ export interface IcqqAdapterConfig {
|
|
|
202
165
|
readonly id?: string;
|
|
203
166
|
readonly autoReconnect?: boolean;
|
|
204
167
|
readonly outboundMedia?: 'file' | 'base64';
|
|
205
|
-
readonly
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
168
|
+
readonly password?: string;
|
|
169
|
+
readonly platform?: number;
|
|
170
|
+
readonly ver?: string;
|
|
171
|
+
readonly dataDir?: string;
|
|
172
|
+
readonly signApiAddr?: string;
|
|
173
|
+
readonly ignoreSelf?: boolean;
|
|
174
|
+
readonly resend?: boolean;
|
|
175
|
+
readonly cacheGroupMember?: boolean;
|
|
176
|
+
readonly autoServer?: boolean;
|
|
177
|
+
readonly qqnt?: boolean;
|
|
178
|
+
readonly ntLogin?: boolean;
|
|
210
179
|
/** Transitional: legacy root `endpoints[]` with `context: icqq`. */
|
|
211
180
|
readonly endpoints?: ReadonlyArray<{
|
|
212
181
|
readonly context?: string;
|
|
213
182
|
readonly id?: string;
|
|
214
183
|
readonly autoReconnect?: boolean;
|
|
215
184
|
readonly outboundMedia?: 'file' | 'base64';
|
|
216
|
-
readonly
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
185
|
+
readonly password?: string;
|
|
186
|
+
readonly platform?: number;
|
|
187
|
+
readonly ver?: string;
|
|
188
|
+
readonly dataDir?: string;
|
|
189
|
+
readonly signApiAddr?: string;
|
|
190
|
+
readonly ignoreSelf?: boolean;
|
|
191
|
+
readonly resend?: boolean;
|
|
192
|
+
readonly cacheGroupMember?: boolean;
|
|
193
|
+
readonly autoServer?: boolean;
|
|
194
|
+
readonly qqnt?: boolean;
|
|
195
|
+
readonly ntLogin?: boolean;
|
|
221
196
|
}>;
|
|
222
197
|
}
|
|
223
198
|
export interface ResolvedIcqqConfig {
|
|
@@ -225,11 +200,17 @@ export interface ResolvedIcqqConfig {
|
|
|
225
200
|
readonly id: string;
|
|
226
201
|
readonly autoReconnect: boolean;
|
|
227
202
|
readonly outboundMedia?: 'file' | 'base64';
|
|
228
|
-
readonly
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
203
|
+
readonly password?: string;
|
|
204
|
+
readonly platform?: number;
|
|
205
|
+
readonly ver?: string;
|
|
206
|
+
readonly dataDir?: string;
|
|
207
|
+
readonly signApiAddr?: string;
|
|
208
|
+
readonly ignoreSelf?: boolean;
|
|
209
|
+
readonly resend?: boolean;
|
|
210
|
+
readonly cacheGroupMember?: boolean;
|
|
211
|
+
readonly autoServer?: boolean;
|
|
212
|
+
readonly qqnt?: boolean;
|
|
213
|
+
readonly ntLogin?: boolean;
|
|
233
214
|
}
|
|
234
215
|
export interface IcqqWireSegment {
|
|
235
216
|
readonly type: string;
|
|
@@ -278,7 +259,7 @@ export declare function icqqInboundConversation(endpointKey: string, input: {
|
|
|
278
259
|
readonly guildId?: string;
|
|
279
260
|
}): ConversationRef;
|
|
280
261
|
/**
|
|
281
|
-
* 出站:从 ConversationRef 派生
|
|
262
|
+
* 出站:从 ConversationRef 派生 action 路由。
|
|
282
263
|
* 群容器(parent kind 'group')内的 private 会话即 ICQQ 群临时会话(temp)。
|
|
283
264
|
*/
|
|
284
265
|
export declare function icqqOutboundTarget(conversation: ConversationRef): ParsedIcqqSendTarget;
|
package/lib/protocol.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IPC 协议类型定义与 Action 常量 (ported from @icqqjs/cli)
|
|
3
|
-
*
|
|
4
|
-
* CLI 与守护进程通过 Unix Domain Socket 通信,
|
|
5
|
-
* 使用 JSON + 换行符(\n)分隔的文本协议。
|
|
6
|
-
*
|
|
7
|
-
* 通信流程(@icqqjs/cli `src/daemon/protocol.ts`):
|
|
8
|
-
* 1. CLI 连接 Socket → auth(token)
|
|
9
|
-
* 2. 认证通过后发送 IpcRequest → 等待 IpcResponse
|
|
10
|
-
* 3. 认证通过后自动接收 icqq 事件推送(IpcEvent),断开连接自动停止
|
|
11
|
-
*
|
|
12
|
-
* 登录相关:**推送**走 IpcEvent(`system.login.*`)。
|
|
13
|
-
*/
|
|
14
1
|
import { pickCredential } from '@zhin.js/adapter';
|
|
15
2
|
import { resolveCqMediaArg } from "./cq-message.js";
|
|
16
|
-
/** 从 IPC 入站 payload 解析可用于引用/撤回的消息 ID */
|
|
17
3
|
export { resolveIcqqInboundMessageId } from "./icqq-inbound.js";
|
|
18
4
|
/**
|
|
19
|
-
*
|
|
5
|
+
* 所有操作常量(@icqqjs/icqq)
|
|
20
6
|
*/
|
|
21
7
|
export const Actions = {
|
|
22
8
|
PING: "ping",
|
|
@@ -194,16 +180,33 @@ export function resolveIcqqConfig(config = {}) {
|
|
|
194
180
|
}
|
|
195
181
|
const autoReconnect = config.autoReconnect ?? entry?.autoReconnect ?? true;
|
|
196
182
|
const outboundMedia = config.outboundMedia ?? entry?.outboundMedia;
|
|
197
|
-
const
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
183
|
+
const password = entry?.password;
|
|
184
|
+
const platform = config.platform ?? entry?.platform ?? 2;
|
|
185
|
+
const ver = config.ver ?? entry?.ver ?? '9.1.70';
|
|
186
|
+
const dataDir = config.dataDir ?? entry?.dataDir ?? `data/icqq/${id}`;
|
|
187
|
+
const signApiAddr = config.signApiAddr ?? entry?.signApiAddr;
|
|
188
|
+
const ignoreSelf = config.ignoreSelf ?? entry?.ignoreSelf ?? true;
|
|
189
|
+
const resend = config.resend ?? entry?.resend;
|
|
190
|
+
const cacheGroupMember = config.cacheGroupMember ?? entry?.cacheGroupMember ?? true;
|
|
191
|
+
const autoServer = config.autoServer ?? entry?.autoServer ?? true;
|
|
192
|
+
const qqnt = config.qqnt ?? entry?.qqnt;
|
|
193
|
+
const ntLogin = config.ntLogin ?? entry?.ntLogin;
|
|
201
194
|
return {
|
|
202
195
|
context: 'icqq',
|
|
203
196
|
id,
|
|
204
197
|
autoReconnect,
|
|
205
198
|
...(outboundMedia ? { outboundMedia } : {}),
|
|
206
|
-
...(
|
|
199
|
+
...(password ? { password } : {}),
|
|
200
|
+
...(platform != null ? { platform: Number(platform) } : {}),
|
|
201
|
+
...(ver ? { ver } : {}),
|
|
202
|
+
...(dataDir ? { dataDir } : {}),
|
|
203
|
+
...(signApiAddr ? { signApiAddr } : {}),
|
|
204
|
+
...(ignoreSelf != null ? { ignoreSelf } : {}),
|
|
205
|
+
...(resend != null ? { resend } : {}),
|
|
206
|
+
...(cacheGroupMember != null ? { cacheGroupMember } : {}),
|
|
207
|
+
...(autoServer != null ? { autoServer } : {}),
|
|
208
|
+
...(qqnt != null ? { qqnt } : {}),
|
|
209
|
+
...(ntLogin != null ? { ntLogin } : {}),
|
|
207
210
|
};
|
|
208
211
|
}
|
|
209
212
|
/**
|
|
@@ -231,7 +234,7 @@ export function icqqInboundConversation(endpointKey, input) {
|
|
|
231
234
|
return { endpoint, kind: input.channelType, id: input.channelId };
|
|
232
235
|
}
|
|
233
236
|
/**
|
|
234
|
-
* 出站:从 ConversationRef 派生
|
|
237
|
+
* 出站:从 ConversationRef 派生 action 路由。
|
|
235
238
|
* 群容器(parent kind 'group')内的 private 会话即 ICQQ 群临时会话(temp)。
|
|
236
239
|
*/
|
|
237
240
|
export function icqqOutboundTarget(conversation) {
|
|
@@ -300,6 +303,8 @@ export function formatOutboundBody(payload) {
|
|
|
300
303
|
const arg = resolveCqMediaArg('video', item.data);
|
|
301
304
|
return arg ? `[video:${arg}]` : '';
|
|
302
305
|
}
|
|
306
|
+
case 'share':
|
|
307
|
+
return formatMusicShareJson(item.data);
|
|
303
308
|
default:
|
|
304
309
|
return String(item.data?.text ?? '');
|
|
305
310
|
}
|
|
@@ -315,3 +320,44 @@ function isWireSegment(value) {
|
|
|
315
320
|
&& value !== null
|
|
316
321
|
&& typeof value.type === 'string';
|
|
317
322
|
}
|
|
323
|
+
function formatMusicShareJson(data) {
|
|
324
|
+
if (!data)
|
|
325
|
+
return '';
|
|
326
|
+
const config = data.config;
|
|
327
|
+
const title = String(data.title ?? '');
|
|
328
|
+
const desc = String(data.artist ?? '');
|
|
329
|
+
const jumpUrl = String(data.url ?? '');
|
|
330
|
+
const musicUrl = String(data.audio ?? '');
|
|
331
|
+
const preview = String(data.image ?? '');
|
|
332
|
+
const tag = config?.appid === 100497308 ? 'QQ音乐'
|
|
333
|
+
: config?.appid === 100495085 ? '网易云音乐'
|
|
334
|
+
: config?.appid === 100243533 ? '酷我音乐'
|
|
335
|
+
: config?.appid === 205141 ? '酷狗音乐'
|
|
336
|
+
: '音乐';
|
|
337
|
+
const json = {
|
|
338
|
+
app: 'com.tencent.structmsg',
|
|
339
|
+
view: 'music',
|
|
340
|
+
ver: '0.0.0.1',
|
|
341
|
+
desc: 'music',
|
|
342
|
+
prompt: `[分享]${title}`,
|
|
343
|
+
meta: {
|
|
344
|
+
music: {
|
|
345
|
+
action: '',
|
|
346
|
+
android_pkg_name: config?.package ?? '',
|
|
347
|
+
app_type: 1,
|
|
348
|
+
appid: config?.appid ?? 0,
|
|
349
|
+
ctime: 0,
|
|
350
|
+
desc,
|
|
351
|
+
jumpUrl,
|
|
352
|
+
musicUrl,
|
|
353
|
+
preview,
|
|
354
|
+
sourceMsgId: '0',
|
|
355
|
+
source_icon: config?.icon ?? '',
|
|
356
|
+
source_url: '',
|
|
357
|
+
tag,
|
|
358
|
+
title,
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
};
|
|
362
|
+
return `[json:${JSON.stringify(json)}]`;
|
|
363
|
+
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ICQQ 适配器类型与配置
|
|
3
|
-
*
|
|
4
|
-
* 不再直接依赖 @icqqjs/icqq,通过 @icqqjs/cli 守护进程 IPC 通信。
|
|
5
|
-
*/
|
|
6
1
|
export type GroupRole = "owner" | "admin" | "member";
|
|
7
2
|
export interface IcqqSenderInfo {
|
|
8
3
|
id: string;
|
|
@@ -14,53 +9,26 @@ export interface IcqqSenderInfo {
|
|
|
14
9
|
card?: string;
|
|
15
10
|
title?: string;
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Endpoint 配置:支持本地 IPC 和远程 RPC 两种连接模式。
|
|
19
|
-
*
|
|
20
|
-
* - 本地模式(默认):只需 name(QQ号),自动连接 ~/.icqq/<uin>/daemon.sock
|
|
21
|
-
* - 远程模式:额外配置 rpc.host / rpc.port / rpc.token
|
|
22
|
-
*/
|
|
23
12
|
export interface IcqqEndpointConfig {
|
|
24
13
|
context: "icqq";
|
|
25
|
-
/** QQ 号码字符串 */
|
|
26
14
|
name: `${number}`;
|
|
27
|
-
/** RPC 远程连接配置(不配置则使用本地 IPC) */
|
|
28
|
-
rpc?: {
|
|
29
|
-
/** 远程主机地址 */
|
|
30
|
-
host: string;
|
|
31
|
-
/** 远程端口 */
|
|
32
|
-
port: number;
|
|
33
|
-
/** 认证 token(用于 HMAC-SHA256 挑战-响应,不会明文传输) */
|
|
34
|
-
token: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* IPC/RPC 与守护进程连接意外断开时是否自动重连(指数退避,上限约 30s)。
|
|
38
|
-
* 默认 true;设为 false 则断开后仅将 `$connected` 置为 false,需手动重连。
|
|
39
|
-
*/
|
|
40
15
|
autoReconnect?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* 出站图片/语音/视频:file=本机临时文件路径(需与 icqq 守护进程同机可读);
|
|
43
|
-
* base64=经 CQ `base64://` 交给守护进程解码(Zhin 与 icqq 异进程/异机时用,配置 rpc 时默认 base64)。
|
|
44
|
-
*/
|
|
45
16
|
outboundMedia?: "file" | "base64";
|
|
46
17
|
}
|
|
47
|
-
|
|
48
|
-
export interface IpcFriendInfo {
|
|
18
|
+
export interface FriendInfo {
|
|
49
19
|
user_id: number;
|
|
50
20
|
nickname: string;
|
|
51
21
|
remark?: string;
|
|
52
22
|
class_id?: number;
|
|
53
23
|
}
|
|
54
|
-
|
|
55
|
-
export interface IpcGroupInfo {
|
|
24
|
+
export interface GroupInfo {
|
|
56
25
|
group_id: number;
|
|
57
26
|
group_name: string;
|
|
58
27
|
member_count: number;
|
|
59
28
|
max_member_count: number;
|
|
60
29
|
owner_id?: number;
|
|
61
30
|
}
|
|
62
|
-
|
|
63
|
-
export interface IpcMemberInfo {
|
|
31
|
+
export interface MemberInfo {
|
|
64
32
|
user_id: number;
|
|
65
33
|
nickname: string;
|
|
66
34
|
card: string;
|
|
@@ -70,11 +38,7 @@ export interface IpcMemberInfo {
|
|
|
70
38
|
last_sent_time?: number;
|
|
71
39
|
shutup_time?: number;
|
|
72
40
|
}
|
|
73
|
-
|
|
74
|
-
* GET_SYSTEM_MSG 归一后的待处理请求(@icqqjs/cli NormalizedSystemMessage)。
|
|
75
|
-
* friendRequests 与 groupRequests 均为该形状,按 flag 处理。
|
|
76
|
-
*/
|
|
77
|
-
export interface IpcSystemMessage {
|
|
41
|
+
export interface SystemMessage {
|
|
78
42
|
type: string;
|
|
79
43
|
user_id?: number;
|
|
80
44
|
nickname?: string;
|
package/lib/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-icqq",
|
|
3
|
-
"version": "8.0.
|
|
4
|
-
"description": "Zhin.js ICQQ adapter
|
|
3
|
+
"version": "8.0.10",
|
|
4
|
+
"description": "Zhin.js ICQQ adapter — direct connection to @icqqjs/icqq",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
@@ -34,25 +34,31 @@
|
|
|
34
34
|
"directory": "plugins/adapters/icqq"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@zhin.js/adapter": "1.1.
|
|
38
|
-
"@zhin.js/command": "1.0.
|
|
39
|
-
"@zhin.js/core": "1.5.
|
|
37
|
+
"@zhin.js/adapter": "1.1.9",
|
|
38
|
+
"@zhin.js/command": "1.0.13",
|
|
39
|
+
"@zhin.js/core": "1.5.9",
|
|
40
|
+
"@zhin.js/tool": "1.0.10",
|
|
40
41
|
"@zhin.js/im-contract": "1.0.3",
|
|
41
|
-
"@zhin.js/
|
|
42
|
-
"@zhin.js/plugin-runtime": "1.1.
|
|
42
|
+
"@zhin.js/permission": "1.0.2",
|
|
43
|
+
"@zhin.js/plugin-runtime": "1.1.6",
|
|
44
|
+
"@zhin.js/logger": "1.0.76"
|
|
43
45
|
},
|
|
44
46
|
"peerDependencies": {
|
|
47
|
+
"@icqqjs/icqq": "^1.12.2",
|
|
45
48
|
"zod": "^4.0.0",
|
|
46
|
-
"@zhin.js/adapter": "1.1.
|
|
47
|
-
"@zhin.js/agent": "1.1.
|
|
48
|
-
"@zhin.js/core": "1.5.
|
|
49
|
-
"@zhin.js/plugin-runtime": "1.1.
|
|
50
|
-
"zhin.js": "6.0.
|
|
49
|
+
"@zhin.js/adapter": "1.1.9",
|
|
50
|
+
"@zhin.js/agent": "1.1.10",
|
|
51
|
+
"@zhin.js/core": "1.5.9",
|
|
52
|
+
"@zhin.js/plugin-runtime": "1.1.6",
|
|
53
|
+
"zhin.js": "6.0.9"
|
|
51
54
|
},
|
|
52
55
|
"peerDependenciesMeta": {
|
|
53
56
|
"zhin.js": {
|
|
54
57
|
"optional": true
|
|
55
58
|
},
|
|
59
|
+
"@icqqjs/icqq": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
56
62
|
"@zhin.js/agent": {
|
|
57
63
|
"optional": true
|
|
58
64
|
},
|
|
@@ -61,12 +67,13 @@
|
|
|
61
67
|
}
|
|
62
68
|
},
|
|
63
69
|
"devDependencies": {
|
|
70
|
+
"@icqqjs/icqq": "^1.12.2",
|
|
64
71
|
"@types/node": "^26.1.2",
|
|
65
72
|
"typescript": "^6.0.3",
|
|
66
73
|
"vitest": "^4.1.10",
|
|
67
74
|
"zod": "^4.4.3",
|
|
68
|
-
"@zhin.js/agent": "1.1.
|
|
69
|
-
"zhin.js": "6.0.
|
|
75
|
+
"@zhin.js/agent": "1.1.10",
|
|
76
|
+
"zhin.js": "6.0.9"
|
|
70
77
|
},
|
|
71
78
|
"files": [
|
|
72
79
|
"adapters",
|
|
@@ -76,6 +83,7 @@
|
|
|
76
83
|
"src",
|
|
77
84
|
"lib",
|
|
78
85
|
"agent",
|
|
86
|
+
"tools",
|
|
79
87
|
"README.md",
|
|
80
88
|
"CHANGELOG.md"
|
|
81
89
|
],
|
|
@@ -100,6 +108,10 @@
|
|
|
100
108
|
{
|
|
101
109
|
"package": "@zhin.js/command",
|
|
102
110
|
"api": "^1.0.0"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"package": "@zhin.js/tool",
|
|
114
|
+
"api": "^1.0.0"
|
|
103
115
|
}
|
|
104
116
|
],
|
|
105
117
|
"plugins": []
|
package/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { createEndpointRuntimeState } from '@zhin.js/adapter';
|
|
3
3
|
import { definePlugin } from '@zhin.js/plugin-runtime';
|
|
4
|
+
import { permissionHostToken, createSceneRolePlatformChecker } from '@zhin.js/permission';
|
|
4
5
|
import { icqqRuntimeStateToken } from "./lib/icqq-runtime-state.js";
|
|
5
6
|
// Module-level guard: multiple icqq instances (icqq, icqq-2, …) share this
|
|
6
7
|
// module, but the prompt contributor is per-platform — register it once.
|
|
@@ -13,10 +14,13 @@ export default definePlugin({
|
|
|
13
14
|
setup(context) {
|
|
14
15
|
// 运行中 endpoint 注册表(icqq.endpoint list 的"运行中"数据源)
|
|
15
16
|
context.resources.provide(icqqRuntimeStateToken, createEndpointRuntimeState());
|
|
17
|
+
const disposePlatform = context.resources.has(permissionHostToken)
|
|
18
|
+
? context.resources.use(permissionHostToken).registerPlatform('icqq', createSceneRolePlatformChecker())
|
|
19
|
+
: undefined;
|
|
16
20
|
// Agent prompt contributor (orchestrator/deferred-worker ICQQ guidance).
|
|
17
21
|
// `zhin.js/agent` is an optional peer — skip silently on IM-only installs.
|
|
18
22
|
if (promptContributorRegistered)
|
|
19
|
-
return;
|
|
23
|
+
return disposePlatform;
|
|
20
24
|
let cancelled = false;
|
|
21
25
|
let unregister;
|
|
22
26
|
void Promise.all([
|
|
@@ -32,6 +36,7 @@ export default definePlugin({
|
|
|
32
36
|
return () => {
|
|
33
37
|
cancelled = true;
|
|
34
38
|
unregister?.();
|
|
39
|
+
disposePlatform?.();
|
|
35
40
|
};
|
|
36
41
|
},
|
|
37
42
|
});
|