@wu529778790/open-im 1.10.2 → 1.10.3-beta.0
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/README.md +46 -138
- package/README.zh-CN.md +41 -127
- package/dist/config/types.d.ts +16 -0
- package/dist/config-web.js +1 -0
- package/dist/config.js +65 -1
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +10 -0
- package/dist/index.js +23 -8
- package/dist/logger.d.ts +15 -2
- package/dist/logger.js +99 -5
- package/dist/session/session-manager.js +6 -2
- package/dist/shared/ai-task.js +38 -3
- package/dist/telemetry/hash-user.d.ts +2 -0
- package/dist/telemetry/hash-user.js +5 -0
- package/dist/telemetry/telemetry-sanitize.d.ts +2 -0
- package/dist/telemetry/telemetry-sanitize.js +30 -0
- package/dist/telemetry/telemetry-upload.d.ts +8 -0
- package/dist/telemetry/telemetry-upload.js +153 -0
- package/package.json +1 -1
- package/dist/adapters/claude-sdk-adapter.test.d.ts +0 -1
- package/dist/adapters/claude-sdk-adapter.test.js +0 -50
- package/dist/channels/capabilities.test.d.ts +0 -1
- package/dist/channels/capabilities.test.js +0 -27
- package/dist/codebuddy/cli-runner.test.d.ts +0 -1
- package/dist/codebuddy/cli-runner.test.js +0 -67
- package/dist/codex/cli-runner.test.d.ts +0 -1
- package/dist/codex/cli-runner.test.js +0 -53
- package/dist/commands/normalize-command.test.d.ts +0 -1
- package/dist/commands/normalize-command.test.js +0 -17
- package/dist/config-web.test.d.ts +0 -1
- package/dist/config-web.test.js +0 -57
- package/dist/config.test.d.ts +0 -1
- package/dist/config.test.js +0 -38
- package/dist/dingtalk/client.test.d.ts +0 -1
- package/dist/dingtalk/client.test.js +0 -22
- package/dist/dingtalk/message-sender.test.d.ts +0 -1
- package/dist/dingtalk/message-sender.test.js +0 -136
- package/dist/platform/create-event-context.test.d.ts +0 -1
- package/dist/platform/create-event-context.test.js +0 -91
- package/dist/platform/handle-ai-request.test.d.ts +0 -1
- package/dist/platform/handle-ai-request.test.js +0 -349
- package/dist/platform/handle-text-flow.test.d.ts +0 -1
- package/dist/platform/handle-text-flow.test.js +0 -239
- package/dist/qq/message-sender.test.d.ts +0 -1
- package/dist/qq/message-sender.test.js +0 -46
- package/dist/queue/request-queue.test.d.ts +0 -1
- package/dist/queue/request-queue.test.js +0 -82
- package/dist/service-control.test.d.ts +0 -1
- package/dist/service-control.test.js +0 -47
- package/dist/session/session-manager.test.d.ts +0 -1
- package/dist/session/session-manager.test.js +0 -106
- package/dist/shared/ai-task.test.d.ts +0 -1
- package/dist/shared/ai-task.test.js +0 -200
- package/dist/shared/media-analysis-prompt.test.d.ts +0 -1
- package/dist/shared/media-analysis-prompt.test.js +0 -40
- package/dist/shared/media-context.test.d.ts +0 -1
- package/dist/shared/media-context.test.js +0 -13
- package/dist/shared/media-prompt.test.d.ts +0 -1
- package/dist/shared/media-prompt.test.js +0 -26
- package/dist/shared/media-storage.test.d.ts +0 -1
- package/dist/shared/media-storage.test.js +0 -68
- package/dist/shared/message-note.test.d.ts +0 -1
- package/dist/shared/message-note.test.js +0 -14
- package/dist/shared/message-title.test.d.ts +0 -1
- package/dist/shared/message-title.test.js +0 -19
- package/dist/shared/system-messages.test.d.ts +0 -1
- package/dist/shared/system-messages.test.js +0 -8
- package/dist/shared/task-cleanup.test.d.ts +0 -1
- package/dist/shared/task-cleanup.test.js +0 -74
- package/dist/shared/utils.test.d.ts +0 -1
- package/dist/shared/utils.test.js +0 -43
- package/dist/wework/event-handler.test.d.ts +0 -1
- package/dist/wework/event-handler.test.js +0 -103
- package/dist/wework/message-sender.test.d.ts +0 -1
- package/dist/wework/message-sender.test.js +0 -33
package/README.md
CHANGED
|
@@ -6,20 +6,15 @@ Multi-platform IM bridge for AI CLI tools. Connect Telegram, Feishu, WeCom, Ding
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **Six IM platforms** —
|
|
10
|
-
- **Three AI backends** — Claude (Agent SDK), Codex, CodeBuddy
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **Media** — images, files, voice, and video for analysis (platform-dependent)
|
|
14
|
-
- **Session isolation** — per-user state; `/new` resets the AI session
|
|
15
|
-
- **Web configuration** — full dashboard **bundled in the npm package** (`web/dist`), served from **`http://127.0.0.1:39282`** (same origin as the API)
|
|
16
|
-
- **Chat commands** — `/help`, `/new`, `/sessions`, `/resume`, `/cd`, `/pwd`, `/status`, `/allow`, `/deny`
|
|
9
|
+
- **Six IM platforms** — Telegram, Feishu, WeCom, DingTalk, QQ, WorkBuddy
|
|
10
|
+
- **Three AI backends** — Claude (Agent SDK), Codex, CodeBuddy (per-platform override supported)
|
|
11
|
+
- **Streaming, media, sessions** — live output where supported; `/new` for a fresh AI session
|
|
12
|
+
- **Web UI** — dashboard bundled in the package; default **`http://127.0.0.1:39282`**
|
|
17
13
|
|
|
18
14
|
## Requirements
|
|
19
15
|
|
|
20
16
|
- Node.js ≥ 20
|
|
21
|
-
- At least one IM platform configured
|
|
22
|
-
- Credentials for the AI tool you use
|
|
17
|
+
- At least one IM platform configured + credentials for your AI tool
|
|
23
18
|
|
|
24
19
|
## Quick start
|
|
25
20
|
|
|
@@ -27,118 +22,62 @@ Multi-platform IM bridge for AI CLI tools. Connect Telegram, Feishu, WeCom, Ding
|
|
|
27
22
|
npx @wu529778790/open-im start
|
|
28
23
|
```
|
|
29
24
|
|
|
30
|
-
Or install
|
|
25
|
+
Or: `npm install -g @wu529778790/open-im` then `open-im start`.
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
npm install -g @wu529778790/open-im
|
|
34
|
-
open-im start
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Configuration file: `~/.open-im/config.json`
|
|
27
|
+
Config: **`~/.open-im/config.json`**
|
|
38
28
|
|
|
39
29
|
## CLI
|
|
40
30
|
|
|
41
31
|
| Command | Description |
|
|
42
32
|
| --- | --- |
|
|
43
|
-
| `open-im init` | Interactive setup
|
|
33
|
+
| `open-im init` | Interactive setup (does not start the bridge) |
|
|
44
34
|
| `open-im start` | Run the bridge in the background |
|
|
45
35
|
| `open-im stop` | Stop the background bridge |
|
|
46
36
|
| `open-im restart` | Stop then start |
|
|
47
|
-
| `open-im
|
|
48
|
-
| `open-im dashboard` | Keep only the local config HTTP server (no bridge) |
|
|
49
|
-
|
|
50
|
-
After `start`, the CLI prints the **web dashboard** URL (`http://127.0.0.1:39282` by default, same as the API base).
|
|
51
|
-
|
|
52
|
-
## Web configuration
|
|
53
|
-
|
|
54
|
-
### Bundled dashboard (full UI)
|
|
55
|
-
|
|
56
|
-
The published npm package includes **`web/dist`**. `open-im start` or `open-im dashboard` serves the **full SPA** (overview, platforms, AI, JSON, service controls) from the local HTTP server. Open **`http://127.0.0.1:<port>`** (default **39282**) in your browser; the page is **same-origin** with the API, so you usually do not need to paste a Server URL.
|
|
37
|
+
| `open-im dashboard` | Web config server only (no bridge) |
|
|
57
38
|
|
|
58
|
-
|
|
59
|
-
- Override the URL shown/opened by the CLI with **`OPEN_IM_PUBLIC_WEB_URL`** (e.g. behind a reverse proxy)
|
|
39
|
+
After `start`, the CLI prints the dashboard URL (default **`http://127.0.0.1:39282`**).
|
|
60
40
|
|
|
61
|
-
|
|
41
|
+
## Web dashboard
|
|
62
42
|
|
|
63
|
-
|
|
43
|
+
`open-im start` and `open-im dashboard` serve the built-in SPA and **`/api/*`** on **`OPEN_IM_WEB_PORT`** (default **39282**). Open **`http://127.0.0.1:39282`** in a browser (same origin as the API). Override the displayed URL with **`OPEN_IM_PUBLIC_WEB_URL`** if behind a proxy.
|
|
64
44
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- **`GET /`** — built-in dashboard when `web/dist` is present; otherwise **503** with a short plain-text hint
|
|
68
|
-
- **`/assets/*`** — static assets for the bundled SPA (when present)
|
|
69
|
-
- **`/api/*`** — JSON API used by the dashboard
|
|
70
|
-
|
|
71
|
-
### Remote access
|
|
72
|
-
|
|
73
|
-
For access from another host or from an HTTPS-hosted page:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
export OPEN_IM_WEB_HOST=0.0.0.0
|
|
77
|
-
# Optional: skip cookie login on trusted networks (see security implications in docs)
|
|
78
|
-
# export OPEN_IM_ALLOW_REMOTE_API=true
|
|
79
|
-
# Optional: restrict CORS origins (comma-separated)
|
|
80
|
-
# export OPEN_IM_CORS_ORIGINS=http://127.0.0.1:39282
|
|
81
|
-
```
|
|
45
|
+
**Remote / LAN:** `export OPEN_IM_WEB_HOST=0.0.0.0` — first access from another host may show a one-time login link. Optional: **`OPEN_IM_ALLOW_REMOTE_API`**, **`OPEN_IM_CORS_ORIGINS`**.
|
|
82
46
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### Developing the web UI (from source)
|
|
86
|
-
|
|
87
|
-
In the repository:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npm run web:dev # Vite dev server; proxies /api to 127.0.0.1:39282
|
|
91
|
-
npm run build # web:build + tsc (use before running the compiled CLI with dashboard)
|
|
92
|
-
npm run build:ts # tsc only (no web/dist refresh)
|
|
93
|
-
npm run web:build # web/dist only
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
More detail: [CLAUDE.md](./CLAUDE.md), [AGENTS.md](./AGENTS.md).
|
|
97
|
-
|
|
98
|
-
## IM commands
|
|
47
|
+
## Chat commands
|
|
99
48
|
|
|
100
49
|
| Command | Description |
|
|
101
50
|
| --- | --- |
|
|
102
51
|
| `/help` | Help |
|
|
103
52
|
| `/new` | New AI session |
|
|
104
|
-
| `/sessions` |
|
|
105
|
-
| `/resume <N>` | Resume
|
|
106
|
-
| `/status` | AI
|
|
107
|
-
| `/cd
|
|
108
|
-
| `/
|
|
109
|
-
| `/allow` / `/y` | Approve a permission request |
|
|
110
|
-
| `/deny` / `/n` | Reject a permission request |
|
|
111
|
-
|
|
112
|
-
## Sessions
|
|
53
|
+
| `/sessions` | Session history |
|
|
54
|
+
| `/resume <N>` | Resume by list number |
|
|
55
|
+
| `/status` | AI + session info |
|
|
56
|
+
| `/cd` / `/pwd` | Working directory |
|
|
57
|
+
| `/allow` / `/y`, `/deny` / `/n` | Permission prompts |
|
|
113
58
|
|
|
114
|
-
|
|
59
|
+
Session state is stored in **`~/.open-im/data/sessions.json`** (per user, not IM chat logs).
|
|
115
60
|
|
|
116
61
|
## Configuration
|
|
117
62
|
|
|
118
|
-
### Per-platform AI
|
|
63
|
+
### Per-platform AI
|
|
119
64
|
|
|
120
|
-
Default: root
|
|
65
|
+
Default: root **`aiCommand`**. Override with **`platforms.<name>.aiCommand`**:
|
|
121
66
|
|
|
122
67
|
```json
|
|
123
68
|
{
|
|
124
69
|
"aiCommand": "claude",
|
|
125
70
|
"platforms": {
|
|
126
|
-
"telegram": { "enabled": true, "aiCommand": "codex" }
|
|
127
|
-
"feishu": { "enabled": true, "aiCommand": "codex" },
|
|
128
|
-
"qq": { "enabled": true, "aiCommand": "codebuddy" }
|
|
71
|
+
"telegram": { "enabled": true, "aiCommand": "codex" }
|
|
129
72
|
}
|
|
130
73
|
}
|
|
131
74
|
```
|
|
132
75
|
|
|
133
76
|
### Claude (Agent SDK)
|
|
134
77
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
1. Environment variables
|
|
138
|
-
2. `env` in `~/.open-im/config.json`
|
|
139
|
-
3. `~/.claude/settings.json` or `~/.claude.json`
|
|
78
|
+
No local `claude` binary required. Credentials: env → **`config.json`** `env` → **`~/.claude/settings.json`**.
|
|
140
79
|
|
|
141
|
-
Third-party compatible
|
|
80
|
+
Third-party / compatible API example:
|
|
142
81
|
|
|
143
82
|
```json
|
|
144
83
|
{
|
|
@@ -150,8 +89,6 @@ Third-party compatible endpoints:
|
|
|
150
89
|
}
|
|
151
90
|
```
|
|
152
91
|
|
|
153
|
-
Claude inherits plugins and settings from `~/.claude/settings.json` when present.
|
|
154
|
-
|
|
155
92
|
### CodeBuddy
|
|
156
93
|
|
|
157
94
|
```bash
|
|
@@ -159,82 +96,53 @@ npm install -g @tencent-ai/codebuddy-code
|
|
|
159
96
|
codebuddy login
|
|
160
97
|
```
|
|
161
98
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
### Example `config.json`
|
|
99
|
+
### Minimal `config.json` shape
|
|
165
100
|
|
|
166
101
|
```json
|
|
167
102
|
{
|
|
168
103
|
"aiCommand": "claude",
|
|
169
104
|
"tools": {
|
|
170
|
-
"claude": {
|
|
171
|
-
"workDir": "/path/to/project",
|
|
172
|
-
"skipPermissions": true,
|
|
173
|
-
"timeoutMs": 600000
|
|
174
|
-
},
|
|
175
|
-
"codex": {
|
|
176
|
-
"workDir": "/path/to/project",
|
|
177
|
-
"skipPermissions": true,
|
|
178
|
-
"proxy": "http://127.0.0.1:7890"
|
|
179
|
-
},
|
|
180
|
-
"codebuddy": {
|
|
181
|
-
"skipPermissions": true,
|
|
182
|
-
"timeoutMs": 600000
|
|
183
|
-
}
|
|
105
|
+
"claude": { "workDir": "/path/to/project", "skipPermissions": true, "timeoutMs": 600000 }
|
|
184
106
|
},
|
|
185
107
|
"platforms": {
|
|
186
|
-
"telegram": { "enabled": true, "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
187
|
-
"feishu": { "enabled": false, "appId": "YOUR_FEISHU_APP_ID", "appSecret": "YOUR_FEISHU_APP_SECRET" },
|
|
188
|
-
"qq": { "enabled": false, "appId": "YOUR_QQ_APP_ID", "secret": "YOUR_QQ_APP_SECRET" },
|
|
189
|
-
"wework": { "enabled": false, "corpId": "YOUR_WEWORK_CORP_ID", "secret": "YOUR_WEWORK_SECRET" },
|
|
190
|
-
"dingtalk": {
|
|
191
|
-
"enabled": false,
|
|
192
|
-
"clientId": "YOUR_DINGTALK_CLIENT_ID",
|
|
193
|
-
"clientSecret": "YOUR_DINGTALK_CLIENT_SECRET",
|
|
194
|
-
"cardTemplateId": "YOUR_DINGTALK_AI_CARD_TEMPLATE_ID"
|
|
195
|
-
},
|
|
196
|
-
"workbuddy": { "enabled": false, "accessToken": "", "refreshToken": "", "userId": "" }
|
|
108
|
+
"telegram": { "enabled": true, "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
197
109
|
}
|
|
198
110
|
}
|
|
199
111
|
```
|
|
200
112
|
|
|
201
|
-
WorkBuddy
|
|
113
|
+
Add Feishu, QQ, WeCom, DingTalk, WorkBuddy under **`platforms`** as needed. Run **`open-im init`** for a full template. WeChat (WorkBuddy) is easiest via **`open-im init`**.
|
|
202
114
|
|
|
203
115
|
### Environment variables
|
|
204
116
|
|
|
205
|
-
|
|
117
|
+
Use **`config.json`** or environment variables; the dashboard exposes common options. Typical keys: **`ANTHROPIC_*`**, **`TELEGRAM_BOT_TOKEN`**, **`OPEN_IM_WEB_PORT`**, **`OPEN_IM_WEB_HOST`**, plus platform-specific `*_APP_ID`, `*_SECRET`, `WORKBUDDY_*`, etc.
|
|
206
118
|
|
|
207
|
-
|
|
119
|
+
### Privacy
|
|
208
120
|
|
|
209
|
-
**
|
|
121
|
+
**Anonymous** usage information may be collected to improve reliability (no chat or prompt content). To disable: **`OPEN_IM_TELEMETRY=false`** or **`"telemetry": { "enabled": false }`** in **`config.json`**.
|
|
210
122
|
|
|
211
|
-
### Platform
|
|
123
|
+
### Platform credentials
|
|
212
124
|
|
|
213
|
-
| Platform |
|
|
125
|
+
| Platform | Notes |
|
|
214
126
|
| --- | --- |
|
|
215
127
|
| Telegram | [@BotFather](https://t.me/BotFather) |
|
|
216
|
-
| Feishu | [
|
|
128
|
+
| Feishu | [Open Platform](https://open.feishu.cn/) |
|
|
217
129
|
| QQ | [QQ Open Platform](https://bot.q.qq.com/) |
|
|
218
|
-
| DingTalk |
|
|
219
|
-
| WeCom | [
|
|
220
|
-
| WeChat |
|
|
221
|
-
|
|
222
|
-
**DingTalk:** Stream Mode (receive) + OpenAPI (send). With `cardTemplateId`, AI assistant streaming cards are used when possible; otherwise plain text. Custom bots and normal groups may only get single text replies. Startup/shutdown notices are not sent to DingTalk.
|
|
130
|
+
| DingTalk | Open Platform — bot **Stream Mode**; optional **`cardTemplateId`** for AI assistant cards |
|
|
131
|
+
| WeCom | [Admin](https://work.weixin.qq.com/) |
|
|
132
|
+
| WeChat | **`open-im init`** → WorkBuddy OAuth |
|
|
223
133
|
|
|
224
134
|
## Troubleshooting
|
|
225
135
|
|
|
226
136
|
| Issue | What to try |
|
|
227
137
|
| --- | --- |
|
|
228
|
-
| Telegram
|
|
229
|
-
| QQ
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
|
|
|
236
|
-
| CodeBuddy asks for login | Run `codebuddy login` |
|
|
237
|
-
| WorkBuddy / WeChat | Re-run `open-im init`; tokens and binding links expire |
|
|
138
|
+
| Telegram / network | `proxy` or **`TELEGRAM_PROXY`** |
|
|
139
|
+
| QQ | Check **`QQ_BOT_APPID`** / **`QQ_BOT_SECRET`**; update if duplicate replies |
|
|
140
|
+
| Feishu cards | **`/mode ask`** or **`/mode yolo`** without card callbacks |
|
|
141
|
+
| WeCom | Send the bot a message first |
|
|
142
|
+
| DingTalk | Stream Mode + credentials; custom bots may be text-only |
|
|
143
|
+
| Codex disconnect | **`CODEX_PROXY`** or **`tools.codex.proxy`** |
|
|
144
|
+
| CodeBuddy login | **`codebuddy login`** |
|
|
145
|
+
| WorkBuddy | Re-run **`open-im init`** (tokens expire) |
|
|
238
146
|
|
|
239
147
|
## License
|
|
240
148
|
|
package/README.zh-CN.md
CHANGED
|
@@ -6,20 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
## 功能特性
|
|
8
8
|
|
|
9
|
-
- **六个 IM 平台** —
|
|
10
|
-
- **三种 AI 后端** — Claude(Agent SDK)、Codex、CodeBuddy
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- **多媒体** — 图片、文件、语音、视频(因平台而异)
|
|
14
|
-
- **会话隔离** — 每用户独立;`/new` 重置会话
|
|
15
|
-
- **Web 配置** — 完整仪表盘 **随 npm 包内置**(`web/dist`),由本机 `http://127.0.0.1:39282` **同源**提供
|
|
16
|
-
- **聊天命令** — `/help`、`/new`、`/sessions`、`/resume`、`/cd`、`/pwd`、`/status`、`/allow`、`/deny`
|
|
9
|
+
- **六个 IM 平台** — Telegram、飞书、企业微信、钉钉、QQ、WorkBuddy
|
|
10
|
+
- **三种 AI 后端** — Claude(Agent SDK)、Codex、CodeBuddy(可按平台覆盖)
|
|
11
|
+
- **流式、多媒体、会话** — 视平台能力;`/new` 开启新 AI 会话
|
|
12
|
+
- **Web 控制台** — 随包内置,默认 **`http://127.0.0.1:39282`**
|
|
17
13
|
|
|
18
14
|
## 环境要求
|
|
19
15
|
|
|
20
16
|
- Node.js ≥ 20
|
|
21
|
-
- 至少配置一个 IM 平台
|
|
22
|
-
- 所选 AI 工具所需的凭证
|
|
17
|
+
- 至少配置一个 IM 平台 + 所选 AI 的凭证
|
|
23
18
|
|
|
24
19
|
## 快速开始
|
|
25
20
|
|
|
@@ -27,71 +22,27 @@
|
|
|
27
22
|
npx @wu529778790/open-im start
|
|
28
23
|
```
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
或:`npm install -g @wu529778790/open-im` 后执行 `open-im start`。
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
npm install -g @wu529778790/open-im
|
|
34
|
-
open-im start
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
配置文件:`~/.open-im/config.json`
|
|
27
|
+
配置:**`~/.open-im/config.json`**
|
|
38
28
|
|
|
39
29
|
## CLI 命令
|
|
40
30
|
|
|
41
31
|
| 命令 | 说明 |
|
|
42
32
|
| --- | --- |
|
|
43
|
-
| `open-im init` |
|
|
33
|
+
| `open-im init` | 交互配置(不启动桥接) |
|
|
44
34
|
| `open-im start` | 后台运行桥接 |
|
|
45
35
|
| `open-im stop` | 停止后台服务 |
|
|
46
36
|
| `open-im restart` | 重启 |
|
|
47
|
-
| `open-im
|
|
48
|
-
| `open-im dashboard` | 仅保留本地配置 HTTP 服务(不启动桥接) |
|
|
49
|
-
|
|
50
|
-
执行 `start` 后,终端会提示 **Web 控制台** 地址(默认 **`http://127.0.0.1:39282`**,与 API 同源)。
|
|
51
|
-
|
|
52
|
-
## Web 配置
|
|
53
|
-
|
|
54
|
-
### 内置仪表盘(完整 UI)
|
|
37
|
+
| `open-im dashboard` | 仅 Web 配置服务(不启动桥接) |
|
|
55
38
|
|
|
56
|
-
|
|
39
|
+
`start` 后会提示控制台地址(默认 **`http://127.0.0.1:39282`**)。
|
|
57
40
|
|
|
58
|
-
|
|
59
|
-
- 若需自定义打开的链接(例如反向代理后的地址),可设置 **`OPEN_IM_PUBLIC_WEB_URL`**
|
|
41
|
+
## Web 控制台
|
|
60
42
|
|
|
61
|
-
|
|
43
|
+
`open-im start` / `open-im dashboard` 在 **`OPEN_IM_WEB_PORT`**(默认 **39282**)提供内置页面与 **`/api/*`**。浏览器打开 **`http://127.0.0.1:39282`** 即可(与 API 同源)。反向代理时可设 **`OPEN_IM_PUBLIC_WEB_URL`**。
|
|
62
44
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
进程监听 **`OPEN_IM_WEB_PORT`**(默认 **39282**):
|
|
66
|
-
|
|
67
|
-
- **`GET /`** — 有 `web/dist` 时返回内置仪表盘;否则 **503** 纯文本提示
|
|
68
|
-
- **`/assets/*`** — 内置前端静态资源(有构建产物时)
|
|
69
|
-
- **`/api/*`** — JSON API
|
|
70
|
-
|
|
71
|
-
### 远程访问
|
|
72
|
-
|
|
73
|
-
从其他机器或 HTTPS 页面访问时:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
export OPEN_IM_WEB_HOST=0.0.0.0
|
|
77
|
-
# 可选:受信网络跳过 Cookie 登录(请自行评估风险)
|
|
78
|
-
# export OPEN_IM_ALLOW_REMOTE_API=true
|
|
79
|
-
# 可选:限制 CORS 来源(逗号分隔)
|
|
80
|
-
# export OPEN_IM_CORS_ORIGINS=http://127.0.0.1:39282
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
未绑定 `127.0.0.1` 时,服务端可能打印 **一次性登录链接**(`login_token=…`)。
|
|
84
|
-
|
|
85
|
-
### 开发 Web 前端(源码仓库)
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npm run web:dev # Vite;将 /api 代理到 127.0.0.1:39282
|
|
89
|
-
npm run build # web:build + tsc;发布前与日常请用此命令
|
|
90
|
-
npm run build:ts # 仅 tsc(不更新 web/dist)
|
|
91
|
-
npm run web:build # 仅构建 web/dist
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
更多开发说明见 [CLAUDE.md](./CLAUDE.md)、[AGENTS.md](./AGENTS.md)。
|
|
45
|
+
**局域网 / 远程:** `export OPEN_IM_WEB_HOST=0.0.0.0` — 首次外网访问可能需一次性登录链接。可选 **`OPEN_IM_ALLOW_REMOTE_API`**、**`OPEN_IM_CORS_ORIGINS`**。
|
|
95
46
|
|
|
96
47
|
## IM 内命令
|
|
97
48
|
|
|
@@ -99,38 +50,32 @@ npm run web:build # 仅构建 web/dist
|
|
|
99
50
|
| --- | --- |
|
|
100
51
|
| `/help` | 帮助 |
|
|
101
52
|
| `/new` | 新 AI 会话 |
|
|
102
|
-
| `/sessions` |
|
|
103
|
-
| `/resume <序号>` |
|
|
53
|
+
| `/sessions` | 历史会话 |
|
|
54
|
+
| `/resume <序号>` | 按列表序号恢复 |
|
|
104
55
|
| `/status` | AI 与会话信息 |
|
|
105
|
-
| `/cd
|
|
106
|
-
| `/
|
|
107
|
-
| `/allow` / `/y` | 同意权限请求 |
|
|
108
|
-
| `/deny` / `/n` | 拒绝权限请求 |
|
|
109
|
-
|
|
110
|
-
## 会话说明
|
|
56
|
+
| `/cd` / `/pwd` | 工作目录 |
|
|
57
|
+
| `/allow` / `/y`、`/deny` / `/n` | 权限确认 |
|
|
111
58
|
|
|
112
|
-
|
|
59
|
+
会话状态保存在 **`~/.open-im/data/sessions.json`**(按用户,与 IM 聊天记录无关)。
|
|
113
60
|
|
|
114
61
|
## 配置说明
|
|
115
62
|
|
|
116
|
-
###
|
|
63
|
+
### 按平台指定 AI
|
|
117
64
|
|
|
118
|
-
根级
|
|
65
|
+
根级 **`aiCommand`** 为默认;用 **`platforms.<name>.aiCommand`** 覆盖:
|
|
119
66
|
|
|
120
67
|
```json
|
|
121
68
|
{
|
|
122
69
|
"aiCommand": "claude",
|
|
123
70
|
"platforms": {
|
|
124
|
-
"telegram": { "enabled": true, "aiCommand": "codex" }
|
|
125
|
-
"feishu": { "enabled": true, "aiCommand": "codex" },
|
|
126
|
-
"qq": { "enabled": true, "aiCommand": "codebuddy" }
|
|
71
|
+
"telegram": { "enabled": true, "aiCommand": "codex" }
|
|
127
72
|
}
|
|
128
73
|
}
|
|
129
74
|
```
|
|
130
75
|
|
|
131
76
|
### Claude(Agent SDK)
|
|
132
77
|
|
|
133
|
-
|
|
78
|
+
无需本地 `claude` 可执行文件。凭证顺序:环境变量 → **`config.json`** 的 **`env`** → **`~/.claude/settings.json`**。
|
|
134
79
|
|
|
135
80
|
第三方兼容接口示例:
|
|
136
81
|
|
|
@@ -144,8 +89,6 @@ npm run web:build # 仅构建 web/dist
|
|
|
144
89
|
}
|
|
145
90
|
```
|
|
146
91
|
|
|
147
|
-
会继承 `~/.claude/settings.json` 中的插件等配置。
|
|
148
|
-
|
|
149
92
|
### CodeBuddy
|
|
150
93
|
|
|
151
94
|
```bash
|
|
@@ -153,82 +96,53 @@ npm install -g @tencent-ai/codebuddy-code
|
|
|
153
96
|
codebuddy login
|
|
154
97
|
```
|
|
155
98
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### 配置示例
|
|
99
|
+
### 最小配置结构
|
|
159
100
|
|
|
160
101
|
```json
|
|
161
102
|
{
|
|
162
103
|
"aiCommand": "claude",
|
|
163
104
|
"tools": {
|
|
164
|
-
"claude": {
|
|
165
|
-
"workDir": "/path/to/project",
|
|
166
|
-
"skipPermissions": true,
|
|
167
|
-
"timeoutMs": 600000
|
|
168
|
-
},
|
|
169
|
-
"codex": {
|
|
170
|
-
"workDir": "/path/to/project",
|
|
171
|
-
"skipPermissions": true,
|
|
172
|
-
"proxy": "http://127.0.0.1:7890"
|
|
173
|
-
},
|
|
174
|
-
"codebuddy": {
|
|
175
|
-
"skipPermissions": true,
|
|
176
|
-
"timeoutMs": 600000
|
|
177
|
-
}
|
|
105
|
+
"claude": { "workDir": "/path/to/project", "skipPermissions": true, "timeoutMs": 600000 }
|
|
178
106
|
},
|
|
179
107
|
"platforms": {
|
|
180
|
-
"telegram": { "enabled": true, "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
181
|
-
"feishu": { "enabled": false, "appId": "YOUR_FEISHU_APP_ID", "appSecret": "YOUR_FEISHU_APP_SECRET" },
|
|
182
|
-
"qq": { "enabled": false, "appId": "YOUR_QQ_APP_ID", "secret": "YOUR_QQ_APP_SECRET" },
|
|
183
|
-
"wework": { "enabled": false, "corpId": "YOUR_WEWORK_CORP_ID", "secret": "YOUR_WEWORK_SECRET" },
|
|
184
|
-
"dingtalk": {
|
|
185
|
-
"enabled": false,
|
|
186
|
-
"clientId": "YOUR_DINGTALK_CLIENT_ID",
|
|
187
|
-
"clientSecret": "YOUR_DINGTALK_CLIENT_SECRET",
|
|
188
|
-
"cardTemplateId": "YOUR_DINGTALK_AI_CARD_TEMPLATE_ID"
|
|
189
|
-
},
|
|
190
|
-
"workbuddy": { "enabled": false, "accessToken": "", "refreshToken": "", "userId": "" }
|
|
108
|
+
"telegram": { "enabled": true, "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
191
109
|
}
|
|
192
110
|
}
|
|
193
111
|
```
|
|
194
112
|
|
|
195
|
-
|
|
113
|
+
在 **`platforms`** 下按需补充飞书、QQ、企业微信、钉钉、WorkBuddy。完整模板请用 **`open-im init`**。微信建议 **`open-im init`** 走 WorkBuddy OAuth。
|
|
196
114
|
|
|
197
115
|
### 环境变量
|
|
198
116
|
|
|
199
|
-
|
|
117
|
+
可在 **`config.json`** 或环境变量中设置;控制台会展示常用项。常见:**`ANTHROPIC_*`**、**`TELEGRAM_BOT_TOKEN`**、**`OPEN_IM_WEB_PORT`**、**`OPEN_IM_WEB_HOST`**,以及各平台的 `*_APP_ID`、`*_SECRET`、`WORKBUDDY_*` 等。
|
|
200
118
|
|
|
201
|
-
|
|
119
|
+
### 隐私
|
|
202
120
|
|
|
203
|
-
|
|
121
|
+
为改进稳定性,可能记录**匿名**运行信息(不含聊天或 prompt 内容)。若需关闭:环境变量 **`OPEN_IM_TELEMETRY=false`**,或 **`config.json`** 中 **`"telemetry": { "enabled": false }`**。
|
|
204
122
|
|
|
205
|
-
###
|
|
123
|
+
### 平台凭证
|
|
206
124
|
|
|
207
125
|
| 平台 | 说明 |
|
|
208
126
|
| --- | --- |
|
|
209
127
|
| Telegram | [@BotFather](https://t.me/BotFather) |
|
|
210
|
-
| 飞书 | [
|
|
128
|
+
| 飞书 | [开放平台](https://open.feishu.cn/) |
|
|
211
129
|
| QQ | [QQ 开放平台](https://bot.q.qq.com/) |
|
|
212
|
-
| 钉钉 |
|
|
130
|
+
| 钉钉 | 开放平台创建应用,机器人开 **Stream Mode**;可选 **`cardTemplateId`** 走 AI 助理卡片 |
|
|
213
131
|
| 企业微信 | [管理后台](https://work.weixin.qq.com/) |
|
|
214
|
-
| 微信 |
|
|
215
|
-
|
|
216
|
-
**钉钉:** Stream 收消息 + OpenAPI 发消息;配置 `cardTemplateId` 可用 AI 助理流式卡片,失败则回退纯文本;自定义机器人与普通群可能仅支持单条文本;启停通知不会发到钉钉。
|
|
132
|
+
| 微信 | **`open-im init`** → WorkBuddy OAuth |
|
|
217
133
|
|
|
218
134
|
## 故障排除
|
|
219
135
|
|
|
220
136
|
| 现象 | 处理 |
|
|
221
137
|
| --- | --- |
|
|
222
|
-
| Telegram
|
|
223
|
-
| QQ
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
| CodeBuddy 要登录 | 先 `codebuddy login` |
|
|
231
|
-
| WorkBuddy / 微信 | 重跑 `open-im init`;Token 与绑定链接会过期 |
|
|
138
|
+
| Telegram / 网络 | 配置 `proxy` 或 **`TELEGRAM_PROXY`** |
|
|
139
|
+
| QQ | 核对 **`QQ_BOT_APPID`**、**`QQ_BOT_SECRET`**;重复回复请升级版本 |
|
|
140
|
+
| 飞书卡片 | 未配回调时用 **`/mode ask`** 或 **`/mode yolo`** |
|
|
141
|
+
| 企业微信 | 先给机器人发一条消息 |
|
|
142
|
+
| 钉钉 | 开启 Stream Mode;自定义机器人可能仅纯文本 |
|
|
143
|
+
| Codex 断流 | **`CODEX_PROXY`** 或 **`tools.codex.proxy`** |
|
|
144
|
+
| CodeBuddy 登录 | **`codebuddy login`** |
|
|
145
|
+
| WorkBuddy / 微信 | 重跑 **`open-im init`**(Token 会过期) |
|
|
232
146
|
|
|
233
147
|
## License
|
|
234
148
|
|
package/dist/config/types.d.ts
CHANGED
|
@@ -38,6 +38,17 @@ export interface Config {
|
|
|
38
38
|
skipPermissions?: boolean;
|
|
39
39
|
logDir: string;
|
|
40
40
|
logLevel: LogLevel;
|
|
41
|
+
/**
|
|
42
|
+
* 遥测:默认开启;关闭后不写入结构化事件、不上传。
|
|
43
|
+
* 环境变量:OPEN_IM_TELEMETRY、OPEN_IM_TELEMETRY_URL、OPEN_IM_TELEMETRY_TOKEN。
|
|
44
|
+
*/
|
|
45
|
+
telemetry: {
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
/** HTTPS 采集端完整 URL(如 https://example.com/v1/ingest) */
|
|
48
|
+
url?: string;
|
|
49
|
+
/** 可选 Bearer,与采集端一致 */
|
|
50
|
+
token?: string;
|
|
51
|
+
};
|
|
41
52
|
platforms: {
|
|
42
53
|
telegram?: {
|
|
43
54
|
enabled: boolean;
|
|
@@ -180,4 +191,9 @@ export interface FileConfig {
|
|
|
180
191
|
};
|
|
181
192
|
logDir?: string;
|
|
182
193
|
logLevel?: LogLevel;
|
|
194
|
+
telemetry?: {
|
|
195
|
+
enabled?: boolean;
|
|
196
|
+
url?: string;
|
|
197
|
+
token?: string;
|
|
198
|
+
};
|
|
183
199
|
}
|