@camstack/system 1.2.434 → 1.2.436

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 (103) 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 +6 -7
  26. package/dist/builtins/keychain/index.mjs +6 -7
  27. package/dist/builtins/keychain/keychain-service.d.ts +1 -2
  28. package/dist/builtins/keychain/system-held-secrets.d.ts +5 -5
  29. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  30. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  31. package/dist/builtins/local-auth/local-auth.addon.js +2 -2
  32. package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  33. package/dist/builtins/local-network/local-network.addon.d.ts +4 -2
  34. package/dist/builtins/local-network/local-network.addon.js +23 -13
  35. package/dist/builtins/local-network/local-network.addon.mjs +23 -13
  36. package/dist/builtins/loki-logging/index.js +1 -1
  37. package/dist/builtins/loki-logging/index.mjs +1 -1
  38. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  39. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  40. package/dist/builtins/platform-probe/index.js +1 -1
  41. package/dist/builtins/platform-probe/index.mjs +1 -1
  42. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  43. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  44. package/dist/builtins/snapshot/index.js +1 -1
  45. package/dist/builtins/snapshot/index.mjs +1 -1
  46. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  47. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  48. package/dist/builtins/sqlite-storage/index.js +1 -1
  49. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  50. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  51. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  52. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  53. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  54. package/dist/builtins/system-config/system-config.addon.d.ts +3 -24
  55. package/dist/builtins/system-config/system-config.addon.js +105 -1410
  56. package/dist/builtins/system-config/system-config.addon.mjs +108 -1402
  57. package/dist/builtins/winston-logging/index.js +1 -1
  58. package/dist/builtins/winston-logging/index.mjs +1 -1
  59. package/dist/{composition-sources-B7R1oQnY.js → composition-sources-BAOlCu4j.js} +1 -1
  60. package/dist/{composition-sources-CqrDyHM1.mjs → composition-sources-gN_BWUKp.mjs} +1 -1
  61. package/dist/constants-BFpowodq.mjs +20 -0
  62. package/dist/constants-GENKqk9k.js +66 -0
  63. package/dist/{device-ca-CDjGQQPd.mjs → device-ca-BNM5ai4t.mjs} +1 -1
  64. package/dist/{device-ca-D21ZP00q.js → device-ca-CuWuRW9N.js} +1 -1
  65. package/dist/{dist-CCH3XPqO.js → dist-DVe0Nsp8.js} +48 -16
  66. package/dist/{dist-CYcBqnXk.mjs → dist-DjD2M79P.mjs} +43 -5
  67. package/dist/file-host-worker.js +1 -1
  68. package/dist/file-host-worker.mjs +1 -1
  69. package/dist/index.js +132 -795
  70. package/dist/index.mjs +133 -753
  71. package/dist/kernel/index.d.ts +7 -21
  72. package/dist/kernel/moleculer/agent-ui-unlock.d.ts +7 -32
  73. package/dist/kernel/moleculer/broker-factory.d.ts +3 -9
  74. package/dist/kernel/moleculer/broker-transport-swap.d.ts +17 -0
  75. package/dist/kernel/moleculer/hub-service.d.ts +6 -16
  76. package/dist/kernel/moleculer/mesh-access-middleware.d.ts +7 -17
  77. package/dist/kernel/moleculer/mesh-identity.d.ts +57 -0
  78. package/dist/kernel/moleculer/mesh-mtls/constants.d.ts +1 -4
  79. package/dist/kernel/moleculer/mesh-mtls/index.d.ts +1 -4
  80. package/dist/kernel/moleculer/mesh-mtls/mesh-ca.d.ts +1 -1
  81. package/dist/kernel/moleculer/mesh-mtls/mesh-renewal.d.ts +1 -1
  82. package/dist/kernel/moleculer/node-registry.d.ts +0 -6
  83. package/dist/kernel/moleculer/register-node-client.d.ts +9 -7
  84. package/dist/{restore-archive-5ml7uYMf.mjs → restore-archive-BxmP1ChO.mjs} +1 -1
  85. package/dist/{restore-archive-Do0QwAik.js → restore-archive-D4h904rb.js} +1 -1
  86. package/dist/{retired-settings-keys-CyDdyjLP.mjs → retired-settings-keys-CQaknvx1.mjs} +1 -1
  87. package/dist/{retired-settings-keys-CEiCaI_j.js → retired-settings-keys-CYP5IZJ5.js} +1 -1
  88. package/dist/{wal-maintenance-LZYd8iT-.js → wal-maintenance-Br60onAQ.js} +0 -0
  89. package/dist/{wal-maintenance-DgLLPK14.mjs → wal-maintenance-CaDsrJM_.mjs} +0 -0
  90. package/package.json +1 -1
  91. package/dist/builtins/system-config/cluster-secret-keeper.d.ts +0 -63
  92. package/dist/constants-CrMPWOug.mjs +0 -102
  93. package/dist/constants-CuOfMdYe.js +0 -221
  94. package/dist/kernel/moleculer/agent-mesh-authenticator.d.ts +0 -91
  95. package/dist/kernel/moleculer/cluster-secret.d.ts +0 -46
  96. package/dist/kernel/moleculer/mesh-auth-mode.d.ts +0 -58
  97. package/dist/kernel/moleculer/mesh-authenticator.d.ts +0 -77
  98. package/dist/kernel/moleculer/mesh-auto-enforce.d.ts +0 -46
  99. package/dist/kernel/moleculer/mesh-join-client.d.ts +0 -73
  100. package/dist/kernel/moleculer/mesh-join-hold.d.ts +0 -85
  101. package/dist/kernel/moleculer/mesh-join-proof.d.ts +0 -39
  102. package/dist/kernel/moleculer/mesh-mtls/mesh-enroll.d.ts +0 -34
  103. 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-CCH3XPqO.js");
