@wu529778790/open-im 1.9.3-beta.8 → 1.9.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.
@@ -5,7 +5,6 @@ import { sendThinkingMessage, updateMessage, sendFinalMessages, sendErrorMessage
5
5
  import { CommandHandler } from "../commands/handler.js";
6
6
  import { getAdapter } from "../adapters/registry.js";
7
7
  import { runAITask } from "../shared/ai-task.js";
8
- import { startTaskCleanup } from "../shared/task-cleanup.js";
9
8
  import { setActiveChatId } from "../shared/active-chats.js";
10
9
  import { setChatUser } from "../shared/chat-user-map.js";
11
10
  import { createLogger } from "../logger.js";
@@ -119,7 +118,6 @@ export function setupQQHandlers(config, sessionManager) {
119
118
  const runningTasks = new Map();
120
119
  const recentEventIds = new Map();
121
120
  const recentEventFingerprints = new Map();
122
- const stopTaskCleanup = startTaskCleanup(runningTasks);
123
121
  const commandHandler = new CommandHandler({
124
122
  config,
125
123
  sessionManager,
@@ -258,7 +256,7 @@ export function setupQQHandlers(config, sessionManager) {
258
256
  log.info(`QQ message handled: user=${userId}, chat=${chatId}, status=${enqueueResult}, attachments=${event.attachments?.length ?? 0}`);
259
257
  }
260
258
  return {
261
- stop: () => stopTaskCleanup(),
259
+ stop: () => { },
262
260
  getRunningTaskCount: () => runningTasks.size,
263
261
  handleEvent,
264
262
  };
package/dist/setup.js CHANGED
@@ -75,11 +75,10 @@ function printManualInstructions(configPath) {
75
75
  "tools": {
76
76
  "claude": {
77
77
  "cliPath": "claude",
78
- "workDir": "${process.cwd().replace(/\\/g, "/")}",
79
- "timeoutMs": 600000
78
+ "workDir": "${process.cwd().replace(/\\/g, "/")}"
80
79
  },
81
80
  "codex": { "cliPath": "codex", "workDir": "${process.cwd().replace(/\\/g, "/")}", "proxy": "http://127.0.0.1:7890" },
82
- "codebuddy": { "cliPath": "codebuddy", "timeoutMs": 600000 }
81
+ "codebuddy": { "cliPath": "codebuddy" }
83
82
  },
84
83
  "platforms": {
85
84
  "telegram": {
@@ -862,7 +861,6 @@ export async function runInteractiveSetup() {
862
861
  ...baseTools.claude,
863
862
  cliPath: baseTools.claude?.cliPath ?? "claude",
864
863
  workDir,
865
- timeoutMs: baseTools.claude?.timeoutMs ?? 600000,
866
864
  },
867
865
  codex: {
868
866
  ...baseTools.codex,
@@ -875,7 +873,6 @@ export async function runInteractiveSetup() {
875
873
  codebuddy: {
876
874
  ...baseTools.codebuddy,
877
875
  cliPath: baseTools.codebuddy?.cliPath ?? "codebuddy",
878
- timeoutMs: baseTools.codebuddy?.timeoutMs ?? 600000,
879
876
  },
880
877
  },
881
878
  };
@@ -86,11 +86,6 @@ export function runAITask(deps, ctx, prompt, toolAdapter, platformAdapter) {
86
86
  // 使用 aiCommand 而不是 toolAdapter.toolId,确保 sessionId 的存储和查询使用相同的 key
87
87
  const aiCommand = resolvePlatformAiCommand(config, ctx.platform);
88
88
  const toolId = toolAdapter.toolId;
89
- const timeoutMs = aiCommand === 'codex'
90
- ? config.codexTimeoutMs
91
- : aiCommand === 'codebuddy'
92
- ? config.codebuddyTimeoutMs
93
- : config.claudeTimeoutMs;
94
89
  const startRun = () => {
95
90
  log.info(`[AITask] Starting: userId=${ctx.userId}, initialSessionId=${currentSessionId ?? 'new'}, prompt="${prompt.slice(0, 50)}..."`);
96
91
  activeHandle = toolAdapter.run(prompt, currentSessionId, ctx.workDir, {
@@ -225,7 +220,6 @@ export function runAITask(deps, ctx, prompt, toolAdapter, platformAdapter) {
225
220
  resolve();
226
221
  },
227
222
  }, {
228
- timeoutMs,
229
223
  model: sessionManager.getModel(ctx.userId, ctx.threadId) ?? config.claudeModel,
230
224
  chatId: ctx.chatId,
231
225
  // 默认跳过权限确认,保持全自动执行
@@ -35,9 +35,6 @@ describe("runAITask", () => {
35
35
  aiCommand: "codex",
36
36
  platforms: {},
37
37
  enabledPlatforms: [],
38
- codexTimeoutMs: 600000,
39
- claudeTimeoutMs: 600000,
40
- codebuddyTimeoutMs: 600000,
41
38
  claudeModel: "",
42
39
  codexProxy: "",
43
40
  wechatUserId: "",
@@ -6,7 +6,6 @@ import { sendThinkingMessage, updateMessage, sendFinalMessages, sendTextReply, s
6
6
  import { CommandHandler } from "../commands/handler.js";
7
7
  import { getAdapter } from "../adapters/registry.js";
8
8
  import { runAITask } from "../shared/ai-task.js";
9
- import { startTaskCleanup } from "../shared/task-cleanup.js";
10
9
  import { TELEGRAM_THROTTLE_MS } from "../constants.js";
11
10
  import { setActiveChatId } from "../shared/active-chats.js";
12
11
  import { setChatUser } from "../shared/chat-user-map.js";
@@ -66,7 +65,6 @@ export function setupTelegramHandlers(bot, config, sessionManager) {
66
65
  const accessControl = new AccessControl(config.telegramAllowedUserIds);
67
66
  const requestQueue = new RequestQueue();
68
67
  const runningTasks = new Map();
69
- const stopTaskCleanup = startTaskCleanup(runningTasks);
70
68
  const commandHandler = new CommandHandler({
71
69
  config,
72
70
  sessionManager,
@@ -488,7 +486,7 @@ export function setupTelegramHandlers(bot, config, sessionManager) {
488
486
  }
489
487
  });
490
488
  return {
491
- stop: () => stopTaskCleanup(),
489
+ stop: () => { },
492
490
  getRunningTaskCount: () => runningTasks.size,
493
491
  };
494
492
  }
@@ -8,7 +8,6 @@ import { sendThinkingMessage, updateMessage, sendFinalMessages, sendTextReply, s
8
8
  import { CommandHandler } from '../commands/handler.js';
9
9
  import { getAdapter } from '../adapters/registry.js';
10
10
  import { runAITask } from '../shared/ai-task.js';
11
- import { startTaskCleanup } from '../shared/task-cleanup.js';
12
11
  import { WEWORK_THROTTLE_MS } from '../constants.js';
13
12
  import { setActiveChatId } from '../shared/active-chats.js';
14
13
  import { setChatUser } from '../shared/chat-user-map.js';
@@ -163,7 +162,6 @@ export function setupWeWorkHandlers(config, sessionManager) {
163
162
  const accessControl = new AccessControl(config.weworkAllowedUserIds);
164
163
  const requestQueue = new RequestQueue();
165
164
  const runningTasks = new Map();
166
- const stopTaskCleanup = startTaskCleanup(runningTasks);
167
165
  // Mutable ref that captures the req_id of the message currently being handled.
168
166
  // WeWork requires req_id to reply; CommandHandler doesn't carry it, so we inject
169
167
  // it via a closure. WeWork delivers messages sequentially over WebSocket, so
@@ -332,7 +330,7 @@ export function setupWeWorkHandlers(config, sessionManager) {
332
330
  }
333
331
  }
334
332
  return {
335
- stop: () => stopTaskCleanup(),
333
+ stop: () => { },
336
334
  getRunningTaskCount: () => runningTasks.size,
337
335
  handleEvent,
338
336
  };
@@ -8,7 +8,6 @@ import { sendTextReply, sendErrorReply } from './message-sender.js';
8
8
  import { CommandHandler } from '../commands/handler.js';
9
9
  import { getAdapter } from '../adapters/registry.js';
10
10
  import { runAITask } from '../shared/ai-task.js';
11
- import { startTaskCleanup } from '../shared/task-cleanup.js';
12
11
  import { WORKBUDDY_THROTTLE_MS } from '../constants.js';
13
12
  import { setActiveChatId } from '../shared/active-chats.js';
14
13
  import { setChatUser } from '../shared/chat-user-map.js';
@@ -19,7 +18,6 @@ export function setupWorkBuddyHandlers(config, sessionManager) {
19
18
  const requestQueue = new RequestQueue();
20
19
  const runningTasks = new Map();
21
20
  const taskKeyByChatId = new Map();
22
- const stopTaskCleanup = startTaskCleanup(runningTasks);
23
21
  // Base dependencies for creating per-event CommandHandler
24
22
  const baseCommandDeps = {
25
23
  config,
@@ -116,7 +114,7 @@ export function setupWorkBuddyHandlers(config, sessionManager) {
116
114
  }
117
115
  }
118
116
  return {
119
- stop: () => stopTaskCleanup(),
117
+ stop: () => { },
120
118
  getRunningTaskCount: () => runningTasks.size,
121
119
  handleEvent,
122
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.9.3-beta.8",
3
+ "version": "1.9.3",
4
4
  "description": "Multi-platform IM bridge for AI CLI tools (Claude, Codex, CodeBuddy)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,2 +0,0 @@
1
- import type { TaskRunState } from './ai-task.js';
2
- export declare function startTaskCleanup(runningTasks: Map<string, TaskRunState>): () => void;
@@ -1,19 +0,0 @@
1
- import { createLogger } from '../logger.js';
2
- const log = createLogger('TaskCleanup');
3
- const TASK_TIMEOUT_MS = 30 * 60 * 1000;
4
- const INTERVAL_MS = 10 * 60 * 1000;
5
- export function startTaskCleanup(runningTasks) {
6
- const timer = setInterval(() => {
7
- const now = Date.now();
8
- for (const [key, task] of runningTasks) {
9
- if (now - task.startedAt > TASK_TIMEOUT_MS) {
10
- log.warn(`Auto-cleaning timeout task: ${key}`);
11
- task.settle();
12
- task.handle.abort();
13
- runningTasks.delete(key);
14
- }
15
- }
16
- }, INTERVAL_MS);
17
- timer.unref();
18
- return () => clearInterval(timer);
19
- }