Skip to content

armgit / axuse

Public Imported from GitHub
0

Accessibility-first browser & computer use for AI agents — one MCP server for every harness (Codex, Claude Code, OpenCode, Antigravity). Instruments the DOM/accessibility tree via CDP instead of screenshot loops: diffed snapshots, stable element refs, trusted input, typed errors. Zero dependencies

Round 9 — human forms, Xvfb death/regeneration, honest proxy-fallback limit

CTOL Team BJ9c7c005b0ad9
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 259a45f..1190e02 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -182,3 +182,5 @@ jobs:
run: env -u DISPLAY node src/cli.js doctor
- name: Posture audit (the full lane, machine-checked; exit 1 on failures)
run: env -u DISPLAY node src/cli.js posture --json
+ - name: Posture egress verification (the exit IP's geo vs the persona; INFO-safe on network gaps)
+ run: env -u DISPLAY node src/cli.js posture --verify-egress | tail -4
diff --git a/docs/server-mode.md b/docs/server-mode.md
index a952b75..a7b5a74 100644
--- a/docs/server-mode.md
+++ b/docs/server-mode.md
@@ -172,6 +172,10 @@ plugins where it matters:
per char, 45–160 ms gaps, 6% thinking pauses, word-boundary slowdowns)
with real layout key codes — for login/challenge fields where keystroke
dynamics are sampled. Solver context: `ctx.type({..., human: true})`.
+- **`ax_fill {human: true}`** — the human lane for WHOLE FORMS (the login
+ flow itself): every field gets a human focus click + per-key typing;
+ checkboxes/selects/sliders keep their trusted-input paths. Live-tested
+ across a two-field credential form.
- **Sliders/interstitials** already move humanly (the challenge-handler's
bezier trajectory engine with ≥8 velocity maxima and sub-8 ms jitter).
- **Ambient park-fuzz** (server mode default, `AXUSE_AMBIENT_MOTION=0`
@@ -346,6 +350,13 @@ the smoke test), and asserted by `test/server-mode.test.js`.
integration point: bring your own egress).
- **No fabricated results.** Solvers report `solved: false` honestly when
a page hard-blocks; `doctor` and tests state measured numbers.
+- **A dead exit falls back to direct.** If the proxy dies mid-session,
+ Chrome silently retries traffic DIRECT — the persona leaks at the IP
+ layer until the next launch (the WebRTC fix holds; HTTP does not). No
+ Chrome flag disables proxy fallback. Fleet practice: health-check exits
+ on a schedule (`axuse posture --verify-egress` reports the live exit IP)
+ and restart the lane when an exit dies — the persona is re-established
+ on the next browser launch.
- **Measured, not assumed, on the CDP surface**: the classic console-getter
DevTools detector (logging a getter-carrying object) does **not** fire
against raw CDP — `Runtime.consoleAPICalled` serialization never invokes
diff --git a/src/core/commands.js b/src/core/commands.js
index 321cc57..a2553c6 100644
--- a/src/core/commands.js
+++ b/src/core/commands.js
@@ -122,6 +122,7 @@ export const Contract = Object.freeze({
params: {
fields: { t: "fields", req: true, desc: '[{"ref":"e3","value":"Ada"},{"ref":"e6","value":true}]' },
submit: { t: "string", desc: "Ref to click after filling." },
+ human: { t: "boolean", desc: "Human input lane for text fields: human focus clicks + per-key trusted typing with human cadence — for login/credential forms on pages where keystroke dynamics are sampled; default is fast bulk insert." },
state_id: STATE, tab_id: TAB, settle_ms: { t: "number", desc: "Default 200." },
},
observed: "diff",
diff --git a/src/core/controller.js b/src/core/controller.js
index a82f2f7..7790e80 100644
--- a/src/core/controller.js
+++ b/src/core/controller.js
@@ -1168,7 +1168,7 @@ export class Controller {
};
const clickRef = async (r) => {
const pos = await this.resolveTarget(tab, { ref: r });
- await this.doSent(tab, () => doClick(this.ctx(tab, pos.session), { x: pos.x, y: pos.y, button: "left", count: 1, modifiers: 0 }));
+ await this.doSent(tab, () => doClick(this.ctx(tab, pos.session), { x: pos.x, y: pos.y, button: "left", count: 1, modifiers: 0, human: !!a.human }));
};
for (const [i, f] of a.fields.entries()) {
if (tab.dialog) fail(i, f, `was not filled: a ${tab.dialog.type} dialog opened`);
@@ -1203,7 +1203,14 @@ export class Controller {
await clickRef(f.ref);
const ctx = this.ctx(tab, session);
await this.doSent(tab, () => pressCombo(ctx, selectAllCombo()));
- await this.doSent(tab, () => insertText(ctx, String(f.value)));
+ // human: per-key trusted events with human cadence — the lane for
+ // login/credential forms on protected pages (keystroke-dynamics
+ // sampling); the default stays the fast bulk insert.
+ if (a.human) {
+ await this.doSent(tab, () => humanType(ctx, String(f.value)));
+ } else {
+ await this.doSent(tab, () => insertText(ctx, String(f.value)));
+ }
if (info.kind === "combo") {
// Autocomplete: wait for suggestions, pick the exact match.
let opt = null;
diff --git a/test/input-realism.test.js b/test/input-realism.test.js
index 6f142f0..b35b141 100644
--- a/test/input-realism.test.js
+++ b/test/input-realism.test.js
@@ -125,6 +125,44 @@ test("human input: typing and clicking land as human-shaped trusted events", { s
assert.ok(m[pressIdx + 1].n === "mouseup", "press → release");
});
+test("human fill: ax_fill {human:true} focuses and types humanly into every field", { skip: !hasBrowser ? "live-gate-browser: needs any Chromium-family browser" : false }, async (t) => {
+ const c = new Controller();
+ t.after(() => c.dispose());
+ const html = `data:text/html,<form>
+ <input id="u" aria-label="user"><input id="p" type="password" aria-label="pass">
+ <script>
+ window.__k = [];
+ for (const id of ["u", "p"]) {
+ const el = document.getElementById(id);
+ ["keydown", "input"].forEach((n) => el.addEventListener(n, (e) =>
+ window.__k.push({ id, n, key: e.key, code: e.code || null, ctrl: e.ctrlKey, trusted: e.isTrusted })));
+ }
+ </script></form>`;
+ const opened = await c.execute("open", { url: html, headless: true, settle_ms: 150 });
+ const refs = {};
+ for (const m of opened.observation.text.matchAll(/textbox "(\w+)"[^\[]*\[ref=(e\d+)\]/g)) refs[m[1]] = m[2];
+ assert.ok(refs.user && refs.pass, `both fields have refs: ${JSON.stringify(refs)}`);
+ const t0 = Date.now();
+ const filled = await c.execute("fill", {
+ fields: [{ ref: refs.user, value: "ada" }, { ref: refs.pass, value: "s3cret" }],
+ human: true,
+ settle_ms: 120,
+ });
+ assert.equal(filled.action_sent, "sent");
+ const keys = JSON.parse((await c.execute("evaluate", { expression: "window.__k" })).value ?? "[]");
+ // per-char pairs in EACH field (the select-all Ctrl+A pairs are excluded
+ // by the ctrl flag — they are the command's, not the typing's).
+ const downs = keys.filter((k) => k.n === "keydown" && !k.ctrl && k.key.length === 1);
+ // per-char pairs in EACH field (select-all combos add Ctrl/A pairs, excluded here)
+ assert.equal(downs.filter((k) => k.id === "u").length, 3, "3 keydowns in the user field");
+ assert.equal(downs.filter((k) => k.id === "p").length, 6, "6 keydowns in the pass field");
+ assert.ok(keys.every((k) => k.trusted), "every event trusted");
+ assert.deepEqual(keys.filter((k) => k.id === "u" && k.n === "input").length, [3][0]);
+ assert.ok(Date.now() - t0 >= (3 + 6) * 45, `human pace across both fields (${Date.now() - t0}ms)`);
+ const vals = JSON.parse((await c.execute("evaluate", { expression: "({u: document.getElementById('u').value, p: document.getElementById('p').value})" })).value ?? "{}");
+ assert.deepEqual(vals, { u: "ada", p: "s3cret" });
+});
+
test("proxy: browser egress routes through a credentialed local proxy (407 → CDP auth)", { skip: !hasBrowser ? "live-gate-browser: needs any Chromium-family browser" : false }, async (t) => {
// Plain origin server (the "site").
const site = http.createServer((req, res) => {
diff --git a/test/mcp.test.js b/test/mcp.test.js
index 32209cd..5f049b9 100644
--- a/test/mcp.test.js
+++ b/test/mcp.test.js
@@ -158,11 +158,18 @@ test("mcp: handshake, tools/list, tools/call end-to-end", { skip: !hasBrowser },
assert.match(openText, /button "go"/);
const ref = openText.match(/button "go"[^\[]*\[ref=(e\d+)\]/)[1];
- const clicked = await srv.call({
- jsonrpc: "2.0", id: 4, method: "tools/call",
- params: { name: "ax_click", arguments: { target: { ref }, settle_ms: 150 } },
- });
- const clickText = clicked.result.content[0].text;
+ // Under parallel-suite load, a data: URL page can wire its onclick AFTER
+ // the first click (the product's own no-change note says one retry is
+ // reasonable) — click up to twice and accept the first observable change.
+ let clickText = "";
+ for (let attempt = 0; attempt < 2; attempt++) {
+ const clicked = await srv.call({
+ jsonrpc: "2.0", id: 4, method: "tools/call",
+ params: { name: "ax_click", arguments: { target: { ref }, settle_ms: attempt ? 300 : 150 } },
+ });
+ clickText = clicked.result.content[0].text;
+ if (/text "done"|changed/.test(clickText)) break;
+ }
assert.doesNotMatch(clickText, /^action: /); // "sent" is the silent default
assert.match(clickText, /text "done"|changed/);
diff --git a/test/server-mode.test.js b/test/server-mode.test.js
index 0e711a3..14d7e9a 100644
--- a/test/server-mode.test.js
+++ b/test/server-mode.test.js
@@ -374,6 +374,30 @@ test("server mode: ambient pointer park-fuzz moves the pointer while the agent i
assert.equal(n1, n0, "AXUSE_AMBIENT_MOTION=0 parks the pointer");
});
+test("server mode: Xvfb death mid-session → typed failure, then full regeneration on the next open", { skip: liveSkip }, async (t) => {
+ const restore = withDeadDisplay();
+ t.after(restore);
+ const c = new Controller();
+ t.after(() => c.dispose());
+ const first = await c.execute("open", { url: "about:blank", settle_ms: 150 });
+ assert.equal(first.display?.virtual, true);
+ const firstDisplay = first.display.id;
+ // The X server dies (OOM, operator cleanup — whatever kills it).
+ __resetVirtualDisplay();
+ // The live browser on the dead display fails typed (broken windows);
+ // the process keeps the stale DISPLAY value — displayUsable must catch
+ // the gone socket and server mode must regenerate on the next open.
+ await assert.rejects(
+ () => c.execute("evaluate", { expression: "1 + 1" }),
+ (e) => typeof e.code === "string",
+ );
+ const second = await c.execute("open", { url: "data:text/html,<h1>regenerated</h1>", settle_ms: 200 });
+ assert.equal(second.display?.virtual, true, "a fresh virtual display booted after the death");
+ assert.ok(second.observation.text.includes("regenerated"));
+ const vd = virtualDisplayStatus();
+ assert.ok(vd.active && firstDisplay, "the singleton is live again");
+});
+
test("server mode: AXUSE_HEADLESS=1 lane still opens headless on a dead display", { skip: liveSkip }, async (t) => {
const restore = withDeadDisplay();
t.after(restore);