@camstack/server 1.2.148 → 1.2.150

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.
@@ -676,8 +676,10 @@ class AddonRegistryService {
676
676
  //
677
677
  // `placement: 'agent-only'` addons and `@camstack/system` builtins are
678
678
  // excluded from the plan (filtered inside `buildAddonGroupPlan`) — except
679
- // a builtin declaring `execution.isolate`, which is spawned AFTER the
680
- // in-process passes below (see `spawnRunnerPlan`'s two calls).
679
+ // a builtin declaring `execution.isolate`, which is spawned in two
680
+ // waves (infra isolates BEFORE in-process builtins, consumers AFTER —
681
+ // see `partitionIsolatedBuiltinIds` and the three `spawnRunnerPlan`
682
+ // calls).
681
683
  // A failed runner spawn is logged and the addon surfaces as
682
684
  // `addon.error` — there is NO in-process-on-the-hub fallback (it
683
685
  // would violate one-addon-one-process). Retry policy for a failed
@@ -712,15 +714,11 @@ class AddonRegistryService {
712
714
  }
713
715
  });
714
716
  };
715
- // An ISOLATED builtin is a builtin: everything it stores lives behind
716
- // `settings-store`, which is one of the in-process builtins booted below.
717
- // Spawned here it would race them, and the failure would not look like a
718
- // race — the snapshot wrapper mints its link-signing secret at init, so a
719
- // store that answers "not ready" once yields either no signed-link plane
720
- // for the life of the process or a NEW secret that invalidates every link
721
- // a client is holding. Ordinary addons tolerate the same window because
722
- // `readAddonStoreWithRetry` rides it out; an isolated builtin does not
723
- // need to be lucky, because it can simply be spawned second.
717
+ // Isolated builtins split into two waves. Snapshot (D123) persists
718
+ // behind `settings-store`, so it must boot AFTER the in-process door.
719
+ // sqlite-settings IS that engine: spawn it with snapshot and every
720
+ // in-process builtin initialises against a missing store (D44).
721
+ // `partitionIsolatedBuiltinIds` is the only classification.
724
722
  const isolatedBuiltinIds = allIds.filter((id) => {
725
723
  const entry = this.addonEntries.get(id);
726
724
  return (entry?.packageName === '@camstack/system' &&
@@ -728,6 +726,16 @@ class AddonRegistryService {
728
726
  (0, types_1.isIsolatedBuiltin)(entry.declaration));
729
727
  });
730
728
  const isolatedBuiltins = new Set(isolatedBuiltinIds);
729
+ const { infra: isolatedInfraIds, consumers: isolatedConsumerIds } = (0, system_1.partitionIsolatedBuiltinIds)(isolatedBuiltinIds, (id) => {
730
+ const entry = this.addonEntries.get(id);
731
+ return entry?.declaredCapabilities ?? [];
732
+ });
733
+ if (isolatedInfraIds.length > 0) {
734
+ this.logger.info('Spawning isolated infrastructure builtins', {
735
+ meta: { addonIds: isolatedInfraIds },
736
+ });
737
+ await spawnRunnerPlan(this.buildAddonGroupPlan(isolatedInfraIds));
738
+ }
731
739
  await spawnRunnerPlan(this.buildAddonGroupPlan(allIds.filter((id) => !isolatedBuiltins.has(id))));
732
740
  // In-process boot for `@camstack/system` builtins. Core builtins stay
733
741
  // resident on the hub process — they provide the storage / settings
@@ -835,14 +843,13 @@ class AddonRegistryService {
835
843
  }
836
844
  }
837
845
  }
