mirror of
https://github.com/andrewyng/openworker.git
synced 2026-11-20 20:37:44 +00:00
Allow developers to easily build AI apps without worrying about the harness part. Bundles the Rust agent runtime as a SDK (Rust and TypeScript) for building desktop and web applications. Applications can manage a local harness or connect to an authenticated harness service on k8s with separately scaled workers and sandbox execution. The implementation is primarily contained in harness/, with deployment tooling in deploy/, Markdown guides in docs/harness/guides/, and the static documentation site in docs-site/. It does not replace the existing Python harness or migrate OpenWorker Desktop. Co-authored-by: Devika Verma <devikaverma11@gmail.com>
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
import { spawnSync } from "node:child_process";
|
|
import { existsSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
const runtime = resolve(
|
|
"bin",
|
|
process.platform === "win32"
|
|
? "openworker-harness.exe"
|
|
: "openworker-harness",
|
|
);
|
|
if (!existsSync(runtime))
|
|
throw new Error(
|
|
"Run npm run runtime once before bundling a development app.",
|
|
);
|
|
const args = [
|
|
resolve("node_modules/electron-builder/cli.js"),
|
|
"--dir",
|
|
"--publish",
|
|
"never",
|
|
`-c.directories.output=${process.argv[2] ?? "release-dev"}`,
|
|
];
|
|
if (!/^release-[a-z0-9-]+$/.test(process.argv[2] ?? "release-dev"))
|
|
throw new Error(
|
|
"Use a release-<name> directory inside Arcade for a development build.",
|
|
);
|
|
if (process.platform === "darwin")
|
|
args.push("-c.mac.identity=-", "-c.mac.notarize=false");
|
|
if(process.platform === "win32") {
|
|
const arch=process.env.ARCADE_TARGET_ARCH??process.arch;
|
|
if(!["x64","arm64"].includes(arch))throw Error("Choose x64 or arm64 for the development app");
|
|
args.push("--win",`--${arch}`,"-c.win.signAndEditExecutable=false");
|
|
}
|
|
const buildEnv = { ...process.env, CSC_IDENTITY_AUTO_DISCOVERY: "false" };
|
|
for (const key of [
|
|
"CSC_LINK",
|
|
"WIN_CSC_LINK",
|
|
"CSC_KEY_PASSWORD",
|
|
"WIN_CSC_KEY_PASSWORD",
|
|
])
|
|
delete buildEnv[key];
|
|
const result = spawnSync(process.execPath, args, {
|
|
stdio: "inherit",
|
|
env: buildEnv,
|
|
});
|
|
if (result.error) throw result.error;
|
|
process.exit(result.status ?? 1);
|