@midscene/computer 1.8.5 → 1.8.6-beta-20260526062942.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/dist/es/cli.mjs CHANGED
@@ -107,6 +107,9 @@ const EDGE_SCROLL_TOTAL_PX = 50000;
107
107
  const EDGE_SCROLL_STEPS = 400;
108
108
  const PHASED_PIXELS_PER_STEP = 30;
109
109
  const PHASED_MIN_STEPS = 10;
110
+ const LIBNUT_FALLBACK_PIXELS_PER_TICK = 100;
111
+ const LIBNUT_FALLBACK_TICK_DELAY = 16;
112
+ const LIBNUT_FALLBACK_MAX_TICKS = 200;
110
113
  const DEFAULT_SCROLL_VIEWPORT_RATIO = 0.7;
111
114
  const EDGE_SCROLL_SPEC = {
112
115
  scrollToTop: {
@@ -402,7 +405,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
402
405
  }
403
406
  async healthCheck() {
404
407
  console.log('[HealthCheck] Starting health check...');
405
- console.log("[HealthCheck] @midscene/computer v1.8.5");
408
+ console.log("[HealthCheck] @midscene/computer v1.8.6-beta-20260526062942.0");
406
409
  console.log('[HealthCheck] Taking screenshot...');
407
410
  const screenshotTimeout = 15000;
408
411
  let timeoutId;
@@ -626,30 +629,19 @@ Original error: ${lastRawMessage}`);
626
629
  await sleep(SCROLL_COMPLETE_DELAY);
627
630
  return;
628
631
  }
629
- const ticks = Math.ceil(distance / 100);
630
- const directionMap = {
631
- up: [
632
- 0,
633
- ticks
634
- ],
635
- down: [
636
- 0,
637
- -ticks
638
- ],
639
- left: [
640
- -ticks,
641
- 0
642
- ],
643
- right: [
644
- ticks,
645
- 0
646
- ]
647
- };
648
- const [dx, dy] = directionMap[direction] || [
632
+ const totalTicks = Math.min(LIBNUT_FALLBACK_MAX_TICKS, Math.max(1, Math.ceil(distance / LIBNUT_FALLBACK_PIXELS_PER_TICK)));
633
+ const sign = 'down' === direction || 'right' === direction ? -1 : 1;
634
+ const [dx, dy] = isHorizontal ? [
635
+ sign,
636
+ 0
637
+ ] : [
649
638
  0,
650
- -ticks
639
+ sign
651
640
  ];
652
- libnut.scrollMouse(dx, dy);
641
+ for(let i = 0; i < totalTicks; i++){
642
+ libnut.scrollMouse(dx, dy);
643
+ await sleep(LIBNUT_FALLBACK_TICK_DELAY);
644
+ }
653
645
  await sleep(SCROLL_COMPLETE_DELAY);
654
646
  return;
655
647
  }
@@ -1588,7 +1580,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
1588
1580
  const tools = new ComputerMidsceneTools();
1589
1581
  runToolsCLI(tools, 'midscene-computer', {
1590
1582
  stripPrefix: 'computer_',
1591
- version: "1.8.5",
1583
+ version: "1.8.6-beta-20260526062942.0",
1592
1584
  extraCommands: createReportCliCommands()
1593
1585
  }).catch((e)=>{
1594
1586
  process.exit(reportCLIError(e));
package/dist/es/index.mjs CHANGED
@@ -107,6 +107,9 @@ const EDGE_SCROLL_TOTAL_PX = 50000;
107
107
  const EDGE_SCROLL_STEPS = 400;
108
108
  const PHASED_PIXELS_PER_STEP = 30;
109
109
  const PHASED_MIN_STEPS = 10;
110
+ const LIBNUT_FALLBACK_PIXELS_PER_TICK = 100;
111
+ const LIBNUT_FALLBACK_TICK_DELAY = 16;
112
+ const LIBNUT_FALLBACK_MAX_TICKS = 200;
110
113
  const DEFAULT_SCROLL_VIEWPORT_RATIO = 0.7;
111
114
  const EDGE_SCROLL_SPEC = {
112
115
  scrollToTop: {
@@ -402,7 +405,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
402
405
  }
403
406
  async healthCheck() {
404
407
  console.log('[HealthCheck] Starting health check...');
405
- console.log("[HealthCheck] @midscene/computer v1.8.5");
408
+ console.log("[HealthCheck] @midscene/computer v1.8.6-beta-20260526062942.0");
406
409
  console.log('[HealthCheck] Taking screenshot...');
407
410
  const screenshotTimeout = 15000;
408
411
  let timeoutId;
@@ -626,30 +629,19 @@ Original error: ${lastRawMessage}`);
626
629
  await sleep(SCROLL_COMPLETE_DELAY);
627
630
  return;
628
631
  }
