feat: display upstream model maximums as read-only capacity facts
This commit is contained in:
@@ -13,9 +13,9 @@ import { HostController } from '../src/core/desktop/host-controller.mjs';
|
||||
import { desktopExecutableIdentity } from '../src/core/desktop/app-installation.mjs';
|
||||
import { projectEnvironment } from '../src/core/process-environment.mjs';
|
||||
|
||||
if (process.argv.includes('--help')) { console.log('node scripts/verify-unrestricted-ui.mjs [--desktop] — isolated actual passthrough, permissions, automatic writes/rollback, upstream errors and cache UI. Optional AGENT_WORKBENCH_QA_APP_ROOT selects the immutable app. No real-model keys.'); process.exit(0); }
|
||||
assert.ok(process.argv.slice(2).every(value => value === '--desktop'));
|
||||
const desktop = process.argv.includes('--desktop'), appRoot = path.resolve(process.env.AGENT_WORKBENCH_QA_APP_ROOT || '.');
|
||||
if (process.argv.includes('--help')) { console.log('node scripts/verify-unrestricted-ui.mjs [--desktop] [--capacity-only] — isolated passthrough, permissions, model capacity, writes/rollback, errors and cache UI. --capacity-only focuses on permissions and model-capacity display. Optional AGENT_WORKBENCH_QA_APP_ROOT selects the immutable app. No real-model keys.'); process.exit(0); }
|
||||
assert.ok(process.argv.slice(2).every(value => ['--desktop', '--capacity-only'].includes(value)));
|
||||
const desktop = process.argv.includes('--desktop'), capacityOnly = process.argv.includes('--capacity-only'), appRoot = path.resolve(process.env.AGENT_WORKBENCH_QA_APP_ROOT || '.');
|
||||
const directory = path.resolve('.qa/unrestricted-1.25.5', (desktop ? 'open-electron-' : 'open-web-') + randomUUID());
|
||||
fs.mkdirSync(directory, { recursive: true }); console.log('EVIDENCE ' + directory);
|
||||
const disposers = [], t = { after: fn => disposers.push(fn) }, f = fixture(t, { modernDefaults: true }), checks = [], screenshots = [], errors = [];
|
||||
@@ -114,14 +114,21 @@ try {
|
||||
mark('open defaults save as real zeros, survive reload, hide local quotas and retain model selection at 1440 and 390 pixels');
|
||||
await resize(1440); await dialog().getByRole('button', { name: '模型连接', exact: true }).click();
|
||||
const connectedCard = () => dialog().locator('.mc-connection').filter({ has: page.getByRole('heading', { name: connection.name, exact: true }) });
|
||||
await expect(connectedCard()).toContainText('默认透传 · 由上游决定');
|
||||
await expect(connectedCard()).toContainText('模型最大上下文'); await expect(connectedCard()).toContainText('131,072 tokens');
|
||||
await expect(connectedCard()).toContainText('32,768 tokens');
|
||||
await connectedCard().getByRole('button', { name: '编辑', exact: true }).click();
|
||||
const connectionEditor = () => dialog().getByRole('form', { name: '编辑模型连接', exact: true });
|
||||
await expect(connectionEditor().getByLabel('上下文上限', { exact: true })).toHaveCount(0);
|
||||
await expect(connectionEditor().getByLabel('输出上限', { exact: true })).toHaveCount(0);
|
||||
await expect(connectionEditor().getByLabel('连接容量策略', { exact: true })).toContainText('默认透传 · 不设本地上限');
|
||||
await expect(connectionEditor().getByLabel('模型最大上下文', { exact: true })).toHaveText('131,072 tokens');
|
||||
await expect(connectionEditor().getByLabel('模型最大输出', { exact: true })).toHaveText('32,768 tokens');
|
||||
assert.equal(await connectionEditor().evaluate(form => form.checkValidity()), true, 'An unlimited zero-concurrency connection must remain saveable.');
|
||||
await expect(connectionEditor().getByRole('button', { name: '填入开发初始值', exact: true })).toHaveCount(0);
|
||||
for (const width of [1440, 390]) { await resize(width); await connectionEditor().getByLabel('连接容量策略', { exact: true }).scrollIntoViewIfNeeded(); await shot('connection-passthrough-' + width); }
|
||||
await connectionEditor().getByLabel('请求模型名称', { exact: true }).fill('owned-model-without-metadata');
|
||||
await expect(connectionEditor().getByLabel('模型最大上下文', { exact: true })).toHaveText('本地无限制 · 由上游决定');
|
||||
await expect(connectionEditor().getByLabel('模型最大输出', { exact: true })).toHaveText('本地无限制 · 由上游决定');
|
||||
await connectionEditor().getByRole('button', { name: '取消', exact: true }).click();
|
||||
await resize(1440); await dialog().locator('.mc-connection').filter({ has: page.getByRole('heading', { name: '原模型连接', exact: true }) }).getByRole('button', { name: '编辑', exact: true }).click();
|
||||
const legacy = page.getByRole('dialog', { name: '原连接与演示设置', exact: true });
|
||||
@@ -129,7 +136,8 @@ try {
|
||||
await expect(legacy.getByLabel('上下文预算', { exact: true })).toHaveCount(0);
|
||||
await expect(legacy.getByLabel('输出上限', { exact: true })).toHaveCount(0);
|
||||
await legacy.getByRole('button', { name: '取消', exact: true }).click(); await open();
|
||||
mark('connection list, editor and legacy settings display active passthrough without inactive 16000/2048 ceilings');
|
||||
mark('proxy models display upstream maximums read-only; absent or different-model metadata shows unlimited local passthrough without 16000/2048 ceilings');
|
||||
if (!capacityOnly) {
|
||||
await resize(1440); await dialog().getByRole('button', { name: '等待时限', exact: true }).click();
|
||||
const waits = () => dialog().getByRole('form', { name: '模型等待时限', exact: true });
|
||||
await expect(waits().getByLabel('单次模型响应上限(秒)', { exact: true })).toHaveValue('0');
|
||||
@@ -247,9 +255,11 @@ try {
|
||||
await host.api('/sessions/' + browserSession.id + '/browsing/tabs/' + ownedTabId + '/close', { approved: true });
|
||||
mark('actual Electron full access opens localhost, retains large DOM and 133 controls, fills password/select and navigates across origins without a manual approval');
|
||||
}
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
assert.equal(model.requests.filter(row => row.input).length, desktop ? 13 : 7);
|
||||
result={success:true,version:host.bootstrap.version,appRoot,actualElectron:desktop,checks,screenshots,errors,realModelRequests:0,ownedModelRequests:desktop ? 13 : 7,directoryGets:model.requests.filter(row => !row.input).length,officialServiceTouched:false};
|
||||
const expectedRequests = capacityOnly ? 2 : desktop ? 13 : 7;
|
||||
assert.equal(model.requests.filter(row => row.input).length, expectedRequests);
|
||||
result={success:true,version:host.bootstrap.version,appRoot,actualElectron:desktop,capacityOnly,checks,screenshots,errors,realModelRequests:0,ownedModelRequests:expectedRequests,directoryGets:model.requests.filter(row => !row.input).length,officialServiceTouched:false};
|
||||
} catch(error) {if(page)await shot('failure').catch(()=>{});result={success:false,appRoot,actualElectron:desktop,checks,screenshots,errors,error:error.stack,realModelRequests:0};}
|
||||
finally {if(application)await application.close();if(browser)await browser.close();if(controller&&await controller.health())await controller.stop();await host?.close?.();for(const dispose of disposers.reverse())await dispose();fs.writeFileSync(path.join(directory,'result.json'),JSON.stringify(result,null,2));}
|
||||
console.log(JSON.stringify({directory,...result}));if(!result.success)process.exitCode=1;
|
||||
|
||||
Reference in New Issue
Block a user