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

Server mode round 4 — tamper-invisibility, Intl coherence, posture facts

CTOL Team BJfcef61e8bb1a
diff --git a/docs/server-mode.md b/docs/server-mode.md
index 5e55663..e4d85fb 100644
--- a/docs/server-mode.md
+++ b/docs/server-mode.md
@@ -177,6 +177,13 @@ spec = one browser instance (different specs never share a launch).
Combine with `AXUSE_TIMEZONE`/`AXUSE_LANG` so the whole persona — IP,
clock, languages — is coherent per instance.
+Every `ax_solve_captcha` / `axuse solve` result carries **posture facts**
+(`headed-on-virtual-display` / `headed` / `headless`, plus the virtual
+display and the credentials-stripped egress endpoint) — and a loud warning
+when the browser was headless, since challenge pages detect that shape
+first. Agents and operators see exactly which browser shape fought the
+challenge.
+
Note: a plugin that re-enables CDP `Fetch` with its own interception
patterns takes over interception for that session and may drop the proxy
auth subscription for those requests (documented integration seam).
@@ -202,18 +209,40 @@ a "consumer" session, a fleet where every account shows the exact same
```bash
AXUSE_TIMEZONE=America/New_York # Date/Intl in pages AND workers (TZ)
AXUSE_LANG=en-GB # navigator.language(s) + Accept-Language
+ # + Intl default locale (LC_ALL — see below)
AXUSE_DISPLAY_SIZE=random # stable geometry per machine, fleet spread
AXUSE_FP_CORES=8 # optional persona cap for big servers
AXUSE_FP_MEMORY=8 # optional; only where the API exists
```
+`AXUSE_LANG` mechanics (measured live, Chrome 151): `--accept-lang` drives
+`navigator.language`/`languages` and the `Accept-Language` header — but the
+**Intl default locale follows the process locale env, not any Chrome flag**
+(`--lang` alone changes neither). axuse therefore derives `LC_ALL`/`LANG`
+(`en-GB` → `en_GB.UTF-8`) for the browser process so Intl, navigator and
+headers all agree. The locale must be **generated on the host** or Intl
+silently falls back: `sudo locale-gen en_GB.UTF-8 && sudo update-locale` —
+`doctor` checks `locale -a` and tells you exactly this.
+
`--disable-blink-features=AutomationControlled` is passed on every launch
(verified live on Chrome 151): with remote debugging active, Chrome reports
`navigator.webdriver === true` in **every context** — main frames and
cross-origin iframes — a fingerprint the *harness itself* creates, present
-on no human-driven Chrome. The flag turns it off **at the source**; a
-pre-document script is the fallback for builds that ignore the flag
-(`AXUSE_NEUTRALIZE_WEBDRIVER=0` opts out of the fallback).
+on no human-driven Chrome. The flag turns it off **at the source**.
+
+**Tamper-visibility discipline** (the subtle part): replacing Chrome's
+native getter — even with one returning the same value — changes the
+prototype descriptor into JS source a page can read (the classic
+`getter.toString().includes("[native code]")` check; we measured ourselves
+guilty of this before fixing it). So the pre-document script patches
+`webdriver` **only when the flag did not already fix it** (`if
+(navigator.webdriver !== false)`), and its fallback/persona-cap getters are
+toString-masked to present native source at the descriptor level. On
+flag-working builds the script touches nothing at all. Honest limit: a
+`Function.prototype.toString.call(getter)` bypass can still see through a
+masked fallback getter — this is why the source-level flag, not the script,
+is the primary mechanism (`AXUSE_NEUTRALIZE_WEBDRIVER=0` removes the
+fallback entirely).
Everything is measured and printed by `doctor` (posture + persona lines in
the smoke test), and asserted by `test/server-mode.test.js`.
@@ -248,9 +277,12 @@ the smoke test), and asserted by `test/server-mode.test.js`.
flag (a pre-document script as fallback): modern Chrome sets it to `true`
merely because a DevTools client is attached — a fingerprint of *our own
plumbing*, present on no human-driven Chrome. axuse restores the exact
- value a human browser reports (`false`), in every frame. It does not
- fake, answer or shortcut any challenge — solvers still click real
- widgets with trusted input. Opt out: `AXUSE_NEUTRALIZE_WEBDRIVER=0`.
+ value a human browser reports (`false`), in every frame — and the script
+ touches nothing on builds where the flag already fixed it (tamper-
+ visibility is asserted by live tests: the prototype getter stays
+ **native**). It does not fake, answer or shortcut any challenge — solvers
+ still click real widgets with trusted input. Opt out:
+ `AXUSE_NEUTRALIZE_WEBDRIVER=0`.
- **No invented hardware.** The WebGL renderer string stays the honest
one (SwiftShader/ANGLE software — what every GPU-less Linux desktop
reports too); `hardwareConcurrency`/`deviceMemory` stay honest unless the
diff --git a/src/cli.js b/src/cli.js
index 3b42d1a..dac603b 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -10,7 +10,7 @@
* axuse help
*/
import { fileURLToPath } from "node:url";
-import { spawn } from "node:child_process";
+import { spawn, spawnSync } from "node:child_process";
import { writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { locateBrowser } from "./core/cdp.js";
@@ -257,6 +257,13 @@ async function solveCmd() {
if (numberArg("--deadline-ms")) opts.deadlineMs = numberArg("--deadline-ms");
const ctx = buildSolveContext(controller);
result = await solveWith(solvers, provider, ctx, opts);
+ // Posture facts ride along (see ax_solve_captcha): which browser shape
+ // fought the challenge, with the loud warning when it was headless.
+ const posture = controller.browserPosture();
+ result = { ...result, posture };
+ if (posture.posture === "headless") {
+ result.warning = "the browser is headless — challenge/anti-bot pages detect --headless first; rerun without --headless (on a display-less host, axuse server mode keeps Chrome headed)";
+ }
} finally {
await Promise.race([controller.dispose(), new Promise((ok) => setTimeout(ok, 5000))]);
}
@@ -352,7 +359,19 @@ async function doctor() {
out(`persona: timezone not overridden (Chrome uses this host's TZ, currently ${new Intl.DateTimeFormat().resolvedOptions().timeZone}) — set AXUSE_TIMEZONE to the egress persona's zone when routing through a proxy`);
}
if (process.env.AXUSE_LANG) {
- out(`AXUSE_LANG=${process.env.AXUSE_LANG}: drives --lang (navigator.language(s) + Accept-Language)`);
+ const langLine = `AXUSE_LANG=${process.env.AXUSE_LANG}: drives --accept-lang (navigator.language(s) + Accept-Language) and LC_ALL (Intl default locale — measured: Chrome flags alone leave Intl at the OS locale)`;
+ const m = /^([a-z]{2,3})[-_]([A-Za-z]{2})$/.exec(String(process.env.AXUSE_LANG).trim());
+ if (m) {
+ const tag = `${m[1]}_${m[2].toUpperCase()}`;
+ const locales = (() => {
+ try { return String(spawnSync("locale", ["-a"], { timeout: 4000 }).stdout ?? ""); } catch { return ""; }
+ })();
+ const generated = new RegExp(`${tag}\\.(utf8|UTF-8)`, "i").test(locales);
+ out(`${langLine}`);
+ out(`locale ${tag}.UTF-8: ${generated ? "generated — Intl resolves coherently" : `NOT generated — Intl silently falls back to the OS locale: sudo locale-gen ${tag}.UTF-8 && sudo update-locale, then restart the MCP server`}`);
+ } else {
+ out(`${langLine}`);
+ }
}
if (process.env.AXUSE_FP_CORES || process.env.AXUSE_FP_MEMORY) {
out(`persona overrides active: hardwareConcurrency=${process.env.AXUSE_FP_CORES ?? "(honest)"} · deviceMemory=${process.env.AXUSE_FP_MEMORY ?? "(honest)"} — a big server's honest cores are a persona mismatch for residential-looking traffic`);
diff --git a/src/core/cdp.js b/src/core/cdp.js
index 13451b8..9b45821 100644
--- a/src/core/cdp.js
+++ b/src/core/cdp.js
@@ -17,26 +17,36 @@ import { ensureVirtualDisplay, needsNoSandbox, serverModePlan, virtualDisplaySta
const SEND_TIMEOUT_MS = 30_000;
-/** The pre-document posture script: restores values a human-driven Chrome
- * reports but a CDP-driven one does not. `--disable-blink-features=
- * AutomationControlled` already fixes navigator.webdriver at the SOURCE
- * (all contexts — main frames, cross-origin iframes); this script is the
- * belt-and-suspenders fallback for builds where the flag is not honored.
- * Optional persona overrides (AXUSE_FP_CORES / AXUSE_FP_MEMORY): a
- * 96-core server's honest hardwareConcurrency is a persona mismatch for a
- * residential-looking session — the operator may cap it. Opt-in, honest
- * hardware stays the default. Exported for tests. */
+/** The pre-document posture script.
+ *
+ * Tamper-visibility discipline (measured live, Chrome 151): replacing
+ * Chrome's NATIVE getter — even with one returning the same value —
+ * changes `Object.getOwnPropertyDescriptor(...).get` into JS source the
+ * page can read (`"[native code]"` check). So:
+ * - webdriver is patched ONLY when the AutomationControlled launch flag
+ * did not already fix it (`navigator.webdriver !== false`); on
+ * flag-working builds the script touches nothing at all;
+ * - fallback and persona-cap getters are toString-masked to look native
+ * at the descriptor level (the level pages actually check;
+ * `Function.prototype.toString.call` bypassing remains theoretically
+ * detectable — stated honestly in docs/server-mode.md).
+ * Persona caps (AXUSE_FP_CORES / AXUSE_FP_MEMORY) are opt-in: a 96-core
+ * server's honest hardwareConcurrency is a persona mismatch for a
+ * residential-looking session — the operator may cap it. */
export function postureScript(env = process.env) {
+ const maskedGetter = (name, expr) => `(function () {
+ var g = function () { return ${expr}; };
+ try { Object.defineProperty(g, "toString", { value: function toString() { return "function get ${name}() { [native code] }"; } }); } catch (e) {}
+ try { Object.defineProperty(navigator, "${name}", { get: g, configurable: true }); } catch (e) {}
+ try { Object.defineProperty(Navigator.prototype, "${name}", { get: g, configurable: true }); } catch (e) {}
+ })()`;
const parts = [
- "try { delete navigator.webdriver; } catch {}",
- "Object.defineProperty(Navigator.prototype, 'webdriver', { get: () => false, configurable: true });",
+ // webdriver: patch ONLY on builds where the flag did not fix it.
+ `try { if (navigator.webdriver !== false) { ${maskedGetter("webdriver", "false")} } } catch (e) {}`,
];
const cores = Number(env.AXUSE_FP_CORES);
if (Number.isFinite(cores) && cores > 0 && Number.isInteger(cores)) {
- parts.push(
- `try { Object.defineProperty(navigator, 'hardwareConcurrency', { get: () => ${cores}, configurable: true }); } catch {}`,
- `try { Object.defineProperty(Navigator.prototype, 'hardwareConcurrency', { get: () => ${cores}, configurable: true }); } catch {}`,
- );
+ parts.push(`try { ${maskedGetter("hardwareConcurrency", String(cores))} } catch (e) {}`);
}
const mem = Number(env.AXUSE_FP_MEMORY);
if (Number.isFinite(mem) && mem > 0) {
@@ -46,9 +56,7 @@ export function postureScript(env = process.env) {
// honest: creating it on a platform that lacks it would be a stronger
// deviation than the value it replaces.
const bucket = [0.25, 0.5, 1, 2, 4, 8].reduce((a, b) => (mem >= b ? b : a), 0.25);
- parts.push(
- `if ('deviceMemory' in navigator) { try { Object.defineProperty(navigator, 'deviceMemory', { get: () => ${bucket}, configurable: true }); } catch {} }`,
- );
+ parts.push(`if ('deviceMemory' in navigator) { try { ${maskedGetter("deviceMemory", String(bucket))} } catch (e) {} }`);
}
return parts.join("\n");
}
@@ -380,6 +388,7 @@ export class BrowserHandle {
// up. The default accommodates that; AXUSE_LAUNCH_TIMEOUT_MS overrides.
const launchTimeoutMs = Number(process.env.AXUSE_LAUNCH_TIMEOUT_MS ?? 30_000);
const persistent = typeof userDataDir === "string" && userDataDir.trim().length > 0;
+ let localeTag = null; // "en_GB.UTF-8"-style tag derived from AXUSE_LANG
const profileRoot = profileRootOverride || process.env.AXUSE_PROFILE_DIR || tmpdir();
try { mkdirSync(profileRoot, { recursive: true }); } catch {}
sweepStaleProfiles(profileRoot);
@@ -430,8 +439,15 @@ export class BrowserHandle {
// Persona coherence: --accept-lang drives navigator.language AND
// navigator.languages AND the Accept-Language header (verified live:
// --lang alone does NOT — Chrome persists the OS-derived preference).
+ // The Intl default locale follows the PROCESS locale env instead (also
+ // measured: flags leave Intl at the OS locale) — derive LC_ALL/LANG so
+ // Intl, navigator.language and Accept-Language agree.
if (process.env.AXUSE_LANG && /^[\w,-]{2,32}$/.test(process.env.AXUSE_LANG)) {
args.push(`--accept-lang=${process.env.AXUSE_LANG}`);
+ const m = /^([a-z]{2,3})[-_]([A-Za-z]{2})$/.exec(process.env.AXUSE_LANG.trim());
+ if (m) {
+ localeTag = `${m[1]}_${m[2].toUpperCase()}.UTF-8`;
+ }
}
const vd = virtualDisplayStatus();
if (vd.active) {
@@ -455,9 +471,15 @@ export class BrowserHandle {
// Persona coherence (opt-in): TZ drives Date/Intl in the page AND in
// workers — set it on the child environment so it matches the egress
// persona (a UTC server behind a US residential exit is a classic
- // timezone-mismatch score).
+ // timezone-mismatch score). LC_ALL/LANG make the Intl default locale
+ // match AXUSE_LANG (needs the locale generated on the host — doctor
+ // checks `locale -a`).
const childEnv = { ...process.env };
if (process.env.AXUSE_TIMEZONE) childEnv.TZ = process.env.AXUSE_TIMEZONE;
+ if (localeTag) {
+ childEnv.LC_ALL = localeTag;
+ childEnv.LANG = localeTag;
+ }
const proc = spawn(exe, args, { stdio: ["ignore", "pipe", "pipe"], windowsHide: false, env: childEnv });
let wsUrl;
try {
diff --git a/src/core/controller.js b/src/core/controller.js
index 43a67d9..6d656c2 100644
--- a/src/core/controller.js
+++ b/src/core/controller.js
@@ -9,7 +9,7 @@
* cursors, snapshots for diffing) lives in this process.
*/
-import { BrowserHandle } from "./cdp.js";
+import { BrowserHandle, parseProxySpec } from "./cdp.js";
import { Contract, validate } from "./commands.js";
import { AxError, Codes } from "./errors.js";
import { serializeExpression } from "./serialize.js";
@@ -454,6 +454,28 @@ export class Controller {
}
}
+ /** The active browser's launch posture — the facts solver results carry
+ * so agents (and operators) can see headless vs headed vs the server-mode
+ * virtual display, and get warned when they are about to fight a
+ * challenge page from a detected browser shape. */
+ browserPosture() {
+ let rec = null;
+ if (this.activeTabId && this.tabs.has(this.activeTabId)) {
+ rec = this.browsers.get(this.tabs.get(this.activeTabId).browserId) ?? null;
+ }
+ if (!rec || !rec.handle) {
+ rec = [...this.browsers.values()].find((b) => b.handle && !b.handle.conn.closed) ?? null;
+ }
+ if (!rec) return { posture: "no-browser" };
+ const vd = virtualDisplayStatus();
+ const headless = String(rec.key).startsWith("launch:headless");
+ return {
+ posture: headless ? "headless" : (vd.active ? "headed-on-virtual-display" : "headed"),
+ ...(vd.active ? { display: vd.display } : {}),
+ ...(rec.egress ? { egress: rec.egress } : {}),
+ };
+ }
+
async ensureBrowser({ headless, cdpUrl, executablePath, backend, profileDir, proxy, proxyBypass }) {
// Extension backend: the user's real Chrome through the axuse bridge
// (Codex pattern: one browser, the user's own, tabs visible to them).
@@ -489,6 +511,12 @@ export class Controller {
: await BrowserHandle.launch({ headless, executablePath, userDataDir: profileDir, proxy, proxyBypass });
const browserId = `b${++this.browserSeq}`;
const rec = { browserId, handle, tabs: new Set(), key };
+ // Egress fact for solver results (parseProxySpec strips credentials —
+ // only the scheme://host:port ever surfaces).
+ // Egress fact for solver results (parseProxySpec strips credentials —
+ // only the scheme://host:port ever surfaces).
+ const egressSpec = parseProxySpec(proxy ?? process.env.AXUSE_PROXY ?? "");
+ if (egressSpec) rec.egress = egressSpec.server;
this.browsers.set(browserId, rec);
this.browserIndex.set(key, browserId);
await this.watchPopups(rec);
diff --git a/src/mcp/server.js b/src/mcp/server.js
index 43422ae..b8d72ae 100644
--- a/src/mcp/server.js
+++ b/src/mcp/server.js
@@ -140,7 +140,15 @@ export async function createServer({ controller = new Controller(), desktop, sol
}
const ctx = buildSolveContext(controller);
const result = await solveWith(registry, args.provider, ctx, opts);
- return { content: [{ type: "text", text: JSON.stringify(result) }] };
+ // Posture facts ride along on every solve: the agent can see (and the
+ // operator audit) which browser shape fought the challenge — and a
+ // headless shape gets the loud warning it deserves.
+ const posture = controller.browserPosture();
+ const payload = { ...result, posture };
+ if (posture.posture === "headless") {
+ payload.warning = "the browser is headless — challenge/anti-bot pages detect --headless first; close this browser (ax_close {browser:true}) and reopen WITHOUT headless (on a display-less host, axuse server mode keeps Chrome headed)";
+ }
+ return { content: [{ type: "text", text: JSON.stringify(payload) }] };
}
if (tool._group === "plugin") {
// A1 dispatch: the plugin tool's validated handle(args, ctx) — the
diff --git a/test/mcp.test.js b/test/mcp.test.js
index 5a67ecb..32209cd 100644
--- a/test/mcp.test.js
+++ b/test/mcp.test.js
@@ -77,6 +77,10 @@ test("mcp: handshake, tools/list, tools/call end-to-end", { skip: !hasBrowser },
const desktopExpected = process.platform === "win32"
|| (process.platform === "darwin" && process.env.AXUSE_ENABLE_MACOS_CUA === "1")
|| linuxDesktopOk;
+ // The AX-structure tools mount ONLY with a structure-first driver
+ // (macOS System Events; Linux AT-SPI). Windows (coordinate driver) must
+ // not advertise them.
+ const axExpected = (process.platform === "darwin" && process.env.AXUSE_ENABLE_MACOS_CUA === "1") || linuxAtspiOk;
// NOTE on stability: this process probes X liveness AND the spawned
// server probes it independently at startup. Under full-suite parallel
@@ -98,10 +102,16 @@ test("mcp: handshake, tools/list, tools/call end-to-end", { skip: !hasBrowser },
};
let { srv, names } = await boot();
t.after(async () => { await srv.end(); });
- if (!!names.includes("ax_desktop_screenshot") !== desktopExpected && process.platform === "linux" && process.env.DISPLAY) {
- await srv.end();
- ({ srv, names } = await boot());
- t.after(async () => { await srv.end(); });
+ // Disagreement on EITHER dimension (desktop mount, AX-layer mount) → one
+ // respawn, then the assertion below is final.
+ if (process.platform === "linux" && process.env.DISPLAY) {
+ const disagrees = (desktopExpected !== names.includes("ax_desktop_screenshot"))
+ || (!!axExpected !== names.includes("ax_desktop_ax_snapshot"));
+ if (disagrees) {
+ await srv.end();
+ ({ srv, names } = await boot());
+ t.after(async () => { await srv.end(); });
+ }
}
assert.ok(names.includes("ax_open"));
@@ -114,10 +124,6 @@ test("mcp: handshake, tools/list, tools/call end-to-end", { skip: !hasBrowser },
} else {
assert.ok(!names.includes("ax_desktop_screenshot"));
}
- // The AX-structure tools mount ONLY with a structure-first driver
- // (macOS System Events; Linux AT-SPI). Windows (coordinate driver) must
- // not advertise them.
- const axExpected = (process.platform === "darwin" && process.env.AXUSE_ENABLE_MACOS_CUA === "1") || linuxAtspiOk;
if (axExpected) {
for (const t of ["ax_desktop_ax_snapshot", "ax_desktop_ax_click", "ax_desktop_ax_set", "ax_desktop_ax_read"]) {
assert.ok(names.includes(t), `${t} mounted with the structure-first driver`);
diff --git a/test/server-mode.test.js b/test/server-mode.test.js
index f290b77..51e1875 100644
--- a/test/server-mode.test.js
+++ b/test/server-mode.test.js
@@ -134,17 +134,25 @@ test("server mode: IANA timezone validation (the same engine Chrome uses)", () =
assert.equal(validTimezone(null), null);
});
-test("server mode: posture script — webdriver fallback plus opt-in persona overrides", () => {
+test("server mode: posture script — conditional, tamper-invisible, opt-in persona overrides", () => {
const base = postureScript({});
- assert.match(base, /navigator\.webdriver/);
+ // The guard: on builds where the AutomationControlled flag already returns
+ // false, the script must touch NOTHING (replacing a native getter with JS
+ // source is itself detectable — measured live).
+ assert.match(base, /if \(navigator\.webdriver !== false\)/, "patches only when the flag did not fix it");
+ // The mask: fallback getters present native source at the descriptor level.
+ assert.match(base, /\[native code\]/);
assert.doesNotMatch(base, /hardwareConcurrency/, "honest cores stay the default");
assert.doesNotMatch(base, /deviceMemory/, "honest memory stays the default");
const cores = postureScript({ AXUSE_FP_CORES: "8" });
- assert.match(cores, /hardwareConcurrency[^]+=> 8/);
+ assert.match(cores, /return 8;/, "cores override present");
+ assert.match(cores, /get hardwareConcurrency\(\) \{ \[native code\] \}/, "cores override is masked");
assert.doesNotMatch(cores, /deviceMemory/);
- // deviceMemory lands in Chrome's 0.25/0.5/1/2/4/8 buckets (16 GB input → 8).
- const mem = postureScript({ AXUSE_FP_MEMORY: "3" });
- assert.match(mem, /'deviceMemory' in navigator[^]+=> 2/);
+ // deviceMemory lands in Chrome's 0.25/0.5/1/2/4/8 buckets (16 GB input → 8),
+ // and only where the platform exposes the API.
+ const mem = postureScript({ AXUSE_FP_MEMORY: "16" });
+ assert.match(mem, /'deviceMemory' in navigator[^]+return 8;/);
+ assert.match(postureScript({ AXUSE_FP_MEMORY: "3" }), /return 2;/);
// Garbage values are ignored, never a broken page.
const junk = postureScript({ AXUSE_FP_CORES: "zero", AXUSE_FP_MEMORY: "-1" });
assert.doesNotMatch(junk, /hardwareConcurrency/);
@@ -244,6 +252,14 @@ test("server mode: headed Chrome auto-boots a virtual display (anti-bot posture)
})).value ?? "{}");
assert.doesNotMatch(ua, /headless/i);
assert.equal(fp.webdriver, false);
+ // Tamper-invisibility (measured regression): with the AutomationControlled
+ // flag working, the prototype getter must be Chrome's NATIVE one — the
+ // posture script touches nothing when the flag already fixed the value.
+ const desc = JSON.parse((await c.execute("evaluate", {
+ expression: `(() => { const d = Object.getOwnPropertyDescriptor(Navigator.prototype, "webdriver") || {}; return { src: String(d.get ?? ""), native: String(d.get ?? "").includes("[native code]"), value: navigator.webdriver }; })()`,
+ })).value ?? "{}");
+ assert.equal(desc.value, false);
+ assert.equal(desc.native, true, `getter must stay native — got: ${desc.src}`);
assert.ok(fp.w >= geo.w - 80, `viewport width ${fp.w} ≈ ${geo.w} (--window-size honored)`);
assert.equal(fp.webgl, true, "WebGL present (SwiftShader) — a signal anti-bot checks");
@@ -281,16 +297,20 @@ test("server mode: persona coherence — TZ, language and core/memory overrides
expression: `(() => {
const g = document.createElement('canvas').getContext('webgl');
const dbg = g && g.getExtension('WEBGL_debug_renderer_info');
- return { tz: Intl.DateTimeFormat().resolvedOptions().timeZone, lang: navigator.language,
- langs: navigator.languages && navigator.languages[0], cores: navigator.hardwareConcurrency,
- mem: navigator.deviceMemory, webdriver: navigator.webdriver,
+ return { tz: Intl.DateTimeFormat().resolvedOptions().timeZone, intl: Intl.DateTimeFormat().resolvedOptions().locale,
+ lang: navigator.language, langs: navigator.languages && navigator.languages[0],
+ cores: navigator.hardwareConcurrency, mem: navigator.deviceMemory, webdriver: navigator.webdriver,
renderer: dbg ? g.getParameter(dbg.UNMASKED_RENDERER_WEBGL) : null, webgl: !!g };
})()`,
})).value ?? "{}");
// TZ reaches Date/Intl in the page (matches the egress persona).
assert.equal(p.tz, "Europe/Amsterdam");
- // --lang drives navigator.language AND the Accept-Language header source.
+ // --accept-lang drives navigator.language AND the Accept-Language header
+ // source; the derived LC_ALL makes the Intl default locale agree (this
+ // host generates en_GB.utf8 — the doctor checks and warns when a host
+ // does not).
assert.equal(p.lang, "en-GB");
+ assert.match(p.intl, /^en[-_]GB/, `Intl default locale follows AXUSE_LANG (got ${p.intl})`);
// Persona overrides land (opt-in caps for high-core servers). deviceMemory
// only exists on platforms that expose the API (this Linux build does not)
// — the override applies exactly there, never inventing an API surface