@agenticmail/enterprise 0.5.434 → 0.5.435

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.
@@ -0,0 +1,286 @@
1
+ import "./chunk-KFQGP6VL.js";
2
+
3
+ // src/cli-serve.ts
4
+ import { existsSync, readFileSync } from "fs";
5
+ import { join } from "path";
6
+ import { homedir } from "os";
7
+ function loadEnvFile() {
8
+ const candidates = [
9
+ join(process.cwd(), ".env"),
10
+ join(homedir(), ".agenticmail", ".env")
11
+ ];
12
+ for (const envPath of candidates) {
13
+ if (!existsSync(envPath)) continue;
14
+ try {
15
+ const content = readFileSync(envPath, "utf8");
16
+ for (const line of content.split("\n")) {
17
+ const trimmed = line.trim();
18
+ if (!trimmed || trimmed.startsWith("#")) continue;
19
+ const eq = trimmed.indexOf("=");
20
+ if (eq < 0) continue;
21
+ const key = trimmed.slice(0, eq).trim();
22
+ let val = trimmed.slice(eq + 1).trim();
23
+ if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
24
+ val = val.slice(1, -1);
25
+ }
26
+ if (!process.env[key]) process.env[key] = val;
27
+ }
28
+ console.log(`Loaded config from ${envPath}`);
29
+ return;
30
+ } catch {
31
+ }
32
+ }
33
+ }
34
+ async function ensureSecrets() {
35
+ const { randomUUID } = await import("crypto");
36
+ const envDir = join(homedir(), ".agenticmail");
37
+ const envPath = join(envDir, ".env");
38
+ let dirty = false;
39
+ if (!process.env.JWT_SECRET) {
40
+ process.env.JWT_SECRET = randomUUID() + randomUUID();
41
+ dirty = true;
42
+ console.log("[startup] Generated new JWT_SECRET (existing sessions will need to re-login)");
43
+ }
44
+ if (!process.env.AGENTICMAIL_VAULT_KEY) {
45
+ process.env.AGENTICMAIL_VAULT_KEY = randomUUID() + randomUUID();
46
+ dirty = true;
47
+ console.log("[startup] Generated new AGENTICMAIL_VAULT_KEY");
48
+ console.log("[startup] \u26A0\uFE0F Previously encrypted credentials will need to be re-entered in the dashboard");
49
+ }
50
+ if (dirty) {
51
+ try {
52
+ if (!existsSync(envDir)) {
53
+ const { mkdirSync } = await import("fs");
54
+ mkdirSync(envDir, { recursive: true });
55
+ }
56
+ const { appendFileSync } = await import("fs");
57
+ const lines = [];
58
+ let existing = "";
59
+ if (existsSync(envPath)) {
60
+ existing = readFileSync(envPath, "utf8");
61
+ }
62
+ if (!existing.includes("JWT_SECRET=")) {
63
+ lines.push(`JWT_SECRET=${process.env.JWT_SECRET}`);
64
+ }
65
+ if (!existing.includes("AGENTICMAIL_VAULT_KEY=")) {
66
+ lines.push(`AGENTICMAIL_VAULT_KEY=${process.env.AGENTICMAIL_VAULT_KEY}`);
67
+ }
68
+ if (lines.length) {
69
+ appendFileSync(envPath, "\n" + lines.join("\n") + "\n", { mode: 384 });
70
+ console.log(`[startup] Saved secrets to ${envPath}`);
71
+ }
72
+ } catch (e) {
73
+ console.warn(`[startup] Could not save secrets to ${envPath}: ${e.message}`);
74
+ }
75
+ }
76
+ }
77
+ async function runServe(_args) {
78
+ loadEnvFile();
79
+ const DATABASE_URL = process.env.DATABASE_URL;
80
+ const PORT = parseInt(process.env.PORT || "8080", 10);
81
+ await ensureSecrets();
82
+ const JWT_SECRET = process.env.JWT_SECRET;
83
+ const _VAULT_KEY = process.env.AGENTICMAIL_VAULT_KEY;
84
+ if (!DATABASE_URL) {
85
+ console.error("ERROR: DATABASE_URL is required.");
86
+ console.error("");
87
+ console.error("Set it via environment variable or .env file:");
88
+ console.error(" DATABASE_URL=postgresql://user:pass@host:5432/db npx @agenticmail/enterprise start");
89
+ console.error("");
90
+ console.error("Or create a .env file (in cwd or ~/.agenticmail/.env):");
91
+ console.error(" DATABASE_URL=postgresql://user:pass@host:5432/db");
92
+ console.error(" JWT_SECRET=your-secret-here");
93
+ console.error(" PORT=3200");
94
+ process.exit(1);
95
+ }
96
+ const { createAdapter, smartDbConfig } = await import("./factory-XRYYBBCW.js");
97
+ const { createServer } = await import("./server-VJXEKR3D.js");
98
+ const db = await createAdapter(smartDbConfig(DATABASE_URL));
99
+ await db.migrate();
100
+ const server = createServer({
101
+ port: PORT,
102
+ db,
103
+ jwtSecret: JWT_SECRET,
104
+ corsOrigins: ["*"]
105
+ });
106
+ await server.start();
107
+ console.log(`AgenticMail Enterprise server running on :${PORT}`);
108
+ try {
109
+ const { startBackgroundUpdateCheck } = await import("./cli-update-SX7GACL3.js");
110
+ startBackgroundUpdateCheck();
111
+ } catch {
112
+ }
113
+ try {
114
+ const { startPreventSleep } = await import("./screen-unlock-4RPZBHOI.js");
115
+ const adminDb = server.getAdminDb?.() || server.adminDb;
116
+ if (adminDb) {
117
+ const settings = await adminDb.getSettings?.().catch(() => null);
118
+ const screenAccess = settings?.securityConfig?.screenAccess;
119
+ if (screenAccess?.enabled && screenAccess?.preventSleep) {
120
+ startPreventSleep();
121
+ console.log("[startup] Prevent-sleep enabled \u2014 system will stay awake while agents are active");
122
+ }
123
+ }
124
+ } catch {
125
+ }
126
+ try {
127
+ await setupSystemPersistence();
128
+ } catch (e) {
129
+ console.warn("[startup] System persistence setup skipped: " + e.message);
130
+ }
131
+ const tunnelToken = process.env.CLOUDFLARED_TOKEN;
132
+ if (tunnelToken) {
133
+ try {
134
+ const { execSync, spawn } = await import("child_process");
135
+ try {
136
+ execSync(process.platform === "win32" ? "where cloudflared" : "which cloudflared", { timeout: 3e3 });
137
+ } catch {
138
+ console.log("[startup] cloudflared not found \u2014 skipping tunnel auto-start");
139
+ console.log("[startup] Install cloudflared to enable tunnel: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/");
140
+ return;
141
+ }
142
+ try {
143
+ if (process.platform === "win32") {
144
+ const tasklist = execSync('tasklist /FI "IMAGENAME eq cloudflared.exe" /NH', { encoding: "utf8", timeout: 5e3 });
145
+ if (tasklist.includes("cloudflared.exe")) {
146
+ console.log("[startup] cloudflared tunnel already running");
147
+ return;
148
+ }
149
+ } else {
150
+ execSync('pgrep -f "cloudflared.*tunnel.*run"', { timeout: 3e3 });
151
+ console.log("[startup] cloudflared tunnel already running");
152
+ return;
153
+ }
154
+ } catch {
155
+ }
156
+ const subdomain = process.env.AGENTICMAIL_SUBDOMAIN || process.env.AGENTICMAIL_DOMAIN || "";
157
+ console.log(`[startup] Starting cloudflared tunnel${subdomain ? ` for ${subdomain}.agenticmail.io` : ""}...`);
158
+ let cfBin = "cloudflared";
159
+ if (process.platform === "win32") {
160
+ try {
161
+ cfBin = execSync("where cloudflared", { encoding: "utf8", timeout: 3e3 }).trim().split("\n")[0].trim();
162
+ } catch {
163
+ const candidate = `${process.env.LOCALAPPDATA || ""}\\cloudflared\\cloudflared.exe`;
164
+ try {
165
+ (await import("fs")).statSync(candidate);
166
+ cfBin = candidate;
167
+ } catch {
168
+ }
169
+ }
170
+ }
171
+ const child = spawn(cfBin, ["tunnel", "--no-autoupdate", "run", "--token", tunnelToken], {
172
+ detached: true,
173
+ stdio: "ignore"
174
+ });
175
+ child.unref();
176
+ console.log("[startup] cloudflared tunnel started (pid " + child.pid + ")");
177
+ } catch (e) {
178
+ console.warn("[startup] Could not auto-start cloudflared: " + e.message);
179
+ }
180
+ }
181
+ }
182
+ async function setupSystemPersistence() {
183
+ const { execSync, spawnSync } = await import("child_process");
184
+ const { existsSync: exists, writeFileSync, mkdirSync } = await import("fs");
185
+ const { join: pathJoin } = await import("path");
186
+ const platform = process.platform;
187
+ if (!process.env.PM2_HOME && !process.env.pm_id) {
188
+ return;
189
+ }
190
+ const markerDir = pathJoin(homedir(), ".agenticmail");
191
+ const markerFile = pathJoin(markerDir, ".persistence-configured");
192
+ if (exists(markerFile)) {
193
+ try {
194
+ execSync("pm2 save --silent", { timeout: 1e4, stdio: "ignore" });
195
+ } catch {
196
+ }
197
+ return;
198
+ }
199
+ console.log("[startup] Configuring system persistence (one-time setup)...");
200
+ try {
201
+ if (platform === "darwin") {
202
+ const result = spawnSync("pm2", ["startup", "launchd", "--silent"], {
203
+ timeout: 15e3,
204
+ stdio: "pipe",
205
+ encoding: "utf-8"
206
+ });
207
+ const output = (result.stdout || "") + (result.stderr || "");
208
+ const sudoMatch = output.match(/sudo\s+env\s+.*pm2\s+startup.*/);
209
+ if (sudoMatch) {
210
+ console.log("[startup] PM2 startup requires sudo. Run this once:");
211
+ console.log(" " + sudoMatch[0]);
212
+ } else {
213
+ console.log("[startup] PM2 startup configured (launchd)");
214
+ }
215
+ const plistPath = pathJoin(homedir(), "Library", "LaunchAgents", `pm2.${process.env.USER || "user"}.plist`);
216
+ if (exists(plistPath)) {
217
+ try {
218
+ execSync(`launchctl load -w "${plistPath}"`, { timeout: 5e3, stdio: "ignore" });
219
+ } catch {
220
+ }
221
+ }
222
+ } else if (platform === "linux") {
223
+ const result = spawnSync("pm2", ["startup", "systemd", "--silent"], {
224
+ timeout: 15e3,
225
+ stdio: "pipe",
226
+ encoding: "utf-8"
227
+ });
228
+ const output = (result.stdout || "") + (result.stderr || "");
229
+ const sudoMatch = output.match(/sudo\s+env\s+.*pm2\s+startup.*/);
230
+ if (sudoMatch) {
231
+ try {
232
+ execSync(sudoMatch[0], { timeout: 15e3, stdio: "ignore" });
233
+ console.log("[startup] PM2 startup configured (systemd)");
234
+ } catch {
235
+ console.log("[startup] PM2 startup requires root. Run this once:");
236
+ console.log(" " + sudoMatch[0]);
237
+ }
238
+ } else {
239
+ console.log("[startup] PM2 startup configured (systemd)");
240
+ }
241
+ } else if (platform === "win32") {
242
+ try {
243
+ execSync("npm list -g pm2-windows-startup", { timeout: 1e4, stdio: "ignore" });
244
+ } catch {
245
+ console.log("[startup] Installing pm2-windows-startup...");
246
+ try {
247
+ execSync("npm install -g pm2-windows-startup", { timeout: 6e4, stdio: "ignore" });
248
+ execSync("pm2-startup install", { timeout: 15e3, stdio: "ignore" });
249
+ console.log("[startup] PM2 startup configured (Windows Service)");
250
+ } catch (e) {
251
+ console.warn("[startup] Could not install pm2-windows-startup: " + e.message);
252
+ }
253
+ }
254
+ }
255
+ } catch (e) {
256
+ console.warn("[startup] PM2 startup setup: " + e.message);
257
+ }
258
+ try {
259
+ const moduleList = execSync("pm2 ls --silent 2>/dev/null || true", { timeout: 1e4, encoding: "utf-8" });
260
+ if (!moduleList.includes("pm2-logrotate")) {
261
+ console.log("[startup] Installing pm2-logrotate...");
262
+ execSync("pm2 install pm2-logrotate --silent", { timeout: 6e4, stdio: "ignore" });
263
+ execSync("pm2 set pm2-logrotate:max_size 10M --silent", { timeout: 5e3, stdio: "ignore" });
264
+ execSync("pm2 set pm2-logrotate:retain 5 --silent", { timeout: 5e3, stdio: "ignore" });
265
+ execSync("pm2 set pm2-logrotate:compress true --silent", { timeout: 5e3, stdio: "ignore" });
266
+ console.log("[startup] Log rotation configured (10MB, 5 files)");
267
+ }
268
+ } catch {
269
+ }
270
+ try {
271
+ execSync("pm2 save --silent", { timeout: 1e4, stdio: "ignore" });
272
+ console.log("[startup] Process list saved");
273
+ } catch {
274
+ }
275
+ try {
276
+ if (!exists(markerDir)) mkdirSync(markerDir, { recursive: true });
277
+ writeFileSync(markerFile, (/* @__PURE__ */ new Date()).toISOString() + `
278
+ platform=${platform}
279
+ `, { mode: 384 });
280
+ console.log("[startup] System persistence configured successfully");
281
+ } catch {
282
+ }
283
+ }
284
+ export {
285
+ runServe
286
+ };
@@ -0,0 +1,282 @@
1
+ import "./chunk-KFQGP6VL.js";
2
+
3
+ // src/cli-update.ts
4
+ import { execSync } from "child_process";
5
+ import { readFileSync, writeFileSync, existsSync } from "fs";
6
+ import { join } from "path";
7
+ import { homedir, platform } from "os";
8
+ var PKG_NAME = "@agenticmail/enterprise";
9
+ function getCurrentVersion() {
10
+ try {
11
+ const pkgPath = join(import.meta.dirname || __dirname, "..", "package.json");
12
+ if (existsSync(pkgPath)) {
13
+ return JSON.parse(readFileSync(pkgPath, "utf-8")).version;
14
+ }
15
+ } catch {
16
+ }
17
+ try {
18
+ const out = execSync(`npm ls -g ${PKG_NAME} --json 2>/dev/null`, { encoding: "utf-8", timeout: 1e4 });
19
+ const data = JSON.parse(out);
20
+ return data.dependencies?.[PKG_NAME]?.version || "unknown";
21
+ } catch {
22
+ }
23
+ return "unknown";
24
+ }
25
+ async function getLatestVersion() {
26
+ try {
27
+ const res = await fetch(`https://registry.npmjs.org/${PKG_NAME}/latest`, {
28
+ headers: { "Accept": "application/json" },
29
+ signal: AbortSignal.timeout(1e4)
30
+ });
31
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
32
+ const data = await res.json();
33
+ return data.version;
34
+ } catch {
35
+ try {
36
+ return execSync(`npm view ${PKG_NAME} version 2>/dev/null`, { encoding: "utf-8", timeout: 1e4 }).trim();
37
+ } catch {
38
+ }
39
+ }
40
+ return "unknown";
41
+ }
42
+ async function checkForUpdate() {
43
+ const current = getCurrentVersion();
44
+ const latest = await getLatestVersion();
45
+ const updateAvailable = latest !== "unknown" && current !== "unknown" && latest !== current;
46
+ let releaseNotes;
47
+ let releaseUrl;
48
+ if (updateAvailable) {
49
+ try {
50
+ const ghRes = await fetch(`https://api.github.com/repos/agenticmail/enterprise/releases/tags/v${latest}`, {
51
+ headers: { "Accept": "application/vnd.github.v3+json", "User-Agent": "AgenticMail-Enterprise" },
52
+ signal: AbortSignal.timeout(5e3)
53
+ });
54
+ if (ghRes.ok) {
55
+ const gh = await ghRes.json();
56
+ releaseNotes = gh.body || void 0;
57
+ releaseUrl = gh.html_url || void 0;
58
+ }
59
+ } catch {
60
+ }
61
+ }
62
+ const info = {
63
+ current,
64
+ latest,
65
+ updateAvailable,
66
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
67
+ releaseNotes,
68
+ releaseUrl
69
+ };
70
+ try {
71
+ const cacheDir = join(homedir(), ".agenticmail");
72
+ const cachePath = join(cacheDir, "update-check.json");
73
+ const safeInfo = { current: String(info.current), latest: String(info.latest), updateAvailable: Boolean(info.updateAvailable), checkedAt: String(info.checkedAt), releaseNotes: info.releaseNotes ? String(info.releaseNotes).slice(0, 1e4) : void 0, releaseUrl: info.releaseUrl ? String(info.releaseUrl).slice(0, 500) : void 0 };
74
+ writeFileSync(cachePath, JSON.stringify(safeInfo, null, 2));
75
+ } catch {
76
+ }
77
+ return info;
78
+ }
79
+ function getCachedUpdateCheck() {
80
+ try {
81
+ const cachePath = join(homedir(), ".agenticmail", "update-check.json");
82
+ if (existsSync(cachePath)) {
83
+ return JSON.parse(readFileSync(cachePath, "utf-8"));
84
+ }
85
+ } catch {
86
+ }
87
+ return null;
88
+ }
89
+ async function performUpdate(options) {
90
+ const current = getCurrentVersion();
91
+ console.log(`
92
+ \u{1F380} AgenticMail Enterprise Update
93
+ `);
94
+ console.log(` Current version: ${current}`);
95
+ const latest = await getLatestVersion();
96
+ console.log(` Latest version: ${latest}`);
97
+ if (latest === current) {
98
+ console.log(`
99
+ \u2705 Already up to date!
100
+ `);
101
+ return { success: true, from: current, to: current, message: "Already up to date" };
102
+ }
103
+ if (latest === "unknown") {
104
+ console.log(`
105
+ \u274C Could not determine latest version
106
+ `);
107
+ return { success: false, from: current, to: "unknown", message: "Could not determine latest version" };
108
+ }
109
+ if (!/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(latest)) {
110
+ return { success: false, from: current, to: latest, message: `Invalid version format: ${latest}` };
111
+ }
112
+ console.log(`
113
+ \u{1F4E6} Installing ${PKG_NAME}@${latest}...`);
114
+ try {
115
+ execSync(`npm install -g --loglevel=error ${PKG_NAME}@${latest}`, {
116
+ stdio: "inherit",
117
+ timeout: 12e4
118
+ });
119
+ } catch (err) {
120
+ console.error(`
121
+ \u274C Update failed: ${err.message}
122
+ `);
123
+ return { success: false, from: current, to: latest, message: `npm install failed: ${err.message}` };
124
+ }
125
+ const newVersion = getCurrentVersion();
126
+ console.log(`
127
+ \u2705 Updated to v${newVersion}`);
128
+ if (options?.restart !== false) {
129
+ console.log(` \u{1F504} Restarting services...`);
130
+ try {
131
+ const jlist = execSync('pm2 jlist 2>/dev/null || echo "[]"', { encoding: "utf-8", timeout: 1e4 });
132
+ const procs = JSON.parse(jlist);
133
+ const amProcs = procs.filter((p) => {
134
+ const script = p.pm2_env?.pm_exec_path || "";
135
+ return script.includes("agenticmail") || script.includes("enterprise");
136
+ });
137
+ if (amProcs.length > 0) {
138
+ const sorted = amProcs.sort((a, b) => {
139
+ const aIsServer = a.name === "enterprise" || a.name === "agenticmail";
140
+ const bIsServer = b.name === "enterprise" || b.name === "agenticmail";
141
+ return aIsServer ? 1 : bIsServer ? -1 : 0;
142
+ });
143
+ for (const proc of sorted) {
144
+ const safeName = String(proc.name).replace(/[^a-zA-Z0-9_-]/g, "");
145
+ if (!safeName) continue;
146
+ console.log(` Restarting: ${safeName}`);
147
+ try {
148
+ execSync(`pm2 restart ${safeName}`, { stdio: "inherit", timeout: 15e3 });
149
+ } catch {
150
+ }
151
+ }
152
+ try {
153
+ execSync("pm2 save", { stdio: "ignore", timeout: 1e4 });
154
+ } catch {
155
+ }
156
+ console.log(` \u2705 All services restarted`);
157
+ } else {
158
+ console.log(` \u26A0\uFE0F No PM2 processes found \u2014 restart manually if needed`);
159
+ }
160
+ } catch (err) {
161
+ console.log(` \u26A0\uFE0F Could not restart PM2: ${err.message}`);
162
+ console.log(` Run manually: pm2 restart enterprise && pm2 save`);
163
+ }
164
+ }
165
+ console.log("");
166
+ return { success: true, from: current, to: newVersion, message: `Updated from ${current} to ${newVersion}` };
167
+ }
168
+ function setupAutoUpdateCron() {
169
+ console.log(`
170
+ \u{1F380} Auto-Update Cron Setup
171
+ `);
172
+ const isWindows = platform() === "win32";
173
+ if (isWindows) {
174
+ const taskName = "AgenticMailEnterprise-AutoUpdate";
175
+ const cmd = `npm install -g ${PKG_NAME}@latest && pm2 restart enterprise && pm2 save`;
176
+ console.log(` Creating Windows Task Scheduler entry...`);
177
+ console.log(` Task: ${taskName}`);
178
+ console.log(` Schedule: Every 6 hours
179
+ `);
180
+ try {
181
+ execSync(
182
+ `schtasks /create /tn "${taskName}" /tr "cmd /c ${cmd}" /sc HOURLY /mo 6 /f`,
183
+ { stdio: "inherit" }
184
+ );
185
+ console.log(` \u2705 Auto-update scheduled!`);
186
+ console.log(` To remove: schtasks /delete /tn "${taskName}" /f
187
+ `);
188
+ } catch (err) {
189
+ console.error(` \u274C Failed: ${err.message}`);
190
+ console.log(` Manual alternative:`);
191
+ console.log(` schtasks /create /tn "${taskName}" /tr "cmd /c ${cmd}" /sc HOURLY /mo 6
192
+ `);
193
+ }
194
+ } else {
195
+ const npmPath = execSync("which npm", { encoding: "utf-8" }).trim();
196
+ const pm2Path = execSync("which pm2 2>/dev/null || echo pm2", { encoding: "utf-8" }).trim();
197
+ const cronLine = `0 */6 * * * ${npmPath} install -g ${PKG_NAME}@latest && ${pm2Path} restart enterprise && ${pm2Path} save 2>/dev/null`;
198
+ const cronTag = "# agenticmail-auto-update";
199
+ console.log(` Adding cron job (every 6 hours):
200
+ `);
201
+ console.log(` ${cronLine}
202
+ `);
203
+ try {
204
+ const existing = execSync('crontab -l 2>/dev/null || echo ""', { encoding: "utf-8" });
205
+ if (existing.includes(cronTag)) {
206
+ console.log(` \u26A0\uFE0F Auto-update cron already installed. Replacing...`);
207
+ const filtered = existing.split("\n").filter((l) => !l.includes(cronTag) && !l.includes("agenticmail")).join("\n");
208
+ const newCron = `${filtered.trimEnd()}
209
+ ${cronLine} ${cronTag}
210
+ `;
211
+ execSync(`echo "${newCron}" | crontab -`, { timeout: 5e3 });
212
+ } else {
213
+ const newCron = `${existing.trimEnd()}
214
+ ${cronLine} ${cronTag}
215
+ `;
216
+ execSync(`echo "${newCron}" | crontab -`, { timeout: 5e3 });
217
+ }
218
+ console.log(` \u2705 Auto-update cron installed!`);
219
+ console.log(` To remove: crontab -e and delete the agenticmail line
220
+ `);
221
+ } catch (err) {
222
+ console.error(` \u274C Failed to install cron: ${err.message}`);
223
+ console.log(` Manual alternative:`);
224
+ console.log(` crontab -e`);
225
+ console.log(` Add: ${cronLine}
226
+ `);
227
+ }
228
+ }
229
+ }
230
+ function startBackgroundUpdateCheck() {
231
+ setTimeout(async () => {
232
+ try {
233
+ const info = await checkForUpdate();
234
+ if (info.updateAvailable) {
235
+ console.log(`[update] \u{1F380} New version available: v${info.latest} (current: v${info.current})`);
236
+ console.log(`[update] Run: agenticmail-enterprise update`);
237
+ }
238
+ } catch {
239
+ }
240
+ }, 3e4);
241
+ setInterval(async () => {
242
+ try {
243
+ const info = await checkForUpdate();
244
+ if (info.updateAvailable) {
245
+ console.log(`[update] \u{1F380} New version available: v${info.latest} (current: v${info.current})`);
246
+ }
247
+ } catch {
248
+ }
249
+ }, 6 * 60 * 6e4);
250
+ }
251
+ async function runUpdate(args) {
252
+ if (args.includes("--cron")) {
253
+ setupAutoUpdateCron();
254
+ return;
255
+ }
256
+ if (args.includes("--check")) {
257
+ const info = await checkForUpdate();
258
+ if (info.updateAvailable) {
259
+ console.log(`
260
+ \u{1F380} Update available: v${info.current} \u2192 v${info.latest}`);
261
+ console.log(` Run: agenticmail-enterprise update
262
+ `);
263
+ } else {
264
+ console.log(`
265
+ \u2705 Up to date (v${info.current})
266
+ `);
267
+ }
268
+ return;
269
+ }
270
+ const noRestart = args.includes("--no-restart");
271
+ await performUpdate({ restart: !noRestart });
272
+ }
273
+ export {
274
+ checkForUpdate,
275
+ getCachedUpdateCheck,
276
+ getCurrentVersion,
277
+ getLatestVersion,
278
+ performUpdate,
279
+ runUpdate,
280
+ setupAutoUpdateCron,
281
+ startBackgroundUpdateCheck
282
+ };
package/dist/cli.js CHANGED
@@ -61,18 +61,18 @@ Skill Development:
61
61
  break;
