@uuaid/pillar 2.8.1 → 2.8.2

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.
@@ -286,11 +286,13 @@ export class JsonDirMailboxReader {
286
286
  appendOutbound() { return this._readOnly("appendOutbound"); }
287
287
  appendInbound() { return this._readOnly("appendInbound"); }
288
288
  markOutboundDelivered() { return this._readOnly("markOutboundDelivered"); }
289
+ markOutboundSuperseded() { return this._readOnly("markOutboundSuperseded"); }
289
290
  admitKnock() { return this._readOnly("admitKnock"); }
290
291
  markKnockAnswered() { return this._readOnly("markKnockAnswered"); }
291
292
  markQuarantined() { return this._readOnly("markQuarantined"); }
292
293
  enqueueGroupV2Sends() { return this._readOnly("enqueueGroupV2Sends"); }
293
294
  markGroupV2Send() { return this._readOnly("markGroupV2Send"); }
295
+ claimGroupV2Attempt() { return this._readOnly("claimGroupV2Attempt"); }
294
296
  releaseQuarantined() { return this._readOnly("releaseQuarantined"); }
295
297
  markInboxRead() { return this._readOnly("markInboxRead"); }
296
298
  setInboundGroup() { return this._readOnly("setInboundGroup"); }
@@ -550,6 +550,16 @@ export class JsonlMailboxStore {
550
550
  if (changed) this._writeJsonl("outbox", this.outboxPath, rows);
551
551
  }
552
552
 
553
+ /** 2.8.2 r2: Mailbox#markOutboundSuperseded (a live pending row only). */
554
+ markOutboundSuperseded(envelopeId) {
555
+ const rows = this._outboxRows();
556
+ let changed = false;
557
+ for (const r of rows) {
558
+ if (r.envelope_id === envelopeId && r.status === "pending" && !isErased(r)) { r.status = "superseded"; changed = true; }
559
+ }
560
+ if (changed) this._writeJsonl("outbox", this.outboxPath, rows);
561
+ }
562
+
553
563
  outboxTip() {
554
564
  const rows = this._outboxRows();
555
565
  return rows.length > 0 ? rows[rows.length - 1].chain_hash : EMPTY_TIP;
@@ -903,15 +913,29 @@ export class JsonlMailboxStore {
903
913
  .sort((a, b) => (a.queued_at < b.queued_at ? -1 : a.queued_at > b.queued_at ? 1 : 0));
904
914
  }
905
915
 
906
- markGroupV2Send(id, state, { envelopeId = null, reason = null } = {}) {
916
+ /** Mailbox#markGroupV2Send; with `attempt`, only a queued item that still names it (2.8.2 r4). True when written. */
917
+ markGroupV2Send(id, state, { envelopeId = null, reason = null, attempt } = {}) {
907
918
  const q = this._readJsonObj("sendq", this.sendqPath, []);
908
919
  const row = q.find((x) => x.id === id);
909
- if (!row) return;
920
+ if (!row) return false;
921
+ if (attempt !== undefined && (row.state !== "queued" || (row.envelope_id ?? null) !== attempt)) return false;
910
922
  row.state = state;
911
923
  row.state_at = new Date().toISOString();
912
924
  if (envelopeId != null) row.envelope_id = envelopeId;
913
925
  row.reason = reason ? String(reason).slice(0, 200) : null;
914
926
  this._writeJsonObj("sendq", this.sendqPath, q);
927
+ return true;
928
+ }
929
+
930
+ /** 2.8.2 r3: Mailbox#claimGroupV2Attempt (a queued item that still names `expected`). */
931
+ claimGroupV2Attempt(id, expected, next) {
932
+ const q = this._readJsonObj("sendq", this.sendqPath, []);
933
+ const row = q.find((x) => x.id === id);
934
+ if (!row || row.state !== "queued" || (row.envelope_id ?? null) !== (expected ?? null)) return false;
935
+ row.envelope_id = next;
936
+ row.state_at = new Date().toISOString();
937
+ this._writeJsonObj("sendq", this.sendqPath, q);
938
+ return true;
915
939
  }
916
940
 
917
941
  // ── Readers & Leases ───────────────────────────────────────────────────────
@@ -1250,6 +1274,7 @@ export const LOCKED_METHODS = Object.freeze([
1250
1274
  "appendOutbound",
1251
1275
  "appendInbound",
1252
1276
  "markOutboundDelivered",
1277
+ "markOutboundSuperseded",
1253
1278
  "admitKnock",
1254
1279
  "markKnockAnswered",
1255
1280
  "markQuarantined",
@@ -1258,6 +1283,7 @@ export const LOCKED_METHODS = Object.freeze([
1258
1283
  "setInboundGroup",
1259
1284
  "enqueueGroupV2Sends",
1260
1285
  "markGroupV2Send",
1286
+ "claimGroupV2Attempt",
1261
1287
  "touchReader",
1262
1288
  "setReaderCursor",
1263
1289
  "holdLease",
@@ -497,7 +497,10 @@ export async function importRetiredMail(pillar, { now = new Date().toISOString()
497
497
  catch (e) { out.errors.push({ uuaid: r.uuaid, error: `archive key: ${e.message}` }); continue; }
498
498
  pillar.metrics?.inc?.("continuity.import.archive-key-load");
499
499
  out.keys++;
500
- const client = new CarrierClient({ keychain: kc, carriers: pillar.carriers });
500
+ const clientOpts = { keychain: kc, carriers: pillar.carriers };
501
+ // 2.8.2: a retired key's inbox auth follows the same trustedCarriers rule as the current key's.
502
+ if (pillar.trustedCarriers != null) clientOpts.trustedCarriers = pillar.trustedCarriers; // @t282 retired-trusted
503
+ const client = new CarrierClient(clientOpts);
501
504
  for (const base of pillar.carriers) {
502
505
  const key = `${base}#${r.uuaid}`;
503
506
  let since = r.cursors?.[base] ?? 0;
@@ -31,7 +31,7 @@ import {
31
31
  verifyStatsArtifact,
32
32
  } from "../registry/stats.mjs";
33
33
 
34
- export const VERIFY_CLI_TOOL = "pillar/2.8.1";
34
+ export const VERIFY_CLI_TOOL = "pillar/2.8.2";
35
35
  const TYPE_SET = new Set([...VERIFY_TYPES, TTFA_VERDICT_TYPE, REGISTRY_STATS_VERDICT_TYPE]);
36
36
 
37
37
  const VALUE_FLAGS = new Set([