@inf-monkeys-tech/monkeys 1.1.7 → 1.1.9

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/lib/esm/index.mjs CHANGED
@@ -22263,13 +22263,17 @@ var requireDependencies = (snapshot, required) => {
22263
22263
  }
22264
22264
  }
22265
22265
  };
22266
- var assertDependencyScopes = (snapshot, scope) => snapshot.forEach(
22267
- (dependency, index) => assertTenantCompatible(
22268
- dependency.revisionRef,
22266
+ var assertDependencyScopes = (snapshot, scope, allowedForeignReferences = /* @__PURE__ */ new Set()) => snapshot.forEach((dependency, index) => {
22267
+ const reference = dependency.revisionRef;
22268
+ const foreign = reference.visibility === "tenant" && scopeKey(reference.tenantScope) !== scopeKey(scope);
22269
+ if (foreign && allowedForeignReferences.has(revisionRefKey(reference)))
22270
+ return;
22271
+ assertTenantCompatible(
22272
+ reference,
22269
22273
  scope,
22270
22274
  `dependencySnapshot[${index}].revisionRef`
22271
- )
22272
- );
22275
+ );
22276
+ });
22273
22277
  var requireReleaseReady = (release) => {
22274
22278
  if (release.operation === "deactivate") {
22275
22279
  throw new DeclarativeControlCompilationError(
@@ -24289,6 +24293,27 @@ var compileNavigationRuntimeBundle = (input) => {
24289
24293
  input.compilerRevisionRef
24290
24294
  );
24291
24295
  const scope = TenantScopeSchema.parse(navigation.tenantScope);
24296
+ const verifiedKernelPageReferences = [...input.verifiedKernelPageReferences ?? []].map((reference, index) => {
24297
+ const parsed = RevisionRefSchema.parse(reference);
24298
+ if (release.target.surface !== "kernel" || parsed.visibility !== "tenant" || !parsed.tenantScope?.teamRef?.id.startsWith("kernel-page.") || parsed.ownerRepo !== "monkeys-server" || !["page", "page-release"].includes(parsed.kind)) {
24299
+ throw new DeclarativeControlCompilationError(
24300
+ "CROSS_TENANT_REFERENCE",
24301
+ `verifiedKernelPageReferences[${index}]`,
24302
+ "Verified Kernel Page references must be exact tenant-scoped Page and PageRelease revisions from the Kernel page catalog."
24303
+ );
24304
+ }
24305
+ if (scopeKey(parsed.tenantScope) === scopeKey(scope)) {
24306
+ throw new DeclarativeControlCompilationError(
24307
+ "CROSS_TENANT_REFERENCE",
24308
+ `verifiedKernelPageReferences[${index}]`,
24309
+ "Verified Kernel Page references must belong to a different tenant scope."
24310
+ );
24311
+ }
24312
+ return parsed;
24313
+ });
24314
+ const verifiedKernelPageReferenceKeys = new Set(
24315
+ verifiedKernelPageReferences.map(revisionRefKey)
24316
+ );
24292
24317
  assertSameTenantScope(release.tenantScope, scope, "release.tenantScope");
24293
24318
  if (navigation.nodes.length > input.limits.maxNavigationNodes)
24294
24319
  throw new DeclarativeControlCompilationError(
@@ -24343,7 +24368,11 @@ var compileNavigationRuntimeBundle = (input) => {
24343
24368
  release.dependencySnapshot,
24344
24369
  navigationDependencies(navigation, release, compilerRevisionRef)
24345
24370
  );
24346
- assertDependencyScopes(release.dependencySnapshot, scope);
24371
+ assertDependencyScopes(
24372
+ release.dependencySnapshot,
24373
+ scope,
24374
+ verifiedKernelPageReferenceKeys
24375
+ );
24347
24376
  const targetRegistry = input.targetRegistry.map((registration, index) => {
24348
24377
  const common = {
24349
24378
  stableTargetRef: StableRefSchema.parse(registration.stableTargetRef),
@@ -24529,11 +24558,32 @@ var compileNavigationRuntimeBundle = (input) => {
24529
24558
  "Navigation target is active on another surface."
24530
24559
  );
24531
24560
  }
24532
- assertTenantCompatible(
24533
- registration.targetRevisionRef,
24534
- scope,
24535
- `nodes[${index}].targetRef`
24536
- );
24561
+ const targetIsForeignTenant = registration.targetRevisionRef.visibility === "tenant" && scopeKey(registration.targetRevisionRef.tenantScope) !== scopeKey(scope);
24562
+ if (targetIsForeignTenant) {
24563
+ const releaseReference = registration.kind === "route" ? registration.releaseRevisionRef : void 0;
24564
+ if (release.target.surface !== "kernel" || registration.kind !== "route" || registration.targetRevisionRef.kind !== "page" || !releaseReference || !verifiedKernelPageReferenceKeys.has(
24565
+ revisionRefKey(registration.targetRevisionRef)
24566
+ ) || !verifiedKernelPageReferenceKeys.has(revisionRefKey(releaseReference))) {
24567
+ throw new DeclarativeControlCompilationError(
24568
+ "CROSS_TENANT_REFERENCE",
24569
+ `nodes[${index}].targetRef`,
24570
+ "Kernel Navigation may retain only Page references independently verified by the authenticated Kernel page catalog."
24571
+ );
24572
+ }
24573
+ if (scopeKey(releaseReference.tenantScope) !== scopeKey(registration.targetRevisionRef.tenantScope)) {
24574
+ throw new DeclarativeControlCompilationError(
24575
+ "CROSS_TENANT_REFERENCE",
24576
+ `nodes[${index}].targetRef`,
24577
+ "Verified Kernel Page and PageRelease references must belong to the same tenant scope."
24578
+ );
24579
+ }
24580
+ } else {
24581
+ assertTenantCompatible(
24582
+ registration.targetRevisionRef,
24583
+ scope,
24584
+ `nodes[${index}].targetRef`
24585
+ );
24586
+ }
24537
24587
  if (!accessPolicyChainImplies(
24538
24588
  [...ancestors, node.audience],
24539
24589
  registration.accessPolicy