whatsapp-pi 1.0.46 → 1.0.48
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 +51 -38
- package/package.json +2 -2
- package/src/i18n.ts +710 -0
- package/src/models/whatsapp.types.ts +0 -3
- package/src/services/audio.service.ts +5 -4
- package/src/services/baileys-console-filter.ts +7 -5
- package/src/services/incoming-media.service.ts +19 -18
- package/src/services/incoming-message.resolver.ts +150 -129
- package/src/services/message.sender.ts +121 -93
- package/src/services/recents.service.ts +4 -2
- package/src/services/session.manager.ts +235 -167
- package/src/services/whatsapp-pi.logger.ts +26 -1
- package/src/services/whatsapp.service.ts +665 -568
- package/src/ui/menu.handler.ts +252 -109
- package/src/ui/message-detail.view.ts +12 -11
- package/src/ui/message-reply.view.ts +9 -8
- package/whatsapp-pi.ts +100 -29
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A WhatsApp integration extension for the **[Pi Coding Agent](https://github.com/
|
|
|
8
8
|
|
|
9
9
|
[](https://github.com/RaphaCastelloes/whatsapp-pi)
|
|
10
10
|
|
|
11
|
-
Pi is a powerful agentic AI coding assistant that operates in your terminal. This extension allows you to chat and pair-program with your Pi agent directly through WhatsApp, featuring message filtering, allow-listing, and reliable message delivery.
|
|
11
|
+
Pi is a powerful agentic AI coding assistant that operates in your terminal. This extension allows you to chat and pair-program with your Pi agent directly through WhatsApp, featuring message filtering, allow-listing, recents/history browsing, message detail/reply, group-only binding, and reliable message delivery.
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
@@ -16,10 +16,17 @@ Pi is a powerful agentic AI coding assistant that operates in your terminal. Thi
|
|
|
16
16
|
- **Allow List**: Control which numbers can interact with Pi
|
|
17
17
|
- Add contacts with optional names for easy identification
|
|
18
18
|
- View ignored numbers (not in allow list) and add them when needed
|
|
19
|
+
- Manage aliases and print allowed numbers from the menu
|
|
20
|
+
- **Allowed Groups**: Control which WhatsApp groups can interact with Pi
|
|
21
|
+
- Add group JIDs with optional aliases
|
|
22
|
+
- Only groups in Allowed Groups are processed by the agent
|
|
23
|
+
- **Recents & History**: Browse recent conversations, inspect full message history, and reply from message detail view
|
|
19
24
|
- **Reliable Messaging**: Queue-based message sending with retry logic
|
|
20
|
-
- **TUI Integration**: Menu-driven interface for managing connections and
|
|
25
|
+
- **TUI Integration**: Menu-driven interface for managing connections, contacts, and recent chats
|
|
26
|
+
- **Group-Only Mode**: Bind the agent to a single WhatsApp group with `--whatsapp-group`
|
|
21
27
|
- **Media Support**:
|
|
22
28
|
- **Vision Analysis**: Automatically forwards WhatsApp images to Pi for analysis.
|
|
29
|
+
- **Audio Transcription**: Transcribes voice notes when Whisper is installed.
|
|
23
30
|
- **Document Handling**: Downloads and stores documents (PDF, text) for agent access.
|
|
24
31
|
|
|
25
32
|
## Prerequisites
|
|
@@ -46,12 +53,12 @@ pi install npm:whatsapp-pi
|
|
|
46
53
|
pi
|
|
47
54
|
```
|
|
48
55
|
|
|
49
|
-
After connecting WhatsApp once from the menu and scanning the QR code, you can start Pi with auto-connect enabled:
|
|
50
|
-
```bash
|
|
51
|
-
pi --whatsapp-pi-online
|
|
52
|
-
```
|
|
56
|
+
After connecting WhatsApp once from the menu and scanning the QR code, you can start Pi with auto-connect enabled:
|
|
57
|
+
```bash
|
|
58
|
+
pi --whatsapp-pi-online
|
|
59
|
+
```
|
|
53
60
|
|
|
54
|
-
3. Use the menu to connect WhatsApp and manage allowed
|
|
61
|
+
3. Use the menu to connect WhatsApp and manage allowed numbers and groups
|
|
55
62
|
|
|
56
63
|
## Development / Testing
|
|
57
64
|
|
|
@@ -69,15 +76,15 @@ npm install
|
|
|
69
76
|
pi -e whatsapp-pi.ts
|
|
70
77
|
```
|
|
71
78
|
|
|
72
|
-
For verbose mode (shows Baileys trace logs for debugging):
|
|
73
|
-
```bash
|
|
74
|
-
pi -e whatsapp-pi.ts --verbose
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
To test startup auto-connect locally after you have already paired WhatsApp:
|
|
78
|
-
```bash
|
|
79
|
-
pi -e whatsapp-pi.ts --whatsapp-pi-online
|
|
80
|
-
```
|
|
79
|
+
For verbose mode (shows Baileys trace logs for debugging):
|
|
80
|
+
```bash
|
|
81
|
+
pi -e whatsapp-pi.ts --verbose
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
To test startup auto-connect locally after you have already paired WhatsApp:
|
|
85
|
+
```bash
|
|
86
|
+
pi -e whatsapp-pi.ts --whatsapp-pi-online
|
|
87
|
+
```
|
|
81
88
|
|
|
82
89
|
## Commands
|
|
83
90
|
|
|
@@ -87,18 +94,26 @@ pi -e whatsapp-pi.ts --whatsapp-pi-online
|
|
|
87
94
|
- **Connect / Reconnect WhatsApp** - Start WhatsApp connection using saved credentials when available; QR code appears only if pairing is required
|
|
88
95
|
- **Disconnect WhatsApp** - Stop WhatsApp connection
|
|
89
96
|
- **Logoff (Delete Session)** - Remove all credentials and session data
|
|
97
|
+
- **Recents** - Open recent conversations, view history, and reply
|
|
90
98
|
- **Allowed Numbers** - Manage contacts that can interact with Pi
|
|
91
|
-
- **
|
|
99
|
+
- **Allowed Groups** - Manage WhatsApp groups that can interact with Pi
|
|
92
100
|
|
|
93
101
|
### Allowed Numbers Management
|
|
94
102
|
- **Add Number** - Add a new contact to the allow list (format: +5511999999999)
|
|
95
|
-
- **Select a contact** - Open a submenu with **Send Message**, **Remove Number**, and **Back**
|
|
103
|
+
- **Select a contact** - Open a submenu with **History**, **Send Message**, **Print Number**, alias actions, **Remove Number**, and **Back**
|
|
96
104
|
- **Back** - Return to main menu
|
|
97
105
|
|
|
98
|
-
###
|
|
99
|
-
- **
|
|
100
|
-
- **
|
|
101
|
-
- **
|
|
106
|
+
### Allowed Groups Management
|
|
107
|
+
- **Add Group** - Add a WhatsApp group JID to the allowed groups list (format: 120363012345@g.us)
|
|
108
|
+
- **Select a group** - Open a submenu with **History**, **Send Message**, **Print Group JID**, alias actions, **Remove Group**, and **Back**
|
|
109
|
+
- **Back** - Return to main menu
|
|
110
|
+
|
|
111
|
+
### Recents Management
|
|
112
|
+
- **History** - Open full message history for that conversation
|
|
113
|
+
- **Send Message** - Send a new message without Pi suffix
|
|
114
|
+
- **Reply** - Open message detail, then press `R` to reply
|
|
115
|
+
- **Allow Number / Allow Group** - Move a recent sender into the appropriate allow list
|
|
116
|
+
- **Remove Alias** - Clear saved alias for that sender
|
|
102
117
|
- **Back** - Return to main menu
|
|
103
118
|
|
|
104
119
|
## Project Structure
|
|
@@ -106,11 +121,11 @@ pi -e whatsapp-pi.ts --whatsapp-pi-online
|
|
|
106
121
|
```
|
|
107
122
|
src/
|
|
108
123
|
├── models/ # Type definitions
|
|
109
|
-
├── services/ # Core services (WhatsApp, Session,
|
|
110
|
-
└── ui/ # Menu handlers
|
|
124
|
+
├── services/ # Core services (WhatsApp, Session, Recents, Media)
|
|
125
|
+
└── ui/ # Menu handlers and TUI views
|
|
111
126
|
|
|
112
|
-
|
|
113
|
-
|
|
127
|
+
tests/
|
|
128
|
+
└── unit/ # Unit tests
|
|
114
129
|
```
|
|
115
130
|
|
|
116
131
|
## Development
|
|
@@ -122,15 +137,13 @@ npm test
|
|
|
122
137
|
|
|
123
138
|
## Implementation Notes
|
|
124
139
|
|
|
125
|
-
### Recent Feature Updates (2026-
|
|
126
|
-
|
|
127
|
-
- **Auto-Connect Support**: Use the `--whatsapp-pi-online` flag to
|
|
128
|
-
- **
|
|
129
|
-
- **
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- **
|
|
133
|
-
- **Intelligent Message Filtering**:
|
|
134
|
-
|
|
135
|
-
- **Manual Interaction**: Users can now interact with the bot from their own WhatsApp account; the bot will process `fromMe` messages as long as they don't contain the bot's signature.
|
|
136
|
-
- **Storage Management**: All persistent data (auth state, documents, config) is centralized in the `.pi-data/` directory.
|
|
140
|
+
### Recent Feature Updates (2026-05)
|
|
141
|
+
|
|
142
|
+
- **Auto-Connect Support**: Use the `--whatsapp-pi-online` flag to connect on startup when credentials already exist.
|
|
143
|
+
- **Group-Only Mode**: Use `--whatsapp-group <jid>` to bind Pi to a single WhatsApp group. The group must also be present in Allowed Groups.
|
|
144
|
+
- **Recents Store**: Recent conversations and message history are persisted in `~/.pi/whatsapp-pi/recents/recents.json`.
|
|
145
|
+
- **Message Detail / Reply**: Open a message from history to inspect full content and reply with `R`.
|
|
146
|
+
- **Media Support**: Images are forwarded for vision analysis, audio is transcribed with Whisper, and documents are saved under `./.pi-data/whatsapp/documents/`.
|
|
147
|
+
- **Session Handling**: Saved state, allow list, and startup reconnects are restored automatically when available.
|
|
148
|
+
- **Intelligent Message Filtering**: Messages ending with `π` are ignored to prevent bot loops.
|
|
149
|
+
- **Storage Management**: Persistent data lives under `.pi-data/` plus the recents store in the user home directory.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whatsapp-pi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.48",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "WhatsApp integration extension for Pi",
|
|
6
6
|
"main": "whatsapp-pi.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"typecheck": "tsc --noEmit"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"
|
|
35
|
+
"baileys": "^6.7.21",
|
|
36
36
|
"pino": "^10.3.1",
|
|
37
37
|
"qrcode-terminal": "^0.12.0"
|
|
38
38
|
},
|