@automagik/omni 2.260421.5 → 2.260422.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.
|
@@ -37,6 +37,8 @@ interface StreamEventRow {
|
|
|
37
37
|
}
|
|
38
38
|
export declare function seedStreamEvent(overrides?: Partial<StreamEventRow>): StreamEventRow;
|
|
39
39
|
export declare function clearStreamedEvents(): void;
|
|
40
|
+
export declare function getLastSendReactionBody<T = unknown>(): T | null;
|
|
41
|
+
export declare function clearLastSendReactionBody(): void;
|
|
40
42
|
interface MockApiHandle {
|
|
41
43
|
url: string;
|
|
42
44
|
port: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-api.d.ts","sourceRoot":"","sources":["../../src/__tests__/mock-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAwUtD;;;;;GAKG;AACH,UAAU,cAAc;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"mock-api.d.ts","sourceRoot":"","sources":["../../src/__tests__/m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","sources":["../../src/commands/react.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/commands/react.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wBAAgB,kBAAkB,IAAI,OAAO,CAgD5C"}
|
package/dist/index.js
CHANGED
|
@@ -113804,7 +113804,7 @@ import { fileURLToPath } from "url";
|
|
|
113804
113804
|
// package.json
|
|
113805
113805
|
var package_default = {
|
|
113806
113806
|
name: "@automagik/omni",
|
|
113807
|
-
version: "2.
|
|
113807
|
+
version: "2.260422.1",
|
|
113808
113808
|
description: "LLM-optimized CLI for Omni",
|
|
113809
113809
|
type: "module",
|
|
113810
113810
|
bin: {
|
|
@@ -123281,14 +123281,16 @@ function createReactCommand() {
|
|
|
123281
123281
|
if (!ctx.chatId) {
|
|
123282
123282
|
return error("No chat in context. Set OMNI_CHAT, use --chat, or run: omni open <contact>");
|
|
123283
123283
|
}
|
|
123284
|
-
const messageId = await resolveReplyTo(options.message);
|
|
123285
|
-
if (!messageId) {
|
|
123286
|
-
return error("No message to react to. Set OMNI_MESSAGE, use --message <id>, or ensure context has a trigger message.");
|
|
123287
|
-
}
|
|
123288
123284
|
try {
|
|
123285
|
+
const instanceId = await resolveInstanceId(ctx.instanceId);
|
|
123286
|
+
const chatId = await resolveRecipient(ctx.chatId);
|
|
123287
|
+
const messageId = await resolveReplyTo(options.message);
|
|
123288
|
+
if (!messageId) {
|
|
123289
|
+
return error("No message to react to. Set OMNI_MESSAGE, use --message <id>, or ensure context has a trigger message.");
|
|
123290
|
+
}
|
|
123289
123291
|
const result = await client.messages.sendReaction({
|
|
123290
|
-
instanceId
|
|
123291
|
-
to:
|
|
123292
|
+
instanceId,
|
|
123293
|
+
to: chatId,
|
|
123292
123294
|
messageId,
|
|
123293
123295
|
emoji
|
|
123294
123296
|
});
|
package/dist/server/index.js
CHANGED
|
@@ -224451,7 +224451,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
224451
224451
|
var require_package8 = __commonJS((exports, module) => {
|
|
224452
224452
|
module.exports = {
|
|
224453
224453
|
name: "@omni/api",
|
|
224454
|
-
version: "2.
|
|
224454
|
+
version: "2.260422.1",
|
|
224455
224455
|
type: "module",
|
|
224456
224456
|
exports: {
|
|
224457
224457
|
".": {
|
|
@@ -236782,7 +236782,7 @@ function validatePgserveDataDir(config4) {
|
|
|
236782
236782
|
}
|
|
236783
236783
|
function isAddressInUse(error2) {
|
|
236784
236784
|
const msg = error2 instanceof Error ? error2.message : String(error2);
|
|
236785
|
-
return msg.includes("EADDRINUSE") || msg.includes("address already in use") || msg.includes("Failed to listen on");
|
|
236785
|
+
return msg.includes("EADDRINUSE") || msg.includes("address already in use") || msg.includes("Failed to listen on") || msg.includes("Failed to listen at");
|
|
236786
236786
|
}
|
|
236787
236787
|
function buildDatabaseUrl(port) {
|
|
236788
236788
|
return `postgresql://postgres:postgres@localhost:${port}/omni`;
|
|
@@ -363740,7 +363740,19 @@ function resolveContactName2(chat2, contactNames) {
|
|
|
363740
363740
|
}
|
|
363741
363741
|
return;
|
|
363742
363742
|
}
|
|
363743
|
-
var chatsRoutes, ChatTypeSchema, listQuerySchema6, createChatSchema, updateChatSchema, addParticipantSchema, updateParticipantRoleSchema, chatChannelActionSchema, muteActionSchema, labelBodySchema,
|
|
363743
|
+
var chatsRoutes, ChatTypeSchema, listQuerySchema6, createChatSchema, updateChatSchema, addParticipantSchema, updateParticipantRoleSchema, chatChannelActionSchema, muteActionSchema, labelBodySchema, optionalDateParam = (paramName) => exports_external.string().optional().transform((v2, ctx) => {
|
|
363744
|
+
if (v2 === undefined || v2 === "")
|
|
363745
|
+
return;
|
|
363746
|
+
const parsed = new Date(v2);
|
|
363747
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
363748
|
+
ctx.addIssue({
|
|
363749
|
+
code: exports_external.ZodIssueCode.custom,
|
|
363750
|
+
message: `invalid ${paramName} parameter: expected ISO 8601 date string, got "${v2}"`
|
|
363751
|
+
});
|
|
363752
|
+
return exports_external.NEVER;
|
|
363753
|
+
}
|
|
363754
|
+
return parsed;
|
|
363755
|
+
}), listMessagesQuerySchema, markChatReadSchema, disappearingSchema, DISAPPEARING_DURATIONS, syncNamesSchema, clearSessionSchema;
|
|
363744
363756
|
var init_chats2 = __esm(() => {
|
|
363745
363757
|
init_dist6();
|
|
363746
363758
|
init_src();
|
|
@@ -363991,17 +364003,20 @@ var init_chats2 = __esm(() => {
|
|
|
363991
364003
|
const participant = await services.chats.updateParticipantRole(chatId, platformUserId, role);
|
|
363992
364004
|
return c.json({ data: participant });
|
|
363993
364005
|
});
|
|
363994
|
-
|
|
364006
|
+
listMessagesQuerySchema = exports_external.object({
|
|
364007
|
+
limit: exports_external.coerce.number().int().min(1).max(1000).default(100),
|
|
364008
|
+
before: optionalDateParam("before"),
|
|
364009
|
+
after: optionalDateParam("after"),
|
|
364010
|
+
mediaOnly: exports_external.string().optional().transform((v2) => v2 === "true")
|
|
364011
|
+
});
|
|
364012
|
+
chatsRoutes.get("/:id/messages", zValidator("query", listMessagesQuerySchema), async (c) => {
|
|
363995
364013
|
const chatId = c.req.param("id");
|
|
363996
|
-
const limit2 =
|
|
363997
|
-
const before = c.req.query("before");
|
|
363998
|
-
const after = c.req.query("after");
|
|
363999
|
-
const mediaOnly = c.req.query("mediaOnly") === "true";
|
|
364014
|
+
const { limit: limit2, before, after, mediaOnly } = c.req.valid("query");
|
|
364000
364015
|
const services = c.get("services");
|
|
364001
364016
|
const messages4 = await services.messages.getChatMessages(chatId, {
|
|
364002
364017
|
limit: limit2,
|
|
364003
|
-
before
|
|
364004
|
-
after
|
|
364018
|
+
before,
|
|
364019
|
+
after,
|
|
364005
364020
|
mediaOnly
|
|
364006
364021
|
});
|
|
364007
364022
|
return c.json({ items: messages4 });
|
|
@@ -368912,6 +368927,11 @@ import { join as join24 } from "path";
|
|
|
368912
368927
|
function isUUID(value) {
|
|
368913
368928
|
return UUID_REGEX.test(value);
|
|
368914
368929
|
}
|
|
368930
|
+
function extractReactionTargetParticipant(rawPayload) {
|
|
368931
|
+
const key = rawPayload?.key;
|
|
368932
|
+
const participant = key?.participant;
|
|
368933
|
+
return typeof participant === "string" && participant.length > 0 ? participant : undefined;
|
|
368934
|
+
}
|
|
368915
368935
|
async function resolveRecipient(to, channelType, services) {
|
|
368916
368936
|
if (!isUUID(to))
|
|
368917
368937
|
return to;
|
|
@@ -369602,12 +369622,17 @@ var init_messages5 = __esm(() => {
|
|
|
369602
369622
|
});
|
|
369603
369623
|
}
|
|
369604
369624
|
const resolvedTo = await resolveRecipient(to, instance4.channel, services);
|
|
369605
|
-
|
|
369625
|
+
const reactionMetadata = {};
|
|
369606
369626
|
const chat2 = await services.chats.findByExternalIdSmart(instanceId, resolvedTo);
|
|
369607
369627
|
if (chat2) {
|
|
369608
369628
|
const target = await services.messages.getByExternalId(chat2.id, messageId);
|
|
369609
369629
|
if (target) {
|
|
369610
|
-
fromMe = target.isFromMe === true;
|
|
369630
|
+
reactionMetadata.fromMe = target.isFromMe === true;
|
|
369631
|
+
if (target.isFromMe !== true) {
|
|
369632
|
+
const participant = extractReactionTargetParticipant(target.rawPayload);
|
|
369633
|
+
if (participant)
|
|
369634
|
+
reactionMetadata.targetParticipant = participant;
|
|
369635
|
+
}
|
|
369611
369636
|
} else {
|
|
369612
369637
|
log101.warn("Reaction target message not found in DB; deferring fromMe to channel plugin fallback (#386)", {
|
|
369613
369638
|
instanceId,
|
|
@@ -369631,7 +369656,7 @@ var init_messages5 = __esm(() => {
|
|
|
369631
369656
|
emoji,
|
|
369632
369657
|
targetMessageId: messageId
|
|
369633
369658
|
},
|
|
369634
|
-
metadata:
|
|
369659
|
+
metadata: reactionMetadata
|
|
369635
369660
|
};
|
|
369636
369661
|
const result = await plugin6.sendMessage(instanceId, outgoingMessage);
|
|
369637
369662
|
if (!result.success) {
|
|
@@ -493588,25 +493613,27 @@ function buildMessageContent2(message2, buildVCard) {
|
|
|
493588
493613
|
}
|
|
493589
493614
|
|
|
493590
493615
|
// ../channel-whatsapp/src/senders/reaction.ts
|
|
493591
|
-
function buildReactionContent(targetJid, targetMessageId, emoji, fromMe = true) {
|
|
493616
|
+
function buildReactionContent(targetJid, targetMessageId, emoji, fromMe = true, participant) {
|
|
493617
|
+
const key = {
|
|
493618
|
+
remoteJid: targetJid,
|
|
493619
|
+
id: targetMessageId,
|
|
493620
|
+
fromMe,
|
|
493621
|
+
...participant ? { participant } : {}
|
|
493622
|
+
};
|
|
493592
493623
|
return {
|
|
493593
493624
|
react: {
|
|
493594
493625
|
text: emoji,
|
|
493595
|
-
key
|
|
493596
|
-
remoteJid: targetJid,
|
|
493597
|
-
id: targetMessageId,
|
|
493598
|
-
fromMe
|
|
493599
|
-
}
|
|
493626
|
+
key
|
|
493600
493627
|
}
|
|
493601
493628
|
};
|
|
493602
493629
|
}
|
|
493603
|
-
async function sendReaction(sock, jid, targetMessageId, emoji, fromMe = true) {
|
|
493604
|
-
const content = buildReactionContent(jid, targetMessageId, emoji, fromMe);
|
|
493630
|
+
async function sendReaction(sock, jid, targetMessageId, emoji, fromMe = true, participant) {
|
|
493631
|
+
const content = buildReactionContent(jid, targetMessageId, emoji, fromMe, participant);
|
|
493605
493632
|
const result = await sock.sendMessage(jid, content);
|
|
493606
493633
|
return result?.key?.id ?? undefined;
|
|
493607
493634
|
}
|
|
493608
|
-
async function removeReaction4(sock, jid, targetMessageId, fromMe = true) {
|
|
493609
|
-
return sendReaction(sock, jid, targetMessageId, "", fromMe);
|
|
493635
|
+
async function removeReaction4(sock, jid, targetMessageId, fromMe = true, participant) {
|
|
493636
|
+
return sendReaction(sock, jid, targetMessageId, "", fromMe, participant);
|
|
493610
493637
|
}
|
|
493611
493638
|
|
|
493612
493639
|
// ../channel-whatsapp/src/senders/stream.ts
|
|
@@ -495079,16 +495106,18 @@ class WhatsAppPlugin extends BaseChannelPlugin {
|
|
|
495079
495106
|
};
|
|
495080
495107
|
}
|
|
495081
495108
|
const fromMe = message2.metadata?.fromMe ?? true;
|
|
495109
|
+
const targetParticipant = typeof message2.metadata?.targetParticipant === "string" ? message2.metadata.targetParticipant : undefined;
|
|
495082
495110
|
await this.humanDelay(instanceId);
|
|
495083
495111
|
this.logger.debug("Sending reaction", {
|
|
495084
495112
|
jid,
|
|
495085
495113
|
targetMessageId,
|
|
495086
495114
|
emoji: reactionEmoji || "(remove)",
|
|
495087
|
-
fromMe
|
|
495115
|
+
fromMe,
|
|
495116
|
+
targetParticipant
|
|
495088
495117
|
});
|
|
495089
495118
|
const correlationId = message2.metadata?.correlationId;
|
|
495090
495119
|
correlationId && this.captureT10(correlationId);
|
|
495091
|
-
const reactionMsgId = await sendReaction(sock, jid, targetMessageId, reactionEmoji, fromMe);
|
|
495120
|
+
const reactionMsgId = await sendReaction(sock, jid, targetMessageId, reactionEmoji, fromMe, targetParticipant);
|
|
495092
495121
|
if (reactionMsgId) {
|
|
495093
495122
|
this.trackSentMessageId(instanceId, reactionMsgId);
|
|
495094
495123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automagik/omni",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.260422.1",
|
|
4
4
|
"description": "LLM-optimized CLI for Omni",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"qrcode-terminal": "^0.12.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@omni/api": "2.260421.
|
|
40
|
-
"@omni/channel-discord": "2.260421.
|
|
41
|
-
"@omni/channel-sdk": "2.260421.
|
|
42
|
-
"@omni/channel-slack": "2.260421.
|
|
43
|
-
"@omni/channel-telegram": "2.260421.
|
|
44
|
-
"@omni/channel-whatsapp": "2.260421.
|
|
45
|
-
"@omni/core": "2.260421.
|
|
46
|
-
"@omni/sdk": "2.260421.
|
|
39
|
+
"@omni/api": "2.260421.6",
|
|
40
|
+
"@omni/channel-discord": "2.260421.6",
|
|
41
|
+
"@omni/channel-sdk": "2.260421.6",
|
|
42
|
+
"@omni/channel-slack": "2.260421.6",
|
|
43
|
+
"@omni/channel-telegram": "2.260421.6",
|
|
44
|
+
"@omni/channel-whatsapp": "2.260421.6",
|
|
45
|
+
"@omni/core": "2.260421.6",
|
|
46
|
+
"@omni/sdk": "2.260421.6",
|
|
47
47
|
"@types/node": "^22.10.3",
|
|
48
48
|
"@types/qrcode-terminal": "^0.12.2",
|
|
49
49
|
"typescript": "^5.7.3"
|