feat: add engineering evaluation review and adoption UI
This commit is contained in:
@@ -52,3 +52,9 @@ docs/desktop-host-*.json -text whitespace=blank-at-eol,blank-at-eof,space-before
|
||||
docs/desktop-credentials-*.tap binary
|
||||
docs/desktop-credentials-*.txt binary
|
||||
docs/desktop-credentials-*.json -text whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol
|
||||
docs/engineering-evals-*-evidence/** -text whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol
|
||||
docs/engineering-evals-*-evidence/**/*.tap binary
|
||||
docs/engineering-evals-*-evidence/*.tap binary
|
||||
docs/engineering-evals-*-evidence/**/*.log binary
|
||||
docs/engineering-evals-*-evidence/*.log binary
|
||||
docs/engineering-evals-*.json -text whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol
|
||||
|
||||
+9
-1
@@ -7,7 +7,7 @@
|
||||
| A 固定契约 | 专项通过 | 1–3固定样本、HEAD/同源字节、明确源码/原测试/检查命令、模型和总预算 |
|
||||
| B 运行账本 | 专项通过 | 原版0模型请求、候选原工具/审批/预算、停止与重启未知、不重放已尝试准备 |
|
||||
| C 比较 | 专项通过 | 原失败/全部尝试/日志SHA、原用量缺失及人工审批/应用、不可变报告和父审查/Git门控 |
|
||||
| D 产品流程 | 待实现 | 桌面/390px准备、审查、比较和采纳 |
|
||||
| D 产品流程 | 7组通过 | 桌面/390px准备、审查、比较、导出、刷新、采纳、停止和来源变化;两视口实际截图回看 |
|
||||
| E 实际工程 | 待验 | Node/React/Python及自身模块小范围试点 |
|
||||
| F 完整发行 | 待验 | 完整源码/历史UI/独立源码/便携/安装/升级/原生回看 |
|
||||
|
||||
@@ -22,3 +22,11 @@
|
||||
最后原版日志/采纳/HTTP3条路径3/3通过(`.qa/evaluation-abc-final-guards.log`)。首次选择器错误后还发现受控textarea的标签名称会随内容变化,现全部关键textarea均有稳定的aria-label,另开收据复验;原第二次失败`.qa/engineering-evals-ui-b08b6c81-cd2b-47c5-85d4-66ecba9fd922`保持。
|
||||
|
||||
父工程检查/变更集/Git/工作区各操作的活动门控已纳入评测活动,最终相关2路径2/2通过。A-C原日志按原字节封存于[清单](engineering-evals-abc-evidence/manifest.json)。
|
||||
|
||||
## D 产品流程回顾
|
||||
|
||||
最终7组通过,原收据`.qa/engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863`,概览见[实际UI记录](engineering-evals-ui-validation.json)。实际原版3测试失败、候选3测试通过、父审查/检查/Git均完成;停止保留stopped,父来源变化在创建工作区前拒绝。桌面并列和390px堆叠截图已目视回看,原失败与候选通过、人工审批/应用次数、缺失费用及固定响应标签均可读,未见页面横向溢出。
|
||||
|
||||
第三次UI收据`.qa/engineering-evals-ui-d240669e-0c9b-4450-960e-1b870f9fb23f`前5组已通过,之后QA在POST完成前读取最新批次,误选旧批次导致停止场景等待失败。修正为等待批次数量和新标题后获取原对象;原失败保持,最终轮独立执行完整7组。此为验收脚本竞态,不删除或改写原失败。
|
||||
|
||||
A-C原日志在提交时被Git默认换行规范化;现增加证据目录字节保护,并重新按原`.qa`字节暂存,后续提交逐Git blob核对清单SHA。保留旧提交,不改写历史。
|
||||
|
||||
@@ -17,3 +17,9 @@
|
||||
复用了原WorkerManager/WorkspaceManager、CheckRunner、ChangeSet及GitDelivery。原版不伪装成一个有修改的worker成果,评测归集只接受候选;普通协作接口不能绕过评测开始或采纳。全部检查尝试、原日志SHA及上游未知用量进入固定报告,缺失证据显示unknown并阻止采纳,不删除原分母。多样本结束后只能采纳一项;先核对原父来源,再切回所属Task形成独立变更集,不能直接覆盖父文件。
|
||||
|
||||
回顾发现采纳预检含异步窗口,已增加父工程活动锁和持久采纳意图;重启不恢复副作用。计划停止也等待原准备结束。对源码/模型修订、精确文件、原测试、HTTP归属及停止恢复的12项专项和原worker6项合计18/18通过,原10项首轮及后续修正证据分别保留。工程推理成功率、真实模型费用和Purge效果没有据此判为完成。
|
||||
|
||||
## D 回顾
|
||||
|
||||
实际原任务导航、提案审查、检查审批、对照报告与采纳后父交付7组通过。对照面板将固定响应标签放在报告头部,390px按原版/候选顺序堆叠并实际滚动核对候选测试证据;缺失费用显示未报告。修正可访问名称随select选项/textarea内容变化的问题,关键表单有稳定名称。第三轮QA提前读取最新对象的竞态修正后,第四轮完整通过;原失败收据保持。复用了现有模态、WorkerPanel、差异审查和Git交付,没有新增执行内核或依赖。
|
||||
|
||||
回看补充同批切换样本时迟到报告响应的当前样本身份核对,避免旧报告盖住新选择;TypeScript通过,随后完整历史/新评测回归覆盖最终代码。证据目录保留原CRLF字节并显式声明cr-at-eol,避免Git文本规范化改变日志及清单。
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
✔ evaluation contract fixes bounded samples, source paths, checks and aggregate budget (525.0705ms)
|
||||
✔ same-source workspaces seal real commands before execution and preserve original staged and unstaged bytes (11083.0145ms)
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (40331.2376ms)
|
||||
✔ candidate cannot shrink tests and changing original test bytes rejects execution before any model request (15626.3462ms)
|
||||
✔ missing upstream usage remains unknown and does not become a free run or invented cost (25914.3911ms)
|
||||
✔ missing raw check logs preserve unknown result and original sample denominator (25759.3229ms)
|
||||
✔ source and model changes never silently replace an existing batch input (2304.4183ms)
|
||||
✔ sample queue cannot skip or reset attempted samples, and reports freeze further writes (20862.9625ms)
|
||||
✔ stop cancels only current candidate and preserves partial results instead of replaying a request (16535.6083ms)
|
||||
✔ restart recovers interrupted evaluations as unknown and keeps completed checks and plan identity (15402.608ms)
|
||||
ℹ tests 10
|
||||
ℹ suites 0
|
||||
ℹ pass 10
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 174485.0587
|
||||
✔ evaluation contract fixes bounded samples, source paths, checks and aggregate budget (525.0705ms)
|
||||
✔ same-source workspaces seal real commands before execution and preserve original staged and unstaged bytes (11083.0145ms)
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (40331.2376ms)
|
||||
✔ candidate cannot shrink tests and changing original test bytes rejects execution before any model request (15626.3462ms)
|
||||
✔ missing upstream usage remains unknown and does not become a free run or invented cost (25914.3911ms)
|
||||
✔ missing raw check logs preserve unknown result and original sample denominator (25759.3229ms)
|
||||
✔ source and model changes never silently replace an existing batch input (2304.4183ms)
|
||||
✔ sample queue cannot skip or reset attempted samples, and reports freeze further writes (20862.9625ms)
|
||||
✔ stop cancels only current candidate and preserves partial results instead of replaying a request (16535.6083ms)
|
||||
✔ restart recovers interrupted evaluations as unknown and keeps completed checks and plan identity (15402.608ms)
|
||||
ℹ tests 10
|
||||
ℹ suites 0
|
||||
ℹ pass 10
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 174485.0587
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (42230.2742ms)
|
||||
✔ missing raw check logs preserve unknown result and original sample denominator (31180.7936ms)
|
||||
✔ HTTP evaluations require host token, original fingerprint and session ownership; worker API cannot bypass evaluation flow (15068.7458ms)
|
||||
ℹ tests 3
|
||||
ℹ suites 0
|
||||
ℹ pass 3
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 88729.2571
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (42230.2742ms)
|
||||
✔ missing raw check logs preserve unknown result and original sample denominator (31180.7936ms)
|
||||
✔ HTTP evaluations require host token, original fingerprint and session ownership; worker API cannot bypass evaluation flow (15068.7458ms)
|
||||
ℹ tests 3
|
||||
ℹ suites 0
|
||||
ℹ pass 3
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 88729.2571
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (41949.8076ms)
|
||||
✔ HTTP evaluations require host token, original fingerprint and session ownership; worker API cannot bypass evaluation flow (12432.7767ms)
|
||||
ℹ tests 2
|
||||
ℹ suites 0
|
||||
ℹ pass 2
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 54628.6602
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (41949.8076ms)
|
||||
✔ HTTP evaluations require host token, original fingerprint and session ownership; worker API cannot bypass evaluation flow (12432.7767ms)
|
||||
ℹ tests 2
|
||||
ℹ suites 0
|
||||
ℹ pass 2
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 54628.6602
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
✔ evaluation contract fixes bounded samples, source paths, checks and aggregate budget (879.7691ms)
|
||||
✔ same-source workspaces seal real commands before execution and preserve original staged and unstaged bytes (14874.6757ms)
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (49362.4978ms)
|
||||
✔ candidate cannot shrink tests and changing original test bytes rejects execution before any model request (19490.2731ms)
|
||||
✔ missing upstream usage remains unknown and does not become a free run or invented cost (28035.4922ms)
|
||||
✔ missing raw check logs preserve unknown result and original sample denominator (27592.2318ms)
|
||||
✔ source and model changes never silently replace an existing batch input (2375.6565ms)
|
||||
✔ model revision change before preparing a fixed sample cannot silently use the replacement connection (2210.0987ms)
|
||||
✔ HTTP evaluations require host token, original fingerprint and session ownership; worker API cannot bypass evaluation flow (12196.9645ms)
|
||||
✔ sample queue cannot skip or reset attempted samples, and reports freeze further writes (21512.0204ms)
|
||||
✔ stop cancels only current candidate and preserves partial results instead of replaying a request (17772.6846ms)
|
||||
✔ restart recovers interrupted evaluations as unknown and keeps completed checks and plan identity (16171.5361ms)
|
||||
✔ worker scopes and allocated budgets reject aliases, extra permissions and aggregate overflow (770.0996ms)
|
||||
✔ two sequential Git workspaces freeze a new parent goal, separate owned tasks and preserve all source bytes (13643.8712ms)
|
||||
✔ real isolated changes, approvals and npm checks produce original owned outputs, not model completion claims (28402.4151ms)
|
||||
✔ forged worker tools cannot execute terminal or Git even when absent from the advertised tool list (12969.4039ms)
|
||||
✔ a completion-only model pauses each worker without fabricated changes or checks (14462.927ms)
|
||||
✔ restart retains frozen scope and marks interrupted parent and workers unknown without sending requests (12239.9837ms)
|
||||
ℹ tests 18
|
||||
ℹ suites 0
|
||||
ℹ pass 18
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 212727.8273
|
||||
✔ evaluation contract fixes bounded samples, source paths, checks and aggregate budget (879.7691ms)
|
||||
✔ same-source workspaces seal real commands before execution and preserve original staged and unstaged bytes (14874.6757ms)
|
||||
✔ actual original failures and candidate success are both preserved, then adoption requires parent review, checks and Git (49362.4978ms)
|
||||
✔ candidate cannot shrink tests and changing original test bytes rejects execution before any model request (19490.2731ms)
|
||||
✔ missing upstream usage remains unknown and does not become a free run or invented cost (28035.4922ms)
|
||||
✔ missing raw check logs preserve unknown result and original sample denominator (27592.2318ms)
|
||||
✔ source and model changes never silently replace an existing batch input (2375.6565ms)
|
||||
✔ model revision change before preparing a fixed sample cannot silently use the replacement connection (2210.0987ms)
|
||||
✔ HTTP evaluations require host token, original fingerprint and session ownership; worker API cannot bypass evaluation flow (12196.9645ms)
|
||||
✔ sample queue cannot skip or reset attempted samples, and reports freeze further writes (21512.0204ms)
|
||||
✔ stop cancels only current candidate and preserves partial results instead of replaying a request (17772.6846ms)
|
||||
✔ restart recovers interrupted evaluations as unknown and keeps completed checks and plan identity (16171.5361ms)
|
||||
✔ worker scopes and allocated budgets reject aliases, extra permissions and aggregate overflow (770.0996ms)
|
||||
✔ two sequential Git workspaces freeze a new parent goal, separate owned tasks and preserve all source bytes (13643.8712ms)
|
||||
✔ real isolated changes, approvals and npm checks produce original owned outputs, not model completion claims (28402.4151ms)
|
||||
✔ forged worker tools cannot execute terminal or Git even when absent from the advertised tool list (12969.4039ms)
|
||||
✔ a completion-only model pauses each worker without fabricated changes or checks (14462.927ms)
|
||||
✔ restart retains frozen scope and marks interrupted parent and workers unknown without sending requests (12239.9837ms)
|
||||
ℹ tests 18
|
||||
ℹ suites 0
|
||||
ℹ pass 18
|
||||
ℹ fail 0
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 212727.8273
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
{
|
||||
"stage": "1.20 A-C",
|
||||
"first": {
|
||||
"passed": 10,
|
||||
"failed": 0
|
||||
},
|
||||
"reviewed": {
|
||||
"evaluations": 12,
|
||||
"workers": 6,
|
||||
"passed": 18,
|
||||
"failed": 0
|
||||
},
|
||||
"finalGuardPaths": {
|
||||
"passed": 3,
|
||||
"failed": 0
|
||||
},
|
||||
"finalOperationLockPaths": {
|
||||
"passed": 2,
|
||||
"failed": 0
|
||||
},
|
||||
"realModelRequests": 0,
|
||||
"files": [
|
||||
{
|
||||
"source": ".qa\\evaluation-a-first.log",
|
||||
"file": "evaluation-a-first.tap",
|
||||
"bytes": 1259,
|
||||
"sha256": "8d5ba79071a3339a5ac2affdcb13a6af88f64fc9c4932c209bca53a0da6b3caf"
|
||||
},
|
||||
{
|
||||
"source": ".qa\\evaluation-abc-reviewed.log",
|
||||
"file": "evaluation-abc-reviewed.tap",
|
||||
"bytes": 2228,
|
||||
"sha256": "15b798551aa6dee8e5b12d73fc070272d1c67b6ffdbc6445d41fcb63d95ec8fa"
|
||||
},
|
||||
{
|
||||
"source": ".qa\\evaluation-abc-final-guards.log",
|
||||
"file": "evaluation-abc-final-guards.tap",
|
||||
"bytes": 504,
|
||||
"sha256": "2db5ee72d4439acb97176bedb14985ffe91cc7ecbc361e32a969b08b39a340f9"
|
||||
},
|
||||
{
|
||||
"source": ".qa\\evaluation-abc-operation-locks.log",
|
||||
"file": "evaluation-abc-operation-locks.tap",
|
||||
"bytes": 405,
|
||||
"sha256": "f689978a90d947c0561dc8f5a891b51b432b547dc206fe302279566957a6c75d"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"stage": "1.20 A-C",
|
||||
"first": {
|
||||
"passed": 10,
|
||||
"failed": 0
|
||||
},
|
||||
"reviewed": {
|
||||
"evaluations": 12,
|
||||
"workers": 6,
|
||||
"passed": 18,
|
||||
"failed": 0
|
||||
},
|
||||
"finalGuardPaths": {
|
||||
"passed": 3,
|
||||
"failed": 0
|
||||
},
|
||||
"finalOperationLockPaths": {
|
||||
"passed": 2,
|
||||
"failed": 0
|
||||
},
|
||||
"realModelRequests": 0,
|
||||
"files": [
|
||||
{
|
||||
"source": ".qa\\evaluation-a-first.log",
|
||||
"file": "evaluation-a-first.tap",
|
||||
"bytes": 1259,
|
||||
"sha256": "8d5ba79071a3339a5ac2affdcb13a6af88f64fc9c4932c209bca53a0da6b3caf"
|
||||
},
|
||||
{
|
||||
"source": ".qa\\evaluation-abc-reviewed.log",
|
||||
"file": "evaluation-abc-reviewed.tap",
|
||||
"bytes": 2228,
|
||||
"sha256": "15b798551aa6dee8e5b12d73fc070272d1c67b6ffdbc6445d41fcb63d95ec8fa"
|
||||
},
|
||||
{
|
||||
"source": ".qa\\evaluation-abc-final-guards.log",
|
||||
"file": "evaluation-abc-final-guards.tap",
|
||||
"bytes": 504,
|
||||
"sha256": "2db5ee72d4439acb97176bedb14985ffe91cc7ecbc361e32a969b08b39a340f9"
|
||||
},
|
||||
{
|
||||
"source": ".qa\\evaluation-abc-operation-locks.log",
|
||||
"file": "evaluation-abc-operation-locks.tap",
|
||||
"bytes": 405,
|
||||
"sha256": "f689978a90d947c0561dc8f5a891b51b432b547dc206fe302279566957a6c75d"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"passed": true,
|
||||
"version": "1.19.0",
|
||||
"evidenceKind": "owned fixed response, actual isolated Git/checks and desktop/390px UI",
|
||||
"realModelRequests": 0,
|
||||
"fixtureRequests": 6,
|
||||
"assertions": [
|
||||
"desktop/390px form rejects candidate test edits, keeps entered requirements, persists fixed model/source/budget and reloads the original plan",
|
||||
"explicit preparation seals two same-source checkouts and actual commands; original real three-test failure is retained with zero model requests",
|
||||
"candidate navigates to its original restricted task for real change review and check approval, runs the original test/build and preserves the parent source",
|
||||
"parallel comparison preserves original failure, candidate pass, real approval/application counts and absent cost; export and refresh retain the original report and fixture label",
|
||||
"adoption forms a fresh parent review batch; completion requires applied source, fresh real parent checks and local Git delivery while owner modifications remain exact",
|
||||
"stop waits for the owned candidate request, preserves stopped outcome and never turns cancellation into a passed sample or a replay",
|
||||
"changed owner source is rejected before workspace creation and the error stays attached to the original batch instead of a generic chat reply"
|
||||
],
|
||||
"screenshots": [
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\desktop-empty.png",
|
||||
"sha256": "a2180342db5c91cca02d41558019c334b83314eba89863005123813d68cce19e"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\mobile-form-scope-error.png",
|
||||
"sha256": "79ff7a3dd7a3e016cbc61ded4e41f7298085fbd0a7256ba0d5d6aa15c403f7ac"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\desktop-ready.png",
|
||||
"sha256": "743a33128dbf82a517bcda9f116b73c6b3ac8f0a800747c06561c60efc275774"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\desktop-candidate-complete.png",
|
||||
"sha256": "536cb42c8840112a2069682624428bcecb6ab79863b2296bf5542f89c86faffd"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\desktop-comparison.png",
|
||||
"sha256": "12089849e6fc1113946abcd24c5208a6413a7d8f60973d4bd6d7466cbe0eac0c"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\mobile-comparison.png",
|
||||
"sha256": "0116a8965610d0e2b6a12e6b7ef9f0b46af530dd31e01ea14f2cd50394f585d0"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\mobile-candidate-evidence.png",
|
||||
"sha256": "594bbd2c3d8171c3f8e0aa8fadd9f2339fdb4bac8cd6827545433ed81aa21433"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\desktop-delivered.png",
|
||||
"sha256": "d67cc3eb5dbaccf3b94dede4f487dd75acf3b071651958362444e9f63107df49"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\mobile-stopped.png",
|
||||
"sha256": "6f69b1a0313d9dc7ab33ce21b4a35e83f89a4157be825fe2f753738e20fb6e22"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\mobile-source-error.png",
|
||||
"sha256": "926f1c3cafb7690828d7cf1001dfa6d28046895b053897675467b937da9b6aad"
|
||||
}
|
||||
],
|
||||
"exports": [
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\downloaded-report.json",
|
||||
"sha256": "fdb56d22b1b5f9778fba08c2ceb0ce57f5d61aed2d19b8ef7f37028c90c895a2"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\report-8a1d20f4-04ef-421e-8939-342e5422abd0.json",
|
||||
"sha256": "fdb56d22b1b5f9778fba08c2ceb0ce57f5d61aed2d19b8ef7f37028c90c895a2"
|
||||
},
|
||||
{
|
||||
"file": "D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\engineering-evals-ui-7203e02f-ee05-41ab-81dd-40b215086863\\report-606d02f2-67b9-443c-bf44-4b36fd764a26.json",
|
||||
"sha256": "ba603f2c9c8fbdb7ad116e4fcedc17762576258f084179c0bee7bb8cf6586c0c"
|
||||
}
|
||||
],
|
||||
"errors": []
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import assert from 'node:assert/strict';
|
||||
import { randomUUID, createHash } from 'node:crypto';
|
||||
import { chromium, expect } from 'playwright/test';
|
||||
import { fixture, call } from '../tests/helpers.mjs';
|
||||
import { workerHttp } from '../tests/fixtures/workers-http.mjs';
|
||||
import { ownerBytes } from '../tests/fixtures/workers-project.mjs';
|
||||
|
||||
if(process.argv.includes('--help')){console.log('node scripts/verify-evaluations-ui.mjs — independent local HTTP host, fixed-response candidate, real Git/test/build, desktop/390px queue, review, comparison, adoption, stop and source errors. No real model inference.');process.exit(0);}
|
||||
assert.equal(process.argv.length,2);
|
||||
const directory=path.resolve('.qa','engineering-evals-ui-'+randomUUID());fs.mkdirSync(directory,{recursive:true});
|
||||
const disposers=[],t={after:fn=>disposers.push(fn)},f=fixture(t),hash=bytes=>createHash('sha256').update(bytes).digest('hex');
|
||||
let hold=false;
|
||||
const host=await workerHttp(f,{broken:true,respond:async({project,signal})=>{
|
||||
if(hold)return new Promise((resolve,reject)=>{if(signal.aborted)reject(signal.reason);else signal.addEventListener('abort',()=>reject(signal.reason),{once:true});});
|
||||
const owner=[...f.store.sessions.values()].find(session=>session.projectId===project.id),taskId=owner.taskId;
|
||||
const plan=[...f.store.core.check_plan.values()].find(plan=>plan.taskId===taskId),job=[...f.store.core.check_job.values()].find(job=>job.taskId===taskId);
|
||||
let calls=[];
|
||||
if(!owner.changes.length)calls=[call(randomUUID(),'propose_file',{path:'src/add.mjs',content:'export const add = (a,b) => a + b;\n',reason:'本地固定响应修复加法'})];
|
||||
else if(owner.changes.some(change=>change.status==='pending'))calls=[];
|
||||
else if(!plan)calls=[call(randomUUID(),'plan_checks',{names:['test','build']})];
|
||||
else if(!job)calls=[call(randomUUID(),'run_checks',{plan_id:plan.id})];
|
||||
return {message:{role:'assistant',content:calls.length?'':'固定响应已返回,仍需实际工程证据',...(calls.length?{tool_calls:calls}:{})},usage:{total_tokens:168,prompt_tokens:123,completion_tokens:45}};
|
||||
}});
|
||||
const browser=await chromium.launch({channel:'msedge',headless:true}),page=await browser.newPage({viewport:{width:1440,height:1000},acceptDownloads:true});
|
||||
const assertions=[],screenshots=[],errors=[],exports=[];page.on('pageerror',error=>errors.push(error.message));
|
||||
const panel=()=>page.getByLabel('工程评测控制台',{exact:true});
|
||||
const mark=value=>{assertions.push(value);console.log('PASS '+value);};
|
||||
const shot=async name=>{const file=path.join(directory,name+'.png');await page.screenshot({path:file,fullPage:true});screenshots.push({file,sha256:hash(fs.readFileSync(file))});assert.ok(await page.locator('body').evaluate(node=>node.scrollWidth<=innerWidth),'body overflow '+name);assert.ok(await panel().evaluate(node=>node.scrollWidth<=node.clientWidth+1),'panel overflow '+name);};
|
||||
const open=async()=>{await page.getByRole('button',{name:'工程评测',exact:true}).click();await expect(panel().getByRole('button',{name:'刷新',exact:true})).toBeEnabled();};
|
||||
const confirm=async(name,button)=>{await panel().getByRole('button',{name,exact:true}).click();await page.getByRole('dialog',{name:'确认评测操作',exact:true}).getByRole('button',{name:button,exact:true}).click();};
|
||||
const refresh=async()=>{await panel().getByRole('button',{name:'刷新',exact:true}).click();};
|
||||
const latest=()=>[...f.store.core.evaluation.values()].at(-1);
|
||||
const parent=async()=>{await page.getByRole('button',{name:'隔离协作',exact:true}).click();await page.getByLabel('隔离协作控制台',{exact:true}).getByRole('button',{name:'返回父目标',exact:true}).click();await expect.poll(()=>page.evaluate(()=>localStorage.getItem('awb-session'))).toBe(f.session.id);await open();};
|
||||
async function fill(title){await panel().getByLabel('评测名称',{exact:true}).fill(title);await panel().getByLabel('评测来源',{exact:true}).selectOption('local-fixture');await panel().getByLabel('样本名称',{exact:true}).fill('正负数和整数加法边界');await panel().getByLabel('具体需求',{exact:true}).fill('修复加法运算,保留原测试及已有调用方式');await panel().getByLabel('验收条件',{exact:true}).fill('原3项加法测试与构建通过,原测试文件和运行声明保持不变');await panel().getByLabel('允许修改的源码文件',{exact:true}).fill('src/add.mjs');}
|
||||
async function apply(prepared=false){if(await page.getByRole('button',{name:'查看改动',exact:true}).isVisible())await page.getByRole('button',{name:'查看改动',exact:true}).click();else await page.locator('.inspector-tabs').getByRole('button',{name:/^改动/}).click();await page.getByRole('button',{name:prepared?'审查变更集':'组合审查',exact:true}).click();if(!prepared)await page.getByRole('dialog',{name:'选择要一起审查的提案',exact:true}).getByRole('button',{name:'封存审查范围',exact:true}).click();const dialog=page.getByRole('dialog',{name:'多文件变更集审查',exact:true});await dialog.getByRole('button',{name:'确认应用全部 1 项',exact:true}).click();await expect(dialog).toContainText('全部应用完成',{timeout:20000});await page.keyboard.press('Escape');}
|
||||
let result;
|
||||
try{
|
||||
await page.addInitScript(({projectId,sessionId})=>{localStorage.setItem('awb-project',projectId);localStorage.setItem('awb-session',sessionId);},{projectId:f.project.id,sessionId:f.session.id});
|
||||
await page.goto(host.url);await page.waitForLoadState('networkidle');await open();await shot('desktop-empty');
|
||||
await expect(panel().getByRole('button',{name:'封存评测计划',exact:true})).toBeDisabled();await fill('固定工程改进 · 中文完整评测');
|
||||
await panel().getByLabel('允许修改的源码文件',{exact:true}).fill('test/add.test.mjs');await panel().getByRole('button',{name:'封存评测计划',exact:true}).click();await expect(panel().getByRole('alert')).toContainText('测试');await expect(panel().getByLabel('具体需求',{exact:true})).toHaveValue('修复加法运算,保留原测试及已有调用方式');
|
||||
await page.setViewportSize({width:390,height:844});await shot('mobile-form-scope-error');await page.setViewportSize({width:1440,height:1000});
|
||||
await panel().getByLabel('允许修改的源码文件',{exact:true}).fill('src/add.mjs');await panel().getByRole('button',{name:'封存评测计划',exact:true}).click();await expect(panel()).toContainText('计划已封存');
|
||||
const batch=latest(),sample=batch.samples[0],original=ownerBytes(f);assert.equal(batch.evidenceMode,'local-fixture');assert.equal(host.requests.length,0);
|
||||
await page.reload();await page.waitForLoadState('networkidle');await open();await expect(panel()).toContainText(batch.title);
|
||||
mark('desktop/390px form rejects candidate test edits, keeps entered requirements, persists fixed model/source/budget and reloads the original plan');
|
||||
await panel().getByRole('button',{name:'准备同源工作区',exact:true}).click();await page.keyboard.press('Escape');assert.equal(f.store.core.worker.size,0);
|
||||
await confirm('准备同源工作区','确认准备');await expect.poll(()=>sample.status,{timeout:30000}).toBe('ready');await expect(panel()).toContainText('node --test test/*.test.mjs');assert.deepEqual(ownerBytes(f),original);await shot('desktop-ready');
|
||||
await confirm('核对并运行原版','确认运行原版');await expect.poll(()=>sample.status,{timeout:30000}).toBe('baseline_complete');assert.equal(host.requests.length,0);assert.equal(f.store.core.check_job.get(sample.baselineJobId).results[0].tests.failed,3);
|
||||
mark('explicit preparation seals two same-source checkouts and actual commands; original real three-test failure is retained with zero model requests');
|
||||
await confirm('开始候选改进','确认开始候选');await expect.poll(()=>sample.status,{timeout:30000}).toBe('awaiting_review');
|
||||
await panel().getByRole('button',{name:'审查候选改动',exact:true}).click();await apply();await parent();
|
||||
await confirm('继续候选任务','确认开始候选');const group=f.store.core.collaboration.get(sample.groupId),child=group.children.find(child=>child.evaluation.role==='candidate');
|
||||
await expect.poll(()=>f.store.session(child.sessionId).status,{timeout:15000}).toBe('awaiting_approval');await expect(panel().getByRole('button',{name:'核对并审批检查',exact:true})).toBeVisible();
|
||||
await panel().getByRole('button',{name:'核对并审批检查',exact:true}).click();await page.locator('.approval-card').getByRole('button',{name:'确认执行',exact:true}).click();await parent();
|
||||
await expect.poll(()=>sample.status,{timeout:30000}).toBe('candidate_complete');assert.deepEqual(ownerBytes(f),original);await shot('desktop-candidate-complete');
|
||||
mark('candidate navigates to its original restricted task for real change review and check approval, runs the original test/build and preserves the parent source');
|
||||
await confirm('封存当前结果','确认封存结果');await expect.poll(()=>batch.status,{timeout:15000}).toBe('completed');await panel().getByRole('button',{name:'查看原版 / 候选对照',exact:true}).click();
|
||||
const report=page.getByRole('dialog',{name:'原版与候选对照',exact:true});await expect(report).toContainText('测试 0/3 · 失败 3');await expect(report).toContainText('测试 3/3 · 失败 0');await expect(report).toContainText('不证明模型自主完成率');await shot('desktop-comparison');
|
||||
const download=page.waitForEvent('download');await report.getByRole('button',{name:'导出原报告',exact:true}).click();const file=path.join(directory,'downloaded-report.json');await (await download).saveAs(file);const downloaded=JSON.parse(fs.readFileSync(file,'utf8'));assert.deepEqual(downloaded.summary,{original:'failed',candidate:'passed'});exports.push({file,sha256:hash(fs.readFileSync(file))});
|
||||
await page.setViewportSize({width:390,height:844});await shot('mobile-comparison');await report.getByText('测试 3/3 · 失败 0',{exact:true}).scrollIntoViewIfNeeded();await expect(report.getByText('测试 3/3 · 失败 0',{exact:true})).toBeVisible();await shot('mobile-candidate-evidence');await page.keyboard.press('Escape');await page.reload();await page.waitForLoadState('networkidle');await open();await panel().getByRole('button',{name:'查看原版 / 候选对照',exact:true}).click();await expect(page.getByRole('dialog',{name:'原版与候选对照',exact:true})).toContainText('测试 0/3 · 失败 3');await page.keyboard.press('Escape');await page.setViewportSize({width:1440,height:1000});
|
||||
mark('parallel comparison preserves original failure, candidate pass, real approval/application counts and absent cost; export and refresh retain the original report and fixture label');
|
||||
await confirm('采纳此候选,准备父工程审查','确认准备采纳');await expect.poll(()=>batch.status,{timeout:30000}).toBe('awaiting_delivery');await panel().getByRole('button',{name:'审查父工程变更集',exact:true}).click();await apply(true);
|
||||
const plan=await host.runtime.checkRunner().plan(f.session,['test','build']);assert.equal((await (await host.runtime.checkRunner().start(f.session,plan.id)).promise).status,'passed');
|
||||
const delivery=await host.runtime.gitDelivery().plan(f.session,{message:'Adopt fixed engineering evaluation candidate'});assert.equal((await (await host.runtime.gitDelivery().start(f.session,delivery.id)).promise).status,'completed');await open();await panel().getByRole('button',{name:'核对父工程检查与 Git',exact:true}).click();await expect.poll(()=>batch.adoption.status).toBe('completed');assert.deepEqual(ownerBytes(f).files,original.files);await shot('desktop-delivered');
|
||||
mark('adoption forms a fresh parent review batch; completion requires applied source, fresh real parent checks and local Git delivery while owner modifications remain exact');
|
||||
hold=true;await panel().getByRole('button',{name:'新建下一批评测',exact:true}).click();await fill('停止中的候选,保留原失败分母');await panel().getByRole('button',{name:'封存评测计划',exact:true}).click();await expect.poll(()=>f.store.core.evaluation.size).toBe(2);await expect(panel()).toContainText('停止中的候选,保留原失败分母');const stopped=latest(),stoppedSample=stopped.samples[0];
|
||||
await confirm('准备同源工作区','确认准备');await expect.poll(()=>stoppedSample.status,{timeout:30000}).toBe('ready');await confirm('核对并运行原版','确认运行原版');await expect.poll(()=>stoppedSample.status,{timeout:30000}).toBe('baseline_complete');const requests=host.requests.length;
|
||||
await confirm('开始候选改进','确认开始候选');await expect.poll(()=>host.requests.length).toBe(requests+1);await panel().getByRole('button',{name:'停止本批执行',exact:true}).click();await expect.poll(()=>host.runtime.hasActivity(),{timeout:10000}).toBe(false);await refresh();assert.notEqual(stoppedSample.status,'candidate_complete');
|
||||
await confirm('封存当前结果','确认封存结果');await expect.poll(()=>!!stoppedSample.report).toBe(true);assert.equal(stoppedSample.report.summary.candidate,'stopped');assert.equal(host.requests.length,requests+1);await page.setViewportSize({width:390,height:844});await shot('mobile-stopped');
|
||||
mark('stop waits for the owned candidate request, preserves stopped outcome and never turns cancellation into a passed sample or a replay');
|
||||
await panel().getByRole('button',{name:'新建下一批评测',exact:true}).click();await fill('来源变化时保持失效原因');await panel().getByRole('button',{name:'封存评测计划',exact:true}).click();await expect.poll(()=>f.store.core.evaluation.size).toBe(3);await expect(panel()).toContainText('来源变化时保持失效原因');const stale=latest();fs.appendFileSync(path.join(f.projectRoot,'README.md'),'\nOwner changed after plan\n');await confirm('准备同源工作区','确认准备');await expect.poll(()=>stale.samples[0].status,{timeout:10000}).toBe('failed');await expect(panel()).toContainText('来源工程已变化');await shot('mobile-source-error');
|
||||
mark('changed owner source is rejected before workspace creation and the error stays attached to the original batch instead of a generic chat reply');
|
||||
for(const batch of f.store.core.evaluation.values())for(const sample of batch.samples){if(sample.report){const file=path.join(directory,'report-'+sample.id+'.json');fs.writeFileSync(file,JSON.stringify(host.runtime.evaluationManager().readReport(f.session,batch,sample),null,2));exports.push({file,sha256:hash(fs.readFileSync(file))});}}
|
||||
assert.deepEqual(errors,[]);result={passed:true,version:JSON.parse(fs.readFileSync('package.json','utf8')).version,evidenceKind:'owned fixed response, actual isolated Git/checks and desktop/390px UI',realModelRequests:0,fixtureRequests:host.requests.length,assertions,screenshots,exports,errors};
|
||||
}catch(error){result={passed:false,error:error.stack,assertions,screenshots,exports,errors};await shot('failure').catch(()=>{});throw error;}
|
||||
finally{await browser.close();await host.runtime.stopAll();f.store.storage.database.exec('PRAGMA wal_checkpoint(TRUNCATE)');fs.cpSync(f.root,path.join(directory,'original-fixture'),{recursive:true});fs.writeFileSync(path.join(directory,'result.json'),JSON.stringify(result,null,2));if(result.passed)fs.writeFileSync('docs/engineering-evals-ui-validation.json',JSON.stringify(result,null,2));for(const dispose of disposers.reverse())await dispose();console.log('EVIDENCE '+directory);}
|
||||
@@ -14,6 +14,7 @@ import { ProjectMemoryPanel } from './ProjectMemoryPanel';
|
||||
import { SkillCenter } from './SkillCenter';
|
||||
import { McpPanel } from './McpPanel';
|
||||
import { WorkerPanel } from './WorkerPanel';
|
||||
import { EvaluationPanel } from './EvaluationPanel';
|
||||
import { DesktopPanel } from './DesktopPanel';
|
||||
import { CompanionPanel } from './CompanionPanel';
|
||||
import { desktop } from './desktop';
|
||||
@@ -82,6 +83,7 @@ export default function App() {
|
||||
const [skillsOpen, setSkillsOpen] = useState(false);
|
||||
const [mcpOpen, setMcpOpen] = useState(false);
|
||||
const [workersOpen, setWorkersOpen] = useState(false);
|
||||
const [evaluationsOpen, setEvaluationsOpen] = useState(false);
|
||||
const [desktopOpen, setDesktopOpen] = useState(false);
|
||||
const [companionOpen, setCompanionOpen] = useState(false);
|
||||
const [pickingProject, setPickingProject] = useState(false);
|
||||
@@ -548,6 +550,7 @@ export default function App() {
|
||||
<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></>}
|
||||
@@ -598,6 +601,7 @@ export default function App() {
|
||||
{skillsOpen && selectedProject && <Modal title="项目技能" description="管理当前项目的技能来源、版本与启用状态。" wide onClose={() => setSkillsOpen(false)}><SkillCenter key={selectedProject.id} projectId={selectedProject.id} busy={isRunning} /></Modal>}
|
||||
{mcpOpen && selectedProject && <Modal title="项目 MCP 工具" description="实际探测本地 stdio 服务,选择可以请求的工具,并核对每次运行原记录。" wide onClose={() => setMcpOpen(false)}><McpPanel key={selectedProject.id + ':' + (session?.id ?? '')} projectId={selectedProject.id} session={session?.projectId === selectedProject.id ? session : null} busy={isRunning} onSession={acceptSession} onError={session ? failureFor(session) : failure} /></Modal>}
|
||||
{workersOpen && session && <Modal title="隔离协作" description="固定父子目标、独立工作区、预算与原成果审查。" wide onClose={() => setWorkersOpen(false)}><WorkerPanel key={session.id} session={session} config={config} busy={isRunning} onSession={acceptSession} onNavigate={async (projectId, sessionId, view) => { setWorkersOpen(false); await navigateWorkspace(projectId, sessionId, () => true, view); }} onReview={() => { setWorkersOpen(false); showInspector('changes'); }} /></Modal>}
|
||||
{evaluationsOpen && session && <Modal title="工程质量评测" description="固定需求与测试,比较原版和候选,审查后交付。" wide onClose={() => setEvaluationsOpen(false)}><EvaluationPanel key={session.id} session={session} config={config} busy={isRunning} onSession={acceptSession} onNavigate={async (projectId, sessionId, view) => { setEvaluationsOpen(false); await navigateWorkspace(projectId, sessionId, () => true, view); }} onReview={() => { setEvaluationsOpen(false); showInspector('changes'); }} onRecovery={() => { setEvaluationsOpen(false); setWorkersOpen(true); }} /></Modal>}
|
||||
{toast && <div className="toast" role="status"><span>{toast}</span><IconButton label="关闭提示" onClick={() => setToast('')}><X size={14} /></IconButton></div>}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
.evaluation-console { --ev-ink:#25344a; --ev-muted:#596a7d; --ev-line:#ccd5df; --ev-wash:#f4f7fa; color:var(--ev-ink);display:grid;gap:22px;min-width:0;overflow-wrap:anywhere; }
|
||||
.evaluation-console h2,.evaluation-console h3,.evaluation-console h4,.evaluation-report h3,.evaluation-report h4 { margin:0; }
|
||||
.evaluation-heading,.evaluation-report-heading { display:flex;align-items:flex-start;justify-content:space-between;gap:18px; }
|
||||
.evaluation-heading h2 {font-size:21px;letter-spacing:-.025em;line-height:1.4;}
|
||||
.evaluation-heading p:not(.evaluation-kicker) {font-size:13px;color:var(--ev-muted);line-height:1.7;margin:7px 0 0;}
|
||||
.evaluation-kicker {font-size:12px;font-weight:650;color:#385e89;margin:0 0 6px;}
|
||||
.evaluation-heading >button {flex-shrink:0;}
|
||||
.evaluation-history {display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:14px;font-size:13px;}
|
||||
.evaluation-console input,.evaluation-console textarea,.evaluation-console select {width:100%;min-width:0;border:1px solid #bbc7d5;border-radius:5px;background:#fff;padding:9px 11px;font:inherit;font-size:13px;color:var(--ev-ink);}
|
||||
.evaluation-console textarea {resize:vertical;line-height:1.65;}
|
||||
.evaluation-console :focus-visible {outline:2px solid #346daa;outline-offset:3px;}
|
||||
.evaluation-console button,.evaluation-report button {min-height:36px;}
|
||||
.evaluation-form {display:grid;gap:18px;}
|
||||
.evaluation-form label {display:grid;gap:7px;font-size:13px;font-weight:600;}
|
||||
.evaluation-form fieldset {min-width:0;display:grid;gap:14px;border:1px solid var(--ev-line);border-left:3px solid #456d99;padding:18px 20px;border-radius:5px;}
|
||||
.evaluation-form legend {font-size:12px;font-weight:650;padding:0 7px;}
|
||||
.evaluation-budget {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;}
|
||||
.evaluation-note {font-size:12px;color:var(--ev-muted,#596a7d);line-height:1.75;margin:0;}
|
||||
.evaluation-error {background:#fff5e9;border:1px solid #d9b992;border-left:3px solid #986024;color:#76501f;padding:12px 15px;font-size:13px;line-height:1.7;}
|
||||
.evaluation-actions {display:flex;flex-wrap:wrap;align-items:center;gap:10px;}
|
||||
.evaluation-source {border-bottom:1px solid var(--ev-line);padding:0 0 20px;}
|
||||
.evaluation-source>div {display:flex;justify-content:space-between;gap:12px;align-items:center;}
|
||||
.evaluation-source>p {font-size:13px;line-height:1.7;}
|
||||
.evaluation-status {font-size:12px;background:#e9eff6;color:#345579;padding:5px 9px;border-radius:4px;flex-shrink:0;}
|
||||
.evaluation-console dl,.evaluation-report dl {display:grid;gap:9px;margin:14px 0;font-size:12px;}
|
||||
.evaluation-console dl>div,.evaluation-report dl>div {display:grid;grid-template-columns:100px minmax(0,1fr);gap:8px;}
|
||||
.evaluation-console dt,.evaluation-report dt {color:#596a7d;}
|
||||
.evaluation-console dd,.evaluation-report dd {margin:0;display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
|
||||
.evaluation-workspace {display:grid;grid-template-columns:190px minmax(0,1fr);gap:24px;align-items:start;}
|
||||
.evaluation-workspace>nav {display:grid;border:1px solid var(--ev-line);border-radius:5px;overflow:hidden;}
|
||||
.evaluation-workspace>nav>button {text-align:left;display:grid;gap:7px;background:#fff;border:0;border-bottom:1px solid var(--ev-line);padding:15px 13px;font:inherit;color:var(--ev-ink);cursor:pointer;}
|
||||
.evaluation-workspace>nav>button:last-child {border-bottom:0;}
|
||||
.evaluation-workspace>nav>button[aria-pressed=true] {background:#eaf0f7;box-shadow:inset 3px 0 #396b9e;}
|
||||
.evaluation-workspace>nav small {font-size:11px;color:var(--ev-muted);}
|
||||
.evaluation-workspace>nav strong {font-size:13px;line-height:1.5;}
|
||||
.evaluation-workspace>nav span {font-size:11px;color:var(--ev-muted);line-height:1.6;}
|
||||
.evaluation-sample {min-width:0;display:grid;gap:17px;}
|
||||
.evaluation-sample>h3 {font-size:18px;line-height:1.5;}
|
||||
.evaluation-goal {font-size:14px;line-height:1.8;white-space:pre-wrap;margin:0;}
|
||||
.evaluation-criteria {border-left:2px solid #7f94ae;padding-left:12px;font-size:13px;line-height:1.7;}
|
||||
.evaluation-criteria p {margin:5px 0 0;white-space:pre-wrap;}
|
||||
.evaluation-paths {display:flex;gap:7px;flex-wrap:wrap;font-size:12px;}
|
||||
.evaluation-paths code {background:var(--ev-wash);padding:4px 6px;}
|
||||
.evaluation-commands {border-top:1px solid var(--ev-line);border-bottom:1px solid var(--ev-line);padding:13px 0;font-size:12px;}
|
||||
.evaluation-commands summary {cursor:pointer;font-weight:650;line-height:1.7;}
|
||||
.evaluation-commands>div {margin-top:13px;}
|
||||
.evaluation-console pre,.evaluation-report pre {white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;line-height:1.7;background:#f1f4f8;color:#304056;padding:12px;border-radius:4px;max-height:360px;overflow:auto;}
|
||||
.evaluation-lanes {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;border:1px solid #ccd5df;border-radius:5px;overflow:hidden;}
|
||||
.evaluation-lanes>section {min-width:0;padding:16px;background:#fff;}
|
||||
.evaluation-lanes>section+section {border-left:1px solid #ccd5df;background:#f5f8fc;}
|
||||
.evaluation-lanes>section>p {font-size:12px;line-height:1.75;color:#596a7d;}
|
||||
.evaluation-lane-title {display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between;}
|
||||
.evaluation-lane-title h4 {font-size:14px;}
|
||||
.evaluation-lane-title>span {font-size:11px;color:#596a7d;}
|
||||
.evaluation-delivery {padding:18px;border:1px solid var(--ev-line);border-left:3px solid #3d6e96;background:#f5f8fc;font-size:13px;line-height:1.8;}
|
||||
.evaluation-delivery h3 {font-size:14px;}
|
||||
.evaluation-confirm {display:grid;gap:18px;font-size:14px;line-height:1.8;padding:22px;}
|
||||
.evaluation-report {display:grid;gap:22px;min-width:0;padding:24px;color:#25344a;overflow-wrap:anywhere;}
|
||||
.evaluation-report-heading h3 {font-size:18px;}
|
||||
.evaluation-report-heading p {font-size:13px;line-height:1.7;}
|
||||
.evaluation-outcome {font-size:12px;color:#73551c;}
|
||||
.evaluation-outcome.passed {color:#216245;}
|
||||
.evaluation-outcome.failed {color:#a33e39;}
|
||||
.evaluation-attempt {border-top:1px solid #ccd5df;padding:13px 0 0;margin-top:13px;font-size:12px;line-height:1.7;}
|
||||
.evaluation-attempt>div {display:grid;gap:4px;margin-top:10px;}
|
||||
.evaluation-attempt code {font-size:11px;color:#596a7d;}
|
||||
.evaluation-report summary {font-size:12px;cursor:pointer;}
|
||||
@media(max-width:760px) { .evaluation-workspace {grid-template-columns:minmax(0,1fr);gap:18px;}.evaluation-workspace>nav {grid-template-columns:repeat(3,minmax(0,1fr));}.evaluation-workspace>nav>button {padding:12px 10px;border-bottom:0;border-right:1px solid var(--ev-line);}.evaluation-budget{grid-template-columns:repeat(2,minmax(0,1fr));} }
|
||||
@media(max-width:520px) { .evaluation-heading h2{font-size:18px;}.evaluation-heading{gap:10px;}.evaluation-history{grid-template-columns:minmax(0,1fr);gap:8px;}.evaluation-workspace>nav{grid-template-columns:minmax(0,1fr);}.evaluation-workspace>nav>button{border-right:0;border-bottom:1px solid var(--ev-line);}.evaluation-source>div{align-items:flex-start;flex-direction:column;}.evaluation-lanes{grid-template-columns:minmax(0,1fr);}.evaluation-lanes>section+section{border-left:0;border-top:1px solid #ccd5df;}.evaluation-report{padding:16px;}.evaluation-report-heading{flex-direction:column;}.evaluation-console button,.evaluation-report button{min-height:42px;}.evaluation-form fieldset{padding:15px;}.evaluation-console dl>div,.evaluation-report dl>div{grid-template-columns:88px minmax(0,1fr);} }
|
||||
@@ -0,0 +1,98 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { ArrowUpRight, ClipboardCheck, Download, GitBranch, LoaderCircle, Plus, RefreshCw, Square } from 'lucide-react';
|
||||
import { api, downloadBlob } from './api';
|
||||
import { Modal } from './components';
|
||||
import type { Config, Session, EvaluationBatch, EvaluationSample, EvaluationReport, EvaluationRole } from './types';
|
||||
import './EvaluationPanel.css';
|
||||
|
||||
const live = ['preparing','baseline_running','candidate_running','collecting','adopting'];
|
||||
const labels: Record<string,string> = {pending:'未执行',planned:'计划已封存',ready:'同源工作区就绪',preparing:'准备同源工程',baseline_running:'原版检查中',baseline_complete:'原版结果已保存',candidate_running:'候选执行中',awaiting_review:'等待改动审查',awaiting_approval:'等待检查审批',candidate_complete:'候选完成',paused:'候选已暂停',failed:'失败',stopped:'已停止',unknown:'结果待核对',sealed:'报告已封存',between_samples:'等待下一样本',completed:'本批已封存',retained:'已保留现场结束',collecting:'核对原证据',adopting:'准备采纳',awaiting_delivery:'等待父工程交付',passed:'通过'};
|
||||
const label = (status:string) => labels[status] ?? status;
|
||||
const split = (value:string) => value.split(/[\n,,]/).map(value=>value.trim()).filter(Boolean);
|
||||
const draft = () => ({label:'',goal:'',criteria:'',paths:'',checks:'test, build'});
|
||||
const number = (value:number) => value.toLocaleString('zh-CN');
|
||||
const elapsed = (role:EvaluationRole) => role.startedAt && role.finishedAt ? Math.max(0,Math.round((Date.parse(role.finishedAt)-Date.parse(role.startedAt))/1000))+' 秒' : '未记录完整起止';
|
||||
|
||||
export function EvaluationPanel({session,config,busy,onSession,onNavigate,onReview,onRecovery}: {
|
||||
session:Session;config:Config;busy:boolean;onSession:(session:Session)=>void;
|
||||
onNavigate:(projectId:string,sessionId:string,view?:'task'|'changes'|'approval')=>Promise<void>;onReview:()=>void;onRecovery:()=>void;
|
||||
}) {
|
||||
const [batches,setBatches]=useState<EvaluationBatch[]>([]),[selected,setSelected]=useState(''),[sampleId,setSampleId]=useState('');
|
||||
const [loading,setLoading]=useState(true),[action,setAction]=useState(''),[error,setError]=useState(''),[creating,setCreating]=useState(false);
|
||||
const [title,setTitle]=useState(''),[samples,setSamples]=useState([draft()]);
|
||||
const [evidenceMode,setEvidenceMode]=useState('configured-model');
|
||||
const [tokens,setTokens]=useState(config.maxRunTokens),[steps,setSteps]=useState(Math.min(200,config.maxSteps*2)),[tools,setTools]=useState(96),[minutes,setMinutes]=useState(Math.floor(config.maxRunDurationMs/60000));
|
||||
const [confirmation,setConfirmation]=useState<{batchId:string;sampleId:string;operation:string}|null>(null),[report,setReport]=useState<EvaluationReport|null>(null);
|
||||
const scope=useRef(0),fetching=useRef(false),currentBatch=useRef(''),currentSample=useRef('');
|
||||
const load=useCallback(async()=>{
|
||||
if(fetching.current)return;fetching.current=true;const generation=scope.current;
|
||||
try{const view=await api<{batches:EvaluationBatch[]}>('/sessions/'+session.id+'/evaluations');if(generation===scope.current)setBatches(view.batches);}
|
||||
catch(error){if(generation===scope.current)setError(error instanceof Error?error.message:String(error));}
|
||||
finally{if(generation===scope.current){fetching.current=false;setLoading(false);}}
|
||||
},[session.id]);
|
||||
useEffect(()=>{scope.current++;fetching.current=false;setBatches([]);setSelected('');setSampleId('');setReport(null);void load();return()=>{scope.current++;};},[load]);
|
||||
useEffect(()=>{void load();},[session.revision,load]);
|
||||
const batch=batches.find(batch=>batch.id===selected)??batches.at(-1),sample=batch?.samples.find(sample=>sample.id===sampleId)??batch?.samples.find(sample=>!sample.report)??batch?.samples.at(-1);
|
||||
currentBatch.current=batch?.id??'';
|
||||
currentSample.current=sample?.id??'';
|
||||
const running=!!batch&&live.includes(batch.status);
|
||||
useEffect(()=>{if(!running)return;const timer=setInterval(()=>void load(),1200);return()=>clearInterval(timer);},[running,load]);
|
||||
useEffect(()=>{setConfirmation(null);setReport(null);setError('');},[session.id,batch?.id,sample?.id]);
|
||||
async function execute(operation:string,target=batch,item=sample){
|
||||
if(!target||currentBatch.current!==target.id)return;const generation=scope.current;setAction(operation);setError('');setConfirmation(null);
|
||||
try{const reply=await api<{session:Session}>('/sessions/'+session.id+'/evaluations/'+target.id+'/'+operation,{fingerprint:target.fingerprint,...(item?{sampleId:item.id}:{})});if(generation===scope.current){onSession(reply.session);await load();}}
|
||||
catch(error){if(generation===scope.current)setError(error instanceof Error?error.message:String(error));}
|
||||
finally{if(generation===scope.current)setAction('');}
|
||||
}
|
||||
async function create(){const generation=scope.current;setAction('create');setError('');
|
||||
try{const reply=await api<{batch:EvaluationBatch;session:Session}>('/sessions/'+session.id+'/evaluations',{title,samples:samples.map(sample=>({...sample,paths:split(sample.paths),checks:split(sample.checks)})),budget:{maxTokens:tokens,maxSteps:steps,maxToolCalls:tools,maxDurationMs:minutes*60000},evidenceMode});if(generation===scope.current){onSession(reply.session);setSelected(reply.batch.id);setCreating(false);await load();}}
|
||||
catch(error){if(generation===scope.current)setError(error instanceof Error?error.message:String(error));}
|
||||
finally{if(generation===scope.current)setAction('');}
|
||||
}
|
||||
async function showReport(){if(!batch||!sample)return;const generation=scope.current,target=batch.id,id=sample.id;setAction('report');setError('');
|
||||
try{const result=await api<EvaluationReport>('/sessions/'+session.id+'/evaluations/'+batch.id+'/report?sampleId='+sample.id);if(generation===scope.current&¤tBatch.current===target&¤tSample.current===id)setReport(result);}
|
||||
catch(error){if(generation===scope.current)setError(error instanceof Error?error.message:String(error));}finally{if(generation===scope.current)setAction('');}
|
||||
}
|
||||
const confirm=(operation:string)=>{if(batch&&sample)setConfirmation({batchId:batch.id,sampleId:sample.id,operation});};
|
||||
const canCreate=!busy&&!action&&(!batch||['completed','retained'].includes(batch.status));
|
||||
return <div className="evaluation-console" aria-label="工程评测控制台">
|
||||
<header className="evaluation-heading"><div><p className="evaluation-kicker">工程质量 · 固定样本</p><h2>同一份需求,核对改进前后</h2><p>封存来源与原测试,在隔离工程里生成候选,再把真实结果带回审查。</p></div><button className="button secondary" disabled={loading||!!action} onClick={()=>void load()}><RefreshCw size={14}/>刷新</button></header>
|
||||
{error&&<div className="evaluation-error" role="alert">{error}</div>}
|
||||
{loading?<p role="status"><LoaderCircle size={15} className="spin"/>正在读取评测…</p>:<>
|
||||
{!!batches.length&&<label className="evaluation-history">评测记录<select aria-label="选择评测记录" value={batch?.id??''} onChange={event=>{setSelected(event.target.value);setSampleId('');setCreating(false);}}>{batches.map(batch=><option key={batch.id} value={batch.id}>{batch.title} · {label(batch.status)}</option>)}</select></label>}
|
||||
{(!batch||creating)?<section className="evaluation-form" aria-label="新建工程评测">
|
||||
<label>评测名称<input value={title} maxLength={120} onChange={event=>setTitle(event.target.value)} placeholder="例如 修复导入边界并保持原测试"/></label>
|
||||
<label>评测来源<select aria-label="评测来源" value={evidenceMode} onChange={event=>setEvidenceMode(event.target.value)}><option value="configured-model">实际配置模型 · 保留真实结果</option><option value="local-fixture">本地固定响应 · 只验证执行链</option></select></label>
|
||||
<p className="evaluation-note">每批 1–3 个样本,按队列显式推进。每个样本都从当前已提交 HEAD 检出;原暂存和未提交内容留在来源工程。</p>
|
||||
{samples.map((sample,index)=><fieldset key={index}><legend>固定样本 {index+1}</legend>{(['label','goal','criteria','paths','checks'] as const).map(key=><label key={key}>{({label:'样本名称',goal:'具体需求',criteria:'验收条件',paths:'允许修改的源码文件',checks:'完整检查名称'})[key]}{key==='label'?<input value={sample[key]} maxLength={64} onChange={event=>setSamples(values=>values.map((value,i)=>i===index?{...value,[key]:event.target.value}:value))}/>:<textarea aria-label={({label:'样本名称',goal:'具体需求',criteria:'验收条件',paths:'允许修改的源码文件',checks:'完整检查名称'})[key]} rows={key==='goal'||key==='criteria'?3:2} maxLength={key==='goal'?6000:4000} value={sample[key]} placeholder={key==='paths'?'例如 src/parser.mjs,每行一个已有文件':key==='checks'?'test, typecheck, build;Python 使用 python:test, python:compile':undefined} onChange={event=>setSamples(values=>values.map((value,i)=>i===index?{...value,[key]:event.target.value}:value))}/>}</label>)}{samples.length>1&&<button className="text-button" onClick={()=>setSamples(values=>values.filter((_,i)=>i!==index))}>移除此未保存样本</button>}</fieldset>)}
|
||||
{samples.length<3&&<button className="button secondary" onClick={()=>setSamples(values=>[...values,draft()])}><Plus size={14}/>添加固定样本</button>}
|
||||
<div className="evaluation-budget"><label>总 token 预算<input type="number" min={samples.length*2000} max={Math.min(config.maxTaskTokens,config.maxRunTokens*samples.length)} value={tokens} onChange={event=>setTokens(Number(event.target.value))}/></label><label>总请求轮次<input type="number" min={samples.length*2} max={200} value={steps} onChange={event=>setSteps(Number(event.target.value))}/></label><label>总工具次数<input type="number" min={samples.length*2} max={512} value={tools} onChange={event=>setTools(Number(event.target.value))}/></label><label>总时限(分钟)<input type="number" min={1} max={Math.floor(config.maxRunDurationMs/60000)} value={minutes} onChange={event=>setMinutes(Number(event.target.value))}/></label></div>
|
||||
<p className="evaluation-note">预算按样本均分,续接保留累计用量。总时限从首次原版检查开始,包含审查等待。候选不修改测试、脚本或运行配置。</p>
|
||||
<div className="evaluation-actions"><button className="button" disabled={!canCreate||!title.trim()||samples.some(sample=>!sample.label.trim()||!sample.goal.trim()||!sample.criteria.trim()||!split(sample.paths).length||!split(sample.checks).length)} onClick={()=>void create()}><ClipboardCheck size={15}/>封存评测计划</button>{creating&&<button className="button secondary" onClick={()=>setCreating(false)}>返回原评测</button>}</div>
|
||||
</section>:sample&&<>
|
||||
<section className="evaluation-source"><div><strong>{batch.title}</strong><span className="evaluation-status">{label(batch.status)}</span></div><p>{batch.message}</p><dl><div><dt>固定来源</dt><dd><GitBranch size={13}/>{batch.source.branch} · <code>{batch.source.head.slice(0,12)}</code></dd></div><div><dt>候选模型</dt><dd>{batch.model.mode==='demo'?'离线演示,不能验证模型能力':batch.model.model}</dd></div><div><dt>完整样本分母</dt><dd>{batch.summary.finished} / {batch.summary.samples} 已封存 · 通过 {batch.summary.candidate.passed} · 失败 {batch.summary.candidate.failed} · 未知 {batch.summary.candidate.unknown} · 未执行 {batch.summary.candidate.pending}</dd></div></dl><p className="evaluation-note">{batch.evidenceMode==='local-fixture'?'本批使用本地固定响应,仅验证执行链和真实检查。':batch.summary.scope}</p></section>
|
||||
<div className="evaluation-workspace"><nav aria-label="固定样本队列">{batch.samples.map((item,index)=><button key={item.id} aria-pressed={sample.id===item.id} onClick={()=>{setSampleId(item.id);setReport(null);}}><small>样本 {index+1}</small><strong>{item.label}</strong><span>{label(item.status)}</span>{item.report&&<span>原版 {label(item.report.summary.original)} → 候选 {label(item.report.summary.candidate)}</span>}</button>)}</nav>
|
||||
<article className="evaluation-sample"><h3>{sample.label}</h3><p className="evaluation-goal">{sample.goal}</p><div className="evaluation-criteria"><strong>验收条件</strong><p>{sample.criteria}</p></div><div className="evaluation-paths">{sample.paths.map(path=><code key={path}>{path}</code>)}</div>
|
||||
{sample.error&&<p className="evaluation-error">{sample.error}</p>}
|
||||
<details className="evaluation-commands" open={sample.status==='ready'}><summary>固定检查 · {sample.checks.join(' / ')}</summary>{sample.commands?.map(command=><div key={command.name}><strong>{command.command}</strong><pre>{command.script}</pre>{command.lifecycle?.map(step=><p key={step.name}>{step.name}:<code>{step.script}</code></p>)}</div>)??<p>工作区准备完成后显示实际命令,执行前需要核对。</p>}</details>
|
||||
{!!sample.workers?.length&&<div className="evaluation-lanes">{sample.workers.map(worker=><section key={worker.id} aria-label={worker.evaluation?.role==='original'?'原版工程':'候选工程'}><div className="evaluation-lane-title"><h4>{worker.evaluation?.role==='original'?'原版':'候选'}</h4><span>{worker.evaluation?.role==='original'?'只跑固定检查':label(worker.sessionStatus==='awaiting_approval'?'awaiting_approval':worker.status)}</span></div><p>{worker.summary}</p>{worker.status!=='unprepared'&&<button className="button secondary" onClick={()=>void onNavigate(worker.projectId,worker.sessionId,worker.sessionStatus==='awaiting_approval'?'approval':worker.sessionStatus==='needs_review'?'changes':'task')}>{worker.sessionStatus==='awaiting_approval'?'核对并审批检查':worker.sessionStatus==='needs_review'?'审查候选改动':'打开原任务'}<ArrowUpRight size={13}/></button>}</section>)}</div>}
|
||||
{sample.contractSha256&&<p className="evaluation-note">同源输入已封存 · SHA-256 <code>{sample.contractSha256.slice(0,16)}</code></p>}
|
||||
<div className="evaluation-actions">
|
||||
{sample.status==='pending'&&<button className="button" disabled={!!action||running||busy||batch.samples.slice(0,batch.samples.indexOf(sample)).some(sample=>!sample.report)} onClick={()=>confirm('prepare')}>准备同源工作区</button>}
|
||||
{sample.status==='ready'&&<button className="button" disabled={!!action||running} onClick={()=>confirm('baseline')}>核对并运行原版</button>}
|
||||
{['baseline_complete','paused','awaiting_review','failed','stopped'].includes(sample.status)&&!!sample.baselineJobId&&!sample.report&&<button className="button" disabled={!!action||running||config.mode==='demo'||sample.workers?.some(worker=>worker.evaluation?.role==='candidate'&&worker.sessionStatus==='needs_review')} onClick={()=>confirm('start')}>{sample.status==='baseline_complete'?'开始候选改进':'继续候选任务'}</button>}
|
||||
{running&&<button className="button secondary" disabled={action==='stop'} onClick={()=>void execute('stop')}><Square size={14}/>停止本批执行</button>}
|
||||
{!running&&!sample.report&&sample.status!=='pending'&&<button className="button secondary" disabled={!!action} onClick={()=>confirm('seal')}>封存当前结果</button>}
|
||||
{sample.report&&<button className="button secondary" disabled={!!action} onClick={()=>void showReport()}>查看原版 / 候选对照</button>}
|
||||
{sample.report?.summary.candidate==='passed'&&!batch.adoption&&batch.samples.every(sample=>sample.report)&&<button className="button" disabled={!!action||running||batch.status==='retained'} onClick={()=>confirm('adopt')}>采纳此候选,准备父工程审查</button>}
|
||||
{batch.status==='unknown'&&<button className="button secondary" onClick={onRecovery}>打开原协作核对现场</button>}
|
||||
</div>
|
||||
</article></div>
|
||||
{batch.adoption&&<section className="evaluation-delivery"><h3>父工程交付</h3><p>{batch.adoption.delivery?'已完成本地提交 '+batch.adoption.delivery.commit:batch.message}</p>{batch.status==='awaiting_delivery'&&<div className="evaluation-actions"><button className="button secondary" onClick={onReview}>审查父工程变更集</button><button className="button secondary" disabled={!!action||busy} onClick={()=>void execute('finalize')}>核对父工程检查与 Git</button></div>}</section>}
|
||||
<footer className="evaluation-actions">{!running&&!['completed','retained'].includes(batch.status)&&<button className="text-button" disabled={!!action} onClick={()=>confirm('retain')}>保留现场,结束本批</button>}{canCreate&&<button className="button secondary" onClick={()=>setCreating(true)}><Plus size={14}/>新建下一批评测</button>}</footer>
|
||||
</>}
|
||||
</>}
|
||||
{confirmation&&batch&&sample&&<Modal title="确认评测操作" onClose={()=>setConfirmation(null)}><div className="evaluation-confirm"><h3>{sample.label}</h3><p>{({prepare:'从封存 HEAD 创建两个独立 Git 工作区,保留来源原修改。',baseline:'请核对上方完整检查命令。将以本机账户执行原工程程序,不请求模型。',start:'将请求封存模型并使用剩余预算。候选提案仍需审查,工程检查仍需审批。',seal:'保存当前全部尝试、失败、停止与未知。封存后该样本不能再执行或修改。',adopt:'核对原通过报告及当前来源后,生成父工程待审查变更集。应用、父检查和 Git 交付仍需确认。',retain:'保留原任务、工作区和全部结果,结束本批;未执行样本仍计入原分母。'} as Record<string,string>)[confirmation.operation]}</p><button className="button" disabled={!!action} onClick={()=>{if(confirmation.batchId===batch.id&&confirmation.sampleId===sample.id)void execute(confirmation.operation);}}>确认{({prepare:'准备',baseline:'运行原版',start:'开始候选',seal:'封存结果',adopt:'准备采纳',retain:'保留现场结束'} as Record<string,string>)[confirmation.operation]}</button></div></Modal>}
|
||||
{report&&sample&&<Modal title="原版与候选对照" wide onClose={()=>setReport(null)}><div className="evaluation-report"><div className="evaluation-report-heading"><div><h3>{report.label}</h3>{report.evidenceMode==='local-fixture'&&<p className="evaluation-note">本地固定响应 · 执行链验收</p>}<p>{report.inputVerified?'原测试与非候选输入已核对':report.inputError??'原输入无法核对'}</p></div><button className="button secondary" onClick={()=>downloadBlob(new Blob([JSON.stringify(report,null,2)],{type:'application/json'}),'agent-workbench-evaluation-'+report.sampleId+'.json')}><Download size={14}/>导出原报告</button></div><div className="evaluation-lanes">{(['original','candidate'] as const).map(role=>{const result=report[role];return <section key={role}><div className="evaluation-lane-title"><h4>{role==='original'?'原版':'候选'}</h4><strong className={'evaluation-outcome '+result.outcome}>{label(result.outcome)}</strong></div><p>{result.reason??result.evidenceError}</p><dl><div><dt>用时</dt><dd>{elapsed(result)}</dd></div><div><dt>模型请求</dt><dd>{result.usage?.requests??'未知'}</dd></div><div><dt>上游用量</dt><dd>{result.usage?.reported?number(result.usage.totalTokens)+' tokens':'未知;保留预算估算'}</dd></div><div><dt>费用</dt><dd>未报告</dd></div><div><dt>实际人工操作</dt><dd>审批 {result.approvals?.filter(approval=>approval.status==='approved').length??0} 次 · 应用提案 {result.changes?.filter(change=>change.status==='applied').length??0} 项</dd></div></dl>{result.attempts.length?result.attempts.map((attempt,index)=><div className="evaluation-attempt" key={attempt.id}><strong>检查尝试 {index+1} · {label(attempt.status)}</strong>{attempt.results.map(check=><div key={check.logArtifactId}><span>{check.name} · {check.status?label(check.status):'证据缺失'}</span>{check.tests&&<span>测试 {check.tests.passed}/{check.tests.total} · 失败 {check.tests.failed}</span>}<code>{check.logSha256?.slice(0,16)??'原日志无法核对'}</code></div>)}</div>):<p>没有完整检查结果;保持未知。</p>}</section>;})}</div><p className="evaluation-note">{report.note}</p><details><summary>报告原字段与工件引用</summary><pre>{JSON.stringify(report,null,2)}</pre></details></div></Modal>}
|
||||
</div>;
|
||||
}
|
||||
@@ -104,16 +104,16 @@ export function WorkerPanel({ session, config, busy, onSession, onNavigate, onRe
|
||||
</div>}
|
||||
{group && !creating && <>
|
||||
{group.children[0]?.engine?.strategy && <p className="worker-engine-badge">本计划的 Purge 提示实验 · {group.children[0].engine.strategy.source.version} · {group.children[0].engine.strategy.sha256.slice(0, 16)}</p>}
|
||||
<section className="worker-parent"><div className="worker-parent-top"><span className={'worker-status ' + (group.requiresVerification || group.status === 'conflict' ? 'attention' : '')}>{statusLabel(group.status)}</span><code>{group.source.identity.branch} · {group.source.identity.head.slice(0, 12)}</code></div><h3>{group.goal}</h3><p>{group.summary}</p><dl><div><dt>模型</dt><dd>{group.model.mode === 'demo' ? '离线演示' : group.model.model}</dd></div><div><dt>执行方式</dt><dd>{group.children[0].engine ? "DeepSeek Harness " + group.children[0].engine.version : "工作台受限子任务"}</dd></div><div><dt>总预算</dt><dd>{number(group.budget.maxTokens)} tokens / {group.budget.maxSteps} 轮 / {group.budget.maxToolCalls} 次工具</dd></div><div><dt>累计用量</dt><dd>{number(group.usage?.accountedTokens)} tokens / {group.usage?.steps ?? 0} 轮 / {group.usage?.toolCalls ?? 0} 次工具 / {group.usage?.requests ?? 0} 次模型请求</dd></div><div><dt>原修改</dt><dd>{group.source.changedPaths.length ? group.source.changedPaths.map(value => value.path).join('、') : '无未提交修改'}</dd></div></dl></section>
|
||||
<div className={"worker-lanes" + (group.children.length === 1 ? " single" : "")}>{(group.workers ?? []).map((child, index) => <section className="worker-lane" key={child.id}><div className="worker-lane-title"><span>通道 {index + 1}</span><span className={'worker-status ' + (child.requiresVerification ? 'attention' : '')}>{statusLabel(child.sessionStatus === 'awaiting_approval' ? 'awaiting_approval' : child.status)}</span></div><h3>{child.label}</h3>{child.engine && <p className="worker-engine-badge">DeepSeek Harness {child.engine.version} · 固定安装 {child.engine.controlledSha256?.slice(0, 12)}</p>}<p className="worker-goal">{child.goal}</p><div className="worker-scope"><span>允许修改</span>{child.paths.map(path => <code key={path}>{path}</code>)}</div><p className="worker-meter">{number(child.usage?.accountedTokens)} / {number(child.budget.maxTokens)} tokens · {child.usage?.steps ?? 0}/{child.budget.maxSteps} 轮</p><p className="worker-summary">{child.summary ?? '先创建独立工作区,再开始子任务。'}</p>{child.result && <div className="worker-proof"><Check size={14} />{child.result.paths.length} 个原改动 · 当前检查已封存</div>}<div className="worker-actions">{child.status !== 'unprepared' && <button className="button secondary" onClick={() => void onNavigate(child.projectId, child.sessionId, child.sessionStatus === "awaiting_approval" ? "approval" : child.sessionStatus === "needs_review" ? "changes" : "task")}>{child.sessionStatus === 'awaiting_approval' ? '查看并审批检查' : child.sessionStatus === 'needs_review' ? '审查子任务改动' : '打开子任务'}<ArrowUpRight size={13} /></button>}{['ready', 'paused', 'failed', 'awaiting_review'].includes(child.status) && !running && child.sessionStatus !== 'needs_review' && <button className="text-button" disabled={!!action || config.mode === 'demo' || group.requiresVerification} onClick={() => setConfirmation({ group, operation: 'start', workerId: child.id })}><Play size={13} />继续子任务</button>}</div></section>)}</div>
|
||||
{group.evaluation && <p className="worker-note">本协作属于固定工程评测。执行与采纳请使用「工程评测」;这里保留原任务导航和中断现场核对。</p>}<section className="worker-parent"><div className="worker-parent-top"><span className={'worker-status ' + (group.requiresVerification || group.status === 'conflict' ? 'attention' : '')}>{statusLabel(group.status)}</span><code>{group.source.identity.branch} · {group.source.identity.head.slice(0, 12)}</code></div><h3>{group.goal}</h3><p>{group.summary}</p><dl><div><dt>模型</dt><dd>{group.model.mode === 'demo' ? '离线演示' : group.model.model}</dd></div><div><dt>执行方式</dt><dd>{group.children[0].engine ? "DeepSeek Harness " + group.children[0].engine.version : "工作台受限子任务"}</dd></div><div><dt>总预算</dt><dd>{number(group.budget.maxTokens)} tokens / {group.budget.maxSteps} 轮 / {group.budget.maxToolCalls} 次工具</dd></div><div><dt>累计用量</dt><dd>{number(group.usage?.accountedTokens)} tokens / {group.usage?.steps ?? 0} 轮 / {group.usage?.toolCalls ?? 0} 次工具 / {group.usage?.requests ?? 0} 次模型请求</dd></div><div><dt>原修改</dt><dd>{group.source.changedPaths.length ? group.source.changedPaths.map(value => value.path).join('、') : '无未提交修改'}</dd></div></dl></section>
|
||||
<div className={"worker-lanes" + (group.children.length === 1 ? " single" : "")}>{(group.workers ?? []).map((child, index) => <section className="worker-lane" key={child.id}><div className="worker-lane-title"><span>通道 {index + 1}</span><span className={'worker-status ' + (child.requiresVerification ? 'attention' : '')}>{statusLabel(child.sessionStatus === 'awaiting_approval' ? 'awaiting_approval' : child.status)}</span></div><h3>{child.label}</h3>{child.engine && <p className="worker-engine-badge">DeepSeek Harness {child.engine.version} · 固定安装 {child.engine.controlledSha256?.slice(0, 12)}</p>}<p className="worker-goal">{child.goal}</p><div className="worker-scope"><span>允许修改</span>{child.paths.map(path => <code key={path}>{path}</code>)}</div><p className="worker-meter">{number(child.usage?.accountedTokens)} / {number(child.budget.maxTokens)} tokens · {child.usage?.steps ?? 0}/{child.budget.maxSteps} 轮</p><p className="worker-summary">{child.summary ?? '先创建独立工作区,再开始子任务。'}</p>{child.result && <div className="worker-proof"><Check size={14} />{child.result.paths.length} 个原改动 · 当前检查已封存</div>}<div className="worker-actions">{child.status !== 'unprepared' && <button className="button secondary" onClick={() => void onNavigate(child.projectId, child.sessionId, child.sessionStatus === "awaiting_approval" ? "approval" : child.sessionStatus === "needs_review" ? "changes" : "task")}>{child.sessionStatus === 'awaiting_approval' ? '查看并审批检查' : child.sessionStatus === 'needs_review' ? '审查子任务改动' : '打开子任务'}<ArrowUpRight size={13} /></button>}{!group.evaluation && ['ready', 'paused', 'failed', 'awaiting_review'].includes(child.status) && !running && child.sessionStatus !== 'needs_review' && <button className="text-button" disabled={!!action || config.mode === 'demo' || group.requiresVerification} onClick={() => setConfirmation({ group, operation: 'start', workerId: child.id })}><Play size={13} />继续子任务</button>}</div></section>)}</div>
|
||||
<section className="worker-review"><div className="worker-review-title"><GitBranch size={18} /><h3>父工程成果审查</h3></div>{group.collection ? <><p>{group.collection.paths.length} 个路径已核对,原记录 <code>{group.collection.sha256.slice(0, 16)}</code></p>{group.collection.conflicts.length > 0 && <ul className="worker-conflicts">{group.collection.conflicts.map((conflict, i) => <li key={i}><code>{conflict.path}</code><span>{conflict.reason}</span></li>)}</ul>}<button className="text-button" disabled={!!action} onClick={() => void showRecord(group, 'collection')}>查看原成果记录</button></> : <p>等待 {group.children.length} 个子任务完成实际修改与检查。重叠路径、来源变化或原证据失效会阻止合并。</p>}{group.merge?.changeSetId && <button className="button secondary" onClick={onReview}>打开父工程变更集审查<ArrowUpRight size={14} /></button>}</section>
|
||||
<div className="worker-actions worker-primary-actions">
|
||||
{['planned', 'partially_prepared'].includes(group.status) && <button className="button" disabled={!!action || busy} onClick={() => setConfirmation({ group, operation: 'prepare' })}><GitBranch size={15} />{group.children.length === 2 ? '创建两个工作区' : '创建引擎工作区'}</button>}
|
||||
{['ready', 'paused', 'awaiting_review'].includes(group.status) && <button className="button" disabled={!!action || running || config.mode === 'demo' || group.requiresVerification || group.workers?.some(child => child.sessionStatus === 'needs_review')} onClick={() => setConfirmation({ group, operation: 'start' })}><Play size={15} />{group.status === 'ready' ? group.children.length === 2 ? '开始两个子任务' : '开始引擎任务' : '继续未完成子任务'}</button>}
|
||||
{!group.evaluation && ['planned', 'partially_prepared'].includes(group.status) && <button className="button" disabled={!!action || busy} onClick={() => setConfirmation({ group, operation: 'prepare' })}><GitBranch size={15} />{group.children.length === 2 ? '创建两个工作区' : '创建引擎工作区'}</button>}
|
||||
{!group.evaluation && ['ready', 'paused', 'awaiting_review'].includes(group.status) && <button className="button" disabled={!!action || running || config.mode === 'demo' || group.requiresVerification || group.workers?.some(child => child.sessionStatus === 'needs_review')} onClick={() => setConfirmation({ group, operation: 'start' })}><Play size={15} />{group.status === 'ready' ? group.children.length === 2 ? '开始两个子任务' : '开始引擎任务' : '继续未完成子任务'}</button>}
|
||||
{running && <button className="button worker-stop" disabled={action === 'stop'} onClick={() => void execute(group, 'stop')}><Square size={14} />停止全部</button>}
|
||||
{['ready_to_collect', 'collected', 'conflict'].includes(group.status) && <button className="button secondary" disabled={!!action || running} onClick={() => void execute(group, 'collect')}><ShieldCheck size={15} />核对成果</button>}
|
||||
{group.status === 'collected' && <button className="button" disabled={!!action} onClick={() => void execute(group, 'merge')}><GitBranch size={15} />准备合并审查</button>}
|
||||
{group.merge?.changeSetId && <button className="button secondary" disabled={!!action || busy} onClick={() => void execute(group, 'finalize')}>核对检查与 Git 交付</button>}
|
||||
{!group.evaluation && ['ready_to_collect', 'collected', 'conflict'].includes(group.status) && <button className="button secondary" disabled={!!action || running} onClick={() => void execute(group, 'collect')}><ShieldCheck size={15} />核对成果</button>}
|
||||
{!group.evaluation && group.status === 'collected' && <button className="button" disabled={!!action} onClick={() => void execute(group, 'merge')}><GitBranch size={15} />准备合并审查</button>}
|
||||
{!group.evaluation && group.merge?.changeSetId && <button className="button secondary" disabled={!!action || busy} onClick={() => void execute(group, 'finalize')}>核对检查与 Git 交付</button>}
|
||||
{group.requiresVerification && <><button className="button secondary" disabled={!!action || running} onClick={() => void execute(group, 'reconcile')}>核对原输入与现场</button>{group.evidence && <><button className="text-button" disabled={!!action} onClick={() => void showRecord(group, 'evidence')}>查看核对记录</button><button className="button secondary" disabled={!!action || readEvidenceSha !== group.evidence.sha256} onClick={() => setConfirmation({ group, operation: 'acknowledge' })}>确认核对并继续</button><button className="text-button" disabled={!!action || readEvidenceSha !== group.evidence.sha256} onClick={() => setConfirmation({ group, operation: 'acknowledge', retain: true })}>确认核对并保留现场结束</button></>}</>}
|
||||
{!running && !group.requiresVerification && !['completed', 'discarded', 'resolved_external'].includes(group.status) && <button className="text-button" disabled={!!action} onClick={() => setConfirmation({ group, operation: 'discard' })}>结束协作并保留现场</button>}
|
||||
{canPlan && <button className="button secondary" onClick={() => { setPurge(emptyPurgeDraft()); setCreating(true); }}>创建下一父目标</button>}
|
||||
|
||||
@@ -201,6 +201,31 @@ export interface CollaborationGroup {
|
||||
evidence?: { artifactId: string; sha256: string } | null;
|
||||
}
|
||||
export interface WorkerView { groups: CollaborationGroup[]; worker: WorkerRecord | null }
|
||||
export interface CollaborationGroup { evaluation?: { batchId: string; sampleId: string } }
|
||||
export interface WorkerDefinition { evaluation?: { batchId: string; sampleId: string; role: 'original' | 'candidate' } }
|
||||
export interface EvaluationRole {
|
||||
outcome: string; reason?: string; evidenceError?: string; workerStatus?: string; startedAt?: string; finishedAt?: string;
|
||||
usage: { requests: number; totalTokens: number; unknownRequests?: number; estimatedUnknownTokens?: number; reported: boolean; cost?: number | null } | null;
|
||||
attempts: { id: string; status: string; summary?: string; results: { name: string; command?: string; status?: string; exitCode?: number; durationMs?: number; tests?: CheckResult['tests']; logArtifactId: string; logSha256?: string }[] }[];
|
||||
approvals?: { id: string; status: string; decidedAt?: string }[]; changes?: { id: string; path: string; status: string }[];
|
||||
}
|
||||
export interface EvaluationReport {
|
||||
schemaVersion: number; batchId: string; sampleId: string; label: string; goal: string; criteria: string; source: { head: string };
|
||||
inputVerified: boolean; inputError?: string; summary: { original: string; candidate: string }; original: EvaluationRole; candidate: EvaluationRole;
|
||||
evidenceMode: string; note: string; sealedAt: string;
|
||||
}
|
||||
export interface EvaluationSample {
|
||||
id: string; label: string; goal: string; criteria: string; paths: string[]; checks: string[]; status: string; groupId?: string; error?: string;
|
||||
baselineAttemptedAt?: string; baselineJobId?: string; contractSha256?: string;
|
||||
commands?: { name: string; command: string; script: string; lifecycle?: { name: string; script: string }[] }[];
|
||||
report: { artifactId: string; sha256: string; summary: { original: string; candidate: string } } | null; workers?: WorkerRecord[];
|
||||
}
|
||||
export interface EvaluationBatch {
|
||||
id: string; title: string; fingerprint: string; status: string; source: { head: string; branch: string }; model: ModelSnapshot;
|
||||
message: string; evidenceMode: string; samples: EvaluationSample[]; budget: WorkerBudget & { maxDurationMs: number }; deadline: number | null;
|
||||
adoption: { sampleId: string; status: string; delivery?: { commit: string } } | null;
|
||||
summary: { samples: number; finished: number; candidate: Record<string, number>; scope: string };
|
||||
}
|
||||
export interface McpTool { name: string; description: string; inputSchema: Record<string, unknown>; unsupported?: string }
|
||||
export interface McpRegistration {
|
||||
id: string; projectId: string; name: string; launch: { executable: { path: string; sha256: string; bytes: number }; entry: { path: string; sha256: string; bytes: number } | null; args: string[]; environment: string; identityScope: string };
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
1. [complete] A:固定样本/基线/需求/允许文件/检查/预算契约;审查原40基准及Node/React/Python,明确夹具与真实推理边界。
|
||||
2. [complete] B:复用两个隔离工作区,一个只做原版检查,一个生成候选;有界串行样本账本、原状态与停止/重启保护,不重放完成工具。
|
||||
3. [complete] C:原版/候选检查、变更、审批/人工介入、用时和原用量对照;缺失与失败保留原分母,不补造评分。
|
||||
4. [in_progress] D:桌面/390px评测入口、完整准备/执行/审查/比较/采纳流程,复用现有审批/差异/检查/Git。
|
||||
5. [pending] E:实际Node/React/Python工程和自身模块试点,测试输入固定、来源修改保持,真实模型自主完成率单列待验。
|
||||
4. [complete] D:桌面/390px评测入口、完整准备/执行/审查/比较/采纳7组通过,停止/来源变化保留原归属;实际两视口截图已回看,复用现有审批/差异/检查/Git。
|
||||
5. [in_progress] E:实际Node/React/Python工程和自身模块试点,测试输入固定、来源修改保持,真实模型自主完成率单列待验。
|
||||
6. [pending] F:完整回归、独立源码/便携/安装/保留状态升级、原生回看、证据/回顾/本地Git与下一计划。
|
||||
|
||||
## 1.19 项目上下文缓存与长任务效率(已完成)
|
||||
|
||||
Reference in New Issue
Block a user