@elizaos/plugin-computeruse 2.0.3-beta.5 → 2.0.3-beta.7

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/index.js CHANGED
@@ -7922,7 +7922,7 @@ function closeAllTerminalSessions() {
7922
7922
  }
7923
7923
 
7924
7924
  // src/platform/windows-list.ts
7925
- import { execSync as execSync5 } from "node:child_process";
7925
+ import { execFileSync as execFileSync7, execSync as execSync5 } from "node:child_process";
7926
7926
  function escapeAppleScriptString(value) {
7927
7927
  return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
7928
7928
  }
@@ -7967,36 +7967,41 @@ function runDarwinWindowScript(target, body) {
7967
7967
  const termList = terms.length > 0 ? `{${terms.map((term) => `"${escapeAppleScriptString(term)}"`).join(", ")}}` : "{}";
7968
7968
  const script = `
7969
7969
  tell application "System Events"
7970
+ set matchedProc to missing value
7970
7971
  repeat with proc in (every process whose visible is true)
7971
7972
  try
7972
7973
  set procName to name of proc
7973
- set matched to false
7974
7974
  repeat with term in ${termList}
7975
7975
  if procName contains term then
7976
- set matched to true
7976
+ set matchedProc to contents of proc
7977
7977
  exit repeat
7978
7978
  end if
7979
7979
  end repeat
7980
- if not matched then
7980
+ end try
7981
+ if matchedProc is not missing value then exit repeat
7982
+ end repeat
7983
+ if matchedProc is missing value then
7984
+ repeat with proc in (every process whose visible is true)
7985
+ try
7981
7986
  repeat with w in (every window of proc)
7982
- set winName to name of w
7983
7987
  repeat with term in ${termList}
7984
- if winName contains term then
7985
- set matched to true
7988
+ if (name of w) contains term then
7989
+ set matchedProc to contents of proc
7986
7990
  exit repeat
7987
7991
  end if
7988
7992
  end repeat
7989
- if matched then exit repeat
7993
+ if matchedProc is not missing value then exit repeat
7990
7994
  end repeat
7991
- end if
7992
- if matched then
7993
- ${body}
7994
- exit repeat
7995
- end if
7996
- end try
7997
- end repeat
7995
+ end try
7996
+ if matchedProc is not missing value then exit repeat
7997
+ end repeat
7998
+ end if
7999
+ if matchedProc is not missing value then
8000
+ set proc to matchedProc
8001
+ ${body}
8002
+ end if
7998
8003
  end tell`;
7999
- return runCommand("osascript", ["-e", script], 5000);
8004
+ return runCommand("osascript", ["-e", script], 15000);
8000
8005
  }
8001
8006
  function listWindows() {
8002
8007
  const os4 = currentPlatform();
@@ -8011,37 +8016,78 @@ function listWindows() {
8011
8016
  }
8012
8017
  return [];
8013
8018
  }
