testronaut 1.0.6 → 1.0.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/core/turnLoop.js CHANGED
@@ -92,6 +92,17 @@ export const turnLoop = async (browser, messages, maxTurns, currentTurn = 0, ret
92
92
 
93
93
  let response;
94
94
  try {
95
+ // console.log(
96
+ // '🔍 Verifying message structure before OpenAI call:\n',
97
+ // messages.map(m => ({
98
+ // role: m.role,
99
+ // name: m.name,
100
+ // tool_call_id: m.tool_call_id,
101
+ // tool_calls: m.tool_calls?.map(t => t.id),
102
+ // content: m.content?.slice?.(0, 100), // truncate for readability
103
+ // }))
104
+ // );
105
+
95
106
  response = await openai.chat.completions.create({
96
107
  model: 'gpt-4o',
97
108
  messages,
@@ -148,6 +159,7 @@ export const turnLoop = async (browser, messages, maxTurns, currentTurn = 0, ret
148
159
  console.log(`[model] → ${fnName}`, args);
149
160
  console.log('Calling tool:', fnName);
150
161
  let result;
162
+ let errorMessage = null;
151
163
  try {
152
164
  console.log("agentMemory: ", agentMemory);
153
165
  result = await CHROME_TOOL_MAP[fnName](browser, args, agentMemory);
@@ -165,9 +177,13 @@ export const turnLoop = async (browser, messages, maxTurns, currentTurn = 0, ret
165
177
  result = JSON.stringify(result ?? '');
166
178
  }
167
179
  } catch (err) {
168
- result = `ERROR: ${err.message}`;
180
+ errorMessage = `ERROR: ${err.message}`;
181
+ result = errorMessage;
169
182
  }
170
183
 
184
+ // 🔍 Diagnostic: log whether this tool call succeeded or failed
185
+ console.log(`[tool ] ← ${fnName} result:`, errorMessage ? '❌ Failed' : '✅ Success');
186
+
171
187
  const truncated = result.length > 100 ? result.slice(0, 100) + '…' : result;
172
188
 
173
189
  if (result.length > 100) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testronaut",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "main": "./runner/testronaut.js",
5
5
  "bin": {
6
6
  "testronaut": "./bin/cli.js"
@@ -90,7 +90,7 @@ export class ChromeBrowser {
90
90
  if (innerText.includes(text)) {
91
91
  await el.scrollIntoViewIfNeeded().catch(() => {});
92
92
  await el.click();
93
- await this.page.screenshot({ path: `screenshot_after_click_${Date.now()}.png` });
93
+ await this.page.screenshot({ path: `missions/mission_reports/screenshot_after_click_${Date.now()}.png` });
94
94
  await this.page.waitForTimeout(5000);
95
95
  // await this.page.screenshot({ path: `screenshot_after_waiting_click_${Date.now()}.png` });
96
96
  return `clicked text "${text}"`;
@@ -119,7 +119,7 @@ export class ChromeBrowser {
119
119
  console.log(`[click_text] → Clicking visible element with bounding box`, box);
120
120
  await el.click();
121
121
  await this.page.waitForTimeout(delayMs);
122
- await this.page.screenshot({ path: `screenshot_after_click_${Date.now()}.png` });
122
+ await this.page.screenshot({ path: `missions/mission_reports/screenshot_after_click_${Date.now()}.png` });
123
123
  return `clicked visible text "${text}"`;
124
124
  }
125
125
  }
@@ -12,8 +12,8 @@ export const tokenEstimate = async (model, text) => {
12
12
  }
13
13
 
14
14
  export const tokenUseCoolOff = async (totalTokensUsed, turnTimestamps) => {
15
- console.log("total tokens used: ", totalTokensUsed);
16
- console.log("turnTimestamps: ", turnTimestamps);
15
+ // console.log("total tokens used: ", totalTokensUsed);
16
+ // console.log("turnTimestamps: ", turnTimestamps);
17
17
 
18
18
  if (totalTokensUsed > TOKEN_LIMIT_PER_MIN) {
19
19
  const msToWait = await getDynamicBackoffMs(turnTimestamps);
@@ -34,6 +34,9 @@ export function validateAndInsertMissingToolResponses(messages, options = {}) {
34
34
  );
35
35
 
36
36
  if (!hasResponse) {
37
+ console.warn(
38
+ `⚠️ Missing response for tool_call_id: ${expectedId}, function: ${toolCall.function.name}, from assistant message index: ${i}`
39
+ );
37
40
  missingResponses.push(expectedId);
38
41
 
39
42
  if (insertPlaceholders) {