@automagik/omni 2.260617.1 → 2.260617.2

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
@@ -124971,7 +124971,7 @@ import { fileURLToPath } from "url";
124971
124971
  // package.json
124972
124972
  var package_default = {
124973
124973
  name: "@automagik/omni",
124974
- version: "2.260617.1",
124974
+ version: "2.260617.2",
124975
124975
  description: "LLM-optimized CLI for Omni",
124976
124976
  type: "module",
124977
124977
  bin: {
@@ -225245,7 +225245,7 @@ var init_sentry_scrub = __esm(() => {
225245
225245
  var require_package7 = __commonJS((exports, module) => {
225246
225246
  module.exports = {
225247
225247
  name: "@omni/api",
225248
- version: "2.260617.1",
225248
+ version: "2.260617.2",
225249
225249
  type: "module",
225250
225250
  exports: {
225251
225251
  ".": {
@@ -285014,18 +285014,23 @@ function readBodyTargets(body) {
285014
285014
  chatId: str(b3.chatId)
285015
285015
  };
285016
285016
  }
285017
- function extractLockTargets(method, rawPath, body) {
285017
+ function readHeaderTargets(c) {
285018
+ const norm = (v2) => v2 && v2.length > 0 ? v2 : null;
285019
+ return {
285020
+ instance: norm(c.req.header("x-omni-instance")),
285021
+ chat: norm(c.req.header("x-omni-chat"))
285022
+ };
285023
+ }
285024
+ function extractLockTargets(method, rawPath, body, headers) {
285018
285025
  const cleanPath2 = normalizePath2(rawPath);
285019
285026
  const { instanceId, to, chatId } = readBodyTargets(body);
285020
- let instance4 = instanceId;
285021
- let chat = chatId;
285022
- let recipient = null;
285023
285027
  const pathInstance = PATH_INSTANCE_PREFIXES.map((p2) => firstPathSegment(cleanPath2, p2)).find((v2) => v2 != null) ?? null;
285024
285028
  const pathChat = PATH_CHAT_PREFIXES.map((p2) => firstPathSegment(cleanPath2, p2)).find((v2) => v2 != null) ?? null;
285025
- if (!instance4 && pathInstance)
285026
- instance4 = pathInstance;
285027
- if (!chat && pathChat)
285028
- chat = pathChat;
285029
+ const headerInstance = headers?.instance && headers.instance.length > 0 ? headers.instance : null;
285030
+ const headerChat = headers?.chat && headers.chat.length > 0 ? headers.chat : null;
285031
+ const instance4 = pathInstance ?? headerInstance ?? instanceId;
285032
+ let chat = pathChat ?? headerChat ?? chatId;
285033
+ let recipient = null;
285029
285034
  if (isOutboundSendRoute(cleanPath2)) {
285030
285035
  recipient = to;
285031
285036
  if (!chat)
@@ -285135,7 +285140,7 @@ var init_scope_enforcer = __esm(() => {
285135
285140
  }
285136
285141
  }
285137
285142
  const body = await safeReadJsonBody(c);
285138
- const targets = extractLockTargets(method, path2, body);
285143
+ const targets = extractLockTargets(method, path2, body, readHeaderTargets(c));
285139
285144
  const instanceResult = enforceInstanceAllowlist(apiKey, targets.instance);
285140
285145
  if (!instanceResult.allowed) {
285141
285146
  log59.warn(`DENIED: key=${apiKey.id} route=${method} ${path2} lock=instanceAllowlist attempted=${instanceResult.attempted}`);
@@ -285194,7 +285199,7 @@ var init_require_signed_instance = __esm(() => {
285194
285199
  const method = c.req.method.toUpperCase();
285195
285200
  const path2 = c.req.path;
285196
285201
  const body = await safeReadJsonBody2(c);
285197
- const targets = extractLockTargets(method, path2, body);
285202
+ const targets = extractLockTargets(method, path2, body, readHeaderTargets(c));
285198
285203
  if (!targets.instance) {
285199
285204
  return next();
285200
285205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260617.1",
3
+ "version": "2.260617.2",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {