@wu529778790/open-im 1.10.8-beta.0 → 1.10.8-beta.1

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.
@@ -10,6 +10,29 @@ const log = createLogger('AITask');
10
10
  function isUsageLimitError(error) {
11
11
  return /usage limit/i.test(error) || /try again at\s+\d{1,2}:\d{2}\s*(AM|PM)/i.test(error);
12
12
  }
13
+ function classifyErrorType(error) {
14
+ const s = error.toLowerCase();
15
+ if (s.includes('aborted'))
16
+ return 'aborted';
17
+ if (isUsageLimitError(error) || s.includes('rate limit') || s.includes('quota'))
18
+ return 'limit';
19
+ if (s.includes('invalid api key') || s.includes('unauthorized') || s.includes('401'))
20
+ return 'auth';
21
+ if (s.includes('model') && (s.includes('not support') || s.includes('not found') || s.includes('invalid'))) {
22
+ return 'model';
23
+ }
24
+ if (s.includes('process exited') || s.includes('exit code'))
25
+ return 'process';
26
+ if (s.includes('timeout') ||
27
+ s.includes('etimedout') ||
28
+ s.includes('econnreset') ||
29
+ s.includes('enotfound') ||
30
+ s.includes('eai_again') ||
31
+ s.includes('network')) {
32
+ return 'network';
33
+ }
34
+ return 'unknown';
35
+ }
13
36
  function buildCompletionNote(result, sessionManager, ctx) {
14
37
  const toolInfo = formatToolStats(result.toolStats, result.numTurns);
15
38
  const parts = [];
@@ -224,6 +247,7 @@ export function runAITask(deps, ctx, prompt, toolAdapter, platformAdapter) {
224
247
  toolId: aiCommand,
225
248
  durationMs: Date.now() - taskState.startedAt,
226
249
  errorSnippet: sanitize(String(error).slice(0, 400)),
250
+ errorType: classifyErrorType(String(error)),
227
251
  });
228
252
  if (isUsageLimitError(error)) {
229
253
  // Usage limit errors: keep session for all tools (user can retry later)
@@ -269,6 +293,7 @@ export function runAITask(deps, ctx, prompt, toolAdapter, platformAdapter) {
269
293
  toolId: aiCommand,
270
294
  durationMs: Date.now() - taskState.startedAt,
271
295
  errorSnippet: 'aborted',
296
+ errorType: 'aborted',
272
297
  });
273
298
  }
274
299
  activeHandle?.abort();
@@ -296,6 +321,7 @@ export function runAITask(deps, ctx, prompt, toolAdapter, platformAdapter) {
296
321
  toolId: aiCommand,
297
322
  durationMs: 0,
298
323
  errorSnippet: sanitize(String(err).slice(0, 400)),
324
+ errorType: classifyErrorType(String(err)),
299
325
  });
300
326
  platformAdapter
301
327
  .sendError(`内部错误:${err instanceof Error ? err.message : String(err)}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.10.8-beta.0",
3
+ "version": "1.10.8-beta.1",
4
4
  "description": "Multi-platform IM bridge for AI CLI tools (Claude, Codex, CodeBuddy)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",