@camstack/server 1.2.789 → 1.2.791

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.
Files changed (131) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/agent/agent-child-manifest.js +39 -0
  3. package/dist/agent/agent-hub-registration.js +11 -1
  4. package/dist/agent/forward-to-hub.js +43 -0
  5. package/dist/agent/main.js +31 -81
  6. package/dist/agent/stale-addon-gate.js +70 -34
  7. package/dist/api/trpc/device-config-secret-redaction.js +14 -1
  8. package/dist/api/trpc/generated-cap-mounts.js +1 -6
  9. package/dist/api/trpc/generated-cap-routers.js +1245 -1417
  10. package/dist/api/trpc/localized-schema-paths.js +1 -0
  11. package/dist/core/addon/addon-registry.service.js +25 -33
  12. package/dist/core/addon/addon-settings-provider.js +57 -0
  13. package/dist/core/addon/boot-health-snapshot.js +0 -28
  14. package/dist/core/addon/{hub-spawn-gate.js → hub-addon-support.js} +12 -35
  15. package/dist/core/moleculer/moleculer.service.js +2 -13
  16. package/dist/core/moleculer/runner-hosted-on-node.js +23 -0
  17. package/dist/core/updates/required-addon-update.js +1 -1
  18. package/package.json +20 -11
  19. package/system/dist/addon-runner.js +22 -0
  20. package/system/dist/addon-runner.mjs +22 -0
  21. package/system/dist/{agent-https-szf2FU49.mjs → agent-https-BmVaVskH.mjs} +1 -1
  22. package/system/dist/{agent-https-jJDe-XNl.js → agent-https-DOs15BCJ.js} +1 -1
  23. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  24. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  25. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  26. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  27. package/system/dist/builtins/alerts/alerts.addon.d.ts +8 -0
  28. package/system/dist/builtins/alerts/alerts.addon.js +72 -1
  29. package/system/dist/builtins/alerts/alerts.addon.mjs +72 -1
  30. package/system/dist/builtins/autotrack/autotrack.addon.d.ts +7 -7
  31. package/system/dist/builtins/autotrack/index.js +15 -8
  32. package/system/dist/builtins/autotrack/index.mjs +15 -8
  33. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  34. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  35. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  36. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  37. package/system/dist/builtins/camera-grid/index.js +1 -1
  38. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  39. package/system/dist/builtins/composer/composer.addon.js +3 -3
  40. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  41. package/system/dist/builtins/console-logging/index.js +1 -1
  42. package/system/dist/builtins/console-logging/index.mjs +1 -1
  43. package/system/dist/builtins/core-blocks/core-blocks.addon.js +11 -5
  44. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +11 -5
  45. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  46. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  47. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  48. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  49. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  50. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  51. package/system/dist/builtins/keychain/index.js +4 -4
  52. package/system/dist/builtins/keychain/index.mjs +4 -4
  53. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  54. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  55. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  56. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  57. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  58. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  59. package/system/dist/builtins/loki-logging/index.js +1 -1
  60. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  61. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  62. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  63. package/system/dist/builtins/platform-probe/index.js +1 -1
  64. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  65. package/system/dist/builtins/record-entries/index.js +1 -1
  66. package/system/dist/builtins/record-entries/index.mjs +1 -1
  67. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +4 -10
  68. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +16 -9
  69. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +16 -9
  70. package/system/dist/builtins/snapshot/index.js +1 -1
  71. package/system/dist/builtins/snapshot/index.mjs +1 -1
  72. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  73. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  74. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  75. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  76. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  77. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  78. package/system/dist/builtins/storage-orchestrator/access-guards.d.ts +1 -1
  79. package/system/dist/builtins/storage-orchestrator/custom-actions.d.ts +11 -0
  80. package/system/dist/builtins/storage-orchestrator/index.d.ts +1 -0
  81. package/system/dist/builtins/storage-orchestrator/index.js +2 -0
  82. package/system/dist/builtins/storage-orchestrator/index.mjs +2 -2
  83. package/system/dist/builtins/storage-orchestrator/location-instances.d.ts +72 -0
  84. package/system/dist/builtins/storage-orchestrator/location-repoint-move.d.ts +1 -1
  85. package/system/dist/builtins/storage-orchestrator/location-secret-refs.d.ts +26 -0
  86. package/system/dist/builtins/storage-orchestrator/location-store.d.ts +28 -2
  87. package/system/dist/builtins/storage-orchestrator/migrations/index.d.ts +9 -2
  88. package/system/dist/builtins/storage-orchestrator/migrations/legacy-location-secret-refs.d.ts +13 -0
  89. package/system/dist/builtins/storage-orchestrator/migrations/location-secret-ports.d.ts +15 -0
  90. package/system/dist/builtins/storage-orchestrator/migrations/location-secrets-to-record.d.ts +57 -0
  91. package/system/dist/builtins/storage-orchestrator/provider-discovery.d.ts +10 -13
  92. package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +6 -0
  93. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +39 -8
  94. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +954 -131
  95. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +954 -132
  96. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +8 -0
  97. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  98. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  99. package/system/dist/builtins/winston-logging/index.js +112 -3
  100. package/system/dist/builtins/winston-logging/index.mjs +112 -3
  101. package/system/dist/builtins/winston-logging/migrations/index.d.ts +8 -0
  102. package/system/dist/builtins/winston-logging/migrations/node-fields.d.ts +43 -0
  103. package/system/dist/builtins/winston-logging/winston-logging.addon.d.ts +10 -2
  104. package/system/dist/{capture-engine-DNHgjQot.js → capture-engine-BVpkq9Mv.js} +1 -1
  105. package/system/dist/{capture-engine-BsKY_3xa.mjs → capture-engine-D-oUDtX5.mjs} +1 -1
  106. package/system/dist/{composition-sources-BRdGsbVT.mjs → composition-sources-Br7JhpbD.mjs} +1 -1
  107. package/system/dist/{composition-sources-BgO0GQYW.js → composition-sources-DKCbVA67.js} +1 -1
  108. package/system/dist/{constants-CQeMrR4f.mjs → constants-Bl0Qxbek.mjs} +1 -1
  109. package/system/dist/{constants-C3jGKQSQ.js → constants-CJVY-mUq.js} +1 -1
  110. package/system/dist/{device-ca-ByVi5eUC.mjs → device-ca-BeDGy8NK.mjs} +1 -1
  111. package/system/dist/{device-ca-D3y6wGmn.js → device-ca-i8EbKp3q.js} +1 -1
  112. package/system/dist/{dist-BsQA6-0i.mjs → dist-CPUbgRkb.mjs} +395 -425
  113. package/system/dist/{dist-BRI-Mwx0.js → dist-Ddkk4Dqq.js} +412 -424
  114. package/system/dist/file-host-worker.js +1 -1
  115. package/system/dist/file-host-worker.mjs +1 -1
  116. package/system/dist/{hub-mdns-ciao-8dJTW2LI.mjs → hub-mdns-ciao-DgF4SifE.mjs} +2 -2
  117. package/system/dist/{hub-mdns-ciao-Ry_Jpljx.js → hub-mdns-ciao-lHRHbXqV.js} +2 -2
  118. package/system/dist/index.js +151 -53
  119. package/system/dist/index.mjs +151 -55
  120. package/system/dist/kernel/addon-health-monitor.d.ts +0 -21
  121. package/system/dist/kernel/index.d.ts +2 -0
  122. package/system/dist/kernel/transport/child-cap-protocol.d.ts +1 -1
  123. package/system/dist/kernel/transport/runner-of-addon.d.ts +2 -0
  124. package/system/dist/kernel/unsupported-addon-tracker.d.ts +74 -0
  125. package/system/dist/{legacy-integration-rows-door-CjXTbmvH.mjs → legacy-integration-rows-door-9JSt493H.mjs} +1 -1
  126. package/system/dist/{legacy-integration-rows-door-D5BdSNla.js → legacy-integration-rows-door-n9GIUxgq.js} +1 -1
  127. package/system/dist/{restore-archive-GoWJMdHy.js → restore-archive-BDvLSZtj.js} +1 -1
  128. package/system/dist/{restore-archive-vn4co_kf.mjs → restore-archive-Dh3XnCR1.mjs} +82 -82
  129. package/system/dist/{wal-maintenance-CadfiGWy.mjs → wal-maintenance-BQJAmAwS.mjs} +0 -0
  130. package/system/dist/{wal-maintenance-sSlXJm4k.js → wal-maintenance-CWlz_qRq.js} +0 -0
  131. package/system/package.json +4 -1
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-sSlXJm4k.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-CWlz_qRq.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-CadfiGWy.mjs";
1
+ import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-BQJAmAwS.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
- import { bc as userError } from "./dist-BsQA6-0i.mjs";
2
+ import { Cc as userError } from "./dist-CPUbgRkb.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-szf2FU49.mjs";
4
+ import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-BmVaVskH.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-BRI-Mwx0.js");
2
+ const require_dist = require("./dist-Ddkk4Dqq.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
- const require_agent_https = require("./agent-https-jJDe-XNl.js");
4
+ const require_agent_https = require("./agent-https-DOs15BCJ.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs = require("node:fs");
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-BRI-Mwx0.js");
4
- const require_device_ca = require("./device-ca-D3y6wGmn.js");
3
+ const require_dist = require("./dist-Ddkk4Dqq.js");
4
+ const require_device_ca = require("./device-ca-i8EbKp3q.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
7
7
  require("./builtins/alerts/index.js");
@@ -26,22 +26,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
26
26
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
27
27
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
28
28
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
29
- const require_wal_maintenance = require("./wal-maintenance-sSlXJm4k.js");
30
- const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-D5BdSNla.js");
29
+ const require_wal_maintenance = require("./wal-maintenance-CWlz_qRq.js");
30
+ const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-n9GIUxgq.js");
31
31
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
32
32
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
33
33
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
34
34
  require("./builtins/storage-orchestrator/index.js");
35
- const require_agent_https = require("./agent-https-jJDe-XNl.js");
36
- const require_constants = require("./constants-C3jGKQSQ.js");
35
+ const require_agent_https = require("./agent-https-DOs15BCJ.js");
36
+ const require_constants = require("./constants-CJVY-mUq.js");
37
37
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
38
38
  require("./builtins/system-config/index.js");
39
39
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
40
40
  const require_custom_action_registry = require("./custom-action-registry-CmWpSeMS.js");
41
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-Ry_Jpljx.js");
41
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-lHRHbXqV.js");
42
42
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
43
43
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
44
- const require_restore_archive = require("./restore-archive-GoWJMdHy.js");
44
+ const require_restore_archive = require("./restore-archive-BDvLSZtj.js");
45
45
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
46
46
  let zod = require("zod");
47
47
  let node_crypto = require("node:crypto");
@@ -19716,6 +19716,12 @@ var RunnerOfAddon = class {
19716
19716
  this.byAddon.set(addonId, runnerId);
19717
19717
  return runnerId;
19718
19718
  }
19719
+ /** The addons the spawn plan put in `runnerId` (a solo runner records itself: `[addonId]`; an addon never planned here is not listed). */
19720
+ addonsOf(runnerId) {
19721
+ const out = [];
19722
+ for (const [addonId, runner] of this.byAddon) if (runner === runnerId) out.push(addonId);
19723
+ return out;
19724
+ }
19719
19725
  resolve = (addonId) => this.byAddon.get(addonId) ?? addonId;
19720
19726
  };
19721
19727
  //#endregion
@@ -25558,7 +25564,6 @@ var AddonHealthMonitor = class {
25558
25564
  logger;
25559
25565
  retryFn;
25560
25566
  now;
25561
- isHeldBack;
25562
25567
  timer = null;
25563
25568
  graceEmittedFor = false;
25564
25569
  constructor(opts) {
@@ -25566,7 +25571,6 @@ var AddonHealthMonitor = class {
25566
25571
  this.logger = opts.logger;
25567
25572
  this.retryFn = opts.retryFn;
25568
25573
  this.now = opts.now ?? (() => Date.now());
25569
- this.isHeldBack = opts.isHeldBack ?? (() => false);
25570
25574
  this.tickIntervalMs = opts.tickIntervalMs ?? 3e4;
25571
25575
  this.gracePeriodMs = opts.gracePeriodMs ?? 3e5;
25572
25576
  this.retryIntervalsMs = opts.retryIntervalsMs ?? HEALTH_MONITOR_RETRY_INTERVALS_MS;
@@ -25594,8 +25598,7 @@ var AddonHealthMonitor = class {
25594
25598
  lastError: null,
25595
25599
  nextRetryAt: null,
25596
25600
  alertEmitted: false,
25597
- retrying: false,
25598
- heldBack: false
25601
+ retrying: false
25599
25602
  });
25600
25603
  if (wasAlerting) this.emit(require_dist.EventCategory.AddonLoadRecovered, {
25601
25604
  packageName,
@@ -25610,11 +25613,6 @@ var AddonHealthMonitor = class {
25610
25613
  */
25611
25614
  recordFailure(packageName, err, addonId) {
25612
25615
  const existing = this.state.get(packageName);
25613
- const id = addonId ?? existing?.addonId;
25614
- if (id !== void 0 && this.isHeldBack(id)) {
25615
- this.recordHeldBack(packageName, require_dist.errMsg(err), id);
25616
- return;
25617
- }
25618
25616
  const t = this.now();
25619
25617
  const retryCount = (existing?.retryCount ?? 0) + 1;
25620
25618
  const intervalIdx = Math.min(retryCount - 1, this.retryIntervalsMs.length - 1);
@@ -25633,8 +25631,7 @@ var AddonHealthMonitor = class {
25633
25631
  lastError: errPayload,
25634
25632
  nextRetryAt,
25635
25633
  alertEmitted: existing?.alertEmitted ?? false,
25636
- retrying: false,
25637
- heldBack: false
25634
+ retrying: false
25638
25635
  };
25639
25636
  this.state.set(packageName, next);
25640
25637
  this.logger.warn("Addon load/init failure recorded", { meta: {
@@ -25663,39 +25660,6 @@ var AddonHealthMonitor = class {
25663
25660
  }
25664
25661
  }
25665
25662
  /**
25666
- * The spawn gate holds this addon back (its package is not yet at the version the
25667
- * server requires). Not a failure: the same retry backoff is armed, so the addon
25668
- * is reloaded once its package is current, but no failure is logged as a warning
25669
- * and no `AddonLoadFailed` / `AddonRetryScheduled` event is emitted. A retry that
25670
- * finds the gate open records success the normal way.
25671
- */
25672
- recordHeldBack(packageName, reason, addonId) {
25673
- const existing = this.state.get(packageName);
25674
- const t = this.now();
25675
- const retryCount = (existing?.retryCount ?? 0) + 1;
25676
- const nextRetryAt = t + this.retryIntervalsMs[Math.min(retryCount - 1, this.retryIntervalsMs.length - 1)];
25677
- this.state.set(packageName, {
25678
- packageName,
25679
- addonId: addonId ?? existing?.addonId,
25680
- phase: "failed",
25681
- retryCount,
25682
- firstFailureAt: existing?.firstFailureAt ?? t,
25683
- lastAttemptAt: t,
25684
- lastError: { message: reason },
25685
- nextRetryAt,
25686
- alertEmitted: false,
25687
- retrying: false,
25688
- heldBack: true
25689
- });
25690
- this.logger.info("Addon held back by the stale gate, retry armed", { meta: {
25691
- packageName,
25692
- addonId: addonId ?? existing?.addonId,
25693
- retryCount,
25694
- nextRetryAt,
25695
- reason
25696
- } });
25697
- }
25698
- /**
25699
25663
  * Force an immediate retry attempt for a package, resetting the
25700
25664
  * counter back to 0 (next failure goes to the 60s interval again).
25701
25665
  * Used by the user-facing `addons.retryLoad` tRPC procedure and by
@@ -25772,7 +25736,7 @@ var AddonHealthMonitor = class {
25772
25736
  const t = this.now();
25773
25737
  if (!this.inGracePeriod() && !this.graceEmittedFor) {
25774
25738
  this.graceEmittedFor = true;
25775
- for (const s of this.state.values()) if (s.phase === "failed" && !s.heldBack && !s.alertEmitted && s.lastError) {
25739
+ for (const s of this.state.values()) if (s.phase === "failed" && !s.alertEmitted && s.lastError) {
25776
25740
  s.alertEmitted = true;
25777
25741
  this.emit(require_dist.EventCategory.AddonLoadFailed, {
25778
25742
  packageName: s.packageName,
@@ -25819,6 +25783,138 @@ var AddonHealthMonitor = class {
25819
25783
  }
25820
25784
  };
25821
25785
  //#endregion
25786
+ //#region src/kernel/unsupported-addon-tracker.ts
25787
+ /**
25788
+ * The operator alert for an addon that RUNS below the version the server needs.
25789
+ *
25790
+ * An addon whose installed package is under the running server's minimum
25791
+ * (`camstack.requires.addons`, or its own `requires.server`) is always started:
25792
+ * a held-back addon is invisible and silently loses its function, and the
25793
+ * `CrashSupervisor` (D6) already bounds a crash loop. What the operator needs is
25794
+ * to SEE it, so this tracker turns the gate's verdict into one alert pair on the
25795
+ * usual AlertCenter path, the way `AddonHealthMonitor` does for a load failure:
25796
+ *
25797
+ * - `AddonUnsupportedVersion` once per streak (same package, same installed
25798
+ * version, same unmet facts), after a short settle window so the alert
25799
+ * centre is subscribed even when the verdict comes from the first boot plan;
25800
+ * - `AddonUnsupportedResolved` when a later judgement finds the package
25801
+ * supported, or the node's installed set no longer holds it, which dismisses
25802
+ * the alert.
25803
+ *
25804
+ * One tracker per process; the verdict is re-judged on every spawn path, and
25805
+ * `observe` is idempotent; given the node's full installed set, a streak whose
25806
+ * package is no longer installed is resolved too. State is in memory: a restart raises a still-
25807
+ * unsupported addon once more, and AlertCenter upserts it under the same id.
25808
+ */
25809
+ var UNSUPPORTED_ADDON_SETTLE_MS = 6e4;
25810
+ var UnsupportedAddonTracker = class {
25811
+ options;
25812
+ streaks = /* @__PURE__ */ new Map();
25813
+ settleMs;
25814
+ now;
25815
+ startedAt;
25816
+ timer = null;
25817
+ logged = /* @__PURE__ */ new Set();
25818
+ constructor(options) {
25819
+ this.options = options;
25820
+ this.settleMs = options.settleMs ?? 6e4;
25821
+ this.now = options.now ?? (() => Date.now());
25822
+ this.startedAt = this.now();
25823
+ }
25824
+ /**
25825
+ * One gate run. `judged` is every package the run looked at, `unsupported` the
25826
+ * subset below its minimum. A judged package with a streak that is not in
25827
+ * `unsupported` any more is resolved; a package this run did not judge is left alone.
25828
+ * `installed`, when the run saw the node's FULL package set, also resolves every
25829
+ * streak whose package is not in it (uninstalled).
25830
+ */
25831
+ observe(judged, unsupported, installed) {
25832
+ if (installed !== void 0) {
25833
+ const present = new Set(installed);
25834
+ for (const packageName of [...this.streaks.keys()]) if (!present.has(packageName)) this.resolve(packageName);
25835
+ }
25836
+ const unsupportedNames = new Set(unsupported.map((f) => f.packageName));
25837
+ for (const packageName of judged) if (!unsupportedNames.has(packageName)) this.resolve(packageName);
25838
+ for (const facts of unsupported) this.raise(facts);
25839
+ this.flush();
25840
+ }
25841
+ /** Log a line the first time only (an unjudged addon is reported once, not on every judgement). */
25842
+ logOnce(line) {
25843
+ if (this.logged.has(line)) return;
25844
+ this.logged.add(line);
25845
+ this.options.log(line);
25846
+ }
25847
+ /** Stop the settle timer (shutdown). */
25848
+ stop() {
25849
+ if (this.timer !== null) clearTimeout(this.timer);
25850
+ this.timer = null;
25851
+ }
25852
+ raise(facts) {
25853
+ const existing = this.streaks.get(facts.packageName);
25854
+ if (existing !== void 0 && sameFacts(existing.facts, facts)) return;
25855
+ this.options.log(`[unsupported-addon] ${facts.addonId} (${facts.packageName}@${facts.installedVersion}) runs below what this server requires: ${facts.unmet.join("; ")}`);
25856
+ this.streaks.set(facts.packageName, {
25857
+ facts,
25858
+ raised: false
25859
+ });
25860
+ }
25861
+ resolve(packageName) {
25862
+ const streak = this.streaks.get(packageName);
25863
+ if (streak === void 0) return;
25864
+ this.streaks.delete(packageName);
25865
+ if (!streak.raised) return;
25866
+ this.options.log(`[unsupported-addon] ${streak.facts.addonId} (${packageName}) is supported again, alert cleared`);
25867
+ this.emit(require_dist.EventCategory.AddonUnsupportedResolved, {
25868
+ packageName,
25869
+ addonId: streak.facts.addonId,
25870
+ nodeId: this.options.nodeId
25871
+ });
25872
+ }
25873
+ /** Emit every pending streak once the settle window is over; otherwise arm one timer for its end. */
25874
+ flush() {
25875
+ const remaining = this.startedAt + this.settleMs - this.now();
25876
+ if (remaining > 0) {
25877
+ if (this.timer === null && this.streaks.size > 0) {
25878
+ this.timer = setTimeout(() => {
25879
+ this.timer = null;
25880
+ this.flush();
25881
+ }, remaining);
25882
+ this.timer.unref();
25883
+ }
25884
+ return;
25885
+ }
25886
+ for (const streak of this.streaks.values()) {
25887
+ if (streak.raised) continue;
25888
+ streak.raised = true;
25889
+ const f = streak.facts;
25890
+ this.emit(require_dist.EventCategory.AddonUnsupportedVersion, {
25891
+ packageName: f.packageName,
25892
+ addonId: f.addonId,
25893
+ nodeId: this.options.nodeId,
25894
+ installedVersion: f.installedVersion,
25895
+ requiredMinimum: f.requiredMinimum,
25896
+ serverVersion: f.serverVersion,
25897
+ unmet: [...f.unmet]
25898
+ });
25899
+ }
25900
+ }
25901
+ emit(category, data) {
25902
+ this.options.eventBus.emit({
25903
+ id: (0, node_crypto.randomUUID)(),
25904
+ timestamp: /* @__PURE__ */ new Date(),
25905
+ category,
25906
+ source: {
25907
+ type: "addon",
25908
+ id: String(data["packageName"])
25909
+ },
25910
+ data
25911
+ });
25912
+ }
25913
+ };
25914
+ function sameFacts(a, b) {
25915
+ return a.installedVersion === b.installedVersion && a.requiredMinimum === b.requiredMinimum && a.serverVersion === b.serverVersion && a.unmet.join("\n") === b.unmet.join("\n");
25916
+ }
25917
+ //#endregion
25822
25918
  //#region src/kernel/moleculer/runner-refusal.ts
25823
25919
  var REFUSED_PREFIX = "REFUSED:";
25824
25920
  function isReport(value) {
@@ -28454,11 +28550,13 @@ exports.TlsTcpTransporter = require_builtins_system_config_system_config_addon.T
28454
28550
  exports.ToastService = ToastService;
28455
28551
  exports.UDS_NO_ROUTE_PREFIX = UDS_NO_ROUTE_PREFIX;
28456
28552
  exports.UNCLAIMED = UNCLAIMED;
28553
+ exports.UNSUPPORTED_ADDON_SETTLE_MS = UNSUPPORTED_ADDON_SETTLE_MS;
28457
28554
  exports.UPLOADED_CA_FILE = require_hub_mdns_ciao.UPLOADED_CA_FILE;
28458
28555
  exports.USER_MANAGEMENT_INTERNAL = require_builtins_local_auth_local_auth_addon.USER_MANAGEMENT_INTERNAL;
28459
28556
  exports.UdsLocalTransportClient = UdsLocalTransportClient;
28460
28557
  exports.UdsLocalTransportServer = UdsLocalTransportServer;
28461
28558
  exports.UnlockTicketJtiStore = require_builtins_system_config_system_config_addon.UnlockTicketJtiStore;
28559
+ exports.UnsupportedAddonTracker = UnsupportedAddonTracker;
28462
28560
  exports.UserManager = require_builtins_local_auth_local_auth_addon.UserManager;
28463
28561
  exports.WinstonDestination = require_builtins_winston_logging_index.WinstonDestination$1;
28464
28562
  exports.WinstonLoggingAddon = require_builtins_winston_logging_index.WinstonLoggingAddon$1;