@zhin.js/adapter-icqq 6.0.1 → 6.0.3
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 +59 -0
- package/README.md +32 -437
- package/adapters/icqq.ts +30 -0
- package/agent/tools/announce.ts +21 -0
- package/agent/tools/essence.ts +22 -0
- package/agent/tools/friend_list.ts +19 -0
- package/agent/tools/group_files.ts +27 -0
- package/agent/tools/group_invite.ts +20 -0
- package/agent/tools/group_list.ts +20 -0
- package/agent/tools/group_sign.ts +19 -0
- package/agent/tools/list_muted.ts +22 -0
- package/agent/tools/poke.ts +20 -0
- package/agent/tools/send_user_like.ts +22 -0
- package/agent/tools/set_anonymous.ts +22 -0
- package/agent/tools/set_title.ts +25 -0
- package/lib/agent-prompt.d.ts +0 -1
- package/lib/agent-prompt.js +0 -1
- package/lib/cq-message.d.ts +0 -1
- package/lib/cq-message.js +0 -1
- package/lib/endpoint.d.ts +45 -97
- package/lib/endpoint.js +357 -628
- package/lib/forward-msg.d.ts +1 -2
- package/lib/forward-msg.js +4 -2
- package/lib/icqq-agent-deps.d.ts +25 -0
- package/lib/icqq-agent-deps.js +32 -0
- package/lib/icqq-guild.d.ts +1 -2
- package/lib/icqq-guild.js +4 -2
- package/lib/icqq-inbound.d.ts +10 -1
- package/lib/icqq-inbound.js +27 -3
- package/lib/index.d.ts +6 -18
- package/lib/index.js +6 -50
- package/lib/ipc-client.d.ts +0 -1
- package/lib/ipc-client.js +0 -1
- package/lib/outbound-media.d.ts +0 -1
- package/lib/outbound-media.js +0 -1
- package/lib/protocol.d.ts +73 -2
- package/lib/protocol.js +124 -2
- package/lib/types.d.ts +0 -1
- package/lib/types.js +0 -1
- package/package.json +51 -43
- package/plugin.ts +32 -0
- package/schema.json +35 -0
- package/src/agent-prompt.ts +1 -2
- package/src/endpoint.ts +399 -800
- package/src/forward-msg.ts +2 -2
- package/src/icqq-agent-deps.ts +57 -0
- package/src/icqq-guild.ts +1 -2
- package/src/icqq-inbound.ts +31 -2
- package/src/index.ts +35 -69
- package/src/protocol.ts +191 -1
- package/client/ICQQManagement.tsx +0 -147
- package/client/LoginAssistPanel.tsx +0 -300
- package/client/index.tsx +0 -11
- package/client/tsconfig.json +0 -7
- package/client/utils/api.ts +0 -30
- package/dist/index.js +0 -34
- package/lib/adapter.d.ts +0 -46
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js +0 -128
- package/lib/adapter.js.map +0 -1
- package/lib/agent-prompt.d.ts.map +0 -1
- package/lib/agent-prompt.js.map +0 -1
- package/lib/cq-message.d.ts.map +0 -1
- package/lib/cq-message.js.map +0 -1
- package/lib/endpoint.d.ts.map +0 -1
- package/lib/endpoint.js.map +0 -1
- package/lib/forward-msg.d.ts.map +0 -1
- package/lib/forward-msg.js.map +0 -1
- package/lib/get-msg.d.ts +0 -3
- package/lib/get-msg.d.ts.map +0 -1
- package/lib/get-msg.js +0 -46
- package/lib/get-msg.js.map +0 -1
- package/lib/icqq-guild.d.ts.map +0 -1
- package/lib/icqq-guild.js.map +0 -1
- package/lib/icqq-inbound.d.ts.map +0 -1
- package/lib/icqq-inbound.js.map +0 -1
- package/lib/icqq-login-assist-bridge.d.ts +0 -5
- package/lib/icqq-login-assist-bridge.d.ts.map +0 -1
- package/lib/icqq-login-assist-bridge.js +0 -148
- package/lib/icqq-login-assist-bridge.js.map +0 -1
- package/lib/icqq-side-events.d.ts +0 -34
- package/lib/icqq-side-events.d.ts.map +0 -1
- package/lib/icqq-side-events.js +0 -194
- package/lib/icqq-side-events.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/ipc-client.d.ts.map +0 -1
- package/lib/ipc-client.js.map +0 -1
- package/lib/login-assist-routes.d.ts +0 -7
- package/lib/login-assist-routes.d.ts.map +0 -1
- package/lib/login-assist-routes.js +0 -29
- package/lib/login-assist-routes.js.map +0 -1
- package/lib/login-ipc-contract.d.ts +0 -44
- package/lib/login-ipc-contract.d.ts.map +0 -1
- package/lib/login-ipc-contract.js +0 -35
- package/lib/login-ipc-contract.js.map +0 -1
- package/lib/outbound-media.d.ts.map +0 -1
- package/lib/outbound-media.js.map +0 -1
- package/lib/protocol.d.ts.map +0 -1
- package/lib/protocol.js.map +0 -1
- package/lib/routes.d.ts +0 -8
- package/lib/routes.d.ts.map +0 -1
- package/lib/routes.js +0 -67
- package/lib/routes.js.map +0 -1
- package/lib/segment-mapper.d.ts +0 -2
- package/lib/segment-mapper.d.ts.map +0 -1
- package/lib/segment-mapper.js +0 -2
- package/lib/segment-mapper.js.map +0 -1
- package/lib/tools/index.d.ts +0 -10
- package/lib/tools/index.d.ts.map +0 -1
- package/lib/tools/index.js +0 -341
- package/lib/tools/index.js.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/plugin.yml +0 -3
- package/src/adapter.ts +0 -151
- package/src/get-msg.ts +0 -56
- package/src/icqq-login-assist-bridge.ts +0 -196
- package/src/icqq-side-events.ts +0 -228
- package/src/login-assist-routes.ts +0 -39
- package/src/login-ipc-contract.ts +0 -52
- package/src/routes.ts +0 -83
- package/src/segment-mapper.ts +0 -1
- package/src/tools/index.ts +0 -412
- /package/{skills/icqq → agent}/PERMITS.md +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; group_id: number }>({
|
|
5
|
+
description: '获取 QQ 群的群文件列表',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
8
|
+
group_id: z.number().describe('群号'),
|
|
9
|
+
}),
|
|
10
|
+
platforms: ['icqq'],
|
|
11
|
+
tags: ['icqq'],
|
|
12
|
+
async execute({ endpoint_id, group_id }: { endpoint_id: string; group_id: number }) {
|
|
13
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
14
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
15
|
+
const resp = await endpoint.ipc.request(Actions.GFS_LIST, { group_id });
|
|
16
|
+
if (!resp.ok) throw new Error(resp.error ?? '获取群文件失败');
|
|
17
|
+
const files = Array.isArray(resp.data) ? resp.data : [];
|
|
18
|
+
if (!files.length) return { files: [], message: '群文件为空' };
|
|
19
|
+
return {
|
|
20
|
+
files: files.slice(0, 30).map((f: { name: string; size: number; uploader_uin: string; upload_time: number }) => ({
|
|
21
|
+
name: f.name, size: f.size, uploader: f.uploader_uin, upload_time: f.upload_time,
|
|
22
|
+
})),
|
|
23
|
+
count: files.length,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; group_id: number; user_id: number }>({
|
|
5
|
+
description: '邀请好友加入 QQ 群',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint QQ号'),
|
|
8
|
+
group_id: z.number().describe('目标群号'),
|
|
9
|
+
user_id: z.number().describe('要邀请的 QQ号'),
|
|
10
|
+
}),
|
|
11
|
+
platforms: ['icqq'],
|
|
12
|
+
tags: ['icqq'],
|
|
13
|
+
async execute({ endpoint_id, group_id, user_id }: { endpoint_id: string; group_id: number; user_id: number }) {
|
|
14
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
15
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
16
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_INVITE, { group_id, user_id });
|
|
17
|
+
return { success: resp.ok, message: resp.ok ? `已邀请 ${user_id} 加入群` : (resp.error ?? '邀请失败') };
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string }>({
|
|
5
|
+
description: '获取 Endpoint 的 QQ 群列表',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint 名称'),
|
|
8
|
+
}),
|
|
9
|
+
platforms: ['icqq'],
|
|
10
|
+
tags: ['icqq'],
|
|
11
|
+
async execute({ endpoint_id }: { endpoint_id: string }) {
|
|
12
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
13
|
+
const groups = Array.from(endpoint.groups.values()).map((g) => ({
|
|
14
|
+
group_id: g.group_id, group_name: g.group_name,
|
|
15
|
+
member_count: g.member_count, max_member_count: g.max_member_count,
|
|
16
|
+
}));
|
|
17
|
+
return { groups: groups.slice(0, 50), count: endpoint.groups.size };
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; group_id: number }>({
|
|
5
|
+
description: 'QQ 群签到打卡',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint QQ号'),
|
|
8
|
+
group_id: z.number().describe('目标群号'),
|
|
9
|
+
}),
|
|
10
|
+
platforms: ['icqq'],
|
|
11
|
+
tags: ['icqq'],
|
|
12
|
+
async execute({ endpoint_id, group_id }: { endpoint_id: string; group_id: number }) {
|
|
13
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
14
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
15
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_SIGN, { group_id });
|
|
16
|
+
return { success: resp.ok, message: resp.ok ? '群签到成功' : (resp.error ?? '签到失败') };
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; group_id: number }>({
|
|
5
|
+
description: '查询 QQ 群中当前被禁言的成员列表',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint QQ号'),
|
|
8
|
+
group_id: z.number().describe('目标群号'),
|
|
9
|
+
}),
|
|
10
|
+
platforms: ['icqq'],
|
|
11
|
+
tags: ['icqq'],
|
|
12
|
+
permissions: ['platform(icqq,scene_admin)'],
|
|
13
|
+
async execute({ endpoint_id, group_id }: { endpoint_id: string; group_id: number }) {
|
|
14
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
15
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
16
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_MUTED_LIST, { group_id });
|
|
17
|
+
if (!resp.ok) throw new Error(resp.error ?? '获取禁言列表失败');
|
|
18
|
+
const list = Array.isArray(resp.data) ? resp.data : [];
|
|
19
|
+
return { muted_members: list, count: list.length };
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; group_id: number; user_id: number }>({
|
|
5
|
+
description: '在 QQ 群中对某个成员执行戳一戳互动操作',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint QQ号'),
|
|
8
|
+
group_id: z.number().describe('目标群号'),
|
|
9
|
+
user_id: z.number().describe('要戳的目标成员 QQ号'),
|
|
10
|
+
}),
|
|
11
|
+
platforms: ['icqq'],
|
|
12
|
+
tags: ['icqq'],
|
|
13
|
+
async execute({ endpoint_id, group_id, user_id }: { endpoint_id: string; group_id: number; user_id: number }) {
|
|
14
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
15
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
16
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_POKE, { group_id, user_id });
|
|
17
|
+
return { success: resp.ok, message: resp.ok ? `已戳了戳 ${user_id}` : (resp.error ?? '戳一戳失败') };
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; user_id: number; times?: number }>({
|
|
5
|
+
description: '给用户点赞(竖大拇指),每人每天最多 20 次',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint QQ号'),
|
|
8
|
+
user_id: z.number().describe('要点赞的目标用户 QQ号'),
|
|
9
|
+
times: z.number().optional().describe('点赞次数(1-20),默认 1'),
|
|
10
|
+
}),
|
|
11
|
+
platforms: ['icqq'],
|
|
12
|
+
tags: ['icqq'],
|
|
13
|
+
async execute({ endpoint_id, user_id, times }: { endpoint_id: string; user_id: number; times?: number }) {
|
|
14
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
15
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
16
|
+
const resp = await endpoint.ipc.request(Actions.FRIEND_LIKE, {
|
|
17
|
+
user_id, times: Math.min(times ?? 1, 20),
|
|
18
|
+
});
|
|
19
|
+
return { success: resp.ok, message: resp.ok ? `已给 ${user_id} 点赞` : (resp.error ?? '点赞失败') };
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; group_id: number; enable?: boolean }>({
|
|
5
|
+
description: '开启或关闭 QQ 群的匿名聊天功能',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint QQ号'),
|
|
8
|
+
group_id: z.number().describe('目标群号'),
|
|
9
|
+
enable: z.boolean().optional().describe('true=开启,false=关闭,默认 true'),
|
|
10
|
+
}),
|
|
11
|
+
platforms: ['icqq'],
|
|
12
|
+
tags: ['icqq'],
|
|
13
|
+
permissions: ['platform(icqq,scene_owner)'],
|
|
14
|
+
async execute({ endpoint_id, group_id, enable }: { endpoint_id: string; group_id: number; enable?: boolean }) {
|
|
15
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
16
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
17
|
+
const on = enable ?? true;
|
|
18
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_ALLOW_ANONY, { group_id, enable: on });
|
|
19
|
+
return { success: resp.ok, message: resp.ok ? (on ? '已开启匿名聊天' : '已关闭匿名聊天') : (resp.error ?? '操作失败') };
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/agent/tools';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { getIcqqAgentDeps } from '../../src/icqq-agent-deps.js';
|
|
4
|
+
export default defineAgentTool<{ endpoint_id: string; group_id: number; user_id: number; title: string; duration?: number }>({
|
|
5
|
+
description: '设置 QQ 群成员的专属头衔',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
endpoint_id: z.string().describe('Endpoint QQ号'),
|
|
8
|
+
group_id: z.number().describe('目标群号'),
|
|
9
|
+
user_id: z.number().describe('目标成员 QQ号'),
|
|
10
|
+
title: z.string().describe('头衔文字'),
|
|
11
|
+
duration: z.number().optional().describe('持续时间(秒),-1永久'),
|
|
12
|
+
}),
|
|
13
|
+
platforms: ['icqq'],
|
|
14
|
+
tags: ['icqq'],
|
|
15
|
+
permissions: ['platform(icqq,scene_owner)'],
|
|
16
|
+
async execute({ endpoint_id, group_id, user_id, title, duration }: { endpoint_id: string; group_id: number; user_id: number; title: string; duration?: number }) {
|
|
17
|
+
const { Actions } = await import('../../src/protocol.js');
|
|
18
|
+
const endpoint = getIcqqAgentDeps().getEndpoint(endpoint_id);
|
|
19
|
+
const resp = await endpoint.ipc.request(Actions.SET_GROUP_TITLE, {
|
|
20
|
+
group_id, user_id, title, duration: duration ?? -1,
|
|
21
|
+
});
|
|
22
|
+
return { success: resp.ok, message: resp.ok ? `已将 ${user_id} 的头衔设为 "${title}"` : (resp.error ?? '设置失败') };
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
package/lib/agent-prompt.d.ts
CHANGED
package/lib/agent-prompt.js
CHANGED
package/lib/cq-message.d.ts
CHANGED
|
@@ -7,4 +7,3 @@ export declare function parseCqMessage(raw: string): MessageSegment[];
|
|
|
7
7
|
/** 构建 icqq IPC send_*_msg 的 message 字符串(非空) */
|
|
8
8
|
export declare function buildIcqqIpcMessage(content: SendContent): string;
|
|
9
9
|
export declare function toCqString(content: SendContent): string;
|
|
10
|
-
//# sourceMappingURL=cq-message.d.ts.map
|
package/lib/cq-message.js
CHANGED
package/lib/endpoint.d.ts
CHANGED
|
@@ -1,103 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 不再直接依赖 @icqqjs/icqq 协议库。
|
|
5
|
-
* 登录由 `icqq login` 完成,本 Endpoint 只负责连接守护进程并收发消息。
|
|
2
|
+
* IcqqIpcEndpoint — lifecycle, outbound, IPC subscribe/admit for ICQQ daemon.
|
|
6
3
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$connected: boolean;
|
|
18
|
-
$config: IcqqEndpointConfig;
|
|
19
|
-
ipc: IpcClient;
|
|
20
|
-
/** 缓存的好友列表 */
|
|
21
|
-
friends: Map<number, IpcFriendInfo>;
|
|
22
|
-
/** 缓存的群列表 */
|
|
23
|
-
groups: Map<number, IpcGroupInfo>;
|
|
24
|
-
/** QQ 频道(guild)子频道缓存 */
|
|
25
|
-
readonly guildCatalog: IcqqGuildCatalog;
|
|
26
|
-
private subscriptions;
|
|
27
|
-
/** 事件去重:覆盖多端回流/服务端重复推送等场景 */
|
|
28
|
-
private readonly inboundDeduper;
|
|
29
|
-
/** MessageEvent.source 解析结果,供 $getMsg 优先命中 */
|
|
30
|
-
private readonly quotedSourceCache;
|
|
31
|
-
/** 用户主动断开时为 true,阻止自动重连 */
|
|
32
|
-
private intentionalDisconnect;
|
|
33
|
-
/** 是否已有重连循环在跑(避免多次 schedule 叠套) */
|
|
34
|
-
private reconnectRunning;
|
|
35
|
-
get $id(): `${number}`;
|
|
36
|
-
get logger(): import("zhin.js").Logger;
|
|
37
|
-
constructor(adapter: IcqqAdapter, config: IcqqEndpointConfig);
|
|
38
|
-
$connect(): Promise<void>;
|
|
39
|
-
/** 建立或恢复与守护进程的 IPC/RPC 会话(订阅、缓存列表) */
|
|
40
|
-
private rebindIpcSession;
|
|
41
|
-
/** IPC/RPC 意外断开时调度重连(指数退避) */
|
|
42
|
-
private scheduleReconnect;
|
|
43
|
-
private runReconnectLoop;
|
|
44
|
-
/** 刷新好友/群列表缓存 */
|
|
45
|
-
refreshLists(): Promise<void>;
|
|
46
|
-
/** Console:列出 guild 子频道(含 parent.guild) */
|
|
47
|
-
getGuildChannelList(): ReturnType<IcqqGuildCatalog["getGuildChannelList"]>;
|
|
48
|
-
resolveConsoleChannelNames(channelId: string, guildId?: string): {
|
|
49
|
-
channelName?: string;
|
|
50
|
-
parentName?: string;
|
|
4
|
+
import type { EndpointInstance } from '@zhin.js/adapter';
|
|
5
|
+
import type { MessageGateway } from '@zhin.js/core/runtime';
|
|
6
|
+
import type { CapabilityId } from '@zhin.js/plugin-runtime';
|
|
7
|
+
import { type IcqqInboundMessage, type IpcEvent, type IpcResponse, type ResolvedIcqqConfig } from './protocol.js';
|
|
8
|
+
import type { IpcFriendInfo, IpcGroupInfo } from './types.js';
|
|
9
|
+
/** Minimal IPC surface used by the endpoint (real IpcClient or test mock). */
|
|
10
|
+
export interface IcqqIpcTransport {
|
|
11
|
+
request(action: string, params?: Record<string, unknown>): Promise<IpcResponse>;
|
|
12
|
+
subscribe(action: string, params: Record<string, unknown>, handler: (event: IpcEvent) => void): {
|
|
13
|
+
unsubscribe: () => Promise<void>;
|
|
51
14
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
15
|
+
setOnRemoteDisconnect(handler: (() => void) | null): void;
|
|
16
|
+
close(): void;
|
|
17
|
+
}
|
|
18
|
+
export type CreateIcqqIpc = (config: ResolvedIcqqConfig) => Promise<IcqqIpcTransport>;
|
|
19
|
+
export interface IcqqEndpointOptions {
|
|
20
|
+
readonly id: CapabilityId;
|
|
21
|
+
readonly gateway: MessageGateway;
|
|
22
|
+
readonly config: ResolvedIcqqConfig;
|
|
23
|
+
readonly createIpc?: CreateIcqqIpc;
|
|
24
|
+
}
|
|
25
|
+
export declare class IcqqIpcEndpoint implements EndpointInstance {
|
|
26
|
+
#private;
|
|
27
|
+
readonly name: string;
|
|
28
|
+
/** Populated after start(); agent tools read this. */
|
|
29
|
+
ipc: IcqqIpcTransport;
|
|
30
|
+
readonly friends: Map<number, IpcFriendInfo>;
|
|
31
|
+
readonly groups: Map<number, IpcGroupInfo>;
|
|
32
|
+
constructor(options: IcqqEndpointOptions);
|
|
33
|
+
request(action: string, params?: Record<string, unknown>): Promise<IpcResponse>;
|
|
34
|
+
start(): Promise<void>;
|
|
35
|
+
open(): void;
|
|
36
|
+
close(): void;
|
|
37
|
+
stop(): Promise<void>;
|
|
38
|
+
send({ target, payload }: {
|
|
39
|
+
readonly target: string;
|
|
40
|
+
readonly payload: unknown;
|
|
41
|
+
}): Promise<string>;
|
|
76
42
|
private static readonly EMOJI_MAP;
|
|
77
|
-
/**
|
|
78
|
-
* 将表情符号转换为 reaction id
|
|
79
|
-
*/
|
|
80
43
|
private getEmojiId;
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
$addReaction(messageId: string, emoji: string): Promise<string | null>;
|
|
89
|
-
/**
|
|
90
|
-
* 移除消息回应
|
|
91
|
-
*
|
|
92
|
-
* @param messageId - 消息 ID
|
|
93
|
-
* @param reactionId - 反应 ID(由 $addReaction 返回)
|
|
94
|
-
*/
|
|
95
|
-
$removeReaction(messageId: string, reactionId: string): Promise<void>;
|
|
96
|
-
}
|
|
97
|
-
/** @deprecated 使用 `./cq-message.js` 导出 */
|
|
98
|
-
export declare namespace IcqqEndpoint {
|
|
99
|
-
const parseCqMessage: typeof parseCqMessageImpl;
|
|
100
|
-
const buildIcqqIpcMessage: typeof buildIcqqIpcMessageImpl;
|
|
101
|
-
const toCqString: typeof toCqStringImpl;
|
|
44
|
+
/** Activity-feedback / OutboundHost reaction surface. */
|
|
45
|
+
addReaction(messageId: string, emoji: string): Promise<string | null>;
|
|
46
|
+
removeReaction(messageId: string, reactionId: string): Promise<void>;
|
|
47
|
+
/** Activity-feedback autoRemove / Console recall. */
|
|
48
|
+
recallMessage(messageId: string): Promise<void>;
|
|
49
|
+
/** Test / internal: admit when open. */
|
|
50
|
+
admit(msg: IcqqInboundMessage): void;
|
|
102
51
|
}
|
|
103
|
-
//# sourceMappingURL=endpoint.d.ts.map
|