ai-remote 0.4.2 → 0.4.4

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 (75) hide show
  1. package/dist/index.js +1 -6
  2. package/dist/{protocols/index.d.ts → protocols.d.ts} +2 -0
  3. package/dist/protocols.js +24 -0
  4. package/package.json +15 -10
  5. package/dist/protocols/index.js +0 -34
  6. package/dist/protocols/rdp/buffer.d.ts +0 -38
  7. package/dist/protocols/rdp/buffer.js +0 -169
  8. package/dist/protocols/rdp/caps.d.ts +0 -49
  9. package/dist/protocols/rdp/caps.js +0 -259
  10. package/dist/protocols/rdp/cert.d.ts +0 -18
  11. package/dist/protocols/rdp/cert.js +0 -134
  12. package/dist/protocols/rdp/client.d.ts +0 -56
  13. package/dist/protocols/rdp/client.js +0 -1069
  14. package/dist/protocols/rdp/cliprdr.d.ts +0 -27
  15. package/dist/protocols/rdp/cliprdr.js +0 -239
  16. package/dist/protocols/rdp/credssp.d.ts +0 -34
  17. package/dist/protocols/rdp/credssp.js +0 -253
  18. package/dist/protocols/rdp/crypto.d.ts +0 -63
  19. package/dist/protocols/rdp/crypto.js +0 -368
  20. package/dist/protocols/rdp/display.d.ts +0 -38
  21. package/dist/protocols/rdp/display.js +0 -588
  22. package/dist/protocols/rdp/gcc.d.ts +0 -23
  23. package/dist/protocols/rdp/gcc.js +0 -131
  24. package/dist/protocols/rdp/keymap.d.ts +0 -9
  25. package/dist/protocols/rdp/keymap.js +0 -131
  26. package/dist/protocols/rdp/mcs.d.ts +0 -40
  27. package/dist/protocols/rdp/mcs.js +0 -222
  28. package/dist/protocols/rdp/ntlm.d.ts +0 -61
  29. package/dist/protocols/rdp/ntlm.js +0 -304
  30. package/dist/protocols/rdp/pdu.d.ts +0 -155
  31. package/dist/protocols/rdp/pdu.js +0 -443
  32. package/dist/protocols/rdp/rail.d.ts +0 -119
  33. package/dist/protocols/rdp/rail.js +0 -382
  34. package/dist/protocols/rdp/rle.d.ts +0 -13
  35. package/dist/protocols/rdp/rle.js +0 -275
  36. package/dist/protocols/rdp/sec.d.ts +0 -59
  37. package/dist/protocols/rdp/sec.js +0 -155
  38. package/dist/protocols/rdp/session.d.ts +0 -62
  39. package/dist/protocols/rdp/session.js +0 -306
  40. package/dist/protocols/rdp/tls.d.ts +0 -18
  41. package/dist/protocols/rdp/tls.js +0 -353
  42. package/dist/protocols/rdp/vchannel.d.ts +0 -28
  43. package/dist/protocols/rdp/vchannel.js +0 -58
  44. package/dist/protocols/rdp/x224.d.ts +0 -40
  45. package/dist/protocols/rdp/x224.js +0 -109
  46. package/dist/protocols/ssh/kex.d.ts +0 -97
  47. package/dist/protocols/ssh/kex.js +0 -176
  48. package/dist/protocols/ssh/messages.d.ts +0 -50
  49. package/dist/protocols/ssh/messages.js +0 -54
  50. package/dist/protocols/ssh/session.d.ts +0 -66
  51. package/dist/protocols/ssh/session.js +0 -608
  52. package/dist/protocols/ssh/terminal.d.ts +0 -46
  53. package/dist/protocols/ssh/terminal.js +0 -190
  54. package/dist/protocols/ssh/transport.d.ts +0 -62
  55. package/dist/protocols/ssh/transport.js +0 -612
  56. package/dist/protocols/ssh/wire.d.ts +0 -52
  57. package/dist/protocols/ssh/wire.js +0 -188
  58. package/dist/protocols/types.d.ts +0 -127
  59. package/dist/protocols/types.js +0 -0
  60. package/dist/protocols/vnc/input.d.ts +0 -5
  61. package/dist/protocols/vnc/input.js +0 -15
  62. package/dist/protocols/vnc/session.d.ts +0 -12
  63. package/dist/protocols/vnc/session.js +0 -258
  64. package/dist/shared/connection.d.ts +0 -81
  65. package/dist/shared/connection.js +0 -113
  66. package/dist/shared/device.d.ts +0 -26
  67. package/dist/shared/device.js +0 -0
  68. package/dist/shared/hosts.d.ts +0 -63
  69. package/dist/shared/hosts.js +0 -132
  70. package/dist/shared/icons.d.ts +0 -46
  71. package/dist/shared/icons.js +0 -41
  72. package/dist/shared/protocol.d.ts +0 -28
  73. package/dist/shared/protocol.js +0 -39
  74. package/dist/shared/signals.d.ts +0 -37
  75. package/dist/shared/signals.js +0 -41
