@automagik/omni 2.260421.5 → 2.260421.6

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;AAID,wBAAgB,eAAe,CAAC,SAAS,GAAE,OAAO,CAAC,cAAc,CAAM,GAAG,cAAc,CAqBvF;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AA0KD,UAAU,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ACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAID;;;;GAIG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC,CA+B3D;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAIlC"}
@@ -1 +1 @@
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;AAWpC,wBAAgB,kBAAkB,IAAI,OAAO,CA6C5C"}
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.260421.5",
113807
+ version: "2.260421.6",
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: ctx.instanceId,
123291
- to: ctx.chatId,
123292
+ instanceId,
123293
+ to: chatId,
123292
123294
  messageId,
123293
123295
  emoji
123294
123296
  });
@@ -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.260421.5",
224454
+ version: "2.260421.6",
224455
224455
  type: "module",
224456
224456
  exports: {
224457
224457
  ".": {
@@ -368912,6 +368912,11 @@ import { join as join24 } from "path";
368912
368912
  function isUUID(value) {
368913
368913
  return UUID_REGEX.test(value);
368914
368914
  }
368915
+ function extractReactionTargetParticipant(rawPayload) {
368916
+ const key = rawPayload?.key;
368917
+ const participant = key?.participant;
368918
+ return typeof participant === "string" && participant.length > 0 ? participant : undefined;
368919
+ }
368915
368920
  async function resolveRecipient(to, channelType, services) {
368916
368921
  if (!isUUID(to))
368917
368922
  return to;
@@ -369602,12 +369607,17 @@ var init_messages5 = __esm(() => {
369602
369607
  });
369603
369608
  }
369604
369609
  const resolvedTo = await resolveRecipient(to, instance4.channel, services);
369605
- let fromMe;
369610
+ const reactionMetadata = {};
369606
369611
  const chat2 = await services.chats.findByExternalIdSmart(instanceId, resolvedTo);
369607
369612
  if (chat2) {
369608
369613
  const target = await services.messages.getByExternalId(chat2.id, messageId);
369609
369614
  if (target) {
369610
- fromMe = target.isFromMe === true;
369615
+ reactionMetadata.fromMe = target.isFromMe === true;
369616
+ if (target.isFromMe !== true) {
369617
+ const participant = extractReactionTargetParticipant(target.rawPayload);
369618
+ if (participant)
369619
+ reactionMetadata.targetParticipant = participant;
369620
+ }
369611
369621
  } else {
369612
369622
  log101.warn("Reaction target message not found in DB; deferring fromMe to channel plugin fallback (#386)", {
369613
369623
  instanceId,
@@ -369631,7 +369641,7 @@ var init_messages5 = __esm(() => {
369631
369641
  emoji,
369632
369642
  targetMessageId: messageId
369633
369643
  },
369634
- metadata: fromMe === undefined ? {} : { fromMe }
369644
+ metadata: reactionMetadata
369635
369645
  };
369636
369646
  const result = await plugin6.sendMessage(instanceId, outgoingMessage);
369637
369647
  if (!result.success) {
@@ -493588,25 +493598,27 @@ function buildMessageContent2(message2, buildVCard) {
493588
493598
  }
493589
493599
 
493590
493600
  // ../channel-whatsapp/src/senders/reaction.ts
493591
- function buildReactionContent(targetJid, targetMessageId, emoji, fromMe = true) {
493601
+ function buildReactionContent(targetJid, targetMessageId, emoji, fromMe = true, participant) {
493602
+ const key = {
493603
+ remoteJid: targetJid,
493604
+ id: targetMessageId,
493605
+ fromMe,
493606
+ ...participant ? { participant } : {}
493607
+ };
493592
493608
  return {
493593
493609
  react: {
493594
493610
  text: emoji,
493595
- key: {
493596
- remoteJid: targetJid,
493597
- id: targetMessageId,
493598
- fromMe
493599
- }
493611
+ key
493600
493612
  }
493601
493613
  };
493602
493614
  }
493603
- async function sendReaction(sock, jid, targetMessageId, emoji, fromMe = true) {
493604
- const content = buildReactionContent(jid, targetMessageId, emoji, fromMe);
493615
+ async function sendReaction(sock, jid, targetMessageId, emoji, fromMe = true, participant) {
493616
+ const content = buildReactionContent(jid, targetMessageId, emoji, fromMe, participant);
493605
493617
  const result = await sock.sendMessage(jid, content);
493606
493618
  return result?.key?.id ?? undefined;
493607
493619
  }
493608
- async function removeReaction4(sock, jid, targetMessageId, fromMe = true) {
493609
- return sendReaction(sock, jid, targetMessageId, "", fromMe);
493620
+ async function removeReaction4(sock, jid, targetMessageId, fromMe = true, participant) {
493621
+ return sendReaction(sock, jid, targetMessageId, "", fromMe, participant);
493610
493622
  }
493611
493623
 
493612
493624
  // ../channel-whatsapp/src/senders/stream.ts
@@ -495079,16 +495091,18 @@ class WhatsAppPlugin extends BaseChannelPlugin {
495079
495091
  };
495080
495092
  }
495081
495093
  const fromMe = message2.metadata?.fromMe ?? true;
495094
+ const targetParticipant = typeof message2.metadata?.targetParticipant === "string" ? message2.metadata.targetParticipant : undefined;
495082
495095
  await this.humanDelay(instanceId);
495083
495096
  this.logger.debug("Sending reaction", {
495084
495097
  jid,
495085
495098
  targetMessageId,
495086
495099
  emoji: reactionEmoji || "(remove)",
495087
- fromMe
495100
+ fromMe,
495101
+ targetParticipant
495088
495102
  });
495089
495103
  const correlationId = message2.metadata?.correlationId;
495090
495104
  correlationId && this.captureT10(correlationId);
495091
- const reactionMsgId = await sendReaction(sock, jid, targetMessageId, reactionEmoji, fromMe);
495105
+ const reactionMsgId = await sendReaction(sock, jid, targetMessageId, reactionEmoji, fromMe, targetParticipant);
495092
495106
  if (reactionMsgId) {
495093
495107
  this.trackSentMessageId(instanceId, reactionMsgId);
495094
495108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260421.5",
3
+ "version": "2.260421.6",
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.4",
40
- "@omni/channel-discord": "2.260421.4",
41
- "@omni/channel-sdk": "2.260421.4",
42
- "@omni/channel-slack": "2.260421.4",
43
- "@omni/channel-telegram": "2.260421.4",
44
- "@omni/channel-whatsapp": "2.260421.4",
45
- "@omni/core": "2.260421.4",
46
- "@omni/sdk": "2.260421.4",
39
+ "@omni/api": "2.260421.5",
40
+ "@omni/channel-discord": "2.260421.5",
41
+ "@omni/channel-sdk": "2.260421.5",
42
+ "@omni/channel-slack": "2.260421.5",
43
+ "@omni/channel-telegram": "2.260421.5",
44
+ "@omni/channel-whatsapp": "2.260421.5",
45
+ "@omni/core": "2.260421.5",
46
+ "@omni/sdk": "2.260421.5",
47
47
  "@types/node": "^22.10.3",
48
48
  "@types/qrcode-terminal": "^0.12.2",
49
49
  "typescript": "^5.7.3"