feat(device-plane): supervise pinned edge channels in core

This commit is contained in:
Codex
2026-08-11 20:14:55 +03:00
parent 6461e7fca8
commit be964eccb7
18 changed files with 1217 additions and 70 deletions
@@ -224,6 +224,11 @@ export function createDeviceGatewayCoreChannelClient(options = {}) {
if (envelope.messageKind !== "channel.hello") {
throw new Error("device_gateway_core_channel_hello_required");
}
if (
envelope.channelGeneration !== connection.registration.channelGeneration
) {
throw new Error("device_gateway_core_channel_generation_mismatch");
}
if (
envelope.payload?.status !== "ready"
|| envelope.payload?.transport !== "http2-mtls"
@@ -233,7 +238,7 @@ export function createDeviceGatewayCoreChannelClient(options = {}) {
) {
throw new Error("device_gateway_core_channel_hello_invalid");
}
connection.channelGeneration = envelope.channelGeneration;
connection.channelGeneration = connection.registration.channelGeneration;
send(connection, "channel.accepted", {
status: "accepted",
coreIdentity: config.coreIdentity,
@@ -549,6 +554,10 @@ function normalizeRegistration(value) {
value.edgeRegistrationId,
"edge_registration_id",
),
channelGeneration: normalizeRef(
value.channelGeneration,
"channel_generation",
),
endpoint: endpoint.toString(),
servername,
certificateIdentities: normalizeCertificateIdentities(