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>
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
// Local QA only. Deterministic response source, never a live-model substitute.
|
|
import { writeFile, mkdir } from "node:fs/promises";
|
|
import { resolve } from "node:path";
|
|
import { modelFixture, makePdf } from "../test/fixtures.mjs";
|
|
import { createApplication } from "../web/server.mjs";
|
|
const fixture = await modelFixture();
|
|
Object.assign(process.env, {
|
|
OPENWORKER_MODEL: "fixture",
|
|
OPENWORKER_MODEL_URL: fixture.url,
|
|
OPENAI_API_KEY: "fixture-only",
|
|
});
|
|
const application = await createApplication({
|
|
stateDir: resolve(".state/preview"),
|
|
});
|
|
await mkdir(".state", { recursive: true });
|
|
await writeFile(".state/sample.pdf", makePdf("Orbit revenue is 42 credits."));
|
|
application.server.listen(4352, "127.0.0.1", () =>
|
|
console.log("Fixture preview: http://127.0.0.1:4352/"),
|
|
);
|
|
// Electron receives this exact model endpoint via a local env file; no real secrets.
|
|
await writeFile(
|
|
".state/fixture.env",
|
|
`OPENWORKER_MODEL=fixture\nOPENWORKER_MODEL_URL=${fixture.url}\nOPENAI_API_KEY=fixture-only\n`,
|
|
);
|
|
for (const sig of ["SIGINT", "SIGTERM"])
|
|
process.once(sig, async () => {
|
|
await application.close();
|
|
await fixture.close();
|
|
process.exit(0);
|
|
});
|