diff --git a/.gitignore b/.gitignore index 4c569a99..87d54cc4 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ !/docs/original-purge-release-f-evidence/**/*.log *.tmp /.qa/ +/output/playwright/ /releases/ /.secrets/ .env diff --git a/DESIGN.md b/DESIGN.md index 3b6d7b98..d3bad649 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -1,4 +1,20 @@ -# Agent Workbench 界面方向 +# Orven 界面方向 + +## 当前产品改版 + +正式品牌 **Orven(奥文)**,定位 **AI 开发工作台**,主张 **从想法,到运行。** 品牌文案及标识见[品牌定稿](docs/orven/BRAND.md),执行与验证见[本次记录](docs/orven/progress.md)。以下历史设计仅保留来源,不代表新版视觉。 + +主任务是带着项目提出目标,核对执行和文件成果,再继续推进。新版默认展示连续对话工作区;侧栏在会话/文件之间切换,源码、差异、轨迹和任务成果在按需打开的检视区并列核对。可搜索工具箱按工作空间、能力与研究、设置与连接分组。Ctrl K 打开工具箱,Ctrl P 查找文件,Ctrl Enter 发送,Esc 返回。 + +比较三种结构:指标总览偏离实际开发;全屏聊天难以核对文件;选择按需展开成果区的对话工作空间。首次任务展示真实项目与三个可编辑的起始提示,提示只填入输入框,不自动执行。未连接模型时提供直接入口。 + +视觉采用白色画布 #FFFFFF、冷灰导航 #F5F5F8、石墨正文 #37333F、次要文字 #716979、鸢尾操作 #6253B5、选中底色 #EFECF9,成功 #277859、错误 #AD3F48、确认采用低饱和琥珀。颜色表达操作与状态,正文保持清楚。按内容关系使用 6–12px 圆角和薄边框;工作区不加入营销图、指标或装饰性渐变。 + +字体为 Segoe UI Variable/Segoe UI 与 Microsoft YaHei UI,代码为 Cascadia Code/Consolas。对话 14px/1.9,导航 12px,说明 11px,元数据 10px;首页问候 28–34px,字标 26px。兼顾中文、英文模型名和长路径。 + +桌面侧栏 242px,成果区默认 430px 并可调整。940px 以下成果区成为抽屉,620px 以下导航也成为抽屉。输入始终在视口底部,内容内部滚动。长路径截断并可查看完整 title,代码保留横向滚动。控件保留可见焦点、弹窗焦点约束和减少动态效果支持。桌面、390px 及异常状态实际渲染验收。 + +## 历史设计记录 当前正式1.12.1已采用工程控制台方向,模型中心的布局、状态语义、颜色/字体和桌面/窄屏验收见[1.12设计与执行方案](docs/PLAN-1.12.md)。1.13隔离协作沿用白/浅蓝、深蓝文字、蓝色操作和细边框,新增固定父目标与两个真实执行通道;实施与验收见[1.13方案](docs/PLAN-1.13.md)。以下保留1.11纸白/海松界面的历史设计基线,不作为当前部署状态。 diff --git a/README.md b/README.md index aa5f6863..7f23a526 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# 本地 Agent 工作台 +# Orven · AI 开发工作台 + +**从想法,到运行。** 正式产品品牌为 **Orven(奥文,OR-ven)**。新版围绕项目任务、连续对话和按需展开的成果区重新组织 UI/UX,配套标识、产品文案与[品牌规范](docs/orven/BRAND.md)。本次源码与独立预览的验证情况见[Orven 改版记录](docs/orven/progress.md),正式安装状态仍以对应发行记录为准。 当前已安装版本为 **1.25.7**。[打开工作台](http://127.0.0.1:4318/?release=1.25.7)。模型连接统一在模型中心编辑,已移除旧设置窗口和离线演示入口;已有有效配置按实际型号或保存名显示。默认完整透传上下文与输出,逐型号只读显示上游最大容量;缺少目录数据时显示本地无限制。文件自动应用并保留Git基线与回滚,操作权限持久保存。源码发布与程序发布独立,不包含用户项目、会话和Key。见[打包说明](docs/PACKAGING.md)和[本次验证](docs/QA-UNIFIED-MODELS-1.25.7.md)。下方各版本数字为历史交付记录。 diff --git a/docs/orven/BRAND.md b/docs/orven/BRAND.md new file mode 100644 index 00000000..0ed9eff1 --- /dev/null +++ b/docs/orven/BRAND.md @@ -0,0 +1,61 @@ +# Orven 品牌定稿 + +正式产品名 **Orven**,中文 **奥文**,读作 **OR-ven**。品牌不附加 Agent、Workbench、Pro 等后缀。完整产品标题采用 **Orven · AI 开发工作台**;中文名称用于介绍和口头沟通,主界面使用 Orven。 + +## 品牌主张 + +**从想法,到运行。** + +Orven 理解你的项目,和你一起研究问题、编写代码,把想法变成可以运行的成果。 + +采用这个名字,是因为它自然、简短、可以独立使用,不绑定某一模型、某种工程或单一能力。品类说明解释产品用途,真实的开发体验逐渐赋予名字意义。 + +## 产品定位 + +面向在本机做开发、研究和工程维护的人。用户带来项目、问题与约束,Orven 将对话、工具执行、文件改动和检查结果组织在同一个工作空间。核心路径是“提出任务 → 理解和执行 → 查看改动与结果 → 接着推进”。 + +能力描述须和实际接入相符。模型能力、外部服务、检查覆盖和执行结果分别说明来源,不承诺所有任务一次完成或自动正确。 + +## 配套文案 + +| 场景 | 定稿 | +| --- | --- | +| 应用名称 | Orven | +| 产品品类 | AI 开发工作台 | +| 主 slogan | 从想法,到运行。 | +| 简短介绍 | 理解项目,研究问题,动手实现。 | +| 官网标题 | 让想法,成为运行中的作品。 | +| 官网说明 | 带上你的项目,与 Orven 一起理解代码、解决问题、完成实现。对话、改动与执行结果,始终连在一起。 | +| 官网主按钮 | 打开 Orven | +| 官网次按钮 | 了解工作方式 | +| 启动画面 | Orven / 从想法,到运行。 | +| 首次任务标题 | 今天,想实现什么? | +| 首次任务说明 | 一个新想法,一个待解决的问题。带上你的项目,我们一起把它做出来。 | +| 输入框 | 把想法交给 Orven,或描述你遇到的问题… | +| 项目为空 | 从你的项目开始 / 打开本机文件夹,让 Orven 理解项目上下文。 | +| 会话为空 | 留给下一个想法 / 新建任务后,对话和执行记录会保存在这里。 | +| 模型未连接 | 连接你的模型,让 Orven 开始协作 | +| 改动为空 | 这里展示待审查改动 / 有文件改动后,在这里核对差异与应用结果。 | +| 执行中 | 正在处理任务 | +| 请求失败 | 模型暂时没有响应 / 查看连接与原始错误后,可重试本次请求。 | +| 暂停后 | 任务已暂停 / 进展已保存,可以查看记录后继续。 | +| 完成后 | 说明实际改动、检查结果和仍待处理的问题;只有实际完成才使用“已完成”。 | +| 页脚短句 | 执行有记录,改动可回看 | + +语气像一个熟悉项目、愿意一起动手的伙伴。使用“打开、查看、连接、继续、审查”等具体动词。错误先说发生了什么,再给出恢复入口。中文自然,技术名词保留原名,避免“赋能、颠覆、全能、无限可能”等空泛承诺。 + +## 视觉标识 + +图形由开放环线和前向笔画构成:项目正在被理解与形成,工作继续向前。字标采用紧凑但可读的自然字形,应用图标采用单色鸢尾底和白色图形。 + +- `public/brand/orven-symbol.svg`:透明图形标。 +- `public/brand/orven-wordmark.svg`:横向图文标;使用 Segoe UI,跨平台交换前需确认字体或转曲。 +- `public/favicon.svg`、`public/mobile-icon.svg`:应用图标。 +- `public/workbench-icon.png`、`.ico`:桌面图标,沿用原资源路径保持启动器兼容。 +- `public/brand.html`:可直接打开的品牌展示页。 + +图形标建议最小 20px,favicon 支持 16px 缩略。周围留出至少图形宽度的四分之一。默认鸢尾图形与石墨字标,深色背景使用白色。不要拉伸、旋转或添加发光、渐变及多层阴影。 + +## 定稿范围 + +本次完成产品名称、文案与本地品牌资产定稿;商标、域名及应用商店名称可用性尚未核验。内部包名、数据目录、桌面应用身份及协议标识沿用,保持历史数据和升级兼容。 diff --git a/docs/orven/QA.md b/docs/orven/QA.md new file mode 100644 index 00000000..2d67f7ec --- /dev/null +++ b/docs/orven/QA.md @@ -0,0 +1,49 @@ +# Orven 改版验收 + +## 范围 + +正式产品品牌、配套文案、标识资源、主工作台信息结构、侧栏导航、工具发现、按需成果区、模型中心、扩展能力主题与手机伴随端身份。保留原 React/TypeScript/Vite 技术栈和业务 API,不迁移用户数据。 + +## 实际验证 + +| 检查 | 结果与范围 | +| --- | --- | +| TypeScript / 前端 / mobile shell / server / desktop bundle | 构建通过 | +| 新版浏览器主路径 | 10 组通过:真实独立服务、3 次本机协议请求、真实文件读取和写入、差异、刷新保持、权限保存、外部冲突、工具入口及品牌资产 | +| 模型中心原验收 | 6 组通过:连接/模型池/导入、历史工件分页与巡检、390px | +| Skills 原验收 | 4 组通过:登记与启用、源变化后审核新修订、390px、实际本机 HTTP 任务绑定修订与指纹 | +| MCP 原验收 | 6 组通过:登记、实际 stdio schema、变化后停用、中断保留 unknown、Task 归属、390px | +| 实际 Electron | 应用名、网页及原生标题、工作台渲染、工具箱与桌面宿主状态通过;自有窗口显示后截图并关闭 | +| 相关单元 | 25 个不同测试通过;首轮 2 项因 Node26 被拒,换仓库指定 Node24.22.1 后补验通过,未改断言 | +| 代表视口 | 1440×960、1280×800、1024×800、768×800、390×844;文档无意外横向/纵向溢出,输入区留在视口 | +| 文字对比样本 | 主入口、导航说明与工具箱实测 5.25:1–12.30:1;不是全应用可访问性认证 | +| 浏览器错误 | 新版主路径 pageerror 0 | + +核心脚本为 `scripts/verify-orven-ui.mjs`,运行 `npm run verify:orven`。实际桌面验证为 `scripts/verify-orven-desktop.mjs`。使用仓库 Node24;现有系统 Node26 不符合桌面宿主身份核验要求。最终文案调整后 TypeScript、Vite 与 mobile shell 重新构建通过,新版浏览器 10 组和实际 Electron 复验通过。 + +## 观测后修正 + +1. 旧主题深色侧栏上的文件名对比不足,且蓝色、绿色主题混用;改为浅灰连续导航、石墨正文和角色明确的鸢尾色。 +2. 快捷提示继承旧 430px 限制导致宽屏拥挤;取消限制并随主工作区宽度切换行列。 +3. 顶部扩展图标缺少文字;收拢到可搜索工具箱,并为当前不可用项说明原因。 +4. 默认成果区在无内容时挤占对话;改为按需展开,文件和差异可并排审查,窄屏用抽屉。 +5. 品牌页首次交互因原 CSP 禁止内联脚本失败;改为同源外部脚本,维持 CSP,再次验收通过。 +6. 外部文件修改后提交编辑,实际保留外部字节和草稿,给出冲突提示;未用假成功掩盖失败。 +7. 首次 Electron 隐藏窗口截图超时:Windows 中从未显示的窗口不产生合成帧。验证器改为临时 `showInactive()`,等待实际宿主状态后截图,最后关闭自有测试窗口;没有改变产品启动方式。 + +## 保存的结果 + +最终主路径结果见 [浏览器记录](evidence/browser-result.json) 与 [Electron 记录](evidence/desktop-result.json)。代表截图来自真实渲染: + +- [桌面主界面](screenshots/desktop.png) +- [任务执行与文件差异](screenshots/task-results.png) +- [390px 会话](screenshots/mobile-conversation.png) +- [品牌展示页](screenshots/brand.png) + +原始截图与本轮首次失败保留在本地 `output/playwright/orven/`;模型中心、Skills、MCP 的原验收结果分别位于 `.qa/model-center-ui-9e9b7eb9-20fa-4131-b480-686bbd4b75f8`、`.qa/skills-ui-d64f3b6c-e635-446f-8f2c-ad6af2f9c219`、`.qa/mcp-ui-4ea6051a-1754-41f4-a62c-084f6525867e`。部分历史驱动仅迁移可见工具入口,没有宣称其全部业务场景本轮均已执行。 + +## 边界 + +全部模型执行来自明确的本机测试接口;未用真实供应商验证新的模型能力。手机伴随端完成品牌和主题,主工作台窄屏已经实际验收;本轮未进行真实 iPhone 配对。安装器显示名更新仅在源码,未重制安装包或更改正式安装。名称的商标、域名和商店可用性尚未核验。 + +历史研究证据和其他对话正在进行的 AF/AG 工作不属于本次提交。4318 正式服务和真实凭据保持原状。独立设计预览在 4327,使用 `.qa/orven-design/data`。 diff --git a/docs/orven/evidence/browser-result.json b/docs/orven/evidence/browser-result.json new file mode 100644 index 00000000..5f6fbde5 --- /dev/null +++ b/docs/orven/evidence/browser-result.json @@ -0,0 +1,19 @@ +{ + "checks": [ + "Orven identity, actual project context and focused new-task surface", + "starter prompts do not execute; missing model preserves input and opens connection setup", + "tool search, no-result recovery, keyboard selection and real file preview preserve the draft", + "model creation and selection persist across refresh; setup emits no model requests", + "real three-request local protocol flow reads and writes the owned project; diff and conversation survive refresh", + "permission choice is saved and restored rather than shown as a cosmetic selection", + "external file conflict preserves external bytes and unsaved editor input, with a visible recovery message", + "1280/1024/768/390 layouts keep the document contained; mobile navigation and result drawer work", + "skills, MCP and diagnostics remain connected through the new tool navigation", + "brand page, interactive mark backgrounds and downloadable SVG/PNG/ICO assets render without browser errors" + ], + "errors": [], + "modelCalls": 3, + "realModelCalls": 0, + "fixtureOnly": true, + "userDataAccessed": false +} \ No newline at end of file diff --git a/docs/orven/evidence/desktop-result.json b/docs/orven/evidence/desktop-result.json new file mode 100644 index 00000000..31cc71d9 --- /dev/null +++ b/docs/orven/evidence/desktop-result.json @@ -0,0 +1,8 @@ +{ + "appName": "Orven", + "nativeTitle": "Orven · AI 开发工作台", + "isolatedHost": true, + "productionTouched": false, + "realModelCalls": 0, + "errors": [] +} \ No newline at end of file diff --git a/docs/orven/findings.md b/docs/orven/findings.md new file mode 100644 index 00000000..fe7861fe --- /dev/null +++ b/docs/orven/findings.md @@ -0,0 +1,11 @@ +# Orven 设计依据 + +真实产品对象是项目、任务、文件、改动和可核对的执行结果。主要用户在 Windows 上用中文开展开发与工程研究,桌面是主要设备,窄屏应能完成导航和审查。 + +现有公开源码与原 UI 文案显示:任务跨轮保存;支持模型连接/池、权限、文件差异、原始工具轨迹、检查与 Git、技能/MCP、隔离协作、工件研究、手机伴随端。此次不更换业务接口,不把尚未实测的模型能力包装成品牌承诺。 + +现有界面的关键问题:顶部重复暴露模型管理和工具;项目/会话/文件缺少清楚的阅读层级;新任务导语与产品名称脱节;扩展能力的图标缺少可见文字;模型未连接时缺少明确下一步。 + +设计参考以当前应用实际 DOM、源码与独立浏览器渲染为直接依据;未把外部产品页面或目录当成已访问体验。借用常规 IDE 的“保留项目上下文”和对话工具的“输入就近选择执行方式”原则,具体视觉及标识为本项目设计。 + +命名结论:采用 Orven,而非再制造功能缩写。独立自然的名字适合长期承载研究和执行能力;品类说明补足用途。商标、域名及应用商店名称可用性不在本地源码验证范围内。 diff --git a/docs/orven/progress.md b/docs/orven/progress.md new file mode 100644 index 00000000..e9159ea0 --- /dev/null +++ b/docs/orven/progress.md @@ -0,0 +1,25 @@ +# Orven 改版执行记录 + +- 已读取项目 AGENTS.md 与 product-ui-ux、frontend-design、ui-art-direction;采用 planning-with-files 保存本次独立计划,Playwright 沿用仓库已有依赖和 Edge 验证方式。 +- 已确认现有源码、技术栈、正式服务边界与已有非本次改动。 +- 已确定正式品牌与三种结构的选择理由;开始独立渲染检查及界面实现。 + +- 已实现 Orven 字标、SVG/PNG/ICO 图标、品牌展示页、主工作台及手机伴随端身份;侧栏会话/文件切换、按需成果区、可搜索工具箱及模型中心分类重组。 +- TypeScript、Vite、mobile shell 与 server/desktop bundle 构建通过。 +- 首次相关单元回归 25 项中 23 通过;2 项桌面启动测试明确要求 Node24,原命令实际用了系统 Node26.13.0。改用仓库配套 Node24.22.1 后两项均通过,未改产品或测试断言。 +- 新 UI 验证已经通过:提示不自动执行、无模型保留草稿、工具搜索/键盘、文件浏览、连接选择刷新保持、本机三请求读取与写入、差异及会话恢复、权限持久保存、外部冲突保留文件与输入、四视口、技能/MCP/诊断入口。 +- 第一次完整新 UI 验证在品牌页切换背景失败:实际 HTTP CSP 禁止内联脚本。已将处理器移到同源 public/brand/brand.js;不放宽 CSP,正在重验。 +- 原模型中心 UI 回归 6 组通过,包括真实保存、模型池、导入、巡检与历史工件分页、390px。 +- 主工作台和工具箱代表文字对比实测为 5.25:1–12.30:1(已检查样本),不以静态颜色表代替实际 DOM。 + +- 修复 CSP 后,新版完整浏览器验收 10 组全部通过;最后一轮仍为 3 次本机协议夹具请求、0 真实模型调用、0 用户数据访问、0 pageerror。 +- 新主题下原 Skills 验收 4 组通过(登记、版本变化与审核、390px、实际本机 HTTP 请求使用所选修订);原 MCP 验收 6 组通过(登记、真实 stdio schema、程序变化后停用、中断 unknown 不重放、Task 归属、390px)。模型中心原 6 组通过,合计本轮 26 组浏览器验收。 +- 原诊断、模型、协作等验收脚本的工具入口已切换为共享 ui-navigation 帮助函数,通过实际可见导航操作,原业务断言保留。没有宣称所有历史验收脚本本轮均已执行。 +- 执行详情改为可展开原记录,保持完整内容,减少原始 JSON 对任务阅读的干扰;项目导航补齐左右键/Home/End,中文输入法组合时避免误发送。 +- 桌面 Electron 实际隐藏窗口单独验证中;不调用正式 4318,也不操作真实项目或凭据。安装器与启动器显示名称已更新,未打包或升级正式安装。 +- Electron 首轮名称、原生标题和连接均通过,截图因 Windows 从未显示窗口而不产生合成帧超时。改为临时 showInactive 捕获自有测试窗口(不抢焦点),随后关闭,重验实际渲染。 + +- 最终 Electron 验证通过:Orven 应用名、网页/原生标题、真实工作台与桌面宿主已运行状态均核对,0 pageerror,测试窗口与服务已清理。 +- DiagnosticsPanel 与 DeliveryPanel 最后文案调整后,Node24 下 TypeScript、Vite、mobile shell 再次构建通过;新版浏览器 10 组复验通过,冲突后的文件重新打开恢复与诊断实际数据截图均已核对。 +- 已实际查看最终桌面、任务差异、390px、诊断、品牌及 Electron 宿主截图。四张代表截图和两个本机结果 JSON 保存到本次文档目录,原始失败和本地输出保持。 +- 本次只保存 Orven 源码、资产、文档及对应导航验证器的本地提交;不制作发行包,不更新正式安装。独立预览 `http://127.0.0.1:4327` 与 `/brand.html` 保留供体验。 diff --git a/docs/orven/screenshots/brand.png b/docs/orven/screenshots/brand.png new file mode 100644 index 00000000..ad963048 Binary files /dev/null and b/docs/orven/screenshots/brand.png differ diff --git a/docs/orven/screenshots/desktop.png b/docs/orven/screenshots/desktop.png new file mode 100644 index 00000000..8ea38d32 Binary files /dev/null and b/docs/orven/screenshots/desktop.png differ diff --git a/docs/orven/screenshots/mobile-conversation.png b/docs/orven/screenshots/mobile-conversation.png new file mode 100644 index 00000000..54364e68 Binary files /dev/null and b/docs/orven/screenshots/mobile-conversation.png differ diff --git a/docs/orven/screenshots/task-results.png b/docs/orven/screenshots/task-results.png new file mode 100644 index 00000000..af5878c7 Binary files /dev/null and b/docs/orven/screenshots/task-results.png differ diff --git a/docs/orven/task_plan.md b/docs/orven/task_plan.md new file mode 100644 index 00000000..d0442e4e --- /dev/null +++ b/docs/orven/task_plan.md @@ -0,0 +1,28 @@ +# Orven 产品品牌与工作台改版 + +## 目标与边界 +将 Agent Workbench 的正式产品品牌确定为 Orven(奥文),交付品牌文案、可复用标识及围绕真实工程任务的 UI/UX 实现。沿用 React 19 / TypeScript / Vite / Lucide 与原后端契约。正式 4318 服务、用户数据和真实凭据不用于设计测试;保留工作区已存在的 AF 研究改动。 + +## 阶段 +1. 产品与现有界面审查:完成。 +2. 品牌与视觉规范:完成。 +3. 工作台结构、关键界面与配套文案实现:完成。 +4. 独立服务桌面/窄屏、功能路径与相关回归:完成。 +5. 验证记录、差异审查与交付资料:完成;本地提交身份以 Git 记录为准,预览使用独立 4327 服务。 + +## 选择 +- 正式名 Orven;中文 奥文;读音 OR-ven;品类 AI 开发工作台;主张 从想法,到运行。 +- 对比三种结构:监控总览以指标为主,偏离工程操作;全屏聊天弱化文件核验;选择对话与成果并置的工作空间,保留文件树和可调节检视区,把扩展工具移入明确分组。 +- 色彩采用白与冷灰、石墨正文和少量鸢尾色操作;不使用大渐变、玻璃、营销 KPI 或装饰性卡片。 +- 实现而非等待风格审批;不委派、不推送、不升级或重启正式服务。 + +## 初始状态 +- 分支 feat/task-agreement-1.25;当前版本 1.25.8。 +- 已有改动 findings.md、scripts/live-ad/common.mjs 及未跟踪 AF 文件保持。 +- 现有工程三栏结构适用,但深蓝侧栏、顶端十余工具、11px 密集文字与旧 AW 身份混杂。 + +## 错误与修正 +- 初次全根目录搜索包含历史证据导致输出过大;后续限定 src/client 与明确文件,不遍历证据和用户数据。 +- 系统 Node26 不满足桌面启动测试所需的已核验 Node24;改用仓库 Node24,两项通过。 +- 品牌页内联交互脚本被原有 CSP 阻止;改用同源外部脚本,不改变安全策略。 +- 初次 patch 同时删除/新增同一图标路径被工具拒绝,未写入;改为原位 Update。 diff --git a/index.html b/index.html index 4fadb2af..43f24d22 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - Agent Workbench · 本地编程工作台 + Orven · AI 开发工作台
diff --git a/mobile.html b/mobile.html index d1e7c37a..a928c7e6 100644 --- a/mobile.html +++ b/mobile.html @@ -1,2 +1,2 @@ -Agent Workbench · 手机伴随端
+Orven · 手机伴随端
diff --git a/package.json b/package.json index 48df1049..e848d94c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.25.8", "private": true, "type": "module", - "description": "A local coding workbench with explicit tool execution, reviewable changes and recoverable sessions.", + "description": "Orven — an AI development workspace. From an idea to a running result.", "scripts": { "dev": "vite --host 127.0.0.1", "build": "tsc --noEmit && vite build && node scripts/build-mobile.mjs && node scripts/build-server.mjs", @@ -12,6 +12,7 @@ "verify:desktop": "node scripts/verify-desktop-window.mjs", "test": "node --test --test-concurrency=2 tests/*.test.mjs", "verify:ui": "node scripts/verify-ui.mjs", + "verify:orven": "node scripts/verify-orven-ui.mjs", "verify:diagnostics": "node scripts/verify-diagnostics-ui.mjs", "verify:python": "node scripts/verify-python-ui.mjs", "verify:react": "node scripts/verify-react-delivery.mjs", diff --git a/public/brand.html b/public/brand.html new file mode 100644 index 00000000..d9d50494 --- /dev/null +++ b/public/brand.html @@ -0,0 +1,55 @@ + + + + + + + + + 认识 Orven · 从想法,到运行。 + + + +
OrvenAI 开发工作台打开 Orven ↗
+
+
+

MEET ORVEN

让想法,成为
运行中的作品。

Orven · 奥文OR-venAI 开发工作台

带上你的项目,与 Orven 一起理解代码、解决问题、完成实现。对话、改动与执行结果,始终连在一起。

从想法,到运行。

+
ORVEN / BRAND MARK
Orven

理解项目,研究问题,动手实现。

+
+

先理解,再动手。

从现有项目和真实文件出发,带着上下文讨论问题,把目标和实现连接起来。

每一步,都看得见。

让对话、工具执行与文件改动留在同一个工作空间。想了解进展,随时打开记录。

做出成果,继续向前。

并排查看源码与差异,核对实际检查结果。保留工作进展,接着完成下一步。

+

品牌资产

鸢尾 #6253B5石墨 #37333F冷灰 #F5F5F8
+
+ + + + diff --git a/public/brand/brand.js b/public/brand/brand.js new file mode 100644 index 00000000..c83ee571 --- /dev/null +++ b/public/brand/brand.js @@ -0,0 +1,6 @@ +document.getElementById('theme').addEventListener('click', function () { + const dark = this.getAttribute('aria-pressed') !== 'true'; + this.setAttribute('aria-pressed', String(dark)); + document.getElementById('specimen').dataset.dark = String(dark); + this.textContent = dark ? '查看品牌色背景' : '查看深色背景'; +}); diff --git a/public/brand/orven-symbol.svg b/public/brand/orven-symbol.svg new file mode 100644 index 00000000..51da040d --- /dev/null +++ b/public/brand/orven-symbol.svg @@ -0,0 +1 @@ + diff --git a/public/brand/orven-wordmark.svg b/public/brand/orven-wordmark.svg new file mode 100644 index 00000000..04609d1a --- /dev/null +++ b/public/brand/orven-wordmark.svg @@ -0,0 +1 @@ +Orven diff --git a/public/favicon.svg b/public/favicon.svg index 33dafaaf..bfd90d59 100644 --- a/public/favicon.svg +++ b/public/favicon.svg @@ -1 +1 @@ - + diff --git a/public/mobile-icon.svg b/public/mobile-icon.svg index c0fa158b..bfd90d59 100644 --- a/public/mobile-icon.svg +++ b/public/mobile-icon.svg @@ -1 +1 @@ - + diff --git a/public/mobile.webmanifest b/public/mobile.webmanifest index e3923530..b46802fe 100644 --- a/public/mobile.webmanifest +++ b/public/mobile.webmanifest @@ -1 +1 @@ -{"id":"/","name":"Agent Workbench 手机伴随端","short_name":"Workbench","lang":"zh-CN","start_url":"/","scope":"/","display":"standalone","background_color":"#f1f4f7","theme_color":"#172b43","icons":[{"src":"/mobile-icon.svg","sizes":"any","type":"image/svg+xml","purpose":"any"},{"src":"/mobile-touch-icon.png","sizes":"256x256","type":"image/png","purpose":"any"}]} +{"id":"/","name":"Orven 手机伴随端","short_name":"Orven","lang":"zh-CN","start_url":"/","scope":"/","display":"standalone","background_color":"#f7f6fa","theme_color":"#6253b5","icons":[{"src":"/mobile-icon.svg","sizes":"any","type":"image/svg+xml","purpose":"any"},{"src":"/mobile-touch-icon.png","sizes":"256x256","type":"image/png","purpose":"any"}]} diff --git a/public/workbench-icon.ico b/public/workbench-icon.ico index ee0c663d..2b8d0efc 100644 Binary files a/public/workbench-icon.ico and b/public/workbench-icon.ico differ diff --git a/public/workbench-icon.png b/public/workbench-icon.png index 98f98742..f10dde5c 100644 Binary files a/public/workbench-icon.png and b/public/workbench-icon.png differ diff --git a/scripts/desktop-project-qa.mjs b/scripts/desktop-project-qa.mjs index a7972f2b..4e7248db 100644 --- a/scripts/desktop-project-qa.mjs +++ b/scripts/desktop-project-qa.mjs @@ -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); diff --git a/scripts/generate-orven-icons.mjs b/scripts/generate-orven-icons.mjs new file mode 100644 index 00000000..bdd782bc --- /dev/null +++ b/scripts/generate-orven-icons.mjs @@ -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('' + 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(); } diff --git a/scripts/ui-navigation.mjs b/scripts/ui-navigation.mjs new file mode 100644 index 00000000..db3c1abc --- /dev/null +++ b/scripts/ui-navigation.mjs @@ -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(); +} diff --git a/scripts/verify-anthropic-messages-ui.mjs b/scripts/verify-anthropic-messages-ui.mjs index a3410c8a..45bf73f3 100644 --- a/scripts/verify-anthropic-messages-ui.mjs +++ b/scripts/verify-anthropic-messages-ui.mjs @@ -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); diff --git a/scripts/verify-companion-ui.mjs b/scripts/verify-companion-ui.mjs index 8ec76918..4214d056 100644 --- a/scripts/verify-companion-ui.mjs +++ b/scripts/verify-companion-ui.mjs @@ -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.'); diff --git a/scripts/verify-controlled-ui.mjs b/scripts/verify-controlled-ui.mjs index 7f486e53..79b77d92 100644 --- a/scripts/verify-controlled-ui.mjs +++ b/scripts/verify-controlled-ui.mjs @@ -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() { diff --git a/scripts/verify-desktop-window.mjs b/scripts/verify-desktop-window.mjs index bf246029..370edcbb 100644 --- a/scripts/verify-desktop-window.mjs +++ b/scripts/verify-desktop-window.mjs @@ -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 }); }); diff --git a/scripts/verify-engines-ui.mjs b/scripts/verify-engines-ui.mjs index bf7fc980..14c459b2 100644 --- a/scripts/verify-engines-ui.mjs +++ b/scripts/verify-engines-ui.mjs @@ -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'); diff --git a/scripts/verify-evaluations-release.mjs b/scripts/verify-evaluations-release.mjs index 516f26d9..7346e855 100644 --- a/scripts/verify-evaluations-release.mjs +++ b/scripts/verify-evaluations-release.mjs @@ -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); diff --git a/scripts/verify-evaluations-ui.mjs b/scripts/verify-evaluations-ui.mjs index fef89d8c..847ce9f4 100644 --- a/scripts/verify-evaluations-ui.mjs +++ b/scripts/verify-evaluations-ui.mjs @@ -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; diff --git a/scripts/verify-mcp-recovery-ui.mjs b/scripts/verify-mcp-recovery-ui.mjs index b9fe50a9..48e90544 100644 --- a/scripts/verify-mcp-recovery-ui.mjs +++ b/scripts/verify-mcp-recovery-ui.mjs @@ -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(); diff --git a/scripts/verify-mcp-ui.mjs b/scripts/verify-mcp-ui.mjs index 2bcb5993..7f82c27c 100644 --- a/scripts/verify-mcp-ui.mjs +++ b/scripts/verify-mcp-ui.mjs @@ -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)); diff --git a/scripts/verify-model-capacity-ui.mjs b/scripts/verify-model-capacity-ui.mjs index 31cb2cb8..0e7557ef 100644 --- a/scripts/verify-model-capacity-ui.mjs +++ b/scripts/verify-model-capacity-ui.mjs @@ -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 }); diff --git a/scripts/verify-model-catalog-ui.mjs b/scripts/verify-model-catalog-ui.mjs index 80527753..425561e4 100644 --- a/scripts/verify-model-catalog-ui.mjs +++ b/scripts/verify-model-catalog-ui.mjs @@ -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 { diff --git a/scripts/verify-model-center-ui.mjs b/scripts/verify-model-center-ui.mjs index 5d488891..676d2abe 100644 --- a/scripts/verify-model-center-ui.mjs +++ b/scripts/verify-model-center-ui.mjs @@ -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 }); diff --git a/scripts/verify-model-fidelity-ui.mjs b/scripts/verify-model-fidelity-ui.mjs index 23ddaa8b..abb68d66 100644 --- a/scripts/verify-model-fidelity-ui.mjs +++ b/scripts/verify-model-fidelity-ui.mjs @@ -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); diff --git a/scripts/verify-model-identity-ui.mjs b/scripts/verify-model-identity-ui.mjs index 4df62259..25f22704 100644 --- a/scripts/verify-model-identity-ui.mjs +++ b/scripts/verify-model-identity-ui.mjs @@ -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'); diff --git a/scripts/verify-model-protocols-ui.mjs b/scripts/verify-model-protocols-ui.mjs index 0aa49ded..81faa75d 100644 --- a/scripts/verify-model-protocols-ui.mjs +++ b/scripts/verify-model-protocols-ui.mjs @@ -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'); diff --git a/scripts/verify-model-selection-ui.mjs b/scripts/verify-model-selection-ui.mjs index d51b54bb..25de44e2 100644 --- a/scripts/verify-model-selection-ui.mjs +++ b/scripts/verify-model-selection-ui.mjs @@ -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'); diff --git a/scripts/verify-model-wait-ui.mjs b/scripts/verify-model-wait-ui.mjs index 606a5542..d10bbbd7 100644 --- a/scripts/verify-model-wait-ui.mjs +++ b/scripts/verify-model-wait-ui.mjs @@ -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(); }; diff --git a/scripts/verify-network-diagnostics-ui.mjs b/scripts/verify-network-diagnostics-ui.mjs index 5c2ca0bf..ab6d8ef0 100644 --- a/scripts/verify-network-diagnostics-ui.mjs +++ b/scripts/verify-network-diagnostics-ui.mjs @@ -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(); }; diff --git a/scripts/verify-open-formal-ui.mjs b/scripts/verify-open-formal-ui.mjs index be242e6b..c7a7dbca 100644 --- a/scripts/verify-open-formal-ui.mjs +++ b/scripts/verify-open-formal-ui.mjs @@ -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); diff --git a/scripts/verify-original-purge-ui.mjs b/scripts/verify-original-purge-ui.mjs index 2410a380..126f4263 100644 --- a/scripts/verify-original-purge-ui.mjs +++ b/scripts/verify-original-purge-ui.mjs @@ -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); diff --git a/scripts/verify-orven-desktop.mjs b/scripts/verify-orven-desktop.mjs new file mode 100644 index 00000000..8fc2ad24 --- /dev/null +++ b/scripts/verify-orven-desktop.mjs @@ -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(); +} diff --git a/scripts/verify-orven-ui.mjs b/scripts/verify-orven-ui.mjs new file mode 100644 index 00000000..36a179b5 --- /dev/null +++ b/scripts/verify-orven-ui.mjs @@ -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(); +} diff --git a/scripts/verify-purge-ui.mjs b/scripts/verify-purge-ui.mjs index cb2b122d..881de15e 100644 --- a/scripts/verify-purge-ui.mjs +++ b/scripts/verify-purge-ui.mjs @@ -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); diff --git a/scripts/verify-reasoning-settings-ui.mjs b/scripts/verify-reasoning-settings-ui.mjs index 215b6bf3..6f6186b2 100644 --- a/scripts/verify-reasoning-settings-ui.mjs +++ b/scripts/verify-reasoning-settings-ui.mjs @@ -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(); } diff --git a/scripts/verify-research-ui.mjs b/scripts/verify-research-ui.mjs index 68762636..2f71d8bf 100644 --- a/scripts/verify-research-ui.mjs +++ b/scripts/verify-research-ui.mjs @@ -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; diff --git a/scripts/verify-skills-ui.mjs b/scripts/verify-skills-ui.mjs index 050a2feb..f1965c48 100644 --- a/scripts/verify-skills-ui.mjs +++ b/scripts/verify-skills-ui.mjs @@ -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('工程交付核验'); diff --git a/scripts/verify-ui.mjs b/scripts/verify-ui.mjs index c8e41fe5..8ed83970 100644 --- a/scripts/verify-ui.mjs +++ b/scripts/verify-ui.mjs @@ -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); diff --git a/scripts/verify-unified-model-ui.mjs b/scripts/verify-unified-model-ui.mjs index 97f05a90..b1a552ce 100644 --- a/scripts/verify-unified-model-ui.mjs +++ b/scripts/verify-unified-model-ui.mjs @@ -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)); } diff --git a/scripts/verify-unrestricted-ui.mjs b/scripts/verify-unrestricted-ui.mjs index f052ec3a..89770c1a 100644 --- a/scripts/verify-unrestricted-ui.mjs +++ b/scripts/verify-unrestricted-ui.mjs @@ -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 }); diff --git a/scripts/verify-workers-ui.mjs b/scripts/verify-workers-ui.mjs index 6876cf23..6ef37bb6 100644 --- a/scripts/verify-workers-ui.mjs +++ b/scripts/verify-workers-ui.mjs @@ -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) { diff --git a/src/client/App.tsx b/src/client/App.tsx index ddd17418..30750dc6 100644 --- a/src/client/App.tsx +++ b/src/client/App.tsx @@ -26,6 +26,9 @@ import { desktop } from './desktop'; import { AttachmentComposer,InputImage } from './InputAttachments'; import { BudgetPausePanel } from './BudgetPausePanel'; import { PermissionModeControl } from './PermissionModeControl'; +import { BRAND, OrvenMark } from './brand'; +import { WorkbenchTools } from './WorkbenchTools'; +import type { WorkbenchAction } from './WorkbenchTools'; const activeStates = ['running', 'awaiting_approval', 'stopping']; const activeMcpStates = ['queued', 'connecting', 'discovering', 'calling', 'closing', 'stopping']; @@ -72,6 +75,9 @@ export default function App() { const [inspectorWidth,setInspectorWidth]=useState(null),[inspectorResizing,setInspectorResizing]=useState(false); const inspectorDrag=useRef<{x:number;width:number}|null>(null); const [sidebarOpen, setSidebarOpen] = useState(() => window.innerWidth > 620); + const [sidebarView, setSidebarView] = useState<'sessions' | 'files'>('sessions'); + const [inspectorOpen, setInspectorOpen] = useState(false); + const [toolsOpen, setToolsOpen] = useState(false); const [narrow, setNarrow] = useState(() => window.innerWidth <= 940); const [viewportWidth,setViewportWidth]=useState(()=>window.innerWidth); const [mobile, setMobile] = useState(() => window.innerWidth <= 620); @@ -192,6 +198,7 @@ export default function App() { }); } function showInspector(next: 'file' | 'changes' | 'trace' | 'task' | 'index' | 'browse') { + setInspectorOpen(true); setTab(next); if (window.innerWidth <= 940) setWide(true); if (window.innerWidth <= 620) setSidebarOpen(false); @@ -520,7 +527,8 @@ export default function App() { }, []); useEffect(() => { const handler = (event: KeyboardEvent) => { - if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'k') { event.preventDefault(); setSidebarOpen(true); setWide(false); requestAnimationFrame(() => filterRef.current?.focus()); } + if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'k') { event.preventDefault(); setToolsOpen(value => !value); } + if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'p' && !document.querySelector('[role="dialog"][aria-modal="true"]')) { event.preventDefault(); setSidebarOpen(true); setSidebarView('files'); setWide(false); requestAnimationFrame(() => filterRef.current?.focus()); } if (event.key === 'Escape' && !event.defaultPrevented && !document.querySelector('[role="dialog"][aria-modal="true"]')) { if (window.innerWidth <= 940) setWide(false); if (window.innerWidth <= 620) setSidebarOpen(false); } }; window.addEventListener('keydown', handler); return () => window.removeEventListener('keydown', handler); @@ -546,51 +554,75 @@ export default function App() { const sidebarWidth=sidebarOpen?(viewportWidth>=1700?260:viewportWidth<=1120?210:242):0; const maximumInspector=Math.max(310,Math.min(1000,viewportWidth-sidebarWidth-320)); const resizeInspector=(width:number)=>setInspectorWidth(Math.max(310,Math.min(maximumInspector,width))); + const actions: WorkbenchAction[] = [ + { id: 'files', label: '项目文件', description: '浏览目录,打开文件或查看源码', group: '工作空间', icon: FolderOpen, run: () => { setSidebarOpen(true); setSidebarView('files'); setWide(false); requestAnimationFrame(() => filterRef.current?.focus()); } }, + { id: 'changes', label: '查看改动', description: '审查文件差异与应用结果', group: '工作空间', icon: GitBranch, run: () => showInspector('changes') }, + { id: 'task', label: '查看任务记录', description: '目标、检查、交付与历史运行', group: '工作空间', icon: ClipboardCheck, run: () => showInspector('task') }, + { id: 'trace', label: '查看执行轨迹', description: '查看工具参数、原始输出和用时', group: '工作空间', icon: SquareTerminal, run: () => showInspector('trace') }, + { id: 'index', label: '代码索引', description: '按符号、路径和导入查找实现', group: '工作空间', icon: Search, run: () => showInspector('index') }, + { id: 'browse', label: '浏览与预览', description: '打开网页,查看项目运行结果', group: '工作空间', icon: Link2, run: () => showInspector('browse') }, + { id: 'memory', label: '项目记忆', description: '保留项目事实、约定和关键决策', group: '能力与研究', icon: Brain, disabled: !selectedProject || restrictedWorker, reason: '请先选择可编辑的项目', run: () => setMemoryOpen(true) }, + { id: 'skills', label: '项目技能', description: '管理技能来源、版本和启用状态', group: '能力与研究', icon: BookOpenText, disabled: !selectedProject || restrictedWorker, reason: '请先选择可编辑的项目', run: () => setSkillsOpen(true) }, + { id: 'mcp', label: '项目 MCP 工具', description: '连接本地工具,扩展工作台能力', group: '能力与研究', icon: Puzzle, disabled: !selectedProject || restrictedWorker, reason: '请先选择可编辑的项目', run: () => setMcpOpen(true) }, + { id: 'workers', label: '隔离协作', description: '在独立工作区分配任务并审查成果', group: '能力与研究', icon: GitBranch, disabled: !session, reason: '新建任务后可使用', run: () => setWorkersOpen(true) }, + { id: 'evaluation', label: '工程评测', description: '比较实现、检查与交付结果', group: '能力与研究', icon: ClipboardCheck, disabled: !session || restrictedWorker, reason: '请先选择主任务', run: () => setEvaluationsOpen(true) }, + { id: 'engine', label: '本地代理引擎', description: '连接已有引擎,查看所属运行记录', group: '能力与研究', icon: Link2, disabled: !session || restrictedWorker && !session.execution?.workers?.some(value => value.engine), reason: '请先选择可用任务', run: () => setEngineOpen(true) }, + { id: 'rea', label: 'REA 工件研究', description: '研究应用工件,核对分析证据', group: '能力与研究', icon: BookOpenText, disabled: !selectedProject || creatingSession || restrictedWorker, reason: '请先选择可编辑的项目', run: () => void openRea() }, + { id: 'research', label: '机制研究与设计', description: '阅读已有研究报告与机制说明', group: '能力与研究', icon: BookOpenText, run: () => void openResearch() }, + { id: 'models', label: '模型中心', description: '选择模型、管理连接和模型池', group: '设置与连接', icon: ModelServer, run: () => setModelCenterOpen(true) }, + { id: 'diagnostics', label: '运行诊断', description: '检查连接、终端与最近错误', group: '设置与连接', icon: Activity, run: () => void openDiagnostics() }, + { id: 'companion', label: '手机连接', description: '在手机上查看和接续电脑任务', group: '设置与连接', icon: Link2, run: () => setCompanionOpen(true) }, + ...(desktop ? [{ id: 'desktop', label: '桌面宿主', description: '查看窗口、后台任务与本地宿主', group: '设置与连接', icon: SquareTerminal, run: () => setDesktopOpen(true) }] : []), + { id: 'version', label: '版本与更新', description: '查看 Orven 当前版本和更新记录', group: '设置与连接', icon: RotateCw, run: () => setInstallationOpen(true) }, + { id: 'export', label: '导出会话', description: '下载当前任务的完整会话记录', group: '工作空间', icon: ArrowDownToLine, disabled: !session, reason: '选择会话后可导出', run: () => { if (session) void exportSession(session.id).catch(failure); } }, + ]; return ( -
+
-
{(!sidebarOpen || mobile) && setSidebarOpen(true)}>}
{selectedProject?.name || '工作空间'} 任务

{session?.title || '让任务走到完成'}

-
{desktop && }
+
{(!sidebarOpen || mobile) && setSidebarOpen(true)}>}
{selectedProject?.name || '工作空间'} 工作区

{session?.title || '新任务'}

+
-
本地项目{session ? : 等待新任务}
- openDiagnostics()}> - setSkillsOpen(true)} disabled={!selectedProject || restrictedWorker}> - setMcpOpen(true)} disabled={!selectedProject || restrictedWorker}> - showInspector('task')}> - setWorkersOpen(true)} disabled={!session}> - setEvaluationsOpen(true)} disabled={!session || restrictedWorker}> - setEngineOpen(true)} disabled={!session || restrictedWorker && !session.execution?.workers?.some(value => value.engine)}> - void openRea()} disabled={!selectedProject || creatingSession || restrictedWorker}> - {narrow && <> showInspector('file')}> showInspector('changes')}> showInspector('trace')}>} +
本地工作空间{session ? : 准备就绪}
+ {pending.length > 0 && } - {session && <> exportSession(session.id).catch(failure)}> - {!isRunning && pending.length === 0 && ['failed', 'paused'].includes(session.status) && }} + {session && !isRunning && pending.length === 0 && ['failed', 'paused'].includes(session.status) && }
- {!session?.messages.length && !session?.events.length ?
从项目到结果

读懂项目。
把每一步做好。

给出一个任务,读取依据、工具执行和文件改动会在这里连成完整过程。

{['了解这个项目,并提出一项改进', '查找关键实现,解释调用关系', '检查项目,并准备可审查的修改'].map((prompt, index) => )}
{config.executionMode === 'unrestricted' ? '文件改动直接应用,可查看差异和回滚。命令按所选权限执行。' : '当前使用自定义额度;命令按所选权限执行。'}
:
+ {!session?.messages.length && !session?.events.length ?
+
{BRAND.name}{BRAND.slogan}
+

今天,想实现什么?

一个新想法,一个待解决的问题。
带上你的项目,我们一起把它做出来。

+
{selectedProject?.name || '从你的项目开始'}{projectId === exampleId && 示例项目}{projectId === exampleId ? '先在示例里探索,或打开你自己的项目。' : selectedProject?.root || '打开本机文件夹,让 Orven 理解项目上下文。'}
+
也可以从这里开始
{[ + { title: '读懂项目', detail: '梳理结构与关键实现', prompt: '了解这个项目,梳理项目结构、技术栈和关键实现,并说明可以从哪里开始。', icon: FolderOpen }, + { title: '一起解决问题', detail: '定位原因,准备修改', prompt: '检查这个项目,找出一个值得修复的问题,说明原因并准备可审查的修改。', icon: Code2 }, + { title: '把改动做扎实', detail: '审查代码,核对检查', prompt: '审查这个项目的代码与现有检查,找出缺少验证的关键路径,并提出具体改进。', icon: ClipboardCheck }, + ].map(item => )}
+ {config.mode === 'demo' && } +
:
{session?.recoveryNotice &&
已恢复会话记录

{session.recoveryNotice}

} - {entries.map(entry => 'message' in entry && entry.message ?
{entry.message.role === 'user' ? '你' : entry.message.role === 'assistant' ? 'AW' : '·'}
{entry.message.role === 'user' ? '你的任务' : entry.message.role === 'assistant' ? session?.executionMode === 'demo' ? '演示执行器' : '编程助手' : '工作台'}
{entry.message.role === 'system' && failureForMessage(entry.message) + {entries.map(entry => 'message' in entry && entry.message ?
{entry.message.role === 'user' ? '你' : entry.message.role === 'assistant' ? : '·'}
{entry.message.role === 'user' ? '你的任务' : entry.message.role === 'assistant' ? session?.executionMode === 'demo' ? '演示执行器' : BRAND.name : '工作台'}
{entry.message.role === 'system' && failureForMessage(entry.message) ? openDiagnostics()} onRetry={session?.status === 'failed' && session?.failure?.messageId === entry.message.id ? () => resumeSession() : undefined} busy={resuming || isRunning} /> - : entry.message.role === 'assistant' ? : entry.message.content}
{entry.message.attachmentIds?.map(id=>{const image=session?.inputAttachments?.find(value=>value.id===id);return image&&session?:null;})}
: 'event' in entry && entry.event ?
{['tool', 'model'].includes(entry.event.kind) ? <> { setEventId(entry.event!.id); showInspector('trace'); }} /> :
{entry.event.label}{entry.event.output &&

{entry.event.output}

}
}
: null)} + : entry.message.role === 'assistant' ? : entry.message.content}
{entry.message.attachmentIds?.map(id=>{const image=session?.inputAttachments?.find(value=>value.id===id);return image&&session?:null;})}
: 'event' in entry && entry.event ?
{['tool', 'model'].includes(entry.event.kind) ? <> { setEventId(entry.event!.id); showInspector('trace'); }} /> :
{entry.event.label}{entry.event.output &&
查看详情
{entry.event.output}
}
}
: null)} {isRunning && !approval &&
{session?.executionMode === 'demo' ? '正在执行演示流程' : '正在处理任务'}
}
} {session&&setWorkersOpen(true)}/>} @@ -602,15 +634,19 @@ export default function App() { {canContinueReview && }
-