@agenticmail/api 0.5.43 → 0.5.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1396,11 +1396,17 @@ function createMailRoutes(accountManager, config, db, gatewayManager) {
|
|
|
1396
1396
|
|
|
1397
1397
|
// src/routes/inbound.ts
|
|
1398
1398
|
import { Router as Router4 } from "express";
|
|
1399
|
+
import { randomUUID } from "crypto";
|
|
1399
1400
|
import {
|
|
1400
1401
|
parseEmail as parseEmail2,
|
|
1401
1402
|
MailSender as MailSender2
|
|
1402
1403
|
} from "@agenticmail/core";
|
|
1403
|
-
var INBOUND_SECRET = process.env.AGENTICMAIL_INBOUND_SECRET ||
|
|
1404
|
+
var INBOUND_SECRET = process.env.AGENTICMAIL_INBOUND_SECRET || (() => {
|
|
1405
|
+
const generated = randomUUID();
|
|
1406
|
+
console.warn("[Inbound] WARNING: AGENTICMAIL_INBOUND_SECRET is not set. Generated a random secret for this session.");
|
|
1407
|
+
console.warn(`[Inbound] Set AGENTICMAIL_INBOUND_SECRET="${generated}" in your environment to persist it across restarts.`);
|
|
1408
|
+
return generated;
|
|
1409
|
+
})();
|
|
1404
1410
|
var DEBUG = () => !!process.env.AGENTICMAIL_DEBUG;
|
|
1405
1411
|
function createInboundRoutes(accountManager, config, gatewayManager) {
|
|
1406
1412
|
const router = Router4();
|
|
@@ -2202,7 +2208,9 @@ function createEventRoutes(accountManager, config, db) {
|
|
|
2202
2208
|
host: config.imap.host,
|
|
2203
2209
|
port: config.imap.port,
|
|
2204
2210
|
email: agent.stalwartPrincipal,
|
|
2205
|
-
password
|
|
2211
|
+
password,
|
|
2212
|
+
autoReconnect: true,
|
|
2213
|
+
maxReconnectAttempts: 20
|
|
2206
2214
|
});
|
|
2207
2215
|
try {
|
|
2208
2216
|
await watcher.start();
|
|
@@ -2329,6 +2337,21 @@ function createEventRoutes(accountManager, config, db) {
|
|
|
2329
2337
|
watcher.on("error", (err) => {
|
|
2330
2338
|
safeWrite(`data: ${JSON.stringify({ type: "error", message: err.message })}
|
|
2331
2339
|
|
|
2340
|
+
`);
|
|
2341
|
+
});
|
|
2342
|
+
watcher.on("reconnecting", (info) => {
|
|
2343
|
+
safeWrite(`data: ${JSON.stringify({ type: "reconnecting", attempt: info.attempt, delayMs: info.delayMs })}
|
|
2344
|
+
|
|
2345
|
+
`);
|
|
2346
|
+
});
|
|
2347
|
+
watcher.on("reconnected", (info) => {
|
|
2348
|
+
safeWrite(`data: ${JSON.stringify({ type: "reconnected", attempt: info.attempt })}
|
|
2349
|
+
|
|
2350
|
+
`);
|
|
2351
|
+
});
|
|
2352
|
+
watcher.on("reconnect_failed", (info) => {
|
|
2353
|
+
safeWrite(`data: ${JSON.stringify({ type: "reconnect_failed", attempts: info.attempts })}
|
|
2354
|
+
|
|
2332
2355
|
`);
|
|
2333
2356
|
});
|
|
2334
2357
|
const pingInterval = setInterval(() => {
|