629
- const ticks = Math.ceil(distance / 100);
630
- const directionMap = {
631
- up: [
632
- 0,
633
- ticks
634
- ],
635
- down: [
636
- 0,
637
- -ticks
638
- ],
639
- left: [
640
- -ticks,
641
- 0
642
- ],
643
- right: [
644
- ticks,
645
- 0
646
- ]
647
- };
648
- const [dx, dy] = directionMap[direction] || [
632
+ const totalTicks = Math.min(LIBNUT_FALLBACK_MAX_TICKS, Math.max(1, Math.ceil(distance / LIBNUT_FALLBACK_PIXELS_PER_TICK)));
633
+ const sign = 'down' === direction || 'right' === direction ? -1 : 1;
634
+ const [dx, dy] = isHorizontal ? [
635
+ sign,
636
+ 0
637
+ ] : [
649
638
  0,
650
- -ticks
639
+ sign
651
640
  ];
652
- device_libnut.scrollMouse(dx, dy);
641
+ for(let i = 0; i < totalTicks; i++){
642
+ device_libnut.scrollMouse(dx, dy);
643
+ await sleep(LIBNUT_FALLBACK_TICK_DELAY);
644
+ }
653
645
  await sleep(SCROLL_COMPLETE_DELAY);
654
646
  return;
655
647
  }
@@ -1629,7 +1621,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
1629
1621
  }
1630
1622
  }
1631
1623
  function version() {
1632
- const currentVersion = "1.8.5";
1624
+ const currentVersion = "1.8.6-beta-20260526062942.0";
1633
1625
  console.log(`@midscene/computer v${currentVersion}`);
1634
1626
  return currentVersion;
1635
1627
  }
@@ -107,6 +107,9 @@ const EDGE_SCROLL_TOTAL_PX = 50000;
107
107
  const EDGE_SCROLL_STEPS = 400;
108
108
  const PHASED_PIXELS_PER_STEP = 30;
109
109
  const PHASED_MIN_STEPS = 10;
110
+ const LIBNUT_FALLBACK_PIXELS_PER_TICK = 100;
111
+ const LIBNUT_FALLBACK_TICK_DELAY = 16;
112
+ const LIBNUT_FALLBACK_MAX_TICKS = 200;
110
113
  const DEFAULT_SCROLL_VIEWPORT_RATIO = 0.7;
