mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:40:44 +00:00
fix: stabilize native Windows onboarding
This commit is contained in:
@@ -60,6 +60,9 @@ Docs: https://docs.openclaw.ai
|
||||
|
||||
### Fixes
|
||||
|
||||
- Windows/native: keep CLI startup and bundled provider plugin loading off
|
||||
Windows ESM raw-path failure paths, fixing native onboarding/install smoke on
|
||||
Node 24. Thanks @steipete.
|
||||
- Providers/Google: transcode Gemini TTS PCM to Opus for voice-note targets so
|
||||
WhatsApp and other native voice-note replies can play as voice messages.
|
||||
- Plugins/runtime deps: reuse existing external bundled-plugin stage roots when
|
||||
|
||||
@@ -72,4 +72,20 @@ describe("buildCliRespawnPlan", () => {
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("does not respawn on Windows", () => {
|
||||
expect(
|
||||
buildCliRespawnPlan({
|
||||
argv: [
|
||||
"node",
|
||||
"C:\\Users\\alice\\AppData\\Roaming\\npm\\node_modules\\openclaw\\openclaw.mjs",
|
||||
"onboard",
|
||||
],
|
||||
env: {},
|
||||
execArgv: [],
|
||||
autoNodeExtraCaCerts: "/etc/ssl/certs/ca-certificates.crt",
|
||||
platform: "win32",
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -28,17 +28,23 @@ export function buildCliRespawnPlan(
|
||||
execArgv?: string[];
|
||||
execPath?: string;
|
||||
autoNodeExtraCaCerts?: string | undefined;
|
||||
platform?: NodeJS.Platform;
|
||||
} = {},
|
||||
): { argv: string[]; env: NodeJS.ProcessEnv } | null {
|
||||
const argv = params.argv ?? process.argv;
|
||||
const env = params.env ?? process.env;
|
||||
const execArgv = params.execArgv ?? process.execArgv;
|
||||
const execPath = params.execPath ?? process.execPath;
|
||||
const platform = params.platform ?? process.platform;
|
||||
|
||||
if (shouldSkipRespawnForArgv(argv) || isTruthyEnvValue(env.OPENCLAW_NO_RESPAWN)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (platform === "win32") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const childEnv: NodeJS.ProcessEnv = { ...env };
|
||||
const childExecArgv = [...execArgv];
|
||||
let needsRespawn = false;
|
||||
|
||||
@@ -28,7 +28,7 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("bundled plugin public surface loader", () => {
|
||||
it("uses native Jiti import for Windows dist public artifact loads", async () => {
|
||||
it("uses transpiled Jiti import for Windows dist public artifact loads", async () => {
|
||||
const createJiti = vi.fn(() => vi.fn(() => ({ marker: "windows-dist-ok" })));
|
||||
vi.doMock("jiti", () => ({
|
||||
createJiti,
|
||||
@@ -56,7 +56,7 @@ describe("bundled plugin public surface loader", () => {
|
||||
expect(createJiti).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
expect.objectContaining({
|
||||
tryNative: true,
|
||||
tryNative: false,
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
|
||||
@@ -870,7 +870,7 @@ describe("plugin sdk alias helpers", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("prefers native Jiti loads on Windows for built JavaScript entries", () => {
|
||||
it("disables native Jiti loads on Windows for built JavaScript entries", () => {
|
||||
const originalPlatform = process.platform;
|
||||
Object.defineProperty(process, "platform", {
|
||||
configurable: true,
|
||||
@@ -878,9 +878,9 @@ describe("plugin sdk alias helpers", () => {
|
||||
});
|
||||
|
||||
try {
|
||||
expect(shouldPreferNativeJiti("/repo/dist/plugins/runtime/index.js")).toBe(true);
|
||||
expect(shouldPreferNativeJiti("/repo/dist/plugins/runtime/index.js")).toBe(false);
|
||||
expect(shouldPreferNativeJiti(`/repo/${bundledDistPluginFile("browser", "index.js")}`)).toBe(
|
||||
true,
|
||||
false,
|
||||
);
|
||||
} finally {
|
||||
Object.defineProperty(process, "platform", {
|
||||
@@ -890,7 +890,7 @@ describe("plugin sdk alias helpers", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps plugin loader dist shortcuts native on Windows", () => {
|
||||
it("keeps plugin loader dist shortcuts on transpiled Jiti on Windows", () => {
|
||||
const originalPlatform = process.platform;
|
||||
Object.defineProperty(process, "platform", {
|
||||
configurable: true,
|
||||
@@ -902,7 +902,7 @@ describe("plugin sdk alias helpers", () => {
|
||||
resolvePluginLoaderJitiTryNative(`/repo/${bundledDistPluginFile("browser", "index.js")}`, {
|
||||
preferBuiltDist: true,
|
||||
}),
|
||||
).toBe(true);
|
||||
).toBe(false);
|
||||
expect(
|
||||
resolvePluginLoaderJitiTryNative(`/repo/${bundledDistPluginFile("browser", "helper.ts")}`, {
|
||||
preferBuiltDist: true,
|
||||
|
||||
@@ -695,7 +695,7 @@ export function buildPluginLoaderJitiOptions(aliasMap: Record<string, string>) {
|
||||
|
||||
function supportsNativeJitiRuntime(): boolean {
|
||||
const versions = process.versions as { bun?: string };
|
||||
return typeof versions.bun !== "string";
|
||||
return typeof versions.bun !== "string" && process.platform !== "win32";
|
||||
}
|
||||
|
||||
function isBundledPluginDistModulePath(modulePath: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user