@zhin.js/adapter-icqq 2.0.22 → 2.0.24

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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @zhin.js/adapter-icqq
2
2
 
3
+ ## 2.0.24
4
+
5
+ ### Patch Changes
6
+
7
+ - dc04e4a: fix: skill 优化
8
+
9
+ ## 2.0.23
10
+
11
+ ### Patch Changes
12
+
13
+ - 92da96d: fix skill 激活优化
14
+ - zhin.js@1.0.79
15
+ - @zhin.js/console@2.0.22
16
+ - @zhin.js/http@1.0.72
17
+ - @zhin.js/core@1.1.21
18
+
3
19
  ## 2.0.22
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-icqq",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
4
4
  "description": "Zhin.js adapter for ICQQ (QQ Bot)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -51,16 +51,16 @@
51
51
  "lucide-react": "^1.14.0",
52
52
  "radix-ui": "^1.4.3",
53
53
  "typescript": "^6.0.3",
54
- "@zhin.js/cli": "1.0.74",
55
- "@zhin.js/console": "2.0.21",
56
- "zhin.js": "1.0.78"
54
+ "@zhin.js/cli": "1.0.75",
55
+ "@zhin.js/console": "2.0.22",
56
+ "zhin.js": "1.0.79"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@zhin.js/client": "1.0.18",
60
- "@zhin.js/console": "2.0.21",
61
- "@zhin.js/core": "1.1.20",
62
- "@zhin.js/http": "1.0.71",
63
- "zhin.js": "1.0.78"
60
+ "@zhin.js/console": "2.0.22",
61
+ "@zhin.js/core": "1.1.21",
62
+ "zhin.js": "1.0.79",
63
+ "@zhin.js/http": "1.0.72"
64
64
  },
