agenticmail 0.3.18 → 0.3.20
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 +50 -47
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -4369,12 +4369,55 @@ function printSummary(result, exitAfter) {
|
|
|
4369
4369
|
process.exit(0);
|
|
4370
4370
|
}
|
|
4371
4371
|
}
|
|
4372
|
+
async function restartOpenClawGateway() {
|
|
4373
|
+
let hasOpenClawCli = false;
|
|
4374
|
+
try {
|
|
4375
|
+
const { execSync } = await import("child_process");
|
|
4376
|
+
execSync("which openclaw", { stdio: "ignore" });
|
|
4377
|
+
hasOpenClawCli = true;
|
|
4378
|
+
} catch {
|
|
4379
|
+
}
|
|
4380
|
+
if (hasOpenClawCli) {
|
|
4381
|
+
log2("");
|
|
4382
|
+
const restartSpinner = new Spinner("gateway", "Restarting OpenClaw gateway...");
|
|
4383
|
+
restartSpinner.start();
|
|
4384
|
+
try {
|
|
4385
|
+
const { execSync } = await import("child_process");
|
|
4386
|
+
execSync("openclaw gateway restart", { stdio: "pipe", timeout: 3e4 });
|
|
4387
|
+
restartSpinner.succeed("OpenClaw gateway restarted");
|
|
4388
|
+
} catch {
|
|
4389
|
+
restartSpinner.fail("Gateway restart failed");
|
|
4390
|
+
log2(` Run manually: ${c2.green("openclaw gateway restart")}`);
|
|
4391
|
+
}
|
|
4392
|
+
} else {
|
|
4393
|
+
info2(`Restart OpenClaw to pick up the changes: ${c2.green("openclaw gateway restart")}`);
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4372
4396
|
async function registerWithOpenClaw(config) {
|
|
4373
4397
|
const openclawConfigPath = findOpenClawConfig();
|
|
4374
4398
|
if (!openclawConfigPath) return;
|
|
4375
4399
|
try {
|
|
4376
4400
|
const raw = readFileSync2(openclawConfigPath, "utf-8");
|
|
4377
4401
|
const existing = JSON5.parse(raw);
|
|
4402
|
+
const installSpinner = new Spinner("plugin", "Updating @agenticmail/openclaw...");
|
|
4403
|
+
installSpinner.start();
|
|
4404
|
+
try {
|
|
4405
|
+
const { execSync } = await import("child_process");
|
|
4406
|
+
execSync("npm i @agenticmail/openclaw@latest", {
|
|
4407
|
+
cwd: homedir(),
|
|
4408
|
+
timeout: 6e4,
|
|
4409
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
4410
|
+
});
|
|
4411
|
+
installSpinner.succeed("Updated @agenticmail/openclaw");
|
|
4412
|
+
} catch (err) {
|
|
4413
|
+
installSpinner.fail(`Could not update: ${err.message}`);
|
|
4414
|
+
}
|
|
4415
|
+
let pluginDir = resolveOpenClawPluginDir();
|
|
4416
|
+
if (!pluginDir) {
|
|
4417
|
+
fail2("Could not find @agenticmail/openclaw after install");
|
|
4418
|
+
info2(`Install manually: ${c2.green("npm i @agenticmail/openclaw@latest")}`);
|
|
4419
|
+
return;
|
|
4420
|
+
}
|
|
4378
4421
|
const existingEntry = existing.plugins?.entries?.agenticmail;
|
|
4379
4422
|
if (existingEntry?.config?.apiKey) {
|
|
4380
4423
|
const existingPaths = existing.plugins?.load?.paths ?? [];
|
|
@@ -4383,32 +4426,10 @@ async function registerWithOpenClaw(config) {
|
|
|
4383
4426
|
);
|
|
4384
4427
|
if (pluginFound) {
|
|
4385
4428
|
ok2(`OpenClaw integration already configured`);
|
|
4429
|
+
await restartOpenClawGateway();
|
|
4386
4430
|
return;
|
|
4387
4431
|
}
|
|
4388
4432
|
}
|
|
4389
|
-
let pluginDir = resolveOpenClawPluginDir();
|
|
4390
|
-
if (!pluginDir) {
|
|
4391
|
-
const installSpinner = new Spinner("plugin", "Installing @agenticmail/openclaw...");
|
|
4392
|
-
installSpinner.start();
|
|
4393
|
-
try {
|
|
4394
|
-
const { execSync } = await import("child_process");
|
|
4395
|
-
execSync("npm i @agenticmail/openclaw", {
|
|
4396
|
-
cwd: homedir(),
|
|
4397
|
-
timeout: 6e4,
|
|
4398
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
4399
|
-
});
|
|
4400
|
-
installSpinner.succeed("Installed @agenticmail/openclaw");
|
|
4401
|
-
pluginDir = resolveOpenClawPluginDir();
|
|
4402
|
-
} catch (err) {
|
|
4403
|
-
installSpinner.fail(`Could not install: ${err.message}`);
|
|
4404
|
-
info2(`Install manually: ${c2.green("npm i @agenticmail/openclaw")}`);
|
|
4405
|
-
return;
|
|
4406
|
-
}
|
|
4407
|
-
}
|
|
4408
|
-
if (!pluginDir) {
|
|
4409
|
-
fail2("Could not find @agenticmail/openclaw after install");
|
|
4410
|
-
return;
|
|
4411
|
-
}
|
|
4412
4433
|
let agentApiKey;
|
|
4413
4434
|
try {
|
|
4414
4435
|
const base = `http://${config.api.host}:${config.api.port}`;
|
|
@@ -4423,37 +4444,19 @@ async function registerWithOpenClaw(config) {
|
|
|
4423
4444
|
}
|
|
4424
4445
|
} catch {
|
|
4425
4446
|
}
|
|
4426
|
-
if (!agentApiKey)
|
|
4447
|
+
if (!agentApiKey) {
|
|
4448
|
+
info2("No agent found \u2014 OpenClaw config will be linked when you run setup again after connecting your email.");
|
|
4449
|
+
return;
|
|
4450
|
+
}
|
|
4427
4451
|
const apiUrl = `http://${config.api.host}:${config.api.port}`;
|
|
4428
4452
|
const updated = mergePluginConfig(existing, apiUrl, config.masterKey, agentApiKey, pluginDir);
|
|
4429
4453
|
writeFileSync2(openclawConfigPath, JSON.stringify(updated, null, 2) + "\n");
|
|
4430
|
-
|
|
4454
|
+
ok2(`Plugin found: ${c2.cyan(pluginDir)}`);
|
|
4431
4455
|
ok2(`OpenClaw config updated: ${c2.cyan(openclawConfigPath)}`);
|
|
4432
4456
|
if (!existing?.hooks?.enabled && updated?.hooks?.enabled) {
|
|
4433
4457
|
ok2(`${c2.bold("Agent auto-spawn")} enabled \u2014 call_agent will auto-create sessions`);
|
|
4434
4458
|
}
|
|
4435
|
-
|
|
4436
|
-
try {
|
|
4437
|
-
const { execSync } = await import("child_process");
|
|
4438
|
-
execSync("which openclaw", { stdio: "ignore" });
|
|
4439
|
-
hasOpenClawCli = true;
|
|
4440
|
-
} catch {
|
|
4441
|
-
}
|
|
4442
|
-
if (hasOpenClawCli) {
|
|
4443
|
-
log2("");
|
|
4444
|
-
const restartSpinner = new Spinner("gateway", "Restarting OpenClaw gateway...");
|
|
4445
|
-
restartSpinner.start();
|
|
4446
|
-
try {
|
|
4447
|
-
const { execSync } = await import("child_process");
|
|
4448
|
-
execSync("openclaw gateway restart", { stdio: "pipe", timeout: 3e4 });
|
|
4449
|
-
restartSpinner.succeed("OpenClaw gateway restarted");
|
|
4450
|
-
} catch {
|
|
4451
|
-
restartSpinner.fail("Gateway restart failed");
|
|
4452
|
-
log2(` Run manually: ${c2.green("openclaw gateway restart")}`);
|
|
4453
|
-
}
|
|
4454
|
-
} else {
|
|
4455
|
-
info2(`Restart OpenClaw to pick up the changes: ${c2.green("openclaw gateway restart")}`);
|
|
4456
|
-
}
|
|
4459
|
+
await restartOpenClawGateway();
|
|
4457
4460
|
} catch {
|
|
4458
4461
|
}
|
|
4459
4462
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agenticmail",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "Email infrastructure for AI agents — send and receive real email programmatically",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsup src/index.ts src/cli.ts --format esm --dts --clean",
|
|
25
|
-
"test": "vitest run",
|
|
25
|
+
"test": "vitest run --passWithNoTests",
|
|
26
26
|
"prepublishOnly": "npm run build"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|