fix(webui): settings-s4 review F3: Model setup drops what design section 10 removes: "Use my own key" and its key fields (the service key is always made on this machine, so init always sends generate), the key rotation grace field and its settings row, the Client keys table with its refresh button and the keys read, and the "Accounts and client keys loaded" line; the setup cleanup no longer clears the removed key fields; the Advanced help says Claude Code, not "the Claude harness" (N5); the tests that pinned the removed parts read the new page (#1873, lane settings-s4)

This commit is contained in:
jason.woltje committed 2026-11-19 18:49:24 -06:00
1 parent 57e86d9867
commit d692ca9b81
4 files changed
+31 -51

No files matched your search

+12 -32
View File
@@ -627,17 +627,12 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
const triage = '<p><a id="proxy-setup-triage" class="btn" href="#/settings/triage">Set up Triage</a></p>';
const advanced = '<details id="proxy-setup-advanced" data-admin hidden><summary>Advanced: programs, port, timeouts</summary><div class="inside">'
+ '<div class="settings-form"><p class="lbl">Programs that drive models</p><ul id="proxy-setup-programs" class="model-list"></ul>'
+ '<p class="help small muted">Each organization switches these on or off on its own Models page. Claude subscription models run only in the Claude harness. Turning a program off for every organization is not built yet.</p></div>'
+ '<p class="help small muted">Each organization switches these on or off on its own Models page. Claude subscription models run only in Claude Code. Turning a program off for every organization is not built yet.</p></div>'
+ '<form id="proxy-setup-init" class="settings-form"><fieldset data-setup-write disabled><legend>Service key</legend>'
+ '<label><input type="radio" name="keySource" value="generate" checked> Generate a key on this machine (recommended). It is stored where setup stores keys and never shown.</label>'
+ '<label id="proxy-setup-paste-choice" hidden><input type="radio" name="keySource" value="paste"> Use my own key</label>'
+ '<p id="proxy-setup-paste-note" class="small muted" hidden>Your own key can be pasted only over HTTPS or on this machine (loopback). This page uses the generated key.</p>'
+ '<div id="proxy-setup-paste" hidden><div class="field"><label for="proxy-setup-key">Service key</label><input id="proxy-setup-key" name="key" type="password" autocomplete="off" spellcheck="false" maxlength="4096"></div>'
+ '<div class="field"><label for="proxy-setup-confirm">Confirm key</label><input id="proxy-setup-confirm" name="confirm" type="password" autocomplete="off" spellcheck="false" maxlength="4096"></div></div></fieldset>'
+ '<p class="small muted">Mosaic makes the service key on this machine, keeps it where setup keeps keys and never shows it.</p></fieldset>'
+ '<fieldset data-setup-write disabled><legend>Settings (leave empty for the defaults)</legend>'
+ '<div class="field w-num"><label for="proxy-setup-port">Port</label><input id="proxy-setup-port" name="port" type="number" min="1024" max="65535" step="1" inputmode="numeric"><p class="help small muted">Only this machine can reach it.</p></div>'
+ '<div class="field w-num"><label for="proxy-setup-first">Wait for a first answer (seconds)</label><input id="proxy-setup-first" name="firstOutputSeconds" type="number" min="1" max="3600" step="1" inputmode="numeric"></div>'
+ '<div class="field w-num"><label for="proxy-setup-grace">Key rotation grace (minutes)</label><input id="proxy-setup-grace" name="rotateGraceMinutes" type="number" min="1" max="1440" step="1" inputmode="numeric"></div>'
+ '<p class="help small muted">Set up model service in step 1 uses these.</p></fieldset></form>'
+ '<dl id="proxy-setup-settings" class="proxy-setup-state" hidden></dl><p id="proxy-setup-settings-note" class="small muted" hidden>Changing these after setup is not built yet.</p></div></details>';
const tech = '<details id="proxy-setup-tech" class="proxy-setup-tech"><summary>Technical details: release, service, history</summary><div class="inside">'
@@ -648,9 +643,7 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
+ '<div class="proxy-setup-orgs"><h4>Organizations</h4><div class="table-wrap" tabindex="0" role="region" aria-label="Organizations using the model service"><table><thead><tr><th>Organization</th><th>Proxy</th><th>Catalogue</th><th>Models</th></tr></thead><tbody id="proxy-setup-orgs"></tbody></table></div>'
+ '<p id="proxy-setup-own" class="muted"></p></div>'
+ '<div class="proxy-setup-receipts"><h4>History</h4><ol id="proxy-setup-receipts"><li class="muted">No setup actions on this page yet.</li></ol></div></div>'
+ '<div data-accounts-part class="proxy-keys"><h4 id="proxy-keys-title">Client keys</h4><p class="small muted">Only key IDs are shown. Hire and fire manage agent keys.</p>'
+ '<div class="table-wrap" tabindex="0" role="region" aria-label="Client keys"><table><thead><tr><th>Key ID</th><th>Managed by</th><th>Agent</th><th>Issued</th><th>State</th></tr></thead><tbody id="proxy-keys"></tbody></table></div>'
+ '<button id="proxy-refresh" type="button">Read accounts and keys again</button></div></div></details>';
+ '</div></details>';
const markup = '<div id="proxy-setup" class="model-setup">'
+ card('service', 1, 'Model service', service, true)
+ card('accounts', 2, 'Accounts and models', accounts, false)
@@ -787,13 +780,10 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
}));
}
async function refresh() {
const [accounts, keys] = await Promise.all([call('accounts'), call('keys')]);
const accounts = await call('accounts');
accountList = Array.isArray(accounts?.accounts) ? accounts.accounts : [];
accountsDown = null;
paintAccounts(); paintOrder();
$('proxy-keys').replaceChildren(...keys.keys.map(key => {
const row = document.createElement('tr'); row.append(cell(key.keyId), cell(key.management), cell(key.agent), cell(window.MosaicLocalTime(key.issuedAt)), cell(key.state)); return row;
}));
if ($('proxy-offered').open) readOffered();
setup.accounts(accountList.length);
paintAccountCard();
@@ -870,7 +860,6 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
else message(result.reason === 'login-timeout' ? 'Sign-in took too long. Try again.' : 'Account sign-in failed. Try again.', true);
} catch (error) { if (active === login) { endLogin(); message(error.message, true); } }
}
$('proxy-refresh').addEventListener('click', () => refresh().then(() => message('Accounts and client keys refreshed.')).catch(e => message(e.message)));
$('proxy-login-start').addEventListener('submit', async event => {
event.preventDefault(); const form=event.currentTarget;if (!canWrite || busy.has('login-start') || login) return;
const provider = providerSelect.value;
@@ -926,7 +915,6 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
let chain = null;
const listed = new Set();
const esc = v => String(v).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
const pasteAllowed = location.protocol === 'https:' || ['localhost', '[::1]'].includes(location.hostname) || /^127\./.test(location.hostname);
const STEPS = { start: 'Starting', 'download-archive': 'Downloading the release archive', 'verify-archive': 'Checking the archive hash', 'download-panel': 'Downloading the panel', 'verify-panel': 'Checking the panel hash', 'extract-binary': 'Extracting the executable', 'verify-binary': 'Checking the executable hash', install: 'Installing', done: 'Done' };
const REASONS = {
'human-required': 'Only the instance owner can set up the model service.',
@@ -1194,7 +1182,6 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
const canInit = sendOk && !busy && !chain?.running && !init.initialized && !init.partial && !initLock.present;
form.querySelectorAll('[data-setup-write]').forEach(e => { e.disabled = !canInit; });
form.hidden = init.initialized;
$('proxy-setup-paste-choice').hidden = !pasteAllowed; $('proxy-setup-paste-note').hidden = pasteAllowed;
const allow = { install: !unit.installed, start: unit.installed && unit.active !== 'active', restart: unit.installed && unit.active === 'active', stop: unit.installed && unit.active === 'active' };
root.querySelectorAll('[data-unit]').forEach(button => { button.disabled = !sendOk || Boolean(busy) || Boolean(chain?.running) || !init.initialized || !allow[button.dataset.unit]; });
const orgs = $('proxy-setup-orgs');
@@ -1206,7 +1193,7 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
// After init, Advanced shows the settings init wrote, read-only.
const dl = $('proxy-setup-settings'), s = init.initialized && init.settings && typeof init.settings === 'object' ? init.settings : null;
dl.hidden = !s; $('proxy-setup-settings-note').hidden = !s; dl.replaceChildren();
if (s) { row(dl, 'Port', human(s.port)); if (s.firstOutputSeconds !== undefined) row(dl, 'Wait for a first answer', `${human(s.firstOutputSeconds)} seconds`); if (s.rotateGraceMinutes !== undefined) row(dl, 'Key rotation grace', `${human(s.rotateGraceMinutes)} minutes`); }
if (s) { row(dl, 'Port', human(s.port)); if (s.firstOutputSeconds !== undefined) row(dl, 'Wait for a first answer', `${human(s.firstOutputSeconds)} seconds`); }
}
// Programs that drive models: the harnesses this Console offers an organization, read on open.
let programsRead = false;
@@ -1317,18 +1304,12 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
// painted here first from the state already read.
try { await action(); } catch (error) { say(error.message, 'error'); } finally { if (state) { state = { ...state, busy: null }; paint(); } await load(); }
}
// The settings under Advanced, read when the chain starts. A pasted key leaves its fields at once.
// The settings under Advanced, read when the chain starts. settings-s4 (design section 10, A8):
// the service key is always generated on this machine; there is no pasted key.
function initArgs() {
const f = form.elements, args = {};
const pasted = pasteAllowed && f.keySource.value === 'paste', key = f.key.value, confirm = f.confirm.value;
f.key.value = ''; f.confirm.value = '';
const f = form.elements, args = { generate: true };
if (!form.checkValidity()) { $('proxy-setup-advanced').open = true; form.reportValidity(); say('A setting under Advanced is out of range.', 'error'); return null; }
for (const name of ['port', 'rotateGraceMinutes', 'firstOutputSeconds']) if (f[name].value !== '') args[name] = Number(f[name].value);
if (pasted) {
if (!key) { $('proxy-setup-advanced').open = true; say('Type the key in both fields under Advanced, or choose the generated key.', 'error'); return null; }
if (key !== confirm) { $('proxy-setup-advanced').open = true; say(explain('proxy-key-mismatch'), 'error'); return null; }
args.key = key; args.confirm = confirm;
} else args.generate = true;
for (const name of ['port', 'firstOutputSeconds']) if (f[name].value !== '') args[name] = Number(f[name].value);
return args;
}
const stop = (at, reason) => Object.assign(new Error(reason), { at });
@@ -1376,7 +1357,6 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
else say({ install: 'Model service installed.', start: 'Model service started and answering.', stop: 'Model service stopped.', restart: 'Model service restarted; the new process answers.' }[op], 'success');
});
const clearFence = () => act('fence-clear', async () => { const result = await admin('fence/clear', {}); addReceipt(result.receipt); say(result.cleared ? 'Fence cleared.' : 'The fence was not set.', 'success'); });
form.elements.keySource.forEach?.(radio => radio.addEventListener('change', () => { $('proxy-setup-paste').hidden = form.elements.keySource.value !== 'paste'; }));
form.addEventListener('submit', event => event.preventDefault());
$('proxy-setup-render').addEventListener('click', async () => {
const pre = $('proxy-setup-unit-file');
@@ -1393,7 +1373,7 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
serviceDone: () => running(),
// An organization whose model list is ready, for Models offered. The open one first.
readyOrg() { const orgs = Array.isArray(state?.organizations) ? state.organizations.filter(o => o.proxy === 'shared' && o.catalogue?.status === 'ready') : []; return (orgs.find(o => o.id === window.MosaicOrg?.id) ?? orgs[0])?.id ?? null; },
stop() { enabled = false; clearTimeout(timer); timer = null; const f = form.elements; f.key.value = ''; f.confirm.value = ''; },
stop() { enabled = false; clearTimeout(timer); timer = null; },
};
})();
// The account parts the not-configured state hides come back once the proxy answers.
@@ -1409,7 +1389,7 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
try { await refresh(); } catch { return; }
accountsShown = true; accountsDown = null; $('proxy-message').classList.remove('empty'); showAccounts(true);
applyWrite();
message('Accounts and client keys loaded.');
message('');
paintAccountCard();
}
// #1873 settings slice 1 (D3): a restart from this page's list reads the status again.
@@ -1429,7 +1409,7 @@ if (document.documentElement.hasAttribute('data-settings-proxy-document') && !lo
if (proxyAdmin) { root.querySelectorAll('[data-admin]').forEach(part => { part.hidden = false; }); setup.start(config); }
paintAccountCard();
return refresh();
}).then(() => message('Accounts and client keys loaded.')).catch(error => { message(error.message);
}).then(() => message('')).catch(error => { message(error.message);
// #1873: on the setup page a stopped proxy hides the account parts like an unconfigured one,
// and the setup load brings them back once the service answers.
// Any failed read hides them, not only proxy-down: a proxy that is initialized but not yet answering
+7 -4
View File
@@ -42,7 +42,8 @@ async function setup(t, readonly = false, refusal = null) {
await b.navigate(`http://127.0.0.1:${server.address().port}/#/settings/model-proxy`);
const wait = expression => b.evaluate(`(async()=>{for(let n=0;n<600;n++){if(${expression})return true;await new Promise(r=>setTimeout(r,25));}throw Error('proxy UI condition timed out');})()`);
await wait('window.__stubReady === true && document.readyState === "complete" && document.querySelector("#proxy-message")');
if (!refusal) await wait('document.querySelector("#proxy-message").textContent.includes("loaded")');
// The status line reads "Reading accounts…" until the accounts are painted, then empties.
if (!refusal) await wait('document.querySelector("#proxy-message").textContent==="" && document.querySelector("#proxy-accounts").children.length>0');
return { b, state, wait };
}
test('proxy browser clears write-only key immediately, sends once and renders data as text', { timeout: 60000 }, async t => {
@@ -106,7 +107,9 @@ test('proxy browser saves the configured model names for a z.ai group', { timeou
assert.equal(state.routes.filter(r => r.endsWith('/group/models/set')).length, 1);
});
test('client key issued time is displayed in local time', { timeout: 60000 }, async t => {
const {b}=await setup(t);
assert.equal(await b.evaluate(`document.querySelector('#proxy-keys tr td:nth-child(4)').textContent`),await b.evaluate(`new Date('2026-11-07T02:24:02.021Z').toLocaleString()`));
test('settings-s4: Model setup shows no client keys table and reads no keys (design section 10)', { timeout: 60000 }, async t => {
const {b,state}=await setup(t);
assert.equal(await b.evaluate(`Boolean(document.querySelector('#proxy-keys, #proxy-refresh'))`),false);
assert.doesNotMatch(await b.evaluate('document.body.innerText'),/Client keys|Accounts and client keys/);
assert.equal(state.routes.some(r=>r.startsWith('/api/proxy/keys')),false);
});
@@ -58,30 +58,27 @@ test('without send the next-step button is disabled and nothing is posted', { ti
assert.deepEqual(await writes(b), []);
});
test('init sends generate by default; a pasted key on loopback is sent with its confirmation and the fields are cleared', { timeout: 90000 }, async t => {
test('init always sends generate; there is no pasted key, and Try again sends generate again', { timeout: 90000 }, async t => {
const { f, b, wait } = await w15Fixture(t, { scenario: { ...scenario(fetched), 'POST /api/proxy/admin/init': { body: { settings: { port: 18432 }, receipt: { op: 'init', time: T, port: 18432, generated: true } } } } });
await b.navigate(f.base + '/#/settings/model-setup');
await wait('document.querySelector("#proxy-setup-go")?.dataset.next==="init"');
assert.equal(await b.evaluate('document.querySelector("#proxy-setup-go").textContent'), 'Continue setup');
// The settings sit under Advanced and go with the press.
assert.equal(await b.evaluate('document.querySelector("#proxy-setup-advanced summary").textContent'), 'Advanced: programs, port, timeouts');
assert.equal(await b.evaluate('document.querySelector("#proxy-setup-paste-choice").hidden'), false, 'loopback page offers the paste choice');
assert.equal(await b.evaluate('document.querySelector("#proxy-setup-paste").hidden'), true);
// settings-s4 (design section 10, A8 and A2): no "Use my own key", no key fields, no rotation grace.
assert.equal(await b.evaluate('Boolean(document.querySelector("#proxy-setup-paste-choice, #proxy-setup-paste, #proxy-setup-key, #proxy-setup-confirm, #proxy-setup-grace, [name=keySource]"))'), false);
assert.equal(await b.evaluate('document.querySelectorAll("#proxy-setup-init input[type=password], #proxy-setup-advanced input[type=password]").length'), 0);
assert.match(await b.evaluate('document.querySelector("#proxy-setup-init").textContent'), /Mosaic makes the service key on this machine/);
assert.doesNotMatch(await b.evaluate('document.querySelector("#proxy-setup").textContent'), /Use my own key|Key rotation grace/);
await b.evaluate('(()=>{const f=document.querySelector("#proxy-setup-init");f.elements.port.value="18432";document.querySelector("#proxy-setup-go").click();})()');
await wait('window.__writes.some(w=>w.path==="/api/proxy/admin/init")');
assert.deepEqual(await writes(b), [{ path: '/api/proxy/admin/init', body: { port: 18432, generate: true } }]);
assert.deepEqual(await writes(b), [{ path: '/api/proxy/admin/init', body: { generate: true, port: 18432 } }]);
assert.match(await b.evaluate('document.querySelector("#proxy-setup-receipts").textContent'), /init/);
// The status still names init, so the run stops there; Try again starts from it.
await wait('document.querySelector("#proxy-setup-go")?.textContent==="Try again" && !document.querySelector("#proxy-setup-init [data-setup-write]").disabled');
await b.evaluate('(()=>{const f=document.querySelector("#proxy-setup-init");f.elements.keySource.value="paste";f.querySelector("[value=paste]").dispatchEvent(new Event("change"));f.elements.port.value="";f.elements.key.value="pa-browser-sentinel-0001";f.elements.confirm.value="pa-browser-sentinel-0002";document.querySelector("#proxy-setup-go").click();})()');
await wait('document.querySelector("#proxy-setup-message").textContent.includes("proxy-key-mismatch")');
assert.equal((await writes(b)).length, 1, 'a mismatch is refused in the page');
assert.equal(await b.evaluate('document.querySelector("#proxy-setup-init").elements.key.value'), '', 'the key field is cleared on submit');
await b.evaluate('(()=>{const f=document.querySelector("#proxy-setup-init");f.elements.key.value="pa-browser-sentinel-0001";f.elements.confirm.value="pa-browser-sentinel-0001";document.querySelector("#proxy-setup-go").click();})()');
await b.evaluate('(()=>{const f=document.querySelector("#proxy-setup-init");f.elements.port.value="";document.querySelector("#proxy-setup-go").click();})()');
await wait('window.__writes.filter(w=>w.path==="/api/proxy/admin/init").length===2');
assert.deepEqual((await writes(b))[1], { path: '/api/proxy/admin/init', body: { key: 'pa-browser-sentinel-0001', confirm: 'pa-browser-sentinel-0001' } });
assert.equal(await b.evaluate('[...document.querySelectorAll("#proxy-setup-init input[type=password]")].every(i=>i.value==="")'), true);
assert.equal(await b.evaluate('document.body.innerText.includes("pa-browser-sentinel")'), false);
assert.deepEqual((await writes(b))[1], { path: '/api/proxy/admin/init', body: { generate: true } });
});
test('after a confirmed restart the next step clears the fence and shows the receipt', { timeout: 90000 }, async t => {
@@ -110,7 +107,7 @@ test('a stopped proxy hides the account panels with a setup note, and starting t
unit: { unit: 'mosaic-proxy.service', installed: true, active: 'active', pid: 4242, port: 18432, listening: true }, next: ['accounts'] })} })`);
await b.evaluate('document.querySelector("#proxy-setup-go").click()');
await wait('window.__writes.some(w=>w.path==="/api/proxy/admin/unit/start")');
await wait('document.querySelector("#proxy-message").textContent.includes("Accounts and client keys loaded")');
await wait('[...document.querySelectorAll("[data-accounts-part]")].length>0 && [...document.querySelectorAll("[data-accounts-part]")].every(e=>!e.hidden)');
assert.equal(await b.evaluate('[...document.querySelectorAll("[data-accounts-part]")].some(e=>e.hidden)'), false);
});
@@ -128,7 +125,7 @@ test('an initialized proxy whose accounts read fails with another code also hide
'/api/proxy/admin/status': ${JSON.stringify({ ...base, release: fetched.release, init: { initialized: true, partial: false, settings: { port: 18432 }, files: [] },
unit: { unit: 'mosaic-proxy.service', installed: true, active: 'active', pid: 4242, port: 18432, listening: true }, next: ['accounts'] })} })`);
await b.evaluate('document.querySelector("#proxy-setup-go").click()');
await wait('document.querySelector("#proxy-message").textContent.includes("Accounts and client keys loaded")');
await wait('[...document.querySelectorAll("[data-accounts-part]")].length>0 && [...document.querySelectorAll("[data-accounts-part]")].every(e=>!e.hidden)');
assert.equal(await b.evaluate('[...document.querySelectorAll("[data-accounts-part]")].some(e=>e.hidden)'), false);
});
@@ -29,7 +29,7 @@ test('F6 add agent labels left aligned with launch on own row',opts,async t=>{co
test('F7 maximum length agent values wrap at 390',opts,async t=>{const {b}=await page(t,'agents',390);assert.equal(await b.evaluate('document.documentElement.scrollWidth<=innerWidth'),true);});
test('F8 root proxy route mounts its settings section',opts,async t=>{const {b}=await page(t,'model-proxy');assert.equal(await b.evaluate('location.pathname'),'/');assert.equal(await b.evaluate('!!document.querySelector("#proxy-accounts")'),true);});
test('F9 add agent saving and refusal remain local and visible',opts,async t=>{const {b,wait}=await page(t,'agents');await pointer(b,'.agent-more');await pointer(b,'[data-agent-edit]');await wait('!!document.querySelector("#instance-change-form")');await input(b,'#instance-add-form [data-instance-field=instance]','new-coder');await b.evaluate(`document.querySelector('#instance-add-form select').value='coder';window.__baseFetch=fetch;window.fetch=(u,o)=>o?.method==='POST'?new Promise(resolve=>window.__answer=(status,body)=>resolve(new Response(JSON.stringify(body),{status}))):window.__baseFetch(u,o);document.querySelector('#instance-add-form').requestSubmit()`);await wait('!!window.__answer && !!document.querySelector("#instance-add-form .settings-spinner")');assert.equal(await b.evaluate('!!document.querySelector("#instance-add-form .settings-spinner")'),true);assert.equal(await b.evaluate('document.querySelector("#instance-change-form select").disabled'),false);await b.evaluate('__answer(409,{message:"Fixture conflict",sent:false})');await wait('document.querySelector("#instances-receipt")?.textContent.includes("Fixture conflict")');assert.equal(await b.evaluate('!!document.querySelector("#instance-add-form .banner.err")'),true);assert.equal(await b.evaluate('document.querySelector("#instance-add-form .banner.err").getBoundingClientRect().bottom<=document.querySelector("#instance-add-form button[type=submit]").getBoundingClientRect().top'),true);});
test('F10 routing widths, segmented focus, conditional proxy link and priority style',opts,async t=>{const {b,wait}=await page(t,'routing');assert.equal(await b.evaluate('[...document.querySelectorAll("#routes-table select")].every(e=>e.getBoundingClientRect().width>=132)'),true);await b.evaluate('location.hash="#/settings/appearance"');await wait('!!document.querySelector(".settings-segments")');await b.evaluate('document.querySelector("[name=theme]:checked").focus()');await b.key('ArrowLeft');assert.equal(await b.evaluate('getComputedStyle(document.querySelector(".settings-segments")).outlineStyle!=="none"'),true);await pointer(b,'#settings-nav a[href="#/settings/model-setup"]');await wait('!!document.querySelector("#proxy-order form")');await pointer(b,'#setup-step-accounts .step-toggle');await wait('!document.querySelector("#setup-step-accounts-body").hidden');await pointer(b,'#proxy-add-box summary');await b.evaluate(`window.open=()=>null;__scenario['POST /api/proxy/login/start']={status:200,body:{url:'https://fixture.invalid/authorize',state:'fixture-state'}}`);await pointer(b,'#proxy-login-start button[type=submit]');await wait('document.querySelector("#proxy-authorize")?.hidden===false');assert.equal(await b.evaluate(`document.querySelector('#proxy-authorize').getBoundingClientRect().height>=44`),true);assert.equal(await b.evaluate('getComputedStyle(document.querySelector("#proxy-order .proxy-priority-save")).backgroundColor===getComputedStyle(document.querySelector("#proxy-refresh")).backgroundColor'),true);});
test('F10 routing widths, segmented focus, conditional proxy link and priority style',opts,async t=>{const {b,wait}=await page(t,'routing');assert.equal(await b.evaluate('[...document.querySelectorAll("#routes-table select")].every(e=>e.getBoundingClientRect().width>=132)'),true);await b.evaluate('location.hash="#/settings/appearance"');await wait('!!document.querySelector(".settings-segments")');await b.evaluate('document.querySelector("[name=theme]:checked").focus()');await b.key('ArrowLeft');assert.equal(await b.evaluate('getComputedStyle(document.querySelector(".settings-segments")).outlineStyle!=="none"'),true);await pointer(b,'#settings-nav a[href="#/settings/model-setup"]');await wait('!!document.querySelector("#proxy-order form")');await pointer(b,'#setup-step-accounts .step-toggle');await wait('!document.querySelector("#setup-step-accounts-body").hidden');await pointer(b,'#proxy-add-box summary');await b.evaluate(`window.open=()=>null;__scenario['POST /api/proxy/login/start']={status:200,body:{url:'https://fixture.invalid/authorize',state:'fixture-state'}}`);await pointer(b,'#proxy-login-start button[type=submit]');await wait('document.querySelector("#proxy-authorize")?.hidden===false');assert.equal(await b.evaluate(`document.querySelector('#proxy-authorize').getBoundingClientRect().height>=44`),true);assert.equal(await b.evaluate('getComputedStyle(document.querySelector("#proxy-order .proxy-priority-save")).backgroundColor===getComputedStyle(document.querySelector("#proxy-login-cancel")).backgroundColor'),true);});
test('F11 Vars fields have labels and mobile agent values identify columns',opts,async t=>{const {b,wait}=await page(t,'agents',390);assert.equal(await b.evaluate('document.querySelector("#instance-add-form textarea").labels.length>0'),true);assert.match(await b.evaluate('document.querySelector("#agents-table tbody tr").innerText'),/Definition/);assert.equal(await b.evaluate('document.querySelector("#agents-table tbody td").getAttribute("headers")'), 'agent-col-definition');await b.viewport(1440,1000);await pointer(b,'.agent-more');await pointer(b,'[data-agent-edit]');await wait('!!document.querySelector("#instance-change-form")');assert.equal(await b.evaluate('document.querySelector("#instance-change-form textarea").labels.length>0'),true);});
test('F12 collapsed section announces current draft and clears after discard',opts,async t=>{const {b,wait}=await page(t,'routing',390);await b.evaluate(`(()=>{let e=[...document.querySelectorAll('[data-route]')].find(e=>JSON.parse(e.dataset.route)[1]==='thinking');e.value='xhigh';e.dispatchEvent(new Event('change',{bubbles:true}))})()`);assert.equal(await b.evaluate('!!document.querySelector("#settings-disclosure .settings-dot")'),true);assert.match(await b.evaluate('document.querySelector("#settings-disclosure").textContent'),/unsaved changes/);await pointer(b,'#routes-reload');await wait('!document.querySelector("#settings-nav .settings-dot")');assert.equal(await b.evaluate('!!document.querySelector("#settings-disclosure .settings-dot")'),false);});
test('F13 each browser save receipt expires independently',opts,async t=>{const {b}=await page(t,'appearance');await b.evaluate('document.querySelector("[name=theme][value=dim]").focus();document.querySelector("[name=theme][value=dim]").click();document.querySelector("[name=palette][value=grove]").focus();document.querySelector("[name=palette][value=grove]").click();document.querySelector("[name=density][value=compact]").focus();document.querySelector("[name=density][value=compact]").click()');await b.evaluate('new Promise(r=>setTimeout(r,4200))');assert.deepEqual(await b.evaluate('[...document.querySelectorAll(".settings-browser-status")].map(e=>e.textContent)'),['','','']);});