feat: introduce Orven brand and task-focused workspace

This commit is contained in:
Agent Workbench Dev
2026-11-06 14:08:53 +08:00
parent 16fb10ca15
commit b4b139a1ba
74 changed files with 1266 additions and 103 deletions
+1
View File
@@ -17,6 +17,7 @@
!/docs/original-purge-release-f-evidence/**/*.log !/docs/original-purge-release-f-evidence/**/*.log
*.tmp *.tmp
/.qa/ /.qa/
/output/playwright/
/releases/ /releases/
/.secrets/ /.secrets/
.env .env
+17 -1
View File
@@ -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纸白/海松界面的历史设计基线,不作为当前部署状态。 当前正式1.12.1已采用工程控制台方向,模型中心的布局、状态语义、颜色/字体和桌面/窄屏验收见[1.12设计与执行方案](docs/PLAN-1.12.md)。1.13隔离协作沿用白/浅蓝、深蓝文字、蓝色操作和细边框,新增固定父目标与两个真实执行通道;实施与验收见[1.13方案](docs/PLAN-1.13.md)。以下保留1.11纸白/海松界面的历史设计基线,不作为当前部署状态。
+3 -1
View File
@@ -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)。下方各版本数字为历史交付记录。 当前已安装版本为 **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)。下方各版本数字为历史交付记录。
+61
View File
@@ -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 缩略。周围留出至少图形宽度的四分之一。默认鸢尾图形与石墨字标,深色背景使用白色。不要拉伸、旋转或添加发光、渐变及多层阴影。
## 定稿范围
本次完成产品名称、文案与本地品牌资产定稿;商标、域名及应用商店名称可用性尚未核验。内部包名、数据目录、桌面应用身份及协议标识沿用,保持历史数据和升级兼容。
+49
View File
@@ -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`。
+19
View File
@@ -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
}
+8
View File
@@ -0,0 +1,8 @@
{
"appName": "Orven",
"nativeTitle": "Orven · AI 开发工作台",
"isolatedHost": true,
"productionTouched": false,
"realModelCalls": 0,
"errors": []
}
+11
View File
@@ -0,0 +1,11 @@
# Orven 设计依据
真实产品对象是项目、任务、文件、改动和可核对的执行结果。主要用户在 Windows 上用中文开展开发与工程研究,桌面是主要设备,窄屏应能完成导航和审查。
现有公开源码与原 UI 文案显示:任务跨轮保存;支持模型连接/池、权限、文件差异、原始工具轨迹、检查与 Git、技能/MCP、隔离协作、工件研究、手机伴随端。此次不更换业务接口,不把尚未实测的模型能力包装成品牌承诺。
现有界面的关键问题:顶部重复暴露模型管理和工具;项目/会话/文件缺少清楚的阅读层级;新任务导语与产品名称脱节;扩展能力的图标缺少可见文字;模型未连接时缺少明确下一步。
设计参考以当前应用实际 DOM、源码与独立浏览器渲染为直接依据;未把外部产品页面或目录当成已访问体验。借用常规 IDE 的“保留项目上下文”和对话工具的“输入就近选择执行方式”原则,具体视觉及标识为本项目设计。
命名结论:采用 Orven,而非再制造功能缩写。独立自然的名字适合长期承载研究和执行能力;品类说明补足用途。商标、域名及应用商店名称可用性不在本地源码验证范围内。
+25
View File
@@ -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` 保留供体验。
Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

