@zhin.js/adapter-icqq 8.0.9 → 8.0.11

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 (88) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +36 -28
  3. package/adapters/icqq.js +6 -11
  4. package/adapters/icqq.ts +7 -16
  5. package/agent/PERMITS.md +2 -0
  6. package/lib/agent-prompt.js +17 -22
  7. package/lib/cq-message.d.ts +2 -2
  8. package/lib/cq-message.js +2 -2
  9. package/lib/endpoint.d.ts +6 -76
  10. package/lib/endpoint.js +348 -507
  11. package/lib/forward-msg.d.ts +7 -8
  12. package/lib/forward-msg.js +11 -24
  13. package/lib/icqq-agent-deps.d.ts +3 -15
  14. package/lib/icqq-agent-deps.js +0 -5
  15. package/lib/icqq-endpoint-commands.js +6 -15
  16. package/lib/icqq-guild.d.ts +15 -11
  17. package/lib/icqq-guild.js +9 -17
  18. package/lib/icqq-inbound.d.ts +20 -20
  19. package/lib/icqq-inbound.js +9 -9
  20. package/lib/icqq-inbox.d.ts +2 -10
  21. package/lib/icqq-runtime-state.js +1 -1
  22. package/lib/index.d.ts +2 -3
  23. package/lib/index.js +2 -3
  24. package/lib/outbound-media.d.ts +3 -8
  25. package/lib/outbound-media.js +3 -8
  26. package/lib/protocol.d.ts +38 -57
  27. package/lib/protocol.js +25 -22
  28. package/lib/types.d.ts +4 -40
  29. package/lib/types.js +0 -5
  30. package/package.json +22 -13
  31. package/plugin.js +8 -3
  32. package/schema.json +119 -61
  33. package/src/agent-prompt.ts +17 -22
  34. package/src/cq-message.ts +2 -2
  35. package/src/endpoint.ts +360 -602
  36. package/src/forward-msg.ts +12 -26
  37. package/src/icqq-agent-deps.ts +3 -17
  38. package/src/icqq-endpoint-commands.ts +6 -15
  39. package/src/icqq-guild.ts +16 -25
  40. package/src/icqq-inbound.ts +26 -26
  41. package/src/icqq-inbox.ts +2 -10
  42. package/src/icqq-runtime-state.ts +1 -1
  43. package/src/index.ts +2 -9
  44. package/src/outbound-media.ts +4 -9
  45. package/src/protocol.ts +61 -67
  46. package/src/types.ts +4 -41
  47. package/tools/announce.js +19 -0
  48. package/tools/announce.ts +18 -0
  49. package/tools/essence.js +24 -0
  50. package/{agent/tools → tools}/essence.ts +8 -8
  51. package/tools/friend_list.js +20 -0
  52. package/{agent/tools → tools}/friend_list.ts +7 -7
  53. package/tools/group_files.js +25 -0
  54. package/tools/group_files.ts +23 -0
  55. package/tools/group_invite.js +25 -0
  56. package/tools/group_invite.ts +22 -0
  57. package/tools/group_kick.js +28 -0
  58. package/tools/group_kick.ts +24 -0
  59. package/tools/group_list.js +21 -0
  60. package/{agent/tools → tools}/group_list.ts +7 -7
  61. package/tools/group_sign.js +21 -0
  62. package/tools/group_sign.ts +19 -0
  63. package/tools/list_muted.js +20 -0
  64. package/tools/list_muted.ts +19 -0
  65. package/tools/poke.js +19 -0
  66. package/tools/poke.ts +18 -0
  67. package/tools/send_user_like.js +28 -0
  68. package/tools/send_user_like.ts +25 -0
  69. package/tools/set_anonymous.js +23 -0
  70. package/tools/set_anonymous.ts +21 -0
  71. package/tools/set_mute.js +26 -0
  72. package/tools/set_mute.ts +23 -0
  73. package/tools/set_title.js +27 -0
  74. package/tools/set_title.ts +24 -0
  75. package/tools/user_info.js +17 -0
  76. package/tools/user_info.ts +16 -0
  77. package/agent/tools/announce.ts +0 -21
  78. package/agent/tools/group_files.ts +0 -27
  79. package/agent/tools/group_invite.ts +0 -20
  80. package/agent/tools/group_sign.ts +0 -19
  81. package/agent/tools/list_muted.ts +0 -22
  82. package/agent/tools/poke.ts +0 -20
  83. package/agent/tools/send_user_like.ts +0 -22
  84. package/agent/tools/set_anonymous.ts +0 -22
  85. package/agent/tools/set_title.ts +0 -25
  86. package/lib/ipc-client.d.ts +0 -73
  87. package/lib/ipc-client.js +0 -358
  88. 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
