@raolin2025/claude-code-node 2.6.9 → 2.6.11
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/channel/tg-listener.js +4 -1
- package/src/core/cli.js +14 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raolin2025/claude-code-node",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.11",
|
|
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",
|
|
@@ -419,8 +419,11 @@ export class TelegramListener {
|
|
|
419
419
|
if (reply) {
|
|
420
420
|
// 如果回复很长,分多条发送
|
|
421
421
|
await this._sendLongMessage(chatId, reply, { replyTo: msg.message_id })
|
|
422
|
+
return
|
|
422
423
|
}
|
|
423
|
-
|
|
424
|
+
// _handleCommand 返回 null = 未知命令(如 /stop、/resume 等)
|
|
425
|
+
// 需要转发给 cc-node 的 processInputLine 处理,不能吞掉。
|
|
426
|
+
// 落到下方普通消息分支继续转发。
|
|
424
427
|
}
|
|
425
428
|
|
|
426
429
|
// 处理普通消息 — 转发给 cc-node
|
package/src/core/cli.js
CHANGED
|
@@ -281,6 +281,7 @@ Commands:
|
|
|
281
281
|
/session — Show session info
|
|
282
282
|
/sessions — List all sessions
|
|
283
283
|
/clear — Clear conversation
|
|
284
|
+
/stop — Stop current AI work (when stuck/long)
|
|
284
285
|
/config KEY — Show config value
|
|
285
286
|
/budget — Show token budget
|
|
286
287
|
/channel CMD — Manage notification channels (list|send|test)
|
|
@@ -315,6 +316,8 @@ const DETAILED_HELP = {
|
|
|
315
316
|
|
|
316
317
|
clear: "/clear\n Clear the current conversation context.\n Starts a fresh session. Previous messages are not sent to the API anymore.\n\n Note: Does not delete saved sessions.",
|
|
317
318
|
|
|
319
|
+
stop: "/stop\n Stop the currently running AI work.\n Use when the AI appears stuck or takes too long to respond.\n Sends an abort signal to interrupt the current task.\n After stopping, you can issue a new command.",
|
|
320
|
+
|
|
318
321
|
config: "/config [key]\n Without key: show the entire config as JSON.\n With a key path: show the value for that specific path.\n\n Example: /config\n Example: /config model",
|
|
319
322
|
|
|
320
323
|
budget: "/budget\n Show token budget usage for the current session.\n Displays how many tokens have been used vs the limit.",
|
|
@@ -608,7 +611,8 @@ const systemPrompt = cliArgs.systemPrompt || DEFAULT_SYSTEM_PROMPT
|
|
|
608
611
|
|
|
609
612
|
// 关键:来自 Telegram 的消息,如果当前正在等待远程权限确认(pendingConfirm),
|
|
610
613
|
// 则把它当作确认回复(y/n/a)处理,而不是当作新的 REPL 输入。
|
|
611
|
-
|
|
614
|
+
// 注意:/ 开头的命令优先走命令分支,不被权限确认拦截(否则 /quit、/stop 会被吞)。
|
|
615
|
+
if (source === 'telegram' && pendingConfirm && !trimmed.startsWith('/')) {
|
|
612
616
|
const confirm = pendingConfirm
|
|
613
617
|
pendingConfirm = null
|
|
614
618
|
const a = trimmed.toLowerCase()
|
|
@@ -750,6 +754,15 @@ const systemPrompt = cliArgs.systemPrompt || DEFAULT_SYSTEM_PROMPT
|
|
|
750
754
|
session = await sessionManager.create()
|
|
751
755
|
console.log('Conversation cleared')
|
|
752
756
|
break
|
|
757
|
+
case 'stop':
|
|
758
|
+
// 停止当前正在运行的 AI 工作(如卡死 / 长时间无响应时)
|
|
759
|
+
if (engine.state.isRunning) {
|
|
760
|
+
engine.abort()
|
|
761
|
+
console.log('⏹️ 已发送停止信号,正在中止当前工作...')
|
|
762
|
+
} else {
|
|
763
|
+
console.log('(当前没有正在运行的任务)')
|
|
764
|
+
}
|
|
765
|
+
break
|
|
753
766
|
case 'config':
|
|
754
767
|
if (rest[0]) {
|
|
755
768
|
const val = config.get(rest.join(' '))
|