@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.
Files changed (125) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +32 -437
  3. package/adapters/icqq.ts +30 -0
  4. package/agent/tools/announce.ts +21 -0
  5. package/agent/tools/essence.ts +22 -0
  6. package/agent/tools/friend_list.ts +19 -0
  7. package/agent/tools/group_files.ts +27 -0
  8. package/agent/tools/group_invite.ts +20 -0
  9. package/agent/tools/group_list.ts +20 -0
  10. package/agent/tools/group_sign.ts +19 -0
  11. package/agent/tools/list_muted.ts +22 -0
  12. package/agent/tools/poke.ts +20 -0
  13. package/agent/tools/send_user_like.ts +22 -0
  14. package/agent/tools/set_anonymous.ts +22 -0
  15. package/agent/tools/set_title.ts +25 -0
  16. package/lib/agent-prompt.d.ts +0 -1
  17. package/lib/agent-prompt.js +0 -1
  18. package/lib/cq-message.d.ts +0 -1
  19. package/lib/cq-message.js +0 -1
  20. package/lib/endpoint.d.ts +45 -97
  21. package/lib/endpoint.js +357 -628
  22. package/lib/forward-msg.d.ts +1 -2
  23. package/lib/forward-msg.js +4 -2
  24. package/lib/icqq-agent-deps.d.ts +25 -0
  25. package/lib/icqq-agent-deps.js +32 -0
  26. package/lib/icqq-guild.d.ts +1 -2
  27. package/lib/icqq-guild.js +4 -2
  28. package/lib/icqq-inbound.d.ts +10 -1
  29. package/lib/icqq-inbound.js +27 -3
  30. package/lib/index.d.ts +6 -18
  31. package/lib/index.js +6 -50
  32. package/lib/ipc-client.d.ts +0 -1
  33. package/lib/ipc-client.js +0 -1
  34. package/lib/outbound-media.d.ts +0 -1
  35. package/lib/outbound-media.js +0 -1
  36. package/lib/protocol.d.ts +73 -2
  37. package/lib/protocol.js +124 -2
  38. package/lib/types.d.ts +0 -1
  39. package/lib/types.js +0 -1
  40. package/package.json +51 -43
  41. package/plugin.ts +32 -0
  42. package/schema.json +35 -0
  43. package/src/agent-prompt.ts +1 -2
  44. package/src/endpoint.ts +399 -800
  45. package/src/forward-msg.ts +2 -2
  46. package/src/icqq-agent-deps.ts +57 -0
  47. package/src/icqq-guild.ts +1 -2
  48. package/src/icqq-inbound.ts +31 -2
  49. package/src/index.ts +35 -69
  50. package/src/protocol.ts +191 -1
  51. package/client/ICQQManagement.tsx +0 -147
  52. package/client/LoginAssistPanel.tsx +0 -300
  53. package/client/index.tsx +0 -11
  54. package/client/tsconfig.json +0 -7
  55. package/client/utils/api.ts +0 -30
  56. package/dist/index.js +0 -34
  57. package/lib/adapter.d.ts +0 -46
  58. package/lib/adapter.d.ts.map +0 -1
  59. package/lib/adapter.js +0 -128
  60. package/lib/adapter.js.map +0 -1
  61. package/lib/agent-prompt.d.ts.map +0 -1
  62. package/lib/agent-prompt.js.map +0 -1
  63. package/lib/cq-message.d.ts.map +0 -1
  64. package/lib/cq-message.js.map +0 -1
  65. package/lib/endpoint.d.ts.map +0 -1
  66. package/lib/endpoint.js.map +0 -1
  67. package/lib/forward-msg.d.ts.map +0 -1
  68. package/lib/forward-msg.js.map +0 -1
  69. package/lib/get-msg.d.ts +0 -3
  70. package/lib/get-msg.d.ts.map +0 -1
  71. package/lib/get-msg.js +0 -46
  72. package/lib/get-msg.js.map +0 -1
  73. package/lib/icqq-guild.d.ts.map +0 -1
  74. package/lib/icqq-guild.js.map +0 -1
  75. package/lib/icqq-inbound.d.ts.map +0 -1
  76. package/lib/icqq-inbound.js.map +0 -1
  77. package/lib/icqq-login-assist-bridge.d.ts +0 -5
  78. package/lib/icqq-login-assist-bridge.d.ts.map +0 -1
  79. package/lib/icqq-login-assist-bridge.js +0 -148
  80. package/lib/icqq-login-assist-bridge.js.map +0 -1
  81. package/lib/icqq-side-events.d.ts +0 -34
  82. package/lib/icqq-side-events.d.ts.map +0 -1
  83. package/lib/icqq-side-events.js +0 -194
  84. package/lib/icqq-side-events.js.map +0 -1
  85. package/lib/index.d.ts.map +0 -1
  86. package/lib/index.js.map +0 -1
  87. package/lib/ipc-client.d.ts.map +0 -1
  88. package/lib/ipc-client.js.map +0 -1
  89. package/lib/login-assist-routes.d.ts +0 -7
  90. package/lib/login-assist-routes.d.ts.map +0 -1
  91. package/lib/login-assist-routes.js +0 -29
  92. package/lib/login-assist-routes.js.map +0 -1
  93. package/lib/login-ipc-contract.d.ts +0 -44
  94. package/lib/login-ipc-contract.d.ts.map +0 -1
  95. package/lib/login-ipc-contract.js +0 -35
  96. package/lib/login-ipc-contract.js.map +0 -1
  97. package/lib/outbound-media.d.ts.map +0 -1
  98. package/lib/outbound-media.js.map +0 -1
  99. package/lib/protocol.d.ts.map +0 -1
  100. package/lib/protocol.js.map +0 -1
  101. package/lib/routes.d.ts +0 -8
  102. package/lib/routes.d.ts.map +0 -1
  103. package/lib/routes.js +0 -67
  104. package/lib/routes.js.map +0 -1
  105. package/lib/segment-mapper.d.ts +0 -2
  106. package/lib/segment-mapper.d.ts.map +0 -1
  107. package/lib/segment-mapper.js +0 -2
  108. package/lib/segment-mapper.js.map +0 -1
  109. package/lib/tools/index.d.ts +0 -10
  110. package/lib/tools/index.d.ts.map +0 -1
  111. package/lib/tools/index.js +0 -341
  112. package/lib/tools/index.js.map +0 -1
  113. package/lib/types.d.ts.map +0 -1
  114. package/lib/types.js.map +0 -1
  115. package/plugin.yml +0 -3
  116. package/src/adapter.ts +0 -151
  117. package/src/get-msg.ts +0 -56
  118. package/src/icqq-login-assist-bridge.ts +0 -196
  119. package/src/icqq-side-events.ts +0 -228
  120. package/src/login-assist-routes.ts +0 -39
  121. package/src/login-ipc-contract.ts +0 -52
  122. package/src/routes.ts +0 -83
  123. package/src/segment-mapper.ts +0 -1
  124. package/src/tools/index.ts +0 -412
  125. /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
