export function isContextRecordV1(record) {
    if (typeof record !== "object" || record === null) {
        return false;
    }
    const r = record;
    return (!("version" in r) &&
        "charsPerToken" in r &&
        "l1Turns" in r &&
        "l2Turns" in r &&
        "l3Turns" in r);
}
export function isContextRecordV2(record) {
    if (typeof record !== "object" || record === null) {
        return false;
    }
    const r = record;
    return "version" in r && r.version === 2;
}
export function detectVersion(record) {
    if (typeof record !== "object" || record === null) {
        return 0; // Invalid record
    }
    const r = record;
    if ("version" in r && typeof r.version === "number") {
        return r.version;
    }
    // No version field = V1
    if (isContextRecordV1(record)) {
        return 1;
    }
    return 0; // Unknown format
}
//# sourceMappingURL=types.js.map