@midscene/computer 1.9.8-beta-20260618014851.0 → 1.9.8
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/dist/es/cli.mjs +11 -11
- package/dist/es/index.mjs +11 -11
- package/dist/es/mcp-server.mjs +2088 -0
- package/dist/lib/cli.js +11 -11
- package/dist/lib/index.js +11 -11
- package/dist/lib/mcp-server.js +2141 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/mcp-server.d.ts +245 -0
- package/package.json +8 -3
package/dist/lib/cli.js
CHANGED
|
@@ -26,9 +26,9 @@ var __webpack_require__ = {};
|
|
|
26
26
|
var __webpack_exports__ = {};
|
|
27
27
|
const core_namespaceObject = require("@midscene/core");
|
|
28
28
|
const cli_namespaceObject = require("@midscene/shared/cli");
|
|
29
|
-
const agent_behavior_init_args_namespaceObject = require("@midscene/shared/agent-tools/agent-behavior-init-args");
|
|
30
|
-
const base_tools_namespaceObject = require("@midscene/shared/agent-tools/base-tools");
|
|
31
29
|
const logger_namespaceObject = require("@midscene/shared/logger");
|
|
30
|
+
const agent_behavior_init_args_namespaceObject = require("@midscene/shared/mcp/agent-behavior-init-args");
|
|
31
|
+
const base_tools_namespaceObject = require("@midscene/shared/mcp/base-tools");
|
|
32
32
|
const agent_namespaceObject = require("@midscene/core/agent");
|
|
33
33
|
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
34
34
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
@@ -721,7 +721,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
721
721
|
}
|
|
722
722
|
async healthCheck() {
|
|
723
723
|
console.log('[HealthCheck] Starting health check...');
|
|
724
|
-
console.log("[HealthCheck] @midscene/computer v1.9.8
|
|
724
|
+
console.log("[HealthCheck] @midscene/computer v1.9.8");
|
|
725
725
|
console.log('[HealthCheck] Taking screenshot...');
|
|
726
726
|
const screenshotTimeout = 15000;
|
|
727
727
|
let timeoutId;
|
|
@@ -1901,7 +1901,7 @@ async function agentForRDPComputer(opts) {
|
|
|
1901
1901
|
await device.connect();
|
|
1902
1902
|
return new ComputerAgent(device, opts);
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function mcp_tools_define_property(obj, key, value) {
|
|
1905
1905
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
1906
1906
|
value: value,
|
|
1907
1907
|
enumerable: true,
|
|
@@ -1911,7 +1911,7 @@ function agent_tools_define_property(obj, key, value) {
|
|
|
1911
1911
|
else obj[key] = value;
|
|
1912
1912
|
return obj;
|
|
1913
1913
|
}
|
|
1914
|
-
const
|
|
1914
|
+
const mcp_tools_debug = (0, logger_namespaceObject.getDebug)('mcp:computer-tools');
|
|
1915
1915
|
const RDP_SECURITY_PROTOCOLS = [
|
|
1916
1916
|
'auto',
|
|
1917
1917
|
'tls',
|
|
@@ -1979,14 +1979,14 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
1979
1979
|
try {
|
|
1980
1980
|
await this.agent.destroy?.();
|
|
1981
1981
|
} catch (error) {
|
|
1982
|
-
|
|
1982
|
+
mcp_tools_debug('Failed to destroy agent during cleanup:', error);
|
|
1983
1983
|
}
|
|
1984
1984
|
this.agent = void 0;
|
|
1985
1985
|
}
|
|
1986
1986
|
if (this.agent) return this.agent;
|
|
1987
1987
|
const reportOptions = this.readCliReportAgentOptions();
|
|
1988
1988
|
if (opts?.mode === 'rdp') {
|
|
1989
|
-
|
|
1989
|
+
mcp_tools_debug('Creating RDP Computer agent for host:', opts.host);
|
|
1990
1990
|
const { mode: _mode, ...rdpFields } = opts;
|
|
1991
1991
|
const agent = await agentForRDPComputer({
|
|
1992
1992
|
...rdpFields,
|
|
@@ -1998,7 +1998,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
1998
1998
|
}
|
|
1999
1999
|
const displayId = opts?.mode === 'local' ? opts.displayId : void 0;
|
|
2000
2000
|
const headless = opts?.mode === 'local' ? opts.headless : void 0;
|
|
2001
|
-
|
|
2001
|
+
mcp_tools_debug('Creating Computer agent with displayId:', displayId || 'primary');
|
|
2002
2002
|
const agentOpts = {
|
|
2003
2003
|
...displayId ? {
|
|
2004
2004
|
displayId
|
|
@@ -2029,7 +2029,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2029
2029
|
try {
|
|
2030
2030
|
await this.agent.destroy?.();
|
|
2031
2031
|
} catch (error) {
|
|
2032
|
-
|
|
2032
|
+
mcp_tools_debug('Failed to destroy agent during connect:', error);
|
|
2033
2033
|
}
|
|
2034
2034
|
this.agent = void 0;
|
|
2035
2035
|
this.lastInitArgsSignature = void 0;
|
|
@@ -2072,7 +2072,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2072
2072
|
];
|
|
2073
2073
|
}
|
|
2074
2074
|
constructor(...args){
|
|
2075
|
-
super(...args),
|
|
2075
|
+
super(...args), mcp_tools_define_property(this, "lastInitArgsSignature", void 0), mcp_tools_define_property(this, "initArgSpec", {
|
|
2076
2076
|
namespace: 'computer',
|
|
2077
2077
|
shape: computerInitArgShape,
|
|
2078
2078
|
cli: {
|
|
@@ -2085,7 +2085,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2085
2085
|
const tools = new ComputerMidsceneTools();
|
|
2086
2086
|
(0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-computer', {
|
|
2087
2087
|
stripPrefix: 'computer_',
|
|
2088
|
-
version: "1.9.8
|
|
2088
|
+
version: "1.9.8",
|
|
2089
2089
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
2090
2090
|
}).catch((e)=>{
|
|
2091
2091
|
process.exit((0, cli_namespaceObject.reportCLIError)(e));
|
package/dist/lib/index.js
CHANGED
|
@@ -747,7 +747,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
747
747
|
}
|
|
748
748
|
async healthCheck() {
|
|
749
749
|
console.log('[HealthCheck] Starting health check...');
|
|
750
|
-
console.log("[HealthCheck] @midscene/computer v1.9.8
|
|
750
|
+
console.log("[HealthCheck] @midscene/computer v1.9.8");
|
|
751
751
|
console.log('[HealthCheck] Taking screenshot...');
|
|
752
752
|
const screenshotTimeout = 15000;
|
|
753
753
|
let timeoutId;
|
|
@@ -1972,9 +1972,9 @@ async function agentForRDPComputer(opts) {
|
|
|
1972
1972
|
return new ComputerAgent(device, opts);
|
|
1973
1973
|
}
|
|
1974
1974
|
const core_namespaceObject = require("@midscene/core");
|
|
1975
|
-
const agent_behavior_init_args_namespaceObject = require("@midscene/shared/
|
|
1976
|
-
const base_tools_namespaceObject = require("@midscene/shared/
|
|
1977
|
-
function
|
|
1975
|
+
const agent_behavior_init_args_namespaceObject = require("@midscene/shared/mcp/agent-behavior-init-args");
|
|
1976
|
+
const base_tools_namespaceObject = require("@midscene/shared/mcp/base-tools");
|
|
1977
|
+
function mcp_tools_define_property(obj, key, value) {
|
|
1978
1978
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
1979
1979
|
value: value,
|
|
1980
1980
|
enumerable: true,
|
|
@@ -1984,7 +1984,7 @@ function agent_tools_define_property(obj, key, value) {
|
|
|
1984
1984
|
else obj[key] = value;
|
|
1985
1985
|
return obj;
|
|
1986
1986
|
}
|
|
1987
|
-
const
|
|
1987
|
+
const mcp_tools_debug = (0, logger_namespaceObject.getDebug)('mcp:computer-tools');
|
|
1988
1988
|
const RDP_SECURITY_PROTOCOLS = [
|
|
1989
1989
|
'auto',
|
|
1990
1990
|
'tls',
|
|
@@ -2052,14 +2052,14 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2052
2052
|
try {
|
|
2053
2053
|
await this.agent.destroy?.();
|
|
2054
2054
|
} catch (error) {
|
|
2055
|
-
|
|
2055
|
+
mcp_tools_debug('Failed to destroy agent during cleanup:', error);
|
|
2056
2056
|
}
|
|
2057
2057
|
this.agent = void 0;
|
|
2058
2058
|
}
|
|
2059
2059
|
if (this.agent) return this.agent;
|
|
2060
2060
|
const reportOptions = this.readCliReportAgentOptions();
|
|
2061
2061
|
if (opts?.mode === 'rdp') {
|
|
2062
|
-
|
|
2062
|
+
mcp_tools_debug('Creating RDP Computer agent for host:', opts.host);
|
|
2063
2063
|
const { mode: _mode, ...rdpFields } = opts;
|
|
2064
2064
|
const agent = await agentForRDPComputer({
|
|
2065
2065
|
...rdpFields,
|
|
@@ -2071,7 +2071,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2071
2071
|
}
|
|
2072
2072
|
const displayId = opts?.mode === 'local' ? opts.displayId : void 0;
|
|
2073
2073
|
const headless = opts?.mode === 'local' ? opts.headless : void 0;
|
|
2074
|
-
|
|
2074
|
+
mcp_tools_debug('Creating Computer agent with displayId:', displayId || 'primary');
|
|
2075
2075
|
const agentOpts = {
|
|
2076
2076
|
...displayId ? {
|
|
2077
2077
|
displayId
|
|
@@ -2102,7 +2102,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2102
2102
|
try {
|
|
2103
2103
|
await this.agent.destroy?.();
|
|
2104
2104
|
} catch (error) {
|
|
2105
|
-
|
|
2105
|
+
mcp_tools_debug('Failed to destroy agent during connect:', error);
|
|
2106
2106
|
}
|
|
2107
2107
|
this.agent = void 0;
|
|
2108
2108
|
this.lastInitArgsSignature = void 0;
|
|
@@ -2145,7 +2145,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2145
2145
|
];
|
|
2146
2146
|
}
|
|
2147
2147
|
constructor(...args){
|
|
2148
|
-
super(...args),
|
|
2148
|
+
super(...args), mcp_tools_define_property(this, "lastInitArgsSignature", void 0), mcp_tools_define_property(this, "initArgSpec", {
|
|
2149
2149
|
namespace: 'computer',
|
|
2150
2150
|
shape: computerInitArgShape,
|
|
2151
2151
|
cli: {
|
|
@@ -2157,7 +2157,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
|
|
|
2157
2157
|
}
|
|
2158
2158
|
const env_namespaceObject = require("@midscene/shared/env");
|
|
2159
2159
|
function version() {
|
|
2160
|
-
const currentVersion = "1.9.8
|
|
2160
|
+
const currentVersion = "1.9.8";
|
|
2161
2161
|
console.log(`@midscene/computer v${currentVersion}`);
|
|
2162
2162
|
return currentVersion;
|
|
2163
2163
|
}
|