@gonzih/cc-tg 0.9.24 → 0.9.26
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 +2 -0
- package/package.json +1 -1
- package/dist/bot.d.ts +0 -87
- package/dist/bot.js +0 -1536
- package/dist/claude.d.ts +0 -54
- package/dist/claude.js +0 -208
- package/dist/cron.d.ts +0 -39
- package/dist/cron.js +0 -148
- package/dist/formatter.d.ts +0 -25
- package/dist/formatter.js +0 -122
- package/dist/index.d.ts +0 -17
- package/dist/index.js +0 -179
- package/dist/notifier.d.ts +0 -47
- package/dist/notifier.js +0 -319
- package/dist/tokens.d.ts +0 -22
- package/dist/tokens.js +0 -56
- package/dist/usage-limit.d.ts +0 -7
- package/dist/usage-limit.js +0 -29
- package/dist/voice.d.ts +0 -13
- package/dist/voice.js +0 -142
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# cc-tg
|
|
2
2
|
|
|
3
|
+
<img src="assets/logo.png" alt="AMAI" width="120">
|
|
4
|
+
|
|
3
5
|
[](https://www.npmjs.com/package/@gonzih/cc-tg)
|
|
4
6
|
|
|
5
7
|
Claude Code Telegram bot. Chat with Claude Code from Telegram — text, voice, images, files, scheduled prompts, and bot management commands.
|
package/package.json
CHANGED
package/dist/bot.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Telegram bot that routes messages to/from a Claude Code subprocess.
|
|
3
|
-
* One ClaudeProcess per chat_id — sessions are isolated per user.
|
|
4
|
-
*/
|
|
5
|
-
import TelegramBot from "node-telegram-bot-api";
|
|
6
|
-
import { Redis } from "ioredis";
|
|
7
|
-
export interface BotOptions {
|
|
8
|
-
telegramToken: string;
|
|
9
|
-
claudeToken?: string;
|
|
10
|
-
cwd?: string;
|
|
11
|
-
allowedUserIds?: number[];
|
|
12
|
-
groupChatIds?: number[];
|
|
13
|
-
redis?: Redis;
|
|
14
|
-
namespace?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class CcTgBot {
|
|
17
|
-
private bot;
|
|
18
|
-
private sessions;
|
|
19
|
-
private pendingRetries;
|
|
20
|
-
private opts;
|
|
21
|
-
private costStore;
|
|
22
|
-
private botUsername;
|
|
23
|
-
private botId;
|
|
24
|
-
private redis?;
|
|
25
|
-
private namespace;
|
|
26
|
-
private lastActiveChatId?;
|
|
27
|
-
private cron;
|
|
28
|
-
constructor(opts: BotOptions);
|
|
29
|
-
private registerBotCommands;
|
|
30
|
-
/** Write a message to the Redis chat log. Fire-and-forget — no-op if Redis is not configured. */
|
|
31
|
-
private writeChatMessage;
|
|
32
|
-
/** Returns the last chatId that sent a message — used by the chat bridge when no fixed chatId is configured. */
|
|
33
|
-
getLastActiveChatId(): number | undefined;
|
|
34
|
-
/** Session key: "chatId:threadId" for topics, "chatId:main" for DMs/non-topic groups */
|
|
35
|
-
private sessionKey;
|
|
36
|
-
/**
|
|
37
|
-
* Send a message back to the correct thread (or plain chat if no thread).
|
|
38
|
-
* When threadId is undefined, calls sendMessage with exactly 2 args to preserve
|
|
39
|
-
* backward-compatible call signatures (no extra options object).
|
|
40
|
-
*/
|
|
41
|
-
private replyToChat;
|
|
42
|
-
/** Parse THREAD_CWD_MAP env var — maps thread name or thread_id to a CWD path */
|
|
43
|
-
private getThreadCwdMap;
|
|
44
|
-
private isAllowed;
|
|
45
|
-
private handleTelegram;
|
|
46
|
-
/**
|
|
47
|
-
* Feed a text message into the active Claude session for the given chat.
|
|
48
|
-
* Called by the notifier when a UI message arrives via Redis pub/sub.
|
|
49
|
-
*/
|
|
50
|
-
handleUserMessage(chatId: number, text: string): Promise<void>;
|
|
51
|
-
private handleVoice;
|
|
52
|
-
private handleVoiceRetry;
|
|
53
|
-
private handlePhoto;
|
|
54
|
-
private handleDocument;
|
|
55
|
-
private getOrCreateSession;
|
|
56
|
-
private handleClaudeMessage;
|
|
57
|
-
private startTyping;
|
|
58
|
-
private stopTyping;
|
|
59
|
-
private flushPending;
|
|
60
|
-
private trackWrittenFiles;
|
|
61
|
-
private isSensitiveFile;
|
|
62
|
-
private uploadMentionedFiles;
|
|
63
|
-
private extractToolName;
|
|
64
|
-
/** Find cc-agent PIDs via pgrep. Returns array of numeric PIDs. */
|
|
65
|
-
private findCcAgentPids;
|
|
66
|
-
/** Kill cc-agent PIDs with SIGTERM. Returns the list of killed PIDs. */
|
|
67
|
-
private killCcAgent;
|
|
68
|
-
private handleReloadMcp;
|
|
69
|
-
private handleMcpStatus;
|
|
70
|
-
private handleMcpVersion;
|
|
71
|
-
private handleClearNpxCache;
|
|
72
|
-
private handleRestart;
|
|
73
|
-
private handleCron;
|
|
74
|
-
private runCronTask;
|
|
75
|
-
private handleGetFile;
|
|
76
|
-
private handleDrivers;
|
|
77
|
-
private handleAgents;
|
|
78
|
-
private callCcAgentTool;
|
|
79
|
-
private killSession;
|
|
80
|
-
getMe(): Promise<TelegramBot.User>;
|
|
81
|
-
stop(): void;
|
|
82
|
-
}
|
|
83
|
-
/** Detect URLs in text, fetch each via Jina Reader, and prepend content to the prompt */
|
|
84
|
-
export declare function enrichPromptWithUrls(text: string): Promise<string>;
|
|
85
|
-
/** List available skills from ~/.claude/skills/ */
|
|
86
|
-
export declare function listSkills(): string;
|
|
87
|
-
export declare function splitMessage(text: string, maxLen?: number): string[];
|