whatsapp-pi 1.0.67 → 1.0.68

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
@@ -138,7 +138,7 @@ The extension registers the following tools that the Pi agent can call:
138
138
  | `get_wa_conversation_history` | read-only | Get the most recent messages with a given `senderNumber` (accepts `+E164`, raw digits, or a JID). Supports `limit`. |
139
139
  | `check_wa_new_messages` | read-only | List conversations whose most recent message is incoming (i.e. waiting for a reply). Supports `sinceTimestamp` (ms epoch). |
140
140
 
141
- The three read-only tools query the local recents store at `~/.pi/agent/extension/whatsapp-pi/recents/recents.json`. They never touch the network and do not mark messages as read.
141
+ The three read-only tools query the local recents store at `~/.pi/agent/extensions/whatsapp-pi/recents/recents.json`. They never touch the network and do not mark messages as read.
142
142
 
143
143
  ## WhatsApp Numbers and JIDs
144
144
 
@@ -209,7 +209,7 @@ npm test
209
209
  - **Auto-Connect Support**: Use the `--whatsapp-pi-online` flag to connect on startup when credentials already exist.
210
210
  - **Group-Only Mode**: Use `--whatsapp-group <jid>` to bind Pi to a single WhatsApp group. The group must also be present in Allowed Groups.
211
211
  - **Allowed Group Reaction Mode**: Each allowed group can be set to Active or Passive. Passive mode only replies when the bot is directly mentioned with @.
212
- - **Recents Store**: Recent conversations and message history are persisted in `~/.pi/agent/extension/whatsapp-pi/recents/recents.json`.
212
+ - **Recents Store**: Recent conversations and message history are persisted in `~/.pi/agent/extensions/whatsapp-pi/recents/recents.json`.
213
213
  - **Message Detail / Reply**: Open a message from history to inspect full content and reply with `R`.
214
214
  - **Media Support**: Images are forwarded for vision analysis, audio is transcribed with Whisper, and PDFs are saved under `./.pi-data/whatsapp/documents/` with local text preview when available.
215
215
  - **Session Handling**: Saved state, allow list, and startup reconnects are restored automatically when available.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-pi",
3
- "version": "1.0.67",
3
+ "version": "1.0.68",
4
4
  "type": "module",
5
5
  "description": "WhatsApp integration extension for Pi",
6
6
  "main": "whatsapp-pi.ts",
@@ -3,11 +3,11 @@ import { homedir } from 'os';
3
3
  import { join } from 'path';
4
4
 
5
5
  export function getDefaultStorageRoot(): string {
6
- return join(homedir(), '.pi', 'agent', 'extension', 'whatsapp-pi');
6
+ return join(homedir(), '.pi', 'agent', 'extensions', 'whatsapp-pi');
7
7
  }
8
8
 
9
9
  export function getDefaultLegacyStorageRoot(): string {
10
- return join(homedir(), '.pi', 'whatsapp-pi');
10
+ return join(homedir(), '.pi', 'agent', 'extension', 'whatsapp-pi');
11
11
  }
12
12
 
13
13
  export interface StoragePaths {
@@ -71,20 +71,26 @@ async function copyEntry(source: string, target: string) {
71
71
  }
72
72
 
73
73
  export async function migrateLegacyStorage(paths: Pick<StoragePaths, 'root' | 'legacyRoot'>): Promise<boolean> {
74
- if (paths.root === paths.legacyRoot) {
75
- return false;
76
- }
74
+ const legacyRoots = [paths.legacyRoot, join(homedir(), '.pi', 'whatsapp-pi')]
75
+ .filter((root, index, roots) => root && roots.indexOf(root) === index && root !== paths.root);
77
76
 
78
- if (!(await pathExists(paths.legacyRoot))) {
79
- return false;
80
- }
77
+ let migrated = false;
81
78
 
82
79
  await mkdir(paths.root, { recursive: true });
83
- const entries = await readdir(paths.legacyRoot, { withFileTypes: true });
84
80
 
85
- for (const entry of entries) {
86
- await copyEntry(join(paths.legacyRoot, entry.name), join(paths.root, entry.name));
81
+ for (const legacyRoot of legacyRoots) {
82
+ if (!(await pathExists(legacyRoot))) {
83
+ continue;
84
+ }
85
+
86
+ const entries = await readdir(legacyRoot, { withFileTypes: true });
87
+
88
+ for (const entry of entries) {
89
+ await copyEntry(join(legacyRoot, entry.name), join(paths.root, entry.name));
90
+ }
91
+
92
+ migrated = true;
87
93
  }
88
94
 
89
- return true;
95
+ return migrated;
90
96
  }