@automagik/omni 2.260717.4 → 2.260717.5

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
@@ -125164,7 +125164,7 @@ import { fileURLToPath } from "url";
125164
125164
  // package.json
125165
125165
  var package_default = {
125166
125166
  name: "@automagik/omni",
125167
- version: "2.260717.4",
125167
+ version: "2.260717.5",
125168
125168
  description: "LLM-optimized CLI for Omni",
125169
125169
  type: "module",
125170
125170
  bin: {
@@ -225883,7 +225883,7 @@ var init_sentry_scrub = __esm(() => {
225883
225883
  var require_package7 = __commonJS((exports, module) => {
225884
225884
  module.exports = {
225885
225885
  name: "@omni/api",
225886
- version: "2.260717.4",
225886
+ version: "2.260717.5",
225887
225887
  type: "module",
225888
225888
  exports: {
225889
225889
  ".": {
@@ -356823,6 +356823,20 @@ function enforceScopeCeiling(c, requestedScopes) {
356823
356823
  }
356824
356824
  }, 403);
356825
356825
  }
356826
+ function enforceInstanceCeiling(c, requestedInstanceIds) {
356827
+ const apiKey = c.get("apiKey");
356828
+ if (apiKey?.instanceIds === null)
356829
+ return null;
356830
+ const exceedsCaller = !apiKey || !Array.isArray(apiKey.instanceIds) || requestedInstanceIds === null || requestedInstanceIds.some((instanceId) => !apiKey.instanceIds?.includes(instanceId));
356831
+ if (!exceedsCaller)
356832
+ return null;
356833
+ return c.json({
356834
+ error: {
356835
+ code: "FORBIDDEN",
356836
+ message: "Cannot grant instance access that exceeds the caller's own."
356837
+ }
356838
+ }, 403);
356839
+ }
356826
356840
  async function handleProfileCreate(c, data, services) {
356827
356841
  try {
356828
356842
  const resolved = resolveProfile({
@@ -356837,6 +356851,9 @@ async function handleProfileCreate(c, data, services) {
356837
356851
  const ceilingDenied = enforceScopeCeiling(c, resolved.scopes);
356838
356852
  if (ceilingDenied)
356839
356853
  return ceilingDenied;
356854
+ const instanceCeilingDenied = enforceInstanceCeiling(c, data.instanceIds ?? null);
356855
+ if (instanceCeilingDenied)
356856
+ return instanceCeilingDenied;
356840
356857
  const result = await services.apiKeys.create({
356841
356858
  name: data.name,
356842
356859
  description: data.description,
@@ -356872,6 +356889,9 @@ async function handleLegacyCreate(c, data, services) {
356872
356889
  const ceilingDenied = enforceScopeCeiling(c, data.scopes);
356873
356890
  if (ceilingDenied)
356874
356891
  return ceilingDenied;
356892
+ const instanceCeilingDenied = enforceInstanceCeiling(c, data.instanceIds ?? null);
356893
+ if (instanceCeilingDenied)
356894
+ return instanceCeilingDenied;
356875
356895
  const result = await services.apiKeys.create({
356876
356896
  name: data.name,
356877
356897
  description: data.description,
@@ -356998,6 +357018,11 @@ var init_keys = __esm(() => {
356998
357018
  if (ceilingDenied)
356999
357019
  return ceilingDenied;
357000
357020
  }
357021
+ if (data.instanceIds !== undefined) {
357022
+ const instanceCeilingDenied = enforceInstanceCeiling(c, data.instanceIds);
357023
+ if (instanceCeilingDenied)
357024
+ return instanceCeilingDenied;
357025
+ }
357001
357026
  try {
357002
357027
  const updated = await services.apiKeys.update(id, {
357003
357028
  ...data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260717.4",
3
+ "version": "2.260717.5",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {