@agenticmail/enterprise 0.5.341 → 0.5.343
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/{chunk-MGNDXWOU.js → chunk-2DE62O56.js} +13 -5
- package/dist/{chunk-G5EUEON7.js → chunk-FWGDL7KF.js} +138 -69
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/setup-D7IXATAY.js +20 -0
- package/dist/setup-KHWRJILU.js +20 -0
- package/logs/enterprise-error.log +6 -0
- package/package.json +1 -1
- package/dist/chunk-3RI3AIJN.js +0 -1519
- package/dist/chunk-AD4DFKHR.js +0 -4928
- package/dist/chunk-DWHJYAV6.js +0 -26055
- package/dist/chunk-GNABVGDZ.js +0 -4928
- package/dist/chunk-HTT6LUPP.js +0 -5101
- package/dist/chunk-I25KEJVB.js +0 -1562
- package/dist/chunk-JH76GUKT.js +0 -5101
- package/dist/chunk-KHYCWUTO.js +0 -1539
- package/dist/chunk-PAHT4ABL.js +0 -106
- package/dist/chunk-QCV66KWM.js +0 -1576
- package/dist/chunk-RHO7WRVJ.js +0 -1519
- package/dist/chunk-UQXPVWXG.js +0 -5101
- package/dist/chunk-VIHOFXA4.js +0 -1526
- package/dist/chunk-WEPTZQL7.js +0 -1519
- package/dist/chunk-XMDE2NGH.js +0 -116
|
@@ -436,8 +436,12 @@ async function runCloudSetup(inquirer, chalk, existingSubdomain) {
|
|
|
436
436
|
} catch {
|
|
437
437
|
console.log(chalk.dim(" winget failed, trying direct download..."));
|
|
438
438
|
const archStr = arch() === "arm64" ? "arm64" : "amd64";
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
const localAppData = process.env.LOCALAPPDATA || `${process.env.USERPROFILE}\\AppData\\Local`;
|
|
440
|
+
const cfDir = `${localAppData}\\cloudflared`;
|
|
441
|
+
const cfExe = `${cfDir}\\cloudflared.exe`;
|
|
442
|
+
const dlUrl = `https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-${archStr}.exe`;
|
|
443
|
+
execSync(`powershell -Command "New-Item -ItemType Directory -Force -Path '${cfDir}' | Out-Null; Invoke-WebRequest -Uri '${dlUrl}' -OutFile '${cfExe}'"`, { stdio: "pipe", timeout: 12e4 });
|
|
444
|
+
process.env.PATH = `${cfDir};${process.env.PATH}`;
|
|
441
445
|
}
|
|
442
446
|
} else {
|
|
443
447
|
console.log(chalk.yellow(" Please install cloudflared manually: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/"));
|
|
@@ -1241,8 +1245,12 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
|
|
|
1241
1245
|
execSync2("winget install --id Cloudflare.cloudflared --accept-source-agreements --accept-package-agreements", { stdio: "pipe", timeout: 12e4 });
|
|
1242
1246
|
} catch {
|
|
1243
1247
|
const archStr = process.arch === "arm64" ? "arm64" : "amd64";
|
|
1244
|
-
|
|
1245
|
-
|
|
1248
|
+
const localAppData = process.env.LOCALAPPDATA || `${process.env.USERPROFILE}\\AppData\\Local`;
|
|
1249
|
+
const cfDir = `${localAppData}\\cloudflared`;
|
|
1250
|
+
const cfExe = `${cfDir}\\cloudflared.exe`;
|
|
1251
|
+
const dlUrl = `https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-${archStr}.exe`;
|
|
1252
|
+
execSync2(`powershell -Command "New-Item -ItemType Directory -Force -Path '${cfDir}' | Out-Null; Invoke-WebRequest -Uri '${dlUrl}' -OutFile '${cfExe}'"`, { stdio: "pipe", timeout: 12e4 });
|
|
1253
|
+
process.env.PATH = `${cfDir};${process.env.PATH}`;
|
|
1246
1254
|
}
|
|
1247
1255
|
} else if (process.platform === "darwin") {
|
|
1248
1256
|
execSync2("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
|
|
@@ -1531,7 +1539,7 @@ async function runSetupWizard() {
|
|
|
1531
1539
|
const { default: chalk } = await import("chalk");
|
|
1532
1540
|
console.log("");
|
|
1533
1541
|
console.log(chalk.cyan(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
1534
|
-
console.log(chalk.cyan(" \u2551") + chalk.bold.white(" \
|
|
1542
|
+
console.log(chalk.cyan(" \u2551") + chalk.bold.white(" \u{1F380} AgenticMail Enterprise \u{1F380} ") + chalk.cyan("\u2551"));
|
|
1535
1543
|
console.log(chalk.cyan(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
1536
1544
|
console.log("");
|
|
1537
1545
|
console.log(chalk.bold.white(" The AI Agent Operating System for Organizations"));
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSupportedDatabases
|
|
3
3
|
} from "./chunk-Z3I6GNTS.js";
|
|
4
|
+
import {
|
|
5
|
+
__require
|
|
6
|
+
} from "./chunk-KFQGP6VL.js";
|
|
4
7
|
|
|
5
8
|
// src/setup/index.ts
|
|
6
9
|
import { execSync as execSync3 } from "child_process";
|
|
7
10
|
import { createRequire } from "module";
|
|
8
|
-
import { join as
|
|
11
|
+
import { join as join3 } from "path";
|
|
9
12
|
|
|
10
13
|
// src/setup/company.ts
|
|
11
14
|
function toSlug(name) {
|
|
@@ -256,15 +259,15 @@ async function promptDatabase(inquirer, chalk) {
|
|
|
256
259
|
}
|
|
257
260
|
|
|
258
261
|
// src/setup/deployment.ts
|
|
259
|
-
import { execSync
|
|
262
|
+
import { execSync, exec as execCb } from "child_process";
|
|
260
263
|
import { promisify } from "util";
|
|
261
264
|
import { existsSync, writeFileSync, readFileSync } from "fs";
|
|
262
|
-
import { join } from "path";
|
|
263
|
-
import { homedir, platform, arch } from "os";
|
|
265
|
+
import { join as join2 } from "path";
|
|
266
|
+
import { homedir as homedir2, platform, arch } from "os";
|
|
264
267
|
var execP = promisify(execCb);
|
|
265
268
|
function whichCmd(bin) {
|
|
266
269
|
const cmd = platform() === "win32" ? `where ${bin}` : `which ${bin}`;
|
|
267
|
-
return
|
|
270
|
+
return execSync(cmd, { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split(/\r?\n/)[0];
|
|
268
271
|
}
|
|
269
272
|
var SUBDOMAIN_REGISTRY_URL = process.env.AGENTICMAIL_SUBDOMAIN_REGISTRY_URL || "https://registry.agenticmail.io";
|
|
270
273
|
async function promptDeployment(inquirer, chalk, existingSubdomain) {
|
|
@@ -426,18 +429,22 @@ async function runCloudSetup(inquirer, chalk, existingSubdomain) {
|
|
|
426
429
|
try {
|
|
427
430
|
const os = platform();
|
|
428
431
|
if (os === "darwin") {
|
|
429
|
-
|
|
432
|
+
execSync("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
|
|
430
433
|
} else if (os === "linux") {
|
|
431
434
|
const archStr = arch() === "arm64" ? "arm64" : "amd64";
|
|
432
|
-
|
|
435
|
+
execSync(`curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${archStr} -o /usr/local/bin/cloudflared && chmod +x /usr/local/bin/cloudflared`, { stdio: "pipe", timeout: 12e4 });
|
|
433
436
|
} else if (os === "win32") {
|
|
434
437
|
try {
|
|
435
|
-
|
|
438
|
+
execSync("winget install --id Cloudflare.cloudflared --accept-source-agreements --accept-package-agreements", { stdio: "pipe", timeout: 12e4 });
|
|
436
439
|
} catch {
|
|
437
440
|
console.log(chalk.dim(" winget failed, trying direct download..."));
|
|
438
441
|
const archStr = arch() === "arm64" ? "arm64" : "amd64";
|
|
439
|
-
|
|
440
|
-
|
|
442
|
+
const localAppData = process.env.LOCALAPPDATA || `${process.env.USERPROFILE}\\AppData\\Local`;
|
|
443
|
+
const cfDir = `${localAppData}\\cloudflared`;
|
|
444
|
+
const cfExe = `${cfDir}\\cloudflared.exe`;
|
|
445
|
+
const dlUrl = `https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-${archStr}.exe`;
|
|
446
|
+
execSync(`powershell -Command "New-Item -ItemType Directory -Force -Path '${cfDir}' | Out-Null; Invoke-WebRequest -Uri '${dlUrl}' -OutFile '${cfExe}'"`, { stdio: "pipe", timeout: 12e4 });
|
|
447
|
+
process.env.PATH = `${cfDir};${process.env.PATH}`;
|
|
441
448
|
}
|
|
442
449
|
} else {
|
|
443
450
|
console.log(chalk.yellow(" Please install cloudflared manually: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/"));
|
|
@@ -481,7 +488,7 @@ async function runCloudSetup(inquirer, chalk, existingSubdomain) {
|
|
|
481
488
|
console.log(` ${chalk.cyan("npx @agenticmail/enterprise start")}`);
|
|
482
489
|
console.log("");
|
|
483
490
|
console.log(chalk.dim(" Or let the setup wizard start them with PM2 (next step).\n"));
|
|
484
|
-
const envPath =
|
|
491
|
+
const envPath = join2(homedir2(), ".agenticmail", ".env");
|
|
485
492
|
try {
|
|
486
493
|
let envContent = "";
|
|
487
494
|
if (existsSync(envPath)) {
|
|
@@ -501,7 +508,7 @@ CLOUDFLARED_TOKEN=${tunnelToken}
|
|
|
501
508
|
`;
|
|
502
509
|
}
|
|
503
510
|
const { mkdirSync } = await import("fs");
|
|
504
|
-
mkdirSync(
|
|
511
|
+
mkdirSync(join2(homedir2(), ".agenticmail"), { recursive: true });
|
|
505
512
|
writeFileSync(envPath, envContent, { mode: 384 });
|
|
506
513
|
} catch {
|
|
507
514
|
}
|
|
@@ -522,7 +529,7 @@ async function runTunnelSetup(inquirer, chalk) {
|
|
|
522
529
|
let installed = false;
|
|
523
530
|
let version = "";
|
|
524
531
|
try {
|
|
525
|
-
version =
|
|
532
|
+
version = execSync("cloudflared --version 2>&1", { encoding: "utf8", timeout: 5e3 }).trim();
|
|
526
533
|
installed = true;
|
|
527
534
|
} catch {
|
|
528
535
|
}
|
|
@@ -545,7 +552,7 @@ async function runTunnelSetup(inquirer, chalk) {
|
|
|
545
552
|
console.log(chalk.dim(" Installing..."));
|
|
546
553
|
try {
|
|
547
554
|
await installCloudflared();
|
|
548
|
-
version =
|
|
555
|
+
version = execSync("cloudflared --version 2>&1", { encoding: "utf8", timeout: 5e3 }).trim();
|
|
549
556
|
console.log(chalk.green(` \u2713 Installed (${version})
|
|
550
557
|
`));
|
|
551
558
|
} catch (err) {
|
|
@@ -555,8 +562,8 @@ async function runTunnelSetup(inquirer, chalk) {
|
|
|
555
562
|
}
|
|
556
563
|
}
|
|
557
564
|
console.log(chalk.bold(" 2. Cloudflare Authentication"));
|
|
558
|
-
const cfDir =
|
|
559
|
-
const certPath =
|
|
565
|
+
const cfDir = join2(homedir2(), ".cloudflared");
|
|
566
|
+
const certPath = join2(cfDir, "cert.pem");
|
|
560
567
|
const loggedIn = existsSync(certPath);
|
|
561
568
|
if (loggedIn) {
|
|
562
569
|
console.log(chalk.green(" \u2713 Already authenticated\n"));
|
|
@@ -608,14 +615,14 @@ async function runTunnelSetup(inquirer, chalk) {
|
|
|
608
615
|
let tunnelId = "";
|
|
609
616
|
try {
|
|
610
617
|
console.log(chalk.dim(" Creating tunnel..."));
|
|
611
|
-
const out =
|
|
618
|
+
const out = execSync(`cloudflared tunnel create ${tunnelName} 2>&1`, { encoding: "utf8", timeout: 3e4 });
|
|
612
619
|
const match = out.match(/Created tunnel .+ with id ([a-f0-9-]+)/);
|
|
613
620
|
tunnelId = match?.[1] || "";
|
|
614
621
|
console.log(chalk.green(` \u2713 Tunnel created: ${tunnelName} (${tunnelId})`));
|
|
615
622
|
} catch (e) {
|
|
616
623
|
if (e.message?.includes("already exists") || e.stderr?.includes("already exists")) {
|
|
617
624
|
try {
|
|
618
|
-
const listOut =
|
|
625
|
+
const listOut = execSync("cloudflared tunnel list --output json 2>&1", { encoding: "utf8", timeout: 15e3 });
|
|
619
626
|
const tunnels = JSON.parse(listOut);
|
|
620
627
|
const existing = tunnels.find((t) => t.name === tunnelName);
|
|
621
628
|
if (existing) {
|
|
@@ -637,17 +644,17 @@ async function runTunnelSetup(inquirer, chalk) {
|
|
|
637
644
|
}
|
|
638
645
|
const config = [
|
|
639
646
|
`tunnel: ${tunnelId}`,
|
|
640
|
-
`credentials-file: ${
|
|
647
|
+
`credentials-file: ${join2(cfDir, tunnelId + ".json")}`,
|
|
641
648
|
"",
|
|
642
649
|
"ingress:",
|
|
643
650
|
` - hostname: ${domain}`,
|
|
644
651
|
` service: http://localhost:${port}`,
|
|
645
652
|
" - service: http_status:404"
|
|
646
653
|
].join("\n");
|
|
647
|
-
writeFileSync(
|
|
654
|
+
writeFileSync(join2(cfDir, "config.yml"), config);
|
|
648
655
|
console.log(chalk.green(` \u2713 Config written: ${domain} \u2192 localhost:${port}`));
|
|
649
656
|
try {
|
|
650
|
-
|
|
657
|
+
execSync(`cloudflared tunnel route dns ${tunnelId} ${domain} 2>&1`, { encoding: "utf8", timeout: 3e4 });
|
|
651
658
|
console.log(chalk.green(` \u2713 DNS CNAME created: ${domain}`));
|
|
652
659
|
} catch (e) {
|
|
653
660
|
if (e.message?.includes("already exists") || e.stderr?.includes("already exists")) {
|
|
@@ -660,19 +667,19 @@ async function runTunnelSetup(inquirer, chalk) {
|
|
|
660
667
|
try {
|
|
661
668
|
whichCmd("pm2");
|
|
662
669
|
try {
|
|
663
|
-
|
|
670
|
+
execSync("pm2 delete cloudflared 2>/dev/null", { timeout: 5e3 });
|
|
664
671
|
} catch {
|
|
665
672
|
}
|
|
666
|
-
|
|
673
|
+
execSync(`pm2 start cloudflared --name cloudflared -- tunnel run`, { encoding: "utf8", timeout: 15e3 });
|
|
667
674
|
try {
|
|
668
|
-
|
|
675
|
+
execSync("pm2 save 2>/dev/null", { timeout: 5e3 });
|
|
669
676
|
} catch {
|
|
670
677
|
}
|
|
671
678
|
try {
|
|
672
|
-
const startupOut =
|
|
679
|
+
const startupOut = execSync("pm2 startup 2>&1", { encoding: "utf8", timeout: 15e3 });
|
|
673
680
|
const sudoMatch = startupOut.match(/sudo .+$/m);
|
|
674
681
|
if (sudoMatch) try {
|
|
675
|
-
|
|
682
|
+
execSync(sudoMatch[0], { timeout: 15e3, stdio: "pipe" });
|
|
676
683
|
} catch {
|
|
677
684
|
}
|
|
678
685
|
} catch {
|
|
@@ -684,21 +691,21 @@ async function runTunnelSetup(inquirer, chalk) {
|
|
|
684
691
|
if (!started) {
|
|
685
692
|
try {
|
|
686
693
|
console.log(chalk.dim(" Installing PM2 for process management..."));
|
|
687
|
-
|
|
694
|
+
execSync("npm install -g pm2", { timeout: 6e4, stdio: "pipe" });
|
|
688
695
|
try {
|
|
689
|
-
|
|
696
|
+
execSync("pm2 delete cloudflared 2>/dev/null", { timeout: 5e3 });
|
|
690
697
|
} catch {
|
|
691
698
|
}
|
|
692
|
-
|
|
699
|
+
execSync(`pm2 start cloudflared --name cloudflared -- tunnel run`, { encoding: "utf8", timeout: 15e3 });
|
|
693
700
|
try {
|
|
694
|
-
|
|
701
|
+
execSync("pm2 save 2>/dev/null", { timeout: 5e3 });
|
|
695
702
|
} catch {
|
|
696
703
|
}
|
|
697
704
|
try {
|
|
698
|
-
const startupOut =
|
|
705
|
+
const startupOut = execSync("pm2 startup 2>&1", { encoding: "utf8", timeout: 15e3 });
|
|
699
706
|
const sudoMatch = startupOut.match(/sudo .+$/m);
|
|
700
707
|
if (sudoMatch) try {
|
|
701
|
-
|
|
708
|
+
execSync(sudoMatch[0], { timeout: 15e3, stdio: "pipe" });
|
|
702
709
|
} catch {
|
|
703
710
|
}
|
|
704
711
|
} catch {
|
|
@@ -728,18 +735,18 @@ async function installCloudflared() {
|
|
|
728
735
|
if (plat === "darwin") {
|
|
729
736
|
try {
|
|
730
737
|
whichCmd("brew");
|
|
731
|
-
|
|
738
|
+
execSync("brew install cloudflared 2>&1", { encoding: "utf8", timeout: 12e4 });
|
|
732
739
|
return;
|
|
733
740
|
} catch {
|
|
734
741
|
}
|
|
735
742
|
const cfArch = a === "arm64" ? "arm64" : "amd64";
|
|
736
|
-
|
|
743
|
+
execSync(
|
|
737
744
|
`curl -L -o /usr/local/bin/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-darwin-${cfArch} && chmod +x /usr/local/bin/cloudflared`,
|
|
738
745
|
{ timeout: 6e4 }
|
|
739
746
|
);
|
|
740
747
|
} else if (plat === "linux") {
|
|
741
748
|
const cfArch = a === "arm64" ? "arm64" : "amd64";
|
|
742
|
-
|
|
749
|
+
execSync(
|
|
743
750
|
`curl -L -o /usr/local/bin/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch} && chmod +x /usr/local/bin/cloudflared`,
|
|
744
751
|
{ timeout: 6e4 }
|
|
745
752
|
);
|
|
@@ -1041,6 +1048,7 @@ async function promptRegistration(inquirer, chalk, ora, domain, companyName, adm
|
|
|
1041
1048
|
|
|
1042
1049
|
// src/setup/provision.ts
|
|
1043
1050
|
import { randomUUID, randomBytes as randomBytes2 } from "crypto";
|
|
1051
|
+
import { execSync as execSync2 } from "child_process";
|
|
1044
1052
|
function generateOrgId() {
|
|
1045
1053
|
const chars = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
1046
1054
|
const bytes = randomBytes2(10);
|
|
@@ -1152,13 +1160,13 @@ async function provision(config, ora, chalk) {
|
|
|
1152
1160
|
spinner.succeed("Admin account created");
|
|
1153
1161
|
try {
|
|
1154
1162
|
const { writeFileSync: writeFileSync2, existsSync: existsSync2, mkdirSync } = await import("fs");
|
|
1155
|
-
const { join:
|
|
1156
|
-
const { homedir:
|
|
1157
|
-
const envDir =
|
|
1163
|
+
const { join: join4 } = await import("path");
|
|
1164
|
+
const { homedir: homedir3 } = await import("os");
|
|
1165
|
+
const envDir = join4(homedir3(), ".agenticmail");
|
|
1158
1166
|
if (!existsSync2(envDir)) mkdirSync(envDir, { recursive: true });
|
|
1159
1167
|
const port = config.tunnel?.port || (config.deployTarget === "local" ? 3e3 : void 0) || (config.deployTarget === "docker" ? 3e3 : void 0) || 3200;
|
|
1160
1168
|
let existingEnv = "";
|
|
1161
|
-
const envFilePath =
|
|
1169
|
+
const envFilePath = join4(envDir, ".env");
|
|
1162
1170
|
if (existsSync2(envFilePath)) {
|
|
1163
1171
|
try {
|
|
1164
1172
|
existingEnv = (await import("fs")).readFileSync(envFilePath, "utf8");
|
|
@@ -1184,7 +1192,7 @@ async function provision(config, ora, chalk) {
|
|
|
1184
1192
|
"# BACK UP THIS FILE! You need it to recover on a new machine.",
|
|
1185
1193
|
...Array.from(envMap.entries()).map(([k, v]) => `${k}=${v}`)
|
|
1186
1194
|
].join("\n") + "\n";
|
|
1187
|
-
writeFileSync2(
|
|
1195
|
+
writeFileSync2(join4(envDir, ".env"), envContent, { mode: 384 });
|
|
1188
1196
|
spinner.succeed(`Config saved to ~/.agenticmail/.env`);
|
|
1189
1197
|
} catch {
|
|
1190
1198
|
}
|
|
@@ -1231,55 +1239,68 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
|
|
|
1231
1239
|
spinner.start("Configuring agenticmail.io deployment...");
|
|
1232
1240
|
try {
|
|
1233
1241
|
const whichCmd2 = process.platform === "win32" ? "where" : "which";
|
|
1234
|
-
|
|
1242
|
+
execSync2(`${whichCmd2} cloudflared`, { stdio: "pipe", timeout: 5e3 });
|
|
1235
1243
|
} catch {
|
|
1236
1244
|
spinner.text = "Installing cloudflared...";
|
|
1237
1245
|
try {
|
|
1238
1246
|
if (process.platform === "win32") {
|
|
1239
1247
|
try {
|
|
1240
|
-
|
|
1248
|
+
execSync2("winget install --id Cloudflare.cloudflared --accept-source-agreements --accept-package-agreements", { stdio: "pipe", timeout: 12e4 });
|
|
1241
1249
|
} catch {
|
|
1242
1250
|
const archStr = process.arch === "arm64" ? "arm64" : "amd64";
|
|
1243
|
-
|
|
1244
|
-
|
|
1251
|
+
const localAppData = process.env.LOCALAPPDATA || `${process.env.USERPROFILE}\\AppData\\Local`;
|
|
1252
|
+
const cfDir = `${localAppData}\\cloudflared`;
|
|
1253
|
+
const cfExe = `${cfDir}\\cloudflared.exe`;
|
|
1254
|
+
const dlUrl = `https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-${archStr}.exe`;
|
|
1255
|
+
execSync2(`powershell -Command "New-Item -ItemType Directory -Force -Path '${cfDir}' | Out-Null; Invoke-WebRequest -Uri '${dlUrl}' -OutFile '${cfExe}'"`, { stdio: "pipe", timeout: 12e4 });
|
|
1256
|
+
process.env.PATH = `${cfDir};${process.env.PATH}`;
|
|
1245
1257
|
}
|
|
1246
1258
|
} else if (process.platform === "darwin") {
|
|
1247
|
-
|
|
1259
|
+
execSync2("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
|
|
1248
1260
|
} else {
|
|
1249
1261
|
const archStr = process.arch === "arm64" ? "arm64" : "amd64";
|
|
1250
|
-
|
|
1262
|
+
execSync2(`curl -L -o /usr/local/bin/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${archStr} && chmod +x /usr/local/bin/cloudflared`, { stdio: "pipe", timeout: 12e4 });
|
|
1251
1263
|
}
|
|
1252
1264
|
} catch {
|
|
1253
1265
|
}
|
|
1254
1266
|
}
|
|
1255
1267
|
try {
|
|
1256
|
-
|
|
1268
|
+
execSync2("npm ls -g pm2 --depth=0", { stdio: "pipe", timeout: 1e4 });
|
|
1257
1269
|
} catch {
|
|
1258
1270
|
spinner.text = "Installing PM2 process manager...";
|
|
1259
1271
|
try {
|
|
1260
|
-
|
|
1272
|
+
execSync2("npm install -g pm2", { stdio: "pipe", timeout: 6e4 });
|
|
1261
1273
|
} catch {
|
|
1262
1274
|
}
|
|
1263
1275
|
}
|
|
1264
1276
|
try {
|
|
1265
1277
|
try {
|
|
1266
|
-
|
|
1278
|
+
execSync2("pm2 delete cloudflared 2>&1", { stdio: "pipe", timeout: 1e4 });
|
|
1279
|
+
} catch {
|
|
1280
|
+
}
|
|
1281
|
+
try {
|
|
1282
|
+
execSync2("pm2 delete enterprise 2>&1", { stdio: "pipe", timeout: 1e4 });
|
|
1267
1283
|
} catch {
|
|
1268
1284
|
}
|
|
1285
|
+
let cfPath = "cloudflared";
|
|
1269
1286
|
try {
|
|
1270
|
-
|
|
1287
|
+
const whichBin = process.platform === "win32" ? "where" : "which";
|
|
1288
|
+
cfPath = execSync2(`${whichBin} cloudflared`, { encoding: "utf8", timeout: 5e3 }).trim().split("\n")[0].trim();
|
|
1271
1289
|
} catch {
|
|
1272
1290
|
}
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1291
|
+
execSync2(`pm2 start "${cfPath}" --name cloudflared --interpreter none -- tunnel --no-autoupdate run --token ${cloud.tunnelToken}`, { stdio: "pipe", timeout: 15e3 });
|
|
1292
|
+
const envFile = join(homedir(), ".agenticmail", ".env");
|
|
1293
|
+
const entryPoint = join(__require.resolve("@agenticmail/enterprise/package.json"), "..", "bin", "agenticmail-enterprise.cjs");
|
|
1294
|
+
let startCmd;
|
|
1295
|
+
try {
|
|
1296
|
+
const { statSync } = __require("fs");
|
|
1297
|
+
statSync(entryPoint);
|
|
1298
|
+
startCmd = `pm2 start "${process.execPath}" --name enterprise -- "${entryPoint}" start`;
|
|
1299
|
+
} catch {
|
|
1300
|
+
const npxPath = process.platform === "win32" ? join(process.env.APPDATA || "", "npm", "npx.cmd") : "npx";
|
|
1301
|
+
startCmd = `pm2 start "${npxPath}" --name enterprise -- @agenticmail/enterprise start`;
|
|
1302
|
+
}
|
|
1303
|
+
execSync2(startCmd, {
|
|
1283
1304
|
stdio: "pipe",
|
|
1284
1305
|
timeout: 15e3,
|
|
1285
1306
|
env: {
|
|
@@ -1291,15 +1312,30 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
|
|
|
1291
1312
|
AGENTICMAIL_DOMAIN: cloud.fqdn
|
|
1292
1313
|
}
|
|
1293
1314
|
});
|
|
1315
|
+
await new Promise((r) => setTimeout(r, 3e3));
|
|
1294
1316
|
try {
|
|
1295
|
-
|
|
1317
|
+
const jlist = execSync2("pm2 jlist", { encoding: "utf8", timeout: 1e4 });
|
|
1318
|
+
const procs = JSON.parse(jlist);
|
|
1319
|
+
const cfProc = procs.find((p) => p.name === "cloudflared");
|
|
1320
|
+
const entProc = procs.find((p) => p.name === "enterprise");
|
|
1321
|
+
if (cfProc?.pm2_env?.status !== "online") {
|
|
1322
|
+
throw new Error("cloudflared not running");
|
|
1323
|
+
}
|
|
1324
|
+
if (entProc?.pm2_env?.status !== "online") {
|
|
1325
|
+
throw new Error("enterprise server not running");
|
|
1326
|
+
}
|
|
1327
|
+
} catch (verifyErr) {
|
|
1328
|
+
throw new Error(`Processes not healthy: ${verifyErr.message}`);
|
|
1329
|
+
}
|
|
1330
|
+
try {
|
|
1331
|
+
execSync2("pm2 save", { timeout: 1e4, stdio: "pipe" });
|
|
1296
1332
|
} catch {
|
|
1297
1333
|
}
|
|
1298
1334
|
try {
|
|
1299
|
-
const startupOut =
|
|
1335
|
+
const startupOut = execSync2("pm2 startup 2>&1", { encoding: "utf8", timeout: 15e3 });
|
|
1300
1336
|
const sudoMatch = startupOut.match(/sudo .+$/m);
|
|
1301
1337
|
if (sudoMatch) try {
|
|
1302
|
-
|
|
1338
|
+
execSync2(sudoMatch[0], { timeout: 15e3, stdio: "pipe" });
|
|
1303
1339
|
} catch {
|
|
1304
1340
|
}
|
|
1305
1341
|
} catch {
|
|
@@ -1308,9 +1344,42 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
|
|
|
1308
1344
|
console.log(chalk.dim(" PM2 will auto-restart on crash and survive reboots."));
|
|
1309
1345
|
} catch (e) {
|
|
1310
1346
|
spinner.warn(`PM2 setup failed: ${e.message}`);
|
|
1311
|
-
console.log(
|
|
1312
|
-
|
|
1313
|
-
|
|
1347
|
+
console.log(chalk.dim(" Starting processes directly instead...\n"));
|
|
1348
|
+
const { spawn } = __require("child_process");
|
|
1349
|
+
let cfPath = "cloudflared";
|
|
1350
|
+
try {
|
|
1351
|
+
const whichBin = process.platform === "win32" ? "where" : "which";
|
|
1352
|
+
cfPath = execSync2(`${whichBin} cloudflared`, { encoding: "utf8", timeout: 5e3 }).trim().split("\n")[0].trim();
|
|
1353
|
+
} catch {
|
|
1354
|
+
}
|
|
1355
|
+
const cfProc = spawn(cfPath, ["tunnel", "--no-autoupdate", "run", "--token", cloud.tunnelToken], {
|
|
1356
|
+
detached: true,
|
|
1357
|
+
stdio: "ignore",
|
|
1358
|
+
env: process.env
|
|
1359
|
+
});
|
|
1360
|
+
cfProc.unref();
|
|
1361
|
+
const entProc = spawn(process.execPath, [
|
|
1362
|
+
"-e",
|
|
1363
|
+
`process.env.PORT='${cloud.port || 8080}';process.env.DATABASE_URL='${(database.connectionString || "").replace(/'/g, "\\'")}';process.env.JWT_SECRET='${jwtSecret}';process.env.AGENTICMAIL_VAULT_KEY='${vaultKey}';process.env.AGENTICMAIL_DOMAIN='${cloud.fqdn}';require('@agenticmail/enterprise/dist/cli.js');`,
|
|
1364
|
+
"--",
|
|
1365
|
+
"start"
|
|
1366
|
+
], {
|
|
1367
|
+
detached: true,
|
|
1368
|
+
stdio: "ignore",
|
|
1369
|
+
env: {
|
|
1370
|
+
...process.env,
|
|
1371
|
+
PORT: String(cloud.port || 8080),
|
|
1372
|
+
DATABASE_URL: database.connectionString || "",
|
|
1373
|
+
JWT_SECRET: jwtSecret,
|
|
1374
|
+
AGENTICMAIL_VAULT_KEY: vaultKey,
|
|
1375
|
+
AGENTICMAIL_DOMAIN: cloud.fqdn
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
entProc.unref();
|
|
1379
|
+
await new Promise((r) => setTimeout(r, 5e3));
|
|
1380
|
+
spinner.succeed(`Live at https://${cloud.fqdn}`);
|
|
1381
|
+
console.log(chalk.yellow(" Note: Processes running in background. They will stop when you close this terminal."));
|
|
1382
|
+
console.log(chalk.dim(" For persistence, install PM2: npm install -g pm2"));
|
|
1314
1383
|
}
|
|
1315
1384
|
console.log("");
|
|
1316
1385
|
console.log(chalk.bold.green(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -1490,7 +1559,7 @@ async function ensureDbDriver(dbType, ora, chalk) {
|
|
|
1490
1559
|
}
|
|
1491
1560
|
if (!found) {
|
|
1492
1561
|
try {
|
|
1493
|
-
const req = createRequire(
|
|
1562
|
+
const req = createRequire(join3(process.cwd(), "index.js"));
|
|
1494
1563
|
req.resolve(pkg);
|
|
1495
1564
|
found = true;
|
|
1496
1565
|
} catch {
|
|
@@ -1499,7 +1568,7 @@ async function ensureDbDriver(dbType, ora, chalk) {
|
|
|
1499
1568
|
if (!found) {
|
|
1500
1569
|
try {
|
|
1501
1570
|
const globalPrefix = execSync3("npm prefix -g", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
1502
|
-
const req = createRequire(
|
|
1571
|
+
const req = createRequire(join3(globalPrefix, "lib", "node_modules", ".package-lock.json"));
|
|
1503
1572
|
req.resolve(pkg);
|
|
1504
1573
|
found = true;
|
|
1505
1574
|
} catch {
|
|
@@ -1530,7 +1599,7 @@ async function runSetupWizard() {
|
|
|
1530
1599
|
const { default: chalk } = await import("chalk");
|
|
1531
1600
|
console.log("");
|
|
1532
1601
|
console.log(chalk.cyan(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
|
|
1533
|
-
console.log(chalk.cyan(" \u2551") + chalk.bold.white(" \
|
|
1602
|
+
console.log(chalk.cyan(" \u2551") + chalk.bold.white(" \u{1F380} AgenticMail Enterprise \u{1F380} ") + chalk.cyan("\u2551"));
|
|
1534
1603
|
console.log(chalk.cyan(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
|
|
1535
1604
|
console.log("");
|
|
1536
1605
|
console.log(chalk.bold.white(" The AI Agent Operating System for Organizations"));
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-2DE62O56.js";
|
|
10
|
+
import "./chunk-Z3I6GNTS.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-FWGDL7KF.js";
|
|
10
|
+
import "./chunk-Z3I6GNTS.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
2026-03-05 16:03:41: [chat-poller] Error polling Agentic Mail Support Space: The operation was aborted due to timeout
|
|
2
|
+
2026-03-05 16:03:41: [chat-poller] 1 consecutive errors, backing off 30s
|
|
3
|
+
2026-03-05 16:07:41: [chat-poller] Error polling Agentic Mail Support Space: The operation was aborted due to timeout
|
|
4
|
+
2026-03-05 16:07:41: [chat-poller] 1 consecutive errors, backing off 30s
|
|
5
|
+
2026-03-05 16:18:12: [chat-poller] Error polling Agentic Mail Support Space: The operation was aborted due to timeout
|
|
6
|
+
2026-03-05 16:18:12: [chat-poller] 1 consecutive errors, backing off 30s
|