@raolin2025/claude-code-node 2.7.4 → 2.7.5
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 +1 -1
- package/src/core/cli.js +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raolin2025/claude-code-node",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
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",
|
package/src/core/cli.js
CHANGED
|
@@ -1008,7 +1008,10 @@ const systemPrompt = cliArgs.systemPrompt || DEFAULT_SYSTEM_PROMPT
|
|
|
1008
1008
|
// 让远程用户看到 AI 正在工作,而不是"以为没回应"。
|
|
1009
1009
|
// 采用节流 + 编辑同一消息的方式,避免刷屏和触发速率限制。
|
|
1010
1010
|
// ============================================================
|
|
1011
|
-
const tgThinking = { buffer: '', timer: null, target: null, lastMsgId: null, flushing: false, typingTimer: null }
|
|
1011
|
+
const tgThinking = { buffer: '', timer: null, target: null, lastMsgId: null, flushing: false, typingTimer: null, lastResetAt: 0 }
|
|
1012
|
+
// 周期性重置"🧠 思考中…"消息,避免它无限膨胀成一个无法判断是否仍在工作的静态块。
|
|
1013
|
+
// 每隔 RESET_MS 就删掉旧消息、发一条新的,让用户每隔几秒看到一次明确的活动信号。
|
|
1014
|
+
const TG_THINKING_RESET_MS = 5000
|
|
1012
1015
|
|
|
1013
1016
|
// Telegram 的 typing 提示约 5 秒后自动消失。若 cc-node 处理耗时较长
|
|
1014
1017
|
//(如执行工具、读取文件、多轮思考),单次 sendChatAction 撑不住整个周期,
|
|
@@ -1036,6 +1039,7 @@ const systemPrompt = cliArgs.systemPrompt || DEFAULT_SYSTEM_PROMPT
|
|
|
1036
1039
|
tgThinking.buffer = ''
|
|
1037
1040
|
tgThinking.lastMsgId = null
|
|
1038
1041
|
tgThinking.flushing = false
|
|
1042
|
+
tgThinking.lastResetAt = Date.now()
|
|
1039
1043
|
// 先发送 typing 动作,让 Telegram 立即显示"正在输入",并启动心跳保持持续显示
|
|
1040
1044
|
if (tgListener?.bot && tgThinking.target) {
|
|
1041
1045
|
tgListener.bot.sendChatAction(tgThinking.target, 'typing').catch(() => {})
|
|
@@ -1062,6 +1066,14 @@ const systemPrompt = cliArgs.systemPrompt || DEFAULT_SYSTEM_PROMPT
|
|
|
1062
1066
|
const target = tgThinking.target
|
|
1063
1067
|
const body = `🧠 思考中…\n\n${tgThinking.buffer.slice(-3500)}`
|
|
1064
1068
|
try {
|
|
1069
|
+
// 周期性重置:若已有一条消息且距上次重置超过阈值,删除旧消息并发新消息,
|
|
1070
|
+
// 让用户每隔几秒看到"🧠 思考中…"重新出现,明确 AI 仍在工作(而非已卡死/完成)。
|
|
1071
|
+
const needReset = tgThinking.lastMsgId && (Date.now() - tgThinking.lastResetAt) >= TG_THINKING_RESET_MS
|
|
1072
|
+
if (needReset) {
|
|
1073
|
+
tgListener.bot.deleteMessage(target, tgThinking.lastMsgId).catch(() => {})
|
|
1074
|
+
tgThinking.lastMsgId = null
|
|
1075
|
+
tgThinking.lastResetAt = Date.now()
|
|
1076
|
+
}
|
|
1065
1077
|
if (tgThinking.lastMsgId) {
|
|
1066
1078
|
await tgListener.bot.editMessage(target, tgThinking.lastMsgId, body, { parseMode: 'HTML' })
|
|
1067
1079
|
} else {
|