fix(core): correct WAAPI rediscovery seek baselines and preview reuse invalidation

This commit is contained in:
func25
2026-05-25 17:51:47 +07:00
parent 68fce93a49
commit e10ec358f8
7 changed files with 287 additions and 16 deletions
+16
View File
@@ -1,3 +1,4 @@
import { createHash } from "node:crypto";
import { existsSync, readFileSync } from "node:fs";
import { resolve, dirname } from "node:path";
@@ -16,6 +17,21 @@ export async function loadRuntimeSource(): Promise<string | null> {
return (await buildFromSource()) ?? (await getInlinedRuntime()) ?? readPrebuiltArtifact();
}
export async function loadRuntimeSourceSignature(): Promise<string | null> {
const source = await loadRuntimeSource();
if (!source) return null;
return createHash("sha256").update(source).digest("hex");
}
export function hashSignatureParts(parts: Array<string | null | undefined>): string {
const hash = createHash("sha256");
for (const part of parts) {
hash.update(part ?? "");
hash.update("\n--hf-signature-part--\n");
}
return hash.digest("hex");
}
// ── Strategy 1: live build from source (dev only) ──────────────────────────
const ENTRY_TS = resolve(__dirname, "..", "..", "..", "core", "src", "runtime", "entry.ts");