- /** CLI → Daemon 请求 */
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
- /** Guild 消息事件数据 */
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
- * 所有 IPC 操作常量 (from @icqqjs/cli)
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 rpc?: {
206
- readonly host?: string;
207
- readonly port?: number;
208
- readonly token?: string;
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 rpc?: {
217
- readonly host?: string;
218
- readonly port?: number;
219
- readonly token?: string;
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 rpc?: {
229
- readonly host: string;
230
- readonly port: number;
231
- readonly token: string;
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 派生 IPC action 路由。
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
- import { pickCredential } from '@zhin.js/adapter';
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
- * 所有 IPC 操作常量 (from @icqqjs/cli)
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 rpcRaw = config.rpc ?? entry?.rpc;
198
- const rpc = rpcRaw?.host && rpcRaw.port != null && rpcRaw.token
199
- ? { host: rpcRaw.host, port: Number(rpcRaw.port), token: rpcRaw.token }
200
- : undefined;
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
- ...(rpc ? { rpc } : {}),
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 派生 IPC action 路由。
237
+ * 出站:从 ConversationRef 派生 action 路由。
235
238
  * 群容器(parent kind 'group')内的 private 会话即 ICQQ 群临时会话(temp)。
236
239
  */
237
240
  export function icqqOutboundTarget(conversation) {
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
- /** IPC 返回的好友信息 */
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
- /** IPC 返回的群信息 */
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
- /** IPC 返回的群成员信息 */
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
@@ -1,6 +1 @@
1
- /**
2
- * ICQQ 适配器类型与配置
3
- *
4
- * 不再直接依赖 @icqqjs/icqq,通过 @icqqjs/cli 守护进程 IPC 通信。
5
- */
6
1
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-icqq",
3
- "version": "8.0.9",
4
- "description": "Zhin.js ICQQ adapter for Plugin Runtime (IPC daemon client)",
3
+ "version": "8.0.11",
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,28 @@
34
34
  "directory": "plugins/adapters/icqq"
35
35
  },
36
36
  "dependencies": {
37
- "@zhin.js/adapter": "1.1.8",
38
- "@zhin.js/command": "1.0.12",
39
- "@zhin.js/core": "1.5.8",
37
+ "@zhin.js/adapter": "1.1.10",
38
+ "@zhin.js/core": "1.5.10",
40
39
  "@zhin.js/im-contract": "1.0.3",
41
40
  "@zhin.js/logger": "1.0.76",
42
- "@zhin.js/plugin-runtime": "1.1.6"
41
+ "@zhin.js/permission": "1.0.2",
42
+ "@zhin.js/tool": "1.0.11"
43
43
  },
44
44
  "peerDependencies": {
45
+ "@icqqjs/icqq": "^1.12.2",
45
46
  "zod": "^4.0.0",
46
- "@zhin.js/adapter": "1.1.8",
47
- "@zhin.js/agent": "1.1.9",
48
- "@zhin.js/core": "1.5.8",
49
- "@zhin.js/plugin-runtime": "1.1.6",
50
- "zhin.js": "6.0.8"
47
+ "@zhin.js/adapter": "1.1.10",
48
+ "@zhin.js/agent": "1.1.11",
49
+ "@zhin.js/core": "1.5.10",
50
+ "zhin.js": "6.0.10"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "zhin.js": {
54
54
  "optional": true
55
55
  },
56
+ "@icqqjs/icqq": {
57
+ "optional": true
58
+ },
56
59
  "@zhin.js/agent": {
57
60
  "optional": true
58
61
  },
@@ -61,12 +64,13 @@
61
64
  }
62
65
  },
63
66
  "devDependencies": {
67
+ "@icqqjs/icqq": "^1.12.2",
64
68
  "@types/node": "^26.1.2",
65
69
  "typescript": "^6.0.3",
66
70
  "vitest": "^4.1.10",
67
71
  "zod": "^4.4.3",
68
- "@zhin.js/agent": "1.1.9",
69
- "zhin.js": "6.0.8"
72
+ "@zhin.js/agent": "1.1.11",
73
+ "zhin.js": "6.0.10"
70
74
  },
71
75
  "files": [
72
76
  "adapters",
@@ -76,6 +80,7 @@
76
80
  "src",
77
81
  "lib",
78
82
  "agent",
83
+ "tools",
79
84
  "README.md",
80
85
  "CHANGELOG.md"
81
86
  ],
@@ -100,6 +105,10 @@
100
105
  {
101
106
  "package": "@zhin.js/command",
102
107
  "api": "^1.0.0"
108
+ },
109
+ {
110
+ "package": "@zhin.js/tool",
111
+ "api": "^1.0.0"
103
112
  }
104
113
  ],
105
114
  "plugins": []
package/plugin.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Generated by build-plugin-runtime-entries.mjs. Do not edit.
2
- import { createEndpointRuntimeState } from '@zhin.js/adapter';
3
- import { definePlugin } from '@zhin.js/plugin-runtime';
2
+ import { createEndpointRuntimeState } from 'zhin.js/adapter';
3
+ import { definePlugin } from 'zhin.js';
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
  });
