@denisixnpm/agent-rdp 0.0.1 → 0.7.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.
Files changed (190) hide show
  1. package/CHANGELOG.md +263 -0
  2. package/README.md +525 -0
  3. package/bin/cli.js +61 -0
  4. package/dist/automation.d.ts +199 -0
  5. package/dist/automation.d.ts.map +1 -0
  6. package/dist/automation.js +309 -0
  7. package/dist/automation.js.map +1 -0
  8. package/dist/client.d.ts +45 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +146 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/daemon.d.ts +32 -0
  13. package/dist/daemon.d.ts.map +1 -0
  14. package/dist/daemon.js +175 -0
  15. package/dist/daemon.js.map +1 -0
  16. package/dist/generated/AccessibilityElement.d.ts +47 -0
  17. package/dist/generated/AccessibilityElement.d.ts.map +1 -0
  18. package/dist/generated/AccessibilityElement.js +2 -0
  19. package/dist/generated/AccessibilityElement.js.map +1 -0
  20. package/dist/generated/AccessibilitySnapshot.d.ts +27 -0
  21. package/dist/generated/AccessibilitySnapshot.d.ts.map +1 -0
  22. package/dist/generated/AccessibilitySnapshot.js +2 -0
  23. package/dist/generated/AccessibilitySnapshot.js.map +1 -0
  24. package/dist/generated/AutomateRequest.d.ts +192 -0
  25. package/dist/generated/AutomateRequest.d.ts.map +1 -0
  26. package/dist/generated/AutomateRequest.js +2 -0
  27. package/dist/generated/AutomateRequest.js.map +1 -0
  28. package/dist/generated/AutomationHandshake.d.ts +26 -0
  29. package/dist/generated/AutomationHandshake.d.ts.map +1 -0
  30. package/dist/generated/AutomationHandshake.js +3 -0
  31. package/dist/generated/AutomationHandshake.js.map +1 -0
  32. package/dist/generated/AutomationScrollDirection.d.ts +5 -0
  33. package/dist/generated/AutomationScrollDirection.d.ts.map +1 -0
  34. package/dist/generated/AutomationScrollDirection.js +3 -0
  35. package/dist/generated/AutomationScrollDirection.js.map +1 -0
  36. package/dist/generated/AutomationStatus.d.ts +22 -0
  37. package/dist/generated/AutomationStatus.d.ts.map +1 -0
  38. package/dist/generated/AutomationStatus.js +3 -0
  39. package/dist/generated/AutomationStatus.js.map +1 -0
  40. package/dist/generated/ClickResult.d.ts +22 -0
  41. package/dist/generated/ClickResult.d.ts.map +1 -0
  42. package/dist/generated/ClickResult.js +3 -0
  43. package/dist/generated/ClickResult.js.map +1 -0
  44. package/dist/generated/ClipboardRequest.d.ts +10 -0
  45. package/dist/generated/ClipboardRequest.d.ts.map +1 -0
  46. package/dist/generated/ClipboardRequest.js +3 -0
  47. package/dist/generated/ClipboardRequest.js.map +1 -0
  48. package/dist/generated/ConnectRequest.d.ts +68 -0
  49. package/dist/generated/ConnectRequest.d.ts.map +1 -0
  50. package/dist/generated/ConnectRequest.js +2 -0
  51. package/dist/generated/ConnectRequest.js.map +1 -0
  52. package/dist/generated/ConnectionState.d.ts +5 -0
  53. package/dist/generated/ConnectionState.d.ts.map +1 -0
  54. package/dist/generated/ConnectionState.js +3 -0
  55. package/dist/generated/ConnectionState.js.map +1 -0
  56. package/dist/generated/DriveMapping.d.ts +14 -0
  57. package/dist/generated/DriveMapping.d.ts.map +1 -0
  58. package/dist/generated/DriveMapping.js +3 -0
  59. package/dist/generated/DriveMapping.js.map +1 -0
  60. package/dist/generated/DriveRequest.d.ts +9 -0
  61. package/dist/generated/DriveRequest.d.ts.map +1 -0
  62. package/dist/generated/DriveRequest.js +3 -0
  63. package/dist/generated/DriveRequest.js.map +1 -0
  64. package/dist/generated/ElementBounds.d.ts +10 -0
  65. package/dist/generated/ElementBounds.d.ts.map +1 -0
  66. package/dist/generated/ElementBounds.js +3 -0
  67. package/dist/generated/ElementBounds.js.map +1 -0
  68. package/dist/generated/ElementValue.d.ts +23 -0
  69. package/dist/generated/ElementValue.d.ts.map +1 -0
  70. package/dist/generated/ElementValue.js +2 -0
  71. package/dist/generated/ElementValue.js.map +1 -0
  72. package/dist/generated/ErrorCode.d.ts +5 -0
  73. package/dist/generated/ErrorCode.d.ts.map +1 -0
  74. package/dist/generated/ErrorCode.js +3 -0
  75. package/dist/generated/ErrorCode.js.map +1 -0
  76. package/dist/generated/ErrorInfo.d.ts +15 -0
  77. package/dist/generated/ErrorInfo.d.ts.map +1 -0
  78. package/dist/generated/ErrorInfo.js +2 -0
  79. package/dist/generated/ErrorInfo.js.map +1 -0
  80. package/dist/generated/FileIpcError.d.ts +14 -0
  81. package/dist/generated/FileIpcError.d.ts.map +1 -0
  82. package/dist/generated/FileIpcError.js +3 -0
  83. package/dist/generated/FileIpcError.js.map +1 -0
  84. package/dist/generated/FileIpcRequest.d.ts +18 -0
  85. package/dist/generated/FileIpcRequest.d.ts.map +1 -0
  86. package/dist/generated/FileIpcRequest.js +3 -0
  87. package/dist/generated/FileIpcRequest.js.map +1 -0
  88. package/dist/generated/FileIpcResponse.d.ts +27 -0
  89. package/dist/generated/FileIpcResponse.d.ts.map +1 -0
  90. package/dist/generated/FileIpcResponse.js +2 -0
  91. package/dist/generated/FileIpcResponse.js.map +1 -0
  92. package/dist/generated/ImageFormat.d.ts +5 -0
  93. package/dist/generated/ImageFormat.d.ts.map +1 -0
  94. package/dist/generated/ImageFormat.js +3 -0
  95. package/dist/generated/ImageFormat.js.map +1 -0
  96. package/dist/generated/KeyboardRequest.d.ts +17 -0
  97. package/dist/generated/KeyboardRequest.d.ts.map +1 -0
  98. package/dist/generated/KeyboardRequest.js +3 -0
  99. package/dist/generated/KeyboardRequest.js.map +1 -0
  100. package/dist/generated/LocateRequest.d.ts +23 -0
  101. package/dist/generated/LocateRequest.d.ts.map +1 -0
  102. package/dist/generated/LocateRequest.js +3 -0
  103. package/dist/generated/LocateRequest.js.map +1 -0
  104. package/dist/generated/LocateResult.d.ts +15 -0
  105. package/dist/generated/LocateResult.d.ts.map +1 -0
  106. package/dist/generated/LocateResult.js +2 -0
  107. package/dist/generated/LocateResult.js.map +1 -0
  108. package/dist/generated/MappedDrive.d.ts +14 -0
  109. package/dist/generated/MappedDrive.d.ts.map +1 -0
  110. package/dist/generated/MappedDrive.js +3 -0
  111. package/dist/generated/MappedDrive.js.map +1 -0
  112. package/dist/generated/MouseButton.d.ts +5 -0
  113. package/dist/generated/MouseButton.d.ts.map +1 -0
  114. package/dist/generated/MouseButton.js +3 -0
  115. package/dist/generated/MouseButton.js.map +1 -0
  116. package/dist/generated/MouseRequest.d.ts +38 -0
  117. package/dist/generated/MouseRequest.d.ts.map +1 -0
  118. package/dist/generated/MouseRequest.js +2 -0
  119. package/dist/generated/MouseRequest.js.map +1 -0
  120. package/dist/generated/OcrMatch.d.ts +34 -0
  121. package/dist/generated/OcrMatch.d.ts.map +1 -0
  122. package/dist/generated/OcrMatch.js +3 -0
  123. package/dist/generated/OcrMatch.js.map +1 -0
  124. package/dist/generated/Request.d.ts +40 -0
  125. package/dist/generated/Request.d.ts.map +1 -0
  126. package/dist/generated/Request.js +2 -0
  127. package/dist/generated/Request.js.map +1 -0
  128. package/dist/generated/Response.d.ts +20 -0
  129. package/dist/generated/Response.d.ts.map +1 -0
  130. package/dist/generated/Response.js +2 -0
  131. package/dist/generated/Response.js.map +1 -0
  132. package/dist/generated/ResponseData.d.ts +92 -0
  133. package/dist/generated/ResponseData.d.ts.map +1 -0
  134. package/dist/generated/ResponseData.js +2 -0
  135. package/dist/generated/ResponseData.js.map +1 -0
  136. package/dist/generated/RunPollResult.d.ts +26 -0
  137. package/dist/generated/RunPollResult.d.ts.map +1 -0
  138. package/dist/generated/RunPollResult.js +3 -0
  139. package/dist/generated/RunPollResult.js.map +1 -0
  140. package/dist/generated/RunResult.d.ts +22 -0
  141. package/dist/generated/RunResult.d.ts.map +1 -0
  142. package/dist/generated/RunResult.js +3 -0
  143. package/dist/generated/RunResult.js.map +1 -0
  144. package/dist/generated/ScreenshotRequest.d.ts +11 -0
  145. package/dist/generated/ScreenshotRequest.d.ts.map +1 -0
  146. package/dist/generated/ScreenshotRequest.js +2 -0
  147. package/dist/generated/ScreenshotRequest.js.map +1 -0
  148. package/dist/generated/ScrollDirection.d.ts +5 -0
  149. package/dist/generated/ScrollDirection.d.ts.map +1 -0
  150. package/dist/generated/ScrollDirection.js +3 -0
  151. package/dist/generated/ScrollDirection.js.map +1 -0
  152. package/dist/generated/ScrollRequest.d.ts +20 -0
  153. package/dist/generated/ScrollRequest.d.ts.map +1 -0
  154. package/dist/generated/ScrollRequest.js +2 -0
  155. package/dist/generated/ScrollRequest.js.map +1 -0
  156. package/dist/generated/SessionInfo.d.ts +35 -0
  157. package/dist/generated/SessionInfo.d.ts.map +1 -0
  158. package/dist/generated/SessionInfo.js +2 -0
  159. package/dist/generated/SessionInfo.js.map +1 -0
  160. package/dist/generated/SessionSummary.d.ts +19 -0
  161. package/dist/generated/SessionSummary.d.ts.map +1 -0
  162. package/dist/generated/SessionSummary.js +2 -0
  163. package/dist/generated/SessionSummary.js.map +1 -0
  164. package/dist/generated/WaitState.d.ts +5 -0
  165. package/dist/generated/WaitState.d.ts.map +1 -0
  166. package/dist/generated/WaitState.js +3 -0
  167. package/dist/generated/WaitState.js.map +1 -0
  168. package/dist/generated/WindowAction.d.ts +5 -0
  169. package/dist/generated/WindowAction.d.ts.map +1 -0
  170. package/dist/generated/WindowAction.js +3 -0
  171. package/dist/generated/WindowAction.js.map +1 -0
  172. package/dist/generated/WindowInfo.d.ts +31 -0
  173. package/dist/generated/WindowInfo.d.ts.map +1 -0
  174. package/dist/generated/WindowInfo.js +2 -0
  175. package/dist/generated/WindowInfo.js.map +1 -0
  176. package/dist/generated/index.d.ts +41 -0
  177. package/dist/generated/index.d.ts.map +1 -0
  178. package/dist/generated/index.js +3 -0
  179. package/dist/generated/index.js.map +1 -0
  180. package/dist/index.d.ts +211 -0
  181. package/dist/index.d.ts.map +1 -0
  182. package/dist/index.js +341 -0
  183. package/dist/index.js.map +1 -0
  184. package/dist/types.d.ts +125 -0
  185. package/dist/types.d.ts.map +1 -0
  186. package/dist/types.js +17 -0
  187. package/dist/types.js.map +1 -0
  188. package/models/text-detection.rten +0 -0
  189. package/models/text-recognition.rten +0 -0
  190. package/package.json +52 -5
