@automagik/omni 2.260911.4 → 2.260911.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.
package/dist/index.js CHANGED
@@ -41429,6 +41429,8 @@ class DebounceManager {
41429
41429
  this.windows.set(key, window2);
41430
41430
  }
41431
41431
  window2.messages.push(message2);
41432
+ window2.from = from;
41433
+ window2.instanceId = instanceId;
41432
41434
  window2.lastActivityAt = Date.now();
41433
41435
  this.resetTimer(key, window2);
41434
41436
  }
@@ -41763,6 +41765,23 @@ class AutomationEngine {
41763
41765
  throw err2;
41764
41766
  }
41765
41767
  }
41768
+ resolveDebounceKey(automation, event, instanceId) {
41769
+ const payload = event.payload;
41770
+ const template = automation.debounce?.key;
41771
+ if (!template) {
41772
+ const from = payload.from;
41773
+ return from?.id ? buildConversationKey(instanceId, from.id) : null;
41774
+ }
41775
+ const rendered = substituteTemplate(template, createTemplateContext(payload)).trim();
41776
+ if (!rendered) {
41777
+ logger4.debug("Debounce key template rendered empty \u2014 processing immediately", {
41778
+ automationId: automation.id,
41779
+ eventId: event.id
41780
+ });
41781
+ return null;
41782
+ }
41783
+ return `${instanceId}:${rendered}`;
41784
+ }
41766
41785
  async handleDebounced(automation, event) {
41767
41786
  const manager = this.debounceManagers.get(automation.id);
41768
41787
  if (!manager) {
@@ -41772,11 +41791,11 @@ class AutomationEngine {
41772
41791
  const payload = event.payload;
41773
41792
  const instanceId = event.metadata.instanceId ?? "global";
41774
41793
  const from = payload.from;
41775
- if (!from?.id) {
41794
+ const key = this.resolveDebounceKey(automation, event, instanceId);
41795
+ if (!key) {
41776
41796
  await this.handleImmediate(automation, event);
41777
41797
  return;
41778
41798
  }
41779
- const key = buildConversationKey(instanceId, from.id);
41780
41799
  if (event.type.startsWith("presence.")) {
41781
41800
  manager.handlePresenceEvent(key, event.type);
41782
41801
  return;
@@ -115780,7 +115799,7 @@ var require_client2 = __commonJS((exports) => {
115780
115799
 
115781
115800
  // ../../node_modules/.bun/@sentry+node-core@10.52.0+2c50d7e904f6cfd7/node_modules/@sentry/node-core/build/cjs/sdk/esmLoader.js
115782
115801
  var require_esmLoader = __commonJS((exports) => {
115783
- var __filename = "/home/runner/work/omni/omni/node_modules/.bun/@sentry+node-core@10.52.0+2c50d7e904f6cfd7/node_modules/@sentry/node-core/build/cjs/sdk/esmLoader.js";
115802
+ var __filename = "/home/runner/work/omni/omni/.stable-source/node_modules/.bun/@sentry+node-core@10.52.0+2c50d7e904f6cfd7/node_modules/@sentry/node-core/build/cjs/sdk/esmLoader.js";
115784
115803
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
115785
115804
  var core = require_cjs();
115786
115805
  var importInTheMiddle = require_import_in_the_middle();
@@ -137213,7 +137232,7 @@ import { fileURLToPath } from "url";
137213
137232
  // package.json
137214
137233
  var package_default = {
137215
137234
  name: "@automagik/omni",
137216
- version: "2.260911.4",
137235
+ version: "2.260911.6",
137217
137236
  repository: {
137218
137237
  type: "git",
137219
137238
  url: "git+https://github.com/automagik-dev/omni.git",
@@ -5822,6 +5822,8 @@ export interface components {
5822
5822
  baseDelayMs?: number;
5823
5823
  maxWaitMs?: number;
5824
5824
  extendOnEvents?: string[];
5825
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
5826
+ key?: string;
5825
5827
  } | null;
5826
5828
  /** @description Whether enabled */
5827
5829
  enabled: boolean;
@@ -5959,6 +5961,8 @@ export interface components {
5959
5961
  baseDelayMs?: number;
5960
5962
  maxWaitMs?: number;
5961
5963
  extendOnEvents?: string[];
5964
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
5965
+ key?: string;
5962
5966
  };
5963
5967
  /**
5964
5968
  * @description Whether enabled
@@ -17906,6 +17910,8 @@ export interface operations {
17906
17910
  baseDelayMs?: number;
17907
17911
  maxWaitMs?: number;
17908
17912
  extendOnEvents?: string[];
17913
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
17914
+ key?: string;
17909
17915
  } | null;
17910
17916
  /** @description Whether enabled */
17911
17917
  enabled: boolean;
@@ -18057,6 +18063,8 @@ export interface operations {
18057
18063
  baseDelayMs?: number;
18058
18064
  maxWaitMs?: number;
18059
18065
  extendOnEvents?: string[];
18066
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
18067
+ key?: string;
18060
18068
  };
18061
18069
  /**
18062
18070
  * @description Whether enabled
@@ -18202,6 +18210,8 @@ export interface operations {
18202
18210
  baseDelayMs?: number;
18203
18211
  maxWaitMs?: number;
18204
18212
  extendOnEvents?: string[];
18213
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
18214
+ key?: string;
18205
18215
  } | null;
18206
18216
  /** @description Whether enabled */
18207
18217
  enabled: boolean;
@@ -18387,6 +18397,8 @@ export interface operations {
18387
18397
  baseDelayMs?: number;
18388
18398
  maxWaitMs?: number;
18389
18399
  extendOnEvents?: string[];
18400
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
18401
+ key?: string;
18390
18402
  } | null;
18391
18403
  /** @description Whether enabled */
18392
18404
  enabled: boolean;
@@ -18609,6 +18621,8 @@ export interface operations {
18609
18621
  baseDelayMs?: number;
18610
18622
  maxWaitMs?: number;
18611
18623
  extendOnEvents?: string[];
18624
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
18625
+ key?: string;
18612
18626
  };
18613
18627
  /**
18614
18628
  * @description Whether enabled
@@ -18754,6 +18768,8 @@ export interface operations {
18754
18768
  baseDelayMs?: number;
18755
18769
  maxWaitMs?: number;
18756
18770
  extendOnEvents?: string[];
18771
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
18772
+ key?: string;
18757
18773
  } | null;
18758
18774
  /** @description Whether enabled */
18759
18775
  enabled: boolean;
@@ -18939,6 +18955,8 @@ export interface operations {
18939
18955
  baseDelayMs?: number;
18940
18956
  maxWaitMs?: number;
18941
18957
  extendOnEvents?: string[];
18958
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
18959
+ key?: string;
18942
18960
  } | null;
18943
18961
  /** @description Whether enabled */
18944
18962
  enabled: boolean;
@@ -19124,6 +19142,8 @@ export interface operations {
19124
19142
  baseDelayMs?: number;
19125
19143
  maxWaitMs?: number;
19126
19144
  extendOnEvents?: string[];
19145
+ /** @description Template over the event payload naming the debounce window (#1110), e.g. "{{payload.pull_request.id}}"; absent = grouped by conversation (instance + sender). Not allowed with mode "presence" */
19146
+ key?: string;
19127
19147
  } | null;
19128
19148
  /** @description Whether enabled */
19129
19149
  enabled: boolean;