export const PROXY_SOCKET_WORKER_ENV = "NEUROLINK_PROXY_SOCKET_WORKER";
export const PROXY_ROLLING_SUPERVISOR_ENV = "NEUROLINK_PROXY_ROLLING_SUPERVISOR";
export function isProxyWorkerControlMessage(value) {
    if (!value || typeof value !== "object") {
        return false;
    }
    const message = value;
    if (!Number.isSafeInteger(message.generation) ||
        Number(message.generation) <= 0) {
        return false;
    }
    if (message.type === "proxy-worker:socket-commit" ||
        message.type === "proxy-worker:socket-cancel") {
        return typeof message.socketId === "string" && message.socketId.length > 0;
    }
    return (message.type === "proxy-worker:drain" ||
        message.type === "proxy-worker:activate" ||
        message.type === "proxy-worker:shutdown");
}
export function isProxyWorkerStatusMessage(value) {
    if (!value || typeof value !== "object") {
        return false;
    }
    const message = value;
    if (!Number.isSafeInteger(message.generation) ||
        Number(message.generation) <= 0 ||
        !Number.isSafeInteger(message.pid) ||
        Number(message.pid) <= 0) {
        return false;
    }
    if (message.type === "proxy-worker:ready") {
        return typeof message.version === "string" && message.version.length > 0;
    }
    if (message.type === "proxy-worker:activated" ||
        message.type === "proxy-worker:drained") {
        return true;
    }
    if (message.type === "proxy-worker:socket-accepted") {
        return typeof message.socketId === "string" && message.socketId.length > 0;
    }
    return (message.type === "proxy-worker:fatal" && typeof message.message === "string");
}
//# sourceMappingURL=rollingWorkerProtocol.js.map