feat: ship isolated workspace review and navigation in 1.6.0

This commit is contained in:
Agent Workbench Dev
2026-10-29 23:45:32 +08:00
parent 7d9bfb85da
commit bb48f69f25
39 changed files with 841 additions and 35 deletions
+3 -1
View File
@@ -4,7 +4,7 @@
本仓库专注AI编程与能力研究工作台。其他项目不纳入本项目计划或代码。用户确定的研究对象为Codex、Claude Code、Cursor、DeepSeek Harness、WorkBuddy及DSH-purge;目标是将有证据的机制独立开发成自有Harness内置能力。
1.0.0是已保存的基础里程碑;1.1.0已交付M1可靠内核,1.2.0增加当前Task的本地Git交付及证据报告,1.3.0增加工程索引与精确补丁,1.4.0增加封存多文件变更集与显式恢复,1.5.0增加完整请求预算、协议组工件与历史追溯。各版本实际部署与验收见docs/VALIDATION.md,后续实现见docs/PRODUCT-PLAN.md、docs/CAPABILITIES.md和docs/RESEARCH-ROADMAP.md。计划中的能力不能写成已经实现。
1.0.0是已保存的基础里程碑;1.1.0已交付M1可靠内核,1.2.0增加当前Task的本地Git交付及证据报告,1.3.0增加工程索引与精确补丁,1.4.0增加封存多文件变更集与显式恢复,1.5.0/1.5.1增加完整请求预算和实际工件分页,1.6.0增加独立工作区和Git审查收尾。各版本实际部署与验收见docs/VALIDATION.md,后续实现见docs/PRODUCT-PLAN.md、docs/CAPABILITIES.md和docs/RESEARCH-ROADMAP.md。计划中的能力不能写成已经实现。
## 研究与来源
@@ -38,3 +38,5 @@
- 浏览器/fixture验证使用独立端口与数据目录;用户项目与研究对象的登录/会话配置不用于测试凭据。
- Windows执行环境以实测shell为准。现有工具使用PowerShell 5.1和UTF-8;不用&&/||拼接命令,使用换行和$LASTEXITCODE核对结果。
- 桌面与移动共用执行宿主。手机127.0.0.1指手机,远程接入通过未来经验证的配对网关。
- 升级使用验收过的新不可变发行目录,不刷新已运行发行;核对原PID、全部会话与执行证据,保留原Provider对象的内存连接。
- Git工作区来源只复制已提交HEAD,未提交文件留在来源;创建及结果待核对记录参与写入/检查/交付活动控制。外部目录和Git身份改变不得自动修复或重试。
+8
View File
@@ -1,5 +1,13 @@
# Agent Workbench 更新记录
## 1.6.0 · 2026-10-29
- 从已提交HEAD预览并创建独立Git目录/分支,登记独立项目和会话;原项目已有索引及未提交修改保留。创建不安装依赖或执行项目脚本。
- 创建意图及实际Git进程身份持久保存,完成前核对来源、分支、索引和检出内容;中断后显式核对,外部变动保留,未知结果不自动重试。
- 桌面和390px界面支持准备、预览、确认、打开、返回来源及创建恢复;迟到响应保持项目/会话归属。Task、Run和报告记录实际工作区身份。
- 模型成功准备Git提交预览后确定性等待审查,同消息后续调用不执行;确认后内核完成原Task和报告,不继续请求模型。预览可修改或撤回。
- 190项完整回归及72组界面通过;发行包、保留原进程更新和配置模型的真实工程结果分别记入[验收记录](docs/VALIDATION.md)。完整三类工程、Electron、移动配对与外部引擎继续开发。
## 1.5.1 · 2026-10-29
- 修复大工件结果因请求预算不足而再次被封存、模型无法看到刚读内容的问题:读取页按下一请求的实际JSON编码字节预算选择,返回next_offset、实际字符数及预算缩小标记;完整原工件保留。
+3 -1
View File
@@ -1,11 +1,13 @@
# 本地 Agent 工作台
Agent Workbench 1.5.1 将 Claude Code 与 Cursor 的机制研究整合为独立的本地 AI 编程工作台。工程索引、精确补丁、多文件整批审查、实际检查、本地Git提交及交付报告可以在同一个Task中完成。
Agent Workbench 1.6.0 将 Claude Code 与 Cursor 的机制研究整合为独立的本地 AI 编程工作台。工程索引、精确补丁、多文件整批审查、实际检查、本地Git提交及交付报告可以在同一个Task中完成。
每次运行保留模型与预算、已完成工具和日志工件。多文件变更集封存同Task的原/新字节、Git基线与审查指纹,应用前核对整批文件;中断后显式核对或回退,保留外部修改。应用改动后可点击「继续检查与交付」,沿用原目标进行实际测试与修复。提交前查看实际文件、diff、署名和检查结果,确认后生成本地提交及可下载的JSON/Markdown报告。版本改动见 [CHANGELOG](CHANGELOG.md),编辑范围见[索引与补丁](docs/CODE-INDEX-AND-PATCHES.md)和[变更集恢复契约](docs/CHANGE-SETS.md)。
## 后续产品与能力建设
当前Git项目可以先预览已提交版本,再创建独立目录和分支;来源已有暂存、未提交及未跟踪文件保留在原项目。子工作区有自己的项目、会话和实际执行目录,创建中断后显式核对。模型准备Git交付预览后停止请求,确认这份预览后由内核完成提交和报告。具体范围见[独立工作区](docs/WORKSPACES.md)及[1.6验收](docs/QA-1.6.md)。
目标是自有Harness核心、用户选择的大模型、REA研究工具和可选外部代理引擎共同完成“需求→工程理解→代码变更→实际测试与修复→审查→Git交付”。研究对象为Codex、Claude Code、Cursor、DeepSeek Harness、WorkBuddy与DSH-purge;研究结论、独立实现和实际验收分别登记。Purge是Harness插件,其工程收益需要版本锁定和同题对照验证。
- [完整产品与执行方案](docs/PRODUCT-PLAN.md):M0–M6阶段、模块、真实任务和Electron/PWA分工。
+8 -1
View File
@@ -1,6 +1,6 @@
# Agent Workbench 能力目标与验收矩阵
日期:2026-10-29。1.0.0为基础里程碑,1.1.0实现M1,1.2.0增加内置Git交付,1.3.0增加工程索引和精确补丁,1.4.0增加可恢复多文件变更集,1.5.0增加有界完整请求计划和历史追溯。下表保留1.0.0缺口与完整产品目标;每项完成范围以实际验证记录为准。
日期:2026-10-29。1.0.0为基础里程碑,1.1.0实现M1,1.2.0增加内置Git交付,1.3.0增加工程索引和精确补丁,1.4.0增加可恢复多文件变更集,1.5.0/1.5.1增加有界请求与可用工件分页,1.6.0增加独立Git工作区和审查收尾。下表保留1.0.0缺口与完整产品目标;每项完成范围以实际验证记录为准。
总体方案见 [PRODUCT-PLAN.md](PRODUCT-PLAN.md),研究问题与来源见 [RESEARCH-ROADMAP.md](RESEARCH-ROADMAP.md)。
@@ -49,6 +49,13 @@
- C02/C13/C23:请求计划联网前持久保存、重启中断而不重放、损坏/缺失证据明确失败;报告深度核对正文、原组、分片及结果归属。
- 158项完整回归与62组界面通过。独立发行与真实模型结果见[QA-1.5](QA-1.5.md),worktree、React/Python完整工程和M2/M6成功率继续实施。
### 1.6.0 M2独立工作区与Git审查切片
- C07/C12:封存已提交HEAD和来源、宿主拥有的独立目录/分支及项目/会话身份;来源index/已有修改保留,创建不执行项目脚本或安装依赖。当前不提供合并和归档。
- C02/C04/C23:创建意图/实际PID/逐阶段结果持久保存;8个实际退出切点、只读显式核对、外部状态保留,Task/Run/模型上下文/报告绑定实际执行工作区。
- C12/C13:成功准备Git预览后保存审查边界并停止模型;后续同消息工具不执行且协议完整。确认后内核完成原Task与报告,不继续请求模型,预览可修改/撤回。
- 190项回归和72组界面通过;合成模型子工作区真实3项失败→3项通过/build/Git报告通过。不可变包、原进程更新与真实配置模型结果见[QA-1.6](QA-1.6.md),完整三类工程及M2/M6能力继续验收。
| ID / 能力 | 1.0.0基础与缺口 | 后续产品目标 | 参考问题 / 模块 / 阶段 | 必须看到的验收证据 |
| --- | --- | --- | --- | --- |
| C01 需求与任务规划 | 有对话和有限步数工具循环,没有任务依赖图 | 固定目标、约束和完成标准;拆任务、判断依赖、接收追加要求与重规划 | CX-1、WB-1 / tasks / M1–M2 | 追加要求后仍保留原目标;任务完成由验收条件决定 |
+5 -5
View File
@@ -1,6 +1,6 @@
# Agent Workbench 后续产品与执行开发方案
日期:2026-10-29。本文保留完整产品规划;1.1.0实现M1,1.2.0增加Task本地Git交付,1.3.0增加索引与精确补丁,1.4.0增加可恢复多文件变更集,1.5.0增加有界完整请求与历史追溯。实际实现、验收与部署分别见[能力矩阵](CAPABILITIES.md)及[验证记录](VALIDATION.md),完整阶段目标继续实施。
日期:2026-10-29。本文保留完整产品规划;1.1.0实现M1,1.2.0增加Task本地Git交付,1.3.0增加索引与精确补丁,1.4.0增加可恢复多文件变更集,1.5.0/1.5.1增加有界请求与可用工件分页,1.6.0增加独立工作区与Git审查收尾。实际实现、验收与部署分别见[能力矩阵](CAPABILITIES.md)及[验证记录](VALIDATION.md),完整阶段目标继续实施。
## 1. 产品目标
@@ -29,9 +29,9 @@ Purge的源码机制不证明模型权重或工程成功率已经提升。增强
现有基础:React工作台、兼容模型连接、Task/Run/Tool及预算、SQLite/工件恢复、工程索引与精确补丁、npm实际检查、单文件/整批审核、Git和报告。1.4.0增加原/新字节快照和逐文件执行账本、整批预检及显式恢复;各版本实测证据单独登记。
当前边界:尚无任务依赖图、长期项目记忆、隔离worktree、多worker、React/Python专用检查与完整三类工程验收、动态REA/MCP/外部引擎注册、桌面壳或手机配对。批次支持文本创建/修改,不提供跨文件原子事务。模型仍使用一个全局连接且stream:false。
当前边界:尚无任务依赖图、长期项目记忆、多worker、React/Python专用检查与完整三类工程验收、动态REA/MCP/外部引擎注册、桌面壳或手机配对。1.6.0已有独立Git工作区创建/身份/恢复,自动合并和归档继续开发。批次支持文本创建/修改,不提供跨文件原子事务。模型仍使用一个全局连接且stream:false。
本次已为工作台源码建立本地Git,基线提交为`bac87da`,标签`v1.0.0-baseline`。这是开发仓库的版本管理;让用户在工作台中管理其工程的Git,是后续独立能力。
工作台源码已建立本地Git,基线提交为`bac87da`,标签`v1.0.0-baseline`,继续按可审查小步提交。用户工程已有内置审查提交/证据报告;1.6.0补齐独立工作区,自动合并、归档及完整工程验收继续实施。
能力逐项对照见 [CAPABILITIES.md](CAPABILITIES.md)。研究身份、来源和问题见 [RESEARCH-ROADMAP.md](RESEARCH-ROADMAP.md)。
@@ -144,8 +144,8 @@ Purge的包声明Apache-2.0,另有商业许可联系说明;Harness声明MIT
## 9. 下一轮最先执行的三个开发切片
1. 1.4.0最终不可变包和真实模型批次交付已完成;HTTP520恢复、385579已报告tokens及模型预算暂停保留。1.5.0请求计划/协议组封存/历史追溯已通过158项回归和62组UI,继续独立包、原进程更新与真实模型验收。
2. 下一批实现封存HEAD的独立Git/worktree、稳定来源/工作区身份和持久恢复记录,再完成React/TypeScript和Python检查及封存任务。原HEAD/index及未提交修改必须保留;当前单Node样本不计为三类工程完成。
1. 1.5.1实际四文件批次/14项检查/build/Git报告已完成,模型仍在Git预览后达到轮次上限,失败和累计702772已报告tokens保留。1.6.0补齐审查边界及独立工作区,190项回归/72组UI通过;继续不可变包、独立源码验收、原进程更新和新的真实模型工作区交付。
2. 接着完成React/TypeScript和Python检查及封存任务,提供可核对的类型/测试/构建结果。新工作区已有创建/恢复,原HEAD/index及未提交修改必须保留;当前单Node样本不计为三类工程完成。
3. 在写入/取消/事件归属边界稳定后按M3接入REA及Codex/DeepSeek EngineAdapter的契约探针,分别固定Harness/Purge/profile版本,再比较真实同题工程收益。桌面Electron与手机配对网关复用同一执行宿主,按M5推进。
这些切片优先复用已验证的文件范围、基线备份、UTF-8、取消与诊断能力。研究结论每次至少绑定一个实现模块、一个契约检查和一个用户场景,按实际失败分类持续调整顺序。
+13
View File
@@ -0,0 +1,13 @@
# 1.6.0 验收清单
本轮补齐已提交版本的隔离Git工作区和Git审查后的确定性收尾。真实模型在1.5.1已完成代码及检查,却在准备提交后继续查询并达到轮次上限;原失败及人工收尾记录保留。
构建及[完整190项回归](workspaces-tests-validation.json)通过,0失败/取消/跳过。工作区核心、策略、实际退出、API与原有检查/批次/交付契约都运行真实文件系统和Git;8个process.exit切点不自动重放创建,来源已有暂存/未提交/未跟踪文件及索引字节保留,外部状态按实际观察核对。
实际本地HTTP用合成模型完成子工作区同Task的3失败→3通过/build、批次审查、Git预览、确认和报告。模型在预览后停止,同消息后续调用保持完整协议但不执行;确认后内核完成Task/Run/报告,无新模型请求。配置值只保存散列;改变Git配置使旧创建预览失效。关闭宿主会等待正在准备的来源快照完成。
[72组界面](workspaces-all-ui-validation.json)全部通过:基础10、诊断9、任务7、Git9、索引8、批次11、上下文9和工作区9。全部验证器使用自己拥有的独立端口及合成数据;0页面/请求异常。[工作区9组](workspaces-ui-validation.json)覆盖预览、重复创建、打开/返回/重载、所属会话导航、外部恢复、390×844及迟到成功/失败保护,截图已目视核对。
首轮默认高并发下完整190项185通过/5失败,日志保留;真实Git/HTTP IO争抢后将测试并发固定为2,断言与超时保持。1.6.0二次升级白名单同步补齐,完整复验190/190通过。首轮UI协调器误用残留1.1.0演示宿主,版本不符立即停止;改为独立1.6.0宿主后72组通过。基础与工作区UI证据命名碰撞已从原成功结果分离并核对,组数及结论未变。
不可变便携/源码包、源码离线安装/独立构建与190项回归、原PID23080及全部历史/内存连接升级、真实模型的新工作区工程交付正在后续验收;此处不提前记为完成。完整React/TypeScript和Python交付、自动合并/工作区归档、M2/M6成功率、Electron及移动配对尚未交付。
+8
View File
@@ -1,5 +1,13 @@
# Agent Workbench 验收记录
## 1.6.0 · 独立Git工作区与审查收尾
构建、190/190项行为/API/实际进程退出/升级回归及72组独立界面通过,0失败/跳过/取消/页面或请求异常;见[回归](workspaces-tests-validation.json)、[界面总表](workspaces-all-ui-validation.json)和[QA-1.6](QA-1.6.md)。工作区创建封存已提交HEAD和来源快照,保存意图与实际Git PID,核对普通检出/分支/索引/来源后登记项目与会话;原项目已有修改保留。中断不自动重放,显式核对保留外部变动。
实际HTTP合成模型在子工作区完成同Task批次修复、3项失败→3项通过/build、Git审查与报告。预览后持久needs_review/git_review并停止模型,同消息后续调用不执行;确认后内核完成原Task/Run,实际请求数保持。8个process.exit创建切点、hooks/所有配置过滤器无执行、来源索引字节及owner文件保护已通过。
72组界面包含基础10/诊断9/任务7/Git9/索引8/批次11/上下文9/工作区9。新工作区支持预览、创建、导航、恢复及390px,异步操作绑定项目/会话与组件存活。首轮并发回归及协调器宿主/证据路径错误保留在QA记录,修正后完整复验。不可变发行/独立源码、保留原进程升级和配置模型新工程交付继续验收;不将合成模型结果替代实际工程能力。
## 1.5.1 · 实际工件分页与重复读取暂停
构建、163/163项完整回归及63组界面全部通过,0失败/跳过/取消/页面或请求异常;见[回归](context-fix-tests-validation.json)、[界面总表](context-fix-all-ui-validation.json)和[QA-1.5.1](QA-1.5.1.md)。工件页按下一请求的双层JSON字节限额生成、返回next_offset;原工件、Unicode与完整协议保留。直接代码依据优先选择,Task已读区间和no_progress暂停持久保存,恢复不自动重放。
+5 -1
View File
@@ -1,6 +1,6 @@
# 独立开发工作区
本切片在开发中。实际发行、回归和模型验收完成后再登记为已交付。
1.6.0构建、190项完整行为/API/实际退出回归及72组界面通过。不可变发行、原进程升级与真实配置模型验收单独登记到[QA-1.6](QA-1.6.md)。
从当前Git项目封存已提交的HEAD、来源目录、命名分支、索引字节、可读取源码、其他引用和Git配置的散列。审查后创建宿主拥有的独立目录及新分支,打开为独立项目和会话。来源的未提交文件不会自动复制;依赖安装另行审查。工作区的Task、Run、模型上下文和报告标明实际执行目录、分支、起始提交与来源身份。
@@ -13,3 +13,7 @@
工作区创建参与Runtime、工程检查、Git交付、文件批次和升级的活动检查。同仓库正在创建或结果待核对的记录需要先在所属会话处理。直接文件读取/编辑也核对物理Git身份。来源状态只在创建及创建恢复时要求完全一致,之后正常开发允许来源和子分支各自推进;本轮没有自动合并和工作区归档能力。
验收要求包含真实进程退出切点、外部改动、保留原索引/已有修改、hooks和过滤器无执行、子工作区批次到真实检查和Git报告,以及桌面和390px界面的创建/切换/恢复/迟到响应。证据随实际完成逐项登记。
已通过的真实HTTP契约用合成模型驱动子工作区的批次修复、3项失败→3项通过/build、Git审查和报告;确认后无新增请求,来源index/HEAD/已有改动保持。8个实际process.exit切点覆盖意图、Git启动/结束、核对及项目/会话登记。合成模型契约通过不代替真实配置模型的工程交付验收。
见[完整回归](workspaces-tests-validation.json)、[工作区界面](workspaces-ui-validation.json)及[全部界面](workspaces-all-ui-validation.json)。[桌面预览](screenshots/1.6-workspace-review-desktop.png)和[390px预览](screenshots/1.6-workspace-review-mobile.png)已目视核对。
Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

