@wu529778790/open-im 1.8.1-beta.17 → 1.8.1-beta.18

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.
@@ -150,27 +150,38 @@ export function setupFeishuHandlers(config, sessionManager) {
150
150
  const toolId = aiCommand;
151
151
  // 使用 CardKit 打字机效果(80ms 节流,约 12 次/秒,比 patch 5 QPS 更流畅)
152
152
  let cardHandle;
153
- try {
154
- cardHandle = await sendThinkingCard(chatId, toolId);
155
- }
156
- catch (err) {
157
- log.error('Failed to send thinking card:', err);
158
- // 检测是否为飞书权限不足
159
- if (isPermissionError(err)) {
160
- const guide = buildPermissionGuideMessage(err);
161
- await sendPermissionFallback(chatId, guide).catch((err) => {
162
- log.warn('Permission fallback send failed:', err);
163
- });
153
+ const MAX_SEND_RETRIES = 3;
154
+ for (let attempt = 1; attempt <= MAX_SEND_RETRIES; attempt++) {
155
+ try {
156
+ cardHandle = await sendThinkingCard(chatId, toolId);
157
+ break;
164
158
  }
165
- else {
166
- try {
167
- await sendTextReply(chatId, '启动 AI 处理失败,请重试。');
159
+ catch (err) {
160
+ const isRetryable = err && typeof err === 'object' && 'code' in err &&
161
+ (err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET' || err.code === 'ECONNREFUSED');
162
+ if (isRetryable && attempt < MAX_SEND_RETRIES) {
163
+ log.warn(`sendThinkingCard attempt ${attempt}/${MAX_SEND_RETRIES} failed (${err.code}), retrying...`);
164
+ await new Promise((r) => setTimeout(r, 1000 * attempt));
165
+ continue;
168
166
  }
169
- catch (err) {
170
- log.warn('Failed to send startup error reply:', err);
167
+ log.error(`Failed to send thinking card after ${attempt} attempts:`, err);
168
+ // 检测是否为飞书权限不足
169
+ if (isPermissionError(err)) {
170
+ const guide = buildPermissionGuideMessage(err);
171
+ await sendPermissionFallback(chatId, guide).catch((err) => {
172
+ log.warn('Permission fallback send failed:', err);
173
+ });
174
+ }
175
+ else {
176
+ try {
177
+ await sendTextReply(chatId, '启动 AI 处理失败,请重试。');
178
+ }
179
+ catch (err) {
180
+ log.warn('Failed to send startup error reply:', err);
181
+ }
171
182
  }
183
+ return;
172
184
  }
173
- return;
174
185
  }
175
186
  const { messageId: msgId, cardId } = cardHandle;
176
187
  const stopTyping = startTypingLoop(chatId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.8.1-beta.17",
3
+ "version": "1.8.1-beta.18",
4
4
  "description": "Multi-platform IM bridge for AI CLI tools (Claude, Codex, CodeBuddy)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",