@agenticmail/enterprise 0.5.254 → 0.5.256

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,114 @@
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 } = await import("./factory-672W7A5B.js");
97
+ const { createServer } = await import("./server-37QX4BUZ.js");
98
+ const db = await createAdapter({
99
+ type: DATABASE_URL.startsWith("postgres") ? "postgres" : "sqlite",
100
+ connectionString: DATABASE_URL
101
+ });
102
+ await db.migrate();
103
+ const server = createServer({
104
+ port: PORT,
105
+ db,
106
+ jwtSecret: JWT_SECRET,
107
+ corsOrigins: ["*"]
108
+ });
109
+ await server.start();
110
+ console.log(`AgenticMail Enterprise server running on :${PORT}`);
111
+ }
112
+ export {
113
+ runServe
114
+ };
package/dist/cli.js CHANGED
@@ -53,14 +53,14 @@ Skill Development:
53
53
  break;
54
54
  case "serve":
55
55
  case "start":
56
- import("./cli-serve-44IKCXDO.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
56
+ import("./cli-serve-TMYT73ZR.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
57
57
  break;
58
58
  case "agent":
59
- import("./cli-agent-3KZRZBZG.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
59
+ import("./cli-agent-UP7UVQ4S.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
60
60
  break;
61
61
  case "setup":
62
62
  default:
63
- import("./setup-3XCPXDZE.js").then((m) => m.runSetupWizard()).catch(fatal);
63
+ import("./setup-5BEVJLTF.js").then((m) => m.runSetupWizard()).catch(fatal);
64
64
  break;
65
65
  }
66
66
  function fatal(err) {
@@ -121,15 +121,17 @@ function layoutChains(tasks) {
121
121
  y += maxH + V_GAP + 8; // space between chains
122
122
  });
123
123
 
124
- // Layout orphans as simple rows per agent
125
- orphansByAgent.forEach(function(agentTasks, agentId) {
124
+ // Layout orphans horizontally in a single row (with wrap if too many)
125
+ var orphanList = [];
126
+ orphansByAgent.forEach(function(agentTasks) { orphanList = orphanList.concat(agentTasks); });
127
+ if (orphanList.length > 0) {
126
128
  var x = PAD;
127
- agentTasks.forEach(function(t) {
129
+ orphanList.forEach(function(t) {
128
130
  allNodes.push({ id: t.id, task: t, x: x, y: y, w: NODE_W, h: NODE_H, isAgent: false, chainId: null });
129
131
  x += NODE_W + H_GAP;
130
132
  });
131
133
  y += NODE_H + V_GAP;
132
- });
134
+ }
133
135
 
134
136
  var maxX = 0;
135
137
  allNodes.forEach(function(n) { maxX = Math.max(maxX, n.x + n.w); });
@@ -707,11 +709,11 @@ export function TaskPipelinePage() {
707
709
  // Canvas
708
710
  h('div', {
709
711
  ref: containerRef,
710
- style: { flex: 1, overflow: 'hidden', cursor: dragging ? 'grabbing' : 'grab', position: 'relative' },
712
+ style: { flex: 1, overflow: 'auto', cursor: dragging ? 'grabbing' : 'grab', position: 'relative' },
711
713
  onMouseDown: handleMouseDown,
712
714
  onWheel: handleWheel,
713
715
  },
714
- h('div', { style: { transform: 'translate(' + pan.x + 'px, ' + pan.y + 'px) scale(' + zoom + ')', transformOrigin: '0 0', position: 'absolute', top: 0, left: 0 } },
716
+ h('div', { style: { transform: 'translate(' + pan.x + 'px, ' + pan.y + 'px) scale(' + zoom + ')', transformOrigin: '0 0', position: 'relative', minWidth: (treeW + PAD * 2) * zoom, minHeight: (treeH + PAD * 2) * zoom } },
715
717
 
716
718
  // Chain labels (left side)
717
719
  chainInfos.map(function(ci, i) {
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  provision,
9
9
  runSetupWizard
10
- } from "./chunk-J6QPL5WN.js";
10
+ } from "./chunk-75FNJLUP.js";
11
11
  import {
12
12
  ValidationError,
13
13
  auditLogger,
@@ -21,7 +21,7 @@ import {
21
21
  requireRole,
22
22
  securityHeaders,
23
23
  validate
24
- } from "./chunk-WXXG3LYY.js";
24
+ } from "./chunk-TOD2HH7L.js";
25
25
  import "./chunk-OF4MUWWS.js";
26
26
  import {
27
27
  AgenticMailManager,
@@ -43,7 +43,7 @@ import {
43
43
  executeTool,
44
44
  runAgentLoop,
45
45
  toolsToDefinitions
46
- } from "./chunk-4IUA4QZE.js";
46
+ } from "./chunk-HE4H2WNG.js";
47
47
  import {
48
48
  PROVIDER_REGISTRY,
49
49
  listAllProviders,