@agenticmail/enterprise 0.5.493 → 0.5.495

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,322 @@
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-R6MMSC2X.js");
97
+ const { createServer } = await import("./server-ZIX4WYJ6.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 { startWatcherEngine, initWatcherTables, setWatcherRuntime } = await import("./polymarket-watcher-QD65QLZQ.js");
110
+ const edb = db.getEngineDB?.();
111
+ if (edb) {
112
+ await initWatcherTables(edb);
113
+ startWatcherEngine(db, {
114
+ log: (...args) => console.log(...args),
115
+ onEvent: (agentId, event) => {
116
+ if (event.severity === "critical") {
117
+ console.log(`[poly-watcher] CRITICAL signal for agent ${agentId}: ${event.title}`);
118
+ }
119
+ }
120
+ });
121
+ setTimeout(async () => {
122
+ try {
123
+ const routes = await import("./routes-OSTTX7K7.js");
124
+ setWatcherRuntime(
125
+ () => routes.getRuntime?.() || null
126
+ );
127
+ } catch (e) {
128
+ console.warn("[poly-watcher] Could not inject runtime:", e.message);
129
+ }
130
+ }, 5e3);
131
+ console.log("[startup] Polymarket watcher engine started");
132
+ }
133
+ setTimeout(async () => {
134
+ try {
135
+ const { autoConnectProxy } = await import("./polymarket-runtime-E7YDVOJD.js");
136
+ const pdb = db.getEngineDB?.();
137
+ if (pdb) await autoConnectProxy(pdb);
138
+ } catch {
139
+ }
140
+ }, 8e3);
141
+ } catch (e) {
142
+ console.warn("[startup] Polymarket watcher engine skipped:", e.message);
143
+ }
144
+ try {
145
+ const { startBackgroundUpdateCheck } = await import("./cli-update-SX7GACL3.js");
146
+ startBackgroundUpdateCheck();
147
+ } catch {
148
+ }
149
+ try {
150
+ const { startPreventSleep } = await import("./screen-unlock-4RPZBHOI.js");
151
+ const adminDb = server.getAdminDb?.() || server.adminDb;
152
+ if (adminDb) {
153
+ const settings = await adminDb.getSettings?.().catch(() => null);
154
+ const screenAccess = settings?.securityConfig?.screenAccess;
155
+ if (screenAccess?.enabled && screenAccess?.preventSleep) {
156
+ startPreventSleep();
157
+ console.log("[startup] Prevent-sleep enabled \u2014 system will stay awake while agents are active");
158
+ }
159
+ }
160
+ } catch {
161
+ }
162
+ try {
163
+ await setupSystemPersistence();
164
+ } catch (e) {
165
+ console.warn("[startup] System persistence setup skipped: " + e.message);
166
+ }
167
+ const tunnelToken = process.env.CLOUDFLARED_TOKEN;
168
+ if (tunnelToken) {
169
+ try {
170
+ const { execSync, spawn } = await import("child_process");
171
+ try {
172
+ execSync(process.platform === "win32" ? "where cloudflared" : "which cloudflared", { timeout: 3e3 });
173
+ } catch {
174
+ console.log("[startup] cloudflared not found \u2014 skipping tunnel auto-start");
175
+ console.log("[startup] Install cloudflared to enable tunnel: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/");
176
+ return;
177
+ }
178
+ try {
179
+ if (process.platform === "win32") {
180
+ const tasklist = execSync('tasklist /FI "IMAGENAME eq cloudflared.exe" /NH', { encoding: "utf8", timeout: 5e3 });
181
+ if (tasklist.includes("cloudflared.exe")) {
182
+ console.log("[startup] cloudflared tunnel already running");
183
+ return;
184
+ }
185
+ } else {
186
+ execSync('pgrep -f "cloudflared.*tunnel.*run"', { timeout: 3e3 });
187
+ console.log("[startup] cloudflared tunnel already running");
188
+ return;
189
+ }
190
+ } catch {
191
+ }
192
+ const subdomain = process.env.AGENTICMAIL_SUBDOMAIN || process.env.AGENTICMAIL_DOMAIN || "";
193
+ console.log(`[startup] Starting cloudflared tunnel${subdomain ? ` for ${subdomain}.agenticmail.io` : ""}...`);
194
+ let cfBin = "cloudflared";
195
+ if (process.platform === "win32") {
196
+ try {
197
+ cfBin = execSync("where cloudflared", { encoding: "utf8", timeout: 3e3 }).trim().split("\n")[0].trim();
198
+ } catch {
199
+ const candidate = `${process.env.LOCALAPPDATA || ""}\\cloudflared\\cloudflared.exe`;
200
+ try {
201
+ (await import("fs")).statSync(candidate);
202
+ cfBin = candidate;
203
+ } catch {
204
+ }
205
+ }
206
+ }
207
+ const child = spawn(cfBin, ["tunnel", "--no-autoupdate", "run", "--token", tunnelToken], {
208
+ detached: true,
209
+ stdio: "ignore"
210
+ });
211
+ child.unref();
212
+ console.log("[startup] cloudflared tunnel started (pid " + child.pid + ")");
213
+ } catch (e) {
214
+ console.warn("[startup] Could not auto-start cloudflared: " + e.message);
215
+ }
216
+ }
217
+ }
218
+ async function setupSystemPersistence() {
219
+ const { execSync, spawnSync } = await import("child_process");
220
+ const { existsSync: exists, writeFileSync, mkdirSync } = await import("fs");
221
+ const { join: pathJoin } = await import("path");
222
+ const platform = process.platform;
223
+ if (!process.env.PM2_HOME && !process.env.pm_id) {
224
+ return;
225
+ }
226
+ const markerDir = pathJoin(homedir(), ".agenticmail");
227
+ const markerFile = pathJoin(markerDir, ".persistence-configured");
228
+ if (exists(markerFile)) {
229
+ try {
230
+ execSync("pm2 save --silent", { timeout: 1e4, stdio: "ignore" });
231
+ } catch {
232
+ }
233
+ return;
234
+ }
235
+ console.log("[startup] Configuring system persistence (one-time setup)...");
236
+ try {
237
+ if (platform === "darwin") {
238
+ const result = spawnSync("pm2", ["startup", "launchd", "--silent"], {
239
+ timeout: 15e3,
240
+ stdio: "pipe",
241
+ encoding: "utf-8"
242
+ });
243
+ const output = (result.stdout || "") + (result.stderr || "");
244
+ const sudoMatch = output.match(/sudo\s+env\s+.*pm2\s+startup.*/);
245
+ if (sudoMatch) {
246
+ console.log("[startup] PM2 startup requires sudo. Run this once:");
247
+ console.log(" " + sudoMatch[0]);
248
+ } else {
249
+ console.log("[startup] PM2 startup configured (launchd)");
250
+ }
251
+ const plistPath = pathJoin(homedir(), "Library", "LaunchAgents", `pm2.${process.env.USER || "user"}.plist`);
252
+ if (exists(plistPath)) {
253
+ try {
254
+ execSync(`launchctl load -w "${plistPath}"`, { timeout: 5e3, stdio: "ignore" });
255
+ } catch {
256
+ }
257
+ }
258
+ } else if (platform === "linux") {
259
+ const result = spawnSync("pm2", ["startup", "systemd", "--silent"], {
260
+ timeout: 15e3,
261
+ stdio: "pipe",
262
+ encoding: "utf-8"
263
+ });
264
+ const output = (result.stdout || "") + (result.stderr || "");
265
+ const sudoMatch = output.match(/sudo\s+env\s+.*pm2\s+startup.*/);
266
+ if (sudoMatch) {
267
+ try {
268
+ execSync(sudoMatch[0], { timeout: 15e3, stdio: "ignore" });
269
+ console.log("[startup] PM2 startup configured (systemd)");
270
+ } catch {
271
+ console.log("[startup] PM2 startup requires root. Run this once:");
272
+ console.log(" " + sudoMatch[0]);
273
+ }
274
+ } else {
275
+ console.log("[startup] PM2 startup configured (systemd)");
276
+ }
277
+ } else if (platform === "win32") {
278
+ try {
279
+ execSync("npm list -g pm2-windows-startup", { timeout: 1e4, stdio: "ignore" });
280
+ } catch {
281
+ console.log("[startup] Installing pm2-windows-startup...");
282
+ try {
283
+ execSync("npm install -g pm2-windows-startup", { timeout: 6e4, stdio: "ignore" });
284
+ execSync("pm2-startup install", { timeout: 15e3, stdio: "ignore" });
285
+ console.log("[startup] PM2 startup configured (Windows Service)");
286
+ } catch (e) {
287
+ console.warn("[startup] Could not install pm2-windows-startup: " + e.message);
288
+ }
289
+ }
290
+ }
291
+ } catch (e) {
292
+ console.warn("[startup] PM2 startup setup: " + e.message);
293
+ }
294
+ try {
295
+ const moduleList = execSync("pm2 ls --silent 2>/dev/null || true", { timeout: 1e4, encoding: "utf-8" });
296
+ if (!moduleList.includes("pm2-logrotate")) {
297
+ console.log("[startup] Installing pm2-logrotate...");
298
+ execSync("pm2 install pm2-logrotate --silent", { timeout: 6e4, stdio: "ignore" });
299
+ execSync("pm2 set pm2-logrotate:max_size 10M --silent", { timeout: 5e3, stdio: "ignore" });
300
+ execSync("pm2 set pm2-logrotate:retain 5 --silent", { timeout: 5e3, stdio: "ignore" });
301
+ execSync("pm2 set pm2-logrotate:compress true --silent", { timeout: 5e3, stdio: "ignore" });
302
+ console.log("[startup] Log rotation configured (10MB, 5 files)");
303
+ }
304
+ } catch {
305
+ }
306
+ try {
307
+ execSync("pm2 save --silent", { timeout: 1e4, stdio: "ignore" });
308
+ console.log("[startup] Process list saved");
309
+ } catch {
310
+ }
311
+ try {
312
+ if (!exists(markerDir)) mkdirSync(markerDir, { recursive: true });
313
+ writeFileSync(markerFile, (/* @__PURE__ */ new Date()).toISOString() + `
314
+ platform=${platform}
315
+ `, { mode: 384 });
316
+ console.log("[startup] System persistence configured successfully");
317
+ } catch {
318
+ }
319
+ }
320
+ export {
321
+ runServe
322
+ };
package/dist/cli.js CHANGED
@@ -65,14 +65,14 @@ Skill Development:
65
65
  break;
