Skip to content

Commit a1404d4

Browse files
committed
interesting.
1 parent 902efa1 commit a1404d4

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

src/core/toolAgent.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ const CONFIG = {
7373
"3. Update documentation as needed",
7474
"4. Consider adding documentation if you encountered setup/understanding challenges",
7575
"",
76+
"Feel free to use Google and Bing via the browser tools to search for information or for ideas when you get stuck.",
77+
"",
7678
"When you run into issues or unexpected results, take a step back and read the project documentation and configuration files and look at other source files in the project for examples of what works.",
7779
"",
7880
"Use sub-agents for parallel tasks, providing them with specific context they need rather than having them rediscover it.",
@@ -112,7 +114,7 @@ async function executeTools(
112114
toolCalls: ToolUseContent[],
113115
tools: Tool[],
114116
messages: Message[],
115-
logger: Logger,
117+
logger: Logger
116118
): Promise<ToolCallResult> {
117119
if (toolCalls.length === 0) {
118120
return { sequenceCompleted: false, toolResults: [] };
@@ -134,7 +136,7 @@ async function executeTools(
134136
content: toolResult,
135137
isComplete: call.name === "sequenceComplete",
136138
};
137-
}),
139+
})
138140
);
139141

140142
const toolResults = results.map(({ type, tool_use_id, content }) => ({
@@ -160,7 +162,7 @@ export const toolAgent = async (
160162
initialPrompt: string,
161163
tools: Tool[],
162164
logger: Logger,
163-
config = CONFIG,
165+
config = CONFIG
164166
): Promise<ToolAgentResult> => {
165167
logger.verbose("Starting agent execution");
166168
logger.verbose("Initial prompt:", initialPrompt);
@@ -189,7 +191,7 @@ export const toolAgent = async (
189191
logger.verbose(
190192
`Requesting completion ${i + 1} with ${messages.length} messages with ${
191193
JSON.stringify(messages).length
192-
} bytes`,
194+
} bytes`
193195
);
194196

195197
interactions++;
@@ -218,15 +220,15 @@ export const toolAgent = async (
218220
interactions,
219221
};
220222
logger.verbose(
221-
`Agent completed with ${result.tokens.input} input tokens, ${result.tokens.output} output tokens in ${result.interactions} interactions`,
223+
`Agent completed with ${result.tokens.input} input tokens, ${result.tokens.output} output tokens in ${result.interactions} interactions`
222224
);
223225
return result;
224226
}
225227

226228
totalInputTokens += response.usage.input_tokens;
227229
totalOutputTokens += response.usage.output_tokens;
228230
logger.verbose(
229-
` Token usage: ${response.usage.input_tokens} input, ${response.usage.output_tokens} output`,
231+
` Token usage: ${response.usage.input_tokens} input, ${response.usage.output_tokens} output`
230232
);
231233

232234
const { content, toolCalls } = processResponse(response);
@@ -245,7 +247,7 @@ export const toolAgent = async (
245247
toolCalls,
246248
tools,
247249
messages,
248-
logger,
250+
logger
249251
);
250252

251253
if (sequenceCompleted) {
@@ -260,7 +262,7 @@ export const toolAgent = async (
260262
interactions,
261263
};
262264
logger.verbose(
263-
`Agent completed with ${result.tokens.input} input tokens, ${result.tokens.output} output tokens in ${result.interactions} interactions`,
265+
`Agent completed with ${result.tokens.input} input tokens, ${result.tokens.output} output tokens in ${result.interactions} interactions`
264266
);
265267
return result;
266268
}
@@ -276,7 +278,7 @@ export const toolAgent = async (
276278
interactions,
277279
};
278280
logger.verbose(
279-
`Agent completed with ${result.tokens.input} input tokens, ${result.tokens.output} output tokens in ${result.interactions} interactions`,
281+
`Agent completed with ${result.tokens.input} input tokens, ${result.tokens.output} output tokens in ${result.interactions} interactions`
280282
);
281283
return result;
282284
};

src/tools/browser/wait-behavior.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ describe("Wait Behavior Tests", () => {
2222
});
2323

2424
it("should handle dynamic loading with explicit waits", async () => {
25+
// Set longer timeout for this test
26+
vi.setConfig({ testTimeout: 10000 });
2527
await session.page.click("button");
2628

2729
// Wait for loading element to appear and then disappear
@@ -41,7 +43,7 @@ describe("Wait Behavior Tests", () => {
4143
await session.page.waitForSelector("#nonexistent", { timeout: 1000 });
4244
expect(true).toBe(false); // Should not reach here
4345
} catch (error: any) {
44-
expect(error.message).toContain("timeout");
46+
expect(error.message).toContain("Timeout");
4547
}
4648
});
4749
});
@@ -65,6 +67,8 @@ describe("Wait Behavior Tests", () => {
6567
});
6668

6769
it("should handle multiple sequential dynamic changes", async () => {
70+
// Set longer timeout for this test
71+
vi.setConfig({ testTimeout: 10000 });
6872
// Remove checkbox
6973
await session.page.click('button:has-text("Remove")');
7074
await session.page.waitForSelector("#checkbox", { state: "hidden" });

vitest.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,26 @@ export default defineConfig({
55
include: ["src/**/*.test.ts"],
66
environment: "node",
77
globals: true,
8+
// Default timeout for all tests
9+
testTimeout: 10000,
10+
// Timeout for hook operations
11+
hookTimeout: 10000,
12+
// Pool timeout for workers
13+
poolTimeout: 30000,
14+
// Specific environment configurations
15+
environmentOptions: {
16+
// Browser-specific timeouts when running browser tests
17+
browser: {
18+
testTimeout: 30000,
19+
hookTimeout: 30000,
20+
},
21+
},
22+
// Browser tests configuration
23+
browser: {
24+
enabled: true,
25+
name: 'chrome',
26+
provider: 'playwright',
27+
headless: true,
28+
},
829
},
930
});

0 commit comments

Comments
 (0)