package/schema.json CHANGED
@@ -4,34 +4,75 @@
4
4
  "additionalProperties": false,
5
5
  "properties": {
6
6
  "master": {
7
- "type": [
8
- "string",
9
- "number"
10
- ],
7
+ "type": ["string", "number"],
11
8
  "description": "框架 master QQ uin(/approve、AI/工具权限);endpoints[i].master 可逐项覆盖"
12
9
  },
13
10
  "trusted": {
14
11
  "type": "array",
15
- "items": {
16
- "type": [
17
- "string",
18
- "number"
19
- ],
20
- "description": "Trusted QQ uin"
21
- },
12
+ "items": { "type": ["string", "number"] },
22
13
  "description": "框架 trusted QQ uin 列表(弱于 master)"
23
14
  },
15
+ "password": {
16
+ "type": "string",
17
+ "description": "QQ 密码(可选,不填则扫码登录)"
18
+ },
19
+ "platform": {
20
+ "type": "number",
21
+ "enum": [1, 2, 3, 4, 5, 6, 7],
22
+ "default": 1,
23
+ "description": "登录设备平台:1=Android, 2=aPad, 3=Watch, 4=iMac, 5=iPad, 6=Tim, 7=Custom"
24
+ },
25
+ "ver": {
26
+ "type": "string",
27
+ "description": "协议版本号,仅在对应 platform 有多个版本时有效,不填则使用最新版本"
28
+ },
29
+ "signApiAddr": {
30
+ "type": "string",
31
+ "description": "签名服务器地址;未配置时若安装了 @icqqjs/qqsign 则自动使用本地签名"
32
+ },
33
+ "dataDir": {
34
+ "type": "string",
35
+ "description": "数据存储文件夹路径,默认为主模块下的 data 文件夹"
36
+ },
24
37
  "autoReconnect": {
25
38
  "type": "boolean",
26
- "default": true
39
+ "default": true,
40
+ "description": "断线后是否自动重连(默认 true)"
27
41
  },
28
42
  "outboundMedia": {
29
43
  "type": "string",
30
- "enum": [
31
- "file",
32
- "base64"
33
- ],
34
- "description": "file=local path (same host as daemon); base64=CQ base64:// (default when rpc set)"
44
+ "enum": ["file", "base64"],
45
+ "default": "file",
46
+ "description": "出站媒体模式:file=落盘本地路径(默认); base64=CQ base64:// 内联"
47
+ },
48
+ "ignoreSelf": {
49
+ "type": "boolean",
50
+ "default": true,
51
+ "description": "群聊和频道中是否过滤自己的消息(默认 true)"
52
+ },
53
+ "resend": {
54
+ "type": "boolean",
55
+ "default": false,
56
+ "description": "被风控时是否尝试用分片发送(默认 false)"
57
+ },
58
+ "cacheGroupMember": {
59
+ "type": "boolean",
60
+ "default": true,
61
+ "description": "是否缓存群员列表(默认 true);群多时(500+)会多占约 100MB+ 内存"
62
+ },
63
+ "autoServer": {
64
+ "type": "boolean",
65
+ "default": true,
66
+ "description": "是否自动选择最优服务器(默认 true)"
67
+ },
68
+ "qqnt": {
69
+ "type": "boolean",
70
+ "default": true,
71
+ "description": "是否使用 QQNT 协议(默认 true)"
72
+ },
73
+ "ntLogin": {
74
+ "type": "boolean",
75
+ "description": "是否使用 NT 登录方式"
35
76
  },
36
77
  "endpoints": {
37
78
  "type": "array",
@@ -40,65 +81,82 @@
40
81
  "type": "object",
41
82
  "additionalProperties": true,
42
83
  "properties": {
84
+ "id": {
85
+ "type": "string",
86
+ "description": "QQ uin"
87
+ },
43
88
  "master": {
44
- "type": [
45
- "string",
46
- "number"
47
- ],
48
- "description": "本 endpoint 的框架 master QQ uin;覆盖顶层 master"
89
+ "type": ["string", "number"],
90
+ "description": "本 endpoint 的 master QQ uin;覆盖顶层 master"
49
91
  },
50
92
  "trusted": {
51
93
  "type": "array",
52
- "items": {
53
- "type": [
54
- "string",
55
- "number"
56
- ],
57
- "description": "Trusted QQ uin"
58
- },
94
+ "items": { "type": ["string", "number"] },
59
95
  "description": "本 endpoint 的 trusted 列表"
60
96
  },
61
- "rpc": {
62
- "type": "object",
63
- "additionalProperties": false,
64
- "properties": {
65
- "host": {
66
- "type": "string",
67
- "description": "RPC host"
68
- },
69
- "port": {
70
- "type": "number",
71
- "description": "RPC port"
72
- },
73
- "token": {
74
- "type": "string",
75
- "description": "RPC token"
76
- }
77
- },
78
- "required": [
79
- "host",
80
- "port",
81
- "token"
82
- ]
97
+ "password": {
98
+ "type": "string",
99
+ "description": "本 endpoint 的 QQ 密码"
100
+ },
101
+ "platform": {
102
+ "type": "number",
103
+ "enum": [1, 2, 3, 4, 5, 6, 7],
104
+ "description": "登录设备平台:1=Android, 2=aPad, 3=Watch, 4=iMac, 5=iPad, 6=Tim, 7=Custom"
83
105
  },
84
- "id": {
106
+ "ver": {
107
+ "type": "string",
108
+ "description": "协议版本号"
109
+ },
110
+ "signApiAddr": {
111
+ "type": "string",
112
+ "description": "签名服务器地址"
113
+ },
114
+ "dataDir": {
85
115
  "type": "string",
86
- "description": "QQ uin (must match icqq login account)"
116
+ "description": "数据存储文件夹路径"
117
+ },
118
+ "autoReconnect": {
119
+ "type": "boolean",
120
+ "description": "断线后是否自动重连"
121
+ },
122
+ "outboundMedia": {
123
+ "type": "string",
124
+ "enum": ["file", "base64"],
125
+ "description": "出站媒体模式"
126
+ },
127
+ "ignoreSelf": {
128
+ "type": "boolean",
129
+ "description": "是否过滤自己的消息"
130
+ },
131
+ "resend": {
132
+ "type": "boolean",
133
+ "description": "被风控时是否分片发送"
134
+ },
135
+ "cacheGroupMember": {
136
+ "type": "boolean",
137
+ "description": "是否缓存群员列表"
138
+ },
139
+ "autoServer": {
140
+ "type": "boolean",
141
+ "description": "是否自动选择最优服务器"
142
+ },
143
+ "qqnt": {
144
+ "type": "boolean",
145
+ "description": "是否使用 QQNT 协议"
146
+ },
147
+ "ntLogin": {
148
+ "type": "boolean",
149
+ "description": "是否使用 NT 登录方式"
87
150
  }
88
151
  },
89
- "required": [
90
- "id"
91
- ]
152
+ "required": ["id"]
92
153
  }
93
154
  },
94
155
  "commandPrefix": {
95
156
  "type": "string",
96
157
  "default": "",
97
- "description": "命令前缀(默认 '' 无前缀,任意文本按命令匹配;如 '/' 要求 / 开头)。endpoints[i] 可逐项覆盖"
158
+ "description": "命令前缀(默认 '' 无前缀)。endpoints[i] 可逐项覆盖"
98
159
  }
99
160
  },
100
- "required": [
101
- "master",
102
- "endpoints"
103
- ]
161
+ "required": ["master", "endpoints"]
104
162
  }