8014
- function listWindowsDarwin() {
8019
+ function parseDarwinWindowEntry(entry) {
8020
+ const [app, title] = entry.split("|||");
8021
+ const appName = app?.trim() ?? "";
8022
+ const winTitle = title?.trim() ?? "";
8023
+ if (!appName && !winTitle)
8024
+ return null;
8025
+ return {
8026
+ app: appName || "unknown",
8027
+ title: winTitle,
8028
+ id: winTitle || appName
8029
+ };
8030
+ }
8031
+ var DARWIN_WINDOW_LIST_SWIFT = `import CoreGraphics
8032
+ import Foundation
8033
+ let opts: CGWindowListOption = [.optionOnScreenOnly, .excludeDesktopElements]
8034
+ guard let list = CGWindowListCopyWindowInfo(opts, kCGNullWindowID) as? [[String: Any]] else { exit(0) }
8035
+ var out: [String] = []
8036
+ for w in list {
8037
+ if ((w[kCGWindowLayer as String] as? Int) ?? -1) != 0 { continue }
8038
+ let owner = (w[kCGWindowOwnerName as String] as? String) ?? ""
8039
+ let name = (w[kCGWindowName as String] as? String) ?? ""
8040
+ out.append(owner + "|||" + name)
8041
+ }
8042
+ print(out.joined(separator: "<<WIN>>"))`;
8043
+ function parseDarwinWindowOutput(output) {
8044
+ return output.split("<<WIN>>").map((entry) => entry.trim()).filter(Boolean).map(parseDarwinWindowEntry).filter((win) => win !== null);
8045
+ }
8046
+ function listWindowsDarwinViaSwift() {
8047
+ if (!commandExists("swift"))
8048
+ return null;
8049
+ try {
8050
+ const output = execFileSync7("swift", ["-"], {
8051
+ input: DARWIN_WINDOW_LIST_SWIFT,
8052
+ encoding: "utf-8",
8053
+ timeout: 15000,
8054
+ stdio: ["pipe", "pipe", "ignore"]
8055
+ });
8056
+ return parseDarwinWindowOutput(output);
8057
+ } catch {
8058
+ return null;
8059
+ }
8060
+ }
8061
+ function listWindowsDarwinViaSystemEvents() {
8015
8062
  try {
8016
8063
  const script = `
8017
8064
  tell application "System Events"
8018
- set windowList to {}
8065
+ set outText to ""
8019
8066
  repeat with proc in (every process whose visible is true)
8020
8067
  try
8068
+ set procName to name of proc
8021
8069
  repeat with w in (every window of proc)
8022
- set end of windowList to (name of proc) & "|||" & (name of w) & "|||" & (id of w as text)
8070
+ try
8071
+ set outText to outText & procName & "|||" & (name of w) & "<<WIN>>"
8072
+ end try
8023
8073
  end repeat
8024
8074
  end try
8025
8075
  end repeat
8026
- return windowList as text
8076
+ return outText
8027
8077
  end tell`;
8028
8078
  const output = execSync5(`osascript -e '${script}'`, {
8029
8079
  encoding: "utf-8",
8030
- timeout: 1e4,
8080
+ timeout: 20000,
8031
8081
  stdio: ["ignore", "pipe", "ignore"]
8032
8082
  });
8033
- return output.split(", ").filter(Boolean).map((entry) => {
8034
- const parts = entry.split("|||");
8035
- return {
8036
- app: parts[0] ?? "unknown",
8037
- title: parts[1] ?? "unknown",
8038
- id: parts[2] ?? "0"
8039
- };
8040
- });
8083
+ return parseDarwinWindowOutput(output);
8041
8084
  } catch {
8042
8085
  return [];
8043
8086
  }
8044
8087
  }
8088
+ function listWindowsDarwin() {
8089
+ return listWindowsDarwinViaSwift() ?? listWindowsDarwinViaSystemEvents();
8090
+ }
8045
8091
  function listWindowsLinux() {
8046
8092
  try {
8047
8093
  if (commandExists("wmctrl")) {
@@ -8091,10 +8137,10 @@ function getActiveWindow() {
8091
8137
  set proc to first process whose frontmost is true
8092
8138
  set procName to name of proc
8093
8139
  try
8094
- set w to window 1 of proc
8095
- return procName & "|||" & (name of w) & "|||" & (id of w as text)
8140
+ set winName to name of window 1 of proc
8141
+ return procName & "|||" & winName & "|||" & winName
8096
8142
  on error
8097
- return procName & "|||" & "" & "|||" & "0"
8143
+ return procName & "|||" & "" & "|||" & procName
8098
8144
  end try
8099
8145
  end tell`;
8100
8146
  const out = execSync5(`osascript -e '${script}'`, {
@@ -8539,7 +8585,7 @@ function getScreenSize() {
8539
8585
  import { EventEmitter } from "node:events";
8540
8586
 
8541
8587
  // src/scene/a11y-provider.ts
8542
- import { execFileSync as execFileSync7 } from "node:child_process";
8588
+ import { execFileSync as execFileSync8 } from "node:child_process";
8543
8589
  class NullAccessibilityProvider {
8544
8590
  name = "null";
8545
8591
  available() {
@@ -8621,7 +8667,7 @@ except Exception as e:
8621
8667
  print("[]")
8622
8668
  `;
8623
8669
  try {
8624
- const text = execFileSync7("python3", ["-c", py], {
8670
+ const text = execFileSync8("python3", ["-c", py], {
8625
8671
  timeout: 4000,
8626
8672
  encoding: "utf8",
8627
8673
  stdio: ["ignore", "pipe", "ignore"]
@@ -8650,7 +8696,7 @@ except Exception as e:
8650
8696
  }
8651
8697
  tryHyprland() {
8652
8698
  try {
8653
- const text = execFileSync7("hyprctl", ["clients", "-j"], {
8699
+ const text = execFileSync8("hyprctl", ["clients", "-j"], {
8654
8700
  timeout: 3000,
8655
8701
  encoding: "utf8",
8656
8702
  stdio: ["ignore", "pipe", "ignore"]
@@ -8662,7 +8708,7 @@ except Exception as e:
8662
8708
  }
8663
8709
  trySway() {
8664
8710
  try {
8665
- const text = execFileSync7("swaymsg", ["-t", "get_tree"], {
8711
+ const text = execFileSync8("swaymsg", ["-t", "get_tree"], {
8666
8712
  timeout: 3000,
8667
8713
  encoding: "utf8",
8668
8714
  stdio: ["ignore", "pipe", "ignore"]
@@ -8796,7 +8842,7 @@ class DarwinAccessibilityProvider {
8796
8842
  }
8797
8843
  JSON.stringify(out);
8798
8844
  `;
8799
- const text = execFileSync7("osascript", ["-l", "JavaScript", "-e", script], {
8845
+ const text = execFileSync8("osascript", ["-l", "JavaScript", "-e", script], {
8800
8846
  timeout: 8000,
8801
8847
  encoding: "utf8",
8802
8848
  stdio: ["ignore", "pipe", "ignore"]
@@ -8855,7 +8901,7 @@ while ($child -and $count -lt 50) {
8855
8901
  $out | ConvertTo-Json -Depth 4 -Compress
8856
8902
  `;
8857
8903
  try {
8858
- const text = execFileSync7("powershell", ["-NoProfile", "-Command", ps], {
8904
+ const text = execFileSync8("powershell", ["-NoProfile", "-Command", ps], {
8859
8905
  timeout: 1e4,
8860
8906
  encoding: "utf8",
8861
8907
  stdio: ["ignore", "pipe", "ignore"]
@@ -8885,10 +8931,10 @@ $out | ConvertTo-Json -Depth 4 -Compress
8885
8931
  }
8886
8932
 
8887
8933
  // src/scene/apps.ts
8888
- import { execFileSync as execFileSync9 } from "node:child_process";
8934
+ import { execFileSync as execFileSync10 } from "node:child_process";
8889
8935
 
8890
8936
  // src/platform/process-list.ts
8891
- import { execFileSync as execFileSync8, execSync as execSync6 } from "node:child_process";
8937
+ import { execFileSync as execFileSync9, execSync as execSync6 } from "node:child_process";
8892
8938
  import { readdirSync, readFileSync as readFileSync4 } from "node:fs";
8893
8939
  function listProcesses() {
8894
8940
  const os4 = currentPlatform();
@@ -8928,7 +8974,7 @@ function listLinux() {
8928
8974
  }
8929
8975
  function listDarwin() {
8930
8976
  try {
8931
- const text = execFileSync8("ps", ["-axco", "pid=,comm="], {
8977
+ const text = execFileSync9("ps", ["-axco", "pid=,comm="], {
8932
8978
  timeout: 4000,
8933
8979
  encoding: "utf8",
8934
8980
  stdio: ["ignore", "pipe", "ignore"]
@@ -8936,7 +8982,7 @@ function listDarwin() {
8936
8982
  return parsePsOutput(text);
8937
8983
  } catch {
8938
8984
  try {
8939
- const text = execFileSync8("ps", ["-axo", "pid=,comm="], {
8985
+ const text = execFileSync9("ps", ["-axo", "pid=,comm="], {
8940
8986
  timeout: 4000,
8941
8987
  encoding: "utf8",
8942
8988
  stdio: ["ignore", "pipe", "ignore"]
@@ -9090,7 +9136,7 @@ function joinAppsAndWindows(procs, windows, platform3) {
9090
9136
  function linuxPidMapFromWmctrl() {
9091
9137
  const out = new Map;
9092
9138
  try {
9093
- const text = execFileSync9("wmctrl", ["-l", "-p"], {
9139
+ const text = execFileSync10("wmctrl", ["-l", "-p"], {
9094
9140
  timeout: 3000,
9095
9141
  encoding: "utf8",
9096
9142
  stdio: ["ignore", "pipe", "ignore"]
@@ -11789,7 +11835,7 @@ async function handleComputerUseRoutes(req, res, pathname, method) {
11789
11835
  return false;
11790
11836
  }
11791
11837
  // src/routes/sandbox-routes.ts
11792
- import { execFileSync as execFileSync10, execSync as execSync7 } from "node:child_process";
11838
+ import { execFileSync as execFileSync11, execSync as execSync7 } from "node:child_process";
11793
11839
  import { readFileSync as readFileSync5, unlinkSync as unlinkSync5, writeFileSync as writeFileSync2 } from "node:fs";
11794
11840
  import { platform as platform3, tmpdir as tmpdir6 } from "node:os";
11795
11841
  import { join as join6 } from "node:path";
@@ -12404,7 +12450,7 @@ function resolveAudioFormat(input) {
12404
12450
  return { format: normalized };
12405
12451
  }
12406
12452
  function runCommand2(command, args, timeout) {
12407
- execFileSync10(command, args, {
12453
+ execFileSync11(command, args, {
12408
12454
  timeout,
12409
12455
  stdio: ["ignore", "pipe", "pipe"]
12410
12456
  });
@@ -12964,7 +13010,7 @@ function readJsonBody(req, res) {
12964
13010
  });
12965
13011
  }
12966
13012
  // src/services/desktop-control.ts
12967
- import { execFileSync as execFileSync11 } from "node:child_process";
13013
+ import { execFileSync as execFileSync12 } from "node:child_process";
12968
13014
  import { readFileSync as readFileSync6, unlinkSync as unlinkSync6 } from "node:fs";
12969
13015
  import { platform as platform4, tmpdir as tmpdir7 } from "node:os";
12970
13016
  import { join as join7 } from "node:path";
@@ -12981,7 +13027,7 @@ function isHeadfulGuiAvailable() {
12981
13027
  function commandExists3(command) {
12982
13028
  try {
12983
13029
  const which = platform4() === "win32" ? "where" : "which";
12984
- execFileSync11(which, [command], {
13030
+ execFileSync12(which, [command], {
12985
13031
  stdio: "ignore",
12986
13032
  timeout: 3000
12987
13033
  });
@@ -13039,7 +13085,7 @@ function captureDesktopScreenshot(region) {
13039
13085
  "$graphics.Dispose()",
13040
13086
  "$bitmap.Dispose()"
13041
13087
  ].join("; ");
13042
- execFileSync11("powershell", ["-Command", psCommand], {
13088
+ execFileSync12("powershell", ["-Command", psCommand], {
13043
13089
  timeout: 15000,
13044
13090
  stdio: ["ignore", "pipe", "pipe"]
13045
13091
  });
@@ -13075,7 +13121,7 @@ function listDesktopWindows() {
13075
13121
  end tell`;
13076
13122
  let output;
13077
13123
  try {
13078
- output = execFileSync11("osascript", ["-e", script], {
13124
+ output = execFileSync12("osascript", ["-e", script], {
13079
13125
  encoding: "utf-8",
13080
13126
  timeout: 5000,
13081
13127
  stdio: ["ignore", "pipe", "ignore"]
@@ -13095,7 +13141,7 @@ function listDesktopWindows() {
13095
13141
  }
13096
13142
  if (os5 === "linux") {
13097
13143
  if (commandExists3("wmctrl")) {
13098
- const output = execFileSync11("wmctrl", ["-l"], {
13144
+ const output = execFileSync12("wmctrl", ["-l"], {
13099
13145
  encoding: "utf-8",
13100
13146
  timeout: 5000
13101
13147
  });
@@ -13110,7 +13156,7 @@ function listDesktopWindows() {
13110
13156
  });
13111
13157
  }
13112
13158
  if (commandExists3("xdotool")) {
13113
- const output = execFileSync11("sh", ["-c", 'xdotool search --name "" getwindowname 2>/dev/null'], {
13159
+ const output = execFileSync12("sh", ["-c", 'xdotool search --name "" getwindowname 2>/dev/null'], {
13114
13160
  encoding: "utf-8",
13115
13161
  timeout: 5000
13116
13162
  });
@@ -13123,7 +13169,7 @@ function listDesktopWindows() {
13123
13169
  }
13124
13170
  }
13125
13171
  if (os5 === "win32") {
13126
- const output = execFileSync11("powershell", [
13172
+ const output = execFileSync12("powershell", [
13127
13173
  "-Command",
13128
13174
  "Get-Process | Where-Object {$_.MainWindowTitle} | Select-Object Id, MainWindowTitle | ConvertTo-Json"
13129
13175
  ], { encoding: "utf-8", timeout: 1e4 });
@@ -13464,7 +13510,7 @@ function detectWindowListCapability(os5) {
13464
13510
  return { available: false, tool: "unsupported platform" };
13465
13511
  }
13466
13512
  function runCommand3(command, args, timeout) {
13467
- execFileSync11(command, args, {
13513
+ execFileSync12(command, args, {
13468
13514
  timeout,
13469
13515
  stdio: ["ignore", "pipe", "pipe"]
13470
13516
  });
@@ -13489,7 +13535,7 @@ function canCaptureMacScreen() {
13489
13535
  }
13490
13536
  function canUseMacSystemEvents() {
13491
13537
  try {
13492
- execFileSync11("osascript", ["-e", 'tell application "System Events" to count of processes'], {
13538
+ execFileSync12("osascript", ["-e", 'tell application "System Events" to count of processes'], {
13493
13539
  encoding: "utf-8",
13494
13540
  timeout: 3000,
13495
13541
  stdio: ["ignore", "pipe", "ignore"]
@@ -13710,5 +13756,5 @@ export {
13710
13756
  AGENT_LOOP_SETTING
13711
13757
  };
13712
13758
 
13713
- //# debugId=771F2F7D00E9BD4564756E2164756E21
13759
+ //# debugId=06C5D42C5305D81664756E2164756E21
13714
13760
  //# sourceMappingURL=index.js.map