@agenticmail/core 0.5.20 → 0.5.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.
package/dist/index.d.ts CHANGED
@@ -1457,6 +1457,11 @@ declare class DependencyInstaller {
1457
1457
  * then starts Docker Desktop hidden (no GUI window).
1458
1458
  */
1459
1459
  private setupExistingDockerApp;
1460
+ /**
1461
+ * Accept Docker Desktop license by writing acceptance files directly to disk.
1462
+ * This bypasses the GUI terms dialog entirely.
1463
+ */
1464
+ private acceptLicenseProgrammatically;
1460
1465
  /**
1461
1466
  * Hide Docker Desktop completely — close all windows, hide from dock, make invisible.
1462
1467
  * Called after starting Docker to ensure the user never sees any Docker UI.
package/dist/index.js CHANGED
@@ -5180,8 +5180,8 @@ var GatewayManager = class {
5180
5180
  const { homedir: homedir8 } = await import("os");
5181
5181
  const backupDir = join4(homedir8(), ".agenticmail");
5182
5182
  const backupPath = join4(backupDir, `dns-backup-${domain}-${Date.now()}.json`);
5183
- const { writeFileSync: writeFileSync6, mkdirSync: mkdirSync5 } = await import("fs");
5184
- mkdirSync5(backupDir, { recursive: true });
5183
+ const { writeFileSync: writeFileSync6, mkdirSync: mkdirSync6 } = await import("fs");
5184
+ mkdirSync6(backupDir, { recursive: true });
5185
5185
  writeFileSync6(backupPath, JSON.stringify({
5186
5186
  domain,
5187
5187
  zoneId: zone.id,
@@ -5813,7 +5813,7 @@ var RELAY_PRESETS = {
5813
5813
 
5814
5814
  // src/setup/index.ts
5815
5815
  import { randomBytes as randomBytes2 } from "crypto";
5816
- import { existsSync as existsSync6, readFileSync as readFileSync4, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, chmodSync } from "fs";
5816
+ import { existsSync as existsSync6, readFileSync as readFileSync4, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, chmodSync } from "fs";
5817
5817
  import { join as join8 } from "path";
5818
5818
  import { homedir as homedir7 } from "os";
5819
5819
 
@@ -5894,7 +5894,7 @@ var DependencyChecker = class {
5894
5894
 
5895
5895
  // src/setup/installer.ts
5896
5896
  import { execFileSync as execFileSync2, execSync, spawn as spawnChild } from "child_process";
5897
- import { existsSync as existsSync4, readdirSync, lstatSync, readlinkSync, writeFileSync as writeFileSync3, readFileSync as readFileSync2 } from "fs";
5897
+ import { existsSync as existsSync4, readdirSync, lstatSync, readlinkSync, writeFileSync as writeFileSync3, readFileSync as readFileSync2, mkdirSync as mkdirSync3 } from "fs";
5898
5898
  import { writeFile, rename, chmod as chmod2, mkdir as mkdir2, unlink } from "fs/promises";
5899
5899
  import { join as join6 } from "path";
5900
5900
  import { homedir as homedir5, platform as platform2, arch as arch2 } from "os";
@@ -6222,39 +6222,16 @@ var DependencyInstaller = class {
6222
6222
  * then starts Docker Desktop hidden (no GUI window).
6223
6223
  */
6224
6224
  async setupExistingDockerApp(appPath) {
6225
- let wasAlreadyRunning = false;
6226
- try {
6227
- execFileSync2("docker", ["info"], { timeout: 5e3, stdio: "ignore" });
6228
- wasAlreadyRunning = true;
6229
- } catch {
6230
- }
6231
- const installBin = join6(appPath, "Contents", "MacOS", "install");
6232
- if (wasAlreadyRunning) {
6233
- if (existsSync4(installBin)) {
6234
- this.onProgress("__progress__:30:Setting up CLI tools...");
6235
- const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
6236
- try {
6237
- execSync(`"${installBin}" --accept-license --user=${user}`, {
6238
- timeout: 12e4,
6239
- stdio: "ignore"
6240
- });
6241
- } catch {
6242
- }
6243
- }
6225
+ if (this.isDockerReady()) {
6244
6226
  this.onProgress("__progress__:100:Engine is ready!");
6245
6227
  this.hideDockerWindow();
6246
6228
  this.configureDockerHeadless();
6247
6229
  return;
6248
6230
  }
6249
- this._firstLaunchMode = true;
6250
- this.onProgress("__progress__:50:Please accept the Docker license agreement...");
6251
- try {
6252
- execFileSync2("open", [appPath], { timeout: 1e4, stdio: "ignore" });
6253
- } catch {
6254
- }
6255
- await this.waitForDocker();
6231
+ this.acceptLicenseProgrammatically();
6232
+ const installBin = join6(appPath, "Contents", "MacOS", "install");
6256
6233
  if (existsSync4(installBin)) {
6257
- this.onProgress("Setting up CLI tools...");
6234
+ this.onProgress("__progress__:30:Setting up CLI tools...");
6258
6235
  const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
6259
6236
  try {
6260
6237
  execSync(`"${installBin}" --accept-license --user=${user}`, {
@@ -6264,10 +6241,67 @@ var DependencyInstaller = class {
6264
6241
  } catch {
6265
6242
  }
6266
6243
  }
6267
- this._firstLaunchMode = false;
6244
+ try {
6245
+ execSync(`osascript -e 'quit app "Docker Desktop"' 2>/dev/null`, { timeout: 5e3, stdio: "ignore" });
6246
+ } catch {
6247
+ }
6248
+ try {
6249
+ execSync(`osascript -e 'quit app "Docker"' 2>/dev/null`, { timeout: 5e3, stdio: "ignore" });
6250
+ } catch {
6251
+ }
6252
+ try {
6253
+ execSync("pkill -f Docker.app 2>/dev/null", { timeout: 5e3, stdio: "ignore" });
6254
+ } catch {
6255
+ }
6256
+ await new Promise((r) => setTimeout(r, 2e3));
6268
6257
  this.configureDockerHeadless();
6258
+ this.onProgress("__progress__:50:Starting engine...");
6259
+ this.startDockerDaemon();
6260
+ await this.waitForDocker();
6269
6261
  this.hideDockerWindow();
6270
6262
  }
6263
+ /**
6264
+ * Accept Docker Desktop license by writing acceptance files directly to disk.
6265
+ * This bypasses the GUI terms dialog entirely.
6266
+ */
6267
+ acceptLicenseProgrammatically() {
6268
+ try {
6269
+ const sysDir = "/Library/Application Support/com.docker.docker";
6270
+ if (!existsSync4(sysDir)) {
6271
+ try {
6272
+ mkdirSync3(sysDir, { recursive: true });
6273
+ } catch {
6274
+ }
6275
+ }
6276
+ if (existsSync4(sysDir)) {
6277
+ writeFileSync3(join6(sysDir, "install-settings.json"), JSON.stringify({ acceptLicense: true }));
6278
+ }
6279
+ } catch {
6280
+ }
6281
+ try {
6282
+ const userDir = join6(process.env.HOME || homedir5(), "Library/Group Containers/group.com.docker");
6283
+ if (!existsSync4(userDir)) {
6284
+ mkdirSync3(userDir, { recursive: true });
6285
+ }
6286
+ const settingsFile = join6(userDir, "settings-store.json");
6287
+ const settings = {};
6288
+ if (existsSync4(settingsFile)) {
6289
+ try {
6290
+ Object.assign(settings, JSON.parse(readFileSync2(settingsFile, "utf-8")));
6291
+ } catch {
6292
+ }
6293
+ }
6294
+ Object.assign(settings, {
6295
+ AutoStart: false,
6296
+ OpenUIOnStartupDisabled: true,
6297
+ TipShown: true,
6298
+ SUAutomaticallyUpdate: false,
6299
+ AnalyticsEnabled: false
6300
+ });
6301
+ writeFileSync3(settingsFile, JSON.stringify(settings, null, 2));
6302
+ } catch {
6303
+ }
6304
+ }
6271
6305
  /**
6272
6306
  * Hide Docker Desktop completely — close all windows, hide from dock, make invisible.
6273
6307
  * Called after starting Docker to ensure the user never sees any Docker UI.
@@ -6380,27 +6414,7 @@ var DependencyInstaller = class {
6380
6414
  await unlink(dmgPath);
6381
6415
  } catch {
6382
6416
  }
6383
- this._firstLaunchMode = true;
6384
- this.onProgress("__progress__:70:Please accept the Docker license agreement...");
6385
- try {
6386
- execFileSync2("open", ["/Applications/Docker.app"], { timeout: 1e4, stdio: "ignore" });
6387
- } catch {
6388
- }
6389
- await this.waitForDocker();
6390
- this._firstLaunchMode = false;
6391
- const installBin = "/Applications/Docker.app/Contents/MacOS/install";
6392
- if (existsSync4(installBin)) {
6393
- const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
6394
- try {
6395
- execSync(`"${installBin}" --accept-license --user=${user}`, {
6396
- timeout: 12e4,
6397
- stdio: "ignore"
6398
- });
6399
- } catch {
6400
- }
6401
- }
6402
- this.configureDockerHeadless();
6403
- this.hideDockerWindow();
6417
+ await this.setupExistingDockerApp("/Applications/Docker.app");
6404
6418
  }
6405
6419
  /**
6406
6420
  * Install Docker Engine on Linux using Docker's official convenience script.
@@ -6714,7 +6728,7 @@ var DependencyInstaller = class {
6714
6728
 
6715
6729
  // src/setup/service.ts
6716
6730
  import { execFileSync as execFileSync3, execSync as execSync2 } from "child_process";
6717
- import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync4, unlinkSync, mkdirSync as mkdirSync3 } from "fs";
6731
+ import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync4, unlinkSync, mkdirSync as mkdirSync4 } from "fs";
6718
6732
  import { join as join7 } from "path";
6719
6733
  import { homedir as homedir6, platform as platform3 } from "os";
6720
6734
  var PLIST_LABEL = "com.agenticmail.server";
@@ -6787,7 +6801,7 @@ var ServiceManager = class {
6787
6801
  */
6788
6802
  cacheApiEntryPath(entryPath) {
6789
6803
  const dataDir = join7(homedir6(), ".agenticmail");
6790
- if (!existsSync5(dataDir)) mkdirSync3(dataDir, { recursive: true });
6804
+ if (!existsSync5(dataDir)) mkdirSync4(dataDir, { recursive: true });
6791
6805
  writeFileSync4(join7(dataDir, "api-entry.path"), entryPath);
6792
6806
  }
6793
6807
  /**
@@ -6821,7 +6835,7 @@ var ServiceManager = class {
6821
6835
  generateStartScript(nodePath, apiEntry) {
6822
6836
  const scriptPath = join7(homedir6(), ".agenticmail", "bin", "start-server.sh");
6823
6837
  const scriptDir = join7(homedir6(), ".agenticmail", "bin");
6824
- if (!existsSync5(scriptDir)) mkdirSync3(scriptDir, { recursive: true });
6838
+ if (!existsSync5(scriptDir)) mkdirSync4(scriptDir, { recursive: true });
6825
6839
  const script = [
6826
6840
  "#!/bin/bash",
6827
6841
  "# AgenticMail auto-start script",
@@ -6887,7 +6901,7 @@ var ServiceManager = class {
6887
6901
  generatePlist(nodePath, apiEntry, configPath) {
6888
6902
  const config = JSON.parse(readFileSync3(configPath, "utf-8"));
6889
6903
  const logDir = join7(homedir6(), ".agenticmail", "logs");
6890
- if (!existsSync5(logDir)) mkdirSync3(logDir, { recursive: true });
6904
+ if (!existsSync5(logDir)) mkdirSync4(logDir, { recursive: true });
6891
6905
  const version = this.getVersion();
6892
6906
  const startScript = this.generateStartScript(nodePath, apiEntry);
6893
6907
  return `<?xml version="1.0" encoding="UTF-8"?>
@@ -7038,7 +7052,7 @@ WantedBy=default.target
7038
7052
  const servicePath = this.getServicePath();
7039
7053
  if (this.os === "darwin") {
7040
7054
  const dir = join7(homedir6(), "Library", "LaunchAgents");
7041
- if (!existsSync5(dir)) mkdirSync3(dir, { recursive: true });
7055
+ if (!existsSync5(dir)) mkdirSync4(dir, { recursive: true });
7042
7056
  if (existsSync5(servicePath)) {
7043
7057
  try {
7044
7058
  execFileSync3("launchctl", ["unload", servicePath], { timeout: 1e4, stdio: "ignore" });
@@ -7055,7 +7069,7 @@ WantedBy=default.target
7055
7069
  return { installed: true, message: `Service installed at ${servicePath}` };
7056
7070
  } else if (this.os === "linux") {
7057
7071
  const dir = join7(homedir6(), ".config", "systemd", "user");
7058
- if (!existsSync5(dir)) mkdirSync3(dir, { recursive: true });
7072
+ if (!existsSync5(dir)) mkdirSync4(dir, { recursive: true });
7059
7073
  const unit = this.generateSystemdUnit(nodePath, apiEntry, configPath);
7060
7074
  writeFileSync4(servicePath, unit);
7061
7075
  try {
@@ -7215,7 +7229,7 @@ var SetupManager = class {
7215
7229
  }
7216
7230
  }
7217
7231
  if (!existsSync6(dataDir)) {
7218
- mkdirSync4(dataDir, { recursive: true });
7232
+ mkdirSync5(dataDir, { recursive: true });
7219
7233
  }
7220
7234
  const masterKey = `mk_${randomBytes2(24).toString("hex")}`;
7221
7235
  const stalwartPassword = randomBytes2(16).toString("hex");
@@ -7259,7 +7273,7 @@ IMAP_PORT=143
7259
7273
  generateDockerFiles(config) {
7260
7274
  const dataDir = config.dataDir || join8(homedir7(), ".agenticmail");
7261
7275
  if (!existsSync6(dataDir)) {
7262
- mkdirSync4(dataDir, { recursive: true });
7276
+ mkdirSync5(dataDir, { recursive: true });
7263
7277
  }
7264
7278
  const password = config.stalwart?.adminPassword || "changeme";
7265
7279
  const composePath = join8(dataDir, "docker-compose.yml");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/core",
3
- "version": "0.5.20",
3
+ "version": "0.5.22",
4
4
  "description": "Core SDK for AgenticMail \u2014 email, SMS, and phone number access for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",