@ghostlytools/sdk 1.10.1 → 1.10.3

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/dist/testing.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Au as IdentityExchange, Cw as createIdentity, Fu as identityStatement, Mu as emptyIdentityLedger, Ru as newIdentityBinding, bu as IDENTITY_MAX_EVIDENCE, ia as isBitcoinAddress, ka as decodeBolt11 } from "./src-CEgQHzFr.js";
1
+ import { Mw as createIdentity, Pu as emptyIdentityLedger, Ru as identityStatement, Vu as newIdentityBinding, ia as isBitcoinAddress, ju as IdentityExchange, ka as decodeBolt11, xu as IDENTITY_MAX_EVIDENCE } from "./src-CCGK1Q_h.js";
2
2
  import { l as providerDescriptorProblems, o as isNothingSpentError } from "./types-DvtCy3WB.js";
3
- import { i as verifyIdentity, r as descriptorProblems } from "./verify-BWOWTWmV.js";
4
- import { _ as fakeAddress, a as fakeAccount, b as fakeOnchain, c as fakeKeySign, d as fakeRecord, f as fakeRecordText, g as TEST_PROVIDERS_FLAG, h as FakeOnchainProvider, i as TEST_IDENTITIES_FLAG, l as fakeKeySubject, m as FakeLightningProvider, n as FAKE_ISSUER, o as fakeAccountToken, p as testIdentitiesEnabled, r as FAKE_RECORD_HOST, s as fakeKey, t as FAKE_IDENTITY_PROVIDERS, u as fakeKeyring, v as fakeInvoice, x as testProvidersEnabled, y as fakeLightning } from "./fakes-83bCOBaf.js";
3
+ import { i as verifyIdentity, r as descriptorProblems } from "./verify-DXMSqZzR.js";
4
+ import { _ as fakeAddress, a as fakeAccount, b as fakeOnchain, c as fakeKeySign, d as fakeRecord, f as fakeRecordText, g as TEST_PROVIDERS_FLAG, h as FakeOnchainProvider, i as TEST_IDENTITIES_FLAG, l as fakeKeySubject, m as FakeLightningProvider, n as FAKE_ISSUER, o as fakeAccountToken, p as testIdentitiesEnabled, r as FAKE_RECORD_HOST, s as fakeKey, t as FAKE_IDENTITY_PROVIDERS, u as fakeKeyring, v as fakeInvoice, x as testProvidersEnabled, y as fakeLightning } from "./fakes-Dbw01Dk9.js";
5
5
  import { afterEach, describe, expect, it, vi } from "vitest";
6
6
  //#region ../browser/src/engine/paymentAdapters/providers/contractSuite.ts
7
7
  var WAIT = 1e4;
@@ -36,6 +36,17 @@ export interface IdentityFetchResponse {
36
36
  bytes: Uint8Array;
37
37
  }
38
38
  export type IdentityFetch = (url: string, options?: IdentityFetchOptions) => Promise<IdentityFetchResponse>;
