@grinev/opencode-telegram-bot 0.6.1-rc.1 → 0.6.1
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/dist/bot/index.js +19 -9
- package/dist/i18n/en.js +1 -2
- package/dist/i18n/ru.js +1 -2
- package/dist/summary/aggregator.js +2 -1
- package/package.json +1 -1
package/dist/bot/index.js
CHANGED
|
@@ -701,6 +701,15 @@ export function createBot() {
|
|
|
701
701
|
promptOptions.variant = storedModel.variant;
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
|
+
const promptErrorLogContext = {
|
|
705
|
+
sessionId: currentSession.id,
|
|
706
|
+
directory: currentSession.directory,
|
|
707
|
+
agent: currentAgent || "default",
|
|
708
|
+
modelProvider: storedModel.providerID || "default",
|
|
709
|
+
modelId: storedModel.modelID || "default",
|
|
710
|
+
variant: storedModel.variant || "default",
|
|
711
|
+
promptLength: text.length,
|
|
712
|
+
};
|
|
704
713
|
logger.info(`[Bot] Calling session.prompt (fire-and-forget) with agent=${currentAgent}...`);
|
|
705
714
|
// CRITICAL: DO NOT wait for session.prompt to complete.
|
|
706
715
|
// If we wait, the handler will not finish and grammY will not call getUpdates,
|
|
@@ -711,20 +720,21 @@ export function createBot() {
|
|
|
711
720
|
task: () => opencodeClient.session.prompt(promptOptions),
|
|
712
721
|
onSuccess: ({ error }) => {
|
|
713
722
|
if (error) {
|
|
714
|
-
const details = formatErrorDetails(error);
|
|
715
|
-
logger.error("OpenCode API error
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}))
|
|
721
|
-
.catch(() => { });
|
|
723
|
+
const details = formatErrorDetails(error, 6000);
|
|
724
|
+
logger.error("[Bot] OpenCode API returned an error for session.prompt", promptErrorLogContext);
|
|
725
|
+
logger.error("[Bot] session.prompt error details:", details);
|
|
726
|
+
logger.error("[Bot] session.prompt raw API error object:", error);
|
|
727
|
+
// Send user-friendly error via API directly because ctx is no longer available
|
|
728
|
+
void bot.api.sendMessage(ctx.chat.id, t("bot.prompt_send_error")).catch(() => { });
|
|
722
729
|
return;
|
|
723
730
|
}
|
|
724
731
|
logger.info("[Bot] session.prompt completed");
|
|
725
732
|
},
|
|
726
733
|
onError: (error) => {
|
|
727
|
-
|
|
734
|
+
const details = formatErrorDetails(error, 6000);
|
|
735
|
+
logger.error("[Bot] session.prompt background task failed", promptErrorLogContext);
|
|
736
|
+
logger.error("[Bot] session.prompt background failure details:", details);
|
|
737
|
+
logger.error("[Bot] session.prompt raw background error object:", error);
|
|
728
738
|
void bot.api.sendMessage(ctx.chat.id, t("bot.prompt_send_error")).catch(() => { });
|
|
729
739
|
},
|
|
730
740
|
});
|
package/dist/i18n/en.js
CHANGED
|
@@ -40,8 +40,7 @@ export const en = {
|
|
|
40
40
|
"bot.session_created": "✅ Session created: {title}",
|
|
41
41
|
"bot.session_busy": "⏳ Agent is already running a task. Wait for completion or use /stop to interrupt current run.",
|
|
42
42
|
"bot.session_reset_project_mismatch": "⚠️ Active session does not match the selected project, so it was reset. Use /sessions to pick one or /new to create a new session.",
|
|
43
|
-
"bot.
|
|
44
|
-
"bot.prompt_send_error": "🔴 An error occurred while sending request to OpenCode.",
|
|
43
|
+
"bot.prompt_send_error": "Failed to send request to OpenCode.",
|
|
45
44
|
"bot.unknown_command": "⚠️ Unknown command: {command}. Use /help to see available commands.",
|
|
46
45
|
"status.header_running": "🟢 **OpenCode Server is running**",
|
|
47
46
|
"status.health.healthy": "Healthy",
|
package/dist/i18n/ru.js
CHANGED
|
@@ -40,8 +40,7 @@ export const ru = {
|
|
|
40
40
|
"bot.session_created": "✅ Сессия создана: {title}",
|
|
41
41
|
"bot.session_busy": "⏳ Агент уже выполняет задачу. Дождитесь завершения или используйте /stop, чтобы прервать текущий запуск.",
|
|
42
42
|
"bot.session_reset_project_mismatch": "⚠️ Активная сессия не соответствует выбранному проекту, поэтому была сброшена. Используйте /sessions для выбора или /new для создания новой сессии.",
|
|
43
|
-
"bot.
|
|
44
|
-
"bot.prompt_send_error": "🔴 Произошла ошибка при отправке запроса в OpenCode.",
|
|
43
|
+
"bot.prompt_send_error": "Не удалось отправить запрос в OpenCode.",
|
|
45
44
|
"bot.unknown_command": "⚠️ Неизвестная команда: {command}. Используйте /help для списка команд.",
|
|
46
45
|
"status.header_running": "🟢 **OpenCode Server запущен**",
|
|
47
46
|
"status.health.healthy": "Healthy",
|
|
@@ -193,8 +193,9 @@ class SummaryAggregator {
|
|
|
193
193
|
this.currentMessageParts.set(messageID, []);
|
|
194
194
|
this.messageCount++;
|
|
195
195
|
this.startTypingIndicator();
|
|
196
|
+
const isSummaryMessage = info.summary === true;
|
|
196
197
|
// Notify that agent started thinking
|
|
197
|
-
if (this.onThinkingCallback) {
|
|
198
|
+
if (!isSummaryMessage && this.onThinkingCallback) {
|
|
198
199
|
const callback = this.onThinkingCallback;
|
|
199
200
|
setImmediate(() => {
|
|
200
201
|
if (typeof callback === "function") {
|