62
62
  case "update":
63
63
  case "upgrade":
64
- import("./cli-update-P3TAXEW7.js").then((m) => m.runUpdate(args.slice(1))).catch(fatal);
64
+ import("./cli-update-SX7GACL3.js").then((m) => m.runUpdate(args.slice(1))).catch(fatal);
65
65
  break;
66
66
  case "serve":
67
67
  case "start":
68
- import("./cli-serve-FOJJE3AK.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
68
+ import("./cli-serve-BLLYMEM2.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
69
69
  break;
70
70
  case "agent":
71
71
  import("./cli-agent-IXQGKMGQ.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
72
72
  break;
73
73
  case "setup":
74
74
  default:
75
- import("./setup-U7A5VHMJ.js").then((m) => m.runSetupWizard()).catch(fatal);
75
+ import("./setup-GE2OQBS7.js").then((m) => m.runSetupWizard()).catch(fatal);
76
76
  break;
77
77
  }
78
78
  function fatal(err) {
@@ -1,5 +1,7 @@
1
1
  import { h, useState, useEffect, Fragment, useApp, apiCall, showConfirm } from '../components/utils.js';
2
- import { I } from '../components/icons.js';
2
+ import { I as Icons } from '../components/icons.js';
3
+ var iconMap = { 'trending-up': 'activity', 'refresh-cw': 'refresh', 'play': 'play', 'pause': 'pause', 'check': 'check', 'x': 'x', 'edit': 'settings', 'link': 'link', 'message-circle': 'messages', 'calendar': 'calendar', 'trash-2': 'trash', 'zap': 'warning', 'git-branch': 'link', 'shuffle': 'refresh', 'activity': 'activity', 'crosshair': 'search', 'layers': 'folder', 'shield': 'shield', 'log-out': 'logout', 'pie-chart': 'dashboard', 'trending-down': 'activity' };
4
+ function I(name) { var k = iconMap[name] || name; var fn = Icons[k]; return fn ? fn() : ''; }
3
5
  import { HelpButton } from '../components/help-button.js';
4
6
  import { useOrgContext } from '../components/org-switcher.js';
5
7
 
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  provision,
9
9
  runSetupWizard
10
- } from "./chunk-XGOLTMNJ.js";
10
+ } from "./chunk-TEPZSA3M.js";
11
11
  import {
12
12
  AgenticMailManager,
13
13
  GoogleEmailProvider,
@@ -43,7 +43,7 @@ import {
43
43
  requireRole,
44
44
  securityHeaders,
45
45
  validate
46
- } from "./chunk-XL3R3MI7.js";
46
+ } from "./chunk-3PY5ZMVS.js";
47
47
  import "./chunk-DJBCRQTD.js";
48
48
  import {
49
49
  PROVIDER_REGISTRY,
@@ -0,0 +1,28 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-3PY5ZMVS.js";
4
+ import "./chunk-DJBCRQTD.js";
5
+ import "./chunk-UF3ZJMJO.js";
6
+ import "./chunk-BPBRWDKT.js";
7
+ import "./chunk-WYDVMFGJ.js";
8
+ import "./chunk-3UAFHUEC.js";
9
+ import "./chunk-E6B4W3WG.js";
10
+ import "./chunk-Z7NVD3OQ.js";
11
+ import "./chunk-VSBC4SWO.js";
12
+ import "./chunk-AF3WSNVX.js";
13
+ import "./chunk-74ZCQKYU.js";
14
+ import "./chunk-ZNLABJCS.js";
15
+ import "./chunk-C6JP5NR6.js";
16
+ import "./chunk-WUAWWKTN.js";
17
+ import "./chunk-F2VNHJLA.js";
18
+ import "./chunk-YDD5TC5Q.js";
19
+ import "./chunk-37ABTUFU.js";
20
+ import "./chunk-NU657BBQ.js";
21
+ import "./chunk-PGAU3W3M.js";
22
+ import "./chunk-FLQ5FLHW.js";
23
+ import "./chunk-E433N7YQ.js";
24
+ import "./chunk-22U7TZPN.js";
25
+ import "./chunk-KFQGP6VL.js";
26
+ export {
27
+ createServer
28
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ promptCompanyInfo,
3
+ promptDatabase,
4
+ promptDeployment,
5
+ promptDomain,
6
+ promptRegistration,
7
+ provision,
8
+ runSetupWizard
9
+ } from "./chunk-TEPZSA3M.js";
10
+ import "./chunk-P6W565WH.js";
11
+ import "./chunk-KFQGP6VL.js";
12
+ export {
13
+ promptCompanyInfo,
14
+ promptDatabase,
15
+ promptDeployment,
16
+ promptDomain,
17
+ promptRegistration,
18
+ provision,
19
+ runSetupWizard
20
+ };