diff --git a/.gitattributes b/.gitattributes index 2e6847e4..8ed30b7f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/docs/QA-1.20.md b/docs/QA-1.20.md index 885cd239..e087ccc1 100644 --- a/docs/QA-1.20.md +++ b/docs/QA-1.20.md @@ -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。保留旧提交,不改写历史。 diff --git a/docs/RETROSPECTIVE-1.20.md b/docs/RETROSPECTIVE-1.20.md index 1ddcd765..e8002aad 100644 --- a/docs/RETROSPECTIVE-1.20.md +++ b/docs/RETROSPECTIVE-1.20.md @@ -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文本规范化改变日志及清单。 diff --git a/docs/engineering-evals-abc-evidence/evaluation-a-first.tap b/docs/engineering-evals-abc-evidence/evaluation-a-first.tap index 599a4db8..5f594355 100644 --- a/docs/engineering-evals-abc-evidence/evaluation-a-first.tap +++ b/docs/engineering-evals-abc-evidence/evaluation-a-first.tap @@ -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 diff --git a/docs/engineering-evals-abc-evidence/evaluation-abc-final-guards.tap b/docs/engineering-evals-abc-evidence/evaluation-abc-final-guards.tap index 13956184..1aa00671 100644 --- a/docs/engineering-evals-abc-evidence/evaluation-abc-final-guards.tap +++ b/docs/engineering-evals-abc-evidence/evaluation-abc-final-guards.tap @@ -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 diff --git a/docs/engineering-evals-abc-evidence/evaluation-abc-operation-locks.tap b/docs/engineering-evals-abc-evidence/evaluation-abc-operation-locks.tap index 6f269156..f427a4cf 100644 --- a/docs/engineering-evals-abc-evidence/evaluation-abc-operation-locks.tap +++ b/docs/engineering-evals-abc-evidence/evaluation-abc-operation-locks.tap @@ -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 diff --git a/docs/engineering-evals-abc-evidence/evaluation-abc-reviewed.tap b/docs/engineering-evals-abc-evidence/evaluation-abc-reviewed.tap index 74a80a28..14caf528 100644 --- a/docs/engineering-evals-abc-evidence/evaluation-abc-reviewed.tap +++ b/docs/engineering-evals-abc-evidence/evaluation-abc-reviewed.tap @@ -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 diff --git a/docs/engineering-evals-abc-evidence/manifest.json b/docs/engineering-evals-abc-evidence/manifest.json index b35903fe..c1736563 100644 --- a/docs/engineering-evals-abc-evidence/manifest.json +++ b/docs/engineering-evals-abc-evidence/manifest.json @@ -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" + } + ] +} diff --git a/docs/engineering-evals-ui-validation.json b/docs/engineering-evals-ui-validation.json new file mode 100644 index 00000000..b0e145da --- /dev/null +++ b/docs/engineering-evals-ui-validation.json @@ -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": [] +} \ No newline at end of file diff --git a/scripts/verify-evaluations-ui.mjs b/scripts/verify-evaluations-ui.mjs new file mode 100644 index 00000000..fef89d8c --- /dev/null +++ b/scripts/verify-evaluations-ui.mjs @@ -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);} diff --git a/src/client/App.tsx b/src/client/App.tsx index 92710dc7..b546e093 100644 --- a/src/client/App.tsx +++ b/src/client/App.tsx @@ -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() { setMcpOpen(true)} disabled={!selectedProject || restrictedWorker}> showInspector('task')}> setWorkersOpen(true)} disabled={!session}> + setEvaluationsOpen(true)} disabled={!session || restrictedWorker}> setEngineOpen(true)} disabled={!session || restrictedWorker && !session.execution?.workers?.some(value => value.engine)}> void openRea()} disabled={!selectedProject || creatingSession || restrictedWorker}> {narrow && <> showInspector('file')}> showInspector('changes')}> showInspector('trace')}>} @@ -598,6 +601,7 @@ export default function App() { {skillsOpen && selectedProject && setSkillsOpen(false)}>} {mcpOpen && selectedProject && setMcpOpen(false)}>} {workersOpen && session && setWorkersOpen(false)}> { setWorkersOpen(false); await navigateWorkspace(projectId, sessionId, () => true, view); }} onReview={() => { setWorkersOpen(false); showInspector('changes'); }} />} + {evaluationsOpen && session && setEvaluationsOpen(false)}> { setEvaluationsOpen(false); await navigateWorkspace(projectId, sessionId, () => true, view); }} onReview={() => { setEvaluationsOpen(false); showInspector('changes'); }} onRecovery={() => { setEvaluationsOpen(false); setWorkersOpen(true); }} />} {toast &&
{toast} setToast('')}>
} ); diff --git a/src/client/EvaluationPanel.css b/src/client/EvaluationPanel.css new file mode 100644 index 00000000..645d1b16 --- /dev/null +++ b/src/client/EvaluationPanel.css @@ -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);} } diff --git a/src/client/EvaluationPanel.tsx b/src/client/EvaluationPanel.tsx new file mode 100644 index 00000000..a5ea437f --- /dev/null +++ b/src/client/EvaluationPanel.tsx @@ -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 = {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;onReview:()=>void;onRecovery:()=>void; +}) { + const [batches,setBatches]=useState([]),[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(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('/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
+

工程质量 · 固定样本

同一份需求,核对改进前后

封存来源与原测试,在隔离工程里生成候选,再把真实结果带回审查。

+ {error&&
{error}
} + {loading?

正在读取评测…

:<> + {!!batches.length&&} + {(!batch||creating)?
+ + +

每批 1–3 个样本,按队列显式推进。每个样本都从当前已提交 HEAD 检出;原暂存和未提交内容留在来源工程。

+ {samples.map((sample,index)=>
固定样本 {index+1}{(['label','goal','criteria','paths','checks'] as const).map(key=>