feat(tools): extend cancellation to browser, web, and process tools

This commit is contained in:
William Valentin
2026-02-15 22:12:03 -08:00
parent 7877a1bcc9
commit b4006e91ff
10 changed files with 228 additions and 32 deletions
+12
View File
@@ -154,4 +154,16 @@ describe('Browser tools', () => {
expect(result.success).toBe(false);
expect(result.error).toContain('Element not found');
});
it('returns aborted error when signal is already aborted', async () => {
const tool = tools.find(t => t.name === 'browser.navigate')!;
const controller = new AbortController();
controller.abort();
const result = await tool.execute({ url: 'https://example.com' }, { signal: controller.signal });
expect(result.success).toBe(false);
expect(result.error).toContain('aborted');
expect(mockManager.getPage).not.toHaveBeenCalled();
expect(mockGoto).not.toHaveBeenCalled();
});
});