fix(web): anchor patch agent version regex to mirror server parseVersion

This commit is contained in:
2026-09-15 09:43:56 +00:00
parent 59e7ef63fe
commit 7809419202
+4 -2
View File
@@ -35,15 +35,17 @@ export const SERVER_STATUS: Record<PatchServerStatus, { label: string; variant:
*/
export const MIN_AGENT_VERSION = "1.4.0";
/** Mirrors patchrun.AgentSupportsPatchResults (and its parseVersion) in the server. */
export function agentSupportsPatchResults(version?: string): boolean {
const m = /^v?(\d+)\.(\d+)\.(\d+)(-[^+]+)?/.exec((version ?? "").trim());
const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([^+]*))?(?:\+.*)?$/.exec((version ?? "").trim());
if (!m) return false;
const have = [Number(m[1]), Number(m[2]), Number(m[3])];
const want = MIN_AGENT_VERSION.split(".").map(Number);
for (let i = 0; i < 3; i++) {
if (have[i] !== want[i]) return have[i] > want[i];
}
return !m[4];
const hasPrerelease = !!m[4];
return !hasPrerelease;
}
const DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];