@ghostlytools/sdk 1.10.6 → 1.11.1

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.
Files changed (42) hide show
  1. package/dist/app.js.map +1 -1
  2. package/dist/core.js +187 -2
  3. package/dist/core.js.map +1 -1
  4. package/dist/{fakes-BNNNkQqY.js → fakes-LaWqqMv4.js} +2 -2
  5. package/dist/{fakes-BNNNkQqY.js.map → fakes-LaWqqMv4.js.map} +1 -1
  6. package/dist/fakes.js +1 -1
  7. package/dist/index.js +2 -2
  8. package/dist/{keet-identity-key-DJbA1oSW.js → keet-identity-key-CASfmXry.js} +2 -2
  9. package/dist/{keet-identity-key-DJbA1oSW.js.map → keet-identity-key-CASfmXry.js.map} +1 -1
  10. package/dist/{src-C2bAufMs.js → src-BN4AAuHI.js} +1995 -313
  11. package/dist/src-BN4AAuHI.js.map +1 -0
  12. package/dist/testing.js +3 -3
  13. package/dist/types/core/src/audioMetadata.d.ts +46 -0
  14. package/dist/types/core/src/clipboardGuard.d.ts +26 -0
  15. package/dist/types/core/src/dhtDelivery.d.ts +20 -1
  16. package/dist/types/core/src/engineErrors.d.ts +2 -0
  17. package/dist/types/core/src/ghostlink.d.ts +47 -3
  18. package/dist/types/core/src/groupCommunity.d.ts +73 -4
  19. package/dist/types/core/src/groupSession.d.ts +13 -1
  20. package/dist/types/core/src/groupSignals.d.ts +2 -0
  21. package/dist/types/core/src/http.d.ts +23 -3
  22. package/dist/types/core/src/identityProofs.d.ts +7 -0
  23. package/dist/types/core/src/identityTimeline.d.ts +6 -0
  24. package/dist/types/core/src/index.d.ts +4 -0
  25. package/dist/types/core/src/link.d.ts +2 -0
  26. package/dist/types/core/src/miniApp.d.ts +2 -2
  27. package/dist/types/core/src/pairedAppRanges.d.ts +18 -7
  28. package/dist/types/core/src/pairedCalls.d.ts +10 -0
  29. package/dist/types/core/src/pairedCapabilities.d.ts +6 -1
  30. package/dist/types/core/src/pairedStatus.d.ts +117 -0
  31. package/dist/types/core/src/pairedTransports.d.ts +10 -4
  32. package/dist/types/core/src/pairedTyping.d.ts +2 -0
  33. package/dist/types/core/src/pairedWake.d.ts +36 -5
  34. package/dist/types/core/src/replies.d.ts +3 -3
  35. package/dist/types/core/src/transport.d.ts +3 -0
  36. package/dist/types/core/src/transportSwitch.d.ts +5 -1
  37. package/dist/types/core/src/videoMetadata.d.ts +8 -2
  38. package/dist/types/core/src/viewerGuard.d.ts +65 -0
  39. package/dist/{verify-CpIce6Bt.js → verify-oCL662ms.js} +2 -2
  40. package/dist/{verify-CpIce6Bt.js.map → verify-oCL662ms.js.map} +1 -1
  41. package/package.json +1 -1
  42. package/dist/src-C2bAufMs.js.map +0 -1
package/dist/testing.js CHANGED
@@ -1,7 +1,7 @@
1
- import { Bu as identityStatement, Iu as emptyIdentityLedger, Lw as createIdentity, Nu as IdentityExchange, Su as IDENTITY_MAX_EVIDENCE, Uu as newIdentityBinding, ia as isBitcoinAddress, ka as decodeBolt11 } from "./src-C2bAufMs.js";
1
+ import { Cd as newIdentityBinding, bd as identityStatement, gd as emptyIdentityLedger, ia as isBitcoinAddress, kT as createIdentity, ka as decodeBolt11, nd as IDENTITY_MAX_EVIDENCE, pd as IdentityExchange } from "./src-BN4AAuHI.js";
2
2
  import { l as providerDescriptorProblems, o as isNothingSpentError } from "./types-DvtCy3WB.js";
