@wu529778790/open-im 0.2.9 → 0.2.10

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/config.js CHANGED
@@ -52,7 +52,7 @@ export function loadConfig() {
52
52
  ? parseInt(process.env.CLAUDE_TIMEOUT_MS, 10) || 600000
53
53
  : file.claudeTimeoutMs ?? 600000;
54
54
  if (aiCommand === 'claude') {
55
- if (isAbsolute(claudeCliPath) || claudeCliPath.includes('/')) {
55
+ if (isAbsolute(claudeCliPath) || claudeCliPath.includes('/') || claudeCliPath.includes('\\')) {
56
56
  try {
57
57
  accessSync(claudeCliPath, constants.F_OK | constants.X_OK);
58
58
  }
@@ -61,11 +61,31 @@ export function loadConfig() {
61
61
  }
62
62
  }
63
63
  else {
64
+ // 检查命令是否存在(Windows 用 where,Unix 用 which)
65
+ const checkCommand = process.platform === 'win32' ? 'where' : 'which';
64
66
  try {
65
- execFileSync('which', [claudeCliPath], { stdio: 'pipe' });
67
+ execFileSync(checkCommand, [claudeCliPath], { stdio: 'pipe' });
66
68
  }
67
69
  catch {
68
- throw new Error(`Claude CLI 在 PATH 中未找到: ${claudeCliPath}`);
70
+ const installGuide = [
71
+ '',
72
+ '━━━ Claude CLI 未安装 ━━━',
73
+ '',
74
+ 'open-im 需要 Claude Code CLI 才能运行。',
75
+ '',
76
+ '安装方法:',
77
+ '',
78
+ ' npm install -g @anthropic-ai/claude-code',
79
+ '',
80
+ '或者:',
81
+ ' 1. 访问 https://claude.ai/download',
82
+ ' 2. 下载并安装 Claude Code',
83
+ '',
84
+ '安装后重新运行:',
85
+ ' open-im run',
86
+ '',
87
+ ].join('\n');
88
+ throw new Error(installGuide);
69
89
  }
70
90
  }
71
91
  }
@@ -56,10 +56,25 @@ export function formatToolCallNotification(toolName, toolInput) {
56
56
  detail = ` → ${toolInput.file_path}`;
57
57
  return `${emoji} ${toolName}${detail}`;
58
58
  }
59
+ // 使用提示池,每轮显示不同的技巧
60
+ const USAGE_TIPS = [
61
+ '💡 提示:用 `/new` 开始全新会话',
62
+ '💡 可以用 `/cd <路径>` 切换工作目录',
63
+ '💡 用 `/pwd` 查看当前目录',
64
+ '💡 用 `/status` 查看运行状态',
65
+ '💡 支持发送图片让 AI 分析',
66
+ '💡 支持多行代码输入',
67
+ '⚠️ 上下文较长,建议 /new 开始新会话',
68
+ ];
59
69
  export function getContextWarning(totalTurns) {
60
- if (totalTurns >= 12)
61
- return '⚠️ 上下文较长,建议 /new 开始新会话';
62
- if (totalTurns >= 8)
63
- return `💡 对话已 ${totalTurns} 轮,可用 /compact 压缩`;
64
- return null;
70
+ // 6 轮开始显示提示
71
+ if (totalTurns < 6)
72
+ return null;
73
+ // 13 轮后一直显示警告
74
+ if (totalTurns >= 13) {
75
+ return USAGE_TIPS[USAGE_TIPS.length - 1];
76
+ }
77
+ // 根据轮数循环显示提示
78
+ const tipIndex = (totalTurns - 6) % USAGE_TIPS.length;
79
+ return USAGE_TIPS[tipIndex];
65
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Multi-platform IM bridge for AI CLI tools (Claude, Codex, Cursor)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",