@camstack/system 1.2.430 → 1.2.432

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 (79) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/autotrack/index.js +1 -1
  8. package/dist/builtins/autotrack/index.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  11. package/dist/builtins/calendars/calendars.addon.js +1 -1
  12. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  13. package/dist/builtins/camera-grid/index.js +1 -1
  14. package/dist/builtins/camera-grid/index.mjs +1 -1
  15. package/dist/builtins/composer/composer.addon.js +2 -2
  16. package/dist/builtins/composer/composer.addon.mjs +2 -2
  17. package/dist/builtins/console-logging/index.js +1 -1
  18. package/dist/builtins/console-logging/index.mjs +1 -1
  19. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  20. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  21. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  22. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  23. package/dist/builtins/hub-forwarder/index.js +1 -1
  24. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  25. package/dist/builtins/keychain/index.js +3 -3
  26. package/dist/builtins/keychain/index.mjs +3 -3
  27. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  28. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  29. package/dist/builtins/local-auth/local-auth.addon.js +2 -2
  30. package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  31. package/dist/builtins/local-network/local-network.addon.js +1 -1
  32. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  33. package/dist/builtins/loki-logging/index.js +1 -1
  34. package/dist/builtins/loki-logging/index.mjs +1 -1
  35. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  36. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  37. package/dist/builtins/platform-probe/index.js +1 -1
  38. package/dist/builtins/platform-probe/index.mjs +1 -1
  39. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  40. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  41. package/dist/builtins/snapshot/index.js +1 -1
  42. package/dist/builtins/snapshot/index.mjs +1 -1
  43. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  44. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  45. package/dist/builtins/sqlite-storage/index.js +1 -1
  46. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  47. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  48. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  49. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  50. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  51. package/dist/builtins/system-config/system-config.addon.js +74 -10
  52. package/dist/builtins/system-config/system-config.addon.mjs +74 -11
  53. package/dist/builtins/winston-logging/index.js +1 -1
  54. package/dist/builtins/winston-logging/index.mjs +1 -1
  55. package/dist/{composition-sources-o5MPSlk6.js → composition-sources-CFlUdpO7.js} +1 -1
  56. package/dist/{composition-sources-Cw_TXEq9.mjs → composition-sources-DpbL38z3.mjs} +1 -1
  57. package/dist/{constants-CttE77VF.mjs → constants-B89vjrSm.mjs} +1 -1
  58. package/dist/{constants-BcNaVkvI.js → constants-DfP8V3eX.js} +1 -1
  59. package/dist/{device-ca-B-BTxeCj.mjs → device-ca-4IY98a_-.mjs} +1 -1
  60. package/dist/{device-ca-CKiqh2Iu.js → device-ca-BCyAPmIj.js} +1 -1
  61. package/dist/{dist-DxJdci75.js → dist-BCKOeWu_.js} +317 -1
  62. package/dist/{dist-CXG6muCR.mjs → dist-Bt8GTRHB.mjs} +317 -1
  63. package/dist/file-host-worker.js +1 -1
  64. package/dist/file-host-worker.mjs +1 -1
  65. package/dist/index.js +203 -53
  66. package/dist/index.mjs +198 -55
  67. package/dist/kernel/index.d.ts +4 -2
  68. package/dist/kernel/moleculer/broker-factory.d.ts +28 -2
  69. package/dist/kernel/moleculer/broker-transport-swap.d.ts +43 -0
  70. package/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +10 -0
  71. package/dist/kernel/moleculer/mesh-mtls/mesh-peer-transport.d.ts +7 -3
  72. package/dist/kernel/moleculer/mesh-mtls/mesh-renewal.d.ts +8 -1
  73. package/dist/{restore-archive-D_wBL1OO.mjs → restore-archive-Bh34W8J8.mjs} +1 -1
  74. package/dist/{restore-archive-CQJNoqRK.js → restore-archive-DhHH7VQp.js} +1 -1
  75. package/dist/{retired-settings-keys-EmDe11cP.mjs → retired-settings-keys-CmcEitC2.mjs} +1 -1
  76. package/dist/{retired-settings-keys-g1oifXxR.js → retired-settings-keys-u3Wwkdrq.js} +1 -1
  77. package/dist/{wal-maintenance-BW1LIHi0.js → wal-maintenance-ChzCPUi2.js} +0 -0
  78. package/dist/{wal-maintenance-vhPZLYuA.mjs → wal-maintenance-uQGuStFW.mjs} +0 -0
  79. package/package.json +2 -2
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DxJdci75.js");
6
+ const require_dist = require("../../dist-BCKOeWu_.js");
7
7
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
8
  const require_x509_es = require("../../x509.es-Dzl0BbmG.js");
