@mulmobridge/telegram 1.0.2 → 1.1.0
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 +5 -3
- package/dist/index.js +10 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -28,15 +28,17 @@ yarn telegram
|
|
|
28
28
|
|---|---|---|---|
|
|
29
29
|
| `TELEGRAM_BOT_TOKEN` | Yes | BotFather token | - |
|
|
30
30
|
| `TELEGRAM_ALLOWED_CHAT_IDS` | Yes | Comma-separated integer chat IDs | empty (deny all) |
|
|
31
|
-
| `MULMOCLAUDE_API_URL` | No | Server URL |
|
|
31
|
+
| `MULMOCLAUDE_API_URL` | No | Server URL | auto (`.server-port`; waits if nothing is published) |
|
|
32
32
|
| `MULMOCLAUDE_AUTH_TOKEN` | No | Bearer token override | reads from file |
|
|
33
33
|
| `TELEGRAM_POLL_TIMEOUT_SEC` | No | Long-poll timeout | `25` |
|
|
34
34
|
|
|
35
35
|
### Auth token persistence across server restarts
|
|
36
36
|
|
|
37
|
-
The MulmoClaude server regenerates a fresh bearer token on every startup and writes it to
|
|
37
|
+
The MulmoClaude server regenerates a fresh bearer token on every startup and writes it to `<workspace>/.session-token` (`$MULMOCLAUDE_WORKSPACE_PATH`, or `~/mulmoclaude` when unset), alongside the port it bound in `.server-port`.
|
|
38
38
|
|
|
39
|
-
**
|
|
39
|
+
**The bridge follows a restart on its own.** When the connection fails it re-reads both files, and if the server came back as a different generation — new token, new port, or both — it rebuilds its socket against it (#3078). You do not have to restart the bridge.
|
|
40
|
+
|
|
41
|
+
Pinning the token is still useful when the bridge runs **on a different machine** from the server, where it cannot read the workspace at all: set `MULMOCLAUDE_AUTH_TOKEN` to the same long random value on both sides. The server then uses it verbatim instead of regenerating.
|
|
40
42
|
|
|
41
43
|
```bash
|
|
42
44
|
# Server (one-time setup — same value across restarts)
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// MULMOCLAUDE_AUTH_TOKEN — optional override
|
|
13
13
|
// TELEGRAM_POLL_TIMEOUT_SEC — optional, default 25
|
|
14
14
|
import "dotenv/config";
|
|
15
|
-
import { createBridgeClient } from "@mulmobridge/client";
|
|
15
|
+
import { createBridgeClient, installProcessGuards } from "@mulmobridge/client";
|
|
16
16
|
import { createTelegramApi } from "./api.js";
|
|
17
17
|
import { parseAllowlist } from "./allowlist.js";
|
|
18
18
|
import { createMessageRouter } from "./router.js";
|
|
@@ -88,11 +88,15 @@ async function main() {
|
|
|
88
88
|
router.handlePush(ev).catch((err) => console.error(`[telegram] handlePush failed: ${String(err)}`));
|
|
89
89
|
});
|
|
90
90
|
const abortController = new AbortController();
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
// Installed here rather than at module level because the shutdown work needs
|
|
92
|
+
// the controller and the socket. `main().catch` still covers the awaited
|
|
93
|
+
// startup path above, so nothing is unguarded in between.
|
|
94
|
+
installProcessGuards({
|
|
95
|
+
name: TRANSPORT_ID,
|
|
96
|
+
onShutdown: () => {
|
|
97
|
+
abortController.abort();
|
|
98
|
+
client.close();
|
|
99
|
+
},
|
|
96
100
|
});
|
|
97
101
|
await pollLoop(api, router, {
|
|
98
102
|
pollTimeoutSec,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mulmobridge/telegram",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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,12 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"author": "Receptron Team",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@mulmobridge/client": "^1.0
|
|
33
|
+
"@mulmobridge/client": "^1.2.0",
|
|
34
34
|
"@mulmobridge/protocol": "^1.0.1",
|
|
35
35
|
"dotenv": "^17.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/node": "^26.1
|
|
38
|
+
"@types/node": "^26.4.1",
|
|
39
39
|
"typescript": "^6.0.3"
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/receptron/mulmoclaude/tree/main/packages/bridges/telegram#readme",
|