diff options
| author | amankumarsingh77 <amankumarsingh7702@gmal.com> | 2026-05-04 22:44:55 +0530 |
|---|---|---|
| committer | amankumarsingh77 <amankumarsingh7702@gmal.com> | 2026-05-04 22:44:55 +0530 |
| commit | 71da8e0719c50d9b11c918b032b9ed4d77aabf5b (patch) | |
| tree | 16794f5884f95abe9fff79d7eec7e08f24286aed /src/registry.ts | |
| parent | 2a98be01d28044beabe6a1363f01a5a3acde9fd5 (diff) | |
feat: parallel tool execution with automatic mutation serialization
- Add lightweight async mutex (src/util/mutex.ts) for FIFO serialization
- Add serialized?: boolean to BrowserToolDefinition
- Wire mutex acquisition into registerBrowserTool execute wrapper
- Expose mutationMutex() on BrowserClient
- Mark all mutation tools (click, type, scroll, navigate, switch_tab, etc.) as serialized
- Leave observation tools (screenshot, page_info, execute_js, http_get, etc.) unguarded
- Update prompt and skill docs to reflect parallel-safe behavior
- Fix scroll tool: add Page.bringToFront, explicit button:none/buttons:0/pointerType:mouse
- Update .gitignore to ignore scripts/ and data/ folders
Diffstat (limited to 'src/registry.ts')
| -rw-r--r-- | src/registry.ts | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/registry.ts b/src/registry.ts index 5f9d7da..d9b7cea 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -16,31 +16,34 @@ import { dragAndDropTool } from "./domains/drag"; import { httpGetTool, getNetworkLogTool } from "./domains/network"; import { executeJsTool, runScriptTool } from "./domains/js"; +// Mutation tools that modify page / browser state are marked `serialized: true` +// so they run through a shared async mutex. Observation / read-only tools are +// left unmarked and can execute in parallel. const TOOLS: ReadonlyArray<AnyBrowserToolDefinition> = [ - clickTool, - typeTool, - pressKeyTool, - dispatchKeyTool, - scrollTool, + { ...clickTool, serialized: true }, + { ...typeTool, serialized: true }, + { ...pressKeyTool, serialized: true }, + { ...dispatchKeyTool, serialized: true }, + { ...scrollTool, serialized: true }, pageInfoTool, waitTool, - waitForLoadTool, - handleDialogTool, + { ...waitForLoadTool, serialized: true }, + { ...handleDialogTool, serialized: true }, screenshotTool, - navigateTool, - openUrlsTool, - goBackTool, - goForwardTool, - reloadTool, + { ...navigateTool, serialized: true }, + { ...openUrlsTool, serialized: true }, + { ...goBackTool, serialized: true }, + { ...goForwardTool, serialized: true }, + { ...reloadTool, serialized: true }, listTabsTool, currentTabTool, - switchTabTool, - newTabTool, - uploadFileTool, - downloadTool, - printToPdfTool, - viewportResizeTool, - dragAndDropTool, + { ...switchTabTool, serialized: true }, + { ...newTabTool, serialized: true }, + { ...uploadFileTool, serialized: true }, + { ...downloadTool, serialized: true }, + { ...printToPdfTool, serialized: true }, + { ...viewportResizeTool, serialized: true }, + { ...dragAndDropTool, serialized: true }, httpGetTool, getNetworkLogTool, executeJsTool, |