9
9
  const require_agent_https_names = require("../../agent-https-names-CpUSuP4w.js");
10
- const require_constants$8 = require("../../constants-BcNaVkvI.js");
10
+ const require_constants$8 = require("../../constants-DfP8V3eX.js");
11
11
  const require_src$1 = require("../../src-CnAqG6EF.js");
12
12
  let zod = require("zod");
13
13
  let node_crypto = require("node:crypto");
@@ -792,7 +792,7 @@ var MeshCertificateRegistry = class {
792
792
  async recordObserved(nodeId, leaf) {
793
793
  const known = this.rows.get(leaf.fingerprint);
794
794
  if (known !== void 0) {
795
- if (known.revokedReason !== "renewal-abandoned") return false;
795
+ if (known.revokedReason !== "renewal-abandoned") return known.revokedAt === null ? this.abandonRenewalsNewerThan(known) : false;
796
796
  const reinstated = {
797
797
  ...known,
798
798
  revokedAt: null,
@@ -908,6 +908,29 @@ var MeshCertificateRegistry = class {
908
908
  return settled;
909
909
  }
910
910
  /** Set a never-completed renewal leaf aside (not current, NOT on the CRL). */
911
+ /** Fingerprints of renewal leaves whose handover is running right now (this process only). */
912
+ renewalsInFlight = /* @__PURE__ */ new Set();
913
+ /**
914
+ * A renewal's leaf is "in flight" from signing until the handover ends. While it is, a node seen
915
+ * presenting its OLD leaf is simply not swapped yet: the new leaf is not set aside (that would
916
+ * flap set-aside / reinstate on the node's first connection with it).
917
+ */
918
+ beginRenewal(fingerprint) {
919
+ this.renewalsInFlight.add(fingerprint);
920
+ }
921
+ endRenewal(fingerprint) {
922
+ this.renewalsInFlight.delete(fingerprint);
923
+ }
924
+ async abandonRenewalsNewerThan(presented) {
925
+ let changed = false;
926
+ for (const record of this.liveFor(presented.nodeId)) {
927
+ if (record.fingerprint === presented.fingerprint) continue;
928
+ if (record.issuedVia !== "renewal" || record.issuedAt <= presented.issuedAt) continue;
929
+ if (this.renewalsInFlight.has(record.fingerprint)) continue;
930
+ if (await this.abandon(record.fingerprint)) changed = true;
931
+ }
932
+ return changed;
933
+ }
911
934
  async abandon(fingerprint) {
912
935
  const record = this.rows.get(fingerprint);
913
936
  if (record === void 0 || record.revokedAt !== null) return false;
@@ -1063,6 +1086,24 @@ function message$1(error) {
1063
1086
  return error instanceof Error ? error.message : String(error);
1064
1087
  }
1065
1088
  async function renewMeshCertificate(deps) {
1089
+ const inFlight = { fingerprint: null };
1090
+ try {
1091
+ return await runRenewal(deps, inFlight);
1092
+ } finally {
1093
+ if (inFlight.fingerprint !== null) {
1094
+ deps.registry.endRenewal(inFlight.fingerprint);
1095
+ const live = deps.peers.peerLeaf(deps.nodeId);
1096
+ if (live !== void 0) await deps.registry.recordObserved(deps.nodeId, {
1097
+ cn: deps.nodeId,
1098
+ serial: live.serial,
1099
+ fingerprint: live.fingerprint,
1100
+ notBefore: live.notBefore,
1101
+ notAfter: live.notAfter
1102
+ }).catch(() => void 0);
1103
+ }
1104
+ }
1105
+ }
1106
+ async function runRenewal(deps, inFlight) {
1066
1107
  const { nodeId, log } = deps;
1067
1108
  const tags = { nodeId };
1068
1109
  const sleep = deps.sleep ?? defaultSleep;
@@ -1124,12 +1165,28 @@ async function renewMeshCertificate(deps) {
1124
1165
  return fail("issue", message$1(error), true);
1125
1166
  }
1126
1167
  const newLeaf = describeMeshLeaf(issued.certPem);
1168
+ deps.registry.beginRenewal(newLeaf.fingerprint);
1169
+ inFlight.fingerprint = newLeaf.fingerprint;
1127
1170
  let resolveRegistered = () => void 0;
1128
1171
  const registeredPromise = new Promise((resolve) => {
1129
1172
  resolveRegistered = resolve;
1130
1173
  });
1131
- const unsubscribe = deps.registrations.subscribe((id) => {
1132
- if (id === nodeId && deps.peers.peerLeaf(nodeId)?.fingerprint === newLeaf.fingerprint) resolveRegistered(true);
1174
+ const expected = deps.expectedAddons?.(nodeId) ?? [];
1175
+ let missingAddons = [];
1176
+ const unsubscribe = deps.registrations.subscribe((id, addonIds) => {
1177
+ if (id !== nodeId || deps.peers.peerLeaf(nodeId)?.fingerprint !== newLeaf.fingerprint) return;
1178
+ if (addonIds !== void 0) {
1179
+ const present = new Set(addonIds);
1180
+ missingAddons = expected.filter((addonId) => !present.has(addonId));
1181
+ if (missingAddons.length > 0) {
1182
+ log.warn("Mesh renewal: the node registered without addons it had before - waiting", {
1183
+ tags,
1184
+ meta: { missing: missingAddons }
1185
+ });
1186
+ return;
1187
+ }
1188
+ }
1189
+ resolveRegistered(true);
1133
1190
  });
1134
1191
  const deadlineTimer = setTimer(() => resolveRegistered(false), timeoutMs);
1135
1192
  registeredPromise.then(() => deadlineTimer.cancel());
@@ -1160,7 +1217,8 @@ async function renewMeshCertificate(deps) {
1160
1217
  }
1161
1218
  });
1162
1219
  await deps.registry.abandon(newLeaf.fingerprint);
1163
- return fail("reconnect", `the node was not back and registered with the new leaf within ${Math.round(timeoutMs / 1e3)} s; the previous leaf was kept and is still valid`, true);
1220
+ const lost = missingAddons.length > 0 ? ` (its last registration lacked ${missingAddons.length} addon(s) it had before: ${missingAddons.slice(0, 5).join(", ")}; the swap was rolled back and nothing was revoked - once those addons are running again the next renewal will go through)` : "";
1221
+ return fail("reconnect", `the node was not back and registered with the new leaf within ${Math.round(timeoutMs / 1e3)} s${lost}; the previous leaf was kept and is still valid`, true);
1164
1222
  }
1165
1223
  log.info("Mesh renewal: the node registered presenting the new leaf", { tags });
1166
1224
  let confirmError = "the node did not confirm the new leaf";
@@ -1280,10 +1338,14 @@ function onProcessNodeRegistered(listener) {
1280
1338
  listeners.delete(listener);
1281
1339
  };
1282
1340
  }
1283
- /** Called by the hub when a node's `registerNode` has been applied. */
1284
- function emitProcessNodeRegistered(nodeId) {
1341
+ /**
1342
+ * Called by the hub when a node's `registerNode` has been applied. `addonIds` is what that
1343
+ * registration carried (a node's own addons and its children's, D3), so a waiter can tell the
1344
+ * registration of a node that came back WHOLE from the first one of a node that lost its children.
1345
+ */
1346
+ function emitProcessNodeRegistered(nodeId, addonIds) {
1285
1347
  for (const listener of [...registrationListeners()]) try {
1286
- listener(nodeId);
1348
+ listener(nodeId, addonIds);
1287
1349
  } catch {}
1288
1350
  }
1289
1351
  //#endregion
@@ -87836,6 +87898,7 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
87836
87898
  });
87837
87899
  server.on("error", (err) => {
87838
87900
  this.logger.error("Mesh TLS server error.", err);
87901
+ if (this.tlsServer === server) this.tlsServer = null;
87839
87902
  reject(err);
87840
87903
  });
87841
87904
  server.listen({
@@ -87845,9 +87908,9 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
87845
87908
  const address = server.address();
87846
87909
  const port = address !== null && typeof address === "object" ? address.port : tlsPort;
87847
87910
  this.logger.info(`Mesh TLS server is listening on port ${port}`);
87911
+ this.tlsServer = server;
87848
87912
  resolve();
87849
87913
  });
87850
- this.tlsServer = server;
87851
87914
  });
87852
87915
  }
