@automagik/omni 2.260907.1 → 2.260907.3

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 CHANGED
@@ -136390,7 +136390,7 @@ import { fileURLToPath } from "url";
136390
136390
  // package.json
136391
136391
  var package_default = {
136392
136392
  name: "@automagik/omni",
136393
- version: "2.260907.1",
136393
+ version: "2.260907.3",
136394
136394
  repository: {
136395
136395
  type: "git",
136396
136396
  url: "git+https://github.com/automagik-dev/omni.git",
@@ -250957,7 +250957,7 @@ var init_sentry_scrub = __esm(() => {
250957
250957
  var require_package7 = __commonJS((exports, module) => {
250958
250958
  module.exports = {
250959
250959
  name: "@omni/api",
250960
- version: "2.260907.1",
250960
+ version: "2.260907.3",
250961
250961
  private: true,
250962
250962
  type: "module",
250963
250963
  exports: {
@@ -355492,6 +355492,25 @@ async function listActiveOwnerIdentifiers(db2, trustedTenantId) {
355492
355492
  cachedActiveOwnerIdentifiersAt = now;
355493
355493
  return cachedActiveOwnerIdentifiers;
355494
355494
  }
355495
+ async function isAgentOutboundEcho(chatsService, messagesService, db2, payload, instanceId, trustedTenantId) {
355496
+ if (payload.rawPayload?.isFromMe !== true)
355497
+ return false;
355498
+ const priorMessage = await runDispatchDb(db2, trustedTenantId, async () => {
355499
+ const chat2 = await chatsService.findByExternalIdSmart(instanceId, payload.chatId);
355500
+ if (!chat2)
355501
+ return null;
355502
+ return messagesService.getByExternalId(chat2.id, payload.externalId);
355503
+ });
355504
+ if (!priorMessage?.senderAgentId)
355505
+ return false;
355506
+ log91.info("Skipping own outbound echo (agent-authored message received back)", {
355507
+ instanceId,
355508
+ chatId: payload.chatId,
355509
+ externalId: payload.externalId,
355510
+ senderAgentId: priorMessage.senderAgentId
355511
+ });
355512
+ return true;
355513
+ }
355495
355514
  async function shouldProcessMessage3(agentRunner, accessService, chatsService, messagesService, routeResolver, db2, payload, metadata, trustedTenantId) {
355496
355515
  if (!metadata.instanceId) {
355497
355516
  log91.debug("No instanceId in metadata", { from: payload.from, chatId: payload.chatId });
@@ -355501,6 +355520,9 @@ async function shouldProcessMessage3(agentRunner, accessService, chatsService, m
355501
355520
  log91.debug("Message from self, skipping", { instanceId: metadata.instanceId, from: payload.from });
355502
355521
  return null;
355503
355522
  }
355523
+ if (await isAgentOutboundEcho(chatsService, messagesService, db2, payload, metadata.instanceId, trustedTenantId)) {
355524
+ return null;
355525
+ }
355504
355526
  if (payload.content?.type === "reaction") {
355505
355527
  log91.debug("Skipping reaction dual-emit on message path (reaction.received owns dispatch)", {
355506
355528
  instanceId: metadata.instanceId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260907.1",
3
+ "version": "2.260907.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/automagik-dev/omni.git",