@essentialai/cogent-bridge-bundled 3.23.2 → 3.23.4
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/cogent-bridge.mjs +731 -318
- package/package.json +1 -1
package/cogent-bridge.mjs
CHANGED
|
@@ -1259,8 +1259,8 @@ var init_parseUtil = __esm({
|
|
|
1259
1259
|
init_errors();
|
|
1260
1260
|
init_en();
|
|
1261
1261
|
makeIssue = (params) => {
|
|
1262
|
-
const { data, path:
|
|
1263
|
-
const fullPath = [...
|
|
1262
|
+
const { data, path: path24, errorMaps, issueData } = params;
|
|
1263
|
+
const fullPath = [...path24, ...issueData.path || []];
|
|
1264
1264
|
const fullIssue = {
|
|
1265
1265
|
...issueData,
|
|
1266
1266
|
path: fullPath
|
|
@@ -1540,11 +1540,11 @@ var init_types = __esm({
|
|
|
1540
1540
|
init_parseUtil();
|
|
1541
1541
|
init_util();
|
|
1542
1542
|
ParseInputLazyPath = class {
|
|
1543
|
-
constructor(parent, value,
|
|
1543
|
+
constructor(parent, value, path24, key) {
|
|
1544
1544
|
this._cachedPath = [];
|
|
1545
1545
|
this.parent = parent;
|
|
1546
1546
|
this.data = value;
|
|
1547
|
-
this._path =
|
|
1547
|
+
this._path = path24;
|
|
1548
1548
|
this._key = key;
|
|
1549
1549
|
}
|
|
1550
1550
|
get path() {
|
|
@@ -4996,10 +4996,10 @@ function assignProp(target, prop, value) {
|
|
|
4996
4996
|
configurable: true
|
|
4997
4997
|
});
|
|
4998
4998
|
}
|
|
4999
|
-
function getElementAtPath(obj,
|
|
5000
|
-
if (!
|
|
4999
|
+
function getElementAtPath(obj, path24) {
|
|
5000
|
+
if (!path24)
|
|
5001
5001
|
return obj;
|
|
5002
|
-
return
|
|
5002
|
+
return path24.reduce((acc, key) => acc?.[key], obj);
|
|
5003
5003
|
}
|
|
5004
5004
|
function promiseAllObject(promisesObj) {
|
|
5005
5005
|
const keys = Object.keys(promisesObj);
|
|
@@ -5248,11 +5248,11 @@ function aborted(x, startIndex = 0) {
|
|
|
5248
5248
|
}
|
|
5249
5249
|
return false;
|
|
5250
5250
|
}
|
|
5251
|
-
function prefixIssues(
|
|
5251
|
+
function prefixIssues(path24, issues) {
|
|
5252
5252
|
return issues.map((iss) => {
|
|
5253
5253
|
var _a;
|
|
5254
5254
|
(_a = iss).path ?? (_a.path = []);
|
|
5255
|
-
iss.path.unshift(
|
|
5255
|
+
iss.path.unshift(path24);
|
|
5256
5256
|
return iss;
|
|
5257
5257
|
});
|
|
5258
5258
|
}
|
|
@@ -17058,8 +17058,8 @@ var require_utils = __commonJS({
|
|
|
17058
17058
|
}
|
|
17059
17059
|
return ind;
|
|
17060
17060
|
}
|
|
17061
|
-
function removeDotSegments(
|
|
17062
|
-
let input =
|
|
17061
|
+
function removeDotSegments(path24) {
|
|
17062
|
+
let input = path24;
|
|
17063
17063
|
const output = [];
|
|
17064
17064
|
let nextSlash = -1;
|
|
17065
17065
|
let len = 0;
|
|
@@ -17258,8 +17258,8 @@ var require_schemes = __commonJS({
|
|
|
17258
17258
|
wsComponent.secure = void 0;
|
|
17259
17259
|
}
|
|
17260
17260
|
if (wsComponent.resourceName) {
|
|
17261
|
-
const [
|
|
17262
|
-
wsComponent.path =
|
|
17261
|
+
const [path24, query] = wsComponent.resourceName.split("?");
|
|
17262
|
+
wsComponent.path = path24 && path24 !== "/" ? path24 : void 0;
|
|
17263
17263
|
wsComponent.query = query;
|
|
17264
17264
|
wsComponent.resourceName = void 0;
|
|
17265
17265
|
}
|
|
@@ -20612,12 +20612,12 @@ var require_dist = __commonJS({
|
|
|
20612
20612
|
throw new Error(`Unknown format "${name}"`);
|
|
20613
20613
|
return f;
|
|
20614
20614
|
};
|
|
20615
|
-
function addFormats(ajv, list,
|
|
20615
|
+
function addFormats(ajv, list, fs22, exportName) {
|
|
20616
20616
|
var _a;
|
|
20617
20617
|
var _b;
|
|
20618
20618
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
20619
20619
|
for (const f of list)
|
|
20620
|
-
ajv.addFormat(f,
|
|
20620
|
+
ajv.addFormat(f, fs22[f]);
|
|
20621
20621
|
}
|
|
20622
20622
|
module.exports = exports = formatsPlugin;
|
|
20623
20623
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -21729,8 +21729,8 @@ var require_parseUtil = __commonJS({
|
|
|
21729
21729
|
var errors_js_1 = require_errors2();
|
|
21730
21730
|
var en_js_1 = __importDefault(require_en());
|
|
21731
21731
|
var makeIssue2 = (params) => {
|
|
21732
|
-
const { data, path:
|
|
21733
|
-
const fullPath = [...
|
|
21732
|
+
const { data, path: path24, errorMaps, issueData } = params;
|
|
21733
|
+
const fullPath = [...path24, ...issueData.path || []];
|
|
21734
21734
|
const fullIssue = {
|
|
21735
21735
|
...issueData,
|
|
21736
21736
|
path: fullPath
|
|
@@ -21884,11 +21884,11 @@ var require_types2 = __commonJS({
|
|
|
21884
21884
|
var parseUtil_js_1 = require_parseUtil();
|
|
21885
21885
|
var util_js_1 = require_util2();
|
|
21886
21886
|
var ParseInputLazyPath2 = class {
|
|
21887
|
-
constructor(parent, value,
|
|
21887
|
+
constructor(parent, value, path24, key) {
|
|
21888
21888
|
this._cachedPath = [];
|
|
21889
21889
|
this.parent = parent;
|
|
21890
21890
|
this.data = value;
|
|
21891
|
-
this._path =
|
|
21891
|
+
this._path = path24;
|
|
21892
21892
|
this._key = key;
|
|
21893
21893
|
}
|
|
21894
21894
|
get path() {
|
|
@@ -26389,8 +26389,8 @@ var init_stdio2 = __esm({
|
|
|
26389
26389
|
// src/constants.ts
|
|
26390
26390
|
import { createRequire } from "node:module";
|
|
26391
26391
|
function resolveVersion() {
|
|
26392
|
-
if ("3.23.
|
|
26393
|
-
return "3.23.
|
|
26392
|
+
if ("3.23.4") {
|
|
26393
|
+
return "3.23.4";
|
|
26394
26394
|
}
|
|
26395
26395
|
try {
|
|
26396
26396
|
const require2 = createRequire(import.meta.url);
|
|
@@ -27826,7 +27826,7 @@ var init_http_backend = __esm({
|
|
|
27826
27826
|
* in cloud mode we ignore it and use this.sessionId (the cloud session).
|
|
27827
27827
|
*/
|
|
27828
27828
|
async registerPeer(peerId, _sessionId, cwd, label, clientVersion, mode, _channelSessionId, capabilities, workspaceId, threadId, peerSecret) {
|
|
27829
|
-
const
|
|
27829
|
+
const path24 = PATHS.peers.replace(":sessionId", this.sessionId);
|
|
27830
27830
|
const body = {
|
|
27831
27831
|
peerId,
|
|
27832
27832
|
cwd,
|
|
@@ -27857,7 +27857,7 @@ var init_http_backend = __esm({
|
|
|
27857
27857
|
if (peerSecret !== void 0 && await relaySupports(this.http, "peer-ownership")) {
|
|
27858
27858
|
body.peerSecret = peerSecret;
|
|
27859
27859
|
}
|
|
27860
|
-
return this.http.post(
|
|
27860
|
+
return this.http.post(path24, body);
|
|
27861
27861
|
}
|
|
27862
27862
|
/**
|
|
27863
27863
|
* Deregister a peer from the cloud session.
|
|
@@ -27869,9 +27869,9 @@ var init_http_backend = __esm({
|
|
|
27869
27869
|
* local mail creds. A 404 (peer not found) resolves to `{ removed: false, ... }`, not a throw.
|
|
27870
27870
|
*/
|
|
27871
27871
|
async deregisterPeer(peerId) {
|
|
27872
|
-
const
|
|
27872
|
+
const path24 = PATHS.peer.replace(":sessionId", this.sessionId).replace(":peerId", peerId);
|
|
27873
27873
|
try {
|
|
27874
|
-
const headers = await this.http.delete(
|
|
27874
|
+
const headers = await this.http.delete(path24, {});
|
|
27875
27875
|
const mailboxDeprovisioned = headers.get(MAILBOX_DEPROVISIONED_HEADER) === "true";
|
|
27876
27876
|
return { removed: true, mailboxDeprovisioned };
|
|
27877
27877
|
} catch (err) {
|
|
@@ -27895,8 +27895,8 @@ var init_http_backend = __esm({
|
|
|
27895
27895
|
* GET /api/sessions/:sessionId/peers
|
|
27896
27896
|
*/
|
|
27897
27897
|
async listPeers() {
|
|
27898
|
-
const
|
|
27899
|
-
const result = await this.http.get(
|
|
27898
|
+
const path24 = PATHS.peers.replace(":sessionId", this.sessionId);
|
|
27899
|
+
const result = await this.http.get(path24);
|
|
27900
27900
|
return result.peers;
|
|
27901
27901
|
}
|
|
27902
27902
|
/**
|
|
@@ -27904,8 +27904,8 @@ var init_http_backend = __esm({
|
|
|
27904
27904
|
* Calls the lightweight heartbeat endpoint on the cloud relay server.
|
|
27905
27905
|
*/
|
|
27906
27906
|
async updateLastSeen(peerId) {
|
|
27907
|
-
const
|
|
27908
|
-
await this.http.post(
|
|
27907
|
+
const path24 = PATHS.heartbeat.replace(":sessionId", this.sessionId);
|
|
27908
|
+
await this.http.post(path24, { peerId });
|
|
27909
27909
|
}
|
|
27910
27910
|
/**
|
|
27911
27911
|
* Record a message in the cloud session.
|
|
@@ -27916,7 +27916,7 @@ var init_http_backend = __esm({
|
|
|
27916
27916
|
* the input record to construct a full MessageRecord.
|
|
27917
27917
|
*/
|
|
27918
27918
|
async recordMessage(record2) {
|
|
27919
|
-
const
|
|
27919
|
+
const path24 = PATHS.messages.replace(":sessionId", this.sessionId);
|
|
27920
27920
|
const body = {
|
|
27921
27921
|
fromPeerId: record2.fromPeerId,
|
|
27922
27922
|
toPeerId: record2.toPeerId,
|
|
@@ -27939,7 +27939,7 @@ var init_http_backend = __esm({
|
|
|
27939
27939
|
if (record2.attachments && record2.attachments.length > 0) {
|
|
27940
27940
|
body.attachments = record2.attachments;
|
|
27941
27941
|
}
|
|
27942
|
-
const resp = await this.http.post(
|
|
27942
|
+
const resp = await this.http.post(path24, body);
|
|
27943
27943
|
return {
|
|
27944
27944
|
...record2,
|
|
27945
27945
|
id: resp.id,
|
|
@@ -27953,7 +27953,7 @@ var init_http_backend = __esm({
|
|
|
27953
27953
|
* Supports optional peerId filter and limit (default 300).
|
|
27954
27954
|
*/
|
|
27955
27955
|
async getHistory(peerId, limit, includeRelayEchoes, metadataOnly, dedupInferredEchoes) {
|
|
27956
|
-
const
|
|
27956
|
+
const path24 = PATHS.messages.replace(":sessionId", this.sessionId);
|
|
27957
27957
|
const query = {};
|
|
27958
27958
|
if (peerId) {
|
|
27959
27959
|
query.peerId = peerId;
|
|
@@ -27968,7 +27968,7 @@ var init_http_backend = __esm({
|
|
|
27968
27968
|
if (dedupInferredEchoes) {
|
|
27969
27969
|
query.dedupInferredEchoes = "true";
|
|
27970
27970
|
}
|
|
27971
|
-
const result = await this.http.get(
|
|
27971
|
+
const result = await this.http.get(path24, query);
|
|
27972
27972
|
return result.messages;
|
|
27973
27973
|
}
|
|
27974
27974
|
/**
|
|
@@ -27979,12 +27979,12 @@ var init_http_backend = __esm({
|
|
|
27979
27979
|
* so that get-history shows the actual response (not null).
|
|
27980
27980
|
*/
|
|
27981
27981
|
async updateMessageResponse(messageId, response, durationMs, pending) {
|
|
27982
|
-
const
|
|
27982
|
+
const path24 = PATHS.message.replace(":sessionId", this.sessionId).replace(":messageId", messageId);
|
|
27983
27983
|
const body = { response, durationMs };
|
|
27984
27984
|
if (pending === true) {
|
|
27985
27985
|
body.pending = true;
|
|
27986
27986
|
}
|
|
27987
|
-
await this.http.patch(
|
|
27987
|
+
await this.http.patch(path24, body);
|
|
27988
27988
|
}
|
|
27989
27989
|
/**
|
|
27990
27990
|
* Validate a session.
|
|
@@ -28126,8 +28126,8 @@ var init_http_client = __esm({
|
|
|
28126
28126
|
* Perform an authenticated GET request.
|
|
28127
28127
|
* Appends query parameters to the URL if provided.
|
|
28128
28128
|
*/
|
|
28129
|
-
async get(
|
|
28130
|
-
const url = new URL(
|
|
28129
|
+
async get(path24, query) {
|
|
28130
|
+
const url = new URL(path24, this.baseUrl);
|
|
28131
28131
|
if (query) {
|
|
28132
28132
|
for (const [k, v] of Object.entries(query)) {
|
|
28133
28133
|
url.searchParams.set(k, v);
|
|
@@ -28142,8 +28142,8 @@ var init_http_client = __esm({
|
|
|
28142
28142
|
/**
|
|
28143
28143
|
* Perform an authenticated POST request with a JSON body.
|
|
28144
28144
|
*/
|
|
28145
|
-
async post(
|
|
28146
|
-
const url = new URL(
|
|
28145
|
+
async post(path24, body) {
|
|
28146
|
+
const url = new URL(path24, this.baseUrl);
|
|
28147
28147
|
const resp = await this.fetchWithTimeout(url, {
|
|
28148
28148
|
method: "POST",
|
|
28149
28149
|
headers: this.headers(),
|
|
@@ -28161,8 +28161,8 @@ var init_http_client = __esm({
|
|
|
28161
28161
|
* Perform an authenticated PATCH request with a JSON body.
|
|
28162
28162
|
* Used to update existing resources (e.g., message response fields).
|
|
28163
28163
|
*/
|
|
28164
|
-
async patch(
|
|
28165
|
-
const url = new URL(
|
|
28164
|
+
async patch(path24, body) {
|
|
28165
|
+
const url = new URL(path24, this.baseUrl);
|
|
28166
28166
|
const resp = await this.fetchWithTimeout(url, {
|
|
28167
28167
|
method: "PATCH",
|
|
28168
28168
|
headers: this.headers(),
|
|
@@ -28187,8 +28187,8 @@ var init_http_client = __esm({
|
|
|
28187
28187
|
* "Malformed JSON in request body" 400 from cogent-server <=3.1.2 when
|
|
28188
28188
|
* any client (including third-party tools) DELETEd a peer without a body.
|
|
28189
28189
|
*/
|
|
28190
|
-
async delete(
|
|
28191
|
-
const url = new URL(
|
|
28190
|
+
async delete(path24, body) {
|
|
28191
|
+
const url = new URL(path24, this.baseUrl);
|
|
28192
28192
|
const headers = {
|
|
28193
28193
|
"Authorization": `Bearer ${this.token}`
|
|
28194
28194
|
};
|
|
@@ -32393,14 +32393,14 @@ var init_ws_client = __esm({
|
|
|
32393
32393
|
if (this.pollTimer) return;
|
|
32394
32394
|
const poll = async () => {
|
|
32395
32395
|
try {
|
|
32396
|
-
const
|
|
32396
|
+
const path24 = `/api/sessions/${this.opts.sessionId}/poll`;
|
|
32397
32397
|
const query = {
|
|
32398
32398
|
peerId: this.opts.peerId
|
|
32399
32399
|
};
|
|
32400
32400
|
if (this.lastMessageId) {
|
|
32401
32401
|
query.lastMessageId = this.lastMessageId;
|
|
32402
32402
|
}
|
|
32403
|
-
const result = await this.opts.http.get(
|
|
32403
|
+
const result = await this.opts.http.get(path24, query);
|
|
32404
32404
|
if (result.messages && result.messages.length > 0) {
|
|
32405
32405
|
this.opts.onMessages(result.messages);
|
|
32406
32406
|
this.lastMessageId = result.messages[result.messages.length - 1].id;
|
|
@@ -33395,6 +33395,352 @@ var init_wake_inflight = __esm({
|
|
|
33395
33395
|
}
|
|
33396
33396
|
});
|
|
33397
33397
|
|
|
33398
|
+
// src/services/wake-claim.ts
|
|
33399
|
+
import crypto6 from "node:crypto";
|
|
33400
|
+
import fs15 from "node:fs";
|
|
33401
|
+
import os11 from "node:os";
|
|
33402
|
+
import path16 from "node:path";
|
|
33403
|
+
function hashCwd4(cwd) {
|
|
33404
|
+
return crypto6.createHash("sha256").update(path16.resolve(cwd)).digest("hex").slice(0, 16);
|
|
33405
|
+
}
|
|
33406
|
+
function wakeClaimPath(peerId, messageId, cwd = process.cwd()) {
|
|
33407
|
+
return path16.join(
|
|
33408
|
+
os11.homedir(),
|
|
33409
|
+
".cogent",
|
|
33410
|
+
"wake-claims",
|
|
33411
|
+
`${hashCwd4(cwd)}.${safe2(peerId)}.${safe2(messageId)}.json`
|
|
33412
|
+
);
|
|
33413
|
+
}
|
|
33414
|
+
function ttlMs2() {
|
|
33415
|
+
let timeout = 3e5;
|
|
33416
|
+
try {
|
|
33417
|
+
const c2 = getConfig()?.COGENT_TIMEOUT_MS;
|
|
33418
|
+
if (typeof c2 === "number" && Number.isFinite(c2) && c2 > 0) timeout = c2;
|
|
33419
|
+
} catch {
|
|
33420
|
+
}
|
|
33421
|
+
return Math.min(timeout * CLAIM_TIMEOUT_FACTOR, CLAIM_MAX_MS);
|
|
33422
|
+
}
|
|
33423
|
+
function holderAlive(pid) {
|
|
33424
|
+
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return false;
|
|
33425
|
+
if (pid === process.pid) return true;
|
|
33426
|
+
try {
|
|
33427
|
+
process.kill(pid, 0);
|
|
33428
|
+
return true;
|
|
33429
|
+
} catch (err) {
|
|
33430
|
+
return err?.code === "EPERM";
|
|
33431
|
+
}
|
|
33432
|
+
}
|
|
33433
|
+
function claimWake(peerId, messageId, cwd = process.cwd()) {
|
|
33434
|
+
const p = wakeClaimPath(peerId, messageId, cwd);
|
|
33435
|
+
const now = Date.now();
|
|
33436
|
+
const body = () => JSON.stringify({ pid: process.pid, startedAt: now, expiresAt: now + ttlMs2() });
|
|
33437
|
+
try {
|
|
33438
|
+
fs15.mkdirSync(path16.dirname(p), { recursive: true });
|
|
33439
|
+
try {
|
|
33440
|
+
fs15.writeFileSync(p, body(), { flag: "wx" });
|
|
33441
|
+
return true;
|
|
33442
|
+
} catch (err) {
|
|
33443
|
+
if (err?.code !== "EEXIST") throw err;
|
|
33444
|
+
}
|
|
33445
|
+
let held = null;
|
|
33446
|
+
try {
|
|
33447
|
+
held = JSON.parse(fs15.readFileSync(p, "utf-8"));
|
|
33448
|
+
} catch {
|
|
33449
|
+
held = null;
|
|
33450
|
+
}
|
|
33451
|
+
const expired = !held || typeof held.expiresAt !== "number" || held.expiresAt <= now;
|
|
33452
|
+
if (!held || expired || !holderAlive(held.pid)) {
|
|
33453
|
+
fs15.writeFileSync(p, body());
|
|
33454
|
+
logger.debug(`wake-claim: took over an abandoned claim for ${messageId}`);
|
|
33455
|
+
return true;
|
|
33456
|
+
}
|
|
33457
|
+
logger.info(
|
|
33458
|
+
`Auto-relay: SKIPPING wake for message ${messageId} \u2014 pid ${held.pid} in this cwd already has it. Another bridge process is registered as "${peerId}"; without this both would resume the same session and duplicate the work.`
|
|
33459
|
+
);
|
|
33460
|
+
return false;
|
|
33461
|
+
} catch (err) {
|
|
33462
|
+
logger.warn(`wake-claim: could not claim ${messageId} (${err.message}) \u2014 waking anyway`);
|
|
33463
|
+
return true;
|
|
33464
|
+
}
|
|
33465
|
+
}
|
|
33466
|
+
function releaseWake(peerId, messageId, cwd = process.cwd()) {
|
|
33467
|
+
try {
|
|
33468
|
+
fs15.unlinkSync(wakeClaimPath(peerId, messageId, cwd));
|
|
33469
|
+
} catch {
|
|
33470
|
+
}
|
|
33471
|
+
}
|
|
33472
|
+
var CLAIM_MAX_MS, CLAIM_TIMEOUT_FACTOR, safe2;
|
|
33473
|
+
var init_wake_claim = __esm({
|
|
33474
|
+
"src/services/wake-claim.ts"() {
|
|
33475
|
+
"use strict";
|
|
33476
|
+
init_config();
|
|
33477
|
+
init_logger();
|
|
33478
|
+
CLAIM_MAX_MS = 18e5;
|
|
33479
|
+
CLAIM_TIMEOUT_FACTOR = 3;
|
|
33480
|
+
safe2 = (s) => String(s).replace(/[^A-Za-z0-9._-]/g, "_");
|
|
33481
|
+
}
|
|
33482
|
+
});
|
|
33483
|
+
|
|
33484
|
+
// src/services/wake-lock.ts
|
|
33485
|
+
import crypto7 from "node:crypto";
|
|
33486
|
+
import fs16 from "node:fs";
|
|
33487
|
+
import os12 from "node:os";
|
|
33488
|
+
import path17 from "node:path";
|
|
33489
|
+
function hashCwd5(cwd) {
|
|
33490
|
+
return crypto7.createHash("sha256").update(path17.resolve(cwd)).digest("hex").slice(0, 16);
|
|
33491
|
+
}
|
|
33492
|
+
function wakeLockPath(cwd = process.cwd()) {
|
|
33493
|
+
return path17.join(os12.homedir(), ".cogent", "wake-locks", `${hashCwd5(cwd)}.json`);
|
|
33494
|
+
}
|
|
33495
|
+
function leaseTtlMs() {
|
|
33496
|
+
let timeout = 3e5;
|
|
33497
|
+
try {
|
|
33498
|
+
const c2 = getConfig()?.COGENT_TIMEOUT_MS;
|
|
33499
|
+
if (typeof c2 === "number" && Number.isFinite(c2) && c2 > 0) timeout = c2;
|
|
33500
|
+
} catch {
|
|
33501
|
+
}
|
|
33502
|
+
return Math.min(timeout * LEASE_TIMEOUT_FACTOR, WAKE_LOCK_MAX_MS);
|
|
33503
|
+
}
|
|
33504
|
+
function defaultMaxWaitMs() {
|
|
33505
|
+
try {
|
|
33506
|
+
const c2 = getConfig()?.COGENT_TIMEOUT_MS;
|
|
33507
|
+
if (typeof c2 === "number" && Number.isFinite(c2) && c2 > 0) return c2;
|
|
33508
|
+
} catch {
|
|
33509
|
+
}
|
|
33510
|
+
return 3e5;
|
|
33511
|
+
}
|
|
33512
|
+
function holderAlive2(pid) {
|
|
33513
|
+
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return false;
|
|
33514
|
+
if (pid === process.pid) return heldDepth > 0;
|
|
33515
|
+
try {
|
|
33516
|
+
process.kill(pid, 0);
|
|
33517
|
+
return true;
|
|
33518
|
+
} catch (err) {
|
|
33519
|
+
return err?.code === "EPERM";
|
|
33520
|
+
}
|
|
33521
|
+
}
|
|
33522
|
+
function readHolder(p) {
|
|
33523
|
+
try {
|
|
33524
|
+
const held = JSON.parse(fs16.readFileSync(p, "utf-8"));
|
|
33525
|
+
if (!held || typeof held.expiresAt !== "number") return null;
|
|
33526
|
+
return held;
|
|
33527
|
+
} catch {
|
|
33528
|
+
return null;
|
|
33529
|
+
}
|
|
33530
|
+
}
|
|
33531
|
+
async function acquireWakeLock(cwd = process.cwd(), sessionId = "unknown", opts = {}) {
|
|
33532
|
+
const p = wakeLockPath(cwd);
|
|
33533
|
+
const maxWaitMs = opts.maxWaitMs ?? defaultMaxWaitMs();
|
|
33534
|
+
const started = Date.now();
|
|
33535
|
+
let contended = false;
|
|
33536
|
+
if (heldDepth > 0) {
|
|
33537
|
+
heldDepth++;
|
|
33538
|
+
let released = false;
|
|
33539
|
+
return {
|
|
33540
|
+
acquired: true,
|
|
33541
|
+
waitedMs: 0,
|
|
33542
|
+
contended: false,
|
|
33543
|
+
release: () => {
|
|
33544
|
+
if (released) return;
|
|
33545
|
+
released = true;
|
|
33546
|
+
heldDepth--;
|
|
33547
|
+
}
|
|
33548
|
+
};
|
|
33549
|
+
}
|
|
33550
|
+
const lease = () => {
|
|
33551
|
+
heldDepth++;
|
|
33552
|
+
let released = false;
|
|
33553
|
+
return {
|
|
33554
|
+
acquired: true,
|
|
33555
|
+
waitedMs: Date.now() - started,
|
|
33556
|
+
contended,
|
|
33557
|
+
release: () => {
|
|
33558
|
+
if (released) return;
|
|
33559
|
+
released = true;
|
|
33560
|
+
heldDepth--;
|
|
33561
|
+
if (heldDepth === 0) releaseWakeLock(cwd);
|
|
33562
|
+
}
|
|
33563
|
+
};
|
|
33564
|
+
};
|
|
33565
|
+
const failOpen = (why) => {
|
|
33566
|
+
logger.warn(`wake-lock: ${why} \u2014 waking anyway (fail-open)`);
|
|
33567
|
+
return { acquired: true, waitedMs: Date.now() - started, contended, release: () => {
|
|
33568
|
+
} };
|
|
33569
|
+
};
|
|
33570
|
+
try {
|
|
33571
|
+
fs16.mkdirSync(path17.dirname(p), { recursive: true });
|
|
33572
|
+
} catch (err) {
|
|
33573
|
+
return failOpen(`cannot create lock dir (${err.message})`);
|
|
33574
|
+
}
|
|
33575
|
+
for (; ; ) {
|
|
33576
|
+
const now = Date.now();
|
|
33577
|
+
const body = JSON.stringify({
|
|
33578
|
+
pid: process.pid,
|
|
33579
|
+
sessionId,
|
|
33580
|
+
startedAt: now,
|
|
33581
|
+
expiresAt: now + leaseTtlMs()
|
|
33582
|
+
});
|
|
33583
|
+
try {
|
|
33584
|
+
fs16.writeFileSync(p, body, { flag: "wx" });
|
|
33585
|
+
if (contended) {
|
|
33586
|
+
logger.info(
|
|
33587
|
+
`Auto-relay: waited ${Date.now() - started}ms for another bridge process to finish its turn in this checkout before resuming \u2014 turns are serialised, not overlapping.`
|
|
33588
|
+
);
|
|
33589
|
+
}
|
|
33590
|
+
return lease();
|
|
33591
|
+
} catch (err) {
|
|
33592
|
+
if (err?.code !== "EEXIST") {
|
|
33593
|
+
return failOpen(`cannot write lock (${err.message})`);
|
|
33594
|
+
}
|
|
33595
|
+
}
|
|
33596
|
+
const held = readHolder(p);
|
|
33597
|
+
if (!held || held.expiresAt <= now || !holderAlive2(held.pid)) {
|
|
33598
|
+
try {
|
|
33599
|
+
fs16.writeFileSync(p, body);
|
|
33600
|
+
} catch (err) {
|
|
33601
|
+
return failOpen(`cannot steal abandoned lock (${err.message})`);
|
|
33602
|
+
}
|
|
33603
|
+
logger.debug(`wake-lock: took over an abandoned lease in ${cwd}`);
|
|
33604
|
+
return lease();
|
|
33605
|
+
}
|
|
33606
|
+
if (!contended) {
|
|
33607
|
+
contended = true;
|
|
33608
|
+
logger.info(
|
|
33609
|
+
`Auto-relay: pid ${held.pid} is already running an agent turn in this checkout (session ${held.sessionId}) \u2014 waiting for it rather than running a second resume over the same worktree. Two bridge processes are live for this cwd; if that is unexpected, check for a stale one left behind by a plugin update.`
|
|
33610
|
+
);
|
|
33611
|
+
}
|
|
33612
|
+
if (Date.now() - started >= maxWaitMs) {
|
|
33613
|
+
return failOpen(
|
|
33614
|
+
`pid ${held.pid} still holds this checkout after ${Date.now() - started}ms`
|
|
33615
|
+
);
|
|
33616
|
+
}
|
|
33617
|
+
await sleep3(POLL_MS);
|
|
33618
|
+
}
|
|
33619
|
+
}
|
|
33620
|
+
function releaseWakeLock(cwd = process.cwd()) {
|
|
33621
|
+
try {
|
|
33622
|
+
fs16.unlinkSync(wakeLockPath(cwd));
|
|
33623
|
+
} catch {
|
|
33624
|
+
}
|
|
33625
|
+
}
|
|
33626
|
+
var WAKE_LOCK_MAX_MS, LEASE_TIMEOUT_FACTOR, POLL_MS, heldDepth, sleep3;
|
|
33627
|
+
var init_wake_lock = __esm({
|
|
33628
|
+
"src/services/wake-lock.ts"() {
|
|
33629
|
+
"use strict";
|
|
33630
|
+
init_config();
|
|
33631
|
+
init_logger();
|
|
33632
|
+
WAKE_LOCK_MAX_MS = 18e5;
|
|
33633
|
+
LEASE_TIMEOUT_FACTOR = 3;
|
|
33634
|
+
POLL_MS = 250;
|
|
33635
|
+
heldDepth = 0;
|
|
33636
|
+
sleep3 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
33637
|
+
}
|
|
33638
|
+
});
|
|
33639
|
+
|
|
33640
|
+
// src/services/wake-ownership.ts
|
|
33641
|
+
import crypto8 from "node:crypto";
|
|
33642
|
+
import fs17 from "node:fs";
|
|
33643
|
+
import os13 from "node:os";
|
|
33644
|
+
import path18 from "node:path";
|
|
33645
|
+
function hashCwd6(cwd) {
|
|
33646
|
+
return crypto8.createHash("sha256").update(path18.resolve(cwd)).digest("hex").slice(0, 16);
|
|
33647
|
+
}
|
|
33648
|
+
function bridgeDirFor(cwd, peerId) {
|
|
33649
|
+
return path18.join(os13.homedir(), ".cogent", "bridges", `${hashCwd6(cwd)}.${safe3(peerId)}`);
|
|
33650
|
+
}
|
|
33651
|
+
function pidAlive(pid) {
|
|
33652
|
+
if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) return false;
|
|
33653
|
+
if (pid === process.pid) return true;
|
|
33654
|
+
try {
|
|
33655
|
+
process.kill(pid, 0);
|
|
33656
|
+
return true;
|
|
33657
|
+
} catch (err) {
|
|
33658
|
+
return err?.code === "EPERM";
|
|
33659
|
+
}
|
|
33660
|
+
}
|
|
33661
|
+
function announceBridge(cwd, peerId, version2, endpoint) {
|
|
33662
|
+
const dir = bridgeDirFor(cwd, peerId);
|
|
33663
|
+
try {
|
|
33664
|
+
fs17.mkdirSync(dir, { recursive: true });
|
|
33665
|
+
const entry = {
|
|
33666
|
+
pid: process.pid,
|
|
33667
|
+
startedAt: PROCESS_STARTED_AT,
|
|
33668
|
+
version: version2,
|
|
33669
|
+
peerId,
|
|
33670
|
+
endpoint,
|
|
33671
|
+
cwd: path18.resolve(cwd)
|
|
33672
|
+
};
|
|
33673
|
+
fs17.writeFileSync(path18.join(dir, `${process.pid}.json`), JSON.stringify(entry));
|
|
33674
|
+
} catch (err) {
|
|
33675
|
+
logger.debug(`wake-ownership: could not announce this bridge (${err.message})`);
|
|
33676
|
+
}
|
|
33677
|
+
}
|
|
33678
|
+
function withdrawBridge(cwd, peerId) {
|
|
33679
|
+
try {
|
|
33680
|
+
fs17.unlinkSync(path18.join(bridgeDirFor(cwd, peerId), `${process.pid}.json`));
|
|
33681
|
+
} catch {
|
|
33682
|
+
}
|
|
33683
|
+
}
|
|
33684
|
+
function listLiveBridges(cwd, peerId) {
|
|
33685
|
+
const dir = bridgeDirFor(cwd, peerId);
|
|
33686
|
+
let names;
|
|
33687
|
+
try {
|
|
33688
|
+
names = fs17.readdirSync(dir);
|
|
33689
|
+
} catch {
|
|
33690
|
+
return [];
|
|
33691
|
+
}
|
|
33692
|
+
const live = [];
|
|
33693
|
+
for (const name of names) {
|
|
33694
|
+
if (!name.endsWith(".json")) continue;
|
|
33695
|
+
const p = path18.join(dir, name);
|
|
33696
|
+
let entry = null;
|
|
33697
|
+
try {
|
|
33698
|
+
entry = JSON.parse(fs17.readFileSync(p, "utf-8"));
|
|
33699
|
+
} catch {
|
|
33700
|
+
entry = null;
|
|
33701
|
+
}
|
|
33702
|
+
if (!entry || !pidAlive(entry.pid) || typeof entry.startedAt !== "number") {
|
|
33703
|
+
try {
|
|
33704
|
+
fs17.unlinkSync(p);
|
|
33705
|
+
} catch {
|
|
33706
|
+
}
|
|
33707
|
+
continue;
|
|
33708
|
+
}
|
|
33709
|
+
live.push(entry);
|
|
33710
|
+
}
|
|
33711
|
+
live.sort((a, b) => b.startedAt - a.startedAt || b.pid - a.pid);
|
|
33712
|
+
return live;
|
|
33713
|
+
}
|
|
33714
|
+
function checkWakeOwnership(cwd, peerId) {
|
|
33715
|
+
let live;
|
|
33716
|
+
try {
|
|
33717
|
+
live = listLiveBridges(cwd, peerId);
|
|
33718
|
+
} catch (err) {
|
|
33719
|
+
logger.warn(`wake-ownership: could not read bridge registry (${err.message}) \u2014 assuming ownership`);
|
|
33720
|
+
return { isOwner: true, liveCount: 1 };
|
|
33721
|
+
}
|
|
33722
|
+
if (live.length === 0) return { isOwner: true, liveCount: 0 };
|
|
33723
|
+
const owner = live[0];
|
|
33724
|
+
if (owner.pid === process.pid) return { isOwner: true, liveCount: live.length };
|
|
33725
|
+
if (live.some((e) => e.pid === process.pid)) {
|
|
33726
|
+
return {
|
|
33727
|
+
isOwner: false,
|
|
33728
|
+
owner: { pid: owner.pid, version: owner.version, endpoint: owner.endpoint },
|
|
33729
|
+
liveCount: live.length
|
|
33730
|
+
};
|
|
33731
|
+
}
|
|
33732
|
+
return { isOwner: true, liveCount: live.length + 1 };
|
|
33733
|
+
}
|
|
33734
|
+
var PROCESS_STARTED_AT, safe3;
|
|
33735
|
+
var init_wake_ownership = __esm({
|
|
33736
|
+
"src/services/wake-ownership.ts"() {
|
|
33737
|
+
"use strict";
|
|
33738
|
+
init_logger();
|
|
33739
|
+
PROCESS_STARTED_AT = Date.now() - Math.floor(process.uptime() * 1e3);
|
|
33740
|
+
safe3 = (s) => String(s).replace(/[^A-Za-z0-9._-]/g, "_");
|
|
33741
|
+
}
|
|
33742
|
+
});
|
|
33743
|
+
|
|
33398
33744
|
// src/services/auto-relay.ts
|
|
33399
33745
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
33400
33746
|
function buildStatusNotice(status, peerId, traceId) {
|
|
@@ -33534,6 +33880,10 @@ var init_auto_relay = __esm({
|
|
|
33534
33880
|
init_backend();
|
|
33535
33881
|
init_codex_cli();
|
|
33536
33882
|
init_wake_inflight();
|
|
33883
|
+
init_wake_claim();
|
|
33884
|
+
init_wake_lock();
|
|
33885
|
+
init_wake_ownership();
|
|
33886
|
+
init_constants();
|
|
33537
33887
|
init_logger();
|
|
33538
33888
|
init_npm_update_check();
|
|
33539
33889
|
RELAY_STATUS = {
|
|
@@ -33580,6 +33930,8 @@ var init_auto_relay = __esm({
|
|
|
33580
33930
|
*/
|
|
33581
33931
|
localLabel = null;
|
|
33582
33932
|
processing = false;
|
|
33933
|
+
/** Senders already told this bridge is superseded — one notice each, not one per message. */
|
|
33934
|
+
supersededNotified = /* @__PURE__ */ new Set();
|
|
33583
33935
|
queue = [];
|
|
33584
33936
|
// Message ids to be handled inject-only (full-group-chat awareness) rather than
|
|
33585
33937
|
// full-wake+reply. Shares the `processing` lock + `queue` so an awareness inject
|
|
@@ -33626,6 +33978,8 @@ var init_auto_relay = __esm({
|
|
|
33626
33978
|
logger.info(
|
|
33627
33979
|
`Auto-relay configured for peer ${peerId} (session: ${sessionId}, pinned: ${this.pinnedSessionId}, mode: ${this.localMode}, label: ${this.localLabel})`
|
|
33628
33980
|
);
|
|
33981
|
+
announceBridge(cwd, peerId, CLIENT_VERSION, getConfig().COGENT_ENDPOINT ?? "local");
|
|
33982
|
+
this.supersededNotified.clear();
|
|
33629
33983
|
}
|
|
33630
33984
|
/**
|
|
33631
33985
|
* Emit one content-free wake-trace line (ids/decisions/timings only — NEVER
|
|
@@ -33990,7 +34344,17 @@ var init_auto_relay = __esm({
|
|
|
33990
34344
|
);
|
|
33991
34345
|
}
|
|
33992
34346
|
}
|
|
34347
|
+
if (this.localPeerId && this.localCwd) {
|
|
34348
|
+
const own = checkWakeOwnership(this.localCwd, this.localPeerId);
|
|
34349
|
+
if (!own.isOwner) {
|
|
34350
|
+
await this._reportSuperseded(msg, own.owner);
|
|
34351
|
+
return;
|
|
34352
|
+
}
|
|
34353
|
+
}
|
|
33993
34354
|
if (this.localPeerId && !this.awarenessOnly.has(msg.id)) {
|
|
34355
|
+
if (!claimWake(this.localPeerId, msg.id, this.localCwd ?? process.cwd())) {
|
|
34356
|
+
return;
|
|
34357
|
+
}
|
|
33994
34358
|
markWakeInFlight(this.localPeerId, msg.id, msg.traceId);
|
|
33995
34359
|
}
|
|
33996
34360
|
if (this.processing) {
|
|
@@ -34017,6 +34381,40 @@ var init_auto_relay = __esm({
|
|
|
34017
34381
|
}
|
|
34018
34382
|
}
|
|
34019
34383
|
}
|
|
34384
|
+
/**
|
|
34385
|
+
* Tell the sender we are a LEFTOVER bridge and are not answering — instead of going silent.
|
|
34386
|
+
*
|
|
34387
|
+
* Silence is the failure mode this codebase treats as worst: it is indistinguishable from
|
|
34388
|
+
* "nothing to do". A superseded bridge is usually reachable on a channel the newer bridge is NOT
|
|
34389
|
+
* on (the measured case had the ghost on the FREE relay and the live one on TEAM), so without
|
|
34390
|
+
* this the sender would wait forever with no explanation.
|
|
34391
|
+
*
|
|
34392
|
+
* Once per sender per process — a leftover that is being messaged steadily must not turn into a
|
|
34393
|
+
* notice generator.
|
|
34394
|
+
*/
|
|
34395
|
+
async _reportSuperseded(msg, owner) {
|
|
34396
|
+
const who = owner ? `pid ${owner.pid} (v${owner.version}, ${owner.endpoint})` : "a newer bridge";
|
|
34397
|
+
logger.warn(
|
|
34398
|
+
`Auto-relay: NOT waking for ${msg.fromPeerId} \u2014 this bridge (pid ${process.pid}, v${CLIENT_VERSION}) has been superseded for peer "${this.localPeerId}" in this checkout by ${who}. It is a leftover process; the newer bridge is answering. Standing down.`
|
|
34399
|
+
);
|
|
34400
|
+
if (this.supersededNotified.has(msg.fromPeerId)) return;
|
|
34401
|
+
this.supersededNotified.add(msg.fromPeerId);
|
|
34402
|
+
try {
|
|
34403
|
+
await getBackend().recordMessage({
|
|
34404
|
+
fromPeerId: this.localPeerId,
|
|
34405
|
+
toPeerId: msg.fromPeerId,
|
|
34406
|
+
message: `\u26A0\uFE0F "${this.localPeerId}" is not answering on this channel: this bridge process is a leftover (v${CLIENT_VERSION}) that a newer one has replaced in the same checkout. Send to the agent on its current channel instead.`,
|
|
34407
|
+
response: null,
|
|
34408
|
+
durationMs: 0,
|
|
34409
|
+
success: false,
|
|
34410
|
+
error: "BRIDGE_SUPERSEDED",
|
|
34411
|
+
isRelayEcho: true,
|
|
34412
|
+
traceId: msg.traceId
|
|
34413
|
+
});
|
|
34414
|
+
} catch (err) {
|
|
34415
|
+
logger.error(`Auto-relay: failed to record superseded notice: ${err}`);
|
|
34416
|
+
}
|
|
34417
|
+
}
|
|
34020
34418
|
/**
|
|
34021
34419
|
* Dispatch a message under the `processing` lock: an awareness-marked broadcast is
|
|
34022
34420
|
* inject-only (see, no reply); everything else is a full wake+reply. Routing both
|
|
@@ -34028,10 +34426,14 @@ var init_auto_relay = __esm({
|
|
|
34028
34426
|
return;
|
|
34029
34427
|
}
|
|
34030
34428
|
const inflightPeer = this.localPeerId;
|
|
34429
|
+
const claimCwd = this.localCwd ?? process.cwd();
|
|
34031
34430
|
try {
|
|
34032
34431
|
await this._processMessage(msg);
|
|
34033
34432
|
} finally {
|
|
34034
|
-
if (inflightPeer)
|
|
34433
|
+
if (inflightPeer) {
|
|
34434
|
+
clearWakeInFlight(inflightPeer, msg.id);
|
|
34435
|
+
releaseWake(inflightPeer, msg.id, claimCwd);
|
|
34436
|
+
}
|
|
34035
34437
|
}
|
|
34036
34438
|
}
|
|
34037
34439
|
/**
|
|
@@ -34128,6 +34530,7 @@ var init_auto_relay = __esm({
|
|
|
34128
34530
|
let wakeExitCode = null;
|
|
34129
34531
|
let refused = false;
|
|
34130
34532
|
let threw = false;
|
|
34533
|
+
let wakeLease = null;
|
|
34131
34534
|
try {
|
|
34132
34535
|
const res = await this.refreshSessionId();
|
|
34133
34536
|
this._trace(traceId, "resolved", {
|
|
@@ -34166,6 +34569,7 @@ var init_auto_relay = __esm({
|
|
|
34166
34569
|
decision: res.decision,
|
|
34167
34570
|
confidence: res.confidence
|
|
34168
34571
|
});
|
|
34572
|
+
wakeLease = await acquireWakeLock(this.localCwd, this.localSessionId);
|
|
34169
34573
|
treeBefore = captureTreeState(this.localCwd);
|
|
34170
34574
|
const result = await execRemote(
|
|
34171
34575
|
getConfig().COGENT_PLATFORM,
|
|
@@ -34254,6 +34658,7 @@ var init_auto_relay = __esm({
|
|
|
34254
34658
|
});
|
|
34255
34659
|
}
|
|
34256
34660
|
} finally {
|
|
34661
|
+
wakeLease?.release();
|
|
34257
34662
|
this._recordWake(msg, traceId, {
|
|
34258
34663
|
outcome: threw ? "threw" : refused ? "refused" : replied ? "replied" : "failed",
|
|
34259
34664
|
exitCode: wakeExitCode,
|
|
@@ -34342,6 +34747,7 @@ var init_auto_relay = __esm({
|
|
|
34342
34747
|
} catch {
|
|
34343
34748
|
}
|
|
34344
34749
|
const formatted = formatInjectOnlyMessage(fromLabel, msg.fromPeerId, msg.message, msg.attachments);
|
|
34750
|
+
const lease = await acquireWakeLock(this.localCwd, this.localSessionId);
|
|
34345
34751
|
try {
|
|
34346
34752
|
await this.refreshSessionId();
|
|
34347
34753
|
const result = await execRemote(
|
|
@@ -34357,6 +34763,8 @@ var init_auto_relay = __esm({
|
|
|
34357
34763
|
}
|
|
34358
34764
|
} catch (err) {
|
|
34359
34765
|
logger.error(`Auto-relay: inject-only execRemote threw: ${err}`);
|
|
34766
|
+
} finally {
|
|
34767
|
+
lease.release();
|
|
34360
34768
|
}
|
|
34361
34769
|
}
|
|
34362
34770
|
/**
|
|
@@ -34377,6 +34785,7 @@ var init_auto_relay = __esm({
|
|
|
34377
34785
|
} catch {
|
|
34378
34786
|
}
|
|
34379
34787
|
const formatted = formatPeerBroadcastNotice(fromLabel, msg.fromPeerId, msg.message, msg.attachments);
|
|
34788
|
+
const lease = await acquireWakeLock(this.localCwd, this.localSessionId);
|
|
34380
34789
|
try {
|
|
34381
34790
|
await this.refreshSessionId();
|
|
34382
34791
|
const result = await execRemote(
|
|
@@ -34392,6 +34801,8 @@ var init_auto_relay = __esm({
|
|
|
34392
34801
|
}
|
|
34393
34802
|
} catch (err) {
|
|
34394
34803
|
logger.error(`Auto-relay: peer-broadcast awareness inject execRemote threw: ${err}`);
|
|
34804
|
+
} finally {
|
|
34805
|
+
lease.release();
|
|
34395
34806
|
}
|
|
34396
34807
|
}
|
|
34397
34808
|
/**
|
|
@@ -34432,8 +34843,10 @@ var init_auto_relay = __esm({
|
|
|
34432
34843
|
}
|
|
34433
34844
|
this.deliveryAckWaiters.clear();
|
|
34434
34845
|
this.recentAcks.clear();
|
|
34846
|
+
if (this.localCwd && this.localPeerId) withdrawBridge(this.localCwd, this.localPeerId);
|
|
34435
34847
|
this.queue = [];
|
|
34436
34848
|
this.awarenessOnly.clear();
|
|
34849
|
+
this.supersededNotified.clear();
|
|
34437
34850
|
this.localPeerId = null;
|
|
34438
34851
|
this.localSessionId = null;
|
|
34439
34852
|
this.localCwd = null;
|
|
@@ -34687,9 +35100,9 @@ __export(startup_exports, {
|
|
|
34687
35100
|
setInboxNotifier: () => setInboxNotifier,
|
|
34688
35101
|
triggerReRegistration: () => triggerReRegistration
|
|
34689
35102
|
});
|
|
34690
|
-
import
|
|
34691
|
-
import
|
|
34692
|
-
import
|
|
35103
|
+
import os14 from "node:os";
|
|
35104
|
+
import path19 from "node:path";
|
|
35105
|
+
import fs18 from "node:fs/promises";
|
|
34693
35106
|
import readline2 from "node:readline";
|
|
34694
35107
|
import { execFile as execFile5 } from "node:child_process";
|
|
34695
35108
|
import { promisify as promisify4 } from "node:util";
|
|
@@ -34707,7 +35120,7 @@ function bindInboxNotifier() {
|
|
|
34707
35120
|
}
|
|
34708
35121
|
async function loadPersistedConfig() {
|
|
34709
35122
|
try {
|
|
34710
|
-
const raw = await
|
|
35123
|
+
const raw = await fs18.readFile(PERSIST_PATH, "utf-8");
|
|
34711
35124
|
return JSON.parse(raw);
|
|
34712
35125
|
} catch {
|
|
34713
35126
|
return {};
|
|
@@ -34715,7 +35128,7 @@ async function loadPersistedConfig() {
|
|
|
34715
35128
|
}
|
|
34716
35129
|
async function savePersistedConfig(config2) {
|
|
34717
35130
|
try {
|
|
34718
|
-
await
|
|
35131
|
+
await fs18.writeFile(PERSIST_PATH, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
34719
35132
|
} catch (err) {
|
|
34720
35133
|
const msg = err instanceof Error ? err.message : String(err);
|
|
34721
35134
|
logger.warn(`Could not save config to ${PERSIST_PATH}: ${msg}`);
|
|
@@ -34750,11 +35163,11 @@ First run detected. Where should cogent-bridge store its data?
|
|
|
34750
35163
|
});
|
|
34751
35164
|
}
|
|
34752
35165
|
async function validateStateDir(statePath) {
|
|
34753
|
-
await
|
|
34754
|
-
const testFile =
|
|
35166
|
+
await fs18.mkdir(statePath, { recursive: true });
|
|
35167
|
+
const testFile = path19.join(statePath, ".write-test");
|
|
34755
35168
|
try {
|
|
34756
|
-
await
|
|
34757
|
-
await
|
|
35169
|
+
await fs18.writeFile(testFile, "test", "utf-8");
|
|
35170
|
+
await fs18.unlink(testFile);
|
|
34758
35171
|
} catch {
|
|
34759
35172
|
throw new BridgeError(
|
|
34760
35173
|
"STARTUP_FAILED" /* STARTUP_FAILED */,
|
|
@@ -34942,10 +35355,10 @@ async function runStartup() {
|
|
|
34942
35355
|
if (envStatePath) {
|
|
34943
35356
|
statePath = envStatePath;
|
|
34944
35357
|
} else {
|
|
34945
|
-
const defaultPath =
|
|
35358
|
+
const defaultPath = path19.join(os14.homedir(), ".cogent");
|
|
34946
35359
|
statePath = await firstRunPrompt(defaultPath);
|
|
34947
35360
|
}
|
|
34948
|
-
if (!envStatePath && statePath !==
|
|
35361
|
+
if (!envStatePath && statePath !== path19.join(os14.homedir(), ".cogent")) {
|
|
34949
35362
|
process.env.COGENT_STATE_PATH = statePath;
|
|
34950
35363
|
} else if (!envStatePath) {
|
|
34951
35364
|
process.env.COGENT_STATE_PATH = statePath;
|
|
@@ -35009,7 +35422,7 @@ async function runStartup() {
|
|
|
35009
35422
|
}
|
|
35010
35423
|
initLogger(
|
|
35011
35424
|
config2.COGENT_LOG_LEVEL,
|
|
35012
|
-
|
|
35425
|
+
path19.join(config2.COGENT_STATE_PATH, "logs")
|
|
35013
35426
|
);
|
|
35014
35427
|
if (isCloud && effectiveSessionId && effectiveToken) {
|
|
35015
35428
|
cloudInbox = new MessageInbox();
|
|
@@ -35071,7 +35484,7 @@ var init_startup = __esm({
|
|
|
35071
35484
|
init_auto_relay();
|
|
35072
35485
|
UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
35073
35486
|
execFileAsync3 = promisify4(execFile5);
|
|
35074
|
-
PERSIST_PATH =
|
|
35487
|
+
PERSIST_PATH = path19.join(os14.homedir(), ".cogent-config.json");
|
|
35075
35488
|
legacyWarnEmitted = false;
|
|
35076
35489
|
cloudWsClient = null;
|
|
35077
35490
|
cloudInbox = null;
|
|
@@ -35085,13 +35498,13 @@ var init_startup = __esm({
|
|
|
35085
35498
|
});
|
|
35086
35499
|
|
|
35087
35500
|
// src/cloud/mail-credential-store.ts
|
|
35088
|
-
import
|
|
35089
|
-
import
|
|
35090
|
-
import
|
|
35091
|
-
import
|
|
35501
|
+
import crypto9 from "node:crypto";
|
|
35502
|
+
import fs19 from "node:fs/promises";
|
|
35503
|
+
import path20 from "node:path";
|
|
35504
|
+
import os15 from "node:os";
|
|
35092
35505
|
function defaultMailCredentialPath(cwd = process.cwd()) {
|
|
35093
|
-
const hash =
|
|
35094
|
-
return
|
|
35506
|
+
const hash = crypto9.createHash("sha256").update(path20.resolve(cwd)).digest("hex").slice(0, 16);
|
|
35507
|
+
return path20.join(os15.homedir(), ".cogent", "mail-credentials", `${hash}.json`);
|
|
35095
35508
|
}
|
|
35096
35509
|
function resolveMailCredentialPath(credentialPath) {
|
|
35097
35510
|
if (credentialPath) return credentialPath;
|
|
@@ -35102,16 +35515,16 @@ function resolveMailCredentialPath(credentialPath) {
|
|
|
35102
35515
|
async function loadMailCredentials(credentialPath) {
|
|
35103
35516
|
const filePath = resolveMailCredentialPath(credentialPath);
|
|
35104
35517
|
try {
|
|
35105
|
-
return JSON.parse(await
|
|
35518
|
+
return JSON.parse(await fs19.readFile(filePath, "utf-8"));
|
|
35106
35519
|
} catch {
|
|
35107
35520
|
return null;
|
|
35108
35521
|
}
|
|
35109
35522
|
}
|
|
35110
35523
|
async function saveMailCredentials(creds, credentialPath) {
|
|
35111
35524
|
const filePath = resolveMailCredentialPath(credentialPath);
|
|
35112
|
-
await
|
|
35113
|
-
await
|
|
35114
|
-
await
|
|
35525
|
+
await fs19.mkdir(path20.dirname(filePath), { recursive: true, mode: 448 });
|
|
35526
|
+
await fs19.writeFile(filePath, JSON.stringify(creds, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
35527
|
+
await fs19.chmod(filePath, 384);
|
|
35115
35528
|
}
|
|
35116
35529
|
async function persistProvisionedMailbox(mailbox, credentialPath) {
|
|
35117
35530
|
if (!mailbox?.address || !mailbox.password) return false;
|
|
@@ -35132,7 +35545,7 @@ async function persistProvisionedMailbox(mailbox, credentialPath) {
|
|
|
35132
35545
|
async function clearMailCredentials(credentialPath) {
|
|
35133
35546
|
const filePath = resolveMailCredentialPath(credentialPath);
|
|
35134
35547
|
try {
|
|
35135
|
-
await
|
|
35548
|
+
await fs19.unlink(filePath);
|
|
35136
35549
|
} catch (err) {
|
|
35137
35550
|
if (err.code !== "ENOENT") throw err;
|
|
35138
35551
|
}
|
|
@@ -35147,7 +35560,7 @@ var init_mail_credential_store = __esm({
|
|
|
35147
35560
|
});
|
|
35148
35561
|
|
|
35149
35562
|
// src/tools/register-peer.ts
|
|
35150
|
-
import
|
|
35563
|
+
import crypto10 from "node:crypto";
|
|
35151
35564
|
function unresolvedSessionReason(r) {
|
|
35152
35565
|
if (r.sessionId) return null;
|
|
35153
35566
|
return r.candidateCount === 0 ? "no-candidates" : "ambiguous";
|
|
@@ -35213,7 +35626,7 @@ function registerRegisterPeerTool(server) {
|
|
|
35213
35626
|
}
|
|
35214
35627
|
}
|
|
35215
35628
|
if (!cloudSessionId) {
|
|
35216
|
-
autoSecret =
|
|
35629
|
+
autoSecret = crypto10.randomBytes(16).toString("hex");
|
|
35217
35630
|
const resp = await fetch(
|
|
35218
35631
|
`${endpoint}/api/sessions`,
|
|
35219
35632
|
{
|
|
@@ -36595,7 +37008,7 @@ var init_wake_log2 = __esm({
|
|
|
36595
37008
|
});
|
|
36596
37009
|
|
|
36597
37010
|
// src/tools/create-session.ts
|
|
36598
|
-
import
|
|
37011
|
+
import crypto11 from "node:crypto";
|
|
36599
37012
|
function registerCreateSessionTool(server) {
|
|
36600
37013
|
server.registerTool(
|
|
36601
37014
|
"cogent_create_session",
|
|
@@ -36626,7 +37039,7 @@ function registerCreateSessionTool(server) {
|
|
|
36626
37039
|
)
|
|
36627
37040
|
);
|
|
36628
37041
|
}
|
|
36629
|
-
const sessionSecret = secret ??
|
|
37042
|
+
const sessionSecret = secret ?? crypto11.randomBytes(16).toString("hex");
|
|
36630
37043
|
const resp = await fetch(
|
|
36631
37044
|
`${config2.COGENT_ENDPOINT}/api/sessions`,
|
|
36632
37045
|
{
|
|
@@ -37084,8 +37497,8 @@ var require_cookies = __commonJS({
|
|
|
37084
37497
|
if (urlparts.hostname !== cookie.domain && (cookie.domain.charAt(0) !== "." || ("." + urlparts.hostname).substr(-cookie.domain.length) !== cookie.domain)) {
|
|
37085
37498
|
return false;
|
|
37086
37499
|
}
|
|
37087
|
-
let
|
|
37088
|
-
if (
|
|
37500
|
+
let path24 = this.getPath(urlparts.pathname);
|
|
37501
|
+
if (path24.substr(0, cookie.path.length) !== cookie.path) {
|
|
37089
37502
|
return false;
|
|
37090
37503
|
}
|
|
37091
37504
|
if (cookie.secure && urlparts.protocol !== "https:") {
|
|
@@ -37145,16 +37558,16 @@ var require_cookies = __commonJS({
|
|
|
37145
37558
|
* @returns {String} Normalized path
|
|
37146
37559
|
*/
|
|
37147
37560
|
getPath(pathname) {
|
|
37148
|
-
let
|
|
37149
|
-
|
|
37150
|
-
|
|
37151
|
-
if (
|
|
37152
|
-
|
|
37561
|
+
let path24 = (pathname || "/").split("/");
|
|
37562
|
+
path24.pop();
|
|
37563
|
+
path24 = path24.join("/").trim();
|
|
37564
|
+
if (path24.charAt(0) !== "/") {
|
|
37565
|
+
path24 = "/" + path24;
|
|
37153
37566
|
}
|
|
37154
|
-
if (
|
|
37155
|
-
|
|
37567
|
+
if (path24.substr(-1) !== "/") {
|
|
37568
|
+
path24 += "/";
|
|
37156
37569
|
}
|
|
37157
|
-
return
|
|
37570
|
+
return path24;
|
|
37158
37571
|
}
|
|
37159
37572
|
};
|
|
37160
37573
|
module.exports = Cookies;
|
|
@@ -37455,15 +37868,15 @@ var require_shared = __commonJS({
|
|
|
37455
37868
|
"use strict";
|
|
37456
37869
|
var urllib = __require("url");
|
|
37457
37870
|
var util2 = __require("util");
|
|
37458
|
-
var
|
|
37871
|
+
var fs22 = __require("fs");
|
|
37459
37872
|
var nmfetch = require_fetch();
|
|
37460
37873
|
var dns = __require("dns");
|
|
37461
37874
|
var net = __require("net");
|
|
37462
|
-
var
|
|
37875
|
+
var os17 = __require("os");
|
|
37463
37876
|
var DNS_TTL = 5 * 60 * 1e3;
|
|
37464
37877
|
var networkInterfaces;
|
|
37465
37878
|
try {
|
|
37466
|
-
networkInterfaces =
|
|
37879
|
+
networkInterfaces = os17.networkInterfaces();
|
|
37467
37880
|
} catch (err) {
|
|
37468
37881
|
}
|
|
37469
37882
|
module.exports.networkInterfaces = networkInterfaces;
|
|
@@ -37841,7 +38254,7 @@ var require_shared = __commonJS({
|
|
|
37841
38254
|
}
|
|
37842
38255
|
return callback(null, parsedDataUri.data);
|
|
37843
38256
|
} else if (content.path) {
|
|
37844
|
-
return resolveStream(
|
|
38257
|
+
return resolveStream(fs22.createReadStream(content.path), callback);
|
|
37845
38258
|
}
|
|
37846
38259
|
}
|
|
37847
38260
|
if (typeof data[key].content === "string" && !["utf8", "usascii", "ascii"].includes(encoding)) {
|
|
@@ -37965,7 +38378,7 @@ var require_shared = __commonJS({
|
|
|
37965
38378
|
var require_mime_types = __commonJS({
|
|
37966
38379
|
"node_modules/nodemailer/lib/mime-funcs/mime-types.js"(exports, module) {
|
|
37967
38380
|
"use strict";
|
|
37968
|
-
var
|
|
38381
|
+
var path24 = __require("path");
|
|
37969
38382
|
var defaultMimeType = "application/octet-stream";
|
|
37970
38383
|
var defaultExtension = "bin";
|
|
37971
38384
|
var mimeTypes = /* @__PURE__ */ new Map([
|
|
@@ -40023,7 +40436,7 @@ var require_mime_types = __commonJS({
|
|
|
40023
40436
|
if (!filename) {
|
|
40024
40437
|
return defaultMimeType;
|
|
40025
40438
|
}
|
|
40026
|
-
let parsed =
|
|
40439
|
+
let parsed = path24.parse(filename);
|
|
40027
40440
|
let extension = (parsed.ext.substr(1) || parsed.name || "").split("?").shift().trim().toLowerCase();
|
|
40028
40441
|
let value = defaultMimeType;
|
|
40029
40442
|
if (extensions.has(extension)) {
|
|
@@ -41424,8 +41837,8 @@ var require_le_unix = __commonJS({
|
|
|
41424
41837
|
var require_mime_node = __commonJS({
|
|
41425
41838
|
"node_modules/nodemailer/lib/mime-node/index.js"(exports, module) {
|
|
41426
41839
|
"use strict";
|
|
41427
|
-
var
|
|
41428
|
-
var
|
|
41840
|
+
var crypto12 = __require("crypto");
|
|
41841
|
+
var fs22 = __require("fs");
|
|
41429
41842
|
var punycode = require_punycode();
|
|
41430
41843
|
var PassThrough = __require("stream").PassThrough;
|
|
41431
41844
|
var shared = require_shared();
|
|
@@ -41441,7 +41854,7 @@ var require_mime_node = __commonJS({
|
|
|
41441
41854
|
constructor(contentType, options) {
|
|
41442
41855
|
this.nodeCounter = 0;
|
|
41443
41856
|
options = options || {};
|
|
41444
|
-
this.baseBoundary = options.baseBoundary ||
|
|
41857
|
+
this.baseBoundary = options.baseBoundary || crypto12.randomBytes(8).toString("hex");
|
|
41445
41858
|
this.boundaryPrefix = options.boundaryPrefix || "--_NmP";
|
|
41446
41859
|
this.disableFileAccess = !!options.disableFileAccess;
|
|
41447
41860
|
this.disableUrlAccess = !!options.disableUrlAccess;
|
|
@@ -42140,7 +42553,7 @@ var require_mime_node = __commonJS({
|
|
|
42140
42553
|
setImmediate(() => contentStream.emit("error", new Error("File access rejected for " + content.path)));
|
|
42141
42554
|
return contentStream;
|
|
42142
42555
|
}
|
|
42143
|
-
return
|
|
42556
|
+
return fs22.createReadStream(content.path);
|
|
42144
42557
|
} else if (content && typeof content.href === "string") {
|
|
42145
42558
|
if (this.disableUrlAccess) {
|
|
42146
42559
|
contentStream = new PassThrough();
|
|
@@ -42384,8 +42797,8 @@ var require_mime_node = __commonJS({
|
|
|
42384
42797
|
_generateMessageId() {
|
|
42385
42798
|
return "<" + [2, 2, 2, 6].reduce(
|
|
42386
42799
|
// crux to generate UUID-like random strings
|
|
42387
|
-
(prev, len) => prev + "-" +
|
|
42388
|
-
|
|
42800
|
+
(prev, len) => prev + "-" + crypto12.randomBytes(len).toString("hex"),
|
|
42801
|
+
crypto12.randomBytes(4).toString("hex")
|
|
42389
42802
|
) + "@" + // try to use the domain of the FROM address or fallback to server hostname
|
|
42390
42803
|
(this.getEnvelope().from || this.hostname || "localhost").split("@").pop() + ">";
|
|
42391
42804
|
}
|
|
@@ -42976,14 +43389,14 @@ var require_relaxed_body = __commonJS({
|
|
|
42976
43389
|
"node_modules/nodemailer/lib/dkim/relaxed-body.js"(exports, module) {
|
|
42977
43390
|
"use strict";
|
|
42978
43391
|
var Transform = __require("stream").Transform;
|
|
42979
|
-
var
|
|
43392
|
+
var crypto12 = __require("crypto");
|
|
42980
43393
|
var RelaxedBody = class extends Transform {
|
|
42981
43394
|
constructor(options) {
|
|
42982
43395
|
super();
|
|
42983
43396
|
options = options || {};
|
|
42984
43397
|
this.chunkBuffer = [];
|
|
42985
43398
|
this.chunkBufferLen = 0;
|
|
42986
|
-
this.bodyHash =
|
|
43399
|
+
this.bodyHash = crypto12.createHash(options.hashAlgo || "sha1");
|
|
42987
43400
|
this.remainder = "";
|
|
42988
43401
|
this.byteLength = 0;
|
|
42989
43402
|
this.debug = options.debug;
|
|
@@ -43086,7 +43499,7 @@ var require_sign = __commonJS({
|
|
|
43086
43499
|
"use strict";
|
|
43087
43500
|
var punycode = require_punycode();
|
|
43088
43501
|
var mimeFuncs = require_mime_funcs();
|
|
43089
|
-
var
|
|
43502
|
+
var crypto12 = __require("crypto");
|
|
43090
43503
|
module.exports = (headers, hashAlgo, bodyHash, options) => {
|
|
43091
43504
|
options = options || {};
|
|
43092
43505
|
let defaultFieldNames = "From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive";
|
|
@@ -43095,7 +43508,7 @@ var require_sign = __commonJS({
|
|
|
43095
43508
|
let dkimHeader = generateDKIMHeader(options.domainName, options.keySelector, canonicalizedHeaderData.fieldNames, hashAlgo, bodyHash);
|
|
43096
43509
|
let signer, signature;
|
|
43097
43510
|
canonicalizedHeaderData.headers += "dkim-signature:" + relaxedHeaderLine(dkimHeader);
|
|
43098
|
-
signer =
|
|
43511
|
+
signer = crypto12.createSign(("rsa-" + hashAlgo).toUpperCase());
|
|
43099
43512
|
signer.update(canonicalizedHeaderData.headers);
|
|
43100
43513
|
try {
|
|
43101
43514
|
signature = signer.sign(options.privateKey, "base64");
|
|
@@ -43161,9 +43574,9 @@ var require_dkim = __commonJS({
|
|
|
43161
43574
|
var RelaxedBody = require_relaxed_body();
|
|
43162
43575
|
var sign = require_sign();
|
|
43163
43576
|
var PassThrough = __require("stream").PassThrough;
|
|
43164
|
-
var
|
|
43165
|
-
var
|
|
43166
|
-
var
|
|
43577
|
+
var fs22 = __require("fs");
|
|
43578
|
+
var path24 = __require("path");
|
|
43579
|
+
var crypto12 = __require("crypto");
|
|
43167
43580
|
var DKIM_ALGO = "sha256";
|
|
43168
43581
|
var MAX_MESSAGE_SIZE = 128 * 1024;
|
|
43169
43582
|
var DKIMSigner = class {
|
|
@@ -43176,7 +43589,7 @@ var require_dkim = __commonJS({
|
|
|
43176
43589
|
this.chunks = [];
|
|
43177
43590
|
this.chunklen = 0;
|
|
43178
43591
|
this.readPos = 0;
|
|
43179
|
-
this.cachePath = this.cacheDir ?
|
|
43592
|
+
this.cachePath = this.cacheDir ? path24.join(this.cacheDir, "message." + Date.now() + "-" + crypto12.randomBytes(14).toString("hex")) : false;
|
|
43180
43593
|
this.cache = false;
|
|
43181
43594
|
this.headers = false;
|
|
43182
43595
|
this.bodyHash = false;
|
|
@@ -43196,10 +43609,10 @@ var require_dkim = __commonJS({
|
|
|
43196
43609
|
if (!this.cache || !this.cachePath) {
|
|
43197
43610
|
return;
|
|
43198
43611
|
}
|
|
43199
|
-
|
|
43612
|
+
fs22.unlink(this.cachePath, () => false);
|
|
43200
43613
|
}
|
|
43201
43614
|
createReadCache() {
|
|
43202
|
-
this.cache =
|
|
43615
|
+
this.cache = fs22.createReadStream(this.cachePath);
|
|
43203
43616
|
this.cache.once("error", (err) => {
|
|
43204
43617
|
this.cleanup();
|
|
43205
43618
|
this.output.emit("error", err);
|
|
@@ -43255,7 +43668,7 @@ var require_dkim = __commonJS({
|
|
|
43255
43668
|
}
|
|
43256
43669
|
createWriteCache() {
|
|
43257
43670
|
this.output.usingCache = true;
|
|
43258
|
-
this.cache =
|
|
43671
|
+
this.cache = fs22.createWriteStream(this.cachePath);
|
|
43259
43672
|
this.cache.once("error", (err) => {
|
|
43260
43673
|
this.cleanup();
|
|
43261
43674
|
this.relaxedBody.unpipe(this.cache);
|
|
@@ -43732,7 +44145,7 @@ var require_mailer = __commonJS({
|
|
|
43732
44145
|
var MailMessage = require_mail_message();
|
|
43733
44146
|
var net = __require("net");
|
|
43734
44147
|
var dns = __require("dns");
|
|
43735
|
-
var
|
|
44148
|
+
var crypto12 = __require("crypto");
|
|
43736
44149
|
var Mail = class extends EventEmitter {
|
|
43737
44150
|
constructor(transporter, options, defaults) {
|
|
43738
44151
|
super();
|
|
@@ -44056,7 +44469,7 @@ var require_mailer = __commonJS({
|
|
|
44056
44469
|
}
|
|
44057
44470
|
let cidCounter = 0;
|
|
44058
44471
|
html = (html || "").toString().replace(/(<img\b[^<>]{0,1024} src\s{0,20}=[\s"']{0,20})(data:([^;]+);[^"'>\s]+)/gi, (match, prefix, dataUri, mimeType) => {
|
|
44059
|
-
let cid =
|
|
44472
|
+
let cid = crypto12.randomBytes(10).toString("hex") + "@localhost";
|
|
44060
44473
|
if (!mail.data.attachments) {
|
|
44061
44474
|
mail.data.attachments = [];
|
|
44062
44475
|
}
|
|
@@ -44182,8 +44595,8 @@ var require_smtp_connection = __commonJS({
|
|
|
44182
44595
|
var EventEmitter = __require("events").EventEmitter;
|
|
44183
44596
|
var net = __require("net");
|
|
44184
44597
|
var tls = __require("tls");
|
|
44185
|
-
var
|
|
44186
|
-
var
|
|
44598
|
+
var os17 = __require("os");
|
|
44599
|
+
var crypto12 = __require("crypto");
|
|
44187
44600
|
var DataStream = require_data_stream();
|
|
44188
44601
|
var PassThrough = __require("stream").PassThrough;
|
|
44189
44602
|
var shared = require_shared();
|
|
@@ -44194,7 +44607,7 @@ var require_smtp_connection = __commonJS({
|
|
|
44194
44607
|
var SMTPConnection = class extends EventEmitter {
|
|
44195
44608
|
constructor(options) {
|
|
44196
44609
|
super(options);
|
|
44197
|
-
this.id =
|
|
44610
|
+
this.id = crypto12.randomBytes(8).toString("base64").replace(/\W/g, "");
|
|
44198
44611
|
this.stage = "init";
|
|
44199
44612
|
this.options = options || {};
|
|
44200
44613
|
this.secureConnection = !!this.options.secure;
|
|
@@ -45287,7 +45700,7 @@ var require_smtp_connection = __commonJS({
|
|
|
45287
45700
|
} else {
|
|
45288
45701
|
challengeString = challengeMatch[1];
|
|
45289
45702
|
}
|
|
45290
|
-
let base64decoded = Buffer.from(challengeString, "base64").toString("ascii"), hmacMD5 =
|
|
45703
|
+
let base64decoded = Buffer.from(challengeString, "base64").toString("ascii"), hmacMD5 = crypto12.createHmac("md5", this._auth.credentials.pass);
|
|
45291
45704
|
hmacMD5.update(base64decoded);
|
|
45292
45705
|
let prepended = this._auth.credentials.user + " " + hmacMD5.digest("hex");
|
|
45293
45706
|
this._responseActions.push((str2) => {
|
|
@@ -45575,7 +45988,7 @@ var require_smtp_connection = __commonJS({
|
|
|
45575
45988
|
_getHostname() {
|
|
45576
45989
|
let defaultHostname;
|
|
45577
45990
|
try {
|
|
45578
|
-
defaultHostname =
|
|
45991
|
+
defaultHostname = os17.hostname() || "";
|
|
45579
45992
|
} catch (err) {
|
|
45580
45993
|
defaultHostname = "localhost";
|
|
45581
45994
|
}
|
|
@@ -45598,7 +46011,7 @@ var require_xoauth2 = __commonJS({
|
|
|
45598
46011
|
"use strict";
|
|
45599
46012
|
var Stream = __require("stream").Stream;
|
|
45600
46013
|
var nmfetch = require_fetch();
|
|
45601
|
-
var
|
|
46014
|
+
var crypto12 = __require("crypto");
|
|
45602
46015
|
var shared = require_shared();
|
|
45603
46016
|
var XOAuth2 = class extends Stream {
|
|
45604
46017
|
constructor(options, logger2) {
|
|
@@ -45889,7 +46302,7 @@ var require_xoauth2 = __commonJS({
|
|
|
45889
46302
|
*/
|
|
45890
46303
|
jwtSignRS256(payload) {
|
|
45891
46304
|
payload = ['{"alg":"RS256","typ":"JWT"}', JSON.stringify(payload)].map((val) => this.toBase64URL(val)).join(".");
|
|
45892
|
-
let signature =
|
|
46305
|
+
let signature = crypto12.createSign("RSA-SHA256").update(payload).sign(this.options.privateKey);
|
|
45893
46306
|
return payload + "." + this.toBase64URL(signature);
|
|
45894
46307
|
}
|
|
45895
46308
|
};
|
|
@@ -48144,13 +48557,13 @@ var require_nodemailer = __commonJS({
|
|
|
48144
48557
|
});
|
|
48145
48558
|
|
|
48146
48559
|
// src/mail/mail-sender.ts
|
|
48147
|
-
import
|
|
48148
|
-
import
|
|
48560
|
+
import fs20 from "node:fs/promises";
|
|
48561
|
+
import path21 from "node:path";
|
|
48149
48562
|
async function buildAndSendMail(sender, creds, params) {
|
|
48150
48563
|
const attachments = [];
|
|
48151
48564
|
for (const p of params.attachmentPaths ?? []) {
|
|
48152
|
-
const content = await
|
|
48153
|
-
attachments.push({ filename:
|
|
48565
|
+
const content = await fs20.readFile(p);
|
|
48566
|
+
attachments.push({ filename: path21.basename(p), content });
|
|
48154
48567
|
}
|
|
48155
48568
|
const { messageId } = await sender.send({
|
|
48156
48569
|
from: creds.address,
|
|
@@ -48539,8 +48952,8 @@ var require_req = __commonJS({
|
|
|
48539
48952
|
if (req.originalUrl) {
|
|
48540
48953
|
_req.url = req.originalUrl;
|
|
48541
48954
|
} else {
|
|
48542
|
-
const
|
|
48543
|
-
_req.url = typeof
|
|
48955
|
+
const path24 = req.path;
|
|
48956
|
+
_req.url = typeof path24 === "string" ? path24 : req.url ? req.url.path || req.url : void 0;
|
|
48544
48957
|
}
|
|
48545
48958
|
if (req.query) {
|
|
48546
48959
|
_req.query = req.query;
|
|
@@ -48705,14 +49118,14 @@ var require_redact = __commonJS({
|
|
|
48705
49118
|
}
|
|
48706
49119
|
return obj;
|
|
48707
49120
|
}
|
|
48708
|
-
function parsePath(
|
|
49121
|
+
function parsePath(path24) {
|
|
48709
49122
|
const parts = [];
|
|
48710
49123
|
let current = "";
|
|
48711
49124
|
let inBrackets = false;
|
|
48712
49125
|
let inQuotes = false;
|
|
48713
49126
|
let quoteChar = "";
|
|
48714
|
-
for (let i = 0; i <
|
|
48715
|
-
const char =
|
|
49127
|
+
for (let i = 0; i < path24.length; i++) {
|
|
49128
|
+
const char = path24[i];
|
|
48716
49129
|
if (!inBrackets && char === ".") {
|
|
48717
49130
|
if (current) {
|
|
48718
49131
|
parts.push(current);
|
|
@@ -48843,10 +49256,10 @@ var require_redact = __commonJS({
|
|
|
48843
49256
|
return current;
|
|
48844
49257
|
}
|
|
48845
49258
|
function redactPaths(obj, paths, censor, remove = false) {
|
|
48846
|
-
for (const
|
|
48847
|
-
const parts = parsePath(
|
|
49259
|
+
for (const path24 of paths) {
|
|
49260
|
+
const parts = parsePath(path24);
|
|
48848
49261
|
if (parts.includes("*")) {
|
|
48849
|
-
redactWildcardPath(obj, parts, censor,
|
|
49262
|
+
redactWildcardPath(obj, parts, censor, path24, remove);
|
|
48850
49263
|
} else {
|
|
48851
49264
|
if (remove) {
|
|
48852
49265
|
removeKey(obj, parts);
|
|
@@ -48931,8 +49344,8 @@ var require_redact = __commonJS({
|
|
|
48931
49344
|
}
|
|
48932
49345
|
} else {
|
|
48933
49346
|
if (afterWildcard.includes("*")) {
|
|
48934
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
48935
|
-
const fullPath = [...pathArray.slice(0, pathLength), ...
|
|
49347
|
+
const wrappedCensor = typeof censor === "function" ? (value, path24) => {
|
|
49348
|
+
const fullPath = [...pathArray.slice(0, pathLength), ...path24];
|
|
48936
49349
|
return censor(value, fullPath);
|
|
48937
49350
|
} : censor;
|
|
48938
49351
|
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
@@ -48967,8 +49380,8 @@ var require_redact = __commonJS({
|
|
|
48967
49380
|
return null;
|
|
48968
49381
|
}
|
|
48969
49382
|
const pathStructure = /* @__PURE__ */ new Map();
|
|
48970
|
-
for (const
|
|
48971
|
-
const parts = parsePath(
|
|
49383
|
+
for (const path24 of pathsToClone) {
|
|
49384
|
+
const parts = parsePath(path24);
|
|
48972
49385
|
let current = pathStructure;
|
|
48973
49386
|
for (let i = 0; i < parts.length; i++) {
|
|
48974
49387
|
const part = parts[i];
|
|
@@ -49020,24 +49433,24 @@ var require_redact = __commonJS({
|
|
|
49020
49433
|
}
|
|
49021
49434
|
return cloneSelectively(obj, pathStructure);
|
|
49022
49435
|
}
|
|
49023
|
-
function validatePath(
|
|
49024
|
-
if (typeof
|
|
49436
|
+
function validatePath(path24) {
|
|
49437
|
+
if (typeof path24 !== "string") {
|
|
49025
49438
|
throw new Error("Paths must be (non-empty) strings");
|
|
49026
49439
|
}
|
|
49027
|
-
if (
|
|
49440
|
+
if (path24 === "") {
|
|
49028
49441
|
throw new Error("Invalid redaction path ()");
|
|
49029
49442
|
}
|
|
49030
|
-
if (
|
|
49031
|
-
throw new Error(`Invalid redaction path (${
|
|
49443
|
+
if (path24.includes("..")) {
|
|
49444
|
+
throw new Error(`Invalid redaction path (${path24})`);
|
|
49032
49445
|
}
|
|
49033
|
-
if (
|
|
49034
|
-
throw new Error(`Invalid redaction path (${
|
|
49446
|
+
if (path24.includes(",")) {
|
|
49447
|
+
throw new Error(`Invalid redaction path (${path24})`);
|
|
49035
49448
|
}
|
|
49036
49449
|
let bracketCount = 0;
|
|
49037
49450
|
let inQuotes = false;
|
|
49038
49451
|
let quoteChar = "";
|
|
49039
|
-
for (let i = 0; i <
|
|
49040
|
-
const char =
|
|
49452
|
+
for (let i = 0; i < path24.length; i++) {
|
|
49453
|
+
const char = path24[i];
|
|
49041
49454
|
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
49042
49455
|
if (!inQuotes) {
|
|
49043
49456
|
inQuotes = true;
|
|
@@ -49051,20 +49464,20 @@ var require_redact = __commonJS({
|
|
|
49051
49464
|
} else if (char === "]" && !inQuotes) {
|
|
49052
49465
|
bracketCount--;
|
|
49053
49466
|
if (bracketCount < 0) {
|
|
49054
|
-
throw new Error(`Invalid redaction path (${
|
|
49467
|
+
throw new Error(`Invalid redaction path (${path24})`);
|
|
49055
49468
|
}
|
|
49056
49469
|
}
|
|
49057
49470
|
}
|
|
49058
49471
|
if (bracketCount !== 0) {
|
|
49059
|
-
throw new Error(`Invalid redaction path (${
|
|
49472
|
+
throw new Error(`Invalid redaction path (${path24})`);
|
|
49060
49473
|
}
|
|
49061
49474
|
}
|
|
49062
49475
|
function validatePaths(paths) {
|
|
49063
49476
|
if (!Array.isArray(paths)) {
|
|
49064
49477
|
throw new TypeError("paths must be an array");
|
|
49065
49478
|
}
|
|
49066
|
-
for (const
|
|
49067
|
-
validatePath(
|
|
49479
|
+
for (const path24 of paths) {
|
|
49480
|
+
validatePath(path24);
|
|
49068
49481
|
}
|
|
49069
49482
|
}
|
|
49070
49483
|
function slowRedact(options = {}) {
|
|
@@ -49232,8 +49645,8 @@ var require_redaction = __commonJS({
|
|
|
49232
49645
|
if (shape[k] === null) {
|
|
49233
49646
|
o[k] = (value) => topCensor(value, [k]);
|
|
49234
49647
|
} else {
|
|
49235
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
49236
|
-
return censor(value, [k, ...
|
|
49648
|
+
const wrappedCensor = typeof censor === "function" ? (value, path24) => {
|
|
49649
|
+
return censor(value, [k, ...path24]);
|
|
49237
49650
|
} : censor;
|
|
49238
49651
|
o[k] = Redact({
|
|
49239
49652
|
paths: shape[k],
|
|
@@ -49417,7 +49830,7 @@ var require_atomic_sleep = __commonJS({
|
|
|
49417
49830
|
"node_modules/atomic-sleep/index.js"(exports, module) {
|
|
49418
49831
|
"use strict";
|
|
49419
49832
|
if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
|
|
49420
|
-
let
|
|
49833
|
+
let sleep4 = function(ms) {
|
|
49421
49834
|
const valid = ms > 0 && ms < Infinity;
|
|
49422
49835
|
if (valid === false) {
|
|
49423
49836
|
if (typeof ms !== "number" && typeof ms !== "bigint") {
|
|
@@ -49428,9 +49841,9 @@ var require_atomic_sleep = __commonJS({
|
|
|
49428
49841
|
Atomics.wait(nil, 0, 0, Number(ms));
|
|
49429
49842
|
};
|
|
49430
49843
|
const nil = new Int32Array(new SharedArrayBuffer(4));
|
|
49431
|
-
module.exports =
|
|
49844
|
+
module.exports = sleep4;
|
|
49432
49845
|
} else {
|
|
49433
|
-
let
|
|
49846
|
+
let sleep4 = function(ms) {
|
|
49434
49847
|
const valid = ms > 0 && ms < Infinity;
|
|
49435
49848
|
if (valid === false) {
|
|
49436
49849
|
if (typeof ms !== "number" && typeof ms !== "bigint") {
|
|
@@ -49442,7 +49855,7 @@ var require_atomic_sleep = __commonJS({
|
|
|
49442
49855
|
while (target > Date.now()) {
|
|
49443
49856
|
}
|
|
49444
49857
|
};
|
|
49445
|
-
module.exports =
|
|
49858
|
+
module.exports = sleep4;
|
|
49446
49859
|
}
|
|
49447
49860
|
}
|
|
49448
49861
|
});
|
|
@@ -49451,11 +49864,11 @@ var require_atomic_sleep = __commonJS({
|
|
|
49451
49864
|
var require_sonic_boom = __commonJS({
|
|
49452
49865
|
"node_modules/sonic-boom/index.js"(exports, module) {
|
|
49453
49866
|
"use strict";
|
|
49454
|
-
var
|
|
49867
|
+
var fs22 = __require("fs");
|
|
49455
49868
|
var EventEmitter = __require("events");
|
|
49456
49869
|
var inherits = __require("util").inherits;
|
|
49457
|
-
var
|
|
49458
|
-
var
|
|
49870
|
+
var path24 = __require("path");
|
|
49871
|
+
var sleep4 = require_atomic_sleep();
|
|
49459
49872
|
var assert2 = __require("assert");
|
|
49460
49873
|
var BUSY_WRITE_TIMEOUT = 100;
|
|
49461
49874
|
var kEmptyBuffer = Buffer.allocUnsafe(0);
|
|
@@ -49508,20 +49921,20 @@ var require_sonic_boom = __commonJS({
|
|
|
49508
49921
|
const mode = sonic.mode;
|
|
49509
49922
|
if (sonic.sync) {
|
|
49510
49923
|
try {
|
|
49511
|
-
if (sonic.mkdir)
|
|
49512
|
-
const fd =
|
|
49924
|
+
if (sonic.mkdir) fs22.mkdirSync(path24.dirname(file), { recursive: true });
|
|
49925
|
+
const fd = fs22.openSync(file, flags, mode);
|
|
49513
49926
|
fileOpened(null, fd);
|
|
49514
49927
|
} catch (err) {
|
|
49515
49928
|
fileOpened(err);
|
|
49516
49929
|
throw err;
|
|
49517
49930
|
}
|
|
49518
49931
|
} else if (sonic.mkdir) {
|
|
49519
|
-
|
|
49932
|
+
fs22.mkdir(path24.dirname(file), { recursive: true }, (err) => {
|
|
49520
49933
|
if (err) return fileOpened(err);
|
|
49521
|
-
|
|
49934
|
+
fs22.open(file, flags, mode, fileOpened);
|
|
49522
49935
|
});
|
|
49523
49936
|
} else {
|
|
49524
|
-
|
|
49937
|
+
fs22.open(file, flags, mode, fileOpened);
|
|
49525
49938
|
}
|
|
49526
49939
|
}
|
|
49527
49940
|
function SonicBoom(opts) {
|
|
@@ -49562,8 +49975,8 @@ var require_sonic_boom = __commonJS({
|
|
|
49562
49975
|
this.flush = flushBuffer;
|
|
49563
49976
|
this.flushSync = flushBufferSync;
|
|
49564
49977
|
this._actualWrite = actualWriteBuffer;
|
|
49565
|
-
fsWriteSync = () =>
|
|
49566
|
-
fsWrite = () =>
|
|
49978
|
+
fsWriteSync = () => fs22.writeSync(this.fd, this._writingBuf);
|
|
49979
|
+
fsWrite = () => fs22.write(this.fd, this._writingBuf, this.release);
|
|
49567
49980
|
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
49568
49981
|
this._writingBuf = "";
|
|
49569
49982
|
this.write = write;
|
|
@@ -49572,15 +49985,15 @@ var require_sonic_boom = __commonJS({
|
|
|
49572
49985
|
this._actualWrite = actualWrite;
|
|
49573
49986
|
fsWriteSync = () => {
|
|
49574
49987
|
if (Buffer.isBuffer(this._writingBuf)) {
|
|
49575
|
-
return
|
|
49988
|
+
return fs22.writeSync(this.fd, this._writingBuf);
|
|
49576
49989
|
}
|
|
49577
|
-
return
|
|
49990
|
+
return fs22.writeSync(this.fd, this._writingBuf, "utf8");
|
|
49578
49991
|
};
|
|
49579
49992
|
fsWrite = () => {
|
|
49580
49993
|
if (Buffer.isBuffer(this._writingBuf)) {
|
|
49581
|
-
return
|
|
49994
|
+
return fs22.write(this.fd, this._writingBuf, this.release);
|
|
49582
49995
|
}
|
|
49583
|
-
return
|
|
49996
|
+
return fs22.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
49584
49997
|
};
|
|
49585
49998
|
} else {
|
|
49586
49999
|
throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
@@ -49601,7 +50014,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49601
50014
|
if ((err.code === "EAGAIN" || err.code === "EBUSY") && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
|
|
49602
50015
|
if (this.sync) {
|
|
49603
50016
|
try {
|
|
49604
|
-
|
|
50017
|
+
sleep4(BUSY_WRITE_TIMEOUT);
|
|
49605
50018
|
this.release(void 0, 0);
|
|
49606
50019
|
} catch (err2) {
|
|
49607
50020
|
this.release(err2);
|
|
@@ -49637,7 +50050,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49637
50050
|
}
|
|
49638
50051
|
}
|
|
49639
50052
|
if (this._fsync) {
|
|
49640
|
-
|
|
50053
|
+
fs22.fsyncSync(this.fd);
|
|
49641
50054
|
}
|
|
49642
50055
|
const len = this._len;
|
|
49643
50056
|
if (this._reopening) {
|
|
@@ -49751,7 +50164,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49751
50164
|
const onDrain = () => {
|
|
49752
50165
|
if (!this._fsync) {
|
|
49753
50166
|
try {
|
|
49754
|
-
|
|
50167
|
+
fs22.fsync(this.fd, (err) => {
|
|
49755
50168
|
this._flushPending = false;
|
|
49756
50169
|
cb(err);
|
|
49757
50170
|
});
|
|
@@ -49853,7 +50266,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49853
50266
|
const fd = this.fd;
|
|
49854
50267
|
this.once("ready", () => {
|
|
49855
50268
|
if (fd !== this.fd) {
|
|
49856
|
-
|
|
50269
|
+
fs22.close(fd, (err) => {
|
|
49857
50270
|
if (err) {
|
|
49858
50271
|
return this.emit("error", err);
|
|
49859
50272
|
}
|
|
@@ -49902,7 +50315,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49902
50315
|
buf = this._bufs[0];
|
|
49903
50316
|
}
|
|
49904
50317
|
try {
|
|
49905
|
-
const n = Buffer.isBuffer(buf) ?
|
|
50318
|
+
const n = Buffer.isBuffer(buf) ? fs22.writeSync(this.fd, buf) : fs22.writeSync(this.fd, buf, "utf8");
|
|
49906
50319
|
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
49907
50320
|
buf = releasedBufObj.writingBuf;
|
|
49908
50321
|
this._len = releasedBufObj.len;
|
|
@@ -49914,11 +50327,11 @@ var require_sonic_boom = __commonJS({
|
|
|
49914
50327
|
if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
|
|
49915
50328
|
throw err;
|
|
49916
50329
|
}
|
|
49917
|
-
|
|
50330
|
+
sleep4(BUSY_WRITE_TIMEOUT);
|
|
49918
50331
|
}
|
|
49919
50332
|
}
|
|
49920
50333
|
try {
|
|
49921
|
-
|
|
50334
|
+
fs22.fsyncSync(this.fd);
|
|
49922
50335
|
} catch {
|
|
49923
50336
|
}
|
|
49924
50337
|
}
|
|
@@ -49939,7 +50352,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49939
50352
|
buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
49940
50353
|
}
|
|
49941
50354
|
try {
|
|
49942
|
-
const n =
|
|
50355
|
+
const n = fs22.writeSync(this.fd, buf);
|
|
49943
50356
|
buf = buf.subarray(n);
|
|
49944
50357
|
this._len = Math.max(this._len - n, 0);
|
|
49945
50358
|
if (buf.length <= 0) {
|
|
@@ -49951,7 +50364,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49951
50364
|
if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
|
|
49952
50365
|
throw err;
|
|
49953
50366
|
}
|
|
49954
|
-
|
|
50367
|
+
sleep4(BUSY_WRITE_TIMEOUT);
|
|
49955
50368
|
}
|
|
49956
50369
|
}
|
|
49957
50370
|
}
|
|
@@ -49967,13 +50380,13 @@ var require_sonic_boom = __commonJS({
|
|
|
49967
50380
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
49968
50381
|
if (this.sync) {
|
|
49969
50382
|
try {
|
|
49970
|
-
const written = Buffer.isBuffer(this._writingBuf) ?
|
|
50383
|
+
const written = Buffer.isBuffer(this._writingBuf) ? fs22.writeSync(this.fd, this._writingBuf) : fs22.writeSync(this.fd, this._writingBuf, "utf8");
|
|
49971
50384
|
release(null, written);
|
|
49972
50385
|
} catch (err) {
|
|
49973
50386
|
release(err);
|
|
49974
50387
|
}
|
|
49975
50388
|
} else {
|
|
49976
|
-
|
|
50389
|
+
fs22.write(this.fd, this._writingBuf, release);
|
|
49977
50390
|
}
|
|
49978
50391
|
}
|
|
49979
50392
|
function actualWriteBuffer() {
|
|
@@ -49982,7 +50395,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49982
50395
|
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
49983
50396
|
if (this.sync) {
|
|
49984
50397
|
try {
|
|
49985
|
-
const written =
|
|
50398
|
+
const written = fs22.writeSync(this.fd, this._writingBuf);
|
|
49986
50399
|
release(null, written);
|
|
49987
50400
|
} catch (err) {
|
|
49988
50401
|
release(err);
|
|
@@ -49991,7 +50404,7 @@ var require_sonic_boom = __commonJS({
|
|
|
49991
50404
|
if (kCopyBuffer) {
|
|
49992
50405
|
this._writingBuf = Buffer.from(this._writingBuf);
|
|
49993
50406
|
}
|
|
49994
|
-
|
|
50407
|
+
fs22.write(this.fd, this._writingBuf, release);
|
|
49995
50408
|
}
|
|
49996
50409
|
}
|
|
49997
50410
|
function actualClose(sonic) {
|
|
@@ -50007,12 +50420,12 @@ var require_sonic_boom = __commonJS({
|
|
|
50007
50420
|
sonic._lens = [];
|
|
50008
50421
|
assert2(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
50009
50422
|
try {
|
|
50010
|
-
|
|
50423
|
+
fs22.fsync(sonic.fd, closeWrapped);
|
|
50011
50424
|
} catch {
|
|
50012
50425
|
}
|
|
50013
50426
|
function closeWrapped() {
|
|
50014
50427
|
if (sonic.fd !== 1 && sonic.fd !== 2) {
|
|
50015
|
-
|
|
50428
|
+
fs22.close(sonic.fd, done);
|
|
50016
50429
|
} else {
|
|
50017
50430
|
done();
|
|
50018
50431
|
}
|
|
@@ -50786,7 +51199,7 @@ var require_transport = __commonJS({
|
|
|
50786
51199
|
var getCallers = require_caller();
|
|
50787
51200
|
var { join: join2, isAbsolute, sep } = __require("node:path");
|
|
50788
51201
|
var { fileURLToPath } = __require("node:url");
|
|
50789
|
-
var
|
|
51202
|
+
var sleep4 = require_atomic_sleep();
|
|
50790
51203
|
var onExit = require_on_exit_leak_free();
|
|
50791
51204
|
var ThreadStream = require_thread_stream();
|
|
50792
51205
|
function setupOnExit(stream) {
|
|
@@ -50848,15 +51261,15 @@ var require_transport = __commonJS({
|
|
|
50848
51261
|
if (!unquoted) {
|
|
50849
51262
|
return false;
|
|
50850
51263
|
}
|
|
50851
|
-
let
|
|
50852
|
-
if (
|
|
51264
|
+
let path24 = unquoted;
|
|
51265
|
+
if (path24.startsWith("file://")) {
|
|
50853
51266
|
try {
|
|
50854
|
-
|
|
51267
|
+
path24 = fileURLToPath(path24);
|
|
50855
51268
|
} catch {
|
|
50856
51269
|
return false;
|
|
50857
51270
|
}
|
|
50858
51271
|
}
|
|
50859
|
-
return isAbsolute(
|
|
51272
|
+
return isAbsolute(path24) && !existsSync(path24);
|
|
50860
51273
|
}
|
|
50861
51274
|
function stripQuotes(value) {
|
|
50862
51275
|
const first = value[0];
|
|
@@ -50909,7 +51322,7 @@ var require_transport = __commonJS({
|
|
|
50909
51322
|
return;
|
|
50910
51323
|
}
|
|
50911
51324
|
stream.flushSync();
|
|
50912
|
-
|
|
51325
|
+
sleep4(100);
|
|
50913
51326
|
stream.end();
|
|
50914
51327
|
}
|
|
50915
51328
|
return stream;
|
|
@@ -52550,7 +52963,7 @@ var require_multistream = __commonJS({
|
|
|
52550
52963
|
var require_pino = __commonJS({
|
|
52551
52964
|
"node_modules/pino/pino.js"(exports, module) {
|
|
52552
52965
|
"use strict";
|
|
52553
|
-
var
|
|
52966
|
+
var os17 = __require("node:os");
|
|
52554
52967
|
var stdSerializers = require_pino_std_serializers();
|
|
52555
52968
|
var caller = require_caller();
|
|
52556
52969
|
var redaction = require_redaction();
|
|
@@ -52597,7 +53010,7 @@ var require_pino = __commonJS({
|
|
|
52597
53010
|
} = symbols;
|
|
52598
53011
|
var { epochTime, nullTime } = time3;
|
|
52599
53012
|
var { pid } = process;
|
|
52600
|
-
var hostname2 =
|
|
53013
|
+
var hostname2 = os17.hostname();
|
|
52601
53014
|
var defaultErrorSerializer = stdSerializers.err;
|
|
52602
53015
|
var defaultOptions2 = {
|
|
52603
53016
|
level: "info",
|
|
@@ -84923,15 +85336,15 @@ var require_tools2 = __commonJS({
|
|
|
84923
85336
|
* @param {String} path - Mailbox path to encode
|
|
84924
85337
|
* @returns {String} Encoded mailbox path
|
|
84925
85338
|
*/
|
|
84926
|
-
encodePath(connection,
|
|
84927
|
-
|
|
84928
|
-
if (!connection.enabled.has("UTF8=ACCEPT") && !tools.isRev2Active(connection) && /[&\x00-\x08\x0b-\x0c\x0e-\x1f\u0080-\uffff]/.test(
|
|
85339
|
+
encodePath(connection, path24) {
|
|
85340
|
+
path24 = (path24 || "").toString();
|
|
85341
|
+
if (!connection.enabled.has("UTF8=ACCEPT") && !tools.isRev2Active(connection) && /[&\x00-\x08\x0b-\x0c\x0e-\x1f\u0080-\uffff]/.test(path24)) {
|
|
84929
85342
|
try {
|
|
84930
|
-
|
|
85343
|
+
path24 = iconv.encode(path24, "utf-7-imap").toString();
|
|
84931
85344
|
} catch {
|
|
84932
85345
|
}
|
|
84933
85346
|
}
|
|
84934
|
-
return
|
|
85347
|
+
return path24;
|
|
84935
85348
|
},
|
|
84936
85349
|
/**
|
|
84937
85350
|
* Decodes a mailbox path from modified UTF-7 if the server does not support UTF8=ACCEPT.
|
|
@@ -84940,15 +85353,15 @@ var require_tools2 = __commonJS({
|
|
|
84940
85353
|
* @param {String} path - Mailbox path to decode
|
|
84941
85354
|
* @returns {String} Decoded mailbox path
|
|
84942
85355
|
*/
|
|
84943
|
-
decodePath(connection,
|
|
84944
|
-
|
|
84945
|
-
if (!connection.enabled.has("UTF8=ACCEPT") && !tools.isRev2Active(connection) && /[&]/.test(
|
|
85356
|
+
decodePath(connection, path24) {
|
|
85357
|
+
path24 = (path24 || "").toString();
|
|
85358
|
+
if (!connection.enabled.has("UTF8=ACCEPT") && !tools.isRev2Active(connection) && /[&]/.test(path24)) {
|
|
84946
85359
|
try {
|
|
84947
|
-
|
|
85360
|
+
path24 = iconv.decode(Buffer.from(path24), "utf-7-imap").toString();
|
|
84948
85361
|
} catch {
|
|
84949
85362
|
}
|
|
84950
85363
|
}
|
|
84951
|
-
return
|
|
85364
|
+
return path24;
|
|
84952
85365
|
},
|
|
84953
85366
|
/**
|
|
84954
85367
|
* Normalizes a mailbox path by joining array segments with the namespace delimiter,
|
|
@@ -84959,17 +85372,17 @@ var require_tools2 = __commonJS({
|
|
|
84959
85372
|
* @param {Boolean} [skipNamespace] - If true, skips prepending the namespace prefix
|
|
84960
85373
|
* @returns {String} Normalized mailbox path
|
|
84961
85374
|
*/
|
|
84962
|
-
normalizePath(connection,
|
|
84963
|
-
if (Array.isArray(
|
|
84964
|
-
|
|
85375
|
+
normalizePath(connection, path24, skipNamespace) {
|
|
85376
|
+
if (Array.isArray(path24)) {
|
|
85377
|
+
path24 = path24.join(connection.namespace && connection.namespace.delimiter || "");
|
|
84965
85378
|
}
|
|
84966
|
-
if (
|
|
85379
|
+
if (path24.toUpperCase() === "INBOX") {
|
|
84967
85380
|
return "INBOX";
|
|
84968
85381
|
}
|
|
84969
|
-
if (!skipNamespace && connection.namespace && connection.namespace.prefix && !
|
|
84970
|
-
|
|
85382
|
+
if (!skipNamespace && connection.namespace && connection.namespace.prefix && !path24.startsWith(connection.namespace.prefix)) {
|
|
85383
|
+
path24 = connection.namespace.prefix + path24;
|
|
84971
85384
|
}
|
|
84972
|
-
return
|
|
85385
|
+
return path24;
|
|
84973
85386
|
},
|
|
84974
85387
|
/**
|
|
84975
85388
|
* Compares two mailbox paths for equality after normalization.
|
|
@@ -85300,14 +85713,14 @@ var require_tools2 = __commonJS({
|
|
|
85300
85713
|
}
|
|
85301
85714
|
}
|
|
85302
85715
|
if (map.emailId || map.uid) {
|
|
85303
|
-
let
|
|
85304
|
-
if (/[\u0080-\uffff]/.test(
|
|
85716
|
+
let path24 = mailbox.path;
|
|
85717
|
+
if (/[\u0080-\uffff]/.test(path24)) {
|
|
85305
85718
|
try {
|
|
85306
|
-
|
|
85719
|
+
path24 = iconv.encode(path24, "utf-7-imap").toString();
|
|
85307
85720
|
} catch {
|
|
85308
85721
|
}
|
|
85309
85722
|
}
|
|
85310
|
-
map.id = map.emailId || createHash2("md5").update([
|
|
85723
|
+
map.id = map.emailId || createHash2("md5").update([path24, mailbox.uidValidity?.toString() || "", map.uid.toString()].join(":")).digest("hex");
|
|
85311
85724
|
}
|
|
85312
85725
|
if (map.flags) {
|
|
85313
85726
|
let flagColor = tools.getFlagColor(map.flags);
|
|
@@ -85482,16 +85895,16 @@ var require_tools2 = __commonJS({
|
|
|
85482
85895
|
* @returns {Object} Parsed body structure tree with part numbers, types, parameters, and child nodes
|
|
85483
85896
|
*/
|
|
85484
85897
|
parseBodystructure(entry) {
|
|
85485
|
-
let walk = (node,
|
|
85486
|
-
|
|
85898
|
+
let walk = (node, path24) => {
|
|
85899
|
+
path24 = path24 || [];
|
|
85487
85900
|
let curNode = {}, i = 0, part = 0;
|
|
85488
|
-
if (
|
|
85489
|
-
curNode.part =
|
|
85901
|
+
if (path24.length) {
|
|
85902
|
+
curNode.part = path24.join(".");
|
|
85490
85903
|
}
|
|
85491
85904
|
if (Array.isArray(node[0])) {
|
|
85492
85905
|
curNode.childNodes = [];
|
|
85493
85906
|
while (Array.isArray(node[i])) {
|
|
85494
|
-
curNode.childNodes.push(walk(node[i],
|
|
85907
|
+
curNode.childNodes.push(walk(node[i], path24.concat(++part)));
|
|
85495
85908
|
i++;
|
|
85496
85909
|
}
|
|
85497
85910
|
curNode.type = "multipart/" + ((node[i++] || {}).value || "").toString().toLowerCase();
|
|
@@ -85534,7 +85947,7 @@ var require_tools2 = __commonJS({
|
|
|
85534
85947
|
// the encapsulated message shares the part number with its wrapper.
|
|
85535
85948
|
// Distinction is via suffixes: path.MIME = wrapper headers,
|
|
85536
85949
|
// path.HEADER = encapsulated message headers.
|
|
85537
|
-
walk(node[i],
|
|
85950
|
+
walk(node[i], path24)
|
|
85538
85951
|
];
|
|
85539
85952
|
}
|
|
85540
85953
|
i++;
|
|
@@ -87496,14 +87909,14 @@ var require_select = __commonJS({
|
|
|
87496
87909
|
// update into a silent no-op for the rest of the session.
|
|
87497
87910
|
permanentflags: { key: "permanentFlags", parse: (value) => Array.isArray(value) && new Set(value) }
|
|
87498
87911
|
});
|
|
87499
|
-
module.exports = async (connection,
|
|
87912
|
+
module.exports = async (connection, path24, options) => {
|
|
87500
87913
|
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state)) {
|
|
87501
87914
|
return;
|
|
87502
87915
|
}
|
|
87503
87916
|
options = options || {};
|
|
87504
|
-
|
|
87505
|
-
if (!connection.folders.has(
|
|
87506
|
-
let folders = await connection.run("LIST", "",
|
|
87917
|
+
path24 = normalizePath(connection, path24);
|
|
87918
|
+
if (!connection.folders.has(path24)) {
|
|
87919
|
+
let folders = await connection.run("LIST", "", path24);
|
|
87507
87920
|
if (!folders) {
|
|
87508
87921
|
throw new Error("Failed to fetch folders");
|
|
87509
87922
|
}
|
|
@@ -87511,10 +87924,10 @@ var require_select = __commonJS({
|
|
|
87511
87924
|
connection.folders.set(folder.path, folder);
|
|
87512
87925
|
});
|
|
87513
87926
|
}
|
|
87514
|
-
let folderListData = connection.folders.has(
|
|
87927
|
+
let folderListData = connection.folders.has(path24) ? connection.folders.get(path24) : false;
|
|
87515
87928
|
let response;
|
|
87516
87929
|
try {
|
|
87517
|
-
let map = { path:
|
|
87930
|
+
let map = { path: path24 };
|
|
87518
87931
|
if (folderListData) {
|
|
87519
87932
|
["delimiter", "specialUse", "subscribed", "listed"].forEach((key) => {
|
|
87520
87933
|
if (folderListData[key]) {
|
|
@@ -87533,7 +87946,7 @@ var require_select = __commonJS({
|
|
|
87533
87946
|
]);
|
|
87534
87947
|
map.qresync = true;
|
|
87535
87948
|
}
|
|
87536
|
-
let encodedPath = encodePath(connection,
|
|
87949
|
+
let encodedPath = encodePath(connection, path24);
|
|
87537
87950
|
let selectCommand = {
|
|
87538
87951
|
command: !options.readOnly ? "SELECT" : "EXAMINE",
|
|
87539
87952
|
/* c8 ignore next */
|
|
@@ -87593,12 +88006,12 @@ var require_select = __commonJS({
|
|
|
87593
88006
|
// since the client's last known state. Only received when QRESYNC was requested.
|
|
87594
88007
|
// A dummy mailbox object is passed because the mailbox isn't officially open yet.
|
|
87595
88008
|
VANISHED: async (untagged) => {
|
|
87596
|
-
await connection.untaggedVanished(untagged, { path:
|
|
88009
|
+
await connection.untaggedVanished(untagged, { path: path24, uidNext: false, uidValidity: false });
|
|
87597
88010
|
},
|
|
87598
88011
|
// Untagged FETCH during SELECT/EXAMINE: only occurs with QRESYNC, delivering
|
|
87599
88012
|
// updated flags for messages that changed since the client's last modseq.
|
|
87600
88013
|
FETCH: async (untagged) => {
|
|
87601
|
-
await connection.untaggedFetch(untagged, { path:
|
|
88014
|
+
await connection.untaggedFetch(untagged, { path: path24, uidNext: false, uidValidity: false });
|
|
87602
88015
|
}
|
|
87603
88016
|
}
|
|
87604
88017
|
});
|
|
@@ -87612,13 +88025,13 @@ var require_select = __commonJS({
|
|
|
87612
88025
|
}
|
|
87613
88026
|
let currentMailbox = connection.mailbox;
|
|
87614
88027
|
connection.mailbox = false;
|
|
87615
|
-
if (currentMailbox && currentMailbox.path !==
|
|
88028
|
+
if (currentMailbox && currentMailbox.path !== path24) {
|
|
87616
88029
|
connection.emit("mailboxClose", currentMailbox);
|
|
87617
88030
|
}
|
|
87618
88031
|
connection.mailbox = map;
|
|
87619
88032
|
connection.currentSelectCommand = selectCommand;
|
|
87620
88033
|
connection.state = connection.states.SELECTED;
|
|
87621
|
-
if (!currentMailbox || currentMailbox.path !==
|
|
88034
|
+
if (!currentMailbox || currentMailbox.path !== path24) {
|
|
87622
88035
|
connection.emit("mailboxOpen", connection.mailbox);
|
|
87623
88036
|
}
|
|
87624
88037
|
response.next();
|
|
@@ -87833,17 +88246,17 @@ var require_create = __commonJS({
|
|
|
87833
88246
|
"node_modules/imapflow/lib/commands/create.js"(exports, module) {
|
|
87834
88247
|
"use strict";
|
|
87835
88248
|
var { encodePath, normalizePath, getStatusCode, enhanceCommandError } = require_tools2();
|
|
87836
|
-
module.exports = async (connection,
|
|
88249
|
+
module.exports = async (connection, path24) => {
|
|
87837
88250
|
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state)) {
|
|
87838
88251
|
return;
|
|
87839
88252
|
}
|
|
87840
|
-
|
|
88253
|
+
path24 = normalizePath(connection, path24);
|
|
87841
88254
|
let response;
|
|
87842
88255
|
try {
|
|
87843
88256
|
let map = {
|
|
87844
|
-
path:
|
|
88257
|
+
path: path24
|
|
87845
88258
|
};
|
|
87846
|
-
response = await connection.exec("CREATE", [{ type: "ATOM", value: encodePath(connection,
|
|
88259
|
+
response = await connection.exec("CREATE", [{ type: "ATOM", value: encodePath(connection, path24) }]);
|
|
87847
88260
|
let section = response.response.attributes && response.response.attributes[0] && response.response.attributes[0].section && response.response.attributes[0].section.length ? response.response.attributes[0].section : false;
|
|
87848
88261
|
if (section) {
|
|
87849
88262
|
let key;
|
|
@@ -87869,13 +88282,13 @@ var require_create = __commonJS({
|
|
|
87869
88282
|
}
|
|
87870
88283
|
map.created = true;
|
|
87871
88284
|
response.next();
|
|
87872
|
-
await connection.run("SUBSCRIBE",
|
|
88285
|
+
await connection.run("SUBSCRIBE", path24);
|
|
87873
88286
|
return map;
|
|
87874
88287
|
} catch (err) {
|
|
87875
88288
|
let errorCode = getStatusCode(err.response);
|
|
87876
88289
|
if (errorCode === "ALREADYEXISTS") {
|
|
87877
88290
|
return {
|
|
87878
|
-
path:
|
|
88291
|
+
path: path24,
|
|
87879
88292
|
created: false
|
|
87880
88293
|
};
|
|
87881
88294
|
}
|
|
@@ -87892,20 +88305,20 @@ var require_delete = __commonJS({
|
|
|
87892
88305
|
"node_modules/imapflow/lib/commands/delete.js"(exports, module) {
|
|
87893
88306
|
"use strict";
|
|
87894
88307
|
var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
|
|
87895
|
-
module.exports = async (connection,
|
|
88308
|
+
module.exports = async (connection, path24) => {
|
|
87896
88309
|
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state)) {
|
|
87897
88310
|
return;
|
|
87898
88311
|
}
|
|
87899
|
-
|
|
87900
|
-
if (connection.state === connection.states.SELECTED && connection.mailbox.path ===
|
|
88312
|
+
path24 = normalizePath(connection, path24);
|
|
88313
|
+
if (connection.state === connection.states.SELECTED && connection.mailbox.path === path24) {
|
|
87901
88314
|
await connection.run("CLOSE");
|
|
87902
88315
|
}
|
|
87903
88316
|
let response;
|
|
87904
88317
|
try {
|
|
87905
88318
|
let map = {
|
|
87906
|
-
path:
|
|
88319
|
+
path: path24
|
|
87907
88320
|
};
|
|
87908
|
-
response = await connection.exec("DELETE", [{ type: "ATOM", value: encodePath(connection,
|
|
88321
|
+
response = await connection.exec("DELETE", [{ type: "ATOM", value: encodePath(connection, path24) }]);
|
|
87909
88322
|
response.next();
|
|
87910
88323
|
return map;
|
|
87911
88324
|
} catch (err) {
|
|
@@ -87922,23 +88335,23 @@ var require_rename = __commonJS({
|
|
|
87922
88335
|
"node_modules/imapflow/lib/commands/rename.js"(exports, module) {
|
|
87923
88336
|
"use strict";
|
|
87924
88337
|
var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
|
|
87925
|
-
module.exports = async (connection,
|
|
88338
|
+
module.exports = async (connection, path24, newPath) => {
|
|
87926
88339
|
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state)) {
|
|
87927
88340
|
return;
|
|
87928
88341
|
}
|
|
87929
|
-
|
|
88342
|
+
path24 = normalizePath(connection, path24);
|
|
87930
88343
|
newPath = normalizePath(connection, newPath);
|
|
87931
|
-
if (connection.state === connection.states.SELECTED && connection.mailbox.path ===
|
|
88344
|
+
if (connection.state === connection.states.SELECTED && connection.mailbox.path === path24) {
|
|
87932
88345
|
await connection.run("CLOSE");
|
|
87933
88346
|
}
|
|
87934
88347
|
let response;
|
|
87935
88348
|
try {
|
|
87936
88349
|
let map = {
|
|
87937
|
-
path:
|
|
88350
|
+
path: path24,
|
|
87938
88351
|
newPath
|
|
87939
88352
|
};
|
|
87940
88353
|
response = await connection.exec("RENAME", [
|
|
87941
|
-
{ type: "ATOM", value: encodePath(connection,
|
|
88354
|
+
{ type: "ATOM", value: encodePath(connection, path24) },
|
|
87942
88355
|
{ type: "ATOM", value: encodePath(connection, newPath) }
|
|
87943
88356
|
]);
|
|
87944
88357
|
response.next();
|
|
@@ -87985,14 +88398,14 @@ var require_subscribe = __commonJS({
|
|
|
87985
88398
|
"node_modules/imapflow/lib/commands/subscribe.js"(exports, module) {
|
|
87986
88399
|
"use strict";
|
|
87987
88400
|
var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
|
|
87988
|
-
module.exports = async (connection,
|
|
88401
|
+
module.exports = async (connection, path24) => {
|
|
87989
88402
|
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state)) {
|
|
87990
88403
|
return;
|
|
87991
88404
|
}
|
|
87992
|
-
|
|
88405
|
+
path24 = normalizePath(connection, path24);
|
|
87993
88406
|
let response;
|
|
87994
88407
|
try {
|
|
87995
|
-
response = await connection.exec("SUBSCRIBE", [{ type: "ATOM", value: encodePath(connection,
|
|
88408
|
+
response = await connection.exec("SUBSCRIBE", [{ type: "ATOM", value: encodePath(connection, path24) }]);
|
|
87996
88409
|
response.next();
|
|
87997
88410
|
return true;
|
|
87998
88411
|
} catch (err) {
|
|
@@ -88009,14 +88422,14 @@ var require_unsubscribe = __commonJS({
|
|
|
88009
88422
|
"node_modules/imapflow/lib/commands/unsubscribe.js"(exports, module) {
|
|
88010
88423
|
"use strict";
|
|
88011
88424
|
var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
|
|
88012
|
-
module.exports = async (connection,
|
|
88425
|
+
module.exports = async (connection, path24) => {
|
|
88013
88426
|
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state)) {
|
|
88014
88427
|
return;
|
|
88015
88428
|
}
|
|
88016
|
-
|
|
88429
|
+
path24 = normalizePath(connection, path24);
|
|
88017
88430
|
let response;
|
|
88018
88431
|
try {
|
|
88019
|
-
response = await connection.exec("UNSUBSCRIBE", [{ type: "ATOM", value: encodePath(connection,
|
|
88432
|
+
response = await connection.exec("UNSUBSCRIBE", [{ type: "ATOM", value: encodePath(connection, path24) }]);
|
|
88020
88433
|
response.next();
|
|
88021
88434
|
return true;
|
|
88022
88435
|
} catch (err) {
|
|
@@ -88822,11 +89235,11 @@ var require_status = __commonJS({
|
|
|
88822
89235
|
var { encodePath, normalizePath, buildStatusQueryAttributes, isRev2Active } = require_tools2();
|
|
88823
89236
|
var { parseStatusList } = require_status_fields();
|
|
88824
89237
|
var MAILBOX_UPDATERS = {
|
|
88825
|
-
messages: (value, connection,
|
|
89238
|
+
messages: (value, connection, path24) => {
|
|
88826
89239
|
let prevCount = connection.mailbox.exists;
|
|
88827
89240
|
if (prevCount !== value) {
|
|
88828
89241
|
connection.mailbox.exists = value;
|
|
88829
|
-
connection.emit("exists", { path:
|
|
89242
|
+
connection.emit("exists", { path: path24, count: value, prevCount });
|
|
88830
89243
|
}
|
|
88831
89244
|
},
|
|
88832
89245
|
uidNext: (value, connection) => {
|
|
@@ -88836,28 +89249,28 @@ var require_status = __commonJS({
|
|
|
88836
89249
|
connection.mailbox.highestModseq = value;
|
|
88837
89250
|
}
|
|
88838
89251
|
};
|
|
88839
|
-
module.exports = async (connection,
|
|
88840
|
-
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state) || !
|
|
89252
|
+
module.exports = async (connection, path24, query) => {
|
|
89253
|
+
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state) || !path24) {
|
|
88841
89254
|
return false;
|
|
88842
89255
|
}
|
|
88843
|
-
|
|
88844
|
-
let encodedPath = encodePath(connection,
|
|
89256
|
+
path24 = normalizePath(connection, path24);
|
|
89257
|
+
let encodedPath = encodePath(connection, path24);
|
|
88845
89258
|
let attributes = [{ type: encodedPath.indexOf("&") >= 0 ? "STRING" : "ATOM", value: encodedPath }];
|
|
88846
89259
|
let queryAttributes = buildStatusQueryAttributes(connection, query);
|
|
88847
89260
|
let syntheticRecent = query && query.recent && isRev2Active(connection);
|
|
88848
89261
|
if (!queryAttributes.length) {
|
|
88849
|
-
return syntheticRecent ? { path:
|
|
89262
|
+
return syntheticRecent ? { path: path24, recent: 0 } : false;
|
|
88850
89263
|
}
|
|
88851
89264
|
attributes.push(queryAttributes);
|
|
88852
89265
|
let response;
|
|
88853
89266
|
try {
|
|
88854
|
-
let map = { path:
|
|
89267
|
+
let map = { path: path24 };
|
|
88855
89268
|
response = await connection.exec("STATUS", attributes, {
|
|
88856
89269
|
untagged: {
|
|
88857
89270
|
// STATUS response: * STATUS <mailbox> (<key> <value> <key> <value> ...)
|
|
88858
89271
|
// Parsed as alternating key-value pairs (i % 2 pattern).
|
|
88859
89272
|
STATUS: async (untagged) => {
|
|
88860
|
-
let updateCurrent = connection.state === connection.states.SELECTED &&
|
|
89273
|
+
let updateCurrent = connection.state === connection.states.SELECTED && path24 === connection.mailbox.path;
|
|
88861
89274
|
let list = untagged.attributes && Array.isArray(untagged.attributes[1]) ? untagged.attributes[1] : false;
|
|
88862
89275
|
if (!list) {
|
|
88863
89276
|
return;
|
|
@@ -88865,7 +89278,7 @@ var require_status = __commonJS({
|
|
|
88865
89278
|
parseStatusList(list, (key, value) => {
|
|
88866
89279
|
map[key] = value;
|
|
88867
89280
|
if (updateCurrent && MAILBOX_UPDATERS[key]) {
|
|
88868
|
-
MAILBOX_UPDATERS[key](value, connection,
|
|
89281
|
+
MAILBOX_UPDATERS[key](value, connection, path24);
|
|
88869
89282
|
}
|
|
88870
89283
|
});
|
|
88871
89284
|
}
|
|
@@ -88878,9 +89291,9 @@ var require_status = __commonJS({
|
|
|
88878
89291
|
return map;
|
|
88879
89292
|
} catch (err) {
|
|
88880
89293
|
if (err.responseStatus === "NO") {
|
|
88881
|
-
let folders = await connection.run("LIST", "",
|
|
89294
|
+
let folders = await connection.run("LIST", "", path24, { listOnly: true });
|
|
88882
89295
|
if (folders && !folders.length) {
|
|
88883
|
-
let error2 = new Error(`Mailbox doesn't exist: ${
|
|
89296
|
+
let error2 = new Error(`Mailbox doesn't exist: ${path24}`);
|
|
88884
89297
|
error2.code = "NotFound";
|
|
88885
89298
|
error2.response = err;
|
|
88886
89299
|
throw error2;
|
|
@@ -89027,15 +89440,15 @@ var require_quota = __commonJS({
|
|
|
89027
89440
|
"node_modules/imapflow/lib/commands/quota.js"(exports, module) {
|
|
89028
89441
|
"use strict";
|
|
89029
89442
|
var { encodePath, normalizePath, enhanceCommandError, parseUintValue, isUnsafeKey } = require_tools2();
|
|
89030
|
-
module.exports = async (connection,
|
|
89031
|
-
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state) || !
|
|
89443
|
+
module.exports = async (connection, path24) => {
|
|
89444
|
+
if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state) || !path24) {
|
|
89032
89445
|
return;
|
|
89033
89446
|
}
|
|
89034
89447
|
if (!connection.capabilities.has("QUOTA")) {
|
|
89035
89448
|
return false;
|
|
89036
89449
|
}
|
|
89037
|
-
|
|
89038
|
-
let map = { path:
|
|
89450
|
+
path24 = normalizePath(connection, path24);
|
|
89451
|
+
let map = { path: path24 };
|
|
89039
89452
|
let processQuotaResponse = (untagged) => {
|
|
89040
89453
|
let attributes = untagged.attributes && untagged.attributes[1];
|
|
89041
89454
|
if (!attributes || !attributes.length) {
|
|
@@ -89075,7 +89488,7 @@ var require_quota = __commonJS({
|
|
|
89075
89488
|
let quotaFound = false;
|
|
89076
89489
|
let response;
|
|
89077
89490
|
try {
|
|
89078
|
-
response = await connection.exec("GETQUOTAROOT", [{ type: "ATOM", value: encodePath(connection,
|
|
89491
|
+
response = await connection.exec("GETQUOTAROOT", [{ type: "ATOM", value: encodePath(connection, path24) }], {
|
|
89079
89492
|
untagged: {
|
|
89080
89493
|
// QUOTAROOT response tells us which quota root applies to this mailbox.
|
|
89081
89494
|
// A mailbox may have zero or one quota root.
|
|
@@ -89218,15 +89631,15 @@ var require_idle = __commonJS({
|
|
|
89218
89631
|
}
|
|
89219
89632
|
}
|
|
89220
89633
|
async function pollOnce2(connection, session) {
|
|
89221
|
-
let
|
|
89634
|
+
let path24 = connection.mailbox && connection.mailbox.path;
|
|
89222
89635
|
switch (connection.missingIdleCommand) {
|
|
89223
89636
|
case "SELECT":
|
|
89224
89637
|
connection.log.debug({ src: "c", msg: `Running SELECT to detect changes in folder`, cid: connection.id });
|
|
89225
|
-
await connection.runInternal("SELECT",
|
|
89638
|
+
await connection.runInternal("SELECT", path24, { readOnly: session.selectCommand.command === "EXAMINE" });
|
|
89226
89639
|
break;
|
|
89227
89640
|
case "STATUS": {
|
|
89228
89641
|
connection.log.debug({ src: "c", msg: `Running STATUS to detect changes in folder`, cid: connection.id });
|
|
89229
|
-
let status = await connection.runInternal("STATUS",
|
|
89642
|
+
let status = await connection.runInternal("STATUS", path24, {
|
|
89230
89643
|
messages: true,
|
|
89231
89644
|
uidNext: true,
|
|
89232
89645
|
uidValidity: true,
|
|
@@ -89519,7 +89932,7 @@ var require_imap_flow = __commonJS({
|
|
|
89519
89932
|
"use strict";
|
|
89520
89933
|
var tls = __require("tls");
|
|
89521
89934
|
var net = __require("net");
|
|
89522
|
-
var
|
|
89935
|
+
var crypto12 = __require("crypto");
|
|
89523
89936
|
var { EventEmitter } = __require("events");
|
|
89524
89937
|
var logger2 = require_logger();
|
|
89525
89938
|
var libmime = require_libmime();
|
|
@@ -89826,7 +90239,7 @@ var require_imap_flow = __commonJS({
|
|
|
89826
90239
|
this.emit("error", err);
|
|
89827
90240
|
}
|
|
89828
90241
|
getRandomId() {
|
|
89829
|
-
let rid = BigInt("0x" +
|
|
90242
|
+
let rid = BigInt("0x" + crypto12.randomBytes(13).toString("hex")).toString(36);
|
|
89830
90243
|
if (rid.length < 20) {
|
|
89831
90244
|
rid = "0".repeat(20 - rid.length) + rid;
|
|
89832
90245
|
}
|
|
@@ -90913,12 +91326,12 @@ var require_imap_flow = __commonJS({
|
|
|
90913
91326
|
this.emit("flags", updateEvent);
|
|
90914
91327
|
}
|
|
90915
91328
|
}
|
|
90916
|
-
async ensureSelectedMailbox(
|
|
90917
|
-
if (!
|
|
91329
|
+
async ensureSelectedMailbox(path24) {
|
|
91330
|
+
if (!path24) {
|
|
90918
91331
|
return false;
|
|
90919
91332
|
}
|
|
90920
|
-
if (!this.mailbox || !comparePaths(this, this.mailbox.path,
|
|
90921
|
-
return await this.mailboxOpen(
|
|
91333
|
+
if (!this.mailbox || !comparePaths(this, this.mailbox.path, path24)) {
|
|
91334
|
+
return await this.mailboxOpen(path24);
|
|
90922
91335
|
}
|
|
90923
91336
|
return true;
|
|
90924
91337
|
}
|
|
@@ -91333,9 +91746,9 @@ var require_imap_flow = __commonJS({
|
|
|
91333
91746
|
* let quota = await client.getQuota();
|
|
91334
91747
|
* console.log(quota.storage.used, quota.storage.limit)
|
|
91335
91748
|
*/
|
|
91336
|
-
async getQuota(
|
|
91337
|
-
|
|
91338
|
-
return await this.run("QUOTA",
|
|
91749
|
+
async getQuota(path24) {
|
|
91750
|
+
path24 = path24 || "INBOX";
|
|
91751
|
+
return await this.run("QUOTA", path24);
|
|
91339
91752
|
}
|
|
91340
91753
|
/**
|
|
91341
91754
|
* @typedef {Object} ListResponse
|
|
@@ -91445,8 +91858,8 @@ var require_imap_flow = __commonJS({
|
|
|
91445
91858
|
* console.log(info.path);
|
|
91446
91859
|
* // "INBOX.parent.child" // assumes "INBOX." as namespace prefix and "." as delimiter
|
|
91447
91860
|
*/
|
|
91448
|
-
async mailboxCreate(
|
|
91449
|
-
return await this.run("CREATE",
|
|
91861
|
+
async mailboxCreate(path24) {
|
|
91862
|
+
return await this.run("CREATE", path24);
|
|
91450
91863
|
}
|
|
91451
91864
|
/**
|
|
91452
91865
|
* @typedef {Object} MailboxRenameResponse
|
|
@@ -91467,8 +91880,8 @@ var require_imap_flow = __commonJS({
|
|
|
91467
91880
|
* console.log(info.newPath);
|
|
91468
91881
|
* // "INBOX.Important stuff ❗️" // assumes "INBOX." as namespace prefix
|
|
91469
91882
|
*/
|
|
91470
|
-
async mailboxRename(
|
|
91471
|
-
return await this.run("RENAME",
|
|
91883
|
+
async mailboxRename(path24, newPath) {
|
|
91884
|
+
return await this.run("RENAME", path24, newPath);
|
|
91472
91885
|
}
|
|
91473
91886
|
/**
|
|
91474
91887
|
* @typedef {Object} MailboxDeleteResponse
|
|
@@ -91487,8 +91900,8 @@ var require_imap_flow = __commonJS({
|
|
|
91487
91900
|
* console.log(info.path);
|
|
91488
91901
|
* // "INBOX.Important stuff ❗️" // assumes "INBOX." as namespace prefix
|
|
91489
91902
|
*/
|
|
91490
|
-
async mailboxDelete(
|
|
91491
|
-
return await this.run("DELETE",
|
|
91903
|
+
async mailboxDelete(path24) {
|
|
91904
|
+
return await this.run("DELETE", path24);
|
|
91492
91905
|
}
|
|
91493
91906
|
/**
|
|
91494
91907
|
* Subscribes to a mailbox
|
|
@@ -91499,8 +91912,8 @@ var require_imap_flow = __commonJS({
|
|
|
91499
91912
|
* @example
|
|
91500
91913
|
* await client.mailboxSubscribe('Important stuff ❗️');
|
|
91501
91914
|
*/
|
|
91502
|
-
async mailboxSubscribe(
|
|
91503
|
-
return await this.run("SUBSCRIBE",
|
|
91915
|
+
async mailboxSubscribe(path24) {
|
|
91916
|
+
return await this.run("SUBSCRIBE", path24);
|
|
91504
91917
|
}
|
|
91505
91918
|
/**
|
|
91506
91919
|
* Unsubscribes from a mailbox
|
|
@@ -91511,8 +91924,8 @@ var require_imap_flow = __commonJS({
|
|
|
91511
91924
|
* @example
|
|
91512
91925
|
* await client.mailboxUnsubscribe('Important stuff ❗️');
|
|
91513
91926
|
*/
|
|
91514
|
-
async mailboxUnsubscribe(
|
|
91515
|
-
return await this.run("UNSUBSCRIBE",
|
|
91927
|
+
async mailboxUnsubscribe(path24) {
|
|
91928
|
+
return await this.run("UNSUBSCRIBE", path24);
|
|
91516
91929
|
}
|
|
91517
91930
|
/**
|
|
91518
91931
|
* Opens a mailbox to access messages. You can perform message operations only against an opened mailbox.
|
|
@@ -91530,8 +91943,8 @@ var require_imap_flow = __commonJS({
|
|
|
91530
91943
|
* console.log(mailbox.exists);
|
|
91531
91944
|
* // 125
|
|
91532
91945
|
*/
|
|
91533
|
-
async mailboxOpen(
|
|
91534
|
-
return await this.run("SELECT",
|
|
91946
|
+
async mailboxOpen(path24, options) {
|
|
91947
|
+
return await this.run("SELECT", path24, options);
|
|
91535
91948
|
}
|
|
91536
91949
|
/**
|
|
91537
91950
|
* Closes a previously opened mailbox
|
|
@@ -91578,8 +91991,8 @@ var require_imap_flow = __commonJS({
|
|
|
91578
91991
|
* console.log(status.unseen);
|
|
91579
91992
|
* // 123
|
|
91580
91993
|
*/
|
|
91581
|
-
async status(
|
|
91582
|
-
return await this.run("STATUS",
|
|
91994
|
+
async status(path24, query) {
|
|
91995
|
+
return await this.run("STATUS", path24, query);
|
|
91583
91996
|
}
|
|
91584
91997
|
/**
|
|
91585
91998
|
* Starts listening for new or deleted messages from the currently opened mailbox. Only required if {@link ImapFlow#disableAutoIdle} is set to `true`
|
|
@@ -91833,8 +92246,8 @@ var require_imap_flow = __commonJS({
|
|
|
91833
92246
|
* @example
|
|
91834
92247
|
* await client.append('INBOX', rawMessageBuffer, ['\\Seen'], new Date(2000, 1, 1));
|
|
91835
92248
|
*/
|
|
91836
|
-
async append(
|
|
91837
|
-
return await this.run("APPEND",
|
|
92249
|
+
async append(path24, content, flags, idate) {
|
|
92250
|
+
return await this.run("APPEND", path24, content, flags, idate) || false;
|
|
91838
92251
|
}
|
|
91839
92252
|
/**
|
|
91840
92253
|
* @typedef {Object} CopyResponseObject
|
|
@@ -92678,7 +93091,7 @@ var require_imap_flow = __commonJS({
|
|
|
92678
93091
|
await new Promise((resolve2) => setImmediate(resolve2));
|
|
92679
93092
|
}
|
|
92680
93093
|
const lock = this.locks.shift();
|
|
92681
|
-
const { resolve, reject, path:
|
|
93094
|
+
const { resolve, reject, path: path24, options, lockId } = lock;
|
|
92682
93095
|
if (lock.acquireTimer) {
|
|
92683
93096
|
clearTimeout(lock.acquireTimer);
|
|
92684
93097
|
lock.acquireTimer = null;
|
|
@@ -92694,7 +93107,7 @@ var require_imap_flow = __commonJS({
|
|
|
92694
93107
|
this.log.warn({
|
|
92695
93108
|
msg: "Mailbox lock held for a long time",
|
|
92696
93109
|
lockId: lock.lockId,
|
|
92697
|
-
path:
|
|
93110
|
+
path: path24,
|
|
92698
93111
|
heldFor: Date.now() - lock.heldAt,
|
|
92699
93112
|
/* c8 ignore next */
|
|
92700
93113
|
// the held-lock-warning diagnostic with a description set is a timing-dependent log detail
|
|
@@ -92730,52 +93143,52 @@ var require_imap_flow = __commonJS({
|
|
|
92730
93143
|
}
|
|
92731
93144
|
};
|
|
92732
93145
|
if (!this.usable || !this.socket || this.socket.destroyed) {
|
|
92733
|
-
this.log.trace({ msg: "Failed to acquire mailbox lock", path:
|
|
93146
|
+
this.log.trace({ msg: "Failed to acquire mailbox lock", path: path24, lockId, idling: this.idling });
|
|
92734
93147
|
let error2 = new Error("Connection not available");
|
|
92735
93148
|
error2.code = "NoConnection";
|
|
92736
93149
|
reject(error2);
|
|
92737
93150
|
continue;
|
|
92738
93151
|
}
|
|
92739
|
-
if (this.mailbox && this.mailbox.path ===
|
|
93152
|
+
if (this.mailbox && this.mailbox.path === path24 && !!this.mailbox.readOnly === !!options.readOnly) {
|
|
92740
93153
|
this.log.trace({
|
|
92741
93154
|
msg: "Mailbox lock acquired [existing]",
|
|
92742
|
-
path:
|
|
93155
|
+
path: path24,
|
|
92743
93156
|
lockId,
|
|
92744
93157
|
idling: this.idling,
|
|
92745
93158
|
...options.description && { description: options.description }
|
|
92746
93159
|
});
|
|
92747
93160
|
this.currentLock = lock;
|
|
92748
93161
|
armHeldTimer();
|
|
92749
|
-
resolve({ path:
|
|
93162
|
+
resolve({ path: path24, release });
|
|
92750
93163
|
break;
|
|
92751
93164
|
}
|
|
92752
93165
|
try {
|
|
92753
|
-
await this.mailboxOpen(
|
|
93166
|
+
await this.mailboxOpen(path24, options);
|
|
92754
93167
|
this.log.trace({
|
|
92755
93168
|
msg: "Mailbox lock acquired [selected]",
|
|
92756
|
-
path:
|
|
93169
|
+
path: path24,
|
|
92757
93170
|
lockId,
|
|
92758
93171
|
idling: this.idling,
|
|
92759
93172
|
...options.description && { description: options.description }
|
|
92760
93173
|
});
|
|
92761
93174
|
this.currentLock = lock;
|
|
92762
93175
|
armHeldTimer();
|
|
92763
|
-
resolve({ path:
|
|
93176
|
+
resolve({ path: path24, release });
|
|
92764
93177
|
break;
|
|
92765
93178
|
} catch (err) {
|
|
92766
93179
|
if (err.responseStatus === "NO") {
|
|
92767
93180
|
try {
|
|
92768
|
-
let folders = await this.run("LIST", "",
|
|
93181
|
+
let folders = await this.run("LIST", "", path24, { listOnly: true });
|
|
92769
93182
|
if (!folders || !folders.length) {
|
|
92770
93183
|
err.mailboxMissing = true;
|
|
92771
93184
|
}
|
|
92772
93185
|
} catch (E) {
|
|
92773
|
-
this.log.trace({ msg: "Failed to verify failed mailbox", path:
|
|
93186
|
+
this.log.trace({ msg: "Failed to verify failed mailbox", path: path24, err: E });
|
|
92774
93187
|
}
|
|
92775
93188
|
}
|
|
92776
93189
|
this.log.trace({
|
|
92777
93190
|
msg: "Failed to acquire mailbox lock",
|
|
92778
|
-
path:
|
|
93191
|
+
path: path24,
|
|
92779
93192
|
lockId,
|
|
92780
93193
|
idling: this.idling,
|
|
92781
93194
|
...options.description && { description: options.description },
|
|
@@ -92814,13 +93227,13 @@ var require_imap_flow = __commonJS({
|
|
|
92814
93227
|
* lock.release();
|
|
92815
93228
|
* }
|
|
92816
93229
|
*/
|
|
92817
|
-
getMailboxLock(
|
|
93230
|
+
getMailboxLock(path24, options) {
|
|
92818
93231
|
options = options || {};
|
|
92819
|
-
|
|
93232
|
+
path24 = normalizePath(this, path24);
|
|
92820
93233
|
let lockId = ++this.lockCounter;
|
|
92821
93234
|
this.log.trace({
|
|
92822
93235
|
msg: "Requesting lock",
|
|
92823
|
-
path:
|
|
93236
|
+
path: path24,
|
|
92824
93237
|
lockId,
|
|
92825
93238
|
...options.description && { description: options.description },
|
|
92826
93239
|
activeLock: this.currentLock ? {
|
|
@@ -92829,7 +93242,7 @@ var require_imap_flow = __commonJS({
|
|
|
92829
93242
|
} : null
|
|
92830
93243
|
});
|
|
92831
93244
|
let lockPromise = new Promise((resolve, reject) => {
|
|
92832
|
-
let lockEntry = { resolve, reject, path:
|
|
93245
|
+
let lockEntry = { resolve, reject, path: path24, options, lockId };
|
|
92833
93246
|
this.locks.push(lockEntry);
|
|
92834
93247
|
if (Number(options.acquireTimeout) > 0) {
|
|
92835
93248
|
lockEntry.acquireTimer = setTimeout(() => {
|
|
@@ -92918,16 +93331,16 @@ var require_imap_flow = __commonJS({
|
|
|
92918
93331
|
});
|
|
92919
93332
|
|
|
92920
93333
|
// src/mail/mail-fetcher.ts
|
|
92921
|
-
import
|
|
92922
|
-
import
|
|
93334
|
+
import fs21 from "node:fs/promises";
|
|
93335
|
+
import path22 from "node:path";
|
|
92923
93336
|
async function saveAttachments(attachments, downloadDir) {
|
|
92924
93337
|
if (attachments.length === 0) return [];
|
|
92925
|
-
await
|
|
93338
|
+
await fs21.mkdir(downloadDir, { recursive: true });
|
|
92926
93339
|
const saved = [];
|
|
92927
93340
|
for (const a of attachments) {
|
|
92928
|
-
const name =
|
|
92929
|
-
const savedPath =
|
|
92930
|
-
await
|
|
93341
|
+
const name = path22.basename(a.filename) || "attachment";
|
|
93342
|
+
const savedPath = path22.join(downloadDir, name);
|
|
93343
|
+
await fs21.writeFile(savedPath, a.content);
|
|
92931
93344
|
saved.push({ filename: name, savedPath, size: a.content.length });
|
|
92932
93345
|
}
|
|
92933
93346
|
return saved;
|
|
@@ -93057,8 +93470,8 @@ var init_mail_fetcher = __esm({
|
|
|
93057
93470
|
});
|
|
93058
93471
|
|
|
93059
93472
|
// src/tools/fetch-mail.ts
|
|
93060
|
-
import
|
|
93061
|
-
import
|
|
93473
|
+
import os16 from "node:os";
|
|
93474
|
+
import path23 from "node:path";
|
|
93062
93475
|
function registerFetchMailTool(server, deps = {}) {
|
|
93063
93476
|
const makeFetcher = deps.fetcherFactory ?? ((creds) => new ImapflowMailFetcher(creds));
|
|
93064
93477
|
server.registerTool(
|
|
@@ -93120,7 +93533,7 @@ var init_fetch_mail = __esm({
|
|
|
93120
93533
|
init_mail_fetcher();
|
|
93121
93534
|
init_auth_error();
|
|
93122
93535
|
init_validate();
|
|
93123
|
-
DEFAULT_DOWNLOAD_DIR =
|
|
93536
|
+
DEFAULT_DOWNLOAD_DIR = path23.join(os16.homedir(), ".cogent", "mail-downloads");
|
|
93124
93537
|
}
|
|
93125
93538
|
});
|
|
93126
93539
|
|