@camstack/system 1.2.430 → 1.2.431
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.
- package/dist/builtins/system-config/system-config.addon.js +72 -8
- package/dist/builtins/system-config/system-config.addon.mjs +72 -9
- package/dist/index.js +198 -48
- package/dist/index.mjs +193 -50
- package/dist/kernel/index.d.ts +4 -2
- package/dist/kernel/moleculer/broker-factory.d.ts +28 -2
- package/dist/kernel/moleculer/broker-transport-swap.d.ts +43 -0
- package/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +10 -0
- package/dist/kernel/moleculer/mesh-mtls/mesh-peer-transport.d.ts +7 -3
- package/dist/kernel/moleculer/mesh-mtls/mesh-renewal.d.ts +8 -1
- package/package.json +2 -2
|
@@ -792,7 +792,7 @@ var MeshCertificateRegistry = class {
|
|
|
792
792
|
async recordObserved(nodeId, leaf) {
|
|
793
793
|
const known = this.rows.get(leaf.fingerprint);
|
|
794
794
|
if (known !== void 0) {
|
|
795
|
-
if (known.revokedReason !== "renewal-abandoned") return false;
|
|
795
|
+
if (known.revokedReason !== "renewal-abandoned") return known.revokedAt === null ? this.abandonRenewalsNewerThan(known) : false;
|
|
796
796
|
const reinstated = {
|
|
797
797
|
...known,
|
|
798
798
|
revokedAt: null,
|
|
@@ -908,6 +908,29 @@ var MeshCertificateRegistry = class {
|
|
|
908
908
|
return settled;
|
|
909
909
|
}
|
|
910
910
|
/** Set a never-completed renewal leaf aside (not current, NOT on the CRL). */
|
|
911
|
+
/** Fingerprints of renewal leaves whose handover is running right now (this process only). */
|
|
912
|
+
renewalsInFlight = /* @__PURE__ */ new Set();
|
|
913
|
+
/**
|
|
914
|
+
* A renewal's leaf is "in flight" from signing until the handover ends. While it is, a node seen
|
|
915
|
+
* presenting its OLD leaf is simply not swapped yet: the new leaf is not set aside (that would
|
|
916
|
+
* flap set-aside / reinstate on the node's first connection with it).
|
|
917
|
+
*/
|
|
918
|
+
beginRenewal(fingerprint) {
|
|
919
|
+
this.renewalsInFlight.add(fingerprint);
|
|
920
|
+
}
|
|
921
|
+
endRenewal(fingerprint) {
|
|
922
|
+
this.renewalsInFlight.delete(fingerprint);
|
|
923
|
+
}
|
|
924
|
+
async abandonRenewalsNewerThan(presented) {
|
|
925
|
+
let changed = false;
|
|
926
|
+
for (const record of this.liveFor(presented.nodeId)) {
|
|
927
|
+
if (record.fingerprint === presented.fingerprint) continue;
|
|
928
|
+
if (record.issuedVia !== "renewal" || record.issuedAt <= presented.issuedAt) continue;
|
|
929
|
+
if (this.renewalsInFlight.has(record.fingerprint)) continue;
|
|
930
|
+
if (await this.abandon(record.fingerprint)) changed = true;
|
|
931
|
+
}
|
|
932
|
+
return changed;
|
|
933
|
+
}
|
|
911
934
|
async abandon(fingerprint) {
|
|
912
935
|
const record = this.rows.get(fingerprint);
|
|
913
936
|
if (record === void 0 || record.revokedAt !== null) return false;
|
|
@@ -1063,6 +1086,24 @@ function message$1(error) {
|
|
|
1063
1086
|
return error instanceof Error ? error.message : String(error);
|
|
1064
1087
|
}
|
|
1065
1088
|
async function renewMeshCertificate(deps) {
|
|
1089
|
+
const inFlight = { fingerprint: null };
|
|
1090
|
+
try {
|
|
1091
|
+
return await runRenewal(deps, inFlight);
|
|
1092
|
+
} finally {
|
|
1093
|
+
if (inFlight.fingerprint !== null) {
|
|
1094
|
+
deps.registry.endRenewal(inFlight.fingerprint);
|
|
1095
|
+
const live = deps.peers.peerLeaf(deps.nodeId);
|
|
1096
|
+
if (live !== void 0) await deps.registry.recordObserved(deps.nodeId, {
|
|
1097
|
+
cn: deps.nodeId,
|
|
1098
|
+
serial: live.serial,
|
|
1099
|
+
fingerprint: live.fingerprint,
|
|
1100
|
+
notBefore: live.notBefore,
|
|
1101
|
+
notAfter: live.notAfter
|
|
1102
|
+
}).catch(() => void 0);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
async function runRenewal(deps, inFlight) {
|
|
1066
1107
|
const { nodeId, log } = deps;
|
|
1067
1108
|
const tags = { nodeId };
|
|
1068
1109
|
const sleep = deps.sleep ?? defaultSleep;
|
|
@@ -1124,12 +1165,28 @@ async function renewMeshCertificate(deps) {
|
|
|
1124
1165
|
return fail("issue", message$1(error), true);
|
|
1125
1166
|
}
|
|
1126
1167
|
const newLeaf = describeMeshLeaf(issued.certPem);
|
|
1168
|
+
deps.registry.beginRenewal(newLeaf.fingerprint);
|
|
1169
|
+
inFlight.fingerprint = newLeaf.fingerprint;
|
|
1127
1170
|
let resolveRegistered = () => void 0;
|
|
1128
1171
|
const registeredPromise = new Promise((resolve) => {
|
|
1129
1172
|
resolveRegistered = resolve;
|
|
1130
1173
|
});
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1174
|
+
const expected = deps.expectedAddons?.(nodeId) ?? [];
|
|
1175
|
+
let missingAddons = [];
|
|
1176
|
+
const unsubscribe = deps.registrations.subscribe((id, addonIds) => {
|
|
1177
|
+
if (id !== nodeId || deps.peers.peerLeaf(nodeId)?.fingerprint !== newLeaf.fingerprint) return;
|
|
1178
|
+
if (addonIds !== void 0) {
|
|
1179
|
+
const present = new Set(addonIds);
|
|
1180
|
+
missingAddons = expected.filter((addonId) => !present.has(addonId));
|
|
1181
|
+
if (missingAddons.length > 0) {
|
|
1182
|
+
log.warn("Mesh renewal: the node registered without addons it had before - waiting", {
|
|
1183
|
+
tags,
|
|
1184
|
+
meta: { missing: missingAddons }
|
|
1185
|
+
});
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
resolveRegistered(true);
|
|
1133
1190
|
});
|
|
1134
1191
|
const deadlineTimer = setTimer(() => resolveRegistered(false), timeoutMs);
|
|
1135
1192
|
registeredPromise.then(() => deadlineTimer.cancel());
|
|
@@ -1160,7 +1217,8 @@ async function renewMeshCertificate(deps) {
|
|
|
1160
1217
|
}
|
|
1161
1218
|
});
|
|
1162
1219
|
await deps.registry.abandon(newLeaf.fingerprint);
|
|
1163
|
-
|
|
1220
|
+
const lost = missingAddons.length > 0 ? ` (its last registration lacked ${missingAddons.length} addon(s) it had before: ${missingAddons.slice(0, 5).join(", ")}; the swap was rolled back and nothing was revoked - once those addons are running again the next renewal will go through)` : "";
|
|
1221
|
+
return fail("reconnect", `the node was not back and registered with the new leaf within ${Math.round(timeoutMs / 1e3)} s${lost}; the previous leaf was kept and is still valid`, true);
|
|
1164
1222
|
}
|
|
1165
1223
|
log.info("Mesh renewal: the node registered presenting the new leaf", { tags });
|
|
1166
1224
|
let confirmError = "the node did not confirm the new leaf";
|
|
@@ -1280,10 +1338,14 @@ function onProcessNodeRegistered(listener) {
|
|
|
1280
1338
|
listeners.delete(listener);
|
|
1281
1339
|
};
|
|
1282
1340
|
}
|
|
1283
|
-
/**
|
|
1284
|
-
|
|
1341
|
+
/**
|
|
1342
|
+
* Called by the hub when a node's `registerNode` has been applied. `addonIds` is what that
|
|
1343
|
+
* registration carried (a node's own addons and its children's, D3), so a waiter can tell the
|
|
1344
|
+
* registration of a node that came back WHOLE from the first one of a node that lost its children.
|
|
1345
|
+
*/
|
|
1346
|
+
function emitProcessNodeRegistered(nodeId, addonIds) {
|
|
1285
1347
|
for (const listener of [...registrationListeners()]) try {
|
|
1286
|
-
listener(nodeId);
|
|
1348
|
+
listener(nodeId, addonIds);
|
|
1287
1349
|
} catch {}
|
|
1288
1350
|
}
|
|
1289
1351
|
//#endregion
|
|
@@ -87836,6 +87898,7 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87836
87898
|
});
|
|
87837
87899
|
server.on("error", (err) => {
|
|
87838
87900
|
this.logger.error("Mesh TLS server error.", err);
|
|
87901
|
+
if (this.tlsServer === server) this.tlsServer = null;
|
|
87839
87902
|
reject(err);
|
|
87840
87903
|
});
|
|
87841
87904
|
server.listen({
|
|
@@ -87845,9 +87908,9 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87845
87908
|
const address = server.address();
|
|
87846
87909
|
const port = address !== null && typeof address === "object" ? address.port : tlsPort;
|
|
87847
87910
|
this.logger.info(`Mesh TLS server is listening on port ${port}`);
|
|
87911
|
+
this.tlsServer = server;
|
|
87848
87912
|
resolve();
|
|
87849
87913
|
});
|
|
87850
|
-
this.tlsServer = server;
|
|
87851
87914
|
});
|
|
87852
87915
|
}
|
|
87853
87916
|
onTlsClientConnected(socket) {
|
|
@@ -88676,6 +88739,7 @@ exports.ServiceBroker = ServiceBroker;
|
|
|
88676
88739
|
exports.SystemConfigAddon = SystemConfigAddon;
|
|
88677
88740
|
exports.default = SystemConfigAddon;
|
|
88678
88741
|
exports.TlsTcpTransporter = TlsTcpTransporter;
|
|
88742
|
+
exports.Transporters = Transporters;
|
|
88679
88743
|
exports.UnlockTicketJtiStore = UnlockTicketJtiStore;
|
|
88680
88744
|
exports.caFingerprint = caFingerprint;
|
|
88681
88745
|
exports.caFingerprintCompact = caFingerprintCompact;
|
|
@@ -783,7 +783,7 @@ var MeshCertificateRegistry = class {
|
|
|
783
783
|
async recordObserved(nodeId, leaf) {
|
|
784
784
|
const known = this.rows.get(leaf.fingerprint);
|
|
785
785
|
if (known !== void 0) {
|
|
786
|
-
if (known.revokedReason !== "renewal-abandoned") return false;
|
|
786
|
+
if (known.revokedReason !== "renewal-abandoned") return known.revokedAt === null ? this.abandonRenewalsNewerThan(known) : false;
|
|
787
787
|
const reinstated = {
|
|
788
788
|
...known,
|
|
789
789
|
revokedAt: null,
|
|
@@ -899,6 +899,29 @@ var MeshCertificateRegistry = class {
|
|
|
899
899
|
return settled;
|
|
900
900
|
}
|
|
901
901
|
/** Set a never-completed renewal leaf aside (not current, NOT on the CRL). */
|
|
902
|
+
/** Fingerprints of renewal leaves whose handover is running right now (this process only). */
|
|
903
|
+
renewalsInFlight = /* @__PURE__ */ new Set();
|
|
904
|
+
/**
|
|
905
|
+
* A renewal's leaf is "in flight" from signing until the handover ends. While it is, a node seen
|
|
906
|
+
* presenting its OLD leaf is simply not swapped yet: the new leaf is not set aside (that would
|
|
907
|
+
* flap set-aside / reinstate on the node's first connection with it).
|
|
908
|
+
*/
|
|
909
|
+
beginRenewal(fingerprint) {
|
|
910
|
+
this.renewalsInFlight.add(fingerprint);
|
|
911
|
+
}
|
|
912
|
+
endRenewal(fingerprint) {
|
|
913
|
+
this.renewalsInFlight.delete(fingerprint);
|
|
914
|
+
}
|
|
915
|
+
async abandonRenewalsNewerThan(presented) {
|
|
916
|
+
let changed = false;
|
|
917
|
+
for (const record of this.liveFor(presented.nodeId)) {
|
|
918
|
+
if (record.fingerprint === presented.fingerprint) continue;
|
|
919
|
+
if (record.issuedVia !== "renewal" || record.issuedAt <= presented.issuedAt) continue;
|
|
920
|
+
if (this.renewalsInFlight.has(record.fingerprint)) continue;
|
|
921
|
+
if (await this.abandon(record.fingerprint)) changed = true;
|
|
922
|
+
}
|
|
923
|
+
return changed;
|
|
924
|
+
}
|
|
902
925
|
async abandon(fingerprint) {
|
|
903
926
|
const record = this.rows.get(fingerprint);
|
|
904
927
|
if (record === void 0 || record.revokedAt !== null) return false;
|
|
@@ -1054,6 +1077,24 @@ function message$1(error) {
|
|
|
1054
1077
|
return error instanceof Error ? error.message : String(error);
|
|
1055
1078
|
}
|
|
1056
1079
|
async function renewMeshCertificate(deps) {
|
|
1080
|
+
const inFlight = { fingerprint: null };
|
|
1081
|
+
try {
|
|
1082
|
+
return await runRenewal(deps, inFlight);
|
|
1083
|
+
} finally {
|
|
1084
|
+
if (inFlight.fingerprint !== null) {
|
|
1085
|
+
deps.registry.endRenewal(inFlight.fingerprint);
|
|
1086
|
+
const live = deps.peers.peerLeaf(deps.nodeId);
|
|
1087
|
+
if (live !== void 0) await deps.registry.recordObserved(deps.nodeId, {
|
|
1088
|
+
cn: deps.nodeId,
|
|
1089
|
+
serial: live.serial,
|
|
1090
|
+
fingerprint: live.fingerprint,
|
|
1091
|
+
notBefore: live.notBefore,
|
|
1092
|
+
notAfter: live.notAfter
|
|
1093
|
+
}).catch(() => void 0);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
async function runRenewal(deps, inFlight) {
|
|
1057
1098
|
const { nodeId, log } = deps;
|
|
1058
1099
|
const tags = { nodeId };
|
|
1059
1100
|
const sleep = deps.sleep ?? defaultSleep;
|
|
@@ -1115,12 +1156,28 @@ async function renewMeshCertificate(deps) {
|
|
|
1115
1156
|
return fail("issue", message$1(error), true);
|
|
1116
1157
|
}
|
|
1117
1158
|
const newLeaf = describeMeshLeaf(issued.certPem);
|
|
1159
|
+
deps.registry.beginRenewal(newLeaf.fingerprint);
|
|
1160
|
+
inFlight.fingerprint = newLeaf.fingerprint;
|
|
1118
1161
|
let resolveRegistered = () => void 0;
|
|
1119
1162
|
const registeredPromise = new Promise((resolve) => {
|
|
1120
1163
|
resolveRegistered = resolve;
|
|
1121
1164
|
});
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1165
|
+
const expected = deps.expectedAddons?.(nodeId) ?? [];
|
|
1166
|
+
let missingAddons = [];
|
|
1167
|
+
const unsubscribe = deps.registrations.subscribe((id, addonIds) => {
|
|
1168
|
+
if (id !== nodeId || deps.peers.peerLeaf(nodeId)?.fingerprint !== newLeaf.fingerprint) return;
|
|
1169
|
+
if (addonIds !== void 0) {
|
|
1170
|
+
const present = new Set(addonIds);
|
|
1171
|
+
missingAddons = expected.filter((addonId) => !present.has(addonId));
|
|
1172
|
+
if (missingAddons.length > 0) {
|
|
1173
|
+
log.warn("Mesh renewal: the node registered without addons it had before - waiting", {
|
|
1174
|
+
tags,
|
|
1175
|
+
meta: { missing: missingAddons }
|
|
1176
|
+
});
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
resolveRegistered(true);
|
|
1124
1181
|
});
|
|
1125
1182
|
const deadlineTimer = setTimer(() => resolveRegistered(false), timeoutMs);
|
|
1126
1183
|
registeredPromise.then(() => deadlineTimer.cancel());
|
|
@@ -1151,7 +1208,8 @@ async function renewMeshCertificate(deps) {
|
|
|
1151
1208
|
}
|
|
1152
1209
|
});
|
|
1153
1210
|
await deps.registry.abandon(newLeaf.fingerprint);
|
|
1154
|
-
|
|
1211
|
+
const lost = missingAddons.length > 0 ? ` (its last registration lacked ${missingAddons.length} addon(s) it had before: ${missingAddons.slice(0, 5).join(", ")}; the swap was rolled back and nothing was revoked - once those addons are running again the next renewal will go through)` : "";
|
|
1212
|
+
return fail("reconnect", `the node was not back and registered with the new leaf within ${Math.round(timeoutMs / 1e3)} s${lost}; the previous leaf was kept and is still valid`, true);
|
|
1155
1213
|
}
|
|
1156
1214
|
log.info("Mesh renewal: the node registered presenting the new leaf", { tags });
|
|
1157
1215
|
let confirmError = "the node did not confirm the new leaf";
|
|
@@ -1271,10 +1329,14 @@ function onProcessNodeRegistered(listener) {
|
|
|
1271
1329
|
listeners.delete(listener);
|
|
1272
1330
|
};
|
|
1273
1331
|
}
|
|
1274
|
-
/**
|
|
1275
|
-
|
|
1332
|
+
/**
|
|
1333
|
+
* Called by the hub when a node's `registerNode` has been applied. `addonIds` is what that
|
|
1334
|
+
* registration carried (a node's own addons and its children's, D3), so a waiter can tell the
|
|
1335
|
+
* registration of a node that came back WHOLE from the first one of a node that lost its children.
|
|
1336
|
+
*/
|
|
1337
|
+
function emitProcessNodeRegistered(nodeId, addonIds) {
|
|
1276
1338
|
for (const listener of [...registrationListeners()]) try {
|
|
1277
|
-
listener(nodeId);
|
|
1339
|
+
listener(nodeId, addonIds);
|
|
1278
1340
|
} catch {}
|
|
1279
1341
|
}
|
|
1280
1342
|
//#endregion
|
|
@@ -87827,6 +87889,7 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87827
87889
|
});
|
|
87828
87890
|
server.on("error", (err) => {
|
|
87829
87891
|
this.logger.error("Mesh TLS server error.", err);
|
|
87892
|
+
if (this.tlsServer === server) this.tlsServer = null;
|
|
87830
87893
|
reject(err);
|
|
87831
87894
|
});
|
|
87832
87895
|
server.listen({
|
|
@@ -87836,9 +87899,9 @@ var TlsTcpTransporter = class extends TcpTransporterBase {
|
|
|
87836
87899
|
const address = server.address();
|
|
87837
87900
|
const port = address !== null && typeof address === "object" ? address.port : tlsPort;
|
|
87838
87901
|
this.logger.info(`Mesh TLS server is listening on port ${port}`);
|
|
87902
|
+
this.tlsServer = server;
|
|
87839
87903
|
resolve();
|
|
87840
87904
|
});
|
|
87841
|
-
this.tlsServer = server;
|
|
87842
87905
|
});
|
|
87843
87906
|
}
|
|
87844
87907
|
onTlsClientConnected(socket) {
|
|
@@ -88647,4 +88710,4 @@ function readJwtExp(token) {
|
|
|
88647
88710
|
return typeof exp === "number" ? exp : 0;
|
|
88648
88711
|
}
|
|
88649
88712
|
//#endregion
|
|
88650
|
-
export {
|
|
88713
|
+
export { verifyAgentUiUnlockTicket as $, setProcessMeshCertificateRegistry as A, generateMeshCa as B, setProcessMeshTlsListenerState as C, RENEWAL_ABANDONED as D, MeshCertificateRegistry as E, requireProcessMeshCa as F, AGENT_DASHBOARD_ORIGINS_FIELD as G, issueMeshLeafForNode as H, caFingerprint as I, AGENT_UI_UNLOCK_VERSION as J, AGENT_UI_UNLOCK_DOMAIN as K, caFingerprintCompact as L, processMeshCrl as M, MeshCaKeeper as N, describeMeshLeaf as O, getProcessMeshCaState as P, parseAgentDashboardOrigins as Q, createMeshCsrPem as R, openMeshTlsWhenRevocationsLoaded as S, SYSTEM_CONFIG_CLUSTER_SECTION_ID, SystemConfigAddon, SystemConfigAddon as default, MESH_NODE_CERTIFICATES_COLUMNS as T, issueMeshLeafFromCsr as U, generateMeshKeyPair as V, loadMeshCa as W, isAllowedAgentDashboardReturnTo as X, UnlockTicketJtiStore as Y, mintAgentUiUnlockTicket as Z, onProcessNodeRegistered as _, ServiceBroker as a, requestProcessMeshEnforcement as at, revokeMeshCertificate as b, enrollMeshNode as c, setProcessMeshEnforcer as ct, processJoinTokenJtiStore as d, parseCidrList as dt, MESH_AUTH_MODE_FIELD as et, verifyMeshJoinToken as f, readCidrSetting as ft, getProcessPeerLeaf as g, getProcessNodeMeshTransport as h, Errors as i, parseMeshAuthMode as it, MeshCrl as j, getProcessMeshCertificateRegistry as k, JoinTokenJtiStore as l, createCidrMatcher as lt, emitProcessNodeRegistered as m, MESH_TLS_PORT_HELLO_FIELD as n, getProcessMeshAuthStatus as nt, Transporters as o, setProcessMeshAuthMode as ot, dropProcessPeer as p, AGENT_UI_UNLOCK_TTL_MS as q, TlsTcpTransporter as r, isMeshAuthMode as rt, setProcessMeshTlsEnabler as s, setProcessMeshAuthStatusSource as st, systemConfigMeshActions as t, getProcessMeshAuthMode as tt, mintMeshJoinToken as u, normalizeIp as ut, setProcessMeshPeerTransportLookup as v, MESH_NODE_CERTIFICATES_COLLECTION as w, getProcessMeshTlsListenerState as x, renewMeshCertificate as y, exportMeshPrivateKeyPem as z };
|
package/dist/index.js
CHANGED
|
@@ -15054,7 +15054,7 @@ function resolveUseHostname() {
|
|
|
15054
15054
|
return process.env["CAMSTACK_MOLECULER_USE_HOSTNAME"] !== "false";
|
|
15055
15055
|
}
|
|
15056
15056
|
function createBroker(config) {
|
|
15057
|
-
const { nodeID, mode,
|
|
15057
|
+
const { nodeID, mode, logLevel = "warn", tcpPort = DEFAULT_HUB_TCP_PORT } = config;
|
|
15058
15058
|
const useHostname = resolveUseHostname();
|
|
15059
15059
|
const infraLevel = "error";
|
|
15060
15060
|
const wildcardLevel = logLevel;
|
|
@@ -15101,56 +15101,11 @@ function createBroker(config) {
|
|
|
15101
15101
|
},
|
|
15102
15102
|
metrics: metricsConfig
|
|
15103
15103
|
});
|
|
15104
|
-
const
|
|
15105
|
-
const hasMeshTls = config.meshTls !== void 0;
|
|
15106
|
-
const hubDialPort = hasMeshTls ? config.tlsPort ?? 6443 : tcpPort;
|
|
15107
|
-
if (hasMeshTls) {
|
|
15108
|
-
const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
|
|
15109
|
-
return new require_builtins_system_config_system_config_addon.ServiceBroker({
|
|
15110
|
-
nodeID,
|
|
15111
|
-
serializer: "MsgPack",
|
|
15112
|
-
transporter: new require_builtins_system_config_system_config_addon.TlsTcpTransporter({
|
|
15113
|
-
port: agentListenPort,
|
|
15114
|
-
tlsPort: config.agentTlsListenPort ?? 6443,
|
|
15115
|
-
peerTlsPort: hubDialPort,
|
|
15116
|
-
hubOnlyPeers: true,
|
|
15117
|
-
maxPacketSize: 10 * 1024 * 1024,
|
|
15118
|
-
useHostname,
|
|
15119
|
-
debug: false,
|
|
15120
|
-
meshTls: config.meshTls,
|
|
15121
|
-
udpDiscovery: false,
|
|
15122
|
-
...urls !== void 0 ? { urls } : {}
|
|
15123
|
-
}),
|
|
15124
|
-
...config.middlewares !== void 0 ? { middlewares: [...config.middlewares] } : {},
|
|
15125
|
-
logger: {
|
|
15126
|
-
type: "Console",
|
|
15127
|
-
options: { level: {
|
|
15128
|
-
BROKER: infraLevel,
|
|
15129
|
-
TRANSPORTER: infraLevel,
|
|
15130
|
-
TRANSIT: infraLevel,
|
|
15131
|
-
REGISTRY: infraLevel,
|
|
15132
|
-
DISCOVERER: infraLevel,
|
|
15133
|
-
"**": wildcardLevel
|
|
15134
|
-
} }
|
|
15135
|
-
},
|
|
15136
|
-
metrics: metricsConfig
|
|
15137
|
-
});
|
|
15138
|
-
}
|
|
15139
|
-
const tcpOptions = {
|
|
15140
|
-
maxPacketSize: 10 * 1024 * 1024,
|
|
15141
|
-
port: agentListenPort,
|
|
15142
|
-
useHostname,
|
|
15143
|
-
debug: false
|
|
15144
|
-
};
|
|
15145
|
-
tcpOptions.udpDiscovery = false;
|
|
15146
|
-
if (hubAddress) tcpOptions.urls = normalizeHubUrl(hubAddress, tcpPort);
|
|
15104
|
+
const transport = createAgentTransport(config);
|
|
15147
15105
|
return new require_builtins_system_config_system_config_addon.ServiceBroker({
|
|
15148
15106
|
nodeID,
|
|
15149
15107
|
serializer: "MsgPack",
|
|
15150
|
-
transporter:
|
|
15151
|
-
type: "TCP",
|
|
15152
|
-
options: tcpOptions
|
|
15153
|
-
},
|
|
15108
|
+
transporter: transport.kind === "tls" ? transport.transporter : transport.descriptor,
|
|
15154
15109
|
...config.middlewares !== void 0 ? { middlewares: [...config.middlewares] } : {},
|
|
15155
15110
|
logger: {
|
|
15156
15111
|
type: "Console",
|
|
@@ -15166,6 +15121,58 @@ function createBroker(config) {
|
|
|
15166
15121
|
metrics: metricsConfig
|
|
15167
15122
|
});
|
|
15168
15123
|
}
|
|
15124
|
+
/**
|
|
15125
|
+
* The transport of an agent broker, from its config. An agent with no hub address dials nobody
|
|
15126
|
+
* and stays `unconfigured` until one is set (the agent UI lists the hubs found over mDNS, D839).
|
|
15127
|
+
* There is no UDP discovery to fall back on (D843).
|
|
15128
|
+
*
|
|
15129
|
+
* The reader binds a STABLE port derived from the nodeID (not an OS-ephemeral `port: 0`). See
|
|
15130
|
+
* `deriveAgentListenPort` - this is what makes a same-nodeID kill+restart reconnect cleanly:
|
|
15131
|
+
* Moleculer never refreshes a known node's address, so the agent must return at the same address
|
|
15132
|
+
* it left from.
|
|
15133
|
+
*
|
|
15134
|
+
* Shared by `createBroker` (the first transport) and the in-place reconnect
|
|
15135
|
+
* (`broker-transport-swap.ts`, the next one): one builder, so a reconnect cannot dial differently
|
|
15136
|
+
* from a boot.
|
|
15137
|
+
*/
|
|
15138
|
+
function createAgentTransport(config) {
|
|
15139
|
+
const { nodeID, hubAddress, tcpPort = DEFAULT_HUB_TCP_PORT } = config;
|
|
15140
|
+
const useHostname = resolveUseHostname();
|
|
15141
|
+
const agentListenPort = config.agentListenPort ?? deriveAgentListenPort(nodeID);
|
|
15142
|
+
const hubDialPort = config.meshTls !== void 0 ? config.tlsPort ?? 6443 : tcpPort;
|
|
15143
|
+
if (config.meshTls !== void 0) {
|
|
15144
|
+
const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
|
|
15145
|
+
return {
|
|
15146
|
+
kind: "tls",
|
|
15147
|
+
transporter: new require_builtins_system_config_system_config_addon.TlsTcpTransporter({
|
|
15148
|
+
port: agentListenPort,
|
|
15149
|
+
tlsPort: config.agentTlsListenPort ?? 6443,
|
|
15150
|
+
peerTlsPort: hubDialPort,
|
|
15151
|
+
hubOnlyPeers: true,
|
|
15152
|
+
maxPacketSize: 10 * 1024 * 1024,
|
|
15153
|
+
useHostname,
|
|
15154
|
+
debug: false,
|
|
15155
|
+
meshTls: config.meshTls,
|
|
15156
|
+
udpDiscovery: false,
|
|
15157
|
+
...urls !== void 0 ? { urls } : {}
|
|
15158
|
+
})
|
|
15159
|
+
};
|
|
15160
|
+
}
|
|
15161
|
+
return {
|
|
15162
|
+
kind: "tcp",
|
|
15163
|
+
descriptor: {
|
|
15164
|
+
type: "TCP",
|
|
15165
|
+
options: {
|
|
15166
|
+
maxPacketSize: 10 * 1024 * 1024,
|
|
15167
|
+
port: agentListenPort,
|
|
15168
|
+
useHostname,
|
|
15169
|
+
debug: false,
|
|
15170
|
+
udpDiscovery: false,
|
|
15171
|
+
...hubAddress ? { urls: normalizeHubUrl(hubAddress, tcpPort) } : {}
|
|
15172
|
+
}
|
|
15173
|
+
}
|
|
15174
|
+
};
|
|
15175
|
+
}
|
|
15169
15176
|
function normalizeHubUrl(raw, defaultPort) {
|
|
15170
15177
|
const atSplit = raw.includes("@") ? raw.split("@") : null;
|
|
15171
15178
|
const nodeIdFromAt = atSplit ? atSplit[0] : null;
|
|
@@ -15181,6 +15188,142 @@ function getBrokerTlsTransporter(broker) {
|
|
|
15181
15188
|
return tx instanceof require_builtins_system_config_system_config_addon.TlsTcpTransporter ? tx : null;
|
|
15182
15189
|
}
|
|
15183
15190
|
//#endregion
|
|
15191
|
+
//#region src/kernel/moleculer/broker-transport-swap.ts
|
|
15192
|
+
/**
|
|
15193
|
+
* Reconnecting a broker's TRANSPORT in place, without rebuilding the broker (D856 amendment).
|
|
15194
|
+
*
|
|
15195
|
+
* An agent changes how it dials the hub (a new hub address, a new cluster secret, a mesh leaf
|
|
15196
|
+
* swap or its rollback) by replacing its transporter. It used to stop the whole `ServiceBroker`
|
|
15197
|
+
* and build another. That threw away everything bound to the old one: the `$process` service
|
|
15198
|
+
* (whose `stopped()` SIGTERMs every runner - the "child gone" lines), `$agent-cap-fwd`,
|
|
15199
|
+
* `$agent`, the event bus, the addon services and every closure that captured the broker. The
|
|
15200
|
+
* node came back ONLINE and capless, and the hub's confirm step then failed with
|
|
15201
|
+
* "`$agent-cap-fwd.forward` is not found".
|
|
15202
|
+
*
|
|
15203
|
+
* The broker, its services, its registries and its child runners are all independent of the
|
|
15204
|
+
* wire. So only the wire is replaced: disconnect the transit, forget the remote nodes (their
|
|
15205
|
+
* connection is gone, and the next `$node.connected` is what re-runs the mesh join), install a
|
|
15206
|
+
* new transporter on the SAME transit and connect it. Children never notice; the join's settle
|
|
15207
|
+
* re-sends the full manifest (D3), which still carries every child.
|
|
15208
|
+
*/
|
|
15209
|
+
function isObject(value) {
|
|
15210
|
+
return typeof value === "object" && value !== null;
|
|
15211
|
+
}
|
|
15212
|
+
function isFunction(value) {
|
|
15213
|
+
return typeof value === "function";
|
|
15214
|
+
}
|
|
15215
|
+
/** Moleculer's d.ts hides the transit and the registry internals: check them at runtime instead. */
|
|
15216
|
+
function isWrappingBroker(value) {
|
|
15217
|
+
return isObject(value) && isFunction(Reflect.get(value, "wrapMethod")) && hasNodeCatalog(Reflect.get(value, "registry")) && "transit" in value;
|
|
15218
|
+
}
|
|
15219
|
+
/** The node catalog the swap forgets remote nodes through (private Moleculer API, pinned by a spec). */
|
|
15220
|
+
function hasNodeCatalog(registry) {
|
|
15221
|
+
if (!isObject(registry)) return false;
|
|
15222
|
+
const nodes = Reflect.get(registry, "nodes");
|
|
15223
|
+
return isObject(nodes) && isFunction(Reflect.get(nodes, "disconnected")) && isFunction(Reflect.get(nodes, "list"));
|
|
15224
|
+
}
|
|
15225
|
+
function isTransporterLike(value) {
|
|
15226
|
+
return isObject(value) && isFunction(Reflect.get(value, "init")) && isFunction(Reflect.get(value, "connect")) && isFunction(Reflect.get(value, "disconnect"));
|
|
15227
|
+
}
|
|
15228
|
+
function wrapping(broker) {
|
|
15229
|
+
if (!isWrappingBroker(broker)) throw new Error("not a Moleculer broker with a transport");
|
|
15230
|
+
return broker;
|
|
15231
|
+
}
|
|
15232
|
+
function transitOf(broker) {
|
|
15233
|
+
const transit = wrapping(broker).transit;
|
|
15234
|
+
if (transit === null || transit === void 0) throw new Error("the broker has no transport to reconnect");
|
|
15235
|
+
return transit;
|
|
15236
|
+
}
|
|
15237
|
+
/** The transporter currently installed on the broker (for identity checks). */
|
|
15238
|
+
function currentBrokerTransporter(broker) {
|
|
15239
|
+
return { tx: transitOf(broker).tx };
|
|
15240
|
+
}
|
|
15241
|
+
/** Build the transporter an {@link AgentTransport} describes (nothing is bound or dialled yet). */
|
|
15242
|
+
function buildTransporter(transport) {
|
|
15243
|
+
const tx = transport.kind === "tls" ? transport.transporter : require_builtins_system_config_system_config_addon.Transporters.resolve(transport.descriptor);
|
|
15244
|
+
if (!isTransporterLike(tx)) throw new Error("the agent transport is not a Moleculer transporter");
|
|
15245
|
+
return { tx };
|
|
15246
|
+
}
|
|
15247
|
+
/**
|
|
15248
|
+
* Whether `pending` is the transporter installed on the broker right now. A reconnect that was
|
|
15249
|
+
* abandoned at its deadline and resumes later must not tear down a newer run's transport.
|
|
15250
|
+
*/
|
|
15251
|
+
function isInstalledTransporter(broker, pending) {
|
|
15252
|
+
return transitOf(broker).tx === pending.tx;
|
|
15253
|
+
}
|
|
15254
|
+
/**
|
|
15255
|
+
* Disconnect the installed transporter and forget every remote node. Forgetting is what makes the
|
|
15256
|
+
* hub's next INFO a NEW connection: `$node.connected` fires again, so the agent's mesh join re-runs
|
|
15257
|
+
* and its settle re-sends the manifest. Without it the hub would still be "available" in the local
|
|
15258
|
+
* registry and nothing would re-announce the node.
|
|
15259
|
+
*/
|
|
15260
|
+
async function disconnectBrokerTransport(broker) {
|
|
15261
|
+
const b = wrapping(broker);
|
|
15262
|
+
const transit = transitOf(broker);
|
|
15263
|
+
const leaving = transit.tx;
|
|
15264
|
+
retired.add(leaving);
|
|
15265
|
+
try {
|
|
15266
|
+
await transit.disconnect();
|
|
15267
|
+
} finally {
|
|
15268
|
+
detachListeners(leaving);
|
|
15269
|
+
for (const node of b.registry.nodes.list({ onlyAvailable: true })) if (node.id !== b.nodeID) b.registry.nodes.disconnected(node.id, false);
|
|
15270
|
+
}
|
|
15271
|
+
}
|
|
15272
|
+
/** Transporters that were disconnected or replaced: their `connect` is a no-op for good. */
|
|
15273
|
+
var retired = /* @__PURE__ */ new WeakSet();
|
|
15274
|
+
/**
|
|
15275
|
+
* The leaving transporter's writer must not keep reporting into the SHARED node catalog: a late
|
|
15276
|
+
* FIN on one of its sockets would call `nodes.disconnected` on the node the NEW transporter just
|
|
15277
|
+
* connected to.
|
|
15278
|
+
*/
|
|
15279
|
+
function detachListeners(tx) {
|
|
15280
|
+
for (const emitter of [tx.writer, tx.reader]) if (isObject(emitter) && isFunction(Reflect.get(emitter, "removeAllListeners"))) Reflect.get(emitter, "removeAllListeners").call(emitter);
|
|
15281
|
+
}
|
|
15282
|
+
/**
|
|
15283
|
+
* One connect at a time per transporter, and none for a retired or replaced one. Moleculer's connect
|
|
15284
|
+
* retry re-runs `tx.connect()` on whatever `transit.tx` is when its timer fires; a second run of
|
|
15285
|
+
* `startTcpServer` overwrites the live reader and writer, leaks the gossip interval and leaves a
|
|
15286
|
+
* listening server behind. A connect that fails is cleaned up before the retry runs.
|
|
15287
|
+
*/
|
|
15288
|
+
function guardConnect(transit, tx) {
|
|
15289
|
+
const original = tx.connect.bind(tx);
|
|
15290
|
+
let inflight = null;
|
|
15291
|
+
tx.connect = (...args) => {
|
|
15292
|
+
if (retired.has(tx) || transit.tx !== tx) return Promise.resolve();
|
|
15293
|
+
if (inflight !== null) return inflight;
|
|
15294
|
+
if (tx.connected === true) return Promise.resolve();
|
|
15295
|
+
const run = original(...args).catch(async (error) => {
|
|
15296
|
+
await Promise.resolve(tx.disconnect()).catch(() => void 0);
|
|
15297
|
+
throw error;
|
|
15298
|
+
}).finally(() => {
|
|
15299
|
+
if (inflight === run) inflight = null;
|
|
15300
|
+
});
|
|
15301
|
+
inflight = run;
|
|
15302
|
+
return run;
|
|
15303
|
+
};
|
|
15304
|
+
}
|
|
15305
|
+
/**
|
|
15306
|
+
* Install `pending` as the broker's transporter: the same wiring Moleculer's `Transit` constructor
|
|
15307
|
+
* does (init + the broker's send/receive middleware wrapping, which carries the mesh join gate).
|
|
15308
|
+
*/
|
|
15309
|
+
function installBrokerTransporter(broker, pending) {
|
|
15310
|
+
const b = wrapping(broker);
|
|
15311
|
+
const transit = transitOf(broker);
|
|
15312
|
+
const tx = pending.tx;
|
|
15313
|
+
retired.add(transit.tx);
|
|
15314
|
+
guardConnect(transit, tx);
|
|
15315
|
+
tx.init(transit, (cmd, packet) => transit.messageHandler(cmd, packet), transit.afterConnect.bind(transit));
|
|
15316
|
+
const send = b.wrapMethod("transporterSend", tx.send, tx);
|
|
15317
|
+
const receive = b.wrapMethod("transporterReceive", tx.receive, tx, { reverse: true });
|
|
15318
|
+
tx.send = send;
|
|
15319
|
+
tx.receive = receive;
|
|
15320
|
+
transit.tx = tx;
|
|
15321
|
+
}
|
|
15322
|
+
/** Connect the installed transporter (the broker's own `start()` path, minus the services). */
|
|
15323
|
+
async function connectBrokerTransport(broker) {
|
|
15324
|
+
await transitOf(broker).connect();
|
|
15325
|
+
}
|
|
15326
|
+
//#endregion
|
|
15184
15327
|
//#region src/kernel/moleculer/addon-deploy-source.ts
|
|
15185
15328
|
function isAddonDeploySource(v) {
|
|
15186
15329
|
if (!v || typeof v !== "object") return false;
|
|
@@ -27144,6 +27287,7 @@ exports.buildNativeCapProxy = buildNativeCapProxy;
|
|
|
27144
27287
|
exports.buildNodeManifest = buildNodeManifest;
|
|
27145
27288
|
exports.buildNpmChildEnv = buildNpmChildEnv;
|
|
27146
27289
|
exports.buildStorageLocationRegistry = require_builtins_storage_orchestrator_storage_orchestrator_addon.buildStorageLocationRegistry;
|
|
27290
|
+
exports.buildTransporter = buildTransporter;
|
|
27147
27291
|
exports.builderMountedCapNames = builderMountedCapNames;
|
|
27148
27292
|
exports.caFingerprint = require_builtins_system_config_system_config_addon.caFingerprint;
|
|
27149
27293
|
exports.caFingerprintCompact = require_builtins_system_config_system_config_addon.caFingerprintCompact;
|
|
@@ -27170,6 +27314,7 @@ exports.collectCertIdentity = require_tls.collectCertIdentity;
|
|
|
27170
27314
|
exports.collectModelFiles = require_custom_action_registry.collectModelFiles;
|
|
27171
27315
|
exports.computeHubJoinProof = computeHubJoinProof;
|
|
27172
27316
|
exports.computeNodeJoinProof = computeNodeJoinProof;
|
|
27317
|
+
exports.connectBrokerTransport = connectBrokerTransport;
|
|
27173
27318
|
exports.contentTypeFor = require_custom_action_registry.contentTypeFor;
|
|
27174
27319
|
exports.copyDirRecursive = copyDirRecursive;
|
|
27175
27320
|
exports.copyExtraFileDirs = copyExtraFileDirs;
|
|
@@ -27179,6 +27324,7 @@ exports.createAddonPeerBytesFacility = createAddonPeerBytesFacility;
|
|
|
27179
27324
|
exports.createAddonService = createAddonService;
|
|
27180
27325
|
exports.createAgentEventScope = createAgentEventScope;
|
|
27181
27326
|
exports.createAgentHttpsRequest = require_tls.createAgentHttpsRequest;
|
|
27327
|
+
exports.createAgentTransport = createAgentTransport;
|
|
27182
27328
|
exports.createArrayBufferCensusGate = createArrayBufferCensusGate;
|
|
27183
27329
|
exports.createAuthenticatedFileServer = require_custom_action_registry.createAuthenticatedFileServer;
|
|
27184
27330
|
exports.createBroker = createBroker;
|
|
@@ -27217,6 +27363,7 @@ exports.createUdsEventBus = createUdsEventBus;
|
|
|
27217
27363
|
exports.createUdsLogger = createUdsLogger;
|
|
27218
27364
|
exports.createUdsLoggerWithControl = createUdsLoggerWithControl;
|
|
27219
27365
|
exports.createV8Reclaimer = createV8Reclaimer;
|
|
27366
|
+
exports.currentBrokerTransporter = currentBrokerTransporter;
|
|
27220
27367
|
exports.decideMeshAutoEnforce = decideMeshAutoEnforce;
|
|
27221
27368
|
exports.deleteModelFromDisk = require_custom_action_registry.deleteModelFromDisk;
|
|
27222
27369
|
exports.deriveAgentListenPort = deriveAgentListenPort;
|
|
@@ -27230,6 +27377,7 @@ exports.deviceOfGetStatus = deviceOfGetStatus;
|
|
|
27230
27377
|
exports.diffCapActionCensus = diffCapActionCensus;
|
|
27231
27378
|
exports.diffEventPlane = diffEventPlane;
|
|
27232
27379
|
exports.diffSocketPlane = diffSocketPlane;
|
|
27380
|
+
exports.disconnectBrokerTransport = disconnectBrokerTransport;
|
|
27233
27381
|
Object.defineProperty(exports, "downloadBinary", {
|
|
27234
27382
|
enumerable: true,
|
|
27235
27383
|
get: function() {
|
|
@@ -27337,6 +27485,7 @@ exports.heapSpaceField = heapSpaceField;
|
|
|
27337
27485
|
exports.hostNodeIdOf = hostNodeIdOf;
|
|
27338
27486
|
exports.hubMainRssBudget = hubMainRssBudget;
|
|
27339
27487
|
exports.installAgentHttps = require_tls.installAgentHttps;
|
|
27488
|
+
exports.installBrokerTransporter = installBrokerTransporter;
|
|
27340
27489
|
exports.installManifestNativeDeps = installManifestNativeDeps;
|
|
27341
27490
|
exports.installManifestPythonDeps = installManifestPythonDeps;
|
|
27342
27491
|
exports.installManifestSystemDeps = installManifestSystemDeps;
|
|
@@ -27363,6 +27512,7 @@ exports.isCollectionArrayMethod = require_dist.isCollectionArrayMethod;
|
|
|
27363
27512
|
exports.isContainerBridgeAddress = require_tls.isContainerBridgeAddress;
|
|
27364
27513
|
exports.isCredentialKeyName = isCredentialKeyName;
|
|
27365
27514
|
exports.isInfraCapability = isInfraCapability;
|
|
27515
|
+
exports.isInstalledTransporter = isInstalledTransporter;
|
|
27366
27516
|
exports.isLocalOnlyHostname = require_tls.isLocalOnlyHostname;
|
|
27367
27517
|
exports.isMeshAuthMode = require_builtins_system_config_system_config_addon.isMeshAuthMode;
|
|
27368
27518
|
exports.isModelDownloaded = require_custom_action_registry.isModelDownloaded;
|
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapF
|
|
|
28
28
|
import "./builtins/storage-orchestrator/index.mjs";
|
|
29
29
|
import { a as setProcessAgentHttpsNames, i as getProcessAgentHttpsNames, n as AGENT_HTTPS_NAMES_COLUMNS, r as AgentHttpsNames, t as AGENT_HTTPS_NAMES_COLLECTION } from "./agent-https-names-uetr4OQl.mjs";
|
|
30
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-CttE77VF.mjs";
|
|
31
|
-
import { $ as
|
|
31
|
+
import { $ as verifyAgentUiUnlockTicket, A as setProcessMeshCertificateRegistry, B as generateMeshCa, C as setProcessMeshTlsListenerState, D as RENEWAL_ABANDONED, E as MeshCertificateRegistry, F as requireProcessMeshCa, G as AGENT_DASHBOARD_ORIGINS_FIELD, H as issueMeshLeafForNode, I as caFingerprint, J as AGENT_UI_UNLOCK_VERSION, K as AGENT_UI_UNLOCK_DOMAIN, L as caFingerprintCompact, M as processMeshCrl, N as MeshCaKeeper, O as describeMeshLeaf, P as getProcessMeshCaState, Q as parseAgentDashboardOrigins, R as createMeshCsrPem, S as openMeshTlsWhenRevocationsLoaded, SystemConfigAddon, T as MESH_NODE_CERTIFICATES_COLUMNS, U as issueMeshLeafFromCsr, V as generateMeshKeyPair, W as loadMeshCa, X as isAllowedAgentDashboardReturnTo, Y as UnlockTicketJtiStore, Z as mintAgentUiUnlockTicket, _ as onProcessNodeRegistered, a as ServiceBroker, at as requestProcessMeshEnforcement, b as revokeMeshCertificate, c as enrollMeshNode, ct as setProcessMeshEnforcer, d as processJoinTokenJtiStore, dt as parseCidrList, et as MESH_AUTH_MODE_FIELD, f as verifyMeshJoinToken, ft as readCidrSetting, g as getProcessPeerLeaf, h as getProcessNodeMeshTransport, i as Errors, it as parseMeshAuthMode, j as MeshCrl, k as getProcessMeshCertificateRegistry, l as JoinTokenJtiStore, lt as createCidrMatcher, m as emitProcessNodeRegistered, n as MESH_TLS_PORT_HELLO_FIELD, nt as getProcessMeshAuthStatus, o as Transporters, ot as setProcessMeshAuthMode, p as dropProcessPeer, q as AGENT_UI_UNLOCK_TTL_MS, r as TlsTcpTransporter, rt as isMeshAuthMode, s as setProcessMeshTlsEnabler, st as setProcessMeshAuthStatusSource, tt as getProcessMeshAuthMode, u as mintMeshJoinToken, ut as normalizeIp, v as setProcessMeshPeerTransportLookup, w as MESH_NODE_CERTIFICATES_COLLECTION, x as getProcessMeshTlsListenerState, y as renewMeshCertificate, z as exportMeshPrivateKeyPem } 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";
|
|
@@ -15051,7 +15051,7 @@ function resolveUseHostname() {
|
|
|
15051
15051
|
return process.env["CAMSTACK_MOLECULER_USE_HOSTNAME"] !== "false";
|
|
15052
15052
|
}
|
|
15053
15053
|
function createBroker(config) {
|
|
15054
|
-
const { nodeID, mode,
|
|
15054
|
+
const { nodeID, mode, logLevel = "warn", tcpPort = DEFAULT_HUB_TCP_PORT } = config;
|
|
15055
15055
|
const useHostname = resolveUseHostname();
|
|
15056
15056
|
const infraLevel = "error";
|
|
15057
15057
|
const wildcardLevel = logLevel;
|
|
@@ -15098,56 +15098,11 @@ function createBroker(config) {
|
|
|
15098
15098
|
},
|
|
15099
15099
|
metrics: metricsConfig
|
|
15100
15100
|
});
|
|
15101
|
-
const
|
|
15102
|
-
const hasMeshTls = config.meshTls !== void 0;
|
|
15103
|
-
const hubDialPort = hasMeshTls ? config.tlsPort ?? 6443 : tcpPort;
|
|
15104
|
-
if (hasMeshTls) {
|
|
15105
|
-
const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
|
|
15106
|
-
return new ServiceBroker({
|
|
15107
|
-
nodeID,
|
|
15108
|
-
serializer: "MsgPack",
|
|
15109
|
-
transporter: new TlsTcpTransporter({
|
|
15110
|
-
port: agentListenPort,
|
|
15111
|
-
tlsPort: config.agentTlsListenPort ?? 6443,
|
|
15112
|
-
peerTlsPort: hubDialPort,
|
|
15113
|
-
hubOnlyPeers: true,
|
|
15114
|
-
maxPacketSize: 10 * 1024 * 1024,
|
|
15115
|
-
useHostname,
|
|
15116
|
-
debug: false,
|
|
15117
|
-
meshTls: config.meshTls,
|
|
15118
|
-
udpDiscovery: false,
|
|
15119
|
-
...urls !== void 0 ? { urls } : {}
|
|
15120
|
-
}),
|
|
15121
|
-
...config.middlewares !== void 0 ? { middlewares: [...config.middlewares] } : {},
|
|
15122
|
-
logger: {
|
|
15123
|
-
type: "Console",
|
|
15124
|
-
options: { level: {
|
|
15125
|
-
BROKER: infraLevel,
|
|
15126
|
-
TRANSPORTER: infraLevel,
|
|
15127
|
-
TRANSIT: infraLevel,
|
|
15128
|
-
REGISTRY: infraLevel,
|
|
15129
|
-
DISCOVERER: infraLevel,
|
|
15130
|
-
"**": wildcardLevel
|
|
15131
|
-
} }
|
|
15132
|
-
},
|
|
15133
|
-
metrics: metricsConfig
|
|
15134
|
-
});
|
|
15135
|
-
}
|
|
15136
|
-
const tcpOptions = {
|
|
15137
|
-
maxPacketSize: 10 * 1024 * 1024,
|
|
15138
|
-
port: agentListenPort,
|
|
15139
|
-
useHostname,
|
|
15140
|
-
debug: false
|
|
15141
|
-
};
|
|
15142
|
-
tcpOptions.udpDiscovery = false;
|
|
15143
|
-
if (hubAddress) tcpOptions.urls = normalizeHubUrl(hubAddress, tcpPort);
|
|
15101
|
+
const transport = createAgentTransport(config);
|
|
15144
15102
|
return new ServiceBroker({
|
|
15145
15103
|
nodeID,
|
|
15146
15104
|
serializer: "MsgPack",
|
|
15147
|
-
transporter:
|
|
15148
|
-
type: "TCP",
|
|
15149
|
-
options: tcpOptions
|
|
15150
|
-
},
|
|
15105
|
+
transporter: transport.kind === "tls" ? transport.transporter : transport.descriptor,
|
|
15151
15106
|
...config.middlewares !== void 0 ? { middlewares: [...config.middlewares] } : {},
|
|
15152
15107
|
logger: {
|
|
15153
15108
|
type: "Console",
|
|
@@ -15163,6 +15118,58 @@ function createBroker(config) {
|
|
|
15163
15118
|
metrics: metricsConfig
|
|
15164
15119
|
});
|
|
15165
15120
|
}
|
|
15121
|
+
/**
|
|
15122
|
+
* The transport of an agent broker, from its config. An agent with no hub address dials nobody
|
|
15123
|
+
* and stays `unconfigured` until one is set (the agent UI lists the hubs found over mDNS, D839).
|
|
15124
|
+
* There is no UDP discovery to fall back on (D843).
|
|
15125
|
+
*
|
|
15126
|
+
* The reader binds a STABLE port derived from the nodeID (not an OS-ephemeral `port: 0`). See
|
|
15127
|
+
* `deriveAgentListenPort` - this is what makes a same-nodeID kill+restart reconnect cleanly:
|
|
15128
|
+
* Moleculer never refreshes a known node's address, so the agent must return at the same address
|
|
15129
|
+
* it left from.
|
|
15130
|
+
*
|
|
15131
|
+
* Shared by `createBroker` (the first transport) and the in-place reconnect
|
|
15132
|
+
* (`broker-transport-swap.ts`, the next one): one builder, so a reconnect cannot dial differently
|
|
15133
|
+
* from a boot.
|
|
15134
|
+
*/
|
|
15135
|
+
function createAgentTransport(config) {
|
|
15136
|
+
const { nodeID, hubAddress, tcpPort = DEFAULT_HUB_TCP_PORT } = config;
|
|
15137
|
+
const useHostname = resolveUseHostname();
|
|
15138
|
+
const agentListenPort = config.agentListenPort ?? deriveAgentListenPort(nodeID);
|
|
15139
|
+
const hubDialPort = config.meshTls !== void 0 ? config.tlsPort ?? 6443 : tcpPort;
|
|
15140
|
+
if (config.meshTls !== void 0) {
|
|
15141
|
+
const urls = hubAddress !== void 0 ? normalizeHubUrl(hubAddress, hubDialPort) : void 0;
|
|
15142
|
+
return {
|
|
15143
|
+
kind: "tls",
|
|
15144
|
+
transporter: new TlsTcpTransporter({
|
|
15145
|
+
port: agentListenPort,
|
|
15146
|
+
tlsPort: config.agentTlsListenPort ?? 6443,
|
|
15147
|
+
peerTlsPort: hubDialPort,
|
|
15148
|
+
hubOnlyPeers: true,
|
|
15149
|
+
maxPacketSize: 10 * 1024 * 1024,
|
|
15150
|
+
useHostname,
|
|
15151
|
+
debug: false,
|
|
15152
|
+
meshTls: config.meshTls,
|
|
15153
|
+
udpDiscovery: false,
|
|
15154
|
+
...urls !== void 0 ? { urls } : {}
|
|
15155
|
+
})
|
|
15156
|
+
};
|
|
15157
|
+
}
|
|
15158
|
+
return {
|
|
15159
|
+
kind: "tcp",
|
|
15160
|
+
descriptor: {
|
|
15161
|
+
type: "TCP",
|
|
15162
|
+
options: {
|
|
15163
|
+
maxPacketSize: 10 * 1024 * 1024,
|
|
15164
|
+
port: agentListenPort,
|
|
15165
|
+
useHostname,
|
|
15166
|
+
debug: false,
|
|
15167
|
+
udpDiscovery: false,
|
|
15168
|
+
...hubAddress ? { urls: normalizeHubUrl(hubAddress, tcpPort) } : {}
|
|
15169
|
+
}
|
|
15170
|
+
}
|
|
15171
|
+
};
|
|
15172
|
+
}
|
|
15166
15173
|
function normalizeHubUrl(raw, defaultPort) {
|
|
15167
15174
|
const atSplit = raw.includes("@") ? raw.split("@") : null;
|
|
15168
15175
|
const nodeIdFromAt = atSplit ? atSplit[0] : null;
|
|
@@ -15178,6 +15185,142 @@ function getBrokerTlsTransporter(broker) {
|
|
|
15178
15185
|
return tx instanceof TlsTcpTransporter ? tx : null;
|
|
15179
15186
|
}
|
|
15180
15187
|
//#endregion
|
|
15188
|
+
//#region src/kernel/moleculer/broker-transport-swap.ts
|
|
15189
|
+
/**
|
|
15190
|
+
* Reconnecting a broker's TRANSPORT in place, without rebuilding the broker (D856 amendment).
|
|
15191
|
+
*
|
|
15192
|
+
* An agent changes how it dials the hub (a new hub address, a new cluster secret, a mesh leaf
|
|
15193
|
+
* swap or its rollback) by replacing its transporter. It used to stop the whole `ServiceBroker`
|
|
15194
|
+
* and build another. That threw away everything bound to the old one: the `$process` service
|
|
15195
|
+
* (whose `stopped()` SIGTERMs every runner - the "child gone" lines), `$agent-cap-fwd`,
|
|
15196
|
+
* `$agent`, the event bus, the addon services and every closure that captured the broker. The
|
|
15197
|
+
* node came back ONLINE and capless, and the hub's confirm step then failed with
|
|
15198
|
+
* "`$agent-cap-fwd.forward` is not found".
|
|
15199
|
+
*
|
|
15200
|
+
* The broker, its services, its registries and its child runners are all independent of the
|
|
15201
|
+
* wire. So only the wire is replaced: disconnect the transit, forget the remote nodes (their
|
|
15202
|
+
* connection is gone, and the next `$node.connected` is what re-runs the mesh join), install a
|
|
15203
|
+
* new transporter on the SAME transit and connect it. Children never notice; the join's settle
|
|
15204
|
+
* re-sends the full manifest (D3), which still carries every child.
|
|
15205
|
+
*/
|
|
15206
|
+
function isObject(value) {
|
|
15207
|
+
return typeof value === "object" && value !== null;
|
|
15208
|
+
}
|
|
15209
|
+
function isFunction(value) {
|
|
15210
|
+
return typeof value === "function";
|
|
15211
|
+
}
|
|
15212
|
+
/** Moleculer's d.ts hides the transit and the registry internals: check them at runtime instead. */
|
|
15213
|
+
function isWrappingBroker(value) {
|
|
15214
|
+
return isObject(value) && isFunction(Reflect.get(value, "wrapMethod")) && hasNodeCatalog(Reflect.get(value, "registry")) && "transit" in value;
|
|
15215
|
+
}
|
|
15216
|
+
/** The node catalog the swap forgets remote nodes through (private Moleculer API, pinned by a spec). */
|
|
15217
|
+
function hasNodeCatalog(registry) {
|
|
15218
|
+
if (!isObject(registry)) return false;
|
|
15219
|
+
const nodes = Reflect.get(registry, "nodes");
|
|
15220
|
+
return isObject(nodes) && isFunction(Reflect.get(nodes, "disconnected")) && isFunction(Reflect.get(nodes, "list"));
|
|
15221
|
+
}
|
|
15222
|
+
function isTransporterLike(value) {
|
|
15223
|
+
return isObject(value) && isFunction(Reflect.get(value, "init")) && isFunction(Reflect.get(value, "connect")) && isFunction(Reflect.get(value, "disconnect"));
|
|
15224
|
+
}
|
|
15225
|
+
function wrapping(broker) {
|
|
15226
|
+
if (!isWrappingBroker(broker)) throw new Error("not a Moleculer broker with a transport");
|
|
15227
|
+
return broker;
|
|
15228
|
+
}
|
|
15229
|
+
function transitOf(broker) {
|
|
15230
|
+
const transit = wrapping(broker).transit;
|
|
15231
|
+
if (transit === null || transit === void 0) throw new Error("the broker has no transport to reconnect");
|
|
15232
|
+
return transit;
|
|
15233
|
+
}
|
|
15234
|
+
/** The transporter currently installed on the broker (for identity checks). */
|
|
15235
|
+
function currentBrokerTransporter(broker) {
|
|
15236
|
+
return { tx: transitOf(broker).tx };
|
|
15237
|
+
}
|
|
15238
|
+
/** Build the transporter an {@link AgentTransport} describes (nothing is bound or dialled yet). */
|
|
15239
|
+
function buildTransporter(transport) {
|
|
15240
|
+
const tx = transport.kind === "tls" ? transport.transporter : Transporters.resolve(transport.descriptor);
|
|
15241
|
+
if (!isTransporterLike(tx)) throw new Error("the agent transport is not a Moleculer transporter");
|
|
15242
|
+
return { tx };
|
|
15243
|
+
}
|
|
15244
|
+
/**
|
|
15245
|
+
* Whether `pending` is the transporter installed on the broker right now. A reconnect that was
|
|
15246
|
+
* abandoned at its deadline and resumes later must not tear down a newer run's transport.
|
|
15247
|
+
*/
|
|
15248
|
+
function isInstalledTransporter(broker, pending) {
|
|
15249
|
+
return transitOf(broker).tx === pending.tx;
|
|
15250
|
+
}
|
|
15251
|
+
/**
|
|
15252
|
+
* Disconnect the installed transporter and forget every remote node. Forgetting is what makes the
|
|
15253
|
+
* hub's next INFO a NEW connection: `$node.connected` fires again, so the agent's mesh join re-runs
|
|
15254
|
+
* and its settle re-sends the manifest. Without it the hub would still be "available" in the local
|
|
15255
|
+
* registry and nothing would re-announce the node.
|
|
15256
|
+
*/
|
|
15257
|
+
async function disconnectBrokerTransport(broker) {
|
|
15258
|
+
const b = wrapping(broker);
|
|
15259
|
+
const transit = transitOf(broker);
|
|
15260
|
+
const leaving = transit.tx;
|
|
15261
|
+
retired.add(leaving);
|
|
15262
|
+
try {
|
|
15263
|
+
await transit.disconnect();
|
|
15264
|
+
} finally {
|
|
15265
|
+
detachListeners(leaving);
|
|
15266
|
+
for (const node of b.registry.nodes.list({ onlyAvailable: true })) if (node.id !== b.nodeID) b.registry.nodes.disconnected(node.id, false);
|
|
15267
|
+
}
|
|
15268
|
+
}
|
|
15269
|
+
/** Transporters that were disconnected or replaced: their `connect` is a no-op for good. */
|
|
15270
|
+
var retired = /* @__PURE__ */ new WeakSet();
|
|
15271
|
+
/**
|
|
15272
|
+
* The leaving transporter's writer must not keep reporting into the SHARED node catalog: a late
|
|
15273
|
+
* FIN on one of its sockets would call `nodes.disconnected` on the node the NEW transporter just
|
|
15274
|
+
* connected to.
|
|
15275
|
+
*/
|
|
15276
|
+
function detachListeners(tx) {
|
|
15277
|
+
for (const emitter of [tx.writer, tx.reader]) if (isObject(emitter) && isFunction(Reflect.get(emitter, "removeAllListeners"))) Reflect.get(emitter, "removeAllListeners").call(emitter);
|
|
15278
|
+
}
|
|
15279
|
+
/**
|
|
15280
|
+
* One connect at a time per transporter, and none for a retired or replaced one. Moleculer's connect
|
|
15281
|
+
* retry re-runs `tx.connect()` on whatever `transit.tx` is when its timer fires; a second run of
|
|
15282
|
+
* `startTcpServer` overwrites the live reader and writer, leaks the gossip interval and leaves a
|
|
15283
|
+
* listening server behind. A connect that fails is cleaned up before the retry runs.
|
|
15284
|
+
*/
|
|
15285
|
+
function guardConnect(transit, tx) {
|
|
15286
|
+
const original = tx.connect.bind(tx);
|
|
15287
|
+
let inflight = null;
|
|
15288
|
+
tx.connect = (...args) => {
|
|
15289
|
+
if (retired.has(tx) || transit.tx !== tx) return Promise.resolve();
|
|
15290
|
+
if (inflight !== null) return inflight;
|
|
15291
|
+
if (tx.connected === true) return Promise.resolve();
|
|
15292
|
+
const run = original(...args).catch(async (error) => {
|
|
15293
|
+
await Promise.resolve(tx.disconnect()).catch(() => void 0);
|
|
15294
|
+
throw error;
|
|
15295
|
+
}).finally(() => {
|
|
15296
|
+
if (inflight === run) inflight = null;
|
|
15297
|
+
});
|
|
15298
|
+
inflight = run;
|
|
15299
|
+
return run;
|
|
15300
|
+
};
|
|
15301
|
+
}
|
|
15302
|
+
/**
|
|
15303
|
+
* Install `pending` as the broker's transporter: the same wiring Moleculer's `Transit` constructor
|
|
15304
|
+
* does (init + the broker's send/receive middleware wrapping, which carries the mesh join gate).
|
|
15305
|
+
*/
|
|
15306
|
+
function installBrokerTransporter(broker, pending) {
|
|
15307
|
+
const b = wrapping(broker);
|
|
15308
|
+
const transit = transitOf(broker);
|
|
15309
|
+
const tx = pending.tx;
|
|
15310
|
+
retired.add(transit.tx);
|
|
15311
|
+
guardConnect(transit, tx);
|
|
15312
|
+
tx.init(transit, (cmd, packet) => transit.messageHandler(cmd, packet), transit.afterConnect.bind(transit));
|
|
15313
|
+
const send = b.wrapMethod("transporterSend", tx.send, tx);
|
|
15314
|
+
const receive = b.wrapMethod("transporterReceive", tx.receive, tx, { reverse: true });
|
|
15315
|
+
tx.send = send;
|
|
15316
|
+
tx.receive = receive;
|
|
15317
|
+
transit.tx = tx;
|
|
15318
|
+
}
|
|
15319
|
+
/** Connect the installed transporter (the broker's own `start()` path, minus the services). */
|
|
15320
|
+
async function connectBrokerTransport(broker) {
|
|
15321
|
+
await transitOf(broker).connect();
|
|
15322
|
+
}
|
|
15323
|
+
//#endregion
|
|
15181
15324
|
//#region src/kernel/moleculer/addon-deploy-source.ts
|
|
15182
15325
|
function isAddonDeploySource(v) {
|
|
15183
15326
|
if (!v || typeof v !== "object") return false;
|
|
@@ -26885,4 +27028,4 @@ var LifecycleJobEngine = class {
|
|
|
26885
27028
|
*/
|
|
26886
27029
|
var CAP_METHOD_NOT_IMPLEMENTED = "CAP_METHOD_NOT_IMPLEMENTED";
|
|
26887
27030
|
//#endregion
|
|
26888
|
-
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_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, AgentMeshAuthenticator, 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, 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, PARENT_ROUTED_PROVIDER_ADDON_ID, PREVIOUS_LEAF_GRACE_MS, PYTHON_VERSION, 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, buildBinaryPath, buildCapRouters, buildHeapSample, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildNpmChildEnv, buildStorageLocationRegistry, 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, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonPeerBytesFacility, createAddonService, createAgentEventScope, createAgentHttpsRequest, createArrayBufferCensusGate, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCapActionCensus, 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, decideMeshAutoEnforce, deleteModelFromDisk, deriveAgentListenPort, describeHttpsLeaf, describeMeshLeaf, describeProviderKindDrift, describeRss, detectWorkspacePackagesDir, deviceCapResolverLink, deviceOfGetStatus, diffCapActionCensus, diffEventPlane, diffSocketPlane, 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, hubMainRssBudget, installAgentHttps, installManifestNativeDeps, installManifestPythonDeps, installManifestSystemDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcParentLink, isAddonDeploySource, isAllowedAgentDashboardReturnTo, isArrayBufferCensusReport, isArrayOutputSchema, isClusterSecretMismatchError, isCollectionArrayMethod, isContainerBridgeAddress, isCredentialKeyName, isInfraCapability, isLocalOnlyHostname, isMeshAuthMode, isModelDownloaded, isOwnChildNodeId, isPeerEventPacket, isPrivateAddress, isRemoteForbiddenAction, isRemoteForbiddenOnAgent, isSettingsReadUnavailable, isSourceNewer, isolatedBuiltinPhase, issueAgentHttpsLeaf, issueDeviceLeaf, issueMeshLeafForNode, issueMeshLeafFromCsr, leafFingerprintOf, loadAgentHttps, loadDeviceCa, loadMeshCa, loadTlsCert, localEndpointPath, localProviderLink, localSupportedPythonRuntimes, mapSignalsToInferenceHardware, meshErrorType, mintAgentUiUnlockTicket, 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, signalAllRunnerGroups, socketDirectionBytes, socketDirectionMessages, splitPemCertificates, stampCallerAddonId, startEventLoopStallMonitor, startHeapWatch, startRunnerHeapWatch, staticJwtSigningKey, storeMayAnswer, storeUploadedCertificate, strandedMb, stripCamstackDeps, stripForgedIdentity, stripForwardedCaller, subscribePassthrough, systemHostFacts, udsChildLogToWorkerEntry, validateProviderRegistrations, validateUploadedTls, verifyAgentUiUnlockTicket, verifyDeviceLeaf, verifyDeviceSignature, verifyMeshJoinToken, waitUntilReady, writeExtraSans, writePendingRestart, writeTlsMode };
|
|
27031
|
+
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_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, AgentMeshAuthenticator, 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, 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, PARENT_ROUTED_PROVIDER_ADDON_ID, PREVIOUS_LEAF_GRACE_MS, PYTHON_VERSION, 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, 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, connectBrokerTransport, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonPeerBytesFacility, createAddonService, createAgentEventScope, createAgentHttpsRequest, createAgentTransport, createArrayBufferCensusGate, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCapActionCensus, 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, 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, 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, isRemoteForbiddenAction, isRemoteForbiddenOnAgent, isSettingsReadUnavailable, isSourceNewer, isolatedBuiltinPhase, issueAgentHttpsLeaf, issueDeviceLeaf, issueMeshLeafForNode, issueMeshLeafFromCsr, leafFingerprintOf, loadAgentHttps, loadDeviceCa, loadMeshCa, loadTlsCert, localEndpointPath, localProviderLink, localSupportedPythonRuntimes, mapSignalsToInferenceHardware, meshErrorType, mintAgentUiUnlockTicket, 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, signalAllRunnerGroups, socketDirectionBytes, socketDirectionMessages, splitPemCertificates, stampCallerAddonId, startEventLoopStallMonitor, startHeapWatch, startRunnerHeapWatch, staticJwtSigningKey, storeMayAnswer, storeUploadedCertificate, strandedMb, stripCamstackDeps, stripForgedIdentity, stripForwardedCaller, subscribePassthrough, systemHostFacts, udsChildLogToWorkerEntry, validateProviderRegistrations, validateUploadedTls, verifyAgentUiUnlockTicket, verifyDeviceLeaf, verifyDeviceSignature, verifyMeshJoinToken, waitUntilReady, writeExtraSans, writePendingRestart, writeTlsMode };
|
package/dist/kernel/index.d.ts
CHANGED
|
@@ -37,8 +37,10 @@ export type { AddonSettingsView } from "./config-manager.js";
|
|
|
37
37
|
export { DeviceRegistry } from "./device-registry.js";
|
|
38
38
|
export { buildStorageLocationRegistry } from "./storage-location-registry.js";
|
|
39
39
|
export type { StorageLocationRegistry } from "./storage-location-registry.js";
|
|
40
|
-
export { createBroker, deriveAgentListenPort, getBrokerTlsTransporter } from "./moleculer/broker-factory.js";
|
|
41
|
-
export type { BrokerConfig } from "./moleculer/broker-factory.js";
|
|
40
|
+
export { createAgentTransport, createBroker, deriveAgentListenPort, getBrokerTlsTransporter } from "./moleculer/broker-factory.js";
|
|
41
|
+
export type { AgentTransport, BrokerConfig } from "./moleculer/broker-factory.js";
|
|
42
|
+
export { buildTransporter, connectBrokerTransport, currentBrokerTransporter, disconnectBrokerTransport, installBrokerTransporter, isInstalledTransporter } from "./moleculer/broker-transport-swap.js";
|
|
43
|
+
export type { PendingTransporter } from "./moleculer/broker-transport-swap.js";
|
|
42
44
|
export { caFingerprint, caFingerprintCompact, describeMeshLeaf, dropProcessPeer, emitProcessNodeRegistered, onProcessNodeRegistered, getProcessMeshCertificateRegistry, getProcessPeerLeaf, MESH_NODE_CERTIFICATES_COLLECTION, MESH_NODE_CERTIFICATES_COLUMNS, MeshCertificateRegistry, getProcessMeshTlsListenerState, openMeshTlsWhenRevocationsLoaded, RENEWAL_ABANDONED, setProcessMeshTlsListenerState, renewMeshCertificate, revokeMeshCertificate, setProcessMeshCertificateRegistry, createMeshCsrPem, enrollMeshNode, exportMeshPrivateKeyPem, getProcessNodeMeshTransport, setProcessMeshPeerTransportLookup, generateMeshCa, generateMeshKeyPair, getProcessMeshCaState, issueMeshLeafForNode, issueMeshLeafFromCsr, JoinTokenJtiStore, loadMeshCa, MESH_CA_FIELD, MESH_CA_KEY_REF, MESH_CA_SETTINGS_KEY, MeshCaKeeper, MeshCrl, mintMeshJoinToken, processMeshCrl, processJoinTokenJtiStore, requireProcessMeshCa, setProcessMeshTlsEnabler, TlsTcpTransporter, verifyMeshJoinToken, DEFAULT_HUB_TLS_TCP_PORT, MESH_TLS_PORT_HELLO_FIELD } from "./moleculer/mesh-mtls/index.js";
|
|
43
45
|
export type { MeshCertificateRecord, MeshLeafDescription, MeshLog, MeshPeerLeaf, MeshPeers, MeshRegistrations, MeshTlsListenerState, NodeMeshClient, RenewMeshResult, RevokeMeshResult, MeshCaSigner, MeshEnrollResult, MeshPeerTransportLookup, MeshTransport, MeshJoinTokenClaims, MeshTlsMaterial } from "./moleculer/mesh-mtls/index.js";
|
|
44
46
|
export { type AddonDeploySource, isAddonDeploySource } from "./moleculer/addon-deploy-source.js";
|
|
@@ -68,8 +68,34 @@ interface BrokerConfig {
|
|
|
68
68
|
*/
|
|
69
69
|
declare function deriveAgentListenPort(nodeID: string): number;
|
|
70
70
|
declare function createBroker(config: BrokerConfig): ServiceBroker;
|
|
71
|
+
/** What an agent's transport is made of: an mTLS transporter, or the clear TCP descriptor. */
|
|
72
|
+
type AgentTransport = {
|
|
73
|
+
readonly kind: "tls";
|
|
74
|
+
readonly transporter: TlsTcpTransporter;
|
|
75
|
+
} | {
|
|
76
|
+
readonly kind: "tcp";
|
|
77
|
+
readonly descriptor: {
|
|
78
|
+
readonly type: "TCP";
|
|
79
|
+
readonly options: Record<string, unknown>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The transport of an agent broker, from its config. An agent with no hub address dials nobody
|
|
84
|
+
* and stays `unconfigured` until one is set (the agent UI lists the hubs found over mDNS, D839).
|
|
85
|
+
* There is no UDP discovery to fall back on (D843).
|
|
86
|
+
*
|
|
87
|
+
* The reader binds a STABLE port derived from the nodeID (not an OS-ephemeral `port: 0`). See
|
|
88
|
+
* `deriveAgentListenPort` - this is what makes a same-nodeID kill+restart reconnect cleanly:
|
|
89
|
+
* Moleculer never refreshes a known node's address, so the agent must return at the same address
|
|
90
|
+
* it left from.
|
|
91
|
+
*
|
|
92
|
+
* Shared by `createBroker` (the first transport) and the in-place reconnect
|
|
93
|
+
* (`broker-transport-swap.ts`, the next one): one builder, so a reconnect cannot dial differently
|
|
94
|
+
* from a boot.
|
|
95
|
+
*/
|
|
96
|
+
declare function createAgentTransport(config: BrokerConfig): AgentTransport;
|
|
71
97
|
declare function normalizeHubUrl(raw: string, defaultPort: number): string;
|
|
72
98
|
/** The hub's {@link TlsTcpTransporter}, or null when the broker is not mesh-TLS. */
|
|
73
99
|
declare function getBrokerTlsTransporter(broker: ServiceBroker): TlsTcpTransporter | null;
|
|
74
|
-
export { createBroker, deriveAgentListenPort, getBrokerTlsTransporter, normalizeHubUrl };
|
|
75
|
-
export type { BrokerConfig };
|
|
100
|
+
export { createAgentTransport, createBroker, deriveAgentListenPort, getBrokerTlsTransporter, normalizeHubUrl };
|
|
101
|
+
export type { AgentTransport, BrokerConfig };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AgentTransport } from "./broker-factory.js";
|
|
2
|
+
/** The slice of a Moleculer transporter this module drives. */
|
|
3
|
+
interface TransporterLike {
|
|
4
|
+
init(transit: unknown, messageHandler: unknown, afterConnect: unknown): void;
|
|
5
|
+
send: unknown;
|
|
6
|
+
receive: unknown;
|
|
7
|
+
connected?: boolean;
|
|
8
|
+
connect(...args: unknown[]): Promise<unknown>;
|
|
9
|
+
disconnect(): Promise<unknown>;
|
|
10
|
+
/** TCP transporters keep their sockets on these; both are event emitters. */
|
|
11
|
+
reader?: unknown;
|
|
12
|
+
writer?: unknown;
|
|
13
|
+
}
|
|
14
|
+
/** Any Moleculer broker (the d.ts of `ServiceBroker` does not describe what this module drives). */
|
|
15
|
+
export type SwappableBroker = object;
|
|
16
|
+
/** A transporter built for a swap and not yet installed. */
|
|
17
|
+
export interface PendingTransporter {
|
|
18
|
+
readonly tx: TransporterLike;
|
|
19
|
+
}
|
|
20
|
+
/** The transporter currently installed on the broker (for identity checks). */
|
|
21
|
+
export declare function currentBrokerTransporter(broker: SwappableBroker): PendingTransporter;
|
|
22
|
+
/** Build the transporter an {@link AgentTransport} describes (nothing is bound or dialled yet). */
|
|
23
|
+
export declare function buildTransporter(transport: AgentTransport): PendingTransporter;
|
|
24
|
+
/**
|
|
25
|
+
* Whether `pending` is the transporter installed on the broker right now. A reconnect that was
|
|
26
|
+
* abandoned at its deadline and resumes later must not tear down a newer run's transport.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isInstalledTransporter(broker: SwappableBroker, pending: PendingTransporter): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Disconnect the installed transporter and forget every remote node. Forgetting is what makes the
|
|
31
|
+
* hub's next INFO a NEW connection: `$node.connected` fires again, so the agent's mesh join re-runs
|
|
32
|
+
* and its settle re-sends the manifest. Without it the hub would still be "available" in the local
|
|
33
|
+
* registry and nothing would re-announce the node.
|
|
34
|
+
*/
|
|
35
|
+
export declare function disconnectBrokerTransport(broker: SwappableBroker): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Install `pending` as the broker's transporter: the same wiring Moleculer's `Transit` constructor
|
|
38
|
+
* does (init + the broker's send/receive middleware wrapping, which carries the mesh join gate).
|
|
39
|
+
*/
|
|
40
|
+
export declare function installBrokerTransporter(broker: SwappableBroker, pending: PendingTransporter): void;
|
|
41
|
+
/** Connect the installed transporter (the broker's own `start()` path, minus the services). */
|
|
42
|
+
export declare function connectBrokerTransport(broker: SwappableBroker): Promise<void>;
|
|
43
|
+
export {};
|
|
@@ -78,6 +78,16 @@ export declare class MeshCertificateRegistry {
|
|
|
78
78
|
*/
|
|
79
79
|
settleInterruptedRenewals(): Promise<number>;
|
|
80
80
|
/** Set a never-completed renewal leaf aside (not current, NOT on the CRL). */
|
|
81
|
+
/** Fingerprints of renewal leaves whose handover is running right now (this process only). */
|
|
82
|
+
private readonly renewalsInFlight;
|
|
83
|
+
/**
|
|
84
|
+
* A renewal's leaf is "in flight" from signing until the handover ends. While it is, a node seen
|
|
85
|
+
* presenting its OLD leaf is simply not swapped yet: the new leaf is not set aside (that would
|
|
86
|
+
* flap set-aside / reinstate on the node's first connection with it).
|
|
87
|
+
*/
|
|
88
|
+
beginRenewal(fingerprint: string): void;
|
|
89
|
+
endRenewal(fingerprint: string): void;
|
|
90
|
+
private abandonRenewalsNewerThan;
|
|
81
91
|
abandon(fingerprint: string): Promise<boolean>;
|
|
82
92
|
/** Replay every persisted revocation into `crl` (hub boot). Set-aside leaves are not revocations. */
|
|
83
93
|
restoreCrl(crl: MeshCrl): number;
|
|
@@ -28,9 +28,13 @@ export declare function getProcessNodeMeshTransport(nodeId: string): MeshTranspo
|
|
|
28
28
|
export declare function getProcessPeerLeaf(nodeId: string): MeshPeerLeaf | undefined;
|
|
29
29
|
/** Disconnect `nodeId` (closes its mutual-TLS sockets). `0` when none were open. */
|
|
30
30
|
export declare function dropProcessPeer(nodeId: string): number;
|
|
31
|
-
type RegistrationListener = (nodeId: string) => void;
|
|
31
|
+
type RegistrationListener = (nodeId: string, addonIds?: readonly string[]) => void;
|
|
32
32
|
/** Subscribe to "node X finished registering". Returns the unsubscribe. */
|
|
33
33
|
export declare function onProcessNodeRegistered(listener: RegistrationListener): () => void;
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Called by the hub when a node's `registerNode` has been applied. `addonIds` is what that
|
|
36
|
+
* registration carried (a node's own addons and its children's, D3), so a waiter can tell the
|
|
37
|
+
* registration of a node that came back WHOLE from the first one of a node that lost its children.
|
|
38
|
+
*/
|
|
39
|
+
export declare function emitProcessNodeRegistered(nodeId: string, addonIds?: readonly string[]): void;
|
|
36
40
|
export {};
|
|
@@ -53,7 +53,7 @@ export interface MeshPeers {
|
|
|
53
53
|
}
|
|
54
54
|
/** "Node X finished registering" - the hub's registration completion (D3), not a poll. */
|
|
55
55
|
export interface MeshRegistrations {
|
|
56
|
-
subscribe(listener: (nodeId: string) => void): () => void;
|
|
56
|
+
subscribe(listener: (nodeId: string, addonIds?: readonly string[]) => void): () => void;
|
|
57
57
|
}
|
|
58
58
|
export interface MeshLog {
|
|
59
59
|
info(message: string, extras?: {
|
|
@@ -79,6 +79,13 @@ export interface RenewMeshDeps {
|
|
|
79
79
|
/** Registration completions: the node is usable once its manifest has landed. */
|
|
80
80
|
readonly registrations: MeshRegistrations;
|
|
81
81
|
readonly log: MeshLog;
|
|
82
|
+
/**
|
|
83
|
+
* The addon ids the hub holds for the node BEFORE the renewal (its own and its children's). The
|
|
84
|
+
* node is "back" only on a registration that carries all of them again: a registration that has
|
|
85
|
+
* lost its forked children is a node that is online and capless, not a node that came back.
|
|
86
|
+
* Absent: any registration with the new leaf counts.
|
|
87
|
+
*/
|
|
88
|
+
readonly expectedAddons?: (nodeId: string) => readonly string[];
|
|
82
89
|
/** How long to wait for the node to be back AND registered with the new leaf. */
|
|
83
90
|
readonly reconnectTimeoutMs?: number;
|
|
84
91
|
/** Gap between attempts to confirm while the node's capability is not there yet. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/system",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.431",
|
|
4
4
|
"description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
"jose": "^6.2.3",
|
|
502
502
|
"js-yaml": "^4.1.0",
|
|
503
503
|
"jsonwebtoken": "^9.0.0",
|
|
504
|
-
"moleculer": "
|
|
504
|
+
"moleculer": "0.15.0",
|
|
505
505
|
"otplib": "13.4.1",
|
|
506
506
|
"sqlite-vec": "^0.1.9",
|
|
507
507
|
"superjson": "^2.2.0",
|