87853
87916
  onTlsClientConnected(socket) {
@@ -88676,6 +88739,7 @@ exports.ServiceBroker = ServiceBroker;
88676
88739
  exports.SystemConfigAddon = SystemConfigAddon;
88677
88740
  exports.default = SystemConfigAddon;
88678
88741
  exports.TlsTcpTransporter = TlsTcpTransporter;
88742
+ exports.Transporters = Transporters;
88679
88743
  exports.UnlockTicketJtiStore = UnlockTicketJtiStore;
88680
88744
  exports.caFingerprint = caFingerprint;
88681
88745
  exports.caFingerprintCompact = caFingerprintCompact;
@@ -1,9 +1,9 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Br as hydrateSchema, Fr as defineCustomActions, Gr as isSecretMarker, Pr as customAction, Wr as isSecretClear, _r as BaseAddon, ci as transformSecretWrite, gr as errMsg, ii as secretTreeFromSchema, qr as makeSecretMarker } from "../../dist-CXG6muCR.mjs";
2
+ import { Br as hydrateSchema, Fr as defineCustomActions, Gr as isSecretMarker, Pr as customAction, Wr as isSecretClear, _r as BaseAddon, ci as transformSecretWrite, gr as errMsg, ii as secretTreeFromSchema, qr as makeSecretMarker } from "../../dist-Bt8GTRHB.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
4
  import { a as KeyUsagesExtension, c as Pkcs10CertificateRequestGenerator, d as X509Certificate$1, f as X509CertificateGenerator, i as KeyUsageFlags, n as BasicConstraintsExtension, o as PemConverter, p as cryptoProvider, r as ExtendedKeyUsageExtension, s as Pkcs10CertificateRequest, t as AuthorityKeyIdentifierExtension, u as SubjectKeyIdentifierExtension } from "../../x509.es-CAjSsrkk.mjs";