111
114
  const EDGE_SCROLL_SPEC = {
112
115
  scrollToTop: {
@@ -402,7 +405,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
402
405
  }
403
406
  async healthCheck() {
404
407
  console.log('[HealthCheck] Starting health check...');
405
- console.log("[HealthCheck] @midscene/computer v1.8.5");
408
+ console.log("[HealthCheck] @midscene/computer v1.8.6-beta-20260526062942.0");
406
409
  console.log('[HealthCheck] Taking screenshot...');
407
410
  const screenshotTimeout = 15000;
408
411
  let timeoutId;
@@ -626,30 +629,19 @@ Original error: ${lastRawMessage}`);
626
629
  await sleep(SCROLL_COMPLETE_DELAY);
627
630
  return;
628
631
  }
629
- const ticks = Math.ceil(distance / 100);
630
- const directionMap = {
631
- up: [
632
- 0,
633
- ticks
634
- ],
635
- down: [
636
- 0,
637
- -ticks
638
- ],
639
- left: [
640
- -ticks,
641
- 0
642
- ],
643
- right: [
644
- ticks,
645
- 0
646
- ]
647
- };
648
- const [dx, dy] = directionMap[direction] || [
632
+ const totalTicks = Math.min(LIBNUT_FALLBACK_MAX_TICKS, Math.max(1, Math.ceil(distance / LIBNUT_FALLBACK_PIXELS_PER_TICK)));
633
+ const sign = 'down' === direction || 'right' === direction ? -1 : 1;
634
+ const [dx, dy] = isHorizontal ? [
635
+ sign,
636
+ 0
637
+ ] : [
649
638
  0,
650
- -ticks
639
+ sign
651
640
  ];
652
- libnut.scrollMouse(dx, dy);
641
+ for(let i = 0; i < totalTicks; i++){
642
+ libnut.scrollMouse(dx, dy);
643
+ await sleep(LIBNUT_FALLBACK_TICK_DELAY);
644
+ }
653
645
  await sleep(SCROLL_COMPLETE_DELAY);
654
646
  return;
655
647
  }
@@ -1592,7 +1584,7 @@ class ComputerMCPServer extends BaseMCPServer {
1592
1584
  constructor(toolsManager){
1593
1585
  super({
1594
1586
  name: '@midscene/computer-mcp',
1595
- version: "1.8.5",
1587
+ version: "1.8.6-beta-20260526062942.0",
1596
1588
  description: 'Control the computer desktop using natural language commands'
1597
1589
  }, toolsManager);
1598
1590
  }
package/dist/lib/cli.js CHANGED
@@ -133,6 +133,9 @@ const EDGE_SCROLL_TOTAL_PX = 50000;
133
133
  const EDGE_SCROLL_STEPS = 400;
134
134
  const PHASED_PIXELS_PER_STEP = 30;
135
135
  const PHASED_MIN_STEPS = 10;
136
+ const LIBNUT_FALLBACK_PIXELS_PER_TICK = 100;
137
+ const LIBNUT_FALLBACK_TICK_DELAY = 16;
138
+ const LIBNUT_FALLBACK_MAX_TICKS = 200;
136
139
  const DEFAULT_SCROLL_VIEWPORT_RATIO = 0.7;
137
140
  const EDGE_SCROLL_SPEC = {
138
141
  scrollToTop: {
@@ -428,7 +431,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
428
431
  }
429
432
  async healthCheck() {
430
433
  console.log('[HealthCheck] Starting health check...');
431
- console.log("[HealthCheck] @midscene/computer v1.8.5");
434
+ console.log("[HealthCheck] @midscene/computer v1.8.6-beta-20260526062942.0");
432
435
  console.log('[HealthCheck] Taking screenshot...');
433
436
  const screenshotTimeout = 15000;
434
437
  let timeoutId;
@@ -652,30 +655,19 @@ Original error: ${lastRawMessage}`);
652
655
  await (0, utils_namespaceObject.sleep)(SCROLL_COMPLETE_DELAY);
653
656
  return;
654
657
  }
655
- const ticks = Math.ceil(distance / 100);
656
- const directionMap = {
657
- up: [
658
- 0,
659
- ticks
660
- ],
661
- down: [
662
- 0,
663
- -ticks
664
- ],
665
- left: [
666
- -ticks,
667
- 0
668
- ],
669
- right: [
670
- ticks,
671
- 0
672
- ]
673
- };
674
- const [dx, dy] = directionMap[direction] || [
658
+ const totalTicks = Math.min(LIBNUT_FALLBACK_MAX_TICKS, Math.max(1, Math.ceil(distance / LIBNUT_FALLBACK_PIXELS_PER_TICK)));
659
+ const sign = 'down' === direction || 'right' === direction ? -1 : 1;
660
+ const [dx, dy] = isHorizontal ? [
661
+ sign,
662
+ 0
663
+ ] : [
675
664
  0,
676
- -ticks
665
+ sign
677
666
  ];
678
- libnut.scrollMouse(dx, dy);
667
+ for(let i = 0; i < totalTicks; i++){
668
+ libnut.scrollMouse(dx, dy);
669
+ await (0, utils_namespaceObject.sleep)(LIBNUT_FALLBACK_TICK_DELAY);
670
+ }
679
671
  await (0, utils_namespaceObject.sleep)(SCROLL_COMPLETE_DELAY);
680
672
  return;
681
673
  }
