lantern-harness 0.1.39 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/500.html +3 -3
  3. package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.Aya8qjH3.js → Base.astro_astro_type_script_index_0_lang.rrUCMnye.js} +1 -1
  4. package/dist/_astro/CaseGenerateApp.C9bJ0es1.js +10 -0
  5. package/dist/_astro/CasesLibrary.DBxhr8Z1.js +21 -0
  6. package/dist/_astro/ChatApp.CRCMwSjv.js +226 -0
  7. package/dist/_astro/PluginsPage.BWrcEbFk.js +1 -0
  8. package/dist/_astro/{PluginsPage.CFjWdGcE.js → PluginsPage.CMeKGbb1.js} +1 -1
  9. package/dist/_astro/{PromptsLibrary.Dp4DSrZg.js → PromptsLibrary.BLEjapm6.js} +1 -1
  10. package/dist/_astro/{ReqAnalysisBoard.DpaBFxfX.js → ReqAnalysisBoard.C1ki8w9Z.js} +14 -14
  11. package/dist/_astro/{SettingsDialog.BVYkUusD.js → SettingsDialog.D486FVZ4.js} +1 -1
  12. package/dist/_astro/{SpaceSwitcher.Cy4UrzbH.js → SpaceSwitcher.Bw13MkIw.js} +2 -2
  13. package/dist/_astro/TemplatesLibrary.YIgI089k.js +1 -0
  14. package/dist/_astro/{UiAutoBoard.DO0PTapJ.js → UiAutoBoard.Df2ky1Cs.js} +3 -3
  15. package/dist/_astro/app-version.DaJuJwsd.js +1 -0
  16. package/dist/_astro/{export.joBT53eb.js → case-fields.CmePqYfh.js} +1 -1
  17. package/dist/_astro/case-gen-run.CxlmN4EC.js +22 -0
  18. package/dist/_astro/{case-review.s1w_mD4l.js → case-review.TdDs1WFM.js} +1 -1
  19. package/dist/_astro/case-template.C-GBxgBC.js +8 -0
  20. package/dist/_astro/{req-analysis.Bcm2pHdw.js → req-analysis.BAC_bd4R.js} +1 -1
  21. package/dist/_astro/{story-review.DFvqbD-c.js → story-review.CCSxTgNL.js} +1 -1
  22. package/dist/case-exec/index.html +3 -3
  23. package/dist/cases/generate/index.html +4 -4
  24. package/dist/cases/library/index.html +4 -4
  25. package/dist/dashboard/index.html +3 -3
  26. package/dist/docs/changelog/index.html +52 -44
  27. package/dist/docs/install/index.html +3 -3
  28. package/dist/docs/manual/index.html +8 -7
  29. package/dist/knowledge/index.html +3 -3
  30. package/dist/life/kr-tasks/index.html +3 -3
  31. package/dist/life/kr-todos/index.html +3 -3
  32. package/dist/life/objectives/index.html +3 -3
  33. package/dist/life/reviews/index.html +3 -3
  34. package/dist/life/stages/index.html +3 -3
  35. package/dist/life/year-plans/index.html +3 -3
  36. package/dist/plugins/index.html +4 -4
  37. package/dist/pm/bugs/index.html +3 -3
  38. package/dist/pm/iterations/index.html +3 -3
  39. package/dist/pm/projects/detail/index.html +3 -3
  40. package/dist/pm/projects/index.html +3 -3
  41. package/dist/pm/requirements/index.html +3 -3
  42. package/dist/prompts/index.html +4 -4
  43. package/dist/reports/index.html +3 -3
  44. package/dist/requirement-analysis/index.html +4 -4
  45. package/dist/requirements/index.html +3 -3
  46. package/dist/tasks/index.html +3 -3
  47. package/dist/templates/index.html +4 -4
  48. package/dist/test-automation/index.html +4 -4
  49. package/dist/test-stats/index.html +3 -3
  50. package/dist/todos/index.html +3 -3
  51. package/dist/workbench/index.html +4 -4
  52. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +5 -4
  53. package/package.json +1 -1
  54. package/dist/_astro/CaseGenerateApp.DfGMhuPe.js +0 -10
  55. package/dist/_astro/CasesLibrary.Pzw3UEXQ.js +0 -24
  56. package/dist/_astro/ChatApp.Clkqzs0x.js +0 -226
  57. package/dist/_astro/PluginsPage.D74pC613.js +0 -1
  58. package/dist/_astro/TemplatesLibrary.C0RqdJhT.js +0 -1
  59. package/dist/_astro/app-version.BI-Orb8i.js +0 -1
  60. package/dist/_astro/case-fields.Dqkws1iX.js +0 -1
  61. package/dist/_astro/case-gen-run.1LjdIEwD.js +0 -22
  62. package/dist/_astro/case-template.F1Nv08GV.js +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # 版本日志
2
2
 
3
+ ## [0.1.40] - 2026-11-03
4
+
5
+ Ideal 等带「说明」封面的用例模板能正确认出字段表;从「我的插件」确认生成类配置后回到工作台会话;生成用例文件名按「产品+版本+迭代版本_类型测试用例_时间戳」固定拼装。
6
+
7
+ ### 修复
8
+
9
+ - **xlsx 用例模板 / 用例文件误读「说明」封面**:跨工作表按用例字段别名打分,挑真正表头(如「功能测试用例」),不再把首 sheet 长标题当成字段
10
+ - **「我的插件」确认生成后仍停在插件页**:`beginPluginSession` 关掉插件覆盖层,回到会话区(用例 / 提示词 / 知识库生成共用)
11
+ - **生成用例文件名带上「需求规格说明书」**:入库改为固定格式 `{产品}{版本}迭代版本_{功能|接口|…}测试用例_{时间戳}`——只抽产品与 `v` 版本号,版本后文案一律丢掉,不再枚举需求侧后缀
12
+
3
13
  ## [0.1.39] - 2026-11-03
4
14
 
5
15
  业务表统一「字段」显隐与创建 / 修改日期;表格胶囊定宽;MCP 首屏不再闪空;待办剩余逾期自动标成已延期;汇报多选时未选中卡片不再误悬停。
package/dist/500.html CHANGED
@@ -3,7 +3,7 @@
3
3
  try {
4
4
  if ('scrollRestoration' in history) history.scrollRestoration = 'manual';
5
5
  } catch (e) {}
