graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Align /help login usage with the zai catalog
Cursor Agent8f0c601b99bb
diff --git a/apps/native/electron/smoke-server-lifecycle.cjs b/apps/native/electron/smoke-server-lifecycle.cjsindex 0ec4b3de..80726a3d 100644--- a/apps/native/electron/smoke-server-lifecycle.cjs+++ b/apps/native/electron/smoke-server-lifecycle.cjs@@ -29,13 +29,31 @@ exports.run = async ({win, backend}) => {};await until(() => js(`!!document.querySelector('[data-workspace-ready="true"] textarea[aria-label="Prompt"]')`), 'composer');phase('composer ready');- async function submit(text) {- const box = await js(`(() => { const e=document.querySelector('textarea[aria-label="Prompt"]');e.scrollIntoView({block:'center'});const r=e.getBoundingClientRect();return {x:r.x+r.width/2,y:r.y+r.height/2}; })()`);+ // Same click + wait-for-value + Send path as frontend-runtime.cjs. Return+ // after a missed click left the composer empty and every worker idle at+ // recipe (native CI, pinned shutdown pass).+ async function click(selector) {+ const box = await js(`(() => { const e=document.querySelector(${JSON.stringify(selector)});e.scrollIntoView({block:'center'});const r=e.getBoundingClientRect();return {x:r.x+r.width/2,y:r.y+r.height/2}; })()`);await desktop.testInput(win.webContents, {type:'mouseDown',button:'left',clickCount:1,...box});await desktop.testInput(win.webContents, {type:'mouseUp',button:'left',clickCount:1,...box});- for (const keyCode of text) await desktop.testInput(win.webContents, {type:'char',keyCode});- await desktop.testInput(win.webContents, {type:'keyDown',keyCode:'Return'});- await desktop.testInput(win.webContents, {type:'keyUp',keyCode:'Return'});+ }+ async function submit(text) {+ const ready = () => js(`document.querySelector('textarea[aria-label="Prompt"]').value === ${JSON.stringify(text)} && !document.querySelector('[aria-label="Send"]').disabled`);+ for (let attempt = 0; attempt < 2 && !(await ready()); attempt++) {+ await click('textarea[aria-label="Prompt"]');+ await until(() => js(`document.activeElement === document.querySelector('textarea[aria-label="Prompt"]')`), 'composer focus');+ for (const keyCode of text) await desktop.testInput(win.webContents, {type:'char',keyCode});+ const end = Date.now() + 8000;+ while (Date.now() < end && !(await ready())) await sleep(50);+ if (!(await ready()) && attempt === 0) phase('typed prompt missed; retrying');+ }+ if (!(await ready())) {+ await timeouts.dumpTimeout({ label: 'typed prompt ready', waitedMs: 8000, outer, output, workspace, js,+ capturePage: () => win.webContents.capturePage().then(page => page.toPNG()),+ backendOrigin: backend.origin, writePhase: phase });+ throw Error('Shutdown fixture failed to land the composer text');+ }+ await click('[aria-label="Send"]');}await submit('Start the isolated listener, check its socket, and report readiness.');phase('prompt submitted');diff --git a/apps/native/electron/smoke-timeout.cjs b/apps/native/electron/smoke-timeout.cjsindex 7b4b3184..508723fb 100644--- a/apps/native/electron/smoke-timeout.cjs+++ b/apps/native/electron/smoke-timeout.cjs@@ -22,6 +22,8 @@ function outerMs(env = process.env) {function phaseBudget(label, outer = outerMs(), elapsedMs = 0) {switch (label) {case 'composer': return 90000;+ case 'composer focus': return 15000;+ case 'typed prompt ready': return 15000;case 'agent completion': return Math.max(30000, outer - 30000);case 'explicit user pin': return 60000;case 'production backend and worker shutdown':diff --git a/apps/native/electron/smoke-timeout.test.cjs b/apps/native/electron/smoke-timeout.test.cjsindex 17eeb84f..6713d3bc 100644--- a/apps/native/electron/smoke-timeout.test.cjs+++ b/apps/native/electron/smoke-timeout.test.cjs@@ -12,6 +12,8 @@ test('outer budget mirrors the spawner validation, defaulting hand runs', () =>test('waits end before the watchdog instead of racing it', () => {assert.equal(phaseBudget('composer', 180000, 0), 90000);+ assert.equal(phaseBudget('composer focus', 180000, 0), 15000);+ assert.equal(phaseBudget('typed prompt ready', 180000, 0), 15000);assert.equal(phaseBudget('agent completion', 180000, 0), 150000);assert.equal(phaseBudget('agent completion', 60000, 0), 30000);assert.equal(phaseBudget('explicit user pin', 180000, 0), 60000);diff --git a/scripts/test-pty-repl.py b/scripts/test-pty-repl.pyindex a00baacf..a406f150 100755--- a/scripts/test-pty-repl.py+++ b/scripts/test-pty-repl.py@@ -76,7 +76,7 @@ def main() -> None:session.send_line("/help")session.wait_for_literal("/models [health]", start=cursor)session.wait_for_literal("/fallback [allow|remove|off]", start=cursor)- session.wait_for_literal("/login [codegraff|codex|kimi]", start=cursor)+ session.wait_for_literal("/login [codegraff|codex|kimi|xai|zai]", start=cursor)session.wait_for_literal(base, start=cursor)session.wait_for_prompt(start=cursor)cursor = len(session.raw)diff --git a/src/help.zig b/src/help.zigindex 9e9ac46a..01e10399 100644--- a/src/help.zig+++ b/src/help.zig@@ -87,4 +87,6 @@ test "render prints every section title, the peers blurb, and the exit footer" {for (sections) |sec| try std.testing.expect(std.mem.indexOf(u8, text, sec.title) != null);try std.testing.expect(std.mem.indexOf(u8, text, "how hearing works") != null);try std.testing.expect(std.mem.indexOf(u8, text, "exit | /exit | /quit") != null);+ const login = find("/login") orelse return error.MissingLogin;+ try std.testing.expect(std.mem.indexOf(u8, text, login.usage) != null);}