@agenticmail/core 0.5.21 → 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 +5 -0
- package/dist/index.js +75 -74
- package/package.json +1 -1
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:
|
|
5184
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
6250
|
-
|
|
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
|
-
|
|
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.
|
|
@@ -6330,19 +6364,6 @@ var DependencyInstaller = class {
|
|
|
6330
6364
|
);
|
|
6331
6365
|
if (brewResult.exitCode === 0) {
|
|
6332
6366
|
this.onProgress("__progress__:45:Mail server engine installed!");
|
|
6333
|
-
try {
|
|
6334
|
-
execSync(`osascript -e 'quit app "Docker Desktop"' 2>/dev/null`, { timeout: 5e3, stdio: "ignore" });
|
|
6335
|
-
} catch {
|
|
6336
|
-
}
|
|
6337
|
-
try {
|
|
6338
|
-
execSync(`osascript -e 'quit app "Docker"' 2>/dev/null`, { timeout: 5e3, stdio: "ignore" });
|
|
6339
|
-
} catch {
|
|
6340
|
-
}
|
|
6341
|
-
try {
|
|
6342
|
-
execSync("pkill -f Docker.app 2>/dev/null", { timeout: 5e3, stdio: "ignore" });
|
|
6343
|
-
} catch {
|
|
6344
|
-
}
|
|
6345
|
-
await new Promise((r) => setTimeout(r, 3e3));
|
|
6346
6367
|
const appPath = this.findDockerApp();
|
|
6347
6368
|
if (appPath) {
|
|
6348
6369
|
await this.setupExistingDockerApp(appPath);
|
|
@@ -6393,27 +6414,7 @@ var DependencyInstaller = class {
|
|
|
6393
6414
|
await unlink(dmgPath);
|
|
6394
6415
|
} catch {
|
|
6395
6416
|
}
|
|
6396
|
-
this.
|
|
6397
|
-
this.onProgress("__progress__:70:Please accept the Docker license agreement...");
|
|
6398
|
-
try {
|
|
6399
|
-
execFileSync2("open", ["/Applications/Docker.app"], { timeout: 1e4, stdio: "ignore" });
|
|
6400
|
-
} catch {
|
|
6401
|
-
}
|
|
6402
|
-
await this.waitForDocker();
|
|
6403
|
-
this._firstLaunchMode = false;
|
|
6404
|
-
const installBin = "/Applications/Docker.app/Contents/MacOS/install";
|
|
6405
|
-
if (existsSync4(installBin)) {
|
|
6406
|
-
const user = process.env.USER || execSync("whoami", { timeout: 5e3 }).toString().trim();
|
|
6407
|
-
try {
|
|
6408
|
-
execSync(`"${installBin}" --accept-license --user=${user}`, {
|
|
6409
|
-
timeout: 12e4,
|
|
6410
|
-
stdio: "ignore"
|
|
6411
|
-
});
|
|
6412
|
-
} catch {
|
|
6413
|
-
}
|
|
6414
|
-
}
|
|
6415
|
-
this.configureDockerHeadless();
|
|
6416
|
-
this.hideDockerWindow();
|
|
6417
|
+
await this.setupExistingDockerApp("/Applications/Docker.app");
|
|
6417
6418
|
}
|
|
6418
6419
|
/**
|
|
6419
6420
|
* Install Docker Engine on Linux using Docker's official convenience script.
|
|
@@ -6727,7 +6728,7 @@ var DependencyInstaller = class {
|
|
|
6727
6728
|
|
|
6728
6729
|
// src/setup/service.ts
|
|
6729
6730
|
import { execFileSync as execFileSync3, execSync as execSync2 } from "child_process";
|
|
6730
|
-
import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync4, unlinkSync, mkdirSync as
|
|
6731
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync4, unlinkSync, mkdirSync as mkdirSync4 } from "fs";
|
|
6731
6732
|
import { join as join7 } from "path";
|
|
6732
6733
|
import { homedir as homedir6, platform as platform3 } from "os";
|
|
6733
6734
|
var PLIST_LABEL = "com.agenticmail.server";
|
|
@@ -6800,7 +6801,7 @@ var ServiceManager = class {
|
|
|
6800
6801
|
*/
|
|
6801
6802
|
cacheApiEntryPath(entryPath) {
|
|
6802
6803
|
const dataDir = join7(homedir6(), ".agenticmail");
|
|
6803
|
-
if (!existsSync5(dataDir))
|
|
6804
|
+
if (!existsSync5(dataDir)) mkdirSync4(dataDir, { recursive: true });
|
|
6804
6805
|
writeFileSync4(join7(dataDir, "api-entry.path"), entryPath);
|
|
6805
6806
|
}
|
|
6806
6807
|
/**
|
|
@@ -6834,7 +6835,7 @@ var ServiceManager = class {
|
|
|
6834
6835
|
generateStartScript(nodePath, apiEntry) {
|
|
6835
6836
|
const scriptPath = join7(homedir6(), ".agenticmail", "bin", "start-server.sh");
|
|
6836
6837
|
const scriptDir = join7(homedir6(), ".agenticmail", "bin");
|
|
6837
|
-
if (!existsSync5(scriptDir))
|
|
6838
|
+
if (!existsSync5(scriptDir)) mkdirSync4(scriptDir, { recursive: true });
|
|
6838
6839
|
const script = [
|
|
6839
6840
|
"#!/bin/bash",
|
|
6840
6841
|
"# AgenticMail auto-start script",
|
|
@@ -6900,7 +6901,7 @@ var ServiceManager = class {
|
|
|
6900
6901
|
generatePlist(nodePath, apiEntry, configPath) {
|
|
6901
6902
|
const config = JSON.parse(readFileSync3(configPath, "utf-8"));
|
|
6902
6903
|
const logDir = join7(homedir6(), ".agenticmail", "logs");
|
|
6903
|
-
if (!existsSync5(logDir))
|
|
6904
|
+
if (!existsSync5(logDir)) mkdirSync4(logDir, { recursive: true });
|
|
6904
6905
|
const version = this.getVersion();
|
|
6905
6906
|
const startScript = this.generateStartScript(nodePath, apiEntry);
|
|
6906
6907
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -7051,7 +7052,7 @@ WantedBy=default.target
|
|
|
7051
7052
|
const servicePath = this.getServicePath();
|
|
7052
7053
|
if (this.os === "darwin") {
|
|
7053
7054
|
const dir = join7(homedir6(), "Library", "LaunchAgents");
|
|
7054
|
-
if (!existsSync5(dir))
|
|
7055
|
+
if (!existsSync5(dir)) mkdirSync4(dir, { recursive: true });
|
|
7055
7056
|
if (existsSync5(servicePath)) {
|
|
7056
7057
|
try {
|
|
7057
7058
|
execFileSync3("launchctl", ["unload", servicePath], { timeout: 1e4, stdio: "ignore" });
|
|
@@ -7068,7 +7069,7 @@ WantedBy=default.target
|
|
|
7068
7069
|
return { installed: true, message: `Service installed at ${servicePath}` };
|
|
7069
7070
|
} else if (this.os === "linux") {
|
|
7070
7071
|
const dir = join7(homedir6(), ".config", "systemd", "user");
|
|
7071
|
-
if (!existsSync5(dir))
|
|
7072
|
+
if (!existsSync5(dir)) mkdirSync4(dir, { recursive: true });
|
|
7072
7073
|
const unit = this.generateSystemdUnit(nodePath, apiEntry, configPath);
|
|
7073
7074
|
writeFileSync4(servicePath, unit);
|
|
7074
7075
|
try {
|
|
@@ -7228,7 +7229,7 @@ var SetupManager = class {
|
|
|
7228
7229
|
}
|
|
7229
7230
|
}
|
|
7230
7231
|
if (!existsSync6(dataDir)) {
|
|
7231
|
-
|
|
7232
|
+
mkdirSync5(dataDir, { recursive: true });
|
|
7232
7233
|
}
|
|
7233
7234
|
const masterKey = `mk_${randomBytes2(24).toString("hex")}`;
|
|
7234
7235
|
const stalwartPassword = randomBytes2(16).toString("hex");
|
|
@@ -7272,7 +7273,7 @@ IMAP_PORT=143
|
|
|
7272
7273
|
generateDockerFiles(config) {
|
|
7273
7274
|
const dataDir = config.dataDir || join8(homedir7(), ".agenticmail");
|
|
7274
7275
|
if (!existsSync6(dataDir)) {
|
|
7275
|
-
|
|
7276
|
+
mkdirSync5(dataDir, { recursive: true });
|
|
7276
7277
|
}
|
|
7277
7278
|
const password = config.stalwart?.adminPassword || "changeme";
|
|
7278
7279
|
const composePath = join8(dataDir, "docker-compose.yml");
|