agenticmail 0.3.15 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +45 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4380,6 +4380,11 @@ async function registerWithOpenClaw(config) {
|
|
|
4380
4380
|
return;
|
|
4381
4381
|
}
|
|
4382
4382
|
const pluginDir = resolveOpenClawPluginDir();
|
|
4383
|
+
if (!pluginDir) {
|
|
4384
|
+
info2(`Install the OpenClaw plugin first: ${c2.green("npm i @agenticmail/openclaw")}`);
|
|
4385
|
+
info2(`Then run: ${c2.green("agenticmail openclaw")}`);
|
|
4386
|
+
return;
|
|
4387
|
+
}
|
|
4383
4388
|
let agentApiKey;
|
|
4384
4389
|
try {
|
|
4385
4390
|
const base = `http://${config.api.host}:${config.api.port}`;
|
|
@@ -4745,25 +4750,58 @@ async function setupDomain(config) {
|
|
|
4745
4750
|
}
|
|
4746
4751
|
}
|
|
4747
4752
|
function resolveOpenClawPluginDir() {
|
|
4753
|
+
const pluginMarker = "openclaw.plugin.json";
|
|
4754
|
+
const pkgPath = join("node_modules", "@agenticmail", "openclaw");
|
|
4748
4755
|
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
4749
4756
|
let dir = thisDir;
|
|
4750
4757
|
for (let i = 0; i < 10; i++) {
|
|
4751
|
-
const candidate = join(dir,
|
|
4752
|
-
if (existsSync2(join(candidate,
|
|
4758
|
+
const candidate = join(dir, pkgPath);
|
|
4759
|
+
if (existsSync2(join(candidate, pluginMarker))) return realpathSync(candidate);
|
|
4753
4760
|
const parent = dirname(dir);
|
|
4754
4761
|
if (parent === dir) break;
|
|
4755
4762
|
dir = parent;
|
|
4756
4763
|
}
|
|
4757
|
-
const
|
|
4764
|
+
const monorepo = [
|
|
4758
4765
|
join(thisDir, "..", "..", "packages", "openclaw"),
|
|
4759
4766
|
join(thisDir, "..", "packages", "openclaw")
|
|
4760
4767
|
];
|
|
4761
|
-
for (const p of
|
|
4762
|
-
if (existsSync2(join(p,
|
|
4768
|
+
for (const p of monorepo) {
|
|
4769
|
+
if (existsSync2(join(p, pluginMarker))) return p;
|
|
4770
|
+
}
|
|
4771
|
+
const userDirs = [
|
|
4772
|
+
join(process.cwd(), pkgPath),
|
|
4773
|
+
join(homedir(), pkgPath)
|
|
4774
|
+
];
|
|
4775
|
+
for (const p of userDirs) {
|
|
4776
|
+
if (existsSync2(join(p, pluginMarker))) {
|
|
4777
|
+
try {
|
|
4778
|
+
return realpathSync(p);
|
|
4779
|
+
} catch {
|
|
4780
|
+
return p;
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
try {
|
|
4785
|
+
const cp = createRequire(import.meta.url)("node:child_process");
|
|
4786
|
+
const prefix = cp.execSync("npm prefix -g", { timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] }).toString().trim();
|
|
4787
|
+
const globalCandidates = [
|
|
4788
|
+
join(prefix, "lib", pkgPath),
|
|
4789
|
+
join(prefix, pkgPath)
|
|
4790
|
+
];
|
|
4791
|
+
for (const p of globalCandidates) {
|
|
4792
|
+
if (existsSync2(join(p, pluginMarker))) {
|
|
4793
|
+
try {
|
|
4794
|
+
return realpathSync(p);
|
|
4795
|
+
} catch {
|
|
4796
|
+
return p;
|
|
4797
|
+
}
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
} catch {
|
|
4763
4801
|
}
|
|
4764
4802
|
try {
|
|
4765
|
-
const
|
|
4766
|
-
const resolved =
|
|
4803
|
+
const req = createRequire(import.meta.url);
|
|
4804
|
+
const resolved = req.resolve("@agenticmail/openclaw/openclaw.plugin.json");
|
|
4767
4805
|
return dirname(resolved);
|
|
4768
4806
|
} catch {
|
|
4769
4807
|
}
|