telegram-claude-mcp 1.2.0 → 1.2.2
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/hooks/notify-hook.sh +10 -5
- package/hooks/permission-hook.sh +10 -5
- package/package.json +1 -1
- package/src/telegram.ts +3 -11
package/hooks/notify-hook.sh
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
# and forwards them to the Telegram MCP server.
|
|
7
7
|
#
|
|
8
8
|
# The script auto-discovers the MCP server port from session info files.
|
|
9
|
-
# No configuration needed - it finds running MCP servers automatically.
|
|
10
9
|
#
|
|
11
10
|
|
|
12
11
|
SESSION_DIR="/tmp/telegram-claude-sessions"
|
|
@@ -17,13 +16,19 @@ find_active_session() {
|
|
|
17
16
|
local latest_file=""
|
|
18
17
|
local latest_time=0
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
# Check if directory exists
|
|
20
|
+
[ -d "$SESSION_DIR" ] || return
|
|
21
|
+
|
|
22
|
+
for info_file in "$SESSION_DIR"/*.info; do
|
|
23
|
+
# Skip if no matches (glob didn't expand)
|
|
24
|
+
[ -e "$info_file" ] || continue
|
|
22
25
|
|
|
23
26
|
# Check if the process is still running
|
|
24
|
-
local pid
|
|
27
|
+
local pid
|
|
28
|
+
pid=$(jq -r '.pid // empty' "$info_file" 2>/dev/null)
|
|
25
29
|
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
|
26
|
-
local file_time
|
|
30
|
+
local file_time
|
|
31
|
+
file_time=$(stat -f %m "$info_file" 2>/dev/null || stat -c %Y "$info_file" 2>/dev/null)
|
|
27
32
|
if [ "$file_time" -gt "$latest_time" ]; then
|
|
28
33
|
latest_time=$file_time
|
|
29
34
|
latest_file=$info_file
|
package/hooks/permission-hook.sh
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
# to the Telegram MCP server for interactive approval via Telegram.
|
|
7
7
|
#
|
|
8
8
|
# The script auto-discovers the MCP server port from session info files.
|
|
9
|
-
# No configuration needed - it finds running MCP servers automatically.
|
|
10
9
|
#
|
|
11
10
|
|
|
12
11
|
SESSION_DIR="/tmp/telegram-claude-sessions"
|
|
@@ -16,13 +15,19 @@ find_active_session() {
|
|
|
16
15
|
local latest_file=""
|
|
17
16
|
local latest_time=0
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
# Check if directory exists
|
|
19
|
+
[ -d "$SESSION_DIR" ] || return
|
|
20
|
+
|
|
21
|
+
for info_file in "$SESSION_DIR"/*.info; do
|
|
22
|
+
# Skip if no matches (glob didn't expand)
|
|
23
|
+
[ -e "$info_file" ] || continue
|
|
21
24
|
|
|
22
25
|
# Check if the process is still running
|
|
23
|
-
local pid
|
|
26
|
+
local pid
|
|
27
|
+
pid=$(jq -r '.pid // empty' "$info_file" 2>/dev/null)
|
|
24
28
|
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
|
25
|
-
local file_time
|
|
29
|
+
local file_time
|
|
30
|
+
file_time=$(stat -f %m "$info_file" 2>/dev/null || stat -c %Y "$info_file" 2>/dev/null)
|
|
26
31
|
if [ "$file_time" -gt "$latest_time" ]; then
|
|
27
32
|
latest_time=$file_time
|
|
28
33
|
latest_file=$info_file
|
package/package.json
CHANGED
package/src/telegram.ts
CHANGED
|
@@ -192,18 +192,10 @@ export class TelegramManager {
|
|
|
192
192
|
|
|
193
193
|
const message = `🔐 [${this.config.sessionName}] Permission Request\n\nTool: ${toolName}\n${inputDisplay}`;
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
inline_keyboard: [
|
|
198
|
-
[
|
|
199
|
-
{ text: '✅ Allow', callback_data: `allow:${sent?.message_id || 'pending'}` },
|
|
200
|
-
{ text: '❌ Deny', callback_data: `deny:${sent?.message_id || 'pending'}` },
|
|
201
|
-
],
|
|
202
|
-
],
|
|
203
|
-
},
|
|
204
|
-
});
|
|
195
|
+
// Send message first without inline keyboard
|
|
196
|
+
const sent = await this.bot.sendMessage(this.config.chatId, message);
|
|
205
197
|
|
|
206
|
-
//
|
|
198
|
+
// Then add the inline keyboard with the correct message ID
|
|
207
199
|
await this.bot.editMessageReplyMarkup(
|
|
208
200
|
{
|
|
209
201
|
inline_keyboard: [
|