3
- import { i as verifyIdentity, r as descriptorProblems } from "./verify-CpIce6Bt.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-BNNNkQqY.js";
3
+ import { i as verifyIdentity, r as descriptorProblems } from "./verify-oCL662ms.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-LaWqqMv4.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;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * What an audio file leaves with. A recording made in another app, or a song a tagger went through, says more than its
3
+ * sound: a title or a file name that is where it was recorded (a phone's recorder names it after the place), a comment,
4
+ * a location tag, a picture, the date. The sender removes them before the file is stored and its digest computed, as
5
+ * pictures' and videos' are (pictureMetadata.ts, videoMetadata.ts), without decoding or re-encoding a sample, and the
6
+ * file keeps its size, so no offset in it moves and it plays as it did:
7
+ *
8
+ * - MP4 audio (M4A, a voice note recorded in MP4): videoMetadata.ts's box walk, its `udta` and `meta` emptied.
9
+ * - MP3 and AAC: an ID3v2 tag at the start becomes an empty one (its frames zeros: padding), one at the end (with its
10
+ * footer), an APEv2 tag's items, a Lyrics3v2 tag and an ID3v1 tag's fields become zeros.
11
+ * - FLAC: every metadata block but its stream info and seek table (a Vorbis comment, a picture, a cue sheet, an
12
+ * application's) becomes padding, zeroed.
13
+ * - Ogg Opus, Vorbis and Speex: the comment header keeps its vendor (the encoder's name) and has no comment, the bytes
14
+ * after it zeros; each page it changed has its checksum made again.
15
+ * - WAV: every chunk but its format, data and the ones of the sound itself (`fact`, `cue `, `smpl`, `inst`) becomes
16
+ * `JUNK`, zeroed (an INFO list, an `id3 ` chunk, a broadcast `bext` with its date and originator, XMP).
17
+ * - WebM and Matroska, audio or video: `Tags`, `Attachments`, `Chapters`, the title, the date, the file names and each
18
+ * track's name become `Void` elements (and the SeekHead's entries for them); the muxer's and the writing app's names
19
+ * are zeroed. Clusters, cues and track settings are kept as they are.
20
+ *
21
+ * Fail-closed: a file that is one of these by its bytes and whose tags cannot be removed (truncated, malformed) is
22
+ * refused with `NO_AUDIO_METADATA`, never sent as it was. Any other file goes as it is (other audio formats too).
23
+ */
24
+ import { type VideoPatch, type VideoSource } from "./videoMetadata.js";
25
+ export declare const AUDIO_METADATA_LIMITS: {
26
+ /** The largest header, element or tag read whole (an Ogg comment header with a picture in it): past this the file is refused. */
27
+ readonly maxReadBytes: number;
28
+ /** The most pages, chunks, blocks or elements walked. */
29
+ readonly maxParts: 1000000;
30
+ /** Bytes read first to tell an audio file from another file. */
31
+ readonly headBytes: 64;
32
+ };
33
+ /** Why an audio file is refused: its tags could not be removed, so it does not go at all. */
34
+ export declare const NO_AUDIO_METADATA = "This audio cannot be sent: Ghostly could not remove the details saved in it, like where it was recorded";
35
+ /**
36
+ * What `withoutAudioMetadata` changes in an audio file read from `source` (one not held in a Blob: a file kept in
37
+ * storage): the parts replaced, in order and apart, the rest of its bytes going as they are; undefined when it goes as
38
+ * it is. Throws `NO_AUDIO_METADATA` for one whose tags cannot be removed; an error reading `source` as it is.
39
+ */
40
+ export declare function audioMetadataPatches(file: VideoSource, mime: string): Promise<VideoPatch[] | undefined>;
41
+ /**
42
+ * `source` as it is sent: an audio file without its tags, made of `source`'s own bytes but for the parts emptied;
43
+ * undefined when it goes as it is (not one of these, or one with nothing to remove). Throws `NO_AUDIO_METADATA` for
44
+ * one whose tags cannot be removed; an error reading `source` as it is.
45
+ */
46
+ export declare function withoutAudioMetadata(source: Blob, mime: string): Promise<Blob | undefined>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A contact's shared app on the web writes the clipboard only in the person's own tap in it. Its frames allow no
3
+ * `clipboard-write`, but Chromium lets `document.execCommand("copy")` write the system clipboard for as long as a tap's
4
+ * activation lasts (seconds, from a timer too), and no sandbox token or permissions policy turns that off. So this
5
+ * script runs first in each of the app's pages (`guardViewerAnswer`) and in the bridge (apps/web/src/svc/bridge.ts):
6
+ * - `execCommand("copy")` and `execCommand("cut")` work only while a trusted tap, click or key of the person's is being
7
+ * dispatched in that window: a copy button copies on its own tap, and nothing else does (not on load, not from a
8
+ * timer or a promise after a tap). `execCommand("paste")` is refused. Every other command passes as it is. The
9
+ * wrapped `execCommand` is left fixed in place (not writable, not configurable), once per window;
10
+ * - runs in a frame's window before the page holds it, as the WebRTC guard does (`VIEWER_GUARD_SCRIPT`): what a frame
11
+ * element hands out is guarded first, the frames of the document and of its shadow trees are gone over as one loads
12
+ * (an empty frame's first load fires as it is put in the page) and as the page changes, each `srcdoc` frame gets
13
+ * this script first, a declarative shadow root the page's script would make is refused, and with `VIEWER_GUARD_CSP`
14
+ * a `javascript:` URL is refused (its own Trusted Types default policy; one passes every other string on as it is).
15
+ * A frame's window keeps what was run in it on its first, empty page when the page it loads is of the same origin (the
16
+ * bridge's guard reaches the app's frame then): there this script only watches the new document. Each document it
17
+ * watches is marked (`ghostlyClipboardGuard`, fixed in place): the bridge reads that to know the guard ran in the page
18
+ * it shows. It uses nothing the page can change after it ran (the page's own code runs later, in the same realm).
19
+ *
20
+ * A fence, not a wall, as the WebRTC guard's own: a frame's window read by its index (`window[0]`) before it loads,
21
+ * inside a shadow tree written in the HTML the page itself sends, is out of its sight.
22
+ * No backslash, `${` or backtick in it.
23
+ */
24
+ export declare const CLIPBOARD_GUARD_SCRIPT = "(function noClipboardWrites(w) {\n \"use strict\";\n try {\n const apply = w.Reflect.apply;\n const describe = w.Object.getOwnPropertyDescriptor;\n const define = w.Object.defineProperty;\n const proto = w.Document.prototype;\n const home = w.document;\n const exec = describe(proto, \"execCommand\");\n const fresh = !!exec && exec.configurable === true && typeof exec.value === \"function\";\n const watched = !!describe(home, \"ghostlyClipboardGuard\");\n if (!fresh && watched) return;\n if (!watched) define(home, \"ghostlyClipboardGuard\", { value: true });\n const own = \"<script>(\" + noClipboardWrites + \")(window)<\" + \"/script>\";\n const close = \"<\" + \"/script>\";\n const webRtc = \"<script>(function noWebRtc(\";\n const text = w.String;\n const lower = text.prototype.toLowerCase;\n const slice = text.prototype.slice;\n const index = text.prototype.indexOf;\n const listen = w.EventTarget.prototype.addEventListener;\n const shut = (inner) => {\n try { if (inner && inner !== w) noClipboardWrites(inner); } catch (e) {}\n };\n const count = describe(w, \"length\").get;\n const view = describe(proto, \"defaultView\").get;\n const sweep = () => {\n try { for (let i = apply(count, w, []); i-- > 0;) shut(w[i]); } catch (e) {}\n };\n const elements = w.Element.prototype;\n const getAttribute = elements.getAttribute;\n const setAttribute = elements.setAttribute;\n const removeAttribute = elements.removeAttribute;\n const attachShadow = elements.attachShadow;\n const size = describe(w.NodeList.prototype, \"length\").get;\n const first = (frame) => {\n const doc = apply(getAttribute, frame, [\"srcdoc\"]);\n if (doc === null) return;\n let at = 0;\n if (apply(slice, doc, [0, webRtc.length]) === webRtc) {\n const end = apply(index, doc, [close]);\n if (end >= 0) at = end + close.length;\n }\n if (apply(slice, doc, [at, at + own.length]) === own) return;\n try { apply(setAttribute, frame, [\"srcdoc\", own + doc]); } catch (e) { apply(removeAttribute, frame, [\"srcdoc\"]); }\n };\n const Observer = w.MutationObserver;\n const observe = Observer.prototype.observe;\n const watch = (root, all) => {\n const scan = () => {\n try {\n const frames = apply(all, root, [\"iframe[srcdoc]\"]);\n for (let i = apply(size, frames, []); i-- > 0;) first(frames[i]);\n } catch (e) {}\n sweep();\n };\n apply(observe, new Observer(scan), [root, { subtree: true, childList: true, attributes: true, attributeFilter: [\"srcdoc\"] }]);\n apply(listen, root, [\"load\", sweep, true]);\n scan();\n return root;\n };\n if (fresh) {\n const run = exec.value;\n const phase = describe(w.Event.prototype, \"eventPhase\").get;\n let tap = null;\n let trusted = null;\n const seen = (event) => {\n try {\n const found = describe(event, \"isTrusted\");\n if (found && found.get && apply(found.get, event, []) === true) { tap = event; trusted = found.get; }\n } catch (e) {}\n };\n const taps = [\"pointerdown\", \"pointerup\", \"mousedown\", \"mouseup\", \"click\", \"auxclick\", \"touchstart\", \"touchend\", \"keydown\", \"keyup\"];\n for (let i = 0; i < taps.length; i++) apply(listen, w, [taps[i], seen, true]);\n const tapping = () => {\n try { return tap !== null && apply(trusted, tap, []) === true && apply(phase, tap, []) !== 0; } catch (e) { return false; }\n };\n const guarded = function execCommand(command) {\n const name = apply(lower, text(command), []);\n if (name === \"paste\" || ((name === \"copy\" || name === \"cut\") && !tapping())) return false;\n const args = [name];\n for (let i = 1; i < arguments.length; i++) args[i] = arguments[i];\n return apply(run, this, args);\n };\n define(proto, \"execCommand\", { value: guarded, writable: false, enumerable: exec.enumerable, configurable: false });\n if (w.trustedTypes && !w.trustedTypes.defaultPolicy) {\n try {\n w.trustedTypes.createPolicy(\"default\", {\n createHTML: (input) => input,\n createScript: (input, type, sink) => (sink === \"Location href\" ? null : input),\n createScriptURL: (input) => input,\n });\n } catch (e) {}\n }\n const reopen = proto.open;\n proto.open = function () {\n const got = apply(reopen, this, arguments);\n try { if (apply(view, this, []) === w) apply(listen, this, [\"load\", sweep, true]); } catch (e) {}\n return got;\n };\n const shadowed = (html) => apply(index, apply(lower, html, []), [\"shadowrootmode\"]) >= 0;\n const Refused = w.TypeError;\n const refuse = () => { throw new Refused(\"A declarative shadow root is not allowed here\"); };\n const parsers = [[elements, \"setHTMLUnsafe\"], [w.ShadowRoot && w.ShadowRoot.prototype, \"setHTMLUnsafe\"], [w.Document, \"parseHTMLUnsafe\"]];\n for (let i = 0; i < parsers.length; i++) {\n const owner = parsers[i][0];\n const name = parsers[i][1];\n const real = owner && owner[name];\n if (typeof real !== \"function\") continue;\n owner[name] = function (html) {\n const checked = text(html);\n if (shadowed(checked)) refuse();\n return apply(real, this, arguments.length > 1 ? [checked, arguments[1]] : [checked]);\n };\n }\n let tail = \"\";\n const writes = [\"write\", \"writeln\"];\n for (let i = 0; i < writes.length; i++) {\n const real = proto[writes[i]];\n if (typeof real !== \"function\") continue;\n proto[writes[i]] = function () {\n let checked = \"\";\n for (let j = 0; j < arguments.length; j++) checked += text(arguments[j]);\n if (shadowed(tail + checked)) refuse();\n tail = apply(slice, tail + checked, [-16]);\n return apply(real, this, [checked]);\n };\n }\n const kinds = [\"HTMLIFrameElement\", \"HTMLFrameElement\", \"HTMLObjectElement\", \"HTMLEmbedElement\"];\n const reads = [\"contentWindow\", \"contentDocument\", \"getSVGDocument\"];\n for (let k = 0; k < kinds.length; k++) {\n const owner = w[kinds[k]] && w[kinds[k]].prototype;\n for (let r = 0; r < reads.length; r++) {\n const name = reads[r];\n const found = owner && describe(owner, name);\n const key = found && found.get ? \"get\" : \"value\";\n if (!found || typeof found[key] !== \"function\") continue;\n const read = found[key];\n found[key] = function () {\n const got = apply(read, this, arguments);\n try { shut(name === \"contentWindow\" ? got : apply(view, got, [])); } catch (e) {}\n return got;\n };\n try { define(owner, name, found); } catch (e) {}\n }\n }\n const inShadow = w.DocumentFragment.prototype.querySelectorAll;\n if (attachShadow) {\n elements.attachShadow = function () {\n const root = apply(attachShadow, this, arguments);\n try { watch(root, inShadow); } catch (e) {}\n return root;\n };\n }\n }\n if (!watched) watch(home, proto.querySelectorAll);\n } catch (e) {}\n})(window)";
25
+ /** `CLIPBOARD_GUARD_SCRIPT`'s hash, as a CSP source: the bridge's policy and a contact's own are given it. */
26
+ export declare const CLIPBOARD_GUARD_HASH = "'sha256-FGs001DxOSnlZv8nm6JyMeex+LlNQJzrCFbnJhAh8n4='";
@@ -285,7 +285,7 @@ export declare class DhtDelivery {
285
285
  pollMs?: number;
286
286
  /**
287
287
  * How often a contact that chose DHT only is read with the chat in the background, where every chat counts as open
288
- * (a CLI daemon: `ACTIVE_DHT_POLL_MS`). Absent: at the background pace (WISP 403, poll pace).
288
+ * (a CLI daemon: `ACTIVE_DHT_POLL_MS`), while that contact is there (`pollMs`). Absent: at the background pace (WISP 403, poll pace).
289
289
  */
290
290
  peerDhtPollMs?: number;
291
291
  /**
@@ -406,6 +406,15 @@ export declare class DhtDelivery {
406
406
  get inviteTaken(): boolean;
407
407
  /** The chat is open with the app in front: on the DHT, its mailbox is read at the signaling pace. */
408
408
  setActive(active: boolean): void;
409
+ /**
410
+ * The device clock now, with every time this side set by it kept no further ahead than it is ever set (`bounded`).
411
+ * The outbox times a text's receipt on a timer, which a step of the clock does not move; these times are judged by
412
+ * the clock. Taken as they were, a clock set back an hour (or one an hour ahead set right) while a text awaited its
413
+ * receipt held every later text of the chat for that hour though the outbox showed the text failed at five minutes,
414
+ * the text was not published again meanwhile and the chat read every 4 s; and a contact away counted as there, its
415
+ * mailbox read every 4 s for most of the hour (bug hunt, 2026-11-08). Kept so in memory; the next save writes them.
416
+ */
417
+ private clock;
409
418
  validate(text: string, timestamp: number, id: string, reply?: string, edit?: DhtEdit): string | null;
410
419
  /**
411
420
  * Measured, not built (`bodyFits`): the outbox asks it of every waiting text at each look, and a text that waits as no
@@ -513,6 +522,16 @@ export declare class DhtDelivery {
513
522
  private publishOnTick;
514
523
  /** How long until the next read of the contact's mailbox (WISP 403, poll pace). */
515
524
  get pollMs(): number;
525
+ /**
526
+ * This side is DHT only, and nothing waits on the contact's mailbox: the contact, pinned, is away (nothing new of its
527
+ * own in `PRESENCE_WINDOW`; it puts a keep-alive every four minutes while there), no text of ours awaits its receipt,
528
+ * and the chat is not on screen. Its mailbox is then read at the background pace, as background reads, not every 4 s:
529
+ * a daemon with 50 such chats looked each contact up on the Mainline DHT every ~3 s, 1,081 lookups a minute for as
530
+ * long as it ran, since its relays' budget held those reads and a held read nobody marked background goes to the DHT.
531
+ * The contact's next envelope (its first on coming back, or a text) is read at the next of those reads, and the
532
+ * 4 s pace is back from there. Just started, a contact there is read so until its next envelope too.
533
+ */
534
+ private dhtOnlyIdle;
516
535
  /**
517
536
  * How long ago this side's invite was made (or joined), while nobody used it (or its inviter never answered,
518
537
  * `unanswered`) and it is no longer awaited (`AWAITING_PEER_MS`).
@@ -32,6 +32,8 @@ export declare const ENGINE_ERRORS: {
32
32
  readonly ecashOtherUnit: "This ecash is in {unit}: only sat ecash can be redeemed here";
33
33
  readonly reviewedEcashSpent: "The ecash for this payment was already spent somewhere else. Nothing was sent, and your balance now shows what the mint still holds.";
34
34
  readonly reviewedSatsGone: "The sats this payment was reviewed with went to another payment. Nothing was sent: review it again.";
35
+ readonly mintFailedQuote: "{host} could not take this payment right now, and no sats left your wallet: try again later. The mint said: {reason}";
36
+ readonly mintFailedFaucet: "{host} could not give test coins right now: try again later. The mint said: {reason}";
35
37
  readonly lightningFeeTooHigh: "The Lightning fee ({fee} sats) is too high";
36
38
  readonly lightningRefused: "The mint refused this Lightning payment, and no sats left your wallet: it is safe to try again. The mint said: {reason}";
37
39
  readonly invoiceExpired: "That invoice has expired";
@@ -26,6 +26,7 @@ import { type ContactAskerFrame } from "./contactRecords.js";
26
26
  import { type WireReaction } from "./reactions.js";
27
27
  import { type WirePin } from "./pins.js";
28
28
  import { type TypingActivity } from "./pairedTyping.js";
29
+ import { type StatusState } from "./pairedStatus.js";
29
30
  import { type WireEdit } from "./pairedEdits.js";
30
31
  import { type PkarrTransport } from "./transport.js";
31
32
  import { type PairingProgress, type PairingRole } from "./pairingProgress.js";
@@ -146,6 +147,16 @@ export declare const LIVENESS_PING_MS = 15000;
146
147
  * side a round trip later, and seeing its current channel close first would make it drop the whole session.
147
148
  */
148
149
  export declare const SWITCH_RETIRE_MS = 3000;
150
+ /**
151
+ * A receiver takes at most this many `paired-rtc` frames from a contact per `RTC_SIGNAL_RATE_WINDOW_MS`, counted before
152
+ * their signature is checked; the rest are dropped. Each offer taken builds a new peer connection (and gathers for it).
153
+ * A person's busiest minute is under half of it, 30 frames: five moves to WebRTC (one every 12 s, back and forth), each
154
+ * with every offer again that refused answers bring (`ANSWER_REFUSED_REDIALS`) and both sides offering at once. One
155
+ * move without a refusal takes one or two. A signal dropped here is a move that does not connect: the chat stays where
156
+ * it is, as with any failed move.
157
+ */
158
+ export declare const RTC_SIGNAL_RECEIVE_LIMIT = 60;
159
+ export declare const RTC_SIGNAL_RATE_WINDOW_MS = 60000;
149
160
  export declare const LIVENESS_MISSED_PINGS = 3;
150
161
  /**
151
162
  * A ping with nothing at all back this long after it went: the contact may have crashed and started again, with its new
@@ -341,6 +352,11 @@ export interface GhostLinkEvents {
341
352
  * (recording, thinking, a bot's status); only changes, never stored.
342
353
  */
343
354
  onPeerTyping?(typing: boolean, activity: TypingActivity | null): void;
355
+ /**
356
+ * What the contact says of itself changed (`status/1`, WISP 401 § Presence and status): its presence, which ends with
357
+ * the session, and a status it set; only changes, never stored here.
358
+ */
359
+ onPeerStatus?(state: StatusState): void;
344
360
  /**
345
361
  * The contact reacted to a message (`react/1`, WISP 401 § Reactions), already checked. True: confirm it (it was
346
362
  * taken: shown, kept for its message, or older than what is shown); false: not now, it comes again.
@@ -498,6 +514,8 @@ export interface GhostLinkOptions {
498
514
  binaryFilesSupport?: boolean;
499
515
  /** Offer `typing/1` on paired sessions: say and show when either side is writing (1:1 chats, not group edges). */
500
516
  typingSupport?: boolean;
517
+ /** Offer `status/1` on paired sessions: say and show presence and a set status (1:1 chats, not group edges). */
518
+ statusSupport?: boolean;
501
519
  /** Offer `react/1` on paired sessions: reactions to messages (1:1 chats, not group edges). */
502
520
  reactionsSupport?: boolean;
503
521
  /** Offer `edit/1` on paired sessions: sent texts can be edited (1:1 chats, not group edges). */
@@ -755,6 +773,11 @@ export declare class GhostLink {
755
773
  /** Typing on this session (`typing/1`): when to say `start` again, and the contact's word with its timeout. */
756
774
  private readonly typingSender;
757
775
  private readonly typingReceiver;
776
+ /** Presence and status on this session (`status/1`): this side's word (kept across sessions) and the contact's. */
777
+ private readonly statusSender;
778
+ private readonly statusReceiver;
779
+ /** A status frame waiting for the send interval to pass. */
780
+ private statusTimer;
758
781
  /** Mini-apps on this session (`apps/1`): this side's open apps (kept across sessions), the peer's, the limits. */
759
782
  private readonly apps;
760
783
  /** The read lane on this session (`app-ranges/1`): what this side serves and what it asked; none of it outlives the session. */
@@ -765,6 +788,10 @@ export declare class GhostLink {
765
788
  private readonly pinsReceived;
766
789
  /** Edit frames the contact may send per window; the rest go unconfirmed and come again. */
767
790
  private readonly editsReceived;
791
+ /** Call signals the contact may send per window; the rest are dropped. */
792
+ private readonly callsReceived;
793
+ /** WebRTC signals the contact may send on the session (`paired-rtc`) per window; the rest are dropped. */
794
+ private readonly rtcSignalsReceived;
768
795
  private readonly wakeReceived;
769
796
  /** Said once a session by the requester's app: a few a minute at most. */
770
797
  private readonly askerReceived;
@@ -1130,6 +1157,11 @@ export declare class GhostLink {
1130
1157
  /** Tells the owner when the wait's view changed (its reason, failures, next retry). */
1131
1158
  private notifyWait;
1132
1159
  get availableTransports(): PairedTransport[];
1160
+ /**
1161
+ * The transport this side's policy names: on Automatic, the app's rule for what runs now (Iroh once its endpoint is
1162
+ * up, with Fallback on; with it off, WebRTC where there is one, so an endpoint coming up moves nothing).
1163
+ */
1164
+ private get ownPreferred();
1133
1165
  private transportOffer;
1134
1166
  registerEndpoint(endpoint: NativeEndpoint): void;
1135
1167
  /**
@@ -1533,6 +1565,18 @@ export declare class GhostLink {
1533
1565
  get peerTyping(): boolean;
1534
1566
  /** What the contact is doing now (typing, recording, thinking, and a bot's status), or null. */
1535
1567
  get peerTypingActivity(): TypingActivity | null;
1568
+ /** Both sides offer `status/1` on the open session: presence and a set status can be said and shown. */
1569
+ get supportsStatus(): boolean;
1570
+ /** What the contact says of itself: presence while this session is live and it shares it, a status while it lasts. */
1571
+ get peerStatus(): StatusState;
1572
+ /**
1573
+ * This side's presence and status (the whole state: `presence` left out when the person does not share it). Said on
1574
+ * the live session once both sides offer `status/1`, at most one frame per few seconds; kept for every next session.
1575
+ */
1576
+ setStatus(state: StatusState): void;
1577
+ private flushStatus;
1578
+ /** The session ended: the contact is not online here any more, and the next session is owed this side's whole state. */
1579
+ private endStatusSession;
1536
1580
  /** Both sides offer `wake/1` on the open session: push subscriptions can be shared (WISP 401 § Wake-up push). */
1537
1581
  get supportsWake(): boolean;
1538
1582
  /**
@@ -1613,8 +1657,8 @@ export declare class GhostLink {
1613
1657
  /** Why the read lane cannot be used for `app` now, or null when it can: open on both sides, on a live session that has it. */
1614
1658
  private appRangesRefusal;
1615
1659
  /**
1616
- * Lets the contact's `app` read `file` (what this side's app calls it) for as long as both have the app open on this
1617
- * session: the serve id to tell it, or why not.
1660
+ * Lets the contact's `app` read `file` (what this side's app calls it) for as long as both have the app open, across
1661
+ * a session change the apps are held across: the serve id to tell it, or why not.
1618
1662
  */
1619
1663
  serveAppFile(app: string, file: string): {
1620
1664
  serve: string;
@@ -1623,7 +1667,7 @@ export declare class GhostLink {
1623
1667
  };
1624
1668
  /** Ends a serve; false when it was not served (any more). */
1625
1669
  unserveAppFile(serve: string): boolean;
1626
- /** The serve ids `app` has given out on this session. */
1670
+ /** The serve ids `app` has given out and not ended. */
1627
1671
  appServes(app: string): string[];
1628
1672
  /**
1629
1673
  * Reads `length` bytes at `offset` of what the contact's `app` serves as `serve`: the bytes (fewer at the end of the
@@ -539,6 +539,14 @@ export declare class CommunitySession {
539
539
  private asked;
540
540
  /** Per member: until when what comes over its edge may be its answer to my sync (`ANSWER_WINDOW_MS`). In memory only. */
541
541
  private readonly answering;
542
+ /**
543
+ * Per member asked: what my sync said I have (`have`), the highest number its answer handed per author and commit
544
+ * (`top`), and whether anything of the answer came (`heard`). Once the answer is over (`settleGaps`), what it did
545
+ * not fill below those is nobody's to hand (a hint, never kept; a frame out of every store). In memory only.
546
+ */
547
+ private readonly answerOf;
548
+ /** Author → `e:h16` → the number up to which a gap is gone (`settleGaps`), not on its way: `missing` leaves it out. In memory only. */
549
+ private readonly gapsGone;
542
550
  /** The message frames given to `handle` that came live here (`CommunityIncomingMessage.live`): `passOn` marks them. */
543
551
  private readonly cameLive;
544
552
  /** Syncs answered per member, a few a minute (`COMMUNITY_LIMITS.syncAnswers`). In memory only. */
@@ -555,12 +563,16 @@ export declare class CommunitySession {
555
563
  /** My frames said again in this run (`e:h16:n`) → the id of the message they first were. In memory only. */
556
564
  private resealedFrom;
557
565
  private saveTimer;
558
- /** One metadata frame naming a commit or a secret I do not have yet: tried again when the chain or my secrets move. */
566
+ /** Metadata frames naming a commit or a secret I do not have yet, one signed by the admin and one by anyone else (`waitMeta`): tried again when the chain or my secrets move. */
559
567
  private pendingMeta;
560
568
  /** The store's frames the app holds with their messages (`storeKey` → message id): in memory here, not in what is saved. */
561
569
  private readonly onRows;
562
570
  /** The oldest epoch whose seen marks are kept, as of the last `pruneSeen`. In memory only. */
563
571
  private seenFrom;
572
+ /** The secret of the epoch I left in (`leave`), for `followAfterLeave`. In memory only. */
573
+ private leftSecret;
574
+ /** After my leave, still taking commits and secrets (`followAfterLeave`). In memory only. */
575
+ private following;
564
576
  /** `rows`: the frames the app holds with the messages it stored (`CommunityIncomingMessage.frame`). They join the store. */
565
577
  constructor(state: CommunityState, hooks: CommunitySessionHooks, rows?: readonly {
566
578
  id: string;
@@ -682,7 +694,20 @@ export declare class CommunitySession {
682
694
  h?: unknown;
683
695
  loc?: unknown;
684
696
  }): CommunityCommitFrame[];
697
+ /**
698
+ * How many of a member's messages under the current commit are known to be missing: on their way, not gone (a
699
+ * finished answer did not fill it, `settleGaps`; or syncs gave it up, `haveOf`). A hint spends its author's number
700
+ * and is never kept (WISP 903), so a member who was away counted it missing until the commit changed.
701
+ */
685
702
  missing(sender: string): number;
703
+ /**
704
+ * Gaps that the answers now over did not fill count as gone: an answer hands every frame its member holds above what
705
+ * my sync said I have, so a number below my mark then, or below the highest it handed, that is still not here is
706
+ * held by nobody. Returns whether some became gone (the members view changes). A sync nobody answered settles nothing.
707
+ */
708
+ settleGaps(): boolean;
709
+ /** The gaps of the answers now over (`settleGaps`), without the prune. */
710
+ private settleAnswers;
686
711
  /**
687
712
  * Replays the main branch (rosters kept for its window) and places the side commits. The main branch was verified
688
713
  * commit by commit when it was accepted: its signatures are not checked again.
@@ -772,9 +797,17 @@ export declare class CommunitySession {
772
797
  * kept, only get what is left of the bound, the most recent first.
773
798
  */
774
799
  private pruneSecrets;
800
+ /** The epoch of the commit on the main branch that took `key` out (`outIndex`), while it is out. */
801
+ private outEpoch;
802
+ /**
803
+ * 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.
804
+ * A member stops being one at the commit that takes it out: a side branch from before it may list it still, at that
805
+ * epoch or later, and that epoch's secret and every later one never reach it.
806
+ */
807
+ private readsAt;
775
808
  /** A derived epoch's secret, from its parent's, when that is held. */
776
809
  private takeDerived;
777
- /** A sealed secret for a known commit I am in the roster of: kept only when it confirms. */
810
+ /** A sealed secret for a known commit I read (`readsAt`): kept only when it confirms. */
778
811
  private takeSecret;
779
812
  private serialize;
780
813
  private persist;
@@ -824,9 +857,31 @@ export declare class CommunitySession {
824
857
  replaceLink(off?: boolean, now?: number): Promise<string>;
825
858
  /**
826
859
  * Leaves: a signed request any other member commits, and my secrets go now. The admin must
827
- * hand over the role first (the engine does it for a leaving admin).
860
+ * hand over the role first (the engine does it for a leaving admin). `follow`: commits and secrets are still taken
861
+ * after (`followAfterLeave`).
862
+ */
863
+ leave(follow?: boolean): Promise<CommunityLeaveFrame | null>;
864
+ /**
865
+ * After I left with `follow` (WISP 903 § Leaving, "A role that reaches a leave"): commits and secrets are taken still,
866
+ * as a member whose admission lost takes them, so a hand-over that crossed my leave reaches me (`handOnAfterLeave`).
867
+ * Once the app has forgotten the group (nothing is saved any more), the secret of the epoch I left in comes back, in
868
+ * memory only, for the epochs derived from it. Nothing else is heard.
869
+ */
870
+ followAfterLeave(): Promise<void>;
871
+ /**
872
+ * After I left, a chain that names me the admin (a hand-over that crossed my leave): the role goes on to
873
+ * `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
874
+ * the signer of the newest `role` on my branch, whatever members committed on top since: an admission there would
875
+ * otherwise steer the role to whoever let someone in. True when it went; false while the secret of my tip has not
876
+ * come (it is tried again).
877
+ */
878
+ handOnAfterLeave(pick: (by: string) => string | undefined, now?: number): Promise<boolean>;
879
+ /**
880
+ * 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
881
+ * missing): the engine asks my edges for it (`catchUp`) while I follow, so the role can go on. Only what I still read
882
+ * comes back (`readsAt`): epochs before the commit that takes me out, never that one's nor any later.
828
883
  */
829
- leave(): Promise<CommunityLeaveFrame | null>;
884
+ get leftWaitsForSecret(): boolean;
830
885
  /** Commits the leave requests I hold whose members are still in: the engine calls this on hubs. */
831
886
  commitPendingLeaves(now?: number): Promise<number>;
832
887
  /**
@@ -964,6 +1019,12 @@ export declare class CommunitySession {
964
1019
  handle(from: string, raw: unknown): Promise<boolean>;
965
1020
  /** After a secret came that confirms: a branch that waited for it may be the one to follow now (see `better`). */
966
1021
  private tookSecrets;
1022
+ /**
1023
+ * The member a leave frame is from, when that member signed it and is in this admission (as `receiveLeave` checks);
1024
+ * else undefined. For an app that left and follows the chain (`followAfterLeave`): it holds no requests, and a leave
1025
+ * it counts takes that member out of whom a role that reached it goes on to.
1026
+ */
1027
+ signedLeave(frame: Record<string, unknown>): string | undefined;
967
1028
  private receiveLeave;
968
1029
  /**
969
1030
  * What a hub hands on of a frame it took (`handle` said it was new): as it came, without the live mark of whoever
@@ -988,6 +1049,8 @@ export declare class CommunitySession {
988
1049
  * filled (the stores rolled past it, a leaver's frames) is given up: each answer hands what is stored above it again.
989
1050
  */
990
1051
  private haveOf;
1052
+ /** A frame (known to be its author's) from a member whose answer to my sync is open: the highest it handed (`settleGaps`). */
1053
+ private handedInAnswer;
991
1054
  private markSeen;
992
1055
  private park;
993
1056
  /** Something is missing here: the current epoch's secret, or the epoch of a member's frames waiting. */
@@ -1032,6 +1095,12 @@ export declare class CommunitySession {
1032
1095
  * whether it was new, so a hub relays it. One naming what I do not have yet waits for the chain.
1033
1096
  */
1034
1097
  private receiveMeta;
1098
+ /**
1099
+ * A statement that waits for the chain: only one its signer signed, so an altered copy cannot push out the one
1100
+ * waiting. The admin I know has a place of their own, which another member's statement cannot take, and in each
1101
+ * place only a later statement takes the one waiting.
1102
+ */
1103
+ private waitMeta;
1035
1104
  /**
1036
1105
  * Who made the change a statement brings me (`at`: its commit's place on my main branch): its signer, when they were
1037
1106
  * the admin all along since the statement I held (or, with none, since I got in). A new admin signs again what the
@@ -496,7 +496,7 @@ export declare class GroupSession {
496
496
  private messagePace;
497
497
  private editPace;
498
498
  private queue;
499
- /** One metadata frame that names a commit or an epoch I do not have yet: tried again when the chain moves. */
499
+ /** Metadata frames that name a commit or an epoch I do not have yet, one signed by the admin and one by anyone else (`waitMeta`): tried again when the chain moves. */
500
500
  private pendingMeta;
501
501
  /** While `handle` runs: the frames it took that a hub passes on (`handle`'s result). */
502
502
  private passOn;
@@ -509,6 +509,12 @@ export declare class GroupSession {
509
509
  * them is not handed them again at every sync. In memory only.
510
510
  */
511
511
  private leaversHanded;
512
+ /**
513
+ * The kept edits each hub I count on was handed that it cannot read (`editKey`): of epochs from before it was let in,
514
+ * 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
515
+ * own. In memory only.
516
+ */
517
+ private carriedHanded;
512
518
  /** Syncs answered per member, a few a minute (`GROUP_LIMITS.syncAnswers`). In memory only. */
513
519
  private syncsAnswered;
514
520
  /**
@@ -1004,6 +1010,12 @@ export declare class GroupSession {
1004
1010
  * it names into metadata Ghostly shows. One naming what I do not have yet waits for the chain.
1005
1011
  */
1006
1012
  private receiveMeta;
1013
+ /**
1014
+ * A statement that waits for the chain: only one its signer signed, so an altered copy cannot push out the one
1015
+ * waiting. The admin I know has a place of their own, which another member's statement cannot take, and in each
1016
+ * place only a later statement takes the one waiting.
1017
+ */
1018
+ private waitMeta;
1007
1019
  /**
1008
1020
  * Who made the change a statement brings me: its signer, when they were the admin all along since the statement I
1009
1021
  * held (or, with none, since I got in). A new admin signs again what the last one set (`metaFollowsChain`): to a
@@ -105,6 +105,8 @@ export declare class CarriedTransport implements PkarrTransport {
105
105
  private readonly hooks;
106
106
  /** My last packet while the edge is down: what a member that just became reachable is handed. */
107
107
  private mine;
108
+ /** The records `mine` holds, as members last took them, and when. */
109
+ private handed;
108
110
  private lastTimestamp;
109
111
  /** The date each packet `stamp` signed carries: the relays' transport takes it rather than check the signature again. */
110
112
  private readonly dated;
@@ -22,12 +22,23 @@ export declare function formatLocalTarget(target: LocalTarget): string;
22
22
  export declare function resolveTargetUrl(target: LocalTarget, path: string): string | null;
23
23
  export declare function sanitizeRequestHeaders(headers: HeaderList): HeaderList;
24
24
  export declare function sanitizeResponseHeaders(headers: HeaderList, target: LocalTarget): HeaderList;
25
+ /**
26
+ * The contact's headers a viewer does not pass on: each makes the browser send something to a place it names, outside
27
+ * `connect-src` (violation and network-error reports, and the endpoints they go to; `Link` preloads, prefetches and
28
+ * early connections). With Hide my IP from contacts on, that place would learn this device's address. The same list
29
+ * as the CLI's `OPENED_SERVICE_DROPPED_HEADERS` and Desktop's `DROPPED_HEADERS`.
30
+ */
31
+ export declare const VIEWER_DROPPED_HEADERS: string[];
32
+ /** The directives of a contact's policy that send reports to a URL it names, dropped from it (`OPENED_SERVICE_DROPPED_DIRECTIVES`). */
33
+ export declare const VIEWER_DROPPED_DIRECTIVES: string[];
25
34
  /**
26
35
  * A contact's response headers as a viewer serves them to the page (the extension's viewer tab, Desktop's viewer
27
- * window). The contact's app decides them, and the wire checks only that they are strings, so a header whose name
36
+ * window, the web app's view).
37
+ * The contact's app decides them, and the wire checks only that they are strings, so a header whose name
28
38
  * is not a token or whose value carries CR, LF or NUL is dropped: it could otherwise add headers of its own. Each
29
39
  * `Set-Cookie` stays on the exact origin it came from (no `Domain=`), and one holding several cookies on separate
30
- * lines becomes one header per cookie.
40
+ * lines becomes one header per cookie. No header or policy directive that sends a report or an early request elsewhere
41
+ * (`VIEWER_DROPPED_HEADERS`, `VIEWER_DROPPED_DIRECTIVES`); a policy left empty goes.
31
42
  */
32
43
  export declare function viewerResponseHeaders(headers: HeaderList): HeaderList;
33
44
  /**
@@ -38,11 +49,20 @@ export declare function viewerResponseHeaders(headers: HeaderList): HeaderList;
38
49
  * packages/cli/src/services.ts).
39
50
  */
40
51
  export declare const VIEWER_SERVICE_CSP = "default-src 'self' https: data: blob: 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; form-action 'self'";
52
+ /**
53
+ * The policy while Hide my IP from contacts is on (`relayOnly`, WISP 100 § Relay only): `VIEWER_SERVICE_CSP` without
54
+ * `https:`, so the app loads nothing but its own origin (and inline, data: and blob: content). A picture, script or
55
+ * frame from a server the contact names would show that server this device's address. The same value as Desktop's
56
+ * `SERVICE_CSP_RELAY_ONLY` and `OPENED_SERVICE_CSP_RELAY_ONLY`.
57
+ */
58
+ export declare const VIEWER_SERVICE_CSP_RELAY_ONLY = "default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; form-action 'self'";
59
+ /** Ghostly's policy for a contact's app, by whether Hide my IP from contacts is on. */
60
+ export declare function viewerServicePolicy(relayOnly: boolean): string;
41
61
  /**
42
62
  * `headers` with Ghostly's policy after the contact's own, all in one `content-security-policy` joined by commas: a
43
63
  * browser enforces every policy of the list, so the contact's can narrow Ghostly's but never widen it.
44
64
  */
45
- export declare function withViewerPolicy(headers: HeaderList): HeaderList;
65
+ export declare function withViewerPolicy(headers: HeaderList, relayOnly?: boolean): HeaderList;
46
66
  /**
47
67
  * Turns `http://localhost:3400/base/x` into `/x` so the client never learns or
48
68
  * follows the local address. Null when the location is not on the target origin
@@ -260,6 +260,13 @@ export declare class IdentityExchange {
260
260
  /** The channel is ready: say what we verify, then send what the person queued while offline. */
261
261
  ready(): void;
262
262
  stop(): void;
263
+ /**
264
+ * The challenges whose window ended unanswered go, and with them their requests' lines still verifying: a contact
265
+ * whose app closed, or whose proof left its profile, before it presented tells this side nothing, and its line read
266
+ * "verifying" for good. No write when none ended.
267
+ */
268
+ expire(): Promise<void>;
269
+ private withoutExpired;
263
270
  /** Share a proof of this profile with this contact: now if connected, else when it next is. */
264
271
  share(id: string, connected: boolean): Promise<void>;
265
272
  private request;
@@ -62,6 +62,12 @@ export type IdentityTimelineEvent =
62
62
  type: "unsent";
63
63
  side: "mine";
64
64
  proof: string;
65
+ }
66
+ /** The contact asked for a challenge and presented nothing within its window: its entry goes, as `unsent` does. */
67
+ | {
68
+ type: "unanswered";
69
+ side: "theirs";
70
+ proof: string;
65
71
  };
66
72
  /** Entries a chat keeps, newest last. */
67
73
  export declare const IDENTITY_TIMELINE_MAX = 100;
@@ -26,6 +26,8 @@ export * from "./callSignal.js";
26
26
  export * from "./signal.js";
27
27
  export * from "./frames.js";
28
28
  export * from "./http.js";
29
+ export * from "./viewerGuard.js";
30
+ export * from "./clipboardGuard.js";
29
31
  export * from "./link.js";
30
32
  export * from "./datalink.js";
31
33
  export * from "./ghostlink.js";
@@ -36,6 +38,7 @@ export * from "./video.js";
36
38
  export * from "./image.js";
37
39
  export * from "./pictureMetadata.js";
38
40
  export * from "./videoMetadata.js";
41
+ export * from "./audioMetadata.js";
39
42
  export * from "./linkPreview.js";
40
43
  export * from "./messageTime.js";
41
44
  export * from "./payments.js";
@@ -48,6 +51,7 @@ export * from "./pairedSession.js";
48
51
  export * from "./pairedCapabilities.js";
49
52
  export * from "./pairedCalls.js";
50
53
  export * from "./pairedTyping.js";
54
+ export * from "./pairedStatus.js";
51
55
  export * from "./pairedApps.js";
52
56
  export * from "./pairedAppRanges.js";
53
57
  export * from "./webPush.js";
@@ -286,6 +286,8 @@ export declare class LinkSession {
286
286
  private upkeepOnly;
287
287
  /** The last write this link asked for was a background one (`retryDelay`). */
288
288
  private wroteInBackground;
289
+ /** The records built for a packet that did not go out, and what they say: a try again of the same reuses them (`publishOnce`). */
290
+ private unsent;
289
291
  private pollTimer;
290
292
  private heartbeatTimer;
291
293
  private lastActivity;
@@ -93,8 +93,8 @@ export interface MiniAppApi {
93
93
  forget(id: string): Promise<void>;
94
94
  /**
95
95
  * Lets the same app on the contact's side read one kept file (the `chat` permission too, in a chat open on both
96
- * sides): answers a serve id for the app to tell its contact in its own `chat.send`. It lasts until `unserve`, this
97
- * side or the contact closes the app, or the session ends.
96
+ * sides): answers a serve id for the app to tell its contact in its own `chat.send`. It lasts until `unserve`, or
97
+ * until this side or the contact closes the app; a reconnect the app is kept open across keeps it.
98
98
  */
99
99
  serve(id: string): Promise<string>;
100
100
  /** Ends one serve. A serve id that is no longer served is no error. */