39
+ /**
40
+ * How a provider says a line it works out when it runs (a step naming the person's domain, a progress line) in the
41
+ * app's language: `key` names the line within the provider, `english` is the line itself with `{{name}}` for each of
42
+ * `values`. The UI reads a built-in provider's line under `identities.providers.<provider id>.<key>`, with `english`
43
+ * when its language has none; a provider written outside the app (a plugin) always gets its `english` back, filled in.
44
+ * Its fixed words (`label`, `summary`, a signer's `description`…) need no call: the UI reads them by the same rule,
45
+ * under their own path (`subject.help`, `signers.<signer id>.label`, `signers.<signer id>.fields.<name>.help`).
46
+ */
47
+ export type ProviderSay = (key: string, english: string, values?: Readonly<Record<string, string | number>>) => string;
48
+ /** `english` with its `{{name}}`s filled in: what `ProviderSay` returns where no app language is at hand (the CLI, tests). */
49
+ export declare const englishSay: ProviderSay;
39
50
  export interface VerifyContext {
40
51
  /** Seconds. Use this, never `Date.now()`, so tests and re-checks agree on time. */
41
52
  now: number;
@@ -64,6 +75,7 @@ export interface SubjectSpec {
64
75
  */
65
76
  preview?(subject: string, options: {
66
77
  signal: AbortSignal;
78
+ say?: ProviderSay;
67
79
  }): Promise<SubjectPreview>;
68
80
  }
69
81
  export interface SubjectPreview {
@@ -112,6 +124,8 @@ export interface SignerContext {
112
124
  onProgress(message: string): void;
113
125
  /** The signer waits for an approval elsewhere (`null`: it no longer does). The UI renders it; see `ApprovalRequest`. */
114
126
  onApproval?(request: ApprovalRequest | null): void;
127
+ /** Says the signer's progress lines and approval words in the app's language; `englishSay` when absent. */
128
+ say?: ProviderSay;
115
129
  }
116
130
  export interface SignerSession<E> {
117
131
  /** The identity the signer controls, canonical (as `subject.normalize` returns it). */
@@ -154,7 +168,8 @@ export interface InAppSigner<E> extends SignerBase {
154
168
  /** The person runs a tool (ssh-keygen, gpg, a Bitcoin wallet) on the statement and pastes the output back. */
155
169
  export interface ExternalToolSigner<E> extends SignerBase {
156
170
  kind: "external-tool";
157
- instructions(statement: IdentityStatement): SignerInstructions;
171
+ /** `say`: the steps in the app's language (`englishSay` when absent). */
172
+ instructions(statement: IdentityStatement, say?: ProviderSay): SignerInstructions;
158
173
  /** What was pasted, as evidence. Throw a message the person can act on ("That is not an SSH signature"). */
159
174
  parse(pasted: string, statement: IdentityStatement): E | Promise<E>;
160
175
  }
@@ -166,7 +181,8 @@ export interface RedirectSigner<E> extends SignerBase {
166
181
  /** The person publishes something the verifier fetches (a DNS TXT record, a /.well-known file). */
167
182
  export interface PublishSigner<E> extends SignerBase {
168
183
  kind: "publish";
169
- instructions(statement: IdentityStatement): SignerInstructions;
184
+ /** `say`: the steps in the app's language (`englishSay` when absent). */
185
+ instructions(statement: IdentityStatement, say?: ProviderSay): SignerInstructions;
170
186
  /** Usually small or empty: the verifier looks the record up itself. */
171
187
  evidence(statement: IdentityStatement): E | Promise<E>;
172
188
  }
@@ -186,6 +186,12 @@ export declare const BURST_RING_MS = 1000;
186
186
  * and every offer, answer and hang-up its sender made afterwards would be dropped as older, until the app started again.
187
187
  */
188
188
  export declare const CALL_SIGNAL_FUTURE_MS: number;
189
+ /**
190
+ * Whether a contact's candidate address may go into this device's remote description: an IPv4 or IPv6 literal, or the
191
+ * `<uuid>.local` name a browser gives its host candidate. Any other name would have this side's ICE agent look it up in
192
+ * DNS, a request the contact chose, whatever the relay policy says.
193
+ */
194
+ export declare function isCandidateAddress(address: string): boolean;
189
195
  /**
190
196
  * Validates an untrusted `_call` signal (from the Pkarr record or a `call`
191
197
  * frame). Every value that ends up in the rebuilt SDP is checked against an
@@ -436,6 +436,12 @@ export declare class ChatFiles {
436
436
  /** Takes an offered file. */
437
437
  accept(id: string): void;
438
438
  decline(id: string): void;
439
+ /**
440
+ * An offer taken here whose record or message the host could not store: refused, so its sender does not count it
441
+ * delivered and keeps its Retry, and forgotten, so that retry is a new offer here. Nothing of it is reported changed
442
+ * (there is nothing to write it to); what was stored of it is removed.
443
+ */
444
+ refuse(id: string, why: RefuseReason): void;
439
445
  pause(direction: "in" | "out", id: string): void;
440
446
  resume(direction: "in" | "out", id: string): void;
441
447
  cancel(direction: "in" | "out", id: string): void;
@@ -14,6 +14,12 @@ export interface DataLinkOptions {
14
14
  createPeerConnection: () => RTCPeerConnection;
15
15
  /** Publishes (or clears, with null) my `_rtc` record. */
16
16
  publishSignal: (signal: string | null) => void;
17
+ /**
18
+ * Whether a signal of this side went out in this attempt: a relay (or the authenticated channel) took it. An answer
19
+ * the relays' budget held back the whole attempt never reached the offerer, so its failing says nothing of the
20
+ * network (agents#1637). Left out: every signal counts as out.
21
+ */
22
+ signalOut?: () => boolean;
17
23
  /** Signaling in progress (or over): look fast for the peer's signal. `offer`: for the answer to this side's offer. */
18
24
  setFastPoll: (fast: boolean, offer?: boolean) => void;
19
25
  onOpen: (channel: FrameChannel) => void;
@@ -97,6 +103,17 @@ export declare const REANSWERS = 2;
97
103
  * backoff (meshSignals, PR #1363). Offers through members cost no relay request; over the relays four is still a few.
98
104
  */
99
105
  export declare const ANSWER_REFUSED_REDIALS = 4;
106
+ /**
107
+ * An answer to this side's offer that comes this long or more after the offer reached the relays was read late (the
108
+ * relays' request budget held the read back, a restart's first minute), and an attempt that ends after this side made
109
+ * its answer again (`REANSWERS`) this long after it took an offer that still stands answered one the offerer has not
110
+ * read yet. Neither says anything about direct connections (`DirectEvidence`): the answering side's ICE gives up about
111
+ * 30 s after its answer with no reply, so the answer that went in late found nobody there, and the offerer gives up on
112
+ * the attempt and offers again. Taken for a network that lets nothing through, a group's edge went native on both
113
+ * sides, and past the native slots members stayed unreachable for the rest of a restart lab (agents#971, 2026-11-03):
114
+ * of 38 answers read 60 s or more after their offer, 13 connected nothing; of 78 read within 20 s, none failed.
115
+ */
116
+ export declare const LATE_ANSWER_MS = 20000;
100
117
  export declare class DataLink {
101
118
  private readonly options;
102
119
  state: DataLinkState;
@@ -104,6 +121,10 @@ export declare class DataLink {
104
121
  /** Each connection's listeners, and its data channel's (`wrapDataChannel`), dropped once it is closed. */
105
122
  private readonly ends;
106
123
  private myOfferTs;
124
+ /** When this side's offer reached the relays, as far as this link knows (`signalWentOut`). */
125
+ private myOfferOutAt;
126
+ /** The answer to this side's offer came `LATE_ANSWER_MS` or more after the offer went out. */
127
+ private answerCameLate;
107
128
  /**
108
129
  * An offer or answer of this side's that went without a public candidate came to nothing (both descriptions were
109
130
  * exchanged, and no path connected): the next one waits for its STUN servers as long as it takes
@@ -152,6 +173,22 @@ export declare class DataLink {
152
173
  * does not show the answer yet: the one it was given counts, as DTLS already checked the peer against it.
153
174
  */
154
175
  get fingerprints(): [string, string] | null;
176
+ /**
177
+ * The answer this side's offer is connecting on came `LATE_ANSWER_MS` or more after the offer went out: if it connects
178
+ * nothing, that says nothing about direct connections, and the link offers again (`GhostLink`'s stall of a group link).
179
+ */
180
+ get answerLate(): boolean;
181
+ /**
182
+ * This side answered, and no answer of its went out in this attempt (`signalOut`: the relays' budget held every one
183
+ * back): the offerer never had one to try (agents#1637). The answering side's twin of `answerLate`.
184
+ */
185
+ private get answerNotOut();
186
+ /**
187
+ * This attempt, if it ends now without opening, says nothing about direct connections: the answer to this side's offer
188
+ * was read late (`answerLate`), or this side's answer never went out (`answerNotOut`). An answer made again and still
189
+ * unread `LATE_ANSWER_MS` on (`failed`) is the same case, seen from the offer that still stands.
190
+ */
191
+ private get saysNothing();
155
192
  /** The peer connection this link holds now (null when idle): a later one is another attempt. */
156
193
  get connection(): RTCPeerConnection | null;
157
194
  close(): void;
@@ -264,6 +264,11 @@ export declare class DhtDelivery {
264
264
  /** The contact took this side's reactions up to number `n`. */
265
265
  reactionsTaken?(n: number): Promise<void>;
266
266
  pollMs?: number;
267
+ /**
268
+ * How often a contact that chose DHT only is read with the chat in the background, where every chat counts as open
269
+ * (a CLI daemon: `ACTIVE_DHT_POLL_MS`). Absent: at the background pace (WISP 403, poll pace).
270
+ */
271
+ peerDhtPollMs?: number;
267
272
  /**
268
273
  * A chat already paired, started again: its first control envelope goes this long after the start, not in the
269
274
  * burst of an app coming back (bug hunt r7a). A text, a receipt, a new mode or a new capability revision still go at once.
@@ -209,6 +209,11 @@ export declare const PAIRED_FRAME_TOO_LARGE = "Message too long once encoded. Sh
209
209
  * as the frame drops one that does not fit.
210
210
  */
211
211
  export declare function pairedMessageFits(ts: number, m: string, reply?: WireReply, forwarded?: number, card?: StatusCard): boolean;
212
+ /**
213
+ * The `paired-edit` frame of this edit fits a session, as `pairedMessageFits` says of a text's: an edit within 16 KiB
214
+ * can pass it the same way, and the contact's session ends on it each time it is said again.
215
+ */
216
+ export declare function pairedEditFits(edit: WireEdit): boolean;
212
217
  /**
213
218
  * The transport a chat is set to reach and is not on yet (WISP 100, "A chosen transport not reached yet"): waited for,
214
219
  * never failed. `by`: whose choice names it (absent: a policy alone, such as Fallback off, limits the chat to it).
@@ -292,6 +297,11 @@ export interface GhostLinkEvents {
292
297
  * forgotten here, and the owner forgets what it kept of it.
293
298
  */
294
299
  onPacketTransportsGone?(): void;
300
+ /**
301
+ * With `packetTransports`: the member's packet carries no `_tr` where the last one read did (`true`), or one again
302
+ * (`false`). News only: what it said before is kept, and on a device link only a signed value counts.
303
+ */
304
+ onPacketTransportsUnsaid?(unsaid: boolean): void;
295
305
  onPairingState?(state: PairingState): void;
296
306
  /** How far a first pairing got (`pairingProgress` option): every change, up to `live`. */
297
307
  onPairingProgress?(progress: PairingProgress): void;
@@ -402,7 +412,8 @@ export interface GhostLinkEvents {
402
412
  onAnswersRefused?(): void;
403
413
  /**
404
414
  * A group link's WebRTC offer of this side's was answered and nothing connected `RACE_ANSWERED_MS` later: there is no
405
- * direct path, as a chat's race takes it (`scheduleRace`). Said once per offer; the attempt itself goes on.
415
+ * direct path, as a chat's race takes it (`scheduleRace`). Said once per offer; the attempt itself goes on. Not for an
416
+ * answer read late (`LATE_ANSWER_MS`): the link gives that attempt up and offers again.
406
417
  */
407
418
  onRtcStalled?(): void;
408
419
  /** The contact's packet came between two reads of its record: its clock against this one (`LinkSessionEvents.onPeerClock`). */
@@ -538,6 +549,8 @@ export interface GhostLinkOptions {
538
549
  state?: DhtDeliveryState;
539
550
  save(state: DhtDeliveryState): Promise<void>;
540
551
  pollMs?: number;
552
+ /** How often a contact that chose DHT only is read with the chat in the background (a CLI daemon's, `DhtDelivery`). */
553
+ peerDhtPollMs?: number;
541
554
  /** A chat already paired, started again: its first control envelope waits this long (`DhtDelivery`). */
542
555
  firstControlAfterMs?: number;
543
556
  /** This side's capability-record revision, told in every envelope (WISP 03). */
@@ -892,6 +905,8 @@ export declare class GhostLink {
892
905
  private noteSignalSigner;
893
906
  /** A signal ready to go: on the live session during a switch to WebRTC, in this side's packet otherwise. */
894
907
  private signalOut;
908
+ /** A WebRTC signal of this attempt went over the authenticated channel (a migration), not the relays. */
909
+ private rtcViaChannel;
895
910
  /** This app is going away (`depart`): no more dials. */
896
911
  private leaving;
897
912
  /** `resume` still to act on: the first dial after the start goes to it, and a native one is knocked on. */
@@ -648,7 +648,8 @@ export declare class CommunitySession {
648
648
  * it was in. What one who left wrote while in the group is taken and handed on, its goodbye included, up to what the
649
649
  * member who committed the leave had heard of it then (its `group-left` mark), never past it: the leaver still holds
650
650
  * those epochs' secrets, and anything it signs later is not heard (WISP 903 § Leaving and removal). No mark here
651
- * (one not come yet, or a committer's app before it) and nothing of it is heard.
651
+ * (one not come yet, or a committer's app before it) and nothing of it is heard. A key let in only on a branch that
652
+ * lost is heard no more either, as one removed, once this member knows it lost.
652
653
  */
653
654
  private heardAfterOut;
654
655
  /** The mark of a leave on my branch, as a frame to hand on (see `heardAfterOut`). */
@@ -769,6 +770,7 @@ export declare class CommunitySession {
769
770
  /** Whether this device may sign commits for the group now (`CommunitySessionHooks.adminWork`). */
770
771
  get adminWork(): boolean;
771
772
  private requireAdmin;
773
+ /** `alongside`: what else the commit changes in the state, saved in the same write (only once the commit is signed). */
772
774
  private commit;
773
775
  /** What an entry session sends a joiner first. */
774
776
  inviteFrame(): CommunityInviteFrame;
@@ -73,6 +73,15 @@ export declare const GROUP_LIMITS: {
73
73
  readonly saveWithinMs: 1000;
74
74
  /** New name records of one member taken in `syncWindowMs` (WISP 902 § Messages, "The name record"): one a rename. */
75
75
  readonly namesPerMember: 4;
76
+ /**
77
+ * Messages of one member taken per `messageWindowMs`, and the bytes of their frames, past a burst of twice its whole
78
+ * log (`AuthorPace`); its edits the same, counted apart. As a community's (`COMMUNITY_LIMITS.messagesPerAuthor`): each
79
+ * one taken is a row in every member's app and a frame each hub passes on. The rest are not taken now and come again
80
+ * in a catch-up.
81
+ */
82
+ readonly messagesPerAuthor: 30;
83
+ readonly messageBytesPerAuthor: number;
84
+ readonly messageWindowMs: 10000;
76
85
  };
77
86
  /** What every member should know about who can read what, in the words the apps show. */
78
87
  export declare const GROUP_READ_NOTE: string;
@@ -401,6 +410,11 @@ export interface GroupSessionHooks {
401
410
  * after one parent halt the group. Absent: true.
402
411
  */
403
412
  adminWork?(): boolean;
413
+ /**
414
+ * The hubs I count on (WISP 902 · Group Mesh § Hubs), when the group runs on them: they carry my edits on even of a
415
+ * message from before they were let in, which they cannot read. Absent or empty: a full mesh.
416
+ */
417
+ carriers?(): readonly string[];
404
418
  /**
405
419
  * Whether a fresh turn read says this device is the active one (WISP 06 § When a device checks), asked before every
406
420
  * commit: two devices that both think they are active would each commit after one parent, and the group halts. No:
@@ -466,6 +480,9 @@ export declare class GroupSession {
466
480
  private nameSaid;
467
481
  /** New name records taken per member, a few a minute (`GROUP_LIMITS.namesPerMember`). In memory only. */
468
482
  private namesTaken;
483
+ /** Messages, and apart from them edits, taken per author (`AuthorPace`). In memory only. */
484
+ private messagePace;
485
+ private editPace;
469
486
  private queue;
470
487
  /** One metadata frame that names a commit or an epoch I do not have yet: tried again when the chain moves. */
471
488
  private pendingMeta;
@@ -537,6 +554,13 @@ export declare class GroupSession {
537
554
  get top(): GroupCommit;
538
555
  get roster(): Roster;
539
556
  get admin(): string | undefined;
557
+ /**
558
+ * The roster in the order its members were last admitted, the creator first (WISP 902 § Transports, the edge a
559
+ * member keeps): every member holding the same chain reads the same order, and a member reads everyone admitted
560
+ * before it from its welcome. Kept for the current top commit.
561
+ */
562
+ get admissionOrder(): string[];
563
+ private admissionCache?;
540
564
  get isAdmin(): boolean;
541
565
  get status(): GroupStatus;
542
566
  /** Members other than me, in the current roster. */
@@ -633,7 +657,12 @@ export declare class GroupSession {
633
657
  private pruneRelay;
634
658
  /** Whether a kept edit is a removal (WISP 400 § Delete for everyone): its box, under its epoch's key, says `rm`. */
635
659
  private isRemovalEdit;
636
- /** Another member's edit, kept to hand on: the latest per message; the oldest go once the log is full. False: one as new was kept. */
660
+ /**
661
+ * Another member's edit, kept to hand on: the latest per message. Full (in count or in bytes), the oldest of the author
662
+ * who holds the most of it goes (the one just kept's own on a tie): an author's edits of messages that are not there,
663
+ * which no keeper can tell (a hub cannot even open them), as many as it likes, push out only its own. False: one as
664
+ * new was kept, or this one went.
665
+ */
637
666
  private keepEdit;
638
667
  /** A frame of another member, kept to hand on; the oldest go once the log is full. */
639
668
  private keep;
@@ -741,7 +770,8 @@ export declare class GroupSession {
741
770
  /**
742
771
  * Says an edit of one of my messages (WISP 902 § Edits): edit `v`, the whole new text and its mentions, sealed under
743
772
  * the key of the message's epoch and signed, to every member of that epoch still in the group, or to `to` alone (an
744
- * edge that just opened). Someone admitted after the message cannot open it and is not sent it. The message's
773
+ * edge that just opened). Someone admitted after the message cannot open it and is not sent it, but a hub I count on
774
+ * (`hooks.carriers`), which carries it on to the members who can. The message's
745
775
  * epoch key must still be here: past `GROUP_LIMITS.secrets` epochs a message cannot be edited.
746
776
  */
747
777
  sendEdit(messageId: string, edit: {
@@ -868,6 +898,7 @@ export declare class GroupSession {
868
898
  */
869
899
  private receiveEdit;
870
900
  private parkEdit;
901
+ private paced;
871
902
  private wholeSigned;
872
903
  /**
873
904
  * The author's name in a message (`nk`), when the author's signature over it (`ns`) holds: any copy, handed on or
@@ -120,6 +120,8 @@ export declare function signIdentityPresentation(seed: Uint8Array, proofId: stri
120
120
  export declare function verifyIdentityPresentation(key: string, sig: string, proofId: string, scope: IdentityScope, nonce: string, issuedAt: number): boolean;
121
121
  /** Bounds a provider's result so a buggy provider cannot store or show arbitrary data. */
122
122
  export declare function boundVerifiedIdentity(v: VerifiedIdentity): VerifiedIdentity;
123
+ /** Bounds a provider's public name/picture (from a proof or `lookupDisplay`): a name with nothing visible left is dropped. */
124
+ export declare function boundIdentityDisplay(d: IdentityDisplay): IdentityDisplay;
123
125
  /** Sharer side, one per proof shared in this conversation. */
124
126
  export interface SharedIdentity {
125
127
  id: string;
@@ -207,6 +209,12 @@ export declare class IdentityCheckUnavailable extends Error {
207
209
  }
208
210
  /** What the contact is told when the check failed with an IdentityCheckUnavailable. */
209
211
  export declare const IDENTITY_CHECK_UNAVAILABLE = "Your contact's app could not check it. Try again later.";
212
+ /**
213
+ * Why a share of mine was not accepted, as this app may say it under my identity: one of the refusals above or my own
214
+ * app's line; else nothing past "not verified". Any other words came from the contact (a ledger kept before this check)
215
+ * and would read as this app's own notice.
216
+ */
217
+ export declare const identityRefusal: (error: unknown) => string | undefined;
210
218
  /**
211
219
  * The `idp-*` exchange of one conversation. Frames (all JSON, additive, over the paired channel,
212
220
  * only when both offers carry `identity-proof/1`):
@@ -222,6 +230,8 @@ export declare class IdentityExchange {
222
230
  private options;
223
231
  private peerProviders;
224
232
  private requested;
233
+ /** The nonces of the presentations in their provider's check now. */
234
+ private checking;
225
235
  constructor(options: IdentityExchangeOptions);
226
236
  private now;
227
237
  /** The ledger with one more step on the chat's timeline, in milliseconds (a test's clock, in seconds, when given). */
@@ -50,6 +50,14 @@ export declare const OFFER_LOOK_MS = 90000;
50
50
  * matrix's chat stayed "On DHT · retrying live" for 45 s (E2E full, 2026-10-30).
51
51
  */
52
52
  export declare const SIGNAL_OUT_READS = 3;
53
+ /**
54
+ * The first fast reads once the contact's offer is due now (`expectPeer(…, true)`: the chat just left DHT only, on
55
+ * both sides) are signaling too, as many as after an answer, until one finds a new signal of the contact's. As plain
56
+ * reads, an extension whose relay minute was spent read its contact once as it came back from DHT only, and the next
57
+ * read waited 41 s: the offer out since then was never read, and the matrix's chat stayed "On DHT · retrying live" for
58
+ * 45 s (E2E full, 2026-11-05).
59
+ */
60
+ export declare const SIGNAL_DUE_READS = 3;
53
61
  /**
54
62
  * How long a link looks fast when its peer, or the peer's offer, is due any moment. The peer that
55
63
  * dials does so as soon as it sees the other one here, and its offer lands in its packet a moment
@@ -170,6 +178,8 @@ export interface LinkSessionEvents {
170
178
  onPeerTransports?(value: string): void;
171
179
  /** The peer's packet has said no `_tr` for `TRANSPORTS_GONE_MS`: the peer publishes none (any more). Once per such stretch. */
172
180
  onPeerTransportsGone?(): void;
181
+ /** The peer's packet that advertises carries no `_tr` (`true`) where the last read did, or carries one again (`false`). */
182
+ onPeerTransportsUnsaid?(unsaid: boolean): void;
173
183
  onStatus?(status: LinkStatus): void;
174
184
  /** A poll started, or finished with the next one due in `nextInMs`. */
175
185
  onPoll?(poll: {
@@ -249,6 +259,10 @@ export declare class LinkSession {
249
259
  private lastCallSignalIn;
250
260
  /** The `_rtc` signal the last packet that went out carried. */
251
261
  private rtcSignalOut;
262
+ /** Counts the signals taken back (`setRtcSignal(null)`): each ends an attempt. */
263
+ private rtcAttempt;
264
+ /** A publish that went out carried a signal of this attempt (since the last take-back). */
265
+ private rtcAttemptOut;
252
266
  private lastRtcSignalIn;
253
267
  /** The `_rtc` signal the peer's packet carried as last read (null: none), whether or not it was new. */
254
268
  private peerRtcSignal;
@@ -258,6 +272,8 @@ export declare class LinkSession {
258
272
  /** When a read first found the peer's packet advertising with no `_tr` (0: the last packet that said carried one). */
259
273
  private transportsAbsentSince;
260
274
  private transportsGone;
275
+ /** The peer's packet carried a `_tr` and the last read found none (`onPeerTransportsUnsaid`). */
276
+ private transportsUnsaid;
261
277
  private running;
262
278
  /** Stopped without a last packet (`stop(false)`): nothing more goes out. */
263
279
  private silent;
@@ -286,6 +302,8 @@ export declare class LinkSession {
286
302
  private fastStepsAfter;
287
303
  /** Fast reads still signaling since this side's last new offer or answer went out (`SIGNAL_OUT_READS`). */
288
304
  private signalReadsLeft;
305
+ /** Fast reads still signaling while the contact's offer is due (`SIGNAL_DUE_READS`). */
306
+ private dueSignalReadsLeft;
289
307
  /** When the last `expectPeer` window ends (or ended): the pace slows down from there step by step. */
290
308
  private expectUntil;
291
309
  /**
@@ -331,6 +349,11 @@ export declare class LinkSession {
331
349
  private peerPacketAt;
332
350
  constructor(options: LinkSessionOptions);
333
351
  get peerPresence(): PeerPresence;
352
+ /**
353
+ * The relays took a WebRTC signal of this attempt: its answer, or an earlier one of it. Not an earlier attempt's still
354
+ * in the packet out: its take-back, a background write, is the first the relays' budget holds back.
355
+ */
356
+ get rtcSignalPublished(): boolean;
334
357
  /** The `_rtc` signal the peer's packet carries, as last read: null when it carries none. */
335
358
  get peerSignal(): string | null;
336
359
  start(): void;
@@ -359,9 +382,11 @@ export declare class LinkSession {
359
382
  setFastPoll(fast: boolean, offer?: boolean): void;
360
383
  /**
361
384
  * The peer, or its offer, is due any moment: poll fast for `EXPECT_PEER_MS` (never cutting a longer fast window short),
362
- * then slow down step by step (`nextInterval`) rather than at once.
385
+ * then slow down step by step (`nextInterval`) rather than at once. `signal`: its offer is due now (it may be out
386
+ * already): a read goes at once, even inside a window already looking fast, and the first reads that look for it are
387
+ * signaling (`SIGNAL_DUE_READS`).
363
388
  */
364
- expectPeer(awaited?: boolean): void;
389
+ expectPeer(awaited?: boolean, signal?: boolean): void;
365
390
  /**
366
391
  * The contact just left a live session, and is likely coming back (an app restarting): fast for `EXPECT_PEER_MS`,
367
392
  * then the active pace until `WATCH_PEER_MS` passed, whatever the chat's pace would be. `idleMs` (a daemon's,
@@ -127,14 +127,44 @@ export declare const GROUP_SIGNALING_ALLOWANCE_SHARE: number;
127
127
  * in the first minute on the default relays: a reading of each beacon, and a read and a write in a hub's lobby (a write
128
128
  * goes to every relay). A member asks it only while it has no edge up in that community.
129
129
  *
130
- * At worst a relay then sees, in one minute, its limit, the chats' allowance past it, the edges' and this one: 46 on a
131
- * relay of 30 (pkarr.pubky.org allows 50 an address, `x-ratelimit-limit`), 92 on pkarr.pubky.app's 60 (it allows 1000)
132
- * and 7 on a relay of 5 (relay.pkarr.org and pkarr.miguelmedeiros.dev allow 10). A share raised past those limits gets
133
- * 429s (docs/TRANSPORTS.md, "The default list").
130
+ * At worst a relay then sees, in one minute, its limit, the chats' allowance past it, the edges', this one and the edges'
131
+ * answer reads' (`ANSWER_READ_ALLOWANCE`): 49 on a relay of 30 (pkarr.pubky.org allows 50 an address,
132
+ * `x-ratelimit-limit`), 95 on pkarr.pubky.app's 60 (it allows 1000) and 7 on a relay of 5 (relay.pkarr.org and
133
+ * pkarr.miguelmedeiros.dev allow 10). A share raised past those limits gets 429s (docs/TRANSPORTS.md, "The default list").
134
134
  */
135
135
  export declare const WAY_BACK_SHARE: number;
136
136
  /** Past the limit, a group's reads within its allowance go no more often than this on a relay. */
137
137
  export declare const GROUP_OVER_PACE_MS = 5000;
138
+ /**
139
+ * A group edge's read for the answer to its offer (`signal`) that the budget refused on a relay goes first there among
140
+ * the groups' signaling (`GROUP_SIGNALING_ALLOWANCE_SHARE`): the edges' offers and answers, their reads back after a
141
+ * restart (`resume`) and their watch reads wait this long after the refusal, while it is not read, for what it could
142
+ * take then. It waits for no group write the budget refused (`WRITE_FIRST_MS`), nor for the turn of a group's key that
143
+ * is not read for an answer (`GROUP_RATION_WINDOW_MS`), and the groups' other urgent reads do not spend its burst
144
+ * (`GROUP_BURST_MS`): it has one of its own. Of everything on the floor it is the closest to a member back: the
145
+ * offer is out, and the member has often answered already. A daemon back after a restart had its edges' offers and
146
+ * reads back spend the floor in its first seconds, and read the answers to offers it had out at 0.4 s only once the
147
+ * minute freed: 66 to 97 s on, and an answer read that late often found the member's attempt over (agents#971, CLI lab,
148
+ * 2026-11-03).
149
+ */
150
+ export declare const ANSWER_READ_FIRST_MS = 5000;
151
+ /**
152
+ * A group edge's read for the answer to its offer (`signal`) that everything else holds back (the limit, the groups'
153
+ * allowance, the chats' reserve, a write the budget refused) goes within an allowance of its own on that relay: this
154
+ * many in a minute, never more than the groups' allowance there (`GROUP_SIGNALING_ALLOWANCE_SHARE`: none on a relay of
155
+ * 5), one at a time (`ANSWER_READ_SPACING_MS`). What it takes counts there alone, as a way back's (`WAY_BACK_SHARE`),
156
+ * so it shortens no one else's minute. Going first on the floor (`ANSWER_READ_FIRST_MS`) was not enough: a daemon back
157
+ * after a restart had its edges' reads back and offers spend its whole minute on each relay 6 s on, before any member
158
+ * had answered (7 to 19 s on), and read the answers when the minute freed: from an answer going out to the hub
159
+ * reading it, 60 to 66 s at the median in each of four runs. With this allowance, 2 to 60 s (14 s over the four runs,
160
+ * against 63 s), and all 18 members were back 77 to 108 s on, against 102 to 153 s (agents#971, CLI lab, 2026-11-05).
161
+ *
162
+ * At worst it adds 3 to a relay's minute: 49 on a relay of 30 (pkarr.pubky.org allows 50), 95 on pkarr.pubky.app's 60,
163
+ * and nothing on a relay of 5.
164
+ */
165
+ export declare const ANSWER_READ_ALLOWANCE = 3;
166
+ /** Within that allowance, an edge's read for its answer goes no more often than this on a relay (`ANSWER_READ_ALLOWANCE`). */
167
+ export declare const ANSWER_READ_SPACING_MS = 20000;
138
168
  /**
139
169
  * Groups' urgent reads (their edges looking fast for a signal) take at most a quarter of a relay's minute in any this
140
170
  * long, so that they never spend it in a burst. An app back after a restart has every edge offering and looking fast at
@@ -288,8 +318,9 @@ export declare class RelayTransport implements PkarrTransport {
288
318
  private readonly spentBackground;
289
319
  /** Background writes on each relay in the last minute (`BACKGROUND_WRITES_SHARE`). */
290
320
  private readonly spentBackgroundWrites;
291
- /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`. */
321
+ /** Groups' urgent reads on each relay in the last `GROUP_BURST_MS`: edges' reads for an answer apart (`ANSWER_READ_FIRST_MS`). */
292
322
  private readonly spentGroupUrgent;
323
+ private readonly spentAnswerUrgent;
293
324
  /** Watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`WATCH_SHARE`). */
294
325
  private readonly spentWatch;
295
326
  /** 1:1 chats' watch reads on each relay in the last `GROUP_RATION_WINDOW_MS` (`CHAT_WATCH_SHARE`). */
@@ -300,6 +331,8 @@ export declare class RelayTransport implements PkarrTransport {
300
331
  private readonly spentGroupSignal;
301
332
  /** Community members' ways back on each relay in the last minute: their allowance (`WAY_BACK_SHARE`). */
302
333
  private readonly spentWayBack;
334
+ /** Edges' reads for an answer that only their own allowance let through, on each relay in the last minute (`ANSWER_READ_ALLOWANCE`). */
335
+ private readonly spentAnswerAllowance;
303
336
  /** Per contact, its departed reads past the limit in the last minute, every relay together (`DEPARTED_READS`). */
304
337
  private readonly departedOver;
305
338
  /**
@@ -318,6 +351,8 @@ export declare class RelayTransport implements PkarrTransport {
318
351
  private readonly groupsFullAt;
319
352
  /** When a link's write was last refused on each relay (`chat <relay>`, `group <relay>`), while it waits for the budget. */
320
353
  private readonly writeWaiting;
354
+ /** Per relay, the keys whose edges' reads for an answer it last refused, and when, until one is read (`ANSWER_READ_FIRST_MS`). */
355
+ private readonly answerReadWaiting;
321
356
  /**
322
357
  * Per key a 1:1 chat asks for: when it last read urgently (for the next minute, groups leave it `CHAT_RESERVE` on
323
358
  * every relay) and when the budget last refused it on each relay (the same, on that relay). A read of the key at a
@@ -518,9 +553,20 @@ export declare class RelayTransport implements PkarrTransport {
518
553
  * Who goes first: a chat's refused write holds back everything but chat writes; a group's refused write holds back
519
554
  * group reads and background requests, never a chat's. Background requests yield to a link that signals. A chat's
520
555
  * signaling goes over the limit by its allowance (`SIGNALING_ALLOWANCE_SHARE`), and so do a few of its reads of a
521
- * contact that just went away (`DEPARTED_READS`).
556
+ * contact that just went away (`DEPARTED_READS`). `ownAllowance` false: what holds an edge's read for its answer
557
+ * without its own allowance (`ANSWER_READ_ALLOWANCE`).
522
558
  */
523
559
  private heldFor;
560
+ /**
561
+ * The edges' reads for their answers may take their own allowance on this relay now (`ANSWER_READ_ALLOWANCE`): fewer
562
+ * than it in the last minute, and none within `ANSWER_READ_SPACING_MS`. None where the groups have no allowance.
563
+ */
564
+ private answerAllowanceFree;
565
+ /**
566
+ * The edges' reads for their answers the budget refused on this relay within `ANSWER_READ_FIRST_MS`, still not read:
567
+ * the key refused last, and how long the groups' other signaling waits for them there. Undefined when there is none.
568
+ */
569
+ private answerReadAhead;
524
570
  /** What is left of the community members' way back allowance on this relay (`WAY_BACK_SHARE`); its reads leave a write the last of it. */
525
571
  private wayBackLeft;
526
572
  /** A group's read of `key`, or a chat's watch read, asks: it waits for its turn from now on, unless it is taken (`readsAhead`). */
@@ -528,7 +574,8 @@ export declare class RelayTransport implements PkarrTransport {
528
574
  /**
529
575
  * Keys a group reads, still asking (within `WATCH_TURN_MS`), that were read longer ago than `key`: a share keeps a
530
576
  * request for each. With `watchLane`, only watched keys the same other limits hold: one the groups' burst holds back
531
- * would keep a turn it cannot take. The chats' watched keys only in their own lane (`CHAT_WATCH_SHARE`).
577
+ * would keep a turn it cannot take. The chats' watched keys only in their own lane (`CHAT_WATCH_SHARE`). `answer`: an
578
+ * edge's read for its answer, which waits only for the others' (`ANSWER_READ_FIRST_MS`).
532
579
  */
533
580
  private readsAhead;
534
581
  /** A read of `key` that takes turns asks: it waits for its turn from now on, unless it is taken (`turnAhead`). */
@@ -125,8 +125,11 @@ export interface PkarrTransport {
125
125
  * a sequence number in seconds). A transport without it cannot publish one.
126
126
  */
127
127
  publishPayload?(pubKeyZ32: string, payload: Uint8Array, options?: PkarrRequestOptions): Promise<void>;
128
- /** Most recent packet known for this key, or null when nothing is published. */
129
- resolve(pubKeyZ32: string, options?: PkarrRequestOptions): Promise<SignedPacket | null>;
128
+ /**
129
+ * Most recent packet known for this key, or null when nothing is published. `keptOnFailure` false: a read nothing
130
+ * answered throws `RelaysFailedError` with the packet known before, rather than handing it back as the answer.
131
+ */
132
+ resolve(pubKeyZ32: string, options?: PkarrRequestOptions, keptOnFailure?: boolean): Promise<SignedPacket | null>;
130
133
  describe(): {
131
134
  protocol: string;
132
135
  relays: string[];
@@ -5,6 +5,8 @@ export declare const VIDEO_METADATA_LIMITS: {
5
5
  readonly maxBoxes: 100000;
6
6
  /** Bytes read first to tell a video from another file. */
7
7
  readonly headBytes: 64;
8
+ /** Bytes read at once for a box's header or a small box, so the next headers and `moof`s are read with it. */
9
+ readonly readAhead: number;
8
10
  };
9
11
  /** Why a video is refused: its metadata could not be removed, so it does not go at all. */
10
12
  export declare const NO_VIDEO_METADATA = "This video cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
@@ -30,4 +32,4 @@ export declare function withoutVideoMetadata(source: Blob, mime: string): Promis
30
32
  * the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as it is.
31
33
  * Throws `NO_VIDEO_METADATA` as it does.
32
34
  */
33
- export declare function videoMetadataPatches(source: VideoSource, mime: string): Promise<VideoPatch[] | undefined>;
35
+ export declare function videoMetadataPatches(file: VideoSource, mime: string): Promise<VideoPatch[] | undefined>;
@@ -1,4 +1,4 @@
1
- import { ju as boundVerifiedIdentity, ku as IdentityCheckUnavailable } from "./src-CEgQHzFr.js";
1
+ import { Au as IdentityCheckUnavailable, Nu as boundVerifiedIdentity } from "./src-CCGK1Q_h.js";
2
2
  //#region ../browser/src/proofs/verify.ts
3
3
  var DAY = 86400;
4
4
  /**
@@ -103,4 +103,4 @@ function boundedIdentityFetch(options = { online: () => true }) {
103
103
  //#endregion
104
104
  export { verifyIdentity as i, boundedIdentityFetch as n, descriptorProblems as r, availableSigners as t };
105
105
 
106
- //# sourceMappingURL=verify-BWOWTWmV.js.map
106
+ //# sourceMappingURL=verify-DXMSqZzR.js.map