agenticmail 0.3.17 → 0.3.19
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 +46 -29
- 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,15 +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
|
-
const pluginDir = resolveOpenClawPluginDir();
|
|
4390
|
-
if (!pluginDir) {
|
|
4391
|
-
info2(`Install the OpenClaw plugin first: ${c2.green("npm i @agenticmail/openclaw")}`);
|
|
4392
|
-
info2(`Then run: ${c2.green("agenticmail openclaw")}`);
|
|
4393
|
-
return;
|
|
4394
|
-
}
|
|
4395
4433
|
let agentApiKey;
|
|
4396
4434
|
try {
|
|
4397
4435
|
const base = `http://${config.api.host}:${config.api.port}`;
|
|
@@ -4410,33 +4448,12 @@ async function registerWithOpenClaw(config) {
|
|
|
4410
4448
|
const apiUrl = `http://${config.api.host}:${config.api.port}`;
|
|
4411
4449
|
const updated = mergePluginConfig(existing, apiUrl, config.masterKey, agentApiKey, pluginDir);
|
|
4412
4450
|
writeFileSync2(openclawConfigPath, JSON.stringify(updated, null, 2) + "\n");
|
|
4413
|
-
|
|
4451
|
+
ok2(`Plugin found: ${c2.cyan(pluginDir)}`);
|
|
4414
4452
|
ok2(`OpenClaw config updated: ${c2.cyan(openclawConfigPath)}`);
|
|
4415
4453
|
if (!existing?.hooks?.enabled && updated?.hooks?.enabled) {
|
|
4416
4454
|
ok2(`${c2.bold("Agent auto-spawn")} enabled \u2014 call_agent will auto-create sessions`);
|
|
4417
4455
|
}
|
|
4418
|
-
|
|
4419
|
-
try {
|
|
4420
|
-
const { execSync } = await import("child_process");
|
|
4421
|
-
execSync("which openclaw", { stdio: "ignore" });
|
|
4422
|
-
hasOpenClawCli = true;
|
|
4423
|
-
} catch {
|
|
4424
|
-
}
|
|
4425
|
-
if (hasOpenClawCli) {
|
|
4426
|
-
log2("");
|
|
4427
|
-
const restartSpinner = new Spinner("gateway", "Restarting OpenClaw gateway...");
|
|
4428
|
-
restartSpinner.start();
|
|
4429
|
-
try {
|
|
4430
|
-
const { execSync } = await import("child_process");
|
|
4431
|
-
execSync("openclaw gateway restart", { stdio: "pipe", timeout: 3e4 });
|
|
4432
|
-
restartSpinner.succeed("OpenClaw gateway restarted");
|
|
4433
|
-
} catch {
|
|
4434
|
-
restartSpinner.fail("Gateway restart failed");
|
|
4435
|
-
log2(` Run manually: ${c2.green("openclaw gateway restart")}`);
|
|
4436
|
-
}
|
|
4437
|
-
} else {
|
|
4438
|
-
info2(`Restart OpenClaw to pick up the changes: ${c2.green("openclaw gateway restart")}`);
|
|
4439
|
-
}
|
|
4456
|
+
await restartOpenClawGateway();
|
|
4440
4457
|
} catch {
|
|
4441
4458
|
}
|
|
4442
4459
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agenticmail",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
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": {
|