@wu529778790/open-im 1.10.9-beta.1 → 1.10.9-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/README.md +4 -0
- package/README.zh-CN.md +4 -0
- package/dist/cli.js +9 -2
- package/dist/config/file-io.d.ts +6 -3
- package/dist/config/file-io.js +12 -7
- package/package.json +1 -1
- package/dist/config/credentials.d.ts +0 -19
- package/dist/config/credentials.js +0 -36
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
Multi-platform IM bridge for AI CLI tools. Connect Telegram, Feishu, WeCom, DingTalk, QQ, and WeChat (WorkBuddy) to Claude Code, Codex, and CodeBuddy — use your AI coding assistant from any phone or chat window.
|
|
6
6
|
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
7
11
|
## Features
|
|
8
12
|
|
|
9
13
|
- **Six IM platforms** — Telegram, Feishu, WeCom, DingTalk, QQ, WorkBuddy
|
package/README.zh-CN.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -97,21 +97,28 @@ async function cmdStop() {
|
|
|
97
97
|
}
|
|
98
98
|
async function cmdRestart() {
|
|
99
99
|
const status = getManagerStatus();
|
|
100
|
+
let restartedExistingInstance = false;
|
|
100
101
|
if (status.pid) {
|
|
101
102
|
await stopBackgroundService();
|
|
102
103
|
const stopped = await stopManagerProcess();
|
|
103
104
|
console.log("\nopen-im stopped.");
|
|
104
105
|
console.log(` pid: ${stopped.pid}`);
|
|
106
|
+
restartedExistingInstance = true;
|
|
105
107
|
}
|
|
106
108
|
else {
|
|
107
|
-
console.log("
|
|
109
|
+
console.log("\nopen-im is not running in the background.");
|
|
108
110
|
}
|
|
109
111
|
if (!(await ensureConfigured("start"))) {
|
|
110
112
|
process.exit(1);
|
|
111
113
|
}
|
|
112
114
|
await checkAndUpdate();
|
|
113
115
|
const child = await startManagerProcess(process.cwd());
|
|
114
|
-
|
|
116
|
+
if (restartedExistingInstance) {
|
|
117
|
+
console.log("\nopen-im restarted in the background.");
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
console.log("\nopen-im started in the background.");
|
|
121
|
+
}
|
|
115
122
|
console.log(` pid: ${child.pid}`);
|
|
116
123
|
logWebDashboardAndApi();
|
|
117
124
|
process.exit(0);
|
package/dist/config/file-io.d.ts
CHANGED
|
@@ -19,8 +19,11 @@ export declare function getClaudeSdkRuntimeIssue(): string | null;
|
|
|
19
19
|
export declare function parseCommaSeparated(value: string): string[];
|
|
20
20
|
/**
|
|
21
21
|
* 将最新的 Claude 认证环境变量按优先级合并到 process.env。
|
|
22
|
-
* 优先级:shell 环境变量 >
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* 优先级:shell 环境变量 > 本机 Claude 配置(~/.claude/settings.json,与 Claude Code 共用)>
|
|
23
|
+
* ~/.open-im/config.json 的 tools.claude.env。
|
|
24
|
+
*
|
|
25
|
+
* 设计意图:用户只需维护 ~/.claude/settings.json(与 Claude Code CLI 共用),
|
|
26
|
+
* open-im 自动跟随本地 Claude 配置,无需单独配置。config.json 的 tools.claude.env
|
|
27
|
+
* 仅作为兜底,供没有本地 Claude 安装的场景使用。
|
|
25
28
|
*/
|
|
26
29
|
export declare function refreshClaudeEnvToProcess(): void;
|
package/dist/config/file-io.js
CHANGED
|
@@ -350,9 +350,12 @@ export function parseCommaSeparated(value) {
|
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
352
|
* 将最新的 Claude 认证环境变量按优先级合并到 process.env。
|
|
353
|
-
* 优先级:shell 环境变量 >
|
|
354
|
-
*
|
|
355
|
-
*
|
|
353
|
+
* 优先级:shell 环境变量 > 本机 Claude 配置(~/.claude/settings.json,与 Claude Code 共用)>
|
|
354
|
+
* ~/.open-im/config.json 的 tools.claude.env。
|
|
355
|
+
*
|
|
356
|
+
* 设计意图:用户只需维护 ~/.claude/settings.json(与 Claude Code CLI 共用),
|
|
357
|
+
* open-im 自动跟随本地 Claude 配置,无需单独配置。config.json 的 tools.claude.env
|
|
358
|
+
* 仅作为兜底,供没有本地 Claude 安装的场景使用。
|
|
356
359
|
*/
|
|
357
360
|
export function refreshClaudeEnvToProcess() {
|
|
358
361
|
const file = loadFileConfig();
|
|
@@ -363,14 +366,16 @@ export function refreshClaudeEnvToProcess() {
|
|
|
363
366
|
process.env[key] = originalShellEnv[key];
|
|
364
367
|
continue;
|
|
365
368
|
}
|
|
366
|
-
|
|
367
|
-
process.env[key] = claudeToolEnv[key];
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
369
|
+
// 优先读取 ~/.claude/settings.json(与 Claude Code CLI 共用同一配置)
|
|
370
370
|
if (key in claudeSettingsEnv) {
|
|
371
371
|
process.env[key] = claudeSettingsEnv[key];
|
|
372
372
|
continue;
|
|
373
373
|
}
|
|
374
|
+
// 兜底:config.json tools.claude.env(仅在没有本地 Claude 安装时需要)
|
|
375
|
+
if (key in claudeToolEnv) {
|
|
376
|
+
process.env[key] = claudeToolEnv[key];
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
374
379
|
delete process.env[key];
|
|
375
380
|
}
|
|
376
381
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { FileConfig } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves a single credential value using the standard priority chain:
|
|
4
|
-
* environment variable → platform file config → legacy file config.
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolveCredential(envKey: string, fileValue?: string, legacyFileValue?: string): string | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Generic per-platform credential resolution.
|
|
9
|
-
* Returns all resolved credentials and whether the platform should be enabled.
|
|
10
|
-
*/
|
|
11
|
-
export interface ResolvedPlatform {
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
credentials: Record<string, string | undefined>;
|
|
14
|
-
}
|
|
15
|
-
export declare function resolvePlatformCredentials(envKeys: Record<string, string>, fileValues: Record<string, string | undefined>, legacyValues: Record<string, string | undefined>, requiredKeys: string[], enabledFlag?: boolean): ResolvedPlatform;
|
|
16
|
-
/**
|
|
17
|
-
* Extract WorkBuddy credentials, with legacy platforms.wechat migration support.
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveWorkBuddyFileConfig(fileConfig: FileConfig): NonNullable<FileConfig['platforms']>['workbuddy'] | undefined;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves a single credential value using the standard priority chain:
|
|
3
|
-
* environment variable → platform file config → legacy file config.
|
|
4
|
-
*/
|
|
5
|
-
export function resolveCredential(envKey, fileValue, legacyFileValue) {
|
|
6
|
-
return process.env[envKey] ?? fileValue ?? legacyFileValue;
|
|
7
|
-
}
|
|
8
|
-
export function resolvePlatformCredentials(envKeys, fileValues, legacyValues, requiredKeys, enabledFlag) {
|
|
9
|
-
const credentials = {};
|
|
10
|
-
for (const [name, envKey] of Object.entries(envKeys)) {
|
|
11
|
-
credentials[name] = resolveCredential(envKey, fileValues[name], legacyValues[name]);
|
|
12
|
-
}
|
|
13
|
-
const hasRequired = requiredKeys.every((key) => credentials[key] !== undefined && credentials[key] !== '');
|
|
14
|
-
return {
|
|
15
|
-
enabled: hasRequired && enabledFlag !== false,
|
|
16
|
-
credentials,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Extract WorkBuddy credentials, with legacy platforms.wechat migration support.
|
|
21
|
-
*/
|
|
22
|
-
export function resolveWorkBuddyFileConfig(fileConfig) {
|
|
23
|
-
const direct = fileConfig.platforms?.workbuddy;
|
|
24
|
-
if (direct)
|
|
25
|
-
return direct;
|
|
26
|
-
const legacyWechat = fileConfig.platforms?.wechat;
|
|
27
|
-
if (legacyWechat?.workbuddyAccessToken && legacyWechat?.workbuddyRefreshToken) {
|
|
28
|
-
return {
|
|
29
|
-
accessToken: legacyWechat.workbuddyAccessToken,
|
|
30
|
-
refreshToken: legacyWechat.workbuddyRefreshToken,
|
|
31
|
-
userId: legacyWechat.userId,
|
|
32
|
-
baseUrl: legacyWechat.workbuddyBaseUrl,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|