primcli 1.54.0 → 1.55.1

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.
@@ -1,5 +1,5 @@
1
- import { d as readMailJson, h as writeMailJson, i as mailId, l as privateMailDirectory, r as mailAddress } from "../shared-mail-files-SPPcis9g.js";
2
- import { a as scopedChatSenderTrust, n as isPlainChatReply } from "../scoped-chat-BrLq4dXH.js";
1
+ import { d as readMailJson, h as writeMailJson, i as mailId, l as privateMailDirectory, r as mailAddress } from "../shared-mail-files-MwlVE90c.js";
2
+ import { a as scopedChatSenderTrust, n as isPlainChatReply } from "../scoped-chat-C7cpIxVS.js";
3
3
  import { existsSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { join } from "node:path";
@@ -25,7 +25,7 @@ const AUTO_WORKING_EXPIRES_SECONDS = 55;
25
25
  /** Renew well before expiry so the indicator does not flicker off. */
26
26
  const AUTO_WORKING_RENEW_MS = 4e4;
27
27
  /** Stop renewing after this long even if no answer was seen. */
28
- const AUTO_WORKING_CAP_MS = 15 * 6e4;
28
+ const AUTO_WORKING_CAP_MS = 9e5;
29
29
  /**
30
30
  * A renewal in flight is never older than this: the signal send and its
31
31
  * reconciliation each abort after 5 seconds. Past it the marker is stale.
@@ -102,7 +102,7 @@ function emailDirectory(configDir, emailId) {
102
102
  }
103
103
  function parseClaim(value) {
104
104
  const row = value;
105
- if (!row || row.version !== 1 || typeof row.profile !== "string" || !profilePattern.test(row.profile) || row.thread_id !== null && typeof row.thread_id !== "string") return null;
105
+ if (row?.version !== 1 || typeof row.profile !== "string" || !profilePattern.test(row.profile) || row.thread_id !== null && typeof row.thread_id !== "string") return null;
106
106
  try {
107
107
  return {
108
108
  version: 1,
@@ -193,8 +193,8 @@ function readStop(configDir, emailId) {
193
193
  }
194
194
  function readWorkingLease(configDir, emailId) {
195
195
  try {
196
- const row = readMailJson(leasePath(configDir, emailId), 64 * 1024);
197
- if (!row || row.version !== 1 || typeof row.profile !== "string" || !profilePattern.test(row.profile) || typeof row.started_at !== "number" || !Number.isFinite(row.started_at) || row.stopped_at !== null && typeof row.stopped_at !== "number" || !Array.isArray(row.signal_sent_ids)) return null;
196
+ const row = readMailJson(leasePath(configDir, emailId), 65536);
197
+ if (row?.version !== 1 || typeof row.profile !== "string" || !profilePattern.test(row.profile) || typeof row.started_at !== "number" || !Number.isFinite(row.started_at) || row.stopped_at !== null && typeof row.stopped_at !== "number" || !Array.isArray(row.signal_sent_ids)) return null;
198
198
  const stop = readStop(configDir, emailId);
199
199
  return {
200
200
  version: 1,
@@ -384,7 +384,7 @@ function sendingInFlight(configDir, emailId) {
384
384
  * A stopped lease stays indexed this long, so a later answer to the same
385
385
  * sender can still find it and hold its stop against a refused earlier one.
386
386
  */
387
- const STOPPED_INDEX_MS = 10 * 6e4;
387
+ const STOPPED_INDEX_MS = 6e5;
388
388
  function indexedLeases(configDir, now) {
389
389
  let entries;
390
390
  try {
@@ -395,7 +395,7 @@ function indexedLeases(configDir, now) {
395
395
  return entries.flatMap((entry) => {
396
396
  if (!/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/.test(entry)) return [];
397
397
  const lease = readWorkingLease(configDir, entry);
398
- if (!lease || lease.stopped_at !== null && now() - lease.stopped_at >= STOPPED_INDEX_MS || now() - lease.started_at >= 9e5 * 2) {
398
+ if (!lease || lease.stopped_at !== null && now() - lease.stopped_at >= STOPPED_INDEX_MS || now() - lease.started_at >= 18e5) {
399
399
  unmarkActive(configDir, entry);
400
400
  return [];
401
401
  }
@@ -577,7 +577,7 @@ function renewerAlive(configDir, emailId) {
577
577
  try {
578
578
  const value = JSON.parse(readFileSync(renewerPath(configDir, emailId), "utf8"));
579
579
  if (typeof value.pid !== "number" || typeof value.at !== "number") return false;
580
- if (Date.now() - value.at > 4e4 * 2) return false;
580
+ if (Date.now() - value.at > 8e4) return false;
581
581
  process.kill(value.pid, 0);
582
582
  return true;
583
583
  } catch {