@fkn/lib 0.9.43 → 0.9.44

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.
@@ -1,5 +1,5 @@
1
- import { D as IpFamily, Dt as UdpSocketOptions, Et as UdpDatagram, H as ProxyFetchInput, I as PackagesErrorCode, J as RoomClaimOptions, K as Resolvers, N as OverlayState, Nt as WriteData, P as PackageQuery, Q as RoomEvent, R as PickOptions, St as TcpSocketListenerOptions, T as InstallOptions, V as ProxyFetchInit, a as AccountChange, at as RoomPermission, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, et as RoomJoinOptions, it as RoomOpenOptions, l as AdoptState, m as ConnectOptions, o as AccountPinOptions, p as ConnectAvailability, st as RoomsErrorCode, tt as RoomMailbox, u as ConflictChoice, wt as TcpSocketOptions, x as FrameConsentRequest, z as Placement } from "./contract-DJxGa8lb.js";
2
- import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
1
+ import { D as IpFamily, Dt as UdpSocketOptions, Et as UdpDatagram, H as ProxyFetchInput, I as PackagesErrorCode, J as RoomClaimOptions, K as Resolvers, N as OverlayState, Nt as WriteData, P as PackageQuery, Q as RoomEvent, R as PickOptions, St as TcpSocketListenerOptions, T as InstallOptions, V as ProxyFetchInit, a as AccountChange, at as RoomPermission, b as FrameConsentAnswer, c as AdoptRequest, d as ConflictRequest, et as RoomJoinOptions, it as RoomOpenOptions, l as AdoptState, m as ConnectOptions, o as AccountPinOptions, p as ConnectAvailability, st as RoomsErrorCode, tt as RoomMailbox, u as ConflictChoice, wt as TcpSocketOptions, x as FrameConsentRequest, z as Placement } from "./contract-6Xfd_qel.js";
2
+ import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-BwA4JjZH.js";
3
3
  import { Remote } from "osra";
4
4
  //#region src/api-epochs.d.ts
5
5
  type EpochListener<T> = (remote: T, epoch: number) => void;
@@ -8,10 +8,9 @@ type EpochListener<T> = (remote: T, epoch: number) => void;
8
8
  declare const hasTransport: boolean;
9
9
  type Api = Remote<Resolvers>;
10
10
  /**
11
- * The broker api. Settles when the first connection exists, exactly as before, but resolves with a
12
- * stable facade that always routes to the NEWEST connection, so holding the resolved value across a
13
- * broker replacement is safe. A call in flight at the moment of replacement rejects with a named
14
- * error instead of hanging.
11
+ * The broker api. Settles when the first connection exists and resolves with a stable facade that
12
+ * always routes to the NEWEST connection, so holding the resolved value across a broker replacement
13
+ * is safe. A call in flight at the moment of replacement rejects with a named error instead of hanging.
15
14
  *
16
15
  * A window realm that relays its channel to a worker (`relayWorker`) moves its own calls to a channel
17
16
  * of their own, never back to the relayed one. There it also settles once the realm relays, a call in
@@ -21,23 +20,14 @@ type Api = Remote<Resolvers>;
21
20
  */
22
21
  declare const apiPromise: Promise<Api>;
23
22
  /**
24
- * `apiPromise` bounded by a deadline, for call sites that must not park forever.
23
+ * The deadline of `apiWithin`, for call sites that own a socket, a timer or a UI and must not park.
24
+ * `apiPromise` NEVER REJECTS: a broker frame that never bridges leaves it pending for the realm's
25
+ * life. In a worker the transport `{receive: self, emit: self}` is inert until the page bridges it,
26
+ * so an unbridged worker parks every socket call with no `listening`, `error` or rejection, which
27
+ * presents as a transport fault invisible from every counter.
25
28
  *
26
- * `apiPromise` NEVER REJECTS: `epochs.first` settles only when a broker connection exists, so a
27
- * broker frame that never bridges leaves it pending for the life of the realm. Awaiting it directly
28
- * is correct wherever hanging is the honest answer, and wrong wherever the caller owns a socket, a
29
- * timer or a UI that has to say something.
30
- *
31
- * That distinction is not academic. In a WORKER realm the osra transport is `{receive: self,
32
- * emit: self}`, which is inert until the page bridges it, so an unbridged worker parks every socket
33
- * call here with no `listening`, no `error` and no rejection. The engine then reports a listener
34
- * that neither succeeded nor failed, its reopen counters stay at 0 because reopen only runs from an
35
- * `error` or `close` that never arrives, and the relay is never contacted at all. That state cost a
36
- * long diagnosis: it presents as a transport fault and is invisible from every counter.
37
- *
38
- * The latch mirrors `storage.ts`: once the broker has missed one deadline, later calls stop paying
39
- * the full wait. `net.ts` needs it especially, because its listen path is `bind('::').catch(() =>
40
- * bind('0.0.0.0'))`, so an unbounded-then-rejecting version would charge the deadline twice.
29
+ * Once one deadline is missed, later calls wait only the retry deadline (as `storage.ts` does):
30
+ * `net.ts` listens with `bind('::').catch(() => bind('0.0.0.0'))` and would otherwise pay it twice.
41
31
  */
42
32
  declare const API_DEADLINE_MS = 8000;
