ai-remote 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +6 -0
  2. package/dist/cli.mjs +17 -6
  3. package/dist/index.d.ts +254 -12
  4. package/dist/protocols.d.ts +349 -0
  5. package/package.json +3 -3
  6. package/dist/protocols/index.d.ts +0 -33
  7. package/dist/protocols/rdp/buffer.d.ts +0 -38
  8. package/dist/protocols/rdp/caps.d.ts +0 -49
  9. package/dist/protocols/rdp/cert.d.ts +0 -18
  10. package/dist/protocols/rdp/client.d.ts +0 -56
  11. package/dist/protocols/rdp/cliprdr.d.ts +0 -27
  12. package/dist/protocols/rdp/credssp.d.ts +0 -34
  13. package/dist/protocols/rdp/crypto.d.ts +0 -63
  14. package/dist/protocols/rdp/display.d.ts +0 -38
  15. package/dist/protocols/rdp/gcc.d.ts +0 -23
  16. package/dist/protocols/rdp/keymap.d.ts +0 -9
  17. package/dist/protocols/rdp/mcs.d.ts +0 -40
  18. package/dist/protocols/rdp/ntlm.d.ts +0 -61
  19. package/dist/protocols/rdp/pdu.d.ts +0 -155
  20. package/dist/protocols/rdp/rail.d.ts +0 -119
  21. package/dist/protocols/rdp/rle.d.ts +0 -13
  22. package/dist/protocols/rdp/sec.d.ts +0 -59
  23. package/dist/protocols/rdp/session.d.ts +0 -62
  24. package/dist/protocols/rdp/tls.d.ts +0 -18
  25. package/dist/protocols/rdp/vchannel.d.ts +0 -28
  26. package/dist/protocols/rdp/x224.d.ts +0 -40
  27. package/dist/protocols/ssh/identity.d.ts +0 -39
  28. package/dist/protocols/ssh/kex.d.ts +0 -97
  29. package/dist/protocols/ssh/messages.d.ts +0 -52
  30. package/dist/protocols/ssh/session.d.ts +0 -67
  31. package/dist/protocols/ssh/terminal.d.ts +0 -46
  32. package/dist/protocols/ssh/transport.d.ts +0 -62
  33. package/dist/protocols/ssh/wire.d.ts +0 -52
  34. package/dist/protocols/types.d.ts +0 -127
  35. package/dist/protocols/vnc/des.d.ts +0 -25
  36. package/dist/protocols/vnc/input.d.ts +0 -5
  37. package/dist/protocols/vnc/keysyms.d.ts +0 -16
  38. package/dist/protocols/vnc/rfb.d.ts +0 -64
  39. package/dist/protocols/vnc/session.d.ts +0 -12
  40. package/dist/shared/connection.d.ts +0 -81
  41. package/dist/shared/device.d.ts +0 -26
  42. package/dist/shared/hosts.d.ts +0 -63
  43. package/dist/shared/icons.d.ts +0 -46
  44. package/dist/shared/protocol.d.ts +0 -32
  45. package/dist/shared/signals.d.ts +0 -37
package/README.md CHANGED
@@ -92,6 +92,12 @@ npx ai-remote shot -o screen.png
92
92
  npx ai-remote click 640,400
