@automagik/omni 2.261008.1 → 2.261015.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/index.js +2 -2
- package/dist/server/index.js +43 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -115986,7 +115986,7 @@ var require_client2 = __commonJS((exports) => {
|
|
|
115986
115986
|
|
|
115987
115987
|
// ../../node_modules/.bun/@sentry+node-core@10.52.0+2c50d7e904f6cfd7/node_modules/@sentry/node-core/build/cjs/sdk/esmLoader.js
|
|
115988
115988
|
var require_esmLoader = __commonJS((exports) => {
|
|
115989
|
-
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";
|
|
115989
|
+
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";
|
|
115990
115990
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
115991
115991
|
var core = require_cjs();
|
|
115992
115992
|
var importInTheMiddle = require_import_in_the_middle();
|
|
@@ -137462,7 +137462,7 @@ import { fileURLToPath } from "url";
|
|
|
137462
137462
|
// package.json
|
|
137463
137463
|
var package_default = {
|
|
137464
137464
|
name: "@automagik/omni",
|
|
137465
|
-
version: "2.
|
|
137465
|
+
version: "2.261015.1",
|
|
137466
137466
|
repository: {
|
|
137467
137467
|
type: "git",
|
|
137468
137468
|
url: "git+https://github.com/automagik-dev/omni.git",
|
package/dist/server/index.js
CHANGED
|
@@ -77157,7 +77157,7 @@ var require_ClientVoiceManager = __commonJS((exports, module) => {
|
|
|
77157
77157
|
|
|
77158
77158
|
// ../../node_modules/.bun/@discordjs+ws@1.2.3/node_modules/@discordjs/ws/dist/index.js
|
|
77159
77159
|
var require_dist9 = __commonJS((exports, module) => {
|
|
77160
|
-
var __dirname = "/home/runner/work/omni/omni/node_modules/.bun/@discordjs+ws@1.2.3/node_modules/@discordjs/ws/dist";
|
|
77160
|
+
var __dirname = "/home/runner/work/omni/omni/.stable-source/node_modules/.bun/@discordjs+ws@1.2.3/node_modules/@discordjs/ws/dist";
|
|
77161
77161
|
var __create2 = Object.create;
|
|
77162
77162
|
var __defProp2 = Object.defineProperty;
|
|
77163
77163
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -176984,7 +176984,7 @@ var require_indexes = __commonJS((exports, module) => {
|
|
|
176984
176984
|
|
|
176985
176985
|
// ../../node_modules/.bun/thread-stream@3.1.0/node_modules/thread-stream/index.js
|
|
176986
176986
|
var require_thread_stream = __commonJS((exports, module) => {
|
|
176987
|
-
var __dirname = "/home/runner/work/omni/omni/node_modules/.bun/thread-stream@3.1.0/node_modules/thread-stream";
|
|
176987
|
+
var __dirname = "/home/runner/work/omni/omni/.stable-source/node_modules/.bun/thread-stream@3.1.0/node_modules/thread-stream";
|
|
176988
176988
|
var { version } = require_package5();
|
|
176989
176989
|
var { EventEmitter: EventEmitter3 } = __require("events");
|
|
176990
176990
|
var { Worker } = __require("worker_threads");
|
|
@@ -177405,7 +177405,7 @@ var require_thread_stream = __commonJS((exports, module) => {
|
|
|
177405
177405
|
|
|
177406
177406
|
// ../../node_modules/.bun/pino@9.14.0/node_modules/pino/lib/transport.js
|
|
177407
177407
|
var require_transport2 = __commonJS((exports, module) => {
|
|
177408
|
-
var __dirname = "/home/runner/work/omni/omni/node_modules/.bun/pino@9.14.0/node_modules/pino/lib";
|
|
177408
|
+
var __dirname = "/home/runner/work/omni/omni/.stable-source/node_modules/.bun/pino@9.14.0/node_modules/pino/lib";
|
|
177409
177409
|
var { createRequire: createRequire2 } = __require("module");
|
|
177410
177410
|
var getCallers = require_caller();
|
|
177411
177411
|
var { join: join8, isAbsolute, sep: sep2 } = __require("path");
|
|
@@ -259218,7 +259218,7 @@ var require_client3 = __commonJS((exports) => {
|
|
|
259218
259218
|
|
|
259219
259219
|
// ../../node_modules/.bun/@sentry+node-core@10.52.0+2c50d7e904f6cfd7/node_modules/@sentry/node-core/build/cjs/sdk/esmLoader.js
|
|
259220
259220
|
var require_esmLoader = __commonJS((exports) => {
|
|
259221
|
-
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";
|
|
259221
|
+
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";
|
|
259222
259222
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
259223
259223
|
var core3 = require_cjs6();
|
|
259224
259224
|
var importInTheMiddle = require_import_in_the_middle();
|
|
@@ -266444,7 +266444,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
266444
266444
|
var require_package7 = __commonJS((exports, module) => {
|
|
266445
266445
|
module.exports = {
|
|
266446
266446
|
name: "@omni/api",
|
|
266447
|
-
version: "2.
|
|
266447
|
+
version: "2.261015.1",
|
|
266448
266448
|
private: true,
|
|
266449
266449
|
type: "module",
|
|
266450
266450
|
exports: {
|
|
@@ -293548,7 +293548,7 @@ var require_src45 = __commonJS((exports) => {
|
|
|
293548
293548
|
|
|
293549
293549
|
// ../../node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src/channelz.js
|
|
293550
293550
|
var require_channelz = __commonJS((exports) => {
|
|
293551
|
-
var __dirname = "/home/runner/work/omni/omni/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";
|
|
293551
|
+
var __dirname = "/home/runner/work/omni/omni/.stable-source/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";
|
|
293552
293552
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
293553
293553
|
exports.registerChannelzSocket = exports.registerChannelzServer = exports.registerChannelzSubchannel = exports.registerChannelzChannel = exports.ChannelzCallTrackerStub = exports.ChannelzCallTracker = exports.ChannelzChildrenTrackerStub = exports.ChannelzChildrenTracker = exports.ChannelzTrace = exports.ChannelzTraceStub = undefined;
|
|
293554
293554
|
exports.unregisterChannelzRef = unregisterChannelzRef;
|
|
@@ -298951,7 +298951,7 @@ var require_duration = __commonJS((exports) => {
|
|
|
298951
298951
|
|
|
298952
298952
|
// ../../node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src/orca.js
|
|
298953
298953
|
var require_orca = __commonJS((exports) => {
|
|
298954
|
-
var __dirname = "/home/runner/work/omni/omni/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";
|
|
298954
|
+
var __dirname = "/home/runner/work/omni/omni/.stable-source/node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src";
|
|
298955
298955
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
298956
298956
|
exports.OrcaOobMetricsSubchannelWrapper = exports.GRPC_METRICS_HEADER = exports.ServerMetricRecorder = exports.PerRequestMetricRecorder = undefined;
|
|
298957
298957
|
exports.createOrcaClient = createOrcaClient;
|
|
@@ -421658,6 +421658,7 @@ var DEFAULT_ASC_FLOW_BASE_URL = "https://sac-notredame.ascbrazil.com.br";
|
|
|
421658
421658
|
var REST_PREFIX = "/rest/v2";
|
|
421659
421659
|
var TURN_PENDING = { pronto: 0 };
|
|
421660
421660
|
var IN_FLIGHT_TTL_MS = 150000;
|
|
421661
|
+
var HANDOFF_PARKED_TTL_MS = 30 * 60000;
|
|
421661
421662
|
var UNDELIVERABLE_ERROR = "no ASC flow turn is polling this cod_atendimento \u2014 a text-only send cannot be delivered";
|
|
421662
421663
|
var HANDOFF_REFUSED_ERROR = "handoff refused: the transfer never held, so the turn answers without it";
|
|
421663
421664
|
var IN_FLIGHT_SWEEP_MS = 60000;
|
|
@@ -421958,6 +421959,10 @@ class AscFlowPlugin extends BaseChannelPlugin {
|
|
|
421958
421959
|
const cod = chatId.trim();
|
|
421959
421960
|
const entry = state.inFlight.get(cod);
|
|
421960
421961
|
if (entry?.correlationId && correlationId && entry.correlationId !== correlationId) {
|
|
421962
|
+
if (ready.hand_off === "sim") {
|
|
421963
|
+
this.carryLateHandoff(state, cod, entry, ready, "correlationId of a closed turn");
|
|
421964
|
+
return;
|
|
421965
|
+
}
|
|
421961
421966
|
this.logger.warn("[asc-flow] discarding an answer from a different turn", {
|
|
421962
421967
|
cod,
|
|
421963
421968
|
reason: "correlationId does not match the turn now in flight"
|
|
@@ -421965,6 +421970,10 @@ class AscFlowPlugin extends BaseChannelPlugin {
|
|
|
421965
421970
|
return;
|
|
421966
421971
|
}
|
|
421967
421972
|
if (entry && answering && entry !== answering) {
|
|
421973
|
+
if (ready.hand_off === "sim") {
|
|
421974
|
+
this.carryLateHandoff(state, cod, entry, ready, "the window now holds a newer turn");
|
|
421975
|
+
return;
|
|
421976
|
+
}
|
|
421968
421977
|
this.logger.warn("[asc-flow] discarding an answer whose turn already closed", {
|
|
421969
421978
|
cod,
|
|
421970
421979
|
reason: "the window now holds a newer turn \u2014 delivering this would answer the wrong message"
|
|
@@ -421987,6 +421996,18 @@ class AscFlowPlugin extends BaseChannelPlugin {
|
|
|
421987
421996
|
}
|
|
421988
421997
|
state.inFlight.set(cod, { text: "", at: Date.now(), ready });
|
|
421989
421998
|
}
|
|
421999
|
+
carryLateHandoff(state, cod, entry, ready, reason) {
|
|
422000
|
+
if (entry.ready?.hand_off === "sim") {
|
|
422001
|
+
this.logger.debug("[asc-flow] keeping the newer parked handoff over a late one", { cod, reason });
|
|
422002
|
+
return;
|
|
422003
|
+
}
|
|
422004
|
+
if (entry.ready) {
|
|
422005
|
+
this.pushDisplacedBubble(state, cod, entry.ready.resposta);
|
|
422006
|
+
}
|
|
422007
|
+
entry.ready = ready;
|
|
422008
|
+
entry.at = Date.now();
|
|
422009
|
+
this.logger.warn("[asc-flow] carrying a late handoff into the turn now in flight", { cod, reason });
|
|
422010
|
+
}
|
|
421990
422011
|
pushDisplacedBubble(state, cod, text) {
|
|
421991
422012
|
if (!text.trim())
|
|
421992
422013
|
return;
|
|
@@ -422212,7 +422233,7 @@ class AscFlowPlugin extends BaseChannelPlugin {
|
|
|
422212
422233
|
state.lastSweepAt = now;
|
|
422213
422234
|
let expired = 0;
|
|
422214
422235
|
for (const [cod, entry] of state.inFlight) {
|
|
422215
|
-
if (now - entry.at > IN_FLIGHT_TTL_MS) {
|
|
422236
|
+
if (now - entry.at > (entry.ready?.hand_off === "sim" ? HANDOFF_PARKED_TTL_MS : IN_FLIGHT_TTL_MS)) {
|
|
422216
422237
|
state.inFlight.delete(cod);
|
|
422217
422238
|
expired++;
|
|
422218
422239
|
}
|
|
@@ -422239,6 +422260,16 @@ class AscFlowPlugin extends BaseChannelPlugin {
|
|
|
422239
422260
|
const entry = state?.inFlight.get(codAtendimento);
|
|
422240
422261
|
if (!state || !entry)
|
|
422241
422262
|
return null;
|
|
422263
|
+
if (entry.ready?.hand_off === "sim" && entry.text !== text) {
|
|
422264
|
+
state.inFlight.delete(codAtendimento);
|
|
422265
|
+
this.rememberAnswered(state, codAtendimento, text);
|
|
422266
|
+
this.logger.warn("[asc-flow] delivering a parked handoff on a newer input", {
|
|
422267
|
+
instanceId,
|
|
422268
|
+
codAtendimento,
|
|
422269
|
+
ageMs: Date.now() - entry.at
|
|
422270
|
+
});
|
|
422271
|
+
return entry.ready;
|
|
422272
|
+
}
|
|
422242
422273
|
if (entry.text !== text)
|
|
422243
422274
|
return null;
|
|
422244
422275
|
const ageMs = Date.now() - entry.at;
|
|
@@ -422262,13 +422293,16 @@ class AscFlowPlugin extends BaseChannelPlugin {
|
|
|
422262
422293
|
ageMs
|
|
422263
422294
|
});
|
|
422264
422295
|
}
|
|
422296
|
+
this.rememberAnswered(state, codAtendimento, text);
|
|
422297
|
+
return entry.ready;
|
|
422298
|
+
}
|
|
422299
|
+
rememberAnswered(state, codAtendimento, text) {
|
|
422265
422300
|
if (state.lastAnswered.size >= IN_FLIGHT_MAX_ENTRIES) {
|
|
422266
422301
|
const oldest = state.lastAnswered.keys().next().value;
|
|
422267
422302
|
if (oldest !== undefined)
|
|
422268
422303
|
state.lastAnswered.delete(oldest);
|
|
422269
422304
|
}
|
|
422270
422305
|
state.lastAnswered.set(codAtendimento, text.trim());
|
|
422271
|
-
return entry.ready;
|
|
422272
422306
|
}
|
|
422273
422307
|
async isStaleFlowReplay(instanceId, turn) {
|
|
422274
422308
|
const state = this.ascFlowInstances.get(instanceId);
|