+
@@ -1,3 +1,2 @@
1
1
  import type { AgentPromptContributor } from 'zhin.js';
2
2
  export declare function createIcqqAgentPromptContributor(): AgentPromptContributor;
3
- //# sourceMappingURL=agent-prompt.d.ts.map
@@ -100,4 +100,3 @@ export function createIcqqAgentPromptContributor() {
100
100
  },
101
101
  };
102
102
  }
103
- //# sourceMappingURL=agent-prompt.js.map
@@ -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
@@ -145,4 +145,3 @@ export function toCqString(content) {
145
145
  })
146
146
  .join("");
147
147
  }
148
- //# sourceMappingURL=cq-message.js.map
package/lib/endpoint.d.ts CHANGED
@@ -1,103 +1,51 @@
1
1
  /**
2
- * ICQQ Bot:通过 @icqqjs/cli 守护进程 IPC 通信,实现 zhin Endpoint 接口
3
- *
4
- * 不再直接依赖 @icqqjs/icqq 协议库。
5
- * 登录由 `icqq login` 完成,本 Endpoint 只负责连接守护进程并收发消息。
2
+ * IcqqIpcEndpoint — lifecycle, outbound, IPC subscribe/admit for ICQQ daemon.
6
3
  */
7
- import { Endpoint, Message, SendOptions, type QuotedMessagePayload } from 'zhin.js';
8
- import type { IcqqEndpointConfig, IpcFriendInfo, IpcGroupInfo } from "./types.js";
9
- import type { IcqqAdapter } from "./adapter.js";
10
- import { IpcClient } from "./ipc-client.js";
11
- import type { IcqqIpcMessageEvent } from "./icqq-inbound.js";
12
- import { type NormalizedIcqqInbound } from "./icqq-inbound.js";
13
- import { buildIcqqIpcMessage as buildIcqqIpcMessageImpl, parseCqMessage as parseCqMessageImpl, toCqString as toCqStringImpl } from "./cq-message.js";
14
- import { IcqqGuildCatalog } from "./icqq-guild.js";
15
- export declare class IcqqEndpoint implements Endpoint<IcqqEndpointConfig, IcqqIpcMessageEvent> {
16
- adapter: IcqqAdapter;
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
- $disconnect(): Promise<void>;
53
- private handleEvent;
54
- private dispatchInboundMessage;
55
- private handleGuildMessageEvent;
56
- private dispatchGuildInboundMessage;
57
- private $formatGuildMessage;
58
- private handleNoticeEvent;
59
- private handleRequestEvent;
60
- private handleMetaEvent;
61
- /** 调试 IPC 入站字段:默认 debug;设 ICQQ_IPC_LOG_RAW=1 则 info 打完整 payload */
62
- private logIpcInboundPayload;
63
- $formatMessage(input: NormalizedIcqqInbound | IcqqIpcMessageEvent): ReturnType<typeof Message.from<IcqqIpcMessageEvent>>;
64
- /**
65
- * 有 source.message_id 时用 get_msg 拉全量正文;否则仅用 source 内联摘要。
66
- */
67
- private primeQuotedSourceCache;
68
- private fetchQuotedMessagePayload;
69
- $getMsg(messageId: string): Promise<QuotedMessagePayload>;
70
- $recallMessage(id: string): Promise<void>;
71
- $sendMessage(options: SendOptions): Promise<string>;
72
- /**
73
- * 表情符号到 reaction id 的映射
74
- * QQ 使用数字 ID 来标识表情,而不是 Unicode 字符
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
- * @param messageId - 消息 ID
85
- * @param emoji - 表情符号或 reaction id
86
- * @returns 反应 ID,可用于后续移除
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