@@ -1,443 +0,0 @@
1
- import { Reader, Writer } from "./buffer.js";
2
- const PDU_TYPE = {
3
- DEMAND_ACTIVE: 1,
4
- CONFIRM_ACTIVE: 3,
5
- DEACTIVATE_ALL: 6,
6
- DATA: 7,
7
- SERVER_REDIRECT: 10
8
- };
9
- const PDU_TYPE2 = {
10
- UPDATE: 2,
11
- CONTROL: 20,
12
- POINTER: 27,
13
- INPUT: 28,
14
- SYNCHRONIZE: 31,
15
- REFRESH_RECT: 33,
16
- PLAY_SOUND: 34,
17
- SUPPRESS_OUTPUT: 35,
18
- SHUTDOWN_REQUEST: 36,
19
- SHUTDOWN_DENIED: 37,
20
- SAVE_SESSION_INFO: 38,
21
- FONT_LIST: 39,
22
- FONT_MAP: 40,
23
- SET_ERROR_INFO: 47,
24
- MONITOR_LAYOUT: 55
25
- };
26
- const UPDATE_TYPE = {
27
- ORDERS: 0,
28
- BITMAP: 1,
29
- PALETTE: 2,
30
- SYNCHRONIZE: 3
31
- };
32
- const CONTROL_ACTION = {
33
- REQUEST_CONTROL: 1,
34
- GRANTED_CONTROL: 2,
35
- DETACH: 3,
36
- COOPERATE: 4
37
- };
38
- const INPUT_EVENT = {
39
- SYNC: 0,
40
- SCANCODE: 4,
41
- UNICODE: 5,
42
- MOUSE: 32769,
43
- MOUSEX: 32770
44
- };
45
- const KEYBOARD_FLAG = {
46
- EXTENDED: 256,
47
- DOWN: 16384,
48
- RELEASE: 32768
49
- };
50
- const POINTER_FLAG = {
51
- WHEEL: 512,
52
- HWHEEL: 1024,
53
- WHEEL_NEGATIVE: 256,
54
- MOVE: 2048,
55
- DOWN: 32768,
56
- BUTTON1: 4096,
57
- BUTTON2: 8192,
58
- BUTTON3: 16384
59
- };
60
- function pointerWheelFlags(delta, horizontal = false) {
61
- const steps = horizontal ? Math.sign(delta) : -Math.sign(delta);
62
- if (steps === 0) return 0;
63
- const wheelFlag = horizontal ? POINTER_FLAG.HWHEEL : POINTER_FLAG.WHEEL;
64
- const rotation = 120;
65
- return steps > 0 ? wheelFlag | rotation : wheelFlag | POINTER_FLAG.WHEEL_NEGATIVE | -rotation & 255;
66
- }
67
- const TOGGLE_FLAG = {
68
- SCROLL_LOCK: 1,
69
- NUM_LOCK: 2,
70
- CAPS_LOCK: 4,
71
- KANA_LOCK: 8
72
- };
73
- const POINTER_MESSAGE = {
74
- SYSTEM: 1,
75
- POSITION: 3,
76
- COLOR: 6,
77
- CACHED: 7,
78
- POINTER: 8,
79
- LARGE: 9
80
- };
81
- const INFO_FLAG = 1 | // INFO_MOUSE
82
- 2 | // INFO_DISABLECTRLALTDEL
83
- 16 | // INFO_UNICODE
84
- 32 | // INFO_MAXIMIZESHELL
85
- 64 | // INFO_LOGONNOTIFY
86
- 256 | // INFO_ENABLEWINDOWSKEY
87
- 65536 | // INFO_LOGONERRORS
88
- 131072 | // INFO_MOUSE_HAS_WHEEL
89
- 524288;
90
- const INFO_AUTOLOGON = 8;
91
- const INFO_RAIL = 32768;
92
- const ERROR_INFO_MESSAGES = {
93
- 1: "The host disconnected the session (an administrative API call ended it).",
94
- 2: "The host logged the session off.",
95
- 3: "The session was disconnected after being idle too long.",
96
- 4: "The session was disconnected because sign-in took too long.",
97
- 5: "The session was taken over by another connection.",
98
- 6: "The host ran out of memory.",
99
- 7: "The host denied the connection.",
100
- 9: "This account does not have permission to sign in remotely.",
101
- 10: "The host requires fresh credentials.",
102
- 11: "A user on the host ended the session.",
103
- 12: "The remote user signed out.",
104
- 256: "Remote Desktop licensing failed on the host (internal error).",
105
- 257: "The host could not reach a Remote Desktop licensing server.",
106
- 258: "The host has no Remote Desktop licence available for this client.",
107
- 259: "The host rejected this client during licensing.",
108
- 260: "The stored Remote Desktop licence does not match this client.",
109
- 261: "The host rejected the client licence.",
110
- 262: "Remote Desktop licensing could not be completed.",
111
- 263: "The client ended the licensing exchange.",
112
- 264: "The host rejected the client licence encryption.",
113
- 265: "The host could not upgrade the client licence.",
114
- 266: "The host does not accept remote connections.",
115
- 4345: "The host rejected a malformed capability set from this client.",
116
- 4346: "The host rejected the client capability exchange."
117
- };
118
- function errorInfoMessage(errorInfo) {
119
- return ERROR_INFO_MESSAGES[errorInfo] || `The host ended the session with error info 0x${errorInfo.toString(16).padStart(8, "0")}.`;
120
- }
121
- function shareControlPdu(pduType, userId, payload) {
122
- const writer = new Writer(payload.length + 6);
123
- writer.u16le(payload.length + 6);
124
- writer.u16le(pduType | 16);
125
- writer.u16le(userId);
126
- writer.raw(payload);
127
- return writer.take();
128
- }
129
- function shareDataPdu(shareId, userId, pduType2, payload) {
130
- const writer = new Writer(payload.length + 12);
131
- writer.u32le(shareId);
132
- writer.u8(0);
133
- writer.u8(1);
134
- writer.u16le(payload.length + 18);
135
- writer.u8(pduType2);
136
- writer.u8(0);
137
- writer.u16le(0);
138
- writer.raw(payload);
139
- return shareControlPdu(PDU_TYPE.DATA, userId, writer.take());
140
- }
141
- function unicodeField(writer, text) {
142
- const start = writer.length;
143
- writer.utf16le(text);
144
- const byteLength = writer.length - start;
145
- writer.u16le(0);
146
- return byteLength;
147
- }
148
- function clientInfoPdu({ domain, username, password, performanceFlags, autoLogon, remoteApp = false }) {
149
- const strings = new Writer(512);
150
- const cbDomain = unicodeField(strings, domain || "");
151
- const cbUsername = unicodeField(strings, username || "");
152
- const cbPassword = unicodeField(strings, password || "");
153
- const cbAlternateShell = unicodeField(strings, "");
154
- const cbWorkingDir = unicodeField(strings, "");
155
- const writer = new Writer(768);
156
- writer.u32le(0);
157
- writer.u32le((INFO_FLAG | (autoLogon ? INFO_AUTOLOGON : 0) | (remoteApp ? INFO_RAIL : 0)) >>> 0);
158
- writer.u16le(cbDomain);
159
- writer.u16le(cbUsername);
160
- writer.u16le(cbPassword);
161
- writer.u16le(cbAlternateShell);
162
- writer.u16le(cbWorkingDir);
163
- writer.raw(strings.take());
164
- writer.u16le(2);
165
- writer.u16le(2);
166
- writer.u16le(0);
167
- writer.u16le(2);
168
- writer.u16le(0);
169
- writer.zeros(172);
170
- writer.u32le(0);
171
- writer.u32le(performanceFlags >>> 0);
172
- writer.u16le(0);
173
- return writer.take();
174
- }
175
- function synchronizePdu(targetUser) {
176
- const writer = new Writer(4);
177
- writer.u16le(1);
178
- writer.u16le(targetUser);
179
- return writer.take();
180
- }
181
- function controlPdu(action) {
182
- const writer = new Writer(8);
183
- writer.u16le(action);
184
- writer.u16le(0);
185
- writer.u32le(0);
186
- return writer.take();
187
- }
188
- function fontListPdu() {
189
- const writer = new Writer(8);
190
- writer.u16le(0);
191
- writer.u16le(0);
192
- writer.u16le(3);
193
- writer.u16le(50);
194
- return writer.take();
195
- }
196
- function confirmActivePdu(shareId, capabilities, capabilityCount) {
197
- const sourceDescriptor = new TextEncoder().encode("MSTSC\0");
198
- const writer = new Writer(capabilities.length + 32);
199
- writer.u32le(shareId);
200
- writer.u16le(1002);
201
- writer.u16le(sourceDescriptor.length);
202
- writer.u16le(capabilities.length + 4);
203
- writer.raw(sourceDescriptor);
204
- writer.u16le(capabilityCount);
205
- writer.u16le(0);
206
- writer.raw(capabilities);
207
- return writer.take();
208
- }
209
- function inputEventsPdu(events) {
210
- const writer = new Writer(events.length * 12 + 4);
211
- writer.u16le(events.length);
212
- writer.u16le(0);
213
- for (const event of events) writer.raw(event);
214
- return writer.take();
215
- }
216
- function inputEvent(messageType, write) {
217
- const writer = new Writer(12);
218
- writer.u32le(0);
219
- writer.u16le(messageType);
220
- write(writer);
221
- return writer.take();
222
- }
223
- function scancodeEvent(scancode, pressed, extended) {
224
- return inputEvent(INPUT_EVENT.SCANCODE, (writer) => {
225
- writer.u16le(
226
- (pressed ? KEYBOARD_FLAG.DOWN : KEYBOARD_FLAG.RELEASE) | (extended ? KEYBOARD_FLAG.EXTENDED : 0)
227
- );
228
- writer.u16le(scancode);
229
- writer.u16le(0);
230
- });
231
- }
232
- function unicodeEvent(codeUnit, pressed) {
233
- return inputEvent(INPUT_EVENT.UNICODE, (writer) => {
234
- writer.u16le(pressed ? KEYBOARD_FLAG.DOWN : KEYBOARD_FLAG.RELEASE);
235
- writer.u16le(codeUnit);
236
- writer.u16le(0);
237
- });
238
- }
239
- function mouseEvent(flags, x, y) {
240
- return inputEvent(INPUT_EVENT.MOUSE, (writer) => {
241
- writer.u16le(flags);
242
- writer.u16le(Math.max(0, Math.min(65535, Math.round(x))));
243
- writer.u16le(Math.max(0, Math.min(65535, Math.round(y))));
244
- });
245
- }
246
- function extendedMouseEvent(flags, x, y) {
247
- return inputEvent(INPUT_EVENT.MOUSEX, (writer) => {
248
- writer.u16le(flags);
249
- writer.u16le(Math.max(0, Math.min(65535, Math.round(x))));
250
- writer.u16le(Math.max(0, Math.min(65535, Math.round(y))));
251
- });
252
- }
253
- function syncEvent(toggleFlags) {
254
- return inputEvent(INPUT_EVENT.SYNC, (writer) => {
255
- writer.u16le(0);
256
- writer.u32le(toggleFlags >>> 0);
257
- });
258
- }
259
- function refreshRectPdu(rects) {
260
- const writer = new Writer(4 + rects.length * 8);
261
- writer.u8(rects.length);
262
- writer.zeros(3);
263
- for (const rect of rects) {
264
- writer.u16le(rect.left);
265
- writer.u16le(rect.top);
266
- writer.u16le(rect.right);
267
- writer.u16le(rect.bottom);
268
- }
269
- return writer.take();
270
- }
271
- function suppressOutputPdu(allowDisplayUpdates, rect) {
272
- const writer = new Writer(12);
273
- writer.u8(allowDisplayUpdates ? 1 : 0);
274
- writer.zeros(3);
275
- if (allowDisplayUpdates && rect) {
276
- writer.u16le(rect.left);
277
- writer.u16le(rect.top);
278
- writer.u16le(rect.right);
279
- writer.u16le(rect.bottom);
280
- }
281
- return writer.take();
282
- }
283
- function parseShareControlHeader(bytes) {
284
- const reader = new Reader(bytes);
285
- const totalLength = reader.u16le();
286
- const typeAndVersion = reader.u16le();
287
- const pduSource = reader.u16le();
288
- return {
289
- totalLength,
290
- pduType: typeAndVersion & 15,
291
- pduSource,
292
- payload: reader.rest().subarray(0, Math.max(0, totalLength - 6))
293
- };
294
- }
295
- function parseShareDataHeader(bytes) {
296
- const reader = new Reader(bytes);
297
- const shareId = reader.u32le();
298
- reader.u8();
299
- reader.u8();
300
- reader.u16le();
301
- const pduType2 = reader.u8();
302
- const compressedType = reader.u8();
303
- const compressedLength = reader.u16le();
304
- return { shareId, pduType2, compressedType, compressedLength, payload: reader.rest() };
305
- }
306
- function parseDemandActive(bytes) {
307
- const reader = new Reader(bytes);
308
- const shareId = reader.u32le();
309
- const lengthSourceDescriptor = reader.u16le();
310
- const lengthCombinedCapabilities = reader.u16le();
311
- reader.skip(lengthSourceDescriptor);
312
- const capabilities = reader.raw(Math.min(lengthCombinedCapabilities, reader.remaining));
313
- return { shareId, capabilities };
314
- }
315
- const BITMAP_COMPRESSION = 1;
316
- const NO_BITMAP_COMPRESSION_HDR = 1024;
317
- function parseBitmapUpdate(reader) {
318
- const count = reader.u16le();
319
- const rects = [];
320
- for (let i = 0; i < count && reader.remaining >= 18; i++) {
321
- const left = reader.u16le();
322
- const top = reader.u16le();
323
- const right = reader.u16le();
324
- const bottom = reader.u16le();
325
- const width = reader.u16le();
326
- const height = reader.u16le();
327
- const bitsPerPixel = reader.u16le();
328
- const flags = reader.u16le();
329
- let bitmapLength = reader.u16le();
330
- const compressed = Boolean(flags & BITMAP_COMPRESSION);
331
- if (compressed && !(flags & NO_BITMAP_COMPRESSION_HDR)) {
332
- reader.u16le();
333
- const mainBodySize = reader.u16le();
334
- reader.u16le();
335
- reader.u16le();
336
- bitmapLength = mainBodySize;
337
- }
338
- rects.push({
339
- left,
340
- top,
341
- right,
342
- bottom,
343
- width,
344
- height,
345
- bitsPerPixel,
346
- compressed,
347
- data: reader.raw(Math.min(bitmapLength, reader.remaining))
348
- });
349
- }
350
- return rects;
351
- }
352
- function parsePaletteUpdate(reader) {
353
- reader.u16le();
354
- reader.u16le();
355
- const count = reader.u32le();
356
- const palette = new Uint8Array(256 * 3);
357
- for (let i = 0; i < count && i < 256 && reader.remaining >= 3; i++) {
358
- palette[i * 3] = reader.u8();
359
- palette[i * 3 + 1] = reader.u8();
360
- palette[i * 3 + 2] = reader.u8();
361
- }
362
- return palette;
363
- }
364
- function parseColorPointer(reader, xorBpp) {
365
- const cacheIndex = reader.u16le();
366
- const hotSpotX = reader.u16le();
367
- const hotSpotY = reader.u16le();
368
- const width = reader.u16le();
369
- const height = reader.u16le();
370
- const andMaskLength = reader.u16le();
371
- const xorMaskLength = reader.u16le();
372
- const xorMask = reader.raw(Math.min(xorMaskLength, reader.remaining)).slice();
373
- const andMask = reader.raw(Math.min(andMaskLength, reader.remaining)).slice();
374
- return {
375
- kind: "bitmap",
376
- cacheIndex,
377
- hotSpotX,
378
- hotSpotY,
379
- width,
380
- height,
381
- xorBpp: xorBpp || 24,
382
- xorMask,
383
- andMask
384
- };
385
- }
386
- function parsePointerUpdate(reader) {
387
- const messageType = reader.u16le();
388
- reader.u16le();
389
- if (messageType === POINTER_MESSAGE.POSITION) {
390
- return { kind: "position", x: reader.u16le(), y: reader.u16le() };
391
- }
392
- if (messageType === POINTER_MESSAGE.SYSTEM) {
393
- const systemPointerType = reader.u32le();
394
- return { kind: "system", hidden: systemPointerType === 0 };
395
- }
396
- if (messageType === POINTER_MESSAGE.CACHED) {
397
- return { kind: "cached", cacheIndex: reader.u16le() };
398
- }
399
- if (messageType === POINTER_MESSAGE.COLOR) {
400
- return parseColorPointer(reader, 24);
401
- }
402
- if (messageType === POINTER_MESSAGE.POINTER) {
403
- const xorBpp = reader.u16le();
404
- return parseColorPointer(reader, xorBpp);
405
- }
406
- if (messageType === POINTER_MESSAGE.LARGE) {
407
- return { kind: "unsupported", messageType };
408
- }
409
- return { kind: "unsupported", messageType };
410
- }
411
- export {
412
- CONTROL_ACTION,
413
- INPUT_EVENT,
414
- KEYBOARD_FLAG,
415
- PDU_TYPE,
416
- PDU_TYPE2,
417
- POINTER_FLAG,
418
- TOGGLE_FLAG,
419
- UPDATE_TYPE,
420
- clientInfoPdu,
421
- confirmActivePdu,
422
- controlPdu,
423
- errorInfoMessage,
424
- extendedMouseEvent,
425
- fontListPdu,
426
- inputEventsPdu,
427
- mouseEvent,
428
- parseBitmapUpdate,
429
- parseDemandActive,
430
- parsePaletteUpdate,
431
- parsePointerUpdate,
432
- parseShareControlHeader,
433
- parseShareDataHeader,
434
- pointerWheelFlags,
435
- refreshRectPdu,
436
- scancodeEvent,
437
- shareControlPdu,
438
- shareDataPdu,
439
- suppressOutputPdu,
440
- syncEvent,
441
- synchronizePdu,
442
- unicodeEvent
443
- };
@@ -1,119 +0,0 @@
1
- import { Reader } from './buffer';
2
- export declare const RAIL_ORDER: {
3
- EXEC: number;
4
- ACTIVATE: number;
5
- SYSPARAM: number;
6
- SYSCOMMAND: number;
7
- HANDSHAKE: number;
8
- WINDOW_MOVE: number;
9
- CLIENT_STATUS: number;
10
- EXEC_RESULT: number;
11
- HANDSHAKE_EX: number;
12
- };
13
- export declare const RAIL_EXEC_RESULT: {
14
- 0: string;
15
- 1: string;
16
- 2: string;
17
- 3: string;
18
- 5: string;
19
- 6: string;
20
- 7: string;
21
- };
22
- /** WM_SYSCOMMAND values a RAIL client may ask the host to apply to a window. */
23
- export declare const SYS_COMMAND: {
24
- MINIMIZE: number;
25
- MAXIMIZE: number;
26
- CLOSE: number;
27
- RESTORE: number;
28
- };
29
- /** SW_* show states reported by a window order's ShowState field. */
30
- export declare const SHOW_STATE: {
31
- HIDDEN: number;
32
- MINIMIZED: number;
33
- MAXIMIZED: number;
34
- NORMAL: number;
35
- };
36
- export declare const WINDOW_ORDER: {
37
- TYPE_WINDOW: number;
38
- STATE_NEW: number;
39
- STATE_DELETED: number;
40
- ICON: number;
41
- CACHED_ICON: number;
42
- };
43
- export declare function railHandshake(buildNumber?: number): Uint8Array<ArrayBufferLike>;
44
- export declare function railClientStatus(flags?: number): Uint8Array<ArrayBufferLike>;
45
- /**
46
- * SPI_SETWORKAREA. This is how a RAIL client tells the host how much room it
47
- * has, and the host maximizes remote windows into it. Sending it again during
48
- * the session is what keeps a maximized window matched to the browser window.
49
- */
50
- export declare function railWorkArea(width: number, height: number): Uint8Array<ArrayBufferLike>;
51
- export declare function railSystemParameters(width: number, height: number): Uint8Array<ArrayBufferLike>[];
52
- /** TS_RAIL_ORDER_ACTIVATE: give (or take) input focus for one remote window. */
53
- export declare function railActivate(windowId: number, enabled?: boolean): Uint8Array<ArrayBufferLike>;
54
- /** TS_RAIL_ORDER_SYSCOMMAND: minimize, maximize, restore or close a window. */
55
- export declare function railSysCommand(windowId: number, command: string): Uint8Array<ArrayBufferLike>;
56
- /**
57
- * TS_RAIL_ORDER_WINDOWMOVE. A client that draws remote windows itself sends
58
- * this when the user finishes moving or resizing one; the host then applies
59
- * the rectangle to the real window. It is the only way to give a remote window
60
- * an exact size, which is what fitting one to the browser viewport needs.
61
- */
62
- export declare function railWindowMove(windowId: number, { left, top, right, bottom }: {
63
- bottom: any;
64
- left: any;
65
- right: any;
66
- top: any;
67
- }): Uint8Array<ArrayBufferLike>;
68
- /** Build TS_RAIL_ORDER_EXEC. Strings are UTF-16LE and are not terminated. */
69
- export declare function railExecute({ program, workingDir, arguments: args }: {
70
- arguments?: string;
71
- program: any;
72
- workingDir?: string;
73
- }): Uint8Array<ArrayBufferLike>;
74
- /**
75
- * True for a window the session exists to show: not a child, not a tool
76
- * window, and not one of the never-activated popups a Chromium or Electron
77
- * application creates for menus, tooltips and drag images.
78
- */
79
- export declare function isPrimaryWindow(candidate: any): boolean;
80
- /**
81
- * Parse the window lifecycle subset of TS_UPDATE_ORDERS_PDU_DATA.
82
- *
83
- * RemoteApp window orders are Alternate Secondary orders and, unlike ordinary
84
- * drawing orders, carry their total size in every header. That lets the parser
85
- * read the fields it understands and then seek to the next order, rather than
86
- * having to understand every icon, notification and desktop order to stay in
87
- * sync with the stream.
88
- */
89
- export declare function parseRemoteAppWindowOrders(reader: Reader): any[];
90
- /** Parse one or more complete RAIL PDUs delivered in a channel message. */
91
- export declare function parseRailPdus(bytes: Uint8Array): any[];
92
- /**
93
- * Minimal RAIL endpoint for the browser client. It deliberately suppresses
94
- * icon orders because the browser currently presents the RemoteApp session in
95
- * one canvas rather than creating a local OS window per remote window.
96
- */
97
- export declare class RailChannel {
98
- private readonly application;
99
- private width;
100
- private height;
101
- private readonly send;
102
- private readonly onReady;
103
- private readonly onResult;
104
- private started;
105
- constructor({ application, width, height, send, onReady, onResult }: {
106
- application: any;
107
- height: any;
108
- onReady: any;
109
- onResult: any;
110
- send: any;
111
- width: any;
112
- });
113
- receive(bytes: Uint8Array): void;
114
- /** Republish the client's work area, which is what maximize resizes into. */
115
- setWorkArea(width: number, height: number): boolean;
116
- activate(windowId: number): boolean;
117
- sysCommand(windowId: number, command: string): boolean;
118
- moveWindow(windowId: number, rectangle: any): boolean;
119
- }