@haex-space/vault-sdk 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1164,6 +1164,59 @@ unknown job rejects it with an error.
1164
1164
  `models.startAsync`, `models.onCompleted` and `models.cancelAsync` give you the job's id and its end
1165
1165
  separately. A job has no tools and sees only the input you send.
1166
1166
 
1167
+ ### Peers
1168
+
1169
+ Channels between frames of your extension on devices of different vaults, for example a multiplayer
1170
+ game. Declare the permission in `manifest.json`; inviting a contact also needs read access to that
1171
+ contact:
1172
+
1173
+ ```json
1174
+ "permissions": {
1175
+ "peers": [{ "target": "*", "action": "connect" }],
1176
+ "contacts": [{ "target": "*", "action": "read" }]
1177
+ }
1178
+ ```
1179
+
1180
+ A channel starts in one of two ways:
1181
+
1182
+ - **Invitation.** `peers.inviteAsync(contactId, payload)` reaches all devices of the contact. The
1183
+ invited user accepts or declines only in the vault's own prompt; the SDK has no accept or decline,
1184
+ and your extension learns of the invitation only after it was accepted, as `channel-opened`
1185
+ (the vault opens your extension first if needed). The inviting side gets `invite-status` exactly
1186
+ once: `accepted` (with `channelId`), `declined`, `not-installed`, `unreachable` (with
1187
+ `hint: "share_current_card"`: ask the contact to share a current card) or `expired`.
1188
+ `cancelInviteAsync(inviteId)` withdraws an open invitation.
1189
+ - **Lobby.** `peers.openLobbyAsync(lobbyId, "contacts" | "public")` returns a join code that starts
1190
+ with `haex-vault:join:`; treat it as opaque text and hand it on. Another device joins with
1191
+ `peers.joinAsync(joinCode, displayName, payload)` and gets `{ channelId, lobbyId }`; the host gets
1192
+ `joined`. A contacts-only lobby admits only the host's contacts. `closeLobbyAsync` stops the code,
1193
+ open channels stay; `removeAsync(channelId)` closes a channel of your lobby and keeps that device
1194
+ out.
1195
+
1196
+ ```ts
1197
+ const peers = client.peers;
1198
+ peers.on("channel-opened", ({ channelId, from, payload }) => startGame(channelId, from.name, payload));
1199
+ peers.on("message", ({ channelId, data, reliable }) => receive(channelId, data, reliable));
1200
+ peers.on("channel-closed", ({ channelId, reason }) => dropPlayer(channelId, reason)); // closed, lost, timeout
1201
+
1202
+ const { joinCode } = await peers.openLobbyAsync("doom-1", "public");
1203
+ peers.on("joined", ({ channelId, displayName, verified }) => addPlayer(channelId, displayName, verified));
1204
+
1205
+ await peers.sendAsync(channelId, packet); // fast, may be lost
1206
+ await peers.sendAsync(channelId, state, { reliable: true }); // in order
1207
+ await peers.closeAsync(channelId); // both sides get channel-closed
1208
+ ```
1209
+
1210
+ Limits: a fast message holds at most `peers.MAX_FAST_BYTES` (1,024) bytes, a reliable one
1211
+ `peers.MAX_RELIABLE_BYTES` (65,536); at most 16 reliable messages may wait per channel. The `payload`
1212
+ of an invitation or a join is JSON of at most `peers.MAX_PAYLOAD_BYTES` (4,096) bytes. Host errors
1213
+ with a reason reject as `PeerError` with the host's `code`, its `reason` (`contact_unknown`,
1214
+ `invite_not_open`, `channel_unknown`, `channel_closed`, `lobby_closed`, `not_admitted`, `too_large`,
1215
+ `limit`, `network_unavailable`, `invalid_input`), a `kind` such as `PEER_LOBBY_CLOSED`, and `limit`
1216
+ for `too_large` and `limit`. `not_admitted` shares code 1002 with a refused permission; tell them
1217
+ apart by `reason`. When your extension's last frame on a device closes, the vault closes its
1218
+ channels and lobbies and withdraws its open invitations.
1219
+
1167
1220
  ### Database Operations
1168
1221
 
1169
1222
  #### Query
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, a as ExtensionManifest, H as HaexHubConfig, E as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, R as RequestOptions } from './types-3iifP-Q1.mjs';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, a as ExtensionManifest, H as HaexHubConfig, E as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, R as RequestOptions } from './types-BZVkX0Wf.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -363,7 +363,8 @@ declare class FilesystemAPI {
363
363
  private client;
364
364
  constructor(client: HaexVaultSdk);
365
365
  /**
366
- * Opens a save file dialog and saves the provided data to the selected location
366
+ * Opens a save file dialog and saves the provided data to the selected location.
367
+ * Waits for the user without the request timeout.
367
368
  * @param data The file data as Uint8Array
368
369
  * @param options Options for the save dialog
369
370
  * @returns The path where the file was saved, or null if cancelled
@@ -426,13 +427,13 @@ declare class FilesystemAPI {
426
427
  */
427
428
  stat(path: string): Promise<FileStat>;
428
429
  /**
429
- * Open a folder selection dialog
430
+ * Open a folder selection dialog; waits for the user without the request timeout
430
431
  * @param options Dialog options
431
432
  * @returns Selected folder path, or null if cancelled
432
433
  */
433
434
  selectFolder(options?: SelectFolderOptions): Promise<string | null>;
434
435
  /**
435
- * Open a file selection dialog
436
+ * Open a file selection dialog; waits for the user without the request timeout
436
437
  * @param options Dialog options
437
438
  * @returns Selected file paths, or null if cancelled
438
439
  */
@@ -1810,6 +1811,177 @@ declare class ModelsAPI {
1810
1811
  }): Promise<ModelJobCompletion>;
1811
1812
  }
1812
1813
 
