@coinseeker/opencode-telegram-plugin 1.0.1 → 1.0.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/dist/telegram-remote.js +4 -3
- package/package.json +1 -1
package/dist/telegram-remote.js
CHANGED
|
@@ -238,6 +238,7 @@ function parsePending(text) {
|
|
|
238
238
|
if (!Array.isArray(parsed.questions)) throw new Error("Invalid pending question: questions");
|
|
239
239
|
if (!Array.isArray(parsed.telegramMessageIds)) throw new Error("Invalid pending question: telegramMessageIds");
|
|
240
240
|
if (!Array.isArray(parsed.answersInProgress)) throw new Error("Invalid pending question: answersInProgress");
|
|
241
|
+
parsed.answersInProgress = parsed.answersInProgress.map((answer) => answer ?? null);
|
|
241
242
|
return parsed;
|
|
242
243
|
}
|
|
243
244
|
async function listPendingFiles(dir) {
|
|
@@ -323,7 +324,7 @@ function loadPluginEnv(opts) {
|
|
|
323
324
|
join3(opts.pluginDir, "../../.env"),
|
|
324
325
|
join3(opts.pluginDir, "..", ".env"),
|
|
325
326
|
join3(opts.pluginDir, ".env"),
|
|
326
|
-
join3(homedir2(), ".config/opencode/telegram-remote/.env")
|
|
327
|
+
join3(opts.homeDir ?? homedir2(), ".config/opencode/telegram-remote/.env")
|
|
327
328
|
];
|
|
328
329
|
const loadedFrom = [];
|
|
329
330
|
const values = {};
|
|
@@ -842,7 +843,7 @@ async function editPromptForQuestion(ctx, pending, shortHash, questionIndex) {
|
|
|
842
843
|
await ctx.bot.editMessageText(messageId, questionPromptText(pending, questionIndex), { reply_markup: { inline_keyboard: inlineKeyboard } });
|
|
843
844
|
}
|
|
844
845
|
async function completeIfReady(ctx, pending, shortHash) {
|
|
845
|
-
const nextIndex = pending.answersInProgress.findIndex((answer) => answer ===
|
|
846
|
+
const nextIndex = pending.answersInProgress.findIndex((answer) => answer === null);
|
|
846
847
|
if (nextIndex >= 0) {
|
|
847
848
|
pending.currentQuestionIndex = nextIndex;
|
|
848
849
|
await ctx.pendingQuestions.savePending(shortHash, pending);
|
|
@@ -884,7 +885,7 @@ async function handleQuestionAsked(event, ctx) {
|
|
|
884
885
|
expiresAt: sentAt + QUESTION_EXPIRY_MS,
|
|
885
886
|
telegramMessageIds: [],
|
|
886
887
|
currentQuestionIndex: 0,
|
|
887
|
-
answersInProgress: request.questions.map(() =>
|
|
888
|
+
answersInProgress: request.questions.map(() => null)
|
|
888
889
|
};
|
|
889
890
|
try {
|
|
890
891
|
const message = request.questions.length === 1 ? await ctx.bot.sendQuestionWithKeyboard(firstQuestion, callbackDataForQuestion(shortHash, 0, firstQuestion)) : await ctx.bot.sendMessage(questionPromptText(pending, 0), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinseeker/opencode-telegram-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Control and monitor OpenCode from Telegram with notifications, question replies, and subagent-aware completion.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/telegram-remote.js",
|