@raolin2025/claude-code-node 2.6.12 → 2.6.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raolin2025/claude-code-node",
3
- "version": "2.6.12",
3
+ "version": "2.6.13",
4
4
  "description": "Node.js AI Code Agent CLI - Zero dependencies, pure JavaScript, security hardened, multi-channel notifications, Telegram & QQ Bot remote programming, rich media upload, multi-account management",
5
5
  "type": "module",
6
6
  "main": "src/core/index.js",
@@ -385,14 +385,15 @@ export class TelegramListener {
385
385
  }
386
386
  }
387
387
 
388
- /** 将消息加入串行处理队列(不阻塞轮询循环) */
388
+ /** 异步处理一条消息(不串行排队,避免权限确认死锁) */
389
389
  _enqueueMessage(msg) {
390
- this._msgQueue = this._msgQueue.then(async () => {
391
- try {
392
- await this._handleMessage(msg)
393
- } catch (e) {
394
- log(`[TG] handle error: ${e.message}`)
395
- }
390
+ // 关键:不能串行排队等待前一条消息处理完。
391
+ // 若第一条消息触发权限确认而挂起(await pendingConfirm),
392
+ // 后续的权限确认回复 a 会排在后面积压,造成死锁(a 永远处理不到)。
393
+ // 因此每条消息独立异步处理:权限确认回复能立即响应,普通消息由
394
+ // processInputLine 内部处理"引擎忙"的情况。
395
+ this._handleMessage(msg).catch((e) => {
396
+ log(`[TG] handle error: ${e.message}`)
396
397
  })
397
398
  }
398
399
 
package/src/core/cli.js CHANGED
@@ -855,6 +855,16 @@ const systemPrompt = cliArgs.systemPrompt || DEFAULT_SYSTEM_PROMPT
855
855
  return
856
856
  }
857
857
 
858
+ // 发送到引擎 — 引擎忙(如正在处理上一条消息)时,提示而不是崩溃/吞掉
859
+ if (engine.state.isRunning) {
860
+ const busyMsg = '⏳ 引擎正在处理其他任务,请稍候或输入 /stop 停止当前任务。'
861
+ console.log(busyMsg)
862
+ if (source === 'telegram' && tgListener?.bot) {
863
+ await sendTelegram(busyMsg, tgChatId || null).catch(() => {})
864
+ }
865
+ return
866
+ }
867
+
858
868
  // 发送到引擎
859
869
  try {
860
870
  const result = await processInput(input)