wire protocol is generated now instead of being hard coded with versioning for commands.

This commit is contained in:
KingKDot
2026-07-30 12:38:28 -05:00
parent 3f49eb07f7
commit 477b9a5353
27 changed files with 2628 additions and 204 deletions
@@ -36,6 +36,7 @@ import { clearThumbnail } from "../../thumbnails";
import { handleClientCommandRoute } from "./client-command-routes";
import { handleClientGroupRoutes } from "./client-group-routes";
import { decryptClientLogBlob, extractSecureLogBlobs } from "../client-log-crypto";
import { getCommandCompatibilityCatalog } from "../../command-compatibility";
type RequestIpProvider = {
requestIP: (req: Request) => { address?: string } | null | undefined;
@@ -68,7 +69,15 @@ function mergeLiveClientState(result: any) {
items: (result.items || []).map((item: any) => {
const live = clientManager.getClient(item.id);
return live
? { ...item, online: true, lastSeen: live.lastSeen, pingMs: live.pingMs ?? item.pingMs }
? {
...item,
online: true,
lastSeen: live.lastSeen,
pingMs: live.pingMs ?? item.pingMs,
protocolVersion: live.protocolVersion ?? 1,
commandVersions: live.commandVersions,
commandCompatibility: getCommandCompatibilityCatalog(live),
}
: item;
}),
};
@@ -14,6 +14,8 @@ import { getConfig } from "../../config";
import { logger } from "../../logger";
import { metrics } from "../../metrics";
import { decodeMessage, encodeMessage, type WireMessage, type Hello, type Ping } from "../../protocol";
import { WIRE_PROTOCOL_VERSION } from "../../generated/wire-contract";
import { getNegotiatedCommandVersions } from "../../command-compatibility";
import * as sessionManager from "../../sessions/sessionManager";
import type { SocketData } from "../../sessions/types";
import type { ClientInfo } from "../../types";
@@ -705,6 +707,8 @@ export async function handleWebSocketMessage(
encodeMessage({
type: "hello_ack",
id: resolvedId,
protocolVersion: WIRE_PROTOCOL_VERSION,
commandVersions: getNegotiatedCommandVersions(infoObj),
notification: {
keywords: notificationConfig.keywords || [],
minIntervalMs: notificationConfig.minIntervalMs || 8000,