1814
+ /**
1815
+ * Types of peer channels (holzi spec 057, `contracts/bridge.md` and `contracts/sdk.md`): channels
1816
+ * between frames of the same extension on devices of different vaults.
1817
+ */
1818
+ /** Who may join a lobby by its code: only the host's contacts, or anyone holding the code. */
1819
+ type PeerVisibility = "contacts" | "public";
1820
+ /**
1821
+ * The outcome of an invitation (`peers:invite-status`), exactly once per invitation, on the
1822
+ * inviting side.
1823
+ */
1824
+ interface PeerInviteStatus {
1825
+ inviteId: string;
1826
+ status: "accepted" | "declined" | "not-installed" | "unreachable" | "expired";
1827
+ /** Only with `accepted`: the channel to the invited device. */
1828
+ channelId?: string;
1829
+ /** Only with `unreachable`: ask the contact to share a current card. */
1830
+ hint?: "share_current_card";
1831
+ }
1832
+ /**
1833
+ * A channel opened by an invitation the user accepted in holzi's prompt (`peers:channel-opened`),
1834
+ * on the invited side.
1835
+ */
1836
+ interface PeerChannelOpened {
1837
+ channelId: string;
1838
+ origin: "invitation";
1839
+ inviteId: string;
1840
+ from: {
1841
+ /** Only when the extension's `contacts` permission covers this contact. */
1842
+ contactId?: string;
1843
+ /** The name on the other vault's card, not the display name of the address book. */
1844
+ name: string;
1845
+ };
1846
+ /** The JSON the inviting extension sent with the invitation. */
1847
+ payload: unknown;
1848
+ }
1849
+ /** A device that joined one of this device's lobbies by code (`peers:joined`), on the host. */
1850
+ interface PeerJoined {
1851
+ lobbyId: string;
1852
+ channelId: string;
1853
+ /** Chosen by the joining user and unchecked. */
1854
+ displayName: string;
1855
+ /** `true` when the joining device belongs to a contact. */
1856
+ verified: boolean;
1857
+ /** Only when the extension's `contacts` permission covers this contact. */
1858
+ contactId?: string;
1859
+ /** The JSON the joining extension sent with the join. */
1860
+ payload: unknown;
1861
+ }
1862
+ /** A message on a channel (`peers:message`), with its data decoded from Base64. */
1863
+ interface PeerMessage {
1864
+ channelId: string;
1865
+ data: Uint8Array;
1866
+ reliable: boolean;
1867
+ }
1868
+ /**
1869
+ * The end of a channel (`peers:channel-closed`): `closed` by either side, `lost` when a reliable
1870
+ * message could not be delivered, `timeout` when the other side stopped answering.
1871
+ */
1872
+ interface PeerChannelClosed {
1873
+ channelId: string;
1874
+ reason: "closed" | "lost" | "timeout";
1875
+ }
1876
+ /** The events of `client.peers.on`, by their name without the `peers:` prefix. */
1877
+ interface PeerEventMap {
1878
+ "invite-status": PeerInviteStatus;
1879
+ "channel-opened": PeerChannelOpened;
1880
+ joined: PeerJoined;
1881
+ message: PeerMessage;
1882
+ "channel-closed": PeerChannelClosed;
1883
+ }
1884
+ type PeerEventType = keyof PeerEventMap;
1885
+ /** The `details.reason` of a host error of a peers method. */
1886
+ type PeerErrorReason = "contact_unknown" | "invite_not_open" | "channel_unknown" | "channel_closed" | "lobby_closed" | "not_admitted" | "too_large" | "limit" | "network_unavailable" | "invalid_input";
1887
+
1888
+ /**
1889
+ * The name of each `details.reason` in haex-doom's draft of this API; `limit`,
1890
+ * `network_unavailable` and `invalid_input` are new there.
1891
+ */
1892
+ declare const PEER_ERROR_KINDS: {
1893
+ readonly contact_unknown: "PEER_CONTACT_UNKNOWN";
1894
+ readonly invite_not_open: "PEER_INVITE_UNKNOWN";
1895
+ readonly channel_unknown: "PEER_CHANNEL_CLOSED";
1896
+ readonly channel_closed: "PEER_CHANNEL_CLOSED";
1897
+ readonly too_large: "PEER_PAYLOAD_TOO_LARGE";
1898
+ readonly lobby_closed: "PEER_LOBBY_CLOSED";
1899
+ readonly not_admitted: "PEER_NOT_ALLOWED";
1900
+ readonly limit: "PEER_LIMIT";
1901
+ readonly network_unavailable: "PEER_NETWORK_UNAVAILABLE";
1902
+ readonly invalid_input: "PEER_INVALID_INPUT";
1903
+ };
1904
+ type PeerErrorKind = (typeof PEER_ERROR_KINDS)[PeerErrorReason];
1905
+ /**
1906
+ * A host error of a peers method that names its `details.reason`. `code` stays the host's number
1907
+ * (1001, 1002, 3001, 7000, 8001); `not_admitted` shares 1002 with a refused permission, so tell
1908
+ * them apart by `reason`. The host's error is kept as `cause`.
1909
+ */
1910
+ declare class PeerError extends Error {
1911
+ readonly code: number;
1912
+ readonly reason: PeerErrorReason;
1913
+ readonly details: Record<string, unknown>;
1914
+ readonly kind: PeerErrorKind;
1915
+ /** The host's `details.limit` with `too_large` (bytes) and `limit` (count). */
1916
+ readonly limit?: number;
1917
+ constructor(code: number, reason: PeerErrorReason, message: string, details?: Record<string, unknown>, options?: {
1918
+ cause?: unknown;
1919
+ });
1920
+ }
1921
+ /**
1922
+ * Channels between frames of this extension on devices of different vaults (holzi spec 057).
1923
+ * Needs the `peers` permission (`{ target: "*", action: "connect" }`); inviting a contact also
1924
+ * needs `contacts` read access to that contact.
1925
+ *
1926
+ * A channel starts in one of two ways. An invitation goes to all devices of a contact; the user
1927
+ * accepts or declines it only in holzi's own prompt, so the SDK has no accept or decline. The
1928
+ * invited side gets `channel-opened`, the inviting side `invite-status`. A lobby hands out an
1929
+ * opaque join code (`haex-vault:join:…`); a device that joins with it gets the channel from
1930
+ * {@link PeersAPI.joinAsync}, the host gets `joined`.
1931
+ *
1932
+ * Errors with a `details.reason` reject as {@link PeerError}; others reject unchanged.
1933
+ */
1934
+ declare class PeersAPI {
1935
+ private client;
1936
+ /** Largest fast message (`reliable: false`) in bytes. */
1937
+ readonly MAX_FAST_BYTES = 1024;
1938
+ /** Largest reliable message in bytes. */
1939
+ readonly MAX_RELIABLE_BYTES = 65536;
1940
+ /** Largest `payload` of an invitation or a join, as JSON, in bytes. */
1941
+ readonly MAX_PAYLOAD_BYTES = 4096;
1942
+ constructor(client: HaexVaultSdk);
1943
+ private call;
1944
+ /** Invites a contact; the outcome follows as `invite-status` with this `inviteId`. */
1945
+ inviteAsync(contactId: string, payload: unknown): Promise<{
1946
+ inviteId: string;
1947
+ }>;
1948
+ /** Withdraws an open invitation on all devices of the contact; no `invite-status` follows. */
1949
+ cancelInviteAsync(inviteId: string): Promise<void>;
1950
+ /**
1951
+ * Opens a lobby; `lobbyId` is 1–64 characters of `[A-Za-z0-9._-]`. The join code is opaque:
1952
+ * hand it on as it is.
1953
+ */
1954
+ openLobbyAsync(lobbyId: string, visibility: PeerVisibility): Promise<{
1955
+ joinCode: string;
1956
+ }>;
1957
+ /** Closes a lobby: its code stops working, its channels stay open. An unknown lobby is fine. */
1958
+ closeLobbyAsync(lobbyId: string): Promise<void>;
1959
+ /**
1960
+ * Joins a lobby by its code with a self-chosen `displayName` (1–64 characters). The host
1961
+ * answers within 15 s; a lobby that cannot be joined for any reason rejects as `lobby_closed`.
1962
+ */
1963
+ joinAsync(joinCode: string, displayName: string, payload: unknown): Promise<{
1964
+ channelId: string;
1965
+ lobbyId: string;
1966
+ }>;
1967
+ /** Closes a channel of an own lobby and keeps that device (and vault) out of the lobby. */
1968
+ removeAsync(channelId: string): Promise<void>;
1969
+ /**
1970
+ * Sends bytes over a channel: fast (default, at most {@link MAX_FAST_BYTES}, may be lost) or
1971
+ * `reliable` (at most {@link MAX_RELIABLE_BYTES}, in order; 16 may wait per channel).
1972
+ */
1973
+ sendAsync(channelId: string, data: Uint8Array, options?: {
1974
+ reliable?: boolean;
1975
+ }): Promise<void>;
1976
+ /** Closes a channel; both sides get `channel-closed` with `reason: "closed"`. */
1977
+ closeAsync(channelId: string): Promise<void>;
1978
+ /**
1979
+ * Listens for one of the peers events (`invite-status`, `channel-opened`, `joined`, `message`,
1980
+ * `channel-closed`); `message.data` arrives as bytes. Returns an unsubscribe function.
1981
+ */
1982
+ on<T extends PeerEventType>(type: T, handler: (event: PeerEventMap[T]) => void): () => void;
1983
+ }
1984
+
1813
1985
  /**
1814
1986
  * Mail types — IMAP fetch + SMTP send.
1815
1987
  *
@@ -2289,6 +2461,7 @@ declare class HaexVaultSdk {
2289
2461
  readonly passwords: PasswordsAPI;
2290
2462
  readonly contacts: ContactsAPI;
2291
2463
  readonly models: ModelsAPI;
2464
+ readonly peers: PeersAPI;
2292
2465
  readonly mail: MailAPI;
2293
2466
  readonly notifications: NotificationsAPI;
2294
2467
  readonly tab: TabAPI;
@@ -2345,5 +2518,5 @@ declare class HaexVaultSdk {
2345
2518
  private log;
2346
2519
  }
2347
2520
 
2348
- export { DatabaseAPI as D, HaexVaultSdk as H, FilesystemAPI as L, KnownPath as N, LOCALSEND_EVENTS as P, LocalSendAPI as Q, StorageAPI as S, MailAPI as V, RemoteStorageAPI as aB, ShellAPI as aO, SpacesAPI as a_, ModelsAPI as ae, NotificationsAPI as ai, PasswordsAPI as aq, PermissionsAPI as at, TabAPI as b0, ToolsAPI as b3, WebAPI as b7, canExternalClientSendRequests as b8, isExternalClientConnected as b9, ContactsAPI as i, DialogAPI as o, EncryptedFoldersAPI as t, ExternalConnectionErrorCode as x, ExternalConnectionState as y };
2349
- export type { MailNewMessagesEvent as $, AuthorizedClient as A, BlockedClient as B, ConfirmOptions as C, EncryptedFolderAccess as E, ExternalRequestEvent as F, ExternalRequestHandler as G, ExternalRequestPayload as I, ExternalResponse as J, FileStat as K, ImapConfig as M, KnownPaths as O, LocalSendEvent as R, FileInfo as T, LocalSendSettings as U, MailAccount as W, MailAddress as X, Attachment as Y, FetchRange as Z, MailMessage as _, ConnectionSecurity as a, SyncBackendInfo as a$, MailSearchCriteria as a0, MailSearchResult as a1, MailboxInfo as a2, MessageEnvelope as a3, ModelEffort as a4, ModelJob as a5, ModelJobAttempt as a6, ModelJobCompletion as a7, ModelJobErrorCode as a8, ModelJobFormat as a9, SftpProposal as aA, StorageBackendInfo as aC, StorageBackendType as aD, StorageObjectInfo as aE, UpdateBackendRequest as aF, WebDavProposal as aG, RequestedExtension as aH, SelectFileOptions as aI, SelectFolderOptions as aJ, ServerInfo as aK, ServerStatus as aL, SessionAuthorization as aM, SharedSpace as aN, ShellCreateOptions as aP, ShellCreateResponse as aQ, ShellExitEvent as aR, ShellOutputEvent as aS, SmtpConfig as aT, SpaceAccessTokenInfo as aU, SpaceAssignment as aV, SpaceInvite as aW, SpaceKeyGrantInfo as aX, SpaceMember as aY, SpaceMemberInfo as aZ, ModelJobImage as aa, ModelJobProvenance as ab, ModelJobStep as ac, ModelPlace as ad, NotificationAction as af, NotificationClickEvent as ag, NotificationOptions as ah, OutgoingAttachment as aj, OutgoingMessage as ak, PasswordInput as al, PasswordItemFull as am, PasswordItemSummary as an, PasswordKeyValue as ao, PasswordKeyValueInput as ap, PendingAuthorization as ar, PendingTransfer as as, AddBackendRequest as au, FolderBackendInfo as av, S3BackendInfo as aw, S3Config as ax, S3Proposal as ay, S3PublicConfig as az, ContactDetail as b, ToolContext as b1, ToolHandler as b2, TransferDirection as b4, TransferProgress as b5, TransferState as b6, ContactHolziAddresses as c, ContactHolziDevice as d, ContactList as e, ContactListOptions as f, ContactSummary as g, ContactValue as h, DecryptedSpace as j, DeepLink as k, Device as l, DeviceInfo as m, DeviceType as n, DirEntry as p, EncryptedFolderChoice as q, EncryptedFolderEntry as r, EncryptedFolderProviderErrorKind as s, ExtensionModel as u, ExternalAuthDecision as v, ExternalConnection as w, ExternalRequest as z };
2521
+ export { DatabaseAPI as D, HaexVaultSdk as H, FilesystemAPI as L, KnownPath as N, LOCALSEND_EVENTS as P, LocalSendAPI as Q, StorageAPI as S, MailAPI as V, ShellAPI as a$, PeersAPI as aD, PermissionsAPI as aG, RemoteStorageAPI as aO, ModelsAPI as ae, NotificationsAPI as ai, PEER_ERROR_KINDS as al, PasswordsAPI as ar, PeerError as au, SpacesAPI as bb, TabAPI as bd, ToolsAPI as bg, WebAPI as bk, canExternalClientSendRequests as bl, isExternalClientConnected as bm, ContactsAPI as i, DialogAPI as o, EncryptedFoldersAPI as t, ExternalConnectionErrorCode as x, ExternalConnectionState as y };
2522
+ export type { MailNewMessagesEvent as $, AuthorizedClient as A, BlockedClient as B, ConfirmOptions as C, EncryptedFolderAccess as E, ExternalRequestEvent as F, ExternalRequestHandler as G, ExternalRequestPayload as I, ExternalResponse as J, FileStat as K, ImapConfig as M, KnownPaths as O, LocalSendEvent as R, FileInfo as T, LocalSendSettings as U, MailAccount as W, MailAddress as X, Attachment as Y, FetchRange as Z, MailMessage as _, ConnectionSecurity as a, MailSearchCriteria as a0, MailSearchResult as a1, MailboxInfo as a2, MessageEnvelope as a3, ModelEffort as a4, ModelJob as a5, ModelJobAttempt as a6, ModelJobCompletion as a7, ModelJobErrorCode as a8, ModelJobFormat as a9, PeerJoined as aA, PeerMessage as aB, PeerVisibility as aC, PendingAuthorization as aE, PendingTransfer as aF, AddBackendRequest as aH, FolderBackendInfo as aI, S3BackendInfo as aJ, S3Config as aK, S3Proposal as aL, S3PublicConfig as aM, SftpProposal as aN, StorageBackendInfo as aP, StorageBackendType as aQ, StorageObjectInfo as aR, UpdateBackendRequest as aS, WebDavProposal as aT, RequestedExtension as aU, SelectFileOptions as aV, SelectFolderOptions as aW, ServerInfo as aX, ServerStatus as aY, SessionAuthorization as aZ, SharedSpace as a_, ModelJobImage as aa, ModelJobProvenance as ab, ModelJobStep as ac, ModelPlace as ad, NotificationAction as af, NotificationClickEvent as ag, NotificationOptions as ah, OutgoingAttachment as aj, OutgoingMessage as ak, PasswordInput as am, PasswordItemFull as an, PasswordItemSummary as ao, PasswordKeyValue as ap, PasswordKeyValueInput as aq, PeerChannelClosed as as, PeerChannelOpened as at, PeerErrorKind as av, PeerErrorReason as aw, PeerEventMap as ax, PeerEventType as ay, PeerInviteStatus as az, ContactDetail as b, ShellCreateOptions as b0, ShellCreateResponse as b1, ShellExitEvent as b2, ShellOutputEvent as b3, SmtpConfig as b4, SpaceAccessTokenInfo as b5, SpaceAssignment as b6, SpaceInvite as b7, SpaceKeyGrantInfo as b8, SpaceMember as b9, SpaceMemberInfo as ba, SyncBackendInfo as bc, ToolContext as be, ToolHandler as bf, TransferDirection as bh, TransferProgress as bi, TransferState as bj, ContactHolziAddresses as c, ContactHolziDevice as d, ContactList as e, ContactListOptions as f, ContactSummary as g, ContactValue as h, DecryptedSpace as j, DeepLink as k, Device as l, DeviceInfo as m, DeviceType as n, DirEntry as p, EncryptedFolderChoice as q, EncryptedFolderEntry as r, EncryptedFolderProviderErrorKind as s, ExtensionModel as u, ExternalAuthDecision as v, ExternalConnection as w, ExternalRequest as z };
@@ -1,4 +1,4 @@
1
- import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, a as ExtensionManifest, H as HaexHubConfig, E as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, R as RequestOptions } from './types-3iifP-Q1.js';
1
+ import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, f as EventCallback, a as ExtensionManifest, H as HaexHubConfig, E as ExtensionInfo, A as ApplicationContext, g as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, R as RequestOptions } from './types-BZVkX0Wf.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  /**
@@ -363,7 +363,8 @@ declare class FilesystemAPI {
363
363
  private client;
364
364
  constructor(client: HaexVaultSdk);
365
365
  /**
366
- * Opens a save file dialog and saves the provided data to the selected location
366
+ * Opens a save file dialog and saves the provided data to the selected location.
367
+ * Waits for the user without the request timeout.
367
368
  * @param data The file data as Uint8Array
368
369
  * @param options Options for the save dialog
369
370
  * @returns The path where the file was saved, or null if cancelled
@@ -426,13 +427,13 @@ declare class FilesystemAPI {
426
427
  */
