agent-rdp 0.1.4 → 0.2.1
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 +86 -15
- package/bin/agent-rdp-darwin-arm64 +0 -0
- package/bin/agent-rdp-darwin-x64 +0 -0
- package/bin/agent-rdp-linux-arm64 +0 -0
- package/bin/agent-rdp-linux-x64 +0 -0
- package/bin/agent-rdp-win32-arm64.exe +0 -0
- package/bin/agent-rdp-win32-x64.exe +0 -0
- package/bin/agent-rdp.cjs +2 -8
- package/dist/automation.d.ts +162 -0
- package/dist/automation.d.ts.map +1 -0
- package/dist/automation.js +269 -0
- package/dist/automation.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +31 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -34
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +103 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +8 -2
- package/scripts/lint-ps1.ps1 +28 -0
- package/bin/agent-rdp +0 -30
- package/bin/agent-rdp.cmd +0 -19
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ A CLI tool for AI agents to control Windows Remote Desktop sessions, built on [I
|
|
|
10
10
|
- **Keyboard input** - Type text, press key combinations (Ctrl+C, Alt+Tab, etc.)
|
|
11
11
|
- **Clipboard sync** - Copy/paste text between local machine and remote Windows
|
|
12
12
|
- **Drive mapping** - Map local directories as network drives on the remote machine
|
|
13
|
+
- **UI Automation** - Interact with Windows applications via accessibility API (click, fill, inspect)
|
|
13
14
|
- **JSON output** - Structured output for AI agent consumption
|
|
14
15
|
- **Session management** - Multiple named sessions with automatic daemon lifecycle
|
|
15
16
|
|
|
@@ -91,10 +92,10 @@ agent-rdp keyboard press "ctrl+c"
|
|
|
91
92
|
agent-rdp keyboard press "alt+tab"
|
|
92
93
|
agent-rdp keyboard press "ctrl+shift+esc"
|
|
93
94
|
|
|
94
|
-
# Press single keys
|
|
95
|
-
agent-rdp keyboard
|
|
96
|
-
agent-rdp keyboard
|
|
97
|
-
agent-rdp keyboard
|
|
95
|
+
# Press single keys (use press command)
|
|
96
|
+
agent-rdp keyboard press enter
|
|
97
|
+
agent-rdp keyboard press escape
|
|
98
|
+
agent-rdp keyboard press f5
|
|
98
99
|
```
|
|
99
100
|
|
|
100
101
|
### Scroll
|
|
@@ -135,6 +136,56 @@ agent-rdp drive list
|
|
|
135
136
|
|
|
136
137
|
On the remote Windows machine, mapped drives appear in File Explorer as network locations.
|
|
137
138
|
|
|
139
|
+
### UI Automation
|
|
140
|
+
|
|
141
|
+
Enable Windows UI Automation to interact with applications programmatically:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Connect with automation enabled
|
|
145
|
+
agent-rdp connect --host 192.168.1.100 -u Admin -p secret --enable-win-automation
|
|
146
|
+
|
|
147
|
+
# Take an accessibility tree snapshot (refs are always included)
|
|
148
|
+
agent-rdp automate snapshot
|
|
149
|
+
|
|
150
|
+
# Snapshot filtering options (like agent-browser)
|
|
151
|
+
agent-rdp automate snapshot -i # Interactive elements only
|
|
152
|
+
agent-rdp automate snapshot -c # Compact (remove empty structural elements)
|
|
153
|
+
agent-rdp automate snapshot -d 3 # Limit depth to 3 levels
|
|
154
|
+
agent-rdp automate snapshot -s "~*Notepad*" # Scope to a window/element
|
|
155
|
+
agent-rdp automate snapshot -i -c -d 5 # Combine options
|
|
156
|
+
|
|
157
|
+
# Click elements by selector (refs use @eN format)
|
|
158
|
+
agent-rdp automate click "#SaveButton" # By automation ID
|
|
159
|
+
agent-rdp automate click "@e5" # By ref number from snapshot
|
|
160
|
+
|
|
161
|
+
# Fill text fields
|
|
162
|
+
agent-rdp automate fill ".Edit" "Hello World"
|
|
163
|
+
|
|
164
|
+
# Window operations
|
|
165
|
+
agent-rdp automate window list
|
|
166
|
+
agent-rdp automate window focus "~*Notepad*"
|
|
167
|
+
|
|
168
|
+
# Run PowerShell commands
|
|
169
|
+
agent-rdp automate run "Get-Process" --wait
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Selector Types:**
|
|
173
|
+
- `@e5` or `@5` - Reference number from snapshot (e prefix recommended)
|
|
174
|
+
- `#SaveButton` - Automation ID
|
|
175
|
+
- `.Edit` - Win32 class name
|
|
176
|
+
- `~*pattern*` - Wildcard name match
|
|
177
|
+
- `File` - Element name (exact match)
|
|
178
|
+
|
|
179
|
+
**Snapshot Output Format:**
|
|
180
|
+
```
|
|
181
|
+
- Window "Notepad" [ref=e1, id=Notepad]
|
|
182
|
+
- MenuBar "Application" [ref=e2]
|
|
183
|
+
- MenuItem "File" [ref=e3]
|
|
184
|
+
- Edit "Text Editor" [ref=e5, value="Hello"]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
For detailed documentation on automation, see [docs/AUTOMATION.md](docs/AUTOMATION.md).
|
|
188
|
+
|
|
138
189
|
### Session Management
|
|
139
190
|
|
|
140
191
|
```bash
|
|
@@ -158,6 +209,25 @@ agent-rdp --session work screenshot
|
|
|
158
209
|
agent-rdp disconnect
|
|
159
210
|
```
|
|
160
211
|
|
|
212
|
+
### Web Viewer
|
|
213
|
+
|
|
214
|
+
Open the web-based viewer to see the remote desktop in your browser:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Open viewer (connects to default streaming port 9224)
|
|
218
|
+
agent-rdp view
|
|
219
|
+
|
|
220
|
+
# Specify a different port
|
|
221
|
+
agent-rdp view --port 9224
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The viewer requires WebSocket streaming to be enabled. Start a session with streaming:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
agent-rdp --stream-port 9224 connect --host 192.168.1.100 -u Admin -p secret
|
|
228
|
+
agent-rdp view
|
|
229
|
+
```
|
|
230
|
+
|
|
161
231
|
## JSON Output
|
|
162
232
|
|
|
163
233
|
All commands support `--json` for structured output:
|
|
@@ -224,23 +294,24 @@ await rdp.connect({
|
|
|
224
294
|
const { base64, width, height } = await rdp.screenshot({ format: 'png' });
|
|
225
295
|
|
|
226
296
|
// Mouse
|
|
227
|
-
await rdp.mouse.click(100, 200);
|
|
228
|
-
await rdp.mouse.rightClick(100, 200);
|
|
229
|
-
await rdp.mouse.doubleClick(100, 200);
|
|
230
|
-
await rdp.mouse.move(150, 250);
|
|
231
|
-
await rdp.mouse.drag(100, 100, 500, 500);
|
|
297
|
+
await rdp.mouse.click({ x: 100, y: 200 });
|
|
298
|
+
await rdp.mouse.rightClick({ x: 100, y: 200 });
|
|
299
|
+
await rdp.mouse.doubleClick({ x: 100, y: 200 });
|
|
300
|
+
await rdp.mouse.move({ x: 150, y: 250 });
|
|
301
|
+
await rdp.mouse.drag({ from: { x: 100, y: 100 }, to: { x: 500, y: 500 } });
|
|
232
302
|
|
|
233
303
|
// Keyboard
|
|
234
|
-
await rdp.keyboard.type('Hello World');
|
|
235
|
-
await rdp.keyboard.press('ctrl+c');
|
|
236
|
-
await rdp.keyboard.
|
|
304
|
+
await rdp.keyboard.type({ text: 'Hello World' });
|
|
305
|
+
await rdp.keyboard.press({ keys: 'ctrl+c' });
|
|
306
|
+
await rdp.keyboard.press({ keys: 'enter' }); // Single keys use press()
|
|
237
307
|
|
|
238
308
|
// Scroll
|
|
239
|
-
await rdp.scroll.up(
|
|
240
|
-
await rdp.scroll.down(5);
|
|
309
|
+
await rdp.scroll.up(); // Default amount: 3
|
|
310
|
+
await rdp.scroll.down({ amount: 5 }); // Custom amount
|
|
311
|
+
await rdp.scroll.up({ x: 500, y: 300 }); // Scroll at position
|
|
241
312
|
|
|
242
313
|
// Clipboard
|
|
243
|
-
await rdp.clipboard.set('text to copy');
|
|
314
|
+
await rdp.clipboard.set({ text: 'text to copy' });
|
|
244
315
|
const text = await rdp.clipboard.get();
|
|
245
316
|
|
|
246
317
|
// Drives
|
|
Binary file
|
package/bin/agent-rdp-darwin-x64
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/agent-rdp-linux-x64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/agent-rdp.cjs
CHANGED
|
@@ -31,14 +31,8 @@ switch (arch()) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const ext = os === 'win32' ? '.exe' : '';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Fallback: Windows ARM64 can run x64 binaries via emulation
|
|
38
|
-
if (!existsSync(binaryPath) && os === 'win32' && architecture === 'arm64') {
|
|
39
|
-
binaryName = `agent-rdp-win32-x64.exe`;
|
|
40
|
-
binaryPath = join(scriptDir, binaryName);
|
|
41
|
-
}
|
|
34
|
+
const binaryName = `agent-rdp-${os}-${architecture}${ext}`;
|
|
35
|
+
const binaryPath = join(scriptDir, binaryName);
|
|
42
36
|
|
|
43
37
|
if (!existsSync(binaryPath)) {
|
|
44
38
|
console.error(`Error: No binary found for ${os}-${architecture}`);
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automation controller for Windows UI Automation.
|
|
3
|
+
*/
|
|
4
|
+
import type { RdpSession } from './index.js';
|
|
5
|
+
import type { AutomationSnapshot, AutomationElementValue, AutomationWindowInfo, AutomationStatus, AutomationRunResult } from './types.js';
|
|
6
|
+
export interface SnapshotOptions {
|
|
7
|
+
/** Filter to interactive elements only (buttons, inputs, focusable). */
|
|
8
|
+
interactive?: boolean;
|
|
9
|
+
/** Compact mode - remove empty structural elements. */
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
/** Maximum tree depth (default: 10). */
|
|
12
|
+
depth?: number;
|
|
13
|
+
/** Scope to a specific element (window, panel, etc.) via selector. */
|
|
14
|
+
selector?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GetOptions {
|
|
17
|
+
/** Property to retrieve: 'name', 'value', 'states', 'bounds', or 'all'. */
|
|
18
|
+
property?: 'name' | 'value' | 'states' | 'bounds' | 'all';
|
|
19
|
+
}
|
|
20
|
+
export interface ClickOptions {
|
|
21
|
+
/** Mouse button: 'left', 'right', or 'middle'. */
|
|
22
|
+
button?: 'left' | 'right' | 'middle';
|
|
23
|
+
/** Double-click instead of single click. */
|
|
24
|
+
double?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ScrollOptions {
|
|
27
|
+
/** Scroll direction. */
|
|
28
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
29
|
+
/** Scroll amount. */
|
|
30
|
+
amount?: number;
|
|
31
|
+
/** Child selector to scroll into view. */
|
|
32
|
+
toChild?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface RunOptions {
|
|
35
|
+
/** Command arguments. */
|
|
36
|
+
args?: string[];
|
|
37
|
+
/** Wait for command to complete. */
|
|
38
|
+
wait?: boolean;
|
|
39
|
+
/** Run with hidden window. */
|
|
40
|
+
hidden?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface WaitForOptions {
|
|
43
|
+
/** Timeout in milliseconds. */
|
|
44
|
+
timeout?: number;
|
|
45
|
+
/** State to wait for: 'visible', 'enabled', or 'gone'. */
|
|
46
|
+
state?: 'visible' | 'enabled' | 'gone';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Automation controller for Windows UI Automation.
|
|
50
|
+
*
|
|
51
|
+
* Provides methods for interacting with Windows applications via the
|
|
52
|
+
* Windows UI Automation API through a PowerShell agent.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* // Take a snapshot of the accessibility tree
|
|
57
|
+
* const snapshot = await rdp.automation.snapshot();
|
|
58
|
+
* console.log(`Found ${snapshot.ref_count} elements`);
|
|
59
|
+
*
|
|
60
|
+
* // Interactive elements only
|
|
61
|
+
* const interactive = await rdp.automation.snapshot({ interactive: true });
|
|
62
|
+
*
|
|
63
|
+
* // Compact output with depth limit
|
|
64
|
+
* const compact = await rdp.automation.snapshot({ interactive: true, compact: true, depth: 5 });
|
|
65
|
+
*
|
|
66
|
+
* // Click an element by ref number (use @eN format)
|
|
67
|
+
* await rdp.automation.click('@e5');
|
|
68
|
+
*
|
|
69
|
+
* // Fill text in an element
|
|
70
|
+
* await rdp.automation.fill('#SearchBox', 'Hello World');
|
|
71
|
+
*
|
|
72
|
+
* // Wait for an element to appear
|
|
73
|
+
* await rdp.automation.waitFor('#SaveDialog', { state: 'visible' });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class AutomationController {
|
|
77
|
+
private rdp;
|
|
78
|
+
constructor(rdp: RdpSession);
|
|
79
|
+
/**
|
|
80
|
+
* Take a snapshot of the accessibility tree.
|
|
81
|
+
*
|
|
82
|
+
* Refs are always included (use @eN format to reference elements).
|
|
83
|
+
*/
|
|
84
|
+
snapshot(options?: SnapshotOptions): Promise<AutomationSnapshot>;
|
|
85
|
+
/**
|
|
86
|
+
* Get element properties.
|
|
87
|
+
*/
|
|
88
|
+
get(selector: string, options?: GetOptions): Promise<AutomationElementValue>;
|
|
89
|
+
/**
|
|
90
|
+
* Set focus to an element.
|
|
91
|
+
*/
|
|
92
|
+
focus(selector: string): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Click an element.
|
|
95
|
+
*/
|
|
96
|
+
click(selector: string, options?: ClickOptions): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Double-click an element.
|
|
99
|
+
*/
|
|
100
|
+
doubleClick(selector: string): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Right-click an element.
|
|
103
|
+
*/
|
|
104
|
+
rightClick(selector: string): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Clear and fill text in an element.
|
|
107
|
+
*/
|
|
108
|
+
fill(selector: string, text: string): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Clear text from an element.
|
|
111
|
+
*/
|
|
112
|
+
clear(selector: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Select an item in a ComboBox or ListBox.
|
|
115
|
+
*/
|
|
116
|
+
select(selector: string, item: string): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Check or uncheck a CheckBox or RadioButton.
|
|
119
|
+
*/
|
|
120
|
+
check(selector: string, uncheck?: boolean): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Scroll an element.
|
|
123
|
+
*/
|
|
124
|
+
scroll(selector: string, options?: ScrollOptions): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* List all windows.
|
|
127
|
+
*/
|
|
128
|
+
listWindows(): Promise<AutomationWindowInfo[]>;
|
|
129
|
+
/**
|
|
130
|
+
* Focus a window.
|
|
131
|
+
*/
|
|
132
|
+
focusWindow(selector?: string): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Maximize a window.
|
|
135
|
+
*/
|
|
136
|
+
maximizeWindow(selector?: string): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Minimize a window.
|
|
139
|
+
*/
|
|
140
|
+
minimizeWindow(selector?: string): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Restore a window.
|
|
143
|
+
*/
|
|
144
|
+
restoreWindow(selector?: string): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Close a window.
|
|
147
|
+
*/
|
|
148
|
+
closeWindow(selector?: string): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Run a PowerShell command.
|
|
151
|
+
*/
|
|
152
|
+
run(command: string, options?: RunOptions): Promise<AutomationRunResult>;
|
|
153
|
+
/**
|
|
154
|
+
* Wait for an element to reach a state.
|
|
155
|
+
*/
|
|
156
|
+
waitFor(selector: string, options?: WaitForOptions): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Get automation agent status.
|
|
159
|
+
*/
|
|
160
|
+
status(): Promise<AutomationStatus>;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=automation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automation.d.ts","sourceRoot":"","sources":["../src/automation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,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;IACG,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD;;OAEG;IACG,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAStD;;OAEG;IACG,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAStD;;OAEG;IACG,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASrD;;OAEG;IACG,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD;;OAEG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAYlF;;OAEG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5E;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAO1C"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automation controller for Windows UI Automation.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Automation controller for Windows UI Automation.
|
|
6
|
+
*
|
|
7
|
+
* Provides methods for interacting with Windows applications via the
|
|
8
|
+
* Windows UI Automation API through a PowerShell agent.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Take a snapshot of the accessibility tree
|
|
13
|
+
* const snapshot = await rdp.automation.snapshot();
|
|
14
|
+
* console.log(`Found ${snapshot.ref_count} elements`);
|
|
15
|
+
*
|
|
16
|
+
* // Interactive elements only
|
|
17
|
+
* const interactive = await rdp.automation.snapshot({ interactive: true });
|
|
18
|
+
*
|
|
19
|
+
* // Compact output with depth limit
|
|
20
|
+
* const compact = await rdp.automation.snapshot({ interactive: true, compact: true, depth: 5 });
|
|
21
|
+
*
|
|
22
|
+
* // Click an element by ref number (use @eN format)
|
|
23
|
+
* await rdp.automation.click('@e5');
|
|
24
|
+
*
|
|
25
|
+
* // Fill text in an element
|
|
26
|
+
* await rdp.automation.fill('#SearchBox', 'Hello World');
|
|
27
|
+
*
|
|
28
|
+
* // Wait for an element to appear
|
|
29
|
+
* await rdp.automation.waitFor('#SaveDialog', { state: 'visible' });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export class AutomationController {
|
|
33
|
+
rdp;
|
|
34
|
+
constructor(rdp) {
|
|
35
|
+
this.rdp = rdp;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Take a snapshot of the accessibility tree.
|
|
39
|
+
*
|
|
40
|
+
* Refs are always included (use @eN format to reference elements).
|
|
41
|
+
*/
|
|
42
|
+
async snapshot(options = {}) {
|
|
43
|
+
const request = {
|
|
44
|
+
type: 'automate',
|
|
45
|
+
action: 'snapshot',
|
|
46
|
+
interactive_only: options.interactive ?? false,
|
|
47
|
+
compact: options.compact ?? false,
|
|
48
|
+
max_depth: options.depth ?? 10,
|
|
49
|
+
selector: options.selector,
|
|
50
|
+
};
|
|
51
|
+
const response = await this.rdp._send(request);
|
|
52
|
+
return response.data;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get element properties.
|
|
56
|
+
*/
|
|
57
|
+
async get(selector, options = {}) {
|
|
58
|
+
const request = {
|
|
59
|
+
type: 'automate',
|
|
60
|
+
action: 'get',
|
|
61
|
+
selector,
|
|
62
|
+
property: options.property,
|
|
63
|
+
};
|
|
64
|
+
const response = await this.rdp._send(request);
|
|
65
|
+
return response.data;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Set focus to an element.
|
|
69
|
+
*/
|
|
70
|
+
async focus(selector) {
|
|
71
|
+
await this.rdp._send({
|
|
72
|
+
type: 'automate',
|
|
73
|
+
action: 'focus',
|
|
74
|
+
selector,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Click an element.
|
|
79
|
+
*/
|
|
80
|
+
async click(selector, options = {}) {
|
|
81
|
+
await this.rdp._send({
|
|
82
|
+
type: 'automate',
|
|
83
|
+
action: 'click',
|
|
84
|
+
selector,
|
|
85
|
+
button: options.button ?? 'left',
|
|
86
|
+
double: options.double ?? false,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Double-click an element.
|
|
91
|
+
*/
|
|
92
|
+
async doubleClick(selector) {
|
|
93
|
+
await this.rdp._send({
|
|
94
|
+
type: 'automate',
|
|
95
|
+
action: 'double_click',
|
|
96
|
+
selector,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Right-click an element.
|
|
101
|
+
*/
|
|
102
|
+
async rightClick(selector) {
|
|
103
|
+
await this.rdp._send({
|
|
104
|
+
type: 'automate',
|
|
105
|
+
action: 'right_click',
|
|
106
|
+
selector,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Clear and fill text in an element.
|
|
111
|
+
*/
|
|
112
|
+
async fill(selector, text) {
|
|
113
|
+
await this.rdp._send({
|
|
114
|
+
type: 'automate',
|
|
115
|
+
action: 'fill',
|
|
116
|
+
selector,
|
|
117
|
+
text,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Clear text from an element.
|
|
122
|
+
*/
|
|
123
|
+
async clear(selector) {
|
|
124
|
+
await this.rdp._send({
|
|
125
|
+
type: 'automate',
|
|
126
|
+
action: 'clear',
|
|
127
|
+
selector,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Select an item in a ComboBox or ListBox.
|
|
132
|
+
*/
|
|
133
|
+
async select(selector, item) {
|
|
134
|
+
await this.rdp._send({
|
|
135
|
+
type: 'automate',
|
|
136
|
+
action: 'select',
|
|
137
|
+
selector,
|
|
138
|
+
item,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Check or uncheck a CheckBox or RadioButton.
|
|
143
|
+
*/
|
|
144
|
+
async check(selector, uncheck = false) {
|
|
145
|
+
await this.rdp._send({
|
|
146
|
+
type: 'automate',
|
|
147
|
+
action: 'check',
|
|
148
|
+
selector,
|
|
149
|
+
uncheck,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Scroll an element.
|
|
154
|
+
*/
|
|
155
|
+
async scroll(selector, options = {}) {
|
|
156
|
+
await this.rdp._send({
|
|
157
|
+
type: 'automate',
|
|
158
|
+
action: 'scroll',
|
|
159
|
+
selector,
|
|
160
|
+
direction: options.direction,
|
|
161
|
+
amount: options.amount,
|
|
162
|
+
to_child: options.toChild,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* List all windows.
|
|
167
|
+
*/
|
|
168
|
+
async listWindows() {
|
|
169
|
+
const response = await this.rdp._send({
|
|
170
|
+
type: 'automate',
|
|
171
|
+
action: 'window',
|
|
172
|
+
window_action: 'list',
|
|
173
|
+
});
|
|
174
|
+
const data = response.data;
|
|
175
|
+
return data.windows;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Focus a window.
|
|
179
|
+
*/
|
|
180
|
+
async focusWindow(selector) {
|
|
181
|
+
await this.rdp._send({
|
|
182
|
+
type: 'automate',
|
|
183
|
+
action: 'window',
|
|
184
|
+
window_action: 'focus',
|
|
185
|
+
selector,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Maximize a window.
|
|
190
|
+
*/
|
|
191
|
+
async maximizeWindow(selector) {
|
|
192
|
+
await this.rdp._send({
|
|
193
|
+
type: 'automate',
|
|
194
|
+
action: 'window',
|
|
195
|
+
window_action: 'maximize',
|
|
196
|
+
selector,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Minimize a window.
|
|
201
|
+
*/
|
|
202
|
+
async minimizeWindow(selector) {
|
|
203
|
+
await this.rdp._send({
|
|
204
|
+
type: 'automate',
|
|
205
|
+
action: 'window',
|
|
206
|
+
window_action: 'minimize',
|
|
207
|
+
selector,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Restore a window.
|
|
212
|
+
*/
|
|
213
|
+
async restoreWindow(selector) {
|
|
214
|
+
await this.rdp._send({
|
|
215
|
+
type: 'automate',
|
|
216
|
+
action: 'window',
|
|
217
|
+
window_action: 'restore',
|
|
218
|
+
selector,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Close a window.
|
|
223
|
+
*/
|
|
224
|
+
async closeWindow(selector) {
|
|
225
|
+
await this.rdp._send({
|
|
226
|
+
type: 'automate',
|
|
227
|
+
action: 'window',
|
|
228
|
+
window_action: 'close',
|
|
229
|
+
selector,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Run a PowerShell command.
|
|
234
|
+
*/
|
|
235
|
+
async run(command, options = {}) {
|
|
236
|
+
const response = await this.rdp._send({
|
|
237
|
+
type: 'automate',
|
|
238
|
+
action: 'run',
|
|
239
|
+
command,
|
|
240
|
+
args: options.args ?? [],
|
|
241
|
+
wait: options.wait ?? false,
|
|
242
|
+
hidden: options.hidden ?? true,
|
|
243
|
+
});
|
|
244
|
+
return response.data;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Wait for an element to reach a state.
|
|
248
|
+
*/
|
|
249
|
+
async waitFor(selector, options = {}) {
|
|
250
|
+
await this.rdp._send({
|
|
251
|
+
type: 'automate',
|
|
252
|
+
action: 'wait_for',
|
|
253
|
+
selector,
|
|
254
|
+
timeout_ms: options.timeout ?? 30000,
|
|
255
|
+
state: options.state ?? 'visible',
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Get automation agent status.
|
|
260
|
+
*/
|
|
261
|
+
async status() {
|
|
262
|
+
const response = await this.rdp._send({
|
|
263
|
+
type: 'automate',
|
|
264
|
+
action: 'status',
|
|
265
|
+
});
|
|
266
|
+
return response.data;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=automation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automation.js","sourceRoot":"","sources":["../src/automation.ts"],"names":[],"mappings":"AAAA;;GAEG;AA4DH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,oBAAoB;IACX;IAApB,YAAoB,GAAe;QAAf,QAAG,GAAH,GAAG,CAAY;IAAG,CAAC;IAEvC;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,UAA2B,EAAE;QAC1C,MAAM,OAAO,GAAoB;YAC/B,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,UAAU;YAClB,gBAAgB,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;YAC9C,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK;YACjC,SAAS,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;YAC9B,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,IAAqC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,QAAgB,EAAE,UAAsB,EAAE;QAClD,MAAM,OAAO,GAAoB;YAC/B,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,KAAK;YACb,QAAQ;YACR,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC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AM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;SAC/B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAsC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,QAAgB,EAAE,UAA0B,EAAE;QAC1D,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YACnB,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,UAAU;YAClB,QAAQ;YACR,UAAU,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK;YACpC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,SAAS;SAClC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM;QACV,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YACpC,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAmC,CAAC;IACtD,CAAC;CACF"}
|
package/dist/client.js
CHANGED
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAqB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,uDAAuD;QACvD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;QAClE,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,IAA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EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACrB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC;IAC9B,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,13 +16,15 @@
|
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
18
|
* const { base64 } = await rdp.screenshot();
|
|
19
|
-
* await rdp.mouse.click(100, 200);
|
|
20
|
-
* await rdp.keyboard.type('Hello World');
|
|
19
|
+
* await rdp.mouse.click({ x: 100, y: 200 });
|
|
20
|
+
* await rdp.keyboard.type({ text: 'Hello World' });
|
|
21
21
|
* await rdp.disconnect();
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
import {
|
|
24
|
+
import { AutomationController } from './automation.js';
|
|
25
|
+
import { ConnectOptions, ConnectResult, ScreenshotOptions, ScreenshotResult, SessionInfo, MappedDrive, MouseClickOptions, MouseDragOptions, ScrollOptions, KeyboardTypeOptions, KeyboardPressOptions, ClipboardSetOptions, Request, Response } from './types.js';
|
|
25
26
|
export * from './types.js';
|
|
27
|
+
export { AutomationController } from './automation.js';
|
|
26
28
|
export interface RdpSessionOptions {
|
|
27
29
|
/** Session name (default: 'default') */
|
|
28
30
|
session?: string;
|
|
@@ -38,15 +40,15 @@ export declare class MouseController {
|
|
|
38
40
|
private rdp;
|
|
39
41
|
constructor(rdp: RdpSession);
|
|
40
42
|
/** Move cursor to position. */
|
|
41
|
-
move(
|
|
43
|
+
move(options: MouseClickOptions): Promise<void>;
|
|
42
44
|
/** Left click at position. */
|
|
43
|
-
click(
|
|
45
|
+
click(options: MouseClickOptions): Promise<void>;
|
|
44
46
|
/** Right click at position. */
|
|
45
|
-
rightClick(
|
|
47
|
+
rightClick(options: MouseClickOptions): Promise<void>;
|
|
46
48
|
/** Double click at position. */
|
|
47
|
-
doubleClick(
|
|
49
|
+
doubleClick(options: MouseClickOptions): Promise<void>;
|
|
48
50
|
/** Drag from one position to another. */
|
|
49
|
-
drag(
|
|
51
|
+
drag(options: MouseDragOptions): Promise<void>;
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* Keyboard controller for RDP sessions.
|
|
@@ -55,11 +57,9 @@ export declare class KeyboardController {
|
|
|
55
57
|
private rdp;
|
|
56
58
|
constructor(rdp: RdpSession);
|
|
57
59
|
/** Type a text string (Unicode). */
|
|
58
|
-
type(
|
|
59
|
-
/** Press a key combination (e.g., 'ctrl+c', 'alt+tab'). */
|
|
60
|
-
press(
|
|
61
|
-
/** Press and release a single key. */
|
|
62
|
-
key(key: string): Promise<void>;
|
|
60
|
+
type(options: KeyboardTypeOptions): Promise<void>;
|
|
61
|
+
/** Press a key combination (e.g., 'ctrl+c', 'alt+tab') or single key (e.g., 'enter'). */
|
|
62
|
+
press(options: KeyboardPressOptions): Promise<void>;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Scroll controller for RDP sessions.
|
|
@@ -68,13 +68,13 @@ export declare class ScrollController {
|
|
|
68
68
|
private rdp;
|
|
69
69
|
constructor(rdp: RdpSession);
|
|
70
70
|
/** Scroll up. */
|
|
71
|
-
up(
|
|
71
|
+
up(options?: ScrollOptions): Promise<void>;
|
|
72
72
|
/** Scroll down. */
|
|
73
|
-
down(
|
|
73
|
+
down(options?: ScrollOptions): Promise<void>;
|
|
74
74
|
/** Scroll left. */
|
|
75
|
-
left(
|
|
75
|
+
left(options?: ScrollOptions): Promise<void>;
|
|
76
76
|
/** Scroll right. */
|
|
77
|
-
right(
|
|
77
|
+
right(options?: ScrollOptions): Promise<void>;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Clipboard controller for RDP sessions.
|
|
@@ -85,7 +85,7 @@ export declare class ClipboardController {
|
|
|
85
85
|
/** Get clipboard text. */
|
|
86
86
|
get(): Promise<string>;
|
|
87
87
|
/** Set clipboard text. */
|
|
88
|
-
set(
|
|
88
|
+
set(options: ClipboardSetOptions): Promise<void>;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Drive controller for RDP sessions.
|
|
@@ -110,6 +110,8 @@ export declare class RdpSession {
|
|
|
110
110
|
readonly clipboard: ClipboardController;
|
|
111
111
|
/** Drive controller. */
|
|
112
112
|
readonly drives: DriveController;
|
|
113
|
+
/** Automation controller for Windows UI Automation. */
|
|
114
|
+
readonly automation: AutomationController;
|
|
113
115
|
private session;
|
|
114
116
|
private timeout;
|
|
115
117
|
private streamPort;
|
|
@@ -118,6 +120,17 @@ export declare class RdpSession {
|
|
|
118
120
|
constructor(options?: RdpSessionOptions);
|
|
119
121
|
/**
|
|
120
122
|
* Connect to an RDP server.
|
|
123
|
+
*
|
|
124
|
+
* @param options Connection options
|
|
125
|
+
* @param options.host Server hostname or IP
|
|
126
|
+
* @param options.port Server port (default: 3389)
|
|
127
|
+
* @param options.username Username for authentication
|
|
128
|
+
* @param options.password Password for authentication
|
|
129
|
+
* @param options.domain Optional domain
|
|
130
|
+
* @param options.width Desktop width (default: 1280)
|
|
131
|
+
* @param options.height Desktop height (default: 800)
|
|
132
|
+
* @param options.drives Drives to map
|
|
133
|
+
* @param options.enableWinAutomation Enable Windows UI Automation
|
|
121
134
|
*/
|
|
122
135
|
connect(options: ConnectOptions): Promise<ConnectResult>;
|
|
123
136
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EACL,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,OAAO,EACP,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAA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IAE1C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAA0B;gBAE5B,OAAO,GAAE,iBAAsB;IAc3C;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA2B9D;;OAEG;IACG,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsB5E;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAwBrC;;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
CHANGED
|
@@ -16,15 +16,17 @@
|
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
18
|
* const { base64 } = await rdp.screenshot();
|
|
19
|
-
* await rdp.mouse.click(100, 200);
|
|
20
|
-
* await rdp.keyboard.type('Hello World');
|
|
19
|
+
* await rdp.mouse.click({ x: 100, y: 200 });
|
|
20
|
+
* await rdp.keyboard.type({ text: 'Hello World' });
|
|
21
21
|
* await rdp.disconnect();
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
import { DaemonManager } from './daemon.js';
|
|
25
|
+
import { AutomationController } from './automation.js';
|
|
25
26
|
import { RdpError, } from './types.js';
|
|
26
27
|
// Re-export types
|
|
27
28
|
export * from './types.js';
|
|
29
|
+
export { AutomationController } from './automation.js';
|
|
28
30
|
/**
|
|
29
31
|
* Mouse controller for RDP sessions.
|
|
30
32
|
*/
|
|
@@ -34,30 +36,30 @@ export class MouseController {
|
|
|
34
36
|
this.rdp = rdp;
|
|
35
37
|
}
|
|
36
38
|
/** Move cursor to position. */
|
|
37
|
-
async move(
|
|
38
|
-
await this.rdp._send({ type: 'mouse', action: 'move', x, y });
|
|
39
|
+
async move(options) {
|
|
40
|
+
await this.rdp._send({ type: 'mouse', action: 'move', x: options.x, y: options.y });
|
|
39
41
|
}
|
|
40
42
|
/** Left click at position. */
|
|
41
|
-
async click(
|
|
42
|
-
await this.rdp._send({ type: 'mouse', action: 'click', x, y });
|
|
43
|
+
async click(options) {
|
|
44
|
+
await this.rdp._send({ type: 'mouse', action: 'click', x: options.x, y: options.y });
|
|
43
45
|
}
|
|
44
46
|
/** Right click at position. */
|
|
45
|
-
async rightClick(
|
|
46
|
-
await this.rdp._send({ type: 'mouse', action: 'right_click', x, y });
|
|
47
|
+
async rightClick(options) {
|
|
48
|
+
await this.rdp._send({ type: 'mouse', action: 'right_click', x: options.x, y: options.y });
|
|
47
49
|
}
|
|
48
50
|
/** Double click at position. */
|
|
49
|
-
async doubleClick(
|
|
50
|
-
await this.rdp._send({ type: 'mouse', action: 'double_click', x, y });
|
|
51
|
+
async doubleClick(options) {
|
|
52
|
+
await this.rdp._send({ type: 'mouse', action: 'double_click', x: options.x, y: options.y });
|
|
51
53
|
}
|
|
52
54
|
/** Drag from one position to another. */
|
|
53
|
-
async drag(
|
|
55
|
+
async drag(options) {
|
|
54
56
|
await this.rdp._send({
|
|
55
57
|
type: 'mouse',
|
|
56
58
|
action: 'drag',
|
|
57
|
-
from_x:
|
|
58
|
-
from_y:
|
|
59
|
-
to_x:
|
|
60
|
-
to_y:
|
|
59
|
+
from_x: options.from.x,
|
|
60
|
+
from_y: options.from.y,
|
|
61
|
+
to_x: options.to.x,
|
|
62
|
+
to_y: options.to.y,
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -70,16 +72,12 @@ export class KeyboardController {
|
|
|
70
72
|
this.rdp = rdp;
|
|
71
73
|
}
|
|
72
74
|
/** Type a text string (Unicode). */
|
|
73
|
-
async type(
|
|
74
|
-
await this.rdp._send({ type: 'keyboard', action: 'type', text });
|
|
75
|
+
async type(options) {
|
|
76
|
+
await this.rdp._send({ type: 'keyboard', action: 'type', text: options.text });
|
|
75
77
|
}
|
|
76
|
-
/** Press a key combination (e.g., 'ctrl+c', 'alt+tab'). */
|
|
77
|
-
async press(
|
|
78
|
-
await this.rdp._send({ type: 'keyboard', action: 'press', keys });
|
|
79
|
-
}
|
|
80
|
-
/** Press and release a single key. */
|
|
81
|
-
async key(key) {
|
|
82
|
-
await this.rdp._send({ type: 'keyboard', action: 'key', key });
|
|
78
|
+
/** Press a key combination (e.g., 'ctrl+c', 'alt+tab') or single key (e.g., 'enter'). */
|
|
79
|
+
async press(options) {
|
|
80
|
+
await this.rdp._send({ type: 'keyboard', action: 'press', keys: options.keys });
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
/**
|
|
@@ -91,20 +89,20 @@ export class ScrollController {
|
|
|
91
89
|
this.rdp = rdp;
|
|
92
90
|
}
|
|
93
91
|
/** Scroll up. */
|
|
94
|
-
async up(
|
|
95
|
-
await this.rdp._send({ type: 'scroll', direction: 'up', amount, x, y });
|
|
92
|
+
async up(options = {}) {
|
|
93
|
+
await this.rdp._send({ type: 'scroll', direction: 'up', amount: options.amount ?? 3, x: options.x, y: options.y });
|
|
96
94
|
}
|
|
97
95
|
/** Scroll down. */
|
|
98
|
-
async down(
|
|
99
|
-
await this.rdp._send({ type: 'scroll', direction: 'down', amount, x, y });
|
|
96
|
+
async down(options = {}) {
|
|
97
|
+
await this.rdp._send({ type: 'scroll', direction: 'down', amount: options.amount ?? 3, x: options.x, y: options.y });
|
|
100
98
|
}
|
|
101
99
|
/** Scroll left. */
|
|
102
|
-
async left(
|
|
103
|
-
await this.rdp._send({ type: 'scroll', direction: 'left', amount, x, y });
|
|
100
|
+
async left(options = {}) {
|
|
101
|
+
await this.rdp._send({ type: 'scroll', direction: 'left', amount: options.amount ?? 3, x: options.x, y: options.y });
|
|
104
102
|
}
|
|
105
103
|
/** Scroll right. */
|
|
106
|
-
async right(
|
|
107
|
-
await this.rdp._send({ type: 'scroll', direction: 'right', amount, x, y });
|
|
104
|
+
async right(options = {}) {
|
|
105
|
+
await this.rdp._send({ type: 'scroll', direction: 'right', amount: options.amount ?? 3, x: options.x, y: options.y });
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
/**
|
|
@@ -122,8 +120,8 @@ export class ClipboardController {
|
|
|
122
120
|
return data.text;
|
|
123
121
|
}
|
|
124
122
|
/** Set clipboard text. */
|
|
125
|
-
async set(
|
|
126
|
-
await this.rdp._send({ type: 'clipboard', action: 'set', text });
|
|
123
|
+
async set(options) {
|
|
124
|
+
await this.rdp._send({ type: 'clipboard', action: 'set', text: options.text });
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
/**
|
|
@@ -155,6 +153,8 @@ export class RdpSession {
|
|
|
155
153
|
clipboard;
|
|
156
154
|
/** Drive controller. */
|
|
157
155
|
drives;
|
|
156
|
+
/** Automation controller for Windows UI Automation. */
|
|
157
|
+
automation;
|
|
158
158
|
session;
|
|
159
159
|
timeout;
|
|
160
160
|
streamPort;
|
|
@@ -170,9 +170,21 @@ export class RdpSession {
|
|
|
170
170
|
this.scroll = new ScrollController(this);
|
|
171
171
|
this.clipboard = new ClipboardController(this);
|
|
172
172
|
this.drives = new DriveController(this);
|
|
173
|
+
this.automation = new AutomationController(this);
|
|
173
174
|
}
|
|
174
175
|
/**
|
|
175
176
|
* Connect to an RDP server.
|
|
177
|
+
*
|
|
178
|
+
* @param options Connection options
|
|
179
|
+
* @param options.host Server hostname or IP
|
|
180
|
+
* @param options.port Server port (default: 3389)
|
|
181
|
+
* @param options.username Username for authentication
|
|
182
|
+
* @param options.password Password for authentication
|
|
183
|
+
* @param options.domain Optional domain
|
|
184
|
+
* @param options.width Desktop width (default: 1280)
|
|
185
|
+
* @param options.height Desktop height (default: 800)
|
|
186
|
+
* @param options.drives Drives to map
|
|
187
|
+
* @param options.enableWinAutomation Enable Windows UI Automation
|
|
176
188
|
*/
|
|
177
189
|
async connect(options) {
|
|
178
190
|
// Ensure daemon is running and connect
|
|
@@ -187,6 +199,7 @@ export class RdpSession {
|
|
|
187
199
|
width: options.width ?? 1280,
|
|
188
200
|
height: options.height ?? 800,
|
|
189
201
|
drives: options.drives ?? [],
|
|
202
|
+
enable_win_automation: options.enableWinAutomation,
|
|
190
203
|
};
|
|
191
204
|
const response = await this._send(request);
|
|
192
205
|
const data = response.data;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAeL,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAWvD;;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,EA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AAE,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK,CAAC,OAAgB;QAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,0CAA0C;YAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAClD,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE/D,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,MAAM,IAAI,QAAQ,CAChB,QAAQ,CAAC,KAAK,EAAE,IAAI,IAAI,gBAAgB,EACxC,QAAQ,CAAC,KAAK,EAAE,OAAO,IAAI,eAAe,CAC3C,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface ConnectOptions {
|
|
|
10
10
|
width?: number;
|
|
11
11
|
height?: number;
|
|
12
12
|
drives?: DriveMapping[];
|
|
13
|
+
/** Enable Windows UI Automation. */
|
|
14
|
+
enableWinAutomation?: boolean;
|
|
13
15
|
}
|
|
14
16
|
export interface DriveMapping {
|
|
15
17
|
path: string;
|
|
@@ -43,6 +45,45 @@ export interface MappedDrive {
|
|
|
43
45
|
name: string;
|
|
44
46
|
path: string;
|
|
45
47
|
}
|
|
48
|
+
/** A point representing x,y coordinates. */
|
|
49
|
+
export interface Point {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
}
|
|
53
|
+
/** Options for mouse click operations. */
|
|
54
|
+
export interface MouseClickOptions {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
}
|
|
58
|
+
/** Options for mouse drag operations. */
|
|
59
|
+
export interface MouseDragOptions {
|
|
60
|
+
from: Point;
|
|
61
|
+
to: Point;
|
|
62
|
+
}
|
|
63
|
+
/** Options for scroll operations. */
|
|
64
|
+
export interface ScrollOptions {
|
|
65
|
+
/** Amount to scroll (default: 3). */
|
|
66
|
+
amount?: number;
|
|
67
|
+
/** X coordinate (optional). */
|
|
68
|
+
x?: number;
|
|
69
|
+
/** Y coordinate (optional). */
|
|
70
|
+
y?: number;
|
|
71
|
+
}
|
|
72
|
+
/** Options for keyboard type operations. */
|
|
73
|
+
export interface KeyboardTypeOptions {
|
|
74
|
+
/** Text to type. */
|
|
75
|
+
text: string;
|
|
76
|
+
}
|
|
77
|
+
/** Options for keyboard press operations. */
|
|
78
|
+
export interface KeyboardPressOptions {
|
|
79
|
+
/** Key combination (e.g., 'ctrl+c') or single key (e.g., 'enter'). */
|
|
80
|
+
keys: string;
|
|
81
|
+
}
|
|
82
|
+
/** Options for clipboard set operations. */
|
|
83
|
+
export interface ClipboardSetOptions {
|
|
84
|
+
/** Text to set. */
|
|
85
|
+
text: string;
|
|
86
|
+
}
|
|
46
87
|
export interface ConnectRequest {
|
|
47
88
|
type: 'connect';
|
|
48
89
|
host: string;
|
|
@@ -53,6 +94,7 @@ export interface ConnectRequest {
|
|
|
53
94
|
width: number;
|
|
54
95
|
height: number;
|
|
55
96
|
drives: DriveMapping[];
|
|
97
|
+
enable_win_automation?: boolean;
|
|
56
98
|
}
|
|
57
99
|
export interface ScreenshotRequest {
|
|
58
100
|
type: 'screenshot';
|
|
@@ -101,12 +143,7 @@ export interface KeyboardPressRequest {
|
|
|
101
143
|
action: 'press';
|
|
102
144
|
keys: string;
|
|
103
145
|
}
|
|
104
|
-
export
|
|
105
|
-
type: 'keyboard';
|
|
106
|
-
action: 'key';
|
|
107
|
-
key: string;
|
|
108
|
-
}
|
|
109
|
-
export type KeyboardRequest = KeyboardTypeRequest | KeyboardPressRequest | KeyboardKeyRequest;
|
|
146
|
+
export type KeyboardRequest = KeyboardTypeRequest | KeyboardPressRequest;
|
|
110
147
|
export interface ScrollRequest {
|
|
111
148
|
type: 'scroll';
|
|
112
149
|
direction: 'up' | 'down' | 'left' | 'right';
|
|
@@ -137,8 +174,13 @@ export interface SessionInfoRequest {
|
|
|
137
174
|
export interface PingRequest {
|
|
138
175
|
type: 'ping';
|
|
139
176
|
}
|
|
140
|
-
export
|
|
141
|
-
|
|
177
|
+
export interface AutomateRequest {
|
|
178
|
+
type: 'automate';
|
|
179
|
+
action: string;
|
|
180
|
+
[key: string]: unknown;
|
|
181
|
+
}
|
|
182
|
+
export type Request = ConnectRequest | ScreenshotRequest | MouseRequest | KeyboardRequest | ScrollRequest | ClipboardRequest | DriveListRequest | DisconnectRequest | SessionInfoRequest | PingRequest | AutomateRequest;
|
|
183
|
+
export type ErrorCode = 'not_connected' | 'already_connected' | 'connection_failed' | 'authentication_failed' | 'timeout' | 'invalid_request' | 'not_supported' | 'internal_error' | 'session_not_found' | 'ipc_error' | 'daemon_not_running' | 'clipboard_error' | 'drive_error' | 'automation_not_enabled' | 'automation_error' | 'element_not_found' | 'stale_ref' | 'command_failed';
|
|
142
184
|
export interface ErrorInfo {
|
|
143
185
|
code: ErrorCode;
|
|
144
186
|
message: string;
|
|
@@ -186,6 +228,59 @@ export interface Response {
|
|
|
186
228
|
data?: ResponseData;
|
|
187
229
|
error?: ErrorInfo;
|
|
188
230
|
}
|
|
231
|
+
export interface AutomationElementBounds {
|
|
232
|
+
x: number;
|
|
233
|
+
y: number;
|
|
234
|
+
width: number;
|
|
235
|
+
height: number;
|
|
236
|
+
}
|
|
237
|
+
export interface AutomationElement {
|
|
238
|
+
ref?: number;
|
|
239
|
+
role: string;
|
|
240
|
+
name?: string;
|
|
241
|
+
automation_id?: string;
|
|
242
|
+
class_name?: string;
|
|
243
|
+
bounds?: AutomationElementBounds;
|
|
244
|
+
states?: string[];
|
|
245
|
+
value?: string;
|
|
246
|
+
patterns?: string[];
|
|
247
|
+
children?: AutomationElement[];
|
|
248
|
+
}
|
|
249
|
+
export interface AutomationSnapshot {
|
|
250
|
+
type: 'snapshot';
|
|
251
|
+
snapshot_id: string;
|
|
252
|
+
ref_count: number;
|
|
253
|
+
root: AutomationElement;
|
|
254
|
+
}
|
|
255
|
+
export interface AutomationElementValue {
|
|
256
|
+
type: 'element';
|
|
257
|
+
name?: string;
|
|
258
|
+
value?: string;
|
|
259
|
+
states?: string[];
|
|
260
|
+
bounds?: AutomationElementBounds;
|
|
261
|
+
}
|
|
262
|
+
export interface AutomationWindowInfo {
|
|
263
|
+
title: string;
|
|
264
|
+
process_name?: string;
|
|
265
|
+
process_id?: number;
|
|
266
|
+
bounds?: AutomationElementBounds;
|
|
267
|
+
minimized?: boolean;
|
|
268
|
+
maximized?: boolean;
|
|
269
|
+
}
|
|
270
|
+
export interface AutomationStatus {
|
|
271
|
+
type: 'automation_status';
|
|
272
|
+
agent_running: boolean;
|
|
273
|
+
agent_pid?: number;
|
|
274
|
+
capabilities?: string[];
|
|
275
|
+
version?: string;
|
|
276
|
+
}
|
|
277
|
+
export interface AutomationRunResult {
|
|
278
|
+
type: 'run_result';
|
|
279
|
+
exit_code?: number;
|
|
280
|
+
stdout?: string;
|
|
281
|
+
stderr?: string;
|
|
282
|
+
pid?: number;
|
|
283
|
+
}
|
|
189
284
|
export declare class RdpError extends Error {
|
|
190
285
|
code: ErrorCode;
|
|
191
286
|
constructor(code: ErrorCode, message: string);
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,EAAE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,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAID,qBAAa,QAAS,SAAQ,KAAK;IAExB,IAAI,EAAE,SAAS;gBAAf,IAAI,EAAE,SAAS,EACtB,OAAO,EAAE,MAAM;CAKlB"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAyYH,sBAAsB;AAEtB,MAAM,OAAO,QAAS,SAAQ,KAAK;IAExB;IADT,YACS,IAAe,EACtB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAW;QAItB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-rdp",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "CLI tool for AI agents to control Windows Remote Desktop sessions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,10 @@
|
|
|
30
30
|
"build": "cargo build --release && node scripts/copy-native.cjs",
|
|
31
31
|
"build:all": "node scripts/build-all.cjs",
|
|
32
32
|
"prepublishOnly": "npm run build:ts",
|
|
33
|
-
"example": "tsx examples/hello-world.ts"
|
|
33
|
+
"example": "tsx examples/typescript/hello-world.ts",
|
|
34
|
+
"lint": "eslint src examples",
|
|
35
|
+
"lint:fix": "eslint src examples --fix",
|
|
36
|
+
"lint:ps1": "pwsh -NoProfile -File scripts/lint-ps1.ps1"
|
|
34
37
|
},
|
|
35
38
|
"keywords": [
|
|
36
39
|
"rdp",
|
|
@@ -46,6 +49,9 @@
|
|
|
46
49
|
"homepage": "https://github.com/thisnick/agent-rdp#readme",
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@types/node": "^20.0.0",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
|
53
|
+
"@typescript-eslint/parser": "^8.53.1",
|
|
54
|
+
"eslint": "^9.39.2",
|
|
49
55
|
"tsx": "^4.7.0",
|
|
50
56
|
"typescript": "^5.3.0"
|
|
51
57
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
# Lint PowerShell scripts using PSScriptAnalyzer
|
|
3
|
+
|
|
4
|
+
$ErrorActionPreference = "Stop"
|
|
5
|
+
|
|
6
|
+
# Install PSScriptAnalyzer if not present
|
|
7
|
+
if (-not (Get-Module -ListAvailable -Name PSScriptAnalyzer)) {
|
|
8
|
+
Write-Host "Installing PSScriptAnalyzer..."
|
|
9
|
+
Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
# Run analysis on automation scripts
|
|
13
|
+
$scriptsPath = Join-Path $PSScriptRoot ".." "crates" "agent-rdp-daemon" "src" "automation" "scripts"
|
|
14
|
+
$settingsPath = Join-Path $scriptsPath "PSScriptAnalyzerSettings.psd1"
|
|
15
|
+
|
|
16
|
+
Write-Host "Analyzing PowerShell scripts in: $scriptsPath"
|
|
17
|
+
Write-Host "Using settings: $settingsPath"
|
|
18
|
+
|
|
19
|
+
$results = Invoke-ScriptAnalyzer -Path $scriptsPath -Recurse -Settings $settingsPath
|
|
20
|
+
|
|
21
|
+
if ($results.Count -gt 0) {
|
|
22
|
+
$results | Format-Table -Property Severity, RuleName, ScriptName, Line, Message -AutoSize
|
|
23
|
+
Write-Error "PSScriptAnalyzer found $($results.Count) issues"
|
|
24
|
+
exit 1
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Write-Host "No issues found in PowerShell scripts" -ForegroundColor Green
|
|
28
|
+
exit 0
|
package/bin/agent-rdp
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# agent-rdp CLI wrapper
|
|
3
|
-
# Detects OS/arch and runs the appropriate native binary
|
|
4
|
-
|
|
5
|
-
SCRIPT="$0"
|
|
6
|
-
while [ -L "$SCRIPT" ]; do
|
|
7
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
|
|
8
|
-
SCRIPT="$(readlink "$SCRIPT")"
|
|
9
|
-
case "$SCRIPT" in /*) ;; *) SCRIPT="$SCRIPT_DIR/$SCRIPT" ;; esac
|
|
10
|
-
done
|
|
11
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
|
|
12
|
-
|
|
13
|
-
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
14
|
-
ARCH=$(uname -m)
|
|
15
|
-
case "$OS" in darwin) OS="darwin" ;; linux) OS="linux" ;; mingw*|msys*|cygwin*) OS="win32" ;; esac
|
|
16
|
-
case "$ARCH" in x86_64|amd64) ARCH="x64" ;; aarch64|arm64) ARCH="arm64" ;; esac
|
|
17
|
-
|
|
18
|
-
BINARY="$SCRIPT_DIR/agent-rdp-${OS}-${ARCH}"
|
|
19
|
-
|
|
20
|
-
if [ -f "$BINARY" ] && [ -x "$BINARY" ]; then
|
|
21
|
-
exec "$BINARY" "$@"
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
echo "Error: No binary found for ${OS}-${ARCH}" >&2
|
|
25
|
-
echo "Expected: $BINARY" >&2
|
|
26
|
-
echo "" >&2
|
|
27
|
-
echo "To build locally:" >&2
|
|
28
|
-
echo " 1. Install Rust: https://rustup.rs" >&2
|
|
29
|
-
echo " 2. Run: npm run build:native" >&2
|
|
30
|
-
exit 1
|
package/bin/agent-rdp.cmd
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
:: agent-rdp CLI wrapper for Windows
|
|
3
|
-
setlocal
|
|
4
|
-
|
|
5
|
-
set "SCRIPT_DIR=%~dp0"
|
|
6
|
-
set "BINARY=%SCRIPT_DIR%agent-rdp-win32-x64.exe"
|
|
7
|
-
|
|
8
|
-
if exist "%BINARY%" (
|
|
9
|
-
"%BINARY%" %*
|
|
10
|
-
exit /b %ERRORLEVEL%
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
echo Error: No binary found for win32-x64 >&2
|
|
14
|
-
echo Expected: %BINARY% >&2
|
|
15
|
-
echo. >&2
|
|
16
|
-
echo To build locally: >&2
|
|
17
|
-
echo 1. Install Rust: https://rustup.rs >&2
|
|
18
|
-
echo 2. Run: npm run build:native >&2
|
|
19
|
-
exit /b 1
|