testdriverai 7.2.92 → 7.3.1

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/agent/index.js CHANGED
@@ -437,10 +437,13 @@ class TestDriverAgent extends EventEmitter2 {
437
437
  this.emitter.emit(events.log.narration, theme.dim("checking..."));
438
438
 
439
439
  // check asks the ai if the task is complete
440
- let thisScreenshot = await this.system.captureScreenBase64(1, false, true);
440
+ // Parallelize system calls for better performance
441
+ const [thisScreenshot, mousePosition, activeWindow] = await Promise.all([
442
+ this.system.captureScreenBase64(1, false, true),
443
+ this.system.getMousePosition(),
444
+ this.system.activeWin(),
445
+ ]);
441
446
  let images = [this.lastScreenshot, thisScreenshot];
442
- let mousePosition = await this.system.getMousePosition();
443
- let activeWindow = await this.system.activeWin();
444
447
 
445
448
  let response = await this.sdk.req("check", {
446
449
  tasks: this.tasks,
@@ -902,12 +905,18 @@ commands:
902
905
 
903
906
  this.emitter.emit(events.log.narration, theme.dim("thinking..."), true);
904
907
 
905
- this.lastScreenshot = await this.system.captureScreenBase64();
908
+ // Parallelize system calls for better performance
909
+ const [screenshot, mousePosition, activeWindow] = await Promise.all([
910
+ this.system.captureScreenBase64(),
911
+ this.system.getMousePosition(),
912
+ this.system.activeWin(),
913
+ ]);
914
+ this.lastScreenshot = screenshot;
906
915
 
907
916
  let message = await this.sdk.req("input", {
908
917
  input: currentTask,
909
- mousePosition: await this.system.getMousePosition(),
910
- activeWindow: await this.system.activeWin(),
918
+ mousePosition,
919
+ activeWindow,
911
920
  image: this.lastScreenshot,
912
921
  });
913
922
 
@@ -938,13 +947,15 @@ commands:
938
947
 
939
948
  this.emitter.emit(events.log.narration, theme.dim("thinking..."), true);
940
949
 
941
- let image = await this.system.captureScreenBase64();
942
-
943
950
  const streamId = `generate-${Date.now()}`;
944
951
  this.emitter.emit(events.log.markdown.start, streamId);
945
952
 
946
- let mouse = await this.system.getMousePosition();
947
- let activeWindow = await this.system.activeWin();
953
+ // Parallelize system calls for better performance
954
+ const [image, mouse, activeWindow] = await Promise.all([
955
+ this.system.captureScreenBase64(),
956
+ this.system.getMousePosition(),
957
+ this.system.activeWin(),
958
+ ]);
948
959
 
949
960
  let message = await this.sdk.req(
950
961
  "generate",
@@ -10,7 +10,10 @@ const createAnalytics = (emitter, config, sessionInstance) => {
10
10
  return;
11
11
  }
12
12
  if (Math.random() <= 0.01) {
13
- await sdk.req("analytics", { event, data });
13
+ // Fire-and-forget: don't await analytics calls
14
+ sdk.req("analytics", { event, data }).catch((err) => {
15
+ console.warn("Analytics track failed:", err.message);
16
+ });
14
17
  }
15
18
  },
16
19
  };