@midscene/computer 1.10.9-beta-20260804015945.0 → 1.10.9

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 CHANGED
@@ -5,9 +5,11 @@ import { BaseMidsceneTools } from "@midscene/shared/agent-tools/base-tools";
5
5
  import { getDebug } from "@midscene/shared/logger";
6
6
  import { Agent } from "@midscene/core/agent";
7
7
  import { execFileSync, execSync, spawn, spawnSync } from "node:child_process";
8
- import { chmodSync, existsSync, statSync } from "node:fs";
8
+ import { randomUUID } from "node:crypto";
9
+ import { chmodSync, existsSync, readFileSync, rmSync, statSync } from "node:fs";
9
10
  import { createRequire } from "node:module";
10
- import { dirname, resolve as external_node_path_resolve } from "node:path";
11
+ import { tmpdir } from "node:os";
12
+ import { dirname, join, resolve as external_node_path_resolve } from "node:path";
11
13
  import { fileURLToPath } from "node:url";
12
14
  import { defineAction, defineActionsFromInputPrimitives } from "@midscene/core/device";
13
15
  import { sleep } from "@midscene/core/utils";
@@ -258,6 +260,21 @@ function device_define_property(obj, key, value) {
258
260
  else obj[key] = value;
259
261
  return obj;
260
262
  }
263
+ async function captureScreenshot(options) {
264
+ if ('linux' !== process.platform) return screenshot_desktop(options);
265
+ const filename = join(tmpdir(), `midscene-screenshot-${randomUUID()}.png`);
266
+ try {
267
+ await screenshot_desktop({
268
+ ...options,
269
+ filename
270
+ });
271
+ return readFileSync(filename);
272
+ } finally{
273
+ rmSync(filename, {
274
+ force: true
275
+ });
276
+ }
277
+ }
261
278
  const SMOOTH_MOVE_STEPS_TAP = 8;
262
279
  const SMOOTH_MOVE_STEPS_MOUSE_MOVE = 10;
263
280
  const SMOOTH_MOVE_DELAY_TAP = 8;
@@ -750,7 +767,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
750
767
  }
