@midscene/computer 1.13.2-beta-20260923032453.0 → 1.13.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.
package/dist/es/cli.mjs CHANGED
@@ -466,12 +466,10 @@ function runWindowsPhysicalPixelPowershell(script) {
466
466
  $ErrorActionPreference = 'Stop'
467
467
  ${WINDOWS_PHYSICAL_PIXEL_POWERSHELL_PREAMBLE}
468
468
  ${script}`;
469
- const encoded = Buffer.from(physicalPixelScript, 'utf16le').toString('base64');
470
469
  return execFileSync('powershell.exe', [
471
470
  '-NoProfile',
472
- '-NonInteractive',
473
- '-EncodedCommand',
474
- encoded
471
+ '-Command',
472
+ physicalPixelScript
475
473
  ], {
476
474
  encoding: 'utf8',
477
475
  timeout: POWERSHELL_TIMEOUT_MS,
@@ -479,6 +477,48 @@ ${script}`;
479
477
  windowsHide: true
480
478
  });
481
479
  }
480
+ function isFiniteNumber(value) {
481
+ return 'number' == typeof value && Number.isFinite(value);
482
+ }
483
+ function isWindowsDisplayGeometry(value) {
484
+ if (!value || 'object' != typeof value) return false;
485
+ const candidate = value;
486
+ const bounds = candidate.bounds;
487
+ return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && !!bounds && isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
488
+ }
489
+ function readWindowsDisplayGeometries() {
490
+ const script = `
491
+ Add-Type -AssemblyName System.Windows.Forms
492
+ $screens = @([System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
493
+ $bounds = $_.Bounds
494
+ [PSCustomObject]@{
495
+ id = $_.DeviceName
496
+ name = $_.DeviceName
497
+ primary = $_.Primary
498
+ bounds = [PSCustomObject]@{
499
+ x = $bounds.X
500
+ y = $bounds.Y
501
+ width = $bounds.Width
502
+ height = $bounds.Height
503
+ }
504
+ }
505
+ })
506
+ [Console]::Out.Write((ConvertTo-Json -InputObject $screens -Compress))
507
+ `.trim();
508
+ const output = runWindowsPhysicalPixelPowershell(script).trim();
509
+ if (!output) throw new Error('Windows display enumeration returned no data');
510
+ const parsed = JSON.parse(output);
511
+ if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
512
+ const displays = parsed.filter(isWindowsDisplayGeometry);
513
+ if (displays.length !== parsed.length) throw new Error('Windows display enumeration returned invalid geometry');
514
+ if (0 === displays.length) throw new Error('Windows display enumeration returned no displays');
515
+ return displays;
516
+ }
517
+ function resolveWindowsDisplayGeometryFromList(displayId, displays) {
518
+ if (!displays.length) return;
519
+ if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
520
+ return displays.find((display)=>display.id === displayId);
521
+ }
482
522
  function windows_pointer_define_property(obj, key, value) {
483
523
  if (key in obj) Object.defineProperty(obj, key, {
484
524
  value: value,
@@ -796,28 +836,6 @@ const EDGE_SCROLL_SPEC = {
796
836
  function escapePowershellSingleQuoted(value) {
797
837
  return value.replace(/'/g, "''");
798
838
  }
799
- function readWindowsDisplayGeometries() {
800
- const script = `
801
- Add-Type -AssemblyName System.Windows.Forms
802
- $s = [System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
803
- $b = $_.Bounds
804
- [PSCustomObject]@{
805
- id = $_.DeviceName
806
- name = $_.DeviceName
807
- primary = $_.Primary
808
- bounds = [PSCustomObject]@{ x = $b.X; y = $b.Y; width = $b.Width; height = $b.Height }
809
- }
810
- }
811
- ConvertTo-Json @($s) -Compress
812
- `.trim();
813
- const output = runWindowsPhysicalPixelPowershell(script).trim();
814
- if (!output) throw new Error('Windows display enumeration returned no data');
815
- const parsed = JSON.parse(output);
816
- if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
817
- const displays = parsed.filter(isWindowsDisplayGeometry);
818
- if (displays.length !== parsed.length || 0 === displays.length) throw new Error('Windows display enumeration returned invalid geometry');
819
- return displays;
820
- }
821
839
  function listWindowsDisplays(geometries = readWindowsDisplayGeometries()) {
822
840
  return geometries.map((display)=>({
823
841
  id: display.id,
@@ -921,23 +939,13 @@ function getDisplayInfoBinary() {
921
939
  displayInfoBinaryPath = binPath;
922
940
  return binPath;
923
941
  }
924
- function isFiniteNumber(value) {
942
+ function device_isFiniteNumber(value) {
925
943
  return 'number' == typeof value && Number.isFinite(value);
926
944
  }
927
- function isDisplayBounds(value) {
928
- if (!value || 'object' != typeof value) return false;
929
- const bounds = value;
930
- return isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
931
- }
932
- function isWindowsDisplayGeometry(value) {
933
- if (!value || 'object' != typeof value) return false;
934
- const candidate = value;
935
- return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && isDisplayBounds(candidate.bounds);
936
- }
937
945
  function isDarwinDisplayGeometry(value) {
938
946
  if (!value || 'object' != typeof value) return false;
939
947
  const candidate = value;
940
- return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && isFiniteNumber(candidate.bounds.x) && isFiniteNumber(candidate.bounds.y) && isFiniteNumber(candidate.bounds.width) && isFiniteNumber(candidate.bounds.height);
948
+ return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && device_isFiniteNumber(candidate.bounds.x) && device_isFiniteNumber(candidate.bounds.y) && device_isFiniteNumber(candidate.bounds.width) && device_isFiniteNumber(candidate.bounds.height);
941
949
  }
942
950
  function readDarwinDisplayGeometries() {
943
951
  const bin = getDisplayInfoBinary();
@@ -1007,11 +1015,6 @@ function resolveDarwinDisplayGeometryFromList(displayId, displays) {
1007
1015
  if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays.find((display)=>0 === display.screenIndex) || displays[0];
1008
1016
  return displays.find((display)=>display.screenIndex === screenIndex) || displays.find((display)=>display.cgDisplayId === screenIndex);
1009
1017
  }
1010
- function resolveWindowsDisplayGeometryFromList(displayId, displays) {
1011
- if (!displays.length) return;
1012
- if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
1013
- return displays.find((display)=>display.id === displayId);
1014
- }
1015
1018
  function resolveDisplayGeometry(displayId, windowsDisplays) {
1016
1019
  if ('darwin' === process.platform) return resolveDarwinDisplayGeometryFromList(displayId, readDarwinDisplayGeometries());
1017
1020
  if ('win32' === process.platform) {
@@ -1234,7 +1237,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
1234
1237
  }
1235
1238
  async healthCheck(displays) {
1236
1239
  console.log('[HealthCheck] Starting health check...');
1237
- console.log("[HealthCheck] @midscene/computer v1.13.2-beta-20260923032453.0");
1240
+ console.log("[HealthCheck] @midscene/computer v1.13.2");
1238
1241
  console.log('[HealthCheck] Taking screenshot...');
1239
1242
  const screenshotTimeout = 15000;
1240
1243
  let timeoutId;
@@ -2723,7 +2726,7 @@ const tools = new ComputerMidsceneTools({
2723
2726
  });
2724
2727
  runToolsCLI(tools, 'midscene-computer', {
2725
2728
  stripPrefix: 'computer_',
2726
- version: "1.13.2-beta-20260923032453.0",
2729
+ version: "1.13.2",
2727
2730
  extraCommands: createReportCliCommands()
2728
2731
  }).catch((e)=>{
2729
2732
  process.exit(reportCLIError(e));
package/dist/es/index.mjs CHANGED
@@ -466,12 +466,10 @@ function runWindowsPhysicalPixelPowershell(script) {
466
466
  $ErrorActionPreference = 'Stop'
467
467
  ${WINDOWS_PHYSICAL_PIXEL_POWERSHELL_PREAMBLE}
468
468
  ${script}`;
469
- const encoded = Buffer.from(physicalPixelScript, 'utf16le').toString('base64');
470
469
  return execFileSync('powershell.exe', [
471
470
  '-NoProfile',
472
- '-NonInteractive',
473
- '-EncodedCommand',
474
- encoded
471
+ '-Command',
472
+ physicalPixelScript
475
473
  ], {
476
474
  encoding: 'utf8',
477
475
  timeout: POWERSHELL_TIMEOUT_MS,
@@ -479,6 +477,48 @@ ${script}`;
479
477
  windowsHide: true
480
478
  });
481
479
  }
480
+ function isFiniteNumber(value) {
481
+ return 'number' == typeof value && Number.isFinite(value);
482
+ }
483
+ function isWindowsDisplayGeometry(value) {
484
+ if (!value || 'object' != typeof value) return false;
485
+ const candidate = value;
486
+ const bounds = candidate.bounds;
487
+ return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && !!bounds && isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
488
+ }
489
+ function readWindowsDisplayGeometries() {
490
+ const script = `
491
+ Add-Type -AssemblyName System.Windows.Forms
492
+ $screens = @([System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
493
+ $bounds = $_.Bounds
494
+ [PSCustomObject]@{
495
+ id = $_.DeviceName
496
+ name = $_.DeviceName
497
+ primary = $_.Primary
498
+ bounds = [PSCustomObject]@{
499
+ x = $bounds.X
500
+ y = $bounds.Y
501
+ width = $bounds.Width
502
+ height = $bounds.Height
503
+ }
504
+ }
505
+ })
506
+ [Console]::Out.Write((ConvertTo-Json -InputObject $screens -Compress))
507
+ `.trim();
508
+ const output = runWindowsPhysicalPixelPowershell(script).trim();
509
+ if (!output) throw new Error('Windows display enumeration returned no data');
510
+ const parsed = JSON.parse(output);
511
+ if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
512
+ const displays = parsed.filter(isWindowsDisplayGeometry);
513
+ if (displays.length !== parsed.length) throw new Error('Windows display enumeration returned invalid geometry');
514
+ if (0 === displays.length) throw new Error('Windows display enumeration returned no displays');
515
+ return displays;
516
+ }
517
+ function resolveWindowsDisplayGeometryFromList(displayId, displays) {
518
+ if (!displays.length) return;
519
+ if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
520
+ return displays.find((display)=>display.id === displayId);
521
+ }
482
522
  function windows_pointer_define_property(obj, key, value) {
483
523
  if (key in obj) Object.defineProperty(obj, key, {
484
524
  value: value,
@@ -796,28 +836,6 @@ const EDGE_SCROLL_SPEC = {
796
836
  function escapePowershellSingleQuoted(value) {
797
837
  return value.replace(/'/g, "''");
798
838
  }
799
- function readWindowsDisplayGeometries() {
800
- const script = `
801
- Add-Type -AssemblyName System.Windows.Forms
802
- $s = [System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
803
- $b = $_.Bounds
804
- [PSCustomObject]@{
805
- id = $_.DeviceName
806
- name = $_.DeviceName
807
- primary = $_.Primary
808
- bounds = [PSCustomObject]@{ x = $b.X; y = $b.Y; width = $b.Width; height = $b.Height }
809
- }
810
- }
811
- ConvertTo-Json @($s) -Compress
812
- `.trim();
813
- const output = runWindowsPhysicalPixelPowershell(script).trim();
814
- if (!output) throw new Error('Windows display enumeration returned no data');
815
- const parsed = JSON.parse(output);
816
- if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
817
- const displays = parsed.filter(isWindowsDisplayGeometry);
818
- if (displays.length !== parsed.length || 0 === displays.length) throw new Error('Windows display enumeration returned invalid geometry');
819
- return displays;
820
- }
821
839
  function listWindowsDisplays(geometries = readWindowsDisplayGeometries()) {
822
840
  return geometries.map((display)=>({
823
841
  id: display.id,
@@ -921,23 +939,13 @@ function getDisplayInfoBinary() {
921
939
  displayInfoBinaryPath = binPath;
922
940
  return binPath;
923
941
  }
924
- function isFiniteNumber(value) {
942
+ function device_isFiniteNumber(value) {
925
943
  return 'number' == typeof value && Number.isFinite(value);
926
944
  }
927
- function isDisplayBounds(value) {
928
- if (!value || 'object' != typeof value) return false;
929
- const bounds = value;
930
- return isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
931
- }
932
- function isWindowsDisplayGeometry(value) {
933
- if (!value || 'object' != typeof value) return false;
934
- const candidate = value;
935
- return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && isDisplayBounds(candidate.bounds);
936
- }
937
945
  function isDarwinDisplayGeometry(value) {
938
946
  if (!value || 'object' != typeof value) return false;
939
947
  const candidate = value;
940
- return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && isFiniteNumber(candidate.bounds.x) && isFiniteNumber(candidate.bounds.y) && isFiniteNumber(candidate.bounds.width) && isFiniteNumber(candidate.bounds.height);
948
+ return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && device_isFiniteNumber(candidate.bounds.x) && device_isFiniteNumber(candidate.bounds.y) && device_isFiniteNumber(candidate.bounds.width) && device_isFiniteNumber(candidate.bounds.height);
941
949
  }
942
950
  function readDarwinDisplayGeometries() {
943
951
  const bin = getDisplayInfoBinary();
@@ -1007,11 +1015,6 @@ function resolveDarwinDisplayGeometryFromList(displayId, displays) {
1007
1015
  if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays.find((display)=>0 === display.screenIndex) || displays[0];
1008
1016
  return displays.find((display)=>display.screenIndex === screenIndex) || displays.find((display)=>display.cgDisplayId === screenIndex);
1009
1017
  }
1010
- function resolveWindowsDisplayGeometryFromList(displayId, displays) {
1011
- if (!displays.length) return;
1012
- if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
1013
- return displays.find((display)=>display.id === displayId);
1014
- }
1015
1018
  function resolveDisplayGeometry(displayId, windowsDisplays) {
1016
1019
  if ('darwin' === process.platform) return resolveDarwinDisplayGeometryFromList(displayId, readDarwinDisplayGeometries());
1017
1020
  if ('win32' === process.platform) {
@@ -1234,7 +1237,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
1234
1237
  }
1235
1238
  async healthCheck(displays) {
1236
1239
  console.log('[HealthCheck] Starting health check...');
1237
- console.log("[HealthCheck] @midscene/computer v1.13.2-beta-20260923032453.0");
1240
+ console.log("[HealthCheck] @midscene/computer v1.13.2");
1238
1241
  console.log('[HealthCheck] Taking screenshot...');
1239
1242
  const screenshotTimeout = 15000;
1240
1243
  let timeoutId;
@@ -2762,7 +2765,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
2762
2765
  }
2763
2766
  }
2764
2767
  function version() {
2765
- const currentVersion = "1.13.2-beta-20260923032453.0";
2768
+ const currentVersion = "1.13.2";
2766
2769
  console.log(`@midscene/computer v${currentVersion}`);
2767
2770
  return currentVersion;
2768
2771
  }
package/dist/lib/cli.js CHANGED
@@ -491,12 +491,10 @@ function runWindowsPhysicalPixelPowershell(script) {
491
491
  $ErrorActionPreference = 'Stop'
492
492
  ${WINDOWS_PHYSICAL_PIXEL_POWERSHELL_PREAMBLE}
493
493
  ${script}`;
494
- const encoded = Buffer.from(physicalPixelScript, 'utf16le').toString('base64');
495
494
  return (0, external_node_child_process_namespaceObject.execFileSync)('powershell.exe', [
496
495
  '-NoProfile',
497
- '-NonInteractive',
498
- '-EncodedCommand',
499
- encoded
496
+ '-Command',
497
+ physicalPixelScript
500
498
  ], {
501
499
  encoding: 'utf8',
502
500
  timeout: POWERSHELL_TIMEOUT_MS,
@@ -504,6 +502,48 @@ ${script}`;
504
502
  windowsHide: true
505
503
  });
506
504
  }
505
+ function isFiniteNumber(value) {
506
+ return 'number' == typeof value && Number.isFinite(value);
507
+ }
508
+ function isWindowsDisplayGeometry(value) {
509
+ if (!value || 'object' != typeof value) return false;
510
+ const candidate = value;
511
+ const bounds = candidate.bounds;
512
+ return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && !!bounds && isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
513
+ }
514
+ function readWindowsDisplayGeometries() {
515
+ const script = `
516
+ Add-Type -AssemblyName System.Windows.Forms
517
+ $screens = @([System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
518
+ $bounds = $_.Bounds
519
+ [PSCustomObject]@{
520
+ id = $_.DeviceName
521
+ name = $_.DeviceName
522
+ primary = $_.Primary
523
+ bounds = [PSCustomObject]@{
524
+ x = $bounds.X
525
+ y = $bounds.Y
526
+ width = $bounds.Width
527
+ height = $bounds.Height
528
+ }
529
+ }
530
+ })
531
+ [Console]::Out.Write((ConvertTo-Json -InputObject $screens -Compress))
532
+ `.trim();
533
+ const output = runWindowsPhysicalPixelPowershell(script).trim();
534
+ if (!output) throw new Error('Windows display enumeration returned no data');
535
+ const parsed = JSON.parse(output);
536
+ if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
537
+ const displays = parsed.filter(isWindowsDisplayGeometry);
538
+ if (displays.length !== parsed.length) throw new Error('Windows display enumeration returned invalid geometry');
539
+ if (0 === displays.length) throw new Error('Windows display enumeration returned no displays');
540
+ return displays;
541
+ }
542
+ function resolveWindowsDisplayGeometryFromList(displayId, displays) {
543
+ if (!displays.length) return;
544
+ if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
545
+ return displays.find((display)=>display.id === displayId);
546
+ }
507
547
  function windows_pointer_define_property(obj, key, value) {
508
548
  if (key in obj) Object.defineProperty(obj, key, {
509
549
  value: value,
@@ -822,28 +862,6 @@ const EDGE_SCROLL_SPEC = {
822
862
  function escapePowershellSingleQuoted(value) {
823
863
  return value.replace(/'/g, "''");
824
864
  }
825
- function readWindowsDisplayGeometries() {
826
- const script = `
827
- Add-Type -AssemblyName System.Windows.Forms
828
- $s = [System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
829
- $b = $_.Bounds
830
- [PSCustomObject]@{
831
- id = $_.DeviceName
832
- name = $_.DeviceName
833
- primary = $_.Primary
834
- bounds = [PSCustomObject]@{ x = $b.X; y = $b.Y; width = $b.Width; height = $b.Height }
835
- }
836
- }
837
- ConvertTo-Json @($s) -Compress
838
- `.trim();
839
- const output = runWindowsPhysicalPixelPowershell(script).trim();
840
- if (!output) throw new Error('Windows display enumeration returned no data');
841
- const parsed = JSON.parse(output);
842
- if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
843
- const displays = parsed.filter(isWindowsDisplayGeometry);
844
- if (displays.length !== parsed.length || 0 === displays.length) throw new Error('Windows display enumeration returned invalid geometry');
845
- return displays;
846
- }
847
865
  function listWindowsDisplays(geometries = readWindowsDisplayGeometries()) {
848
866
  return geometries.map((display)=>({
849
867
  id: display.id,
@@ -947,23 +965,13 @@ function getDisplayInfoBinary() {
947
965
  displayInfoBinaryPath = binPath;
948
966
  return binPath;
949
967
  }
950
- function isFiniteNumber(value) {
968
+ function device_isFiniteNumber(value) {
951
969
  return 'number' == typeof value && Number.isFinite(value);
952
970
  }
953
- function isDisplayBounds(value) {
954
- if (!value || 'object' != typeof value) return false;
955
- const bounds = value;
956
- return isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
957
- }
958
- function isWindowsDisplayGeometry(value) {
959
- if (!value || 'object' != typeof value) return false;
960
- const candidate = value;
961
- return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && isDisplayBounds(candidate.bounds);
962
- }
963
971
  function isDarwinDisplayGeometry(value) {
964
972
  if (!value || 'object' != typeof value) return false;
965
973
  const candidate = value;
966
- return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && isFiniteNumber(candidate.bounds.x) && isFiniteNumber(candidate.bounds.y) && isFiniteNumber(candidate.bounds.width) && isFiniteNumber(candidate.bounds.height);
974
+ return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && device_isFiniteNumber(candidate.bounds.x) && device_isFiniteNumber(candidate.bounds.y) && device_isFiniteNumber(candidate.bounds.width) && device_isFiniteNumber(candidate.bounds.height);
967
975
  }
968
976
  function readDarwinDisplayGeometries() {
969
977
  const bin = getDisplayInfoBinary();
@@ -1033,11 +1041,6 @@ function resolveDarwinDisplayGeometryFromList(displayId, displays) {
1033
1041
  if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays.find((display)=>0 === display.screenIndex) || displays[0];
1034
1042
  return displays.find((display)=>display.screenIndex === screenIndex) || displays.find((display)=>display.cgDisplayId === screenIndex);
1035
1043
  }
1036
- function resolveWindowsDisplayGeometryFromList(displayId, displays) {
1037
- if (!displays.length) return;
1038
- if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
1039
- return displays.find((display)=>display.id === displayId);
1040
- }
1041
1044
  function resolveDisplayGeometry(displayId, windowsDisplays) {
1042
1045
  if ('darwin' === process.platform) return resolveDarwinDisplayGeometryFromList(displayId, readDarwinDisplayGeometries());
1043
1046
  if ('win32' === process.platform) {
@@ -1260,7 +1263,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
1260
1263
  }
1261
1264
  async healthCheck(displays) {
1262
1265
  console.log('[HealthCheck] Starting health check...');
1263
- console.log("[HealthCheck] @midscene/computer v1.13.2-beta-20260923032453.0");
1266
+ console.log("[HealthCheck] @midscene/computer v1.13.2");
1264
1267
  console.log('[HealthCheck] Taking screenshot...');
1265
1268
  const screenshotTimeout = 15000;
1266
1269
  let timeoutId;
@@ -2750,7 +2753,7 @@ const tools = new ComputerMidsceneTools({
2750
2753
  });
2751
2754
  (0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-computer', {
2752
2755
  stripPrefix: 'computer_',
2753
- version: "1.13.2-beta-20260923032453.0",
2756
+ version: "1.13.2",
2754
2757
  extraCommands: (0, core_namespaceObject.createReportCliCommands)()
2755
2758
  }).catch((e)=>{
2756
2759
  process.exit((0, cli_namespaceObject.reportCLIError)(e));
package/dist/lib/index.js CHANGED
@@ -517,12 +517,10 @@ function runWindowsPhysicalPixelPowershell(script) {
517
517
  $ErrorActionPreference = 'Stop'
518
518
  ${WINDOWS_PHYSICAL_PIXEL_POWERSHELL_PREAMBLE}
519
519
  ${script}`;
520
- const encoded = Buffer.from(physicalPixelScript, 'utf16le').toString('base64');
521
520
  return (0, external_node_child_process_namespaceObject.execFileSync)('powershell.exe', [
522
521
  '-NoProfile',
523
- '-NonInteractive',
524
- '-EncodedCommand',
525
- encoded
522
+ '-Command',
523
+ physicalPixelScript
526
524
  ], {
527
525
  encoding: 'utf8',
528
526
  timeout: POWERSHELL_TIMEOUT_MS,
@@ -530,6 +528,48 @@ ${script}`;
530
528
  windowsHide: true
531
529
  });
532
530
  }
531
+ function isFiniteNumber(value) {
532
+ return 'number' == typeof value && Number.isFinite(value);
533
+ }
534
+ function isWindowsDisplayGeometry(value) {
535
+ if (!value || 'object' != typeof value) return false;
536
+ const candidate = value;
537
+ const bounds = candidate.bounds;
538
+ return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && !!bounds && isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
539
+ }
540
+ function readWindowsDisplayGeometries() {
541
+ const script = `
542
+ Add-Type -AssemblyName System.Windows.Forms
543
+ $screens = @([System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
544
+ $bounds = $_.Bounds
545
+ [PSCustomObject]@{
546
+ id = $_.DeviceName
547
+ name = $_.DeviceName
548
+ primary = $_.Primary
549
+ bounds = [PSCustomObject]@{
550
+ x = $bounds.X
551
+ y = $bounds.Y
552
+ width = $bounds.Width
553
+ height = $bounds.Height
554
+ }
555
+ }
556
+ })
557
+ [Console]::Out.Write((ConvertTo-Json -InputObject $screens -Compress))
558
+ `.trim();
559
+ const output = runWindowsPhysicalPixelPowershell(script).trim();
560
+ if (!output) throw new Error('Windows display enumeration returned no data');
561
+ const parsed = JSON.parse(output);
562
+ if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
563
+ const displays = parsed.filter(isWindowsDisplayGeometry);
564
+ if (displays.length !== parsed.length) throw new Error('Windows display enumeration returned invalid geometry');
565
+ if (0 === displays.length) throw new Error('Windows display enumeration returned no displays');
566
+ return displays;
567
+ }
568
+ function resolveWindowsDisplayGeometryFromList(displayId, displays) {
569
+ if (!displays.length) return;
570
+ if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
571
+ return displays.find((display)=>display.id === displayId);
572
+ }
533
573
  function windows_pointer_define_property(obj, key, value) {
534
574
  if (key in obj) Object.defineProperty(obj, key, {
535
575
  value: value,
@@ -848,28 +888,6 @@ const EDGE_SCROLL_SPEC = {
848
888
  function escapePowershellSingleQuoted(value) {
849
889
  return value.replace(/'/g, "''");
850
890
  }
851
- function readWindowsDisplayGeometries() {
852
- const script = `
853
- Add-Type -AssemblyName System.Windows.Forms
854
- $s = [System.Windows.Forms.Screen]::AllScreens | ForEach-Object {
855
- $b = $_.Bounds
856
- [PSCustomObject]@{
857
- id = $_.DeviceName
858
- name = $_.DeviceName
859
- primary = $_.Primary
860
- bounds = [PSCustomObject]@{ x = $b.X; y = $b.Y; width = $b.Width; height = $b.Height }
861
- }
862
- }
863
- ConvertTo-Json @($s) -Compress
864
- `.trim();
865
- const output = runWindowsPhysicalPixelPowershell(script).trim();
866
- if (!output) throw new Error('Windows display enumeration returned no data');
867
- const parsed = JSON.parse(output);
868
- if (!Array.isArray(parsed)) throw new Error('Windows display enumeration returned invalid data');
869
- const displays = parsed.filter(isWindowsDisplayGeometry);
870
- if (displays.length !== parsed.length || 0 === displays.length) throw new Error('Windows display enumeration returned invalid geometry');
871
- return displays;
872
- }
873
891
  function listWindowsDisplays(geometries = readWindowsDisplayGeometries()) {
874
892
  return geometries.map((display)=>({
875
893
  id: display.id,
@@ -973,23 +991,13 @@ function getDisplayInfoBinary() {
973
991
  displayInfoBinaryPath = binPath;
974
992
  return binPath;
975
993
  }
976
- function isFiniteNumber(value) {
994
+ function device_isFiniteNumber(value) {
977
995
  return 'number' == typeof value && Number.isFinite(value);
978
996
  }
979
- function isDisplayBounds(value) {
980
- if (!value || 'object' != typeof value) return false;
981
- const bounds = value;
982
- return isFiniteNumber(bounds.x) && isFiniteNumber(bounds.y) && isFiniteNumber(bounds.width) && isFiniteNumber(bounds.height) && bounds.width > 0 && bounds.height > 0;
983
- }
984
- function isWindowsDisplayGeometry(value) {
985
- if (!value || 'object' != typeof value) return false;
986
- const candidate = value;
987
- return 'string' == typeof candidate.id && candidate.id.length > 0 && 'string' == typeof candidate.name && 'boolean' == typeof candidate.primary && isDisplayBounds(candidate.bounds);
988
- }
989
997
  function isDarwinDisplayGeometry(value) {
990
998
  if (!value || 'object' != typeof value) return false;
991
999
  const candidate = value;
992
- return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && isFiniteNumber(candidate.bounds.x) && isFiniteNumber(candidate.bounds.y) && isFiniteNumber(candidate.bounds.width) && isFiniteNumber(candidate.bounds.height);
1000
+ return Number.isInteger(candidate.screenIndex) && Number.isInteger(candidate.cgDisplayId) && 'boolean' == typeof candidate.primary && !!candidate.bounds && device_isFiniteNumber(candidate.bounds.x) && device_isFiniteNumber(candidate.bounds.y) && device_isFiniteNumber(candidate.bounds.width) && device_isFiniteNumber(candidate.bounds.height);
993
1001
  }
994
1002
  function readDarwinDisplayGeometries() {
995
1003
  const bin = getDisplayInfoBinary();
@@ -1059,11 +1067,6 @@ function resolveDarwinDisplayGeometryFromList(displayId, displays) {
1059
1067
  if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays.find((display)=>0 === display.screenIndex) || displays[0];
1060
1068
  return displays.find((display)=>display.screenIndex === screenIndex) || displays.find((display)=>display.cgDisplayId === screenIndex);
1061
1069
  }
1062
- function resolveWindowsDisplayGeometryFromList(displayId, displays) {
1063
- if (!displays.length) return;
1064
- if (void 0 === displayId || '' === displayId) return displays.find((display)=>display.primary) || displays[0];
1065
- return displays.find((display)=>display.id === displayId);
1066
- }
1067
1070
  function resolveDisplayGeometry(displayId, windowsDisplays) {
1068
1071
  if ('darwin' === process.platform) return resolveDarwinDisplayGeometryFromList(displayId, readDarwinDisplayGeometries());
1069
1072
  if ('win32' === process.platform) {
@@ -1286,7 +1289,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
1286
1289
  }
1287
1290
  async healthCheck(displays) {
1288
1291
  console.log('[HealthCheck] Starting health check...');
1289
- console.log("[HealthCheck] @midscene/computer v1.13.2-beta-20260923032453.0");
1292
+ console.log("[HealthCheck] @midscene/computer v1.13.2");
1290
1293
  console.log('[HealthCheck] Taking screenshot...');
1291
1294
  const screenshotTimeout = 15000;
1292
1295
  let timeoutId;
@@ -2820,7 +2823,7 @@ class ComputerMidsceneTools extends base_tools_namespaceObject.BaseMidsceneTools
2820
2823
  }
2821
2824
  const env_namespaceObject = require("@midscene/shared/env");
2822
2825
  function version() {
2823
- const currentVersion = "1.13.2-beta-20260923032453.0";
2826
+ const currentVersion = "1.13.2";
2824
2827
  console.log(`@midscene/computer v${currentVersion}`);
2825
2828
  return currentVersion;
2826
2829
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/computer",
3
- "version": "1.13.2-beta-20260923032453.0",
3
+ "version": "1.13.2",
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.13.2-beta-20260923032453.0",
37
- "@midscene/shared": "1.13.2-beta-20260923032453.0"
36
+ "@midscene/shared": "1.13.2",
37
+ "@midscene/core": "1.13.2"
38
38
  },
39
39
  "optionalDependencies": {
40
40
  "node-mac-permissions": "2.5.0"