+74
View File
@@ -0,0 +1,74 @@
{
"success": true,
"version": "1.6.0",
"at": "2026-10-29T15:36:15.661Z",
"groups": 72,
"results": [
{
"script": "verify-ui.mjs",
"success": true,
"groups": 10,
"durationMs": 33435,
"evidence": "docs/workspaces-basic-ui-validation.json",
"log": ".qa/workspaces-verify-ui.log"
},
{
"script": "verify-diagnostics-ui.mjs",
"success": true,
"groups": 9,
"durationMs": 33505,
"evidence": "docs/workspaces-diagnostics-ui-validation.json",
"log": ".qa/workspaces-verify-diagnostics-ui.log"
},
{
"script": "verify-execution-ui.mjs",
"success": true,
"groups": 7,
"durationMs": 32962,
"evidence": "docs/workspaces-execution-ui-validation.json",
"log": ".qa/workspaces-verify-execution-ui.log"
},
{
"script": "verify-delivery-ui.mjs",
"success": true,
"groups": 9,
"durationMs": 49262,
"evidence": "docs/workspaces-delivery-ui-validation.json",
"log": ".qa/workspaces-verify-delivery-ui.log"
},
{
"script": "verify-index-ui.mjs",
"success": true,
"groups": 8,
"durationMs": 6115,
"evidence": "docs/workspaces-index-ui-validation.json",
"log": ".qa/workspaces-verify-index-ui.log"
},
{
"script": "verify-change-sets-ui.mjs",
"success": true,
"groups": 11,
"durationMs": 15466,
"evidence": "docs/workspaces-change-sets-ui-validation.json",
"log": ".qa/workspaces-verify-change-sets-ui.log"
},
{
"script": "verify-context-ui.mjs",
"success": true,
"groups": 9,
"durationMs": 20276,
"evidence": "docs/workspaces-context-ui-validation.json",
"log": ".qa/workspaces-verify-context-ui.log"
},
{
"script": "verify-workspaces-ui.mjs",
"success": true,
"groups": 9,
"durationMs": 23764,
"evidence": "docs/workspaces-ui-validation.json",
"log": ".qa/workspaces-verify-workspaces-ui.log"
}
],
"scope": "Every verifier owns an independent port and synthetic data directory. Synthetic provider fixtures verify protocols; configured-model acceptance is separate. No production service or real key read/copied.",
"evidencePathCorrection": "Basic and workspace UI proof paths separated; each original passed result and all 72 groups rechecked. No UI behavior changed."
}
+27
View File
@@ -0,0 +1,27 @@
{
"success": true,
"url": "http://127.0.0.1:53474",
"browser": "Microsoft Edge 156.0.4314.42",
"date": "2026-10-29T15:33:12.485Z",
"projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\ui-eda23316-962b-4a51-9453-9e56068a5eb2\\ui-project",
"viewports": [
1440,
780,
390
],
"passed": [
"project selection and real file preview",
"real command consent, execution and stale snapshot rejection",
"diff review and verified file application",
"manual editor creates a reviewable proposal",
"file responses stay with the current selection",
"denial, session selection, reload, stale response rejection and export",
"project inventory responses cannot replace another project",
"780 and 390 px: project drawer, file, diff and trace controls, no page overflow",
"unified and detailed research reports render",
"model list, ephemeral key, compatible fixture tool loop and return to offline mode"
],
"pageErrors": [],
"requestFailures": [],
"modelValidation": "controlled local HTTP fixture; no real model"
}
+29
View File
@@ -0,0 +1,29 @@
{
"success": true,
"version": "1.6.0",
"testedAt": "2026-10-29T15:35:31.077Z",
"cases": [
"Desktop batch scope, per-file diffs, sealed single-write guard and pre-apply bytes",
"Three-file reviewed application preserves exact BOM/CRLF/LF and creates the new file",
"Explicit batch rollback restores exact originals and removes only the reviewed new file",
"A last-file owner conflict blocks the whole batch and shows the real recovery direction",
"Durable partial recovery reads actual hashes and preserves owner content during rollback",
"Changed observation fingerprints reject stale acknowledgement without releasing the project",
"Explicit owner-content acknowledgement ends recovery without claiming successful application",
"Switching projects clears the previous task notification while retaining its durable error and recovery history",
"390px step-limit review, same-task continuation entry, rollback confirmation and keyboard close fit the viewport",
"A delayed preparation response never opens a different project or changes its selected session",
"A failed batch response after its component unmounts cannot display an error in the newly selected project"
],
"pageErrors": [],
"requestFailures": [],
"screenshots": [
".qa/screenshots/workspaces-batch-desktop-review.png",
".qa/screenshots/workspaces-batch-desktop-conflict.png",
".qa/screenshots/workspaces-batch-desktop-recovery.png",
".qa/screenshots/workspaces-batch-mobile-review.png",
".qa/screenshots/workspaces-batch-mobile-rollback.png"
],
"projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\batch-ui-76c717f8-eedf-4bc9-83b3-114c8d7bd851",
"scope": "Real independent demo host and durable batch states; UI fixtures include actual owner conflict/rollback results. No real model credentials or user project were used."
}
@@ -0,0 +1,29 @@
{
"success": true,
"version": "1.6.0",
"testedAt": "2026-10-29T15:35:31.077Z",
"cases": [
"Desktop batch scope, per-file diffs, sealed single-write guard and pre-apply bytes",
"Three-file reviewed application preserves exact BOM/CRLF/LF and creates the new file",
"Explicit batch rollback restores exact originals and removes only the reviewed new file",
"A last-file owner conflict blocks the whole batch and shows the real recovery direction",
"Durable partial recovery reads actual hashes and preserves owner content during rollback",
"Changed observation fingerprints reject stale acknowledgement without releasing the project",
"Explicit owner-content acknowledgement ends recovery without claiming successful application",
"Switching projects clears the previous task notification while retaining its durable error and recovery history",
"390px step-limit review, same-task continuation entry, rollback confirmation and keyboard close fit the viewport",
"A delayed preparation response never opens a different project or changes its selected session",
"A failed batch response after its component unmounts cannot display an error in the newly selected project"
],
"pageErrors": [],
"requestFailures": [],
"screenshots": [
".qa/screenshots/workspaces-batch-desktop-review.png",
".qa/screenshots/workspaces-batch-desktop-conflict.png",
".qa/screenshots/workspaces-batch-desktop-recovery.png",
".qa/screenshots/workspaces-batch-mobile-review.png",
".qa/screenshots/workspaces-batch-mobile-rollback.png"
],
"projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\batch-ui-76c717f8-eedf-4bc9-83b3-114c8d7bd851",
"scope": "Real independent demo host and durable batch states; UI fixtures include actual owner conflict/rollback results. No real model credentials or user project were used."
}
@@ -0,0 +1,30 @@
{
"success": true,
"version": "1.6.0",
"testedAt": "2026-10-29T15:35:50.543Z",
"passed": [
"desktop request estimate, actual usage, complete goal and history identity are visible",
"paged complete history opens actual tool result artifacts without executing tools",
"historical and resumed Runs retain their own request records",
"390px history, original JSON and sent-body dialogs fit and retain close controls",
"late old history failure stays in its original scope after switching projects",
"late old Run failure stays in its original scope after switching projects",
"late old request-body failure stays in its original scope after switching projects",
"context-limit pause explains the intact requirement and explicit continuation",
"390px repeated-read pause explains the cause and explicit continuation retains the same Task"
],
"pageErrors": [],
"requestFailures": [],
"screenshots": [
".qa/screenshots/workspaces-context-desktop-plan.png",
".qa/screenshots/workspaces-context-desktop-history.png",
".qa/screenshots/workspaces-context-mobile-history.png",
".qa/screenshots/workspaces-context-mobile-original.png",
".qa/screenshots/workspaces-context-mobile-request-body.png",
".qa/screenshots/workspaces-context-mobile-read-pause.png"
],
"root": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\context-ui-b5407282-c7c2-4aa1-815c-fbd7823915e7",
"data": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\context-ui-b5407282-c7c2-4aa1-815c-fbd7823915e7\\data",
"mode": "saved synthetic context evidence; no real model or project commands executed by this UI verifier",
"browser": "156.0.4314.42"
}
@@ -0,0 +1,31 @@
{
"success": true,
"version": "1.6.0",
"testedAt": "2026-10-29T15:35:09.290Z",
"browser": "156.0.4314.42",
"passed": [
"actual failing tests and four source proposals retain the original project and task",
"reviewed changes continue the same Task through 14 real tests and model-prepared Git review",
"review shows actual paths, diffs, tests, author and policy; cancelling leaves Git unchanged",
"an index change after confirmation preview refuses the stale job and preserves both staged owners",
"390px confirmation keeps file hashes, diffs and actions inside the modal",
"double confirmation creates one four-file commit, retains owner bytes and publishes report with completion",
"report viewing and Markdown/JSON downloads preserve verified artifact bytes and truthful acceptance limits",
"mobile report preview closes cleanly and keeps the task input fixed",
"unknown Git results block new submission and the explicit reconcile action restores the existing commit"
],
"pageErrors": [],
"requestFailures": [],
"projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\delivery-ui-c9d8072a-f17c-46e1-a43a-9657ebc092cb\\四模块交付工程",
"projectId": "8d85cdd4-da9a-4136-8363-0f8bed9f127e",
"sessionId": "a5df1ec9-f4f7-4f88-addb-c62d85f5866e",
"taskId": "7581f010-a89a-4ad3-872a-c5269808e567",
"commit": "711f097db7c4eb670211c0eabe9f9acf930e2487",
"recoveryCommit": "e2e0a943aea8f56dde9d3f414251edcf8168d31d",
"testCounts": {
"baselineFailed": 13,
"passed": 14
},
"model": "controlled local HTTP fixture",
"confirmations": 2
}
@@ -0,0 +1,20 @@
{
"success": true,
"version": "1.6.0",
"url": "http://127.0.0.1:59547",
"date": "2026-10-29T15:33:46.613Z",
"passed": [
"model response validation checks the tentative connection before saving",
"a model failure after successful tools shows source, attempts and local runtime diagnosis",
"explicit retry preserves the completed tool result without replaying the task",
"an error question receives the actual session diagnosis and formatted answer",
"review state exposes the review action and prevents application during a running request",
"approved Unicode commands execute in the declared shell and retain Chinese output",
"authentication errors do not retry and error/diagnostic controls fit a 390 px viewport",
"stop cancels pending retry and clears running model state",
"a transient service failure recovers within the bounded retry policy"
],
"pageErrors": [],
"requestFailures": [],
"modelValidation": "controlled local HTTP fixture; actual configured model is verified separately"
}
@@ -0,0 +1,19 @@
{
"success": true,
"version": "1.6.0",
"testedAt": "2026-10-29T15:34:19.995Z",
"browser": "156.0.4314.42",
"passed": [
"model-selected checks wait for approval and display actual counted results",
"verified artifact preview shows the real check log and hash",
"changed source invalidates old checks and manual confirmation runs the new plan",
"390px task drawer, log preview, close controls and fixed composer remain operable",
"reconnection synchronizes missed session changes in other projects",
"budget controls pause before tools and preserve the goal across recorded runs",
"applied proposals continue the original task into actual engineering verification"
],
"pageErrors": [],
"requestFailures": [],
"projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\execution-ui-be3c81da-3231-4a7c-845c-6a8239197747\\project",
"model": "controlled local HTTP fixture"
}
+19
View File
@@ -0,0 +1,19 @@
{
"checkedAt": "2026-10-29T15:35:15.743Z",
"version": "1.6.0",
"passed": [
"工程索引可独立于任务使用,实际覆盖范围与损坏文件显示明确",
"真实AST查询打开原文件第181行并仅滚动代码容器,输入区和顶部保持可见",
"查询词保留;过期SHA不高亮旧位置,增量刷新后正确定位第184行",
"切换项目时延迟返回的旧索引不覆盖新项目结果",
"Python候选、字符串误报排除和局部导入文件候选保留真实证据标签",
"两处唯一锚点成为待审核提案,真实界面应用后BOM/CRLF和未选择原字节保留",
"390px索引查询、范围和完整指纹可读且无横向溢出,实际文件行定位通过",
"索引刷新失败保留归属和解释,旧结果禁用并可重试恢复"
],
"pageErrors": [],
"requestFailures": [],
"root": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\index-ui-838b7181-b341-4595-a841-c1a627c29b8d",
"primaryProjectId": "dfe47e01-988b-4aa9-8217-ce92a8e04bff",
"otherProjectId": "6b4cdbb1-1748-4107-a011-8df0cc6a4e17"
}
+20
View File
@@ -0,0 +1,20 @@
{
"success": true,
"version": "1.6.0",
"testedAt": "2026-10-29T15:42:53.755Z",
"counts": {
"tests": 190,
"pass": 190,
"fail": 0,
"cancelled": 0,
"skipped": 0,
"todo": 0
},
"exitCode": 0,
"logFile": ".qa/workspaces-tests.log",
"logSha256": "c2433ebdd086a29cd39c131fd95a06162a5404bd0a80aee694cb7367d1e89895",
"testFiles": 23,
"concurrency": 2,
"initialFailureLog": ".qa/workspaces-tests-initial.log",
"scope": "Real filesystem, Git, HTTP, process-exit, recovery and synthetic-provider tests. Configured-model acceptance is recorded separately."
}
+28
View File
@@ -0,0 +1,28 @@
{
"success": true,
"version": "1.6.0",
"at": "2026-10-29T15:36:15.266Z",
"browser": "156.0.4314.42",
"passed": [
"desktop preview seals the committed version and shows existing staged/unstaged/untracked source changes",
"repeated create clicks execute once and preserve the exact source index and owner files",
"opening the child, returning to the source and reloading retain stable project/session identity",
"a record owned by another session navigates to that saved owner instead of accepting its actions",
"explicit recovery preserves outside content and acknowledgement does not report successful creation",
"390×844 preview/create/open/return stays within viewport and preserves source ownership",
"late-failure stays with the original session after project switching",
"late-success stays with the original session after project switching",
"a delayed bootstrap cannot navigate after the task panel has unmounted"
],
"pageErrors": [],
"requestFailures": [],
"screenshots": [
".qa/screenshots/1.6-workspace-review-desktop.png",
".qa/screenshots/1.6-workspace-ready-desktop.png",
".qa/screenshots/1.6-workspace-recovery-desktop.png",
".qa/screenshots/1.6-workspace-review-mobile.png",
".qa/screenshots/1.6-workspace-child-mobile.png"
],
"projectRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\workspace-ui-13e158a6-04c7-41c4-b588-25791134bca0",
"scope": "Independent synthetic Git projects and real browser flows. Desktop/390×844, actual worktree creation, source preservation, explicit external recovery, ownership navigation, delayed success/error/navigation. No production service or real model credential used."
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "local-agent-workbench",
"version": "1.5.1",
"version": "1.6.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "local-agent-workbench",
"version": "1.5.1",
"version": "1.6.0",
"dependencies": {
"@babel/parser": "7.29.11",
"diff": "^8.0.2",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "local-agent-workbench",
"version": "1.5.1",
"version": "1.6.0",
"private": true,
"type": "module",
"description": "A local coding workbench with explicit tool execution, reviewable changes and recoverable sessions.",
@@ -8,7 +8,7 @@
"dev": "vite --host 127.0.0.1",
"build": "tsc --noEmit && vite build && node scripts/build-server.mjs",
"start": "node dist-server/server.mjs",
"test": "node --test tests/*.test.mjs",
"test": "node --test --test-concurrency=2 tests/*.test.mjs",
"verify:ui": "node scripts/verify-ui.mjs",
"verify:diagnostics": "node scripts/verify-diagnostics-ui.mjs",
"package": "node scripts/package.mjs"
+7
View File
@@ -166,3 +166,10 @@
- 工作区初批21/21通过,包含8个真实进程退出切点和外部登记改动,所有clean/smudge/process/required及hooks/fsmonitor探针均无执行;内置CRLF转换与中文空格路径通过。实际API首次2项失败为隐藏.git写入方式和报告异步保存等待条件,已针对校正,继续重新验收。
- 实际API2/2通过:子工作区同Task批次修复、真实3项测试/build、确定性Git审查与报告完成,确认后没有新增模型请求;原项目索引/HEAD/owner文件保留。原检查/批次/Git/Runtime相关76/76回归通过。首轮界面6组已通过,迟到失败测试错误地要求不存在的toast节点,改为核对匹配错误的节点数量为0,产品没有错误串会话。
- 接续全量推进:完整1.6.0构建通过;八类72组独立界面全部通过,工作区9组包含创建/重复点击/打开/返回/恢复/390px及迟到响应保护。完整190项回归正在运行,正式4318仍为原PID23080的冻结1.5.1。
- 首次全量190项185通过/5失败,保存.qa/workspaces-tests-initial.log;默认高并发争抢真实Git/HTTP IO,改为并发2且不改断言/超时,另补齐1.6.0二次不可变升级支持。首次UI协调器误用残留4319的1.1.0演示宿主,版本断言停止,保留.qa/workspaces-all-ui-initial.json;改为独立port=0/data/无Key的1.6.0宿主后72组通过。
- 审核UI总表时发现基础界面与新工作区界面曾共享docs/workspaces-ui-validation.json。保留原总表快照,从各自原始成功证据分离为workspaces-basic-ui和workspaces-ui,核对每份组数与总数72;仅修正证据路径,不重复执行已通过流程。
- 完整190/190回归通过,0失败/取消/跳过,日志SHA256及并发2保存workspaces-tests-validation.json;1.6.0实测界面72组与实际退出/API成果同步公开范围。准备本地UI/版本/验证提交、不可变打包与独立源码验收;此时尚未升级正式1.5.1或启动新的模型任务。只读查询误用不存在的src/core/runtime.mjs,按rg --files定位实际runtime后继续,无写入。
- AGENTS补丁误用了task_plan中的阶段段落,整批校验拒绝、后续提交/打包未执行;按真实AGENTS末段补充不可变升级和工作区边界后继续。
+1 -1
View File
@@ -64,7 +64,7 @@ export async function upgradeRunning({ url, pid, currentRoot, newRoot, handlerRo
if (!fs.existsSync(originalScript) || !fs.existsSync(upgradeScript) || !fs.existsSync(path.join(next, 'dist-client', 'index.html'))) throw new Error('Upgrade bundles are incomplete.');
if (!Number.isInteger(pid) || pid < 1 || pid === process.pid) throw new Error('Invalid target process.');
const before = await readUpgradeJson(origin + '/api/bootstrap', 5000, 'Read original Workbench');
if (!before.token || !['0.1.0', '1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.5.1'].includes(before.version)) throw new Error('This migration accepts a supported existing Workbench.');
if (!before.token || !['0.1.0', '1.0.0', '1.1.0', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.5.1', '1.6.0'].includes(before.version)) throw new Error('This migration accepts a supported existing Workbench.');
if (before.sessions.some(session => ['running', 'awaiting_approval', 'stopping'].includes(session.status))) throw new Error('Wait for existing tasks and approvals before upgrading.');
let protocol, socket, enabledHere = false, paused = false;
const breakpoints = [];
+74
View File
@@ -0,0 +1,74 @@
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { spawn } from 'node:child_process';
import { gitEnvironment } from '../src/core/git-process.mjs';
import { randomUUID } from 'node:crypto';
const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version;
assert.equal(version, '1.6.0', 'Review evidence paths when introducing the next release.');
const prefix = 'workspaces', resultFile = `.qa/${prefix}-all-ui-validation.json`, results = [];
const cases = [
['verify-ui.mjs', '.qa/ui-validation.json'], ['verify-diagnostics-ui.mjs', '.qa/diagnostics-ui-validation.json'],
['verify-execution-ui.mjs', '.qa/execution-ui-validation.json'], ['verify-delivery-ui.mjs', '.qa/delivery-ui-validation.json'],
['verify-index-ui.mjs', '.qa/index-ui-result.json'], ['verify-change-sets-ui.mjs', 'docs/workspaces-batch-ui-validation.json'],
['verify-context-ui.mjs', '.qa/workspaces-context-ui-validation.json'], ['verify-workspaces-ui.mjs', 'docs/workspaces-ui-validation.json'],
];
fs.mkdirSync('.qa', { recursive: true });
const externalHost = new Set(['verify-ui.mjs', 'verify-diagnostics-ui.mjs', 'verify-execution-ui.mjs', 'verify-index-ui.mjs']);
async function startHost(script) {
const data = path.resolve('.qa', 'ui-host-' + script.replace('.mjs', '') + '-' + randomUUID());
fs.mkdirSync(data, { recursive: true });
const child = spawn(process.execPath, ['dist-server/server.mjs'], { cwd: process.cwd(), env: { ...gitEnvironment(),
AGENT_WORKBENCH_APP_DIR: process.cwd(), AGENT_WORKBENCH_DATA_DIR: data, AGENT_WORKBENCH_PORT: '0' }, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
let url = '', output = '', errors = '';
child.stdout.on('data', bytes => { output += bytes.toString('utf8'); for (const line of output.split('\n')) { try { const value = JSON.parse(line); if (value.ready) url = value.url; } catch {} } });
child.stderr.on('data', bytes => { errors += bytes.toString('utf8'); });
const deadline = Date.now() + 10000;
while (!url && child.exitCode === null && Date.now() < deadline) await new Promise(resolve => setTimeout(resolve, 30));
if (!url) { child.kill(); throw new Error('Independent UI host failed: ' + errors); }
const bootstrap = await (await fetch(url + '/api/bootstrap')).json();
assert.equal(bootstrap.version, version); assert.equal(bootstrap.config.hasKey, false); assert.equal(bootstrap.config.mode, 'demo');
return { url, data, async close() {
try {
await fetch(url + '/api/shutdown', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Workbench-Token': bootstrap.token, Connection: 'close' }, body: '{}' });
const stopDeadline = Date.now() + 10000;
while (child.exitCode === null && child.signalCode === null && Date.now() < stopDeadline) await new Promise(resolve => setTimeout(resolve, 30));
} finally { if (child.exitCode === null && child.signalCode === null) child.kill(); }
} };
}
for (const [script, proof] of cases) {
console.log('UI regression: ' + script); const started = Date.now(), log = `.qa/${prefix}-${script.replace('.mjs', '')}.log`;
const stream = fs.createWriteStream(log);
let host;
try {
if (externalHost.has(script)) host = await startHost(script);
await new Promise((resolve, reject) => {
const child = spawn(process.execPath, [path.join('scripts', script)], { cwd: process.cwd(), env: { ...gitEnvironment(), ...(host ? { AGENT_WORKBENCH_URL: host.url } : {}) }, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
let tail = ''; const capture = bytes => { stream.write(bytes); tail = (tail + bytes.toString('utf8')).slice(-10000); };
child.stdout.on('data', capture); child.stderr.on('data', capture);
const timer = setTimeout(() => child.kill(), 240000);
child.once('error', error => { clearTimeout(timer); reject(error); });
child.once('close', code => { clearTimeout(timer); code === 0 ? resolve() : reject(new Error(script + ' failed (' + code + '): ' + tail)); });
});
stream.end(); const evidence = JSON.parse(fs.readFileSync(proof, 'utf8'));
assert.notEqual(evidence.success, false); if (evidence.version) assert.equal(evidence.version, version);
const passed = evidence.passed ?? evidence.cases;
assert.ok(Array.isArray(passed) && passed.length > 0);
const errors = evidence.pageErrors ?? [], failures = evidence.requestFailures ?? [];
assert.equal(errors.length, 0); assert.equal(failures.length, 0);
const saved = script === 'verify-ui.mjs' ? `docs/${prefix}-basic-ui-validation.json`
: script === 'verify-workspaces-ui.mjs' ? proof
: `docs/${prefix}-${script.replace('verify-', '').replace('.mjs', '')}-validation.json`;
if (path.resolve(saved) !== path.resolve(proof)) fs.copyFileSync(proof, saved);
results.push({ script, success: true, groups: passed.length, durationMs: Date.now() - started, evidence: saved, log });
console.log('PASS ' + script + ': ' + passed.length + ' groups');
} catch (error) {
stream.end(); fs.writeFileSync(resultFile, JSON.stringify({ success: false, version, at: new Date().toISOString(), results, error: error.message, script, log }, null, 2) + '\n');
throw error;
} finally { await host?.close(); }
}
const result = { success: true, version, at: new Date().toISOString(), groups: results.reduce((sum, item) => sum + item.groups, 0), results,
scope: 'Every verifier owns an independent port and synthetic data directory. Synthetic provider fixtures verify protocols; configured-model acceptance is separate. No production service or real key read/copied.' };
fs.writeFileSync(resultFile, JSON.stringify(result, null, 2) + '\n');
fs.copyFileSync(resultFile, 'docs/' + prefix + '-all-ui-validation.json'); console.log(JSON.stringify(result, null, 2));
+2 -2
View File
@@ -33,8 +33,8 @@ child.stdout.on('data', value => { output += value; for (const line of output.sp
child.stderr.on('data', value => { errors += value; });
const wait = async predicate => { const deadline = Date.now() + 15000; while (!await predicate()) { if (Date.now() > deadline) throw new Error('UI fixture timed out: ' + errors); await new Promise(resolve => setTimeout(resolve, 40)); } };
await wait(() => url); const bootstrap = await (await fetch(url + '/api/bootstrap')).json();
assert.ok(['1.4.0', '1.5.0', '1.5.1'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
const proofPrefix = bootstrap.version === '1.4.0' ? 'm2-batch' : bootstrap.version === '1.5.0' ? 'context-batch' : 'context-fix-batch';
assert.ok(['1.4.0', '1.5.0', '1.5.1', '1.6.0'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
const proofPrefix = bootstrap.version === '1.4.0' ? 'm2-batch' : bootstrap.version === '1.5.0' ? 'context-batch' : bootstrap.version === '1.5.1' ? 'context-fix-batch' : 'workspaces-batch';
const screenshotPrefix = bootstrap.version === '1.4.0' ? '1.4-batch' : proofPrefix;
const api = async (route, input) => { const response = await fetch(url + '/api' + route, { method: input === undefined ? 'GET' : 'POST', headers: { 'Content-Type': 'application/json', 'X-Workbench-Token': bootstrap.token, Connection: 'close' },
...(input === undefined ? {} : { body: JSON.stringify(input) }) }); const value = await response.json(); assert.ok(response.ok, value.error); return value; };
+2 -2
View File
@@ -60,9 +60,9 @@ child.stderr.on('data', bytes => { errors += bytes.toString('utf8'); });
const until = async predicate => { const deadline = Date.now() + 20000; while (!await predicate()) { if (Date.now() > deadline) throw new Error('Context UI fixture timeout: ' + errors); await new Promise(resolve => setTimeout(resolve, 40)); } };
await until(() => url || child.exitCode !== null); assert.ok(url, errors);
const bootstrap = await (await fetch(url + '/api/bootstrap', { headers: { Connection: 'close' } })).json();
assert.ok(['1.5.0', '1.5.1'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
assert.ok(['1.5.0', '1.5.1', '1.6.0'].includes(bootstrap.version)); assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
const api = async route => { const response = await fetch(url + '/api' + route, { headers: { 'X-Workbench-Token': bootstrap.token, Connection: 'close' } }); const value = await response.json(); assert.ok(response.ok, value.error); return value; };
const proofPrefix = bootstrap.version === '1.5.0' ? 'context' : 'context-fix';
const proofPrefix = bootstrap.version === '1.5.0' ? 'context' : bootstrap.version === '1.5.1' ? 'context-fix' : 'workspaces-context';
const browser = await chromium.launch({ channel: 'msedge', headless: true }), page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
const passed = [], pageErrors = [], requestFailures = [], screenshots = [];
page.on('pageerror', error => pageErrors.push(error.message));
+147
View File
@@ -0,0 +1,147 @@
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { randomUUID } from 'node:crypto';
import { spawn } from 'node:child_process';
import { chromium, expect } from 'playwright/test';
import { Store } from '../src/server/store.mjs';
import { WorkspaceManager } from '../src/core/workspaces/git-workspaces.mjs';
import { createDeliveryProject } from '../tests/fixtures/delivery-project.mjs';
import { captureWorkspaceSource, assertWorkspaceSource } from '../tests/fixtures/workspace-project.mjs';
// Every host/project is synthetic and independently owned. Never uses 4318.
const root = path.resolve('.qa', 'workspace-ui-' + randomUUID()), data = path.join(root, 'data');
fs.mkdirSync(root, { recursive: true }); fs.mkdirSync('.qa/screenshots', { recursive: true });
const store = new Store(data), cases = {}, passed = [], pageErrors = [], requestFailures = [], screenshots = [], createPosts = [];
for (const name of ['normal', 'mobile', 'recovery', 'late-success', 'late-failure']) {
const projectRoot = path.join(root, '独立工作区验收-' + name); fs.mkdirSync(projectRoot); fs.writeFileSync(path.join(projectRoot, 'README.md'), '# Workspace UI fixture\n');
const project = store.addProject(projectRoot), session = store.createSession(project.id), f = { root, data, projectRoot, project, session, store };
createDeliveryProject(f); session.title = '工作区验收 ' + name; store.save(session);
const before = captureWorkspaceSource(f); cases[name] = { ...f, before };
if (name === 'recovery') {
const manager = new WorkspaceManager(store, { faultInjector: (phase, record) => {
if (phase === 'git_finished') fs.writeFileSync(path.join(record.root, 'src/add.mjs'), 'Owner registration recovery content\n');
} });
const record = await manager.prepare(session, '创建中断核对'); await (await manager.start(session, record.id, record.fingerprint)).promise;
assert.equal(record.status, 'unknown'); cases[name].record = structuredClone(record);
}
}
const peer = store.createSession(cases.normal.project.id, '同项目其他会话'); store.close();
const env = { ...process.env, AGENT_WORKBENCH_APP_DIR: process.cwd(), AGENT_WORKBENCH_DATA_DIR: data, AGENT_WORKBENCH_PORT: '0' }; delete env.AGENT_WORKBENCH_API_KEY;
const host = spawn(process.execPath, ['dist-server/server.mjs'], { cwd: process.cwd(), env, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
let url = '', output = '', errors = '';
host.stdout.on('data', bytes => { output += bytes.toString('utf8'); for (const line of output.split('\n')) { try { const value = JSON.parse(line); if (value.ready) url = value.url; } catch {} } });
host.stderr.on('data', bytes => { errors += bytes.toString('utf8'); });
const wait = async predicate => { const deadline = Date.now() + 30000; while (!(await predicate())) { if (Date.now() > deadline) throw new Error('Workspace UI state timed out: ' + errors); await new Promise(resolve => setTimeout(resolve, 30)); } };
await wait(() => url || host.exitCode !== null); assert.ok(url, errors); assert.notEqual(new URL(url).port, '4318');
const bootstrap = await (await fetch(url + '/api/bootstrap')).json();
assert.equal(bootstrap.config.hasKey, false); assert.equal(bootstrap.config.mode, 'demo');
const api = async (route, input) => {
const response = await fetch(url + '/api' + route, { method: input === undefined ? 'GET' : 'POST', headers: { 'Content-Type': 'application/json', 'X-Workbench-Token': bootstrap.token, Connection: 'close' }, ...(input === undefined ? {} : { body: JSON.stringify(input) }) });
const value = await response.json(); assert.ok(response.ok, value.error); return value;
};
const browser = await chromium.launch({ executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe', headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
page.on('pageerror', error => pageErrors.push(error.message));
page.on('requestfailed', request => { if (request.resourceType() !== 'eventsource') requestFailures.push(request.url() + ': ' + request.failure()?.errorText); });
page.on('request', request => { if (request.method() === 'POST' && /\/workspaces\/[^/]+\/create$/.test(new URL(request.url()).pathname)) createPosts.push(new URL(request.url()).pathname); });
const panel = () => page.getByLabel('独立开发工作区', { exact: true });
const review = () => page.getByRole('dialog', { name: '创建独立工作区', exact: true });
const mark = value => { passed.push(value); console.log('PASS ' + value); };
const records = f => api('/sessions/' + f.session.id + '/workspaces');
const latest = async f => (await records(f)).at(-1);
async function choose(name) {
const f = cases[name];
if (!await page.locator('.project-sidebar').isVisible()) await page.getByRole('button', { name: '展开项目栏', exact: true }).click();
await page.getByLabel('当前项目', { exact: true }).selectOption(f.project.id);
if (!await page.locator('.session-item.selected').filter({ hasText: f.session.title }).count()) await page.locator('.session-select').filter({ hasText: f.session.title }).click();
if (page.viewportSize().width <= 620 && await page.locator('.project-sidebar').isVisible()) await page.getByRole('button', { name: '收起项目栏', exact: true }).click();
await page.getByRole('button', { name: '查看任务记录', exact: true }).click(); await expect(panel()).toBeVisible(); return f;
}
async function fit(name) {
const size = await page.evaluate(() => {
const modal = document.querySelector('[role="dialog"]'), close = modal?.querySelector('[aria-label="关闭窗口"]');
const rect = modal?.getBoundingClientRect(), closeRect = close?.getBoundingClientRect();
return { width: innerWidth, height: innerHeight, scrollWidth: document.documentElement.scrollWidth, top: rect?.top, bottom: rect?.bottom, left: rect?.left, right: rect?.right, closeBottom: closeRect?.bottom };
});
assert.ok(size.scrollWidth <= size.width + 1, name + ' page horizontal overflow');
if (size.top !== undefined) { assert.ok(size.top >= 0 && size.left >= 0 && size.right <= size.width + 1 && size.bottom <= size.height + 1, name + ' modal bounds'); assert.ok(size.closeBottom <= size.height); }
const file = '.qa/screenshots/1.6-workspace-' + name + '.png'; await page.screenshot({ path: file, scale: 'css' }); screenshots.push(file);
}
try {
await page.goto(url); await page.waitForLoadState('networkidle');
const normal = await choose('normal');
await panel().getByLabel('工作区名称').fill('桌面独立开发'); await panel().getByRole('button', { name: '准备独立工作区', exact: true }).click();
await expect(review()).toBeVisible(); await expect(review()).toContainText('3 项未提交改动'); await review().getByText('查看来源已有改动', { exact: true }).click();
await expect(review()).toContainText('owner-staged.txt'); const planned = await latest(normal); assert.equal(planned.status, 'prepared'); assert.equal(fs.existsSync(planned.root), false);
await fit('review-desktop'); mark('desktop preview seals the committed version and shows existing staged/unstaged/untracked source changes');
await review().getByRole('button', { name: '确认创建工作区', exact: true }).evaluate(button => { button.click(); button.click(); });
await expect(review()).toBeHidden(); await wait(async () => (await latest(normal)).status === 'ready');
await expect(panel()).toContainText('可以开始开发'); assert.equal(createPosts.filter(route => route.includes(planned.id)).length, 1);
assertWorkspaceSource(assert, normal, normal.before, planned.branch); await fit('ready-desktop'); mark('repeated create clicks execute once and preserve the exact source index and owner files');
await panel().getByRole('button', { name: '打开此工作区', exact: true }).click();
await expect(page.getByLabel('当前项目', { exact: true })).toHaveValue(planned.childProjectId); await expect(panel()).toContainText('当前独立分支');
await expect(panel()).toContainText(planned.branch); await panel().getByRole('button', { name: '返回来源会话', exact: true }).click();
await expect(page.getByLabel('当前项目', { exact: true })).toHaveValue(normal.project.id); await expect(panel()).toContainText('桌面独立开发');
await page.reload(); await page.waitForLoadState('networkidle'); await page.getByRole('button', { name: '查看任务记录', exact: true }).click();
await expect(panel()).toContainText('可以开始开发'); mark('opening the child, returning to the source and reloading retain stable project/session identity');
await page.locator('.session-select').filter({ hasText: peer.title }).click(); await expect(panel()).toContainText('转到所属会话');
await panel().getByRole('button', { name: '转到所属会话', exact: true }).click(); await expect(page.locator('.session-item.selected')).toContainText(normal.session.title);
mark('a record owned by another session navigates to that saved owner instead of accepting its actions');
const recovery = await choose('recovery'); await expect(panel()).toContainText('创建结果需要核对');
await panel().getByRole('button', { name: '核对创建结果', exact: true }).click();
await expect(panel().getByRole('button', { name: '核对创建结果', exact: true })).toBeEnabled();
assert.equal((await latest(recovery)).status, 'unknown'); await fit('recovery-desktop');
await panel().getByRole('button', { name: '保留当前外部状态', exact: true }).click();
await page.getByRole('dialog', { name: '保留当前外部状态', exact: true }).getByRole('button', { name: '确认保留当前状态', exact: true }).click();
await expect(panel()).toContainText('已保留外部状态'); assert.equal((await latest(recovery)).status, 'resolved_external');
assert.equal(fs.readFileSync(path.join(recovery.record.root, 'src/add.mjs'), 'utf8'), 'Owner registration recovery content\n');
mark('explicit recovery preserves outside content and acknowledgement does not report successful creation');
await page.setViewportSize({ width: 390, height: 844 }); await expect(page.locator('.project-sidebar')).toBeHidden(); const mobile = await choose('mobile');
await panel().getByLabel('工作区名称').fill('手机审查工作区'); await panel().getByRole('button', { name: '准备独立工作区', exact: true }).click();
await expect(review()).toBeVisible(); await fit('review-mobile');
await review().getByRole('button', { name: '确认创建工作区', exact: true }).click(); await expect(review()).toBeHidden();
await wait(async () => (await latest(mobile)).status === 'ready'); const mobileRecord = await latest(mobile);
await panel().getByRole('button', { name: '打开此工作区', exact: true }).click(); await expect(panel()).toContainText(mobileRecord.branch); await fit('child-mobile');
await panel().getByRole('button', { name: '返回来源会话', exact: true }).click(); await expect(panel()).toContainText('手机审查工作区');
assertWorkspaceSource(assert, mobile, mobile.before, mobileRecord.branch); mark('390×844 preview/create/open/return stays within viewport and preserves source ownership');
await page.setViewportSize({ width: 1440, height: 1000 });
for (const kind of ['late-failure', 'late-success']) {
const f = await choose(kind), pattern = '**/api/sessions/' + f.session.id + '/workspaces';
let release, held, recorded;
const heldPromise = new Promise(resolve => { held = resolve; }), releasePromise = new Promise(resolve => { release = resolve; });
await page.route(pattern, async route => {
if (route.request().method() !== 'POST') return route.continue();
const response = kind === 'late-success' ? await route.fetch() : null;
if (response) recorded = await response.json(); held(); await releasePromise;
if (response) await route.fulfill({ response }); else await route.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ error: 'OLD-SOURCE-ONLY delayed failure' }) });
});
await panel().getByLabel('工作区名称').fill(kind); await panel().getByRole('button', { name: '准备独立工作区', exact: true }).click(); await heldPromise;
await choose('normal'); release(); await page.waitForResponse(response => response.url().endsWith('/sessions/' + f.session.id + '/workspaces') && response.request().method() === 'POST');
await expect(review()).toBeHidden(); await expect(page.locator('.toast').filter({ hasText: 'OLD-SOURCE-ONLY' })).toHaveCount(0);
await expect(page.getByLabel('当前项目', { exact: true })).toHaveValue(normal.project.id);
if (recorded) { assert.equal((await latest(f)).id, recorded.id); assert.equal((await latest(f)).status, 'prepared'); assert.equal(fs.existsSync(recorded.root), false); }
await page.unroute(pattern); mark(kind + ' stays with the original session after project switching');
}
await choose('normal'); let releaseNavigation, heldNavigation;
const navHeld = new Promise(resolve => { heldNavigation = resolve; }), navRelease = new Promise(resolve => { releaseNavigation = resolve; });
await page.route('**/api/bootstrap', async route => { const response = await route.fetch(); heldNavigation(); await navRelease; await route.fulfill({ response }); });
await panel().getByRole('button', { name: '打开此工作区', exact: true }).click(); await navHeld;
await page.locator('.inspector-tabs').getByRole('button', { name: /^文件/ }).click(); releaseNavigation();
await page.waitForResponse(response => response.url().endsWith('/api/bootstrap'));
await expect(page.getByLabel('当前项目', { exact: true })).toHaveValue(normal.project.id); await expect(panel()).toBeHidden();
await page.unroute('**/api/bootstrap'); mark('a delayed bootstrap cannot navigate after the task panel has unmounted');
assert.equal(pageErrors.length, 0, pageErrors.join('\n')); assert.equal(requestFailures.length, 0, requestFailures.join('\n'));
const result = { success: true, version: bootstrap.version, at: new Date().toISOString(), browser: browser.version(), passed, pageErrors, requestFailures, screenshots, projectRoot: root,
scope: 'Independent synthetic Git projects and real browser flows. Desktop/390×844, actual worktree creation, source preservation, explicit external recovery, ownership navigation, delayed success/error/navigation. No production service or real model credential used.' };
fs.writeFileSync('docs/workspaces-ui-validation.json', JSON.stringify(result, null, 2) + '\n'); console.log(JSON.stringify(result, null, 2));
} catch (error) {
await page.screenshot({ path: '.qa/screenshots/1.6-workspace-failure.png', scale: 'css' });
fs.writeFileSync('.qa/workspaces-ui-failure.json', JSON.stringify({ success: false, message: error.message, passed, pageErrors, requestFailures }, null, 2)); throw error;
} finally {
await browser.close(); try { await api('/shutdown', {}); await wait(() => host.exitCode !== null); } catch { if (host.exitCode === null) host.kill(); }
}
+38 -5
View File
@@ -13,7 +13,7 @@ const defaultConfig: Config = { mode: 'demo', baseUrl: 'http://127.0.0.1:11434/v
export default function App() {
const [token, setAccess] = useState('');
const [version, setVersion] = useState('1.5.0');
const [version, setVersion] = useState('1.6.0');
const [diagnosticsOpen, setDiagnosticsOpen] = useState(false);
const [diagnostics, setDiagnostics] = useState<RuntimeDiagnostics | null>(null);
const [diagnosticsBusy, setDiagnosticsBusy] = useState(false);
@@ -75,11 +75,13 @@ export default function App() {
const filesRequest = useRef(0);
const fileRequest = useRef(0);
const reportRequest = useRef(0);
const workspaceRequest = useRef(0);
const sessionCreation = useRef<Promise<Session | null> | null>(null);
const selectedProject = projects.find(project => project.id === projectId);
const isRunning = !!session && (activeStates.includes(session.status) || session.execution?.checks.some(job => ['queued', 'running'].includes(job.status)) === true
|| session.execution?.deliveries?.some(job => ['queued', 'preparing', 'prepared', 'publishing', 'committed', 'reporting'].includes(job.status)) === true
|| session.execution?.changeSets?.some(set => ['applying', 'rolling_back'].includes(set.status)) === true);
|| session.execution?.changeSets?.some(set => ['applying', 'rolling_back'].includes(set.status)) === true
|| session.execution?.workspaces?.some(value => ['creating', 'verifying', 'registering'].includes(value.status)) === true);
const anyRunning = isRunning || briefs.some(item => activeStates.includes(item.status));
const pending = session?.changes.filter(change => ['pending', 'conflict'].includes(change.status)) || [];
const reviewedRun = session?.execution?.run;
@@ -117,7 +119,7 @@ export default function App() {
function failure(error: unknown) { notify(error instanceof Error ? error.message : String(error)); }
function selectSession(id: string) {
if (selectedSessionRef.current === id) return;
selectedSessionRef.current = id; setSessionId(id); setSession(null); setToast('');
workspaceRequest.current++; selectedSessionRef.current = id; setSessionId(id); setSession(null); setToast('');
localStorage.setItem('awb-session', id); setChangeId(''); setEventId('');
}
function acceptSession(updated: Session) {
@@ -149,7 +151,7 @@ export default function App() {
}
async function chooseProject(id: string, preferredSession?: string) {
if (selectedProjectRef.current !== id) setToast('');
selectedProjectRef.current = id; setProjectId(id); localStorage.setItem('awb-project', id);
workspaceRequest.current++; selectedProjectRef.current = id; setProjectId(id); localStorage.setItem('awb-project', id);
filesRequest.current++; fileRequest.current++;
setOpenFile(null); setFiles([]); setFileLoading(false); setFileLine(null); setFileNotice(''); setEditing(false); setCollapsed(new Set()); setFilter('');
const candidate = preferredSession || briefs.find(item => item.projectId === id)?.id || '';
@@ -162,6 +164,28 @@ export default function App() {
} else selectSession(id);
if (window.innerWidth <= 620) setSidebarOpen(false);
}
function acceptWorkspaceBootstrap(value: Bootstrap) {
setProjects(value.projects);
setBriefs(previous => {
const merged = new Map(value.sessions.map(item => [item.id, item]));
for (const item of previous) if (!archivedSessions.current.has(item.id) && item.revision >= (merged.get(item.id)?.revision ?? -1)) merged.set(item.id, item);
return [...merged.values()].filter(item => !archivedSessions.current.has(item.id)).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
});
}
async function refreshWorkspaceState(originProjectId: string, originSessionId: string, isCurrent: () => boolean = () => true) {
const request = ++workspaceRequest.current;
const [bootstrap, updated] = await Promise.all([api<Bootstrap>('/bootstrap'), api<Session>('/sessions/' + originSessionId)]);
if (!isCurrent() || request !== workspaceRequest.current || selectedProjectRef.current !== originProjectId || selectedSessionRef.current !== originSessionId) return;
acceptWorkspaceBootstrap(bootstrap); acceptSession(updated);
}
async function navigateWorkspace(nextProjectId: string, nextSessionId: string, isCurrent: () => boolean = () => true) {
const originProjectId = selectedProjectRef.current, originSessionId = selectedSessionRef.current, request = ++workspaceRequest.current;
const [bootstrap, next] = await Promise.all([api<Bootstrap>('/bootstrap'), api<Session>('/sessions/' + nextSessionId)]);
if (!isCurrent() || request !== workspaceRequest.current || selectedProjectRef.current !== originProjectId || selectedSessionRef.current !== originSessionId) return;
if (next.projectId !== nextProjectId || next.archived || !bootstrap.projects.some(value => value.id === nextProjectId)) throw new Error('目标会话已归档或项目身份发生变化,请从项目栏选择当前会话。');
acceptWorkspaceBootstrap(bootstrap);
await chooseProject(nextProjectId, nextSessionId); acceptSession(next); showInspector('task');
}
async function newSession() {
if (sessionCreation.current) return sessionCreation.current;
if (!projectId) { setProjectOpen(true); return null; }
@@ -348,6 +372,15 @@ export default function App() {
api<Session>('/sessions/' + sessionId).then(result => { if (alive) acceptSession(result); }).catch(error => { if (alive) failure(error); });
return () => { alive = false; };
}, [token, sessionId]);
const readyWorkspaceIds = (session?.execution?.workspaces ?? []).filter(value => value.status === 'ready').map(value => value.childProjectId).join(',');
useEffect(() => {
if (!session || !readyWorkspaceIds || readyWorkspaceIds.split(',').every(id => projects.some(value => value.id === id))) return;
let alive = true; const originProject = session.projectId, originSession = session.id;
refreshWorkspaceState(originProject, originSession, () => alive).catch(error => {
if (alive && selectedProjectRef.current === originProject && selectedSessionRef.current === originSession) failure(error);
});
return () => { alive = false; };
}, [session?.id, readyWorkspaceIds]);
useEffect(() => {
if (!token) return;
let alive = true, refreshTimer: ReturnType<typeof setTimeout> | null = null;
@@ -478,7 +511,7 @@ export default function App() {
{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><IconButton label="复制文件内容" onClick={() => navigator.clipboard.writeText(openFile.content).then(() => notify('已复制文件内容。')).catch(failure)}><Copy size={14} /></IconButton><IconButton label={editing ? '取消编辑' : '编辑文件'} onClick={() => { 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></> : <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={failure} 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 === 'task' && (session ? <TaskPanel key={session.id} session={session} onSession={acceptSession} onError={failure} busy={isRunning} /> : <EmptyInspector kind="trace" />)}
{tab === 'task' && (session && selectedProject ? <TaskPanel key={session.id} project={selectedProject} session={session} onSession={acceptSession} onError={failure} busy={isRunning} onWorkspaceRefresh={refreshWorkspaceState} onWorkspaceNavigate={navigateWorkspace} /> : <EmptyInspector kind="trace" />)}
{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>
</aside>
+5 -3
View File
@@ -1,10 +1,11 @@
import { useEffect, useRef, useState } from 'react';
import { Check, ClipboardCheck, FileText, GitBranch, LoaderCircle, Play, RefreshCw, ShieldQuestion } from 'lucide-react';
import type { ArtifactPreview, CheckPlan, Run, Session } from './types';
import type { ArtifactPreview, CheckPlan, Project, Run, Session } from './types';
import { api } from './api';
import { Modal, Status } from './components';
import { DeliveryPanel } from './DeliveryPanel';
import { RequestContextPanel } from './RequestContextPanel';
import { WorkspacePanel } from './WorkspacePanel';
import './TaskPanel.css';
const stopReasons: Record<string, string> = { no_progress: '重复读取未推进任务,请核对后继续', context_limit: '完整任务要求超过请求上下文预算', time_limit: '到达运行时间预算', token_limit: '到达本次 token 预算', task_token_limit: '到达任务累计预算', step_limit: '到达工具轮次上限', cancelled: '用户停止', model_error: '模型请求失败', interrupted: '进程中断' };
@@ -13,7 +14,7 @@ stopReasons.git_review = 'Git预览已保存,等待审查与确认';
stopReasons.git_review_declined = 'Git预览已撤回,文件和检查记录保留';
const time = (value: string | null | undefined) => value ? new Date(value).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit' }) : '执行中';
export function TaskPanel({ session, onSession, onError, busy }: { session: Session; onSession: (value: Session) => void; onError: (error: unknown) => void; busy: boolean }) {
export function TaskPanel({ project, session, onSession, onError, busy, onWorkspaceRefresh, onWorkspaceNavigate }: { project: Project; session: Session; onSession: (value: Session) => void; onError: (error: unknown) => void; busy: boolean; onWorkspaceRefresh: (projectId: string, sessionId: string, isCurrent?: () => boolean) => Promise<void>; onWorkspaceNavigate: (projectId: string, sessionId: string, isCurrent?: () => boolean) => Promise<void> }) {
const execution = session.execution, task = execution?.task;
const [runId, setRunId] = useState('');
const [historicalRun, setHistoricalRun] = useState<Run | null>(null);
@@ -60,6 +61,7 @@ export function TaskPanel({ session, onSession, onError, busy }: { session: Sess
}
return <div className="task-record" aria-label="任务记录">
<WorkspacePanel project={project} session={session} busy={busy} onRefresh={onWorkspaceRefresh} onNavigate={onWorkspaceNavigate} onError={onError} />
<section className="task-record-section">
<div className="record-heading"><ClipboardCheck size={15} /><h3>任务目标</h3>{task && <Status value={task.status} />}</div>
{task ? <><p className="task-goal">{task.goal}</p><code className="record-id" title={task.id}>{task.id.slice(0, 8)} · 任务</code>
@@ -71,7 +73,7 @@ export function TaskPanel({ session, onSession, onError, busy }: { session: Sess
<div className="record-heading"><h3>运行记录</h3><span>{execution?.runs.filter(item => item.taskId === task.id).length} 次</span></div>
<label className="run-picker">选择一次运行<select aria-label="选择运行记录" value={id} onChange={event => setRunId(event.target.value)}>{execution?.runs.filter(item => item.taskId === task.id).map((item, index) => <option key={item.id} value={item.id}>第 {index + 1} 次 · {time(item.startedAt)}{item.resumeOf ? ' · 接续' : ''}</option>)}</select></label>
{run ? <><div className="run-status"><Status value={run.status} /><code title={run.id}>{run.id.slice(0, 8)}</code></div>
<dl className="record-fields"><dt>实际模型</dt><dd>{run.model?.verified === false ? '历史模型信息未记录' : run.model?.mode === 'demo' ? '离线演示 · 固定脚本' : run.model?.model || '未记录'}</dd><dt>接口</dt><dd className="record-endpoint">{run.model?.verified === false ? '未记录' : run.model?.baseUrl || '本地演示'}</dd><dt>开始 / 结束</dt><dd>{time(run.startedAt)}<br />{time(run.finishedAt)}</dd><dt>模型轮次 / 工具</dt><dd>{run.steps} / {run.toolCalls}</dd><dt>已报告用量</dt><dd>{number(run.usage?.totalTokens)} tokens<br /><small>输入 {number(run.usage?.inputTokens)} · 输出 {number(run.usage?.outputTokens)}</small></dd>
<dl className="record-fields"><dt>实际模型</dt><dd>{run.model?.verified === false ? '历史模型信息未记录' : run.model?.mode === 'demo' ? '离线演示 · 固定脚本' : run.model?.model || '未记录'}</dd><dt>接口</dt><dd className="record-endpoint">{run.model?.verified === false ? '未记录' : run.model?.baseUrl || '本地演示'}</dd>{run.workspaceIdentity && <><dt>执行目录</dt><dd className="record-endpoint">{run.workspaceIdentity.root}</dd>{run.workspaceIdentity.branch && <><dt>独立分支</dt><dd className="record-endpoint">{run.workspaceIdentity.branch}</dd></>}</>}<dt>开始 / 结束</dt><dd>{time(run.startedAt)}<br />{time(run.finishedAt)}</dd><dt>模型轮次 / 工具</dt><dd>{run.steps} / {run.toolCalls}</dd><dt>已报告用量</dt><dd>{number(run.usage?.totalTokens)} tokens<br /><small>输入 {number(run.usage?.inputTokens)} · 输出 {number(run.usage?.outputTokens)}</small></dd>
{!!run.usage?.unknownRequests && <><dt>未报告用量</dt><dd>{run.usage.unknownRequests} 次请求 · 估算 {number(run.usage.estimatedUnknownTokens)} tokens</dd></>}
<dt>本次预算</dt><dd>{number(run.budget?.maxTokens)} tokens · {Math.round((run.budget?.maxDurationMs ?? 0) / 60000)} 分钟 · {run.budget?.maxSteps} 轮</dd><dt>任务累计</dt><dd>{number(execution?.accountedTaskTokens)} / {number(task.budget.maxTokens)} tokens</dd>
</dl>{run.stopReason && <p className="run-stop">{stopReasons[run.stopReason] || run.stopReason}</p>}
+44
View File
@@ -0,0 +1,44 @@
.workspace-panel { min-width: 0; }
.workspace-prepare { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.workspace-prepare label { font-size: 11px; color: var(--muted); }
.workspace-prepare input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 5px; padding: 9px 10px; background: #fff; font-size: 12px; }
.workspace-prepare .button { align-self: flex-start; }
.workspace-record { padding: 13px 0 0; margin-top: 16px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.8; }
.workspace-record-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.workspace-record-heading strong { font-size: 12px; overflow-wrap: anywhere; }
.workspace-record-heading span { color: var(--muted); font-size: 10px; flex-shrink: 0; }
.workspace-ready .workspace-record-heading span { color: var(--teal); }
.workspace-unknown .workspace-record-heading span { color: #805d22; }
.workspace-branch { display: block; margin-top: 6px; overflow-wrap: anywhere; color: var(--teal); font-size: 10px; }
.workspace-record > p { margin: 8px 0; color: var(--muted); }
.workspace-record details { margin-top: 10px; }
.workspace-record summary, .workspace-review summary { cursor: pointer; color: var(--teal); font-size: 11px; }
.workspace-fields { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 7px 8px; margin: 10px 0; }
.workspace-fields dt { color: var(--muted); }
.workspace-fields dd { margin: 0; min-width: 0; }
.workspace-fields code { font-size: 10px; overflow-wrap: anywhere; }
.workspace-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; margin-top: 9px; }
.workspace-actions .text-button, .workspace-current .text-button { padding-left: 0; }
.workspace-current { padding: 11px; border-left: 2px solid var(--teal); background: #edf3f1; font-size: 11px; line-height: 1.8; }
.workspace-current > span { display: block; color: var(--muted); font-size: 10px; }
.workspace-current > code { display: block; margin-top: 3px; overflow-wrap: anywhere; color: var(--teal); font-size: 10px; }
.workspace-current p { margin-top: 7px; }
.workspace-problems { display: flex; align-items: flex-start; gap: 7px; padding: 9px; background: #faf4e8; color: #805d22; border-radius: 5px; }
.workspace-problems svg { margin-top: 3px; flex-shrink: 0; }
.workspace-problems ul { margin: 0; padding-left: 14px; overflow-wrap: anywhere; }
.workspace-review { flex: 1; min-height: 0; overflow: auto; padding: 1px; font-size: 12px; line-height: 1.85; }
.workspace-review > p { margin: 12px 0; }
.workspace-track { padding: 14px; border: 1px solid var(--line); border-radius: 6px; }
.workspace-track > span { display: block; color: var(--muted); font-size: 11px; }
.workspace-track > strong { display: block; font-size: 15px; margin: 3px 0 7px; }
.workspace-track > code { display: block; font-size: 11px; overflow-wrap: anywhere; }
.workspace-track > p { margin-top: 5px; color: var(--muted); font-size: 11px; }
.workspace-track-child { border-color: #b6ccc4; background: #edf3f1; }
.workspace-track-child > code { color: var(--teal); }
.workspace-track-arrow { display: block; margin: 8px auto; color: var(--teal); }
.workspace-source-note { padding: 10px 12px; border-left: 2px solid #bd9654; background: #faf7ef; }
.workspace-source-paths { padding: 0; list-style: none; }
.workspace-source-paths li { display: flex; gap: 8px; padding: 5px 0; font-size: 11px; }
.workspace-source-paths code { white-space: pre; color: var(--muted); }
.workspace-source-paths span { overflow-wrap: anywhere; }
@media (max-width: 620px) { .workspace-review { font-size: 11px; } .workspace-track { padding: 11px; } .workspace-record-heading { flex-wrap: wrap; } }
+91
View File
@@ -0,0 +1,91 @@
import { useEffect, useRef, useState } from 'react';
import { ArrowDown, ArrowLeft, Check, FolderGit2, GitBranch, LoaderCircle, RefreshCw, ShieldQuestion } from 'lucide-react';
import { api } from './api';
import { Modal } from './components';
import type { Project, Session, WorkspaceRecord } from './types';
import './WorkspacePanel.css';
const active = ['creating', 'verifying', 'registering'];
const labels: Record<string, string> = { prepared: '等待确认创建', creating: '正在创建独立分支', verifying: '正在核对文件与分支', registering: '正在登记项目与会话', ready: '可以开始开发', unknown: '创建结果需要核对', resolved_external: '已保留外部状态', discarded: '计划已撤销' };
export function WorkspacePanel({ project, session, busy, onRefresh, onNavigate, onError }: {
project: Project; session: Session; busy: boolean;
onRefresh: (projectId: string, sessionId: string, isCurrent?: () => boolean) => Promise<void>;
onNavigate: (projectId: string, sessionId: string, isCurrent?: () => boolean) => Promise<void>;
onError: (error: unknown) => void;
}) {
const records = session.execution?.workspaces ?? [];
const [label, setLabel] = useState('');
const [working, setWorking] = useState('');
const [confirm, setConfirm] = useState<WorkspaceRecord | null>(null);
const [external, setExternal] = useState<WorkspaceRecord | null>(null);
const identity = useRef(0), inFlight = useRef(false);
const unresolved = records.some(value => value.requiresVerification || value.status === 'prepared' || active.includes(value.status));
useEffect(() => {
identity.current++; inFlight.current = false; setWorking(''); setLabel(''); setConfirm(null); setExternal(null);
return () => { identity.current++; };
}, [project.id, session.id]);
async function perform(action: string, record?: WorkspaceRecord) {
if (inFlight.current) return;
inFlight.current = true; const request = ++identity.current; setWorking(record?.id ?? 'prepare');
try {
const value = await api<WorkspaceRecord>(`/sessions/${session.id}/workspaces${record ? '/' + record.id + '/' + action : ''}`,
record ? { fingerprint: record.fingerprint, ...(action === 'acknowledge' ? { observationFingerprint: record.observation?.fingerprint } : {}) } : { label: label.trim() });
if (request !== identity.current) return;
await onRefresh(project.id, session.id, () => request === identity.current);
if (request !== identity.current) return;
if (action === 'prepare') { setConfirm(value); setLabel(''); }
else { setConfirm(null); setExternal(null); }
} catch (error) { if (request === identity.current) onError(error); }
finally { if (request === identity.current) { inFlight.current = false; setWorking(''); } }
}
async function navigate(projectId: string, sessionId: string, record?: WorkspaceRecord) {
if (inFlight.current) return;
inFlight.current = true; const request = ++identity.current; setWorking(record?.id ?? 'origin');
try {
if (record) await api(`/sessions/${record.sessionId}/workspaces/${record.id}/open`, {});
if (request !== identity.current) return;
await onNavigate(projectId, sessionId, () => request === identity.current);
} catch (error) { if (request === identity.current) onError(error); }
finally { if (request === identity.current) { inFlight.current = false; setWorking(''); } }
}
return <section className="task-record-section workspace-panel" aria-label="独立开发工作区">
<div className="record-heading"><FolderGit2 size={15} /><h3>独立开发工作区</h3></div>
{project.workspace && <div className="workspace-current"><span>当前独立分支</span><code>{project.workspace.branch}</code><p>修改、检查和提交都在此目录执行。交付后可以审查,再合并回来源项目。</p><button type="button" className="text-button" disabled={!!working} onClick={() => navigate(project.workspace!.sourceProjectId, project.workspace!.sourceSessionId)}><ArrowLeft size={13} />返回来源会话</button></div>}
<p className="record-footnote">从当前已提交版本创建独立目录和分支,让新任务有明确的开发范围。</p>
<form className="workspace-prepare" onSubmit={event => { event.preventDefault(); perform('prepare'); }}>
<label htmlFor={'workspace-label-' + session.id}>工作区名称</label>
<input id={'workspace-label-' + session.id} value={label} onChange={event => setLabel(event.target.value)} maxLength={64} placeholder="例如:订单导出功能" disabled={busy || !!working || unresolved} />
<button type="submit" className="button secondary" disabled={!label.trim() || busy || !!working || unresolved}>{working === 'prepare' ? <LoaderCircle size={14} className="spin" /> : <GitBranch size={14} />}准备独立工作区</button>
</form>
{records.slice().reverse().map(record => <article className={'workspace-record workspace-' + record.status} key={record.id}>
<div className="workspace-record-heading"><strong>{record.label}</strong><span>{labels[record.status] || record.status}</span></div>
<code className="workspace-branch">{record.branch}</code><p>{record.summary}</p>
{record.observation?.problems.length ? <div className="workspace-problems" role="status"><ShieldQuestion size={14} /><ul>{record.observation.problems.map((value, index) => <li key={index}>{value}</li>)}</ul></div> : null}
<details><summary>目录与来源</summary><dl className="workspace-fields"><dt>来源目录</dt><dd><code>{record.source.root}</code></dd><dt>起始提交</dt><dd><code>{record.source.head}</code></dd><dt>工作区目录</dt><dd><code>{record.root}</code></dd></dl></details>
<div className="workspace-actions">
{record.sessionId !== session.id ? <button type="button" className="text-button" disabled={!!working} onClick={() => navigate(record.projectId, record.sessionId)}>转到所属会话</button> : <>
{record.status === 'prepared' && <><button type="button" className="text-button" disabled={busy || !!working} onClick={() => setConfirm(record)}>查看创建预览</button><button type="button" className="text-button" disabled={busy || !!working} onClick={() => perform('discard', record)}>撤销计划</button></>}
{active.includes(record.status) && <button type="button" className="text-button" disabled={!!working} onClick={() => perform('stop', record)}>停止创建</button>}
{record.status === 'unknown' && <><button type="button" className="text-button" disabled={busy || !!working} onClick={() => perform('reconcile', record)}>{working === record.id ? <LoaderCircle size={13} className="spin" /> : <RefreshCw size={13} />}核对创建结果</button>{record.observation && <button type="button" className="text-button" disabled={busy || !!working} onClick={() => setExternal(record)}>保留当前外部状态</button>}</>}
{record.status === 'ready' && <button type="button" className="button secondary" disabled={!!working} onClick={() => navigate(record.childProjectId, record.childSessionId, record)}><FolderGit2 size={14} />打开此工作区</button>}
</>}
</div>
</article>)}
{confirm && <Modal title="创建独立工作区" description="核对来源版本和新目录后,再开始这个工作区的开发。" onClose={() => { if (!working) setConfirm(null); }}>
<div className="workspace-review">
<div className="workspace-track"><span>来源已提交版本</span><strong>{project.name}</strong><code>{confirm.source.branch} · {confirm.source.head.slice(0, 12)}</code><p>{confirm.source.treeFiles.length} 份文件 · {(confirm.source.committedBytes / 1024).toFixed(1)} KB</p></div>
<ArrowDown size={18} className="workspace-track-arrow" aria-hidden="true" />
<div className="workspace-track workspace-track-child"><span>新独立工作区</span><strong>{confirm.label}</strong><code>{confirm.branch}</code><code>{confirm.root}</code></div>
<p className="workspace-source-note">{confirm.source.dirty ? `来源有 ${confirm.source.changedPathCount} 项未提交改动,将保留在来源目录。新工作区使用上方已提交版本。` : '来源目录当前没有未提交改动。'}</p>
{!!confirm.source.changedPaths.length && <details><summary>查看来源已有改动</summary><ul className="workspace-source-paths">{confirm.source.changedPaths.map(value => <li key={value.path}><code>{value.status}</code><span>{value.path}</span></li>)}</ul></details>}
<p className="record-footnote">创建后打开为新的项目和会话。需要的依赖可在工作区中审查安装。</p>
</div>
<div className="modal-actions"><button type="button" className="button secondary" disabled={!!working} onClick={() => setConfirm(null)}>稍后创建</button><button type="button" className="button primary" disabled={busy || !!working} onClick={() => perform('create', confirm)}>{working ? <LoaderCircle size={14} className="spin" /> : <Check size={14} />}确认创建工作区</button></div>
</Modal>}
{external && <Modal title="保留当前外部状态" description="结束本次创建结果核对,目录与分支继续保留。" onClose={() => { if (!working) setExternal(null); }}><div className="workspace-review"><p>这次创建将记为“已保留外部状态”。需要继续开发时,请核对目录后从项目栏打开;这项操作不会把创建记为成功。</p><code className="workspace-branch">{external.root}</code>{external.observation?.problems.map((value, i) => <p key={i}>{value}</p>)}</div><div className="modal-actions"><button type="button" className="button secondary" disabled={!!working} onClick={() => setExternal(null)}>返回核对</button><button type="button" className="button primary" disabled={!!working} onClick={() => perform('acknowledge', external)}>确认保留当前状态</button></div></Modal>}
</section>;
}
+14 -4
View File
@@ -3,7 +3,17 @@ export interface Config {
contextLimit: number; maxSteps: number; maxOutputTokens: number; hasKey: boolean;
maxRunDurationMs: number; maxRunTokens: number; maxTaskTokens: number;
}
export interface Project { id: string; root: string; name: string; addedAt: string }
export interface WorkspaceOrigin { id: string; sourceProjectId: string; sourceSessionId: string; sourceRoot: string; sourceWorkspaceId: string | null; baseCommit: string; branch: string; commonGitDir: string; gitDir: string; fingerprint: string }
export interface WorkspaceIdentity { kind: 'local-project' | 'managed-worktree'; projectId: string; root: string; workspaceId?: string; sourceProjectId?: string; sourceSessionId?: string; sourceRoot?: string; sourceWorkspaceId?: string | null; baseCommit?: string; branch?: string; commonGitDir?: string; gitDir?: string; fingerprint?: string }
export interface Project { id: string; root: string; name: string; addedAt: string; workspace?: WorkspaceOrigin }
export interface WorkspaceRecord {
id: string; projectId: string; sessionId: string; taskId: string | null; runId: string | null; label: string; root: string; branch: string;
childProjectId: string; childSessionId: string; status: string; phase: string; fingerprint: string;
createdAt: string; updatedAt: string; finishedAt: string | null; creationAttempted: boolean; requiresVerification: boolean;
ownerPid: number | null; gitPid: number | null; summary: string;
source: { root: string; head: string; branch: string; dirty: boolean; changedPathCount: number; changedPaths: { status: string; path: string; originalPath?: string }[]; fingerprint: string; committedBytes: number; treeFiles: { mode: string; blob: string; bytes: number; path: string }[] };
observation?: { rootState: string; branchHead: string | null; workspaceHead: string | null; workspaceBranch: string | null; registered: boolean; clean: boolean; contentsVerified: boolean; sourcePreserved: boolean; ready: boolean; fingerprint: string; observedAt: string; problems: string[] } | null;
}
export interface SessionBrief { id: string; projectId: string; title: string; status: string; revision: number; updatedAt: string; changeCount: number }
export interface Message { id: string; role: string; content: string; createdAt: string }
export interface ToolEvent {
@@ -69,7 +79,7 @@ export interface CodeQuery { query: string; kind: CodeQueryKind; results: CodeRe
export interface ModelSnapshot { mode: string; model: string; baseUrl: string; verified?: boolean; contextLimit?: number; maxOutputTokens?: number }
export interface Usage { requests: number; inputTokens: number; outputTokens: number; totalTokens: number; unknownRequests: number; estimatedUnknownTokens: number }
export interface RunBudget { maxSteps: number; maxDurationMs: number; maxTokens: number; maxTaskTokens: number }
export interface RunBrief { id: string; taskId: string; status: string; startedAt: string; finishedAt: string | null; steps: number; toolCalls: number; usage: Usage; stopReason: string | null; model: ModelSnapshot; budget: RunBudget; resumeOf: string | null }
export interface RunBrief { id: string; taskId: string; status: string; startedAt: string; finishedAt: string | null; steps: number; toolCalls: number; usage: Usage; stopReason: string | null; model: ModelSnapshot; budget: RunBudget; resumeOf: string | null; workspaceIdentity?: WorkspaceIdentity }
export interface Run extends RunBrief { engine: string; review?: { kind: string; planId: string; status: string; preparedAt?: string; resolvedAt?: string }; currentContextPlanId?: string; checkpoint: { completedToolIds: string[]; pendingToolIds: string[]; requiresVerification: string[] } }
export interface ContextPlan {
id: string; sessionId: string; projectId: string; taskId: string; runId: string; stepId: string; requestIndex?: number; status: string;
@@ -85,7 +95,7 @@ export interface ContextHistoryGroup {
archive: { artifact_id: string; sha256: string; bytes: number; chunks?: number };
}
export interface ContextHistory { planId: string; groups: ContextHistoryGroup[]; offset: number; totalGroups: number; truncated: boolean }
export interface Task { id: string; goal: string; status: string; instructions: { id: string; content: string; createdAt: string; source?: string }[]; usage: Usage; budget: { maxTokens: number }; verification: { status: string; checkJobId: string | null }; origin: string }
export interface Task { id: string; goal: string; status: string; instructions: { id: string; content: string; createdAt: string; source?: string }[]; usage: Usage; budget: { maxTokens: number }; verification: { status: string; checkJobId: string | null }; origin: string; workspaceIdentity?: WorkspaceIdentity }
export interface Artifact { id: string; taskId: string | null; runId: string | null; kind: string; mediaType: string; sha256: string; bytes: number; createdAt: string; status: string }
export interface ArtifactPreview extends Artifact { content: string; offset: number; totalCharacters: number; truncated: boolean }
export interface CheckResult { id: string; name: string; kind: string; command: string; status: string; exitCode: number | null; durationMs: number; tests: { total: number; passed: number; failed: number; skipped: number; cancelled: number } | null; logArtifactId?: string; reason?: string }
@@ -113,4 +123,4 @@ export interface ChangeSet {
snapshotArtifactId: string; sourceRunId: string; restoreError?: string }[];
observations?: { path: string; state: string; exists: boolean | null; actualSha256: string | null; problem?: string }[];
}
export interface ExecutionSnapshot { schemaVersion: number; task: Task | null; run: Run | null; runs: RunBrief[]; progress: { totalTools: number; completedTools: number; requiresVerification: { id: string; tool: string; state: string; callId: string }[] }; artifacts: Artifact[]; checks: CheckJob[]; plans?: CheckPlan[]; deliveries?: DeliveryJob[]; deliveryPlans?: DeliveryPlan[]; changeSets?: ChangeSet[]; contextPlans?: ContextPlan[]; accountedTaskTokens: number }
export interface ExecutionSnapshot { schemaVersion: number; task: Task | null; run: Run | null; runs: RunBrief[]; progress: { totalTools: number; completedTools: number; requiresVerification: { id: string; tool: string; state: string; callId: string }[] }; artifacts: Artifact[]; checks: CheckJob[]; plans?: CheckPlan[]; deliveries?: DeliveryJob[]; deliveryPlans?: DeliveryPlan[]; changeSets?: ChangeSet[]; contextPlans?: ContextPlan[]; workspaces?: WorkspaceRecord[]; workspaceIdentity?: WorkspaceIdentity; accountedTaskTokens: number }
+1 -1
View File
@@ -74,7 +74,7 @@ return async (request, response) => {
eventCursor: store.eventCursor, storage: store.storageInfo(), runtimeRoot: appDirectory,
environment: executionEnvironment(),
projects: store.projects, sessions: store.listSessions(), exampleProjectId: exampleProject?.id ?? null,
capabilities: { requestContext: 'bounded-whole-request-and-history-artifacts', changeSets: 'reviewed-recoverable-batches', fileChanges: 'review', exactPatches: 'sha256-unique-anchors', codeIndex: 'bounded-ast-and-candidates', commands: 'per-call-approval', recovery: 'durable-tool-results', model: 'chat-completions-compatible', execution: 'task-run-step', events: 'persistent-cursor', artifacts: 'sha256-verified', checks: 'npm-script-jobs', projectInspection: 'bounded-source-and-git', gitDelivery: 'reviewed-local-snapshot', deliveryReports: 'evidence-json-markdown' },
capabilities: { workspaces: 'owned-git-worktree-and-explicit-recovery', gitReview: 'durable-confirmation-boundary', requestContext: 'bounded-whole-request-and-history-artifacts', changeSets: 'reviewed-recoverable-batches', fileChanges: 'review', exactPatches: 'sha256-unique-anchors', codeIndex: 'bounded-ast-and-candidates', commands: 'per-call-approval', recovery: 'durable-tool-results', model: 'chat-completions-compatible', execution: 'task-run-step', events: 'persistent-cursor', artifacts: 'sha256-verified', checks: 'npm-script-jobs', projectInspection: 'bounded-source-and-git', gitDelivery: 'reviewed-local-snapshot', deliveryReports: 'evidence-json-markdown' },
});
if (method === 'GET' && route === '/api/diagnostics') {
const selected = url.searchParams.get('session');
+1 -1
View File
@@ -1,6 +1,6 @@
import { randomUUID, createHash } from 'node:crypto';
export const APP_VERSION = '1.5.1';
export const APP_VERSION = '1.6.0';
export function executionEnvironment() {
const windows = process.platform === 'win32';
+5 -3
View File
@@ -189,9 +189,11 @@
## 独立工作区与审查收尾(1.6.0开发)
1. [complete] Git预览后确定性停止模型请求并等待审查;34项相关回归/9组界面和本地提交7d60dc9保留。
2. [in_progress] 工作区快照、普通检出、过滤器/hook关闭、稳定归属和实际进程恢复;21项初批行为通过,API和交付整合继续。
3. [in_progress] 原项目/子工作区导航与桌面/390px界面,异步操作有完整归属保护;构建通过,真实浏览器待验收。
4. [pending] 全部回归、不可变1.6.0包/独立源码验收、原PID/连接升级、真实模型工作区工程交付与证据本地提交。
2. [complete] 工作区快照、普通检出、过滤器/hook关闭、稳定归属和实际进程恢复;21项初批行为及2项真实API交付通过,新增关闭等待和配置隐私用例进入全量回归。
3. [complete] 原项目/子工作区导航与桌面/390px界面,异步操作有完整归属保护;1.6.0共72组界面通过。
4. [in_progress] 全部190项回归、不可变1.6.0包/独立源码验收、原PID/连接升级、真实模型工作区工程交付与证据本地提交。
5. [pending] 继续React/TypeScript与Python工程检查、REA证据绑定的机制适配和Purge实验;Electron/移动配对及完整M2/M6另行验收。
本轮错误:首批API验证的2项失败均在测试阶段。Windows隐藏.git不能以创建标志覆盖,改为r+打开原控制文件;Git提交completed早于报告工件保存,改为同时等待报告身份再核对。没有修改正式服务或真实凭据。
本轮接续:首轮全量190项在默认高并发下185通过/5失败,原日志保留为.qa/workspaces-tests-initial.log;将真实Git/HTTP测试并发固定为2,不放宽超时或断言,补齐1.6.0重复升级兼容后重新验收。首轮界面协调器误用了旧4319演示宿主,版本不符即停止;改为四个旧验证器各自启动独立1.6.0宿主,八类72组全部通过。基础界面与工作区界面证据的命名碰撞已修正为独立路径,原结果未改写为不同结论。
+1
View File
@@ -17,6 +17,7 @@ function replaceControlFile(file, contents) {
test('workspace HTTP ownership, reviewed creation and reopen survive restart without changing source files', { timeout: 60000 }, async t => {
const f = fixture(t); createDeliveryProject(f); const before = captureWorkspaceSource(f); f.store.close();
const host = await launchWorkbench(t, f.data), parent = '/sessions/' + f.session.id;
assert.equal(host.bootstrap.capabilities.workspaces, 'owned-git-worktree-and-explicit-recovery');
const plan = await host.api(parent + '/workspaces', { label: 'API隔离工作区' });
assert.equal(plan.source.dirty, true); assert.equal(fs.existsSync(plan.root), false);
await assert.rejects(host.api(parent + '/workspaces/' + plan.id + '/create', {}), /指纹/);
+25
View File
@@ -81,6 +81,31 @@ test('workspace preparation refuses known shared-repository activity and preserv
assert.equal(f.store.core.workspace.size, 1);
});
test('a pending source snapshot participates in shutdown and completes before storage can close', async t => {
const f = fixture(t); createDeliveryProject(f, { ownerChanges: false });
const runtime = new Runtime(f.store, new Provider()), manager = runtime.workspaceManager();
const snapshot = manager.snapshot.bind(manager); let release;
const gate = new Promise(resolve => { release = resolve; });
manager.snapshot = async project => { await gate; return snapshot(project); };
const prepared = manager.prepare(f.session, 'pending snapshot');
assert.equal(runtime.isActive(f.session.id), true); assert.equal(runtime.hasActivity(), true);
let finished = false; const stopped = runtime.stopAll().then(() => { finished = true; });
await new Promise(resolve => setImmediate(resolve)); assert.equal(finished, false);
release(); const plan = await prepared; await stopped;
assert.equal(plan.status, 'prepared'); assert.equal(fs.existsSync(plan.root), false); assert.equal(runtime.hasActivity(), false);
});
test('source configuration values stay private and a configuration change invalidates a saved review', async t => {
const f = fixture(t); createDeliveryProject(f, { ownerChanges: false });
deliveryGit(f, ['config', 'workbench.syntheticcredential', 'QA-CONFIG-VALUE-MUST-NOT-BE-EXPORTED']);
const manager = new WorkspaceManager(f.store), record = await manager.prepare(f.session, 'config identity');
assert.equal(JSON.stringify(record).includes('QA-CONFIG-VALUE-MUST-NOT-BE-EXPORTED'), false);
assert.match(record.source.configuration.common, /^[a-f0-9]{64}$/);
deliveryGit(f, ['config', 'core.autocrlf', 'true']);
await (await manager.start(f.session, record.id, record.fingerprint)).promise;
assert.equal(record.status, 'prepared'); assert.equal(record.creationAttempted, false); assert.equal(fs.existsSync(record.root), false);
});
for (const kind of ['excluded dependency', 'large committed blob', 'case collision', 'committed symbolic link', 'external config include']) {
test('workspace review rejects ' + kind + ' before any checkout', async t => {
const f = fixture(t); createDeliveryProject(f, { ownerChanges: false });