@coinseeker/opencode-telegram-plugin 1.0.0 → 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/README.md CHANGED
@@ -4,6 +4,13 @@ Control and monitor OpenCode from Telegram.
4
4
 
5
5
  ## Install
6
6
 
7
+ Paste below into your OpenCode.
8
+
9
+ ```text
10
+ Install and configure OpenCode Telegram Plugin by following the instructions here:
11
+ https://raw.githubusercontent.com/coin-seeker/opencode-telegram-plugin/refs/heads/main/docs/installation.md
12
+ ```
13
+
7
14
  Configure the npm package in `~/.config/opencode/opencode.json`:
8
15
 
9
16
  ```json
@@ -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 === void 0);
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(() => void 0)
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.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",