@sdux-vault/engine 0.8.0 → 0.9.0

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.
@@ -11,7 +11,7 @@ import { EventBus, initDevtoolsWidget } from '@sdux-vault/devtools';
11
11
  // cmd+alt+j (see .vscode/keybindings.json)
12
12
  // --- END AI MODEL FILE PATH ---
13
13
  const SDUX_PACKAGE = '@sdux-vault/engine';
14
- const SDUX_VERSION = '0.8.0';
14
+ const SDUX_VERSION = '0.9.0';
15
15
  registerVersion(SDUX_PACKAGE, SDUX_VERSION);
16
16
 
17
17
  /**
@@ -1573,6 +1573,7 @@ const VAULT_LICENSE_ID = 'sdux-vault';
1573
1573
  // Generated by pathcomment [tab] (see .vscode/typescript.code-snippets) or
1574
1574
  // cmd+alt+j (see .vscode/keybindings.json)
1575
1575
  // --- END AI MODEL FILE PATH ---
1576
+ const CORE_LICENSE_BEHAVIOR_KEY = 'SDUX::Behavior::Core::License';
1576
1577
  let instance = null;
1577
1578
  function VaultCore(config = {}) {
1578
1579
  if (!instance) {
@@ -1584,6 +1585,7 @@ class VaultCoreInstance {
1584
1585
  #validaionSub;
1585
1586
  #licenseMap = new Map();
1586
1587
  #terminalStatus = new Map();
1588
+ #aiAssistEnabled = false;
1587
1589
  #bypassLicensing = true;
1588
1590
  #licenseTimeoutMs;
1589
1591
  // eslint-disable-next-line
@@ -1828,6 +1830,9 @@ class VaultCoreInstance {
1828
1830
  return;
1829
1831
  this.#applyLicenseValidation(record.behaviors, key, licenseToken, valid);
1830
1832
  this.#applyLicenseValidation(record.controllers, key, licenseToken, valid);
1833
+ if (valid && key === CORE_LICENSE_BEHAVIOR_KEY) {
1834
+ this.#enableAiAssist();
1835
+ }
1831
1836
  }
1832
1837
  #applyLicenseValidation(entities, key, licenseId, valid) {
1833
1838
  if (!entities?.has(key))
@@ -1906,6 +1911,20 @@ class VaultCoreInstance {
1906
1911
  }
1907
1912
  return this.#registry.get(key);
1908
1913
  }
1914
+ #enableAiAssist() {
1915
+ if (this.#aiAssistEnabled)
1916
+ return;
1917
+ if (!DevMode.active)
1918
+ return;
1919
+ // istanbul ignore next -- SSR guard; document is always defined in browser tests
1920
+ if (typeof document === 'undefined')
1921
+ return;
1922
+ this.#aiAssistEnabled = true;
1923
+ globalThis.sdux ??= {};
1924
+ globalThis.sdux.debugWidget ??= {};
1925
+ globalThis.sdux.debugWidget.aiAssistEnabled = true;
1926
+ document.dispatchEvent(new CustomEvent('sdux-license-resolved'));
1927
+ }
1909
1928
  #injectDebugWidget() {
1910
1929
  if (!DevMode.active)
1911
1930
  return;