6
- </script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.Aya8qjH3.js"></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="animate"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CO1cjG9V.js"></script><script>
6
+ </script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.rrUCMnye.js"></script><meta name="astro-view-transitions-enabled" content="true"><meta name="astro-view-transitions-fallback" content="animate"><script type="module" src="/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CO1cjG9V.js"></script><script>
7
7
  (function () {
8
8
  try {
9
9
  // 配置按空间分键(`tw.app.config.v1::<spaceId>`),主题必须从同一个键读,
@@ -135,7 +135,7 @@
135
135
  animation-duration: 180ms;
136
136
  animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
137
137
  animation-fill-mode: both;
138
- animation-name: astroFadeIn; }</style></head><body class="tw-body antialiased"><div class="tw-shell min-h-screen"><aside class="tw-nav-aside fixed inset-y-0 left-0 flex flex-col z-45" id="tw-nav-aside"><div class="tw-nav-brand"><div class="tw-nav-brand-row"><a href="/" class="tw-nav-brand-link min-w-0 flex-1" data-astro-reload><span class="tw-nav-brand-mark" aria-hidden="true"><img class="tw-nav-brand-mark-img" src="/brand/brand-mark.png" alt="" width="36" height="36"></span><span class="tw-nav-brand-text"><span class="tw-nav-brand-title-row"><span class="tw-nav-brand-title" data-i18n="nav.brand">Lantern Harness</span><span class="tw-nav-brand-ver" data-hint="平台版本 v0.1.39">v0.1.39<span class="tw-nav-brand-dot" id="tw-update-dot" role="button" tabindex="-1" aria-label="有新版本可更新" hidden></span></span></span></span></a></div></div><div class="tw-nav-space-slot"><div class="tw-nav-space tw-nav-space-ph" id="tw-nav-space-ph" aria-hidden="true"><div class="tw-nav-space-ph-box"><span class="tw-nav-space-ph-ico"></span><span class="tw-nav-space-ph-lines"><span class="tw-nav-space-ph-bar is-cap"></span><span class="tw-nav-space-ph-bar is-name"></span></span></div></div><style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).only=e,window.dispatchEvent(new Event(`astro:only`))})();</script><script>(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);{let e={0:e=>a(e),1:e=>n(e),2:e=>new RegExp(e),3:e=>new Date(e),4:e=>new Map(n(e)),5:e=>new Set(n(e)),6:e=>BigInt(e),7:e=>new URL(e),8:e=>new Uint8Array(e),9:e=>new Uint16Array(e),10:e=>new Uint32Array(e),11:e=>1/0*e},t=t=>{let[n,r]=t;return n in e?e[n](r):void 0},n=e=>e.map(t),a=e=>typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]));class o extends HTMLElement{constructor(...e){super(...e),r(this,`Component`,void 0),r(this,`hydrator`,void 0),r(this,`hydrate`,async()=>{var e;if(!this.hydrator||!this.isConnected)return;let t=(e=this.parentElement)==null?void 0:e.closest(`astro-island[ssr]`);if(t){t.addEventListener(`astro:hydrate`,this.hydrate,{once:!0});return}let n=this.querySelectorAll(`astro-slot`),r={},i=this.querySelectorAll(`template[data-astro-template]`);for(let e of i){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`data-astro-template`)||`default`]=e.innerHTML,e.remove())}for(let e of n){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`name`)||`default`]=e.innerHTML)}let o;try{o=this.hasAttribute(`props`)?a(JSON.parse(this.getAttribute(`props`))):{}}catch(e){let t=this.getAttribute(`component-url`)||`<unknown>`,n=this.getAttribute(`component-export`);throw n&&(t+=` (export ${n})`),console.error(`[hydrate] Error parsing props for component ${t}`,this.getAttribute(`props`),e),e}await this.hydrator(this)(this.Component,o,r,{client:this.getAttribute(`client`)}),this.removeAttribute(`ssr`),this.dispatchEvent(new CustomEvent(`astro:hydrate`))}),r(this,`unmount`,()=>{this.isConnected||this.dispatchEvent(new CustomEvent(`astro:unmount`))})}disconnectedCallback(){document.removeEventListener(`astro:after-swap`,this.unmount),document.addEventListener(`astro:after-swap`,this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(`await-children`)||document.readyState===`interactive`||document.readyState===`complete`)this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(`DOMContentLoaded`,e),t.disconnect(),this.childrenConnectedCallback()},t=new MutationObserver(()=>{var t;((t=this.lastChild)==null?void 0:t.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===`astro:end`&&(this.lastChild.remove(),e())});t.observe(this,{childList:!0}),document.addEventListener(`DOMContentLoaded`,e)}}async childrenConnectedCallback(){let e=this.getAttribute(`before-hydration-url`);e&&await import(e),this.start()}getRetryImportUrl(e){let t=new URL(e,document.baseURI);return t.searchParams.set(`astro-retry`,Date.now().toString()),t.toString()}async importWithRetry(e){try{return await import(e)}catch(t){return await new Promise(e=>setTimeout(e,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let t=this.getAttribute(`component-url`),n=new CustomEvent(`astro:hydration-error`,{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:t}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${t}`,e)}async start(){let e=JSON.parse(this.getAttribute(`opts`)),t=this.getAttribute(`client`);if(Astro[t]===void 0)window.addEventListener(`astro:${t}`,()=>this.start(),{once:!0});else try{await Astro[t](async()=>{let e=this.getAttribute(`renderer-url`);try{let[t,{default:n}]=await Promise.all([this.importWithRetry(this.getAttribute(`component-url`)),e?this.importWithRetry(e):Promise.resolve({default:()=>()=>{}})]),r=this.getAttribute(`component-export`)||`default`;if(r.includes(`.`)){this.Component=t;for(let e of r.split(`.`)){if(i.has(e)||!this.Component||typeof this.Component!=`object`&&typeof this.Component!=`function`||!Object.hasOwn(this.Component,e))throw Error(`Invalid component export path: ${r}`);this.Component=this.Component[e]}}else{if(i.has(r))throw Error(`Invalid component export path: ${r}`);this.Component=t[r]}return this.hydrator=n,this.hydrate}catch(e){return this.handleHydrationError(e),()=>{}}},e,this)}catch(e){this.handleHydrationError(e)}}attributeChangedCallback(){this.hydrate()}}r(o,`observedAttributes`,[`props`]),customElements.get(`astro-island`)||customElements.define(`astro-island`,o)}})();</script><astro-island uid="2wH2Dz" component-url="/_astro/SpaceSwitcher.Cy4UrzbH.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-gyrtbwwo-1&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;SpaceSwitcher&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-gyrtbwwo-1"></astro-island></div><button type="button" id="tw-nav-toggle" class="tw-nav-toggle" aria-label="收起或展开左侧导航" aria-expanded="true" aria-controls="tw-nav-aside"><svg class="tw-nav-toggle-icon is-collapse" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg><svg class="tw-nav-toggle-icon is-expand" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button><nav class="tw-nav-list flex-1 overflow-y-auto"><a href="/workbench/" class="tw-nav-item" data-i18n-hint="nav.home" data-hint="我的工作台"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"></path><path d="M5 9.5V20h14V9.5"></path></svg><span class="tw-nav-label" data-i18n="nav.home">我的工作台</span></a><div class="tw-nav-libraries"><div class="tw-nav-libraries-ph"><a href="/dashboard/" class="tw-nav-item" data-plugin-nav="dashboard"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect></svg><span class="tw-nav-label" data-i18n="nav.dashboard">仪表盘</span></a><a href="/tasks/" class="tw-nav-item" data-plugin-nav="tasks"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 5h10"></path><path d="M9 12h10"></path><path d="M9 19h10"></path><path d="M4 5h.01"></path><path d="M4 12h.01"></path><path d="M4 19h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.tasks">任务管理</span></a><a href="/todos/" class="tw-nav-item" data-plugin-nav="todos"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M8 6h13"></path><path d="M8 12h13"></path><path d="M8 18h13"></path><path d="M3 6h.01"></path><path d="M3 12h.01"></path><path d="M3 18h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.todos">待办事项</span></a><a href="/pm/projects/" class="tw-nav-item" data-plugin-nav="projects"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"></path></svg><span class="tw-nav-label" data-i18n="nav.projects">项目列表</span></a><a href="/pm/iterations/" class="tw-nav-item" data-plugin-nav="iterations"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"></rect><path d="M8 3v4"></path><path d="M16 3v4"></path><path d="M3 10h18"></path></svg><span class="tw-nav-label" data-i18n="nav.iterations">迭代管理</span></a><a href="/pm/requirements/" class="tw-nav-item" data-plugin-nav="pmRequirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.requirementsMgmt">需求管理</span></a><a href="/pm/bugs/" class="tw-nav-item" data-plugin-nav="bugs"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="14" r="5"></circle><path d="M9 6l2 2"></path><path d="M15 6l-2 2"></path><path d="M7 11H4"></path><path d="M20 11h-3"></path><path d="M7 17H4"></path><path d="M20 17h-3"></path></svg><span class="tw-nav-label" data-i18n="nav.bugs">缺陷管理</span></a><a href="/reports/" class="tw-nav-item" data-plugin-nav="reports"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.reports">工作汇报</span></a><a href="/test-stats/" class="tw-nav-item" data-plugin-nav="testStats"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 20V10"></path><path d="M10 20V4"></path><path d="M16 20v-7"></path><path d="M22 20H2"></path></svg><span class="tw-nav-label" data-i18n="nav.testStats">测试统计</span></a><a href="/case-exec/" class="tw-nav-item" data-plugin-nav="caseExec"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><circle cx="12" cy="12" r="5"></circle><circle cx="12" cy="12" r="1.4"></circle></svg><span class="tw-nav-label" data-i18n="nav.caseExec">用例执行统计</span></a><a href="/cases/library/" class="tw-nav-item" data-plugin-nav="cases"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg><span class="tw-nav-label" data-i18n="nav.caseManage">用例管理</span></a><a href="/knowledge/" class="tw-nav-item" data-plugin-nav="knowledgeLib"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg><span class="tw-nav-label" data-i18n="nav.knowledge">知识库管理</span></a><a href="/requirements/" class="tw-nav-item" data-plugin-nav="requirements" data-i18n-hint="nav.requirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h6"></path></svg><span class="tw-nav-label" data-i18n="nav.requirements">需求文档库</span></a><a href="/templates/" class="tw-nav-item" data-plugin-nav="templates" data-i18n-hint="nav.templates"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 3 3 8l9 5 9-5-9-5z"></path><path d="m3 13 9 5 9-5"></path></svg><span class="tw-nav-label" data-i18n="nav.templates">测试模板库</span></a></div><astro-island uid="Z1lgSd4" component-url="/_astro/NavLibraries.D9EKoN80.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-iywf7oe7-2&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;NavLibraries&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-iywf7oe7-2"></astro-island><script>(function(){const host = ".tw-nav-libraries";
138
+ animation-name: astroFadeIn; }</style></head><body class="tw-body antialiased"><div class="tw-shell min-h-screen"><aside class="tw-nav-aside fixed inset-y-0 left-0 flex flex-col z-45" id="tw-nav-aside"><div class="tw-nav-brand"><div class="tw-nav-brand-row"><a href="/" class="tw-nav-brand-link min-w-0 flex-1" data-astro-reload><span class="tw-nav-brand-mark" aria-hidden="true"><img class="tw-nav-brand-mark-img" src="/brand/brand-mark.png" alt="" width="36" height="36"></span><span class="tw-nav-brand-text"><span class="tw-nav-brand-title-row"><span class="tw-nav-brand-title" data-i18n="nav.brand">Lantern Harness</span><span class="tw-nav-brand-ver" data-hint="平台版本 v0.1.40">v0.1.40<span class="tw-nav-brand-dot" id="tw-update-dot" role="button" tabindex="-1" aria-label="有新版本可更新" hidden></span></span></span></span></a></div></div><div class="tw-nav-space-slot"><div class="tw-nav-space tw-nav-space-ph" id="tw-nav-space-ph" aria-hidden="true"><div class="tw-nav-space-ph-box"><span class="tw-nav-space-ph-ico"></span><span class="tw-nav-space-ph-lines"><span class="tw-nav-space-ph-bar is-cap"></span><span class="tw-nav-space-ph-bar is-name"></span></span></div></div><style>astro-island,astro-slot,astro-static-slot{display:contents}</style><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).only=e,window.dispatchEvent(new Event(`astro:only`))})();</script><script>(function(){function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);{let e={0:e=>a(e),1:e=>n(e),2:e=>new RegExp(e),3:e=>new Date(e),4:e=>new Map(n(e)),5:e=>new Set(n(e)),6:e=>BigInt(e),7:e=>new URL(e),8:e=>new Uint8Array(e),9:e=>new Uint16Array(e),10:e=>new Uint32Array(e),11:e=>1/0*e},t=t=>{let[n,r]=t;return n in e?e[n](r):void 0},n=e=>e.map(t),a=e=>typeof e!=`object`||!e?e:Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]));class o extends HTMLElement{constructor(...e){super(...e),r(this,`Component`,void 0),r(this,`hydrator`,void 0),r(this,`hydrate`,async()=>{var e;if(!this.hydrator||!this.isConnected)return;let t=(e=this.parentElement)==null?void 0:e.closest(`astro-island[ssr]`);if(t){t.addEventListener(`astro:hydrate`,this.hydrate,{once:!0});return}let n=this.querySelectorAll(`astro-slot`),r={},i=this.querySelectorAll(`template[data-astro-template]`);for(let e of i){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`data-astro-template`)||`default`]=e.innerHTML,e.remove())}for(let e of n){let t=e.closest(this.tagName);t!=null&&t.isSameNode(this)&&(r[e.getAttribute(`name`)||`default`]=e.innerHTML)}let o;try{o=this.hasAttribute(`props`)?a(JSON.parse(this.getAttribute(`props`))):{}}catch(e){let t=this.getAttribute(`component-url`)||`<unknown>`,n=this.getAttribute(`component-export`);throw n&&(t+=` (export ${n})`),console.error(`[hydrate] Error parsing props for component ${t}`,this.getAttribute(`props`),e),e}await this.hydrator(this)(this.Component,o,r,{client:this.getAttribute(`client`)}),this.removeAttribute(`ssr`),this.dispatchEvent(new CustomEvent(`astro:hydrate`))}),r(this,`unmount`,()=>{this.isConnected||this.dispatchEvent(new CustomEvent(`astro:unmount`))})}disconnectedCallback(){document.removeEventListener(`astro:after-swap`,this.unmount),document.addEventListener(`astro:after-swap`,this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(`await-children`)||document.readyState===`interactive`||document.readyState===`complete`)this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(`DOMContentLoaded`,e),t.disconnect(),this.childrenConnectedCallback()},t=new MutationObserver(()=>{var t;((t=this.lastChild)==null?void 0:t.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===`astro:end`&&(this.lastChild.remove(),e())});t.observe(this,{childList:!0}),document.addEventListener(`DOMContentLoaded`,e)}}async childrenConnectedCallback(){let e=this.getAttribute(`before-hydration-url`);e&&await import(e),this.start()}getRetryImportUrl(e){let t=new URL(e,document.baseURI);return t.searchParams.set(`astro-retry`,Date.now().toString()),t.toString()}async importWithRetry(e){try{return await import(e)}catch(t){return await new Promise(e=>setTimeout(e,1e3)),import(this.getRetryImportUrl(e))}}handleHydrationError(e){let t=this.getAttribute(`component-url`),n=new CustomEvent(`astro:hydration-error`,{cancelable:!0,bubbles:!0,composed:!0,detail:{error:e,componentUrl:t}});this.dispatchEvent(n)&&console.error(`[astro-island] Error hydrating ${t}`,e)}async start(){let e=JSON.parse(this.getAttribute(`opts`)),t=this.getAttribute(`client`);if(Astro[t]===void 0)window.addEventListener(`astro:${t}`,()=>this.start(),{once:!0});else try{await Astro[t](async()=>{let e=this.getAttribute(`renderer-url`);try{let[t,{default:n}]=await Promise.all([this.importWithRetry(this.getAttribute(`component-url`)),e?this.importWithRetry(e):Promise.resolve({default:()=>()=>{}})]),r=this.getAttribute(`component-export`)||`default`;if(r.includes(`.`)){this.Component=t;for(let e of r.split(`.`)){if(i.has(e)||!this.Component||typeof this.Component!=`object`&&typeof this.Component!=`function`||!Object.hasOwn(this.Component,e))throw Error(`Invalid component export path: ${r}`);this.Component=this.Component[e]}}else{if(i.has(r))throw Error(`Invalid component export path: ${r}`);this.Component=t[r]}return this.hydrator=n,this.hydrate}catch(e){return this.handleHydrationError(e),()=>{}}},e,this)}catch(e){this.handleHydrationError(e)}}attributeChangedCallback(){this.hydrate()}}r(o,`observedAttributes`,[`props`]),customElements.get(`astro-island`)||customElements.define(`astro-island`,o)}})();</script><astro-island uid="2wH2Dz" component-url="/_astro/SpaceSwitcher.Bw13MkIw.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-gyrtbwwo-1&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;SpaceSwitcher&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-gyrtbwwo-1"></astro-island></div><button type="button" id="tw-nav-toggle" class="tw-nav-toggle" aria-label="收起或展开左侧导航" aria-expanded="true" aria-controls="tw-nav-aside"><svg class="tw-nav-toggle-icon is-collapse" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"></path></svg><svg class="tw-nav-toggle-icon is-expand" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"></path></svg></button><nav class="tw-nav-list flex-1 overflow-y-auto"><a href="/workbench/" class="tw-nav-item" data-i18n-hint="nav.home" data-hint="我的工作台"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5"></path><path d="M5 9.5V20h14V9.5"></path></svg><span class="tw-nav-label" data-i18n="nav.home">我的工作台</span></a><div class="tw-nav-libraries"><div class="tw-nav-libraries-ph"><a href="/dashboard/" class="tw-nav-item" data-plugin-nav="dashboard"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect></svg><span class="tw-nav-label" data-i18n="nav.dashboard">仪表盘</span></a><a href="/tasks/" class="tw-nav-item" data-plugin-nav="tasks"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 5h10"></path><path d="M9 12h10"></path><path d="M9 19h10"></path><path d="M4 5h.01"></path><path d="M4 12h.01"></path><path d="M4 19h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.tasks">任务管理</span></a><a href="/todos/" class="tw-nav-item" data-plugin-nav="todos"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M8 6h13"></path><path d="M8 12h13"></path><path d="M8 18h13"></path><path d="M3 6h.01"></path><path d="M3 12h.01"></path><path d="M3 18h.01"></path></svg><span class="tw-nav-label" data-i18n="nav.todos">待办事项</span></a><a href="/pm/projects/" class="tw-nav-item" data-plugin-nav="projects"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"></path></svg><span class="tw-nav-label" data-i18n="nav.projects">项目列表</span></a><a href="/pm/iterations/" class="tw-nav-item" data-plugin-nav="iterations"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="2"></rect><path d="M8 3v4"></path><path d="M16 3v4"></path><path d="M3 10h18"></path></svg><span class="tw-nav-label" data-i18n="nav.iterations">迭代管理</span></a><a href="/pm/requirements/" class="tw-nav-item" data-plugin-nav="pmRequirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.requirementsMgmt">需求管理</span></a><a href="/pm/bugs/" class="tw-nav-item" data-plugin-nav="bugs"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="14" r="5"></circle><path d="M9 6l2 2"></path><path d="M15 6l-2 2"></path><path d="M7 11H4"></path><path d="M20 11h-3"></path><path d="M7 17H4"></path><path d="M20 17h-3"></path></svg><span class="tw-nav-label" data-i18n="nav.bugs">缺陷管理</span></a><a href="/reports/" class="tw-nav-item" data-plugin-nav="reports"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h5"></path></svg><span class="tw-nav-label" data-i18n="nav.reports">工作汇报</span></a><a href="/test-stats/" class="tw-nav-item" data-plugin-nav="testStats"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 20V10"></path><path d="M10 20V4"></path><path d="M16 20v-7"></path><path d="M22 20H2"></path></svg><span class="tw-nav-label" data-i18n="nav.testStats">测试统计</span></a><a href="/case-exec/" class="tw-nav-item" data-plugin-nav="caseExec"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><circle cx="12" cy="12" r="5"></circle><circle cx="12" cy="12" r="1.4"></circle></svg><span class="tw-nav-label" data-i18n="nav.caseExec">用例执行统计</span></a><a href="/cases/library/" class="tw-nav-item" data-plugin-nav="cases"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M9 11l3 3L22 4"></path><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg><span class="tw-nav-label" data-i18n="nav.caseManage">用例管理</span></a><a href="/knowledge/" class="tw-nav-item" data-plugin-nav="knowledgeLib"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg><span class="tw-nav-label" data-i18n="nav.knowledge">知识库管理</span></a><a href="/requirements/" class="tw-nav-item" data-plugin-nav="requirements" data-i18n-hint="nav.requirements"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M14 3v5h5"></path><path d="M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"></path><path d="M8 13h8"></path><path d="M8 17h6"></path></svg><span class="tw-nav-label" data-i18n="nav.requirements">需求文档库</span></a><a href="/templates/" class="tw-nav-item" data-plugin-nav="templates" data-i18n-hint="nav.templates"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 3 3 8l9 5 9-5-9-5z"></path><path d="m3 13 9 5 9-5"></path></svg><span class="tw-nav-label" data-i18n="nav.templates">测试模板库</span></a></div><astro-island uid="Z1lgSd4" component-url="/_astro/NavLibraries.D9EKoN80.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{&quot;data-astro-transition-persist&quot;:[0,&quot;astro-iywf7oe7-2&quot;]}" ssr client="only" opts="{&quot;name&quot;:&quot;NavLibraries&quot;,&quot;value&quot;:&quot;react&quot;}" data-astro-transition-persist="astro-iywf7oe7-2"></astro-island><script>(function(){const host = ".tw-nav-libraries";
139
139
  const cacheKey = "tw.hydrate.nav";
140
140
  const fixActive = true;
141
141
  const capture = false;
@@ -428,7 +428,7 @@ const syncNavGroups = true;
428
428
  // 缓存坏了就当没有
429
429
  }
430
430
  })();
431
- })();</script></div><a href="/prompts/" class="tw-nav-item" data-plugin-nav="prompts" data-pinned-nav="prompts"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg><span class="tw-nav-label" data-i18n="nav.prompts">提示词管理</span></a><a href="/docs/manual/" class="tw-nav-item" data-hint="帮助中心" data-i18n-hint="nav.helpCenter"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M5 4.5h9.5L19 9v10.5H5V4.5Z" stroke-linejoin="round"></path><path d="M14.5 4.5V9H19" stroke-linejoin="round"></path><path d="M8 13h8M8 16.5h6" stroke-linecap="round"></path></svg><span class="tw-nav-label" data-i18n="nav.helpCenter">帮助中心</span></a></nav><div class="tw-nav-foot"><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).load=e,window.dispatchEvent(new Event(`astro:load`))})();</script><astro-island uid="Z12jkyC" prefix="r1" component-url="/_astro/SettingsDialog.BVYkUusD.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{&quot;name&quot;:&quot;SettingsDialog&quot;,&quot;value&quot;:true}" await-children><div class="tw-nav-foot-row"><button type="button" class="tw-nav-settings-btn" data-hint="设置"><svg class="tw-nav-ico w-4.5 h-4.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path></svg><span data-i18n="nav.settings">设置</span></button><button type="button" class="tw-nav-provider-chip is-empty" data-hint="未配置模型"><span class="tw-nav-provider-dot" aria-hidden="true"></span><span class="tw-nav-provider-name">未配置</span></button></div><span hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></span><!--astro:end--></astro-island></div></aside><script data-astro-rerun>
431
+ })();</script></div><a href="/prompts/" class="tw-nav-item" data-plugin-nav="prompts" data-pinned-nav="prompts"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M12 20h9"></path><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg><span class="tw-nav-label" data-i18n="nav.prompts">提示词管理</span></a><a href="/docs/manual/" class="tw-nav-item" data-hint="帮助中心" data-i18n-hint="nav.helpCenter"><svg class="tw-nav-ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M5 4.5h9.5L19 9v10.5H5V4.5Z" stroke-linejoin="round"></path><path d="M14.5 4.5V9H19" stroke-linejoin="round"></path><path d="M8 13h8M8 16.5h6" stroke-linecap="round"></path></svg><span class="tw-nav-label" data-i18n="nav.helpCenter">帮助中心</span></a></nav><div class="tw-nav-foot"><script>(function(){let e=async e=>{await(await e())()};(self.Astro||(self.Astro={})).load=e,window.dispatchEvent(new Event(`astro:load`))})();</script><astro-island uid="Z12jkyC" prefix="r1" component-url="/_astro/SettingsDialog.D486FVZ4.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{&quot;name&quot;:&quot;SettingsDialog&quot;,&quot;value&quot;:true}" await-children><div class="tw-nav-foot-row"><button type="button" class="tw-nav-settings-btn" data-hint="设置"><svg class="tw-nav-ico w-4.5 h-4.5 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9c.2.6.7 1 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path></svg><span data-i18n="nav.settings">设置</span></button><button type="button" class="tw-nav-provider-chip is-empty" data-hint="未配置模型"><span class="tw-nav-provider-dot" aria-hidden="true"></span><span class="tw-nav-provider-name">未配置</span></button></div><span hidden="" style="position:fixed;top:1px;left:1px;width:1px;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></span><!--astro:end--></astro-island></div></aside><script data-astro-rerun>
432
432
  (function () {
433
433
  try {
434
434
  var raw = localStorage.getItem('tw.app.model.v1');
@@ -1,2 +1,2 @@
1
- import{i as e}from"./app-config.C4rpn1Ix.js";import{i as t,o as n}from"./plugins.C0NrHGZv.js";import{t as r}from"./app-version.BI-Orb8i.js";import{t as i}from"./settings.NTeTjmxg.js";import{t as ee}from"./update.Fq2CGmCX.js";var a=100,te=1010,ne=420,o=14,re=150,s=6,ie=3200,ae=180,c=null,l=null,u=null,d=null,f=null,p=!1,m=0,h=0,g=0,_=0,v=!1,y=0,b=null,x=null,S=0,C=!1,w=null,T=!1;function E(e){if(!e.isConnected||e.closest(`[data-closed]`)||e.checkVisibility&&!e.checkVisibility({checkVisibilityCSS:!0}))return!0;let t=e.getBoundingClientRect();return t.width===0&&t.height===0}function D(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2;if(n<0||r<0||n>window.innerWidth||r>window.innerHeight)return!1;let i=document.elementFromPoint(n,r);return i?!(i===e||e.contains(i)||i.contains(e)):!1}function O(e){let t=e.getBoundingClientRect();b&&b.left===t.left&&b.top===t.top&&b.width===t.width&&b.height===t.height||(M(),N())}function k(e){let t=e.getBoundingClientRect();return t.bottom<=0||t.top>=window.innerHeight||t.right<=0||t.left>=window.innerWidth}function oe(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function A(){_&&=(cancelAnimationFrame(_),0)}function j(){x=null,S&&=(window.clearTimeout(S),0)}function se(){A();let e=()=>{_=0;let t=d;t&&(E(t)||k(t)||D(t)||C&&w&&!oe(t.getBoundingClientRect(),w.x,w.y)||!C&&!t.contains(document.activeElement)?L():(O(t),_=requestAnimationFrame(e)))};_=requestAnimationFrame(e)}function ce(){c&&c.isConnected||(c=document.createElement(`div`),c.setAttribute(`role`,`tooltip`),c.className=`tw-tooltip tw-tooltip-anim pointer-events-none fixed rounded-md px-2 py-1 text-[12px] leading-5 break-all text-stone-700 shadow-lg`,c.style.zIndex=String(a),c.style.maxHeight=`40vh`,c.style.overflowY=`auto`,c.dataset.closed=``,l=document.createElement(`span`),l.setAttribute(`aria-hidden`,`true`),l.className=`tw-tooltip-arrow absolute h-2 w-2`,l.style.transform=`translateX(-50%) rotate(45deg)`,u=document.createTextNode(``),c.append(l,u),document.body.appendChild(c))}function M(){if(!d)return;let e=d.getBoundingClientRect(),t=Math.min(Math.max(e.width,160),ne),n=e.bottom+72>window.innerHeight-8,r=n?e.top-s:e.bottom+s,i=Math.max(8,Math.min(e.left,Math.max(8,window.innerWidth-t-8)));f={top:r,left:i,maxWidth:t,openUp:n,arrowLeft:Math.max(o,Math.min(e.left+e.width/2-i,t-o))},b={left:e.left,top:e.top,width:e.width,height:e.height}}function N(){if(!c||!l||!f)return;let e=d?.dataset.hintLayer===`popover`;c.style.zIndex=String(e?te:a),c.style.maxHeight=e?``:`40vh`,c.style.overflowY=e?`visible`:`auto`,c.style.top=`${f.top}px`,c.style.left=`${f.left}px`,c.style.maxWidth=`${f.maxWidth}px`,c.classList.toggle(`is-up`,f.openUp),c.classList.toggle(`is-down`,!f.openUp),l.classList.toggle(`is-up`,f.openUp),l.classList.toggle(`is-down`,!f.openUp),l.style.left=`${f.arrowLeft}px`,l.style.top=f.openUp?``:`-5px`,l.style.bottom=f.openUp?`-5px`:``}function le(e){let t=e.innerText||``;return e.querySelectorAll(`[class*="sr-only"]`).forEach(e=>{let n=e.innerText;n&&(t=t.replace(n,``))}),t.replace(/\s+/g,` `).trim()}function ue(e){return e.scrollWidth>e.clientWidth+1||e.scrollHeight>e.clientHeight+1}function P(e){return e.dataset.hintAlways!==void 0||e.dataset.hintFit===void 0&&!le(e)||ue(e)}function F(e){return!!e.dataset.hint&&P(e)}function I(e,t){let n=e.dataset.hint??``;if(!n||!P(e))return;let r=e.getBoundingClientRect();if(!r.width||!r.height||e.checkVisibility&&!e.checkVisibility({checkVisibilityCSS:!0})||D(e)||(ce(),!c||!u))return;d=e,C=t,h&&=(window.clearTimeout(h),0),u.data=n,c.style.whiteSpace=n.includes(`
1
+ import{i as e}from"./app-config.C4rpn1Ix.js";import{i as t,o as n}from"./plugins.C0NrHGZv.js";import{t as r}from"./app-version.DaJuJwsd.js";import{t as i}from"./settings.NTeTjmxg.js";import{t as ee}from"./update.Fq2CGmCX.js";var a=100,te=1010,ne=420,o=14,re=150,s=6,ie=3200,ae=180,c=null,l=null,u=null,d=null,f=null,p=!1,m=0,h=0,g=0,_=0,v=!1,y=0,b=null,x=null,S=0,C=!1,w=null,T=!1;function E(e){if(!e.isConnected||e.closest(`[data-closed]`)||e.checkVisibility&&!e.checkVisibility({checkVisibilityCSS:!0}))return!0;let t=e.getBoundingClientRect();return t.width===0&&t.height===0}function D(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2;if(n<0||r<0||n>window.innerWidth||r>window.innerHeight)return!1;let i=document.elementFromPoint(n,r);return i?!(i===e||e.contains(i)||i.contains(e)):!1}function O(e){let t=e.getBoundingClientRect();b&&b.left===t.left&&b.top===t.top&&b.width===t.width&&b.height===t.height||(M(),N())}function k(e){let t=e.getBoundingClientRect();return t.bottom<=0||t.top>=window.innerHeight||t.right<=0||t.left>=window.innerWidth}function oe(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}function A(){_&&=(cancelAnimationFrame(_),0)}function j(){x=null,S&&=(window.clearTimeout(S),0)}function se(){A();let e=()=>{_=0;let t=d;t&&(E(t)||k(t)||D(t)||C&&w&&!oe(t.getBoundingClientRect(),w.x,w.y)||!C&&!t.contains(document.activeElement)?L():(O(t),_=requestAnimationFrame(e)))};_=requestAnimationFrame(e)}function ce(){c&&c.isConnected||(c=document.createElement(`div`),c.setAttribute(`role`,`tooltip`),c.className=`tw-tooltip tw-tooltip-anim pointer-events-none fixed rounded-md px-2 py-1 text-[12px] leading-5 break-all text-stone-700 shadow-lg`,c.style.zIndex=String(a),c.style.maxHeight=`40vh`,c.style.overflowY=`auto`,c.dataset.closed=``,l=document.createElement(`span`),l.setAttribute(`aria-hidden`,`true`),l.className=`tw-tooltip-arrow absolute h-2 w-2`,l.style.transform=`translateX(-50%) rotate(45deg)`,u=document.createTextNode(``),c.append(l,u),document.body.appendChild(c))}function M(){if(!d)return;let e=d.getBoundingClientRect(),t=Math.min(Math.max(e.width,160),ne),n=e.bottom+72>window.innerHeight-8,r=n?e.top-s:e.bottom+s,i=Math.max(8,Math.min(e.left,Math.max(8,window.innerWidth-t-8)));f={top:r,left:i,maxWidth:t,openUp:n,arrowLeft:Math.max(o,Math.min(e.left+e.width/2-i,t-o))},b={left:e.left,top:e.top,width:e.width,height:e.height}}function N(){if(!c||!l||!f)return;let e=d?.dataset.hintLayer===`popover`;c.style.zIndex=String(e?te:a),c.style.maxHeight=e?``:`40vh`,c.style.overflowY=e?`visible`:`auto`,c.style.top=`${f.top}px`,c.style.left=`${f.left}px`,c.style.maxWidth=`${f.maxWidth}px`,c.classList.toggle(`is-up`,f.openUp),c.classList.toggle(`is-down`,!f.openUp),l.classList.toggle(`is-up`,f.openUp),l.classList.toggle(`is-down`,!f.openUp),l.style.left=`${f.arrowLeft}px`,l.style.top=f.openUp?``:`-5px`,l.style.bottom=f.openUp?`-5px`:``}function le(e){let t=e.innerText||``;return e.querySelectorAll(`[class*="sr-only"]`).forEach(e=>{let n=e.innerText;n&&(t=t.replace(n,``))}),t.replace(/\s+/g,` `).trim()}function ue(e){return e.scrollWidth>e.clientWidth+1||e.scrollHeight>e.clientHeight+1}function P(e){return e.dataset.hintAlways!==void 0||e.dataset.hintFit===void 0&&!le(e)||ue(e)}function F(e){return!!e.dataset.hint&&P(e)}function I(e,t){let n=e.dataset.hint??``;if(!n||!P(e))return;let r=e.getBoundingClientRect();if(!r.width||!r.height||e.checkVisibility&&!e.checkVisibility({checkVisibilityCSS:!0})||D(e)||(ce(),!c||!u))return;d=e,C=t,h&&=(window.clearTimeout(h),0),u.data=n,c.style.whiteSpace=n.includes(`
2
2
  `)?`pre-wrap`:``,M(),N(),c.style.display=``,p||(c.dataset.closed=``),cancelAnimationFrame(m);let i=++y;m=requestAnimationFrame(()=>{m=requestAnimationFrame(()=>{c&&i===y&&d===e&&(p=!0,delete c.dataset.closed)})}),se(),g&&window.clearTimeout(g),g=window.setTimeout(()=>{g=0,d===e&&L()},ie)}function L(){A(),j(),y+=1,m&&=(cancelAnimationFrame(m),0),d=null,C=!1,b=null,g&&=(window.clearTimeout(g),0),c&&(p=!1,c.dataset.closed=``,h&&window.clearTimeout(h),h=window.setTimeout(()=>{h=0,!p&&c&&(c.style.display=`none`)},re))}function R(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-hint]`);return t instanceof HTMLElement?t:null}function z(e){T=!0,(e.clientX!==0||e.clientY!==0)&&(w={x:e.clientX,y:e.clientY});let t=R(e.target);t!==d&&(!t||!F(t)?(j(),d&&L()):t!==x&&(j(),x=t,S=window.setTimeout(()=>{S=0;let e=x;x=null,e&&e!==d&&I(e,!0)},ae)))}function B(e){let t=R(e.target);if(t&&t===x&&j(),!t||t!==d)return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||L()}function V(e){if(T)return;let t=R(e.target);t!==d&&(!t||!F(t)?d&&L():I(t,!1))}function H(e){let t=R(e.target);if(!t||t!==d)return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||L()}function U(){j(),d&&L()}function W(){d&&(E(d)||k(d)||D(d)?L():O(d))}function de(e){w={x:e.clientX,y:e.clientY},T=!0}function fe(){T=!0,j(),d&&L()}function pe(e){T=!1,e.key===`Escape`&&d&&L()}function me(){typeof document>`u`||v||(v=!0,document.addEventListener(`mouseover`,z,!0),document.addEventListener(`mouseout`,B,!0),document.addEventListener(`pointermove`,de,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,fe,!0),document.addEventListener(`focusin`,V,!0),document.addEventListener(`focusout`,H,!0),document.addEventListener(`click`,U,!0),document.addEventListener(`keydown`,pe,!0),window.addEventListener(`scroll`,W,!0),window.addEventListener(`resize`,W),window.addEventListener(`blur`,()=>{d&&L()}),document.addEventListener(`visibilitychange`,()=>{document.hidden&&d&&L()}),document.documentElement.addEventListener(`mouseleave`,()=>{d&&L()}),document.addEventListener(`astro:after-swap`,()=>{A(),y+=1,m&&=(cancelAnimationFrame(m),0),g&&=(window.clearTimeout(g),0),d=null,p=!1,b=null,c?.isConnected&&c.remove(),c=null,l=null,u=null}))}var he=[`dashboard`,`tasks`,`todos`,`projects`,`iterations`,`pmRequirements`,`bugs`,`reports`,`testStats`,`caseExec`,`cases`,`prompts`,`knowledgeLib`,`requirements`,`templates`];function ge(e){return`pluginOff${e.charAt(0).toUpperCase()}${e.slice(1)}`}function G(){let e=document.documentElement;for(let n of he){let r=ge(n);t(n)?delete e.dataset[r]:e.dataset[r]=`1`}}function _e(){G(),n(()=>G()),e().then(()=>G()),document.addEventListener(`astro:page-load`,G)}var ve=`tw-update-dot`,ye=3e5,K=`tw.update.badge.checked-at.v1`,be=15e3,xe=4,q=0,J=null,Y=!1,X=`tw.update.stale.reload.v1`;function Se(e){let t=e.status?.phase;return t===`installing`||t===`restarting`}function Ce(e){if(e.mode===`dev`&&!Se(e)&&e.current&&e.current!==r){try{let e=Number(localStorage.getItem(X))||0;if(Date.now()-e<6e4)return;localStorage.setItem(X,String(Date.now()))}catch{}window.location.reload()}}function we(){try{return Number(localStorage.getItem(K))||0}catch{return 0}}function Te(){try{localStorage.setItem(K,String(Date.now()))}catch{}}function Z(e,t,n){e.hidden=!n,e.closest(`.tw-nav-brand-ver`)?.classList.toggle(`has-update`,n),n&&e.setAttribute(`aria-label`,t?`有新版本可用 v${t}`:`有新版本可更新`)}function Ee(e,t){q>=xe||(q+=1,J!==null&&window.clearTimeout(J),J=window.setTimeout(()=>{J=null,Q(e,t)},be))}async function Q(e,t){if(!Y){Y=!0;try{let n=await ee(t);if(!n){Ee(e,t);return}q=0,Te();let i=!!n.current&&n.current!==r;Z(e,n.latest,!!n.hasUpdate||i),i&&Ce(n)}finally{Y=!1}}}function $(){let e=document.getElementById(ve);if(!e)return;e.dataset.bound!==`1`&&(e.dataset.bound=`1`,e.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),window.dispatchEvent(new CustomEvent(i,{detail:{tab:`general`}}))}));let t=Date.now()-we()>ye;q=0,Q(e,t)}function De(){document.addEventListener(`astro:page-load`,$),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&$()}),document.readyState!==`loading`&&$()}me(),_e(),De();
@@ -0,0 +1,10 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/lib.S37S0T6S.js","_astro/react.Blvh0GOs.js","_astro/jszip.min.Bh2Mgo40.js"])))=>i.map(i=>d[i]);
2
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";import{t as i}from"./SelectDropdown.Dmk5n225.js";import{showToast as a}from"./Toast.BO2NFckG.js";import{i as o,r as s}from"./case-types.CprZTsyX.js";import{d as c,f as l,m as u,p as d,r as f,u as ee}from"./case-gen-run.CxlmN4EC.js";import{a as p}from"./case-fields.CmePqYfh.js";import{_ as m,c as h,f as g,l as _,p as v,r as y,u as b,v as x}from"./project-docs.DAw9bzgk.js";import{a as S,i as C,n as w,o as te,r as T,s as ne,t as re}from"./case-template.C-GBxgBC.js";import{b as E,m as ie,p as ae,u as oe}from"./settings.NTeTjmxg.js";import{o as se}from"./llm.DyweO-KK.js";import{n as D}from"./doc-roots.DAJP9Svr.js";import{r as ce}from"./prompts-meta.Dnmq-SnF.js";import{t as le}from"./ExcelFieldTags.CXif3Ilh.js";import{t as ue}from"./MultiSelectDropdown.y8JMbCxO.js";import{t as O}from"./SearchableSelect.DFZBUFIs.js";var k=e(t(),1),A=r(),de=[{value:`md`,label:`Markdown 表格`},{value:`xlsx`,label:`Excel`},{value:`csv`,label:`CSV`}];function fe(e){let t=e.match(/```(?:json)?\s*([\s\S]*?)```/)?.[1]??e.match(/\{[\s\S]*\}/)?.[0]??e.match(/\[[\s\S]*\]/)?.[0];if(!t)return null;try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length>0)return{docTitle:``,cases:e};if(e&&typeof e==`object`){let t=e,n=t.用例??t.cases??t.items;if(!Array.isArray(n)||n.length===0)return null;let r=t.需求名称??t.文档名称??t.docTitle??t.title;return{docTitle:typeof r==`string`?r.trim():``,cases:n}}}catch{return null}return null}function pe(e){return(e.split(`/`).pop()||e).replace(/\.[^.]+$/,``).trim()}function me(e){let t=e.match(/^#\s+(.+)$/m);if(t?.[1])return t[1].trim().slice(0,48);let n=e.match(/^标题[::]\s*(.+)$/m);return n?.[1]?n[1].trim().slice(0,48):``}function he(e,t){let n=[];if(!e.length)return n.push(`未生成任何用例`),n;for(let r of t){let t=e.filter(e=>!String(e[r]??``).trim()).length;t===e.length?n.push(`字段「${r}」全部为空`):t>Math.max(2,Math.floor(e.length*.3))&&n.push(`字段「${r}」有 ${t}/${e.length} 条为空`)}e.length<15&&n.push(`用例数量偏少(${e.length} 条),建议核对需求覆盖`);let r=e.map(e=>{for(let t of[`用例标题`,`标题`,`测试分项目`,`测试项目`])if(e[t]?.trim())return e[t].trim();return``}).filter(Boolean),i=new Set(r);return r.length>=4&&i.size<r.length*.6&&n.push(`用例标题/分项重复偏多,可能覆盖不足`),n}function ge(e){if(e==null||e<0)return`—`;if(e<1e3)return`${e} ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)} s`;let n=Math.floor(t/60);return`${n} 分 ${Math.round(t-n*60)} 秒`}function _e(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return`—`}}async function ve(e){let t=s(e).templateFolder;try{let{entries:e}=await h(`templates`,t),n=e.filter(e=>e.type===`file`).sort((e,t)=>(t.mtime??0)-(e.mtime??0)),r=[];for(let e of n){let t=e.name.toLowerCase(),n=[...p],i=``;try{if(t.endsWith(`.xlsx`)||t.endsWith(`.xls`)){let t=await g(`templates`,e.path);if(t.encoding===`base64`&&t.contentBase64){let e=C(t.contentBase64);n=e.headers,i=e.body}}else if(t.endsWith(`.csv`)){let t=await v(`templates`,e.path),r=w(t.content);n=r.headers,i=r.body}else if(t.endsWith(`.md`)||t.endsWith(`.txt`)){let t=await v(`templates`,e.path),r=T(t.content);n=r.headers,i=r.body}}catch{i=``}r.push({id:e.path,title:e.name.replace(/\.[^.]+$/,``),body:i,headers:n})}return r}catch{return[]}}async function j(t){let n=t.toLowerCase();if(n.endsWith(`.md`)||n.endsWith(`.txt`)||n.endsWith(`.csv`))return(await v(`requirements`,t)).content;if(n.endsWith(`.docx`)){let n=await g(`requirements`,t);if(n.encoding!==`base64`||!n.contentBase64)throw Error(`无法读取 docx`);let r=atob(n.contentBase64),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return((await(await E(()=>import(`./lib.S37S0T6S.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1,2]))).extractRawText({arrayBuffer:i.buffer})).value??``).trim()}throw Error(`该需求文件类型暂不支持正文提取`)}function M(){let[e,t]=(0,k.useState)(null),[r,g]=(0,k.useState)(!1),[C,w]=(0,k.useState)([]),[T,E]=(0,k.useState)(``),[M,N]=(0,k.useState)(`functional`),[P,ye]=(0,k.useState)([]),[be,F]=(0,k.useState)(``),[xe,Se]=(0,k.useState)([]),[I,L]=(0,k.useState)(``),[Ce,R]=(0,k.useState)(``),[we,Te]=(0,k.useState)([]),[z,B]=(0,k.useState)([]),[V,H]=(0,k.useState)(`md`),[U,Ee]=(0,k.useState)(``),[W,G]=(0,k.useState)(null),[K,De]=(0,k.useState)(!1),[Oe,q]=(0,k.useState)(null),[J,Y]=(0,k.useState)(null),X=(0,k.useRef)(null),ke=(0,k.useRef)(null),Z=(0,k.useMemo)(()=>P.find(e=>e.id===be)??P[0],[P,be]),Q=M,Ae=s(Q).label;(0,k.useEffect)(()=>{n().then(()=>t(oe()));let e=ae(()=>t(oe()));return(async()=>{await c();let e=await y(`requirements`),t=await y(`cases`),n=await y(`templates`),r=await y(`prompts`),i=await y(`knowledge`);g(e&&t&&n&&r);async function a(e,t,n){let{entries:r}=await h(e,t);for(let t of r)t.type===`file`?n.push(t):await a(e,t.path,n)}if(e)try{let e=[];await a(`requirements`,`.`,e),w(e)}catch{}if(i)try{let e=[];await a(`knowledge`,`.`,e),e.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),Te(e)}catch{}if(r)try{let e=[];await a(`prompts`,`.`,e);let t=e.filter(e=>!ce(e.path));t.sort((e,t)=>(t.mtime??0)-(e.mtime??0)),Se(t);let n=t.find(e=>e.path.includes(`功能测试用例提示词`))?.path??t[0]?.path??``;L(e=>e&&!ce(e)&&t.some(t=>t.path===e)?e:n)}catch{}let s=new URLSearchParams(window.location.search),d=s.get(`session`),f=s.get(`path`),p=l();if(d){let e=p.sessions.find(e=>e.id===d);e&&(G(e),N(e.caseType),H(e.outputFormat),E(e.reqPaths[0]??``),e.templateId&&F(e.templateId),e.promptPath&&L(e.promptPath),e.knowledgePaths?.length&&B([...e.knowledgePaths]),e.linkedCasePath&&Y({path:e.linkedCasePath,count:0}))}else if(f){let e=p.sessions.find(e=>e.linkedCasePath===f);if(e)G(e),N(e.caseType),H(e.outputFormat),E(e.reqPaths[0]??``),e.templateId&&F(e.templateId),e.promptPath&&L(e.promptPath),e.knowledgePaths?.length&&B([...e.knowledgePaths]),e.linkedCasePath&&Y({path:e.linkedCasePath,count:0});else{let e=f.split(`.`).pop()?.toLowerCase(),t=e===`csv`?`csv`:e===`xlsx`||e===`xls`?`xlsx`:`md`,n=f.split(`/`)[0]??``,r=o().find(e=>e.casesFolder===n)?.id??o()[0]?.id??`functional`,i=ee({title:f.split(`/`).pop()?.replace(/\.[^.]+$/,``)||`用例续改`,caseType:r,outputFormat:t,reqPaths:[]}),a=u(i.id,{linkedCasePath:f}).sessions.find(e=>e.id===i.id)??null;G(a),N(r),H(t),Y({path:f,count:0})}}})(),e},[]),(0,k.useEffect)(()=>{if(!r)return;let e=!1;return ve(M).then(t=>{e||(ye(t),F(e=>e&&t.some(t=>t.id===e)?e:W?.templateId&&t.some(e=>e.id===W.templateId)?W.templateId:t[0]?.id??``))}),()=>{e=!0}},[r,M,W?.templateId]),(0,k.useEffect)(()=>{I?v(`prompts`,I).then(e=>{let t=e.content??``;R(t),t.trim()||a(`「提示词管理/${I}」是空的,生成前请先补上提示词内容。`,`error`)}).catch(e=>{R(``);let t=e instanceof Error?e.message:String(e);a(`没有读到「提示词管理/${I}」:${t}`,`error`)}):R(``)},[I]),(0,k.useEffect)(()=>{ke.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[W?.messages,K]);function $(e){if(!W)return;let t=u(W.id,e);G(t.sessions.find(e=>e.id===W.id)??W)}async function je(){let e=``;if(T)try{let t=await j(T);e+=`\n### 需求文档:${T}\n${t}\n`}catch{e+=`\n### 需求文档:${T}\n(无法读取正文)\n`}Z?.body?e+=`\n### 用例模板:${Z.title}\n${Z.body}\n`:Z&&(e+=`\n### 用例模板:${Z.title}\n字段:${(Z.headers.length?Z.headers:p).join(`、`)}\n`);for(let t of z)try{let n=await v(`knowledge`,t);e+=`\n### 知识库:${t}\n${n.content}\n`}catch{e+=`\n### 知识库:${t}\n(无法读取)\n`}return e}async function Me(e,t,n,r){let i=s(t.caseType),a=n||t.title||i.label,o=f(a,t.caseType),c=i.casesFolder;try{await _(`cases`,`.`,c)}catch{}let l=`${c}/${o}${t.outputFormat===`md`?`.md`:t.outputFormat===`csv`?`.csv`:`.xlsx`}`,u=r.length?r:[...p];return t.outputFormat===`md`?await x(`cases`,l,te(e,a,u)):t.outputFormat===`csv`?await x(`cases`,l,S(e,u)):await m(`cases`,l,await ne(e,u,i.label)),l}async function Ne(){if(!T)return``;let e=pe(T);try{return me(await j(T))||e}catch{return e}}async function Pe(t,n){if(!e){ie(`model`);return}if(!r){q(`本地文档服务未就绪,无法读写用例 / 需求 / 模板库`);return}let i=await Ne(),o=n;o?(u(o.id,{caseType:M,outputFormat:V,reqPaths:T?[T]:[],templateId:Z?.id,templateTitle:Z?.title,promptPath:I||void 0,knowledgePaths:z.length?[...z]:void 0}),o={...o,caseType:M,outputFormat:V,reqPaths:T?[T]:[],templateId:Z?.id,templateTitle:Z?.title,promptPath:I||void 0,knowledgePaths:z.length?[...z]:void 0}):(o=ee({title:i||t.slice(0,24)||`用例生成`,caseType:M,outputFormat:V,reqPaths:T?[T]:[],templateId:Z?.id,templateTitle:Z?.title,promptPath:I||void 0,knowledgePaths:z.length?[...z]:void 0}),G(o));let c=await je(),l=s(M).label,d=Z?.headers?.length?Z.headers:[...p],f=V===`md`?`最终结果将保存为 Markdown 表格文件`:V===`csv`?`最终结果将保存为 CSV 文件`:`最终结果将保存为 Excel 文件`,m=Ce.trim();if(!m){let e=I?`「提示词管理/${I}」没读到内容,请先在提示词管理里补上`:`请先选择提示词`;q(e),a(e,`error`);return}let h=`${m}
3
+
4
+ 【运行时约束】
5
+ - 用例类型:${l}
6
+ - ${f}
7
+ - 需求名称默认可用「${i||`未命名需求`}」
8
+ - 「用例」对象键必须与模板字段完全一致(另可多写「备注」):${d.includes(`备注`)?d.join(`、`):[...d,`备注`].join(`、`)}
9
+ - 「待业务确认 / 待确认」项也要写成用例,在「备注」写「待业务确认:…」,不要只丢进未覆盖说明
10
+ - 仅输出 JSON 对象:{"需求名称":"...","覆盖需求率":0-100,"未覆盖说明":[],"编写说明":"...","用例":[...]},不要其他解释`,g=[{role:`system`,content:h},{role:`user`,content:`${c}\n\n【用户请求】\n${t}`}];if(n&&n.messages.length){g.length=0,g.push({role:`system`,content:h});for(let e of n.messages.slice(-8))(e.role===`user`||e.role===`assistant`)&&g.push({role:e.role,content:e.content});g.push({role:`user`,content:t})}let _=Date.now(),v={role:`user`,content:t,time:_},y={role:`assistant`,content:``,time:_,result:{ok:!1,count:0}},b=[...o.messages||[],v,y],x=o.messages.length>0?o.title:i||t.slice(0,24)||o.title;o={...o,messages:b,title:x},G(o),u(o.id,{messages:b,title:o.title}),De(!0),q(null);let S=new AbortController;X.current=S;let C=``;function w(e,t=``){let n=[...b];n[n.length-1]={role:`assistant`,content:t,time:Date.now(),result:e};let r={messages:n,outputFormat:o.outputFormat,caseType:o.caseType};e.ok&&e.path&&(r.linkedCasePath=e.path,e.path&&Y({path:e.path,count:e.count}));let i=u(o.id,r);G(i.sessions.find(e=>e.id===o.id)??null)}try{for await(let t of se(e,g,S.signal,{thinking:!1}))t.type===`content`&&(C+=t.delta);let t=Date.now()-_,n=fe(C);if(n){let e=Z?.headers?.length?Z.headers:[...p],r=re(n.cases,e),a=i||o.title||n.docTitle||s(o.caseType).label,c=await Me(r,{...o,title:a},a,e),l=he(r,e);u(o.id,{title:a}),w({ok:!0,count:r.length,path:c,durationMs:t,finishedAt:Date.now(),omissions:l})}else{let e=`未能解析出用例 JSON`;q(`${e},可调整提示词或需求后重试。`),w({ok:!1,count:0,durationMs:t,finishedAt:Date.now(),error:e,omissions:[`输出无法解析,未写入用例文件`]})}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)w({ok:!1,count:0,durationMs:Date.now()-_,finishedAt:Date.now(),error:`已停止`,omissions:[`用户停止生成`]});else{let t=e instanceof Error?e.message:String(e);q(t),w({ok:!1,count:0,durationMs:Date.now()-_,finishedAt:Date.now(),error:t,omissions:[`生成过程中断或失败`]})}}finally{De(!1),X.current=null}}async function Fe(){let e=U.trim();e&&!K&&(Ee(``),await Pe(e,W??void 0))}let Ie=!!U.trim()&&!K,Le=C.map(e=>({value:e.path,label:e.path})),Re=P.map(e=>({value:e.id,label:e.title})),ze=xe.map(e=>({value:e.path,label:e.path.replace(/\.[^.]+$/,``)}));return(0,A.jsxs)(`div`,{className:`flex flex-col gap-4 max-w-4xl mx-auto`,children:[r?null:(0,A.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900`,children:`本地文档服务未就绪,无法读写需求 / 模板 / 提示词 / 用例库。`}),(0,A.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-4 space-y-4`,children:[(0,A.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:`用例类型`}),(0,A.jsx)(i,{options:o().map(e=>({value:e.id,label:e.label})),value:Q,onChange:e=>{N(e),$({caseType:e})}})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:`输出格式`}),(0,A.jsx)(i,{options:de,value:V,onChange:e=>{if(H(e),W?.linkedCasePath){let t=`${W.linkedCasePath.replace(/\.[^.]+$/,``)}${e===`md`?`.md`:e===`csv`?`.csv`:`.xlsx`}`;$({outputFormat:e,linkedCasePath:t}),Y(e=>e?{...e,path:t}:{path:t,count:0})}else $({outputFormat:e})}})]})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-0.5`,children:`需求文档`}),(0,A.jsx)(O,{options:Le,value:T,onChange:e=>{E(e),$({reqPaths:e?[e]:[]})},allowEmpty:!1,placeholder:`未选择需求文档`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`text-xs font-medium text-stone-500 mb-0.5`,children:[`用例模板`,(0,A.jsxs)(`span`,{className:`ml-1 font-normal text-stone-400`,children:[`(`,Ae,` · `,s(Q).templateFolder,`)`]})]}),(0,A.jsx)(O,{options:Re,value:Z?.id??``,onChange:e=>{F(e),$({templateId:e,templateTitle:P.find(t=>t.id===e)?.title})},allowEmpty:!1,placeholder:Re.length?`搜索并选择模板…`:`暂无「${s(Q).templateFolder}」模板`}),Z?.headers?.length?(0,A.jsx)(le,{fields:Z.headers}):Z?(0,A.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400`,children:`未识别到模板字段`}):null]})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-0.5`,children:`提示词`}),(0,A.jsx)(O,{options:ze,value:I,onChange:e=>{L(e),$({promptPath:e||void 0})},allowEmpty:!1,placeholder:ze.length?`搜索并选择提示词…`:`请先在提示词管理中上传`})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-0.5`,children:`引用知识库(可多选)`}),(0,A.jsx)(ue,{options:we.map(e=>({value:e.path,label:e.path.replace(/\.[^.]+$/,``)})),values:z,onChange:e=>{B(e),$({knowledgePaths:e.length?e:void 0})},placeholder:we.length?`选择知识库文档…`:`暂无知识库文档`})]})]}),W?.linkedCasePath&&!J?(0,A.jsxs)(`p`,{className:`text-xs text-emerald-700 bg-emerald-50 border border-emerald-100 rounded-md px-3 py-2`,children:[`已关联用例文件:`,D(`cases`),W.linkedCasePath]}):null]}),(0,A.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-[#f8f9fb] flex flex-col h-[min(520px,60vh)]`,children:[(0,A.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-4 py-4 space-y-3`,children:[W?.messages.length?(()=>{let e=[];for(let t of W.messages)if(t.role===`user`)e.push({user:t});else if(t.role===`assistant`){let n=e[e.length-1];n&&!n.assistant?n.assistant=t:e.push({assistant:t})}return e.map((t,n)=>{let r=n===e.length-1,i=K&&r&&!t.assistant?.result?.finishedAt,a=t.assistant?.result;return(0,A.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 items-stretch`,children:[(0,A.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-3 py-3 min-h-22`,children:[(0,A.jsx)(`div`,{className:`text-[11px] font-medium text-stone-400 mb-1.5`,children:`提问`}),(0,A.jsx)(`div`,{className:`text-sm text-stone-800 whitespace-pre-wrap leading-6`,children:t.user?.content||`—`})]}),(0,A.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-3 py-3 min-h-22`,children:[(0,A.jsx)(`div`,{className:`text-[11px] font-medium text-stone-400 mb-1.5`,children:`生成结果`}),i?(0,A.jsx)(`div`,{className:`text-sm text-[#4176e6]`,children:`生成中…`}):a?(0,A.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,A.jsx)(`span`,{className:`inline-flex items-center h-6 px-2 rounded-md text-xs font-medium ${a.ok?`bg-emerald-50 text-emerald-700`:`bg-red-50 text-red-700`}`,children:a.ok?`成功`:`失败`}),(0,A.jsx)(`span`,{className:`text-xs text-stone-500`,children:_e(a.finishedAt??t.assistant?.time)}),(0,A.jsxs)(`span`,{className:`text-xs text-stone-500`,children:[`耗时 `,ge(a.durationMs)]})]}),(0,A.jsxs)(`div`,{className:`text-stone-700`,children:[`用例数量:`,(0,A.jsx)(`span`,{className:`font-medium text-stone-900`,children:a.count}),` 条`]}),a.path?(0,A.jsxs)(`button`,{type:`button`,className:`text-xs text-[#4176e6] hover:underline text-left truncate max-w-full`,"data-hint":`本地打开`,onClick:()=>void b(`cases`,a.path).catch(e=>q(e instanceof Error?e.message:String(e))),children:[D(`cases`),a.path]}):null,a.error?(0,A.jsx)(`div`,{className:`text-xs text-red-600`,children:a.error}):null,(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1`,children:`遗漏检测`}),a.omissions&&a.omissions.length>0?(0,A.jsx)(`ul`,{className:`text-xs text-amber-800 bg-amber-50 border border-amber-100 rounded-md px-2.5 py-2 space-y-1`,children:a.omissions.map(e=>(0,A.jsxs)(`li`,{children:[`· `,e]},e))}):a.ok?(0,A.jsx)(`div`,{className:`text-xs text-emerald-700 bg-emerald-50 border border-emerald-100 rounded-md px-2.5 py-2`,children:`未发现明显遗漏`}):(0,A.jsx)(`div`,{className:`text-xs text-stone-400`,children:`—`})]})]}):(0,A.jsx)(`div`,{className:`text-sm text-stone-400`,children:`等待结果`})]})]},n)})})():(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-stone-400 py-16`,children:`选择上下文后,在下方输入需求说明并提交,将创建一条用例会话。`}),(0,A.jsx)(`div`,{ref:ke})]}),Oe?(0,A.jsx)(`div`,{className:`shrink-0 mx-4 mb-2 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:Oe}):null,J?(0,A.jsxs)(`div`,{className:`shrink-0 mx-4 mb-3`,children:[(0,A.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:`生成的用例文件`}),(0,A.jsxs)(`button`,{type:`button`,"data-hint":`点击在本地打开`,onClick:()=>{b(`cases`,J.path).catch(e=>q(e instanceof Error?e.message:String(e)))},onDoubleClick:()=>{b(`cases`,J.path).catch(e=>q(e instanceof Error?e.message:String(e)))},className:`w-full flex items-center gap-3 rounded-lg border border-stone-200 bg-white px-3 py-2.5 text-left hover:border-[#4176e6] hover:bg-[#f5f8ff] transition-colors`,children:[(0,A.jsx)(`span`,{className:`w-9 h-9 rounded-lg bg-emerald-50 text-emerald-700 flex items-center justify-center text-xs font-semibold shrink-0`,children:J.path.split(`.`).pop()?.toUpperCase()||`FILE`}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`span`,{className:`block text-sm text-stone-800 truncate`,children:J.path.split(`/`).pop()}),(0,A.jsxs)(`span`,{className:`block text-[11px] text-stone-400 truncate`,children:[D(`cases`),J.path,J.count>0?` · ${J.count} 条`:``,` · 点击打开`]})]})]})]}):null,(0,A.jsxs)(`div`,{className:`shrink-0 p-3 border-t border-stone-200 bg-white rounded-b-xl`,children:[(0,A.jsxs)(`div`,{className:`rounded-2xl border border-stone-200 focus-within:ring-2 focus-within:ring-[#4176e6]/25`,children:[(0,A.jsx)(`textarea`,{value:U,onChange:e=>Ee(e.target.value),rows:3,placeholder:e?`描述要生成或修改的用例… Enter 发送,Shift+Enter 换行`:`请先配置模型`,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),Fe())},className:`w-full px-4 pt-3 pb-2 text-sm resize-none outline-none bg-transparent`}),(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-3 pb-2`,children:[e?null:(0,A.jsx)(`button`,{type:`button`,onClick:()=>ie(`model`),className:`text-xs text-amber-700 hover:underline`,children:`配置模型`}),K?(0,A.jsx)(`button`,{type:`button`,onClick:()=>X.current?.abort(),className:`h-8 px-3 text-sm rounded-full bg-stone-200 text-stone-700`,children:`停止`}):null,(0,A.jsx)(`button`,{type:`button`,disabled:!Ie,onClick:()=>void Fe(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-full hover:bg-[#3565c7] disabled:opacity-40`,children:`提交`})]})]}),W?(0,A.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-stone-400 hover:text-stone-600`,onClick:()=>{G(null),Y(null),q(null);let e=l();d({...e,activeId:``})},children:`开始新的用例会话`}):null]})]})]})}export{M as default};
@@ -0,0 +1,21 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/case-fields.CmePqYfh.js","_astro/react.Blvh0GOs.js","_astro/lib.S37S0T6S.js","_astro/jszip.min.Bh2Mgo40.js"])))=>i.map(i=>d[i]);
2
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{i as r,o as i,s as a}from"./plugins.C0NrHGZv.js";import{n as o,o as s,r as c,s as l}from"./view-prefs.8MPl3A7e.js";import{i as u,n as d,r as f,t as p}from"./dialog.DZHZCe_T.js";import{t as m}from"./jsx-runtime.DUg_B_vD.js";import{t as h}from"./ConfirmDialog.D5qXeML0.js";import{n as g,t as _}from"./DocsPager.D0TMvJ67.js";import{t as v}from"./OverflowHint.pvo2Xc8R.js";import{t as y}from"./SelectDropdown.Dmk5n225.js";import{t as b}from"./SlideOverDrawer.C1IVOc_8.js";import{m as x}from"./PmShared.D6iq_Z9g.js";import{n as S,r as C,t as w}from"./TableFieldConfig.C_NeWm8L.js";import{showToast as T}from"./Toast.BO2NFckG.js";import{i as E,n as D,o as O}from"./case-gen-run.CxlmN4EC.js";import{a as ee,i as k,r as A,t as j}from"./case-fields.CmePqYfh.js";import{c as M,d as te,f as N,g as P,h as ne,n as re,o as F,p as I,r as ie,u as ae}from"./project-docs.DAw9bzgk.js";import{c as oe}from"./case-template.C-GBxgBC.js";import{b as se,p as ce,s as le,u as ue}from"./settings.NTeTjmxg.js";import{M as de,v as fe,z as pe}from"./req-analysis.BAC_bd4R.js";import{s as me}from"./llm.DyweO-KK.js";import{n as he}from"./doc-roots.DAJP9Svr.js";import{i as ge,n as _e,r as ve,t as ye}from"./DocsFileBrowser.DceJyP9V.js";import{d as L,f as be,h as R,l as xe,n as Se,o as Ce,p as z,t as we,v as B}from"./open-docs-in-session.5cTowYAC.js";import{A as Te,C as V,D as Ee,E as H,M as De,N as Oe,O as U,P as ke,S as Ae,T as je,_ as Me,a as W,b as Ne,c as G,d as Pe,f as Fe,g as Ie,h as Le,j as Re,k as ze,l as Be,m as Ve,n as He,o as Ue,p as K,s as q,t as J,u as We,v as Ge,w as Ke,x as qe,y as Je}from"./case-review.TdDs1WFM.js";import{a as Ye,c as Xe,d as Ze,i as Qe,l as $e,n as et,o as tt,t as Y}from"./ColumnResize.CkE59sGq.js";import{t as nt}from"./NamePromptDialog.Csfnh5eM.js";import{o as rt,r as it,s as at,t as ot}from"./composer-task.DJmluzPT.js";var X=e(t(),1),st=`备份列表`;function ct(e){return String(e??``).replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()===st}function lt(e){let t=String(e??``).split(/[/\\]/).pop();return t?/\.bak(?:$|[-_.])/i.test(t):!1}var Z=m(),ut=40,dt=20,ft=`tw.case-backup.page-size.v1`,pt=[{key:`select`,width:ut,min:36},{key:`name`,width:280,min:140},{key:`kind`,width:100,min:72},{key:`mtime`,width:148,min:120},{key:`size`,width:88,min:64},{key:`filler`,filler:!0},{key:`action`,width:72,min:64}];async function mt(e=`.`){let{entries:t}=await M(`cases`,e),n=[];for(let e of t)e.type===`file`?(lt(e.name)||lt(e.path))&&n.push(e):!ct(e.name)&&!ct(e.path)&&n.push(...await mt(e.path));return n}function ht(e){return e===`folder`?`备份列表`:e===`sidecar`?`旁路`:`历史`}function gt(e){if(!Number.isFinite(e))return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return`—`}}function _t(e){return e==null||!Number.isFinite(e)?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function vt(){let e=[];try{if(await je()){let t=await V();for(let n of t){let t=n.kind===`legacy`?`legacy`:`folder`,r=n.casesPath||(t===`folder`?n.path:``);e.push({id:`${t}:${n.name}:${n.mtime}`,kind:t,name:n.name,path:r||n.path,reviewName:t===`legacy`?n.name:void 0,mtime:n.mtime,size:n.size})}}}catch{}try{let t=await mt(`.`);for(let n of t){let t=typeof n.mtime==`number`?n.mtime:0;e.push({id:`sidecar:${n.path}`,kind:`sidecar`,name:n.name,path:n.path,mtime:t,size:n.size})}}catch{}return e.sort((e,t)=>t.mtime-e.mtime),e}function yt({open:e,onClose:t,onChanged:n}){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)({}),[p,m]=(0,X.useState)(null),[y,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(``),[E,D]=(0,X.useState)(1),[O,ee]=g(dt,ft),k=$e(`lh:case-backup:cols:v4`,pt),A=Ze(`case-backup`),j=(0,X.useCallback)(async()=>{o(!0),u(null);try{let e=await vt();i(e),f(t=>{let n={};for(let r of e)t[r.id]&&(n[r.id]=!0);return n})}catch(e){u(e instanceof Error?e.message:String(e))}finally{o(!1)}},[]);(0,X.useEffect)(()=>{e&&(D(1),j())},[e,j]);let M=Math.max(1,Math.ceil(r.length/O)),N=Math.min(E,M),P=(0,X.useMemo)(()=>r.slice((N-1)*O,N*O),[r,N,O]),F=(0,X.useMemo)(()=>Object.keys(d).filter(e=>d[e]),[d]),I=P.length>0&&P.every(e=>d[e.id]);async function ie(e){c(!0),u(null);try{let t=e.filter(e=>e.kind===`folder`||e.kind===`sidecar`),r=e.filter(e=>e.kind===`legacy`);for(let e of t)await re(`cases`,e.path);r.length&&await Je(r.map(e=>e.reviewName||e.name)),T(e.length===1?`已删除「${e[0].name}」`:`已删除 ${e.length} 个备份`,`success`),await j(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);u(t),T(`删除失败:${t}`,`error`)}finally{c(!1)}}async function oe(){let e=p;if(m(null),!e)return;if(e.kind===`one`){await ie([e.row]);return}let t=new Map(r.map(e=>[e.id,e])),n=e.ids.map(e=>t.get(e)).filter(Boolean);n.length&&await ie(n)}async function se(e){if(e.kind!==`legacy`)try{await ae(`cases`,e.path)}catch(e){u(e instanceof Error?e.message:String(e))}}function ce(e){e.kind!==`legacy`&&(w(``),S(e))}async function le(e){let t=y;if(!t||t.kind===`legacy`)return;let i=e.trim();if(!i||i===t.name){S(null),w(``);return}let a=te(t.path),o=(a===`.`?i:`${a}/${i}`).toLowerCase(),s=r.find(e=>e.id!==t.id&&e.kind!==`legacy`&&e.path.toLowerCase()===o);if(s)w(`已存在同名文件「${s.name}」,换个名字再试`);else{c(!0),u(null),w(``);try{await ne(`cases`,t.path,i),S(null),T(`已重命名为「${i}」`,`success`),await j(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);w(t),T(`重命名失败:${t}`,`error`)}finally{c(!1)}}}let ue=p?.kind===`one`?`删除备份「${p.row.name}」?此操作不可恢复。`:p?.kind===`batch`?`确认删除已选中的 ${p.ids.length} 个备份?此操作不可恢复。`:``;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(b,{open:e,onClose:t,title:`备份列表`,closeAriaLabel:`关闭备份列表`,widthClass:`max-w-5xl`,bodyClassName:`flex flex-col gap-3 overflow-hidden`,escDisabled:!!p||y!=null,footer:(0,Z.jsxs)(`footer`,{className:`shrink-0 p-4 border-t border-stone-100 flex items-center gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:s||F.length===0,onClick:()=>m({kind:`batch`,ids:F}),className:`h-9 px-3 text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:[`删除所选`,F.length?`(${F.length})`:``]}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsx)(`button`,{type:`button`,disabled:s||a,onClick:()=>void j(),className:`h-9 px-3 text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40`,children:`刷新`}),(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`h-9 px-3 text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50`,children:`关闭`})]}),children:[(0,Z.jsxs)(`p`,{className:`shrink-0 text-xs text-stone-500 leading-5`,children:[`新备份在「用例管理/`,st,`/」(首次备份时自动创建,主列表不展示该文件夹)。历史旁路 .bak* 仍可在此查看。备份不会自动过期,请手动删除。`]}),l?(0,Z.jsx)(`div`,{className:`shrink-0 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:l}):null,(0,Z.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 text-xs text-stone-500`,children:[(0,Z.jsxs)(`span`,{children:[`共 `,(0,Z.jsx)(`span`,{className:`font-medium text-stone-800`,children:r.length}),` 个`]}),a?(0,Z.jsx)(`span`,{children:`加载中…`}):null]}),r.length===0&&!a?(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 rounded-xl border border-dashed border-stone-200 px-4 py-10 flex items-center justify-center text-sm text-stone-400`,children:`暂无备份文件`}):(0,Z.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-hidden rounded-xl border border-stone-200 flex flex-col`,children:[(0,Z.jsx)(`div`,{ref:A,className:`tw-scroll-x flex-1 min-h-0 overflow-auto`,children:(0,Z.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-left text-sm`,style:k.tableStyle,children:[(0,Z.jsx)(`colgroup`,{children:pt.map(e=>(0,Z.jsx)(`col`,{style:k.widthOf(e.key)?{width:k.widthOf(e.key)}:void 0},e.key))}),(0,Z.jsx)(`thead`,{className:`bg-stone-50 text-xs text-stone-500`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:`${Ye} relative`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:I,disabled:s||P.length===0,onChange:e=>{let t=e.target.checked;f(e=>{let n={...e};for(let e of P)t?n[e.id]=!0:delete n[e.id];return n})},"aria-label":`全选本页备份`}),(0,Z.jsx)(Y,{...k.resizeProps(`select`)})]}),(0,Z.jsxs)(`th`,{className:tt,style:{"--tw-sticky-left":`${ut}px`},children:[`文件名`,(0,Z.jsx)(Y,{...k.resizeProps(`name`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`类型`,(0,Z.jsx)(Y,{...k.resizeProps(`kind`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`备份时间`,(0,Z.jsx)(Y,{...k.resizeProps(`mtime`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`大小`,(0,Z.jsx)(Y,{...k.resizeProps(`size`)})]}),(0,Z.jsx)(`th`,{"aria-hidden":`true`}),(0,Z.jsx)(`th`,{className:Xe,children:`操作`})]})}),(0,Z.jsx)(`tbody`,{children:P.map(e=>(0,Z.jsxs)(`tr`,{className:`group border-t border-stone-100 ${e.kind===`legacy`?``:`cursor-pointer`}`,onDoubleClick:()=>{e.kind===`legacy`||s||se(e)},children:[(0,Z.jsx)(`td`,{className:et,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!d[e.id],disabled:s,onChange:t=>f(n=>({...n,[e.id]:t.target.checked})),"aria-label":`选择 ${e.name}`})}),(0,Z.jsx)(`td`,{className:`${et} min-w-0 max-w-0`,style:{"--tw-sticky-left":`${ut}px`},children:(0,Z.jsxs)(`div`,{className:`inline-flex min-w-0 max-w-full items-center`,children:[(0,Z.jsx)(v,{text:e.name,className:`min-w-0 truncate font-medium text-stone-800`}),e.kind===`legacy`?null:(0,Z.jsx)(`span`,{className:`ml-0.5 mr-1 flex shrink-0 items-center opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100`,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`button`,{type:`button`,disabled:s,"aria-label":`重命名 ${e.name}`,onClick:()=>ce(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,Z.jsx)(x,{name:`pencil`,size:12})})})]})}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:ht(e.kind)}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:gt(e.mtime)}),(0,Z.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap tabular-nums`,children:_t(e.size)}),(0,Z.jsx)(`td`,{"aria-hidden":`true`}),(0,Z.jsx)(`td`,{className:Qe,onDoubleClick:e=>e.stopPropagation(),children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 whitespace-nowrap`,children:(0,Z.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>m({kind:`one`,row:e}),className:`h-7 px-2 text-xs font-medium text-red-600 rounded-md hover:bg-red-50 disabled:opacity-40`,children:`删除`})})})]},e.id))})]})}),r.length>0?(0,Z.jsx)(_,{page:N,totalPages:M,pageSize:O,busy:s||a,className:`shrink-0 !px-4 !py-2`,onPage:D,onPageSize:e=>{ee(e),D(1)}}):null]})]}),(0,Z.jsx)(h,{open:!!p,title:p?.kind===`batch`?`批量删除备份`:`删除备份`,message:ue,confirmLabel:`删除`,danger:!0,onClose:()=>m(null),onConfirm:()=>void oe()}),(0,Z.jsx)(nt,{open:y!=null,title:`重命名备份`,label:`文件名称`,placeholder:`请输入文件名`,initialValue:y?.name??``,lockExtension:!0,confirmLabel:`保存`,cancelLabel:`取消`,error:C,onClose:()=>{s||(S(null),w(``))},onConfirm:e=>void le(e)})]})}async function bt(e){let t=[...pe(e.outline??[]).entries()].sort((e,t)=>e[1]-t[1]).map(([e])=>e),n=new Map((e.stories??[]).map(e=>[e.id.toUpperCase(),e.sourceRefs??[]])),r=[];if(e.sourcePath)try{let t=await xt(e.sourcePath);r=fe(t)}catch{r=[]}return{outlineOrder:t,testPointIds:e.testPoints?.points?.map(e=>e.id)??void 0,idealOrder:r,storySourceRefs:n}}async function xt(t){let n=t.toLowerCase();if(n.endsWith(`.xlsx`)||n.endsWith(`.xls`)){let e=await N(`requirements`,t);if(e.encoding!==`base64`||!e.contentBase64)throw Error(`无法读取 Excel`);let n=await se(()=>import(`./case-fields.CmePqYfh.js`).then(e=>e.d),__vite__mapDeps([0,1])),r=n.read(e.contentBase64,{type:`base64`,cellDates:!0}),i=[];for(let e of r.SheetNames){let t=r.Sheets[e];if(!t)continue;let a=n.utils.sheet_to_csv(t,{blankrows:!1}).trim();a&&i.push(`## 工作表:${e}\n${a}`)}return i.join(`
3
+
4
+ `).trim()}if(n.endsWith(`.docx`)){let n=await N(`requirements`,t);if(n.encoding!==`base64`||!n.contentBase64)throw Error(`无法读取 docx`);let r=atob(n.contentBase64),i=new Uint8Array(r.length);for(let e=0;e<r.length;e+=1)i[e]=r.charCodeAt(e);return((await(await se(()=>import(`./lib.S37S0T6S.js`).then(t=>e(t.default,1)),__vite__mapDeps([2,1,3]))).extractRawText({arrayBuffer:i.buffer})).value??``).trim()}return(await I(`requirements`,t)).content}async function St(){try{return await de()}catch{return[]}}function Ct(e,t){let n=A(t).no;return n?e.map((e,t)=>({...e,[n]:String(t+1)})):e}async function wt(e,t={}){let n=await oe(e),r=O(n.rows,n.headers,{outlineOrder:t.outlineOrder,testPointIds:t.testPointIds,idealOrder:t.idealOrder,storySourceRefs:t.storySourceRefs}),i=r.filter((e,t)=>e!==n.rows[t]).length,a=Ct(r,n.headers),o=A(n.headers),s=o.no,c=o.title,l=o.reqCite,u=a.slice(0,5).map(e=>({no:s?String(e[s]??``):``,title:c?String(e[c]??``):``,cite:l?String(e[l]??``):``}));return{casePath:e,headers:n.headers,rows:a,moved:i,total:a.length,preview:u}}async function Tt(e){let t=await Ge(e.casePath);return{backup:(await Re(e.casePath,e.headers,e.rows)).backup||t.backup}}var Et=`__none__`;function Dt({open:e,casePath:t,fileName:n,onClose:r,onDone:i,onError:a}){let[o,s]=(0,X.useState)([]),[c,l]=(0,X.useState)(Et),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(!1),[v,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(``);(0,X.useEffect)(()=>{if(!e)return;let t=!0;return l(Et),h(null),S(``),b(!1),(async()=>{try{let e=await St();if(!t)return;s(e)}catch{t&&s([])}})(),()=>{t=!1}},[e]);let C=(0,X.useCallback)(async()=>{if(c===Et)return{};let e=o.find(e=>e.id===c);if(!e)return{};try{return await bt(e)}catch{return{outlineOrder:void 0,testPointIds:e.testPoints?.points?.map(e=>e.id)}}},[c,o]);(0,X.useEffect)(()=>{if(!e||!t)return;let n=!0;return _(!0),S(``),(async()=>{try{let e=await wt(t,await C());n&&h(e)}catch(e){if(!n)return;h(null),S(e instanceof Error?e.message:String(e))}finally{n&&_(!1)}})(),()=>{n=!1}},[e,t,C]);let w=(0,X.useMemo)(()=>[{value:Et,label:`仅按引用编号(RO / TP)`,muted:!0},...o.map(e=>({value:e.id,label:e.title||e.sourceTitle||e.id,secondary:e.sourcePath}))],[o]);async function T(){if(m&&!v){if(m.moved===0)i(`用例顺序已是最终顺序,文件未改动`),r();else{b(!0),S(``);try{await Tt(m),i(`已重排 ${m.total} 条用例(移动 ${m.moved} 行),原文件已备份到「备份列表」`),r()}catch(e){let t=e instanceof Error?e.message:String(e);S(t),a(`重排失败:${t}`)}finally{b(!1)}}}}return(0,Z.jsxs)(f,{open:e,onClose:()=>v?void 0:r(),className:`relative z-110`,children:[(0,Z.jsx)(p,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,Z.jsxs)(u,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim flex w-full max-w-lg flex-col rounded-xl border border-stone-200 bg-white p-5 shadow-xl`,children:[(0,Z.jsx)(d,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:`按需求重排用例`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-stone-500 break-all`,children:n}),(0,Z.jsxs)(`div`,{className:`mt-4`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:`需求来源`}),(0,Z.jsx)(y,{options:w,value:c,onChange:l,ariaLabel:`重排依据的需求分析记录`,className:`mt-1.5`,disabled:v}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-stone-400`,children:`排序口径:需求条目(RO)→ 条目内测试点(TP)→ 原文件顺序;用例编号会按新顺序重编为 1…N。`})]}),(0,Z.jsx)(`div`,{className:`mt-4 rounded-lg border border-stone-200 bg-stone-50/60 p-3`,children:g?(0,Z.jsx)(`p`,{className:`text-xs text-stone-500`,children:`正在计算排序结果…`}):m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-xs text-stone-600`,children:[`共 `,m.total,` 条用例,需要移动`,` `,(0,Z.jsx)(`span`,{className:`font-semibold tabular-nums`,children:m.moved}),` 行`,m.moved===0?`(已是最终顺序)`:``]}),m.preview.length?(0,Z.jsxs)(`table`,{className:`mt-2 w-full table-fixed border-collapse text-[11px]`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`text-stone-400`,children:[(0,Z.jsx)(`th`,{className:`w-10 pb-1 text-left font-normal`,children:`编号`}),(0,Z.jsx)(`th`,{className:`pb-1 text-left font-normal`,children:`用例标题`}),(0,Z.jsx)(`th`,{className:`w-40 pb-1 text-left font-normal`,children:`引用需求点`})]})}),(0,Z.jsx)(`tbody`,{children:m.preview.map((e,t)=>(0,Z.jsxs)(`tr`,{className:`align-top text-stone-600`,children:[(0,Z.jsx)(`td`,{className:`py-0.5 pr-2 tabular-nums`,children:e.no}),(0,Z.jsx)(`td`,{className:`truncate py-0.5 pr-2`,children:e.title}),(0,Z.jsx)(`td`,{className:`truncate py-0.5 text-stone-500`,children:e.cite})]},`${e.no}-${t}`))})]}):null]}):(0,Z.jsx)(`p`,{className:`text-xs text-stone-500`,children:`暂无可预览的行`})}),x?(0,Z.jsx)(`p`,{className:`mt-2 text-[11px] leading-relaxed text-red-600`,children:x}):null,(0,Z.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Z.jsx)(`button`,{type:`button`,disabled:v,onClick:r,className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg text-stone-600 hover:bg-stone-100 disabled:opacity-40 transition-colors`,children:`取消`}),(0,Z.jsx)(`button`,{type:`button`,disabled:v||g||!m,onClick:()=>void T(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:v?`重排中…`:`开始重排`})]})]})})]})}var Ot=[`all`,...Be,`ignored`],kt={blue:`text-sky-700`,purple:`text-violet-700`,green:`text-emerald-700`,amber:`text-amber-700`,yellow:`text-yellow-700`,red:`text-rose-700`,gray:`text-stone-600`,muted:`text-stone-500`},At={blue:`bg-sky-500`,purple:`bg-violet-500`,green:`bg-emerald-500`,amber:`bg-amber-500`,yellow:`bg-yellow-500`,red:`bg-rose-500`,gray:`bg-stone-400`,muted:`bg-stone-300`};function jt(e){return e>=85?`green`:e>=60?`amber`:`red`}function Mt(e){let t=Date.parse(e);if(!Number.isFinite(t))return`—`;let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`刚刚`;let r=Math.floor(n/60);if(r<60)return`${r} 分钟前`;let i=Math.floor(r/60);if(i<24)return`${i} 小时前`;let a=Math.floor(i/24);return a<30?`${a} 天前`:new Date(t).toLocaleDateString()}function Nt({review:e,running:t,modelReady:n,onRun:r,onStop:i,onFix:a,onFixBatch:u,onIgnore:d,onUnignore:f,autoFixedKeys:p,onExport:m}){let[h,g]=(0,X.useState)(()=>o(`caseReview.quality.filter`,[...Ot],`all`)),[_,v]=(0,X.useState)(()=>c(`caseReview.quality.search`)),[y,b]=(0,X.useState)({}),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(()=>o(`caseReview.quality.worstFirst`,[`1`,`0`],`0`)===`1`),T=e=>{g(e),s(`caseReview.quality.filter`,e)},E=e=>{v(e),l(`caseReview.quality.search`,e)},D=e=>{w(e),s(`caseReview.quality.worstFirst`,e?`1`:`0`)},O=(0,X.useMemo)(()=>{let t=e?.cases??[];return p?.size?t.map(e=>{let t=K(e);return t&&p.has(t)?{...e,fixed:!0}:e}):t},[e,p]),ee=(0,X.useMemo)(()=>O.filter(e=>e.ignored).length,[O]),k=(0,X.useMemo)(()=>{let e={usable:0,revise:0,invalid:0};for(let t of O)t.ignored||(e[t.verdict]+=1);return e},[O]),A=(0,X.useMemo)(()=>{let e=_.trim().toLowerCase(),t=O.filter(t=>{if(h===`ignored`){if(!t.ignored)return!1}else if(t.ignored||h!==`all`&&t.verdict!==h)return!1;return!e||`${t.no} ${t.title}`.toLowerCase().includes(e)});return C?[...t].sort((e,t)=>e.score-t.score):t},[O,h,_,C]),j=h===`revise`||h===`invalid`,[M,te]=(0,X.useState)(()=>new Set);(0,X.useEffect)(()=>{te(new Set)},[h]);let N=(0,X.useMemo)(()=>A.filter(e=>!e.ignored&&e.verdict!==`usable`&&!e.fixed),[A]),P=(0,X.useMemo)(()=>N.filter(e=>{let t=K(e);return!!(t&&M.has(t))}),[N,M]),ne=N.length>0&&N.every(e=>{let t=K(e);return!!(t&&M.has(t))}),re=P.length?P:N,F=!j||N.length===0,I=e=>{e&&te(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t?(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 px-3 rounded-lg text-xs font-medium border border-rose-300 bg-rose-50 text-rose-700 hover:bg-rose-100`,children:`停止评审`}):(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`h-8 px-3 rounded-lg text-xs font-medium bg-stone-900 text-white hover:bg-stone-800`,children:e?`重新评审`:`开始评审`}),(0,Z.jsx)(`button`,{type:`button`,onClick:m,disabled:!e||t,className:`h-8 px-3 rounded-lg text-xs border border-stone-200 text-stone-700 hover:bg-stone-50 disabled:opacity-40`,children:`导出 Markdown`}),(0,Z.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:n?`规则 + 模型:语义问题与扣分原因由模型补`:`未配置模型:只跑规则判定`}),e?(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 text-[11px] text-stone-400`,children:[e.modelCovered!=null&&e.modelCovered<O.length?(0,Z.jsxs)(`span`,{className:`text-amber-700`,children:[`模型只评到 `,e.modelCovered,`/`,O.length,` 条,其余按规则分`]}):null,(0,Z.jsxs)(`span`,{children:[`上次评审:`,Mt(e.at)]})]}):null]}),e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-stone-50/60 px-3 py-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`flex w-full items-center gap-2 text-left`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:`看到结论后怎么处理`}),(0,Z.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:x?`收起`:`展开`})]}),x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`ul`,{className:`mt-1.5 space-y-1 text-[11px] leading-relaxed text-stone-600`,children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border px-1 ${G.invalid.badge}`,children:`错误无效`}),`点这条右侧的「修改」,会带着编号、扣分原因与建议跳到工作台(用例绑定的会话,没有就新建), 让模型按建议改;跳转本身不标「已修改」。改完文件后回来,若正文相对上次评审有变,会自动标「已修改」。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border px-1 ${G.revise.badge}`,children:`待修改`}),`不影响执行,按建议补齐边界 / 异常 / 前置条件即可;改完回来自动识别,或批量改完再整体重评一次。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border border-stone-200 px-1 text-stone-600`,children:`忽略`}),`这条不再参与后续评审与「待修改」统计;点「忽略」后可在「忽略」筛选里「取消忽略」。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border border-stone-200 px-1 text-stone-600`,children:`批量修改`}),`切到「错误无效 / 待修改」,可勾选后点「批量修改」;未勾选时对本筛选下全部可改条生效。跳转不标已修改。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border px-1 ${G.usable.badge}`,children:`可用`}),`可直接执行或入库;这里只读,不会自动改你的用例文件。`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`mr-1 rounded border border-stone-200 px-1 text-stone-600`,children:`重新评审`}),`首次(无「已修改」)评全部未忽略条;有「已修改」时只重审这些条并按分数重判(未达可用仍为待修改 / 无效,不会因标过「已修改」就自动变可用),未改的保留上次判定;忽略的永远不送评。`]})]}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-[10px] text-stone-400`,children:`改文件后报告会标「可能已过期」,重新评审即刷新;每次结果都存在「用例评审」目录里。`})]}):null]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-500`,children:`总分`}),(0,Z.jsx)(`div`,{className:`text-xl font-semibold ${kt[jt(e.score)]}`,children:e.score}),(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-400`,children:e.modeled?`规则 + 模型`:`仅规则`})]}),Be.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-500`,children:G[e].label}),(0,Z.jsx)(`div`,{className:`text-xl font-semibold ${kt[G[e].tone]}`,children:k[e]}),(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-400`,children:G[e].hint})]},e))]}),(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:`五维得分(整批平均)`}),(0,Z.jsx)(`span`,{className:`text-[10px] text-stone-400`,children:`每维 0–100 分;左侧百分比是权重,右侧数字才是这一维的得分`})]}),(0,Z.jsxs)(`div`,{className:`mt-2 mb-1 flex items-center gap-2 text-[10px] text-stone-400`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0`,children:`维度`}),(0,Z.jsx)(`span`,{className:`w-9 shrink-0 text-right`,children:`权重`}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)(`span`,{className:`w-8 shrink-0 text-right`,children:`得分`})]}),(0,Z.jsx)(`div`,{className:`space-y-2`,children:e.dimensions.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 text-[11px] text-stone-600`,children:e.label}),(0,Z.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-[11px] tabular-nums text-stone-400`,children:[e.weight,`%`]}),(0,Z.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,Z.jsx)(`div`,{className:`h-full ${At[W[e.key]?.tone??`gray`]}`,style:{width:`${e.score}%`}})}),(0,Z.jsx)(`span`,{className:`w-8 shrink-0 text-right text-[11px] tabular-nums text-stone-700`,children:e.score})]},e.key))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-stone-400`,children:[`总分 `,e.score,` = 各维度得分 × 权重求和(不是右侧某个数字); ≥`,` `,We.usable,` 可用 · `,We.revise,`–`,We.usable-1,` 待修改 · < `,We.revise,` 错误无效。`]})]}),(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,Z.jsxs)(`h3`,{className:`mb-2 text-xs font-semibold text-stone-700`,children:[`量化指标`,(0,Z.jsx)(`span`,{className:`ml-1 font-normal text-stone-400`,children:`七项 + 硬伤条数`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:e.metrics.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-lg border border-stone-100 bg-stone-50/60 px-2.5 py-2`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] text-stone-500`,children:e.label}),(0,Z.jsx)(`div`,{className:`text-base font-semibold text-stone-800 tabular-nums`,children:e.text}),(0,Z.jsx)(`div`,{className:`text-[10px] leading-tight text-stone-400`,children:e.hint})]},e.key))})]}),e.summary?(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white p-3`,children:[(0,Z.jsx)(`h3`,{className:`mb-1 text-xs font-semibold text-stone-700`,children:`整体结论`}),(0,Z.jsx)(`p`,{className:`text-xs leading-relaxed text-stone-600 whitespace-pre-wrap`,children:e.summary})]}):null,(0,Z.jsx)(`div`,{className:`sticky -top-4 z-10 -mx-4 bg-white px-4 pt-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-stone-200 bg-white px-3 py-2 shadow-sm`,children:[j?(0,Z.jsxs)(`label`,{className:`flex h-6 shrink-0 items-center gap-1.5 text-[11px] text-stone-600`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:ne,disabled:!N.length,onChange:()=>{if(ne){te(new Set);return}let e=new Set;for(let t of N){let n=K(t);n&&e.add(n)}te(e)},className:`rounded border-stone-300`}),`全选`]}):null,(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:`逐条明细`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(Pt,{active:h===`all`,onClick:()=>T(`all`),children:[`全部 `,O.length-ee]}),Be.map(e=>(0,Z.jsxs)(Pt,{active:h===e,onClick:()=>T(e),children:[G[e].label,` `,k[e]]},e)),(0,Z.jsxs)(Pt,{active:h===`ignored`,onClick:()=>T(`ignored`),children:[`忽略`,ee?` ${ee}`:``]})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>D(!C),className:`ml-auto h-6 shrink-0 rounded-md px-2 text-[11px] transition-colors ${C?`bg-stone-900 text-white`:`text-stone-500 hover:bg-stone-100`}`,children:`按分数升序`}),(0,Z.jsx)(`input`,{value:_,onChange:e=>E(e.target.value),placeholder:`搜编号 / 标题`,className:`h-7 w-40 rounded-lg border border-stone-200 px-2 text-xs outline-none focus:border-stone-400`}),(0,Z.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>u(re),className:`h-7 shrink-0 rounded-lg border border-stone-200 px-2 text-[11px] text-stone-600 transition-colors hover:bg-stone-50 disabled:cursor-not-allowed disabled:opacity-40`,children:[`批量修改`,j&&P.length?` ${P.length}`:j&&N.length?` ${N.length}`:``]})]})}),(0,Z.jsx)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:(0,Z.jsxs)(`ul`,{className:`divide-y divide-stone-100`,children:[A.map((e,t)=>{let n=K(e),r=`${e.no}-${t}`,i=!e.ignored&&e.verdict!==`usable`&&!e.fixed;return(0,Z.jsx)(Ft,{item:e,open:y[r]===!0,onToggle:()=>b(e=>({...e,[r]:!e[r]})),onFix:()=>a(e),onIgnore:()=>d(e),onUnignore:()=>f(e),selectable:j&&i,checked:!!(n&&M.has(n)),onToggleSelect:n?()=>I(n):void 0},r)}),A.length?null:(0,Z.jsx)(`li`,{className:`px-3 py-8 text-center text-xs text-stone-400`,children:`没有符合条件的用例`})]})})]}):(0,Z.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 px-6 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-stone-600`,children:`还没有评审结果`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`评审按五维打分(需求覆盖 / 步骤可执行 / 预期可判定 / 数据与边界 / 规范完整), 算七项量化指标,并把每条判成「可用 / 待修改 / 错误无效」;只读不改用例。`})]})]})}function Pt({active:e,onClick:t,children:n}){return(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`h-6 rounded-md px-2 text-[11px] transition-colors ${e?`bg-stone-900 text-white`:`text-stone-500 hover:bg-stone-100`}`,children:n})}function Ft({item:e,open:t,onToggle:n,onFix:r,onIgnore:i,onUnignore:a,selectable:o,checked:s,onToggleSelect:c}){let l=G[e.verdict],u=!e.ignored&&e.verdict!==`usable`&&!e.fixed,d=Ve(e);return(0,Z.jsxs)(`li`,{className:`group px-3 py-2 ${e.fixed||e.ignored?`opacity-70`:``}`,children:[(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:n,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`flex w-full items-center gap-2 text-left`,children:[o?(0,Z.jsx)(`input`,{type:`checkbox`,checked:!!s,onChange:()=>c?.(),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),className:`shrink-0 rounded border-stone-300`}):null,(0,Z.jsx)(`span`,{className:`inline-flex w-14 shrink-0 items-center justify-center rounded border px-1 py-0.5 text-[10px] leading-4 ${e.ignored?`border-stone-200 bg-stone-50 text-stone-500`:e.fixed?`border-emerald-200 bg-emerald-50 text-emerald-700`:l.badge}`,children:e.ignored?`已忽略`:e.fixed?`已修改`:l.label}),(0,Z.jsx)(`span`,{className:`w-16 shrink-0 truncate text-left text-[11px] tabular-nums leading-4 text-stone-500`,children:e.no||`—`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left text-xs leading-4 text-stone-800`,children:e.title||`(无标题)`}),e.ignored?(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>e.stopPropagation(),className:`h-5 shrink-0 rounded-md border border-stone-200 px-1.5 text-[10px] leading-none text-stone-600 opacity-0 transition-opacity hover:bg-stone-100 focus-visible:opacity-100 group-hover:opacity-100`,children:`取消忽略`}):u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},onKeyDown:e=>e.stopPropagation(),className:`h-5 shrink-0 rounded-md border border-stone-200 px-1.5 text-[10px] leading-none text-stone-600 opacity-0 transition-opacity hover:bg-stone-100 focus-visible:opacity-100 group-hover:opacity-100`,children:`修改`}),(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},onKeyDown:e=>e.stopPropagation(),className:`h-5 shrink-0 rounded-md border border-stone-200 px-1.5 text-[10px] leading-none text-stone-600 opacity-0 transition-opacity hover:bg-stone-100 focus-visible:opacity-100 group-hover:opacity-100`,children:`忽略`})]}):null]}),(0,Z.jsx)(`span`,{className:`w-7 shrink-0 text-right text-[11px] tabular-nums leading-4 text-stone-500`,children:e.score}),(0,Z.jsx)(`span`,{className:`flex h-5 w-8 shrink-0 items-center justify-center text-[10px] text-stone-400`,children:t?`收起`:`详情`})]}),t?(0,Z.jsxs)(`div`,{className:`mt-2 space-y-2 pl-1`,children:[e.hard?(0,Z.jsxs)(`p`,{className:`rounded-md border border-rose-200 bg-rose-50 px-2 py-1 text-[11px] text-rose-700`,children:[`硬伤:`,e.hard]}):null,(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.keys(W).map(t=>(0,Z.jsxs)(`span`,{className:`rounded-md border border-stone-100 bg-stone-50 px-2 py-0.5 text-[10px] text-stone-600`,children:[W[t].label,` `,e.dimensions[t]]},t))}),e.deductions.length?(0,Z.jsx)(`ul`,{className:`space-y-1.5`,children:e.deductions.map((e,t)=>(0,Z.jsxs)(`li`,{className:`rounded-md bg-stone-50 px-2 py-1.5`,children:[(0,Z.jsxs)(`div`,{className:`text-[11px] text-stone-700`,children:[(0,Z.jsxs)(`span`,{className:`mr-1 font-medium text-stone-500`,children:[`[`,W[e.dimension]?.label??e.dimension,e.points?` −${e.points}`:``,`]`]}),e.reason]}),e.suggestion?(0,Z.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-emerald-700`,children:[`建议:`,e.suggestion]}):null]},t))}):d.length?(0,Z.jsx)(`ul`,{className:`space-y-1.5`,children:d.map((e,t)=>(0,Z.jsx)(`li`,{className:`rounded-md bg-stone-50 px-2 py-1.5 text-[11px] text-stone-500`,children:e},t))}):(0,Z.jsx)(`p`,{className:`text-[11px] text-stone-400`,children:`没有扣分项。`})]}):null]})}var It={blue:`border-sky-200 bg-sky-50 text-sky-700`,purple:`border-violet-200 bg-violet-50 text-violet-700`,green:`border-emerald-200 bg-emerald-50 text-emerald-700`,amber:`border-amber-200 bg-amber-50 text-amber-800`,yellow:`border-yellow-200 bg-yellow-50 text-yellow-800`,red:`border-rose-200 bg-rose-50 text-rose-700`,gray:`border-stone-200 bg-stone-50 text-stone-600`,muted:`border-stone-200 bg-white text-stone-400`};function Lt({report:e,loading:t,running:n,completing:r,modelReady:i,selected:a,onToggle:o,onToggleCategory:s,onDetect:c,onStop:l,onComplete:u,onWriteback:d,onExport:f}){let p=e?.items??[],m=(0,X.useMemo)(()=>p.filter(e=>!e.added),[p]),h=p.length-m.length,g=(0,X.useMemo)(()=>U(p),[p]),[_,v]=(0,X.useState)(new Set),y=(0,X.useMemo)(()=>m.map(e=>e.id),[m]),b=(0,X.useMemo)(()=>y.filter(e=>a.has(e)).length,[y,a]),x=y.length>0&&y.every(e=>a.has(e)),S=e=>{v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(`p`,{className:`rounded-lg border border-stone-200 bg-stone-50/60 px-3 py-2 text-[11px] leading-relaxed text-stone-500`,children:`用途:找出「需求里有、用例里没有」的场景(非功能、安全边界、兼容性、隐藏业务规则), 不是挑现有用例的毛病,而是补漏。流程:① 探测盲区 → ② 勾选要补的条目 → ③「补全选中」写全前置 / 步骤 / 预期 → ④「去工作台写回」跳到绑定会话,按归属需求插到对应分组最后一行之后(写前备份,不动原有行;对不上组才落到末尾)。写回后标「已修改」;重新探测会去掉已确认写回的场景。`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:c,disabled:n||r,className:`h-8 px-3 rounded-lg text-xs font-medium bg-stone-900 text-white hover:bg-stone-800 disabled:opacity-50`,children:n?`探测中…`:e?`重新探测`:`探测盲区`}),n?(0,Z.jsx)(`button`,{type:`button`,onClick:l,className:`h-8 px-3 rounded-lg text-xs border border-rose-200 text-rose-600 hover:bg-rose-50`,children:`停止`}):null,(0,Z.jsx)(`button`,{type:`button`,onClick:u,disabled:!b||r||n,className:`h-8 px-3 rounded-lg text-xs border border-stone-200 text-stone-700 hover:bg-stone-50 disabled:opacity-40`,children:r?`补全中…`:`补全选中 ${b||``}`}),(0,Z.jsx)(`button`,{type:`button`,onClick:d,disabled:!b||n||t,className:`h-8 px-3 rounded-lg text-xs font-medium border border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 disabled:opacity-40`,children:`去工作台写回 ${b||``}`}),(0,Z.jsx)(`button`,{type:`button`,onClick:f,disabled:!e,className:`h-8 px-3 rounded-lg text-xs border border-stone-200 text-stone-700 hover:bg-stone-50 disabled:opacity-40`,children:`导出 Markdown`}),(0,Z.jsx)(`span`,{className:`ml-auto text-[11px] text-stone-400`,children:m.length?`已选 ${b} / 共 ${m.length}${h?` · 已修改 ${h}`:``}`:h?`已修改 ${h}`:``}),(0,Z.jsx)(`button`,{type:`button`,disabled:!y.length,onClick:()=>s(y,!x),className:`h-6 shrink-0 rounded-md px-2 text-[11px] text-stone-500 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:x?`清空`:`全选`})]}),i?null:(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-[11px] text-amber-800`,children:`场景探测要靠模型推理,先在设置里配好模型。`}),t?(0,Z.jsx)(`p`,{className:`py-8 text-center text-xs text-stone-400`,children:`读取中…`}):!e||!e.items.length&&!n?(0,Z.jsxs)(`div`,{className:`rounded-xl border border-dashed border-stone-200 px-6 py-12 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-stone-600`,children:`还没有探测结果`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-stone-400`,children:`会从非功能、安全边界、兼容性与隐藏业务规则四个方向找现有用例的缺口。`})]}):(0,Z.jsxs)(Z.Fragment,{children:[e.summary?(0,Z.jsx)(`p`,{className:`rounded-lg border border-stone-200 bg-white px-3 py-2 text-xs leading-relaxed text-stone-600 whitespace-pre-wrap`,children:e.summary}):null,g.map(e=>{let t=J[e.key],n=e.items.filter(e=>!e.added).map(e=>e.id),r=n.length>0&&n.every(e=>a.has(e)),i=_.has(e.key),c=n.filter(e=>a.has(e)).length,l=e.items.filter(e=>e.added).length;return(0,Z.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white`,children:[(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-stone-100 px-3 py-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S(e.key),className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[(0,Z.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] ${It[t.tone]}`,children:t.mark}),(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-stone-700`,children:t.label}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-stone-400`,children:[e.items.length,` 条`,c?` · 已选 ${c}`:``,l?` · 已修改 ${l}`:``]}),(0,Z.jsx)(`span`,{className:`ml-auto text-[10px] text-stone-400`,children:i?`展开`:`收起`})]}),n.length?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>s(n,!r),className:`h-6 shrink-0 rounded-md px-2 text-[11px] text-stone-500 transition-colors hover:bg-stone-100`,children:r?`取消本类`:`全选本类`}):null]}),i?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`px-3 pt-2 text-[11px] text-stone-400`,children:t.hint}),(0,Z.jsx)(`ul`,{className:`divide-y divide-stone-100`,children:e.items.map(e=>(0,Z.jsx)(Rt,{item:e,checked:a.has(e.id),onToggle:()=>o(e.id)},e.id))})]})]},e.key)})]}),b?(0,Z.jsxs)(`p`,{className:`sticky bottom-0 rounded-lg border border-stone-200 bg-white/95 px-3 py-2 text-[11px] text-stone-500 shadow-sm backdrop-blur`,children:[`已选 `,b,` 条:可以先「补全选中」把字段写全,也可以直接「去工作台写回」—— 会按归属需求插到对应分组下面(不是整份追加到末尾),写前自动备份。`]}):null]})}function Rt({item:e,checked:t,onToggle:n}){let[r,i]=(0,X.useState)(!1),a=q[e.severity],o=e.added;return(0,Z.jsxs)(`li`,{className:`px-3 py-2 ${o?`opacity-70`:``}`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:t&&!o,disabled:o,onChange:n,className:`mt-1 h-3.5 w-3.5 shrink-0 accent-stone-900 disabled:opacity-40`,"aria-label":`选择 ${e.title}`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`flex-1 min-w-0 text-left`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 rounded border px-1 py-0.5 text-[10px] ${It[a.tone]}`,children:a.label}),o?(0,Z.jsx)(`span`,{className:`shrink-0 rounded border border-emerald-200 bg-emerald-50 px-1 py-0.5 text-[10px] text-emerald-700`,children:`已修改`}):null,(0,Z.jsx)(`span`,{className:`flex-1 min-w-0 text-xs text-stone-800`,children:e.title}),(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-stone-400`,children:e.priority})]}),e.reqAnchor?(0,Z.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-stone-400`,children:[`归属:`,e.reqAnchor]}):null,e.why?(0,Z.jsxs)(`p`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-500`,children:[`容易漏:`,e.why]}):null]})]}),r?(0,Z.jsxs)(`dl`,{className:`mt-2 space-y-1 rounded-md bg-stone-50 px-2 py-1.5 text-[11px] text-stone-600`,children:[(0,Z.jsx)(zt,{label:`归属需求`,value:e.reqAnchor}),(0,Z.jsx)(zt,{label:`前置条件`,value:e.precondition}),(0,Z.jsx)(zt,{label:`步骤`,value:e.steps.map((e,t)=>`${t+1}. ${e}`).join(` `)}),(0,Z.jsx)(zt,{label:`预期`,value:e.expected})]}):null]})}function zt({label:e,value:t}){return t?(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-14 shrink-0 text-stone-400`,children:e}),(0,Z.jsx)(`dd`,{className:`flex-1 whitespace-pre-wrap`,children:t})]}):null}var Bt=[`module`,`type`,`priority`],Vt=[{key:`no`,width:84,min:72},{key:`title`,width:168,min:120},{key:`steps`,width:200,min:150},{key:`expected`,width:192,min:150},{key:`verdict`,width:112,min:104},{key:`suggestions`,width:220,min:200},{key:`filler`,filler:!0}],Ht=new Set([`no`,`title`,`filler`]),Ut=[{key:`steps`,label:`测试步骤`},{key:`expected`,label:`预期结果`},{key:`verdict`,label:`规则判定`},{key:`suggestions`,label:`修改建议`}],Wt=`case-review.fields`,Gt=`lh:case-review:cols:v1`;function Kt(e){return e.replace(/\.[A-Za-z0-9]+$/,``).trim().toLowerCase()}function qt({file:e,audit:t,review:n,fileName:r,autoFixedKeys:i}){let a=(0,X.useMemo)(()=>e?.rows??[],[e]),[u,d]=(0,X.useState)(()=>o(`caseReview.table.filter`,[`all`,...Be],`all`)),[f,p]=(0,X.useState)(()=>c(`caseReview.table.search`)),m=e=>{d(e),s(`caseReview.table.filter`,e)},h=e=>{p(e),l(`caseReview.table.search`,e)},g=C(Wt,Ut,Ht),_=(0,X.useMemo)(()=>S(Vt,g.isVisible),[g.isVisible]),y=$e(Gt,_),b=Ze(`case-review`),x=(0,X.useMemo)(()=>A(e?.headers??[]),[e]),T=(0,X.useMemo)(()=>{let e=new Map,r=new Map;for(let t of n?.cases??[]){let n=K(t),a=n&&i?.has(n)&&!t.fixed?{...t,fixed:!0}:t;a.no&&e.set(a.no.trim(),a),a.title&&r.set(a.title.trim(),a)}return a.map((n,i)=>{let a=String(n[x.no??j.no]??``).trim(),o=String(n[x.title??j.title]??``).trim();return(a?e.get(a):void 0)??(o?r.get(o):void 0)??t?.cases[i]??null})},[a,x,n,t,i]),E=(0,X.useMemo)(()=>{let e={usable:0,revise:0,invalid:0};for(let t of T)t&&(e[t.verdict]+=1);return e},[T]),D=(0,X.useMemo)(()=>a.map((e,t)=>{let n=T[t],i=t=>String(e[x[t]??j[t]]??``),a=r?Kt(r):``,o=Bt.map(i).map(e=>e.trim()).filter(e=>!!e&&(!a||Kt(e)!==a)).join(` · `);return{key:t,no:i(`no`),title:i(`title`),meta:o,steps:i(`steps`),expected:i(`expected`),verdict:n,suggestions:n?Ve(n):[]}}),[a,x,T,r]),O=(0,X.useMemo)(()=>{let e=f.trim().toLowerCase();return D.filter(t=>u!==`all`&&t.verdict?.verdict!==u?!1:!e||`${t.no} ${t.title}`.toLowerCase().includes(e))},[D,u,f]);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,style:{height:`calc(100vh - 9rem)`},children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:e?`${a.length} 条 · ${e.ext}`:`未读到用例文件`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(Jt,{active:u===`all`,onClick:()=>m(`all`),children:[`全部 `,D.length]}),Be.map(e=>(0,Z.jsxs)(Jt,{active:u===e,onClick:()=>m(e),children:[G[e].label,` `,E[e]]},e))]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{value:f,onChange:e=>h(e.target.value),placeholder:`搜编号 / 标题`,className:`h-7 w-40 rounded-lg border border-stone-200 px-2 text-xs outline-none focus:border-stone-400`}),(0,Z.jsx)(w,{fields:g.fields,isVisible:g.isVisible,onToggle:g.toggle})]})]}),(0,Z.jsxs)(`p`,{className:`shrink-0 text-[11px] text-stone-400`,children:[n?`只读对照:判定与「质量评审」一致;要改用例回「用例管理」,或在质量评审里点「修改」跳工作台。`:`只读对照:还没评审,先用规则体检结果;要改用例回「用例管理」。`,(0,Z.jsx)(`span`,{className:`ml-1 text-stone-300`,children:`拖动表头右边缘可调列宽,双击恢复默认。`})]}),a.length?(0,Z.jsx)(`div`,{ref:b,className:`tw-scroll-x min-h-0 flex-1 overflow-auto rounded-xl border border-stone-200 bg-white`,children:(0,Z.jsxs)(`table`,{className:`tw-sticky-table table-fixed text-left text-xs`,style:y.tableStyle,children:[(0,Z.jsx)(`colgroup`,{children:_.map(e=>(0,Z.jsx)(`col`,{style:y.widthOf(e.key)?{width:y.widthOf(e.key)}:void 0},e.key))}),(0,Z.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-[11px] text-stone-500`,children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`th`,{className:tt,children:[`用例编号`,(0,Z.jsx)(Y,{...y.resizeProps(`no`)})]}),(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`用例标题`,(0,Z.jsx)(Y,{...y.resizeProps(`title`)})]}),g.isVisible(`steps`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`测试步骤`,(0,Z.jsx)(Y,{...y.resizeProps(`steps`)})]}):null,g.isVisible(`expected`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`预期结果`,(0,Z.jsx)(Y,{...y.resizeProps(`expected`)})]}):null,g.isVisible(`verdict`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium whitespace-nowrap`,children:[`规则判定`,(0,Z.jsx)(Y,{...y.resizeProps(`verdict`)})]}):null,g.isVisible(`suggestions`)?(0,Z.jsxs)(`th`,{className:`relative px-2.5 py-2 font-medium`,children:[`修改建议`,(0,Z.jsx)(Y,{...y.resizeProps(`suggestions`)})]}):null,(0,Z.jsx)(`th`,{"aria-hidden":`true`})]})}),(0,Z.jsxs)(`tbody`,{children:[O.map(e=>{let t=e.verdict;return(0,Z.jsxs)(`tr`,{className:`align-top`,children:[(0,Z.jsx)(`td`,{className:`${et} tabular-nums text-stone-600`,children:(0,Z.jsx)(v,{text:e.no||`—`,className:`block truncate`})}),(0,Z.jsxs)(`td`,{className:`px-2.5 py-1.5`,children:[(0,Z.jsx)(v,{text:e.title||`(无标题)`,className:`block truncate text-stone-800`}),e.meta?(0,Z.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-stone-400`,children:e.meta}):null]}),g.isVisible(`steps`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5 text-stone-700`,children:(0,Z.jsx)(v,{text:e.steps,clamp:`y`,className:`line-clamp-2 whitespace-pre-wrap break-words`})}):null,g.isVisible(`expected`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5 text-stone-700`,children:(0,Z.jsx)(v,{text:e.expected,clamp:`y`,className:`line-clamp-2 whitespace-pre-wrap break-words`})}):null,g.isVisible(`verdict`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5`,children:t?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[t.fixed?(0,Z.jsxs)(`span`,{className:`rounded border border-emerald-200 bg-emerald-50 px-1.5 py-0.5 text-[10px] text-emerald-700`,children:[`已修改 `,t.score]}):(0,Z.jsxs)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] ${G[t.verdict].badge}`,children:[G[t.verdict].label,` `,t.score]}),t.hard&&!t.fixed?(0,Z.jsx)(`span`,{className:`rounded border border-rose-200 bg-white px-1 py-0.5 text-[10px] text-rose-600`,children:`硬伤`}):null]}):(0,Z.jsx)(`span`,{className:`text-[10px] text-stone-300`,children:`—`})}):null,g.isVisible(`suggestions`)?(0,Z.jsx)(`td`,{className:`px-2.5 py-1.5`,children:e.suggestions.length?(0,Z.jsx)(v,{text:e.suggestions.map((e,t)=>`${t+1}. ${e}`).join(`
5
+ `),clamp:`y`,className:`line-clamp-2 whitespace-pre-wrap break-words text-[11px] text-stone-600`}):(0,Z.jsx)(`span`,{className:`text-[10px] text-stone-300`,children:`—`})}):null,(0,Z.jsx)(`td`,{"aria-hidden":`true`})]},e.key)}),O.length?null:(0,Z.jsx)(`tr`,{children:(0,Z.jsx)(`td`,{colSpan:_.length,className:`px-3 py-10 text-center text-xs text-stone-400`,children:`没有符合条件的用例`})})]})]})}):(0,Z.jsx)(`p`,{className:`rounded-xl border border-dashed border-stone-200 px-6 py-12 text-center text-xs text-stone-400`,children:`没解析到用例行:确认第一行是表头,且有编号与标题列(也认「测试项目 / 用例名称」这类叫法)。支持 md 表格、csv、xlsx。`})]})}function Jt({active:e,onClick:t,children:n}){return(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`h-6 rounded-md px-2 text-[11px] transition-colors ${e?`bg-stone-900 text-white`:`text-stone-500 hover:bg-stone-100`}`,children:n})}var Yt=`可用工具(只调用这些,不要自己编工具名):
6
+ - case_save_review:提交逐条用例判定(verdict / 五个维度分 / 扣分原因与建议),一次提交整批。
7
+ - case_save_blindspots:提交探测到的场景盲区(四类之一 + 可执行字段),一次提交全部。
8
+
9
+ 提交后不要重复提交同样的内容;工具返回 ok 之后再写最终回答。`,Xt={coverage:`coverage`,steps:`steps`,expected:`expected`,data:`data`,convention:`convention`,需求覆盖:`coverage`,步骤可执行:`steps`,预期可判定:`expected`,数据与边界:`data`,规范完整:`convention`},Zt={nonfunctional:`nonfunctional`,security:`security`,compatibility:`compatibility`,business:`business`,非功能:`nonfunctional`,安全:`security`,兼容:`compatibility`,业务:`business`};function Qt(e){try{let t=JSON.parse(e||`{}`);return t&&typeof t==`object`?t:{}}catch{return{}}}function Q(e,t=500){return typeof e==`string`?e.trim().slice(0,t):``}function $t(e,t=0){let n=Number(e);return Number.isFinite(n)?Math.min(100,Math.max(0,Math.round(n))):t}function en(e){let t=Q(e,40);return Xt[t]??Xt[t.toLowerCase()]??`expected`}function tn(e){let t=Q(e,40);return Zt[t]??Zt[t.toLowerCase()]??`business`}function nn(e){let t=Q(e,10).toLowerCase();return t===`high`||t===`medium`||t===`low`?t:`medium`}function rn(e){let t=Q(e,4).toUpperCase();return[`P0`,`P1`,`P2`,`P3`].includes(t)?t:`P1`}function an(e){if(!e||typeof e!=`object`)return null;let t=Q(e.reason,1e3);if(!t)return null;let n=e;return{dimension:en(n.dimension),points:$t(n.points,0),reason:t,suggestion:Q(n.suggestion,1e3)}}function on(e){if(!e||typeof e!=`object`)return null;let t=e,n=Q(t.no,80),r=Q(t.title,300);if(!n&&!r)return null;let i=t.dimensions&&typeof t.dimensions==`object`?t.dimensions:{},a={};for(let e of Ue)a[e]=$t(i[e],0);let o=Q(t.verdict,20),s=Q(t.hard,500),c={no:n,title:r,verdict:o===`usable`||o===`invalid`?o:`revise`,score:$t(t.score,0),dimensions:a,deductions:Array.isArray(t.deductions)?t.deductions.map(an).filter(e=>!!e).slice(0,20):[]};return s&&(c.hard=s),c}function sn(e){if(!e||typeof e!=`object`)return null;let t=e,n=Q(t.title,300);if(!n)return null;let r=Q(t.id,40);return{id:/^bs_[A-Za-z0-9_-]{4,40}$/.test(r)?r:``,category:tn(t.category),severity:nn(t.severity),title:n,why:Q(t.why,1e3),precondition:Q(t.precondition,1e3),steps:Array.isArray(t.steps)?t.steps.map(e=>Q(e,1e3)).filter(Boolean).slice(0,20):[],expected:Q(t.expected,1e3),priority:rn(t.priority),reqAnchor:Q(t.reqAnchor??t.requirement??t.reqRef,200),added:!1,caseNo:``}}var cn=[{type:`function`,function:{name:`case_save_review`,description:`提交用例质量评审结果:逐条给 verdict、五个维度分与扣分原因/建议。一次提交整批,不要一条调一次。`,parameters:{type:`object`,properties:{summary:{type:`string`,description:`整体结论,两三句话,指出最该先改的三条`},cases:{type:`array`,items:{type:`object`,properties:{no:{type:`string`,description:`用例编号,原样返回`},title:{type:`string`,description:`用例标题,原样返回`},verdict:{type:`string`,enum:[`usable`,`revise`,`invalid`],description:`可用 / 待修改 / 错误无效(系统最终按维度加权分与 hard 重算,分数与判定要自洽)`},hard:{type:`string`,description:`判「错误无效」时必须写清硬伤证据(与需求哪条冲突 / 和哪条重复);没有硬伤就留空`},dimensions:{type:`object`,description:`五维分数,0–100 整数`,properties:Object.fromEntries(Ue.map(e=>[e,{type:`number`,description:e}])),required:[...Ue]},deductions:{type:`array`,items:{type:`object`,properties:{dimension:{type:`string`,enum:[...Ue]},points:{type:`number`,description:`这一项扣几分`},reason:{type:`string`,description:`具体到位置与原因`},suggestion:{type:`string`,description:`要补什么`}},required:[`dimension`,`reason`]}}},required:[`no`,`verdict`,`dimensions`]}}},required:[`cases`]}}},{type:`function`,function:{name:`case_save_blindspots`,description:`提交场景遗漏补全的盲区清单:四类之一(nonfunctional / security / compatibility / business),每条带可执行字段。补全时带原 id 原地更新。`,parameters:{type:`object`,properties:{summary:{type:`string`,description:`整体结论:几条、四类各几条、风险最高的三条`},items:{type:`array`,items:{type:`object`,properties:{id:{type:`string`,description:`补全已有条目时才带(bs_ 开头)`},category:{type:`string`,enum:[...He]},severity:{type:`string`,enum:[`high`,`medium`,`low`]},title:{type:`string`,description:`一句话说清测什么`},why:{type:`string`,description:`为什么人工容易漏`},precondition:{type:`string`,description:`账号 / 数据 / 初始状态`},steps:{type:`array`,items:{type:`string`}},expected:{type:`string`,description:`可判定的预期结果`},priority:{type:`string`,enum:[`P0`,`P1`,`P2`,`P3`]},reqAnchor:{type:`string`,description:`归属需求:优先抄已有需求编号原文(前缀不限);没有编号时再补自定义编号(同组共用);写回时插到该组最后一行之后;对不上才留空`}},required:[`category`,`title`]}}},required:[`items`]}}}];async function ln(e,t,n){let r=Qt(t);if(e===`case_save_review`){let e=(Array.isArray(r.cases)?r.cases:[]).map(on).filter(e=>!!e);return e.length?(n.onCases(e,Q(r.summary,2e3)),JSON.stringify({ok:!0,count:e.length,usable:e.filter(e=>e.verdict===`usable`).length,invalid:e.filter(e=>e.verdict===`invalid`).length})):JSON.stringify({ok:!1,error:`没有解析到任何用例判定`})}if(e===`case_save_blindspots`){let e=(Array.isArray(r.items)?r.items:[]).map(sn).filter(e=>!!e).slice(0,300);return e.length?(n.onBlindspots(e,Q(r.summary,2e3)),JSON.stringify({ok:!0,count:e.length,categories:He.map(t=>[t,e.filter(e=>e.category===t).length]).filter(([,e])=>Number(e)>0)})):JSON.stringify({ok:!1,error:`没有解析到任何盲区条目`})}return JSON.stringify({ok:!1,error:`未知工具:${e}`})}function un(e){return!!at(e).trim()||it(e).length>0}function dn(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/^\/+/,``)}function fn(e){return/\.(xlsx|xlsm|xls)$/i.test(e)}function pn(e,t,n){return fn(e)?[`${n}. ${t===`fix`?`这个文件是 xlsx(二进制):会话里的文件工具一般写不了它。请不要假装写成功,改成把改好的整行按「文件表头顺序」用 markdown 表格贴出来(第一列是原编号),我直接粘回文件。`:`这个文件是 xlsx(二进制):会话里的文件工具一般写不了它。请不要假装写成功,改成把新增的行按「文件表头顺序」用 markdown 表格贴出来(编号按文件规则续),并标明每条应插在哪个归属需求分组的哪一行之后,我按位置粘进文件,不要默认贴到末尾。`}`,`${n+1}. 如果确实有 bash / python 能直接改 xlsx,也可以直接改,但改完必须把改动行贴出来让我核对。`]:[`${n}. ${t===`fix`?`改动写回原文件(写之前先备份),写完告诉我改了哪些列、改成什么。`:`写回原文件前先备份,写完告诉我加了哪几条、编号是什么。`}`,`${n+1}. 如果当前会话没有可用的文件工具,把${t===`fix`?`改好的整条用例`:`新行`}按文件表头贴给我,我自己粘回去。`]}function mn(e,t){return e.sessions.find(e=>{if(!z(e))return!1;let n=e.caseGen?.linkedCasePath;return!!(n&&dn(n)===t)})}function hn(e){let{verdict:t}=e,n=e.name||e.path.split(`/`).pop()||e.path,r=t.no||`(无编号)`,i=t.title||`(无标题)`,a=t.verdict===`invalid`?`错误无效`:`待修改`,o=[];if(o.push(`帮我改一下用例文件《${n}》里的这一条:${r} ${i}`),o.push(``),o.push(`评审结论:${a}(${t.score} 分)`),t.hard&&o.push(`硬伤:${t.hard}`),t.deductions.length){o.push(``),o.push(`扣分项与建议:`);for(let e of t.deductions)o.push(`- 扣 ${e.points} 分:${e.reason}`),e.suggestion&&o.push(` 建议:${e.suggestion}`)}return e.requirementTitle&&(o.push(``),o.push(`对照需求:${e.requirementTitle}(对不上时以需求分析的验收标准为准)`)),o.push(``),o.push(`要求:`),o.push(`1. 先读一遍这个文件,确认表头与已有用例的写法,只改这一条,其它用例一个字都不要动;`),o.push(`2. 标题、步骤、预期按上面建议补齐,步骤一步一个动作,预期写到可判定的状态 / 文案 / 数值;`),o.push(`3. 改完后把该条「用例状态」直接标为「待验证」(不要标通过 / 已修改 / 不通过);没有「用例状态」列就跳过这一步;`),o.push(`4. 我自己也会在「用例管理」里同时改,改动以文件当前内容为准,别按我给的建议覆盖我后来的手改;`),o.push(...pn(n,`fix`,5)),o.join(`
10
+ `)}var gn=[`帮我改一下用例文件`,`帮我把下面`];function _n(e){let t=e.trim();return t.length>240&&gn.some(e=>t.startsWith(e))}async function vn(e,t,r){await L().catch(()=>null),await n().catch(()=>null);let i=dn(e),a=R(),o=mn(a,i);if(!o){let e=a.sessions.find(e=>e.id===a.activeId);if(e&&be(e)&&z(e))o=e;else{let e=a.sessions.find(e=>z(e)&&be(e)&&!un(e.id));e?(o=e,a={...a,activeId:e.id}):(a=Ce(a,{access:le()}),o=a.sessions.find(e=>e.id===a.activeId))}}if(!o)throw Error(`无法创建或定位会话`);a=B(a,o.id,un),a.activeId!==o.id&&(a={...a,activeId:o.id}),await xe(a),o=a.sessions.find(e=>e.id===o.id)??o,_n(at(o.id))&&rt(o.id),ot(o.id,{...r,at:Date.now()});try{let e=a.sessions.find(e=>e.id===o.id)??o;sessionStorage.setItem(Se(o.id),JSON.stringify({session:e}))}catch{}let s=t||i.split(`/`).pop()||i,c=new URLSearchParams({session:o.id,attachRoot:`cases`,attachPath:i,attachName:s});window.location.href=`/workbench/?${c.toString()}`}async function yn(e){let t=e.name||e.path.split(`/`).pop()||e.path;await vn(e.path,e.name,{id:`case-fix:${dn(e.path)}:${e.verdict.no||e.verdict.title}`,label:`修改用例 ${e.verdict.no||e.verdict.title||t}`,detail:`${e.verdict.verdict===`invalid`?`错误无效`:`待修改`} · ${t}`,body:hn(e)})}function bn(e){let t=e.name||e.path.split(`/`).pop()||e.path,n=e.verdicts,r=[];return r.push(`帮我改一下用例文件《${t}》里这 ${n.length} 条评审没通过的用例,其它用例不要动。`),r.push(``),n.forEach((e,t)=>{let n=e.verdict===`invalid`?`错误无效`:`待修改`;r.push(`### ${t+1}. ${e.no||`(无编号)`} ${e.title||`(无标题)`} · ${n} ${e.score}`),e.hard&&r.push(`- 硬伤:${e.hard}`);for(let t of e.deductions)r.push(`- 扣 ${t.points} 分:${t.reason}${t.suggestion?`|建议:${t.suggestion}`:``}`)}),e.requirementTitle&&(r.push(``),r.push(`对照需求:${e.requirementTitle}(对不上时以需求分析的验收标准为准)`)),r.push(``),r.push(`要求:`),r.push(`1. 先读一遍这个文件,按编号定位要改的行,确认表头与已有用例的写法;只改上面列出的这些条,其它行一个字都不要动;`),r.push(`2. 标题、步骤、预期、前置条件按建议补齐:步骤一步一个动作,预期写到可判定的状态 / 文案 / 数值;`),r.push(`3. 改完的每条都把「用例状态」直接标为「待验证」(不要标通过 / 已修改 / 不通过);没有「用例状态」列就跳过这一步;`),r.push(`4. 我也在「用例管理」里同时手改,改之前先按文件当前内容确认一遍,不要用我早期的版本覆盖后来的手改;`),r.push(`5. 条数多时分包处理(每包 8 条以内),每包处理完先回报「编号 → 改了什么」,不要一口气静默改完;`),r.push(...pn(t,`fix`,6)),r.push(`8. 改完在回复里给我一张对照表(编号 / 改前问题 / 改后要点 / 已标待验证);对照表只写在对话里,不要另存成用例管理目录下的新文件。`),r.join(`
11
+ `)}async function xn(e){let t=e.name||e.path.split(`/`).pop()||e.path,n=e.verdicts.length,r=e.verdicts.map(e=>e.no).filter(Boolean).slice(0,3).join(`、`);await vn(e.path,e.name,{id:`case-batch-fix:${dn(e.path)}:${e.verdicts.map(e=>e.no||e.title).join(`,`)}`,label:`批量修改用例`,detail:r?`${n} 条 · ${r}${n>3?` 等`:``} · ${t}`:`${n} 条 · ${t}`,body:bn(e)})}function Sn(e){let t=e.name||e.path.split(`/`).pop()||e.path,n=[];return n.push(`帮我把下面 ${e.items.length} 条「场景补全」用例补进用例文件《${t}》。`),n.push(``),e.requirementTitle&&(n.push(`对照需求:${e.requirementTitle}`),n.push(``)),n.push(`待补进的用例:`),e.items.forEach((e,t)=>{let r=J[e.category];n.push(``),n.push(`### ${t+1}. [${r?.label??e.category}] ${e.title}`),n.push(`- 归属需求:${e.reqAnchor?.trim()||`(未标,按标题 / why / 对照需求与文件里已有分组推断)`}`),n.push(`- 为什么容易漏:${e.why||`—`}`),n.push(`- 前置条件:${e.precondition||`(待补)`}`),n.push(`- 测试步骤:${e.steps.length?e.steps.map((e,t)=>`${t+1}. ${e}`).join(`;`):`(待补)`}`),n.push(`- 预期结果:${e.expected||`(待补)`}`),n.push(`- 优先级:${e.priority||`P2`}`)}),n.push(``),n.push(`要求:`),n.push(`1. 先读一遍这个文件,看清表头,以及已有用例是怎么按需求分组的(常见分组列:需求编号 / 关联需求 / 所属模块 / 测试项目 / 模块;Ideal 一类常按「一行需求标题」聚在同一模块列)。`),n.push(`2. 每条新用例必须插到「归属需求」对应分组的最后一行之后,禁止整批发到文件末尾:`),n.push(` - 条目写了归属需求时,优先用它匹配(与文件「需求编号 / 关联需求」列原文一致即可,前缀不限;或模块 / 测试项目 / 标题列包含该文案);`),n.push(` - 没写归属时,根据标题、why、对照需求推断最贴近的一组,再插到该组末尾;`),n.push(` - 整份文件都对不上任何组时,才允许追加到文件末尾,并在回复里说明对不上的原因。`),n.push(`3. 分组列(需求编号 / 关联需求等)优先抄同组已有行的编号;同组也没有编号、且归属需求本身也没有编号时,再补一个自定义编号写入该列(同组多条共用同一个号,风格跟文件里已有编号一致;文件完全没有先例时用短递增号),并在回复里列出新编了哪些号。模块 / 测试项目等展示列仍跟同组邻行一致。`),n.push(`4. 再按文件表头填标题、前置、步骤、预期、优先级、类型、用例编号。用例编号沿用文件规则并避开已用编号。`),n.push(`5. 只插入这些新用例:原有行内容一个字都不要改,也不要重排无关行;步骤一步一个动作,预期写到可判定,不要留「待补」。`),n.push(`6. 我自己也会同时手改这个文件,插入前先按当前内容确认用例编号没有被占用;`),n.push(...pn(t,`add`,7)),n.join(`
12
+ `)}async function Cn(e){let t=e.name||e.path.split(`/`).pop()||e.path;await vn(e.path,e.name,{id:`blindspot-writeback:${dn(e.path)}:${e.items.map(e=>e.id).join(`,`)}`,label:`补进 ${e.items.length} 条场景用例`,detail:t,body:Sn(e)})}var wn=new Map,Tn=new Set,En={current:null};function Dn(e){return{path:e,entry:null,file:null,stale:!1,docs:[],reqId:``,selected:[],reviewPrompt:null,blindspotPrompt:null,error:``,notice:``,reviewRunning:!1,detectRunning:!1,completing:!1,runLabel:``,runLog:[],received:0,runTarget:0,progress:``,runStartedAt:0}}function $(e,t){if(!e)return;let n=wn.get(e)??Dn(e);wn.set(e,{...n,...t,path:e});for(let e of Tn)e()}function On(e){return Tn.add(e),()=>{Tn.delete(e)}}function kn(e){return e.replace(/\.[^.]+$/,``).replace(/[\s_\-—·()()[\]【】]/g,``).toLowerCase()}function An(e,t){let n=t.split(`/`).pop()??t,r=kn(n);if(!r)return``;let i=``,a=0;for(let t of e){let e=kn(t.title),o=kn(t.sourceTitle||``),s=D(n,t.title)||D(n,t.sourceTitle||``),c=e.length>=4&&(r.includes(e)||e.includes(r))||o.length>=4&&(r.includes(o)||o.includes(r));if(!s&&!c)continue;let l=Math.max(E(t.title).length,E(t.sourceTitle||``).length,e.length);l>a&&(i=t.id,a=l)}return i}function jn({open:e,path:t,reviewOn:r,blindspotOn:i,onClose:a,onSaved:c}){let[l,u]=(0,X.useState)(()=>o(`caseReview.tab`,[`quality`,`table`,`blindspot`],`quality`)),d=(0,X.useCallback)(e=>{u(e),s(`caseReview.tab`,e)},[]),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(null),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[D,O]=(0,X.useState)(null),[j,M]=(0,X.useState)(null),[te,N]=(0,X.useState)(!1),[P,ne]=(0,X.useState)(!1),[re,F]=(0,X.useState)(!1),[I,ie]=(0,X.useState)(``),[ae,se]=(0,X.useState)(``),[le,fe]=(0,X.useState)(0),[pe,he]=(0,X.useState)([]),[ge,_e]=(0,X.useState)(0),[ve,ye]=(0,X.useState)(0),[L,be]=(0,X.useState)([]),[R,xe]=(0,X.useState)(``),[Se,Ce]=(0,X.useState)(new Set),z=!!(j?.baseURL&&j.apiKey&&j.model),we=(0,X.useCallback)(e=>{y(e.entry),w(e.file),S(e.stale),be(e.docs),xe(e.reqId),Ce(new Set(e.selected)),E(e.reviewPrompt),O(e.blindspotPrompt),h(e.error),_(e.notice),N(e.reviewRunning),ne(e.detectRunning),F(e.completing),se(e.runLabel),he(e.runLog),_e(e.received),ye(e.runTarget),ie(e.progress),fe(e.runStartedAt?Math.round((Date.now()-e.runStartedAt)/1e3):0),p(!1)},[]),B=(0,X.useCallback)((e,n,r=0)=>{let i=Date.now();se(e),he([n]),_e(0),fe(0),ie(``),ye(r),$(t,{runLabel:e,runLog:[n],received:0,progress:``,runTarget:r,runStartedAt:i,error:``})},[t]),V=(0,X.useCallback)(e=>{he(n=>{let r=[...n.slice(-11),e];return $(t,{runLog:r}),r})},[t]),Ee=(0,X.useCallback)(()=>{se(``),ie(``),fe(0),ye(0),$(t,{runLabel:``,progress:``,runTarget:0,runStartedAt:0,reviewRunning:!1,detectRunning:!1,completing:!1})},[t]),U=(0,X.useCallback)(()=>{let e=En.current;e?e.signal.aborted||(e.abort(),V(`已请求停止,正在收尾…`)):V(`当前没有可中断的请求`)},[V]);(0,X.useEffect)(()=>{if(!ae)return;let e=Date.now(),t=window.setInterval(()=>{fe(Math.round((Date.now()-e)/1e3))},1e3);return()=>window.clearInterval(t)},[ae]);let W=(0,X.useMemo)(()=>{let e=L.find(e=>e.id===R);if(!e)return``;let t=[`# ${e.title}`];for(let n of e.outline)t.push(`- ${n.title}${n.quote?`:${n.quote}`:``}`);for(let n of e.stories)t.push(`- ${n.id} ${n.title}(${n.role})${n.goal?`:${n.goal}`:``}${n.acceptance.length?`;验收:${n.acceptance.map(e=>`${e.given} ${e.when} 则 ${e.then}`).join(` / `)}`:``}`);return t.join(`
13
+ `)},[L,R]);(0,X.useEffect)(()=>(n().then(()=>M(ue())).catch(()=>M(ue())),ce(()=>M(ue()))),[]);let G=(0,X.useCallback)(async()=>{if(t){p(!0),h(``),_(``);try{let[e,n]=await Promise.all([r?je():Promise.resolve(!1),i?qe():Promise.resolve(!1)]);if(!e&&!n){let e="评审服务没起来:确认已用 `lantern dev` 启动(插件依赖本地中间件)。";h(e),$(t,{error:e})}let a=e||n,[o,s]=await Promise.all([oe(t),a?Ke(t):Promise.resolve({entry:null,stale:!1})]),c=s.entry?.review?{...s.entry,review:Te(s.entry.review,o.rows)}:s.entry;if(c?.review&&s.entry?.review&&a){let e=new Map(s.entry.review.cases.map(e=>[K(e),e.contentFp]));if(c.review.cases.some(t=>{let n=K(t);return!!(t.contentFp&&n&&!e.get(n))}))try{c=await Oe(t,{review:c.review})}catch{}}w(o),y(c),S(s.stale);let l=null,u=null,d=[];if(e&&r&&(l=await H(),E(l)),n&&i&&(u=await Ae(),O(u)),e||n)try{d=await de()}catch{d=[]}be(d);let f=An(d,t);xe(f),Ce(new Set),$(t,{file:o,entry:c,stale:s.stale,docs:d,reqId:f,selected:[],reviewPrompt:l,blindspotPrompt:u,error:!e&&!n?wn.get(t)?.error??``:``,notice:``})}catch(e){let n=e instanceof Error?e.message:String(e);h(n),$(t,{error:n})}finally{p(!1)}}},[t,r,i]),Re=(0,X.useCallback)(async()=>{if(t)try{let[e,n]=await Promise.all([oe(t),Ke(t).catch(()=>({entry:null,stale:!1}))]);w(e),S(n.stale),$(t,{file:e,stale:n.stale})}catch{}},[t]);(0,X.useEffect)(()=>{if(!e||!t)return;let n=o(`caseReview.tab`,[`quality`,`table`,`blindspot`],`quality`);d((n===`blindspot`?i:n!==`quality`||r)?n:r?`quality`:`blindspot`);let a=wn.get(t);a?.file?(we(a),Re()):G()},[e,t,G,Re,r,i,d,we]),(0,X.useEffect)(()=>{if(e&&t)return On(()=>{let e=wn.get(t);e&&we(e)})},[e,t,we]),(0,X.useEffect)(()=>{if(R&&L.some(e=>e.id===R))return;let e=An(L,t);e&&(xe(e),$(t,{reqId:e}))},[L,t,R]);let Be=(0,X.useMemo)(()=>C?.headers.length?C.headers:[...ee],[C]),Ve=(0,X.useMemo)(()=>C?.headers.length?k(A(C.headers)):``,[C]),He=(0,X.useMemo)(()=>L.find(e=>e.id===R)?.title??``,[L,R]),Ue=(0,X.useMemo)(()=>C?Pe(C.rows,W):null,[C,W]),q=v?.review??null,J=v?.blindspot??null,We=(0,X.useCallback)(async(e,n,r,i)=>{if(!j)throw Error(`还没读到模型设置`);let a=En.current??new AbortController;if(En.current=a,i?.aborted||a.signal.aborted)throw new DOMException(`Aborted`,`AbortError`);let o=``;for await(let i of me(j,[{role:`system`,content:`${e}\n\n${Yt}`},{role:`user`,content:n}],a.signal,{tools:cn,runTool:(e,n)=>ln(e,n,{onCases:(e,n)=>{r.cases.push(...e),n&&(r.summary=n);let i=r.cases.length+r.items.length;_e(i),$(t,{received:i}),V(`模型交回 ${e.length} 条判定(累计 ${i} 条)`)},onBlindspots:(e,n)=>{r.items.push(...e),n&&(r.summary=n);let i=r.cases.length+r.items.length;_e(i),$(t,{received:i}),V(`模型交回 ${e.length} 条盲区(累计 ${i} 条)`)}})}))i.type===`content`&&(o=`${o}${i.delta}`.slice(-400),ie(o),$(t,{progress:o}))},[j,V,t]),Ge=(0,X.useCallback)((e,t)=>{let n=t.length?t:ee;return e.map((e,t)=>{let r=[`### ${t+1}`];for(let t of n){let n=String(e[t]??``).trim();n&&r.push(`${t}:${n}`)}return r.join(`
14
+ `)}).join(`
15
+
16
+ `)},[]),Je=(0,X.useCallback)(async()=>{if(!C)return;let e=Pe(C.rows,W);if(!C.rows.length){h(`这个文件里没解析到用例行:确认第一行是表头,且有编号与标题列(「测试项目 / 用例名称」这类叫法也认)。`);return}let n=v?.review?Te(v.review,C.rows).cases:[],r=new Map(n.map(e=>[K(e),e]).filter(([e])=>e)),i=Ie(n),a=Le(n,C.rows),o=n.length>0&&a.size>0,s=[];C.rows.forEach((t,n)=>{let r=e.cases[n],c=r?K(r):``;c&&i.has(c)||(!o||c&&a.has(c))&&s.push(n)});let l=s.map(e=>C.rows[e]),u=new Set(s.map(t=>K(e.cases[t])).filter(Boolean)),d=Pe(l,W),f=new AbortController;En.current=f,N(!0),h(``),$(t,{reviewRunning:!0,error:``});let p=o?`重审已修改 ${l.length} 条`:i.size?`全量 ${l.length} 条(已忽略 ${i.size} 条不送评)`:`全量 ${l.length} 条`;B(`评审用例`,`开始评审:${p}(规则 + 模型)`,Math.max(l.length,1));try{if(!l.length){let e=i.size?`没有待评用例(${i.size} 条已忽略)。取消忽略后再评,或先改文件产生「已修改」。`:`没有待评用例。`;V(e),_(e),$(t,{notice:e});return}let a=async n=>{let a=ke(e.cases,n,u,r,e.metrics),s=await Oe(t,{review:a}),l=``;if(o){let e={usable:0,revise:0,invalid:0};for(let t of a.cases){let n=K(t);n&&u.has(n)&&!t.ignored&&(e[t.verdict]+=1)}l=`(本轮重审 ${u.size} 条 → 升可用 ${e.usable} · 仍待修改 ${e.revise} · 仍无效 ${e.invalid})`}let d=`评审完成:${a.cases.length} 条,可用 ${a.counts.usable} · 待修改 ${a.counts.revise} · 错误无效 ${a.counts.invalid}${l}${i.size?` · 忽略 ${i.size}`:``}。`;y(s),S(!1),_(d),$(t,{entry:s,stale:!1,notice:d}),c?.()};if(!z){V(`没有配置模型,只跑规则判定(${p})`),await a(De(d));return}if(f.signal.aborted)throw new DOMException(`Aborted`,`AbortError`);let s=T?.review?.trim();if(!s)throw Error(`没有读到「用例质量评审提示词.md」的「评审」段,先到插件页把插件关掉再打开重新生成。`);V(`规则体检完成:待评 ${d.cases.length} 条(${p}),按五维拼提示词`);let m=Ge(l,C.headers),h=s.replaceAll(`{{cases}}`,`见用户消息里的 ${l.length} 条用例`).replaceAll(`{{requirement}}`,W||`(未挂对照需求)`).replaceAll(`{{template}}`,Be.join(` / `)).replaceAll(`{{fields}}`,Ve),g=[`## 对照需求`,W||`(未挂对照需求,只按用例自身结构评)`,``,`## 用例字段`,Be.join(` / `),``,`## 字段对照`,Ve||`(按文件里的实际表头读)`,``,`## 待评审用例(${l.length} 条)`,m,i.size||n.length&&!o?[``,`## 说明`,o?`本轮只复查已修改的 ${u.size} 条;其余沿用上次判定,请勿评未列出的用例。`:i.size?`另有 ${i.size} 条用户已忽略,不在本次列表中。`:``].filter(Boolean).join(`
17
+ `):``].filter(Boolean).join(`
18
+ `),v={cases:[],items:[],summary:``};if(V(`提示词已就绪,等待模型返回…`),await We(h,g,v,f.signal),f.signal.aborted)throw new DOMException(`Aborted`,`AbortError`);if(!v.cases.length)throw Error(`模型没有提交判定结果,可以重试一次或换成更擅长的模型。`);V(`正在按规则复算分数并落盘…`),await a(ze(d,v.cases,v.summary))}catch(e){if(f.signal.aborted||e instanceof Error&&e.name===`AbortError`){let e=`已停止评审,本次结果没有保存;已有报告保持不变。`;_(e),$(t,{notice:e})}else{let n=e instanceof Error?e.message:String(e),r=/failed to fetch/i.test(n)?`连不上服务(Failed to fetch)。本机热更新或模型 Base URL / 跨域都可能导致;确认 lantern 仍在跑后重试「重新评审」。`:n;h(r),$(t,{error:r})}}finally{N(!1),Ee(),En.current===f&&(En.current=null)}},[C,W,z,T,Ge,Be,Ve,We,t,c,B,V,Ee,v]),Ye=(0,X.useCallback)(async()=>{if(C){ne(!0),h(``),$(t,{detectRunning:!0,error:``}),B(`探测场景盲区`,`开始对照需求检查 ${C.rows.length} 条用例的盲区`);try{if(!z)throw Error(`场景探测需要模型,请先在设置里配置。`);let e=D?.detect?.trim();if(!e)throw Error(`没有读到「场景遗漏补全提示词.md」的「探测」段,先到插件页把插件关掉再打开重新生成。`);let n=(v?.blindspot?.items??[]).filter(e=>e.added),r=new Set(n.map(e=>Fe(e))),i=e.replaceAll(`{{cases}}`,`见用户消息里的 ${C.rows.length} 条用例`),a=[`## 对照需求`,W||`(未挂对照需求)`,``,`## 字段对照`,Ve||`(按文件里的实际表头读)`,``,`## 已有用例(${C.rows.length} 条)`,Ge(C.rows,C.headers),n.length?[``,`## 以下场景已写回用例文件,不要再报为盲区`,...n.map((e,t)=>`${t+1}. [${e.category}] ${e.title}${e.reqAnchor?`(归属 ${e.reqAnchor})`:``}`)].join(`
19
+ `):``].filter(Boolean).join(`
20
+ `),o={cases:[],items:[],summary:``};if(V(`上下文:需求${W?`已挂`:`未挂`} · 四类盲区 · ${C.rows.length} 条已有用例${r.size?` · 跳过已写回 ${r.size}`:``}`),await We(i,a,o),!o.items.length)throw Error(`模型没有提交盲区条目,可以重试一次。`);V(`正在去重并落盘探测结果…`);let s=new Map((v?.blindspot?.items??[]).map(e=>[Fe(e),e])),l=new Set,u=[],d=0;for(let e of o.items){let t=Fe(e);if(l.has(t))continue;if(l.add(t),r.has(t)){d+=1;continue}let n=s.get(t);u.push({...e,id:n?.id||e.id||`bs_${Math.random().toString(16).slice(2,18)}`,reqAnchor:e.reqAnchor?.trim()||n?.reqAnchor||``,added:!1,caseNo:``})}let f={at:new Date().toISOString(),context:{reqRef:R,reqTitle:L.find(e=>e.id===R)?.title??``},items:u,summary:o.summary},p=await Oe(t,{blindspot:f}),m=`探测完成:${u.length} 条盲区${d?`(已去掉 ${d} 条已写回)`:``}。`;y(p),S(!1),_(m),$(t,{entry:p,stale:!1,notice:m}),c?.()}catch(e){if(En.current?.signal.aborted){let e=`已停止探测,本次结果没有保存。`;_(e),$(t,{notice:e})}else{let n=e instanceof Error?e.message:String(e);h(n),$(t,{error:n})}}finally{ne(!1),Ee(),En.current=null}}},[C,z,D,W,Ve,Ge,v,R,L,We,t,c,B,V,Ee]),Xe=(0,X.useCallback)(async()=>{if(!J)return;let e=J.items.filter(e=>Se.has(e.id)&&!e.added);if(e.length){F(!0),h(``),$(t,{completing:!0,error:``}),B(`补全选中条目`,`把 ${e.length} 条盲区补全为完整用例(前置 / 步骤 / 预期)`,e.length);try{if(!z)throw Error(`补全需要模型,请先在设置里配置。`);let n=D?.complete?.trim();if(!n)throw Error(`没有读到「场景遗漏补全提示词.md」的「补全」段,先到插件页把插件关掉再打开重新生成。`);let r=n.replaceAll(`{{selected}}`,`见用户消息里的 ${e.length} 条`),i=[`## 需要补全的条目`,JSON.stringify(e.map(e=>({id:e.id,category:e.category,title:e.title,why:e.why,precondition:e.precondition,steps:e.steps,expected:e.expected,priority:e.priority,reqAnchor:e.reqAnchor})),null,2)].join(`
21
+ `),a={cases:[],items:[],summary:``};if(await We(r,i,a),!a.items.length)throw Error(`模型没有返回补全结果,可以重试一次。`);let o=new Map(a.items.map(e=>[e.id,e])),s=J.items.map(e=>{let t=o.get(e.id);return t?{...e,...t,id:e.id,category:e.category,reqAnchor:t.reqAnchor?.trim()||e.reqAnchor,added:e.added,caseNo:e.caseNo}:e}),l=await Oe(t,{blindspot:{...J,items:s,summary:a.summary||J.summary}}),u=`已补全 ${a.items.length} 条,确认后可写回用例文件。`;y(l),_(u),$(t,{entry:l,notice:u}),c?.()}catch(e){if(En.current?.signal.aborted){let e=`已停止补全,本次结果没有保存。`;_(e),$(t,{notice:e})}else{let n=e instanceof Error?e.message:String(e);h(n),$(t,{error:n})}}finally{F(!1),Ee(),En.current=null}}},[J,Se,z,D,We,t,c,B,Ee]),Ze=(0,X.useCallback)(()=>{if(!J)return;let e=J.items.filter(e=>Se.has(e.id)&&!e.added);if(!e.length)return;h(``);let n=new Set(e.map(e=>e.id));(async()=>{try{let r=J.items.map(e=>n.has(e.id)?{...e,added:!0}:e),i={...J,items:r},a=await Oe(t,{blindspot:i});y(a),$(t,{entry:a}),Ce(e=>{let r=new Set(e);for(let e of n)r.delete(e);return $(t,{selected:[...r]}),r}),c?.(),await Cn({path:t,name:t.split(`/`).pop()??t,items:e,requirementTitle:He})}catch(e){h(e instanceof Error?e.message:String(e))}})()},[J,Se,t,He,c]),Qe=(0,X.useCallback)(e=>{Ce(n=>{let r=new Set(n);return r.has(e)?r.delete(e):r.add(e),$(t,{selected:[...r]}),r})},[t]),$e=(0,X.useCallback)((e,n)=>{Ce(r=>{let i=new Set(r);for(let t of e)n?i.add(t):i.delete(t);return $(t,{selected:[...i]}),i})},[t]),et=(0,X.useMemo)(()=>q&&C?Le(q.cases,C.rows):new Set,[q,C]),tt=(0,X.useCallback)(e=>{let n=K(e);e.ignored||e.fixed||n&&et.has(n)||(h(``),yn({path:t,name:t.split(`/`).pop()??t,verdict:e,requirementTitle:He}).catch(e=>h(e instanceof Error?e.message:String(e))))},[t,He,et]),Y=(0,X.useCallback)(e=>{let n=e.filter(e=>{let t=K(e);return!e.ignored&&!e.fixed&&!(t&&et.has(t))&&e.verdict!==`usable`});n.length&&(h(``),xn({path:t,name:t.split(`/`).pop()??t,verdicts:n,requirementTitle:He}).catch(e=>h(e instanceof Error?e.message:String(e))))},[t,He,et]),nt=(0,X.useCallback)(async(e,n)=>{if(!q||!e.length)return;let r=new Set(e.map(e=>K(e)).filter(Boolean));if(!r.size)return;let i=q.cases.map(e=>{if(!r.has(K(e)))return e;let t={...e};return n?t.ignored=!0:delete t.ignored,t}),a={usable:0,revise:0,invalid:0};for(let e of i)e.ignored||(a[e.verdict]+=1);let o=await Oe(t,{review:{...q,cases:i,counts:a}});y(o),$(t,{entry:o}),c?.()},[q,t,c]),rt=(0,X.useCallback)(e=>{e.ignored||e.verdict===`usable`||(h(``),nt([e],!0).catch(e=>h(e instanceof Error?e.message:String(e))))},[nt]),it=(0,X.useCallback)(e=>{e.ignored&&(h(``),nt([e],!1).catch(e=>h(e instanceof Error?e.message:String(e))))},[nt]),at=q?Me(q.cases,et):0,ot=J?J.items.filter(e=>!e.added).length:0,st=[{key:`quality`,label:`质量评审${q?` · 需改 ${at}`:``}`},{key:`table`,label:`用例表格${C?` ${C.rows.length}`:``}`},{key:`blindspot`,label:`场景补全${ot?` ${ot}`:``}`}],ct=t.split(`/`).pop()??t;return(0,Z.jsxs)(b,{open:e,onClose:a,title:`用例评审 · ${ct}`,widthClass:`max-w-5xl`,children:[!r||!i?(0,Z.jsxs)(`p`,{className:`text-[11px] text-stone-400`,children:[`未启用`,r?``:`「用例质量评审」`,!r&&!i?` / `:``,i?``:`「场景遗漏补全」`,`插件:到插件页开启后才能用对应 Tab。`]}):null,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg bg-stone-100 p-0.5`,children:st.map(e=>{let t=e.key===`quality`&&!r||e.key===`blindspot`&&!i;return(0,Z.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>d(e.key),className:`h-7 rounded-md px-2.5 text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${l===e.key?`bg-white text-stone-900 shadow-sm`:`text-stone-500 hover:text-stone-700`}`,children:e.label},e.key)})}),He?(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-stone-400`,children:[`已挂:`,He]}):(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-amber-700`,children:`未匹配到需求(覆盖率不计)`})]}),ae?(0,Z.jsxs)(`div`,{className:`rounded-lg border border-stone-200 bg-white px-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[11px]`,children:[(0,Z.jsx)(`span`,{className:`tw-lib-spin shrink-0`,style:{width:14,height:14,borderWidth:2},"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`font-medium text-stone-700`,children:[ae,`中…`]}),(0,Z.jsxs)(`span`,{className:`tabular-nums text-stone-500`,children:[le,`s`]}),ge?(0,Z.jsxs)(`span`,{className:`text-stone-500`,children:[`已收到 `,ge,` 条`,ve?` / ${ve}`:``]}):null]}),(0,Z.jsx)(`div`,{className:`tw-run-track mt-2`,role:`progressbar`,"aria-label":`${ae}进度`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ve>0?Math.round(Math.min(ge,ve)/ve*100):void 0,children:ve>0?(0,Z.jsx)(`div`,{className:`tw-run-fill`,style:{width:`${Math.round(Math.min(ge,ve)/ve*100)}%`}}):(0,Z.jsx)(`div`,{className:`tw-run-fill tw-run-fill--indeterminate`})}),(0,Z.jsxs)(`div`,{className:`mt-1.5 space-y-0.5`,children:[pe.slice(-3).map((e,t)=>(0,Z.jsxs)(`div`,{className:`truncate text-[10px] text-stone-400`,children:[`· `,e]},`${t}-${e}`)),I?(0,Z.jsx)(`div`,{className:`line-clamp-2 text-[10px] leading-4 text-stone-500`,children:I}):null]})]}):null,x?(0,Z.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-1.5 text-[11px] text-amber-800`,children:`文件在评审后改过,结论可能已过期;重新评审可刷新。`}):null,g?(0,Z.jsx)(`p`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-1.5 text-[11px] text-emerald-700`,children:g}):null,m&&C?(0,Z.jsx)(`p`,{className:`rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-[11px] whitespace-pre-wrap text-rose-700`,children:m}):null,f?(0,Z.jsx)(`p`,{className:`py-10 text-center text-xs text-stone-400`,children:`读取中…`}):m&&!C?(0,Z.jsx)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 px-4 py-6 text-center text-xs text-rose-700 whitespace-pre-wrap`,children:m}):l===`quality`?(0,Z.jsx)(Nt,{review:q,running:te,modelReady:z,onRun:Je,onStop:U,onFix:tt,onFixBatch:Y,onIgnore:rt,onUnignore:it,autoFixedKeys:et,onExport:()=>Ne(ct,q,J)}):l===`table`?(0,Z.jsx)(qt,{file:C,audit:Ue,review:q,fileName:ct,autoFixedKeys:et}):(0,Z.jsx)(Lt,{report:J,loading:f,running:P,completing:re,modelReady:z,onStop:U,selected:Se,onToggle:Qe,onToggleCategory:$e,onDetect:Ye,onComplete:Xe,onWriteback:Ze,onExport:()=>Ne(ct,q,J)})]})}var Mn=10,Nn=new Set([`.xlsx`,`.xls`,`.csv`,`.md`]),Pn=`.xlsx,.xls,.csv,.md,text/csv,text/markdown,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel`;function Fn(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t).toLowerCase():``}function In(e){return Nn.has(Fn(e))}function Ln(e){let t=e.split(/[/\\]/).pop()||e;return!!(F(t)||lt(t)||t.startsWith(`~$`)||t.endsWith(`~`))}async function Rn(e=`.`){let{entries:t}=await M(`cases`,e),n=[];for(let e of t)e.type===`file`?!Ln(e.path)&&!Ln(e.name)&&n.push(e):!ct(e.name)&&!ct(e.path)&&n.push(...await Rn(e.path));return n}function zn(){let e=ve(`cases`),[t,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!0),[p,m]=(0,X.useState)(!1),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)({}),[b,S]=(0,X.useState)(()=>c(`caseReview.path`)),[C,w]=(0,X.useState)(()=>!!c(`caseReview.path`)&&o(`caseReview.open`,[`0`,`1`],`0`)===`1`),[E,D]=(0,X.useState)(e?!0:null),[O,ee]=(0,X.useState)(()=>e??[]),[k,A]=(0,X.useState)({}),[j,M]=(0,X.useState)(null),[N,F]=(0,X.useState)(!1),[I,oe]=(0,X.useState)(null),[se,ce]=(0,X.useState)(!1),[le,ue]=(0,X.useState)(0),[de,fe]=(0,X.useState)(null),[pe,me]=(0,X.useState)(``),[be,R]=(0,X.useState)(null),[xe,Se]=(0,X.useState)(null),[Ce,z]=(0,X.useState)(``),[B,Te]=(0,X.useState)(null),V=(0,X.useRef)(null),H=_e(O,Mn,`cases`),De=(0,X.useCallback)(async()=>{try{let e=await vt();ue(e.length)}catch{ue(0)}},[]),U=(0,X.useCallback)(async()=>{M(null);let e=await Rn(`.`);ee(e),ge(`cases`,e),A(t=>{let n={};for(let r of e)t[r.path]&&(n[r.path]=!0);return n}),De()},[De]);(0,X.useEffect)(()=>{let e=i(e=>{f(!!e.cases),m(!!e.caseReview),_(!!e.caseBlindspot)});return n().then(()=>{f(r(`cases`)),m(r(`caseReview`)),_(r(`caseBlindspot`)),u(!0)}),e},[]);let ke=(0,X.useCallback)(async()=>{if(!p&&!g)y({});else try{let e=await Ee();y(Object.fromEntries(e.map(e=>[e.path,e])))}catch{y({})}},[p,g]);(0,X.useEffect)(()=>{t&&d&&E!==!1&&ke()},[t,d,E,ke]),(0,X.useEffect)(()=>{t&&d&&(async()=>{if(!await ie(`cases`))D(!1);else try{await L().catch(()=>null),await U(),D(!0)}catch(e){M(e instanceof Error?e.message:String(e)),D(!0)}})()},[t,d,U]);let Ae=(0,X.useMemo)(()=>Object.keys(k).filter(e=>k[e]),[k]);async function je(){let e=I;if(e){oe(null),F(!0),M(null);try{if(e.kind===`one`)await re(`cases`,e.entry.path);else{for(let t of e.paths)await re(`cases`,t);A({})}await U(),T(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个用例文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);M(t),T(`删除失败:${t}`,`error`)}finally{F(!1)}}}let Me=I?.kind===`one`?`删除「${I.entry.name}」?将从 ${he(`cases`)} 中移除。`:I?.kind===`batch`?`确认删除已选中的 ${I.paths.length} 个用例文件?此操作不可恢复。`:``;function W(){r(`caseGen`)?window.location.href=`/workbench/?plugin=caseGen`:M(a(`caseGen`))}async function Ne(e){F(!0),M(null);try{await we(`cases`,e)}catch(e){M(e instanceof Error?e.message:String(e)),F(!1)}}function G(e){me(``),fe(e)}function Pe(e){z(``),Se(e)}let Fe=(0,X.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=O.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[O]);async function Ie(e){let t=xe;if(!t)return;let n=e.trim();if(!n||n===t.name){Se(null),z(``);return}let r=Fe(te(t.path),n,t.path);if(r)z(`已存在同名文件「${r}」,换个名字再试`);else{F(!0),M(null),z(``);try{let e=await ne(`cases`,t.path,n);if(e!==t.path&&(p||g))try{let{entry:n}=await Ke(t.path);(n?.review||n?.blindspot)&&(await Oe(e,{review:n.review??null,blindspot:n.blindspot??null}),await Oe(t.path,{review:null,blindspot:null}))}catch{}b===t.path&&(S(e),l(`caseReview.path`,e)),Se(null),await U(),ke(),T(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);z(t),T(`重命名失败:${t}`,`error`)}finally{F(!1)}}}async function Le(e){let t=de;if(t){F(!0),M(null),me(``);try{let{name:n}=await Ge(t.path,e);fe(null),T(`已备份到备份列表:${n}`,`success`),await De()}catch(e){let t=e instanceof Error?e.message:String(e);me(t),T(`备份失败:${t}`,`error`)}finally{F(!1)}}}async function Re(e){let t=typeof e==`string`?e:e.path;M(null);try{await ae(`cases`,t)}catch(e){M(e instanceof Error?e.message:String(e))}}function ze(e){let t=new Set(O.filter(e=>te(e.path)===`.`).map(e=>e.name.toLowerCase())),n=[],r=new Set;for(let i of e){let e=i.name.toLowerCase();t.has(e)&&!r.has(e)&&(n.push(i.name),r.add(e))}return n}async function Be(e){if(e.length){F(!0),M(null);try{for(let t of e)await P(`cases`,`.`,t);await U(),T(`已上传 ${e.length} 个文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);M(t),T(`上传失败:${t}`,`error`)}finally{F(!1),Te(null),V.current&&(V.current.value=``)}}}function Ve(e){if(!e?.length)return;let t=Array.from(e),n=t.filter(e=>In(e.name)),r=t.filter(e=>!In(e.name));r.length&&T(`已跳过 ${r.length} 个不支持的格式(仅 .xlsx / .xls / .csv / .md)`,`error`),n.length?ze(n).length?Te(n):Be(n):V.current&&(V.current.value=``)}return t?d?E===null?(0,Z.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):E?(0,Z.jsxs)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,Z.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,Z.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[H.query.trim()?(0,Z.jsxs)(Z.Fragment,{children:[`匹配 `,(0,Z.jsx)(`span`,{className:`font-medium text-stone-800`,children:H.filtered.length}),` 个`,(0,Z.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,O.length]})]}):(0,Z.jsxs)(Z.Fragment,{children:[`共 `,(0,Z.jsx)(`span`,{className:`font-medium text-stone-800`,children:O.length}),` 个文件`]}),Ae.length>0?(0,Z.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Ae.length]}):null]}),(0,Z.jsx)(`input`,{ref:V,type:`file`,multiple:!0,accept:Pn,className:`hidden`,onChange:e=>Ve(e.target.files)}),(0,Z.jsxs)(`button`,{type:`button`,disabled:N,onClick:()=>ce(!0),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40`,children:[`备份列表`,le>0?`(${le>99?`99+`:le})`:``]}),(0,Z.jsx)(`button`,{type:`button`,disabled:N||Ae.length===0,onClick:()=>oe({kind:`batch`,paths:Ae}),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-red-600 border border-red-200 rounded-lg hover:bg-red-50 disabled:opacity-40`,children:`批量删除`}),(0,Z.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>V.current?.click(),className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-stone-700 border border-stone-200 rounded-lg hover:bg-stone-50 disabled:opacity-40`,children:`上传用例`}),(0,Z.jsx)(`button`,{type:`button`,disabled:N,onClick:W,className:`h-8 px-3 shrink-0 whitespace-nowrap text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40`,children:`生成用例`})]}),j?(0,Z.jsx)(`div`,{className:`shrink-0 mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:j}):null,(0,Z.jsx)(ye,{files:O,filtered:H.filtered,pageFiles:H.pageFiles,query:H.query,onQuery:H.setQuery,sortBy:H.sortBy,onSortBy:H.setSortBy,page:H.page,totalPages:H.totalPages,pageSize:H.pageSize,onPage:H.setPage,onPageSize:H.setPageSize,busy:N,emptyText:`暂无用例文件,可「上传用例」导入本地文件,或点「生成用例」前往工作台。`,searchPlaceholder:`搜索文件名或路径…`,resizeKey:`docs:cases:cols:v1`,extraColumn:p||g?{header:`评审`,render:e=>{let t=v[e.path];if(!t)return(0,Z.jsx)(`span`,{className:`text-[11px] text-stone-300`,children:`—`});let n=t.score;return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 whitespace-nowrap`,children:[n==null?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-stone-400`,children:`未评审`}):(0,Z.jsxs)(`span`,{className:`shrink-0 text-[11px] font-medium tabular-nums ${n==null?`text-stone-500`:n>=85?`text-emerald-700`:n>=60?`text-amber-700`:`text-rose-700`}`,children:[n,` 分`]}),t.blindspotCount?(0,Z.jsxs)(`span`,{className:`shrink-0 text-[10px] text-stone-400`,children:[`补 `,t.blindspotCount]}):null,t.stale?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-amber-600`,children:`过期`}):null]})}}:void 0,selected:k,onToggleRow:e=>A(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>A(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Re(e),renderNameAction:e=>(0,Z.jsx)(`button`,{type:`button`,disabled:N,"aria-label":`重命名 ${e.name}`,onClick:()=>Pe(e),className:`inline-flex h-6 w-6 items-center justify-center rounded text-stone-400 transition-colors hover:bg-[#e8f0fe] hover:text-[#4176e6] disabled:opacity-40`,children:(0,Z.jsx)(x,{name:`pencil`,size:12})}),renderActions:e=>(0,Z.jsxs)(Z.Fragment,{children:[p||g?(0,Z.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>{S(e.path),w(!0),l(`caseReview.path`,e.path),s(`caseReview.open`,`1`)},className:`text-xs whitespace-nowrap text-stone-700 border border-stone-200 px-2 py-1 rounded hover:bg-stone-50 cursor-pointer disabled:opacity-40`,children:`评审`}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>G(e),className:`text-xs whitespace-nowrap text-stone-700 border border-stone-200 px-2 py-1 rounded hover:bg-stone-50 cursor-pointer disabled:opacity-40`,children:`备份`}),(0,Z.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>R(e),className:`text-xs whitespace-nowrap text-stone-700 border border-stone-200 px-2 py-1 rounded hover:bg-stone-50 cursor-pointer disabled:opacity-40`,children:`重排`}),(0,Z.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>void Ne(e),className:`text-xs whitespace-nowrap text-white bg-[#4176e6] px-2 py-1 rounded hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,Z.jsx)(`button`,{type:`button`,disabled:N,onClick:()=>oe({kind:`one`,entry:e}),className:`text-xs whitespace-nowrap text-red-600 hover:bg-red-50 px-2 py-1 rounded cursor-pointer disabled:opacity-40`,children:`删除`})]})}),(0,Z.jsx)(h,{open:I!=null,title:I?.kind===`batch`?`批量删除`:`删除用例文件`,message:Me,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>oe(null),onConfirm:()=>void je()}),(0,Z.jsx)(h,{open:B!=null,title:`覆盖同名文件`,message:B?`以下文件已存在于用例管理根目录,继续将覆盖:${ze(B).join(`、`)}。是否继续?`:``,confirmLabel:`覆盖上传`,cancelLabel:`取消`,danger:!0,onClose:()=>{N||(Te(null),V.current&&(V.current.value=``))},onConfirm:()=>{let e=B;e&&Be(e)}}),(0,Z.jsx)(nt,{open:de!=null,title:`备份用例`,label:`备份文件名`,placeholder:`请输入备份文件名`,initialValue:de?.name??``,lockExtension:!0,confirmLabel:`备份`,cancelLabel:`取消`,error:pe,onClose:()=>{N||(fe(null),me(``))},onConfirm:e=>void Le(e)}),(0,Z.jsx)(nt,{open:xe!=null,title:`重命名用例`,label:`文件名称`,placeholder:`请输入文件名`,initialValue:xe?.name??``,lockExtension:!0,confirmLabel:`保存`,cancelLabel:`取消`,error:Ce,onClose:()=>{N||(Se(null),z(``))},onConfirm:e=>void Ie(e)}),(0,Z.jsx)(Dt,{open:be!=null,casePath:be?.path??``,fileName:be?.name??``,onClose:()=>R(null),onDone:e=>{T(e,`success`),U(),ke()},onError:e=>T(e,`error`)}),(0,Z.jsx)(jn,{open:C&&!!b,path:b,reviewOn:p,blindspotOn:g,onClose:()=>{w(!1),s(`caseReview.open`,`0`),ke()},onSaved:()=>void ke()}),(0,Z.jsx)(yt,{open:se,onClose:()=>ce(!1),onChanged:()=>void U()})]}):(0,Z.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:`用例管理需要本地文档服务,当前未就绪。`}):(0,Z.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`cases`)}):(0,Z.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{zn as default};