import {
  compareVersions
} from "./chunk-HL4DB7TO.js";
import "./chunk-PZ5AY32C.js";

// src/legacy-hook-compat.ts
var FIRST_PUBLISHED_RUNTIME_WITHOUT_AGENT_HEARTBEAT = [2026, 1, 29];
var OPENCLAW_VERSION_PREFIX = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?/;
function parseOpenClawVersion(value) {
  if (typeof value !== "string") return null;
  const match = value.trim().match(OPENCLAW_VERSION_PREFIX);
  if (!match) return null;
  return {
    triple: [
      Number.parseInt(match[1], 10),
      Number.parseInt(match[2], 10),
      Number.parseInt(match[3], 10)
    ],
    prerelease: typeof match[4] === "string" && match[4].length > 0
  };
}
function shouldRegisterTypedAgentHeartbeat(runtimeVersion) {
  const parsed = parseOpenClawVersion(runtimeVersion);
  if (!parsed) return false;
  const comparison = compareVersions(
    parsed.triple,
    FIRST_PUBLISHED_RUNTIME_WITHOUT_AGENT_HEARTBEAT
  );
  if (comparison < 0) return true;
  if (comparison > 0) return false;
  return parsed.prerelease;
}
export {
  shouldRegisterTypedAgentHeartbeat
};
//# sourceMappingURL=legacy-hook-compat.js.map