5
5
  import { a as setProcessAgentHttpsNames, n as AGENT_HTTPS_NAMES_COLUMNS, r as AgentHttpsNames, t as AGENT_HTTPS_NAMES_COLLECTION } from "../../agent-https-names-uetr4OQl.mjs";
6
- import { a as MESH_CA_KEY_REF, b as setProcessClusterSecretGate, c as MESH_JOIN_TOKEN_MAX_TTL_SEC, d as CLUSTER_SECRET_REF, i as MESH_CA_FIELD, l as SERVER_AUTH_OID, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID, v as hashClusterSecret } from "../../constants-CttE77VF.mjs";
6
+ import { a as MESH_CA_KEY_REF, b as setProcessClusterSecretGate, c as MESH_JOIN_TOKEN_MAX_TTL_SEC, d as CLUSTER_SECRET_REF, i as MESH_CA_FIELD, l as SERVER_AUTH_OID, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID, v as hashClusterSecret } from "../../constants-B89vjrSm.mjs";
7
7
  import { t as require_src } from "../../src-hG4grMU4.mjs";
8
8
  import { z } from "zod";
9
9
  import { X509Certificate, createHash, createHmac, randomBytes, timingSafeEqual, webcrypto } from "node:crypto";
@@ -783,7 +783,7 @@ var MeshCertificateRegistry = class {
783
783
  async recordObserved(nodeId, leaf) {
784
784
  const known = this.rows.get(leaf.fingerprint);
785
785
  if (known !== void 0) {
786
- if (known.revokedReason !== "renewal-abandoned") return false;
786
+ if (known.revokedReason !== "renewal-abandoned") return known.revokedAt === null ? this.abandonRenewalsNewerThan(known) : false;
787
787
  const reinstated = {
788
788
  ...known,
789
789
  revokedAt: null,
@@ -899,6 +899,29 @@ var MeshCertificateRegistry = class {
899
899
  return settled;
900
900
  }
901
901
  /** Set a never-completed renewal leaf aside (not current, NOT on the CRL). */
902
+ /** Fingerprints of renewal leaves whose handover is running right now (this process only). */
903
+ renewalsInFlight = /* @__PURE__ */ new Set();
904
+ /**
905
+ * A renewal's leaf is "in flight" from signing until the handover ends. While it is, a node seen
906
+ * presenting its OLD leaf is simply not swapped yet: the new leaf is not set aside (that would
907
+ * flap set-aside / reinstate on the node's first connection with it).
908
+ */
909
+ beginRenewal(fingerprint) {
910
+ this.renewalsInFlight.add(fingerprint);
911
+ }
912
+ endRenewal(fingerprint) {
913
+ this.renewalsInFlight.delete(fingerprint);
914
+ }
915
+ async abandonRenewalsNewerThan(presented) {
916
+ let changed = false;
917
+ for (const record of this.liveFor(presented.nodeId)) {
918
+ if (record.fingerprint === presented.fingerprint) continue;
919
+ if (record.issuedVia !== "renewal" || record.issuedAt <= presented.issuedAt) continue;
920
+ if (this.renewalsInFlight.has(record.fingerprint)) continue;
921
+ if (await this.abandon(record.fingerprint)) changed = true;
922
+ }
923
+ return changed;
924
+ }
902
925
  async abandon(fingerprint) {
903
926
  const record = this.rows.get(fingerprint);
904
927
  if (record === void 0 || record.revokedAt !== null) return false;
@@ -1054,6 +1077,24 @@ function message$1(error) {
1054
1077
  return error instanceof Error ? error.message : String(error);
1055
1078
  }
1056
1079
  async function renewMeshCertificate(deps) {
1080
+ const inFlight = { fingerprint: null };
1081
+ try {
1082
+ return await runRenewal(deps, inFlight);
1083
+ } finally {
1084
+ if (inFlight.fingerprint !== null) {
1085
+ deps.registry.endRenewal(inFlight.fingerprint);
1086
+ const live = deps.peers.peerLeaf(deps.nodeId);
1087
+ if (live !== void 0) await deps.registry.recordObserved(deps.nodeId, {
1088
+ cn: deps.nodeId,
1089
+ serial: live.serial,
1090
+ fingerprint: live.fingerprint,
1091
+ notBefore: live.notBefore,
1092
+ notAfter: live.notAfter
1093
+ }).catch(() => void 0);
1094
+ }
1095
+ }
1096
+ }
1097
+ async function runRenewal(deps, inFlight) {
1057
1098
  const { nodeId, log } = deps;
1058
1099
  const tags = { nodeId };
1059
1100
  const sleep = deps.sleep ?? defaultSleep;
@@ -1115,12 +1156,28 @@ async function renewMeshCertificate(deps) {
1115
1156
  return fail("issue", message$1(error), true);
1116
1157
  }
1117
1158
  const newLeaf = describeMeshLeaf(issued.certPem);
1159
+ deps.registry.beginRenewal(newLeaf.fingerprint);
1160
+ inFlight.fingerprint = newLeaf.fingerprint;
1118
1161
  let resolveRegistered = () => void 0;
1119
1162
  const registeredPromise = new Promise((resolve) => {
1120
1163
  resolveRegistered = resolve;
1121
1164
  });
1122
- const unsubscribe = deps.registrations.subscribe((id) => {
1123
- if (id === nodeId && deps.peers.peerLeaf(nodeId)?.fingerprint === newLeaf.fingerprint) resolveRegistered(true);
1165
+ const expected = deps.expectedAddons?.(nodeId) ?? [];
1166
+ let missingAddons = [];
1167
+ const unsubscribe = deps.registrations.subscribe((id, addonIds) => {
1168
+ if (id !== nodeId || deps.peers.peerLeaf(nodeId)?.fingerprint !== newLeaf.fingerprint) return;
1169
+ if (addonIds !== void 0) {
1170
+ const present = new Set(addonIds);
1171
+ missingAddons = expected.filter((addonId) => !present.has(addonId));
1172
+ if (missingAddons.length > 0) {
1173
+ log.warn("Mesh renewal: the node registered without addons it had before - waiting", {
1174
+ tags,
1175
+ meta: { missing: missingAddons }
1176
+ });
1177
+ return;
1178
+ }
1179
+ }
1180
+ resolveRegistered(true);
1124
1181
  });
1125
1182
  const deadlineTimer = setTimer(() => resolveRegistered(false), timeoutMs);
1126
1183
  registeredPromise.then(() => deadlineTimer.cancel());
@@ -1151,7 +1208,8 @@ async function renewMeshCertificate(deps) {
1151
1208
  }
1152
1209
  });
1153
1210
  await deps.registry.abandon(newLeaf.fingerprint);
1154
- return fail("reconnect", `the node was not back and registered with the new leaf within ${Math.round(timeoutMs / 1e3)} s; the previous leaf was kept and is still valid`, true);
1211
+ const lost = missingAddons.length > 0 ? ` (its last registration lacked ${missingAddons.length} addon(s) it had before: ${missingAddons.slice(0, 5).join(", ")}; the swap was rolled back and nothing was revoked - once those addons are running again the next renewal will go through)` : "";
1212
+ return fail("reconnect", `the node was not back and registered with the new leaf within ${Math.round(timeoutMs / 1e3)} s${lost}; the previous leaf was kept and is still valid`, true);
1155
1213
  }
1156
1214
  log.info("Mesh renewal: the node registered presenting the new leaf", { tags });
1157
1215
  let confirmError = "the node did not confirm the new leaf";
@@ -1271,10 +1329,14 @@ function onProcessNodeRegistered(listener) {
1271
1329
  listeners.delete(listener);
1272
1330
  };
1273
1331
  }
1274
- /** Called by the hub when a node's `registerNode` has been applied. */
1275
- function emitProcessNodeRegistered(nodeId) {
1332
+ /**
1333
+ * Called by the hub when a node's `registerNode` has been applied. `addonIds` is what that
1334
+ * registration carried (a node's own addons and its children's, D3), so a waiter can tell the
1335
+ * registration of a node that came back WHOLE from the first one of a node that lost its children.
1336
+ */
1337
+ function emitProcessNodeRegistered(nodeId, addonIds) {
1276
1338
  for (const listener of [...registrationListeners()]) try {
1277
- listener(nodeId);
1339
+ listener(nodeId, addonIds);
1278
1340
  } catch {}
1279
1341
  }
1280
1342
  //#endregion
@@ -87827,6 +87889,7 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
87827
87889
  });
87828
87890
  server.on("error", (err) => {
87829
87891
  this.logger.error("Mesh TLS server error.", err);
87892
+ if (this.tlsServer === server) this.tlsServer = null;
87830
87893
  reject(err);
87831
87894
  });
87832
87895
  server.listen({
@@ -87836,9 +87899,9 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
87836
87899
  const address = server.address();
87837
87900
  const port = address !== null && typeof address === "object" ? address.port : tlsPort;
87838
87901
  this.logger.info(`Mesh TLS server is listening on port ${port}`);
87902
+ this.tlsServer = server;
87839
87903
  resolve();
87840
87904
  });
87841
- this.tlsServer = server;
87842
87905
  });
87843
87906
  }
