@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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as __require } from "./chunk-CNf5ZN-e.mjs";
2
- import { $r as parseJsonObject, $t as isVoidInput, Ar as asJsonObject$1, Cr as DEVICE_STATUS_METHOD, Dr as ReadinessTimeoutError, Er as ReadinessRegistry, F as LOG_LEVEL_RANK, Fn as resolveMethodAuth, Ir as createEvent$1, Jt as isArrayOutputSchema, L as METHOD_ACCESS_MAP, Mr as asString$1, Q as addonSettingsCapability, Qt as isObjectInput, Rn as scopesAllowAddon, Sr as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Tn as procedureAuthKey, Tr as RUNTIME_DEFAULTS, Vr as expandCapMethods, Vt as extractNestedAddonId, Xn as supportedRuntimes, Yt as isCollectionArrayMethod, ai as scopeKey, an as lifecycleJobSchema, bn as objectInputDeclaresRequiredDeviceId, ei as parseJsonUnknown, en as kebabToCamel$1, fi as EventCategory$1, jr as asNumber, ln as logLevelAtMost, n as AGENT_MDNS_TXT_KEYS, ni as readinessKey, r as ALL_CAPABILITY_DEFINITIONS, ri as resolveCapMount, t as AGENT_MDNS_SERVICE_TYPE, un as looseSchema, xr as DATAPLANE_SECRET_HEADER$1, yn as objectInputDeclaresAddonId, yr as errMsg$1, zn as scopesAllowDeviceCap, zr as emitDownForOwnedCaps } from "./dist-CYcBqnXk.mjs";
3
- import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-CDjGQQPd.mjs";
2
+ import { $ as addonSettingsCapability, $r as parseJsonObject, $t as isObjectInput, Bn as scopesAllowDeviceCap, Br as emitDownForOwnedCaps, Cr as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Dr as ReadinessRegistry, En as procedureAuthKey, Er as RUNTIME_DEFAULTS, F as LOG_LEVEL_RANK, Hr as expandCapMethods, Ht as extractNestedAddonId, In as resolveMethodAuth, L as METHOD_ACCESS_MAP, Lr as createEvent$1, Mr as asNumber, Nr as asString$1, Or as ReadinessTimeoutError, Sr as DATAPLANE_SECRET_HEADER$1, Xt as isCollectionArrayMethod, Yt as isArrayOutputSchema, Zn as supportedRuntimes, ai as scopeKey, bn as objectInputDeclaresAddonId, br as errMsg$1, di as EventCategory$1, dn as looseSchema, ei as parseJsonUnknown, en as isVoidInput, jr as asJsonObject$1, n as AGENT_MDNS_TXT_KEYS, ni as readinessKey, on as lifecycleJobSchema, r as ALL_CAPABILITY_DEFINITIONS, ri as resolveCapMount, t as AGENT_MDNS_SERVICE_TYPE, tn as kebabToCamel$1, un as logLevelAtMost, wr as DEVICE_STATUS_METHOD, xn as objectInputDeclaresRequiredDeviceId, zn as scopesAllowAddon } from "./dist-DjD2M79P.mjs";
3
+ import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-BNM5ai4t.mjs";
4
4
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
5
5
  import "./builtins/alerts/index.mjs";
6
6
  import { CalendarsAddon } from "./builtins/calendars/calendars.addon.mjs";
@@ -21,24 +21,24 @@ import "./builtins/local-auth/index.mjs";
21
21
  import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index.mjs";
