fix(browser): wire all hanzo.* commands end-to-end, zero gaps

- Forward hanzo.dblclick/hover/type/clear/select/check/uncheck through
  chrome.runtime to browser-control
- Add browser.dblclick, browser.clear, browser.check, browser.uncheck,
  browser.focus, browser.blur, browser.drag, browser.scrollIntoView
  to handleBrowserAction
- Add actionMap for naming mismatches (url→getURL, title→getTitle, etc.)
- Verified: 0 gaps in server→client→browser-control chain
This commit is contained in:
Hanzo Dev
2026-03-06 03:45:54 -08:00
parent 04a42286c8
commit d9d506e707
2 changed files with 39 additions and 1 deletions
+24
View File
@@ -994,9 +994,33 @@ export class BrowserControl {
case 'browser.scroll':
sendResponse({ success: await this.scroll(tabId, request.x, request.y, request.selector) });
break;
case 'browser.dblclick':
sendResponse({ success: await this.doubleClick(tabId, request.selector) });
break;
case 'browser.hover':
sendResponse({ success: await this.hover(tabId, request.selector) });
break;
case 'browser.clear':
sendResponse({ success: await this.fill(tabId, request.selector, '') });
break;
case 'browser.check':
sendResponse({ success: await this.check(tabId, request.selector, true) });
break;
case 'browser.uncheck':
sendResponse({ success: await this.check(tabId, request.selector, false) });
break;
case 'browser.focus':
sendResponse({ success: await this.focus(tabId, request.selector) });
break;
case 'browser.blur':
sendResponse({ success: await this.blur(tabId, request.selector) });
break;
case 'browser.drag':
sendResponse({ success: await this.drag(tabId, request.from || request.selector, request.to) });
break;
case 'browser.scrollIntoView':
sendResponse({ success: await this.scrollIntoView(tabId, request.selector) });
break;
case 'browser.pressKey':
sendResponse({ success: await this.pressKey(tabId, request.key, request.modifiers) });
break;
+15 -1
View File
@@ -452,6 +452,15 @@ export class CDPBridge {
break;
// High-level hanzo.* commands — forward to BrowserControl via executeScript
// Forward hanzo.* commands to BrowserControl via chrome.runtime
// (hanzo.click, hanzo.fill, hanzo.screenshot handled above with overlay)
case 'hanzo.dblclick':
case 'hanzo.hover':
case 'hanzo.type':
case 'hanzo.clear':
case 'hanzo.select':
case 'hanzo.check':
case 'hanzo.uncheck':
case 'hanzo.getHTML':
case 'hanzo.setHTML':
case 'hanzo.getText':
@@ -475,7 +484,12 @@ export class CDPBridge {
case 'hanzo.getHistory':
case 'hanzo.fetch': {
// Map hanzo.X → browser.X and forward via chrome.runtime message
const action = 'browser.' + method.replace('hanzo.', '');
const cmd = method.replace('hanzo.', '');
// Normalize naming: hanzo.select → browser.select, hanzo.dblclick → browser.dblclick, etc.
const actionMap: Record<string, string> = {
'url': 'getURL', 'title': 'getTitle', 'tabInfo': 'getTabInfo',
};
const action = 'browser.' + (actionMap[cmd] || cmd);
result = await new Promise((resolve) => {
chrome.runtime.sendMessage({ action, tabId, ...params }, (response) => {
resolve(response || { error: chrome.runtime.lastError?.message });