+28
View File
@@ -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。
+1 -1
View File
@@ -1,5 +1,5 @@
<!doctype html> <!doctype html>
<html lang="zh-CN"> <html lang="zh-CN">
<head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="theme-color" content="#154b4a" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><title>Agent Workbench · 本地编程工作台</title></head> <head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="theme-color" content="#6253b5" /><meta name="description" content="Orven,AI 开发工作台。理解项目,研究问题,编写代码。从想法,到运行。" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><title>Orven · AI 开发工作台</title></head>
<body><div id="root"></div><script type="module" src="/src/client/main.tsx"></script></body> <body><div id="root"></div><script type="module" src="/src/client/main.tsx"></script></body>
</html> </html>
+1 -1
View File
@@ -1,2 +1,2 @@
<!doctype html> <!doctype html>
<html lang="zh-CN"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /><meta name="theme-color" content="#172b43" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-title" content="Workbench" /><link rel="manifest" href="/mobile.webmanifest" /><link rel="icon" type="image/svg+xml" href="/mobile-icon.svg" /><link rel="apple-touch-icon" href="/mobile-touch-icon.png" /><title>Agent Workbench · 手机伴随端</title></head><body><div id="mobile-root"></div><script type="module" src="/src/client/mobile/main.tsx"></script></body></html> <html lang="zh-CN"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /><meta name="theme-color" content="#6253b5" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-title" content="Orven" /><link rel="manifest" href="/mobile.webmanifest" /><link rel="icon" type="image/svg+xml" href="/mobile-icon.svg" /><link rel="apple-touch-icon" href="/mobile-touch-icon.png" /><title>Orven · 手机伴随端</title></head><body><div id="mobile-root"></div><script type="module" src="/src/client/mobile/main.tsx"></script></body></html>
+2 -1
View File
@@ -3,7 +3,7 @@
"version": "1.25.8", "version": "1.25.8",
"private": true, "private": true,
"type": "module", "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": { "scripts": {
"dev": "vite --host 127.0.0.1", "dev": "vite --host 127.0.0.1",
"build": "tsc --noEmit && vite build && node scripts/build-mobile.mjs && node scripts/build-server.mjs", "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", "verify:desktop": "node scripts/verify-desktop-window.mjs",
"test": "node --test --test-concurrency=2 tests/*.test.mjs", "test": "node --test --test-concurrency=2 tests/*.test.mjs",
"verify:ui": "node scripts/verify-ui.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:diagnostics": "node scripts/verify-diagnostics-ui.mjs",
"verify:python": "node scripts/verify-python-ui.mjs", "verify:python": "node scripts/verify-python-ui.mjs",
"verify:react": "node scripts/verify-react-delivery.mjs", "verify:react": "node scripts/verify-react-delivery.mjs",
+55
View File
@@ -0,0 +1,55 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#6253b5" />
<meta name="description" content="Orven · AI 开发工作台。从想法,到运行。" />
<link rel="icon" href="/favicon.svg" />
<title>认识 Orven · 从想法,到运行。</title>
<style>
:root { font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", sans-serif; color: #37333f; background: #fcfbfe; font-synthesis: none; }
* { box-sizing: border-box; } body { margin: 0; } a { color: inherit; text-decoration: none; } button { font: inherit; cursor: pointer; } a:focus-visible, button:focus-visible { outline: 2px solid #6253b5; outline-offset: 5px; }
header { height: 94px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8e3ef; max-width: 1260px; margin: auto; padding: 0 34px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 650; letter-spacing: -1px; } .brand img { width: 31px; height: 31px; } .brand small { font-size: 11px; font-weight: 400; letter-spacing: .4px; color: #736c7d; margin-left: 10px; }
.open { border: 1px solid #ddd5e8; border-radius: 7px; padding: 10px 15px; font-size: 12px; color: #645274; } .open:hover { background: #f0eaf8; }
main { max-width: 1260px; margin: auto; padding: 62px 34px 34px; }
.intro { display: grid; grid-template-columns: 1.2fr 1fr; gap: 70px; align-items: center; }
.eyebrow { color: #72657f; font-size: 11px; letter-spacing: 1.4px; margin: 0 0 28px; }
h1 { font-size: clamp(44px, 5vw, 68px); font-weight: 600; line-height: 1.22; letter-spacing: -2.3px; margin: 0; }
h1 span { color: #6253b5; } .pronounce { display: flex; align-items: center; gap: 17px; color: #736b7e; font-size: 12px; margin: 28px 0 22px; } .pronounce b { color: #5b5265; font-weight: 500; }
.lead { max-width: 430px; color: #716979; font-size: 15px; line-height: 2; margin: 0; }
.signature { margin: 29px 0 0; font-size: 17px; color: #595061; letter-spacing: .5px; }
.specimen { background: #6253b5; border-radius: 22px; color: white; padding: 27px; min-height: 408px; display: flex; flex-direction: column; align-items: center; position: relative; transition: background .15s; }
.specimen[data-dark="true"] { background: #292431; }
.specimen-top { width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: #ede8fa; letter-spacing: .5px; }
.specimen button { border: 1px solid #ffffff55; color: #fff; background: none; border-radius: 6px; padding: 7px 9px; font-size: 10px; }
.specimen svg { width: 142px; height: 142px; margin: 37px 0 10px; }
.specimen strong { font-size: 48px; letter-spacing: -2px; line-height: 1.3; font-weight: 600; }
.specimen p { color: #ece6f8; font-size: 11px; margin-top: 9px; letter-spacing: 1px; }
.work { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 35px; margin: 73px 0 0; border-top: 1px solid #e4ddeb; padding-top: 25px; }
.work h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: #5b4b68; } .work p { color: #776a81; font-size: 12px; line-height: 1.9; margin: 0; max-width: 290px; }
.identity { display: flex; align-items: center; gap: 30px; border-top: 1px solid #e4ddeb; margin-top: 37px; padding-top: 24px; }
.identity h2 { font-size: 12px; font-weight: 500; margin: 0; color: #73617f; } .swatches { display: flex; gap: 19px; margin-right: auto; }
.swatches span { display: flex; align-items: center; gap: 7px; font-size: 10px; color: #7c6c89; } .swatches i { width: 16px; height: 16px; border-radius: 4px; background: var(--swatch); border: 1px solid #33224912; }
.downloads { display: flex; gap: 17px; font-size: 11px; color: #786386; } .downloads a { text-decoration: underline; text-underline-offset: 4px; }
footer { max-width: 1260px; padding: 26px 34px 28px; margin: auto; display: flex; justify-content: space-between; font-size: 10px; color: #8a7997; }
@media(max-width:800px) { header { padding: 0 22px; height: 76px; } .brand small { display: none; } main { padding: 35px 24px 15px; } .intro { gap: 30px; } .specimen { min-height: 335px; padding: 20px; } .specimen svg { width: 110px; height: 110px; margin-top: 35px; } .specimen strong { font-size: 38px; } h1 { font-size: 46px; } .lead { font-size: 13px; } .work { margin-top: 45px; gap: 20px; } .identity { flex-wrap: wrap; gap: 20px; } footer { padding-inline: 24px; } }
@media(max-width:560px) { .intro { grid-template-columns: 1fr; } h1 { font-size: 48px; } .eyebrow { margin-bottom: 22px; } .specimen { margin-top: 9px; min-height: 350px; } .specimen svg { margin-top: 30px; width: 120px; height: 120px; } .work { grid-template-columns: 1fr; gap: 26px; margin-top: 34px; } .work p { max-width: none; } .identity { align-items: flex-start; } .swatches { flex-wrap: wrap; gap: 13px; } .downloads { width: 100%; } footer { gap: 20px; line-height: 1.8; } }
@media(prefers-reduced-motion:reduce) { * { transition: none!important; } }
</style>
</head>
<body>
<header><a class="brand" href="/brand.html"><img src="/brand/orven-symbol.svg" alt="" />Orven<small>AI 开发工作台</small></a><a class="open" href="/">打开 Orven ↗</a></header>
<main>
<section class="intro">
<div><p class="eyebrow">MEET ORVEN</p><h1>让想法,成为<br /><span>运行中的作品。</span></h1><p class="pronounce"><b>Orven · 奥文</b><span>OR-ven</span><span>AI 开发工作台</span></p><p class="lead">带上你的项目,与 Orven 一起理解代码、解决问题、完成实现。对话、改动与执行结果,始终连在一起。</p><p class="signature">从想法,到运行。</p></div>
<div class="specimen" id="specimen"><div class="specimen-top"><span>ORVEN / BRAND MARK</span><button type="button" id="theme" aria-pressed="false">查看深色背景</button></div><svg viewBox="0 0 40 40" fill="none" aria-label="Orven 图形标"><g stroke="currentColor" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round"><path d="M30.7 12.3a13.2 13.2 0 1 0 1.7 12.6"/><path d="m21.5 20 6.2 6.2L36 17.9"/></g></svg><strong>Orven</strong><p>理解项目,研究问题,动手实现。</p></div>
</section>
<section class="work" aria-label="Orven 的工作方式"><article><h2>先理解,再动手。</h2><p>从现有项目和真实文件出发,带着上下文讨论问题,把目标和实现连接起来。</p></article><article><h2>每一步,都看得见。</h2><p>让对话、工具执行与文件改动留在同一个工作空间。想了解进展,随时打开记录。</p></article><article><h2>做出成果,继续向前。</h2><p>并排查看源码与差异,核对实际检查结果。保留工作进展,接着完成下一步。</p></article></section>
<section class="identity" aria-label="品牌资产"><h2>品牌资产</h2><div class="swatches"><span><i style="--swatch:#6253b5"></i>鸢尾 #6253B5</span><span><i style="--swatch:#37333f"></i>石墨 #37333F</span><span><i style="--swatch:#f5f5f8"></i>冷灰 #F5F5F8</span></div><div class="downloads"><a href="/brand/orven-symbol.svg" download>下载图形标 SVG</a><a href="/brand/orven-wordmark.svg" download>下载组合标 SVG</a></div></section>
</main>
<footer><span>Orven · 从想法,到运行。</span><span>产品品牌与界面设计定稿</span></footer>
<script src="/brand/brand.js" defer></script>
</body>
</html>
+6
View File
@@ -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 ? '查看品牌色背景' : '查看深色背景';
});
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" fill="none"><g stroke="#6253b5" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round"><path d="M30.7 12.3a13.2 13.2 0 1 0 1.7 12.6"/><path d="m21.5 20 6.2 6.2L36 17.9"/></g></svg>

After

Width:  |  Height:  |  Size: 252 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 272 80" role="img" aria-label="Orven"><g transform="translate(8 16) scale(1.2)" fill="none" stroke="#6253b5" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round"><path d="M30.7 12.3a13.2 13.2 0 1 0 1.7 12.6"/><path d="m21.5 20 6.2 6.2L36 17.9"/></g><text x="72" y="56" fill="#37333f" font-family="Segoe UI,Arial,sans-serif" font-size="54" font-weight="600" letter-spacing="-2">Orven</text></svg>

After

Width:  |  Height:  |  Size: 462 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="14" fill="#154b4a"/><path d="M12 44l8-25h6l8 25h-6l-2-6H18l-2 6zm8-11h5l-2.5-8zm14-14h5l3 17 3-13h5l3 13 3-17h5l-5 25h-6l-2.5-13L45 44h-6z" fill="#fcfdfc"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="16" fill="#6253b5"/><g transform="translate(11 11) scale(1.05)" fill="none" stroke="#fff" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round"><path d="M30.7 12.3a13.2 13.2 0 1 0 1.7 12.6"/><path d="m21.5 20 6.2 6.2L36 17.9"/></g></svg>

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 355 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 192"><rect width="192" height="192" rx="36" fill="#172b43"/><path d="M42 55h108v82H42z" fill="none" stroke="#f3f6fa" stroke-width="9"/><path d="m60 78 16 18-16 18m32 0h35" fill="none" stroke="#8bd0b9" stroke-width="9" stroke-linecap="square"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="16" fill="#6253b5"/><g transform="translate(11 11) scale(1.05)" fill="none" stroke="#fff" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round"><path d="M30.7 12.3a13.2 13.2 0 1 0 1.7 12.6"/><path d="m21.5 20 6.2 6.2L36 17.9"/></g></svg>

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 355 B

+1 -1
View File
@@ -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"}]}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
@@ -38,7 +39,7 @@ export async function desktopProjectQa({ store, provider, runtime, sample, kind
await select(session); await closeInspector(); 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())); 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) { 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();
await page.getByRole('button', { name: '审查变更集', exact: true }).click(); await page.getByRole('button', { name: '审查变更集', exact: true }).click();
} else { } 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 }); retainedEvents: retainedEvents.length, retainedEventsSha256: hash(Buffer.from(JSON.stringify(retainedEvents))), instanceId: identity.instanceId, completedToolSha256: prior, approvals });
} }
async function capture(session, label) { 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]) { for (const width of [1440, 390]) {
const native = await application.browserWindow(page); await native.evaluate((value, width) => { value.showInactive(); value.setContentSize(width, 900); }, width); 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); await expect.poll(() => page.evaluate(() => innerWidth)).toBe(width);
+29
View File
@@ -0,0 +1,29 @@
import fs from 'node:fs';
import path from 'node:path';
import { chromium } from 'playwright';
// Keep the existing filenames consumed by the desktop launcher and mobile build.
const svg = fs.readFileSync(path.resolve('public/favicon.svg'), 'utf8');
const browser = await chromium.launch({ channel: 'msedge', headless: true });
try {
const page = await browser.newPage({ deviceScaleFactor: 1 });
const images = [];
for (const size of [16, 32, 48, 256]) {
await page.setViewportSize({ width: size, height: size });
await page.setContent('<style>html,body{margin:0;background:transparent}svg{display:block;width:100vw;height:100vh}</style>' + svg);
images.push({ size, bytes: await page.screenshot({ omitBackground: true }) });
}
fs.writeFileSync('public/workbench-icon.png', images.at(-1).bytes);
const header = Buffer.alloc(6 + images.length * 16);
header.writeUInt16LE(1, 2); header.writeUInt16LE(images.length, 4);
let offset = header.length;
for (let index = 0; index < images.length; index++) {
const { size, bytes } = images[index], position = 6 + index * 16;
header[position] = size === 256 ? 0 : size; header[position + 1] = size === 256 ? 0 : size;
header.writeUInt16LE(1, position + 4); header.writeUInt16LE(32, position + 6);
header.writeUInt32LE(bytes.length, position + 8); header.writeUInt32LE(offset, position + 12);
offset += bytes.length;
}
fs.writeFileSync('public/workbench-icon.ico', Buffer.concat([header, ...images.map(image => image.bytes)]));
console.log('Orven icons generated: PNG 256px; ICO 16/32/48/256px.');
} finally { await browser.close(); }
+12
View File
@@ -0,0 +1,12 @@
// Keep acceptance drivers on the product's real navigation after the Orven redesign.
// This opens a visible entry or the searchable toolbox; it never bypasses the UI.
export async function openWorkbenchTool(page, name) {
const aliases = { '打开模型中心': '选择与管理模型', '项目MCP工具': '项目 MCP 工具' };
const direct = page.getByRole('button', { name: aliases[name] ?? name, exact: true });
if (await direct.first().isVisible()) { await direct.first().click(); return; }
await page.getByRole('button', { name: '打开工具箱', exact: true }).click();
const toolbox = page.getByRole('dialog', { name: '工具箱', exact: true });
const actionName = name === '打开模型中心' ? '模型中心' : aliases[name] ?? name;
await toolbox.getByLabel('搜索工作台工具').fill(actionName);
await toolbox.getByRole('button', { name: actionName, exact: true }).click();
}
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; 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)); page.on('pageerror', cause => errors.push(cause.message));
const mark = message => { checks.push(message); console.log('PASS ' + message); }; const mark = message => { checks.push(message); console.log('PASS ' + message); };
const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true }); 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) { async function shot(name) {
const file = path.join(directory, name + '.png'); await page.screenshot({ path: file }); screenshots.push(file); 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); assert.ok(await page.locator('body').evaluate(node => node.scrollWidth <= innerWidth), 'page overflow: ' + name);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; 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; let mobile, relay, gatewayStatus, cookie = '', disconnected = false;
try { 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.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(); const panel = desktop.getByRole('dialog', { name: '手机连接', exact: true }); await expect(panel).toBeVisible();
await expect(panel).toContainText('默认关闭'); await expect(panel).toContainText('默认关闭');
const initial = await host.api('/companion'); assert.ok(initial.addresses.length, 'Requires an actual owned private IPv4 interface.'); const initial = await host.api('/companion'); assert.ok(initial.addresses.length, 'Requires an actual owned private IPv4 interface.');
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
@@ -41,8 +42,8 @@ async function closeInspector() {
await expect(close).toHaveCount(1); await expect(close).toHaveCount(1);
if (await close.isVisible()) { await close.click(); await expect(page.locator('.inspector')).toBeHidden(); } 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 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 page.getByRole('button', { name: '本地代理引擎', exact: true }).click(); await expect(runPanel()).toBeVisible(); } 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 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 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() { async function applyOne() {
+4 -3
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
@@ -54,7 +55,7 @@ try {
await page.getByRole('combobox', { name: '当前项目', exact: true }).selectOption(project.id); await page.getByRole('combobox', { name: '当前项目', exact: true }).selectOption(project.id);
if (native) { 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'); 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(); const pending = page.getByRole('button', { name: '选择项目文件夹', exact: true }).click();
console.log(JSON.stringify({ nativePickerReady: true, expectedPath: chosenRoot, electronPid: pid, hostPid: original.pid, root })); 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; 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 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 }); 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]); 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)); 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 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)]; 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.' }); 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'; 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 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()); await until(() => page.getByRole('button', { name: '停止并退出', exact: true }).isEnabled());
assert.equal((await controller.connect()).identity.instanceId, original.instanceId); assert.equal((await controller.connect()).identity.instanceId, original.instanceId);
await application.evaluate(({ dialog }) => { dialog.showMessageBox = async () => ({ response: 1 }); }); await application.evaluate(({ dialog }) => { dialog.showMessageBox = async () => ({ response: 1 }); });
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import { releaseEvidencePrefix } from './qa-evidence.mjs'; import { releaseEvidencePrefix } from './qa-evidence.mjs';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; 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; 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(); 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.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'); await textContains(panel(), '已找到 0.2.1-rc.2');
} }
async function detect(installationRoot) { async function detect(installationRoot) {
@@ -117,7 +118,7 @@ try {
await page.locator('.session-list button').filter({ hasText: other.title }).click(); selectedRoute = '/sessions/' + other.id; 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); const lateResponse = page.waitForResponse(response => response.url().includes('/engines/deepseek/availability') && response.status() === 500);
release(); await lateResponse; await page.unroute(pattern); 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(), '先验证这个安装能否连接'); 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); 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'); mark('late detection failure from a closed panel cannot appear in a different task or reveal its prior engine records');
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; 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'); 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)); 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.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'); 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('费用未报告'); 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))});} 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'); 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)); 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); const plan=(await host.api(route+'/check-plans',{names:['test','build']})).execution.plans.at(-1),job=(await host.api(route+'/check-jobs',{planId:plan.id})).execution.checks.at(-1);let checked;await until(async()=>{checked=await host.api(route+'/check-jobs/'+job.id);return !['queued','running'].includes(checked.status);});assert.equal(checked.status,'passed',checked.summary);
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; 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 panel=()=>page.getByLabel('工程评测控制台',{exact:true});
const mark=value=>{assertions.push(value);console.log('PASS '+value);}; 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 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 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 refresh=async()=>{await panel().getByRole('button',{name:'刷新',exact:true}).click();};
const latest=()=>[...f.store.core.evaluation.values()].at(-1); 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 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');} 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; let result;
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
@@ -35,7 +36,7 @@ const mark = value => { assertions.push(value); console.log('PASS ' + value); };
try { 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.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.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 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); const row = history.locator('.mcp-history-row.state-unknown'); await expect(row).toHaveCount(1);
await row.getByRole('button', { name: '查看原始输入', exact: true }).click(); await row.getByRole('button', { name: '查看原始输入', exact: true }).click();
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
@@ -22,7 +23,7 @@ const mark = value => { assertions.push(value); console.log('PASS ' + value); };
try { 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.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.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 dialog = page.getByRole('dialog', { name: '项目 MCP 工具', exact: true }); await expect(dialog).toBeVisible();
const form = dialog.locator('.mcp-register'); const form = dialog.locator('.mcp-register');
await form.getByLabel('显示名称', { exact: true }).fill('只读与工程工具'); 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'); 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.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(); const mobileDialog = page.getByRole('dialog', { name: '项目 MCP 工具', exact: true }); await expect(mobileDialog).toBeVisible();
await expect(mobileDialog.locator('.mcp-registration')).toHaveCount(1); await expect(mobileDialog.locator('.mcp-registration')).toHaveCount(1);
assert.ok(await page.locator('body').evaluate(node => node.scrollWidth <= 390)); assert.ok(await page.locator('body').evaluate(node => node.scrollWidth <= 390));
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import net from 'node:net'; 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; let host, controller, browser, application, page, window, result;
const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true }); const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true });
const mark = name => { checks.push(name); console.log('PASS ' + name); }; 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) { 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)); } 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 }); else await page.setViewportSize({ width, height: 1080 });
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import net from 'node:net'; 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') }); 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()); 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 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(); } async function fetchModels() { await catalog().getByRole('button', { name: /获取上游模型|重新获取模型目录/ }).click(); await expect(catalog().getByLabel('上游模型列表', { exact: true })).toBeVisible(); }
try { try {
+1 -1
View File
@@ -24,7 +24,7 @@ page.on('requestfailed', request => requestFailures.push(request.url() + ': ' +
const mark = value => { marks.push(value); console.log('PASS ' + value); }; const mark = value => { marks.push(value); console.log('PASS ' + value); };
try { try {
await page.goto(host.url); await page.waitForLoadState('networkidle'); 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(); const dialog = page.getByRole('dialog', { name: '模型中心', exact: true }); await expect(dialog).toBeVisible();
await dialog.getByRole('button', { name: '手动填写(兼容)', exact: true }).click(); await dialog.getByRole('button', { name: '手动填写(兼容)', exact: true }).click();
const editor = dialog.getByRole('form', { name: '编辑模型连接', exact: true }); const editor = dialog.getByRole('form', { name: '编辑模型连接', exact: true });
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; 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' }); member = await host.api('/model-center/connections', { ...member, apiKey: 'owned-ui-private-key' });
const mark = text => { checks.push(text); console.log('PASS ' + text); }; 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 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) { async function run(prompt) {
await page.getByLabel('任务内容').fill(prompt); await page.getByRole('button', { name: '发送任务', exact: true }).click(); 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); let id; await until(async () => { id = (await host.api('/sessions')).find(value => value.title === prompt)?.id; return id && (await host.api('/sessions/' + id)).status === 'failed'; }, 15000);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; import http from 'node:http';
@@ -29,7 +30,7 @@ const host=await launchWorkbench(t,f.data,{}, {appRoot,nodePath});assert.notEqua
let browser,page,result; 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 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 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{ try{
browser=await chromium.launch({channel:'msedge',headless:true});page=await browser.newPage({viewport:{width:1440,height:1000}}); 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'); page.on('pageerror',e=>errors.push(e.message));await page.goto(host.url);await page.waitForLoadState('networkidle');
+6 -5
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; import http from 'node:http';
@@ -57,7 +58,7 @@ let mobile, relay, cookie = '', gateway;
try { 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.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.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 }); const dialog = page.getByRole('dialog', { name: '模型中心', exact: true });
await dialog.getByRole('button', { name: '手动填写(兼容)', exact: true }).click(); await dialog.getByRole('button', { name: '手动填写(兼容)', exact: true }).click();
const form = dialog.getByRole('form', { name: '编辑模型连接', exact: true }); 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 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 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 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 · 流式开启'); 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'); 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); 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'); 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 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; 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(); 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('按能力选择的验收池'); 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(); 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); 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); 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')); 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('只支持文本'); await expect(dialog.locator('.mc-route-rejections').first()).toContainText('只支持文本');
const downloadEvent = page.waitForEvent('download'); await dialog.getByRole('button', { name: '下载已保存的响应', exact: true }).first().click(); 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); 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); 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); 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); 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 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'); 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'); mark('truncated output keeps explicit unknown ledger, partial evidence and no automatic failover or incomplete tool execution');
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; 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'); 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 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(select()).toHaveValue('connection:' + selected.id); await close();
await expect(page.getByRole('button', { name: '切换当前模型' })).toContainText(selected.name); await expect(page.getByRole('button', { name: '切换当前模型' })).toContainText(selected.name);
await page.getByRole('button', { name: '切换当前模型' }).click(); await select().selectOption('demo'); await expect(select()).toHaveValue('demo'); await page.getByRole('button', { name: '切换当前模型' }).click(); await select().selectOption('demo'); await expect(select()).toHaveValue('demo');
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import http from 'node:http'; 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') }); screenshots.push({ path: file, sha256: createHash('sha256').update(fs.readFileSync(file)).digest('hex') });
}; };
const openWaits = async () => { const openWaits = async () => {
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 expect(page.getByRole('form', { name: '模型等待时限' })).toBeVisible(); await expect(page.getByRole('form', { name: '模型等待时限' })).toBeVisible();
}; };
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import net from 'node:net'; import net from 'node:net';
@@ -33,7 +34,7 @@ page.on('pageerror', error => errors.push(error.message));
let result; let result;
const mark = value => { checks.push(value); console.log('PASS ' + value); }; 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 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 tab = dialog => dialog.getByRole('navigation', { name: '模型中心分类' }).getByRole('button', { name: '连接诊断', exact: true });
const panel = () => page.getByRole('region', { name: '模型连接诊断', exact: true }); const panel = () => page.getByRole('region', { name: '模型连接诊断', exact: true });
const start = async () => { await panel().getByRole('button', { name: '开始直连检查', exact: true }).click(); }; const start = async () => { await panel().getByRole('button', { name: '开始直连检查', exact: true }).click(); };
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
@@ -35,7 +36,7 @@ try {
assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1)); 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); 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(); 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 })).toHaveValue('unrestricted');
await expect(dialog.getByLabel('输出上限', { exact: true })).toHaveCount(0); await expect(dialog.getByLabel('输出上限', { exact: true })).toHaveCount(0);
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; 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);}; 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 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(); 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');} async function detect(){await control().getByRole('button',{name:'检测 Purge 来源',exact:true}).click();await expect(control()).toContainText('已核对 Purge 1.1.78');}
let report; let report;
try{ try{
@@ -71,7 +72,7 @@ try{
// closing it, so a late navigation result cannot reopen it over the toolbar. // closing it, so a late navigation result cannot reopen it over the toolbar.
await expect(panel()).toBeHidden(); 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(); 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); 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); 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); assert.equal(fs.readFileSync(file,'utf8'),originalEngineRun(f.store,session,job));assert.equal(hash(fs.readFileSync(file)),job.reportSha256);
+45
View File
@@ -0,0 +1,45 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { _electron } from 'playwright';
import { fixture, launchWorkbench } from '../tests/helpers.mjs';
import { projectEnvironment } from '../src/core/process-environment.mjs';
import { openWorkbenchTool } from './ui-navigation.mjs';
const disposers = [], t = { after: dispose => disposers.push(dispose) };
const f = fixture(t, { modernDefaults: true }); f.store.close();
const host = await launchWorkbench(t, f.data);
assert.notEqual(new URL(host.url).port, '4318');
const output = path.resolve('output/playwright/orven'); fs.mkdirSync(output, { recursive: true });
let app;
try {
app = await _electron.launch({ executablePath: path.resolve('node_modules/electron/dist/electron.exe'),
args: [path.resolve('dist-desktop/main.cjs'), '--app-root', process.cwd(), '--data-root', f.data, '--node', process.execPath, '--port', new URL(host.url).port, '--hidden-window'],
env: projectEnvironment(), cwd: process.cwd(), timeout: 60000 });
const page = await app.firstWindow(), errors = [];
page.on('pageerror', error => errors.push(error.message));
await page.locator('.connection.connected').waitFor({ timeout: 30000 });
assert.equal(await app.evaluate(({ app }) => app.getName()), 'Orven');
assert.equal(await page.title(), 'Orven · AI 开发工作台');
const native = await app.browserWindow(page);
assert.equal(await native.evaluate(window => window.getTitle()), 'Orven · AI 开发工作台');
// A never-shown native window does not produce compositor frames on Windows.
// Show without taking focus for capture, then close this owned fixture below.
await native.evaluate(window => window.showInactive());
await page.screenshot({ path: path.join(output, 'native-desktop.png'), timeout: 10000 });
await openWorkbenchTool(page, '桌面宿主');
await page.getByRole('dialog', { name: '桌面与后台任务' }).waitFor();
await page.getByText('执行宿主正在运行', { exact: true }).waitFor();
await page.locator('.desktop-host-facts').waitFor();
await page.screenshot({ path: path.join(output, 'native-host.png') });
assert.deepEqual(errors, []);
const result = { appName: 'Orven', nativeTitle: 'Orven · AI 开发工作台', isolatedHost: true, productionTouched: false, realModelCalls: 0, errors };
fs.writeFileSync(path.join(output, 'desktop-result.json'), JSON.stringify(result, null, 2));
console.log('PASS actual Electron window: Orven application/title, rendered workspace and native host navigation');
} catch (error) {
fs.writeFileSync(path.join(output, 'desktop-failure.json'), JSON.stringify({ error: error.message, isolatedHost: true }, null, 2));
throw error;
} finally {
if (app) await app.close();
for (const dispose of disposers.reverse()) await dispose();
}
+196
View File
@@ -0,0 +1,196 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { chromium, expect } from 'playwright/test';
import { fixture, compatibleFixture, completion, call, launchWorkbench } from '../tests/helpers.mjs';
// Real browser + real isolated host + local protocol fixture. No real model or user project.
const output = path.resolve('output/playwright/orven');
fs.mkdirSync(output, { recursive: true });
const disposers = [], t = { after: dispose => disposers.push(dispose) };
const f = fixture(t, { modernDefaults: true });
fs.writeFileSync(path.join(f.projectRoot, 'README.md'), '# Orven UI fixture\n\n用于独立界面验证的项目。\n');
let modelCalls = 0;
const model = await compatibleFixture(t, (url, input) => {
assert.equal(url, '/v1/chat/completions');
assert.equal(input.model, 'orven-ui-fixture');
modelCalls++;
if (modelCalls === 1) return completion([call('orven-read', 'read_file', { path: 'README.md' })]);
if (modelCalls === 2) return completion([call('orven-write', 'propose_file', { path: 'ORVEN-NOTES.md', content: '# Orven 验证\n\n已读取项目,完成本机受控接口验证。\n', reason: '只用于本次独立 UI 验证' })]);
return completion([], '已读取 README.md,并写入 ORVEN-NOTES.md。本次使用本机协议夹具,没有调用真实模型。');
});
f.store.close();
const host = await launchWorkbench(t, f.data);
assert.notEqual(new URL(host.url).port, '4318');
const browser = await chromium.launch({ channel: 'msedge', headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 960 }, deviceScaleFactor: 1 });
page.setDefaultTimeout(12000);
const errors = [], checks = [];
page.on('pageerror', error => errors.push(error.message));
const mark = value => { checks.push(value); console.log('PASS ' + value); };
const shot = async name => page.screenshot({ path: path.join(output, name + '.png'), fullPage: true });
const tool = async name => {
await page.keyboard.press('Escape');
await page.getByRole('button', { name: '打开工具箱', exact: true }).click();
const dialog = page.getByRole('dialog', { name: '工具箱', exact: true });
await dialog.getByLabel('搜索工作台工具').fill(name);
await dialog.getByRole('button', { name, exact: true }).click();
};
const bounds = async () => {
const value = await page.evaluate(() => {
const footer = document.querySelector('.composer-wrap').getBoundingClientRect();
return { width: innerWidth, height: innerHeight, scrollWidth: document.documentElement.scrollWidth, scrollHeight: document.documentElement.scrollHeight, footer: footer.bottom };
});
assert.ok(value.scrollWidth <= value.width + 1 && value.scrollHeight <= value.height + 1, JSON.stringify(value));
assert.ok(value.footer <= value.height + 1, JSON.stringify(value));
};
try {
await page.goto(host.url);
await page.locator('.connection.connected').waitFor();
await expect(page).toHaveTitle('Orven · AI 开发工作台');
await expect(page.getByRole('heading', { name: '今天,想实现什么?' })).toBeVisible();
await expect(page.locator('.inspector')).not.toBeVisible();
await bounds(); await shot('desktop');
mark('Orven identity, actual project context and focused new-task surface');
const before = (await host.api('/bootstrap')).sessions.length;
await page.locator('.starter-prompts button').filter({ hasText: '读懂项目' }).click();
const draft = await page.getByLabel('任务内容').inputValue();
assert.match(draft, /了解这个项目/);
assert.equal((await host.api('/bootstrap')).sessions.length, before);
await page.getByRole('button', { name: '发送任务', exact: true }).click();
const center = page.getByRole('dialog', { name: '模型中心', exact: true });
await expect(center).toBeVisible(); assert.equal(modelCalls, 0);
await page.keyboard.press('Escape');
await expect(page.getByLabel('任务内容')).toHaveValue(draft);
mark('starter prompts do not execute; missing model preserves input and opens connection setup');
await page.keyboard.press('Control+k');
await expect(page.getByLabel('搜索工作台工具')).toBeFocused();
await page.getByLabel('搜索工作台工具').fill('a-tool-that-does-not-exist');
await expect(page.locator('.tools-empty')).toContainText('没有找到');
await page.getByRole('button', { name: '清除搜索' }).click();
await page.getByLabel('搜索工作台工具').fill('项目文件');
await page.getByLabel('搜索工作台工具').press('ArrowDown');
await expect(page.getByRole('button', { name: '项目文件', exact: true })).toBeFocused();
await page.keyboard.press('Enter');
await expect(page.getByRole('tab', { name: /^文件/ })).toHaveAttribute('aria-selected', 'true');
await expect(page.getByLabel('筛选文件')).toBeFocused();
await page.getByLabel('筛选文件').fill('missing-orven-file');
await expect(page.locator('.sidebar-hint')).toContainText('没有匹配');
await page.getByLabel('筛选文件').fill('README');
await page.locator('.tree-row[title="README.md"]').click();
await expect(page.locator('.code-view')).toContainText('Orven UI fixture');
await page.getByRole('button', { name: '关闭检视区', exact: true }).click();
await expect(page.getByLabel('任务内容')).toHaveValue(draft);
mark('tool search, no-result recovery, keyboard selection and real file preview preserve the draft');
await page.getByRole('button', { name: '切换当前模型', exact: true }).click();
await center.getByRole('button', { name: '手动填写(兼容)', exact: true }).click();
const editor = center.getByRole('form', { name: '编辑模型连接' });
await editor.getByLabel('连接名称', { exact: true }).fill('Orven 本机验证');
await editor.getByLabel('接口根地址', { exact: true }).fill(model.baseUrl);
await editor.getByLabel('请求模型名称', { exact: true }).fill('orven-ui-fixture');
await editor.getByLabel('服务需要 API Key', { exact: true }).uncheck();
await editor.getByRole('button', { name: '保存模型连接', exact: true }).click();
const connection = center.locator('.mc-connection').filter({ hasText: 'Orven 本机验证' });
await connection.getByRole('button', { name: '用于新任务', exact: true }).click();
await expect(center.locator('.mc-current')).toContainText('Orven 本机验证');
await center.getByRole('button', { name: '请求账本', exact: true }).click();
await expect(center.getByLabel('默认模型选择')).not.toBeVisible();
await center.getByRole('button', { name: '模型连接', exact: true }).click();
await shot('models'); await page.keyboard.press('Escape');
await page.reload(); await page.locator('.connection.connected').waitFor();
await expect(page.getByRole('button', { name: '切换当前模型', exact: true })).toContainText('Orven 本机验证');
assert.equal(modelCalls, 0);
mark('model creation and selection persist across refresh; setup emits no model requests');
await page.getByLabel('任务内容').fill('只读取 README.md,并写一个 ORVEN-NOTES.md 说明。无需检查,无需 Git。');
await page.getByRole('button', { name: '发送任务', exact: true }).click();
await expect(page.locator('.message-assistant')).toContainText('本机协议夹具', { timeout: 20000 });
assert.equal(modelCalls, 3);
assert.match(fs.readFileSync(path.join(f.projectRoot, 'ORVEN-NOTES.md'), 'utf8'), /已读取项目/);
await expect(page.locator('.composer textarea')).toBeEmpty();
await tool('查看改动');
await expect(page.locator('.diff-view')).toContainText('已读取项目');
await shot('task-results');
await page.getByRole('button', { name: '关闭检视区', exact: true }).click();
await page.reload(); await page.locator('.connection.connected').waitFor();
await expect(page.locator('.message-assistant')).toContainText('本机协议夹具');
mark('real three-request local protocol flow reads and writes the owned project; diff and conversation survive refresh');
await page.getByLabel('操作权限').selectOption('auto');
await expect.poll(async () => (await host.api('/bootstrap')).config.approvalMode).toBe('auto');
await page.reload(); await page.locator('.connection.connected').waitFor();
await expect(page.getByLabel('操作权限')).toHaveValue('auto');
mark('permission choice is saved and restored rather than shown as a cosmetic selection');
await page.keyboard.press('Control+p');
await page.getByLabel('筛选文件').fill('README');
await page.locator('.tree-row[title="README.md"]').click();
await expect(page.locator('.code-view')).toContainText('Orven UI fixture');
await page.getByRole('button', { name: '编辑文件', exact: true }).click();
const original = await page.getByLabel('编辑文件内容').inputValue();
await page.getByLabel('编辑文件内容').fill(original + '\n本次编辑应保留到冲突处理。\n');
fs.writeFileSync(path.join(f.projectRoot, 'README.md'), original + '\n外部已更新。\n');
await page.getByRole('button', { name: '保存为提案', exact: true }).click();
await expect(page.locator('.toast')).toBeVisible();
assert.match(fs.readFileSync(path.join(f.projectRoot, 'README.md'), 'utf8'), /外部已更新/);
assert.ok(!fs.readFileSync(path.join(f.projectRoot, 'README.md'), 'utf8').includes('本次编辑应保留'));
await expect(page.getByLabel('编辑文件内容')).toHaveValue(original + '\n本次编辑应保留到冲突处理。\n');
await shot('file-conflict');
mark('external file conflict preserves external bytes and unsaved editor input, with a visible recovery message');
await page.getByRole('button', { name: '取消编辑', exact: true }).click();
await page.locator('.tree-row[title="README.md"]').click();
await expect(page.locator('.code-view')).toContainText('外部已更新');
const toastClose = page.getByRole('button', { name: '关闭提示', exact: true });
if (await toastClose.isVisible()) await toastClose.click();
await page.getByRole('button', { name: '关闭检视区', exact: true }).click();
for (const width of [1280, 1024, 768, 390]) {
await page.setViewportSize({ width, height: width === 390 ? 844 : 800 });
await bounds();
}
await page.getByRole('button', { name: '展开项目栏', exact: true }).click();
await page.getByRole('tab', { name: /^会话/ }).click();
await expect(page.locator('.session-list')).toContainText('只读取');
await page.getByRole('button', { name: '关闭侧边面板', exact: true }).click({ position: { x: 380, y: 350 } });
await page.getByRole('button', { name: '文件与成果', exact: true }).click();
await expect(page.getByRole('button', { name: '关闭检视区', exact: true })).toBeVisible();
await shot('mobile-results');
await page.keyboard.press('Escape');
await expect(page.getByRole('button', { name: '发送任务', exact: true })).toBeVisible();
await shot('mobile-conversation');
mark('1280/1024/768/390 layouts keep the document contained; mobile navigation and result drawer work');
await page.setViewportSize({ width: 1440, height: 960 });
await tool('项目技能');
await expect(page.getByRole('dialog', { name: '项目技能', exact: true })).toBeVisible();
await shot('skills'); await page.keyboard.press('Escape');
await tool('项目 MCP 工具');
await expect(page.getByRole('dialog', { name: '项目 MCP 工具', exact: true })).toBeVisible();
await shot('mcp'); await page.keyboard.press('Escape');
await tool('运行诊断');
await expect(page.getByRole('dialog', { name: '运行诊断', exact: true })).toBeVisible();
await page.locator('.diagnostic-panel').waitFor();
await shot('diagnostics'); await page.keyboard.press('Escape');
mark('skills, MCP and diagnostics remain connected through the new tool navigation');
await page.goto(host.url + '/brand.html');
await expect(page.getByRole('heading', { level: 1 })).toContainText('运行中的作品');
await page.getByRole('button', { name: '查看深色背景', exact: true }).click();
await expect(page.locator('#specimen')).toHaveAttribute('data-dark', 'true');
await page.getByRole('button', { name: '查看品牌色背景', exact: true }).click();
await shot('brand');
for (const asset of ['/brand/orven-symbol.svg', '/brand/orven-wordmark.svg', '/workbench-icon.png', '/workbench-icon.ico']) assert.equal((await fetch(host.url + asset)).status, 200);
assert.deepEqual(errors, []);
mark('brand page, interactive mark backgrounds and downloadable SVG/PNG/ICO assets render without browser errors');
fs.writeFileSync(path.join(output, 'result.json'), JSON.stringify({ checks, errors, modelCalls, realModelCalls: 0, fixtureOnly: true, userDataAccessed: false }, null, 2));
} catch (error) {
await shot('failure').catch(() => {});
fs.writeFileSync(path.join(output, 'failure.json'), JSON.stringify({ checks, errors, modelCalls, message: error.message }, null, 2));
throw error;
} finally {
await browser.close();
for (const dispose of disposers.reverse()) await dispose();
}
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; 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); }; 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 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 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); } 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; let result, releaseLate;
try { try {
@@ -89,7 +90,7 @@ try {
assert.equal(job.native.readiness.promptExperimentSha256, bound.sha256); assert.deepEqual(ownerBytes(f), original); 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'); 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 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); 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 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); const reportPath = path.join(directory, 'original-engine-report.json'); await download.saveAs(reportPath);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import net from 'node:net'; 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()); fs.writeFileSync(path.join(directory, name + '.txt'), await page.locator('body').innerText());
} }
async function edit(name) { 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 dialog().locator('.mc-connection').filter({ has: page.getByRole('heading', { name, exact: true }) }).getByRole('button', { name: '推理与能力', exact: true }).click();
await form().waitFor(); await form().waitFor();
} }
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import { releaseEvidencePrefix } from './qa-evidence.mjs'; import { releaseEvidencePrefix } from './qa-evidence.mjs';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; 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) { async function openProject(projectId = project.id, title = original.title) {
await page.goto(host.url); await page.waitForLoadState('networkidle'); 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.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) { async function register(filename, label) {
const before = (await state()).execution.researchTargets.length; const before = (await state()).execution.researchTargets.length;
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; 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); }, await page.addInitScript(({ projectId, sessionId }) => { localStorage.setItem('awb-project', projectId); localStorage.setItem('awb-session', sessionId); },
{ projectId: f.project.id, sessionId: f.session.id }); { projectId: f.project.id, sessionId: f.session.id });
await page.goto(host.url); await page.waitForLoadState('networkidle'); 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 dialog = page.getByRole('dialog', { name: '项目技能', exact: true }); await expect(dialog).toBeVisible();
const editor = dialog.locator('.skill-register'); const editor = dialog.locator('.skill-register');
await editor.getByLabel('技能名称', { exact: true }).fill('工程交付核验'); await editor.getByLabel('技能名称', { exact: true }).fill('工程交付核验');
+3 -2
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
@@ -155,7 +156,7 @@ try {
await page.reload({ waitUntil: 'domcontentloaded' }); await page.reload({ waitUntil: 'domcontentloaded' });
await expect(page.locator('.work-title h1')).toHaveText(second.title); await expect(page.locator('.work-title h1')).toHaveText(second.title);
const downloadPromise = page.waitForEvent('download'); 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')); 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); 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'); mark('denial, session selection, reload, stale response rejection and export');
@@ -200,7 +201,7 @@ try {
stage = 'research'; await page.setViewportSize({ width: 1440, height: 960 }); stage = 'research'; await page.setViewportSize({ width: 1440, height: 960 });
if (!(await page.locator('.project-sidebar').isVisible())) await page.getByRole('button', { name: '展开项目栏', exact: true }).click(); 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: '机制研究与独立设计' }); const research = page.getByRole('dialog', { name: '机制研究与独立设计' });
await expect(research.locator('.research-content')).toContainText('统一机制报告'); await expect(research.locator('.research-content')).toContainText('统一机制报告');
assert.ok(await research.locator('table').count() >= 2); assert.ok(await research.locator('table').count() >= 2);
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import net from 'node:net'; 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 editor = () => dialog().getByRole('form', { name: '编辑模型连接', exact: true });
const card = () => dialog().locator('[data-connection-id="legacy-default"]'); const card = () => dialog().locator('[data-connection-id="legacy-default"]');
const mark = message => { marks.push(message); console.log('PASS ' + message); }; 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 shot(name) { const file = path.join(directory, name + '.png'); await page.screenshot({ path: file, fullPage: true }); screenshots.push(file); }
async function resize(width) { 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)); } if (window) { await window.evaluate((win, size) => win.setContentSize(size.width, size.height), { width, height: 1080 }); await until(() => page.evaluate(w => innerWidth === w, width)); }
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import net from 'node:net'; 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; let host, controller, browser, application, page, window, result, ownedFailure = false, browserUrl, browserTurn = 0, ownedTabId;
const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true }); const dialog = () => page.getByRole('dialog', { name: '模型中心', exact: true });
const mark = name => { checks.push(name); console.log('PASS ' + name); }; 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) { 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)); } 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 }); else await page.setViewportSize({ width, height: 1080 });
+2 -1
View File
@@ -1,3 +1,4 @@
import { openWorkbenchTool } from './ui-navigation.mjs';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import assert from 'node:assert/strict'; 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 panel = () => page.getByLabel('隔离协作控制台', { exact: true }), groupState = id => f.store.core.collaboration.get(id);
const mark = text => { assertions.push(text); console.log('PASS ' + text); }; 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 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 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 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) { async function applyUi(count, prepared = false) {
+68 -31
View File
@@ -26,6 +26,9 @@ import { desktop } from './desktop';
import { AttachmentComposer,InputImage } from './InputAttachments'; import { AttachmentComposer,InputImage } from './InputAttachments';
import { BudgetPausePanel } from './BudgetPausePanel'; import { BudgetPausePanel } from './BudgetPausePanel';
import { PermissionModeControl } from './PermissionModeControl'; 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 activeStates = ['running', 'awaiting_approval', 'stopping'];
const activeMcpStates = ['queued', 'connecting', 'discovering', 'calling', 'closing', 'stopping']; const activeMcpStates = ['queued', 'connecting', 'discovering', 'calling', 'closing', 'stopping'];
@@ -72,6 +75,9 @@ export default function App() {
const [inspectorWidth,setInspectorWidth]=useState<number|null>(null),[inspectorResizing,setInspectorResizing]=useState(false); const [inspectorWidth,setInspectorWidth]=useState<number|null>(null),[inspectorResizing,setInspectorResizing]=useState(false);
const inspectorDrag=useRef<{x:number;width:number}|null>(null); const inspectorDrag=useRef<{x:number;width:number}|null>(null);
const [sidebarOpen, setSidebarOpen] = useState(() => window.innerWidth > 620); 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 [narrow, setNarrow] = useState(() => window.innerWidth <= 940);
const [viewportWidth,setViewportWidth]=useState(()=>window.innerWidth); const [viewportWidth,setViewportWidth]=useState(()=>window.innerWidth);
const [mobile, setMobile] = useState(() => window.innerWidth <= 620); const [mobile, setMobile] = useState(() => window.innerWidth <= 620);
@@ -192,6 +198,7 @@ export default function App() {
}); });
} }
function showInspector(next: 'file' | 'changes' | 'trace' | 'task' | 'index' | 'browse') { function showInspector(next: 'file' | 'changes' | 'trace' | 'task' | 'index' | 'browse') {
setInspectorOpen(true);
setTab(next); setTab(next);
if (window.innerWidth <= 940) setWide(true); if (window.innerWidth <= 940) setWide(true);
if (window.innerWidth <= 620) setSidebarOpen(false); if (window.innerWidth <= 620) setSidebarOpen(false);
@@ -520,7 +527,8 @@ export default function App() {
}, []); }, []);
useEffect(() => { useEffect(() => {
const handler = (event: KeyboardEvent) => { 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); } 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); 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 sidebarWidth=sidebarOpen?(viewportWidth>=1700?260:viewportWidth<=1120?210:242):0;
const maximumInspector=Math.max(310,Math.min(1000,viewportWidth-sidebarWidth-320)); const maximumInspector=Math.max(310,Math.min(1000,viewportWidth-sidebarWidth-320));
const resizeInspector=(width:number)=>setInspectorWidth(Math.max(310,Math.min(maximumInspector,width))); 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 ( return (
<div className={'workbench ' + (sidebarOpen ? '' : 'sidebar-hidden ') + (wide ? 'inspector-wide ' : '')+(inspectorResizing?'inspector-resizing':'')} <div className={'workbench orven-workbench ' + (sidebarOpen ? '' : 'sidebar-hidden ') + (inspectorOpen ? 'inspector-open ' : 'inspector-closed ') + (wide ? 'inspector-wide ' : '')+(inspectorResizing?'inspector-resizing':'')}
style={!narrow&&inspectorWidth!==null?{gridTemplateColumns:sidebarWidth+'px minmax(310px,1fr) '+Math.min(maximumInspector,inspectorWidth)+'px'}:undefined}> style={!narrow&&inspectorOpen&&inspectorWidth!==null?{gridTemplateColumns:sidebarWidth+'px minmax(310px,1fr) '+Math.min(maximumInspector,inspectorWidth)+'px'}:undefined}>
<aside className="project-sidebar"> <aside className="project-sidebar">
<div className="brand"><span className="brand-mark">AW</span><div><strong>Agent Workbench</strong><span>本地编程工作台 · 正式版</span></div><IconButton label="收起项目栏" onClick={() => setSidebarOpen(false)}><PanelLeftClose size={16} /></IconButton></div> <div className="brand"><span className="brand-mark"><OrvenMark size={27} /></span><div><strong>{BRAND.name}</strong><span>{BRAND.category}</span></div><IconButton label="收起项目栏" onClick={() => setSidebarOpen(false)}><PanelLeftClose size={17} /></IconButton></div>
<div className="project-selector"><span className="field-eyebrow">当前项目</span><div className="project-select-row"><FolderOpen size={17} /><select aria-label="当前项目" value={projectId} onChange={event => chooseProject(event.target.value)}>{projects.map(project => <option key={project.id} value={project.id}>{project.name}{project.id === exampleId ? '(示例)' : ''}</option>)}{!projects.length && <option value="">选择一个项目</option>}</select><IconButton label="打开项目" onClick={() => setProjectOpen(true)}><Plus size={15} /></IconButton></div>{selectedProject && <span className="project-root" title={selectedProject.root}>{selectedProject.root}</span>}{projectId === exampleId && <span className="example-tag">当前为自带示例,可打开自己的项目开始开发</span>}</div> <div className="project-selector"><span className="field-eyebrow">当前项目</span><div className="project-select-row"><FolderOpen size={17} /><select aria-label="当前项目" value={projectId} onChange={event => chooseProject(event.target.value)}>{projects.map(project => <option key={project.id} value={project.id}>{project.name}{project.id === exampleId ? '(示例)' : ''}</option>)}{!projects.length && <option value="">选择一个项目</option>}</select><IconButton label="打开项目" onClick={() => setProjectOpen(true)}><Plus size={15} /></IconButton></div>{selectedProject && <span className="project-root" title={selectedProject.root}>{selectedProject.root}</span>}{projectId === exampleId && <span className="example-tag">当前为自带示例,可打开自己的项目开始开发</span>}</div>
<div className="sidebar-section sessions-section"><div className="section-label"><span>任务会话</span><IconButton label="新建任务" disabled={creatingSession || restrictedWorker} onClick={() => newSession().catch(failure)}><Plus size={15} /></IconButton></div> <button type="button" className="new-task-button" disabled={creatingSession || restrictedWorker} onClick={() => { setSidebarView('sessions'); void newSession().catch(failure); }}><Plus size={17} />新建任务<ArrowUp size={14} /></button>
<button type="button" className="new-task-button" disabled={creatingSession || restrictedWorker} onClick={() => newSession().catch(failure)}><Plus size={15} />新建任务<span>↵</span></button> <div className="sidebar-view-tabs" role="tablist" aria-label="项目导航" onKeyDown={event => { if (['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) { event.preventDefault(); const next = event.key === 'Home' ? 'sessions' : event.key === 'End' ? 'files' : sidebarView === 'sessions' ? 'files' : 'sessions'; setSidebarView(next); document.getElementById(next + '-tab')?.focus(); } }}><button id="sessions-tab" role="tab" tabIndex={sidebarView === 'sessions' ? 0 : -1} aria-selected={sidebarView === 'sessions'} aria-controls="sessions-panel" onClick={() => setSidebarView('sessions')}><MessageSquare size={14} />会话<span>{projectSessions.length}</span></button><button id="files-tab" role="tab" tabIndex={sidebarView === 'files' ? 0 : -1} aria-selected={sidebarView === 'files'} aria-controls="files-panel" onClick={() => setSidebarView('files')}><Folder size={14} />文件<span>{files.filter(file => file.kind === 'file').length}</span></button></div>
<div className="session-list">{projectSessions.slice(0, 15).map(item => <div key={item.id} className={'session-item ' + (item.id === sessionId ? 'selected' : '')}> <div id="sessions-panel" role="tabpanel" aria-labelledby="sessions-tab" hidden={sidebarView !== 'sessions'} className="sidebar-section sessions-section"><div className="section-label"><span>最近会话</span></div>
<div className="session-list">{projectSessions.map(item => <div key={item.id} className={'session-item ' + (item.id === sessionId ? 'selected' : '')}>
<button type="button" className="session-select" onClick={() => chooseSession(item.id)}><MessageSquare size={14} /><span>{item.title}</span>{item.changeCount > 0 && <b>{item.changeCount}</b>}</button> <button type="button" className="session-select" onClick={() => chooseSession(item.id)}><MessageSquare size={14} /><span>{item.title}</span>{item.changeCount > 0 && <b>{item.changeCount}</b>}</button>
{!activeStates.includes(item.status) && <IconButton label={'归档会话 ' + item.title} onClick={() => api('/sessions/' + item.id + '/archive', {}).then(() => { if (item.id === selectedSessionRef.current) selectSession(''); }).catch(failure)}><Trash2 size={12} /></IconButton>} {!activeStates.includes(item.status) && <IconButton label={'归档会话 ' + item.title} onClick={() => api('/sessions/' + item.id + '/archive', {}).then(() => { if (item.id === selectedSessionRef.current) selectSession(''); }).catch(failure)}><Trash2 size={12} /></IconButton>}
</div>)}{!projectSessions.length && <p className="sidebar-hint">开始一个任务,过程会自动保存。</p>}</div> </div>)}{!projectSessions.length && <div className="sidebar-empty"><MessageSquare size={23} strokeWidth={1.4} /><strong>留给下一个想法</strong><p>新建任务后,对话和执行记录<br />会保存在这里。</p></div>}</div>
</div> </div>
<div className="sidebar-section file-section"><div className="section-label"><span>项目文件 <b>{files.filter(file => file.kind === 'file').length}</b></span><IconButton label="刷新文件" onClick={() => refreshFiles().catch(failure)}><Folder size={14} /></IconButton></div> <div id="files-panel" role="tabpanel" aria-labelledby="files-tab" hidden={sidebarView !== 'files'} className="sidebar-section file-section"><div className="section-label"><span>项目文件</span><IconButton label="刷新文件" onClick={() => refreshFiles().catch(failure)}><RotateCw size={14} /></IconButton></div>
<div className="file-filter"><Search size={14} /><input ref={filterRef} value={filter} onChange={event => setFilter(event.target.value)} placeholder="筛选文件" aria-label="筛选文件" /><kbd>⌃ K</kbd></div> <div className="file-filter"><Search size={14} /><input ref={filterRef} value={filter} onChange={event => setFilter(event.target.value)} placeholder="筛选文件" aria-label="筛选文件" /><kbd>⌃ P</kbd></div>
<div className="file-tree">{visibleFiles.map(file => <button key={file.path} type="button" title={file.path} className={'tree-row ' + (openFile?.path === file.path ? 'selected' : '')} style={{ paddingLeft: 10 + Math.min(file.path.split('/').length - 1, 6) * 13 }} onClick={() => { <div className="file-tree">{visibleFiles.map(file => <button key={file.path} type="button" title={file.path} className={'tree-row ' + (openFile?.path === file.path ? 'selected' : '')} style={{ paddingLeft: 10 + Math.min(file.path.split('/').length - 1, 6) * 13 }} onClick={() => {
if (file.kind === 'directory') setCollapsed(previous => { const next = new Set(previous); if (next.has(file.path)) next.delete(file.path); else next.add(file.path); return next; }); else loadFile(file.path); if (file.kind === 'directory') setCollapsed(previous => { const next = new Set(previous); if (next.has(file.path)) next.delete(file.path); else next.add(file.path); return next; }); else loadFile(file.path);
}}>{file.kind === 'directory' ? <><span className="tree-chevron">{collapsed.has(file.path) ? <ChevronRight size={11} /> : <ChevronDown size={11} />}</span><Folder size={14} /></> : <><span className="tree-chevron" /><File size={13} /></>}<span>{filter ? file.path : file.name}</span></button>)}{filter && !visibleFiles.length && <p className="sidebar-hint">没有匹配的文件。</p>}</div> }}>{file.kind === 'directory' ? <><span className="tree-chevron">{collapsed.has(file.path) ? <ChevronRight size={11} /> : <ChevronDown size={11} />}</span><Folder size={14} /></> : <><span className="tree-chevron" /><File size={13} /></>}<span>{filter ? file.path : file.name}</span></button>)}{filter && !visibleFiles.length && <p className="sidebar-hint">没有匹配的文件。</p>}</div>
</div> </div>
<div className="sidebar-footer"><button onClick={openResearch}><BookOpenText size={16} />机制研究与设计<ChevronRight size={13} /></button><button onClick={() => setMemoryOpen(true)} disabled={!selectedProject || restrictedWorker}><Brain size={16} />项目记忆<ChevronRight size={13} /></button><button onClick={() => openDiagnostics()}><Activity size={16} />运行诊断<ChevronRight size={13} /></button><button className="model-sidebar-entry" onClick={() => setModelCenterOpen(true)} aria-label="选择与管理模型"><ModelServer size={16} /><span>模型与连接<small>{config.mode === 'demo' ? '尚未选择模型' : modelSelection.name || config.model || '选择模型'}</small></span><ChevronRight size={13} /></button><div className={'connection ' + (ready ? 'connected' : '')}><span />{ready ? '本地服务已连接' : '正在连接本地服务'}<button className="version-entry" aria-label="版本与更新" onClick={() => setInstallationOpen(true)}>v{version}</button></div></div> <div className="sidebar-footer"><button onClick={() => setMemoryOpen(true)} disabled={!selectedProject || restrictedWorker}><Brain size={17} />项目记忆<ChevronRight size={13} /></button><button onClick={() => setToolsOpen(true)}><Settings2 size={17} />工具与设置<kbd>⌃ K</kbd></button><button className="model-sidebar-entry" onClick={() => setModelCenterOpen(true)} aria-label="选择与管理模型"><ModelServer size={17} /><span>模型与连接<small>{config.mode === 'demo' ? '连接模型,开始协作' : modelSelection.name || config.model || '选择模型'}</small></span><ChevronRight size={13} /></button><div className={'connection ' + (ready ? 'connected' : '')}><span />{ready ? '本地服务已连接' : '正在连接本地服务'}<button className="version-entry" aria-label="版本与更新" onClick={() => setInstallationOpen(true)}>v{version}</button></div></div>
</aside> </aside>
<main className="task-pane"> <main className="task-pane">
<header className="work-header"><div className="work-title">{(!sidebarOpen || mobile) && <IconButton label="展开项目栏" onClick={() => setSidebarOpen(true)}><PanelLeftOpen size={18} /></IconButton>}<span className="header-symbol"><Code2 size={17} /></span><div><span className="header-breadcrumb">{selectedProject?.name || '工作空间'} <ChevronRight size={12} /> 任务</span><h1>{session?.title || '让任务走到完成'}</h1></div></div> <header className="work-header"><div className="work-title">{(!sidebarOpen || mobile) && <IconButton label="展开项目栏" onClick={() => setSidebarOpen(true)}><PanelLeftOpen size={18} /></IconButton>}<div><span className="header-breadcrumb">{selectedProject?.name || '工作空间'} <ChevronRight size={12} /> 工作区</span><h1>{session?.title || '新任务'}</h1></div></div>
<div className="model-launch"><button className="button secondary" onClick={() => setCompanionOpen(true)} aria-label="手机连接"><Link2 size={16} /><span>手机连接</span></button>{desktop && <button className="button secondary desktop-launch" onClick={() => setDesktopOpen(true)} aria-label="桌面宿主"><SquareTerminal size={16} /><span>桌面宿主</span></button>}<button className="button secondary" onClick={() => setModelCenterOpen(true)} aria-label="打开模型中心"><ModelServer size={16} /><span>模型中心</span></button><button className="model-button" aria-label="切换当前模型" title="选择模型、模型池或添加连接" onClick={() => setModelCenterOpen(true)}><span className="model-light" />{config.mode === 'demo' ? '选择模型' : modelSelection.name || config.model || '选择模型'}<ChevronDown size={13} /></button></div> <div className="model-launch"><button className="header-tools" onClick={() => setToolsOpen(true)} aria-label="打开工具箱"><Settings2 size={16} /><span>工具箱</span><kbd>⌃ K</kbd></button><button className="inspector-toggle" aria-label="文件与成果" aria-pressed={inspectorOpen && (!narrow || wide)} onClick={() => { if (inspectorOpen && (!narrow || wide)) { setInspectorOpen(false); setWide(false); } else showInspector(tab); }}><FileCode2 size={16} /><span>文件与成果</span></button></div>
</header> </header>
<div className="task-toolbar"><span className="task-local"><GitBranch size={13} />本地项目</span>{session ? <Status value={session.status} /> : <span className="subtle">等待新任务</span>}<div className="toolbar-actions"> <div className="task-toolbar"><span className="task-local"><span className="local-dot" />本地工作空间</span>{session ? <Status value={session.status} /> : <span className="subtle">准备就绪</span>}<div className="toolbar-actions">
<IconButton label="运行诊断" onClick={() => openDiagnostics()}><Activity size={15} /></IconButton> <button className="text-button" aria-label="查看任务记录" onClick={() => showInspector('task')}><ClipboardCheck size={14} />任务记录</button>
<IconButton label="项目技能" onClick={() => setSkillsOpen(true)} disabled={!selectedProject || restrictedWorker}><BookOpenText size={15} /></IconButton>
<IconButton label="项目MCP工具" onClick={() => setMcpOpen(true)} disabled={!selectedProject || restrictedWorker}><Puzzle size={15} /></IconButton>
<IconButton label="查看任务记录" onClick={() => showInspector('task')}><ClipboardCheck size={15} /></IconButton>
<IconButton label="隔离协作" onClick={() => setWorkersOpen(true)} disabled={!session}><GitBranch size={15} /></IconButton>
<IconButton label="工程评测" onClick={() => setEvaluationsOpen(true)} disabled={!session || restrictedWorker}><ClipboardCheck size={15} /></IconButton>
<IconButton label="本地代理引擎" onClick={() => setEngineOpen(true)} disabled={!session || restrictedWorker && !session.execution?.workers?.some(value => value.engine)}><Link2 size={15} /></IconButton>
<IconButton label="REA 工件研究" onClick={() => void openRea()} disabled={!selectedProject || creatingSession || restrictedWorker}><BookOpenText size={15} /></IconButton>
{narrow && <><IconButton label="查看文件" onClick={() => showInspector('file')}><FileCode2 size={16} /></IconButton><IconButton label="查看改动" onClick={() => showInspector('changes')}><GitBranch size={16} /></IconButton><IconButton label="查看执行轨迹" onClick={() => showInspector('trace')}><SquareTerminal size={16} /></IconButton></>}
{pending.length > 0 && <button className="text-button review-toolbar" onClick={() => { setChangeId(pending[0].id); showInspector('changes'); }}><FileCode2 size={13} />审核 {pending.length} 项</button>} {pending.length > 0 && <button className="text-button review-toolbar" onClick={() => { setChangeId(pending[0].id); showInspector('changes'); }}><FileCode2 size={13} />审核 {pending.length} 项</button>}
{session && <><IconButton label="导出会话" onClick={() => exportSession(session.id).catch(failure)}><ArrowDownToLine size={15} /></IconButton> {session && !isRunning && pending.length === 0 && ['failed', 'paused'].includes(session.status) && <button className="text-button" disabled={resuming} onClick={() => resumeSession()}><RotateCw size={13} />{session.status === 'failed' && session.failure?.source === 'model_connection' ? '重试模型请求' : '继续任务'}</button>}
{!isRunning && pending.length === 0 && ['failed', 'paused'].includes(session.status) && <button className="text-button" disabled={resuming} onClick={() => resumeSession()}><RotateCw size={13} />{session.status === 'failed' && session.failure?.source === 'model_connection' ? '重试模型请求' : '继续任务'}</button>}</>}
</div></div> </div></div>
<section ref={conversationRef} className="conversation" aria-label="任务对话"> <section ref={conversationRef} className="conversation" aria-label="任务对话">
{!session?.messages.length && !session?.events.length ? <div className="welcome"><span className="welcome-label"><span />从项目到结果</span><h2>读懂项目。<br />把每一步做好。</h2><p>给出一个任务,读取依据、工具执行和文件改动会在这里连成完整过程。</p><div className="starter-prompts">{['了解这个项目,并提出一项改进', '查找关键实现,解释调用关系', '检查项目,并准备可审查的修改'].map((prompt, index) => <button key={prompt} onClick={() => { setComposer(prompt); composerRef.current?.focus(); }}><span>{index === 0 ? <FolderOpen size={17} /> : index === 1 ? <Link2 size={17} /> : <FileCode2 size={17} />}</span>{prompt}<ArrowRight size={14} /></button>)}</div><div className="welcome-note"><ShieldCheck size={16} /><span>{config.executionMode === 'unrestricted' ? '文件改动直接应用,可查看差异和回滚。命令按所选权限执行。' : '当前使用自定义额度;命令按所选权限执行。'}</span></div></div> : <div className="conversation-entries"> {!session?.messages.length && !session?.events.length ? <div className="welcome orven-welcome">
<div className="welcome-signature"><OrvenMark size={34} /><span>{BRAND.name}<small>{BRAND.slogan}</small></span></div>
<h2>今天,想实现什么?</h2><p>一个新想法,一个待解决的问题。<br />带上你的项目,我们一起把它做出来。</p>
<div className="welcome-project"><span className="welcome-project-icon"><FolderOpen size={20} /></span><div><strong>{selectedProject?.name || '从你的项目开始'}{projectId === exampleId && <span>示例项目</span>}</strong><small>{projectId === exampleId ? '先在示例里探索,或打开你自己的项目。' : selectedProject?.root || '打开本机文件夹,让 Orven 理解项目上下文。'}</small></div><button aria-label="打开自己的项目" onClick={() => setProjectOpen(true)}>打开项目<ArrowUp size={14} /></button></div>
<div className="starter-heading">也可以从这里开始</div><div className="starter-prompts">{[
{ title: '读懂项目', detail: '梳理结构与关键实现', prompt: '了解这个项目,梳理项目结构、技术栈和关键实现,并说明可以从哪里开始。', icon: FolderOpen },
{ title: '一起解决问题', detail: '定位原因,准备修改', prompt: '检查这个项目,找出一个值得修复的问题,说明原因并准备可审查的修改。', icon: Code2 },
{ title: '把改动做扎实', detail: '审查代码,核对检查', prompt: '审查这个项目的代码与现有检查,找出缺少验证的关键路径,并提出具体改进。', icon: ClipboardCheck },
].map(item => <button key={item.title} onClick={() => { setComposer(item.prompt); composerRef.current?.focus(); }}><span className="starter-icon"><item.icon size={19} strokeWidth={1.7} /></span><span><strong>{item.title}</strong><small>{item.detail}</small></span><ArrowRight size={15} /></button>)}</div>
{config.mode === 'demo' && <button className="welcome-connect" onClick={() => setModelCenterOpen(true)}><ModelServer size={16} /><span>连接你的模型,让 Orven 开始协作</span><ArrowRight size={15} /></button>}
</div> : <div className="conversation-entries">
{session?.recoveryNotice && <div className="recovery-note"><ShieldCheck size={16} /><div><strong>已恢复会话记录</strong><p>{session.recoveryNotice}</p></div></div>} {session?.recoveryNotice && <div className="recovery-note"><ShieldCheck size={16} /><div><strong>已恢复会话记录</strong><p>{session.recoveryNotice}</p></div></div>}
{entries.map(entry => 'message' in entry && entry.message ? <div key={entry.id} className={'message message-' + entry.message.role}><span className="message-avatar">{entry.message.role === 'user' ? '你' : entry.message.role === 'assistant' ? 'AW' : '·'}</span><div className="message-body"><div className="message-label">{entry.message.role === 'user' ? '你的任务' : entry.message.role === 'assistant' ? session?.executionMode === 'demo' ? '演示执行器' : '编程助手' : '工作台'}<time>{new Date(entry.date).toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })}</time></div><div className="message-text">{entry.message.role === 'system' && failureForMessage(entry.message) {entries.map(entry => 'message' in entry && entry.message ? <div key={entry.id} className={'message message-' + entry.message.role}><span className="message-avatar">{entry.message.role === 'user' ? '你' : entry.message.role === 'assistant' ? <OrvenMark size={20} /> : '·'}</span><div className="message-body"><div className="message-label">{entry.message.role === 'user' ? '你的任务' : entry.message.role === 'assistant' ? session?.executionMode === 'demo' ? '演示执行器' : BRAND.name : '工作台'}<time>{new Date(entry.date).toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })}</time></div><div className="message-text">{entry.message.role === 'system' && failureForMessage(entry.message)
? <FailureCard failure={failureForMessage(entry.message)!} onDiagnose={() => openDiagnostics()} onRetry={session?.status === 'failed' && session?.failure?.messageId === entry.message.id ? () => resumeSession() : undefined} busy={resuming || isRunning} /> ? <FailureCard failure={failureForMessage(entry.message)!} onDiagnose={() => openDiagnostics()} onRetry={session?.status === 'failed' && session?.failure?.messageId === entry.message.id ? () => resumeSession() : undefined} busy={resuming || isRunning} />
: entry.message.role === 'assistant' ? <ResearchContent content={entry.message.content} /> : entry.message.content}</div>{entry.message.attachmentIds?.map(id=>{const image=session?.inputAttachments?.find(value=>value.id===id);return image&&session?<InputImage key={id} sessionId={session.id} image={image} onError={failure}/>:null;})}</div></div> : 'event' in entry && entry.event ? <div key={entry.id} className="inline-event">{['tool', 'model'].includes(entry.event.kind) ? <><ToolRow event={entry.event} onSelect={() => { setEventId(entry.event!.id); showInspector('trace'); }} /><ModelStreamPreview event={entry.event} /></> : <div className={'system-event event-' + entry.event.phase}><span />{entry.event.label}{entry.event.output && <p>{entry.event.output}</p>}</div>}</div> : null)} : entry.message.role === 'assistant' ? <ResearchContent content={entry.message.content} /> : entry.message.content}</div>{entry.message.attachmentIds?.map(id=>{const image=session?.inputAttachments?.find(value=>value.id===id);return image&&session?<InputImage key={id} sessionId={session.id} image={image} onError={failure}/>:null;})}</div></div> : 'event' in entry && entry.event ? <div key={entry.id} className="inline-event">{['tool', 'model'].includes(entry.event.kind) ? <><ToolRow event={entry.event} onSelect={() => { setEventId(entry.event!.id); showInspector('trace'); }} /><ModelStreamPreview event={entry.event} /></> : <div className={'system-event event-' + entry.event.phase}><span />{entry.event.label}{entry.event.output && <details className="system-event-output"><summary>查看详情</summary><pre>{entry.event.output}</pre></details>}</div>}</div> : null)}
{isRunning && !approval && <div className="working-note"><LoaderCircle size={14} className="spin" /><span>{session?.executionMode === 'demo' ? '正在执行演示流程' : '正在处理任务'}</span></div>} {isRunning && !approval && <div className="working-note"><LoaderCircle size={14} className="spin" /><span>{session?.executionMode === 'demo' ? '正在执行演示流程' : '正在处理任务'}</span></div>}
</div>} </div>}
{session&&<BudgetPausePanel key={session.id+session.execution?.run?.id} session={session} config={config} onSession={acceptSession} onRecovery={()=>setWorkersOpen(true)}/>} {session&&<BudgetPausePanel key={session.id+session.execution?.run?.id} session={session} config={config} onSession={acceptSession} onRecovery={()=>setWorkersOpen(true)}/>}
@@ -602,15 +634,19 @@ export default function App() {
{canContinueReview && <button type="button" aria-label="继续原任务" className="review-callout" disabled={resuming} onClick={continueReviewed}><ClipboardCheck size={17} /><span><strong>继续原任务</strong><small>改动已应用,保留原目标、范围和检查约定继续处理。</small></span><ArrowRight size={17} /></button>} {canContinueReview && <button type="button" aria-label="继续原任务" className="review-callout" disabled={resuming} onClick={continueReviewed}><ClipboardCheck size={17} /><span><strong>继续原任务</strong><small>改动已应用,保留原目标、范围和检查约定继续处理。</small></span><ArrowRight size={17} /></button>}
<div ref={chatEnd} /> <div ref={chatEnd} />
</section> </section>
<footer className="composer-wrap"><div className="composer-permissions"><PermissionModeControl value={config.approvalMode ?? 'ask'} disabled={permissionSaving || !ready} onChange={mode => void savePermission(mode)} /><small>{permissionSaving ? '正在保存…' : '选择自动保存 · 可随时切换'}</small></div><form className="composer" onSubmit={event => { event.preventDefault(); submit(); }}><AttachmentComposer session={session} selectedIds={imageSelection.sessionId===session?.id?imageSelection.ids:[]} onSelection={(id,ids)=>setImageSelection({sessionId:id,ids})} onEnsureSession={newSession} onSession={acceptSession} onError={failure} disabled={isRunning||sending||creatingSession||!ready||restrictedWorker} routeName={config.mode === 'demo' ? '尚未选择模型' : modelSelection.name || config.model} onModels={()=>setModelCenterOpen(true)}/><textarea ref={composerRef} aria-label="任务内容" placeholder="描述项目任务,或询问工作台的执行状态与报错…" value={composer} onChange={event => setComposer(event.target.value)} onKeyDown={event => { if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') { event.preventDefault(); submit(); } }} maxLength={config.executionMode === 'unrestricted' ? undefined : 20000} rows={3} /><div className="composer-bottom"><span><Folder size={13} />{selectedProject?.name || '选择项目'}<span className="composer-divider" />{config.mode === 'demo' ? '选择模型开始开发' : modelSelection.name || config.model}</span>{isRunning ? <button type="button" className="stop-button" onClick={() => session && api('/sessions/' + session.id + '/stop', {}).catch(failure)}><Square size={13} />停止</button> : <button type="submit" className="send-button" aria-label="发送任务" disabled={!composer.trim() || sending || creatingSession || !ready || !!(sessionId && !session)}>{sending ? <LoaderCircle size={17} className="spin" /> : <ArrowUp size={18} />}</button>}</div></form><div className="composer-footnote"><span>Ctrl + Enter 发送 · 会话自动保存</span><span>{session?.estimatedTokens ? '上下文估算 ' + session.estimatedTokens.toLocaleString() + ' tokens' : '改动与执行结果可追溯'}</span></div></footer> <footer className="composer-wrap"><form className="composer" onSubmit={event => { event.preventDefault(); submit(); }}>
<textarea ref={composerRef} aria-label="任务内容" placeholder="把想法交给 Orven,或描述你遇到的问题…" value={composer} onChange={event => setComposer(event.target.value)} onKeyDown={event => { if (!event.nativeEvent.isComposing && (event.ctrlKey || event.metaKey) && event.key === 'Enter') { event.preventDefault(); submit(); } }} maxLength={config.executionMode === 'unrestricted' ? undefined : 20000} rows={3} />
<AttachmentComposer session={session} selectedIds={imageSelection.sessionId===session?.id?imageSelection.ids:[]} onSelection={(id,ids)=>setImageSelection({sessionId:id,ids})} onEnsureSession={newSession} onSession={acceptSession} onError={failure} disabled={isRunning||sending||creatingSession||!ready||restrictedWorker} routeName={config.mode === 'demo' ? '尚未选择模型' : modelSelection.name || config.model} onModels={()=>setModelCenterOpen(true)}/>
<div className="composer-bottom"><div className="composer-options"><button type="button" className="composer-model" aria-label="切换当前模型" title="选择模型、模型池或添加连接" onClick={() => setModelCenterOpen(true)}><span className={'model-light ' + (config.mode === 'demo' ? 'model-unset' : '')} /><span>{config.mode === 'demo' ? '选择模型' : modelSelection.name || config.model || '选择模型'}</span><ChevronDown size={13} /></button><span className="composer-divider" /><PermissionModeControl value={config.approvalMode ?? 'ask'} disabled={permissionSaving || !ready} onChange={mode => void savePermission(mode)} /></div>{isRunning ? <button type="button" className="stop-button" onClick={() => session && api('/sessions/' + session.id + '/stop', {}).catch(failure)}><Square size={13} />停止</button> : <button type="submit" className="send-button" aria-label="发送任务" disabled={!composer.trim() || sending || creatingSession || !ready || !!(sessionId && !session)}>{sending ? <LoaderCircle size={17} className="spin" /> : <ArrowUp size={18} />}</button>}</div>
</form><div className="composer-footnote"><span>Ctrl + Enter 发送 · 会话自动保存</span><span>{permissionSaving ? '正在保存权限…' : session?.estimatedTokens ? '上下文估算 ' + session.estimatedTokens.toLocaleString() + ' tokens' : '执行有记录,改动可回看'}</span></div></footer>
</main> </main>
{((mobile && sidebarOpen) || (narrow && wide)) && <button type="button" className="panel-scrim" aria-label="关闭侧边面板" onClick={() => { setSidebarOpen(false); setWide(false); }} />} {((mobile && sidebarOpen) || (narrow && wide)) && <button type="button" className="panel-scrim" aria-label="关闭侧边面板" onClick={() => { setSidebarOpen(false); setWide(false); }} />}
<aside className="inspector"> <aside className="inspector" aria-label="文件与成果区" inert={!inspectorOpen || narrow && !wide}>
{!narrow&&<div className="inspector-resize-handle" role="separator" aria-label="调整检视区宽度" aria-orientation="vertical" tabIndex={0} aria-valuemin={310} aria-valuemax={maximumInspector} aria-valuenow={inspectorWidth??undefined} {!narrow&&<div className="inspector-resize-handle" role="separator" aria-label="调整检视区宽度" aria-orientation="vertical" tabIndex={0} aria-valuemin={310} aria-valuemax={maximumInspector} aria-valuenow={inspectorWidth??undefined}
onPointerDown={event=>{if(event.button!==0)return;event.preventDefault();inspectorDrag.current={x:event.clientX,width:event.currentTarget.parentElement!.getBoundingClientRect().width};event.currentTarget.setPointerCapture(event.pointerId);setInspectorResizing(true);}} onPointerDown={event=>{if(event.button!==0)return;event.preventDefault();inspectorDrag.current={x:event.clientX,width:event.currentTarget.parentElement!.getBoundingClientRect().width};event.currentTarget.setPointerCapture(event.pointerId);setInspectorResizing(true);}}
onDoubleClick={()=>setInspectorWidth(null)} onDoubleClick={()=>setInspectorWidth(null)}
onKeyDown={event=>{const width=event.currentTarget.parentElement!.getBoundingClientRect().width;if(event.key==='ArrowLeft'||event.key==='ArrowRight'){event.preventDefault();resizeInspector(width+(event.key==='ArrowLeft'?32:-32));}else if(event.key==='Home'){event.preventDefault();resizeInspector(310);}else if(event.key==='End'){event.preventDefault();resizeInspector(maximumInspector);}}}/>} onKeyDown={event=>{const width=event.currentTarget.parentElement!.getBoundingClientRect().width;if(event.key==='ArrowLeft'||event.key==='ArrowRight'){event.preventDefault();resizeInspector(width+(event.key==='ArrowLeft'?32:-32));}else if(event.key==='Home'){event.preventDefault();resizeInspector(310);}else if(event.key==='End'){event.preventDefault();resizeInspector(maximumInspector);}}}/>}
<div className="inspector-tabs"><button className={tab === 'file' ? 'selected' : ''} onClick={() => setTab('file')}><FileCode2 size={14} />文件</button><button className={tab === 'changes' ? 'selected' : ''} onClick={() => setTab('changes')}><GitBranch size={14} />改动{pending.length > 0 && <b>{pending.length}</b>}</button><button className={tab === 'trace' ? 'selected' : ''} onClick={() => setTab('trace')}><SquareTerminal size={14} />轨迹</button><button className={tab === 'task' ? 'selected' : ''} onClick={() => setTab('task')}><ClipboardCheck size={14} />任务</button><button className={tab === 'index' ? 'selected' : ''} onClick={() => setTab('index')}><Search size={14} />索引</button><button className={tab === 'browse' ? 'selected' : ''} onClick={() => setTab('browse')}><Link2 size={14} />浏览</button><IconButton label={narrow ? '关闭检视区' : wide ? '缩小检视区' : '放大检视区'} onClick={() => setWide(previous => !previous)}>{narrow ? <X size={16} /> : wide ? <Minimize2 size={14} /> : <Maximize2 size={14} />}</IconButton></div> <div className="inspector-tabs"><button className={tab === 'file' ? 'selected' : ''} onClick={() => setTab('file')}><FileCode2 size={14} />文件</button><button className={tab === 'changes' ? 'selected' : ''} onClick={() => setTab('changes')}><GitBranch size={14} />改动{pending.length > 0 && <b>{pending.length}</b>}</button><button className={tab === 'trace' ? 'selected' : ''} onClick={() => setTab('trace')}><SquareTerminal size={14} />轨迹</button><button className={tab === 'task' ? 'selected' : ''} onClick={() => setTab('task')}><ClipboardCheck size={14} />任务</button><button className={tab === 'index' ? 'selected' : ''} onClick={() => setTab('index')}><Search size={14} />索引</button><button className={tab === 'browse' ? 'selected' : ''} onClick={() => setTab('browse')}><Link2 size={14} />浏览</button><IconButton label="关闭检视区" onClick={() => { setInspectorOpen(false); setWide(false); }}><X size={16} /></IconButton></div>
{tab === 'file' && (fileLoading ? <div className="loading-inspector"><LoaderCircle className="spin" size={24} />正在读取文件</div> : openFile ? <div className="file-inspector"><div className="file-heading"><FileCode2 size={15} /><span title={openFile.path}>{openFile.path}</span>{/\.html?$/i.test(openFile.path) && <div className="file-mode-switch" role="group" aria-label="文件显示方式"><button type="button" aria-pressed={fileMode === 'preview'} disabled={editing} onClick={() => setFileMode('preview')}>预览</button><button type="button" aria-pressed={fileMode === 'source'} onClick={() => { setFileMode('source'); setEditing(false); }}>源码</button></div>}<IconButton label="复制文件内容" onClick={() => navigator.clipboard.writeText(openFile.content).then(() => notify('已复制文件内容。')).catch(failure)}><Copy size={14} /></IconButton><IconButton label={editing ? '取消编辑' : '编辑文件'} onClick={() => { setFileMode('source'); setEditing(previous => !previous); setDraft(openFile.content); }}><Pencil size={14} /></IconButton></div><div className="file-details"><span>{lineCount} 行 · {openFile.bytes.toLocaleString()} B{fileLine ? ' · 定位第 ' + fileLine + ' 行' : ''}</span><span className="code-utility">{openFile.sha256.slice(0, 10)}</span></div>{fileNotice && <div className="file-index-notice" role="status">{fileNotice}</div>}{editing ? <><textarea className="code-editor" aria-label="编辑文件内容" spellCheck={false} value={draft} onChange={event => setDraft(event.target.value)} /><div className="editor-actions"><button className="button primary" onClick={saveDraft} disabled={draft === openFile.content || draftSaving}><GitBranch size={14} />保存为提案</button></div></> : fileMode === 'preview' && /\.html?$/i.test(openFile.path) ? <HtmlFilePreview key={projectId + ':' + openFile.path} projectId={projectId} path={openFile.path} /> : <div className="code-view" ref={codeViewRef}>{openFile.content.split('\n').map((line, index) => <div key={index} data-line={index + 1} className={fileLine === index + 1 ? 'code-line-target' : ''}><span>{index + 1}</span><code>{line.replace(/\r$/, '') || ' '}</code></div>)}</div>}</div> : <EmptyInspector kind="file" />)} {tab === 'file' && (fileLoading ? <div className="loading-inspector"><LoaderCircle className="spin" size={24} />正在读取文件</div> : openFile ? <div className="file-inspector"><div className="file-heading"><FileCode2 size={15} /><span title={openFile.path}>{openFile.path}</span>{/\.html?$/i.test(openFile.path) && <div className="file-mode-switch" role="group" aria-label="文件显示方式"><button type="button" aria-pressed={fileMode === 'preview'} disabled={editing} onClick={() => setFileMode('preview')}>预览</button><button type="button" aria-pressed={fileMode === 'source'} onClick={() => { setFileMode('source'); setEditing(false); }}>源码</button></div>}<IconButton label="复制文件内容" onClick={() => navigator.clipboard.writeText(openFile.content).then(() => notify('已复制文件内容。')).catch(failure)}><Copy size={14} /></IconButton><IconButton label={editing ? '取消编辑' : '编辑文件'} onClick={() => { setFileMode('source'); setEditing(previous => !previous); setDraft(openFile.content); }}><Pencil size={14} /></IconButton></div><div className="file-details"><span>{lineCount} 行 · {openFile.bytes.toLocaleString()} B{fileLine ? ' · 定位第 ' + fileLine + ' 行' : ''}</span><span className="code-utility">{openFile.sha256.slice(0, 10)}</span></div>{fileNotice && <div className="file-index-notice" role="status">{fileNotice}</div>}{editing ? <><textarea className="code-editor" aria-label="编辑文件内容" spellCheck={false} value={draft} onChange={event => setDraft(event.target.value)} /><div className="editor-actions"><button className="button primary" onClick={saveDraft} disabled={draft === openFile.content || draftSaving}><GitBranch size={14} />保存为提案</button></div></> : fileMode === 'preview' && /\.html?$/i.test(openFile.path) ? <HtmlFilePreview key={projectId + ':' + openFile.path} projectId={projectId} path={openFile.path} /> : <div className="code-view" ref={codeViewRef}>{openFile.content.split('\n').map((line, index) => <div key={index} data-line={index + 1} className={fileLine === index + 1 ? 'code-line-target' : ''}><span>{index + 1}</span><code>{line.replace(/\r$/, '') || ' '}</code></div>)}</div>}</div> : <EmptyInspector kind="file" />)}
{tab === 'changes' && (session ? <ChangesInspector session={session} selectedChange={selectedChange} busy={!!changeBusy} isRunning={isRunning} onSelect={setChangeId} onAction={changeAction} onSession={acceptSession} onError={failureFor(session)} onFilesChanged={refreshBatchFiles} /> : <EmptyInspector kind="changes" />)} {tab === 'changes' && (session ? <ChangesInspector session={session} selectedChange={selectedChange} busy={!!changeBusy} isRunning={isRunning} onSelect={setChangeId} onAction={changeAction} onSession={acceptSession} onError={failureFor(session)} onFilesChanged={refreshBatchFiles} /> : <EmptyInspector kind="changes" />)}
{tab === 'trace' && (session?.events.length ? <div className="trace-inspector"><div className="trace-caption"><span>完整执行记录</span><span>{toolEvents.length} 次工具调用</span></div><div className="trace-list">{session.events.map(event => <ToolRow key={event.id} event={event} selected={selectedEvent?.id === event.id} onSelect={() => setEventId(event.id)} />)}</div>{selectedEvent && <div className="event-details"><div className="event-detail-heading"><strong>{selectedEvent.label}</strong><Status value={selectedEvent.phase} /></div>{selectedEvent.input && <><h4>输入</h4><pre>{JSON.stringify(selectedEvent.input, null, 2)}</pre></>}<h4>结果</h4><pre>{selectedEvent.output || (selectedEvent.phase === 'waiting' ? '等待确认后执行。' : '正在等待工具结果。')}</pre>{selectedEvent.durationMs !== undefined && <p className="subtle">耗时 {(selectedEvent.durationMs / 1000).toFixed(2)} 秒,包含确认等待。</p>}</div>}</div> : <EmptyInspector kind="trace" />)} {tab === 'trace' && (session?.events.length ? <div className="trace-inspector"><div className="trace-caption"><span>完整执行记录</span><span>{toolEvents.length} 次工具调用</span></div><div className="trace-list">{session.events.map(event => <ToolRow key={event.id} event={event} selected={selectedEvent?.id === event.id} onSelect={() => setEventId(event.id)} />)}</div>{selectedEvent && <div className="event-details"><div className="event-detail-heading"><strong>{selectedEvent.label}</strong><Status value={selectedEvent.phase} /></div>{selectedEvent.input && <><h4>输入</h4><pre>{JSON.stringify(selectedEvent.input, null, 2)}</pre></>}<h4>结果</h4><pre>{selectedEvent.output || (selectedEvent.phase === 'waiting' ? '等待确认后执行。' : '正在等待工具结果。')}</pre>{selectedEvent.durationMs !== undefined && <p className="subtle">耗时 {(selectedEvent.durationMs / 1000).toFixed(2)} 秒,包含确认等待。</p>}</div>}</div> : <EmptyInspector kind="trace" />)}
@@ -619,6 +655,7 @@ export default function App() {
{selectedProject && <CodeIndexPanel key={selectedProject.id} project={selectedProject} active={tab === 'index'} onOpen={(path, line, expectedSha256) => void loadFile(path, { line, expectedSha256 })} />} {selectedProject && <CodeIndexPanel key={selectedProject.id} project={selectedProject} active={tab === 'index'} onOpen={(path, line, expectedSha256) => void loadFile(path, { line, expectedSha256 })} />}
<div className="inspector-footer"><ShieldCheck size={13} /><span>{tab === 'changes' ? '应用前会核对文件基线' : tab === 'trace' ? '中断调用保留待核实状态' : tab === 'task' ? '任务目标、检查与结果持久保存' : tab === 'index' ? '结果绑定当前项目及文件 SHA256' : '读取范围限定在当前项目'}</span></div> <div className="inspector-footer"><ShieldCheck size={13} /><span>{tab === 'changes' ? '应用前会核对文件基线' : tab === 'trace' ? '中断调用保留待核实状态' : tab === 'task' ? '任务目标、检查与结果持久保存' : tab === 'index' ? '结果绑定当前项目及文件 SHA256' : '读取范围限定在当前项目'}</span></div>
</aside> </aside>
{toolsOpen && <Modal title="工具箱" description="项目的上下文、能力和连接,都在这里。" onClose={() => setToolsOpen(false)}><WorkbenchTools actions={actions} onClose={() => setToolsOpen(false)} /></Modal>}
{installationOpen && <Modal title="版本与更新" description="核对本机版本、真实更新阶段与原始结果。" onClose={() => setInstallationOpen(false)}><InstallationStatus /></Modal>} {installationOpen && <Modal title="版本与更新" description="核对本机版本、真实更新阶段与原始结果。" onClose={() => setInstallationOpen(false)}><InstallationStatus /></Modal>}
{projectOpen && <Modal title="打开项目" description="选择这台电脑上的项目文件夹,或输入完整路径。" onClose={() => { if (!projectBusy) { setProjectOpen(false); setDirectoryPickerOpen(false); setProjectError(''); } }}><form onSubmit={event => { event.preventDefault(); if (!directoryPickerOpen) void openProject(); }}><label className="form-field">项目文件夹<input autoFocus value={projectInput} disabled={projectBusy} onChange={event => { setProjectInput(event.target.value); setProjectError(''); }} placeholder="C:\Projects\my-app" aria-label="项目文件夹路径" /></label>{projectError && <p className="local-files-error" role="alert">{projectError}</p>}{directoryPickerOpen && <ProjectDirectoryPicker initialPath={projectInput.trim()} onChoose={value => { setProjectInput(value); setProjectError(''); setDirectoryPickerOpen(false); }} onCancel={() => setDirectoryPickerOpen(false)} />}<div className="modal-actions"><button type="button" className="button secondary" disabled={pickingProject || projectBusy} onClick={() => desktop ? void pickDesktopProject() : setDirectoryPickerOpen(value => !value)}><FolderOpen size={15} />选择文件夹</button>{exampleId && <button type="button" className="button secondary" disabled={projectBusy} onClick={() => { chooseProject(exampleId); setProjectOpen(false); setDirectoryPickerOpen(false); }}>打开示例项目</button>}<button type="submit" className="button primary" disabled={!projectInput.trim() || projectBusy || directoryPickerOpen}>{projectBusy ? <LoaderCircle className="spin" size={15} /> : <FolderOpen size={15} />}{projectBusy ? '正在打开…' : '打开项目'}</button></div></form></Modal>} {projectOpen && <Modal title="打开项目" description="选择这台电脑上的项目文件夹,或输入完整路径。" onClose={() => { if (!projectBusy) { setProjectOpen(false); setDirectoryPickerOpen(false); setProjectError(''); } }}><form onSubmit={event => { event.preventDefault(); if (!directoryPickerOpen) void openProject(); }}><label className="form-field">项目文件夹<input autoFocus value={projectInput} disabled={projectBusy} onChange={event => { setProjectInput(event.target.value); setProjectError(''); }} placeholder="C:\Projects\my-app" aria-label="项目文件夹路径" /></label>{projectError && <p className="local-files-error" role="alert">{projectError}</p>}{directoryPickerOpen && <ProjectDirectoryPicker initialPath={projectInput.trim()} onChoose={value => { setProjectInput(value); setProjectError(''); setDirectoryPickerOpen(false); }} onCancel={() => setDirectoryPickerOpen(false)} />}<div className="modal-actions"><button type="button" className="button secondary" disabled={pickingProject || projectBusy} onClick={() => desktop ? void pickDesktopProject() : setDirectoryPickerOpen(value => !value)}><FolderOpen size={15} />选择文件夹</button>{exampleId && <button type="button" className="button secondary" disabled={projectBusy} onClick={() => { chooseProject(exampleId); setProjectOpen(false); setDirectoryPickerOpen(false); }}>打开示例项目</button>}<button type="submit" className="button primary" disabled={!projectInput.trim() || projectBusy || directoryPickerOpen}>{projectBusy ? <LoaderCircle className="spin" size={15} /> : <FolderOpen size={15} />}{projectBusy ? '正在打开…' : '打开项目'}</button></div></form></Modal>}
{companionOpen && <Modal title="手机连接" description="指定项目和权限,连接到同一个Windows执行宿主。" onClose={() => setCompanionOpen(false)} wide><CompanionPanel projects={projects} selectedProjectId={selectedProject?.id ?? ''} /></Modal>} {companionOpen && <Modal title="手机连接" description="指定项目和权限,连接到同一个Windows执行宿主。" onClose={() => setCompanionOpen(false)} wide><CompanionPanel projects={projects} selectedProjectId={selectedProject?.id ?? ''} /></Modal>}
+1 -1
View File
@@ -104,7 +104,7 @@ export function DeliveryPanel({ session, busy, onSession, onError, openArtifact
<div className="delivery-route" aria-label="交付步骤"><span className={hasApplied && !pending ? 'done' : ''}>文件已审查</span><i>→</i><span className={task?.verification.status === 'passed' ? 'done' : ''}>实际检查</span><i>→</i><span className={jobs.some(job => job.status === 'completed') ? 'done' : ''}>本地提交</span></div> <div className="delivery-route" aria-label="交付步骤"><span className={hasApplied && !pending ? 'done' : ''}>文件已审查</span><i>→</i><span className={task?.verification.status === 'passed' ? 'done' : ''}>实际检查</span><i>→</i><span className={jobs.some(job => job.status === 'completed') ? 'done' : ''}>本地提交</span></div>
{waitingPlan && <div className="delivery-attention delivery-review-boundary" aria-label="等待Git确认"><strong>Git预览已保存,等待确认</strong><p>{waitingPlan.paths.length} 个文件 · {waitingPlan.baseline.branch} · HEAD {waitingPlan.baseline.head.slice(0, 12)}</p><p>任务已暂停请求模型。审查现有预览后确认提交,或撤回预览再继续。</p><div className="delivery-report-actions"><button type="button" className="button primary" disabled={busy || running || submitting || waitingPlan.status !== 'planned'} onClick={() => setConfirm(waitingPlan)}>查看待确认预览</button><button type="button" className="button secondary" disabled={busy || running || unresolved || submitting} onClick={discard}>撤回预览</button></div>{waitingPlan.status === 'accepted' && <p>这份预览已尝试执行;请核对原结果,确认未提交后重新预览。</p>}</div>} {waitingPlan && <div className="delivery-attention delivery-review-boundary" aria-label="等待Git确认"><strong>Git预览已保存,等待确认</strong><p>{waitingPlan.paths.length} 个文件 · {waitingPlan.baseline.branch} · HEAD {waitingPlan.baseline.head.slice(0, 12)}</p><p>任务已暂停请求模型。审查现有预览后确认提交,或撤回预览再继续。</p><div className="delivery-report-actions"><button type="button" className="button primary" disabled={busy || running || submitting || waitingPlan.status !== 'planned'} onClick={() => setConfirm(waitingPlan)}>查看待确认预览</button><button type="button" className="button secondary" disabled={busy || running || unresolved || submitting} onClick={discard}>撤回预览</button></div>{waitingPlan.status === 'accepted' && <p>这份预览已尝试执行;请核对原结果,确认未提交后重新预览。</p>}</div>}
<label className="form-field delivery-message">提交说明<textarea aria-label="提交说明" rows={2} value={message} maxLength={1600} disabled={busy || running} onChange={event => setMessage(event.target.value)} /></label> <label className="form-field delivery-message">提交说明<textarea aria-label="提交说明" rows={2} value={message} maxLength={1600} disabled={busy || running} onChange={event => setMessage(event.target.value)} /></label>
<details className="delivery-author"><summary>Git署名</summary><p>默认采用项目Git署名;尚未配置时使用 Agent Workbench 本地身份。预览会展示实际署名。</p><label className="form-field">提交者姓名<input value={authorName} disabled={busy || running} onChange={event => setAuthorName(event.target.value)} placeholder="采用默认署名" autoComplete="off" /></label><label className="form-field">提交者邮箱<input type="email" value={authorEmail} disabled={busy || running} onChange={event => setAuthorEmail(event.target.value)} placeholder="采用默认邮箱" autoComplete="off" /></label></details> <details className="delivery-author"><summary>Git署名</summary><p>默认采用项目 Git 署名;尚未配置时使用本地默认署名。预览会展示实际署名。</p><label className="form-field">提交者姓名<input value={authorName} disabled={busy || running} onChange={event => setAuthorName(event.target.value)} placeholder="采用默认署名" autoComplete="off" /></label><label className="form-field">提交者邮箱<input type="email" value={authorEmail} disabled={busy || running} onChange={event => setAuthorEmail(event.target.value)} placeholder="采用默认邮箱" autoComplete="off" /></label></details>
<button type="button" className="button primary" aria-label="预览Git提交" disabled={!task || !hasApplied || pending || busy || running || unresolved || planning || !message.trim()} onClick={prepare}>{planning ? <LoaderCircle size={14} className="spin" /> : <GitCommitHorizontal size={14} />}预览Git提交</button> <button type="button" className="button primary" aria-label="预览Git提交" disabled={!task || !hasApplied || pending || busy || running || unresolved || planning || !message.trim()} onClick={prepare}>{planning ? <LoaderCircle size={14} className="spin" /> : <GitCommitHorizontal size={14} />}预览Git提交</button>
{existingOnly ? <p className="record-footnote">本任务沿用已有成果,无新增修改,不创建空提交。可生成报告核对成果与原检查。</p> : (!hasApplied || pending) && <p className="record-footnote">应用本任务的文件提案后,可以准备Git提交。</p>} {existingOnly ? <p className="record-footnote">本任务沿用已有成果,无新增修改,不创建空提交。可生成报告核对成果与原检查。</p> : (!hasApplied || pending) && <p className="record-footnote">应用本任务的文件提案后,可以准备Git提交。</p>}
{jobs.slice().reverse().map(job => <div key={job.id} className={'delivery-job ' + (job.requiresVerification ? 'delivery-attention' : '')}> {jobs.slice().reverse().map(job => <div key={job.id} className={'delivery-job ' + (job.requiresVerification ? 'delivery-attention' : '')}>
+1 -1
View File
@@ -7,7 +7,7 @@ export function DiagnosticsPanel({ value, busy, onRefresh }: { value: RuntimeDia
if (!value) return <div className="diagnostic-loading"><LoaderCircle size={20} className="spin" />{busy ? '正在读取本机执行记录…' : '诊断记录暂时不可用,请刷新重试。'}<button type="button" className="button secondary" disabled={busy} onClick={onRefresh}>刷新</button></div>; if (!value) return <div className="diagnostic-loading"><LoaderCircle size={20} className="spin" />{busy ? '正在读取本机执行记录…' : '诊断记录暂时不可用,请刷新重试。'}<button type="button" className="button secondary" disabled={busy} onClick={onRefresh}>刷新</button></div>;
const failure = value.session?.lastFailure; const failure = value.session?.lastFailure;
return <div className="diagnostic-panel"> return <div className="diagnostic-panel">
<div className="diagnostic-intro"><Activity size={18} /><div><strong>Agent Workbench {value.version}</strong><p>依据本机保存的执行记录检查当前状态。</p></div><button type="button" className="button secondary" onClick={onRefresh} disabled={busy}><RotateCw size={13} className={busy ? 'spin' : ''} />刷新</button></div> <div className="diagnostic-intro"><Activity size={18} /><div><strong>Orven {value.version}</strong><p>依据本机保存的执行记录检查当前状态。</p></div><button type="button" className="button secondary" onClick={onRefresh} disabled={busy}><RotateCw size={13} className={busy ? 'spin' : ''} />刷新</button></div>
<div className="diagnostic-grid"><section><h3>运行环境</h3><dl><dt>终端</dt><dd>{value.environment.shell}</dd><dt>Node.js</dt><dd>{value.environment.node}</dd><dt>输入与输出</dt><dd>{value.environment.encoding}</dd></dl><p className="diagnostic-note">{value.environment.shellSyntax}</p></section> <div className="diagnostic-grid"><section><h3>运行环境</h3><dl><dt>终端</dt><dd>{value.environment.shell}</dd><dt>Node.js</dt><dd>{value.environment.node}</dd><dt>输入与输出</dt><dd>{value.environment.encoding}</dd></dl><p className="diagnostic-note">{value.environment.shellSyntax}</p></section>
<section><h3>模型连接</h3><dl><dt>模式</dt><dd>{value.connection.mode === 'demo' ? '离线演示' : '兼容模型服务'}</dd><dt>模型</dt><dd>{value.connection.model || '未配置'}</dd><dt>服务地址</dt><dd>{value.connection.endpoint}</dd><dt>凭据状态</dt><dd>{value.connection.hasKey ? '本次运行已配置' : '未配置'}</dd></dl>{value.connection.lastRequest && <p className="diagnostic-note">最近请求:{value.connection.lastRequest.status === 'completed' ? '成功' : value.connection.lastRequest.status === 'retrying' ? '重试中' : value.connection.lastRequest.status === 'interrupted' ? '已停止' : '失败'} · {value.connection.lastRequest.attempts ?? 1} 次</p>}</section></div> <section><h3>模型连接</h3><dl><dt>模式</dt><dd>{value.connection.mode === 'demo' ? '离线演示' : '兼容模型服务'}</dd><dt>模型</dt><dd>{value.connection.model || '未配置'}</dd><dt>服务地址</dt><dd>{value.connection.endpoint}</dd><dt>凭据状态</dt><dd>{value.connection.hasKey ? '本次运行已配置' : '未配置'}</dd></dl>{value.connection.lastRequest && <p className="diagnostic-note">最近请求:{value.connection.lastRequest.status === 'completed' ? '成功' : value.connection.lastRequest.status === 'retrying' ? '重试中' : value.connection.lastRequest.status === 'interrupted' ? '已停止' : '失败'} · {value.connection.lastRequest.attempts ?? 1} 次</p>}</section></div>
{value.session && <section className="diagnostic-session"><div className="diagnostic-section-heading"><h3>当前项目与会话</h3><Status value={value.session.session.status} /></div><strong>{value.session.project.name}</strong><p className="diagnostic-path">{value.session.project.root}</p><p className="diagnostic-note">{value.session.changes.filter(change => change.status === 'applied').length} 项已应用 · {value.session.changes.filter(change => ['pending', 'conflict'].includes(change.status)).length} 项待处理</p></section>} {value.session && <section className="diagnostic-session"><div className="diagnostic-section-heading"><h3>当前项目与会话</h3><Status value={value.session.session.status} /></div><strong>{value.session.project.name}</strong><p className="diagnostic-path">{value.session.project.root}</p><p className="diagnostic-note">{value.session.changes.filter(change => change.status === 'applied').length} 项已应用 · {value.session.changes.filter(change => ['pending', 'conflict'].includes(change.status)).length} 项待处理</p></section>}
+3 -3
View File
@@ -97,14 +97,14 @@ export function ModelCenter({ onConfig, busy, runModel }: { onConfig: (value: Co
const locked = working || busy; const locked = working || busy;
const passthrough = !runtimeConfig || runtimeConfig.executionMode === 'unrestricted' || runtimeConfig.capacityMode === 'passthrough'; const passthrough = !runtimeConfig || runtimeConfig.executionMode === 'unrestricted' || runtimeConfig.capacityMode === 'passthrough';
return <section className="model-center" aria-label="模型控制台" aria-busy={working}> return <section className="model-center" aria-label="模型控制台" aria-busy={working}>
<div className="mc-overview"><div><span className="mc-eyebrow">MODEL CONTROL</span><h2>选择模型,继续开发。</h2><p>连接、模型池和实际请求使用同一个入口。</p></div><div className="mc-current"><Route size={18} /><span>新任务默认<strong>{runtimeConfig?.mode === 'demo' ? '尚未选择' : selectionName || '正在读取'}</strong></span><span className="mc-count">{view?.waiting ?? 0} 等待</span></div></div> <div className="mc-overview"><div><span className="mc-eyebrow">ORVEN / MODELS</span><h2>选择模型,继续开发。</h2><p>接入你信任的模型,为项目选择合适的能力。</p></div><div className="mc-current"><Route size={18} /><span>新任务默认<strong>{runtimeConfig?.mode === 'demo' ? '尚未选择' : selectionName || '正在读取'}</strong></span><span className="mc-count">{view?.waiting ?? 0} 等待</span></div></div>
<nav ref={tabsRef} className="mc-tabs" aria-label="模型中心分类">{[['connections', '模型连接', Server], ['network', '连接诊断', Activity], ['pools', '模型池', Layers3], ['budgets', '运行预算', Settings2], ['waits', '等待时限', Settings2], ['attempts', '请求账本', Route], ['imports', '配置导入', Settings2], ['credentials', '凭据保存', KeyRound], ['operations', '运行巡检', Activity]].map(([id, title, Icon]) => { <nav ref={tabsRef} className="mc-tabs" aria-label="模型中心分类">{[['connections', '模型连接', Server], ['network', '连接诊断', Activity], ['pools', '模型池', Layers3], ['budgets', '运行预算', Settings2], ['waits', '等待时限', Settings2], ['attempts', '请求账本', Route], ['imports', '配置导入', Settings2], ['credentials', '凭据保存', KeyRound], ['operations', '运行巡检', Activity]].map(([id, title, Icon]) => {
const Symbol = Icon as typeof Server; return <button key={id as string} type="button" aria-current={tab === id ? 'page' : undefined} onClick={() => { setTab(id as string); setNotice(''); }}><Symbol size={16} />{title as string}</button>; const Symbol = Icon as typeof Server; return <button key={id as string} type="button" aria-current={tab === id ? 'page' : undefined} onClick={() => { setTab(id as string); setNotice(''); }}><Symbol size={16} />{title as string}</button>;
})}<button className="mc-refresh" type="button" disabled={working} onClick={() => void act(refresh)} aria-label="刷新模型中心"><RefreshCw size={16} /></button></nav> })}<button className="mc-refresh" type="button" disabled={working} onClick={() => void act(refresh)} aria-label="刷新模型中心"><RefreshCw size={16} /></button></nav>
{notice && <div className="mc-notice" role="status">{notice}{noticeFailure && <ModelErrorDetails failure={noticeFailure} />}</div>} {notice && <div className="mc-notice" role="status">{notice}{noticeFailure && <ModelErrorDetails failure={noticeFailure} />}</div>}
{busy && <p className="mc-notice">有任务正在执行;连接可停用,其他配置请在任务结束后修改。</p>} {busy && <p className="mc-notice">有任务正在执行;连接可停用,其他配置请在任务结束后修改。</p>}
{!view ? <p className="mc-empty">正在读取实际连接状态…</p> : <div className="mc-content"> {!view ? <p className="mc-empty">正在读取实际连接状态…</p> : <div className="mc-content">
<section className="mc-route-control" aria-label="默认模型选择"> {tab === 'connections' && <> <section className="mc-route-control" aria-label="默认模型选择">
<div className="mc-route-heading"><div><h3>新任务默认模型</h3><p>选择已保存的连接,或使用模型池调度。切换本身不请求模型。</p></div><button className="button secondary" disabled={locked} onClick={addConnection}><Plus size={15} />添加模型</button></div> <div className="mc-route-heading"><div><h3>新任务默认模型</h3><p>选择已保存的连接,或使用模型池调度。切换本身不请求模型。</p></div><button className="button secondary" disabled={locked} onClick={addConnection}><Plus size={15} />添加模型</button></div>
<label className="mc-route-select">当前选择<select aria-label="新任务默认模型" disabled={locked || !runtimeConfig} value={runtimeConfig?.mode === 'demo' || !connections.some(value => value.id === selected?.id) && selected?.type !== 'pool' ? '' : selected?.type + ':' + selected?.id} onChange={event => void selectRoute(event.target.value)}> <label className="mc-route-select">当前选择<select aria-label="新任务默认模型" disabled={locked || !runtimeConfig} value={runtimeConfig?.mode === 'demo' || !connections.some(value => value.id === selected?.id) && selected?.type !== 'pool' ? '' : selected?.type + ':' + selected?.id} onChange={event => void selectRoute(event.target.value)}>
<option value="" disabled>选择模型或添加连接</option> <option value="" disabled>选择模型或添加连接</option>
@@ -113,7 +113,7 @@ export function ModelCenter({ onConfig, busy, runModel }: { onConfig: (value: Co
</select></label> </select></label>
<div className="mc-route-detail">{runtimeConfig?.mode === 'demo' ? '请从上游获取模型,或选择已配置的连接开始开发。' : selected?.type === 'pool' ? '模型池按成员配置调度;每次实际连接和返回型号保存在请求账本。' : (() => { const connection = connections.find(c => c.id === selected?.id); return connection ? `${protocolLabel(connection.protocol)} · ${previewUrl(connection)} · 请求 ${connection.model || '未配置'}` : '请选择可用连接。'; })()}</div> <div className="mc-route-detail">{runtimeConfig?.mode === 'demo' ? '请从上游获取模型,或选择已配置的连接开始开发。' : selected?.type === 'pool' ? '模型池按成员配置调度;每次实际连接和返回型号保存在请求账本。' : (() => { const connection = connections.find(c => c.id === selected?.id); return connection ? `${protocolLabel(connection.protocol)} · ${previewUrl(connection)} · 请求 ${connection.model || '未配置'}` : '请选择可用连接。'; })()}</div>
{runModel && <div className="mc-run-model"><strong>当前会话最近运行</strong><span>{runModel.mode === 'demo' ? '离线演示' : runModel.routing?.members?.length ? runModel.routing.members.map(member => member.name + ' · ' + member.model).join(';') : runModel.model}</span><small>这是该次运行封存的请求配置;实际返回型号请看请求账本。更改默认选择不会改写旧记录。</small></div>} {runModel && <div className="mc-run-model"><strong>当前会话最近运行</strong><span>{runModel.mode === 'demo' ? '离线演示' : runModel.routing?.members?.length ? runModel.routing.members.map(member => member.name + ' · ' + member.model).join(';') : runModel.model}</span><small>这是该次运行封存的请求配置;实际返回型号请看请求账本。更改默认选择不会改写旧记录。</small></div>}
</section> </section></>}
{tab === 'budgets' && runtimeConfig && <ModelBudgetSettings key={JSON.stringify(runtimeConfig)} value={runtimeConfig} disabled={locked} onSave={input => void act(async () => { await api('/model-center/runtime-budgets', input); if (alive.current) setNotice('运行预算已保存,当前模型选择保持。'); })} />} {tab === 'budgets' && runtimeConfig && <ModelBudgetSettings key={JSON.stringify(runtimeConfig)} value={runtimeConfig} disabled={locked} onSave={input => void act(async () => { await api('/model-center/runtime-budgets', input); if (alive.current) setNotice('运行预算已保存,当前模型选择保持。'); })} />}
{tab === 'waits' && <ModelWaitSettings key={JSON.stringify(view.waitSettings)} value={view.waitSettings} disabled={locked} onSave={value => void act(async () => { {tab === 'waits' && <ModelWaitSettings key={JSON.stringify(view.waitSettings)} value={view.waitSettings} disabled={locked} onSave={value => void act(async () => {
const result = await api<{ config: Config }>('/model-center/wait-settings', value); const result = await api<{ config: Config }>('/model-center/wait-settings', value);
+29
View File
@@ -0,0 +1,29 @@
import { useMemo, useRef, useState } from 'react';
import type { ComponentType } from 'react';
import type { LucideProps } from 'lucide-react';
import { ArrowUpRight, Search } from 'lucide-react';
export type WorkbenchAction = { id: string; label: string; description: string; group: string; icon: ComponentType<LucideProps>; run: () => void; disabled?: boolean; reason?: string };
export function WorkbenchTools({ actions, onClose }: { actions: WorkbenchAction[]; onClose: () => void }) {
const [query, setQuery] = useState('');
const list = useRef<HTMLDivElement>(null);
const filtered = useMemo(() => actions.filter(action => (action.label + action.description + action.group).toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())), [actions, query]);
return <div className="workbench-tools">
<div className="tools-search"><Search size={18} /><input autoFocus data-autofocus aria-label="搜索工作台工具" value={query} onChange={event => setQuery(event.target.value)} placeholder="搜索工具、文件或任务操作…" onKeyDown={event => {
if (event.key === 'ArrowDown') { event.preventDefault(); list.current?.querySelector<HTMLButtonElement>('button:not(:disabled)')?.focus(); }
if (event.key === 'Enter') { const first = filtered.find(action => !action.disabled); if (first) { onClose(); first.run(); } }
}} /><kbd>Esc</kbd></div>
<div className="tools-results" ref={list} onKeyDown={event => {
if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;
const buttons = Array.from(list.current?.querySelectorAll<HTMLButtonElement>('button:not(:disabled)') ?? []);
if (!buttons.length) return;
event.preventDefault(); const index = buttons.indexOf(document.activeElement as HTMLButtonElement);
buttons[event.key === 'Home' ? 0 : event.key === 'End' ? buttons.length - 1 : (index + (event.key === 'ArrowDown' ? 1 : -1) + buttons.length) % buttons.length]?.focus();
}}>
{[...new Set(filtered.map(action => action.group))].map(group => <section key={group}><h3>{group}</h3>{filtered.filter(action => action.group === group).map(action => <button key={action.id} aria-label={action.label} disabled={action.disabled} title={action.disabled ? action.reason : action.description} onClick={() => { onClose(); action.run(); }}><span className="tools-action-icon"><action.icon size={18} /></span><span><strong>{action.label}</strong><small>{action.disabled ? action.reason || '当前不可用' : action.description}</small></span><ArrowUpRight size={15} /></button>)}</section>)}
{!filtered.length && <div className="tools-empty"><Search size={23} /><strong>没有找到“{query}”</strong><p>试试“模型”“文件”或“研究”。</p><button type="button" className="text-button" onClick={() => setQuery('')}>清除搜索</button></div>}
</div>
<div className="tools-footnote"><span>↑ ↓ 选择工具 · Enter 打开</span><span>Ctrl K 随时唤起</span></div>
</div>;
}
+15
View File
@@ -0,0 +1,15 @@
export const BRAND = {
name: 'Orven',
chineseName: '奥文',
category: 'AI 开发工作台',
slogan: '从想法,到运行。',
description: '理解你的项目,和你一起研究问题、编写代码,把想法变成可以运行的成果。',
} as const;
/** An open orbit and its forward stroke: a project taking shape and moving on. */
export function OrvenMark({ className = '', size = 32 }: { className?: string; size?: number }) {
return <svg className={'orven-mark ' + className} width={size} height={size} viewBox="0 0 40 40" fill="none" aria-hidden="true">
<path d="M30.7 12.3a13.2 13.2 0 1 0 1.7 12.6" stroke="currentColor" strokeWidth="5.2" strokeLinecap="round" />
<path d="m21.5 20 6.2 6.2L36 17.9" stroke="currentColor" strokeWidth="5.2" strokeLinecap="round" strokeLinejoin="round" />
</svg>;
}
+2 -2
View File
@@ -30,7 +30,7 @@ export function Modal({ title, description, children, onClose, wide = false }: {
const close = useRef(onClose); close.current = onClose; const close = useRef(onClose); close.current = onClose;
useEffect(() => { useEffect(() => {
const previous = document.activeElement as HTMLElement | null; const previous = document.activeElement as HTMLElement | null;
panel.current?.querySelector<HTMLElement>('input, select, textarea, button')?.focus(); (panel.current?.querySelector<HTMLElement>('[data-autofocus]') ?? panel.current?.querySelector<HTMLElement>('input:not(:disabled), select:not(:disabled), textarea:not(:disabled)') ?? panel.current?.querySelector<HTMLElement>('button:not(:disabled)'))?.focus();
const handle = (event: KeyboardEvent) => { const handle = (event: KeyboardEvent) => {
const dialogs = document.querySelectorAll('[role="dialog"][aria-modal="true"]'); const dialogs = document.querySelectorAll('[role="dialog"][aria-modal="true"]');
if (dialogs[dialogs.length - 1] !== panel.current) return; if (dialogs[dialogs.length - 1] !== panel.current) return;
@@ -119,7 +119,7 @@ export function EmptyInspector({ kind }: { kind: 'file' | 'changes' | 'trace' })
const Icon = kind === 'file' ? FileCode2 : kind === 'changes' ? Check : SquareTerminal; const Icon = kind === 'file' ? FileCode2 : kind === 'changes' ? Check : SquareTerminal;
return <div className="empty-inspector"><span className="empty-inspector-symbol"><Icon size={25} strokeWidth={1.5} /></span> return <div className="empty-inspector"><span className="empty-inspector-symbol"><Icon size={25} strokeWidth={1.5} /></span>
<h3>{kind === 'file' ? '查看项目文件' : kind === 'changes' ? '这里展示待审查改动' : '执行过程会记录在这里'}</h3> <h3>{kind === 'file' ? '查看项目文件' : kind === 'changes' ? '这里展示待审查改动' : '执行过程会记录在这里'}</h3>
<p>{kind === 'file' ? '从左侧打开文件,或让助手先读取项目。' : kind === 'changes' ? '助手提出修改后,可以查看完整差异,再决定是否应用。' : '每次工具调用都会保留参数、结果和完成状态。'}</p> <p>{kind === 'file' ? '切换左侧「文件」,打开源码;也可以让 Orven 先读取项目。' : kind === 'changes' ? '有文件改动后,在这里核对差异与应用结果。' : '每次工具调用都会保留参数、结果和完成状态。'}</p>
</div>; </div>;
} }
+1 -1
View File
@@ -2,5 +2,5 @@ import React from 'react';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import App from './App'; import App from './App';
import './styles.css'; import './styles.css';
import './control-console.css'; import './orven.css';
ReactDOM.createRoot(document.getElementById('root')!).render(<React.StrictMode><App /></React.StrictMode>); ReactDOM.createRoot(document.getElementById('root')!).render(<React.StrictMode><App /></React.StrictMode>);
+2 -1
View File
@@ -6,6 +6,7 @@ import type { CompanionDevice, MobileBrief, MobileTask } from '../companion-type
import { mobileApi, MobileError, verifiedText, verifyDigest } from './api'; import { mobileApi, MobileError, verifiedText, verifyDigest } from './api';
import { MobileInputImage } from './MobileInputImage'; import { MobileInputImage } from './MobileInputImage';
import './file-results.css'; import './file-results.css';
import { BRAND, OrvenMark } from '../brand';
const stateLabel = (state: string) => ({ idle: '未开始', waiting: '等待审批', validating: '校验中', queued: '排队中', executing: '执行中', error: '错误', running: '执行中', awaiting_approval: '等待审批', stopping: '正在停止', completed: '已完成', needs_review: '待审查', failed: '失败', interrupted: '已中断', cancelled: '已停止', paused: '已暂停', unknown: '需核对', completed_with_changes: '待审查', passed: '通过', pending: '待处理', applied: '已应用', denied: '已拒绝', approved: '已批准', conflict: '有冲突', unverified: '需核对', stale: '已变化' } as Record<string, string>)[state] ?? state; const stateLabel = (state: string) => ({ idle: '未开始', waiting: '等待审批', validating: '校验中', queued: '排队中', executing: '执行中', error: '错误', running: '执行中', awaiting_approval: '等待审批', stopping: '正在停止', completed: '已完成', needs_review: '待审查', failed: '失败', interrupted: '已中断', cancelled: '已停止', paused: '已暂停', unknown: '需核对', completed_with_changes: '待审查', passed: '通过', pending: '待处理', applied: '已应用', denied: '已拒绝', approved: '已批准', conflict: '有冲突', unverified: '需核对', stale: '已变化' } as Record<string, string>)[state] ?? state;
const time = (value: string) => new Date(value).toLocaleString('zh-CN', { month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit' }); const time = (value: string) => new Date(value).toLocaleString('zh-CN', { month: 'numeric', day: 'numeric', hour: '2-digit', minute: '2-digit' });
@@ -108,7 +109,7 @@ export function MobileApp({ initialToken }: { initialToken: string }) {
const projectName = (id: string) => projects.find(value => value.id === id)?.name ?? '原项目'; const projectName = (id: string) => projects.find(value => value.id === id)?.name ?? '原项目';
const selectedTask = task?.id === selected ? task : null; const selectedTask = task?.id === selected ? task : null;
return <div className="mobile-app"> return <div className="mobile-app">
<header className="mobile-header"><span className="mobile-mark"><Terminal size={20} /></span><div><strong>Agent Workbench</strong><span>手机伴随端 · Windows 执行宿主</span></div><button aria-label="刷新任务" disabled={!!busy} onClick={() => void refresh()}><RefreshCw size={19} /></button></header> <header className="mobile-header"><span className="mobile-mark"><OrvenMark size={24} /></span><div><strong>{BRAND.name}</strong><span>手机伴随端 · 接续你的工作</span></div><button aria-label="刷新任务" disabled={!!busy} onClick={() => void refresh()}><RefreshCw size={19} /></button></header>
{me && <div className={'mobile-connection ' + (fresh ? '' : 'disconnected')}>{fresh ? <Wifi size={14} /> : <WifiOff size={14} />}<span>{fresh ? '已同步 · ' + time(lastSync) : '连接中断 · 当前内容可能已过期'}</span><span>{me.device.permissions.approve ? '可审批' : '观察'}</span></div>} {me && <div className={'mobile-connection ' + (fresh ? '' : 'disconnected')}>{fresh ? <Wifi size={14} /> : <WifiOff size={14} />}<span>{fresh ? '已同步 · ' + time(lastSync) : '连接中断 · 当前内容可能已过期'}</span><span>{me.device.permissions.approve ? '可审批' : '观察'}</span></div>}
{error && <div className="mobile-error" role="alert"><strong>{fresh ? '操作未完成' : connectionRequired ? '需要连接' : '连接待恢复'}</strong><p>{error}</p>{me && <button onClick={() => void refresh()} disabled={!!busy}>重新同步</button>}</div>} {error && <div className="mobile-error" role="alert"><strong>{fresh ? '操作未完成' : connectionRequired ? '需要连接' : '连接待恢复'}</strong><p>{error}</p>{me && <button onClick={() => void refresh()} disabled={!!busy}>重新同步</button>}</div>}
{me?.operations?.some(value => value.status === 'unknown') && <div className="mobile-unknown"><strong>手机操作回执需要核对</strong><p>有原审批或停止操作没有完整回执,请在电脑核对;手机不会自动重放。</p>{me.operations.filter(value => value.status === 'unknown').map(value => <code key={value.requestId}>Task {value.taskId} · {value.action === 'stop' ? '停止' : '审批'}</code>)}</div>} {me?.operations?.some(value => value.status === 'unknown') && <div className="mobile-unknown"><strong>手机操作回执需要核对</strong><p>有原审批或停止操作没有完整回执,请在电脑核对;手机不会自动重放。</p>{me.operations.filter(value => value.status === 'unknown').map(value => <code key={value.requestId}>Task {value.taskId} · {value.action === 'stop' ? '停止' : '审批'}</code>)}</div>}
+1
View File
@@ -2,6 +2,7 @@ import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client'; import { createRoot } from 'react-dom/client';
import { MobileApp } from './MobileApp'; import { MobileApp } from './MobileApp';
import './mobile.css'; import './mobile.css';
import './orven-mobile.css';
const fragment = new URLSearchParams(location.hash.slice(1)); const fragment = new URLSearchParams(location.hash.slice(1));
const token = fragment.get('pair') ?? ''; const token = fragment.get('pair') ?? '';
+20
View File
@@ -0,0 +1,20 @@
:root { color: #37333f; background: #f5f5f8; --ink: #37333f; --muted: #716979; --line: #e5dfed; --green: #277859; }
button, input, select { border-color: #dcd2e7; border-radius: 8px; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline-color: #6253b5; }
.mobile-app { background: #fff; }
.mobile-header { background: #fff; color: #37333f; border-bottom: 1px solid #e6dfed; }
.mobile-mark { border: 0; background: #f2edf9; color: #6253b5; border-radius: 10px; }
.mobile-header strong { font-size: 24px; letter-spacing: -.6px; }
.mobile-header div > span { color: #716979; font-size: 10px; }
.mobile-header button { color: #716979; }
.mobile-primary { background: #6253b5; border-color: #6253b5; border-radius: 8px; }
.mobile-pair-heading > svg { color: #80708d; }
.mobile-pair-heading h1 { color: #4b4155; font-weight: 600; }
.mobile-pair-heading p, .mobile-pair-help p { color: #716979; }
.mobile-pair-help { background: #f8f5fc; border-color: #e7dcef; color: #867093; border-radius: 10px; }
.mobile-projects, .mobile-session, .mobile-task-title, .mobile-document { border-color: #e5dfed; }
.mobile-tabs { background: #faf8fd; border-color: #e4d9ef; }
.mobile-tabs button.active, .mobile-tabs button[aria-selected="true"] { color: #6253b5; border-color: #6253b5; background: #f1eaf9; }
.mobile-error { color: #8b4255; background: #fff4f7; border-color: #eed6e1; }
.mobile-error button { color: #8b4255; border-color: #dcbac9; }
.mobile-stream { background: #f7f2fc; border-left-color: #a58abb; }
+466
View File
@@ -0,0 +1,466 @@
/* Orven: a quiet engineering workspace. Shared tokens also theme tool panels. */
:root {
font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
font-size: 14px;
color: #37333f;
background: #f9f9fb;
font-synthesis: none;
--ink: #25262d;
--muted: #686a76;
--line: #e4e4eb;
--paper: #ffffff;
--teal: #6253b5;
--blue: #6253b5;
--accent: #6253b5;
--accent-soft: #efecf9;
--surface: #f6f6f9;
--success: #277859;
--danger: #ad3f48;
}
::selection { background: #e1dcf4; color: #37333f; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [role="separator"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .48; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: #d0ced9 transparent; }
.icon-button { color: var(--muted); width: 32px; height: 32px; border-radius: 7px; }
.icon-button:hover { background: #eeedf3; color: var(--ink); }
.button { min-height: 36px; height: auto; padding: 8px 13px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover:not(:disabled) { background: #51439c; }
.button.secondary { background: #fff; border: 1px solid #dcdce5; color: #57515f; }
.button.secondary:hover:not(:disabled) { background: #f5f4f9; border-color: #c7c2dc; }
.text-button { color: #57515f; border-radius: 6px; font-size: 12px; }
.text-button:hover { background: #eeecf5; color: var(--accent); }
/* Project context stays in a continuous navigation surface. */
.orven-workbench { grid-template-columns: 242px minmax(320px, 1fr) 430px; max-width: none; background: #fff; }
.orven-workbench.inspector-closed { grid-template-columns: 242px minmax(0, 1fr) 0; }
.orven-workbench.sidebar-hidden { grid-template-columns: 0 minmax(320px, 1fr) 430px; }
.orven-workbench.sidebar-hidden.inspector-closed { grid-template-columns: 0 minmax(0, 1fr) 0; }
.orven-workbench.inspector-wide { grid-template-columns: 242px minmax(310px, 1fr) min(48vw, 760px); }
.orven-workbench.inspector-closed .inspector { display: none; }
.project-sidebar { background: #f5f5f8; color: #57515f; border-color: var(--line); }
.brand { height: 84px; min-height: 84px; padding: 0 20px; border: 0; gap: 10px; }
.brand-mark { width: 35px; height: 39px; background: transparent; box-shadow: none; color: var(--accent); border: 0; }
.brand strong { font: 650 26px/1.05 "Segoe UI Variable", "Segoe UI", sans-serif; letter-spacing: -1.1px; color: #37333f; }
.brand div > span { color: #57515f; font-size: 10px; letter-spacing: .1px; margin-top: 6px; }
.brand > .icon-button { margin-left: auto; width: 28px; color: #57515f; }
.project-selector { margin: 4px 14px 0; padding: 12px 12px 14px; border: 1px solid #e1e0e9; background: #fafafc; border-radius: 9px; }
.field-eyebrow { color: #57515f; font-size: 11px; font-weight: 500; letter-spacing: .1px; }
.project-select-row { color: #57515f; gap: 8px; margin: 7px 0 4px; }
.project-select-row select { color: #37333f; font-size: 13px; font-weight: 600; padding: 3px 0; }
.project-select-row select option { color: #37333f; background: white; }
.project-root { color: #57515f; font-size: 10px; line-height: 1.7; }
.example-tag { display: block; font-size: 10px; color: #57515f; line-height: 1.7; margin-top: 7px; }
.project-sidebar > .new-task-button { flex-shrink: 0; width: calc(100% - 28px); margin: 18px 14px 16px; height: 40px; background: #fff; color: #57515f; border: 1px solid #d9d5e5; border-radius: 8px; font-size: 13px; font-weight: 600; padding: 0 12px; box-shadow: 0 1px 2px #30234a04; }
.new-task-button > svg:last-child { margin-left: auto; color: #57515f; transform: rotate(45deg); }
.new-task-button:hover { background: #f1eef9; border-color: #c4bbdc; }
.sidebar-view-tabs { display: flex; align-items: center; margin: 0 16px 0; border-bottom: 1px solid #dedde6; flex-shrink: 0; gap: 17px; }
.sidebar-view-tabs button { display: flex; align-items: center; gap: 6px; min-height: 37px; border-bottom: 2px solid transparent; color: #57515f; padding: 0 2px; font-size: 12px; }
.sidebar-view-tabs button[aria-selected="true"] { border-color: var(--accent); color: #57515f; font-weight: 600; }
.sidebar-view-tabs button > span { color: #57515f; background: #e9e7ee; border-radius: 4px; font-size: 10px; min-width: 18px; padding: 1px 4px; text-align: center; }
.sidebar-section { padding: 16px 12px; }
.sessions-section { flex: 1; display: flex; flex-direction: column; min-height: 60px; border: 0; overflow: hidden; }
.section-label { font-weight: 500; color: #57515f; font-size: 11px; margin: 0 4px 7px; }
.session-list { margin: 0; max-height: none; min-height: 0; overflow: auto; flex: 1; }
.session-item { border-radius: 6px; margin: 2px 0; }
.session-select { padding: 11px 10px; font-size: 12px; color: #57515f; min-height: 39px; }
.session-item.selected { background: #e9e5f3; }
.session-item.selected .session-select { color: #57515f; }
.session-item:hover { background: #eeecf3; }
.session-select > svg { color: #57515f; }
.session-select > b { color: #57515f; background: #fff; }
.sidebar-empty { padding: 27px 6px; text-align: center; color: #57515f; }
.sidebar-empty > svg { margin-bottom: 12px; color: #57515f; }
.sidebar-empty strong { display: block; color: #57515f; font-size: 12px; font-weight: 500; }
.sidebar-empty p { margin-top: 8px; color: #57515f; font-size: 11px; line-height: 1.8; }
.file-section { flex: 1; padding-top: 13px; }
.file-filter { border: 1px solid #dfdce7; background: #fcfbfe; height: 33px; border-radius: 6px; color: #57515f; margin: 0 3px 9px; }
.file-filter input { font-size: 12px; color: #37333f; }
.file-filter input::placeholder, .file-filter kbd { color: #57515f; }
.tree-row { height: 32px; color: #57515f; font-size: 12px; }
.tree-row svg { color: #57515f; }
.tree-row:hover { background: #eeebf3; }
.tree-row.selected { background: #e8e3f2; color: #57515f; }
.tree-row.selected svg { color: #57515f; }
.sidebar-footer { padding: 10px 12px 12px; border-color: #e1dfe8; background: #f5f5f8; }
.sidebar-footer > button { min-height: 38px; color: #57515f; font-size: 12px; border-radius: 6px; padding: 9px 9px; }
.sidebar-footer > button:hover { background: #eae7f1; }
.sidebar-footer > button > svg:last-child { color: #57515f; }
.sidebar-footer > button > kbd { margin-left: auto; color: #57515f; font-size: 10px; }
.sidebar-footer > .model-sidebar-entry { margin-top: 4px; padding: 11px 9px; }
.model-sidebar-entry small { color: #57515f; margin-top: 3px; font-size: 10px; }
.connection { border-top: 1px solid #e1dfe8; margin: 7px 5px 0; padding: 13px 0 1px; color: #57515f; font-size: 10px; }
.connection.connected > span { background: #3e8c6d; }
.version-entry { color: #57515f; font-size: 10px; }
/* The conversation is the default work surface; results open alongside it. */
.task-pane { background: #fff; min-height: 0; container-type: inline-size; }
.work-header { min-height: 76px; height: 76px; padding: 0 32px; gap: 18px; border-color: #eeeef2; }
.work-title { flex: 1; gap: 12px; }
.work-title > div { min-width: 0; }
.header-breadcrumb { color: #57515f; font-size: 11px; margin-bottom: 6px; }
.work-title h1 { font: 600 15px/1.4 "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", sans-serif; color: #37333f; max-width: 570px; }
.model-launch { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-tools, .inspector-toggle { display: flex; gap: 7px; align-items: center; min-height: 34px; border-radius: 7px; padding: 7px 10px; color: #57515f; font-size: 12px; white-space: nowrap; }
.header-tools:hover, .inspector-toggle:hover { background: #f3f1f8; }
.header-tools kbd { margin-left: 8px; color: #57515f; font-size: 10px; }
.inspector-toggle { border: 1px solid #e2deeb; color: #57515f; }
.inspector-toggle[aria-pressed="true"] { color: var(--accent); background: #f2eff9; border-color: #d5cdea; }
.task-toolbar { height: 43px; min-height: 43px; padding: 0 30px; gap: 12px; border: 0; background: #fff; color: #57515f; }
.task-local { color: #57515f; font-size: 11px; gap: 7px; }
.local-dot { width: 5px; height: 5px; background: #7a998a; border-radius: 50%; }
.task-toolbar .subtle { font-size: 11px; color: #57515f; }
.toolbar-actions { gap: 5px; }
.toolbar-actions .text-button { color: #57515f; font-size: 11px; }
.status { font-size: 10px; border-radius: 4px; font-weight: 500; }
.status-idle { color: #57515f; background: #f0edf5; }
.status-running, .status-retrying { color: #57515f; background: #f0eafa; }
.status-completed, .status-passed, .status-applied { color: #28664f; background: #eaf4ee; }
.status-failed, .status-conflict { color: #a43d48; background: #fff0f1; }
.conversation { padding: 28px 38px 22px; }
.conversation-entries { max-width: 800px; margin: 0 auto; }
.message { gap: 13px; margin-bottom: 27px; }
.message-avatar { width: 30px; height: 30px; border-radius: 8px; color: #57515f; background: #f0ebf8; border: 0; font-size: 11px; }
.message-user .message-avatar { color: #57515f; background: #f0edf3; }
.message-label { color: #57515f; font-size: 12px; font-weight: 600; margin-bottom: 9px; }
.message-label time { color: #57515f; font-size: 10px; font-weight: 400; }
.message-text, .message-text .research-content { font-size: 14px; color: #37333f; line-height: 1.9; }
.message-text .research-content h2, .message-text .research-content h3, .message-text .research-content h4 { color: #37333f; }
.message-text .research-content code { background: #f3f0f7; color: #57515f; }
.message-system .message-text { color: #57515f; }
.inline-event { margin-left: 43px; }
.tool-row { min-height: 43px; border: 1px solid #e6e1ed; border-radius: 7px; background: #faf9fc; }
.tool-name > strong { color: #57515f; font-size: 12px; }
.tool-name > span, .tool-end { color: #57515f; font-size: 11px; }
.tool-symbol { background: #f1edf7; color: #57515f; }
.tool-completed .tool-symbol { color: #4f7b64; background: #eaf4ee; }
.working-note { color: #57515f; font-size: 12px; }
.system-event { color: #57515f; }
.system-event-output { margin: 4px 0 0; color: #716979; }
.system-event-output summary { cursor: pointer; display: list-item; font-size: 10px; padding: 3px 0; width: fit-content; }
.system-event-output pre { color: #57515f; background: #f8f6fb; border: 1px solid #e7e0ee; border-radius: 6px; padding: 10px; margin: 6px 0; max-height: 220px; overflow: auto; font-size: 11px; line-height: 1.8; }
.model-stream-preview { border-left-color: #aaa0c7; background: #f8f6fc; color: #57515f; }
.model-stream-preview span, .model-stream-preview p { color: #57515f; }
/* First task: useful project context and three concrete starting points. */
.orven-welcome { max-width: 740px; width: 100%; margin: clamp(12px, 4vh, 48px) auto 16px; padding: 0; }
.welcome-signature { display: flex; align-items: center; gap: 12px; margin-bottom: 33px; color: var(--accent); }
.welcome-signature > span { font-size: 23px; font-weight: 600; letter-spacing: -.7px; color: #37333f; }
.welcome-signature small { display: block; margin-top: 4px; color: #57515f; font-size: 11px; font-weight: 400; letter-spacing: .4px; }
.orven-welcome h2 { color: #37333f; font: 600 clamp(25px, 2.4vw, 34px)/1.4 "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", sans-serif; letter-spacing: -.9px; margin: 0 0 14px; }
.orven-welcome > p { color: #57515f; font-size: 14px; line-height: 1.9; margin: 0; }
.welcome-project { display: flex; gap: 12px; align-items: center; padding: 18px 0; margin-top: 28px; border-bottom: 1px solid #e9e5ee; }
.welcome-project-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; background: #f3f0f8; color: #57515f; }
.welcome-project > div { min-width: 0; flex: 1; }
.welcome-project strong { font-size: 13px; font-weight: 600; color: #57515f; display: flex; gap: 8px; align-items: center; }
.welcome-project strong > span { padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 400; color: #57515f; background: #f1edf7; }
.welcome-project small { display: block; color: #57515f; font-size: 11px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.welcome-project > button { display: flex; align-items: center; gap: 7px; min-height: 36px; font-size: 12px; color: #57515f; padding: 6px 10px; border: 1px solid #e3dce9; border-radius: 6px; white-space: nowrap; }
.welcome-project > button > svg { transform: rotate(45deg); }
.welcome-project > button:hover { background: #f4f0fa; }
.starter-heading { font-size: 11px; color: #57515f; margin: 24px 0 12px; }
.orven-welcome .starter-prompts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin: 0; width: 100%; max-width: none; }
.orven-welcome .starter-prompts > button { min-height: 87px; padding: 15px 12px; border: 1px solid #e7e1ed; border-radius: 8px; background: #fff; display: flex; align-items: center; gap: 10px; box-shadow: none; }
.orven-welcome .starter-prompts > button:hover { background: #faf8fd; border-color: #c9bbdb; }
.orven-welcome .starter-prompts .starter-icon { display: flex; width: 25px; height: 30px; align-items: center; justify-content: flex-start; background: none; color: #57515f; border-radius: 0; }
.orven-welcome .starter-prompts > button > span:nth-child(2) { flex: 1; min-width: 0; display: block; background: none; width: auto; height: auto; }
.starter-prompts strong { display: block; color: #57515f; font-size: 12px; font-weight: 500; white-space: nowrap; }
.starter-prompts small { display: block; color: #57515f; font-size: 10px; margin-top: 6px; white-space: nowrap; }
.orven-welcome .starter-prompts > button > svg { color: #57515f; margin: 0; width: 12px; }
.welcome-connect { display: flex; width: 100%; align-items: center; gap: 9px; margin-top: 22px; padding: 4px 0; min-height: 32px; color: #57515f; font-size: 11px; text-align: left; }
.welcome-connect > svg:last-child { margin-left: auto; }
.welcome-connect:hover { color: var(--accent); }
/* Input and execution controls share one stable, reachable footer. */
.composer-wrap { background: white; border: 0; padding: 14px max(30px, calc((100% - 800px) / 2)) 17px; }
.composer { display: flex; flex-direction: column; background: #fff; border: 1px solid #dcd4e6; border-radius: 12px; box-shadow: 0 4px 20px #39214805; overflow: visible; }
.composer:focus-within { border-color: #ab94c7; box-shadow: 0 0 0 3px #b9a6d015; }
.composer textarea { min-height: 90px; padding: 17px 19px 7px; color: #37333f; font-size: 14px; line-height: 1.8; }
.composer textarea::placeholder { color: #57515f; }
.composer .input-composer { border: 0; padding: 0 11px; }
.input-composer-tools { gap: 8px; }
.input-composer-tools > span { color: #57515f; font-size: 10px; }
.input-add { color: #57515f; font-size: 11px; padding: 5px 7px; }
.input-add:hover { background: #f3eef8; }
.input-route { color: #57515f; }
.composer-bottom { min-height: 52px; padding: 8px 13px 11px; gap: 10px; }
.composer-options { display: flex; align-items: center; min-width: 0; gap: 8px; }
.composer-model { display: flex; align-items: center; gap: 7px; padding: 6px; min-width: 0; font-size: 11px; color: #57515f; border-radius: 5px; }
.composer-model > span:nth-child(2) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 190px; }
.composer-model:hover { background: #f5effa; }
.model-light { background: #609577; width: 6px; height: 6px; }
.model-light.model-unset { background: #aa96b5; }
.composer-divider { height: 14px; width: 1px; background: #e5ddea; flex-shrink: 0; }
.composer .permission-mode { border: 0; padding: 4px; color: #57515f; background: none; gap: 4px; min-width: 0; }
.composer .permission-mode select { color: #57515f; font-size: 11px; min-height: 28px; max-width: 145px; }
.composer .send-button { display: grid; place-items: center; width: 34px; height: 34px; background: var(--accent); border-radius: 8px; color: #fff; flex-shrink: 0; }
.composer .send-button:disabled { opacity: 1; color: #57515f; background: #efebf4; }
.composer .send-button:hover:not(:disabled) { background: #50419d; }
.stop-button { background: #fbf0f2; color: #a04a60; border: 1px solid #ecd5de; border-radius: 6px; padding: 8px 10px; font-size: 12px; }
.composer-footnote { display: flex; justify-content: space-between; gap: 10px; color: #57515f; padding: 10px 2px 0; font-size: 10px; }
/* A practical review pane, with legible source and semantic diff colors. */
.inspector { background: #faf9fc; border-color: var(--line); min-height: 0; }
.inspector-tabs { gap: 2px; padding: 0 9px; height: 54px; background: #faf9fc; border-color: #e7e1ec; }
.inspector-tabs > button:not(.icon-button) { font-size: 11px; color: #57515f; gap: 4px; padding: 0 7px; }
.inspector-tabs > button.selected { color: var(--accent); border-bottom-color: var(--accent); }
.inspector-tabs > button > b { color: #57515f; background: #eae2f4; }
.inspector-tabs > .icon-button { width: 28px; }
.inspector-footer { color: #57515f; border-color: #e8e1ed; font-size: 10px; padding: 11px 10px; }
.empty-inspector { max-width: 320px; padding: 32px 27px; }
.empty-inspector-symbol { width: 52px; height: 52px; border-radius: 12px; color: #57515f; border: 1px solid #e7deef; background: #f4eff9; margin-bottom: 21px; }
.empty-inspector h3 { color: #57515f; font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.empty-inspector p { color: #57515f; font-size: 12px; line-height: 1.8; }
.file-heading, .file-details { background: #faf8fd; border-color: #e9e1f0; color: #57515f; font-size: 11px; }
.code-view { background: #fff; font-size: 12px; line-height: 1.9; }
.code-view code { color: #57515f; }
.code-view > div > span { color: #57515f; font-size: 11px; }
.code-editor { color: #37333f; background: #fff; font-size: 12px; }
.change-list, .change-summary, .change-actions, .event-details { border-color: #e6dfed; }
.change-list > button { color: #57515f; font-size: 12px; }
.change-list > button:hover, .change-list > button.selected { background: #eee7f6; }
.change-summary strong { color: #57515f; font-size: 12px; }
.change-summary > p, .diff-caption, .trace-caption, .event-details h4 { color: #57515f; border-color: #e9e0f1; }
.diff-view { background: #fff; }
.diff-line { color: #57515f; font-size: 12px; }
.diff-line.diff-added { background: #edf6f0; color: #38654b; }
.diff-line.diff-removed { background: #fceff1; color: #9a4252; }
.line-number { color: #57515f; }
.event-detail-heading strong { color: #57515f; font-size: 12px; }
.event-details pre { color: #57515f; background: #f5effa; border-color: #e9dff2; }
.inspector-resize-handle:hover, .inspector-resizing .inspector-resize-handle { background: #9980bb; }
/* Existing capabilities keep their own layouts and share this surface system. */
.modal-backdrop { background: #20172f55; backdrop-filter: blur(2px); }
.modal { color: #57515f; background: #fff; border: 1px solid #e1d7ea; border-radius: 14px; box-shadow: 0 24px 100px #25153730; padding: 26px; }
.modal-heading h2 { font: 600 20px/1.4 "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", sans-serif; color: #37333f; letter-spacing: -.4px; }
.modal-heading p { color: #57515f; font-size: 12px; line-height: 1.8; }
.modal-heading > .icon-button { color: #57515f; }
.modal .form-field { color: #716979; font-size: 12px; }
.modal .form-field input, .modal .form-field select, .modal .form-field textarea { color: #57515f; border-color: #dfd1e9; background: #fff; border-radius: 7px; min-height: 40px; }
.modal .form-field input::placeholder { color: #57515f; }
.modal .subtle, .modal .mc-help { color: #57515f; }
.modal :is(.skill-center, .mcp-panel, .worker-console, .evaluation-console, .project-memory, .engine-panel, .rea-panel, .diagnostic-panel) { color: #57515f; font-size: 13px; }
.modal :is(.skill-heading, .mcp-heading, .worker-console-heading, .evaluation-heading, .memory-overview, .engine-heading, .rea-heading) h2 { color: #37333f; font-size: 22px; font-weight: 600; letter-spacing: -.5px; }
.modal :is(.skill-heading, .mcp-heading, .worker-console-heading, .evaluation-heading, .memory-overview, .engine-heading, .rea-heading) p { color: #716979; font-size: 12px; line-height: 1.9; }
.modal :is(.skill-kicker, .mcp-kicker, .worker-eyebrow, .evaluation-kicker, .memory-eyebrow, .engine-eyebrow, .rea-eyebrow) { color: #716979; font-size: 10px; }
.modal :is(.skill-status-bar, .mcp-status-bar, .memory-summary) { color: #716979; border-color: #e4deeb; background: #faf8fc; padding: 12px; border-radius: 6px; }
.modal :is(.skill-register, .mcp-register, .worker-plan-form, .worker-budget-form, .evaluation-form, .memory-editor, .engine-connection, .rea-registration) { background: #f8f6fb; border: 1px solid #e2daeb; border-radius: 10px; padding: 20px; }
.modal :is(.skill-register-heading, .mcp-register-heading, .memory-editor-heading) { color: #57515f; }
.modal :is(.skill-empty, .mcp-empty, .memory-empty, .engine-empty, .rea-empty, .rea-empty-result) { color: #716979; border: 1px solid #e5deee; background: #fff; border-radius: 10px; padding: 30px 20px; }
.modal :is(.skill-empty, .mcp-empty, .memory-empty, .engine-empty, .rea-empty, .rea-empty-result) > svg { color: #8d7c9e; }
.modal :is(.skill-empty, .mcp-empty, .memory-empty, .engine-empty, .rea-empty, .rea-empty-result) strong { color: #57515f; }
.modal :is(.skill-form-grid, .mcp-form-grid, .memory-form-grid, .evaluation-form, .worker-plan-form) label { color: #57515f; font-size: 12px; }
.modal input:not([type="checkbox"]):not([type="radio"]), .modal select, .modal textarea { border-color: #d8cde4; border-radius: 7px; color: #57515f; }
.modal input[type="checkbox"], .modal input[type="radio"] { accent-color: var(--accent); }
.modal :is(input, textarea)::placeholder { color: #81708b; }
.modal :is(.mcp-boundary, .worker-boundary, .memory-scope-warning) { color: #716979; border-color: #e4d9ee; background: #f7f2fc; border-radius: 7px; }
.modal :is(.skill-source, .mcp-source, .engine-scope, .rea-hint, .skill-path, .memory-meta, .worker-scope, .worker-note, .evaluation-note) { color: #716979; }
.modal .diagnostic-intro strong, .modal .diagnostic-grid h3 { color: #57515f; }
.modal .diagnostic-grid section { border-color: #e3dbea; background: #faf8fd; border-radius: 8px; }
.modal .diagnostic-grid dt, .modal .diagnostic-grid dd { color: #716979; }
.change-set-bar { background: #f8f5fc; border-color: #e7ddf0; color: #625275; }
.review-callout { background: #f4f0fa; border-color: #dfd4ed; color: #57515f; border-radius: 9px; }
.review-callout small { color: #57515f; }
.recovery-note { background: #f7f3fc; border-color: #dfd3ef; color: #716979; }
.recovery-note p { color: #57515f; }
.approval-card { background: #fffcf4; border: 1px solid #eadbb5; border-left: 3px solid #caa355; border-radius: 9px; box-shadow: none; }
.approval-heading strong { color: #82622c; font-size: 13px; }
.approval-heading p, .approval-scope { color: #57515f; font-size: 12px; }
.approval-card > pre { background: #f8f3e8; border-color: #ede2cb; color: #57515f; font-size: 12px; }
.approval-actions .button.primary { background: #a77d33; border-color: #a77d33; }
.failure-card { background: #fff9fa; border-color: #efdae2; border-left: 3px solid #c56d8d; border-radius: 9px; }
.failure-heading > strong { color: #a04c6c; }
.failure-heading, .failure-card p { color: #9b6783; }
.toast { background: #44334f; color: #fff; border-color: #65506f; border-radius: 9px; }
.toast .icon-button { color: #57515f; }
/* Model management is a connected work surface, not a separate admin theme. */
.modal:has(.model-center) { border-radius: 13px; border-color: #ded3ea; }
.modal:has(.model-center) > .modal-heading { background: white; border-color: #e7ddef; padding: 23px 28px 20px; }
.modal:has(.model-center) > .modal-heading h2 { color: #57515f; font-size: 20px; font-weight: 600; }
.modal:has(.model-center) > .modal-heading p { color: #57515f; }
.model-center { color: #57515f; background: #faf7fd; }
.mc-overview { background: #f5effa; border-color: #e5d9ee; padding: 24px 28px; }
.mc-eyebrow { color: #57515f; letter-spacing: .1em; }
.mc-overview h2 { color: #57515f; font-size: 23px; font-weight: 600; letter-spacing: -.5px; }
.mc-overview p, .mc-section-title p { color: #57515f; font-size: 12px; }
.mc-current { border-color: #e1d2ec; border-radius: 9px; box-shadow: none; }
.mc-current > span, .mc-current strong { color: #716979; }
.mc-tabs { background: #fff; border-color: #e5d9ef; }
.mc-tabs button { color: #57515f; border-bottom-width: 2px; font-size: 12px; font-weight: 500; }
.mc-tabs button[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.mc-tabs button:hover { background: #f8f1fc; }
.mc-content { padding-top: 25px; }
.mc-section-title h3 { color: #57515f; font-size: 16px; font-weight: 600; }
.mc-connection, .mc-pool, .mc-checks article, .mc-import-source { border-color: #e6d9f0; border-radius: 10px; box-shadow: none; }
.mc-card-heading h4, .mc-pool h4 { color: #57515f; }
.mc-card-heading > div > span, .mc-connection dt, .mc-pool p { color: #716979; }
.mc-connection dd { color: #716979; }
.mc-service-icon { color: #716979; background: #f4eafa; border-color: #e5cff4; border-radius: 10px; }
.mc-connection footer { border-color: #eedff7; }
.mc-capabilities span { border-color: #ead9f6; color: #716979; }
.mc-editor { border-color: #ddc6ee; border-top-color: var(--accent); border-radius: 10px; }
.mc-form-grid label { color: #716979; }
.mc-form-grid input, .mc-form-grid select { color: #57515f; border-color: #dfc6ef; border-radius: 7px; }
.mc-checkbox { color: #716979; }
.mc-checkbox input { accent-color: var(--accent); }
.mc-empty { color: #716979; border-style: solid; border-color: #e9d9f4; background: #fff; border-radius: 10px; padding: 35px 24px; }
.mc-icon-action, .mc-probe { color: #716979; }
.mc-route-control { background: #fff; border: 1px solid #e1dce9; border-left: 1px solid #e1dce9; border-radius: 9px; color: #57515f; }
.mc-route-heading h3 { color: #514b5c; font-size: 13px; font-weight: 600; }
.mc-route-heading p, .mc-route-detail { color: #716979; font-size: 11px; }
.mc-route-select { color: #716979; }
.mc-route-select select { color: #57515f; border-color: #d8d0e3; border-radius: 7px; }
@media (min-width: 941px) {
.model-center { display: grid; grid-template-columns: 178px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); flex: 1; }
.mc-overview { grid-column: 1 / -1; padding: 23px 28px; background: #f7f5fa; }
.mc-overview h2 { font-size: 22px; margin-block: 7px; }
.mc-tabs { grid-column: 1; grid-row: 2; border-bottom: 0; border-right: 1px solid #e5dfee; padding: 15px 10px; gap: 3px; display: flex; flex-direction: column; overflow-y: auto; background: #faf9fc; }
.mc-tabs button { min-height: 41px; padding: 10px 13px; border: 0; border-radius: 6px; font-size: 12px; flex-shrink: 0; }
.mc-tabs button[aria-current] { background: #ebe5f5; color: #6253b5; }
.mc-tabs .mc-refresh { margin: auto 0 0; justify-content: flex-start; }
.mc-tabs .mc-refresh::after { content: '刷新连接状态'; font-size: 11px; }
.mc-content { grid-column: 2; grid-row: 2; background: #fff; padding: 24px 26px; }
.mc-notice { grid-column: 2; grid-row: 2; z-index: 1; align-self: start; box-shadow: 0 5px 20px #58405c12; }
.model-center:has(> .mc-notice) .mc-content { padding-top: 96px; }
.model-center > .mc-empty { grid-column: 2; grid-row: 2; align-self: start; margin: 24px; }
.mc-connections { grid-template-columns: 1fr; }
}
/* Searchable tool discovery uses words and keyboard navigation. */
.modal:has(.workbench-tools) { width: 640px; padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: min(780px, 90dvh); }
.modal:has(.workbench-tools) > .modal-heading { padding: 22px 24px 16px; margin: 0; flex-shrink: 0; }
.workbench-tools { display: flex; flex-direction: column; min-height: 0; }
.tools-search { display: flex; align-items: center; gap: 11px; padding: 12px 22px; border-block: 1px solid #e8e3ef; background: #faf8fd; color: #57515f; flex-shrink: 0; }
.tools-search input { border: 0; background: none; min-width: 0; flex: 1; font-size: 13px; color: #57515f; height: 30px; }
.tools-search input::placeholder { color: #57515f; }
.tools-search kbd { font-size: 10px; color: #57515f; border: 1px solid #e6d7f0; padding: 3px 5px; border-radius: 4px; }
.tools-results { padding: 9px 12px 16px; overflow: auto; min-height: 0; }
.tools-results section h3 { font-size: 11px; font-weight: 500; color: #716979; padding: 17px 12px 7px; }
.tools-results section > button { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px; min-height: 65px; border-radius: 8px; text-align: left; }
.tools-results section > button:hover, .tools-results section > button:focus-visible { background: #f6eefb; }
.tools-action-icon { display: grid; place-items: center; width: 34px; height: 34px; color: #716979; background: #f5edf9; border-radius: 7px; }
.tools-results button > span:nth-child(2) { min-width: 0; flex: 1; }
.tools-results strong { display: block; font-size: 13px; color: #57515f; font-weight: 500; }
.tools-results small { display: block; font-size: 11px; color: #716979; margin-top: 4px; }
.tools-results button > svg { color: #57515f; }
.tools-results button:disabled { opacity: .65; }
.tools-results button:disabled strong { color: #57515f; }
.tools-empty { padding: 40px 15px; color: #716979; text-align: center; }
.tools-empty strong { margin: 13px 0 8px; }
.tools-empty p { font-size: 12px; margin-bottom: 12px; }
.tools-footnote { display: flex; justify-content: space-between; gap: 10px; padding: 13px 24px; border-top: 1px solid #eaddf3; color: #57515f; font-size: 10px; flex-shrink: 0; }
@media (min-width: 1700px) {
.orven-workbench, .orven-workbench.inspector-wide { grid-template-columns: 260px minmax(430px, 1fr) 470px; }
.orven-workbench.inspector-closed { grid-template-columns: 260px minmax(0, 1fr) 0; }
.orven-workbench.sidebar-hidden { grid-template-columns: 0 minmax(430px, 1fr) 470px; }
.orven-workbench.sidebar-hidden.inspector-closed { grid-template-columns: 0 minmax(0, 1fr) 0; }
}
@media (max-width: 1120px) and (min-width: 941px) {
.orven-workbench, .orven-workbench.inspector-wide { grid-template-columns: 210px minmax(310px, 1fr) 360px; }
.orven-workbench.inspector-closed { grid-template-columns: 210px minmax(0, 1fr) 0; }
.orven-workbench.sidebar-hidden { grid-template-columns: 0 minmax(310px, 1fr) 360px; }
.orven-workbench.sidebar-hidden.inspector-closed { grid-template-columns: 0 minmax(0, 1fr) 0; }
.brand { padding-inline: 14px; }
.project-selector { margin-inline: 10px; padding: 10px; }
}
@container (max-width: 740px) {
.work-header { padding-inline: 22px; }
.conversation { padding: 20px 26px; }
.orven-welcome { margin-top: 15px; }
.welcome-signature { margin-bottom: 24px; }
.orven-welcome h2 { font-size: 28px; }
.orven-welcome .starter-prompts { grid-template-columns: 1fr; gap: 8px; }
.orven-welcome .starter-prompts > button { min-height: 57px; padding: 10px 14px; }
.starter-prompts small { display: inline; margin-left: 14px; font-size: 11px; }
.starter-prompts strong { display: inline; }
.starter-heading { margin-top: 20px; }
.welcome-project { margin-top: 18px; }
.welcome-connect { margin-top: 13px; }
.composer-wrap { padding-inline: 24px; }
.header-tools kbd { display: none; }
}
@container (max-width: 510px) {
.work-header { padding-inline: 15px; }
.model-launch { gap: 4px; }
.header-tools { padding-inline: 7px; }
.header-tools > span, .inspector-toggle > span { display: none; }
.inspector-toggle { width: 34px; padding: 8px; }
.conversation { padding: 15px 20px; }
.orven-welcome h2 { font-size: 26px; }
.welcome-signature { margin-bottom: 24px; }
.welcome-project small { max-width: 210px; }
.starter-prompts small { margin-left: 10px; font-size: 10px; }
.composer-wrap { padding-inline: 16px; }
.composer-model > span:nth-child(2) { max-width: 120px; }
.composer-options { gap: 4px; }
.composer-footnote > span:last-child { display: none; }
}
@media (max-width: 940px) {
.orven-workbench, .orven-workbench.inspector-closed, .orven-workbench.inspector-wide { grid-template-columns: 210px minmax(0, 1fr); }
.orven-workbench.sidebar-hidden, .orven-workbench.sidebar-hidden.inspector-closed, .orven-workbench.sidebar-hidden.inspector-wide { grid-template-columns: 0 minmax(0, 1fr); }
.orven-workbench.inspector-wide.inspector-open .inspector { display: flex; width: min(600px, 90vw); z-index: 23; box-shadow: -10px 0 45px #30164417; }
.orven-workbench.inspector-closed .inspector { display: none; }
.panel-scrim { background: #24163044; backdrop-filter: none; }
}
@media (max-width: 620px) {
.orven-workbench, .orven-workbench.inspector-closed, .orven-workbench.sidebar-hidden, .orven-workbench.sidebar-hidden.inspector-closed, .orven-workbench.inspector-wide { grid-template-columns: 0 minmax(0, 1fr); }
.orven-workbench:not(.sidebar-hidden) .project-sidebar { width: min(290px, 86vw); }
.work-header { height: 66px; min-height: 66px; }
.work-title h1 { font-size: 14px; }
.header-breadcrumb { font-size: 10px; }
.task-toolbar { padding: 0 17px; height: 39px; min-height: 39px; gap: 9px; }
.task-toolbar .text-button { min-height: 35px; }
.orven-welcome { margin-top: 14px; }
.welcome-signature { margin-bottom: 24px; }
.welcome-signature > span { font-size: 22px; }
.orven-welcome > p { font-size: 13px; }
.welcome-project { gap: 9px; padding-block: 14px; }
.welcome-project-icon { width: 33px; height: 35px; }
.welcome-project > button { font-size: 11px; padding: 5px 7px; }
.welcome-project small { max-width: 175px; font-size: 10px; }
.starter-heading { margin-top: 16px; }
.orven-welcome .starter-prompts > button { min-height: 51px; }
.welcome-connect { font-size: 10px; }
.composer-wrap { padding: 10px 13px 12px; }
.composer textarea { min-height: 78px; max-height: 140px; padding: 13px 14px 4px; font-size: 16px; }
.composer-bottom { padding: 5px 9px 9px; min-height: 46px; }
.composer .permission-mode select { font-size: 10px; max-width: 111px; }
.composer .permission-mode > svg { width: 12px; }
.composer .input-composer { padding-inline: 7px; }
.input-composer-tools > span { font-size: 9px; }
.composer-model { font-size: 10px; }
.composer-model > span:nth-child(2) { max-width: 100px; }
.composer-footnote { font-size: 9px; padding-top: 8px; }
.message-text, .message-text .research-content { font-size: 13px; }
.modal-backdrop { padding: 12px; }
.modal { border-radius: 12px; max-height: calc(100dvh - 24px); padding: 21px 18px; }
.modal-wide { height: calc(100dvh - 24px); }
.modal-heading p { font-size: 11px; }
.modal:has(.workbench-tools) { max-height: calc(100dvh - 24px); }
.tools-search { padding-inline: 16px; }
.tools-results { padding-inline: 7px; }
.tools-footnote { padding-inline: 16px; font-size: 9px; }
.tools-results section > button { min-height: 64px; }
.modal:has(.model-center) { width: calc(100vw - 24px); height: calc(100dvh - 24px); }
.modal:has(.model-center) > .modal-heading { padding: 19px 18px 15px; }
.mc-overview, .mc-content { padding: 18px; }
.mc-overview { gap: 14px; }
.mc-overview h2 { font-size: 20px; }
.mc-tabs { padding-inline: 8px; }
.mc-tabs button { min-height: 46px; padding-inline: 12px; }
}
@media (max-height: 800px) and (min-width: 621px) {
.orven-welcome { margin-top: 8px; }
.welcome-signature { margin-bottom: 20px; }
.welcome-project { margin-top: 16px; }
.orven-welcome .starter-prompts > button { min-height: 68px; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
+1 -1
View File
@@ -81,6 +81,6 @@ internal static class Launcher {
Regex allowed = new Regex("^(path|pathext|systemroot|systemdrive|windir|comspec|temp|tmp|userprofile|homedrive|homepath|appdata|localappdata|programfiles(?:\\(x86\\))?|commonprogramfiles(?:\\(x86\\))?|lang|lc_all|AGENT_WORKBENCH_(?:DEEPSEEK_ROOT|PURGE_ROOT|PYTHON_PATH|TEST_PYTHON))$", RegexOptions.IgnoreCase); Regex allowed = new Regex("^(path|pathext|systemroot|systemdrive|windir|comspec|temp|tmp|userprofile|homedrive|homepath|appdata|localappdata|programfiles(?:\\(x86\\))?|commonprogramfiles(?:\\(x86\\))?|lang|lc_all|AGENT_WORKBENCH_(?:DEEPSEEK_ROOT|PURGE_ROOT|PYTHON_PATH|TEST_PYTHON))$", RegexOptions.IgnoreCase);
foreach (string key in keys) if (!allowed.IsMatch(key)) launch.EnvironmentVariables.Remove(key); foreach (string key in keys) if (!allowed.IsMatch(key)) launch.EnvironmentVariables.Remove(key);
using (Process child = Process.Start(launch)) { if (uninstall) { child.WaitForExit(); return child.ExitCode; } } return 0; using (Process child = Process.Start(launch)) { if (uninstall) { child.WaitForExit(); return child.ExitCode; } } return 0;
} catch (Exception error) { if (!hidden) MessageBox.Show(error.Message, "Agent Workbench 无法打开", MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; } } catch (Exception error) { if (!hidden) MessageBox.Show(error.Message, "Orven 无法打开", MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; }
} }
} }
+6 -6
View File
@@ -1,9 +1,9 @@
[Setup] [Setup]
AppId={{E914E883-46F9-4B82-B27F-BDB2B40DCC90} AppId={{E914E883-46F9-4B82-B27F-BDB2B40DCC90}
AppName=Agent Workbench AppName=Orven
AppVersion={#Version} AppVersion={#Version}
DefaultDirName={localappdata}\Programs\AgentWorkbench DefaultDirName={localappdata}\Programs\AgentWorkbench
DefaultGroupName=Agent Workbench DefaultGroupName=Orven
PrivilegesRequired=lowest PrivilegesRequired=lowest
ArchitecturesAllowed=x64compatible ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible ArchitecturesInstallIn64BitMode=x64compatible
@@ -28,14 +28,14 @@ Source: "{#PortableRoot}\*"; DestDir: "{app}\versions\{#VersionDirectory}"; Flag
Source: "{#PortableRoot}\AgentWorkbench.exe"; DestDir: "{app}"; Flags: onlyifdoesntexist Source: "{#PortableRoot}\AgentWorkbench.exe"; DestDir: "{app}"; Flags: onlyifdoesntexist
[Icons] [Icons]
Name: "{group}\Agent Workbench"; Filename: "{app}\AgentWorkbench.exe" Name: "{group}\Orven"; Filename: "{app}\AgentWorkbench.exe"
Name: "{userdesktop}\Agent Workbench"; Filename: "{app}\AgentWorkbench.exe"; Tasks: desktopicon Name: "{userdesktop}\Orven"; Filename: "{app}\AgentWorkbench.exe"; Tasks: desktopicon
[Tasks] [Tasks]
Name: "desktopicon"; Description: "创建桌面快捷方式"; Flags: unchecked Name: "desktopicon"; Description: "创建桌面快捷方式"; Flags: unchecked
[Run] [Run]
Filename: "{app}\AgentWorkbench.exe"; Description: "打开 Agent Workbench"; Flags: nowait postinstall skipifsilent; Check: WasActivated Filename: "{app}\AgentWorkbench.exe"; Description: "打开 Orven"; Flags: nowait postinstall skipifsilent; Check: WasActivated
[Code] [Code]
var DataRoot: String; Port: String; StageOnly: Boolean; Activated: Boolean; ActivationFailed: Boolean; var DataRoot: String; Port: String; StageOnly: Boolean; Activated: Boolean; ActivationFailed: Boolean;
@@ -79,7 +79,7 @@ begin
' --operation-id ' + Quoted(OperationId) + ' --expected-manifest-sha256 {#ManifestSha256}'; ' --operation-id ' + Quoted(OperationId) + ' --expected-manifest-sha256 {#ManifestSha256}';
if Candidate then Parameters := Parameters + ' --candidate-root ' + Quoted(ExpandConstant('{app}\versions\{#VersionDirectory}')); if Candidate then Parameters := Parameters + ' --candidate-root ' + Quoted(ExpandConstant('{app}\versions\{#VersionDirectory}'));
if StageOnly then Parameters := Parameters + ' --stage-only'; if StageOnly then Parameters := Parameters + ' --stage-only';
if ManagerPage = nil then ManagerPage := CreateOutputProgressPage('Agent Workbench 版本更新', '核对原版本、当前阶段与实际结果'); if ManagerPage = nil then ManagerPage := CreateOutputProgressPage('Orven 版本更新', '核对原版本、当前阶段与实际结果');
ManagerPage.SetText('准备核对安装操作', '操作记录:' + ExpandConstant('{app}') + '\.installation\progress-' + OperationId + '.json'); ManagerPage.SetText('准备核对安装操作', '操作记录:' + ExpandConstant('{app}') + '\.installation\progress-' + OperationId + '.json');
ManagerPage.ProgressBar.Visible := False; ManagerPage.ProgressBar.Visible := False;
if Command <> 'cancel' then ManagerPage.Show; if Command <> 'cancel' then ManagerPage.Show;
+4 -4
View File
@@ -18,7 +18,7 @@ const dataRoot = path.resolve(options['--data-root'] || path.join(process.env.LO
const port = Number(options['--port'] || 4318); const port = Number(options['--port'] || 4318);
assertLocalTree(dataRoot, { missing: true }); fs.mkdirSync(dataRoot, { recursive: true }); assertLocalTree(dataRoot, { missing: true }); fs.mkdirSync(dataRoot, { recursive: true });
const profile = ownedChild(dataRoot, '.desktop-profile', { missing: true }); fs.mkdirSync(profile, { recursive: true }); protectUserDirectory(profile); app.setPath('userData', profile); const profile = ownedChild(dataRoot, '.desktop-profile', { missing: true }); fs.mkdirSync(profile, { recursive: true }); protectUserDirectory(profile); app.setPath('userData', profile);
app.setAppUserModelId('local.agent-workbench'); app.setName('Agent Workbench'); app.setAppUserModelId('local.agent-workbench'); app.setName('Orven');
let window, controller, bridge, browsingView, windowId, windowOwner, quitting = false; let window, controller, bridge, browsingView, windowId, windowOwner, quitting = false;
const retained = app.requestSingleInstanceLock({ appRoot, dataRoot, port }); const retained = app.requestSingleInstanceLock({ appRoot, dataRoot, port });
if (!retained) app.quit(); if (!retained) app.quit();
@@ -41,8 +41,8 @@ else {
windowId = randomUUID(); windowOwner = { windowId, pid: process.pid, createdAt: observed.createdAt, instanceId: host.identity.instanceId, runtimeIdentity: host.identity.runtimeIdentity }; windowId = randomUUID(); windowOwner = { windowId, pid: process.pid, createdAt: observed.createdAt, instanceId: host.identity.instanceId, runtimeIdentity: host.identity.runtimeIdentity };
await controller.api('/host/windows/register', { method: 'POST', input: windowOwner }); await controller.api('/host/windows/register', { method: 'POST', input: windowOwner });
const preload = path.join(appRoot, 'dist-desktop/preload.cjs'); const preload = path.join(appRoot, 'dist-desktop/preload.cjs');
window = new BrowserWindow({ title: 'Agent Workbench', width: 1440, height: 1000, minWidth: 390, minHeight: 600, window = new BrowserWindow({ title: 'Orven · AI 开发工作台', width: 1440, height: 1000, minWidth: 390, minHeight: 600,
show: false, backgroundColor: '#edf2f7', icon: path.join(appRoot, 'public/workbench-icon.png'), show: false, backgroundColor: '#ffffff', icon: path.join(appRoot, 'public/workbench-icon.png'),
webPreferences: { preload, sandbox: true, contextIsolation: true, nodeIntegration: false, webSecurity: true, allowRunningInsecureContent: false } }); webPreferences: { preload, sandbox: true, contextIsolation: true, nodeIntegration: false, webSecurity: true, allowRunningInsecureContent: false } });
window.webContents.setWindowOpenHandler(() => ({ action: 'deny' })); window.webContents.setWindowOpenHandler(() => ({ action: 'deny' }));
window.webContents.on('will-navigate', details => { if (!desktopOrigin(details.url, controller.url)) details.preventDefault(); }); window.webContents.on('will-navigate', details => { if (!desktopOrigin(details.url, controller.url)) details.preventDefault(); });
@@ -71,5 +71,5 @@ else {
console.log(JSON.stringify({ app: 'agent-workbench-desktop', ready: true, pid: process.pid, hostPid: host.identity.pid, console.log(JSON.stringify({ app: 'agent-workbench-desktop', ready: true, pid: process.pid, hostPid: host.identity.pid,
instanceId: host.identity.instanceId, appRoot, dataRoot, url: host.url })); instanceId: host.identity.instanceId, appRoot, dataRoot, url: host.url }));
}).catch(error => { console.error(JSON.stringify({ app: 'agent-workbench-desktop', ready: false, message: error.message })); }).catch(error => { console.error(JSON.stringify({ app: 'agent-workbench-desktop', ready: false, message: error.message }));
if (!options.hidden) dialog.showErrorBox('Agent Workbench 无法打开', error.message); app.exit(1); }); if (!options.hidden) dialog.showErrorBox('Orven 无法打开', error.message); app.exit(1); });
} }