65
65
  "peerDependenciesMeta": {
66
66
  "@zhin.js/client": {
@@ -1,5 +1,7 @@
1
1
  ---
2
2
  name: icqq
3
+ platforms:
4
+ - icqq
3
5
  description: 'Operate QQ account via icqq CLI. Use when asked to: send QQ message, manage QQ groups, check QQ friends, poke friend, like friend, mute member, kick member, set nickname, view QQ profile, handle friend/group requests, manage group files, set group announcement, QQ签到, 发消息, 管群, 好友操作, 群文件.'
4
6
  argument-hint: 'Describe what QQ operation to perform, e.g. "send hello to friend 12345" or "mute user 67890 in group 11111"'
5
7
  disable-model-invocation: true
@@ -13,7 +15,7 @@ Operate a QQ account through the `icqq` command-line tool. The daemon must be ru
13
15
 
14
16
  1. **Identify the module** — Match the user's intent to one of the modules below
15
17
  2. **Load the reference** — Read ONLY the relevant module reference file(s)
16
- 3. **Check daemon** — Run `icqq status` if unsure whether the account is online
18
+ 3. **Check daemon** — Use `icqq service status` for install/running state, then probe the account with `icqq profile` or `icqq friend list` to confirm IPC responds
17
19
  4. **Execute** — Run the command in terminal and report results
18
20
 
19
21
  ## Modules
@@ -28,7 +30,7 @@ Load the corresponding reference file based on what the user wants:
28
30
  | 设置:昵称、头像、签名、群名片、群头衔、加群方式、匿名 | Settings | [settings.md](./references/settings.md) |
29
31
  | 好友/群请求处理 | Requests | [requests.md](./references/requests.md) |
30
32
  | 群文件:目录管理、上传下载、转发 | Group Files | [gfs.md](./references/gfs.md) |
31
- | 登录、状态、配置、OCR、黑名单、Webhook、通知、UID转换、陌生人、漫游表情、缓存、重载、频道与子频道(Guild & Channel)、补全 | General | [general.md](./references/general.md) |
33
+ | 登录、服务/守护、配置、OCR、黑名单、Webhook、通知、UID转换、陌生人、漫游表情、缓存、重载、频道与子频道(Guild & Channel)、RPC 远程连接、补全 | General | [general.md](./references/general.md) |
32
34
 
33
35
  ## Global Notes
34
36
 
@@ -39,4 +41,3 @@ Load the corresponding reference file based on what the user wants:
39
41
  - CQ code syntax in messages: `[face:id]` `[image:path]` `[at:uid]` `[at:all]` `[dice]` `[rps]`
40
42
  - Quote strings with spaces: `icqq friend send 12345 "hello world"`
41
43
  - Chain batch ops with `&&`
42
- - **Agent / bash**:`icqq …` 多由 `bash` 执行;`execSecurity: allowlist` 下非敏感子命令通常直接放行,敏感操作与 Owner `approve rule` / `approve always bash` 等见框架文档 [docs/advanced/ai.md](../../../../../docs/advanced/ai.md)(`#icqq-bash-exec`、`#owner-approve-commands`)。
@@ -12,20 +12,20 @@ icqq friend avatar-url <uid> # Get avatar URL
12
12
 
13
13
  ```
14
14
  icqq friend send <uid> <message> # Send private message
15
- icqq friend poke <uid> # Poke a friend
16
- icqq friend like <uid> [-t times] # Like (1-20 times, default 1)
17
- icqq friend delete <uid> [-b] # Delete friend (-b: also block)
18
- icqq friend remark <uid> <remark> # Set friend remark/alias
19
- icqq friend add <uid> # Add friend (optionally via group)
15
+ icqq friend poke <uid> # Poke a friend
16
+ icqq friend like <uid> [-t times] # Like (1-20 times, default 1)
17
+ icqq friend delete <uid> [-b] # Delete friend (-b: also block)
18
+ icqq friend remark <uid> <remark> # Set friend remark/alias
19
+ icqq friend add <uid> # Add friend (optionally via group)
20
20
  ```
21
21
 
22
22
  ## Files
23
23
 
24
24
  ```
25
25
  icqq friend send-file <uid> <file> # Send file to friend
26
- icqq friend file-info <uid> <fid> # Get file info
27
- icqq friend file-url <uid> <fid> # Get file download URL
28
- icqq friend recall-file <uid> <fid> # Recall a sent file
26
+ icqq friend file-info <uid> <fid> # Get file info
27
+ icqq friend file-url <uid> <fid> # Get file download URL
28
+ icqq friend recall-file <uid> <fid> # Recall a sent file
29
29
  ```
30
30
 
31
31
  ## Friend Classes (Groups)
@@ -2,19 +2,38 @@
2
2
 
3
3
  ## Account
4
4
 
5
+ > Use **`icqq service status`** for service/daemon state, or **`icqq profile`** / **`icqq friend list`** to verify the daemon answers over IPC.
6
+
5
7
  ```
6
8
  icqq login # Login QQ and start daemon (interactive wizard)
7
9
  icqq login -r # Quick reconnect using saved token
8
10
  icqq login -q <uid> -r # Quick reconnect specific account
9
- icqq status # Check all daemon/account statuses
10
- icqq stop # Stop the daemon
11
- icqq stop <uin> # Stop specific daemon
11
+ icqq logout # Logout and stop daemon (token invalidated)
12
+ icqq logout -k # Disconnect only, keep token (login -r still works)
13
+ icqq logout <uin> # Logout specific account
12
14
  icqq switch # Switch current account (interactive)
13
15
  icqq switch <uin> # Switch to specific account
14
16
  icqq profile # View current account profile
15
17
  icqq requests # View pending friend/group requests
16
18
  ```
17
19
 
20
+ ## System Service (auto-restart on crash, start on boot)
21
+
22
+ ```
23
+ icqq service install # Register daemon as system service (launchd/systemd)
24
+ icqq service install -a # Install service for all configured accounts
25
+ icqq service uninstall # Remove system service
26
+ icqq service uninstall -a # Uninstall all
27
+ icqq service start # Start installed service
28
+ icqq service start -a # Start all
29
+ icqq service stop # Stop service (keeps service file, no restart until start)
30
+ icqq service stop -a # Stop all
31
+ icqq service status # Show service install/running state
32
+ icqq service status -a # Show status for all accounts
33
+ ```
34
+
35
+ Note: `icqq logout` does NOT prevent service auto-restart. To permanently stop, uninstall the service first.
36
+
18
37
  ## Config
19
38
 
20
39
  ```
@@ -79,9 +98,9 @@ icqq get video-url <vid> # Get video download URL
79
98
  ## Stranger
80
99
 
81
100
  ```
82
- icqq stranger view <uid> # View stranger profile
83
- icqq stranger status <uid> # Check online status
84
- icqq stranger add-setting <uid> # Check add-friend settings
101
+ icqq stranger view <uid> # View stranger profile
102
+ icqq stranger status <uid> # Check online status
103
+ icqq stranger add-setting <uid> # Check add-friend settings
85
104
  ```
86
105
 
87
106
  ## Roaming Emoji (Stamps)
@@ -122,10 +141,76 @@ icqq guild channel forum-url <guild_id> <channel_id> <forum_id> # Get forum URL
122
141
  icqq completion [shell] # Generate shell completion script (bash/zsh/fish)
123
142
  ```
124
143
 
144
+ ## RPC (TCP Remote Connection)
145
+
146
+ The daemon supports optional TCP remote access for cross-machine QQ account control.
147
+
148
+ ### Configuration
149
+
150
+ In `~/.icqq/config.json`:
151
+
152
+ ```json
153
+ {
154
+ "rpc": {
155
+ "enabled": true,
156
+ "host": "127.0.0.1",
157
+ "port": 0
158
+ }
159
+ }
160
+ ```
161
+
162
+ Or via CLI:
163
+
164
+ ```
165
+ icqq config set rpc.enabled true # Enable RPC TCP listener
166
+ icqq config set rpc.host 0.0.0.0 # Listen on all interfaces (for remote access)
167
+ icqq config set rpc.port 9100 # Set listen port (0 = auto-assign)
168
+ ```
169
+
170
+ | Field | Description | Default |
171
+ |-------|-------------|---------|
172
+ | `enabled` | Enable RPC TCP listener | `false` |
173
+ | `host` | Listen address, `"0.0.0.0"` for remote | `"127.0.0.1"` |
174
+ | `port` | Listen port, `0` = auto-assign | `0` |
175
+
176
+ ### Security
177
+
178
+ - **HMAC-SHA256 challenge-response auth** — token never transmitted over network
179
+ - **IP rate limiting** — 5 failures in 5 minutes → auto-block
180
+ - **Default localhost only** — must explicitly set `host: "0.0.0.0"` for remote access
181
+ - **4KB unauthenticated buffer limit** — prevents memory exhaustion
182
+
183
+ ### Programmatic Access
184
+
185
+ ```typescript
186
+ import { IpcClient } from "@icqqjs/cli/lib/ipc-client";
187
+
188
+ // Option 1: Specify host/port/token directly
189
+ const client = await IpcClient.connectRpc({
190
+ host: "192.168.1.100",
191
+ port: 9100,
192
+ token: "your-token-here",
193
+ });
194
+
195
+ // Option 2: Auto-read from daemon.rpc file (local only)
196
+ const client = await IpcClient.connectRpcByUin(12345);
197
+
198
+ const resp = await client.request("list_friends");
199
+ client.close();
200
+ ```
201
+
202
+ ### Auth Flow
203
+
204
+ 1. Client connects to TCP port
205
+ 2. Server sends `{ "challenge": "<random-hex>" }`
206
+ 3. Client computes `HMAC-SHA256(token, challenge)` → digest
207
+ 4. Client sends `{ "action": "auth", "params": { "digest": "<hex>" } }`
208
+ 5. Server verifies → authenticated
209
+
125
210
  ## Examples
126
211
 
127
212
  ```bash
128
- icqq status
213
+ icqq service status
129
214
  icqq profile
130
215
  icqq requests
131
216
  icqq login -r
@@ -3,7 +3,7 @@
3
3
  ## List Files
4
4
 
5
5
  ```
6
- icqq group fs list <gid> # List root directory
6
+ icqq group fs list <gid> # List root directory
7
7
  icqq group fs list <gid> -p <pid> # List subdirectory by parent ID
8
8
  ```
9
9
 
@@ -27,7 +27,7 @@ icqq group fs move <gid> <fid> <pid> # Move file to directory
27
27
 
28
28
  ```
29
29
  icqq group fs upload <gid> <file> # Upload file to group
30
- icqq group fs download <gid> <fid> # Get download URL
30
+ icqq group fs download <gid> <fid> # Get download URL
31
31
  icqq group fs forward <gid> <fid> <target_gid> # Forward file to another group
32
32
  icqq group fs forward-offline <gid> <fid> # Convert to offline file
33
33
  ```
@@ -35,9 +35,9 @@ icqq group screen-member <gid> <uid> # Block/unblock member messages
35
35
 
36
36
  ```
37
37
  icqq group send <gid> <message> # Send group message
38
- icqq group poke <gid> <uid> # Poke group member
39
- icqq group invite <gid> <uid> # Invite friend to group
40
- icqq group sign <gid> # Group check-in
38
+ icqq group poke <gid> <uid> # Poke group member
39
+ icqq group invite <gid> <uid> # Invite friend to group
40
+ icqq group sign <gid> # Group check-in
41
41
  ```
42
42
 
43
43
  ## Reactions
@@ -22,7 +22,7 @@ Messages support inline CQ codes for rich content:
22
22
  [rps] # Rock-paper-scissors
23
23
  ```
24
24
 
25
- Mixed example: `icqq group send 67890 "你好[face:178]看看[image:/tmp/pic.jpg]"`
25
+ Mixed example: `icqq send group 67890 "你好[face:178]看看[image:/tmp/pic.jpg]"`
26
26
 
27
27
  ## Recall
28
28
 
@@ -52,8 +52,6 @@ icqq friend chat <uid> # Enter private chat mode
52
52
  icqq group chat <gid> # Enter group chat mode
53
53
  ```
54
54
 
55
- > **Do NOT use interactive chat commands for agent operations.** Use `icqq friend send` / `icqq group send` instead.
56
-
57
55
  ## Examples
58
56
 
59
57
  ```bash