@automagik/omni 2.260430.15 → 2.260501.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.
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/index.js +161 -44
- package/dist/lib/canonical-pgserve.d.ts.map +1 -1
- package/dist/server/index.js +152 -52
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,KAAK,MAAM,EACX,KAAK,YAAY,EAKlB,MAAM,cAAc,CAAC;AAgBtB,8CAA8C;AAC9C,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhD,kDAAkD;AAClD,MAAM,MAAM,OAAO,GACf,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,gBAAgB,GAChB,oBAAoB,GACpB,eAAe,GACf,YAAY,GACZ,kBAAkB,GAClB,yBAAyB,GACzB,sCAAsC,GACtC,mBAAmB,CAAC;AAExB,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,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M,MAAM,CAAC;IAC7B,mEAAmE;IACnE,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,iFAAiF;IACjF,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;IACnE;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAChC;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACpD;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;CAC5D;AAmsBD;;;GAGG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAcxG;AA2BD,wBAAgB,mBAAmB,IAAI,OAAO,CAgD7C"}
|
package/dist/index.js
CHANGED
|
@@ -26733,6 +26733,9 @@ function createSubscription(options) {
|
|
|
26733
26733
|
return {
|
|
26734
26734
|
id: subscriptionId,
|
|
26735
26735
|
pattern,
|
|
26736
|
+
isAlive() {
|
|
26737
|
+
return isActive;
|
|
26738
|
+
},
|
|
26736
26739
|
async unsubscribe() {
|
|
26737
26740
|
isActive = false;
|
|
26738
26741
|
abortController.abort();
|
|
@@ -34208,13 +34211,16 @@ var init_debounce = __esm(() => {
|
|
|
34208
34211
|
// ../core/src/automations/engine.ts
|
|
34209
34212
|
class AutomationEngine {
|
|
34210
34213
|
config;
|
|
34211
|
-
subscriptions =
|
|
34214
|
+
subscriptions = new Map;
|
|
34212
34215
|
instanceQueues = new Map;
|
|
34213
34216
|
debounceManagers = new Map;
|
|
34214
34217
|
automations = [];
|
|
34215
34218
|
eventBus = null;
|
|
34216
34219
|
deps;
|
|
34217
34220
|
logger = null;
|
|
34221
|
+
reconcileTimer = null;
|
|
34222
|
+
reconcileEnabled = false;
|
|
34223
|
+
reconcilePromise = null;
|
|
34218
34224
|
constructor(config2) {
|
|
34219
34225
|
this.config = config2;
|
|
34220
34226
|
this.deps = {
|
|
@@ -34231,33 +34237,17 @@ class AutomationEngine {
|
|
|
34231
34237
|
callAgent: deps.callAgent
|
|
34232
34238
|
};
|
|
34233
34239
|
this.automations = automations.filter((a) => a.enabled);
|
|
34234
|
-
|
|
34235
|
-
|
|
34236
|
-
|
|
34237
|
-
const subscription = await eventBus.subscribePattern(`${eventType}.>`, async (event) => {
|
|
34238
|
-
await this.handleEvent(event);
|
|
34239
|
-
}, {
|
|
34240
|
-
durable,
|
|
34241
|
-
queue: "automation-engine",
|
|
34242
|
-
startFrom: "new",
|
|
34243
|
-
maxRetries: 3,
|
|
34244
|
-
retryDelayMs: 1000
|
|
34245
|
-
});
|
|
34246
|
-
this.subscriptions.push(subscription);
|
|
34247
|
-
logger4.info(`Subscribed to ${eventType}.*`, { durable });
|
|
34248
|
-
}
|
|
34249
|
-
for (const automation of this.automations) {
|
|
34250
|
-
if (automation.debounce && automation.debounce.mode !== "none") {
|
|
34251
|
-
this.setupDebounceManager(automation);
|
|
34252
|
-
}
|
|
34253
|
-
}
|
|
34240
|
+
await this.reconcileSubscriptions();
|
|
34241
|
+
this.rebuildDebounceManagers();
|
|
34242
|
+
this.startReconcileTimer();
|
|
34254
34243
|
logger4.info(`Automation engine started with ${this.automations.length} automations`);
|
|
34255
34244
|
}
|
|
34256
34245
|
async stop() {
|
|
34257
|
-
|
|
34246
|
+
this.stopReconcileTimer();
|
|
34247
|
+
for (const subscription of this.subscriptions.values()) {
|
|
34258
34248
|
await subscription.unsubscribe();
|
|
34259
34249
|
}
|
|
34260
|
-
this.subscriptions
|
|
34250
|
+
this.subscriptions.clear();
|
|
34261
34251
|
for (const manager of this.debounceManagers.values()) {
|
|
34262
34252
|
manager.flushAll();
|
|
34263
34253
|
}
|
|
@@ -34268,9 +34258,117 @@ class AutomationEngine {
|
|
|
34268
34258
|
this.logger = logger5;
|
|
34269
34259
|
}
|
|
34270
34260
|
async reload(automations) {
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34261
|
+
if (!this.eventBus) {
|
|
34262
|
+
this.automations = automations.filter((a) => a.enabled);
|
|
34263
|
+
return;
|
|
34264
|
+
}
|
|
34265
|
+
this.automations = automations.filter((a) => a.enabled);
|
|
34266
|
+
await this.reconcileSubscriptions();
|
|
34267
|
+
this.rebuildDebounceManagers();
|
|
34268
|
+
}
|
|
34269
|
+
async reconcile() {
|
|
34270
|
+
if (!this.eventBus)
|
|
34271
|
+
return;
|
|
34272
|
+
await this.reconcileSubscriptions();
|
|
34273
|
+
}
|
|
34274
|
+
async reconcileSubscriptions() {
|
|
34275
|
+
if (!this.eventBus)
|
|
34276
|
+
return;
|
|
34277
|
+
if (this.reconcilePromise)
|
|
34278
|
+
return this.reconcilePromise;
|
|
34279
|
+
this.reconcilePromise = this.doReconcileSubscriptions().finally(() => {
|
|
34280
|
+
this.reconcilePromise = null;
|
|
34281
|
+
});
|
|
34282
|
+
return this.reconcilePromise;
|
|
34283
|
+
}
|
|
34284
|
+
async doReconcileSubscriptions() {
|
|
34285
|
+
if (!this.eventBus)
|
|
34286
|
+
return;
|
|
34287
|
+
const expectedTriggers = new Set(this.automations.map((a) => a.triggerEventType));
|
|
34288
|
+
for (const [eventType, subscription] of this.subscriptions) {
|
|
34289
|
+
if (!expectedTriggers.has(eventType)) {
|
|
34290
|
+
await subscription.unsubscribe().catch((err2) => {
|
|
34291
|
+
logger4.warn("Failed to unsubscribe orphan trigger", { eventType, error: String(err2) });
|
|
34292
|
+
});
|
|
34293
|
+
this.subscriptions.delete(eventType);
|
|
34294
|
+
logger4.info(`Unsubscribed from ${eventType}.* (no enabled automations)`);
|
|
34295
|
+
}
|
|
34296
|
+
}
|
|
34297
|
+
for (const eventType of expectedTriggers) {
|
|
34298
|
+
const existing = this.subscriptions.get(eventType);
|
|
34299
|
+
if (existing && this.isSubscriptionAlive(existing)) {
|
|
34300
|
+
continue;
|
|
34301
|
+
}
|
|
34302
|
+
if (existing) {
|
|
34303
|
+
await existing.unsubscribe().catch(() => {});
|
|
34304
|
+
this.subscriptions.delete(eventType);
|
|
34305
|
+
logger4.warn("Replacing dead subscription", { eventType });
|
|
34306
|
+
}
|
|
34307
|
+
const subscription = await this.subscribeForTrigger(eventType);
|
|
34308
|
+
this.subscriptions.set(eventType, subscription);
|
|
34309
|
+
}
|
|
34310
|
+
}
|
|
34311
|
+
async subscribeForTrigger(eventType) {
|
|
34312
|
+
if (!this.eventBus) {
|
|
34313
|
+
throw new Error("Event bus not initialized");
|
|
34314
|
+
}
|
|
34315
|
+
const durable = `automation-engine-${eventType.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
34316
|
+
const subscription = await this.eventBus.subscribePattern(`${eventType}.>`, async (event) => {
|
|
34317
|
+
await this.handleEvent(event);
|
|
34318
|
+
}, {
|
|
34319
|
+
durable,
|
|
34320
|
+
queue: "automation-engine",
|
|
34321
|
+
startFrom: "new",
|
|
34322
|
+
maxRetries: 3,
|
|
34323
|
+
retryDelayMs: 1000
|
|
34324
|
+
});
|
|
34325
|
+
logger4.info(`Subscribed to ${eventType}.*`, { durable });
|
|
34326
|
+
return subscription;
|
|
34327
|
+
}
|
|
34328
|
+
isSubscriptionAlive(subscription) {
|
|
34329
|
+
return subscription.isAlive ? subscription.isAlive() : true;
|
|
34330
|
+
}
|
|
34331
|
+
rebuildDebounceManagers() {
|
|
34332
|
+
const enabledIds = new Set(this.automations.map((a) => a.id));
|
|
34333
|
+
for (const id of this.debounceManagers.keys()) {
|
|
34334
|
+
if (!enabledIds.has(id)) {
|
|
34335
|
+
this.debounceManagers.get(id)?.flushAll();
|
|
34336
|
+
this.debounceManagers.delete(id);
|
|
34337
|
+
}
|
|
34338
|
+
}
|
|
34339
|
+
for (const automation of this.automations) {
|
|
34340
|
+
if (automation.debounce && automation.debounce.mode !== "none" && !this.debounceManagers.has(automation.id)) {
|
|
34341
|
+
this.setupDebounceManager(automation);
|
|
34342
|
+
}
|
|
34343
|
+
}
|
|
34344
|
+
}
|
|
34345
|
+
startReconcileTimer() {
|
|
34346
|
+
this.stopReconcileTimer();
|
|
34347
|
+
const intervalMs = this.config.reconcileIntervalMs ?? 30000;
|
|
34348
|
+
if (intervalMs <= 0)
|
|
34349
|
+
return;
|
|
34350
|
+
this.reconcileEnabled = true;
|
|
34351
|
+
this.scheduleNextReconcile(intervalMs);
|
|
34352
|
+
}
|
|
34353
|
+
scheduleNextReconcile(intervalMs) {
|
|
34354
|
+
if (!this.reconcileEnabled)
|
|
34355
|
+
return;
|
|
34356
|
+
this.reconcileTimer = setTimeout(() => {
|
|
34357
|
+
this.reconcileSubscriptions().catch((err2) => {
|
|
34358
|
+
logger4.error("Reconciler tick failed", { error: String(err2) });
|
|
34359
|
+
}).finally(() => {
|
|
34360
|
+
this.scheduleNextReconcile(intervalMs);
|
|
34361
|
+
});
|
|
34362
|
+
}, intervalMs);
|
|
34363
|
+
if (typeof this.reconcileTimer === "object" && this.reconcileTimer && "unref" in this.reconcileTimer) {
|
|
34364
|
+
this.reconcileTimer.unref();
|
|
34365
|
+
}
|
|
34366
|
+
}
|
|
34367
|
+
stopReconcileTimer() {
|
|
34368
|
+
this.reconcileEnabled = false;
|
|
34369
|
+
if (this.reconcileTimer) {
|
|
34370
|
+
clearTimeout(this.reconcileTimer);
|
|
34371
|
+
this.reconcileTimer = null;
|
|
34274
34372
|
}
|
|
34275
34373
|
}
|
|
34276
34374
|
async handleEvent(event) {
|
|
@@ -114079,7 +114177,7 @@ import { fileURLToPath } from "url";
|
|
|
114079
114177
|
// package.json
|
|
114080
114178
|
var package_default = {
|
|
114081
114179
|
name: "@automagik/omni",
|
|
114082
|
-
version: "2.
|
|
114180
|
+
version: "2.260501.1",
|
|
114083
114181
|
description: "LLM-optimized CLI for Omni",
|
|
114084
114182
|
type: "module",
|
|
114085
114183
|
bin: {
|
|
@@ -118735,7 +118833,7 @@ init_output();
|
|
|
118735
118833
|
var PGSERVE_REQUIRED_VERSION = "^2.1.0";
|
|
118736
118834
|
async function isPgserveInstalled() {
|
|
118737
118835
|
try {
|
|
118738
|
-
const code = await Bun.spawn({ cmd: ["pgserve", "
|
|
118836
|
+
const code = await Bun.spawn({ cmd: ["pgserve", "--help"], stdout: "pipe", stderr: "pipe" }).exited;
|
|
118739
118837
|
return code === 0;
|
|
118740
118838
|
} catch {
|
|
118741
118839
|
return false;
|
|
@@ -119374,27 +119472,46 @@ function summarizeChecks(checks) {
|
|
|
119374
119472
|
}
|
|
119375
119473
|
return summary;
|
|
119376
119474
|
}
|
|
119475
|
+
var CASCADE_PRONE_FIXES = new Set([
|
|
119476
|
+
"cli-key-valid",
|
|
119477
|
+
"omni-db-exists",
|
|
119478
|
+
"pgserve-reachable"
|
|
119479
|
+
]);
|
|
119480
|
+
async function runPhase1MigrationFix(deps, checks, fixesApplied) {
|
|
119481
|
+
const canonicalCheck = checks.find((c2) => c2.id === "pgserve-canonical");
|
|
119482
|
+
if (!canonicalCheck || canonicalCheck.level === "OK") {
|
|
119483
|
+
return { canonicalFailed: false, checks };
|
|
119484
|
+
}
|
|
119485
|
+
const result = await applyFix(deps, canonicalCheck);
|
|
119486
|
+
if (result !== null)
|
|
119487
|
+
fixesApplied.push(result);
|
|
119488
|
+
const canonicalFailed = typeof result === "string" && result.startsWith("FAILED ");
|
|
119489
|
+
const refreshed = await runAllChecks(deps);
|
|
119490
|
+
return { canonicalFailed, checks: refreshed };
|
|
119491
|
+
}
|
|
119492
|
+
async function runPhase2Fixes(deps, checks, canonicalFailed, fixesApplied) {
|
|
119493
|
+
for (const check of checks) {
|
|
119494
|
+
if (check.level === "OK")
|
|
119495
|
+
continue;
|
|
119496
|
+
if (check.id === "pgserve-canonical")
|
|
119497
|
+
continue;
|
|
119498
|
+
if (canonicalFailed && CASCADE_PRONE_FIXES.has(check.id)) {
|
|
119499
|
+
fixesApplied.push(`SKIPPED ${check.id}: blocked by failed canonical-pgserve migration \u2014 fix manually after \`pgserve install\``);
|
|
119500
|
+
continue;
|
|
119501
|
+
}
|
|
119502
|
+
const result = await applyFix(deps, check);
|
|
119503
|
+
if (result !== null)
|
|
119504
|
+
fixesApplied.push(result);
|
|
119505
|
+
}
|
|
119506
|
+
}
|
|
119377
119507
|
async function runDoctor(options, depsOverride) {
|
|
119378
119508
|
const deps = depsOverride ?? productionDeps();
|
|
119379
119509
|
let checks = await runAllChecks(deps);
|
|
119380
119510
|
const fixesApplied = [];
|
|
119381
119511
|
if (options.fix) {
|
|
119382
|
-
const
|
|
119383
|
-
|
|
119384
|
-
|
|
119385
|
-
if (result !== null)
|
|
119386
|
-
fixesApplied.push(result);
|
|
119387
|
-
checks = await runAllChecks(deps);
|
|
119388
|
-
}
|
|
119389
|
-
for (const check of checks) {
|
|
119390
|
-
if (check.level === "OK")
|
|
119391
|
-
continue;
|
|
119392
|
-
if (check.id === "pgserve-canonical")
|
|
119393
|
-
continue;
|
|
119394
|
-
const result = await applyFix(deps, check);
|
|
119395
|
-
if (result !== null)
|
|
119396
|
-
fixesApplied.push(result);
|
|
119397
|
-
}
|
|
119512
|
+
const phase1 = await runPhase1MigrationFix(deps, checks, fixesApplied);
|
|
119513
|
+
checks = phase1.checks;
|
|
119514
|
+
await runPhase2Fixes(deps, checks, phase1.canonicalFailed, fixesApplied);
|
|
119398
119515
|
checks = await runAllChecks(deps);
|
|
119399
119516
|
}
|
|
119400
119517
|
return { checks, summary: summarizeChecks(checks), fixesApplied };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-pgserve.d.ts","sourceRoot":"","sources":["../../src/lib/canonical-pgserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"canonical-pgserve.d.ts","sourceRoot":"","sources":["../../src/lib/canonical-pgserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAqIH;;;;;;GAMG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iCAAiC,CACrD,WAAW,EAAE,OAAO,EACpB,GAAG,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAC3B,OAAO,CAAC,OAAO,CAAC,CA6BlB"}
|
package/dist/server/index.js
CHANGED
|
@@ -21136,6 +21136,9 @@ function createSubscription(options) {
|
|
|
21136
21136
|
return {
|
|
21137
21137
|
id: subscriptionId,
|
|
21138
21138
|
pattern,
|
|
21139
|
+
isAlive() {
|
|
21140
|
+
return isActive;
|
|
21141
|
+
},
|
|
21139
21142
|
async unsubscribe() {
|
|
21140
21143
|
isActive = false;
|
|
21141
21144
|
abortController.abort();
|
|
@@ -28371,13 +28374,16 @@ var init_debounce = __esm(() => {
|
|
|
28371
28374
|
// ../core/src/automations/engine.ts
|
|
28372
28375
|
class AutomationEngine {
|
|
28373
28376
|
config;
|
|
28374
|
-
subscriptions =
|
|
28377
|
+
subscriptions = new Map;
|
|
28375
28378
|
instanceQueues = new Map;
|
|
28376
28379
|
debounceManagers = new Map;
|
|
28377
28380
|
automations = [];
|
|
28378
28381
|
eventBus = null;
|
|
28379
28382
|
deps;
|
|
28380
28383
|
logger = null;
|
|
28384
|
+
reconcileTimer = null;
|
|
28385
|
+
reconcileEnabled = false;
|
|
28386
|
+
reconcilePromise = null;
|
|
28381
28387
|
constructor(config2) {
|
|
28382
28388
|
this.config = config2;
|
|
28383
28389
|
this.deps = {
|
|
@@ -28394,33 +28400,17 @@ class AutomationEngine {
|
|
|
28394
28400
|
callAgent: deps.callAgent
|
|
28395
28401
|
};
|
|
28396
28402
|
this.automations = automations.filter((a) => a.enabled);
|
|
28397
|
-
|
|
28398
|
-
|
|
28399
|
-
|
|
28400
|
-
const subscription = await eventBus.subscribePattern(`${eventType}.>`, async (event) => {
|
|
28401
|
-
await this.handleEvent(event);
|
|
28402
|
-
}, {
|
|
28403
|
-
durable,
|
|
28404
|
-
queue: "automation-engine",
|
|
28405
|
-
startFrom: "new",
|
|
28406
|
-
maxRetries: 3,
|
|
28407
|
-
retryDelayMs: 1000
|
|
28408
|
-
});
|
|
28409
|
-
this.subscriptions.push(subscription);
|
|
28410
|
-
logger4.info(`Subscribed to ${eventType}.*`, { durable });
|
|
28411
|
-
}
|
|
28412
|
-
for (const automation of this.automations) {
|
|
28413
|
-
if (automation.debounce && automation.debounce.mode !== "none") {
|
|
28414
|
-
this.setupDebounceManager(automation);
|
|
28415
|
-
}
|
|
28416
|
-
}
|
|
28403
|
+
await this.reconcileSubscriptions();
|
|
28404
|
+
this.rebuildDebounceManagers();
|
|
28405
|
+
this.startReconcileTimer();
|
|
28417
28406
|
logger4.info(`Automation engine started with ${this.automations.length} automations`);
|
|
28418
28407
|
}
|
|
28419
28408
|
async stop() {
|
|
28420
|
-
|
|
28409
|
+
this.stopReconcileTimer();
|
|
28410
|
+
for (const subscription of this.subscriptions.values()) {
|
|
28421
28411
|
await subscription.unsubscribe();
|
|
28422
28412
|
}
|
|
28423
|
-
this.subscriptions
|
|
28413
|
+
this.subscriptions.clear();
|
|
28424
28414
|
for (const manager of this.debounceManagers.values()) {
|
|
28425
28415
|
manager.flushAll();
|
|
28426
28416
|
}
|
|
@@ -28431,9 +28421,117 @@ class AutomationEngine {
|
|
|
28431
28421
|
this.logger = logger5;
|
|
28432
28422
|
}
|
|
28433
28423
|
async reload(automations) {
|
|
28434
|
-
|
|
28435
|
-
|
|
28436
|
-
|
|
28424
|
+
if (!this.eventBus) {
|
|
28425
|
+
this.automations = automations.filter((a) => a.enabled);
|
|
28426
|
+
return;
|
|
28427
|
+
}
|
|
28428
|
+
this.automations = automations.filter((a) => a.enabled);
|
|
28429
|
+
await this.reconcileSubscriptions();
|
|
28430
|
+
this.rebuildDebounceManagers();
|
|
28431
|
+
}
|
|
28432
|
+
async reconcile() {
|
|
28433
|
+
if (!this.eventBus)
|
|
28434
|
+
return;
|
|
28435
|
+
await this.reconcileSubscriptions();
|
|
28436
|
+
}
|
|
28437
|
+
async reconcileSubscriptions() {
|
|
28438
|
+
if (!this.eventBus)
|
|
28439
|
+
return;
|
|
28440
|
+
if (this.reconcilePromise)
|
|
28441
|
+
return this.reconcilePromise;
|
|
28442
|
+
this.reconcilePromise = this.doReconcileSubscriptions().finally(() => {
|
|
28443
|
+
this.reconcilePromise = null;
|
|
28444
|
+
});
|
|
28445
|
+
return this.reconcilePromise;
|
|
28446
|
+
}
|
|
28447
|
+
async doReconcileSubscriptions() {
|
|
28448
|
+
if (!this.eventBus)
|
|
28449
|
+
return;
|
|
28450
|
+
const expectedTriggers = new Set(this.automations.map((a) => a.triggerEventType));
|
|
28451
|
+
for (const [eventType, subscription] of this.subscriptions) {
|
|
28452
|
+
if (!expectedTriggers.has(eventType)) {
|
|
28453
|
+
await subscription.unsubscribe().catch((err) => {
|
|
28454
|
+
logger4.warn("Failed to unsubscribe orphan trigger", { eventType, error: String(err) });
|
|
28455
|
+
});
|
|
28456
|
+
this.subscriptions.delete(eventType);
|
|
28457
|
+
logger4.info(`Unsubscribed from ${eventType}.* (no enabled automations)`);
|
|
28458
|
+
}
|
|
28459
|
+
}
|
|
28460
|
+
for (const eventType of expectedTriggers) {
|
|
28461
|
+
const existing = this.subscriptions.get(eventType);
|
|
28462
|
+
if (existing && this.isSubscriptionAlive(existing)) {
|
|
28463
|
+
continue;
|
|
28464
|
+
}
|
|
28465
|
+
if (existing) {
|
|
28466
|
+
await existing.unsubscribe().catch(() => {});
|
|
28467
|
+
this.subscriptions.delete(eventType);
|
|
28468
|
+
logger4.warn("Replacing dead subscription", { eventType });
|
|
28469
|
+
}
|
|
28470
|
+
const subscription = await this.subscribeForTrigger(eventType);
|
|
28471
|
+
this.subscriptions.set(eventType, subscription);
|
|
28472
|
+
}
|
|
28473
|
+
}
|
|
28474
|
+
async subscribeForTrigger(eventType) {
|
|
28475
|
+
if (!this.eventBus) {
|
|
28476
|
+
throw new Error("Event bus not initialized");
|
|
28477
|
+
}
|
|
28478
|
+
const durable = `automation-engine-${eventType.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
28479
|
+
const subscription = await this.eventBus.subscribePattern(`${eventType}.>`, async (event) => {
|
|
28480
|
+
await this.handleEvent(event);
|
|
28481
|
+
}, {
|
|
28482
|
+
durable,
|
|
28483
|
+
queue: "automation-engine",
|
|
28484
|
+
startFrom: "new",
|
|
28485
|
+
maxRetries: 3,
|
|
28486
|
+
retryDelayMs: 1000
|
|
28487
|
+
});
|
|
28488
|
+
logger4.info(`Subscribed to ${eventType}.*`, { durable });
|
|
28489
|
+
return subscription;
|
|
28490
|
+
}
|
|
28491
|
+
isSubscriptionAlive(subscription) {
|
|
28492
|
+
return subscription.isAlive ? subscription.isAlive() : true;
|
|
28493
|
+
}
|
|
28494
|
+
rebuildDebounceManagers() {
|
|
28495
|
+
const enabledIds = new Set(this.automations.map((a) => a.id));
|
|
28496
|
+
for (const id of this.debounceManagers.keys()) {
|
|
28497
|
+
if (!enabledIds.has(id)) {
|
|
28498
|
+
this.debounceManagers.get(id)?.flushAll();
|
|
28499
|
+
this.debounceManagers.delete(id);
|
|
28500
|
+
}
|
|
28501
|
+
}
|
|
28502
|
+
for (const automation of this.automations) {
|
|
28503
|
+
if (automation.debounce && automation.debounce.mode !== "none" && !this.debounceManagers.has(automation.id)) {
|
|
28504
|
+
this.setupDebounceManager(automation);
|
|
28505
|
+
}
|
|
28506
|
+
}
|
|
28507
|
+
}
|
|
28508
|
+
startReconcileTimer() {
|
|
28509
|
+
this.stopReconcileTimer();
|
|
28510
|
+
const intervalMs = this.config.reconcileIntervalMs ?? 30000;
|
|
28511
|
+
if (intervalMs <= 0)
|
|
28512
|
+
return;
|
|
28513
|
+
this.reconcileEnabled = true;
|
|
28514
|
+
this.scheduleNextReconcile(intervalMs);
|
|
28515
|
+
}
|
|
28516
|
+
scheduleNextReconcile(intervalMs) {
|
|
28517
|
+
if (!this.reconcileEnabled)
|
|
28518
|
+
return;
|
|
28519
|
+
this.reconcileTimer = setTimeout(() => {
|
|
28520
|
+
this.reconcileSubscriptions().catch((err) => {
|
|
28521
|
+
logger4.error("Reconciler tick failed", { error: String(err) });
|
|
28522
|
+
}).finally(() => {
|
|
28523
|
+
this.scheduleNextReconcile(intervalMs);
|
|
28524
|
+
});
|
|
28525
|
+
}, intervalMs);
|
|
28526
|
+
if (typeof this.reconcileTimer === "object" && this.reconcileTimer && "unref" in this.reconcileTimer) {
|
|
28527
|
+
this.reconcileTimer.unref();
|
|
28528
|
+
}
|
|
28529
|
+
}
|
|
28530
|
+
stopReconcileTimer() {
|
|
28531
|
+
this.reconcileEnabled = false;
|
|
28532
|
+
if (this.reconcileTimer) {
|
|
28533
|
+
clearTimeout(this.reconcileTimer);
|
|
28534
|
+
this.reconcileTimer = null;
|
|
28437
28535
|
}
|
|
28438
28536
|
}
|
|
28439
28537
|
async handleEvent(event) {
|
|
@@ -224556,7 +224654,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
224556
224654
|
var require_package8 = __commonJS((exports, module) => {
|
|
224557
224655
|
module.exports = {
|
|
224558
224656
|
name: "@omni/api",
|
|
224559
|
-
version: "2.
|
|
224657
|
+
version: "2.260501.1",
|
|
224560
224658
|
type: "module",
|
|
224561
224659
|
exports: {
|
|
224562
224660
|
".": {
|
|
@@ -233726,7 +233824,7 @@ var init_src5 = __esm(() => {
|
|
|
233726
233824
|
init_schema2();
|
|
233727
233825
|
});
|
|
233728
233826
|
|
|
233729
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
233827
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/postgres.js
|
|
233730
233828
|
import { EventEmitter as EventEmitter4 } from "events";
|
|
233731
233829
|
import os6 from "os";
|
|
233732
233830
|
import path2 from "path";
|
|
@@ -234699,7 +234797,7 @@ Output: ${startupOutput}`));
|
|
|
234699
234797
|
};
|
|
234700
234798
|
});
|
|
234701
234799
|
|
|
234702
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
234800
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/logger.js
|
|
234703
234801
|
function formatTime2() {
|
|
234704
234802
|
const now = new Date;
|
|
234705
234803
|
return `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}`;
|
|
@@ -234763,7 +234861,7 @@ var init_logger4 = __esm(() => {
|
|
|
234763
234861
|
LEVELS = { debug: 10, info: 20, warn: 30, error: 40 };
|
|
234764
234862
|
});
|
|
234765
234863
|
|
|
234766
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
234864
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/sync.js
|
|
234767
234865
|
var {SQL: SQL2 } = globalThis.Bun;
|
|
234768
234866
|
function matchesPattern2(dbName, patterns) {
|
|
234769
234867
|
if (!patterns || patterns.length === 0)
|
|
@@ -234980,7 +235078,7 @@ var init_sync = __esm(() => {
|
|
|
234980
235078
|
init_logger4();
|
|
234981
235079
|
});
|
|
234982
235080
|
|
|
234983
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
235081
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/pg-wire.js
|
|
234984
235082
|
import { createHash as createHash7 } from "crypto";
|
|
234985
235083
|
|
|
234986
235084
|
class PgWireClient {
|
|
@@ -235552,7 +235650,7 @@ var init_pg_wire = __esm(() => {
|
|
|
235552
235650
|
};
|
|
235553
235651
|
});
|
|
235554
235652
|
|
|
235555
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
235653
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/restore.js
|
|
235556
235654
|
function matchesPattern3(dbName, patterns) {
|
|
235557
235655
|
if (!patterns || patterns.length === 0)
|
|
235558
235656
|
return true;
|
|
@@ -235905,7 +236003,7 @@ var init_restore = __esm(() => {
|
|
|
235905
236003
|
init_logger4();
|
|
235906
236004
|
});
|
|
235907
236005
|
|
|
235908
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
236006
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/dashboard.js
|
|
235909
236007
|
import { readFileSync as readFileSync3 } from "fs";
|
|
235910
236008
|
import { join as join14, dirname as dirname5 } from "path";
|
|
235911
236009
|
import { fileURLToPath } from "url";
|
|
@@ -236049,7 +236147,7 @@ var init_dashboard = __esm(() => {
|
|
|
236049
236147
|
};
|
|
236050
236148
|
});
|
|
236051
236149
|
|
|
236052
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
236150
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/protocol.js
|
|
236053
236151
|
function parseStartupMessage(data, fastPath = true) {
|
|
236054
236152
|
const length = data.readInt32BE(0);
|
|
236055
236153
|
const version4 = data.readInt32BE(4);
|
|
@@ -236202,7 +236300,7 @@ function buildErrorResponse({ severity = "FATAL", sqlstate, message: message2 })
|
|
|
236202
236300
|
var PROTOCOL_VERSION_3 = 196608;
|
|
236203
236301
|
var init_protocol = () => {};
|
|
236204
236302
|
|
|
236205
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
236303
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/router.js
|
|
236206
236304
|
import fs10 from "fs";
|
|
236207
236305
|
import { EventEmitter as EventEmitter5 } from "events";
|
|
236208
236306
|
function flushPending(target, pending) {
|
|
@@ -236538,7 +236636,7 @@ var init_router = __esm(() => {
|
|
|
236538
236636
|
};
|
|
236539
236637
|
});
|
|
236540
236638
|
|
|
236541
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
236639
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/stats-collector.js
|
|
236542
236640
|
class StatsCollector {
|
|
236543
236641
|
constructor(options = {}) {
|
|
236544
236642
|
this.pgManager = options.pgManager;
|
|
@@ -236857,7 +236955,7 @@ class StatsCollector {
|
|
|
236857
236955
|
}
|
|
236858
236956
|
var CPU_SAMPLE_MIN_INTERVAL_MS = 100, PROC_DISKSTATS_MIN_FIELDS = 14;
|
|
236859
236957
|
|
|
236860
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
236958
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/stats-dashboard.js
|
|
236861
236959
|
class StatsDashboard {
|
|
236862
236960
|
constructor(options = {}) {
|
|
236863
236961
|
this.enabled = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
@@ -237121,7 +237219,7 @@ var init_stats_dashboard = __esm(() => {
|
|
|
237121
237219
|
};
|
|
237122
237220
|
});
|
|
237123
237221
|
|
|
237124
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237222
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/audit.js
|
|
237125
237223
|
import fs11 from "fs";
|
|
237126
237224
|
import os7 from "os";
|
|
237127
237225
|
import path3 from "path";
|
|
@@ -237217,7 +237315,7 @@ var init_audit = __esm(() => {
|
|
|
237217
237315
|
});
|
|
237218
237316
|
});
|
|
237219
237317
|
|
|
237220
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237318
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/fingerprint.js
|
|
237221
237319
|
import crypto6 from "crypto";
|
|
237222
237320
|
import { execFileSync } from "child_process";
|
|
237223
237321
|
import fs12 from "fs";
|
|
@@ -237496,7 +237594,7 @@ var init_fingerprint = __esm(() => {
|
|
|
237496
237594
|
init_audit();
|
|
237497
237595
|
});
|
|
237498
237596
|
|
|
237499
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237597
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/tokens.js
|
|
237500
237598
|
import crypto7 from "crypto";
|
|
237501
237599
|
function mintToken() {
|
|
237502
237600
|
const id = crypto7.randomBytes(TOKEN_ID_BYTES).toString("hex");
|
|
@@ -237550,7 +237648,7 @@ var init_tokens = __esm(() => {
|
|
|
237550
237648
|
FP_RE = /^[0-9a-f]{12}$/;
|
|
237551
237649
|
});
|
|
237552
237650
|
|
|
237553
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237651
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/control-db.js
|
|
237554
237652
|
function query(client, text3, params = [], opts = {}) {
|
|
237555
237653
|
if (client.supportsQueryOptions && opts && Object.keys(opts).length > 0) {
|
|
237556
237654
|
return client.query(text3, params, opts);
|
|
@@ -237687,7 +237785,7 @@ var init_control_db = __esm(() => {
|
|
|
237687
237785
|
init_tokens();
|
|
237688
237786
|
});
|
|
237689
237787
|
|
|
237690
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237788
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/admin-client.js
|
|
237691
237789
|
var {SQL: SQL3 } = globalThis.Bun;
|
|
237692
237790
|
import fs13 from "fs";
|
|
237693
237791
|
import path5 from "path";
|
|
@@ -237830,7 +237928,7 @@ function removeAdminDiscovery(controlSocketDir) {
|
|
|
237830
237928
|
}
|
|
237831
237929
|
var init_admin_client = () => {};
|
|
237832
237930
|
|
|
237833
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237931
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/tenancy.js
|
|
237834
237932
|
function sanitizeName(name) {
|
|
237835
237933
|
const raw = (typeof name === "string" ? name : "").toLowerCase();
|
|
237836
237934
|
const collapsed = raw.replace(/[^a-z0-9]+/g, "_");
|
|
@@ -237854,7 +237952,7 @@ function isFingerprintEnforcementDisabled(env2 = process.env) {
|
|
|
237854
237952
|
}
|
|
237855
237953
|
var KILL_SWITCH_ENV = "PGSERVE_DISABLE_FINGERPRINT_ENFORCEMENT", NAME_TRUNCATE = 30, MAX_DB_IDENT = 63;
|
|
237856
237954
|
|
|
237857
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237955
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/daemon-shared.js
|
|
237858
237956
|
function flushPending2(target, pending) {
|
|
237859
237957
|
const written = target.write(pending);
|
|
237860
237958
|
if (written === pending.byteLength)
|
|
@@ -237864,7 +237962,7 @@ function flushPending2(target, pending) {
|
|
|
237864
237962
|
return pending.subarray(written);
|
|
237865
237963
|
}
|
|
237866
237964
|
|
|
237867
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
237965
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/daemon-control.js
|
|
237868
237966
|
import fs14 from "fs";
|
|
237869
237967
|
function attachControlHandlers(PgserveDaemon) {
|
|
237870
237968
|
PgserveDaemon.prototype.handleSocketOpen = handleSocketOpen;
|
|
@@ -238199,7 +238297,7 @@ var init_daemon_control = __esm(() => {
|
|
|
238199
238297
|
MAX_STARTUP_BUFFER_SIZE2 = 1024 * 1024;
|
|
238200
238298
|
});
|
|
238201
238299
|
|
|
238202
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
238300
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/daemon-tcp.js
|
|
238203
238301
|
import fs15 from "fs";
|
|
238204
238302
|
function attachTcpHandlers(PgserveDaemon) {
|
|
238205
238303
|
PgserveDaemon.prototype.bindTcpListener = bindTcpListener;
|
|
@@ -238468,7 +238566,7 @@ var init_daemon_tcp = __esm(() => {
|
|
|
238468
238566
|
MAX_STARTUP_BUFFER_SIZE3 = 1024 * 1024;
|
|
238469
238567
|
});
|
|
238470
238568
|
|
|
238471
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
238569
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/gc.js
|
|
238472
238570
|
function defaultIsProcessAlive(pid) {
|
|
238473
238571
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
238474
238572
|
return false;
|
|
@@ -238684,7 +238782,7 @@ var init_gc = __esm(() => {
|
|
|
238684
238782
|
HOURLY_MS = 60 * 60 * 1000;
|
|
238685
238783
|
});
|
|
238686
238784
|
|
|
238687
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
238785
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/daemon.js
|
|
238688
238786
|
import fs16 from "fs";
|
|
238689
238787
|
import path6 from "path";
|
|
238690
238788
|
import { EventEmitter as EventEmitter6 } from "events";
|
|
@@ -239181,7 +239279,7 @@ var init_daemon = __esm(() => {
|
|
|
239181
239279
|
attachTcpHandlers(PgserveDaemon);
|
|
239182
239280
|
});
|
|
239183
239281
|
|
|
239184
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
239282
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/sdk.js
|
|
239185
239283
|
import { spawn as spawn4 } from "child_process";
|
|
239186
239284
|
import fs17 from "fs";
|
|
239187
239285
|
import path7 from "path";
|
|
@@ -239304,7 +239402,7 @@ var init_sdk4 = __esm(() => {
|
|
|
239304
239402
|
__dirname2 = path7.dirname(fileURLToPath2(import.meta.url));
|
|
239305
239403
|
});
|
|
239306
239404
|
|
|
239307
|
-
// ../../node_modules/.bun/pgserve@2.1.
|
|
239405
|
+
// ../../node_modules/.bun/pgserve@2.1.2/node_modules/pgserve/src/index.js
|
|
239308
239406
|
var exports_src2 = {};
|
|
239309
239407
|
__export(exports_src2, {
|
|
239310
239408
|
stopDaemon: () => stopDaemon,
|
|
@@ -283438,11 +283536,12 @@ class FollowUpLifecycleService {
|
|
|
283438
283536
|
if (lastInboundCustomerMessageAt) {
|
|
283439
283537
|
set.lastInboundCustomerMessageAt = lastInboundCustomerMessageAt;
|
|
283440
283538
|
}
|
|
283441
|
-
const
|
|
283539
|
+
const reasonGuard = TERMINAL_DISARM_REASONS.has(reason) ? or2(isNull2(chatFollowUpState.disarmReason), notInArray(chatFollowUpState.disarmReason, TERMINAL_OVERRIDE_PROTECTED)) : isNull2(chatFollowUpState.disarmReason);
|
|
283540
|
+
const result = await this.db.update(chatFollowUpState).set(set).where(and2(eq(chatFollowUpState.chatId, chatId), eq(chatFollowUpState.instanceId, instanceId), reasonGuard)).returning({ id: chatFollowUpState.id });
|
|
283442
283541
|
return { disarmed: result.length > 0 };
|
|
283443
283542
|
}
|
|
283444
283543
|
}
|
|
283445
|
-
var log85, TERMINAL_DISARM_REASONS;
|
|
283544
|
+
var log85, TERMINAL_DISARM_REASONS, TERMINAL_OVERRIDE_PROTECTED;
|
|
283446
283545
|
var init_follow_up_lifecycle = __esm(() => {
|
|
283447
283546
|
init_src();
|
|
283448
283547
|
init_src5();
|
|
@@ -283454,6 +283553,7 @@ var init_follow_up_lifecycle = __esm(() => {
|
|
|
283454
283553
|
"archived",
|
|
283455
283554
|
"window_expired"
|
|
283456
283555
|
]);
|
|
283556
|
+
TERMINAL_OVERRIDE_PROTECTED = [...TERMINAL_DISARM_REASONS, "contact_closed"];
|
|
283457
283557
|
});
|
|
283458
283558
|
|
|
283459
283559
|
// ../api/src/services/follow-up-sweeper.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automagik/omni",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.260501.1",
|
|
4
4
|
"description": "LLM-optimized CLI for Omni",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
"qrcode-terminal": "^0.12.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@omni/api": "2.260430.
|
|
55
|
-
"@omni/channel-discord": "2.260430.
|
|
56
|
-
"@omni/channel-gupshup": "2.260430.
|
|
57
|
-
"@omni/channel-sdk": "2.260430.
|
|
58
|
-
"@omni/channel-slack": "2.260430.
|
|
59
|
-
"@omni/channel-telegram": "2.260430.
|
|
60
|
-
"@omni/channel-whatsapp": "2.260430.
|
|
61
|
-
"@omni/core": "2.260430.
|
|
62
|
-
"@omni/sdk": "2.260430.
|
|
54
|
+
"@omni/api": "2.260430.16",
|
|
55
|
+
"@omni/channel-discord": "2.260430.16",
|
|
56
|
+
"@omni/channel-gupshup": "2.260430.16",
|
|
57
|
+
"@omni/channel-sdk": "2.260430.16",
|
|
58
|
+
"@omni/channel-slack": "2.260430.16",
|
|
59
|
+
"@omni/channel-telegram": "2.260430.16",
|
|
60
|
+
"@omni/channel-whatsapp": "2.260430.16",
|
|
61
|
+
"@omni/core": "2.260430.16",
|
|
62
|
+
"@omni/sdk": "2.260430.16",
|
|
63
63
|
"@types/node": "^22.10.3",
|
|
64
64
|
"@types/qrcode-terminal": "^0.12.2",
|
|
65
65
|
"typescript": "^5.7.3"
|