@mulmobridge/twilio-sms 0.1.1 → 1.0.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/README.md +25 -0
- package/dist/index.js +12 -10
- package/package.json +25 -5
package/README.md
CHANGED
|
@@ -51,6 +51,24 @@ Text the Twilio number — you'll get a reply.
|
|
|
51
51
|
| `MULMOCLAUDE_AUTH_TOKEN` | no | auto | MulmoClaude bearer token override |
|
|
52
52
|
| `MULMOCLAUDE_API_URL` | no | `http://localhost:3001` | MulmoClaude server URL |
|
|
53
53
|
|
|
54
|
+
### Auth token persistence across server restarts
|
|
55
|
+
|
|
56
|
+
The MulmoClaude server regenerates a fresh bearer token on every startup and writes it to `~/mulmoclaude/.session-token`. The bridge reads that file once at launch and keeps the token in memory — so if the server restarts while the bridge is running, the bridge keeps using the **old** token and every API call returns **401**, silently.
|
|
57
|
+
|
|
58
|
+
**Fix**: set `MULMOCLAUDE_AUTH_TOKEN` to the same long random value on **both** the server and the bridge. The server uses it verbatim instead of regenerating, so the token survives restarts and the bridge stays authenticated.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Server (one-time setup — same value across restarts)
|
|
62
|
+
MULMOCLAUDE_AUTH_TOKEN=long-random-string yarn dev
|
|
63
|
+
|
|
64
|
+
# Bridge (separate process / machine — same value)
|
|
65
|
+
MULMOCLAUDE_AUTH_TOKEN=long-random-string \
|
|
66
|
+
<bridge-specific-envs> \
|
|
67
|
+
npx <this-package>@latest
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Recommended: at least 32 characters of random data (the server logs a warning at startup for shorter values).
|
|
71
|
+
|
|
54
72
|
## How it works
|
|
55
73
|
|
|
56
74
|
1. Twilio posts form-encoded `From`, `To`, `Body`, `MessageSid` to `/sms` every time an SMS arrives.
|
|
@@ -113,3 +131,10 @@ Part of the [`@mulmobridge/*`](https://www.npmjs.com/~mulmobridge) package famil
|
|
|
113
131
|
- [`@mulmobridge/xmpp`](https://www.npmjs.com/package/@mulmobridge/xmpp) — XMPP / Jabber
|
|
114
132
|
- [`@mulmobridge/zulip`](https://www.npmjs.com/package/@mulmobridge/zulip) — Zulip
|
|
115
133
|
|
|
134
|
+
## Related projects
|
|
135
|
+
|
|
136
|
+
Published from the MulmoClaude monorepo by [Receptron](https://github.com/receptron).
|
|
137
|
+
|
|
138
|
+
- **[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.
|
|
139
|
+
- **[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.
|
|
140
|
+
- **[MulmoTerminal manual](https://receptron.github.io/mulmoterminal/)** — setup, workflows, feature reference, configuration, mobile notifications, and alternative / local model providers. Available in English and Japanese.
|
package/dist/index.js
CHANGED
|
@@ -27,17 +27,22 @@ import "dotenv/config";
|
|
|
27
27
|
import crypto from "crypto";
|
|
28
28
|
import express from "express";
|
|
29
29
|
import { createBridgeClient, chunkText } from "@mulmobridge/client";
|
|
30
|
+
import { parseCsvSet } from "@mulmoclaude/common";
|
|
30
31
|
const TRANSPORT_ID = "twilio-sms";
|
|
31
32
|
const MAX_SMS_LEN = 1_600; // Twilio concatenates segments up to 1600 chars
|
|
32
33
|
const FETCH_TIMEOUT_MS = 15_000;
|
|
33
34
|
const PORT = Number(process.env.TWILIO_WEBHOOK_PORT) || 3010;
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
function readRequiredEnv() {
|
|
36
|
+
const accountSid = process.env.TWILIO_ACCOUNT_SID;
|
|
37
|
+
const authToken = process.env.TWILIO_AUTH_TOKEN;
|
|
38
|
+
const fromNumber = process.env.TWILIO_FROM_NUMBER;
|
|
39
|
+
if (!accountSid || !authToken || !fromNumber) {
|
|
40
|
+
console.error("TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_FROM_NUMBER are required.\nSee README for setup instructions.");
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
return { accountSid, authToken, fromNumber };
|
|
40
44
|
}
|
|
45
|
+
const { accountSid, authToken, fromNumber } = readRequiredEnv();
|
|
41
46
|
const publicUrl = process.env.TWILIO_PUBLIC_URL?.replace(/\/$/, "");
|
|
42
47
|
const allowUnverified = process.env.TWILIO_ALLOW_UNVERIFIED === "1";
|
|
43
48
|
if (!publicUrl && !allowUnverified) {
|
|
@@ -49,10 +54,7 @@ if (!publicUrl && !allowUnverified) {
|
|
|
49
54
|
if (!publicUrl && allowUnverified) {
|
|
50
55
|
console.warn("[twilio-sms] ⚠ TWILIO_ALLOW_UNVERIFIED=1 — signature verification DISABLED. Use only in local testing.");
|
|
51
56
|
}
|
|
52
|
-
const allowedNumbers =
|
|
53
|
-
.split(",")
|
|
54
|
-
.map((num) => num.trim())
|
|
55
|
-
.filter(Boolean));
|
|
57
|
+
const allowedNumbers = parseCsvSet(process.env.TWILIO_ALLOWED_NUMBERS);
|
|
56
58
|
const allowAll = allowedNumbers.size === 0;
|
|
57
59
|
const mulmo = createBridgeClient({ transportId: TRANSPORT_ID });
|
|
58
60
|
mulmo.onPush((pushEvent) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mulmobridge/twilio-sms",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Twilio SMS bridge for MulmoBridge — inbound SMS via webhook, outbound via Twilio REST API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,19 +16,39 @@
|
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"prepack": "yarn build",
|
|
18
18
|
"typecheck": "tsc --noEmit",
|
|
19
|
-
"test": "echo no tests yet"
|
|
19
|
+
"test": "echo no tests yet",
|
|
20
|
+
"lint": "eslint src"
|
|
20
21
|
},
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"author": "Receptron Team",
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@mulmobridge/client": "^0.1
|
|
25
|
-
"@mulmobridge/protocol": "^0.1
|
|
25
|
+
"@mulmobridge/client": "^1.0.1",
|
|
26
|
+
"@mulmobridge/protocol": "^1.0.1",
|
|
27
|
+
"@mulmoclaude/common": "^1.1.1",
|
|
26
28
|
"dotenv": "^17.0.0",
|
|
27
29
|
"express": "^5.0.0"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
32
|
"@types/express": "^5.0.0",
|
|
31
|
-
"@types/node": "^
|
|
33
|
+
"@types/node": "^26.1.1",
|
|
32
34
|
"typescript": "^6.0.3"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/receptron/mulmoclaude/tree/main/packages/bridges/twilio-sms#readme",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/receptron/mulmoclaude.git",
|
|
40
|
+
"directory": "packages/bridges/twilio-sms"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"sms",
|
|
44
|
+
"twilio",
|
|
45
|
+
"mulmobridge",
|
|
46
|
+
"chatbot",
|
|
47
|
+
"bridge",
|
|
48
|
+
"ai-agent",
|
|
49
|
+
"mulmoclaude"
|
|
50
|
+
],
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/receptron/mulmoclaude/issues"
|
|
33
53
|
}
|
|
34
54
|
}
|