feat: introduce Orven brand and task-focused workspace

This commit is contained in:
Agent Workbench Dev
2026-11-06 14:08:53 +08:00
parent 16fb10ca15
commit b4b139a1ba
74 changed files with 1266 additions and 103 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
@@ -38,7 +39,7 @@ export async function desktopProjectQa({ store, provider, runtime, sample, kind
await select(session); await closeInspector();
const prepared = [...store.core.change_set.values()].find(value => value.sessionId === session.id && value.status === 'prepared' && JSON.stringify(value.files.map(file => file.changeId).sort()) === JSON.stringify(ids.slice().sort()));
if (prepared) {
await page.getByRole('button', { name: '隔离协作', exact: true }).click();
await openWorkbenchTool(page, '隔离协作');
await page.getByRole('button', { name: '打开父工程变更集审查', exact: true }).click();
await page.getByRole('button', { name: '审查变更集', exact: true }).click();
} else {
@@ -96,7 +97,7 @@ export async function desktopProjectQa({ store, provider, runtime, sample, kind
retainedEvents: retainedEvents.length, retainedEventsSha256: hash(Buffer.from(JSON.stringify(retainedEvents))), instanceId: identity.instanceId, completedToolSha256: prior, approvals });
}
async function capture(session, label) {
await select(session); await closeInspector(); await page.getByRole('button', { name: '隔离协作', exact: true }).click();
await select(session); await closeInspector(); await openWorkbenchTool(page, '隔离协作');
for (const width of [1440, 390]) {
const native = await application.browserWindow(page); await native.evaluate((value, width) => { value.showInactive(); value.setContentSize(width, 900); }, width);
await expect.poll(() => page.evaluate(() => innerWidth)).toBe(width);
+29
View File
@@ -0,0 +1,29 @@
import fs from 'node:fs';
import path from 'node:path';
import { chromium } from 'playwright';
// Keep the existing filenames consumed by the desktop launcher and mobile build.
const svg = fs.readFileSync(path.resolve('public/favicon.svg'), 'utf8');
const browser = await chromium.launch({ channel: 'msedge', headless: true });
try {
const page = await browser.newPage({ deviceScaleFactor: 1 });
const images = [];
for (const size of [16, 32, 48, 256]) {
await page.setViewportSize({ width: size, height: size });
await page.setContent('<style>html,body{margin:0;background:transparent}svg{display:block;width:100vw;height:100vh}</style>' + svg);
images.push({ size, bytes: await page.screenshot({ omitBackground: true }) });
}
fs.writeFileSync('public/workbench-icon.png', images.at(-1).bytes);
const header = Buffer.alloc(6 + images.length * 16);
header.writeUInt16LE(1, 2); header.writeUInt16LE(images.length, 4);
let offset = header.length;
for (let index = 0; index < images.length; index++) {
const { size, bytes } = images[index], position = 6 + index * 16;
header[position] = size === 256 ? 0 : size; header[position + 1] = size === 256 ? 0 : size;
header.writeUInt16LE(1, position + 4); header.writeUInt16LE(32, position + 6);
header.writeUInt32LE(bytes.length, position + 8); header.writeUInt32LE(offset, position + 12);
offset += bytes.length;
}
fs.writeFileSync('public/workbench-icon.ico', Buffer.concat([header, ...images.map(image => image.bytes)]));
console.log('Orven icons generated: PNG 256px; ICO 16/32/48/256px.');
} finally { await browser.close(); }
+12
View File
@@ -0,0 +1,12 @@
// Keep acceptance drivers on the product's real navigation after the Orven redesign.
// This opens a visible entry or the searchable toolbox; it never bypasses the UI.
export async function openWorkbenchTool(page, name) {
const aliases = { '打开模型中心': '选择与管理模型', '项目MCP工具': '项目 MCP 工具' };
const direct = page.getByRole('button', { name: aliases[name] ?? name, exact: true });
if (await direct.first().isVisible()) { await direct.first().click(); return; }
await page.getByRole('button', { name: '打开工具箱', exact: true }).click();
const toolbox = page.getByRole('dialog', { name: '工具箱', exact: true });
const actionName = name === '打开模型中心' ? '模型中心' : aliases[name] ?? name;
await toolbox.getByLabel('搜索工作台工具').fill(actionName);
await toolbox.getByRole('button', { name: actionName, exact: true }).click();
}
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -48,7 +49,7 @@ const browser = await chromium.launch({ channel: 'msedge', headless: true }), pa
page.on('pageerror', cause => errors.push(cause.message));
const mark = message => { checks.push(message); console.log('PASS ' + message); };
const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true });
async function open() { if (!await dialog().isVisible()) await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); return dialog(); }
async function open() { if (!await dialog().isVisible()) await openWorkbenchTool(page, '打开模型中心'); return dialog(); }
async function shot(name) {
const file = path.join(directory, name + '.png'); await page.screenshot({ path: file }); screenshots.push(file);
assert.ok(await page.locator('body').evaluate(node => node.scrollWidth <= innerWidth), 'page overflow: ' + name);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -31,7 +32,7 @@ async function shot(page, name) { const file = path.join(directory, name + '.png
let mobile, relay, gatewayStatus, cookie = '', disconnected = false;
try {
await desktop.addInitScript(({ projectId, sessionId }) => { localStorage.setItem('awb-project', projectId); localStorage.setItem('awb-session', sessionId); }, { projectId: f.project.id, sessionId: f.session.id });
await desktop.goto(host.url); await desktop.getByRole('button', { name: '手机连接', exact: true }).click();
await desktop.goto(host.url); await openWorkbenchTool(desktop, '手机连接');
const panel = desktop.getByRole('dialog', { name: '手机连接', exact: true }); await expect(panel).toBeVisible();
await expect(panel).toContainText('默认关闭');
const initial = await host.api('/companion'); assert.ok(initial.addresses.length, 'Requires an actual owned private IPv4 interface.');
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -41,8 +42,8 @@ async function closeInspector() {
await expect(close).toHaveCount(1);
if (await close.isVisible()) { await close.click(); await expect(page.locator('.inspector')).toBeHidden(); }
}
async function openWorkers() { await closeInspector(); await page.getByRole('button', { name: '隔离协作', exact: true }).click(); await expect(panel()).toBeVisible(); await expect(panel().getByRole('button', { name: '刷新', exact: true })).toBeEnabled(); }
async function openEngine() { await closeInspector(); await page.getByRole('button', { name: '本地代理引擎', exact: true }).click(); await expect(runPanel()).toBeVisible(); }
async function openWorkers() { await closeInspector(); await openWorkbenchTool(page, '隔离协作'); await expect(panel()).toBeVisible(); await expect(panel().getByRole('button', { name: '刷新', exact: true })).toBeEnabled(); }
async function openEngine() { await closeInspector(); await openWorkbenchTool(page, '本地代理引擎'); await expect(runPanel()).toBeVisible(); }
async function parentFromChild() { await openWorkers(); await panel().getByRole('button', { name: '返回父目标', exact: true }).click(); await expect.poll(() => page.evaluate(() => localStorage.getItem('awb-session'))).toBe(f.session.id); await openWorkers(); }
async function start() { await panel().getByRole('button', { name: /开始引擎任务|继续未完成子任务/, exact: true }).click(); await page.getByRole('dialog', { name: '确认受限子执行', exact: true }).getByRole('button', { name: '确认开始', exact: true }).click(); }
async function applyOne() {
+4 -3
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
@@ -54,7 +55,7 @@ try {
await page.getByRole('combobox', { name: '当前项目', exact: true }).selectOption(project.id);
if (native) {
stage = 'actual native directory picker'; const chosenRoot = path.join(root, 'native-picked-project'); fs.mkdirSync(chosenRoot); fs.writeFileSync(path.join(chosenRoot, 'README.md'), '# Actual native picker project\n');
await page.getByRole('button', { name: '桌面宿主', exact: true }).click();
await openWorkbenchTool(page, '桌面宿主');
const pending = page.getByRole('button', { name: '选择项目文件夹', exact: true }).click();
console.log(JSON.stringify({ nativePickerReady: true, expectedPath: chosenRoot, electronPid: pid, hostPid: original.pid, root }));
await until(async () => (await controller.api('/bootstrap')).projects.some(value => value.root.toLowerCase() === chosenRoot.toLowerCase()), 1200000); await pending;
@@ -107,7 +108,7 @@ try {
const file = await controller.api('/projects/' + project.id + '/file?path=README.md'), scope = { projectId: project.id, sessionId: session.id, taskId: done.execution.task.id };
const invalid = await page.evaluate(async input => { const rejected = []; for (const value of [{ ...input, path: '../outside' }, { ...input, taskId: '00000000-0000-0000-0000-000000000000' }, { ...input, sha256: '0'.repeat(64) }, { ...input, command: 'foreign' }]) { try { await window.desktopWorkbench.revealFile(value); rejected.push(false); } catch { rejected.push(true); } } return rejected; }, { ...scope, path: file.path, sha256: file.sha256 });
assert.deepEqual(invalid, [true, true, true, true]);
await page.getByRole('button', { name: '桌面宿主', exact: true }).click(); await page.getByRole('button', { name: '打开项目目录', exact: true }).click(); await page.getByRole('button', { name: '定位当前文件', exact: true }).click();
await openWorkbenchTool(page, '桌面宿主'); await page.getByRole('button', { name: '打开项目目录', exact: true }).click(); await page.getByRole('button', { name: '定位当前文件', exact: true }).click();
await until(() => application.evaluate(() => globalThis.desktopFixtureCalls.length === 2));
const fixtureCalls = await application.evaluate(() => globalThis.desktopFixtureCalls); assert.deepEqual(fixtureCalls, [{ folder: projectRoot }, { reveal: path.join(projectRoot, 'README.md') }]);
const screenshots = [await snapshot('desktop-host-1440', 1440), await snapshot('desktop-host-390', 390)];
@@ -115,7 +116,7 @@ try {
record(stage, { invalidRejected: invalid.length, fixtureCalls, screenshots, nativeOperations: 'Dialog/shell adapters are declared fixtures in this automated run; actual Windows picker separately verified.' });
stage = 'native stop cancelled, then original host explicitly stopped';
await page.getByRole('button', { name: '关闭检视区', exact: true }).click();
await page.getByRole('button', { name: '桌面宿主', exact: true }).click(); await page.getByRole('button', { name: '停止并退出', exact: true }).click();
await openWorkbenchTool(page, '桌面宿主'); await page.getByRole('button', { name: '停止并退出', exact: true }).click();
await until(() => page.getByRole('button', { name: '停止并退出', exact: true }).isEnabled());
assert.equal((await controller.connect()).identity.instanceId, original.instanceId);
await application.evaluate(({ dialog }) => { dialog.showMessageBox = async () => ({ response: 1 }); });
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import { releaseEvidencePrefix } from './qa-evidence.mjs';
import assert from 'node:assert/strict';
import fs from 'node:fs';
@@ -36,7 +37,7 @@ async function open(title = session.title) {
deliberateNavigation = true; await page.goto(host.url); await page.waitForLoadState('networkidle'); deliberateNavigation = false;
if (!await page.getByLabel('当前项目').isVisible()) await page.getByRole('button', { name: '展开项目栏', exact: true }).click();
await page.getByLabel('当前项目').selectOption(project.id); await page.locator('.session-list button').filter({ hasText: title }).click();
await page.getByRole('button', { name: '本地代理引擎', exact: true }).click(); await panel().waitFor({ state: 'visible' });
await openWorkbenchTool(page, '本地代理引擎'); await panel().waitFor({ state: 'visible' });
await textContains(panel(), '已找到 0.2.1-rc.2');
}
async function detect(installationRoot) {
@@ -117,7 +118,7 @@ try {
await page.locator('.session-list button').filter({ hasText: other.title }).click(); selectedRoute = '/sessions/' + other.id;
const lateResponse = page.waitForResponse(response => response.url().includes('/engines/deepseek/availability') && response.status() === 500);
release(); await lateResponse; await page.unroute(pattern);
await page.getByRole('button', { name: '本地代理引擎', exact: true }).click(); await panel().waitFor({ state: 'visible' });
await openWorkbenchTool(page, '本地代理引擎'); await panel().waitFor({ state: 'visible' });
await textContains(panel(), '已找到 0.2.1-rc.2'); await textContains(panel(), '先验证这个安装能否连接');
assert.equal((await state()).execution.engineJobs.length, 0); assert.equal(await page.getByText('owned-late-engine-error-must-stay-in-original-view').count(), 0);
mark('late detection failure from a closed panel cannot appear in a different task or reveal its prior engine records');
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -47,11 +48,11 @@ try{
mark('real owned HTTP tools, applied candidate review and approved original checks pass; unsealed attempted outcomes stay unknown and sealed report retains original failure');
browser=await chromium.launch({channel:'msedge',headless:true});const page=await browser.newPage({viewport:{width:1440,height:1000},acceptDownloads:true});page.on('pageerror',error=>pageErrors.push(error.message));
await page.addInitScript(({projectId,sessionId})=>{localStorage.setItem('awb-project',projectId);localStorage.setItem('awb-session',sessionId);},{projectId:f.project.id,sessionId:f.session.id});
await page.goto(host.url);await page.waitForLoadState('networkidle');await page.getByRole('button',{name:'工程评测',exact:true}).click();const panel=page.getByLabel('工程评测控制台',{exact:true});await expect(panel).toContainText('随包工程评测');
await page.goto(host.url);await page.waitForLoadState('networkidle');await openWorkbenchTool(page, '工程评测');const panel=page.getByLabel('工程评测控制台',{exact:true});await expect(panel).toContainText('随包工程评测');
const refresh=panel.getByRole('button',{name:'刷新',exact:true});await refresh.focus();assert.ok(await refresh.evaluate(node=>node.matches(':focus')));await page.keyboard.press('Tab');
await panel.getByRole('button',{name:'查看原版 / 候选对照',exact:true}).click();const dialog=page.getByRole('dialog',{name:'原版与候选对照',exact:true});await expect(dialog).toContainText('测试 0/3 · 失败 3');await expect(dialog).toContainText('测试 3/3 · 失败 0');await expect(dialog).toContainText('本地固定响应');await expect(dialog).toContainText('费用未报告');
for(const viewport of [{width:1440,height:1000},{width:390,height:844}]){await page.setViewportSize(viewport);if(viewport.width===390)await dialog.getByText('测试 3/3 · 失败 0',{exact:true}).scrollIntoViewIfNeeded();assert.ok(await page.locator('body').evaluate(node=>node.scrollWidth<=innerWidth));const file=path.join(directory,'comparison-'+viewport.width+'.png');await page.screenshot({path:file,fullPage:true});screenshots.push({file,sha256:hash(fs.readFileSync(file))});}
const downloaded=page.waitForEvent('download');await dialog.getByRole('button',{name:'导出原报告',exact:true}).click();const file=path.join(directory,'downloaded-report.json');await(await downloaded).saveAs(file);assert.deepEqual(JSON.parse(fs.readFileSync(file)).summary,comparison.summary);await page.keyboard.press('Escape');await page.reload();await page.waitForLoadState('networkidle');await page.getByRole('button',{name:'工程评测',exact:true}).click();await expect(panel).toContainText('随包工程评测');
const downloaded=page.waitForEvent('download');await dialog.getByRole('button',{name:'导出原报告',exact:true}).click();const file=path.join(directory,'downloaded-report.json');await(await downloaded).saveAs(file);assert.deepEqual(JSON.parse(fs.readFileSync(file)).summary,comparison.summary);await page.keyboard.press('Escape');await page.reload();await page.waitForLoadState('networkidle');await openWorkbenchTool(page, '工程评测');await expect(panel).toContainText('随包工程评测');
mark('compiled desktop/390px UI renders original and candidate checks, fixed-response label, unknown fee, keyboard focus and downloadable report; refresh preserves the same batch');
batch=await operation(batch,'adopt');assert.equal(batch.status,'awaiting_delivery',batch.message);const adopted=(await host.api(route+'/collaborations')).groups.find(row=>row.id===group.id);await apply(route,await host.api(route+'/change-sets/'+adopted.merge.changeSetId));
const plan=(await host.api(route+'/check-plans',{names:['test','build']})).execution.plans.at(-1),job=(await host.api(route+'/check-jobs',{planId:plan.id})).execution.checks.at(-1);let checked;await until(async()=>{checked=await host.api(route+'/check-jobs/'+job.id);return !['queued','running'].includes(checked.status);});assert.equal(checked.status,'passed',checked.summary);
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -28,11 +29,11 @@ const assertions=[],screenshots=[],errors=[],exports=[];page.on('pageerror',erro
const panel=()=>page.getByLabel('工程评测控制台',{exact:true});
const mark=value=>{assertions.push(value);console.log('PASS '+value);};
const shot=async name=>{const file=path.join(directory,name+'.png');await page.screenshot({path:file,fullPage:true});screenshots.push({file,sha256:hash(fs.readFileSync(file))});assert.ok(await page.locator('body').evaluate(node=>node.scrollWidth<=innerWidth),'body overflow '+name);assert.ok(await panel().evaluate(node=>node.scrollWidth<=node.clientWidth+1),'panel overflow '+name);};
const open=async()=>{await page.getByRole('button',{name:'工程评测',exact:true}).click();await expect(panel().getByRole('button',{name:'刷新',exact:true})).toBeEnabled();};
const open=async()=>{await openWorkbenchTool(page, '工程评测');await expect(panel().getByRole('button',{name:'刷新',exact:true})).toBeEnabled();};
const confirm=async(name,button)=>{await panel().getByRole('button',{name,exact:true}).click();await page.getByRole('dialog',{name:'确认评测操作',exact:true}).getByRole('button',{name:button,exact:true}).click();};
const refresh=async()=>{await panel().getByRole('button',{name:'刷新',exact:true}).click();};
const latest=()=>[...f.store.core.evaluation.values()].at(-1);
const parent=async()=>{await page.getByRole('button',{name:'隔离协作',exact:true}).click();await page.getByLabel('隔离协作控制台',{exact:true}).getByRole('button',{name:'返回父目标',exact:true}).click();await expect.poll(()=>page.evaluate(()=>localStorage.getItem('awb-session'))).toBe(f.session.id);await open();};
const parent=async()=>{await openWorkbenchTool(page, '隔离协作');await page.getByLabel('隔离协作控制台',{exact:true}).getByRole('button',{name:'返回父目标',exact:true}).click();await expect.poll(()=>page.evaluate(()=>localStorage.getItem('awb-session'))).toBe(f.session.id);await open();};
async function fill(title){await panel().getByLabel('评测名称',{exact:true}).fill(title);await panel().getByLabel('评测来源',{exact:true}).selectOption('local-fixture');await panel().getByLabel('样本名称',{exact:true}).fill('正负数和整数加法边界');await panel().getByLabel('具体需求',{exact:true}).fill('修复加法运算,保留原测试及已有调用方式');await panel().getByLabel('验收条件',{exact:true}).fill('原3项加法测试与构建通过,原测试文件和运行声明保持不变');await panel().getByLabel('允许修改的源码文件',{exact:true}).fill('src/add.mjs');}
async function apply(prepared=false){if(await page.getByRole('button',{name:'查看改动',exact:true}).isVisible())await page.getByRole('button',{name:'查看改动',exact:true}).click();else await page.locator('.inspector-tabs').getByRole('button',{name:/^改动/}).click();await page.getByRole('button',{name:prepared?'审查变更集':'组合审查',exact:true}).click();if(!prepared)await page.getByRole('dialog',{name:'选择要一起审查的提案',exact:true}).getByRole('button',{name:'封存审查范围',exact:true}).click();const dialog=page.getByRole('dialog',{name:'多文件变更集审查',exact:true});await dialog.getByRole('button',{name:'确认应用全部 1 项',exact:true}).click();await expect(dialog).toContainText('全部应用完成',{timeout:20000});await page.keyboard.press('Escape');}
let result;
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -35,7 +36,7 @@ const mark = value => { assertions.push(value); console.log('PASS ' + value); };
try {
await page.addInitScript(({ projectId, sessionId }) => { localStorage.setItem('awb-project', projectId); localStorage.setItem('awb-session', sessionId); }, { projectId: f.project.id, sessionId: f.session.id });
await page.goto(host.url); await page.waitForLoadState('networkidle');
await page.getByRole('button', { name: '项目MCP工具', exact: true }).click();
await openWorkbenchTool(page, '项目MCP工具');
const dialog = page.getByRole('dialog', { name: '项目 MCP 工具', exact: true }), history = dialog.getByLabel('MCP运行记录', { exact: true });
const row = history.locator('.mcp-history-row.state-unknown'); await expect(row).toHaveCount(1);
await row.getByRole('button', { name: '查看原始输入', exact: true }).click();
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -22,7 +23,7 @@ const mark = value => { assertions.push(value); console.log('PASS ' + value); };
try {
await page.addInitScript(({ projectId, sessionId }) => { localStorage.setItem('awb-project', projectId); localStorage.setItem('awb-session', sessionId); }, { projectId: f.project.id, sessionId: f.session.id });
await page.goto(host.url); await page.waitForLoadState('networkidle');
await page.getByRole('button', { name: '项目MCP工具', exact: true }).click();
await openWorkbenchTool(page, '项目MCP工具');
const dialog = page.getByRole('dialog', { name: '项目 MCP 工具', exact: true }); await expect(dialog).toBeVisible();
const form = dialog.locator('.mcp-register');
await form.getByLabel('显示名称', { exact: true }).fill('只读与工程工具');
@@ -91,7 +92,7 @@ try {
mark('TaskPanel exposes Task/Run source, original report, and human acknowledgement without marking unknown as success');
await page.setViewportSize({ width: 390, height: 844 });
await page.getByRole('button', { name: '项目MCP工具', exact: true }).click();
await openWorkbenchTool(page, '项目MCP工具');
const mobileDialog = page.getByRole('dialog', { name: '项目 MCP 工具', exact: true }); await expect(mobileDialog).toBeVisible();
await expect(mobileDialog.locator('.mcp-registration')).toHaveCount(1);
assert.ok(await page.locator('body').evaluate(node => node.scrollWidth <= 390));
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
@@ -20,7 +21,7 @@ const disposers = [], t = { after: fn => disposers.push(fn) }, f = fixture(t), c
let host, controller, browser, application, page, window, result;
const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true });
const mark = name => { checks.push(name); console.log('PASS ' + name); };
async function open() { if (!await dialog().count()) await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); }
async function open() { if (!await dialog().count()) await openWorkbenchTool(page, '打开模型中心'); }
async function resize(width) {
if (window) { await window.evaluate((win, size) => win.setContentSize(size.width, size.height), { width, height: 1080 }); await until(() => page.evaluate(w => innerWidth === w, width)); }
else await page.setViewportSize({ width, height: 1080 });
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
@@ -45,7 +46,7 @@ async function shot(name) {
screenshots.push({ path: file, sha256: createHash('sha256').update(fs.readFileSync(file)).digest('hex') });
fs.writeFileSync(path.join(directory, name + '.txt'), await page.locator('body').innerText());
}
async function open() { if (!await dialog().count()) await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); }
async function open() { if (!await dialog().count()) await openWorkbenchTool(page, '打开模型中心'); }
async function add() { await open(); await dialog().getByRole('button', { name: '从上游添加模型', exact: true }).click(); await catalog().waitFor(); }
async function fetchModels() { await catalog().getByRole('button', { name: /获取上游模型|重新获取模型目录/ }).click(); await expect(catalog().getByLabel('上游模型列表', { exact: true })).toBeVisible(); }
try {
+1 -1
View File
@@ -24,7 +24,7 @@ page.on('requestfailed', request => requestFailures.push(request.url() + ': ' +
const mark = value => { marks.push(value); console.log('PASS ' + value); };
try {
await page.goto(host.url); await page.waitForLoadState('networkidle');
await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
await page.getByRole('button', { name: '选择与管理模型', exact: true }).click();
const dialog = page.getByRole('dialog', { name: '模型中心', exact: true }); await expect(dialog).toBeVisible();
await dialog.getByRole('button', { name: '手动填写(兼容)', exact: true }).click();
const editor = dialog.getByRole('form', { name: '编辑模型连接', exact: true });
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -36,7 +37,7 @@ const host = await launchWorkbench(t, f.data, {}, { appRoot, nodePath: fs.exists
member = await host.api('/model-center/connections', { ...member, apiKey: 'owned-ui-private-key' });
const mark = text => { checks.push(text); console.log('PASS ' + text); };
async function capture(name) { const file = path.join(directory, name + '.png'); await page.screenshot({ path: file }); screenshots.push({ path: file, sha256: createHash('sha256').update(fs.readFileSync(file)).digest('hex') }); }
async function openCenter() { await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); return page.getByRole('dialog', { name: '模型中心', exact: true }); }
async function openCenter() { await openWorkbenchTool(page, '打开模型中心'); return page.getByRole('dialog', { name: '模型中心', exact: true }); }
async function run(prompt) {
await page.getByLabel('任务内容').fill(prompt); await page.getByRole('button', { name: '发送任务', exact: true }).click();
let id; await until(async () => { id = (await host.api('/sessions')).find(value => value.title === prompt)?.id; return id && (await host.api('/sessions/' + id)).status === 'failed'; }, 15000);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -29,7 +30,7 @@ const host=await launchWorkbench(t,f.data,{}, {appRoot,nodePath});assert.notEqua
let browser,page,result;
const capture=async name=>{const file=path.join(directory,name+'.png');await page.screenshot({path:file});screenshots.push({path:file,sha256:createHash('sha256').update(fs.readFileSync(file)).digest('hex')});};
const mark=name=>{checks.push(name);console.log('PASS '+name);};
const openCenter=async()=>{await page.getByRole('button',{name:'打开模型中心',exact:true}).click();return page.getByRole('dialog',{name:'模型中心',exact:true});};
const openCenter=async()=>{await openWorkbenchTool(page, '打开模型中心');return page.getByRole('dialog',{name:'模型中心',exact:true});};
try{
browser=await chromium.launch({channel:'msedge',headless:true});page=await browser.newPage({viewport:{width:1440,height:1000}});
page.on('pageerror',e=>errors.push(e.message));await page.goto(host.url);await page.waitForLoadState('networkidle');
+6 -5
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -57,7 +58,7 @@ let mobile, relay, cookie = '', gateway;
try {
await page.addInitScript(({ projectId, sessionId }) => { localStorage.setItem('awb-project', projectId); localStorage.setItem('awb-session', sessionId); }, { projectId: f.project.id, sessionId: f.session.id });
await page.goto(host.url); await page.waitForLoadState('networkidle');
await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
await openWorkbenchTool(page, '打开模型中心');
const dialog = page.getByRole('dialog', { name: '模型中心', exact: true });
await dialog.getByRole('button', { name: '手动填写(兼容)', exact: true }).click();
const form = dialog.getByRole('form', { name: '编辑模型连接', exact: true });
@@ -69,7 +70,7 @@ try {
await form.getByLabel('请求模型名称', { exact: true }).fill('owned-responses'); await form.getByLabel('服务需要 API Key', { exact: true }).uncheck();
await shot(page, 'desktop-editor'); await page.setViewportSize({ width: 390, height: 844 }); await form.scrollIntoViewIfNeeded(); await shot(page, 'narrow-editor');
await form.getByRole('button', { name: '保存模型连接', exact: true }).click(); await expect(form).toHaveCount(0);
await page.reload(); await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
await page.reload(); await openWorkbenchTool(page, '打开模型中心');
const card = dialog.locator('.mc-connection').filter({ hasText: '验收 Responses' }); await expect(card).toContainText('Responses · 流式开启');
let center = await host.api('/model-center'), connection = center.connections.find(value => value.name === '验收 Responses');
assert.equal(connection.protocol, 'responses'); assert.equal(connection.streaming, true);
@@ -86,7 +87,7 @@ try {
mark('separate text, nonce tool and actual SSE probes bind only their requested capability and own attempts');
const text = await host.api('/model-center/connections', { name: '只支持文本', model: 'text-only', baseUrl: connection.baseUrl, requiresKey: false, capabilityDeclarations: { tools: 'unsupported' } });
const textId = text.connection?.id ?? (await host.api('/model-center')).connections.find(value => value.name === '只支持文本').id;
await page.reload(); await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
await page.reload(); await openWorkbenchTool(page, '打开模型中心');
await dialog.getByRole('button', { name: '模型池', exact: true }).click(); await dialog.getByRole('button', { name: '新建模型池', exact: true }).click();
const poolForm = dialog.getByRole('form', { name: '编辑模型池', exact: true }); await poolForm.getByLabel('模型池名称', { exact: true }).fill('按能力选择的验收池');
for (const name of ['验收 Responses', '只支持文本']) await poolForm.locator('.mc-member-choice').filter({ hasText: name }).locator('input[type=checkbox]').check();
@@ -100,7 +101,7 @@ try {
const completed = await getSession(); assert.equal(completed.events.filter(value => value.tool === 'list_files' && value.phase === 'completed').length, 1);
center = await host.api('/model-center'); const attempt = center.attempts.find(value => value.runId === completed.runId);
assert.equal(attempt.protocol, 'responses'); assert.ok(attempt.rejections.some(value => value.connectionId === textId && value.capability === 'tools')); assert.ok(requests.every(value => value.body.model !== 'text-only'));
await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); await dialog.getByRole('button', { name: '请求账本', exact: true }).click();
await openWorkbenchTool(page, '打开模型中心'); await dialog.getByRole('button', { name: '请求账本', exact: true }).click();
await expect(dialog.locator('.mc-route-rejections').first()).toContainText('只支持文本');
const downloadEvent = page.waitForEvent('download'); await dialog.getByRole('button', { name: '下载已保存的响应', exact: true }).first().click();
const download = await downloadEvent, saved = path.join(directory, 'original-stream.sse'); await download.saveAs(saved);
@@ -141,7 +142,7 @@ try {
await until(async () => (await getSession()).status === 'failed', 15000);
const broken = await getSession(), latest = (await host.api('/model-center')).attempts.find(value => value.runId === broken.runId);
assert.equal(latest.status, 'unknown'); assert.equal(latest.stream.terminal, false); assert.equal(requests.length, count + 2);
await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); await dialog.getByRole('button', { name: '请求账本', exact: true }).click();
await openWorkbenchTool(page, '打开模型中心'); await dialog.getByRole('button', { name: '请求账本', exact: true }).click();
await expect(dialog.locator('.mc-attempts article').first()).toContainText('结果待核对'); await expect(dialog.locator('.mc-attempts article').first()).toContainText('响应未完整'); await shot(page, 'desktop-incomplete');
await page.setViewportSize({ width: 390, height: 844 }); await shot(page, 'narrow-incomplete');
mark('truncated output keeps explicit unknown ledger, partial evidence and no automatic failover or incomplete tool execution');
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -101,7 +102,7 @@ try {
mark('actual pool request reaches only the selected endpoint; changing defaults preserves the sealed old Run and shows both identities');
await host.api('/model-center/select', { type: 'connection', id: selected.id });
await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
await openWorkbenchTool(page, '打开模型中心');
await expect(select()).toHaveValue('connection:' + selected.id); await close();
await expect(page.getByRole('button', { name: '切换当前模型' })).toContainText(selected.name);
await page.getByRole('button', { name: '切换当前模型' }).click(); await select().selectOption('demo'); await expect(select()).toHaveValue('demo');
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import http from 'node:http';
@@ -32,7 +33,7 @@ const capture = async name => {
screenshots.push({ path: file, sha256: createHash('sha256').update(fs.readFileSync(file)).digest('hex') });
};
const openWaits = async () => {
await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
await openWorkbenchTool(page, '打开模型中心');
await page.getByRole('button', { name: '等待时限', exact: true }).click();
await expect(page.getByRole('form', { name: '模型等待时限' })).toBeVisible();
};
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
@@ -33,7 +34,7 @@ page.on('pageerror', error => errors.push(error.message));
let result;
const mark = value => { checks.push(value); console.log('PASS ' + value); };
const capture = async name => { const file = path.join(root, name + '.png'); await page.screenshot({ path: file, fullPage: true }); screenshots.push(file); };
const open = async () => { await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); const dialog = page.getByRole('dialog', { name: '模型中心', exact: true }); await expect(dialog).toBeVisible(); return dialog; };
const open = async () => { await openWorkbenchTool(page, '打开模型中心'); const dialog = page.getByRole('dialog', { name: '模型中心', exact: true }); await expect(dialog).toBeVisible(); return dialog; };
const tab = dialog => dialog.getByRole('navigation', { name: '模型中心分类' }).getByRole('button', { name: '连接诊断', exact: true });
const panel = () => page.getByRole('region', { name: '模型连接诊断', exact: true });
const start = async () => { await panel().getByRole('button', { name: '开始直连检查', exact: true }).click(); };
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -35,7 +36,7 @@ try {
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));
const file = path.join(root, 'permission-' + width + '.png'); await page.screenshot({ path: file, fullPage: true }); screenshots.push(file);
}
await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
await openWorkbenchTool(page, '打开模型中心');
const dialog = page.getByRole('dialog', { name: '模型中心', exact: true }); await dialog.getByRole('button', { name: '运行预算', exact: true }).click();
await expect(dialog.getByLabel('额度策略', { exact: true })).toHaveValue('unrestricted');
await expect(dialog.getByLabel('输出上限', { exact: true })).toHaveCount(0);
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -33,7 +34,7 @@ const seal=()=>panel().getByRole('button',{name:'封存分工计划',exact:true}
const mark=value=>{cases.push(value);console.log('PASS '+value);};
async function screenshot(name){const file=path.join(directory,name+'.png');await page.screenshot({path:file,scale:'css'});screenshots.push({file,sha256:hash(fs.readFileSync(file))});}
async function workers(){const close=page.getByRole('button',{name:'关闭检视区',exact:true});if(page.viewportSize().width<=940&&await close.isVisible())await close.click();
await page.getByRole('button',{name:'隔离协作',exact:true}).click();await expect(panel()).toBeVisible();}
await openWorkbenchTool(page, '隔离协作');await expect(panel()).toBeVisible();}
async function detect(){await control().getByRole('button',{name:'检测 Purge 来源',exact:true}).click();await expect(control()).toContainText('已核对 Purge 1.1.78');}
let report;
try{
@@ -71,7 +72,7 @@ try{
// closing it, so a late navigation result cannot reopen it over the toolbar.
await expect(panel()).toBeHidden();
const close=page.getByRole('button',{name:'关闭检视区',exact:true});await expect(close).toBeVisible();await close.click();await expect(page.locator('aside.inspector')).toBeHidden();
await page.getByRole('button',{name:'本地代理引擎',exact:true}).click();const runs=page.getByLabel('受控引擎工程运行',{exact:true});
await openWorkbenchTool(page, '本地代理引擎');const runs=page.getByLabel('受控引擎工程运行',{exact:true});
await expect(runs).toContainText('Purge 原版受限模式 · 1.1.78');await runs.getByText('查看本次实验策略',{exact:true}).click();await expect(runs).toContainText(strategy.runtime.sha256);
const pending=page.waitForEvent('download');await runs.getByRole('button',{name:'下载完整报告',exact:true}).click();const download=await pending,file=path.join(directory,'original-engine-report.json');await download.saveAs(file);
assert.equal(fs.readFileSync(file,'utf8'),originalEngineRun(f.store,session,job));assert.equal(hash(fs.readFileSync(file)),job.reportSha256);
+45
View File
@@ -0,0 +1,45 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { _electron } from 'playwright';
import { fixture, launchWorkbench } from '../tests/helpers.mjs';
import { projectEnvironment } from '../src/core/process-environment.mjs';
import { openWorkbenchTool } from './ui-navigation.mjs';
const disposers = [], t = { after: dispose => disposers.push(dispose) };
const f = fixture(t, { modernDefaults: true }); f.store.close();
const host = await launchWorkbench(t, f.data);
assert.notEqual(new URL(host.url).port, '4318');
const output = path.resolve('output/playwright/orven'); fs.mkdirSync(output, { recursive: true });
let app;
try {
app = await _electron.launch({ executablePath: path.resolve('node_modules/electron/dist/electron.exe'),
args: [path.resolve('dist-desktop/main.cjs'), '--app-root', process.cwd(), '--data-root', f.data, '--node', process.execPath, '--port', new URL(host.url).port, '--hidden-window'],
env: projectEnvironment(), cwd: process.cwd(), timeout: 60000 });
const page = await app.firstWindow(), errors = [];
page.on('pageerror', error => errors.push(error.message));
await page.locator('.connection.connected').waitFor({ timeout: 30000 });
assert.equal(await app.evaluate(({ app }) => app.getName()), 'Orven');
assert.equal(await page.title(), 'Orven · AI 开发工作台');
const native = await app.browserWindow(page);
assert.equal(await native.evaluate(window => window.getTitle()), 'Orven · AI 开发工作台');
// A never-shown native window does not produce compositor frames on Windows.
// Show without taking focus for capture, then close this owned fixture below.
await native.evaluate(window => window.showInactive());
await page.screenshot({ path: path.join(output, 'native-desktop.png'), timeout: 10000 });
await openWorkbenchTool(page, '桌面宿主');
await page.getByRole('dialog', { name: '桌面与后台任务' }).waitFor();
await page.getByText('执行宿主正在运行', { exact: true }).waitFor();
await page.locator('.desktop-host-facts').waitFor();
await page.screenshot({ path: path.join(output, 'native-host.png') });
assert.deepEqual(errors, []);
const result = { appName: 'Orven', nativeTitle: 'Orven · AI 开发工作台', isolatedHost: true, productionTouched: false, realModelCalls: 0, errors };
fs.writeFileSync(path.join(output, 'desktop-result.json'), JSON.stringify(result, null, 2));
console.log('PASS actual Electron window: Orven application/title, rendered workspace and native host navigation');
} catch (error) {
fs.writeFileSync(path.join(output, 'desktop-failure.json'), JSON.stringify({ error: error.message, isolatedHost: true }, null, 2));
throw error;
} finally {
if (app) await app.close();
for (const dispose of disposers.reverse()) await dispose();
}
+196
View File
@@ -0,0 +1,196 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { chromium, expect } from 'playwright/test';
import { fixture, compatibleFixture, completion, call, launchWorkbench } from '../tests/helpers.mjs';
// Real browser + real isolated host + local protocol fixture. No real model or user project.
const output = path.resolve('output/playwright/orven');
fs.mkdirSync(output, { recursive: true });
const disposers = [], t = { after: dispose => disposers.push(dispose) };
const f = fixture(t, { modernDefaults: true });
fs.writeFileSync(path.join(f.projectRoot, 'README.md'), '# Orven UI fixture\n\n用于独立界面验证的项目。\n');
let modelCalls = 0;
const model = await compatibleFixture(t, (url, input) => {
assert.equal(url, '/v1/chat/completions');
assert.equal(input.model, 'orven-ui-fixture');
modelCalls++;
if (modelCalls === 1) return completion([call('orven-read', 'read_file', { path: 'README.md' })]);
if (modelCalls === 2) return completion([call('orven-write', 'propose_file', { path: 'ORVEN-NOTES.md', content: '# Orven 验证\n\n已读取项目,完成本机受控接口验证。\n', reason: '只用于本次独立 UI 验证' })]);
return completion([], '已读取 README.md,并写入 ORVEN-NOTES.md。本次使用本机协议夹具,没有调用真实模型。');
});
f.store.close();
const host = await launchWorkbench(t, f.data);
assert.notEqual(new URL(host.url).port, '4318');
const browser = await chromium.launch({ channel: 'msedge', headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 960 }, deviceScaleFactor: 1 });
page.setDefaultTimeout(12000);
const errors = [], checks = [];
page.on('pageerror', error => errors.push(error.message));
const mark = value => { checks.push(value); console.log('PASS ' + value); };
const shot = async name => page.screenshot({ path: path.join(output, name + '.png'), fullPage: true });
const tool = async name => {
await page.keyboard.press('Escape');
await page.getByRole('button', { name: '打开工具箱', exact: true }).click();
const dialog = page.getByRole('dialog', { name: '工具箱', exact: true });
await dialog.getByLabel('搜索工作台工具').fill(name);
await dialog.getByRole('button', { name, exact: true }).click();
};
const bounds = async () => {
const value = await page.evaluate(() => {
const footer = document.querySelector('.composer-wrap').getBoundingClientRect();
return { width: innerWidth, height: innerHeight, scrollWidth: document.documentElement.scrollWidth, scrollHeight: document.documentElement.scrollHeight, footer: footer.bottom };
});
assert.ok(value.scrollWidth <= value.width + 1 && value.scrollHeight <= value.height + 1, JSON.stringify(value));
assert.ok(value.footer <= value.height + 1, JSON.stringify(value));
};
try {
await page.goto(host.url);
await page.locator('.connection.connected').waitFor();
await expect(page).toHaveTitle('Orven · AI 开发工作台');
await expect(page.getByRole('heading', { name: '今天,想实现什么?' })).toBeVisible();
await expect(page.locator('.inspector')).not.toBeVisible();
await bounds(); await shot('desktop');
mark('Orven identity, actual project context and focused new-task surface');
const before = (await host.api('/bootstrap')).sessions.length;
await page.locator('.starter-prompts button').filter({ hasText: '读懂项目' }).click();
const draft = await page.getByLabel('任务内容').inputValue();
assert.match(draft, /了解这个项目/);
assert.equal((await host.api('/bootstrap')).sessions.length, before);
await page.getByRole('button', { name: '发送任务', exact: true }).click();
const center = page.getByRole('dialog', { name: '模型中心', exact: true });
await expect(center).toBeVisible(); assert.equal(modelCalls, 0);
await page.keyboard.press('Escape');
await expect(page.getByLabel('任务内容')).toHaveValue(draft);
mark('starter prompts do not execute; missing model preserves input and opens connection setup');
await page.keyboard.press('Control+k');
await expect(page.getByLabel('搜索工作台工具')).toBeFocused();
await page.getByLabel('搜索工作台工具').fill('a-tool-that-does-not-exist');
await expect(page.locator('.tools-empty')).toContainText('没有找到');
await page.getByRole('button', { name: '清除搜索' }).click();
await page.getByLabel('搜索工作台工具').fill('项目文件');
await page.getByLabel('搜索工作台工具').press('ArrowDown');
await expect(page.getByRole('button', { name: '项目文件', exact: true })).toBeFocused();
await page.keyboard.press('Enter');
await expect(page.getByRole('tab', { name: /^文件/ })).toHaveAttribute('aria-selected', 'true');
await expect(page.getByLabel('筛选文件')).toBeFocused();
await page.getByLabel('筛选文件').fill('missing-orven-file');
await expect(page.locator('.sidebar-hint')).toContainText('没有匹配');
await page.getByLabel('筛选文件').fill('README');
await page.locator('.tree-row[title="README.md"]').click();
await expect(page.locator('.code-view')).toContainText('Orven UI fixture');
await page.getByRole('button', { name: '关闭检视区', exact: true }).click();
await expect(page.getByLabel('任务内容')).toHaveValue(draft);
mark('tool search, no-result recovery, keyboard selection and real file preview preserve the draft');
await page.getByRole('button', { name: '切换当前模型', exact: true }).click();
await center.getByRole('button', { name: '手动填写(兼容)', exact: true }).click();
const editor = center.getByRole('form', { name: '编辑模型连接' });
await editor.getByLabel('连接名称', { exact: true }).fill('Orven 本机验证');
await editor.getByLabel('接口根地址', { exact: true }).fill(model.baseUrl);
await editor.getByLabel('请求模型名称', { exact: true }).fill('orven-ui-fixture');
await editor.getByLabel('服务需要 API Key', { exact: true }).uncheck();
await editor.getByRole('button', { name: '保存模型连接', exact: true }).click();
const connection = center.locator('.mc-connection').filter({ hasText: 'Orven 本机验证' });
await connection.getByRole('button', { name: '用于新任务', exact: true }).click();
await expect(center.locator('.mc-current')).toContainText('Orven 本机验证');
await center.getByRole('button', { name: '请求账本', exact: true }).click();
await expect(center.getByLabel('默认模型选择')).not.toBeVisible();
await center.getByRole('button', { name: '模型连接', exact: true }).click();
await shot('models'); await page.keyboard.press('Escape');
await page.reload(); await page.locator('.connection.connected').waitFor();
await expect(page.getByRole('button', { name: '切换当前模型', exact: true })).toContainText('Orven 本机验证');
assert.equal(modelCalls, 0);
mark('model creation and selection persist across refresh; setup emits no model requests');
await page.getByLabel('任务内容').fill('只读取 README.md,并写一个 ORVEN-NOTES.md 说明。无需检查,无需 Git。');
await page.getByRole('button', { name: '发送任务', exact: true }).click();
await expect(page.locator('.message-assistant')).toContainText('本机协议夹具', { timeout: 20000 });
assert.equal(modelCalls, 3);
assert.match(fs.readFileSync(path.join(f.projectRoot, 'ORVEN-NOTES.md'), 'utf8'), /已读取项目/);
await expect(page.locator('.composer textarea')).toBeEmpty();
await tool('查看改动');
await expect(page.locator('.diff-view')).toContainText('已读取项目');
await shot('task-results');
await page.getByRole('button', { name: '关闭检视区', exact: true }).click();
await page.reload(); await page.locator('.connection.connected').waitFor();
await expect(page.locator('.message-assistant')).toContainText('本机协议夹具');
mark('real three-request local protocol flow reads and writes the owned project; diff and conversation survive refresh');
await page.getByLabel('操作权限').selectOption('auto');
await expect.poll(async () => (await host.api('/bootstrap')).config.approvalMode).toBe('auto');
await page.reload(); await page.locator('.connection.connected').waitFor();
await expect(page.getByLabel('操作权限')).toHaveValue('auto');
mark('permission choice is saved and restored rather than shown as a cosmetic selection');
await page.keyboard.press('Control+p');
await page.getByLabel('筛选文件').fill('README');
await page.locator('.tree-row[title="README.md"]').click();
await expect(page.locator('.code-view')).toContainText('Orven UI fixture');
await page.getByRole('button', { name: '编辑文件', exact: true }).click();
const original = await page.getByLabel('编辑文件内容').inputValue();
await page.getByLabel('编辑文件内容').fill(original + '\n本次编辑应保留到冲突处理。\n');
fs.writeFileSync(path.join(f.projectRoot, 'README.md'), original + '\n外部已更新。\n');
await page.getByRole('button', { name: '保存为提案', exact: true }).click();
await expect(page.locator('.toast')).toBeVisible();
assert.match(fs.readFileSync(path.join(f.projectRoot, 'README.md'), 'utf8'), /外部已更新/);
assert.ok(!fs.readFileSync(path.join(f.projectRoot, 'README.md'), 'utf8').includes('本次编辑应保留'));
await expect(page.getByLabel('编辑文件内容')).toHaveValue(original + '\n本次编辑应保留到冲突处理。\n');
await shot('file-conflict');
mark('external file conflict preserves external bytes and unsaved editor input, with a visible recovery message');
await page.getByRole('button', { name: '取消编辑', exact: true }).click();
await page.locator('.tree-row[title="README.md"]').click();
await expect(page.locator('.code-view')).toContainText('外部已更新');
const toastClose = page.getByRole('button', { name: '关闭提示', exact: true });
if (await toastClose.isVisible()) await toastClose.click();
await page.getByRole('button', { name: '关闭检视区', exact: true }).click();
for (const width of [1280, 1024, 768, 390]) {
await page.setViewportSize({ width, height: width === 390 ? 844 : 800 });
await bounds();
}
await page.getByRole('button', { name: '展开项目栏', exact: true }).click();
await page.getByRole('tab', { name: /^会话/ }).click();
await expect(page.locator('.session-list')).toContainText('只读取');
await page.getByRole('button', { name: '关闭侧边面板', exact: true }).click({ position: { x: 380, y: 350 } });
await page.getByRole('button', { name: '文件与成果', exact: true }).click();
await expect(page.getByRole('button', { name: '关闭检视区', exact: true })).toBeVisible();
await shot('mobile-results');
await page.keyboard.press('Escape');
await expect(page.getByRole('button', { name: '发送任务', exact: true })).toBeVisible();
await shot('mobile-conversation');
mark('1280/1024/768/390 layouts keep the document contained; mobile navigation and result drawer work');
await page.setViewportSize({ width: 1440, height: 960 });
await tool('项目技能');
await expect(page.getByRole('dialog', { name: '项目技能', exact: true })).toBeVisible();
await shot('skills'); await page.keyboard.press('Escape');
await tool('项目 MCP 工具');
await expect(page.getByRole('dialog', { name: '项目 MCP 工具', exact: true })).toBeVisible();
await shot('mcp'); await page.keyboard.press('Escape');
await tool('运行诊断');
await expect(page.getByRole('dialog', { name: '运行诊断', exact: true })).toBeVisible();
await page.locator('.diagnostic-panel').waitFor();
await shot('diagnostics'); await page.keyboard.press('Escape');
mark('skills, MCP and diagnostics remain connected through the new tool navigation');
await page.goto(host.url + '/brand.html');
await expect(page.getByRole('heading', { level: 1 })).toContainText('运行中的作品');
await page.getByRole('button', { name: '查看深色背景', exact: true }).click();
await expect(page.locator('#specimen')).toHaveAttribute('data-dark', 'true');
await page.getByRole('button', { name: '查看品牌色背景', exact: true }).click();
await shot('brand');
for (const asset of ['/brand/orven-symbol.svg', '/brand/orven-wordmark.svg', '/workbench-icon.png', '/workbench-icon.ico']) assert.equal((await fetch(host.url + asset)).status, 200);
assert.deepEqual(errors, []);
mark('brand page, interactive mark backgrounds and downloadable SVG/PNG/ICO assets render without browser errors');
fs.writeFileSync(path.join(output, 'result.json'), JSON.stringify({ checks, errors, modelCalls, realModelCalls: 0, fixtureOnly: true, userDataAccessed: false }, null, 2));
} catch (error) {
await shot('failure').catch(() => {});
fs.writeFileSync(path.join(output, 'failure.json'), JSON.stringify({ checks, errors, modelCalls, message: error.message }, null, 2));
throw error;
} finally {
await browser.close();
for (const dispose of disposers.reverse()) await dispose();
}
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -42,7 +43,7 @@ const seal = () => panel().getByRole('button', { name: '封存分工计划', exa
const mark = text => { assertions.push(text); console.log('PASS ' + text); };
async function screenshot(name) { const file = path.join(directory, name + '.png'); await page.screenshot({ path: file, scale: 'css' }); screenshots.push({ file, sha256: hash(fs.readFileSync(file)) }); }
async function closeInspector() { const close = page.getByRole('button', { name: '关闭检视区', exact: true }); if (page.viewportSize().width <= 940 && await close.isVisible()) { await close.click(); await expect(page.locator('.inspector')).toBeHidden(); } }
async function workers() { await closeInspector(); await page.getByRole('button', { name: '隔离协作', exact: true }).click(); await expect(panel()).toBeVisible(); }
async function workers() { await closeInspector(); await openWorkbenchTool(page, '隔离协作'); await expect(panel()).toBeVisible(); }
async function source(root, version) { await experiment().getByLabel('Purge 源码目录', { exact: true }).fill(root); await experiment().getByRole('button', { name: '检测 Purge 来源', exact: true }).click(); await expect(experiment()).toContainText('已核对 Purge ' + version); }
let result, releaseLate;
try {
@@ -89,7 +90,7 @@ try {
assert.equal(job.native.readiness.promptExperimentSha256, bound.sha256); assert.deepEqual(ownerBytes(f), original);
mark('actual Harness applies the exact non-interpolated prompt once in every owned model request and closes its complete process tree');
await panel().getByRole('button', { name: '审查子任务改动', exact: true }).click(); await expect.poll(() => page.evaluate(() => localStorage.getItem('awb-session'))).toBe(session.id);
await closeInspector(); await page.getByRole('button', { name: '本地代理引擎', exact: true }).click(); const runs = page.getByLabel('受控引擎工程运行', { exact: true });
await closeInspector(); await openWorkbenchTool(page, '本地代理引擎'); const runs = page.getByLabel('受控引擎工程运行', { exact: true });
await expect(runs).toContainText('Purge 提示实验 · 1.1.81'); await runs.getByText('查看本次实验策略', { exact: true }).click(); await expect(runs).toContainText(bound.sha256); await expect(runs).toContainText(bound.prompt);
const downloadPromise = page.waitForEvent('download'); await runs.getByRole('button', { name: '下载完整报告', exact: true }).click(); const download = await downloadPromise;
const reportPath = path.join(directory, 'original-engine-report.json'); await download.saveAs(reportPath);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
@@ -50,7 +51,7 @@ async function shot(name) {
fs.writeFileSync(path.join(directory, name + '.txt'), await page.locator('body').innerText());
}
async function edit(name) {
if (!await dialog().count()) await page.getByRole('button', { name: '打开模型中心', exact: true }).click();
if (!await dialog().count()) await openWorkbenchTool(page, '打开模型中心');
await dialog().locator('.mc-connection').filter({ has: page.getByRole('heading', { name, exact: true }) }).getByRole('button', { name: '推理与能力', exact: true }).click();
await form().waitFor();
}
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import { releaseEvidencePrefix } from './qa-evidence.mjs';
import assert from 'node:assert/strict';
import fs from 'node:fs';
@@ -35,7 +36,7 @@ async function screenshot(name) { const filename = '.qa/screenshots/' + proofPre
async function openProject(projectId = project.id, title = original.title) {
await page.goto(host.url); await page.waitForLoadState('networkidle');
await page.getByLabel('当前项目').selectOption(projectId); await page.locator('.session-list button').filter({ hasText: title }).click();
await page.getByRole('button', { name: 'REA 工件研究', exact: true }).click(); await expect(panel()).toBeVisible();
await openWorkbenchTool(page, 'REA 工件研究'); await expect(panel()).toBeVisible();
}
async function register(filename, label) {
const before = (await state()).execution.researchTargets.length;
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -24,7 +25,7 @@ try {
await page.addInitScript(({ projectId, sessionId }) => { localStorage.setItem('awb-project', projectId); localStorage.setItem('awb-session', sessionId); },
{ projectId: f.project.id, sessionId: f.session.id });
await page.goto(host.url); await page.waitForLoadState('networkidle');
await page.getByRole('button', { name: '项目技能', exact: true }).click();
await openWorkbenchTool(page, '项目技能');
const dialog = page.getByRole('dialog', { name: '项目技能', exact: true }); await expect(dialog).toBeVisible();
const editor = dialog.locator('.skill-register');
await editor.getByLabel('技能名称', { exact: true }).fill('工程交付核验');
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
@@ -155,7 +156,7 @@ try {
await page.reload({ waitUntil: 'domcontentloaded' });
await expect(page.locator('.work-title h1')).toHaveText(second.title);
const downloadPromise = page.waitForEvent('download');
await page.getByRole('button', { name: '导出会话', exact: true }).click();
await openWorkbenchTool(page, '导出会话');
const download = await downloadPromise; await download.saveAs(path.join(caseRoot, 'session-export.json'));
assert.equal(JSON.parse(fs.readFileSync(path.join(caseRoot, 'session-export.json'), 'utf8')).session.id, second.id);
mark('denial, session selection, reload, stale response rejection and export');
@@ -200,7 +201,7 @@ try {
stage = 'research'; await page.setViewportSize({ width: 1440, height: 960 });
if (!(await page.locator('.project-sidebar').isVisible())) await page.getByRole('button', { name: '展开项目栏', exact: true }).click();
await page.getByRole('button', { name: '机制研究与设计', exact: true }).click();
await openWorkbenchTool(page, '机制研究与设计');
const research = page.getByRole('dialog', { name: '机制研究与独立设计' });
await expect(research.locator('.research-content')).toContainText('统一机制报告');
assert.ok(await research.locator('table').count() >= 2);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
@@ -23,7 +24,7 @@ const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: tru
const editor = () => dialog().getByRole('form', { name: '编辑模型连接', exact: true });
const card = () => dialog().locator('[data-connection-id="legacy-default"]');
const mark = message => { marks.push(message); console.log('PASS ' + message); };
async function open() { await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); await expect(dialog()).toBeVisible(); }
async function open() { await openWorkbenchTool(page, '打开模型中心'); await expect(dialog()).toBeVisible(); }
async function shot(name) { const file = path.join(directory, name + '.png'); await page.screenshot({ path: file, fullPage: true }); screenshots.push(file); }
async function resize(width) {
if (window) { await window.evaluate((win, size) => win.setContentSize(size.width, size.height), { width, height: 1080 }); await until(() => page.evaluate(w => innerWidth === w, width)); }
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import net from 'node:net';
@@ -22,7 +23,7 @@ const disposers = [], t = { after: fn => disposers.push(fn) }, f = fixture(t, {
let host, controller, browser, application, page, window, result, ownedFailure = false, browserUrl, browserTurn = 0, ownedTabId;
const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true });
const mark = name => { checks.push(name); console.log('PASS ' + name); };
async function open() { if (!await dialog().count()) await page.getByRole('button', { name: '打开模型中心', exact: true }).click(); }
async function open() { if (!await dialog().count()) await openWorkbenchTool(page, '打开模型中心'); }
async function resize(width) {
if (window) { await window.evaluate((win, size) => win.setContentSize(size.width, size.height), { width, height: 1080 }); await until(() => page.evaluate(w => innerWidth === w, width)); }
else await page.setViewportSize({ width, height: 1080 });
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
@@ -25,7 +26,7 @@ page.on('pageerror', error => pageErrors.push(error.message)); page.on('requestf
const panel = () => page.getByLabel('隔离协作控制台', { exact: true }), groupState = id => f.store.core.collaboration.get(id);
const mark = text => { assertions.push(text); console.log('PASS ' + text); };
async function screenshot(name) { const file = path.join(directory, name + '.png'); await page.screenshot({ path: file, scale: 'css' }); screenshots.push({ file, sha256: hash(fs.readFileSync(file)) }); }
async function openWorkers() { await page.getByRole('button', { name: '隔离协作', exact: true }).click(); await expect(panel()).toBeVisible(); await expect(panel().getByRole('button', { name: '刷新', exact: true })).toBeEnabled(); }
async function openWorkers() { await openWorkbenchTool(page, '隔离协作'); await expect(panel()).toBeVisible(); await expect(panel().getByRole('button', { name: '刷新', exact: true })).toBeEnabled(); }
async function parentFromChild() { await openWorkers(); await panel().getByRole('button', { name: '返回父目标', exact: true }).click(); await expect.poll(() => page.evaluate(() => localStorage.getItem('awb-session'))).toBe(f.session.id); await openWorkers(); }
async function confirmStart() { await panel().getByRole('button', { name: /开始两个子任务|继续未完成子任务/ }).click(); await page.getByRole('dialog', { name: '确认受限子执行', exact: true }).getByRole('button', { name: '确认开始', exact: true }).click(); }
async function applyUi(count, prepared = false) {