testdriverai 4.1.32 → 4.1.34

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.
Files changed (3) hide show
  1. package/agent.js +10 -13
  2. package/lib/system.js +3 -1
  3. package/package.json +1 -1
package/agent.js CHANGED
@@ -220,13 +220,12 @@ const dieOnFatal = async (error) => {
220
220
  log.log("info", chalk.red("Fatal Error") + `\n${error.message}`);
221
221
  await summarize(error.message);
222
222
  return await exit(true);
223
- }
223
+ };
224
224
 
225
225
  // creates a new "thread" in which the AI is given an error
226
226
  // and responds. notice `actOnMarkdown` which will continue
227
227
  // the thread until there are no more codeblocks to execute
228
228
  const haveAIResolveError = async (error, markdown, depth = 0, undo = true) => {
229
-
230
229
  if (thisCommand == "run" || error.fatal) {
231
230
  return await dieOnFatal(error);
232
231
  }
@@ -271,10 +270,12 @@ const haveAIResolveError = async (error, markdown, depth = 0, undo = true) => {
271
270
 
272
271
  const mdStream = log.createMarkdownStreamLogger();
273
272
 
274
- let response = await sdk.req("error", {
275
- description: eMessage,
276
- markdown,
277
- image,
273
+ let response = await sdk.req(
274
+ "error",
275
+ {
276
+ description: eMessage,
277
+ markdown,
278
+ image,
278
279
  },
279
280
  (chunk) => {
280
281
  if (chunk.type === "data") {
@@ -506,7 +507,6 @@ const humanInput = async (currentTask, validateAndLoop = false) => {
506
507
  image: lastScreenshot,
507
508
  },
508
509
  (chunk) => {
509
-
510
510
  if (chunk.type === "data") {
511
511
  mdStream.log(chunk.data);
512
512
  }
@@ -558,6 +558,8 @@ const generate = async (type, count) => {
558
558
  sanitizeFilename(testPrompt.headings[0])
559
559
  .trim()
560
560
  .replace(/ /g, "-")
561
+ .replace(/['"`]/g, "")
562
+ .replace(/[^a-zA-Z0-9-]/g, "") // remove any non-alphanumeric chars except hyphens
561
563
  .toLowerCase() + ".md";
562
564
  let path1 = path.join(process.cwd(), "testdriver", "generate", fileName);
563
565
 
@@ -739,7 +741,6 @@ New commands will be appended.
739
741
  };
740
742
 
741
743
  let setTerminalWindowTransparency = async (hide) => {
742
-
743
744
  if (hide) {
744
745
  try {
745
746
  http
@@ -766,7 +767,6 @@ let setTerminalWindowTransparency = async (hide) => {
766
767
  return;
767
768
  }
768
769
 
769
-
770
770
  try {
771
771
  if (hide) {
772
772
  if (terminalApp) {
@@ -952,7 +952,6 @@ const promptUser = () => {
952
952
  };
953
953
 
954
954
  const setTerminalApp = async (win) => {
955
-
956
955
  if (terminalApp) return;
957
956
  if (process.platform === "win32") {
958
957
  terminalApp = win?.title || "";
@@ -1014,7 +1013,6 @@ const embed = async (file, depth) => {
1014
1013
  };
1015
1014
 
1016
1015
  const start = async () => {
1017
-
1018
1016
  // console.log(await system.getPrimaryDisplay());
1019
1017
 
1020
1018
  // @todo add-auth
@@ -1058,7 +1056,6 @@ const start = async () => {
1058
1056
  console.log("");
1059
1057
  }
1060
1058
 
1061
-
1062
1059
  // should be start of new session
1063
1060
  const sessionRes = await sdk.req("session/start", {
1064
1061
  systemInformationOsInfo: await system.getSystemInformationOsInfo(),
@@ -1096,5 +1093,5 @@ process.on("unhandledRejection", async (reason, promise) => {
1096
1093
 
1097
1094
  module.exports = {
1098
1095
  setTerminalApp,
1099
- start
1096
+ start,
1100
1097
  };
package/lib/system.js CHANGED
@@ -28,8 +28,10 @@ const getSystemInformationOsInfo = async () => {
28
28
  return await si.osInfo();
29
29
  };
30
30
 
31
+ let countImages = 0;
31
32
  const tmpFilename = () => {
32
- return path.join(os.tmpdir(), `${new Date().getTime() + Math.random()}.png`);
33
+ countImages = countImages + 1;
34
+ return path.join(os.tmpdir(), `${new Date().getTime() + countImages}.png`);
33
35
  };
34
36
 
35
37
  const captureAndResize = async (scale = 1, silent = false, mouse = false) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.1.32",
3
+ "version": "4.1.34",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {