@automagik/omni 2.260423.10 → 2.260424.2
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/index.js +1 -1
- package/dist/server/index.js +35 -23
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -113929,7 +113929,7 @@ import { fileURLToPath } from "url";
|
|
|
113929
113929
|
// package.json
|
|
113930
113930
|
var package_default = {
|
|
113931
113931
|
name: "@automagik/omni",
|
|
113932
|
-
version: "2.
|
|
113932
|
+
version: "2.260424.2",
|
|
113933
113933
|
description: "LLM-optimized CLI for Omni",
|
|
113934
113934
|
type: "module",
|
|
113935
113935
|
bin: {
|
package/dist/server/index.js
CHANGED
|
@@ -224554,7 +224554,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
224554
224554
|
var require_package8 = __commonJS((exports, module) => {
|
|
224555
224555
|
module.exports = {
|
|
224556
224556
|
name: "@omni/api",
|
|
224557
|
-
version: "2.
|
|
224557
|
+
version: "2.260424.2",
|
|
224558
224558
|
type: "module",
|
|
224559
224559
|
exports: {
|
|
224560
224560
|
".": {
|
|
@@ -280785,7 +280785,7 @@ class FollowUpSweeperService {
|
|
|
280785
280785
|
lastInboundCustomerMessageAt: chatFollowUpState.lastInboundCustomerMessageAt,
|
|
280786
280786
|
chatName: chats.name,
|
|
280787
280787
|
channelType: instances.channel
|
|
280788
|
-
}).from(chatFollowUpState).leftJoin(chats, eq(chatFollowUpState.chatId, chats.id)).leftJoin(instances, eq(chatFollowUpState.instanceId, instances.id)).where(and2(isNull2(chatFollowUpState.disarmReason), lte(chatFollowUpState.nextFireAt, now))).orderBy(chatFollowUpState.nextFireAt).limit(limit2).for("update", { of: chatFollowUpState, skipLocked: true });
|
|
280788
|
+
}).from(chatFollowUpState).leftJoin(chats, eq(chatFollowUpState.chatId, chats.id)).leftJoin(instances, eq(chatFollowUpState.instanceId, instances.id)).where(and2(isNull2(chatFollowUpState.disarmReason), lte(chatFollowUpState.nextFireAt, now), sql`(${chats.settings}->>'agentPaused') IS DISTINCT FROM 'true'`)).orderBy(chatFollowUpState.nextFireAt).limit(limit2).for("update", { of: chatFollowUpState, skipLocked: true });
|
|
280789
280789
|
return claimed;
|
|
280790
280790
|
});
|
|
280791
280791
|
return rows.map((r) => ({
|
|
@@ -300693,9 +300693,6 @@ var init_messages5 = __esm(() => {
|
|
|
300693
300693
|
const channelRegistry2 = c.get("channelRegistry");
|
|
300694
300694
|
checkInstanceAccess2(c.get("apiKey"), data.instanceId);
|
|
300695
300695
|
const instance4 = await services.instances.getById(data.instanceId);
|
|
300696
|
-
if (instance4.channel !== "gupshup") {
|
|
300697
|
-
return c.json({ error: "Handoff is only supported on Gupshup instances" }, 400);
|
|
300698
|
-
}
|
|
300699
300696
|
if (!channelRegistry2) {
|
|
300700
300697
|
throw new OmniError({
|
|
300701
300698
|
code: ERROR_CODES.CHANNEL_NOT_CONNECTED,
|
|
@@ -300713,42 +300710,56 @@ var init_messages5 = __esm(() => {
|
|
|
300713
300710
|
});
|
|
300714
300711
|
}
|
|
300715
300712
|
const resolvedTo = await resolveRecipient(data.to, instance4.channel, services);
|
|
300716
|
-
const
|
|
300717
|
-
|
|
300718
|
-
|
|
300719
|
-
|
|
300720
|
-
|
|
300721
|
-
|
|
300722
|
-
|
|
300723
|
-
|
|
300724
|
-
|
|
300725
|
-
|
|
300726
|
-
|
|
300727
|
-
|
|
300713
|
+
const hasNativeHandoff = plugin7.capabilities?.canHandoff === true;
|
|
300714
|
+
let channelSendResult = null;
|
|
300715
|
+
if (hasNativeHandoff) {
|
|
300716
|
+
const outgoingMessage = {
|
|
300717
|
+
to: resolvedTo,
|
|
300718
|
+
content: { type: "text", text: data.text },
|
|
300719
|
+
metadata: {
|
|
300720
|
+
isHandoff: true,
|
|
300721
|
+
dadosLead: data.dadosLead ?? data.extraInfo,
|
|
300722
|
+
motivoHandoff: data.motivoHandoff,
|
|
300723
|
+
handoffFields: data.handoffFields
|
|
300724
|
+
}
|
|
300725
|
+
};
|
|
300726
|
+
channelSendResult = await plugin7.sendMessage(data.instanceId, outgoingMessage);
|
|
300727
|
+
handleSendResult(channelSendResult, {
|
|
300728
|
+
channelType: instance4.channel,
|
|
300729
|
+
instanceId: data.instanceId,
|
|
300730
|
+
operation: "send handoff"
|
|
300731
|
+
});
|
|
300732
|
+
}
|
|
300728
300733
|
await services.chats.update(data.chatId, {
|
|
300729
300734
|
settings: { agentPaused: true }
|
|
300730
300735
|
});
|
|
300736
|
+
await services.followUpLifecycle.disarm({
|
|
300737
|
+
chatId: data.chatId,
|
|
300738
|
+
instanceId: data.instanceId,
|
|
300739
|
+
reason: "handoff"
|
|
300740
|
+
});
|
|
300731
300741
|
db2.insert(handoffLogs).values({
|
|
300732
300742
|
instanceId: data.instanceId,
|
|
300733
300743
|
chatUuid: data.chatId,
|
|
300734
|
-
chatId:
|
|
300735
|
-
toPhone:
|
|
300744
|
+
chatId: resolvedTo,
|
|
300745
|
+
toPhone: resolvedTo,
|
|
300736
300746
|
text: data.text,
|
|
300737
300747
|
extraInfo: data.dadosLead ?? data.extraInfo ?? null,
|
|
300738
300748
|
agentId: instance4.agentId ?? null,
|
|
300739
|
-
externalMessageId:
|
|
300749
|
+
externalMessageId: channelSendResult?.messageId ?? null,
|
|
300740
300750
|
handoffFields: data.handoffFields ?? null,
|
|
300741
300751
|
sentAt: new Date,
|
|
300742
300752
|
metadata: {
|
|
300743
300753
|
instanceChannel: instance4.channel,
|
|
300754
|
+
channelHandoffSupported: hasNativeHandoff,
|
|
300744
300755
|
...data.motivoHandoff ? { motivoHandoff: data.motivoHandoff } : {}
|
|
300745
300756
|
}
|
|
300746
300757
|
}).catch((err) => log103.warn("Failed to persist handoff log", { error: String(err) }));
|
|
300747
300758
|
return c.json({
|
|
300748
300759
|
data: {
|
|
300749
|
-
messageId:
|
|
300750
|
-
status: "sent",
|
|
300751
|
-
timestamp:
|
|
300760
|
+
messageId: channelSendResult?.messageId ?? null,
|
|
300761
|
+
status: hasNativeHandoff ? "sent" : "paused",
|
|
300762
|
+
timestamp: channelSendResult?.timestamp ?? Date.now()
|
|
300752
300763
|
}
|
|
300753
300764
|
}, 201);
|
|
300754
300765
|
});
|
|
@@ -309230,6 +309241,7 @@ var GUPSHUP_CAPABILITIES = {
|
|
|
309230
309241
|
canDeleteMessage: false,
|
|
309231
309242
|
canReplyToMessage: true,
|
|
309232
309243
|
canForwardMessage: false,
|
|
309244
|
+
canHandoff: true,
|
|
309233
309245
|
canSendContact: false,
|
|
309234
309246
|
canSendLocation: true,
|
|
309235
309247
|
canSendSticker: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automagik/omni",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.260424.2",
|
|
4
4
|
"description": "LLM-optimized CLI for Omni",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"qrcode-terminal": "^0.12.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@omni/api": "2.
|
|
43
|
-
"@omni/channel-discord": "2.
|
|
44
|
-
"@omni/channel-gupshup": "2.
|
|
45
|
-
"@omni/channel-sdk": "2.
|
|
46
|
-
"@omni/channel-slack": "2.
|
|
47
|
-
"@omni/channel-telegram": "2.
|
|
48
|
-
"@omni/channel-whatsapp": "2.
|
|
49
|
-
"@omni/core": "2.
|
|
50
|
-
"@omni/sdk": "2.
|
|
42
|
+
"@omni/api": "2.260424.1",
|
|
43
|
+
"@omni/channel-discord": "2.260424.1",
|
|
44
|
+
"@omni/channel-gupshup": "2.260424.1",
|
|
45
|
+
"@omni/channel-sdk": "2.260424.1",
|
|
46
|
+
"@omni/channel-slack": "2.260424.1",
|
|
47
|
+
"@omni/channel-telegram": "2.260424.1",
|
|
48
|
+
"@omni/channel-whatsapp": "2.260424.1",
|
|
49
|
+
"@omni/core": "2.260424.1",
|
|
50
|
+
"@omni/sdk": "2.260424.1",
|
|
51
51
|
"@types/node": "^22.10.3",
|
|
52
52
|
"@types/qrcode-terminal": "^0.12.2",
|
|
53
53
|
"typescript": "^5.7.3"
|