93
93
  ```
94
94
 
95
+ When a Mac offers both account authentication and the legacy VNC-password
96
+ challenge, `-u NAME` selects the account exchange and attaches to that user's
97
+ desktop. Omit `-u` to use the legacy VNC password instead. Add `--save` after a
98
+ successful first connection to keep the password in the macOS login Keychain;
99
+ later connections can use `--no-prompt`.
100
+
95
101
  The client is this package's own: no noVNC, no browser and no gateway. It signs
96
102
  in either way a host may ask -- the classic VNC password, or the account and
97
103
  password macOS Screen Sharing wants -- and decodes Raw and CopyRect, which
package/dist/cli.mjs CHANGED
@@ -7649,6 +7649,8 @@ var ENCODING = {
7649
7649
  LAST_RECT: -224
7650
7650
  };
7651
7651
  var SECURITY = { NONE: 1, VNC: 2, APPLE_DH: 30 };
7652
+ var ACTIVE_UPDATE_INTERVAL_MS = 1e3 / 30;
7653
+ var IDLE_UPDATE_INTERVAL_MS = 100;
7652
7654
  var SECURITY_NAME = {
7653
7655
  0: "invalid",
7654
7656
  1: "none",
@@ -7800,13 +7802,16 @@ var RfbClient = class extends EventTarget {
7800
7802
  /**
7801
7803
  * Which way to sign in.
7802
7804
  *
7803
- * A password challenge is preferred where the host offers one: it is the same
7804
- * everywhere. Apple's exchange comes next, because on macOS it is usually the
7805
- * only thing offered -- Screen Sharing wants an account, not a VNC password,
7806
- * unless somebody has turned the legacy one on.
7805
+ * A named account means the caller wants Apple's account exchange when the
7806
+ * host offers it. macOS can advertise that beside the legacy VNC-password
7807
+ * challenge; choosing the challenge first ignores the account and attaches to
7808
+ * loginwindow instead of the named user's desktop. Without an account, keep
7809
+ * preferring the portable VNC-password challenge.
7807
7810
  */
7808
7811
  #chooseSecurity(offered) {
7812
+ const username = this.options.username ?? "";
7809
7813
  const password2 = this.options.password ?? "";
7814
+ if (username && password2 && offered.includes(SECURITY.APPLE_DH)) return SECURITY.APPLE_DH;
7810
7815
  if (password2 && offered.includes(SECURITY.VNC)) return SECURITY.VNC;
7811
7816
  if (password2 && offered.includes(SECURITY.APPLE_DH)) return SECURITY.APPLE_DH;
7812
7817
  if (offered.includes(SECURITY.NONE)) return SECURITY.NONE;
@@ -7886,7 +7891,12 @@ var RfbClient = class extends EventTarget {
7886
7891
  while (!this.#closed) {
7887
7892
  const [type] = await this.#read(1);
7888
7893
  if (type === SERVER.FRAMEBUFFER_UPDATE) {
7889
- await this.#framebufferUpdate();
7894
+ const started = Date.now();
7895
+ const changed = await this.#framebufferUpdate();
7896
+ const interval = changed ? ACTIVE_UPDATE_INTERVAL_MS : IDLE_UPDATE_INTERVAL_MS;
7897
+ const remaining = interval - (Date.now() - started);
7898
+ if (remaining > 0) await new Promise((resolve) => setTimeout(resolve, remaining));
7899
+ if (this.#closed) break;
7890
7900
  this.#requestUpdate(!this.#wantFull);
7891
7901
  continue;
7892
7902
  }
@@ -7951,6 +7961,7 @@ var RfbClient = class extends EventTarget {
7951
7961
  if (rects.length) {
7952
7962
  this.dispatchEvent(new CustomEvent("paint", { detail: { rects } }));
7953
7963
  }
7964
+ return resized || rects.length > 0;
7954
7965
  }
7955
7966
  // --- the byte stream -------------------------------------------------------------
7956
7967
  #feed(bytes) {
@@ -9799,7 +9810,7 @@ async function runWindow(argv) {
9799
9810
  }
9800
9811
  }, 400);
9801
9812
  }
9802
- await application.whenReady();
9813
+ await application.whenReady({ interval: 100 });
9803
9814
  }
9804
9815
 
9805
9816
  // src/cli/generated/viewer-bundle.ts
package/dist/index.d.ts CHANGED
@@ -1,13 +1,255 @@
1
1
  /**
2
- * The vocabulary every host of this stack shares.
3
- *
4
- * Deliberately no protocol engines: a Worker that only needs to know what a
5
- * host roster is should not pull noVNC or an RDP state machine into its
6
- * bundle. The engines live behind `@remotectl/core/protocols`.
7
- */
8
- export * from './shared/connection';
9
- export * from './shared/device';
10
- export * from './shared/hosts';
11
- export * from './shared/icons';
12
- export * from './shared/protocol';
13
- export * from './shared/signals';
2
+ * The vocabulary both halves of the gateway share.
3
+ *
4
+ * The Worker and the browser have to agree on what a "protocol" is, what ports
5
+ * they default to and how an RDP security layer is named, so those live here
6
+ * rather than being re-declared on each side and drifting apart.
7
+ */
8
+ /** A remote-desktop protocol the session workspace can display. */
9
+ export declare const REMOTE_PROTOCOLS: readonly ['vnc', 'rdp'];
10
+ export type RemoteProtocol = (typeof REMOTE_PROTOCOLS)[number];
11
+ /** Every protocol the gateway relays, including the terminal side panel. */
12
+ export declare const TRANSPORT_PROTOCOLS: readonly ['vnc', 'rdp', 'ssh'];
13
+ export type TransportProtocol = (typeof TRANSPORT_PROTOCOLS)[number];
14
+ /**
15
+ * The RDP security layer. `auto` negotiates with the host, which is right for
16
+ * anything that answers honestly; the rest are for hosts that do not.
17
+ */
18
+ export declare const RDP_SECURITY_MODES: readonly ['auto', 'nla', 'tls', 'rdp'];
19
+ export type RdpSecurity = (typeof RDP_SECURITY_MODES)[number];
20
+ export declare const DEFAULT_PORTS: Record<TransportProtocol, number>;
21
+ export declare const DEFAULT_SSH_PORT: number;
22
+ /** Max time allowed before command start output is detected. */
23
+ export declare const COMMAND_START_MS = 15000;
24
+ /** Max idle silence allowed during command execution. */
25
+ export declare const COMMAND_IDLE_MS: number;
26
+ export declare function isRemoteProtocol(value: unknown): value is RemoteProtocol;
27
+ export declare function isRdpSecurity(value: unknown): value is RdpSecurity;
28
+ /** Coerce anything to a protocol, falling back to what the caller opens on. */
29
+ export declare function toRemoteProtocol(value: unknown, fallback?: RemoteProtocol): RemoteProtocol;
30
+ export declare function toRdpSecurity(value: unknown, fallback?: RdpSecurity): RdpSecurity;
31
+ /** A port number, or the protocol's default when the value is not one. */
32
+ export declare function toPort(value: unknown, fallback: number): number;
33
+ /** A published Windows application launched instead of the full desktop. */
34
+ export interface RemoteAppLaunch {
35
+ /** Alias (`||notepad`) or an executable path. */
36
+ program: string;
37
+ workingDir?: string;
38
+ arguments?: string;
39
+ }
40
+ /** The companion terminal offered beside a desktop. */
41
+ export interface SshCompanion {
42
+ enabled: boolean;
43
+ port: number;
44
+ username: string;
45
+ }
46
+ /** Picture and input options. VNC negotiates them; RDP and SSH ignore what does not apply. */
47
+ export interface DisplaySettings {
48
+ /** RFB quality level, 1 (smallest) to 9 (sharpest). */
49
+ quality: number;
50
+ /** RFB compression level, 0 (fastest) to 9 (smallest). */
51
+ compression: number;
52
+ /** Fit the remote desktop to the pane rather than scrolling it. */
53
+ scaling: boolean;
54
+ /** Watch without sending keyboard or pointer input. */
55
+ viewOnly: boolean;
56
+ }
57
+ /**
58
+ * Everything a session needs. `password` is the only field never persisted
59
+ * anywhere -- not in the device library on the gateway, not in localStorage.
60
+ */
61
+ export interface ConnectionSettings {
62
+ /** Stable identity: protocol, address, port and program. See {@link connectionId}. */
63
+ id: string;
64
+ label: string;
65
+ protocol: RemoteProtocol;
66
+ host: string;
67
+ port: number;
68
+ username: string;
69
+ password: string;
70
+ /** Windows domain or computer name. RDP only. */
71
+ domain: string;
72
+ security: RdpSecurity;
73
+ remoteApp: RemoteAppLaunch | null;
74
+ display: DisplaySettings;
75
+ ssh: SshCompanion;
76
+ /** Open the terminal panel as soon as the desktop appears. */
77
+ openSshOnConnect: boolean;
78
+ }
79
+ export declare const DEFAULT_DISPLAY_SETTINGS: DisplaySettings;
80
+ /**
81
+ * A connection's identity is what it points at, not when it was made. Editing
82
+ * the address therefore makes a different connection rather than silently
83
+ * repointing an existing card, which is the behaviour people expect from a
84
+ * list of machines.
85
+ */
86
+ export declare function connectionId(input: Pick<ConnectionSettings, 'protocol' | 'host' | 'port'> & {
87
+ remoteApp?: RemoteAppLaunch | null;
88
+ }): string;
89
+ /** A blank connection, ready for the dialog to fill in. */
90
+ export declare function emptyConnection(protocol?: RemoteProtocol): ConnectionSettings;
91
+ export declare function normalizeDisplaySettings(value: unknown): DisplaySettings;
92
+ /**
93
+ * Build a complete, valid connection out of whatever a caller happens to have.
94
+ * Partial input from a saved card, a host list entry, a URL or localStorage all
95
+ * arrive here, so the dialog never has to reason about missing fields.
96
+ */
97
+ export declare function normalizeConnection(input: Partial<ConnectionSettings> & Record<string, unknown>): ConnectionSettings;
98
+ /** What a connection is worth remembering by -- never the password. */
99
+ export type PersistedConnection = Omit<ConnectionSettings, 'password'>;
100
+ export declare function withoutPassword(settings: ConnectionSettings): PersistedConnection;
101
+ /** A one-line description for the dialog's summary row and the status bar. */
102
+ export declare function describeConnection(settings: ConnectionSettings): string;
103
+ export interface SavedDevice {
104
+ id: string;
105
+ label: string;
106
+ host: string;
107
+ port: number;
108
+ protocol: RemoteProtocol;
109
+ domain?: string;
110
+ security?: RdpSecurity;
111
+ /** RemoteApp alias (`||notepad`) when this card launches an app, not a desktop. */
112
+ program?: string;
113
+ favorite?: boolean;
114
+ /** Milliseconds since the epoch; drives the "recent" ordering. */
115
+ lastUsed?: number;
116
+ createdAt?: number;
117
+ /** Set when a thumbnail exists, so the client can cache-bust its <img>. */
118
+ thumbnailAt?: number;
119
+ }
120
+ /** Optional SSH access to the same machine, which publishes a terminal for it. */
121
+ export interface HostSshAccess {
122
+ port: number;
123
+ username?: string;
124
+ }
125
+ /** One machine as the gateway's configuration describes it. */
126
+ export interface RemoteHostTarget {
127
+ id: string;
128
+ name: string;
129
+ host: string;
130
+ port: number;
131
+ protocol: RemoteProtocol;
132
+ /** Windows domain or computer name pre-filled in the connect dialog. */
133
+ domain?: string;
134
+ security?: RdpSecurity;
135
+ remoteApp?: RemoteAppLaunch;
136
+ ssh?: HostSshAccess;
137
+ }
138
+ /**
139
+ * Build the target list offered in the connect dialog. `VNC_HOSTS` and
140
+ * `RDP_HOSTS` are merged into one list; each entry may override its protocol,
141
+ * so a single list can carry both kinds of target.
142
+ */
143
+ export declare function parseConfiguredHosts(options: {
144
+ vncHostsJson?: string;
145
+ rdpHostsJson?: string;
146
+ defaultHost?: string;
147
+ defaultPort?: string;
148
+ defaultRdpHost?: string;
149
+ defaultRdpPort?: string;
150
+ }): RemoteHostTarget[];
151
+ /** One allowed network, as a base address and a mask. */
152
+ export interface Subnet {
153
+ base: number;
154
+ mask: number;
155
+ }
156
+ /** Dotted-quad to a 32-bit number, or null for anything that is not one. */
157
+ export declare function ipv4ToInt(value: string): number | null;
158
+ /**
159
+ * The networks this gateway may dial, beyond the machines named in the host
160
+ * lists. Written as `ALLOWED_SUBNETS`, comma-separated:
161
+ *
162
+ * 192.168.8.0/24 a CIDR block
163
+ * 192.168.8.* the same thing, written the way people say it
164
+ * 192.168.8.67 a single address
165
+ *
166
+ * This is what lets a terminal open on a machine that was never listed. Keep it
167
+ * to networks you own: anything inside one can be reached on any port by anyone
168
+ * who gets past the gateway's login.
169
+ */
170
+ export declare function parseAllowedSubnets(value?: string): Subnet[];
171
+ /** Whether a dotted-quad address falls inside one of the allowed networks. */
172
+ export declare function hostInAllowedSubnets(host: string, value?: string): boolean;
173
+ /**
174
+ * Icon path data, shared by the server-rendered login page and the React app.
175
+ *
176
+ * Each value is the inside of a 24x24 stroked `<svg>`; the wrapper differs
177
+ * between the two (a string on the Worker, a component in the browser) but the
178
+ * geometry should not.
179
+ */
180
+ export declare const ICON_PATHS: {
181
+ readonly monitor: '<rect x="2" y="3" width="20" height="14" rx="2"/><path d="M8 21h8M12 17v4"/>';
182
+ readonly link: '<path d="M9 17H7A5 5 0 0 1 7 7h2M15 7h2a5 5 0 1 1 0 10h-2M8 12h8"/>';
183
+ readonly power: '<path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.8 0"/>';
184
+ readonly maximize: '<path d="M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M16 21h3a2 2 0 0 0 2-2v-3"/>';
185
+ readonly minimize: '<path d="M8 3v3a2 2 0 0 1-2 2H3M21 8h-3a2 2 0 0 1-2-2V3M3 16h3a2 2 0 0 1 2 2v3M16 21v-3a2 2 0 0 1 2-2h3"/>';
186
+ readonly keyboard: '<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"/>';
187
+ readonly clipboard: '<rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>';
188
+ readonly check: '<path d="m5 13 4 4 10-10"/>';
189
+ readonly camera: '<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z"/><circle cx="12" cy="13" r="3"/>';
190
+ readonly eye: '<path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>';
191
+ readonly sliders: '<path d="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M2 14h4M10 8h4M18 16h4"/>';
192
+ readonly expand: '<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>';
193
+ readonly shield: '<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>';
194
+ readonly chevron: '<path d="m6 9 6 6 6-6"/>';
195
+ readonly back: '<path d="m15 18-6-6 6-6"/>';
196
+ readonly zap: '<path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z"/>';
197
+ readonly cube: '<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><path d="m3.3 7 8.7 5 8.7-5M12 22V12"/>';
198
+ readonly logout: '<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9"/>';
199
+ readonly clock: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3.5 2"/>';
200
+ readonly activity: '<path d="M22 12h-4l-3 9L9 3l-3 9H2"/>';
201
+ readonly transfer: '<path d="m3 16 4 4 4-4M7 20V4M21 8l-4-4-4 4M17 4v16"/>';
202
+ readonly screen: '<rect x="2" y="5" width="20" height="13" rx="2"/><path d="M7 21h10"/>';
203
+ readonly command: '<path d="M15 6a3 3 0 1 1 3 3h-3zm0 0v12m0 0a3 3 0 1 0 3-3h-3zM9 6a3 3 0 1 0-3 3h3zm0 0v12m0 0a3 3 0 1 1-3-3h3z"/>';
204
+ readonly apps: '<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/>';
205
+ readonly terminal: '<path d="m4 17 6-6-6-6M12 19h8"/>';
206
+ readonly folder: '<path d="M3 7h6l2 2h10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M3 7V6a2 2 0 0 1 2-2h4l2 3"/>';
207
+ readonly close: '<path d="M18 6 6 18M6 6l12 12"/>';
208
+ readonly sparkles: '<path d="m12 3 1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"/><path d="m19 15 .8 2.2 2.2.8-2.2.8L19 21l-.8-2.2-2.2-.8 2.2-.8z"/>';
209
+ readonly broom: '<path d="M10 10V4a2 2 0 0 1 4 0v6"/><path d="M6 10h12a2 2 0 0 1 2 2v2H4v-2a2 2 0 0 1 2-2Z"/><path d="m5 14-2 7h18l-2-7M9 18l-1 3M15 18l1 3"/>';
210
+ readonly panel: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M14 4v16"/>';
211
+ readonly menu: '<path d="M4 7h16M4 12h16M4 17h16"/>';
212
+ readonly plus: '<path d="M12 5v14M5 12h14"/>';
213
+ readonly star: '<path d="m12 3 2.9 5.9 6.5.9-4.7 4.6 1.1 6.5L12 17.8 6.2 20.9l1.1-6.5L2.6 9.8l6.5-.9L12 3z"/>';
214
+ readonly trash: '<path d="M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/>';
215
+ };
216
+ export type IconName = keyof typeof ICON_PATHS;
217
+ /** The tab icon: a monitor in Cloudflare orange. */
218
+ export declare const FAVICON_DATA_URI = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f38020' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='14' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4'/%3E%3C/svg%3E";
219
+ /**
220
+ * Control frames the browser and the gateway exchange on the WebSocket that
221
+ * carries a remote-desktop stream.
222
+ *
223
+ * They are plain strings precisely so they can never be confused with the
224
+ * binary protocol payload flowing in either direction, and both sides import
225
+ * these same literals so the two halves cannot drift apart.
226
+ */
227
+ /** Browser -> gateway: "my WebSocket is open, you may start reading the host". */
228
+ export declare const GATEWAY_READY_SIGNAL = "VNC_GATEWAY_READY_v1";
229
+ /**
230
+ * Browser -> gateway: keep the edge from idling out a silent session.
231
+ * Cloudflare closes a WebSocket with no traffic in either direction for 100s,
232
+ * and an untouched desktop transmits nothing at all.
233
+ */
234
+ export declare const GATEWAY_KEEPALIVE_SIGNAL = "VNC_GATEWAY_KEEPALIVE_v1";
235
+ /**
236
+ * How often the browser nudges the transport. Well inside the edge's 100s
237
+ * window, so a session that is merely being looked at is never torn down
238
+ * without a close frame -- which is what a bare WebSocket 1006 used to mean.
239
+ */
240
+ export declare const KEEPALIVE_INTERVAL_MS = 25000;
241
+ export declare const MAX_CLOSE_REASON_BYTES = 123;
242
+ /** Whether a live desktop ended for a transient transport reason worth retrying. */
243
+ export declare function isRetryableDisconnect(diagnostic: {
244
+ close: {
245
+ code: number;
246
+ reason: string;
247
+ } | null;
248
+ established: boolean;
249
+ }): boolean;
250
+ /** WebSocket close reasons are capped at 123 bytes; trim without splitting a code point. */
251
+ export declare function websocketCloseReason(reason: string): string;
252
+ /** 1005/1006/1015 are reserved and cannot be transmitted in a close frame. */
253
+ export declare function sendableCloseCode(code: number): number;
254
+ /** Normalize any WebSocket message payload to bytes. */
255
+ export declare function messageToBytes(data: unknown): Promise<Uint8Array | null>;