telegram-claude-mcp 1.0.1 → 1.0.3
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/providers/index.ts +11 -1
- package/src/telegram.ts +6 -0
package/package.json
CHANGED
package/src/providers/index.ts
CHANGED
|
@@ -31,10 +31,20 @@ export function loadAppConfig(): AppConfig {
|
|
|
31
31
|
const chatId = process.env.TELEGRAM_CHAT_ID;
|
|
32
32
|
const sessionPort = process.env.SESSION_PORT || '3333';
|
|
33
33
|
|
|
34
|
+
// Auto-detect project name from current working directory
|
|
35
|
+
const cwd = process.cwd();
|
|
36
|
+
const projectName = cwd.split('/').pop() || 'unknown';
|
|
37
|
+
|
|
38
|
+
// Build session name: SESSION_NAME:projectName or just projectName
|
|
39
|
+
const baseSessionName = process.env.SESSION_NAME;
|
|
40
|
+
const sessionName = baseSessionName
|
|
41
|
+
? `${baseSessionName}:${projectName}`
|
|
42
|
+
: projectName;
|
|
43
|
+
|
|
34
44
|
return {
|
|
35
45
|
telegramBotToken: process.env.TELEGRAM_BOT_TOKEN || '',
|
|
36
46
|
telegramChatId: chatId ? parseInt(chatId, 10) : 0,
|
|
37
|
-
sessionName
|
|
47
|
+
sessionName,
|
|
38
48
|
sessionPort: parseInt(sessionPort, 10),
|
|
39
49
|
openrouterApiKey: process.env.OPENROUTER_API_KEY,
|
|
40
50
|
openrouterModel: process.env.OPENROUTER_MODEL || 'openai/gpt-oss-120b',
|
package/src/telegram.ts
CHANGED
|
@@ -167,10 +167,12 @@ export class TelegramManager {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
const text = msg.text || '';
|
|
170
|
+
console.error(`[${this.config.sessionName}] Received message: "${text}" (pending: ${this.pendingResponses.size})`);
|
|
170
171
|
|
|
171
172
|
// Check if this is a reply to one of our messages
|
|
172
173
|
if (msg.reply_to_message) {
|
|
173
174
|
const replyToId = msg.reply_to_message.message_id;
|
|
175
|
+
console.error(`[${this.config.sessionName}] Is reply to message ${replyToId}, isOurs: ${this.isOurMessage(replyToId)}`);
|
|
174
176
|
if (this.isOurMessage(replyToId)) {
|
|
175
177
|
this.resolveResponse(text);
|
|
176
178
|
return;
|
|
@@ -181,13 +183,17 @@ export class TelegramManager {
|
|
|
181
183
|
const sessionPrefix = `@${this.config.sessionName}`;
|
|
182
184
|
if (text.toLowerCase().startsWith(sessionPrefix.toLowerCase())) {
|
|
183
185
|
const response = text.slice(sessionPrefix.length).trim();
|
|
186
|
+
console.error(`[${this.config.sessionName}] Matched session prefix, resolving with: "${response}"`);
|
|
184
187
|
this.resolveResponse(response);
|
|
185
188
|
return;
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
// Check if we're the most recent waiting session
|
|
189
192
|
if (this.isWaitingAndMostRecent()) {
|
|
193
|
+
console.error(`[${this.config.sessionName}] Is most recent waiting, resolving with: "${text}"`);
|
|
190
194
|
this.resolveResponse(text);
|
|
195
|
+
} else {
|
|
196
|
+
console.error(`[${this.config.sessionName}] Not the most recent waiting session, ignoring`);
|
|
191
197
|
}
|
|
192
198
|
});
|
|
193
199
|
|