chatccc 0.2.300 → 0.2.301
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/.agents/skills/create-chatccc-feishu-app/SKILL.md +85 -85
- package/.claude/skills/create-chatccc-feishu-app/SKILL.md +85 -85
- package/.cursor/skills/create-chatccc-feishu-app/SKILL.md +85 -85
- package/README.md +6 -2
- package/agent-prompts/claude_specific.md +45 -45
- package/agent-prompts/codex_specific.md +2 -2
- package/agent-prompts/cursor_specific.md +13 -13
- package/bin/cccagent.mjs +26 -26
- package/bin/chatccc.mjs +15 -15
- package/config.sample.json +7 -6
- package/deepccc-agent/README.md +21 -4
- package/deepccc-agent/os-prompts/darwin.md +8 -8
- package/deepccc-agent/os-prompts/linux.md +8 -8
- package/deepccc-agent/os-prompts/win32.md +11 -11
- package/deepccc-agent/package.json +68 -68
- package/dist/deepccc-agent/src/attachments.js +7 -5
- package/dist/deepccc-agent/src/cli.js +52 -7
- package/dist/deepccc-agent/src/completion-session.js +100 -0
- package/dist/deepccc-agent/src/config.js +4 -0
- package/dist/deepccc-agent/src/context.js +4 -1
- package/dist/deepccc-agent/src/decision-session.js +314 -0
- package/dist/deepccc-agent/src/file-tools.js +5 -0
- package/dist/deepccc-agent/src/index.js +41 -4
- package/dist/deepccc-agent/src/json-mode-fetch.js +12 -0
- package/dist/deepccc-agent/src/json-response.js +33 -0
- package/dist/deepccc-agent/src/multimodal.js +291 -0
- package/dist/deepccc-agent/src/progress/reducer.js +2 -0
- package/dist/deepccc-agent/src/web-page.js +411 -411
- package/dist/deepccc-agent/src/web-runtime.js +3 -0
- package/dist/deepccc-agent/src/web-server.js +2 -0
- package/dist/src/adapters/ccc-adapter.js +4 -0
- package/dist/src/agent-team/web/agent-team-page.js +250 -250
- package/dist/src/config.js +2 -0
- package/dist/src/engines/engine-specs.js +71 -71
- package/dist/src/feishu-api.js +11 -11
- package/dist/src/litellm-proxy.js +15 -15
- package/dist/src/progress/reducer.js +2 -0
- package/dist/src/session.js +1 -0
- package/dist/src/web-ui.js +80 -66
- package/im-skills/feishu-skill/receive-send-file.md +65 -65
- package/im-skills/feishu-skill/receive-send-image.md +26 -26
- package/im-skills/feishu-skill/send-file.mjs +6 -6
- package/im-skills/feishu-skill/send-image.mjs +6 -6
- package/im-skills/feishu-skill/skill.md +28 -28
- package/im-skills/wechat-file-skill/receive-send-file.md +38 -38
- package/im-skills/wechat-file-skill/send-file.mjs +83 -83
- package/im-skills/wechat-file-skill/skill.md +10 -10
- package/im-skills/wechat-image-skill/skill.md +10 -10
- package/im-skills/wechat-video-skill/receive-send-video.md +38 -38
- package/im-skills/wechat-video-skill/send-video.mjs +79 -79
- package/im-skills/wechat-video-skill/skill.md +10 -10
- package/package.json +77 -77
- package/scripts/postinstall-sharp-check.mjs +58 -58
- package/scripts/self-update-helper.mjs +301 -301
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
# Sending & Downloading Files/Videos
|
|
2
|
-
|
|
3
|
-
## Send Files or Videos
|
|
4
|
-
|
|
5
|
-
Videos are sent as regular files (not media), which looks cleaner in Feishu.
|
|
6
|
-
|
|
7
|
-
**Use the node script below. Do NOT use curl or raw HTTP — the script correctly handles errors and exits non-zero on failure.**
|
|
8
|
-
|
|
9
|
-
### Script
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
node "{{send_file_script}}" --url "{{send_file_url}}" --session-id "{{session_id}}" --grant "{{agent_capability_grant}}" --path "<absolute file path>" --caption "<optional caption>"
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Rules
|
|
16
|
-
|
|
17
|
-
- Use the node script above — never curl or raw HTTP.
|
|
18
|
-
- Save or choose a local file first.
|
|
19
|
-
- Use an absolute local path.
|
|
20
|
-
- Use only the session ID and capability grant shown above; they are a bound pair.
|
|
21
|
-
- Max file size: 30MB.
|
|
22
|
-
- Supported formats: .mp4 .mov .avi .mkv .webm .flv .mp3 .wav .ogg .aac .m4a .pdf .doc .docx .xls .xlsx .csv .ppt .pptx .txt .zip .tar .gz.
|
|
23
|
-
- Only send a file/video when the user asked for one or when it materially helps the answer.
|
|
24
|
-
- **If the script fails (non-zero exit), read stderr for the error. Do NOT retry with the same path. Either fix the problem (wrong extension, missing file, etc.) or tell the user what the error was. Never retry more than once.**
|
|
25
|
-
|
|
26
|
-
### Video Compression (when file > 30MB)
|
|
27
|
-
|
|
28
|
-
If the video exceeds 30MB, compress it with ffmpeg before sending.
|
|
29
|
-
|
|
30
|
-
**Ensure ffmpeg is available** (install if missing):
|
|
31
|
-
|
|
32
|
-
| OS | Install command |
|
|
33
|
-
|----|----------------|
|
|
34
|
-
| macOS | `brew install ffmpeg` |
|
|
35
|
-
| Linux (Debian/Ubuntu) | `sudo apt install ffmpeg` |
|
|
36
|
-
| Linux (RHEL/Fedora) | `sudo dnf install ffmpeg` |
|
|
37
|
-
| Windows | `winget install Gyan.FFmpeg` |
|
|
38
|
-
|
|
39
|
-
**Two-pass compression** (target ~28MB for 30s video, adjust `b:v` for other durations):
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
ffmpeg -y -i "<input>" -c:v libx264 -b:v <bitrate>k -pass 1 -f mp4 NUL
|
|
43
|
-
ffmpeg -y -i "<input>" -c:v libx264 -b:v <bitrate>k -pass 2 -c:a aac -b:a 128k "<output>"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Bitrate formula: `bitrate = 28 × 8 × 1000 ÷ duration_seconds - 128` (target ~28MB, safe under 30MB).
|
|
47
|
-
On Windows replace `NUL` with `NUL` (same); on Linux/macOS use `/dev/null`.
|
|
48
|
-
|
|
49
|
-
If the compressed file still exceeds 30MB, explain to the user that automatic compression wasn't enough and suggest they manually trim or re-encode the source.
|
|
50
|
-
|
|
51
|
-
## Download Files or Videos
|
|
52
|
-
|
|
53
|
-
When the user sends a file or video to the bot, the message contains `message_id` and `file_key`. Download it with:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
node "{{download_video_script}}" --message-id <message_id> --file-key <file_key> --name <file_name>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
If only `chat_id` and `file_key` are available:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
node "{{download_video_script}}" --chat-id <chat_id> --file-key <file_key> --name <file_name>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Downloads are saved under `~/.chatccc/videos/downloads/`.
|
|
1
|
+
# Sending & Downloading Files/Videos
|
|
2
|
+
|
|
3
|
+
## Send Files or Videos
|
|
4
|
+
|
|
5
|
+
Videos are sent as regular files (not media), which looks cleaner in Feishu.
|
|
6
|
+
|
|
7
|
+
**Use the node script below. Do NOT use curl or raw HTTP — the script correctly handles errors and exits non-zero on failure.**
|
|
8
|
+
|
|
9
|
+
### Script
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
node "{{send_file_script}}" --url "{{send_file_url}}" --session-id "{{session_id}}" --grant "{{agent_capability_grant}}" --path "<absolute file path>" --caption "<optional caption>"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Rules
|
|
16
|
+
|
|
17
|
+
- Use the node script above — never curl or raw HTTP.
|
|
18
|
+
- Save or choose a local file first.
|
|
19
|
+
- Use an absolute local path.
|
|
20
|
+
- Use only the session ID and capability grant shown above; they are a bound pair.
|
|
21
|
+
- Max file size: 30MB.
|
|
22
|
+
- Supported formats: .mp4 .mov .avi .mkv .webm .flv .mp3 .wav .ogg .aac .m4a .pdf .doc .docx .xls .xlsx .csv .ppt .pptx .txt .zip .tar .gz.
|
|
23
|
+
- Only send a file/video when the user asked for one or when it materially helps the answer.
|
|
24
|
+
- **If the script fails (non-zero exit), read stderr for the error. Do NOT retry with the same path. Either fix the problem (wrong extension, missing file, etc.) or tell the user what the error was. Never retry more than once.**
|
|
25
|
+
|
|
26
|
+
### Video Compression (when file > 30MB)
|
|
27
|
+
|
|
28
|
+
If the video exceeds 30MB, compress it with ffmpeg before sending.
|
|
29
|
+
|
|
30
|
+
**Ensure ffmpeg is available** (install if missing):
|
|
31
|
+
|
|
32
|
+
| OS | Install command |
|
|
33
|
+
|----|----------------|
|
|
34
|
+
| macOS | `brew install ffmpeg` |
|
|
35
|
+
| Linux (Debian/Ubuntu) | `sudo apt install ffmpeg` |
|
|
36
|
+
| Linux (RHEL/Fedora) | `sudo dnf install ffmpeg` |
|
|
37
|
+
| Windows | `winget install Gyan.FFmpeg` |
|
|
38
|
+
|
|
39
|
+
**Two-pass compression** (target ~28MB for 30s video, adjust `b:v` for other durations):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
ffmpeg -y -i "<input>" -c:v libx264 -b:v <bitrate>k -pass 1 -f mp4 NUL
|
|
43
|
+
ffmpeg -y -i "<input>" -c:v libx264 -b:v <bitrate>k -pass 2 -c:a aac -b:a 128k "<output>"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Bitrate formula: `bitrate = 28 × 8 × 1000 ÷ duration_seconds - 128` (target ~28MB, safe under 30MB).
|
|
47
|
+
On Windows replace `NUL` with `NUL` (same); on Linux/macOS use `/dev/null`.
|
|
48
|
+
|
|
49
|
+
If the compressed file still exceeds 30MB, explain to the user that automatic compression wasn't enough and suggest they manually trim or re-encode the source.
|
|
50
|
+
|
|
51
|
+
## Download Files or Videos
|
|
52
|
+
|
|
53
|
+
When the user sends a file or video to the bot, the message contains `message_id` and `file_key`. Download it with:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
node "{{download_video_script}}" --message-id <message_id> --file-key <file_key> --name <file_name>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If only `chat_id` and `file_key` are available:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
node "{{download_video_script}}" --chat-id <chat_id> --file-key <file_key> --name <file_name>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Downloads are saved under `~/.chatccc/videos/downloads/`.
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# Sending & Receiving Images
|
|
2
|
-
|
|
3
|
-
## Send Images
|
|
4
|
-
|
|
5
|
-
**Use the node script below. Do NOT use curl or raw HTTP — the script correctly handles errors and exits non-zero on failure.**
|
|
6
|
-
|
|
7
|
-
### Script
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
node "{{send_image_script}}" --url "{{send_image_url}}" --session-id "{{session_id}}" --grant "{{agent_capability_grant}}" --path "<absolute image path>" --caption "<optional caption>"
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### Rules
|
|
14
|
-
|
|
15
|
-
- Use the node script above — never curl or raw HTTP.
|
|
16
|
-
- Save or choose a local image file first.
|
|
17
|
-
- Use an absolute local path.
|
|
18
|
-
- Use only the session ID and capability grant shown above; they are a bound pair.
|
|
19
|
-
- Supported formats: .png, .jpg, .jpeg, .webp, .gif, .bmp.
|
|
20
|
-
- Max image size: 10MB.
|
|
21
|
-
- Only send an image when the user asked for one or when it materially helps the answer.
|
|
22
|
-
- **If the script fails (non-zero exit), read stderr for the error. Do NOT retry with the same path. Either fix the problem (wrong extension, missing file, etc.) or tell the user what the error was. Never retry more than once.**
|
|
23
|
-
|
|
24
|
-
## Receive Images
|
|
25
|
-
|
|
26
|
-
Images sent to the bot are automatically downloaded to `~/.chatccc/images/downloads/`. The message contains an `image_key` that maps to the cached file.
|
|
1
|
+
# Sending & Receiving Images
|
|
2
|
+
|
|
3
|
+
## Send Images
|
|
4
|
+
|
|
5
|
+
**Use the node script below. Do NOT use curl or raw HTTP — the script correctly handles errors and exits non-zero on failure.**
|
|
6
|
+
|
|
7
|
+
### Script
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
node "{{send_image_script}}" --url "{{send_image_url}}" --session-id "{{session_id}}" --grant "{{agent_capability_grant}}" --path "<absolute image path>" --caption "<optional caption>"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Rules
|
|
14
|
+
|
|
15
|
+
- Use the node script above — never curl or raw HTTP.
|
|
16
|
+
- Save or choose a local image file first.
|
|
17
|
+
- Use an absolute local path.
|
|
18
|
+
- Use only the session ID and capability grant shown above; they are a bound pair.
|
|
19
|
+
- Supported formats: .png, .jpg, .jpeg, .webp, .gif, .bmp.
|
|
20
|
+
- Max image size: 10MB.
|
|
21
|
+
- Only send an image when the user asked for one or when it materially helps the answer.
|
|
22
|
+
- **If the script fails (non-zero exit), read stderr for the error. Do NOT retry with the same path. Either fix the problem (wrong extension, missing file, etc.) or tell the user what the error was. Never retry more than once.**
|
|
23
|
+
|
|
24
|
+
## Receive Images
|
|
25
|
+
|
|
26
|
+
Images sent to the bot are automatically downloaded to `~/.chatccc/images/downloads/`. The message contains an `image_key` that maps to the cached file.
|
|
@@ -14,23 +14,23 @@ function parseArgs(argv) {
|
|
|
14
14
|
|
|
15
15
|
function usage() {
|
|
16
16
|
console.error(`Usage:
|
|
17
|
-
node ${basename(process.argv[1])} --url <url> --session-id <session_id> --grant <session_grant> --path <absolute file path> [--caption <text>]`);
|
|
17
|
+
node ${basename(process.argv[1])} --url <url> --session-id <session_id> --grant <session_grant> --path <absolute file path> [--caption <text>]`);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
async function main() {
|
|
21
21
|
const args = parseArgs(process.argv.slice(2));
|
|
22
22
|
const url = args.url || process.env.CHATCCC_SEND_FILE_URL;
|
|
23
|
-
const sessionId = args["session-id"] || args.session_id || process.env.CHATCCC_SESSION_ID;
|
|
24
|
-
const grant = args.grant || process.env.CHATCCC_AGENT_CAPABILITY_GRANT;
|
|
23
|
+
const sessionId = args["session-id"] || args.session_id || process.env.CHATCCC_SESSION_ID;
|
|
24
|
+
const grant = args.grant || process.env.CHATCCC_AGENT_CAPABILITY_GRANT;
|
|
25
25
|
const path = args.path;
|
|
26
26
|
const caption = args.caption || "";
|
|
27
27
|
|
|
28
|
-
if (!url || !sessionId || !grant || !path) {
|
|
28
|
+
if (!url || !sessionId || !grant || !path) {
|
|
29
29
|
usage();
|
|
30
30
|
process.exit(1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const body = Buffer.from(JSON.stringify({ session_id: sessionId, grant, path, caption }), "utf8");
|
|
33
|
+
const body = Buffer.from(JSON.stringify({ session_id: sessionId, grant, path, caption }), "utf8");
|
|
34
34
|
const response = await fetch(url, {
|
|
35
35
|
method: "POST",
|
|
36
36
|
headers: {
|
|
@@ -49,4 +49,4 @@ async function main() {
|
|
|
49
49
|
main().catch((err) => {
|
|
50
50
|
console.error(err instanceof Error ? err.message : String(err));
|
|
51
51
|
process.exit(1);
|
|
52
|
-
});
|
|
52
|
+
});
|
|
@@ -14,23 +14,23 @@ function parseArgs(argv) {
|
|
|
14
14
|
|
|
15
15
|
function usage() {
|
|
16
16
|
console.error(`Usage:
|
|
17
|
-
node ${basename(process.argv[1])} --url <url> --session-id <session_id> --grant <session_grant> --path <absolute image path> [--caption <text>]`);
|
|
17
|
+
node ${basename(process.argv[1])} --url <url> --session-id <session_id> --grant <session_grant> --path <absolute image path> [--caption <text>]`);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
async function main() {
|
|
21
21
|
const args = parseArgs(process.argv.slice(2));
|
|
22
22
|
const url = args.url || process.env.CHATCCC_SEND_IMAGE_URL;
|
|
23
|
-
const sessionId = args["session-id"] || args.session_id || process.env.CHATCCC_SESSION_ID;
|
|
24
|
-
const grant = args.grant || process.env.CHATCCC_AGENT_CAPABILITY_GRANT;
|
|
23
|
+
const sessionId = args["session-id"] || args.session_id || process.env.CHATCCC_SESSION_ID;
|
|
24
|
+
const grant = args.grant || process.env.CHATCCC_AGENT_CAPABILITY_GRANT;
|
|
25
25
|
const path = args.path;
|
|
26
26
|
const caption = args.caption || "";
|
|
27
27
|
|
|
28
|
-
if (!url || !sessionId || !grant || !path) {
|
|
28
|
+
if (!url || !sessionId || !grant || !path) {
|
|
29
29
|
usage();
|
|
30
30
|
process.exit(1);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const body = Buffer.from(JSON.stringify({ session_id: sessionId, grant, path, caption }), "utf8");
|
|
33
|
+
const body = Buffer.from(JSON.stringify({ session_id: sessionId, grant, path, caption }), "utf8");
|
|
34
34
|
const response = await fetch(url, {
|
|
35
35
|
method: "POST",
|
|
36
36
|
headers: {
|
|
@@ -49,4 +49,4 @@ async function main() {
|
|
|
49
49
|
main().catch((err) => {
|
|
50
50
|
console.error(err instanceof Error ? err.message : String(err));
|
|
51
51
|
process.exit(1);
|
|
52
|
-
});
|
|
52
|
+
});
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: feishu-skill
|
|
3
|
-
description: Feishu IM local skills for sending images, files, videos, and for creating new sessions or switching working directories.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Current working directory: {{cwd}}
|
|
7
|
-
Your session id: {{session_id}}
|
|
8
|
-
Your session capability grant: {{agent_capability_grant}}
|
|
9
|
-
Your Feishu open_id: {{open_id}}
|
|
10
|
-
|
|
11
|
-
Use local endpoints instead of calling Feishu Open Platform directly.
|
|
12
|
-
|
|
13
|
-
- **Send images**: POST `{{send_image_url}}` with `{"session_id":"{{session_id}}","grant":"{{agent_capability_grant}}","path":"<absolute path>","caption":"<optional>"}` — read `{{im_skills_cache_dir}}/feishu-skill/receive-send-image.md`
|
|
14
|
-
- **Send files/videos**: POST `{{send_file_url}}` with `{"session_id":"{{session_id}}","grant":"{{agent_capability_grant}}","path":"<absolute path>","caption":"<optional>"}` — read `{{im_skills_cache_dir}}/feishu-skill/receive-send-file.md`
|
|
15
|
-
- **Create a new session (新建会话)**: POST `{{delegate_task_url}}` with `{"tool":"claude|cursor|codex|ccc|dsh","cwd":"<absolute path>","open_id":"{{open_id}}","prompt":"<optional first task>"}`. This creates a new Feishu group and session, and only adds you (the requester). `tool` and `prompt` are optional; omit `prompt` to just create the session without a first task.
|
|
16
|
-
- **Set default working directory (cd / 切换目录)**: POST `{{set_cwd_url}}` with `{"session_id":"{{session_id}}","dir":"<absolute path>"}`. This sets the default directory for future new sessions only; it does not change the current session.
|
|
17
|
-
|
|
18
|
-
How to map user requests to these endpoints:
|
|
19
|
-
|
|
20
|
-
- "新建会话 / 开个新会话 / 换个新会话" → create a new session (no prompt). Use `cwd` = your current working directory ({{cwd}}) unless the user names a directory.
|
|
21
|
-
- "在 <目录> 新建会话(做 <任务>)" → create a new session with `cwd` = that directory, and set `prompt` to the task if one was given.
|
|
22
|
-
- "cd 到 <目录> / 切换到 <目录> / 去 <目录> 干活" → judge intent:
|
|
23
|
-
- if the user wants to start working there now (a fresh conversation in that directory) → create a new session with `cwd` = that directory.
|
|
24
|
-
- if the user only wants to change the default directory for future sessions → call set-cwd.
|
|
25
|
-
- when ambiguous, prefer creating a new session (the more common intent for "切换到").
|
|
26
|
-
- Directory names may be fuzzy or relative; resolve them to an absolute local path (using your file tools) before calling either endpoint.
|
|
27
|
-
- `open_id` must always be passed as exactly {{open_id}}; do not invent it.
|
|
28
|
-
- The capability grant is bound to this session. Never reuse a grant with another session ID.
|
|
1
|
+
---
|
|
2
|
+
name: feishu-skill
|
|
3
|
+
description: Feishu IM local skills for sending images, files, videos, and for creating new sessions or switching working directories.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Current working directory: {{cwd}}
|
|
7
|
+
Your session id: {{session_id}}
|
|
8
|
+
Your session capability grant: {{agent_capability_grant}}
|
|
9
|
+
Your Feishu open_id: {{open_id}}
|
|
10
|
+
|
|
11
|
+
Use local endpoints instead of calling Feishu Open Platform directly.
|
|
12
|
+
|
|
13
|
+
- **Send images**: POST `{{send_image_url}}` with `{"session_id":"{{session_id}}","grant":"{{agent_capability_grant}}","path":"<absolute path>","caption":"<optional>"}` — read `{{im_skills_cache_dir}}/feishu-skill/receive-send-image.md`
|
|
14
|
+
- **Send files/videos**: POST `{{send_file_url}}` with `{"session_id":"{{session_id}}","grant":"{{agent_capability_grant}}","path":"<absolute path>","caption":"<optional>"}` — read `{{im_skills_cache_dir}}/feishu-skill/receive-send-file.md`
|
|
15
|
+
- **Create a new session (新建会话)**: POST `{{delegate_task_url}}` with `{"tool":"claude|cursor|codex|ccc|dsh","cwd":"<absolute path>","open_id":"{{open_id}}","prompt":"<optional first task>"}`. This creates a new Feishu group and session, and only adds you (the requester). `tool` and `prompt` are optional; omit `prompt` to just create the session without a first task.
|
|
16
|
+
- **Set default working directory (cd / 切换目录)**: POST `{{set_cwd_url}}` with `{"session_id":"{{session_id}}","dir":"<absolute path>"}`. This sets the default directory for future new sessions only; it does not change the current session.
|
|
17
|
+
|
|
18
|
+
How to map user requests to these endpoints:
|
|
19
|
+
|
|
20
|
+
- "新建会话 / 开个新会话 / 换个新会话" → create a new session (no prompt). Use `cwd` = your current working directory ({{cwd}}) unless the user names a directory.
|
|
21
|
+
- "在 <目录> 新建会话(做 <任务>)" → create a new session with `cwd` = that directory, and set `prompt` to the task if one was given.
|
|
22
|
+
- "cd 到 <目录> / 切换到 <目录> / 去 <目录> 干活" → judge intent:
|
|
23
|
+
- if the user wants to start working there now (a fresh conversation in that directory) → create a new session with `cwd` = that directory.
|
|
24
|
+
- if the user only wants to change the default directory for future sessions → call set-cwd.
|
|
25
|
+
- when ambiguous, prefer creating a new session (the more common intent for "切换到").
|
|
26
|
+
- Directory names may be fuzzy or relative; resolve them to an absolute local path (using your file tools) before calling either endpoint.
|
|
27
|
+
- `open_id` must always be passed as exactly {{open_id}}; do not invent it.
|
|
28
|
+
- The capability grant is bound to this session. Never reuse a grant with another session ID.
|
|
@@ -1,39 +1,39 @@
|
|
|
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.
|
|
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
39
|
- **Claw 限制**: 文件发送也计入微信 claw 连发计数,连续 10 条未回复会截断。
|
|
@@ -1,84 +1,84 @@
|
|
|
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);
|
|
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
84
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
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`
|
|
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
11
|
- **Send files**: Use the send-file helper script — read `{{im_skills_cache_dir}}/wechat-file-skill/receive-send-file.md`
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: wechat-image-skill
|
|
3
|
-
description: WeChat iLink local skills for sending and receiving images.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Current working directory: {{cwd}}
|
|
7
|
-
|
|
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
|
-
|
|
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`
|
|
1
|
+
---
|
|
2
|
+
name: wechat-image-skill
|
|
3
|
+
description: WeChat iLink local skills for sending and receiving images.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Current working directory: {{cwd}}
|
|
7
|
+
|
|
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
|
+
|
|
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
11
|
- **Send images**: Use the send-image helper script — read `{{im_skills_cache_dir}}/wechat-image-skill/receive-send-image.md`
|