@mulmobridge/telegram 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
@@ -102,6 +102,14 @@ Part of the [`@mulmobridge/*`](https://www.npmjs.com/~mulmobridge) package famil
102
102
  - [`@mulmobridge/xmpp`](https://www.npmjs.com/package/@mulmobridge/xmpp) — XMPP / Jabber
103
103
  - [`@mulmobridge/zulip`](https://www.npmjs.com/package/@mulmobridge/zulip) — Zulip
104
104
 
105
+ ## Related projects
106
+
107
+ Published from the MulmoClaude monorepo by [Receptron](https://github.com/receptron).
108
+
109
+ - **[MulmoClaude](https://github.com/receptron/mulmoclaude)** — an open-source AI assistant platform that runs on your own computer. Claude Code as the engine, a personal wiki for long-term memory, schema-driven collections for your data, and chat that summons the right GUI (markdown, charts, forms, spreadsheets, wikis) for each task.
110
+ - **[MulmoTerminal](https://github.com/receptron/mulmoterminal)** — a terminal-first cockpit for running many AI coding agents in parallel. One roster showing every session's summary and PR status, tmux-backed session persistence, git-worktree isolation, one-click PRs, and mobile push with remote reply.
111
+ - **[MulmoTerminal manual](https://receptron.github.io/mulmoterminal/)** — setup, workflows, feature reference, configuration, mobile notifications, and alternative / local model providers. Available in English and Japanese.
112
+
105
113
  ## License
106
114
 
107
115
  MIT
package/dist/api.d.ts CHANGED
@@ -46,9 +46,9 @@ export interface TelegramApiOptions {
46
46
  fetchImpl?: typeof fetch;
47
47
  }
48
48
  export interface GetUpdatesOptions {
49
- offset?: number;
50
- timeoutSec?: number;
51
- signal?: AbortSignal;
49
+ offset?: number | undefined;
50
+ timeoutSec?: number | undefined;
51
+ signal?: AbortSignal | undefined;
52
52
  }
53
53
  export interface TelegramApi {
54
54
  getUpdates(opts?: GetUpdatesOptions): Promise<TelegramUpdate[]>;
package/dist/api.js CHANGED
@@ -13,7 +13,7 @@ export function createTelegramApi(opts) {
13
13
  params.set("timeout", String(gu.timeoutSec));
14
14
  }
15
15
  const url = `${base}/getUpdates?${params.toString()}`;
16
- const res = await fetchImpl(url, { signal: gu.signal });
16
+ const res = await fetchImpl(url, gu.signal !== undefined ? { signal: gu.signal } : {});
17
17
  if (!res.ok) {
18
18
  throw new Error(`getUpdates failed: ${res.status} ${await safeText(res)}`);
19
19
  }
package/dist/router.js CHANGED
@@ -74,42 +74,42 @@ export function createMessageRouter(deps) {
74
74
  // exclusive (photo OR document), but forwarded messages or future
75
75
  // API changes could carry both. We collect all available attachments
76
76
  // rather than picking one.
77
- async function tryDownloadAttachments(msg) {
78
- const attachments = [];
79
- let anyFailed = false;
80
- if (Array.isArray(msg.photo) && msg.photo.length > 0) {
81
- const largest = msg.photo[msg.photo.length - 1];
82
- try {
83
- const dataUrl = await api.downloadFile(largest.file_id, "image/jpeg");
84
- const parsed = parseDataUrl(dataUrl);
85
- if (parsed) {
86
- attachments.push({ mimeType: parsed.mimeType, data: parsed.data });
87
- }
88
- }
89
- catch (err) {
90
- log.error(`[telegram] photo download failed: ${String(err)}`);
91
- anyFailed = true;
92
- }
77
+ async function downloadPhoto(msg) {
78
+ // Telegram lists photo sizes smallest-first, so the last entry is
79
+ // the highest resolution available.
80
+ const largest = Array.isArray(msg.photo) ? msg.photo[msg.photo.length - 1] : undefined;
81
+ if (!largest)
82
+ return null;
83
+ try {
84
+ const parsed = parseDataUrl(await api.downloadFile(largest.file_id, "image/jpeg"));
85
+ return parsed ? { attachment: { mimeType: parsed.mimeType, data: parsed.data } } : null;
93
86
  }
94
- if (msg.document) {
95
- const doc = msg.document;
96
- const fallbackMime = doc.mime_type ?? "application/octet-stream";
97
- try {
98
- const dataUrl = await api.downloadFile(doc.file_id, fallbackMime);
99
- const parsed = parseDataUrl(dataUrl);
100
- if (parsed) {
101
- attachments.push({
102
- mimeType: parsed.mimeType,
103
- data: parsed.data,
104
- filename: doc.file_name,
105
- });
106
- }
107
- }
108
- catch (err) {
109
- log.error(`[telegram] document download failed: ${String(err)}`);
110
- anyFailed = true;
111
- }
87
+ catch (err) {
88
+ log.error(`[telegram] photo download failed: ${String(err)}`);
89
+ return { failed: true };
90
+ }
91
+ }
92
+ async function downloadDocument(msg) {
93
+ const doc = msg.document;
94
+ if (!doc)
95
+ return null;
96
+ const fallbackMime = doc.mime_type ?? "application/octet-stream";
97
+ try {
98
+ const parsed = parseDataUrl(await api.downloadFile(doc.file_id, fallbackMime));
99
+ if (!parsed)
100
+ return null;
101
+ const filename = doc.file_name !== undefined ? { filename: doc.file_name } : {};
102
+ return { attachment: { mimeType: parsed.mimeType, data: parsed.data, ...filename } };
112
103
  }
104
+ catch (err) {
105
+ log.error(`[telegram] document download failed: ${String(err)}`);
106
+ return { failed: true };
107
+ }
108
+ }
109
+ async function tryDownloadAttachments(msg) {
110
+ const outcomes = [await downloadPhoto(msg), await downloadDocument(msg)];
111
+ const attachments = outcomes.flatMap((outcome) => (outcome && "attachment" in outcome ? [outcome.attachment] : []));
112
+ const anyFailed = outcomes.some((outcome) => outcome !== null && "failed" in outcome);
113
113
  if (attachments.length === 0 && anyFailed) {
114
114
  return { attachments: [], failed: true };
115
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulmobridge/telegram",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Telegram bridge for MulmoBridge — connect a Telegram bot to MulmoClaude",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,12 +30,30 @@
30
30
  "license": "MIT",
31
31
  "author": "Receptron Team",
32
32
  "dependencies": {
33
- "@mulmobridge/client": "^1.0.0",
34
- "@mulmobridge/protocol": "^1.0.0",
33
+ "@mulmobridge/client": "^1.0.2",
34
+ "@mulmobridge/protocol": "^1.0.1",
35
35
  "dotenv": "^17.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@types/node": "^26.1.1",
38
+ "@types/node": "^26.1.2",
39
39
  "typescript": "^6.0.3"
40
+ },
41
+ "homepage": "https://github.com/receptron/mulmoclaude/tree/main/packages/bridges/telegram#readme",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/receptron/mulmoclaude.git",
45
+ "directory": "packages/bridges/telegram"
46
+ },
47
+ "keywords": [
48
+ "telegram",
49
+ "telegram-bot",
50
+ "mulmobridge",
51
+ "chatbot",
52
+ "bridge",
53
+ "ai-agent",
54
+ "mulmoclaude"
55
+ ],
56
+ "bugs": {
57
+ "url": "https://github.com/receptron/mulmoclaude/issues"
40
58
  }
41
59
  }