shadok-ai 0.20.17 → 0.20.18
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 +18 -3
- package/dist/server.js +26 -3
- package/dist/server.js.map +1 -1
- package/dist/tg-guests.d.ts +1 -1
- package/dist/tg-guests.js +20 -0
- package/dist/tg-guests.js.map +1 -1
- package/dist/wa-baileys.d.ts +3 -3
- package/dist/wa-baileys.js +68 -7
- package/dist/wa-baileys.js.map +1 -1
- package/dist/wa-bridge.d.ts +24 -1
- package/dist/wa-bridge.js +391 -41
- package/dist/wa-bridge.js.map +1 -1
- package/dist/wa-fake.d.ts +9 -0
- package/dist/wa-fake.js +17 -0
- package/dist/wa-fake.js.map +1 -1
- package/dist/wa-format.d.ts +54 -0
- package/dist/wa-format.js +87 -1
- package/dist/wa-format.js.map +1 -1
- package/dist/wa-guests.d.ts +38 -0
- package/dist/wa-guests.js +24 -3
- package/dist/wa-guests.js.map +1 -1
- package/dist/wa-inbox.d.ts +10 -0
- package/dist/wa-inbox.js.map +1 -1
- package/dist/wa-transport.d.ts +13 -0
- package/dist/wa-transport.js.map +1 -1
- package/dist/wa-worker-host.js +8 -0
- package/dist/wa-worker-host.js.map +1 -1
- package/dist/wa-worker.js +5 -1
- package/dist/wa-worker.js.map +1 -1
- package/dist/whatsapp.d.ts +3 -1
- package/dist/whatsapp.js +6 -0
- package/dist/whatsapp.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -967,9 +967,24 @@ from the phone's *Linked devices* list too.
|
|
|
967
967
|
being started, or while the server was updating, is answered once it is back.
|
|
968
968
|
- **Closing a guest's agent in the cockpit** ends that conversation: their next
|
|
969
969
|
message starts a new agent. A link that drops ends nothing.
|
|
970
|
-
- **
|
|
971
|
-
|
|
972
|
-
|
|
970
|
+
- **Pictures, documents, voice notes and videos** reach the person's agent the
|
|
971
|
+
way Telegram attachments do (a voice note is transcribed, and what was
|
|
972
|
+
understood is echoed back to the person; a video is looked at through a few
|
|
973
|
+
stills). Up to **50 MB** per file; a larger one gets a line asking for a
|
|
974
|
+
smaller file or a link.
|
|
975
|
+
- **Files the agent hands over** reach the person as a picture or a document.
|
|
976
|
+
Pictures go out without WhatsApp's blurred preview thumbnail, because the
|
|
977
|
+
WhatsApp library is installed without an image-processing library; the
|
|
978
|
+
picture itself is intact.
|
|
979
|
+
- **Questions** the agent asks arrive as a numbered list: the person answers
|
|
980
|
+
with the number (several numbers for a multiple choice), or with their own
|
|
981
|
+
words where the question offers that.
|
|
982
|
+
- **A first message that arrives unreadable** (WhatsApp sometimes delivers the
|
|
983
|
+
first messages from a new sender before they are readable by a linked
|
|
984
|
+
device) gets one line asking the person to send it again — at most once
|
|
985
|
+
every ten minutes, never with the door shut.
|
|
986
|
+
- **Closing a guest's agent** tells the person, once, that their next message
|
|
987
|
+
starts a new conversation.
|
|
973
988
|
- The panel always shows the link's true state, one at a time: *Not linked*,
|
|
974
989
|
*Linking*, *Connected*, *Reconnecting* (a link that stops answering leaves
|
|
975
990
|
*Connected* within about two minutes, even with no disconnect event),
|
package/dist/server.js
CHANGED
|
@@ -7341,6 +7341,13 @@ function startWhatsAppHandle() {
|
|
|
7341
7341
|
channels: { load: loadChannels, upsert: upsertChannel },
|
|
7342
7342
|
inbox: openInbox(path.join(waFake ? `${stateDir}-fake` : stateDir, "inbox.json")),
|
|
7343
7343
|
sessionAlive: (id) => tmuxHasSession("sk-" + id),
|
|
7344
|
+
// Step 3: a received medium waits beside the inbox, then lands in the
|
|
7345
|
+
// agent's GROUP media directory; a file an agent hands over is read with
|
|
7346
|
+
// the agent's rights — both exactly Telegram's rules (invariant 60).
|
|
7347
|
+
stagingDir: path.join(waFake ? `${stateDir}-fake` : stateDir, "media"),
|
|
7348
|
+
mediaDirFor: mediaDirForSession,
|
|
7349
|
+
readAgentFile: readSessionFile,
|
|
7350
|
+
multiTenant: DEPLOYMENT_MODE === "multi-tenant",
|
|
7344
7351
|
});
|
|
7345
7352
|
}
|
|
7346
7353
|
// The boot breaker (src/whatsapp.ts) reads a resume cut short by the process
|
|
@@ -7387,6 +7394,7 @@ app.get("/whatsapp", async (req, res) => {
|
|
|
7387
7394
|
// the bridge's answers. Fake mode only: a real instance never echoes a
|
|
7388
7395
|
// guest's conversation through this route.
|
|
7389
7396
|
out.fakeSent = waFake.sent.slice(-20);
|
|
7397
|
+
out.fakeFiles = waFake.files.slice(-20);
|
|
7390
7398
|
}
|
|
7391
7399
|
res.json(out);
|
|
7392
7400
|
});
|
|
@@ -7493,7 +7501,22 @@ app.post("/whatsapp/fake/:action", (req, res) => {
|
|
|
7493
7501
|
const chat = str("chat");
|
|
7494
7502
|
if (!chat)
|
|
7495
7503
|
return res.status(400).json({ error: "chat is required" });
|
|
7496
|
-
|
|
7504
|
+
// A medium for the side instance: `media` = image | document | audio |
|
|
7505
|
+
// video (`voice: true` for a voice note), its bytes as base64 `data`.
|
|
7506
|
+
const kind = str("media");
|
|
7507
|
+
const media = kind === "image" || kind === "document" || kind === "audio" || kind === "video"
|
|
7508
|
+
? { kind: kind, ...(str("mime") ? { mime: str("mime") } : {}), ...(str("fileName") ? { fileName: str("fileName") } : {}), ...(b.voice === true ? { voice: true } : {}) }
|
|
7509
|
+
: undefined;
|
|
7510
|
+
waFake.script.deliver({
|
|
7511
|
+
chat,
|
|
7512
|
+
chatAlt: str("chatAlt"),
|
|
7513
|
+
text: str("text"),
|
|
7514
|
+
pushName: str("pushName"),
|
|
7515
|
+
id: str("id"),
|
|
7516
|
+
...(media ? { media } : {}),
|
|
7517
|
+
...(str("data") ? { mediaData: Buffer.from(str("data"), "base64") } : {}),
|
|
7518
|
+
...(b.unreadable === true ? { unreadable: true } : {}),
|
|
7519
|
+
});
|
|
7497
7520
|
}
|
|
7498
7521
|
else if (action === "mapLid") {
|
|
7499
7522
|
const pn = str("pn"), lid = str("lid");
|
|
@@ -8215,7 +8238,7 @@ async function readSessionFile(sessionId, p) {
|
|
|
8215
8238
|
if (!st?.isFile)
|
|
8216
8239
|
throw new Error("not a readable file");
|
|
8217
8240
|
if (st.size > MAX)
|
|
8218
|
-
throw new Error("file too large
|
|
8241
|
+
throw new Error("file too large to send (over 50 MB)");
|
|
8219
8242
|
const { cmd, argv } = readAsUserArgv(user, p);
|
|
8220
8243
|
return new Promise((resolve, reject) => execFile(cmd, argv, { encoding: "buffer", maxBuffer: MAX + 1, timeout: 60_000 }, (err, out) => err ? reject(new Error("could not read the file as the agent's user")) : resolve(out)));
|
|
8221
8244
|
}
|
|
@@ -8224,7 +8247,7 @@ async function readSessionFile(sessionId, p) {
|
|
|
8224
8247
|
throw new Error("not a readable file");
|
|
8225
8248
|
try {
|
|
8226
8249
|
if (opened.stat.size > MAX)
|
|
8227
|
-
throw new Error("file too large
|
|
8250
|
+
throw new Error("file too large to send (over 50 MB)");
|
|
8228
8251
|
const buf = Buffer.alloc(opened.stat.size);
|
|
8229
8252
|
let off = 0;
|
|
8230
8253
|
while (off < buf.length) {
|