22
22
  import NativeMetricsAddon, { a as NativeMetricsProvider, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
23
23
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
24
- import { c as SqliteSettingsBackend, l as prefixRange } from "./wal-maintenance-DgLLPK14.mjs";
24
+ import { c as SqliteSettingsBackend, l as prefixRange } from "./wal-maintenance-CaDsrJM_.mjs";
25
25
  import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
26
26
  import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
27
27
  import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
28
28
  import "./builtins/storage-orchestrator/index.mjs";
29
29
  import { A as AgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, M as setProcessAgentHttpsNames, O as AGENT_HTTPS_NAMES_COLLECTION, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as isPrivateAddress, f as issueAgentHttpsLeaf, g as CA_COMMON_NAME, h as pinnedHttpsCaFingerprint, i as certificateNames, j as getProcessAgentHttpsNames, k as AGENT_HTTPS_NAMES_COLUMNS, l as isContainerBridgeAddress, m as pemDigest, n as acceptAgentSans, o as createAgentHttpsRequest, p as loadAgentHttps, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isLocalOnlyHostname, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts } from "./agent-https-B8lKYVtU.mjs";
30
- import { _ as getProcessClusterSecretGate, a as MESH_CA_KEY_REF, b as setProcessClusterSecretGate, d as CLUSTER_SECRET_REF, f as CLUSTER_SECRET_REJECTED_EXIT_CODE, g as clusterSecretMatches, h as checkClusterSecret, i as MESH_CA_FIELD, m as CLUSTER_SECRET_UNAVAILABLE_TYPE, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, p as CLUSTER_SECRET_SETTINGS_KEY, u as CLUSTER_SECRET_MISMATCH_TYPE, v as hashClusterSecret, y as isClusterSecretMismatchError } from "./constants-CrMPWOug.mjs";
31
- import { $ as requireProcessMeshCa, A as dropProcessPeer, At as setProcessMeshAuthStatusSource, B as openMeshTlsWhenRevocationsLoaded, C as Transporters, Ct as MESH_AUTH_MODE_FIELD, D as mintMeshJoinToken, Dt as parseMeshAuthMode, E as JoinTokenJtiStore, Et as isMeshAuthMode, F as onProcessNodeRegistered, Ft as readCidrSetting, G as RENEWAL_ABANDONED, H as MESH_NODE_CERTIFICATES_COLLECTION, I as setProcessMeshPeerTransportLookup, J as setProcessMeshCertificateRegistry, K as describeMeshLeaf, L as renewMeshCertificate, M as getProcessNodeMeshTransport, Mt as createCidrMatcher, N as getProcessPeerLeaf, Nt as normalizeIp, O as processJoinTokenJtiStore, Ot as requestProcessMeshEnforcement, P as isProcessVerifiedMeshPeer, Pt as parseCidrList, Q as getProcessMeshCaState, R as revokeMeshCertificate, S as ServiceBroker, St as verifyAgentUiUnlockTicketEs256, SystemConfigAddon, T as enrollMeshNode, Tt as getProcessMeshAuthStatus, U as MESH_NODE_CERTIFICATES_COLUMNS, V as setProcessMeshTlsListenerState, W as MeshCertificateRegistry, X as processMeshCrl, Y as MeshCrl, Z as MeshCaKeeper, _ as signPairingProof, _t as isAllowedAgentDashboardReturnTo, a as hubHostFromMeshAddress, at as generateMeshKeyPair, b as TlsTcpTransporter, bt as parseAgentDashboardOrigins, c as PAIRING_MAX_SESSIONS, ct as issueMeshLeafFromCsr, d as PAIRING_PROTOCOL, dt as AGENT_UI_UNLOCK_DOMAIN, et as caFingerprint, f as PAIRING_TTL_MS, ft as AGENT_UI_UNLOCK_TTL_MS, g as keyFingerprintShort, gt as UnlockTicketJtiStore, h as describeCsr, ht as AGENT_UI_UNLOCK_VERSION, i as AgentPairing, it as generateMeshCa, j as emitProcessNodeRegistered, jt as setProcessMeshEnforcer, k as verifyMeshJoinToken, kt as setProcessMeshAuthMode, l as PAIRING_PATHS, lt as loadMeshCa, m as computePairingSas, mt as AGENT_UI_UNLOCK_USE, n as HubPairing, nt as createMeshCsrPem, o as PAIRING_CODE_DIGITS, ot as isValidAgentNodeId, p as computePairingCommitment, pt as AGENT_UI_UNLOCK_TYP, q as getProcessMeshCertificateRegistry, r as PairingHttpError, rt as exportMeshPrivateKeyPem, s as PAIRING_MAX_CODE_ATTEMPTS, st as issueMeshLeafForNode, tt as caFingerprintCompact, u as PAIRING_PIN_DIGITS, ut as AGENT_DASHBOARD_ORIGINS_FIELD, v as verifyPairingProof, vt as mintAgentUiUnlockTicket, w as setProcessMeshTlsEnabler, wt as getProcessMeshAuthMode, x as Errors, xt as verifyAgentUiUnlockTicket, y as MESH_TLS_PORT_HELLO_FIELD, yt as mintAgentUiUnlockTicketEs256, z as getProcessMeshTlsListenerState } from "./builtins/system-config/system-config.addon.mjs";
30
+ import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-BFpowodq.mjs";
31
+ import { $ as generateMeshKeyPair, A as setProcessMeshPeerTransportLookup, B as describeMeshLeaf, C as setProcessMeshTlsEnabler, D as getProcessPeerLeaf, E as getProcessNodeMeshTransport, F as setProcessMeshTlsListenerState, G as MeshCaKeeper, H as setProcessMeshCertificateRegistry, I as MESH_NODE_CERTIFICATES_COLLECTION, J as caFingerprint, K as getProcessMeshCaState, L as MESH_NODE_CERTIFICATES_COLUMNS, M as revokeMeshCertificate, N as getProcessMeshTlsListenerState, O as isProcessVerifiedMeshPeer, P as openMeshTlsWhenRevocationsLoaded, Q as generateMeshCa, R as MeshCertificateRegistry, S as ServiceBroker, SystemConfigAddon, T as emitProcessNodeRegistered, U as MeshCrl, V as getProcessMeshCertificateRegistry, W as processMeshCrl, X as createMeshCsrPem, Y as caFingerprintCompact, Z as exportMeshPrivateKeyPem, _ as signPairingProof, _t as readCidrSetting, a as hubHostFromMeshAddress, at as AGENT_UI_UNLOCK_TTL_MS, b as TlsTcpTransporter, c as PAIRING_MAX_SESSIONS, ct as AGENT_UI_UNLOCK_VERSION, d as PAIRING_PROTOCOL, dt as mintAgentUiUnlockTicket, et as isValidAgentNodeId, f as PAIRING_TTL_MS, ft as parseAgentDashboardOrigins, g as keyFingerprintShort, gt as parseCidrList, h as describeCsr, ht as normalizeIp, i as AgentPairing, it as AGENT_DASHBOARD_ORIGINS_FIELD, j as renewMeshCertificate, k as onProcessNodeRegistered, l as PAIRING_PATHS, lt as UnlockTicketJtiStore, m as computePairingSas, mt as createCidrMatcher, n as HubPairing, nt as issueMeshLeafFromCsr, o as PAIRING_CODE_DIGITS, ot as AGENT_UI_UNLOCK_TYP, p as computePairingCommitment, pt as verifyAgentUiUnlockTicket, q as requireProcessMeshCa, r as PairingHttpError, rt as loadMeshCa, s as PAIRING_MAX_CODE_ATTEMPTS, st as AGENT_UI_UNLOCK_USE, tt as issueMeshLeafForNode, u as PAIRING_PIN_DIGITS, ut as isAllowedAgentDashboardReturnTo, v as verifyPairingProof, w as dropProcessPeer, x as Errors, y as MESH_TLS_PORT_HELLO_FIELD, z as RENEWAL_ABANDONED } from "./builtins/system-config/system-config.addon.mjs";
32
32
  import "./builtins/system-config/index.mjs";
33
33
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
34
34
  import { C as isModelDownloaded, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-BQnbN0DP.mjs";
35
35
  import { C as DEFAULT_LAN_HTTP_PORT, D as closeLanHttp, E as bindPendingLanHttp, O as readLanHttpState, S as reissueTlsLeaf, T as applyLanHttp, _ as splitPemCertificates, a as storeUploadedCertificate, b as ensureTlsCert, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsMode, h as readTlsAccessStatus, i as revertToGeneratedCertificate, k as registerLanHttpHandler, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as validateUploadedTls, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as writeExtraSans, w as allFamiliesListenHost, x as loadTlsCert, y as writeTlsMode } from "./hub-mdns-ciao-DJRwtlA8.mjs";
36
36
  import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
37
37
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
38
- import { c as BackupDecryptError, f as generateBackupKeyPair, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-5ml7uYMf.mjs";
38
+ import { c as BackupDecryptError, f as generateBackupKeyPair, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-BxmP1ChO.mjs";
39
39
  import { z } from "zod";
40
40
  import * as crypto$1 from "node:crypto";
41
- import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
41
+ import { createHash, randomBytes, randomUUID } from "node:crypto";
42
42
  import { PYTHON_VERSION, buildBinaryPath, downloadBinary, ensureBinary, ensureBinary as ensureBinary$1, ensureFfmpeg, ensureFfmpeg as ensureFfmpeg$1, ensurePython, ensurePython as ensurePython$1, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonPackages as installPythonPackages$1, installPythonRequirements, installPythonRequirements as installPythonRequirements$1 } from "@camstack/types/node";
43
43
  import { connect, createConnection, createServer } from "node:net";
44
44
  import { mkdir, rm, stat, unlink } from "node:fs/promises";
@@ -15180,11 +15180,10 @@ function createBroker(config) {
15180
15180
  },
15181
15181
  metrics: metricsConfig
15182
15182
  });
15183
- const transport = createAgentTransport(config);
15184
15183
  return new ServiceBroker({
15185
15184
  nodeID,
15186
15185
  serializer: "MsgPack",
15187
- transporter: transport.kind === "tls" ? transport.transporter : transport.descriptor,
15186
+ transporter: createAgentTransport(config).transporter,
15188
15187
  ...config.middlewares !== void 0 ? { middlewares: [...config.middlewares] } : {},
15189
15188
  logger: {
15190
15189
  type: "Console",
@@ -15219,37 +15218,21 @@ function createAgentTransport(config) {
15219
15218
  const useHostname = resolveUseHostname();
15220
15219
  const agentListenPort = config.agentListenPort ?? deriveAgentListenPort(nodeID);
15221
15220
  const hubDialPort = config.meshTls !== void 0 ? config.tlsPort ?? 6443 : tcpPort;
15222
- if (config.meshTls !== void 0) {
15223
- const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
15224
- return {
15225
- kind: "tls",
15226
- transporter: new TlsTcpTransporter({
15227
- port: agentListenPort,
15228
- tlsPort: config.agentTlsListenPort ?? 6443,
15229
- peerTlsPort: hubDialPort,
15230
- hubOnlyPeers: true,
15231
- maxPacketSize: 10 * 1024 * 1024,
15232
- useHostname,
15233
- debug: false,
15234
- meshTls: config.meshTls,
15235
- udpDiscovery: false,
15236
- ...urls !== void 0 ? { urls } : {}
15237
- })
15238
- };
15239
- }
15221
+ const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
15240
15222
  return {
15241
- kind: "tcp",
15242
- descriptor: {
15243
- type: "TCP",
15244
- options: {
15245
- maxPacketSize: 10 * 1024 * 1024,
15246
- port: agentListenPort,
15247
- useHostname,
15248
- debug: false,
15249
- udpDiscovery: false,
15250
- ...hubAddress ? { urls: normalizeHubUrl(hubAddress, tcpPort) } : {}
15251
- }
15252
- }
15223
+ kind: "tls",
15224
+ transporter: new TlsTcpTransporter({
15225
+ port: agentListenPort,
15226
+ tlsPort: config.agentTlsListenPort ?? 6443,
15227
+ peerTlsPort: hubDialPort,
15228
+ hubOnlyPeers: true,
15229
+ maxPacketSize: 10 * 1024 * 1024,
15230
+ useHostname,
15231
+ debug: false,
15232
+ ...config.meshTls !== void 0 ? { meshTls: config.meshTls } : {},
15233
+ udpDiscovery: false,
15234
+ ...urls !== void 0 ? { urls } : {}
15235
+ })
15253
15236
  };
15254
15237
  }
15255
15238
  function normalizeHubUrl(raw, defaultPort) {
@@ -15268,23 +15251,6 @@ function getBrokerTlsTransporter(broker) {
15268
15251
  }
15269
15252
  //#endregion
15270
15253
  //#region src/kernel/moleculer/broker-transport-swap.ts
15271
- /**
15272
- * Reconnecting a broker's TRANSPORT in place, without rebuilding the broker (D856 amendment).
15273
- *
15274
- * An agent changes how it dials the hub (a new hub address, a new cluster secret, a mesh leaf
15275
- * swap or its rollback) by replacing its transporter. It used to stop the whole `ServiceBroker`
15276
- * and build another. That threw away everything bound to the old one: the `$process` service
15277
- * (whose `stopped()` SIGTERMs every runner - the "child gone" lines), `$agent-cap-fwd`,
15278
- * `$agent`, the event bus, the addon services and every closure that captured the broker. The
15279
- * node came back ONLINE and capless, and the hub's confirm step then failed with
15280
- * "`$agent-cap-fwd.forward` is not found".
15281
- *
15282
- * The broker, its services, its registries and its child runners are all independent of the
15283
- * wire. So only the wire is replaced: disconnect the transit, forget the remote nodes (their
15284
- * connection is gone, and the next `$node.connected` is what re-runs the mesh join), install a
15285
- * new transporter on the SAME transit and connect it. Children never notice; the join's settle
15286
- * re-sends the full manifest (D3), which still carries every child.
15287
- */
15288
15254
  function isObject(value) {
15289
15255
  return typeof value === "object" && value !== null;
15290
15256
  }
@@ -15319,7 +15285,7 @@ function currentBrokerTransporter(broker) {
15319
15285
  }
15320
15286
  /** Build the transporter an {@link AgentTransport} describes (nothing is bound or dialled yet). */
15321
15287
  function buildTransporter(transport) {
15322
- const tx = transport.kind === "tls" ? transport.transporter : Transporters.resolve(transport.descriptor);
15288
+ const tx = transport.transporter;
15323
15289
  if (!isTransporterLike(tx)) throw new Error("the agent transport is not a Moleculer transporter");
15324
15290
  return { tx };
15325
15291
  }
@@ -23737,23 +23703,8 @@ function createHubService(deps) {
23737
23703
  deps.onSetLogLevel?.(ctx.params.level);
23738
23704
  return true;
23739
23705
  } },
23740
- joinChallenge: { handler(ctx) {
23741
- if (deps.meshAuth === void 0) throw new Errors.MoleculerClientError("mesh join is not enabled on this node", 404);
23742
- return deps.meshAuth.issueChallenge(senderOf$1(ctx));
23743
- } },
23744
- authenticateNode: { handler(ctx) {
23745
- if (deps.meshAuth === void 0) throw new Errors.MoleculerClientError("mesh join is not enabled on this node", 404);
23746
- return deps.meshAuth.authenticate(senderOf$1(ctx), ctx.params);
23747
- } },
23748
23706
  registerNode: { handler(ctx) {
23749
- if (deps.meshAuth !== void 0) {
23750
- deps.meshAuth.admitRegistration(senderOf$1(ctx), ctx.params);
23751
- deps.onRegisterNode?.(ctx.params);
23752
- return { ok: true };
23753
- }
23754
- const verdict = checkClusterSecret(deps.clusterSecretGate?.() ?? { kind: "off" }, ctx.params.clusterSecretHash);
23755
- if (verdict === "mismatch") throw new Errors.MoleculerError(`cluster secret mismatch — node "${ctx.params.nodeId}" rejected`, 403, CLUSTER_SECRET_MISMATCH_TYPE);
23756
- if (verdict === "unavailable") throw new Errors.MoleculerRetryableError(`the hub cannot read its cluster secret yet — node "${ctx.params.nodeId}" must retry`, 503, CLUSTER_SECRET_UNAVAILABLE_TYPE);
23707
+ deps.meshIdentity?.admitRegistration(senderOf$1(ctx), ctx.params.nodeId);
23757
23708
  deps.onRegisterNode?.(ctx.params);
23758
23709
  return { ok: true };
23759
23710
  } },
@@ -23900,14 +23851,14 @@ var HubNodeRegistry = class {
23900
23851
  //#region src/kernel/moleculer/register-node-client.ts
23901
23852
  /**
23902
23853
  * Build a `RegisterNodeParams` from a node id, its per-addon manifests,
23903
- * optionally its device-scoped native caps, optionally the SHA-256 hash
23904
- * of the cluster secret, and optionally the node's root-package identity
23905
- * (runtime-updatable node packages: version visibility). `nativeCaps` is
23906
- * omitted entirely on the first handshake; `clusterSecretHash` is omitted
23907
- * when no secret is configured; `rootPackage` is omitted by nodes that do
23908
- * not run the root-package model (UDS children).
23909
- */
23910
- function buildNodeManifest(nodeId, addons, nativeCaps, clusterSecretHash, rootPackage) {
23854
+ * optionally its device-scoped native caps, and optionally the node's
23855
+ * root-package identity (runtime-updatable node packages: version
23856
+ * visibility). `nativeCaps` is omitted entirely on the first handshake;
23857
+ * `rootPackage` is omitted by nodes that do not run the root-package model
23858
+ * (UDS children). Who the sender is comes from its certificate (D857), not
23859
+ * from the payload.
23860
+ */
23861
+ function buildNodeManifest(nodeId, addons, nativeCaps, rootPackage) {
23911
23862
  return {
23912
23863
  nodeId,
23913
23864
  addons: addons.map((a) => ({
@@ -23919,7 +23870,6 @@ function buildNodeManifest(nodeId, addons, nativeCaps, clusterSecretHash, rootPa
23919
23870
  addonId: n.addonId,
23920
23871
  deviceIds: [...n.deviceIds]
23921
23872
  })) },
23922
- ...clusterSecretHash === void 0 ? {} : { clusterSecretHash },
23923
23873
  ...rootPackage === void 0 ? {} : { rootPackage: {
23924
23874
  name: rootPackage.name,
23925
23875
  version: rootPackage.version
@@ -23957,10 +23907,7 @@ async function callRegisterNodeWithRetry(broker, params, opts) {
23957
23907
  if (attempt > 0) opts.log?.(`[register-node] ${action} acked after ${attempt + 1} attempt(s)`);
23958
23908
  return;
23959
23909
  } catch (err) {
23960
- if (isClusterSecretMismatchError(err)) {
23961
- opts.log?.(`[register-node] ${action} REJECTED — cluster secret mismatch; not retrying`);
23962
- throw err;
23963
- }
23910
+ opts.onAttemptFailed?.(err);
23964
23911
  attempt++;
23965
23912
  const wait = Math.min(base * 2 ** (attempt - 1), 5e3);
23966
23913
  opts.log?.(`[register-node] ${action} failed (attempt ${attempt}) — retrying in ${wait}ms: ${err instanceof Error ? err.message : String(err)}`);
@@ -23969,180 +23916,64 @@ async function callRegisterNodeWithRetry(broker, params, opts) {
23969
23916
  }
23970
23917
  }
23971
23918
  //#endregion
23972
- //#region src/kernel/moleculer/mesh-join-proof.ts
23973
- /**
23974
- * Mesh join — the challenge–response that authenticates a node to the hub
23975
- * (D802). Shared by the hub (`$hub.joinChallenge` / `$hub.authenticateNode`)
23976
- * and the agent (`MeshJoinClient`).
23977
- *
23978
- * The exchange, over the clear-text Moleculer transport:
23979
- *
23980
- * agent → hub `$hub.joinChallenge {}` → { nonce }
23981
- * agent → hub `$hub.authenticateNode { nodeId, nonce,
23982
- * clientNonce, proof }` → { hubProof }
23983
- *
23984
- * proof = HMAC-SHA256(K, "camstack-mesh-join/v1|node|<nodeId>|<nonce>")
23985
- * hubProof = HMAC-SHA256(K, "camstack-mesh-join/v1|hub|<nodeId>|<nonce>|<clientNonce>")
23986
- * K = SHA-256(cluster secret) — the value each side already holds
23987
- *
23988
- * What it buys over the D797 hash (`clusterSecretHash` in `registerNode`):
23989
- * - nothing reusable crosses the wire: the nonce is the hub's, single use,
23990
- * short-lived and bound to the SENDER node id, so a sniffed proof answers a
23991
- * challenge that no longer exists;
23992
- * - the agent authenticates the HUB too (`hubProof` over the agent's own
23993
- * nonce): a rogue node answering to `hub` on the LAN — found through UDP
23994
- * discovery — cannot prove it knows the secret, and the agent refuses it.
23995
- *
23996
- * What it does NOT buy: the transport stays clear text, and the sender node id
23997
- * of every later packet is self-declared. A LAN host that watches a node join
23998
- * can still spoof that node id afterwards. Only mutual TLS (the next step,
23999
- * `docs/design/2026-10-09-mesh-mtls-plan.md`) closes that.
24000
- */
24001
- /** Protocol version carried by the challenge; the agent refuses one it does not speak. */
24002
- var MESH_JOIN_PROTOCOL = 1;
24003
- var DOMAIN = "camstack-mesh-join/v1";
24004
- /** The hub's action that hands out a single-use nonce. */
24005
- var MESH_JOIN_CHALLENGE_ACTION = "$hub.joinChallenge";
24006
- /** The hub's action that verifies a node's proof and answers with its own. */
24007
- var MESH_JOIN_AUTHENTICATE_ACTION = "$hub.authenticateNode";
24008
- /** Moleculer error `type`: the sender has not authenticated and the hub enforces it. */
23919
+ //#region src/kernel/moleculer/mesh-identity.ts
23920
+ /**
23921
+ * Mesh identity (D857) — who is calling a node, decided by the CERTIFICATE.
23922
+ *
23923
+ * There is no shared secret. A node is admitted by the mesh when its mutual-TLS
23924
+ * handshake chained to the mesh CA, its leaf CN is the node id it speaks as, and
23925
+ * the leaf is not revoked (D856). The transport enforces the first two on every
23926
+ * packet (`TlsTcpTransporter.onIncomingMessage` drops a `sender` that is not the
23927
+ * peer CN), and answers the third through `verifiedPeer`. These gates do one
23928
+ * thing: turn "is this sender a verified peer" into allow or deny, and keep a
23929
+ * short list of actions no other node may ever call.
23930
+ *
23931
+ * Hub gate: every other node must be a verified peer.
23932
+ * Agent gate: only the verified hub may call an agent; an agent's mesh has no
23933
+ * other peer (D848).
23934
+ *
23935
+ * Nothing here reads a credential, mints a nonce or remembers a node's state:
23936
+ * a verdict is a pure function of the transport's current knowledge, so a
23937
+ * revocation takes effect on the next packet.
23938
+ */
23939
+ /** Moleculer error `type`: the sender has no certificate identity this node accepts. */
24009
23940
  var MESH_NODE_UNAUTHENTICATED_TYPE = "MESH_NODE_UNAUTHENTICATED";
24010
23941
  /** Moleculer error `type`: the action is never callable from another node. */
24011
23942
  var MESH_ACTION_FORBIDDEN_TYPE = "MESH_ACTION_FORBIDDEN";
24012
- /** Moleculer error `type`: the challenge is unknown, used or expired — ask for a new one. */
24013
- var MESH_JOIN_CHALLENGE_INVALID_TYPE = "MESH_JOIN_CHALLENGE_INVALID";
24014
- /** A fresh 32-byte nonce, hex. */
24015
- function createMeshNonce() {
24016
- return randomBytes(32).toString("hex");
24017
- }
24018
- function hmacHex(secretHash, message) {
24019
- return createHmac("sha256", Buffer.from(secretHash, "utf8")).update(message, "utf8").digest("hex");
24020
- }
24021
- /** The node's answer to the hub's nonce. `secretHash` is `hashClusterSecret(secret)`. */
24022
- function computeNodeJoinProof(secretHash, nodeId, nonce) {
24023
- return hmacHex(secretHash, `${DOMAIN}|node|${nodeId}|${nonce}`);
24024
- }
24025
- /** The hub's answer to the node's nonce — proves the hub holds the same secret. */
24026
- function computeHubJoinProof(secretHash, nodeId, nonce, clientNonce) {
24027
- return hmacHex(secretHash, `${DOMAIN}|hub|${nodeId}|${nonce}|${clientNonce}`);
24028
- }
24029
- /** Constant-time comparison of two hex proofs; any shape mismatch is `false`. */
24030
- function proofsEqual(expected, presented) {
24031
- if (typeof presented !== "string" || presented.length !== expected.length) return false;
24032
- return timingSafeEqual(Buffer.from(expected, "utf8"), Buffer.from(presented, "utf8"));
24033
- }
24034
23943
  /** Reads a Moleculer error's `type`, including after an RPC round-trip. */
24035
23944
  function meshErrorType(err) {
24036
23945
  if (typeof err !== "object" || err === null || !("type" in err)) return null;
24037
23946
  const { type } = err;
24038
23947
  return typeof type === "string" ? type : null;
24039
23948
  }
24040
- //#endregion
24041
- //#region src/kernel/moleculer/mesh-authenticator.ts
24042
- /**
24043
- * MeshAuthenticator — the hub's record of WHICH node is calling, and whether
24044
- * it proved it (D802).
24045
- *
24046
- * Every remote Moleculer action and event reaching the hub passes through
24047
- * {@link MeshAuthenticator.admitCall} (wired as a broker middleware,
24048
- * `mesh-access-middleware.ts`). The sender node id Moleculer reports is
24049
- * self-declared; this class binds it to a proof:
24050
- *
24051
- * - `$hub.joinChallenge` → a single-use nonce bound to the sender;
24052
- * - `$hub.authenticateNode` → the node's HMAC over that nonce and its own id
24053
- * (`mesh-join-proof.ts`). Success marks the node `authenticated` until its
24054
- * connection drops (`forget`, on `$node.disconnected`).
24055
- *
24056
- * Policy, per remote action:
24057
- * - the join actions and `registerNode` are open (they ARE the
24058
- * authentication; `registerNode` applies its own rule below);
24059
- * - {@link isRemoteForbiddenAction}: never from another node, whoever it is;
24060
- * - otherwise an authenticated (or, in `transition`, legacy) node is allowed;
24061
- * an unauthenticated one is refused in `enforced` and tolerated — with a
24062
- * warning and a row on System → Cluster — in `transition`.
24063
- *
24064
- * `registerNode` (`admitRegistration`): a node registers only itself; an
24065
- * authenticated node always may; the D797 hash is accepted as `legacy` in
24066
- * `transition` only; no proof at all is tolerated in `transition` only.
24067
- */
24068
- /** A challenge is answered within this window or not at all. */
24069
- var MESH_JOIN_CHALLENGE_TTL_MS = 6e4;
24070
- /** Outstanding challenges kept at most — a flood of fake node ids evicts the oldest. */
24071
- var MAX_PENDING_CHALLENGES = 256;
24072
- /** Unauthenticated senders remembered for the status page — bounded the same way. */
24073
- var MAX_TRACKED_NODES$1 = 256;
24074
- /** Actions any node may call before it has authenticated. */
24075
- var PRE_AUTH_ACTIONS = new Set([
24076
- MESH_JOIN_CHALLENGE_ACTION,
24077
- MESH_JOIN_AUTHENTICATE_ACTION,
24078
- "$hub.registerNode"
24079
- ]);
24080
23949
  /**
24081
23950
  * Services and actions no other node ever calls on the hub. `$process` spawns
24082
23951
  * runners with an arbitrary environment (code execution); `$node` is
24083
23952
  * Moleculer's introspection; `setLogLevel` is an operator action the hub
24084
- * issues itself. Nothing in the cluster calls them remotely, so refusing them
24085
- * costs nothing and closes the cheapest routes to the hub.
23953
+ * issues itself.
24086
23954
  */
24087
- var REMOTE_FORBIDDEN_SERVICES$1 = new Set(["$process", "$node"]);
24088
- var REMOTE_FORBIDDEN_ACTIONS = new Set(["$hub.setLogLevel"]);
23955
+ var HUB_FORBIDDEN_SERVICES = new Set(["$process", "$node"]);
23956
+ var HUB_FORBIDDEN_ACTIONS = new Set(["$hub.setLogLevel"]);
24089
23957
  function isRemoteForbiddenAction(action) {
24090
- if (REMOTE_FORBIDDEN_ACTIONS.has(action)) return true;
23958
+ if (HUB_FORBIDDEN_ACTIONS.has(action)) return true;
23959
+ const dot = action.indexOf(".");
23960
+ return dot > 0 && HUB_FORBIDDEN_SERVICES.has(action.slice(0, dot));
23961
+ }
23962
+ /** Moleculer introspection — never from another node, on an agent either. */
23963
+ var AGENT_FORBIDDEN_SERVICES = new Set(["$node"]);
23964
+ function isRemoteForbiddenOnAgent(action) {
24091
23965
  const dot = action.indexOf(".");
24092
- return dot > 0 && REMOTE_FORBIDDEN_SERVICES$1.has(action.slice(0, dot));
23966
+ return dot > 0 && AGENT_FORBIDDEN_SERVICES.has(action.slice(0, dot));
24093
23967
  }
24094
23968
  function refuse(message, type, code = 403) {
24095
23969
  return new Errors.MoleculerClientError(message, code, type);
24096
23970
  }
24097
- var MeshAuthenticator = class {
23971
+ var NOT_PAIRED_HINT = "pair it with this hub (System → Cluster → Agents) so it holds a certificate from the mesh CA";
23972
+ /** The hub's gate: every other node must hold a verified certificate identity. */
23973
+ var MeshIdentityGate = class {
24098
23974
  deps;
24099
- challenges = /* @__PURE__ */ new Map();
24100
- nodes = /* @__PURE__ */ new Map();
24101
- /** Completed the challenge–response at least once since the hub started. */
24102
- everAuthenticated = /* @__PURE__ */ new Set();
24103
- /** Let in WITHOUT the challenge–response at least once since the hub started. */
24104
- everTolerated = /* @__PURE__ */ new Set();
24105
- now;
24106
23975
  constructor(deps) {
24107
23976
  this.deps = deps;
24108
- this.now = deps.now ?? Date.now;
24109
- }
24110
- issueChallenge(sender) {
24111
- const nonce = createMeshNonce();
24112
- this.challenges.delete(sender);
24113
- if (this.challenges.size >= MAX_PENDING_CHALLENGES) {
24114
- const oldest = this.challenges.keys().next().value;
24115
- if (oldest !== void 0) this.challenges.delete(oldest);
24116
- }
24117
- this.challenges.set(sender, {
24118
- nonce,
24119
- expiresAt: this.now() + MESH_JOIN_CHALLENGE_TTL_MS
24120
- });
24121
- return {
24122
- protocol: 1,
24123
- nonce
24124
- };
24125
- }
24126
- authenticate(sender, params) {
24127
- if (params.nodeId !== sender) throw refuse(`mesh join refused: node "${sender}" presented a proof for "${String(params.nodeId)}"`, MESH_NODE_UNAUTHENTICATED_TYPE);
24128
- const pending = this.challenges.get(sender);
24129
- this.challenges.delete(sender);
24130
- 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);
24131
- const hash = this.secretHashOrThrow(sender);
24132
- if (!proofsEqual(computeNodeJoinProof(hash, sender, pending.nonce), params.proof)) throw refuse(`cluster secret mismatch — node "${sender}" rejected`, CLUSTER_SECRET_MISMATCH_TYPE);
24133
- this.record(sender, "authenticated");
24134
- this.everAuthenticated.add(sender);
24135
- this.deps.onAuthenticated?.(sender);
24136
- const clientNonce = typeof params.clientNonce === "string" ? params.clientNonce : "";
24137
- return {
24138
- ok: true,
24139
- hubProof: computeHubJoinProof(hash, sender, pending.nonce, clientNonce)
24140
- };
24141
- }
24142
- /** The node's connection dropped: it authenticates again when it returns. */
24143
- forget(nodeId) {
24144
- this.nodes.delete(nodeId);
24145
- this.challenges.delete(nodeId);
24146
23977
  }
24147
23978
  admitCall(sender, action) {
24148
23979
  if (sender === this.deps.ownNodeId) return { verdict: "allow" };
@@ -24151,7 +23982,6 @@ var MeshAuthenticator = class {
24151
23982
  errorType: MESH_ACTION_FORBIDDEN_TYPE,
24152
23983
  message: `"${action}" is not callable from another node (caller "${sender}")`
24153
23984
  };
24154
- if (PRE_AUTH_ACTIONS.has(action)) return { verdict: "allow" };
24155
23985
  return this.admitSender(sender, action);
24156
23986
  }
24157
23987
  /** Same rule as a call, for an inbound event. */
@@ -24159,103 +23989,72 @@ var MeshAuthenticator = class {
24159
23989
  if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24160
23990
  return this.admitSender(sender, `event:${eventName}`);
24161
23991
  }
23992
+ /** Throws when `sender` may not register `nodeId`: a node registers only itself. */
23993
+ admitRegistration(sender, nodeId) {
23994
+ if (sender === this.deps.ownNodeId) return;
23995
+ if (nodeId !== sender) throw refuse(`registration refused: node "${sender}" may register only itself, not "${nodeId}"`, MESH_NODE_UNAUTHENTICATED_TYPE);
23996
+ if (!this.deps.isVerifiedPeer(sender)) {
23997
+ this.deps.onRefused?.(sender, "$hub.registerNode");
23998
+ throw refuse(`node "${sender}" holds no valid mesh certificate — ${NOT_PAIRED_HINT}`, MESH_NODE_UNAUTHENTICATED_TYPE);
23999
+ }
24000
+ }
24162
24001
  admitSender(sender, what) {
24163
- const state = this.stateOf(sender);
24164
- if (state === "authenticated" || this.deps.isVerifiedPeer?.(sender) === true) return { verdict: "allow" };
24165
- if (this.deps.mode() === "enforced") return {
24002
+ if (this.deps.isVerifiedPeer(sender)) return { verdict: "allow" };
24003
+ this.deps.onRefused?.(sender, what);
24004
+ return {
24166
24005
  verdict: "deny",
24167
24006
  errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24168
- message: `node "${sender}" has not authenticated to this hub — enter the hub cluster secret (System → Cluster) in the agent and restart it`
24007
+ message: `node "${sender}" holds no valid mesh certificate — ${NOT_PAIRED_HINT}`
24169
24008
  };
24170
- if (state === "legacy") return { verdict: "allow" };
24171
- if (!this.nodes.has(sender)) {
24172
- this.record(sender, "unauthenticated");
24173
- this.noteTolerated(sender);
24174
- this.deps.onTolerated?.(sender, what);
24175
- }
24176
- return { verdict: "tolerate" };
24177
- }
24178
- /** Throws when `sender` may not register `params`; returns when it may. */
24179
- admitRegistration(sender, params) {
24180
- if (sender === this.deps.ownNodeId) return;
24181
- if (params.nodeId !== sender) throw refuse(`registration refused: node "${sender}" may register only itself, not "${params.nodeId}"`, MESH_NODE_UNAUTHENTICATED_TYPE);
24182
- if (this.stateOf(sender) === "authenticated" || this.deps.isVerifiedPeer?.(sender) === true) return;
24183
- 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`, CLUSTER_SECRET_MISMATCH_TYPE);
24184
- if (params.clusterSecretHash === void 0) {
24185
- this.admitSender(sender, "$hub.registerNode");
24186
- return;
24187
- }
24188
- const verdict = checkClusterSecret(this.deps.gate(), params.clusterSecretHash);
24189
- if (verdict === "mismatch") throw refuse(`cluster secret mismatch — node "${sender}" rejected`, CLUSTER_SECRET_MISMATCH_TYPE);
24190
- if (verdict === "unavailable") throw new Errors.MoleculerRetryableError(`the hub cannot read its cluster secret yet — node "${sender}" must retry`, 503, CLUSTER_SECRET_UNAVAILABLE_TYPE);
24191
- this.record(sender, this.deps.gate().kind === "on" ? "legacy" : "unauthenticated");
24192
- this.noteTolerated(sender);
24193
- }
24194
- noteTolerated(nodeId) {
24195
- if (this.everTolerated.size >= MAX_TRACKED_NODES$1) return;
24196
- this.everTolerated.add(nodeId);
24197
24009
  }
24198
- stateOf(nodeId) {
24199
- return this.nodes.get(nodeId)?.state ?? "unauthenticated";
24200
- }
24201
- /** Node ids that completed the challenge–response on their current connection. */
24202
- authenticatedNodeIds() {
24203
- return [...this.nodes].filter(([, r]) => r.state === "authenticated").map(([id]) => id);
24010
+ };
24011
+ /**
24012
+ * An agent's inbound gate: the hub, proven by the certificate the agent's TLS
24013
+ * listener already verified, and nobody else. An agent that is not paired holds
24014
+ * no certificate, so it admits no one.
24015
+ */
24016
+ var AgentMeshIdentityGate = class {
24017
+ deps;
24018
+ hubNodeId;
24019
+ constructor(deps) {
24020
+ this.deps = deps;
24021
+ this.hubNodeId = deps.hubNodeId ?? "hub";
24204
24022
  }
24205
- /** Node ids that ever completed the challenge–response since the hub started. */
24206
- everAuthenticatedNodeIds() {
24207
- return this.everAuthenticated;
24023
+ admitCall(sender, action) {
24024
+ if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24025
+ if (isRemoteForbiddenOnAgent(action)) return {
24026
+ verdict: "deny",
24027
+ errorType: MESH_ACTION_FORBIDDEN_TYPE,
24028
+ message: `"${action}" is not callable from another node (caller "${sender}")`
24029
+ };
24030
+ return this.admitSender(sender, action);
24208
24031
  }
24209
- /**
24210
- * Node ids let in without the challenge–response since the hub started.
24211
- * Bounded: past {@link MAX_TRACKED_NODES} a flood of fake ids stops adding,
24212
- * and the ones already here keep the transition open (the operator can still
24213
- * switch to `enforced` by hand).
24214
- */
24215
- everToleratedNodeIds() {
24216
- return [...this.everTolerated];
24032
+ admitEvent(sender, eventName) {
24033
+ if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24034
+ return this.admitSender(sender, `event:${eventName}`);
24217
24035
  }
24218
- snapshot() {
24219
- const nodes = [...this.nodes].map(([nodeId, r]) => ({
24220
- nodeId,
24221
- state: r.state,
24222
- since: r.since
24223
- })).toSorted((a, b) => a.nodeId.localeCompare(b.nodeId));
24036
+ admitSender(sender, what) {
24037
+ if (sender === this.hubNodeId && this.deps.isVerifiedPeer(sender)) return { verdict: "allow" };
24038
+ this.deps.onRefused?.(sender, what);
24224
24039
  return {
24225
- mode: this.deps.mode(),
24226
- nodes
24040
+ verdict: "deny",
24041
+ errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24042
+ 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`
24227
24043
  };
24228
24044
  }
24229
- record(nodeId, state) {
24230
- this.nodes.delete(nodeId);
24231
- if (this.nodes.size >= MAX_TRACKED_NODES$1) {
24232
- const oldestTolerated = [...this.nodes].find(([, r]) => r.state === "unauthenticated");
24233
- if (oldestTolerated !== void 0) this.nodes.delete(oldestTolerated[0]);
24234
- }
24235
- this.nodes.set(nodeId, {
24236
- state,
24237
- since: this.now()
24238
- });
24239
- }
24240
- secretHashOrThrow(sender) {
24241
- const gate = this.deps.gate();
24242
- if (gate.kind === "on") return gate.hash;
24243
- throw new 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, CLUSTER_SECRET_UNAVAILABLE_TYPE);
24244
- }
24245
24045
  };
24246
24046
  //#endregion
24247
24047
  //#region src/kernel/moleculer/mesh-access-middleware.ts
24248
24048
  /**
24249
- * Mesh gate middleware (D802): wraps every LOCAL action and event handler so
24250
- * it sees each request another node sends with `ctx.nodeID` = the sender.
24049
+ * Mesh gate middleware (D802, D857): wraps every LOCAL action and event handler
24050
+ * so it sees each request another node sends with `ctx.nodeID` = the sender.
24251
24051
  *
24252
24052
  * Used on both sides of the mesh:
24253
- * - hub: {@link MeshAuthenticator} (challenge–response join);
24254
- * - agent: {@link AgentMeshAuthenticator} (hub proven by mutual join + own
24255
- * children via `$agent.registerNode`).
24053
+ * - hub: {@link MeshIdentityGate} (the sender holds a verified certificate);
24054
+ * - agent: {@link AgentMeshIdentityGate} (the sender is the certified hub).
24256
24055
  *
24257
24056
  * For a request from another node it:
24258
- * 1. asks the gate's `admitCall` — refuse, tolerate or allow;
24057
+ * 1. asks the gate's `admitCall` — refuse or allow;
24259
24058
  * 2. strips a forged identity from the params ({@link stripForgedIdentity}).
24260
24059
  *
24261
24060
  * Calls a node makes to itself (`ctx.nodeID` = own) pass untouched.
@@ -24298,6 +24097,9 @@ function senderOf(ctx) {
24298
24097
  const nodeID = ctx.nodeID;
24299
24098
  return typeof nodeID === "string" && nodeID.length > 0 ? nodeID : null;
24300
24099
  }
24100
+ function noSenderError(action) {
24101
+ return new Errors.MoleculerClientError(`"${action}" refused: the call names no sender node`, 403, MESH_NODE_UNAUTHENTICATED_TYPE);
24102
+ }
24301
24103
  function paramNodeId(params) {
24302
24104
  return params !== null && typeof params === "object" ? Reflect.get(params, "nodeId") : void 0;
24303
24105
  }
@@ -24306,7 +24108,7 @@ function paramNodeId(params) {
24306
24108
  * so it wraps every service, including the ones Moleculer creates itself.
24307
24109
  */
24308
24110
  function createMeshAccessMiddleware(options) {
24309
- const { ownNodeId, authenticator, logger } = options;
24111
+ const { ownNodeId, gate, logger } = options;
24310
24112
  const dropped = /* @__PURE__ */ new Map();
24311
24113
  const noteDroppedEvent = (sender, eventName) => {
24312
24114
  const now = Date.now();
@@ -24336,10 +24138,9 @@ function createMeshAccessMiddleware(options) {
24336
24138
  const name = action.name ?? "";
24337
24139
  return function meshGatedAction(ctx) {
24338
24140
  const sender = senderOf(ctx);
24339
- if (sender === null || sender === ownNodeId) return next.call(this, ctx);
24340
- const verdict = authenticator.admitCall(sender, name);
24341
- if (verdict.verdict === "hold") return verdict.settled.then((settled) => runAdmitted.call(this, ctx, sender, settled));
24342
- return runAdmitted.call(this, ctx, sender, verdict);
24141
+ if (sender === null) return Promise.reject(noSenderError(name));
24142
+ if (sender === ownNodeId) return next.call(this, ctx);
24143
+ return runAdmitted.call(this, ctx, sender, gate.admitCall(sender, name));
24343
24144
  };
24344
24145
  function runAdmitted(ctx, sender, verdict) {
24345
24146
  if (verdict.verdict === "deny") {
@@ -24359,235 +24160,21 @@ function createMeshAccessMiddleware(options) {
24359
24160
  const name = event.name ?? "";
24360
24161
  return function meshGatedEvent(ctx) {
24361
24162
  const sender = senderOf(ctx);
24362
- if (sender === null || sender === ownNodeId) return Promise.resolve(next.call(this, ctx));
24363
- const verdict = authenticator.admitEvent(sender, name);
24364
- const deliver = (settled) => {
24365
- if (settled.verdict === "deny") {
24366
- noteDroppedEvent(sender, name);
24367
- return Promise.resolve();
24368
- }
24369
- return Promise.resolve(next.call(this, ctx));
24370
- };
24371
- return verdict.verdict === "hold" ? verdict.settled.then(deliver) : deliver(verdict);
24163
+ if (sender === null) {
24164
+ noteDroppedEvent("(no sender)", name);
24165
+ return Promise.resolve();
24166
+ }
24167
+ if (sender === ownNodeId) return Promise.resolve(next.call(this, ctx));
24168
+ if (gate.admitEvent(sender, name).verdict === "deny") {
24169
+ noteDroppedEvent(sender, name);
24170
+ return Promise.resolve();
24171
+ }
24172
+ return Promise.resolve(next.call(this, ctx));
24372
24173
  };
24373
24174
  }
24374
24175
  };
24375
24176
  }
24376
24177
  //#endregion
24377
- //#region src/kernel/moleculer/mesh-join-hold.ts
24378
- var DEFAULT_MESH_JOIN_MAX_HELD = 1e3;
24379
- var DEFAULT_MESH_JOIN_MAX_HOLD_MS = 15e3;
24380
- var MeshJoinHold = class {
24381
- opts;
24382
- waiters = [];
24383
- firstHeldAt = null;
24384
- overflow = 0;
24385
- timer = null;
24386
- /** Holding is open while a join is in flight; closed after a decision or the bound. */
24387
- open = true;
24388
- now;
24389
- constructor(opts) {
24390
- this.opts = opts;
24391
- this.now = opts.now ?? Date.now;
24392
- }
24393
- /** Whether a request arriving now would be held (a join is in flight). */
24394
- get holding() {
24395
- return this.open;
24396
- }
24397
- /** How many requests wait right now. */
24398
- get size() {
24399
- return this.waiters.length;
24400
- }
24401
- /** A join started: hold again. */
24402
- reopen() {
24403
- this.open = true;
24404
- }
24405
- /** Hold one request; `null` when holding is closed (the caller refuses it). */
24406
- hold(kind) {
24407
- if (!this.open) return null;
24408
- if (this.waiters.length >= (this.opts.maxHeld ?? 1e3)) {
24409
- this.overflow++;
24410
- return {
24411
- verdict: "hold",
24412
- settled: Promise.resolve(this.refusal("the hold before the mesh join is full"))
24413
- };
24414
- }
24415
- if (this.firstHeldAt === null) {
24416
- this.firstHeldAt = this.now();
24417
- this.timer = setTimeout(() => this.refuse("bound"), this.opts.maxHoldMs ?? 15e3);
24418
- this.timer.unref?.();
24419
- }
24420
- return {
24421
- verdict: "hold",
24422
- settled: new Promise((resolve) => {
24423
- this.waiters.push({
24424
- kind,
24425
- resolve
24426
- });
24427
- })
24428
- };
24429
- }
24430
- /** The join proved the hub: deliver everything held, in order. */
24431
- release() {
24432
- this.open = false;
24433
- this.settle({ verdict: "allow" }, "delivered", "authenticated");
24434
- }
24435
- /** The join failed, or the bound ran out: refuse everything held. */
24436
- refuse(reason) {
24437
- this.open = false;
24438
- this.settle(this.refusal(`the join ended "${reason}"`), "refused", reason);
24439
- }
24440
- refusal(why) {
24441
- return {
24442
- verdict: "deny",
24443
- errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24444
- message: `"${this.opts.hubNodeId}" sent this before the mesh join settled, and ${why}`
24445
- };
24446
- }
24447
- settle(verdict, outcome, reason) {
24448
- if (this.timer !== null) clearTimeout(this.timer);
24449
- this.timer = null;
24450
- const waiters = this.waiters;
24451
- const overflow = this.overflow;
24452
- const firstHeldAt = this.firstHeldAt;
24453
- this.waiters = [];
24454
- this.overflow = 0;
24455
- this.firstHeldAt = null;
24456
- if (waiters.length === 0 && overflow === 0) return;
24457
- for (const w of waiters) w.resolve(verdict);
24458
- this.opts.onReport?.({
24459
- outcome,
24460
- reason,
24461
- events: waiters.filter((w) => w.kind === "event").length,
24462
- calls: waiters.filter((w) => w.kind === "call").length,
24463
- overflow,
24464
- heldForMs: firstHeldAt === null ? 0 : this.now() - firstHeldAt
24465
- });
24466
- }
24467
- };
24468
- //#endregion
24469
- //#region src/kernel/moleculer/agent-mesh-authenticator.ts
24470
- /** The child's register action on its parent agent. */
24471
- var AGENT_REGISTER_NODE_ACTION = "$agent.registerNode";
24472
- var DEFAULT_HUB_NODE_ID = "hub";
24473
- var MAX_TRACKED_NODES = 256;
24474
- /** Moleculer introspection — never from another node, on an agent either. */
24475
- var REMOTE_FORBIDDEN_SERVICES = new Set(["$node"]);
24476
- function isRemoteForbiddenOnAgent(action) {
24477
- const dot = action.indexOf(".");
24478
- return dot > 0 && REMOTE_FORBIDDEN_SERVICES.has(action.slice(0, dot));
24479
- }
24480
- function isOwnChildNodeId(ownNodeId, sender) {
24481
- return sender.startsWith(`${ownNodeId}/`);
24482
- }
24483
- var AgentMeshAuthenticator = class {
24484
- deps;
24485
- nodes = /* @__PURE__ */ new Map();
24486
- hubNodeId;
24487
- now;
24488
- hold;
24489
- constructor(deps) {
24490
- this.deps = deps;
24491
- this.hubNodeId = deps.hubNodeId ?? DEFAULT_HUB_NODE_ID;
24492
- this.now = deps.now ?? Date.now;
24493
- this.hold = new MeshJoinHold({
24494
- hubNodeId: this.hubNodeId,
24495
- now: this.now,
24496
- ...deps.maxHeld !== void 0 ? { maxHeld: deps.maxHeld } : {},
24497
- ...deps.maxHoldMs !== void 0 ? { maxHoldMs: deps.maxHoldMs } : {},
24498
- ...deps.onHoldReport !== void 0 ? { onReport: deps.onHoldReport } : {}
24499
- });
24500
- }
24501
- /** How many of the hub's requests wait for the join right now. */
24502
- heldCount() {
24503
- return this.hold.size;
24504
- }
24505
- /** Current mode: a secret OR a certificate → enforce; else tolerate (upgrade path). */
24506
- mode() {
24507
- return this.deps.hasSecret() || this.deps.isPaired?.() === true ? "enforced" : "transition";
24508
- }
24509
- /**
24510
- * Reflect a settled mesh join. `authenticated` stamps the hub; a blocking
24511
- * failure forgets it so an impostor cannot call in; transitional states
24512
- * leave the hub unmarked (calls are tolerated while mode is `transition`).
24513
- */
24514
- noteHubJoinState(state) {
24515
- if (state === "authenticated") {
24516
- this.record(this.hubNodeId, "authenticated");
24517
- this.hold.release();
24518
- return;
24519
- }
24520
- if (state === "pending") {
24521
- this.forget(this.hubNodeId);
24522
- this.hold.reopen();
24523
- return;
24524
- }
24525
- if (state === "secret-mismatch" || state === "hub-unverified") this.forget(this.hubNodeId);
24526
- this.hold.refuse(state);
24527
- }
24528
- /** A child's `$agent.registerNode` was accepted (secret hash matched or none required). */
24529
- noteChildRegistered(sender, proof = "authenticated") {
24530
- if (!isOwnChildNodeId(this.deps.ownNodeId, sender)) return;
24531
- this.record(sender, proof);
24532
- }
24533
- /** The peer's connection dropped. */
24534
- forget(nodeId) {
24535
- this.nodes.delete(nodeId);
24536
- }
24537
- admitCall(sender, action) {
24538
- if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24539
- if (isRemoteForbiddenOnAgent(action)) return {
24540
- verdict: "deny",
24541
- errorType: MESH_ACTION_FORBIDDEN_TYPE,
24542
- message: `"${action}" is not callable from another node (caller "${sender}")`
24543
- };
24544
- if (action === "$agent.registerNode" && isOwnChildNodeId(this.deps.ownNodeId, sender)) return { verdict: "allow" };
24545
- return this.admitSender(sender, action, "call");
24546
- }
24547
- admitEvent(sender, eventName) {
24548
- if (sender === this.deps.ownNodeId) return { verdict: "allow" };
24549
- return this.admitSender(sender, `event:${eventName}`, "event");
24550
- }
24551
- stateOf(nodeId) {
24552
- return this.nodes.get(nodeId)?.state ?? "unauthenticated";
24553
- }
24554
- authenticatedNodeIds() {
24555
- return [...this.nodes].filter(([, r]) => r.state === "authenticated").map(([id]) => id);
24556
- }
24557
- admitSender(sender, what, kind) {
24558
- const state = this.stateOf(sender);
24559
- if (state === "authenticated" || state === "legacy") return { verdict: "allow" };
24560
- if (sender === this.hubNodeId && this.deps.isVerifiedPeer?.(sender) === true) return { verdict: "allow" };
24561
- if (this.mode() === "enforced") {
24562
- if (sender === this.hubNodeId) {
24563
- const held = this.hold.hold(kind);
24564
- if (held !== null) return held;
24565
- }
24566
- return {
24567
- verdict: "deny",
24568
- errorType: MESH_NODE_UNAUTHENTICATED_TYPE,
24569
- 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`
24570
- };
24571
- }
24572
- if (!this.nodes.has(sender)) {
24573
- this.record(sender, "unauthenticated");
24574
- this.deps.onTolerated?.(sender, what);
24575
- }
24576
- return { verdict: "tolerate" };
24577
- }
24578
- record(nodeId, state) {
24579
- this.nodes.delete(nodeId);
24580
- if (this.nodes.size >= MAX_TRACKED_NODES) {
24581
- const oldest = this.nodes.keys().next().value;
24582
- if (oldest !== void 0) this.nodes.delete(oldest);
24583
- }
24584
- this.nodes.set(nodeId, {
24585
- state,
24586
- since: this.now()
24587
- });
24588
- }
24589
- };
24590
- //#endregion
24591
24178
  //#region src/kernel/moleculer/agent-event-scope.ts
24592
24179
  /** Moleculer's EVENT packet type (`packets.PACKET_EVENT`). */
24593
24180
  var PACKET_EVENT = "EVENT";
@@ -24622,213 +24209,6 @@ function createAgentEventScope(opts) {
24622
24209
  };
24623
24210
  }
24624
24211
  //#endregion
24625
- //#region src/kernel/moleculer/mesh-join-client.ts
24626
- /** States in which a call to the hub is refused locally. */
24627
- var BLOCKING = new Set(["secret-mismatch", "hub-unverified"]);
24628
- /** Error `type`s meaning "the hub has no such action": it predates D802. */
24629
- var UNSUPPORTED = new Set(["SERVICE_NOT_FOUND", "SERVICE_NOT_AVAILABLE"]);
24630
- function errText(err) {
24631
- return err instanceof Error ? err.message : String(err);
24632
- }
24633
- function errCode(err) {
24634
- if (typeof err !== "object" || err === null || !("code" in err)) return null;
24635
- const { code } = err;
24636
- return typeof code === "number" ? code : null;
24637
- }
24638
- function readString(value, key) {
24639
- if (value === null || typeof value !== "object") return null;
24640
- const v = Reflect.get(value, key);
24641
- return typeof v === "string" ? v : null;
24642
- }
24643
- var MeshJoinClient = class {
24644
- opts;
24645
- current = "pending";
24646
- settledWaiters = [];
24647
- inFlight = null;
24648
- hubNodeId;
24649
- constructor(opts) {
24650
- this.opts = opts;
24651
- this.hubNodeId = opts.hubNodeId ?? "hub";
24652
- }
24653
- get state() {
24654
- return this.current;
24655
- }
24656
- /** Did this agent prove itself on the current connection? */
24657
- get authenticated() {
24658
- return this.current === "authenticated";
24659
- }
24660
- /**
24661
- * Run the join. Concurrent callers share one attempt. Resolves with the
24662
- * settled state; never rejects.
24663
- */
24664
- join() {
24665
- if (this.inFlight !== null) return this.inFlight;
24666
- const attempt = this.runJoin().then((state) => {
24667
- this.inFlight = null;
24668
- this.settle(state);
24669
- return state;
24670
- });
24671
- this.inFlight = attempt;
24672
- return attempt;
24673
- }
24674
- /** The hub connection dropped: the next connection authenticates again. */
24675
- reset() {
24676
- this.current = "pending";
24677
- }
24678
- /** Resolves when a call to the hub may go out; rejects when it must not. */
24679
- async whenCallable() {
24680
- if (this.current === "pending") {
24681
- let timer;
24682
- const settled = await Promise.race([new Promise((resolve) => this.settledWaiters.push(() => resolve(true))), new Promise((resolve) => {
24683
- timer = setTimeout(() => resolve(false), this.opts.pendingWaitMs ?? 3e4);
24684
- timer.unref?.();
24685
- })]);
24686
- if (timer !== void 0) clearTimeout(timer);
24687
- if (!settled) throw new Error(`the mesh join with "${this.hubNodeId}" has not completed — the call was not sent`);
24688
- }
24689
- if (!BLOCKING.has(this.current)) return;
24690
- 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");
24691
- 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)`);
24692
- }
24693
- /**
24694
- * Moleculer middleware for the AGENT broker: every call to the hub node waits
24695
- * for the join; a hub answer "not authenticated" (the hub restarted and lost
24696
- * us) triggers a new join.
24697
- */
24698
- middleware(onUnauthenticated) {
24699
- const hubNodeId = this.hubNodeId;
24700
- const whenCallable = () => this.whenCallable();
24701
- const secretPresent = () => this.secretPresent();
24702
- return {
24703
- name: "CamstackMeshJoin",
24704
- remoteAction(next, action) {
24705
- const name = action.name ?? "";
24706
- if (name === "$hub.joinChallenge" || name === "$hub.authenticateNode") return next;
24707
- return async function meshJoinGated(ctx) {
24708
- if (ctx.nodeID !== hubNodeId) return next.call(this, ctx);
24709
- await whenCallable();
24710
- try {
24711
- return await next.call(this, ctx);
24712
- } catch (err) {
24713
- if (meshErrorType(err) === "MESH_NODE_UNAUTHENTICATED" && secretPresent()) onUnauthenticated?.();
24714
- throw err;
24715
- }
24716
- };
24717
- }
24718
- };
24719
- }
24720
- secretPresent() {
24721
- const s = this.opts.secret();
24722
- return s !== null && s.length > 0;
24723
- }
24724
- settle(state) {
24725
- this.current = state;
24726
- this.opts.onSettled?.(state);
24727
- const waiters = this.settledWaiters;
24728
- this.settledWaiters = [];
24729
- for (const w of waiters) w();
24730
- }
24731
- async runJoin() {
24732
- const secret = this.opts.secret();
24733
- if (secret === null || secret.length === 0) return "no-secret";
24734
- const hash = hashClusterSecret(secret);
24735
- const maxAttempts = this.opts.maxAttempts ?? 5;
24736
- let last = "unavailable";
24737
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
24738
- const outcome = await this.attempt(hash);
24739
- if (outcome !== "retry") return outcome;
24740
- last = "unavailable";
24741
- await new Promise((r) => setTimeout(r, (this.opts.retryDelayMs ?? 1e3) * attempt));
24742
- }
24743
- return last;
24744
- }
24745
- async attempt(hash) {
24746
- const callOpts = {
24747
- nodeID: this.hubNodeId,
24748
- timeout: this.opts.callTimeoutMs ?? 1e4
24749
- };
24750
- const nodeId = this.opts.nodeId;
24751
- try {
24752
- const challenge = await this.opts.call(MESH_JOIN_CHALLENGE_ACTION, {}, callOpts);
24753
- const nonce = readString(challenge, "nonce");
24754
- const protocol = challenge !== null && typeof challenge === "object" ? Reflect.get(challenge, "protocol") : void 0;
24755
- if (nonce === null || protocol !== 1) {
24756
- this.opts.log?.(`[mesh-join] the hub sent a challenge this agent does not speak`);
24757
- return "unsupported";
24758
- }
24759
- const clientNonce = createMeshNonce();
24760
- const answer = await this.opts.call(MESH_JOIN_AUTHENTICATE_ACTION, {
24761
- nodeId,
24762
- nonce,
24763
- clientNonce,
24764
- proof: computeNodeJoinProof(hash, nodeId, nonce)
24765
- }, callOpts);
24766
- if (!proofsEqual(computeHubJoinProof(hash, nodeId, nonce, clientNonce), readString(answer, "hubProof"))) {
24767
- this.opts.log?.(`[mesh-join] the hub could not prove it holds the cluster secret — refused`);
24768
- return "hub-unverified";
24769
- }
24770
- this.opts.log?.(`[mesh-join] authenticated to the hub (mutual)`);
24771
- return "authenticated";
24772
- } catch (err) {
24773
- const type = meshErrorType(err);
24774
- if (type === "CLUSTER_SECRET_MISMATCH") {
24775
- this.opts.log?.(`[mesh-join] the hub refused our proof: cluster secret mismatch`);
24776
- return "secret-mismatch";
24777
- }
24778
- if (type !== null && UNSUPPORTED.has(type) || errCode(err) === 404) {
24779
- this.opts.log?.(`[mesh-join] the hub predates the mesh join — legacy registration`);
24780
- return "unsupported";
24781
- }
24782
- this.opts.log?.(`[mesh-join] join attempt failed (${type ?? "error"}): ${errText(err)}`);
24783
- return "retry";
24784
- }
24785
- }
24786
- };
24787
- //#endregion
24788
- //#region src/kernel/moleculer/mesh-auto-enforce.ts
24789
- /** Boot grace before an empty or partial roster can end the transition. */
24790
- var MESH_AUTO_ENFORCE_GRACE_MS = 5 * 6e4;
24791
- function isAgentId(id, ownNodeId) {
24792
- return id !== ownNodeId && !id.includes("/");
24793
- }
24794
- function decideMeshAutoEnforce(input) {
24795
- if (input.mode !== "transition") return {
24796
- enforce: false,
24797
- waitingFor: [],
24798
- why: "not in transition"
24799
- };
24800
- if (input.gate !== "on") return {
24801
- enforce: false,
24802
- waitingFor: [],
24803
- why: "no readable cluster secret"
24804
- };
24805
- if (input.knownAgents === null) return {
24806
- enforce: false,
24807
- waitingFor: [],
24808
- why: "the cluster-node history has not answered"
24809
- };
24810
- if (input.uptimeMs < (input.graceMs ?? 3e5)) return {
24811
- enforce: false,
24812
- waitingFor: [],
24813
- why: "boot grace period"
24814
- };
24815
- const known = new Set([
24816
- ...input.knownAgents,
24817
- ...input.connected,
24818
- ...input.toleratedEver
24819
- ].filter((id) => isAgentId(id, input.ownNodeId)));
24820
- const waitingFor = [...known].filter((id) => !input.authenticatedEver.has(id)).toSorted();
24821
- if (waitingFor.length > 0) return {
24822
- enforce: false,
24823
- waitingFor,
24824
- why: "agents have not authenticated yet"
24825
- };
24826
- return {
24827
- enforce: true,
24828
- reason: known.size === 0 ? "no agent has ever joined this hub" : `every known agent has authenticated (${[...known].toSorted().join(", ")})`
24829
- };
24830
- }
24831
- //#endregion
24832
24212
  //#region src/kernel/moleculer/readiness-service.ts
24833
24213
  /**
24834
24214
  * Service name AGENTS register their own readiness snapshot under.
@@ -27111,4 +26491,4 @@ var LifecycleJobEngine = class {
27111
26491
  */
27112
26492
  var CAP_METHOD_NOT_IMPLEMENTED = "CAP_METHOD_NOT_IMPLEMENTED";
27113
26493
  //#endregion
27114
- export { ADMIN_TOKEN_MAX_LIFETIME_MS, ADMIN_TOKEN_PREFIX, AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AGENT_DASHBOARD_ORIGINS_FIELD, AGENT_HTTPS_NAMES_COLLECTION, AGENT_HTTPS_NAMES_COLUMNS, AGENT_READINESS_SERVICE_NAME, AGENT_REGISTER_NODE_ACTION, AGENT_UI_UNLOCK_DOMAIN, AGENT_UI_UNLOCK_TTL_MS, AGENT_UI_UNLOCK_TYP, AGENT_UI_UNLOCK_USE, AGENT_UI_UNLOCK_VERSION, ALL_CAPABILITY_DEFINITIONS, ARRAY_BUFFER_CENSUS_COOLDOWN_MS, ARRAY_BUFFER_CENSUS_SUSTAIN_MS, ARRAY_BUFFER_CENSUS_THRESHOLD_MB, ARRAY_BUFFER_RELEASE_MIN_DROP_RATIO, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AdminTokenManager, AgentHttpsInstallError, AgentHttpsNames, AgentMdnsAdvertiser, AgentMeshAuthenticator, AgentPairing, AlertCenterAddon, ApiKeyManager, AuthAuditLog, AuthManager, BackupDecryptError, BackupKeyFormatError, BackupKeyMismatchError, BackupKeyRequiredError, CAP_ACTION_OVERFLOW_LABEL, CAP_ACTION_UNLABELLED, CAP_METHOD_NOT_IMPLEMENTED, CA_COMMON_NAME, CA_VALIDITY_DAYS, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REF, CLUSTER_SECRET_REJECTED_EXIT_CODE, CLUSTER_SECRET_SETTINGS_KEY, CLUSTER_SECRET_UNAVAILABLE_TYPE, CORE_CAP_SERVICE_NAME, CalendarsAddon, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ComposerAddon, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CoreBlocksAddon, CustomActionRegistry, DECISIVE_HEAP_SPACES, DEFAULT_DATA_PATH, DEFAULT_HUB_TLS_TCP_PORT, DEFAULT_LAN_HTTP_PORT, DEFAULT_LOG_LEVEL, DEFAULT_MESH_JOIN_MAX_HELD, DEFAULT_MESH_JOIN_MAX_HOLD_MS, DEVICE_CA_KEY_REF, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DataPlaneRegistry, DeviceCaStore, DeviceCredentialManager, DeviceManagerAddon, DeviceRegistry, DeviceStore, EMPTY_CAP_ACTION_READING, EMPTY_SOCKET_DIRECTION, EMPTY_SOCKET_PLANE_BASELINE, EVENT_PLANE_TOP_N, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FIRST_BOOT_ADMIN_PASSWORD, FIRST_BOOT_ADMIN_USERNAME, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, GET_STATUS_METHOD, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_SPACE_REPORT_MIN_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_CAP_FWD_ACTION, HUB_CAP_FWD_SERVICE, HUB_MAIN_HEAP_WATCH_LABEL, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, HubPairing, INFRA_CAPABILITIES, IntegrationRegistry, JWT_SIGNING_KEY_REF, JobJournal, JoinTokenJtiStore, JwtSigningKeyUnavailableError, LEAF_RENEWAL_WINDOW_DAYS, LifecycleJobEngine, LifecycleStateMachine, LivenessMonitorAddon, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, LoggingGate, LoginSessionManager, LokiDestination, LokiLoggingAddon, MAX_CAP_ACTIONS_PER_PEER, MAX_LEAF_VALIDITY_DAYS, MESH_ACTION_FORBIDDEN_TYPE, MESH_AUTH_MODE_FIELD, MESH_AUTO_ENFORCE_GRACE_MS, MESH_CA_FIELD, MESH_CA_KEY_REF, MESH_CA_SETTINGS_KEY, MESH_JOIN_AUTHENTICATE_ACTION, MESH_JOIN_CHALLENGE_ACTION, MESH_JOIN_CHALLENGE_INVALID_TYPE, MESH_JOIN_CHALLENGE_TTL_MS, MESH_JOIN_PROTOCOL, MESH_NODE_CERTIFICATES_COLLECTION, MESH_NODE_CERTIFICATES_COLUMNS, MESH_NODE_UNAUTHENTICATED_TYPE, MESH_QUEUE_TOP_N, MESH_TLS_PORT_HELLO_FIELD, METHOD_ACCESS_MAP, MeshAuthenticator, MeshCaKeeper, MeshCertificateRegistry, MeshCrl, MeshJoinClient, MeshJoinHold, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NATIVE_SCAN_DEPTH, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, OUTBOUND_QUEUE_COOLDOWN_MS, OUTBOUND_QUEUE_SUSTAIN_MS, OUTBOUND_QUEUE_THRESHOLD_BYTES, PAIRING_CODE_DIGITS, PAIRING_MAX_CODE_ATTEMPTS, PAIRING_MAX_SESSIONS, PAIRING_PATHS, PAIRING_PIN_DIGITS, PAIRING_PROTOCOL, PAIRING_TTL_MS, PARENT_ROUTED_PROVIDER_ADDON_ID, PREVIOUS_LEAF_GRACE_MS, PYTHON_VERSION, PairingHttpError, PeerAnsweredError, PipelineRunner, PipelineValidator, PythonEnvManager, QUARANTINE_DIRNAME, REFRESH_TOKEN_PREFIX, RENEWAL_ABANDONED, RESTART_MARKER_FILE, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, SERVER_AUTH_OID, SOCKET_PLANE_TOP_N, SOCKET_QUEUE_TOP_N, STALL_REPORT_MS, STALL_TICK_MS, STORE_READABLE_BOOTSTRAP_KEYS, SYSTEM_SECRET_OWNER, ScopedLogger, ScopedTokenManager, SettingsReadUnavailableError, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemBackupService, SystemConfigAddon, SystemEventBus, TRADITIONAL_NATIVE_PACKAGES, TlsTcpTransporter, ToastService, UDS_NO_ROUTE_PREFIX, UNCLAIMED, UPLOADED_CA_FILE, USER_MANAGEMENT_INTERNAL, UdsLocalTransportClient, UdsLocalTransportServer, UnlockTicketJtiStore, UserManager, WinstonDestination, WinstonLoggingAddon, ZERO_LOOP_DELAY, __resetCapUsageRegistryForTests, __resetLoggingGateForTests, acceptAgentSans, adaptBrokerToCluster, addonSettingsCapability, adoptModelRevisions, afterWorkerOnlineAnnounce, agentHttpsPaths, allFamiliesListenHost, answerClaimedGetStatus, applyCertificateToListener, applyLanHttp, attachUserManagementInternal, attributeStall, bindPendingLanHttp, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildAgentAnnouncement, buildBinaryPath, buildCapRouters, buildHeapSample, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildNpmChildEnv, buildStorageLocationRegistry, buildTransporter, builderMountedCapNames, caFingerprint, caFingerprintCompact, callRegisterNodeWithRetry, callWithServiceDiscovery, canServeDataPlane, capActionLabel, capActionName, capActionSuffix, capBareAction, capServiceName, certificateNames, checkClusterSecret, classifyAddonDir, classifyCapRoute, clearHttpsListener, clearPendingRestart, clearPlatformKeychainKey, closeLanHttp, clusterEventTopic, clusterSecretMatches, collectAgentNames, collectCertIdentity, collectModelFiles, computeHubJoinProof, computeNodeJoinProof, computePairingCommitment, computePairingSas, connectBrokerTransport, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonPeerBytesFacility, createAddonService, createAgentEventScope, createAgentHttpsRequest, createAgentTransport, createArrayBufferCensusGate, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCapActionCensus, createCiaoPublisher, createCidrMatcher, createCoreCapService, createDeferredHeapWatchSink, createDoorSettingsView, createEventPlaneMeter, createEventPlaneReader, createFileDataPlaneHandler, createHubCapForwardService, createHubService, createInspectorArrayBufferCensus, createKernelHwAccel, createKernelInferenceEngine, createLocalTransport, createLoopDelayMeter, createMeshAccessMiddleware, createMeshCsrPem, createMeshQueueReader, createOutboundQueueGate, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createSocketDirectionCounters, createSocketPlaneMeter, createSocketPlaneReader, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, createV8Reclaimer, currentBrokerTransporter, decideMeshAutoEnforce, deleteModelFromDisk, deriveAgentListenPort, describeCsr, describeHttpsLeaf, describeMeshLeaf, describeProviderKindDrift, describeRss, detectWorkspacePackagesDir, deviceCapResolverLink, deviceOfGetStatus, diffCapActionCensus, diffEventPlane, diffSocketPlane, disconnectBrokerTransport, downloadBinary, downloadFile, downloadModel, dropProcessPeer, emitDownForOwnedCaps, emitHeapDiagnosticReport, emitProcessNodeRegistered, encodeFrame, enrollMeshNode, ensureAddonNativePrebuilds, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensureNativePrebuilds, ensurePython, ensureTlsCert, evaluateExistingCert, expandCapMethods, exportMeshPrivateKeyPem, fetchJson, findInPath, formatArrayBufferCensus, formatEventPlane, formatHeapSpaces, formatLogLine, formatMeshQueue, formatOutboundQueueVerdict, formatSocketPlane, generateBackupKeyPair, generateDeviceCa, generateMeshCa, generateMeshKeyPair, getBrokerEventBus, getBrokerTlsTransporter, getCapUsageRegistry, getFfmpegDownloadUrl, getLoggingGate, getModelFilePath, getMoleculerEventStats, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPlatformKeychainKey, getProcessAgentHttpsNames, getProcessClusterSecretGate, getProcessJwtSigningKeyState, getProcessMeshAuthMode, getProcessMeshAuthStatus, getProcessMeshCaState, getProcessMeshCertificateRegistry, getProcessMeshTlsListenerState, getProcessNodeMeshTransport, getProcessPeerLeaf, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getUserManagementInternal, getWorkerDeviceRegistry, hasDotNode, hashClusterSecret, heapSpaceField, hostNodeIdOf, hubHostFromMeshAddress, hubMainRssBudget, installAgentHttps, installBrokerTransporter, installManifestNativeDeps, installManifestPythonDeps, installManifestSystemDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcParentLink, isAddonDeploySource, isAllowedAgentDashboardReturnTo, isArrayBufferCensusReport, isArrayOutputSchema, isClusterSecretMismatchError, isCollectionArrayMethod, isContainerBridgeAddress, isCredentialKeyName, isInfraCapability, isInstalledTransporter, isLocalOnlyHostname, isMeshAuthMode, isModelDownloaded, isOwnChildNodeId, isPeerEventPacket, isPrivateAddress, isProcessVerifiedMeshPeer, isRemoteForbiddenAction, isRemoteForbiddenOnAgent, isSettingsReadUnavailable, isSourceNewer, isValidAgentNodeId, isolatedBuiltinPhase, issueAgentHttpsLeaf, issueDeviceLeaf, issueMeshLeafForNode, issueMeshLeafFromCsr, keyFingerprintShort, leafFingerprintOf, loadAgentHttps, loadDeviceCa, loadMeshCa, loadTlsCert, localEndpointPath, localProviderLink, localSupportedPythonRuntimes, mapSignalsToInferenceHardware, meshErrorType, mintAgentUiUnlockTicket, mintAgentUiUnlockTicketEs256, mintMeshJoinToken, mountNativeCapService, nextRssBudgetState, normalizeIp, onProcessNodeRegistered, openMeshTlsWhenRevocationsLoaded, overlayGetStatus, parseAgentDashboardOrigins, parseCapAction, parseCidrList, parseMeshAuthMode, parseRangeHeader, parseRssBudgetMb, parseTokenExpiry, parseTokenizedUrl, partitionIsolatedBuiltinIds, pemDigest, pinnedHttpsCaFingerprint, prepareBootTls, prepareRestoreArchive, probePlatform, processJoinTokenJtiStore, processJwtSigningKey, processMeshCrl, proxyToUpstream, quarantineAddonResidue, readBackupEncryptionHeader, readCidrSetting, readExtraSans, readHeapSpaces, readLanHttpState, readPendingRestart, readSocketQueues, readTlsAccessStatus, readTlsMode, readinessKey, reclaimIntervalMs, recordSocketFrame, redactLogEntry, redactLogMeta, redactLogText, regenerateCertificate, registerEventBusService, registerHttpsListener, registerLanHttpHandler, reissueTlsLeaf, reloadHttpsListener, renewMeshCertificate, requestProcessMeshEnforcement, requireProcessMeshCa, resolveFilePath, resolveFormatRevision, resolveHwAccel, resolveNpmInvocation, revertToGeneratedCertificate, revisionWeightUrl, revokeMeshCertificate, runHubAddonBoot, runNpm, sampleSocketDirection, scheduleSelfRestart, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, selectAddonResidue, selectReportedSpaces, serializeTypedArrays, servedHttpsLeafFingerprint, setHubConnected, setNodeEventInterest, setPlatformKeychainKey, setProcessAgentHttpsNames, setProcessClusterSecretGate, setProcessMeshAuthMode, setProcessMeshAuthStatusSource, setProcessMeshCertificateRegistry, setProcessMeshEnforcer, setProcessMeshPeerTransportLookup, setProcessMeshTlsEnabler, setProcessMeshTlsListenerState, setWrapperActive, shouldReclaim, signPairingProof, signalAllRunnerGroups, socketDirectionBytes, socketDirectionMessages, splitPemCertificates, stampCallerAddonId, startEventLoopStallMonitor, startHeapWatch, startRunnerHeapWatch, staticJwtSigningKey, storeMayAnswer, storeUploadedCertificate, strandedMb, stripCamstackDeps, stripForgedIdentity, stripForwardedCaller, subscribePassthrough, systemHostFacts, udsChildLogToWorkerEntry, validateProviderRegistrations, validateUploadedTls, verifyAgentUiUnlockTicket, verifyAgentUiUnlockTicketEs256, verifyDeviceLeaf, verifyDeviceSignature, verifyMeshJoinToken, verifyPairingProof, waitUntilReady, writeExtraSans, writePendingRestart, writeTlsMode };
26494
+ export { ADMIN_TOKEN_MAX_LIFETIME_MS, ADMIN_TOKEN_PREFIX, AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AGENT_DASHBOARD_ORIGINS_FIELD, AGENT_HTTPS_NAMES_COLLECTION, AGENT_HTTPS_NAMES_COLUMNS, AGENT_READINESS_SERVICE_NAME, AGENT_UI_UNLOCK_TTL_MS, AGENT_UI_UNLOCK_TYP, AGENT_UI_UNLOCK_USE, AGENT_UI_UNLOCK_VERSION, ALL_CAPABILITY_DEFINITIONS, ARRAY_BUFFER_CENSUS_COOLDOWN_MS, ARRAY_BUFFER_CENSUS_SUSTAIN_MS, ARRAY_BUFFER_CENSUS_THRESHOLD_MB, ARRAY_BUFFER_RELEASE_MIN_DROP_RATIO, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AdminTokenManager, AgentHttpsInstallError, AgentHttpsNames, AgentMdnsAdvertiser, AgentMeshIdentityGate, AgentPairing, AlertCenterAddon, ApiKeyManager, AuthAuditLog, AuthManager, BackupDecryptError, BackupKeyFormatError, BackupKeyMismatchError, BackupKeyRequiredError, CAP_ACTION_OVERFLOW_LABEL, CAP_ACTION_UNLABELLED, CAP_METHOD_NOT_IMPLEMENTED, CA_COMMON_NAME, CA_VALIDITY_DAYS, CORE_CAP_SERVICE_NAME, CalendarsAddon, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ComposerAddon, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CoreBlocksAddon, CustomActionRegistry, DECISIVE_HEAP_SPACES, DEFAULT_DATA_PATH, DEFAULT_HUB_TLS_TCP_PORT, DEFAULT_LAN_HTTP_PORT, DEFAULT_LOG_LEVEL, DEVICE_CA_KEY_REF, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DataPlaneRegistry, DeviceCaStore, DeviceCredentialManager, DeviceManagerAddon, DeviceRegistry, DeviceStore, EMPTY_CAP_ACTION_READING, EMPTY_SOCKET_DIRECTION, EMPTY_SOCKET_PLANE_BASELINE, EVENT_PLANE_TOP_N, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FIRST_BOOT_ADMIN_PASSWORD, FIRST_BOOT_ADMIN_USERNAME, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, GET_STATUS_METHOD, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_SPACE_REPORT_MIN_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_CAP_FWD_ACTION, HUB_CAP_FWD_SERVICE, HUB_MAIN_HEAP_WATCH_LABEL, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, HubPairing, INFRA_CAPABILITIES, IntegrationRegistry, JWT_SIGNING_KEY_REF, JobJournal, JwtSigningKeyUnavailableError, LEAF_RENEWAL_WINDOW_DAYS, LifecycleJobEngine, LifecycleStateMachine, LivenessMonitorAddon, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, LoggingGate, LoginSessionManager, LokiDestination, LokiLoggingAddon, MAX_CAP_ACTIONS_PER_PEER, MAX_LEAF_VALIDITY_DAYS, MESH_ACTION_FORBIDDEN_TYPE, MESH_CA_FIELD, MESH_CA_KEY_REF, MESH_CA_SETTINGS_KEY, MESH_NODE_CERTIFICATES_COLLECTION, MESH_NODE_CERTIFICATES_COLUMNS, MESH_NODE_UNAUTHENTICATED_TYPE, MESH_QUEUE_TOP_N, MESH_TLS_PORT_HELLO_FIELD, METHOD_ACCESS_MAP, MeshCaKeeper, MeshCertificateRegistry, MeshCrl, MeshIdentityGate, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NATIVE_SCAN_DEPTH, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, OUTBOUND_QUEUE_COOLDOWN_MS, OUTBOUND_QUEUE_SUSTAIN_MS, OUTBOUND_QUEUE_THRESHOLD_BYTES, PAIRING_CODE_DIGITS, PAIRING_MAX_CODE_ATTEMPTS, PAIRING_MAX_SESSIONS, PAIRING_PATHS, PAIRING_PIN_DIGITS, PAIRING_PROTOCOL, PAIRING_TTL_MS, PARENT_ROUTED_PROVIDER_ADDON_ID, PREVIOUS_LEAF_GRACE_MS, PYTHON_VERSION, PairingHttpError, PeerAnsweredError, PipelineRunner, PipelineValidator, PythonEnvManager, QUARANTINE_DIRNAME, REFRESH_TOKEN_PREFIX, RENEWAL_ABANDONED, RESTART_MARKER_FILE, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, SERVER_AUTH_OID, SOCKET_PLANE_TOP_N, SOCKET_QUEUE_TOP_N, STALL_REPORT_MS, STALL_TICK_MS, STORE_READABLE_BOOTSTRAP_KEYS, SYSTEM_SECRET_OWNER, ScopedLogger, ScopedTokenManager, SettingsReadUnavailableError, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemBackupService, SystemConfigAddon, SystemEventBus, TRADITIONAL_NATIVE_PACKAGES, TlsTcpTransporter, ToastService, UDS_NO_ROUTE_PREFIX, UNCLAIMED, UPLOADED_CA_FILE, USER_MANAGEMENT_INTERNAL, UdsLocalTransportClient, UdsLocalTransportServer, UnlockTicketJtiStore, UserManager, WinstonDestination, WinstonLoggingAddon, ZERO_LOOP_DELAY, __resetCapUsageRegistryForTests, __resetLoggingGateForTests, acceptAgentSans, adaptBrokerToCluster, addonSettingsCapability, adoptModelRevisions, afterWorkerOnlineAnnounce, agentHttpsPaths, allFamiliesListenHost, answerClaimedGetStatus, applyCertificateToListener, applyLanHttp, attachUserManagementInternal, attributeStall, bindPendingLanHttp, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildAgentAnnouncement, buildBinaryPath, buildCapRouters, buildHeapSample, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildNpmChildEnv, buildStorageLocationRegistry, buildTransporter, builderMountedCapNames, caFingerprint, caFingerprintCompact, callRegisterNodeWithRetry, callWithServiceDiscovery, canServeDataPlane, capActionLabel, capActionName, capActionSuffix, capBareAction, capServiceName, certificateNames, classifyAddonDir, classifyCapRoute, clearHttpsListener, clearPendingRestart, clearPlatformKeychainKey, closeLanHttp, clusterEventTopic, collectAgentNames, collectCertIdentity, collectModelFiles, computePairingCommitment, computePairingSas, connectBrokerTransport, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonPeerBytesFacility, createAddonService, createAgentEventScope, createAgentHttpsRequest, createAgentTransport, createArrayBufferCensusGate, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCapActionCensus, createCiaoPublisher, createCidrMatcher, createCoreCapService, createDeferredHeapWatchSink, createDoorSettingsView, createEventPlaneMeter, createEventPlaneReader, createFileDataPlaneHandler, createHubCapForwardService, createHubService, createInspectorArrayBufferCensus, createKernelHwAccel, createKernelInferenceEngine, createLocalTransport, createLoopDelayMeter, createMeshAccessMiddleware, createMeshCsrPem, createMeshQueueReader, createOutboundQueueGate, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createSocketDirectionCounters, createSocketPlaneMeter, createSocketPlaneReader, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, createV8Reclaimer, currentBrokerTransporter, deleteModelFromDisk, deriveAgentListenPort, describeCsr, describeHttpsLeaf, describeMeshLeaf, describeProviderKindDrift, describeRss, detectWorkspacePackagesDir, deviceCapResolverLink, deviceOfGetStatus, diffCapActionCensus, diffEventPlane, diffSocketPlane, disconnectBrokerTransport, downloadBinary, downloadFile, downloadModel, dropProcessPeer, emitDownForOwnedCaps, emitHeapDiagnosticReport, emitProcessNodeRegistered, encodeFrame, ensureAddonNativePrebuilds, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensureNativePrebuilds, ensurePython, ensureTlsCert, evaluateExistingCert, expandCapMethods, exportMeshPrivateKeyPem, fetchJson, findInPath, formatArrayBufferCensus, formatEventPlane, formatHeapSpaces, formatLogLine, formatMeshQueue, formatOutboundQueueVerdict, formatSocketPlane, generateBackupKeyPair, generateDeviceCa, generateMeshCa, generateMeshKeyPair, getBrokerEventBus, getBrokerTlsTransporter, getCapUsageRegistry, getFfmpegDownloadUrl, getLoggingGate, getModelFilePath, getMoleculerEventStats, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPlatformKeychainKey, getProcessAgentHttpsNames, getProcessJwtSigningKeyState, getProcessMeshCaState, getProcessMeshCertificateRegistry, getProcessMeshTlsListenerState, getProcessNodeMeshTransport, getProcessPeerLeaf, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getUserManagementInternal, getWorkerDeviceRegistry, hasDotNode, heapSpaceField, hostNodeIdOf, hubHostFromMeshAddress, hubMainRssBudget, installAgentHttps, installBrokerTransporter, installManifestNativeDeps, installManifestPythonDeps, installManifestSystemDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcParentLink, isAddonDeploySource, isAllowedAgentDashboardReturnTo, isArrayBufferCensusReport, isArrayOutputSchema, isCollectionArrayMethod, isContainerBridgeAddress, isCredentialKeyName, isInfraCapability, isInstalledTransporter, isLocalOnlyHostname, isModelDownloaded, isPeerEventPacket, isPrivateAddress, isProcessVerifiedMeshPeer, isRemoteForbiddenAction, isRemoteForbiddenOnAgent, isSettingsReadUnavailable, isSourceNewer, isValidAgentNodeId, isolatedBuiltinPhase, issueAgentHttpsLeaf, issueDeviceLeaf, issueMeshLeafForNode, issueMeshLeafFromCsr, keyFingerprintShort, leafFingerprintOf, loadAgentHttps, loadDeviceCa, loadMeshCa, loadTlsCert, localEndpointPath, localProviderLink, localSupportedPythonRuntimes, mapSignalsToInferenceHardware, meshErrorType, mintAgentUiUnlockTicket, mountNativeCapService, nextRssBudgetState, normalizeIp, onProcessNodeRegistered, openMeshTlsWhenRevocationsLoaded, overlayGetStatus, parseAgentDashboardOrigins, parseCapAction, parseCidrList, parseRangeHeader, parseRssBudgetMb, parseTokenExpiry, parseTokenizedUrl, partitionIsolatedBuiltinIds, pemDigest, pinnedHttpsCaFingerprint, prepareBootTls, prepareRestoreArchive, probePlatform, processJwtSigningKey, processMeshCrl, proxyToUpstream, quarantineAddonResidue, readBackupEncryptionHeader, readCidrSetting, readExtraSans, readHeapSpaces, readLanHttpState, readPendingRestart, readSocketQueues, readTlsAccessStatus, readTlsMode, readinessKey, reclaimIntervalMs, recordSocketFrame, redactLogEntry, redactLogMeta, redactLogText, regenerateCertificate, registerEventBusService, registerHttpsListener, registerLanHttpHandler, reissueTlsLeaf, reloadHttpsListener, renewMeshCertificate, requireProcessMeshCa, resolveFilePath, resolveFormatRevision, resolveHwAccel, resolveNpmInvocation, revertToGeneratedCertificate, revisionWeightUrl, revokeMeshCertificate, runHubAddonBoot, runNpm, sampleSocketDirection, scheduleSelfRestart, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, selectAddonResidue, selectReportedSpaces, serializeTypedArrays, servedHttpsLeafFingerprint, setHubConnected, setNodeEventInterest, setPlatformKeychainKey, setProcessAgentHttpsNames, setProcessMeshCertificateRegistry, setProcessMeshPeerTransportLookup, setProcessMeshTlsEnabler, setProcessMeshTlsListenerState, setWrapperActive, shouldReclaim, signPairingProof, signalAllRunnerGroups, socketDirectionBytes, socketDirectionMessages, splitPemCertificates, stampCallerAddonId, startEventLoopStallMonitor, startHeapWatch, startRunnerHeapWatch, staticJwtSigningKey, storeMayAnswer, storeUploadedCertificate, strandedMb, stripCamstackDeps, stripForgedIdentity, stripForwardedCaller, subscribePassthrough, systemHostFacts, udsChildLogToWorkerEntry, validateProviderRegistrations, validateUploadedTls, verifyAgentUiUnlockTicket, verifyDeviceLeaf, verifyDeviceSignature, verifyPairingProof, waitUntilReady, writeExtraSans, writePendingRestart, writeTlsMode };