@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.
@@ -17905,13 +17905,17 @@ var requireDependencies = (snapshot, required) => {
17905
17905
  }
17906
17906
  }
17907
17907
  };
17908
- var assertDependencyScopes = (snapshot, scope) => snapshot.forEach(
17909
- (dependency, index) => assertTenantCompatible(
17910
- dependency.revisionRef,
17908
+ var assertDependencyScopes = (snapshot, scope, allowedForeignReferences = /* @__PURE__ */ new Set()) => snapshot.forEach((dependency, index) => {
17909
+ const reference = dependency.revisionRef;
17910
+ const foreign = reference.visibility === "tenant" && scopeKey(reference.tenantScope) !== scopeKey(scope);
17911
+ if (foreign && allowedForeignReferences.has(revisionRefKey(reference)))
17912
+ return;
17913
+ assertTenantCompatible(
17914
+ reference,
17911
17915
  scope,
17912
17916
  `dependencySnapshot[${index}].revisionRef`
17913
- )
17914
- );
17917
+ );
17918
+ });
17915
17919
  var requireReleaseReady = (release) => {
17916
17920
  if (release.operation === "deactivate") {
17917
17921
  throw new DeclarativeControlCompilationError(
@@ -19931,6 +19935,27 @@ var compileNavigationRuntimeBundle = (input) => {
19931
19935
  input.compilerRevisionRef
19932
19936
  );
19933
19937
  const scope = TenantScopeSchema.parse(navigation.tenantScope);
19938
+ const verifiedKernelPageReferences = [...input.verifiedKernelPageReferences ?? []].map((reference, index) => {
19939
+ const parsed = RevisionRefSchema.parse(reference);
19940
+ 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)) {
19941
+ throw new DeclarativeControlCompilationError(
19942
+ "CROSS_TENANT_REFERENCE",
19943
+ `verifiedKernelPageReferences[${index}]`,
19944
+ "Verified Kernel Page references must be exact tenant-scoped Page and PageRelease revisions from the Kernel page catalog."
19945
+ );
19946
+ }
19947
+ if (scopeKey(parsed.tenantScope) === scopeKey(scope)) {
19948
+ throw new DeclarativeControlCompilationError(
19949
+ "CROSS_TENANT_REFERENCE",
19950
+ `verifiedKernelPageReferences[${index}]`,
19951
+ "Verified Kernel Page references must belong to a different tenant scope."
19952
+ );
19953
+ }
19954
+ return parsed;
19955
+ });
19956
+ const verifiedKernelPageReferenceKeys = new Set(
19957
+ verifiedKernelPageReferences.map(revisionRefKey)
19958
+ );
19934
19959
  assertSameTenantScope(release.tenantScope, scope, "release.tenantScope");
19935
19960
  if (navigation.nodes.length > input.limits.maxNavigationNodes)
19936
19961
  throw new DeclarativeControlCompilationError(
@@ -19985,7 +20010,11 @@ var compileNavigationRuntimeBundle = (input) => {
19985
20010
  release.dependencySnapshot,
19986
20011
  navigationDependencies(navigation, release, compilerRevisionRef)
19987
20012
  );
19988
- assertDependencyScopes(release.dependencySnapshot, scope);
20013
+ assertDependencyScopes(
20014
+ release.dependencySnapshot,
20015
+ scope,
20016
+ verifiedKernelPageReferenceKeys
20017
+ );
19989
20018
  const targetRegistry = input.targetRegistry.map((registration, index) => {
19990
20019
  const common = {
19991
20020
  stableTargetRef: StableRefSchema.parse(registration.stableTargetRef),
@@ -20171,11 +20200,32 @@ var compileNavigationRuntimeBundle = (input) => {
20171
20200
  "Navigation target is active on another surface."
20172
20201
  );
20173
20202
  }
20174
- assertTenantCompatible(
20175
- registration.targetRevisionRef,
20176
- scope,
20177
- `nodes[${index}].targetRef`
20178
- );
20203
+ const targetIsForeignTenant = registration.targetRevisionRef.visibility === "tenant" && scopeKey(registration.targetRevisionRef.tenantScope) !== scopeKey(scope);
20204
+ if (targetIsForeignTenant) {
20205
+ const releaseReference = registration.kind === "route" ? registration.releaseRevisionRef : void 0;
20206
+ if (release.target.surface !== "kernel" || registration.kind !== "route" || registration.targetRevisionRef.kind !== "page" || !releaseReference || !verifiedKernelPageReferenceKeys.has(
20207
+ revisionRefKey(registration.targetRevisionRef)
20208
+ ) || !verifiedKernelPageReferenceKeys.has(revisionRefKey(releaseReference))) {
20209
+ throw new DeclarativeControlCompilationError(
20210
+ "CROSS_TENANT_REFERENCE",
20211
+ `nodes[${index}].targetRef`,
20212
+ "Kernel Navigation may retain only Page references independently verified by the authenticated Kernel page catalog."
20213
+ );
20214
+ }
20215
+ if (scopeKey(releaseReference.tenantScope) !== scopeKey(registration.targetRevisionRef.tenantScope)) {
20216
+ throw new DeclarativeControlCompilationError(
20217
+ "CROSS_TENANT_REFERENCE",
20218
+ `nodes[${index}].targetRef`,
20219
+ "Verified Kernel Page and PageRelease references must belong to the same tenant scope."
20220
+ );
20221
+ }
20222
+ } else {
20223
+ assertTenantCompatible(
20224
+ registration.targetRevisionRef,
20225
+ scope,
20226
+ `nodes[${index}].targetRef`
20227
+ );
20228
+ }
20179
20229
  if (!accessPolicyChainImplies(
20180
20230
  [...ancestors, node.audience],
20181
20231
  registration.accessPolicy