@raolin2025/claude-code-node 2.8.3 → 2.8.4
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/README.md +10 -0
- package/package.json +1 -1
- package/src/channel/tg-listener.js +49 -7
package/README.md
CHANGED
|
@@ -544,8 +544,18 @@ cc-notify 是独立的通知守护进程,**不需要 cc-node 在前台运行**
|
|
|
544
544
|
/notify 任务完成! → 通过 Telegram 广播通知
|
|
545
545
|
/status → 查看服务状态
|
|
546
546
|
/cancel → 取消当前操作
|
|
547
|
+
/help → 查看完整帮助(含 AI 编程命令)
|
|
548
|
+
/model gpt-4o → 切换模型
|
|
549
|
+
/window 128k → 设置上下文窗口
|
|
550
|
+
/budget → 查看 token 预算
|
|
551
|
+
/compact → 压缩上下文
|
|
552
|
+
/clear → 清空对话
|
|
547
553
|
```
|
|
548
554
|
|
|
555
|
+
> 除上述系统命令外,所有 `/help` 列出的 AI 编程命令(`/model`、`/window`、`/budget`、
|
|
556
|
+
> `/compact`、`/clear`、`/sessions`、`/config`、`/cost`、`/cd`、`/tools`、`/stop`、`/allow`
|
|
557
|
+
> 等)都会自动转发给 cc-node 处理,结果回发到 Telegram。`/help <命令>` 可查看详细用法。
|
|
558
|
+
|
|
549
559
|
### HTTP API(守护模式可用)
|
|
550
560
|
|
|
551
561
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raolin2025/claude-code-node",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.4",
|
|
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",
|
|
@@ -316,15 +316,33 @@ export class TelegramListener {
|
|
|
316
316
|
this.running = true
|
|
317
317
|
log(`[TG] Starting long polling...`)
|
|
318
318
|
|
|
319
|
-
//
|
|
319
|
+
// 设置命令菜单(Telegram 输入框 / 提示,最多 100 个命令)
|
|
320
320
|
try {
|
|
321
321
|
await this.bot.setMyCommands([
|
|
322
|
+
// —— 系统命令(本进程处理)——
|
|
322
323
|
{ command: 'ping', description: '🏓 检查服务状态' },
|
|
323
324
|
{ command: 'status', description: '📊 查看 cc-node 状态' },
|
|
324
325
|
{ command: 'run', description: '💻 执行 shell 命令(如 /run ls -la)' },
|
|
325
326
|
{ command: 'notify', description: '📢 广播通知消息' },
|
|
326
|
-
{ command: 'help', description: '❓ 查看帮助' },
|
|
327
327
|
{ command: 'cancel', description: '🚫 取消当前操作' },
|
|
328
|
+
{ command: 'help', description: '❓ 查看帮助' },
|
|
329
|
+
// —— AI 编程命令(转发给 cc-node)——
|
|
330
|
+
{ command: 'model', description: '🤖 切换模型(如 /model gpt-4o)' },
|
|
331
|
+
{ command: 'models', description: '📋 列出可用模型' },
|
|
332
|
+
{ command: 'window', description: '🧠 查看/设置上下文窗口(如 /window 128k)' },
|
|
333
|
+
{ command: 'budget', description: '💰 查看 token 预算使用' },
|
|
334
|
+
{ command: 'compact', description: '🗜️ 手动压缩上下文' },
|
|
335
|
+
{ command: 'clear', description: '🧹 清空当前对话' },
|
|
336
|
+
{ command: 'session', description: '🗂️ 查看会话信息' },
|
|
337
|
+
{ command: 'sessions', description: '📂 列出所有会话' },
|
|
338
|
+
{ command: 'resume', description: '↩️ 恢复会话(/resume <id>)' },
|
|
339
|
+
{ command: 'config', description: '⚙️ 查看配置(/config model)' },
|
|
340
|
+
{ command: 'cost', description: '💲 查看 API 费用' },
|
|
341
|
+
{ command: 'channel', description: '🔔 管理通知通道' },
|
|
342
|
+
{ command: 'cd', description: '📁 切换工作目录' },
|
|
343
|
+
{ command: 'tools', description: '🛠️ 列出可用工具' },
|
|
344
|
+
{ command: 'stop', description: '⏹️ 停止当前 AI 任务' },
|
|
345
|
+
{ command: 'allow', description: '🔓 工具权限管理' },
|
|
328
346
|
])
|
|
329
347
|
} catch {}
|
|
330
348
|
|
|
@@ -536,9 +554,13 @@ export class TelegramListener {
|
|
|
536
554
|
|
|
537
555
|
switch (cmd) {
|
|
538
556
|
case '/start':
|
|
539
|
-
case '/help':
|
|
540
557
|
return this._helpText()
|
|
541
558
|
|
|
559
|
+
case '/help':
|
|
560
|
+
// 无参数 → 返回完整帮助;带参数(/help <cmd>)→ 转发给 cc-node 输出详细用法
|
|
561
|
+
if (!args) return this._helpText()
|
|
562
|
+
return null // 交由 cli.js processInputLine 处理 /help <cmd> 详细帮助
|
|
563
|
+
|
|
542
564
|
case '/ping':
|
|
543
565
|
return '🏓 pong! cc-notify is alive.'
|
|
544
566
|
|
|
@@ -592,25 +614,45 @@ export class TelegramListener {
|
|
|
592
614
|
}
|
|
593
615
|
}
|
|
594
616
|
|
|
595
|
-
/**
|
|
617
|
+
/** 生成帮助文本(含 cc-notify 系统命令 + cc-node AI 编程命令) */
|
|
596
618
|
_helpText() {
|
|
597
619
|
return [
|
|
598
620
|
'🤖 *cc-notify — AI Code Agent*',
|
|
599
621
|
'',
|
|
600
622
|
'通过 Telegram 远程操控 AI 编程助手。',
|
|
623
|
+
'直接发消息 → AI 处理;发 / 开头命令 → 执行对应操作。',
|
|
601
624
|
'',
|
|
602
|
-
'
|
|
625
|
+
'*🔧 系统命令*',
|
|
603
626
|
'• `/ping` — 检查服务状态',
|
|
604
627
|
'• `/status` — 查看详细状态',
|
|
605
628
|
'• `/run <cmd>` — 直接执行 shell 命令',
|
|
606
629
|
'• `/notify <msg>` — 广播通知到所有通道',
|
|
607
630
|
'• `/cancel` — 取消当前操作',
|
|
608
|
-
'
|
|
631
|
+
'',
|
|
632
|
+
'*🤖 AI 编程命令*(转发给 cc-node 处理)',
|
|
633
|
+
'• `/model NAME` — 切换模型(如 /model gpt-4o)',
|
|
634
|
+
'• `/models` — 列出可用模型',
|
|
635
|
+
'• `/window [N]` — 查看/设置上下文窗口(/window 128k、/window auto)',
|
|
636
|
+
'• `/budget` — 查看 token 预算使用',
|
|
637
|
+
'• `/compact` — 手动压缩上下文',
|
|
638
|
+
'• `/clear` — 清空当前对话',
|
|
639
|
+
'• `/session` — 查看会话信息',
|
|
640
|
+
'• `/sessions` — 列出所有会话',
|
|
641
|
+
'• `/resume <id>` — 恢复历史会话',
|
|
642
|
+
'• `/config KEY` — 查看配置(如 /config model)',
|
|
643
|
+
'• `/cost` — 查看 API 费用',
|
|
644
|
+
'• `/channel` — 管理通知通道',
|
|
645
|
+
'• `/cd PATH` — 切换工作目录',
|
|
646
|
+
'• `/tools` — 列出可用工具',
|
|
647
|
+
'• `/stop` — 停止当前 AI 任务',
|
|
648
|
+
'• `/allow` — 工具权限管理',
|
|
609
649
|
'',
|
|
610
650
|
'*普通消息*',
|
|
611
|
-
'
|
|
651
|
+
'直接发送文字 → 自动发给 AI 处理',
|
|
612
652
|
'支持发送图片(AI 无法看图,但会作为附件)',
|
|
613
653
|
'',
|
|
654
|
+
'💡 任意 `/help <命令>` 查看某个命令的详细用法。',
|
|
655
|
+
'',
|
|
614
656
|
].join('\n')
|
|
615
657
|
}
|
|
616
658
|
|