751
768
  async healthCheck() {
752
769
  console.log('[HealthCheck] Starting health check...');
753
- console.log("[HealthCheck] @midscene/computer v1.10.9-beta-20260804015945.0");
770
+ console.log("[HealthCheck] @midscene/computer v1.10.9");
754
771
  console.log('[HealthCheck] Taking screenshot...');
755
772
  const screenshotTimeout = 15000;
756
773
  let timeoutId;
@@ -832,7 +849,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
832
849
  const RETRY_DELAY_MS = 300;
833
850
  let lastRawMessage = '';
834
851
  for(let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++)try {
835
- const buffer = await screenshot_desktop(options);
852
+ const buffer = await captureScreenshot(options);
836
853
  if (attempt > 1) debugDevice(`Screenshot succeeded on attempt ${attempt}`);
837
854
  return createImgBase64ByFormat('png', buffer.toString('base64'));
838
855
  } catch (error) {
@@ -2148,7 +2165,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
2148
2165
  const tools = new ComputerMidsceneTools();
2149
2166
  runToolsCLI(tools, 'midscene-computer', {
2150
2167
  stripPrefix: 'computer_',
2151
- version: "1.10.9-beta-20260804015945.0",
2168
+ version: "1.10.9",
2152
2169
  extraCommands: createReportCliCommands()
2153
2170
  }).catch((e)=>{
2154
2171
  process.exit(reportCLIError(e));
package/dist/es/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  import { execFileSync, execSync, spawn, spawnSync } from "node:child_process";
2
- import { chmodSync, existsSync, statSync } from "node:fs";
2
+ import { randomUUID } from "node:crypto";
3
+ import { chmodSync, existsSync, readFileSync, rmSync, statSync } from "node:fs";
3
4
  import { createRequire } from "node:module";
4
- import { dirname, resolve as external_node_path_resolve } from "node:path";
5
+ import { tmpdir } from "node:os";
6
+ import { dirname, join, resolve as external_node_path_resolve } from "node:path";
5
7
  import { fileURLToPath } from "node:url";
6
8
  import { defineAction, defineActionsFromInputPrimitives } from "@midscene/core/device";
7
9
  import { sleep } from "@midscene/core/utils";
@@ -258,6 +260,21 @@ function device_define_property(obj, key, value) {
258
260
  else obj[key] = value;
259
261
  return obj;
260
262
  }
263
+ async function captureScreenshot(options) {
264
+ if ('linux' !== process.platform) return screenshot_desktop(options);
265
+ const filename = join(tmpdir(), `midscene-screenshot-${randomUUID()}.png`);
266
+ try {
267
+ await screenshot_desktop({
268
+ ...options,
269
+ filename
270
+ });
271
+ return readFileSync(filename);
272
+ } finally{
273
+ rmSync(filename, {
274
+ force: true
275
+ });
276
+ }
277
+ }
261
278
  const SMOOTH_MOVE_STEPS_TAP = 8;
262
279
  const SMOOTH_MOVE_STEPS_MOUSE_MOVE = 10;
263
280
  const SMOOTH_MOVE_DELAY_TAP = 8;
@@ -750,7 +767,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
750
767
  }
751
768
  async healthCheck() {
752
769
  console.log('[HealthCheck] Starting health check...');
753
- console.log("[HealthCheck] @midscene/computer v1.10.9-beta-20260804015945.0");
770
+ console.log("[HealthCheck] @midscene/computer v1.10.9");
754
771
  console.log('[HealthCheck] Taking screenshot...');
755
772
  const screenshotTimeout = 15000;
756
773
  let timeoutId;
@@ -832,7 +849,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
832
849
  const RETRY_DELAY_MS = 300;
833
850
  let lastRawMessage = '';
834
851
  for(let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++)try {
835
- const buffer = await screenshot_desktop(options);
852
+ const buffer = await captureScreenshot(options);
836
853
  if (attempt > 1) debugDevice(`Screenshot succeeded on attempt ${attempt}`);
837
854
  return createImgBase64ByFormat('png', buffer.toString('base64'));
838
855
  } catch (error) {
@@ -2189,7 +2206,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
2189
2206
  }
2190
2207
  }
2191
2208
  function version() {
2192
- const currentVersion = "1.10.9-beta-20260804015945.0";
2209
+ const currentVersion = "1.10.9";
2193
2210
  console.log(`@midscene/computer v${currentVersion}`);
2194
2211
  return currentVersion;
2195
2212
  }
package/dist/lib/cli.js CHANGED
@@ -31,8 +31,10 @@ const base_tools_namespaceObject = require("@midscene/shared/agent-tools/base-to
31
31
  const logger_namespaceObject = require("@midscene/shared/logger");
32
32
  const agent_namespaceObject = require("@midscene/core/agent");
33
33
  const external_node_child_process_namespaceObject = require("node:child_process");
34
+ const external_node_crypto_namespaceObject = require("node:crypto");
34
35
  const external_node_fs_namespaceObject = require("node:fs");
35
36
  const external_node_module_namespaceObject = require("node:module");
37
+ const external_node_os_namespaceObject = require("node:os");
36
38
  const external_node_path_namespaceObject = require("node:path");
37
39
  const external_node_url_namespaceObject = require("node:url");
38
40
  const device_namespaceObject = require("@midscene/core/device");
@@ -284,6 +286,21 @@ function device_define_property(obj, key, value) {
284
286
  else obj[key] = value;
285
287
  return obj;
286
288
  }
289
+ async function captureScreenshot(options) {
290
+ if ('linux' !== process.platform) return external_screenshot_desktop_default()(options);
291
+ const filename = (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), `midscene-screenshot-${(0, external_node_crypto_namespaceObject.randomUUID)()}.png`);
292
+ try {
293
+ await external_screenshot_desktop_default()({
294
+ ...options,
295
+ filename
296
+ });
297
+ return (0, external_node_fs_namespaceObject.readFileSync)(filename);
298
+ } finally{
299
+ (0, external_node_fs_namespaceObject.rmSync)(filename, {
300
+ force: true
301
+ });
302
+ }
303
+ }
287
304
  const SMOOTH_MOVE_STEPS_TAP = 8;
288
305
  const SMOOTH_MOVE_STEPS_MOUSE_MOVE = 10;
289
306
  const SMOOTH_MOVE_DELAY_TAP = 8;
@@ -776,7 +793,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
776
793
  }
777
794
  async healthCheck() {
778
795
  console.log('[HealthCheck] Starting health check...');
779
- console.log("[HealthCheck] @midscene/computer v1.10.9-beta-20260804015945.0");
796
+ console.log("[HealthCheck] @midscene/computer v1.10.9");
780
797
  console.log('[HealthCheck] Taking screenshot...');
781
798
  const screenshotTimeout = 15000;
782
799
  let timeoutId;
@@ -858,7 +875,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
858
875
  const RETRY_DELAY_MS = 300;
859
876
  let lastRawMessage = '';
860
877
  for(let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++)try {
861
- const buffer = await external_screenshot_desktop_default()(options);
878
+ const buffer = await captureScreenshot(options);
862
879
  if (attempt > 1) debugDevice(`Screenshot succeeded on attempt ${attempt}`);
863
880
  return (0, img_namespaceObject.createImgBase64ByFormat)('png', buffer.toString('base64'));
864
881
  } catch (error) {
@@ -2175,7 +2192,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
2175
2192
  const tools = new ComputerMidsceneTools();
2176
2193
  (0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-computer', {
2177
2194
  stripPrefix: 'computer_',
2178
- version: "1.10.9-beta-20260804015945.0",
2195
+ version: "1.10.9",
2179
2196
  extraCommands: (0, core_namespaceObject.createReportCliCommands)()
2180
2197
  }).catch((e)=>{
2181
2198
  process.exit((0, cli_namespaceObject.reportCLIError)(e));
package/dist/lib/index.js CHANGED
@@ -56,8 +56,10 @@ __webpack_require__.d(__webpack_exports__, {
56
56
  ComputerAgent: ()=>ComputerAgent
57
57
  });
58
58
  const external_node_child_process_namespaceObject = require("node:child_process");
59
+ const external_node_crypto_namespaceObject = require("node:crypto");
59
60
  const external_node_fs_namespaceObject = require("node:fs");
60
61
  const external_node_module_namespaceObject = require("node:module");
62
+ const external_node_os_namespaceObject = require("node:os");
61
63
  const external_node_path_namespaceObject = require("node:path");
62
64
  const external_node_url_namespaceObject = require("node:url");
63
65
  const device_namespaceObject = require("@midscene/core/device");
@@ -310,6 +312,21 @@ function device_define_property(obj, key, value) {
310
312
  else obj[key] = value;
311
313
  return obj;
312
314
  }
315
+ async function captureScreenshot(options) {
316
+ if ('linux' !== process.platform) return external_screenshot_desktop_default()(options);
317
+ const filename = (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), `midscene-screenshot-${(0, external_node_crypto_namespaceObject.randomUUID)()}.png`);
318
+ try {
319
+ await external_screenshot_desktop_default()({
320
+ ...options,
321
+ filename
322
+ });
323
+ return (0, external_node_fs_namespaceObject.readFileSync)(filename);
324
+ } finally{
325
+ (0, external_node_fs_namespaceObject.rmSync)(filename, {
326
+ force: true
327
+ });
328
+ }
329
+ }
313
330
  const SMOOTH_MOVE_STEPS_TAP = 8;
314
331
  const SMOOTH_MOVE_STEPS_MOUSE_MOVE = 10;
315
332
  const SMOOTH_MOVE_DELAY_TAP = 8;
@@ -802,7 +819,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
802
819
  }
803
820
  async healthCheck() {
804
821
  console.log('[HealthCheck] Starting health check...');
805
- console.log("[HealthCheck] @midscene/computer v1.10.9-beta-20260804015945.0");
822
+ console.log("[HealthCheck] @midscene/computer v1.10.9");
806
823
  console.log('[HealthCheck] Taking screenshot...');
807
824
  const screenshotTimeout = 15000;
808
825
  let timeoutId;
@@ -884,7 +901,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
884
901
  const RETRY_DELAY_MS = 300;
885
902
  let lastRawMessage = '';
886
903
  for(let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++)try {
887
- const buffer = await external_screenshot_desktop_default()(options);
904
+ const buffer = await captureScreenshot(options);
888
905
  if (attempt > 1) debugDevice(`Screenshot succeeded on attempt ${attempt}`);
889
906
  return (0, img_namespaceObject.createImgBase64ByFormat)('png', buffer.toString('base64'));
890
907
  } catch (error) {
@@ -2247,7 +2264,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
2247
2264
  }
2248
2265
  const env_namespaceObject = require("@midscene/shared/env");
2249
2266
  function version() {
2250
- const currentVersion = "1.10.9-beta-20260804015945.0";
2267
+ const currentVersion = "1.10.9";
2251
2268
  console.log(`@midscene/computer v${currentVersion}`);
2252
2269
  return currentVersion;
2253
2270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/computer",
3
- "version": "1.10.9-beta-20260804015945.0",
3
+ "version": "1.10.9",
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/core": "1.10.9-beta-20260804015945.0",
37
- "@midscene/shared": "1.10.9-beta-20260804015945.0"
36
+ "@midscene/core": "1.10.9",
37
+ "@midscene/shared": "1.10.9"
38
38
  },
39
39
  "optionalDependencies": {
40
40
  "node-mac-permissions": "2.5.0"