@iamtrask/om-bridge 1.1.0 → 1.3.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.
Files changed (3) hide show
  1. package/bridge.js +3 -2
  2. package/package.json +1 -1
  3. package/setup.sh +70 -0
package/bridge.js CHANGED
@@ -42,7 +42,7 @@ async function start() {
42
42
  sock.ev.on("connection.update", async ({ connection, lastDisconnect, qr }) => {
43
43
  if (qr) {
44
44
  console.log("\nScan this QR code with WhatsApp:\n");
45
- console.log(await QRCode.toString(qr, { type: "terminal", small: true }));
45
+ console.log(await QRCode.toString(qr, { type: "terminal" }));
46
46
  }
47
47
  if (connection === "open") {
48
48
  console.log("Connected to WhatsApp!");
@@ -61,7 +61,8 @@ async function start() {
61
61
 
62
62
  sock.ev.on("messages.upsert", async ({ messages }) => {
63
63
  for (const msg of messages) {
64
- if (msg.key.fromMe) continue;
64
+ // Allow self-messages for testing (skip other fromMe like delivery receipts)
65
+ if (msg.key.fromMe && !msg.message?.conversation && !msg.message?.extendedTextMessage?.text) continue;
65
66
  const text = msg.message?.conversation
66
67
  || msg.message?.extendedTextMessage?.text
67
68
  || "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamtrask/om-bridge",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "The Open Mind — an AI auto-responder for WhatsApp. When someone texts you a message starting with \"om\", a local model replies on your behalf using only the files in that person's folder.",
5
5
  "main": "bridge.js",
6
6
  "bin": {
package/setup.sh ADDED
@@ -0,0 +1,70 @@
1
+ #!/bin/bash
2
+
3
+ # OMBox Setup — installs dependencies, pulls the model, and starts the bridge
4
+ # Usage: curl -fsSL https://raw.githubusercontent.com/.../setup.sh | bash
5
+
6
+ set -e
7
+
8
+ echo "=== OMBox Setup ==="
9
+ echo ""
10
+
11
+ # Install Node.js if missing
12
+ if ! command -v node &> /dev/null; then
13
+ echo "Node.js not found. Installing..."
14
+ if command -v brew &> /dev/null; then
15
+ brew install node
16
+ elif command -v apt-get &> /dev/null; then
17
+ curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
18
+ sudo apt-get install -y nodejs
19
+ elif command -v dnf &> /dev/null; then
20
+ curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
21
+ sudo dnf install -y nodejs
22
+ elif command -v pacman &> /dev/null; then
23
+ sudo pacman -S --noconfirm nodejs npm
24
+ else
25
+ echo "Could not auto-install Node.js. Trying nvm..."
26
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
27
+ export NVM_DIR="$HOME/.nvm"
28
+ [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
29
+ nvm install --lts
30
+ fi
31
+ fi
32
+
33
+ # Verify node is available
34
+ if ! command -v node &> /dev/null; then
35
+ echo "ERROR: Node.js installation failed. Please install manually from https://nodejs.org"
36
+ exit 1
37
+ fi
38
+ echo "Node.js: $(node --version)"
39
+
40
+ # Install Ollama if missing
41
+ if ! command -v ollama &> /dev/null; then
42
+ echo "Ollama not found. Installing..."
43
+ curl -fsSL https://ollama.com/install.sh | sh
44
+ fi
45
+ echo "Ollama: $(ollama --version)"
46
+
47
+ # Start Ollama in the background if not already running
48
+ if ! curl -s http://localhost:11434/api/tags &> /dev/null; then
49
+ echo "Starting Ollama server..."
50
+ ollama serve &> /dev/null &
51
+ sleep 3
52
+ fi
53
+
54
+ # Pull the model
55
+ echo ""
56
+ echo "Pulling gemma4 (~9GB). If that's too big, ctrl-c and run:"
57
+ echo " ollama pull qwen3.5:0.8b"
58
+ echo " (then update MODEL in your Python code to match)"
59
+ echo ""
60
+ ollama pull gemma4
61
+
62
+ echo ""
63
+ echo "=== Setup complete! ==="
64
+ echo ""
65
+ echo "Starting WhatsApp bridge... scan the QR code with your phone."
66
+ echo "(WhatsApp > Settings > Linked Devices > Link a Device)"
67
+ echo ""
68
+
69
+ # Start the WhatsApp bridge
70
+ npx @iamtrask/om-bridge