@inf-monkeys-tech/monkeys 1.1.13 → 1.1.15

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.
@@ -23591,6 +23591,7 @@ function resolveThemeTokens(input) {
23591
23591
  return result;
23592
23592
  };
23593
23593
  for (const path of collected.keys()) resolveToken(path);
23594
+ assertBentoTokens(resolved);
23594
23595
  const resolvedDocument = {};
23595
23596
  for (const token of resolved.values()) {
23596
23597
  const segments = token.path.split(".");
@@ -23703,6 +23704,35 @@ function assertMonkeysThemeTokensComplete(input) {
23703
23704
  }
23704
23705
  return resolved.document;
23705
23706
  }
23707
+ function assertBentoTokens(tokens) {
23708
+ const fields = {
23709
+ background: "color",
23710
+ borderColor: "color",
23711
+ borderWidth: "dimension",
23712
+ borderStyle: "strokeStyle",
23713
+ radius: "dimension",
23714
+ shadow: "shadow",
23715
+ padding: "dimension",
23716
+ gap: "dimension"
23717
+ };
23718
+ for (const [path, token] of tokens) {
23719
+ if (!path.startsWith("semantic.bento.")) continue;
23720
+ const match = /^semantic\.bento\.(?:default|levels\.level([1-9]\d*))\.([a-zA-Z]+)(?:\.([a-z]+))?$/.exec(path);
23721
+ const field = match?.[2];
23722
+ const axis = match?.[3];
23723
+ const expected = field && fields[field];
23724
+ const modes = field === "padding" || field === "gap" ? ["compact", "default", "comfortable"] : ["light", "dark"];
23725
+ if (!match || !expected || token.type !== expected || axis && !modes.includes(axis) || match[1] && !Number.isSafeInteger(Number(match[1]))) {
23726
+ throw new ThemeTokenValidationError("Invalid Bento semantic token.", [{ path, message: "Expected a supported Bento field, type, level and mode." }]);
23727
+ }
23728
+ if (field === "borderStyle" && typeof token.value !== "string") {
23729
+ throw new ThemeTokenValidationError("Invalid Bento border style.", [{ path, message: "Bento borders require a CSS stroke keyword." }]);
23730
+ }
23731
+ if (token.type === "dimension" && token.value.value < 0) {
23732
+ throw new ThemeTokenValidationError("Invalid Bento dimension.", [{ path, message: "Bento dimensions must be non-negative." }]);
23733
+ }
23734
+ }
23735
+ }
23706
23736
 
23707
23737
  // src/contracts/theme.ts
23708
23738
  var ThemeTokenTypeSchema = z16.enum(THEME_TOKEN_TYPES);
@@ -24682,7 +24712,6 @@ var assertCompatibleCapabilityUpgrade = (previous, next) => {
24682
24712
  }
24683
24713
  const manifestContract = (entry) => ({
24684
24714
  kind: entry.manifest.kind,
24685
- ports: entry.manifest.ports,
24686
24715
  runtime: { ...entry.manifest.runtime, providerBindings: entry.manifest.runtime.providerBindings.map((binding) => ({ ...binding, providerRef: { ...binding.providerRef, version: void 0 } })) },
24687
24716
  placement: entry.manifest.placement,
24688
24717
  accessibility: entry.manifest.accessibility
@@ -24709,7 +24738,15 @@ var assertCompatibleCapabilityUpgrade = (previous, next) => {
24709
24738
  for (const direction of ["inputPorts", "outputPorts"]) {
24710
24739
  const oldPorts = oldRegistration[direction];
24711
24740
  const newPorts = newRegistration[direction];
24712
- if (oldPorts.length !== newPorts.length) throw new TypeError("Public runtime ports cannot be removed or replaced.");
24741
+ const oldManifestPorts = previous.manifest.ports?.[direction === "inputPorts" ? "inputs" : "outputs"] ?? [];
24742
+ const newManifestPorts = next.manifest.ports?.[direction === "inputPorts" ? "inputs" : "outputs"] ?? [];
24743
+ for (const port of oldManifestPorts) {
24744
+ const replacement = newManifestPorts.find((candidate) => candidate.name === port.name);
24745
+ if (!replacement || canonicalContentHash(port) !== canonicalContentHash(replacement)) throw new TypeError("Published runtime port semantics changed.");
24746
+ }
24747
+ if (newManifestPorts.some((port) => port.required && !oldManifestPorts.some((previousPort) => previousPort.name === port.name)) || newPorts.some((port) => port.required && !oldPorts.some((previousPort) => previousPort.name === port.name))) {
24748
+ throw new TypeError("New runtime ports must be optional for published declarations.");
24749
+ }
24713
24750
  for (const port of oldPorts) {
24714
24751
  const replacement = newPorts.find((candidate) => candidate.name === port.name);
24715
24752
  if (!replacement || port.required !== replacement.required || port.multiple !== replacement.multiple) throw new TypeError("Public runtime port cardinality changed.");
@@ -24723,7 +24760,12 @@ var assertCompatibleCapabilityUpgrade = (previous, next) => {
24723
24760
  if (canonicalContentHash(requirements(oldRegistration)) !== canonicalContentHash(requirements(newRegistration))) {
24724
24761
  throw new TypeError("Runtime Ontology access requirements changed.");
24725
24762
  }
24726
- for (const key of ["allowedSideEffects", "actionRequirements", "allowedSlots", "supportedSurfaces", "allowedParentCapabilityRefs", "allowedChildCapabilityRefs"]) {
24763
+ const existingOutputs = new Set(oldRegistration.outputPorts.map((port) => port.name));
24764
+ const existingActions = newRegistration.actionRequirements.filter((requirement) => existingOutputs.has(requirement.outputPort));
24765
+ if (canonicalContentHash(oldRegistration.actionRequirements) !== canonicalContentHash(existingActions)) {
24766
+ throw new TypeError("Published output action and permission requirements changed.");
24767
+ }
24768
+ for (const key of ["allowedSideEffects", "allowedSlots", "supportedSurfaces", "allowedParentCapabilityRefs", "allowedChildCapabilityRefs"]) {
24727
24769
  if (canonicalContentHash(oldRegistration[key]) !== canonicalContentHash(newRegistration[key])) throw new TypeError(`Runtime contract ${key} changed.`);
24728
24770
  }
24729
24771
  };