refactor(core): migrate to Bun and converge acquisition policies and Agent boundaries
This commit is contained in:
1 parent
3f1c6d02f6
commit
27c0f27434
268 files changed
+7468
-7852
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import { cp, mkdir, readdir, readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
process.chdir(root);
|
||||
const native = Bun.spawnSync(["sh", "scripts/build-sandbox.sh"], { stdout: "inherit", stderr: "inherit" });
|
||||
if (native.exitCode !== 0) process.exit(native.exitCode);
|
||||
await mkdir("dist", { recursive: true });
|
||||
const migrations = (await readdir("packages/db/migrations")).filter((name) => name.endsWith(".ts")).sort();
|
||||
const result = await Bun.build({
|
||||
entrypoints: ["apps/server/src/main.ts"],
|
||||
compile: { outfile: "dist/umt-server", autoloadDotenv: false, autoloadBunfig: false },
|
||||
target: "bun",
|
||||
plugins: [
|
||||
{
|
||||
name: "embedded-migrations",
|
||||
setup(build) {
|
||||
build.onLoad({ filter: /packages\/db\/src\/migrator\.ts$/ }, async ({ path }) => {
|
||||
const source = await readFile(path, "utf8");
|
||||
const imports = migrations
|
||||
.map(
|
||||
(name, i) =>
|
||||
`import * as migration${i} from ${JSON.stringify(resolve(root, "packages/db/migrations", name))};`,
|
||||
)
|
||||
.join("\n");
|
||||
const entries = migrations
|
||||
.map((name, i) => `${JSON.stringify(name.slice(0, -3))}: migration${i}`)
|
||||
.join(",\n");
|
||||
return {
|
||||
contents: `${imports}\n${source.replace("new FileMigrationProvider({ fs, path, migrationFolder: MIGRATIONS_DIR })", `{ getMigrations: async () => ({${entries}}) }`)}`,
|
||||
loader: "ts",
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
if (!result.success) {
|
||||
for (const log of result.logs) console.error(log);
|
||||
process.exit(1);
|
||||
}
|
||||
await cp("packages/agent/skills", "dist/skills", { recursive: true, force: true });
|
||||
console.log("Built dist/umt-server, dist/sandbox-policy.node and dist/skills");
|
||||
Reference in new issue
Block a user