Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Document interface preview and improve visual diagnostics

Rach Pradhan7e14b12262ca
diff --git a/apps/native/electron/browser-address-visual.cjs b/apps/native/electron/browser-address-visual.cjs
index 17903165..a2fc31cf 100644
--- a/apps/native/electron/browser-address-visual.cjs
+++ b/apps/native/electron/browser-address-visual.cjs
@@ -1,12 +1,13 @@
const assert = require('node:assert/strict');
-async function runBrowserAddress({ wc, browser, destination, guard, wait, delayOpenReply, openReplySent, delayAbortedReply, abortedReplySent, delayUnreplacedAbort, unreplacedAbortSent }) {
+async function runBrowserAddress({ wc, browser, destination, guard, wait, browserOpens, errors, delayOpenReply, openReplySent, delayAbortedReply, abortedReplySent, delayUnreplacedAbort, unreplacedAbortSent }) {
const js = code => wc.executeJavaScript(code);
- const searches = [];
+ const searches = [], attempted = [];
const safe = guard(destination);
// Redirect only the expected search URL to local HTML before any network I/O.
const query = 'how to center a div 世界';
const expected = `https://www.google.com/search?q=${encodeURIComponent(query)}`;
browser.session.webRequest.onBeforeRequest((details, callback) => {
+ if (attempted.length < 12) attempted.push(details.url);
if (details.url === expected) { searches.push(details.url); callback({ redirectURL: destination }); }
else safe(details, callback);
});
@@ -21,7 +22,13 @@ async function runBrowserAddress({ wc, browser, destination, guard, wait, delayO
};
delayOpenReply();
await submit(query);
- await wait(() => searches.length === 1, 'ordinary words reach the search URL');
+ try {
+ await wait(() => searches.length === 1, 'ordinary words reach the search URL');
+ } catch (error) {
+ const address = await js(`document.querySelector('input[aria-label="Address"]')?.value`);
+ const visible = browser.tabs.get(browser.visible)?.view?.webContents?.getURL();
+ throw new Error(`${error.message}; address=${JSON.stringify(address)}; browser opens=${JSON.stringify(browserOpens)}; attempted requests=${JSON.stringify(attempted)}; IPC errors=${JSON.stringify(errors)}; visible page=${JSON.stringify(visible)}`, { cause: error });
+ }
await wait(() => {
const page = browser.tabs.get(browser.visible)?.view?.webContents;
return page && !page.isLoading() && page.getURL() === destination + '/';
diff --git a/apps/native/electron/link-destination-visual.cjs b/apps/native/electron/link-destination-visual.cjs
index d9b6bf72..f84b9d09 100644
--- a/apps/native/electron/link-destination-visual.cjs
+++ b/apps/native/electron/link-destination-visual.cjs
@@ -30,7 +30,7 @@ async function runLinkDestinationVisuals({ origin, output }) {
};
wc.on('console-message', event => { if (event.level >= 2) console.error('Link renderer:', event.message); });
const browser = new BrowserTabs(win, event => wc.send('browser-event', event));
- const system = [], routed = [], settings = [], blocked = [], errors = [];
+ const system = [], routed = [], settings = [], blocked = [], errors = [], browserOpens = [];
let delayNextOpen = null, delayedReplySent = false, abortedReplySent = false, unreplacedAbortSent = false;
// Neither session may reach the network or an engine endpoint. Only the app's
// static assets and our loopback HTML fixture are allowed through.
@@ -47,7 +47,11 @@ async function runLinkDestinationVisuals({ origin, output }) {
const result = await (action === 'save' ? store.save(value) : store.load());
settings.push({ action, value, result }); return result;
});
+ // The real desktop registers this IPC before opening settings. Keep the
+ // isolated fixture's settings surface equivalent without changing the app.
+ ipcMain.handle('notch-settings', () => null);
ipcMain.handle('browser', async (_event, { chat, method, params }) => {
+ if (method === 'open') browserOpens.push(params?.url);
const delayed = method === 'open' ? delayNextOpen : null;
if (delayed) delayNextOpen = null;
try {
@@ -227,7 +231,7 @@ async function runLinkDestinationVisuals({ origin, output }) {
assert.equal(routed.length, before, 'same-origin links bypass external routing');
assert.ok(await js(`!!document.querySelector('textarea[aria-label="Prompt"]')`));
assert.deepEqual(errors, [], 'browser IPC completes without errors');
- await require('./browser-address-visual.cjs').runBrowserAddress({ wc, browser, destination, guard, wait,
+ await require('./browser-address-visual.cjs').runBrowserAddress({ wc, browser, destination, guard, wait, browserOpens, errors,
delayOpenReply: () => { delayNextOpen = 'success'; }, openReplySent: () => delayedReplySent,
delayAbortedReply: () => { delayNextOpen = 'abort'; }, abortedReplySent: () => abortedReplySent,
delayUnreplacedAbort: () => { delayNextOpen = 'unreplaced-abort'; }, unreplacedAbortSent: () => unreplacedAbortSent });
@@ -235,7 +239,7 @@ async function runLinkDestinationVisuals({ origin, output }) {
assert.deepEqual(blocked, [], 'no external network or engine/model requests attempted');
console.log('Link destination visuals passed: real UserBubble click, default/save/switch, reload and fresh-store persistence, normal/blank links, closed-browser reveal, overlays, unsafe/same-origin links, split focus and preserved app.');
} finally {
- ipcMain.removeHandler('link-settings'); ipcMain.removeHandler('browser'); ipcMain.removeListener('browser-overlay', overlay);
+ ipcMain.removeHandler('link-settings'); ipcMain.removeHandler('notch-settings'); ipcMain.removeHandler('browser'); ipcMain.removeListener('browser-overlay', overlay);
browser.closeAll(); win.destroy(); browser.session.webRequest.onBeforeRequest(null);
await new Promise(resolve => fixture.close(resolve));
fs.rmSync(directory, { recursive: true, force: true });
diff --git a/docs/releases/assets/v0.0.302.4/ui-preview-appearance.jpg b/docs/releases/assets/v0.0.302.4/ui-preview-appearance.jpg
new file mode 100644
index 00000000..20b35e00
Binary files /dev/null and b/docs/releases/assets/v0.0.302.4/ui-preview-appearance.jpg differ
diff --git a/docs/releases/assets/v0.0.302.4/ui-preview.jpg b/docs/releases/assets/v0.0.302.4/ui-preview.jpg
new file mode 100644
index 00000000..b4cea85b
Binary files /dev/null and b/docs/releases/assets/v0.0.302.4/ui-preview.jpg differ
diff --git a/docs/releases/v0.0.302.4.md b/docs/releases/v0.0.302.4.md
index 12b6d416..513863e3 100644
--- a/docs/releases/v0.0.302.4.md
+++ b/docs/releases/v0.0.302.4.md
@@ -97,11 +97,17 @@ of the distribution path.
## Replacement interface preview
-The image below previews a proposed replacement interface. **It is not the
-desktop interface shipped in v0.0.302.4.** This release still ships the
+The following captures preview a proposed replacement interface. **Neither
+interface view is shipped in v0.0.302.4.** This release still ships the
Codegraff desktop interface described above.
-![Preview of a proposed replacement interface; not shipped in v0.0.302.4](https://raw.githubusercontent.com/justrach/codegraff/v0.0.302.4/docs/releases/assets/v0.0.302.4/ui-preview.png)
+Proposed project and session view — **preview only, not shipped**:
+
+![Preview of the proposed project and session view; not shipped in v0.0.302.4](https://raw.githubusercontent.com/justrach/codegraff/v0.0.302.4/docs/releases/assets/v0.0.302.4/ui-preview.jpg)
+
+Proposed appearance settings — **preview only, not shipped**:
+
+![Preview of proposed appearance settings; not shipped in v0.0.302.4](https://raw.githubusercontent.com/justrach/codegraff/v0.0.302.4/docs/releases/assets/v0.0.302.4/ui-preview-appearance.jpg)
## Install and verification