@rubytech/create-maxy-code 0.1.429 → 0.1.431
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 +69 -3
- package/payload/platform/plugins/docs/PLUGIN.md +1 -0
- package/payload/platform/plugins/docs/references/internals.md +2 -2
- package/payload/platform/plugins/docs/references/workflows.md +61 -0
- package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.d.ts +8 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.d.ts.map +1 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.js +8 -1
- package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.js.map +1 -1
- package/payload/platform/plugins/workflows/PLUGIN.md +29 -9
- package/payload/platform/plugins/workflows/mcp/dist/index.js +34 -0
- package/payload/platform/plugins/workflows/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.d.ts +2 -2
- package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/step-resolver.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.d.ts +25 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js +14 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-create.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.d.ts +25 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js +79 -15
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-execute.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.d.ts +2 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.js +4 -0
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-get.js.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.d.ts +3 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.d.ts.map +1 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js +8 -1
- package/payload/platform/plugins/workflows/mcp/dist/tools/workflow-update.js.map +1 -1
- package/payload/platform/plugins/workflows/skills/workflow-manager/SKILL.md +24 -3
- package/payload/platform/services/telegram-channel/dist/instructions.js +1 -1
- package/payload/platform/services/telegram-channel/dist/instructions.js.map +1 -1
- package/payload/platform/services/telegram-channel/dist/notification.d.ts +10 -5
- package/payload/platform/services/telegram-channel/dist/notification.d.ts.map +1 -1
- package/payload/platform/services/telegram-channel/dist/notification.js +9 -6
- package/payload/platform/services/telegram-channel/dist/notification.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 +15 -5
- package/payload/platform/services/telegram-channel/dist/server.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/instructions.js +1 -1
- package/payload/platform/services/webchat-channel/dist/instructions.js.map +1 -1
- package/payload/platform/services/webchat-channel/dist/notification.d.ts +12 -10
- package/payload/platform/services/webchat-channel/dist/notification.d.ts.map +1 -1
- package/payload/platform/services/webchat-channel/dist/notification.js +12 -11
- package/payload/platform/services/webchat-channel/dist/notification.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 +12 -1
- package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/notification.d.ts +11 -6
- package/payload/platform/services/whatsapp-channel/dist/notification.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/notification.js +11 -8
- package/payload/platform/services/whatsapp-channel/dist/notification.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 +39 -14
- package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/targets.d.ts +17 -2
- package/payload/platform/services/whatsapp-channel/dist/targets.d.ts.map +1 -1
- package/payload/platform/services/whatsapp-channel/dist/targets.js +37 -2
- package/payload/platform/services/whatsapp-channel/dist/targets.js.map +1 -1
- package/payload/server/public/assets/{AdminLoginScreens-C4AZT7cQ.js → AdminLoginScreens-CcW3pAAZ.js} +1 -1
- package/payload/server/public/assets/{admin-SaF1F4e-.js → admin-Co3hOTNp.js} +1 -1
- package/payload/server/public/assets/{audio-attachment-mime-BBW07eyG.js → audio-attachment-mime-CwYrV1pg.js} +1 -1
- package/payload/server/public/assets/{chat-B9Qjt7C9.js → chat-rxbGimwf.js} +1 -1
- package/payload/server/public/assets/data-D0YFYP1i.js +1 -0
- package/payload/server/public/assets/{operator-CTJjI8te.js → operator-Djv3MdcL.js} +1 -1
- package/payload/server/public/assets/{page-JzxyFGle.js → page-Ci27UrJz.js} +5 -5
- package/payload/server/public/assets/{page-CbI1wtef.js → page-D1EAVC_9.js} +1 -1
- package/payload/server/public/assets/{public-DzeW3_eM.js → public-C6k-fPfx.js} +1 -1
- package/payload/server/public/chat.html +3 -3
- package/payload/server/public/data.html +3 -3
- package/payload/server/public/index.html +4 -4
- package/payload/server/public/operator.html +4 -4
- package/payload/server/public/public.html +3 -3
- package/payload/server/server.js +95 -25
- package/payload/server/public/assets/data-BKE6Sa-g.js +0 -1
package/payload/server/server.js
CHANGED
|
@@ -4375,9 +4375,12 @@ function getStatus() {
|
|
|
4375
4375
|
function getSocket(accountId) {
|
|
4376
4376
|
return connections.get(accountId)?.sock ?? null;
|
|
4377
4377
|
}
|
|
4378
|
+
function findConnectionByKey(conns, accountId) {
|
|
4379
|
+
return conns.find((c) => c.accountId === accountId) ?? conns.find((c) => c.platformAccountId === accountId);
|
|
4380
|
+
}
|
|
4378
4381
|
function selectConnection(conns, accountId) {
|
|
4379
4382
|
const presentKeys = conns.map((c) => c.accountId);
|
|
4380
|
-
const conn =
|
|
4383
|
+
const conn = findConnectionByKey(conns, accountId);
|
|
4381
4384
|
if (!conn) return { ok: false, reason: "key-miss", presentKeys };
|
|
4382
4385
|
if (!conn.sock) return { ok: false, reason: "disconnected", presentKeys };
|
|
4383
4386
|
return { ok: true, sock: conn.sock, accountId: conn.accountId };
|
|
@@ -4385,6 +4388,13 @@ function selectConnection(conns, accountId) {
|
|
|
4385
4388
|
function resolveSocket(accountId) {
|
|
4386
4389
|
return selectConnection(Array.from(connections.values()), accountId);
|
|
4387
4390
|
}
|
|
4391
|
+
function selectStoreAccountKey(conns, accountId) {
|
|
4392
|
+
const conn = findConnectionByKey(conns, accountId);
|
|
4393
|
+
return conn ? conn.platformAccountId : accountId;
|
|
4394
|
+
}
|
|
4395
|
+
function resolveReadStoreKey(accountId) {
|
|
4396
|
+
return selectStoreAccountKey(Array.from(connections.values()), accountId);
|
|
4397
|
+
}
|
|
4388
4398
|
function listConnectionPlatformAccountIds() {
|
|
4389
4399
|
return [...connections.values()].map((conn) => conn.platformAccountId);
|
|
4390
4400
|
}
|
|
@@ -7788,9 +7798,10 @@ app2.get("/activity", (c) => {
|
|
|
7788
7798
|
});
|
|
7789
7799
|
app2.get("/conversations", (c) => {
|
|
7790
7800
|
try {
|
|
7791
|
-
const
|
|
7792
|
-
const denial = callerScopeDenial(c,
|
|
7801
|
+
const requestedAccountId = validateAccountId(c.req.query("accountId") ?? null);
|
|
7802
|
+
const denial = callerScopeDenial(c, requestedAccountId);
|
|
7793
7803
|
if (denial) return denial;
|
|
7804
|
+
const accountId = resolveReadStoreKey(requestedAccountId);
|
|
7794
7805
|
const jids = listConversationJids(accountId);
|
|
7795
7806
|
const conversations = jids.map((jid) => {
|
|
7796
7807
|
const messages = getMessages(accountId, jid);
|
|
@@ -7803,7 +7814,7 @@ app2.get("/conversations", (c) => {
|
|
|
7803
7814
|
};
|
|
7804
7815
|
});
|
|
7805
7816
|
conversations.sort((a, b) => (b.lastMessageTimestamp ?? 0) - (a.lastMessageTimestamp ?? 0));
|
|
7806
|
-
console.error(`${TAG21} conversations account=${accountId} storeKeyFound=${jids.length > 0} count=${conversations.length}`);
|
|
7817
|
+
console.error(`${TAG21} conversations requested=${requestedAccountId} account=${accountId} storeKeyFound=${jids.length > 0} count=${conversations.length}`);
|
|
7807
7818
|
return c.json({ conversations });
|
|
7808
7819
|
} catch (err) {
|
|
7809
7820
|
console.error(`${TAG21} conversations error: ${String(err)}`);
|
|
@@ -7812,9 +7823,10 @@ app2.get("/conversations", (c) => {
|
|
|
7812
7823
|
});
|
|
7813
7824
|
app2.get("/messages", (c) => {
|
|
7814
7825
|
try {
|
|
7815
|
-
const
|
|
7816
|
-
const denial = callerScopeDenial(c,
|
|
7826
|
+
const requestedAccountId = validateAccountId(c.req.query("accountId") ?? null);
|
|
7827
|
+
const denial = callerScopeDenial(c, requestedAccountId);
|
|
7817
7828
|
if (denial) return denial;
|
|
7829
|
+
const accountId = resolveReadStoreKey(requestedAccountId);
|
|
7818
7830
|
const jid = c.req.query("jid");
|
|
7819
7831
|
if (!jid) {
|
|
7820
7832
|
return c.json({ error: "Missing required parameter: jid" }, 400);
|
|
@@ -7824,7 +7836,7 @@ app2.get("/messages", (c) => {
|
|
|
7824
7836
|
const effectiveLimit = limit && !Number.isNaN(limit) && limit > 0 ? limit : void 0;
|
|
7825
7837
|
const messages = getMessages(accountId, jid, effectiveLimit);
|
|
7826
7838
|
const storeKeyFound = listConversationJids(accountId).length > 0;
|
|
7827
|
-
console.error(`${TAG21} messages account=${accountId} jid=${jid} storeKeyFound=${storeKeyFound} limit=${effectiveLimit ?? "all"} returned=${messages.length}`);
|
|
7839
|
+
console.error(`${TAG21} messages requested=${requestedAccountId} account=${accountId} jid=${jid} storeKeyFound=${storeKeyFound} limit=${effectiveLimit ?? "all"} returned=${messages.length}`);
|
|
7828
7840
|
return c.json({ messages });
|
|
7829
7841
|
} catch (err) {
|
|
7830
7842
|
console.error(`${TAG21} messages error: ${String(err)}`);
|
|
@@ -8481,14 +8493,14 @@ function joinTextBlocks(content) {
|
|
|
8481
8493
|
}
|
|
8482
8494
|
return parts.join("");
|
|
8483
8495
|
}
|
|
8484
|
-
function assistantTurns(content, ts) {
|
|
8496
|
+
function assistantTurns(content, ts, promoteFinal = false) {
|
|
8485
8497
|
if (!Array.isArray(content)) return [];
|
|
8486
8498
|
const out = [];
|
|
8487
8499
|
for (const block of content) {
|
|
8488
8500
|
if (!block || typeof block !== "object") continue;
|
|
8489
8501
|
const b = block;
|
|
8490
8502
|
if (b.type === "text" && typeof b.text === "string") {
|
|
8491
|
-
out.push({ kind: "agent-text", text: b.text, ts });
|
|
8503
|
+
out.push(promoteFinal && b.text.trim().length > 0 ? { kind: "agent-webchat-final", text: b.text, ts } : { kind: "agent-text", text: b.text, ts });
|
|
8492
8504
|
} else if (b.type === "tool_use" && (b.name === WA_REPLY_TOOL || b.name === WEBCHAT_REPLY_TOOL || b.name === CHANNEL_REPLY_TOOL)) {
|
|
8493
8505
|
const text = b.input?.text;
|
|
8494
8506
|
out.push({ kind: "agent-reply", text: typeof text === "string" ? text : "", ts });
|
|
@@ -8539,7 +8551,7 @@ function renderOrSuppressChannelInbound(u, ts, out, queuedPendingSuppress) {
|
|
|
8539
8551
|
out.push(operatorInboundTurn(u, ts));
|
|
8540
8552
|
}
|
|
8541
8553
|
}
|
|
8542
|
-
function parseTranscript(lines, queuedPendingSuppress = /* @__PURE__ */ new Map()) {
|
|
8554
|
+
function parseTranscript(lines, queuedPendingSuppress = /* @__PURE__ */ new Map(), turnCtx = {}) {
|
|
8543
8555
|
const out = [];
|
|
8544
8556
|
for (const line of lines) {
|
|
8545
8557
|
if (!line || line[0] !== "{") continue;
|
|
@@ -8562,23 +8574,31 @@ function parseTranscript(lines, queuedPendingSuppress = /* @__PURE__ */ new Map(
|
|
|
8562
8574
|
out.push({ kind: "agent-error", code, raw, ts });
|
|
8563
8575
|
continue;
|
|
8564
8576
|
}
|
|
8565
|
-
|
|
8577
|
+
const isEnd = msg?.stop_reason === "end_turn";
|
|
8578
|
+
out.push(...assistantTurns(msg?.content, ts, isEnd && turnCtx.lastChannelSource === "webchat"));
|
|
8566
8579
|
continue;
|
|
8567
8580
|
}
|
|
8568
8581
|
if (row.type === "queue-operation" && row.operation === "enqueue") {
|
|
8569
8582
|
const content = asString(row.content);
|
|
8570
|
-
if (content !== null && CHANNEL_WRAPPER2.test(content)
|
|
8583
|
+
if (content !== null && CHANNEL_WRAPPER2.test(content)) {
|
|
8571
8584
|
const u = unwrapChannel(content);
|
|
8572
|
-
|
|
8573
|
-
|
|
8585
|
+
turnCtx.lastChannelSource = u.source;
|
|
8586
|
+
if (!isScheduleSource(content)) {
|
|
8587
|
+
out.push(operatorInboundTurn(u, ts));
|
|
8588
|
+
queuedPendingSuppress.set(u.text, (queuedPendingSuppress.get(u.text) ?? 0) + 1);
|
|
8589
|
+
}
|
|
8574
8590
|
}
|
|
8575
8591
|
continue;
|
|
8576
8592
|
}
|
|
8577
8593
|
if (row.type === "attachment") {
|
|
8578
8594
|
const att = row.attachment;
|
|
8579
8595
|
const isChannelQueued = att?.type === "queued_command" && att.isMeta === true && typeof att.origin === "object" && att.origin !== null && att.origin.kind === "channel" && typeof att.prompt === "string";
|
|
8580
|
-
if (isChannelQueued
|
|
8581
|
-
|
|
8596
|
+
if (isChannelQueued) {
|
|
8597
|
+
const u = unwrapChannel(att.prompt);
|
|
8598
|
+
turnCtx.lastChannelSource = u.source;
|
|
8599
|
+
if (!isScheduleSource(att.prompt)) {
|
|
8600
|
+
renderOrSuppressChannelInbound(u, ts, out, queuedPendingSuppress);
|
|
8601
|
+
}
|
|
8582
8602
|
}
|
|
8583
8603
|
continue;
|
|
8584
8604
|
}
|
|
@@ -8603,8 +8623,10 @@ function parseTranscript(lines, queuedPendingSuppress = /* @__PURE__ */ new Map(
|
|
|
8603
8623
|
// enqueue row AND this row both render and every channel message doubles.
|
|
8604
8624
|
CHANNEL_WRAPPER2.test(text);
|
|
8605
8625
|
if (isChannel) {
|
|
8626
|
+
const u = unwrapChannel(text);
|
|
8627
|
+
turnCtx.lastChannelSource = u.source;
|
|
8606
8628
|
if (!isScheduleSource(text)) {
|
|
8607
|
-
renderOrSuppressChannelInbound(
|
|
8629
|
+
renderOrSuppressChannelInbound(u, ts, out, queuedPendingSuppress);
|
|
8608
8630
|
}
|
|
8609
8631
|
} else if (row.isMeta === true) {
|
|
8610
8632
|
out.push({ kind: "harness-internal", text, ts });
|
|
@@ -9044,6 +9066,7 @@ data: ${JSON.stringify(obj)}
|
|
|
9044
9066
|
log: (line) => console.log(line)
|
|
9045
9067
|
});
|
|
9046
9068
|
const queuedPendingSuppress = /* @__PURE__ */ new Map();
|
|
9069
|
+
const turnCtx = {};
|
|
9047
9070
|
const drain = () => {
|
|
9048
9071
|
try {
|
|
9049
9072
|
const { buf, end } = readFrom(jsonlPath, offset);
|
|
@@ -9051,7 +9074,7 @@ data: ${JSON.stringify(obj)}
|
|
|
9051
9074
|
const { lines, nextOffset } = splitNewLines(buf, offset);
|
|
9052
9075
|
offset = nextOffset;
|
|
9053
9076
|
let n = 0;
|
|
9054
|
-
for (const turn of parseTranscript(lines, queuedPendingSuppress)) {
|
|
9077
|
+
for (const turn of parseTranscript(lines, queuedPendingSuppress, turnCtx)) {
|
|
9055
9078
|
send(controller, enrichAdminAttachments(enrichDownloads(turn, scratchpadRoot)), offset);
|
|
9056
9079
|
actx.lastParentTurns.push(turn);
|
|
9057
9080
|
if (turn.kind === "agent-error") {
|
|
@@ -9071,7 +9094,7 @@ data: ${JSON.stringify(obj)}
|
|
|
9071
9094
|
const { buf, end } = readFrom(jsonlPath, 0);
|
|
9072
9095
|
offset = end;
|
|
9073
9096
|
let n = 0;
|
|
9074
|
-
for (const turn of parseTranscript(buf.toString("utf8").split("\n"), queuedPendingSuppress)) {
|
|
9097
|
+
for (const turn of parseTranscript(buf.toString("utf8").split("\n"), queuedPendingSuppress, turnCtx)) {
|
|
9075
9098
|
send(controller, enrichAdminAttachments(enrichDownloads(turn, scratchpadRoot)), offset);
|
|
9076
9099
|
actx.lastParentTurns.push(turn);
|
|
9077
9100
|
if (turn.kind === "agent-error") {
|
|
@@ -22073,7 +22096,24 @@ function createWaChannelRoutes(deps) {
|
|
|
22073
22096
|
if (typeof senderId !== "string" || typeof sessionId !== "string" || typeof replied !== "boolean") {
|
|
22074
22097
|
return c.json({ error: "senderId, sessionId and replied required" }, 400);
|
|
22075
22098
|
}
|
|
22099
|
+
const interactive = body?.interactive === true;
|
|
22100
|
+
const finalText = typeof body?.finalText === "string" ? body.finalText : "";
|
|
22076
22101
|
const sid = sessionId.slice(0, 8);
|
|
22102
|
+
const deliver = interactive && finalText.trim().length > 0;
|
|
22103
|
+
if (deliver) {
|
|
22104
|
+
const bytes = Buffer.byteLength(finalText, "utf8");
|
|
22105
|
+
try {
|
|
22106
|
+
await deps.sendOutbound(senderId, finalText);
|
|
22107
|
+
} catch (err) {
|
|
22108
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
22109
|
+
console.error(
|
|
22110
|
+
`[whatsapp-native] op=turn-strand-anomaly senderId=${senderId} sessionId=${sid} interactive=yes bytes=${bytes} delivered=undelivered error=${message}`
|
|
22111
|
+
);
|
|
22112
|
+
return c.json({ ok: true, delivered: "undelivered" });
|
|
22113
|
+
}
|
|
22114
|
+
console.error(`[whatsapp-native] op=turn-end sessionId=${sid} replied=${replied ? "yes" : "no"} delivered=fallback bytes=${bytes}`);
|
|
22115
|
+
return c.json({ ok: true, delivered: "fallback" });
|
|
22116
|
+
}
|
|
22077
22117
|
if (replied) {
|
|
22078
22118
|
console.error(`[whatsapp-native] op=turn-end sessionId=${sid} replied=yes delivered=reply`);
|
|
22079
22119
|
return c.json({ ok: true, delivered: "reply" });
|
|
@@ -22194,6 +22234,11 @@ var WaGateway = class {
|
|
|
22194
22234
|
console.error(
|
|
22195
22235
|
`[whatsapp-native] op=inbound senderId=${input.senderId} accountId=${input.accountId} bytes=${bytes} ${mediaField} source=${source} delivery=${willDeliverNow ? "immediate" : "queued"}`
|
|
22196
22236
|
);
|
|
22237
|
+
if (source === "schedule" && (hadSubscriber || this.spawning.has(input.senderId))) {
|
|
22238
|
+
console.error(
|
|
22239
|
+
`[whatsapp-native] op=coalesced-onto-live-session eventId=${input.scheduleProvenance?.eventId ?? "-"} senderId=${input.senderId} droppedSeat=${input.scheduledSessionId ?? "-"} reason=${hadSubscriber ? "live-subscriber" : "spawn-in-flight"}`
|
|
22240
|
+
);
|
|
22241
|
+
}
|
|
22197
22242
|
if (!hadSubscriber && !this.spawning.has(input.senderId)) {
|
|
22198
22243
|
this.spawning.add(input.senderId);
|
|
22199
22244
|
console.error(`[whatsapp-native] op=spawn-trigger senderId=${input.senderId}`);
|
|
@@ -22500,17 +22545,20 @@ function createWebchatChannelRoutes(deps) {
|
|
|
22500
22545
|
if (typeof key !== "string" || typeof sessionId !== "string" || typeof replied !== "boolean") {
|
|
22501
22546
|
return c.json({ error: "key, sessionId and replied required" }, 400);
|
|
22502
22547
|
}
|
|
22548
|
+
const interactive = body?.interactive === true;
|
|
22549
|
+
const finalBytes = typeof body?.finalBytes === "number" && Number.isFinite(body.finalBytes) ? body.finalBytes : 0;
|
|
22503
22550
|
const k = key.slice(0, 8);
|
|
22504
22551
|
const sid = sessionId.slice(0, 8);
|
|
22552
|
+
if (interactive && finalBytes > 0) {
|
|
22553
|
+
console.error(`[webchat-native] op=turn-end channel=webchat key=${k} sessionId=${sid} replied=${replied ? "yes" : "no"} delivered=fallback bytes=${finalBytes}`);
|
|
22554
|
+
return c.json({ ok: true, delivered: "fallback" });
|
|
22555
|
+
}
|
|
22505
22556
|
if (replied) {
|
|
22557
|
+
console.error(`[webchat-native] op=turn-end channel=webchat key=${k} sessionId=${sid} delivered=reply`);
|
|
22506
22558
|
return c.json({ ok: true, delivered: "reply" });
|
|
22507
22559
|
}
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
return c.json({ ok: true, delivered: "none" });
|
|
22511
|
-
}
|
|
22512
|
-
console.error(`[webchat-native] op=turn-undelivered channel=webchat key=${k} sessionId=${sid} bytes=${finalBytes}`);
|
|
22513
|
-
return c.json({ ok: true, delivered: "undelivered" });
|
|
22560
|
+
console.error(`[webchat-native] op=turn-end channel=webchat key=${k} sessionId=${sid} delivered=none`);
|
|
22561
|
+
return c.json({ ok: true, delivered: "none" });
|
|
22514
22562
|
});
|
|
22515
22563
|
return app61;
|
|
22516
22564
|
}
|
|
@@ -23443,7 +23491,24 @@ function createTelegramChannelRoutes(deps) {
|
|
|
23443
23491
|
if (typeof key !== "string" || typeof sessionId !== "string" || typeof replied !== "boolean") {
|
|
23444
23492
|
return c.json({ error: "key, sessionId and replied required" }, 400);
|
|
23445
23493
|
}
|
|
23494
|
+
const interactive = body?.interactive === true;
|
|
23495
|
+
const finalText = typeof body?.finalText === "string" ? body.finalText : "";
|
|
23446
23496
|
const sid = sessionId.slice(0, 8);
|
|
23497
|
+
const deliver = interactive && finalText.trim().length > 0;
|
|
23498
|
+
if (deliver) {
|
|
23499
|
+
const bytes = Buffer.byteLength(finalText, "utf8");
|
|
23500
|
+
try {
|
|
23501
|
+
await deps.sendOutbound(key, finalText);
|
|
23502
|
+
} catch (err) {
|
|
23503
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
23504
|
+
console.error(
|
|
23505
|
+
`[telegram-native] op=turn-strand-anomaly key=${key} sessionId=${sid} interactive=yes bytes=${bytes} delivered=undelivered error=${message}`
|
|
23506
|
+
);
|
|
23507
|
+
return c.json({ ok: true, delivered: "undelivered" });
|
|
23508
|
+
}
|
|
23509
|
+
console.error(`[telegram-native] op=turn-end key=${key} sessionId=${sid} replied=${replied ? "yes" : "no"} delivered=fallback bytes=${bytes}`);
|
|
23510
|
+
return c.json({ ok: true, delivered: "fallback" });
|
|
23511
|
+
}
|
|
23447
23512
|
if (replied) {
|
|
23448
23513
|
console.error(`[telegram-native] op=turn-end key=${key} sessionId=${sid} replied=yes delivered=reply`);
|
|
23449
23514
|
return c.json({ ok: true, delivered: "reply" });
|
|
@@ -23524,6 +23589,11 @@ var TelegramGateway = class {
|
|
|
23524
23589
|
console.error(
|
|
23525
23590
|
`[telegram-native] op=inbound key=${input.senderId} accountId=${input.accountId} botType=${input.role} bytes=${bytes} source=${source} delivery=${willDeliverNow ? "immediate" : "queued"}`
|
|
23526
23591
|
);
|
|
23592
|
+
if (source === "schedule" && (hadSubscriber || this.spawning.has(input.senderId))) {
|
|
23593
|
+
console.error(
|
|
23594
|
+
`[telegram-native] op=coalesced-onto-live-session eventId=${input.scheduleProvenance?.eventId ?? "-"} senderId=${input.senderId} droppedSeat=${input.scheduledSessionId ?? "-"} reason=${hadSubscriber ? "live-subscriber" : "spawn-in-flight"}`
|
|
23595
|
+
);
|
|
23596
|
+
}
|
|
23527
23597
|
if (!hadSubscriber && !this.spawning.has(input.senderId)) {
|
|
23528
23598
|
this.spawning.add(input.senderId);
|
|
23529
23599
|
console.error(`[telegram-native] op=spawn-trigger key=${input.senderId} role=${input.role}`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,y as t}from"./useSubAccountSwitcher-DyjTbzQR.js";import"./audio-attachment-mime-BBW07eyG.js";import{t as n}from"./page-CbI1wtef.js";import"./file-download-B2B2DTar.js";import"./graph-labels-DxqDdO7G.js";var r=e(),i=t();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|