@@ -0,0 +1,31 @@
1
+ import type { ElementBounds } from "./ElementBounds.js";
2
+ /**
3
+ * Window information.
4
+ */
5
+ export type WindowInfo = {
6
+ /**
7
+ * Window title.
8
+ */
9
+ title: string;
10
+ /**
11
+ * Process name.
12
+ */
13
+ process_name?: string;
14
+ /**
15
+ * Process ID.
16
+ */
17
+ process_id?: number;
18
+ /**
19
+ * Window bounds.
20
+ */
21
+ bounds?: ElementBounds;
22
+ /**
23
+ * Whether the window is minimized.
24
+ */
25
+ minimized: boolean;
26
+ /**
27
+ * Whether the window is maximized.
28
+ */
29
+ maximized: boolean;
30
+ };
31
+ //# sourceMappingURL=WindowInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WindowInfo.d.ts","sourceRoot":"","sources":["../../src/generated/WindowInfo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WindowInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WindowInfo.js","sourceRoot":"","sources":["../../src/generated/WindowInfo.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ export type { AccessibilityElement } from './AccessibilityElement.js';
2
+ export type { AccessibilitySnapshot } from './AccessibilitySnapshot.js';
3
+ export type { AutomateRequest } from './AutomateRequest.js';
4
+ export type { AutomationHandshake } from './AutomationHandshake.js';
5
+ export type { AutomationScrollDirection } from './AutomationScrollDirection.js';
6
+ export type { AutomationStatus } from './AutomationStatus.js';
7
+ export type { ClickResult } from './ClickResult.js';
8
+ export type { ClipboardRequest } from './ClipboardRequest.js';
9
+ export type { ConnectRequest } from './ConnectRequest.js';
10
+ export type { ConnectionState } from './ConnectionState.js';
11
+ export type { DriveMapping } from './DriveMapping.js';
12
+ export type { DriveRequest } from './DriveRequest.js';
13
+ export type { ElementBounds } from './ElementBounds.js';
14
+ export type { ElementValue } from './ElementValue.js';
15
+ export type { ErrorCode } from './ErrorCode.js';
16
+ export type { ErrorInfo } from './ErrorInfo.js';
17
+ export type { FileIpcError } from './FileIpcError.js';
18
+ export type { FileIpcRequest } from './FileIpcRequest.js';
19
+ export type { FileIpcResponse } from './FileIpcResponse.js';
20
+ export type { ImageFormat } from './ImageFormat.js';
21
+ export type { KeyboardRequest } from './KeyboardRequest.js';
22
+ export type { LocateRequest } from './LocateRequest.js';
23
+ export type { LocateResult } from './LocateResult.js';
24
+ export type { MappedDrive } from './MappedDrive.js';
25
+ export type { MouseButton } from './MouseButton.js';
26
+ export type { MouseRequest } from './MouseRequest.js';
27
+ export type { OcrMatch } from './OcrMatch.js';
28
+ export type { Request } from './Request.js';
29
+ export type { Response } from './Response.js';
30
+ export type { ResponseData } from './ResponseData.js';
31
+ export type { RunPollResult } from './RunPollResult.js';
32
+ export type { RunResult } from './RunResult.js';
33
+ export type { ScreenshotRequest } from './ScreenshotRequest.js';
34
+ export type { ScrollDirection } from './ScrollDirection.js';
35
+ export type { ScrollRequest } from './ScrollRequest.js';
36
+ export type { SessionInfo } from './SessionInfo.js';
37
+ export type { SessionSummary } from './SessionSummary.js';
38
+ export type { WaitState } from './WaitState.js';
39
+ export type { WindowAction } from './WindowAction.js';
40
+ export type { WindowInfo } from './WindowInfo.js';
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.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;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Auto-generated by cargo test - do not edit manually
2
+ export {};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AAAA,sDAAsD"}
@@ -0,0 +1,211 @@
1
+ /**
2
+ * agent-rdp Node.js API
3
+ *
4
+ * Programmatic interface for controlling Windows Remote Desktop sessions.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { RdpSession } from 'agent-rdp';
9
+ *
10
+ * const rdp = new RdpSession({ session: 'default' });
11
+ *
12
+ * await rdp.connect({
13
+ * host: '192.168.1.100',
14
+ * username: 'Administrator',
15
+ * password: 'secret',
16
+ * });
17
+ *
18
+ * const { path, width, height } = await rdp.screenshot({ path: 'screenshot.png' });
19
+ * await rdp.mouse.click({ x: 100, y: 200 });
20
+ * await rdp.keyboard.type({ text: 'Hello World' });
21
+ * await rdp.disconnect();
22
+ * ```
23
+ */
24
+ import { AutomationController } from './automation.js';
25
+ import { ConnectOptions, ConnectResult, ScreenshotOptions, ScreenshotResult, ScreenshotFileResult, SessionInfo, MappedDrive, MouseClickOptions, MouseDragOptions, ScrollOptions, KeyboardTypeOptions, KeyboardPressOptions, ClipboardSetOptions, LocateOptions, OcrMatch, Request, Response } from './types.js';
26
+ export * from './types.js';
27
+ export { AutomationController } from './automation.js';
28
+ export interface RdpSessionOptions {
29
+ /** Session name (default: 'default') */
30
+ session?: string;
31
+ /** Request timeout in milliseconds (default: 30000) */
32
+ timeout?: number;
33
+ /** WebSocket streaming port (0 = disabled). Connect to ws://localhost:<port> for frames. */
34
+ streamPort?: number;
35
+ /**
36
+ * Address the streaming server binds to (default: '127.0.0.1'). The stream is
37
+ * unauthenticated and grants full control of the session, so only widen this
38
+ * (e.g. '0.0.0.0') on a trusted network.
39
+ */
40
+ streamBind?: string;
41
+ /** Streaming frame rate (default: 10). */
42
+ streamFps?: number;
43
+ /** Streaming JPEG quality, 0-100 (default: 80). */
44
+ streamQuality?: number;
45
+ }
46
+ /**
47
+ * Mouse controller for RDP sessions.
48
+ */
49
+ export declare class MouseController {
50
+ private rdp;
51
+ constructor(rdp: RdpSession);
52
+ /** Move cursor to position. */
53
+ move(options: MouseClickOptions): Promise<void>;
54
+ /** Left click at position. */
55
+ click(options: MouseClickOptions): Promise<void>;
56
+ /** Right click at position. */
57
+ rightClick(options: MouseClickOptions): Promise<void>;
58
+ /** Double click at position. */
59
+ doubleClick(options: MouseClickOptions): Promise<void>;
60
+ /** Drag from one position to another. */
61
+ drag(options: MouseDragOptions): Promise<void>;
62
+ }
63
+ /**
64
+ * Keyboard controller for RDP sessions.
65
+ */
66
+ export declare class KeyboardController {
67
+ private rdp;
68
+ constructor(rdp: RdpSession);
69
+ /** Type a text string (Unicode). */
70
+ type(options: KeyboardTypeOptions): Promise<void>;
71
+ /** Press a key combination (e.g., 'ctrl+c', 'alt+tab') or single key (e.g., 'enter'). */
72
+ press(options: KeyboardPressOptions): Promise<void>;
73
+ }
74
+ /**
75
+ * Scroll controller for RDP sessions.
76
+ */
77
+ export declare class ScrollController {
78
+ private rdp;
79
+ constructor(rdp: RdpSession);
80
+ /** Scroll up. */
81
+ up(options?: ScrollOptions): Promise<void>;
82
+ /** Scroll down. */
83
+ down(options?: ScrollOptions): Promise<void>;
84
+ /** Scroll left. */
85
+ left(options?: ScrollOptions): Promise<void>;
86
+ /** Scroll right. */
87
+ right(options?: ScrollOptions): Promise<void>;
88
+ }
89
+ /**
90
+ * Clipboard controller for RDP sessions.
91
+ */
92
+ export declare class ClipboardController {
93
+ private rdp;
94
+ constructor(rdp: RdpSession);
95
+ /** Get clipboard text. */
96
+ get(): Promise<string>;
97
+ /** Set clipboard text. */
98
+ set(options: ClipboardSetOptions): Promise<void>;
99
+ }
100
+ /**
101
+ * Drive controller for RDP sessions.
102
+ */
103
+ export declare class DriveController {
104
+ private rdp;
105
+ constructor(rdp: RdpSession);
106
+ /** List mapped drives. */
107
+ list(): Promise<MappedDrive[]>;
108
+ }
109
+ /**
110
+ * Main RDP session class.
111
+ */
112
+ export declare class RdpSession {
113
+ /** Mouse controller. */
114
+ readonly mouse: MouseController;
115
+ /** Keyboard controller. */
116
+ readonly keyboard: KeyboardController;
117
+ /** Scroll controller. */
118
+ readonly scroll: ScrollController;
119
+ /** Clipboard controller. */
120
+ readonly clipboard: ClipboardController;
121
+ /** Drive controller. */
122
+ readonly drives: DriveController;
123
+ /** Automation controller for Windows UI Automation. */
124
+ readonly automation: AutomationController;
125
+ private session;
126
+ private timeout;
127
+ private streamPort;
128
+ private streamBind;
129
+ private streamFps;
130
+ private streamQuality;
131
+ private daemon;
132
+ private client;
133
+ constructor(options?: RdpSessionOptions);
134
+ /**
135
+ * Connect to an RDP server.
136
+ *
137
+ * @param options Connection options
138
+ * @param options.host Server hostname or IP
139
+ * @param options.port Server port (default: 3389)
140
+ * @param options.username Username for authentication
141
+ * @param options.password Password for authentication
142
+ * @param options.domain Optional domain
143
+ * @param options.width Desktop width (default: 1280)
144
+ * @param options.height Desktop height (default: 800)
145
+ * @param options.drives Drives to map
146
+ * @param options.enableWinAutomation Enable Windows UI Automation
147
+ */
148
+ connect(options: ConnectOptions): Promise<ConnectResult>;
149
+ /**
150
+ * Take a screenshot.
151
+ *
152
+ * Pass `path` to write the image to disk and get back just the path and
153
+ * dimensions, instead of a base64 string. Prefer `path` when the caller
154
+ * (e.g. an AI agent) doesn't need the raw bytes in memory — returning
155
+ * base64 to a caller that echoes results into an LLM context can burn a
156
+ * large number of tokens for a single screenshot.
157
+ */
158
+ screenshot(options: ScreenshotOptions & {
159
+ path: string;
160
+ }): Promise<ScreenshotFileResult>;
161
+ screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>;
162
+ /**
163
+ * Get session information.
164
+ */
165
+ getInfo(): Promise<SessionInfo>;
166
+ /**
167
+ * Locate text on screen using OCR.
168
+ *
169
+ * @param options Locate options
170
+ * @param options.text Text to search for (required unless all is true)
171
+ * @param options.all If true, returns all text on screen
172
+ * @param options.pattern Use glob-style pattern matching (* and ?)
173
+ * @param options.caseSensitive Case-sensitive matching (default: false)
174
+ * @returns Array of matching text lines with coordinates
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // Find lines containing text
179
+ * const matches = await rdp.locate({ text: 'Non HDR' });
180
+ * if (matches.length > 0) {
181
+ * await rdp.mouse.click({ x: matches[0].center_x, y: matches[0].center_y });
182
+ * }
183
+ *
184
+ * // Pattern matching
185
+ * const saveButtons = await rdp.locate({ text: 'Save*', pattern: true });
186
+ *
187
+ * // Get all text on screen
188
+ * const allLines = await rdp.locate({ all: true });
189
+ * ```
190
+ */
191
+ locate(options: LocateOptions): Promise<OcrMatch[]>;
192
+ /**
193
+ * Disconnect from the RDP server.
194
+ */
195
+ disconnect(): Promise<void>;
196
+ /**
197
+ * Close the IPC connection without disconnecting the RDP session.
198
+ */
199
+ close(): Promise<void>;
200
+ /**
201
+ * Get the WebSocket streaming URL, if streaming is enabled.
202
+ * Connect to this URL to receive JPEG frames.
203
+ */
204
+ getStreamUrl(): string | null;
205
+ /**
206
+ * Internal: Send a request to the daemon.
207
+ * @internal
208
+ */
209
+ _send(request: Request): Promise<Response>;
210
+ }
211
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,OAAO,EACP,QAAQ,EAET,MAAM,YAAY,CAAC;AAGpB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,aAAa,CAAC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C,oBAAoB,CAAC;IACxF,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmCxE;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAwBrC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAazD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAO5B;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,IAAI;IAO7B;;;OAGG;IACG,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAiBjD"}
package/dist/index.js ADDED
@@ -0,0 +1,341 @@
1
+ /**
2
+ * agent-rdp Node.js API
3
+ *
4
+ * Programmatic interface for controlling Windows Remote Desktop sessions.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { RdpSession } from 'agent-rdp';
9
+ *
10
+ * const rdp = new RdpSession({ session: 'default' });
11
+ *
12
+ * await rdp.connect({
13
+ * host: '192.168.1.100',
14
+ * username: 'Administrator',
15
+ * password: 'secret',
16
+ * });
17
+ *
18
+ * const { path, width, height } = await rdp.screenshot({ path: 'screenshot.png' });
19
+ * await rdp.mouse.click({ x: 100, y: 200 });
20
+ * await rdp.keyboard.type({ text: 'Hello World' });
21
+ * await rdp.disconnect();
22
+ * ```
23
+ */
24
+ import * as fs from 'node:fs';
25
+ import { DaemonManager } from './daemon.js';
26
+ import { AutomationController } from './automation.js';
27
+ import { RdpError, } from './types.js';
28
+ // Re-export types
29
+ export * from './types.js';
30
+ export { AutomationController } from './automation.js';
31
+ /**
32
+ * Mouse controller for RDP sessions.
33
+ */
34
+ export class MouseController {
35
+ rdp;
36
+ constructor(rdp) {
37
+ this.rdp = rdp;
38
+ }
39
+ /** Move cursor to position. */
40
+ async move(options) {
41
+ await this.rdp._send({ type: 'mouse', action: 'move', x: options.x, y: options.y });
42
+ }
43
+ /** Left click at position. */
44
+ async click(options) {
45
+ await this.rdp._send({ type: 'mouse', action: 'click', x: options.x, y: options.y });
46
+ }
47
+ /** Right click at position. */
48
+ async rightClick(options) {
49
+ await this.rdp._send({ type: 'mouse', action: 'right_click', x: options.x, y: options.y });
50
+ }
51
+ /** Double click at position. */
52
+ async doubleClick(options) {
53
+ await this.rdp._send({ type: 'mouse', action: 'double_click', x: options.x, y: options.y });
54
+ }
55
+ /** Drag from one position to another. */
56
+ async drag(options) {
57
+ await this.rdp._send({
58
+ type: 'mouse',
59
+ action: 'drag',
60
+ from_x: options.from.x,
61
+ from_y: options.from.y,
62
+ to_x: options.to.x,
63
+ to_y: options.to.y,
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * Keyboard controller for RDP sessions.
69
+ */
70
+ export class KeyboardController {
71
+ rdp;
72
+ constructor(rdp) {
73
+ this.rdp = rdp;
74
+ }
75
+ /** Type a text string (Unicode). */
76
+ async type(options) {
77
+ await this.rdp._send({ type: 'keyboard', action: 'type', text: options.text });
78
+ }
79
+ /** Press a key combination (e.g., 'ctrl+c', 'alt+tab') or single key (e.g., 'enter'). */
80
+ async press(options) {
81
+ await this.rdp._send({ type: 'keyboard', action: 'press', keys: options.keys });
82
+ }
83
+ }
84
+ /**
85
+ * Scroll controller for RDP sessions.
86
+ */
87
+ export class ScrollController {
88
+ rdp;
89
+ constructor(rdp) {
90
+ this.rdp = rdp;
91
+ }
92
+ /** Scroll up. */
93
+ async up(options = {}) {
94
+ await this.rdp._send({ type: 'scroll', direction: 'up', amount: options.amount ?? 3, x: options.x, y: options.y });
95
+ }
96
+ /** Scroll down. */
97
+ async down(options = {}) {
98
+ await this.rdp._send({ type: 'scroll', direction: 'down', amount: options.amount ?? 3, x: options.x, y: options.y });
99
+ }
100
+ /** Scroll left. */
101
+ async left(options = {}) {
102
+ await this.rdp._send({ type: 'scroll', direction: 'left', amount: options.amount ?? 3, x: options.x, y: options.y });
103
+ }
104
+ /** Scroll right. */
105
+ async right(options = {}) {
106
+ await this.rdp._send({ type: 'scroll', direction: 'right', amount: options.amount ?? 3, x: options.x, y: options.y });
107
+ }
108
+ }
109
+ /**
110
+ * Clipboard controller for RDP sessions.
111
+ */
112
+ export class ClipboardController {
113
+ rdp;
114
+ constructor(rdp) {
115
+ this.rdp = rdp;
116
+ }
117
+ /** Get clipboard text. */
118
+ async get() {
119
+ const response = await this.rdp._send({ type: 'clipboard', action: 'get' });
120
+ const data = response.data;
121
+ return data.text;
122
+ }
123
+ /** Set clipboard text. */
124
+ async set(options) {
125
+ await this.rdp._send({ type: 'clipboard', action: 'set', text: options.text });
126
+ }
127
+ }
128
+ /**
129
+ * Drive controller for RDP sessions.
130
+ */
131
+ export class DriveController {
132
+ rdp;
133
+ constructor(rdp) {
134
+ this.rdp = rdp;
135
+ }
136
+ /** List mapped drives. */
137
+ async list() {
138
+ const response = await this.rdp._send({ type: 'drive', action: 'list' });
139
+ const data = response.data;
140
+ return data.drives;
141
+ }
142
+ }
143
+ /**
144
+ * Main RDP session class.
145
+ */
146
+ export class RdpSession {
147
+ /** Mouse controller. */
148
+ mouse;
149
+ /** Keyboard controller. */
150
+ keyboard;
151
+ /** Scroll controller. */
152
+ scroll;
153
+ /** Clipboard controller. */
154
+ clipboard;
155
+ /** Drive controller. */
156
+ drives;
157
+ /** Automation controller for Windows UI Automation. */
158
+ automation;
159
+ session;
160
+ timeout;
161
+ streamPort;
162
+ streamBind;
163
+ streamFps;
164
+ streamQuality;
165
+ daemon;
166
+ client = null;
167
+ constructor(options = {}) {
168
+ this.session = options.session ?? 'default';
169
+ this.timeout = options.timeout ?? 30000;
170
+ this.streamPort = options.streamPort ?? 0;
171
+ this.streamBind = options.streamBind ?? '127.0.0.1';
172
+ this.streamFps = options.streamFps ?? 10;
173
+ this.streamQuality = options.streamQuality ?? 80;
174
+ this.daemon = new DaemonManager(this.session, this.streamPort);
175
+ this.mouse = new MouseController(this);
176
+ this.keyboard = new KeyboardController(this);
177
+ this.scroll = new ScrollController(this);
178
+ this.clipboard = new ClipboardController(this);
179
+ this.drives = new DriveController(this);
180
+ this.automation = new AutomationController(this);
181
+ }
182
+ /**
183
+ * Connect to an RDP server.
184
+ *
185
+ * @param options Connection options
186
+ * @param options.host Server hostname or IP
187
+ * @param options.port Server port (default: 3389)
188
+ * @param options.username Username for authentication
189
+ * @param options.password Password for authentication
190
+ * @param options.domain Optional domain
191
+ * @param options.width Desktop width (default: 1280)
192
+ * @param options.height Desktop height (default: 800)
193
+ * @param options.drives Drives to map
194
+ * @param options.enableWinAutomation Enable Windows UI Automation
195
+ */
196
+ async connect(options) {
197
+ // Ensure daemon is running and connect
198
+ this.client = await this.daemon.ensureRunning();
199
+ const request = {
200
+ type: 'connect',
201
+ host: options.host,
202
+ port: options.port ?? 3389,
203
+ username: options.username,
204
+ password: options.password,
205
+ domain: options.domain,
206
+ width: options.width ?? 1280,
207
+ height: options.height ?? 800,
208
+ drives: options.drives ?? [],
209
+ enable_win_automation: options.enableWinAutomation ?? false,
210
+ stream_port: this.streamPort,
211
+ stream_bind: this.streamBind,
212
+ stream_fps: this.streamFps,
213
+ stream_quality: this.streamQuality,
214
+ // Serve the HTML viewer whenever streaming is on, matching the CLI.
215
+ serve_viewer: this.streamPort > 0,
216
+ };
217
+ const response = await this._send(request);
218
+ const data = response.data;
219
+ return {
220
+ host: data.host,
221
+ width: data.width,
222
+ height: data.height,
223
+ };
224
+ }
225
+ async screenshot(options = {}) {
226
+ const response = await this._send({
227
+ type: 'screenshot',
228
+ format: options.format ?? 'png',
229
+ });
230
+ const data = response.data;
231
+ if (options.path) {
232
+ fs.writeFileSync(options.path, Buffer.from(data.base64, 'base64'));
233
+ return {
234
+ path: options.path,
235
+ width: data.width,
236
+ height: data.height,
237
+ format: data.format,
238
+ };
239
+ }
240
+ return {
241
+ base64: data.base64,
242
+ width: data.width,
243
+ height: data.height,
244
+ format: data.format,
245
+ };
246
+ }
247
+ /**
248
+ * Get session information.
249
+ */
250
+ async getInfo() {
251
+ const response = await this._send({ type: 'session_info' });
252
+ const data = response.data;
253
+ return {
254
+ name: data.name,
255
+ state: data.state,
256
+ host: data.host,
257
+ width: data.width,
258
+ height: data.height,
259
+ pid: data.pid,
260
+ uptime_secs: data.uptime_secs,
261
+ };
262
+ }
263
+ /**
264
+ * Locate text on screen using OCR.
265
+ *
266
+ * @param options Locate options
267
+ * @param options.text Text to search for (required unless all is true)
268
+ * @param options.all If true, returns all text on screen
269
+ * @param options.pattern Use glob-style pattern matching (* and ?)
270
+ * @param options.caseSensitive Case-sensitive matching (default: false)
271
+ * @returns Array of matching text lines with coordinates
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * // Find lines containing text
276
+ * const matches = await rdp.locate({ text: 'Non HDR' });
277
+ * if (matches.length > 0) {
278
+ * await rdp.mouse.click({ x: matches[0].center_x, y: matches[0].center_y });
279
+ * }
280
+ *
281
+ * // Pattern matching
282
+ * const saveButtons = await rdp.locate({ text: 'Save*', pattern: true });
283
+ *
284
+ * // Get all text on screen
285
+ * const allLines = await rdp.locate({ all: true });
286
+ * ```
287
+ */
288
+ async locate(options) {
289
+ const response = await this._send({
290
+ type: 'locate',
291
+ text: options.text ?? '',
292
+ pattern: options.pattern ?? false,
293
+ ignore_case: !(options.caseSensitive ?? false),
294
+ all: options.all ?? false,
295
+ });
296
+ const data = response.data;
297
+ return data.matches ?? [];
298
+ }
299
+ /**
300
+ * Disconnect from the RDP server.
301
+ */
302
+ async disconnect() {
303
+ await this._send({ type: 'disconnect' });
304
+ await this.close();
305
+ }
306
+ /**
307
+ * Close the IPC connection without disconnecting the RDP session.
308
+ */
309
+ async close() {
310
+ if (this.client) {
311
+ await this.client.close();
312
+ this.client = null;
313
+ }
314
+ }
315
+ /**
316
+ * Get the WebSocket streaming URL, if streaming is enabled.
317
+ * Connect to this URL to receive JPEG frames.
318
+ */
319
+ getStreamUrl() {
320
+ if (this.streamPort === 0) {
321
+ return null;
322
+ }
323
+ return `ws://localhost:${this.streamPort}`;
324
+ }
325
+ /**
326
+ * Internal: Send a request to the daemon.
327
+ * @internal
328
+ */
329
+ async _send(request) {
330
+ if (!this.client) {
331
+ // Auto-connect to daemon if not connected
332
+ this.client = await this.daemon.ensureRunning();
333
+ }
334
+ const response = await this.client.send(request, this.timeout);
335
+ if (!response.success) {
336
+ throw new RdpError(response.error?.code ?? 'internal_error', response.error?.message ?? 'Unknown error');
337
+ }
338
+ return response;
339
+ }
340
+ }
341
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAkBL,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAqBvD;;GAEG;AACH,MAAM,OAAO,eAAe;IACN;IAApB,YAAoB,GAAe;QAAf,QAAG,GAAH,GAAG,CAAY;IAAG,CAAC;IAEvC,+BAA+B;IAC/B,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,8BAA8B;IAC9B,KAAK,CAAC,KAAK,CAAC,OAA0B;QACpC,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CA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