@wu529778790/open-im 1.11.1-beta.1 → 1.11.1-beta.3
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 +23 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import { destroyAllLiveChildren } from "./shared/process-kill.js";
|
|
|
35
35
|
import { initLogger, createLogger, closeLogger, emitStructuredEvent, shutdownLoggerTelemetry, } from "./logger.js";
|
|
36
36
|
import { APP_HOME, SHUTDOWN_PORT } from "./constants.js";
|
|
37
37
|
import { createRequire } from "node:module";
|
|
38
|
-
import { escapePathForMarkdown } from "./shared/utils.js";
|
|
38
|
+
import { escapePathForMarkdown, getAIToolDisplayName } from "./shared/utils.js";
|
|
39
39
|
import { applyOpenImGitCoauthorToProcessEnv } from "./shared/git-coauthor.js";
|
|
40
40
|
import { emitInterruptedTerminals } from "./shared/task-cleanup.js";
|
|
41
41
|
const require = createRequire(import.meta.url);
|
|
@@ -127,6 +127,15 @@ async function sendLifecycleNotification(platform, message) {
|
|
|
127
127
|
await mod.sendNotification(chatId, message);
|
|
128
128
|
log.info(`[${platform}] Lifecycle notification sent successfully`);
|
|
129
129
|
}
|
|
130
|
+
const PLATFORM_DISPLAY_NAMES = {
|
|
131
|
+
telegram: 'Telegram',
|
|
132
|
+
feishu: '飞书',
|
|
133
|
+
wework: '企业微信',
|
|
134
|
+
dingtalk: '钉钉',
|
|
135
|
+
qq: 'QQ',
|
|
136
|
+
workbuddy: '微信',
|
|
137
|
+
clawbot: '微信 (ClawBot)',
|
|
138
|
+
};
|
|
130
139
|
function buildStartupMessage(platform, appVersion, aiCommand, defaultWorkDir, sessionManager) {
|
|
131
140
|
let sessionDir;
|
|
132
141
|
// Telegram 私聊、企业微信当前实现里,活跃 chatId 可直接对应到 session userId。
|
|
@@ -136,28 +145,24 @@ function buildStartupMessage(platform, appVersion, aiCommand, defaultWorkDir, se
|
|
|
136
145
|
sessionDir = sessionManager.getWorkDir(activeChatId);
|
|
137
146
|
}
|
|
138
147
|
}
|
|
139
|
-
const
|
|
140
|
-
|
|
148
|
+
const platformName = PLATFORM_DISPLAY_NAMES[platform] ?? platform;
|
|
149
|
+
const toolName = getAIToolDisplayName(aiCommand);
|
|
150
|
+
const dir = sessionDir ? escapePathForMarkdown(sessionDir) : '发送 `/pwd` 查看';
|
|
151
|
+
return [
|
|
152
|
+
`✅ open-im v${appVersion} 已就绪`,
|
|
141
153
|
"",
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
];
|
|
146
|
-
if (sessionDir) {
|
|
147
|
-
lines.push(`- 会话目录: ${escapePathForMarkdown(sessionDir)}`);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
lines.push(`- 会话目录: 发送 \`/pwd\` 查看`);
|
|
151
|
-
}
|
|
152
|
-
return lines.join("\n");
|
|
154
|
+
`📱 平台: ${platformName}`,
|
|
155
|
+
`🤖 AI: ${toolName}`,
|
|
156
|
+
`📁 目录: ${dir}`,
|
|
157
|
+
].join("\n\n");
|
|
153
158
|
}
|
|
154
159
|
function buildShutdownMessage(uptimeMinutes) {
|
|
160
|
+
const uptime = uptimeMinutes < 1 ? '< 1' : String(uptimeMinutes);
|
|
155
161
|
return [
|
|
156
|
-
|
|
162
|
+
`🛑 open-im 正在关闭`,
|
|
157
163
|
"",
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
].join("\n");
|
|
164
|
+
`⏱️ 运行时长: ${uptime} 分钟`,
|
|
165
|
+
].join("\n\n");
|
|
161
166
|
}
|
|
162
167
|
export async function main() {
|
|
163
168
|
const startupCwd = process.cwd();
|