@camstack/server 1.2.16 → 1.2.18

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.
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.AddonRegistryService = void 0;
37
+ exports.shouldEvictMissingOnDisk = shouldEvictMissingOnDisk;
37
38
  exports.shouldEmitProviderRegisteredReady = shouldEmitProviderRegisteredReady;
38
39
  /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access -- pre-existing lint debt across this 2200-line orchestration class. The flagged sites (StorageService.setLocationManager / setSettingsBackend, LoggingService.addDestination, RouteRegistry, etc.) are typed as `unknown` by their owning services to break circular construction-order dependencies; runtime contracts are validated structurally. Tracked separately; do not amend in unrelated edits. */
39
40
  const os = __importStar(require("node:os"));
@@ -55,6 +56,20 @@ const addon_settings_provider_js_1 = require("./addon-settings-provider.js");
55
56
  const addon_call_gateway_js_1 = require("./addon-call-gateway.js");
56
57
  const system_6 = require("@camstack/system");
57
58
  const types_2 = require("@camstack/types");
59
+ /**
60
+ * Decide whether an in-memory addon entry should be evicted because it is no
61
+ * longer on disk (the uninstall path in `loadNewAddons`).
62
+ *
63
+ * A `@camstack/system` builtin is NEVER evicted here: the fresh loader scans
64
+ * `addonsDir` only (no `['@camstack/system']` closure include), so builtins
65
+ * are never in `onDiskIds`, and their lifecycle is the server closure
66
+ * (single-copy model), not the data/addons uninstall path. Omitting this guard
67
+ * let a deploy of an unrelated addon silently unregister loki-logging on the
68
+ * live hub.
69
+ */
70
+ function shouldEvictMissingOnDisk(entry, id, onDiskIds) {
71
+ return (entry.source === 'installed' && entry.packageName !== '@camstack/system' && !onDiskIds.has(id));
72
+ }
58
73
  /**
59
74
  * Type predicate: true when an `ISettingsBackend` also satisfies the
60
75
  * sync `ISettingsStore` contract (system/addon/device key-value ops)
@@ -2098,11 +2113,10 @@ class AddonRegistryService {
2098
2113
  // D5: every non-core addon lives in its own runner subprocess. The
2099
2114
  // uninstall consolidation is "stop the runner"; the runner exits and
2100
2115
  // re-handshakes the hub WITHOUT the removed addon (D3 machinery).
2101
- // Only `@camstack/system` builtins which have no runner take the
2102
- // in-process `shutdown()` + disposer-drain path.
2116
+ // `@camstack/system` builtins are excludedsee `shouldEvictMissingOnDisk`.
2103
2117
  const onDiskIds = new Set(freshLoader.listAddons().map((a) => a.declaration.id));
2104
2118
  for (const [id, entry] of this.addonEntries) {
2105
- if (entry.source === 'installed' && !onDiskIds.has(id)) {
2119
+ if (shouldEvictMissingOnDisk(entry, id, onDiskIds)) {
2106
2120
  // Unregister capabilities before stopping the addon.
2107
2121
  for (const cap of entry.declaredCapabilities) {
2108
2122
  this.capabilityRegistry.unregisterProvider(cap.name, id);
@@ -2130,7 +2144,9 @@ class AddonRegistryService {
2130
2144
  }
2131
2145
  }
2132
2146
  else if (entry.initialized) {
2133
- // `@camstack/system` builtin reload model is in-process.
2147
+ // Defensive fallback: a non-forked installed addon (every
2148
+ // non-`@camstack/system` addon forks, and builtins are excluded
2149
+ // above, so this is not normally reached). Shut it down in-process.
2134
2150
  try {
2135
2151
  await entry.addon.shutdown();
2136
2152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -38,12 +38,12 @@
38
38
  "@camstack/addon-auth": "1.2.5",
39
39
  "@camstack/addon-decoder-nodeav": "1.2.5",
40
40
  "@camstack/addon-notifiers": "1.2.6",
41
- "@camstack/addon-pipeline": "1.2.13",
41
+ "@camstack/addon-pipeline": "1.2.14",
42
42
  "@camstack/addon-pipeline-orchestrator": "1.2.10",
43
- "@camstack/addon-post-analysis": "1.2.11",
43
+ "@camstack/addon-post-analysis": "1.2.12",
44
44
  "@camstack/sdk": "1.2.5",
45
45
  "@camstack/shm-ring": "1.1.5",
46
- "@camstack/system": "1.2.17",
46
+ "@camstack/system": "1.2.18",
47
47
  "@camstack/types": "1.2.15",
48
48
  "@camstack/ui-library": "1.2.11",
49
49
  "@fastify/compress": "^9.0.0",