@melandlabs/integrations-whatsapp 0.2.1 → 0.3.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/dist/conversation-store.js +2 -2
- package/dist/index.js +5 -3
- package/package.json +6 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { homedir } from 'os';
|
|
2
1
|
import { join } from 'path';
|
|
3
2
|
import { loadChannelDay, saveChannelMessage, clearChannelConversationFromAllDays, clearAllChannelForUser } from '@melandlabs/ai/store';
|
|
3
|
+
import { getOpenContextPath } from '@melandlabs/env-config';
|
|
4
4
|
|
|
5
5
|
// src/conversation-store.ts
|
|
6
6
|
function getAppMemoryDir(userId) {
|
|
7
|
-
const base =
|
|
7
|
+
const base = getOpenContextPath("data", "memory");
|
|
8
8
|
return userId ? join(base, userId) : base;
|
|
9
9
|
}
|
|
10
10
|
var WhatsAppConversationStore = class {
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { MessagePlatformAdapter } from '@melandlabs/integrations-channels';
|
|
|
5
5
|
import { proto, fetchLatestBaileysVersion, makeWASocket, DisconnectReason } from '@whiskeysockets/baileys';
|
|
6
6
|
import { downloadMediaMessage } from '@whiskeysockets/baileys/lib/Utils/messages.js';
|
|
7
7
|
import { rmSync, mkdirSync, writeFileSync, renameSync, existsSync, readFileSync, readdirSync } from 'fs';
|
|
8
|
-
import {
|
|
8
|
+
import { getOpenContextPath } from '@melandlabs/env-config';
|
|
9
9
|
import { loadChannelDay, saveChannelMessage, clearChannelConversationFromAllDays, clearAllChannelForUser } from '@melandlabs/ai/store';
|
|
10
10
|
|
|
11
11
|
var __create = Object.create;
|
|
@@ -4352,7 +4352,7 @@ var FLUSH_DEBOUNCE_MS = 2e3;
|
|
|
4352
4352
|
var FLUSH_MAX_FILES_PER_PASS = 50;
|
|
4353
4353
|
var MAX_CONSECUTIVE_FLUSH_FAILURES = 5;
|
|
4354
4354
|
function defaultBaseDir() {
|
|
4355
|
-
return
|
|
4355
|
+
return getOpenContextPath("data", "whatsapp-history");
|
|
4356
4356
|
}
|
|
4357
4357
|
function sanitizeForFilename(value) {
|
|
4358
4358
|
return value.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -6068,6 +6068,7 @@ var WhatsAppAdapter = class extends MessagePlatformAdapter {
|
|
|
6068
6068
|
return false;
|
|
6069
6069
|
}
|
|
6070
6070
|
}
|
|
6071
|
+
// biome-ignore lint/suspicious/noExplicitAny: platform-specific opaque type
|
|
6071
6072
|
async ingestMessageAttachments(msg) {
|
|
6072
6073
|
if (!this.ownerUserId || !this.ownerUserType || !this.fileIngester) return [];
|
|
6073
6074
|
const m = msg.message;
|
|
@@ -6102,6 +6103,7 @@ var WhatsAppAdapter = class extends MessagePlatformAdapter {
|
|
|
6102
6103
|
const ingested = await this.fileIngester.ingestForUser({
|
|
6103
6104
|
source: "whatsapp",
|
|
6104
6105
|
ownerUserId: this.ownerUserId,
|
|
6106
|
+
// biome-ignore lint/suspicious/noExplicitAny: platform-specific opaque type
|
|
6105
6107
|
ownerLocalUserType: this.ownerUserType,
|
|
6106
6108
|
maxSizeBytes: WHATSAPP_MAX_ATTACHMENT_BYTES,
|
|
6107
6109
|
originalFileName: fileName,
|
|
@@ -6137,7 +6139,7 @@ function jidToUser(jid) {
|
|
|
6137
6139
|
return jid.split("@")[0];
|
|
6138
6140
|
}
|
|
6139
6141
|
function getAppMemoryDir(userId) {
|
|
6140
|
-
const base =
|
|
6142
|
+
const base = getOpenContextPath("data", "memory");
|
|
6141
6143
|
return userId ? join(base, userId) : base;
|
|
6142
6144
|
}
|
|
6143
6145
|
var WhatsAppConversationStore = class {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@melandlabs/integrations-whatsapp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -34,14 +34,15 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@whiskeysockets/baileys": "^7.0.0-rc.9",
|
|
37
|
-
"@melandlabs/ai": "0.
|
|
38
|
-
"@melandlabs/integrations
|
|
39
|
-
"@melandlabs/
|
|
37
|
+
"@melandlabs/ai": "0.3.1",
|
|
38
|
+
"@melandlabs/integrations": "0.3.0",
|
|
39
|
+
"@melandlabs/env-config": "0.4.0",
|
|
40
|
+
"@melandlabs/integrations-channels": "0.3.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"typescript": "^5.6.3",
|
|
43
44
|
"vitest": "^2.1.8",
|
|
44
|
-
"@melandlabs/config": "0.
|
|
45
|
+
"@melandlabs/config": "0.3.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
47
48
|
"build": "tsup",
|