@agenticmail/enterprise 0.5.355 → 0.5.357

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.
@@ -466,7 +466,7 @@ var AgentHeartbeatManager = class {
466
466
  return;
467
467
  }
468
468
  try {
469
- const { guardrails } = await import("./routes-S43BQMDK.js");
469
+ const { guardrails } = await import("./routes-L5POMDQZ.js");
470
470
  const status = await guardrails.getStatus(ctx.agentId);
471
471
  if (status.paused || status.offDuty) {
472
472
  console.log(`[heartbeat] Skipping action dispatch \u2014 agent is ${status.offDuty ? "off duty" : "paused"}`);
@@ -83,6 +83,11 @@ function provisionAgent(config) {
83
83
  const m = mainEnvContent.match(new RegExp(`^${key}=(.+)$`, "m"));
84
84
  if (m) envLines.push(`${key}=${m[1]}`);
85
85
  }
86
+ if (!envLines.some((l) => l.startsWith("ENTERPRISE_URL="))) {
87
+ const portMatch = mainEnvContent.match(/^PORT=(\d+)$/m);
88
+ const serverPort = portMatch ? portMatch[1] : process.env.PORT || "8080";
89
+ envLines.push(`ENTERPRISE_URL=http://localhost:${serverPort}`);
90
+ }
86
91
  try {
87
92
  writeFileSync(envFile, envLines.join("\n") + "\n");
88
93
  } catch (e) {
@@ -13752,7 +13752,7 @@ async function createAllTools(options) {
13752
13752
  var smtpEmailTools = [];
13753
13753
  if (options?.emailConfig?.smtpHost && !tp) {
13754
13754
  try {
13755
- var { executeSmtpEmailTool, getSmtpEmailTools: getSmtpIds } = await import("./smtp-email-WGUG4M45.js");
13755
+ var { executeSmtpEmailTool, getSmtpEmailTools: getSmtpIds } = await import("./smtp-email-UZ53LCJ7.js");
13756
13756
  var smtpToolIds = getSmtpIds();
13757
13757
  var smtpToolDefs = {
13758
13758
  email_send: { desc: "Send an email via SMTP", params: { type: "object", properties: { to: { type: "string", description: "Recipient email" }, cc: { type: "string" }, bcc: { type: "string" }, subject: { type: "string" }, body: { type: "string", description: "Email body text" }, html: { type: "string" }, replyTo: { type: "string" } }, required: ["to", "body"] } },
@@ -679,7 +679,7 @@ EOF`);
679
679
  */
680
680
  async deployLocal(config, emit) {
681
681
  emit("provision", "started", "Creating agent configuration files...");
682
- const { provisionAgent } = await import("./agent-provisioner-JIT6CRPU.js");
682
+ const { provisionAgent } = await import("./agent-provisioner-5KANSYPK.js");
683
683
  const provision = provisionAgent(config);
684
684
  if (!provision.success) {
685
685
  emit("provision", "failed", `Provisioning failed: ${provision.error}`);
@@ -1234,7 +1234,7 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
1234
1234
  const { deployTarget, company, database, domain, tunnel, cloud } = config;
1235
1235
  if (deployTarget === "cloudflare-tunnel" && tunnel) {
1236
1236
  spinner.start(`Starting local server on port ${tunnel.port}...`);
1237
- const { createServer: createServer2 } = await import("./server-5URLZCXN.js");
1237
+ const { createServer: createServer2 } = await import("./server-JVQIW7QZ.js");
1238
1238
  const server2 = createServer2({ port: tunnel.port, db, jwtSecret });
1239
1239
  const handle2 = await server2.start();
1240
1240
  spinner.succeed("Server running");
@@ -1535,7 +1535,7 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
1535
1535
  return {};
1536
1536
  }
1537
1537
  spinner.start("Starting local server...");
1538
- const { createServer } = await import("./server-5URLZCXN.js");
1538
+ const { createServer } = await import("./server-JVQIW7QZ.js");
1539
1539
  const server = createServer({ port: 3e3, db, jwtSecret });
1540
1540
  const handle = await server.start();
1541
1541
  spinner.succeed("Server running");
@@ -356,7 +356,7 @@ function createRuntimeHooks(deps) {
356
356
  var injectedMessages = [...messages];
357
357
  if (deps.knowledgeBaseEnabled !== false) {
358
358
  try {
359
- var { knowledgeBase } = await import("./routes-S43BQMDK.js");
359
+ var { knowledgeBase } = await import("./routes-L5POMDQZ.js");
360
360
  var kbs = await knowledgeBase.listForAgent(agentId);
361
361
  if (kbs.length > 0) {
362
362
  var contextParts = [];
@@ -389,7 +389,7 @@ ${contextParts.join("\n\n")}`;
389
389
  }
390
390
  if (deps.memoryEnabled !== false) {
391
391
  try {
392
- var { memoryManager } = await import("./routes-S43BQMDK.js");
392
+ var { memoryManager } = await import("./routes-L5POMDQZ.js");
393
393
  var memories = await memoryManager.queryMemories({
394
394
  agentId,
395
395
  limit: 10,
@@ -410,7 +410,7 @@ ${memories.map(function(m) {
410
410
  }
411
411
  if (deps.policyEnabled !== false) {
412
412
  try {
413
- var { policyEngine } = await import("./routes-S43BQMDK.js");
413
+ var { policyEngine } = await import("./routes-L5POMDQZ.js");
414
414
  var policies = await policyEngine.getAgentPolicies(agentId, deps.orgId);
415
415
  if (policies.length > 0) {
416
416
  var policyText = policies.map(function(p) {
@@ -435,7 +435,7 @@ ${policyText}`;
435
435
  // ─── Budget Check ──────────────────────────────
436
436
  async checkBudget(agentId, _orgId, _estimatedTokens) {
437
437
  try {
438
- var { lifecycle } = await import("./routes-S43BQMDK.js");
438
+ var { lifecycle } = await import("./routes-L5POMDQZ.js");
439
439
  var now = Date.now();
440
440
  var cacheKey = `budget_sync_${agentId}`;
441
441
  var lastSync = globalThis[cacheKey] || 0;
@@ -528,7 +528,7 @@ ${policyText}`;
528
528
  // ─── Record LLM Usage ──────────────────────────
529
529
  async recordLLMUsage(agentId, orgId, usage) {
530
530
  try {
531
- var { lifecycle } = await import("./routes-S43BQMDK.js");
531
+ var { lifecycle } = await import("./routes-L5POMDQZ.js");
532
532
  console.log(`[hooks] recordLLMUsage: agent=${agentId}, input=${usage.inputTokens}, output=${usage.outputTokens}`);
533
533
  await lifecycle.recordLLMUsage(agentId, {
534
534
  inputTokens: usage.inputTokens,
@@ -539,7 +539,7 @@ ${policyText}`;
539
539
  console.log(`[hooks] recordLLMUsage error: ${recordErr.message}`);
540
540
  }
541
541
  try {
542
- var { activity } = await import("./routes-S43BQMDK.js");
542
+ var { activity } = await import("./routes-L5POMDQZ.js");
543
543
  await activity.record({
544
544
  agentId,
545
545
  orgId,
@@ -587,7 +587,7 @@ ${policyText}`;
587
587
  var cacheKey = `${ctx.agentId}:${ctx.toolName}`;
588
588
  var cached = getCachedPermission(cacheKey);
589
589
  if (cached) return cached;
590
- var { permissionEngine } = await import("./routes-S43BQMDK.js");
590
+ var { permissionEngine } = await import("./routes-L5POMDQZ.js");
591
591
  var permResult = await permissionEngine.checkPermission(ctx.agentId, ctx.toolName);
592
592
  var result = {
593
593
  allowed: permResult.allowed,
@@ -596,7 +596,7 @@ ${policyText}`;
596
596
  };
597
597
  if (result.allowed && deps.guardrailsEnabled !== false) {
598
598
  try {
599
- var { guardrails } = await import("./routes-S43BQMDK.js");
599
+ var { guardrails } = await import("./routes-L5POMDQZ.js");
600
600
  var status = await guardrails.getStatus(ctx.agentId);
601
601
  if (status.paused || status.offDuty) {
602
602
  result.allowed = false;
@@ -608,7 +608,7 @@ ${policyText}`;
608
608
  }
609
609
  if (result.allowed && deps.dlpEnabled !== false && ctx.parameters) {
610
610
  try {
611
- var { dlp } = await import("./routes-S43BQMDK.js");
611
+ var { dlp } = await import("./routes-L5POMDQZ.js");
612
612
  var dlpResult = await dlp.scanParameters({
613
613
  orgId: ctx.orgId,
614
614
  agentId: ctx.agentId,
@@ -628,7 +628,7 @@ ${policyText}`;
628
628
  }
629
629
  if (result.requiresApproval && result.allowed) {
630
630
  try {
631
- var { approvals } = await import("./routes-S43BQMDK.js");
631
+ var { approvals } = await import("./routes-L5POMDQZ.js");
632
632
  var approval = await approvals.createAndWait({
633
633
  agentId: ctx.agentId,
634
634
  orgId: ctx.orgId,
@@ -658,7 +658,7 @@ ${policyText}`;
658
658
  // ─── After Tool Call ────────────────────────────
659
659
  async afterToolCall(ctx, result) {
660
660
  try {
661
- var { activity } = await import("./routes-S43BQMDK.js");
661
+ var { activity } = await import("./routes-L5POMDQZ.js");
662
662
  await activity.record({
663
663
  agentId: ctx.agentId,
664
664
  orgId: ctx.orgId,
@@ -675,7 +675,7 @@ ${policyText}`;
675
675
  } catch {
676
676
  }
677
677
  try {
678
- var { lifecycle } = await import("./routes-S43BQMDK.js");
678
+ var { lifecycle } = await import("./routes-L5POMDQZ.js");
679
679
  await lifecycle.recordToolCall(ctx.agentId, {
680
680
  toolId: ctx.toolName,
681
681
  tokensUsed: 0,
@@ -687,7 +687,7 @@ ${policyText}`;
687
687
  }
688
688
  if (result.success && EXTERNAL_TOOLS.has(ctx.toolName)) {
689
689
  try {
690
- var { journal } = await import("./routes-S43BQMDK.js");
690
+ var { journal } = await import("./routes-L5POMDQZ.js");
691
691
  await journal.record({
692
692
  orgId: ctx.orgId,
693
693
  agentId: ctx.agentId,
@@ -702,7 +702,7 @@ ${policyText}`;
702
702
  }
703
703
  if (result.success && COMMUNICATION_TOOLS.has(ctx.toolName)) {
704
704
  try {
705
- var { commBus } = await import("./routes-S43BQMDK.js");
705
+ var { commBus } = await import("./routes-L5POMDQZ.js");
706
706
  await commBus.observeMessage({
707
707
  orgId: ctx.orgId,
708
708
  agentId: ctx.agentId,
@@ -716,7 +716,7 @@ ${policyText}`;
716
716
  // ─── Session Lifecycle ──────────────────────────
717
717
  async onSessionStart(sessionId, agentId, orgId) {
718
718
  try {
719
- var { activity } = await import("./routes-S43BQMDK.js");
719
+ var { activity } = await import("./routes-L5POMDQZ.js");
720
720
  await activity.record({
721
721
  agentId,
722
722
  orgId,
@@ -729,7 +729,7 @@ ${policyText}`;
729
729
  },
730
730
  async onSessionEnd(sessionId, agentId, orgId) {
731
731
  try {
732
- var { activity } = await import("./routes-S43BQMDK.js");
732
+ var { activity } = await import("./routes-L5POMDQZ.js");
733
733
  await activity.record({
734
734
  agentId,
735
735
  orgId,
@@ -743,7 +743,7 @@ ${policyText}`;
743
743
  // ─── Context Compaction ─────────────────────────
744
744
  async onContextCompaction(sessionId, agentId, summary) {
745
745
  try {
746
- var { memoryManager } = await import("./routes-S43BQMDK.js");
746
+ var { memoryManager } = await import("./routes-L5POMDQZ.js");
747
747
  await memoryManager.createMemory({
748
748
  agentId,
749
749
  orgId: deps.orgId,
@@ -2518,7 +2518,7 @@ async function runAgentLoop(config, initialMessages, hooks, options) {
2518
2518
  console.log(`[agent-loop] \u2705 Tool ${toolCall.name} succeeded (${content.length} chars): ${content.slice(0, 300)}`);
2519
2519
  }
2520
2520
  try {
2521
- const { activity } = await import("./routes-S43BQMDK.js");
2521
+ const { activity } = await import("./routes-L5POMDQZ.js");
2522
2522
  activity.recordToolCallCompact({
2523
2523
  agentId: config.agentId,
2524
2524
  orgId: config.orgId,
@@ -3385,7 +3385,7 @@ function createRequestToolsTool(allTools, activeSets, _context) {
3385
3385
  };
3386
3386
  }
3387
3387
  async function createToolsForContext(options, context, opts) {
3388
- const { createAllTools } = await import("./agent-tools-LOVO4CLJ.js");
3388
+ const { createAllTools } = await import("./agent-tools-2F6FYYXG.js");
3389
3389
  if (context === "full") {
3390
3390
  return createAllTools(options);
3391
3391
  }
@@ -40,7 +40,7 @@ import {
40
40
  DeploymentEngine,
41
41
  init_agent_config,
42
42
  init_deployer
43
- } from "./chunk-3IEMACO4.js";
43
+ } from "./chunk-FT5MAYTU.js";
44
44
  import {
45
45
  init_resilience,
46
46
  withRetry
@@ -790,7 +790,7 @@ var init_lifecycle = __esm({
790
790
  async deploy(agentId, deployedBy) {
791
791
  const agent = this.getAgent(agentId);
792
792
  if (!agent) throw new Error(`Agent ${agentId} not found`);
793
- if (!["ready", "stopped", "error", "degraded", "draft"].includes(agent.state)) {
793
+ if (!["ready", "stopped", "error", "degraded", "draft", "provisioning", "deploying", "starting"].includes(agent.state)) {
794
794
  throw new Error(`Cannot deploy from state "${agent.state}"`);
795
795
  }
796
796
  if (!this.isConfigComplete(agent.config)) {
@@ -6847,7 +6847,7 @@ function createAgentRoutes(opts) {
6847
6847
  });
6848
6848
  router.post("/system/install-pm2", async (c) => {
6849
6849
  try {
6850
- const { ensurePm2 } = await import("./deployer-JJYWIRFH.js");
6850
+ const { ensurePm2 } = await import("./deployer-HN7HPTZU.js");
6851
6851
  const result = await ensurePm2();
6852
6852
  if (result.installed) {
6853
6853
  return c.json({ success: true, message: `PM2 ${result.version} installed successfully` });
@@ -7103,7 +7103,7 @@ function createAgentRoutes(opts) {
7103
7103
  }
7104
7104
  const managedAgent = await lifecycle2.createAgent(orgId, config, actor);
7105
7105
  try {
7106
- const { knowledgeBase: kbEngine } = await import("./routes-S43BQMDK.js");
7106
+ const { knowledgeBase: kbEngine } = await import("./routes-L5POMDQZ.js");
7107
7107
  const allKbs = kbEngine.getAllKnowledgeBases();
7108
7108
  const clientOrgId = managedAgent?.clientOrgId || config?.clientOrgId || null;
7109
7109
  let kbAssigned = 0;
@@ -25364,7 +25364,17 @@ var init_routes3 = __esm({
25364
25364
  engine.post("/agent-status/:agentId", async (c) => {
25365
25365
  try {
25366
25366
  const body = await c.req.json();
25367
- agentStatus.externalUpdate(c.req.param("agentId"), body);
25367
+ const agentId = c.req.param("agentId");
25368
+ agentStatus.externalUpdate(agentId, body);
25369
+ if (body.status === "online" || body.status === "idle") {
25370
+ const agent = lifecycle.getAgent(agentId);
25371
+ if (agent && agent.state !== "running" && agent.state !== "active") {
25372
+ agent.state = "running";
25373
+ agent.stateMessage = "Agent online (heartbeat)";
25374
+ lifecycle.saveAgent(agentId).catch(() => {
25375
+ });
25376
+ }
25377
+ }
25368
25378
  return c.json({ ok: true });
25369
25379
  } catch (err) {
25370
25380
  return c.json({ error: err.message }, 400);
@@ -11,7 +11,7 @@ import {
11
11
  init_config_bus,
12
12
  init_routes,
13
13
  routes_exports
14
- } from "./chunk-RCCWFEZI.js";
14
+ } from "./chunk-J7DJJVGJ.js";
15
15
  import {
16
16
  CircuitBreaker,
17
17
  HealthMonitor,
@@ -4661,7 +4661,7 @@ function createServer(config) {
4661
4661
  let engineInitialized = false;
4662
4662
  api.all("/engine/*", async (c, _next) => {
4663
4663
  try {
4664
- const { engineRoutes, setEngineDb } = await import("./routes-S43BQMDK.js");
4664
+ const { engineRoutes, setEngineDb } = await import("./routes-L5POMDQZ.js");
4665
4665
  const { EngineDatabase } = await import("./db-adapter-2T56ORSD.js");
4666
4666
  if (!engineInitialized) {
4667
4667
  engineInitialized = true;
@@ -4691,13 +4691,13 @@ function createServer(config) {
4691
4691
  engineInitialized = true;
4692
4692
  if (config.runtime?.enabled) {
4693
4693
  try {
4694
- const { createAgentRuntime } = await import("./runtime-3GLGCAGF.js");
4695
- const { mountRuntimeApp, setRuntime } = await import("./routes-S43BQMDK.js");
4694
+ const { createAgentRuntime } = await import("./runtime-PMERZPPG.js");
4695
+ const { mountRuntimeApp, setRuntime } = await import("./routes-L5POMDQZ.js");
4696
4696
  let getEmailConfig;
4697
4697
  let onTokenRefresh;
4698
4698
  let agentMemoryMgr;
4699
4699
  try {
4700
- const { lifecycle: lc, memoryManager: mm } = await import("./routes-S43BQMDK.js");
4700
+ const { lifecycle: lc, memoryManager: mm } = await import("./routes-L5POMDQZ.js");
4701
4701
  agentMemoryMgr = mm;
4702
4702
  if (lc) {
4703
4703
  getEmailConfig = (agentId) => {
@@ -4736,7 +4736,7 @@ function createServer(config) {
4736
4736
  }
4737
4737
  } catch {
4738
4738
  }
4739
- const { vault: vaultRef, permissionEngine: permRef, databaseManager: dbMgr } = await import("./routes-S43BQMDK.js");
4739
+ const { vault: vaultRef, permissionEngine: permRef, databaseManager: dbMgr } = await import("./routes-L5POMDQZ.js");
4740
4740
  const runtime = createAgentRuntime({
4741
4741
  engineDb,
4742
4742
  adminDb: config.db,
@@ -4936,7 +4936,7 @@ function createServer(config) {
4936
4936
  });
4937
4937
  (async () => {
4938
4938
  try {
4939
- const { engineRoutes, setEngineDb } = await import("./routes-S43BQMDK.js");
4939
+ const { engineRoutes, setEngineDb } = await import("./routes-L5POMDQZ.js");
4940
4940
  const { EngineDatabase } = await import("./db-adapter-2T56ORSD.js");
4941
4941
  if (!engineInitialized) {
4942
4942
  engineInitialized = true;
@@ -4960,13 +4960,13 @@ function createServer(config) {
4960
4960
  await setEngineDb(engineDb, config.db);
4961
4961
  if (config.runtime?.enabled) {
4962
4962
  try {
4963
- const { createAgentRuntime } = await import("./runtime-3GLGCAGF.js");
4964
- const { mountRuntimeApp, setRuntime } = await import("./routes-S43BQMDK.js");
4963
+ const { createAgentRuntime } = await import("./runtime-PMERZPPG.js");
4964
+ const { mountRuntimeApp, setRuntime } = await import("./routes-L5POMDQZ.js");
4965
4965
  let getEmailConfig;
4966
4966
  let onTokenRefresh;
4967
4967
  let agentMemoryMgr;
4968
4968
  try {
4969
- const { lifecycle: lc, memoryManager: mm } = await import("./routes-S43BQMDK.js");
4969
+ const { lifecycle: lc, memoryManager: mm } = await import("./routes-L5POMDQZ.js");
4970
4970
  agentMemoryMgr = mm;
4971
4971
  if (lc) {
4972
4972
  getEmailConfig = (agentId) => {
@@ -5005,7 +5005,7 @@ function createServer(config) {
5005
5005
  }
5006
5006
  } catch {
5007
5007
  }
5008
- const { vault: vaultRef2, permissionEngine: permRef2, databaseManager: dbMgr2 } = await import("./routes-S43BQMDK.js");
5008
+ const { vault: vaultRef2, permissionEngine: permRef2, databaseManager: dbMgr2 } = await import("./routes-L5POMDQZ.js");
5009
5009
  const runtime = createAgentRuntime({
5010
5010
  engineDb,
5011
5011
  adminDb: config.db,
@@ -5017,7 +5017,7 @@ function createServer(config) {
5017
5017
  agentMemoryManager: agentMemoryMgr,
5018
5018
  vault: vaultRef2,
5019
5019
  permissionEngine: permRef2,
5020
- hierarchyManager: (await import("./routes-S43BQMDK.js")).hierarchyManager ?? void 0,
5020
+ hierarchyManager: (await import("./routes-L5POMDQZ.js")).hierarchyManager ?? void 0,
5021
5021
  databaseManager: dbMgr2
5022
5022
  });
5023
5023
  await runtime.start();
@@ -5031,7 +5031,7 @@ function createServer(config) {
5031
5031
  }
5032
5032
  console.log("[engine] Eagerly initialized");
5033
5033
  try {
5034
- const { lifecycle: lcRef } = await import("./routes-S43BQMDK.js");
5034
+ const { lifecycle: lcRef } = await import("./routes-L5POMDQZ.js");
5035
5035
  if (lcRef) {
5036
5036
  const agents = Array.from(lcRef.agents?.values?.() || []);
5037
5037
  const hasLocalPm2 = agents.some((a) => {
@@ -5040,7 +5040,7 @@ function createServer(config) {
5040
5040
  return target === "local" && (!pm || pm === "pm2");
5041
5041
  });
5042
5042
  if (hasLocalPm2) {
5043
- const { ensurePm2 } = await import("./deployer-JJYWIRFH.js");
5043
+ const { ensurePm2 } = await import("./deployer-HN7HPTZU.js");
5044
5044
  const pm2 = await ensurePm2();
5045
5045
  if (pm2.installed) {
5046
5046
  console.log(`[startup] PM2 v${pm2.version} available for local deployments`);
@@ -762,7 +762,7 @@ async function runAgent(_args) {
762
762
  const agent = agentRow[0];
763
763
  console.log(` Agent: ${agent.display_name || agent.name}`);
764
764
  console.log(` State: ${agent.state}`);
765
- const routes = await import("./routes-S43BQMDK.js");
765
+ const routes = await import("./routes-L5POMDQZ.js");
766
766
  await routes.lifecycle.setDb(engineDb);
767
767
  await routes.lifecycle.loadFromDb();
768
768
  routes.lifecycle.standaloneMode = true;
@@ -820,10 +820,10 @@ async function runAgent(_args) {
820
820
  }
821
821
  } catch {
822
822
  }
823
- const { createAgentRuntime } = await import("./runtime-3GLGCAGF.js");
823
+ const { createAgentRuntime } = await import("./runtime-PMERZPPG.js");
824
824
  let orgIntMgr = null;
825
825
  try {
826
- const { orgIntegrations: oi } = await import("./routes-S43BQMDK.js");
826
+ const { orgIntegrations: oi } = await import("./routes-L5POMDQZ.js");
827
827
  orgIntMgr = oi;
828
828
  } catch {
829
829
  }
@@ -1222,7 +1222,7 @@ Please complete this task now.`,
1222
1222
  }
1223
1223
  if (scope === "all" || scope === "permissions") {
1224
1224
  try {
1225
- const { permissionEngine } = await import("./routes-S43BQMDK.js");
1225
+ const { permissionEngine } = await import("./routes-L5POMDQZ.js");
1226
1226
  await permissionEngine.setDb(engineDb);
1227
1227
  reloaded.push("permissions");
1228
1228
  } catch {
@@ -1262,7 +1262,7 @@ Please complete this task now.`,
1262
1262
  }
1263
1263
  if (scope === "all" || scope === "guardrails") {
1264
1264
  try {
1265
- const { guardrails } = await import("./routes-S43BQMDK.js");
1265
+ const { guardrails } = await import("./routes-L5POMDQZ.js");
1266
1266
  await guardrails.loadFromDb?.();
1267
1267
  reloaded.push("guardrails");
1268
1268
  } catch {
@@ -2190,7 +2190,7 @@ Available tools: gmail_send (to, subject, body) or agenticmail_send (to, subject
2190
2190
  console.log("[guardrails] Disabled via autonomy settings");
2191
2191
  }
2192
2192
  try {
2193
- const { AgentHeartbeatManager } = await import("./agent-heartbeat-ZCVMYFMO.js");
2193
+ const { AgentHeartbeatManager } = await import("./agent-heartbeat-VAQTRYST.js");
2194
2194
  const hbOrgRows = await engineDb.query(`SELECT org_id FROM managed_agents WHERE id = $1`, [AGENT_ID]);
2195
2195
  const hbOrgId = hbOrgRows?.[0]?.org_id || "";
2196
2196
  const hbManagerEmail = config.managerEmail || (config.manager?.type === "external" ? config.manager.email : null);
@@ -94,7 +94,7 @@ async function runServe(_args) {
94
94
  process.exit(1);
95
95
  }
96
96
  const { createAdapter, smartDbConfig } = await import("./factory-RTZU2K54.js");
97
- const { createServer } = await import("./server-5URLZCXN.js");
97
+ const { createServer } = await import("./server-JVQIW7QZ.js");
98
98
  const db = await createAdapter(smartDbConfig(DATABASE_URL));
99
99
  await db.migrate();
100
100
  const server = createServer({
package/dist/cli.js CHANGED
@@ -57,14 +57,14 @@ Skill Development:
57
57
  break;
58
58
  case "serve":
59
59
  case "start":
60
- import("./cli-serve-JS5CDMOW.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
60
+ import("./cli-serve-ISFHDWKP.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
61
61
  break;
62
62
  case "agent":
63
- import("./cli-agent-SPDASSB7.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
63
+ import("./cli-agent-7HSS5FUE.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
64
64
  break;
65
65
  case "setup":
66
66
  default:
67
- import("./setup-R2ECMQLR.js").then((m) => m.runSetupWizard()).catch(fatal);
67
+ import("./setup-Z5TIFVJQ.js").then((m) => m.runSetupWizard()).catch(fatal);
68
68
  break;
69
69
  }
70
70
  function fatal(err) {
@@ -2,7 +2,7 @@ import {
2
2
  DeploymentEngine,
3
3
  ensurePm2,
4
4
  init_deployer
5
- } from "./chunk-3IEMACO4.js";
5
+ } from "./chunk-FT5MAYTU.js";
6
6
  import "./chunk-KFQGP6VL.js";
7
7
  init_deployer();
8
8
  export {
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  provision,
15
15
  runSetupWizard
16
- } from "./chunk-WECNT5FR.js";
16
+ } from "./chunk-G4EXGQSK.js";
17
17
  import {
18
18
  AgentRuntime,
19
19
  EmailChannel,
@@ -28,7 +28,7 @@ import {
28
28
  executeTool,
29
29
  runAgentLoop,
30
30
  toolsToDefinitions
31
- } from "./chunk-PPGBBASR.js";
31
+ } from "./chunk-GIWIAVLJ.js";
32
32
  import {
33
33
  ValidationError,
34
34
  auditLogger,
@@ -42,7 +42,7 @@ import {
42
42
  requireRole,
43
43
  securityHeaders,
44
44
  validate
45
- } from "./chunk-3VZOFEQF.js";
45
+ } from "./chunk-KMOGPT4O.js";
46
46
  import "./chunk-DJBCRQTD.js";
47
47
  import {
48
48
  PROVIDER_REGISTRY,
@@ -82,7 +82,7 @@ import {
82
82
  init_storage_manager,
83
83
  init_tenant,
84
84
  init_workforce
85
- } from "./chunk-RCCWFEZI.js";
85
+ } from "./chunk-J7DJJVGJ.js";
86
86
  import "./chunk-3UAFHUEC.js";
87
87
  import {
88
88
  ENGINE_TABLES,
@@ -115,7 +115,7 @@ import {
115
115
  DeploymentEngine,
116
116
  init_agent_config,
117
117
  init_deployer
118
- } from "./chunk-3IEMACO4.js";
118
+ } from "./chunk-FT5MAYTU.js";
119
119
  import {
120
120
  CircuitBreaker,
121
121
  CircuitOpenError,
@@ -35,7 +35,7 @@ import {
35
35
  tenants,
36
36
  vault,
37
37
  workforce
38
- } from "./chunk-RCCWFEZI.js";
38
+ } from "./chunk-J7DJJVGJ.js";
39
39
  import "./chunk-3UAFHUEC.js";
40
40
  import "./chunk-Z7NVD3OQ.js";
41
41
  import "./chunk-VSBC4SWO.js";
@@ -45,7 +45,7 @@ import "./chunk-Z6K5FKAB.js";
45
45
  import "./chunk-C6JP5NR6.js";
46
46
  import "./chunk-WYDVMFGJ.js";
47
47
  import "./chunk-HIQY73V2.js";
48
- import "./chunk-3IEMACO4.js";
48
+ import "./chunk-FT5MAYTU.js";
49
49
  import "./chunk-YDD5TC5Q.js";
50
50
  import "./chunk-FLQ5FLHW.js";
51
51
  import "./chunk-WUAWWKTN.js";
@@ -14,7 +14,7 @@ import {
14
14
  executeTool,
15
15
  runAgentLoop,
16
16
  toolsToDefinitions
17
- } from "./chunk-PPGBBASR.js";
17
+ } from "./chunk-GIWIAVLJ.js";
18
18
  import {
19
19
  PROVIDER_REGISTRY,
20
20
  listAllProviders,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-3VZOFEQF.js";
3
+ } from "./chunk-KMOGPT4O.js";
4
4
  import "./chunk-DJBCRQTD.js";
5
5
  import "./chunk-UF3ZJMJO.js";
6
- import "./chunk-RCCWFEZI.js";
6
+ import "./chunk-J7DJJVGJ.js";
7
7
  import "./chunk-3UAFHUEC.js";
8
8
  import "./chunk-Z7NVD3OQ.js";
9
9
  import "./chunk-VSBC4SWO.js";
@@ -13,7 +13,7 @@ import "./chunk-Z6K5FKAB.js";
13
13
  import "./chunk-C6JP5NR6.js";
14
14
  import "./chunk-WYDVMFGJ.js";
15
15
  import "./chunk-HIQY73V2.js";
16
- import "./chunk-3IEMACO4.js";
16
+ import "./chunk-FT5MAYTU.js";
17
17
  import "./chunk-YDD5TC5Q.js";
18
18
  import "./chunk-37ABTUFU.js";
19
19
  import "./chunk-NU657BBQ.js";
@@ -6,7 +6,7 @@ import {
6
6
  promptRegistration,
7
7
  provision,
8
8
  runSetupWizard
9
- } from "./chunk-WECNT5FR.js";
9
+ } from "./chunk-G4EXGQSK.js";
10
10
  import "./chunk-Z3I6GNTS.js";
11
11
  import "./chunk-KFQGP6VL.js";
12
12
  export {
@@ -6,11 +6,13 @@ import { ImapFlow } from "imapflow";
6
6
  function getSmtpConfig(ctx) {
7
7
  const ec = ctx.emailConfig;
8
8
  if (!ec?.smtpHost) throw new Error("SMTP not configured. Set up email credentials in agent settings.");
9
+ const pass = ec.smtpPass || ec.password;
10
+ if (!pass) throw new Error("No password configured. Set email password in agent email settings.");
9
11
  return {
10
12
  host: ec.smtpHost,
11
13
  port: ec.smtpPort || 587,
12
14
  secure: (ec.smtpPort || 587) === 465,
13
- auth: { user: ec.smtpUser || ec.email, pass: ec.smtpPass }
15
+ auth: { user: ec.smtpUser || ec.email, pass }
14
16
  };
15
17
  }
16
18
  function getImapConfig(ctx) {
@@ -24,11 +26,13 @@ function getImapConfig(ctx) {
24
26
  else if (smtpHost.includes("smtp.yahoo")) imapHost = "imap.mail.yahoo.com";
25
27
  else imapHost = smtpHost.replace("smtp.", "imap.");
26
28
  }
29
+ const pass = ec.smtpPass || ec.imapPass || ec.password;
30
+ if (!pass) throw new Error("No password configured. Set email password in agent email settings.");
27
31
  return {
28
32
  host: imapHost,
29
33
  port: ec.imapPort || 993,
30
34
  secure: true,
31
- auth: { user: ec.smtpUser || ec.imapUser || ec.email, pass: ec.smtpPass || ec.imapPass },
35
+ auth: { user: ec.smtpUser || ec.imapUser || ec.email, pass },
32
36
  logger: false
33
37
  };
34
38
  }
@@ -143,3 +143,13 @@
143
143
  2026-03-05 19:23:02: 2026-03-05T18:23:02Z ERR Request failed error="stream 357 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/cluster/stream event=0 ip=198.41.192.107 type=http
144
144
  2026-03-05 19:53:34: 2026-03-05T18:53:34Z ERR error="stream 405 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
145
145
  2026-03-05 19:53:34: 2026-03-05T18:53:34Z ERR Request failed error="stream 405 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.192.107 type=http
146
+ 2026-03-05 19:53:47: 2026-03-05T18:53:47Z ERR error="stream 377 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
147
+ 2026-03-05 19:53:47: 2026-03-05T18:53:47Z ERR Request failed error="stream 377 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.192.107 type=http
148
+ 2026-03-05 19:53:50: 2026-03-05T18:53:50Z ERR error="stream 777 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
149
+ 2026-03-05 19:53:50: 2026-03-05T18:53:50Z ERR Request failed error="stream 777 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.192.107 type=http
150
+ 2026-03-05 19:55:34: 2026-03-05T18:55:34Z ERR error="stream 881 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
151
+ 2026-03-05 19:55:34: 2026-03-05T18:55:34Z ERR Request failed error="stream 881 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream event=0 ip=198.41.192.107 type=http
152
+ 2026-03-05 19:55:49: 2026-03-05T18:55:49Z ERR error="stream 753 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
153
+ 2026-03-05 19:55:49: 2026-03-05T18:55:49Z ERR Request failed error="stream 753 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.192.107 type=http
154
+ 2026-03-05 19:56:02: 2026-03-05T18:56:02Z ERR error="stream 913 canceled by remote with error code 0" connIndex=0 event=1 ingressRule=0 originService=http://localhost:3100
155
+ 2026-03-05 19:56:02: 2026-03-05T18:56:02Z ERR Request failed error="stream 913 canceled by remote with error code 0" connIndex=0 dest=https://enterprise.agenticmail.io/api/engine/agent-status-stream?agentId=3eecd57d-03ae-440d-8945-5b35f43a8d90 event=0 ip=198.41.192.107 type=http
@@ -15,3 +15,79 @@
15
15
  2026-03-05 08:01:57: Loaded config from /Users/ope/Desktop/projects/agenticmail/enterprise/.env
16
16
  2026-03-05 08:04:00: Loaded config from /Users/ope/Desktop/projects/agenticmail/enterprise/.env
17
17
  2026-03-05 08:08:16: Loaded config from /Users/ope/Desktop/projects/agenticmail/enterprise/.env
18
+ 2026-03-05 19:54:10: Closing session: SessionEntry {
19
+ 2026-03-05 19:54:10: _chains: {
20
+ 2026-03-05 19:54:10: BQDZFLrx0MLImqzD3cvFwPpOQBCZv3izA6ZtPewySrJl: { chainKey: [Object], chainType: 2, messageKeys: {} },
21
+ 2026-03-05 19:54:10: 'Ba7peRFQL4jv9e7JsA/oCYEcBIOilGAyHCnBfiGt5UJA': { chainKey: [Object], chainType: 1, messageKeys: {} }
22
+ 2026-03-05 19:54:10: },
23
+ 2026-03-05 19:54:10: registrationId: 6971310,
24
+ 2026-03-05 19:54:10: currentRatchet: {
25
+ 2026-03-05 19:54:10: ephemeralKeyPair: {
26
+ 2026-03-05 19:54:10: pubKey: <Buffer 05 ae e9 79 11 50 2f 88 ef f5 ee c9 b0 0f e8 09 81 1c 04 83 a2 94 60 32 1c 29 c1 7e 21 ad e5 42 40>,
27
+ 2026-03-05 19:54:10: privKey: <Buffer d8 85 b7 b0 8a 43 fe 8e 7c 5f c9 d3 af 0d 33 89 a2 da 36 4c 95 72 e1 d8 ef 6a 5b a4 c9 dd ca 75>
28
+ 2026-03-05 19:54:10: },
29
+ 2026-03-05 19:54:10: lastRemoteEphemeralKey: <Buffer 05 00 d9 14 ba f1 d0 c2 c8 9a ac c3 dd cb c5 c0 fa 4e 40 10 99 bf 78 b3 03 a6 6d 3d ec 32 4a b2 65>,
30
+ 2026-03-05 19:54:10: previousCounter: 0,
31
+ 2026-03-05 19:54:10: rootKey: <Buffer 9c ea de a7 65 11 20 cd 78 4d 26 af 04 97 89 3a 60 f3 ae c9 3d 77 f4 59 ea 5c 1b 20 ea 1b 68 7e>
32
+ 2026-03-05 19:54:10: },
33
+ 2026-03-05 19:54:10: indexInfo: {
34
+ 2026-03-05 19:54:10: baseKey: <Buffer 05 ef 03 72 3e 7b c1 f1 d0 7b 7f ca a5 44 51 22 9a fc 82 5b 47 60 92 c8 a1 db 84 ad 6b 79 12 35 22>,
35
+ 2026-03-05 19:54:10: baseKeyType: 2,
36
+ 2026-03-05 19:54:10: closed: -1,
37
+ 2026-03-05 19:54:10: used: 1772736848203,
38
+ 2026-03-05 19:54:10: created: 1772736848203,
39
+ 2026-03-05 19:54:10: remoteIdentityKey: <Buffer 05 77 f5 0b 9d bd dc 37 d4 af cf 0e ba 1e f9 62 e2 31 0c d6 13 ce 68 ff 0c f9 a7 d4 7b fb ec ce 1d>
40
+ 2026-03-05 19:54:10: }
41
+ 2026-03-05 19:54:10: }
42
+ 2026-03-05 19:56:01: Closing session: SessionEntry {
43
+ 2026-03-05 19:56:01: _chains: {
44
+ 2026-03-05 19:56:01: BWzsTCgB4Oexii4nnddiCmEWWOeeoCnxjE1kZXetZnEp: { chainKey: [Object], chainType: 2, messageKeys: {} },
45
+ 2026-03-05 19:56:01: 'BUK3+8ASHqSDX27FF4QognQvAVUV3FJrddpzukI9V98F': { chainKey: [Object], chainType: 1, messageKeys: {} }
46
+ 2026-03-05 19:56:01: },
47
+ 2026-03-05 19:56:01: registrationId: 6971310,
48
+ 2026-03-05 19:56:01: currentRatchet: {
49
+ 2026-03-05 19:56:01: ephemeralKeyPair: {
50
+ 2026-03-05 19:56:01: pubKey: <Buffer 05 42 b7 fb c0 12 1e a4 83 5f 6e c5 17 84 28 82 74 2f 01 55 15 dc 52 6b 75 da 73 ba 42 3d 57 df 05>,
51
+ 2026-03-05 19:56:01: privKey: <Buffer 90 b4 00 87 ba 0b 0b de 13 b9 c5 4c 58 97 90 01 5d 93 16 0f f1 a4 67 e7 21 a5 e4 a7 90 85 81 4a>
52
+ 2026-03-05 19:56:01: },
53
+ 2026-03-05 19:56:01: lastRemoteEphemeralKey: <Buffer 05 6c ec 4c 28 01 e0 e7 b1 8a 2e 27 9d d7 62 0a 61 16 58 e7 9e a0 29 f1 8c 4d 64 65 77 ad 66 71 29>,
54
+ 2026-03-05 19:56:01: previousCounter: 0,
55
+ 2026-03-05 19:56:01: rootKey: <Buffer 2f 8d 69 30 67 7c df 08 b4 14 2b cb da 81 74 0c 6d 75 6d 1d dd 16 a7 ee ba 81 c5 e7 4c be 86 bb>
56
+ 2026-03-05 19:56:01: },
57
+ 2026-03-05 19:56:01: indexInfo: {
58
+ 2026-03-05 19:56:01: baseKey: <Buffer 05 af 0d cc 21 e1 dd 7e fd 6a 29 3f 4c 40 1d 1d 25 be f6 1e 00 65 05 2d a5 47 b1 18 e4 78 52 05 5b>,
59
+ 2026-03-05 19:56:01: baseKeyType: 2,
60
+ 2026-03-05 19:56:01: closed: -1,
61
+ 2026-03-05 19:56:01: used: 1772736960772,
62
+ 2026-03-05 19:56:01: created: 1772736960772,
63
+ 2026-03-05 19:56:01: remoteIdentityKey: <Buffer 05 77 f5 0b 9d bd dc 37 d4 af cf 0e ba 1e f9 62 e2 31 0c d6 13 ce 68 ff 0c f9 a7 d4 7b fb ec ce 1d>
64
+ 2026-03-05 19:56:01: }
65
+ 2026-03-05 19:56:01: }
66
+ 2026-03-05 19:56:06: Closing session: SessionEntry {
67
+ 2026-03-05 19:56:06: _chains: {
68
+ 2026-03-05 19:56:06: 'BfboMzdiDlz8szVAP/BdZIOC5RokX5mkejM32IMi+gAn': { chainKey: [Object], chainType: 1, messageKeys: {} }
69
+ 2026-03-05 19:56:06: },
70
+ 2026-03-05 19:56:06: registrationId: 179,
71
+ 2026-03-05 19:56:06: currentRatchet: {
72
+ 2026-03-05 19:56:06: ephemeralKeyPair: {
73
+ 2026-03-05 19:56:06: pubKey: <Buffer 05 f6 e8 33 37 62 0e 5c fc b3 35 40 3f f0 5d 64 83 82 e5 1a 24 5f 99 a4 7a 33 37 d8 83 22 fa 00 27>,
74
+ 2026-03-05 19:56:06: privKey: <Buffer d8 9f 70 09 9a 2e ae ea b3 ea 37 eb 56 dc 87 51 a8 be 3e 92 f7 5d a1 3a 83 dc 21 45 fe 70 24 40>
75
+ 2026-03-05 19:56:06: },
76
+ 2026-03-05 19:56:06: lastRemoteEphemeralKey: <Buffer 05 62 84 f4 72 b0 65 2d 5b 72 08 94 18 2c dd 77 53 86 a9 60 9f 45 7c 7f fa 3e d7 23 47 a0 8f d1 14>,
77
+ 2026-03-05 19:56:06: previousCounter: 0,
78
+ 2026-03-05 19:56:06: rootKey: <Buffer 2b 0e 69 ed e4 19 ae 59 d9 86 f1 b0 8c 96 38 3b e8 20 5d 1a 65 2b ff b0 a2 77 46 06 91 b7 5f fb>
79
+ 2026-03-05 19:56:06: },
80
+ 2026-03-05 19:56:06: indexInfo: {
81
+ 2026-03-05 19:56:06: baseKey: <Buffer 05 6d 54 bd 52 9b 1e d5 5c cc 78 a0 6e 6c da f8 6a 58 57 83 bf 31 83 1f 89 09 52 ea c3 2f 93 73 5c>,
82
+ 2026-03-05 19:56:06: baseKeyType: 1,
83
+ 2026-03-05 19:56:06: closed: -1,
84
+ 2026-03-05 19:56:06: used: 1772736962010,
85
+ 2026-03-05 19:56:06: created: 1772736962010,
86
+ 2026-03-05 19:56:06: remoteIdentityKey: <Buffer 05 49 ad f2 cf 3b 33 c5 c7 e9 e7 fe a0 78 40 6d 9d 6c f6 e2 1c 34 66 e9 da 59 54 01 48 6b ed 9a 61>
87
+ 2026-03-05 19:56:06: },
88
+ 2026-03-05 19:56:06: pendingPreKey: {
89
+ 2026-03-05 19:56:06: signedKeyId: 1,
90
+ 2026-03-05 19:56:06: baseKey: <Buffer 05 6d 54 bd 52 9b 1e d5 5c cc 78 a0 6e 6c da f8 6a 58 57 83 bf 31 83 1f 89 09 52 ea c3 2f 93 73 5c>,
91
+ 2026-03-05 19:56:06: preKeyId: 1135
92
+ 2026-03-05 19:56:06: }
93
+ 2026-03-05 19:56:06: }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.355",
3
+ "version": "0.5.357",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {