@midscene/computer 1.10.5 → 1.10.6-beta-20260716090839.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.
- package/bin/linux/rdp-helper +0 -0
- package/dist/es/cli.mjs +2 -2
- package/dist/es/index.mjs +2 -2
- package/dist/lib/cli.js +2 -2
- package/dist/lib/index.js +2 -2
- package/native/rdp/CMakeLists.txt +20 -0
- package/native/rdp/include/rdp_helper_connection_policy.hpp +14 -0
- package/native/rdp/src/session.cpp +20 -0
- package/native/rdp/tests/connection_policy_test.cpp +35 -0
- package/package.json +3 -3
package/bin/linux/rdp-helper
CHANGED
|
Binary file
|
package/dist/es/cli.mjs
CHANGED
|
@@ -731,7 +731,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
731
731
|
}
|
|
732
732
|
async healthCheck() {
|
|
733
733
|
console.log('[HealthCheck] Starting health check...');
|
|
734
|
-
console.log("[HealthCheck] @midscene/computer v1.10.
|
|
734
|
+
console.log("[HealthCheck] @midscene/computer v1.10.6-beta-20260716090839.0");
|
|
735
735
|
console.log('[HealthCheck] Taking screenshot...');
|
|
736
736
|
const screenshotTimeout = 15000;
|
|
737
737
|
let timeoutId;
|
|
@@ -2124,7 +2124,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
|
|
|
2124
2124
|
const tools = new ComputerMidsceneTools();
|
|
2125
2125
|
runToolsCLI(tools, 'midscene-computer', {
|
|
2126
2126
|
stripPrefix: 'computer_',
|
|
2127
|
-
version: "1.10.
|
|
2127
|
+
version: "1.10.6-beta-20260716090839.0",
|
|
2128
2128
|
extraCommands: createReportCliCommands()
|
|
2129
2129
|
}).catch((e)=>{
|
|
2130
2130
|
process.exit(reportCLIError(e));
|
package/dist/es/index.mjs
CHANGED
|
@@ -731,7 +731,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
731
731
|
}
|
|
732
732
|
async healthCheck() {
|
|
733
733
|
console.log('[HealthCheck] Starting health check...');
|
|
734
|
-
console.log("[HealthCheck] @midscene/computer v1.10.
|
|
734
|
+
console.log("[HealthCheck] @midscene/computer v1.10.6-beta-20260716090839.0");
|
|
735
735
|
console.log('[HealthCheck] Taking screenshot...');
|
|
736
736
|
const screenshotTimeout = 15000;
|
|
737
737
|
let timeoutId;
|
|
@@ -2165,7 +2165,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
|
|
|
2165
2165
|
}
|
|
2166
2166
|
}
|
|
2167
2167
|
function version() {
|
|
2168
|
-
const currentVersion = "1.10.
|
|
2168
|
+
const currentVersion = "1.10.6-beta-20260716090839.0";
|
|
2169
2169
|
console.log(`@midscene/computer v${currentVersion}`);
|
|
2170
2170
|
return currentVersion;
|
|
2171
2171
|
}
|
package/dist/lib/cli.js
CHANGED
|
@@ -757,7 +757,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
757
757
|
}
|
|
758
758
|
async healthCheck() {
|
|
759
759
|
console.log('[HealthCheck] Starting health check...');
|
|
760
|
-
console.log("[HealthCheck] @midscene/computer v1.10.
|
|
760
|
+
console.log("[HealthCheck] @midscene/computer v1.10.6-beta-20260716090839.0");
|
|
761
761
|
console.log('[HealthCheck] Taking screenshot...');
|
|
762
762
|
const screenshotTimeout = 15000;
|
|
763
763
|
let timeoutId;
|
|
@@ -2151,7 +2151,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2151
2151
|
const tools = new ComputerMidsceneTools();
|
|
2152
2152
|
(0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-computer', {
|
|
2153
2153
|
stripPrefix: 'computer_',
|
|
2154
|
-
version: "1.10.
|
|
2154
|
+
version: "1.10.6-beta-20260716090839.0",
|
|
2155
2155
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
2156
2156
|
}).catch((e)=>{
|
|
2157
2157
|
process.exit((0, cli_namespaceObject.reportCLIError)(e));
|
package/dist/lib/index.js
CHANGED
|
@@ -783,7 +783,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
783
783
|
}
|
|
784
784
|
async healthCheck() {
|
|
785
785
|
console.log('[HealthCheck] Starting health check...');
|
|
786
|
-
console.log("[HealthCheck] @midscene/computer v1.10.
|
|
786
|
+
console.log("[HealthCheck] @midscene/computer v1.10.6-beta-20260716090839.0");
|
|
787
787
|
console.log('[HealthCheck] Taking screenshot...');
|
|
788
788
|
const screenshotTimeout = 15000;
|
|
789
789
|
let timeoutId;
|
|
@@ -2223,7 +2223,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2223
2223
|
}
|
|
2224
2224
|
const env_namespaceObject = require("@midscene/shared/env");
|
|
2225
2225
|
function version() {
|
|
2226
|
-
const currentVersion = "1.10.
|
|
2226
|
+
const currentVersion = "1.10.6-beta-20260716090839.0";
|
|
2227
2227
|
console.log(`@midscene/computer v${currentVersion}`);
|
|
2228
2228
|
return currentVersion;
|
|
2229
2229
|
}
|
|
@@ -58,6 +58,26 @@ target_link_libraries(
|
|
|
58
58
|
Threads::Threads
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
+
include(CTest)
|
|
62
|
+
|
|
63
|
+
if(BUILD_TESTING)
|
|
64
|
+
add_executable(
|
|
65
|
+
rdp-connection-policy-test
|
|
66
|
+
tests/connection_policy_test.cpp
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
target_include_directories(
|
|
70
|
+
rdp-connection-policy-test
|
|
71
|
+
PRIVATE
|
|
72
|
+
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
add_test(
|
|
76
|
+
NAME rdp-connection-policy-test
|
|
77
|
+
COMMAND rdp-connection-policy-test
|
|
78
|
+
)
|
|
79
|
+
endif()
|
|
80
|
+
|
|
61
81
|
if(APPLE)
|
|
62
82
|
target_compile_definitions(rdp-helper PRIVATE _DARWIN_C_SOURCE)
|
|
63
83
|
endif()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <string_view>
|
|
4
|
+
|
|
5
|
+
namespace midscene::rdp {
|
|
6
|
+
|
|
7
|
+
constexpr bool ShouldRetryAutoWithRdp(std::string_view security_protocol,
|
|
8
|
+
bool transport_failed,
|
|
9
|
+
bool using_rdp_security_layer) noexcept {
|
|
10
|
+
return security_protocol == "auto" && transport_failed &&
|
|
11
|
+
using_rdp_security_layer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
} // namespace midscene::rdp
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
#include <freerdp/transport_io.h>
|
|
37
37
|
#include <winpr/synch.h>
|
|
38
38
|
|
|
39
|
+
#include "rdp_helper_connection_policy.hpp"
|
|
40
|
+
|
|
39
41
|
namespace midscene::rdp {
|
|
40
42
|
|
|
41
43
|
namespace {
|
|
@@ -992,8 +994,26 @@ ConnectionInfo FreeRdpSessionTransport::Connect(const ConnectionConfig& config)
|
|
|
992
994
|
}
|
|
993
995
|
|
|
994
996
|
if (!connected) {
|
|
997
|
+
const UINT32 last_error_code =
|
|
998
|
+
freerdp_get_last_error(instance_->context);
|
|
999
|
+
const bool using_rdp_security_layer =
|
|
1000
|
+
freerdp_settings_get_bool(settings, FreeRDP_UseRdpSecurityLayer) ==
|
|
1001
|
+
TRUE;
|
|
1002
|
+
const bool retry_with_rdp = ShouldRetryAutoWithRdp(
|
|
1003
|
+
config.security_protocol,
|
|
1004
|
+
last_error_code == FREERDP_ERROR_CONNECT_TRANSPORT_FAILED,
|
|
1005
|
+
using_rdp_security_layer);
|
|
995
1006
|
const std::string error = LastFreeRdpErrorLocked();
|
|
996
1007
|
StopInstance(false);
|
|
1008
|
+
if (retry_with_rdp) {
|
|
1009
|
+
// Some RDP-only servers reject the initial TLS/NLA negotiation. FreeRDP
|
|
1010
|
+
// can then carry stale transport state into its RDP fallback and fail
|
|
1011
|
+
// while parsing the encrypted Demand Active PDU. A fresh instance forced
|
|
1012
|
+
// to the protocol FreeRDP already selected avoids that corrupted state.
|
|
1013
|
+
ConnectionConfig retry_config = config;
|
|
1014
|
+
retry_config.security_protocol = "rdp";
|
|
1015
|
+
return Connect(retry_config);
|
|
1016
|
+
}
|
|
997
1017
|
throw std::runtime_error("Failed to connect to RDP server: " + error);
|
|
998
1018
|
}
|
|
999
1019
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#include <iostream>
|
|
2
|
+
#include <string_view>
|
|
3
|
+
|
|
4
|
+
#include "rdp_helper_connection_policy.hpp"
|
|
5
|
+
|
|
6
|
+
namespace {
|
|
7
|
+
|
|
8
|
+
bool ExpectRetry(std::string_view name,
|
|
9
|
+
std::string_view protocol,
|
|
10
|
+
bool transport_failed,
|
|
11
|
+
bool using_rdp_security_layer,
|
|
12
|
+
bool expected) {
|
|
13
|
+
const bool actual = midscene::rdp::ShouldRetryAutoWithRdp(
|
|
14
|
+
protocol, transport_failed, using_rdp_security_layer);
|
|
15
|
+
if (actual == expected) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
std::cerr << name << ": expected retry=" << expected
|
|
20
|
+
<< ", actual=" << actual << '\n';
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
} // namespace
|
|
25
|
+
|
|
26
|
+
int main() {
|
|
27
|
+
bool passed = true;
|
|
28
|
+
passed &= ExpectRetry("auto RDP transport fallback", "auto", true, true,
|
|
29
|
+
true);
|
|
30
|
+
passed &= ExpectRetry("explicit RDP", "rdp", true, true, false);
|
|
31
|
+
passed &= ExpectRetry("auto authentication failure", "auto", false, true,
|
|
32
|
+
false);
|
|
33
|
+
passed &= ExpectRetry("auto unreachable host", "auto", true, false, false);
|
|
34
|
+
return passed ? 0 : 1;
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/computer",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.6-beta-20260716090839.0",
|
|
4
4
|
"description": "Midscene.js Computer Desktop Automation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@computer-use/libnut": "^4.2.0",
|
|
34
34
|
"clipboardy": "^4.0.0",
|
|
35
35
|
"screenshot-desktop": "^1.15.3",
|
|
36
|
-
"@midscene/shared": "1.10.
|
|
37
|
-
"@midscene/core": "1.10.
|
|
36
|
+
"@midscene/shared": "1.10.6-beta-20260716090839.0",
|
|
37
|
+
"@midscene/core": "1.10.6-beta-20260716090839.0"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
40
|
"node-mac-permissions": "2.5.0"
|