@automagik/omni 2.260423.7 → 2.260423.8

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
@@ -113929,7 +113929,7 @@ import { fileURLToPath } from "url";
113929
113929
  // package.json
113930
113930
  var package_default = {
113931
113931
  name: "@automagik/omni",
113932
- version: "2.260423.7",
113932
+ version: "2.260423.8",
113933
113933
  description: "LLM-optimized CLI for Omni",
113934
113934
  type: "module",
113935
113935
  bin: {
@@ -224550,7 +224550,7 @@ var init_sentry_scrub = __esm(() => {
224550
224550
  var require_package8 = __commonJS((exports, module) => {
224551
224551
  module.exports = {
224552
224552
  name: "@omni/api",
224553
- version: "2.260423.7",
224553
+ version: "2.260423.8",
224554
224554
  type: "module",
224555
224555
  exports: {
224556
224556
  ".": {
@@ -305387,6 +305387,24 @@ function setupShutdownHandlers(server, earlyShutdown) {
305387
305387
  process.on("SIGINT", shutdown);
305388
305388
  process.on("SIGTERM", shutdown);
305389
305389
  }
305390
+ async function resolveCallAgentChatIds(services, ctx) {
305391
+ if (!UUID_RE3.test(ctx.chatId)) {
305392
+ return { chatId: ctx.chatId, senderId: ctx.senderId };
305393
+ }
305394
+ try {
305395
+ const chat2 = await services.chats.getById(ctx.chatId, { includeHidden: true });
305396
+ return {
305397
+ chatId: chat2.externalId,
305398
+ senderId: ctx.senderId === ctx.chatId ? chat2.externalId : ctx.senderId
305399
+ };
305400
+ } catch {
305401
+ log112.warn("call_agent: chat UUID not resolvable, using raw value (session may diverge)", {
305402
+ chatId: ctx.chatId,
305403
+ instanceId: ctx.instanceId
305404
+ });
305405
+ return { chatId: ctx.chatId, senderId: ctx.senderId };
305406
+ }
305407
+ }
305390
305408
  async function setupEventBusServices(eventBus, services, db3) {
305391
305409
  if (!eventBus) {
305392
305410
  log112.warn("Skipping event bus services (no event bus)");
@@ -305431,6 +305449,7 @@ async function setupEventBusServices(eventBus, services, db3) {
305431
305449
  const instance4 = await services.instances.getById(ctx.instanceId);
305432
305450
  if (!instance4)
305433
305451
  throw new Error(`Instance not found: ${ctx.instanceId}`);
305452
+ const { chatId: resolvedChatId, senderId: resolvedSenderId } = await resolveCallAgentChatIds(services, ctx);
305434
305453
  const agentFkId = ctx.agentId ?? instance4.agentId;
305435
305454
  if (!agentFkId)
305436
305455
  throw new Error(`No agent configured for instance ${instance4.id}`);
@@ -305461,8 +305480,8 @@ async function setupEventBusServices(eventBus, services, db3) {
305461
305480
  };
305462
305481
  const result = await services.agentRunner.runOrStream({
305463
305482
  instance: runInstance,
305464
- chatId: ctx.chatId,
305465
- senderId: ctx.senderId,
305483
+ chatId: resolvedChatId,
305484
+ senderId: resolvedSenderId,
305466
305485
  senderName: ctx.senderName,
305467
305486
  chatType: "dm",
305468
305487
  messages: ctx.messages
@@ -305654,7 +305673,7 @@ async function main() {
305654
305673
  });
305655
305674
  setupShutdownHandlers(server, earlyShutdown);
305656
305675
  }
305657
- var import__package3, log112, natsLog, pluginLog, shutdownLog, PORT, HOST, NATS_URL, voiceStreamRegistry, globalEventBus = null, globalChannelRegistry = null, globalInstanceMonitor = null, globalDispatcherCleanup = null, globalTurnMonitor = null, globalDbRef = null;
305676
+ var import__package3, log112, natsLog, pluginLog, shutdownLog, PORT, HOST, NATS_URL, voiceStreamRegistry, globalEventBus = null, globalChannelRegistry = null, globalInstanceMonitor = null, globalDispatcherCleanup = null, globalTurnMonitor = null, globalDbRef = null, UUID_RE3;
305658
305677
  var init_src8 = __esm(() => {
305659
305678
  init_instrument2();
305660
305679
  init_src2();
@@ -305687,6 +305706,7 @@ var init_src8 = __esm(() => {
305687
305706
  HOST = process.env.API_HOST ?? "0.0.0.0";
305688
305707
  NATS_URL = process.env.NATS_URL ?? "nats://localhost:4222";
305689
305708
  voiceStreamRegistry = new VoiceStreamRegistry;
305709
+ UUID_RE3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
305690
305710
  main().catch((error2) => {
305691
305711
  log112.error("Failed to start API server", { error: String(error2) });
305692
305712
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260423.7",
3
+ "version": "2.260423.8",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,15 +39,15 @@
39
39
  "qrcode-terminal": "^0.12.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@omni/api": "2.260423.6",
43
- "@omni/channel-discord": "2.260423.6",
44
- "@omni/channel-gupshup": "2.260423.6",
45
- "@omni/channel-sdk": "2.260423.6",
46
- "@omni/channel-slack": "2.260423.6",
47
- "@omni/channel-telegram": "2.260423.6",
48
- "@omni/channel-whatsapp": "2.260423.6",
49
- "@omni/core": "2.260423.6",
50
- "@omni/sdk": "2.260423.6",
42
+ "@omni/api": "2.260423.7",
43
+ "@omni/channel-discord": "2.260423.7",
44
+ "@omni/channel-gupshup": "2.260423.7",
45
+ "@omni/channel-sdk": "2.260423.7",
46
+ "@omni/channel-slack": "2.260423.7",
47
+ "@omni/channel-telegram": "2.260423.7",
48
+ "@omni/channel-whatsapp": "2.260423.7",
49
+ "@omni/core": "2.260423.7",
50
+ "@omni/sdk": "2.260423.7",
51
51
  "@types/node": "^22.10.3",
52
52
  "@types/qrcode-terminal": "^0.12.2",
53
53
  "typescript": "^5.7.3"