lantern-harness 0.1.37 → 0.1.38
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.
- package/CHANGELOG.md +18 -0
- package/README.md +9 -15
- package/builtin/session/lh-spaces.mjs +8 -2
- package/builtin/session/space-context.mjs +2 -2
- package/cli/data-root.mjs +2 -2
- package/cli/lantern.mjs +149 -24
- package/cli/user-config.mjs +108 -10
- package/dist/500.html +3 -3
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.CdBewZc9.js → Base.astro_astro_type_script_index_0_lang.C17uMscj.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.Hq9MCdxl.js → CaseGenerateApp.fUXTG_NE.js} +1 -1
- package/dist/_astro/{CasesLibrary.DptLD8ae.js → CasesLibrary.CVPhAnFf.js} +1 -1
- package/dist/_astro/{ChatApp.CUrUFBY4.js → ChatApp.KceL1TNg.js} +1 -1
- package/dist/_astro/{PluginsPage.6moeF68Q.js → PluginsPage.BFEwg0vr.js} +1 -1
- package/dist/_astro/PluginsPage.CPEoYrlx.js +1 -0
- package/dist/_astro/{PromptsLibrary.D8n2TGTV.js → PromptsLibrary.CNLcQ66B.js} +1 -1
- package/dist/_astro/{ReqAnalysisBoard.1OolNXqU.js → ReqAnalysisBoard.DaOV-2Z2.js} +1 -1
- package/dist/_astro/{SettingsDialog.BMph2QUr.js → SettingsDialog.DFnXkw7a.js} +1 -1
- package/dist/_astro/app-version.BsRPDlqD.js +1 -0
- package/dist/_astro/{case-gen-run.C_Y3mlu1.js → case-gen-run.BaUxa_BR.js} +1 -1
- package/dist/_astro/{req-analysis.BgIbt-VI.js → req-analysis.ilj0McI3.js} +1 -1
- package/dist/_astro/{story-review.D6yzlcwY.js → story-review.Bsm2JWdj.js} +1 -1
- package/dist/case-exec/index.html +3 -3
- package/dist/cases/generate/index.html +4 -4
- package/dist/cases/library/index.html +4 -4
- package/dist/dashboard/index.html +3 -3
- package/dist/docs/changelog/index.html +58 -42
- package/dist/docs/install/index.html +19 -10
- package/dist/docs/manual/index.html +6 -3
- package/dist/knowledge/index.html +3 -3
- package/dist/life/kr-tasks/index.html +3 -3
- package/dist/life/kr-todos/index.html +3 -3
- package/dist/life/objectives/index.html +3 -3
- package/dist/life/reviews/index.html +3 -3
- package/dist/life/stages/index.html +3 -3
- package/dist/life/year-plans/index.html +3 -3
- package/dist/plugins/index.html +4 -4
- package/dist/pm/bugs/index.html +3 -3
- package/dist/pm/iterations/index.html +3 -3
- package/dist/pm/projects/detail/index.html +3 -3
- package/dist/pm/projects/index.html +3 -3
- package/dist/pm/requirements/index.html +3 -3
- package/dist/prompts/index.html +4 -4
- package/dist/reports/index.html +3 -3
- package/dist/requirement-analysis/index.html +4 -4
- package/dist/requirements/index.html +3 -3
- package/dist/tasks/index.html +3 -3
- package/dist/templates/index.html +3 -3
- package/dist/test-automation/index.html +3 -3
- package/dist/test-stats/index.html +3 -3
- package/dist/todos/index.html +3 -3
- package/dist/workbench/index.html +4 -4
- package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +16 -6
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +2 -0
- package/package.json +2 -2
- package/dist/_astro/PluginsPage.YOpImJhn.js +0 -1
- package/dist/_astro/app-version.DAXbxwiA.js +0 -1
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.
|
|
6
|
+
</script><script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.C17uMscj.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.37">v0.1.37<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="{"data-astro-transition-persist":[0,"astro-gyrtbwwo-1"]}" ssr client="only" opts="{"name":"SpaceSwitcher","value":"react"}" 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="{"data-astro-transition-persist":[0,"astro-iywf7oe7-2"]}" ssr client="only" opts="{"name":"NavLibraries","value":"react"}" 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.38">v0.1.38<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="{"data-astro-transition-persist":[0,"astro-gyrtbwwo-1"]}" ssr client="only" opts="{"name":"SpaceSwitcher","value":"react"}" 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="{"data-astro-transition-persist":[0,"astro-iywf7oe7-2"]}" ssr client="only" opts="{"name":"NavLibraries","value":"react"}" 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.
|
|
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.DFnXkw7a.js" component-export="default" renderer-url="/_astro/client.BHNTqLjv.js" props="{}" ssr client="load" opts="{"name":"SettingsDialog","value":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.
|
|
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.BsRPDlqD.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();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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.TgxIOKMD.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.
|
|
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.TgxIOKMD.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.BaUxa_BR.js";import{t as p}from"./export.joBT53eb.js";import{a as m,i as h,n as g,o as _,r as v,s as te,t as ne}from"./case-template.F1Nv08GV.js";import{b as y,m as re,p as b,u as x}from"./settings.NTeTjmxg.js";import{_ as S,c as C,f as w,l as ie,p as T,r as E,u as D,v as ae}from"./project-docs.DAw9bzgk.js";import{o as oe}from"./llm.DyweO-KK.js";import{n as O}from"./doc-roots.DAJP9Svr.js";import{r as se}from"./prompts-meta.Dnmq-SnF.js";import{t as ce}from"./ExcelFieldTags.CXif3Ilh.js";import{t as le}from"./MultiSelectDropdown.y8JMbCxO.js";import{t as k}from"./SearchableSelect.5SfNLwNW.js";var A=e(t(),1),j=r(),ue=[{value:`md`,label:`Markdown 表格`},{value:`xlsx`,label:`Excel`},{value:`csv`,label:`CSV`}];function de(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 fe(e){return(e.split(`/`).pop()||e).replace(/\.[^.]+$/,``).trim()}function pe(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 me(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 he(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 ge(e){if(!e)return`—`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return`—`}}async function _e(e){let t=s(e).templateFolder;try{let{entries:e}=await C(`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 w(`templates`,e.path);if(t.encoding===`base64`&&t.contentBase64){let e=h(t.contentBase64);n=e.headers,i=e.body}}else if(t.endsWith(`.csv`)){let t=await T(`templates`,e.path),r=g(t.content);n=r.headers,i=r.body}else if(t.endsWith(`.md`)||t.endsWith(`.txt`)){let t=await T(`templates`,e.path),r=v(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 ve(t){let n=t.toLowerCase();if(n.endsWith(`.md`)||n.endsWith(`.txt`)||n.endsWith(`.csv`))return(await T(`requirements`,t)).content;if(n.endsWith(`.docx`)){let n=await w(`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 y(()=>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,A.useState)(null),[r,h]=(0,A.useState)(!1),[g,v]=(0,A.useState)([]),[y,w]=(0,A.useState)(``),[M,N]=(0,A.useState)(`functional`),[P,ye]=(0,A.useState)([]),[be,F]=(0,A.useState)(``),[xe,Se]=(0,A.useState)([]),[I,L]=(0,A.useState)(``),[Ce,R]=(0,A.useState)(``),[we,Te]=(0,A.useState)([]),[z,B]=(0,A.useState)([]),[V,H]=(0,A.useState)(`md`),[U,Ee]=(0,A.useState)(``),[W,G]=(0,A.useState)(null),[K,De]=(0,A.useState)(!1),[Oe,q]=(0,A.useState)(null),[J,Y]=(0,A.useState)(null),X=(0,A.useRef)(null),ke=(0,A.useRef)(null),Z=(0,A.useMemo)(()=>P.find(e=>e.id===be)??P[0],[P,be]),Q=M,Ae=s(Q).label;(0,A.useEffect)(()=>{n().then(()=>t(x()));let e=b(()=>t(x()));return(async()=>{await c();let e=await E(`requirements`),t=await E(`cases`),n=await E(`templates`),r=await E(`prompts`),i=await E(`knowledge`);h(e&&t&&n&&r);async function a(e,t,n){let{entries:r}=await C(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),v(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=>!se(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&&!se(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),w(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),w(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,A.useEffect)(()=>{if(!r)return;let e=!1;return _e(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,A.useEffect)(()=>{I?T(`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,A.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(y)try{let t=await ve(y);e+=`\n### 需求文档:${y}\n${t}\n`}catch{e+=`\n### 需求文档:${y}\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 T(`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 ie(`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 ae(`cases`,l,_(e,a,u)):t.outputFormat===`csv`?await ae(`cases`,l,m(e,u)):await S(`cases`,l,await te(e,u,i.label)),l}async function Ne(){if(!y)return``;let e=fe(y);try{return pe(await ve(y))||e}catch{return e}}async function Pe(t,n){if(!e){re(`model`);return}if(!r){q(`本地文档服务未就绪,无法读写用例 / 需求 / 模板库`);return}let i=await Ne(),o=n;o?(u(o.id,{caseType:M,outputFormat:V,reqPaths:y?[y]:[],templateId:Z?.id,templateTitle:Z?.title,promptPath:I||void 0,knowledgePaths:z.length?[...z]:void 0}),o={...o,caseType:M,outputFormat:V,reqPaths:y?[y]:[],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:y?[y]:[],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
3
|
|
|
4
4
|
【运行时约束】
|
|
5
5
|
- 用例类型:${l}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_astro/export.joBT53eb.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.BS20yicJ.js";import{t as v}from"./OverflowHint.pvo2Xc8R.js";import{t as y}from"./SelectDropdown.TgxIOKMD.js";import{showToast as b}from"./Toast.BO2NFckG.js";import{i as x,n as S,o as C}from"./case-gen-run.C_Y3mlu1.js";import{a as ee,i as w,t as T}from"./export.joBT53eb.js";import{i as E,n as D,r as O,t as k}from"./case-fields.Dqkws1iX.js";import{b as A,p as j,s as M,u as N}from"./settings.NTeTjmxg.js";import{M as P,v as F,z as te}from"./req-analysis.BgIbt-VI.js";import{c as ne,d as re,f as ie,g as ae,h as oe,n as se,o as ce,p as le,r as ue,u as de}from"./project-docs.DAw9bzgk.js";import{s as fe}from"./llm.DyweO-KK.js";import{n as pe}from"./doc-roots.DAJP9Svr.js";import{i as me,n as he,r as ge,t as _e}from"./DocsFileBrowser.9WTBumS5.js";import{d as ve,f as I,h as ye,l as L,n as be,o as R,p as z,t as xe,v as Se}from"./open-docs-in-session.5cTowYAC.js";import{A as Ce,C as B,D as V,E as we,M as Te,N as Ee,O as H,P as De,S as Oe,T as ke,_ as Ae,a as je,b as Me,c as U,d as Ne,f as Pe,g as Fe,h as Ie,j as Le,k as Re,l as ze,m as Be,n as Ve,o as W,p as G,s as He,t as K,u as q,v as Ue,w as We,x as Ge,y as Ke}from"./case-review.s1w_mD4l.js";import{a as qe,c as Je,d as Ye,i as Xe,l as Ze,n as Qe,o as $e,t as J}from"./ColumnResize.CkE59sGq.js";import{t as et}from"./NamePromptDialog.Csfnh5eM.js";import{t as tt}from"./SlideOverDrawer.C1IVOc_8.js";import{m as nt}from"./PmShared.BJpoEYvk.js";import{o as rt,r as it,s as at,t as ot}from"./composer-task.DJmluzPT.js";var Y=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 X=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 ne(`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 ke()){let t=await B();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,Y.useState)([]),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)({}),[p,m]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(``),[ee,w]=(0,Y.useState)(1),[T,E]=g(dt,ft),D=Ze(`lh:case-backup:cols:v4`,pt),O=Ye(`case-backup`),k=(0,Y.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,Y.useEffect)(()=>{e&&(w(1),k())},[e,k]);let A=Math.max(1,Math.ceil(r.length/T)),j=Math.min(ee,A),M=(0,Y.useMemo)(()=>r.slice((j-1)*T,j*T),[r,j,T]),N=(0,Y.useMemo)(()=>Object.keys(d).filter(e=>d[e]),[d]),P=M.length>0&&M.every(e=>d[e.id]);async function F(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 se(`cases`,e.path);r.length&&await Ke(r.map(e=>e.reviewName||e.name)),b(e.length===1?`已删除「${e[0].name}」`:`已删除 ${e.length} 个备份`,`success`),await k(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);u(t),b(`删除失败:${t}`,`error`)}finally{c(!1)}}async function te(){let e=p;if(m(null),!e)return;if(e.kind===`one`){await F([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 F(n)}async function ne(e){if(e.kind!==`legacy`)try{await de(`cases`,e.path)}catch(e){u(e instanceof Error?e.message:String(e))}}function ie(e){e.kind!==`legacy`&&(C(``),x(e))}async function ae(e){let t=y;if(!t||t.kind===`legacy`)return;let i=e.trim();if(!i||i===t.name){x(null),C(``);return}let a=re(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)C(`已存在同名文件「${s.name}」,换个名字再试`);else{c(!0),u(null),C(``);try{await oe(`cases`,t.path,i),x(null),b(`已重命名为「${i}」`,`success`),await k(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);C(t),b(`重命名失败:${t}`,`error`)}finally{c(!1)}}}let ce=p?.kind===`one`?`删除备份「${p.row.name}」?此操作不可恢复。`:p?.kind===`batch`?`确认删除已选中的 ${p.ids.length} 个备份?此操作不可恢复。`:``;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(tt,{open:e,onClose:t,title:`备份列表`,closeAriaLabel:`关闭备份列表`,widthClass:`max-w-5xl`,bodyClassName:`flex flex-col gap-3 overflow-hidden`,escDisabled:!!p||y!=null,footer:(0,X.jsxs)(`footer`,{className:`shrink-0 p-4 border-t border-stone-100 flex items-center gap-2`,children:[(0,X.jsxs)(`button`,{type:`button`,disabled:s||N.length===0,onClick:()=>m({kind:`batch`,ids:N}),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:[`删除所选`,N.length?`(${N.length})`:``]}),(0,X.jsx)(`div`,{className:`flex-1`}),(0,X.jsx)(`button`,{type:`button`,disabled:s||a,onClick:()=>void k(),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,X.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,X.jsxs)(`p`,{className:`shrink-0 text-xs text-stone-500 leading-5`,children:[`新备份在「用例管理/`,st,`/」(首次备份时自动创建,主列表不展示该文件夹)。历史旁路 .bak* 仍可在此查看。备份不会自动过期,请手动删除。`]}),l?(0,X.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,X.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 text-xs text-stone-500`,children:[(0,X.jsxs)(`span`,{children:[`共 `,(0,X.jsx)(`span`,{className:`font-medium text-stone-800`,children:r.length}),` 个`]}),a?(0,X.jsx)(`span`,{children:`加载中…`}):null]}),r.length===0&&!a?(0,X.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,X.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-hidden rounded-xl border border-stone-200 flex flex-col`,children:[(0,X.jsx)(`div`,{ref:O,className:`tw-scroll-x flex-1 min-h-0 overflow-auto`,children:(0,X.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-left text-sm`,style:D.tableStyle,children:[(0,X.jsx)(`colgroup`,{children:pt.map(e=>(0,X.jsx)(`col`,{style:D.widthOf(e.key)?{width:D.widthOf(e.key)}:void 0},e.key))}),(0,X.jsx)(`thead`,{className:`bg-stone-50 text-xs text-stone-500`,children:(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`${qe} relative`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:P,disabled:s||M.length===0,onChange:e=>{let t=e.target.checked;f(e=>{let n={...e};for(let e of M)t?n[e.id]=!0:delete n[e.id];return n})},"aria-label":`全选本页备份`}),(0,X.jsx)(J,{...D.resizeProps(`select`)})]}),(0,X.jsxs)(`th`,{className:$e,style:{"--tw-sticky-left":`${ut}px`},children:[`文件名`,(0,X.jsx)(J,{...D.resizeProps(`name`)})]}),(0,X.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`类型`,(0,X.jsx)(J,{...D.resizeProps(`kind`)})]}),(0,X.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`备份时间`,(0,X.jsx)(J,{...D.resizeProps(`mtime`)})]}),(0,X.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`大小`,(0,X.jsx)(J,{...D.resizeProps(`size`)})]}),(0,X.jsx)(`th`,{"aria-hidden":`true`}),(0,X.jsx)(`th`,{className:Je,children:`操作`})]})}),(0,X.jsx)(`tbody`,{children:M.map(e=>(0,X.jsxs)(`tr`,{className:`group border-t border-stone-100 ${e.kind===`legacy`?``:`cursor-pointer`}`,onDoubleClick:()=>{e.kind===`legacy`||s||ne(e)},children:[(0,X.jsx)(`td`,{className:Qe,onDoubleClick:e=>e.stopPropagation(),children:(0,X.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,X.jsx)(`td`,{className:`${Qe} min-w-0 max-w-0`,style:{"--tw-sticky-left":`${ut}px`},children:(0,X.jsxs)(`div`,{className:`inline-flex min-w-0 max-w-full items-center`,children:[(0,X.jsx)(v,{text:e.name,className:`min-w-0 truncate font-medium text-stone-800`}),e.kind===`legacy`?null:(0,X.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,X.jsx)(`button`,{type:`button`,disabled:s,"aria-label":`重命名 ${e.name}`,onClick:()=>ie(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,X.jsx)(nt,{name:`pencil`,size:12})})})]})}),(0,X.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:ht(e.kind)}),(0,X.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:gt(e.mtime)}),(0,X.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap tabular-nums`,children:_t(e.size)}),(0,X.jsx)(`td`,{"aria-hidden":`true`}),(0,X.jsx)(`td`,{className:Xe,onDoubleClick:e=>e.stopPropagation(),children:(0,X.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 whitespace-nowrap`,children:(0,X.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,X.jsx)(_,{page:j,totalPages:A,pageSize:T,busy:s||a,className:`shrink-0 !px-4 !py-2`,onPage:w,onPageSize:e=>{E(e),w(1)}}):null]})]}),(0,X.jsx)(h,{open:!!p,title:p?.kind===`batch`?`批量删除备份`:`删除备份`,message:ce,confirmLabel:`删除`,danger:!0,onClose:()=>m(null),onConfirm:()=>void te()}),(0,X.jsx)(et,{open:y!=null,title:`重命名备份`,label:`文件名称`,placeholder:`请输入文件名`,initialValue:y?.name??``,lockExtension:!0,confirmLabel:`保存`,cancelLabel:`取消`,error:S,onClose:()=>{s||(x(null),C(``))},onConfirm:e=>void ae(e)})]})}var bt=[`.md`,`.markdown`,`.txt`,`.csv`],xt=[`.xlsx`,`.xls`];function St(e){return e.replace(/<br\s*\/?>/gi,`
|
|
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.BS20yicJ.js";import{t as v}from"./OverflowHint.pvo2Xc8R.js";import{t as y}from"./SelectDropdown.TgxIOKMD.js";import{showToast as b}from"./Toast.BO2NFckG.js";import{i as x,n as S,o as C}from"./case-gen-run.BaUxa_BR.js";import{a as ee,i as w,t as T}from"./export.joBT53eb.js";import{i as E,n as D,r as O,t as k}from"./case-fields.Dqkws1iX.js";import{b as A,p as j,s as M,u as N}from"./settings.NTeTjmxg.js";import{M as P,v as F,z as te}from"./req-analysis.ilj0McI3.js";import{c as ne,d as re,f as ie,g as ae,h as oe,n as se,o as ce,p as le,r as ue,u as de}from"./project-docs.DAw9bzgk.js";import{s as fe}from"./llm.DyweO-KK.js";import{n as pe}from"./doc-roots.DAJP9Svr.js";import{i as me,n as he,r as ge,t as _e}from"./DocsFileBrowser.9WTBumS5.js";import{d as ve,f as I,h as ye,l as L,n as be,o as R,p as z,t as xe,v as Se}from"./open-docs-in-session.5cTowYAC.js";import{A as Ce,C as B,D as V,E as we,M as Te,N as Ee,O as H,P as De,S as Oe,T as ke,_ as Ae,a as je,b as Me,c as U,d as Ne,f as Pe,g as Fe,h as Ie,j as Le,k as Re,l as ze,m as Be,n as Ve,o as W,p as G,s as He,t as K,u as q,v as Ue,w as We,x as Ge,y as Ke}from"./case-review.s1w_mD4l.js";import{a as qe,c as Je,d as Ye,i as Xe,l as Ze,n as Qe,o as $e,t as J}from"./ColumnResize.CkE59sGq.js";import{t as et}from"./NamePromptDialog.Csfnh5eM.js";import{t as tt}from"./SlideOverDrawer.C1IVOc_8.js";import{m as nt}from"./PmShared.BJpoEYvk.js";import{o as rt,r as it,s as at,t as ot}from"./composer-task.DJmluzPT.js";var Y=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 X=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 ne(`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 ke()){let t=await B();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,Y.useState)([]),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)({}),[p,m]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(``),[ee,w]=(0,Y.useState)(1),[T,E]=g(dt,ft),D=Ze(`lh:case-backup:cols:v4`,pt),O=Ye(`case-backup`),k=(0,Y.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,Y.useEffect)(()=>{e&&(w(1),k())},[e,k]);let A=Math.max(1,Math.ceil(r.length/T)),j=Math.min(ee,A),M=(0,Y.useMemo)(()=>r.slice((j-1)*T,j*T),[r,j,T]),N=(0,Y.useMemo)(()=>Object.keys(d).filter(e=>d[e]),[d]),P=M.length>0&&M.every(e=>d[e.id]);async function F(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 se(`cases`,e.path);r.length&&await Ke(r.map(e=>e.reviewName||e.name)),b(e.length===1?`已删除「${e[0].name}」`:`已删除 ${e.length} 个备份`,`success`),await k(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);u(t),b(`删除失败:${t}`,`error`)}finally{c(!1)}}async function te(){let e=p;if(m(null),!e)return;if(e.kind===`one`){await F([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 F(n)}async function ne(e){if(e.kind!==`legacy`)try{await de(`cases`,e.path)}catch(e){u(e instanceof Error?e.message:String(e))}}function ie(e){e.kind!==`legacy`&&(C(``),x(e))}async function ae(e){let t=y;if(!t||t.kind===`legacy`)return;let i=e.trim();if(!i||i===t.name){x(null),C(``);return}let a=re(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)C(`已存在同名文件「${s.name}」,换个名字再试`);else{c(!0),u(null),C(``);try{await oe(`cases`,t.path,i),x(null),b(`已重命名为「${i}」`,`success`),await k(),n?.()}catch(e){let t=e instanceof Error?e.message:String(e);C(t),b(`重命名失败:${t}`,`error`)}finally{c(!1)}}}let ce=p?.kind===`one`?`删除备份「${p.row.name}」?此操作不可恢复。`:p?.kind===`batch`?`确认删除已选中的 ${p.ids.length} 个备份?此操作不可恢复。`:``;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(tt,{open:e,onClose:t,title:`备份列表`,closeAriaLabel:`关闭备份列表`,widthClass:`max-w-5xl`,bodyClassName:`flex flex-col gap-3 overflow-hidden`,escDisabled:!!p||y!=null,footer:(0,X.jsxs)(`footer`,{className:`shrink-0 p-4 border-t border-stone-100 flex items-center gap-2`,children:[(0,X.jsxs)(`button`,{type:`button`,disabled:s||N.length===0,onClick:()=>m({kind:`batch`,ids:N}),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:[`删除所选`,N.length?`(${N.length})`:``]}),(0,X.jsx)(`div`,{className:`flex-1`}),(0,X.jsx)(`button`,{type:`button`,disabled:s||a,onClick:()=>void k(),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,X.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,X.jsxs)(`p`,{className:`shrink-0 text-xs text-stone-500 leading-5`,children:[`新备份在「用例管理/`,st,`/」(首次备份时自动创建,主列表不展示该文件夹)。历史旁路 .bak* 仍可在此查看。备份不会自动过期,请手动删除。`]}),l?(0,X.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,X.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 text-xs text-stone-500`,children:[(0,X.jsxs)(`span`,{children:[`共 `,(0,X.jsx)(`span`,{className:`font-medium text-stone-800`,children:r.length}),` 个`]}),a?(0,X.jsx)(`span`,{children:`加载中…`}):null]}),r.length===0&&!a?(0,X.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,X.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-hidden rounded-xl border border-stone-200 flex flex-col`,children:[(0,X.jsx)(`div`,{ref:O,className:`tw-scroll-x flex-1 min-h-0 overflow-auto`,children:(0,X.jsxs)(`table`,{className:`tw-data-table tw-sticky-table w-full table-fixed text-left text-sm`,style:D.tableStyle,children:[(0,X.jsx)(`colgroup`,{children:pt.map(e=>(0,X.jsx)(`col`,{style:D.widthOf(e.key)?{width:D.widthOf(e.key)}:void 0},e.key))}),(0,X.jsx)(`thead`,{className:`bg-stone-50 text-xs text-stone-500`,children:(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`${qe} relative`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:P,disabled:s||M.length===0,onChange:e=>{let t=e.target.checked;f(e=>{let n={...e};for(let e of M)t?n[e.id]=!0:delete n[e.id];return n})},"aria-label":`全选本页备份`}),(0,X.jsx)(J,{...D.resizeProps(`select`)})]}),(0,X.jsxs)(`th`,{className:$e,style:{"--tw-sticky-left":`${ut}px`},children:[`文件名`,(0,X.jsx)(J,{...D.resizeProps(`name`)})]}),(0,X.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`类型`,(0,X.jsx)(J,{...D.resizeProps(`kind`)})]}),(0,X.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`备份时间`,(0,X.jsx)(J,{...D.resizeProps(`mtime`)})]}),(0,X.jsxs)(`th`,{className:`relative px-3 py-2 font-medium whitespace-nowrap`,children:[`大小`,(0,X.jsx)(J,{...D.resizeProps(`size`)})]}),(0,X.jsx)(`th`,{"aria-hidden":`true`}),(0,X.jsx)(`th`,{className:Je,children:`操作`})]})}),(0,X.jsx)(`tbody`,{children:M.map(e=>(0,X.jsxs)(`tr`,{className:`group border-t border-stone-100 ${e.kind===`legacy`?``:`cursor-pointer`}`,onDoubleClick:()=>{e.kind===`legacy`||s||ne(e)},children:[(0,X.jsx)(`td`,{className:Qe,onDoubleClick:e=>e.stopPropagation(),children:(0,X.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,X.jsx)(`td`,{className:`${Qe} min-w-0 max-w-0`,style:{"--tw-sticky-left":`${ut}px`},children:(0,X.jsxs)(`div`,{className:`inline-flex min-w-0 max-w-full items-center`,children:[(0,X.jsx)(v,{text:e.name,className:`min-w-0 truncate font-medium text-stone-800`}),e.kind===`legacy`?null:(0,X.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,X.jsx)(`button`,{type:`button`,disabled:s,"aria-label":`重命名 ${e.name}`,onClick:()=>ie(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,X.jsx)(nt,{name:`pencil`,size:12})})})]})}),(0,X.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:ht(e.kind)}),(0,X.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap`,children:gt(e.mtime)}),(0,X.jsx)(`td`,{className:`px-3 py-2.5 text-xs text-stone-600 whitespace-nowrap tabular-nums`,children:_t(e.size)}),(0,X.jsx)(`td`,{"aria-hidden":`true`}),(0,X.jsx)(`td`,{className:Xe,onDoubleClick:e=>e.stopPropagation(),children:(0,X.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 whitespace-nowrap`,children:(0,X.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,X.jsx)(_,{page:j,totalPages:A,pageSize:T,busy:s||a,className:`shrink-0 !px-4 !py-2`,onPage:w,onPageSize:e=>{E(e),w(1)}}):null]})]}),(0,X.jsx)(h,{open:!!p,title:p?.kind===`batch`?`批量删除备份`:`删除备份`,message:ce,confirmLabel:`删除`,danger:!0,onClose:()=>m(null),onConfirm:()=>void te()}),(0,X.jsx)(et,{open:y!=null,title:`重命名备份`,label:`文件名称`,placeholder:`请输入文件名`,initialValue:y?.name??``,lockExtension:!0,confirmLabel:`保存`,cancelLabel:`取消`,error:S,onClose:()=>{s||(x(null),C(``))},onConfirm:e=>void ae(e)})]})}var bt=[`.md`,`.markdown`,`.txt`,`.csv`],xt=[`.xlsx`,`.xls`];function St(e){return e.replace(/<br\s*\/?>/gi,`
|
|
3
3
|
`).replace(/</g,`<`).replace(/>/g,`>`).replace(/&/g,`&`).trim()}function Ct(e){return e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(St)}function wt(e){return/^\s*\|?[\s-:|]+\|?\s*$/.test(e)&&/-+/.test(e)}function Tt(e){let t=String(e??``).split(/\r?\n/),n=-1,r=[];for(let e=0;e<t.length;e++){if(!t[e].includes(`|`))continue;let i=Ct(t[e]);if(i.some(e=>e.includes(`用例`))&&i.length>=2){n=e,r=i;break}}if(n<0||!r.length)return{headers:[...T],rows:[]};let i=wt(t[n+1]??``)?n+2:n+1,a=[];for(let e=i;e<t.length;e++){let n=t[e];if(!n.includes(`|`)||wt(n)){if(a.length>0&&!n.includes(`|`))break;continue}let i=Ct(n);if(i.every(e=>!e))continue;let o={};r.forEach((e,t)=>{o[e]=i[t]??``}),Object.values(o).some(e=>e.trim())&&a.push(o)}return{headers:r,rows:a}}function Et(e){let t=String(e??``).replace(/^\uFEFF/,``),n=[],r=``,i=[],a=!1;for(let e=0;e<t.length;e++){let o=t[e];a?o===`"`?t[e+1]===`"`?(r+=`"`,e+=1):a=!1:r+=o:o===`"`?a=!0:o===`,`?(i.push(r),r=``):o===`
|
|
4
4
|
`||o===`\r`?(o===`\r`&&t[e+1]===`
|
|
5
5
|
`&&(e+=1),i.push(r),r=``,i.some(e=>e.trim())&&n.push(i),i=[]):r+=o}i.push(r),i.some(e=>e.trim())&&n.push(i);let[o,...s]=n,c=(o??[]).map(e=>String(e??``).trim()),l=c.filter(Boolean);return l.length?{headers:l,rows:s.map(e=>{let t={};return c.forEach((n,r)=>{n&&(t[n]=String(e[r]??``).trim())}),t})}:{headers:[...T],rows:[]}}function Dt(e){let t=w(e,{type:`base64`,cellDates:!0}),n=t.SheetNames[0],r=n?t.Sheets[n]:void 0;if(!r)return{headers:[...T],rows:[]};let i=ee.sheet_to_json(r,{header:1,defval:``,raw:!1,blankrows:!1}),a=(i[0]??[]).map(e=>String(e??``).trim()),o=a.filter(Boolean);if(!o.length)return{headers:[...T],rows:[]};let s=[];for(let e of i.slice(1)){let t={};a.forEach((n,r)=>{n&&(t[n]=String(e[r]??``).trim())}),Object.values(t).some(e=>e.trim())&&s.push(t)}return{headers:o,rows:s}}async function Ot(e){let t=`.${(e.split(`.`).pop()??``).toLowerCase()}`;if(xt.includes(t)){let n=await ie(`cases`,e);if(n.encoding!==`base64`||!n.contentBase64)throw Error(`无法读取该用例文件`);let r=Dt(n.contentBase64);return{ext:t,...r,rows:D(r.rows)}}if(!bt.includes(t))throw Error(`暂不支持评审 ${t} 文件,请用 md / csv / xlsx`);let{content:n}=await le(`cases`,e),r=t===`.csv`?Et(n):Tt(n);return{ext:t,...r,rows:D(r.rows),text:n}}async function kt(e){let t=[...te(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 At(e.sourcePath);r=F(t)}catch{r=[]}return{outlineOrder:t,testPointIds:e.testPoints?.points?.map(e=>e.id)??void 0,idealOrder:r,storySourceRefs:n}}async function At(t){let n=t.toLowerCase();if(n.endsWith(`.xlsx`)||n.endsWith(`.xls`)){let e=await ie(`requirements`,t);if(e.encoding!==`base64`||!e.contentBase64)throw Error(`无法读取 Excel`);let n=await A(()=>import(`./export.joBT53eb.js`).then(e=>e.s),__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(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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","_astro/export.joBT53eb.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{B as n,H as r,U as i,V as a,W as o,i as s,p as c,r as l,t as u,u as d,z as f}from"./app-config.C4rpn1Ix.js";import{a as p,i as m,o as h,s as g,t as _}from"./plugins.C0NrHGZv.js";import{_ as v,a as y,h as b,o as x,r as S,s as C,t as w}from"./case-exec.BMNk9OyF.js";import{n as T,o as E}from"./view-prefs.8MPl3A7e.js";import{t as D}from"./react-dom.DLW9pGCF.js";import{i as O,n as k,r as ee,t as te}from"./dialog.DZHZCe_T.js";import{i as ne,n as re,r as A,t as j}from"./menu.Dnrpz489.js";import{t as ie}from"./jsx-runtime.DUg_B_vD.js";import{t as ae}from"./ConfirmDialog.D5qXeML0.js";import{t as M}from"./DatePicker.Bkl71M49.js";import{t as oe}from"./OverflowHint.pvo2Xc8R.js";import{t as N}from"./SelectDropdown.TgxIOKMD.js";import{showToast as P}from"./Toast.BO2NFckG.js";import{a as se,i as ce,n as F,o as I,r as le,t as ue}from"./case-types.CprZTsyX.js";import{a as de,c as fe,l as pe,s as me,t as he}from"./case-gen-run.
|
|
2
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{B as n,H as r,U as i,V as a,W as o,i as s,p as c,r as l,t as u,u as d,z as f}from"./app-config.C4rpn1Ix.js";import{a as p,i as m,o as h,s as g,t as _}from"./plugins.C0NrHGZv.js";import{_ as v,a as y,h as b,o as x,r as S,s as C,t as w}from"./case-exec.BMNk9OyF.js";import{n as T,o as E}from"./view-prefs.8MPl3A7e.js";import{t as D}from"./react-dom.DLW9pGCF.js";import{i as O,n as k,r as ee,t as te}from"./dialog.DZHZCe_T.js";import{i as ne,n as re,r as A,t as j}from"./menu.Dnrpz489.js";import{t as ie}from"./jsx-runtime.DUg_B_vD.js";import{t as ae}from"./ConfirmDialog.D5qXeML0.js";import{t as M}from"./DatePicker.Bkl71M49.js";import{t as oe}from"./OverflowHint.pvo2Xc8R.js";import{t as N}from"./SelectDropdown.TgxIOKMD.js";import{showToast as P}from"./Toast.BO2NFckG.js";import{a as se,i as ce,n as F,o as I,r as le,t as ue}from"./case-types.CprZTsyX.js";import{a as de,c as fe,l as pe,s as me,t as he}from"./case-gen-run.BaUxa_BR.js";import{a as ge,i as _e,t as ve}from"./export.joBT53eb.js";import{i as ye,n as be,r as L}from"./case-template.F1Nv08GV.js";import{a as xe,b as R,c as Se,f as Ce,h as we,m as Te,p as Ee,r as De,s as Oe,u as ke}from"./settings.NTeTjmxg.js";import{D as Ae,M as je,rt as Me,y as Ne,z as Pe}from"./req-analysis.ilj0McI3.js";import{c as Fe,f as Ie,p as Le,r as Re,u as ze,v as Be}from"./project-docs.DAw9bzgk.js";import{a as Ve,i as He,r as Ue,s as We,t as Ge}from"./llm.DyweO-KK.js";import{n as Ke,t as qe}from"./doc-roots.DAJP9Svr.js";import{a as Je,l as Ye,n as Xe,r as Ze,t as Qe}from"./prompts-meta.Dnmq-SnF.js";import{t as $e}from"./ExcelFieldTags.CXif3Ilh.js";import{t as et}from"./MultiSelectDropdown.y8JMbCxO.js";import{t as tt}from"./SearchableSelect.5SfNLwNW.js";import{A as nt,C as rt,D as it,E as at,O as ot,S as st,T as ct,_ as lt,a as ut,b as dt,c as ft,d as pt,f as mt,g as ht,h as gt,i as _t,j as vt,k as yt,l as bt,m as xt,n as St,o as Ct,p as wt,r as Tt,s as Et,u as Dt,v as Ot,w as kt,x as At,y as jt}from"./open-docs-in-session.5cTowYAC.js";import{t as Mt}from"./NamePromptDialog.Csfnh5eM.js";import{C as Nt,E as Pt,M as z,O as Ft,R as It,S as Lt,T as Rt,a as zt,d as Bt,g as Vt,h as Ht,k as B,l as Ut,r as Wt,s as Gt,t as Kt,w as qt,x as Jt,y as Yt}from"./pm.BXmOiFfW.js";import{t as Xt}from"./SlideOverDrawer.C1IVOc_8.js";import{a as Zt,c as Qt,i as $t,n as en,o as tn,r as nn,s as rn}from"./composer-task.DJmluzPT.js";import{n as an}from"./i18n.BJeTr39S.js";import{n as on,t as sn}from"./PromptMountDialog.CpTT6L0a.js";import{_ as cn,a as ln,b as un,c as dn,d as fn,f as pn,g as mn,h as hn,i as gn,l as _n,m as vn,n as yn,o as bn,p as xn,r as Sn,s as Cn,t as wn,u as Tn,v as En,y as Dn}from"./fs-tools.3F9MFrLf.js";import{C as On,D as kn,E as V,F as An,O as jn,P as Mn,S as Nn,T as Pn,_ as Fn,a as In,b as Ln,c as Rn,d as zn,g as Bn,i as Vn,j as H,k as Hn,l as Un,m as Wn,n as Gn,o as Kn,r as qn,t as U,u as Jn,v as Yn,x as Xn,y as Zn}from"./tasks.DefXqRfI.js";import{_ as Qn,a as $n,c as er,d as tr,f as nr,g as rr,h as ir,i as ar,l as or,m as sr,n as cr,o as lr,p as ur,r as dr,s as fr,t as pr,u as mr,v as hr,y as gr}from"./bash-tools.RQcI4_42.js";import{C as _r,S as vr,_ as yr,a as br,b as xr,c as Sr,d as W,g as Cr,h as wr,i as Tr,l as Er,m as Dr,n as Or,o as kr,p as Ar,r as jr,s as Mr,t as Nr,u as Pr,v as Fr,w as Ir,x as Lr,y as Rr}from"./PluginsPage.BFEwg0vr.js";import{l as zr,r as Br,t as Vr}from"./report-prompt.B9C4cv84.js";import{s as Hr}from"./test-stats.Cf3_L4wu.js";import{i as Ur}from"./ui-auto-prompt.l_EXfDs5.js";import{h as Wr}from"./ui-auto.BmC9JJ_X.js";import{b as Gr,l as Kr,v as qr}from"./story-review.Bsm2JWdj.js";var G=e(t(),1),Jr=e(D(),1),K=`/__tb_sessions/runs`;async function Yr(e){try{return(await fetch(K,{signal:e??AbortSignal.timeout(1500)})).ok}catch{return!1}}async function Xr(e){let t=await fetch(K,{signal:e??AbortSignal.timeout(3e3)});if(!t.ok)return[];let n=await t.json();return Array.isArray(n.runs)?n.runs:[]}async function Zr(e){let t=await fetch(K,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));return t.ok?{ok:!0}:{ok:!1,error:n.error||`HTTP ${t.status}`}}async function Qr(e){await fetch(`${K}/${encodeURIComponent(e)}/stop`,{method:`POST`}).catch(()=>{})}async function $r(e){try{let t=await fetch(`${K}/${encodeURIComponent(e)}`,{signal:AbortSignal.timeout(3e3)});return t.status===404?{ok:!1}:t.ok?await t.json():null}catch{return null}}function ei(e){return e===`completed`||e===`stopped`||e===`error`}function ti(e,t,n,r){let i=new AbortController,a=`${K}/${encodeURIComponent(e)}/events?after=${Math.max(0,t)}`;return(async()=>{try{let e=await fetch(a,{headers:{Accept:`text/event-stream`},signal:i.signal});if(!e.ok||!e.body){r?.(Error(`SSE ${e.status}`));return}let t=e.body.getReader(),o=new TextDecoder,s=``;for(;;){let{done:e,value:a}=await t.read();if(e){i.signal.aborted||r?.(Error(`SSE disconnected`));break}s+=o.decode(a,{stream:!0});let c=s.split(`
|
|
3
3
|
`);s=c.pop()??``;for(let e of c){let t=e.trim();if(!t.startsWith(`data:`))continue;let r=t.slice(5).trim();if(r)try{n(JSON.parse(r))}catch{}}}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;r?.(e instanceof Error?e:Error(String(e)))}})(),()=>i.abort()}function ni(e,t,n){let r=!1,i=Math.max(0,t),a=0,o=null,s,c=n.maxAttempts??10,l=()=>{r=!0,s!=null&&clearTimeout(s),s=void 0,o?.(),o=null},u=()=>{r||n.signal?.aborted||(o?.(),o=ti(e,i,e=>{typeof e.seq==`number`&&Number.isFinite(e.seq)&&(i=Math.max(i,e.seq)),n.onEvent(e),e.type===`status`&&ei(e.status)&&(n.onTerminal?.(e),l())},t=>{r||n.signal?.aborted||(async()=>{a+=1;try{let r=await $r(e);if(r?.ok&&typeof r.seq==`number`&&(i=Math.max(i,r.seq)),r?.ok&&ei(r.status)){let e={type:`status`,status:r.status,seq:r.seq,assistant:r.assistant};n.onEvent(e),n.onTerminal?.(e),l();return}if(r&&r.ok===!1){n.onGaveUp?.(Error(t.message||`run not found`)),l();return}}catch{}if(a>=c){n.onGaveUp?.(t),l();return}let r=Math.min(4e3,250*a);s=setTimeout(u,r)})()}))},d=()=>l();return n.signal?.addEventListener(`abort`,d),u(),()=>{n.signal?.removeEventListener(`abort`,d),l()}}function ri(e){for(let t of e)if(t.role===`user`&&typeof t.content==`string`){let e=t.content.trim();if(e)return e}return``}function ii(e,t){let n=(e||``).trim()||`新对话`;return n===`新对话`||n===at(t)}function ai(e){let t=String(e??``).trim().replace(/^["「『]+|["」』]+$/g,``).replace(/\s+/g,` `).replace(/^标题[::]\s*/i,``);return t=t.replace(/[。.!!]+$/g,``).trim(),t?t.length>28?`${t.slice(0,28)}…`:t:``}async function oi(e,t,n){let r=t.trim().slice(0,800);if(!r)return null;let i=[{role:`system`,content:`你为对话生成侧栏短标题。只输出标题本身:中文优先,不超过 16 个字,无引号、无标点收尾、无解释。`},{role:`user`,content:`用户首条消息:\n${r}\n\n请给出标题:`}];try{return ai(await Ue(e,i,n))||null}catch{return null}}function si(e){let t=Array.isArray(e.messages)?e.messages:[],n=0,r=0,i=0,a=0,o=0;for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;t.role===`user`?n+=1:t.role===`assistant`&&(r+=1);let s=t.usage;if(s&&typeof s==`object`){let e=s;typeof e.promptTokens==`number`&&(i+=e.promptTokens),typeof e.completionTokens==`number`&&(a+=e.completionTokens),typeof e.totalTokens==`number`?o+=e.totalTokens:(typeof e.promptTokens==`number`||typeof e.completionTokens==`number`)&&(o+=(Number(e.promptTokens)||0)+(Number(e.completionTokens)||0))}}let s=e.goal,c=!!(s&&s.status!==`cleared`&&s.text?.trim());return{sessionId:e.id,title:e.title||`新对话`,messageCount:t.length,userCount:n,assistantCount:r,promptTokens:i,completionTokens:a,totalTokens:o,createdAt:e.createdAt,updatedAt:e.updatedAt,hasGoal:c,todoCount:Array.isArray(e.todos)?e.todos.length:0}}function ci(e){let t=new Date(e.createdAt).toLocaleString(),n=new Date(e.updatedAt).toLocaleString();return[`会话:${e.title}`,`消息 ${e.messageCount}(用户 ${e.userCount} / 助手 ${e.assistantCount})`,`用量≈ 输入 ${e.promptTokens} · 输出 ${e.completionTokens} · 合计 ${e.totalTokens}`,`待办 ${e.todoCount} · 目标 ${e.hasGoal?`有`:`无`}`,`创建 ${t}`,`更新 ${n}`].join(`
|
|
4
4
|
`)}var li=new Map,ui=new Map,di=40;function fi(e,t,n=``){return`${e}:${t}:${n}`}function pi(e){for(;e.size>di;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function mi(e,t,n,r,i=``){let a=e===`outline`?li:ui,o=fi(t,n,i),s=a.get(t);if(s&&s.stamp===o)return s.value;let c=r();return a.set(t,{stamp:o,value:c}),pi(a),c}var hi=`/__tb_sessions/log`;function gi(e){let t=String(e.userContent??``).trim(),n=String(e.assistantContent??``).trim(),r=String(e.reasoning??``).trim(),i=[];if(t&&i.push({role:`user`,content:t}),n||r){let e={role:`assistant`,content:n};r&&(e.reasoning_content=r),i.push(e)}return i}async function _i(e){try{let t=await fetch(hi,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:AbortSignal.timeout(5e3)}),n=await t.json().catch(()=>({}));return t.ok?{ok:!0,path:n.path}:{ok:!1,error:n.error||`HTTP ${t.status}`}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function vi(e){return String(e??``).trim()}function yi(e,t=80){let n=vi(e).replace(/\s+/g,` `);return n?n.length>t?`${n.slice(0,t)}…`:n:``}function bi(e,t=40){let n=[],r=null;for(let i=0;i<e.length;i++){let a=e[i];if(a.role===`user`){let e=vi(a.content),t=yi(e);if(!t)continue;r&&n.push({index:n.length+1,userPreview:r.preview,assistantPreview:``,userText:r.text,assistantText:``,userTime:r.time,endMessageIndex:r.messageIndex}),r={text:e,preview:t,time:typeof a.time==`number`?a.time:void 0,messageIndex:i}}else if(a.role===`assistant`&&r){let e=vi(a.content),t=vi(a.reasoning)||void 0;n.push({index:n.length+1,userPreview:r.preview,assistantPreview:yi(e)||(t?`(含思考)`:``),userText:r.text,assistantText:e,reasoning:t,reasoningDuration:typeof a.reasoningDuration==`number`?a.reasoningDuration:void 0,userTime:r.time,assistantTime:typeof a.time==`number`?a.time:void 0,endMessageIndex:i}),r=null}if(n.length>=t)break}return r&&n.length<t&&n.push({index:n.length+1,userPreview:r.preview,assistantPreview:``,userText:r.text,assistantText:``,userTime:r.time,endMessageIndex:r.messageIndex}),n}function xi(e,t){let n=String(t??``).trim();return!n||n===`inherit`||n===e.model?e:{...e,model:n}}var Si=`/__tb_fs`,Ci=`你可以使用 office_to_pdf:优先用本机 LibreOffice 转为 PDF;若未安装,则对 docx/xlsx/pptx 降级抽取正文为同目录 .extracted.md(需写权限)。`,wi={type:`function`,function:{name:`office_to_pdf`,description:`Convert Office docs to PDF via LibreOffice when available; otherwise extract text to .extracted.md for docx/xlsx/pptx.`,parameters:{type:`object`,properties:{path:{type:`string`,description:`Input file path relative to workspace (or absolute when allowed)`},outDir:{type:`string`,description:`Optional output directory (default: same as input)`}},required:[`path`]}}};async function Ti(e,t,n){if(e!==`office_to_pdf`)return JSON.stringify({error:`unknown tool: ${e}`});let r={};try{r=JSON.parse(t||`{}`)}catch{return JSON.stringify({ok:!1,error:`invalid JSON arguments`})}let i=String(r.path??``).trim();if(!i)return JSON.stringify({ok:!1,error:`path is required`});try{let e=await(await fetch(`${Si}/office-to-pdf`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i,outDir:typeof r.outDir==`string`?r.outDir:void 0,access:n}),signal:AbortSignal.timeout(13e4)})).json().catch(()=>({}));return JSON.stringify(e,null,2)}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}}var Ei=`/__tb_fs`,Di=`你可以使用 load_workspace_dependencies:查询本机 node / npm / pnpm / python 等可执行文件绝对路径(需本地 fs 服务)。`,Oi={type:`function`,function:{name:`load_workspace_dependencies`,description:`Resolve absolute paths of common runtimes/package managers on this machine (node, npm, pnpm, python, …).`,parameters:{type:`object`,properties:{}}}};async function ki(e){if(e!==`load_workspace_dependencies`)return JSON.stringify({error:`unknown tool: ${e}`});try{let e=await fetch(`${Ei}/workspace-dependencies`,{signal:AbortSignal.timeout(8e3)}),t=await e.json().catch(()=>({}));if(!e.ok){let n=typeof t==`object`&&t&&`error`in t?String(t.error):`HTTP ${e.status}`;return JSON.stringify({ok:!1,error:n})}return JSON.stringify(t,null,2)}catch(e){return JSON.stringify({ok:!1,error:e instanceof Error?e.message:String(e)})}}function Ai(e){return Array.isArray(e)}function ji(e){return Ai(e)?e.some(e=>e.type===`image_url`):!1}function Mi(e){let t=e.filter(e=>e.type===`text`).map(e=>e.text),n=e.filter(e=>e.type===`image_url`).length,r=n>0?`[image-offload] 已卸载 ${n} 张图片(超预算,仅保留最近附图)。`:``;return[{type:`text`,text:[...t,r].filter(Boolean).join(`
|
|
5
5
|
`)||r||`(图片已卸载)`}]}function Ni(e,t={}){let n=Math.max(0,Math.floor(t.keepRecentImageMessages??1)),r=[];for(let t=0;t<e.length;t++){let n=e[t];n.role===`user`&&ji(n.content)&&r.push(t)}if(r.length<=n)return e;let i=new Set(r.slice(-n)),a=!1,o=e.map((e,t)=>e.role!==`user`||!ji(e.content)||i.has(t)||!Ai(e.content)?e:(a=!0,{...e,content:Mi(e.content)}));return a?o:e}var Pi=/(\s*(TP-[A-Za-z0-9_-]+)\s*)|\(\s*(TP-[A-Za-z0-9_-]+)\s*\)/i;function Fi(e){let t=String(e||``).replace(/\r\n/g,`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{a as r,l as i,o as a,r as o,t as s}from"./plugins.C0NrHGZv.js";import{f as c}from"./case-exec.BMNk9OyF.js";import{n as l,o as u}from"./view-prefs.8MPl3A7e.js";import{i as d,n as f,r as p,t as m}from"./dialog.DZHZCe_T.js";import{t as h}from"./jsx-runtime.DUg_B_vD.js";import{t as g}from"./OverflowHint.pvo2Xc8R.js";import{showToast as _}from"./Toast.BO2NFckG.js";import"./settings.NTeTjmxg.js";import{at as v}from"./req-analysis.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{a as r,l as i,o as a,r as o,t as s}from"./plugins.C0NrHGZv.js";import{f as c}from"./case-exec.BMNk9OyF.js";import{n as l,o as u}from"./view-prefs.8MPl3A7e.js";import{i as d,n as f,r as p,t as m}from"./dialog.DZHZCe_T.js";import{t as h}from"./jsx-runtime.DUg_B_vD.js";import{t as g}from"./OverflowHint.pvo2Xc8R.js";import{showToast as _}from"./Toast.BO2NFckG.js";import"./settings.NTeTjmxg.js";import{at as v}from"./req-analysis.ilj0McI3.js";import{F as y,I as b}from"./case-review.s1w_mD4l.js";import{I as x,v as S}from"./pm.BXmOiFfW.js";import{s as C}from"./fs-tools.3F9MFrLf.js";import{s as w,w as T}from"./tasks.DefXqRfI.js";import{l as E}from"./report-prompt.B9C4cv84.js";import{a as D}from"./test-stats.Cf3_L4wu.js";import{a as O}from"./ui-auto-prompt.l_EXfDs5.js";import{s as k,y as ee}from"./story-review.Bsm2JWdj.js";var A=e(t(),1),j=`/__tb_memory`,M=3e3,N=`你可以使用跨会话长期记忆(本机五轨:user / memory / key / project / daily):
|
|
2
2
|
- 系统可能已在 <memory_snapshot> 注入用户档案、全局事实与项目关键记忆;优先参考。
|
|
3
3
|
- 查历史进展:memory_search 或 memory_read(project / daily 不自动注入)。
|
|
4
4
|
- 用户明确要求记住偏好/全局事实/项目约定:调用 memory_suggest(进待确认,确认后才注入)。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as default}from"./PluginsPage.BFEwg0vr.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.C4rpn1Ix.js";import{a as i,i as a,n as o,o as s,s as c}from"./plugins.C0NrHGZv.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.D5qXeML0.js";import{showToast as u}from"./Toast.BO2NFckG.js";import{i as te}from"./case-types.CprZTsyX.js";import{a as ne,at as re,c as ie}from"./req-analysis.BgIbt-VI.js";import{c as d,d as f,h as ae,n as p,p as oe,r as se,u as ce,v as le}from"./project-docs.DAw9bzgk.js";import{n as ue}from"./doc-roots.DAJP9Svr.js";import{a as m,c as h,d as de,i as g,l as _,o as v,s as y,u as b}from"./prompts-meta.Dnmq-SnF.js";import{i as fe,n as pe,r as me,t as he}from"./DocsFileBrowser.9WTBumS5.js";import{d as ge,t as _e}from"./open-docs-in-session.5cTowYAC.js";import{F as ve,I as ye,i as be,r as xe}from"./case-review.s1w_mD4l.js";import{t as x}from"./NamePromptDialog.Csfnh5eM.js";import{m as S}from"./PmShared.BJpoEYvk.js";import{i as Se}from"./report-prompt.B9C4cv84.js";import{g as Ce,s as we}from"./ui-auto.BmC9JJ_X.js";import{f as Te,s as Ee,t as De,y as Oe}from"./story-review.D6yzlcwY.js";var C=e(t(),1),w=`tw.prompts.mounted.v1`;function ke(){try{let e=sessionStorage.getItem(r(w));if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&(n[e]=r);return n}catch{return{}}}function Ae(e){try{sessionStorage.setItem(r(w),JSON.stringify(e))}catch{}}var T=l(),je=10;async function E(e=`.`){let{entries:t}=await d(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await E(e.path));return n}function Me({path:e,enabled:t,mounted:n}){let r=b(e,n);if(!r)return(0,T.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,T.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,s=v(e,n);return(0,T.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),s&&a?(0,T.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function D(){let e=me(`prompts`),[t,r]=(0,C.useState)(!1),[l,d]=(0,C.useState)(!0),[v,w]=(0,C.useState)(e?!0:null),[D,Ne]=(0,C.useState)(()=>e??[]),[O,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(!1),[M,N]=(0,C.useState)({}),[P,F]=(0,C.useState)(null),[I,L]=(0,C.useState)(()=>i()),[R,Pe]=(0,C.useState)(()=>ke()),[z,B]=(0,C.useState)(null),[V,H]=(0,C.useState)(null),[U,W]=(0,C.useState)(``),G=pe(D,je,`prompts`),K=(0,C.useRef)(!1),q=(0,C.useRef)(!1),Fe=(0,C.useRef)(!1),J=(0,C.useRef)(!1),Ie=(0,C.useRef)(!1),Y=(0,C.useCallback)(async()=>{k(null);try{let e=await E(`.`);Ne(e),fe(`prompts`,e)}catch(e){k(e instanceof Error?e.message:String(e))}},[]);(0,C.useEffect)(()=>{if(!v||I.reqAnalysis!==!0||K.current)return;let e=new Set(D.map(e=>e.name));e.has(`需求分析提示词.md`)&&e.has(`原文结构提示词.md`)||(K.current=!0,re(!0).then(()=>Y()).catch(()=>void 0))},[v,I.reqAnalysis,D,Y]),(0,C.useEffect)(()=>{v&&I.storyReview===!0&&!q.current&&(D.some(e=>e.name===`用户故事审查提示词.md`)||(q.current=!0,Ee(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.storyReview,D,Y]),(0,C.useEffect)(()=>{v&&I.testPoints===!0&&!Fe.current&&(D.some(e=>e.name===`测试点生成提示词.md`)||(Fe.current=!0,Oe(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.testPoints,D,Y]),(0,C.useEffect)(()=>{v&&I.caseReview===!0&&!J.current&&(D.some(e=>e.name===`用例质量评审提示词.md`)||(J.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.caseReview,D,Y]),(0,C.useEffect)(()=>{v&&I.caseBlindspot===!0&&!Ie.current&&(D.some(e=>e.name===`场景遗漏补全提示词.md`)||(Ie.current=!0,ve(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.caseBlindspot,D,Y]),(0,C.useEffect)(()=>{let e=s(e=>{d(!!e.prompts),L(e)});return n().then(()=>{d(a(`prompts`)),L(i()),r(!0)}),e},[]),(0,C.useEffect)(()=>{t&&l&&(async()=>{await se(`prompts`)?(await ge().catch(()=>null),await Y(),w(!0)):w(!1)})()},[t,l,Y]);let X=(0,C.useCallback)(async()=>{let e=await we(),t=a(`reports`),n=t?await Se().catch(()=>null):null;Pe(r=>{let i={};if(e)for(let t of e)i[h(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[h(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}if(I.reqAnalysis&&(i[h(ne)]=`reqAnalysis`,i[h(ie)]=`reqAnalysis`),I.storyReview&&(i[h(De)]=`storyReview`),I.testPoints&&(i[h(Te)]=`testPoints`),I.caseReview&&(i[h(be)]=`caseReview`),I.caseBlindspot&&(i[h(xe)]=`caseBlindspot`),I.caseGen)for(let e of te()){let t=(e.promptPath??``).trim();t&&(i[h(t)]=`caseGen`)}return Ae(i),i})},[I.reqAnalysis,I.storyReview,I.testPoints,I.caseReview,I.caseBlindspot,I.caseGen]);(0,C.useEffect)(()=>{if(!t||!l)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=Ce(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,l,I.uiAuto,I.reports,I.reqAnalysis,I.storyReview,I.testPoints,I.caseReview,I.caseBlindspot,I.caseGen,X]);let Z=(0,C.useMemo)(()=>Object.keys(M).filter(e=>M[e]),[M]),Q=(0,C.useCallback)(e=>{let t=b(e,R);return!t||t===`system`||de(e)?``:I[t]===!0?t:``},[R,I]);async function Le(e){j(!0),k(null);try{await ce(`prompts`,e.path)}catch(e){k(e instanceof Error?e.message:String(e))}finally{j(!1)}}async function Re(e){j(!0),k(null);try{await _e(`prompts`,e)}catch(e){k(e instanceof Error?e.message:String(e)),j(!1)}}function ze(e){if(y(e.path)){k(`默认提示词不可删除`);return}if(g(e.path,I)){k(_(e.path,I));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;k(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else F({kind:`one`,entry:e})}function Be(e){if(y(e.path)){k(`默认提示词不可改名`);return}if(g(e.path,I)){k(_(e.path,I));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;k(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else B(e),W(``)}function Ve(e){H(e),W(``)}async function He(){let e=P;if(e){F(null),j(!0),k(null);try{if(e.kind===`one`)await p(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)y(n)||g(n,I)||Q(n)?t+=1:await p(`prompts`,n);t&&k(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),N({})}await Y(),u(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),u(`删除失败:${t}`,`error`)}finally{j(!1)}}}function Ue(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:k(c(`promptGen`))}let $=(0,C.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=D.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[D]);async function We(e){let t=z;if(!t)return;let n=e.trim();if(!n||n===t.name){B(null),W(``);return}let r=$(f(t.path),n,t.path);if(r)W(`已存在同名文件「${r}」,换个名字再试`);else{j(!0),W(``);try{await ae(`prompts`,t.path,n),B(null),await Y(),u(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);W(t),u(`重命名失败:${t}`,`error`)}finally{j(!1)}}}async function Ge(e){let t=V;if(!t)return;let n=e.trim();if(!n)return;let r=$(f(t.path),n);if(r)W(`已存在同名文件「${r}」,换个名字再试`);else{j(!0),W(``);try{let{content:e}=await oe(`prompts`,t.path);await le(`prompts`,f(t.path)===`.`?n:`${f(t.path)}/${n}`,e),H(null),await Y(),u(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);W(t),u(`复制失败:${t}`,`error`)}finally{j(!1)}}}let Ke=P?.kind===`one`?`删除「${P.entry.name}」?将从 ${ue(`prompts`)} 中移除。`:P?.kind===`batch`?`确认删除已选中的 ${P.paths.length} 个提示词?此操作不可恢复。`:``;return t?l?v===null?(0,T.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,T.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):v?(0,T.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,T.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,T.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[G.query.trim()?(0,T.jsxs)(T.Fragment,{children:[`匹配 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-800`,children:G.filtered.length}),` 个`,(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,D.length]})]}):(0,T.jsxs)(T.Fragment,{children:[`共 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-800`,children:D.length}),` 个提示词`]}),Z.length>0?(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,T.jsx)(`button`,{type:`button`,disabled:A||Z.length===0,onClick:()=>F({kind:`batch`,paths:Z}),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,T.jsx)(`button`,{type:`button`,disabled:A,onClick:Ue,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:`生成提示词`})]}),O?(0,T.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:O}):null,(0,T.jsx)(he,{resizeKey:`docs:prompts:cols:v1`,files:D,filtered:G.filtered,pageFiles:G.pageFiles,query:G.query,onQuery:G.setQuery,sortBy:G.sortBy,onSortBy:G.setSortBy,page:G.page,totalPages:G.totalPages,pageSize:G.pageSize,onPage:G.setPage,onPageSize:G.setPageSize,busy:A,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!m(e.path,I)&&!Q(e.path),selected:M,onToggleRow:e=>N(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>N(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Le(e),extraColumn:{header:`关联插件`,render:e=>(0,T.jsx)(Me,{path:e.path,enabled:I,mounted:R})},renderNameAction:e=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{type:`button`,disabled:A,"aria-label":`重命名 ${e.name}`,onClick:()=>Be(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,T.jsx)(S,{name:`pencil`,size:12})}),(0,T.jsx)(`button`,{type:`button`,disabled:A,"aria-label":`复制 ${e.name}`,onClick:()=>Ve(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,T.jsx)(S,{name:`copy`,size:12})})]}),renderActions:e=>{let t=m(e.path,I)||!!Q(e.path);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{type:`button`,disabled:A,onClick:()=>void Re(e),className:`inline-flex h-6 items-center whitespace-nowrap rounded bg-[#4176e6] px-2 text-xs text-white hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,T.jsx)(`button`,{type:`button`,disabled:A||t,"aria-label":`删除 ${e.name}`,onClick:()=>ze(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,T.jsx)(S,{name:`trash`,size:12})})]})}}),(0,T.jsx)(x,{open:z!=null,title:`重命名提示词`,label:`文件名称`,initialValue:z?.name??``,lockExtension:!0,confirmLabel:`保存`,error:U,onClose:()=>{B(null),W(``)},onConfirm:e=>void We(e)}),(0,T.jsx)(x,{open:V!=null,title:`复制提示词`,label:`新文件名称`,initialValue:V?V.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:U,onClose:()=>{H(null),W(``)},onConfirm:e=>void Ge(e)}),(0,T.jsx)(ee,{open:P!=null,title:P?.kind===`batch`?`批量删除`:`删除提示词`,message:Ke,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>F(null),onConfirm:()=>void He()})]}):(0,T.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,T.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:c(`prompts`)}):(0,T.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,T.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{D as default};
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.C4rpn1Ix.js";import{a as i,i as a,n as o,o as s,s as c}from"./plugins.C0NrHGZv.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as ee}from"./ConfirmDialog.D5qXeML0.js";import{showToast as u}from"./Toast.BO2NFckG.js";import{i as te}from"./case-types.CprZTsyX.js";import{a as ne,at as re,c as ie}from"./req-analysis.ilj0McI3.js";import{c as d,d as f,h as ae,n as p,p as oe,r as se,u as ce,v as le}from"./project-docs.DAw9bzgk.js";import{n as ue}from"./doc-roots.DAJP9Svr.js";import{a as m,c as h,d as de,i as g,l as _,o as v,s as y,u as b}from"./prompts-meta.Dnmq-SnF.js";import{i as fe,n as pe,r as me,t as he}from"./DocsFileBrowser.9WTBumS5.js";import{d as ge,t as _e}from"./open-docs-in-session.5cTowYAC.js";import{F as ve,I as ye,i as be,r as xe}from"./case-review.s1w_mD4l.js";import{t as x}from"./NamePromptDialog.Csfnh5eM.js";import{m as S}from"./PmShared.BJpoEYvk.js";import{i as Se}from"./report-prompt.B9C4cv84.js";import{g as Ce,s as we}from"./ui-auto.BmC9JJ_X.js";import{f as Te,s as Ee,t as De,y as Oe}from"./story-review.Bsm2JWdj.js";var C=e(t(),1),w=`tw.prompts.mounted.v1`;function ke(){try{let e=sessionStorage.getItem(r(w));if(!e)return{};let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof e==`string`&&typeof r==`string`&&(n[e]=r);return n}catch{return{}}}function Ae(e){try{sessionStorage.setItem(r(w),JSON.stringify(e))}catch{}}var T=l(),je=10;async function E(e=`.`){let{entries:t}=await d(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await E(e.path));return n}function Me({path:e,enabled:t,mounted:n}){let r=b(e,n);if(!r)return(0,T.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,T.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,s=v(e,n);return(0,T.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),s&&a?(0,T.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function D(){let e=me(`prompts`),[t,r]=(0,C.useState)(!1),[l,d]=(0,C.useState)(!0),[v,w]=(0,C.useState)(e?!0:null),[D,Ne]=(0,C.useState)(()=>e??[]),[O,k]=(0,C.useState)(null),[A,j]=(0,C.useState)(!1),[M,N]=(0,C.useState)({}),[P,F]=(0,C.useState)(null),[I,L]=(0,C.useState)(()=>i()),[R,Pe]=(0,C.useState)(()=>ke()),[z,B]=(0,C.useState)(null),[V,H]=(0,C.useState)(null),[U,W]=(0,C.useState)(``),G=pe(D,je,`prompts`),K=(0,C.useRef)(!1),q=(0,C.useRef)(!1),Fe=(0,C.useRef)(!1),J=(0,C.useRef)(!1),Ie=(0,C.useRef)(!1),Y=(0,C.useCallback)(async()=>{k(null);try{let e=await E(`.`);Ne(e),fe(`prompts`,e)}catch(e){k(e instanceof Error?e.message:String(e))}},[]);(0,C.useEffect)(()=>{if(!v||I.reqAnalysis!==!0||K.current)return;let e=new Set(D.map(e=>e.name));e.has(`需求分析提示词.md`)&&e.has(`原文结构提示词.md`)||(K.current=!0,re(!0).then(()=>Y()).catch(()=>void 0))},[v,I.reqAnalysis,D,Y]),(0,C.useEffect)(()=>{v&&I.storyReview===!0&&!q.current&&(D.some(e=>e.name===`用户故事审查提示词.md`)||(q.current=!0,Ee(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.storyReview,D,Y]),(0,C.useEffect)(()=>{v&&I.testPoints===!0&&!Fe.current&&(D.some(e=>e.name===`测试点生成提示词.md`)||(Fe.current=!0,Oe(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.testPoints,D,Y]),(0,C.useEffect)(()=>{v&&I.caseReview===!0&&!J.current&&(D.some(e=>e.name===`用例质量评审提示词.md`)||(J.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.caseReview,D,Y]),(0,C.useEffect)(()=>{v&&I.caseBlindspot===!0&&!Ie.current&&(D.some(e=>e.name===`场景遗漏补全提示词.md`)||(Ie.current=!0,ve(!0).then(()=>Y()).catch(()=>void 0)))},[v,I.caseBlindspot,D,Y]),(0,C.useEffect)(()=>{let e=s(e=>{d(!!e.prompts),L(e)});return n().then(()=>{d(a(`prompts`)),L(i()),r(!0)}),e},[]),(0,C.useEffect)(()=>{t&&l&&(async()=>{await se(`prompts`)?(await ge().catch(()=>null),await Y(),w(!0)):w(!1)})()},[t,l,Y]);let X=(0,C.useCallback)(async()=>{let e=await we(),t=a(`reports`),n=t?await Se().catch(()=>null):null;Pe(r=>{let i={};if(e)for(let t of e)i[h(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[h(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}if(I.reqAnalysis&&(i[h(ne)]=`reqAnalysis`,i[h(ie)]=`reqAnalysis`),I.storyReview&&(i[h(De)]=`storyReview`),I.testPoints&&(i[h(Te)]=`testPoints`),I.caseReview&&(i[h(be)]=`caseReview`),I.caseBlindspot&&(i[h(xe)]=`caseBlindspot`),I.caseGen)for(let e of te()){let t=(e.promptPath??``).trim();t&&(i[h(t)]=`caseGen`)}return Ae(i),i})},[I.reqAnalysis,I.storyReview,I.testPoints,I.caseReview,I.caseBlindspot,I.caseGen]);(0,C.useEffect)(()=>{if(!t||!l)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=Ce(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,l,I.uiAuto,I.reports,I.reqAnalysis,I.storyReview,I.testPoints,I.caseReview,I.caseBlindspot,I.caseGen,X]);let Z=(0,C.useMemo)(()=>Object.keys(M).filter(e=>M[e]),[M]),Q=(0,C.useCallback)(e=>{let t=b(e,R);return!t||t===`system`||de(e)?``:I[t]===!0?t:``},[R,I]);async function Le(e){j(!0),k(null);try{await ce(`prompts`,e.path)}catch(e){k(e instanceof Error?e.message:String(e))}finally{j(!1)}}async function Re(e){j(!0),k(null);try{await _e(`prompts`,e)}catch(e){k(e instanceof Error?e.message:String(e)),j(!1)}}function ze(e){if(y(e.path)){k(`默认提示词不可删除`);return}if(g(e.path,I)){k(_(e.path,I));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;k(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else F({kind:`one`,entry:e})}function Be(e){if(y(e.path)){k(`默认提示词不可改名`);return}if(g(e.path,I)){k(_(e.path,I));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;k(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else B(e),W(``)}function Ve(e){H(e),W(``)}async function He(){let e=P;if(e){F(null),j(!0),k(null);try{if(e.kind===`one`)await p(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)y(n)||g(n,I)||Q(n)?t+=1:await p(`prompts`,n);t&&k(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),N({})}await Y(),u(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);k(t),u(`删除失败:${t}`,`error`)}finally{j(!1)}}}function Ue(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:k(c(`promptGen`))}let $=(0,C.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=D.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[D]);async function We(e){let t=z;if(!t)return;let n=e.trim();if(!n||n===t.name){B(null),W(``);return}let r=$(f(t.path),n,t.path);if(r)W(`已存在同名文件「${r}」,换个名字再试`);else{j(!0),W(``);try{await ae(`prompts`,t.path,n),B(null),await Y(),u(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);W(t),u(`重命名失败:${t}`,`error`)}finally{j(!1)}}}async function Ge(e){let t=V;if(!t)return;let n=e.trim();if(!n)return;let r=$(f(t.path),n);if(r)W(`已存在同名文件「${r}」,换个名字再试`);else{j(!0),W(``);try{let{content:e}=await oe(`prompts`,t.path);await le(`prompts`,f(t.path)===`.`?n:`${f(t.path)}/${n}`,e),H(null),await Y(),u(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);W(t),u(`复制失败:${t}`,`error`)}finally{j(!1)}}}let Ke=P?.kind===`one`?`删除「${P.entry.name}」?将从 ${ue(`prompts`)} 中移除。`:P?.kind===`batch`?`确认删除已选中的 ${P.paths.length} 个提示词?此操作不可恢复。`:``;return t?l?v===null?(0,T.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,T.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):v?(0,T.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,T.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,T.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[G.query.trim()?(0,T.jsxs)(T.Fragment,{children:[`匹配 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-800`,children:G.filtered.length}),` 个`,(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,D.length]})]}):(0,T.jsxs)(T.Fragment,{children:[`共 `,(0,T.jsx)(`span`,{className:`font-medium text-stone-800`,children:D.length}),` 个提示词`]}),Z.length>0?(0,T.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,T.jsx)(`button`,{type:`button`,disabled:A||Z.length===0,onClick:()=>F({kind:`batch`,paths:Z}),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,T.jsx)(`button`,{type:`button`,disabled:A,onClick:Ue,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:`生成提示词`})]}),O?(0,T.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:O}):null,(0,T.jsx)(he,{resizeKey:`docs:prompts:cols:v1`,files:D,filtered:G.filtered,pageFiles:G.pageFiles,query:G.query,onQuery:G.setQuery,sortBy:G.sortBy,onSortBy:G.setSortBy,page:G.page,totalPages:G.totalPages,pageSize:G.pageSize,onPage:G.setPage,onPageSize:G.setPageSize,busy:A,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!m(e.path,I)&&!Q(e.path),selected:M,onToggleRow:e=>N(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>N(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Le(e),extraColumn:{header:`关联插件`,render:e=>(0,T.jsx)(Me,{path:e.path,enabled:I,mounted:R})},renderNameAction:e=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{type:`button`,disabled:A,"aria-label":`重命名 ${e.name}`,onClick:()=>Be(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,T.jsx)(S,{name:`pencil`,size:12})}),(0,T.jsx)(`button`,{type:`button`,disabled:A,"aria-label":`复制 ${e.name}`,onClick:()=>Ve(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,T.jsx)(S,{name:`copy`,size:12})})]}),renderActions:e=>{let t=m(e.path,I)||!!Q(e.path);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{type:`button`,disabled:A,onClick:()=>void Re(e),className:`inline-flex h-6 items-center whitespace-nowrap rounded bg-[#4176e6] px-2 text-xs text-white hover:bg-[#3565c7] cursor-pointer disabled:opacity-40`,children:`在会话中打开`}),(0,T.jsx)(`button`,{type:`button`,disabled:A||t,"aria-label":`删除 ${e.name}`,onClick:()=>ze(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,T.jsx)(S,{name:`trash`,size:12})})]})}}),(0,T.jsx)(x,{open:z!=null,title:`重命名提示词`,label:`文件名称`,initialValue:z?.name??``,lockExtension:!0,confirmLabel:`保存`,error:U,onClose:()=>{B(null),W(``)},onConfirm:e=>void We(e)}),(0,T.jsx)(x,{open:V!=null,title:`复制提示词`,label:`新文件名称`,initialValue:V?V.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:U,onClose:()=>{H(null),W(``)},onConfirm:e=>void Ge(e)}),(0,T.jsx)(ee,{open:P!=null,title:P?.kind===`batch`?`批量删除`:`删除提示词`,message:Ke,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>F(null),onConfirm:()=>void He()})]}):(0,T.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,T.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:c(`prompts`)}):(0,T.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,T.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,T.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{D as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{s as r}from"./plugins.C0NrHGZv.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./view-prefs.8MPl3A7e.js";import{i as d,n as f,r as p,t as m}from"./dialog.DZHZCe_T.js";import{t as h}from"./jsx-runtime.DUg_B_vD.js";import{t as g}from"./ConfirmDialog.D5qXeML0.js";import{t as _}from"./OverflowHint.pvo2Xc8R.js";import{t as v}from"./SelectDropdown.TgxIOKMD.js";import{showToast as y}from"./Toast.BO2NFckG.js";import{m as ee,p as te,u as b}from"./settings.NTeTjmxg.js";import{$ as x,A as S,B as ne,C,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as w,P as me,Q as he,R as ge,S as _e,T as ve,U as ye,V as be,W as xe,X as Se,Y as Ce,Z as we,_ as Te,a as Ee,at as De,b as Oe,c as ke,ct as T,d as Ae,et as je,f as Me,g as Ne,h as Pe,i as Fe,it as Ie,j as Le,k as Re,l as ze,m as Be,n as E,nt as Ve,o as He,ot as Ue,p as We,q as Ge,r as D,s as Ke,st as qe,t as Je,tt as Ye,u as Xe,w as Ze,x as Qe,y as $e}from"./req-analysis.
|
|
1
|
+
import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{s as r}from"./plugins.C0NrHGZv.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./view-prefs.8MPl3A7e.js";import{i as d,n as f,r as p,t as m}from"./dialog.DZHZCe_T.js";import{t as h}from"./jsx-runtime.DUg_B_vD.js";import{t as g}from"./ConfirmDialog.D5qXeML0.js";import{t as _}from"./OverflowHint.pvo2Xc8R.js";import{t as v}from"./SelectDropdown.TgxIOKMD.js";import{showToast as y}from"./Toast.BO2NFckG.js";import{m as ee,p as te,u as b}from"./settings.NTeTjmxg.js";import{$ as x,A as S,B as ne,C,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as w,P as me,Q as he,R as ge,S as _e,T as ve,U as ye,V as be,W as xe,X as Se,Y as Ce,Z as we,_ as Te,a as Ee,at as De,b as Oe,c as ke,ct as T,d as Ae,et as je,f as Me,g as Ne,h as Pe,i as Fe,it as Ie,j as Le,k as Re,l as ze,m as Be,n as E,nt as Ve,o as He,ot as Ue,p as We,q as Ge,r as D,s as Ke,st as qe,t as Je,tt as Ye,u as Xe,w as Ze,x as Qe,y as $e}from"./req-analysis.ilj0McI3.js";import{o as et}from"./project-docs.DAw9bzgk.js";import{s as tt}from"./llm.DyweO-KK.js";import{t as nt}from"./MultiSelectDropdown.y8JMbCxO.js";import{S as rt,_ as it,g as at,k as ot,m as st,u as ct}from"./PmShared.BJpoEYvk.js";import{_ as lt,a as ut,c as dt,d as ft,f as pt,g as mt,h as ht,i as gt,l as _t,m as vt,n as yt,o as bt,p as xt,r as St,s as Ct,u as wt,y as Tt}from"./story-review.Bsm2JWdj.js";import{t as Et}from"./hydrate-cache.DI6vqM0o.js";var O=e(t(),1),Dt=`可用工具(只调用这些,不要自己编工具名):
|
|
2
2
|
- req_set_outline:在已播种的文档条目下提交查询/修改子点(带 parentId、kind),返回 id 供 sourceRefs 引用。不要另造文档里没有的条目标题。同一 parentId 下按能力点拆多条子点(可多个 query、多个 mutate),勿把多个能力点合并成一条。
|
|
3
3
|
- req_insert_outline_after:在指定已有子点下方插入新的查询/修改子点(用户补充需求内容时用);afterId 固定为消息里给出的锚点;插入后同父级子点 id 按序号顺延。
|
|
4
4
|
- req_update_outline_point:按 id 更新已有查询/修改子点的标题 / 类型 / 原文(id 不变);用户变更当前点内容时用。
|