fix: resolve symlinked argv1 for Control UI asset detection (#14919)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 07b85041dc
Co-authored-by: gumadeiras <116837+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-02-12 14:45:31 -05:00
committed by GitHub
parent bdd0c12329
commit 8d5094e1f4
3 changed files with 126 additions and 3 deletions

View File

@@ -20,11 +20,15 @@ export async function resolveControlUiDistIndexHealth(
opts: {
root?: string;
argv1?: string;
moduleUrl?: string;
} = {},
): Promise<ControlUiDistIndexHealth> {
const indexPath = opts.root
? resolveControlUiDistIndexPathForRoot(opts.root)
: await resolveControlUiDistIndexPath(opts.argv1 ?? process.argv[1]);
: await resolveControlUiDistIndexPath({
argv1: opts.argv1 ?? process.argv[1],
moduleUrl: opts.moduleUrl,
});
return {
indexPath,
exists: Boolean(indexPath && fs.existsSync(indexPath)),
@@ -66,8 +70,11 @@ export function resolveControlUiRepoRoot(
}
export async function resolveControlUiDistIndexPath(
argv1: string | undefined = process.argv[1],
argv1OrOpts?: string | { argv1?: string; moduleUrl?: string },
): Promise<string | null> {
const argv1 =
typeof argv1OrOpts === "string" ? argv1OrOpts : (argv1OrOpts?.argv1 ?? process.argv[1]);
const moduleUrl = typeof argv1OrOpts === "object" ? argv1OrOpts?.moduleUrl : undefined;
if (!argv1) {
return null;
}
@@ -79,7 +86,7 @@ export async function resolveControlUiDistIndexPath(
return path.join(distDir, "control-ui", "index.html");
}
const packageRoot = await resolveOpenClawPackageRoot({ argv1: normalized });
const packageRoot = await resolveOpenClawPackageRoot({ argv1: normalized, moduleUrl });
if (packageRoot) {
return path.join(packageRoot, "dist", "control-ui", "index.html");
}