@agenticmail/core 0.3.0 → 0.3.2
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/index.d.ts +11 -3
- package/dist/index.js +52 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1265,12 +1265,20 @@ declare class DependencyInstaller {
|
|
|
1265
1265
|
private onProgress;
|
|
1266
1266
|
constructor(onProgress?: InstallProgress);
|
|
1267
1267
|
/**
|
|
1268
|
-
*
|
|
1269
|
-
*
|
|
1268
|
+
* Ensure Docker is installed AND the daemon is running.
|
|
1269
|
+
* Installs Docker if not present (Homebrew on macOS, apt on Linux).
|
|
1270
|
+
* Starts the daemon if Docker CLI is present but daemon is stopped.
|
|
1270
1271
|
*/
|
|
1271
1272
|
installDocker(): Promise<void>;
|
|
1272
1273
|
/**
|
|
1273
|
-
*
|
|
1274
|
+
* Attempt to start the Docker daemon.
|
|
1275
|
+
* On macOS: opens Docker Desktop app.
|
|
1276
|
+
* On Linux: tries systemctl.
|
|
1277
|
+
*/
|
|
1278
|
+
private startDockerDaemon;
|
|
1279
|
+
/**
|
|
1280
|
+
* Wait for Docker daemon to be ready (up to 3 minutes).
|
|
1281
|
+
* Docker Desktop can take 1-2+ minutes on first launch.
|
|
1274
1282
|
*/
|
|
1275
1283
|
private waitForDocker;
|
|
1276
1284
|
/**
|
package/dist/index.js
CHANGED
|
@@ -5437,15 +5437,28 @@ var DependencyInstaller = class {
|
|
|
5437
5437
|
});
|
|
5438
5438
|
}
|
|
5439
5439
|
/**
|
|
5440
|
-
*
|
|
5441
|
-
*
|
|
5440
|
+
* Ensure Docker is installed AND the daemon is running.
|
|
5441
|
+
* Installs Docker if not present (Homebrew on macOS, apt on Linux).
|
|
5442
|
+
* Starts the daemon if Docker CLI is present but daemon is stopped.
|
|
5442
5443
|
*/
|
|
5443
5444
|
async installDocker() {
|
|
5445
|
+
let cliInstalled = false;
|
|
5444
5446
|
try {
|
|
5445
5447
|
execSync2("docker --version", { timeout: 5e3, stdio: "ignore" });
|
|
5446
|
-
|
|
5448
|
+
cliInstalled = true;
|
|
5447
5449
|
} catch {
|
|
5448
5450
|
}
|
|
5451
|
+
if (cliInstalled) {
|
|
5452
|
+
try {
|
|
5453
|
+
execSync2("docker info", { timeout: 1e4, stdio: "ignore" });
|
|
5454
|
+
return;
|
|
5455
|
+
} catch {
|
|
5456
|
+
this.onProgress("Docker found but not running \u2014 starting it now...");
|
|
5457
|
+
this.startDockerDaemon();
|
|
5458
|
+
await this.waitForDocker();
|
|
5459
|
+
return;
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5449
5462
|
const os = platform2();
|
|
5450
5463
|
if (os === "darwin") {
|
|
5451
5464
|
this.onProgress("Installing Docker via Homebrew...");
|
|
@@ -5456,10 +5469,7 @@ var DependencyInstaller = class {
|
|
|
5456
5469
|
}
|
|
5457
5470
|
execSync2("brew install --cask docker", { timeout: 3e5, stdio: "inherit" });
|
|
5458
5471
|
this.onProgress("Docker installed. Starting Docker Desktop...");
|
|
5459
|
-
|
|
5460
|
-
execSync2("open -a Docker", { timeout: 1e4, stdio: "ignore" });
|
|
5461
|
-
} catch {
|
|
5462
|
-
}
|
|
5472
|
+
this.startDockerDaemon();
|
|
5463
5473
|
await this.waitForDocker();
|
|
5464
5474
|
} else if (os === "linux") {
|
|
5465
5475
|
this.onProgress("Installing Docker...");
|
|
@@ -5474,21 +5484,49 @@ var DependencyInstaller = class {
|
|
|
5474
5484
|
}
|
|
5475
5485
|
}
|
|
5476
5486
|
/**
|
|
5477
|
-
*
|
|
5487
|
+
* Attempt to start the Docker daemon.
|
|
5488
|
+
* On macOS: opens Docker Desktop app.
|
|
5489
|
+
* On Linux: tries systemctl.
|
|
5490
|
+
*/
|
|
5491
|
+
startDockerDaemon() {
|
|
5492
|
+
const os = platform2();
|
|
5493
|
+
if (os === "darwin") {
|
|
5494
|
+
try {
|
|
5495
|
+
execSync2("open -a Docker", { timeout: 1e4, stdio: "ignore" });
|
|
5496
|
+
} catch {
|
|
5497
|
+
}
|
|
5498
|
+
} else if (os === "linux") {
|
|
5499
|
+
try {
|
|
5500
|
+
execSync2("sudo systemctl start docker", { timeout: 15e3, stdio: "ignore" });
|
|
5501
|
+
} catch {
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
}
|
|
5505
|
+
/**
|
|
5506
|
+
* Wait for Docker daemon to be ready (up to 3 minutes).
|
|
5507
|
+
* Docker Desktop can take 1-2+ minutes on first launch.
|
|
5478
5508
|
*/
|
|
5479
5509
|
async waitForDocker() {
|
|
5480
|
-
this.onProgress("Waiting for Docker to
|
|
5481
|
-
const maxWait =
|
|
5510
|
+
this.onProgress("Waiting for Docker to start (this can take a minute)...");
|
|
5511
|
+
const maxWait = 18e4;
|
|
5482
5512
|
const start = Date.now();
|
|
5513
|
+
let attempts = 0;
|
|
5483
5514
|
while (Date.now() - start < maxWait) {
|
|
5484
5515
|
try {
|
|
5485
5516
|
execSync2("docker info", { timeout: 5e3, stdio: "ignore" });
|
|
5486
5517
|
return;
|
|
5487
5518
|
} catch {
|
|
5488
5519
|
}
|
|
5520
|
+
attempts++;
|
|
5521
|
+
if (attempts % 5 === 0) {
|
|
5522
|
+
const elapsed = Math.round((Date.now() - start) / 1e3);
|
|
5523
|
+
this.onProgress(`Still waiting for Docker to start (${elapsed}s)...`);
|
|
5524
|
+
}
|
|
5489
5525
|
await new Promise((r) => setTimeout(r, 3e3));
|
|
5490
5526
|
}
|
|
5491
|
-
throw new Error(
|
|
5527
|
+
throw new Error(
|
|
5528
|
+
"Docker daemon did not start in time. Open Docker Desktop manually, wait for it to finish loading, then run this again."
|
|
5529
|
+
);
|
|
5492
5530
|
}
|
|
5493
5531
|
/**
|
|
5494
5532
|
* Start the Stalwart mail server Docker container.
|
|
@@ -5500,7 +5538,9 @@ var DependencyInstaller = class {
|
|
|
5500
5538
|
try {
|
|
5501
5539
|
execSync2("docker info", { timeout: 1e4, stdio: "ignore" });
|
|
5502
5540
|
} catch {
|
|
5503
|
-
|
|
5541
|
+
this.onProgress("Starting Docker...");
|
|
5542
|
+
this.startDockerDaemon();
|
|
5543
|
+
await this.waitForDocker();
|
|
5504
5544
|
}
|
|
5505
5545
|
this.onProgress("Starting Stalwart mail server...");
|
|
5506
5546
|
execSync2(`docker compose -f "${composePath}" up -d`, {
|