@wu529778790/open-im 1.10.9-beta.2 → 1.10.9-beta.21
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 +43 -62
- package/README.zh-CN.md +43 -62
- package/dist/adapters/claude-sdk-adapter.d.ts +13 -0
- package/dist/adapters/claude-sdk-adapter.js +221 -23
- package/dist/adapters/registry.js +3 -0
- package/dist/channels/capabilities.js +5 -0
- package/dist/clawbot/client.d.ts +14 -0
- package/dist/clawbot/client.js +299 -0
- package/dist/clawbot/event-handler.d.ts +12 -0
- package/dist/clawbot/event-handler.js +85 -0
- package/dist/clawbot/message-sender.d.ts +18 -0
- package/dist/clawbot/message-sender.js +109 -0
- package/dist/clawbot/qr-login.d.ts +33 -0
- package/dist/clawbot/qr-login.js +120 -0
- package/dist/clawbot/types.d.ts +111 -0
- package/dist/clawbot/types.js +7 -0
- package/dist/codebuddy/cli-runner.js +31 -2
- package/dist/codex/cli-runner.js +28 -2
- package/dist/config/file-io.d.ts +6 -3
- package/dist/config/file-io.js +12 -7
- package/dist/config/types.d.ts +17 -1
- package/dist/config-web-page-i18n.d.ts +24 -2
- package/dist/config-web-page-i18n.js +24 -2
- package/dist/config-web.js +79 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +38 -2
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +6 -0
- package/dist/dingtalk/client.js +2 -1
- package/dist/dingtalk/event-handler.js +1 -1
- package/dist/index.js +50 -0
- package/dist/qq/client.js +7 -1
- package/dist/queue/request-queue.js +11 -10
- package/dist/setup.js +131 -3
- package/dist/shared/active-chats.d.ts +2 -2
- package/dist/shared/ai-task.d.ts +14 -0
- package/dist/shared/ai-task.js +57 -9
- package/dist/shared/process-kill.d.ts +24 -0
- package/dist/shared/process-kill.js +79 -0
- package/dist/shared/reconnect.d.ts +28 -0
- package/dist/shared/reconnect.js +56 -0
- package/dist/shared/task-cleanup.d.ts +16 -0
- package/dist/shared/task-cleanup.js +34 -1
- package/dist/telegram/client.js +7 -1
- package/dist/telemetry/telemetry-upload.js +1 -1
- package/dist/wework/client.js +17 -5
- package/dist/wework/event-handler.js +3 -0
- package/dist/workbuddy/centrifuge-client.d.ts +4 -0
- package/dist/workbuddy/centrifuge-client.js +76 -28
- package/dist/workbuddy/client.js +39 -2
- package/package.json +1 -1
- package/web/dist/assets/index-BaLTMeeF.js +57 -0
- package/web/dist/index.html +1 -1
- package/dist/config/credentials.d.ts +0 -19
- package/dist/config/credentials.js +0 -36
- package/web/dist/assets/index-B-oVSMUp.js +0 -57
package/README.md
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
**English** · [中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
Multi-platform IM bridge for AI CLI tools. Connect Telegram, Feishu, WeCom, DingTalk, QQ, and WeChat (
|
|
5
|
+
Multi-platform IM bridge for AI CLI tools. Connect Telegram, Feishu, WeCom, DingTalk, QQ, WeChat (WorkBuddy), and WeChat (ClawBot) to Claude Code, Codex, and CodeBuddy — use your AI coding assistant from any phone or chat window.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+

|
|
6
10
|
|
|
7
11
|
## Features
|
|
8
12
|
|
|
9
|
-
- **
|
|
13
|
+
- **Seven IM platforms** — Telegram, Feishu, WeCom, DingTalk, QQ, WorkBuddy, ClawBot
|
|
10
14
|
- **Three AI backends** — Claude (Agent SDK), Codex, CodeBuddy (per-platform override supported)
|
|
11
15
|
- **Streaming, media, sessions** — live output where supported; `/new` for a fresh AI session
|
|
12
16
|
- **Web UI** — dashboard bundled in the package; default **`http://127.0.0.1:39282`**
|
|
@@ -38,16 +42,6 @@ Config: **`~/.open-im/config.json`**
|
|
|
38
42
|
|
|
39
43
|
After `start`, the CLI prints the dashboard URL (default **`http://127.0.0.1:39282`**).
|
|
40
44
|
|
|
41
|
-
## Git co-authors
|
|
42
|
-
|
|
43
|
-
`Co-authored-by` is appended by default on AI-driven commits. **Disable:** set **`OPEN_IM_GIT_COAUTHOR=0`** in the environment and restart the bridge.
|
|
44
|
-
|
|
45
|
-
## Web dashboard
|
|
46
|
-
|
|
47
|
-
`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.
|
|
48
|
-
|
|
49
|
-
**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`**.
|
|
50
|
-
|
|
51
45
|
## Chat commands
|
|
52
46
|
|
|
53
47
|
| Command | Description |
|
|
@@ -60,33 +54,54 @@ After `start`, the CLI prints the dashboard URL (default **`http://127.0.0.1:392
|
|
|
60
54
|
| `/cd` / `/pwd` | Working directory |
|
|
61
55
|
| `/allow` / `/y`, `/deny` / `/n` | Permission prompts |
|
|
62
56
|
|
|
63
|
-
Session
|
|
57
|
+
## Session continuity
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
open-im and Claude Code CLI share the same session storage. In the same directory, you can seamlessly switch between phone and computer.
|
|
66
60
|
|
|
67
|
-
|
|
61
|
+
**Phone → Computer:** open-im auto-resumes the latest CLI session — no configuration needed.
|
|
62
|
+
|
|
63
|
+
**Computer → Phone:** use `claude --continue` (or `claude -c`) to pick up the phone conversation.
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
```
|
|
66
|
+
# On computer
|
|
67
|
+
cd /my-project && claude # work as usual, then Ctrl+C
|
|
68
|
+
|
|
69
|
+
# On phone (via IM)
|
|
70
|
+
"help me fix the login bug" # open-im auto-resumes the same session
|
|
71
|
+
|
|
72
|
+
# Back on computer
|
|
73
|
+
claude -c # continues the phone conversation
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> Only one side can be active at a time. Exit the CLI before sending messages from the phone, and vice versa.
|
|
77
|
+
|
|
78
|
+
## Git co-authors
|
|
79
|
+
|
|
80
|
+
`Co-authored-by` is appended by default on AI-driven commits. **Disable:** set **`OPEN_IM_GIT_COAUTHOR=0`** in the environment and restart the bridge.
|
|
81
|
+
|
|
82
|
+
## Minimal config
|
|
70
83
|
|
|
71
84
|
```json
|
|
72
85
|
{
|
|
86
|
+
"tools": {
|
|
87
|
+
"claude": { "workDir": "/path/to/project", "skipPermissions": true, "timeoutMs": 600000 }
|
|
88
|
+
},
|
|
73
89
|
"platforms": {
|
|
74
|
-
"telegram": { "enabled": true, "
|
|
90
|
+
"telegram": { "enabled": true, "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
93
|
```
|
|
78
94
|
|
|
79
|
-
|
|
95
|
+
Add other platforms under **`platforms`** as needed. Run **`open-im init`** for a full template.
|
|
80
96
|
|
|
81
|
-
|
|
97
|
+
### Claude (Agent SDK)
|
|
82
98
|
|
|
83
|
-
Third-party / compatible API
|
|
99
|
+
No local `claude` binary required. Third-party / compatible API:
|
|
84
100
|
|
|
85
101
|
```json
|
|
86
102
|
{
|
|
87
103
|
"tools": {
|
|
88
104
|
"claude": {
|
|
89
|
-
"workDir": "/path/to/project",
|
|
90
105
|
"env": {
|
|
91
106
|
"ANTHROPIC_AUTH_TOKEN": "your-token",
|
|
92
107
|
"ANTHROPIC_BASE_URL": "https://your-api-endpoint",
|
|
@@ -97,59 +112,25 @@ Third-party / compatible API example:
|
|
|
97
112
|
}
|
|
98
113
|
```
|
|
99
114
|
|
|
100
|
-
###
|
|
115
|
+
### Per-platform AI
|
|
101
116
|
|
|
102
|
-
|
|
103
|
-
npm install -g @tencent-ai/codebuddy-code
|
|
104
|
-
codebuddy login
|
|
105
|
-
```
|
|
117
|
+
Set **`platforms.<name>.aiCommand`** (`claude` / `codex` / `codebuddy`) per channel. Default: `claude`.
|
|
106
118
|
|
|
107
|
-
###
|
|
119
|
+
### Web dashboard
|
|
108
120
|
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
"tools": {
|
|
112
|
-
"claude": { "workDir": "/path/to/project", "skipPermissions": true, "timeoutMs": 600000 }
|
|
113
|
-
},
|
|
114
|
-
"platforms": {
|
|
115
|
-
"telegram": { "enabled": true, "aiCommand": "claude", "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
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`**.
|
|
121
|
+
`open-im start` serves the built-in SPA and **`/api/*`** on **`OPEN_IM_WEB_PORT`** (default **39282**). For LAN access: `export OPEN_IM_WEB_HOST=0.0.0.0`.
|
|
121
122
|
|
|
122
123
|
### Environment variables
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
Typical keys: **`ANTHROPIC_*`** (shell or **`tools.claude.env`**), **`TELEGRAM_BOT_TOKEN`**, **`OPEN_IM_WEB_PORT`**, **`OPEN_IM_WEB_HOST`**, plus platform-specific `*_APP_ID`, `*_SECRET`, `WORKBUDDY_*`, etc.
|
|
125
126
|
|
|
126
127
|
### Privacy
|
|
127
128
|
|
|
128
129
|
**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`**.
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
| Platform | Notes |
|
|
133
|
-
| --- | --- |
|
|
134
|
-
| Telegram | [@BotFather](https://t.me/BotFather) |
|
|
135
|
-
| Feishu | [Open Platform](https://open.feishu.cn/) |
|
|
136
|
-
| QQ | [QQ Open Platform](https://bot.q.qq.com/) |
|
|
137
|
-
| DingTalk | Open Platform — bot **Stream Mode**; optional **`cardTemplateId`** for AI assistant cards |
|
|
138
|
-
| WeCom | [Admin](https://work.weixin.qq.com/) |
|
|
139
|
-
| WeChat | **`open-im init`** → WorkBuddy OAuth |
|
|
131
|
+
## Platform setup & troubleshooting
|
|
140
132
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
| Issue | What to try |
|
|
144
|
-
| --- | --- |
|
|
145
|
-
| Telegram / network | `proxy` or **`TELEGRAM_PROXY`** |
|
|
146
|
-
| QQ | Check **`QQ_BOT_APPID`** / **`QQ_BOT_SECRET`**; update if duplicate replies |
|
|
147
|
-
| Feishu cards | **`/mode ask`** or **`/mode yolo`** without card callbacks |
|
|
148
|
-
| WeCom | Send the bot a message first |
|
|
149
|
-
| DingTalk | Stream Mode + credentials; custom bots may be text-only |
|
|
150
|
-
| Codex disconnect | **`CODEX_PROXY`** or **`tools.codex.proxy`** |
|
|
151
|
-
| CodeBuddy login | **`codebuddy login`** |
|
|
152
|
-
| WorkBuddy | Re-run **`open-im init`** (tokens expire) |
|
|
133
|
+
See **[docs/platforms.md](./docs/platforms.md)** for detailed per-platform configuration, credential setup, and troubleshooting.
|
|
153
134
|
|
|
154
135
|
## License
|
|
155
136
|
|
package/README.zh-CN.md
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md) · **中文**
|
|
4
4
|
|
|
5
|
-
多平台 IM 桥接:把 Telegram、飞书、企业微信、钉钉、QQ、微信(WorkBuddy)接到 Claude Code、Codex、CodeBuddy,在手机或聊天里使用 AI 编程助手。
|
|
5
|
+
多平台 IM 桥接:把 Telegram、飞书、企业微信、钉钉、QQ、微信(WorkBuddy)、微信(ClawBot)接到 Claude Code、Codex、CodeBuddy,在手机或聊天里使用 AI 编程助手。
|
|
6
|
+
|
|
7
|
+
## 架构
|
|
8
|
+
|
|
9
|
+

|
|
6
10
|
|
|
7
11
|
## 功能特性
|
|
8
12
|
|
|
9
|
-
-
|
|
13
|
+
- **七个 IM 平台** — Telegram、飞书、企业微信、钉钉、QQ、WorkBuddy、ClawBot
|
|
10
14
|
- **三种 AI 后端** — Claude(Agent SDK)、Codex、CodeBuddy(可按平台覆盖)
|
|
11
15
|
- **流式、多媒体、会话** — 视平台能力;`/new` 开启新 AI 会话
|
|
12
16
|
- **Web 控制台** — 随包内置,默认 **`http://127.0.0.1:39282`**
|
|
@@ -38,16 +42,6 @@ npx @wu529778790/open-im start
|
|
|
38
42
|
|
|
39
43
|
`start` 后会提示控制台地址(默认 **`http://127.0.0.1:39282`**)。
|
|
40
44
|
|
|
41
|
-
## Git 共同作者
|
|
42
|
-
|
|
43
|
-
默认在 AI 发起的提交里追加 `Co-authored-by`。**关闭**:设置环境变量 **`OPEN_IM_GIT_COAUTHOR=0`** 并重启桥接。
|
|
44
|
-
|
|
45
|
-
## Web 控制台
|
|
46
|
-
|
|
47
|
-
`open-im start` / `open-im dashboard` 在 **`OPEN_IM_WEB_PORT`**(默认 **39282**)提供内置页面与 **`/api/*`**。浏览器打开 **`http://127.0.0.1:39282`** 即可(与 API 同源)。反向代理时可设 **`OPEN_IM_PUBLIC_WEB_URL`**。
|
|
48
|
-
|
|
49
|
-
**局域网 / 远程:** `export OPEN_IM_WEB_HOST=0.0.0.0` — 首次外网访问可能需一次性登录链接。可选 **`OPEN_IM_ALLOW_REMOTE_API`**、**`OPEN_IM_CORS_ORIGINS`**。
|
|
50
|
-
|
|
51
45
|
## IM 内命令
|
|
52
46
|
|
|
53
47
|
| 命令 | 说明 |
|
|
@@ -60,33 +54,54 @@ npx @wu529778790/open-im start
|
|
|
60
54
|
| `/cd` / `/pwd` | 工作目录 |
|
|
61
55
|
| `/allow` / `/y`、`/deny` / `/n` | 权限确认 |
|
|
62
56
|
|
|
63
|
-
|
|
57
|
+
## 会话接力
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
open-im 和 Claude Code CLI 共享同一份 session 存储。在同一个目录下,手机和电脑可以无缝切换。
|
|
66
60
|
|
|
67
|
-
|
|
61
|
+
**手机接电脑:** open-im 自动恢复同目录下最新的 CLI session,无需配置。
|
|
62
|
+
|
|
63
|
+
**电脑接手机:** 使用 `claude --continue`(或 `claude -c`)接上 open-im 端的对话。
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
```bash
|
|
66
|
+
# 电脑端
|
|
67
|
+
cd /my-project && claude # 正常工作,退出时 Ctrl+C
|
|
68
|
+
|
|
69
|
+
# 手机端(IM 消息)
|
|
70
|
+
"帮我修复登录 bug" # open-im 自动接续同一个 session
|
|
71
|
+
|
|
72
|
+
# 回到电脑端
|
|
73
|
+
claude -c # 接上手机端的对话
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> 同一时刻只能有一端活跃。从手机发消息前先退出 CLI,反之亦然。
|
|
77
|
+
|
|
78
|
+
## Git 共同作者
|
|
79
|
+
|
|
80
|
+
默认在 AI 发起的提交里追加 `Co-authored-by`。**关闭**:设置环境变量 **`OPEN_IM_GIT_COAUTHOR=0`** 并重启桥接。
|
|
81
|
+
|
|
82
|
+
## 最小配置
|
|
70
83
|
|
|
71
84
|
```json
|
|
72
85
|
{
|
|
86
|
+
"tools": {
|
|
87
|
+
"claude": { "workDir": "/path/to/project", "skipPermissions": true, "timeoutMs": 600000 }
|
|
88
|
+
},
|
|
73
89
|
"platforms": {
|
|
74
|
-
"telegram": { "enabled": true, "
|
|
90
|
+
"telegram": { "enabled": true, "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
93
|
```
|
|
78
94
|
|
|
79
|
-
|
|
95
|
+
在 **`platforms`** 下按需补充其他平台。完整模板请用 **`open-im init`**。
|
|
80
96
|
|
|
81
|
-
|
|
97
|
+
### Claude(Agent SDK)
|
|
82
98
|
|
|
83
|
-
|
|
99
|
+
无需本地 `claude` 可执行文件。第三方兼容接口示例:
|
|
84
100
|
|
|
85
101
|
```json
|
|
86
102
|
{
|
|
87
103
|
"tools": {
|
|
88
104
|
"claude": {
|
|
89
|
-
"workDir": "/path/to/project",
|
|
90
105
|
"env": {
|
|
91
106
|
"ANTHROPIC_AUTH_TOKEN": "your-token",
|
|
92
107
|
"ANTHROPIC_BASE_URL": "https://your-api-endpoint",
|
|
@@ -97,59 +112,25 @@ npx @wu529778790/open-im start
|
|
|
97
112
|
}
|
|
98
113
|
```
|
|
99
114
|
|
|
100
|
-
###
|
|
115
|
+
### 按平台指定 AI
|
|
101
116
|
|
|
102
|
-
|
|
103
|
-
npm install -g @tencent-ai/codebuddy-code
|
|
104
|
-
codebuddy login
|
|
105
|
-
```
|
|
117
|
+
在每个平台上设置 **`platforms.<name>.aiCommand`**(`claude` / `codex` / `codebuddy`)。默认 `claude`。
|
|
106
118
|
|
|
107
|
-
###
|
|
119
|
+
### Web 控制台
|
|
108
120
|
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
"tools": {
|
|
112
|
-
"claude": { "workDir": "/path/to/project", "skipPermissions": true, "timeoutMs": 600000 }
|
|
113
|
-
},
|
|
114
|
-
"platforms": {
|
|
115
|
-
"telegram": { "enabled": true, "aiCommand": "claude", "botToken": "YOUR_TELEGRAM_BOT_TOKEN" }
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
在 **`platforms`** 下按需补充飞书、QQ、企业微信、钉钉、WorkBuddy。完整模板请用 **`open-im init`**。微信建议 **`open-im init`** 走 WorkBuddy OAuth。
|
|
121
|
+
`open-im start` 在 **`OPEN_IM_WEB_PORT`**(默认 **39282**)提供内置页面与 **`/api/*`**。局域网访问:`export OPEN_IM_WEB_HOST=0.0.0.0`。
|
|
121
122
|
|
|
122
123
|
### 环境变量
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
常见:**`ANTHROPIC_*`**(shell 或 **`tools.claude.env`**)、**`TELEGRAM_BOT_TOKEN`**、**`OPEN_IM_WEB_PORT`**、**`OPEN_IM_WEB_HOST`**,以及各平台的 `*_APP_ID`、`*_SECRET`、`WORKBUDDY_*` 等。
|
|
125
126
|
|
|
126
127
|
### 隐私
|
|
127
128
|
|
|
128
129
|
为改进稳定性,可能记录**匿名**运行信息(不含聊天或 prompt 内容)。若需关闭:环境变量 **`OPEN_IM_TELEMETRY=false`**,或 **`config.json`** 中 **`"telemetry": { "enabled": false }`**。
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
| 平台 | 说明 |
|
|
133
|
-
| --- | --- |
|
|
134
|
-
| Telegram | [@BotFather](https://t.me/BotFather) |
|
|
135
|
-
| 飞书 | [开放平台](https://open.feishu.cn/) |
|
|
136
|
-
| QQ | [QQ 开放平台](https://bot.q.qq.com/) |
|
|
137
|
-
| 钉钉 | 开放平台创建应用,机器人开 **Stream Mode**;可选 **`cardTemplateId`** 走 AI 助理卡片 |
|
|
138
|
-
| 企业微信 | [管理后台](https://work.weixin.qq.com/) |
|
|
139
|
-
| 微信 | **`open-im init`** → WorkBuddy OAuth |
|
|
131
|
+
## 平台配置与故障排除
|
|
140
132
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
| 现象 | 处理 |
|
|
144
|
-
| --- | --- |
|
|
145
|
-
| Telegram / 网络 | 配置 `proxy` 或 **`TELEGRAM_PROXY`** |
|
|
146
|
-
| QQ | 核对 **`QQ_BOT_APPID`**、**`QQ_BOT_SECRET`**;重复回复请升级版本 |
|
|
147
|
-
| 飞书卡片 | 未配回调时用 **`/mode ask`** 或 **`/mode yolo`** |
|
|
148
|
-
| 企业微信 | 先给机器人发一条消息 |
|
|
149
|
-
| 钉钉 | 开启 Stream Mode;自定义机器人可能仅纯文本 |
|
|
150
|
-
| Codex 断流 | **`CODEX_PROXY`** 或 **`tools.codex.proxy`** |
|
|
151
|
-
| CodeBuddy 登录 | **`codebuddy login`** |
|
|
152
|
-
| WorkBuddy / 微信 | 重跑 **`open-im init`**(Token 会过期) |
|
|
133
|
+
详见 **[docs/platforms.zh-CN.md](./docs/platforms.zh-CN.md)**。
|
|
153
134
|
|
|
154
135
|
## License
|
|
155
136
|
|
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
* 认证:ANTHROPIC_API_KEY 或 CLAUDE_CODE_OAUTH_TOKEN
|
|
10
10
|
*/
|
|
11
11
|
import type { ToolAdapter, RunCallbacks, RunOptions, RunHandle } from './tool-adapter.interface.js';
|
|
12
|
+
interface ClaudeSessionMeta {
|
|
13
|
+
sessionId: string;
|
|
14
|
+
mtime: number;
|
|
15
|
+
filePath: string;
|
|
16
|
+
size: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 扫描 ~/.claude/projects/<encoded-path>/ 找到最新的 CLI session。
|
|
20
|
+
* 只返回 JSONL 文件(排除子目录如 subagents/),按修改时间倒序。
|
|
21
|
+
* @param homeOverride 测试用:覆盖 homedir() 的返回值
|
|
22
|
+
*/
|
|
23
|
+
export declare function findLatestClaudeSession(workDir: string, homeOverride?: string): ClaudeSessionMeta | undefined;
|
|
12
24
|
/**
|
|
13
25
|
* 由 initAdapters 根据配置调用。ttlMinutes≤0 时关闭空闲回收(仍受 MAX_ACTIVE_SESSIONS 限制)。
|
|
14
26
|
*/
|
|
@@ -26,3 +38,4 @@ export declare class ClaudeSDKAdapter implements ToolAdapter {
|
|
|
26
38
|
static removeSession(sessionId: string): void;
|
|
27
39
|
run(prompt: string, sessionId: string | undefined, workDir: string, callbacks: RunCallbacks, options?: RunOptions): RunHandle;
|
|
28
40
|
}
|
|
41
|
+
export {};
|