chatccc 0.2.63 → 0.2.65
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/config.sample.json +2 -3
- package/im-skills/feishu-skill/download-video.mjs +10 -17
- package/im-skills/wechat-file-skill/receive-send-file.md +39 -42
- package/im-skills/wechat-file-skill/send-file.mjs +84 -101
- package/im-skills/wechat-file-skill/skill.md +11 -11
- package/im-skills/wechat-image-skill/receive-send-image.md +5 -5
- package/im-skills/wechat-image-skill/send-image.mjs +2 -6
- package/im-skills/wechat-image-skill/skill.md +4 -4
- package/im-skills/wechat-video-skill/receive-send-video.md +39 -41
- package/im-skills/wechat-video-skill/send-video.mjs +80 -84
- package/im-skills/wechat-video-skill/skill.md +11 -11
- package/package.json +59 -59
- package/src/__tests__/agent-platform-routing.test.ts +26 -0
- package/src/__tests__/claude-adapter.test.ts +48 -48
- package/src/__tests__/config-reload.test.ts +14 -14
- package/src/__tests__/config-sample.test.ts +22 -22
- package/src/__tests__/im-skills.test.ts +49 -50
- package/src/__tests__/orchestrator.test.ts +1 -1
- package/src/__tests__/privacy.test.ts +142 -142
- package/src/__tests__/simplify.test.ts +282 -282
- package/src/__tests__/web-ui.test.ts +23 -23
- package/src/__tests__/wechat-platform.test.ts +0 -65
- package/src/adapters/claude-adapter.ts +40 -40
- package/src/agent-file-rpc.ts +19 -4
- package/src/agent-image-rpc.ts +19 -4
- package/src/agent-platform-routing.ts +28 -0
- package/src/config.ts +2 -24
- package/src/im-skills.ts +9 -0
- package/src/index.ts +11 -6
- package/src/orchestrator.ts +3 -4
- package/src/privacy.ts +67 -67
- package/src/session.ts +15 -3
- package/src/simplify.ts +119 -119
- package/src/web-ui.ts +3 -26
- package/src/wechat-platform.ts +68 -151
package/config.sample.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"feishu": {
|
|
3
3
|
"appId": "",
|
|
4
|
-
"appSecret": ""
|
|
5
|
-
"domain": "feishu"
|
|
4
|
+
"appSecret": ""
|
|
6
5
|
},
|
|
7
6
|
"platforms": {
|
|
8
7
|
"feishu": { "enabled": true },
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
"claude": {
|
|
15
14
|
"enabled": false,
|
|
16
15
|
"defaultAgent": true,
|
|
17
|
-
"model": "
|
|
16
|
+
"model": "",
|
|
18
17
|
"subagentModel": "",
|
|
19
18
|
"effort": "",
|
|
20
19
|
"apiKey": "",
|
|
@@ -30,12 +30,6 @@ function walkUpForConfig(startDir) {
|
|
|
30
30
|
return result;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function getBaseUrl(domain) {
|
|
34
|
-
return domain === "lark"
|
|
35
|
-
? "https://open.larksuite.com/open-apis"
|
|
36
|
-
: "https://open.feishu.cn/open-apis";
|
|
37
|
-
}
|
|
38
|
-
|
|
39
33
|
async function findConfig() {
|
|
40
34
|
const paths = [
|
|
41
35
|
join(homedir(), ".chatccc", "config.json"),
|
|
@@ -50,7 +44,7 @@ async function findConfig() {
|
|
|
50
44
|
const appSecret = cfg.feishu?.appSecret || "";
|
|
51
45
|
if (appId && appSecret) {
|
|
52
46
|
console.error(`Using config: ${path}`);
|
|
53
|
-
return { appId, appSecret
|
|
47
|
+
return { appId, appSecret };
|
|
54
48
|
}
|
|
55
49
|
} catch {
|
|
56
50
|
// Try the next candidate.
|
|
@@ -59,8 +53,8 @@ async function findConfig() {
|
|
|
59
53
|
throw new Error(`Could not find Feishu config. Tried: ${paths.slice(0, 3).join(", ")}...`);
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
async function getTenantAccessToken(appId, appSecret
|
|
63
|
-
const response = await fetch(
|
|
56
|
+
async function getTenantAccessToken(appId, appSecret) {
|
|
57
|
+
const response = await fetch("https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal", {
|
|
64
58
|
method: "POST",
|
|
65
59
|
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
66
60
|
body: Buffer.from(JSON.stringify({ app_id: appId, app_secret: appSecret }), "utf8"),
|
|
@@ -72,10 +66,10 @@ async function getTenantAccessToken(appId, appSecret, baseUrl) {
|
|
|
72
66
|
return data.tenant_access_token;
|
|
73
67
|
}
|
|
74
68
|
|
|
75
|
-
async function findMessageId(token,
|
|
69
|
+
async function findMessageId(token, chatId, fileKey) {
|
|
76
70
|
let pageToken = "";
|
|
77
71
|
for (let page = 0; page < 10; page++) {
|
|
78
|
-
const url = new URL(
|
|
72
|
+
const url = new URL("https://open.feishu.cn/open-apis/im/v1/messages");
|
|
79
73
|
url.searchParams.set("receive_id_type", "chat_id");
|
|
80
74
|
url.searchParams.set("receive_id", chatId);
|
|
81
75
|
url.searchParams.set("page_size", "50");
|
|
@@ -107,8 +101,8 @@ function safeFileName(name) {
|
|
|
107
101
|
return (name || "download.bin").replace(/[\\/:*?"<>|]/g, "_");
|
|
108
102
|
}
|
|
109
103
|
|
|
110
|
-
async function downloadResource(token,
|
|
111
|
-
const url =
|
|
104
|
+
async function downloadResource(token, messageId, fileKey, fileName) {
|
|
105
|
+
const url = `https://open.feishu.cn/open-apis/im/v1/messages/${encodeURIComponent(messageId)}/resources/${encodeURIComponent(fileKey)}?type=file`;
|
|
112
106
|
console.error(`Downloading: ${url}`);
|
|
113
107
|
|
|
114
108
|
const response = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });
|
|
@@ -137,12 +131,12 @@ async function main() {
|
|
|
137
131
|
process.exit(1);
|
|
138
132
|
}
|
|
139
133
|
|
|
140
|
-
const { appId, appSecret
|
|
141
|
-
const token = await getTenantAccessToken(appId, appSecret
|
|
134
|
+
const { appId, appSecret } = await findConfig();
|
|
135
|
+
const token = await getTenantAccessToken(appId, appSecret);
|
|
142
136
|
|
|
143
137
|
let messageId = args["message-id"] || "";
|
|
144
138
|
if (!messageId && args["chat-id"]) {
|
|
145
|
-
messageId = await findMessageId(token,
|
|
139
|
+
messageId = await findMessageId(token, args["chat-id"], args["file-key"]);
|
|
146
140
|
if (!messageId) {
|
|
147
141
|
throw new Error(`No message found for file_key=${args["file-key"]}`);
|
|
148
142
|
}
|
|
@@ -155,7 +149,6 @@ async function main() {
|
|
|
155
149
|
|
|
156
150
|
const localPath = await downloadResource(
|
|
157
151
|
token,
|
|
158
|
-
baseUrl,
|
|
159
152
|
messageId,
|
|
160
153
|
args["file-key"],
|
|
161
154
|
args.name || "download.bin",
|
|
@@ -1,42 +1,39 @@
|
|
|
1
|
-
# Receiving & Sending Files (WeChat)
|
|
2
|
-
|
|
3
|
-
## Receive Files
|
|
4
|
-
|
|
5
|
-
Files sent to the bot are automatically downloaded to `~/.chatccc/
|
|
6
|
-
|
|
7
|
-
The message text you receive will include the downloaded path in the format:
|
|
8
|
-
```
|
|
9
|
-
[文件] C:\Users
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
You can read the file at that path to
|
|
13
|
-
|
|
14
|
-
## Send Files
|
|
15
|
-
|
|
16
|
-
### Script (recommended)
|
|
17
|
-
```bash
|
|
18
|
-
node "{{wechat_send_file_script}}" --path "<absolute file path>" --caption "<optional caption>"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The script reads the current WeChat session's auth token, chat ID, and context token from `~/.chatccc/state/ilink-auth.json`, then sends the file to the most recent chat.
|
|
22
|
-
|
|
23
|
-
### Direct usage in test scripts
|
|
24
|
-
|
|
25
|
-
The underlying SDK call is:
|
|
26
|
-
```ts
|
|
27
|
-
import { Client as OpenIlinkWire } from "@openilink/openilink-sdk-node";
|
|
28
|
-
const wire = new OpenIlinkWire(token, { base_url: baseUrl });
|
|
29
|
-
await wire.sendMediaFile(chatId, contextToken, fileBuffer, "
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
- Use the dedicated image or video skill for images and videos.
|
|
41
|
-
- Only send a file when the user asked for one or when it materially helps the answer.
|
|
42
|
-
- File sending counts as an outgoing WeChat message. Avoid repeated unsolicited sends.
|
|
1
|
+
# Receiving & Sending Files (WeChat)
|
|
2
|
+
|
|
3
|
+
## Receive Files
|
|
4
|
+
|
|
5
|
+
Files sent to the bot are **automatically downloaded** to `~/.chatccc/images/downloads/` with the `wx_` filename prefix.
|
|
6
|
+
|
|
7
|
+
The message text you receive will include the downloaded path in the format:
|
|
8
|
+
```
|
|
9
|
+
[文件] C:\Users\<用户名>\.chatccc\images\downloads\wx_<key>_<filename>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
You can read the file at that path to understand what the user sent.
|
|
13
|
+
|
|
14
|
+
## Send Files
|
|
15
|
+
|
|
16
|
+
### Script (recommended)
|
|
17
|
+
```bash
|
|
18
|
+
node "{{wechat_send_file_script}}" --path "<absolute file path>" --caption "<optional caption>"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The script reads the current WeChat session's auth token, chat ID, and context token from `~/.chatccc/state/ilink-auth.json`, then sends the file to the most recent chat.
|
|
22
|
+
|
|
23
|
+
### Direct usage in test scripts
|
|
24
|
+
|
|
25
|
+
The underlying SDK call is:
|
|
26
|
+
```ts
|
|
27
|
+
import { Client as OpenIlinkWire } from "@openilink/openilink-sdk-node";
|
|
28
|
+
const wire = new OpenIlinkWire(token, { base_url: baseUrl });
|
|
29
|
+
await wire.sendMediaFile(chatId, contextToken, fileBuffer, "filename.pdf", "caption");
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Rules
|
|
33
|
+
|
|
34
|
+
- Save or choose a local file first.
|
|
35
|
+
- Use an absolute local path.
|
|
36
|
+
- Supported formats: .pdf, .doc, .docx, .xls, .xlsx, .csv, .ppt, .pptx, .txt, .zip, .tar, .gz, .rar, .7z, .mp3, .wav, .ogg, .aac, .m4a.
|
|
37
|
+
- Max file size: 100MB.
|
|
38
|
+
- Only send a file when the user asked for one or when it materially helps the answer.
|
|
39
|
+
- **Claw 限制**: 文件发送也计入微信 claw 连发计数,连续 10 条未回复会截断。
|
|
@@ -1,101 +1,84 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
-
import { basename, extname,
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
|
-
|
|
6
|
-
import { Client as OpenIlinkWire } from "@openilink/openilink-sdk-node";
|
|
7
|
-
|
|
8
|
-
const ILINK_AUTH_PATH = join(homedir(), ".chatccc", "state", "ilink-auth.json");
|
|
9
|
-
const MAX_FILE_BYTES =
|
|
10
|
-
const ALLOWED_EXTS = new Set([
|
|
11
|
-
".
|
|
12
|
-
".
|
|
13
|
-
".
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const fileData = readFileSync(filePath);
|
|
88
|
-
const fileName = basename(filePath);
|
|
89
|
-
|
|
90
|
-
const wire = new OpenIlinkWire(snap.token, {
|
|
91
|
-
base_url: snap.baseUrl,
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
await wire.sendMediaFile(snap.lastChatId, snap.contextToken, fileData, fileName, caption);
|
|
95
|
-
console.log(JSON.stringify({ ok: true, sentTo: 1 }));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
main().catch((err) => {
|
|
99
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
100
|
-
process.exit(1);
|
|
101
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { basename, extname, join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
|
|
6
|
+
import { Client as OpenIlinkWire } from "@openilink/openilink-sdk-node";
|
|
7
|
+
|
|
8
|
+
const ILINK_AUTH_PATH = join(homedir(), ".chatccc", "state", "ilink-auth.json");
|
|
9
|
+
const MAX_FILE_BYTES = 100 * 1024 * 1024;
|
|
10
|
+
const ALLOWED_EXTS = new Set([
|
|
11
|
+
".pdf", ".doc", ".docx", ".xls", ".xlsx", ".csv", ".ppt", ".pptx",
|
|
12
|
+
".txt", ".zip", ".tar", ".gz", ".rar", ".7z",
|
|
13
|
+
".mp3", ".wav", ".ogg", ".aac", ".m4a",
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
function parseArgs(argv) {
|
|
17
|
+
const result = {};
|
|
18
|
+
for (let i = 0; i < argv.length; i++) {
|
|
19
|
+
const key = argv[i];
|
|
20
|
+
if (!key.startsWith("--")) continue;
|
|
21
|
+
const value = argv[i + 1] && !argv[i + 1].startsWith("--") ? argv[++i] : "true";
|
|
22
|
+
result[key.slice(2)] = value;
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function usage() {
|
|
28
|
+
console.error(`Usage:
|
|
29
|
+
node ${basename(process.argv[1])} --path <absolute file path> [--caption <text>]`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function main() {
|
|
33
|
+
const args = parseArgs(process.argv.slice(2));
|
|
34
|
+
const filePath = args.path;
|
|
35
|
+
const caption = args.caption || "";
|
|
36
|
+
|
|
37
|
+
if (!filePath) {
|
|
38
|
+
usage();
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const ext = extname(filePath).toLowerCase();
|
|
43
|
+
if (!ALLOWED_EXTS.has(ext)) {
|
|
44
|
+
console.error(`Unsupported file extension: ${ext || "(none)"}`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const st = statSync(filePath);
|
|
49
|
+
if (!st.isFile()) {
|
|
50
|
+
console.error("File path is not a file");
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
if (st.size > MAX_FILE_BYTES) {
|
|
54
|
+
console.error("File exceeds 100MB limit");
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!existsSync(ILINK_AUTH_PATH)) {
|
|
59
|
+
console.error(`Auth snapshot not found: ${ILINK_AUTH_PATH}`);
|
|
60
|
+
console.error("Make sure the WeChat iLink platform is logged in.");
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const snap = JSON.parse(readFileSync(ILINK_AUTH_PATH, "utf8"));
|
|
65
|
+
if (!snap.token || !snap.lastChatId || !snap.contextToken) {
|
|
66
|
+
console.error("Auth snapshot missing token, lastChatId, or contextToken.");
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const fileData = readFileSync(filePath);
|
|
71
|
+
const fileName = basename(filePath);
|
|
72
|
+
|
|
73
|
+
const wire = new OpenIlinkWire(snap.token, {
|
|
74
|
+
base_url: snap.baseUrl,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
await wire.sendMediaFile(snap.lastChatId, snap.contextToken, fileData, fileName, caption);
|
|
78
|
+
console.log(JSON.stringify({ ok: true, sentTo: 1 }));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
main().catch((err) => {
|
|
82
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
83
|
+
process.exit(1);
|
|
84
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: wechat-file-skill
|
|
3
|
-
description: WeChat iLink local
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Current working directory: {{cwd}}
|
|
7
|
-
|
|
8
|
-
WeChat files are handled through the iLink SDK. The local server does NOT have HTTP RPC endpoints for WeChat; use the helper
|
|
9
|
-
|
|
10
|
-
- **Receive files**: Files sent to the bot are automatically downloaded to `~/.chatccc/
|
|
11
|
-
- **Send files**: Use the send-file helper script — read `{{im_skills_cache_dir}}/wechat-file-skill/receive-send-file.md`
|
|
1
|
+
---
|
|
2
|
+
name: wechat-file-skill
|
|
3
|
+
description: WeChat iLink local skills for sending and receiving files.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Current working directory: {{cwd}}
|
|
7
|
+
|
|
8
|
+
WeChat files are handled through the iLink SDK. The local server does NOT have HTTP RPC endpoints for WeChat; use the helper scripts below instead.
|
|
9
|
+
|
|
10
|
+
- **Receive files**: Files sent to the bot are automatically downloaded to `~/.chatccc/images/downloads/` with the filename prefix `wx_`. The message text will include the local path as `[文件] <absolute path>` — read `{{im_skills_cache_dir}}/wechat-file-skill/receive-send-file.md`
|
|
11
|
+
- **Send files**: Use the send-file helper script — read `{{im_skills_cache_dir}}/wechat-file-skill/receive-send-file.md`
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Receive Images
|
|
4
4
|
|
|
5
|
-
Images sent to the bot are automatically downloaded to `~/.chatccc/images/downloads/` with the `wx_` filename prefix.
|
|
5
|
+
Images sent to the bot are **automatically downloaded** to `~/.chatccc/images/downloads/` with the `wx_` filename prefix.
|
|
6
6
|
|
|
7
7
|
The message text you receive will include the downloaded path in the format:
|
|
8
|
-
```
|
|
9
|
-
[图片] C:\Users
|
|
8
|
+
```
|
|
9
|
+
[图片] C:\Users\<用户名>\.chatccc\images\downloads\wx_<key>.png
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
You can read the image file at that path to understand what the user sent.
|
|
@@ -34,6 +34,6 @@ await wire.sendMediaFile(chatId, contextToken, imageBuffer, "filename.png", "cap
|
|
|
34
34
|
- Save or choose a local image file first.
|
|
35
35
|
- Use an absolute local path.
|
|
36
36
|
- Supported formats: .png, .jpg, .jpeg, .webp, .gif, .bmp.
|
|
37
|
-
- Max image size: 10MB.
|
|
37
|
+
- Max image size: 10MB (SDK guideline; larger files upload slower).
|
|
38
38
|
- Only send an image when the user asked for one or when it materially helps the answer.
|
|
39
|
-
-
|
|
39
|
+
- **Claw 限制**: 图片发送也计入微信 claw 连发计数,连续 10 条未回复会截断。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
-
import { basename, extname,
|
|
3
|
+
import { basename, extname, join } from "node:path";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
|
|
6
6
|
import { Client as OpenIlinkWire } from "@openilink/openilink-sdk-node";
|
|
@@ -34,10 +34,6 @@ async function main() {
|
|
|
34
34
|
usage();
|
|
35
35
|
process.exit(1);
|
|
36
36
|
}
|
|
37
|
-
if (!isAbsolute(imagePath)) {
|
|
38
|
-
console.error("Image path must be absolute.");
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
37
|
|
|
42
38
|
const ext = extname(imagePath).toLowerCase();
|
|
43
39
|
if (!ALLOWED_EXTS.has(ext)) {
|
|
@@ -81,4 +77,4 @@ async function main() {
|
|
|
81
77
|
main().catch((err) => {
|
|
82
78
|
console.error(err instanceof Error ? err.message : String(err));
|
|
83
79
|
process.exit(1);
|
|
84
|
-
});
|
|
80
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wechat-image-skill
|
|
3
|
-
description: WeChat iLink local
|
|
3
|
+
description: WeChat iLink local skills for sending and receiving images.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Current working directory: {{cwd}}
|
|
7
7
|
|
|
8
|
-
WeChat images are handled through the iLink SDK. The local server does NOT have HTTP RPC endpoints for WeChat; use the helper
|
|
8
|
+
WeChat images are handled through the iLink SDK. The local server does NOT have HTTP RPC endpoints for WeChat; use the helper scripts below instead.
|
|
9
9
|
|
|
10
|
-
- **Receive images**: Images sent to the bot are automatically downloaded to `~/.chatccc/images/downloads/` with the filename prefix `wx_`. The message text will include the local path as `[图片] <absolute path
|
|
11
|
-
- **Send images**: Use the send-image helper script — read `{{im_skills_cache_dir}}/wechat-image-skill/receive-send-image.md`
|
|
10
|
+
- **Receive images**: Images sent to the bot are automatically downloaded to `~/.chatccc/images/downloads/` with the filename prefix `wx_`. The message text will include the local path as `[图片] <absolute path>` — read `{{im_skills_cache_dir}}/wechat-image-skill/receive-send-image.md`
|
|
11
|
+
- **Send images**: Use the send-image helper script — read `{{im_skills_cache_dir}}/wechat-image-skill/receive-send-image.md`
|
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
# Receiving & Sending Videos (WeChat)
|
|
2
|
-
|
|
3
|
-
## Receive Videos
|
|
4
|
-
|
|
5
|
-
Videos sent to the bot are automatically downloaded to `~/.chatccc/
|
|
6
|
-
|
|
7
|
-
The message text you receive will include the downloaded path in the format:
|
|
8
|
-
```
|
|
9
|
-
[视频] C:\Users
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
You can read the video file at that path to
|
|
13
|
-
|
|
14
|
-
## Send Videos
|
|
15
|
-
|
|
16
|
-
### Script (recommended)
|
|
17
|
-
```bash
|
|
18
|
-
node "{{wechat_send_video_script}}" --path "<absolute video path>" --caption "<optional caption>"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The script reads the current WeChat session's auth token, chat ID, and context token from `~/.chatccc/state/ilink-auth.json`, then sends the video to the most recent chat.
|
|
22
|
-
|
|
23
|
-
### Direct usage in test scripts
|
|
24
|
-
|
|
25
|
-
The underlying SDK call is:
|
|
26
|
-
```ts
|
|
27
|
-
import { Client as OpenIlinkWire } from "@openilink/openilink-sdk-node";
|
|
28
|
-
const wire = new OpenIlinkWire(token, { base_url: baseUrl });
|
|
29
|
-
await wire.sendMediaFile(chatId, contextToken, videoBuffer, "
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
- Only send a video when the user asked for one or when it materially helps the answer.
|
|
41
|
-
- Video sending counts as an outgoing WeChat message. Avoid repeated unsolicited sends.
|
|
1
|
+
# Receiving & Sending Videos (WeChat)
|
|
2
|
+
|
|
3
|
+
## Receive Videos
|
|
4
|
+
|
|
5
|
+
Videos sent to the bot are **automatically downloaded** to `~/.chatccc/images/downloads/` with the `wx_` filename prefix.
|
|
6
|
+
|
|
7
|
+
The message text you receive will include the downloaded path in the format:
|
|
8
|
+
```
|
|
9
|
+
[视频] C:\Users\<用户名>\.chatccc\images\downloads\wx_<key>.mp4
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
You can read the video file at that path to understand what the user sent.
|
|
13
|
+
|
|
14
|
+
## Send Videos
|
|
15
|
+
|
|
16
|
+
### Script (recommended)
|
|
17
|
+
```bash
|
|
18
|
+
node "{{wechat_send_video_script}}" --path "<absolute video path>" --caption "<optional caption>"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The script reads the current WeChat session's auth token, chat ID, and context token from `~/.chatccc/state/ilink-auth.json`, then sends the video to the most recent chat.
|
|
22
|
+
|
|
23
|
+
### Direct usage in test scripts
|
|
24
|
+
|
|
25
|
+
The underlying SDK call is:
|
|
26
|
+
```ts
|
|
27
|
+
import { Client as OpenIlinkWire } from "@openilink/openilink-sdk-node";
|
|
28
|
+
const wire = new OpenIlinkWire(token, { base_url: baseUrl });
|
|
29
|
+
await wire.sendMediaFile(chatId, contextToken, videoBuffer, "video.mp4", "caption");
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Rules
|
|
33
|
+
|
|
34
|
+
- Save or choose a local video file first.
|
|
35
|
+
- Use an absolute local path.
|
|
36
|
+
- Supported formats: .mp4, .mov, .avi, .mkv, .webm, .flv.
|
|
37
|
+
- Max video size: 100MB.
|
|
38
|
+
- Only send a video when the user asked for one or when it materially helps the answer.
|
|
39
|
+
- **Claw 限制**: 视频发送也计入微信 claw 连发计数,连续 10 条未回复会截断。
|