@midscene/computer 1.9.2-beta-20260608084200.0 → 1.9.2

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.
@@ -30,6 +30,8 @@ declare class ComputerDevice implements AbstractInterface {
30
30
  * to avoid focus issues with system overlays (e.g. Spotlight).
31
31
  */
32
32
  private useAppleScript;
33
+ /** Cached result of the elevation check; see isRunningAsAdmin(). */
34
+ private adminCheckCache?;
33
35
  uri?: string;
34
36
  readonly inputPrimitives: ComputerInputPrimitives;
35
37
  constructor(options?: ComputerDeviceOpt);
@@ -43,6 +45,10 @@ declare class ComputerDevice implements AbstractInterface {
43
45
  /**
44
46
  * Check if the current process is running with Administrator privileges.
45
47
  * Uses "net session" which succeeds only when elevated.
48
+ *
49
+ * The result is cached because elevation cannot change during the process
50
+ * lifetime, and the underlying `execSync('net session')` is a blocking
51
+ * subprocess spawn that should not run on every connect / health check.
46
52
  */
47
53
  private isRunningAsAdmin;
48
54
  screenshotBase64(): Promise<string>;
@@ -12,14 +12,6 @@ namespace midscene::rdp {
12
12
 
13
13
  namespace {
14
14
 
15
- std::string NormalizeRdpHost(std::string_view host) {
16
- if (host.size() >= 2 && host.front() == '[' && host.back() == ']' &&
17
- host.find(':') != std::string_view::npos) {
18
- return std::string(host.substr(1, host.size() - 2));
19
- }
20
- return std::string(host);
21
- }
22
-
23
15
  ConnectionConfig ParseConnectionConfig(const JsonObject& payload) {
24
16
  const JsonObject* config = GetObjectField(payload, "config");
25
17
  if (!config) {
@@ -32,7 +24,7 @@ ConnectionConfig ParseConnectionConfig(const JsonObject& payload) {
32
24
  }
33
25
 
34
26
  ConnectionConfig parsed;
35
- parsed.host = NormalizeRdpHost(*host);
27
+ parsed.host = *host;
36
28
  if (const auto port = GetIntField(*config, "port"); port.has_value()) {
37
29
  parsed.port = static_cast<uint16_t>(*port);
38
30
  }
@@ -186,18 +186,6 @@ std::string GenerateSessionId() {
186
186
  return session_id.str();
187
187
  }
188
188
 
189
- std::string FormatServerAddress(std::string_view host, UINT32 port) {
190
- std::ostringstream server;
191
- if (host.find(':') != std::string_view::npos &&
192
- !(host.size() >= 2 && host.front() == '[' && host.back() == ']')) {
193
- server << '[' << host << ']';
194
- } else {
195
- server << host;
196
- }
197
- server << ':' << port;
198
- return server.str();
199
- }
200
-
201
189
  DWORD VerifyCertificateEx(freerdp* instance,
202
190
  const char* host,
203
191
  UINT16 port,
@@ -600,7 +588,9 @@ ConnectionInfo FreeRdpSessionTransport::Connect(const ConnectionConfig& config)
600
588
  const char* host = freerdp_settings_get_server_name(settings);
601
589
  const UINT32 port =
602
590
  freerdp_settings_get_uint32(settings, FreeRDP_ServerPort);
603
- info.server = FormatServerAddress(host ? host : "", port);
591
+ std::ostringstream server;
592
+ server << (host ? host : "") << ":" << port;
593
+ info.server = server.str();
604
594
  if (instance_->context && instance_->context->gdi) {
605
595
  info.size.width = instance_->context->gdi->width;
606
596
  info.size.height = instance_->context->gdi->height;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/computer",
3
- "version": "1.9.2-beta-20260608084200.0",
3
+ "version": "1.9.2",
4
4
  "description": "Midscene.js Computer Desktop Automation",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "@computer-use/libnut": "^4.2.0",
39
39
  "clipboardy": "^4.0.0",
40
40
  "screenshot-desktop": "^1.15.3",
41
- "@midscene/shared": "1.9.2-beta-20260608084200.0",
42
- "@midscene/core": "1.9.2-beta-20260608084200.0"
41
+ "@midscene/core": "1.9.2",
42
+ "@midscene/shared": "1.9.2"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "node-mac-permissions": "2.5.0"