@ghostlytools/cli 1.10.5 → 1.11.0
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/README.md +27 -22
- package/SKILL.md +8 -5
- package/dist/assets/api-B-52sVYp.js +3 -0
- package/dist/assets/{api-DppWqAP3.js → api-CTqIcdu7.js} +532 -197
- package/dist/assets/api-CTqIcdu7.js.map +1 -0
- package/dist/assets/{apiKit-DFIho4Ev.js → apiKit-CZq4Lq4f.js} +97 -13
- package/dist/assets/apiKit-CZq4Lq4f.js.map +1 -0
- package/dist/assets/{apps-yBnbEtfV.js → apps-C_X0zgSG.js} +16 -4
- package/dist/assets/apps-C_X0zgSG.js.map +1 -0
- package/dist/assets/{apps-1MkGMH8m.js → apps-kRsY9S2S.js} +1 -1
- package/dist/assets/{arkade-bFAS6imn.js → arkade-_aaB7VbW.js} +2 -2
- package/dist/assets/{arkade-bFAS6imn.js.map → arkade-_aaB7VbW.js.map} +1 -1
- package/dist/assets/{backup-ejIX59o7.js → backup-DBg388Ke.js} +1 -1
- package/dist/assets/{backup-vj4J7M3e.js → backup-OTvrmk-w.js} +35 -7
- package/dist/assets/backup-OTvrmk-w.js.map +1 -0
- package/dist/assets/{blobFiles-XZ9PEXYy.js → blobFiles-BmsrvZc3.js} +3 -3
- package/dist/assets/{blobFiles-XZ9PEXYy.js.map → blobFiles-BmsrvZc3.js.map} +1 -1
- package/dist/assets/buttons-4EKtQl-7.js +2 -0
- package/dist/assets/{buttons-BoDMx3Ky.js → buttons-DUu7hxxT.js} +61 -30
- package/dist/assets/buttons-DUu7hxxT.js.map +1 -0
- package/dist/assets/{client-BQArefYa.js → client-DDpZP1R1.js} +55 -10
- package/dist/assets/client-DDpZP1R1.js.map +1 -0
- package/dist/assets/{codec-_MwTUz5E.js → codec-DrryGcPT.js} +2 -2
- package/dist/assets/{codec-_MwTUz5E.js.map → codec-DrryGcPT.js.map} +1 -1
- package/dist/assets/{envelope-CeZBNGX-.js → envelope-Q_rMgoE9.js} +2 -2
- package/dist/assets/{envelope-CeZBNGX-.js.map → envelope-Q_rMgoE9.js.map} +1 -1
- package/dist/assets/{irohWeb-C_Wnw7Q9.js → fedimintSdk-CqTeMdF0.js} +2 -354
- package/dist/assets/fedimintSdk-CqTeMdF0.js.map +1 -0
- package/dist/assets/{fileBytes-DqnfKIkj.js → fileBytes-B0z9A6Le.js} +2 -2
- package/dist/assets/{fileBytes-DqnfKIkj.js.map → fileBytes-B0z9A6Le.js.map} +1 -1
- package/dist/assets/{fileBytes-BABGEF13.js → fileBytes-BLPZq9YU.js} +3 -3
- package/dist/assets/{fileBytes-BABGEF13.js.map → fileBytes-BLPZq9YU.js.map} +1 -1
- package/dist/assets/{fileBytes-CQQK2uOh.js → fileBytes-BtIyoDF2.js} +1 -1
- package/dist/assets/{fileBytesIdb-DrXmDUSy.js → fileBytesIdb-Bmlrl9EO.js} +3 -3
- package/dist/assets/{fileBytesIdb-DrXmDUSy.js.map → fileBytesIdb-Bmlrl9EO.js.map} +1 -1
- package/dist/assets/fileBytesIdb-D8mAK4pF.js +2 -0
- package/dist/assets/{fileBytesOpfs-udKCzcLe.js → fileBytesOpfs-DBS0kbPT.js} +3 -3
- package/dist/assets/{fileBytesOpfs-udKCzcLe.js.map → fileBytesOpfs-DBS0kbPT.js.map} +1 -1
- package/dist/assets/{fixedHosts-B_2Rvyja.js → fixedHosts-BV5GDiTU.js} +3 -3
- package/dist/assets/{fixedHosts-B_2Rvyja.js.map → fixedHosts-BV5GDiTU.js.map} +1 -1
- package/dist/assets/{host-DFLzzKNr.js → host-BlUzZgQL.js} +336 -84
- package/dist/assets/host-BlUzZgQL.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-CV6qMrom.js → hyperdhtRelay-BvI_uNZO.js} +2 -2
- package/dist/assets/{hyperdhtRelay-CV6qMrom.js.map → hyperdhtRelay-BvI_uNZO.js.map} +1 -1
- package/dist/assets/{idb-BHsAqENE.js → idb-CEuoNsTv.js} +16 -5
- package/dist/assets/idb-CEuoNsTv.js.map +1 -0
- package/dist/assets/{groupFiles-D-ZUUHrx.js → irohWeb-CqPN8VPY.js} +469 -16
- package/dist/assets/irohWeb-CqPN8VPY.js.map +1 -0
- package/dist/assets/{main-xO8MnXxD.js → main-vQjlgEnt.js} +409 -126
- package/dist/assets/main-vQjlgEnt.js.map +1 -0
- package/dist/assets/{mainline-Bx184Ixg.js → mainline-p6HOW7sb.js} +2 -2
- package/dist/assets/{mainline-Bx184Ixg.js.map → mainline-p6HOW7sb.js.map} +1 -1
- package/dist/assets/{networkReason-BlQhTbXk.js → networkReason-DMffkiJ6.js} +4 -4
- package/dist/assets/{networkReason-BlQhTbXk.js.map → networkReason-DMffkiJ6.js.map} +1 -1
- package/dist/assets/{nwc-B3-PHX0L.js → nwc-2vH18oNy.js} +4 -4
- package/dist/assets/nwc-2vH18oNy.js.map +1 -0
- package/dist/assets/{nwcProvider-BeQBPB2q.js → nwcProvider-DpeDy0bV.js} +11 -3
- package/dist/assets/nwcProvider-DpeDy0bV.js.map +1 -0
- package/dist/assets/{ownDid-DAzW-Urb.js → ownDid-iKz8u_fM.js} +2 -2
- package/dist/assets/{ownDid-DAzW-Urb.js.map → ownDid-iKz8u_fM.js.map} +1 -1
- package/dist/assets/{words-BvdNuw_v.js → ownStatus-BlRKnM5F.js} +56 -4
- package/dist/assets/ownStatus-BlRKnM5F.js.map +1 -0
- package/dist/assets/{profiles-Bg43mRXu.js → profiles-B5e0TyvS.js} +22 -12
- package/dist/assets/profiles-B5e0TyvS.js.map +1 -0
- package/dist/assets/{registry-CAk2-5BQ.js → registry-Cc_PQb3k.js} +1 -1
- package/dist/assets/{registry-BDnsZJBi.js → registry-CnFO2Pp5.js} +123 -99
- package/dist/assets/registry-CnFO2Pp5.js.map +1 -0
- package/dist/assets/{resolve-UAfshn6j.js → resolve-DI8uAM_Y.js} +2 -2
- package/dist/assets/{resolve-UAfshn6j.js.map → resolve-DI8uAM_Y.js.map} +1 -1
- package/dist/assets/{restoredRows-YhlbokEE.js → restoredRows-C3LcxmOw.js} +4 -4
- package/dist/assets/{restoredRows-YhlbokEE.js.map → restoredRows-C3LcxmOw.js.map} +1 -1
- package/dist/assets/{server-DYdR0_Fj.js → server-DdtPxkqI.js} +2057 -655
- package/dist/assets/server-DdtPxkqI.js.map +1 -0
- package/dist/assets/{src-BTRPAi5X.js → src-BnpEQqzk.js} +813 -144
- package/dist/assets/src-BnpEQqzk.js.map +1 -0
- package/dist/assets/{sshForges-KtHK5x1x.js → sshForges-cdIAraDw.js} +2 -2
- package/dist/assets/{sshForges-KtHK5x1x.js.map → sshForges-cdIAraDw.js.map} +1 -1
- package/dist/assets/{translate-CYuygrvA.js → translate-kNopA04L.js} +2 -2
- package/dist/assets/{translate-CYuygrvA.js.map → translate-kNopA04L.js.map} +1 -1
- package/dist/assets/{usdt-Dw9IENe_.js → usdt-CDaLhEYh.js} +3 -3
- package/dist/assets/{usdt-Dw9IENe_.js.map → usdt-CDaLhEYh.js.map} +1 -1
- package/dist/assets/{waitNotice-Ce3YCinu.js → waitNotice-Cn0WJ-He.js} +3 -1
- package/dist/assets/waitNotice-Cn0WJ-He.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/examples/claude-code-agent.sh +5 -0
- package/package.json +2 -2
- package/dist/assets/api-DppWqAP3.js.map +0 -1
- package/dist/assets/api-K-i5MrP-.js +0 -3
- package/dist/assets/apiKit-DFIho4Ev.js.map +0 -1
- package/dist/assets/apps-yBnbEtfV.js.map +0 -1
- package/dist/assets/backup-vj4J7M3e.js.map +0 -1
- package/dist/assets/buttons-BoDMx3Ky.js.map +0 -1
- package/dist/assets/buttons-DG1CKgAI.js +0 -2
- package/dist/assets/client-BQArefYa.js.map +0 -1
- package/dist/assets/fileBytesIdb-BtXATa7j.js +0 -2
- package/dist/assets/groupFiles-D-ZUUHrx.js.map +0 -1
- package/dist/assets/host-DFLzzKNr.js.map +0 -1
- package/dist/assets/idb-BHsAqENE.js.map +0 -1
- package/dist/assets/irohWeb-C_Wnw7Q9.js.map +0 -1
- package/dist/assets/main-xO8MnXxD.js.map +0 -1
- package/dist/assets/nwc-B3-PHX0L.js.map +0 -1
- package/dist/assets/nwcProvider-BeQBPB2q.js.map +0 -1
- package/dist/assets/profiles-Bg43mRXu.js.map +0 -1
- package/dist/assets/registry-BDnsZJBi.js.map +0 -1
- package/dist/assets/server-DYdR0_Fj.js.map +0 -1
- package/dist/assets/src-BTRPAi5X.js.map +0 -1
- package/dist/assets/waitNotice-Ce3YCinu.js.map +0 -1
- package/dist/assets/words-BvdNuw_v.js.map +0 -1
|
@@ -4751,7 +4751,7 @@ var codePoints = (s) => [...s].length;
|
|
|
4751
4751
|
/** Text of several lines: no control character but the line feed. */
|
|
4752
4752
|
var isText$2 = (v, max) => typeof v === "string" && codePoints(v) <= max && !/[^\P{Cc}\n]/u.test(v);
|
|
4753
4753
|
var isSafeCount = (v, min) => typeof v === "number" && Number.isSafeInteger(v) && v >= min;
|
|
4754
|
-
var isObject$
|
|
4754
|
+
var isObject$6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4755
4755
|
/**
|
|
4756
4756
|
* An https URL as WISP 1200 takes one anywhere: at most 512 characters, no user or password, and on jsDelivr only
|
|
4757
4757
|
* `https://cdn.jsdelivr.net/gh/<owner>/<repo>@<40-hex commit>/...`, since a branch, a tag, a range or `latest` is
|
|
@@ -4830,7 +4830,7 @@ var bad = (field, detail = `${field} is not valid`) => ({
|
|
|
4830
4830
|
* ignored unless `strict` (`AppManifestOptions`).
|
|
4831
4831
|
*/
|
|
4832
4832
|
function checkAppManifest(value, options = {}) {
|
|
4833
|
-
if (!isObject$
|
|
4833
|
+
if (!isObject$6(value)) return bad("manifest", "The manifest is not an object");
|
|
4834
4834
|
if (value.ghostlyApp !== void 0 && value.ghostlyApp !== 1) return {
|
|
4835
4835
|
ok: false,
|
|
4836
4836
|
reason: "unsupported-format",
|
|
@@ -4873,7 +4873,7 @@ function checkAppManifest(value, options = {}) {
|
|
|
4873
4873
|
if (!Array.isArray(permissions) || new Set(permissions).size !== permissions.length || !permissions.every((p) => APP_PERMISSIONS.includes(p))) return bad("permissions");
|
|
4874
4874
|
if (m.view !== void 0 && !APP_VIEWS.includes(m.view)) return bad("view", `view is "chat" or "full"`);
|
|
4875
4875
|
const runtime = m.runtime;
|
|
4876
|
-
if (!isObject$
|
|
4876
|
+
if (!isObject$6(runtime)) return bad("runtime");
|
|
4877
4877
|
for (const key of Object.keys(runtime)) {
|
|
4878
4878
|
if (key === "host" || key === "clients") continue;
|
|
4879
4879
|
if (options.strict) return {
|
|
@@ -4908,7 +4908,7 @@ function checkAppManifest(value, options = {}) {
|
|
|
4908
4908
|
let previous = "";
|
|
4909
4909
|
let screenshots = 0;
|
|
4910
4910
|
for (const f of files) {
|
|
4911
|
-
if (!isObject$
|
|
4911
|
+
if (!isObject$6(f) || Object.keys(f).length !== 3 || !isAppPath(f.path) || !isSafeCount(f.size, 0) || !isAppHash(f.sha256)) return isObject$6(f) && typeof f.path === "string" && !isAppPath(f.path) ? {
|
|
4912
4912
|
ok: false,
|
|
4913
4913
|
reason: "bad-path",
|
|
4914
4914
|
detail: f.path
|
|
@@ -4944,7 +4944,7 @@ function checkAppManifest(value, options = {}) {
|
|
|
4944
4944
|
};
|
|
4945
4945
|
}
|
|
4946
4946
|
const entry = m.entry;
|
|
4947
|
-
if (typeof entry !== "string" || !entry.endsWith(".html") || !files.some((f) => isObject$
|
|
4947
|
+
if (typeof entry !== "string" || !entry.endsWith(".html") || !files.some((f) => isObject$6(f) && f.path === entry)) return {
|
|
4948
4948
|
ok: false,
|
|
4949
4949
|
reason: "bad-entry",
|
|
4950
4950
|
detail: "The entry is not an .html file of the bundle"
|
|
@@ -6738,7 +6738,7 @@ function extractParamsFromSdp(sdp, { maxCandidates = 2, loopback = false, relayO
|
|
|
6738
6738
|
if (currentMedia === "a" && opus === null && /^opus/i.test(rtpmap[2])) opus = pt;
|
|
6739
6739
|
if (currentMedia === "v" && vp8 === null && /^VP8/i.test(rtpmap[2])) vp8 = pt;
|
|
6740
6740
|
}
|
|
6741
|
-
if (line.startsWith("a=candidate:")) candidates.push(line.substring(12));
|
|
6741
|
+
if (line.startsWith("a=candidate:") && line.split(" ")[1] === "1") candidates.push(line.substring(12));
|
|
6742
6742
|
if (line.startsWith("a=ssrc:")) {
|
|
6743
6743
|
const ssrcMatch = line.match(/^a=ssrc:(\d+)/);
|
|
6744
6744
|
if (ssrcMatch) {
|
|
@@ -8405,6 +8405,8 @@ var LinkSession = class {
|
|
|
8405
8405
|
upkeepOnly = false;
|
|
8406
8406
|
/** The last write this link asked for was a background one (`retryDelay`). */
|
|
8407
8407
|
wroteInBackground = false;
|
|
8408
|
+
/** The records built for a packet that did not go out, and what they say: a try again of the same reuses them (`publishOnce`). */
|
|
8409
|
+
unsent = null;
|
|
8408
8410
|
pollTimer = null;
|
|
8409
8411
|
heartbeatTimer = null;
|
|
8410
8412
|
lastActivity = Date.now();
|
|
@@ -8859,7 +8861,7 @@ var LinkSession = class {
|
|
|
8859
8861
|
this.wroteInBackground = options?.background === true;
|
|
8860
8862
|
const held = this.transport.publishHeld?.(this.identity.pubKeyZ32, options);
|
|
8861
8863
|
if (held) throw held;
|
|
8862
|
-
const
|
|
8864
|
+
const state = {
|
|
8863
8865
|
messages: this.sentBuffer,
|
|
8864
8866
|
ackTimestamp: this.myAck,
|
|
8865
8867
|
nick: this.nick,
|
|
@@ -8867,9 +8869,16 @@ var LinkSession = class {
|
|
|
8867
8869
|
rtcSignal,
|
|
8868
8870
|
services: advertise ? this.getServices() : void 0,
|
|
8869
8871
|
transports: advertise ? this.transports : null
|
|
8870
|
-
}
|
|
8872
|
+
};
|
|
8873
|
+
const says = JSON.stringify(state);
|
|
8874
|
+
const built = this.unsent?.says === says ? this.unsent.built : buildLinkRecords(this.identity.pubKeyZ32, state, this.encKey);
|
|
8875
|
+
this.unsent = {
|
|
8876
|
+
says,
|
|
8877
|
+
built
|
|
8878
|
+
};
|
|
8871
8879
|
keptMessages = built.keptMessages;
|
|
8872
8880
|
await this.transport.publish(this.identity, built.records, options);
|
|
8881
|
+
this.unsent = null;
|
|
8873
8882
|
} catch (error) {
|
|
8874
8883
|
const ms = Date.now() - started, waiting = isDiscoveryBudgetError(error);
|
|
8875
8884
|
traceLink(this.identity.pubKeyZ32, "publish", {
|
|
@@ -10621,8 +10630,8 @@ var sameButtonText = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase()
|
|
|
10621
10630
|
* them (one line, cleaned). `at` is the button that clashes, `with` the one it clashes with.
|
|
10622
10631
|
*/
|
|
10623
10632
|
function buttonLabelClash(buttons) {
|
|
10624
|
-
const labels = buttons.map((button) => isObject$
|
|
10625
|
-
const ids = buttons.map((button) => isObject$
|
|
10633
|
+
const labels = buttons.map((button) => isObject$5(button) ? cardLine(button.label, Infinity) : void 0);
|
|
10634
|
+
const ids = buttons.map((button) => isObject$5(button) && typeof button.id === "string" ? button.id : void 0);
|
|
10626
10635
|
for (const [at, label] of labels.entries()) {
|
|
10627
10636
|
if (!label) continue;
|
|
10628
10637
|
const twin = labels.findIndex((other, i) => i < at && !!other && sameButtonText(other, label));
|
|
@@ -10645,7 +10654,7 @@ function appCardId(ref) {
|
|
|
10645
10654
|
}
|
|
10646
10655
|
/** An app card's `sequence`: a whole number from 0 to 2^53 - 1. */
|
|
10647
10656
|
var appSequence = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
10648
|
-
var isObject$
|
|
10657
|
+
var isObject$5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10649
10658
|
/** One line of display text: runs of space (line breaks included) become one space, then the display rules for names. */
|
|
10650
10659
|
function cardLine(value, max) {
|
|
10651
10660
|
if (typeof value !== "string") return void 0;
|
|
@@ -10686,7 +10695,7 @@ function readLinks(raw) {
|
|
|
10686
10695
|
if (!Array.isArray(raw)) return [];
|
|
10687
10696
|
const links = [];
|
|
10688
10697
|
for (const entry of raw.slice(0, STATUS_CARD_LIMITS.links)) {
|
|
10689
|
-
if (!isObject$
|
|
10698
|
+
if (!isObject$5(entry)) continue;
|
|
10690
10699
|
const url = cardUrl(entry.url);
|
|
10691
10700
|
if (!url) continue;
|
|
10692
10701
|
const label = cardLine(entry.label, STATUS_CARD_LIMITS.linkLabel);
|
|
@@ -10709,7 +10718,7 @@ function readTags(raw) {
|
|
|
10709
10718
|
return tags;
|
|
10710
10719
|
}
|
|
10711
10720
|
function readRun(raw, now) {
|
|
10712
|
-
if (!isObject$
|
|
10721
|
+
if (!isObject$5(raw)) return void 0;
|
|
10713
10722
|
const at = time(raw.at, now + MESSAGE_CLOCK_SKEW_MS), result = oneOf(RUN_RESULTS, raw.result);
|
|
10714
10723
|
if (!at || !result) return void 0;
|
|
10715
10724
|
const summary = cardLine(raw.summary, STATUS_CARD_LIMITS.line);
|
|
@@ -10734,7 +10743,7 @@ function readUsage(raw, id, now) {
|
|
|
10734
10743
|
const resetsAt = ahead(raw.resetsAt, now), updatedAt = time(raw.updatedAt, now + MESSAGE_CLOCK_SKEW_MS);
|
|
10735
10744
|
const windows = [];
|
|
10736
10745
|
if (Array.isArray(raw.windows)) for (const entry of raw.windows.slice(0, STATUS_CARD_LIMITS.usageWindows)) {
|
|
10737
|
-
if (!isObject$
|
|
10746
|
+
if (!isObject$5(entry)) continue;
|
|
10738
10747
|
const name = cardLine(entry.window, STATUS_CARD_LIMITS.usageWindow), share = percent(entry.left);
|
|
10739
10748
|
if (!name || share === void 0) continue;
|
|
10740
10749
|
const at = ahead(entry.resetsAt, now);
|
|
@@ -10780,7 +10789,7 @@ function statusCardBytes(card) {
|
|
|
10780
10789
|
* routine's next run up to a year ahead). The message is always kept: without a card it shows its text.
|
|
10781
10790
|
*/
|
|
10782
10791
|
function readStatusCard(raw, now = Date.now()) {
|
|
10783
|
-
if (!isObject$
|
|
10792
|
+
if (!isObject$5(raw) || statusCardBytes(raw) > STATUS_CARD_LIMITS.bytes) return void 0;
|
|
10784
10793
|
const id = typeof raw.id === "string" && ID$4.test(raw.id) ? raw.id : void 0;
|
|
10785
10794
|
if (!id) return void 0;
|
|
10786
10795
|
if (raw.kind === "app") {
|
|
@@ -10819,7 +10828,7 @@ function readStatusCard(raw, now = Date.now()) {
|
|
|
10819
10828
|
if (done === void 0 || total === void 0 || done > total) done = total = void 0;
|
|
10820
10829
|
const step = cardLine(raw.step, STATUS_CARD_LIMITS.line), branch = cardLine(raw.branch, STATUS_CARD_LIMITS.branch);
|
|
10821
10830
|
let pr;
|
|
10822
|
-
if (isObject$
|
|
10831
|
+
if (isObject$5(raw.pr)) {
|
|
10823
10832
|
const url = cardUrl(raw.pr.url);
|
|
10824
10833
|
if (url) {
|
|
10825
10834
|
const number = count(raw.pr.number, 1), additions = count(raw.pr.additions), deletions = count(raw.pr.deletions), files = count(raw.pr.files);
|
|
@@ -10837,7 +10846,7 @@ function readStatusCard(raw, now = Date.now()) {
|
|
|
10837
10846
|
}
|
|
10838
10847
|
const items = [];
|
|
10839
10848
|
if (Array.isArray(raw.items)) for (const entry of raw.items.slice(0, STATUS_CARD_LIMITS.items)) {
|
|
10840
|
-
if (!isObject$
|
|
10849
|
+
if (!isObject$5(entry)) continue;
|
|
10841
10850
|
const text = cardLine(entry.text, STATUS_CARD_LIMITS.line);
|
|
10842
10851
|
if (text) items.push({
|
|
10843
10852
|
text,
|
|
@@ -10896,7 +10905,7 @@ function readStatusCard(raw, now = Date.now()) {
|
|
|
10896
10905
|
if (!Array.isArray(raw.buttons)) return void 0;
|
|
10897
10906
|
const buttons = [], seen = /* @__PURE__ */ new Set();
|
|
10898
10907
|
for (const entry of raw.buttons.slice(0, STATUS_CARD_LIMITS.buttons)) {
|
|
10899
|
-
if (!isObject$
|
|
10908
|
+
if (!isObject$5(entry) || typeof entry.id !== "string" || !BUTTON_ID.test(entry.id) || seen.has(entry.id)) continue;
|
|
10900
10909
|
const label = cardLine(entry.label, STATUS_CARD_LIMITS.buttonLabel);
|
|
10901
10910
|
if (!label) continue;
|
|
10902
10911
|
seen.add(entry.id);
|
|
@@ -10925,7 +10934,7 @@ function readStatusCard(raw, now = Date.now()) {
|
|
|
10925
10934
|
* at once and nothing it said is lost on the way. Line breaks and invisible characters are cleaned, as a reader would.
|
|
10926
10935
|
*/
|
|
10927
10936
|
function checkStatusCard(raw, now = Date.now()) {
|
|
10928
|
-
if (!isObject$
|
|
10937
|
+
if (!isObject$5(raw)) return { error: "A card is an object" };
|
|
10929
10938
|
const bytes = statusCardBytes(raw);
|
|
10930
10939
|
if (bytes > STATUS_CARD_LIMITS.bytes) return { error: `The card takes ${bytes} bytes; at most ${STATUS_CARD_LIMITS.bytes}` };
|
|
10931
10940
|
if (raw.kind !== "task" && raw.kind !== "routine" && raw.kind !== "buttons" && raw.kind !== "app" && raw.kind !== "usage" && raw.kind !== "removed") return { error: "kind is task, routine, buttons, app, usage or removed" };
|
|
@@ -10942,7 +10951,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
10942
10951
|
if (raw.links !== void 0) {
|
|
10943
10952
|
if (!Array.isArray(raw.links) || raw.links.length > STATUS_CARD_LIMITS.links) errors.push(`links is a list of at most ${STATUS_CARD_LIMITS.links}`);
|
|
10944
10953
|
else for (const [i, link] of raw.links.entries()) {
|
|
10945
|
-
if (!isObject$
|
|
10954
|
+
if (!isObject$5(link)) {
|
|
10946
10955
|
errors.push(`links[${i}] is an object`);
|
|
10947
10956
|
continue;
|
|
10948
10957
|
}
|
|
@@ -10969,7 +10978,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
10969
10978
|
if (raw.windows !== void 0) {
|
|
10970
10979
|
if (!Array.isArray(raw.windows) || raw.windows.length > STATUS_CARD_LIMITS.usageWindows) errors.push(`windows is a list of at most ${STATUS_CARD_LIMITS.usageWindows}`);
|
|
10971
10980
|
else for (const [i, entry] of raw.windows.entries()) {
|
|
10972
|
-
if (!isObject$
|
|
10981
|
+
if (!isObject$5(entry)) {
|
|
10973
10982
|
errors.push(`windows[${i}] is an object`);
|
|
10974
10983
|
continue;
|
|
10975
10984
|
}
|
|
@@ -10992,7 +11001,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
10992
11001
|
else {
|
|
10993
11002
|
const ids = /* @__PURE__ */ new Set();
|
|
10994
11003
|
for (const [i, button] of raw.buttons.entries()) {
|
|
10995
|
-
if (!isObject$
|
|
11004
|
+
if (!isObject$5(button)) {
|
|
10996
11005
|
errors.push(`buttons[${i}] is an object`);
|
|
10997
11006
|
continue;
|
|
10998
11007
|
}
|
|
@@ -11019,7 +11028,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
11019
11028
|
}
|
|
11020
11029
|
errors.push(line("step", raw.step, STATUS_CARD_LIMITS.line), line("branch", raw.branch, STATUS_CARD_LIMITS.branch));
|
|
11021
11030
|
if (raw.pr !== void 0) {
|
|
11022
|
-
if (!isObject$
|
|
11031
|
+
if (!isObject$5(raw.pr)) errors.push("pr is an object");
|
|
11023
11032
|
else {
|
|
11024
11033
|
errors.push(url("pr.url", raw.pr.url), whole("pr.number", raw.pr.number, 1), whole("pr.additions", raw.pr.additions), whole("pr.deletions", raw.pr.deletions), whole("pr.files", raw.pr.files));
|
|
11025
11034
|
if (raw.pr.state !== void 0 && !oneOf(PR_STATES, raw.pr.state)) errors.push(`pr.state is one of ${PR_STATES.join(", ")}`);
|
|
@@ -11051,7 +11060,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
11051
11060
|
if (raw.items !== void 0) {
|
|
11052
11061
|
if (!Array.isArray(raw.items) || raw.items.length > STATUS_CARD_LIMITS.items) errors.push(`items is a list of at most ${STATUS_CARD_LIMITS.items}`);
|
|
11053
11062
|
else for (const [i, item] of raw.items.entries()) {
|
|
11054
|
-
if (!isObject$
|
|
11063
|
+
if (!isObject$5(item)) {
|
|
11055
11064
|
errors.push(`items[${i}] is an object`);
|
|
11056
11065
|
continue;
|
|
11057
11066
|
}
|
|
@@ -11065,7 +11074,7 @@ function checkStatusCard(raw, now = Date.now()) {
|
|
|
11065
11074
|
if (raw.cron !== void 0 && !(typeof raw.cron === "string" && CRON_LINE.test(raw.cron.trim()))) errors.push(`cron is a cron line of at most ${STATUS_CARD_LIMITS.cron} characters`);
|
|
11066
11075
|
if (raw.nextRunAt !== void 0 && !(typeof raw.nextRunAt === "number" && Number.isSafeInteger(raw.nextRunAt) && raw.nextRunAt > 0 && raw.nextRunAt <= now + STATUS_CARD_LIMITS.nextRunMs)) errors.push("nextRunAt is a time in milliseconds, within a year");
|
|
11067
11076
|
const run = (field, value) => {
|
|
11068
|
-
if (!isObject$
|
|
11077
|
+
if (!isObject$5(value)) return errors.push(`${field} is an object`);
|
|
11069
11078
|
if (!(typeof value.at === "number" && Number.isSafeInteger(value.at) && value.at > 0 && value.at <= now + 3e5)) errors.push(`${field}.at is a time in milliseconds, not in the future`);
|
|
11070
11079
|
if (!oneOf(RUN_RESULTS, value.result)) errors.push(`${field}.result is one of ${RUN_RESULTS.join(", ")}`);
|
|
11071
11080
|
errors.push(line(`${field}.summary`, value.summary, STATUS_CARD_LIMITS.line));
|
|
@@ -11191,14 +11200,41 @@ var REPLY_ID = /^[A-Za-z0-9_:.-]{1,128}$/;
|
|
|
11191
11200
|
var PAIRED_REPLY_AUTHORS = ["sender", "recipient"];
|
|
11192
11201
|
/** A picture sent inline has no line worth quoting. */
|
|
11193
11202
|
var INLINE_PICTURE = /^data:image\//i;
|
|
11194
|
-
/**
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11203
|
+
/** What a spoiler reads as in a line of it: nothing of what it hides (the chat list's `SPOILER_PLAIN` in apps/ui). */
|
|
11204
|
+
var SPOILER_COVER = "▒▒▒";
|
|
11205
|
+
var PIPES = /\|{2,}/gu;
|
|
11206
|
+
var SPACE$1 = /\s/u;
|
|
11207
|
+
var PUNCT = /[\p{P}\p{S}]/u;
|
|
11208
|
+
/**
|
|
11209
|
+
* A line of text with its spoilers (`||hidden||`, WISP 400 § Formatting) as `SPOILER_COVER`. The bubble's parser
|
|
11210
|
+
* (apps/ui lib/parse) is not here, so this covers at least what it hides: from the first `||` on the line that may
|
|
11211
|
+
* open one to the last that may close one, by the parser's word-edge rules without its exceptions. Two spoilers on a
|
|
11212
|
+
* line read as one, with the words between them. `open`: the line goes on past this text, so a spoiler opened on it
|
|
11213
|
+
* runs to its end.
|
|
11214
|
+
*/
|
|
11215
|
+
function coverSpoilers(line, open) {
|
|
11216
|
+
let start = -1, end = -1;
|
|
11217
|
+
for (const run of line.matchAll(PIPES)) {
|
|
11218
|
+
const at = run.index, after = line[at + run[0].length], before = line[at - 1];
|
|
11219
|
+
const long = run[0].length > 2;
|
|
11220
|
+
if (start < 0) {
|
|
11221
|
+
if (long || after !== void 0 && !SPACE$1.test(after) && (before === void 0 || SPACE$1.test(before) || PUNCT.test(before))) start = at;
|
|
11222
|
+
} else if (long || before !== void 0 && !SPACE$1.test(before) && (after === void 0 || SPACE$1.test(after) || PUNCT.test(after))) end = at + run[0].length;
|
|
11223
|
+
}
|
|
11224
|
+
if (start < 0) return line;
|
|
11225
|
+
if (open) return line.slice(0, start) + SPOILER_COVER;
|
|
11226
|
+
return end < 0 ? line : line.slice(0, start) + SPOILER_COVER + line.slice(end);
|
|
11227
|
+
}
|
|
11228
|
+
/**
|
|
11229
|
+
* A line of a message to quote: plain text on one line (line breaks and runs of spaces become one space), its
|
|
11230
|
+
* spoilers covered, without control, invisible or direction characters (WISP 400, as for names), at most
|
|
11231
|
+
* `REPLY_LIMITS.snippet` code points, the last of them an ellipsis when it was cut.
|
|
11198
11232
|
*/
|
|
11199
11233
|
function replySnippet(text) {
|
|
11200
11234
|
if (INLINE_PICTURE.test(text.trimStart())) return "🖼️ Picture";
|
|
11201
|
-
const
|
|
11235
|
+
const head = text.slice(0, REPLY_LIMITS.raw * 2);
|
|
11236
|
+
const lines = head.split("\n");
|
|
11237
|
+
const clean = sanitizeDisplayText(lines.map((line, i) => coverSpoilers(line, head.length < text.length && i === lines.length - 1)).join("\n").replace(/\s+/gu, " "), REPLY_LIMITS.snippet + 1) ?? "";
|
|
11202
11238
|
const points = [...clean];
|
|
11203
11239
|
return points.length > REPLY_LIMITS.snippet ? `${points.slice(0, REPLY_LIMITS.snippet - 1).join("").trimEnd()}…` : clean;
|
|
11204
11240
|
}
|
|
@@ -12256,11 +12292,23 @@ var MAX_ATTEMPTS = 8;
|
|
|
12256
12292
|
* nothing; one the budget turned away is not used again, as it may have gone out on the DHT (the CLI puts there too).
|
|
12257
12293
|
*/
|
|
12258
12294
|
var SEQUENCE_BLOCK = 64;
|
|
12295
|
+
/** The longest the relays' request budget holds publications back (`budgetUntil`). */
|
|
12296
|
+
var BUDGET_HOLD_MAX_MS = 6e4;
|
|
12297
|
+
/** The longest wait `backoff` gives. */
|
|
12298
|
+
var BACKOFF_MAX_MS = 6e4;
|
|
12259
12299
|
/** The wait before publication attempt `attempts + 1` of a text, or of a receipt the contact still asks for. */
|
|
12260
|
-
var backoff = (attempts) => Math.min(
|
|
12300
|
+
var backoff = (attempts) => Math.min(BACKOFF_MAX_MS, 4e3 * 2 ** attempts);
|
|
12301
|
+
/**
|
|
12302
|
+
* A time this side set by its clock, at most `ms` after the moment it was set, read back `now`. One further ahead was set
|
|
12303
|
+
* before the device clock went back (an NTP step, a clock that ran ahead set right): it counts from now, not for as long
|
|
12304
|
+
* as the clock went back, as `relay.ts` counts its budget times. One already past (the clock set forward) stays past:
|
|
12305
|
+
* what it timed ends early, never late.
|
|
12306
|
+
*/
|
|
12307
|
+
var bounded = (at, now, ms = 0) => Math.min(at, now + ms);
|
|
12261
12308
|
/**
|
|
12262
|
-
* The contact's mailbox is read this often while this side is DHT-only
|
|
12263
|
-
*
|
|
12309
|
+
* The contact's mailbox is read this often while this side is DHT-only, unless that contact is away with nothing of
|
|
12310
|
+
* ours waiting on it (`dhtOnlyIdle`; a contact that chose it is read at the chat's pace: `ACTIVE_DHT_POLL_MS` open,
|
|
12311
|
+
* or on a daemon, `peerDhtPollMs`), and otherwise…
|
|
12264
12312
|
*/
|
|
12265
12313
|
var DHT_POLL_MS = 4e3;
|
|
12266
12314
|
var STREAM_POLL_MS = 3e4;
|
|
@@ -12762,6 +12810,41 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12762
12810
|
if (active && !this.live) this.tick();
|
|
12763
12811
|
else this.schedule();
|
|
12764
12812
|
}
|
|
12813
|
+
/**
|
|
12814
|
+
* The device clock now, with every time this side set by it kept no further ahead than it is ever set (`bounded`).
|
|
12815
|
+
* The outbox times a text's receipt on a timer, which a step of the clock does not move; these times are judged by
|
|
12816
|
+
* the clock. Taken as they were, a clock set back an hour (or one an hour ahead set right) while a text awaited its
|
|
12817
|
+
* receipt held every later text of the chat for that hour though the outbox showed the text failed at five minutes,
|
|
12818
|
+
* the text was not published again meanwhile and the chat read every 4 s; and a contact away counted as there, its
|
|
12819
|
+
* mailbox read every 4 s for most of the hour (bug hunt, 2026-11-08). Kept so in memory; the next save writes them.
|
|
12820
|
+
*/
|
|
12821
|
+
clock() {
|
|
12822
|
+
const now = Date.now(), { pending, receipt } = this.state;
|
|
12823
|
+
if (pending && (pending.expires > now + 3e5 || pending.next > now + BACKOFF_MAX_MS)) this.state = {
|
|
12824
|
+
...this.state,
|
|
12825
|
+
pending: {
|
|
12826
|
+
...pending,
|
|
12827
|
+
expires: bounded(pending.expires, now, DHT_MESSAGE_TTL),
|
|
12828
|
+
next: bounded(pending.next, now, BACKOFF_MAX_MS)
|
|
12829
|
+
}
|
|
12830
|
+
};
|
|
12831
|
+
if (receipt && (receipt.expires > now + 3e5 || (receipt.next ?? 0) > now + BACKOFF_MAX_MS)) this.state = {
|
|
12832
|
+
...this.state,
|
|
12833
|
+
receipt: {
|
|
12834
|
+
...receipt,
|
|
12835
|
+
expires: bounded(receipt.expires, now, DHT_MESSAGE_TTL),
|
|
12836
|
+
...receipt.next !== void 0 && { next: bounded(receipt.next, now, BACKOFF_MAX_MS) }
|
|
12837
|
+
}
|
|
12838
|
+
};
|
|
12839
|
+
this.peerNewAt = bounded(this.peerNewAt, now);
|
|
12840
|
+
this.lastPublish = bounded(this.lastPublish, now);
|
|
12841
|
+
this.networkBackAt = bounded(this.networkBackAt, now);
|
|
12842
|
+
this.pinnedProbeAt = bounded(this.pinnedProbeAt, now);
|
|
12843
|
+
this.controlDue = bounded(this.controlDue, now, Math.max(24e4, UNUSED_INVITE_UPKEEP_MS, this.options.firstControlAfterMs ?? 0));
|
|
12844
|
+
this.budgetUntil = bounded(this.budgetUntil, now, BUDGET_HOLD_MAX_MS);
|
|
12845
|
+
this.leavingUntil = bounded(this.leavingUntil, now, LEAVING_DHT_FAST_MS);
|
|
12846
|
+
return now;
|
|
12847
|
+
}
|
|
12765
12848
|
validate(text, timestamp, id, reply, edit) {
|
|
12766
12849
|
if (this.options.peerAcceptsText?.() === false) return DHT_TEXT_REFUSED;
|
|
12767
12850
|
if (this.forwardSecrecy === "stopped") return DHT_RATCHET_STOPPED;
|
|
@@ -12769,7 +12852,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12769
12852
|
if (edit !== void 0 && (reply !== void 0 || !ID$2.test(edit[0]) || !validEditNumber(edit[1]))) return "Invalid message.";
|
|
12770
12853
|
if (utf8Encode(text).length > 256) return DHT_TEXT_TOO_LONG;
|
|
12771
12854
|
if (/cashu[AB][A-Za-z0-9_-]+/i.test(text)) return "Payment tokens cannot be sent through DHT delivery.";
|
|
12772
|
-
const now =
|
|
12855
|
+
const now = this.clock(), pending = this.state.pending;
|
|
12773
12856
|
if (pending && pending.expires > now && pending.message[0] !== id) return "One DHT text can await a receipt at a time. Wait for its receipt or expiry before sending another.";
|
|
12774
12857
|
if (pending?.message[0] === id && pending.expires > now && pending.attempts >= MAX_ATTEMPTS) return "DHT retry budget exhausted. Wait for expiry before retrying this message.";
|
|
12775
12858
|
const next = pending?.message[0] === id && pending.expires > now ? pending : {
|
|
@@ -12955,8 +13038,8 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12955
13038
|
}
|
|
12956
13039
|
/** The id of what awaits its receipt on the floor now, if anything does. */
|
|
12957
13040
|
get pendingId() {
|
|
12958
|
-
const pending = this.state.pending;
|
|
12959
|
-
return pending && pending.expires >
|
|
13041
|
+
const now = this.clock(), pending = this.state.pending;
|
|
13042
|
+
return pending && pending.expires > now && pending.attempts < MAX_ATTEMPTS ? pending.message[0] : void 0;
|
|
12960
13043
|
}
|
|
12961
13044
|
/**
|
|
12962
13045
|
* This side's capability record has a new revision (WISP 03): an envelope names it now. Otherwise the contact
|
|
@@ -12967,7 +13050,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
12967
13050
|
await this.serialize(async () => {
|
|
12968
13051
|
const rev = this.options.capsRev?.();
|
|
12969
13052
|
if (rev === void 0 || rev === this.namedRev) return;
|
|
12970
|
-
const wait = this.lastPublish + 4e3 -
|
|
13053
|
+
const wait = this.lastPublish + 4e3 - this.clock();
|
|
12971
13054
|
if (wait > 0) {
|
|
12972
13055
|
this.announceTimer ??= setTimeout(() => {
|
|
12973
13056
|
this.announceTimer = null;
|
|
@@ -13062,7 +13145,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
13062
13145
|
};
|
|
13063
13146
|
}
|
|
13064
13147
|
async publish(force = false) {
|
|
13065
|
-
const now =
|
|
13148
|
+
const now = this.clock();
|
|
13066
13149
|
if (!this.running || !force && (now - this.lastPublish < 4e3 || now < this.budgetUntil)) return;
|
|
13067
13150
|
const pending = this.state.pending && this.state.pending.expires > now && this.state.pending.attempts < MAX_ATTEMPTS ? this.state.pending : void 0;
|
|
13068
13151
|
const receipt = this.state.receipt && this.state.receipt.expires > now && this.state.receipt.attempts < MAX_ATTEMPTS ? this.state.receipt : void 0;
|
|
@@ -13141,7 +13224,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
13141
13224
|
* receipt as they were before, and no publication before then (`budgetUntil`) but a forced one.
|
|
13142
13225
|
*/
|
|
13143
13226
|
async heldBack(error, now, before, pending, receipt) {
|
|
13144
|
-
const at = now + budgetRetryMs(error, 1e3,
|
|
13227
|
+
const at = now + budgetRetryMs(error, 1e3, BUDGET_HOLD_MAX_MS);
|
|
13145
13228
|
this.budgetUntil = at;
|
|
13146
13229
|
this.lastPublish = before.lastPublish;
|
|
13147
13230
|
this.controlDue = Math.min(before.controlDue, at);
|
|
@@ -13528,15 +13611,29 @@ var DhtDelivery = class DhtDelivery {
|
|
|
13528
13611
|
if (this.options.pollMs) return this.options.pollMs;
|
|
13529
13612
|
const taken = this.takenInviteWait();
|
|
13530
13613
|
if (taken !== void 0) return taken;
|
|
13531
|
-
const now =
|
|
13614
|
+
const now = this.clock();
|
|
13532
13615
|
const unused = this.running ? this.unusedInviteAge(now) : void 0;
|
|
13533
13616
|
const readers = countUnusedInvite(this.options.transport, this, unused !== void 0 && !this.active && now >= this.fastUntil);
|
|
13534
13617
|
if (unused !== void 0 && !this.active && now >= this.fastUntil) return unusedInviteWait(unused, this.mode === "dht" ? DHT_POLL_MS : STREAM_POLL_MS, readers);
|
|
13535
|
-
if (this.mode === "dht" || this.state.peerMode === "dht" && now < this.leavingUntil || now < this.fastUntil) return DHT_POLL_MS;
|
|
13618
|
+
if (this.mode === "dht" && !this.dhtOnlyIdle(now) || this.state.peerMode === "dht" && now < this.leavingUntil || now < this.fastUntil) return DHT_POLL_MS;
|
|
13536
13619
|
if (this.live) return LIVE_POLL_MS;
|
|
13537
13620
|
if (this.state.pending && this.state.pending.expires > now) return DHT_POLL_MS;
|
|
13538
13621
|
if (this.active) return ACTIVE_DHT_POLL_MS;
|
|
13539
|
-
|
|
13622
|
+
const there = now - this.peerNewAt < PRESENCE_WINDOW;
|
|
13623
|
+
return this.state.peerMode === "dht" && this.options.peerDhtPollMs && there ? Math.min(this.options.peerDhtPollMs, STREAM_POLL_MS) : STREAM_POLL_MS;
|
|
13624
|
+
}
|
|
13625
|
+
/**
|
|
13626
|
+
* This side is DHT only, and nothing waits on the contact's mailbox: the contact, pinned, is away (nothing new of its
|
|
13627
|
+
* own in `PRESENCE_WINDOW`; it puts a keep-alive every four minutes while there), no text of ours awaits its receipt,
|
|
13628
|
+
* and the chat is not on screen. Its mailbox is then read at the background pace, as background reads, not every 4 s:
|
|
13629
|
+
* a daemon with 50 such chats looked each contact up on the Mainline DHT every ~3 s, 1,081 lookups a minute for as
|
|
13630
|
+
* long as it ran, since its relays' budget held those reads and a held read nobody marked background goes to the DHT.
|
|
13631
|
+
* The contact's next envelope (its first on coming back, or a text) is read at the next of those reads, and the
|
|
13632
|
+
* 4 s pace is back from there. Just started, a contact there is read so until its next envelope too.
|
|
13633
|
+
*/
|
|
13634
|
+
dhtOnlyIdle(now) {
|
|
13635
|
+
if (this.active || !this.options.credentials.peerKey || now - this.peerNewAt < 6e5) return false;
|
|
13636
|
+
return !(this.state.pending && this.state.pending.expires > now);
|
|
13540
13637
|
}
|
|
13541
13638
|
/**
|
|
13542
13639
|
* How long ago this side's invite was made (or joined), while nobody used it (or its inviter never answered,
|
|
@@ -13562,7 +13659,7 @@ var DhtDelivery = class DhtDelivery {
|
|
|
13562
13659
|
schedule() {
|
|
13563
13660
|
if (!this.running || this.ticking) return;
|
|
13564
13661
|
if (this.timer) clearTimeout(this.timer);
|
|
13565
|
-
const held = this.budgetUntil -
|
|
13662
|
+
const held = this.budgetUntil - this.clock();
|
|
13566
13663
|
const due = this.reactionsDue || this.resealDue && !this.errors.publish ? Math.max(0, this.lastPublish + 4e3 - Date.now(), held) : Infinity;
|
|
13567
13664
|
const readHeld = this.readHeldUntil > 0 ? Math.max(1e3, this.readHeldUntil - Date.now()) : Infinity;
|
|
13568
13665
|
this.timer = setTimeout(() => void this.tick(), Math.min(held > 0 ? Math.min(this.pollMs, held) : this.pollMs, due, readHeld));
|
|
@@ -14656,17 +14753,28 @@ function relayedTransports(local, remote) {
|
|
|
14656
14753
|
/** Symmetric rank sum; the fixed order breaks ties deterministically. Neither
|
|
14657
14754
|
* a remote list nor a preference can add an unavailable local adapter. A
|
|
14658
14755
|
* relayed transport ranks after every direct one: it is where a failed direct
|
|
14659
|
-
* path goes, never ahead of one that works.
|
|
14756
|
+
* path goes, never ahead of one that works. Iroh through its relay is the
|
|
14757
|
+
* exception (WISP 100, revision 2026-11-08): it comes back almost at once after
|
|
14758
|
+
* the app was away, and a browser's Iroh is never anything else. */
|
|
14660
14759
|
function rankTransports(local, remote, relayed = []) {
|
|
14661
|
-
const penalty = (t) => relayed.includes(t) ? 1 : 0;
|
|
14760
|
+
const penalty = (t) => t !== "iroh/1" && relayed.includes(t) ? 1 : 0;
|
|
14662
14761
|
return TRANSPORTS.filter((t) => local.includes(t) && remote.includes(t)).sort((a, b) => penalty(a) - penalty(b) || local.indexOf(a) + remote.indexOf(a) - (local.indexOf(b) + remote.indexOf(b)) || TRANSPORTS.indexOf(a) - TRANSPORTS.indexOf(b));
|
|
14663
14762
|
}
|
|
14664
14763
|
/**
|
|
14665
|
-
* What a chat prefers when nobody chose (Automatic):
|
|
14666
|
-
*
|
|
14764
|
+
* What a chat prefers when nobody chose (Automatic): Iroh where the app has it, then WebRTC, then HyperDHT (WISP 100,
|
|
14765
|
+
* revision 2026-11-08). Every app puts Iroh first, so the rank sum of two apps that both run it puts it first on both
|
|
14766
|
+
* sides. With nothing at all, WebRTC, which the offer then leaves out.
|
|
14767
|
+
* With Fallback off the chat may use only that one transport, and nothing moves it off a relayed Iroh then: WebRTC
|
|
14768
|
+
* where the app has it, else the first transport it has (a Linux Desktop: WebKitGTK has no WebRTC), as before.
|
|
14667
14769
|
*/
|
|
14668
|
-
|
|
14669
|
-
|
|
14770
|
+
var AUTOMATIC_ORDER = [
|
|
14771
|
+
"iroh/1",
|
|
14772
|
+
"webrtc/1",
|
|
14773
|
+
"hyperdht/1"
|
|
14774
|
+
];
|
|
14775
|
+
function automaticTransport(available, fallback = true) {
|
|
14776
|
+
if (!fallback) return available.includes("webrtc/1") ? "webrtc/1" : TRANSPORTS.find((t) => available.includes(t)) ?? "webrtc/1";
|
|
14777
|
+
return AUTOMATIC_ORDER.find((t) => available.includes(t)) ?? "webrtc/1";
|
|
14670
14778
|
}
|
|
14671
14779
|
function transportOrder(available, preferred, fallback) {
|
|
14672
14780
|
const rest = TRANSPORTS.filter((t) => available.includes(t) && t !== preferred);
|
|
@@ -14674,6 +14782,8 @@ function transportOrder(available, preferred, fallback) {
|
|
|
14674
14782
|
}
|
|
14675
14783
|
var POLICY_RECEIVE_WINDOW_MS = 6e4;
|
|
14676
14784
|
var allowedTransports = (policy) => transportOrder(policy.available, policy.preferred, policy.fallback);
|
|
14785
|
+
/** The first ranked transport that is not relayed. */
|
|
14786
|
+
var directFirst = (ranked, relayed) => ranked.find((t) => !relayed.includes(t));
|
|
14677
14787
|
function parsePolicy(raw) {
|
|
14678
14788
|
if (!raw || typeof raw !== "object") return null;
|
|
14679
14789
|
const p = raw;
|
|
@@ -14751,7 +14861,7 @@ var TransportSwitch = class {
|
|
|
14751
14861
|
if (!this.context || !this.remote) return void 0;
|
|
14752
14862
|
const local = this.local(), remote = this.remote, winner = this.winner(local, remote);
|
|
14753
14863
|
return {
|
|
14754
|
-
transport: this.choices(local, remote)[0] ?? winner.preferred,
|
|
14864
|
+
transport: (this.isUpgrade(local, remote) ? this.actual : void 0) ?? this.choices(local, remote)[0] ?? winner.preferred,
|
|
14755
14865
|
...winner.intent > 0 ? { by: winner === local ? "you" : "contact" } : {}
|
|
14756
14866
|
};
|
|
14757
14867
|
}
|
|
@@ -14945,12 +15055,17 @@ var TransportSwitch = class {
|
|
|
14945
15055
|
const ranked = rankTransports(allowedTransports(local), allowedTransports(remote), relayed);
|
|
14946
15056
|
if (!ranked.length) return [];
|
|
14947
15057
|
const winner = this.winner(local, remote);
|
|
14948
|
-
const target = this.upgrading(winner, ranked, relayed) ? ranked
|
|
15058
|
+
const target = this.upgrading(winner, ranked, relayed) ? directFirst(ranked, relayed) : winner.intent === 0 && this.actual && ranked.includes(this.actual) ? this.actual : ranked.includes(winner.preferred) ? winner.preferred : ranked[0];
|
|
14949
15059
|
return [target, ...local.fallback && remote.fallback ? ranked.filter((t) => t !== target) : []];
|
|
14950
15060
|
}
|
|
14951
|
-
/**
|
|
15061
|
+
/**
|
|
15062
|
+
* Nobody chose, the session is on a relayed transport, a direct one is ranked, and both sides move (`upgrade/1`). The
|
|
15063
|
+
* first direct one, not the first ranked: Iroh through its relay ranks first so that a chat comes back over it at once
|
|
15064
|
+
* (WISP 100, revision 2026-11-08), and the session then moves to the direct path, which carries files many times faster.
|
|
15065
|
+
*/
|
|
14952
15066
|
upgrading(winner, ranked, relayed) {
|
|
14953
|
-
|
|
15067
|
+
const direct = directFirst(ranked, relayed);
|
|
15068
|
+
return winner.intent === 0 && !!this.actual && relayed.includes(this.actual) && ranked.includes(this.actual) && !!direct && direct !== this.actual && !!this.options.upgrade?.();
|
|
14954
15069
|
}
|
|
14955
15070
|
isUpgrade(local, remote) {
|
|
14956
15071
|
const relayed = relayedTransports(local.descriptors, remote.descriptors);
|
|
@@ -15644,7 +15759,8 @@ function applyIdentityEvent(timeline, event, at) {
|
|
|
15644
15759
|
reason: event.reason
|
|
15645
15760
|
});
|
|
15646
15761
|
break;
|
|
15647
|
-
case "unsent":
|
|
15762
|
+
case "unsent":
|
|
15763
|
+
case "unanswered": if (last?.kind === "shared" && last.state === "verifying") out.splice(i, 1);
|
|
15648
15764
|
}
|
|
15649
15765
|
return out.length > 100 ? out.slice(-100) : out;
|
|
15650
15766
|
}
|
|
@@ -15679,6 +15795,8 @@ var IDENTITY_MAX_VALIDITY = 3456e4;
|
|
|
15679
15795
|
var IDENTITY_MAX_EVIDENCE = 16384;
|
|
15680
15796
|
/** Unanswered challenges a verifier keeps per conversation. */
|
|
15681
15797
|
var MAX_CHALLENGES = 8;
|
|
15798
|
+
/** A challenge still open at `now` (seconds): a presentation for it is still taken. */
|
|
15799
|
+
var liveAt = (c, now) => c.issuedAt > now - 300;
|
|
15682
15800
|
var IDENTITY_FRAME_WINDOW_MS = 6e4;
|
|
15683
15801
|
var IDENTITY_PROVIDER_ID = /^[a-z][a-z0-9-]{0,31}$/;
|
|
15684
15802
|
/** Printable ASCII without spaces, so the statement can be built but never needs parsing. */
|
|
@@ -15953,6 +16071,28 @@ var IdentityExchange = class {
|
|
|
15953
16071
|
this.requested.clear();
|
|
15954
16072
|
this.peerProviders = void 0;
|
|
15955
16073
|
}
|
|
16074
|
+
/**
|
|
16075
|
+
* The challenges whose window ended unanswered go, and with them their requests' lines still verifying: a contact
|
|
16076
|
+
* whose app closed, or whose proof left its profile, before it presented tells this side nothing, and its line read
|
|
16077
|
+
* "verifying" for good. No write when none ended.
|
|
16078
|
+
*/
|
|
16079
|
+
async expire() {
|
|
16080
|
+
const now = this.now();
|
|
16081
|
+
if (!this.options.storage.read().challenges.some((c) => !liveAt(c, now))) return;
|
|
16082
|
+
await this.options.storage.update((l) => this.withoutExpired(l, now));
|
|
16083
|
+
}
|
|
16084
|
+
withoutExpired(l, now) {
|
|
16085
|
+
const live = l.challenges.filter((c) => liveAt(c, now));
|
|
16086
|
+
if (live.length === l.challenges.length) return l;
|
|
16087
|
+
return [...new Set(l.challenges.filter((c) => c.id !== void 0 && !liveAt(c, now) && !live.some((x) => x.id === c.id)).map((c) => c.id))].reduce((out, proof) => this.log(out, {
|
|
16088
|
+
type: "unanswered",
|
|
16089
|
+
side: "theirs",
|
|
16090
|
+
proof
|
|
16091
|
+
}), {
|
|
16092
|
+
...l,
|
|
16093
|
+
challenges: live
|
|
16094
|
+
});
|
|
16095
|
+
}
|
|
15956
16096
|
/** Share a proof of this profile with this contact: now if connected, else when it next is. */
|
|
15957
16097
|
async share(id, connected) {
|
|
15958
16098
|
const local = await this.options.localProof(id);
|
|
@@ -16209,17 +16349,16 @@ var IdentityExchange = class {
|
|
|
16209
16349
|
id
|
|
16210
16350
|
};
|
|
16211
16351
|
await this.options.storage.update((l) => {
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
return this.log({
|
|
16352
|
+
if (l.challenges.filter((c) => liveAt(c, now)).length >= MAX_CHALLENGES) throw new Error("Too many identity challenges");
|
|
16353
|
+
return this.withoutExpired(this.log({
|
|
16215
16354
|
...l,
|
|
16216
|
-
challenges: [...
|
|
16355
|
+
challenges: [...l.challenges, challenge]
|
|
16217
16356
|
}, {
|
|
16218
16357
|
type: "shared",
|
|
16219
16358
|
side: "theirs",
|
|
16220
16359
|
proof: id,
|
|
16221
16360
|
provider
|
|
16222
|
-
});
|
|
16361
|
+
}), now);
|
|
16223
16362
|
});
|
|
16224
16363
|
this.send({
|
|
16225
16364
|
t: "idp-challenge",
|
|
@@ -16286,7 +16425,7 @@ var IdentityExchange = class {
|
|
|
16286
16425
|
const id = statement.id;
|
|
16287
16426
|
const scope = this.incomingScope();
|
|
16288
16427
|
const now = this.now();
|
|
16289
|
-
const challengeOf = (l) => l.challenges.find((c) => c.nonce === nonce && c.issuedAt === issuedAt && c.provider === binding.provider && c
|
|
16428
|
+
const challengeOf = (l) => l.challenges.find((c) => c.nonce === nonce && c.issuedAt === issuedAt && c.provider === binding.provider && liveAt(c, now));
|
|
16290
16429
|
const known = (l) => !!challengeOf(l);
|
|
16291
16430
|
if (!known(this.options.storage.read())) throw new Error("Unknown or reused identity challenge");
|
|
16292
16431
|
let verified;
|
|
@@ -17489,6 +17628,11 @@ var FILES_CAPABILITY = "files/3";
|
|
|
17489
17628
|
var FILES_BINARY_CAPABILITY = "files/4";
|
|
17490
17629
|
/** The typing indicator: `paired-typing` frames on this session, 1:1 chats only (WISP 401 § Typing, `pairedTyping.ts`). */
|
|
17491
17630
|
var TYPING_CAPABILITY = "typing/1";
|
|
17631
|
+
/**
|
|
17632
|
+
* Presence and a set status: `paired-status` frames on this session, 1:1 chats only (WISP 401 § Presence and status,
|
|
17633
|
+
* `pairedStatus.ts`).
|
|
17634
|
+
*/
|
|
17635
|
+
var STATUS_CAPABILITY = "status/1";
|
|
17492
17636
|
/** Reactions to messages: `paired-reaction` frames on this session, 1:1 chats only (WISP 401 § Reactions, `reactions.ts`). */
|
|
17493
17637
|
var REACTIONS_CAPABILITY = "react/1";
|
|
17494
17638
|
/** Editing sent texts: `paired-edit` frames on this session, 1:1 chats only (WISP 401 § Edits, `pairedEdits.ts`). */
|
|
@@ -17533,6 +17677,7 @@ var KNOWN_SESSION_CAPABILITIES = [
|
|
|
17533
17677
|
FILES_CAPABILITY,
|
|
17534
17678
|
FILES_BINARY_CAPABILITY,
|
|
17535
17679
|
TYPING_CAPABILITY,
|
|
17680
|
+
STATUS_CAPABILITY,
|
|
17536
17681
|
REACTIONS_CAPABILITY,
|
|
17537
17682
|
EDIT_CAPABILITY,
|
|
17538
17683
|
WAKE_SESSION_CAPABILITY,
|
|
@@ -17937,7 +18082,7 @@ var APP_RANGE_LIMITS = {
|
|
|
17937
18082
|
bytesPerSecond: 33554432
|
|
17938
18083
|
};
|
|
17939
18084
|
/**
|
|
17940
|
-
* What an `ar-err` says. `not-served`: no serve of that id
|
|
18085
|
+
* What an `ar-err` says. `not-served`: no serve of that id (never given, or ended); `changed` and
|
|
17941
18086
|
* `gone`: the file under it, as `files.read` says them; `busy`: past the requests the server takes in flight. A
|
|
17942
18087
|
* later version may add one: an asker reads a code it does not know as a failure.
|
|
17943
18088
|
*/
|
|
@@ -18122,12 +18267,13 @@ function decodeAppRangeData(message) {
|
|
|
18122
18267
|
var slot = (app, request) => `${app}:${request}`;
|
|
18123
18268
|
/**
|
|
18124
18269
|
* The read lane of one chat, both ways (WISP 1200 § A read lane to the contact). As the side that serves it keeps the
|
|
18125
|
-
* serve ids it gave out
|
|
18270
|
+
* serve ids it gave out and answers the contact's `ar-get` for those only, at most
|
|
18126
18271
|
* `APP_RANGE_LIMITS.inFlight` per app and `bytesPerSecond` asked in all (`busy` past either); the bytes themselves
|
|
18127
18272
|
* are read and sent by the session, which calls `finish` or `fail` for each task. As the side that asks it sends at
|
|
18128
18273
|
* most `inFlight` requests per app, keeps
|
|
18129
|
-
* the rest waiting, and puts each answer back together, in order, from the offset asked.
|
|
18130
|
-
*
|
|
18274
|
+
* the rest waiting, and puts each answer back together, in order, from the offset asked. Requests last one session
|
|
18275
|
+
* (`suspend` ends them); serves last until the app closes on either side (`closeApp`) or the session ends for good
|
|
18276
|
+
* (`reset`, which ends both). A task still being read counts until it is settled.
|
|
18131
18277
|
*/
|
|
18132
18278
|
var AppRanges = class {
|
|
18133
18279
|
send;
|
|
@@ -18158,8 +18304,8 @@ var AppRanges = class {
|
|
|
18158
18304
|
this.now = now;
|
|
18159
18305
|
}
|
|
18160
18306
|
/**
|
|
18161
|
-
* Lets the contact's `app` read `file`
|
|
18162
|
-
* the id it has, so an app that serves again on each play holds one serve per file, not one per call.
|
|
18307
|
+
* Lets the contact's `app` read `file` until the app closes: the serve id to tell it. A file the app serves already
|
|
18308
|
+
* answers the id it has, so an app that serves again on each play holds one serve per file, not one per call.
|
|
18163
18309
|
*/
|
|
18164
18310
|
serve(app, file) {
|
|
18165
18311
|
if (!isChatAppId(app)) throw new Error("Not a chat app id");
|
|
@@ -18179,7 +18325,7 @@ var AppRanges = class {
|
|
|
18179
18325
|
for (const task of this.serving.values()) if (task.serve === serveId) this.drop(task, true);
|
|
18180
18326
|
return true;
|
|
18181
18327
|
}
|
|
18182
|
-
/** The serve ids `app` has given out
|
|
18328
|
+
/** The serve ids `app` has given out and not ended (what the panel's "Sharing with" line shows). */
|
|
18183
18329
|
servesOf(app) {
|
|
18184
18330
|
return [...this.serves].filter(([, serve]) => serve.app === app).map(([id]) => id);
|
|
18185
18331
|
}
|
|
@@ -18314,6 +18460,28 @@ var AppRanges = class {
|
|
|
18314
18460
|
*/
|
|
18315
18461
|
closeApp(app, error = "peer-closed", stopped = false) {
|
|
18316
18462
|
for (const [id, serve] of this.serves) if (serve.app === app) this.serves.delete(id);
|
|
18463
|
+
for (const key of [...this.sizes.keys()]) if (key.startsWith(`${app} `)) this.sizes.delete(key);
|
|
18464
|
+
this.endRequests(app, error, stopped);
|
|
18465
|
+
}
|
|
18466
|
+
/** The session ended: no serve id lasts into the next, and every request fails with `offline`. Tasks still being read keep their places into the next. */
|
|
18467
|
+
reset() {
|
|
18468
|
+
this.sizes.clear();
|
|
18469
|
+
for (const app of new Set([...this.serves.values()].map((serve) => serve.app))) this.closeApp(app, "offline");
|
|
18470
|
+
this.suspend();
|
|
18471
|
+
}
|
|
18472
|
+
/**
|
|
18473
|
+
* The session changed (a resume, a re-dial, a transport switch) and the apps are held across it: every request fails
|
|
18474
|
+
* with `offline`, and the serve ids stay, for the next session, until the app closes on either side.
|
|
18475
|
+
*/
|
|
18476
|
+
suspend() {
|
|
18477
|
+
const apps = new Set([...this.serving.values(), ...this.draining].map((task) => task.app).concat([...this.waiting.keys()], [...this.asking.values()].map((ask) => ask.app)));
|
|
18478
|
+
for (const app of apps) this.endRequests(app, "offline");
|
|
18479
|
+
}
|
|
18480
|
+
/**
|
|
18481
|
+
* What `app` was sending stops and what it asked fails with `error`. A task this side is still reading keeps its place
|
|
18482
|
+
* until it is settled; only `stopped` (this side's app closed) frees them now.
|
|
18483
|
+
*/
|
|
18484
|
+
endRequests(app, error, stopped = false) {
|
|
18317
18485
|
for (const task of this.serving.values()) if (task.app === app) this.drop(task, !stopped);
|
|
18318
18486
|
if (stopped) {
|
|
18319
18487
|
for (const task of this.draining) if (task.app === app) this.draining.delete(task);
|
|
@@ -18321,13 +18489,6 @@ var AppRanges = class {
|
|
|
18321
18489
|
for (const ask of this.waiting.get(app) ?? []) ask.reject(new Error(error));
|
|
18322
18490
|
this.waiting.delete(app);
|
|
18323
18491
|
for (const ask of this.asking.values()) if (ask.app === app) this.settle(ask, error);
|
|
18324
|
-
for (const key of [...this.sizes.keys()]) if (key.startsWith(`${app} `)) this.sizes.delete(key);
|
|
18325
|
-
}
|
|
18326
|
-
/** The session ended: no serve id lasts into the next, and every request fails with `offline`. Tasks still being read keep their places into the next. */
|
|
18327
|
-
reset() {
|
|
18328
|
-
this.sizes.clear();
|
|
18329
|
-
const apps = new Set([...this.serves.values()].map((serve) => serve.app).concat([...this.serving.values(), ...this.draining].map((task) => task.app), [...this.waiting.keys()], [...this.asking.values()].map((ask) => ask.app)));
|
|
18330
|
-
for (const app of apps) this.closeApp(app, "offline");
|
|
18331
18492
|
}
|
|
18332
18493
|
/** Stops `task` and frees its request number; `draining` keeps it counted until it is settled. */
|
|
18333
18494
|
drop(task, draining = false) {
|
|
@@ -18498,6 +18659,12 @@ function pushRequest(target, keys, payload, options) {
|
|
|
18498
18659
|
var WAKE_FRAME = "paired-wake";
|
|
18499
18660
|
/** At most one wake-up per contact in this long. A burst of messages is one push. */
|
|
18500
18661
|
var WAKE_INTERVAL_MS = 3e5;
|
|
18662
|
+
/**
|
|
18663
|
+
* A wake-up that did not reach the push service (no network, the push relay did not forward it, the push service
|
|
18664
|
+
* answered 429 or 5xx) is not the contact's wake-up: the next one may go this long after it, not 5 minutes. Never a
|
|
18665
|
+
* retry of that one; only a pause, so a relay that is refusing is not asked again on every message.
|
|
18666
|
+
*/
|
|
18667
|
+
var WAKE_RETRY_MS = 3e4;
|
|
18501
18668
|
/** A wake-up that has not reached the phone within this is no use: the push service may drop it. */
|
|
18502
18669
|
var WAKE_TTL_SECONDS = 3600;
|
|
18503
18670
|
/** The VAPID subject push services ask for: who to contact about abuse. The project, never a person. */
|
|
@@ -18515,7 +18682,8 @@ function wakeFrame(target) {
|
|
|
18515
18682
|
a: target.auth,
|
|
18516
18683
|
vp: target.vapid.publicKey,
|
|
18517
18684
|
vk: target.vapid.privateKey,
|
|
18518
|
-
k: target.token
|
|
18685
|
+
k: target.token,
|
|
18686
|
+
...target.online && { o: 1 }
|
|
18519
18687
|
}
|
|
18520
18688
|
};
|
|
18521
18689
|
}
|
|
@@ -18530,7 +18698,7 @@ function parseWakeFrame(frame) {
|
|
|
18530
18698
|
if (frame.w === null) return null;
|
|
18531
18699
|
const w = frame.w;
|
|
18532
18700
|
if (!w || typeof w !== "object") return void 0;
|
|
18533
|
-
const { e, p, a, vp, vk, k } = w;
|
|
18701
|
+
const { e, p, a, vp, vk, k, o } = w;
|
|
18534
18702
|
if (typeof e !== "string" || ![
|
|
18535
18703
|
p,
|
|
18536
18704
|
a,
|
|
@@ -18550,22 +18718,26 @@ function parseWakeFrame(frame) {
|
|
|
18550
18718
|
publicKey: vp,
|
|
18551
18719
|
privateKey: vk
|
|
18552
18720
|
},
|
|
18553
|
-
token: k
|
|
18721
|
+
token: k,
|
|
18722
|
+
...o === 1 && { online: true }
|
|
18554
18723
|
};
|
|
18555
18724
|
if (!vapidKeysMatch(target.vapid)) return void 0;
|
|
18556
18725
|
return target;
|
|
18557
18726
|
}
|
|
18727
|
+
/** At most one online notice per contact in this long, whatever the message wake-ups do. Kept across restarts. */
|
|
18728
|
+
var WAKE_ONLINE_INTERVAL_MS = 18e5;
|
|
18729
|
+
/** How long after this side comes online it waits for the chat to go live before it says so: a live contact needs no push. */
|
|
18730
|
+
var WAKE_ONLINE_DELAY_MS = 3e4;
|
|
18731
|
+
var WAKE_ONLINE_BATCH_MS = 6e4;
|
|
18558
18732
|
/** At most one call wake-up per contact in this long: a caller who tries again at once is not a new push. */
|
|
18559
18733
|
var WAKE_CALL_INTERVAL_MS = 3e4;
|
|
18560
|
-
/** The wake-up's plaintext: the contact's token for this chat, and whether it is for a call. Nothing else. */
|
|
18734
|
+
/** The wake-up's plaintext: the contact's token for this chat, and whether it is for a call or an online notice. Nothing else. */
|
|
18561
18735
|
function wakePayload(token, kind = "message") {
|
|
18562
|
-
return utf8Encode(JSON.stringify(
|
|
18736
|
+
return utf8Encode(JSON.stringify({
|
|
18563
18737
|
wake: 1,
|
|
18564
18738
|
k: token,
|
|
18565
|
-
c: 1
|
|
18566
|
-
|
|
18567
|
-
wake: 1,
|
|
18568
|
-
k: token
|
|
18739
|
+
...kind === "call" && { c: 1 },
|
|
18740
|
+
...kind === "online" && { o: 1 }
|
|
18569
18741
|
}));
|
|
18570
18742
|
}
|
|
18571
18743
|
/**
|
|
@@ -18588,7 +18760,7 @@ function deviceWakeRequest(target, now = Date.now()) {
|
|
|
18588
18760
|
function wakeRequest(target, now = Date.now(), kind = "message") {
|
|
18589
18761
|
return pushRequest(target, target.vapid, wakePayload(target.token, kind), {
|
|
18590
18762
|
subject: WAKE_SUBJECT,
|
|
18591
|
-
ttlSeconds: kind === "call" ? 60 : WAKE_TTL_SECONDS,
|
|
18763
|
+
ttlSeconds: kind === "call" ? 60 : kind === "online" ? 300 : WAKE_TTL_SECONDS,
|
|
18592
18764
|
now
|
|
18593
18765
|
});
|
|
18594
18766
|
}
|
|
@@ -18606,6 +18778,14 @@ var WakeLimiter = class {
|
|
|
18606
18778
|
this.last.set(contact, now);
|
|
18607
18779
|
return true;
|
|
18608
18780
|
}
|
|
18781
|
+
/**
|
|
18782
|
+
* The wake-up taken at `takenAt` did not reach the push service: it does not count, and the next may go
|
|
18783
|
+
* `retryMs` from now. Nothing changes when another was taken since, or the count started over.
|
|
18784
|
+
*/
|
|
18785
|
+
missed(contact, takenAt, retryMs = WAKE_RETRY_MS, now = Date.now()) {
|
|
18786
|
+
if (this.last.get(contact) !== takenAt) return;
|
|
18787
|
+
this.last.set(contact, now - this.interval + Math.min(retryMs, this.interval));
|
|
18788
|
+
}
|
|
18609
18789
|
/** The contact answered (it is live again): the next time it is away, it may be woken at once. */
|
|
18610
18790
|
reset(contact) {
|
|
18611
18791
|
this.last.delete(contact);
|
|
@@ -18759,8 +18939,12 @@ var LINK_OR_MARKUP = /[a-z][a-z0-9+.-]*:\/\/|\bwww\.|\b(?:mailto|javascript|data
|
|
|
18759
18939
|
* holds a link or markup (it is plain text, never a way to put a link on the contact's screen).
|
|
18760
18940
|
*/
|
|
18761
18941
|
function sanitizeTypingStatus(value) {
|
|
18942
|
+
return plainStatusLine(value, 40);
|
|
18943
|
+
}
|
|
18944
|
+
/** A contact's line of plain text by the typing status's rules, at most `max` characters (a set status uses it too). */
|
|
18945
|
+
function plainStatusLine(value, max) {
|
|
18762
18946
|
if (typeof value !== "string") return void 0;
|
|
18763
|
-
const clean = sanitizeDisplayText(value.slice(0,
|
|
18947
|
+
const clean = sanitizeDisplayText(value.slice(0, 4 * max).replace(/\s+/g, " "), max);
|
|
18764
18948
|
if (!clean || LINK_OR_MARKUP.test(clean)) return void 0;
|
|
18765
18949
|
return clean;
|
|
18766
18950
|
}
|
|
@@ -18939,6 +19123,187 @@ var TypingReceiver = class {
|
|
|
18939
19123
|
}
|
|
18940
19124
|
};
|
|
18941
19125
|
//#endregion
|
|
19126
|
+
//#region ../core/src/pairedStatus.ts
|
|
19127
|
+
/**
|
|
19128
|
+
* Presence and a set status in a 1:1 chat (WISP 401 § Presence and status): whether the person is there, and a status
|
|
19129
|
+
* they set (Slack-like), said to the contact on the live session only.
|
|
19130
|
+
*
|
|
19131
|
+
* {"t":"paired-status","p":"active"}
|
|
19132
|
+
* {"t":"paired-status","p":"idle","s":{"a":"busy","e":"🍕","m":"At lunch","u":1762603600000}}
|
|
19133
|
+
* {"t":"paired-status"}
|
|
19134
|
+
*
|
|
19135
|
+
* It needs `status/1` in `paired-capabilities` on both sides. Each frame is the whole state and replaces the one before.
|
|
19136
|
+
* Like typing, it is presence, not a message: no message id (older apps drop it), never stored, held or put on the DHT.
|
|
19137
|
+
* `p` is absent when the person does not share when they are online; `s` is absent when they set no status.
|
|
19138
|
+
*/
|
|
19139
|
+
var STATUS_FRAME = "paired-status";
|
|
19140
|
+
/** What a person can say they are: `dnd` is Do not disturb. */
|
|
19141
|
+
var STATUS_AVAILABILITIES = [
|
|
19142
|
+
"available",
|
|
19143
|
+
"busy",
|
|
19144
|
+
"away",
|
|
19145
|
+
"dnd"
|
|
19146
|
+
];
|
|
19147
|
+
/** Whether the person uses the app now (`active`) or not for a while (`idle`). */
|
|
19148
|
+
var PRESENCES = ["active", "idle"];
|
|
19149
|
+
/** No input in the app for this long: the person is idle. */
|
|
19150
|
+
var STATUS_IDLE_AFTER_MS = 6e5;
|
|
19151
|
+
/** The sender says at most one frame per this; a change in between goes when it ends, the latest state only. */
|
|
19152
|
+
var STATUS_SEND_INTERVAL_MS = 5e3;
|
|
19153
|
+
var isObject$4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19154
|
+
var validUntil = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
19155
|
+
var availabilityOf = (value) => STATUS_AVAILABILITIES.includes(value) ? value : "available";
|
|
19156
|
+
var presenceOf = (value) => PRESENCES.includes(value) ? value : "active";
|
|
19157
|
+
/** A status text as it may be shown: one line, no invisible characters, no link or markup, at most 60 characters. */
|
|
19158
|
+
function sanitizeStatusText(value) {
|
|
19159
|
+
return plainStatusLine(value, 60);
|
|
19160
|
+
}
|
|
19161
|
+
/** A status with each field checked; undefined when nothing is left of it. An unknown availability reads as available. */
|
|
19162
|
+
function personStatus(raw) {
|
|
19163
|
+
if (!isObject$4(raw)) return void 0;
|
|
19164
|
+
const status = {};
|
|
19165
|
+
if (raw.availability !== void 0) status.availability = availabilityOf(raw.availability);
|
|
19166
|
+
const emoji = reactionEmoji(raw.emoji);
|
|
19167
|
+
if (emoji) status.emoji = emoji;
|
|
19168
|
+
const text = sanitizeStatusText(raw.text);
|
|
19169
|
+
if (text) status.text = text;
|
|
19170
|
+
if (validUntil(raw.until)) status.until = raw.until;
|
|
19171
|
+
return Object.keys(status).length ? status : void 0;
|
|
19172
|
+
}
|
|
19173
|
+
/** The status while it lasts: undefined once its `until` is past by this clock. */
|
|
19174
|
+
function liveStatus(status, now = Date.now()) {
|
|
19175
|
+
return status && (status.until === void 0 || status.until > now) ? status : void 0;
|
|
19176
|
+
}
|
|
19177
|
+
/** A state with its fields checked. */
|
|
19178
|
+
function statusState(raw) {
|
|
19179
|
+
const state = {};
|
|
19180
|
+
if (raw.presence !== void 0) state.presence = presenceOf(raw.presence);
|
|
19181
|
+
const status = personStatus(raw.status);
|
|
19182
|
+
if (status) state.status = status;
|
|
19183
|
+
return state;
|
|
19184
|
+
}
|
|
19185
|
+
function statusFrame(state) {
|
|
19186
|
+
const frame = { t: STATUS_FRAME };
|
|
19187
|
+
const clean = statusState(state);
|
|
19188
|
+
if (clean.presence) frame.p = clean.presence;
|
|
19189
|
+
const status = clean.status;
|
|
19190
|
+
if (status) {
|
|
19191
|
+
const wire = {};
|
|
19192
|
+
if (status.availability) wire.a = status.availability;
|
|
19193
|
+
if (status.emoji) wire.e = status.emoji;
|
|
19194
|
+
if (status.text) wire.m = status.text;
|
|
19195
|
+
if (status.until !== void 0) wire.u = status.until;
|
|
19196
|
+
frame.s = wire;
|
|
19197
|
+
}
|
|
19198
|
+
return frame;
|
|
19199
|
+
}
|
|
19200
|
+
/**
|
|
19201
|
+
* The state a `paired-status` frame says, or null when it is malformed (then the reader keeps what it had): `s` not an
|
|
19202
|
+
* object, or `p` or `s.a` present and not a string. A field that does not hold (an emoji that is not one, a text with a
|
|
19203
|
+
* link, a bad `u`) is left out, not the frame.
|
|
19204
|
+
*/
|
|
19205
|
+
function parseStatusFrame(frame) {
|
|
19206
|
+
if (frame?.t !== "paired-status") return null;
|
|
19207
|
+
if (frame.p !== void 0 && typeof frame.p !== "string") return null;
|
|
19208
|
+
if (frame.s !== void 0 && !isObject$4(frame.s)) return null;
|
|
19209
|
+
const s = frame.s;
|
|
19210
|
+
if (s?.a !== void 0 && typeof s.a !== "string") return null;
|
|
19211
|
+
return statusState({
|
|
19212
|
+
...frame.p !== void 0 ? { presence: frame.p } : {},
|
|
19213
|
+
...s ? { status: {
|
|
19214
|
+
availability: s.a,
|
|
19215
|
+
emoji: s.e,
|
|
19216
|
+
text: s.m,
|
|
19217
|
+
until: s.u
|
|
19218
|
+
} } : {}
|
|
19219
|
+
});
|
|
19220
|
+
}
|
|
19221
|
+
var sameStatus = (a, b) => a?.availability === b?.availability && a?.emoji === b?.emoji && a?.text === b?.text && a?.until === b?.until;
|
|
19222
|
+
/** Two states say the same. */
|
|
19223
|
+
var sameStatusState = (a, b) => a.presence === b.presence && sameStatus(a.status, b.status);
|
|
19224
|
+
/**
|
|
19225
|
+
* This side's word: what it says, and when. One per chat. A new session owes the whole state (`reset`); a change owes
|
|
19226
|
+
* it again. Frames go at most one per `STATUS_SEND_INTERVAL_MS`, across sessions, so the reader's window always has room.
|
|
19227
|
+
*/
|
|
19228
|
+
var StatusSender = class {
|
|
19229
|
+
now;
|
|
19230
|
+
state = {};
|
|
19231
|
+
owed = true;
|
|
19232
|
+
sentAt = -Infinity;
|
|
19233
|
+
constructor(now = () => Date.now()) {
|
|
19234
|
+
this.now = now;
|
|
19235
|
+
}
|
|
19236
|
+
/** What this side says now. */
|
|
19237
|
+
get current() {
|
|
19238
|
+
return this.state;
|
|
19239
|
+
}
|
|
19240
|
+
/** This side's presence or status changed: owed again when it says something new. */
|
|
19241
|
+
set(state) {
|
|
19242
|
+
const clean = statusState(state);
|
|
19243
|
+
if (sameStatusState(clean, this.state)) return;
|
|
19244
|
+
this.state = clean;
|
|
19245
|
+
this.owed = true;
|
|
19246
|
+
}
|
|
19247
|
+
/**
|
|
19248
|
+
* On a session that agreed `status/1`: the frame to send now; or how long to wait before asking again (the interval
|
|
19249
|
+
* has not passed); or null when nothing is owed.
|
|
19250
|
+
*/
|
|
19251
|
+
take() {
|
|
19252
|
+
if (!this.owed) return null;
|
|
19253
|
+
const now = this.now(), wait = this.sentAt + STATUS_SEND_INTERVAL_MS - now;
|
|
19254
|
+
if (wait > 0 && now >= this.sentAt) return { wait };
|
|
19255
|
+
this.owed = false;
|
|
19256
|
+
this.sentAt = now;
|
|
19257
|
+
return { frame: statusFrame(this.state) };
|
|
19258
|
+
}
|
|
19259
|
+
/** The session ended: the next one is owed the whole state. */
|
|
19260
|
+
reset() {
|
|
19261
|
+
this.owed = true;
|
|
19262
|
+
}
|
|
19263
|
+
};
|
|
19264
|
+
/**
|
|
19265
|
+
* The contact's word, with a rate limit. Presence ends with the session (`endSession`); the status stays until a new
|
|
19266
|
+
* frame replaces it or its `until` passes (read through `peer`). `onChange` hears changes only.
|
|
19267
|
+
*/
|
|
19268
|
+
var StatusReceiver = class {
|
|
19269
|
+
onChange;
|
|
19270
|
+
now;
|
|
19271
|
+
state = {};
|
|
19272
|
+
recent = [];
|
|
19273
|
+
constructor(onChange, now = () => Date.now()) {
|
|
19274
|
+
this.onChange = onChange;
|
|
19275
|
+
this.now = now;
|
|
19276
|
+
}
|
|
19277
|
+
/** What the contact says now, a status past its `until` left out. */
|
|
19278
|
+
get peer() {
|
|
19279
|
+
const status = liveStatus(this.state.status, this.now());
|
|
19280
|
+
return {
|
|
19281
|
+
...this.state.presence ? { presence: this.state.presence } : {},
|
|
19282
|
+
...status ? { status } : {}
|
|
19283
|
+
};
|
|
19284
|
+
}
|
|
19285
|
+
/** A `paired-status` frame from the contact. False when it was dropped: malformed, or over the rate limit. */
|
|
19286
|
+
receive(frame) {
|
|
19287
|
+
const now = this.now();
|
|
19288
|
+
this.recent = this.recent.filter((at) => at <= now && now - at < 6e4);
|
|
19289
|
+
if (this.recent.length >= 15) return false;
|
|
19290
|
+
this.recent.push(now);
|
|
19291
|
+
const state = parseStatusFrame(frame);
|
|
19292
|
+
if (!state) return false;
|
|
19293
|
+
this.set(state);
|
|
19294
|
+
return true;
|
|
19295
|
+
}
|
|
19296
|
+
/** The session ended: the contact is not online any more; its status stands. */
|
|
19297
|
+
endSession() {
|
|
19298
|
+
if (this.state.presence) this.set(this.state.status ? { status: this.state.status } : {});
|
|
19299
|
+
}
|
|
19300
|
+
set(state) {
|
|
19301
|
+
if (sameStatusState(state, this.state)) return;
|
|
19302
|
+
this.state = state;
|
|
19303
|
+
this.onChange(this.peer);
|
|
19304
|
+
}
|
|
19305
|
+
};
|
|
19306
|
+
//#endregion
|
|
18942
19307
|
//#region ../core/src/chatFiles.ts
|
|
18943
19308
|
/**
|
|
18944
19309
|
* files/3 (WISP 501, revision 0.3): files of any size in a chat, offered before they are sent, sent with
|
|
@@ -20596,6 +20961,7 @@ var ChatFiles = class {
|
|
|
20596
20961
|
* contact this session authenticated. Nothing about a call is ever published on the DHT.
|
|
20597
20962
|
*/
|
|
20598
20963
|
var PAIRED_CALL_FRAME = "paired-call";
|
|
20964
|
+
var CALL_RATE_WINDOW_MS = 6e4;
|
|
20599
20965
|
/**
|
|
20600
20966
|
* The signal a `paired-call` frame carries, or null when it is not a well-formed one. It came on a live session, now:
|
|
20601
20967
|
* that is when it was heard (`heardCallSignal`), whatever time its sender's clock gave it.
|
|
@@ -21145,6 +21511,8 @@ var CarriedTransport = class {
|
|
|
21145
21511
|
hooks;
|
|
21146
21512
|
/** My last packet while the edge is down: what a member that just became reachable is handed. */
|
|
21147
21513
|
mine = null;
|
|
21514
|
+
/** The records `mine` holds, as members last took them, and when. */
|
|
21515
|
+
handed = null;
|
|
21148
21516
|
lastTimestamp = 0n;
|
|
21149
21517
|
/** The date each packet `stamp` signed carries: the relays' transport takes it rather than check the signature again. */
|
|
21150
21518
|
dated = /* @__PURE__ */ new WeakMap();
|
|
@@ -21215,6 +21583,8 @@ var CarriedTransport = class {
|
|
|
21215
21583
|
throw held;
|
|
21216
21584
|
}
|
|
21217
21585
|
}
|
|
21586
|
+
const said = JSON.stringify(records);
|
|
21587
|
+
if (this.mine && this.handed?.said === said && Date.now() - this.handed.at < 3e4) return this.toRelays(identity, records, this.mine, options);
|
|
21218
21588
|
const payload = this.newest = this.stamp(identity, records);
|
|
21219
21589
|
this.mine = payload;
|
|
21220
21590
|
let carried = {
|
|
@@ -21224,6 +21594,10 @@ var CarriedTransport = class {
|
|
|
21224
21594
|
try {
|
|
21225
21595
|
carried = this.hooks.carry(payload);
|
|
21226
21596
|
} catch {}
|
|
21597
|
+
this.handed = carried.taken ? {
|
|
21598
|
+
said,
|
|
21599
|
+
at: Date.now()
|
|
21600
|
+
} : null;
|
|
21227
21601
|
const proven = Date.now() - this.heardAt < SIGNAL_PROVEN_MS;
|
|
21228
21602
|
if (!carried.taken || this.quiet || !(carried.sure || proven)) return this.toRelays(identity, records, payload, options);
|
|
21229
21603
|
let end;
|
|
@@ -21385,6 +21759,7 @@ var CarriedTransport = class {
|
|
|
21385
21759
|
if (this.unsigned) {
|
|
21386
21760
|
const { identity, records } = this.unsigned;
|
|
21387
21761
|
this.unsigned = null;
|
|
21762
|
+
this.handed = null;
|
|
21388
21763
|
this.mine = this.newest = this.stamp(identity, records);
|
|
21389
21764
|
}
|
|
21390
21765
|
return this.mine;
|
|
@@ -21781,6 +22156,8 @@ var ENGINE_ERRORS = {
|
|
|
21781
22156
|
ecashOtherUnit: "This ecash is in {unit}: only sat ecash can be redeemed here",
|
|
21782
22157
|
reviewedEcashSpent: "The ecash for this payment was already spent somewhere else. Nothing was sent, and your balance now shows what the mint still holds.",
|
|
21783
22158
|
reviewedSatsGone: "The sats this payment was reviewed with went to another payment. Nothing was sent: review it again.",
|
|
22159
|
+
mintFailedQuote: "{host} could not take this payment right now, and no sats left your wallet: try again later. The mint said: {reason}",
|
|
22160
|
+
mintFailedFaucet: "{host} could not give test coins right now: try again later. The mint said: {reason}",
|
|
21784
22161
|
lightningFeeTooHigh: "The Lightning fee ({fee} sats) is too high",
|
|
21785
22162
|
lightningRefused: "The mint refused this Lightning payment, and no sats left your wallet: it is safe to try again. The mint said: {reason}",
|
|
21786
22163
|
invoiceExpired: "That invoice has expired",
|
|
@@ -22002,6 +22379,15 @@ var LIVENESS_PING_MS = 15e3;
|
|
|
22002
22379
|
*/
|
|
22003
22380
|
var SWITCH_RETIRE_MS = 3e3;
|
|
22004
22381
|
/**
|
|
22382
|
+
* A move's native dial that found no announce of the contact (HyperDHT's PEER_NOT_FOUND) is made again this long after,
|
|
22383
|
+
* for as long as the move lasts: the contact is live (its policy came over the open session), and its endpoint is not
|
|
22384
|
+
* announced while a channel is live: a move back to HyperDHT within ~5 s of leaving it, before the session left behind
|
|
22385
|
+
* had retired (`SWITCH_RETIRE_MS`) and the endpoint was announced again, found nobody. The move gave up at once and the
|
|
22386
|
+
* chat waited the 20 s retry (20.0-20.1 s in 3 of 3 cycles on two CLI daemons, a 2 s gap between moves).
|
|
22387
|
+
*/
|
|
22388
|
+
var SWITCH_FIND_RETRY_MS = 1e3;
|
|
22389
|
+
var RTC_SIGNAL_RATE_WINDOW_MS = 6e4;
|
|
22390
|
+
/**
|
|
22005
22391
|
* Frames that keep a session going rather than say something of the two people's: what the contact sent last outside
|
|
22006
22392
|
* these is when the chat was last in use (`canYieldEndpoint`). Every other frame (a text, a receipt, typing, a
|
|
22007
22393
|
* reaction, an edit, a file, a call, a payment) is use; what this side sends is answered with one of them.
|
|
@@ -22285,6 +22671,11 @@ var GhostLink = class {
|
|
|
22285
22671
|
/** Typing on this session (`typing/1`): when to say `start` again, and the contact's word with its timeout. */
|
|
22286
22672
|
typingSender = new TypingSender();
|
|
22287
22673
|
typingReceiver = new TypingReceiver((typing, activity) => this.options.events?.onPeerTyping?.(typing, activity));
|
|
22674
|
+
/** Presence and status on this session (`status/1`): this side's word (kept across sessions) and the contact's. */
|
|
22675
|
+
statusSender = new StatusSender();
|
|
22676
|
+
statusReceiver = new StatusReceiver((state) => this.options.events?.onPeerStatus?.(state));
|
|
22677
|
+
/** A status frame waiting for the send interval to pass. */
|
|
22678
|
+
statusTimer = null;
|
|
22288
22679
|
/** Mini-apps on this session (`apps/1`): this side's open apps (kept across sessions), the peer's, the limits. */
|
|
22289
22680
|
apps;
|
|
22290
22681
|
/** The read lane on this session (`app-ranges/1`): what this side serves and what it asked; none of it outlives the session. */
|
|
@@ -22299,6 +22690,10 @@ var GhostLink = class {
|
|
|
22299
22690
|
pinsReceived = new ReactionWindow(PIN_LIMITS.receive, PIN_LIMITS.windowMs);
|
|
22300
22691
|
/** Edit frames the contact may send per window; the rest go unconfirmed and come again. */
|
|
22301
22692
|
editsReceived = new RateWindow(30, EDIT_RATE_WINDOW_MS);
|
|
22693
|
+
/** Call signals the contact may send per window; the rest are dropped. */
|
|
22694
|
+
callsReceived = new RateWindow(150, CALL_RATE_WINDOW_MS);
|
|
22695
|
+
/** WebRTC signals the contact may send on the session (`paired-rtc`) per window; the rest are dropped. */
|
|
22696
|
+
rtcSignalsReceived = new RateWindow(60, RTC_SIGNAL_RATE_WINDOW_MS);
|
|
22302
22697
|
wakeReceived = new RateWindow(6, 6e4);
|
|
22303
22698
|
/** Said once a session by the requester's app: a few a minute at most. */
|
|
22304
22699
|
askerReceived = new RateWindow(4, 6e4);
|
|
@@ -22845,7 +23240,7 @@ var GhostLink = class {
|
|
|
22845
23240
|
key: this.myPubKeyZ32,
|
|
22846
23241
|
peerKey: options.params.peerPubKeyZ32,
|
|
22847
23242
|
policy: () => ({
|
|
22848
|
-
preferred: this.
|
|
23243
|
+
preferred: this.ownPreferred,
|
|
22849
23244
|
fallback: this.fallback,
|
|
22850
23245
|
available: this.availableTransports,
|
|
22851
23246
|
descriptors: Object.fromEntries([...this.endpoints].map(([transport, endpoint]) => [transport, endpoint.descriptor]))
|
|
@@ -23540,7 +23935,7 @@ var GhostLink = class {
|
|
|
23540
23935
|
return wanted && wanted.transport !== state.transport ? wanted : void 0;
|
|
23541
23936
|
}
|
|
23542
23937
|
if (!this.fallback) return {
|
|
23543
|
-
transport: this.
|
|
23938
|
+
transport: this.ownPreferred,
|
|
23544
23939
|
...this.automatic ? {} : { by: "you" }
|
|
23545
23940
|
};
|
|
23546
23941
|
return this.choiceApart;
|
|
@@ -23643,8 +24038,15 @@ var GhostLink = class {
|
|
|
23643
24038
|
get availableTransports() {
|
|
23644
24039
|
return [...this.options.rtcAvailable !== false ? ["webrtc/1"] : [], ...this.endpoints.keys()];
|
|
23645
24040
|
}
|
|
24041
|
+
/**
|
|
24042
|
+
* The transport this side's policy names: on Automatic, the app's rule for what runs now (Iroh once its endpoint is
|
|
24043
|
+
* up, with Fallback on; with it off, WebRTC where there is one, so an endpoint coming up moves nothing).
|
|
24044
|
+
*/
|
|
24045
|
+
get ownPreferred() {
|
|
24046
|
+
return this.automatic ? automaticTransport(this.availableTransports, this.fallback) : this.preferred;
|
|
24047
|
+
}
|
|
23646
24048
|
transportOffer() {
|
|
23647
|
-
return transportOrder(this.availableTransports, this.
|
|
24049
|
+
return transportOrder(this.availableTransports, this.ownPreferred, this.fallback);
|
|
23648
24050
|
}
|
|
23649
24051
|
registerEndpoint(endpoint) {
|
|
23650
24052
|
if (this.stopped || this.deliveryMode === "dht" || this.quietForTaken || !this.options.params.profile) {
|
|
@@ -24046,8 +24448,9 @@ var GhostLink = class {
|
|
|
24046
24448
|
const relayed = relayedTransports(this.localDescriptors(), this.peerDescriptors);
|
|
24047
24449
|
const remembered = this.peerTransports && rankTransports(local, this.peerFallback ? this.peerTransports : this.peerTransports.slice(0, 1), relayed);
|
|
24048
24450
|
const ranked = remembered?.length ? remembered : this.peerTransports ? rankTransports(local, this.peerTransports, relayed) : local.filter((t) => t === "webrtc/1");
|
|
24049
|
-
const chosen = this.switcher.chosenTarget ?? this.choiceApart?.transport ?? this.resuming;
|
|
24050
24451
|
const resume = this.resuming === "webrtc/1", woke = resume && this.resumingWoke;
|
|
24452
|
+
if (this.automatic && this.resuming === "webrtc/1" && ranked.includes("iroh/1") && ranked.indexOf("iroh/1") < ranked.indexOf("webrtc/1")) this.resuming = "iroh/1";
|
|
24453
|
+
const chosen = this.switcher.chosenTarget ?? this.choiceApart?.transport ?? this.resuming;
|
|
24051
24454
|
if (chosen && chosen === this.resuming && ranked.includes(chosen)) {
|
|
24052
24455
|
this.resuming = void 0;
|
|
24053
24456
|
this.resumingWoke = false;
|
|
@@ -25155,6 +25558,7 @@ var GhostLink = class {
|
|
|
25155
25558
|
if (this.options.largeFilesSupport) offered.push(FILES_CAPABILITY);
|
|
25156
25559
|
if (this.options.largeFilesSupport && this.options.binaryFilesSupport && this.channel?.binary) offered.push(FILES_BINARY_CAPABILITY);
|
|
25157
25560
|
if (this.options.typingSupport) offered.push(TYPING_CAPABILITY);
|
|
25561
|
+
if (this.options.statusSupport) offered.push(STATUS_CAPABILITY);
|
|
25158
25562
|
if (this.options.reactionsSupport) offered.push(REACTIONS_CAPABILITY);
|
|
25159
25563
|
if (this.options.editSupport) offered.push(EDIT_CAPABILITY);
|
|
25160
25564
|
if (this.options.wakeSupport) offered.push(WAKE_SESSION_CAPABILITY);
|
|
@@ -25233,6 +25637,48 @@ var GhostLink = class {
|
|
|
25233
25637
|
get peerTypingActivity() {
|
|
25234
25638
|
return this.typingReceiver.peerActivity;
|
|
25235
25639
|
}
|
|
25640
|
+
/** Both sides offer `status/1` on the open session: presence and a set status can be said and shown. */
|
|
25641
|
+
get supportsStatus() {
|
|
25642
|
+
return !!this.options.params.profile && this.isDataLinkOpen && this.sessionCapabilities.agreed("status/1");
|
|
25643
|
+
}
|
|
25644
|
+
/** What the contact says of itself: presence while this session is live and it shares it, a status while it lasts. */
|
|
25645
|
+
get peerStatus() {
|
|
25646
|
+
return this.statusReceiver.peer;
|
|
25647
|
+
}
|
|
25648
|
+
/**
|
|
25649
|
+
* This side's presence and status (the whole state: `presence` left out when the person does not share it). Said on
|
|
25650
|
+
* the live session once both sides offer `status/1`, at most one frame per few seconds; kept for every next session.
|
|
25651
|
+
*/
|
|
25652
|
+
setStatus(state) {
|
|
25653
|
+
this.statusSender.set(state);
|
|
25654
|
+
this.flushStatus();
|
|
25655
|
+
}
|
|
25656
|
+
flushStatus() {
|
|
25657
|
+
if (this.statusTimer || !this.channel || !this.supportsStatus) return;
|
|
25658
|
+
const next = this.statusSender.take();
|
|
25659
|
+
if (!next) return;
|
|
25660
|
+
if ("wait" in next) {
|
|
25661
|
+
this.statusTimer = setTimeout(() => {
|
|
25662
|
+
this.statusTimer = null;
|
|
25663
|
+
this.flushStatus();
|
|
25664
|
+
}, next.wait);
|
|
25665
|
+
return;
|
|
25666
|
+
}
|
|
25667
|
+
try {
|
|
25668
|
+
this.channel.send(JSON.stringify(next.frame));
|
|
25669
|
+
} catch {
|
|
25670
|
+
this.statusSender.reset();
|
|
25671
|
+
}
|
|
25672
|
+
}
|
|
25673
|
+
/** The session ended: the contact is not online here any more, and the next session is owed this side's whole state. */
|
|
25674
|
+
endStatusSession() {
|
|
25675
|
+
if (this.statusTimer) {
|
|
25676
|
+
clearTimeout(this.statusTimer);
|
|
25677
|
+
this.statusTimer = null;
|
|
25678
|
+
}
|
|
25679
|
+
this.statusSender.reset();
|
|
25680
|
+
this.statusReceiver.endSession();
|
|
25681
|
+
}
|
|
25236
25682
|
/** Both sides offer `wake/1` on the open session: push subscriptions can be shared (WISP 401 § Wake-up push). */
|
|
25237
25683
|
get supportsWake() {
|
|
25238
25684
|
return !!this.options.params.profile && this.isDataLinkOpen && this.sessionCapabilities.agreed("wake/1");
|
|
@@ -25449,8 +25895,8 @@ var GhostLink = class {
|
|
|
25449
25895
|
return this.supportsAppRanges && this.apps.peerOpen.has(app) ? null : "peer-closed";
|
|
25450
25896
|
}
|
|
25451
25897
|
/**
|
|
25452
|
-
* Lets the contact's `app` read `file` (what this side's app calls it) for as long as both have the app open
|
|
25453
|
-
* session: the serve id to tell it, or why not.
|
|
25898
|
+
* Lets the contact's `app` read `file` (what this side's app calls it) for as long as both have the app open, across
|
|
25899
|
+
* a session change the apps are held across: the serve id to tell it, or why not.
|
|
25454
25900
|
*/
|
|
25455
25901
|
serveAppFile(app, file) {
|
|
25456
25902
|
const error = this.appRangesRefusal(app);
|
|
@@ -25460,7 +25906,7 @@ var GhostLink = class {
|
|
|
25460
25906
|
unserveAppFile(serve) {
|
|
25461
25907
|
return this.appRanges.unserve(serve);
|
|
25462
25908
|
}
|
|
25463
|
-
/** The serve ids `app` has given out
|
|
25909
|
+
/** The serve ids `app` has given out and not ended. */
|
|
25464
25910
|
appServes(app) {
|
|
25465
25911
|
return this.appRanges.servesOf(app);
|
|
25466
25912
|
}
|
|
@@ -25548,7 +25994,7 @@ var GhostLink = class {
|
|
|
25548
25994
|
* gives what it held its own grace: a later one's apps do not close at an earlier one's time.
|
|
25549
25995
|
*/
|
|
25550
25996
|
appsSuspended() {
|
|
25551
|
-
this.appRanges.
|
|
25997
|
+
this.appRanges.suspend();
|
|
25552
25998
|
this.apps.sessionSuspended(this.options.appResumeGraceMs ?? 1e4);
|
|
25553
25999
|
this.armAppsGrace();
|
|
25554
26000
|
}
|
|
@@ -25562,7 +26008,10 @@ var GhostLink = class {
|
|
|
25562
26008
|
if (until === void 0) return;
|
|
25563
26009
|
this.appsGrace = setTimeout(() => {
|
|
25564
26010
|
this.appsGrace = null;
|
|
25565
|
-
for (const event of this.apps.heldExpired())
|
|
26011
|
+
for (const event of this.apps.heldExpired()) {
|
|
26012
|
+
if ("o" in event && event.o === "close") this.appRanges.closeApp(event.app, "offline");
|
|
26013
|
+
this.options.events?.onAppFrame?.(event);
|
|
26014
|
+
}
|
|
25566
26015
|
this.armAppsGrace();
|
|
25567
26016
|
}, Math.max(0, until - Date.now()));
|
|
25568
26017
|
}
|
|
@@ -25713,6 +26162,10 @@ var GhostLink = class {
|
|
|
25713
26162
|
this.typingReceiver.clear();
|
|
25714
26163
|
} else this.resumeTyping();
|
|
25715
26164
|
}
|
|
26165
|
+
if (changed.includes("status/1")) {
|
|
26166
|
+
if (this.supportsStatus) this.flushStatus();
|
|
26167
|
+
else this.endStatusSession();
|
|
26168
|
+
}
|
|
25716
26169
|
if (changed.includes("react/1")) this.options.events?.onReactionsSupport?.(this.supportsReactions);
|
|
25717
26170
|
if (changed.includes("edit/1")) this.options.events?.onEditSupport?.(this.supportsEdits);
|
|
25718
26171
|
if (changed.includes("pin/1")) this.options.events?.onPinSupport?.(this.supportsPins);
|
|
@@ -25817,10 +26270,10 @@ var GhostLink = class {
|
|
|
25817
26270
|
}
|
|
25818
26271
|
try {
|
|
25819
26272
|
await new Promise((resolve, reject) => {
|
|
25820
|
-
let active = true;
|
|
26273
|
+
let active = true, notFound;
|
|
25821
26274
|
const timer = setTimeout(() => {
|
|
25822
26275
|
active = false;
|
|
25823
|
-
reject(/* @__PURE__ */ new Error(`${transport} did not connect in time`));
|
|
26276
|
+
reject(notFound ?? /* @__PURE__ */ new Error(`${transport} did not connect in time`));
|
|
25824
26277
|
}, 8e3);
|
|
25825
26278
|
const done = {
|
|
25826
26279
|
resolve: () => {
|
|
@@ -25848,17 +26301,26 @@ var GhostLink = class {
|
|
|
25848
26301
|
return;
|
|
25849
26302
|
}
|
|
25850
26303
|
const turn = (this.switchDials.get(transport) ?? Promise.resolve()).then(async () => {
|
|
25851
|
-
|
|
25852
|
-
|
|
25853
|
-
|
|
25854
|
-
|
|
25855
|
-
|
|
25856
|
-
|
|
26304
|
+
for (;;) {
|
|
26305
|
+
if (!active || epoch !== this.candidateEpoch || this.switcher.pending !== plan) return;
|
|
26306
|
+
this.switcher.dialing(plan);
|
|
26307
|
+
try {
|
|
26308
|
+
const { channel, binding } = await endpoint.connect(descriptor);
|
|
26309
|
+
if (!active || epoch !== this.candidateEpoch || this.switcher.pending !== plan) {
|
|
26310
|
+
channel.close();
|
|
26311
|
+
return;
|
|
26312
|
+
}
|
|
26313
|
+
this.attachCandidate(channel, binding, plan).then(done.resolve, done.reject);
|
|
25857
26314
|
return;
|
|
26315
|
+
} catch (error) {
|
|
26316
|
+
const failure = error instanceof Error ? error : new Error(String(error));
|
|
26317
|
+
if (!/^PEER_NOT_FOUND\b/.test(failure.message)) {
|
|
26318
|
+
done.reject(failure);
|
|
26319
|
+
return;
|
|
26320
|
+
}
|
|
26321
|
+
notFound = failure;
|
|
26322
|
+
await new Promise((resolve) => setTimeout(resolve, SWITCH_FIND_RETRY_MS));
|
|
25858
26323
|
}
|
|
25859
|
-
this.attachCandidate(channel, binding, plan).then(done.resolve, done.reject);
|
|
25860
|
-
} catch (error) {
|
|
25861
|
-
done.reject(error instanceof Error ? error : new Error(String(error)));
|
|
25862
26324
|
}
|
|
25863
26325
|
});
|
|
25864
26326
|
this.switchDials.set(transport, turn);
|
|
@@ -26242,6 +26704,7 @@ var GhostLink = class {
|
|
|
26242
26704
|
this.leaveHangUp();
|
|
26243
26705
|
this.typingSender.reset();
|
|
26244
26706
|
this.typingReceiver.clear();
|
|
26707
|
+
this.endStatusSession();
|
|
26245
26708
|
this.appsSuspended();
|
|
26246
26709
|
this.pairedHttp?.close();
|
|
26247
26710
|
this.pairedHttp = new PairedHttp(channel, this.options.getHostedHttpService, this.options.localFetch, this.bodiesOn(channel));
|
|
@@ -26336,6 +26799,7 @@ var GhostLink = class {
|
|
|
26336
26799
|
if (!frame || typeof frame !== "object") return;
|
|
26337
26800
|
if (paired.peerTransportSwitchSupport && this.switcher.handle(frame)) return;
|
|
26338
26801
|
if (frame.t === "paired-rtc") {
|
|
26802
|
+
if (!this.rtcSignalsReceived.take()) return;
|
|
26339
26803
|
if (this.switcher.pending?.choices.includes("webrtc/1") && typeof frame.signal === "string") {
|
|
26340
26804
|
const credentials = this.options.pairing.credentials;
|
|
26341
26805
|
const signal = verifyPairedSignal(frame.signal, this.options.params.peerPubKeyZ32, this.myPubKeyZ32, credentials.peerKey, true);
|
|
@@ -26437,6 +26901,10 @@ var GhostLink = class {
|
|
|
26437
26901
|
if (keys && this.askerReceived.take()) this.options.events?.onContactAsker?.(frame, keys);
|
|
26438
26902
|
return;
|
|
26439
26903
|
}
|
|
26904
|
+
if (frame?.t === "paired-status") {
|
|
26905
|
+
if (this.supportsStatus) this.statusReceiver.receive(frame);
|
|
26906
|
+
return;
|
|
26907
|
+
}
|
|
26440
26908
|
if (frame?.t === "paired-typing") {
|
|
26441
26909
|
if (this.supportsTyping) this.typingReceiver.receive(frame);
|
|
26442
26910
|
return;
|
|
@@ -26495,7 +26963,8 @@ var GhostLink = class {
|
|
|
26495
26963
|
return;
|
|
26496
26964
|
}
|
|
26497
26965
|
if (frame?.t === "paired-call") {
|
|
26498
|
-
|
|
26966
|
+
if (!this.supportsCalls || !this.callsReceived.take()) return;
|
|
26967
|
+
const signal = parsePairedCallFrame(frame);
|
|
26499
26968
|
if (signal && this.pairedCalls.heard(signal)) this.options.events?.onCallSignal?.(signal);
|
|
26500
26969
|
return;
|
|
26501
26970
|
}
|
|
@@ -27035,6 +27504,7 @@ var GhostLink = class {
|
|
|
27035
27504
|
this.sessionCapabilities.reset();
|
|
27036
27505
|
this.typingSender.reset();
|
|
27037
27506
|
this.typingReceiver.clear();
|
|
27507
|
+
this.endStatusSession();
|
|
27038
27508
|
this.appsSuspended();
|
|
27039
27509
|
this.emitFilesSession();
|
|
27040
27510
|
this.peerGroupsWereOn = false;
|
|
@@ -27997,8 +28467,8 @@ var VISUAL = /* @__PURE__ */ new Set([
|
|
|
27997
28467
|
"auxv",
|
|
27998
28468
|
"pict"
|
|
27999
28469
|
]);
|
|
28000
|
-
/** Zeros put in a Blob a
|
|
28001
|
-
var ZEROS = /* @__PURE__ */ new Uint8Array(1048576);
|
|
28470
|
+
/** Zeros put in a Blob a slice at a time: a Blob's Blob parts are not copied, so a zeroed range of any size holds no more. */
|
|
28471
|
+
var ZEROS = new Blob([/* @__PURE__ */ new Uint8Array(1048576)]);
|
|
28002
28472
|
var u32be = (b, at) => (b[at] << 24 >>> 0) + (b[at + 1] << 16) + (b[at + 2] << 8) + b[at + 3];
|
|
28003
28473
|
var text = (b, at, length) => String.fromCharCode(...b.subarray(at, at + length));
|
|
28004
28474
|
/** Refuses the video where its bytes are not what this expects. */
|
|
@@ -28373,7 +28843,7 @@ async function withoutVideoMetadata(source, mime) {
|
|
|
28373
28843
|
for (const patch of patches) {
|
|
28374
28844
|
if (patch.start > at) parts.push(source.slice(at, patch.start));
|
|
28375
28845
|
if (patch.bytes) parts.push(patch.bytes);
|
|
28376
|
-
else for (let left = patch.end - patch.start; left > 0; left -= ZEROS.
|
|
28846
|
+
else for (let left = patch.end - patch.start; left > 0; left -= ZEROS.size) parts.push(ZEROS.slice(0, Math.min(left, ZEROS.size)));
|
|
28377
28847
|
at = patch.end;
|
|
28378
28848
|
}
|
|
28379
28849
|
if (at < source.size) parts.push(source.slice(at));
|
|
@@ -32045,13 +32515,19 @@ function openGroupMeta(frame, messageKey) {
|
|
|
32045
32515
|
const body = decryptText(messageKey, boxAad(frame.statement.g, frame.k, frame.statement.d), frame.nn, frame.c);
|
|
32046
32516
|
if (body === null || sha256Hex(utf8Encode(body)) !== frame.statement.d) return null;
|
|
32047
32517
|
const parsed = parseGroupMetaBody(body);
|
|
32048
|
-
|
|
32049
|
-
|
|
32050
|
-
|
|
32051
|
-
|
|
32052
|
-
|
|
32053
|
-
|
|
32054
|
-
|
|
32518
|
+
if (!parsed) return null;
|
|
32519
|
+
const meta = {
|
|
32520
|
+
...frame.statement,
|
|
32521
|
+
body
|
|
32522
|
+
};
|
|
32523
|
+
parsedBodies.set(meta, {
|
|
32524
|
+
body,
|
|
32525
|
+
parsed
|
|
32526
|
+
});
|
|
32527
|
+
return {
|
|
32528
|
+
meta,
|
|
32529
|
+
body: copyBody(parsed)
|
|
32530
|
+
};
|
|
32055
32531
|
}
|
|
32056
32532
|
/** Is `a` later than `b`: signed under a later commit, or a higher revision under the same one. */
|
|
32057
32533
|
function groupMetaNewer(a, b) {
|
|
@@ -32094,13 +32570,40 @@ function parseGroupMetaTag(tag) {
|
|
|
32094
32570
|
r
|
|
32095
32571
|
};
|
|
32096
32572
|
}
|
|
32573
|
+
/**
|
|
32574
|
+
* Each kept statement's body as `parseGroupMetaBody` reads it, worked out once per statement: the sessions' `name` and
|
|
32575
|
+
* `picture` read it on every engine state, and checking a picture (`sanitizeAvatar`) costs ~0.2 ms at 40 KB. Keyed by
|
|
32576
|
+
* the statement object, so an entry goes with the statement it was made for; the body it was made from is kept beside
|
|
32577
|
+
* it, and a statement whose body was swapped in place is read again.
|
|
32578
|
+
*/
|
|
32579
|
+
var parsedBodies = /* @__PURE__ */ new WeakMap();
|
|
32580
|
+
function parsedBody(meta) {
|
|
32581
|
+
const hit = parsedBodies.get(meta);
|
|
32582
|
+
if (hit && hit.body === meta.body) return hit.parsed;
|
|
32583
|
+
const parsed = parseGroupMetaBody(meta.body);
|
|
32584
|
+
parsedBodies.set(meta, {
|
|
32585
|
+
body: meta.body,
|
|
32586
|
+
parsed
|
|
32587
|
+
});
|
|
32588
|
+
return parsed;
|
|
32589
|
+
}
|
|
32590
|
+
/** A body the caller may change without changing the one kept for its statement. */
|
|
32591
|
+
function copyBody(parsed) {
|
|
32592
|
+
const copy = { ...parsed };
|
|
32593
|
+
if (parsed.hubs) copy.hubs = {
|
|
32594
|
+
pin: [...parsed.hubs.pin],
|
|
32595
|
+
no: [...parsed.hubs.no]
|
|
32596
|
+
};
|
|
32597
|
+
return copy;
|
|
32598
|
+
}
|
|
32097
32599
|
/** What a kept statement's body says, `{}` for none. */
|
|
32098
32600
|
function groupMetaBody(meta) {
|
|
32099
|
-
|
|
32601
|
+
const parsed = meta && parsedBody(meta);
|
|
32602
|
+
return parsed ? copyBody(parsed) : {};
|
|
32100
32603
|
}
|
|
32101
32604
|
/** The picture a kept statement's body names, if it is one Ghostly shows. */
|
|
32102
32605
|
function groupMetaPicture(meta) {
|
|
32103
|
-
return
|
|
32606
|
+
return (meta && parsedBody(meta))?.pic;
|
|
32104
32607
|
}
|
|
32105
32608
|
/**
|
|
32106
32609
|
* The name members see: the one the admin's statement gives, else the name the group had when this member got in
|
|
@@ -32108,7 +32611,7 @@ function groupMetaPicture(meta) {
|
|
|
32108
32611
|
* names show, and what a member shows until the statement reaches them.
|
|
32109
32612
|
*/
|
|
32110
32613
|
function groupDisplayName(meta, first) {
|
|
32111
|
-
return
|
|
32614
|
+
return (meta && parsedBody(meta))?.name ?? first;
|
|
32112
32615
|
}
|
|
32113
32616
|
/**
|
|
32114
32617
|
* The name and picture that differ between two statements; null when neither does (hubs alone, or the same body signed
|
|
@@ -32945,6 +33448,12 @@ var GroupSession = class {
|
|
|
32945
33448
|
* them is not handed them again at every sync. In memory only.
|
|
32946
33449
|
*/
|
|
32947
33450
|
leaversHanded = /* @__PURE__ */ new Map();
|
|
33451
|
+
/**
|
|
33452
|
+
* The kept edits each hub I count on was handed that it cannot read (`editKey`): of epochs from before it was let in,
|
|
33453
|
+
* for it to carry to the members of those epochs. Each goes to a hub once while my app runs, not at every sync of its
|
|
33454
|
+
* own. In memory only.
|
|
33455
|
+
*/
|
|
33456
|
+
carriedHanded = /* @__PURE__ */ new Map();
|
|
32948
33457
|
/** Syncs answered per member, a few a minute (`GROUP_LIMITS.syncAnswers`). In memory only. */
|
|
32949
33458
|
syncsAnswered = /* @__PURE__ */ new Map();
|
|
32950
33459
|
/**
|
|
@@ -32991,7 +33500,12 @@ var GroupSession = class {
|
|
|
32991
33500
|
const handed = this.leaversHanded.get(to) ?? /* @__PURE__ */ new Set();
|
|
32992
33501
|
this.leaversHanded.set(to, handed.add(editKey(frame)));
|
|
32993
33502
|
}
|
|
32994
|
-
|
|
33503
|
+
const took = hooks.send(to, frame);
|
|
33504
|
+
if (took !== false && frame.t === "group-edit" && !rosterHas(this.state.chain[frame.e]?.m ?? [], to)) {
|
|
33505
|
+
const carried = this.carriedHanded.get(to) ?? /* @__PURE__ */ new Set();
|
|
33506
|
+
this.carriedHanded.set(to, carried.add(editKey(frame)));
|
|
33507
|
+
}
|
|
33508
|
+
return took;
|
|
32995
33509
|
},
|
|
32996
33510
|
...hooks.handled && { handled: (to) => hooks.handled(to) },
|
|
32997
33511
|
active: () => this.state.status === "active",
|
|
@@ -34865,8 +35379,14 @@ var GroupSession = class {
|
|
|
34865
35379
|
answer.push(f);
|
|
34866
35380
|
}
|
|
34867
35381
|
const readable = (f) => !!this.state.chain[f.e] && rosterHas(this.state.chain[f.e].m, from);
|
|
35382
|
+
const carrier = !!this.hooks.carriers?.().includes(from), carried = this.carriedHanded.get(from);
|
|
35383
|
+
if (carried) {
|
|
35384
|
+
const held = new Set((this.state.relayEdits ?? []).map(editKey));
|
|
35385
|
+
for (const key of carried) if (!held.has(key)) carried.delete(key);
|
|
35386
|
+
}
|
|
35387
|
+
const owed = (f) => readable(f) || carrier && !!this.state.chain[f.e] && !carried?.has(editKey(f));
|
|
34868
35388
|
for (const author of asked) {
|
|
34869
|
-
const edits = (this.state.relayEdits ?? []).filter((f) => f.s === author &&
|
|
35389
|
+
const edits = (this.state.relayEdits ?? []).filter((f) => f.s === author && owed(f));
|
|
34870
35390
|
answer.push(...edits.slice(-GROUP_LIMITS.handOnEdits));
|
|
34871
35391
|
}
|
|
34872
35392
|
const handed = this.leaversHanded.get(from);
|
|
@@ -35839,6 +36359,14 @@ var CommunitySession = class CommunitySession {
|
|
|
35839
36359
|
asked = /* @__PURE__ */ new Map();
|
|
35840
36360
|
/** Per member: until when what comes over its edge may be its answer to my sync (`ANSWER_WINDOW_MS`). In memory only. */
|
|
35841
36361
|
answering = /* @__PURE__ */ new Map();
|
|
36362
|
+
/**
|
|
36363
|
+
* Per member asked: what my sync said I have (`have`), the highest number its answer handed per author and commit
|
|
36364
|
+
* (`top`), and whether anything of the answer came (`heard`). Once the answer is over (`settleGaps`), what it did
|
|
36365
|
+
* not fill below those is nobody's to hand (a hint, never kept; a frame out of every store). In memory only.
|
|
36366
|
+
*/
|
|
36367
|
+
answerOf = /* @__PURE__ */ new Map();
|
|
36368
|
+
/** Author → `e:h16` → the number up to which a gap is gone (`settleGaps`), not on its way: `missing` leaves it out. In memory only. */
|
|
36369
|
+
gapsGone = {};
|
|
35842
36370
|
/** The message frames given to `handle` that came live here (`CommunityIncomingMessage.live`): `passOn` marks them. */
|
|
35843
36371
|
cameLive = /* @__PURE__ */ new WeakSet();
|
|
35844
36372
|
/** Syncs answered per member, a few a minute (`COMMUNITY_LIMITS.syncAnswers`). In memory only. */
|
|
@@ -35861,6 +36389,10 @@ var CommunitySession = class CommunitySession {
|
|
|
35861
36389
|
onRows = /* @__PURE__ */ new Map();
|
|
35862
36390
|
/** The oldest epoch whose seen marks are kept, as of the last `pruneSeen`. In memory only. */
|
|
35863
36391
|
seenFrom = -1;
|
|
36392
|
+
/** The secret of the epoch I left in (`leave`), for `followAfterLeave`. In memory only. */
|
|
36393
|
+
leftSecret;
|
|
36394
|
+
/** After my leave, still taking commits and secrets (`followAfterLeave`). In memory only. */
|
|
36395
|
+
following = false;
|
|
35864
36396
|
/** `rows`: the frames the app holds with the messages it stored (`CommunityIncomingMessage.frame`). They join the store. */
|
|
35865
36397
|
constructor(state, hooks, rows = []) {
|
|
35866
36398
|
this.hooks = hooks;
|
|
@@ -36267,13 +36799,50 @@ var CommunitySession = class CommunitySession {
|
|
|
36267
36799
|
commit
|
|
36268
36800
|
}));
|
|
36269
36801
|
}
|
|
36802
|
+
/**
|
|
36803
|
+
* How many of a member's messages under the current commit are known to be missing: on their way, not gone (a
|
|
36804
|
+
* finished answer did not fill it, `settleGaps`; or syncs gave it up, `haveOf`). A hint spends its author's number
|
|
36805
|
+
* and is never kept (WISP 903), so a member who was away counted it missing until the commit changed.
|
|
36806
|
+
*/
|
|
36270
36807
|
missing(sender) {
|
|
36271
|
-
|
|
36808
|
+
this.settleAnswers();
|
|
36809
|
+
const key = seenKey(this.epoch, shortHash(this.topHash));
|
|
36810
|
+
const entry = this.state.seen[sender]?.[key];
|
|
36272
36811
|
if (!entry) return 0;
|
|
36273
|
-
const lowest = Math.max(0, entry.high - COMMUNITY_LIMITS.replay + 1);
|
|
36812
|
+
const lowest = Math.max(0, entry.high - COMMUNITY_LIMITS.replay + 1, (entry.floor ?? -1) + 1, (this.gapsGone[sender]?.[key] ?? -1) + 1);
|
|
36274
36813
|
return Math.max(0, entry.high - lowest + 1 - (1 + entry.window.filter((n) => n >= lowest).length));
|
|
36275
36814
|
}
|
|
36276
36815
|
/**
|
|
36816
|
+
* Gaps that the answers now over did not fill count as gone: an answer hands every frame its member holds above what
|
|
36817
|
+
* my sync said I have, so a number below my mark then, or below the highest it handed, that is still not here is
|
|
36818
|
+
* held by nobody. Returns whether some became gone (the members view changes). A sync nobody answered settles nothing.
|
|
36819
|
+
*/
|
|
36820
|
+
settleGaps() {
|
|
36821
|
+
const changed = this.settleAnswers();
|
|
36822
|
+
for (const [sender, byKey] of Object.entries(this.gapsGone)) {
|
|
36823
|
+
for (const key of Object.keys(byKey)) if (!this.state.seen[sender]?.[key]) delete byKey[key];
|
|
36824
|
+
if (!Object.keys(byKey).length) delete this.gapsGone[sender];
|
|
36825
|
+
}
|
|
36826
|
+
return changed;
|
|
36827
|
+
}
|
|
36828
|
+
/** The gaps of the answers now over (`settleGaps`), without the prune. */
|
|
36829
|
+
settleAnswers() {
|
|
36830
|
+
if (!this.answerOf.size) return false;
|
|
36831
|
+
const now = this.hooks.clock?.() ?? Date.now();
|
|
36832
|
+
let changed = false;
|
|
36833
|
+
for (const [from, answer] of this.answerOf) {
|
|
36834
|
+
if ((this.answering.get(from) ?? 0) > now) continue;
|
|
36835
|
+
this.answerOf.delete(from);
|
|
36836
|
+
if (!answer.heard) continue;
|
|
36837
|
+
for (const marks of [answer.have, answer.top]) for (const [sender, byKey] of Object.entries(marks)) for (const [key, upTo] of Object.entries(byKey)) {
|
|
36838
|
+
if (!this.state.seen[sender]?.[key] || upTo <= (this.gapsGone[sender]?.[key] ?? -1)) continue;
|
|
36839
|
+
(this.gapsGone[sender] ??= {})[key] = upTo;
|
|
36840
|
+
changed = true;
|
|
36841
|
+
}
|
|
36842
|
+
}
|
|
36843
|
+
return changed;
|
|
36844
|
+
}
|
|
36845
|
+
/**
|
|
36277
36846
|
* Replays the main branch (rosters kept for its window) and places the side commits. The main branch was verified
|
|
36278
36847
|
* commit by commit when it was accepted: its signatures are not checked again.
|
|
36279
36848
|
*/
|
|
@@ -36720,19 +37289,33 @@ var CommunitySession = class CommunitySession {
|
|
|
36720
37289
|
}
|
|
36721
37290
|
for (const h of Object.keys(this.state.secrets)) if (!keep.has(h)) delete this.state.secrets[h];
|
|
36722
37291
|
}
|
|
37292
|
+
/** The epoch of the commit on the main branch that took `key` out (`outIndex`), while it is out. */
|
|
37293
|
+
outEpoch(key) {
|
|
37294
|
+
const i = this.outIndex(key);
|
|
37295
|
+
return i < 0 ? void 0 : this.state.chain[i].e;
|
|
37296
|
+
}
|
|
37297
|
+
/**
|
|
37298
|
+
* Whether `key` reads commit `h`, so its secret may be sealed to it or taken by it: in its roster, and not out by then.
|
|
37299
|
+
* A member stops being one at the commit that takes it out: a side branch from before it may list it still, at that
|
|
37300
|
+
* epoch or later, and that epoch's secret and every later one never reach it.
|
|
37301
|
+
*/
|
|
37302
|
+
readsAt(h, key, out = this.outEpoch(key)) {
|
|
37303
|
+
const c = this.known.get(h);
|
|
37304
|
+
return !!c && rosterHas(this.rosterAt(h) ?? [], key) && (out === void 0 || c.e < out);
|
|
37305
|
+
}
|
|
36723
37306
|
/** A derived epoch's secret, from its parent's, when that is held. */
|
|
36724
37307
|
takeDerived(h) {
|
|
36725
37308
|
const c = this.known.get(h);
|
|
36726
37309
|
if (!c || this.state.secrets[h] || FRESH.has(c.k)) return;
|
|
36727
37310
|
const parent = this.state.secrets[c.p];
|
|
36728
|
-
if (!parent || !
|
|
37311
|
+
if (!parent || !this.readsAt(h, this.myKey)) return;
|
|
36729
37312
|
const secret = derivedSecret(fromBase64Url(parent), communityUntaggedHash(c));
|
|
36730
37313
|
if (confirmationMatches(epochKeys(secret, this.id, c.e).confirm, communityUntaggedHash(c), c.c)) {
|
|
36731
37314
|
this.state.secrets[h] = toBase64Url(secret);
|
|
36732
37315
|
for (const [child, cc] of this.known) if (cc.p === h) this.takeDerived(child);
|
|
36733
37316
|
}
|
|
36734
37317
|
}
|
|
36735
|
-
/** A sealed secret for a known commit I
|
|
37318
|
+
/** A sealed secret for a known commit I read (`readsAt`): kept only when it confirms. */
|
|
36736
37319
|
takeSecret(h, sealed) {
|
|
36737
37320
|
const c = this.known.get(h);
|
|
36738
37321
|
if (!c) {
|
|
@@ -36747,7 +37330,7 @@ var CommunitySession = class CommunitySession {
|
|
|
36747
37330
|
});
|
|
36748
37331
|
return false;
|
|
36749
37332
|
}
|
|
36750
|
-
if (this.state.secrets[h] || !isSealed(sealed) || !
|
|
37333
|
+
if (this.state.secrets[h] || !isSealed(sealed) || !this.readsAt(h, this.myKey)) return false;
|
|
36751
37334
|
const secret = openSecret(this.identity.seed, this.myKey, sealed, secretAad(this.id, h, this.myKey));
|
|
36752
37335
|
if (!secret || !confirmationMatches(epochKeys(secret, this.id, c.e).confirm, communityUntaggedHash(c), c.c)) return false;
|
|
36753
37336
|
this.state.secrets[h] = toBase64Url(secret);
|
|
@@ -37027,9 +37610,10 @@ var CommunitySession = class CommunitySession {
|
|
|
37027
37610
|
}
|
|
37028
37611
|
/**
|
|
37029
37612
|
* Leaves: a signed request any other member commits, and my secrets go now. The admin must
|
|
37030
|
-
* hand over the role first (the engine does it for a leaving admin).
|
|
37613
|
+
* hand over the role first (the engine does it for a leaving admin). `follow`: commits and secrets are still taken
|
|
37614
|
+
* after (`followAfterLeave`).
|
|
37031
37615
|
*/
|
|
37032
|
-
leave() {
|
|
37616
|
+
leave(follow = false) {
|
|
37033
37617
|
return this.serialize(async () => {
|
|
37034
37618
|
if (this.state.status !== "active") return null;
|
|
37035
37619
|
if (this.isAdmin && this.others.length) throw new Error("Make someone else the admin before leaving");
|
|
@@ -37045,19 +37629,66 @@ var CommunitySession = class CommunitySession {
|
|
|
37045
37629
|
break;
|
|
37046
37630
|
}
|
|
37047
37631
|
this.hooks.broadcast(frame);
|
|
37632
|
+
const tip = this.state.secrets[this.topHash];
|
|
37633
|
+
this.leftSecret = tip ? {
|
|
37634
|
+
h: this.topHash,
|
|
37635
|
+
s: tip
|
|
37636
|
+
} : void 0;
|
|
37048
37637
|
this.out("left", "You left this group");
|
|
37638
|
+
this.following = follow;
|
|
37049
37639
|
await this.persist();
|
|
37050
37640
|
this.hooks.changed();
|
|
37051
37641
|
return frame;
|
|
37052
37642
|
});
|
|
37053
37643
|
}
|
|
37644
|
+
/**
|
|
37645
|
+
* After I left with `follow` (WISP 903 § Leaving, "A role that reaches a leave"): commits and secrets are taken still,
|
|
37646
|
+
* as a member whose admission lost takes them, so a hand-over that crossed my leave reaches me (`handOnAfterLeave`).
|
|
37647
|
+
* Once the app has forgotten the group (nothing is saved any more), the secret of the epoch I left in comes back, in
|
|
37648
|
+
* memory only, for the epochs derived from it. Nothing else is heard.
|
|
37649
|
+
*/
|
|
37650
|
+
followAfterLeave() {
|
|
37651
|
+
return this.serialize(async () => {
|
|
37652
|
+
if (!this.following || this.state.status !== "left") return;
|
|
37653
|
+
const kept = this.leftSecret;
|
|
37654
|
+
if (!kept) return;
|
|
37655
|
+
this.state.secrets[kept.h] = kept.s;
|
|
37656
|
+
for (const [child, c] of this.known) if (c.p === kept.h) this.takeDerived(child);
|
|
37657
|
+
});
|
|
37658
|
+
}
|
|
37659
|
+
/**
|
|
37660
|
+
* After I left, a chain that names me the admin (a hand-over that crossed my leave): the role goes on to
|
|
37661
|
+
* `pick(<the member who handed it to me>)` with a `role` commit of mine, as an admin's leave hands it. Who handed it is
|
|
37662
|
+
* the signer of the newest `role` on my branch, whatever members committed on top since: an admission there would
|
|
37663
|
+
* otherwise steer the role to whoever let someone in. True when it went; false while the secret of my tip has not
|
|
37664
|
+
* come (it is tried again).
|
|
37665
|
+
*/
|
|
37666
|
+
handOnAfterLeave(pick, now = Date.now()) {
|
|
37667
|
+
return this.serialize(async () => {
|
|
37668
|
+
if (!this.following || this.state.status !== "left" || this.admin !== this.myKey || !this.state.secrets[this.topHash]) return false;
|
|
37669
|
+
const next = pick([...this.state.chain].reverse().find((c) => c.k === "role" || c.k === "create").by);
|
|
37670
|
+
if (!next || next === this.myKey || !rosterHas(this.roster, next)) return false;
|
|
37671
|
+
await this.commit("role", { s: next }, now);
|
|
37672
|
+
return true;
|
|
37673
|
+
});
|
|
37674
|
+
}
|
|
37675
|
+
/**
|
|
37676
|
+
* After I left, a chain that names me the admin whose tip's secret has not come (the fresh one of a commit below went
|
|
37677
|
+
* missing): the engine asks my edges for it (`catchUp`) while I follow, so the role can go on. Only what I still read
|
|
37678
|
+
* comes back (`readsAt`): epochs before the commit that takes me out, never that one's nor any later.
|
|
37679
|
+
*/
|
|
37680
|
+
get leftWaitsForSecret() {
|
|
37681
|
+
return this.following && this.state.status === "left" && this.admin === this.myKey && !this.state.secrets[this.topHash];
|
|
37682
|
+
}
|
|
37054
37683
|
/** Commits the leave requests I hold whose members are still in: the engine calls this on hubs. */
|
|
37055
37684
|
commitPendingLeaves(now = Date.now()) {
|
|
37056
37685
|
return this.serialize(async () => {
|
|
37057
37686
|
if (!this.isMember || !this.adminWork) return 0;
|
|
37058
37687
|
if (this.state.pendingLeaves.length && this.hooks.adminTurn && !await this.hooks.adminTurn()) return 0;
|
|
37059
37688
|
let done = 0;
|
|
37689
|
+
const handedBy = this.state.pendingLeaves.some((r) => r.s === this.admin) ? [...this.state.chain].reverse().find((c) => c.k === "role")?.by : void 0;
|
|
37060
37690
|
for (const request of [...this.state.pendingLeaves]) {
|
|
37691
|
+
if ((request.s === handedBy || request.s === this.admin) && request.s !== this.myKey && rosterHas(this.roster, request.s)) continue;
|
|
37061
37692
|
if (!rosterHas(this.roster, request.s) || request.s === this.myKey || request.s === this.admin) {
|
|
37062
37693
|
this.state.pendingLeaves = this.state.pendingLeaves.filter((r) => r !== request);
|
|
37063
37694
|
continue;
|
|
@@ -37630,6 +38261,14 @@ var CommunitySession = class CommunitySession {
|
|
|
37630
38261
|
const key = seenKey(f.e, f.h);
|
|
37631
38262
|
(have[f.s] ??= {})[key] ??= Math.max(f.n, this.state.seen[f.s]?.[key]?.high ?? -1);
|
|
37632
38263
|
}
|
|
38264
|
+
if (to) {
|
|
38265
|
+
const open = this.answerOf.get(to);
|
|
38266
|
+
this.answerOf.set(to, {
|
|
38267
|
+
have: Object.fromEntries(Object.entries(have).map(([sender, byKey]) => [sender, { ...byKey }])),
|
|
38268
|
+
top: open?.top ?? {},
|
|
38269
|
+
heard: open?.heard ?? false
|
|
38270
|
+
});
|
|
38271
|
+
}
|
|
37633
38272
|
const secrets = this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => communityCommitHash(c)).filter((h) => this.state.secrets[h]).map(shortHash);
|
|
37634
38273
|
const loc = [];
|
|
37635
38274
|
for (let back = 1; back < this.state.chain.length && loc.length < 12; back *= 2) loc.push(communityCommitHash(this.state.chain[this.state.chain.length - 1 - back]));
|
|
@@ -37655,8 +38294,12 @@ var CommunitySession = class CommunitySession {
|
|
|
37655
38294
|
const frame = raw;
|
|
37656
38295
|
if (frame.g !== this.id || frame.v !== 2) return false;
|
|
37657
38296
|
const now = this.hooks.clock?.() ?? Date.now();
|
|
37658
|
-
if ((this.answering.get(from) ?? 0) > now)
|
|
37659
|
-
|
|
38297
|
+
if ((this.answering.get(from) ?? 0) > now) {
|
|
38298
|
+
this.answering.set(from, now + ANSWER_WINDOW_MS);
|
|
38299
|
+
const answer = this.answerOf.get(from);
|
|
38300
|
+
if (answer) answer.heard = true;
|
|
38301
|
+
}
|
|
38302
|
+
if (this.state.status !== "active" && !((this.state.status === "lost" || this.following) && (frame.t === "group-commit" || frame.t === "group-secret" || frame.t === "group-secrets"))) return false;
|
|
37660
38303
|
switch (frame.t) {
|
|
37661
38304
|
case "group-msg": return this.receiveMessage(from, raw);
|
|
37662
38305
|
case "group-commit": return this.receiveCommit(from, frame.commit);
|
|
@@ -37699,6 +38342,23 @@ var CommunitySession = class CommunitySession {
|
|
|
37699
38342
|
this.hooks.changed();
|
|
37700
38343
|
await this.replayWaiting();
|
|
37701
38344
|
}
|
|
38345
|
+
/**
|
|
38346
|
+
* The member a leave frame is from, when that member signed it and is in this admission (as `receiveLeave` checks);
|
|
38347
|
+
* else undefined. For an app that left and follows the chain (`followAfterLeave`): it holds no requests, and a leave
|
|
38348
|
+
* it counts takes that member out of whom a role that reached it goes on to.
|
|
38349
|
+
*/
|
|
38350
|
+
signedLeave(frame) {
|
|
38351
|
+
const s = frame.s, ls = frame.ls;
|
|
38352
|
+
if (typeof s !== "string" || !MEMBER_KEY.test(s) || typeof ls !== "string" || !SIG.test(ls) || !rosterHas(this.roster, s)) return void 0;
|
|
38353
|
+
const ls3 = typeof frame.ls3 === "string" && SIG.test(frame.ls3) ? frame.ls3 : void 0;
|
|
38354
|
+
if (!verify(fromBase64Url(ls), leaveStatement(this.id, s), publicKeyFromZ32(s))) return void 0;
|
|
38355
|
+
return leaveStands({
|
|
38356
|
+
g: this.id,
|
|
38357
|
+
s,
|
|
38358
|
+
ls,
|
|
38359
|
+
ls3
|
|
38360
|
+
}, this.ancestry(this.topHash)) ? s : void 0;
|
|
38361
|
+
}
|
|
37702
38362
|
receiveLeave(frame) {
|
|
37703
38363
|
const s = frame.s, ls = frame.ls;
|
|
37704
38364
|
if (typeof s !== "string" || !MEMBER_KEY.test(s) || typeof ls !== "string" || !SIG.test(ls) || !rosterHas(this.roster, s)) return false;
|
|
@@ -37752,7 +38412,10 @@ var CommunitySession = class CommunitySession {
|
|
|
37752
38412
|
const now = this.hooks.clock?.() ?? Date.now();
|
|
37753
38413
|
const live = !waited && (raw.s === from ? (this.answering.get(from) ?? 0) <= now : mark === from && rosterHas(this.roster, from) && now - raw.ts <= COMMUNITY_LIMITS.liveMarkMs);
|
|
37754
38414
|
if (live) this.cameLive.add(input);
|
|
37755
|
-
if (this.isDuplicate(raw))
|
|
38415
|
+
if (this.isDuplicate(raw)) {
|
|
38416
|
+
this.handedInAnswer(from, raw, now);
|
|
38417
|
+
return false;
|
|
38418
|
+
}
|
|
37756
38419
|
if (!verify(fromBase64Url(raw.sig), messageSigned(raw), publicKeyFromZ32(raw.s))) return false;
|
|
37757
38420
|
if (!this.heardAfterOut(raw)) return false;
|
|
37758
38421
|
const found = this.commitByShort(raw.e, raw.h);
|
|
@@ -37765,6 +38428,7 @@ var CommunitySession = class CommunitySession {
|
|
|
37765
38428
|
let pace = this.messagePace.get(raw.s);
|
|
37766
38429
|
if (!pace) this.messagePace.set(raw.s, pace = new MessagePace());
|
|
37767
38430
|
if (!pace.take(seenKey(raw.e, raw.h), raw.n, raw.c.length, this.hooks.clock?.() ?? Date.now())) return false;
|
|
38431
|
+
this.handedInAnswer(from, raw, now);
|
|
37768
38432
|
if (!rosterHas(roster, this.myKey)) {
|
|
37769
38433
|
this.markSeen(raw);
|
|
37770
38434
|
this.keep(raw);
|
|
@@ -37946,6 +38610,13 @@ var CommunitySession = class CommunitySession {
|
|
|
37946
38610
|
];
|
|
37947
38611
|
return gap - 1;
|
|
37948
38612
|
}
|
|
38613
|
+
/** A frame (known to be its author's) from a member whose answer to my sync is open: the highest it handed (`settleGaps`). */
|
|
38614
|
+
handedInAnswer(from, f, now) {
|
|
38615
|
+
const answer = (this.answering.get(from) ?? 0) > now ? this.answerOf.get(from) : void 0;
|
|
38616
|
+
if (!answer) return;
|
|
38617
|
+
const byKey = answer.top[f.s] ??= {}, key = seenKey(f.e, f.h);
|
|
38618
|
+
byKey[key] = Math.max(f.n, byKey[key] ?? -1);
|
|
38619
|
+
}
|
|
37949
38620
|
markSeen(f) {
|
|
37950
38621
|
const bySender = this.state.seen[f.s] ??= {};
|
|
37951
38622
|
const entry = bySender[seenKey(f.e, f.h)] ??= {
|
|
@@ -37993,11 +38664,8 @@ var CommunitySession = class CommunitySession {
|
|
|
37993
38664
|
}
|
|
37994
38665
|
/** My sync for a member, unless I asked it a moment ago. */
|
|
37995
38666
|
question(from) {
|
|
37996
|
-
|
|
37997
|
-
|
|
37998
|
-
this.asked.set(from, now);
|
|
37999
|
-
this.answering.set(from, now + ANSWER_WINDOW_MS);
|
|
38000
|
-
return this.syncFrame();
|
|
38667
|
+
if ((this.hooks.clock?.() ?? Date.now()) - (this.asked.get(from) ?? 0) < 5e3) return null;
|
|
38668
|
+
return this.syncFrame(from);
|
|
38001
38669
|
}
|
|
38002
38670
|
async replayWaiting() {
|
|
38003
38671
|
await this.metaFollowsChain();
|
|
@@ -38046,6 +38714,7 @@ var CommunitySession = class CommunitySession {
|
|
|
38046
38714
|
start = common !== void 0 ? this.mainIndex.get(common) + 1 : Math.max(0, this.state.chain.length - COMMUNITY_LIMITS.side);
|
|
38047
38715
|
ask();
|
|
38048
38716
|
}
|
|
38717
|
+
const out = this.outEpoch(from);
|
|
38049
38718
|
for (let i = start; i < this.state.chain.length; i++) {
|
|
38050
38719
|
const commit = this.state.chain[i], h = communityCommitHash(commit);
|
|
38051
38720
|
answer.push({
|
|
@@ -38055,7 +38724,7 @@ var CommunitySession = class CommunitySession {
|
|
|
38055
38724
|
commit
|
|
38056
38725
|
});
|
|
38057
38726
|
const secret = this.state.secrets[h];
|
|
38058
|
-
if (secret &&
|
|
38727
|
+
if (secret && this.readsAt(h, from, out) && FRESH.has(commit.k)) answer.push({
|
|
38059
38728
|
t: "group-secret",
|
|
38060
38729
|
v: 2,
|
|
38061
38730
|
g: this.id,
|
|
@@ -38065,7 +38734,7 @@ var CommunitySession = class CommunitySession {
|
|
|
38065
38734
|
});
|
|
38066
38735
|
}
|
|
38067
38736
|
const held = new Set(Array.isArray(frame.secrets) ? frame.secrets.filter((x) => typeof x === "string") : []);
|
|
38068
|
-
const secrets = this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => communityCommitHash(c)).filter((h) => this.state.secrets[h] && !held.has(shortHash(h)) &&
|
|
38737
|
+
const secrets = this.state.chain.slice(-COMMUNITY_LIMITS.window - 1).map((c) => communityCommitHash(c)).filter((h) => this.state.secrets[h] && !held.has(shortHash(h)) && this.readsAt(h, from, out)).map((h) => ({
|
|
38069
38738
|
h,
|
|
38070
38739
|
s: sealSecret(from, fromBase64Url(this.state.secrets[h]), secretAad(this.id, h, from))
|
|
38071
38740
|
}));
|
|
@@ -38090,9 +38759,9 @@ var CommunitySession = class CommunitySession {
|
|
|
38090
38759
|
if (!this.heardAfterOut(stored)) continue;
|
|
38091
38760
|
const found = this.commitByShort(stored.e, stored.h);
|
|
38092
38761
|
if (!found) continue;
|
|
38093
|
-
const reads =
|
|
38762
|
+
const reads = this.readsAt(found.hash, from, out), mine = stored.s === this.myKey && unheard.has(frameKey(stored));
|
|
38094
38763
|
if (!reads && !(mine && rosterHas(this.roster, from))) continue;
|
|
38095
|
-
if (!this.mainIndex.has(found.hash)) this.handSide(from, found.hash, handed, answer);
|
|
38764
|
+
if (!this.mainIndex.has(found.hash)) this.handSide(from, found.hash, handed, answer, out);
|
|
38096
38765
|
if (!rosterHas(this.roster, stored.s) && !marked.has(stored.s)) {
|
|
38097
38766
|
marked.add(stored.s);
|
|
38098
38767
|
const left = this.leftFrame(stored.s);
|
|
@@ -38121,7 +38790,7 @@ var CommunitySession = class CommunitySession {
|
|
|
38121
38790
|
this.answers.handOut(from, answer);
|
|
38122
38791
|
}
|
|
38123
38792
|
/** The commits of a branch I do not follow, from where it leaves mine, and the secrets I hold of those `to` was in, onto `answer`. */
|
|
38124
|
-
handSide(to, tip, handed, answer) {
|
|
38793
|
+
handSide(to, tip, handed, answer, out = this.outEpoch(to)) {
|
|
38125
38794
|
for (const h of this.pathToMain(tip) ?? []) {
|
|
38126
38795
|
if (handed.has(h)) continue;
|
|
38127
38796
|
handed.add(h);
|
|
@@ -38132,7 +38801,7 @@ var CommunitySession = class CommunitySession {
|
|
|
38132
38801
|
commit: this.known.get(h)
|
|
38133
38802
|
});
|
|
38134
38803
|
const secret = this.state.secrets[h];
|
|
38135
|
-
if (secret &&
|
|
38804
|
+
if (secret && this.readsAt(h, to, out)) answer.push({
|
|
38136
38805
|
t: "group-secret",
|
|
38137
38806
|
v: 2,
|
|
38138
38807
|
g: this.id,
|
|
@@ -39002,6 +39671,6 @@ function readX401SdJwtVc(text) {
|
|
|
39002
39671
|
};
|
|
39003
39672
|
}
|
|
39004
39673
|
//#endregion
|
|
39005
|
-
export { SSHSIG_NAMESPACE as $, ReactionWindow as $a, openRequest as $c, HOLD_DATED_BACK_MS as $i, deviceEchoFrame as $l, engineError as $n, PRESENCE_WINDOW as $o, PIN_LIMITS as $r, handoffReleaseFrame as $s, ONCHAIN_PROVIDER as $t, sanitizeDisplayText as $u, knockIdentity as A, VOICE_LIMITS as Aa, enrollProofFrame as Ac, IDENTITY_REVOCATION_LABEL as Ai, signAppObject as Al, ENDPOINT as An, claimedTime as Ao, lobbyKeys as Ar, HANDOFF_HELLO as As, didJwsAlg as At, currentRelays as Au, GROUP_REACTED_FRAME as B, EDIT_RATE_WINDOW_MS as Ba, takeRequest as Bc, newIdentityBinding as Bi, createDeviceInvite as Bl, NO_PICTURE_METADATA as Bn, rosterAdmin as Bo, shouldBeHub as Br, handoffAttemptFailed as Bs, parseDidSignaturePaste as Bt, RELAY_PAYLOAD_MAX_BYTES as Bu, communityHasFrame as C, peekDhtMailbox as Ca, ENROLL_PROOF as Cc, UPGRADE_CAPABILITY as Ci, isAppHash as Cl, pubkyProofFile as Cn, cardLine as Co, pickMeshHubs as Cr, HTTP_SERVICE_PROTO as Cs, DID_DOCUMENT_MAX_BYTES as Ct, turnVerifierMark as Cu, decodeGroupEntryLink as D, sanitizeFileName as Da, enrollDoneFrame as Dc, dialDescriptors as Di, readAppRevocationShape as Dl, requestLnurlInvoice as Dn, statusCardBytes as Do, doorHubs as Dr, HANDOFF_CANCEL as Ds, checkDidJws as Dt, RelayTransport as Du, KNOCK_TTL_MS as E, formatFileSize as Ea, enrollDigits as Ec, capsDescriptors as Ei, readAppRevocation as El, pubkyHomeserverOf as En, sameButtonText as Eo, beaconRecords as Er, HANDOFF_ACK as Es, DidError as Et, HEDGE_MS as Eu, GroupWakeLimiter as F, parseVoiceMeta as Fa, endedRequests as Fc, emptyIdentityLedger as Fi, canonicalJsonBytes as Fl, parseCashuRequestPayload as Fn, GROUP_MEMBER_CAP as Fo, pickHubs as Fr, HANDOFF_TIMINGS as Fs, didWebFileUrl as Ft, DiscoveryBudgetError as Fu, GROUP_EDIT_FRAME as G, LINK_TRAILING as Ga, contactAskerHolds as Gc, emptyProofLedger as Gi, decodeInviteCode as Gl, GhostLink as Gn, RatchetBox as Go, transferEnded as Gr, handoffContextProof as Gs, didDhtDocument as Gt, createIdentity as Gu, GroupSession as H, REMOVED_TEXT as Ha, ContactRequestError as Hc, revokesIdentity as Hi, readDeviceInvite as Hl, isStrippedPicture as Hn, verifyCommitSignature as Ho, FILE_LIMITS as Hr, handoffBusyFrame as Hs, staticDidDocument as Ht, newerPacket as Hu, groupWakeFrame as I, voiceDownloadName as Ia, inboxRecord as Ic, identityRefusal as Ii, readCanonicalJson as Il, parseFedimintRequestPayload as In, MAX_GROUP_CHAIN as Io, rankHubs as Ir, HANDOFF_VERIFIED as Is, didWebHost as It, budgetRetryMs as Iu, meshMessageRef as J, forwardedAgain as Ja, knockSlotOf as Jc, automaticTransport as Ji, inviteOwnership as Jl, PAIRED_FRAME_TOO_LARGE as Jn, DirectPathWatch as Jo, TYPING_REFRESH_MS as Jr, handoffEphemeral as Js, encodeDidDhtPacket as Jt, publicKeyFromZ32 as Ju, GROUP_EDIT_TEXT_BYTES as K, linkStop as Ka, contactDay as Kc, validExternalKey as Ki, encodeInviteCode as Kl, INVITE_TAKEN as Kn, emptyRatchetState as Ko, transferStalled as Kr, handoffDataFrame as Ks, didDhtFromPublicKey as Kt, identityFromSeed as Ku, groupWakes as L, voiceLevel as La, newInbox as Lc, identityRevocationValue as Li, createContactLink as Ll, NO_VIDEO_METADATA as Ln, MEMBER_KEY as Lo, readBeacon as Lr, NO_ATTEMPTS as Ls, normalizeDid as Lt, isDiscoveryBudgetError as Lu, mergeKnocks as M, baseMime as Ma, readEnrollHello as Mc, IdentityExchange as Mi, parseImageMeta as Ml, fedimintRequestPayload as Mn, receivedTimestamp as Mo, mergeBeacon as Mr, HANDOFF_PAKE as Ms, didWebDocumentUrl as Mt, relayUrlProblem as Mu, readKnocks as N, downsamplePeaks as Na, verifyEnrollProof as Nc, boundIdentityDisplay as Ni, readImageMeta as Nl, findEndpoint as Nn, shownTime as No, mergeLobby as Nr, HANDOFF_PIECE_BYTES as Ns, didWebFile as Nt, setLinkTraceSink as Nu, encodeGroupEntryLink as O, sanitizeMime as Oa, enrollGrantFrame as Oc, IDENTITY_MAX_EVIDENCE as Oi, readAppRevocations as Ol, resolveLightningDestination as On, statusCardText as Oo, freshHubs as Or, HANDOFF_DONE as Os, checkDidSignature as Ot, RelaysFailedError as Ou, GROUP_WAKE_FRAME as P, fileMessageText as Pa, clearMissed as Pc, boundVerifiedIdentity as Pi, canonicalJson as Pl, isFederationId as Pn, GROUP_ADMIN_OFF_ERROR as Po, newerHead as Pr, HANDOFF_REQUEST as Ps, didWebFileNames as Pt, traceLink as Pu, SSHSIG_MAX_ARMOR as Q, REACTION_LIMITS as Qa, mergeContactKnocks as Qc, HOLD_CAPABILITY as Qi, HANDOFF_CAPABILITY as Ql, EngineError as Qn, EXPECT_PEER_MS as Qo, GROUP_PIN_FRAME as Qr, handoffPakeFrame as Qs, EVM_TEST_CHAINS as Qt, hasVisible as Qu, parseGroupWakeFrame as R, parseVideoMeta as Ra, planKnocks as Rc, identityStatement as Ri, encodeContactLink as Rl, videoMetadataPatches as Rn, commitHash as Ro, readBeaconHead as Rr, filePartName as Rs, parseDid as Rt, withRequestOptions as Ru, GROUP_READ_NOTE_COMMUNITY as S, DHT_MESSAGE_TTL as Sa, ENROLL_HELLO as Sc, STATUS_CARD_CAPABILITY as Si, checkAppRevokeStatement as Sl, pubkyProofCapability as Sn, buttonLabelClash as So, meshHubs as Sr, emptyLinkRecords as Ss, verifyAtprotoRecordProof as St, turnStatedVerifier as Su, encodeCommunityLink as T, dhtFileId as Ta, enrollCancelReason as Tc, DHT_TEXT_CAPABILITY as Ti, isAppRef as Tl, homeserverWebEndpoint as Tn, checkStatusCard as To, beaconKeys as Tr, serviceIdFromName as Ts, DID_JWS_MAX_LENGTH as Tt, HEDGE_MISSING_MS as Tu, frameBytes as U, RateWindow as Ua, REQUEST_LIFETIME_MS as Uc, lastSharedWithMe as Ui, OwnInviteError as Ul, stripPictureMetadata as Un, edgeParams as Uo, FileUplink as Ur, handoffCancelFrame as Us, strictBase64Url as Ut, openRelayPayload as Uu, GROUP_READ_NOTE as V, MAX_REMOVAL_NUMBER as Va, turnOff as Vc, receivedIdentityStatus as Vi, deviceInviteJoinerParams as Vl, PICTURE_METADATA_LIMITS as Vn, rosterHas as Vo, ChatFiles as Vr, handoffAttemptSucceeded as Vs, signingKeys as Vt, createRelayPayload as Vu, COMMUNITY_EDIT_FRAME as W, dhtEditId as Wa, contactAskerFrame as Wc, PeerProofs as Wi, createChatInvite as Wl, withoutPictureMetadata as Wn, RATCHET_CAPABILITY as Wo, sentWhole as Wr, handoffContext as Ws, DidDhtError as Wt, parseRelayPayload as Wu, mentionsMember as X, COMMUNITY_REACTION_FRAME as Xa, linkRecords as Xc, irohDescriptor as Xi, DEVICES_CAPABILITY as Xl, pairedMessageFits as Xn, DAEMON_WATCH_PEER_IDLE_MS as Xo, sanitizeTypingStatus as Xr, handoffManifestFrames as Xs, signDidDhtPacket as Xt, MAX_AVATAR_LENGTH as Xu, parseCommunityEdit as Y, readForwarded as Ya, knockSlotRecords as Yc, dialableIrohRelay as Yi, ownInviteRefusal as Yl, pairedEditFits as Yn, AWAITING_PEER_MS as Yo, TypingSender as Yr, handoffHelloFrame as Ys, resolveDidDht as Yt, verify as Yu, groupName as Z, GROUP_REACTION_FRAME as Za, makeStampPaced as Zc, irohRelayUrl as Zi, ENROLL_CAPABILITY as Zl, pairedMessageFrame as Zn, DHT_POLL_INTERVALS as Zo, typingActivity as Zr, handoffOfferFrame as Zs, ETHEREUM_USDT as Zt, sanitizeAvatar as Zu, groupTypingEpoch as _, recordsName as _a, setUpdateFrame as _c, chatAppId as _i, APP_PREFIXES as _l, PUBKY_PROOF_MAX_BYTES as _n, RUN_RESULTS as _o, SIGNAL_REPLY_MS as _r, callSignalHeardAt as _s, isAtprotoDid as _t, signTurnPacket as _u, appRevocationFor as a, readManifest as aa, readHandoffCancel as ac, toBase64Url as ad, WAKE_CALL_INTERVAL_MS as ai, APP_BUNDLE_MAGIC as al, WALLET_NETWORKS as an, validReactionNumber as ao, GROUP_WANT_NO_FRAME as ar, parseLocalTarget as as, verifySshSignature as at, seedSigner as au, COMMUNITY_LIMITS as b, ACTIVE_DHT_POLL_MS as ba, ENROLL_DONE as bc, BUTTONS_CAPABILITY as bi, appRef as bl, newPubkyProofFolder as bn, appCardId as bo, MESH_HUBS as br, parseCallSignal as bs, shortAtprotoDid as bt, turnKeys as bu, checkAppBeforeRun as c, dnsProofName as ca, readHandoffHello as cc, utf8Encode as cd, newWakeToken as ci, appDigest as cl, assertWholeSats as cn, readReply as co, isGroupMessageId as cr, decodeControl as cs, decodeAnyBitcoinAddress as ct, TURN_RAISE_READ_TIMEOUT_MS as cu, checkAppStoreIndex as d, encodeDnsQuery as da, readHandoffVerified as dc, wakeRequest as di, checkAppManifest as dl, walletNetworkOf as dn, BUTTON_STYLES as do, readGroupWant as dr, CALL_SIGNAL_MAX_AGE_MS as ds, ATPROTO_PROOF_COLLECTION as dt, turnPutSummary as du, HOLD_LIMITS as ea, handoffRetryAfter as ec, stripHidden as ed, mayPin as ei, readKnockSlot as el, PaymentPreflightError as en, nextReactionNumber as eo, engineText as er, RELAY_POLL_INTERVALS as es, SshSigError as et, deviceEchoNonce as eu, readAppStore as f, isPublicAddress as fa, sealHandoffPiece as fc, checkPushEndpoint as fi, isAppUrl as fl, SPARK_NETWORKS as fn, CRON_LINE as fo, readGroupWantNo as fr, QUICK_REDIAL_MS as fs, ATPROTO_PROOF_SCOPE as ft, TURN_LAST_SEQUENCE as fu, GroupTypingBoard as g, recordsFromWellKnown as ga, setAckFrame as gc, APP_DATA_MAX_BYTES as gi, sha256Paced as gl, isBitcoinAddress as gn, ROUTINE_STATES as go, SIGNAL_HOLD_MS as gr, callRtcConfig as gs, checkAtprotoProofRecord as gt, readTurnPacket as gu, GROUP_TYPING_FRAME as h, recordsFromTxt as ha, readSetUpdate as hc, isServeId as hi, readAppBundleAsync as hl, sparkInvoiceDetails as hn, PR_STATES as ho, SIGNAL_FRESH_MS as hr, buildSdpFromSignal as hs, atprotoProofRkey as ht, nextTurnPosition as hu, addedAppPermissions as i, newMailbox as ia, readHandoffAck as ic, randomBytes as id, readPin as ii, APP_BUNDLE_LIMITS as il, USDT_PUBLIC_RPC as in, readReaction as io, GROUP_WANT_FRAME as ir, formatLocalTarget as is, sshSignCommand as it, newDeviceSetSecret as iu, knockRecords as j, VOICE_METER as ja, readEnrollGrant as jc, IdentityCheckUnavailable as ji, signAppRevocation as jl, cashuRequestPayload as jn, heardTime as jo, lobbyRecords as jr, HANDOFF_OFFER as js, didSignedMessages as jt, normalizeRelayUrl as ju, entryParams as k, PLAYABLE_AUDIO as ka, enrollHelloFrame as kc, IDENTITY_MAX_VALIDITY as ki, setAppSignatureFastPath as kl, decodeBolt11 as kn, arrivalKey as ko, hubRank as kr, HANDOFF_HAVE as ks, didGhostlyServiceEntry as kt, SLOW_MS as ku, planAppUpdate as l, domainTxtRecord as la, readHandoffPake as lc, parseWakeFrame as li, appViewOf as ll, formatPaymentAmount as ln, replySnippet as lo, readGroupFileMeta as lr, encodeControl as ls, ATPROTO_DECLARED_SCOPE as lt, TURN_SETTLE_MS as lu, signAppStore as m, normalizeDomain as ma, SET_UPDATE as mc, APP_RANGE_LIMITS as mi, readAppBundle as ml, sparkAddressKind as mn, PR_CHECKS as mo, GROUP_SIGNAL_FRAME as mr, answersOffer as ms, atprotoProofRecord as mt, firstDeviceSetSecret as mu, readX401SdJwtVc as n, HoldRefusedError as na, handoffVersions as nc, fromBase64Url as nd, pinIsNewer as ni, requestRecords as nl, SEPOLIA_TEST_USDT_FAUCET as nn, reactionEmoji as no, GROUP_FILE_LIMITS as nr, presenceSeenAt as ns, parseSshSignature as nt, deviceLinkPairing as nu, appStoreDecision as o, DOMAIN_FILE_MAX_BYTES as oa, readHandoffDone as oc, toZ32 as od, WakeLimiter as oi, APP_ICON_PATH as ol, arkAddressPrefix as on, wireReaction as oo, fetchesByItself as or, webLocalFetch as os, verifyBitcoinMessage as ot, webCryptoSigner as ou, readAppStoreSteps as p, nip05RootKey as pa, SET_ACK as pc, vapidKeysMatch as pi, pacer as pl, SPARK_PROVIDER as pn, ITEM_STATES as po, CarriedTransport as pr, RTC_CONFIG as ps, atprotoDidMethod as pt, TURN_MAX as pu, carryMentions as q, parseLinkPreview as qa, knockSlotIdentity as qc, TRANSPORTS as qi, inviteLink as ql, LIVENESS_PING_MS as qn, ratchetSessionOf as qo, TYPING_KINDS as qr, handoffDigest as qs, encodeDidDhtDeactivated as qt, identityFromSeedB64 as qu, sameX401HolderJwk as r, isHoldUrl as ra, newHandoffId as rc, isZ32Key as rd, pinNumberHolds as ri, seenEntry as rl, TEST_USDT_FAUCET_AMOUNT as rn, reactionIsNewer as ro, GROUP_HAVE_FRAME as rr, GhostlyHttpError as rs, sameSshKey as rt, devicePingFrame as ru, appUpdateDecision as s, decodeDnsResponse as sa, readHandoffHave as sc, utf8Decode as sd, deviceWakeRequest as si, APP_PERMISSIONS as sl, assertTokenUnits as sn, pairedReplyAuthor as so, groupFileFallback as sr, LIMITS as ss, BitcoinAddressError as st, TURN_PUT_WINDOW_MS as su, newX401HolderKey as t, HoldKeys as ta, handoffStreamKey as tc, bytesEqual as td, nextPinNumber as ti, readLinkRecord as tl, SEPOLIA_TEST_USDT as tn, queueReaction as to, parseEngineError as tr, WATCH_PEER_MS as ts, parseSshPublicKey as tt, deviceKeyZ32 as tu, APP_STORE_LIMITS as u, domainWellKnownFile as ua, readHandoffTurnFrame as uc, relayRequest as ui, assembleAppBundle as ul, validatePaymentTarget as un, BUTTON_ID as uo, readGroupHave as ur, BURST_RING_MS as us, ATPROTO_FULL_SCOPE as ut, classifyTurnRead as uu, openGroupTyping as v, txtValue as va, signTombstone as vc, isAppVersion as vi, APP_STATEMENT_LIMITS as vl, isPubkyKey as vn, STATUS_CARD_LIMITS as vo, groupSignalFrame as vr, contactRtcConfig as vs, normalizeAtprotoHandle as vt, signTurnRelease as vu, decodeCommunityLink as w, DHT_FILE_CAPABILITY as wa, enrollCancelFrame as wc, CapsExchange as wi, isAppKey as wl, pubkyProofPath as wn, cardUrl as wo, COMMUNITY_TOPOLOGY as wr, LEGACY_SERVICES as ws, DID_FILE_MAX_BYTES as wt, DEFAULT_RELAYS as wu, CommunitySession as x, DHT_FILE_TOO_LARGE as xa, ENROLL_GRANT as xc, EDIT_CAPABILITY as xi, appRefPublisher as xl, normalizePubkyKey as xn, appCardUrl as xo, mayBeHub as xr, signalHasVideo as xs, AtprotoProofError as xt, turnName as xu, sealGroupTyping as y, wellKnownUrl as ya, verifySetUpdate as yc, APPS_CAPABILITY as yi, appFingerprint as yl, isPubkyProofFolder as yn, TASK_STATUSES as yo, readGroupSignal as yr, extractParamsFromSdp as ys, parseAtprotoDidDocument as yt, turnInstance as yu, GROUP_LIMITS as z, EDIT_BUFFER_MS as za, settleRequest as zc, isIdentityBinding as zi, readContactLink as zl, withoutVideoMetadata as zn, parseGroupCommit as zo, readLobby as zr, handoffAttemptAllowed as zs, parseDidDocument as zt, PacketTooLargeError as zu };
|
|
39674
|
+
export { SSHSIG_NAMESPACE as $, LINK_TRAILING as $a, contactAskerFrame as $c, emptyProofLedger as $i, OwnInviteError as $l, engineError as $n, RATCHET_CAPABILITY as $o, TYPING_REFRESH_MS as $r, handoffContext as $s, ONCHAIN_PROVIDER as $t, openRelayPayload as $u, knockIdentity as A, DHT_MESSAGE_TTL as Aa, ENROLL_GRANT as Ac, STATUS_CARD_CAPABILITY as Ai, appRefPublisher as Al, ENDPOINT as An, buttonLabelClash as Ao, lobbyKeys as Ar, signalHasVideo as As, didJwsAlg as At, turnKeys as Au, GROUP_REACTED_FRAME as B, baseMime as Ba, readEnrollGrant as Bc, IdentityExchange as Bi, signAppObject as Bl, NO_PICTURE_METADATA as Bn, heardTime as Bo, shouldBeHub as Br, HANDOFF_OFFER as Bs, parseDidSignaturePaste as Bt, currentRelays as Bu, communityHasFrame as C, recordsFromTxt as Ca, SET_UPDATE as Cc, isServeId as Ci, readAppBundle as Cl, pubkyProofFile as Cn, PR_STATES as Co, pickMeshHubs as Cr, answersOffer as Cs, DID_DOCUMENT_MAX_BYTES as Ct, TURN_MAX as Cu, decodeGroupEntryLink as D, wellKnownUrl as Da, signTombstone as Dc, APPS_CAPABILITY as Di, APP_STATEMENT_LIMITS as Dl, requestLnurlInvoice as Dn, TASK_STATUSES as Do, doorHubs as Dr, contactRtcConfig as Ds, checkDidJws as Dt, signTurnPacket as Du, KNOCK_TTL_MS as E, txtValue as Ea, setUpdateFrame as Ec, isAppVersion as Ei, APP_PREFIXES as El, pubkyHomeserverOf as En, STATUS_CARD_LIMITS as Eo, beaconRecords as Er, callSignalHeardAt as Es, DidError as Et, readTurnPacket as Eu, GroupWakeLimiter as F, sanitizeFileName as Fa, enrollDigits as Fc, dialDescriptors as Fi, isAppRef as Fl, parseCashuRequestPayload as Fn, statusCardBytes as Fo, pickHubs as Fr, HANDOFF_ACK as Fs, didWebFileUrl as Ft, HEDGE_MISSING_MS as Fu, GROUP_EDIT_FRAME as G, voiceLevel as Ga, inboxRecord as Gc, identityRevocationValue as Gi, canonicalJsonBytes as Gl, GhostLink as Gn, MAX_GROUP_CHAIN as Go, transferEnded as Gr, HANDOFF_VERIFIED as Gs, didDhtDocument as Gt, DiscoveryBudgetError as Gu, GroupSession as H, fileMessageText as Ha, verifyEnrollProof as Hc, boundVerifiedIdentity as Hi, parseImageMeta as Hl, isStrippedPicture as Hn, shownTime as Ho, FILE_LIMITS as Hr, HANDOFF_PIECE_BYTES as Hs, staticDidDocument as Ht, relayUrlProblem as Hu, groupWakeFrame as I, sanitizeMime as Ia, enrollDoneFrame as Ic, IDENTITY_MAX_EVIDENCE as Ii, readAppRevocation as Il, parseFedimintRequestPayload as In, statusCardText as Io, rankHubs as Ir, HANDOFF_CANCEL as Is, didWebHost as It, HEDGE_MS as Iu, meshMessageRef as J, EDIT_RATE_WINDOW_MS as Ja, settleRequest as Jc, newIdentityBinding as Ji, encodeContactLink as Jl, PAIRED_FRAME_TOO_LARGE as Jn, parseGroupCommit as Jo, STATUS_IDLE_AFTER_MS as Jr, handoffAttemptAllowed as Js, encodeDidDhtPacket as Jt, withRequestOptions as Ju, GROUP_EDIT_TEXT_BYTES as K, parseVideoMeta as Ka, newInbox as Kc, identityStatement as Ki, readCanonicalJson as Kl, INVITE_TAKEN as Kn, MEMBER_KEY as Ko, transferStalled as Kr, NO_ATTEMPTS as Ks, didDhtFromPublicKey as Kt, budgetRetryMs as Ku, groupWakes as L, PLAYABLE_AUDIO as La, enrollGrantFrame as Lc, IDENTITY_MAX_VALIDITY as Li, readAppRevocationShape as Ll, NO_VIDEO_METADATA as Ln, MESSAGE_CLOCK_SKEW_MS as Lo, readBeacon as Lr, HANDOFF_DONE as Ls, normalizeDid as Lt, RelayTransport as Lu, mergeKnocks as M, DHT_FILE_CAPABILITY as Ma, ENROLL_PROOF as Mc, CapsExchange as Mi, isAppHash as Ml, fedimintRequestPayload as Mn, cardUrl as Mo, mergeBeacon as Mr, HTTP_SERVICE_PROTO as Ms, didWebDocumentUrl as Mt, turnStatedVerifier as Mu, readKnocks as N, dhtFileId as Na, enrollCancelFrame as Nc, DHT_TEXT_CAPABILITY as Ni, isAppKey as Nl, findEndpoint as Nn, checkStatusCard as No, mergeLobby as Nr, LEGACY_SERVICES as Ns, didWebFile as Nt, turnVerifierMark as Nu, encodeGroupEntryLink as O, ACTIVE_DHT_POLL_MS as Oa, verifySetUpdate as Oc, BUTTONS_CAPABILITY as Oi, appFingerprint as Ol, resolveLightningDestination as On, appCardId as Oo, freshHubs as Or, extractParamsFromSdp as Os, checkDidSignature as Ot, signTurnRelease as Ou, GROUP_WAKE_FRAME as P, formatFileSize as Pa, enrollCancelReason as Pc, capsDescriptors as Pi, isAppLine as Pl, isFederationId as Pn, sameButtonText as Po, newerHead as Pr, serviceIdFromName as Ps, didWebFileNames as Pt, DEFAULT_RELAYS as Pu, SSHSIG_MAX_ARMOR as Q, dhtEditId as Qa, REQUEST_LIFETIME_MS as Qc, PeerProofs as Qi, readDeviceInvite as Ql, EngineError as Qn, edgeParams as Qo, TYPING_KINDS as Qr, handoffCancelFrame as Qs, EVM_TEST_CHAINS as Qt, newerPacket as Qu, parseGroupWakeFrame as R, VOICE_LIMITS as Ra, enrollHelloFrame as Rc, IDENTITY_REVOCATION_LABEL as Ri, readAppRevocations as Rl, videoMetadataPatches as Rn, arrivalKey as Ro, readBeaconHead as Rr, HANDOFF_HAVE as Rs, parseDid as Rt, RelaysFailedError as Ru, GROUP_READ_NOTE_COMMUNITY as S, normalizeDomain as Sa, SET_ACK as Sc, APP_RANGE_LIMITS as Si, pacer as Sl, pubkyProofCapability as Sn, PR_CHECKS as So, meshHubs as Sr, RTC_CONFIG as Ss, verifyAtprotoRecordProof as St, TURN_LAST_SEQUENCE as Su, encodeCommunityLink as T, recordsName as Ta, setAckFrame as Tc, chatAppId as Ti, sha256Paced as Tl, homeserverWebEndpoint as Tn, RUN_RESULTS as To, beaconKeys as Tr, callRtcConfig as Ts, DID_JWS_MAX_LENGTH as Tt, nextTurnPosition as Tu, frameBytes as U, parseVoiceMeta as Ua, clearMissed as Uc, emptyIdentityLedger as Ui, readImageMeta as Ul, stripPictureMetadata as Un, GROUP_ADMIN_OFF_ERROR as Uo, FileUplink as Ur, HANDOFF_REQUEST as Us, strictBase64Url as Ut, setLinkTraceSink as Uu, GROUP_READ_NOTE as V, downsamplePeaks as Va, readEnrollHello as Vc, boundIdentityDisplay as Vi, signAppRevocation as Vl, PICTURE_METADATA_LIMITS as Vn, receivedTimestamp as Vo, ChatFiles as Vr, HANDOFF_PAKE as Vs, signingKeys as Vt, normalizeRelayUrl as Vu, COMMUNITY_EDIT_FRAME as W, voiceDownloadName as Wa, endedRequests as Wc, identityRefusal as Wi, canonicalJson as Wl, withoutPictureMetadata as Wn, GROUP_MEMBER_CAP as Wo, sentWhole as Wr, HANDOFF_TIMINGS as Ws, DidDhtError as Wt, traceLink as Wu, mentionsMember as X, REMOVED_TEXT as Xa, turnOff as Xc, revokesIdentity as Xi, createDeviceInvite as Xl, pairedMessageFits as Xn, rosterHas as Xo, personStatus as Xr, handoffAttemptSucceeded as Xs, signDidDhtPacket as Xt, RELAY_PAYLOAD_MAX_BYTES as Xu, parseCommunityEdit as Y, MAX_REMOVAL_NUMBER as Ya, takeRequest as Yc, receivedIdentityStatus as Yi, readContactLink as Yl, pairedEditFits as Yn, rosterAdmin as Yo, liveStatus as Yr, handoffAttemptFailed as Ys, resolveDidDht as Yt, PacketTooLargeError as Yu, groupName as Z, RateWindow as Za, ContactRequestError as Zc, lastSharedWithMe as Zi, deviceInviteJoinerParams as Zl, pairedMessageFrame as Zn, verifyCommitSignature as Zo, sanitizeStatusText as Zr, handoffBusyFrame as Zs, ETHEREUM_USDT as Zt, createRelayPayload as Zu, groupTypingEpoch as _, domainTxtRecord as _a, readHandoffHello as _c, utf8Decode as _d, parseWakeFrame as _i, appDigest as _l, PUBKY_PROOF_MAX_BYTES as _n, replySnippet as _o, SIGNAL_REPLY_MS as _r, decodeControl as _s, isAtprotoDid as _t, TURN_PUT_WINDOW_MS as _u, appRevocationFor as a, irohRelayUrl as aa, handoffManifestFrames as ac, verify as ad, mayPin as ai, linkRecords as al, WALLET_NETWORKS as an, GROUP_REACTION_FRAME as ao, GROUP_WANT_NO_FRAME as ar, DAEMON_WATCH_PEER_IDLE_MS as as, verifySshSignature as at, ownInviteRefusal as au, COMMUNITY_LIMITS as b, isPublicAddress as ba, readHandoffVerified as bc, checkPushEndpoint as bi, checkAppManifest as bl, newPubkyProofFolder as bn, CRON_LINE as bo, MESH_HUBS as br, CALL_SIGNAL_MAX_AGE_MS as bs, shortAtprotoDid as bt, classifyTurnRead as bu, checkAppBeforeRun as c, HOLD_LIMITS as ca, handoffReleaseFrame as cc, hasVisible as cd, pinNumberHolds as ci, openRequest as cl, assertWholeSats as cn, nextReactionNumber as co, isGroupMessageId as cr, PRESENCE_WINDOW as cs, decodeAnyBitcoinAddress as ct, HANDOFF_CAPABILITY as cu, checkAppStoreIndex as d, isHoldUrl as da, handoffVersions as dc, bytesEqual as dd, WAKE_ONLINE_BATCH_MS as di, requestRecords as dl, walletNetworkOf as dn, reactionIsNewer as do, readGroupWant as dr, presenceSeenAt as ds, ATPROTO_PROOF_COLLECTION as dt, deviceKeyZ32 as du, validExternalKey as ea, handoffContextProof as ec, parseRelayPayload as ed, TypingSender as ei, contactAskerHolds as el, PaymentPreflightError as en, linkStop as eo, engineText as er, RatchetBox as es, SshSigError as et, createChatInvite as eu, readAppStore as f, newMailbox as fa, newHandoffId as fc, fromBase64Url as fd, WAKE_ONLINE_DELAY_MS as fi, seenEntry as fl, SPARK_NETWORKS as fn, readReaction as fo, readGroupWantNo as fr, GhostlyHttpError as fs, ATPROTO_PROOF_SCOPE as ft, deviceLinkPairing as fu, GroupTypingBoard as g, dnsProofName as ga, readHandoffHave as gc, toZ32 as gd, newWakeToken as gi, APP_PERMISSIONS as gl, isBitcoinAddress as gn, readReply as go, SIGNAL_HOLD_MS as gr, LIMITS as gs, checkAtprotoProofRecord as gt, webCryptoSigner as gu, GROUP_TYPING_FRAME as h, decodeDnsResponse as ha, readHandoffDone as hc, toBase64Url as hd, deviceWakeRequest as hi, APP_ICON_PATH as hl, sparkInvoiceDetails as hn, pairedReplyAuthor as ho, SIGNAL_FRESH_MS as hr, webLocalFetch as hs, atprotoProofRkey as ht, seedSigner as hu, addedAppPermissions as i, irohDescriptor as ia, handoffHelloFrame as ic, publicKeyFromZ32 as id, PIN_LIMITS as ii, knockSlotRecords as il, USDT_PUBLIC_RPC as in, COMMUNITY_REACTION_FRAME as io, GROUP_WANT_FRAME as ir, AWAITING_PEER_MS as is, sshSignCommand as it, inviteOwnership as iu, knockRecords as j, peekDhtMailbox as ja, ENROLL_HELLO as jc, UPGRADE_CAPABILITY as ji, checkAppRevokeStatement as jl, cashuRequestPayload as jn, cardLine as jo, lobbyRecords as jr, emptyLinkRecords as js, didSignedMessages as jt, turnName as ju, entryParams as k, DHT_FILE_TOO_LARGE as ka, ENROLL_DONE as kc, EDIT_CAPABILITY as ki, appRef as kl, decodeBolt11 as kn, appCardUrl as ko, hubRank as kr, parseCallSignal as ks, didGhostlyServiceEntry as kt, turnInstance as ku, planAppUpdate as l, HoldKeys as la, handoffRetryAfter as lc, sanitizeDisplayText as ld, readPin as li, readKnockSlot as ll, formatPaymentAmount as ln, queueReaction as lo, readGroupFileMeta as lr, RELAY_POLL_INTERVALS as ls, ATPROTO_DECLARED_SCOPE as lt, deviceEchoFrame as lu, signAppStore as m, DOMAIN_FILE_MAX_BYTES as ma, readHandoffCancel as mc, randomBytes as md, WakeLimiter as mi, APP_BUNDLE_MAGIC as ml, sparkAddressKind as mn, wireReaction as mo, GROUP_SIGNAL_FRAME as mr, parseLocalTarget as ms, atprotoProofRecord as mt, newDeviceSetSecret as mu, readX401SdJwtVc as n, automaticTransport as na, handoffDigest as nc, identityFromSeed as nd, typingActivity as ni, knockSlotIdentity as nl, SEPOLIA_TEST_USDT_FAUCET as nn, forwardedAgain as no, GROUP_FILE_LIMITS as nr, ratchetSessionOf as ns, parseSshSignature as nt, encodeInviteCode as nu, appStoreDecision as o, HOLD_CAPABILITY as oa, handoffOfferFrame as oc, MAX_AVATAR_LENGTH as od, nextPinNumber as oi, makeStampPaced as ol, arkAddressPrefix as on, REACTION_LIMITS as oo, fetchesByItself as or, DHT_POLL_INTERVALS as os, verifyBitcoinMessage as ot, DEVICES_CAPABILITY as ou, readAppStoreSteps as p, readManifest as pa, readHandoffAck as pc, isZ32Key as pd, WAKE_ONLINE_INTERVAL_MS as pi, APP_BUNDLE_LIMITS as pl, SPARK_PROVIDER as pn, validReactionNumber as po, CarriedTransport as pr, formatLocalTarget as ps, atprotoDidMethod as pt, devicePingFrame as pu, carryMentions as q, EDIT_BUFFER_MS as qa, planKnocks as qc, isIdentityBinding as qi, createContactLink as ql, LIVENESS_PING_MS as qn, commitHash as qo, STATUS_AVAILABILITIES as qr, filePartName as qs, encodeDidDhtDeactivated as qt, isDiscoveryBudgetError as qu, sameX401HolderJwk as r, dialableIrohRelay as ra, handoffEphemeral as rc, identityFromSeedB64 as rd, GROUP_PIN_FRAME as ri, knockSlotOf as rl, TEST_USDT_FAUCET_AMOUNT as rn, readForwarded as ro, GROUP_HAVE_FRAME as rr, DirectPathWatch as rs, sameSshKey as rt, inviteLink as ru, appUpdateDecision as s, HOLD_DATED_BACK_MS as sa, handoffPakeFrame as sc, sanitizeAvatar as sd, pinIsNewer as si, mergeContactKnocks as sl, assertTokenUnits as sn, ReactionWindow as so, groupFileFallback as sr, EXPECT_PEER_MS as ss, BitcoinAddressError as st, ENROLL_CAPABILITY as su, newX401HolderKey as t, TRANSPORTS as ta, handoffDataFrame as tc, createIdentity as td, sanitizeTypingStatus as ti, contactDay as tl, SEPOLIA_TEST_USDT as tn, parseLinkPreview as to, parseEngineError as tr, emptyRatchetState as ts, parseSshPublicKey as tt, decodeInviteCode as tu, APP_STORE_LIMITS as u, HoldRefusedError as ua, handoffStreamKey as uc, stripHidden as ud, WAKE_CALL_INTERVAL_MS as ui, readLinkRecord as ul, validatePaymentTarget as un, reactionEmoji as uo, readGroupHave as ur, WATCH_PEER_MS as us, ATPROTO_FULL_SCOPE as ut, deviceEchoNonce as uu, openGroupTyping as v, domainWellKnownFile as va, readHandoffPake as vc, utf8Encode as vd, relayRequest as vi, appViewOf as vl, isPubkyKey as vn, BUTTON_ID as vo, groupSignalFrame as vr, encodeControl as vs, normalizeAtprotoHandle as vt, TURN_RAISE_READ_TIMEOUT_MS as vu, decodeCommunityLink as w, recordsFromWellKnown as wa, readSetUpdate as wc, APP_DATA_MAX_BYTES as wi, readAppBundleAsync as wl, pubkyProofPath as wn, ROUTINE_STATES as wo, COMMUNITY_TOPOLOGY as wr, buildSdpFromSignal as ws, DID_FILE_MAX_BYTES as wt, firstDeviceSetSecret as wu, CommunitySession as x, nip05RootKey as xa, sealHandoffPiece as xc, vapidKeysMatch as xi, isAppUrl as xl, normalizePubkyKey as xn, ITEM_STATES as xo, mayBeHub as xr, QUICK_REDIAL_MS as xs, AtprotoProofError as xt, turnPutSummary as xu, sealGroupTyping as y, encodeDnsQuery as ya, readHandoffTurnFrame as yc, wakeRequest as yi, assembleAppBundle as yl, isPubkyProofFolder as yn, BUTTON_STYLES as yo, readGroupSignal as yr, BURST_RING_MS as ys, parseAtprotoDidDocument as yt, TURN_SETTLE_MS as yu, GROUP_LIMITS as z, VOICE_METER as za, enrollProofFrame as zc, IdentityCheckUnavailable as zi, setAppSignatureFastPath as zl, withoutVideoMetadata as zn, claimedTime as zo, readLobby as zr, HANDOFF_HELLO as zs, parseDidDocument as zt, SLOW_MS as zu };
|
|
39006
39675
|
|
|
39007
|
-
//# sourceMappingURL=src-
|
|
39676
|
+
//# sourceMappingURL=src-BnpEQqzk.js.map
|