@agenticmail/core 0.5.11 → 0.5.14

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
@@ -1416,6 +1416,7 @@ type InstallProgress = (message: string) => void;
1416
1416
  */
1417
1417
  declare class DependencyInstaller {
1418
1418
  private onProgress;
1419
+ private _firstLaunchMode;
1419
1420
  constructor(onProgress?: InstallProgress);
1420
1421
  /**
1421
1422
  * Ensure Docker is installed AND the daemon is running.
@@ -1440,19 +1441,16 @@ declare class DependencyInstaller {
1440
1441
  */
1441
1442
  private findDockerApp;
1442
1443
  /**
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)
1444
+ * Check if Docker Desktop license has already been accepted.
1445
+ * Returns true if we're confident the user has accepted before.
1446
+ */
1447
+ private isDockerLicenseAccepted;
1448
+ /**
1449
+ * Configure Docker Desktop to run headless after first-time setup.
1450
+ * Call this AFTER Docker has been started and license accepted.
1451
+ * Suppresses UI, dock icon, tips, analytics, and auto-updates.
1454
1452
  */
1455
- private preAcceptDockerLicense;
1453
+ private configureDockerHeadless;
1456
1454
  /**
1457
1455
  * Docker.app exists but CLI isn't available or daemon isn't running.
1458
1456
  * Runs the built-in installer silently (--accept-license to link CLI tools),
package/dist/index.js CHANGED
@@ -6061,6 +6061,7 @@ function hasHomebrew() {
6061
6061
  }
6062
6062
  var DependencyInstaller = class {
6063
6063
  onProgress;
6064
+ _firstLaunchMode = false;
6064
6065
  constructor(onProgress) {
6065
6066
  this.onProgress = onProgress ?? (() => {
6066
6067
  });
@@ -6150,42 +6151,38 @@ var DependencyInstaller = class {
6150
6151
  return null;
6151
6152
  }
6152
6153
  /**
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)
6154
+ * Check if Docker Desktop license has already been accepted.
6155
+ * Returns true if we're confident the user has accepted before.
6164
6156
  */
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 });
6157
+ isDockerLicenseAccepted() {
6169
6158
  try {
6170
- if (!existsSync4(systemDir)) {
6171
- execSync(`mkdir -p "${systemDir}"`, { timeout: 5e3, stdio: "ignore" });
6159
+ const systemFile = "/Library/Application Support/com.docker.docker/install-settings.json";
6160
+ if (existsSync4(systemFile)) {
6161
+ const raw = readFileSync2(systemFile, "utf-8");
6162
+ const data = JSON.parse(raw);
6163
+ if (data.acceptLicense) return true;
6172
6164
  }
6173
- writeFileSync3(systemFile, licenseJson, { mode: 420 });
6174
6165
  } 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 {
6166
+ }
6167
+ try {
6168
+ const settingsFile = join6(process.env.HOME || "", "Library/Group Containers/group.com.docker/settings-store.json");
6169
+ if (existsSync4(settingsFile)) {
6170
+ return true;
6182
6171
  }
6172
+ } catch {
6183
6173
  }
6174
+ return false;
6175
+ }
6176
+ /**
6177
+ * Configure Docker Desktop to run headless after first-time setup.
6178
+ * Call this AFTER Docker has been started and license accepted.
6179
+ * Suppresses UI, dock icon, tips, analytics, and auto-updates.
6180
+ */
6181
+ configureDockerHeadless() {
6184
6182
  try {
6185
6183
  const userDockerDir = join6(process.env.HOME || "", "Library/Group Containers/group.com.docker");
6186
6184
  const settingsFile = join6(userDockerDir, "settings-store.json");
6187
6185
  const headlessDefaults = {
6188
- AcceptedLicense: true,
6189
6186
  AutoStart: false,
6190
6187
  // Don't auto-start on login (we start it ourselves)
6191
6188
  OpenUIOnStartupDisabled: true,
@@ -6226,9 +6223,9 @@ var DependencyInstaller = class {
6226
6223
  */
6227
6224
  async setupExistingDockerApp(appPath) {
6228
6225
  const installBin = join6(appPath, "Contents", "MacOS", "install");
6229
- this.preAcceptDockerLicense();
6226
+ const isFirstLaunch = !this.isDockerLicenseAccepted();
6230
6227
  if (existsSync4(installBin)) {
6231
- this.onProgress("__progress__:30:Setting up Docker CLI tools...");
6228
+ this.onProgress("__progress__:30:Setting up CLI tools...");
6232
6229
  const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
6233
6230
  try {
6234
6231
  execSync(`"${installBin}" --accept-license --user=${user}`, {
@@ -6238,10 +6235,23 @@ var DependencyInstaller = class {
6238
6235
  } catch {
6239
6236
  }
6240
6237
  }
6241
- this.onProgress("__progress__:50:Starting Docker engine...");
6242
- this.startDockerDaemon();
6243
- this.hideDockerWindow();
6244
- await this.waitForDocker();
6238
+ if (isFirstLaunch) {
6239
+ this._firstLaunchMode = true;
6240
+ this.onProgress("__progress__:50:Opening Docker \u2014 please accept the license agreement...");
6241
+ try {
6242
+ execFileSync2("open", ["-a", appPath], { timeout: 1e4, stdio: "ignore" });
6243
+ } catch {
6244
+ }
6245
+ await this.waitForDocker();
6246
+ this._firstLaunchMode = false;
6247
+ this.configureDockerHeadless();
6248
+ this.hideDockerWindow();
6249
+ } else {
6250
+ this.onProgress("__progress__:50:Starting engine...");
6251
+ this.startDockerDaemon();
6252
+ this.hideDockerWindow();
6253
+ await this.waitForDocker();
6254
+ }
6245
6255
  }
6246
6256
  /**
6247
6257
  * Hide Docker Desktop completely — close all windows, hide from dock, make invisible.
@@ -6339,8 +6349,7 @@ var DependencyInstaller = class {
6339
6349
  } catch {
6340
6350
  throw new Error("Failed to mount Docker DMG. The download may be corrupted \u2014 try again.");
6341
6351
  }
6342
- this.preAcceptDockerLicense();
6343
- this.onProgress("__progress__:55:Running Docker installer...");
6352
+ this.onProgress("__progress__:55:Running installer...");
6344
6353
  const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
6345
6354
  try {
6346
6355
  execSync(`/Volumes/Docker/Docker.app/Contents/MacOS/install --accept-license --user=${user}`, {
@@ -6353,7 +6362,7 @@ var DependencyInstaller = class {
6353
6362
  try {
6354
6363
  execSync('cp -R "/Volumes/Docker/Docker.app" /Applications/', { timeout: 6e4, stdio: "ignore" });
6355
6364
  } catch {
6356
- throw new Error("Failed to install Docker Desktop. You may need to run this with admin privileges.");
6365
+ throw new Error("Failed to install. You may need to run this with admin privileges.");
6357
6366
  }
6358
6367
  }
6359
6368
  }
@@ -6365,10 +6374,16 @@ var DependencyInstaller = class {
6365
6374
  await unlink(dmgPath);
6366
6375
  } catch {
6367
6376
  }
6368
- this.onProgress("__progress__:70:Starting Docker engine...");
6369
- this.startDockerDaemon();
6370
- this.hideDockerWindow();
6377
+ this._firstLaunchMode = true;
6378
+ this.onProgress("__progress__:70:Opening Docker \u2014 please accept the license agreement...");
6379
+ try {
6380
+ execFileSync2("open", ["-a", "/Applications/Docker.app"], { timeout: 1e4, stdio: "ignore" });
6381
+ } catch {
6382
+ }
6371
6383
  await this.waitForDocker();
6384
+ this._firstLaunchMode = false;
6385
+ this.configureDockerHeadless();
6386
+ this.hideDockerWindow();
6372
6387
  }
6373
6388
  /**
6374
6389
  * Install Docker Engine on Linux using Docker's official convenience script.
@@ -6556,11 +6571,11 @@ var DependencyInstaller = class {
6556
6571
  const msgIdx = Math.floor(elapsed / 1e4) % msgs.length;
6557
6572
  this.onProgress(`__progress__:${pct}:${msgs[msgIdx]}`);
6558
6573
  }
6559
- if (os === "darwin") this.hideDockerWindow();
6574
+ if (os === "darwin" && !this._firstLaunchMode) this.hideDockerWindow();
6560
6575
  await new Promise((r) => setTimeout(r, 3e3));
6561
6576
  }
6562
6577
  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."
6578
+ "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
6579
  );
6565
6580
  }
6566
6581
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/core",
3
- "version": "0.5.11",
3
+ "version": "0.5.14",
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",