87844
87907
  onTlsClientConnected(socket) {
@@ -88647,4 +88710,4 @@ function readJwtExp(token) {
88647
88710
  return typeof exp === "number" ? exp : 0;
88648
88711
  }
88649
88712
  //#endregion
88650
- export { MESH_AUTH_MODE_FIELD as $, MeshCrl as A, generateMeshKeyPair as B, MESH_NODE_CERTIFICATES_COLLECTION as C, describeMeshLeaf as D, RENEWAL_ABANDONED as E, caFingerprint as F, AGENT_UI_UNLOCK_DOMAIN as G, issueMeshLeafFromCsr as H, caFingerprintCompact as I, UnlockTicketJtiStore as J, AGENT_UI_UNLOCK_TTL_MS as K, createMeshCsrPem as L, MeshCaKeeper as M, getProcessMeshCaState as N, getProcessMeshCertificateRegistry as O, requireProcessMeshCa as P, verifyAgentUiUnlockTicket as Q, exportMeshPrivateKeyPem as R, setProcessMeshTlsListenerState as S, SYSTEM_CONFIG_CLUSTER_SECTION_ID, SystemConfigAddon, SystemConfigAddon as default, MeshCertificateRegistry as T, loadMeshCa as U, issueMeshLeafForNode as V, AGENT_DASHBOARD_ORIGINS_FIELD as W, mintAgentUiUnlockTicket as X, isAllowedAgentDashboardReturnTo as Y, parseAgentDashboardOrigins as Z, setProcessMeshPeerTransportLookup as _, ServiceBroker as a, setProcessMeshAuthMode as at, getProcessMeshTlsListenerState as b, JoinTokenJtiStore as c, createCidrMatcher as ct, verifyMeshJoinToken as d, readCidrSetting as dt, getProcessMeshAuthMode as et, dropProcessPeer as f, onProcessNodeRegistered as g, getProcessPeerLeaf as h, Errors as i, requestProcessMeshEnforcement as it, processMeshCrl as j, setProcessMeshCertificateRegistry as k, mintMeshJoinToken as l, normalizeIp as lt, getProcessNodeMeshTransport as m, MESH_TLS_PORT_HELLO_FIELD as n, isMeshAuthMode as nt, setProcessMeshTlsEnabler as o, setProcessMeshAuthStatusSource as ot, emitProcessNodeRegistered as p, AGENT_UI_UNLOCK_VERSION as q, TlsTcpTransporter as r, parseMeshAuthMode as rt, enrollMeshNode as s, setProcessMeshEnforcer as st, systemConfigMeshActions as t, getProcessMeshAuthStatus as tt, processJoinTokenJtiStore as u, parseCidrList as ut, renewMeshCertificate as v, MESH_NODE_CERTIFICATES_COLUMNS as w, openMeshTlsWhenRevocationsLoaded as x, revokeMeshCertificate as y, generateMeshCa as z };
88713
+ export { verifyAgentUiUnlockTicket as $, setProcessMeshCertificateRegistry as A, generateMeshCa as B, setProcessMeshTlsListenerState as C, RENEWAL_ABANDONED as D, MeshCertificateRegistry as E, requireProcessMeshCa as F, AGENT_DASHBOARD_ORIGINS_FIELD as G, issueMeshLeafForNode as H, caFingerprint as I, AGENT_UI_UNLOCK_VERSION as J, AGENT_UI_UNLOCK_DOMAIN as K, caFingerprintCompact as L, processMeshCrl as M, MeshCaKeeper as N, describeMeshLeaf as O, getProcessMeshCaState as P, parseAgentDashboardOrigins as Q, createMeshCsrPem as R, openMeshTlsWhenRevocationsLoaded as S, SYSTEM_CONFIG_CLUSTER_SECTION_ID, SystemConfigAddon, SystemConfigAddon as default, MESH_NODE_CERTIFICATES_COLUMNS as T, issueMeshLeafFromCsr as U, generateMeshKeyPair as V, loadMeshCa as W, isAllowedAgentDashboardReturnTo as X, UnlockTicketJtiStore as Y, mintAgentUiUnlockTicket as Z, onProcessNodeRegistered as _, ServiceBroker as a, requestProcessMeshEnforcement as at, revokeMeshCertificate as b, enrollMeshNode as c, setProcessMeshEnforcer as ct, processJoinTokenJtiStore as d, parseCidrList as dt, MESH_AUTH_MODE_FIELD as et, verifyMeshJoinToken as f, readCidrSetting as ft, getProcessPeerLeaf as g, getProcessNodeMeshTransport as h, Errors as i, parseMeshAuthMode as it, MeshCrl as j, getProcessMeshCertificateRegistry as k, JoinTokenJtiStore as l, createCidrMatcher as lt, emitProcessNodeRegistered as m, MESH_TLS_PORT_HELLO_FIELD as n, getProcessMeshAuthStatus as nt, Transporters as o, setProcessMeshAuthMode as ot, dropProcessPeer as p, AGENT_UI_UNLOCK_TTL_MS as q, TlsTcpTransporter as r, isMeshAuthMode as rt, setProcessMeshTlsEnabler as s, setProcessMeshAuthStatusSource as st, systemConfigMeshActions as t, getProcessMeshAuthMode as tt, mintMeshJoinToken as u, normalizeIp as ut, setProcessMeshPeerTransportLookup as v, MESH_NODE_CERTIFICATES_COLLECTION as w, getProcessMeshTlsListenerState as x, renewMeshCertificate as y, exportMeshPrivateKeyPem as z };
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DxJdci75.js");
6
+ const require_dist = require("../../dist-BCKOeWu_.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_chunk.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { _r as BaseAddon, an as logDestinationCapability } from "../../dist-CXG6muCR.mjs";
1
+ import { _r as BaseAddon, an as logDestinationCapability } from "../../dist-Bt8GTRHB.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  import * as path$1 from "node:path";
4
4
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-DxJdci75.js");
1
+ const require_dist = require("./dist-BCKOeWu_.js");
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,4 +1,4 @@
1
- import { gr as errMsg, lr as compositionSourceKey } from "./dist-CXG6muCR.mjs";
1
+ import { gr as errMsg, lr as compositionSourceKey } from "./dist-Bt8GTRHB.mjs";
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,4 +1,4 @@
1
- import { Ar as buildSecretRef } from "./dist-CXG6muCR.mjs";
1
+ import { Ar as buildSecretRef } from "./dist-Bt8GTRHB.mjs";
2
2
  import { createHash, timingSafeEqual } from "node:crypto";
3
3
  //#region src/kernel/moleculer/cluster-secret.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-DxJdci75.js");
1
+ const require_dist = require("./dist-BCKOeWu_.js");
2
2
  let node_crypto = require("node:crypto");
3
3
  //#region src/kernel/moleculer/cluster-secret.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Ar as buildSecretRef, C as DEVICE_SAN_CREDENTIAL_PREFIX, w as DEVICE_SAN_USER_PREFIX } from "./dist-CXG6muCR.mjs";
1
+ import { Ar as buildSecretRef, C as DEVICE_SAN_CREDENTIAL_PREFIX, w as DEVICE_SAN_USER_PREFIX } from "./dist-Bt8GTRHB.mjs";
2
2
  import { a as KeyUsagesExtension, d as X509Certificate$1, f as X509CertificateGenerator, i as KeyUsageFlags, l as SubjectAlternativeNameExtension, n as BasicConstraintsExtension, o as PemConverter, p as cryptoProvider, r as ExtendedKeyUsageExtension, t as AuthorityKeyIdentifierExtension, u as SubjectKeyIdentifierExtension } from "./x509.es-CAjSsrkk.mjs";
3
3
  import { X509Certificate, createPublicKey, randomBytes, verify, webcrypto } from "node:crypto";
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-DxJdci75.js");
1
+ const require_dist = require("./dist-BCKOeWu_.js");
2
2
  const require_x509_es = require("./x509.es-Dzl0BbmG.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/auth/jwt-signing-key.ts