@wu529778790/open-im 1.11.2-beta.14 → 1.11.2-beta.16
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/dist/index.js +62 -13
- package/package.json +1 -1
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,21 +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
|
-
return
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
201
|
+
return buildNotification({
|
|
202
|
+
emoji: "✅",
|
|
203
|
+
title: `open-im v${appVersion} 已就绪`,
|
|
204
|
+
platform: platformName,
|
|
205
|
+
aiCommand: toolName,
|
|
206
|
+
dir,
|
|
207
|
+
});
|
|
159
208
|
}
|
|
160
209
|
function buildShutdownMessage(uptimeMinutes) {
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
|
|
164
|
-
"",
|
|
165
|
-
|
|
166
|
-
|
|
210
|
+
const uptimeStr = uptimeMinutes < 1 ? '< 1 分钟' : `${uptimeMinutes} 分钟`;
|
|
211
|
+
return buildNotification({
|
|
212
|
+
emoji: "🛑",
|
|
213
|
+
title: "open-im 正在关闭",
|
|
214
|
+
uptime: uptimeStr,
|
|
215
|
+
});
|
|
167
216
|
}
|
|
168
217
|
export async function main() {
|
|
169
218
|
const startupCwd = process.cwd();
|
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.16",
|
|
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",
|