mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 17:41:37 +00:00
* feat(mxc): add Windows MXC sandbox backend Add the official MXC sandbox plugin package with Windows ProcessContainer execution, plugin-owned MXC SDK dependency packaging, host-backed filesystem bridge support, and configured MXC policy file loading via mxcPolicyPaths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(mxc): preserve Windows binary override paths * fix: remove stray sandbox barrel export Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9ea19539-b8ca-44fb-93bd-b8496e3deb2c * fix(mxc): address sandbox review feedback Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * fix(mxc): satisfy test type checks Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * fix(mxc): clarify protected skill enforcement Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * test(mxc): align fail-closed expectations Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * fix(mxc): satisfy extension lint Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * fix(plugin-sdk): narrow fs-safe remove surface Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * fix(mxc): repair rebased CI failures * fix(scripts): declare shrinkwrap override normalizer --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Gio Della-Libera <235387111+giodl73-repo@users.noreply.github.com> Co-authored-by: Dallin Romney <dallinromney@gmail.com>
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import fs from "node:fs";
|
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import path from "node:path";
|
|
import { pathToFileURL } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
import { resolveMxcLauncherPath } from "../src/plugin-root.js";
|
|
|
|
describe("resolveMxcLauncherPath", () => {
|
|
it("throws when called from outside any plugin tree", () => {
|
|
const outside = pathToFileURL(path.resolve("README.md")).href;
|
|
expect(() => resolveMxcLauncherPath(outside)).toThrow(/cannot locate plugin root/);
|
|
});
|
|
|
|
it("returns the src .mjs in dev layout", () => {
|
|
const launcher = resolveMxcLauncherPath();
|
|
expect(launcher).toMatch(/mxc-spawn-launcher\.mjs$/);
|
|
expect(fs.existsSync(launcher)).toBe(true);
|
|
});
|
|
|
|
it("returns the package dist launcher in packed plugin layout", () => {
|
|
const root = mkdtempSync(path.join(tmpdir(), "mxc-packed-plugin-"));
|
|
try {
|
|
writeFileSync(path.join(root, "package.json"), "{}");
|
|
writeFileSync(path.join(root, "openclaw.plugin.json"), "{}");
|
|
const distDir = path.join(root, "dist");
|
|
fs.mkdirSync(distDir, { recursive: true });
|
|
const launcher = path.join(distDir, "mxc-spawn-launcher.mjs");
|
|
writeFileSync(launcher, "export {};\n");
|
|
const moduleUrl = pathToFileURL(path.join(distDir, "index.js")).href;
|
|
|
|
expect(resolveMxcLauncherPath(moduleUrl)).toBe(launcher);
|
|
} finally {
|
|
rmSync(root, { recursive: true, force: true });
|
|
}
|
|
});
|
|
});
|