427
428
  stat(path: string): Promise<FileStat>;
428
429
  /**
429
- * Open a folder selection dialog
430
+ * Open a folder selection dialog; waits for the user without the request timeout
430
431
  * @param options Dialog options
431
432
  * @returns Selected folder path, or null if cancelled
432
433
  */
433
434
  selectFolder(options?: SelectFolderOptions): Promise<string | null>;
434
435
  /**
435
- * Open a file selection dialog
436
+ * Open a file selection dialog; waits for the user without the request timeout
436
437
  * @param options Dialog options
437
438
  * @returns Selected file paths, or null if cancelled
438
439
  */
@@ -1810,6 +1811,177 @@ declare class ModelsAPI {
1810
1811
  }): Promise<ModelJobCompletion>;
1811
1812
  }
1812
1813
 
1814
+ /**
1815
+ * Types of peer channels (holzi spec 057, `contracts/bridge.md` and `contracts/sdk.md`): channels
1816
+ * between frames of the same extension on devices of different vaults.
1817
+ */
1818
+ /** Who may join a lobby by its code: only the host's contacts, or anyone holding the code. */
1819
+ type PeerVisibility = "contacts" | "public";
1820
+ /**
1821
+ * The outcome of an invitation (`peers:invite-status`), exactly once per invitation, on the
1822
+ * inviting side.
1823
+ */
1824
+ interface PeerInviteStatus {
1825
+ inviteId: string;
1826
+ status: "accepted" | "declined" | "not-installed" | "unreachable" | "expired";
1827
+ /** Only with `accepted`: the channel to the invited device. */
1828
+ channelId?: string;
1829
+ /** Only with `unreachable`: ask the contact to share a current card. */
1830
+ hint?: "share_current_card";
1831
+ }
1832
+ /**
1833
+ * A channel opened by an invitation the user accepted in holzi's prompt (`peers:channel-opened`),
1834
+ * on the invited side.
1835
+ */
1836
+ interface PeerChannelOpened {
1837
+ channelId: string;
1838
+ origin: "invitation";
1839
+ inviteId: string;
1840
+ from: {
1841
+ /** Only when the extension's `contacts` permission covers this contact. */
1842
+ contactId?: string;
1843
+ /** The name on the other vault's card, not the display name of the address book. */
1844
+ name: string;
1845
+ };
1846
+ /** The JSON the inviting extension sent with the invitation. */
1847
+ payload: unknown;
1848
+ }
1849
+ /** A device that joined one of this device's lobbies by code (`peers:joined`), on the host. */
1850
+ interface PeerJoined {
1851
+ lobbyId: string;
1852
+ channelId: string;
1853
+ /** Chosen by the joining user and unchecked. */
1854
+ displayName: string;
1855
+ /** `true` when the joining device belongs to a contact. */
1856
+ verified: boolean;
1857
+ /** Only when the extension's `contacts` permission covers this contact. */
1858
+ contactId?: string;
1859
+ /** The JSON the joining extension sent with the join. */
1860
+ payload: unknown;
1861
+ }
1862
+ /** A message on a channel (`peers:message`), with its data decoded from Base64. */
1863
+ interface PeerMessage {
1864
+ channelId: string;
1865
+ data: Uint8Array;
1866
+ reliable: boolean;
1867
+ }
1868
+ /**
1869
+ * The end of a channel (`peers:channel-closed`): `closed` by either side, `lost` when a reliable
1870
+ * message could not be delivered, `timeout` when the other side stopped answering.
1871
+ */
1872
+ interface PeerChannelClosed {
1873
+ channelId: string;
1874
+ reason: "closed" | "lost" | "timeout";
1875
+ }
1876
+ /** The events of `client.peers.on`, by their name without the `peers:` prefix. */
1877
+ interface PeerEventMap {
1878
+ "invite-status": PeerInviteStatus;
1879
+ "channel-opened": PeerChannelOpened;
1880
+ joined: PeerJoined;
1881
+ message: PeerMessage;
1882
+ "channel-closed": PeerChannelClosed;
1883
+ }
1884
+ type PeerEventType = keyof PeerEventMap;
1885
+ /** The `details.reason` of a host error of a peers method. */
1886
+ type PeerErrorReason = "contact_unknown" | "invite_not_open" | "channel_unknown" | "channel_closed" | "lobby_closed" | "not_admitted" | "too_large" | "limit" | "network_unavailable" | "invalid_input";
1887
+
1888
+ /**
1889
+ * The name of each `details.reason` in haex-doom's draft of this API; `limit`,
1890
+ * `network_unavailable` and `invalid_input` are new there.
1891
+ */
1892
+ declare const PEER_ERROR_KINDS: {
1893
+ readonly contact_unknown: "PEER_CONTACT_UNKNOWN";
1894
+ readonly invite_not_open: "PEER_INVITE_UNKNOWN";
1895
+ readonly channel_unknown: "PEER_CHANNEL_CLOSED";
1896
+ readonly channel_closed: "PEER_CHANNEL_CLOSED";
1897
+ readonly too_large: "PEER_PAYLOAD_TOO_LARGE";
1898
+ readonly lobby_closed: "PEER_LOBBY_CLOSED";
1899
+ readonly not_admitted: "PEER_NOT_ALLOWED";
1900
+ readonly limit: "PEER_LIMIT";
1901
+ readonly network_unavailable: "PEER_NETWORK_UNAVAILABLE";
1902
+ readonly invalid_input: "PEER_INVALID_INPUT";
1903
+ };
1904
+ type PeerErrorKind = (typeof PEER_ERROR_KINDS)[PeerErrorReason];
1905
+ /**
1906
+ * A host error of a peers method that names its `details.reason`. `code` stays the host's number
1907
+ * (1001, 1002, 3001, 7000, 8001); `not_admitted` shares 1002 with a refused permission, so tell
1908
+ * them apart by `reason`. The host's error is kept as `cause`.
1909
+ */
1910
+ declare class PeerError extends Error {
1911
+ readonly code: number;
1912
+ readonly reason: PeerErrorReason;
1913
+ readonly details: Record<string, unknown>;
1914
+ readonly kind: PeerErrorKind;
1915
+ /** The host's `details.limit` with `too_large` (bytes) and `limit` (count). */
1916
+ readonly limit?: number;
1917
+ constructor(code: number, reason: PeerErrorReason, message: string, details?: Record<string, unknown>, options?: {
1918
+ cause?: unknown;
1919
+ });
1920
+ }
1921
+ /**
1922
+ * Channels between frames of this extension on devices of different vaults (holzi spec 057).
1923
+ * Needs the `peers` permission (`{ target: "*", action: "connect" }`); inviting a contact also
1924
+ * needs `contacts` read access to that contact.
1925
+ *
1926
+ * A channel starts in one of two ways. An invitation goes to all devices of a contact; the user
1927
+ * accepts or declines it only in holzi's own prompt, so the SDK has no accept or decline. The
1928
+ * invited side gets `channel-opened`, the inviting side `invite-status`. A lobby hands out an
1929
+ * opaque join code (`haex-vault:join:…`); a device that joins with it gets the channel from
1930
+ * {@link PeersAPI.joinAsync}, the host gets `joined`.
1931
+ *
1932
+ * Errors with a `details.reason` reject as {@link PeerError}; others reject unchanged.
1933
+ */
1934
+ declare class PeersAPI {
1935
+ private client;
1936
+ /** Largest fast message (`reliable: false`) in bytes. */
1937
+ readonly MAX_FAST_BYTES = 1024;
1938
+ /** Largest reliable message in bytes. */
1939
+ readonly MAX_RELIABLE_BYTES = 65536;
1940
+ /** Largest `payload` of an invitation or a join, as JSON, in bytes. */
1941
+ readonly MAX_PAYLOAD_BYTES = 4096;
1942
+ constructor(client: HaexVaultSdk);
1943
+ private call;
1944
+ /** Invites a contact; the outcome follows as `invite-status` with this `inviteId`. */
1945
+ inviteAsync(contactId: string, payload: unknown): Promise<{
1946
+ inviteId: string;
1947
+ }>;
1948
+ /** Withdraws an open invitation on all devices of the contact; no `invite-status` follows. */
1949
+ cancelInviteAsync(inviteId: string): Promise<void>;
1950
+ /**
1951
+ * Opens a lobby; `lobbyId` is 1–64 characters of `[A-Za-z0-9._-]`. The join code is opaque:
1952
+ * hand it on as it is.
1953
+ */
1954
+ openLobbyAsync(lobbyId: string, visibility: PeerVisibility): Promise<{
1955
+ joinCode: string;
1956
+ }>;
1957
+ /** Closes a lobby: its code stops working, its channels stay open. An unknown lobby is fine. */
1958
+ closeLobbyAsync(lobbyId: string): Promise<void>;
1959
+ /**
1960
+ * Joins a lobby by its code with a self-chosen `displayName` (1–64 characters). The host
1961
+ * answers within 15 s; a lobby that cannot be joined for any reason rejects as `lobby_closed`.
1962
+ */
1963
+ joinAsync(joinCode: string, displayName: string, payload: unknown): Promise<{
1964
+ channelId: string;
1965
+ lobbyId: string;
1966
+ }>;
1967
+ /** Closes a channel of an own lobby and keeps that device (and vault) out of the lobby. */
1968
+ removeAsync(channelId: string): Promise<void>;
1969
+ /**
1970
+ * Sends bytes over a channel: fast (default, at most {@link MAX_FAST_BYTES}, may be lost) or
1971
+ * `reliable` (at most {@link MAX_RELIABLE_BYTES}, in order; 16 may wait per channel).
1972
+ */
1973
+ sendAsync(channelId: string, data: Uint8Array, options?: {
1974
+ reliable?: boolean;
1975
+ }): Promise<void>;
1976
+ /** Closes a channel; both sides get `channel-closed` with `reason: "closed"`. */
1977
+ closeAsync(channelId: string): Promise<void>;
1978
+ /**
1979
+ * Listens for one of the peers events (`invite-status`, `channel-opened`, `joined`, `message`,
1980
+ * `channel-closed`); `message.data` arrives as bytes. Returns an unsubscribe function.
1981
+ */
1982
+ on<T extends PeerEventType>(type: T, handler: (event: PeerEventMap[T]) => void): () => void;
1983
+ }
1984
+
1813
1985
  /**
1814
1986
  * Mail types — IMAP fetch + SMTP send.
1815
1987
  *
@@ -2289,6 +2461,7 @@ declare class HaexVaultSdk {
2289
2461
  readonly passwords: PasswordsAPI;
2290
2462
  readonly contacts: ContactsAPI;
2291
2463
  readonly models: ModelsAPI;
2464
+ readonly peers: PeersAPI;
2292
2465
  readonly mail: MailAPI;
2293
2466
  readonly notifications: NotificationsAPI;
2294
2467
  readonly tab: TabAPI;
@@ -2345,5 +2518,5 @@ declare class HaexVaultSdk {
2345
2518
  private log;
2346
2519
  }
2347
2520
 
2348
- export { DatabaseAPI as D, HaexVaultSdk as H, FilesystemAPI as L, KnownPath as N, LOCALSEND_EVENTS as P, LocalSendAPI as Q, StorageAPI as S, MailAPI as V, RemoteStorageAPI as aB, ShellAPI as aO, SpacesAPI as a_, ModelsAPI as ae, NotificationsAPI as ai, PasswordsAPI as aq, PermissionsAPI as at, TabAPI as b0, ToolsAPI as b3, WebAPI as b7, canExternalClientSendRequests as b8, isExternalClientConnected as b9, ContactsAPI as i, DialogAPI as o, EncryptedFoldersAPI as t, ExternalConnectionErrorCode as x, ExternalConnectionState as y };
2349
- export type { MailNewMessagesEvent as $, AuthorizedClient as A, BlockedClient as B, ConfirmOptions as C, EncryptedFolderAccess as E, ExternalRequestEvent as F, ExternalRequestHandler as G, ExternalRequestPayload as I, ExternalResponse as J, FileStat as K, ImapConfig as M, KnownPaths as O, LocalSendEvent as R, FileInfo as T, LocalSendSettings as U, MailAccount as W, MailAddress as X, Attachment as Y, FetchRange as Z, MailMessage as _, ConnectionSecurity as a, SyncBackendInfo as a$, MailSearchCriteria as a0, MailSearchResult as a1, MailboxInfo as a2, MessageEnvelope as a3, ModelEffort as a4, ModelJob as a5, ModelJobAttempt as a6, ModelJobCompletion as a7, ModelJobErrorCode as a8, ModelJobFormat as a9, SftpProposal as aA, StorageBackendInfo as aC, StorageBackendType as aD, StorageObjectInfo as aE, UpdateBackendRequest as aF, WebDavProposal as aG, RequestedExtension as aH, SelectFileOptions as aI, SelectFolderOptions as aJ, ServerInfo as aK, ServerStatus as aL, SessionAuthorization as aM, SharedSpace as aN, ShellCreateOptions as aP, ShellCreateResponse as aQ, ShellExitEvent as aR, ShellOutputEvent as aS, SmtpConfig as aT, SpaceAccessTokenInfo as aU, SpaceAssignment as aV, SpaceInvite as aW, SpaceKeyGrantInfo as aX, SpaceMember as aY, SpaceMemberInfo as aZ, ModelJobImage as aa, ModelJobProvenance as ab, ModelJobStep as ac, ModelPlace as ad, NotificationAction as af, NotificationClickEvent as ag, NotificationOptions as ah, OutgoingAttachment as aj, OutgoingMessage as ak, PasswordInput as al, PasswordItemFull as am, PasswordItemSummary as an, PasswordKeyValue as ao, PasswordKeyValueInput as ap, PendingAuthorization as ar, PendingTransfer as as, AddBackendRequest as au, FolderBackendInfo as av, S3BackendInfo as aw, S3Config as ax, S3Proposal as ay, S3PublicConfig as az, ContactDetail as b, ToolContext as b1, ToolHandler as b2, TransferDirection as b4, TransferProgress as b5, TransferState as b6, ContactHolziAddresses as c, ContactHolziDevice as d, ContactList as e, ContactListOptions as f, ContactSummary as g, ContactValue as h, DecryptedSpace as j, DeepLink as k, Device as l, DeviceInfo as m, DeviceType as n, DirEntry as p, EncryptedFolderChoice as q, EncryptedFolderEntry as r, EncryptedFolderProviderErrorKind as s, ExtensionModel as u, ExternalAuthDecision as v, ExternalConnection as w, ExternalRequest as z };
2521
+ export { DatabaseAPI as D, HaexVaultSdk as H, FilesystemAPI as L, KnownPath as N, LOCALSEND_EVENTS as P, LocalSendAPI as Q, StorageAPI as S, MailAPI as V, ShellAPI as a$, PeersAPI as aD, PermissionsAPI as aG, RemoteStorageAPI as aO, ModelsAPI as ae, NotificationsAPI as ai, PEER_ERROR_KINDS as al, PasswordsAPI as ar, PeerError as au, SpacesAPI as bb, TabAPI as bd, ToolsAPI as bg, WebAPI as bk, canExternalClientSendRequests as bl, isExternalClientConnected as bm, ContactsAPI as i, DialogAPI as o, EncryptedFoldersAPI as t, ExternalConnectionErrorCode as x, ExternalConnectionState as y };
2522
+ export type { MailNewMessagesEvent as $, AuthorizedClient as A, BlockedClient as B, ConfirmOptions as C, EncryptedFolderAccess as E, ExternalRequestEvent as F, ExternalRequestHandler as G, ExternalRequestPayload as I, ExternalResponse as J, FileStat as K, ImapConfig as M, KnownPaths as O, LocalSendEvent as R, FileInfo as T, LocalSendSettings as U, MailAccount as W, MailAddress as X, Attachment as Y, FetchRange as Z, MailMessage as _, ConnectionSecurity as a, MailSearchCriteria as a0, MailSearchResult as a1, MailboxInfo as a2, MessageEnvelope as a3, ModelEffort as a4, ModelJob as a5, ModelJobAttempt as a6, ModelJobCompletion as a7, ModelJobErrorCode as a8, ModelJobFormat as a9, PeerJoined as aA, PeerMessage as aB, PeerVisibility as aC, PendingAuthorization as aE, PendingTransfer as aF, AddBackendRequest as aH, FolderBackendInfo as aI, S3BackendInfo as aJ, S3Config as aK, S3Proposal as aL, S3PublicConfig as aM, SftpProposal as aN, StorageBackendInfo as aP, StorageBackendType as aQ, StorageObjectInfo as aR, UpdateBackendRequest as aS, WebDavProposal as aT, RequestedExtension as aU, SelectFileOptions as aV, SelectFolderOptions as aW, ServerInfo as aX, ServerStatus as aY, SessionAuthorization as aZ, SharedSpace as a_, ModelJobImage as aa, ModelJobProvenance as ab, ModelJobStep as ac, ModelPlace as ad, NotificationAction as af, NotificationClickEvent as ag, NotificationOptions as ah, OutgoingAttachment as aj, OutgoingMessage as ak, PasswordInput as am, PasswordItemFull as an, PasswordItemSummary as ao, PasswordKeyValue as ap, PasswordKeyValueInput as aq, PeerChannelClosed as as, PeerChannelOpened as at, PeerErrorKind as av, PeerErrorReason as aw, PeerEventMap as ax, PeerEventType as ay, PeerInviteStatus as az, ContactDetail as b, ShellCreateOptions as b0, ShellCreateResponse as b1, ShellExitEvent as b2, ShellOutputEvent as b3, SmtpConfig as b4, SpaceAccessTokenInfo as b5, SpaceAssignment as b6, SpaceInvite as b7, SpaceKeyGrantInfo as b8, SpaceMember as b9, SpaceMemberInfo as ba, SyncBackendInfo as bc, ToolContext as be, ToolHandler as bf, TransferDirection as bh, TransferProgress as bi, TransferState as bj, ContactHolziAddresses as c, ContactHolziDevice as d, ContactList as e, ContactListOptions as f, ContactSummary as g, ContactValue as h, DecryptedSpace as j, DeepLink as k, Device as l, DeviceInfo as m, DeviceType as n, DirEntry as p, EncryptedFolderChoice as q, EncryptedFolderEntry as r, EncryptedFolderProviderErrorKind as s, ExtensionModel as u, ExternalAuthDecision as v, ExternalConnection as w, ExternalRequest as z };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-D9zisRb8.mjs';
2
- export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PasswordInput, am as PasswordItemFull, an as PasswordItemSummary, ao as PasswordKeyValue, ap as PasswordKeyValueInput, aq as PasswordsAPI, ar as PendingAuthorization, as as PendingTransfer, at as PermissionsAPI, au as RemoteAddBackendRequest, av as RemoteFolderBackendInfo, aw as RemoteS3BackendInfo, ax as RemoteS3Config, ay as RemoteS3Proposal, az as RemoteS3PublicConfig, aA as RemoteSftpProposal, aB as RemoteStorageAPI, aC as RemoteStorageBackendInfo, aD as RemoteStorageBackendType, aE as RemoteStorageObjectInfo, aF as RemoteUpdateBackendRequest, aG as RemoteWebDavProposal, aH as RequestedExtension, aI as SelectFileOptions, aJ as SelectFolderOptions, aK as ServerInfo, aL as ServerStatus, aM as SessionAuthorization, aN as SharedSpace, aO as ShellAPI, aP as ShellCreateOptions, aQ as ShellCreateResponse, aR as ShellExitEvent, aS as ShellOutputEvent, aT as SmtpConfig, aU as SpaceAccessTokenInfo, aV as SpaceAssignment, aW as SpaceInvite, aX as SpaceKeyGrantInfo, aY as SpaceMember, aZ as SpaceMemberInfo, a_ as SpacesAPI, a$ as SyncBackendInfo, b0 as TabAPI, b1 as ToolContext, b2 as ToolHandler, b3 as ToolsAPI, b4 as TransferDirection, b5 as TransferProgress, b6 as TransferState, b7 as WebAPI, b8 as canExternalClientSendRequests, b9 as isExternalClientConnected } from './client-D9zisRb8.mjs';
3
- import { h as SignedClaimPresentation, H as HaexHubConfig } from './types-3iifP-Q1.mjs';
4
- export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, E as ExtensionInfo, a as ExtensionManifest, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, B as HostErrorCode, I as IdentityClaim, G as MAIL_EVENTS, J as MODEL_JOB_EVENTS, K as MailEvent, L as ManifestI18nEntry, N as ManifestTool, O as ManifestToolEffect, Q as ModelJobEvent, T as NOTIFICATION_EVENTS, U as NotificationEvent, V as PermissionDeniedError, X as PermissionErrorBase, Y as PermissionErrorCode, Z as PermissionPromptError, P as PermissionResponse, _ as PermissionStatus, R as RequestOptions, $ as SHELL_EVENTS, a0 as SearchQuery, a1 as SearchRequestEvent, S as SearchResult, a2 as ShellEvent, a3 as SyncTablesUpdatedEvent, a4 as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, a5 as getTableName, a6 as isPermissionDeniedError, a7 as isPermissionError, a8 as isPermissionPromptError } from './types-3iifP-Q1.mjs';
1
+ import { H as HaexVaultSdk } from './client-CS0AdXto.mjs';
2
+ export { A as AuthorizedClient, B as BlockedClient, C as ConfirmOptions, a as ConnectionSecurity, b as ContactDetail, c as ContactHolziAddresses, d as ContactHolziDevice, e as ContactList, f as ContactListOptions, g as ContactSummary, h as ContactValue, i as ContactsAPI, D as DatabaseAPI, j as DecryptedSpace, k as DeepLink, l as Device, m as DeviceInfo, n as DeviceType, o as DialogAPI, p as DirEntry, E as EncryptedFolderAccess, q as EncryptedFolderChoice, r as EncryptedFolderEntry, s as EncryptedFolderProviderErrorKind, t as EncryptedFoldersAPI, u as ExtensionModel, v as ExternalAuthDecision, w as ExternalConnection, x as ExternalConnectionErrorCode, y as ExternalConnectionState, z as ExternalRequest, F as ExternalRequestEvent, G as ExternalRequestHandler, I as ExternalRequestPayload, J as ExternalResponse, K as FileStat, L as FilesystemAPI, M as ImapConfig, N as KnownPath, O as KnownPaths, P as LOCALSEND_EVENTS, Q as LocalSendAPI, R as LocalSendEvent, T as LocalSendFileInfo, U as LocalSendSettings, V as MailAPI, W as MailAccount, X as MailAddress, Y as MailAttachment, Z as MailFetchRange, _ as MailMessage, $ as MailNewMessagesEvent, a0 as MailSearchCriteria, a1 as MailSearchResult, a2 as MailboxInfo, a3 as MessageEnvelope, a4 as ModelEffort, a5 as ModelJob, a6 as ModelJobAttempt, a7 as ModelJobCompletion, a8 as ModelJobErrorCode, a9 as ModelJobFormat, aa as ModelJobImage, ab as ModelJobProvenance, ac as ModelJobStep, ad as ModelPlace, ae as ModelsAPI, af as NotificationAction, ag as NotificationClickEvent, ah as NotificationOptions, ai as NotificationsAPI, aj as OutgoingAttachment, ak as OutgoingMessage, al as PEER_ERROR_KINDS, am as PasswordInput, an as PasswordItemFull, ao as PasswordItemSummary, ap as PasswordKeyValue, aq as PasswordKeyValueInput, ar as PasswordsAPI, as as PeerChannelClosed, at as PeerChannelOpened, au as PeerError, av as PeerErrorKind, aw as PeerErrorReason, ax as PeerEventMap, ay as PeerEventType, az as PeerInviteStatus, aA as PeerJoined, aB as PeerMessage, aC as PeerVisibility, aD as PeersAPI, aE as PendingAuthorization, aF as PendingTransfer, aG as PermissionsAPI, aH as RemoteAddBackendRequest, aI as RemoteFolderBackendInfo, aJ as RemoteS3BackendInfo, aK as RemoteS3Config, aL as RemoteS3Proposal, aM as RemoteS3PublicConfig, aN as RemoteSftpProposal, aO as RemoteStorageAPI, aP as RemoteStorageBackendInfo, aQ as RemoteStorageBackendType, aR as RemoteStorageObjectInfo, aS as RemoteUpdateBackendRequest, aT as RemoteWebDavProposal, aU as RequestedExtension, aV as SelectFileOptions, aW as SelectFolderOptions, aX as ServerInfo, aY as ServerStatus, aZ as SessionAuthorization, a_ as SharedSpace, a$ as ShellAPI, b0 as ShellCreateOptions, b1 as ShellCreateResponse, b2 as ShellExitEvent, b3 as ShellOutputEvent, b4 as SmtpConfig, b5 as SpaceAccessTokenInfo, b6 as SpaceAssignment, b7 as SpaceInvite, b8 as SpaceKeyGrantInfo, b9 as SpaceMember, ba as SpaceMemberInfo, bb as SpacesAPI, bc as SyncBackendInfo, bd as TabAPI, be as ToolContext, bf as ToolHandler, bg as ToolsAPI, bh as TransferDirection, bi as TransferProgress, bj as TransferState, bk as WebAPI, bl as canExternalClientSendRequests, bm as isExternalClientConnected } from './client-CS0AdXto.mjs';
3
+ import { h as SignedClaimPresentation, H as HaexHubConfig } from './types-BZVkX0Wf.mjs';
4
+ export { A as ApplicationContext, C as ClaimRequirement, i as ContextChangedEvent, j as DEFAULT_TIMEOUT, k as DatabaseColumnInfo, l as DatabaseExecuteParams, m as DatabasePermission, g as DatabasePermissionRequest, n as DatabaseQueryParams, D as DatabaseQueryResult, o as DatabaseTableInfo, c as EXTERNAL_EVENTS, p as ErrorCode, f as EventCallback, E as ExtensionInfo, a as ExtensionManifest, q as ExtensionRuntimeMode, r as ExternalEvent, F as FileChangeEvent, s as FileChangePayload, t as FileChangeType, u as FilteredSyncTablesResult, v as HAEXTENSION_EVENTS, b as HaexHubEvent, w as HaexHubRequest, x as HaexHubResponse, y as HaexVaultSdkError, z as HaextensionEvent, B as HostErrorCode, I as IdentityClaim, G as MAIL_EVENTS, J as MODEL_JOB_EVENTS, K as MailEvent, L as ManifestI18nEntry, N as ManifestTool, O as ManifestToolEffect, Q as ModelJobEvent, T as NOTIFICATION_EVENTS, U as NotificationEvent, V as PEERS_EVENTS, X as PeersEvent, Y as PermissionDeniedError, Z as PermissionErrorBase, _ as PermissionErrorCode, $ as PermissionPromptError, P as PermissionResponse, a0 as PermissionStatus, R as RequestOptions, a1 as SHELL_EVENTS, a2 as SearchQuery, a3 as SearchRequestEvent, S as SearchResult, a4 as ShellEvent, a5 as SyncTablesUpdatedEvent, a6 as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, a7 as getTableName, a8 as isPermissionDeniedError, a9 as isPermissionError, aa as isPermissionPromptError } from './types-BZVkX0Wf.mjs';
5
5
  export { H as HaextensionConfig } from './config-P_6DqTHl.mjs';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -169,6 +169,37 @@ declare const MODEL_COMMANDS: {
169
169
  };
170
170
  type ModelCommand = (typeof MODEL_COMMANDS)[keyof typeof MODEL_COMMANDS];
171
171
 
172
+ /**
173
+ * Peer Commands
174
+ *
175
+ * Commands for channels between frames of the same extension on devices of
176
+ * different vaults (holzi spec 057, `contracts/bridge.md`). Every method needs
177
+ * the `peers` permission (`action` = `connect`, `target` = "*"). There is no
178
+ * command to accept or decline an invitation: that happens only in holzi's
179
+ * own prompt.
180
+ *
181
+ * Naming convention: `extension_peers_<action>`
182
+ */
183
+ declare const PEER_COMMANDS: {
184
+ /** Invites a contact; the outcome follows as `peers:invite-status` */
185
+ readonly invite: "extension_peers_invite";
186
+ /** Withdraws an open invitation on all devices of the contact */
187
+ readonly inviteCancel: "extension_peers_invite_cancel";
188
+ /** Opens a lobby and returns its join code */
189
+ readonly lobbyOpen: "extension_peers_lobby_open";
190
+ /** Closes a lobby; its code stops working, its channels stay open */
191
+ readonly lobbyClose: "extension_peers_lobby_close";
192
+ /** Joins a lobby by its code; waits at most 15 s for the host */
193
+ readonly join: "extension_peers_join";
194
+ /** Closes a channel of an own lobby and keeps the device out of that lobby */
195
+ readonly remove: "extension_peers_remove";
196
+ /** Sends a fast or a reliable message over a channel */
197
+ readonly send: "extension_peers_send";
198
+ /** Closes a channel on both sides */
199
+ readonly close: "extension_peers_close";
200
+ };
201
+ type PeerCommand = (typeof PEER_COMMANDS)[keyof typeof PEER_COMMANDS];
202
+
172
203
  /**
173
204
  * Mail Commands (IMAP fetch + SMTP send).
174
205
  *
@@ -896,6 +927,16 @@ declare const TAURI_COMMANDS: {
896
927
  readonly start: "extension_model_job_start";
897
928
  readonly cancel: "extension_model_job_cancel";
898
929
  };
930
+ readonly peers: {
931
+ readonly invite: "extension_peers_invite";
932
+ readonly inviteCancel: "extension_peers_invite_cancel";
933
+ readonly lobbyOpen: "extension_peers_lobby_open";
934
+ readonly lobbyClose: "extension_peers_lobby_close";
935
+ readonly join: "extension_peers_join";
936
+ readonly remove: "extension_peers_remove";
937
+ readonly send: "extension_peers_send";
938
+ readonly close: "extension_peers_close";
939
+ };
899
940
  readonly mail: {
900
941
  readonly listMailboxes: "extension_mail_list_mailboxes";
901
942
  readonly fetchEnvelopes: "extension_mail_fetch_envelopes";
@@ -917,7 +958,7 @@ declare const TAURI_COMMANDS: {
917
958
  readonly dismiss: "extension_notifications_dismiss";
918
959
  };
919
960
  };
920
- type TauriCommand = (typeof DATABASE_COMMANDS)[keyof typeof DATABASE_COMMANDS] | (typeof PERMISSIONS_COMMANDS)[keyof typeof PERMISSIONS_COMMANDS] | (typeof WEB_COMMANDS)[keyof typeof WEB_COMMANDS] | (typeof WEB_STORAGE_COMMANDS)[keyof typeof WEB_STORAGE_COMMANDS] | (typeof FILESYSTEM_COMMANDS)[keyof typeof FILESYSTEM_COMMANDS] | (typeof EXTERNAL_BRIDGE_COMMANDS)[keyof typeof EXTERNAL_BRIDGE_COMMANDS] | (typeof EXTENSION_COMMANDS)[keyof typeof EXTENSION_COMMANDS] | (typeof REMOTE_STORAGE_COMMANDS)[keyof typeof REMOTE_STORAGE_COMMANDS] | (typeof ENCRYPTED_FOLDER_COMMANDS)[keyof typeof ENCRYPTED_FOLDER_COMMANDS] | (typeof LOCALSEND_COMMANDS)[keyof typeof LOCALSEND_COMMANDS] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS] | (typeof SHELL_COMMANDS)[keyof typeof SHELL_COMMANDS] | (typeof PASSWORD_COMMANDS)[keyof typeof PASSWORD_COMMANDS] | (typeof CONTACT_COMMANDS)[keyof typeof CONTACT_COMMANDS] | (typeof MODEL_COMMANDS)[keyof typeof MODEL_COMMANDS] | (typeof MAIL_COMMANDS)[keyof typeof MAIL_COMMANDS] | (typeof NOTIFICATION_COMMANDS)[keyof typeof NOTIFICATION_COMMANDS];
961
+ type TauriCommand = (typeof DATABASE_COMMANDS)[keyof typeof DATABASE_COMMANDS] | (typeof PERMISSIONS_COMMANDS)[keyof typeof PERMISSIONS_COMMANDS] | (typeof WEB_COMMANDS)[keyof typeof WEB_COMMANDS] | (typeof WEB_STORAGE_COMMANDS)[keyof typeof WEB_STORAGE_COMMANDS] | (typeof FILESYSTEM_COMMANDS)[keyof typeof FILESYSTEM_COMMANDS] | (typeof EXTERNAL_BRIDGE_COMMANDS)[keyof typeof EXTERNAL_BRIDGE_COMMANDS] | (typeof EXTENSION_COMMANDS)[keyof typeof EXTENSION_COMMANDS] | (typeof REMOTE_STORAGE_COMMANDS)[keyof typeof REMOTE_STORAGE_COMMANDS] | (typeof ENCRYPTED_FOLDER_COMMANDS)[keyof typeof ENCRYPTED_FOLDER_COMMANDS] | (typeof LOCALSEND_COMMANDS)[keyof typeof LOCALSEND_COMMANDS] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS] | (typeof SHELL_COMMANDS)[keyof typeof SHELL_COMMANDS] | (typeof PASSWORD_COMMANDS)[keyof typeof PASSWORD_COMMANDS] | (typeof CONTACT_COMMANDS)[keyof typeof CONTACT_COMMANDS] | (typeof MODEL_COMMANDS)[keyof typeof MODEL_COMMANDS] | (typeof PEER_COMMANDS)[keyof typeof PEER_COMMANDS] | (typeof MAIL_COMMANDS)[keyof typeof MAIL_COMMANDS] | (typeof NOTIFICATION_COMMANDS)[keyof typeof NOTIFICATION_COMMANDS];
921
962
 
922
963
  /**
923
964
  * Crypto utilities for Vault Key Management
@@ -1184,5 +1225,5 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
1184
1225
 
1185
1226
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
1186
1227
 
1187
- export { CONTACT_COMMANDS, COSE_ALGORITHM, ENCRYPTED_FOLDER_COMMANDS, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, KEY_AGREEMENT_ALGO, MAIL_COMMANDS, MODEL_COMMANDS, NOTIFICATION_COMMANDS, PASSWORD_COMMANDS, SIGNING_ALGO, SPACE_COMMANDS, SignedClaimPresentation, TAURI_COMMANDS, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
1188
- export type { AuthUser, ContactCommand, CoseAlgorithm, CreateSpaceRequest, EncryptedFolderCommand, ExportedPasskeyKeyPair, ExportedUserKeypair, HaexspaceMessageType, InviteMemberRequest, MailCommand, ModelCommand, NotificationCommand, PasskeyKeyPair, PasswordCommand, RegisterKeypairRequest, SealedData, SignableRecord, SpaceCommand, StorageConfig, ErrorResponse as SyncServerErrorResponse, ServerInfo as SyncServerInfo, LoginRequest as SyncServerLoginRequest, LoginResponse as SyncServerLoginResponse, RefreshRequest as SyncServerRefreshRequest, TauriCommand, UserKeypair };
1228
+ export { CONTACT_COMMANDS, COSE_ALGORITHM, ENCRYPTED_FOLDER_COMMANDS, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, KEY_AGREEMENT_ALGO, MAIL_COMMANDS, MODEL_COMMANDS, NOTIFICATION_COMMANDS, PASSWORD_COMMANDS, PEER_COMMANDS, SIGNING_ALGO, SPACE_COMMANDS, SignedClaimPresentation, TAURI_COMMANDS, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, unwrapKey, verifyClaimPresentationAsync, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
1229
+ export type { AuthUser, ContactCommand, CoseAlgorithm, CreateSpaceRequest, EncryptedFolderCommand, ExportedPasskeyKeyPair, ExportedUserKeypair, HaexspaceMessageType, InviteMemberRequest, MailCommand, ModelCommand, NotificationCommand, PasskeyKeyPair, PasswordCommand, PeerCommand, RegisterKeypairRequest, SealedData, SignableRecord, SpaceCommand, StorageConfig, ErrorResponse as SyncServerErrorResponse, ServerInfo as SyncServerInfo, LoginRequest as SyncServerLoginRequest, LoginResponse as SyncServerLoginResponse, RefreshRequest as SyncServerRefreshRequest, TauriCommand, UserKeypair };