@wu529778790/open-im 1.11.2-beta.15 → 1.11.2-beta.17
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.
|
@@ -23,8 +23,10 @@ export function setupClawbotHandlers(config, sessionManager) {
|
|
|
23
23
|
});
|
|
24
24
|
const stopTaskCleanup = startTaskCleanup(ctx.runningTasks);
|
|
25
25
|
const platformSender = {
|
|
26
|
-
sendThinkingMessage: async (
|
|
27
|
-
|
|
26
|
+
sendThinkingMessage: async (chatId, _replyToMessageId, _toolId) => {
|
|
27
|
+
// ClawBot 不支持 typing indicator,先发一条"思考中"消息给用户反馈
|
|
28
|
+
await sendTextReply(chatId, '🤔 正在处理...');
|
|
29
|
+
return 'clawbot_thinking';
|
|
28
30
|
},
|
|
29
31
|
sendTextReply: async (chatId, text) => {
|
|
30
32
|
await sendTextReply(chatId, text);
|
package/dist/index.js
CHANGED
|
@@ -137,6 +137,55 @@ const PLATFORM_DISPLAY_NAMES = {
|
|
|
137
137
|
workbuddy: '微信',
|
|
138
138
|
clawbot: '微信 (ClawBot)',
|
|
139
139
|
};
|
|
140
|
+
/** 读取已启用的插件列表 */
|
|
141
|
+
function getEnabledPlugins() {
|
|
142
|
+
try {
|
|
143
|
+
const { readFileSync, existsSync } = require("fs");
|
|
144
|
+
const { join } = require("path");
|
|
145
|
+
const { homedir } = require("os");
|
|
146
|
+
const settingsPath = join(homedir(), ".claude", "settings.json");
|
|
147
|
+
if (!existsSync(settingsPath))
|
|
148
|
+
return [];
|
|
149
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
150
|
+
const plugins = settings.enabledPlugins ?? {};
|
|
151
|
+
return Object.entries(plugins)
|
|
152
|
+
.filter(([, v]) => v === true)
|
|
153
|
+
.map(([k]) => k.split("@")[0]);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 统一通知格式模板
|
|
161
|
+
* 所有发送给 IM 的通知都使用这个格式,保持一致性
|
|
162
|
+
*/
|
|
163
|
+
function buildNotification(opts) {
|
|
164
|
+
const lines = [];
|
|
165
|
+
// 标题行
|
|
166
|
+
lines.push(`${opts.emoji} ${opts.title}`);
|
|
167
|
+
// 详情行
|
|
168
|
+
const details = [];
|
|
169
|
+
if (opts.platform)
|
|
170
|
+
details.push(`📱 平台: ${opts.platform}`);
|
|
171
|
+
if (opts.aiCommand)
|
|
172
|
+
details.push(`🤖 AI: ${opts.aiCommand}`);
|
|
173
|
+
if (opts.dir)
|
|
174
|
+
details.push(`📁 目录: ${opts.dir}`);
|
|
175
|
+
const plugins = getEnabledPlugins();
|
|
176
|
+
if (plugins.length > 0)
|
|
177
|
+
details.push(`🧩 插件: ${plugins.join(", ")}`);
|
|
178
|
+
if (opts.uptime)
|
|
179
|
+
details.push(`⏱️ 运行: ${opts.uptime}`);
|
|
180
|
+
if (details.length > 0) {
|
|
181
|
+
lines.push("", ...details);
|
|
182
|
+
}
|
|
183
|
+
// 额外信息
|
|
184
|
+
if (opts.extra?.length) {
|
|
185
|
+
lines.push("", ...opts.extra);
|
|
186
|
+
}
|
|
187
|
+
return lines.join("\n");
|
|
188
|
+
}
|
|
140
189
|
function buildStartupMessage(platform, appVersion, aiCommand, defaultWorkDir, sessionManager) {
|
|
141
190
|
let sessionDir;
|
|
142
191
|
// Telegram 私聊、企业微信当前实现里,活跃 chatId 可直接对应到 session userId。
|
|
@@ -149,41 +198,21 @@ function buildStartupMessage(platform, appVersion, aiCommand, defaultWorkDir, se
|
|
|
149
198
|
const platformName = PLATFORM_DISPLAY_NAMES[platform] ?? platform;
|
|
150
199
|
const toolName = getAIToolDisplayName(aiCommand);
|
|
151
200
|
const dir = sessionDir ? escapePathForMarkdown(sessionDir) : '发送 `/pwd` 查看';
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (existsSync(settingsPath)) {
|
|
160
|
-
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
161
|
-
const plugins = settings.enabledPlugins ?? {};
|
|
162
|
-
const enabled = Object.entries(plugins)
|
|
163
|
-
.filter(([, v]) => v === true)
|
|
164
|
-
.map(([k]) => k.split("@")[0]); // 只取插件名,去掉 @scope
|
|
165
|
-
if (enabled.length > 0) {
|
|
166
|
-
pluginLines.push("", `🧩 插件: ${enabled.join(", ")}`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
catch { /* ignore */ }
|
|
171
|
-
return [
|
|
172
|
-
`✅ open-im v${appVersion} 已就绪`,
|
|
173
|
-
"",
|
|
174
|
-
`📱 平台: ${platformName}`,
|
|
175
|
-
`🤖 AI: ${toolName}`,
|
|
176
|
-
`📁 目录: ${dir}`,
|
|
177
|
-
...pluginLines,
|
|
178
|
-
].join("\n\n");
|
|
201
|
+
return buildNotification({
|
|
202
|
+
emoji: "✅",
|
|
203
|
+
title: `open-im v${appVersion} 已就绪`,
|
|
204
|
+
platform: platformName,
|
|
205
|
+
aiCommand: toolName,
|
|
206
|
+
dir,
|
|
207
|
+
});
|
|
179
208
|
}
|
|
180
209
|
function buildShutdownMessage(uptimeMinutes) {
|
|
181
|
-
const
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
"",
|
|
185
|
-
|
|
186
|
-
|
|
210
|
+
const uptimeStr = uptimeMinutes < 1 ? '< 1 分钟' : `${uptimeMinutes} 分钟`;
|
|
211
|
+
return buildNotification({
|
|
212
|
+
emoji: "🛑",
|
|
213
|
+
title: "open-im 正在关闭",
|
|
214
|
+
uptime: uptimeStr,
|
|
215
|
+
});
|
|
187
216
|
}
|
|
188
217
|
export async function main() {
|
|
189
218
|
const startupCwd = process.cwd();
|
|
@@ -24,17 +24,17 @@ export function setupWorkBuddyHandlers(config, sessionManager) {
|
|
|
24
24
|
});
|
|
25
25
|
// Start task cleanup
|
|
26
26
|
const stopTaskCleanup = startTaskCleanup(ctx.runningTasks);
|
|
27
|
-
// WorkBuddy-specific sender callbacks
|
|
27
|
+
// WorkBuddy-specific sender callbacks
|
|
28
28
|
const platformSender = {
|
|
29
|
-
sendThinkingMessage: async (
|
|
30
|
-
// WorkBuddy
|
|
31
|
-
|
|
29
|
+
sendThinkingMessage: async (chatId, _replyToMessageId, _toolId) => {
|
|
30
|
+
// WorkBuddy 不支持 typing indicator,先发一条"思考中"消息给用户反馈
|
|
31
|
+
await sendTextReply(null, chatId, '🤔 正在处理...', '');
|
|
32
|
+
return 'workbuddy_thinking';
|
|
32
33
|
},
|
|
33
34
|
sendTextReply: async (chatId, text) => {
|
|
34
35
|
await sendTextReply(null, chatId, text, '');
|
|
35
36
|
},
|
|
36
37
|
startTyping: (_chatId) => {
|
|
37
|
-
// WorkBuddy doesn't support typing indicators
|
|
38
38
|
return () => { };
|
|
39
39
|
},
|
|
40
40
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wu529778790/open-im",
|
|
3
|
-
"version": "1.11.2-beta.
|
|
3
|
+
"version": "1.11.2-beta.17",
|
|
4
4
|
"description": "Your AI coding assistant, in every chat app. Multi-platform IM bridge for Claude Code, Codex, and CodeBuddy.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|