@@ -1615,7 +1607,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
1615
1607
  const tools = new ComputerMidsceneTools();
1616
1608
  (0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-computer', {
1617
1609
  stripPrefix: 'computer_',
1618
- version: "1.8.5",
1610
+ version: "1.8.6-beta-20260526062942.0",
1619
1611
  extraCommands: (0, core_namespaceObject.createReportCliCommands)()
1620
1612
  }).catch((e)=>{
1621
1613
  process.exit((0, cli_namespaceObject.reportCLIError)(e));
package/dist/lib/index.js CHANGED
@@ -160,6 +160,9 @@ const EDGE_SCROLL_TOTAL_PX = 50000;
160
160
  const EDGE_SCROLL_STEPS = 400;
161
161
  const PHASED_PIXELS_PER_STEP = 30;
162
162
  const PHASED_MIN_STEPS = 10;
163
+ const LIBNUT_FALLBACK_PIXELS_PER_TICK = 100;
164
+ const LIBNUT_FALLBACK_TICK_DELAY = 16;
165
+ const LIBNUT_FALLBACK_MAX_TICKS = 200;
163
166
  const DEFAULT_SCROLL_VIEWPORT_RATIO = 0.7;
164
167
  const EDGE_SCROLL_SPEC = {
165
168
  scrollToTop: {
@@ -455,7 +458,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
455
458
  }
456
459
  async healthCheck() {
457
460
  console.log('[HealthCheck] Starting health check...');
458
- console.log("[HealthCheck] @midscene/computer v1.8.5");
461
+ console.log("[HealthCheck] @midscene/computer v1.8.6-beta-20260526062942.0");
459
462
  console.log('[HealthCheck] Taking screenshot...');
460
463
  const screenshotTimeout = 15000;
461
464
  let timeoutId;
@@ -679,30 +682,19 @@ Original error: ${lastRawMessage}`);
679
682
  await (0, utils_namespaceObject.sleep)(SCROLL_COMPLETE_DELAY);
680
683
  return;
681
684
  }
682
- const ticks = Math.ceil(distance / 100);
683
- const directionMap = {
684
- up: [
685
- 0,
686
- ticks
687
- ],
688
- down: [
689
- 0,
690
- -ticks
691
- ],
692
- left: [
693
- -ticks,
694
- 0
695
- ],
696
- right: [
697
- ticks,
698
- 0
699
- ]
700
- };
701
- const [dx, dy] = directionMap[direction] || [
685
+ const totalTicks = Math.min(LIBNUT_FALLBACK_MAX_TICKS, Math.max(1, Math.ceil(distance / LIBNUT_FALLBACK_PIXELS_PER_TICK)));
686
+ const sign = 'down' === direction || 'right' === direction ? -1 : 1;
687
+ const [dx, dy] = isHorizontal ? [
688
+ sign,
689
+ 0
690
+ ] : [
702
691
  0,
703
- -ticks
692
+ sign
704
693
  ];
705
- device_libnut.scrollMouse(dx, dy);
694
+ for(let i = 0; i < totalTicks; i++){
695
+ device_libnut.scrollMouse(dx, dy);
696
+ await (0, utils_namespaceObject.sleep)(LIBNUT_FALLBACK_TICK_DELAY);
697
+ }
706
698
  await (0, utils_namespaceObject.sleep)(SCROLL_COMPLETE_DELAY);
707
699
  return;
708
700
  }
@@ -1687,7 +1679,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
1687
1679
  }
1688
1680
  const env_namespaceObject = require("@midscene/shared/env");
1689
1681
  function version() {
1690
- const currentVersion = "1.8.5";
1682
+ const currentVersion = "1.8.6-beta-20260526062942.0";
1691
1683
  console.log(`@midscene/computer v${currentVersion}`);
1692
1684
  return currentVersion;
1693
1685
  }
@@ -147,6 +147,9 @@ const EDGE_SCROLL_TOTAL_PX = 50000;
147
147
  const EDGE_SCROLL_STEPS = 400;
148
148
  const PHASED_PIXELS_PER_STEP = 30;
149
149
  const PHASED_MIN_STEPS = 10;
150
+ const LIBNUT_FALLBACK_PIXELS_PER_TICK = 100;
151
+ const LIBNUT_FALLBACK_TICK_DELAY = 16;
152
+ const LIBNUT_FALLBACK_MAX_TICKS = 200;
150
153
  const DEFAULT_SCROLL_VIEWPORT_RATIO = 0.7;
151
154
  const EDGE_SCROLL_SPEC = {
152
155
  scrollToTop: {
@@ -442,7 +445,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
442
445
  }
443
446
  async healthCheck() {
444
447
  console.log('[HealthCheck] Starting health check...');
445
- console.log("[HealthCheck] @midscene/computer v1.8.5");
448
+ console.log("[HealthCheck] @midscene/computer v1.8.6-beta-20260526062942.0");
446
449
  console.log('[HealthCheck] Taking screenshot...');
447
450
  const screenshotTimeout = 15000;
448
451
  let timeoutId;
@@ -666,30 +669,19 @@ Original error: ${lastRawMessage}`);
666
669
  await (0, utils_namespaceObject.sleep)(SCROLL_COMPLETE_DELAY);
667
670
  return;
668
671
  }
669
- const ticks = Math.ceil(distance / 100);
670
- const directionMap = {
671
- up: [
672
- 0,
673
- ticks
674
- ],
675
- down: [
676
- 0,
677
- -ticks
678
- ],
679
- left: [
680
- -ticks,
681
- 0
682
- ],
683
- right: [
684
- ticks,
685
- 0
686
- ]
687
- };
688
- const [dx, dy] = directionMap[direction] || [
672
+ const totalTicks = Math.min(LIBNUT_FALLBACK_MAX_TICKS, Math.max(1, Math.ceil(distance / LIBNUT_FALLBACK_PIXELS_PER_TICK)));
673
+ const sign = 'down' === direction || 'right' === direction ? -1 : 1;
674
+ const [dx, dy] = isHorizontal ? [
675
+ sign,
676
+ 0
677
+ ] : [
689
678
  0,
690
- -ticks
679
+ sign
691
680
  ];
692
- libnut.scrollMouse(dx, dy);
681
+ for(let i = 0; i < totalTicks; i++){
682
+ libnut.scrollMouse(dx, dy);
683
+ await (0, utils_namespaceObject.sleep)(LIBNUT_FALLBACK_TICK_DELAY);
684
+ }
693
685
  await (0, utils_namespaceObject.sleep)(SCROLL_COMPLETE_DELAY);
694
686
  return;
695
687
  }
@@ -1635,7 +1627,7 @@ class ComputerMCPServer extends mcp_namespaceObject.BaseMCPServer {
1635
1627
  constructor(toolsManager){
1636
1628
  super({
1637
1629
  name: '@midscene/computer-mcp',
1638
- version: "1.8.5",
1630
+ version: "1.8.6-beta-20260526062942.0",
1639
1631
  description: 'Control the computer desktop using natural language commands'
1640
1632
  }, toolsManager);
1641
1633
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/computer",
3
- "version": "1.8.5",
3
+ "version": "1.8.6-beta-20260526062942.0",
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/core": "1.8.5",
42
- "@midscene/shared": "1.8.5"
41
+ "@midscene/core": "1.8.6-beta-20260526062942.0",
42
+ "@midscene/shared": "1.8.6-beta-20260526062942.0"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "node-mac-permissions": "2.5.0"