838
- // Isolated builtins, now that storage / settings / logging are resident.
839
- // Same authority (`buildAddonGroupPlan`), same failure semantics — only the
840
- // ORDER differs, and the order is the point.
841
- if (isolatedBuiltinIds.length > 0) {
846
+ // Isolated consumers (snapshot), now that storage / settings / logging
847
+ // are resident. Infra isolates already spawned above.
848
+ if (isolatedConsumerIds.length > 0) {
842
849
  this.logger.info('Spawning isolated system builtins', {
843
- meta: { addonIds: isolatedBuiltinIds },
850
+ meta: { addonIds: isolatedConsumerIds },
844
851
  });
845
- await spawnRunnerPlan(this.buildAddonGroupPlan(isolatedBuiltinIds));
852
+ await spawnRunnerPlan(this.buildAddonGroupPlan(isolatedConsumerIds));
846
853
  }
847
854
  const initializedIds = [...this.addonEntries.entries()]
848
855
  .filter(([, e]) => e.initialized)
@@ -2423,7 +2430,9 @@ class AddonRegistryService {
2423
2430
  this.configService.setSettingsStore(syncStore);
2424
2431
  }
2425
2432
  else {
2426
- this.logger.error('settings-store provider does not implement the sync ConfigManager surface and no data-store-provider engine does either — every addon store reads empty, devices will NOT be restored', { meta: { addonId, phase: 'v2' } });
2433
+ // Isolated engine: the UDS proxy is not `ISettingsStore`. The
2434
+ // async door below is what `createSettingsView` uses instead.
2435
+ this.logger.info('settings-store engine is isolated — ConfigManager uses the async door, not a sync ISettingsStore', { meta: { addonId, phase: 'v2' } });
2427
2436
  }
2428
2437
  this.storageService.setSettingsBackend(provider);
2429
2438
  // The registry needs the DOOR's own shape, not `ISettingsBackend`.
@@ -2436,6 +2445,7 @@ class AddonRegistryService {
2436
2445
  const store = this.capabilityRegistry.getProviderByAddon('settings-store', addonId);
2437
2446
  if (!store)
2438
2447
  return;
2448
+ this.configService.setSettingsDoor(store);
2439
2449
  this.integrationRegistry = new system_1.IntegrationRegistry(store);
2440
2450
  void this.integrationRegistry.initialize().then(() => {
2441
2451
  this.logger.info('IntegrationRegistry initialized', { meta: { phase: 'v2' } });
@@ -767,17 +767,26 @@ class MoleculerService {
767
767
  // re-handshaking), so the rule resolves the same key on both sides.
768
768
  const registryKeyFor = (addonId) => isLocalChild ? addonId : `${addonId}@${nodeId}`;
769
769
  // Collect the `(registryKey, capName)` pairs a manifest would APPLY —
770
- // applying the SAME `isInfraCapability` skip and `capDef` existence
771
- // check the register block below uses, so the set reflects exactly
772
- // what is (or would have been) registered. Keyed `${registryKey}::${capName}`.
770
+ // applying the SAME infra skip and `capDef` existence check the
771
+ // register block below uses, so the set reflects exactly what is
772
+ // (or would have been) registered. Keyed `${registryKey}::${capName}`.
773
773
  // The resolved `capDef` is carried through so the register loop never
774
774
  // re-looks it up (and never needs a non-null assertion).
775
+ //
776
+ // Infra caps (`data-store-provider`, `storage-provider`, …) used to be
777
+ // skipped for EVERY handshake. That was right for a remote agent — the
778
+ // hub collection is this node's engine, and a second sqlite would make
779
+ // the door refuse (D44). It is wrong for a hub-local child: sqlite-settings
780
+ // isolate (D231) IS this node's engine, and skipping it leaves
781
+ // `getCollection` empty. Hub-local children are proxied; remote nodes
782
+ // are not (D233).
783
+ const skipInfraFromRemote = (capName) => (0, system_1.isInfraCapability)(capName) && !isLocalChild;
775
784
  const appliedKeys = (manifest) => {
776
785
  const keys = new Map();
777
786
  for (const addon of manifest) {
778
787
  const registryKey = registryKeyFor(addon.addonId);
779
788
  for (const capName of addon.capabilities) {
780
- if ((0, system_1.isInfraCapability)(capName))
789
+ if (skipInfraFromRemote(capName))
781
790
  continue;
782
791
  const capDef = registry.getDefinition(capName);
783
792
  if (!capDef)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.148",
3
+ "version": "1.2.150",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -33,18 +33,18 @@
33
33
  ]
34
34
  },
35
35
  "dependencies": {
36
- "@camstack/addon-admin-ui": "1.2.95",
36
+ "@camstack/addon-admin-ui": "1.2.96",
37
37
  "@camstack/addon-agent-ui": "1.2.28",
38
38
  "@camstack/addon-auth": "1.2.30",
39
39
  "@camstack/addon-decoder-nodeav": "1.2.26",
40
40
  "@camstack/addon-notifiers": "1.2.31",
41
- "@camstack/addon-pipeline": "1.2.119",
42
- "@camstack/addon-pipeline-orchestrator": "1.2.103",
43
- "@camstack/addon-post-analysis": "1.2.117",
41
+ "@camstack/addon-pipeline": "1.2.120",
42
+ "@camstack/addon-pipeline-orchestrator": "1.2.104",
43
+ "@camstack/addon-post-analysis": "1.2.118",
44
44
  "@camstack/sdk": "1.2.30",
45
- "@camstack/system": "1.2.118",
46
- "@camstack/types": "1.2.101",
47
- "@camstack/ui-library": "1.2.69",
45
+ "@camstack/system": "1.2.119",
46
+ "@camstack/types": "1.2.102",
47
+ "@camstack/ui-library": "1.2.70",
48
48
  "@fastify/compress": "^9.0.0",
49
49
  "@fastify/cookie": "^11.0.2",
50
50
  "@fastify/cors": "^11.2.0",