fix(plugins): share one cached handoff runtime and use version 0.3.2

This commit is contained in:
kartik-mem0
2026-09-10 18:52:09 +05:30
parent 0fb924051f
commit 19a71bbacf
97 changed files with 946 additions and 11890 deletions
@@ -1,12 +1,19 @@
import { copyFile, mkdir, readFile } from "node:fs/promises";
import { createHash } from "node:crypto";
import { copyFile, mkdir, readFile, rm } from "node:fs/promises";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
export async function packageHandoff(output = "dist") {
const files = JSON.parse(await readFile(new URL("./handoff-runtime.json", import.meta.url), "utf8"));
const manifest = JSON.parse(await readFile(new URL("./handoff-runtime.json", import.meta.url), "utf8"));
await mkdir(output, { recursive: true });
for (const name of files) {
await copyFile(new URL(`../python/${name}`, import.meta.url), resolve(output, name));
for (const [name, digest] of Object.entries(manifest.files)) {
const bytes = await readFile(new URL(`../python/${name}`, import.meta.url));
if (createHash("sha256").update(bytes).digest("hex") !== digest) throw new Error(`Update the shared handoff runtime pin after changing ${name}`);
}
for (const name of Object.keys(manifest.files)) await rm(resolve(output, name), { force: true });
for (const name of manifest.artifacts) {
const source = name.endsWith(".py") ? `../python/${name}` : `./${name}`;
await copyFile(new URL(source, import.meta.url), resolve(output, name));
}
}