agenticmail 0.3.21 → 0.3.22

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.
Files changed (2) hide show
  1. package/dist/cli.js +36 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -4195,7 +4195,42 @@ async function cmdSetup() {
4195
4195
  process.exit(1);
4196
4196
  }
4197
4197
  } else {
4198
- ok2(`${c2.bold("Mail Server")} ${c2.dim("\u2014 already running")}`);
4198
+ try {
4199
+ const authCheck = await fetch(`${result.config.stalwart.url}/api/principal`, {
4200
+ headers: {
4201
+ "Authorization": "Basic " + Buffer.from(`${result.config.stalwart.adminUser}:${result.config.stalwart.adminPassword}`).toString("base64")
4202
+ },
4203
+ signal: AbortSignal.timeout(5e3)
4204
+ });
4205
+ if (authCheck.status === 401) {
4206
+ const spinner = new Spinner("stalwart", "Resetting mail server (stale credentials)...");
4207
+ spinner.start();
4208
+ try {
4209
+ const { execFileSync } = await import("child_process");
4210
+ execFileSync("docker", ["rm", "-f", "agenticmail-stalwart"], { timeout: 15e3, stdio: "ignore" });
4211
+ try {
4212
+ const volumes = execFileSync(
4213
+ "docker",
4214
+ ["volume", "ls", "-q", "--filter", "name=stalwart-data"],
4215
+ { timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] }
4216
+ ).toString().trim();
4217
+ for (const vol of volumes.split("\n").filter(Boolean)) {
4218
+ execFileSync("docker", ["volume", "rm", vol], { timeout: 1e4, stdio: "ignore" });
4219
+ }
4220
+ } catch {
4221
+ }
4222
+ await setup.ensureStalwart();
4223
+ spinner.succeed(`${c2.bold("Mail Server")} \u2014 recreated with fresh credentials`);
4224
+ } catch (err) {
4225
+ spinner.fail(`Couldn't reset mail server: ${err.message}`);
4226
+ process.exit(1);
4227
+ }
4228
+ } else {
4229
+ ok2(`${c2.bold("Mail Server")} ${c2.dim("\u2014 already running")}`);
4230
+ }
4231
+ } catch {
4232
+ ok2(`${c2.bold("Mail Server")} ${c2.dim("\u2014 already running")}`);
4233
+ }
4199
4234
  await new Promise((r) => setTimeout(r, 300));
4200
4235
  }
4201
4236
  const cf = deps.find((d) => d.name === "cloudflared");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenticmail",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Email infrastructure for AI agents — send and receive real email programmatically",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",