@ghostlytools/cli 1.3.7 → 1.3.8
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 +8 -5
- package/SKILL.md +2 -0
- package/dist/assets/{api-BL0vpWGN.js → api-CYG-sByy.js} +2 -2
- package/dist/assets/{api-DlxlF4jP.js → api-Q6QZ0oIy.js} +50 -24
- package/dist/assets/api-Q6QZ0oIy.js.map +1 -0
- package/dist/assets/{apiKit-BnpVuZrZ.js → apiKit-C9lLXQwt.js} +2 -2
- package/dist/assets/{apiKit-BnpVuZrZ.js.map → apiKit-C9lLXQwt.js.map} +1 -1
- package/dist/assets/{apps-B_6Q-Mq-.js → apps-Bs8xpLGv.js} +1 -1
- package/dist/assets/{apps-Bs6QYQjm.js → apps-tcynvhlC.js} +2 -2
- package/dist/assets/{apps-Bs6QYQjm.js.map → apps-tcynvhlC.js.map} +1 -1
- package/dist/assets/{arkade-DwgUNqCz.js → arkade-BgmB0fUk.js} +2 -2
- package/dist/assets/{arkade-DwgUNqCz.js.map → arkade-BgmB0fUk.js.map} +1 -1
- package/dist/assets/{backup-BqtsbjOT.js → backup-OlEHNkqQ.js} +1 -1
- package/dist/assets/{backup-DEe1NqKb.js → backup-XtMACsQ0.js} +4 -4
- package/dist/assets/{backup-DEe1NqKb.js.map → backup-XtMACsQ0.js.map} +1 -1
- package/dist/assets/buttons-BoGOYSHb.js +2 -0
- package/dist/assets/{buttons-D9NQ3kV0.js → buttons-mdl2Gol2.js} +3 -3
- package/dist/assets/{buttons-D9NQ3kV0.js.map → buttons-mdl2Gol2.js.map} +1 -1
- package/dist/assets/{envelope-WC8QWYIL.js → envelope-DHf3mrHv.js} +2 -2
- package/dist/assets/{envelope-WC8QWYIL.js.map → envelope-DHf3mrHv.js.map} +1 -1
- package/dist/assets/{groupFiles-BrCMSXxg.js → groupFiles-CqrujNN1.js} +3 -3
- package/dist/assets/{groupFiles-BrCMSXxg.js.map → groupFiles-CqrujNN1.js.map} +1 -1
- package/dist/assets/{host-H0IYKNoK.js → host-Mz74S9cM.js} +29 -9
- package/dist/assets/host-Mz74S9cM.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-CEfwbaCO.js → hyperdhtRelay-BnqdXvmv.js} +2 -2
- package/dist/assets/{hyperdhtRelay-CEfwbaCO.js.map → hyperdhtRelay-BnqdXvmv.js.map} +1 -1
- package/dist/assets/{irohWeb-Bn-JA2kp.js → irohWeb-C8iKFl8d.js} +2 -2
- package/dist/assets/{irohWeb-Bn-JA2kp.js.map → irohWeb-C8iKFl8d.js.map} +1 -1
- package/dist/assets/{main-DiCC-Vjq.js → main-BXwlJall.js} +52 -27
- package/dist/assets/main-BXwlJall.js.map +1 -0
- package/dist/assets/{mainline-gU7pE7s2.js → mainline-CbrPHUrZ.js} +2 -2
- package/dist/assets/{mainline-gU7pE7s2.js.map → mainline-CbrPHUrZ.js.map} +1 -1
- package/dist/assets/{networkReason-Dl9JThBQ.js → networkReason-CrrB031Y.js} +2 -2
- package/dist/assets/{networkReason-Dl9JThBQ.js.map → networkReason-CrrB031Y.js.map} +1 -1
- package/dist/assets/{nwc-CKjZjg-q.js → nwc-Cu5zwrE8.js} +3 -3
- package/dist/assets/{nwc-CKjZjg-q.js.map → nwc-Cu5zwrE8.js.map} +1 -1
- package/dist/assets/{nwcProvider-GDrc0HM4.js → nwcProvider-BVVFfJM5.js} +2 -2
- package/dist/assets/{nwcProvider-GDrc0HM4.js.map → nwcProvider-BVVFfJM5.js.map} +1 -1
- package/dist/assets/{registry-JGOFtJDE.js → registry-BKm8N_TI.js} +3 -3
- package/dist/assets/{registry-JGOFtJDE.js.map → registry-BKm8N_TI.js.map} +1 -1
- package/dist/assets/{registry-Wk7ZHuwm.js → registry-CshC1EyV.js} +1 -1
- package/dist/assets/{resolve-CVpEbud3.js → resolve-DKGaPeMz.js} +2 -2
- package/dist/assets/{resolve-CVpEbud3.js.map → resolve-DKGaPeMz.js.map} +1 -1
- package/dist/assets/{server-CkYscxE3.js → server-CaDVxJKy.js} +17 -13
- package/dist/assets/{server-CkYscxE3.js.map → server-CaDVxJKy.js.map} +1 -1
- package/dist/assets/{src-gJqfoRKI.js → src-CVYir6mP.js} +127 -17
- package/dist/assets/src-CVYir6mP.js.map +1 -0
- package/dist/assets/{turnRefs-zUQbFkl3.js → turnRefs-BeWsTX0o.js} +2 -2
- package/dist/assets/{turnRefs-zUQbFkl3.js.map → turnRefs-BeWsTX0o.js.map} +1 -1
- package/dist/assets/{usdt-BkDMGqZa.js → usdt-C5Q0BWHr.js} +3 -3
- package/dist/assets/{usdt-BkDMGqZa.js.map → usdt-C5Q0BWHr.js.map} +1 -1
- package/dist/ghostly.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/api-DlxlF4jP.js.map +0 -1
- package/dist/assets/buttons-CB1opfZP.js +0 -2
- package/dist/assets/host-H0IYKNoK.js.map +0 -1
- package/dist/assets/main-DiCC-Vjq.js.map +0 -1
- package/dist/assets/src-gJqfoRKI.js.map +0 -1
|
@@ -6116,6 +6116,15 @@ var LinkSession = class {
|
|
|
6116
6116
|
this.departedUntil = Date.now() + DEPARTED_READ_MS;
|
|
6117
6117
|
this.expectPeer();
|
|
6118
6118
|
}
|
|
6119
|
+
/**
|
|
6120
|
+
* Nothing a read finds can be acted on for a while (a dial waiting out its backoff, whose end has a look of its own):
|
|
6121
|
+
* the windows that look fast for the contact (`expectPeer`, `watchPeer`) end, and the link reads at its pace from the
|
|
6122
|
+
* next read on. An offer of this side's out keeps its window.
|
|
6123
|
+
*/
|
|
6124
|
+
calm() {
|
|
6125
|
+
if (this.rtcSignal !== null) return;
|
|
6126
|
+
this.fastPollUntil = this.fastStepsAfter = this.expectUntil = this.watchUntil = 0;
|
|
6127
|
+
}
|
|
6119
6128
|
/** The data link carries chat and services while it is up. */
|
|
6120
6129
|
setDataLinkOpen(open) {
|
|
6121
6130
|
this.connected = open;
|
|
@@ -6833,6 +6842,10 @@ var DataLink = class {
|
|
|
6833
6842
|
return null;
|
|
6834
6843
|
}
|
|
6835
6844
|
}
|
|
6845
|
+
/** The peer connection this link holds now (null when idle): a later one is another attempt. */
|
|
6846
|
+
get connection() {
|
|
6847
|
+
return this.pc;
|
|
6848
|
+
}
|
|
6836
6849
|
close() {
|
|
6837
6850
|
const stalled = Date.now() - this.connectingSince >= STALLED_EVIDENCE_MS;
|
|
6838
6851
|
const evidence = stalled ? this.directEvidence() : null;
|
|
@@ -16504,14 +16517,28 @@ function unpack(bytes, withLoad, max) {
|
|
|
16504
16517
|
* the same set. Only when there is none (a group's first minute), the one that has been a hub longest. And when none said so lately, a hub asking (`me`)
|
|
16505
16518
|
* that sees no other fresh hub in the beacon is the door alone, listed or not: its own entry may not have reached the
|
|
16506
16519
|
* relays yet (a new group's first hub, whose write the relays' budget holds back), and there is nobody to agree with.
|
|
16520
|
+
*
|
|
16521
|
+
* A hub that says since when it is one (`mine.since`) counts itself among those of the first minute, listed or not, so
|
|
16522
|
+
* the first hub whose entry is held back still reads itself as the door beside a newer hub's entry. And one that became
|
|
16523
|
+
* a hub less than a minute ago, reading no other hub but knowing of one (`mine.known`: the member who let it in, whose
|
|
16524
|
+
* entry may be the one held back), is not the door alone: that hub still is.
|
|
16507
16525
|
*/
|
|
16508
|
-
function doorHubs(hubs, now = Date.now(), me) {
|
|
16526
|
+
function doorHubs(hubs, now = Date.now(), me, mine) {
|
|
16509
16527
|
const lately = hubs.filter((h) => now - h.ts < COMMUNITY_TOPOLOGY.beaconEveryMs * 1.5);
|
|
16510
16528
|
const settled = lately.filter((h) => now - (h.since ?? h.ts) >= 6e4);
|
|
16511
16529
|
const since = (h) => Math.floor((h.since ?? h.ts) / 1e3);
|
|
16512
|
-
const
|
|
16530
|
+
const self = mine && me !== void 0 && !lately.some((h) => h.key === me) ? [{
|
|
16531
|
+
key: me,
|
|
16532
|
+
ts: now,
|
|
16533
|
+
load: 0,
|
|
16534
|
+
since: mine.since
|
|
16535
|
+
}] : [];
|
|
16536
|
+
const first = [...lately, ...self].sort((a, b) => since(a) - since(b) || (a.key < b.key ? -1 : 1)).slice(0, 1);
|
|
16513
16537
|
const door = (settled.length ? settled : first).map((h) => h.key);
|
|
16514
|
-
if (
|
|
16538
|
+
if (me === void 0) return door;
|
|
16539
|
+
const alone = !freshHubs(hubs, now).some((h) => h.key !== me);
|
|
16540
|
+
if (alone && mine && now - mine.since < 6e4 && mine.known.some((key) => key !== me) && door.every((key) => key === me)) return [];
|
|
16541
|
+
if (door.length || !alone) return door;
|
|
16515
16542
|
return [me];
|
|
16516
16543
|
}
|
|
16517
16544
|
var HEAD_BYTES = 52;
|
|
@@ -17463,6 +17490,13 @@ function parseEngineError(text) {
|
|
|
17463
17490
|
/** Unanswered offers are repeated less and less often: 1.5, 3, 6, then every 12 minutes. */
|
|
17464
17491
|
/** After a failed attempt: 20 s, then doubling up to 3 min. Someone opening the chat starts it over. */
|
|
17465
17492
|
var AUTO_CONNECT_RETRY_MS = 2e4;
|
|
17493
|
+
/**
|
|
17494
|
+
* Back after a restart (`resume`), a first automatic dial that failed within this long reached nobody (a HyperDHT hole
|
|
17495
|
+
* punch aborted at once on loopback, 4-13 ms): it is tried again after `INSTANT_FAIL_RETRY_MS`, once, before it counts.
|
|
17496
|
+
* Counted, it held the chat 40 s while the app's other chats came back in 0.5-3 s (DHT-direct lab, 2026-10-17).
|
|
17497
|
+
*/
|
|
17498
|
+
var INSTANT_FAIL_MS = 100;
|
|
17499
|
+
var INSTANT_FAIL_RETRY_MS = 3e3;
|
|
17466
17500
|
/** A group link with nothing to dial looks fast for the member's `_tr` on this many attempts, then at its own pace. */
|
|
17467
17501
|
var PACKET_TRANSPORTS_FAST_ATTEMPTS = 3;
|
|
17468
17502
|
/** A native transport that fails this many attempts in a row is skipped for `DEMOTE_MS`, while another remains (WISP 100). */
|
|
@@ -17478,6 +17512,8 @@ var RESUME_WAIT_MS = 1e4;
|
|
|
17478
17512
|
* 7 ms on loopback and under 0.5 s over a relayed Iroh.
|
|
17479
17513
|
*/
|
|
17480
17514
|
var CROSSED_PROBE_MS = 1500;
|
|
17515
|
+
/** Frames a connection waiting on `probeCrossed` keeps for the session that may take it: a handshake's few. */
|
|
17516
|
+
var PROBE_EARLY_FRAMES = 8;
|
|
17481
17517
|
/** A WebRTC attempt under way, not yet open: what a member's packet saying it has no WebRTC ends (`peerPacketTransports`). */
|
|
17482
17518
|
var WEBRTC_ATTEMPT = /* @__PURE__ */ new Set([
|
|
17483
17519
|
"offering",
|
|
@@ -17970,18 +18006,30 @@ var GhostLink = class {
|
|
|
17970
18006
|
resuming;
|
|
17971
18007
|
/** Until then, a dial waits for the native endpoint `resuming` names to start (it is knocked on as it does). */
|
|
17972
18008
|
resumeWaitUntil = 0;
|
|
18009
|
+
/** The contact's other native transports were knocked on while this resume waited (`knockWhileResuming`). */
|
|
18010
|
+
resumeKnocked = false;
|
|
17973
18011
|
/** What the last live session ran on, kept after it ended: a wake resumes on it (`resumeAfterAbsence`). */
|
|
17974
18012
|
lastLiveOn;
|
|
17975
18013
|
/** `resuming` is a wake's, not a restart's. */
|
|
17976
18014
|
resumingWoke = false;
|
|
17977
18015
|
/** Until then, a session that ends was lost while the app was away (`WAKE_LOST_MS`). */
|
|
17978
18016
|
wokeUntil = 0;
|
|
18017
|
+
/** Back after a restart, the first automatic dial is still to go (`INSTANT_FAIL_MS`). */
|
|
18018
|
+
resumeDial = false;
|
|
18019
|
+
/** That dial failed at once: the next waits `INSTANT_FAIL_RETRY_MS`, not `dialWait`'s backoff. */
|
|
18020
|
+
instantRetry = false;
|
|
17979
18021
|
constructor(options) {
|
|
17980
18022
|
this.options = options;
|
|
17981
18023
|
this.apps = new AppSessions(options.appsOpen);
|
|
17982
18024
|
if (options.pairing?.credentials.signer && (options.dht || options.params.deliveryMode === "dht")) throw new Error("A link that signs through a signer has no DHT delivery");
|
|
17983
18025
|
this.deliveryMode = options.params.deliveryMode ?? "stream";
|
|
17984
|
-
|
|
18026
|
+
const dhtState = options.dht?.state;
|
|
18027
|
+
const takenAtStart = !!options.pairing?.credentials.peerKey && !!dhtState?.inviteTaken && !dhtState.wasLive;
|
|
18028
|
+
const firstPairing = options.pairingProgress ?? (takenAtStart ? {
|
|
18029
|
+
role: "joiner",
|
|
18030
|
+
startedAt: options.madeAt ?? Date.now()
|
|
18031
|
+
} : void 0);
|
|
18032
|
+
this.tracker = firstPairing && options.pairing && (!options.pairing.credentials.peerKey || takenAtStart) && this.deliveryMode !== "dht" ? new PairingTracker(firstPairing.role, firstPairing.startedAt, (progress) => {
|
|
17985
18033
|
traceLink(this.myPubKeyZ32, "progress", {
|
|
17986
18034
|
stage: progress.stage,
|
|
17987
18035
|
attempt: progress.attempt,
|
|
@@ -18086,6 +18134,7 @@ var GhostLink = class {
|
|
|
18086
18134
|
this.fallback = options.native?.fallback ?? true;
|
|
18087
18135
|
this.automatic = options.native?.automatic ?? !options.native?.preferred;
|
|
18088
18136
|
this.resuming = options.pairing?.credentials.peerKey && options.params.profile ? options.resume : void 0;
|
|
18137
|
+
this.resumeDial = !!this.resuming && !options.packetTransports;
|
|
18089
18138
|
const events = options.events ?? {};
|
|
18090
18139
|
this.session = new LinkSession({
|
|
18091
18140
|
params: options.params,
|
|
@@ -18217,7 +18266,7 @@ var GhostLink = class {
|
|
|
18217
18266
|
if (this.rtcStartedUnpinned) this.openedUnpinned.add(channel);
|
|
18218
18267
|
const plan = this.switcher.pending;
|
|
18219
18268
|
if (plan?.choices.includes("webrtc/1") && this.paired?.state.status === "ready") this.attachCandidate(channel, void 0, plan).catch(() => {});
|
|
18220
|
-
else if (this.activeBinding)
|
|
18269
|
+
else if (this.activeBinding) this.rtcOverHeld(channel);
|
|
18221
18270
|
else this.attach(channel);
|
|
18222
18271
|
},
|
|
18223
18272
|
onClose: () => {
|
|
@@ -18344,6 +18393,10 @@ var GhostLink = class {
|
|
|
18344
18393
|
upgrade: () => !!this.options.upgradeSupport && this.sessionCapabilities.agreed("upgrade/1")
|
|
18345
18394
|
});
|
|
18346
18395
|
if (options.native?.automatic === false) this.switcher.choseApart();
|
|
18396
|
+
if (takenAtStart) {
|
|
18397
|
+
this.tracker?.pinnedOverDht();
|
|
18398
|
+
this.tracker?.failed("taken", false, INVITE_TAKEN);
|
|
18399
|
+
}
|
|
18347
18400
|
}
|
|
18348
18401
|
get myPubKeyZ32() {
|
|
18349
18402
|
return this.session.identity.pubKeyZ32;
|
|
@@ -19706,6 +19759,22 @@ var GhostLink = class {
|
|
|
19706
19759
|
this.knockedEarly = epoch;
|
|
19707
19760
|
this.knockEarly(epoch, direct);
|
|
19708
19761
|
}
|
|
19762
|
+
/**
|
|
19763
|
+
* Back after a restart on a native transport whose endpoint has not started yet (Iroh waits up to 10 s for its relay,
|
|
19764
|
+
* and does not start at all with the relay out of reach): the contact's other direct transports that are up here are
|
|
19765
|
+
* knocked on meanwhile, once per resume, as a resume over WebRTC knocks as its offer goes out. The contact still holds
|
|
19766
|
+
* its old session and reads slowly; before, the chat waited out `RESUME_WAIT_MS` and then the race's 8 s (20.5-22.9 s
|
|
19767
|
+
* between two CLIs, bh-zero43). The first live wins, and the resumed transport is still knocked once it starts.
|
|
19768
|
+
*/
|
|
19769
|
+
knockWhileResuming() {
|
|
19770
|
+
if (this.resumeKnocked || !this.fallback || !this.peerFallback || this.dialing || this.channel) return;
|
|
19771
|
+
const relayed = this.upgradesFromRelay() ? [] : this.relayedTransports;
|
|
19772
|
+
const offer = this.transportOffer();
|
|
19773
|
+
const direct = TRANSPORTS.filter((t) => t !== "webrtc/1" && t !== this.resuming && this.endpoints.has(t) && offer.includes(t) && !!this.peerTransports?.includes(t) && !relayed.includes(t) && this.canDial(t));
|
|
19774
|
+
if (!direct.length) return;
|
|
19775
|
+
this.resumeKnocked = true;
|
|
19776
|
+
this.knockEarly(this.connectionEpoch, direct, () => true);
|
|
19777
|
+
}
|
|
19709
19778
|
async knockEarly(epoch, transports, standing = () => this.offerOut) {
|
|
19710
19779
|
this.knockingEarly = true;
|
|
19711
19780
|
try {
|
|
@@ -20077,12 +20146,16 @@ var GhostLink = class {
|
|
|
20077
20146
|
*/
|
|
20078
20147
|
maybeAutoConnect(presence) {
|
|
20079
20148
|
if (this.stopped || this.leaving || this.yielding || this.streamBlocked || this.keyStopped || !this.options.autoConnect || !presence.online || this.channel || this.dialing || this.dataLink.state !== "idle") return;
|
|
20080
|
-
if (this.resuming && this.resuming !== "webrtc/1" && !this.endpoints.has(this.resuming) && Date.now() < this.resumeWaitUntil)
|
|
20149
|
+
if (this.resuming && this.resuming !== "webrtc/1" && !this.endpoints.has(this.resuming) && Date.now() < this.resumeWaitUntil) {
|
|
20150
|
+
this.knockWhileResuming();
|
|
20151
|
+
return;
|
|
20152
|
+
}
|
|
20081
20153
|
if (this.departed) {
|
|
20082
20154
|
if (presence.lastPacketAt === this.departed.packet && Date.now() < this.departed.until) return;
|
|
20083
20155
|
this.departed = null;
|
|
20084
20156
|
}
|
|
20085
|
-
|
|
20157
|
+
const pairing = !!this.tracker && !this.tracker.done && this.tracker.progress.stage !== "on-dht";
|
|
20158
|
+
if ((pairing ? this.options.pairingProgress?.role : void 0) === "inviter") {
|
|
20086
20159
|
this.peerSeenAt ||= Date.now();
|
|
20087
20160
|
if (Date.now() - this.peerSeenAt < 2500 && !this.nothingToAwait()) {
|
|
20088
20161
|
this.session.expectPeer();
|
|
@@ -20101,6 +20174,7 @@ var GhostLink = class {
|
|
|
20101
20174
|
failures: this.autoConnectFailures,
|
|
20102
20175
|
left: wait - (Date.now() - this.lastAutoConnectAt)
|
|
20103
20176
|
});
|
|
20177
|
+
if (!pairing && !this.options.packetTransports && this.myPubKeyZ32 < this.options.params.peerPubKeyZ32 && Date.now() >= this.lostUntil) this.session.calm();
|
|
20104
20178
|
this.lookAtRetry();
|
|
20105
20179
|
return;
|
|
20106
20180
|
}
|
|
@@ -20114,11 +20188,18 @@ var GhostLink = class {
|
|
|
20114
20188
|
* 12 s: the pairing turned `on-dht` and the next dial waited 160 s, though nothing had been tried.
|
|
20115
20189
|
*/
|
|
20116
20190
|
autoDial() {
|
|
20117
|
-
const tries = this.anythingToDial();
|
|
20118
|
-
|
|
20191
|
+
const tries = this.anythingToDial(), started = Date.now();
|
|
20192
|
+
const resumeDial = tries && this.resumeDial;
|
|
20193
|
+
if (tries) this.resumeDial = false;
|
|
20194
|
+
this.instantRetry = false;
|
|
20195
|
+
this.lastAutoConnectAt = started;
|
|
20119
20196
|
if (tries) this.autoConnectFailures++;
|
|
20120
20197
|
this.dial().catch((error) => {
|
|
20121
|
-
if (
|
|
20198
|
+
if (resumeDial && Date.now() - started < INSTANT_FAIL_MS && this.lastAutoConnectAt === started && this.autoConnectFailures > 0) {
|
|
20199
|
+
this.autoConnectFailures--;
|
|
20200
|
+
this.instantRetry = true;
|
|
20201
|
+
traceLink(this.myPubKeyZ32, "dial-instant-fail", { ms: Date.now() - started });
|
|
20202
|
+
} else if (tries) this.tracker?.failed("transport", true);
|
|
20122
20203
|
this.dialFailed(error instanceof Error ? error.message : String(error));
|
|
20123
20204
|
this.lookAtRetry();
|
|
20124
20205
|
});
|
|
@@ -20191,6 +20272,7 @@ var GhostLink = class {
|
|
|
20191
20272
|
}
|
|
20192
20273
|
/** How long after the last automatic dial the next one may go. A first pairing tries again sooner: the contact just read the invite and is waiting. */
|
|
20193
20274
|
dialWait() {
|
|
20275
|
+
if (this.instantRetry) return INSTANT_FAIL_RETRY_MS;
|
|
20194
20276
|
return !!this.tracker && !this.tracker.done && this.tracker.progress.stage !== "on-dht" ? Math.min(PAIRING_RETRY_MS * 2 ** this.autoConnectFailures, PAIRING_MAX_RETRY_MS) : Math.min(AUTO_CONNECT_RETRY_MS * 2 ** this.autoConnectFailures, AUTO_CONNECT_MAX_RETRY_MS);
|
|
20195
20277
|
}
|
|
20196
20278
|
/** The name this side shows, told to a paired peer directly. */
|
|
@@ -21068,9 +21150,25 @@ var GhostLink = class {
|
|
|
21068
21150
|
}
|
|
21069
21151
|
this.replaceWith(channel, binding);
|
|
21070
21152
|
}
|
|
21153
|
+
/**
|
|
21154
|
+
* The contact's WebRTC opened while this side holds a native session, with no switch under way. A contact offers only
|
|
21155
|
+
* with no session of its own: its app is back after a crash, with no way to the held transport (its Iroh relay out of
|
|
21156
|
+
* reach, its listener not up yet), and the held session is dead without this side having heard. Closed at once, the
|
|
21157
|
+
* contact counted a failed dial and waited its backoff: live again 52.8 s after its start (two CLIs over a chosen Iroh
|
|
21158
|
+
* whose relay stopped, bug hunt 2026-10-17). The held session is pinged as for a crossing (`probeCrossed`): heard from,
|
|
21159
|
+
* the WebRTC closes, as before; silent, it takes over. Before the pin, or while the held one authenticates, it closes.
|
|
21160
|
+
*/
|
|
21161
|
+
rtcOverHeld(channel) {
|
|
21162
|
+
const held = this.channel;
|
|
21163
|
+
if (!held || this.candidate || !this.options.pairing?.credentials.peerKey || !this.options.params.profile || this.paired?.state.status !== "ready") {
|
|
21164
|
+
channel.close();
|
|
21165
|
+
return;
|
|
21166
|
+
}
|
|
21167
|
+
this.probeCrossed(held, channel);
|
|
21168
|
+
}
|
|
21071
21169
|
replaceWith(channel, binding) {
|
|
21072
21170
|
traceLink(this.myPubKeyZ32, "replacing", {
|
|
21073
|
-
transport: binding
|
|
21171
|
+
transport: binding?.transport ?? "webrtc/1",
|
|
21074
21172
|
held: this.paired?.state.transport
|
|
21075
21173
|
});
|
|
21076
21174
|
this.attach(channel, binding, {
|
|
@@ -21090,7 +21188,7 @@ var GhostLink = class {
|
|
|
21090
21188
|
probeCrossed(held, channel, binding) {
|
|
21091
21189
|
this.dropCrossedProbe();
|
|
21092
21190
|
traceLink(this.myPubKeyZ32, "dial-crossed", {
|
|
21093
|
-
transport: binding
|
|
21191
|
+
transport: binding?.transport ?? "webrtc/1",
|
|
21094
21192
|
held: true,
|
|
21095
21193
|
probe: true
|
|
21096
21194
|
});
|
|
@@ -21098,6 +21196,16 @@ var GhostLink = class {
|
|
|
21098
21196
|
try {
|
|
21099
21197
|
this.sendPing(held, false);
|
|
21100
21198
|
} catch {}
|
|
21199
|
+
const early = [];
|
|
21200
|
+
channel.onMessage = (data) => {
|
|
21201
|
+
if (early.length < PROBE_EARLY_FRAMES) early.push(data);
|
|
21202
|
+
};
|
|
21203
|
+
const take = (attach) => {
|
|
21204
|
+
channel.onMessage = null;
|
|
21205
|
+
attach();
|
|
21206
|
+
const read = channel.onMessage;
|
|
21207
|
+
for (const data of early) read?.(data);
|
|
21208
|
+
};
|
|
21101
21209
|
const timer = setTimeout(() => {
|
|
21102
21210
|
if (this.crossedProbe?.channel !== channel) return;
|
|
21103
21211
|
this.crossedProbe = null;
|
|
@@ -21106,15 +21214,15 @@ var GhostLink = class {
|
|
|
21106
21214
|
return;
|
|
21107
21215
|
}
|
|
21108
21216
|
if (!this.channel) {
|
|
21109
|
-
this.attach(channel, binding);
|
|
21217
|
+
take(() => this.attach(channel, binding));
|
|
21110
21218
|
return;
|
|
21111
21219
|
}
|
|
21112
21220
|
if (this.channel === held && this.framesHeard !== heard) {
|
|
21113
21221
|
channel.close();
|
|
21114
21222
|
return;
|
|
21115
21223
|
}
|
|
21116
|
-
traceLink(this.myPubKeyZ32, "crossed-held-silent", { transport: binding
|
|
21117
|
-
this.replaceWith(channel, binding);
|
|
21224
|
+
traceLink(this.myPubKeyZ32, "crossed-held-silent", { transport: binding?.transport ?? "webrtc/1" });
|
|
21225
|
+
take(() => this.replaceWith(channel, binding));
|
|
21118
21226
|
}, CROSSED_PROBE_MS);
|
|
21119
21227
|
channel.onClose = () => {
|
|
21120
21228
|
if (this.crossedProbe?.channel === channel) {
|
|
@@ -21251,8 +21359,9 @@ var GhostLink = class {
|
|
|
21251
21359
|
this.activeBinding = binding;
|
|
21252
21360
|
this.channelSince = Date.now();
|
|
21253
21361
|
oldPaired?.stop();
|
|
21362
|
+
const oldRtc = oldBinding ? null : this.dataLink.connection;
|
|
21254
21363
|
if (oldChannel) this.retire(oldChannel, () => {
|
|
21255
|
-
if (
|
|
21364
|
+
if (oldRtc && this.activeBinding && this.dataLink.connection === oldRtc) this.dataLink.close();
|
|
21256
21365
|
}, !oldBinding);
|
|
21257
21366
|
this.session.setDataLinkOpen(true);
|
|
21258
21367
|
if (migration.plan) switched = {
|
|
@@ -21906,6 +22015,7 @@ var GhostLink = class {
|
|
|
21906
22015
|
traceLink(this.myPubKeyZ32, "wake-resume", { transport });
|
|
21907
22016
|
if (transport !== "webrtc/1") {
|
|
21908
22017
|
this.resumeWaitUntil = Date.now() + RESUME_WAIT_MS;
|
|
22018
|
+
this.resumeKnocked = false;
|
|
21909
22019
|
return;
|
|
21910
22020
|
}
|
|
21911
22021
|
if (this.dataLink.state === "answering" && this.answeringEpoch === this.connectionEpoch) {
|
|
@@ -31257,4 +31367,4 @@ function appStoreDecision(held, read) {
|
|
|
31257
31367
|
//#endregion
|
|
31258
31368
|
export { COMMUNITY_EDIT_FRAME as $, buttonLabelClash as $a, currentRelays as $c, revokesIdentity as $i, GROUP_FILE_LIMITS as $n, extractParamsFromSdp as $o, WAKE_CALL_INTERVAL_MS as $r, ENROLL_DONE as $s, didDhtFromPublicKey as $t, CommunitySession as A, forwardedAgain as Aa, devicePingFrame as Ac, isPublicAddress as Ai, pubkyProofFile as An, rosterAdmin as Ao, newerHead as Ar, handoffOfferFrame as As, verifyAtprotoRecordProof as At, knockRecords as B, readReaction as Ba, TURN_MAX as Bc, capsDescriptors as Bi, findEndpoint as Bn, GhostlyHttpError as Bo, transferStalled as Br, readHandoffHave as Bs, didWebDocumentUrl as Bt, sha256Paced as C, parseImageMeta as Ca, DEVICES_CAPABILITY as Cc, readManifest as Ci, randomBytes as Cl, isBitcoinAddress as Cn, canonicalJsonBytes as Co, beaconRecords as Cr, handoffContext as Cs, atprotoProofRkey as Ct, openGroupTyping as D, RateWindow as Da, deviceEchoNonce as Dc, domainTxtRecord as Di, utf8Encode as Dl, newPubkyProofFolder as Dn, MEMBER_KEY as Do, lobbyRecords as Dr, handoffEphemeral as Ds, parseAtprotoDidDocument as Dt, groupTypingEpoch as E, EDIT_RATE_WINDOW_MS as Ea, deviceEchoFrame as Ec, dnsProofName as Ei, utf8Decode as El, isPubkyProofFolder as En, MAX_GROUP_CHAIN as Eo, lobbyKeys as Er, handoffDigest as Es, normalizeAtprotoHandle as Et, KNOCK_TTL_MS as F, ReactionWindow as Fa, TURN_RAISE_READ_TIMEOUT_MS as Fc, recordsName as Fi, resolveLightningDestination as Fn, AWAITING_PEER_MS as Fo, readLobby as Fr, handoffVersions as Fs, checkDidJws as Ft, groupWakeFrame as G, replySnippet as Ga, signTurnRelease as Gc, IdentityCheckUnavailable as Gi, INVITE_TAKEN as Gn, decodeControl as Go, typingActivity as Gr, sealHandoffPiece as Gs, normalizeDid as Gt, readKnocks as H, wireReaction as Ha, nextTurnPosition as Hc, IDENTITY_MAX_EVIDENCE as Hi, parseCashuRequestPayload as Hn, parseLocalTarget as Ho, TYPING_REFRESH_MS as Hr, readHandoffPake as Hs, didWebFileNames as Ht, decodeGroupEntryLink as I, nextReactionNumber as Ia, TURN_SETTLE_MS as Ic, txtValue as Ii, decodeBolt11 as In, DHT_POLL_INTERVALS as Io, shouldBeHub as Ir, newHandoffId as Is, checkDidSignature as It, GROUP_LIMITS as J, PR_CHECKS as Ja, turnName as Jc, emptyIdentityLedger as Ji, pairedMessageFits as Jn, RTC_CONFIG as Jo, mayPin as Jr, readSetUpdate as Js, parseDidSignaturePaste as Jt, groupWakes as K, BUTTON_ID as Ka, turnInstance as Kc, IdentityExchange as Ki, LIVENESS_PING_MS as Kn, encodeControl as Ko, GROUP_PIN_FRAME as Kr, SET_ACK as Ks, parseDid as Kt, encodeGroupEntryLink as L, queueReaction as La, classifyTurnRead as Lc, wellKnownUrl as Li, ENDPOINT as Ln, EXPECT_PEER_MS as Lo, ChatFiles as Lr, readHandoffAck as Ls, didGhostlyServiceEntry as Lt, communityHasFrame as M, COMMUNITY_REACTION_FRAME as Ma, seedSigner as Mc, normalizeDomain as Mi, homeserverWebEndpoint as Mn, verifyCommitSignature as Mo, rankHubs as Mr, handoffReleaseFrame as Ms, DID_FILE_MAX_BYTES as Mt, decodeCommunityLink as N, GROUP_REACTION_FRAME as Na, webCryptoSigner as Nc, recordsFromTxt as Ni, pubkyHomeserverOf as Nn, edgeParams as No, readBeacon as Nr, handoffRetryAfter as Ns, DID_JWS_MAX_LENGTH as Nt, sealGroupTyping as O, dhtEditId as Oa, deviceKeyZ32 as Oc, domainWellKnownFile as Oi, normalizePubkyKey as On, commitHash as Oo, mergeBeacon as Or, handoffHelloFrame as Os, shortAtprotoDid as Ot, encodeCommunityLink as P, REACTION_LIMITS as Pa, TURN_PUT_WINDOW_MS as Pc, recordsFromWellKnown as Pi, requestLnurlInvoice as Pn, DirectPathWatch as Po, readBeaconHead as Pr, handoffStreamKey as Ps, DidError as Pt, frameBytes as Q, appCardId as Qa, RelayTransport as Qc, receivedIdentityStatus as Qi, parseEngineError as Qn, callSignalHeardAt as Qo, readPin as Qr, verifySetUpdate as Qs, didDhtDocument as Qt, entryParams as R, reactionEmoji as Ra, turnPutSummary as Rc, CapsExchange as Ri, cashuRequestPayload as Rn, RELAY_POLL_INTERVALS as Ro, FILE_LIMITS as Rr, readHandoffCancel as Rs, didJwsAlg as Rt, readAppBundleAsync as S, parseVideoMeta as Sa, ownInviteRefusal as Sc, newMailbox as Si, isZ32Key as Sl, sparkInvoiceDetails as Sn, canonicalJson as So, beaconKeys as Sr, handoffCancelFrame as Ss, atprotoProofRecord as St, GroupTypingBoard as T, EDIT_BUFFER_MS as Ta, HANDOFF_CAPABILITY as Tc, decodeDnsResponse as Ti, toZ32 as Tl, isPubkyKey as Tn, GROUP_MEMBER_CAP as To, freshHubs as Tr, handoffDataFrame as Ts, isAtprotoDid as Tt, GROUP_WAKE_FRAME as U, pairedReplyAuthor as Ua, readTurnPacket as Uc, IDENTITY_MAX_VALIDITY as Ui, parseFedimintRequestPayload as Un, webLocalFetch as Uo, TypingSender as Ur, readHandoffTurnFrame as Us, didWebFileUrl as Ut, mergeKnocks as V, validReactionNumber as Va, firstDeviceSetSecret as Vc, dialDescriptors as Vi, isFederationId as Vn, formatLocalTarget as Vo, TYPING_KINDS as Vr, readHandoffHello as Vs, didWebFile as Vt, GroupWakeLimiter as W, readReply as Wa, signTurnPacket as Wc, IDENTITY_REVOCATION_LABEL as Wi, GhostLink as Wn, LIMITS as Wo, sanitizeTypingStatus as Wr, readHandoffVerified as Ws, didWebHost as Wt, GROUP_READ_NOTE as X, RUN_RESULTS as Xa, turnVerifierMark as Xc, identityStatement as Xi, engineError as Xn, buildSdpFromSignal as Xo, pinIsNewer as Xr, setUpdateFrame as Xs, staticDidDocument as Xt, GROUP_REACTED_FRAME as Y, PR_STATES as Ya, turnStatedVerifier as Yc, identityRevocationValue as Yi, pairedMessageFrame as Yn, answersOffer as Yo, nextPinNumber as Yr, setAckFrame as Ys, signingKeys as Yt, GroupSession as Z, STATUS_CARD_LIMITS as Za, DEFAULT_RELAYS as Zc, newIdentityBinding as Zi, engineText as Zn, callRtcConfig as Zo, pinNumberHolds as Zr, signTombstone as Zs, strictBase64Url as Zt, assembleAppBundle as _, VOICE_LIMITS as _a, createChatInvite as _c, HOLD_DATED_BACK_MS as _i, MAX_AVATAR_LENGTH as _l, validatePaymentTarget as _n, isAppRef as _o, MESH_HUBS as _r, filePartName as _s, ATPROTO_DECLARED_SCOPE as _t, planAppUpdate as a, automaticTransport as aa, enrollDigits as ac, wakeRequest as ai, withRequestOptions as al, EVM_TEST_CHAINS as an, arrivalKey as ao, isGroupMessageId as ar, serviceIdFromName as as, groupName as at, pacer as b, parseVoiceMeta as ba, inviteLink as bc, HoldRefusedError as bi, bytesEqual as bl, SPARK_PROVIDER as bn, signAppObject as bo, pickMeshHubs as br, handoffAttemptSucceeded as bs, ATPROTO_PROOF_SCOPE as bt, readAppStore as c, DHT_FILE_TOO_LARGE as ca, enrollHelloFrame as cc, APP_DATA_MAX_BYTES as ci, createRelayPayload as cl, SEPOLIA_TEST_USDT as cn, receivedTimestamp as co, readGroupWant as cr, HANDOFF_DONE as cs, SshSigError as ct, APP_BUNDLE_LIMITS as d, DHT_FILE_CAPABILITY as da, readEnrollHello as dc, APPS_CAPABILITY as di, parseRelayPayload as dl, USDT_PUBLIC_RPC as dn, APP_STATEMENT_LIMITS as do, GROUP_SIGNAL_FRAME as dr, HANDOFF_OFFER as ds, sameSshKey as dt, lastSharedWithMe as ea, ENROLL_GRANT as ec, WakeLimiter as ei, normalizeRelayUrl as el, encodeDidDhtDeactivated as en, cardLine as eo, GROUP_HAVE_FRAME as er, parseCallSignal as es, GROUP_EDIT_FRAME as et, APP_BUNDLE_MAGIC as f, dhtFileId as fa, verifyEnrollProof as fc, BUTTONS_CAPABILITY as fi, createIdentity as fl, WALLET_NETWORKS as fn, appFingerprint as fo, SIGNAL_FRESH_MS as fr, HANDOFF_PAKE as fs, sshSignCommand as ft, appViewOf as g, PLAYABLE_AUDIO as ga, OwnInviteError as gc, HOLD_CAPABILITY as gi, verify as gl, formatPaymentAmount as gn, isAppKey as go, readGroupSignal as gr, HANDOFF_VERIFIED as gs, decodeAnyBitcoinAddress as gt, appDigest as h, sanitizeMime as ha, readDeviceInvite as hc, UPGRADE_CAPABILITY as hi, publicKeyFromZ32 as hl, assertWholeSats as hn, isAppHash as ho, groupSignalFrame as hr, HANDOFF_TIMINGS as hs, BitcoinAddressError as ht, checkAppBeforeRun as i, TRANSPORTS as ia, enrollCancelReason as ic, relayRequest as ii, isDiscoveryBudgetError as il, ETHEREUM_USDT as in, statusCardText as io, groupFileFallback as ir, LEGACY_SERVICES as is, mentionsMember as it, GROUP_READ_NOTE_COMMUNITY as j, readForwarded as ja, newDeviceSetSecret as jc, nip05RootKey as ji, pubkyProofPath as jn, rosterHas as jo, pickHubs as jr, handoffPakeFrame as js, DID_DOCUMENT_MAX_BYTES as jt, COMMUNITY_LIMITS as k, parseLinkPreview as ka, deviceLinkPairing as kc, encodeDnsQuery as ki, pubkyProofCapability as kn, parseGroupCommit as ko, mergeLobby as kr, handoffManifestFrames as ks, AtprotoProofError as kt, readAppStoreSteps as l, DHT_MESSAGE_TTL as la, enrollProofFrame as lc, chatAppId as li, newerPacket as ll, SEPOLIA_TEST_USDT_FAUCET as ln, shownTime as lo, readGroupWantNo as lr, HANDOFF_HAVE as ls, parseSshPublicKey as lt, APP_PERMISSIONS as m, sanitizeFileName as ma, deviceInviteJoinerParams as mc, STATUS_CARD_CAPABILITY as mi, identityFromSeedB64 as ml, assertTokenUnits as mn, checkAppRevokeStatement as mo, SIGNAL_REPLY_MS as mr, HANDOFF_REQUEST as ms, verifyBitcoinMessage as mt, appStoreDecision as n, emptyProofLedger as na, ENROLL_PROOF as nc, newWakeToken as ni, traceLink as nl, resolveDidDht as nn, checkStatusCard as no, GROUP_WANT_NO_FRAME as nr, emptyLinkRecords as ns, carryMentions as nt, APP_STORE_LIMITS as o, irohDescriptor as oa, enrollDoneFrame as oc, checkPushEndpoint as oi, PacketTooLargeError as ol, ONCHAIN_PROVIDER as on, claimedTime as oo, readGroupFileMeta as or, HANDOFF_ACK as os, SSHSIG_MAX_ARMOR as ot, APP_ICON_PATH as p, formatFileSize as pa, createDeviceInvite as pc, EDIT_CAPABILITY as pi, identityFromSeed as pl, arkAddressPrefix as pn, appRef as po, SIGNAL_HOLD_MS as pr, HANDOFF_PIECE_BYTES as ps, verifySshSignature as pt, parseGroupWakeFrame as q, ITEM_STATES as qa, turnKeys as qc, boundVerifiedIdentity as qi, PAIRED_FRAME_TOO_LARGE as qn, CALL_SIGNAL_MAX_AGE_MS as qo, PIN_LIMITS as qr, SET_UPDATE as qs, parseDidDocument as qt, appUpdateDecision as r, validExternalKey as ra, enrollCancelFrame as rc, parseWakeFrame as ri, budgetRetryMs as rl, signDidDhtPacket as rn, sameButtonText as ro, fetchesByItself as rr, HTTP_SERVICE_PROTO as rs, parseCommunityEdit as rt, checkAppStoreIndex as s, irohRelayUrl as sa, enrollGrantFrame as sc, vapidKeysMatch as si, RELAY_PAYLOAD_MAX_BYTES as sl, PaymentPreflightError as sn, heardTime as so, readGroupHave as sr, HANDOFF_CANCEL as ss, SSHSIG_NAMESPACE as st, appRevocationFor as t, PeerProofs as ta, ENROLL_HELLO as tc, deviceWakeRequest as ti, setLinkTraceSink as tl, encodeDidDhtPacket as tn, cardUrl as to, GROUP_WANT_FRAME as tr, signalHasVideo as ts, GROUP_EDIT_TEXT_BYTES as tt, signAppStore as u, peekDhtMailbox as ua, readEnrollGrant as uc, isAppVersion as ui, openRelayPayload as ul, TEST_USDT_FAUCET_AMOUNT as un, APP_PREFIXES as uo, CarriedTransport as ur, HANDOFF_HELLO as us, parseSshSignature as ut, checkAppManifest as v, baseMime as va, decodeInviteCode as vc, HOLD_LIMITS as vi, sanitizeAvatar as vl, walletNetworkOf as vn, readAppRevocation as vo, mayBeHub as vr, handoffAttemptAllowed as vs, ATPROTO_FULL_SCOPE as vt, GROUP_TYPING_FRAME as w, readImageMeta as wa, ENROLL_CAPABILITY as wc, DOMAIN_FILE_MAX_BYTES as wi, toBase64Url as wl, PUBKY_PROOF_MAX_BYTES as wn, readCanonicalJson as wo, doorHubs as wr, handoffContextProof as ws, checkAtprotoProofRecord as wt, readAppBundle as x, voicePeaksOf as xa, inviteOwnership as xc, isHoldUrl as xi, fromBase64Url as xl, sparkAddressKind as xn, signAppRevocation as xo, COMMUNITY_TOPOLOGY as xr, handoffBusyFrame as xs, atprotoDidMethod as xt, isAppUrl as y, fileMessageText as ya, encodeInviteCode as yc, HoldKeys as yi, sanitizeDisplayText as yl, SPARK_NETWORKS as yn, readAppRevocations as yo, meshHubs as yr, handoffAttemptFailed as ys, ATPROTO_PROOF_COLLECTION as yt, knockIdentity as z, reactionIsNewer as za, TURN_LAST_SEQUENCE as zc, DHT_TEXT_CAPABILITY as zi, fedimintRequestPayload as zn, presenceSeenAt as zo, transferEnded as zr, readHandoffDone as zs, didSignedMessages as zt };
|
|
31259
31369
|
|
|
31260
|
-
//# sourceMappingURL=src-
|
|
31370
|
+
//# sourceMappingURL=src-CVYir6mP.js.map
|