43
33
  declare class BrokerUnreachableError extends Error {
@@ -45,15 +35,14 @@ declare class BrokerUnreachableError extends Error {
45
35
  }
46
36
  /**
47
37
  * A page's own call, refused because the page relays its FKN channel to a worker (`relayWorker`) and
48
- * the broker it reached never answered on the page's own channel within the deadline: a broker
49
- * document from before that channel, as fkn.app's service worker can still serve from its cache. The
50
- * page's own calls never fall back to the relayed channel, so this is the answer until a reload
51
- * reaches a newer broker. The relayed worker's calls are unaffected.
38
+ * the broker never answered on the page's own channel within the deadline: a broker document from
39
+ * before that channel, as fkn.app's service worker can still serve from its cache. The page's own
40
+ * calls never fall back to the relayed channel, so this is the answer until a reload reaches a newer
41
+ * broker. The relayed worker's calls are unaffected.
52
42
  *
53
- * What the page registered on the relayed channel went with it, and nothing registers it again until
54
- * then: FKN's UI on this page (the prompts and header the broker draws over it, those the worker's
55
- * calls raise included) is no longer placed, and account changes are no longer heard. So the realm also logs this error
56
- * once with `console.error` when the deadline passes, whether or not the page calls.
43
+ * What the page registered on the relayed channel went with it: FKN's UI over this page is no longer
44
+ * placed and account changes are no longer heard. So the realm also logs this error once with
45
+ * `console.error` when the deadline passes, whether or not the page calls.
57
46
  */
58
47
  declare class OwnChannelUnavailableError extends Error {
59
48
  constructor();
@@ -322,6 +311,7 @@ declare const onApiEpoch: (listener: EpochListener<{
322
311
  claimed: boolean;
323
312
  mailbox: RoomMailbox | null;
324
313
  temporaryClaims?: true;
314
+ mailboxSwitch?: true;
325
315
  defaults: () => Promise<{
326
316
  readonly send: boolean;
327
317
  readonly receive: boolean;
@@ -410,6 +400,12 @@ declare const onApiEpoch: (listener: EpochListener<{
410
400
  } | {
411
401
  ok: true;
412
402
  }>;
403
+ setMailbox: (on: boolean) => Promise<{
404
+ error: RoomsErrorCode;
405
+ message: string;
406
+ } | {
407
+ ok: true;
408
+ }>;
413
409
  release: () => Promise<{
414
410
  error: RoomsErrorCode;
415
411
  message: string;
@@ -453,6 +449,7 @@ declare const onApiEpoch: (listener: EpochListener<{
453
449
  claimed: boolean;
454
450
  mailbox: RoomMailbox | null;
455
451
  temporaryClaims?: true;
452
+ mailboxSwitch?: true;
456
453
  defaults: () => Promise<{
457
454
  readonly send: boolean;
458
455
  readonly receive: boolean;
@@ -541,6 +538,12 @@ declare const onApiEpoch: (listener: EpochListener<{
541
538
  } | {
542
539
  ok: true;
543
540
  }>;
541
+ setMailbox: (on: boolean) => Promise<{
542
+ error: RoomsErrorCode;
543
+ message: string;
544
+ } | {
545
+ ok: true;
546
+ }>;
544
547
  release: () => Promise<{
545
548
  error: RoomsErrorCode;
546
549
  message: string;
@@ -584,6 +587,7 @@ declare const onApiEpoch: (listener: EpochListener<{
584
587
  claimed: boolean;
585
588
  mailbox: RoomMailbox | null;
586
589
  temporaryClaims?: true;
590
+ mailboxSwitch?: true;
587
591
  defaults: () => Promise<{
588
592
  readonly send: boolean;
589
593
  readonly receive: boolean;
@@ -672,6 +676,12 @@ declare const onApiEpoch: (listener: EpochListener<{
672
676
  } | {
673
677
  ok: true;
674
678
  }>;
679
+ setMailbox: (on: boolean) => Promise<{
680
+ error: RoomsErrorCode;
681
+ message: string;
682
+ } | {
683
+ ok: true;
684
+ }>;
675
685
  release: () => Promise<{
676
686
  error: RoomsErrorCode;
677
687
  message: string;
@@ -1039,6 +1049,7 @@ declare const currentApiEpoch: () => {
1039
1049
  claimed: boolean;
1040
1050
  mailbox: RoomMailbox | null;
1041
1051
  temporaryClaims?: true;
1052
+ mailboxSwitch?: true;
1042
1053
  defaults: () => Promise<{
1043
1054
  readonly send: boolean;
1044
1055
  readonly receive: boolean;
@@ -1127,6 +1138,12 @@ declare const currentApiEpoch: () => {
1127
1138
  } | {
1128
1139
  ok: true;
1129
1140
  }>;
1141
+ setMailbox: (on: boolean) => Promise<{
1142
+ error: RoomsErrorCode;
1143
+ message: string;
1144
+ } | {
1145
+ ok: true;
1146
+ }>;
1130
1147
  release: () => Promise<{
1131
1148
  error: RoomsErrorCode;
1132
1149
  message: string;
@@ -1170,6 +1187,7 @@ declare const currentApiEpoch: () => {
1170
1187
  claimed: boolean;
1171
1188
  mailbox: RoomMailbox | null;
1172
1189
  temporaryClaims?: true;
1190
+ mailboxSwitch?: true;
1173
1191
  defaults: () => Promise<{
1174
1192
  readonly send: boolean;
1175
1193
  readonly receive: boolean;
@@ -1258,6 +1276,12 @@ declare const currentApiEpoch: () => {
1258
1276
  } | {
1259
1277
  ok: true;
1260
1278
  }>;
1279
+ setMailbox: (on: boolean) => Promise<{
1280
+ error: RoomsErrorCode;
1281
+ message: string;
1282
+ } | {
1283
+ ok: true;
1284
+ }>;
1261
1285
  release: () => Promise<{
1262
1286
  error: RoomsErrorCode;
1263
1287
  message: string;
@@ -1301,6 +1325,7 @@ declare const currentApiEpoch: () => {
1301
1325
  claimed: boolean;
1302
1326
  mailbox: RoomMailbox | null;
1303
1327
  temporaryClaims?: true;
1328
+ mailboxSwitch?: true;
1304
1329
  defaults: () => Promise<{
1305
1330
  readonly send: boolean;
1306
1331
  readonly receive: boolean;
@@ -1389,6 +1414,12 @@ declare const currentApiEpoch: () => {
1389
1414
  } | {
1390
1415
  ok: true;
1391
1416
  }>;
1417
+ setMailbox: (on: boolean) => Promise<{
1418
+ error: RoomsErrorCode;
1419
+ message: string;
1420
+ } | {
1421
+ ok: true;
1422
+ }>;
1392
1423
  release: () => Promise<{
1393
1424
  error: RoomsErrorCode;
1394
1425
  message: string;
package/api.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { K as Resolvers } from "./contract-DJxGa8lb.js";
2
- import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-H1TzWitc.js";
1
+ import { K as Resolvers } from "./contract-6Xfd_qel.js";
2
+ import { a as apiLastCall, c as currentApiEpoch, i as apiInFlight, l as hasTransport, n as BrokerUnreachableError, o as apiPromise, r as OwnChannelUnavailableError, s as apiWithin, t as API_DEADLINE_MS, u as onApiEpoch } from "./api-CFkZVr53.js";
3
3
  export { API_DEADLINE_MS, BrokerUnreachableError, OwnChannelUnavailableError, type Resolvers, apiInFlight, apiLastCall, apiPromise, apiWithin, currentApiEpoch, hasTransport, onApiEpoch };
@@ -2,9 +2,8 @@
2
2
  /** What `normalizeHosts` keeps beyond a bare hostname. */
3
3
  type NormalizeHostsOptions = {
4
4
  /**
5
- * Keep a bracketed IPv6 literal, in the canonical form `URL.hostname` reports, because that is
6
- * the value a document or a fetch is compared against. Off by default: only the extension's own
7
- * callers pass it, so the cloud's declared hosts (`normalizeDeclaredHosts`) stay what they were.
5
+ * Keep a bracketed IPv6 literal, in the canonical form `URL.hostname` reports (what a document or
6
+ * fetch is compared against). Off by default; only the extension's own callers pass it.
8
7
  */
9
8
  ipv6?: boolean;
10
9
  };
@@ -18,12 +17,11 @@ declare const normalizeHosts: (raw: readonly string[], { ipv6 }?: NormalizeHosts
18
17
  //#endregion
19
18
  //#region src/attach-policy.d.ts
20
19
  /**
21
- * The pure half of the middle page's frame.fetch gate: everything that can be decided from the
22
- * attachment's own facts, with no broker and no UI. The middle page enforces this on EVERY fetch
23
- * call, because any app can drive the 'fkn-attach-frame' channel directly and skip the client
24
- * library's copy of the same checks.
20
+ * The pure half of the middle page's frame.fetch gate: what can be decided from the attachment's own
21
+ * facts, with no broker and no UI. The middle page enforces it on EVERY fetch call, because any app
22
+ * can drive the 'fkn-attach-frame' channel directly and skip the library's copy of the checks.
25
23
  *
26
- * Refusals here must surface under a TERMINAL locator error name (the caller maps them through
24
+ * Refusals must surface under a TERMINAL locator error name (callers map them through
27
25
  * `locatorDeniedError`), or the shared dispatch loop retries them to its 30 second deadline and
28
26
  * reports a timeout that names neither the operation nor the reason.
29
27
  */
@@ -44,13 +42,11 @@ export type FrameFetchVerdict = {
44
42
  promptHosts: string[];
45
43
  };
46
44
  /**
47
- * How a fetch url is read.
48
- *
49
- * `'no-base'` is `new URL(url)`, which accepts the two base-dependent forms `https:h/x` and
50
- * `http:h/x` as if they named `h`. `'fetchTarget'` is the shared classifier, which calls those
51
- * relative and refuses them here. The middle page keeps `'no-base'` until the contract deploy, so
52
- * an application on an older library is refused nothing it was not refused before; the library's
53
- * own gate passes `'fetchTarget'`.
45
+ * How a fetch url is read. `'no-base'` is `new URL(url)`, which accepts the base-dependent forms
46
+ * `https:h/x` and `http:h/x` as if they named `h`. `'fetchTarget'` is the shared classifier, which
47
+ * calls those relative and refuses them. The middle page keeps `'no-base'` until the contract deploy,
48
+ * so an application on an older library is refused nothing new; the library's own gate passes
49
+ * `'fetchTarget'`.
54
50
  */
55
51
  export type FrameFetchClassifier = 'no-base' | 'fetchTarget';
56
52
  export declare const frameFetchVerdict: (policy: FrameFetchPolicy, url: unknown, { classifier }?: {
package/cloud/dns.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { s as AddressLookupResult } from "../contract-DJxGa8lb.js";
1
+ import { s as AddressLookupResult } from "../contract-6Xfd_qel.js";
2
2
  import { lookup } from "../dns.js";
3
3
  export { type AddressLookupResult, lookup };
package/cloud/fetch.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as cloudFetch } from "../proxy-ylK5lpw8.js";
1
+ import { t as cloudFetch } from "../proxy-dOOmiMl4.js";
2
2
  export { cloudFetch as fetch };
@@ -1,5 +1,5 @@
1
1
  import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions } from "../../index-BQgZVQl7.js";
2
- import "../../fs-D0MMRnHC.js";
2
+ import "../../fs-KA1Mgisv.js";
3
3
  //#region src/cloud/fs-promises.d.ts
4
4
  export declare const readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>, writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>, unlink: (path: import("node:fs").PathLike) => Promise<void>, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>, readdir: (path: import("node:fs").PathLike) => Promise<string[]>, mkdir: (_path?: import("node:fs").PathLike, _options?: MakeOptions) => Promise<void>, rm: (path: import("node:fs").PathLike, options?: {
5
5
  recursive?: boolean;
package/cloud/fs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as Stats } from "../index-BQgZVQl7.js";
2
- import { _ as unlock, a as StorageAccountChangedError, c as StorageNotFoundError, f as encryption, h as quota, i as SealedRead, l as StorageQuota, m as isNotFound, n as EncryptionStatus, o as StorageAccountPinUnsupportedError, p as isAccountChanged, r as FileEntry, s as StorageLockedError, t as CloudAvailability, u as availability } from "../storage-BVr2Rb-d.js";
3
- import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, u as STORAGE_NOT_FOUND } from "../messages-CRcziTuC.js";
4
- import { a as promises, c as readdir, d as stat, f as unlink, i as mkdir, l as rename, o as readFile, p as writeFile, r as list, s as readFileSealed, t as available, u as rm } from "../fs-D0MMRnHC.js";
2
+ import { _ as unlock, a as StorageAccountChangedError, c as StorageNotFoundError, f as encryption, h as quota, i as SealedRead, l as StorageQuota, m as isNotFound, n as EncryptionStatus, o as StorageAccountPinUnsupportedError, p as isAccountChanged, r as FileEntry, s as StorageLockedError, t as CloudAvailability, u as availability } from "../storage-BLBsmkmp.js";
3
+ import { c as STORAGE_ACCOUNT_CHANGED, l as STORAGE_ACCOUNT_PIN_UNSUPPORTED, u as STORAGE_NOT_FOUND } from "../messages-d7pvCXPn.js";
4
+ import { a as promises, c as readdir, d as stat, f as unlink, i as mkdir, l as rename, o as readFile, p as writeFile, r as list, s as readFileSealed, t as available, u as rm } from "../fs-KA1Mgisv.js";
5
5
  export { type CloudAvailability, type EncryptionStatus, type FileEntry, STORAGE_ACCOUNT_CHANGED, STORAGE_ACCOUNT_PIN_UNSUPPORTED, STORAGE_NOT_FOUND, type SealedRead, type Stats, StorageAccountChangedError, StorageAccountPinUnsupportedError, StorageLockedError, StorageNotFoundError, type StorageQuota, availability, available, encryption, isAccountChanged, isNotFound, list, mkdir, promises, quota, readFile, readFileSealed, readdir, rename, rm, stat, unlink, unlock, writeFile };
package/cloud/net.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-BOswhyfE.js";
1
+ import { a as createConnection, c as isIP, i as connect, l as isIPv4, n as Socket, o as createServer, r as _default, t as Server, u as isIPv6 } from "../net-CmMZgV2a.js";
2
2
  export { Server, Socket, _default, _default as default, connect, createConnection, createServer, isIP, isIPv4, isIPv6 };
@@ -1,8 +1,8 @@
1
- import { r as AttachFrameFunction } from "./index-Cgnfjh9o.js";
2
- import { t as cloudFetch } from "./proxy-ylK5lpw8.js";
1
+ import { r as AttachFrameFunction } from "./index-BOInGaEl.js";
2
+ import { t as cloudFetch } from "./proxy-dOOmiMl4.js";
3
3
  import { t as dns_d_exports } from "./dns.js";
4
- import { n as fs_d_exports } from "./fs-D0MMRnHC.js";
5
- import { s as net_d_exports } from "./net-BOswhyfE.js";
4
+ import { n as fs_d_exports } from "./fs-KA1Mgisv.js";
5
+ import { s as net_d_exports } from "./net-CmMZgV2a.js";
6
6
  import { t as dgram_d_exports } from "./dgram.js";
7
7
  import { t as http_d_exports } from "./http.js";
8
8
  //#region src/cloud/frame.d.ts
package/cloud.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { t as cloudFetch } from "./proxy-ylK5lpw8.js";
2
- import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-Y0FzWpFT.js";
1
+ import { t as cloudFetch } from "./proxy-dOOmiMl4.js";
2
+ import { a as attachFrame, i as quota, r as QuotaStatus, t as available } from "./cloud-DyOQPyUB.js";
3
3
  import { t as dns_d_exports } from "./dns.js";
4
- import { n as fs_d_exports } from "./fs-D0MMRnHC.js";
5
- import { s as net_d_exports } from "./net-BOswhyfE.js";
4
+ import { n as fs_d_exports } from "./fs-KA1Mgisv.js";
5
+ import { s as net_d_exports } from "./net-CmMZgV2a.js";
6
6
  import { t as dgram_d_exports } from "./dgram.js";
7
7
  import { t as http_d_exports } from "./http.js";
8
8
  export { type QuotaStatus, attachFrame, available, dgram_d_exports as dgram, dns_d_exports as dns, cloudFetch as fetch, fs_d_exports as fs, http_d_exports as http, net_d_exports as net, quota };
@@ -1,5 +1,5 @@
1
- import { D as StorageState, tt as SelectorPart, u as ClearCookiesWire } from "./index-Cgnfjh9o.js";
2
- import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
1
+ import { D as StorageState, tt as SelectorPart, u as ClearCookiesWire } from "./index-BOInGaEl.js";
2
+ import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-BwA4JjZH.js";
3
3
  //#region ../web-extension/lib/lib/storage-state.d.ts
4
4
  /**
5
5
  * A `storageState` cookie in the cloud jar's own shape (mirage's `Cookie`): `domain` always with
@@ -78,7 +78,7 @@ type WriteData = ArrayBuffer | Uint8Array | string;
78
78
  /**
79
79
  * The trailing option of every pinned storage call: a value `accountPin()` answered. The api refuses the
80
80
  * call ACCOUNT_CHANGED when the signed-in account (or the app) is not the one the pin was taken under.
81
- * Absent, the call is sent exactly as it was before pins existed.
81
+ * Absent, the call is unpinned.
82
82
  */
83
83
  type AccountPinOptions = {
84
84
  accountPin?: string;
@@ -558,8 +558,9 @@ type RoomMessage = {
558
558
  text: string;
559
559
  };
560
560
  /**
561
- * What a claimed room's mailbox holds, as the room last said. Null for a room nobody has claimed.
562
- * `cap` is the most it stores: 500 MB, or the size limit the account set in its fkn.app settings.
561
+ * What a claimed room's mailbox holds, as the room last said. Null for a room that keeps no messages:
562
+ * one nobody has claimed, or a claim whose mailbox is off. `cap` is the most it stores: 500 MB, or the
563
+ * size limit the account set in its fkn.app settings.
563
564
  */
564
565
  type RoomMailbox = {
565
566
  messages: number;
@@ -600,12 +601,15 @@ type RoomEvent =
600
601
  } |
601
602
  /**
602
603
  * the room was claimed, released (by its app, or by the account in its fkn.app settings) or
603
- * dissolved; `owner` is the owner's member id, or '' while a claimed room's owner has never joined
604
+ * dissolved, or its mailbox was turned off or on; `owner` is the owner's member id, or '' while a
605
+ * claimed room's owner has never joined. `mailbox` is whether the room now keeps messages, always
606
+ * false while `claimed` is false. Turning a mailbox off sends no `deleted`: what the app shows stays.
604
607
  */
605
608
  {
606
609
  type: 'claim';
607
610
  claimed: boolean;
608
611
  owner: string;
612
+ mailbox: boolean;
609
613
  };
610
614
  type RoomsErrorCode = 'invalid' | 'not-found' | 'bad-key' | 'full' | 'blocked' | 'denied' | 'rate-limited' | 'too-large' | 'storage' | 'quota' | 'unavailable' | 'closed';
611
615
  /** A refusal, as data. `packages` crosses the hop the same way, and for the same reason. */
@@ -646,8 +650,10 @@ type RoomClaimOptions = {
646
650
  * settings, where it can clear or unclaim the room, so say what would be lost. One line of plain text:
647
651
  * trimmed, then 1 to 200 characters as `String.length` counts them, with no control character, line or
648
652
  * paragraph separator, or bidi control; anything else is refused `invalid`, never cut short. Not sealed:
649
- * stored with the claim and shown to the account only. Claiming again with one replaces it, from the app
650
- * that claimed the room only (the same app once it is verified); claiming without one keeps it.
653
+ * stored with the claim and shown to the account only. Claiming again with one replaces it: on a room
654
+ * under an app's scope from the app that claimed the room only (the same app once it is verified), and
655
+ * from another app it is refused `denied` (`rooms: only the app that claimed the room can describe it`);
656
+ * on a `global` room from any app of the account. Claiming without one keeps it.
651
657
  */
652
658
  description?: string;
653
659
  /**
@@ -665,11 +671,27 @@ type RoomClaimOptions = {
665
671
  * room. It counts toward the account's room limit while it lasts and frees the slot when it ends.
666
672
  *
667
673
  * The latest claim decides: claiming again without it makes the room permanent, and with it makes it
668
- * temporary again. Only the app that claimed the room (the same app once it is verified) sets or
669
- * changes it; from another app it is refused `denied`, and a claim from another app without it leaves
670
- * the room as it was.
674
+ * temporary again. On a room under an app's scope only the app that claimed the room (the same app
675
+ * once it is verified) sets or changes it, and from another app it is refused `denied` (`rooms: only
676
+ * the app that claimed the room can set when it expires`); on a `global` room any app of the account
677
+ * does. A claim from another app without it leaves the room as it was, on either kind of room.
671
678
  */
672
679
  temporary?: boolean | number;
680
+ /**
681
+ * Whether the room keeps its messages. `false` claims the name and stores nothing: a message reaches
682
+ * whoever is present and is kept nowhere, `backlog` answers an empty page, and `edit` and `delete` are
683
+ * refused `invalid` (`rooms: the room keeps no messages`). The claim still reserves the name, locks it
684
+ * to the key and keeps the owner, the blocks and the overrides when everyone leaves, and it still needs
685
+ * premium. `true` or no value keeps a mailbox. Anything else is refused `invalid` (`rooms: malformed
686
+ * frame`).
687
+ *
688
+ * Read only when the call starts the claim: on a room the account already holds it is ignored, so an
689
+ * app that claims on every open never undoes what the owner chose since. A claim landing after a
690
+ * temporary one ran out starts a new claim, so it reads it again. A broker too old to carry it refuses
691
+ * `false` `unavailable` (`rooms: the mailbox switch is not available`) rather than store what the app
692
+ * asked it not to.
693
+ */
694
+ mailbox?: boolean;
673
695
  };
674
696
  /** What a backlog page answered: the highest seq it sent, and whether another page follows. */
675
697
  type RoomBacklog = {
@@ -701,49 +723,108 @@ type RoomHandle = {
701
723
  * let the room outlive what the app asked for.
702
724
  */
703
725
  temporaryClaims?: true;
726
+ /**
727
+ * set by a broker that carries `mailbox` on a claim and sends `setMailbox`. A broker older than that
728
+ * drops the option and claims with a mailbox, and has no `setMailbox`, so the lib refuses both on a
729
+ * handle without it rather than store what the app asked it not to.
730
+ */
731
+ mailboxSwitch?: true;
704
732
  defaults: () => Promise<RoomDefaults>;
705
733
  members: () => Promise<RoomMember[]>;
706
734
  /** sealed before it leaves the browser and refused, never truncated, past this member's `maxMessageBytes` on the wire */
707
735
  send: (text: string) => Promise<RoomsFail | {
708
736
  ok: true;
709
737
  }>;
710
- /** a stored message's text, replaced: the sender's own, or any as the owner */
738
+ /**
739
+ * a stored message's text, replaced: the sender's own, or any as the owner. From another app of the
740
+ * claim's account on a room claimed under an app's scope, `denied` (`rooms: only the app that claimed
741
+ * the room can change it`), the account's own messages included, as `claim` says.
742
+ */
711
743
  edit: (seq: number, text: string) => Promise<RoomsFail | {
712
744
  ok: true;
713
745
  }>;
714
- /** stored messages dropped: one of the sender's own, or any range as the owner */
746
+ /**
747
+ * stored messages dropped: one of the sender's own, or any range as the owner. From another app of the
748
+ * claim's account on a room claimed under an app's scope, `denied` (`rooms: only the app that claimed
749
+ * the room can change it`), the account's own messages included, as `claim` says.
750
+ */
715
751
  delete: (from: number, to?: number) => Promise<RoomsFail | {
716
752
  ok: true;
717
753
  }>;
718
754
  /** replays stored messages above `after` as `message` events marked `replayed`, one page at a time */
719
755
  backlog: (after: number, limit?: number) => Promise<RoomsFail | RoomBacklog>;
756
+ /**
757
+ * the room default for `send` or `receive`, from the owner only (`denied`, `rooms: not the room
758
+ * owner`). From another app of the claim's account on a room claimed under an app's scope, `denied`
759
+ * (`rooms: only the app that claimed the room can change it`), as `claim` says.
760
+ */
720
761
  setDefault: (permission: 'send' | 'receive', value: boolean) => Promise<RoomsFail | {
721
762
  ok: true;
722
763
  }>;
723
- /** the message size cap: the room default when no member is named, that member's override otherwise, cleared by null */
764
+ /**
765
+ * the message size cap: the room default when no member is named, that member's override otherwise,
766
+ * cleared by null. From the owner only (`denied`, `rooms: not the room owner`); from another app of the
767
+ * claim's account on a room claimed under an app's scope, `denied` (`rooms: only the app that claimed
768
+ * the room can change it`), as `claim` says.
769
+ */
724
770
  limit: (maxMessageBytes: number | null, id?: string) => Promise<RoomsFail | {
725
771
  ok: true;
726
772
  }>;
773
+ /**
774
+ * a member's override of a permission, set to true, from the owner only (`denied`, `rooms: not the
775
+ * room owner`). From another app of the claim's account on a room claimed under an app's scope,
776
+ * `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
777
+ */
727
778
  grant: (id: string, permission: RoomPermission) => Promise<RoomsFail | {
728
779
  ok: true;
729
780
  }>;
781
+ /**
782
+ * a member's override of a permission, set to false, from the owner only (`denied`, `rooms: not the
783
+ * room owner`). From another app of the claim's account on a room claimed under an app's scope,
784
+ * `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
785
+ */
730
786
  revoke: (id: string, permission: RoomPermission) => Promise<RoomsFail | {
731
787
  ok: true;
732
788
  }>;
789
+ /**
790
+ * a member sent out, free to join again, with the `remove` permission (`denied`, `rooms: permission
791
+ * denied`). From another app of the claim's account on a room claimed under an app's scope, `denied`
792
+ * (`rooms: only the app that claimed the room can change it`), as `claim` says.
793
+ */
733
794
  remove: (id: string) => Promise<RoomsFail | {
734
795
  ok: true;
735
796
  }>;
797
+ /**
798
+ * a member sent out and kept out, with the `block` permission (`denied`, `rooms: permission denied`).
799
+ * From another app of the claim's account on a room claimed under an app's scope, `denied` (`rooms:
800
+ * only the app that claimed the room can change it`), as `claim` says.
801
+ */
736
802
  block: (id: string) => Promise<RoomsFail | {
737
803
  ok: true;
738
804
  }>;
805
+ /**
806
+ * a block lifted, with the `block` permission (`denied`, `rooms: permission denied`). From another app
807
+ * of the claim's account on a room claimed under an app's scope, `denied` (`rooms: only the app that
808
+ * claimed the room can change it`), as `claim` says.
809
+ */
739
810
  unblock: (id: string) => Promise<RoomsFail | {
740
811
  ok: true;
741
812
  }>;
742
813
  /**
743
- * keeps the name and a mailbox for the signed-in premium account; the only thing in rooms that premium
744
- * buys. `description` says what the room is for, shown to the account in its fkn.app settings.
745
- * `temporary` makes the claim end by itself that many milliseconds after its last claim (`true` is 7
746
- * days); the broker carries it as a number of milliseconds and never as `true`.
814
+ * keeps the name for the signed-in premium account, and a mailbox unless `mailbox` is false; the only
815
+ * thing in rooms that premium buys. `description` says what the room is for, shown to the account in
816
+ * its fkn.app settings. `temporary` makes the claim end by itself that many milliseconds after its last
817
+ * claim (`true` is 7 days); the broker carries it as a number of milliseconds and never as `true`.
818
+ * `mailbox` is read only when the call starts the claim.
819
+ *
820
+ * A room under an app's scope, which is every room but a `global` one, is changed by the claim's
821
+ * account only through the app that claimed it (the same app once it is verified): from another app of
822
+ * the account `setDefault`, `limit`, `grant`, `revoke`, `remove`, `block`, `unblock`, `setMailbox`,
823
+ * `edit` and `delete` answer `denied` (`rooms: only the app that claimed the room can change it`), the
824
+ * account's own messages included, and `unavailable` while the room cannot tell whether two apps are
825
+ * one. A claimed `global` room is changed by any app of the account, which also describes it, sets its
826
+ * `temporary` and releases it. The account's fkn.app settings
827
+ * change every room it claimed, and members of other accounts are answered as in any room.
747
828
  *
748
829
  * Past the account's room limit the call waits while fkn.app shows the person their claimed rooms over
749
830
  * your app, with Unclaim on each: it answers `{ ok: true }` once one is unclaimed and this claim is
@@ -753,6 +834,15 @@ type RoomHandle = {
753
834
  claim: (options?: RoomClaimOptions) => Promise<RoomsFail | {
754
835
  ok: true;
755
836
  }>;
837
+ /**
838
+ * the owner turns a claimed room's mailbox off, deleting what it stored, or on, starting it empty.
839
+ * Answers once the room is in that state and has tried to tell the api its storage figure; the answer
840
+ * does not say whether the api heard it. From another app of the claim's account on a room claimed
841
+ * under an app's scope, `denied` (`rooms: only the app that claimed the room can change it`), as `claim` says.
842
+ */
843
+ setMailbox: (on: boolean) => Promise<RoomsFail | {
844
+ ok: true;
845
+ }>;
756
846
  release: () => Promise<RoomsFail | {
757
847
  ok: true;
758
848
  }>;
@@ -806,9 +896,6 @@ type ProxyFetchInput = string | URL | Request;
806
896
  * A spread request is the app's own choice and is not announced: the header keeps naming the
807
897
  * session's node, which every request not carrying this flag still goes through. Only the cloud
808
898
  * backend reads it; the extension and the desktop fetch from the user's own address and ignore it.
809
- *
810
- * `render` used to sit here. It set a request header the proxy never read and never listed for CORS,
811
- * so a caller that passed it failed its own preflight; nothing did, and it is gone.
812
899
  */
813
900
  type ProxyFetchInit = (RequestInit & {
814
901
  spread?: boolean;
package/contract.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as CookieMatchWire, u as ClearCookiesWire } from "./index-Cgnfjh9o.js";
2
- import { $ as RoomHandle, A as MiddleGotoOptions, At as WINDOW_HELLO_TIMEOUT_MS, B as ProxyFetch, C as FrameMessageRelay, Ct as TcpSocketListenerResult, D as IpFamily, Dt as UdpSocketOptions, E as InstalledPackage, Et as UdpDatagram, F as PackageResult, Ft as JarSeedCookie, G as Radii, H as ProxyFetchInput, I as PackagesErrorCode, J as RoomClaimOptions, K as Resolvers, L as PackagesFail, M as OverlayRect, Mt as WindowMiddleControl, N as OverlayState, Nt as WriteData, O as JAR_ANCHOR_MESSAGE, Ot as UdpSocketResult, P as PackageQuery, Pt as JarSeed, Q as RoomEvent, R as PickOptions, S as FrameFetchScope, St as TcpSocketListenerOptions, T as InstallOptions, Tt as TcpSocketResult, U as Quota, V as ProxyFetchInit, W as ROOM_TEMPORARY_MS, X as RoomDefaults, Y as RoomCreateOptions, Z as RoomEnd, _ as DnsLookup, _t as ShellGotoOptions, a as AccountChange, at as RoomPermission, b as FrameConsentAnswer, bt as StorageQuota, c as AdoptRequest, ct as RoomsFail, d as ConflictRequest, dt as SHELL_FRAME_MESSAGE, et as RoomJoinOptions, f as ConflictSide, ft as SHELL_JAR_MESSAGE, g as DisplayLevel, gt as ShellFrameMessage, h as DisplayCause, ht as ShellControl, i as Account, it as RoomOpenOptions, j as MountDescriptor, jt as WINDOW_JAR_MODE_TIMEOUT_MS, k as MiddleControl, kt as WINDOW_HANDSHAKE_TIMEOUT_MS, l as AdoptState, lt as SHELL_ATTACH_ERROR, m as ConnectOptions, mt as SetOverlayHost, n as ATTACH_WINDOW_KEY, nt as RoomMember, o as AccountPinOptions, ot as RoomPermissions, p as ConnectAvailability, pt as SHELL_JAR_UNREACHABLE, q as RoomBacklog, r as ATTACH_WINDOW_MESSAGE, rt as RoomMessage, s as AddressLookupResult, st as RoomsErrorCode, t as ATTACH_FRAME_KEY, tt as RoomMailbox, u as ConflictChoice, ut as SHELL_CONTROL_KEY, v as EncryptionState, vt as ShellJarUnreachable, w as HiddenSurface, wt as TcpSocketOptions, x as FrameConsentRequest, xt as SurfaceRect, y as FRAME_MESSAGE, yt as StorageEntry, z as Placement } from "./contract-DJxGa8lb.js";
3
- import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-Gbo-D74t.js";
1
+ import { d as CookieMatchWire, u as ClearCookiesWire } from "./index-BOInGaEl.js";
2
+ import { $ as RoomHandle, A as MiddleGotoOptions, At as WINDOW_HELLO_TIMEOUT_MS, B as ProxyFetch, C as FrameMessageRelay, Ct as TcpSocketListenerResult, D as IpFamily, Dt as UdpSocketOptions, E as InstalledPackage, Et as UdpDatagram, F as PackageResult, Ft as JarSeedCookie, G as Radii, H as ProxyFetchInput, I as PackagesErrorCode, J as RoomClaimOptions, K as Resolvers, L as PackagesFail, M as OverlayRect, Mt as WindowMiddleControl, N as OverlayState, Nt as WriteData, O as JAR_ANCHOR_MESSAGE, Ot as UdpSocketResult, P as PackageQuery, Pt as JarSeed, Q as RoomEvent, R as PickOptions, S as FrameFetchScope, St as TcpSocketListenerOptions, T as InstallOptions, Tt as TcpSocketResult, U as Quota, V as ProxyFetchInit, W as ROOM_TEMPORARY_MS, X as RoomDefaults, Y as RoomCreateOptions, Z as RoomEnd, _ as DnsLookup, _t as ShellGotoOptions, a as AccountChange, at as RoomPermission, b as FrameConsentAnswer, bt as StorageQuota, c as AdoptRequest, ct as RoomsFail, d as ConflictRequest, dt as SHELL_FRAME_MESSAGE, et as RoomJoinOptions, f as ConflictSide, ft as SHELL_JAR_MESSAGE, g as DisplayLevel, gt as ShellFrameMessage, h as DisplayCause, ht as ShellControl, i as Account, it as RoomOpenOptions, j as MountDescriptor, jt as WINDOW_JAR_MODE_TIMEOUT_MS, k as MiddleControl, kt as WINDOW_HANDSHAKE_TIMEOUT_MS, l as AdoptState, lt as SHELL_ATTACH_ERROR, m as ConnectOptions, mt as SetOverlayHost, n as ATTACH_WINDOW_KEY, nt as RoomMember, o as AccountPinOptions, ot as RoomPermissions, p as ConnectAvailability, pt as SHELL_JAR_UNREACHABLE, q as RoomBacklog, r as ATTACH_WINDOW_MESSAGE, rt as RoomMessage, s as AddressLookupResult, st as RoomsErrorCode, t as ATTACH_FRAME_KEY, tt as RoomMailbox, u as ConflictChoice, ut as SHELL_CONTROL_KEY, v as EncryptionState, vt as ShellJarUnreachable, w as HiddenSurface, wt as TcpSocketOptions, x as FrameConsentRequest, xt as SurfaceRect, y as FRAME_MESSAGE, yt as StorageEntry, z as Placement } from "./contract-6Xfd_qel.js";
3
+ import { o as TcpSocketOption, v as UdpSocketOption } from "./wire-BwA4JjZH.js";
4
4
  export { ATTACH_FRAME_KEY, ATTACH_WINDOW_KEY, ATTACH_WINDOW_MESSAGE, Account, AccountChange, AccountPinOptions, AddressLookupResult, AdoptRequest, AdoptState, type ClearCookiesWire, ConflictChoice, ConflictRequest, ConflictSide, ConnectAvailability, ConnectOptions, type CookieMatchWire, DisplayCause, DisplayLevel, DnsLookup, EncryptionState, FRAME_MESSAGE, FrameConsentAnswer, FrameConsentRequest, FrameFetchScope, FrameMessageRelay, HiddenSurface, InstallOptions, InstalledPackage, IpFamily, JAR_ANCHOR_MESSAGE, type JarSeed, type JarSeedCookie, MiddleControl, MiddleGotoOptions, MountDescriptor, OverlayRect, OverlayState, PackageQuery, PackageResult, PackagesErrorCode, PackagesFail, PickOptions, Placement, ProxyFetch, ProxyFetchInit, ProxyFetchInput, Quota, ROOM_TEMPORARY_MS, Radii, Resolvers, RoomBacklog, RoomClaimOptions, RoomCreateOptions, RoomDefaults, RoomEnd, RoomEvent, RoomHandle, RoomJoinOptions, RoomMailbox, RoomMember, RoomMessage, RoomOpenOptions, RoomPermission, RoomPermissions, RoomsErrorCode, RoomsFail, SHELL_ATTACH_ERROR, SHELL_CONTROL_KEY, SHELL_FRAME_MESSAGE, SHELL_JAR_MESSAGE, SHELL_JAR_UNREACHABLE, SetOverlayHost, ShellControl, ShellFrameMessage, ShellGotoOptions, ShellJarUnreachable, StorageEntry, StorageQuota, SurfaceRect, TcpSocketListenerOptions, TcpSocketListenerResult, type TcpSocketOption, TcpSocketOptions, TcpSocketResult, UdpDatagram, type UdpSocketOption, UdpSocketOptions, UdpSocketResult, WINDOW_HANDSHAKE_TIMEOUT_MS, WINDOW_HELLO_TIMEOUT_MS, WINDOW_JAR_MODE_TIMEOUT_MS, WindowMiddleControl, WriteData };
package/dgram.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { K as Resolvers, Ot as UdpSocketResult } from "./contract-DJxGa8lb.js";
2
- import { v as UdpSocketOption } from "./wire-Gbo-D74t.js";
3
- import "./api-H1TzWitc.js";
1
+ import { K as Resolvers, Ot as UdpSocketResult } from "./contract-6Xfd_qel.js";
2
+ import { v as UdpSocketOption } from "./wire-BwA4JjZH.js";
3
+ import "./api-CFkZVr53.js";
4
4
  import { Buffer } from "buffer";
5
5
  import { AddressInfo } from "net";
6
6
  import { EventEmitter } from "events";
@@ -62,17 +62,10 @@ export declare class Socket extends EventEmitter implements Socket$2 {
62
62
  bind(callback?: (() => void) | undefined): this;
63
63
  bind(options: BindOptions, callback?: (() => void) | undefined): this;
64
64
  /**
65
- * Wire a datagram socket up from a connection already in hand, and report it as bound.
66
- *
67
- * `endpoints` publishes the local address SYNCHRONOUSLY, for the same reason net.ts's TCP
68
- * equivalent does: `address()` throws EBADF until the promise below resolves, so a caller that
69
- * reads it in the same turn as the bind gets an exception rather than the answer. Node fills an
70
- * address in before it reports a socket as bound.
71
- *
72
- * Splitting this out of `bind()` is also what gives a test a seam. Everything a refused bind does
73
- * lives past `apiWithin`, so without this the only way to reach it is to mock the resolver, and
74
- * the guard on that path stayed untested through the whole period the relay could not refuse a
75
- * bind at all.
65
+ * Wires the socket up from a connection already in hand and reports it as bound; also the seam a
66
+ * test uses to reach a refused bind without mocking the resolver. `endpoints` publishes the local
67
+ * address synchronously, as net.ts does: `address()` throws EBADF until the connection resolves,
68
+ * while Node fills an address in before reporting a socket bound.
76
69
  */
77
70
  __webvpn_udp_socket_init__(connection: ReturnType<WebVpnUdpSocket>, endpoints?: Awaited<ReturnType<WebVpnUdpSocket>>): Promise<UdpSocketResult | undefined>;
78
71
  close(callback?: (() => void) | undefined): this;
package/dns.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { s as AddressLookupResult } from "./contract-DJxGa8lb.js";
1
+ import { s as AddressLookupResult } from "./contract-6Xfd_qel.js";
2
2
  declare namespace dns_d_exports {
3
3
  export { AddressLookupResult, lookup };
4
4
  }