graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Submit the browser address from the field, not stale React state
Rach6222502faf74
diff --git a/apps/native/components/site/ElectronBrowserPane.tsx b/apps/native/components/site/ElectronBrowserPane.tsxindex 206d9b18..1f52802b 100644--- a/apps/native/components/site/ElectronBrowserPane.tsx+++ b/apps/native/components/site/ElectronBrowserPane.tsx@@ -91,12 +91,16 @@ export default function ElectronBrowserPane({ chat, pins, onPinsChange, onAsk, o<button className={button} aria-label="Activity" onClick={() => void desktop()!.activity()}>Activity</button><button className={button} aria-label="Close browser" onClick={() => { void desktop()!.browser(chat, "close"); onClose(); }}>×</button></header>- <form className="flex h-10 items-center gap-1 border-b border-line px-2" onSubmit={e => { e.preventDefault(); void command("open", { url }); }}>+ <form className="flex h-10 items-center gap-1 border-b border-line px-2" onSubmit={e => {+ e.preventDefault();+ const typed = (address.current?.value ?? url).trim();+ void command("open", { url: typed });+ }}><button type="button" className={button} aria-label="Back" disabled={!info?.canGoBack} onClick={() => void command("back")}>←</button><button type="button" className={button} aria-label="Forward" disabled={!info?.canGoForward} onClick={() => void command("forward")}>→</button>- <button type="button" className={button} aria-label="Reload" onClick={() => void command("open", { url })}>↻</button>+ <button type="button" className={button} aria-label="Reload" onClick={() => void command("open", { url: address.current?.value || url })}>↻</button><input ref={address} className="h-7 min-w-0 flex-1 rounded-md bg-field px-2 text-xs outline-none" aria-label="Address" placeholder="Search or enter a URL" value={url} onChange={e => setUrl(e.target.value)} onFocus={e => e.currentTarget.select()} />- <button className={button}>Go</button>+ <button type="submit" className={button} aria-label="Go">Go</button></form>{picking && <p role="status" className="border-b border-line bg-accent-tint px-3 py-2 text-xs text-accent-ink">Click the page to pin. Esc cancels.</p>}{error && <p role="alert" className="px-3 py-2 text-xs text-red">{error}</p>}diff --git a/apps/native/electron/browser-focus-frontend.cjs b/apps/native/electron/browser-focus-frontend.cjsindex 64d584ac..79f10fd8 100644--- a/apps/native/electron/browser-focus-frontend.cjs+++ b/apps/native/electron/browser-focus-frontend.cjs@@ -21,15 +21,19 @@ async function runBrowserFocus({ win, output, click, until, report }) {ipcMain.removeHandler('browser');ipcMain.handle('browser', (_event, { chat, method, params }) => method === 'handle' ? bridge.handle(chat) : browser.command(chat, method, params));try {+ const loaded = want => {+ const got = [...browser.tabs.values()].map(tab => tab.view?.webContents.getURL() || tab.url);+ return got.some(href => href === want || href === `${want}/` || href.replace(/\/$/, '') === want.replace(/\/$/, ''));+ };const navigateUser = async url => {await click('[aria-label="Address"]');- await until(() => js(`document.activeElement?.getAttribute('aria-label')==='Address'`), 'address field focused');- // Controlled React value ignores CDP char events; same path as browser-address-visual.- await js(`(()=>{const e=document.querySelector('[aria-label="Address"]');e.focus();Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set.call(e,${JSON.stringify(url)});e.dispatchEvent(new Event('input',{bubbles:true}));})()`);+ await until(() => js(`!!document.querySelector('[aria-label="Address"]')`), 'address field present');+ await js(`(()=>{const e=document.querySelector('[aria-label="Address"]');e.focus();Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,'value').set.call(e,${JSON.stringify(url)});e.dispatchEvent(new Event('input',{bubbles:true}));e.dispatchEvent(new Event('change',{bubbles:true}));})()`);await until(() => js(`document.querySelector('[aria-label="Address"]').value===${JSON.stringify(url)}`), 'address value');await js('new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(()=>resolve(true))))');- await js(`document.querySelector('[aria-label="Address"]').form.requestSubmit()`);- await until(() => browser.visible && browser.tabs.get(browser.visible)?.view?.webContents.getURL() === url, 'explicit address navigation');+ if (await js(`!!document.querySelector('[aria-label="Go"]')`)) await click('[aria-label="Go"]');+ else await js(`document.querySelector('[aria-label="Address"]').form.requestSubmit()`);+ await until(() => loaded(url), 'explicit address navigation');};const openBrowser = async () => {await click('[aria-label="Workspace tools"]');