@uuaid/pillar 2.8.0 → 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.
- package/HOSTING-LIMITS.md +32 -5
- package/README.md +196 -26
- package/bin/carrier.mjs +30 -23
- package/bin/pillar-directory.mjs +6 -4
- package/bin/pillar-seed.mjs +4 -2
- package/package.json +2 -1
- package/src/groups-v2-admin.mjs +3 -0
- package/src/groups-v2.mjs +198 -5
- package/src/mailbox/mailbox.mjs +30 -5
- package/src/net/carrier-client.mjs +109 -14
- package/src/net/carrier-server.mjs +98 -10
- package/src/net/discovery.mjs +31 -9
- package/src/net/inbox-auth.mjs +100 -0
- package/src/net/refusals.mjs +9 -0
- package/src/net/seed-registry.mjs +50 -14
- package/src/net/tunnel-relay.mjs +24 -14
- package/src/net/tunnel.mjs +6 -2
- package/src/pillar.mjs +324 -60
- package/src/registry/stats.mjs +1 -1
- package/src/send-permit.mjs +66 -0
- package/src/vnext/init-cli.mjs +2 -2
- package/src/vnext/json-dir-mailbox.mjs +2 -0
- package/src/vnext/jsonl-mailbox.mjs +28 -2
- package/src/vnext/retired-import.mjs +4 -1
- package/src/vnext/verify-cli.mjs +1 -1
package/src/vnext/init-cli.mjs
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
readRecoverySheetWords,
|
|
43
43
|
writeFileAtomic,
|
|
44
44
|
} from "./wave-a.mjs";
|
|
45
|
-
import { directoryCarriers, readBackCarriers, relayedCarriersIn } from "../net/discovery.mjs";
|
|
45
|
+
import { directoryCarriers, readBackCarriers, relayedCarriersIn, MAX_RELAYED_FROM_DIRECTORY } from "../net/discovery.mjs";
|
|
46
46
|
|
|
47
47
|
const INIT_VALUE_FLAGS = new Set([
|
|
48
48
|
"home",
|
|
@@ -181,7 +181,7 @@ function failInit(errOut, msg, exitCode = 1) {
|
|
|
181
181
|
*/
|
|
182
182
|
function carriersFromDirectory(d, errOut) {
|
|
183
183
|
const { carriers, skippedRelayed } = directoryCarriers(d);
|
|
184
|
-
if (skippedRelayed) errOut(`note: ${skippedRelayed} relayed seed URL(s) in the directory were not added
|
|
184
|
+
if (skippedRelayed) errOut(`note: ${skippedRelayed} relayed seed URL(s) in the directory were not added (no relay named for its URL, or past the first ${MAX_RELAYED_FROM_DIRECTORY}); name one with pillar init --carriers <url>\n`);
|
|
185
185
|
return carriers;
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -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
|
|
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
|
|
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;
|
package/src/vnext/verify-cli.mjs
CHANGED
|
@@ -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.
|
|
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([
|