testdriverai 5.1.1 → 5.1.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/agent.js +7 -3
- package/lib/logger.js +4 -1
- package/lib/speak.js +0 -1
- package/lib/websockets.js +10 -3
- package/package.json +1 -1
package/agent.js
CHANGED
|
@@ -31,7 +31,7 @@ const sanitizeFilename = require("sanitize-filename");
|
|
|
31
31
|
const macScreenPerms = require("mac-screen-capture-permissions");
|
|
32
32
|
|
|
33
33
|
// local modules
|
|
34
|
-
const
|
|
34
|
+
const websocketserver = require("./lib/websockets.js");
|
|
35
35
|
const speak = require("./lib/speak.js");
|
|
36
36
|
const analytics = require("./lib/analytics.js");
|
|
37
37
|
const log = require("./lib/logger.js");
|
|
@@ -63,6 +63,7 @@ let checkCount = 0;
|
|
|
63
63
|
let checkLimit = 7;
|
|
64
64
|
let lastScreenshot = null;
|
|
65
65
|
let rl;
|
|
66
|
+
let wss;
|
|
66
67
|
|
|
67
68
|
// list of prompts that the user has given us
|
|
68
69
|
let tasks = [];
|
|
@@ -837,7 +838,7 @@ const firstPrompt = async () => {
|
|
|
837
838
|
|
|
838
839
|
rl.on("line", handleInput);
|
|
839
840
|
|
|
840
|
-
wss.addEventListener("input", async (message) => {
|
|
841
|
+
config.TD_VM && wss.addEventListener("input", async (message) => {
|
|
841
842
|
handleInput(message.data);
|
|
842
843
|
});
|
|
843
844
|
|
|
@@ -1081,7 +1082,7 @@ ${yaml.dump(step)}
|
|
|
1081
1082
|
};
|
|
1082
1083
|
|
|
1083
1084
|
const promptUser = () => {
|
|
1084
|
-
wss.sendToClients("done");
|
|
1085
|
+
config.TD_VM && wss.sendToClients("done");
|
|
1085
1086
|
emitter.emit(events.interactive, true);
|
|
1086
1087
|
rl.prompt(true);
|
|
1087
1088
|
};
|
|
@@ -1144,6 +1145,9 @@ const embed = async (file, depth) => {
|
|
|
1144
1145
|
|
|
1145
1146
|
const buildEnv = async () => {
|
|
1146
1147
|
let win = await system.activeWin();
|
|
1148
|
+
if (config.TD_VM) {
|
|
1149
|
+
wss = websocketserver.create();
|
|
1150
|
+
}
|
|
1147
1151
|
setTerminalApp(win);
|
|
1148
1152
|
await ensureMacScreenPerms();
|
|
1149
1153
|
await makeSandbox();
|
package/lib/logger.js
CHANGED
|
@@ -10,6 +10,7 @@ const shouldLog =
|
|
|
10
10
|
// responsible for rendering ai markdown output
|
|
11
11
|
const { marked } = require("marked");
|
|
12
12
|
const { markedTerminal } = require("marked-terminal");
|
|
13
|
+
const { config } = require("dotenv");
|
|
13
14
|
|
|
14
15
|
const { printf } = winston.format;
|
|
15
16
|
|
|
@@ -84,7 +85,9 @@ const createMarkdownStreamLogger = () => {
|
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
if (config.TD_VM) {
|
|
89
|
+
websockets.sendToClients("output", chunk);
|
|
90
|
+
}
|
|
88
91
|
|
|
89
92
|
const previousConsoleOutput = markedParsePartial(buffer, 0, -1);
|
|
90
93
|
|
package/lib/speak.js
CHANGED
package/lib/websockets.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const WebSocket = require('ws');
|
|
2
|
+
const config = require('./config');
|
|
2
3
|
|
|
4
|
+
let instance;
|
|
3
5
|
class WebSocketServerSingleton {
|
|
4
6
|
constructor() {
|
|
7
|
+
|
|
5
8
|
if (!WebSocketServerSingleton.instance) {
|
|
6
9
|
this.wss = new WebSocket.Server({ port: 8080 }, () => {
|
|
7
10
|
});
|
|
@@ -72,7 +75,11 @@ class WebSocketServerSingleton {
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
const instance = new WebSocketServerSingleton();
|
|
76
|
-
Object.freeze(instance);
|
|
77
78
|
|
|
78
|
-
module.exports =
|
|
79
|
+
module.exports = {
|
|
80
|
+
create: () => {
|
|
81
|
+
instance = new WebSocketServerSingleton();
|
|
82
|
+
Object.freeze(instance);
|
|
83
|
+
return instance;
|
|
84
|
+
}
|
|
85
|
+
};
|