@camstack/system 1.2.435 → 1.2.437

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 (107) hide show
  1. package/dist/{agent-https-B8lKYVtU.mjs → agent-https-BPfHrI4c.mjs} +3 -3
  2. package/dist/auth/login-session-manager.d.ts +2 -0
  3. package/dist/auth/session-revocation-bus.d.ts +32 -0
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  8. package/dist/builtins/alerts/alerts.addon.js +1 -1
  9. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  10. package/dist/builtins/autotrack/index.js +1 -1
  11. package/dist/builtins/autotrack/index.mjs +1 -1
  12. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  14. package/dist/builtins/calendars/calendars.addon.js +1 -1
  15. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  16. package/dist/builtins/camera-grid/index.js +1 -1
  17. package/dist/builtins/camera-grid/index.mjs +1 -1
  18. package/dist/builtins/composer/composer.addon.js +2 -2
  19. package/dist/builtins/composer/composer.addon.mjs +2 -2
  20. package/dist/builtins/console-logging/index.js +1 -1
  21. package/dist/builtins/console-logging/index.mjs +1 -1
  22. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  23. package/dist/builtins/core-blocks/core-blocks.addon.mjs +5 -5
  24. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  25. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  26. package/dist/builtins/hub-forwarder/index.js +1 -1
  27. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  28. package/dist/builtins/keychain/index.js +6 -7
  29. package/dist/builtins/keychain/index.mjs +6 -7
  30. package/dist/builtins/keychain/keychain-service.d.ts +1 -2
  31. package/dist/builtins/keychain/system-held-secrets.d.ts +5 -5
  32. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  33. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  34. package/dist/builtins/local-auth/local-auth.addon.js +43 -2
  35. package/dist/builtins/local-auth/local-auth.addon.mjs +43 -3
  36. package/dist/builtins/local-network/local-network.addon.js +1 -1
  37. package/dist/builtins/local-network/local-network.addon.mjs +4 -4
  38. package/dist/builtins/loki-logging/index.js +1 -1
  39. package/dist/builtins/loki-logging/index.mjs +1 -1
  40. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  41. package/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
  42. package/dist/builtins/platform-probe/index.js +1 -1
  43. package/dist/builtins/platform-probe/index.mjs +8 -8
  44. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  45. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  46. package/dist/builtins/snapshot/index.js +1 -1
  47. package/dist/builtins/snapshot/index.mjs +1 -1
  48. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  49. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  50. package/dist/builtins/sqlite-storage/index.js +1 -1
  51. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  52. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  53. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  54. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  55. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  56. package/dist/builtins/system-config/system-config.addon.d.ts +11 -23
  57. package/dist/builtins/system-config/system-config.addon.js +219 -1479
  58. package/dist/builtins/system-config/system-config.addon.mjs +222 -1472
  59. package/dist/builtins/winston-logging/index.js +1 -1
  60. package/dist/builtins/winston-logging/index.mjs +1 -1
  61. package/dist/{composition-sources-Cm42mgbv.js → composition-sources-BIT8IUKm.js} +1 -1
  62. package/dist/{composition-sources-_7W2Ly9s.mjs → composition-sources-tpYR0f1x.mjs} +1 -1
  63. package/dist/constants-Bc6trhoW.mjs +20 -0
  64. package/dist/constants-CwRY32Nx.js +66 -0
  65. package/dist/{device-ca-B6YJZus6.mjs → device-ca-BhdBByGD.mjs} +1 -1
  66. package/dist/{device-ca-WXuKc8AX.js → device-ca-DImD8IzR.js} +1 -1
  67. package/dist/{dist-CnUtkSwN.js → dist-CEAyXW3Q.js} +42 -12
  68. package/dist/{dist-Bz4_y8Xy.mjs → dist-m5JkT8UN.mjs} +33 -3
  69. package/dist/file-host-worker.js +1 -1
  70. package/dist/file-host-worker.mjs +1 -1
  71. package/dist/{hub-mdns-ciao-DJRwtlA8.mjs → hub-mdns-ciao-DMlQTdPU.mjs} +1 -1
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.js +135 -796
  74. package/dist/index.mjs +150 -769
  75. package/dist/kernel/index.d.ts +7 -21
  76. package/dist/kernel/moleculer/agent-ui-unlock.d.ts +7 -32
  77. package/dist/kernel/moleculer/broker-factory.d.ts +3 -9
  78. package/dist/kernel/moleculer/broker-transport-swap.d.ts +17 -0
  79. package/dist/kernel/moleculer/hub-service.d.ts +6 -16
  80. package/dist/kernel/moleculer/mesh-access-middleware.d.ts +7 -17
  81. package/dist/kernel/moleculer/mesh-identity.d.ts +57 -0
  82. package/dist/kernel/moleculer/mesh-mtls/constants.d.ts +1 -4
  83. package/dist/kernel/moleculer/mesh-mtls/index.d.ts +1 -4
  84. package/dist/kernel/moleculer/mesh-mtls/mesh-ca.d.ts +1 -1
  85. package/dist/kernel/moleculer/mesh-mtls/mesh-renewal.d.ts +1 -1
  86. package/dist/kernel/moleculer/node-registry.d.ts +0 -6
  87. package/dist/kernel/moleculer/register-node-client.d.ts +9 -7
  88. package/dist/{restore-archive-BNoFLAg8.js → restore-archive-C75srVbG.js} +1 -1
  89. package/dist/{restore-archive-DJYuznWP.mjs → restore-archive-DNxAStrJ.mjs} +1 -1
  90. package/dist/{retired-settings-keys-9nA85bwT.mjs → retired-settings-keys-C5qP9QIf.mjs} +1 -1
  91. package/dist/{retired-settings-keys-CO3RqsDw.js → retired-settings-keys-DNfV28R_.js} +1 -1
  92. package/dist/{wal-maintenance-D3gwRj1B.js → wal-maintenance-Ch79gy9S.js} +0 -0
  93. package/dist/{wal-maintenance-DLrbapzi.mjs → wal-maintenance-DvnVO5IK.mjs} +0 -0
  94. package/package.json +1 -1
  95. package/dist/builtins/system-config/cluster-secret-keeper.d.ts +0 -63
  96. package/dist/constants-DL87WgeN.js +0 -221
  97. package/dist/constants-DoiTA134.mjs +0 -102
  98. package/dist/kernel/moleculer/agent-mesh-authenticator.d.ts +0 -91
  99. package/dist/kernel/moleculer/cluster-secret.d.ts +0 -46
  100. package/dist/kernel/moleculer/mesh-auth-mode.d.ts +0 -58
  101. package/dist/kernel/moleculer/mesh-authenticator.d.ts +0 -77
  102. package/dist/kernel/moleculer/mesh-auto-enforce.d.ts +0 -46
  103. package/dist/kernel/moleculer/mesh-join-client.d.ts +0 -73
  104. package/dist/kernel/moleculer/mesh-join-hold.d.ts +0 -85
  105. package/dist/kernel/moleculer/mesh-join-proof.d.ts +0 -39
  106. package/dist/kernel/moleculer/mesh-mtls/mesh-enroll.d.ts +0 -34
  107. package/dist/kernel/moleculer/mesh-mtls/mesh-join-token.d.ts +0 -56
package/dist/index.js CHANGED
@@ -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-CnUtkSwN.js");
4
- const require_device_ca = require("./device-ca-WXuKc8AX.js");
3
+ const require_dist = require("./dist-CEAyXW3Q.js");
4
+ const require_device_ca = require("./device-ca-DImD8IzR.js");
5
5
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
6
6
  require("./builtins/alerts/index.js");
7
7
  const require_builtins_calendars_calendars_addon = require("./builtins/calendars/calendars.addon.js");
@@ -22,13 +22,13 @@ require("./builtins/local-auth/index.js");
22
22
  const require_builtins_loki_logging_index = require("./builtins/loki-logging/index.js");
23
23
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
24
24
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
25
- const require_wal_maintenance = require("./wal-maintenance-D3gwRj1B.js");
25
+ const require_wal_maintenance = require("./wal-maintenance-Ch79gy9S.js");
26
26
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
27
27
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
28
28
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
29
29
  require("./builtins/storage-orchestrator/index.js");
30
30
  const require_agent_https = require("./agent-https-BZIwS4xF.js");
31
- const require_constants = require("./constants-DL87WgeN.js");
31
+ const require_constants = require("./constants-CwRY32Nx.js");
32
32
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
33
33
  require("./builtins/system-config/index.js");
34
34
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
@@ -36,7 +36,7 @@ const require_custom_action_registry = require("./custom-action-registry-Bf_Ynag
36
36
  const require_hub_mdns_ciao = require("./hub-mdns-ciao-CBLvq2oj.js");
37
37
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
38
38
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
39
- const require_restore_archive = require("./restore-archive-BNoFLAg8.js");
39
+ const require_restore_archive = require("./restore-archive-C75srVbG.js");
40
40
  let zod = require("zod");
41
41
  let node_crypto = require("node:crypto");
42
42
  node_crypto = require_chunk.__toESM(node_crypto);
@@ -14451,7 +14451,8 @@ var STORE_READABLE_BOOTSTRAP_KEYS = new Set([
14451
14451
  "auth.tokenExpiry",
14452
14452
  "auth.accessTokenExpiry",
14453
14453
  "auth.trustedProxies",
14454
- "auth.trustedNetworks"
14454
+ "auth.trustedNetworks",
14455
+ "server.name"
14455
14456
  ]);
14456
14457
  /** May the settings store answer `key`, or is it env + config.yaml only? */
14457
14458
  function storeMayAnswer(key) {
@@ -15183,11 +15184,10 @@ function createBroker(config) {
15183
15184
  },
15184
15185
  metrics: metricsConfig
15185
15186
  });