4
- const require_device_ca = require("./device-ca-D21ZP00q.js");
3
+ const require_dist = require("./dist-DVe0Nsp8.js");
4
+ const require_device_ca = require("./device-ca-CuWuRW9N.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-LZYd8iT-.js");
25
+ const require_wal_maintenance = require("./wal-maintenance-Br60onAQ.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-CuOfMdYe.js");
31
+ const require_constants = require("./constants-GENKqk9k.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-Do0QwAik.js");
39
+ const require_restore_archive = require("./restore-archive-D4h904rb.js");
40
40
  let zod = require("zod");
41
41
  let node_crypto = require("node:crypto");
42
42
  node_crypto = require_chunk.__toESM(node_crypto);
@@ -15183,11 +15183,10 @@ function createBroker(config) {
15183
15183
  },
15184
15184
  metrics: metricsConfig
15185
15185
  });
15186
- const transport = createAgentTransport(config);
15187
15186
  return new require_builtins_system_config_system_config_addon.ServiceBroker({
15188
15187
  nodeID,
15189
15188
  serializer: "MsgPack",
15190
- transporter: transport.kind === "tls" ? transport.transporter : transport.descriptor,
15189
+ transporter: createAgentTransport(config).transporter,
15191
15190
  ...config.middlewares !== void 0 ? { middlewares: [...config.middlewares] } : {},
15192
15191
  logger: {
15193
15192
  type: "Console",
@@ -15222,37 +15221,21 @@ function createAgentTransport(config) {
15222
15221
  const useHostname = resolveUseHostname();
15223
15222
  const agentListenPort = config.agentListenPort ?? deriveAgentListenPort(nodeID);
15224
15223
  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
- }
15224
+ const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
15243
15225
  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
- }
15226
+ kind: "tls",
15227
+ transporter: new require_builtins_system_config_system_config_addon.TlsTcpTransporter({
15228
+ port: agentListenPort,
15229
+ tlsPort: config.agentTlsListenPort ?? 6443,
15230
+ peerTlsPort: hubDialPort,
15231
+ hubOnlyPeers: true,
15232
+ maxPacketSize: 10 * 1024 * 1024,
15233
+ useHostname,
15234
+ debug: false,
15235
+ ...config.meshTls !== void 0 ? { meshTls: config.meshTls } : {},
15236
+ udpDiscovery: false,
15237
+ ...urls !== void 0 ? { urls } : {}
15238
+ })
15256
15239
  };
15257
15240
  }
15258
15241
  function normalizeHubUrl(raw, defaultPort) {
@@ -15271,23 +15254,6 @@ function getBrokerTlsTransporter(broker) {
15271
15254
  }
15272
15255
  //#endregion
15273
15256
  //#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
15257
  function isObject(value) {
15292
15258
  return typeof value === "object" && value !== null;
15293
15259
  }
@@ -15322,7 +15288,7 @@ function currentBrokerTransporter(broker) {
15322
15288
  }
15323
15289
  /** Build the transporter an {@link AgentTransport} describes (nothing is bound or dialled yet). */
15324
15290
  function buildTransporter(transport) {
15325
- const tx = transport.kind === "tls" ? transport.transporter : require_builtins_system_config_system_config_addon.Transporters.resolve(transport.descriptor);
15291
+ const tx = transport.transporter;
15326
15292
  if (!isTransporterLike(tx)) throw new Error("the agent transport is not a Moleculer transporter");
15327
15293
  return { tx };
15328
15294
  }
@@ -23740,23 +23706,8 @@ function createHubService(deps) {
23740
23706
  deps.onSetLogLevel?.(ctx.params.level);
23741
23707
  return true;
23742
23708
  } },
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
23709
  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);
23710
+ deps.meshIdentity?.admitRegistration(senderOf$1(ctx), ctx.params.nodeId);
23760
23711
  deps.onRegisterNode?.(ctx.params);
23761
23712
  return { ok: true };
23762
23713
  } },
