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>
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
import { join, resolve } from "node:path";
|
|
import { tmpdir } from "node:os";
|
|
import {
|
|
manifests,
|
|
writeSources,
|
|
renderSourceButton,
|
|
} from "./source-examples.mjs";
|
|
test("source drawer contains exact allowlisted example files and honors deployment base", () => {
|
|
const root = resolve(import.meta.dirname, "../.."),
|
|
out = mkdtempSync(join(tmpdir(), "ow-doc-source-"));
|
|
try {
|
|
writeSources(root, out);
|
|
for (const [track, paths] of Object.entries(manifests)) {
|
|
const data = JSON.parse(
|
|
readFileSync(join(out, "examples", track + ".json"), "utf8"),
|
|
);
|
|
assert.deepEqual(
|
|
data.files.map((f) => f.path),
|
|
paths,
|
|
);
|
|
for (const file of data.files) {
|
|
assert.ok(
|
|
!/(^|\/)(\.state|\.env|node_modules|bin)(\/|$)/.test(file.path),
|
|
);
|
|
assert.equal(
|
|
file.content,
|
|
readFileSync(
|
|
join(root, "harness/examples/quickstart", file.path),
|
|
"utf8",
|
|
),
|
|
);
|
|
}
|
|
for (const base of ["/docs/sdk", "/docs/sdk/0.1.0-beta.1"])
|
|
assert.ok(
|
|
renderSourceButton(`<!-- sdk-source: ${track} -->`, base).includes(
|
|
`${base}/examples/${track}.json`,
|
|
),
|
|
);
|
|
}
|
|
} finally {
|
|
rmSync(out, { recursive: true, force: true });
|
|
}
|
|
});
|