15186
- const transport = createAgentTransport(config);
15187
15187
  return new require_builtins_system_config_system_config_addon.ServiceBroker({
15188
15188
  nodeID,
15189
15189
  serializer: "MsgPack",
15190
- transporter: transport.kind === "tls" ? transport.transporter : transport.descriptor,
15190
+ transporter: createAgentTransport(config).transporter,
15191
15191
  ...config.middlewares !== void 0 ? { middlewares: [...config.middlewares] } : {},
15192
15192
  logger: {
15193
15193
  type: "Console",
@@ -15222,37 +15222,21 @@ function createAgentTransport(config) {
15222
15222
  const useHostname = resolveUseHostname();
15223
15223
  const agentListenPort = config.agentListenPort ?? deriveAgentListenPort(nodeID);
15224
15224
  const hubDialPort = config.meshTls !== void 0 ? config.tlsPort ?? 6443 : tcpPort;
15225
- if (config.meshTls !== void 0) {
15226
- const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
15227
- return {
15228
- kind: "tls",
15229
- transporter: new require_builtins_system_config_system_config_addon.TlsTcpTransporter({
15230
- port: agentListenPort,
15231
- tlsPort: config.agentTlsListenPort ?? 6443,
15232
- peerTlsPort: hubDialPort,
15233
- hubOnlyPeers: true,
15234
- maxPacketSize: 10 * 1024 * 1024,
15235
- useHostname,
15236
- debug: false,
15237
- meshTls: config.meshTls,
15238
- udpDiscovery: false,
15239
- ...urls !== void 0 ? { urls } : {}
15240
- })
15241
- };
15242
- }
15225
+ const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
15243
15226
  return {
15244
- kind: "tcp",
15245
- descriptor: {
15246
- type: "TCP",
15247
- options: {
15248
- maxPacketSize: 10 * 1024 * 1024,
15249
- port: agentListenPort,
15250
- useHostname,
15251
- debug: false,
15252
- udpDiscovery: false,
15253
- ...hubAddress ? { urls: normalizeHubUrl(hubAddress, tcpPort) } : {}
15254
- }
15255
- }
15227
+ kind: "tls",
15228
+ transporter: new require_builtins_system_config_system_config_addon.TlsTcpTransporter({
15229
+ port: agentListenPort,
15230
+ tlsPort: config.agentTlsListenPort ?? 6443,
15231
+ peerTlsPort: hubDialPort,
15232
+ hubOnlyPeers: true,
15233
+ maxPacketSize: 10 * 1024 * 1024,
15234
+ useHostname,
15235
+ debug: false,
15236
+ ...config.meshTls !== void 0 ? { meshTls: config.meshTls } : {},
15237
+ udpDiscovery: false,
15238
+ ...urls !== void 0 ? { urls } : {}
15239
+ })
15256
15240
  };
15257
15241
  }
15258
15242
  function normalizeHubUrl(raw, defaultPort) {
@@ -15271,23 +15255,6 @@ function getBrokerTlsTransporter(broker) {
15271
15255
  }
15272
15256
  //#endregion
15273
15257
  //#region src/kernel/moleculer/broker-transport-swap.ts
15274
- /**
15275
- * Reconnecting a broker's TRANSPORT in place, without rebuilding the broker (D856 amendment).
15276
- *
15277
- * An agent changes how it dials the hub (a new hub address, a new cluster secret, a mesh leaf
15278
- * swap or its rollback) by replacing its transporter. It used to stop the whole `ServiceBroker`
15279
- * and build another. That threw away everything bound to the old one: the `$process` service
15280
- * (whose `stopped()` SIGTERMs every runner - the "child gone" lines), `$agent-cap-fwd`,
15281
- * `$agent`, the event bus, the addon services and every closure that captured the broker. The
15282
- * node came back ONLINE and capless, and the hub's confirm step then failed with
15283
- * "`$agent-cap-fwd.forward` is not found".
15284
- *
15285
- * The broker, its services, its registries and its child runners are all independent of the
15286
- * wire. So only the wire is replaced: disconnect the transit, forget the remote nodes (their
15287
- * connection is gone, and the next `$node.connected` is what re-runs the mesh join), install a
15288
- * new transporter on the SAME transit and connect it. Children never notice; the join's settle
15289
- * re-sends the full manifest (D3), which still carries every child.
15290
- */
15291
15258
  function isObject(value) {
15292
15259
  return typeof value === "object" && value !== null;
15293
15260
  }
@@ -15322,7 +15289,7 @@ function currentBrokerTransporter(broker) {
15322
15289
  }
15323
15290
  /** Build the transporter an {@link AgentTransport} describes (nothing is bound or dialled yet). */
15324
15291
  function buildTransporter(transport) {
15325
- const tx = transport.kind === "tls" ? transport.transporter : require_builtins_system_config_system_config_addon.Transporters.resolve(transport.descriptor);
15292
+ const tx = transport.transporter;
15326
15293
  if (!isTransporterLike(tx)) throw new Error("the agent transport is not a Moleculer transporter");
15327
15294
  return { tx };
15328
15295
  }
@@ -23740,23 +23707,8 @@ function createHubService(deps) {
23740
23707
  deps.onSetLogLevel?.(ctx.params.level);
23741
23708
  return true;
23742
23709
  } },
23743
- joinChallenge: { handler(ctx) {
23744
- if (deps.meshAuth === void 0) throw new require_builtins_system_config_system_config_addon.Errors.MoleculerClientError("mesh join is not enabled on this node", 404);
23745
- return deps.meshAuth.issueChallenge(senderOf$1(ctx));
23746
- } },
23747
- authenticateNode: { handler(ctx) {
23748
- if (deps.meshAuth === void 0) throw new require_builtins_system_config_system_config_addon.Errors.MoleculerClientError("mesh join is not enabled on this node", 404);
23749
- return deps.meshAuth.authenticate(senderOf$1(ctx), ctx.params);
23750
- } },
23751
23710
  registerNode: { handler(ctx) {
23752
- if (deps.meshAuth !== void 0) {
23753
- deps.meshAuth.admitRegistration(senderOf$1(ctx), ctx.params);
23754
- deps.onRegisterNode?.(ctx.params);
23755
- return { ok: true };
23756
- }
23757
- const verdict = require_constants.checkClusterSecret(deps.clusterSecretGate?.() ?? { kind: "off" }, ctx.params.clusterSecretHash);
23758
- if (verdict === "mismatch") throw new require_builtins_system_config_system_config_addon.Errors.MoleculerError(`cluster secret mismatch — node "${ctx.params.nodeId}" rejected`, 403, require_constants.CLUSTER_SECRET_MISMATCH_TYPE);
23759
- if (verdict === "unavailable") throw new require_builtins_system_config_system_config_addon.Errors.MoleculerRetryableError(`the hub cannot read its cluster secret yet — node "${ctx.params.nodeId}" must retry`, 503, require_constants.CLUSTER_SECRET_UNAVAILABLE_TYPE);
23711
+ deps.meshIdentity?.admitRegistration(senderOf$1(ctx), ctx.params.nodeId);
23760
23712
  deps.onRegisterNode?.(ctx.params);
23761
23713
  return { ok: true };
23762
23714
  } },
@@ -23903,14 +23855,14 @@ var HubNodeRegistry = class {
23903
23855
  //#region src/kernel/moleculer/register-node-client.ts
23904
23856
  /**
23905
23857
  * Build a `RegisterNodeParams` from a node id, its per-addon manifests,
23906
- * optionally its device-scoped native caps, optionally the SHA-256 hash
23907
- * of the cluster secret, and optionally the node's root-package identity
23908
- * (runtime-updatable node packages: version visibility). `nativeCaps` is
23909
- * omitted entirely on the first handshake; `clusterSecretHash` is omitted
23910
- * when no secret is configured; `rootPackage` is omitted by nodes that do
23911
- * not run the root-package model (UDS children).
23912
- */
23913
- function buildNodeManifest(nodeId, addons, nativeCaps, clusterSecretHash, rootPackage) {
23858
+ * optionally its device-scoped native caps, and optionally the node's
23859
+ * root-package identity (runtime-updatable node packages: version
23860
+ * visibility). `nativeCaps` is omitted entirely on the first handshake;
23861
+ * `rootPackage` is omitted by nodes that do not run the root-package model
23862
+ * (UDS children). Who the sender is comes from its certificate (D857), not
23863
+ * from the payload.
23864
+ */
23865
+ function buildNodeManifest(nodeId, addons, nativeCaps, rootPackage) {
23914
23866
  return {
23915
23867
  nodeId,
23916
23868
  addons: addons.map((a) => ({
@@ -23922,7 +23874,6 @@ function buildNodeManifest(nodeId, addons, nativeCaps, clusterSecretHash, rootPa
23922
23874
  addonId: n.addonId,
23923
23875
  deviceIds: [...n.deviceIds]
23924
23876
  })) },
23925
- ...clusterSecretHash === void 0 ? {} : { clusterSecretHash },
23926
23877
  ...rootPackage === void 0 ? {} : { rootPackage: {
23927
23878
  name: rootPackage.name,
23928
23879
  version: rootPackage.version
@@ -23960,10 +23911,7 @@ async function callRegisterNodeWithRetry(broker, params, opts) {
23960
23911
  if (attempt > 0) opts.log?.(`[register-node] ${action} acked after ${attempt + 1} attempt(s)`);
23961
23912
  return;
23962
23913
  } catch (err) {
23963
- if (require_constants.isClusterSecretMismatchError(err)) {
23964
- opts.log?.(`[register-node] ${action} REJECTED — cluster secret mismatch; not retrying`);
23965
- throw err;
23966
- }
23914
+ opts.onAttemptFailed?.(err);
23967
23915
  attempt++;
23968
23916
  const wait = Math.min(base * 2 ** (attempt - 1), 5e3);
23969
23917
  opts.log?.(`[register-node] ${action} failed (attempt ${attempt}) — retrying in ${wait}ms: ${err instanceof Error ? err.message : String(err)}`);
@@ -23972,180 +23920,64 @@ async function callRegisterNodeWithRetry(broker, params, opts) {
23972
23920
  }
23973
23921
  }
23974
23922
  //#endregion
23975
- //#region src/kernel/moleculer/mesh-join-proof.ts
23976
- /**
23977
- * Mesh join — the challenge–response that authenticates a node to the hub
23978
- * (D802). Shared by the hub (`$hub.joinChallenge` / `$hub.authenticateNode`)
23979
- * and the agent (`MeshJoinClient`).
23980
- *
23981
- * The exchange, over the clear-text Moleculer transport:
23982
- *
23983
- * agent → hub `$hub.joinChallenge {}` → { nonce }
23984
- * agent → hub `$hub.authenticateNode { nodeId, nonce,
23985
- * clientNonce, proof }` → { hubProof }
23986
- *
23987
- * proof = HMAC-SHA256(K, "camstack-mesh-join/v1|node|<nodeId>|<nonce>")
23988
- * hubProof = HMAC-SHA256(K, "camstack-mesh-join/v1|hub|<nodeId>|<nonce>|<clientNonce>")
23989
- * K = SHA-256(cluster secret) — the value each side already holds
23990
- *
23991
- * What it buys over the D797 hash (`clusterSecretHash` in `registerNode`):
23992
- * - nothing reusable crosses the wire: the nonce is the hub's, single use,
23993
- * short-lived and bound to the SENDER node id, so a sniffed proof answers a
23994
- * challenge that no longer exists;
23995
- * - the agent authenticates the HUB too (`hubProof` over the agent's own
23996
- * nonce): a rogue node answering to `hub` on the LAN — found through UDP
23997
- * discovery — cannot prove it knows the secret, and the agent refuses it.
23998
- *
23999
- * What it does NOT buy: the transport stays clear text, and the sender node id
24000
- * of every later packet is self-declared. A LAN host that watches a node join
24001
- * can still spoof that node id afterwards. Only mutual TLS (the next step,
24002
- * `docs/design/2026-10-09-mesh-mtls-plan.md`) closes that.
24003
- */
24004
- /** Protocol version carried by the challenge; the agent refuses one it does not speak. */
24005
- var MESH_JOIN_PROTOCOL = 1;
24006
- var DOMAIN = "camstack-mesh-join/v1";
24007
- /** The hub's action that hands out a single-use nonce. */
24008
- var MESH_JOIN_CHALLENGE_ACTION = "$hub.joinChallenge";
24009
- /** The hub's action that verifies a node's proof and answers with its own. */
24010
- var MESH_JOIN_AUTHENTICATE_ACTION = "$hub.authenticateNode";
24011
- /** Moleculer error `type`: the sender has not authenticated and the hub enforces it. */
23923
+ //#region src/kernel/moleculer/mesh-identity.ts
23924
+ /**
23925
+ * Mesh identity (D857) — who is calling a node, decided by the CERTIFICATE.
23926
+ *
23927
+ * There is no shared secret. A node is admitted by the mesh when its mutual-TLS
23928
+ * handshake chained to the mesh CA, its leaf CN is the node id it speaks as, and
23929
+ * the leaf is not revoked (D856). The transport enforces the first two on every
23930
+ * packet (`TlsTcpTransporter.onIncomingMessage` drops a `sender` that is not the
23931
+ * peer CN), and answers the third through `verifiedPeer`. These gates do one
23932
+ * thing: turn "is this sender a verified peer" into allow or deny, and keep a
23933
+ * short list of actions no other node may ever call.
23934
+ *
23935
+ * Hub gate: every other node must be a verified peer.
23936
+ * Agent gate: only the verified hub may call an agent; an agent's mesh has no
23937
+ * other peer (D848).
23938
+ *
23939
+ * Nothing here reads a credential, mints a nonce or remembers a node's state:
23940
+ * a verdict is a pure function of the transport's current knowledge, so a
23941
+ * revocation takes effect on the next packet.
23942
+ */
23943
+ /** Moleculer error `type`: the sender has no certificate identity this node accepts. */
24012
23944
  var MESH_NODE_UNAUTHENTICATED_TYPE = "MESH_NODE_UNAUTHENTICATED";
24013
23945
  /** Moleculer error `type`: the action is never callable from another node. */
24014
23946
  var MESH_ACTION_FORBIDDEN_TYPE = "MESH_ACTION_FORBIDDEN";
24015
- /** Moleculer error `type`: the challenge is unknown, used or expired — ask for a new one. */
24016
- var MESH_JOIN_CHALLENGE_INVALID_TYPE = "MESH_JOIN_CHALLENGE_INVALID";
24017
- /** A fresh 32-byte nonce, hex. */
24018
- function createMeshNonce() {
24019
- return (0, node_crypto.randomBytes)(32).toString("hex");
24020
- }
24021
- function hmacHex(secretHash, message) {
24022
- return (0, node_crypto.createHmac)("sha256", Buffer.from(secretHash, "utf8")).update(message, "utf8").digest("hex");
24023
- }
24024
- /** The node's answer to the hub's nonce. `secretHash` is `hashClusterSecret(secret)`. */
24025
- function computeNodeJoinProof(secretHash, nodeId, nonce) {
24026
- return hmacHex(secretHash, `${DOMAIN}|node|${nodeId}|${nonce}`);
24027
- }
24028
- /** The hub's answer to the node's nonce — proves the hub holds the same secret. */
24029
- function computeHubJoinProof(secretHash, nodeId, nonce, clientNonce) {
24030
- return hmacHex(secretHash, `${DOMAIN}|hub|${nodeId}|${nonce}|${clientNonce}`);
24031
- }
24032
- /** Constant-time comparison of two hex proofs; any shape mismatch is `false`. */
24033
- function proofsEqual(expected, presented) {
24034
- if (typeof presented !== "string" || presented.length !== expected.length) return false;
24035
- return (0, node_crypto.timingSafeEqual)(Buffer.from(expected, "utf8"), Buffer.from(presented, "utf8"));
24036
- }
24037
23947
  /** Reads a Moleculer error's `type`, including after an RPC round-trip. */
24038
23948
  function meshErrorType(err) {
24039
23949
  if (typeof err !== "object" || err === null || !("type" in err)) return null;
24040
23950
  const { type } = err;
24041
23951
  return typeof type === "string" ? type : null;
24042
23952
  }
24043
- //#endregion
24044
- //#region src/kernel/moleculer/mesh-authenticator.ts
24045
- /**
24046
- * MeshAuthenticator — the hub's record of WHICH node is calling, and whether
24047
- * it proved it (D802).
24048
- *
24049
- * Every remote Moleculer action and event reaching the hub passes through
24050
- * {@link MeshAuthenticator.admitCall} (wired as a broker middleware,
24051
- * `mesh-access-middleware.ts`). The sender node id Moleculer reports is
24052
- * self-declared; this class binds it to a proof:
24053
- *
24054
- * - `$hub.joinChallenge` → a single-use nonce bound to the sender;
24055
- * - `$hub.authenticateNode` → the node's HMAC over that nonce and its own id
24056
- * (`mesh-join-proof.ts`). Success marks the node `authenticated` until its
24057
- * connection drops (`forget`, on `$node.disconnected`).
24058
- *
24059
- * Policy, per remote action:
24060
- * - the join actions and `registerNode` are open (they ARE the
24061
- * authentication; `registerNode` applies its own rule below);
24062
- * - {@link isRemoteForbiddenAction}: never from another node, whoever it is;
24063
- * - otherwise an authenticated (or, in `transition`, legacy) node is allowed;
24064
- * an unauthenticated one is refused in `enforced` and tolerated — with a
24065
- * warning and a row on System → Cluster — in `transition`.
24066
- *
24067
- * `registerNode` (`admitRegistration`): a node registers only itself; an
24068
- * authenticated node always may; the D797 hash is accepted as `legacy` in
24069
- * `transition` only; no proof at all is tolerated in `transition` only.
24070
- */
24071
- /** A challenge is answered within this window or not at all. */
24072
- var MESH_JOIN_CHALLENGE_TTL_MS = 6e4;
24073
- /** Outstanding challenges kept at most — a flood of fake node ids evicts the oldest. */
24074
- var MAX_PENDING_CHALLENGES = 256;
24075
- /** Unauthenticated senders remembered for the status page — bounded the same way. */
24076
- var MAX_TRACKED_NODES$1 = 256;
24077
- /** Actions any node may call before it has authenticated. */
24078
- var PRE_AUTH_ACTIONS = new Set([
24079
- MESH_JOIN_CHALLENGE_ACTION,
24080
- MESH_JOIN_AUTHENTICATE_ACTION,
24081
- "$hub.registerNode"
24082
- ]);
24083
23953
  /**
24084
23954
  * Services and actions no other node ever calls on the hub. `$process` spawns
24085
23955
  * runners with an arbitrary environment (code execution); `$node` is
24086
23956
  * Moleculer's introspection; `setLogLevel` is an operator action the hub
24087
- * issues itself. Nothing in the cluster calls them remotely, so refusing them
24088
- * costs nothing and closes the cheapest routes to the hub.
23957
+ * issues itself.
24089
23958
  */
24090
- var REMOTE_FORBIDDEN_SERVICES$1 = new Set(["$process", "$node"]);
24091
- var REMOTE_FORBIDDEN_ACTIONS = new Set(["$hub.setLogLevel"]);
23959
+ var HUB_FORBIDDEN_SERVICES = new Set(["$process", "$node"]);
23960
+ var HUB_FORBIDDEN_ACTIONS = new Set(["$hub.setLogLevel"]);
24092
23961
  function isRemoteForbiddenAction(action) {
24093
- if (REMOTE_FORBIDDEN_ACTIONS.has(action)) return true;
23962
+ if (HUB_FORBIDDEN_ACTIONS.has(action)) return true;
23963
+ const dot = action.indexOf(".");
23964
+ return dot > 0 && HUB_FORBIDDEN_SERVICES.has(action.slice(0, dot));
23965
+ }
23966
+ /** Moleculer introspection — never from another node, on an agent either. */
23967
+ var AGENT_FORBIDDEN_SERVICES = new Set(["$node"]);
23968
+ function isRemoteForbiddenOnAgent(action) {
24094
23969
  const dot = action.indexOf(".");
24095
- return dot > 0 && REMOTE_FORBIDDEN_SERVICES$1.has(action.slice(0, dot));
23970
+ return dot > 0 && AGENT_FORBIDDEN_SERVICES.has(action.slice(0, dot));
24096
23971
  }
24097
23972
  function refuse(message, type, code = 403) {
24098
23973
  return new require_builtins_system_config_system_config_addon.Errors.MoleculerClientError(message, code, type);
24099
23974
  }
24100
- var MeshAuthenticator = class {
23975
+ var NOT_PAIRED_HINT = "pair it with this hub (System → Cluster → Agents) so it holds a certificate from the mesh CA";
23976
+ /** The hub's gate: every other node must hold a verified certificate identity. */
23977
+ var MeshIdentityGate = class {
24101
23978
  deps;
24102
- challenges = /* @__PURE__ */ new Map();
24103
- nodes = /* @__PURE__ */ new Map();
24104
- /** Completed the challenge–response at least once since the hub started. */
24105
- everAuthenticated = /* @__PURE__ */ new Set();
24106
- /** Let in WITHOUT the challenge–response at least once since the hub started. */
24107
- everTolerated = /* @__PURE__ */ new Set();
24108
- now;
24109
23979
  constructor(deps) {
24110
23980
  this.deps = deps;
24111
- this.now = deps.now ?? Date.now;
24112
- }
24113
- issueChallenge(sender) {
24114
- const nonce = createMeshNonce();
24115
- this.challenges.delete(sender);
24116
- if (this.challenges.size >= MAX_PENDING_CHALLENGES) {
24117
- const oldest = this.challenges.keys().next().value;
24118
- if (oldest !== void 0) this.challenges.delete(oldest);
24119
- }
24120
- this.challenges.set(sender, {
24121
- nonce,
24122
- expiresAt: this.now() + MESH_JOIN_CHALLENGE_TTL_MS
24123
- });
24124
- return {
24125
- protocol: 1,
24126
- nonce
24127
- };
24128
- }
24129
- authenticate(sender, params) {
24130
- if (params.nodeId !== sender) throw refuse(`mesh join refused: node "${sender}" presented a proof for "${String(params.nodeId)}"`, MESH_NODE_UNAUTHENTICATED_TYPE);
24131
- const pending = this.challenges.get(sender);
24132
- this.challenges.delete(sender);
24133
- if (pending === void 0 || pending.expiresAt < this.now() || typeof params.nonce !== "string" || !proofsEqual(pending.nonce, params.nonce)) throw refuse(`mesh join refused: no live challenge for node "${sender}" — ask for a new one`, MESH_JOIN_CHALLENGE_INVALID_TYPE);
24134
- const hash = this.secretHashOrThrow(sender);
24135
- if (!proofsEqual(computeNodeJoinProof(hash, sender, pending.nonce), params.proof)) throw refuse(`cluster secret mismatch — node "${sender}" rejected`, require_constants.CLUSTER_SECRET_MISMATCH_TYPE);
24136
- this.record(sender, "authenticated");
24137
- this.everAuthenticated.add(sender);
24138
- this.deps.onAuthenticated?.(sender);
24139
- const clientNonce = typeof params.clientNonce === "string" ? params.clientNonce : "";
24140
- return {
24141
- ok: true,
24142
- hubProof: computeHubJoinProof(hash, sender, pending.nonce, clientNonce)
24143
- };
24144
- }
24145
- /** The node's connection dropped: it authenticates again when it returns. */
24146
- forget(nodeId) {
24147
- this.nodes.delete(nodeId);
24148
- this.challenges.delete(nodeId);
24149
23981
  }
24150
23982
  admitCall(sender, action) {
24151
23983
  if (sender === this.deps.ownNodeId) return { verdict: "allow" };
@@ -24154,7 +23986,6 @@ var MeshAuthenticator = class {
24154
23986
  errorType: MESH_ACTION_FORBIDDEN_TYPE,
24155
23987
  message: `"${action}" is not callable from another node (caller "${sender}")`
24156
23988
  };
24157
- if (PRE_AUTH_ACTIONS.has(action)) return { verdict: "allow" };
24158
23989
  return this.admitSender(sender, action);
24159
23990
  }
24160
23991
  /** Same rule as a call, for an inbound event. */
@@ -24162,103 +23993,72 @@ var MeshAuthenticator = class {
24162
23993
  if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24163
23994
  return this.admitSender(sender, `event:${eventName}`);
24164
23995
  }
23996
+ /** Throws when `sender` may not register `nodeId`: a node registers only itself. */
23997
+ admitRegistration(sender, nodeId) {
23998
+ if (sender === this.deps.ownNodeId) return;
23999
+ if (nodeId !== sender) throw refuse(`registration refused: node "${sender}" may register only itself, not "${nodeId}"`, MESH_NODE_UNAUTHENTICATED_TYPE);
24000
+ if (!this.deps.isVerifiedPeer(sender)) {
24001
+ this.deps.onRefused?.(sender, "$hub.registerNode");
24002
+ throw refuse(`node "${sender}" holds no valid mesh certificate — ${NOT_PAIRED_HINT}`, MESH_NODE_UNAUTHENTICATED_TYPE);
24003
+ }
24004
+ }
24165
24005
  admitSender(sender, what) {
24166
- const state = this.stateOf(sender);
24167
- if (state === "authenticated" || this.deps.isVerifiedPeer?.(sender) === true) return { verdict: "allow" };
24168
- if (this.deps.mode() === "enforced") return {
24006
+ if (this.deps.isVerifiedPeer(sender)) return { verdict: "allow" };
24007
+ this.deps.onRefused?.(sender, what);
24008
+ return {
24169
24009
  verdict: "deny",
24170
24010
  errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24171
- message: `node "${sender}" has not authenticated to this hub — enter the hub cluster secret (System → Cluster) in the agent and restart it`
24011
+ message: `node "${sender}" holds no valid mesh certificate — ${NOT_PAIRED_HINT}`
24172
24012
  };
24173
- if (state === "legacy") return { verdict: "allow" };
24174
- if (!this.nodes.has(sender)) {
24175
- this.record(sender, "unauthenticated");
24176
- this.noteTolerated(sender);
24177
- this.deps.onTolerated?.(sender, what);
24178
- }
24179
- return { verdict: "tolerate" };
24180
24013
  }
24181
- /** Throws when `sender` may not register `params`; returns when it may. */
24182
- admitRegistration(sender, params) {
24183
- if (sender === this.deps.ownNodeId) return;
24184
- if (params.nodeId !== sender) throw refuse(`registration refused: node "${sender}" may register only itself, not "${params.nodeId}"`, MESH_NODE_UNAUTHENTICATED_TYPE);
24185
- if (this.stateOf(sender) === "authenticated" || this.deps.isVerifiedPeer?.(sender) === true) return;
24186
- if (this.deps.mode() === "enforced") throw refuse(`cluster secret mismatch — node "${sender}" rejected: this hub requires agents to authenticate with the cluster secret (System → Cluster); update the agent and enter it`, require_constants.CLUSTER_SECRET_MISMATCH_TYPE);
24187
- if (params.clusterSecretHash === void 0) {
24188
- this.admitSender(sender, "$hub.registerNode");
24189
- return;
24190
- }
24191
- const verdict = require_constants.checkClusterSecret(this.deps.gate(), params.clusterSecretHash);
24192
- if (verdict === "mismatch") throw refuse(`cluster secret mismatch — node "${sender}" rejected`, require_constants.CLUSTER_SECRET_MISMATCH_TYPE);
24193
- if (verdict === "unavailable") throw new require_builtins_system_config_system_config_addon.Errors.MoleculerRetryableError(`the hub cannot read its cluster secret yet — node "${sender}" must retry`, 503, require_constants.CLUSTER_SECRET_UNAVAILABLE_TYPE);
24194
- this.record(sender, this.deps.gate().kind === "on" ? "legacy" : "unauthenticated");
24195
- this.noteTolerated(sender);
24196
- }
24197
- noteTolerated(nodeId) {
24198
- if (this.everTolerated.size >= MAX_TRACKED_NODES$1) return;
24199
- this.everTolerated.add(nodeId);
24200
- }
24201
- stateOf(nodeId) {
24202
- return this.nodes.get(nodeId)?.state ?? "unauthenticated";
24203
- }
24204
- /** Node ids that completed the challenge–response on their current connection. */
24205
- authenticatedNodeIds() {
24206
- return [...this.nodes].filter(([, r]) => r.state === "authenticated").map(([id]) => id);
24014
+ };
24015
+ /**
24016
+ * An agent's inbound gate: the hub, proven by the certificate the agent's TLS
24017
+ * listener already verified, and nobody else. An agent that is not paired holds
24018
+ * no certificate, so it admits no one.
24019
+ */
24020
+ var AgentMeshIdentityGate = class {
24021
+ deps;
24022
+ hubNodeId;
24023
+ constructor(deps) {
24024
+ this.deps = deps;
24025
+ this.hubNodeId = deps.hubNodeId ?? "hub";
24207
24026
  }
24208
- /** Node ids that ever completed the challenge–response since the hub started. */
24209
- everAuthenticatedNodeIds() {
24210
- return this.everAuthenticated;
24027
+ admitCall(sender, action) {
24028
+ if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24029
+ if (isRemoteForbiddenOnAgent(action)) return {
24030
+ verdict: "deny",
24031
+ errorType: MESH_ACTION_FORBIDDEN_TYPE,
24032
+ message: `"${action}" is not callable from another node (caller "${sender}")`
24033
+ };
24034
+ return this.admitSender(sender, action);
24211
24035
  }
24212
- /**
24213
- * Node ids let in without the challenge–response since the hub started.
24214
- * Bounded: past {@link MAX_TRACKED_NODES} a flood of fake ids stops adding,
24215
- * and the ones already here keep the transition open (the operator can still
24216
- * switch to `enforced` by hand).
24217
- */
24218
- everToleratedNodeIds() {
24219
- return [...this.everTolerated];
24036
+ admitEvent(sender, eventName) {
24037
+ if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24038
+ return this.admitSender(sender, `event:${eventName}`);
24220
24039
  }
24221
- snapshot() {
24222
- const nodes = [...this.nodes].map(([nodeId, r]) => ({
24223
- nodeId,
24224
- state: r.state,
24225
- since: r.since
24226
- })).toSorted((a, b) => a.nodeId.localeCompare(b.nodeId));
24040
+ admitSender(sender, what) {
24041
+ if (sender === this.hubNodeId && this.deps.isVerifiedPeer(sender)) return { verdict: "allow" };
24042
+ this.deps.onRefused?.(sender, what);
24227
24043
  return {
24228
- mode: this.deps.mode(),
24229
- nodes
24044
+ verdict: "deny",
24045
+ errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24046
+ message: `node "${sender}" is not accepted by this agent — only the hub, proven by the certificate this agent's TLS listener verified, may call it`
24230
24047
  };
24231
24048
  }
24232
- record(nodeId, state) {
24233
- this.nodes.delete(nodeId);
24234
- if (this.nodes.size >= MAX_TRACKED_NODES$1) {
24235
- const oldestTolerated = [...this.nodes].find(([, r]) => r.state === "unauthenticated");
24236
- if (oldestTolerated !== void 0) this.nodes.delete(oldestTolerated[0]);
24237
- }
24238
- this.nodes.set(nodeId, {
24239
- state,
24240
- since: this.now()
24241
- });
24242
- }
24243
- secretHashOrThrow(sender) {
24244
- const gate = this.deps.gate();
24245
- if (gate.kind === "on") return gate.hash;
24246
- throw new require_builtins_system_config_system_config_addon.Errors.MoleculerRetryableError(gate.kind === "off" ? `the hub has no cluster secret yet — node "${sender}" must retry` : `the hub cannot read its cluster secret yet — node "${sender}" must retry`, 503, require_constants.CLUSTER_SECRET_UNAVAILABLE_TYPE);
24247
- }
24248
24049
  };
24249
24050
  //#endregion
24250
24051
  //#region src/kernel/moleculer/mesh-access-middleware.ts
24251
24052
  /**
24252
- * Mesh gate middleware (D802): wraps every LOCAL action and event handler so
24253
- * it sees each request another node sends with `ctx.nodeID` = the sender.
24053
+ * Mesh gate middleware (D802, D857): wraps every LOCAL action and event handler
24054
+ * so it sees each request another node sends with `ctx.nodeID` = the sender.
24254
24055
  *
24255
24056
  * Used on both sides of the mesh:
24256
- * - hub: {@link MeshAuthenticator} (challenge–response join);
24257
- * - agent: {@link AgentMeshAuthenticator} (hub proven by mutual join + own
24258
- * children via `$agent.registerNode`).
24057
+ * - hub: {@link MeshIdentityGate} (the sender holds a verified certificate);
24058
+ * - agent: {@link AgentMeshIdentityGate} (the sender is the certified hub).
24259
24059
  *
24260
24060
  * For a request from another node it:
24261
- * 1. asks the gate's `admitCall` — refuse, tolerate or allow;
24061
+ * 1. asks the gate's `admitCall` — refuse or allow;
24262
24062
  * 2. strips a forged identity from the params ({@link stripForgedIdentity}).
24263
24063
  *
24264
24064
  * Calls a node makes to itself (`ctx.nodeID` = own) pass untouched.
@@ -24301,6 +24101,9 @@ function senderOf(ctx) {
24301
24101
  const nodeID = ctx.nodeID;
24302
24102
  return typeof nodeID === "string" && nodeID.length > 0 ? nodeID : null;
24303
24103
  }
24104
+ function noSenderError(action) {
24105
+ return new require_builtins_system_config_system_config_addon.Errors.MoleculerClientError(`"${action}" refused: the call names no sender node`, 403, MESH_NODE_UNAUTHENTICATED_TYPE);
24106
+ }
24304
24107
  function paramNodeId(params) {
24305
24108
  return params !== null && typeof params === "object" ? Reflect.get(params, "nodeId") : void 0;
24306
24109
  }
@@ -24309,7 +24112,7 @@ function paramNodeId(params) {
24309
24112
  * so it wraps every service, including the ones Moleculer creates itself.
24310
24113
  */
24311
24114
  function createMeshAccessMiddleware(options) {
24312
- const { ownNodeId, authenticator, logger } = options;
24115
+ const { ownNodeId, gate, logger } = options;
24313
24116
  const dropped = /* @__PURE__ */ new Map();
24314
24117
  const noteDroppedEvent = (sender, eventName) => {
24315
24118
  const now = Date.now();
@@ -24339,10 +24142,9 @@ function createMeshAccessMiddleware(options) {
24339
24142
  const name = action.name ?? "";
24340
24143
  return function meshGatedAction(ctx) {
24341
24144
  const sender = senderOf(ctx);
24342
- if (sender === null || sender === ownNodeId) return next.call(this, ctx);
24343
- const verdict = authenticator.admitCall(sender, name);
24344
- if (verdict.verdict === "hold") return verdict.settled.then((settled) => runAdmitted.call(this, ctx, sender, settled));
24345
- return runAdmitted.call(this, ctx, sender, verdict);
24145
+ if (sender === null) return Promise.reject(noSenderError(name));
24146
+ if (sender === ownNodeId) return next.call(this, ctx);
24147
+ return runAdmitted.call(this, ctx, sender, gate.admitCall(sender, name));
24346
24148
  };
24347
24149
  function runAdmitted(ctx, sender, verdict) {
24348
24150
  if (verdict.verdict === "deny") {
@@ -24362,235 +24164,21 @@ function createMeshAccessMiddleware(options) {
24362
24164
  const name = event.name ?? "";
24363
24165
  return function meshGatedEvent(ctx) {
24364
24166
  const sender = senderOf(ctx);
24365
- if (sender === null || sender === ownNodeId) return Promise.resolve(next.call(this, ctx));
24366
- const verdict = authenticator.admitEvent(sender, name);
24367
- const deliver = (settled) => {
24368
- if (settled.verdict === "deny") {
24369
- noteDroppedEvent(sender, name);
24370
- return Promise.resolve();
24371
- }
24372
- return Promise.resolve(next.call(this, ctx));
24373
- };
24374
- return verdict.verdict === "hold" ? verdict.settled.then(deliver) : deliver(verdict);
24167
+ if (sender === null) {
24168
+ noteDroppedEvent("(no sender)", name);
24169
+ return Promise.resolve();
24170
+ }
24171
+ if (sender === ownNodeId) return Promise.resolve(next.call(this, ctx));
24172
+ if (gate.admitEvent(sender, name).verdict === "deny") {
24173
+ noteDroppedEvent(sender, name);
24174
+ return Promise.resolve();
24175
+ }
24176
+ return Promise.resolve(next.call(this, ctx));
24375
24177
  };
24376
24178
  }
24377
24179
  };
24378
24180
  }
24379
24181
  //#endregion
24380
- //#region src/kernel/moleculer/mesh-join-hold.ts
24381
- var DEFAULT_MESH_JOIN_MAX_HELD = 1e3;
24382
- var DEFAULT_MESH_JOIN_MAX_HOLD_MS = 15e3;
24383
- var MeshJoinHold = class {
24384
- opts;
24385
- waiters = [];
24386
- firstHeldAt = null;
24387
- overflow = 0;
24388
- timer = null;
24389
- /** Holding is open while a join is in flight; closed after a decision or the bound. */
24390
- open = true;
24391
- now;
24392
- constructor(opts) {
24393
- this.opts = opts;
24394
- this.now = opts.now ?? Date.now;
24395
- }
24396
- /** Whether a request arriving now would be held (a join is in flight). */
24397
- get holding() {
24398
- return this.open;
24399
- }
24400
- /** How many requests wait right now. */
24401
- get size() {
24402
- return this.waiters.length;
24403
- }
24404
- /** A join started: hold again. */
24405
- reopen() {
24406
- this.open = true;
24407
- }
24408
- /** Hold one request; `null` when holding is closed (the caller refuses it). */
24409
- hold(kind) {
24410
- if (!this.open) return null;
24411
- if (this.waiters.length >= (this.opts.maxHeld ?? 1e3)) {
24412
- this.overflow++;
24413
- return {
24414
- verdict: "hold",
24415
- settled: Promise.resolve(this.refusal("the hold before the mesh join is full"))
24416
- };
24417
- }
24418
- if (this.firstHeldAt === null) {
24419
- this.firstHeldAt = this.now();
24420
- this.timer = setTimeout(() => this.refuse("bound"), this.opts.maxHoldMs ?? 15e3);
24421
- this.timer.unref?.();
24422
- }
24423
- return {
24424
- verdict: "hold",
24425
- settled: new Promise((resolve) => {
24426
- this.waiters.push({
24427
- kind,
24428
- resolve
24429
- });
24430
- })
24431
- };
24432
- }
24433
- /** The join proved the hub: deliver everything held, in order. */
24434
- release() {
24435
- this.open = false;
24436
- this.settle({ verdict: "allow" }, "delivered", "authenticated");
24437
- }
24438
- /** The join failed, or the bound ran out: refuse everything held. */
24439
- refuse(reason) {
24440
- this.open = false;
24441
- this.settle(this.refusal(`the join ended "${reason}"`), "refused", reason);
24442
- }
24443
- refusal(why) {
24444
- return {
24445
- verdict: "deny",
24446
- errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24447
- message: `"${this.opts.hubNodeId}" sent this before the mesh join settled, and ${why}`
24448
- };
24449
- }
24450
- settle(verdict, outcome, reason) {
24451
- if (this.timer !== null) clearTimeout(this.timer);
24452
- this.timer = null;
24453
- const waiters = this.waiters;
24454
- const overflow = this.overflow;
24455
- const firstHeldAt = this.firstHeldAt;
24456
- this.waiters = [];
24457
- this.overflow = 0;
24458
- this.firstHeldAt = null;
24459
- if (waiters.length === 0 && overflow === 0) return;
24460
- for (const w of waiters) w.resolve(verdict);
24461
- this.opts.onReport?.({
24462
- outcome,
24463
- reason,
24464
- events: waiters.filter((w) => w.kind === "event").length,
24465
- calls: waiters.filter((w) => w.kind === "call").length,
24466
- overflow,
24467
- heldForMs: firstHeldAt === null ? 0 : this.now() - firstHeldAt
24468
- });
24469
- }
24470
- };
24471
- //#endregion
24472
- //#region src/kernel/moleculer/agent-mesh-authenticator.ts
24473
- /** The child's register action on its parent agent. */
24474
- var AGENT_REGISTER_NODE_ACTION = "$agent.registerNode";
24475
- var DEFAULT_HUB_NODE_ID = "hub";
24476
- var MAX_TRACKED_NODES = 256;
24477
- /** Moleculer introspection — never from another node, on an agent either. */
24478
- var REMOTE_FORBIDDEN_SERVICES = new Set(["$node"]);
24479
- function isRemoteForbiddenOnAgent(action) {
24480
- const dot = action.indexOf(".");
24481
- return dot > 0 && REMOTE_FORBIDDEN_SERVICES.has(action.slice(0, dot));
24482
- }
24483
- function isOwnChildNodeId(ownNodeId, sender) {
24484
- return sender.startsWith(`${ownNodeId}/`);
24485
- }
24486
- var AgentMeshAuthenticator = class {
24487
- deps;
24488
- nodes = /* @__PURE__ */ new Map();
24489
- hubNodeId;
24490
- now;
24491
- hold;
24492
- constructor(deps) {
24493
- this.deps = deps;
24494
- this.hubNodeId = deps.hubNodeId ?? DEFAULT_HUB_NODE_ID;
24495
- this.now = deps.now ?? Date.now;
24496
- this.hold = new MeshJoinHold({
24497
- hubNodeId: this.hubNodeId,
24498
- now: this.now,
24499
- ...deps.maxHeld !== void 0 ? { maxHeld: deps.maxHeld } : {},
24500
- ...deps.maxHoldMs !== void 0 ? { maxHoldMs: deps.maxHoldMs } : {},
24501
- ...deps.onHoldReport !== void 0 ? { onReport: deps.onHoldReport } : {}
24502
- });
24503
- }
24504
- /** How many of the hub's requests wait for the join right now. */
24505
- heldCount() {
24506
- return this.hold.size;
24507
- }
24508
- /** Current mode: a secret OR a certificate → enforce; else tolerate (upgrade path). */
24509
- mode() {
24510
- return this.deps.hasSecret() || this.deps.isPaired?.() === true ? "enforced" : "transition";
24511
- }
24512
- /**
24513
- * Reflect a settled mesh join. `authenticated` stamps the hub; a blocking
24514
- * failure forgets it so an impostor cannot call in; transitional states
24515
- * leave the hub unmarked (calls are tolerated while mode is `transition`).
24516
- */
24517
- noteHubJoinState(state) {
24518
- if (state === "authenticated") {
24519
- this.record(this.hubNodeId, "authenticated");
24520
- this.hold.release();
24521
- return;
24522
- }
24523
- if (state === "pending") {
24524
- this.forget(this.hubNodeId);
24525
- this.hold.reopen();
24526
- return;
24527
- }
24528
- if (state === "secret-mismatch" || state === "hub-unverified") this.forget(this.hubNodeId);
24529
- this.hold.refuse(state);
24530
- }
24531
- /** A child's `$agent.registerNode` was accepted (secret hash matched or none required). */
24532
- noteChildRegistered(sender, proof = "authenticated") {
24533
- if (!isOwnChildNodeId(this.deps.ownNodeId, sender)) return;
24534
- this.record(sender, proof);
24535
- }
24536
- /** The peer's connection dropped. */
24537
- forget(nodeId) {
24538
- this.nodes.delete(nodeId);
24539
- }
24540
- admitCall(sender, action) {
24541
- if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24542
- if (isRemoteForbiddenOnAgent(action)) return {
24543
- verdict: "deny",
24544
- errorType: MESH_ACTION_FORBIDDEN_TYPE,
24545
- message: `"${action}" is not callable from another node (caller "${sender}")`
24546
- };
24547
- if (action === "$agent.registerNode" && isOwnChildNodeId(this.deps.ownNodeId, sender)) return { verdict: "allow" };
24548
- return this.admitSender(sender, action, "call");
24549
- }
24550
- admitEvent(sender, eventName) {
24551
- if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24552
- return this.admitSender(sender, `event:${eventName}`, "event");
24553
- }
24554
- stateOf(nodeId) {
24555
- return this.nodes.get(nodeId)?.state ?? "unauthenticated";
24556
- }
24557
- authenticatedNodeIds() {
24558
- return [...this.nodes].filter(([, r]) => r.state === "authenticated").map(([id]) => id);
24559
- }
24560
- admitSender(sender, what, kind) {
24561
- const state = this.stateOf(sender);
24562
- if (state === "authenticated" || state === "legacy") return { verdict: "allow" };
24563
- if (sender === this.hubNodeId && this.deps.isVerifiedPeer?.(sender) === true) return { verdict: "allow" };
24564
- if (this.mode() === "enforced") {
24565
- if (sender === this.hubNodeId) {
24566
- const held = this.hold.hold(kind);
24567
- if (held !== null) return held;
24568
- }
24569
- return {
24570
- verdict: "deny",
24571
- errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24572
- message: `node "${sender}" has not authenticated to this agent — only the hub (after mutual mesh join) and this agent's own children may call it`
24573
- };
24574
- }
24575
- if (!this.nodes.has(sender)) {
24576
- this.record(sender, "unauthenticated");
24577
- this.deps.onTolerated?.(sender, what);
24578
- }
24579
- return { verdict: "tolerate" };
24580
- }
24581
- record(nodeId, state) {
24582
- this.nodes.delete(nodeId);
24583
- if (this.nodes.size >= MAX_TRACKED_NODES) {
24584
- const oldest = this.nodes.keys().next().value;
24585
- if (oldest !== void 0) this.nodes.delete(oldest);
24586
- }
24587
- this.nodes.set(nodeId, {
24588
- state,
24589
- since: this.now()
24590
- });
24591
- }
24592
- };
24593
- //#endregion
24594
24182
  //#region src/kernel/moleculer/agent-event-scope.ts
24595
24183
  /** Moleculer's EVENT packet type (`packets.PACKET_EVENT`). */
24596
24184
  var PACKET_EVENT = "EVENT";
@@ -24625,213 +24213,6 @@ function createAgentEventScope(opts) {
24625
24213
  };
24626
24214
  }
24627
24215
  //#endregion
24628
- //#region src/kernel/moleculer/mesh-join-client.ts
24629
- /** States in which a call to the hub is refused locally. */
24630
- var BLOCKING = new Set(["secret-mismatch", "hub-unverified"]);
24631
- /** Error `type`s meaning "the hub has no such action": it predates D802. */
24632
- var UNSUPPORTED = new Set(["SERVICE_NOT_FOUND", "SERVICE_NOT_AVAILABLE"]);
24633
- function errText(err) {
24634
- return err instanceof Error ? err.message : String(err);
24635
- }
24636
- function errCode(err) {
24637
- if (typeof err !== "object" || err === null || !("code" in err)) return null;
24638
- const { code } = err;
24639
- return typeof code === "number" ? code : null;
24640
- }
24641
- function readString(value, key) {
24642
- if (value === null || typeof value !== "object") return null;
24643
- const v = Reflect.get(value, key);
24644
- return typeof v === "string" ? v : null;
24645
- }
24646
- var MeshJoinClient = class {
24647
- opts;
24648
- current = "pending";
24649
- settledWaiters = [];
24650
- inFlight = null;
24651
- hubNodeId;
24652
- constructor(opts) {
24653
- this.opts = opts;
24654
- this.hubNodeId = opts.hubNodeId ?? "hub";
24655
- }
24656
- get state() {
24657
- return this.current;
24658
- }
24659
- /** Did this agent prove itself on the current connection? */
24660
- get authenticated() {
24661
- return this.current === "authenticated";
24662
- }
24663
- /**
24664
- * Run the join. Concurrent callers share one attempt. Resolves with the
24665
- * settled state; never rejects.
24666
- */
24667
- join() {
24668
- if (this.inFlight !== null) return this.inFlight;
24669
- const attempt = this.runJoin().then((state) => {
24670
- this.inFlight = null;
24671
- this.settle(state);
24672
- return state;
24673
- });
24674
- this.inFlight = attempt;
24675
- return attempt;
24676
- }
24677
- /** The hub connection dropped: the next connection authenticates again. */
24678
- reset() {
24679
- this.current = "pending";
24680
- }
24681
- /** Resolves when a call to the hub may go out; rejects when it must not. */
24682
- async whenCallable() {
24683
- if (this.current === "pending") {
24684
- let timer;
24685
- const settled = await Promise.race([new Promise((resolve) => this.settledWaiters.push(() => resolve(true))), new Promise((resolve) => {
24686
- timer = setTimeout(() => resolve(false), this.opts.pendingWaitMs ?? 3e4);
24687
- timer.unref?.();
24688
- })]);
24689
- if (timer !== void 0) clearTimeout(timer);
24690
- if (!settled) throw new Error(`the mesh join with "${this.hubNodeId}" has not completed — the call was not sent`);
24691
- }
24692
- if (!BLOCKING.has(this.current)) return;
24693
- if (this.current === "secret-mismatch") throw new Error("the hub refused this agent: cluster secret mismatch — copy the cluster secret from the hub's System → Cluster page into this agent's setup");
24694
- throw new Error(`the node answering as "${this.hubNodeId}" could not prove it holds the cluster secret — refusing to talk to it (check the hub address and the secret)`);
24695
- }
24696
- /**
24697
- * Moleculer middleware for the AGENT broker: every call to the hub node waits
24698
- * for the join; a hub answer "not authenticated" (the hub restarted and lost
24699
- * us) triggers a new join.
24700
- */
24701
- middleware(onUnauthenticated) {
24702
- const hubNodeId = this.hubNodeId;
24703
- const whenCallable = () => this.whenCallable();
24704
- const secretPresent = () => this.secretPresent();
24705
- return {
24706
- name: "CamstackMeshJoin",
24707
- remoteAction(next, action) {
24708
- const name = action.name ?? "";
24709
- if (name === "$hub.joinChallenge" || name === "$hub.authenticateNode") return next;
24710
- return async function meshJoinGated(ctx) {
24711
- if (ctx.nodeID !== hubNodeId) return next.call(this, ctx);
24712
- await whenCallable();
24713
- try {
24714
- return await next.call(this, ctx);
24715
- } catch (err) {
24716
- if (meshErrorType(err) === "MESH_NODE_UNAUTHENTICATED" && secretPresent()) onUnauthenticated?.();
24717
- throw err;
24718
- }
24719
- };
24720
- }
24721
- };
24722
- }
24723
- secretPresent() {
24724
- const s = this.opts.secret();
24725
- return s !== null && s.length > 0;
24726
- }
24727
- settle(state) {
24728
- this.current = state;
24729
- this.opts.onSettled?.(state);
24730
- const waiters = this.settledWaiters;
24731
- this.settledWaiters = [];
24732
- for (const w of waiters) w();
24733
- }
24734
- async runJoin() {
24735
- const secret = this.opts.secret();
24736
- if (secret === null || secret.length === 0) return "no-secret";
24737
- const hash = require_constants.hashClusterSecret(secret);
24738
- const maxAttempts = this.opts.maxAttempts ?? 5;
24739
- let last = "unavailable";
24740
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
24741
- const outcome = await this.attempt(hash);
24742
- if (outcome !== "retry") return outcome;
24743
- last = "unavailable";
24744
- await new Promise((r) => setTimeout(r, (this.opts.retryDelayMs ?? 1e3) * attempt));
24745
- }
24746
- return last;
24747
- }
24748
- async attempt(hash) {
24749
- const callOpts = {
24750
- nodeID: this.hubNodeId,
24751
- timeout: this.opts.callTimeoutMs ?? 1e4
24752
- };
24753
- const nodeId = this.opts.nodeId;
24754
- try {
24755
- const challenge = await this.opts.call(MESH_JOIN_CHALLENGE_ACTION, {}, callOpts);
24756
- const nonce = readString(challenge, "nonce");
24757
- const protocol = challenge !== null && typeof challenge === "object" ? Reflect.get(challenge, "protocol") : void 0;
24758
- if (nonce === null || protocol !== 1) {
24759
- this.opts.log?.(`[mesh-join] the hub sent a challenge this agent does not speak`);
24760
- return "unsupported";
24761
- }
24762
- const clientNonce = createMeshNonce();
24763
- const answer = await this.opts.call(MESH_JOIN_AUTHENTICATE_ACTION, {
24764
- nodeId,
24765
- nonce,
24766
- clientNonce,
24767
- proof: computeNodeJoinProof(hash, nodeId, nonce)
24768
- }, callOpts);
24769
- if (!proofsEqual(computeHubJoinProof(hash, nodeId, nonce, clientNonce), readString(answer, "hubProof"))) {
24770
- this.opts.log?.(`[mesh-join] the hub could not prove it holds the cluster secret — refused`);
24771
- return "hub-unverified";
24772
- }
24773
- this.opts.log?.(`[mesh-join] authenticated to the hub (mutual)`);
24774
- return "authenticated";
24775
- } catch (err) {
24776
- const type = meshErrorType(err);
24777
- if (type === "CLUSTER_SECRET_MISMATCH") {
24778
- this.opts.log?.(`[mesh-join] the hub refused our proof: cluster secret mismatch`);
24779
- return "secret-mismatch";
24780
- }
24781
- if (type !== null && UNSUPPORTED.has(type) || errCode(err) === 404) {
24782
- this.opts.log?.(`[mesh-join] the hub predates the mesh join — legacy registration`);
24783
- return "unsupported";
24784
- }
24785
- this.opts.log?.(`[mesh-join] join attempt failed (${type ?? "error"}): ${errText(err)}`);
24786
- return "retry";
24787
- }
24788
- }
24789
- };
24790
- //#endregion
24791
- //#region src/kernel/moleculer/mesh-auto-enforce.ts
24792
- /** Boot grace before an empty or partial roster can end the transition. */
24793
- var MESH_AUTO_ENFORCE_GRACE_MS = 5 * 6e4;
24794
- function isAgentId(id, ownNodeId) {
24795
- return id !== ownNodeId && !id.includes("/");
24796
- }
24797
- function decideMeshAutoEnforce(input) {
24798
- if (input.mode !== "transition") return {
24799
- enforce: false,
24800
- waitingFor: [],
24801
- why: "not in transition"
24802
- };
24803
- if (input.gate !== "on") return {
24804
- enforce: false,
24805
- waitingFor: [],
24806
- why: "no readable cluster secret"
24807
- };
24808
- if (input.knownAgents === null) return {
24809
- enforce: false,
24810
- waitingFor: [],
24811
- why: "the cluster-node history has not answered"
24812
- };
24813
- if (input.uptimeMs < (input.graceMs ?? 3e5)) return {
24814
- enforce: false,
24815
- waitingFor: [],
24816
- why: "boot grace period"
24817
- };
24818
- const known = new Set([
24819
- ...input.knownAgents,
24820
- ...input.connected,
24821
- ...input.toleratedEver
24822
- ].filter((id) => isAgentId(id, input.ownNodeId)));
24823
- const waitingFor = [...known].filter((id) => !input.authenticatedEver.has(id)).toSorted();
24824
- if (waitingFor.length > 0) return {
24825
- enforce: false,
24826
- waitingFor,
24827
- why: "agents have not authenticated yet"
24828
- };
24829
- return {
24830
- enforce: true,
24831
- reason: known.size === 0 ? "no agent has ever joined this hub" : `every known agent has authenticated (${[...known].toSorted().join(", ")})`
24832
- };
24833
- }
24834
- //#endregion
24835
24216
  //#region src/kernel/moleculer/readiness-service.ts
24836
24217
  /**
24837
24218
  * Service name AGENTS register their own readiness snapshot under.
@@ -27122,8 +26503,6 @@ exports.AGENT_DASHBOARD_ORIGINS_FIELD = require_builtins_system_config_system_co
27122
26503
  exports.AGENT_HTTPS_NAMES_COLLECTION = require_agent_https.AGENT_HTTPS_NAMES_COLLECTION;
27123
26504
  exports.AGENT_HTTPS_NAMES_COLUMNS = require_agent_https.AGENT_HTTPS_NAMES_COLUMNS;
27124
26505
  exports.AGENT_READINESS_SERVICE_NAME = AGENT_READINESS_SERVICE_NAME;
27125
- exports.AGENT_REGISTER_NODE_ACTION = AGENT_REGISTER_NODE_ACTION;
27126
- exports.AGENT_UI_UNLOCK_DOMAIN = require_builtins_system_config_system_config_addon.AGENT_UI_UNLOCK_DOMAIN;
27127
26506
  exports.AGENT_UI_UNLOCK_TTL_MS = require_builtins_system_config_system_config_addon.AGENT_UI_UNLOCK_TTL_MS;
27128
26507
  exports.AGENT_UI_UNLOCK_TYP = require_builtins_system_config_system_config_addon.AGENT_UI_UNLOCK_TYP;
27129
26508
  exports.AGENT_UI_UNLOCK_USE = require_builtins_system_config_system_config_addon.AGENT_UI_UNLOCK_USE;
@@ -27145,7 +26524,7 @@ exports.AdminTokenManager = require_builtins_local_auth_local_auth_addon.AdminTo
27145
26524
  exports.AgentHttpsInstallError = require_agent_https.AgentHttpsInstallError;
27146
26525
  exports.AgentHttpsNames = require_agent_https.AgentHttpsNames;
27147
26526
  exports.AgentMdnsAdvertiser = AgentMdnsAdvertiser;
27148
- exports.AgentMeshAuthenticator = AgentMeshAuthenticator;
26527
+ exports.AgentMeshIdentityGate = AgentMeshIdentityGate;
27149
26528
  exports.AgentPairing = require_builtins_system_config_system_config_addon.AgentPairing;
27150
26529
  exports.AlertCenterAddon = require_builtins_alerts_alerts_addon.AlertCenterAddon;
27151
26530
  exports.ApiKeyManager = require_builtins_local_auth_local_auth_addon.ApiKeyManager;
@@ -27160,11 +26539,6 @@ exports.CAP_ACTION_UNLABELLED = CAP_ACTION_UNLABELLED;
27160
26539
  exports.CAP_METHOD_NOT_IMPLEMENTED = CAP_METHOD_NOT_IMPLEMENTED;
27161
26540
  exports.CA_COMMON_NAME = require_agent_https.CA_COMMON_NAME;
27162
26541
  exports.CA_VALIDITY_DAYS = require_agent_https.CA_VALIDITY_DAYS;
27163
- exports.CLUSTER_SECRET_MISMATCH_TYPE = require_constants.CLUSTER_SECRET_MISMATCH_TYPE;
27164
- exports.CLUSTER_SECRET_REF = require_constants.CLUSTER_SECRET_REF;
27165
- exports.CLUSTER_SECRET_REJECTED_EXIT_CODE = require_constants.CLUSTER_SECRET_REJECTED_EXIT_CODE;
27166
- exports.CLUSTER_SECRET_SETTINGS_KEY = require_constants.CLUSTER_SECRET_SETTINGS_KEY;
27167
- exports.CLUSTER_SECRET_UNAVAILABLE_TYPE = require_constants.CLUSTER_SECRET_UNAVAILABLE_TYPE;
27168
26542
  exports.CORE_CAP_SERVICE_NAME = CORE_CAP_SERVICE_NAME;
27169
26543
  exports.CalendarsAddon = require_builtins_calendars_calendars_addon.CalendarsAddon;
27170
26544
  exports.CapRouteError = CapRouteError;
@@ -27185,8 +26559,6 @@ exports.DEFAULT_DATA_PATH = DEFAULT_DATA_PATH;
27185
26559
  exports.DEFAULT_HUB_TLS_TCP_PORT = require_constants.DEFAULT_HUB_TLS_TCP_PORT;
27186
26560
  exports.DEFAULT_LAN_HTTP_PORT = require_hub_mdns_ciao.DEFAULT_LAN_HTTP_PORT;
27187
26561
  exports.DEFAULT_LOG_LEVEL = DEFAULT_LOG_LEVEL;
27188
- exports.DEFAULT_MESH_JOIN_MAX_HELD = DEFAULT_MESH_JOIN_MAX_HELD;
27189
- exports.DEFAULT_MESH_JOIN_MAX_HOLD_MS = DEFAULT_MESH_JOIN_MAX_HOLD_MS;
27190
26562
  exports.DEVICE_CA_KEY_REF = require_device_ca.DEVICE_CA_KEY_REF;
27191
26563
  exports.DEVICE_SETTINGS_CONTRIBUTION_METHODS = require_dist.DEVICE_SETTINGS_CONTRIBUTION_METHODS;
27192
26564
  exports.DEVICE_STATUS_METHOD = require_dist.DEVICE_STATUS_METHOD;
@@ -27234,7 +26606,6 @@ exports.INFRA_CAPABILITIES = INFRA_CAPABILITIES;
27234
26606
  exports.IntegrationRegistry = IntegrationRegistry;
27235
26607
  exports.JWT_SIGNING_KEY_REF = require_device_ca.JWT_SIGNING_KEY_REF;
27236
26608
  exports.JobJournal = JobJournal;
27237
- exports.JoinTokenJtiStore = require_builtins_system_config_system_config_addon.JoinTokenJtiStore;
27238
26609
  exports.JwtSigningKeyUnavailableError = require_device_ca.JwtSigningKeyUnavailableError;
27239
26610
  exports.LEAF_RENEWAL_WINDOW_DAYS = require_agent_https.LEAF_RENEWAL_WINDOW_DAYS;
27240
26611
  exports.LifecycleJobEngine = LifecycleJobEngine;
@@ -27252,28 +26623,19 @@ exports.LokiLoggingAddon = require_builtins_loki_logging_index.LokiLoggingAddon$
27252
26623
  exports.MAX_CAP_ACTIONS_PER_PEER = MAX_CAP_ACTIONS_PER_PEER;
27253
26624
  exports.MAX_LEAF_VALIDITY_DAYS = require_agent_https.MAX_LEAF_VALIDITY_DAYS;
27254
26625
  exports.MESH_ACTION_FORBIDDEN_TYPE = MESH_ACTION_FORBIDDEN_TYPE;
27255
- exports.MESH_AUTH_MODE_FIELD = require_builtins_system_config_system_config_addon.MESH_AUTH_MODE_FIELD;
27256
- exports.MESH_AUTO_ENFORCE_GRACE_MS = MESH_AUTO_ENFORCE_GRACE_MS;
27257
26626
  exports.MESH_CA_FIELD = require_constants.MESH_CA_FIELD;
27258
26627
  exports.MESH_CA_KEY_REF = require_constants.MESH_CA_KEY_REF;
27259
26628
  exports.MESH_CA_SETTINGS_KEY = require_constants.MESH_CA_SETTINGS_KEY;
27260
- exports.MESH_JOIN_AUTHENTICATE_ACTION = MESH_JOIN_AUTHENTICATE_ACTION;
27261
- exports.MESH_JOIN_CHALLENGE_ACTION = MESH_JOIN_CHALLENGE_ACTION;
27262
- exports.MESH_JOIN_CHALLENGE_INVALID_TYPE = MESH_JOIN_CHALLENGE_INVALID_TYPE;
27263
- exports.MESH_JOIN_CHALLENGE_TTL_MS = MESH_JOIN_CHALLENGE_TTL_MS;
27264
- exports.MESH_JOIN_PROTOCOL = MESH_JOIN_PROTOCOL;
27265
26629
  exports.MESH_NODE_CERTIFICATES_COLLECTION = require_builtins_system_config_system_config_addon.MESH_NODE_CERTIFICATES_COLLECTION;
27266
26630
  exports.MESH_NODE_CERTIFICATES_COLUMNS = require_builtins_system_config_system_config_addon.MESH_NODE_CERTIFICATES_COLUMNS;
27267
26631
  exports.MESH_NODE_UNAUTHENTICATED_TYPE = MESH_NODE_UNAUTHENTICATED_TYPE;
27268
26632
  exports.MESH_QUEUE_TOP_N = MESH_QUEUE_TOP_N;
27269
26633
  exports.MESH_TLS_PORT_HELLO_FIELD = require_builtins_system_config_system_config_addon.MESH_TLS_PORT_HELLO_FIELD;
27270
26634
  exports.METHOD_ACCESS_MAP = require_dist.METHOD_ACCESS_MAP;
27271
- exports.MeshAuthenticator = MeshAuthenticator;
27272
26635
  exports.MeshCaKeeper = require_builtins_system_config_system_config_addon.MeshCaKeeper;
27273
26636
  exports.MeshCertificateRegistry = require_builtins_system_config_system_config_addon.MeshCertificateRegistry;
27274
26637
  exports.MeshCrl = require_builtins_system_config_system_config_addon.MeshCrl;
27275
- exports.MeshJoinClient = MeshJoinClient;
27276
- exports.MeshJoinHold = MeshJoinHold;
26638
+ exports.MeshIdentityGate = MeshIdentityGate;
27277
26639
  exports.ModelDownloadService = require_custom_action_registry.ModelDownloadService;
27278
26640
  exports.NATIVE_PROVIDER_SERVICE_INFIX = NATIVE_PROVIDER_SERVICE_INFIX;
27279
26641
  exports.NATIVE_SCAN_DEPTH = NATIVE_SCAN_DEPTH;
@@ -27397,7 +26759,6 @@ exports.capActionSuffix = capActionSuffix;
27397
26759
  exports.capBareAction = capBareAction;
27398
26760
  exports.capServiceName = capServiceName;
27399
26761
  exports.certificateNames = require_agent_https.certificateNames;
27400
- exports.checkClusterSecret = require_constants.checkClusterSecret;
27401
26762
  exports.classifyAddonDir = classifyAddonDir;
27402
26763
  exports.classifyCapRoute = classifyCapRoute;
27403
26764
  exports.clearHttpsListener = require_hub_mdns_ciao.clearHttpsListener;
@@ -27405,12 +26766,9 @@ exports.clearPendingRestart = clearPendingRestart;
27405
26766
  exports.clearPlatformKeychainKey = require_platform_key_source.clearPlatformKeychainKey;
27406
26767
  exports.closeLanHttp = require_hub_mdns_ciao.closeLanHttp;
27407
26768
  exports.clusterEventTopic = clusterEventTopic;
27408
- exports.clusterSecretMatches = require_constants.clusterSecretMatches;
27409
26769
  exports.collectAgentNames = require_agent_https.collectAgentNames;
27410
26770
  exports.collectCertIdentity = require_agent_https.collectCertIdentity;
27411
26771
  exports.collectModelFiles = require_custom_action_registry.collectModelFiles;
27412
- exports.computeHubJoinProof = computeHubJoinProof;
27413
- exports.computeNodeJoinProof = computeNodeJoinProof;
27414
26772
  exports.computePairingCommitment = require_builtins_system_config_system_config_addon.computePairingCommitment;
27415
26773
  exports.computePairingSas = require_builtins_system_config_system_config_addon.computePairingSas;
27416
26774
  exports.connectBrokerTransport = connectBrokerTransport;
@@ -27464,7 +26822,6 @@ exports.createUdsLogger = createUdsLogger;
27464
26822
  exports.createUdsLoggerWithControl = createUdsLoggerWithControl;
27465
26823
  exports.createV8Reclaimer = createV8Reclaimer;
27466
26824
  exports.currentBrokerTransporter = currentBrokerTransporter;
27467
- exports.decideMeshAutoEnforce = decideMeshAutoEnforce;
27468
26825
  exports.deleteModelFromDisk = require_custom_action_registry.deleteModelFromDisk;
27469
26826
  exports.deriveAgentListenPort = deriveAgentListenPort;
27470
26827
  exports.describeCsr = require_builtins_system_config_system_config_addon.describeCsr;
@@ -27492,7 +26849,6 @@ exports.emitDownForOwnedCaps = require_dist.emitDownForOwnedCaps;
27492
26849
  exports.emitHeapDiagnosticReport = emitHeapDiagnosticReport;
27493
26850
  exports.emitProcessNodeRegistered = require_builtins_system_config_system_config_addon.emitProcessNodeRegistered;
27494
26851
  exports.encodeFrame = encodeFrame;
27495
- exports.enrollMeshNode = require_builtins_system_config_system_config_addon.enrollMeshNode;
27496
26852
  exports.ensureAddonNativePrebuilds = ensureAddonNativePrebuilds;
27497
26853
  Object.defineProperty(exports, "ensureBinary", {
27498
26854
  enumerable: true,
@@ -27561,10 +26917,7 @@ Object.defineProperty(exports, "getPlatformInfo", {
27561
26917
  });
27562
26918
  exports.getPlatformKeychainKey = require_platform_key_source.getPlatformKeychainKey;
27563
26919
  exports.getProcessAgentHttpsNames = require_agent_https.getProcessAgentHttpsNames;
27564
- exports.getProcessClusterSecretGate = require_constants.getProcessClusterSecretGate;
27565
26920
  exports.getProcessJwtSigningKeyState = require_device_ca.getProcessJwtSigningKeyState;
27566
- exports.getProcessMeshAuthMode = require_builtins_system_config_system_config_addon.getProcessMeshAuthMode;
27567
- exports.getProcessMeshAuthStatus = require_builtins_system_config_system_config_addon.getProcessMeshAuthStatus;
27568
26921
  exports.getProcessMeshCaState = require_builtins_system_config_system_config_addon.getProcessMeshCaState;
27569
26922
  exports.getProcessMeshCertificateRegistry = require_builtins_system_config_system_config_addon.getProcessMeshCertificateRegistry;
27570
26923
  exports.getProcessMeshTlsListenerState = require_builtins_system_config_system_config_addon.getProcessMeshTlsListenerState;
@@ -27581,7 +26934,6 @@ exports.getSinglePidStats = require_resource_monitor.getSinglePidStats;
27581
26934
  exports.getUserManagementInternal = require_builtins_local_auth_local_auth_addon.getUserManagementInternal;
27582
26935
  exports.getWorkerDeviceRegistry = getWorkerDeviceRegistry;
27583
26936
  exports.hasDotNode = hasDotNode;
27584
- exports.hashClusterSecret = require_constants.hashClusterSecret;
27585
26937
  exports.heapSpaceField = heapSpaceField;
27586
26938
  exports.hostNodeIdOf = hostNodeIdOf;
27587
26939
  exports.hubHostFromMeshAddress = require_builtins_system_config_system_config_addon.hubHostFromMeshAddress;
@@ -27609,16 +26961,13 @@ exports.isAddonDeploySource = isAddonDeploySource;
27609
26961
  exports.isAllowedAgentDashboardReturnTo = require_builtins_system_config_system_config_addon.isAllowedAgentDashboardReturnTo;
27610
26962
  exports.isArrayBufferCensusReport = isArrayBufferCensusReport;
27611
26963
  exports.isArrayOutputSchema = require_dist.isArrayOutputSchema;
27612
- exports.isClusterSecretMismatchError = require_constants.isClusterSecretMismatchError;
27613
26964
  exports.isCollectionArrayMethod = require_dist.isCollectionArrayMethod;
27614
26965
  exports.isContainerBridgeAddress = require_agent_https.isContainerBridgeAddress;
27615
26966
  exports.isCredentialKeyName = isCredentialKeyName;
27616
26967
  exports.isInfraCapability = isInfraCapability;
27617
26968
  exports.isInstalledTransporter = isInstalledTransporter;
27618
26969
  exports.isLocalOnlyHostname = require_agent_https.isLocalOnlyHostname;
27619
- exports.isMeshAuthMode = require_builtins_system_config_system_config_addon.isMeshAuthMode;
27620
26970
  exports.isModelDownloaded = require_custom_action_registry.isModelDownloaded;
27621
- exports.isOwnChildNodeId = isOwnChildNodeId;
27622
26971
  exports.isPeerEventPacket = isPeerEventPacket;
27623
26972
  exports.isPrivateAddress = require_agent_https.isPrivateAddress;
27624
26973
  exports.isProcessVerifiedMeshPeer = require_builtins_system_config_system_config_addon.isProcessVerifiedMeshPeer;
@@ -27644,18 +26993,16 @@ exports.localSupportedPythonRuntimes = localSupportedPythonRuntimes;
27644
26993
  exports.mapSignalsToInferenceHardware = mapSignalsToInferenceHardware;
27645
26994
  exports.meshErrorType = meshErrorType;
27646
26995
  exports.mintAgentUiUnlockTicket = require_builtins_system_config_system_config_addon.mintAgentUiUnlockTicket;
27647
- exports.mintAgentUiUnlockTicketEs256 = require_builtins_system_config_system_config_addon.mintAgentUiUnlockTicketEs256;
27648
- exports.mintMeshJoinToken = require_builtins_system_config_system_config_addon.mintMeshJoinToken;
27649
26996
  exports.mountNativeCapService = mountNativeCapService;
27650
26997
  exports.nextRssBudgetState = nextRssBudgetState;
27651
26998
  exports.normalizeIp = require_builtins_system_config_system_config_addon.normalizeIp;
27652
26999
  exports.onProcessNodeRegistered = require_builtins_system_config_system_config_addon.onProcessNodeRegistered;
27000
+ exports.onSessionsRevoked = require_builtins_local_auth_local_auth_addon.onSessionsRevoked;
27653
27001
  exports.openMeshTlsWhenRevocationsLoaded = require_builtins_system_config_system_config_addon.openMeshTlsWhenRevocationsLoaded;
27654
27002
  exports.overlayGetStatus = overlayGetStatus;
27655
27003
  exports.parseAgentDashboardOrigins = require_builtins_system_config_system_config_addon.parseAgentDashboardOrigins;
27656
27004
  exports.parseCapAction = parseCapAction;
27657
27005
  exports.parseCidrList = require_builtins_system_config_system_config_addon.parseCidrList;
27658
- exports.parseMeshAuthMode = require_builtins_system_config_system_config_addon.parseMeshAuthMode;
27659
27006
  exports.parseRangeHeader = require_custom_action_registry.parseRangeHeader;
27660
27007
  exports.parseRssBudgetMb = parseRssBudgetMb;
27661
27008
  exports.parseTokenExpiry = require_builtins_local_auth_local_auth_addon.parseTokenExpiry;
@@ -27666,7 +27013,6 @@ exports.pinnedHttpsCaFingerprint = require_agent_https.pinnedHttpsCaFingerprint;
27666
27013
  exports.prepareBootTls = require_hub_mdns_ciao.prepareBootTls;
27667
27014
  exports.prepareRestoreArchive = require_restore_archive.prepareRestoreArchive;
27668
27015
  exports.probePlatform = probePlatform;
27669
- exports.processJoinTokenJtiStore = require_builtins_system_config_system_config_addon.processJoinTokenJtiStore;
27670
27016
  exports.processJwtSigningKey = require_device_ca.processJwtSigningKey;
27671
27017
  exports.processMeshCrl = require_builtins_system_config_system_config_addon.processMeshCrl;
27672
27018
  exports.proxyToUpstream = proxyToUpstream;
@@ -27693,7 +27039,6 @@ exports.registerLanHttpHandler = require_hub_mdns_ciao.registerLanHttpHandler;
27693
27039
  exports.reissueTlsLeaf = require_hub_mdns_ciao.reissueTlsLeaf;
27694
27040
  exports.reloadHttpsListener = require_hub_mdns_ciao.reloadHttpsListener;
27695
27041
  exports.renewMeshCertificate = require_builtins_system_config_system_config_addon.renewMeshCertificate;
27696
- exports.requestProcessMeshEnforcement = require_builtins_system_config_system_config_addon.requestProcessMeshEnforcement;
27697
27042
  exports.requireProcessMeshCa = require_builtins_system_config_system_config_addon.requireProcessMeshCa;
27698
27043
  exports.resolveFilePath = require_custom_action_registry.resolveFilePath;
27699
27044
  exports.resolveFormatRevision = require_custom_action_registry.resolveFormatRevision;
@@ -27717,11 +27062,7 @@ exports.setHubConnected = setHubConnected;
27717
27062
  exports.setNodeEventInterest = setNodeEventInterest;
27718
27063
  exports.setPlatformKeychainKey = require_platform_key_source.setPlatformKeychainKey;
27719
27064
  exports.setProcessAgentHttpsNames = require_agent_https.setProcessAgentHttpsNames;
27720
- exports.setProcessClusterSecretGate = require_constants.setProcessClusterSecretGate;
27721
- exports.setProcessMeshAuthMode = require_builtins_system_config_system_config_addon.setProcessMeshAuthMode;
27722
- exports.setProcessMeshAuthStatusSource = require_builtins_system_config_system_config_addon.setProcessMeshAuthStatusSource;
27723
27065
  exports.setProcessMeshCertificateRegistry = require_builtins_system_config_system_config_addon.setProcessMeshCertificateRegistry;
27724
- exports.setProcessMeshEnforcer = require_builtins_system_config_system_config_addon.setProcessMeshEnforcer;
27725
27066
  exports.setProcessMeshPeerTransportLookup = require_builtins_system_config_system_config_addon.setProcessMeshPeerTransportLookup;
27726
27067
  exports.setProcessMeshTlsEnabler = require_builtins_system_config_system_config_addon.setProcessMeshTlsEnabler;
27727
27068
  exports.setProcessMeshTlsListenerState = require_builtins_system_config_system_config_addon.setProcessMeshTlsListenerState;
@@ -27749,10 +27090,8 @@ exports.udsChildLogToWorkerEntry = udsChildLogToWorkerEntry;
27749
27090
  exports.validateProviderRegistrations = validateProviderRegistrations;
27750
27091
  exports.validateUploadedTls = require_hub_mdns_ciao.validateUploadedTls;
27751
27092
  exports.verifyAgentUiUnlockTicket = require_builtins_system_config_system_config_addon.verifyAgentUiUnlockTicket;
27752
- exports.verifyAgentUiUnlockTicketEs256 = require_builtins_system_config_system_config_addon.verifyAgentUiUnlockTicketEs256;
27753
27093
  exports.verifyDeviceLeaf = require_device_ca.verifyDeviceLeaf;
27754
27094
  exports.verifyDeviceSignature = require_device_ca.verifyDeviceSignature;
27755
- exports.verifyMeshJoinToken = require_builtins_system_config_system_config_addon.verifyMeshJoinToken;
27756
27095
  exports.verifyPairingProof = require_builtins_system_config_system_config_addon.verifyPairingProof;
27757
27096
  exports.waitUntilReady = waitUntilReady;
27758
27097
  exports.writeExtraSans = require_hub_mdns_ciao.writeExtraSans;