fix(codex): support packaged lazycodex installs

This commit is contained in:
YeonGyu-Kim
2026-05-31 14:39:03 +09:00
parent 247bba39e5
commit d0d1735e6b
15 changed files with 335 additions and 19 deletions
@@ -40,7 +40,7 @@ function resolveExternalMcpPackageRoot(runtimePath, sourceRoot) {
if (!isPathInside(runtimePath, packagesRoot)) return undefined;
let packageRoot = dirname(runtimePath);
while (packageRoot !== packagesRoot) {
if (existsSync(join(packageRoot, "package.json")) && isPathInside(runtimePath, join(packageRoot, "dist"))) {
if (isPathInside(runtimePath, join(packageRoot, "dist")) && isRuntimePackageRoot(packageRoot)) {
return packageRoot;
}
const parent = dirname(packageRoot);
@@ -50,6 +50,10 @@ function resolveExternalMcpPackageRoot(runtimePath, sourceRoot) {
return undefined;
}
function isRuntimePackageRoot(packageRoot) {
return existsSync(join(packageRoot, "package.json")) || existsSync(join(packageRoot, "dist"));
}
function findPackagesRoot(path) {
let current = resolve(path);
for (let index = 0; index < 8; index++) {