@@ -23903,14 +23854,14 @@ var HubNodeRegistry = class {
23903
23854
  //#region src/kernel/moleculer/register-node-client.ts
23904
23855
  /**
23905
23856
  * 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) {
23857
+ * optionally its device-scoped native caps, and optionally the node's
23858
+ * root-package identity (runtime-updatable node packages: version
23859
+ * visibility). `nativeCaps` is omitted entirely on the first handshake;
23860
+ * `rootPackage` is omitted by nodes that do not run the root-package model
23861
+ * (UDS children). Who the sender is comes from its certificate (D857), not
23862
+ * from the payload.
23863
+ */
23864
+ function buildNodeManifest(nodeId, addons, nativeCaps, rootPackage) {
23914
23865
  return {
23915
23866
  nodeId,
23916
23867
  addons: addons.map((a) => ({
@@ -23922,7 +23873,6 @@ function buildNodeManifest(nodeId, addons, nativeCaps, clusterSecretHash, rootPa
23922
23873
  addonId: n.addonId,
23923
23874
  deviceIds: [...n.deviceIds]
23924
23875
  })) },
23925
- ...clusterSecretHash === void 0 ? {} : { clusterSecretHash },
23926
23876
  ...rootPackage === void 0 ? {} : { rootPackage: {
23927
23877
  name: rootPackage.name,
23928
23878
  version: rootPackage.version
@@ -23960,10 +23910,7 @@ async function callRegisterNodeWithRetry(broker, params, opts) {
23960
23910
  if (attempt > 0) opts.log?.(`[register-node] ${action} acked after ${attempt + 1} attempt(s)`);
23961
23911
  return;
23962
23912
  } catch (err) {
23963
- if (require_constants.isClusterSecretMismatchError(err)) {
23964
- opts.log?.(`[register-node] ${action} REJECTED — cluster secret mismatch; not retrying`);
23965
- throw err;
23966
- }
23913
+ opts.onAttemptFailed?.(err);
23967
23914
  attempt++;
23968
23915
  const wait = Math.min(base * 2 ** (attempt - 1), 5e3);
23969
23916
  opts.log?.(`[register-node] ${action} failed (attempt ${attempt}) — retrying in ${wait}ms: ${err instanceof Error ? err.message : String(err)}`);
@@ -23972,180 +23919,64 @@ async function callRegisterNodeWithRetry(broker, params, opts) {
23972
23919
  }
23973
23920
  }
23974
23921
  //#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. */
23922
+ //#region src/kernel/moleculer/mesh-identity.ts
23923
+ /**
23924
+ * Mesh identity (D857) — who is calling a node, decided by the CERTIFICATE.
23925
+ *
23926
+ * There is no shared secret. A node is admitted by the mesh when its mutual-TLS
23927
+ * handshake chained to the mesh CA, its leaf CN is the node id it speaks as, and
23928
+ * the leaf is not revoked (D856). The transport enforces the first two on every
23929
+ * packet (`TlsTcpTransporter.onIncomingMessage` drops a `sender` that is not the
23930
+ * peer CN), and answers the third through `verifiedPeer`. These gates do one
23931
+ * thing: turn "is this sender a verified peer" into allow or deny, and keep a
23932
+ * short list of actions no other node may ever call.
23933
+ *
23934
+ * Hub gate: every other node must be a verified peer.
23935
+ * Agent gate: only the verified hub may call an agent; an agent's mesh has no
23936
+ * other peer (D848).
23937
+ *
23938
+ * Nothing here reads a credential, mints a nonce or remembers a node's state:
23939
+ * a verdict is a pure function of the transport's current knowledge, so a
23940
+ * revocation takes effect on the next packet.
23941
+ */
23942
+ /** Moleculer error `type`: the sender has no certificate identity this node accepts. */
24012
23943
  var MESH_NODE_UNAUTHENTICATED_TYPE = "MESH_NODE_UNAUTHENTICATED";
24013
23944
  /** Moleculer error `type`: the action is never callable from another node. */
24014
23945
  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
23946
  /** Reads a Moleculer error's `type`, including after an RPC round-trip. */
24038
23947
  function meshErrorType(err) {
24039
23948
  if (typeof err !== "object" || err === null || !("type" in err)) return null;
24040
23949
  const { type } = err;
24041
23950
  return typeof type === "string" ? type : null;
24042
23951
  }
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
23952
  /**
24084
23953
  * Services and actions no other node ever calls on the hub. `$process` spawns
24085
23954
  * runners with an arbitrary environment (code execution); `$node` is
24086
23955
  * 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.
23956
+ * issues itself.
24089
23957
  */
24090
- var REMOTE_FORBIDDEN_SERVICES$1 = new Set(["$process", "$node"]);
24091
- var REMOTE_FORBIDDEN_ACTIONS = new Set(["$hub.setLogLevel"]);
23958
+ var HUB_FORBIDDEN_SERVICES = new Set(["$process", "$node"]);
23959
+ var HUB_FORBIDDEN_ACTIONS = new Set(["$hub.setLogLevel"]);
24092
23960
  function isRemoteForbiddenAction(action) {
24093
- if (REMOTE_FORBIDDEN_ACTIONS.has(action)) return true;
23961
+ if (HUB_FORBIDDEN_ACTIONS.has(action)) return true;
23962
+ const dot = action.indexOf(".");
23963
+ return dot > 0 && HUB_FORBIDDEN_SERVICES.has(action.slice(0, dot));
23964
+ }
23965
+ /** Moleculer introspection — never from another node, on an agent either. */
23966
+ var AGENT_FORBIDDEN_SERVICES = new Set(["$node"]);
23967
+ function isRemoteForbiddenOnAgent(action) {
24094
23968
  const dot = action.indexOf(".");
24095
- return dot > 0 && REMOTE_FORBIDDEN_SERVICES$1.has(action.slice(0, dot));
23969
+ return dot > 0 && AGENT_FORBIDDEN_SERVICES.has(action.slice(0, dot));
24096
23970
  }
24097
23971
  function refuse(message, type, code = 403) {
24098
23972
  return new require_builtins_system_config_system_config_addon.Errors.MoleculerClientError(message, code, type);
24099
23973
  }
24100
- var MeshAuthenticator = class {
23974
+ var NOT_PAIRED_HINT = "pair it with this hub (System → Cluster → Agents) so it holds a certificate from the mesh CA";
23975
+ /** The hub's gate: every other node must hold a verified certificate identity. */
23976
+ var MeshIdentityGate = class {
24101
23977
  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
23978
  constructor(deps) {
24110
23979
  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
23980
  }
24150
23981
  admitCall(sender, action) {
24151
23982
  if (sender === this.deps.ownNodeId) return { verdict: "allow" };
@@ -24154,7 +23985,6 @@ var MeshAuthenticator = class {
24154
23985
  errorType: MESH_ACTION_FORBIDDEN_TYPE,
24155
23986
  message: `"${action}" is not callable from another node (caller "${sender}")`
24156
23987
  };
24157
- if (PRE_AUTH_ACTIONS.has(action)) return { verdict: "allow" };
24158
23988
  return this.admitSender(sender, action);
24159
23989
  }
24160
23990
  /** Same rule as a call, for an inbound event. */
@@ -24162,103 +23992,72 @@ var MeshAuthenticator = class {
24162
23992
  if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24163
23993
  return this.admitSender(sender, `event:${eventName}`);
24164
23994
  }
23995
+ /** Throws when `sender` may not register `nodeId`: a node registers only itself. */
23996
+ admitRegistration(sender, nodeId) {
23997
+ if (sender === this.deps.ownNodeId) return;
23998
+ if (nodeId !== sender) throw refuse(`registration refused: node "${sender}" may register only itself, not "${nodeId}"`, MESH_NODE_UNAUTHENTICATED_TYPE);
23999
+ if (!this.deps.isVerifiedPeer(sender)) {
24000
+ this.deps.onRefused?.(sender, "$hub.registerNode");
24001
+ throw refuse(`node "${sender}" holds no valid mesh certificate — ${NOT_PAIRED_HINT}`, MESH_NODE_UNAUTHENTICATED_TYPE);
24002
+ }
24003
+ }
24165
24004
  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 {
24005
+ if (this.deps.isVerifiedPeer(sender)) return { verdict: "allow" };
24006
+ this.deps.onRefused?.(sender, what);
24007
+ return {
24169
24008
  verdict: "deny",
24170
24009
  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`
24010
+ message: `node "${sender}" holds no valid mesh certificate — ${NOT_PAIRED_HINT}`
24172
24011
  };
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
- }
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
24012
  }
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);
24013
+ };
24014
+ /**
24015
+ * An agent's inbound gate: the hub, proven by the certificate the agent's TLS
24016
+ * listener already verified, and nobody else. An agent that is not paired holds
24017
+ * no certificate, so it admits no one.
24018
+ */
24019
+ var AgentMeshIdentityGate = class {
24020
+ deps;
24021
+ hubNodeId;
24022
+ constructor(deps) {
24023
+ this.deps = deps;
24024
+ this.hubNodeId = deps.hubNodeId ?? "hub";
24207
24025
  }
24208
- /** Node ids that ever completed the challenge–response since the hub started. */
24209
- everAuthenticatedNodeIds() {
24210
- return this.everAuthenticated;
24026
+ admitCall(sender, action) {
24027
+ if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24028
+ if (isRemoteForbiddenOnAgent(action)) return {
24029
+ verdict: "deny",
24030
+ errorType: MESH_ACTION_FORBIDDEN_TYPE,
24031
+ message: `"${action}" is not callable from another node (caller "${sender}")`
24032
+ };
24033
+ return this.admitSender(sender, action);
24211
24034
  }
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];
24035
+ admitEvent(sender, eventName) {
24036
+ if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24037
+ return this.admitSender(sender, `event:${eventName}`);
24220
24038
  }
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));
24039
+ admitSender(sender, what) {
24040
+ if (sender === this.hubNodeId && this.deps.isVerifiedPeer(sender)) return { verdict: "allow" };
24041
+ this.deps.onRefused?.(sender, what);
24227
24042
  return {
24228
- mode: this.deps.mode(),
24229
- nodes
24043
+ verdict: "deny",
24044
+ errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24045
+ 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
24046
  };
24231
24047
  }
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
24048
  };
24249
24049
  //#endregion
24250
24050
  //#region src/kernel/moleculer/mesh-access-middleware.ts
24251
24051
  /**
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.
24052
+ * Mesh gate middleware (D802, D857): wraps every LOCAL action and event handler
24053
+ * so it sees each request another node sends with `ctx.nodeID` = the sender.
24254
24054
  *
24255
24055
  * 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`).
24056
+ * - hub: {@link MeshIdentityGate} (the sender holds a verified certificate);
24057
+ * - agent: {@link AgentMeshIdentityGate} (the sender is the certified hub).
24259
24058
  *
24260
24059
  * For a request from another node it:
24261
- * 1. asks the gate's `admitCall` — refuse, tolerate or allow;
24060
+ * 1. asks the gate's `admitCall` — refuse or allow;
24262
24061
  * 2. strips a forged identity from the params ({@link stripForgedIdentity}).
24263
24062
  *
24264
24063
  * Calls a node makes to itself (`ctx.nodeID` = own) pass untouched.
@@ -24301,6 +24100,9 @@ function senderOf(ctx) {
24301
24100
  const nodeID = ctx.nodeID;
24302
24101
  return typeof nodeID === "string" && nodeID.length > 0 ? nodeID : null;
24303
24102
  }
24103
+ function noSenderError(action) {
24104
+ return new require_builtins_system_config_system_config_addon.Errors.MoleculerClientError(`"${action}" refused: the call names no sender node`, 403, MESH_NODE_UNAUTHENTICATED_TYPE);
24105
+ }
24304
24106
  function paramNodeId(params) {
24305
24107
  return params !== null && typeof params === "object" ? Reflect.get(params, "nodeId") : void 0;
24306
24108
  }
@@ -24309,7 +24111,7 @@ function paramNodeId(params) {
24309
24111
  * so it wraps every service, including the ones Moleculer creates itself.
24310
24112
  */
24311
24113
  function createMeshAccessMiddleware(options) {
24312
- const { ownNodeId, authenticator, logger } = options;
24114
+ const { ownNodeId, gate, logger } = options;
24313
24115
  const dropped = /* @__PURE__ */ new Map();
24314
24116
  const noteDroppedEvent = (sender, eventName) => {
24315
24117
  const now = Date.now();
@@ -24339,10 +24141,9 @@ function createMeshAccessMiddleware(options) {
24339
24141
  const name = action.name ?? "";
24340
24142
  return function meshGatedAction(ctx) {
24341
24143
  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);
24144
+ if (sender === null) return Promise.reject(noSenderError(name));
24145
+ if (sender === ownNodeId) return next.call(this, ctx);
24146
+ return runAdmitted.call(this, ctx, sender, gate.admitCall(sender, name));
24346
24147
  };
24347
24148
  function runAdmitted(ctx, sender, verdict) {
24348
24149
  if (verdict.verdict === "deny") {
@@ -24362,235 +24163,21 @@ function createMeshAccessMiddleware(options) {
24362
24163
  const name = event.name ?? "";
24363
24164
  return function meshGatedEvent(ctx) {
24364
24165
  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);
24166
+ if (sender === null) {
24167
+ noteDroppedEvent("(no sender)", name);
24168
+ return Promise.resolve();
24169
+ }
24170
+ if (sender === ownNodeId) return Promise.resolve(next.call(this, ctx));
24171
+ if (gate.admitEvent(sender, name).verdict === "deny") {
24172
+ noteDroppedEvent(sender, name);
24173
+ return Promise.resolve();
24174
+ }
24175
+ return Promise.resolve(next.call(this, ctx));
24375
24176
  };
24376
24177
  }
24377
24178
  };
24378
24179
  }
24379
24180
  //#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
24181
  //#region src/kernel/moleculer/agent-event-scope.ts
24595
24182
  /** Moleculer's EVENT packet type (`packets.PACKET_EVENT`). */
24596
24183
  var PACKET_EVENT = "EVENT";
@@ -24625,213 +24212,6 @@ function createAgentEventScope(opts) {
24625
24212
  };
24626
24213
  }
24627
24214
  //#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
24215
  //#region src/kernel/moleculer/readiness-service.ts
24836
24216
  /**
24837
24217
  * Service name AGENTS register their own readiness snapshot under.
@@ -27122,8 +26502,6 @@ exports.AGENT_DASHBOARD_ORIGINS_FIELD = require_builtins_system_config_system_co
27122
26502
  exports.AGENT_HTTPS_NAMES_COLLECTION = require_agent_https.AGENT_HTTPS_NAMES_COLLECTION;
27123
26503
  exports.AGENT_HTTPS_NAMES_COLUMNS = require_agent_https.AGENT_HTTPS_NAMES_COLUMNS;
27124
26504
  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
26505
  exports.AGENT_UI_UNLOCK_TTL_MS = require_builtins_system_config_system_config_addon.AGENT_UI_UNLOCK_TTL_MS;
27128
26506
  exports.AGENT_UI_UNLOCK_TYP = require_builtins_system_config_system_config_addon.AGENT_UI_UNLOCK_TYP;
27129
26507
  exports.AGENT_UI_UNLOCK_USE = require_builtins_system_config_system_config_addon.AGENT_UI_UNLOCK_USE;
@@ -27145,7 +26523,7 @@ exports.AdminTokenManager = require_builtins_local_auth_local_auth_addon.AdminTo
27145
26523
  exports.AgentHttpsInstallError = require_agent_https.AgentHttpsInstallError;
27146
26524
  exports.AgentHttpsNames = require_agent_https.AgentHttpsNames;
27147
26525
  exports.AgentMdnsAdvertiser = AgentMdnsAdvertiser;
27148
- exports.AgentMeshAuthenticator = AgentMeshAuthenticator;
26526
+ exports.AgentMeshIdentityGate = AgentMeshIdentityGate;
27149
26527
  exports.AgentPairing = require_builtins_system_config_system_config_addon.AgentPairing;
27150
26528
  exports.AlertCenterAddon = require_builtins_alerts_alerts_addon.AlertCenterAddon;
27151
26529
  exports.ApiKeyManager = require_builtins_local_auth_local_auth_addon.ApiKeyManager;
@@ -27160,11 +26538,6 @@ exports.CAP_ACTION_UNLABELLED = CAP_ACTION_UNLABELLED;
27160
26538
  exports.CAP_METHOD_NOT_IMPLEMENTED = CAP_METHOD_NOT_IMPLEMENTED;
27161
26539
  exports.CA_COMMON_NAME = require_agent_https.CA_COMMON_NAME;
27162
26540
  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
26541
  exports.CORE_CAP_SERVICE_NAME = CORE_CAP_SERVICE_NAME;
27169
26542
  exports.CalendarsAddon = require_builtins_calendars_calendars_addon.CalendarsAddon;
27170
26543
  exports.CapRouteError = CapRouteError;
@@ -27185,8 +26558,6 @@ exports.DEFAULT_DATA_PATH = DEFAULT_DATA_PATH;
27185
26558
  exports.DEFAULT_HUB_TLS_TCP_PORT = require_constants.DEFAULT_HUB_TLS_TCP_PORT;
27186
26559
  exports.DEFAULT_LAN_HTTP_PORT = require_hub_mdns_ciao.DEFAULT_LAN_HTTP_PORT;
27187
26560
  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
26561
  exports.DEVICE_CA_KEY_REF = require_device_ca.DEVICE_CA_KEY_REF;
27191
26562
  exports.DEVICE_SETTINGS_CONTRIBUTION_METHODS = require_dist.DEVICE_SETTINGS_CONTRIBUTION_METHODS;
27192
26563
  exports.DEVICE_STATUS_METHOD = require_dist.DEVICE_STATUS_METHOD;
@@ -27234,7 +26605,6 @@ exports.INFRA_CAPABILITIES = INFRA_CAPABILITIES;
27234
26605
  exports.IntegrationRegistry = IntegrationRegistry;
27235
26606
  exports.JWT_SIGNING_KEY_REF = require_device_ca.JWT_SIGNING_KEY_REF;
27236
26607
  exports.JobJournal = JobJournal;
27237
- exports.JoinTokenJtiStore = require_builtins_system_config_system_config_addon.JoinTokenJtiStore;
27238
26608
  exports.JwtSigningKeyUnavailableError = require_device_ca.JwtSigningKeyUnavailableError;
27239
26609
  exports.LEAF_RENEWAL_WINDOW_DAYS = require_agent_https.LEAF_RENEWAL_WINDOW_DAYS;
27240
26610
  exports.LifecycleJobEngine = LifecycleJobEngine;
@@ -27252,28 +26622,19 @@ exports.LokiLoggingAddon = require_builtins_loki_logging_index.LokiLoggingAddon$
27252
26622
  exports.MAX_CAP_ACTIONS_PER_PEER = MAX_CAP_ACTIONS_PER_PEER;
27253
26623
  exports.MAX_LEAF_VALIDITY_DAYS = require_agent_https.MAX_LEAF_VALIDITY_DAYS;
27254
26624
  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
26625
  exports.MESH_CA_FIELD = require_constants.MESH_CA_FIELD;
27258
26626
  exports.MESH_CA_KEY_REF = require_constants.MESH_CA_KEY_REF;
27259
26627
  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
26628
  exports.MESH_NODE_CERTIFICATES_COLLECTION = require_builtins_system_config_system_config_addon.MESH_NODE_CERTIFICATES_COLLECTION;
27266
26629
  exports.MESH_NODE_CERTIFICATES_COLUMNS = require_builtins_system_config_system_config_addon.MESH_NODE_CERTIFICATES_COLUMNS;
27267
26630
  exports.MESH_NODE_UNAUTHENTICATED_TYPE = MESH_NODE_UNAUTHENTICATED_TYPE;
27268
26631
  exports.MESH_QUEUE_TOP_N = MESH_QUEUE_TOP_N;
27269
26632
  exports.MESH_TLS_PORT_HELLO_FIELD = require_builtins_system_config_system_config_addon.MESH_TLS_PORT_HELLO_FIELD;
27270
26633
  exports.METHOD_ACCESS_MAP = require_dist.METHOD_ACCESS_MAP;
27271
- exports.MeshAuthenticator = MeshAuthenticator;
27272
26634
  exports.MeshCaKeeper = require_builtins_system_config_system_config_addon.MeshCaKeeper;
27273
26635
  exports.MeshCertificateRegistry = require_builtins_system_config_system_config_addon.MeshCertificateRegistry;
27274
26636
  exports.MeshCrl = require_builtins_system_config_system_config_addon.MeshCrl;
27275
- exports.MeshJoinClient = MeshJoinClient;
27276
- exports.MeshJoinHold = MeshJoinHold;
26637
+ exports.MeshIdentityGate = MeshIdentityGate;
27277
26638
  exports.ModelDownloadService = require_custom_action_registry.ModelDownloadService;
27278
26639
  exports.NATIVE_PROVIDER_SERVICE_INFIX = NATIVE_PROVIDER_SERVICE_INFIX;
27279
26640
  exports.NATIVE_SCAN_DEPTH = NATIVE_SCAN_DEPTH;
@@ -27397,7 +26758,6 @@ exports.capActionSuffix = capActionSuffix;
27397
26758
  exports.capBareAction = capBareAction;
27398
26759
  exports.capServiceName = capServiceName;
27399
26760
  exports.certificateNames = require_agent_https.certificateNames;
27400
- exports.checkClusterSecret = require_constants.checkClusterSecret;
27401
26761
  exports.classifyAddonDir = classifyAddonDir;
27402
26762
  exports.classifyCapRoute = classifyCapRoute;
27403
26763
  exports.clearHttpsListener = require_hub_mdns_ciao.clearHttpsListener;
@@ -27405,12 +26765,9 @@ exports.clearPendingRestart = clearPendingRestart;
27405
26765
  exports.clearPlatformKeychainKey = require_platform_key_source.clearPlatformKeychainKey;
27406
26766
  exports.closeLanHttp = require_hub_mdns_ciao.closeLanHttp;
27407
26767
  exports.clusterEventTopic = clusterEventTopic;
27408
- exports.clusterSecretMatches = require_constants.clusterSecretMatches;
27409
26768
  exports.collectAgentNames = require_agent_https.collectAgentNames;
27410
26769
  exports.collectCertIdentity = require_agent_https.collectCertIdentity;
27411
26770
  exports.collectModelFiles = require_custom_action_registry.collectModelFiles;
27412
- exports.computeHubJoinProof = computeHubJoinProof;
27413
- exports.computeNodeJoinProof = computeNodeJoinProof;
27414
26771
  exports.computePairingCommitment = require_builtins_system_config_system_config_addon.computePairingCommitment;
27415
26772
  exports.computePairingSas = require_builtins_system_config_system_config_addon.computePairingSas;
27416
26773
  exports.connectBrokerTransport = connectBrokerTransport;
@@ -27464,7 +26821,6 @@ exports.createUdsLogger = createUdsLogger;
27464
26821
  exports.createUdsLoggerWithControl = createUdsLoggerWithControl;
27465
26822
  exports.createV8Reclaimer = createV8Reclaimer;
27466
26823
  exports.currentBrokerTransporter = currentBrokerTransporter;
27467
- exports.decideMeshAutoEnforce = decideMeshAutoEnforce;
27468
26824
  exports.deleteModelFromDisk = require_custom_action_registry.deleteModelFromDisk;
27469
26825
  exports.deriveAgentListenPort = deriveAgentListenPort;
27470
26826
  exports.describeCsr = require_builtins_system_config_system_config_addon.describeCsr;
@@ -27492,7 +26848,6 @@ exports.emitDownForOwnedCaps = require_dist.emitDownForOwnedCaps;
27492
26848
  exports.emitHeapDiagnosticReport = emitHeapDiagnosticReport;
27493
26849
  exports.emitProcessNodeRegistered = require_builtins_system_config_system_config_addon.emitProcessNodeRegistered;
27494
26850
  exports.encodeFrame = encodeFrame;
27495
- exports.enrollMeshNode = require_builtins_system_config_system_config_addon.enrollMeshNode;
27496
26851
  exports.ensureAddonNativePrebuilds = ensureAddonNativePrebuilds;
27497
26852
  Object.defineProperty(exports, "ensureBinary", {
27498
26853
  enumerable: true,
@@ -27561,10 +26916,7 @@ Object.defineProperty(exports, "getPlatformInfo", {
27561
26916
  });
27562
26917
  exports.getPlatformKeychainKey = require_platform_key_source.getPlatformKeychainKey;
27563
26918
  exports.getProcessAgentHttpsNames = require_agent_https.getProcessAgentHttpsNames;
27564
- exports.getProcessClusterSecretGate = require_constants.getProcessClusterSecretGate;
27565
26919
  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
26920
  exports.getProcessMeshCaState = require_builtins_system_config_system_config_addon.getProcessMeshCaState;
27569
26921
  exports.getProcessMeshCertificateRegistry = require_builtins_system_config_system_config_addon.getProcessMeshCertificateRegistry;
27570
26922
  exports.getProcessMeshTlsListenerState = require_builtins_system_config_system_config_addon.getProcessMeshTlsListenerState;
@@ -27581,7 +26933,6 @@ exports.getSinglePidStats = require_resource_monitor.getSinglePidStats;
27581
26933
  exports.getUserManagementInternal = require_builtins_local_auth_local_auth_addon.getUserManagementInternal;
27582
26934
  exports.getWorkerDeviceRegistry = getWorkerDeviceRegistry;
27583
26935
  exports.hasDotNode = hasDotNode;
27584
- exports.hashClusterSecret = require_constants.hashClusterSecret;
27585
26936
  exports.heapSpaceField = heapSpaceField;
27586
26937
  exports.hostNodeIdOf = hostNodeIdOf;
27587
26938
  exports.hubHostFromMeshAddress = require_builtins_system_config_system_config_addon.hubHostFromMeshAddress;
@@ -27609,16 +26960,13 @@ exports.isAddonDeploySource = isAddonDeploySource;
27609
26960
  exports.isAllowedAgentDashboardReturnTo = require_builtins_system_config_system_config_addon.isAllowedAgentDashboardReturnTo;
27610
26961
  exports.isArrayBufferCensusReport = isArrayBufferCensusReport;
27611
26962
  exports.isArrayOutputSchema = require_dist.isArrayOutputSchema;
27612
- exports.isClusterSecretMismatchError = require_constants.isClusterSecretMismatchError;
27613
26963
  exports.isCollectionArrayMethod = require_dist.isCollectionArrayMethod;
27614
26964
  exports.isContainerBridgeAddress = require_agent_https.isContainerBridgeAddress;
27615
26965
  exports.isCredentialKeyName = isCredentialKeyName;
27616
26966
  exports.isInfraCapability = isInfraCapability;
27617
26967
  exports.isInstalledTransporter = isInstalledTransporter;
27618
26968
  exports.isLocalOnlyHostname = require_agent_https.isLocalOnlyHostname;
27619
- exports.isMeshAuthMode = require_builtins_system_config_system_config_addon.isMeshAuthMode;
27620
26969
  exports.isModelDownloaded = require_custom_action_registry.isModelDownloaded;
27621
- exports.isOwnChildNodeId = isOwnChildNodeId;
27622
26970
  exports.isPeerEventPacket = isPeerEventPacket;
27623
26971
  exports.isPrivateAddress = require_agent_https.isPrivateAddress;
27624
26972
  exports.isProcessVerifiedMeshPeer = require_builtins_system_config_system_config_addon.isProcessVerifiedMeshPeer;
@@ -27644,8 +26992,6 @@ exports.localSupportedPythonRuntimes = localSupportedPythonRuntimes;
27644
26992
  exports.mapSignalsToInferenceHardware = mapSignalsToInferenceHardware;
27645
26993
  exports.meshErrorType = meshErrorType;
27646
26994
  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
26995
  exports.mountNativeCapService = mountNativeCapService;
27650
26996
  exports.nextRssBudgetState = nextRssBudgetState;
27651
26997
  exports.normalizeIp = require_builtins_system_config_system_config_addon.normalizeIp;
@@ -27655,7 +27001,6 @@ exports.overlayGetStatus = overlayGetStatus;
27655
27001
  exports.parseAgentDashboardOrigins = require_builtins_system_config_system_config_addon.parseAgentDashboardOrigins;
27656
27002
  exports.parseCapAction = parseCapAction;
27657
27003
  exports.parseCidrList = require_builtins_system_config_system_config_addon.parseCidrList;
27658
- exports.parseMeshAuthMode = require_builtins_system_config_system_config_addon.parseMeshAuthMode;
27659
27004
  exports.parseRangeHeader = require_custom_action_registry.parseRangeHeader;
27660
27005
  exports.parseRssBudgetMb = parseRssBudgetMb;
27661
27006
  exports.parseTokenExpiry = require_builtins_local_auth_local_auth_addon.parseTokenExpiry;
@@ -27666,7 +27011,6 @@ exports.pinnedHttpsCaFingerprint = require_agent_https.pinnedHttpsCaFingerprint;
27666
27011
  exports.prepareBootTls = require_hub_mdns_ciao.prepareBootTls;
27667
27012
  exports.prepareRestoreArchive = require_restore_archive.prepareRestoreArchive;
27668
27013
  exports.probePlatform = probePlatform;
27669
- exports.processJoinTokenJtiStore = require_builtins_system_config_system_config_addon.processJoinTokenJtiStore;
27670
27014
  exports.processJwtSigningKey = require_device_ca.processJwtSigningKey;
27671
27015
  exports.processMeshCrl = require_builtins_system_config_system_config_addon.processMeshCrl;
27672
27016
  exports.proxyToUpstream = proxyToUpstream;
@@ -27693,7 +27037,6 @@ exports.registerLanHttpHandler = require_hub_mdns_ciao.registerLanHttpHandler;
27693
27037
  exports.reissueTlsLeaf = require_hub_mdns_ciao.reissueTlsLeaf;
27694
27038
  exports.reloadHttpsListener = require_hub_mdns_ciao.reloadHttpsListener;
27695
27039
  exports.renewMeshCertificate = require_builtins_system_config_system_config_addon.renewMeshCertificate;
27696
- exports.requestProcessMeshEnforcement = require_builtins_system_config_system_config_addon.requestProcessMeshEnforcement;
27697
27040
  exports.requireProcessMeshCa = require_builtins_system_config_system_config_addon.requireProcessMeshCa;
27698
27041
  exports.resolveFilePath = require_custom_action_registry.resolveFilePath;
27699
27042
  exports.resolveFormatRevision = require_custom_action_registry.resolveFormatRevision;
@@ -27717,11 +27060,7 @@ exports.setHubConnected = setHubConnected;
27717
27060
  exports.setNodeEventInterest = setNodeEventInterest;
27718
27061
  exports.setPlatformKeychainKey = require_platform_key_source.setPlatformKeychainKey;
27719
27062
  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
27063
  exports.setProcessMeshCertificateRegistry = require_builtins_system_config_system_config_addon.setProcessMeshCertificateRegistry;
27724
- exports.setProcessMeshEnforcer = require_builtins_system_config_system_config_addon.setProcessMeshEnforcer;
27725
27064
  exports.setProcessMeshPeerTransportLookup = require_builtins_system_config_system_config_addon.setProcessMeshPeerTransportLookup;
27726
27065
  exports.setProcessMeshTlsEnabler = require_builtins_system_config_system_config_addon.setProcessMeshTlsEnabler;
27727
27066
  exports.setProcessMeshTlsListenerState = require_builtins_system_config_system_config_addon.setProcessMeshTlsListenerState;
@@ -27749,10 +27088,8 @@ exports.udsChildLogToWorkerEntry = udsChildLogToWorkerEntry;
27749
27088
  exports.validateProviderRegistrations = validateProviderRegistrations;
27750
27089
  exports.validateUploadedTls = require_hub_mdns_ciao.validateUploadedTls;
27751
27090
  exports.verifyAgentUiUnlockTicket = require_builtins_system_config_system_config_addon.verifyAgentUiUnlockTicket;
27752
- exports.verifyAgentUiUnlockTicketEs256 = require_builtins_system_config_system_config_addon.verifyAgentUiUnlockTicketEs256;
27753
27091
  exports.verifyDeviceLeaf = require_device_ca.verifyDeviceLeaf;
27754
27092
  exports.verifyDeviceSignature = require_device_ca.verifyDeviceSignature;
27755
- exports.verifyMeshJoinToken = require_builtins_system_config_system_config_addon.verifyMeshJoinToken;
27756
27093
  exports.verifyPairingProof = require_builtins_system_config_system_config_addon.verifyPairingProof;
27757
27094
  exports.waitUntilReady = waitUntilReady;
27758
27095
  exports.writeExtraSans = require_hub_mdns_ciao.writeExtraSans;