66
66
  case "serve":
67
67
  case "start":
68
- import("./cli-serve-VVEAJWDJ.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
68
+ import("./cli-serve-2YBQNL75.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
69
69
  break;
70
70
  case "agent":
71
- import("./cli-agent-APILWIJS.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
71
+ import("./cli-agent-3WPXYJ3H.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
72
72
  break;
73
73
  case "setup":
74
74
  default:
75
- import("./setup-BXECF4TV.js").then((m) => m.runSetupWizard()).catch(fatal);
75
+ import("./setup-7PR7RNNN.js").then((m) => m.runSetupWizard()).catch(fatal);
76
76
  break;
77
77
  }
78
78
  function fatal(err) {
@@ -0,0 +1,203 @@
1
+ import { h, useState, useEffect, useCallback } from './utils.js';
2
+
3
+ // ─── Three animated canvas backgrounds for the login page ───
4
+ // Randomly picks one on each page load. Only shown when no custom company background.
5
+
6
+ var CHARS_BLOCK = '\u2591\u2592\u2593\u2588\u2580\u2584\u258C\u2590\u2502\u2500\u2524\u251C\u2534\u252C\u256D\u256E\u2570\u256F';
7
+ var CHARS_DOT = '\u00B7\u2218\u25CB\u25EF\u25CC\u25CF\u25C9';
8
+
9
+ function renderSphere(ctx, rect, time) {
10
+ var centerX = rect.width / 2;
11
+ var centerY = rect.height / 2;
12
+ var radius = Math.min(rect.width, rect.height) * 0.525;
13
+
14
+ ctx.font = '12px monospace';
15
+ ctx.textAlign = 'center';
16
+ ctx.textBaseline = 'middle';
17
+
18
+ var points = [];
19
+
20
+ for (var phi = 0; phi < Math.PI * 2; phi += 0.15) {
21
+ for (var theta = 0; theta < Math.PI; theta += 0.15) {
22
+ var x = Math.sin(theta) * Math.cos(phi + time * 0.5);
23
+ var y = Math.sin(theta) * Math.sin(phi + time * 0.5);
24
+ var z = Math.cos(theta);
25
+
26
+ var rotY = time * 0.3;
27
+ var newX = x * Math.cos(rotY) - z * Math.sin(rotY);
28
+ var newZ = x * Math.sin(rotY) + z * Math.cos(rotY);
29
+
30
+ var rotX = time * 0.2;
31
+ var newY = y * Math.cos(rotX) - newZ * Math.sin(rotX);
32
+ var finalZ = y * Math.sin(rotX) + newZ * Math.cos(rotX);
33
+
34
+ var depth = (finalZ + 1) / 2;
35
+ var charIndex = Math.floor(depth * (CHARS_BLOCK.length - 1));
36
+
37
+ points.push({ x: centerX + newX * radius, y: centerY + newY * radius, z: finalZ, ch: CHARS_BLOCK[charIndex] });
38
+ }
39
+ }
40
+
41
+ points.sort(function(a, b) { return a.z - b.z; });
42
+ points.forEach(function(p) {
43
+ var alpha = 0.15 + (p.z + 1) * 0.3;
44
+ ctx.fillStyle = 'rgba(120, 120, 140, ' + alpha + ')';
45
+ ctx.fillText(p.ch, p.x, p.y);
46
+ });
47
+ }
48
+
49
+ function renderTetrahedron(ctx, rect, time) {
50
+ var centerX = rect.width / 2;
51
+ var centerY = rect.height / 2;
52
+ var scale = Math.min(rect.width, rect.height) * 0.7;
53
+
54
+ ctx.font = '18px monospace';
55
+ ctx.textAlign = 'center';
56
+ ctx.textBaseline = 'middle';
57
+
58
+ var verts = [
59
+ { x: 0, y: 1, z: 0 },
60
+ { x: -0.943, y: -0.333, z: -0.5 },
61
+ { x: 0.943, y: -0.333, z: -0.5 },
62
+ { x: 0, y: -0.333, z: 1 },
63
+ ];
64
+
65
+ var edges = [[0,1],[0,2],[0,3],[1,2],[2,3],[3,1]];
66
+ var faces = [[0,1,2],[0,2,3],[0,3,1],[1,3,2]];
67
+
68
+ function rotY(p, a) { return { x: p.x * Math.cos(a) - p.z * Math.sin(a), y: p.y, z: p.x * Math.sin(a) + p.z * Math.cos(a) }; }
69
+ function rotX(p, a) { return { x: p.x, y: p.y * Math.cos(a) - p.z * Math.sin(a), z: p.y * Math.sin(a) + p.z * Math.cos(a) }; }
70
+ function rotZ(p, a) { return { x: p.x * Math.cos(a) - p.y * Math.sin(a), y: p.x * Math.sin(a) + p.y * Math.cos(a), z: p.z }; }
71
+
72
+ var points = [];
73
+
74
+ edges.forEach(function(e) {
75
+ var v1 = verts[e[0]], v2 = verts[e[1]];
76
+ for (var t = 0; t <= 1; t += 0.05) {
77
+ var pt = { x: v1.x + (v2.x - v1.x) * t, y: v1.y + (v2.y - v1.y) * t, z: v1.z + (v2.z - v1.z) * t };
78
+ pt = rotY(pt, time * 0.4); pt = rotX(pt, time * 0.3); pt = rotZ(pt, time * 0.2);
79
+ var d = (pt.z + 1.5) / 3;
80
+ var ci = Math.min(Math.floor(d * (CHARS_BLOCK.length - 1)), CHARS_BLOCK.length - 1);
81
+ points.push({ x: centerX + pt.x * scale, y: centerY - pt.y * scale, z: pt.z, ch: CHARS_BLOCK[ci] });
82
+ }
83
+ });
84
+
85
+ faces.forEach(function(f) {
86
+ var v1 = verts[f[0]], v2 = verts[f[1]], v3 = verts[f[2]];
87
+ for (var u = 0; u <= 1; u += 0.12) {
88
+ for (var v = 0; v <= 1 - u; v += 0.12) {
89
+ var w = 1 - u - v;
90
+ var pt = { x: v1.x * u + v2.x * v + v3.x * w, y: v1.y * u + v2.y * v + v3.y * w, z: v1.z * u + v2.z * v + v3.z * w };
91
+ pt = rotY(pt, time * 0.4); pt = rotX(pt, time * 0.3); pt = rotZ(pt, time * 0.2);
92
+ var d = (pt.z + 1.5) / 3;
93
+ var ci = Math.min(Math.floor(d * (CHARS_BLOCK.length - 1)), CHARS_BLOCK.length - 1);
94
+ points.push({ x: centerX + pt.x * scale, y: centerY - pt.y * scale, z: pt.z, ch: CHARS_BLOCK[ci] });
95
+ }
96
+ }
97
+ });
98
+
99
+ points.sort(function(a, b) { return a.z - b.z; });
100
+ points.forEach(function(p) {
101
+ var alpha = 0.1 + (p.z + 1.5) * 0.2;
102
+ ctx.fillStyle = 'rgba(120, 120, 140, ' + Math.min(alpha, 0.7) + ')';
103
+ ctx.fillText(p.ch, p.x, p.y);
104
+ });
105
+ }
106
+
107
+ function renderWave(ctx, rect, time) {
108
+ ctx.font = '14px monospace';
109
+ ctx.textAlign = 'center';
110
+ ctx.textBaseline = 'middle';
111
+
112
+ var cols = Math.floor(rect.width / 20);
113
+ var rows = Math.floor(rect.height / 20);
114
+
115
+ for (var y = 0; y < rows; y++) {
116
+ for (var x = 0; x < cols; x++) {
117
+ var px = (x + 0.5) * (rect.width / cols);
118
+ var py = (y + 0.5) * (rect.height / rows);
119
+
120
+ var wave1 = Math.sin(x * 0.2 + time * 2) * Math.cos(y * 0.15 + time);
121
+ var wave2 = Math.sin((x + y) * 0.1 + time * 1.5);
122
+ var wave3 = Math.cos(x * 0.1 - y * 0.1 + time * 0.8);
123
+
124
+ var combined = (wave1 + wave2 + wave3) / 3;
125
+ var normalized = (combined + 1) / 2;
126
+
127
+ var charIndex = Math.floor(normalized * (CHARS_DOT.length - 1));
128
+ var alpha = 0.1 + normalized * 0.4;
129
+
130
+ ctx.fillStyle = 'rgba(120, 120, 140, ' + alpha + ')';
131
+ ctx.fillText(CHARS_DOT[charIndex], px, py);
132
+ }
133
+ }
134
+ }
135
+
136
+ var RENDERERS = [
137
+ { fn: renderSphere, speed: 0.02 },
138
+ { fn: renderTetrahedron, speed: 0.015 },
139
+ { fn: renderWave, speed: 0.03 },
140
+ ];
141
+
142
+ export function LoginAnimation() {
143
+ var _choice = useState(function() { return Math.floor(Math.random() * RENDERERS.length); });
144
+ var choice = _choice[0];
145
+
146
+ var canvasRef = useCallback(function(canvas) {
147
+ if (!canvas) return;
148
+ var ctx = canvas.getContext('2d');
149
+ if (!ctx) return;
150
+
151
+ var renderer = RENDERERS[choice];
152
+ var time = 0;
153
+ var frameId = 0;
154
+
155
+ function resize() {
156
+ var dpr = window.devicePixelRatio || 1;
157
+ var rect = canvas.getBoundingClientRect();
158
+ canvas.width = rect.width * dpr;
159
+ canvas.height = rect.height * dpr;
160
+ ctx.scale(dpr, dpr);
161
+ }
162
+
163
+ resize();
164
+ window.addEventListener('resize', resize);
165
+
166
+ function render() {
167
+ var rect = canvas.getBoundingClientRect();
168
+ ctx.clearRect(0, 0, rect.width, rect.height);
169
+ renderer.fn(ctx, rect, time);
170
+ time += renderer.speed;
171
+ frameId = requestAnimationFrame(render);
172
+ }
173
+
174
+ render();
175
+
176
+ canvas._cleanup = function() {
177
+ window.removeEventListener('resize', resize);
178
+ cancelAnimationFrame(frameId);
179
+ };
180
+ }, [choice]);
181
+
182
+ useEffect(function() {
183
+ return function() {
184
+ // Cleanup on unmount — find canvas and call cleanup
185
+ var c = document.getElementById('login-anim-canvas');
186
+ if (c && c._cleanup) c._cleanup();
187
+ };
188
+ }, []);
189
+
190
+ return h('canvas', {
191
+ id: 'login-anim-canvas',
192
+ ref: canvasRef,
193
+ style: {
194
+ position: 'absolute',
195
+ top: 0,
196
+ left: 0,
197
+ width: '100%',
198
+ height: '100%',
199
+ zIndex: 0,
200
+ pointerEvents: 'none',
201
+ }
202
+ });
203
+ }
@@ -2,6 +2,7 @@ import { h, useState, useEffect, useCallback, Fragment } from '../components/uti
2
2
  import { apiCall, authCall, engineCall } from '../components/utils.js';
3
3
  import { I } from '../components/icons.js';
4
4
  import { E } from '../assets/icons/emoji-icons.js';
5
+ import { LoginAnimation } from '../components/login-animations.js';
5
6
 
6
7
  var _b = typeof window !== 'undefined' && window.__EM_BRANDING__ || {};
7
8
  var _brandLogo = _b.login_logo || _b.logo || _brandLogo;
@@ -128,8 +129,9 @@ export function LoginPage({ onLogin }) {
128
129
  // ─── 2FA Verification Screen ──────────────────────────
129
130
 
130
131
  if (needs2fa) {
131
- return h('div', { className: 'login-page', style: _brandBg ? { backgroundImage: 'url(' + _brandBg + ')', backgroundSize: 'cover', backgroundPosition: 'center' } : {} },
132
- h('div', { className: 'login-card' },
132
+ return h('div', { className: 'login-page', style: Object.assign({ position: 'relative', overflow: 'hidden' }, _brandBg ? { backgroundImage: 'url(' + _brandBg + ')', backgroundSize: 'cover', backgroundPosition: 'center' } : {}) },
133
+ !_brandBg && h(LoginAnimation),
134
+ h('div', { className: 'login-card', style: { position: 'relative', zIndex: 1 } },
133
135
  h('div', { className: 'login-logo' },
134
136
  h('img', { src: _brandLogo, alt: 'AgenticMail', style: { width: 48, height: 48, objectFit: 'contain' } }),
135
137
  h('h1', null, 'Two-Factor Authentication'),
@@ -161,8 +163,9 @@ export function LoginPage({ onLogin }) {
161
163
  // ─── Forgot Password Screen ──────────────────────────
162
164
 
163
165
  if (forgotMode) {
164
- return h('div', { className: 'login-page', style: _brandBg ? { backgroundImage: 'url(' + _brandBg + ')', backgroundSize: 'cover', backgroundPosition: 'center' } : {} },
165
- h('div', { className: 'login-card' },
166
+ return h('div', { className: 'login-page', style: Object.assign({ position: 'relative', overflow: 'hidden' }, _brandBg ? { backgroundImage: 'url(' + _brandBg + ')', backgroundSize: 'cover', backgroundPosition: 'center' } : {}) },
167
+ !_brandBg && h(LoginAnimation),
168
+ h('div', { className: 'login-card', style: { position: 'relative', zIndex: 1 } },
166
169
  h('div', { className: 'login-logo' },
167
170
  h('img', { src: _brandLogo, alt: 'AgenticMail', style: { width: 48, height: 48, objectFit: 'contain' } }),
168
171
  h('h1', null, 'Reset Password'),
@@ -257,8 +260,9 @@ export function LoginPage({ onLogin }) {
257
260
 
258
261
  // ─── Main Login Screen ────────────────────────────────
259
262
 
260
- return h('div', { className: 'login-page', style: _brandBg ? { backgroundImage: 'url(' + _brandBg + ')', backgroundSize: 'cover', backgroundPosition: 'center' } : {} },
261
- h('div', { className: 'login-card' },
263
+ return h('div', { className: 'login-page', style: Object.assign({ position: 'relative', overflow: 'hidden' }, _brandBg ? { backgroundImage: 'url(' + _brandBg + ')', backgroundSize: 'cover', backgroundPosition: 'center' } : {}) },
264
+ !_brandBg && h(LoginAnimation),
265
+ h('div', { className: 'login-card', style: { position: 'relative', zIndex: 1 } },
262
266
  h('div', { className: 'login-logo' },
263
267
  h('img', { src: _brandLogo, alt: 'AgenticMail', style: { width: 48, height: 48, objectFit: 'contain' } }),
264
268
  h('h1', null, 'AgenticMail Enterprise'),
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  provision,
9
9
  runSetupWizard
10
- } from "./chunk-QURJZ7YA.js";
10
+ } from "./chunk-3JBINCUY.js";
11
11
  import {
12
12
  AgenticMailManager,
13
13
  GoogleEmailProvider,
@@ -28,7 +28,7 @@ import {
28
28
  executeTool,
29
29
  runAgentLoop,
30
30
  toolsToDefinitions
31
- } from "./chunk-6CKKEJ2Z.js";
31
+ } from "./chunk-IKZCLQLH.js";
32
32
  import "./chunk-UBXXLAND.js";
33
33
  import {
34
34
  ValidationError,
@@ -43,7 +43,7 @@ import {
43
43
  requireRole,
44
44
  securityHeaders,
45
45
  validate
46
- } from "./chunk-YY545PSF.js";
46
+ } from "./chunk-MR5OF4WY.js";
47
47
  import "./chunk-DJBCRQTD.js";
48
48
  import {
49
49
  PROVIDER_REGISTRY,
@@ -117,18 +117,18 @@ import {
117
117
  init_agent_config,
118
118
  init_deployer
119
119
  } from "./chunk-PSZU6FMQ.js";
120
- import "./chunk-IHBZGGCE.js";
120
+ import "./chunk-FU64VLD6.js";
121
121
  import "./chunk-X5IZUXDC.js";
122
122
  import "./chunk-I5IGHBXW.js";
123
- import "./chunk-35O7J5FW.js";
123
+ import "./chunk-EOVUE6WA.js";
124
124
  import {
125
125
  SecureVault,
126
126
  init_vault
127
127
  } from "./chunk-WUAWWKTN.js";
128
- import "./chunk-TXZWO3T4.js";
129
- import "./chunk-FDOK2L5M.js";
130
- import "./chunk-CVFIM72Q.js";
131
- import "./chunk-5SRN7SQF.js";
128
+ import "./chunk-2CDGYMJK.js";
129
+ import "./chunk-V3LPIDTL.js";
130
+ import "./chunk-A4CX3XQS.js";
131
+ import "./chunk-5UQD5G7D.js";
132
132
  import {
133
133
  CircuitBreaker,
134
134
  CircuitOpenError,
@@ -0,0 +1,15 @@
1
+ import {
2
+ batchScreen,
3
+ fullAnalysis,
4
+ portfolioReview,
5
+ quickAnalysis
6
+ } from "./chunk-2CDGYMJK.js";
7
+ import "./chunk-V3LPIDTL.js";
8
+ import "./chunk-A4CX3XQS.js";
9
+ import "./chunk-KFQGP6VL.js";
10
+ export {
11
+ batchScreen,
12
+ fullAnalysis,
13
+ portfolioReview,
14
+ quickAnalysis
15
+ };
@@ -0,0 +1,17 @@
1
+ import {
2
+ createPolymarketTools,
3
+ executeOrder
4
+ } from "./chunk-FU64VLD6.js";
5
+ import "./chunk-X5IZUXDC.js";
6
+ import "./chunk-I5IGHBXW.js";
7
+ import "./chunk-EOVUE6WA.js";
8
+ import "./chunk-WUAWWKTN.js";
9
+ import "./chunk-2CDGYMJK.js";
10
+ import "./chunk-V3LPIDTL.js";
11
+ import "./chunk-A4CX3XQS.js";
12
+ import "./chunk-5UQD5G7D.js";
13
+ import "./chunk-KFQGP6VL.js";
14
+ export {
15
+ createPolymarketTools,
16
+ executeOrder
17
+ };