@rubytech/create-maxy-code 0.1.462 → 0.1.463
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/package.json +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +2 -2
- package/payload/platform/plugins/docs/references/internals.md +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts +1 -6
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.js +9 -17
- package/payload/platform/plugins/outlook/mcp/dist/lib/message.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.d.ts +56 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.d.ts.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.js +40 -0
- package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.js.map +1 -0
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js +1 -3
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js +3 -18
- package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js +1 -3
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.d.ts.map +1 -1
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js +3 -18
- package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js +6 -32
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js +10 -30
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-cancel.test.js +24 -21
- package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-cancel.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.d.ts +27 -18
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.js +31 -27
- package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.js.map +1 -1
- package/payload/platform/services/telegram-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/telegram-channel/dist/server.js +0 -4
- package/payload/platform/services/telegram-channel/dist/server.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/webchat-channel/dist/server.js +0 -4
- package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/server.js +0 -4
- package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
- package/payload/server/public/assets/{chat-CufidiBQ.js → chat-DYT5H81o.js} +1 -1
- package/payload/server/public/assets/{operator-Cj0B_usT.js → operator-gm2eP4r6.js} +1 -1
- package/payload/server/public/assets/page-BoPorLg-.js +32 -0
- package/payload/server/public/assets/{public-BkNW9e9T.js → public-DqJk6qgW.js} +1 -1
- package/payload/server/public/chat.html +2 -2
- package/payload/server/public/operator.html +2 -2
- package/payload/server/public/public.html +2 -2
- package/payload/server/server.js +70 -61
- package/payload/server/public/assets/page-84Fdwiu_.js +0 -32
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Chat — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/chat-
|
|
8
|
+
<script type="module" crossorigin src="/assets/chat-DYT5H81o.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-Ck5AOu5v.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-CU-lOxTd.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DDmLmPph.js">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-rOWd_lzl.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BnpVBu51.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-D_5cETGt.js">
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BoPorLg-.js">
|
|
21
21
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-pu0jjLCz.css">
|
|
22
22
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
23
23
|
</head>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Operator — Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/operator-
|
|
8
|
+
<script type="module" crossorigin src="/assets/operator-gm2eP4r6.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-Ck5AOu5v.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-CU-lOxTd.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DDmLmPph.js">
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-rOWd_lzl.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BnpVBu51.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-D_5cETGt.js">
|
|
22
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BoPorLg-.js">
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-pu0jjLCz.css">
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
|
|
25
25
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Maxy</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico">
|
|
8
|
-
<script type="module" crossorigin src="/assets/public-
|
|
8
|
+
<script type="module" crossorigin src="/assets/public-DqJk6qgW.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-Ck5AOu5v.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-CU-lOxTd.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/useSelectionMode-DDmLmPph.js">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/useCopyFeedback-rOWd_lzl.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/chevron-left-BnpVBu51.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/rotate-ccw-D_5cETGt.js">
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/page-
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/page-BoPorLg-.js">
|
|
21
21
|
<link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-pu0jjLCz.css">
|
|
22
22
|
<link rel="stylesheet" href="/brand-defaults.css">
|
|
23
23
|
</head>
|
package/payload/server/server.js
CHANGED
|
@@ -2188,6 +2188,7 @@ import {
|
|
|
2188
2188
|
} from "@whiskeysockets/baileys";
|
|
2189
2189
|
import { createRequire } from "module";
|
|
2190
2190
|
var TAG2 = "[whatsapp:session]";
|
|
2191
|
+
var WIRE_TAG = "[whatsapp:wire]";
|
|
2191
2192
|
var baileysPkgVersion = (() => {
|
|
2192
2193
|
try {
|
|
2193
2194
|
const req = createRequire(import.meta.url);
|
|
@@ -2408,6 +2409,12 @@ async function createWaSocket(opts) {
|
|
|
2408
2409
|
sock.ws.on("error", (err) => {
|
|
2409
2410
|
console.error(`${TAG2} WebSocket error: ${String(err)}`);
|
|
2410
2411
|
});
|
|
2412
|
+
sock.ws.on("CB:message", (node) => {
|
|
2413
|
+
const attrs = node?.attrs ?? {};
|
|
2414
|
+
console.error(
|
|
2415
|
+
`${WIRE_TAG} op=stanza msgId=${attrs.id ?? "none"} from=${attrs.from ?? "none"} type=${attrs.type ?? "none"} offline=${attrs.offline ?? "none"} account=${acct}`
|
|
2416
|
+
);
|
|
2417
|
+
});
|
|
2411
2418
|
}
|
|
2412
2419
|
return sock;
|
|
2413
2420
|
}
|
|
@@ -5271,14 +5278,6 @@ async function registerLoginSocket(accountId, sock, authDir) {
|
|
|
5271
5278
|
throw err;
|
|
5272
5279
|
}
|
|
5273
5280
|
await stopConnection(accountId);
|
|
5274
|
-
const selfId = readSelfId(authDir);
|
|
5275
|
-
const rawLidMapping = sock.signalRepository?.lidMapping ?? null;
|
|
5276
|
-
const lidMapping = withSelfLidShortcut(rawLidMapping, selfId.lid, selfId.jid);
|
|
5277
|
-
if (selfId.lid) {
|
|
5278
|
-
console.error(`[whatsapp:lid] resolved self-lid accountId=${accountId} selfLid=${selfId.lid} source=creds`);
|
|
5279
|
-
} else {
|
|
5280
|
-
console.error(`[whatsapp:lid] FAIL self-lid-resolution accountId=${accountId} reason=creds-missing-lid`);
|
|
5281
|
-
}
|
|
5282
5281
|
const conn = {
|
|
5283
5282
|
accountId,
|
|
5284
5283
|
platformAccountId,
|
|
@@ -5286,16 +5285,18 @@ async function registerLoginSocket(accountId, sock, authDir) {
|
|
|
5286
5285
|
authDir,
|
|
5287
5286
|
sock,
|
|
5288
5287
|
connected: true,
|
|
5289
|
-
selfPhone:
|
|
5290
|
-
selfJid:
|
|
5291
|
-
selfLid:
|
|
5288
|
+
selfPhone: null,
|
|
5289
|
+
selfJid: null,
|
|
5290
|
+
selfLid: null,
|
|
5292
5291
|
reconnectAttempts: 0,
|
|
5293
5292
|
lastConnectedAt: Date.now(),
|
|
5294
5293
|
abortController: new AbortController(),
|
|
5295
5294
|
debouncer: null,
|
|
5296
|
-
lidMapping
|
|
5295
|
+
lidMapping: null
|
|
5297
5296
|
};
|
|
5297
|
+
applySelfIdentity(conn, sock, "register");
|
|
5298
5298
|
connections.set(accountId, conn);
|
|
5299
|
+
monitorInbound(conn);
|
|
5299
5300
|
try {
|
|
5300
5301
|
await sock.sendPresenceUpdate("available");
|
|
5301
5302
|
console.error(`${TAG13} presence set to available account=${accountId}`);
|
|
@@ -5309,10 +5310,9 @@ async function registerLoginSocket(accountId, sock, authDir) {
|
|
|
5309
5310
|
attempt: 0,
|
|
5310
5311
|
signal: conn.abortController.signal
|
|
5311
5312
|
});
|
|
5312
|
-
monitorInbound(conn);
|
|
5313
5313
|
watchForDisconnect(conn);
|
|
5314
5314
|
attachSelfIdRefreshOnCredsUpdate(conn);
|
|
5315
|
-
console.error(`${TAG13} registered login socket for account=${accountId} phone=${
|
|
5315
|
+
console.error(`${TAG13} registered login socket for account=${accountId} phone=${conn.selfPhone ?? "unknown"}`);
|
|
5316
5316
|
}
|
|
5317
5317
|
function attachSelfIdRefreshOnCredsUpdate(conn) {
|
|
5318
5318
|
if (!conn.sock) return;
|
|
@@ -5392,30 +5392,27 @@ async function connectWithReconnect(conn) {
|
|
|
5392
5392
|
let connectedAt;
|
|
5393
5393
|
try {
|
|
5394
5394
|
console.error(`${TAG13} connecting account=${conn.accountId} attempt=${conn.reconnectAttempts}`);
|
|
5395
|
+
if (conn.debouncer) {
|
|
5396
|
+
await conn.debouncer.destroy();
|
|
5397
|
+
conn.debouncer = null;
|
|
5398
|
+
}
|
|
5395
5399
|
const sock = await createWaSocket({
|
|
5396
5400
|
authDir: conn.authDir,
|
|
5397
|
-
silent: true
|
|
5401
|
+
silent: true,
|
|
5402
|
+
account: conn.accountId
|
|
5398
5403
|
});
|
|
5399
5404
|
conn.sock = sock;
|
|
5405
|
+
applySelfIdentity(conn, sock, "pre-listener");
|
|
5406
|
+
monitorInbound(conn);
|
|
5400
5407
|
console.error(`${TAG13} socket created account=${conn.accountId} \u2014 waiting for connection`);
|
|
5401
5408
|
await waitForConnection(sock);
|
|
5402
|
-
const selfId = readSelfId(conn.authDir);
|
|
5403
5409
|
connectedAt = Date.now();
|
|
5404
5410
|
conn.connected = true;
|
|
5405
|
-
conn.selfPhone = selfId.e164;
|
|
5406
|
-
conn.selfJid = selfId.jid;
|
|
5407
|
-
conn.selfLid = selfId.lid;
|
|
5408
5411
|
conn.lastConnectedAt = connectedAt;
|
|
5409
5412
|
conn.lastError = void 0;
|
|
5410
5413
|
conn.terminalReason = void 0;
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
if (selfId.lid) {
|
|
5414
|
-
console.error(`[whatsapp:lid] resolved self-lid accountId=${conn.accountId} selfLid=${selfId.lid} source=creds`);
|
|
5415
|
-
} else {
|
|
5416
|
-
console.error(`[whatsapp:lid] FAIL self-lid-resolution accountId=${conn.accountId} reason=creds-missing-lid`);
|
|
5417
|
-
}
|
|
5418
|
-
console.error(`${TAG13} connected account=${conn.accountId} phone=${selfId.e164 ?? "unknown"}`);
|
|
5414
|
+
applySelfIdentity(conn, sock, "post-connect");
|
|
5415
|
+
console.error(`${TAG13} connected account=${conn.accountId} phone=${conn.selfPhone ?? "unknown"}`);
|
|
5419
5416
|
try {
|
|
5420
5417
|
await sock.sendPresenceUpdate("available");
|
|
5421
5418
|
console.error(`${TAG13} presence set to available account=${conn.accountId}`);
|
|
@@ -5429,11 +5426,6 @@ async function connectWithReconnect(conn) {
|
|
|
5429
5426
|
attempt: conn.reconnectAttempts,
|
|
5430
5427
|
signal: conn.abortController.signal
|
|
5431
5428
|
});
|
|
5432
|
-
if (conn.debouncer) {
|
|
5433
|
-
await conn.debouncer.destroy();
|
|
5434
|
-
conn.debouncer = null;
|
|
5435
|
-
}
|
|
5436
|
-
monitorInbound(conn);
|
|
5437
5429
|
attachSelfIdRefreshOnCredsUpdate(conn);
|
|
5438
5430
|
await waitForDisconnectEvent(conn);
|
|
5439
5431
|
uptimeMs = Date.now() - connectedAt;
|
|
@@ -5526,6 +5518,23 @@ function watchForDisconnect(conn) {
|
|
|
5526
5518
|
}
|
|
5527
5519
|
});
|
|
5528
5520
|
}
|
|
5521
|
+
function applySelfIdentity(conn, sock, phase) {
|
|
5522
|
+
const selfId = readSelfId(conn.authDir);
|
|
5523
|
+
conn.selfPhone = selfId.e164;
|
|
5524
|
+
conn.selfJid = selfId.jid;
|
|
5525
|
+
conn.selfLid = selfId.lid;
|
|
5526
|
+
const rawLidMapping = sock.signalRepository?.lidMapping ?? null;
|
|
5527
|
+
conn.lidMapping = withSelfLidShortcut(rawLidMapping, selfId.lid, selfId.jid);
|
|
5528
|
+
if (selfId.lid) {
|
|
5529
|
+
console.error(
|
|
5530
|
+
`[whatsapp:lid] resolved self-lid accountId=${conn.accountId} selfLid=${selfId.lid} source=creds phase=${phase}`
|
|
5531
|
+
);
|
|
5532
|
+
} else {
|
|
5533
|
+
console.error(
|
|
5534
|
+
`[whatsapp:lid] FAIL self-lid-resolution accountId=${conn.accountId} reason=creds-missing-lid phase=${phase}`
|
|
5535
|
+
);
|
|
5536
|
+
}
|
|
5537
|
+
}
|
|
5529
5538
|
function monitorInbound(conn) {
|
|
5530
5539
|
if (!conn.sock || !onInboundMessage) return;
|
|
5531
5540
|
const sock = conn.sock;
|
|
@@ -6866,7 +6875,6 @@ function parseScheduleProvenance(v) {
|
|
|
6866
6875
|
|
|
6867
6876
|
// server/routes/channel/schedule-inject.ts
|
|
6868
6877
|
var TAG16 = "[schedule-inject]";
|
|
6869
|
-
var UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
6870
6878
|
function isLoopbackAddr(addr) {
|
|
6871
6879
|
return addr === "127.0.0.1" || addr === "::1" || addr === "::ffff:127.0.0.1";
|
|
6872
6880
|
}
|
|
@@ -6899,7 +6907,6 @@ function createScheduleInjectRoutes(deps) {
|
|
|
6899
6907
|
const prompt = typeof body.prompt === "string" ? body.prompt : "";
|
|
6900
6908
|
const eventId = typeof body.eventId === "string" ? body.eventId : "";
|
|
6901
6909
|
const scheduleProvenance = parseScheduleProvenance(body.scheduleProvenance);
|
|
6902
|
-
const overrideSessionId = typeof body.sessionId === "string" && UUID_V4.test(body.sessionId) ? body.sessionId : void 0;
|
|
6903
6910
|
if (channel !== "whatsapp" && channel !== "telegram" || !destination || !prompt) {
|
|
6904
6911
|
console.error(`${TAG16} reject reason=bad-request channel=${String(channel)} hasDestination=${Boolean(destination)} hasPrompt=${Boolean(prompt)}`);
|
|
6905
6912
|
return c.json({ ok: false, error: "schedule-inject-bad-request" }, 400);
|
|
@@ -6918,7 +6925,7 @@ function createScheduleInjectRoutes(deps) {
|
|
|
6918
6925
|
return c.json({ ok: false, error: "account-manager-unresolved" }, 403);
|
|
6919
6926
|
}
|
|
6920
6927
|
console.error(`${TAG16} op=effective-account eventId=${eventId} effectiveAccount=${effectiveAccount2}`);
|
|
6921
|
-
const sessionId2 =
|
|
6928
|
+
const sessionId2 = adminSessionIdFor(effectiveAccount2, normalizeTarget(destination) ?? destination);
|
|
6922
6929
|
const reply2 = (text) => deps.sendWhatsAppText(houseAccountId, destination, text);
|
|
6923
6930
|
try {
|
|
6924
6931
|
await deps.waHandleInbound({
|
|
@@ -6936,7 +6943,6 @@ function createScheduleInjectRoutes(deps) {
|
|
|
6936
6943
|
media: [],
|
|
6937
6944
|
source: "schedule",
|
|
6938
6945
|
scheduleProvenance,
|
|
6939
|
-
scheduledSessionId: overrideSessionId,
|
|
6940
6946
|
reply: reply2
|
|
6941
6947
|
});
|
|
6942
6948
|
} catch (err) {
|
|
@@ -6954,7 +6960,7 @@ function createScheduleInjectRoutes(deps) {
|
|
|
6954
6960
|
return c.json({ ok: false, error: "no-admin-bot-token" }, 400);
|
|
6955
6961
|
}
|
|
6956
6962
|
const chatId = Number(destination);
|
|
6957
|
-
const sessionId =
|
|
6963
|
+
const sessionId = adminSessionIdFor(effectiveAccount, destination);
|
|
6958
6964
|
const reply = (text) => deps.sendTelegramText(botToken, chatId, text);
|
|
6959
6965
|
try {
|
|
6960
6966
|
await deps.tgHandleInbound({
|
|
@@ -6966,7 +6972,6 @@ function createScheduleInjectRoutes(deps) {
|
|
|
6966
6972
|
text: prompt,
|
|
6967
6973
|
source: "schedule",
|
|
6968
6974
|
scheduleProvenance,
|
|
6969
|
-
scheduledSessionId: overrideSessionId,
|
|
6970
6975
|
reply
|
|
6971
6976
|
});
|
|
6972
6977
|
} catch (err) {
|
|
@@ -24211,14 +24216,14 @@ var WaGateway = class {
|
|
|
24211
24216
|
},
|
|
24212
24217
|
Date.now()
|
|
24213
24218
|
);
|
|
24219
|
+
const resolvedSessionId = adminSessionIdFor(
|
|
24220
|
+
input.effectiveAccountId,
|
|
24221
|
+
senderId,
|
|
24222
|
+
input.role === "public" && input.personId ? input.personId : void 0
|
|
24223
|
+
);
|
|
24214
24224
|
console.error(
|
|
24215
|
-
`[whatsapp-native] op=inbound senderId=${senderId} accountId=${input.accountId} bytes=${bytes} ${mediaField} source=${source} delivery=${willDeliverNow ? "immediate" : "queued"}`
|
|
24225
|
+
`[whatsapp-native] op=inbound senderId=${senderId} accountId=${input.accountId} bytes=${bytes} ${mediaField} source=${source} delivery=${willDeliverNow ? "immediate" : "queued"} sessionId=${resolvedSessionId}`
|
|
24216
24226
|
);
|
|
24217
|
-
if (source === "schedule" && (hadSubscriber || this.spawning.has(senderId))) {
|
|
24218
|
-
console.error(
|
|
24219
|
-
`[whatsapp-native] op=coalesced-onto-live-session eventId=${input.scheduleProvenance?.eventId ?? "-"} senderId=${senderId} droppedSeat=${input.scheduledSessionId ?? "-"} reason=${hadSubscriber ? "live-subscriber" : "spawn-in-flight"}`
|
|
24220
|
-
);
|
|
24221
|
-
}
|
|
24222
24227
|
if (!hadSubscriber && !this.spawning.has(senderId)) {
|
|
24223
24228
|
this.spawning.add(senderId);
|
|
24224
24229
|
console.error(`[whatsapp-native] op=spawn-trigger senderId=${senderId}`);
|
|
@@ -24231,8 +24236,6 @@ var WaGateway = class {
|
|
|
24231
24236
|
personId: input.personId ?? null,
|
|
24232
24237
|
gatewayUrl: this.deps.gatewayUrl,
|
|
24233
24238
|
serverPath: this.deps.serverPath,
|
|
24234
|
-
// Task 1526 — a scheduled firing's per-firing seat id; absent on real inbound.
|
|
24235
|
-
sessionIdOverride: input.scheduledSessionId,
|
|
24236
24239
|
// Task 1575 — the gate's owner-self verdict; drives owner attribution
|
|
24237
24240
|
// for an unbound owner self-phone at the spawn site.
|
|
24238
24241
|
ownerSelfPhone: input.ownerSelfPhone
|
|
@@ -24286,7 +24289,12 @@ function logDuplicateSenderGroups(groups) {
|
|
|
24286
24289
|
function buildWaSpawnRequest(input) {
|
|
24287
24290
|
const personId = input.role === "public" && input.personId ? input.personId : void 0;
|
|
24288
24291
|
return {
|
|
24289
|
-
|
|
24292
|
+
// Task 1746 — the deterministic per-sender id is the ONLY id a sender's
|
|
24293
|
+
// session ever has. Task 1526's per-firing seat override used to replace it
|
|
24294
|
+
// on a scheduled cold start, which spawned a second session for the sender;
|
|
24295
|
+
// that session then attached under the sender's own hub key and swallowed
|
|
24296
|
+
// their real messages until it detached, splitting the conversation in two.
|
|
24297
|
+
sessionId: adminSessionIdFor(input.accountId, input.senderId, personId),
|
|
24290
24298
|
role: input.role,
|
|
24291
24299
|
channel: "whatsapp",
|
|
24292
24300
|
personId,
|
|
@@ -25773,14 +25781,14 @@ var TelegramGateway = class {
|
|
|
25773
25781
|
{ key: input.senderId, text: input.text, messageId: `tg-${++this.seq}`, source, standingRules, scheduleProvenance: input.scheduleProvenance },
|
|
25774
25782
|
Date.now()
|
|
25775
25783
|
);
|
|
25784
|
+
const resolvedSessionId = adminSessionIdFor(
|
|
25785
|
+
input.accountId,
|
|
25786
|
+
input.senderId,
|
|
25787
|
+
input.role === "public" && input.personId ? input.personId : void 0
|
|
25788
|
+
);
|
|
25776
25789
|
console.error(
|
|
25777
|
-
`[telegram-native] op=inbound key=${input.senderId} accountId=${input.accountId} botType=${input.role} bytes=${bytes} source=${source} delivery=${willDeliverNow ? "immediate" : "queued"}`
|
|
25790
|
+
`[telegram-native] op=inbound key=${input.senderId} accountId=${input.accountId} botType=${input.role} bytes=${bytes} source=${source} delivery=${willDeliverNow ? "immediate" : "queued"} sessionId=${resolvedSessionId}`
|
|
25778
25791
|
);
|
|
25779
|
-
if (source === "schedule" && (hadSubscriber || this.spawning.has(input.senderId))) {
|
|
25780
|
-
console.error(
|
|
25781
|
-
`[telegram-native] op=coalesced-onto-live-session eventId=${input.scheduleProvenance?.eventId ?? "-"} senderId=${input.senderId} droppedSeat=${input.scheduledSessionId ?? "-"} reason=${hadSubscriber ? "live-subscriber" : "spawn-in-flight"}`
|
|
25782
|
-
);
|
|
25783
|
-
}
|
|
25784
25792
|
if (!hadSubscriber && !this.spawning.has(input.senderId)) {
|
|
25785
25793
|
this.spawning.add(input.senderId);
|
|
25786
25794
|
console.error(`[telegram-native] op=spawn-trigger key=${input.senderId} role=${input.role}`);
|
|
@@ -25792,9 +25800,7 @@ var TelegramGateway = class {
|
|
|
25792
25800
|
personId: input.personId ?? null,
|
|
25793
25801
|
chatId: input.chatId,
|
|
25794
25802
|
gatewayUrl: this.deps.gatewayUrl,
|
|
25795
|
-
serverPath: this.deps.serverPath
|
|
25796
|
-
// Task 1526 — a scheduled firing's per-firing seat id; absent on real inbound.
|
|
25797
|
-
sessionIdOverride: input.scheduledSessionId
|
|
25803
|
+
serverPath: this.deps.serverPath
|
|
25798
25804
|
});
|
|
25799
25805
|
} finally {
|
|
25800
25806
|
this.spawning.delete(input.senderId);
|
|
@@ -25812,7 +25818,10 @@ var TelegramGateway = class {
|
|
|
25812
25818
|
function buildTelegramSpawnRequest(input) {
|
|
25813
25819
|
const personId = input.role === "public" && input.personId ? input.personId : void 0;
|
|
25814
25820
|
return {
|
|
25815
|
-
|
|
25821
|
+
// Task 1746 — the deterministic per-sender id is the ONLY id a sender's
|
|
25822
|
+
// session ever has. Mirror of the WhatsApp builder; see its comment for why
|
|
25823
|
+
// Task 1526's per-firing override was removed.
|
|
25824
|
+
sessionId: adminSessionIdFor(input.accountId, input.senderId, personId),
|
|
25816
25825
|
role: input.role,
|
|
25817
25826
|
channel: "telegram",
|
|
25818
25827
|
personId,
|
|
@@ -26600,7 +26609,7 @@ var waGateway = new WaGateway({
|
|
|
26600
26609
|
});
|
|
26601
26610
|
return result.ok ? { ok: true, messageId: result.messageId } : { ok: false, error: result.error };
|
|
26602
26611
|
},
|
|
26603
|
-
ensureChannelSession: async ({ accountId, effectiveAccountId, senderId, role, personId, gatewayUrl, serverPath, passive, text, msgId,
|
|
26612
|
+
ensureChannelSession: async ({ accountId, effectiveAccountId, senderId, role, personId, gatewayUrl, serverPath, passive, text, msgId, ownerSelfPhone }) => {
|
|
26604
26613
|
if (passive) {
|
|
26605
26614
|
const phoneHash = createHash7("sha256").update(senderId).digest("hex").slice(0, 12);
|
|
26606
26615
|
const prompt = (text ?? "").trim();
|
|
@@ -26648,7 +26657,7 @@ var waGateway = new WaGateway({
|
|
|
26648
26657
|
const managesAccount = effectiveAccountId !== accountId ? effectiveAccountId : "none";
|
|
26649
26658
|
console.error(`[whatsapp-native] op=account-manager-route senderId=${senderId} managesAccount=${managesAccount} effectiveAccount=${effectiveAccountId} source=gate`);
|
|
26650
26659
|
}
|
|
26651
|
-
const req = buildWaSpawnRequest({ accountId: effectiveAccountId, senderId, role, personId, gatewayUrl, serverPath
|
|
26660
|
+
const req = buildWaSpawnRequest({ accountId: effectiveAccountId, senderId, role, personId, gatewayUrl, serverPath });
|
|
26652
26661
|
const userId = role === "admin" ? resolveAdminUserId({ accountId: effectiveAccountId, senderPhone: senderId }) ?? (ownerSelfPhone ? resolveOwnerUserId(effectiveAccountId) ?? void 0 : void 0) : void 0;
|
|
26653
26662
|
if (role === "admin") {
|
|
26654
26663
|
const attribution = userId ?? (ownerSelfPhone ? "owner-self-unresolved" : "unbound-empty");
|
|
@@ -26804,8 +26813,8 @@ var telegramGateway = new TelegramGateway({
|
|
|
26804
26813
|
fetchStandingRules: fetchAccountStandingRules,
|
|
26805
26814
|
gatewayUrl: telegramGatewayUrl(),
|
|
26806
26815
|
serverPath: telegramServerPath(),
|
|
26807
|
-
ensureChannelSession: async ({ accountId, senderId, role, personId, chatId, gatewayUrl, serverPath
|
|
26808
|
-
const req = buildTelegramSpawnRequest({ accountId, senderId, role, personId, gatewayUrl, serverPath
|
|
26816
|
+
ensureChannelSession: async ({ accountId, senderId, role, personId, chatId, gatewayUrl, serverPath }) => {
|
|
26817
|
+
const req = buildTelegramSpawnRequest({ accountId, senderId, role, personId, gatewayUrl, serverPath });
|
|
26809
26818
|
const result = await managerRcSpawn(req);
|
|
26810
26819
|
if ("error" in result) {
|
|
26811
26820
|
console.error(`[telegram-native] spawn-failed senderId=${senderId} role=${role} error=${result.error} status=${result.status}`);
|