mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
* perf(build): generate isolated plugin assets once
* fix(build): bound isolated plugin asset execution
* test(ui): inherit model picker readiness fix
Apply the existing fixture correction from dd2a7baba6 (#162869). The picker can be visible while its controls still await catalog hydration; assert readiness before interacting.
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
---------
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
34 lines
1,018 B
TypeScript
34 lines
1,018 B
TypeScript
// Keep asset deadlines and child cleanup identical across root and isolated builds.
|
|
import { runManagedCommand } from "./managed-child-process.mts";
|
|
|
|
const PLUGIN_ASSET_HOOK_TIMEOUT_MS = 600_000;
|
|
|
|
export async function runPluginAssetCommand(params: {
|
|
command: string;
|
|
cwd: string;
|
|
pluginId: string;
|
|
phase: "build" | "copy";
|
|
}): Promise<number> {
|
|
try {
|
|
return await runManagedCommand({
|
|
bin: params.command,
|
|
cwd: params.cwd,
|
|
env: process.env,
|
|
shell: true,
|
|
stdio: "inherit",
|
|
timeoutMs: PLUGIN_ASSET_HOOK_TIMEOUT_MS,
|
|
requireProcessTreeExit: process.platform !== "win32",
|
|
});
|
|
} catch (error) {
|
|
if (error && typeof error === "object" && "code" in error && error.code === "ETIMEDOUT") {
|
|
throw Object.assign(
|
|
new Error(
|
|
`Plugin asset ${params.phase} hook timed out after ${PLUGIN_ASSET_HOOK_TIMEOUT_MS}ms: ${params.pluginId}`,
|
|
{ cause: error },
|
|
),
|
|
{ code: "ETIMEDOUT" },
|
|
);
|
|
}
|
|
throw error;
|
|
}
|
|
}
|