@agenticmail/core 0.5.11 → 0.5.13

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
@@ -1440,19 +1440,16 @@ declare class DependencyInstaller {
1440
1440
  */
1441
1441
  private findDockerApp;
1442
1442
  /**
1443
- * Pre-accept the Docker Desktop license agreement by writing the settings
1444
- * file that Docker checks on startup. This prevents the license dialog from
1445
- * appearing and blocking automated setup.
1446
- *
1447
- * Docker Desktop checks /Library/Application Support/com.docker.docker/install-settings.json
1448
- * (system-level, requires sudo) for {"acceptLicense": true}. The --accept-license
1449
- * flag on the installer binary tries to write this but fails without sudo.
1450
- *
1451
- * We try multiple approaches:
1452
- * 1. Write to the system-level path (may fail without sudo — that's OK)
1453
- * 2. Write to the user-level Docker settings (Group Containers)
1443
+ * Check if Docker Desktop license has already been accepted.
1444
+ * Returns true if we're confident the user has accepted before.
1445
+ */
1446
+ private isDockerLicenseAccepted;
1447
+ /**
1448
+ * Configure Docker Desktop to run headless after first-time setup.
1449
+ * Call this AFTER Docker has been started and license accepted.
1450
+ * Suppresses UI, dock icon, tips, analytics, and auto-updates.
1454
1451
  */
1455
- private preAcceptDockerLicense;
1452
+ private configureDockerHeadless;
1456
1453
  /**
1457
1454
  * Docker.app exists but CLI isn't available or daemon isn't running.
1458
1455
  * Runs the built-in installer silently (--accept-license to link CLI tools),
package/dist/index.js CHANGED
@@ -6150,42 +6150,38 @@ var DependencyInstaller = class {
6150
6150
  return null;
6151
6151
  }
6152
6152
  /**
6153
- * Pre-accept the Docker Desktop license agreement by writing the settings
6154
- * file that Docker checks on startup. This prevents the license dialog from
6155
- * appearing and blocking automated setup.
6156
- *
6157
- * Docker Desktop checks /Library/Application Support/com.docker.docker/install-settings.json
6158
- * (system-level, requires sudo) for {"acceptLicense": true}. The --accept-license
6159
- * flag on the installer binary tries to write this but fails without sudo.
6160
- *
6161
- * We try multiple approaches:
6162
- * 1. Write to the system-level path (may fail without sudo — that's OK)
6163
- * 2. Write to the user-level Docker settings (Group Containers)
6153
+ * Check if Docker Desktop license has already been accepted.
6154
+ * Returns true if we're confident the user has accepted before.
6164
6155
  */
6165
- preAcceptDockerLicense() {
6166
- const systemDir = "/Library/Application Support/com.docker.docker";
6167
- const systemFile = join6(systemDir, "install-settings.json");
6168
- const licenseJson = JSON.stringify({ acceptLicense: true });
6156
+ isDockerLicenseAccepted() {
6169
6157
  try {
6170
- if (!existsSync4(systemDir)) {
6171
- execSync(`mkdir -p "${systemDir}"`, { timeout: 5e3, stdio: "ignore" });
6158
+ const systemFile = "/Library/Application Support/com.docker.docker/install-settings.json";
6159
+ if (existsSync4(systemFile)) {
6160
+ const raw = readFileSync2(systemFile, "utf-8");
6161
+ const data = JSON.parse(raw);
6162
+ if (data.acceptLicense) return true;
6172
6163
  }
6173
- writeFileSync3(systemFile, licenseJson, { mode: 420 });
6174
6164
  } catch {
6175
- try {
6176
- execSync(`sudo -n mkdir -p "${systemDir}" 2>/dev/null && sudo -n tee "${systemFile}" > /dev/null 2>&1`, {
6177
- timeout: 5e3,
6178
- input: licenseJson,
6179
- stdio: ["pipe", "ignore", "ignore"]
6180
- });
6181
- } catch {
6165
+ }
6166
+ try {
6167
+ const settingsFile = join6(process.env.HOME || "", "Library/Group Containers/group.com.docker/settings-store.json");
6168
+ if (existsSync4(settingsFile)) {
6169
+ return true;
6182
6170
  }
6171
+ } catch {
6183
6172
  }
6173
+ return false;
6174
+ }
6175
+ /**
6176
+ * Configure Docker Desktop to run headless after first-time setup.
6177
+ * Call this AFTER Docker has been started and license accepted.
6178
+ * Suppresses UI, dock icon, tips, analytics, and auto-updates.
6179
+ */
6180
+ configureDockerHeadless() {
6184
6181
  try {
6185
6182
  const userDockerDir = join6(process.env.HOME || "", "Library/Group Containers/group.com.docker");
6186
6183
  const settingsFile = join6(userDockerDir, "settings-store.json");
6187
6184
  const headlessDefaults = {
6188
- AcceptedLicense: true,
6189
6185
  AutoStart: false,
6190
6186
  // Don't auto-start on login (we start it ourselves)
6191
6187
  OpenUIOnStartupDisabled: true,
@@ -6226,9 +6222,9 @@ var DependencyInstaller = class {
6226
6222
  */
6227
6223
  async setupExistingDockerApp(appPath) {
6228
6224
  const installBin = join6(appPath, "Contents", "MacOS", "install");
6229
- this.preAcceptDockerLicense();
6225
+ const isFirstLaunch = !this.isDockerLicenseAccepted();
6230
6226
  if (existsSync4(installBin)) {
6231
- this.onProgress("__progress__:30:Setting up Docker CLI tools...");
6227
+ this.onProgress("__progress__:30:Setting up CLI tools...");
6232
6228
  const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
6233
6229
  try {
6234
6230
  execSync(`"${installBin}" --accept-license --user=${user}`, {
@@ -6238,10 +6234,21 @@ var DependencyInstaller = class {
6238
6234
  } catch {
6239
6235
  }
6240
6236
  }
6241
- this.onProgress("__progress__:50:Starting Docker engine...");
6242
- this.startDockerDaemon();
6243
- this.hideDockerWindow();
6244
- await this.waitForDocker();
6237
+ if (isFirstLaunch) {
6238
+ this.onProgress("__progress__:50:Opening Docker \u2014 please accept the license agreement...");
6239
+ try {
6240
+ execFileSync2("open", ["-a", appPath], { timeout: 1e4, stdio: "ignore" });
6241
+ } catch {
6242
+ }
6243
+ await this.waitForDocker();
6244
+ this.configureDockerHeadless();
6245
+ this.hideDockerWindow();
6246
+ } else {
6247
+ this.onProgress("__progress__:50:Starting engine...");
6248
+ this.startDockerDaemon();
6249
+ this.hideDockerWindow();
6250
+ await this.waitForDocker();
6251
+ }
6245
6252
  }
6246
6253
  /**
6247
6254
  * Hide Docker Desktop completely — close all windows, hide from dock, make invisible.
@@ -6339,8 +6346,7 @@ var DependencyInstaller = class {
6339
6346
  } catch {
6340
6347
  throw new Error("Failed to mount Docker DMG. The download may be corrupted \u2014 try again.");
6341
6348
  }
6342
- this.preAcceptDockerLicense();
6343
- this.onProgress("__progress__:55:Running Docker installer...");
6349
+ this.onProgress("__progress__:55:Running installer...");
6344
6350
  const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
6345
6351
  try {
6346
6352
  execSync(`/Volumes/Docker/Docker.app/Contents/MacOS/install --accept-license --user=${user}`, {
@@ -6353,7 +6359,7 @@ var DependencyInstaller = class {
6353
6359
  try {
6354
6360
  execSync('cp -R "/Volumes/Docker/Docker.app" /Applications/', { timeout: 6e4, stdio: "ignore" });
6355
6361
  } catch {
6356
- throw new Error("Failed to install Docker Desktop. You may need to run this with admin privileges.");
6362
+ throw new Error("Failed to install. You may need to run this with admin privileges.");
6357
6363
  }
6358
6364
  }
6359
6365
  }
@@ -6365,10 +6371,14 @@ var DependencyInstaller = class {
6365
6371
  await unlink(dmgPath);
6366
6372
  } catch {
6367
6373
  }
6368
- this.onProgress("__progress__:70:Starting Docker engine...");
6369
- this.startDockerDaemon();
6370
- this.hideDockerWindow();
6374
+ this.onProgress("__progress__:70:Opening Docker \u2014 please accept the license agreement...");
6375
+ try {
6376
+ execFileSync2("open", ["-a", "/Applications/Docker.app"], { timeout: 1e4, stdio: "ignore" });
6377
+ } catch {
6378
+ }
6371
6379
  await this.waitForDocker();
6380
+ this.configureDockerHeadless();
6381
+ this.hideDockerWindow();
6372
6382
  }
6373
6383
  /**
6374
6384
  * Install Docker Engine on Linux using Docker's official convenience script.
@@ -6556,11 +6566,11 @@ var DependencyInstaller = class {
6556
6566
  const msgIdx = Math.floor(elapsed / 1e4) % msgs.length;
6557
6567
  this.onProgress(`__progress__:${pct}:${msgs[msgIdx]}`);
6558
6568
  }
6559
- if (os === "darwin") this.hideDockerWindow();
6569
+ if (os === "darwin" && this.isDockerLicenseAccepted()) this.hideDockerWindow();
6560
6570
  await new Promise((r) => setTimeout(r, 3e3));
6561
6571
  }
6562
6572
  throw new Error(
6563
- "Docker could not be started after trying all available methods. This usually means Docker Desktop needs a one-time manual launch to complete its setup. Open Docker from your Applications folder, then run this command again."
6573
+ "Engine could not be started after trying all available methods. If this is your first time, open Docker from your Applications folder, accept the license agreement, then run this command again."
6564
6574
  );
6565
6575
  }
6566
6576
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/core",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
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",